summaryrefslogtreecommitdiff
path: root/packets/login_server_login_packet.gd
blob: 5b4c1f3b2a996720a2767c2e877ee718b2fc4ed8 (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
class_name LoginServerLoginPacket
extends Packet


static var header := 0x064


## Byte Type: u32
## Byte Length: 4
var version: int = 0

## Byte Length: 24
var username: String

## Byte Length: 24
var password: String

## Byte Type: u8
## Byte Length: 1
var client_type: int = 0


func to_bytes():
	var username_bytes = username.to_utf8_buffer()
	username_bytes.resize(24)
	
	var password_bytes = password.to_utf8_buffer()
	password_bytes.resize(24)
	
	var payload = PackedByteArray([])
	payload.resize(4)
	payload.encode_u32(0, version)
	
	payload.append_array(username_bytes)
	payload.append_array(password_bytes)
	
	payload.resize(53)
	payload.encode_u8(52, client_type)
	
	return get_header() + payload