Fixed player-level commands that were not updated to handle the cmdhandler's dealing with Player/Character separation.
This commit is contained in:
parent
1352fecf75
commit
33bbf6274e
2 changed files with 21 additions and 13 deletions
|
|
@ -62,6 +62,7 @@ class CmdLook(MuxCommand):
|
||||||
"""
|
"""
|
||||||
caller = self.caller
|
caller = self.caller
|
||||||
args = self.args
|
args = self.args
|
||||||
|
|
||||||
if args:
|
if args:
|
||||||
# Use search to handle duplicate/nonexistant results.
|
# Use search to handle duplicate/nonexistant results.
|
||||||
looking_at_obj = caller.search(args, use_nicks=True)
|
looking_at_obj = caller.search(args, use_nicks=True)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,10 @@ These commands go in the PlayerCmdset and are accessible also
|
||||||
when puppeting a Character (although with lower priority)
|
when puppeting a Character (although with lower priority)
|
||||||
|
|
||||||
These commands use the MuxCommandOOC parent that makes sure
|
These commands use the MuxCommandOOC parent that makes sure
|
||||||
to setup caller correctly. The self.character can be used to
|
to setup caller correctly. They use self.player to make sure
|
||||||
|
to always use the player object rather than self.caller (which
|
||||||
|
change depending on the level you are calling from)
|
||||||
|
The property self.character can be used to
|
||||||
access the character when these commands are triggered with
|
access the character when these commands are triggered with
|
||||||
a connected character (such as the case of the @ooc command), it
|
a connected character (such as the case of the @ooc command), it
|
||||||
is None if we are OOC.
|
is None if we are OOC.
|
||||||
|
|
@ -35,6 +38,10 @@ BASE_PLAYER_TYPECLASS = settings.BASE_PLAYER_TYPECLASS
|
||||||
PERMISSION_HIERARCHY = settings.PERMISSION_HIERARCHY
|
PERMISSION_HIERARCHY = settings.PERMISSION_HIERARCHY
|
||||||
PERMISSION_HIERARCHY_LOWER = [perm.lower() for perm in PERMISSION_HIERARCHY]
|
PERMISSION_HIERARCHY_LOWER = [perm.lower() for perm in PERMISSION_HIERARCHY]
|
||||||
|
|
||||||
|
# Obs - these are all intended to be stored on the Player, and as such,
|
||||||
|
# use self.player instead of self.caller, just to be sure. Also self.msg()
|
||||||
|
# is used to make sure returns go to the right session
|
||||||
|
|
||||||
class CmdOOCLook(MuxPlayerCommand):
|
class CmdOOCLook(MuxPlayerCommand):
|
||||||
"""
|
"""
|
||||||
ooc look
|
ooc look
|
||||||
|
|
@ -57,7 +64,7 @@ class CmdOOCLook(MuxPlayerCommand):
|
||||||
|
|
||||||
def look_target(self):
|
def look_target(self):
|
||||||
"Hook method for when an argument is given."
|
"Hook method for when an argument is given."
|
||||||
player = self.caller
|
player = self.player
|
||||||
key = self.args.lower()
|
key = self.args.lower()
|
||||||
chars = dict((utils.to_str(char.key.lower()), char)
|
chars = dict((utils.to_str(char.key.lower()), char)
|
||||||
for char in player.db._playable_characters)
|
for char in player.db._playable_characters)
|
||||||
|
|
@ -71,7 +78,7 @@ class CmdOOCLook(MuxPlayerCommand):
|
||||||
def no_look_target(self):
|
def no_look_target(self):
|
||||||
"Hook method for default look without a specified target"
|
"Hook method for default look without a specified target"
|
||||||
# caller is always a player at this point.
|
# caller is always a player at this point.
|
||||||
player = self.caller
|
player = self.player
|
||||||
sessid = self.sessid
|
sessid = self.sessid
|
||||||
# get all our characters and sessions
|
# get all our characters and sessions
|
||||||
characters = player.db._playable_characters
|
characters = player.db._playable_characters
|
||||||
|
|
@ -155,7 +162,7 @@ class CmdCharCreate(MuxPlayerCommand):
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
"create the new character"
|
"create the new character"
|
||||||
player = self.caller
|
player = self.player
|
||||||
if not self.args:
|
if not self.args:
|
||||||
self.msg("Usage: @charcreate <charname> [= description]")
|
self.msg("Usage: @charcreate <charname> [= description]")
|
||||||
return
|
return
|
||||||
|
|
@ -216,7 +223,7 @@ class CmdIC(MuxPlayerCommand):
|
||||||
"""
|
"""
|
||||||
Main puppet method
|
Main puppet method
|
||||||
"""
|
"""
|
||||||
player = self.caller
|
player = self.player
|
||||||
sessid = self.sessid
|
sessid = self.sessid
|
||||||
|
|
||||||
new_character = None
|
new_character = None
|
||||||
|
|
@ -279,7 +286,7 @@ class CmdOOC(MuxPlayerCommand):
|
||||||
def func(self):
|
def func(self):
|
||||||
"Implement function"
|
"Implement function"
|
||||||
|
|
||||||
player = self.caller
|
player = self.player
|
||||||
sessid = self.sessid
|
sessid = self.sessid
|
||||||
|
|
||||||
old_char = player.get_puppet(sessid)
|
old_char = player.get_puppet(sessid)
|
||||||
|
|
@ -313,7 +320,7 @@ class CmdSessions(MuxPlayerCommand):
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
"Implement function"
|
"Implement function"
|
||||||
player = self.caller
|
player = self.player
|
||||||
sessions = player.get_all_sessions()
|
sessions = player.get_all_sessions()
|
||||||
|
|
||||||
table = prettytable.PrettyTable(["{wsessid",
|
table = prettytable.PrettyTable(["{wsessid",
|
||||||
|
|
@ -353,7 +360,7 @@ class CmdWho(MuxPlayerCommand):
|
||||||
Get all connected players by polling session.
|
Get all connected players by polling session.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
player = self.caller
|
player = self.player
|
||||||
session_list = SESSIONS.get_sessions()
|
session_list = SESSIONS.get_sessions()
|
||||||
|
|
||||||
session_list = sorted(session_list, key=lambda o: o.player.key)
|
session_list = sorted(session_list, key=lambda o: o.player.key)
|
||||||
|
|
@ -434,7 +441,7 @@ class CmdEncoding(MuxPlayerCommand):
|
||||||
"""
|
"""
|
||||||
Sets the encoding.
|
Sets the encoding.
|
||||||
"""
|
"""
|
||||||
player = self.caller
|
player = self.player
|
||||||
|
|
||||||
if 'clear' in self.switches:
|
if 'clear' in self.switches:
|
||||||
# remove customization
|
# remove customization
|
||||||
|
|
@ -479,7 +486,7 @@ class CmdPassword(MuxPlayerCommand):
|
||||||
def func(self):
|
def func(self):
|
||||||
"hook function."
|
"hook function."
|
||||||
|
|
||||||
player = self.caller
|
player = self.player
|
||||||
if not self.rhs:
|
if not self.rhs:
|
||||||
self.msg("Usage: @password <oldpass> = <newpass>")
|
self.msg("Usage: @password <oldpass> = <newpass>")
|
||||||
return
|
return
|
||||||
|
|
@ -513,7 +520,7 @@ class CmdQuit(MuxPlayerCommand):
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
"hook function"
|
"hook function"
|
||||||
player = self.caller
|
player = self.player
|
||||||
|
|
||||||
if 'all' in self.switches:
|
if 'all' in self.switches:
|
||||||
player.msg("{RQuitting{n all sessions. Hope to see you soon again.", sessid=self.sessid)
|
player.msg("{RQuitting{n all sessions. Hope to see you soon again.", sessid=self.sessid)
|
||||||
|
|
@ -649,7 +656,7 @@ class CmdQuell(MuxPlayerCommand):
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
"Perform the command"
|
"Perform the command"
|
||||||
player = self.caller
|
player = self.player
|
||||||
permstr = player.is_superuser and " (superuser)" or " (%s)" % (", ".join(player.permissions.all()))
|
permstr = player.is_superuser and " (superuser)" or " (%s)" % (", ".join(player.permissions.all()))
|
||||||
if self.cmdstring == '@unquell':
|
if self.cmdstring == '@unquell':
|
||||||
if not player.attributes.get('_quell'):
|
if not player.attributes.get('_quell'):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue