def pack(self): name_offset = self.REGION_STRUCT.size packed_name = pad_chars(self.get_name_to_pack(), encoding='shift-jis', pad_to_multiple_of=4) unknown_offset_1 = name_offset + len(packed_name) unknown_offset_2 = unknown_offset_1 + 4 packed_type_data = self.pack_type_data() if packed_type_data: type_data_offset = unknown_offset_2 + 4 entity_id_offset = type_data_offset + len(packed_type_data) else: type_data_offset = 0 entity_id_offset = unknown_offset_2 + 4 packed_base_data = self.REGION_STRUCT.pack( name_offset=name_offset, region_index=self._region_index, region_type=self.ENTRY_TYPE, translate=list(self.translate), rotate=list(self.rotate), unknown_offset_1=unknown_offset_1, unknown_offset_2=unknown_offset_2, type_data_offset=type_data_offset, entity_id_offset=entity_id_offset, ) packed_entity_id = struct.pack('i', self.entity_id) return packed_base_data + packed_name + b'\0\0\0\0' * 2 + packed_type_data + packed_entity_id
def pack(self, region_index=0): name_offset = self.REGION_STRUCT.size packed_name = pad_chars(self.get_name_to_pack(), encoding=self.NAME_ENCODING, pad_to_multiple_of=4) unknown_offset_1 = name_offset + len(packed_name) unknown_offset_2 = unknown_offset_1 + 4 packed_type_data = self.pack_type_data() if packed_type_data: type_data_offset = unknown_offset_2 + 4 entity_id_offset = type_data_offset + len(packed_type_data) else: type_data_offset = 0 entity_id_offset = unknown_offset_2 + 4 packed_base_data = self.REGION_STRUCT.pack( name_offset=name_offset, __region_index=region_index, region_type=self.ENTRY_SUBTYPE, translate=list(self.translate), rotate=list(self.rotate), unknown_offset_1=unknown_offset_1, unknown_offset_2=unknown_offset_2, type_data_offset=type_data_offset, entity_id_offset=entity_id_offset, ) packed_entity_id = struct.pack("i", self.entity_id) return packed_base_data + packed_name + b"\0\0\0\0" * 2 + packed_type_data + packed_entity_id
def pack(self): name_offset = self.EVENT_HEADER_STRUCT.size packed_name = pad_chars(self.get_name_to_pack(), encoding=self.NAME_ENCODING, pad_to_multiple_of=4) base_data_offset = name_offset + len(packed_name) packed_base_data = self.EVENT_BASE_DATA_STRUCT.pack(self) type_data_offset = base_data_offset + len(packed_base_data) packed_type_data = self.pack_type_data() packed_header = self.EVENT_HEADER_STRUCT.pack( __name_offset=name_offset, _event_index=self._event_index, __event_type=self.ENTRY_SUBTYPE, _local_event_index=self._local_event_index, __base_data_offset=base_data_offset, __type_data_offset=type_data_offset, ) return packed_header + packed_name + packed_base_data + packed_type_data
def pack(self): name_offset = self.EVENT_HEADER_STRUCT.size packed_name = pad_chars(self.get_name_to_pack(), encoding='shift-jis', pad_to_multiple_of=4) base_data_offset = name_offset + len(packed_name) packed_base_data = self.EVENT_BASE_DATA_STRUCT.pack( part_index=self._base_part_index, region_index=self._base_region_index, entity_id=self.entity_id, ) type_data_offset = base_data_offset + len(packed_base_data) packed_type_data = self.pack_type_data() packed_header = self.EVENT_HEADER_STRUCT.pack( name_offset=name_offset, event_index=self._event_index, event_type=self.ENTRY_TYPE, local_event_index=self._local_event_index, base_data_offset=base_data_offset, type_data_offset=type_data_offset, ) return packed_header + packed_name + packed_base_data + packed_type_data