def on_packet(self, packet): if isinstance(packet, p.ServerList): self._failure("Refusing to use second server list") elif isinstance(packet, p.Relay): self._failure("Refusing to follow second relay") elif isinstance(packet, p.CharacterList): character = packet.find(self.character) if character: self._client.send(p.PlayCharacter(character.slot)) self._client.send(p.ClientVersion('5.0.8.3')) else: self._failure("No such character") elif isinstance(packet, p.LoginComplete): self._success(self._client)
def on_packet(self, packet): if isinstance(packet, p.ServerList): self._client.send(p.PlayServer(0)) elif isinstance(packet, p.Relay): # connect to the game server self._client.relay_to(packet.ip, packet.port, packet.auth_id) self._client.send(p.GameLogin(self._username, self._password, packet.auth_id)) elif isinstance(packet, p.CharacterList): character = packet.find(self._character) if character: self._client.send(p.PlayCharacter(character.slot)) self._client.send(p.ClientVersion('5.0.8.3')) else: self._failure(RuntimeError("No such character")) elif isinstance(packet, p.LoginComplete): self._success()
def on_packet(self, packet): if isinstance(packet, p.ServerList): self._client.send(p.PlayServer(0)) elif isinstance(packet, p.Relay): self._disconnect() # connect to the game server d = self.connect(packet.ip, packet.port, seed=packet.auth_id, decompress=True) d.addCallback( lambda client: self._on_connect(client, packet.auth_id)) d.addErrback(lambda f: self._failure(f)) elif isinstance(packet, p.CharacterList): character = packet.find(self.character) if character: self._client.send(p.PlayCharacter(character.slot)) self._client.send(p.ClientVersion('5.0.8.3')) else: self._failure("No such character") elif isinstance(packet, p.LoginComplete): self._success(self._client)