Beispiel #1
0
def ConfigureSettings():
    print "Configuring Settings"
    #World User (clean this up.. for instance, if we change the username we'll leave row crumbs)
    try:
        user = User.byName(CONFIG["World Username"])
    except:
        user = User(name=CONFIG["World Username"], password="")
        key = RegKey(key=CONFIG["World Username"] + "!")
        account = Account(regkey=key.key,
                          publicName=CONFIG["World Username"],
                          email="",
                          password="")
        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"]
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 ConfigureUsers():
    reg = User(name="Registration",password="******")
    reg.addRole(Role.byName("Registration"))
    
    enumWorlds = User(name="EnumWorlds",password="******")
    enumWorlds.addRole(Role.byName("EnumWorlds"))
        
    cserver = User(name="CharacterServer",password=CONFIG["Character Server Password"])
    cserver.addRole(Role.byName("CharacterServer"))
    def perspective_newPlayer(self,publicName,fantasyName, playerPassword = None):
        #XXX if you change this function, also change it's mirror in cserveravatar!!!
        
        if self.world.pwNewPlayer and playerPassword != self.world.pwNewPlayer:
            return (-1,"Incorrect player password.",None)

        #does player already exist?
        try:
            player = Player.byPublicName(publicName)
        except:
            pass
        else:
            return (-1,"You already have an account on this world.",None)
     
        try:
            player = Player.byFantasyName(fantasyName)
        except:
            pass
        else:
            return (-1,"That avatar name is taken, please choose another.",None)
                
        password = GenPasswd().upper()

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

        t = zone.immTransform
        dt = dzone.immTransform
        mt = mzone.immTransform
        
        p = Player(publicName=publicName,password=password,fantasyName=publicName,logZone=zone,bindZone=zone,darknessLogZone=dzone,darknessBindZone=dzone,monsterLogZone=mzone,monsterBindZone=mzone)
        #temp
        
        p.logTransformInternal=t
        p.bindTransformInternal=t

        p.darknessLogTransformInternal=dt
        p.darknessBindTransformInternal=dt

        p.monsterLogTransformInternal=mt
        p.monsterBindTransformInternal=mt

        
        user = User(name=publicName,password=password)
        user.addRole(Role.byName("Player"))
        
        if publicName == NewPlayerAvatar.ownerPublicName: 
            user.addRole(Role.byName("Immortal"))
            user.addRole(Role.byName("Guardian"))
            
            return (0,"Immortal Account Created.\nYour password is %s"%password,password)
        
        
        return (0,"Account Created.\nYour password is %s"%password,password)
def ConfigureUsers():
    reg = User(name="Registration", password="******")
    reg.addRole(Role.byName("Registration"))

    enumWorlds = User(name="EnumWorlds", password="******")
    enumWorlds.addRole(Role.byName("EnumWorlds"))

    cserver = User(name="CharacterServer",
                   password=CONFIG["Character Server Password"])
    cserver.addRole(Role.byName("CharacterServer"))
Beispiel #6
0
def ConfigureRoles():
    admin = Role(name="Administrator")
    RoleAvatar(name="AdminAvatar",role=admin)
    
    gm = Role(name="GM")
    RoleAvatar(name="GMAvatar",role=gm)
    
    character = Role(name="CharacterServer")
    RoleAvatar(name="CharacterAvatar",role=character)
    
    wdaemon = Role(name="WorldDaemon")
    RoleAvatar(name="WorldDaemonAvatar",role=wdaemon)
Beispiel #7
0
def ConfigureUsers():
    cserver = User(name="CharacterServer",password="******")
    cserver.addRole(Role.byName("CharacterServer"))
    
    for worldName,password in WORLDNAMES.iteritems():
        wdaemon = User(name=worldName,password=password)
        wdaemon.addRole(Role.byName("WorldDaemon"))
    
    from userpasswords import USERS
    for name,info in USERS.iteritems():
        password,roles = info
        user = User(name=name,password=password)
        for role in roles:
            user.addRole(Role.byName(role))
