def MakeFactory(allowedIP,username,password):

    #svc = service.MultiService()
    
    from mud.world.player import Player
    
    namespace = {}
    namespace["TheWorld"]=World.byName("TheWorld")
    namespace["LiveZones"]=World.byName("TheWorld").liveZoneInstances
    namespace["ActivePlayers"]=World.byName("TheWorld").activePlayers
    namespace["Player"]=Player

    checker = ManholeChecker(username,password)

    sshRealm = manhole_ssh.TerminalRealm()
    sshRealm.chainedProtocolFactory = chainedProtocolFactory(namespace)

    sshPortal = portal.Portal(sshRealm, [checker])
    sshFactory = ConchFactory(sshPortal)
    sshFactory.allowedIP = allowedIP

    #sshService = strports.service(8000,sshFactory)
    #sshService.setServiceParent(svc)

    return sshFactory
Beispiel #2
0
def MakeFactory(allowedIP, username, password):

    #svc = service.MultiService()

    from mud.world.player import Player

    namespace = {}
    namespace["TheWorld"] = World.byName("TheWorld")
    namespace["LiveZones"] = World.byName("TheWorld").liveZoneInstances
    namespace["ActivePlayers"] = World.byName("TheWorld").activePlayers
    namespace["Player"] = Player

    checker = ManholeChecker(username, password)

    sshRealm = manhole_ssh.TerminalRealm()
    sshRealm.chainedProtocolFactory = chainedProtocolFactory(namespace)

    sshPortal = portal.Portal(sshRealm, [checker])
    sshFactory = ConchFactory(sshPortal)
    sshFactory.allowedIP = allowedIP

    #sshService = strports.service(8000,sshFactory)
    #sshService.setServiceParent(svc)

    return sshFactory
    def DaemonConnected(perspective):
        from mud.world.cserveravatar import CharacterServerAvatar
        csa = CharacterServerAvatar()
        world = World.byName("TheWorld")
        world.daemonPerspective = perspective
        DAEMON.perspective = perspective

        d = perspective.callRemote("setWorldPID",os.getpid(),WORLDPORT,str(world.genesisTime),csa)
        d.addCallback(GotCSMind)
        zpid = []
        zport = []
        zpassword = []

        for zname in STATICZONES:
            for z in world.liveZoneInstances:
                if zname == z.zone.name:
                    if z.pid == None:
                        print_stack()
                        print "AssertionError: z.pid is None!"
                        return
                    zpid.append(z.pid)
                    zpassword.append(z.password)
                    zport.append(z.port)

        #this also marks this cluster server as live
        perspective.callRemote("setZonePID",zpid,zport,zpassword)

        from mud.worldserver.charutil import SetClusterNum
        SetClusterNum(CLUSTER)
        THESERVER.allowConnections = True
def CreatePlayer():
    try:
        Player.byPublicName("ThePlayer")
    except:
        world = World.byName("TheWorld")
        
        #move me
        zone = Zone.byName(world.startZone)
        dzone = Zone.byName(world.dstartZone)
        mzone = Zone.byName(world.mstartZone)
        
        p = Player(publicName="ThePlayer",password="******",fantasyName="ThePlayer",logZone=zone,bindZone=zone,darknessLogZone=dzone,darknessBindZone=dzone,
        monsterLogZone=mzone,monsterBindZone=mzone)

        #temp
        
        t = zone.immTransform
        dt = dzone.immTransform
        mt = mzone.immTransform
        
        p.logTransformInternal= t
        p.bindTransformInternal= t
        p.darknessLogTransformInternal= dt
        p.darknessBindTransformInternal= dt
        p.monsterLogTransformInternal= mt
        p.monsterBindTransformInternal= mt
        
        user = User(name="ThePlayer",password="******")
        user.addRole(Role.byName("Player"))
        user.addRole(Role.byName("Immortal"))
 def __init__(self,username,role,mind):
     Avatar.__init__(self,username,role,mind)
     self.username = username
     self.mind = mind
     self.player = Player.byPublicName(username)
     from mud.world.theworld import World
     self.world = World.byName("TheWorld")
