rustplus 5.6.15__tar.gz → 5.6.17__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.
Files changed (111) hide show
  1. {rustplus-5.6.15/rustplus.egg-info → rustplus-5.6.17}/PKG-INFO +1 -1
  2. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/__init__.py +1 -1
  3. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/base_rust_api.py +10 -6
  4. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/camera/camera_manager.py +5 -3
  5. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/camera/camera_parser.py +3 -3
  6. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/events/handler_list.py +3 -3
  7. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/rust_api.py +3 -10
  8. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/structures/rust_marker.py +3 -0
  9. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/commands/command_handler.py +4 -3
  10. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/utils/rust_utils.py +41 -8
  11. {rustplus-5.6.15 → rustplus-5.6.17/rustplus.egg-info}/PKG-INFO +1 -1
  12. {rustplus-5.6.15 → rustplus-5.6.17}/LICENSE +0 -0
  13. {rustplus-5.6.15 → rustplus-5.6.17}/MANIFEST.in +0 -0
  14. {rustplus-5.6.15 → rustplus-5.6.17}/README.md +0 -0
  15. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/__init__.py +0 -0
  16. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/__init__.py +0 -0
  17. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/airfield.png +0 -0
  18. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/arctic_base.png +0 -0
  19. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/bandit.png +0 -0
  20. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/barn.png +0 -0
  21. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/cargo.png +0 -0
  22. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/chinook.png +0 -0
  23. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/chinook_blades.png +0 -0
  24. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/crate.png +0 -0
  25. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/desert_base.png +0 -0
  26. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/dome.png +0 -0
  27. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/excavator.png +0 -0
  28. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/explosion.png +0 -0
  29. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/ferryterminal.png +0 -0
  30. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/fishing.png +0 -0
  31. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/harbour.png +0 -0
  32. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/icon.png +0 -0
  33. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/junkyard.png +0 -0
  34. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/large_oil_rig.png +0 -0
  35. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/launchsite.png +0 -0
  36. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/lighthouse.png +0 -0
  37. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/military_tunnels.png +0 -0
  38. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/mining_outpost.png +0 -0
  39. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/mining_quarry_hqm.png +0 -0
  40. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/mining_quarry_stone.png +0 -0
  41. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/mining_quarry_sulfur.png +0 -0
  42. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/missile_silo.png +0 -0
  43. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/outpost.png +0 -0
  44. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/oxums.png +0 -0
  45. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/patrol.png +0 -0
  46. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/power_plant.png +0 -0
  47. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/satellite.png +0 -0
  48. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/sewer.png +0 -0
  49. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/small_oil_rig.png +0 -0
  50. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/stables.png +0 -0
  51. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/supermarket.png +0 -0
  52. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/swamp.png +0 -0
  53. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/train.png +0 -0
  54. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/train_yard.png +0 -0
  55. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/underwater_lab.png +0 -0
  56. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/vending_machine.png +0 -0
  57. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/icons/water_treatment.png +0 -0
  58. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/__init__.py +0 -0
  59. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/camera/__init__.py +0 -0
  60. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/camera/camera_constants.py +0 -0
  61. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/camera/structures.py +0 -0
  62. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/events/__init__.py +0 -0
  63. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/events/event_handler.py +0 -0
  64. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/events/event_loop_manager.py +0 -0
  65. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/events/events.py +0 -0
  66. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/events/map_event_listener.py +0 -0
  67. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/events/registered_listener.py +0 -0
  68. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/fcm_listener.py +0 -0
  69. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/heartbeat.py +0 -0
  70. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/ratelimiter.py +0 -0
  71. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/rplus_version_handler.py +0 -0
  72. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/rust_remote_interface.py +0 -0
  73. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/rustplus_proto/__init__.py +0 -0
  74. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/rustplus_proto/rustplus.py +0 -0
  75. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/rustws.py +0 -0
  76. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/remote/server_checker.py +0 -0
  77. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/structures/__init__.py +0 -0
  78. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/structures/rust_chat_message.py +0 -0
  79. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/structures/rust_contents.py +0 -0
  80. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/structures/rust_entity_info.py +0 -0
  81. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/structures/rust_info.py +0 -0
  82. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/structures/rust_item.py +0 -0
  83. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/structures/rust_map.py +0 -0
  84. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/structures/rust_team_info.py +0 -0
  85. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/structures/rust_time.py +0 -0
  86. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/structures/serialization.py +0 -0
  87. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/api/structures/util.py +0 -0
  88. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/commands/__init__.py +0 -0
  89. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/commands/command.py +0 -0
  90. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/commands/command_data.py +0 -0
  91. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/commands/command_options.py +0 -0
  92. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/conversation/__init__.py +0 -0
  93. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/conversation/conversation.py +0 -0
  94. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/conversation/conversation_factory.py +0 -0
  95. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/conversation/conversation_prompt.py +0 -0
  96. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/exceptions/__init__.py +0 -0
  97. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/exceptions/exceptions.py +0 -0
  98. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/utils/__init__.py +0 -0
  99. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/utils/deprecated.py +0 -0
  100. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/utils/emojis.py +0 -0
  101. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/utils/fonts/PermanentMarker.ttf +0 -0
  102. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/utils/fonts/__init__.py +0 -0
  103. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/utils/grab_items.py +0 -0
  104. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/utils/server_id.py +0 -0
  105. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus/utils/yielding_event.py +0 -0
  106. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus.egg-info/SOURCES.txt +0 -0
  107. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus.egg-info/dependency_links.txt +0 -0
  108. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus.egg-info/requires.txt +0 -0
  109. {rustplus-5.6.15 → rustplus-5.6.17}/rustplus.egg-info/top_level.txt +0 -0
  110. {rustplus-5.6.15 → rustplus-5.6.17}/setup.cfg +0 -0
  111. {rustplus-5.6.15 → rustplus-5.6.17}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rustplus