def CmdGrant(mob,args):
    from mud.common.permission import User,Role
    
    if len(args) < 2:
        return
    
    try:
        user = User.byName(args[0])
    except:
        mob.player.sendGameText(RPG_MSG_GAME_DENIED,"Unknown user %s.\\n"%args[0])
        return
    
    try:
        role = Role.byName(args[1])
    except:
        mob.player.sendGameText(RPG_MSG_GAME_DENIED,"Unknown role %s.\\n"%args[1])
        return
    
    for r in user.roles:
        if r.name == role.name:
            mob.player.sendGameText(RPG_MSG_GAME_DENIED,"User %s already has the %s role.\\n"%(args[0],args[1]))
            return
        
    if role.name == "Immortal":
        from newplayeravatar import NewPlayerAvatar
        if mob.player.publicName != NewPlayerAvatar.ownerPublicName:
            mob.player.sendGameText(RPG_MSG_GAME_DENIED,"Immortal access can only be granted by the server's owner.\\n")
            return

            
    
    mob.player.sendGameText(RPG_MSG_GAME_GAINED,"User %s granted the %s role.\\n"%(args[0],args[1]))
    user.addRole(role)
Beispiel #9
0
    def createPlayer(self, publicName, code):
        #from newplayeravatar import NewPlayerAvatar
        #XXX if you change this function, also change it's mirror in cserveravatar!!!

        password = GenPasswd().upper()

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

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

        p = Player(publicName=publicName,
                   password=password,
                   fantasyName=publicName,
                   logZone=zone,
                   bindZone=zone,
                   darknessLogZone=dzone,
                   darknessBindZone=dzone,
                   monsterLogZone=mzone,
                   monsterBindZone=mzone)
        #temp

        p.logTransformInternal = t
        p.bindTransformInternal = t

        p.darknessLogTransformInternal = dt
        p.darknessBindTransformInternal = dt

        p.monsterLogTransformInternal = mt
        p.monsterBindTransformInternal = mt

        user = User(name=publicName, password=password)
        user.addRole(Role.byName("Player"))

        if code == 2:
            user.addRole(Role.byName("Immortal"))
            user.addRole(Role.byName("Guardian"))
        elif code == 1:
            user.addRole(Role.byName("Guardian"))

        return p
Beispiel #10
0
def ConfigureRoles():
    registration = Role(name="Registration")
    RoleAvatar(name="RegistrationAvatar", role=registration)

    enumWorlds = Role(name="EnumWorlds")
    RoleAvatar(name="EnumWorldsAvatar", role=enumWorlds)

    player = Role(name="Player")
    RoleAvatar(name="EnumWorldsAvatar", role=player)
    RoleAvatar(name="PlayerAvatar", role=player)

    world = Role(name="World")
    RoleAvatar(name="NewWorldAvatar", role=world)
    RoleAvatar(name="WorldAvatar", role=world)
    RoleAvatar(name="EnumWorldsAvatar", role=world)

    character = Role(name="CharacterServer")
    RoleAvatar(name="CharacterAvatar", role=character)
    def createPlayer(self,publicName,code):
        #from newplayeravatar import NewPlayerAvatar
        #XXX if you change this function, also change it's mirror in cserveravatar!!!

                
        password = GenPasswd().upper()

        #move me
        zone = Zone.byName(self.world.startZone)
        dzone = Zone.byName(self.world.dstartZone)
        mzone = Zone.byName(self.world.mstartZone)
        
        t = zone.immTransform
        dt = dzone.immTransform
        mt = mzone.immTransform
        
        p = Player(publicName=publicName,password=password,fantasyName=publicName,logZone=zone,bindZone=zone,darknessLogZone=dzone,darknessBindZone=dzone,monsterLogZone=mzone,monsterBindZone=mzone)
        #temp
        
        p.logTransformInternal=t
        p.bindTransformInternal=t

        p.darknessLogTransformInternal=dt
        p.darknessBindTransformInternal=dt

        p.monsterLogTransformInternal=mt
        p.monsterBindTransformInternal=mt

        
        user = User(name=publicName,password=password)
        user.addRole(Role.byName("Player"))
        
        if code == 2: 
            user.addRole(Role.byName("Immortal"))
            user.addRole(Role.byName("Guardian"))
        elif code == 1:
            user.addRole(Role.byName("Guardian"))
            
            
        return p
Beispiel #12
0
def ConfigureSettings():
    print "Configuring Settings"
    #World User (clean this up.. for instance, if we change the username we'll leave row crumbs)
    try:
        user = User.byName(CONFIG["World Username"])
    except:
        user = User(name=CONFIG["World Username"], password="")
        key = RegKey(key=CONFIG["World Username"] + "!")
        account = Account(regkey=key.key,
                          publicName=CONFIG["World Username"],
                          email="",
                          password="")
        account.addProduct("MOM")
        user.addRole(Role.byName("Player"))
        user.addRole(Role.byName("World"))

    user.password = CONFIG["World Password"]
    account = Account.byPublicName(user.name)
    account.password = user.password

    cserver = User.byName("CharacterServer")
    cserver.password = CONFIG["Character Server Password"]
