A Python library for utilizing the Nebulous.io UDP protocol.
Project description
nebulous.py
Table of Contents
Installation
- Install git
- Install
java-random
:python -m pip install --user git+https://github.com/MostAwesomeDude/java-random
- NOTE: This is a required step, as the
java-random
package on pypi is outdated and broken.
- NOTE: This is a required step, as the
- Install
nebulous.py
:python -m pip install --user nebulous.py
Usage
From test_connect.py
:
import time
from nebulous.game.account import ServerRegions
from nebulous.game.models.client import Client, ClientCallbacks
from nebulous.game.packets import ConnectRequest3, ConnectResult2, Disconnect, KeepAlive
TEST_TICKET = ""
class TestCallbacks(ClientCallbacks):
def on_connect(self, client: Client, packet: ConnectRequest3) -> ConnectRequest3:
print("Connected to server")
return packet
def on_disconnect(self, client: Client, packet: Disconnect) -> Disconnect:
print("Disconnected from server")
return packet
def on_keep_alive(self, client: Client, packet: KeepAlive) -> KeepAlive:
print("Sending keep alive packet")
return packet
def on_connect_result(self, client: Client, packet: ConnectResult2) -> ConnectResult2:
print(f"Received connection result: {packet.result}")
return packet
def test_client():
client = Client(TEST_TICKET, ServerRegions.US_EAST, callbacks=TestCallbacks())
client.start()
# disconnect after 3 seconds.
# can also use client.run_forever() to keep the client running indefinitely
# until ctrl+c is pressed.
time.sleep(3)
client.stop()
if __name__ == "__main__":
test_client()
You can also dump packets as json, as shown in sample_packet.json
:
print(packet.as_json(indent=4))
License
nebulous.py
is distributed under the terms of the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nebulous_py-1.2.0.tar.gz
(25.3 kB
view details)
Built Distribution
File details
Details for the file nebulous_py-1.2.0.tar.gz
.
File metadata
- Download URL: nebulous_py-1.2.0.tar.gz
- Upload date:
- Size: 25.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.25.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce989667f7515725f7672b81a5f5b1c8d5a9b235accd862972b5950e4065f324 |
|
MD5 | 207c6592f72f31f750e7a02711e7d155 |
|
BLAKE2b-256 | d6768487efaf19e42b319e78f9a0922410f8f9a11833e96a6dc9600f4aa4541a |
File details
Details for the file nebulous_py-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: nebulous_py-1.2.0-py3-none-any.whl
- Upload date:
- Size: 25.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.25.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06bcf49c53f4a97af7605081dbf8e39ea86aff490dc25669f972320481d76f16 |
|
MD5 | 5af6dadb1624c1f12d5a672abc6b3bd6 |
|
BLAKE2b-256 | f40d238188672b228e82490878c6664c8568aee066dfb070875adbc21505e279 |