summaryrefslogtreecommitdiff
path: root/packets/map_server/navigate_to_target_packet.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-12-15 14:23:25 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-12-15 14:23:25 +0100
commita14e88ff4d0d87841a44254e2bff1784da6e8b48 (patch)
tree0507cb8117da7943805a6479aef4526edb2db4dd /packets/map_server/navigate_to_target_packet.gd
parentca4d1945598863d0ce297f4272317e5dd5797f88 (diff)
next commit
Diffstat (limited to 'packets/map_server/navigate_to_target_packet.gd')
-rw-r--r--packets/map_server/navigate_to_target_packet.gd58
1 files changed, 58 insertions, 0 deletions
diff --git a/packets/map_server/navigate_to_target_packet.gd b/packets/map_server/navigate_to_target_packet.gd
new file mode 100644
index 0000000..c418470
--- /dev/null
+++ b/packets/map_server/navigate_to_target_packet.gd
@@ -0,0 +1,58 @@
+## rAthena References:
+## - clif_navigateTo
+class_name NavigateToTargetPacket
+extends Packet
+
+
+const HEADER := 0x08e2
+const BYTE_LENGTH := 27
+
+
+## Byte Type: u8 [br]
+## Byte Length: 1 [br]
+## 0: Coordinates [br]
+## 1: Coordinates - but fails if you're already on the map [br]
+## 3: Monster
+var target_type: int
+
+## Byte Type: u8 [br]
+## Byte Length: 1
+var flags: int
+
+## Byte Type: u8 [br]
+## Byte Length: 1
+var hide_window: int
+
+## Byte Type: u8 [br]
+## Byte Length: 16
+var map_name: String
+
+## Byte Type: u16 [br]
+## Byte Length: 2
+var target_position_x: int
+
+## Byte Type: u16 [br]
+## Byte Length: 2
+var target_position_y: int
+
+## Byte Type: u16 [br]
+## Byte Length: 2
+var target_monster_id: int
+
+
+func get_target_position() -> Vector2:
+ return Vector2(target_position_x, target_position_y)
+
+
+static func from_bytes(bytes: PackedByteArray) -> NavigateToTargetPacket:
+ var packet = NavigateToTargetPacket.new()
+
+ packet.target_type = bytes.decode_u8(2)
+ packet.flags = bytes.decode_u8(3)
+ packet.hide_window = bytes.decode_u8(4)
+ packet.map_name = bytes.slice(5, 5 + 16).get_string_from_utf8()
+ packet.target_position_x = bytes.decode_u16(21)
+ packet.target_position_y = bytes.decode_u16(23)
+ packet.target_monster_id = bytes.decode_u16(25)
+
+ return packet