def _unpack(self): self.victim_id = Packet.unpack_uint8(self.buffer) self.killer_id = Packet.unpack_uint8(self.buffer) self.reason = Packet.unpack_uint16(self.buffer) self.shot_id = Packet.unpack_uint16(self.buffer) self.flag = Packet.unpack_flag(self.buffer) if self.reason == code_from_chars('pd'): self.physics_driver_id = Packet.unpack_uint32(self.buffer)
def unpack(self, buf: BinaryIO) -> None: self.magic_number = Packet.unpack_uint32(buf) self.version = Packet.unpack_uint32(buf) self.offset = Packet.unpack_uint32(buf) self.file_time = Packet.unpack_int64(buf) self.player = Packet.unpack_uint32(buf) self.flags_size = Packet.unpack_uint32(buf) self.world_size = Packet.unpack_uint32(buf) self.callsign = Packet.unpack_string(buf, NetworkProtocol.CALLSIGN_LEN) self.motto = Packet.unpack_string(buf, NetworkProtocol.MOTTO_LEN) self.server_version = Packet.unpack_string(buf, NetworkProtocol.SERVER_LEN) self.app_version = Packet.unpack_string(buf, NetworkProtocol.MESSAGE_LEN) self.real_hash = Packet.unpack_string(buf, NetworkProtocol.HASH_LEN) self.length = ReplayDuration(self.file_time) # Skip the appropriate number of bytes since we're not making use of this # data yet buf.read(4 + NetworkProtocol.WORLD_SETTING_SIZE) if self.flags_size > 0: buf.read(self.flags_size) buf.read(self.world_size)
def _unpack(self): self.msb = Packet.unpack_uint32(self.buffer) self.lsb = Packet.unpack_uint32(self.buffer)