def parse(self, data: bytes) -> FastPathPDU: stream = BytesIO(data) header = Uint8.unpack(stream) eventCount = self.parseEventCount(header) pduLength = self.parseLength(stream) if eventCount == 0: eventCount = Uint8.unpack(stream) data = stream.read(pduLength - stream.tell()) events = self.parseEvents(data) return FastPathPDU(header, events)
def parse(self, data: bytes) -> FastPathPDU: stream = BytesIO(data) header = Uint8.unpack(stream) eventCount = self.parseEventCount(header) pduLength = self.parseLength(stream) _signature = stream.read(8) if eventCount == 0: eventCount = Uint8.unpack(stream) data = stream.read(pduLength - stream.tell()) if header & FastPathSecurityFlags.FASTPATH_OUTPUT_ENCRYPTED != 0: data = self.crypter.decrypt(data) self.crypter.addDecryption() events = self.parseEvents(data) return FastPathPDU(header, events)
def sendOutputEvents(self, events: [FastPathOutputEvent]): pdu = FastPathPDU(0, events) self.client.sendPDU(pdu)
def sendInputEvents(self, events: [FastPathInputEvent]): pdu = FastPathPDU(0, events) self.recorder.record(pdu, PlayerPDUType.FAST_PATH_INPUT, True) self.server.sendPDU(pdu)