summaryrefslogtreecommitdiff
path: root/packets/quest_objective_details.gd
diff options
context:
space:
mode:
Diffstat (limited to 'packets/quest_objective_details.gd')
-rw-r--r--packets/quest_objective_details.gd65
1 files changed, 65 insertions, 0 deletions
diff --git a/packets/quest_objective_details.gd b/packets/quest_objective_details.gd
new file mode 100644
index 0000000..4fe3a8e
--- /dev/null
+++ b/packets/quest_objective_details.gd
@@ -0,0 +1,65 @@
+class_name QuestObjectiveDetails
+extends PacketChunk
+
+
+const BYTE_LENGTH := 44
+
+
+## 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
+
+
+static func from_bytes(bytes: PackedByteArray):
+ var details = QuestObjectiveDetails.new()
+
+ details.hunt_identification = bytes.decode_u32(0)
+ details.objective_type = bytes.decode_u32(4)
+ details.mob_id = bytes.decode_u32(8)
+ details.minimum_level = bytes.decode_u16(12)
+ details.maximum_level = bytes.decode_u16(14)
+ details.kill_count = bytes.decode_u16(16)
+ details.total_count = bytes.decode_u16(18)
+ details.mob_name = bytes.slice(20, 20 + 24).get_string_from_utf8()
+
+ return details
+
+
+static func array_from_bytes(bytes: PackedByteArray) -> Array[QuestObjectiveDetails]:
+ var array: Array[QuestObjectiveDetails] = []
+
+ var offset = 0
+ while offset < bytes.size():
+ var chunk = from_bytes(bytes.slice(offset))
+ array.append(chunk)
+ offset += chunk.byte_length
+
+ return array