aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-06-12 20:14:46 -0700
committerFuwn <[email protected]>2024-06-12 20:14:46 -0700
commit0477e4b55a6ddf07c837bcd3df683ce7631e8ddb (patch)
tree5e25a6752e4fd1bdce35429bf341ede5fc45f532
parentfix: oneof ObjectID id (diff)
downloadworldserver-protobufs-main.tar.xz
worldserver-protobufs-main.zip
fix(test.py): new object id format + command parsingHEADmain
-rw-r--r--build/test.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/build/test.py b/build/test.py
index e9fb8ad..a771cd5 100644
--- a/build/test.py
+++ b/build/test.py
@@ -4,7 +4,7 @@ import command_pb2 as command
request = network_packet.NetworkPacket()
-request.short_object_id = 0xFF
+request.object_id.short_object_id = 0xFF
request.type = command.BUDDYLISTNOTIFYCMD
request.buddy_list_notify_command.CopyFrom(
buddy_list_notify_command.BuddyListNotifyCommand()
@@ -22,7 +22,9 @@ deserialised_request = network_packet.NetworkPacket()
deserialised_request.ParseFromString(request.SerializeToString())
print(f"deserialised_request.length: {deserialised_request.length}")
-print(f"deserialised_request.short_object_id: {deserialised_request.short_object_id}")
+print(
+ f"deserialised_request.short_object_id: {deserialised_request.object_id.short_object_id}"
+)
print(f"deserialised_request.type: {deserialised_request.type}")
print(
f"deserialised_request.buddy_list_notify_command.buddy_name: {deserialised_request.buddy_list_notify_command.buddy_name}"
@@ -37,7 +39,7 @@ def parse_network_packet(raw_bytes):
net_packet = network_packet.NetworkPacket()
net_packet.length = raw_bytes[0]
- net_packet.short_object_id = raw_bytes[1]
+ net_packet.object_id.short_object_id = raw_bytes[1]
net_packet.type = raw_bytes[2]
command_type = net_packet.type
@@ -45,6 +47,12 @@ def parse_network_packet(raw_bytes):
match command_type:
case command.BUDDYLISTNOTIFYCMD:
print("This is a BuddyListNotifyCommand.")
+
+ buddy_list_notify_cmd = buddy_list_notify_command.BuddyListNotifyCommand()
+ buddy_list_notify_cmd.buddy_name = raw_bytes[4:-1].decode("utf-8")
+ buddy_list_notify_cmd.logged_on = raw_bytes[-1]
+
+ net_packet.buddy_list_notify_command.CopyFrom(buddy_list_notify_cmd)
case command.PROPREQCMD:
print("This is a PropertyRequestCommand.")
case _:
@@ -56,3 +64,11 @@ def parse_network_packet(raw_bytes):
print(parse_network_packet(b"\x03\xff\x1e"))
print(parse_network_packet(b"\x03\x00\x1a"))
print(parse_network_packet(b"\x03\xff\x0a"))
+
+bytes = b"\xff"
+bytes += command.BUDDYLISTNOTIFYCMD.to_bytes(1, byteorder="big")
+bytes += b"\x05" + b"Whirl"
+bytes += b"\x01"
+bytes = bytes[0:1] + bytes
+
+print(parse_network_packet(bytes))