Beispiel #6
0
 def __init__(self, username, role, mind):
     Avatar.__init__(self, username, role, mind)
     self.username = username
     self.mind = mind
     self.player = Player.byPublicName(username)
     from mud.world.theworld import World
     self.world = World.byName("TheWorld")
Beispiel #7
0
    def DaemonConnected(perspective):
        from mud.world.cserveravatar import CharacterServerAvatar
        csa = CharacterServerAvatar()
        world = World.byName("TheWorld")
        world.daemonPerspective = perspective
        DAEMON.perspective = perspective

        d = perspective.callRemote("setWorldPID",os.getpid(),WORLDPORT,str(world.genesisTime),csa)
        d.addCallback(GotCSMind)
        zpid = []
        zport = []
        zpassword = []

        for zname in STATICZONES:
            for z in world.liveZoneInstances:
                if zname == z.zone.name:
                    if z.pid == None:
                        print_stack()
                        print "AssertionError: z.pid is None!"
                        return
                    zpid.append(z.pid)
                    zpassword.append(z.password)
                    zport.append(z.port)

        #this also marks this cluster server as live
        perspective.callRemote("setZonePID",zpid,zport,zpassword)

        from mud.worldserver.charutil import SetClusterNum
        SetClusterNum(CLUSTER)
        THESERVER.allowConnections = True
        THEWORLD.allowConnections = True
Beispiel #8
0
    def __init__(self):
        from mud.world.theworld import World

        global AVATAR
        self.world = World.byName("TheWorld")
        AVATAR = self
        self.mind = None
 def __init__(self):
     from mud.world.theworld import World
     
     global AVATAR
     self.world = World.byName("TheWorld")
     AVATAR = self
     self.mind = None
Beispiel #10
0
    def ConnectToDaemon():
        print "Connecting to World Deamon at: %s"%DAEMONIP
        world = World.byName("TheWorld")

        factory = pb.PBClientFactory()
        reactor.connectTCP(DAEMONIP,7000,factory)
        world.daemonMind = mind = DaemonMind(world)
        password = md5("daemon").digest()
        factory.login(UsernamePassword(str(CLUSTER),password),mind).addCallbacks(DaemonConnected, DaemonFailure)
Beispiel #11
0
    def ConnectToDaemon():
        print "Connecting to World Deamon at: %s"%DAEMONIP
        world = World.byName("TheWorld")

        factory = pb.PBClientFactory()
        reactor.connectTCP(DAEMONIP,7000,factory)
        world.daemonMind = mind = DaemonMind(world)
        password = md5("daemon").digest()
        factory.login(UsernamePassword(str(CLUSTER),password),mind).addCallbacks(DaemonConnected, DaemonFailure)
Beispiel #12
0
def ShutdownEmbeddedWorld():
    global WORLDSERVER, MANHOLE
    if not WORLDSERVER:
        return

    world = World.byName("TheWorld")
    world.shutdown()
    WORLDSERVER.shutdown()
    WORLDSERVER = None

    if MANHOLE:
        MANHOLE.stopListening()

    MANHOLE = None
    SetDBConnection(None)
def ShutdownEmbeddedWorld():
    global WORLDSERVER,MANHOLE
    if not WORLDSERVER:
        return
    
    world = World.byName("TheWorld")
    world.shutdown()
    WORLDSERVER.shutdown()
    WORLDSERVER = None
    
    if MANHOLE:
        MANHOLE.stopListening()
    
    MANHOLE = None
    SetDBConnection(None)
Beispiel #14
0
 def __init__(self,username,role,mind):
     Avatar.__init__(self,username,role,mind)
     self.mind = mind
     self.username = username
     if username == "ZoneServer":
         self.dedicated = True
         self.player = None #dedicated!
     else:
         self.player = Player.byPublicName(username)
         self.dedicated = False
         
     self.zone = None
     self.world = World.byName("TheWorld")
     
     self.playerLookup ={}
     self.simObjects = []
     self.simLookup = {}