3
- Version: 5.6.15
3
+ Version: 5.6.17
4
4
  Summary: A python wrapper for the Rust Plus API
5
5
  Home-page: https://github.com/olijeffers0n/rustplus
6
6
  Author: olijeffers0n
@@ -22,5 +22,5 @@ from .utils import *
22
22
 
23
23
  __name__ = "rustplus"
24
24
  __author__ = "olijeffers0n"
25
- __version__ = "5.6.15"
25
+ __version__ = "5.6.17"
26
26
  __support__ = "Discord: https://discord.gg/nQqJe8qvP8"
@@ -145,9 +145,11 @@ class BaseRustSocket:
145
145
  :return: None
146
146
  """
147
147
  EventLoopManager.set_loop(
148
- self.event_loop
149
- if self.event_loop is not None
150
- else asyncio.get_event_loop(),
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
- self.event_loop
159
- if self.event_loop is not None
160
- else asyncio.get_event_loop(),
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
- max_entity_amount
84
- if max_entity_amount is not None
85
- else len(self._last_packets.get_last().entities),
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
- x : x + self.scale_factor, y : y + self.scale_factor
126
- ] = distance
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
- ServerID, Dict[str, Set[RegisteredListener]]
34
- ] = defaultdict(dict)
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,7 @@ from ..utils import (
36
36
  convert_monument,
37
37
  translate_id_to_stack,
38
38
  deprecated,
39
+ generate_grid,
39
40
  )
40
41
 
41
42
 
@@ -205,17 +206,9 @@ class RustSocket(BaseRustSocket):
205
206
  game_map = image.resize((map_size, map_size), Image.LANCZOS).convert("RGBA")
206
207
 
207
208
  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
- )
209
+ grid = generate_grid(map_size)
217
210
 
218
- game_map.paste(grid, (0, 0), grid)
211
+ game_map.paste(grid, (5, 5), grid)
219
212
 
220
213
  if add_icons or add_events or add_vending_machines:
221
214
  map_markers = (
@@ -185,3 +185,6 @@ class RustMarker(Serializable):
185
185
  self._out_of_stock,
186
186
  )
187
187
  )
188
+
189
+ def __hash__(self) -> int:
190
+ return hash((self._id, self._type))
@@ -1,4 +1,5 @@
1
1
  import asyncio
2
+ import shlex
2
3
  from datetime import datetime
3
4
 
4
5
  from . import Command, CommandTime
@@ -22,7 +23,7 @@ class CommandHandler:
22
23
 
23
24
  async def run_command(self, message: RustChatMessage, prefix) -> None:
24
25
  if prefix == self.command_options.prefix:
25
- command = message.message.split(" ")[0][len(prefix) :]
26
+ command = shlex.split(message.message)[0][len(prefix) :]
26
27
  else:
27
28
  command = prefix
28
29
 
@@ -35,7 +36,7 @@ class CommandHandler:
35
36
  message.steam_id,
36
37
  CommandTime(datetime.utcfromtimestamp(message.time), message.time),
37
38
  command,
38
- message.message.split(" ")[1:],
39
+ shlex.split(message.message)[1:],
39
40
  )
40
41
  )
41
42
  else:
@@ -52,7 +53,7 @@ class CommandHandler:
52
53
  datetime.utcfromtimestamp(message.time), message.time
53
54
  ),
54
55
  command,
55
- message.message.split(" ")[1:],
56
+ shlex.split(message.message)[1:],
56
57
  ),
57
58
  )
58
59
  break
@@ -1,13 +1,14 @@
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
- icons_path = "rustplus.api.icons"
10
+ ICONS_PATH = "rustplus.api.icons"
11
+ FONT_PATH = "rustplus.utils.fonts"
11
12
  GRID_DIAMETER = 146.28571428571428
12
13
 
13
14
 
@@ -60,21 +61,21 @@ def convert_marker(name, angle) -> Image.Image:
60
61
  "8": "patrol.png",
61
62
  }
62
63
 
63
- with resources.path(icons_path, name_to_file[name]) as path:
64
+ with resources.path(ICONS_PATH, name_to_file[name]) as path:
64
65
  icon = Image.open(path).convert("RGBA")
65
66
  if name == "6":
66
67
  icon = icon.resize((85, 85))
67
68
  elif name == "2":
68
69
  icon = icon.resize((96, 96))
69
70
  elif name == "4":
70
- with resources.path(icons_path, "chinook_blades.png") as path:
71
+ with resources.path(ICONS_PATH, "chinook_blades.png") as path:
71
72
  blades = Image.open(path).convert("RGBA")
72
73
  blades = blades.resize((100, 100))
73
74
  icon.paste(blades, (64 - 50, 96 - 50), blades)
74
75
  icon.paste(blades, (64 - 50, 32 - 50), blades)
75
76
  elif name == "8":
76
77
  icon = icon.resize((200, 200))
77
- with resources.path(icons_path, "chinook_blades.png") as path:
78
+ with resources.path(ICONS_PATH, "chinook_blades.png") as path:
78
79
  blades = Image.open(path).convert("RGBA")
79
80
  blades = blades.resize((200, 200))
80
81
  icon.paste(blades, (0, 0), blades)
@@ -129,16 +130,16 @@ def convert_monument(name: str, override_images: dict) -> Image.Image:
129
130
 
130
131
  if name in name_to_file:
131
132
  file_name = name_to_file[name]
132
- with resources.path(icons_path, file_name) as path:
133
+ with resources.path(ICONS_PATH, file_name) as path:
133
134
  icon = Image.open(path).convert("RGBA")
134
135
  elif "swamp" in name:
135
- with resources.path(icons_path, "swamp.png") as path:
136
+ with resources.path(ICONS_PATH, "swamp.png") as path:
136
137
  icon = Image.open(path).convert("RGBA")
137
138
  else:
138
139
  logging.getLogger("rustplus.py").info(
139
140
  f"{name} - Has no icon, report this as an issue"
140
141
  )
141
- with resources.path(icons_path, "icon.png") as path:
142
+ with resources.path(ICONS_PATH, "icon.png") as path:
142
143
  icon = Image.open(path).convert("RGBA")
143
144
  return icon
144
145
 
@@ -228,3 +229,35 @@ def convert_xy_to_grid(
228
229
  grid_pos_number = str(int(_get_grid_y(coords[1], corrected_map_size)))
229
230
 
230
231
  return HackyBackwardsCompatCoordClass(grid_pos_letters, grid_pos_number)
232
+
233
+
234
+ def generate_grid(
235
+ map_size: int,
236
+ text_size: int = 20,
237
+ text_padding: int = 5,
238
+ color: str = "black",
239
+ ) -> Image.Image:
240
+ img = Image.new("RGBA", (map_size, map_size), (0, 0, 0, 0))
241
+ d = ImageDraw.Draw(img)
242
+
243
+ with resources.path(FONT_PATH, "PermanentMarker.ttf") as path:
244
+ font = ImageFont.truetype(str(path), text_size)
245
+
246
+ letters = list(string.ascii_uppercase)
247
+ letters.extend(
248
+ a + b for a in string.ascii_uppercase for b in string.ascii_uppercase
249
+ )
250
+
251
+ num_cells = int(map_size / GRID_DIAMETER)
252
+
253
+ for i in range(num_cells):
254
+ for j in range(num_cells):
255
+ start = (i * GRID_DIAMETER, j * GRID_DIAMETER)
256
+ end = ((i + 1) * GRID_DIAMETER, (j + 1) * GRID_DIAMETER)
257
+ d.rectangle((start, end), outline=color)
258
+
259
+ text = letters[i] + str(j)
260
+ text_pos = (start[0] + text_padding, start[1] + text_padding)
261
+ d.text(text_pos, text, fill=color, font=font)
262
+
263
+ return img
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rustplus
3
- Version: 5.6.15
3
+ Version: 5.6.17
4
4
  Summary: A python wrapper for the Rust Plus API
5
5
  Home-page: https://github.com/olijeffers0n/rustplus
6
6
  Author: olijeffers0n
File without changes
File without changes
File without changes
File without changes
File without changes