def load(self, bytes, frames, event_type, event_code, pid): event = ResourceTransferEvent(frames, event_type, event_code, pid) bytes.skip(1) # 84 event.sender = event.player event.receiver = event.code >> 4 #I might need to shift these two things to 19, 11, 3 for first 3 shifts event.minerals = bytes.get_big_8() << 20 | bytes.get_big_8() << 12 | bytes.get_big_8() << 4 | bytes.get_big_8() >> 4 event.gas = bytes.get_big_8() << 20 | bytes.get_big_8() << 12 | bytes.get_big_8() << 4 | bytes.get_big_8() >> 4 #unknown extra stuff bytes.skip(2) return event
def load(self, bytes, frames, event_type, event_code, pid): event = ResourceTransferEvent(frames, event_type, event_code, pid) bytes.skip(1) # 84 event.sender = event.player event.receiver = event.code >> 4 #I might need to shift these two things to 19, 11, 3 for first 3 shifts event.minerals = bytes.get_big_8() << 20 | bytes.get_big_8( ) << 12 | bytes.get_big_8() << 4 | bytes.get_big_8() >> 4 event.gas = bytes.get_big_8() << 20 | bytes.get_big_8( ) << 12 | bytes.get_big_8() << 4 | bytes.get_big_8() >> 4 #unknown extra stuff bytes.skip(2) return event
def load(self, bytes, frames, event_type, event_code, pid): event = ResourceTransferEvent(frames, event_type, event_code, pid) #Always 17 bytes long event.sender = event.player event.reciever = event.code >> 4 bytes.get_big_8() #Always 84 #Minerals and Gas are encoded the same way resource_block = bytes.get_big_32() base, extension = resource_block >> 8, resource_block & 0xFF event.minerals = base*(extension >> 4)+ (extension & 0x0F) resource_block = bytes.get_big_32() base, extension = resource_block >> 8, resource_block & 0xFF event.gas = base*(extension >> 4)+ (extension & 0x0F) #Another 8 bytes that don't make sense bytes.skip(8) return event
def load(self, bytes, frames, event_type, event_code, pid): event = ResourceTransferEvent(frames, event_type, event_code, pid) #Always 17 bytes long event.sender = event.player event.reciever = event.code >> 4 bytes.get_big_8() #Always 84 #Minerals and Gas are encoded the same way resource_block = bytes.get_big_32() base, extension = resource_block >> 8, resource_block & 0xFF event.minerals = base * (extension >> 4) + (extension & 0x0F) resource_block = bytes.get_big_32() base, extension = resource_block >> 8, resource_block & 0xFF event.gas = base * (extension >> 4) + (extension & 0x0F) #Another 8 bytes that don't make sense bytes.skip(8) return event