Resolve merge conflicts

This commit is contained in:
Griatch 2019-05-01 19:20:19 +02:00
commit 43bf2da79c
5 changed files with 24 additions and 7 deletions

View file

@ -1169,7 +1169,7 @@ class DefaultAccount(with_metaclass(TypeclassBase, AccountDB)):
""" """
# if we have saved protocol flags on ourselves, load them here. # if we have saved protocol flags on ourselves, load them here.
protocol_flags = self.attributes.get("_saved_protocol_flags", None) protocol_flags = self.attributes.get("_saved_protocol_flags", {})
if session and protocol_flags: if session and protocol_flags:
session.update_flags(**protocol_flags) session.update_flags(**protocol_flags)

View file

@ -434,10 +434,10 @@ class CmdWho(COMMAND_DEFAULT_CLASS):
account = session.get_account() account = session.get_account()
puppet = session.get_puppet() puppet = session.get_puppet()
location = puppet.location.key if puppet and puppet.location else "None" location = puppet.location.key if puppet and puppet.location else "None"
table.add_row(utils.crop(account.name, width=25), table.add_row(utils.crop(account.get_display_name(account), width=25),
utils.time_format(delta_conn, 0), utils.time_format(delta_conn, 0),
utils.time_format(delta_cmd, 1), utils.time_format(delta_cmd, 1),
utils.crop(puppet.key if puppet else "None", width=25), utils.crop(puppet.get_display_name(account) if puppet else "None", width=25),
utils.crop(location, width=25), utils.crop(location, width=25),
session.cmd_total, session.cmd_total,
session.protocol_key, session.protocol_key,
@ -451,7 +451,7 @@ class CmdWho(COMMAND_DEFAULT_CLASS):
delta_cmd = time.time() - session.cmd_last_visible delta_cmd = time.time() - session.cmd_last_visible
delta_conn = time.time() - session.conn_time delta_conn = time.time() - session.conn_time
account = session.get_account() account = session.get_account()
table.add_row(utils.crop(account.key, width=25), table.add_row(utils.crop(account.get_display_name(account), width=25),
utils.time_format(delta_conn, 0), utils.time_format(delta_conn, 0),
utils.time_format(delta_cmd, 1)) utils.time_format(delta_cmd, 1))
is_one = naccounts == 1 is_one = naccounts == 1

View file

@ -1,8 +1,9 @@
""" """
Typeclasses for the in-game Python system. Typeclasses for the in-game Python system.
To use thm, one should inherit from these classes (EventObject, To use them, change your base typeclasses to inherit from the classes in this
EventRoom, EventCharacter and EventExit). module (EventObject, EventRoom, EventCharacter and EventExit) instead of the
default ones in evennia core.
""" """
@ -179,6 +180,11 @@ class EventCharacter(DefaultCharacter):
"unpuppeted": (["character"], CHARACTER_UNPUPPETED), "unpuppeted": (["character"], CHARACTER_UNPUPPETED),
} }
@lazy_property
def callbacks(self):
"""Return the CallbackHandler."""
return CallbackHandler(self)
def announce_move_from(self, destination, msg=None, mapping=None): def announce_move_from(self, destination, msg=None, mapping=None):
""" """
Called if the move is to be announced. This is Called if the move is to be announced. This is
@ -602,6 +608,11 @@ class EventExit(DefaultExit):
"traverse": (["character", "exit", "origin", "destination"], EXIT_TRAVERSE), "traverse": (["character", "exit", "origin", "destination"], EXIT_TRAVERSE),
} }
@lazy_property
def callbacks(self):
"""Return the CallbackHandler."""
return CallbackHandler(self)
def at_traverse(self, traversing_object, target_location): def at_traverse(self, traversing_object, target_location):
""" """
This hook is responsible for handling the actual traversal, This hook is responsible for handling the actual traversal,
@ -862,6 +873,11 @@ class EventRoom(DefaultRoom):
"unpuppeted_in": (["character", "room"], ROOM_UNPUPPETED_IN), "unpuppeted_in": (["character", "room"], ROOM_UNPUPPETED_IN),
} }
@lazy_property
def callbacks(self):
"""Return the CallbackHandler."""
return CallbackHandler(self)
def at_object_delete(self): def at_object_delete(self):
""" """
Called just before the database object is permanently Called just before the database object is permanently

View file

@ -241,4 +241,5 @@ class AMPServerClientProtocol(amp.AMPMultiConnectionProtocol):
else: else:
raise Exception("operation %(op)s not recognized." % {'op': operation}) raise Exception("operation %(op)s not recognized." % {'op': operation})
return {} return {}

View file

@ -135,7 +135,7 @@ class Session(object):
""" """
if self.account: if self.account:
self.protocol_flags.update(self.account.attributes.get("_saved_protocol_flags", {})) self.protocol_flags.update(self.account.attributes.get("_saved_protocol_flags", None) or {})
# access hooks # access hooks