Exemplo n.º 1
0
 def gotWorldServer(res):
     hasFailed(res)
     if not res:
         raise NoResultsException
     ws = res[0]["worldServerID"]
     if ws not in self.getFactory("WorldServerCommServerFactory").worldServers:
         raise WorldServerLinkNotEstablishedException
     wsProto = self.getFactory("WorldServerCommServerFactory").worldServers[ws]
     return wsProto.protoDoJoinServer(proto, world).addCallback(noArgs(afterAddedNewClient), wsProto)
Exemplo n.º 2
0
 def protoDoJoinServer(self, proto, world=None):
     """
     Makes the protocol join the server.
     """
     # Send the basic information over
     def afterNewPlayer():
         d = self.sendStateUpdate(proto.sessionID, proto.player, requireResponse=True)
         self.logger.info("Sent request for {} to join worldServer {}".format(proto.player["username"], self.id))
         return d
     return self.sendNewPlayer(proto.sessionID).addCallback(noArgs(afterNewPlayer))
Exemplo n.º 3
0
        def gotData():
            # OK, see if there's anyone else with that username
            usernameList = self.parent.factory.buildUsernameList()
            if self.parent.player["username"].lower() in usernameList:
                # Kick the other guy out
                self.parent.factory.clients[usernameList[self.parent.player["username"]]]["protocol"].sendError(
                    "You logged in on another computer.", disconnectNow=True)
                return

            # All check complete. Request World Server to prepare level
            self.parent.identified = True
            self.parent.factory.assignWorldServer(self.parent).addBoth(noArgs(afterAssignedWorldServer))
Exemplo n.º 4
0
 def gotBans(data):
     # Are they banned?
     if data:
         self.parent.sendError("You are banned: {}".format(data["reason"]))
         return
     self.parent.factory.getUserByUsername(self.parent.player["username"]).addBoth(populateData).addBoth(noArgs(gotData))
Exemplo n.º 5
0
 def afterDBAPIReady():
     # Get our ID
     wsFactory.loadID().addCallback(noArgs(afterLoadedSelfID))
Exemplo n.º 6
0
 def afterLoadedSelfID():
     serv.factories["WorldServerFactory"].loadPreloadedWorlds().addCallback(noArgs(afterLoadedPreloadedWorlds))