albibong 1.0.0__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.
Files changed (46) hide show
  1. albibong/__init__.py +82 -0
  2. albibong/classes/__init__.py +0 -0
  3. albibong/classes/character.py +83 -0
  4. albibong/classes/coords.py +9 -0
  5. albibong/classes/dungeon.py +59 -0
  6. albibong/classes/item.py +41 -0
  7. albibong/classes/location.py +48 -0
  8. albibong/classes/logger.py +122 -0
  9. albibong/classes/packet_handler.py +61 -0
  10. albibong/classes/world_data.py +327 -0
  11. albibong/gui_dist/No Equipment.png +0 -0
  12. albibong/gui_dist/assets/index-BFSx0nua.css +1 -0
  13. albibong/gui_dist/assets/index-DAndaN_4.js +161 -0
  14. albibong/gui_dist/fame.png +0 -0
  15. albibong/gui_dist/index.html +14 -0
  16. albibong/gui_dist/re_spec.png +0 -0
  17. albibong/gui_dist/silver.png +0 -0
  18. albibong/gui_dist/vite.svg +1 -0
  19. albibong/photon_packet_parser/__init__.py +4 -0
  20. albibong/photon_packet_parser/command_type.py +7 -0
  21. albibong/photon_packet_parser/crc_calculator.py +16 -0
  22. albibong/photon_packet_parser/event_data.py +4 -0
  23. albibong/photon_packet_parser/message_type.py +6 -0
  24. albibong/photon_packet_parser/number_serializer.py +22 -0
  25. albibong/photon_packet_parser/operation_request.py +4 -0
  26. albibong/photon_packet_parser/operation_response.py +6 -0
  27. albibong/photon_packet_parser/photon_packet_parser.py +168 -0
  28. albibong/photon_packet_parser/protocol16_deserializer.py +302 -0
  29. albibong/photon_packet_parser/protocol16_type.py +23 -0
  30. albibong/photon_packet_parser/segmented_packet.py +5 -0
  31. albibong/resources/EventCode.py +579 -0
  32. albibong/resources/OperationCode.py +499 -0
  33. albibong/resources/event_code.json +577 -0
  34. albibong/resources/items.json +54035 -0
  35. albibong/resources/maps.json +3565 -0
  36. albibong/resources/operation_code.json +497 -0
  37. albibong/threads/__init__.py +0 -0
  38. albibong/threads/http_server.py +60 -0
  39. albibong/threads/packet_handler_thread.py +32 -0
  40. albibong/threads/sniffer_thread.py +27 -0
  41. albibong/threads/websocket_server.py +168 -0
  42. albibong-1.0.0.dist-info/METADATA +15 -0
  43. albibong-1.0.0.dist-info/RECORD +46 -0
  44. albibong-1.0.0.dist-info/WHEEL +4 -0
  45. albibong-1.0.0.dist-info/entry_points.txt +2 -0
  46. albibong-1.0.0.dist-info/licenses/LICENSE +19 -0