Beispiel #15
0
    def main():
        print "####Starting world server"
        from twisted.python import log

        LOG = not USE_WX

        if SSH_ENABLED:
            print "Security Warning: SSH Enabled on port %i for ip addresses:"%SSH_PORT,SSH_IPS
            from manhole import MakeFactory
            ips = SSH_IPS
            f= MakeFactory(ips,"me","me")
            reactor.listenTCP(SSH_PORT, f)


        if LOG:
            fname = "./logs/WorldServer.txt"
            if CLUSTER != -1:
                fname = "./logs/ZoneCluster%i.txt"%CLUSTER

            LOGFILE = file(fname,"w")
            log.startLogging(LOGFILE)


        #kickstart the heart
        print "####Getting world info"
        world = World.byName("TheWorld")
        world.frozen = FROZEN
        world.clusterNum = CLUSTER
        world.worldPort = WORLDPORT

        world.launchTime = curTime()
        world.liveZoneCallback = LiveZoneCallback
        world.startup()
        world.transactionTick()
        world.tick()

        reactor.callLater(0,LaunchWorld)
        reactor.addSystemEventTrigger('before', 'shutdown', world.shutdown)
        reactor.run()

        #world.shutdown()

        if LOG:
            LOGFILE.close()
Beispiel #16
0
    def main():

        from twisted.python import log

        LOG = not USE_WX

        if SSH_ENABLED:
            print "Security Warning: SSH Enabled on port %i for ip addresses:"%SSH_PORT,SSH_IPS
            from manhole import MakeFactory
            ips = SSH_IPS
            f= MakeFactory(ips,"me","me")
            reactor.listenTCP(SSH_PORT, f)


        if LOG:
            fname = "./log_WorldServer.txt"
            if CLUSTER != -1:
                fname = "./log_ZoneCluster%i.txt"%CLUSTER

            LOGFILE = file(fname,"w")
            log.startLogging(LOGFILE)


        #kickstart the heart
        world = World.byName("TheWorld")
        world.frozen = FROZEN
        world.clusterNum = CLUSTER
        world.worldPort = WORLDPORT

        world.launchTime = curTime()
        world.liveZoneCallback = LiveZoneCallback
        world.startup()
        world.transactionTick()
        world.tick()

        reactor.callLater(0,LaunchWorld)
        reactor.addSystemEventTrigger('before', 'shutdown', world.shutdown)
        reactor.run()

        #world.shutdown()

        if LOG:
            LOGFILE.close()
Beispiel #17
0
 def LaunchSuccess(result,perspective):
     print "####Launch succeeded"
     world = World.byName("TheWorld")
     ip = get_IP()
     if not ip:
         print_stack()
         print "AssertionError: Error getting WAN address!"
         return
     print "WAN IP found: ",ip
     #temporary, need to be able to set individual zone ip's
     world.zoneIP = ip
     perspective.broker.transport.loseConnection()
     if len(STATICZONES):
         SpawnZones()
     else:
         # if not CoreSettings.PGSERVER:
         #     THESERVER.allowConnections = True
         #     AnnounceWorld()
         # else:
         ConnectToDaemon()
Beispiel #18
0
    def LaunchWorld():
        if not CoreSettings.PGSERVER:
            username=PUBLICNAME+"-"+"World"
            password=PASSWORD
            password = md5(password).digest()

            factory = pb.PBClientFactory()
            reactor.connectTCP(MASTERIP,MASTERPORT,factory)
            factory.login(UsernamePassword(username, password),pb.Root()).addCallbacks(LaunchWorldConnected, AnnounceFailure)
        else:
            world = World.byName("TheWorld")
            ip = get_IP()
            if not ip:
                print_stack()
                print "AssertionError: Error getting WAN address!"
                return
            print "WAN IP found: ",ip
            #temporary, need to be able to set individual zone ip's
            world.zoneIP = ip
            SpawnZones()
