Esempio n. 1
0
def main():
    OPTIONS, argv = getOptions('mmolite/config/servers.cfg', 'master server', sys.argv)
    
    dbconn = MasterDBObject('master.db', 'mmolite/data')
    
    if OPTIONS.setup: 
        print "Setting up Master Server..."
        
        dbconn.resetDB()
        user = PeersInfo(peername = "Master", password = "******", role = PeerType.Master)
        user = PeersInfo(peername = "Character", password = "******", role = PeerType.Character)
        user = PeersInfo(peername = "World", password = "******", role = PeerType.World)
        user = PeersInfo(peername = "Cluster", password = "******", role = PeerType.Cluster)
        user = PeersInfo(peername = "Zone", password = "******", role = PeerType.Zone)
        user = PeersInfo(peername = "Client", password = "******", role = PeerType.Client)
        user = Accounts(username = "******", password = "******", role = UserType.Admin)
        print "Successfully"
        return
    else: 
        print "Initialize Master Server database..."
        dbconn.startDB()
        Peers.dropTable(ifExists=True); Peers.createTable()
        print "Master Server Listening to port: %d"%OPTIONS.master_port
        
        realm = MasterRealm()
        p = portal.Portal(realm)
        p.registerChecker(MasterPasswordChecker())
        reactor.listenTCP(OPTIONS.master_port, pb.PBServerFactory(p))

        keepAlive(realm)
        reactor.run()
