Fixed bugs that now allows multiple sessions to connect through the same player to different characters. Still lots of bugs and inconsistencies, the permissions of superusers don't quite transfer sometimes, for example.
This commit is contained in:
parent
3aa122c41a
commit
a84b4f24fc
4 changed files with 23 additions and 15 deletions
|
|
@ -1555,7 +1555,7 @@ class CmdExamine(ObjManipCommand):
|
|||
"""
|
||||
key = "@examine"
|
||||
aliases = ["@ex","ex", "exam", "examine"]
|
||||
locks = "cmd:perm(examine) or perm(Builders)"
|
||||
locks = "cmd:perm(examine) or perm(Players)"#Builders)"
|
||||
help_category = "Building"
|
||||
arg_regex = r"(/\w+?(\s|$))|\s|$"
|
||||
|
||||
|
|
@ -1615,6 +1615,7 @@ class CmdExamine(ObjManipCommand):
|
|||
headers = {"name":"\n{wName/key{n: {c%s{n (%s)",
|
||||
"aliases":"\n{wAliases{n: %s",
|
||||
"player":"\n{wPlayer{n: {c%s{n",
|
||||
"sessid":" {wsessid{n: {c%s{n",
|
||||
"playerperms":"\n{wPlayer Perms{n: %s",
|
||||
"typeclass":"\n{wTypeclass{n: %s (%s)",
|
||||
"location":"\n{wLocation{n: %s (#%s)",
|
||||
|
|
@ -1630,6 +1631,7 @@ class CmdExamine(ObjManipCommand):
|
|||
headers_noansi = {"name":"\nName/key: %s (%s)",
|
||||
"aliases":"\nAliases: %s",
|
||||
"player":"\nPlayer: %s",
|
||||
"sessid":" sessid: %s)",
|
||||
"playerperms":"\nPlayer Perms: %s",
|
||||
"typeclass":"\nTypeclass: %s%s",
|
||||
"location":"\nLocation: %s (#%s)",
|
||||
|
|
@ -1659,6 +1661,10 @@ class CmdExamine(ObjManipCommand):
|
|||
elif not perms:
|
||||
perms = ["<None>"]
|
||||
string += headers["playerperms"] % (", ".join(perms))
|
||||
if hasattr(obj, "sessid"):
|
||||
string += headers["sessid"] % obj.sessid
|
||||
elif hasattr(obj, "sessions"):
|
||||
string += headers["sessid"] % (",".join(sess.sessid for sess in obj.sessions))
|
||||
string += headers["typeclass"] % (obj.typeclass.typename, obj.typeclass_path)
|
||||
|
||||
if hasattr(obj, "location") and obj.location:
|
||||
|
|
@ -1733,13 +1739,16 @@ class CmdExamine(ObjManipCommand):
|
|||
|
||||
if not self.args:
|
||||
# If no arguments are provided, examine the invoker's location.
|
||||
obj = caller.location
|
||||
if not obj.access(caller, 'examine'):
|
||||
#If we don't have special info access, just look at the object instead.
|
||||
caller.execute_cmd('look %s' % obj.name)
|
||||
return
|
||||
# using callback for printing result whenever function returns.
|
||||
get_and_merge_cmdsets(obj).addCallback(get_cmdset_callback)
|
||||
if hasattr(caller, "location"):
|
||||
obj = caller.location
|
||||
if not obj.access(caller, 'examine'):
|
||||
#If we don't have special info access, just look at the object instead.
|
||||
caller.execute_cmd('look %s' % obj.name)
|
||||
return
|
||||
# using callback for printing result whenever function returns.
|
||||
get_and_merge_cmdsets(obj).addCallback(get_cmdset_callback)
|
||||
else:
|
||||
caller.msg("You need to supply a target to examine.")
|
||||
return
|
||||
|
||||
# we have given a specific target object
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ a Player object as caller rather than a Character.
|
|||
from src.commands.cmdset import CmdSet
|
||||
from src.commands.default import help, comms, general, admin, system
|
||||
|
||||
from src.commands.default import building
|
||||
class OOCCmdSet(CmdSet):
|
||||
"""
|
||||
Implements the player command set.
|
||||
|
|
@ -28,6 +29,9 @@ class OOCCmdSet(CmdSet):
|
|||
self.add(general.CmdQuit())
|
||||
self.add(general.CmdPassword())
|
||||
|
||||
# test
|
||||
self.add(building.CmdExamine())
|
||||
|
||||
# Help command
|
||||
self.add(help.CmdHelp())
|
||||
|
||||
|
|
|
|||
|
|
@ -934,8 +934,7 @@ class CmdOOC(MuxCommandOOC):
|
|||
old_char.location = None
|
||||
|
||||
# disconnect
|
||||
err = caller.disconnect_character(caller)
|
||||
print "err:", err
|
||||
err = caller.disconnect_character(self.character)
|
||||
caller.msg("\n{GYou go OOC.{n\n")
|
||||
caller.execute_cmd("look")
|
||||
|
||||
|
|
|
|||
|
|
@ -465,7 +465,6 @@ class PlayerDB(TypedObject):
|
|||
if not sessid:
|
||||
return
|
||||
char = _GA(self, "get_character")(sessid=sessid, return_dbobj=True)
|
||||
print "disonnect session:", char
|
||||
if char:
|
||||
# call hook before disconnecting
|
||||
_GA(char.typeclass, "at_disconnect")()
|
||||
|
|
@ -512,9 +511,7 @@ class PlayerDB(TypedObject):
|
|||
return char and (char == character.dbobj and (return_dbobj and char or char.typeclass)) or None
|
||||
return char and (return_dbobj and char or char.typeclass) or None
|
||||
elif character:
|
||||
print character, character.dbobj, _GA(self,"db_objs").all()
|
||||
char = _GA(self, "db_objs").filter(id=_GA(character.dbobj, "id"))
|
||||
print "character:", character, char
|
||||
return char and (return_dbobj and char[0] or char[0].typeclass) or None
|
||||
else:
|
||||
# no sessid given - return all available characters
|
||||
|
|
@ -555,9 +552,8 @@ class PlayerDB(TypedObject):
|
|||
if not character:
|
||||
return
|
||||
char = _GA(self, "get_character")(character=character, return_dbobj=True)
|
||||
print "disconnect_char:", char
|
||||
if char:
|
||||
print _GA(self, "disconnect_session_from_character")(char.sessid)
|
||||
err = _GA(self, "disconnect_session_from_character")(char.sessid)
|
||||
_GA(self, "db_objs").remove(char)
|
||||
del char.player
|
||||
self.save()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue