made woopsie, fix
This commit is contained in:
parent
f9a1b4c594
commit
500dd6a899
@ -67,7 +67,7 @@ class Client(ClientBase):
|
|||||||
if not self._channels:
|
if not self._channels:
|
||||||
return
|
return
|
||||||
|
|
||||||
await self.send_packet(iPacket(SendOps.CHARLIST_REQUEST))
|
await self.send_packet(oPacket(SendOps.CHARLIST_REQUEST))
|
||||||
return
|
return
|
||||||
|
|
||||||
world_name = ipkt.decode_string()
|
world_name = ipkt.decode_string()
|
||||||
|
@ -120,32 +120,32 @@ class ClientBase:
|
|||||||
else:
|
else:
|
||||||
nbytes = -1
|
nbytes = -1
|
||||||
|
|
||||||
await sleep(0.5)
|
buf = bytearray(self._buff)[4:length + 4][:]
|
||||||
|
|
||||||
async with self._lock:
|
print(length, len(buf))
|
||||||
buf = bytearray(self._buff)[4:length + 4][:]
|
|
||||||
|
|
||||||
if length == len(buf):
|
if length == len(buf):
|
||||||
buf = MapleAes.transform(buf, self._recv_iv)
|
buf = MapleAes.transform(buf, self._recv_iv)
|
||||||
buf = decrypt_transform(buf)
|
buf = decrypt_transform(buf)
|
||||||
packet = iPacket(buf)
|
packet = iPacket(buf)
|
||||||
|
|
||||||
print(f"Received packet: {packet.to_string()}")
|
print(f"Received packet: {packet.to_string()}")
|
||||||
|
|
||||||
self._buff = bytearray()
|
self._buff = bytearray()
|
||||||
|
|
||||||
self.handle_packet(packet)
|
self.handle_packet(packet)
|
||||||
|
|
||||||
def handle_packet(self, packet):
|
def handle_packet(self, packet):
|
||||||
coro = None
|
coro = None
|
||||||
|
|
||||||
for packet_handler in self._packet_handlers:
|
for pkt_hndl in self._packet_handlers:
|
||||||
if packet_handler.op_code == packet.op_code:
|
print(f"handler: {pkt_hndl.op_code} | packet: {packet.op_code}")
|
||||||
coro = packet_handler.callback
|
if int(pkt_hndl.op_code) == int(packet.op_code):
|
||||||
|
coro = pkt_hndl.callback
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print(f"Unhandled packet: {packet.op_code}")
|
print(f"Unhandled packet: {packet.op_code}")
|
||||||
return
|
return
|
||||||
|
|
||||||
if not coro:
|
if not coro:
|
||||||
raise AttributeError
|
raise AttributeError
|
||||||
|
Loading…
Reference in New Issue
Block a user