class_name AchievementData extends PacketChunk const BYTE_LENGTH := 50 ## Byte Type: u32 ## Byte Length: 4 var achievement_id: int ## Byte Type: u8 ## Byte Length: 1 var is_completed: bool ## Byte Type: u32 ## Byte Length: 4 * 10 var objectives: PackedByteArray ## Byte Type: u32 ## Byte Length: 4 var completion_timestamp: int ## Byte Type: u8 ## Byte Length: 1 var got_rewarded: bool static func from_bytes(bytes: PackedByteArray) -> AchievementData: var achievement_data = AchievementData.new() achievement_data.achievement_id = bytes.decode_u32(0) achievement_data.is_completed = bytes.decode_u8(4) achievement_data.objectives = bytes.slice(5, 5 + 40) achievement_data.completion_timestamp = bytes.decode_u32(45) achievement_data.got_rewarded = bytes.decode_u8(49) return achievement_data static func array_from_bytes(bytes: PackedByteArray) -> Array[AchievementData]: var array: Array[AchievementData] = [] var offset = 0 while offset < bytes.size(): var chunk = from_bytes(bytes.slice(offset)) array.append(chunk) offset += chunk.byte_length return array