Beispiel #19
0
 def LaunchSuccess(result,perspective):
     world = World.byName("TheWorld")
     ip = get_IP()
     if not ip:
         print_stack()
         print "AssertionError: Error getting WAN address!"
         return
     print "WAN IP found: ",ip
     #temporary, need to be able to set individual zone ip's
     world.zoneIP = ip
     perspective.broker.transport.loseConnection()
     if len(STATICZONES):
         SpawnZones()
     else:
         if not CoreSettings.PGSERVER:
             THESERVER.allowConnections = True
             AnnounceWorld()
         else:
             ConnectToDaemon()
             ConnectToAH()
             ConnectToMailServer()
Beispiel #20
0
    def LaunchWorld():
        print "####Launching world"
        if not CoreSettings.PGSERVER:
            username=PUBLICNAME+"-"+"World"
            password=PASSWORD
            password = md5(password).digest()

            factory = pb.PBClientFactory()
            reactor.connectTCP(MASTERIP,MASTERPORT,factory)
            print "####Connecting to Master: " + str([MASTERIP, MASTERPORT])
            factory.login(UsernamePassword(username, password),pb.Root()).addCallbacks(LaunchWorldConnected, AnnounceFailure)
        else:
            world = World.byName("TheWorld")
            ip = get_IP()
            if not ip:
                print_stack()
                print "AssertionError: Error getting WAN address!"
                return
            print "WAN IP found: ",ip
            #temporary, need to be able to set individual zone ip's
            world.zoneIP = ip
            SpawnZones()
Beispiel #21
0
def CreatePlayer():
    try:
        Player.byPublicName("ThePlayer")
    except:
        world = World.byName("TheWorld")

        #move me
        zone = Zone.byName(world.startZone)
        dzone = Zone.byName(world.dstartZone)
        mzone = Zone.byName(world.mstartZone)

        p = Player(publicName="ThePlayer",
                   password="******",
                   fantasyName="ThePlayer",
                   logZone=zone,
                   bindZone=zone,
                   darknessLogZone=dzone,
                   darknessBindZone=dzone,
                   monsterLogZone=mzone,
                   monsterBindZone=mzone)

        #temp

        t = zone.immTransform
        dt = dzone.immTransform
        mt = mzone.immTransform

        p.logTransformInternal = t
        p.bindTransformInternal = t
        p.darknessLogTransformInternal = dt
        p.darknessBindTransformInternal = dt
        p.monsterLogTransformInternal = mt
        p.monsterBindTransformInternal = mt

        user = User(name="ThePlayer", password="******")
        user.addRole(Role.byName("Player"))
        user.addRole(Role.byName("Immortal"))
Beispiel #22
0
 def AHConnected(perspective):
     world = World.byName("TheWorld")
     world.AHPerspective = perspective
Beispiel #23
0
 def MSConnected(perspective):
     world = World.byName("TheWorld")
     world.MailServerPerspective = perspective
Beispiel #24
0
            rmtree(d)
        except:
            pass
        os.makedirs(d)
        DATABASE = d+"/world.db"
        copyfile("./%s/data/worlds/multiplayer.baseline/world.db"%GAMEROOT,DATABASE)
    else:
        DATABASE = "./%s/data/worlds/multiplayer/%s/world.db"%(GAMEROOT,WORLDNAME)

    from mud.utils import getSQLiteURL
    SetDBConnection(getSQLiteURL(DATABASE),True)


    #--- Avatars
    from mud.world.theworld import World
    THEWORLD = World.byName("TheWorld")
    THEWORLD.multiName = WORLDNAME
    if CLUSTER!=-1:
        ZONESTARTPORT+=CLUSTER*100
    THEWORLD.zoneStartPort = ZONESTARTPORT
    THEWORLD.pwNewPlayer = PLAYERPASSWORD
    THEWORLD.staticZoneNames = STATICZONES

    if not CoreSettings.PGSERVER:
        THEWORLD.allowConnections = False
        THEWORLD.dbFile = "%s/%s/data/worlds/multiplayer/%s/world.db"%(os.getcwd(),GAMEROOT,WORLDNAME)


    #now replace to non-file friendly
    WORLDNAME = WORLDNAME.replace("_"," ")
    print THEWORLD.multiName
from twisted.internet import protocol
from twisted.application import service, strports
from twisted.conch.ssh import session
from twisted.conch import interfaces as iconch
from twisted.cred import portal, checkers,error, credentials
from twisted.python import components, usage,failure, log

