blob: eaf8d2e79f857d4e7ab22f578fe905a1dfd3d182 (
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
60
61
62
63
64
65
|
class_name QuestDetails
extends PacketChunk
## Byte Type: u32
## Byte Length: 4
var hunt_identification: int
## Byte Type: u32
## Byte Length: 4
var objective_type: int
## Byte Type: u32
## Byte Length: 4
var mob_id: int
## Byte Type: u16
## Byte Length: 2
var minimum_level: int
## Byte Type: u16
## Byte Length: 2
var maximum_level: int
## Byte Type: u16
## Byte Length: 2
var kill_count: int
## Byte Type: u16
## Byte Length: 2
var total_count: int
## Byte Type: u8
## Byte Length: 24
var mob_name: String
func get_byte_length():
return 44
static func from_bytes(bytes: PackedByteArray):
var details = QuestDetails.new()
details.server_ip = bytes.slice(0, 4)
details.server_port = bytes.decode_u16(4)
details.server_name = bytes.slice(6, 6 + 20).get_string_from_utf8()
details.user_count = bytes.decode_u16(26)
details.server_type = bytes.decode_u16(28)
details.display_new = bytes.decode_u16(30)
details.unknown = bytes.slice(32)
return details
static func array_from_bytes(bytes: PackedByteArray) -> Array:
var array = []
var offset = 0
while offset < bytes.size():
var chunk = from_bytes(bytes.slice(offset))
array.append(chunk)
offset += chunk.byte_length
return array
|