Beispiel #13
0
def ConfigureSettings():
    print "Configuring Settings"
    #World User (clean this up.. for instance, if we change the username we'll leave row crumbs)
    try:
        user = User.byName(CONFIG["World Username"])
    except:
        user = User(name=CONFIG["World Username"], password = "")
        key = RegKey(key=CONFIG["World Username"]+"!")
        account = Account(regkey=key.key, publicName=CONFIG["World Username"], email="", password="")
        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"]
Beispiel #14
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 #15
0
    def install(self):
        if self.dbAttr["name"] == "ZoneServer":
            return

        FilterColumns(User, self.dbAttr)
        user = User(**self.dbAttr)

        for r in self.roles:
            try:
                role = Role.byName(r)
            except:
                print "Role: %s no longer exists!" % r
                continue

            user.addRole(role)
 def install(self):
     if self.dbAttr["name"] == "ZoneServer":
         return
     
     FilterColumns(User,self.dbAttr)
     user = User(**self.dbAttr)
     
     for r in self.roles:
         try:
             role = Role.byName(r)
         except:
             print "Role: %s no longer exists!"%r
             continue
         
         user.addRole(role)
Beispiel #17
0
def ConfigureRoles():
    #--- User and Role Table creation

    from mud.common.permission import Role, TablePermission, ColumnPermission, User, BannedUser, BannedIP
    from mud.common.avatar import RoleAvatar

    #configure connections
    TABLES = [
        Role, User, BannedUser, BannedIP, TablePermission, ColumnPermission,
        RoleAvatar
    ]

    #for now we'll drop and recreate the tables every time
    for t in TABLES:
        t.dropTable(ifExists=True)
        t.createTable()

    #immortal
    immortal = Role(name="Immortal")
    RoleAvatar(name="RoleEnumAvatar", role=immortal)
    RoleAvatar(name="DatabaseAvatar", role=immortal)
    RoleAvatar(name="ImmortalAvatar", role=immortal)
    RoleAvatar(name="GuardianAvatar", role=immortal)
    RoleAvatar(name="PlayerAvatar", role=immortal)
    RoleAvatar(name="SimAvatar", role=immortal)

    #guardian
    guardian = Role(name="Guardian")
    RoleAvatar(name="PlayerAvatar", role=guardian)
    RoleAvatar(name="GuardianAvatar", role=guardian)
    RoleAvatar(name="SimAvatar", role=guardian)

    newplayer = Role(name="NewPlayer")
    RoleAvatar(name="NewPlayerAvatar", role=newplayer)

    player = Role(name="Player")
    RoleAvatar(name="PlayerAvatar", role=player)
    RoleAvatar(name="SimAvatar", role=player)

    #dedicated zone server
    zserver = Role(name="ZoneServer")
    RoleAvatar(name="SimAvatar", role=zserver)
    zuser = User(name="ZoneServer", password="******")
    zuser.addRole(zserver)

    query = Role(name="Query")
    RoleAvatar(name="QueryAvatar", role=query)

    stats = Role(name="Stats")
    RoleAvatar(name="StatsAvatar", role=stats)
def CmdDeny(mob, args):
    from mud.common.permission import User, Role
    from player import Player

    if len(args) < 2:
        return

    try:
        user = User.byName(args[0])
    except:
        mob.player.sendGameText(RPG_MSG_GAME_DENIED,
                                "Unknown user %s.\\n" % args[0])
        return

    if not IsUserSuperior(mob.player.publicName, user.name):
        mob.player.sendGameText(
            RPG_MSG_GAME_DENIED,
            "You do not have the required permission for this action.\\n")
        return

    try:
        role = Role.byName(args[1])
    except:
        mob.player.sendGameText(RPG_MSG_GAME_DENIED,
                                "Unknown role %s.\\n" % args[1])
        return

    for r in user.roles:
        if r.name == role.name:
            user.removeRole(r)
            try:
                player = Player.byPublicName(args[0])
                if player.avatar and player.avatar.masterPerspective:
                    player.avatar.masterPerspective.removeAvatar(
                        "GuardianAvatar")
            except:
                pass

            mob.player.sendGameText(
                RPG_MSG_GAME_GAINED,
                "User %s denied the %s role.\\n" % (args[0], args[1]))
            return

    mob.player.sendGameText(
        RPG_MSG_GAME_DENIED,
        "User %s doesn't have the %s role.\\n" % (args[0], args[1]))
