diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-12-15 14:23:25 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-12-15 14:23:25 +0100 |
commit | a14e88ff4d0d87841a44254e2bff1784da6e8b48 (patch) | |
tree | 0507cb8117da7943805a6479aef4526edb2db4dd /packets/map_server | |
parent | ca4d1945598863d0ce297f4272317e5dd5797f88 (diff) |
next commit
Diffstat (limited to 'packets/map_server')
36 files changed, 1100 insertions, 0 deletions
diff --git a/packets/map_server/achievement_list_packet.gd b/packets/map_server/achievement_list_packet.gd new file mode 100644 index 0000000..ed09184 --- /dev/null +++ b/packets/map_server/achievement_list_packet.gd @@ -0,0 +1,48 @@ +## rAthena References: +## - ZC_ALL_ACH_LIST +class_name AchievementListPacket +extends Packet + + +const HEADER := 0x0a23 +const BYTE_LENGTH := 0 + + +## Byte Type: u16 +## Byte Length: 2 +var packet_length: int + +## Byte Type: u32 +## Byte Length: 4 +var achievement_count: int + +## Byte Type: u32 +## Byte Length: 4 +var total_score: int + +## Byte Type: u16 +## Byte Length: 2 +var level: int + +## Byte Type: u32 +## Byte Length: 4 +var achievement_experience: int + +## Byte Type: u32 +## Byte Length: 4 +var achievement_experience_to_next_level: int + +var achievement_data: Array[AchievementData] + + +static func from_bytes(bytes: PackedByteArray) -> AchievementListPacket: + var packet = AchievementListPacket.new() + + packet.achievement_count = bytes.decode_u32(4) + packet.total_score = bytes.decode_u32(8) + packet.level = bytes.decode_u16(12) + packet.achievement_experience = bytes.decode_u32(14) + packet.achievement_experience_to_next_level = bytes.decode_u32(18) + packet.achievement_data = AchievementData.array_from_bytes(bytes.slice(22)) + + return packet diff --git a/packets/map_server/achievement_update_packet.gd b/packets/map_server/achievement_update_packet.gd new file mode 100644 index 0000000..9b33273 --- /dev/null +++ b/packets/map_server/achievement_update_packet.gd @@ -0,0 +1,39 @@ +## rAthena References: +## - ZC_ACH_UPDATE +class_name AchievementUpdatePacket +extends Packet + + +const HEADER := 0x0a24 +const BYTE_LENGTH := 66 + + +## Byte Type: u32 +## Byte Length: 4 +var total_score: int + +## Byte Type: u16 +## Byte Length: 2 +var level: int + +## Byte Type: u32 +## Byte Length: 4 +var achievement_experience: int + +## Byte Type: u32 +## Byte Length: 4 +var achievement_experience_to_next_level: int + +var achievement_data: AchievementData + + +static func from_bytes(bytes: PackedByteArray) -> AchievementUpdatePacket: + var packet = AchievementUpdatePacket.new() + + packet.total_score = bytes.decode_u32(2) + packet.level = bytes.decode_u16(6) + packet.achievement_experience = bytes.decode_u32(8) + packet.achievement_experience_to_next_level = bytes.decode_u32(12) + packet.achievement_data = AchievementData.from_bytes(bytes.slice(16)) + + return packet diff --git a/packets/map_server/broadcast_formatted_message_packet.gd b/packets/map_server/broadcast_formatted_message_packet.gd new file mode 100644 index 0000000..c66c4f1 --- /dev/null +++ b/packets/map_server/broadcast_formatted_message_packet.gd @@ -0,0 +1,74 @@ +## rAthena References: +## - clif_broadcast2 +class_name BroadcastFormattedMessagePacket +extends Packet + + +const HEADER := 0x01c3 +const BYTE_LENGTH := 0 + + +## Byte Type: u16 +## Byte Length: 2 +var packet_length: int + +## Byte Type: u8 +## Byte Length: 1 +var font_color_r: int + +## Byte Type: u8 +## Byte Length: 1 +var font_color_g: int + +## Byte Type: u8 +## Byte Length: 1 +var font_color_b: int + +## Byte Type: u8 +## Byte Length: 1 +var font_color_a: int + +## Byte Type: u16 +## Byte Length: 2 +var font_type: int + +## Byte Type: u16 +## Byte Length: 2 +var font_size: int + +## Byte Type: u16 +## Byte Length: 2 +var font_alignment: int + +## Byte Type: u16 +## Byte Length: 2 +var font_y: int + +## Byte Length: variable +var message: String + + +func get_font_color() -> Color: + return Color8( + font_color_r, + font_color_g, + font_color_b, + 255 + ) + + +static func from_bytes(bytes: PackedByteArray) -> BroadcastFormattedMessagePacket: + var packet = BroadcastFormattedMessagePacket.new() + + packet.packet_length = bytes.decode_u16(2) + packet.font_color_r = bytes.decode_u8(4) + packet.font_color_g = bytes.decode_u8(5) + packet.font_color_b = bytes.decode_u8(6) + packet.font_color_a = bytes.decode_u8(7) + packet.font_type = bytes.decode_u16(8) + packet.font_size = bytes.decode_u16(10) + packet.font_alignment = bytes.decode_u16(12) + packet.font_y = bytes.decode_u16(14) + packet.message = bytes.slice(16, packet.packet_length).get_string_from_utf8() + + return packet diff --git a/packets/map_server/change_map_packet.gd b/packets/map_server/change_map_packet.gd new file mode 100644 index 0000000..beee821 --- /dev/null +++ b/packets/map_server/change_map_packet.gd @@ -0,0 +1,35 @@ +## rAthena References: +## - ZC_NPCACK_MAPMOVE +class_name ChangeMapPacket +extends Packet + + +const HEADER := 0x0091 +const BYTE_LENGTH := 22 + + +## Byte Type: u8 +## Byte Length: 16 +var map_name: String + +## Byte Type: u16 +## Byte Length: 2 +var position_x: int + +## Byte Type: u16 +## Byte Length: 2 +var position_y: int + + +func get_position() -> Vector2: + return Vector2(position_x, position_y) + + +static func from_bytes(bytes: PackedByteArray): + var packet = ChangeMapPacket.new() + + packet.map_name = bytes.slice(2, 2 + 16).get_string_from_utf8() + packet.position_x = bytes.decode_u16(18) + packet.position_x = bytes.decode_u16(20) + + return packet diff --git a/packets/map_server/close_dialog_button_packet.gd b/packets/map_server/close_dialog_button_packet.gd new file mode 100644 index 0000000..db6ff02 --- /dev/null +++ b/packets/map_server/close_dialog_button_packet.gd @@ -0,0 +1,23 @@ +## rAthena References: +## - ZC_CLOSE_DIALOG +## - PACKET_ZC_CLOSE_DIALOG +## - clif_scriptclose +class_name CloseDialogButtonPacket +extends Packet + + +const HEADER := 0x00b6 +const BYTE_LENGTH := 6 + + +## Byte Type: u32 +## Byte Length: 4 +var entity_id: int + + +static func from_bytes(bytes: PackedByteArray) -> CloseDialogButtonPacket: + var packet = CloseDialogButtonPacket.new() + + packet.entity_id = bytes.decode_u32(2) + + return packet diff --git a/packets/map_server/couple_status_packet.gd b/packets/map_server/couple_status_packet.gd new file mode 100644 index 0000000..9f41174 --- /dev/null +++ b/packets/map_server/couple_status_packet.gd @@ -0,0 +1,29 @@ +class_name CoupleStatusPacket +extends Packet + + +const HEADER := 0x0141 +const BYTE_LENGTH := 14 + + +## Byte Type: u32 +## Byte Length: 4 +var status_type: int + +## Byte Type: i32 +## Byte Length: 4 +var default_status: int + +## Byte Type: i32 +## Byte Length: 4 +var plus_status: int + + +static func from_bytes(bytes: PackedByteArray): + var packet = CoupleStatusPacket.new() + + packet.status_type = bytes.decode_u32(2) + packet.default_status = bytes.decode_s32(6) + packet.plus_status = bytes.decode_s32(10) + + return packet diff --git a/packets/map_server/display_emotion_packet.gd b/packets/map_server/display_emotion_packet.gd new file mode 100644 index 0000000..6949ef9 --- /dev/null +++ b/packets/map_server/display_emotion_packet.gd @@ -0,0 +1,27 @@ +## rAthena References: +## - clif_emotion +## - enum emotion_type +class_name DisplayEmotionPacket +extends Packet + + +const HEADER := 0x00c0 +const BYTE_LENGTH := 7 + + +## Byte Type: u32 +## Byte Length: 4 +var entity_id: int + +## Byte Type: u8 +## Byte Length: 1 +var emotion: Constants.EmotionType + + +static func from_bytes(bytes: PackedByteArray) -> DisplayEmotionPacket: + var packet = DisplayEmotionPacket.new() + + packet.entity_id = bytes.decode_u32(2) + packet.emotion = bytes.decode_u8(6) + + return packet diff --git a/packets/map_server/entity_appeared_2_packet.gd b/packets/map_server/entity_appeared_2_packet.gd new file mode 100644 index 0000000..817d3ad --- /dev/null +++ b/packets/map_server/entity_appeared_2_packet.gd @@ -0,0 +1,31 @@ +## rAthena References: +## - ZC_NOTIFY_STANDENTRY11 +class_name EntityAppeared2Packet +extends Packet + + +const HEADER := 0x09ff +const BYTE_LENGTH := 0 + + +## Byte Type: u16 +## Byte Length: 2 +var packet_length: int + +## Byte Type: u8 +## Byte Length: 1 +var object_type: int + +## Byte Type: u32 +## Byte Length: 4 +var entity_id: int + +# TODO + + +static func from_bytes(bytes: PackedByteArray) -> EntityAppeared2Packet: + var packet = EntityAppeared2Packet.new() + + packet.packet_length = bytes.decode_u16(2) + + return packet diff --git a/packets/map_server/entity_disappeared_packet.gd b/packets/map_server/entity_disappeared_packet.gd new file mode 100644 index 0000000..1027fe8 --- /dev/null +++ b/packets/map_server/entity_disappeared_packet.gd @@ -0,0 +1,27 @@ +## rAthena References: +## - PACKET_ZC_NOTIFY_VANISH +## - clif_clearunit_area +class_name EntityDisappearedPacket +extends Packet + + +const HEADER := 0x0080 +const BYTE_LENGTH := 7 + + +## Byte Type: u32 +## Byte Length: 4 +var entity_id: int + +## Byte Type: u8 +## Byte Length: 1 +var reason: int # TODO: create enum + + +static func from_bytes(bytes: PackedByteArray) -> EntityDisappearedPacket: + var packet = EntityDisappearedPacket.new() + + packet.entity_id = bytes.decode_u32(2) + packet.reason = bytes.decode_u8(6) + + return packet diff --git a/packets/map_server/equippable_item_list_packet.gd b/packets/map_server/equippable_item_list_packet.gd new file mode 100644 index 0000000..6d642cc --- /dev/null +++ b/packets/map_server/equippable_item_list_packet.gd @@ -0,0 +1,34 @@ +## rAthena References: +## - clif_inventorylist +## - packet_itemlist_equip +class_name EquippableItemListPacket +extends Packet + + +const HEADER := 0x0b39 +const BYTE_LENGTH := 0 + + + +## Byte Type: u16 +## Byte Length: 2 +var packet_length: int + +## Byte Type: u8 +## Byte Length: 1 +var inventory_type: int + +## Byte Type: u8 +var item_information: Array[EquippableItemInformation] + + +static func from_bytes(bytes: PackedByteArray) -> EquippableItemListPacket: + var packet = EquippableItemListPacket.new() + + packet.packet_length = bytes.decode_u16(2) + packet.inventory_type = bytes.decode_u8(4) + packet.item_information = EquippableItemInformation.array_from_bytes( + ByteStream.from_bytes(bytes.slice(5)) + ) + + return packet diff --git a/packets/map_server/equippable_switch_item_list_packet.gd b/packets/map_server/equippable_switch_item_list_packet.gd new file mode 100644 index 0000000..98d42f1 --- /dev/null +++ b/packets/map_server/equippable_switch_item_list_packet.gd @@ -0,0 +1,25 @@ +## rAthena References: +## - clif_equipswitch_list +class_name EquippableSwitchItemListPacket +extends Packet + + +const HEADER := 0x0a9b +const BYTE_LENGTH := 0 + + +## Byte Type: u16 +## Byte Length: 2 +var packet_length: int + +## Byte Type: u8 +var item_information: Array[EquippableSwitchItemInformation] + + +static func from_bytes(bytes: PackedByteArray) -> EquippableSwitchItemListPacket: + var packet = EquippableSwitchItemListPacket.new() + + packet.packet_length = bytes.decode_u16(2) + packet.item_information = EquippableSwitchItemInformation.array_from_bytes(bytes.slice(4)) + + return packet diff --git a/packets/map_server/friend_list_packet.gd b/packets/map_server/friend_list_packet.gd new file mode 100644 index 0000000..ab419f5 --- /dev/null +++ b/packets/map_server/friend_list_packet.gd @@ -0,0 +1,23 @@ +## rAthena References: +## - ZC_FRIENDS_LIST +class_name FriendListPacket +extends Packet + + +const HEADER := 0x0201 +const BYTE_LENGTH := 0 + + +## Byte Type: u16 +## Byte Length: 2 +var packet_length: int + +var friends: Array[Friend] + + +static func from_bytes(bytes: PackedByteArray): + var packet = FriendListPacket.new() + + packet.friends = Friend.array_from_bytes(bytes.slice(4)) + + return packet diff --git a/packets/map_server/initial_status_packet.gd b/packets/map_server/initial_status_packet.gd new file mode 100644 index 0000000..9c41ef9 --- /dev/null +++ b/packets/map_server/initial_status_packet.gd @@ -0,0 +1,18 @@ +## rAthena References: +## - ZC_STATUS +## - clif_initialstatus +class_name InitialStatusPacket +extends Packet + + +const HEADER := 0x00bd +const BYTE_LENGTH := 2 + 14 + 28 + + +# TODO + + +static func from_bytes(bytes: PackedByteArray) -> InitialStatusPacket: + var packet = InitialStatusPacket.new() + + return packet diff --git a/packets/map_server/inventory_end_packet.gd b/packets/map_server/inventory_end_packet.gd new file mode 100644 index 0000000..d8d313b --- /dev/null +++ b/packets/map_server/inventory_end_packet.gd @@ -0,0 +1,26 @@ +## rAthena References: +## - PACKET_ZC_INVENTORY_END +## - clif_inventoryEnd +class_name InventoryEndPacket +extends Packet + + +const HEADER := 0x0b0b +const BYTE_LENGTH := 4 + + +## Byte Type: u8 +## Byte Length: 1 +var inventory_type: int + +## Byte Type: u8 +var flag: int + + +static func from_bytes(bytes: PackedByteArray) -> InventoryEndPacket: + var packet = InventoryEndPacket.new() + + packet.inventory_type = bytes.decode_u8(2) + packet.flag = bytes.decode_u8(3) + + return packet diff --git a/packets/map_server/inventory_start_packet.gd b/packets/map_server/inventory_start_packet.gd new file mode 100644 index 0000000..2a02731 --- /dev/null +++ b/packets/map_server/inventory_start_packet.gd @@ -0,0 +1,32 @@ +## rAthena References: +## - PACKET_ZC_INVENTORY_START +## - clif_inventoryStart +class_name InventoryStartPacket +extends Packet + + +const HEADER := 0x0b08 +const BYTE_LENGTH := 0 + + + +## Byte Type: u16 +## Byte Length: 2 +var packet_length: int + +## Byte Type: u8 +## Byte Length: 1 +var inventory_type: int + +## Byte Type: u8 +var inventory_name: String + + +static func from_bytes(bytes: PackedByteArray) -> InventoryStartPacket: + var packet = InventoryStartPacket.new() + + packet.packet_length = bytes.decode_u16(2) + packet.inventory_type = bytes.decode_u8(4) + packet.inventory_name = bytes.slice(5).get_string_from_utf8() + + return packet diff --git a/packets/map_server/map_server_login_success_packet.gd b/packets/map_server/map_server_login_success_packet.gd new file mode 100644 index 0000000..9b70428 --- /dev/null +++ b/packets/map_server/map_server_login_success_packet.gd @@ -0,0 +1,51 @@ +## rAthena References: +## - PACKET_ZC_ACCEPT_ENTER +## - clif_authok +class_name MapServerLoginSuccessPacket +extends Packet + + +const HEADER := 0x02eb +const BYTE_LENGTH := 13 + + +## Byte Type: u32 +## Byte Length: 4 +var client_tick: int + +## Byte Type: u8 +## Byte Length: 3 +var position: PackedByteArray + +## Byte Type: u8 +## Byte Length: 2 +## Always [5, 5] on rAthena +var ignored: PackedByteArray + +## Byte Type: u16 +## Byte Length: 2 +var font: int + +## Byte Type: u8 +## Byte Length: 1 +## Depends on packet version +var gender: Constants.Gender + + +func get_position(): + return Vector2( + position[1] >> 6 | position[0] << 2, + position[2] >> 4 | (position[1] & 0b111111) << 4 + ) + + +static func from_bytes(bytes: PackedByteArray): + var packet = MapServerLoginSuccessPacket.new() + + packet.client_tick = bytes.decode_u32(2) + packet.position = bytes.slice(6, 6 + 3) + packet.ignored = bytes.slice(9, 9 + 2) + packet.font = bytes.decode_u16(11) + #packet.gender = bytes.decode_u8(13) + + return packet diff --git a/packets/map_server/map_type_packet.gd b/packets/map_server/map_type_packet.gd new file mode 100644 index 0000000..122475c --- /dev/null +++ b/packets/map_server/map_type_packet.gd @@ -0,0 +1,27 @@ +## rAthena References: +## - ZC_MAPPROPERTY_R2 +## - clif_map_property +class_name MapTypePacket +extends Packet + + +const HEADER := 0x099b +const BYTE_LENGTH := 8 + + +## Byte Type: u16 +## Byte Length: 2 +var map_type: int + +## Byte Type: u32 +## Byte Length: 4 +var flags: int + + +static func from_bytes(bytes: PackedByteArray): + var packet = MapTypePacket.new() + + packet.map_type = bytes.decode_u16(2) + packet.flags = bytes.decode_u32(4) + + return packet diff --git a/packets/map_server/moving_entity_appeared_packet.gd b/packets/map_server/moving_entity_appeared_packet.gd new file mode 100644 index 0000000..43b19ae --- /dev/null +++ b/packets/map_server/moving_entity_appeared_packet.gd @@ -0,0 +1,31 @@ +## rAthena References: +## - ZC_NOTIFY_MOVEENTRY11 +class_name MovingEntityAppearedPacket +extends Packet + + +const HEADER := 0x09fd +const BYTE_LENGTH := 0 + + +## Byte Type: u16 +## Byte Length: 2 +var packet_length: int + +## Byte Type: u8 +## Byte Length: 1 +var object_type: int + +## Byte Type: u32 +## Byte Length: 4 +var entity_id: int + +# TODO + + +static func from_bytes(bytes: PackedByteArray) -> MovingEntityAppearedPacket: + var packet = MovingEntityAppearedPacket.new() + + packet.packet_length = bytes.decode_u16(2) + + return packet 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 diff --git a/packets/map_server/new_mail_status_packet.gd b/packets/map_server/new_mail_status_packet.gd new file mode 100644 index 0000000..4e87ed5 --- /dev/null +++ b/packets/map_server/new_mail_status_packet.gd @@ -0,0 +1,19 @@ +class_name NewMailStatusPacket +extends Packet + + +const HEADER := 0x09e7 +const BYTE_LENGTH := 3 + + +## Byte Type: u8 +## Byte Length: 1 +var new_available: int + + +static func from_bytes(bytes: PackedByteArray): + var packet = NewMailStatusPacket.new() + + packet.new_available = bytes.decode_u8(2) + + return packet diff --git a/packets/map_server/parameter_change_2_packet.gd b/packets/map_server/parameter_change_2_packet.gd new file mode 100644 index 0000000..a659046 --- /dev/null +++ b/packets/map_server/parameter_change_2_packet.gd @@ -0,0 +1,27 @@ +## rAthena References: +## - ZC_LONGLONGPAR_CHANGE +## - clif_longlongpar_change +class_name ParameterChange2Packet +extends Packet + + +const HEADER := 0x0acb +const BYTE_LENGTH := 12 + + +## Byte Type: u16 +## Byte Length: 2 +var parameter_id: int + +## Byte Type: u64 +## Byte Length: 8 +var value: int + + +static func from_bytes(bytes: PackedByteArray) -> ParameterChange2Packet: + var packet = ParameterChange2Packet.new() + + packet.parameter_id = bytes.decode_u16(2) + packet.value = bytes.decode_u64(4) + + return packet diff --git a/packets/map_server/parameter_change_3_packet.gd b/packets/map_server/parameter_change_3_packet.gd new file mode 100644 index 0000000..33ac5f3 --- /dev/null +++ b/packets/map_server/parameter_change_3_packet.gd @@ -0,0 +1,27 @@ +## rAthena References: +## - ZC_STATUS_CHANGE +## - clif_zc_status_change +class_name ParameterChange3Packet +extends Packet + + +const HEADER := 0x00be +const BYTE_LENGTH := 5 + + +## Byte Type: u16 +## Byte Length: 2 +var parameter_id: int + +## Byte Type: u8 +## Byte Length: 1 +var value: int + + +static func from_bytes(bytes: PackedByteArray) -> ParameterChange3Packet: + var packet = ParameterChange3Packet.new() + + packet.parameter_id = bytes.decode_u16(2) + packet.value = bytes.decode_u8(4) + + return packet diff --git a/packets/map_server/parameter_change_packet.gd b/packets/map_server/parameter_change_packet.gd new file mode 100644 index 0000000..8422dc2 --- /dev/null +++ b/packets/map_server/parameter_change_packet.gd @@ -0,0 +1,24 @@ +class_name ParameterChangePacket +extends Packet + + +const HEADER := 0x00b0 +const BYTE_LENGTH := 8 + + +## Byte Type: u16 +## Byte Length: 2 +var parameter_id: int + +## Byte Type: i32 +## Byte Length: 4 +var value: int + + +static func from_bytes(bytes: PackedByteArray): + var packet = ParameterChangePacket.new() + + packet.parameter_id = bytes.decode_u16(2) + packet.value = bytes.decode_s32(4) + + return packet diff --git a/packets/map_server/quest_effect_packet.gd b/packets/map_server/quest_effect_packet.gd new file mode 100644 index 0000000..aba7c7b --- /dev/null +++ b/packets/map_server/quest_effect_packet.gd @@ -0,0 +1,39 @@ +## rAthena References: +## - clif_quest_show_event +class_name QuestEffectPacket +extends Packet + + +const HEADER := 0x0446 +const BYTE_LENGTH := 14 + + +## Byte Type: u32 +## Byte Length: 4 +var entity_id: int + +## Byte Type: u16 +## Byte Length: 2 +var position_x: int + +## Byte Type: u16 +## Byte Length: 2 +var position_y: int + +## Byte Type: u16 +## Byte Length: 2 +var quest_effect: int + +## Byte Type: u16 +## Byte Length: 2 +var quest_color: int + + +# TODO: get_position, get_color + +static func from_bytes(bytes: PackedByteArray) -> QuestEffectPacket: + var packet = QuestEffectPacket.new() + + packet.entity_id = bytes.decode_u32(2) + + return packet diff --git a/packets/map_server/quest_list_packet.gd b/packets/map_server/quest_list_packet.gd new file mode 100644 index 0000000..fb148c3 --- /dev/null +++ b/packets/map_server/quest_list_packet.gd @@ -0,0 +1,27 @@ +class_name QuestListPacket +extends Packet + + +const HEADER := 0x09f8 +const BYTE_LENGTH := 0 + + +## Byte Type: u16 +## Byte Length: 2 +var packet_length: int + +## Byte Type: u32 +## Byte Length: 4 +var quest_count: int + +var quests: Array[Quest] + + +static func from_bytes(bytes: PackedByteArray): + var packet = QuestListPacket.new() + + packet.packet_length = bytes.decode_u16(2) + packet.quest_count = bytes.decode_u32(4) + packet.quests = Quest.array_from_bytes(bytes.slice(8)) + + return packet diff --git a/packets/map_server/regular_item_list_packet.gd b/packets/map_server/regular_item_list_packet.gd new file mode 100644 index 0000000..529c729 --- /dev/null +++ b/packets/map_server/regular_item_list_packet.gd @@ -0,0 +1,34 @@ +## rAthena References: +## - clif_inventorylist +## - packet_itemlist_normal +class_name RegularItemListPacket +extends Packet + + +const HEADER := 0x0b09 +const BYTE_LENGTH := 0 + + + +## Byte Type: u16 +## Byte Length: 2 +var packet_length: int + +## Byte Type: u8 +## Byte Length: 1 +var inventory_type: int + +## Byte Type: u8 +var item_information: Array[RegularItemInformation] + + +static func from_bytes(bytes: PackedByteArray) -> RegularItemListPacket: + var packet = RegularItemListPacket.new() + + packet.packet_length = bytes.decode_u16(2) + packet.inventory_type = bytes.decode_u8(4) + packet.item_information = RegularItemInformation.array_from_bytes( + ByteStream.from_bytes(bytes.slice(5)) + ) + + return packet diff --git a/packets/map_server/reputation_packet.gd b/packets/map_server/reputation_packet.gd new file mode 100644 index 0000000..2c2d1b3 --- /dev/null +++ b/packets/map_server/reputation_packet.gd @@ -0,0 +1,31 @@ +## rAthena References: +## - ZC_REPUTE_INFO +## - clif_reputation_type +## - clif_reputation_list +class_name ReputationPacket +extends Packet + + +const HEADER := 0x0b8d +const BYTE_LENGTH := 0 + + +## Byte Type: u16 +## Byte Length: 2 +var packet_length: int + +## Byte Type: u8 +## Byte Length: 1 +var success: bool + +var entries: Array#Array[ReputationEntry] +# TODO + + +static func from_bytes(bytes: PackedByteArray) -> ReputationPacket: + var packet = ReputationPacket.new() + + packet.packet_length = bytes.decode_u16(2) + packet.success = bytes.decode_u8(4) + + return packet diff --git a/packets/map_server/server_message_packet.gd b/packets/map_server/server_message_packet.gd new file mode 100644 index 0000000..6ab2a3f --- /dev/null +++ b/packets/map_server/server_message_packet.gd @@ -0,0 +1,27 @@ +## rAthena References: +## - clif_displaymessage +class_name ServerMessagePacket +extends Packet + + +const HEADER := 0x008e +const BYTE_LENGTH := 0 + + +## Byte Type: u16 +## Byte Length: 2 +var packet_length: int + +## Byte Type: u8 +## Byte Length: variable +var message: String + + +static func from_bytes(bytes: PackedByteArray): + var packet = ServerMessagePacket.new() + + packet.message = bytes.slice(4).get_string_from_utf8() + + print("Message: ", packet.message) + + return packet diff --git a/packets/map_server/sprite_change_packet.gd b/packets/map_server/sprite_change_packet.gd new file mode 100644 index 0000000..af6d934 --- /dev/null +++ b/packets/map_server/sprite_change_packet.gd @@ -0,0 +1,37 @@ +## rAthena References: +## - PACKET_ZC_SPRITE_CHANGE +## - clif_sprite_change +class_name SpriteChangePacket +extends Packet + + +const HEADER := 0x01d7 +const BYTE_LENGTH := 15 + + +## Byte Type: u32 +## Byte Length: 4 +var account_id: int + +## Byte Type: u8 +## Byte Length: 1 +var sprite_type: int + +## Byte Type: u32 +## Byte Length: 4 +var value: int + +## Byte Type: u32 +## Byte Length: 4 +var value2: int + + +static func from_bytes(bytes: PackedByteArray) -> SpriteChangePacket: + var packet = SpriteChangePacket.new() + + packet.account_id = bytes.decode_u32(2) + packet.sprite_type = bytes.decode_u32(6) + packet.value = bytes.decode_u32(7) + packet.value2 = bytes.decode_u32(11) + + return packet diff --git a/packets/map_server/update_attack_range_packet.gd b/packets/map_server/update_attack_range_packet.gd new file mode 100644 index 0000000..1ace166 --- /dev/null +++ b/packets/map_server/update_attack_range_packet.gd @@ -0,0 +1,19 @@ +class_name UpdateAttackRangePacket +extends Packet + + +const HEADER := 0x013a +const BYTE_LENGTH := 4 + + +## Byte Type: i16 +## Byte Length: 2 +var current_attack_range: int + + +static func from_bytes(bytes: PackedByteArray): + var packet = UpdateAttackRangePacket.new() + + packet.current_attack_range = bytes.decode_s16(2) + + return packet diff --git a/packets/map_server/update_configuration_packet.gd b/packets/map_server/update_configuration_packet.gd new file mode 100644 index 0000000..c9b3652 --- /dev/null +++ b/packets/map_server/update_configuration_packet.gd @@ -0,0 +1,26 @@ +## rAthena References: +## - clif_configuration +class_name UpdateConfigurationPacket +extends Packet + + +const HEADER := 0x02d9 +const BYTE_LENGTH := 10 + + +## Byte Type: u32 +## Byte Length: 4 +var config_type: int + +## Byte Type: u32 +## Byte Length: 4 +var enabled: bool + + +static func from_bytes(bytes: PackedByteArray) -> UpdateConfigurationPacket: + var packet = UpdateConfigurationPacket.new() + + packet.config_type = bytes.decode_u32(2) + packet.enabled = bytes.decode_u32(6) + + return packet diff --git a/packets/map_server/update_critical_weight_packet.gd b/packets/map_server/update_critical_weight_packet.gd new file mode 100644 index 0000000..03fb273 --- /dev/null +++ b/packets/map_server/update_critical_weight_packet.gd @@ -0,0 +1,19 @@ +class_name UpdateCriticalWeightPacket +extends Packet + + +const HEADER := 0x0ade +const BYTE_LENGTH := 6 + + +## Byte Type: u32 +## Byte Length: 4 +var weight: int + + +static func from_bytes(bytes: PackedByteArray) -> UpdateCriticalWeightPacket: + var packet = UpdateCriticalWeightPacket.new() + + packet.weight = bytes.decode_u32(2) + + return packet diff --git a/packets/map_server/update_hotkeys_packet.gd b/packets/map_server/update_hotkeys_packet.gd new file mode 100644 index 0000000..f991a7e --- /dev/null +++ b/packets/map_server/update_hotkeys_packet.gd @@ -0,0 +1,17 @@ +## rAthena References: +## - ZC_SHORTCUT_KEY_LIST +## - clif_hotkeys_send +class_name UpdateHotkeysPacket +extends Packet + + +const HEADER := 0x0b20 +const BYTE_LENGTH := 2 + 1 + 2 + 7*38 + +# TODO + + +static func from_bytes(bytes: PackedByteArray) -> UpdateHotkeysPacket: + var packet = UpdateHotkeysPacket.new() + + return packet diff --git a/packets/map_server/update_party_invitation_state_packet.gd b/packets/map_server/update_party_invitation_state_packet.gd new file mode 100644 index 0000000..5efb064 --- /dev/null +++ b/packets/map_server/update_party_invitation_state_packet.gd @@ -0,0 +1,22 @@ +## rAthena References: +## - ZC_PARTY_CONFIG +## - clif_partyinvitationstate +class_name UpdatePartyInvitationState +extends Packet + + +const HEADER := 0x02c9 +const BYTE_LENGTH := 3 + + +## Byte Type: u8 +## Byte Length: 1 +var deny_invites: bool + + +static func from_bytes(bytes: PackedByteArray) -> UpdatePartyInvitationState: + var packet = UpdatePartyInvitationState.new() + + packet.deny_invites = bytes.decode_u8(2) + + return packet diff --git a/packets/map_server/update_show_equip_packet.gd b/packets/map_server/update_show_equip_packet.gd new file mode 100644 index 0000000..5693550 --- /dev/null +++ b/packets/map_server/update_show_equip_packet.gd @@ -0,0 +1,21 @@ +## rAthena References: +## - clif_equipcheckbox +class_name UpdateShowEquipPacket +extends Packet + + +const HEADER := 0x02da +const BYTE_LENGTH := 3 + + +## Byte Type: u8 +## Byte Length: 1 +var open_equip_window: bool + + +static func from_bytes(bytes: PackedByteArray) -> UpdateShowEquipPacket: + var packet = UpdateShowEquipPacket.new() + + packet.open_equip_window = bytes.decode_u8(2) + + return packet diff --git a/packets/map_server/update_skill_tree_packet.gd b/packets/map_server/update_skill_tree_packet.gd new file mode 100644 index 0000000..404f4a1 --- /dev/null +++ b/packets/map_server/update_skill_tree_packet.gd @@ -0,0 +1,26 @@ +## rAthena References: +## - ZC_SKILLINFO_LIST +## - clif_skillinfoblock +class_name UpdateSkillTreePacket +extends Packet + + +const HEADER := 0x010f +const BYTE_LENGTH := 0 + + +## Byte Type: u16 +## Byte Length: 2 +var packet_length: int + +var object_type: Array#Array[SkillInformation] + +# TODO + + +static func from_bytes(bytes: PackedByteArray) -> UpdateSkillTreePacket: + var packet = UpdateSkillTreePacket.new() + + packet.packet_length = bytes.decode_u16(2) + + return packet |