@@ -0,0 +1,168 @@
1
+ import asyncio
2
+ import json
3
+ import os
4
+ import queue
5
+ import threading
6
+
7
+ import websockets
8
+
9
+ from albibong.classes.dungeon import Dungeon
10
+ from albibong.classes.logger import Logger
11
+
12
+ logger = Logger(__name__, stdout=True, log_to_file=False)
13
+ logger_file = Logger(__name__)
14
+
15
+ home_dir = os.path.expanduser("~")
16
+ FILENAME = f"{home_dir}/Albibong/list_dungeon.json"
17
+
18
+
19
+ class WebsocketServer(threading.Thread):
20
+ def __init__(self, name, in_queue) -> None:
21
+ super().__init__()
22
+ self.name = name
23
+ self.in_queue = in_queue
24
+ self.stop_event = threading.Event()
25
+ self.connections = set()
26
+
27
+ async def handler(self, websocket):
28
+ from albibong.classes.world_data import get_world_data
29
+
30
+ self.connections.add(websocket)
31
+ try:
32
+ world_data = get_world_data()
33
+ me = world_data.me
34
+ # if me.id != None:
35
+ event_init_world = {
36
+ "type": "init_world",
37
+ "payload": {
38
+ "me": {
39
+ "username": me.username,
40
+ "fame": me.fame_gained,
41
+ "re_spec": me.re_spec_gained,
42
+ "silver": me.silver_gained,
43
+ },
44
+ "world": {
45
+ "map": (
46
+ world_data.current_map.name
47
+ if world_data.current_map
48
+ else "not initialized"
49
+ ),
50
+ "dungeon": (
51
+ Dungeon.serialize(world_data.current_dungeon)
52
+ if world_data.current_dungeon
53
+ else None
54
+ ),
55
+ "isDPSMeterRunning": world_data.is_dps_meter_running,
56
+ },
57
+ },
58
+ }
59
+ # logger.info(f"initializing character: {event}")
60
+ await websocket.send(json.dumps(event_init_world))
61
+ try:
62
+ with open(FILENAME) as json_file:
63
+ list_dungeon = json.load(json_file)
64
+ event_init_dungeon_list = {
65
+ "type": "update_dungeon",
66
+ "payload": {"list_dungeon": list_dungeon},
67
+ }
68
+ except:
69
+ event_init_dungeon_list = {
70
+ "type": "update_dungeon",
71
+ "payload": {"list_dungeon": []},
72
+ }
73
+ await websocket.send(json.dumps(event_init_dungeon_list))
74
+
75
+ async for message in websocket:
76
+ event = json.loads(message)
77
+ # print(event)
78
+ if event["type"] == "update_is_dps_meter_running":
79
+ world_data.is_dps_meter_running = event["payload"]["value"]
80
+ reply = {
81
+ "type": "update_is_dps_meter_running",
82
+ "payload": {"value": world_data.is_dps_meter_running},
83
+ }
84
+ logger_file.log_dps_meter_state(world_data.is_dps_meter_running)
85
+ await websocket.send(json.dumps(reply))
86
+ elif event["type"] == "reset_dps_meter":
87
+ party_members = event["payload"]["party_members"]
88
+ for member in party_members:
89
+ char = world_data.characters[member]
90
+ char.damage_dealt = 0
91
+ char.healing_dealt = 0
92
+ reply = {
93
+ "type": "update_dps",
94
+ "payload": {
95
+ "party_members": world_data.serialize_party_members()
96
+ },
97
+ }
98
+ await websocket.send(json.dumps(reply))
99
+ elif event["type"] == "refresh_dungeon_list":
100
+ try:
101
+ with open(FILENAME) as json_file:
102
+ list_dungeon = json.load(json_file)
103
+ reply = {
104
+ "type": "update_dungeon",
105
+ "payload": {"list_dungeon": list_dungeon},
106
+ }
107
+ except:
108
+ reply = {
109
+ "type": "update_dungeon",
110
+ "payload": {"list_dungeon": []},
111
+ }
112
+ await websocket.send(json.dumps(reply))
113
+ elif event["type"] == "update_dungeon_data":
114
+ updated_tier = event["payload"]["list_dungeon"]
115
+ with open(FILENAME, "w") as json_file:
116
+ json.dump(updated_tier, json_file)
117
+
118
+ reply = {
119
+ "type": "update_dungeon",
120
+ "payload": {"list_dungeon": updated_tier},
121
+ }
122
+ await websocket.send(json.dumps(reply))
123
+
124
+ event = {}
125
+ send_event(event)
126
+ finally:
127
+ self.connections.remove(websocket)
128
+
129
+ async def main(self):
130
+ async with websockets.serve(self.handler, "", 8081):
131
+ while True:
132
+ if self.stop_event.is_set():
133
+ return
134
+
135
+ while not self.in_queue.empty():
136
+ if self.stop_event.is_set():
137
+ return
138
+
139
+ event = self.in_queue.get()
140
+ if len(self.connections) > 0:
141
+ # logger.info(f"broadcast {event}")
142
+ websockets.broadcast(self.connections, json.dumps(event))
143
+ await asyncio.sleep(0)
144
+
145
+ await asyncio.sleep(0)
146
+
147
+ def run(self):
148
+ logger.info(f"Thread {self.name} started")
149
+
150
+ loop = asyncio.new_event_loop()
151
+ asyncio.set_event_loop(loop)
152
+ loop.run_until_complete(self.main())
153
+
154
+ def stop(self):
155
+ logger.info(f"Thread {self.name} stopped")
156
+ self.stop_event.set()
157
+
158
+
159
+ event_queue = queue.Queue()
160
+ ws_server = WebsocketServer(name="ws_server", in_queue=event_queue)
161
+
162
+
163
+ def send_event(event):
164
+ event_queue.put(event)
165
+
166
+
167
+ def get_ws_server():
168
+ return ws_server
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.3
2
+ Name: albibong
3
+ Version: 1.0.0
4
+ Summary: An Albion Online damage, heal and dungeon tracker for UNIX-based operating systems
5
+ Project-URL: Homepage, https://github.com/imjangkar/albibong
6
+ Project-URL: Issues, https://github.com/imjangkar/albibong/issues
7
+ Author-email: imjangkar <imjangkar@gmail.com>
8
+ License-File: LICENSE
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.8
13
+ Requires-Dist: pywebview==5.1
14
+ Requires-Dist: scapy==2.5.0
15
+ Requires-Dist: websockets==12.0
@@ -0,0 +1,46 @@
1
+ albibong/__init__.py,sha256=oN1a84hbyVBUNvwVEPCx_G9kd6uO0SNKuBxGNTa1Zao,1838
2
+ albibong/classes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ albibong/classes/character.py,sha256=FA5zITu3kPCw5VHrsseimDOERpuDOoVa_a8dPIqCMZ8,2529
4
+ albibong/classes/coords.py,sha256=wjCO7YnKXzH9IsJ9YFObbpMYfVFT5o38RndWjQhjVEg,189
5
+ albibong/classes/dungeon.py,sha256=DWvBWi-iy_94ZoeiOivvj2CtcQ23PJdt2sZARima6NI,1700
6
+ albibong/classes/item.py,sha256=Lk-PggyOx-tSanoqD9Hj03jqqHmDzlABH4OEQcYT9ZA,1105
7
+ albibong/classes/location.py,sha256=b8SyZ_c6tzQz51B-7__T7e1I_Dghz7BIay9E2zVWTqY,1262
8
+ albibong/classes/logger.py,sha256=Z51pTZttZeoow3fDa9hFoaZrtfYb4JtBmcK7dRtkLko,4243
9
+ albibong/classes/packet_handler.py,sha256=RvbFx6rnSacXpvHh8eW4rQs-zgsouBd2HlYEE_s4spk,1655
10
+ albibong/classes/world_data.py,sha256=XlDc2NeRm0Soq7vCm2TDFew7TV0I5ref1g-JYcQm88I,12952
11
+ albibong/gui_dist/No Equipment.png,sha256=HdVR3WJ0ktF5v606QyURdHscjOgCqiXJnqI8k8IlSgE,131
12
+ albibong/gui_dist/fame.png,sha256=X2tUCmgR5TkGLUVvFB2lInH_RrXkC1pSLqpw_ply-rE,6015
13
+ albibong/gui_dist/index.html,sha256=jMnQKh8Lwfm0belxWN0KT34g-CsMLx4iqHt_VThkvFQ,464
14
+ albibong/gui_dist/re_spec.png,sha256=1KTzGT1u1wjmNk9svS5ZOV7zCDIEmiFy0USh6A_vhPA,6230
15
+ albibong/gui_dist/silver.png,sha256=tqXvZdf9zr0YoOQZoR2vG8NRffl4xvz0LY5XgwIrYD8,11533
16
+ albibong/gui_dist/vite.svg,sha256=SnSK_UQ5GLsWWRyDTEAdrjPoeGGrXbrQgRw6O0qSFPs,1497
17
+ albibong/gui_dist/assets/index-BFSx0nua.css,sha256=5Gz7BjRUjMkcwlZA6qEWLS0lBY833vU33vMDSOHXwgg,2233
18
+ albibong/gui_dist/assets/index-DAndaN_4.js,sha256=06w5huhYX9gD68YDeaAlX6qW-3i3pmp6wQV5-5n9qr4,438031
19
+ albibong/photon_packet_parser/__init__.py,sha256=Y_XwBGLl0ufhLr7d6phhfA6qL1RrG6mJ3qAC5lNKM_c,301
20
+ albibong/photon_packet_parser/command_type.py,sha256=-LSdpsQgViDygDJsjaoCUuLbBkK4-pmQuM8ESHG1BNk,137
21
+ albibong/photon_packet_parser/crc_calculator.py,sha256=rnhmknjiZBaSXBwS2cJacwLlnXaT74u9yEmvLknIh2o,402
22
+ albibong/photon_packet_parser/event_data.py,sha256=zZcxy51eylw0YjSwaMuEHBlzd13Pr7DmU2hyAQEd3hE,123
23
+ albibong/photon_packet_parser/message_type.py,sha256=oJW56zvdUijzmEdAQ7CHfeYZmN0WknkBGQYvMkS0kZA,117
24
+ albibong/photon_packet_parser/number_serializer.py,sha256=JigFyqDeJZjXB9fIuYchQzvXzOWXKiwlrRc5uAd0M7E,577
25
+ albibong/photon_packet_parser/operation_request.py,sha256=WYu4TOvgkJpfUlhveJVrbF0HWBAdW3y2ZdVuvgA3AVw,162
26
+ albibong/photon_packet_parser/operation_response.py,sha256=-IKoy92H21vpmfSpILoPnNM3JTrGDPyxKPuBmnjLJlI,273
27
+ albibong/photon_packet_parser/photon_packet_parser.py,sha256=ayPObVh3LQLWsvJxSMpuFrXKgXzTQxqE-BxNJM9z9uY,6374
28
+ albibong/photon_packet_parser/protocol16_deserializer.py,sha256=apZZUI0_c5yF9BN-E3DihenClCYCxlGifnNSe_uj3p8,11646
29
+ albibong/photon_packet_parser/protocol16_type.py,sha256=r1DLNl_mmaEvb9v7W_OOlp5hikp5UeEgrzpQgl7efBw,451
30
+ albibong/photon_packet_parser/segmented_packet.py,sha256=pftqyVO0D7ZX8m1ZL2w2Xt_g1Nc_mClXvQ99FOBn41E,235
31
+ albibong/resources/EventCode.py,sha256=90pjJln6Pha2-VytzkMbDg7D_Fu6Dx6g6omTDxQz_JM,18864
32
+ albibong/resources/OperationCode.py,sha256=y-aBW8u-UkAd5QjWP1-0CAPFWgtttU-U3q_cJZrQy1w,16356
33
+ albibong/resources/event_code.json,sha256=aWBziHVmNrKSYsYqHyg5wmqXc212ILAznI1jM1EzsCs,19970
34
+ albibong/resources/items.json,sha256=BET-GKhyviSX5k0ibC9U2nLNQ0t1BN7VTIO586TR6yg,1368513
35
+ albibong/resources/maps.json,sha256=MZsF4wx4_U3cgOxY3gxYQeATAOJOfZ4pug-JXev3yqY,123681
36
+ albibong/resources/operation_code.json,sha256=8CQngMdC_h7iUZoXzvEtVVy0rq3l73vpr4_1R1yRRWE,17298
37
+ albibong/threads/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
+ albibong/threads/http_server.py,sha256=fNy4CzaIZC7NCZG2uYc-KHt9hGfBiuZWIEMFwq1DfVg,1900
39
+ albibong/threads/packet_handler_thread.py,sha256=bqgYQUeCaTtnWgx4bGoqw-cWQcXRJohIse2hwCbVLmo,949
40
+ albibong/threads/sniffer_thread.py,sha256=tgnRAbTje4tgJz57qku-vQwr2MAdVpLwdcFyWUpk4XI,766
41
+ albibong/threads/websocket_server.py,sha256=MUVJwL-GPwuXnf5IqVr6M4R43rk17tCCMj0_U60IdPg,6169
42
+ albibong-1.0.0.dist-info/METADATA,sha256=RKz-6krPUWeb4tgXhAHfGi7h81G0ZsVG0q_YxtCbwZA,598
43
+ albibong-1.0.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
44
+ albibong-1.0.0.dist-info/entry_points.txt,sha256=pLvUeo6eUwvsDQXsxdP9mRdSPufUlrz_9mFxsov0nm0,43
45
+ albibong-1.0.0.dist-info/licenses/LICENSE,sha256=7EI8xVBu6h_7_JlVw-yPhhOZlpY9hP8wal7kHtqKT_E,1074
46
+ albibong-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.24.2
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ albibong = albibong:main
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2018 The Python Packaging Authority
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.