Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: olijeffers0n/rustplus
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5.6.0
Choose a base ref
...
head repository: olijeffers0n/rustplus
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 2,742 additions and 2,721 deletions.
  1. +1 −1 .github/CODE_OF_CONDUCT.md
  2. +14 −32 .github/workflows/format.yml
  3. +2 −1 MANIFEST.in
  4. +10 −8 README.md
  5. BIN docs/.gitbook/assets/Untitled.png
  6. BIN docs/.gitbook/assets/icon.png
  7. +21 −0 docs/README.md
  8. +40 −0 docs/SUMMARY.md
  9. +21 −0 docs/api-methods/getting-contents-of-monitors.md
  10. +33 −0 docs/api-methods/getting-entity-information.md
  11. +52 −0 docs/api-methods/getting-map-markers.md
  12. +17 −0 docs/api-methods/getting-server-info.md
  13. +14 −0 docs/api-methods/getting-team-chat.md
  14. +40 −0 docs/api-methods/getting-team-info.md
  15. +27 −0 docs/api-methods/getting-the-map.md
  16. +14 −0 docs/api-methods/getting-the-time.md
  17. +4 −0 docs/api-methods/promoting-players-to-team-leader.md
  18. +22 −0 docs/api-methods/removing-listeners.md
  19. +8 −0 docs/api-methods/sending-messages.md
  20. +55 −0 docs/cameras/camera-managers.md
  21. +46 −0 docs/command-system/command-decorator.md
  22. +11 −0 docs/command-system/command-options.md
  23. +18 −0 docs/command-system/commands-overview.md
  24. +10 −0 docs/command-system/hanging-the-socket.md
  25. +4 −0 docs/community-examples/examples.md
  26. +81 −0 docs/event-system/events-overview.md
  27. +67 −0 docs/getting-started/getting-player-details/README.md
  28. +31 −0 docs/getting-started/getting-player-details/fcm-listener.md
  29. +12 −0 docs/getting-started/getting-player-details/getting-entity-ids.md
  30. +42 −0 docs/getting-started/quick-start.md
  31. +16 −0 docs/getting-started/rustsocket/README.md
  32. +27 −0 docs/getting-started/rustsocket/rate-limiting.md
  33. +2 −2 requirements.txt
  34. +6 −0 rustplus.proto
  35. +9 −18 rustplus/__init__.py
  36. +5 −0 rustplus/annotations/__init__.py
  37. +21 −0 rustplus/annotations/chat_event.py
  38. +23 −0 rustplus/annotations/command.py
  39. +19 −0 rustplus/annotations/entity_event.py
  40. +19 −0 rustplus/annotations/protobuf_event.py
  41. +19 −0 rustplus/annotations/team_event.py
  42. +0 −1 rustplus/api/__init__.py
  43. +0 −598 rustplus/api/base_rust_api.py
  44. BIN rustplus/api/icons/arctic_base.png
  45. BIN rustplus/api/icons/desert_base.png
  46. BIN rustplus/api/icons/harbour.png
  47. BIN rustplus/api/icons/patrol.png
  48. BIN rustplus/api/icons/quarry.png
  49. BIN rustplus/api/icons/stable.png
  50. +0 −8 rustplus/api/remote/__init__.py
  51. +0 −4 rustplus/api/remote/events/__init__.py
  52. +0 −50 rustplus/api/remote/events/event_handler.py
  53. +0 −25 rustplus/api/remote/events/event_loop_manager.py
  54. +0 −126 rustplus/api/remote/events/events.py
  55. +0 −62 rustplus/api/remote/events/handler_list.py
  56. +0 −104 rustplus/api/remote/events/map_event_listener.py
  57. +0 −27 rustplus/api/remote/events/registered_listener.py
  58. +0 −48 rustplus/api/remote/expo_bundle_handler.py
  59. +0 −32 rustplus/api/remote/heartbeat.py
  60. +0 −234 rustplus/api/remote/rust_remote_interface.py
  61. +0 −308 rustplus/api/remote/rustws.py
  62. +0 −26 rustplus/api/remote/server_checker.py
  63. +0 −417 rustplus/api/rust_api.py
  64. +2 −2 rustplus/commands/__init__.py
  65. +33 −0 rustplus/commands/chat_command.py
  66. +7 −6 rustplus/commands/{command_data.py → chat_command_data.py}
  67. +0 −23 rustplus/commands/command.py
  68. +0 −67 rustplus/commands/command_handler.py
  69. +1 −9 rustplus/commands/command_options.py
  70. +0 −3 rustplus/conversation/__init__.py
  71. +0 −62 rustplus/conversation/conversation.py
  72. +0 −50 rustplus/conversation/conversation_factory.py
  73. +0 −12 rustplus/conversation/conversation_prompt.py
  74. +4 −0 rustplus/events/__init__.py
  75. +13 −0 rustplus/events/chat_event.py
  76. +60 −0 rustplus/events/entity_event.py
  77. +12 −0 rustplus/events/protobuf_event.py
  78. +18 −0 rustplus/events/team_event.py
  79. 0 rustplus/{api → }/icons/__init__.py
  80. BIN rustplus/{api → }/icons/airfield.png
  81. BIN rustplus/icons/arctic_base.png
  82. BIN rustplus/{api → }/icons/bandit.png
  83. BIN rustplus/{api → }/icons/barn.png
  84. BIN rustplus/{api → }/icons/cargo.png
  85. BIN rustplus/{api → }/icons/chinook.png
  86. BIN rustplus/{api → }/icons/chinook_blades.png
  87. BIN rustplus/{api → }/icons/crate.png
  88. BIN rustplus/icons/desert_base.png
  89. BIN rustplus/{api → }/icons/dome.png
  90. BIN rustplus/{api → }/icons/excavator.png
  91. BIN rustplus/{api → }/icons/explosion.png
  92. BIN rustplus/icons/ferryterminal.png
  93. BIN rustplus/{api → }/icons/fishing.png
  94. BIN rustplus/icons/harbour.png
  95. BIN rustplus/{api → }/icons/icon.png
  96. BIN rustplus/{api → }/icons/junkyard.png
  97. BIN rustplus/{api → }/icons/large_oil_rig.png
  98. BIN rustplus/{api → }/icons/launchsite.png
  99. BIN rustplus/{api → }/icons/lighthouse.png
  100. BIN rustplus/{api → }/icons/military_tunnels.png
  101. BIN rustplus/{api → }/icons/mining_outpost.png
  102. BIN rustplus/icons/mining_quarry_hqm.png
  103. BIN rustplus/icons/mining_quarry_stone.png
  104. BIN rustplus/icons/mining_quarry_sulfur.png
  105. BIN rustplus/icons/missile_silo.png
  106. BIN rustplus/{api → }/icons/outpost.png
  107. BIN rustplus/{api → }/icons/oxums.png
  108. BIN rustplus/icons/patrol.png
  109. BIN rustplus/{api → }/icons/power_plant.png
  110. BIN rustplus/{api → }/icons/satellite.png
  111. BIN rustplus/{api → }/icons/sewer.png
  112. BIN rustplus/{api → }/icons/small_oil_rig.png
  113. BIN rustplus/icons/stables.png
  114. BIN rustplus/{api → }/icons/supermarket.png
  115. BIN rustplus/{api → }/icons/swamp.png
  116. BIN rustplus/{api → }/icons/train.png
  117. BIN rustplus/{api → }/icons/train_yard.png
  118. BIN rustplus/{api → }/icons/underwater_lab.png
  119. BIN rustplus/{api → }/icons/vending_machine.png
  120. BIN rustplus/{api → }/icons/water_treatment.png
  121. +2 −0 rustplus/identification/__init__.py
  122. +76 −0 rustplus/identification/handler_list.py
  123. +26 −0 rustplus/identification/registered_listener.py
  124. +39 −0 rustplus/identification/server_details.py
  125. 0 rustplus/remote/__init__.py
  126. 0 rustplus/{api → }/remote/camera/__init__.py
  127. 0 rustplus/{api → }/remote/camera/camera_constants.py
  128. +29 −22 rustplus/{api → }/remote/camera/camera_manager.py
  129. +23 −14 rustplus/{api → }/remote/camera/camera_parser.py
  130. +7 −7 rustplus/{api → }/remote/camera/structures.py
  131. +1 −0 rustplus/remote/fcm/__init__.py
  132. 0 rustplus/{api/remote → remote/fcm}/fcm_listener.py
  133. +1 −0 rustplus/remote/proxy/__init__.py
  134. +32 −0 rustplus/remote/proxy/proxy_value_grabber.py
  135. +33 −31 rustplus/{api/remote/ratelimiter.py → remote/ratelimiter/__init__.py}
  136. 0 rustplus/{api → }/remote/rustplus_proto/__init__.py
  137. +6 −1 rustplus/{api → }/remote/rustplus_proto/rustplus.py
  138. +1 −0 rustplus/remote/websocket/__init__.py
  139. +362 −0 rustplus/remote/websocket/ws.py
  140. +560 −0 rustplus/rust_api.py
  141. +1 −0 rustplus/{api/structures → structs}/__init__.py
  142. +3 −2 rustplus/{api/structures → structs}/rust_chat_message.py
  143. +2 −2 rustplus/{api/structures → structs}/rust_contents.py
  144. +4 −4 rustplus/{api/structures → structs}/rust_entity_info.py
  145. +33 −0 rustplus/structs/rust_error.py
  146. +2 −1 rustplus/{api/structures → structs}/rust_info.py
  147. +2 −1 rustplus/{api/structures → structs}/rust_item.py
  148. +3 −3 rustplus/{api/structures → structs}/rust_map.py
  149. +8 −4 rustplus/{api/structures → structs}/rust_marker.py
  150. +22 −5 rustplus/{api/structures → structs}/rust_team_info.py
  151. +4 −1 rustplus/{api/structures → structs}/rust_time.py
  152. +17 −0 rustplus/structs/serialization.py
  153. 0 rustplus/{api/structures → structs}/util.py
  154. +11 −3 rustplus/utils/__init__.py
  155. +31 −0 rustplus/utils/emojis.py
  156. +126 −48 rustplus/utils/grab_items.py
  157. +0 −172 rustplus/utils/rust_utils.py
  158. +0 −26 rustplus/utils/server_id.py
  159. +232 −0 rustplus/utils/utils.py
  160. +10 −8 rustplus/utils/yielding_event.py