from twisted.conch.insults import insults
from twisted.conch import manhole, manhole_ssh, telnet
from twisted.conch.ssh import factory, keys, session
from zope import interface

from mud.world.theworld import World

THEWORLD = World.byName("TheWorld")


class ConchFactory(factory.SSHFactory):
    publicKey = 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAGEArzJx8OYOnJmzf4tfBEvLi8DVPrJ3/c9k2I/Az64fxjHf9imyRJbixtQhlH9lfNjUIx+4LmrJH5QNRsFporcHDKOTwTTYLh5KmRpslkYHRivcJSkbh/C+BR3utDS555mV'

    publicKeys = {
        'ssh-rsa' : keys.getPublicKeyString(data = publicKey)
    }
    del publicKey

    privateKey = """-----BEGIN RSA PRIVATE KEY-----
MIIByAIBAAJhAK8ycfDmDpyZs3+LXwRLy4vA1T6yd/3PZNiPwM+uH8Yx3/YpskSW
4sbUIZR/ZXzY1CMfuC5qyR+UDUbBaaK3Bwyjk8E02C4eSpkabJZGB0Yr3CUpG4fw
vgUd7rQ0ueeZlQIBIwJgbh+1VZfr7WftK5lu7MHtqE1S1vPWZQYE3+VUn8yJADyb
Z4fsZaCrzW9lkIqXkE3GIY+ojdhZhkO1gbG0118sIgphwSWKRxK0mvh6ERxKqIt1
Beispiel #26
0
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()
 def logout(self):
     try:
         #clear inn if any
         self.lastTell = None
         
         if self.inn:
             self.inn.endInteraction()
             self.inn = None
         
         allDead = False
         if self.party and self.party.members:
             allDead = True
             for c in self.party.members:
                 if not c.dead:
                     allDead = False
                 # Since list gets parsed in reverse order, there's no need
                 #  to copy it for modification during the loop.
                 for item in reversed(c.items):
                     if item.flags & RPG_ITEM_ETHEREAL:
                         item.destroySelf()
                     else:
                         item.storeToItem()
         try:
             # Using values() instead of itervalues() already makes sure
             #  we work on a copy, so deleting during loop is safe.
             for item in self.bankList.values():
                 if item.flags & RPG_ITEM_ETHEREAL:
                     item.destroySelf()
                 else:
                     item.storeToItem()
         except:  # bankItems were never queried, no save needed
             pass
         
         self.cursorItem = None
         
         if self.looting:
             self.looting.looter = None
             self.looting = None
         
         if self.invite:
             self.invite.cancel()
             self.invite = None
             
         if self.trade:
             self.trade.cancel()
         
         if hasattr(self,"alliance") and self.alliance:
             self.alliance.leave(self)
         
         if allDead:
             if self.darkness:
                 self.darknessLogZone = self.curChar.deathZone
                 self.darknessLogTransform = self.curChar.deathTransform
             elif self.monster:
                 self.monsterLogZone = self.curChar.deathZone
                 self.monsterLogTransform = self.curChar.deathTransform
             else:
                 self.logZone = self.curChar.deathZone
                 self.logTransform = self.curChar.deathTransform
         if hasattr(self,"zone"):
             if self.zone:
                 self.endInteraction(False)
                 
                 if not allDead and self.simObject:
                     transform = list(self.simObject.position)
                     transform.extend(list(self.simObject.rotation))
                     transform[-1] = degrees(transform[-1])
                     
                     if self.darkness:
                         self.darknessLogZone = self.zone.zone
                         self.darknessLogTransform = transform
                     elif self.monster:
                         self.monsterLogZone = self.zone.zone
                         self.monsterLogTransform = transform
                     else:
                         self.logZone = self.zone.zone
                         self.logTransform = transform
                 
                 if self.zone.owningPlayer != self:
                     from mud.world.theworld import World
                     world = World.byName("TheWorld")
                     if not world.singlePlayer:
                         self.zone.kickPlayer(self)
                     self.zone.removePlayer(self)
             
             self.zone = None
     except:
         traceback.print_exc()
     
     if self.world:
         self.world.playerLeaveWorld(self)
         if not self.world.singlePlayer:
             self.world.commit(True)
     self.world = None
     
     self.reset()
Beispiel #28
0
 def MSConnected(perspective):
     world = World.byName("TheWorld")
     world.MailServerPerspective = perspective
Beispiel #29
0
 def AHConnected(perspective):
     world = World.byName("TheWorld")
     world.AHPerspective = perspective
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()
Beispiel #31
0
 def __init__(self,username,role,mind):
     Avatar.__init__(self,username,role,mind)
     self.username = username
     self.mind = mind
     from mud.world.theworld import World
     self.world = World.byName("TheWorld")
Beispiel #32
0
    def logout(self):
        try:
            #clear inn if any
            self.lastTell = None

            if self.inn:
                self.inn.endInteraction()
                self.inn = None

            allDead = False
            if self.party and self.party.members:
                allDead = True
                for c in self.party.members:
                    if not c.dead:
                        allDead = False
                    # Since list gets parsed in reverse order, there's no need
                    #  to copy it for modification during the loop.
                    for item in reversed(c.items):
                        if item.flags & RPG_ITEM_ETHEREAL:
                            item.destroySelf()
                        else:
                            item.storeToItem()
            try:
                # Using values() instead of itervalues() already makes sure
                #  we work on a copy, so deleting during loop is safe.
                for item in self.bankList.values():
                    if item.flags & RPG_ITEM_ETHEREAL:
                        item.destroySelf()
                    else:
                        item.storeToItem()
            except:  # bankItems were never queried, no save needed
                pass

            self.cursorItem = None

            if self.looting:
                self.looting.looter = None
                self.looting = None

            if self.invite:
                self.invite.cancel()
                self.invite = None

            if self.trade:
                self.trade.cancel()

            if hasattr(self, "alliance") and self.alliance:
                self.alliance.leave(self)

            if allDead:
                if self.darkness:
                    self.darknessLogZone = self.curChar.deathZone
                    self.darknessLogTransform = self.curChar.deathTransform
                elif self.monster:
                    self.monsterLogZone = self.curChar.deathZone
                    self.monsterLogTransform = self.curChar.deathTransform
                else:
                    self.logZone = self.curChar.deathZone
                    self.logTransform = self.curChar.deathTransform
            if hasattr(self, "zone"):
                if self.zone:
                    self.endInteraction(False)

                    if not allDead and self.simObject:
                        transform = list(self.simObject.position)
                        transform.extend(list(self.simObject.rotation))
                        transform[-1] = degrees(transform[-1])

                        if self.darkness:
                            self.darknessLogZone = self.zone.zone
                            self.darknessLogTransform = transform
                        elif self.monster:
                            self.monsterLogZone = self.zone.zone
                            self.monsterLogTransform = transform
                        else:
                            self.logZone = self.zone.zone
                            self.logTransform = transform

                    if self.zone.owningPlayer != self:
                        from mud.world.theworld import World
                        world = World.byName("TheWorld")
                        if not world.singlePlayer:
                            self.zone.kickPlayer(self)
                        self.zone.removePlayer(self)

                self.zone = None
        except:
            traceback.print_exc()

        if self.world:
            self.world.playerLeaveWorld(self)
            if not self.world.singlePlayer:
                self.world.commit(True)
        self.world = None

        self.reset()
 def __init__(self,username,role,mind):
     Avatar.__init__(self,username,role,mind)
     self.username = username
     self.world = World.byName("TheWorld")
from mud.world.theworld import World
world = World.byName("TheWorld")

world.startZone = "base"
world.dstartZone = "base" 
world.mstartZone = "base"

 def __init__(self, username, role, mind):
     Avatar.__init__(self, username, role, mind)
     self.username = username
     self.world = World.byName("TheWorld")
Beispiel #36
0
from mud.world.theworld import World

world = World.byName("TheWorld")

world.startZone = "base"
world.dstartZone = "base"
world.mstartZone = "base"