Esempio n. 2
0
def main():
    OPTIONS, argv = getOptions('mmolite/config/servers.cfg', 'character server', sys.argv)
    
    if OPTIONS.username=="-": OPTIONS.username = raw_input("Username: "******"-": OPTIONS.password = raw_input("Password: "******"Setting up Character Server..."
        
        dbconn.resetDB()
        raceStat = RaceStats(race = RaceType.Men, initStr = 5, initDex = 5, initCon = 5, initInt = 8, maxStr = 800, maxDex = 800, maxCon = 800, maxInt = 850)
        raceStat = RaceStats(race = RaceType.Elves, initStr = 3, initDex = 8, initCon = 3, initInt = 9, maxStr = 650, maxDex = 800, maxCon = 650, maxInt = 1000)
        raceStat = RaceStats(race = RaceType.Orcs, initStr = 8, initDex = 7, initCon = 7, initInt = 3, maxStr = 1000, maxDex = 1000, maxCon = 900, maxInt = 500)
        raceStat = RaceStats(race = RaceType.Dwarves, initStr = 9, initDex = 5, initCon = 9, initInt = 4, maxStr = 1000, maxDex = 600, maxCon = 1000, maxInt = 750)
        fracMod = FractionModifier(race = RaceType.Men, fraction = FractionType.Aral, weapon = WeaponType.MachineGun, upperArmor = UpperArmorType.Light, lowerArmor = LowerArmorType.Light, initStr = 0, initDex = 0, initCon = 0, initInt = 5, maxStr = 0, maxDex = 0, maxCon = 0, maxInt = 80)
        fracMod = FractionModifier(race = RaceType.Men, fraction = FractionType.Juze, weapon = WeaponType.Sword, upperArmor = UpperArmorType.Spider, lowerArmor = LowerArmorType.Spider, initStr = 5, initDex = 0, initCon = 0, initInt = 0, maxStr = 100, maxDex = 0, maxCon = 0, maxInt = 0)
        fracMod = FractionModifier(race = RaceType.Men, fraction = FractionType.Neit, weapon = WeaponType.Fist, upperArmor = UpperArmorType.Bare, lowerArmor = LowerArmorType.Bare, initStr = 0, initDex = 0, initCon = 5, initInt = 0, maxStr = 0, maxDex = 0, maxCon = 60, maxInt = 0)
        genMod = GenderModifier(race = RaceType.Men, gender = GenderType.Male, face = FaceType.MaleMen, initStr = 2, initDex = 0, initCon = 1, initInt = 0, maxStr = 50, maxDex = 0, maxCon = 50, maxInt = 0)
        genMod = GenderModifier(race = RaceType.Men, gender = GenderType.Female, face = FaceType.FemaleMen, initStr = 0, initDex = 1, initCon = 0, initInt = 2, maxStr = 0, maxDex = 50, maxCon = 0, maxInt = 50)
        print "Successfully"
        return
    else: 
        print "Initialize Character Server database..."
        dbconn.startDB()

        print "Character server connecting to master server: ip[%s] port[%d]"%(OPTIONS.master_ip, OPTIONS.master_port)
        
        charSvr = CharacterServer(OPTIONS.username, PeerType.Character)
        charSvr.run(OPTIONS.password, OPTIONS.master_ip, OPTIONS.master_port)

        reactor.run()
Esempio n. 3
0
def main():
    OPTIONS, argv = getOptions('mmolite/config/client.cfg', 'client', sys.argv)

    if OPTIONS.username == "-": OPTIONS.username = raw_input("Username: "******"Username: %s" % OPTIONS.username)
    if OPTIONS.password == "-": OPTIONS.password = raw_input("Password: "******"Password: %s" % OPTIONS.password)
    #password = md5(OPTIONS.password).digest()

    print "MMO test client connecting to: ip[%s] port[%d]" % (
        OPTIONS.master_ip, OPTIONS.master_port)

    tester = PbAuthTester(OPTIONS.username)
    tester.runTests(OPTIONS.master_ip, OPTIONS.master_port, OPTIONS.password)
    reactor.run()
Esempio n. 4
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()
Esempio n. 5
0
def main():
    global clientObj
    global userObj
    Running = False
    OPTIONS, argv = getOptions('mmolite/config/client.cfg', 'client', sys.argv)

    print "MMO test client initializing torque client"
    if '-game' not in argv:
        argv.extend(['-game', 'test.mmo'])
    pytorque.initialize(len(argv), argv)

    print "MMO test client connecting to: ip[%s] port[%d]" % (
        OPTIONS.master_ip, OPTIONS.master_port)
    clientObj = PbAuthClient()
    clientObj.login("Client", "tneilc", OPTIONS.master_ip, OPTIONS.master_port)
    userObj = PbAuthUser()

    # get torque object
    loginButton = TorqueObject("LoginButton")
    signupButton = TorqueObject("SignupButton")
    # set torque object's attribute
    loginButton.Command = 'LoginButton.OnButton("%s", %s);' % (
        OPTIONS.master_ip, OPTIONS.master_port)
    signupButton.Command = 'SignupButton.OnButton("%s", %s);' % (
        OPTIONS.master_ip, OPTIONS.master_port)
    # map python function to torque action
    pytorque.export(OnLoginPressed, "LoginButton", "OnButton",
                    "Login button command", 2, 2)
    pytorque.export(OnSignupPressed, "SignupButton", "OnButton",
                    "Signup button command", 2, 2)
    # call torque object method
    loginButton.setActive(0)
    signupButton.setActive(0)

    print "MMO test client running"
    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()

    print "MMO test client quit"
Esempio n. 6
0
def main():
    OPTIONS, argv = getOptions('mmolite/config/servers.cfg', 'master server',
                               sys.argv)

    dbconn = MasterDBObject('master.db', 'mmolite/data')

    if OPTIONS.setup:
        print "Setting up Master Server..."

        dbconn.resetDB()
        user = PeersInfo(peername="Master",
                         password="******",
                         role=PeerType.Master)
        user = PeersInfo(peername="Character",
                         password="******",
                         role=PeerType.Character)
        user = PeersInfo(peername="World",
                         password="******",
                         role=PeerType.World)
        user = PeersInfo(peername="Cluster",
                         password="******",
                         role=PeerType.Cluster)
        user = PeersInfo(peername="Zone", password="******", role=PeerType.Zone)
        user = PeersInfo(peername="Client",
                         password="******",
                         role=PeerType.Client)
        user = Accounts(username="******",
                        password="******",
                        role=UserType.Admin)
        print "Successfully"
        return
    else:
        print "Initialize Master Server database..."
        dbconn.startDB()
        Peers.dropTable(ifExists=True)
        Peers.createTable()
        print "Master Server Listening to port: %d" % OPTIONS.master_port

        realm = MasterRealm()
        p = portal.Portal(realm)
        p.registerChecker(MasterPasswordChecker())
        reactor.listenTCP(OPTIONS.master_port, pb.PBServerFactory(p))

        keepAlive(realm)
        reactor.run()
Esempio n. 7
0
def main():
    OPTIONS, argv = getOptions("mmolite/config/client.cfg", "client", sys.argv)

    if OPTIONS.username == "-":
        OPTIONS.username = raw_input("Username: "******"Username: %s" % OPTIONS.username)
    if OPTIONS.password == "-":
        OPTIONS.password = raw_input("Password: "******"Password: %s" % OPTIONS.password)
    # password = md5(OPTIONS.password).digest()

    print "MMO test client connecting to: ip[%s] port[%d]" % (OPTIONS.master_ip, OPTIONS.master_port)

    tester = PbAuthTester(OPTIONS.username)
    tester.runTests(OPTIONS.master_ip, OPTIONS.master_port, OPTIONS.password)
    reactor.run()
Esempio n. 8
0
def main():
    global clientObj
    global userObj
    Running = False
    OPTIONS, argv = getOptions('mmolite/config/client.cfg', 'client', sys.argv)

    print "MMO test client initializing torque client"
    if '-game' not in argv:
        argv.extend(['-game', 'test.mmo'])
    pytorque.initialize(len(argv),argv)
    
    print "MMO test client connecting to: ip[%s] port[%d]"%(OPTIONS.master_ip, OPTIONS.master_port)
    clientObj = PbAuthClient()
    clientObj.login("Client", "tneilc", OPTIONS.master_ip, OPTIONS.master_port)
    userObj = PbAuthUser()
    
    # get torque object
    loginButton = TorqueObject("LoginButton")
    signupButton = TorqueObject("SignupButton")
    # set torque object's attribute
    loginButton.Command = 'LoginButton.OnButton("%s", %s);'%(OPTIONS.master_ip, OPTIONS.master_port)
    signupButton.Command = 'SignupButton.OnButton("%s", %s);'%(OPTIONS.master_ip, OPTIONS.master_port)
    # map python function to torque action
    pytorque.export(OnLoginPressed,"LoginButton","OnButton","Login button command",2,2)
    pytorque.export(OnSignupPressed,"SignupButton","OnButton","Signup button command",2,2)
    # call torque object method
    loginButton.setActive(0)
    signupButton.setActive(0)
    
    print "MMO test client running"
    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()
    
    print "MMO test client quit"
Esempio n. 9
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()
Esempio n. 10
0
def main():
    OPTIONS, argv = getOptions('mmolite/config/servers.cfg',
                               'character server', sys.argv)

    if OPTIONS.username == "-": OPTIONS.username = raw_input("Username: "******"-": OPTIONS.password = raw_input("Password: "******"Setting up Character Server..."

        dbconn.resetDB()
        raceStat = RaceStats(race=RaceType.Men,
                             initStr=5,
                             initDex=5,
                             initCon=5,
                             initInt=8,
                             maxStr=800,
                             maxDex=800,
                             maxCon=800,
                             maxInt=850)
        raceStat = RaceStats(race=RaceType.Elves,
                             initStr=3,
                             initDex=8,
                             initCon=3,
                             initInt=9,
                             maxStr=650,
                             maxDex=800,
                             maxCon=650,
                             maxInt=1000)
        raceStat = RaceStats(race=RaceType.Orcs,
                             initStr=8,
                             initDex=7,
                             initCon=7,
                             initInt=3,
                             maxStr=1000,
                             maxDex=1000,
                             maxCon=900,
                             maxInt=500)
        raceStat = RaceStats(race=RaceType.Dwarves,
                             initStr=9,
                             initDex=5,
                             initCon=9,
                             initInt=4,
                             maxStr=1000,
                             maxDex=600,
                             maxCon=1000,
                             maxInt=750)
        fracMod = FractionModifier(race=RaceType.Men,
                                   fraction=FractionType.Aral,
                                   weapon=WeaponType.MachineGun,
                                   upperArmor=UpperArmorType.Light,
                                   lowerArmor=LowerArmorType.Light,
                                   initStr=0,
                                   initDex=0,
                                   initCon=0,
                                   initInt=5,
                                   maxStr=0,
                                   maxDex=0,
                                   maxCon=0,
                                   maxInt=80)
        fracMod = FractionModifier(race=RaceType.Men,
                                   fraction=FractionType.Juze,
                                   weapon=WeaponType.Sword,
                                   upperArmor=UpperArmorType.Spider,
                                   lowerArmor=LowerArmorType.Spider,
                                   initStr=5,
                                   initDex=0,
                                   initCon=0,
                                   initInt=0,
                                   maxStr=100,
                                   maxDex=0,
                                   maxCon=0,
                                   maxInt=0)
        fracMod = FractionModifier(race=RaceType.Men,
                                   fraction=FractionType.Neit,
                                   weapon=WeaponType.Fist,
                                   upperArmor=UpperArmorType.Bare,
                                   lowerArmor=LowerArmorType.Bare,
                                   initStr=0,
                                   initDex=0,
                                   initCon=5,
                                   initInt=0,
                                   maxStr=0,
                                   maxDex=0,
                                   maxCon=60,
                                   maxInt=0)
        genMod = GenderModifier(race=RaceType.Men,
                                gender=GenderType.Male,
                                face=FaceType.MaleMen,
                                initStr=2,
                                initDex=0,
                                initCon=1,
                                initInt=0,
                                maxStr=50,
                                maxDex=0,
                                maxCon=50,
                                maxInt=0)
        genMod = GenderModifier(race=RaceType.Men,
                                gender=GenderType.Female,
                                face=FaceType.FemaleMen,
                                initStr=0,
                                initDex=1,
                                initCon=0,
                                initInt=2,
                                maxStr=0,
                                maxDex=50,
                                maxCon=0,
                                maxInt=50)
        print "Successfully"
        return
    else:
        print "Initialize Character Server database..."
        dbconn.startDB()

        print "Character server connecting to master server: ip[%s] port[%d]" % (
            OPTIONS.master_ip, OPTIONS.master_port)

        charSvr = CharacterServer(OPTIONS.username, PeerType.Character)
        charSvr.run(OPTIONS.password, OPTIONS.master_ip, OPTIONS.master_port)

        reactor.run()