2 changes: 1 addition & 1 deletion .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
### Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting Ollie on discord at `Ollie#0175`. All
reported by contacting Ollie on discord at `ollieee_`. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
46 changes: 14 additions & 32 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
# name: Format code
#
# on:
# pull_request:
# branches:
# - master
#
# jobs:
# format:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Format code with black
# run: |
# pip install black
# black . --exclude rustplus/api/remote/camera/camera_constants.py
# - name: Sort imports with isort
# run: |
# pip install isort
# isort .
# - name: Remove unused imports with autoflake
# run: |
# pip install autoflake
# autoflake --in-place --remove-all-unused-imports --remove-unused-variables --ignore-init-module-imports --recursive .
# - name: Commit changes
# uses: EndBug/add-and-commit@v4
# with:
# author_name: ${{ github.actor }}
# author_email: ${{ github.actor }}@users.noreply.github.com
# message: "Format code with black"
# add: "."
# branch: ${{ github.ref }}
name: Lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
options: "--check --verbose --exclude 'rustplus/remote/camera/camera_constants.py'"
src: "./rustplus"
version: "~= 24.4.2"
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
recursive-include rustplus *.png
recursive-include rustplus *.ttf
recursive-include rustplus *.ttf
include requirements.txt
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -14,17 +14,11 @@
</div>
</div>