def CmdDeny(mob,args):
    from mud.common.permission import User,Role
    from player import Player
    
    if len(args) < 2:
        return
    
    try:
        user = User.byName(args[0])
    except:
        mob.player.sendGameText(RPG_MSG_GAME_DENIED,"Unknown user %s.\\n"%args[0])
        return
    
    
    if not IsUserSuperior(mob.player.publicName,user.name):
        mob.player.sendGameText(RPG_MSG_GAME_DENIED,"You do not have the required permission for this action.\\n")
        return

    
    try:
        role = Role.byName(args[1])
    except:
        mob.player.sendGameText(RPG_MSG_GAME_DENIED,"Unknown role %s.\\n"%args[1])
        return
    
    for r in user.roles:
        if r.name == role.name:
            user.removeRole(r)
            try:
                player = Player.byPublicName(args[0])
                if player.avatar and player.avatar.masterPerspective:
                    player.avatar.masterPerspective.removeAvatar("GuardianAvatar")            
            except:
                pass

            mob.player.sendGameText(RPG_MSG_GAME_GAINED,"User %s denied the %s role.\\n"%(args[0],args[1]))
            return
    
            
    mob.player.sendGameText(RPG_MSG_GAME_DENIED,"User %s doesn't have the %s role.\\n"%(args[0],args[1]))
def CmdGrant(mob, args):
    from mud.common.permission import User, Role

    if len(args) < 2:
        return

    try:
        user = User.byName(args[0])
    except:
        mob.player.sendGameText(RPG_MSG_GAME_DENIED,
                                "Unknown user %s.\\n" % args[0])
        return

    try:
        role = Role.byName(args[1])
    except:
        mob.player.sendGameText(RPG_MSG_GAME_DENIED,
                                "Unknown role %s.\\n" % args[1])
        return

    for r in user.roles:
        if r.name == role.name:
            mob.player.sendGameText(
                RPG_MSG_GAME_DENIED,
                "User %s already has the %s role.\\n" % (args[0], args[1]))
            return

    if role.name == "Immortal":
        from newplayeravatar import NewPlayerAvatar
        if mob.player.publicName != NewPlayerAvatar.ownerPublicName:
            mob.player.sendGameText(
                RPG_MSG_GAME_DENIED,
                "Immortal access can only be granted by the server's owner.\\n"
            )
            return

    mob.player.sendGameText(
        RPG_MSG_GAME_GAINED,
        "User %s granted the %s role.\\n" % (args[0], args[1]))
    user.addRole(role)
Beispiel #21
0
    def requestAvatar(self, avatarId, mind, *interfaces):
        
        if pb.IPerspective in interfaces:
            username,role=avatarId.split('-')
            
            #user and ip banning
            if mind: #blah, I wish I could get this regardless!!!!
                ip = mind.broker.transport.getPeer()
                try:
                    subnet=ip.host[:ip.host.rfind('.')]
                except:
                    print "Warning:  IP logging isn't working... Windows 2000?"
                    subnet = ""
                
                
                if role == 'Registration' and subnet: #old client didn't pass pb.Root here... grr
                    try:
                        bi = BannedIP.byAddress(subnet)
                        return failure.Failure(BannedIPError())
                    except:
                        pass
        
                    
                if role in ('Player','Guardian','Immortal'):
                    u = User.byName(username)
                    if subnet:
                        u.lastConnectSubnet = subnet

            if role in ('Player','Guardian','Immortal'):
                if not THESERVER.allowConnections:
                    return failure.Failure(AllowConnectionsError())
            
            role=Role.byName(role)       
            print "-------->",THESERVER.__class__.__name__,role.name                     
            avatar = MasterPerspective(role,username,mind,self)
            avatar.realm = self
            self.avatars.append(avatar)
            return pb.IPerspective, avatar, avatar.logout 
        else:
            raise NotImplementedError("no interface")
