summaryrefslogtreecommitdiff
path: root/character_information.gd
blob: 101f74ffcde5bc071fef1a50cd3a0db34d4af8e6 (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
class_name CharacterInformation


## Byte Length: 4
var character_id: int

## Byte Length: 8
var experience: int

## Byte Length: 4
var money: int


static func from_bytes(bytes: PackedByteArray):
	var info = CharacterInformation.new()
	
	info.character_id = bytes.decode_u32(0)
	info.experience = bytes.decode_s64(4)
	info.money = bytes.decode_s32(12)
	
	return info


static func array_from_bytes(bytes: PackedByteArray) -> Array:
	var array = []
	
	var offset = 0
	while offset < bytes.size():
		array.append(from_bytes(bytes.slice(offset)))
		offset += 175
	
	return array