summaryrefslogtreecommitdiff
path: root/packets/character_server
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-12-15 14:23:25 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-12-15 14:23:25 +0100
commita14e88ff4d0d87841a44254e2bff1784da6e8b48 (patch)
tree0507cb8117da7943805a6479aef4526edb2db4dd /packets/character_server
parentca4d1945598863d0ce297f4272317e5dd5797f88 (diff)
next commit
Diffstat (limited to 'packets/character_server')
-rw-r--r--packets/character_server/block_character_packet.gd22
-rw-r--r--packets/character_server/character_list_size_packet.gd25
-rw-r--r--packets/character_server/character_selection_failed_packet.gd19
-rw-r--r--packets/character_server/character_selection_success_packet.gd48
-rw-r--r--packets/character_server/character_server_login_success_character_list_packet.gd42
-rw-r--r--packets/character_server/character_server_login_success_packet.gd42
-rw-r--r--packets/character_server/pin_code_state_packet.gd36
-rw-r--r--packets/character_server/request_character_list_success_packet.gd22
8 files changed, 256 insertions, 0 deletions
diff --git a/packets/character_server/block_character_packet.gd b/packets/character_server/block_character_packet.gd
new file mode 100644
index 0000000..aa35cce
--- /dev/null
+++ b/packets/character_server/block_character_packet.gd
@@ -0,0 +1,22 @@
+# TODO: check chclif_block_character in rAthena
+class_name BlockCharacterPacket
+extends Packet
+
+
+const HEADER := 0x020d
+const BYTE_LENGTH := 0
+
+
+## Byte Type: u16
+## Byte Length: 2
+var packet_length: int
+
+# TODO
+
+
+static func from_bytes(bytes: PackedByteArray):
+ var packet = BlockCharacterPacket.new()
+
+ packet.packet_length = bytes.decode_u16(2)
+
+ return packet
diff --git a/packets/character_server/character_list_size_packet.gd b/packets/character_server/character_list_size_packet.gd
new file mode 100644
index 0000000..9491e1d
--- /dev/null
+++ b/packets/character_server/character_list_size_packet.gd
@@ -0,0 +1,25 @@
+# TODO: really correct? chclif_charlist_notify in rAthena
+class_name CharacterListSizePacket
+extends Packet
+
+
+const HEADER := 0x09a0
+const BYTE_LENGTH := 6
+
+
+## Byte Type: u32
+## Byte Length: 4
+var page_to_load: int
+
+## Byte Type: u16
+## Byte Length: 2
+var character_slot_count: int
+
+
+static func from_bytes(bytes: PackedByteArray):
+ var packet = CharacterListSizePacket.new()
+
+ packet.page_to_load = bytes.decode_u32(2)
+ packet.character_slot_count = bytes.decode_u16(4)
+
+ return packet
diff --git a/packets/character_server/character_selection_failed_packet.gd b/packets/character_server/character_selection_failed_packet.gd
new file mode 100644
index 0000000..5f6cb8a
--- /dev/null
+++ b/packets/character_server/character_selection_failed_packet.gd
@@ -0,0 +1,19 @@
+class_name CharacterSelectionFailedPacket
+extends Packet
+
+
+const HEADER := 0x006c
+const BYTE_LENGTH := 3
+
+
+## Byte Type: u8
+## Byte Length: 1
+var reason: int
+
+
+static func from_bytes(bytes: PackedByteArray):
+ var packet = CharacterSelectionFailedPacket.new()
+
+ packet.reason = bytes.decode_u8(2)
+
+ return packet
diff --git a/packets/character_server/character_selection_success_packet.gd b/packets/character_server/character_selection_success_packet.gd
new file mode 100644
index 0000000..b188d42
--- /dev/null
+++ b/packets/character_server/character_selection_success_packet.gd
@@ -0,0 +1,48 @@
+class_name CharacterSelectionSuccessPacket
+extends Packet
+
+
+const HEADER := 0x0ac5
+const BYTE_LENGTH := 156
+
+
+## Byte Type: u32
+## Byte Length: 4
+var character_id: int
+
+## Byte Type: u8
+## Byte Length: 16
+var map_name: String
+
+## Byte Type: u32
+## Byte Length: 4
+var map_server_ip: PackedByteArray
+
+## Byte Type: u16
+## Byte Length: 2
+var map_server_port: int
+
+## Byte Type: u8
+## Byte Length: 128
+var unknown: PackedByteArray
+
+
+func get_map_server_ip():
+ return "%s.%s.%s.%s" % [
+ map_server_ip.decode_u8(0),
+ map_server_ip.decode_u8(1),
+ map_server_ip.decode_u8(2),
+ map_server_ip.decode_u8(3)
+ ]
+
+
+static func from_bytes(bytes: PackedByteArray):
+ var packet = CharacterSelectionSuccessPacket.new()
+
+ packet.character_id = bytes.decode_u32(2)
+ packet.map_name = bytes.slice(6, 6 + 16).get_string_from_utf8()
+ packet.map_server_ip = bytes.slice(22, 22 + 4)
+ packet.map_server_port = bytes.decode_u16(26)
+ packet.unknown = bytes.slice(28)
+
+ return packet
diff --git a/packets/character_server/character_server_login_success_character_list_packet.gd b/packets/character_server/character_server_login_success_character_list_packet.gd
new file mode 100644
index 0000000..e3a649b
--- /dev/null
+++ b/packets/character_server/character_server_login_success_character_list_packet.gd
@@ -0,0 +1,42 @@
+class_name CharacterServerLoginSuccessCharacterListPacket
+extends Packet
+
+
+const HEADER := 0x006b
+const BYTE_LENGTH := 0
+
+
+## Byte Type: u16
+## Byte Length: 2
+var packet_length: int
+
+## Byte Type: u8
+## Byte Length: 1
+var maximum_slot_count: int
+
+## Byte Type: u8
+## Byte Length: 1
+var available_slot_count: int
+
+## Byte Type: u8
+## Byte Length: 1
+var vip_slot_count: int
+
+## Byte Type: u8
+## Byte Length: 20
+var unknown: PackedByteArray
+
+var character_information: Array[CharacterInformation]
+
+
+static func from_bytes(bytes: PackedByteArray):
+ var packet = CharacterServerLoginSuccessCharacterListPacket.new()
+
+ packet.packet_length = bytes.decode_u16(2)
+ packet.maximum_slot_count = bytes.decode_u8(4)
+ packet.maximum_slot_count = bytes.decode_u8(5)
+ packet.maximum_slot_count = bytes.decode_u8(6)
+ packet.unknown = bytes.slice(7, 7 + 20)
+ packet.character_information = CharacterInformation.array_from_bytes(bytes.slice(27))
+
+ return packet
diff --git a/packets/character_server/character_server_login_success_packet.gd b/packets/character_server/character_server_login_success_packet.gd
new file mode 100644
index 0000000..f3da048
--- /dev/null
+++ b/packets/character_server/character_server_login_success_packet.gd
@@ -0,0 +1,42 @@
+class_name CharacterServerLoginSuccessPacket
+extends Packet
+
+
+const HEADER := 0x082d
+const BYTE_LENGTH := 29
+
+
+## Byte Length: 2
+var unknown: int
+
+## Byte Length: 1
+var normal_slot_count: int
+
+## Byte Length: 1
+var vip_slot_count: int
+
+## Byte Length: 1
+var billing_slot_count: int
+
+## Byte Length: 1
+var producible_slot_count: int
+
+## Byte Length: 1
+var valid_slot: int
+
+## Byte Length: 20
+var unused: PackedByteArray
+
+
+static func from_bytes(bytes: PackedByteArray):
+ var packet = CharacterServerLoginSuccessPacket.new()
+
+ packet.unknown = bytes.decode_u16(2)
+ packet.normal_slot_count = bytes.decode_u8(4)
+ packet.vip_slot_count = bytes.decode_u8(5)
+ packet.billing_slot_count = bytes.decode_u8(6)
+ packet.producible_slot_count = bytes.decode_u8(7)
+ packet.valid_slot = bytes.decode_u8(8)
+ packet.unused = bytes.slice(9, 9 + 20)
+
+ return packet
diff --git a/packets/character_server/pin_code_state_packet.gd b/packets/character_server/pin_code_state_packet.gd
new file mode 100644
index 0000000..ab75618
--- /dev/null
+++ b/packets/character_server/pin_code_state_packet.gd
@@ -0,0 +1,36 @@
+## rAthena References:
+## - chclif_pincode_sendstate
+class_name PinCodeStatePacket
+extends Packet
+
+
+const HEADER := 0x08b9
+const BYTE_LENGTH := 12
+
+
+## Byte Type: u32
+## Byte Length: 4
+var pin_code_seed: int
+
+## Byte Type: u32
+## Byte Length: 4
+var account_id: int
+
+## Byte Type: u8
+## Byte Length: 1
+var pin_code_state: Constants.PinCodeState
+
+## Byte Type: u8
+## Byte Length: 1
+var unused: PackedByteArray
+
+
+static func from_bytes(bytes: PackedByteArray):
+ var packet = PinCodeStatePacket.new()
+
+ packet.pin_code_seed = bytes.decode_u32(2)
+ packet.account_id = bytes.decode_u32(6)
+ packet.pin_code_state = bytes.decode_u8(10)
+ packet.unused = bytes.slice(11)
+
+ return packet
diff --git a/packets/character_server/request_character_list_success_packet.gd b/packets/character_server/request_character_list_success_packet.gd
new file mode 100644
index 0000000..342bccb
--- /dev/null
+++ b/packets/character_server/request_character_list_success_packet.gd
@@ -0,0 +1,22 @@
+class_name RequestCharacterListSuccessPacket
+extends Packet
+
+
+const HEADER := 0x0b72
+const BYTE_LENGTH := 0
+
+
+## Byte Type: u16
+## Byte Length: 2
+var packet_length: int
+
+var character_information: Array[CharacterInformation]
+
+
+static func from_bytes(bytes: PackedByteArray):
+ var packet = RequestCharacterListSuccessPacket.new()
+
+ packet.packet_length = bytes.decode_u16(2)
+ packet.character_information = CharacterInformation.array_from_bytes(bytes.slice(4))
+
+ return packet