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()
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.0.0.tar.gz
(17.6 kB
view details)
Built Distribution
File details
Details for the file nebulous_py-1.0.0.tar.gz
.
File metadata
- Download URL: nebulous_py-1.0.0.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.25.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | de4c254c6ed229335893809b63b1cbdbc4bc5645e64952fcb17b17b3e74dd8d7 |
|
MD5 | f9071f240141a71fd757199ede9807c0 |
|
BLAKE2b-256 | ea29223a321119a0416329dabc4ec6f4be0067e5dcb8afeba5e88409ac489908 |
File details
Details for the file nebulous_py-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: nebulous_py-1.0.0-py3-none-any.whl
- Upload date:
- Size: 18.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.25.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c3a7bb67e5353ba74fd63cd6f271839e644665ae1b87becb590f8fb0302ec36 |
|
MD5 | b7e608243b7d97f1bcfbd04f7b3f5e0c |
|
BLAKE2b-256 | c01f07ef6abb3686f2ff0d8e1e1e89a1fe59c211d2e8920cbf96767ea656684b |