From a14e88ff4d0d87841a44254e2bff1784da6e8b48 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 15 Dec 2024 14:23:25 +0100 Subject: next commit --- packets/map_server/navigate_to_target_packet.gd | 58 +++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 packets/map_server/navigate_to_target_packet.gd (limited to 'packets/map_server/navigate_to_target_packet.gd') 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 -- cgit v1.2.3