diff --git a/src/commands/default/general.py b/src/commands/default/general.py index be0f5900a6..7f11fcc08e 100644 --- a/src/commands/default/general.py +++ b/src/commands/default/general.py @@ -834,13 +834,18 @@ class CmdOOCLook(MuxCommandOOC, CmdLook): if csessid: # character is already puppeted sess = player.get_session(csessid) - if sess: + if hasattr(char.locks, "lock_bypass") and char.locks.lock_bypass: + string += "\n - {G%s{n (superuser character) (played by you from session with id %i)" % (char.key, sess.sessid) + elif sess: string += "\n - {G%s{n (played by you from session with id %i)" % (char.key, sess.sessid) else: string += "\n - {R%s{n (played by someone else)" % char.key else: # character is "free to puppet" - string += "\n - %s" % char.key + if player.is_superuser and char.get_attribute("_superuser_character"): + string += "\n - %s (superuser character)" % (char.key) + else: + string += "\n - %s" % char.key self.msg(string) def func(self): @@ -878,7 +883,7 @@ class CmdCharCreate(MuxCommandOOC): key = self.lhs desc = self.rhs if player.db._playable_characters and len(player.db._playable_characters) >= self.MAX_NR_CHARACTERS: - player.msg("You may only create a maximum of %i characters." % self.MAX_NR_CHARACTERS) + self.msg("You may only create a maximum of %i characters." % self.MAX_NR_CHARACTERS) return # create the character from src.objects.models import ObjectDB @@ -892,7 +897,7 @@ class CmdCharCreate(MuxCommandOOC): player.db._playable_characters.append(new_character) if desc: new_character.db.desc = desc - player.msg("Created new character %s." % new_character.key) + self.msg("Created new character %s." % new_character.key) class CmdIC(MuxCommandOOC): @@ -930,7 +935,7 @@ class CmdIC(MuxCommandOOC): if not self.args: new_character = caller.db.last_puppet if not new_character: - caller.msg("Usage: @ic ") + self.msg("Usage: @ic ") return if not new_character: # search for a matching character @@ -938,24 +943,24 @@ class CmdIC(MuxCommandOOC): if new_character: new_character = new_character[0] else: - # the search method handles error messages etc. + self.msg("That is not a valid character choice.") return # permission checks if caller.get_character(sessid=sessid, character=new_character): - caller.msg("{RYou already act as {c%s{n." % new_character.name) + self.msg("{RYou already act as {c%s{n." % new_character.name) return if new_character.player: if new_character.sessid == sessid: - caller.msg("{RYou already act as {c%s{n from another session." % new_character.name) + self.msg("{RYou already act as {c%s{n from another session." % new_character.name) return elif not caller.get_character(character=new_character): - caller.msg("{c%s{r is already acted by another player.{n" % new_character.name) + self.msg("{c%s{r is already acted by another player.{n" % new_character.name) return if not new_character.access(caller, "puppet"): - caller.msg("{rYou may not become %s.{n" % new_character.name) + self.msg("{rYou may not become %s.{n" % new_character.name) return if caller.connect_character(new_character, sessid=sessid): - new_character.msg("\n{gYou become {c%s{n.\n" % new_character.name) + self.msg("\n{gYou become {c%s{n.\n" % new_character.name) caller.db.last_puppet = old_character if not new_character.location: # this might be due to being hidden away at logout; check @@ -968,7 +973,7 @@ class CmdIC(MuxCommandOOC): new_character.location.at_object_receive(new_character, new_character.location) new_character.execute_cmd("look") else: - caller.msg("{rYou cannot become {C%s{n." % new_character.name) + msg.msg("{rYou cannot become {C%s{n." % new_character.name) class CmdOOC(MuxCommandOOC): """ @@ -995,7 +1000,7 @@ class CmdOOC(MuxCommandOOC): old_char = caller.get_character(sessid=self.sessid) if not old_char: string = "You are already OOC." - caller.msg(string) + self.msg(string) return caller.db.last_puppet = old_char @@ -1007,6 +1012,6 @@ class CmdOOC(MuxCommandOOC): # disconnect err = caller.disconnect_character(self.character) - caller.msg("\n{GYou go OOC.{n\n") + self.msg("\n{GYou go OOC.{n\n") caller.execute_cmd("look") diff --git a/src/commands/default/system.py b/src/commands/default/system.py index c3f6e84b8d..323652fb5f 100644 --- a/src/commands/default/system.py +++ b/src/commands/default/system.py @@ -136,7 +136,7 @@ class CmdPy(MuxCommand): """ key = "@py" aliases = ["!"] - locks = "cmd:all()"#"cmd:perm(py) or perm(Immortals)" + locks = "cmd:perm(py) or perm(Immortals)" help_category = "System" def func(self): diff --git a/src/locks/lockhandler.py b/src/locks/lockhandler.py index 3451203ce9..d43d205702 100644 --- a/src/locks/lockhandler.py +++ b/src/locks/lockhandler.py @@ -259,9 +259,10 @@ class LockHandler(object): get_player method (this sits on serversessions, in some rare cases where a check is done before the login process has yet been fully finalized) """ - self.lock_bypass = ((hasattr(obj, "is_superuser") and obj.is_superuser) - or (hasattr(obj, "player") and hasattr(obj.player, "is_superuser") and obj.player.is_superuser) - or (hasattr(obj, "get_player") and (not obj.get_player() or obj.get_player().is_superuser))) + self.lock_bypass = (hasattr(obj, "is_superuser") and obj.is_superuser + or ((hasattr(obj, "get_attribute") and obj.get_attribute("_superuser_character")) + and ((hasattr(obj, "player") and hasattr(obj.player, "is_superuser") and obj.player.is_superuser) + or (hasattr(obj, "get_player") and (not obj.get_player() or obj.get_player().is_superuser))))) def add(self, lockstring, log_obj=None): """ diff --git a/src/objects/models.py b/src/objects/models.py index c26a8d7ddd..2229203751 100644 --- a/src/objects/models.py +++ b/src/objects/models.py @@ -250,6 +250,7 @@ class ObjectDB(TypedObject): a TypedObject, so as to not create a loop. """ return get_field_cache(self, "player") + #@player.setter def __player_set(self, player): "Setter. Allows for self.player = value" @@ -260,6 +261,7 @@ class ObjectDB(TypedObject): # bypass lockchecks unless they start the game connected # to the character in question. self.locks.cache_lock_bypass(self) + #@player.deleter def __player_del(self): "Deleter. Allows for del self.player" @@ -482,11 +484,11 @@ class ObjectDB(TypedObject): has_player = property(__has_player_get) is_player = property(__has_player_get) - #@property - def __is_superuser_get(self): - "Check if user has a player, and if so, if it is a superuser." - return any(_GA(self, "sessions")) and _GA(_GA(self, "player"), "is_superuser") - is_superuser = property(__is_superuser_get) + ##@property + #def __is_superuser_get(self): + # "Check if user has a player, and if so, if it is a superuser." + # return any(_GA(self, "sessions")) and _GA(_GA(self, "player"), "is_superuser") + #is_superuser = property(__is_superuser_get) # contents