summaryrefslogtreecommitdiff
path: root/packets/login_server_login_success_packet.gd
blob: ce6a058ff69d5f90420f995bd5df383a82aa74a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
class_name LoginServerLoginSuccessPacket
extends Packet


const HEADER := 0x0ac4
const BYTE_LENGTH := 0


## Byte Type: u16
## Byte Length: 2
var packet_length: int

## Byte Type: u32
## Byte Length: 4
var login_id1: int

## Byte Type: u32
## Byte Length: 4
var account_id: int

## Byte Type: u32
## Byte Length: 4
var login_id2: int

## Deprecated and always 0 on rAthena
## Byte Type: u32
## Byte Length: 4
var ip_address: PackedByteArray

## Deprecated and always 0 on rAthena
## Byte Type: u8
## Byte Length: 26
var last_login: PackedByteArray

## Byte Type: u8
## Byte Length: 1
var gender: Constants.Gender

## Byte Type: u8
## Byte Length: 17
var auth_token: String

var character_server_information: Array[CharacterServerInformation]


static func from_bytes(bytes: PackedByteArray):
	var packet = LoginServerLoginSuccessPacket.new()
	
	packet.packet_length = bytes.decode_u16(2)
	packet.login_id1 = bytes.decode_u32(4)
	packet.account_id = bytes.decode_u32(8)
	packet.login_id2 = bytes.decode_u32(12)
	packet.ip_address = bytes.slice(16, 20)
	packet.last_login = bytes.slice(20, 20 + 26)
	packet.gender = bytes[46]
	packet.auth_token = bytes.slice(47, 47 + 17).get_string_from_utf8()
	packet.character_server_information = CharacterServerInformation.array_from_bytes(bytes.slice(64))
	
	return packet