Beispiel #22
0
    def requestAvatar(self, avatarId, mind, *interfaces):

        if pb.IPerspective in interfaces:
            username, role = avatarId.split('-')

            #user and ip banning
            if mind:  #blah, I wish I could get this regardless!!!!
                ip = mind.broker.transport.getPeer()
                try:
                    subnet = ip.host[:ip.host.rfind('.')]
                except:
                    print "Warning:  IP logging isn't working... Windows 2000?"
                    subnet = ""

                if role == 'Registration' and subnet:  #old client didn't pass pb.Root here... grr
                    try:
                        bi = BannedIP.byAddress(subnet)
                        return failure.Failure(BannedIPError())
                    except:
                        pass

                if role in ('Player', 'Guardian', 'Immortal'):
                    u = User.byName(username)
                    if subnet:
                        u.lastConnectSubnet = subnet

            if role in ('Player', 'Guardian', 'Immortal'):
                if not THESERVER.allowConnections:
                    return failure.Failure(AllowConnectionsError())

            role = Role.byName(role)
            print "-------->", THESERVER.__class__.__name__, role.name
            avatar = MasterPerspective(role, username, mind, self)
            avatar.realm = self
            self.avatars.append(avatar)
            return pb.IPerspective, avatar, avatar.logout
        else:
            raise NotImplementedError("no interface")
Beispiel #23
0
    import mud.world.simavatar
    from   mud.common.avatar import RoleAvatar

    from mud.common.permission import User,Role


    #XXX clean this up, there is no reason for creating and destroying these, also are the roles bloating the db or are they destroyed?
    #destroy the new player user, and recreate
    try:
        user = User.byName("NewPlayer")
        user.destroySelf()
    except:
        pass

    newuser = User(name="NewPlayer",password="")
    newuser.addRole(Role.byName("NewPlayer"))

    try:
        user = User.byName("Query")
        user.destroySelf()
    except:
        pass

    newuser = User(name="Query",password="******")
    newuser.addRole(Role.byName("Query"))


    try:
        stats = User.byName("Stats")
        stats.destroySelf()
    except:
    def remote_installPlayer(self,publicName,buffer,code,premium,guildInfo):
        from mud.server.app import THESERVER
        
        if buffer:
            buffer = loads(decodestring(buffer))
        
        if not THESERVER.allowConnections:
            return (False,"This world is currently unavailable.  Please try again in a few minutes.")
        
        for p in self.world.activePlayers:
            if p.publicName == publicName:
                return (False,"Player already on world")
        
        #destroy player
        p = None
        try:
            p = Player.byPublicName(publicName)
        except:
            pass
        
        if p:
            #we must destroy this player (this should probably be changed to raw sql for speed)
            p.destroySelf()
            
        try:
            user = User.byName(publicName)
            for r in user.roles:
                r.removeUser(user)
            user.destroySelf()
        except:
            pass
            
        
        
        if buffer and buffer != "None":
            error = self.installPlayerBuffer(buffer)
            if error:
                return (False,"Error installing player buffer")
            
            try:
                p = Player.byPublicName(publicName)
                password = GenPasswd().upper()
                p.password = password
                user = User(name=publicName,password=password)
                user.addRole(Role.byName("Player"))
                
                if code == 2: 
                    user.addRole(Role.byName("Immortal"))
                    user.addRole(Role.byName("Guardian"))
                elif code == 1:
                    user.addRole(Role.byName("Guardian"))
                    
                
            except:
                traceback.print_exc()
                return (False,"Error setting up installed player")
                

        else:
            try:
                p = self.createPlayer(publicName,code)
            except:
                traceback.print_exc()
                return (False,"Error creating new player")
        
        p.premium = premium
        p.fantasyName = p.publicName #legacy
        
        p.guildName = guildInfo[0]
        p.guildInfo = guildInfo[1]
        p.guildMOTD = guildInfo[2]
        p.guildRank = guildInfo[3]
        return (True,p.password)
Beispiel #25
0
    import mud.world.simavatar
    from   mud.common.avatar import RoleAvatar

    from mud.common.permission import User,Role


    #XXX clean this up, there is no reason for creating and destroying these, also are the roles bloating the db or are they destroyed?
    #destroy the new player user, and recreate
    try:
        user = User.byName("NewPlayer")
        user.destroySelf()
    except:
        pass

    newuser = User(name="NewPlayer",password="")
    newuser.addRole(Role.byName("NewPlayer"))

    try:
        user = User.byName("Query")
        user.destroySelf()
    except:
        pass

    newuser = User(name="Query",password="")
    newuser.addRole(Role.byName("Query"))


    try:
        stats = User.byName("Stats")
        stats.destroySelf()
    except:
