def __init__(self, name, mind, realm): self.name = name self.mind = mind self.realm = realm if self.name: row = Clients.byUsername(self.name) row.status = Clients.Online return
def main(): OPTIONS, argv = getOptions('mmolite/config/servers.cfg', 'world server', sys.argv) if OPTIONS.username == "-": OPTIONS.username = raw_input("Username: "******"-": OPTIONS.password = raw_input("Password: "******"Setting up World Server..." dbconn.resetDB() print "Successfully" return else: print "Initialize World Server database..." dbconn.startDB() Clients.dropTable(ifExists=True) Clients.createTable() print "Run TGE dedicated server" argv.extend([ '-dedicated', '-game', 'test.mmo', '-mission', 'test.mmo/data/missions/chatspot.mis' ]) pytorque.initialize(len(argv), argv) print "World server connecting to master server: ip[%s] port[%d]" % ( OPTIONS.master_ip, OPTIONS.master_port) creds = credentials.UsernamePassword(OPTIONS.username, OPTIONS.password) world = WorldServer(OPTIONS.master_ip, OPTIONS.master_port, OPTIONS.world_port, PeerType.World, creds, WorldPortal()) world.run() #reactor.run() reactor.startRunning() #the main loop is broken out and can be combined with other frameworks rather easily while pytorque.tick(): reactorTick() #cleanup pytorque.. goodbye! pytorque.shutdown()
def remote_newClient(self, accountID, username, authenticID, mode): client = Clients(accountID=accountID, username=username, authenticID=authenticID, location=WorldServer.Name, status=Clients.Hopping, mode=mode, expiryTime=datetime.now() + timedelta(minutes=5))
def requestAvatarId(self, credentials): name = credentials.username try: row = Clients.byUsername(name) except: print "Login Failed: username[%s]"%(name) return failure.Failure(credError.UnauthorizedLogin("Bad username")) print "Received client: username[%s] password[%s]"%(name, row.authenticID) return defer.maybeDeferred(credentials.checkPassword, row.authenticID).addCallback(self._checkedPassword, name)
def requestAvatarId(self, credentials): name = credentials.username try: row = Clients.byUsername(name) except: print "Login Failed: username[%s]" % (name) return failure.Failure(credError.UnauthorizedLogin("Bad username")) print "Received client: username[%s] password[%s]" % (name, row.authenticID) return defer.maybeDeferred(credentials.checkPassword, row.authenticID).addCallback( self._checkedPassword, name)
def main(): OPTIONS, argv = getOptions('mmolite/config/servers.cfg', 'world server', sys.argv) if OPTIONS.username=="-": OPTIONS.username = raw_input("Username: "******"-": OPTIONS.password = raw_input("Password: "******"Setting up World Server..." dbconn.resetDB() print "Successfully" return else: print "Initialize World Server database..." dbconn.startDB() Clients.dropTable(ifExists=True); Clients.createTable() print "Run TGE dedicated server" argv.extend(['-dedicated', '-game', 'test.mmo', '-mission', 'test.mmo/data/missions/chatspot.mis']) pytorque.initialize(len(argv),argv) print "World server connecting to master server: ip[%s] port[%d]"%(OPTIONS.master_ip, OPTIONS.master_port) creds = credentials.UsernamePassword(OPTIONS.username, OPTIONS.password) world = WorldServer(OPTIONS.master_ip, OPTIONS.master_port, OPTIONS.world_port, PeerType.World, creds, WorldPortal()) world.run() #reactor.run() reactor.startRunning() #the main loop is broken out and can be combined with other frameworks rather easily while pytorque.tick(): reactorTick() #cleanup pytorque.. goodbye! pytorque.shutdown()
def logout(self): if self.name: row = Clients.byUsername(self.name) Clients.delete(row.id) self.name = None self.realm.logout(self)
def remote_getLoad(self): rows = Clients.selectBy(location=WorldServer.Name) return rows.count()
def remote_getLoad(self): rows = Clients.selectBy(location = WorldServer.Name) return rows.count()