diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-11-28 18:38:42 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-11-28 18:38:42 +0100 |
commit | e8aa9f50886b66d525307a58d71036e6fd3d4aa1 (patch) | |
tree | ce6f59eecf1eb3e1ba2794166c09623d8a2d7d83 /packets/map_server_login_success_packet.gd | |
parent | c89f25f59aa493d95bcac8e75ca5cdd57a0403e7 (diff) |
next commit
Diffstat (limited to 'packets/map_server_login_success_packet.gd')
-rw-r--r-- | packets/map_server_login_success_packet.gd | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/packets/map_server_login_success_packet.gd b/packets/map_server_login_success_packet.gd new file mode 100644 index 0000000..9eecc65 --- /dev/null +++ b/packets/map_server_login_success_packet.gd @@ -0,0 +1,48 @@ +class_name MapServerLoginSuccessPacket +extends Packet + + +static var header := 0x02eb + + +## 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 + + +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(0) + packet.position = bytes.slice(4, 4 + 3) + packet.ignored = bytes.slice(7, 7 + 2) + packet.font = bytes.decode_u32(9) + + return packet + + +static func from_bytes_via_peer(peer: StreamPeer): + var _header = peer.get_data(2) + var remaining_bytes = peer.get_data(peer.get_available_bytes()) + + return from_bytes(remaining_bytes[1]) |