crxsnake 1.3.3__py3-none-any.whl → 1.3.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- crxsnake/__init__.py +4 -3
- crxsnake/files.py +3 -3
- crxsnake/tortoise.py +0 -3
- crxsnake/utils/convert.py +19 -0
- crxsnake/{issues → utils}/crx.py +3 -3
- crxsnake/{issues → utils}/hotline.py +43 -7
- {crxsnake-1.3.3.dist-info → crxsnake-1.3.5.dist-info}/METADATA +1 -1
- crxsnake-1.3.5.dist-info/RECORD +15 -0
- crxsnake-1.3.3.dist-info/RECORD +0 -14
- /crxsnake/{issues → utils}/__init__.py +0 -0
- /crxsnake/{misc.py → utils/misc.py} +0 -0
- {crxsnake-1.3.3.dist-info → crxsnake-1.3.5.dist-info}/LICENSE +0 -0
- {crxsnake-1.3.3.dist-info → crxsnake-1.3.5.dist-info}/WHEEL +0 -0
- {crxsnake-1.3.3.dist-info → crxsnake-1.3.5.dist-info}/top_level.txt +0 -0
crxsnake/__init__.py
CHANGED
@@ -2,10 +2,11 @@ from .logger import logger
|
|
2
2
|
from .cogs import load_cogs
|
3
3
|
from .files import read_json, write_json
|
4
4
|
from .tortoise import Database
|
5
|
-
from .misc import *
|
6
5
|
|
7
|
-
from .
|
8
|
-
from .
|
6
|
+
from .utils.misc import *
|
7
|
+
from .utils.hotline import IssueHotline
|
8
|
+
from .utils.crx import IssueCRX
|
9
|
+
from .utils.convert import steam_to_be_guid, steam_to_dayz_guid
|
9
10
|
|
10
11
|
|
11
12
|
__all__ = [
|
crxsnake/files.py
CHANGED
@@ -17,12 +17,12 @@ async def read_json(path: str, *keys: str) -> Optional[Any]:
|
|
17
17
|
for key in keys:
|
18
18
|
if key not in file_data:
|
19
19
|
return None
|
20
|
-
|
21
20
|
file_data = file_data[key]
|
21
|
+
|
22
22
|
return file_data
|
23
23
|
|
24
24
|
except Exception:
|
25
|
-
|
25
|
+
raise
|
26
26
|
|
27
27
|
|
28
28
|
async def write_json(path: str, data: Any) -> bool:
|
@@ -34,4 +34,4 @@ async def write_json(path: str, data: Any) -> bool:
|
|
34
34
|
await file.write(dumps(data, ensure_ascii=False, indent=2))
|
35
35
|
return True
|
36
36
|
except Exception:
|
37
|
-
|
37
|
+
raise
|
crxsnake/tortoise.py
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
from hashlib import sha256, md5
|
2
|
+
from base64 import b64encode
|
3
|
+
|
4
|
+
|
5
|
+
def steam_to_be_guid(steam_id: int) -> str:
|
6
|
+
parts = [0x42, 0x45] + [0] * 8
|
7
|
+
for i in range(2, 10):
|
8
|
+
steam_id, remainder = divmod(steam_id, 256)
|
9
|
+
parts[i] = remainder
|
10
|
+
|
11
|
+
byte_array = bytes(parts)
|
12
|
+
hash_object = md5(byte_array)
|
13
|
+
return hash_object.hexdigest()
|
14
|
+
|
15
|
+
|
16
|
+
def steam_to_dayz_guid(steam_id: int) -> str:
|
17
|
+
hashed = sha256()
|
18
|
+
hashed.update(str(steam_id).encode("utf-8"))
|
19
|
+
return b64encode(hashed.digest()).decode("utf-8")
|
crxsnake/{issues → utils}/crx.py
RENAMED
@@ -2,10 +2,10 @@ from typing import List, Dict, Any
|
|
2
2
|
|
3
3
|
|
4
4
|
class IssueCRX:
|
5
|
+
|
6
|
+
|
5
7
|
async def create_items(
|
6
|
-
|
7
|
-
issue_type: str,
|
8
|
-
items_list: List[Dict[str, Any]]
|
8
|
+
self, issue_type: str, items_list: List[Dict[str, Any]]
|
9
9
|
) -> Dict[str, List[Dict[str, Any]]]:
|
10
10
|
"""
|
11
11
|
Create a dictionary with generated codes and processed items.
|
@@ -5,7 +5,9 @@ from typing import List, Dict, Any, AsyncGenerator
|
|
5
5
|
|
6
6
|
class IssueHotline:
|
7
7
|
MAX_STACK = 100
|
8
|
-
|
8
|
+
"""
|
9
|
+
Hotline issue class.
|
10
|
+
"""
|
9
11
|
async def __generate_code(self) -> str:
|
10
12
|
part1 = "".join(choices(ascii_uppercase, k=2))
|
11
13
|
part2 = "".join(choices(ascii_letters + digits, k=4))
|
@@ -16,10 +18,7 @@ class IssueHotline:
|
|
16
18
|
self,
|
17
19
|
items_list: List[Dict[str, Any]]
|
18
20
|
) -> AsyncGenerator[Dict[str, Any], None]:
|
19
|
-
|
20
|
-
Generate item counts based on the MAX_STACK value.
|
21
|
-
Splits items into full stacks and the remainder.
|
22
|
-
"""
|
21
|
+
|
23
22
|
for item in items_list:
|
24
23
|
item_count = item.get("m_count", 0)
|
25
24
|
item_name = item.get("m_item", "")
|
@@ -38,6 +37,8 @@ class IssueHotline:
|
|
38
37
|
) -> Dict[str, Any]:
|
39
38
|
"""
|
40
39
|
Create a dictionary with generated codes and processed items.
|
40
|
+
|
41
|
+
items_list example: [{"m_item": "item1", "m_count": 10}, {"m_item": "item2", "m_count": 20}]
|
41
42
|
"""
|
42
43
|
processed_items = [item async for item in self.__generate_count(items_list)]
|
43
44
|
return {
|
@@ -47,8 +48,12 @@ class IssueHotline:
|
|
47
48
|
"m_name": issue_name,
|
48
49
|
"m_type": "item",
|
49
50
|
"m_itemsArray": processed_items,
|
50
|
-
"m_vehicles": {},
|
51
51
|
"m_teleport_position": "",
|
52
|
+
"m_vehicles": {
|
53
|
+
"m_item": "",
|
54
|
+
"m_attachments": [],
|
55
|
+
"m_cargo": []
|
56
|
+
},
|
52
57
|
"m_give_zone_positions": [],
|
53
58
|
"m_give_zone_positions_forbidden": [],
|
54
59
|
}
|
@@ -62,6 +67,8 @@ class IssueHotline:
|
|
62
67
|
) -> Dict[str, Any]:
|
63
68
|
"""
|
64
69
|
Create a dictionary with generated code and vehicle data.
|
70
|
+
|
71
|
+
items_dict example: {"m_item": "class_name", "m_attachments": ["class_name"], "m_cargo": null}
|
65
72
|
"""
|
66
73
|
return {
|
67
74
|
"m_CodeArray": [
|
@@ -70,10 +77,39 @@ class IssueHotline:
|
|
70
77
|
"m_name": issue_name,
|
71
78
|
"m_type": "vehicle",
|
72
79
|
"m_itemsArray": [],
|
73
|
-
"m_vehicles": items_dict,
|
74
80
|
"m_teleport_position": "",
|
81
|
+
"m_vehicles": items_dict,
|
75
82
|
"m_give_zone_positions": [],
|
76
83
|
"m_give_zone_positions_forbidden": [],
|
77
84
|
}
|
78
85
|
]
|
79
86
|
}
|
87
|
+
|
88
|
+
async def create_teleport(
|
89
|
+
self,
|
90
|
+
issue_name: str,
|
91
|
+
teleport_position: str
|
92
|
+
) -> Dict[str, Any]:
|
93
|
+
"""
|
94
|
+
Create a dictionary with generated code and teleport data.
|
95
|
+
|
96
|
+
teleport_position format: (x, y, z)
|
97
|
+
"""
|
98
|
+
return {
|
99
|
+
"m_CodeArray": [
|
100
|
+
{
|
101
|
+
"m_code": await self.__generate_code(),
|
102
|
+
"m_name": issue_name,
|
103
|
+
"m_type": "teleport",
|
104
|
+
"m_itemsArray": [],
|
105
|
+
"m_teleport_position": teleport_position,
|
106
|
+
"m_vehicles": {
|
107
|
+
"m_item": "",
|
108
|
+
"m_attachments": []
|
109
|
+
},
|
110
|
+
"m_give_zone_position": "",
|
111
|
+
"m_give_zone_radius": 0,
|
112
|
+
"m_fresh_spawn_delay": 0
|
113
|
+
}
|
114
|
+
]
|
115
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
crxsnake/__init__.py,sha256=5wsmYQtnqufR1WXHTXuDjLlWJ5eUDJTBEbE3IUr1dnY,444
|
2
|
+
crxsnake/cogs.py,sha256=yllAQ7WEES0mrIrVacAjtW103XL-Z-kdC1wWKliKTTU,602
|
3
|
+
crxsnake/files.py,sha256=eO5qGmzYXZEIWySJNFcVHec_DTew1xETOpPjQeo8574,937
|
4
|
+
crxsnake/logger.py,sha256=-TXqHfagCV-TrnwJrucKEa61BRePW34sep0K9RCbHn8,764
|
5
|
+
crxsnake/tortoise.py,sha256=zx51jsL9eMbEm7-3D2ObqrmtemUMzQxHA_mgfKOX_zM,617
|
6
|
+
crxsnake/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
crxsnake/utils/convert.py,sha256=lfS4fhePDdNJ4LS0PqT523bs34auIA5114NfZi4aaeE,542
|
8
|
+
crxsnake/utils/crx.py,sha256=iBZzz71u-TSWynynSLLfWqcr2CX_Zba4DbPwFmYd7iM,437
|
9
|
+
crxsnake/utils/hotline.py,sha256=m67Li-jByQ-9EER0USLoFsa1SnxCufwbhGvIfq2qlWM,3901
|
10
|
+
crxsnake/utils/misc.py,sha256=cgrtl9r2rlm_M9qpx-2BPVn42UEzaeSMRa2hY6YCa3g,529
|
11
|
+
crxsnake-1.3.5.dist-info/LICENSE,sha256=xt4Ru6tOCU8e2wVlx_lgx7wh-sNLKbiCbmANzr2e3cc,1085
|
12
|
+
crxsnake-1.3.5.dist-info/METADATA,sha256=bh9-fjaiq2KQWxkrTaASNydxEhxTn6q9BEGKv_oxzw8,1453
|
13
|
+
crxsnake-1.3.5.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
|
14
|
+
crxsnake-1.3.5.dist-info/top_level.txt,sha256=GOgG6tMH05czsfM6y-Tvm9LUSd-0PPuuuYkkkbWHZjQ,9
|
15
|
+
crxsnake-1.3.5.dist-info/RECORD,,
|
crxsnake-1.3.3.dist-info/RECORD
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
crxsnake/__init__.py,sha256=Va8nawElNujlj6tmw30e3X723hkBbOcX0eP96D_F9iM,375
|
2
|
-
crxsnake/cogs.py,sha256=yllAQ7WEES0mrIrVacAjtW103XL-Z-kdC1wWKliKTTU,602
|
3
|
-
crxsnake/files.py,sha256=nNFUcyYefu-DrLiT2HkWoDpMjZ9mSxLxPp0tmtSlOLg,1049
|
4
|
-
crxsnake/logger.py,sha256=-TXqHfagCV-TrnwJrucKEa61BRePW34sep0K9RCbHn8,764
|
5
|
-
crxsnake/misc.py,sha256=cgrtl9r2rlm_M9qpx-2BPVn42UEzaeSMRa2hY6YCa3g,529
|
6
|
-
crxsnake/tortoise.py,sha256=lQQzxrdXw_4reKtLVUzlD8UL3BYehUSWaeEQXd8eJ-c,682
|
7
|
-
crxsnake/issues/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
crxsnake/issues/crx.py,sha256=Ka6V7q4ISJdoH2tI_avYzT67rGWcaKFTHIX4p6V5biI,447
|
9
|
-
crxsnake/issues/hotline.py,sha256=08z38-7TCp2p086Ga_mMSY7lzH3MxdwB4mZgt4J9Nls,2722
|
10
|
-
crxsnake-1.3.3.dist-info/LICENSE,sha256=xt4Ru6tOCU8e2wVlx_lgx7wh-sNLKbiCbmANzr2e3cc,1085
|
11
|
-
crxsnake-1.3.3.dist-info/METADATA,sha256=I5x2coLsbYexC1KJwmigSG0mBUTRzP5CaN659kWWBOM,1453
|
12
|
-
crxsnake-1.3.3.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
|
13
|
-
crxsnake-1.3.3.dist-info/top_level.txt,sha256=GOgG6tMH05czsfM6y-Tvm9LUSd-0PPuuuYkkkbWHZjQ,9
|
14
|
-
crxsnake-1.3.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|