summaryrefslogtreecommitdiff
path: root/packets/quest_details.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-11-29 21:54:32 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-11-29 21:54:32 +0100
commit313afffce7a823c30acf4853b083f9ca5132e879 (patch)
tree5a7370392ebd39314612166b35e6f53e67441c0b /packets/quest_details.gd
parente8aa9f50886b66d525307a58d71036e6fd3d4aa1 (diff)
next commit
Diffstat (limited to 'packets/quest_details.gd')
-rw-r--r--packets/quest_details.gd65
1 files changed, 65 insertions, 0 deletions
diff --git a/packets/quest_details.gd b/packets/quest_details.gd
new file mode 100644
index 0000000..eaf8d2e
--- /dev/null
+++ b/packets/quest_details.gd
@@ -0,0 +1,65 @@
+class_name QuestDetails
+extends PacketChunk
+
+
+## Byte Type: u32
+## Byte Length: 4
+var hunt_identification: int
+
+## Byte Type: u32
+## Byte Length: 4
+var objective_type: int
+
+## Byte Type: u32
+## Byte Length: 4
+var mob_id: int
+
+## Byte Type: u16
+## Byte Length: 2
+var minimum_level: int
+
+## Byte Type: u16
+## Byte Length: 2
+var maximum_level: int
+
+## Byte Type: u16
+## Byte Length: 2
+var kill_count: int
+
+## Byte Type: u16
+## Byte Length: 2
+var total_count: int
+
+## Byte Type: u8
+## Byte Length: 24
+var mob_name: String
+
+
+func get_byte_length():
+ return 44
+
+
+static func from_bytes(bytes: PackedByteArray):
+ var details = QuestDetails.new()
+
+ details.server_ip = bytes.slice(0, 4)
+ details.server_port = bytes.decode_u16(4)
+ details.server_name = bytes.slice(6, 6 + 20).get_string_from_utf8()
+ details.user_count = bytes.decode_u16(26)
+ details.server_type = bytes.decode_u16(28)
+ details.display_new = bytes.decode_u16(30)
+ details.unknown = bytes.slice(32)
+
+ return details
+
+
+static func array_from_bytes(bytes: PackedByteArray) -> Array:
+ var array = []
+
+ var offset = 0
+ while offset < bytes.size():
+ var chunk = from_bytes(bytes.slice(offset))
+ array.append(chunk)
+ offset += chunk.byte_length
+
+ return array