rustplus 6.0.12__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.0.12/rustplus.egg-info → rustplus-6.1.1}/PKG-INFO +4 -1
- {rustplus-6.0.12 → rustplus-6.1.1}/README.md +2 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/requirements.txt +1 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/__init__.py +2 -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.0.12 → 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.1/rustplus/remote/camera/camera_constants.py +32 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/remote/camera/camera_manager.py +4 -4
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/remote/camera/camera_parser.py +86 -3
- rustplus-6.1.1/rustplus/remote/nexus/__init__.py +1 -0
- rustplus-6.1.1/rustplus/remote/nexus/nexus_interface.py +45 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/rust_api.py +36 -5
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/__init__.py +1 -1
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/util.py +6 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/utils/__init__.py +1 -1
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/utils/utils.py +92 -50
- {rustplus-6.0.12 → rustplus-6.1.1/rustplus.egg-info}/PKG-INFO +4 -1
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus.egg-info/SOURCES.txt +2 -35
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus.egg-info/requires.txt +1 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/setup.cfg +1 -1
- rustplus-6.0.12/rustplus/annotations/chat_event.py +0 -21
- rustplus-6.0.12/rustplus/annotations/clan_event.py +0 -21
- rustplus-6.0.12/rustplus/annotations/entity_event.py +0 -19
- rustplus-6.0.12/rustplus/annotations/protobuf_event.py +0 -19
- rustplus-6.0.12/rustplus/annotations/team_event.py +0 -19
- rustplus-6.0.12/rustplus/icons/airfield.png +0 -0
- rustplus-6.0.12/rustplus/icons/arctic_base.png +0 -0
- rustplus-6.0.12/rustplus/icons/bandit.png +0 -0
- rustplus-6.0.12/rustplus/icons/barn.png +0 -0
- rustplus-6.0.12/rustplus/icons/desert_base.png +0 -0
- rustplus-6.0.12/rustplus/icons/dome.png +0 -0
- rustplus-6.0.12/rustplus/icons/excavator.png +0 -0
- rustplus-6.0.12/rustplus/icons/ferryterminal.png +0 -0
- rustplus-6.0.12/rustplus/icons/fishing.png +0 -0
- rustplus-6.0.12/rustplus/icons/harbour.png +0 -0
- rustplus-6.0.12/rustplus/icons/jungle_ziggurat.png +0 -0
- rustplus-6.0.12/rustplus/icons/junkyard.png +0 -0
- rustplus-6.0.12/rustplus/icons/large_oil_rig.png +0 -0
- rustplus-6.0.12/rustplus/icons/launchsite.png +0 -0
- rustplus-6.0.12/rustplus/icons/lighthouse.png +0 -0
- rustplus-6.0.12/rustplus/icons/military_tunnels.png +0 -0
- rustplus-6.0.12/rustplus/icons/mining_outpost.png +0 -0
- rustplus-6.0.12/rustplus/icons/mining_quarry_hqm.png +0 -0
- rustplus-6.0.12/rustplus/icons/mining_quarry_stone.png +0 -0
- rustplus-6.0.12/rustplus/icons/mining_quarry_sulfur.png +0 -0
- rustplus-6.0.12/rustplus/icons/missile_silo.png +0 -0
- rustplus-6.0.12/rustplus/icons/outpost.png +0 -0
- rustplus-6.0.12/rustplus/icons/oxums.png +0 -0
- rustplus-6.0.12/rustplus/icons/power_plant.png +0 -0
- rustplus-6.0.12/rustplus/icons/radtown.png +0 -0
- rustplus-6.0.12/rustplus/icons/satellite.png +0 -0
- rustplus-6.0.12/rustplus/icons/sewer.png +0 -0
- rustplus-6.0.12/rustplus/icons/small_oil_rig.png +0 -0
- rustplus-6.0.12/rustplus/icons/stables.png +0 -0
- rustplus-6.0.12/rustplus/icons/supermarket.png +0 -0
- rustplus-6.0.12/rustplus/icons/swamp.png +0 -0
- rustplus-6.0.12/rustplus/icons/train.png +0 -0
- rustplus-6.0.12/rustplus/icons/train_yard.png +0 -0
- rustplus-6.0.12/rustplus/icons/underwater_lab.png +0 -0
- rustplus-6.0.12/rustplus/icons/water_treatment.png +0 -0
- rustplus-6.0.12/rustplus/remote/camera/camera_constants.py +0 -35
- {rustplus-6.0.12 → rustplus-6.1.1}/LICENSE +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/MANIFEST.in +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/annotations/__init__.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/commands/__init__.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/commands/chat_command.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/commands/chat_command_data.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/commands/command_options.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/events/__init__.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/events/chat_event.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/events/clan_info_event.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/events/entity_event.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/events/protobuf_event.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/events/team_event.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/exceptions/__init__.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/exceptions/exceptions.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/icons/__init__.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/icons/cargo.png +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/icons/chinook.png +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/icons/chinook_blades.png +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/icons/crate.png +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/icons/explosion.png +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/icons/icon.png +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/icons/patrol.png +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/icons/vending_machine.png +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/identification/__init__.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/identification/handler_list.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/identification/registered_listener.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/identification/server_details.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/remote/__init__.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/remote/camera/__init__.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/remote/camera/structures.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/remote/fcm/__init__.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/remote/fcm/fcm_listener.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/remote/proxy/__init__.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/remote/proxy/proxy_value_grabber.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/remote/ratelimiter/__init__.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/remote/rustplus_proto/__init__.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/remote/rustplus_proto/rustplus.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/remote/websocket/__init__.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/remote/websocket/ws.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/clans/__init__.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/clans/rust_clan_info.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/clans/rust_clan_message.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/rust_chat_message.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/rust_contents.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/rust_entity_info.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/rust_error.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/rust_info.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/rust_item.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/rust_map.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/rust_marker.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/rust_team_info.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/rust_time.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/structs/serialization.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/utils/deprecated.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/utils/emojis.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/utils/fonts/PermanentMarker.ttf +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/utils/fonts/__init__.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/utils/grab_items.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus/utils/yielding_event.py +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus.egg-info/dependency_links.txt +0 -0
- {rustplus-6.0.12 → rustplus-6.1.1}/rustplus.egg-info/top_level.txt +0 -0
- {rustplus-6.0.12 → 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.
|
|
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
|
|
@@ -60,6 +61,8 @@ pip install rustplus
|
|
|
60
61
|
- Getting the time
|
|
61
62
|
- Using Smart Devices
|
|
62
63
|
- Camera Handling
|
|
64
|
+
- Interacting with clans
|
|
65
|
+
- Getting nexus information
|
|
63
66
|
|
|
64
67
|
# For information on all the above methods, see the [Wiki](https://rplus.ollieee.xyz)
|
|
65
68
|
|
|
@@ -14,6 +14,7 @@ from .annotations import (
|
|
|
14
14
|
)
|
|
15
15
|
from .remote.fcm import FCMListener
|
|
16
16
|
from .remote.camera import MovementControls, CameraMovementOptions
|
|
17
|
+
from .remote.nexus import NexusInterface, Realm
|
|
17
18
|
from .commands import CommandOptions, ChatCommand
|
|
18
19
|
from .events import ChatEventPayload, TeamEventPayload, EntityEventPayload
|
|
19
20
|
from .utils import convert_event_type_to_name, Emoji, convert_coordinates
|
|
@@ -21,5 +22,5 @@ from .structs import RustError, RustMarker, Vector
|
|
|
21
22
|
|
|
22
23
|
__name__ = "rustplus"
|
|
23
24
|
__author__ = "olijeffers0n"
|
|
24
|
-
__version__ = "6.
|
|
25
|
+
__version__ = "6.1.1"
|
|
25
26
|
__support__ = "Discord: https://discord.gg/nQqJe8qvP8"
|
|
@@ -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
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
class MovementControls:
|
|
2
|
+
"""
|
|
3
|
+
Possible inputs for the camera movement.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
FORWARD = 2
|
|
7
|
+
BACKWARD = 4
|
|
8
|
+
LEFT = 8
|
|
9
|
+
RIGHT = 16
|
|
10
|
+
JUMP = 32
|
|
11
|
+
DUCK = 64
|
|
12
|
+
SPRINT = 128
|
|
13
|
+
USE = 256
|
|
14
|
+
FIRE_PRIMARY = 1024
|
|
15
|
+
FIRE_SECONDARY = 2048
|
|
16
|
+
RELOAD = 8192
|
|
17
|
+
FIRE_THIRD = 134217728
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class CameraMovementOptions:
|
|
21
|
+
"""
|
|
22
|
+
Indicate which camera controls are active for the camera.
|
|
23
|
+
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
NONE = 0
|
|
27
|
+
MOVEMENT = 1
|
|
28
|
+
MOUSE = 2
|
|
29
|
+
SPRINT_AND_DUCK = 4
|
|
30
|
+
FIRE = 8
|
|
31
|
+
RELOAD = 16
|
|
32
|
+
CROSSHAIR = 32
|
|
@@ -58,8 +58,8 @@ class CameraManager:
|
|
|
58
58
|
async def _create_frame(
|
|
59
59
|
self,
|
|
60
60
|
render_entities: bool = True,
|
|
61
|
-
entity_render_distance: float = float("inf"),
|
|
62
|
-
max_entity_amount: int = float("inf"),
|
|
61
|
+
entity_render_distance: float | int = float("inf"),
|
|
62
|
+
max_entity_amount: float | int = float("inf"),
|
|
63
63
|
) -> Union[Image.Image, None]:
|
|
64
64
|
if self._last_packets is None:
|
|
65
65
|
return None
|
|
@@ -95,8 +95,8 @@ class CameraManager:
|
|
|
95
95
|
async def get_frame(
|
|
96
96
|
self,
|
|
97
97
|
render_entities: bool = True,
|
|
98
|
-
entity_render_distance: float = float("inf"),
|
|
99
|
-
max_entity_amount: int = float("inf"),
|
|
98
|
+
entity_render_distance: float | int = float("inf"),
|
|
99
|
+
max_entity_amount: float | int = float("inf"),
|
|
100
100
|
) -> Union[Image.Image, None]:
|
|
101
101
|
return await self._create_frame(
|
|
102
102
|
render_entities, entity_render_distance, max_entity_amount
|
|
@@ -7,7 +7,6 @@ import numpy as np
|
|
|
7
7
|
from scipy.spatial import ConvexHull
|
|
8
8
|
from PIL import Image, ImageDraw, ImageFont
|
|
9
9
|
|
|
10
|
-
from .camera_constants import LOOKUP_CONSTANTS
|
|
11
10
|
from .structures import Entity, Vector3
|
|
12
11
|
|
|
13
12
|
SCIENTIST_COLOUR = "#3098f2"
|
|
@@ -44,6 +43,8 @@ class Parser:
|
|
|
44
43
|
self.entities = []
|
|
45
44
|
self.last_fov = 0
|
|
46
45
|
|
|
46
|
+
self.lookup_constants = self._generate_lookup_constants(self.width, self.height)
|
|
47
|
+
|
|
47
48
|
def reset_output(self) -> None:
|
|
48
49
|
self.colour_output = np.full(
|
|
49
50
|
(self.width * self.scale_factor, self.height * self.scale_factor, 3),
|
|
@@ -53,6 +54,42 @@ class Parser:
|
|
|
53
54
|
(self.width * self.scale_factor, self.height * self.scale_factor)
|
|
54
55
|
)
|
|
55
56
|
|
|
57
|
+
@staticmethod
|
|
58
|
+
def _generate_lookup_constants(width: int, height: int) -> List[int]:
|
|
59
|
+
instance_count = width * height
|
|
60
|
+
|
|
61
|
+
sample_position_buffer = [0] * (instance_count * 2)
|
|
62
|
+
|
|
63
|
+
buffer_index = 0
|
|
64
|
+
|
|
65
|
+
for y in range(height):
|
|
66
|
+
for x in range(width):
|
|
67
|
+
sample_position_buffer[buffer_index] = RNGSource.int32(x)
|
|
68
|
+
buffer_index += 1
|
|
69
|
+
|
|
70
|
+
sample_position_buffer[buffer_index] = RNGSource.int32(y)
|
|
71
|
+
buffer_index += 1
|
|
72
|
+
|
|
73
|
+
rng = RNGSource(1337)
|
|
74
|
+
|
|
75
|
+
for current_position in range(instance_count - 1, 0, -1):
|
|
76
|
+
current_index = 2 * current_position
|
|
77
|
+
random_position = 2 * rng.next_int(current_position + 1)
|
|
78
|
+
|
|
79
|
+
current_x = sample_position_buffer[current_index]
|
|
80
|
+
current_y = sample_position_buffer[current_index + 1]
|
|
81
|
+
|
|
82
|
+
random_x = sample_position_buffer[random_position]
|
|
83
|
+
random_y = sample_position_buffer[random_position + 1]
|
|
84
|
+
|
|
85
|
+
sample_position_buffer[random_position] = current_x
|
|
86
|
+
sample_position_buffer[random_position + 1] = current_y
|
|
87
|
+
|
|
88
|
+
sample_position_buffer[current_index] = random_x
|
|
89
|
+
sample_position_buffer[current_index + 1] = random_y
|
|
90
|
+
|
|
91
|
+
return sample_position_buffer
|
|
92
|
+
|
|
56
93
|
def handle_camera_ray_data(self, data) -> None:
|
|
57
94
|
if data is None:
|
|
58
95
|
return
|
|
@@ -90,9 +127,11 @@ class Parser:
|
|
|
90
127
|
alignment = ray[1]
|
|
91
128
|
material = ray[2]
|
|
92
129
|
|
|
93
|
-
index1 =
|
|
130
|
+
index1 = self.lookup_constants[self._sample_offset]
|
|
94
131
|
self._sample_offset += 1
|
|
95
|
-
index2 = int(
|
|
132
|
+
index2 = int(
|
|
133
|
+
self.lookup_constants[self._sample_offset] * self.width + index1
|
|
134
|
+
)
|
|
96
135
|
self._sample_offset += 1
|
|
97
136
|
|
|
98
137
|
x = (index2 % self.width) * self.scale_factor
|
|
@@ -786,3 +825,47 @@ class MathUtils:
|
|
|
786
825
|
|
|
787
826
|
# Return the vertices that correspond to the non-zero indices
|
|
788
827
|
return np.array(list(zip(x, y)))
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
class RNGSource:
|
|
831
|
+
def __init__(self, seed):
|
|
832
|
+
self.state = self.int32(seed)
|
|
833
|
+
self.next_state()
|
|
834
|
+
|
|
835
|
+
def next_int(self, e):
|
|
836
|
+
t = self.int32((self.next_state() * self.int32(e)) / 4294967295)
|
|
837
|
+
|
|
838
|
+
if t < 0:
|
|
839
|
+
t = e + t - 1
|
|
840
|
+
|
|
841
|
+
return self.int32(t)
|
|
842
|
+
|
|
843
|
+
def next_state(self):
|
|
844
|
+
e = self.state
|
|
845
|
+
t = e
|
|
846
|
+
|
|
847
|
+
e = self.int32(e ^ self.int32(e << 13))
|
|
848
|
+
e = self.int32(e ^ (self.uint32(e) >> 17))
|
|
849
|
+
e = self.int32(e ^ self.int32(e << 5))
|
|
850
|
+
|
|
851
|
+
self.state = e
|
|
852
|
+
|
|
853
|
+
return self.clamp(t)
|
|
854
|
+
|
|
855
|
+
@staticmethod
|
|
856
|
+
def clamp(e):
|
|
857
|
+
return e if e >= 0 else 4294967295 + e - 1
|
|
858
|
+
|
|
859
|
+
@staticmethod
|
|
860
|
+
def int32(value):
|
|
861
|
+
value = int(value)
|
|
862
|
+
value &= 0xFFFFFFFF
|
|
863
|
+
|
|
864
|
+
if value >= 0x80000000:
|
|
865
|
+
value -= 0x100000000
|
|
866
|
+
|
|
867
|
+
return value
|
|
868
|
+
|
|
869
|
+
@staticmethod
|
|
870
|
+
def uint32(value):
|
|
871
|
+
return value & 0xFFFFFFFF
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .nexus_interface import NexusInterface, Realm
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
import requests
|
|
4
|
+
import enum
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Realm(enum.Enum):
|
|
8
|
+
Development = 0
|
|
9
|
+
Staging = 1
|
|
10
|
+
Production = 2
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class NexusInterface:
|
|
14
|
+
def __init__(self, endpoint: str):
|
|
15
|
+
self.session = requests.Session()
|
|
16
|
+
self.endpoint = endpoint
|
|
17
|
+
|
|
18
|
+
def get_all_nexus(self, public_key: str, realm: Realm) -> Any | None:
|
|
19
|
+
|
|
20
|
+
res = self.session.get(
|
|
21
|
+
f"{self.endpoint}?publicKey={public_key}&realm={realm.value}"
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
if res.status_code == 200:
|
|
25
|
+
return res.json()
|
|
26
|
+
|
|
27
|
+
return None
|
|
28
|
+
|
|
29
|
+
def get_nexus_info(self, nexus_id: int) -> Any | None:
|
|
30
|
+
|
|
31
|
+
res = self.session.get(f"{self.endpoint}/{nexus_id}")
|
|
32
|
+
|
|
33
|
+
if res.status_code == 200:
|
|
34
|
+
return res.json()
|
|
35
|
+
|
|
36
|
+
return None
|
|
37
|
+
|
|
38
|
+
def get_nexus_map(self, nexus_id: int) -> Any | None:
|
|
39
|
+
|
|
40
|
+
res = self.session.get(f"{self.endpoint}/{nexus_id}/map")
|
|
41
|
+
|
|
42
|
+
if res.status_code == 200:
|
|
43
|
+
return res.content
|
|
44
|
+
|
|
45
|
+
return None
|
|
@@ -19,6 +19,7 @@ from .remote.rustplus_proto import (
|
|
|
19
19
|
AppCameraSubscribe,
|
|
20
20
|
AppMapMonument,
|
|
21
21
|
AppFlag,
|
|
22
|
+
AppGetNexusAuth,
|
|
22
23
|
)
|
|
23
24
|
from .remote.websocket import RustWebsocket
|
|
24
25
|
from .structs import (
|
|
@@ -33,6 +34,7 @@ from .structs import (
|
|
|
33
34
|
RustItem,
|
|
34
35
|
RustClanInfo,
|
|
35
36
|
RustClanMessage,
|
|
37
|
+
RustAuthDetails,
|
|
36
38
|
)
|
|
37
39
|
from .structs.rust_error import RustError
|
|
38
40
|
from .utils import (
|
|
@@ -42,7 +44,7 @@ from .utils import (
|
|
|
42
44
|
fetch_avatar_icon,
|
|
43
45
|
format_coord,
|
|
44
46
|
convert_marker,
|
|
45
|
-
|
|
47
|
+
convert_monument_to_image,
|
|
46
48
|
)
|
|
47
49
|
from .remote.ratelimiter import RateLimiter
|
|
48
50
|
from .utils.utils import error_present
|
|
@@ -315,6 +317,9 @@ class RustSocket:
|
|
|
315
317
|
await self.get_markers() if add_events or add_vending_machines else []
|
|
316
318
|
)
|
|
317
319
|
|
|
320
|
+
if isinstance(map_markers, RustError):
|
|
321
|
+
return map_markers
|
|
322
|
+
|
|
318
323
|
if add_icons:
|
|
319
324
|
for monument in monuments:
|
|
320
325
|
if str(monument.token) == "DungeonBase":
|
|
@@ -324,11 +329,12 @@ class RustSocket:
|
|
|
324
329
|
# reported as separate markers next to the lab; they aren't
|
|
325
330
|
# standalone monuments, so don't draw them.
|
|
326
331
|
continue
|
|
327
|
-
|
|
332
|
+
|
|
328
333
|
if monument.token in override_images:
|
|
329
|
-
icon =
|
|
330
|
-
|
|
331
|
-
icon =
|
|
334
|
+
icon = override_images[monument.token].resize((150, 150))
|
|
335
|
+
else:
|
|
336
|
+
icon = convert_monument_to_image(monument.token)
|
|
337
|
+
|
|
332
338
|
output.paste(
|
|
333
339
|
icon,
|
|
334
340
|
(format_coord(int(monument.x), int(monument.y), map_size)),
|
|
@@ -634,3 +640,28 @@ class RustSocket:
|
|
|
634
640
|
packet.set_clan_motd = send_message
|
|
635
641
|
|
|
636
642
|
await self.ws.send_message(packet, True)
|
|
643
|
+
|
|
644
|
+
async def get_nexus_auth(self, app_key: str) -> Union[RustAuthDetails, RustError]:
|
|
645
|
+
"""
|
|
646
|
+
Gets the auth for a server. Does not require that the player token of this RustSocket is set correctly.
|
|
647
|
+
|
|
648
|
+
:param app_key: The app key to use. I do not know how you would get this currently, without owning the server.
|
|
649
|
+
"""
|
|
650
|
+
|
|
651
|
+
packet = await self._generate_request()
|
|
652
|
+
send_message = AppGetNexusAuth()
|
|
653
|
+
send_message.app_key = app_key
|
|
654
|
+
packet.get_nexus_auth = send_message
|
|
655
|
+
|
|
656
|
+
response = await self.ws.send_and_get(packet)
|
|
657
|
+
|
|
658
|
+
if response is None:
|
|
659
|
+
return RustError("get_nexus_auth", "No response received")
|
|
660
|
+
|
|
661
|
+
if error_present(response):
|
|
662
|
+
return RustError("get_nexus_auth", response.response.error.error)
|
|
663
|
+
|
|
664
|
+
return RustAuthDetails(
|
|
665
|
+
response.response.nexus_auth.server_id,
|
|
666
|
+
response.response.nexus_auth.player_token,
|
|
667
|
+
)
|
|
@@ -7,6 +7,6 @@ from .rust_team_info import RustTeamInfo, RustTeamMember, RustTeamNote
|
|
|
7
7
|
from .rust_entity_info import RustEntityInfo
|
|
8
8
|
from .rust_contents import RustContents
|
|
9
9
|
from .rust_item import RustItem
|
|
10
|
-
from .util import Vector
|
|
10
|
+
from .util import Vector, RustAuthDetails
|
|
11
11
|
from .rust_error import RustError
|
|
12
12
|
from .clans import *
|