made woopsie, fix

This commit is contained in:
Ra 2022-03-11 20:00:30 -07:00
parent f9a1b4c594
commit 500dd6a899
2 changed files with 17 additions and 17 deletions

View File

@ -67,7 +67,7 @@ class Client(ClientBase):
if not self._channels:
return
await self.send_packet(iPacket(SendOps.CHARLIST_REQUEST))
await self.send_packet(oPacket(SendOps.CHARLIST_REQUEST))
return
world_name = ipkt.decode_string()

View File

@ -120,32 +120,32 @@ class ClientBase:
else:
nbytes = -1
await sleep(0.5)
buf = bytearray(self._buff)[4:length + 4][:]
async with self._lock:
buf = bytearray(self._buff)[4:length + 4][:]
print(length, len(buf))
if length == len(buf):
buf = MapleAes.transform(buf, self._recv_iv)
buf = decrypt_transform(buf)
packet = iPacket(buf)
if length == len(buf):
buf = MapleAes.transform(buf, self._recv_iv)
buf = decrypt_transform(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):
coro = None
for packet_handler in self._packet_handlers:
if packet_handler.op_code == packet.op_code:
coro = packet_handler.callback
for pkt_hndl in self._packet_handlers:
print(f"handler: {pkt_hndl.op_code} | packet: {packet.op_code}")
if int(pkt_hndl.op_code) == int(packet.op_code):
coro = pkt_hndl.callback
break
else:
print(f"Unhandled packet: {packet.op_code}")
return
else:
print(f"Unhandled packet: {packet.op_code}")
return
if not coro:
raise AttributeError