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): # 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)) 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("No such character") elif isinstance(packet, p.LoginComplete): self._success(self._client)
def __init__(self, client, username, password, auth_id, character): Engine.__init__(self, client) self.character = character client.send(p.GameLogin(username, password, auth_id))