diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-12-22 18:38:11 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-12-22 18:38:11 +0100 |
commit | 7b3f386449aeab124d84d2aff4c273e646e68763 (patch) | |
tree | 9d24a7de247d190edcd8e315fc3e45ab8a4a8d34 /packets/map_server | |
parent | f4e07d090cded56ebab54363f1b47f1ea45c8682 (diff) |
Diffstat (limited to 'packets/map_server')
-rw-r--r-- | packets/map_server/moving_entity_appeared_packet.gd | 181 |
1 files changed, 178 insertions, 3 deletions
diff --git a/packets/map_server/moving_entity_appeared_packet.gd b/packets/map_server/moving_entity_appeared_packet.gd index 50afaf5..4ff9a9e 100644 --- a/packets/map_server/moving_entity_appeared_packet.gd +++ b/packets/map_server/moving_entity_appeared_packet.gd @@ -21,12 +21,187 @@ var object_type: int ## Byte Length: 4 var entity_id: int -# TODO +## Byte Type: u32 +## Byte Length: 4 +var group_id: int +## Byte Type: u16 +## Byte Length: 2 +var movement_speed: int + +## Byte Type: u16 +## Byte Length: 2 +var body_state: int + +## Byte Type: u16 +## Byte Length: 2 +var health_state: int + +## Byte Type: u32 +## Byte Length: 4 +var effect_state: int + +## Byte Type: u16 +## Byte Length: 2 +var job: int + +## Byte Type: u16 +## Byte Length: 2 +var head: int + +## Byte Type: u32 +## Byte Length: 4 +var weapon: int + +## Byte Type: u32 +## Byte Length: 4 +var shield: int + +## Byte Type: u16 +## Byte Length: 2 +var accessory: int + +## Byte Type: u32 +## Byte Length: 4 +var move_start_time: int + +## Byte Type: u16 +## Byte Length: 2 +var accessory2: int + +## Byte Type: u16 +## Byte Length: 2 +var accessory3: int + +## Byte Type: u16 +## Byte Length: 2 +var head_palette: int + +## Byte Type: u16 +## Byte Length: 2 +var body_palette: int + +## Byte Type: u16 +## Byte Length: 2 +var head_direction: int + +## Byte Type: u16 +## Byte Length: 2 +var robe: int -static func from_bytes(bytes: PackedByteArray) -> MovingEntityAppearedPacket: +## Byte Type: u32 +## Byte Length: 4 +var guild_id: int + +## Byte Type: u16 +## Byte Length: 2 +var emblem_version: int + +## Byte Type: u16 +## Byte Length: 2 +var honor: int + +## Byte Type: u32 +## Byte Length: 4 +var virtue: int + +## Byte Type: u8 +## Byte Length: 1 +var is_pk_mode_on: bool + +## Byte Type: u8 +## Byte Length: 1 +var gender: Constants.Gender + +## Byte Type: u8 +## Byte Length: 6 +var position: PackedByteArray + +## Byte Type: u8 +## Byte Length: 1 +var size_x: int + +## Byte Type: u8 +## Byte Length: 1 +var size_y: int + +## Byte Type: u16 +## Byte Length: 2 +var c_level: int + +## Byte Type: u16 +## Byte Length: 2 +var font: int + +## Byte Type: i32 +## Byte Length: 4 +var maximum_health_points: int + +## Byte Type: i32 +## Byte Length: 4 +var health_points: int + +## Byte Type: u8 +## Byte Length: 1 +var is_boss: bool + +## Byte Type: u16 +## Byte Length: 2 +var body: int + +## Byte Length: 24 +var name: String + + +func get_size() -> Vector2: + return Vector2( + size_x, + size_y + ) + + +static func from_bytes(pbytes: PackedByteArray) -> MovingEntityAppearedPacket: + var bytes := ByteStream.from_bytes(pbytes) + var packet = MovingEntityAppearedPacket.new() - packet.packet_length = bytes.decode_u16(2) + bytes.advance(2) # skip header + + packet.packet_length = bytes.decode_u16() + packet.object_type = bytes.decode_u8() + packet.entity_id = bytes.decode_u32() + packet.group_id = bytes.decode_u32() + packet.movement_speed = bytes.decode_u16() + packet.body_state = bytes.decode_u16() + packet.health_state = bytes.decode_u16() + packet.effect_state = bytes.decode_u32() + packet.job = bytes.decode_u16() + packet.head = bytes.decode_u16() + packet.weapon = bytes.decode_u32() + packet.shield = bytes.decode_u32() + packet.accessory = bytes.decode_u16() + packet.move_start_time = bytes.decode_u32() + packet.accessory2 = bytes.decode_u16() + packet.accessory3 = bytes.decode_u16() + packet.head_palette = bytes.decode_u16() + packet.body_palette = bytes.decode_u16() + packet.head_direction = bytes.decode_u16() + packet.robe = bytes.decode_u16() + packet.guild_id = bytes.decode_u32() + packet.emblem_version = bytes.decode_u16() + packet.honor = bytes.decode_u16() + packet.virtue = bytes.decode_u32() + packet.is_pk_mode_on = bytes.decode_u8() + packet.gender = bytes.decode_u8() + packet.position = bytes.get_buffer(6).bytes + packet.size_x = bytes.decode_u8() + packet.size_y = bytes.decode_u8() + packet.c_level = bytes.decode_u16() + packet.font = bytes.decode_u16() + packet.maximum_health_points = bytes.decode_s32() + packet.health_points = bytes.decode_s32() + packet.is_boss = bytes.decode_u8() + packet.body = bytes.decode_u16() + packet.name = bytes.get_string_from_utf8(24) return packet |