A lot of code and ideas have come from the JavaScript version of a wrapper, so I will credit it now:
[RustPlus.js](https://github.com/liamcottle/rustplus.js)
I have used his Protocol Buffer file for generating the necessary requests so chuck some support their way


## Installation:
Install the package with:
```
pip install rustplus
```
It should also install all the dependencies, but if not you will have to install them yourself

## What can you do?
- Get the Map
@@ -39,9 +33,11 @@ It should also install all the dependencies, but if not you will have to install
# For information on all the above methods, see the [Wiki](https://rplus.ollieee.xyz)

### Support:
If you need help, or you think that there is an issue feel free to open an issue. If you think you have made some improvements, open a PR!
If you need help, or you think that there is a problem feel free to open an issue. If you think you have made some improvements, open a PR!

Feel free to chuck some support to Liam at [RustPlus.js](https://github.com/liamcottle/rustplus.js) as he was the first to really crack this API

I have tried to explain this a well as possible, but if you should need further clarification, join me on my discord server:
You can also join me on my discord server:
<div align="center">
<a href = "https://discord.gg/nQqJe8qvP8">
<img src="https://discordapp.com/api/guilds/872406750639321088/widget.png?style=banner2" alt="Discord">
@@ -51,3 +47,9 @@ I have tried to explain this a well as possible, but if you should need further
GitHub ⭐'s are always welcome :)

Have Fun!

## Special Thanks:
Thanks to [JetBrains](https://www.jetbrains.com/?from=rustplus) for providing me with a free Open Source License for
PyCharm Professional, which is what I use to develop this project.

<a href="https://jb.gg/OpenSourceSupport"><img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg" width="150"></a>
Binary file added docs/.gitbook/assets/Untitled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/.gitbook/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Welcome to the Rust+.py Docs!

![](.gitbook/assets/icon.png)

Welcome to Rust+.py! Here you'll find all the documentation you need to get up and running with API.

## Want to jump right in?

Feeling like an eager beaver? Jump in to the quick start docs and get making your first requests:

{% content-ref url="getting-started/quick-start.md" %}
[quick-start.md](getting-started/quick-start.md)
{% endcontent-ref %}

## Want to take a look at our source?

Head over to our GitHub repository [here](https://github.com/olijeffers0n/rustplus)

## Need some help?

Head over to our discord server [here](https://lt.ollieee.xyz/rplusdiscord)
40 changes: 40 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Table of contents

## Getting Started

* [Welcome to the Rust+.py Docs!](README.md)
* [Quick Start](getting-started/quick-start.md)
* [Getting Player Details](getting-started/getting-player-details/README.md)
* [FCM Listener](getting-started/getting-player-details/fcm-listener.md)
* [Getting Entity ID's](getting-started/getting-player-details/getting-entity-ids.md)
* [RustSocket](getting-started/rustsocket/README.md)
* [Rate Limiting](getting-started/rustsocket/rate-limiting.md)

## API methods

* [Removing Listeners](api-methods/removing-listeners.md)
* [Getting Team Info](api-methods/getting-team-info.md)
* [Getting Team Chat](api-methods/getting-team-chat.md)
* [Getting Server Info](api-methods/getting-server-info.md)
* [Getting the Map](api-methods/getting-the-map.md)
* [Sending Messages](api-methods/sending-messages.md)
* [Getting the Time](api-methods/getting-the-time.md)
* [Getting Entity Information](api-methods/getting-entity-information.md)
* [Getting Map Markers](api-methods/getting-map-markers.md)
* [Getting Contents of Monitors](api-methods/getting-contents-of-monitors.md)
* [Promoting Players to Team Leader](api-methods/promoting-players-to-team-leader.md)

## Command System

* [Commands Overview](command-system/commands-overview.md)
* [Command Options](command-system/command-options.md)
* [Command Decorator](command-system/command-decorator.md)
* [Hanging The Socket](command-system/hanging-the-socket.md)

## Event System

* [Events Overview](event-system/events-overview.md)

## Cameras

* [Camera Managers](cameras/camera-managers.md)
21 changes: 21 additions & 0 deletions docs/api-methods/getting-contents-of-monitors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Getting Contents of Monitors

Calling `rust_socket.get_contents(eid: int, combine_stacks: bool)` returns a `RustContents` object:



```python
class RustContents with fields:

protection_time: timedelta
has_protection: bool
contents : List[RustItem]

class RustItem with fields:

name: str
item_id: int
quantity: int
is_blueprint: bool
```

33 changes: 33 additions & 0 deletions docs/api-methods/getting-entity-information.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Getting Entity Information

Calling `rust_socket.get_entity_info(entity_id: int)` will return a `RustEntityInfo` object with the following data:

```python
class RustEntityInfo with fields:

type: int
value: bool
items : RustEntityInfoItem
capacity: int
has_protection: bool
protection_expiry: int

class RustEntityInfoItem with fields:

item_id: int
quantity: int
item_is_blueprint: bool
```

The entity type is an integer value which corresponds to these values:

```
Switch = 1
Alarm = 2
StorageMonitor = 3
```

## Setting Entity Information

Calling `rust_socket.set_entity_value(entity_id: int, value: bool)` will set the value of the entity with the given ID to the given value.

52 changes: 52 additions & 0 deletions docs/api-methods/getting-map-markers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Getting Map Markers

Calling `rust_socket.get_markers()` returns a `List[RustMarker]` with the following data:

```python
class RustMarker with fields:

id: int
type: int
x: float
y: float
steam_id: int
rotation: float
radius: float
colour1 : RustColour
colour2 : RustColour
alpha: float
name: str
sell_orders : List[RustSellOrder]

class RustColour with fields:

x: float
y: float
z: float
w: float

class RustSellOrder with fields:

item_id: int
quantity: int
currency_id: int
cost_per_item: int
item_is_blueprint: bool
currency_is_blueprint: bool
amount_in_stock: int
```

#### These are the types of the RustMarker

```
Types:
Player = 1
Explosion = 2
VendingMachine = 3
CH47 = 4
CargoShip = 5
Crate = 6
GenericRadius = 7
PatrolHelicopter = 8
```

17 changes: 17 additions & 0 deletions docs/api-methods/getting-server-info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Getting Server Info

Calling `rust_socket.get_info()` will return a `RustInfo` object with the following data:

```python
class RustInfo with fields:

url: str
name: str
map: str
size: int
players: int
max_players: int
queued_players: int
seed: int
```

14 changes: 14 additions & 0 deletions docs/api-methods/getting-team-chat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Getting Team Chat

Calling `rust_socket.get_team_chat()` will return a `List[RustChatMessage]` objects with fields:

```python
class RustChatMessage with fields:

steam_id: int
name: str
message: str
colour: str
time: int
```

40 changes: 40 additions & 0 deletions docs/api-methods/getting-team-info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Getting Team Info

Calling `rust_socket.get_team_info()` returns a `RustTeamInfo` object with the following data:

```python
class RustTeamInfo with fields:

leader_steam_id: int
members : List[RustTeamMember]
map_notes : List[RustTeamNote]
leader_map_notes : List[RustTeamNote]

class RustTeamMember with fields:

steam_id: int
name: str
x: float
y: float
is_online: bool
spawn_time: int
is_alive: bool
death_time: int

class RustTeamNote with fields:

type: int
x: float
y: float
icon: int
colour_index: int
label: string
```

So, to get the name of the first member in the team you can do:

```python
info = await rust_socket.get_team_info()
print(info.members[0].name)
```

27 changes: 27 additions & 0 deletions docs/api-methods/getting-the-map.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Getting the Map

### Getting the Image

Calling `rust_socket.get_map(add_icons: bool, add_events: bool, add_vending_machines: bool, add_team_positions: bool, override_images: dict, add_grid: bool)` will return a `PIL.Image` with the respective additions.

### Getting the Map Data

Calling `rust_socket.get_map_info()` will return a `RustMap` object with the following data:

```python
class RustMap with fields:

width: int
height: int
jpg_image: bytes
margin: int
monuments : List[RustMonument]
background: str

class RustMonument with fields:

token: str
x: float
y: float
```

14 changes: 14 additions & 0 deletions docs/api-methods/getting-the-time.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Getting the Time

Calling `rust_socket.get_time()` returns a `RustTime` object with the following info:

```python
class RustTime with fields:

day_length: float
sunrise: str
sunset: str
time: str
raw_time: float
```

4 changes: 4 additions & 0 deletions docs/api-methods/promoting-players-to-team-leader.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Promoting Players to Team Leader

Calling `rust_socket.promote_to_team_leader(steam_id: int)` will promote the player in your team to the leader.

Loading