rustplus 5.6.16__tar.gz → 5.6.18__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-5.6.16/rustplus.egg-info → rustplus-5.6.18}/PKG-INFO +2 -3
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/__init__.py +1 -1
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/base_rust_api.py +10 -6
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/camera/camera_manager.py +5 -3
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/camera/camera_parser.py +3 -3
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/events/handler_list.py +3 -3
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/rust_api.py +28 -11
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/utils/rust_utils.py +75 -8
- {rustplus-5.6.16 → rustplus-5.6.18/rustplus.egg-info}/PKG-INFO +2 -3
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus.egg-info/requires.txt +1 -2
- {rustplus-5.6.16 → rustplus-5.6.18}/LICENSE +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/MANIFEST.in +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/README.md +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/__init__.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/__init__.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/airfield.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/arctic_base.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/bandit.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/barn.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/cargo.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/chinook.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/chinook_blades.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/crate.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/desert_base.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/dome.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/excavator.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/explosion.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/ferryterminal.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/fishing.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/harbour.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/icon.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/junkyard.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/large_oil_rig.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/launchsite.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/lighthouse.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/military_tunnels.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/mining_outpost.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/mining_quarry_hqm.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/mining_quarry_stone.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/mining_quarry_sulfur.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/missile_silo.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/outpost.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/oxums.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/patrol.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/power_plant.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/satellite.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/sewer.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/small_oil_rig.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/stables.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/supermarket.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/swamp.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/train.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/train_yard.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/underwater_lab.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/vending_machine.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/icons/water_treatment.png +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/__init__.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/camera/__init__.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/camera/camera_constants.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/camera/structures.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/events/__init__.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/events/event_handler.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/events/event_loop_manager.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/events/events.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/events/map_event_listener.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/events/registered_listener.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/fcm_listener.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/heartbeat.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/ratelimiter.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/rplus_version_handler.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/rust_remote_interface.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/rustplus_proto/__init__.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/rustplus_proto/rustplus.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/rustws.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/remote/server_checker.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/structures/__init__.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/structures/rust_chat_message.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/structures/rust_contents.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/structures/rust_entity_info.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/structures/rust_info.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/structures/rust_item.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/structures/rust_map.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/structures/rust_marker.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/structures/rust_team_info.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/structures/rust_time.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/structures/serialization.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/api/structures/util.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/commands/__init__.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/commands/command.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/commands/command_data.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/commands/command_handler.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/commands/command_options.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/conversation/__init__.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/conversation/conversation.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/conversation/conversation_factory.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/conversation/conversation_prompt.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/exceptions/__init__.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/exceptions/exceptions.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/utils/__init__.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/utils/deprecated.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/utils/emojis.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/utils/fonts/PermanentMarker.ttf +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/utils/fonts/__init__.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/utils/grab_items.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/utils/server_id.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus/utils/yielding_event.py +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus.egg-info/SOURCES.txt +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus.egg-info/dependency_links.txt +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/rustplus.egg-info/top_level.txt +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/setup.cfg +0 -0
- {rustplus-5.6.16 → rustplus-5.6.18}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: rustplus
|
|
3
|
-
Version: 5.6.
|
|
3
|
+
Version: 5.6.18
|
|
4
4
|
Summary: A python wrapper for the Rust Plus API
|
|
5
5
|
Home-page: https://github.com/olijeffers0n/rustplus
|
|
6
6
|
Author: olijeffers0n
|
|
@@ -12,13 +12,12 @@ License-File: LICENSE
|
|
|
12
12
|
Requires-Dist: websockets
|
|
13
13
|
Requires-Dist: Pillow
|
|
14
14
|
Requires-Dist: asyncio
|
|
15
|
-
Requires-Dist: rustPlusPushReceiver==0.
|
|
15
|
+
Requires-Dist: rustPlusPushReceiver==0.6.0
|
|
16
16
|
Requires-Dist: http-ece
|
|
17
17
|
Requires-Dist: requests
|
|
18
18
|
Requires-Dist: numpy
|
|
19
19
|
Requires-Dist: scipy
|
|
20
20
|
Requires-Dist: betterproto==2.0.0b6
|
|
21
|
-
Requires-Dist: shlex
|
|
22
21
|
|
|
23
22
|

