diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-11-28 00:45:30 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-11-28 00:45:30 +0100 |
commit | c89f25f59aa493d95bcac8e75ca5cdd57a0403e7 (patch) | |
tree | e1eb14f3b27ab8bcce68551424fe49a4f7d376af /packets/login_server_login_success_packet.gd |
initial commit
Diffstat (limited to 'packets/login_server_login_success_packet.gd')
-rw-r--r-- | packets/login_server_login_success_packet.gd | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/packets/login_server_login_success_packet.gd b/packets/login_server_login_success_packet.gd new file mode 100644 index 0000000..3d74289 --- /dev/null +++ b/packets/login_server_login_success_packet.gd @@ -0,0 +1,54 @@ +class_name LoginServerLoginSuccessPacket +extends Packet + + +## Byte Length: 4 +var login_id1: int + +## Byte Length: 4 +var account_id: int + +## Byte Length: 4 +var login_id2: int + +## Deprecated and always 0 on rAthena +## Byte Length: 4 +var ip_address: PackedByteArray + +## Deprecated and always 0 on rAthena +## Byte Length: 24 +var name: String + +## Always 0 on rAthena +## Byte Length: 2 +var unknown: int + +## Byte Length: 1 +var gender: Constants.Gender + +## Byte Length: 17 +var auth_token: String + +var character_server_information: Array + + +static func from_bytes(bytes: PackedByteArray): + var packet = LoginServerLoginSuccessPacket.new() + + packet.login_id1 = bytes.decode_u32(0) + packet.account_id = bytes.decode_u32(4) + packet.login_id2 = bytes.decode_u32(8) + packet.ip_address = bytes.slice(12, 16) + packet.name = bytes.slice(16, 16 + 24).get_string_from_utf8() + packet.unknown = bytes.decode_u16(40) + packet.gender = bytes[42] + packet.auth_token = bytes.slice(43, 43 + 17 - 1).get_string_from_utf8() + packet.character_server_information = CharacterServerInformation.array_from_bytes(bytes.slice(60)) + + return packet + +static func from_bytes_via_peer(peer: StreamPeer): + var _header = peer.get_data(4) + var remaining_bytes = peer.get_data(peer.get_available_bytes()) + + return from_bytes(remaining_bytes[1]) |