Beispiel #26
0
def ConfigureRoles():
    ms = Role(name="MS")
    RoleAvatar(name="MailAvatar", role=ms)

    msp = Role(name="MSP")
    RoleAvatar(name="MailProxyAvatar", role=msp)
Beispiel #27
0
def ConfigureUsers():
    reg = User(name="MS", password="******")
    reg.addRole(Role.byName("MS"))

    reg2 = User(name="MSP", password="******")
    reg2.addRole(Role.byName("MSP"))
Beispiel #28
0
    def remote_installPlayer(self, publicName, buffer, code, premium,
                             guildInfo):
        from mud.server.app import THESERVER

        if buffer:
            buffer = loads(decodestring(buffer))

        if not THESERVER.allowConnections:
            return (
                False,
                "This world is currently unavailable.  Please try again in a few minutes."
            )

        for p in self.world.activePlayers:
            if p.publicName == publicName:
                return (False, "Player already on world")

        #destroy player
        p = None
        try:
            p = Player.byPublicName(publicName)
        except:
            pass

        if p:
            #we must destroy this player (this should probably be changed to raw sql for speed)
            p.destroySelf()

        try:
            user = User.byName(publicName)
            for r in user.roles:
                r.removeUser(user)
            user.destroySelf()
        except:
            pass

        if buffer and buffer != "None":
            error = self.installPlayerBuffer(buffer)
            if error:
                return (False, "Error installing player buffer")

            try:
                p = Player.byPublicName(publicName)
                password = GenPasswd().upper()
                p.password = password
                user = User(name=publicName, password=password)
                user.addRole(Role.byName("Player"))

                if code == 2:
                    user.addRole(Role.byName("Immortal"))
                    user.addRole(Role.byName("Guardian"))
                elif code == 1:
                    user.addRole(Role.byName("Guardian"))

            except:
                traceback.print_exc()
                return (False, "Error setting up installed player")

        else:
            try:
                p = self.createPlayer(publicName, code)
            except:
                traceback.print_exc()
                return (False, "Error creating new player")

        p.premium = premium
        p.fantasyName = p.publicName  #legacy

        p.guildName = guildInfo[0]
        p.guildInfo = guildInfo[1]
        p.guildMOTD = guildInfo[2]
        p.guildRank = guildInfo[3]
        return (True, p.password)
Beispiel #29
0
def ConfigureUsers():
    reg = User(name="AH",password="******")
    reg.addRole(Role.byName("AH"))
    def perspective_newPlayer(self,
                              publicName,
                              fantasyName,
                              playerPassword=None):
        #XXX if you change this function, also change it's mirror in cserveravatar!!!

        if self.world.pwNewPlayer and playerPassword != self.world.pwNewPlayer:
            return (-1, "Incorrect player password.", None)

        #does player already exist?
        try:
            player = Player.byPublicName(publicName)
        except:
            pass
        else:
            return (-1, "You already have an account on this world.", None)

        try:
            player = Player.byFantasyName(fantasyName)
        except:
            pass
        else:
            return (-1, "That avatar name is taken, please choose another.",
                    None)

        password = GenPasswd().upper()

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

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

        p = Player(publicName=publicName,
                   password=password,
                   fantasyName=publicName,
                   logZone=zone,
                   bindZone=zone,
                   darknessLogZone=dzone,
                   darknessBindZone=dzone,
                   monsterLogZone=mzone,
                   monsterBindZone=mzone)
        #temp

        p.logTransformInternal = t
        p.bindTransformInternal = t

        p.darknessLogTransformInternal = dt
        p.darknessBindTransformInternal = dt

        p.monsterLogTransformInternal = mt
        p.monsterBindTransformInternal = mt

        user = User(name=publicName, password=password)
        user.addRole(Role.byName("Player"))

        if publicName == NewPlayerAvatar.ownerPublicName:
            user.addRole(Role.byName("Immortal"))
            user.addRole(Role.byName("Guardian"))

            return (0, "Immortal Account Created.\nYour password is %s" %
                    password, password)

        return (0, "Account Created.\nYour password is %s" % password,
                password)
Beispiel #31
0
def ConfigureRoles():
    ah = Role(name="AH")
    RoleAvatar(name="AHAvatar",role=ah)