|
|
24
23
|
<div align = "center">
|
|
@@ -145,9 +145,11 @@ class BaseRustSocket:
|
|
|
145
145
|
:return: None
|
|
146
146
|
"""
|
|
147
147
|
EventLoopManager.set_loop(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
(
|
|
149
|
+
self.event_loop
|
|
150
|
+
if self.event_loop is not None
|
|
151
|
+
else asyncio.get_event_loop()
|
|
152
|
+
),
|
|
151
153
|
self.server_id,
|
|
152
154
|
)
|
|
153
155
|
|
|
@@ -155,9 +157,11 @@ class BaseRustSocket:
|
|
|
155
157
|
ServerChecker(self.server_id.ip, self.server_id.port).run()
|
|
156
158
|
|
|
157
159
|
EventLoopManager.set_loop(
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
(
|
|
161
|
+
self.event_loop
|
|
162
|
+
if self.event_loop is not None
|
|
163
|
+
else asyncio.get_event_loop()
|
|
164
|
+
),
|
|
161
165
|
self.server_id,
|
|
162
166
|
)
|
|
163
167
|
|
|
@@ -80,9 +80,11 @@ class CameraManager:
|
|
|
80
80
|
last_packet.vertical_fov,
|
|
81
81
|
self._cam_info_message.far_plane,
|
|
82
82
|
entity_render_distance,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
(
|
|
84
|
+
max_entity_amount
|
|
85
|
+
if max_entity_amount is not None
|
|
86
|
+
else len(self._last_packets.get_last().entities)
|
|
87
|
+
),
|
|
86
88
|
)
|
|
87
89
|
|
|
88
90
|
async def get_frame(
|
|
@@ -121,9 +121,9 @@ class Parser:
|
|
|
121
121
|
] = (208, 230, 252)
|
|
122
122
|
distance = float("inf")
|
|
123
123
|
|
|
124
|
-
self.depth_output[
|
|
125
|
-
|
|
126
|
-
|
|
124
|
+
self.depth_output[x : x + self.scale_factor, y : y + self.scale_factor] = (
|
|
125
|
+
distance
|
|
126
|
+
)
|
|
127
127
|
|
|
128
128
|
return False
|
|
129
129
|
|
|
@@ -29,9 +29,9 @@ class HandlerList:
|
|
|
29
29
|
class EntityHandlerList(HandlerList):
|
|
30
30
|
def __init__(self) -> None:
|
|
31
31
|
super().__init__()
|
|
32
|
-
self._handlers: Dict[
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
self._handlers: Dict[ServerID, Dict[str, Set[RegisteredListener]]] = (
|
|
33
|
+
defaultdict(dict)
|
|
34
|
+
)
|
|
35
35
|
|
|
36
36
|
def unregister(self, listener: RegisteredListener, server_id: ServerID) -> None:
|
|
37
37
|
if listener.listener_id in self._handlers.get(server_id):
|
|
@@ -36,6 +36,8 @@ from ..utils import (
|
|
|
36
36
|
convert_monument,
|
|
37
37
|
translate_id_to_stack,
|
|
38
38
|
deprecated,
|
|
39
|
+
generate_grid,
|
|
40
|
+
avatar_processing,
|
|
39
41
|
)
|
|
40
42
|
|
|
41
43
|
|
|
@@ -167,6 +169,7 @@ class RustSocket(BaseRustSocket):
|
|
|
167
169
|
add_icons: bool = False,
|
|
168
170
|
add_events: bool = False,
|
|
169
171
|
add_vending_machines: bool = False,
|
|
172
|
+
add_team_positions: bool = False,
|
|
170
173
|
override_images: dict = None,
|
|
171
174
|
add_grid: bool = False,
|
|
172
175
|
) -> Image.Image:
|
|
@@ -180,7 +183,7 @@ class RustSocket(BaseRustSocket):
|
|
|
180
183
|
+ (
|
|
181
184
|
1
|
|
182
185
|
if [add_icons, add_events, add_vending_machines].count(True) >= 1
|
|
183
|
-
else 0
|
|
186
|
+
else 0 + 1 if add_team_positions else 0
|
|
184
187
|
)
|
|
185
188
|
)
|
|
186
189
|
|
|
@@ -205,17 +208,9 @@ class RustSocket(BaseRustSocket):
|
|
|
205
208
|
game_map = image.resize((map_size, map_size), Image.LANCZOS).convert("RGBA")
|
|
206
209
|
|
|
207
210
|
if add_grid:
|
|
208
|
-
grid = (
|
|
209
|
-
Image.open(
|
|
210
|
-
requests.get(
|
|
211
|
-
f"https://files.rustmaps.com/grids/{map_size}.png", stream=True
|
|
212
|
-
).raw
|
|
213
|
-
)
|
|
214
|
-
.resize((map_size, map_size), Image.LANCZOS)
|
|
215
|
-
.convert("RGBA")
|
|
216
|
-
)
|
|
211
|
+
grid = generate_grid(map_size)
|
|
217
212
|
|
|
218
|
-
game_map.paste(grid, (
|
|
213
|
+
game_map.paste(grid, (5, 5), grid)
|
|
219
214
|
|
|
220
215
|
if add_icons or add_events or add_vending_machines:
|
|
221
216
|
map_markers = (
|
|
@@ -278,6 +273,28 @@ class RustSocket(BaseRustSocket):
|
|
|
278
273
|
(int(marker.x) - 50, map_size - int(marker.y) - 50),
|
|
279
274
|
vending_machine,
|
|
280
275
|
)
|
|
276
|
+
if add_team_positions:
|
|
277
|
+
team = await self.get_team_info()
|
|
278
|
+
for member in team.members:
|
|
279
|
+
if member.is_alive:
|
|
280
|
+
avatar = (
|
|
281
|
+
Image.open(
|
|
282
|
+
requests.get(
|
|
283
|
+
f"https://companion-rust.facepunch.com/api/avatar/{member.steam_id}",
|
|
284
|
+
stream=True,
|
|
285
|
+
).raw
|
|
286
|
+
)
|
|
287
|
+
.resize((100, 100), Image.LANCZOS)
|
|
288
|
+
.convert("RGBA")
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
player_avatar = avatar_processing(avatar, 5, member.is_online)
|
|
292
|
+
|
|
293
|
+
game_map.paste(
|
|
294
|
+
player_avatar,
|
|
295
|
+
(format_coord(int(member.x), int(member.y), map_size)),
|
|
296
|
+
player_avatar,
|
|
297
|
+
)
|
|
281
298
|
|
|
282
299
|
return game_map.resize((2000, 2000), Image.LANCZOS)
|
|
283
300
|
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
from importlib import resources
|
|
2
2
|
from typing import Tuple
|
|
3
|
-
from PIL import Image
|
|
3
|
+
from PIL import Image, ImageDraw, ImageFont
|
|
4
4
|
import logging
|
|
5
5
|
import string
|
|
6
6
|
|
|
7
7
|
from ..api.remote.rustplus_proto import AppMessage
|
|
8
8
|
from ..api.structures import RustTime
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
ICONS_PATH = "rustplus.api.icons"
|
|
11
|
+
FONT_PATH = "rustplus.utils.fonts"
|
|
11
12
|
GRID_DIAMETER = 146.28571428571428
|
|
12
13
|
|
|
14
|
+
PLAYER_MARKER_ONLINE_COLOR = (201, 242, 155, 255)
|
|
15
|
+
PLAYER_MARKER_OFFLINE_COLOR = (128, 128, 128, 255)
|
|
16
|
+
|
|
13
17
|
|
|
14
18
|
def format_time(protobuf: AppMessage) -> RustTime:
|
|
15
19
|
def convert_time(time) -> str:
|
|
@@ -60,21 +64,21 @@ def convert_marker(name, angle) -> Image.Image:
|
|
|
60
64
|
"8": "patrol.png",
|
|
61
65
|
}
|
|
62
66
|
|
|
63
|
-
with resources.path(
|
|
67
|
+
with resources.path(ICONS_PATH, name_to_file[name]) as path:
|
|
64
68
|
icon = Image.open(path).convert("RGBA")
|
|
65
69
|
if name == "6":
|
|
66
70
|
icon = icon.resize((85, 85))
|
|
67
71
|
elif name == "2":
|
|
68
72
|
icon = icon.resize((96, 96))
|
|
69
73
|
elif name == "4":
|
|
70
|
-
with resources.path(
|
|
74
|
+
with resources.path(ICONS_PATH, "chinook_blades.png") as path:
|
|
71
75
|
blades = Image.open(path).convert("RGBA")
|
|
72
76
|
blades = blades.resize((100, 100))
|
|
73
77
|
icon.paste(blades, (64 - 50, 96 - 50), blades)
|
|
74
78
|
icon.paste(blades, (64 - 50, 32 - 50), blades)
|
|
75
79
|
elif name == "8":
|
|
76
80
|
icon = icon.resize((200, 200))
|
|
77
|
-
with resources.path(
|
|
81
|
+
with resources.path(ICONS_PATH, "chinook_blades.png") as path:
|
|
78
82
|
blades = Image.open(path).convert("RGBA")
|
|
79
83
|
blades = blades.resize((200, 200))
|
|
80
84
|
icon.paste(blades, (0, 0), blades)
|
|
@@ -129,16 +133,16 @@ def convert_monument(name: str, override_images: dict) -> Image.Image:
|
|
|
129
133
|
|
|
130
134
|
if name in name_to_file:
|
|
131
135
|
file_name = name_to_file[name]
|
|
132
|
-
with resources.path(
|
|
136
|
+
with resources.path(ICONS_PATH, file_name) as path:
|
|
133
137
|
icon = Image.open(path).convert("RGBA")
|
|
134
138
|
elif "swamp" in name:
|
|
135
|
-
with resources.path(
|
|
139
|
+
with resources.path(ICONS_PATH, "swamp.png") as path:
|
|
136
140
|
icon = Image.open(path).convert("RGBA")
|
|
137
141
|
else:
|
|
138
142
|
logging.getLogger("rustplus.py").info(
|
|
139
143
|
f"{name} - Has no icon, report this as an issue"
|
|
140
144
|
)
|
|
141
|
-
with resources.path(
|
|
145
|
+
with resources.path(ICONS_PATH, "icon.png") as path:
|
|
142
146
|
icon = Image.open(path).convert("RGBA")
|
|
143
147
|
return icon
|
|
144
148
|
|
|
@@ -228,3 +232,66 @@ def convert_xy_to_grid(
|
|
|
228
232
|
grid_pos_number = str(int(_get_grid_y(coords[1], corrected_map_size)))
|
|
229
233
|
|
|
230
234
|
return HackyBackwardsCompatCoordClass(grid_pos_letters, grid_pos_number)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def generate_grid(
|
|
238
|
+
map_size: int,
|
|
239
|
+
text_size: int = 20,
|
|
240
|
+
text_padding: int = 5,
|
|
241
|
+
color: str = "black",
|
|
242
|
+
) -> Image.Image:
|
|
243
|
+
img = Image.new("RGBA", (map_size, map_size), (0, 0, 0, 0))
|
|
244
|
+
d = ImageDraw.Draw(img)
|
|
245
|
+
|
|
246
|
+
with resources.path(FONT_PATH, "PermanentMarker.ttf") as path:
|
|
247
|
+
font = ImageFont.truetype(str(path), text_size)
|
|
248
|
+
|
|
249
|
+
letters = list(string.ascii_uppercase)
|
|
250
|
+
letters.extend(
|
|
251
|
+
a + b for a in string.ascii_uppercase for b in string.ascii_uppercase
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
num_cells = int(map_size / GRID_DIAMETER)
|
|
255
|
+
|
|
256
|
+
for i in range(num_cells):
|
|
257
|
+
for j in range(num_cells):
|
|
258
|
+
start = (i * GRID_DIAMETER, j * GRID_DIAMETER)
|
|
259
|
+
end = ((i + 1) * GRID_DIAMETER, (j + 1) * GRID_DIAMETER)
|
|
260
|
+
d.rectangle((start, end), outline=color)
|
|
261
|
+
|
|
262
|
+
text = letters[i] + str(j)
|
|
263
|
+
text_pos = (start[0] + text_padding, start[1] + text_padding)
|
|
264
|
+
d.text(text_pos, text, fill=color, font=font)
|
|
265
|
+
|
|
266
|
+
return img
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def avatar_processing(
|
|
270
|
+
image: Image.Image, border_size: int, player_online: bool = False
|
|
271
|
+
) -> Image.Image:
|
|
272
|
+
size_with_border = (
|
|
273
|
+
image.size[0] + 2 * border_size,
|
|
274
|
+
image.size[1] + 2 * border_size,
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
border_image = Image.new("RGBA", size_with_border, (0, 0, 0, 0))
|
|
278
|
+
|
|
279
|
+
mask = Image.new("L", size_with_border, 0)
|
|
280
|
+
draw = ImageDraw.Draw(mask)
|
|
281
|
+
|
|
282
|
+
draw.ellipse([0, 0, size_with_border[0], size_with_border[1]], fill=255)
|
|
283
|
+
|
|
284
|
+
border_layer = Image.new(
|
|
285
|
+
"RGBA",
|
|
286
|
+
size_with_border,
|
|
287
|
+
PLAYER_MARKER_ONLINE_COLOR if player_online else PLAYER_MARKER_OFFLINE_COLOR,
|
|
288
|
+
)
|
|
289
|
+
border_image.paste(border_layer, mask=mask)
|
|
290
|
+
|
|
291
|
+
image_mask = Image.new("L", image.size, 0)
|
|
292
|
+
draw = ImageDraw.Draw(image_mask)
|
|
293
|
+
draw.ellipse([0, 0, image.size[0], image.size[1]], fill=255)
|
|
294
|
+
|
|
295
|
+
border_image.paste(image, (border_size, border_size), image_mask)
|
|
296
|
+
|
|
297
|
+
return border_image
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: rustplus
|
|
3
|
-
Version: 5.6.
|
|
3
|
+
Version: 5.6.18
|
|
4
4
|
Summary: A python wrapper for the Rust Plus API
|
|
5
5
|
Home-page: https://github.com/olijeffers0n/rustplus
|
|
6
6
|
Author: olijeffers0n
|
|
@@ -12,13 +12,12 @@ License-File: LICENSE
|
|
|
12
12
|
Requires-Dist: websockets
|
|
13
13
|
Requires-Dist: Pillow
|
|
14
14
|
Requires-Dist: asyncio
|
|
15
|
-
Requires-Dist: rustPlusPushReceiver==0.
|
|
15
|
+
Requires-Dist: rustPlusPushReceiver==0.6.0
|
|
16
16
|
Requires-Dist: http-ece
|
|
17
17
|
Requires-Dist: requests
|
|
18
18
|
Requires-Dist: numpy
|
|
19
19
|
Requires-Dist: scipy
|
|
20
20
|
Requires-Dist: betterproto==2.0.0b6
|
|
21
|
-
Requires-Dist: shlex
|
|
22
21
|
|
|
23
22
|

|
|
24
23
|
<div align = "center">
|
|
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
|
|
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
|