""" General Character commands usually available to all characters """ from django.conf import settings from evennia.utils import utils, evtable from evennia.typeclasses.attributes import NickTemplateInvalid COMMAND_DEFAULT_CLASS = utils.class_from_module(settings.COMMAND_DEFAULT_CLASS) # limit symbol import for API __all__ = ("CmdHome", "CmdLook", "CmdNick", "CmdInventory", "CmdGet", "CmdDrop", "CmdGive", "CmdSay", "CmdWhisper", "CmdPose", "CmdAccess") class CmdHome(COMMAND_DEFAULT_CLASS): """ move to your character's home location Usage: home Teleports you to your home location. """ key = "home" locks = "cmd:perm(home) or perm(Builders)" arg_regex = r"$" def func(self): """Implement the command""" caller = self.caller home = caller.home if not home: caller.msg("You have no home!") elif home == caller.location: caller.msg("You are already home!") else: caller.msg("There's no place like home ...") caller.move_to(home) class CmdLook(COMMAND_DEFAULT_CLASS): """ look at location or object Usage: look look look * Observes your location or objects in your vicinity. """ key = "look" aliases = ["l", "ls"] locks = "cmd:all()" arg_regex = r"\s|$" def func(self): """ Handle the looking. """ caller = self.caller if not self.args: target = caller.location if not target: caller.msg("You have no location to look at!") return else: target = caller.search(self.args, use_dbref=caller.check_permstring("Builders")) if not target: return self.msg(caller.at_look(target)) class CmdNick(COMMAND_DEFAULT_CLASS): """ define a personal alias/nick Usage: nick[/switches] [= [replacement_string]] nick[/switches]