rustplus 6.1.0__tar.gz → 6.1.1__tar.gz
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.
- {rustplus-6.1.0/rustplus.egg-info → rustplus-6.1.1}/PKG-INFO +2 -1
- {rustplus-6.1.0 → rustplus-6.1.1}/requirements.txt +1 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/__init__.py +1 -1
- rustplus-6.1.1/rustplus/annotations/chat_event.py +34 -0
- rustplus-6.1.1/rustplus/annotations/clan_event.py +34 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/annotations/command.py +13 -0
- rustplus-6.1.1/rustplus/annotations/entity_event.py +32 -0
- rustplus-6.1.1/rustplus/annotations/protobuf_event.py +32 -0
- rustplus-6.1.1/rustplus/annotations/team_event.py +32 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/rust_api.py +9 -5
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/utils/__init__.py +1 -1
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/utils/utils.py +92 -50
- {rustplus-6.1.0 → rustplus-6.1.1/rustplus.egg-info}/PKG-INFO +2 -1
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus.egg-info/SOURCES.txt +0 -35
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus.egg-info/requires.txt +1 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/setup.cfg +1 -1
- rustplus-6.1.0/rustplus/annotations/chat_event.py +0 -21
- rustplus-6.1.0/rustplus/annotations/clan_event.py +0 -21
- rustplus-6.1.0/rustplus/annotations/entity_event.py +0 -19
- rustplus-6.1.0/rustplus/annotations/protobuf_event.py +0 -19
- rustplus-6.1.0/rustplus/annotations/team_event.py +0 -19
- rustplus-6.1.0/rustplus/icons/airfield.png +0 -0
- rustplus-6.1.0/rustplus/icons/arctic_base.png +0 -0
- rustplus-6.1.0/rustplus/icons/bandit.png +0 -0
- rustplus-6.1.0/rustplus/icons/barn.png +0 -0
- rustplus-6.1.0/rustplus/icons/desert_base.png +0 -0
- rustplus-6.1.0/rustplus/icons/dome.png +0 -0
- rustplus-6.1.0/rustplus/icons/excavator.png +0 -0
- rustplus-6.1.0/rustplus/icons/ferryterminal.png +0 -0
- rustplus-6.1.0/rustplus/icons/fishing.png +0 -0
- rustplus-6.1.0/rustplus/icons/harbour.png +0 -0
- rustplus-6.1.0/rustplus/icons/jungle_ziggurat.png +0 -0
- rustplus-6.1.0/rustplus/icons/junkyard.png +0 -0
- rustplus-6.1.0/rustplus/icons/large_oil_rig.png +0 -0
- rustplus-6.1.0/rustplus/icons/launchsite.png +0 -0
- rustplus-6.1.0/rustplus/icons/lighthouse.png +0 -0
- rustplus-6.1.0/rustplus/icons/military_tunnels.png +0 -0
- rustplus-6.1.0/rustplus/icons/mining_outpost.png +0 -0
- rustplus-6.1.0/rustplus/icons/mining_quarry_hqm.png +0 -0
- rustplus-6.1.0/rustplus/icons/mining_quarry_stone.png +0 -0
- rustplus-6.1.0/rustplus/icons/mining_quarry_sulfur.png +0 -0
- rustplus-6.1.0/rustplus/icons/missile_silo.png +0 -0
- rustplus-6.1.0/rustplus/icons/outpost.png +0 -0
- rustplus-6.1.0/rustplus/icons/oxums.png +0 -0
- rustplus-6.1.0/rustplus/icons/power_plant.png +0 -0
- rustplus-6.1.0/rustplus/icons/radtown.png +0 -0
- rustplus-6.1.0/rustplus/icons/satellite.png +0 -0
- rustplus-6.1.0/rustplus/icons/sewer.png +0 -0
- rustplus-6.1.0/rustplus/icons/small_oil_rig.png +0 -0
- rustplus-6.1.0/rustplus/icons/stables.png +0 -0
- rustplus-6.1.0/rustplus/icons/supermarket.png +0 -0
- rustplus-6.1.0/rustplus/icons/swamp.png +0 -0
- rustplus-6.1.0/rustplus/icons/train.png +0 -0
- rustplus-6.1.0/rustplus/icons/train_yard.png +0 -0
- rustplus-6.1.0/rustplus/icons/underwater_lab.png +0 -0
- rustplus-6.1.0/rustplus/icons/water_treatment.png +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/LICENSE +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/MANIFEST.in +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/README.md +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/annotations/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/commands/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/commands/chat_command.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/commands/chat_command_data.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/commands/command_options.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/events/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/events/chat_event.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/events/clan_info_event.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/events/entity_event.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/events/protobuf_event.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/events/team_event.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/exceptions/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/exceptions/exceptions.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/icons/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/icons/cargo.png +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/icons/chinook.png +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/icons/chinook_blades.png +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/icons/crate.png +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/icons/explosion.png +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/icons/icon.png +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/icons/patrol.png +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/icons/vending_machine.png +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/identification/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/identification/handler_list.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/identification/registered_listener.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/identification/server_details.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/camera/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/camera/camera_constants.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/camera/camera_manager.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/camera/camera_parser.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/camera/structures.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/fcm/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/fcm/fcm_listener.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/nexus/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/nexus/nexus_interface.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/proxy/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/proxy/proxy_value_grabber.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/ratelimiter/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/rustplus_proto/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/rustplus_proto/rustplus.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/websocket/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/remote/websocket/ws.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/clans/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/clans/rust_clan_info.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/clans/rust_clan_message.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/rust_chat_message.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/rust_contents.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/rust_entity_info.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/rust_error.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/rust_info.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/rust_item.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/rust_map.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/rust_marker.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/rust_team_info.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/rust_time.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/serialization.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/structs/util.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/utils/deprecated.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/utils/emojis.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/utils/fonts/PermanentMarker.ttf +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/utils/fonts/__init__.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/utils/grab_items.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus/utils/yielding_event.py +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus.egg-info/dependency_links.txt +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/rustplus.egg-info/top_level.txt +0 -0
- {rustplus-6.1.0 → rustplus-6.1.1}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rustplus
|
|
3
|
-
Version: 6.1.
|
|
3
|
+
Version: 6.1.1
|
|
4
4
|
Summary: A python wrapper for the Rust Plus API
|
|
5
5
|
Home-page: https://github.com/olijeffers0n/rustplus
|
|
6
6
|
Author: olijeffers0n
|
|
@@ -18,6 +18,7 @@ Requires-Dist: requests
|
|
|
18
18
|
Requires-Dist: numpy
|
|
19
19
|
Requires-Dist: scipy
|
|
20
20
|
Requires-Dist: betterproto==2.0.0b7
|
|
21
|
+
Requires-Dist: resvg
|
|
21
22
|
Dynamic: author
|
|
22
23
|
Dynamic: description
|
|
23
24
|
Dynamic: description-content-type
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from typing import Callable
|
|
2
|
+
|
|
3
|
+
from .. import ServerDetails
|
|
4
|
+
from ..identification import RegisteredListener
|
|
5
|
+
from ..events import ChatEventPayload as ChatEventManager
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def ChatEvent(server_details: ServerDetails) -> Callable:
|
|
9
|
+
|
|
10
|
+
def wrapper(func) -> RegisteredListener:
|
|
11
|
+
|
|
12
|
+
if isinstance(func, RegisteredListener):
|
|
13
|
+
func = func.get_coro()
|
|
14
|
+
|
|
15
|
+
listener = RegisteredListener(func.__name__, func)
|
|
16
|
+
|
|
17
|
+
ChatEventManager.HANDLER_LIST.register(listener, server_details)
|
|
18
|
+
|
|
19
|
+
return listener
|
|
20
|
+
|
|
21
|
+
if not isinstance(server_details, ServerDetails):
|
|
22
|
+
if callable(server_details):
|
|
23
|
+
message = (
|
|
24
|
+
"ChatEvent decorator requires a ServerDetails object as an argument. You have probably "
|
|
25
|
+
"forgotten the brackets on the decorator to pass the server details object."
|
|
26
|
+
)
|
|
27
|
+
else:
|
|
28
|
+
message = (
|
|
29
|
+
"ChatEvent decorator requires a ServerDetails object as an argument. Please provide a valid "
|
|
30
|
+
"ServerDetails instance."
|
|
31
|
+
)
|
|
32
|
+
raise TypeError(message)
|
|
33
|
+
|
|
34
|
+
return wrapper
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from typing import Callable
|
|
2
|
+
|
|
3
|
+
from .. import ServerDetails
|
|
4
|
+
from ..identification import RegisteredListener
|
|
5
|
+
from ..events import ClanInfoEventPayload as ClanInfoEventManager
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def ClanEvent(server_details: ServerDetails) -> Callable:
|
|
9
|
+
|
|
10
|
+
def wrapper(func) -> RegisteredListener:
|
|
11
|
+
|
|
12
|
+
if isinstance(func, RegisteredListener):
|
|
13
|
+
func = func.get_coro()
|
|
14
|
+
|
|
15
|
+
listener = RegisteredListener(func.__name__, func)
|
|
16
|
+
|
|
17
|
+
ClanInfoEventManager.HANDLER_LIST.register(listener, server_details)
|
|
18
|
+
|
|
19
|
+
return listener
|
|
20
|
+
|
|
21
|
+
if not isinstance(server_details, ServerDetails):
|
|
22
|
+
if callable(server_details):
|
|
23
|
+
message = (
|
|
24
|
+
"ClanEvent decorator requires a ServerDetails object as an argument. You have probably "
|
|
25
|
+
"forgotten the brackets on the decorator to pass the server details object."
|
|
26
|
+
)
|
|
27
|
+
else:
|
|
28
|
+
message = (
|
|
29
|
+
"ClanEvent decorator requires a ServerDetails object as an argument. Please provide a valid "
|
|
30
|
+
"ServerDetails instance."
|
|
31
|
+
)
|
|
32
|
+
raise TypeError(message)
|
|
33
|
+
|
|
34
|
+
return wrapper
|
|
@@ -20,4 +20,17 @@ def Command(
|
|
|
20
20
|
|
|
21
21
|
return RegisteredListener(func.__name__, func)
|
|
22
22
|
|
|
23
|
+
if not isinstance(server_details, ServerDetails):
|
|
24
|
+
if callable(server_details):
|
|
25
|
+
message = (
|
|
26
|
+
"Command decorator requires a ServerDetails object as an argument. You have probably "
|
|
27
|
+
"forgotten the brackets on the decorator to pass the server details object."
|
|
28
|
+
)
|
|
29
|
+
else:
|
|
30
|
+
message = (
|
|
31
|
+
"Command decorator requires a ServerDetails object as an argument. Please provide a valid "
|
|
32
|
+
"ServerDetails instance."
|
|
33
|
+
)
|
|
34
|
+
raise TypeError(message)
|
|
35
|
+
|
|
23
36
|
return wrapper
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from typing import Callable
|
|
2
|
+
|
|
3
|
+
from .. import ServerDetails
|
|
4
|
+
from ..identification import RegisteredListener
|
|
5
|
+
from ..events import EntityEventPayload as EntityEventManager
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def EntityEvent(server_details: ServerDetails, eid: int) -> Callable:
|
|
9
|
+
def wrapper(func) -> RegisteredListener:
|
|
10
|
+
if isinstance(func, RegisteredListener):
|
|
11
|
+
func = func.get_coro()
|
|
12
|
+
|
|
13
|
+
listener = RegisteredListener(str(eid), func)
|
|
14
|
+
|
|
15
|
+
EntityEventManager.HANDLER_LIST.register(listener, server_details)
|
|
16
|
+
|
|
17
|
+
return listener
|
|
18
|
+
|
|
19
|
+
if not isinstance(server_details, ServerDetails):
|
|
20
|
+
if callable(server_details):
|
|
21
|
+
message = (
|
|
22
|
+
"EntityEvent decorator requires a ServerDetails object as an argument. You have probably "
|
|
23
|
+
"forgotten the brackets on the decorator to pass the server details object."
|
|
24
|
+
)
|
|
25
|
+
else:
|
|
26
|
+
message = (
|
|
27
|
+
"EntityEvent decorator requires a ServerDetails object as an argument. Please provide a valid "
|
|
28
|
+
"ServerDetails instance."
|
|
29
|
+
)
|
|
30
|
+
raise TypeError(message)
|
|
31
|
+
|
|
32
|
+
return wrapper
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from typing import Callable
|
|
2
|
+
|
|
3
|
+
from .. import ServerDetails
|
|
4
|
+
from ..identification import RegisteredListener
|
|
5
|
+
from ..events import ProtobufEventPayload as ProtobufEventManager
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def ProtobufEvent(server_details: ServerDetails) -> Callable:
|
|
9
|
+
def wrapper(func) -> RegisteredListener:
|
|
10
|
+
if isinstance(func, RegisteredListener):
|
|
11
|
+
func = func.get_coro()
|
|
12
|
+
|
|
13
|
+
listener = RegisteredListener(func.__name__, func)
|
|
14
|
+
|
|
15
|
+
ProtobufEventManager.HANDLER_LIST.register(listener, server_details)
|
|
16
|
+
|
|
17
|
+
return listener
|
|
18
|
+
|
|
19
|
+
if not isinstance(server_details, ServerDetails):
|
|
20
|
+
if callable(server_details):
|
|
21
|
+
message = (
|
|
22
|
+
"ProtobufEvent decorator requires a ServerDetails object as an argument. You have probably "
|
|
23
|
+
"forgotten the brackets on the decorator to pass the server details object."
|
|
24
|
+
)
|
|
25
|
+
else:
|
|
26
|
+
message = (
|
|
27
|
+
"ProtobufEvent decorator requires a ServerDetails object as an argument. Please provide a valid "
|
|
28
|
+
"ServerDetails instance."
|
|
29
|
+
)
|
|
30
|
+
raise TypeError(message)
|
|
31
|
+
|
|
32
|
+
return wrapper
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
from typing import Callable
|
|
2
|
+
|
|
3
|
+
from .. import ServerDetails
|
|
4
|
+
from ..identification import RegisteredListener
|
|
5
|
+
from ..events import TeamEventPayload as TeamEventManager
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def TeamEvent(server_details: ServerDetails) -> Callable:
|
|
9
|
+
def wrapper(func) -> RegisteredListener:
|
|
10
|
+
if isinstance(func, RegisteredListener):
|
|
11
|
+
func = func.get_coro()
|
|
12
|
+
|
|
13
|
+
listener = RegisteredListener(func.__name__, func)
|
|
14
|
+
|
|
15
|
+
TeamEventManager.HANDLER_LIST.register(listener, server_details)
|
|
16
|
+
|
|
17
|
+
return listener
|
|
18
|
+
|
|
19
|
+
if not isinstance(server_details, ServerDetails):
|
|
20
|
+
if callable(server_details):
|
|
21
|
+
message = (
|
|
22
|
+
"TeamEvent decorator requires a ServerDetails object as an argument. You have probably "
|
|
23
|
+
"forgotten the brackets on the decorator to pass the server details object."
|
|
24
|
+
)
|
|
25
|
+
else:
|
|
26
|
+
message = (
|
|
27
|
+
"TeamEvent decorator requires a ServerDetails object as an argument. Please provide a valid "
|
|
28
|
+
"ServerDetails instance."
|
|
29
|
+
)
|
|
30
|
+
raise TypeError(message)
|
|
31
|
+
|
|
32
|
+
return wrapper
|
|
@@ -44,7 +44,7 @@ from .utils import (
|
|
|
44
44
|
fetch_avatar_icon,
|
|
45
45
|
format_coord,
|
|
46
46
|
convert_marker,
|
|
47
|
-
|
|
47
|
+
convert_monument_to_image,
|
|
48
48
|
)
|
|
49
49
|
from .remote.ratelimiter import RateLimiter
|
|
50
50
|
from .utils.utils import error_present
|
|
@@ -317,6 +317,9 @@ class RustSocket:
|
|
|
317
317
|
await self.get_markers() if add_events or add_vending_machines else []
|
|
318
318
|
)
|
|
319
319
|
|
|
320
|
+
if isinstance(map_markers, RustError):
|
|
321
|
+
return map_markers
|
|
322
|
+
|
|
320
323
|
if add_icons:
|
|
321
324
|
for monument in monuments:
|
|
322
325
|
if str(monument.token) == "DungeonBase":
|
|
@@ -326,11 +329,12 @@ class RustSocket:
|
|
|
326
329
|
# reported as separate markers next to the lab; they aren't
|
|
327
330
|
# standalone monuments, so don't draw them.
|
|
328
331
|
continue
|
|
329
|
-
|
|
332
|
+
|
|
330
333
|
if monument.token in override_images:
|
|
331
|
-
icon =
|
|
332
|
-
|
|
333
|
-
icon =
|
|
334
|
+
icon = override_images[monument.token].resize((150, 150))
|
|
335
|
+
else:
|
|
336
|
+
icon = convert_monument_to_image(monument.token)
|
|
337
|
+
|
|
334
338
|
output.paste(
|
|
335
339
|
icon,
|
|
336
340
|
(format_coord(int(monument.x), int(monument.y), map_size)),
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import string
|
|
3
3
|
from importlib import resources
|
|
4
|
-
from typing import Tuple
|
|
4
|
+
from typing import Tuple
|
|
5
5
|
|
|
6
6
|
import requests
|
|
7
7
|
from PIL import ImageFont, Image, ImageDraw
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from resvg import render, usvg
|
|
10
|
+
from io import BytesIO
|
|
8
11
|
|
|
9
12
|
ICONS_PATH = "rustplus.icons"
|
|
10
13
|
FONT_PATH = "rustplus.utils.fonts"
|
|
@@ -179,64 +182,69 @@ def convert_marker(marker_type: int, angle) -> Image.Image:
|
|
|
179
182
|
return icon
|
|
180
183
|
|
|
181
184
|
|
|
182
|
-
def
|
|
185
|
+
def convert_monument_to_image(name: str) -> Image.Image:
|
|
183
186
|
name_to_file = {
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
"
|
|
187
|
-
"
|
|
188
|
-
"
|
|
189
|
-
"
|
|
190
|
-
"
|
|
191
|
-
"
|
|
192
|
-
"
|
|
193
|
-
"
|
|
194
|
-
"
|
|
195
|
-
"
|
|
196
|
-
"
|
|
197
|
-
"
|
|
198
|
-
"
|
|
199
|
-
"
|
|
200
|
-
"
|
|
201
|
-
"
|
|
202
|
-
"
|
|
203
|
-
"
|
|
204
|
-
"
|
|
205
|
-
"
|
|
206
|
-
"
|
|
207
|
-
"
|
|
208
|
-
"
|
|
209
|
-
"
|
|
210
|
-
"
|
|
211
|
-
"arctic_base_a": "
|
|
212
|
-
"arctic_base_b": "
|
|
213
|
-
"
|
|
214
|
-
"
|
|
215
|
-
"
|
|
216
|
-
"
|
|
217
|
-
"
|
|
218
|
-
"
|
|
219
|
-
"
|
|
220
|
-
"
|
|
221
|
-
"radtown": "
|
|
187
|
+
"ferryterminal": "Ferry_Terminal.svg",
|
|
188
|
+
"train_tunnel_display_name": "Tunnel_Entrance.svg",
|
|
189
|
+
"train_tunnel_link_display_name": "Tunnel_Entrance.svg",
|
|
190
|
+
"apartmentcomplex": "Apartments_Complex.svg",
|
|
191
|
+
"harbor_display_name": "Harbor.svg",
|
|
192
|
+
"harbor_2_display_name": "Harbor.svg",
|
|
193
|
+
"large_fishing_village_display_name": "Fishing_Village.svg",
|
|
194
|
+
"fishing_village_display_name": "Fishing_Village.svg",
|
|
195
|
+
"AbandonedMilitaryBase": "Military_Base.svg",
|
|
196
|
+
"power_plant_display_name": "Powerplant.svg",
|
|
197
|
+
"missile_silo_monument": "Missile_Silo.svg",
|
|
198
|
+
"outpost": "Outpost.svg",
|
|
199
|
+
"bandit_camp": "Bandit_Camp.svg",
|
|
200
|
+
"stables_a": "Stables.svg",
|
|
201
|
+
"stables_b": "Stables.svg",
|
|
202
|
+
"mining_quarry_stone_display_name": "Stone_Quarry.svg",
|
|
203
|
+
"mining_quarry_sulfur_display_name": "Sulfur_Quarry.svg",
|
|
204
|
+
"mining_quarry_hqm_display_name": "HQM_Quarry.svg",
|
|
205
|
+
"satellite_dish_display_name": "Satellite_Dish.svg",
|
|
206
|
+
"dome_monument_name": "Dome.svg",
|
|
207
|
+
"junkyard_display_name": "Junkyard.svg",
|
|
208
|
+
"sewer_display_name": "Sewer_Branch.svg",
|
|
209
|
+
"oil_rig_small": "Oil_Rig_Small.svg",
|
|
210
|
+
"large_oil_rig": "Oil_Rig_Large.svg",
|
|
211
|
+
"lighthouse_display_name": "Lighthouse.svg",
|
|
212
|
+
"mining_outpost_display_name": "Mining_Outpost.svg",
|
|
213
|
+
"supermarket": "Supermarket.svg",
|
|
214
|
+
"arctic_base_a": "Arctic_Research_Base.svg",
|
|
215
|
+
"arctic_base_b": "Arctic_Research_Base.svg",
|
|
216
|
+
"launchsite": "Launch_Site.svg",
|
|
217
|
+
"water_treatment_plant_display_name": "Water_Treatment.svg",
|
|
218
|
+
"excavator": "Excavator.svg",
|
|
219
|
+
"train_yard_display_name": "Trainyard.svg",
|
|
220
|
+
"airfield_display_name": "Airfield.svg",
|
|
221
|
+
"military_tunnels_display_name": "Military_Tunnels.svg",
|
|
222
|
+
"gas_station": "Gas_Station.svg",
|
|
223
|
+
"jungle_ziggurat": "Jungle_Ziggurat.svg",
|
|
224
|
+
"radtown": "Radtown.svg",
|
|
222
225
|
}
|
|
223
226
|
|
|
224
|
-
try:
|
|
225
|
-
return override_images[name]
|
|
226
|
-
except KeyError:
|
|
227
|
-
pass
|
|
228
|
-
|
|
229
227
|
if name in name_to_file:
|
|
230
228
|
file_name = name_to_file[name]
|
|
231
229
|
with resources.path(ICONS_PATH, file_name) as path:
|
|
232
|
-
|
|
230
|
+
if file_name.endswith(".png"):
|
|
231
|
+
return Image.open(path).convert("RGBA")
|
|
232
|
+
elif file_name.endswith(".svg"):
|
|
233
|
+
return svg_to_pil(path, (150, 150))
|
|
234
|
+
else:
|
|
235
|
+
logging.getLogger("rustplus.py").info(
|
|
236
|
+
f"{name} - Has no icon, report this as an issue"
|
|
237
|
+
)
|
|
238
|
+
with resources.path(ICONS_PATH, "icon.png") as path:
|
|
239
|
+
return Image.open(path).convert("RGBA")
|
|
240
|
+
|
|
233
241
|
elif "swamp" in name:
|
|
234
|
-
with resources.path(ICONS_PATH, "
|
|
235
|
-
|
|
242
|
+
with resources.path(ICONS_PATH, "Swamp.svg") as path:
|
|
243
|
+
return svg_to_pil(path, (150, 150))
|
|
236
244
|
elif "underwater_lab" in name:
|
|
237
245
|
# Same story with swamp, no rust+ specific token so prefab name is sent instead
|
|
238
|
-
with resources.path(ICONS_PATH, "
|
|
239
|
-
|
|
246
|
+
with resources.path(ICONS_PATH, "Underwater_Lab.svg") as path:
|
|
247
|
+
return svg_to_pil(path, (150, 150))
|
|
240
248
|
else:
|
|
241
249
|
logging.getLogger("rustplus.py").info(
|
|
242
250
|
f"{name} - Has no icon, report this as an issue"
|
|
@@ -245,3 +253,37 @@ def convert_monument(name: str, override_images: Dict[str, Image.Image]) -> Imag
|
|
|
245
253
|
icon = Image.open(path).convert("RGBA")
|
|
246
254
|
|
|
247
255
|
return icon
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def svg_to_pil(filepath: str | Path, size: tuple[int, int]) -> Image.Image:
|
|
259
|
+
target_w, target_h = size
|
|
260
|
+
|
|
261
|
+
svg = Path(filepath).read_text()
|
|
262
|
+
|
|
263
|
+
opts = usvg.Options.default()
|
|
264
|
+
tree = usvg.Tree.from_str(svg, opts)
|
|
265
|
+
|
|
266
|
+
orig_w, orig_h = tree.int_size()
|
|
267
|
+
|
|
268
|
+
# Preserve aspect ratio (fit inside target)
|
|
269
|
+
scale_x = target_w / orig_w
|
|
270
|
+
scale_y = target_h / orig_h
|
|
271
|
+
scale = min(scale_x, scale_y) # use max for "cover" behavior
|
|
272
|
+
|
|
273
|
+
# center the scaled image in the target canvas
|
|
274
|
+
tx = (target_w - orig_w * scale) / 2.0
|
|
275
|
+
ty = (target_h - orig_h * scale) / 2.0
|
|
276
|
+
|
|
277
|
+
# transform tuple format: (a, b, c, d, e, f)
|
|
278
|
+
# corresponds to the affine matrix rows:
|
|
279
|
+
# [ a b c ]
|
|
280
|
+
# [ d e f ]
|
|
281
|
+
transform_fit = (scale, 0.0, tx, 0.0, scale, ty)
|
|
282
|
+
|
|
283
|
+
png_bytes = render(
|
|
284
|
+
tree,
|
|
285
|
+
transform_fit,
|
|
286
|
+
bg_size=(target_w, target_h),
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
return Image.open(BytesIO(png_bytes)).convert("RGBA")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rustplus
|
|
3
|
-
Version: 6.1.
|
|
3
|
+
Version: 6.1.1
|
|
4
4
|
Summary: A python wrapper for the Rust Plus API
|
|
5
5
|
Home-page: https://github.com/olijeffers0n/rustplus
|
|
6
6
|
Author: olijeffers0n
|
|
@@ -18,6 +18,7 @@ Requires-Dist: requests
|
|
|
18
18
|
Requires-Dist: numpy
|
|
19
19
|
Requires-Dist: scipy
|
|
20
20
|
Requires-Dist: betterproto==2.0.0b7
|
|
21
|
+
Requires-Dist: resvg
|
|
21
22
|
Dynamic: author
|
|
22
23
|
Dynamic: description
|
|
23
24
|
Dynamic: description-content-type
|
|
@@ -31,49 +31,14 @@ rustplus/events/team_event.py
|
|
|
31
31
|
rustplus/exceptions/__init__.py
|
|
32
32
|
rustplus/exceptions/exceptions.py
|
|
33
33
|
rustplus/icons/__init__.py
|
|
34
|
-
rustplus/icons/airfield.png
|
|
35
|
-
rustplus/icons/arctic_base.png
|
|
36
|
-
rustplus/icons/bandit.png
|
|
37
|
-
rustplus/icons/barn.png
|
|
38
34
|
rustplus/icons/cargo.png
|
|
39
35
|
rustplus/icons/chinook.png
|
|
40
36
|
rustplus/icons/chinook_blades.png
|
|
41
37
|
rustplus/icons/crate.png
|
|
42
|
-
rustplus/icons/desert_base.png
|
|
43
|
-
rustplus/icons/dome.png
|
|
44
|
-
rustplus/icons/excavator.png
|
|
45
38
|
rustplus/icons/explosion.png
|
|
46
|
-
rustplus/icons/ferryterminal.png
|
|
47
|
-
rustplus/icons/fishing.png
|
|
48
|
-
rustplus/icons/harbour.png
|
|
49
39
|
rustplus/icons/icon.png
|
|
50
|
-
rustplus/icons/jungle_ziggurat.png
|
|
51
|
-
rustplus/icons/junkyard.png
|
|
52
|
-
rustplus/icons/large_oil_rig.png
|
|
53
|
-
rustplus/icons/launchsite.png
|
|
54
|
-
rustplus/icons/lighthouse.png
|
|
55
|
-
rustplus/icons/military_tunnels.png
|
|
56
|
-
rustplus/icons/mining_outpost.png
|
|
57
|
-
rustplus/icons/mining_quarry_hqm.png
|
|
58
|
-
rustplus/icons/mining_quarry_stone.png
|
|
59
|
-
rustplus/icons/mining_quarry_sulfur.png
|
|
60
|
-
rustplus/icons/missile_silo.png
|
|
61
|
-
rustplus/icons/outpost.png
|
|
62
|
-
rustplus/icons/oxums.png
|
|
63
40
|
rustplus/icons/patrol.png
|
|
64
|
-
rustplus/icons/power_plant.png
|
|
65
|
-
rustplus/icons/radtown.png
|
|
66
|
-
rustplus/icons/satellite.png
|
|
67
|
-
rustplus/icons/sewer.png
|
|
68
|
-
rustplus/icons/small_oil_rig.png
|
|
69
|
-
rustplus/icons/stables.png
|
|
70
|
-
rustplus/icons/supermarket.png
|
|
71
|
-
rustplus/icons/swamp.png
|
|
72
|
-
rustplus/icons/train.png
|
|
73
|
-
rustplus/icons/train_yard.png
|
|
74
|
-
rustplus/icons/underwater_lab.png
|
|
75
41
|
rustplus/icons/vending_machine.png
|
|
76
|
-
rustplus/icons/water_treatment.png
|
|
77
42
|
rustplus/identification/__init__.py
|
|
78
43
|
rustplus/identification/handler_list.py
|
|
79
44
|
rustplus/identification/registered_listener.py
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
from typing import Callable
|
|
2
|
-
|
|
3
|
-
from .. import ServerDetails
|
|
4
|
-
from ..identification import RegisteredListener
|
|
5
|
-
from ..events import ChatEventPayload as ChatEventManager
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def ChatEvent(server_details: ServerDetails) -> Callable:
|
|
9
|
-
|
|
10
|
-
def wrapper(func) -> RegisteredListener:
|
|
11
|
-
|
|
12
|
-
if isinstance(func, RegisteredListener):
|
|
13
|
-
func = func.get_coro()
|
|
14
|
-
|
|
15
|
-
listener = RegisteredListener(func.__name__, func)
|
|
16
|
-
|
|
17
|
-
ChatEventManager.HANDLER_LIST.register(listener, server_details)
|
|
18
|
-
|
|
19
|
-
return listener
|
|
20
|
-
|
|
21
|
-
return wrapper
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
from typing import Callable
|
|
2
|
-
|
|
3
|
-
from .. import ServerDetails
|
|
4
|
-
from ..identification import RegisteredListener
|
|
5
|
-
from ..events import ClanInfoEventPayload as ClanInfoEventManager
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def ClanEvent(server_details: ServerDetails) -> Callable:
|
|
9
|
-
|
|
10
|
-
def wrapper(func) -> RegisteredListener:
|
|
11
|
-
|
|
12
|
-
if isinstance(func, RegisteredListener):
|
|
13
|
-
func = func.get_coro()
|
|
14
|
-
|
|
15
|
-
listener = RegisteredListener(func.__name__, func)
|
|
16
|
-
|
|
17
|
-
ClanInfoEventManager.HANDLER_LIST.register(listener, server_details)
|
|
18
|
-
|
|
19
|
-
return listener
|
|
20
|
-
|
|
21
|
-
return wrapper
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
from typing import Callable
|
|
2
|
-
|
|
3
|
-
from .. import ServerDetails
|
|
4
|
-
from ..identification import RegisteredListener
|
|
5
|
-
from ..events import EntityEventPayload as EntityEventManager
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def EntityEvent(server_details: ServerDetails, eid: int) -> Callable:
|
|
9
|
-
def wrapper(func) -> RegisteredListener:
|
|
10
|
-
if isinstance(func, RegisteredListener):
|
|
11
|
-
func = func.get_coro()
|
|
12
|
-
|
|
13
|
-
listener = RegisteredListener(str(eid), func)
|
|
14
|
-
|
|
15
|
-
EntityEventManager.HANDLER_LIST.register(listener, server_details)
|
|
16
|
-
|
|
17
|
-
return listener
|
|
18
|
-
|
|
19
|
-
return wrapper
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
from typing import Callable
|
|
2
|
-
|
|
3
|
-
from .. import ServerDetails
|
|
4
|
-
from ..identification import RegisteredListener
|
|
5
|
-
from ..events import ProtobufEventPayload as ProtobufEventManager
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def ProtobufEvent(server_details: ServerDetails) -> Callable:
|
|
9
|
-
def wrapper(func) -> RegisteredListener:
|
|
10
|
-
if isinstance(func, RegisteredListener):
|
|
11
|
-
func = func.get_coro()
|
|
12
|
-
|
|
13
|
-
listener = RegisteredListener(func.__name__, func)
|
|
14
|
-
|
|
15
|
-
ProtobufEventManager.HANDLER_LIST.register(listener, server_details)
|
|
16
|
-
|
|
17
|
-
return listener
|
|
18
|
-
|
|
19
|
-
return wrapper
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
from typing import Callable
|
|
2
|
-
|
|
3
|
-
from .. import ServerDetails
|
|
4
|
-
from ..identification import RegisteredListener
|
|
5
|
-
from ..events import TeamEventPayload as TeamEventManager
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def TeamEvent(server_details: ServerDetails) -> Callable:
|
|
9
|
-
def wrapper(func) -> RegisteredListener:
|
|
10
|
-
if isinstance(func, RegisteredListener):
|
|
11
|
-
func = func.get_coro()
|
|
12
|
-
|
|
13
|
-
listener = RegisteredListener(func.__name__, func)
|
|
14
|
-
|
|
15
|
-
TeamEventManager.HANDLER_LIST.register(listener, server_details)
|
|
16
|
-
|
|
17
|
-
return listener
|
|
18
|
-
|
|
19
|
-
return wrapper
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|