def main(): if USE_WX: from gui import Setup app = Setup(reactor) reactor.registerWxApp(app) print "Master Server" print "->Initializing" server = Server(CONFIG["Master Port"]) server.startServices() from telnetmanhole import MakeFactory from twisted.application import app, service, strports ips = ["127.0.0.1"] f = MakeFactory(ips, CONFIG["Manhole Username"], CONFIG["Manhole Password"]) reactor.listenTCP(CONFIG["Manhole Port"], f) #from webserver import MakeWebServer #MakeWebServer() from mud.common.persistent import Persistent Persistent._connection.getConnection().text_factory = lambda x: unicode( x, "utf-8", "ignore") CheckDB() ConfigureSettings() TransactionTick() print "->Server is up" reactor.run() TransactionTick(True)
try: stats = User.byName("Stats") stats.destroySelf() except: pass stats = User(name="Stats",password=STATSERVERPASSWORD) stats.addRole(Role.byName("Stats")) NewPlayerAvatar.ownerPublicName = PUBLICNAME #--- Application from mud.server.app import Server THESERVER = Server(WORLDPORT) THESERVER.allowConnections = False THESERVER.throttleUsage = True if MAXPLAYERS == -1: MAXPLAYERS = 1024 THESERVER.roleLimits["Player"]=MAXPLAYERS THESERVER.startServices() GAMEPROCESS = None ZONESSPAWNED = False #XXX starting zones simultaneously crashes
announcePort=int(CONFIG["Default World Port"]), account=account, allowGuests=True, maxLivePlayers=-1, maxLiveZones=-1, demoWorld=False) user.password = CONFIG["World Password"] account = Account.byPublicName(user.name) account.password = user.password cserver = User.byName("CharacterServer") cserver.password = CONFIG["Character Server Password"] server = Server(CONFIG["Master Port"]) server.startServices() from telnetmanhole import MakeFactory from twisted.application import app, service, strports ips = ["127.0.0.1"] f = MakeFactory(ips, CONFIG["Manhole Username"], CONFIG["Manhole Password"]) reactor.listenTCP(CONFIG["Manhole Port"], f) #from webserver import MakeWebServer #MakeWebServer() from mud.common.persistent import Persistent Persistent._connection.getConnection().text_factory = lambda x: unicode( x, "utf-8", "ignore")
account.addProduct("MOM") user.addRole(Role.byName("Player")) user.addRole(Role.byName("World")) #fix me, this shouldn't really be here... and allowGuests is used for testing worlds World(name="Premium MMORPG", announcePort=int(CONFIG["Default World Port"]), account=account, allowGuests=True,maxLivePlayers=-1,maxLiveZones=-1,demoWorld = False) user.password = CONFIG["World Password"] account = Account.byPublicName(user.name) account.password = user.password cserver = User.byName("CharacterServer") cserver.password = CONFIG["Character Server Password"] server = Server(CONFIG["Master Port"]) server.startServices() from telnetmanhole import MakeFactory from twisted.application import app, service, strports ips = ["127.0.0.1"] f= MakeFactory(ips, CONFIG["Manhole Username"], CONFIG["Manhole Password"]) reactor.listenTCP(CONFIG["Manhole Port"], f) #from webserver import MakeWebServer #MakeWebServer() from mud.common.persistent import Persistent Persistent._connection.getConnection().text_factory = lambda x: unicode(x, "utf-8", "ignore") CheckDB()
def SetupEmbeddedWorld(worldname): global WORLDSERVER global MANHOLE DATABASE = "sqlite:///%s/%s/data/worlds/singleplayer/%s/world.db" % ( os.getcwd(), GAMEROOT, worldname) SetDBConnection(DATABASE, True) #destroy the new player user, and recreate try: user = User.byName("NewPlayer") user.destroySelf() except: pass CreatePlayer() IDESetup() #--- Application from twisted.spread import pb from twisted.internet import reactor from twisted.cred.credentials import UsernamePassword from mud.server.app import Server WORLDSERVER = server = Server(3013) server.startServices() #kickstart the heart world = World.byName("TheWorld") #TODO, single player backups #world.dbFile = os.getcwd()+"/minions.of.mirth/data/worlds/singleplayer/"+worldname+"/world.db" try: v = int(TGEGetGlobal("$pref::gameplay::difficulty")) except: v = 0 TGESetGlobal("$pref::gameplay::difficulty", 0) try: respawn = float(TGEGetGlobal("$pref::gameplay::monsterrespawn")) except: TGESetGlobal("$pref::gameplay::monsterrespawn", 0.0) respawn = 0.0 try: SPpopulators = int(TGEGetGlobal("$pref::gameplay::SPpopulators")) except: SPpopulators = 0 TGESetGlobal("$pref::gameplay::SPpopulators", 0) if v == 1: CoreSettings.DIFFICULTY = 0 elif v == 2: CoreSettings.DIFFICULTY = 2 else: CoreSettings.DIFFICULTY = 1 CoreSettings.RESPAWNTIME = respawn CoreSettings.SPPOPULATORS = SPpopulators CoreSettings.SINGLEPLAYER = True world.launchTime = currentTime() world.singlePlayer = True world.startup() world.transactionTick() world.tick()
#Database setup for communications with World Server sys.argv.append('database=data/ahserver') ConfigureServer("mailcommunication.db") #Drop tables on the comm DB TABLES = [Role, RoleAvatar, User] for t in TABLES: t.dropTable(ifExists=True) t.createTable() ConfigureRoles() ConfigureUsers() #Start Services to ready a connection from the World Server server = Server(MAILSERVER_PORT, True) # True to use md5 hashing for passwords server.startServices() print "->Mail Server is up" reactor.run() if MAILCONNECT: print "Dumping the Transactions to Database" MAILCONNECT.conn.execute("END TRANSACTION;") MAILCONNECT.conn.close() MAILCONNECT.dbconn.close() print "Cleanly shutdown the Mail Server!" sys.exit() print "Error, could not find the MailServer Avatar, shutdown was not clean!"