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.1.tar.gz
(25.4 kB
view details)
Built Distribution
File details
Details for the file nebulous_py-1.2.1.tar.gz
.
File metadata
- Download URL: nebulous_py-1.2.1.tar.gz
- Upload date:
- Size: 25.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.25.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0467a501795aae2084de590654f3a31ee158106120dd01540a02d84f8156b86 |
|
MD5 | 4613b189f4521ca4c6083ea1f90f4f5e |
|
BLAKE2b-256 | 67ebf518d11f770cfb4a9b15af3982b6c9f18baa483b7cf9bf6b7abd86c85628 |
File details
Details for the file nebulous_py-1.2.1-py3-none-any.whl
.
File metadata
- Download URL: nebulous_py-1.2.1-py3-none-any.whl
- Upload date:
- Size: 25.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.25.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1013810ae3df8c075a3da5f4709b96754f057b9c9993c78b28d436ddb15c757d |
|
MD5 | e4b7aef5e46f0fe2856f1e11bd9dcee8 |
|
BLAKE2b-256 | 488c4dd6d6cc580ec13c6b4de396020f7b00277541b6107df1ca6fb8e3b919d1 |