예제 #1
0
 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
예제 #2
0
 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
예제 #3
0
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()
예제 #4
0
    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))
예제 #5
0
 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)
예제 #6
0
    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)
예제 #7
0
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()
예제 #8
0
 def logout(self):
     if self.name:
         row = Clients.byUsername(self.name)
         Clients.delete(row.id)
         self.name = None
     self.realm.logout(self)
예제 #9
0
 def logout(self):
     if self.name:
         row = Clients.byUsername(self.name)
         Clients.delete(row.id)
         self.name = None
     self.realm.logout(self)
예제 #10
0
 def remote_getLoad(self):
     rows = Clients.selectBy(location=WorldServer.Name)
     return rows.count()
예제 #11
0
 def remote_getLoad(self):
     rows = Clients.selectBy(location = WorldServer.Name)
     return rows.count()