summaryrefslogtreecommitdiff
path: root/packets/map_server_login_success_packet.gd
blob: 9b70428cb53870eee723c5406fc5638ba881c10b (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
## rAthena References:
## - PACKET_ZC_ACCEPT_ENTER
## - clif_authok
class_name MapServerLoginSuccessPacket
extends Packet


const HEADER := 0x02eb
const BYTE_LENGTH := 13


## 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

## Byte Type: u8
## Byte Length: 1
## Depends on packet version
var gender: Constants.Gender


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(2)
	packet.position = bytes.slice(6, 6 + 3)
	packet.ignored = bytes.slice(9, 9 + 2)
	packet.font = bytes.decode_u16(11)
	#packet.gender = bytes.decode_u8(13)
	
	return packet