diff --git a/docs/0.9.5/.buildinfo b/docs/0.9.5/.buildinfo index 09c5021c47..faf79d3291 100644 --- a/docs/0.9.5/.buildinfo +++ b/docs/0.9.5/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 75efcd5cc8712eff6ba9e68cfd2962a8 +config: b3d6691cbcfd884f2c512e34b39ac37e tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/0.9.5/_modules/evennia/accounts/accounts.html b/docs/0.9.5/_modules/evennia/accounts/accounts.html index e5db96d662..9639b85792 100644 --- a/docs/0.9.5/_modules/evennia/accounts/accounts.html +++ b/docs/0.9.5/_modules/evennia/accounts/accounts.html @@ -73,7 +73,7 @@ SIGNAL_OBJECT_POST_PUPPET, SIGNAL_OBJECT_POST_UNPUPPET, ) -from evennia.typeclasses.attributes import NickHandler +from evennia.typeclasses.attributes import NickHandler, ModelAttributeBackend from evennia.scripts.scripthandler import ScriptHandler from evennia.commands.cmdsethandler import CmdSetHandler from evennia.utils.optionhandler import OptionHandler @@ -81,7 +81,7 @@ from django.utils.translation import gettext as _ from random import getrandbits -__all__ = ("DefaultAccount",) +__all__ = ("DefaultAccount", "DefaultGuest") _SESSIONS = None @@ -240,7 +240,7 @@
[docs] @lazy_property def nicks(self): - return NickHandler(self)
+ return NickHandler(self, ModelAttributeBackend)
[docs] @lazy_property def sessions(self): @@ -1588,21 +1588,21 @@ return look_string
-class DefaultGuest(DefaultAccount): +
[docs]class DefaultGuest(DefaultAccount): """ This class is used for guest logins. Unlike Accounts, Guests and their characters are deleted after disconnection. """ - @classmethod +
[docs] @classmethod def create(cls, **kwargs): """ Forwards request to cls.authenticate(); returns a DefaultGuest object if one is available for use. """ - return cls.authenticate(**kwargs) + return cls.authenticate(**kwargs)
- @classmethod +
[docs] @classmethod def authenticate(cls, **kwargs): """ Gets or creates a Guest account object. @@ -1674,9 +1674,9 @@ logger.log_trace() return None, errors - return account, errors + return account, errors
- def at_post_login(self, session=None, **kwargs): +
[docs] def at_post_login(self, session=None, **kwargs): """ In theory, guests only have one character regardless of which MULTISESSION_MODE we're in. They don't get a choice. @@ -1688,9 +1688,9 @@ """ self._send_to_connect_channel(_("|G{key} connected|n").format(key=self.key)) - self.puppet_object(session, self.db._last_puppet) + self.puppet_object(session, self.db._last_puppet)
- def at_server_shutdown(self): +
[docs] def at_server_shutdown(self): """ We repeat the functionality of `at_disconnect()` here just to be on the safe side. @@ -1699,9 +1699,9 @@ characters = self.db._playable_characters for character in characters: if character: - character.delete() + character.delete()
- def at_post_disconnect(self, **kwargs): +
[docs] def at_post_disconnect(self, **kwargs): """ Once having disconnected, destroy the guest's characters and @@ -1715,7 +1715,7 @@ for character in characters: if character: character.delete() - self.delete() + self.delete()
diff --git a/docs/0.9.5/_modules/evennia/commands/command.html b/docs/0.9.5/_modules/evennia/commands/command.html index f61a95c9f0..2a9dac9b0c 100644 --- a/docs/0.9.5/_modules/evennia/commands/command.html +++ b/docs/0.9.5/_modules/evennia/commands/command.html @@ -125,6 +125,15 @@ break cls.help_category = cls.help_category.lower() + # pre-prepare a help index entry for quicker lookup + cls.search_index_entry = { + "key": cls.key, + "aliases": " ".join(cls.aliases), + "category": cls.help_category, + "text": cls.__doc__, + "tags": "", + } +
[docs]class CommandMeta(type): """ @@ -550,20 +559,6 @@ "SCREENWIDTH", {0: settings.CLIENT_DEFAULT_WIDTH} )[0] return settings.CLIENT_DEFAULT_WIDTH
- -
[docs] def client_height(self): - """ - Get the client screenheight for the session using this command. - - Returns: - client height (int): The height (in characters) of the client window. - - """ - if self.session: - return self.session.protocol_flags.get( - "SCREENHEIGHT", {0: settings.CLIENT_DEFAULT_HEIGHT} - )[0] - return settings.CLIENT_DEFAULT_HEIGHT
[docs] def styled_table(self, *args, **kwargs): """ diff --git a/docs/0.9.5/_modules/evennia/commands/default/help.html b/docs/0.9.5/_modules/evennia/commands/default/help.html index 16aa771d2d..52acd8c9d1 100644 --- a/docs/0.9.5/_modules/evennia/commands/default/help.html +++ b/docs/0.9.5/_modules/evennia/commands/default/help.html @@ -53,8 +53,14 @@ from evennia.commands.command import Command from evennia.help.models import HelpEntry from evennia.utils import create, evmore +from evennia.utils.ansi import ANSIString from evennia.utils.eveditor import EvEditor -from evennia.utils.utils import string_suggestions, class_from_module +from evennia.utils.utils import ( + string_suggestions, + class_from_module, + inherits_from, + format_grid, +) COMMAND_DEFAULT_CLASS = class_from_module(settings.COMMAND_DEFAULT_CLASS) HELP_MORE = settings.HELP_MORE @@ -65,6 +71,71 @@ _DEFAULT_WIDTH = settings.CLIENT_DEFAULT_WIDTH _SEP = "|C" + "-" * _DEFAULT_WIDTH + "|n" +_LUNR = None +_LUNR_EXCEPTION = None + + +class HelpCategory: + def __init__(self, key): + self.key = key + + @property + def search_index_entry(self): + return { + "key": str(self), + "aliases": "", + "category": self.key, + "tags": "", + "text": "", + } + + def __str__(self): + return f"Category: {self.key}" + + def __eq__(self, other): + return str(self).lower() == str(other).lower() + + def __hash__(self): + return id(self) + + +def help_search_with_index(query, candidate_entries, suggestion_maxnum=5): + """ + Lunr-powered fast index search and suggestion wrapper + """ + global _LUNR, _LUNR_EXCEPTION + if not _LUNR: + # we have to delay-load lunr because it messes with logging if it's imported + # before twisted's logging has been set up + from lunr import lunr as _LUNR + from lunr.exceptions import QueryParseError as _LUNR_EXCEPTION + + indx = [cnd.search_index_entry for cnd in candidate_entries] + mapping = {indx[ix]["key"]: cand for ix, cand in enumerate(candidate_entries)} + + search_index = _LUNR( + ref="key", + fields=[ + {"field_name": "key", "boost": 10}, + {"field_name": "aliases", "boost": 9}, + {"field_name": "category", "boost": 8}, + {"field_name": "tags", "boost": 5}, + {"field_name": "text", "boost": 1}, + ], + documents=indx, + ) + try: + matches = search_index.search(query)[:suggestion_maxnum] + except _LUNR_EXCEPTION: + # this is a user-input problem + matches = [] + + # matches (objs), suggestions (strs) + return ( + [mapping[match["ref"]] for match in matches], + [str(match["ref"]) for match in matches], # + f" (score {match['score']})") # good debug + ) +
[docs]class CmdHelp(Command): """ @@ -108,7 +179,7 @@ if type(self).help_more: usemore = True - if self.session and self.session.protocol_key in ("websocket", "ajax/comet"): + if self.session and self.session.protocol_key in ("websocket", "ajax/comet",): try: options = self.account.db._saved_webclient_options if options and options["helppopup"]: @@ -152,30 +223,34 @@ string += "\n" + _SEP return string
-
[docs] @staticmethod - def format_help_list(hdict_cmds, hdict_db): +
[docs] def format_help_list(self, hdict_cmds, hdict_db): """ Output a category-ordered list. The input are the pre-loaded help files for commands and database-helpfiles respectively. You can override this method to return a custom display of the list of commands and topics. """ - string = "" - if hdict_cmds and any(hdict_cmds.values()): - string += "\n" + _SEP + "\n |CCommand help entries|n\n" + _SEP - for category in sorted(hdict_cmds.keys()): - string += "\n |w%s|n:\n" % (str(category).title()) - string += "|G" + fill("|C, |G".join(sorted(hdict_cmds[category]))) + "|n" - if hdict_db and any(hdict_db.values()): - string += "\n\n" + _SEP + "\n\r |COther help entries|n\n" + _SEP - for category in sorted(hdict_db.keys()): - string += "\n\r |w%s|n:\n" % (str(category).title()) - string += ( - "|G" - + fill(", ".join(sorted([str(topic) for topic in hdict_db[category]]))) - + "|n" + category_clr = "|w" + topic_clr = "|G" + width = self.client_width() + grid = [] + verbatim_elements = [] + for category in sorted(set(list(hdict_cmds.keys()) + list(hdict_db.keys()))): + + category_str = f"-- {category.title()} " + grid.append( + ANSIString( + category_clr + category_str + "-" * (width - len(category_str)) + topic_clr ) - return string
+ ) + verbatim_elements.append(len(grid) - 1) + + entries = sorted(set(hdict_cmds.get(category, []) + hdict_db.get(category, []))) + grid.extend(entries) + + gridrows = format_grid(grid, width, sep=" ", verbatim_elements=verbatim_elements) + gridrows = ANSIString("\n").join(gridrows) + return gridrows
[docs] def check_show_help(self, cmd, caller): """ @@ -216,7 +291,7 @@ False: the command shouldn't appear in the table. """ - return cmd.access(caller, "view", default=True)
+ return True
[docs] def parse(self): """ @@ -249,8 +324,8 @@ ] all_categories = list( set( - [cmd.help_category.lower() for cmd in all_cmds] - + [topic.help_category.lower() for topic in all_topics] + [HelpCategory(cmd.help_category) for cmd in all_cmds] + + [HelpCategory(topic.help_category) for topic in all_topics] ) ) @@ -271,78 +346,51 @@ self.msg_help(self.format_help_list(hdict_cmd, hdict_topic)) return - # Try to access a particular command + # Try to access a particular help entry or category + entries = [cmd for cmd in all_cmds if cmd] + list(HelpEntry.objects.all()) + all_categories - # build vocabulary of suggestions and rate them by string similarity. - suggestions = None - if suggestion_maxnum > 0: - vocabulary = ( - [cmd.key for cmd in all_cmds if cmd] - + [topic.key for topic in all_topics] - + all_categories + for match_query in [f"{query}~1", f"{query}*"]: + # We first do an exact word-match followed by a start-by query + matches, suggestions = help_search_with_index( + match_query, entries, suggestion_maxnum=self.suggestion_maxnum ) - [vocabulary.extend(cmd.aliases) for cmd in all_cmds] - suggestions = [ - sugg - for sugg in string_suggestions( - query, set(vocabulary), cutoff=suggestion_cutoff, maxnum=suggestion_maxnum - ) - if sugg != query - ] - if not suggestions: - suggestions = [ - sugg for sugg in vocabulary if sugg != query and sugg.startswith(query) - ] - # try an exact command auto-help match - match = [cmd for cmd in all_cmds if cmd == query] + if matches: + match = matches[0] + if isinstance(match, HelpCategory): + formatted = self.format_help_list( + { + match.key: [ + cmd.key + for cmd in all_cmds + if match.key.lower() == cmd.help_category + ] + }, + { + match.key: [ + topic.key + for topic in all_topics + if match.key.lower() == topic.help_category + ] + }, + ) + elif inherits_from(match, "evennia.commands.command.Command"): + formatted = self.format_help_entry( + match.key, + match.get_help(caller, cmdset), + aliases=match.aliases, + suggested=suggestions[1:], + ) + else: + formatted = self.format_help_entry( + match.key, + match.entrytext, + aliases=match.aliases.all(), + suggested=suggestions[1:], + ) - if not match: - # try an inexact match with prefixes stripped from query and cmds - _query = query[1:] if query[0] in CMD_IGNORE_PREFIXES else query - - match = [ - cmd - for cmd in all_cmds - for m in cmd._matchset - if m == _query or m[0] in CMD_IGNORE_PREFIXES and m[1:] == _query - ] - - if len(match) == 1: - cmd = match[0] - key = cmd.auto_help_display_key if hasattr(cmd, "auto_help_display_key") else cmd.key - formatted = self.format_help_entry( - key, - cmd.get_help(caller, cmdset), - aliases=cmd.aliases, - suggested=suggestions, - ) - self.msg_help(formatted) - return - - # try an exact database help entry match - match = list(HelpEntry.objects.find_topicmatch(query, exact=True)) - if len(match) == 1: - formatted = self.format_help_entry( - match[0].key, - match[0].entrytext, - aliases=match[0].aliases.all(), - suggested=suggestions, - ) - self.msg_help(formatted) - return - - # try to see if a category name was entered - if query in all_categories: - self.msg_help( - self.format_help_list({ - query: [ - cmd.auto_help_display_key if hasattr(cmd, "auto_help_display_key") else cmd.key - for cmd in all_cmds if cmd.help_category == query]}, - {query: [topic.key for topic in all_topics if topic.help_category == query]}, - ) - ) - return + self.msg_help(formatted) + return # no exact matches found. Just give suggestions. self.msg( @@ -423,7 +471,10 @@ self.msg("You have to define a topic!") return topicstrlist = topicstr.split(";") - topicstr, aliases = (topicstrlist[0], topicstrlist[1:] if len(topicstr) > 1 else []) + topicstr, aliases = ( + topicstrlist[0], + topicstrlist[1:] if len(topicstr) > 1 else [], + ) aliastxt = ("(aliases: %s)" % ", ".join(aliases)) if aliases else "" old_entry = None @@ -452,7 +503,7 @@ helpentry = old_entry else: helpentry = create.create_help_entry( - topicstr, self.rhs, category=category, locks=lockstring, aliases=aliases + topicstr, self.rhs, category=category, locks=lockstring, aliases=aliases, ) self.caller.db._editing_help = helpentry diff --git a/docs/0.9.5/_modules/evennia/commands/default/system.html b/docs/0.9.5/_modules/evennia/commands/default/system.html index e35f6ce014..0c236ad30b 100644 --- a/docs/0.9.5/_modules/evennia/commands/default/system.html +++ b/docs/0.9.5/_modules/evennia/commands/default/system.html @@ -434,7 +434,9 @@ if noecho: prompt = "..." if console.push(line) else main_prompt else: - prompt = line if console.push(line) else f"{line}\n{main_prompt}" + if line: + self.caller.msg(f">>> {line}") + prompt = line if console.push(line) else main_prompt except SystemExit: break self.msg("|gClosing the Python console.|n") diff --git a/docs/0.9.5/_modules/evennia/commands/default/tests.html b/docs/0.9.5/_modules/evennia/commands/default/tests.html index 8c2cbbc737..34d17d8294 100644 --- a/docs/0.9.5/_modules/evennia/commands/default/tests.html +++ b/docs/0.9.5/_modules/evennia/commands/default/tests.html @@ -314,8 +314,21 @@
[docs]class TestHelp(CommandTest): +
[docs] def setUp(self): + super().setUp() + # we need to set up a logger here since lunr takes over the logger otherwise + import logging + + logging.basicConfig(level=logging.ERROR)
+ +
[docs] def tearDown(self): + super().tearDown() + import logging + + logging.disable(level=logging.ERROR)
+
[docs] def test_help(self): - self.call(help.CmdHelp(), "", "Command help entries", cmdset=CharacterCmdSet())
+ self.call(help.CmdHelp(), "", "Admin", cmdset=CharacterCmdSet())
[docs] def test_set_help(self): self.call( diff --git a/docs/0.9.5/_modules/evennia/commands/default/unloggedin.html b/docs/0.9.5/_modules/evennia/commands/default/unloggedin.html index 23b949ea3b..b4af40b12e 100644 --- a/docs/0.9.5/_modules/evennia/commands/default/unloggedin.html +++ b/docs/0.9.5/_modules/evennia/commands/default/unloggedin.html @@ -335,6 +335,7 @@ |wquit|n - abort the connection First create an account e.g. with |wcreate Anna c67jHL8p|n +(If you have spaces in your name, use double quotes: |wcreate "Anna the Barbarian" c67jHL8p|n Next you can connect to the game: |wconnect Anna c67jHL8p|n You can use the |wlook|n command if you want to see the connect screen again. diff --git a/docs/0.9.5/_modules/evennia/contrib/rpsystem.html b/docs/0.9.5/_modules/evennia/contrib/rpsystem.html index ccf7a921d7..b8f7146d72 100644 --- a/docs/0.9.5/_modules/evennia/contrib/rpsystem.html +++ b/docs/0.9.5/_modules/evennia/contrib/rpsystem.html @@ -324,7 +324,8 @@ the markers and a tuple (langname, saytext), where langname can be None. Raises: - rplanguage.LanguageError: If an invalid language was specified. + evennia.contrib.rpsystem.LanguageError: If an invalid language was + specified. Notes: Note that no errors are raised if the wrong language identifier diff --git a/docs/0.9.5/_modules/evennia/contrib/turnbattle/tb_range.html b/docs/0.9.5/_modules/evennia/contrib/turnbattle/tb_range.html index e6043e86f9..ef167d79dc 100644 --- a/docs/0.9.5/_modules/evennia/contrib/turnbattle/tb_range.html +++ b/docs/0.9.5/_modules/evennia/contrib/turnbattle/tb_range.html @@ -683,7 +683,6 @@ Args: to_init (object): Object to initialize range field for. - Keyword Args: anchor_obj (object): Object to copy range values from, or None for a random object. add_distance (int): Distance to put between to_init object and anchor object. diff --git a/docs/0.9.5/_modules/evennia/contrib/tutorial_world/intro_menu.html b/docs/0.9.5/_modules/evennia/contrib/tutorial_world/intro_menu.html index 706444a0b2..925f9a2599 100644 --- a/docs/0.9.5/_modules/evennia/contrib/tutorial_world/intro_menu.html +++ b/docs/0.9.5/_modules/evennia/contrib/tutorial_world/intro_menu.html @@ -473,8 +473,9 @@ and the main window. - Use |y<Return>|n (or click the arrow on the right) to send your input. -- Use |yShift + <up/down-arrow>|n to step back and forth in your command-history. -- Use |yShift + <Return>|n to add a new line to your input without sending. +- Use |yCtrl + <up/down-arrow>|n to step back and forth in your command-history. +- Use |yCtrl + <Return>|n to add a new line to your input without sending. +(Cmd instead of Ctrl-key on Macs) There is also some |wextra|n info to learn about customizing the webclient. diff --git a/docs/0.9.5/_modules/evennia/contrib/tutorial_world/mob.html b/docs/0.9.5/_modules/evennia/contrib/tutorial_world/mob.html index 4115af4819..8687437b25 100644 --- a/docs/0.9.5/_modules/evennia/contrib/tutorial_world/mob.html +++ b/docs/0.9.5/_modules/evennia/contrib/tutorial_world/mob.html @@ -110,7 +110,7 @@ stationary (idling) until attacked. aggressive: if set, will attack Characters in the same room using whatever Weapon it - carries (see tutorial_world.objects.Weapon). + carries (see tutorial_world.objects.TutorialWeapon). if unset, the mob will never engage in combat no matter what. hunting: if set, the mob will pursue enemies trying @@ -209,9 +209,9 @@ be "ticked". Args: - interval (int): The number of seconds + interval (int or None): The number of seconds between ticks - hook_key (str): The name of the method + hook_key (str or None): The name of the method (on this mob) to call every interval seconds. stop (bool, optional): Just stop the @@ -413,16 +413,11 @@ return # we use the same attack commands as defined in - # tutorial_world.objects.Weapon, assuming that + # tutorial_world.objects.TutorialWeapon, assuming that # the mob is given a Weapon to attack with. attack_cmd = random.choice(("thrust", "pierce", "stab", "slash", "chop")) self.execute_cmd("%s %s" % (attack_cmd, target)) - if target.db.health is None: - # This is not an attackable target - logger.log_err(f"{self.key} found {target} had an `health` attribute of `None`.") - return - # analyze the current state if target.db.health <= 0: # we reduced the target to <= 0 health. Move them to the diff --git a/docs/0.9.5/_modules/evennia/contrib/tutorial_world/objects.html b/docs/0.9.5/_modules/evennia/contrib/tutorial_world/objects.html index c84d0a7c8b..db3dab64d7 100644 --- a/docs/0.9.5/_modules/evennia/contrib/tutorial_world/objects.html +++ b/docs/0.9.5/_modules/evennia/contrib/tutorial_world/objects.html @@ -55,8 +55,8 @@ Obelisk LightSource CrumblingWall -Weapon -WeaponRack +TutorialWeapon +TutorialWeaponRack """ @@ -832,7 +832,7 @@ # ------------------------------------------------------------- # -# Weapon - object type +# TutorialWeapon - object type # # A weapon is necessary in order to fight in the tutorial # world. A weapon (which here is assumed to be a bladed @@ -972,7 +972,7 @@ self.add(CmdAttack())
-
[docs]class Weapon(TutorialObject): +
[docs]class TutorialWeapon(TutorialObject): """ This defines a bladed weapon. @@ -984,7 +984,7 @@ """ -
[docs] def at_object_creation(self): +
[docs] def at_object_creation(self): """Called at first creation of the object""" super().at_object_creation() self.db.hit = 0.4 # hit chance @@ -993,7 +993,7 @@ self.db.magic = False self.cmdset.add_default(CmdSetWeapon, permanent=True)
-
[docs] def reset(self): +
[docs] def reset(self): """ When reset, the weapon is simply deleted, unless it has a place to return to. @@ -1023,7 +1023,7 @@ WEAPON_PROTOTYPES = { "weapon": { - "typeclass": "evennia.contrib.tutorial_world.objects.Weapon", + "typeclass": "evennia.contrib.tutorial_world.objects.TutorialWeapon", "key": "Weapon", "hit": 0.2, "parry": 0.2, @@ -1168,7 +1168,7 @@ self.add(CmdGetWeapon())
-
[docs]class WeaponRack(TutorialObject): +
[docs]class TutorialWeaponRack(TutorialObject): """ This object represents a weapon store. When people use the "get weapon" command on this rack, it will produce one @@ -1185,7 +1185,7 @@ """ -
[docs] def at_object_creation(self): +
[docs] def at_object_creation(self): """ called at creation """ @@ -1204,7 +1204,7 @@ self.db.no_more_weapons_msg = "you find nothing else of use." self.db.available_weapons = ["knife", "dagger", "sword", "club"]
-
[docs] def produce_weapon(self, caller): +
[docs] def produce_weapon(self, caller): """ This will produce a new weapon from the rack, assuming the caller hasn't already gotten one. When diff --git a/docs/0.9.5/_modules/evennia/help/models.html b/docs/0.9.5/_modules/evennia/help/models.html index e7bf886807..db79c56666 100644 --- a/docs/0.9.5/_modules/evennia/help/models.html +++ b/docs/0.9.5/_modules/evennia/help/models.html @@ -114,7 +114,8 @@ db_tags = models.ManyToManyField( Tag, blank=True, - help_text="tags on this object. Tags are simple string markers to identify, group and alias objects.", + help_text="tags on this object. Tags are simple string markers to " + "identify, group and alias objects.", ) # (deprecated, only here to allow MUX helpfile load (don't use otherwise)). # TODO: remove this when not needed anymore. @@ -164,6 +165,19 @@ """ return self.locks.check(accessing_obj, access_type=access_type, default=default)
+ @property + def search_index_entry(self): + """ + Property for easily retaining a search index entry for this object. + """ + return { + "key": self.db_key, + "aliases": " ".join(self.aliases.all()), + "category": self.db_help_category, + "text": self.db_entrytext, + "tags": " ".join(str(tag) for tag in self.tags.all()), + } + # # Web/Django methods # diff --git a/docs/0.9.5/_modules/evennia/locks/lockfuncs.html b/docs/0.9.5/_modules/evennia/locks/lockfuncs.html index b7942694ee..9743b5569d 100644 --- a/docs/0.9.5/_modules/evennia/locks/lockfuncs.html +++ b/docs/0.9.5/_modules/evennia/locks/lockfuncs.html @@ -580,8 +580,6 @@ Only true if accessed_obj has the specified tag and optional category. """ - if hasattr(accessed_obj, "obj"): - accessed_obj = accessed_obj.obj tagkey = args[0] if args else None category = args[1] if len(args) > 1 else None return bool(accessed_obj.tags.get(tagkey, category=category))
@@ -613,9 +611,6 @@ in your inventory will also pass the lock). """ - if hasattr(accessed_obj, "obj"): - accessed_obj = accessed_obj.obj - def _recursive_inside(obj, accessed_obj, lvl=1): if obj.location: if obj.location == accessed_obj: diff --git a/docs/0.9.5/_modules/evennia/objects/models.html b/docs/0.9.5/_modules/evennia/objects/models.html index 5aa38956f6..2caa92c4b7 100644 --- a/docs/0.9.5/_modules/evennia/objects/models.html +++ b/docs/0.9.5/_modules/evennia/objects/models.html @@ -54,6 +54,7 @@ the database object. Like everything else, they can be accessed transparently through the decorating TypeClass. """ +from collections import defaultdict from django.conf import settings from django.db import models from django.core.exceptions import ObjectDoesNotExist @@ -83,34 +84,49 @@ """ self.obj = obj - self._pkcache = {} + self._pkcache = set() self._idcache = obj.__class__.__instance_cache__ + self._typecache = defaultdict(set) self.init()
+
[docs] def load(self): + """ + Retrieves all objects from database. Used for initializing. + + Returns: + Objects (list of ObjectDB) + """ + return list(self.obj.locations_set.all())
+
[docs] def init(self): """ Re-initialize the content cache """ - self._pkcache.update( - dict((obj.pk, None) for obj in ObjectDB.objects.filter(db_location=self.obj) if obj.pk) - )
+ objects = self.load() + self._pkcache = {obj.pk for obj in objects} + for obj in objects: + for ctype in obj._content_types: + self._typecache[ctype].add(obj.pk)
-
[docs] def get(self, exclude=None): +
[docs] def get(self, exclude=None, content_type=None): """ Return the contents of the cache. Args: exclude (Object or list of Object): object(s) to ignore + content_type (str or None): Filter list by a content-type. If None, don't filter. Returns: objects (list): the Objects inside this location """ - if exclude: - pks = [pk for pk in self._pkcache if pk not in [excl.pk for excl in make_iter(exclude)]] + if content_type is not None: + pks = self._typecache[content_type] else: pks = self._pkcache + if exclude: + pks = pks - {excl.pk for excl in make_iter(exclude)} try: return [self._idcache[pk] for pk in pks] except KeyError: @@ -120,10 +136,9 @@ try: return [self._idcache[pk] for pk in pks] except KeyError: - # this means the central instance_cache was totally flushed. - # Re-fetching from database will rebuild the necessary parts of the cache - # for next fetch. - return list(ObjectDB.objects.filter(db_location=self.obj))
+ # this means an actual failure of caching. Return real database match. + logger.log_err("contents cache failed for %s." % self.obj.key) + return self.load()
[docs] def add(self, obj): """ @@ -133,7 +148,9 @@ obj (Object): object to add """ - self._pkcache[obj.pk] = None
+ self._pkcache.add(obj.pk) + for ctype in obj._content_types: + self._typecache[ctype].add(obj.pk)
[docs] def remove(self, obj): """ @@ -143,7 +160,10 @@ obj (Object): object to remove """ - self._pkcache.pop(obj.pk, None)
+ self._pkcache.remove(obj.pk) + for ctype in obj._content_types: + if obj.pk in self._typecache[ctype]: + self._typecache[ctype].remove(obj.pk)
[docs] def clear(self): """ @@ -151,6 +171,7 @@ """ self._pkcache = {} + self._typecache = defaultdict(set) self.init()
diff --git a/docs/0.9.5/_modules/evennia/objects/objects.html b/docs/0.9.5/_modules/evennia/objects/objects.html index 16adaba36e..158162ed4a 100644 --- a/docs/0.9.5/_modules/evennia/objects/objects.html +++ b/docs/0.9.5/_modules/evennia/objects/objects.html @@ -53,7 +53,7 @@ from django.conf import settings from evennia.typeclasses.models import TypeclassBase -from evennia.typeclasses.attributes import NickHandler +from evennia.typeclasses.attributes import NickHandler, ModelAttributeBackend from evennia.objects.manager import ObjectManager from evennia.objects.models import ObjectDB from evennia.scripts.scripthandler import ScriptHandler @@ -245,6 +245,9 @@ """ + # Used for sorting / filtering in inventories / room contents. + _content_types = ("object",) + # lockstring of newly created objects, for easy overloading. # Will be formatted with the appropriate attributes. lockstring = "control:id({account_id}) or perm(Admin);delete:id({account_id}) or perm(Admin)" @@ -263,7 +266,7 @@
[docs] @lazy_property def nicks(self): - return NickHandler(self)
+ return NickHandler(self, ModelAttributeBackend)
[docs] @lazy_property def sessions(self): @@ -298,7 +301,7 @@ and not self.db_account.attributes.get("_quell") ) -
[docs] def contents_get(self, exclude=None): +
[docs] def contents_get(self, exclude=None, content_type=None): """ Returns the contents of this object, i.e. all objects that has this object set as its location. @@ -307,17 +310,18 @@ Args: exclude (Object): Object to exclude from returned contents list + content_type (str): A content_type to filter by. None for no + filtering. Returns: contents (list): List of contents of this Object. Notes: - Also available as the `contents` property. + Also available as the `contents` property, minus exclusion + and filtering. """ - con = self.contents_cache.get(exclude=exclude) - # print "contents_get:", self, con, id(self), calledby() # DEBUG - return con
+ return self.contents_cache.get(exclude=exclude, content_type=content_type)
[docs] def contents_set(self, *args): "You cannot replace this property" @@ -413,6 +417,7 @@ nofound_string=None, multimatch_string=None, use_dbref=None, + stacked=0, ): """ Returns an Object matching a search string/condition @@ -468,10 +473,19 @@ will be treated like a normal string. If `None` (default), the ability to query by #dbref is turned on if `self` has the permission 'Builder' and is turned off otherwise. + stacked (int, optional): If > 0, multimatches will be analyzed to determine if they + only contains identical objects; these are then assumed 'stacked' and no multi-match + error will be generated, instead `stacked` number of matches will be returned. If + `stacked` is larger than number of matches, returns that number of matches. If + the found stack is a mix of objects, return None and handle the multi-match + error depending on the value of `quiet`. Returns: - match (Object, None or list): will return an Object/None if `quiet=False`, - otherwise it will return a list of 0, 1 or more matches. + Object: If finding a match an `quiet=False` + None: If not finding a unique match and `quiet=False`. + list: With 0, 1 or more matching objects if `quiet=True` + list: With 2 or more matching objects if `stacked` is a positive integer and + the matched stack has only object-copies. Notes: To find Accounts, use eg. `evennia.account_search`. If @@ -539,8 +553,29 @@ use_dbref=use_dbref, ) + nresults = len(results) + if stacked > 0 and nresults > 1: + # handle stacks, disable multimatch errors + nstack = nresults + if not exact: + # we re-run exact match agains one of the matches to + # make sure we were not catching partial matches not belonging + # to the stack + nstack = len(ObjectDB.objects.get_objs_with_key_or_alias( + results[0].key, + exact=True, + candidates=list(results), + typeclasses=[typeclass] if typeclass else None + )) + if nstack == nresults: + # a valid stack, return multiple results + return list(results)[:stacked] + if quiet: + # don't auto-handle error messaging return list(results) + + # handle error messages return _AT_SEARCH_RESULT( results, self, @@ -1697,20 +1732,26 @@ **kwargs (dict): Arbitrary, optional arguments for users overriding the call (unused by default). """ + + def filter_visible(obj_list): + # Helper method to determine if objects are visible to the looker. + return [obj for obj in obj_list if obj != looker and obj.access(looker, "view")] + if not looker: return "" + # get and identify all objects - visible = (con for con in self.contents if con != looker and con.access(looker, "view")) - exits, users, things = [], [], defaultdict(list) - for con in visible: - key = con.get_display_name(looker) - if con.destination: - exits.append(key) - elif con.has_account: - users.append("|c%s|n" % key) - else: - # things can be pluralized - things[key].append(con) + exits_list = filter_visible(self.contents_get(content_type="exit")) + users_list = filter_visible(self.contents_get(content_type="character")) + things_list = filter_visible(self.contents_get(content_type="object")) + + things = defaultdict(list) + + for thing in things_list: + things[thing.key].append(thing) + users = [f"|c{user.key}|n" for user in users_list] + exits = [ex.key for ex in exits_list] + # get description, build string string = "|c%s|n\n" % self.get_display_name(looker) desc = self.db.desc @@ -2068,6 +2109,9 @@ """ + # Tuple of types used for indexing inventory contents. Characters generally wouldn't be in + # anyone's inventory, but this also governs displays in room contents. + _content_types = ("character",) # lockstring of newly created rooms, for easy overloading. # Will be formatted with the appropriate attributes. lockstring = ( @@ -2107,6 +2151,13 @@ # If no typeclass supplied, use this class kwargs["typeclass"] = kwargs.pop("typeclass", cls) + # Normalize to latin characters and validate, if necessary, the supplied key + key = cls.normalize_name(key) + + if not cls.validate_name(key): + errors.append("Invalid character name.") + return obj, errors + # Set the supplied key as the name of the intended object kwargs["key"] = key @@ -2156,6 +2207,38 @@ return obj, errors
+
[docs] @classmethod + def normalize_name(cls, name): + """ + Normalize the character name prior to creating. Note that this should be refactored + to support i18n for non-latin scripts, but as we (currently) have no bug reports requesting better + support of non-latin character sets, requiring character names to be latinified is an acceptable option. + + Args: + name (str) : The name of the character + + Returns: + latin_name (str) : A valid name. + """ + + from evennia.utils.utils import latinify + + latin_name = latinify(name, default="X") + return latin_name
+ +
[docs] @classmethod + def validate_name(cls, name): + """ Validate the character name prior to creating. Overload this function to add custom validators + + Args: + name (str) : The name of the character + Returns: + valid (bool) : True if character creation should continue; False if it should fail + + """ + + return True # Default validator does not perform any operations
+
[docs] def basetype_setup(self): """ Setup character-specific security. @@ -2284,6 +2367,10 @@ location is always `None`. """ + # A tuple of strings used for indexing this object inside an inventory. + # Generally, a room isn't expected to HAVE a location, but maybe in some games? + _content_types = ("room",) + # lockstring of newly created rooms, for easy overloading. # Will be formatted with the {id} of the creating object. lockstring = ( @@ -2443,6 +2530,7 @@ """ + _content_types = ("exit",) exit_command = ExitCommand priority = 101 diff --git a/docs/0.9.5/_modules/evennia/server/amp_client.html b/docs/0.9.5/_modules/evennia/server/amp_client.html index b997e5a11c..5e68c4930e 100644 --- a/docs/0.9.5/_modules/evennia/server/amp_client.html +++ b/docs/0.9.5/_modules/evennia/server/amp_client.html @@ -46,9 +46,11 @@ """ import os +from django.conf import settings from evennia.server.portal import amp from twisted.internet import protocol from evennia.utils import logger +from evennia.utils.utils import class_from_module
[docs]class AMPClientFactory(protocol.ReconnectingClientFactory): @@ -74,7 +76,7 @@ """ self.server = server - self.protocol = AMPServerClientProtocol + self.protocol = class_from_module(settings.AMP_CLIENT_PROTOCOL_CLASS) self.maxDelay = 10 # not really used unless connecting to multiple servers, but # avoids having to check for its existence on the protocol diff --git a/docs/0.9.5/_modules/evennia/server/inputfuncs.html b/docs/0.9.5/_modules/evennia/server/inputfuncs.html index 330cf2aa50..fdbef11188 100644 --- a/docs/0.9.5/_modules/evennia/server/inputfuncs.html +++ b/docs/0.9.5/_modules/evennia/server/inputfuncs.html @@ -528,7 +528,6 @@ Keyword Args: <option name>: an option to save - """ account = session.account diff --git a/docs/0.9.5/_modules/evennia/server/portal/amp.html b/docs/0.9.5/_modules/evennia/server/portal/amp.html index 77e0764566..0f751a2ed6 100644 --- a/docs/0.9.5/_modules/evennia/server/portal/amp.html +++ b/docs/0.9.5/_modules/evennia/server/portal/amp.html @@ -56,7 +56,7 @@ import pickle from twisted.internet.defer import DeferredList, Deferred -from evennia.utils.utils import to_str, variable_from_module +from evennia.utils.utils import variable_from_module # delayed import _LOGGER = None diff --git a/docs/0.9.5/_modules/evennia/server/portal/amp_server.html b/docs/0.9.5/_modules/evennia/server/portal/amp_server.html index caa7308fcb..664a59f69a 100644 --- a/docs/0.9.5/_modules/evennia/server/portal/amp_server.html +++ b/docs/0.9.5/_modules/evennia/server/portal/amp_server.html @@ -52,6 +52,7 @@ from django.conf import settings from subprocess import Popen, STDOUT from evennia.utils import logger +from evennia.utils.utils import class_from_module def _is_windows(): @@ -97,7 +98,7 @@ """ self.portal = portal - self.protocol = AMPServerProtocol + self.protocol = class_from_module(settings.AMP_SERVER_PROTOCOL_CLASS) self.broadcasts = [] self.server_connection = None self.launcher_connection = None @@ -115,7 +116,7 @@ protocol (Protocol): The created protocol. """ - self.portal.amp_protocol = AMPServerProtocol() + self.portal.amp_protocol = self.protocol() self.portal.amp_protocol.factory = self return self.portal.amp_protocol
diff --git a/docs/0.9.5/_modules/evennia/server/portal/portal.html b/docs/0.9.5/_modules/evennia/server/portal/portal.html index 4e95eaa721..d190355b63 100644 --- a/docs/0.9.5/_modules/evennia/server/portal/portal.html +++ b/docs/0.9.5/_modules/evennia/server/portal/portal.html @@ -68,7 +68,7 @@ evennia._init() -from evennia.utils.utils import get_evennia_version, mod_import, make_iter +from evennia.utils.utils import get_evennia_version, mod_import, make_iter, class_from_module from evennia.server.portal.portalsessionhandler import PORTAL_SESSIONS from evennia.utils import logger from evennia.server.webserver import EvenniaReverseProxyResource @@ -327,6 +327,8 @@ from evennia.server.portal import telnet + _telnet_protocol = class_from_module(settings.TELNET_PROTOCOL_CLASS) + for interface in TELNET_INTERFACES: ifacestr = "" if interface not in ("0.0.0.0", "::") or len(TELNET_INTERFACES) > 1: @@ -335,7 +337,7 @@ pstring = "%s:%s" % (ifacestr, port) factory = telnet.TelnetServerFactory() factory.noisy = False - factory.protocol = telnet.TelnetProtocol + factory.protocol = _telnet_protocol factory.sessionhandler = PORTAL_SESSIONS telnet_service = internet.TCPServer(port, factory, interface=interface) telnet_service.setName("EvenniaTelnet%s" % pstring) @@ -350,6 +352,8 @@ from evennia.server.portal import telnet_ssl + _ssl_protocol = class_from_module(settings.SSL_PROTOCOL_CLASS) + for interface in SSL_INTERFACES: ifacestr = "" if interface not in ("0.0.0.0", "::") or len(SSL_INTERFACES) > 1: @@ -359,7 +363,7 @@ factory = protocol.ServerFactory() factory.noisy = False factory.sessionhandler = PORTAL_SESSIONS - factory.protocol = telnet_ssl.SSLProtocol + factory.protocol = _ssl_protocol ssl_context = telnet_ssl.getSSLContext() if ssl_context: @@ -383,6 +387,8 @@ from evennia.server.portal import ssh + _ssh_protocol = class_from_module(settings.SSH_PROTOCOL_CLASS) + for interface in SSH_INTERFACES: ifacestr = "" if interface not in ("0.0.0.0", "::") or len(SSH_INTERFACES) > 1: @@ -390,11 +396,7 @@ for port in SSH_PORTS: pstring = "%s:%s" % (ifacestr, port) factory = ssh.makeFactory( - { - "protocolFactory": ssh.SshProtocol, - "protocolArgs": (), - "sessions": PORTAL_SESSIONS, - } + {"protocolFactory": _ssh_protocol, "protocolArgs": (), "sessions": PORTAL_SESSIONS,} ) factory.noisy = False ssh_service = internet.TCPServer(port, factory, interface=interface) @@ -410,6 +412,7 @@ # Start a reverse proxy to relay data to the Server-side webserver websocket_started = False + _websocket_protocol = class_from_module(settings.WEBSOCKET_PROTOCOL_CLASS) for interface in WEBSERVER_INTERFACES: ifacestr = "" if interface not in ("0.0.0.0", "::") or len(WEBSERVER_INTERFACES) > 1: @@ -444,7 +447,7 @@ factory = Websocket() factory.noisy = False - factory.protocol = webclient.WebSocketClient + factory.protocol = _websocket_protocol factory.sessionhandler = PORTAL_SESSIONS websocket_service = internet.TCPServer(port, factory, interface=w_interface) websocket_service.setName("EvenniaWebSocket%s:%s" % (w_ifacestr, port)) diff --git a/docs/0.9.5/_modules/evennia/server/portal/portalsessionhandler.html b/docs/0.9.5/_modules/evennia/server/portal/portalsessionhandler.html index 9aa10be81f..91be8bf870 100644 --- a/docs/0.9.5/_modules/evennia/server/portal/portalsessionhandler.html +++ b/docs/0.9.5/_modules/evennia/server/portal/portalsessionhandler.html @@ -48,8 +48,10 @@ from collections import deque, namedtuple from twisted.internet import reactor from django.conf import settings -from evennia.server.sessionhandler import SessionHandler, PCONN, PDISCONN, PCONNSYNC, PDISCONNALL +from evennia.server.sessionhandler import SessionHandler +from evennia.server.portal.amp import PCONN, PDISCONN, PCONNSYNC, PDISCONNALL from evennia.utils.logger import log_trace +from evennia.utils.utils import class_from_module # module import _MOD_IMPORT = None @@ -109,6 +111,19 @@ """ self.connection_time = time.time()
+
[docs] def generate_sessid(self): + """ + Simply generates a sessid that's guaranteed to be unique for this Portal run. + + Returns: + sessid + + """ + self.latest_sessid += 1 + if self.latest_sessid in self: + return self.generate_sessid() + return self.latest_sessid
+
[docs] def connect(self, session): """ Called by protocol at first connect. This adds a not-yet @@ -132,8 +147,7 @@ if not session.sessid: # if the session already has a sessid (e.g. being inherited in the # case of a webclient auto-reconnect), keep it - self.latest_sessid += 1 - session.sessid = self.latest_sessid + session.sessid = self.generate_sessid() session.server_connected = False _CONNECTION_QUEUE.appendleft(session) if len(_CONNECTION_QUEUE) > 1: @@ -504,7 +518,9 @@ log_trace()
-PORTAL_SESSIONS = PortalSessionHandler() +_PORTAL_SESSION_HANDLER_CLASS = class_from_module(settings.PORTAL_SESSION_HANDLER_CLASS) + +PORTAL_SESSIONS = _PORTAL_SESSION_HANDLER_CLASS()
diff --git a/docs/0.9.5/_modules/evennia/server/portal/ssh.html b/docs/0.9.5/_modules/evennia/server/portal/ssh.html index 9e43ed66d9..5dbf39cfd7 100644 --- a/docs/0.9.5/_modules/evennia/server/portal/ssh.html +++ b/docs/0.9.5/_modules/evennia/server/portal/ssh.html @@ -84,10 +84,9 @@ from twisted.python import components from django.conf import settings -from evennia.server import session from evennia.accounts.models import AccountDB from evennia.utils import ansi -from evennia.utils.utils import to_str +from evennia.utils.utils import to_str, class_from_module _RE_N = re.compile(r"\|n$") _RE_SCREENREADER_REGEX = re.compile( @@ -115,6 +114,8 @@ _PRIVATE_KEY_FILE, _PUBLIC_KEY_FILE ) +_BASE_SESSION_CLASS = class_from_module(settings.BASE_SESSION_CLASS) + # not used atm
[docs]class SSHServerFactory(protocol.ServerFactory): @@ -125,7 +126,7 @@ return "SSH"
-
[docs]class SshProtocol(Manhole, session.Session): +
[docs]class SshProtocol(Manhole, _BASE_SESSION_CLASS): """ Each account connecting over ssh gets this protocol assigned to them. All communication between game and account goes through @@ -318,18 +319,18 @@ text (str): The first argument is always the text string to send. No other arguments are considered. Keyword Args: - options (dict): Send-option flags: + options (dict): Send-option flags (booleans) - - mxp: Enforce MXP link support. - - ansi: Enforce no ANSI colors. - - xterm256: Enforce xterm256 colors, regardless of TTYPE setting. - - nocolor: Strip all colors. - - raw: Pass string through without any ansi processing - (i.e. include Evennia ansi markers but do not + - mxp: enforce mxp link support. + - ansi: enforce no ansi colors. + - xterm256: enforce xterm256 colors, regardless of ttype setting. + - nocolor: strip all colors. + - raw: pass string through without any ansi processing + (i.e. include evennia ansi markers but do not convert them into ansi tokens) - - echo: Turn on/off line echo on the client. Turn + - echo: turn on/off line echo on the client. turn off line echo for client, for example for password. - Note that it must be actively turned back on again! + note that it must be actively turned back on again! """ # print "telnet.send_text", args,kwargs # DEBUG diff --git a/docs/0.9.5/_modules/evennia/server/portal/ssl.html b/docs/0.9.5/_modules/evennia/server/portal/ssl.html index 161644b900..8ea08bd247 100644 --- a/docs/0.9.5/_modules/evennia/server/portal/ssl.html +++ b/docs/0.9.5/_modules/evennia/server/portal/ssl.html @@ -59,7 +59,7 @@ raise ImportError(errstr.format(err=error)) from django.conf import settings -from evennia.server.portal.telnet import TelnetProtocol +from evennia.utils.utils import class_from_module _GAME_DIR = settings.GAME_DIR @@ -84,8 +84,10 @@ {exestring} """ +_TELNET_PROTOCOL_CLASS = class_from_module(settings.TELNET_PROTOCOL_CLASS) -
[docs]class SSLProtocol(TelnetProtocol): + +
[docs]class SSLProtocol(_TELNET_PROTOCOL_CLASS): """ Communication is the same as telnet, except data transfer is done with encryption. diff --git a/docs/0.9.5/_modules/evennia/server/portal/telnet.html b/docs/0.9.5/_modules/evennia/server/portal/telnet.html index 133f7eb08b..2ff272b22d 100644 --- a/docs/0.9.5/_modules/evennia/server/portal/telnet.html +++ b/docs/0.9.5/_modules/evennia/server/portal/telnet.html @@ -66,12 +66,11 @@ LINEMODE_TRAPSIG, ) from django.conf import settings -from evennia.server.session import Session from evennia.server.portal import ttype, mssp, telnet_oob, naws, suppress_ga from evennia.server.portal.mccp import Mccp, mccp_compress, MCCP from evennia.server.portal.mxp import Mxp, mxp_parse from evennia.utils import ansi -from evennia.utils.utils import to_bytes +from evennia.utils.utils import to_bytes, class_from_module _RE_N = re.compile(r"\|n$") _RE_LEND = re.compile(br"\n$|\r$|\r\n$|\r\x00$|", re.MULTILINE) @@ -97,6 +96,9 @@ ) +_BASE_SESSION_CLASS = class_from_module(settings.BASE_SESSION_CLASS) + +
[docs]class TelnetServerFactory(protocol.ServerFactory): "This is only to name this better in logs" noisy = False @@ -105,7 +107,7 @@ return "Telnet"
-
[docs]class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session): +
[docs]class TelnetProtocol(Telnet, StatefulTelnetProtocol, _BASE_SESSION_CLASS): """ Each player connecting over telnet (ie using most traditional mud clients) gets a telnet protocol instance assigned to them. All @@ -429,19 +431,19 @@ text (str): The first argument is always the text string to send. No other arguments are considered. Keyword Args: - options (dict): Send-option flags: + options (dict): Send-option flags - - mxp: Enforce MXP link support. - - ansi: Enforce no ANSI colors. - - xterm256: Enforce xterm256 colors, regardless of TTYPE. - - noxterm256: Enforce no xterm256 color support, regardless of TTYPE. - - nocolor: Strip all Color, regardless of ansi/xterm256 setting. - - raw: Pass string through without any ansi processing - (i.e. include Evennia ansi markers but do not - convert them into ansi tokens) - - echo: Turn on/off line echo on the client. Turn - off line echo for client, for example for password. - Note that it must be actively turned back on again! + - mxp: Enforce MXP link support. + - ansi: Enforce no ANSI colors. + - xterm256: Enforce xterm256 colors, regardless of TTYPE. + - noxterm256: Enforce no xterm256 color support, regardless of TTYPE. + - nocolor: Strip all Color, regardless of ansi/xterm256 setting. + - raw: Pass string through without any ansi processing + (i.e. include Evennia ansi markers but do not + convert them into ansi tokens) + - echo: Turn on/off line echo on the client. Turn + off line echo for client, for example for password. + Note that it must be actively turned back on again! """ text = args[0] if args else "" diff --git a/docs/0.9.5/_modules/evennia/server/portal/telnet_oob.html b/docs/0.9.5/_modules/evennia/server/portal/telnet_oob.html index 59e8d16a6c..2b8d0a7910 100644 --- a/docs/0.9.5/_modules/evennia/server/portal/telnet_oob.html +++ b/docs/0.9.5/_modules/evennia/server/portal/telnet_oob.html @@ -51,21 +51,16 @@ instruct the client to play sounds or to update a graphical health bar. -> Note that in Evennia's Web client, all send commands are "OOB commands", -(including the "text" one), there is no equivalence to MSDP/GMCP for the -webclient since it doesn't need it. +Note that in Evennia's Web client, all send commands are "OOB +commands", (including the "text" one), there is no equivalence to +MSDP/GMCP for the webclient since it doesn't need it. This implements the following telnet OOB communication protocols: -- MSDP (Mud Server Data Protocol), as per - http://tintin.sourceforge.net/msdp/ +- MSDP (Mud Server Data Protocol), as per http://tintin.sourceforge.net/msdp/ - GMCP (Generic Mud Communication Protocol) as per http://www.ironrealms.com/rapture/manual/files/FeatGMCP-txt.html#Generic_MUD_Communication_Protocol%28GMCP%29 -Following the lead of KaVir's protocol snippet, we first check if client -supports MSDP and if not, we fallback to GMCP with a MSDP header where -applicable. - ---- """ @@ -202,16 +197,16 @@ MSDP structures on these forms: :: - [cmdname, [], {}] -> VAR cmdname VAL "" - [cmdname, [arg], {}] -> VAR cmdname VAL arg - [cmdname, [args],{}] -> VAR cmdname VAL ARRAYOPEN VAL arg VAL arg ... ARRAYCLOSE - [cmdname, [], {kwargs}] -> VAR cmdname VAL TABLEOPEN VAR key VAL val ... TABLECLOSE + [cmdname, [], {}] -> VAR cmdname VAL "" + [cmdname, [arg], {}] -> VAR cmdname VAL arg + [cmdname, [args],{}] -> VAR cmdname VAL ARRAYOPEN VAL arg VAL arg ... ARRAYCLOSE + [cmdname, [], {kwargs}] -> VAR cmdname VAL TABLEOPEN VAR key VAL val ... TABLECLOSE [cmdname, [args], {kwargs}] -> VAR cmdname VAL ARRAYOPEN VAL arg VAL arg ... ARRAYCLOSE VAR cmdname VAL TABLEOPEN VAR key VAL val ... TABLECLOSE - Further nesting is not supported, so if an array argument consists - of an array (for example), that array will be json-converted to a - string. + Further nesting is not supported, so if an array argument + consists of an array (for example), that array will be + json-converted to a string. """ msdp_cmdname = "{msdp_var}{msdp_cmdname}{msdp_val}".format( @@ -281,11 +276,10 @@ [cmd.name, [arg], {}] -> Cmd.Name arg [cmd.name, [args],{}] -> Cmd.Name [args] [cmd.name, [], {kwargs}] -> Cmd.Name {kwargs} - [cmdname, [args, {kwargs}] -> Core.Cmdname [[args],{kwargs}] + [cmdname, [args, {kwargs}] -> Core.Cmdname [[args],{kwargs}] Notes: - There are also a few default mappings between evennia outputcmds and - GMCP: + There are also a few default mappings between evennia outputcmds and GMCP: :: client_options -> Core.Supports.Get diff --git a/docs/0.9.5/_modules/evennia/server/portal/webclient.html b/docs/0.9.5/_modules/evennia/server/portal/webclient.html index d0d95206a6..67ee7a41bc 100644 --- a/docs/0.9.5/_modules/evennia/server/portal/webclient.html +++ b/docs/0.9.5/_modules/evennia/server/portal/webclient.html @@ -58,10 +58,8 @@ import re import json import html -from twisted.internet.protocol import Protocol from django.conf import settings -from evennia.server.session import Session -from evennia.utils.utils import to_str, mod_import +from evennia.utils.utils import mod_import, class_from_module from evennia.utils.ansi import parse_ansi from evennia.utils.text2html import parse_html from autobahn.twisted.websocket import WebSocketServerProtocol @@ -81,10 +79,10 @@ # called when the browser is navigating away from the page GOING_AWAY = WebSocketServerProtocol.CLOSE_STATUS_CODE_GOING_AWAY -STATE_CLOSING = WebSocketServerProtocol.STATE_CLOSING +_BASE_SESSION_CLASS = class_from_module(settings.BASE_SESSION_CLASS) -
[docs]class WebSocketClient(WebSocketServerProtocol, Session): +
[docs]class WebSocketClient(WebSocketServerProtocol, _BASE_SESSION_CLASS): """ Implements the server-side of the Websocket connection. """ @@ -298,8 +296,6 @@ return else: return - # just to be sure - text = to_str(text) flags = self.protocol_flags diff --git a/docs/0.9.5/_modules/evennia/server/profiling/dummyrunner_settings.html b/docs/0.9.5/_modules/evennia/server/profiling/dummyrunner_settings.html index f420e75626..765d885f5a 100644 --- a/docs/0.9.5/_modules/evennia/server/profiling/dummyrunner_settings.html +++ b/docs/0.9.5/_modules/evennia/server/profiling/dummyrunner_settings.html @@ -47,15 +47,15 @@ The settings are global variables: -TIMESTEP - time in seconds between each 'tick' -CHANCE_OF_ACTION - chance 0-1 of action happening -CHANCE_OF_LOGIN - chance 0-1 of login happening -TELNET_PORT - port to use, defaults to settings.TELNET_PORT -ACTIONS - see below +- TIMESTEP - time in seconds between each 'tick' +- CHANCE_OF_ACTION - chance 0-1 of action happening +- CHANCE_OF_LOGIN - chance 0-1 of login happening +- TELNET_PORT - port to use, defaults to settings.TELNET_PORT +- ACTIONS - see below ACTIONS is a tuple -``` +```python (login_func, logout_func, (0.3, func1), (0.1, func2) ... ) ``` @@ -78,14 +78,14 @@ The client object has the following relevant properties and methods: - key - an optional client key. This is only used for dummyrunner output. - Default is "Dummy-<cid>" + Default is "Dummy-<cid>" - cid - client id - gid - globally unique id, hashed with time stamp - istep - the current step - exits - an empty list. Can be used to store exit names - objs - an empty list. Can be used to store object names - counter() - returns a unique increasing id, hashed with time stamp - to make it unique also between dummyrunner instances. + to make it unique also between dummyrunner instances. The return should either be a single command string or a tuple of command strings. This list of commands will always be executed every @@ -93,7 +93,7 @@ (no randomness) and allows for setting up a more complex chain of commands (such as creating an account and logging in). ---- +---- """ # Dummy runner settings diff --git a/docs/0.9.5/_modules/evennia/server/server.html b/docs/0.9.5/_modules/evennia/server/server.html index 9e5151a12e..237e9920f6 100644 --- a/docs/0.9.5/_modules/evennia/server/server.html +++ b/docs/0.9.5/_modules/evennia/server/server.html @@ -40,12 +40,12 @@

Source code for evennia.server.server

 """
-This module implements the main Evennia server process, the core of
-the game engine.
+This module implements the main Evennia server process, the core of the game
+engine.
 
-This module should be started with the 'twistd' executable since it
-sets up all the networking features.  (this is done automatically
-by evennia/server/server_runner.py).
+This module should be started with the 'twistd' executable since it sets up all
+the networking features.  (this is done automatically by
+evennia/server/server_runner.py).
 
 """
 import time
@@ -63,6 +63,7 @@
 django.setup()
 
 import evennia
+import importlib
 
 evennia._init()
 
@@ -72,7 +73,6 @@
 from evennia.accounts.models import AccountDB
 from evennia.scripts.models import ScriptDB
 from evennia.server.models import ServerConfig
-from evennia.server import initial_setup
 
 from evennia.utils.utils import get_evennia_version, mod_import, make_iter
 from evennia.utils import logger
@@ -382,6 +382,7 @@
         Once finished the last_initial_setup_step is set to -1.
         """
         global INFO_DICT
+        initial_setup = importlib.import_module(settings.INITIAL_SETUP_MODULE)
         last_initial_setup_step = ServerConfig.objects.conf("last_initial_setup_step")
         if not last_initial_setup_step:
             # None is only returned if the config does not exist,
@@ -440,18 +441,17 @@
         """
         Shuts down the server from inside it.
 
-        Keyword Args:
-            mode (str): Sets the server restart mode:
-            - 'reload': server restarts, no "persistent" scripts
-              are stopped, at_reload hooks called.
-            - 'reset' - server restarts, non-persistent scripts stopped,
-              at_shutdown hooks called but sessions will not
-              be disconnected.
-            -'shutdown' - like reset, but server will not auto-restart.
-            _reactor_stopping: This is set if server is stopped by a kill
-                command OR this method was already called
-                once - in both cases the reactor is dead/stopping already.
-
+        mode - sets the server restart mode.
+           - 'reload' - server restarts, no "persistent" scripts
+             are stopped, at_reload hooks called.
+           - 'reset' - server restarts, non-persistent scripts stopped,
+             at_shutdown hooks called but sessions will not
+             be disconnected.
+           - 'shutdown' - like reset, but server will not auto-restart.
+        _reactor_stopping - this is set if server is stopped by a kill
+           command OR this method was already called
+           once - in both cases the reactor is
+           dead/stopping already.
         """
         if _reactor_stopping and hasattr(self, "shutdown_complete"):
             # this means we have already passed through this method
diff --git a/docs/0.9.5/_modules/evennia/server/serversession.html b/docs/0.9.5/_modules/evennia/server/serversession.html
index d93037930a..ce95a5bccd 100644
--- a/docs/0.9.5/_modules/evennia/server/serversession.html
+++ b/docs/0.9.5/_modules/evennia/server/serversession.html
@@ -47,7 +47,6 @@
 It is stored on the Server side (as opposed to protocol-specific sessions which
 are stored on the Portal side)
 """
-import weakref
 import time
 from django.utils import timezone
 from django.conf import settings
@@ -57,6 +56,7 @@
 from evennia.commands.cmdsethandler import CmdSetHandler
 from evennia.server.session import Session
 from evennia.scripts.monitorhandler import MONITOR_HANDLER
+from evennia.typeclasses.attributes import AttributeHandler, InMemoryAttributeBackend, DbHolder
 
 _GA = object.__getattribute__
 _SA = object.__setattr__
@@ -66,124 +66,6 @@
 # i18n
 from django.utils.translation import gettext as _
 
-# Handlers for Session.db/ndb operation
-
-
-
[docs]class NDbHolder(object): - """Holder for allowing property access of attributes""" - -
[docs] def __init__(self, obj, name, manager_name="attributes"): - _SA(self, name, _GA(obj, manager_name)) - _SA(self, "name", name)
- - def __getattribute__(self, attrname): - if attrname == "all": - # we allow to overload our default .all - attr = _GA(self, _GA(self, "name")).get("all") - return attr if attr else _GA(self, "all") - return _GA(self, _GA(self, "name")).get(attrname) - - def __setattr__(self, attrname, value): - _GA(self, _GA(self, "name")).add(attrname, value) - - def __delattr__(self, attrname): - _GA(self, _GA(self, "name")).remove(attrname) - -
[docs] def get_all(self): - return _GA(self, _GA(self, "name")).all()
- - all = property(get_all)
- - -
[docs]class NAttributeHandler(object): - """ - NAttributeHandler version without recache protection. - This stand-alone handler manages non-database saving. - It is similar to `AttributeHandler` and is used - by the `.ndb` handler in the same way as `.db` does - for the `AttributeHandler`. - """ - -
[docs] def __init__(self, obj): - """ - Initialized on the object - """ - self._store = {} - self.obj = weakref.proxy(obj)
- -
[docs] def has(self, key): - """ - Check if object has this attribute or not. - - Args: - key (str): The Nattribute key to check. - - Returns: - has_nattribute (bool): If Nattribute is set or not. - - """ - return key in self._store
- -
[docs] def get(self, key, default=None): - """ - Get the named key value. - - Args: - key (str): The Nattribute key to get. - - Returns: - the value of the Nattribute. - - """ - return self._store.get(key, default)
- -
[docs] def add(self, key, value): - """ - Add new key and value. - - Args: - key (str): The name of Nattribute to add. - value (any): The value to store. - - """ - self._store[key] = value
- -
[docs] def remove(self, key): - """ - Remove Nattribute from storage. - - Args: - key (str): The name of the Nattribute to remove. - - """ - if key in self._store: - del self._store[key]
- -
[docs] def clear(self): - """ - Remove all NAttributes from handler. - - """ - self._store = {}
- -
[docs] def all(self, return_tuples=False): - """ - List the contents of the handler. - - Args: - return_tuples (bool, optional): Defines if the Nattributes - are returns as a list of keys or as a list of `(key, value)`. - - Returns: - nattributes (list): A list of keys `[key, key, ...]` or a - list of tuples `[(key, value), ...]` depending on the - setting of `return_tuples`. - - """ - if return_tuples: - return [(key, value) for (key, value) in self._store.items() if not key.startswith("_")] - return [key for key in self._store if not key.startswith("_")]
- # ------------------------------------------------------------- # Server Session @@ -216,6 +98,10 @@ cmdset_storage = property(__cmdset_storage_get, __cmdset_storage_set) + @property + def id(self): + return self.sessid +
[docs] def at_sync(self): """ This is called whenever a session has been resynced with the @@ -385,7 +271,7 @@ Update the protocol_flags and sync them with Portal. Keyword Args: - any: A key:value pair to set in the + protocol_flag (any): A key and value to set in the protocol_flags dictionary. Notes: @@ -417,14 +303,13 @@ the respective inputfuncs. Keyword Args: - any: Incoming data from protocol on + kwargs (any): Incoming data from protocol on the form `{"commandname": ((args), {kwargs}),...}` Notes: This method is here in order to give the user a single place to catch and possibly process all incoming data from the client. It should usually always end by sending this data off to `self.sessionhandler.call_inputfuncs(self, **kwargs)`. - """ self.sessionhandler.call_inputfuncs(self, **kwargs)
@@ -434,7 +319,9 @@ Args: text (str): String input. - kwargs (str or tuple): Send-commands identified + + Keyword Args: + any (str or tuple): Send-commands identified by their keys. Or "options", carrying options for the protocol(s). @@ -530,7 +417,7 @@
[docs] @lazy_property def nattributes(self): - return NAttributeHandler(self)
+ return AttributeHandler(self, InMemoryAttributeBackend)
[docs] @lazy_property def attributes(self): @@ -548,7 +435,7 @@ try: return self._ndb_holder except AttributeError: - self._ndb_holder = NDbHolder(self, "nattrhandler", manager_name="nattributes") + self._ndb_holder = DbHolder(self, "nattrhandler", manager_name="nattributes") return self._ndb_holder
# @ndb.setter diff --git a/docs/0.9.5/_modules/evennia/server/session.html b/docs/0.9.5/_modules/evennia/server/session.html index 6435748e93..8a1a3b5a27 100644 --- a/docs/0.9.5/_modules/evennia/server/session.html +++ b/docs/0.9.5/_modules/evennia/server/session.html @@ -76,26 +76,6 @@ """ - # names of attributes that should be affected by syncing. - _attrs_to_sync = ( - "protocol_key", - "address", - "suid", - "sessid", - "uid", - "csessid", - "uname", - "logged_in", - "puid", - "conn_time", - "cmd_last", - "cmd_last_visible", - "cmd_total", - "protocol_flags", - "server_data", - "cmdset_storage_string", - ) -
[docs] def init_session(self, protocol_key, address, sessionhandler): """ Initialize the Session. This should be called by the protocol when @@ -162,9 +142,9 @@ the keys given by self._attrs_to_sync. """ - return dict( - (key, value) for key, value in self.__dict__.items() if key in self._attrs_to_sync - )
+ return { + attr: getattr(self, attr) for attr in settings.SESSION_SYNC_ATTRS if hasattr(self, attr) + }
[docs] def load_sync_data(self, sessdata): """ diff --git a/docs/0.9.5/_modules/evennia/server/sessionhandler.html b/docs/0.9.5/_modules/evennia/server/sessionhandler.html index 9bbc191276..cdd7d0e6e5 100644 --- a/docs/0.9.5/_modules/evennia/server/sessionhandler.html +++ b/docs/0.9.5/_modules/evennia/server/sessionhandler.html @@ -45,12 +45,12 @@ There are two similar but separate stores of sessions: - - ServerSessionHandler - this stores generic game sessions - for the game. These sessions has no knowledge about - how they are connected to the world. - - PortalSessionHandler - this stores sessions created by - twisted protocols. These are dumb connectors that - handle network communication but holds no game info. +- ServerSessionHandler - this stores generic game sessions + for the game. These sessions has no knowledge about + how they are connected to the world. +- PortalSessionHandler - this stores sessions created by + twisted protocols. These are dumb connectors that + handle network communication but holds no game info. """ import time @@ -64,7 +64,9 @@ make_iter, delay, callables_from_module, + class_from_module, ) +from evennia.server.portal import amp from evennia.server.signals import SIGNAL_ACCOUNT_POST_LOGIN, SIGNAL_ACCOUNT_POST_LOGOUT from evennia.server.signals import SIGNAL_ACCOUNT_POST_FIRST_LOGIN, SIGNAL_ACCOUNT_POST_LAST_LOGOUT from evennia.utils.inlinefuncs import parse_inlinefunc @@ -88,25 +90,6 @@ DUMMYSESSION = DummySession() -# AMP signals -PCONN = chr(1) # portal session connect -PDISCONN = chr(2) # portal session disconnect -PSYNC = chr(3) # portal session sync -SLOGIN = chr(4) # server session login -SDISCONN = chr(5) # server session disconnect -SDISCONNALL = chr(6) # server session disconnect all -SSHUTD = chr(7) # server shutdown -SSYNC = chr(8) # server session sync -SCONN = chr(11) # server portal connection (for bots) -PCONNSYNC = chr(12) # portal post-syncing session -PDISCONNALL = chr(13) # portal session discnnect all -SRELOAD = chr(14) # server reloading (have portal start a new server) -SSTART = chr(15) # server start (portal must already be running anyway) -PSHUTD = chr(16) # portal (+server) shutdown -SSHUTD = chr(17) # server shutdown -PSTATUS = chr(18) # ping server or portal status -SRESET = chr(19) # server shutdown in reset mode - # i18n from django.utils.translation import gettext as _ @@ -214,23 +197,20 @@ Args: session (Session): The relevant session instance. - kwargs (dict) Each keyword represents a - send-instruction, with the keyword itself being the name + kwargs (dict) Each keyword represents a send-instruction, with the keyword itself being the name of the instruction (like "text"). Suitable values for each keyword are: - :: - - arg -> [[arg], {}] - [args] -> [[args], {}] - {kwargs} -> [[], {kwargs}] - [args, {kwargs}] -> [[arg], {kwargs}] - [[args], {kwargs}] -> [[args], {kwargs}] + - arg -> [[arg], {}] + - [args] -> [[args], {}] + - {kwargs} -> [[], {kwargs}] + - [args, {kwargs}] -> [[arg], {kwargs}] + - [[args], {kwargs}] -> [[args], {kwargs}] Returns: kwargs (dict): A cleaned dictionary of cmdname:[[args],{kwargs}] pairs, - where the keys, args and kwargs have all been converted to - send-safe entities (strings or numbers), and inlinefuncs have been - applied. + where the keys, args and kwargs have all been converted to + send-safe entities (strings or numbers), and inlinefuncs have been + applied. """ options = kwargs.pop("options", None) or {} @@ -494,7 +474,7 @@ """ self.server.amp_protocol.send_AdminServer2Portal( - DUMMYSESSION, operation=SCONN, protocol_path=protocol_path, config=configdict + DUMMYSESSION, operation=amp.SCONN, protocol_path=protocol_path, config=configdict )
[docs] def portal_restart_server(self): @@ -502,14 +482,14 @@ Called by server when reloading. We tell the portal to start a new server instance. """ - self.server.amp_protocol.send_AdminServer2Portal(DUMMYSESSION, operation=SRELOAD)
+ self.server.amp_protocol.send_AdminServer2Portal(DUMMYSESSION, operation=amp.SRELOAD)
[docs] def portal_reset_server(self): """ Called by server when reloading. We tell the portal to start a new server instance. """ - self.server.amp_protocol.send_AdminServer2Portal(DUMMYSESSION, operation=SRESET)
+ self.server.amp_protocol.send_AdminServer2Portal(DUMMYSESSION, operation=amp.SRESET)
[docs] def portal_shutdown(self): """ @@ -517,7 +497,7 @@ itself down) """ - self.server.amp_protocol.send_AdminServer2Portal(DUMMYSESSION, operation=PSHUTD)
+ self.server.amp_protocol.send_AdminServer2Portal(DUMMYSESSION, operation=amp.PSHUTD)
[docs] def login(self, session, account, force=False, testmode=False): """ @@ -565,7 +545,7 @@ # sync the portal to the session if not testmode: self.server.amp_protocol.send_AdminServer2Portal( - session, operation=SLOGIN, sessiondata={"logged_in": True, "uid": session.uid} + session, operation=amp.SLOGIN, sessiondata={"logged_in": True, "uid": session.uid} ) account.at_post_login(session=session) if nsess < 2: @@ -610,7 +590,7 @@ if sync_portal: # inform portal that session should be closed. self.server.amp_protocol.send_AdminServer2Portal( - session, operation=SDISCONN, reason=reason + session, operation=amp.SDISCONN, reason=reason )
[docs] def all_sessions_portal_sync(self): @@ -621,7 +601,7 @@ """ sessdata = self.get_all_sync_data() return self.server.amp_protocol.send_AdminServer2Portal( - DUMMYSESSION, operation=SSYNC, sessiondata=sessdata + DUMMYSESSION, operation=amp.SSYNC, sessiondata=sessdata )
[docs] def session_portal_sync(self, session): @@ -632,7 +612,7 @@ """ sessdata = {session.sessid: session.get_sync_data()} return self.server.amp_protocol.send_AdminServer2Portal( - DUMMYSESSION, operation=SSYNC, sessiondata=sessdata, clean=False + DUMMYSESSION, operation=amp.SSYNC, sessiondata=sessdata, clean=False )
[docs] def session_portal_partial_sync(self, session_data): @@ -645,7 +625,7 @@ """ return self.server.amp_protocol.send_AdminServer2Portal( - DUMMYSESSION, operation=SSYNC, sessiondata=session_data, clean=False + DUMMYSESSION, operation=amp.SSYNC, sessiondata=session_data, clean=False )
[docs] def disconnect_all_sessions(self, reason="You have been disconnected."): @@ -661,7 +641,7 @@ del session # tell portal to disconnect all sessions self.server.amp_protocol.send_AdminServer2Portal( - DUMMYSESSION, operation=SDISCONNALL, reason=reason + DUMMYSESSION, operation=amp.SDISCONNALL, reason=reason )
[docs] def disconnect_duplicate_sessions( @@ -804,8 +784,9 @@ Given a client identification hash (for session types that offer them) return all sessions with a matching hash. - Args: + Args csessid (str): The session hash. + Returns: sessions (list): The sessions with matching .csessid, if any. @@ -868,9 +849,9 @@
[docs] def call_inputfuncs(self, session, **kwargs): """ - Split incoming data into its inputfunc counterparts. - This should be called by the serversession.data_in - as `sessionhandler.call_inputfunc(self, **kwargs)`. + Split incoming data into its inputfunc counterparts. This should be + called by the `serversession.data_in` as + `sessionhandler.call_inputfunc(self, **kwargs)`. We also intercept OOB communication here. @@ -878,8 +859,8 @@ sessions (Session): Session. Keyword Args: - kwargs (any): Incoming data from protocol on - the form `{"commandname": ((args), {kwargs}),...}` + any (tuple): Incoming data from protocol, each + on the form `commandname=((args), {kwargs})`. """ @@ -900,7 +881,11 @@ log_trace()
-SESSION_HANDLER = ServerSessionHandler() +# import class from settings +_SESSION_HANDLER_CLASS = class_from_module(settings.SERVER_SESSION_HANDLER_CLASS) + +# Instantiate class. These globals are used to provide singleton-like behavior. +SESSION_HANDLER = _SESSION_HANDLER_CLASS() SESSIONS = SESSION_HANDLER # legacy
diff --git a/docs/0.9.5/_modules/evennia/typeclasses/attributes.html b/docs/0.9.5/_modules/evennia/typeclasses/attributes.html index 67175b1449..276ba1c7a3 100644 --- a/docs/0.9.5/_modules/evennia/typeclasses/attributes.html +++ b/docs/0.9.5/_modules/evennia/typeclasses/attributes.html @@ -53,6 +53,8 @@ import fnmatch import weakref +from collections import defaultdict + from django.db import models from django.conf import settings from django.utils.encoding import smart_str @@ -72,7 +74,7 @@ # ------------------------------------------------------------- -
[docs]class Attribute(SharedMemoryModel): +
[docs]class IAttribute: """ Attributes are things that are specific to different types of objects. For example, a drink container needs to store its fill level, whereas an exit @@ -94,6 +96,112 @@ - category (str): Optional character string for grouping the Attribute. + This class is an API/Interface/Abstract base class; do not instantiate it directly. + """ + +
[docs] @lazy_property + def locks(self): + return LockHandler(self)
+ + key = property(lambda self: self.db_key) + strvalue = property(lambda self: self.db_strvalue) + category = property(lambda self: self.db_category) + model = property(lambda self: self.db_model) + attrtype = property(lambda self: self.db_attrtype) + date_created = property(lambda self: self.db_date_created) + + def __lock_storage_get(self): + return self.db_lock_storage + + def __lock_storage_set(self, value): + self.db_lock_storage = value + + def __lock_storage_del(self): + self.db_lock_storage = "" + + lock_storage = property(__lock_storage_get, __lock_storage_set, __lock_storage_del) + +
[docs] def access(self, accessing_obj, access_type="read", default=False, **kwargs): + """ + Determines if another object has permission to access. + + Args: + accessing_obj (object): Entity trying to access this one. + access_type (str, optional): Type of access sought, see + the lock documentation. + default (bool, optional): What result to return if no lock + of access_type was found. The default, `False`, means a lockdown + policy, only allowing explicit access. + kwargs (any, optional): Not used; here to make the API consistent with + other access calls. + + Returns: + result (bool): If the lock was passed or not. + + """ + result = self.locks.check(accessing_obj, access_type=access_type, default=default) + return result
+ + # + # + # Attribute methods + # + # + + def __str__(self): + return smart_str("%s(%s)" % (self.db_key, self.id)) + + def __repr__(self): + return "%s(%s)" % (self.db_key, self.id)
+ + +
[docs]class InMemoryAttribute(IAttribute): + """ + This Attribute is used purely for NAttributes/NAttributeHandler. It has no database backend. + """ + + # Primary Key has no meaning for an InMemoryAttribute. This merely serves to satisfy other code. + +
[docs] def __init__(self, pk, **kwargs): + """ + Create an Attribute that exists only in Memory. + + Args: + pk (int): This is a fake 'primary key' / id-field. It doesn't actually have to be unique, but is fed an + incrementing number from the InMemoryBackend by default. This is needed only so Attributes can be + sorted. Some parts of the API also see the lack of a .pk field as a sign that the Attribute was + deleted. + **kwargs: Other keyword arguments are used to construct the actual Attribute. + """ + self.id = pk + self.pk = pk + + # Copy all kwargs to local properties. We use db_ for compatability here. + for key, value in kwargs.items(): + # Value and locks are special. We must call the wrappers. + if key == "value": + self.value = value + elif key == "lock_storage": + self.lock_storage = value + else: + setattr(self, f"db_{key}", value)
+ + # value property (wraps db_value) + def __value_get(self): + return self.db_value + + def __value_set(self, new_value): + self.db_value = new_value + + def __value_del(self): + pass + + value = property(__value_get, __value_set, __value_del)
+ + +
[docs]class Attribute(IAttribute, SharedMemoryModel): + """ + This attribute is stored via Django. Most Attributes will be using this class. """ # @@ -150,35 +258,10 @@ # Database manager # objects = managers.AttributeManager() -
[docs] @lazy_property - def locks(self): - return LockHandler(self)
- class Meta(object): "Define Django meta options" verbose_name = "Evennia Attribute" - # read-only wrappers - key = property(lambda self: self.db_key) - strvalue = property(lambda self: self.db_strvalue) - category = property(lambda self: self.db_category) - model = property(lambda self: self.db_model) - attrtype = property(lambda self: self.db_attrtype) - date_created = property(lambda self: self.db_date_created) - - def __lock_storage_get(self): - return self.db_lock_storage - - def __lock_storage_set(self, value): - self.db_lock_storage = value - self.save(update_fields=["db_lock_storage"]) - - def __lock_storage_del(self): - self.db_lock_storage = "" - self.save(update_fields=["db_lock_storage"]) - - lock_storage = property(__lock_storage_get, __lock_storage_set, __lock_storage_del) - # Wrapper properties to easily set database fields. These are # @property decorators that allows to access these fields using # normal python operations (without having to remember to save() @@ -187,6 +270,20 @@ # value = self.attr and del self.attr respectively (where self # is the object in question). + # lock_storage wrapper. Overloaded for saving to database. + def __lock_storage_get(self): + return self.db_lock_storage + + def __lock_storage_set(self, value): + super().__lock_storage_set(value) + self.save(update_fields=["db_lock_storage"]) + + def __lock_storage_del(self): + super().__lock_storage_del() + self.save(update_fields=["db_lock_storage"]) + + lock_storage = property(__lock_storage_get, __lock_storage_set, __lock_storage_del) + # value property (wraps db_value) # @property def __value_get(self): @@ -205,7 +302,6 @@ see self.__value_get. """ self.db_value = to_pickle(new_value) - # print("value_set, self.db_value:", repr(self.db_value)) # DEBUG self.save(update_fields=["db_value"]) # @value.deleter @@ -213,40 +309,7 @@ """Deleter. Allows for del attr.value. This removes the entire attribute.""" self.delete() - value = property(__value_get, __value_set, __value_del) - - # - # - # Attribute methods - # - # - - def __str__(self): - return smart_str("%s(%s)" % (self.db_key, self.id)) - - def __repr__(self): - return "%s(%s)" % (self.db_key, self.id) - -
[docs] def access(self, accessing_obj, access_type="attrread", default=False, **kwargs): - """ - Determines if another object has permission to access. - - Args: - accessing_obj (object): Entity trying to access this one. - access_type (str, optional): Type of access sought, see - the lock documentation. - default (bool, optional): What result to return if no lock - of access_type was found. The default, `False`, means a lockdown - policy, only allowing explicit access. - kwargs (any, optional): Not used; here to make the API consistent with - other access calls. - - Returns: - result (bool): If the lock was passed or not. - - """ - result = self.locks.check(accessing_obj, access_type=access_type, default=default) - return result
+ value = property(__value_get, __value_set, __value_del)
# @@ -254,59 +317,145 @@ # -
[docs]class AttributeHandler(object): +
[docs]class IAttributeBackend: """ - Handler for adding Attributes to the object. + Abstract interface for the backends used by the Attribute Handler. + + All Backends must implement this base class. """ - _m2m_fieldname = "db_attributes" _attrcreate = "attrcreate" _attredit = "attredit" _attrread = "attrread" - _attrtype = None + _attrclass = None -
[docs] def __init__(self, obj): - """Initialize handler.""" - self.obj = obj - self._objid = obj.id - self._model = to_str(obj.__dbclass__.__name__.lower()) +
[docs] def __init__(self, handler, attrtype): + self.handler = handler + self.obj = handler.obj + self._attrtype = attrtype + self._objid = handler.obj.id self._cache = {} # store category names fully cached self._catcache = {} # full cache was run on all attributes self._cache_complete = False
- def _query_all(self): - "Fetch all Attributes on this object" - query = { - "%s__id" % self._model: self._objid, - "attribute__db_model__iexact": self._model, - "attribute__db_attrtype": self._attrtype, - } - return [ - conn.attribute - for conn in getattr(self.obj, self._m2m_fieldname).through.objects.filter(**query) - ] +
[docs] def query_all(self): + """ + Fetch all Attributes from this object. - def _fullcache(self): + Returns: + attrlist (list): A list of Attribute objects. + """ + raise NotImplementedError()
+ +
[docs] def query_key(self, key, category): + """ + + Args: + key (str): The key of the Attribute being searched for. + category (str or None): The category of the desired Attribute. + + Returns: + attribute (IAttribute): A single Attribute. + """ + raise NotImplementedError()
+ +
[docs] def query_category(self, category): + """ + Returns every matching Attribute as a list, given a category. + + This method calls up whatever storage the backend uses. + + Args: + category (str or None): The category to query. + + Returns: + attrs (list): The discovered Attributes. + """ + raise NotImplementedError()
+ + def _full_cache(self): """Cache all attributes of this object""" if not _TYPECLASS_AGGRESSIVE_CACHE: return - attrs = self._query_all() - self._cache = dict( - ( - "%s-%s" - % ( - to_str(attr.db_key).lower(), - attr.db_category.lower() if attr.db_category else None, - ), - attr, - ) + attrs = self.query_all() + self._cache = { + f"{to_str(attr.key).lower()}-{attr.category.lower() if attr.category else None}": attr for attr in attrs - ) + } self._cache_complete = True - def _getcache(self, key=None, category=None): + def _get_cache_key(self, key, category): + """ + + + Args: + key (str): The key of the Attribute being searched for. + category (str or None): The category of the desired Attribute. + + Returns: + attribute (IAttribute): A single Attribute. + """ + cachekey = "%s-%s" % (key, category) + cachefound = False + try: + attr = _TYPECLASS_AGGRESSIVE_CACHE and self._cache[cachekey] + cachefound = True + except KeyError: + attr = None + + if attr and (not hasattr(attr, "pk") and attr.pk is None): + # clear out Attributes deleted from elsewhere. We must search this anew. + attr = None + cachefound = False + del self._cache[cachekey] + if cachefound and _TYPECLASS_AGGRESSIVE_CACHE: + if attr: + return [attr] # return cached entity + else: + return [] # no such attribute: return an empty list + else: + conn = self.query_key(key, category) + if conn: + attr = conn[0].attribute + if _TYPECLASS_AGGRESSIVE_CACHE: + self._cache[cachekey] = attr + return [attr] if attr.pk else [] + else: + # There is no such attribute. We will explicitly save that + # in our cache to avoid firing another query if we try to + # retrieve that (non-existent) attribute again. + if _TYPECLASS_AGGRESSIVE_CACHE: + self._cache[cachekey] = None + return [] + + def _get_cache_category(self, category): + """ + Retrieves Attribute list (by category) from cache. + + Args: + category (str or None): The category to query. + + Returns: + attrs (list): The discovered Attributes. + """ + catkey = "-%s" % category + if _TYPECLASS_AGGRESSIVE_CACHE and catkey in self._catcache: + return [attr for key, attr in self._cache.items() if key.endswith(catkey) and attr] + else: + # we have to query to make this category up-date in the cache + attrs = self.query_category(category) + if _TYPECLASS_AGGRESSIVE_CACHE: + for attr in attrs: + if attr.pk: + cachekey = "%s-%s" % (attr.key, category) + self._cache[cachekey] = attr + # mark category cache as up-to-date + self._catcache[catkey] = True + return attrs + + def _get_cache(self, key=None, category=None): """ Retrieve from cache or database (always caches) @@ -332,85 +481,31 @@ key = key.strip().lower() if key else None category = category.strip().lower() if category else None if key: - cachekey = "%s-%s" % (key, category) - cachefound = False - try: - attr = _TYPECLASS_AGGRESSIVE_CACHE and self._cache[cachekey] - cachefound = True - except KeyError: - attr = None + return self._get_cache_key(key, category) + return self._get_cache_category(category) - if attr and (not hasattr(attr, "pk") and attr.pk is None): - # clear out Attributes deleted from elsewhere. We must search this anew. - attr = None - cachefound = False - del self._cache[cachekey] - if cachefound and _TYPECLASS_AGGRESSIVE_CACHE: - if attr: - return [attr] # return cached entity - else: - return [] # no such attribute: return an empty list - else: - query = { - "%s__id" % self._model: self._objid, - "attribute__db_model__iexact": self._model, - "attribute__db_attrtype": self._attrtype, - "attribute__db_key__iexact": key.lower(), - "attribute__db_category__iexact": category.lower() if category else None, - } - if not self.obj.pk: - return [] - conn = getattr(self.obj, self._m2m_fieldname).through.objects.filter(**query) - if conn: - attr = conn[0].attribute - if _TYPECLASS_AGGRESSIVE_CACHE: - self._cache[cachekey] = attr - return [attr] if attr.pk else [] - else: - # There is no such attribute. We will explicitly save that - # in our cache to avoid firing another query if we try to - # retrieve that (non-existent) attribute again. - if _TYPECLASS_AGGRESSIVE_CACHE: - self._cache[cachekey] = None - return [] - else: - # only category given (even if it's None) - we can't - # assume the cache to be complete unless we have queried - # for this category before - catkey = "-%s" % category - if _TYPECLASS_AGGRESSIVE_CACHE and catkey in self._catcache: - return [attr for key, attr in self._cache.items() if key.endswith(catkey) and attr] - else: - # we have to query to make this category up-date in the cache - query = { - "%s__id" % self._model: self._objid, - "attribute__db_model__iexact": self._model, - "attribute__db_attrtype": self._attrtype, - "attribute__db_category__iexact": category.lower() if category else None, - } - attrs = [ - conn.attribute - for conn in getattr(self.obj, self._m2m_fieldname).through.objects.filter( - **query - ) - ] - if _TYPECLASS_AGGRESSIVE_CACHE: - for attr in attrs: - if attr.pk: - cachekey = "%s-%s" % (attr.db_key, category) - self._cache[cachekey] = attr - # mark category cache as up-to-date - self._catcache[catkey] = True - return attrs +
[docs] def get(self, key=None, category=None): + """ + Frontend for .get_cache. Retrieves Attribute(s). - def _setcache(self, key, category, attr_obj): + Args: + key (str, optional): Attribute key to query for + category (str, optional): Attribiute category + + Returns: + args (list): Returns a list of zero or more matches + found from cache or database. + """ + return self._get_cache(key, category)
+ + def _set_cache(self, key, category, attr_obj): """ Update cache. Args: key (str): A cleaned key string category (str or None): A cleaned category name - attr_obj (Attribute): The newly saved attribute + attr_obj (IAttribute): The newly saved attribute """ if not _TYPECLASS_AGGRESSIVE_CACHE: @@ -424,7 +519,7 @@ self._catcache.pop(catkey, None) self._cache_complete = False - def _delcache(self, key, category): + def _delete_cache(self, key, category): """ Remove attribute from cache @@ -447,7 +542,7 @@ self._catcache.pop(catkey, None) self._cache_complete = False -
[docs] def reset_cache(self): +
[docs] def reset_cache(self): """ Reset cache from the outside. """ @@ -455,6 +550,431 @@ self._cache = {} self._catcache = {}
+
[docs] def do_create_attribute(self, key, category, lockstring, value, strvalue): + """ + Does the hard work of actually creating Attributes, whatever is needed. + + Args: + key (str): The Attribute's key. + category (str or None): The Attribute's category, or None + lockstring (str): Any locks for the Attribute. + value (obj): The Value of the Attribute. + strvalue (bool): Signifies if this is a strvalue Attribute. Value MUST be a string or + this will lead to Trouble. Ignored for InMemory attributes. + + Returns: + attr (IAttribute): The new Attribute. + """ + raise NotImplementedError()
+ +
[docs] def create_attribute(self, key, category, lockstring, value, strvalue=False, cache=True): + """ + Creates Attribute (using the class specified for the backend), (optionally) caches it, and returns it. + + This MUST actively save the Attribute to whatever database backend is used, AND + call self.set_cache(key, category, new_attrobj) + + Args: + key (str): The Attribute's key. + category (str or None): The Attribute's category, or None + lockstring (str): Any locks for the Attribute. + value (obj): The Value of the Attribute. + strvalue (bool): Signifies if this is a strvalue Attribute. Value MUST be a string or + this will lead to Trouble. Ignored for InMemory attributes. + cache (bool): Whether to cache the new Attribute + + Returns: + attr (IAttribute): The new Attribute. + """ + attr = self.do_create_attribute(key, category, lockstring, value, strvalue) + if cache: + self._set_cache(key, category, attr) + return attr
+ +
[docs] def do_update_attribute(self, attr, value): + """ + Simply sets a new Value to an Attribute. + + Args: + attr (IAttribute): The Attribute being changed. + value (obj): The Value for the Attribute. + + """ + raise NotImplementedError()
+ +
[docs] def do_batch_update_attribute(self, attr_obj, category, lock_storage, new_value, strvalue): + """ + Called opnly by batch add. For the database backend, this is a method + of updating that can alter category and lock-storage. + + Args: + attr_obj (IAttribute): The Attribute being altered. + category (str or None): The attribute's (new) category. + lock_storage (str): The attribute's new locks. + new_value (obj): The Attribute's new value. + strvalue (bool): Signifies if this is a strvalue Attribute. Value MUST be a string or + this will lead to Trouble. Ignored for InMemory attributes. + """ + raise NotImplementedError()
+ +
[docs] def do_batch_finish(self, attr_objs): + """ + Called after batch_add completed. Used for handling database operations + and/or caching complications. + + Args: + attr_objs (list of IAttribute): The Attributes created/updated thus far. + + """ + raise NotImplementedError()
+ +
[docs] def batch_add(self, *args, **kwargs): + """ + Batch-version of `.add()`. This is more efficient than repeat-calling + `.add` when having many Attributes to add. + + Args: + *args (tuple): Tuples of varying length representing the + Attribute to add to this object. Supported tuples are + + - (key, value) + - (key, value, category) + - (key, value, category, lockstring) + - (key, value, category, lockstring, default_access) + + Raises: + RuntimeError: If trying to pass a non-iterable as argument. + + Notes: + The indata tuple order matters, so if you want a lockstring but no + category, set the category to `None`. This method does not have the + ability to check editing permissions and is mainly used internally. + It does not use the normal `self.add` but applies the Attributes + directly to the database. + + """ + new_attrobjs = [] + strattr = kwargs.get("strattr", False) + for tup in args: + if not is_iter(tup) or len(tup) < 2: + raise RuntimeError("batch_add requires iterables as arguments (got %r)." % tup) + ntup = len(tup) + keystr = str(tup[0]).strip().lower() + new_value = tup[1] + category = str(tup[2]).strip().lower() if ntup > 2 and tup[2] is not None else None + lockstring = tup[3] if ntup > 3 else "" + + attr_objs = self._get_cache(keystr, category) + + if attr_objs: + attr_obj = attr_objs[0] + # update an existing attribute object + self.do_batch_update_attribute(attr_obj, category, lockstring, new_value, strattr) + else: + new_attr = self.do_create_attribute( + keystr, category, lockstring, new_value, strvalue=strattr + ) + new_attrobjs.append(new_attr) + if new_attrobjs: + self.do_batch_finish(new_attrobjs)
+ +
[docs] def do_delete_attribute(self, attr): + """ + Does the hard work of actually deleting things. + + Args: + attr (IAttribute): The attribute to delete. + """ + raise NotImplementedError()
+ +
[docs] def delete_attribute(self, attr): + """ + Given an Attribute, deletes it. Also remove it from cache. + + Args: + attr (IAttribute): The attribute to delete. + """ + if not attr: + return + self._delete_cache(attr.key, attr.category) + self.do_delete_attribute(attr)
+ +
[docs] def update_attribute(self, attr, value): + """ + Simply updates an Attribute. + + Args: + attr (IAttribute): The attribute to delete. + value (obj): The new value. + """ + self.do_update_attribute(attr, value)
+ +
[docs] def do_batch_delete(self, attribute_list): + """ + Given a list of attributes, deletes them all. + The default implementation is fine, but this is overridable since some databases may allow + for a better method. + + Args: + attribute_list (list of IAttribute): + """ + for attribute in attribute_list: + self.delete_attribute(attribute)
+ +
[docs] def clear_attributes(self, category, accessing_obj, default_access): + """ + Remove all Attributes on this object. + + Args: + category (str, optional): If given, clear only Attributes + of this category. + accessing_obj (object, optional): If given, check the + `attredit` lock on each Attribute before continuing. + default_access (bool, optional): Use this permission as + fallback if `access_obj` is given but there is no lock of + type `attredit` on the Attribute in question. + + """ + category = category.strip().lower() if category is not None else None + + if not self._cache_complete: + self._full_cache() + + if category is not None: + attrs = [attr for attr in self._cache.values() if attr.category == category] + else: + attrs = self._cache.values() + + if accessing_obj: + self.do_batch_delete( + [ + attr + for attr in attrs + if attr.access(accessing_obj, self._attredit, default=default_access) + ] + ) + else: + # have to cast the results to a list or we'll get a RuntimeError for removing from the dict we're iterating + self.do_batch_delete(list(attrs)) + self.reset_cache()
+ +
[docs] def get_all_attributes(self): + """ + Simply returns all Attributes of this object, sorted by their IDs. + + Returns: + attributes (list of IAttribute) + """ + if _TYPECLASS_AGGRESSIVE_CACHE: + if not self._cache_complete: + self._full_cache() + return sorted([attr for attr in self._cache.values() if attr], key=lambda o: o.id) + else: + return sorted([attr for attr in self.query_all() if attr], key=lambda o: o.id)
+ + +
[docs]class InMemoryAttributeBackend(IAttributeBackend): + """ + This Backend for Attributes stores NOTHING in the database. Everything is kept in memory, and normally lost + on a crash, reload, shared memory flush, etc. It generates IDs for the Attributes it manages, but these are + of little importance beyond sorting and satisfying the caching logic to know an Attribute hasn't been + deleted out from under the cache's nose. + + """ + + _attrclass = InMemoryAttribute + +
[docs] def __init__(self, handler, attrtype): + super().__init__(handler, attrtype) + self._storage = dict() + self._category_storage = defaultdict(list) + self._id_counter = 0
+ + def _next_id(self): + """ + Increments the internal ID counter and returns the new value. + + Returns: + next_id (int): A simple integer. + """ + self._id_counter += 1 + return self._id_counter + +
[docs] def query_all(self): + return self._storage.values()
+ +
[docs] def query_key(self, key, category): + found = self._storage.get((key, category), None) + if found: + return [found] + return []
+ +
[docs] def query_category(self, category): + if category is None: + return self._storage.values() + return self._category_storage.get(category, [])
+ +
[docs] def do_create_attribute(self, key, category, lockstring, value, strvalue): + """ + See parent class. + + strvalue has no meaning for InMemory attributes. + + """ + new_attr = self._attrclass( + pk=self._next_id(), key=key, category=category, lock_storage=lockstring, value=value + ) + self._storage[(key, category)] = new_attr + self._category_storage[category].append(new_attr) + return new_attr
+ +
[docs] def do_update_attribute(self, attr, value): + attr.value = value
+ +
[docs] def do_batch_update_attribute(self, attr_obj, category, lock_storage, new_value, strvalue): + """ + No need to bother saving anything. Just set some values. + """ + attr_obj.db_category = category + attr_obj.db_lock_storage = lock_storage if lock_storage else "" + attr_obj.value = new_value
+ +
[docs] def do_batch_finish(self, attr_objs): + """ + Nothing to do here for In-Memory. + + Args: + attr_objs (list of IAttribute): The Attributes created/updated thus far. + """ + pass
+ +
[docs] def do_delete_attribute(self, attr): + """ + Removes the Attribute from local storage. Once it's out of the cache, garbage collection will handle the rest. + + Args: + attr (IAttribute): The attribute to delete. + """ + del self._storage[(attr.key, attr.category)] + self._category_storage[attr.category].remove(attr)
+ + +
[docs]class ModelAttributeBackend(IAttributeBackend): + """ + Uses Django models for storing Attributes. + """ + + _attrclass = Attribute + _m2m_fieldname = "db_attributes" + +
[docs] def __init__(self, handler, attrtype): + super().__init__(handler, attrtype) + self._model = to_str(handler.obj.__dbclass__.__name__.lower())
+ +
[docs] def query_all(self): + query = { + "%s__id" % self._model: self._objid, + "attribute__db_model__iexact": self._model, + "attribute__db_attrtype": self._attrtype, + } + return [ + conn.attribute + for conn in getattr(self.obj, self._m2m_fieldname).through.objects.filter(**query) + ]
+ +
[docs] def query_key(self, key, category): + query = { + "%s__id" % self._model: self._objid, + "attribute__db_model__iexact": self._model, + "attribute__db_attrtype": self._attrtype, + "attribute__db_key__iexact": key.lower(), + "attribute__db_category__iexact": category.lower() if category else None, + } + if not self.obj.pk: + return [] + return getattr(self.obj, self._m2m_fieldname).through.objects.filter(**query)
+ +
[docs] def query_category(self, category): + query = { + "%s__id" % self._model: self._objid, + "attribute__db_model__iexact": self._model, + "attribute__db_attrtype": self._attrtype, + "attribute__db_category__iexact": category.lower() if category else None, + } + return [ + conn.attribute + for conn in getattr(self.obj, self._m2m_fieldname).through.objects.filter(**query) + ]
+ +
[docs] def do_create_attribute(self, key, category, lockstring, value, strvalue): + kwargs = { + "db_key": key, + "db_category": category, + "db_model": self._model, + "db_lock_storage": lockstring if lockstring else "", + "db_attrtype": self._attrtype, + } + if strvalue: + kwargs["db_value"] = None + kwargs["db_strvalue"] = value + else: + kwargs["db_value"] = to_pickle(value) + kwargs["db_strvalue"] = None + new_attr = self._attrclass(**kwargs) + new_attr.save() + getattr(self.obj, self._m2m_fieldname).add(new_attr) + self._set_cache(key, category, new_attr) + return new_attr
+ +
[docs] def do_update_attribute(self, attr, value): + attr.value = value
+ +
[docs] def do_batch_update_attribute(self, attr_obj, category, lock_storage, new_value, strvalue): + attr_obj.db_category = category + attr_obj.db_lock_storage = lock_storage if lock_storage else "" + if strvalue: + # store as a simple string (will not notify OOB handlers) + attr_obj.db_strvalue = new_value + attr_obj.value = None + else: + # store normally (this will also notify OOB handlers) + attr_obj.value = new_value + attr_obj.db_strvalue = None + attr_obj.save(update_fields=["db_strvalue", "db_value", "db_category", "db_lock_storage"])
+ +
[docs] def do_batch_finish(self, attr_objs): + # Add new objects to m2m field all at once + getattr(self.obj, self._m2m_fieldname).add(*attr_objs)
+ +
[docs] def do_delete_attribute(self, attr): + try: + attr.delete() + except AssertionError: + # This could happen if the Attribute has already been deleted. + pass
+ + +
[docs]class AttributeHandler: + """ + Handler for adding Attributes to the object. + """ + + _attrcreate = "attrcreate" + _attredit = "attredit" + _attrread = "attrread" + _attrtype = None + +
[docs] def __init__(self, obj, backend_class): + """ + Setup the AttributeHandler. + + Args: + obj (TypedObject): An Account, Object, Channel, ServerSession (not technically a typed object), etc. + backend_class (IAttributeBackend class): The class of the backend to use. + """ + self.obj = obj + self.backend = backend_class(self, self._attrtype)
+
[docs] def has(self, key=None, category=None): """ Checks if the given Attribute (or list of Attributes) exists on @@ -476,7 +996,7 @@ category = category.strip().lower() if category is not None else None for keystr in make_iter(key): keystr = key.strip().lower() - ret.extend(bool(attr) for attr in self._getcache(keystr, category)) + ret.extend(bool(attr) for attr in self.backend.get(keystr, category)) return ret[0] if len(ret) == 1 else ret
[docs] def get( @@ -534,7 +1054,7 @@ ret = [] for keystr in make_iter(key): # it's okay to send a None key - attr_objs = self._getcache(keystr, category) + attr_objs = self.backend.get(keystr, category) if attr_objs: ret.extend(attr_objs) elif raise_exception: @@ -600,33 +1120,15 @@ category = category.strip().lower() if category is not None else None keystr = key.strip().lower() - attr_obj = self._getcache(key, category) + attr_obj = self.backend.get(key, category) if attr_obj: # update an existing attribute object attr_obj = attr_obj[0] - if strattr: - # store as a simple string (will not notify OOB handlers) - attr_obj.db_strvalue = value - attr_obj.save(update_fields=["db_strvalue"]) - else: - # store normally (this will also notify OOB handlers) - attr_obj.value = value + self.backend.update_attribute(attr_obj, value) else: # create a new Attribute (no OOB handlers can be notified) - kwargs = { - "db_key": keystr, - "db_category": category, - "db_model": self._model, - "db_attrtype": self._attrtype, - "db_value": None if strattr else to_pickle(value), - "db_strvalue": value if strattr else None, - } - new_attr = Attribute(**kwargs) - new_attr.save() - getattr(self.obj, self._m2m_fieldname).add(new_attr) - # update cache - self._setcache(keystr, category, new_attr)
+ self.backend.create_attribute(keystr, category, lockstring, value, strattr)
[docs] def batch_add(self, *args, **kwargs): """ @@ -638,10 +1140,10 @@ length) representing the Attribute to add to this object. Supported tuples are - - `(key, value)` - - `(key, value, category)` - - `(key, value, category, lockstring)` - - `(key, value, category, lockstring, default_access)` + - (key, value) + - (key, value, category) + - (key, value, category, lockstring) + - (key, value, category, lockstring, default_access) Keyword Args: strattr (bool): If `True`, value must be a string. This @@ -661,50 +1163,7 @@ to the database. """ - new_attrobjs = [] - strattr = kwargs.get("strattr", False) - for tup in args: - if not is_iter(tup) or len(tup) < 2: - raise RuntimeError("batch_add requires iterables as arguments (got %r)." % tup) - ntup = len(tup) - keystr = str(tup[0]).strip().lower() - new_value = tup[1] - category = str(tup[2]).strip().lower() if ntup > 2 and tup[2] is not None else None - lockstring = tup[3] if ntup > 3 else "" - - attr_objs = self._getcache(keystr, category) - - if attr_objs: - attr_obj = attr_objs[0] - # update an existing attribute object - attr_obj.db_category = category - attr_obj.db_lock_storage = lockstring or "" - attr_obj.save(update_fields=["db_category", "db_lock_storage"]) - if strattr: - # store as a simple string (will not notify OOB handlers) - attr_obj.db_strvalue = new_value - attr_obj.save(update_fields=["db_strvalue"]) - else: - # store normally (this will also notify OOB handlers) - attr_obj.value = new_value - else: - # create a new Attribute (no OOB handlers can be notified) - kwargs = { - "db_key": keystr, - "db_category": category, - "db_model": self._model, - "db_attrtype": self._attrtype, - "db_value": None if strattr else to_pickle(new_value), - "db_strvalue": new_value if strattr else None, - "db_lock_storage": lockstring or "", - } - new_attr = Attribute(**kwargs) - new_attr.save() - new_attrobjs.append(new_attr) - self._setcache(keystr, category, new_attr) - if new_attrobjs: - # Add new objects to m2m field all at once - getattr(self.obj, self._m2m_fieldname).add(*new_attrobjs)
+ self.backend.batch_add(*args, **kwargs)
[docs] def remove( self, @@ -753,20 +1212,13 @@ for keystr in make_iter(key): keystr = keystr.lower() - attr_objs = self._getcache(keystr, category) + attr_objs = self.backend.get(keystr, category) for attr_obj in attr_objs: if not ( accessing_obj and not attr_obj.access(accessing_obj, self._attredit, default=default_access) ): - try: - attr_obj.delete() - except AssertionError: - print("Assertionerror for attr.delete()") - # this happens if the attr was already deleted - pass - finally: - self._delcache(keystr, category) + self.backend.delete_attribute(attr_obj) if not attr_objs and raise_exception: raise AttributeError
@@ -784,27 +1236,7 @@ type `attredit` on the Attribute in question. """ - category = category.strip().lower() if category is not None else None - - if not self._cache_complete: - self._fullcache() - - if category is not None: - attrs = [attr for attr in self._cache.values() if attr.category == category] - else: - attrs = self._cache.values() - - if accessing_obj: - [ - attr.delete() - for attr in attrs - if attr and attr.access(accessing_obj, self._attredit, default=default_access) - ] - else: - [attr.delete() for attr in attrs if attr and attr.pk] - self._cache = {} - self._catcache = {} - self._cache_complete = False
+ self.backend.clear_attributes(category, accessing_obj, default_access)
[docs] def all(self, accessing_obj=None, default_access=True): """ @@ -823,12 +1255,7 @@ their values!) in the handler. """ - if _TYPECLASS_AGGRESSIVE_CACHE: - if not self._cache_complete: - self._fullcache() - attrs = sorted([attr for attr in self._cache.values() if attr], key=lambda o: o.id) - else: - attrs = sorted([attr for attr in self._query_all() if attr], key=lambda o: o.id) + attrs = self.backend.get_all_attributes() if accessing_obj: return [ @@ -837,7 +1264,42 @@ if attr.access(accessing_obj, self._attredit, default=default_access) ] else: - return attrs
+ return attrs
+ +
[docs] def reset_cache(self): + self.backend.reset_cache()
+ + +# DbHolders for .db and .ndb properties on Typeclasses. + +_GA = object.__getattribute__ +_SA = object.__setattr__ + + +
[docs]class DbHolder(object): + "Holder for allowing property access of attributes" + +
[docs] def __init__(self, obj, name, manager_name="attributes"): + _SA(self, name, _GA(obj, manager_name)) + _SA(self, "name", name)
+ + def __getattribute__(self, attrname): + if attrname == "all": + # we allow to overload our default .all + attr = _GA(self, _GA(self, "name")).get("all") + return attr if attr else _GA(self, "all") + return _GA(self, _GA(self, "name")).get(attrname) + + def __setattr__(self, attrname, value): + _GA(self, _GA(self, "name")).add(attrname, value) + + def __delattr__(self, attrname): + _GA(self, _GA(self, "name")).remove(attrname) + +
[docs] def get_all(self): + return _GA(self, _GA(self, "name")).get_all_attributes()
+ + all = property(get_all)
# Nick templating @@ -889,13 +1351,13 @@ matched by the in_template. Returns: - (regex, str): Regex to match against strings and a template - Template with markers `{arg1}`, `{arg2}`, etc for - replacement using the standard `.format` method. + regex (regex): Regex to match against strings + template (str): Template with markers ``{arg1}, {arg2}``, etc for + replacement using the standard .format method. Raises: - attributes.NickTemplateInvalid: If the in/out template does not have a matching - number of $args. + evennia.typecalasses.attributes.NickTemplateInvalid: If the in/out + template does not have a matching number of `$args`. """ @@ -1080,95 +1542,6 @@ if is_match: break return raw_string - - -
[docs]class NAttributeHandler(object): - """ - This stand-alone handler manages non-database saving. - It is similar to `AttributeHandler` and is used - by the `.ndb` handler in the same way as `.db` does - for the `AttributeHandler`. - """ - -
[docs] def __init__(self, obj): - """ - Initialized on the object - """ - self._store = {} - self.obj = weakref.proxy(obj)
- -
[docs] def has(self, key): - """ - Check if object has this attribute or not. - - Args: - key (str): The Nattribute key to check. - - Returns: - has_nattribute (bool): If Nattribute is set or not. - - """ - return key in self._store
- -
[docs] def get(self, key): - """ - Get the named key value. - - Args: - key (str): The Nattribute key to get. - - Returns: - the value of the Nattribute. - - """ - return self._store.get(key, None)
- -
[docs] def add(self, key, value): - """ - Add new key and value. - - Args: - key (str): The name of Nattribute to add. - value (any): The value to store. - - """ - self._store[key] = value
- -
[docs] def remove(self, key): - """ - Remove Nattribute from storage. - - Args: - key (str): The name of the Nattribute to remove. - - """ - if key in self._store: - del self._store[key]
- -
[docs] def clear(self): - """ - Remove all NAttributes from handler. - - """ - self._store = {}
- -
[docs] def all(self, return_tuples=False): - """ - List the contents of the handler. - - Args: - return_tuples (bool, optional): Defines if the Nattributes - are returns as a list of keys or as a list of `(key, value)`. - - Returns: - nattributes (list): A list of keys `[key, key, ...]` or a - list of tuples `[(key, value), ...]` depending on the - setting of `return_tuples`. - - """ - if return_tuples: - return [(key, value) for (key, value) in self._store.items() if not key.startswith("_")] - return [key for key in self._store if not key.startswith("_")]
diff --git a/docs/0.9.5/_modules/evennia/typeclasses/managers.html b/docs/0.9.5/_modules/evennia/typeclasses/managers.html index 92df063f5d..3810825c74 100644 --- a/docs/0.9.5/_modules/evennia/typeclasses/managers.html +++ b/docs/0.9.5/_modules/evennia/typeclasses/managers.html @@ -72,17 +72,15 @@ # Attribute manager methods
[docs] def get_attribute( - self, key=None, category=None, value=None, strvalue=None, - obj=None, attrtype=None, **kwargs): + self, key=None, category=None, value=None, strvalue=None, obj=None, attrtype=None, **kwargs + ): """ - Return Attribute objects by key, by category, by value, by - `strvalue`, by object (it is stored on) or with a combination of - those criteria. + Return Attribute objects by key, by category, by value, by strvalue, by + object (it is stored on) or with a combination of those criteria. Args: - key (str, optional): The attribute's key to search for. - category (str, optional): The category of the attribute(s) - to search for. + key (str, optional): The attribute's key to search for + category (str, optional): The category of the attribute(s) to search for. value (str, optional): The attribute value to search for. Note that this is not a very efficient operation since it will query for a pickled entity. Mutually exclusive to @@ -93,13 +91,13 @@ precedence if given. obj (Object, optional): On which object the Attribute to search for is. - attrtype (str, optional): An attribute-type to search for. + attrype (str, optional): An attribute-type to search for. By default this is either `None` (normal Attributes) or `"nick"`. - kwargs (any): Currently unused. Reserved for future use. + **kwargs (any): Currently unused. Reserved for future use. Returns: - attributes (list): The matching Attributes. + list: The matching Attributes. """ dbmodel = self.model.__dbclass__.__name__.lower() @@ -217,7 +215,7 @@ to search for. obj (Object, optional): On which object the Tag to search for is. - tagtype (str, optional): One of None (normal tags), + tagtype (str, optional): One of `None` (normal tags), "alias" or "permission" global_search (bool, optional): Include all possible tags, not just tags on this object @@ -620,7 +618,7 @@ for parent in (parent for parent in parents if hasattr(parent, "path")): query = query | Q(db_typeclass_path__exact=parent.path) # actually query the database - return self.filter(query)
+ return super().filter(query) class TypeclassManager(TypedObjectManager): diff --git a/docs/0.9.5/_modules/evennia/typeclasses/models.html b/docs/0.9.5/_modules/evennia/typeclasses/models.html index 48e843b873..700c534889 100644 --- a/docs/0.9.5/_modules/evennia/typeclasses/models.html +++ b/docs/0.9.5/_modules/evennia/typeclasses/models.html @@ -65,8 +65,6 @@ This module also contains the Managers for the respective models; inherit from these to create custom managers. ----- - """ from django.db.models import signals @@ -79,7 +77,13 @@ from django.utils.encoding import smart_str from django.utils.text import slugify -from evennia.typeclasses.attributes import Attribute, AttributeHandler, NAttributeHandler +from evennia.typeclasses.attributes import ( + Attribute, + AttributeHandler, + ModelAttributeBackend, + InMemoryAttributeBackend, +) +from evennia.typeclasses.attributes import DbHolder from evennia.typeclasses.tags import Tag, TagHandler, AliasHandler, PermissionHandler from evennia.utils.idmapper.models import SharedMemoryModel, SharedMemoryModelBase @@ -203,35 +207,6 @@ return new_class -class DbHolder(object): - """ - Holder for allowing property access of attributes. - - """ - - def __init__(self, obj, name, manager_name="attributes"): - _SA(self, name, _GA(obj, manager_name)) - _SA(self, "name", name) - - def __getattribute__(self, attrname): - if attrname == "all": - # we allow to overload our default .all - attr = _GA(self, _GA(self, "name")).get("all") - return attr if attr else _GA(self, "all") - return _GA(self, _GA(self, "name")).get(attrname) - - def __setattr__(self, attrname, value): - _GA(self, _GA(self, "name")).add(attrname, value) - - def __delattr__(self, attrname): - _GA(self, _GA(self, "name")).remove(attrname) - - def get_all(self): - return _GA(self, _GA(self, "name")).all() - - all = property(get_all) - - # # Main TypedObject abstraction # @@ -355,8 +330,10 @@ than use the one in the model. Args: - *args: Passed through to parent. - **kwargs: Passed through to parent. + Passed through to parent. + + Keyword Args: + Passed through to parent. Notes: The loading mechanism will attempt the following steps: @@ -383,7 +360,7 @@ # initialize all handlers in a lazy fashion
[docs] @lazy_property def attributes(self): - return AttributeHandler(self)
+ return AttributeHandler(self, ModelAttributeBackend)
[docs] @lazy_property def locks(self): @@ -403,7 +380,7 @@
[docs] @lazy_property def nattributes(self): - return NAttributeHandler(self)
+ return AttributeHandler(self, InMemoryAttributeBackend)
[docs] class Meta(object): """ @@ -680,7 +657,7 @@ superuser lock bypass (be careful with this one). Keyword Args: - kwargs (any): Ignored, but is there to make the api + kwar (any): Ignored, but is there to make the api consistent with the object-typeclass method access, which use it to feed to its hook methods. @@ -769,18 +746,18 @@ def __db_get(self): """ Attribute handler wrapper. Allows for the syntax - :: + ```python obj.db.attrname = value - and + # and value = obj.db.attrname - and + # and del obj.db.attrname - and + # and all_attr = obj.db.all() - - (unless there is an attribute named 'all', in which case that will be - returned instead). + # (unless there is an attribute + # named 'all', in which case that will be returned instead). + ``` """ try: @@ -791,14 +768,14 @@ # @db.setter def __db_set(self, value): - """Stop accidentally replacing the db object""" + "Stop accidentally replacing the db object" string = "Cannot assign directly to db object! " string += "Use db.attr=value instead." raise Exception(string) # @db.deleter def __db_del(self): - """Stop accidental deletion.""" + "Stop accidental deletion." raise Exception("Cannot delete the db object!") db = property(__db_get, __db_set, __db_del) @@ -810,23 +787,10 @@ # @property ndb def __ndb_get(self): """ - A non-attr_obj store (NonDataBase). Everything stored to this is - guaranteed to be cleared when a server is shutdown. Syntax is same as - for the `.db` property, e.g. - :: - - obj.ndb.attrname = value - and - value = obj.ndb.attrname - and - del obj.ndb.attrname - and - all_attr = obj.ndb.all() - - What makes this preferable over just assigning properties directly on - the object is that Evennia can track caching for these properties and - for example avoid wiping objects with set `.ndb` data on cache flushes. - + A non-attr_obj store (ndb: NonDataBase). Everything stored + to this is guaranteed to be cleared when a server is shutdown. + Syntax is same as for the _get_db_holder() method and + property, e.g. obj.ndb.attr = value etc. """ try: return self._ndb_holder @@ -931,33 +895,28 @@
[docs] @classmethod def web_get_create_url(cls): """ - Returns the URI path for a View that allows users to create new instances of this object. + ex. Chargen = '/characters/create/' + + For this to work, the developer must have defined a named view somewhere + in urls.py that follows the format 'modelname-action', so in this case + a named view of 'character-create' would be referenced by this method. + + ex. + url(r'characters/create/', ChargenView.as_view(), name='character-create') + + If no View has been created and defined in urls.py, returns an + HTML anchor. + + This method is naive and simply returns a path. Securing access to + the actual view and limiting who can create new objects is the + developer's responsibility. + Returns: path (str): URI path to object creation page, if defined. - Examples: - :: - - Chargen = '/characters/create/' - - For this to work, the developer must have defined a named view somewhere - in urls.py that follows the format 'modelname-action', so in this case - a named view of 'character-create' would be referenced by this method. - :: - - url(r'characters/create/', ChargenView.as_view(), name='character-create') - - If no View has been created and defined in urls.py, returns an - HTML anchor. - - Notes: - This method is naive and simply returns a path. Securing access to - the actual view and limiting who can create new objects is the - developer's responsibility. - """ try: return reverse("%s-create" % slugify(cls._meta.verbose_name)) @@ -973,21 +932,24 @@ path (str): URI path to object detail page, if defined. Examples: - :: - Oscar (Character) = '/characters/oscar/1/' + ```python + Oscar (Character) = '/characters/oscar/1/' + ``` For this to work, the developer must have defined a named view somewhere in urls.py that follows the format 'modelname-action', so in this case a named view of 'character-detail' would be referenced by this method. - :: + + ```python + url(r'characters/(?P<slug>[\w\d\-]+)/(?P<pk>[0-9]+)/$', CharDetailView.as_view(), name='character-detail') + ``` If no View has been created and defined in urls.py, returns an HTML anchor. - Notes: This method is naive and simply returns a path. Securing access to the actual view and limiting who can view this object is the developer's responsibility. @@ -1007,25 +969,26 @@ object. Returns: - path (str): URI path to object puppet page, if defined. + str: URI path to object puppet page, if defined. Examples: - :: - Oscar (Character) = '/characters/oscar/1/puppet/' + ```python + Oscar (Character) = '/characters/oscar/1/puppet/' + ``` For this to work, the developer must have defined a named view somewhere in urls.py that follows the format 'modelname-action', so in this case a named view of 'character-puppet' would be referenced by this method. - :: - url(r'characters/(?P<slug>[\w\d\-]+)/(?P<pk>[0-9]+)/puppet/$', - CharPuppetView.as_view(), name='character-puppet') + ```python + url(r'characters/(?P<slug>[\w\d\-]+)/(?P<pk>[0-9]+)/puppet/$', + CharPuppetView.as_view(), name='character-puppet') + ``` If no View has been created and defined in urls.py, returns an HTML anchor. - Notes: This method is naive and simply returns a path. Securing access to the actual view and limiting who can view this object is the developer's responsibility. @@ -1046,29 +1009,31 @@ object. Returns: - path (str): URI path to object update page, if defined. + str: URI path to object update page, if defined. Examples: - :: - Oscar (Character) = '/characters/oscar/1/change/' + ```python + Oscar (Character) = '/characters/oscar/1/change/' + ``` For this to work, the developer must have defined a named view somewhere in urls.py that follows the format 'modelname-action', so in this case a named view of 'character-update' would be referenced by this method. - :: - url(r'characters/(?P<slug>[\w\d\-]+)/(?P<pk>[0-9]+)/change/$', - CharUpdateView.as_view(), name='character-update') + ```python + url(r'characters/(?P<slug>[\w\d\-]+)/(?P<pk>[0-9]+)/change/$', + CharUpdateView.as_view(), name='character-update') + ``` If no View has been created and defined in urls.py, returns an HTML anchor. - Notes: This method is naive and simply returns a path. Securing access to the actual view and limiting who can modify objects is the developer's responsibility. + """ try: return reverse( @@ -1086,25 +1051,27 @@ path (str): URI path to object deletion page, if defined. Examples: - :: - Oscar (Character) = '/characters/oscar/1/delete/' + ```python + Oscar (Character) = '/characters/oscar/1/delete/' + ``` - For this to work, the developer must have defined a named view somewhere - in urls.py that follows the format 'modelname-action', so in this case - a named view of 'character-detail' would be referenced by this method. - :: + For this to work, the developer must have defined a named view + somewhere in urls.py that follows the format 'modelname-action', so + in this case a named view of 'character-detail' would be referenced + by this method. - url(r'characters/(?P<slug>[\w\d\-]+)/(?P<pk>[0-9]+)/delete/$', - CharDeleteView.as_view(), name='character-delete') + ```python + url(r'characters/(?P<slug>[\w\d\-]+)/(?P<pk>[0-9]+)/delete/$', + CharDeleteView.as_view(), name='character-delete') + ``` - If no View has been created and defined in urls.py, returns an - HTML anchor. + If no View has been created and defined in urls.py, returns an HTML + anchor. - Notes: This method is naive and simply returns a path. Securing access to - the actual view and limiting who can delete this object is the developer's - responsibility. + the actual view and limiting who can delete this object is the + developer's responsibility. """ diff --git a/docs/0.9.5/_modules/evennia/typeclasses/tags.html b/docs/0.9.5/_modules/evennia/typeclasses/tags.html index 1b559d1695..2dd61cd59d 100644 --- a/docs/0.9.5/_modules/evennia/typeclasses/tags.html +++ b/docs/0.9.5/_modules/evennia/typeclasses/tags.html @@ -360,6 +360,40 @@ getattr(self.obj, self._m2m_fieldname).add(tagobj) self._setcache(tagstr, category, tagobj)
+
[docs] def has(self, tag=None, category=None, return_list=False): + """ + Checks if the given Tag (or list of Tags) exists on the object. + + Args: + tag (str or iterable): The Tag key or tags to check for. + If `None`, search by category. + category (str, optional): Limit the check to Tags with this + category (note, that `None` is the default category). + + Returns: + has_tag (bool or list): If the Tag exists on this object or not. + If `tag` was given as an iterable then the return is a list of booleans. + + Raises: + ValueError: If neither `tag` nor `category` is given. + + """ + ret = [] + category = category.strip().lower() if category is not None else None + if tag: + for tag_str in make_iter(tag): + tag_str = tag_str.strip().lower() + ret.extend(bool(tag) for tag in self._getcache(tag_str, category)) + elif category: + ret.extend(bool(tag) for tag in self._getcache(category=category)) + else: + raise ValueError("Either tag or category must be provided.") + + if return_list: + return ret + + return ret[0] if len(ret) == 1 else ret
+
[docs] def get(self, key=None, default=None, category=None, return_tagobj=False, return_list=False): """ Get the tag for the given key, category or combination of the two. diff --git a/docs/0.9.5/_modules/evennia/utils/ansi.html b/docs/0.9.5/_modules/evennia/utils/ansi.html index 3bedc2d5a9..55de3aede5 100644 --- a/docs/0.9.5/_modules/evennia/utils/ansi.html +++ b/docs/0.9.5/_modules/evennia/utils/ansi.html @@ -42,20 +42,19 @@ """ ANSI - Gives colour to text. -Use the codes defined in ANSIPARSER in your text to apply colour to text -according to the ANSI standard. -:: +Use the codes defined in ANSIPARSER in your text +to apply colour to text according to the ANSI standard. - This is |rRed text|n and this is normal again. +Examples: -Mostly you should not need to call `parse_ansi()` explicitly; it is run by -Evennia just before returning data to/from the user. Depreciated/decativated -example forms are available in contribs by extending the ansi mapping +```python +"This is |rRed text|n and this is normal again." +``` -This module also contains the `ANSIString` custom string-type, which correctly -wraps/manipulates and tracks lengths of strings containing ANSI-markup. - ----- +Mostly you should not need to call `parse_ansi()` explicitly; +it is run by Evennia just before returning data to/from the +user. Depreciated example forms are available by extending +the ansi mapping. """ import functools @@ -123,14 +122,16 @@
[docs]class ANSIParser(object): """ - A class that parses ANSI markup to ANSI command sequences + A class that parses ANSI markup + to ANSI command sequences - We also allow to escape colour codes by prepending with - an extra `|`, so `||r` will literally print `|r`. + We also allow to escape colour codes + by prepending with a \ for xterm256, + an extra | for Merc-style codes """ - # Mapping using |r, |n etc + # Mapping using {r {n etc ansi_map = [ # alternative |-format @@ -629,9 +630,10 @@ def _transform(func_name): """ - Some string functions, like those manipulating capital letters, return a - string the same length as the original. This function allows us to do the - same, replacing all the non-coded characters with the resulting string. + Some string functions, like those manipulating capital letters, + return a string the same length as the original. This function + allows us to do the same, replacing all the non-coded characters + with the resulting string. """ @@ -864,7 +866,7 @@ """ if not offset: - return [] + return iterable return [i + offset for i in iterable] @classmethod @@ -1026,12 +1028,9 @@ occurrence of the separator rather than the first. Returns: - result (tuple): - - prefix (ANSIString): The part of the string before the - separator - - sep (ANSIString): The separator itself - - postfix (ANSIString): The part of the string after the - separator. + ANSIString: The part of the string before the separator + ANSIString: The separator itself + ANSIString: The part of the string after the separator. """ if hasattr(sep, "_clean_string"): @@ -1330,27 +1329,23 @@ Joins together strings in an iterable, using this string between each one. + NOTE: This should always be used for joining strings when ANSIStrings + are involved. Otherwise color information will be discarded by python, + due to details in the C implementation of strings. + Args: iterable (list of strings): A list of strings to join together Returns: - result (ANSIString): A single string with all of the iterable's + ANSIString: A single string with all of the iterable's contents concatenated, with this string between each. Examples: :: - ANSIString(', ').join(['up', 'right', 'left', 'down']) - - Would return - :: + >>> ANSIString(', ').join(['up', 'right', 'left', 'down']) ANSIString('up, right, left, down') - Notes: - This should always be used for joining strings when ANSIStrings are - involved. Otherwise color information will be discarded by python, - due to details in the C implementation of strings. - """ result = ANSIString("") last_item = None diff --git a/docs/0.9.5/_modules/evennia/utils/batchprocessors.html b/docs/0.9.5/_modules/evennia/utils/batchprocessors.html index 660cd405fc..1fca9ac530 100644 --- a/docs/0.9.5/_modules/evennia/utils/batchprocessors.html +++ b/docs/0.9.5/_modules/evennia/utils/batchprocessors.html @@ -41,24 +41,22 @@

Source code for evennia.utils.batchprocessors

 """
 This module contains the core methods for the Batch-command- and
-Batch-code-processors respectively. In short, these are two different
-ways to build a game world using a normal text-editor without having
-to do so 'on the fly' in-game. They also serve as an automatic backup
-so you can quickly recreate a world also after a server reset. The
-functions in this module is meant to form the backbone of a system
-called and accessed through game commands.
+Batch-code-processors respectively. In short, these are two different ways to
+build a game world using a normal text-editor without having to do so 'on the
+fly' in-game. They also serve as an automatic backup so you can quickly
+recreate a world also after a server reset. The functions in this module is
+meant to form the backbone of a system called and accessed through game
+commands.
 
-The Batch-command processor is the simplest. It simply runs a list of
-in-game commands in sequence by reading them from a text file. The
-advantage of this is that the builder only need to remember the normal
-in-game commands. They are also executing with full permission checks
-etc, making it relatively safe for builders to use. The drawback is
-that in-game there is really a builder-character walking around
-building things, and it can be important to create rooms and objects
-in the right order, so the character can move between them. Also
-objects that affects players (such as mobs, dark rooms etc) will
-affect the building character too, requiring extra care to turn
-off/on.
+The Batch-command processor is the simplest. It simply runs a list of in-game
+commands in sequence by reading them from a text file. The advantage of this is
+that the builder only need to remember the normal in-game commands. They are
+also executing with full permission checks etc, making it relatively safe for
+builders to use. The drawback is that in-game there is really a
+builder-character walking around building things, and it can be important to
+create rooms and objects in the right order, so the character can move between
+them. Also objects that affects players (such as mobs, dark rooms etc) will
+affect the building character too, requiring extra care to turn off/on.
 
 The Batch-code processor is a more advanced system that accepts full
 Python code, executing in chunks. The advantage of this is much more
@@ -72,8 +70,7 @@
 recommended that the batch-code processor is limited only to
 superusers or highly trusted staff.
 
-Batch-Command processor file syntax
------------------------------------
+# Batch-command processor file syntax
 
 The batch-command processor accepts 'batchcommand files' e.g
 `batch.ev`, containing a sequence of valid Evennia commands in a
@@ -81,31 +78,39 @@
 had been run at the game prompt.
 
 Each Evennia command must be delimited by a line comment to mark its
-end. This way entire game worlds can be created and planned offline; it is
+end.
+
+::
+
+    look
+    # delimiting comment
+    create/drop box
+    # another required comment
+
+One can also inject another batchcmdfile:
+
+::
+
+    #INSERT path.batchcmdfile
+
+This way entire game worlds can be created and planned offline; it is
 especially useful in order to create long room descriptions where a
 real offline text editor is often much better than any online text
 editor or prompt.
 
-There is only one batchcommand-specific entry to use in a batch-command
-files (all others are just like in-game commands):
+## Example of batch.ev file:
 
-- `#INSERT path.batchcmdfile` - this as the first entry on a line will
-  import and run a batch.ev file in this position, as if it was
-  written in this file.
-
-
-Example of batch.ev file:
 ::
 
     # batch file
     # all lines starting with # are comments; they also indicate
     # that a command definition is over.
 
-    @create box
+    create box
 
     # this comment ends the @create command.
 
-    @set box/desc = A large box.
+    set box/desc = A large box.
 
     Inside are some scattered piles of clothing.
 
@@ -117,25 +122,22 @@
     # is ignored.  An empty line in the command definition is parsed as a \n
     # (so two empty lines becomes a new paragraph).
 
-    @teleport #221
+    teleport #221
 
     # (Assuming #221 is a warehouse or something.)
     # (remember, this comment ends the @teleport command! Don'f forget it)
 
     # Example of importing another file at this point.
-    #INSERT examples.batch
+    #IMPORT examples.batch
 
-    @drop box
+    drop box
 
     # Done, the box is in the warehouse! (this last comment is not necessary to
-    # close the @drop command since it's the end of the file)
-
+    # close the drop command since it's the end of the file)
 
 An example batch file is `contrib/examples/batch_example.ev`.
 
-
-Batch-Code processor file syntax
---------------------------------
+# Batch-code processor file syntax
 
 The Batch-code processor accepts full python modules (e.g. `batch.py`)
 that looks identical to normal Python files. The difference from
@@ -169,13 +171,14 @@
 Importing works as normal. The following variables are automatically
 made available in the script namespace.
 
-- `caller` -  The object executing the batchscript
+- `caller` - The object executing the batchscript
 - `DEBUG` - This is a boolean marking if the batchprocessor is running
-  in debug mode. It can be checked to e.g. delete created objects
-  when running a CODE block multiple times during testing.
-  (avoids creating a slew of same-named db objects)
+            in debug mode. It can be checked to e.g. delete created objects
+            when running a CODE block multiple times during testing.
+            (avoids creating a slew of same-named db objects)
+
+## Example batch.py file
 
-Example batch.py file:
 ::
 
     #HEADER
@@ -204,8 +207,6 @@
 
     script = create.create_script()
 
-----
-
 """
 import re
 import codecs
@@ -243,7 +244,7 @@
         file_ending (str): The file ending of this file (.ev or .py)
 
     Returns:
-        str: The text content of the batch file.
+        text (str): The text content of the batch file.
 
     Raises:
         IOError: If problems reading file.
@@ -290,22 +291,30 @@
 
 
[docs] def parse_file(self, pythonpath): """ - This parses the lines of a batchfile according to the following - rules: + This parses the lines of a batch-command-file. - 1. `#` at the beginning of a line marks the end of the command before - it. It is also a comment and any number of # can exist on - subsequent lines (but not inside comments). - 2. `#INSERT` at the beginning of a line imports another - batch-cmd file file and pastes it into the batch file as if - it was written there. - 3. Commands are placed alone at the beginning of a line and their - arguments are considered to be everything following (on any - number of lines) until the next comment line beginning with #. - 4. Newlines are ignored in command definitions - 5. A completely empty line in a command line definition is condered - a newline (so two empty lines is a paragraph). - 6. Excess spaces and indents inside arguments are stripped. + Args: + pythonpath (str): The dot-python path to the file. + + Returns: + list: A list of all parsed commands with arguments, as strings. + + Notes: + Parsing follows the following rules: + + 1. A `#` at the beginning of a line marks the end of the command before + it. It is also a comment and any number of # can exist on + subsequent lines (but not inside comments). + 2. #INSERT at the beginning of a line imports another + batch-cmd file file and pastes it into the batch file as if + it was written there. + 3. Commands are placed alone at the beginning of a line and their + arguments are considered to be everything following (on any + number of lines) until the next comment line beginning with #. + 4. Newlines are ignored in command definitions + 5. A completely empty line in a command line definition is condered + a newline (so two empty lines is a paragraph). + 6. Excess spaces and indents inside arguments are stripped. """ @@ -354,21 +363,23 @@
[docs] def parse_file(self, pythonpath): """ - This parses the lines of a batchfile according to the following - rules: + This parses the lines of a batch-code file Args: pythonpath (str): The dot-python path to the file. Returns: - codeblocks (list): A list of all #CODE blocks, each with - prepended #HEADER data. If no #CODE blocks were found, - this will be a list of one element. + list: A list of all `#CODE` blocks, each with + prepended `#HEADER` block data. If no `#CODE` + blocks were found, this will be a list of one element + containing all code in the file (so a normal Python file). Notes: + Parsing is done according to the following rules: + 1. Code before a #CODE/HEADER block are considered part of - the first code/header block or is the ONLY block if no - #CODE/HEADER blocks are defined. + the first code/header block or is the ONLY block if no + `#CODE/HEADER` blocks are defined. 2. Lines starting with #HEADER starts a header block (ends other blocks) 3. Lines starting with #CODE begins a code block (ends other blocks) 4. Lines starting with #INSERT are on form #INSERT filename. Code from @@ -377,6 +388,7 @@ 5. Code after the last block is considered part of the last header/code block + """ text = "".join(read_batchfile(pythonpath, file_ending=".py")) diff --git a/docs/0.9.5/_modules/evennia/utils/create.html b/docs/0.9.5/_modules/evennia/utils/create.html index 4ad97ca7a5..1e64879456 100644 --- a/docs/0.9.5/_modules/evennia/utils/create.html +++ b/docs/0.9.5/_modules/evennia/utils/create.html @@ -40,27 +40,19 @@

Source code for evennia.utils.create

 """
-This module gathers all the essential database-creation
-functions for the game engine's various object types.
+This module gathers all the essential database-creation functions for the game
+engine's various object types.
 
-Only objects created 'stand-alone' are in here, e.g. object Attributes
-are always created directly through their respective objects.
+Only objects created 'stand-alone' are in here. E.g. object Attributes are
+always created through their respective objects handlers.
 
-Each creation_* function also has an alias named for the entity being
-created, such as create_object() and object().  This is for
-consistency with the utils.search module and allows you to do the
-shorter "create.object()".
+Each `creation_*` function also has an alias named for the entity being created,
+such as create_object() and object(). This is for consistency with the
+utils.search module and allows you to do the shorter `create.object()`.
 
-The respective object managers hold more methods for manipulating and
-searching objects already existing in the database.
+The respective object managers hold more methods for manipulating and searching
+objects already existing in the database.
 
-Models covered:
- Objects
- Scripts
- Help
- Message
- Channel
- Accounts
 """
 from django.conf import settings
 from django.db import IntegrityError
@@ -122,22 +114,21 @@
     Keyword Args:
         typeclass (class or str): Class or python path to a typeclass.
         key (str): Name of the new object. If not set, a name of
-            #dbref will be set.
+            `#dbref` will be set.
         home (Object or str): Obj or #dbref to use as the object's
             home location.
         permissions (list): A list of permission strings or tuples (permstring, category).
         locks (str): one or more lockstrings, separated by semicolons.
         aliases (list): A list of alternative keys or tuples (aliasstring, category).
         tags (list): List of tag keys or tuples (tagkey, category) or (tagkey, category, data).
-        destination (Object or str): Obj or #dbref to use as an Exit's
-            target.
+        destination (Object or str): Obj or #dbref to use as an Exit's target.
         report_to (Object): The object to return error messages to.
         nohome (bool): This allows the creation of objects without a
             default home location; only used when creating the default
             location itself or during unittests.
         attributes (list): Tuples on the form (key, value) or (key, value, category),
-           (key, value, lockstring) or (key, value, lockstring, default_access).
-           to set as Attributes on the new object.
+            (key, value, lockstring) or (key, value, lockstring, default_access).
+            to set as Attributes on the new object.
         nattributes (list): Non-persistent tuples on the form (key, value). Note that
             adding this rarely makes sense since this data will not survive a reload.
 
diff --git a/docs/0.9.5/_modules/evennia/utils/dbserialize.html b/docs/0.9.5/_modules/evennia/utils/dbserialize.html
index 40a9db2e93..74cfe2cee8 100644
--- a/docs/0.9.5/_modules/evennia/utils/dbserialize.html
+++ b/docs/0.9.5/_modules/evennia/utils/dbserialize.html
@@ -653,7 +653,7 @@
             that saves assigned data to the database. Skip if not
             serializing onto a given object.  If db_obj is given, this
             function will convert lists, dicts and sets to their
-            `_SaverList`, `_SaverDict` and `_SaverSet` counterparts.
+            _SaverList, _SaverDict and _SaverSet counterparts.
 
     Returns:
         data (any): Unpickled data.
diff --git a/docs/0.9.5/_modules/evennia/utils/eveditor.html b/docs/0.9.5/_modules/evennia/utils/eveditor.html
index 8a073d4ab6..53c2cbaca6 100644
--- a/docs/0.9.5/_modules/evennia/utils/eveditor.html
+++ b/docs/0.9.5/_modules/evennia/utils/eveditor.html
@@ -42,47 +42,42 @@
 """
 EvEditor (Evennia Line Editor)
 
-This implements an advanced line editor for editing longer texts
-in-game. The editor mimics the command mechanisms of the "VI" editor
-(a famous line-by-line editor) as far as reasonable.
+This implements an advanced line editor for editing longer texts in-game. The
+editor mimics the command mechanisms of the "VI" editor (a famous line-by-line
+editor) as far as reasonable.
 
 Features of the editor:
 
- - undo/redo.
- - edit/replace on any line of the buffer.
- - search&replace text anywhere in buffer.
- - formatting of buffer, or selection, to certain width + indentations.
- - allow to echo the input or not, depending on your client.
+- undo/redo.
+- edit/replace on any line of the buffer.
+- search&replace text anywhere in buffer.
+- formatting of buffer, or selection, to certain width + indentations.
+- allow to echo the input or not, depending on your client.
+- in-built help
 
-To use the editor, just import EvEditor from this module
-and initialize it:
-::
+To use the editor, just import EvEditor from this module and initialize it:
 
-    from evennia.utils.eveditor import EvEditor
-    EvEditor(caller, loadfunc=None, savefunc=None, quitfunc=None, key="", persistent=True)
+```python
+from evennia.utils.eveditor import EvEditor
 
-- `caller` is the user of the editor, the one to see all feedback.
-- `loadfunc(caller)` is called when the editor is first launched; the
-  return from this function is loaded as the starting buffer in the
-  editor.
-- `safefunc(caller, buffer)` is called with the current buffer when
-  saving in the editor. The function should return True/False depending
-  on if the saving was successful or not.
-- `quitfunc(caller)` is called when the editor exits. If this is given,
-  no automatic quit messages will be given.
-- `key` is an optional identifier for the editing session, to be
-  displayed in the editor.
-- `persistent` means the editor state will be saved to the database making it
-  survive a server reload. Note that using this mode, the load- save-
-  and quit-funcs must all be possible to pickle - notable unusable
-  callables are class methods and functions defined inside other
-  functions. With persistent=False, no such restriction exists.
-- `code` set to True activates features on the EvEditor to enter Python code.
+# set up an editor to edit the caller's 'desc' Attribute
+def _loadfunc(caller):
+    return caller.db.desc
 
-In addition, the EvEditor can be used to enter Python source code,
-and offers basic handling of indentation.
+def _savefunc(caller, buffer):
+    caller.db.desc = buffer.strip()
+    return True
 
-----
+def _quitfunc(caller):
+    caller.msg("Custom quit message")
+
+# start the editor
+EvEditor(caller, loadfunc=None, savefunc=None, quitfunc=None, key="",
+         persistent=True, code=False)
+```
+
+The editor can also be used to format Python code and be made to
+survive a reload. See the `EvEditor` class for more details.
 
 """
 import re
@@ -270,17 +265,18 @@
 
 
[docs] def parse(self): """ - Handles pre-parsing + Handles pre-parsing. Editor commands are on the form + + :: - Usage: :cmd [li] [w] [txt] Where all arguments are optional. - - li - line number (int), starting from 1. This could also - be a range given as <l>:<l>. - - w - word(s) (string), could be encased in quotes. - - txt - extra text (string), could be encased in quotes. + - `li` - line number (int), starting from 1. This could also + be a range given as <l>:<l>. + - `w` - word(s) (string), could be encased in quotes. + - `txt` - extra text (string), could be encased in quotes. """ diff --git a/docs/0.9.5/_modules/evennia/utils/evform.html b/docs/0.9.5/_modules/evennia/utils/evform.html index 5e864e18ce..adfc009fbe 100644 --- a/docs/0.9.5/_modules/evennia/utils/evform.html +++ b/docs/0.9.5/_modules/evennia/utils/evform.html @@ -54,32 +54,34 @@ object when displaying the form. Example of input file `testform.py`: -:: - FORMCHAR = "x" - TABLECHAR = "c" +```python +FORMCHAR = "x" +TABLECHAR = "c" - FORM = ''' - .------------------------------------------------. - | | - | Name: xxxxx1xxxxx Player: xxxxxxx2xxxxxxx | - | xxxxxxxxxxx | - | | - >----------------------------------------------< - | | - | Desc: xxxxxxxxxxx STR: x4x DEX: x5x | - | xxxxx3xxxxx INT: x6x STA: x7x | - | xxxxxxxxxxx LUC: x8x MAG: x9x | - | | - >----------------------------------------------< - | | | - | cccccccc | ccccccccccccccccccccccccccccccccccc | - | cccccccc | ccccccccccccccccccccccccccccccccccc | - | cccAcccc | ccccccccccccccccccccccccccccccccccc | - | cccccccc | ccccccccccccccccccccccccccccccccccc | - | cccccccc | cccccccccccccccccBccccccccccccccccc | - | | | - ------------------------------------------------- +FORM = ''' +.------------------------------------------------. +| | +| Name: xxxxx1xxxxx Player: xxxxxxx2xxxxxxx | +| xxxxxxxxxxx | +| | + >----------------------------------------------< +| | +| Desc: xxxxxxxxxxx STR: x4x DEX: x5x | +| xxxxx3xxxxx INT: x6x STA: x7x | +| xxxxxxxxxxx LUC: x8x MAG: x9x | +| | + >----------------------------------------------< +| | | +| cccccccc | ccccccccccccccccccccccccccccccccccc | +| cccccccc | ccccccccccccccccccccccccccccccccccc | +| cccAcccc | ccccccccccccccccccccccccccccccccccc | +| cccccccc | ccccccccccccccccccccccccccccccccccc | +| cccccccc | cccccccccccccccccBccccccccccccccccc | +| | | +------------------------------------------------- +''' +``` The first line of the `FORM` string is ignored. The forms and table markers must mark out complete, unbroken rectangles, each containing @@ -93,8 +95,8 @@ Use as follows: -:: +```python from evennia import EvForm, EvTable # create a new form from the template @@ -126,9 +128,10 @@ "B": tableB}) print(form) - +``` This produces the following result: + :: .------------------------------------------------. @@ -152,7 +155,6 @@ | | | ------------------------------------------------ - The marked forms have been replaced with EvCells of text and with EvTables. The form can be updated by simply re-applying `form.map()` with the updated data. @@ -227,15 +229,16 @@
[docs] def __init__(self, filename=None, cells=None, tables=None, form=None, **kwargs): """ - Initiate the form. + Initiate the form Keyword Args: filename (str): Path to template file. - cells (dict): A dictionary mapping of `{id:text}`. - tables (dict): A dictionary mapping of `{id:EvTable}`. - form (dict): A dictionary of - `{"FORMCHAR":char, "TABLECHAR":char, "FORM":templatestring}`. - if this is given, filename is not read. + cells (dict): A dictionary mapping `{id: text}` + tables (dict): A dictionary mapping `{id: EvTable}`. + form (dict): A dictionary + `{"FORMCHAR":char, "TABLECHAR":char, "FORM":templatestring}`. + If this is given, filename is not read. + Notes: Other kwargs are fed as options to the EvCells and EvTables (see `evtable.EvCell` and `evtable.EvTable` for more info). diff --git a/docs/0.9.5/_modules/evennia/utils/evmenu.html b/docs/0.9.5/_modules/evennia/utils/evmenu.html index 880248de9b..14bfcdb5fd 100644 --- a/docs/0.9.5/_modules/evennia/utils/evmenu.html +++ b/docs/0.9.5/_modules/evennia/utils/evmenu.html @@ -40,12 +40,14 @@

Source code for evennia.utils.evmenu

 """
-The EvMenu is a full in-game menu system for Evennia.
+EvMenu
+
+This implements a full menu system for Evennia.
 
 To start the menu, just import the EvMenu class from this module.
-
 Example usage:
-::
+
+```python
 
     from evennia.utils.evmenu import EvMenu
 
@@ -53,10 +55,11 @@
          startnode="node1",
          cmdset_mergetype="Replace", cmdset_priority=1,
          auto_quit=True, cmd_on_exit="look", persistent=True)
+```
 
 Where `caller` is the Object to use the menu on - it will get a new
-cmdset while using the Menu. The `menu_module_path` is the python path
-to a python module containing function definitions. By adjusting the
+cmdset while using the Menu. The menu_module_path is the python path
+to a python module containing function definitions.  By adjusting the
 keyword options of the Menu() initialization call you can start the
 menu at different places in the menu definition file, adjust if the
 menu command should overload the normal commands or not, etc.
@@ -70,7 +73,8 @@
 
 The menu is defined in a module (this can be the same module as the
 command definition too) with function definitions:
-::
+
+```python
 
     def node1(caller):
         # (this is the start node if called like above)
@@ -84,8 +88,9 @@
     def another_node(caller, input_string, **kwargs):
         # code
         return text, options
+```
 
-Where `caller` is the object using the menu and input_string is the
+Where caller is the object using the menu and input_string is the
 command entered by the user on the *previous* node (the command
 entered to get to this node). The node function code will only be
 executed once per node-visit and the system will accept nodes with
@@ -102,42 +107,42 @@
 menu is immediately exited and the default "look" command is called.
 
 - `text` (str, tuple or None): Text shown at this node. If a tuple, the
-  second element in the tuple is a help text to display at this
-  node when the user enters the menu help command there.
+   second element in the tuple is a help text to display at this
+   node when the user enters the menu help command there.
 - `options` (tuple, dict or None): If `None`, this exits the menu.
   If a single dict, this is a single-option node. If a tuple,
-  it should be a tuple of option dictionaries. Option dicts have
-  the following keys:
+  it should be a tuple of option dictionaries. Option dicts have the following keys:
 
   - `key` (str or tuple, optional): What to enter to choose this option.
-      If a tuple, it must be a tuple of strings, where the first string is the
-      key which will be shown to the user and the others are aliases.
-      If unset, the options' number will be used. The special key `_default`
-      marks this option as the default fallback when no other option matches
-      the user input. There can only be one `_default` option per node. It
-      will not be displayed in the list.
+    If a tuple, it must be a tuple of strings, where the first string is the
+    key which will be shown to the user and the others are aliases.
+    If unset, the options' number will be used. The special key `_default`
+    marks this option as the default fallback when no other option matches
+    the user input. There can only be one `_default` option per node. It
+    will not be displayed in the list.
   - `desc` (str, optional): This describes what choosing the option will do.
   - `goto` (str, tuple or callable): If string, should be the name of node to go to
-      when this option is selected. If a callable, it has the signature
-      `callable(caller[,raw_input][,**kwargs])`. If a tuple, the first element
-      is the callable and the second is a dict with the kwargs to pass to
-      the callable. Those kwargs will also be passed into the next node if possible.
-      Such a callable should return either a str or a (str, dict), where the
-      string is the name of the next node to go to and the dict is the new,
-      (possibly modified) kwarg to pass into the next node. If the callable returns
-      None or the empty string, the current node will be revisited.
+    when this option is selected. If a callable, it has the signature
+    `callable(caller[,raw_input][,**kwargs])`. If a tuple, the first element
+    is the callable and the second is a dict with the `**kwargs` to pass to
+    the callable. Those kwargs will also be passed into the next node if possible.
+    Such a callable should return either a str or a (str, dict), where the
+    string is the name of the next node to go to and the dict is the new,
+    (possibly modified) kwarg to pass into the next node. If the callable returns
+    None or the empty string, the current node will be revisited.
   - `exec` (str, callable or tuple, optional): This takes the same input as `goto` above
-      and runs before it. If given a node name, the node will be executed but will not
-      be considered the next node. If node/callback returns str or (str, dict), these will
-      replace the `goto` step (`goto` callbacks will not fire), with the string being the
-      next node name and the optional dict acting as the kwargs-input for the next node.
-      If an exec callable returns `None`, the current node is re-run.
+    and runs before it. If given a node name, the node will be executed but will not
+    be considered the next node. If node/callback returns str or (str, dict), these will
+    replace the `goto` step (`goto` callbacks will not fire), with the string being the
+    next node name and the optional dict acting as the kwargs-input for the next node.
+    If an exec callable returns the empty string (only), the current node is re-run.
 
-If key is not given, the option will automatically be identified by
+If `key` is not given, the option will automatically be identified by
 its number 1..N.
 
 Example:
-::
+
+```python
 
     # in menu_module.py
 
@@ -173,8 +178,11 @@
         text = "This ends the menu since there are no options."
         return text, None
 
+```
+
 When starting this menu with  `Menu(caller, "path.to.menu_module")`,
 the first node will look something like this:
+
 ::
 
     This is a node text
@@ -193,9 +201,8 @@
 reaching a node without any options.
 
 
-For a menu demo, import CmdTestMenu from this module and add it to
-your default cmdset. Run it with this module, like `testmenu
-evennia.utils.evmenu`.
+For a menu demo, import `CmdTestMenu` from this module and add it to
+your default cmdset. Run it with this module, like `testmenu evennia.utils.evmenu`.
 
 
 ## Menu generation from template string
@@ -211,10 +218,13 @@
 For maximum flexibility you can inject normally-created nodes in the menu tree
 before passing it to EvMenu. If that's not needed, you can also create a menu
 in one step with:
-::
+
+```python
 
     evmenu.template2menu(caller, menu_template, goto_callables)
 
+```
+
 The `goto_callables` is a mapping `{"funcname": callable, ...}`, where each
 callable must be a module-global function on the form
 `funcname(caller, raw_string, **kwargs)` (like any goto-callable). The
@@ -292,9 +302,9 @@
 key:values will be converted to strings/numbers with literal_eval before passed
 into the callable.
 
-The "> " option takes a glob or regex to perform different actions depending on user
-input. Make sure to sort these in increasing order of generality since they
-will be tested in sequence.
+The \\> option takes a glob or regex to perform different actions depending
+on user input. Make sure to sort these in increasing order of generality since
+they will be tested in sequence.
 
 ----
 
@@ -573,9 +583,7 @@
                 by default in all nodes of the menu. This will print out the current state of
                 the menu. Deactivate for production use! When the debug flag is active, the
                 `persistent` flag is deactivated.
-
-        Keyword Args:
-            any (any): All kwargs will become initialization variables on `caller.ndb._evmenu`,
+            **kwargs: All kwargs will become initialization variables on `caller.ndb._menutree`,
                 to be available at run.
 
         Raises:
@@ -775,30 +783,6 @@
         Call a node-like callable, with a variable number of raw_string, *args, **kwargs, all of
         which should work also if not present (only `caller` is always required). Return its result.
 
-        Viable node-like callable forms:
-        ::
-
-            _callname(caller)
-            _callname(caller, raw_string)
-            _callname(caller, **kwargs)
-            _callname(caller, raw_string, **kwargs)
-
-        If this is a node:
-
-        - `caller` is the one using the menu.
-        - `raw_string` is the users exact input on the *previous* node.
-        - `**kwargs` is either passed through the previous node or returned
-          along with the node name from the goto-callable leading to this node.
-
-        If this is a goto-callable:
-
-        - `caller` is the one using the menu.
-        - `raw_string` is the user's exact input when chosing the option that triggered
-          this goto-callable.
-        - `**kwargs` is any extra dict passed to the callable in the option
-          definition, or (if no explit kwarg was given to the callable) the
-          previous node's kwarg, if any.
-
         """
         try:
             try:
@@ -1003,8 +987,7 @@
             raw_string (str): The raw default string entered on the
                 previous node (only used if the node accepts it as an
                 argument)
-        Keyword Args:
-            any: Extra arguments to goto callables.
+            **kwargs: Extra arguments to goto callables.
 
         """
 
@@ -1377,33 +1360,29 @@
         option_generator (callable or list): A list of strings indicating the options, or a callable
             that is called as option_generator(caller) to produce such a list.
         select (callable or str, optional): Node to redirect a selection to. Its `**kwargs` will
-            contain the `available_choices` list and `selection` will hold one
-            of the elements in that list.  If a callable, it will be called as
-            `select(caller, menuchoice, **kwargs)` where menuchoice is the
-            chosen option as a string and `available_choices` is the list of available
-            options offered by the option_generator. The callable whould return
-            the name of the target node to goto after this selection (or None to repeat the
-            list-node).  Note that if this is not given, the decorated node
-            must itself provide a way to continue from the node!
+            contain the `available_choices` list and `selection` will hold one of the elements in
+            that list.  If a callable, it will be called as
+            `select(caller, menuchoice, **kwargs)` where menuchoice is the chosen option as a
+            string and `available_choices` is a kwarg mapping the option keys to the choices
+            offered by the option_generator. The callable whould return the name of the target node
+            to goto after this selection (or None to repeat the list-node). Note that if this is not
+            given, the decorated node must itself provide a way to continue from the node!
         pagesize (int): How many options to show per page.
 
     Example:
-        ::
 
-            def _selectfunc(caller, menuchoice, **kwargs):
-                # menuchoice would be either 'foo' or 'bar' here
-                # kwargs['available_choices'] would be the list ['foo', 'bar']
-                return "the_next_node_to_go_to"
-
-            @list_node(['foo', 'bar'], _selectfunc)
-            def node_index(caller):
-                text = "describing the list"
-                return text, []
+        ```python
+        list_node(['foo', 'bar'], select)
+        def node_index(caller):
+            text = "describing the list"
+            return text, []
+        ```
 
     Notes:
-        All normal `goto` or `exec` callables returned from the decorated nodes will, if they accept
-        `**kwargs`, get a new kwarg `available_choices` injected. This is the ordered list of named
-        options (descs) visible on the current node page.
+        All normal `goto` or `exec` callables returned from the decorated nodes
+        will, if they accept `**kwargs`, get a new kwarg 'available_choices'
+        injected. These are the ordered list of named options (descs) visible
+        on the current node page.
 
     """
 
@@ -1624,60 +1603,51 @@
 
 
[docs]def get_input(caller, prompt, callback, session=None, *args, **kwargs): """ - This is a helper function for easily request input from - the caller. + This is a helper function for easily request input from the caller. Args: - caller (Account or Object): The entity being asked - the question. This should usually be an object - controlled by a user. - prompt (str): This text will be shown to the user, - in order to let them know their input is needed. + caller (Account or Object): The entity being asked the question. This + should usually be an object controlled by a user. + prompt (str): This text will be shown to the user, in order to let them + know their input is needed. callback (callable): A function that will be called - when the user enters a reply. It must take three - arguments: the `caller`, the `prompt` text and the - `result` of the input given by the user. If the - callback doesn't return anything or return False, - the input prompt will be cleaned up and exited. If - returning True, the prompt will remain and continue to - accept input. + when the user enters a reply. It must take three arguments: the + `caller`, the `prompt` text and the `result` of the input given by + the user. If the callback doesn't return anything or return False, + the input prompt will be cleaned up and exited. If returning True, + the prompt will remain and continue to accept input. session (Session, optional): This allows to specify the - session to send the prompt to. It's usually only - needed if `caller` is an Account in multisession modes - greater than 2. The session is then updated by the - command and is available (for example in callbacks) - through `caller.ndb.getinput._session`. - args, kwargs (optional): Extra arguments will be - passed to the fall back function as a list 'args' - and all keyword arguments as a dictionary 'kwargs'. - To utilise `*args` and `**kwargs`, a value for the - session argument must be provided (None by default) - and the callback function must take `*args` and - `**kwargs` as arguments. + session to send the prompt to. It's usually only needed if `caller` + is an Account in multisession modes greater than 2. The session is + then updated by the command and is available (for example in + callbacks) through `caller.ndb.getinput._session`. + *args (any): Extra arguments to pass to `callback`. To utilise `*args` + (and `**kwargs`), a value for the `session` argument must also be + provided. + **kwargs (any): Extra kwargs to pass to `callback`. Raises: RuntimeError: If the given callback is not callable. Notes: - The result value sent to the callback is raw and not - processed in any way. This means that you will get - the ending line return character from most types of - client inputs. So make sure to strip that before - doing a comparison. + The result value sent to the callback is raw and not processed in any + way. This means that you will get the ending line return character from + most types of client inputs. So make sure to strip that before doing a + comparison. - When the prompt is running, a temporary object - `caller.ndb._getinput` is stored; this will be removed - when the prompt finishes. - If you need the specific Session of the caller (which - may not be easy to get if caller is an account in higher - multisession modes), then it is available in the - callback through `caller.ndb._getinput._session`. + When the prompt is running, a temporary object `caller.ndb._getinput` + is stored; this will be removed when the prompt finishes. - Chaining get_input functions will result in the caller - stacking ever more instances of InputCmdSets. Whilst - they will all be cleared on concluding the get_input - chain, EvMenu should be considered for anything beyond - a single question. + If you need the specific Session of the caller (which may not be easy + to get if caller is an account in higher multisession modes), then it + is available in the callback through `caller.ndb._getinput._session`. + This is why the `session` is required as input. + + It's not recommended to 'chain' `get_input` into a sequence of + questions. This will result in the caller stacking ever more instances + of InputCmdSets. While they will all be cleared on concluding the + get_input chain, EvMenu should be considered for anything beyond a + single question. """ if not callable(callback): diff --git a/docs/0.9.5/_modules/evennia/utils/evmore.html b/docs/0.9.5/_modules/evennia/utils/evmore.html index df225702b8..ee0e5e46c4 100644 --- a/docs/0.9.5/_modules/evennia/utils/evmore.html +++ b/docs/0.9.5/_modules/evennia/utils/evmore.html @@ -43,29 +43,34 @@ """ EvMore - pager mechanism -This is a pager for displaying long texts and allows stepping up and -down in the text (the name comes from the traditional 'more' unix -command). +This is a pager for displaying long texts and allows stepping up and down in +the text (the name comes from the traditional 'more' unix command). To use, simply pass the text through the EvMore object: -:: + + +```python from evennia.utils.evmore import EvMore text = some_long_text_output() EvMore(caller, text, always_page=False, session=None, justify_kwargs=None, **kwargs) +``` -One can also use the convenience function msg from this module: -:: +One can also use the convenience function `msg` from this module to avoid +having to set up the `EvMenu` object manually: + +```python from evennia.utils import evmore text = some_long_text_output() evmore.msg(caller, text, always_page=False, session=None, justify_kwargs=None, **kwargs) +``` -Where always_page decides if the pager is used also if the text is not long -enough to need to scroll, session is used to determine which session to relay -to and `justify_kwargs` are kwargs to pass to `utils.utils.justify` in order to +The `always_page` argument decides if the pager is used also if the text is not long +enough to need to scroll, `session` is used to determine which session to relay +to and `justify_kwargs` are kwargs to pass to utils.utils.justify in order to change the formatting of the text. The remaining `**kwargs` will be passed on to the `caller.msg()` construct every time the page is updated. @@ -77,7 +82,8 @@ from django.core.paginator import Paginator from evennia import Command, CmdSet from evennia.commands import cmdhandler -from evennia.utils.utils import make_iter, inherits_from, justify +from evennia.utils.ansi import ANSIString +from evennia.utils.utils import make_iter, inherits_from, justify, dedent _CMD_NOMATCH = cmdhandler.CMD_NOMATCH _CMD_NOINPUT = cmdhandler.CMD_NOINPUT @@ -88,6 +94,8 @@ _EVTABLE = None +_LBR = ANSIString("\n") + # text _DISPLAY = """{text} @@ -169,10 +177,9 @@ return qs.count()
-
[docs]class EvMore: +
[docs]class EvMore(object): """ - The main pager object. - + The main pager object """
[docs] def __init__( @@ -190,16 +197,15 @@ ): """ - Initialization of the Evmore input handler. + Initialization of the EvMore pager. Args: caller (Object or Account): Entity reading the text. inp (str, EvTable, Paginator or iterator): The text or data to put under paging. - If a string, paginage normally. If this text contains - one or more \\\\f (backslash + f) format symbols, automatic - pagination and justification are force-disabled and - page-breaks will only happen after each \\\\f. + one or more `\\\\f` format symbol, automatic pagination and justification + are force-disabled and page-breaks will only happen after each `\\\\f`. - If `EvTable`, the EvTable will be paginated with the same setting on each page if it is too long. The table decorations will be considered in the size of the page. @@ -207,8 +213,9 @@ expected to be a line in the final display. Each line will be run through `iter_callable`. - always_page (bool, optional): If `False`, the pager will only kick - in if `inp` is too big to fit the screen. + always_page (bool, optional): If `False`, the + pager will only kick in if `inp` is too big + to fit the screen. session (Session, optional): If given, this session will be used to determine the screen width and will receive all output. justify (bool, optional): If set, auto-justify long lines. This must be turned @@ -224,51 +231,29 @@ the caller when the more page exits. Note that this will be using whatever cmdset the user had *before* the evmore pager was activated (so none of the evmore commands will be available when this is run). - kwargs (any, any): These will be passed on to the `caller.msg` method. + kwargs (any, optional): These will be passed on to the `caller.msg` method. Examples: - Basic use: - :: - super_long_text = " ... " - EvMore(caller, super_long_text) - - Paginated query data - this is an optimization to avoid fetching - database data until it's actually paged to. - :: - - from django.core.paginator import Paginator - - query = ObjectDB.objects.all() - pages = Paginator(query, 10) # 10 objs per page - EvMore(caller, pages) - - Automatic split EvTable over multiple EvMore pages - :: - - table = EvMore(*header, table=tabledata) - EvMore(caller, table) - - Every page a separate EvTable (optimization for very large data sets) - :: - - from evennia import EvTable, EvMore - - class TableEvMore(EvMore): - def init_pages(self, data): - pages = # depends on data type - super().init_pages(pages) - - def page_formatter(self, page): - table = EvTable() - - for line in page: - cols = # split raw line into columns - table.add_row(*cols) - - return str(table) - - TableEvMore(caller, pages) + ```python + super_long_text = " ... " + EvMore(caller, super_long_text) + ``` + Paginator + ```python + from django.core.paginator import Paginator + query = ObjectDB.objects.all() + pages = Paginator(query, 10) # 10 objs per page + EvMore(caller, pages) + ``` + Every page an EvTable + ```python + from evennia import EvTable + def _to_evtable(page): + table = ... # convert page to a table + return EvTable(*headers, table=table, ...) + EvMore(caller, pages, page_formatter=_to_evtable) + ``` """ self._caller = caller @@ -455,9 +440,12 @@
[docs] def init_f_str(self, text): """ - The input contains \\\\f (backslash + f) markers. We use \\\\f to indicate - the user wants to enforce their line breaks on their own. If so, we do - no automatic line-breaking/justification at all. + The input contains `\\f` markers. We use `\\f` to indicate the user wants to + enforce their line breaks on their own. If so, we do no automatic + line-breaking/justification at all. + + Args: + text (str): The string to format with f-markers. """ self._data = text.split("\f") @@ -486,7 +474,7 @@ lines = text.split("\n") self._data = [ - "\n".join(lines[i : i + self.height]) for i in range(0, len(lines), self.height) + _LBR.join(lines[i : i + self.height]) for i in range(0, len(lines), self.height) ] self._npages = len(self._data)
@@ -504,15 +492,13 @@ Notes: If overridden, this method must perform the following actions: - - read and re-store `self._data` (the incoming data set) if needed - for pagination to work. + - read and re-store `self._data` (the incoming data set) if needed for pagination to work. - set `self._npages` to the total number of pages. Default is 1. - set `self._paginator` to a callable that will take a page number 1...N and return the data to display on that page (not any decorations or next/prev buttons). If only wanting to change the paginator, override `self.paginator` instead. - - set `self._page_formatter` to a callable that will receive the - page from `self._paginator` and format it with one element per - line. Default is `str`. Or override `self.page_formatter` + - set `self._page_formatter` to a callable that will receive the page from `self._paginator` + and format it with one element per line. Default is `str`. Or override `self.page_formatter` directly instead. By default, helper methods are called that perform these actions @@ -590,40 +576,6 @@ """ EvMore-supported version of msg, mimicking the normal msg method. - Args: - caller (Object or Account): Entity reading the text. - text (str, EvTable or iterator): The text or data to put under paging. - - - If a string, paginage normally. If this text contains - one or more \\\\f (backslash + f) format symbol, automatic pagination is disabled - and page-breaks will only happen after each \\\\f. - - If `EvTable`, the EvTable will be paginated with the same - setting on each page if it is too long. The table - decorations will be considered in the size of the page. - - Otherwise `text` is converted to an iterator, where each step is - is expected to be a line in the final display, and each line - will be run through repr(). - - always_page (bool, optional): If `False`, the - pager will only kick in if `text` is too big - to fit the screen. - session (Session, optional): If given, this session will be used - to determine the screen width and will receive all output. - justify (bool, optional): If set, justify long lines in output. Disable for - fixed-format output, like tables. - justify_kwargs (dict, bool or None, optional): If given, this should - be valid keyword arguments to the utils.justify() function. If False, - no justification will be done. - exit_on_lastpage (bool, optional): Immediately exit pager when reaching the last page. - use_evtable (bool, optional): If True, each page will be rendered as an - EvTable. For this to work, `text` must be an iterable, where each element - is the table (list of list) to render on that page. - evtable_args (tuple, optional): The args to use for EvTable on each page. - evtable_kwargs (dict, optional): The kwargs to use for EvTable on each - page (except `table`, which is supplied by EvMore per-page). - kwargs (any, optional): These will be passed on - to the `caller.msg` method. - """ EvMore( caller, @@ -635,6 +587,9 @@ exit_on_lastpage=exit_on_lastpage, **kwargs, )
+ + +msg.__doc__ += dedent(EvMore.__init__.__doc__)
diff --git a/docs/0.9.5/_modules/evennia/utils/evtable.html b/docs/0.9.5/_modules/evennia/utils/evtable.html index cb521b5ff1..02e56d4ce9 100644 --- a/docs/0.9.5/_modules/evennia/utils/evtable.html +++ b/docs/0.9.5/_modules/evennia/utils/evtable.html @@ -40,21 +40,25 @@

Source code for evennia.utils.evtable

 """
-This is an advanced ASCII table creator. It was inspired by
-[prettytable](https://code.google.com/p/prettytable/) but shares no code.
+This is an advanced ASCII table creator. It was inspired by Prettytable
+(https://code.google.com/p/prettytable/) but shares no code and is considerably
+more advanced, supporting auto-balancing of incomplete tables and ANSI colors among
+other things.
 
 Example usage:
-::
 
-    from evennia.utils import evtable
+```python
+  from evennia.utils import evtable
 
-    table = evtable.EvTable("Heading1", "Heading2",
+  table = evtable.EvTable("Heading1", "Heading2",
                   table=[[1,2,3],[4,5,6],[7,8,9]], border="cells")
-    table.add_column("This is long data", "This is even longer data")
-    table.add_row("This is a single row")
-    print table
+  table.add_column("This is long data", "This is even longer data")
+  table.add_row("This is a single row")
+  print table
+```
 
 Result:
+
 ::
 
     +----------------------+----------+---+--------------------------+
@@ -71,13 +75,15 @@
 
 As seen, the table will automatically expand with empty cells to make
 the table symmetric. Tables can be restricted to a given width:
-::
 
-    table.reformat(width=50, align="l")
+```python
+  table.reformat(width=50, align="l")
+```
 
 (We could just have added these keywords to the table creation call)
 
 This yields the following result:
+
 ::
 
     +-----------+------------+-----------+-----------+
@@ -98,16 +104,21 @@
     | row       |            |           |           |
     +-----------+------------+-----------+-----------+
 
+
 Table-columns can be individually formatted. Note that if an
 individual column is set with a specific width, table auto-balancing
 will not affect this column (this may lead to the full table being too
 wide, so be careful mixing fixed-width columns with auto- balancing).
 Here we change the width and alignment of the column at index 3
 (Python starts from 0):
-::
 
-    table.reformat_column(3, width=30, align="r")
-    print table
+```python
+
+table.reformat_column(3, width=30, align="r")
+print table
+```
+
+::
 
     +-----------+-------+-----+-----------------------------+---------+
     | Heading1  | Headi |     |                             |         |
@@ -131,15 +142,14 @@
 vertically. This will lead to text contents being cropped. Each cell
 can only shrink to a minimum width and height of 1.
 
-`EvTable` is intended to be used with [ANSIString](evennia.utils.ansi#ansistring)
-for supporting ANSI-coloured string types.
+`EvTable` is intended to be used with `ANSIString` for supporting ANSI-coloured
+string types.
 
-When a cell is auto-wrapped across multiple lines, ANSI-reset
-sequences will be put at the end of each wrapped line. This means that
-the colour of a wrapped cell will not "bleed", but it also means that
-eventual colour outside the table will not transfer "across" a table,
-you need to re-set the color to have it appear on both sides of the
-table string.
+When a cell is auto-wrapped across multiple lines, ANSI-reset sequences will be
+put at the end of each wrapped line. This means that the colour of a wrapped
+cell will not "bleed", but it also means that eventual colour outside the table
+will not transfer "across" a table, you need to re-set the color to have it
+appear on both sides of the table string.
 
 ----
 
diff --git a/docs/0.9.5/_modules/evennia/utils/inlinefuncs.html b/docs/0.9.5/_modules/evennia/utils/inlinefuncs.html
index 07d837b84f..27c1f6e74a 100644
--- a/docs/0.9.5/_modules/evennia/utils/inlinefuncs.html
+++ b/docs/0.9.5/_modules/evennia/utils/inlinefuncs.html
@@ -43,20 +43,22 @@
 Inline functions (nested form).
 
 This parser accepts nested inlinefunctions on the form
-::
 
-    $funcname(arg, arg, ...)
+```python
+$funcname(arg, arg, ...)
+```
 
-embedded in any text where any arg can be another `$funcname{}` call.
+embedded in any text where any arg can be another ``$funcname()`` call.
 This functionality is turned off by default - to activate,
 `settings.INLINEFUNC_ENABLED` must be set to `True`.
 
-Each token starts with `$funcname(` where there must be no space between the
-$funcname and "(". It ends with a matched ending parentesis ")".
+Each token starts with `$funcname(` where there must be no space
+between the `$funcname` and `"("`. The inlinefunc ends with a matched ending parentesis.
+`")"`.
 
-Inside the inlinefunc definition, one can use \\\\ to escape. This is
+Inside the inlinefunc definition, one can use `\` to escape. This is
 mainly needed for escaping commas in flowing text (which would
-otherwise be interpreted as an argument separator), or to escape `}`
+otherwise be interpreted as an argument separator), or to escape `)`
 when not intended to close the function block. Enclosing text in
 matched `\"\"\"` (triple quotes) or `'''` (triple single-quotes) will
 also escape *everything* within without needing to escape individual
@@ -66,10 +68,11 @@
 modules defined by `settings.INLINEFUNC_MODULES`. They are identified
 by their function name (and ignored if this name starts with `_`). They
 should be on the following form:
-::
 
-    def funcname (*args, **kwargs):
+```python
+def funcname (*args, **kwargs):
     # ...
+```
 
 Here, the arguments given to `$funcname(arg1,arg2)` will appear as the
 `*args` tuple. This will be populated by the arguments given to the
@@ -93,8 +96,9 @@
   the `stackfull` inlinefunc is appended to the end. By default this is an
   error message.
 
-Syntax errors, notably not completely closing all inlinefunc blocks, will lead
-to the entire string remaining unparsed.
+Syntax errors, notably failing to completely closing all inlinefunc
+blocks, will lead to the entire string remaining unparsed. Inlineparsing should
+never traceback.
 
 ----
 
@@ -132,10 +136,9 @@
         given range.
 
     Example:
-
-        - `$random()`
-        - `$random(5)`
-        - `$random(5, 10)`
+        `$random()`
+        `$random(5)`
+        `$random(5, 10)`
 
     """
     nargs = len(args)
@@ -615,16 +618,16 @@
     Args:
         in_template (str): The template to be used for nick recognition.
         out_template (str): The template to be used to replace the string
-            matched by the `in_template`.
+            matched by the in_template.
 
     Returns:
-        regex, template (regex, str): Regex to match against strings and a
-        template with markers `{arg1}`, `{arg2}`, etc for replacement using the
-        standard `.format` method.
+        regex  (regex): Regex to match against strings
+        template (str): Template with markers {arg1}, {arg2}, etc for
+        replacement using the standard .format method.
 
     Raises:
-        inlinefuncs.NickTemplateInvalid: If the in/out template does not have a matching
-            number of $args.
+        evennia.utils.inlinefuncs.NickTemplateInvalid: If the in/out template
+        does not have a matching number of $args.
 
     """
     # create the regex for in_template
diff --git a/docs/0.9.5/_modules/evennia/utils/optionclasses.html b/docs/0.9.5/_modules/evennia/utils/optionclasses.html
index fbf955fe3f..d3650b9924 100644
--- a/docs/0.9.5/_modules/evennia/utils/optionclasses.html
+++ b/docs/0.9.5/_modules/evennia/utils/optionclasses.html
@@ -39,13 +39,7 @@
           

Source code for evennia.utils.optionclasses

-"""
-Option classes store user- or server Options in a generic way
-while also providing validation.
-
-"""
-
-import datetime
+import datetime
 from evennia import logger
 from evennia.utils.ansi import strip_ansi
 from evennia.utils.validatorfuncs import _TZ_DICT
@@ -53,7 +47,7 @@
 from evennia.utils import validatorfuncs
 
 
-
[docs]class BaseOption: +
[docs]class BaseOption(object): """ Abstract Class to deal with encapsulating individual Options. An Option has a name/key, a description to display in relevant commands and menus, and a @@ -157,8 +151,8 @@
[docs] def save(self, **kwargs): """ Stores the current value using `.handler.save_handler(self.key, value, **kwargs)` - where kwargs are a combination of those passed into this function and the - ones specified by the OptionHandler. + where `kwargs` are a combination of those passed into this function and + the ones specified by the `OptionHandler`. Keyword Args: any (any): Not used by default. These are passed in from self.set diff --git a/docs/0.9.5/_modules/evennia/utils/picklefield.html b/docs/0.9.5/_modules/evennia/utils/picklefield.html index fa8ac4c095..8a2536e413 100644 --- a/docs/0.9.5/_modules/evennia/utils/picklefield.html +++ b/docs/0.9.5/_modules/evennia/utils/picklefield.html @@ -327,7 +327,7 @@ return value
[docs] def value_to_string(self, obj): - value = self._get_val_from_obj(obj) + value = self.value_from_object(obj) return self.get_db_prep_value(value)
[docs] def get_internal_type(self): diff --git a/docs/0.9.5/_modules/evennia/utils/search.html b/docs/0.9.5/_modules/evennia/utils/search.html index 62fdc9f499..8fd3b8ac56 100644 --- a/docs/0.9.5/_modules/evennia/utils/search.html +++ b/docs/0.9.5/_modules/evennia/utils/search.html @@ -77,6 +77,7 @@ "search_message", "search_channel", "search_help_entry", + "search_tag", "search_script_tag", "search_account_tag", "search_channel_tag", diff --git a/docs/0.9.5/_modules/evennia/utils/test_resources.html b/docs/0.9.5/_modules/evennia/utils/test_resources.html index e20f7f0068..952284061f 100644 --- a/docs/0.9.5/_modules/evennia/utils/test_resources.html +++ b/docs/0.9.5/_modules/evennia/utils/test_resources.html @@ -80,18 +80,18 @@ should directly give the module pathname to unload. Example: - :: - # (in a test method) - unload_module(foo) - with mock.patch("foo.GLOBALTHING", "mockval"): - import foo - ... # test code using foo.GLOBALTHING, now set to 'mockval' + ```python + # (in a test method) + unload_module(foo) + with mock.patch("foo.GLOBALTHING", "mockval"): + import foo + ... # test code using foo.GLOBALTHING, now set to 'mockval' + ``` - Notes: - This allows for mocking constants global to the module, since - otherwise those would not be mocked (since a module is only - loaded once). + This allows for mocking constants global to the module, since + otherwise those would not be mocked (since a module is only + loaded once). """ if isinstance(module, str): diff --git a/docs/0.9.5/_modules/evennia/utils/utils.html b/docs/0.9.5/_modules/evennia/utils/utils.html index 2dcf9e4cf9..a5dd1ceeaf 100644 --- a/docs/0.9.5/_modules/evennia/utils/utils.html +++ b/docs/0.9.5/_modules/evennia/utils/utils.html @@ -401,17 +401,17 @@ values with double quotes. Returns: - liststr (str): The list represented as a string. + str: The list represented as a string. Examples: ```python - # no endsep: - [1,2,3] -> '1, 2, 3' - # with endsep=='and': - [1,2,3] -> '1, 2 and 3' - # with addquote and endsep - [1,2,3] -> '"1", "2" and "3"' + >>> list_to_string([1,2,3], endsep='') + '1, 2, 3' + >>> list_to_string([1,2,3], ensdep='and') + '1, 2 and 3' + >>> list_to_string([1,2,3], endsep='and', addquote=True) + '"1", "2" and "3"' ``` """ @@ -891,7 +891,7 @@ the text with "?" in place of problematic characters. If the specified encoding cannot be found, the protocol flag is reset to utf-8. In any case, returns bytes. - Note: + Notes: If `text` is already bytes, return it as is. """ @@ -931,7 +931,7 @@ Returns: decoded_text (str): The decoded text. - Note: + Notes: If `text` is already str, return it as is. """ if isinstance(text, str): @@ -985,18 +985,17 @@ distance from parent. Args: - obj (any): Object to analyze. This may be either an instance - or a class. - parent (any): Can be either instance, class or python path to class. + obj (any): Object to analyze. This may be either an instance or + a class. + parent (any): Can be either an instance, a class or the python + path to the class. Returns: inherits_from (bool): If `parent` is a parent to `obj` or not. Notes: - What differs this function from e.g. `isinstance()` is that `obj` - may be both an instance and a class, and parent may be an - instance, a class, or the python path to a class (counting from - the evennia root directory). + What differentiates this function from Python's `isinstance()` is the + flexibility in the types allowed for the object and parent being compared. """ @@ -1044,8 +1043,7 @@ shortcut to having to use the full backend name. Args: - name (str): One of 'sqlite3', 'mysql', 'postgresql' - or 'oracle'. + name (str): One of 'sqlite3', 'mysql', 'postgresql' or 'oracle'. Returns: uses (bool): If the given database is used or not. @@ -1069,20 +1067,19 @@ timedelay (int or float): The delay in seconds callback (callable): Will be called as `callback(*args, **kwargs)` after `timedelay` seconds. - args (any, optional): Will be used as arguments to callback + *args: Will be used as arguments to callback Keyword Args: - persistent (bool, optional): should make the delay persistent - over a reboot or reload - any (any): Will be used as keyword arguments to callback. + persistent (bool): Make the delay persistent over a reboot or reload. + any: Any other keywords will be use as keyword arguments to callback. Returns: - deferred (deferred): Will fire with callback after - `timedelay` seconds. Note that if `timedelay()` is used in the - commandhandler callback chain, the callback chain can be - defined directly in the command body and don't need to be - specified here. + deferred: Will fire with callback after `timedelay` seconds. Note that + if `timedelay()` is used in the + commandhandler callback chain, the callback chain can be + defined directly in the command body and don't need to be + specified here. - Note: + Notes: The task handler (`evennia.scripts.taskhandler.TASK_HANDLER`) will be called for persistent or non-persistent tasks. If persistent is set to True, the callback, its arguments @@ -1113,17 +1110,16 @@ executed with `*args` and non-reserved `**kwargs` as arguments. The callable will be executed using ProcPool, or in a thread if ProcPool is not available. - Keyword Args: at_return (callable): Should point to a callable with one - argument. It will be called with the return value from - to_execute. + argument. It will be called with the return value from + to_execute. at_return_kwargs (dict): This dictionary will be used as - keyword arguments to the at_return callback. + keyword arguments to the at_return callback. at_err (callable): This will be called with a Failure instance - if there is an error in to_execute. + if there is an error in to_execute. at_err_kwargs (dict): This dictionary will be used as keyword - arguments to the at_err errback. + arguments to the at_err errback. Notes: All other `*args` and `**kwargs` will be passed on to @@ -1209,7 +1205,7 @@
[docs]def has_parent(basepath, obj): """ - Checks if `basepath` is somewhere in `obj`'s parent tree. + Checks if `basepath` is somewhere in obj's parent tree. Args: basepath (str): Python dotpath to compare against obj path. @@ -1577,8 +1573,8 @@ Returns: suggestions (list): Suggestions from `vocabulary` with a - similarity-rating that higher than or equal to `cutoff`. - Could be empty if there are no matches. + similarity-rating that higher than or equal to `cutoff`. + Could be empty if there are no matches. """ return [ @@ -1646,11 +1642,9 @@
[docs]def format_table(table, extra_space=1): """ - Note: `evennia.utils.evtable` is more powerful than this, but this function - can be useful when the number of columns and rows are unknown and must be - calculated on the fly. + Format a 2D array of strings into a multi-column table. - Args. + Args: table (list): A list of lists to represent columns in the table: `[[val,val,val,...], [val,val,val,...], ...]`, where each val will be placed on a separate row in the @@ -1660,26 +1654,30 @@ padding (in characters) should be left between columns. Returns: - table (list): A list of lists representing the rows to print - out one by one. + list: A list of lists representing the rows to print out one by one. Notes: The function formats the columns to be as wide as the widest member of each column. - Example: - :: + `evennia.utils.evtable` is more powerful than this, but this + function can be useful when the number of columns and rows are + unknown and must be calculated on the fly. - ftable = format_table([[...], [...], ...]) - for ir, row in enumarate(ftable): - if ir == 0: - # make first row white - string += "\\\\n|w" + ""join(row) + "|n" - else: - string += "\\\\n" + "".join(row) - print(string) + Examples: :: + + ftable = format_table([[1,2,3], [4,5,6]]) + string = "" + for ir, row in enumarate(ftable): + if ir == 0: + # make first row white + string += "\\n|w" + "".join(row) + "|n" + else: + string += "\\n" + "".join(row) + print(string) """ + if not table: return [[]] @@ -1695,6 +1693,191 @@ return ftable
+
[docs]def percent(value, minval, maxval, formatting="{:3.1f}%"): + """ + Get a value in an interval as a percentage of its position + in that interval. This also understands negative numbers. + + Args: + value (number): This should be a value minval<=value<=maxval. + minval (number or None): Smallest value in interval. This could be None + for an open interval (then return will always be 100%) + maxval (number or None): Biggest value in interval. This could be None + for an open interval (then return will always be 100%) + formatted (str, optional): This is a string that should + accept one formatting tag. This will receive the + current value as a percentage. If None, the + raw float will be returned instead. + Returns: + str or float: The formatted value or the raw percentage as a float. + Notes: + We try to handle a weird interval gracefully. + + - If either maxval or minval is None (open interval), we (aribtrarily) assume 100%. + - If minval > maxval, we return 0%. + - If minval == maxval == value we are looking at a single value match and return 100%. + - If minval == maxval != value we return 0%. + - If value not in [minval..maxval], we set value to the closest + boundary, so the result will be 0% or 100%, respectively. + + """ + result = None + if None in (minval, maxval): + # we have no boundaries, percent calculation makes no sense, + # we set this to 100% since it + result = 100.0 + elif minval > maxval: + # interval has no width so we cannot + # occupy any position within it. + result = 0.0 + elif minval == maxval == value: + # this is a single value that we match + result = 100.0 + elif minval == maxval != value: + # interval has no width so we cannot be in it. + result = 0.0 + + if result is None: + # constrain value to interval + value = min(max(minval, value), maxval) + + # these should both be >0 + dpart = value - minval + dfull = maxval - minval + result = (dpart / dfull) * 100.0 + + if isinstance(formatting, str): + return formatting.format(result) + return result
+ + +import functools # noqa + + +
[docs]def percentile(iterable, percent, key=lambda x: x): + """ + Find the percentile of a list of values. + + Args: + iterable (iterable): A list of values. Note N MUST BE already sorted. + percent (float): A value from 0.0 to 1.0. + key (callable, optional). Function to compute value from each element of N. + + Returns: + float: The percentile of the values + + """ + if not iterable: + return None + k = (len(iterable) - 1) * percent + f = math.floor(k) + c = math.ceil(k) + if f == c: + return key(iterable[int(k)]) + d0 = key(iterable[int(f)]) * (c - k) + d1 = key(iterable[int(c)]) * (k - f) + return d0 + d1
+ + +
[docs]def format_grid(elements, width=78, sep=" ", verbatim_elements=None): + """ + This helper function makes a 'grid' output, where it distributes the given + string-elements as evenly as possible to fill out the given width. + will not work well if the variation of length is very big! + + Args: + elements (iterable): A 1D list of string elements to put in the grid. + width (int, optional): The width of the grid area to fill. + sep (str, optional): The extra separator to put between words. If + set to the empty string, words may run into each other. + verbatim_elements (list, optional): This is a list of indices pointing to + specific items in the `elements` list. An element at this index will + not be included in the calculation of the slot sizes. It will still + be inserted into the grid at the correct position and may be surrounded + by padding unless filling the entire line. This is useful for embedding + decorations in the grid, such as horizontal bars. + + Returns: + gridstr: The grid as a list of ready-formatted rows. We return it + like this to make it easier to insert decorations between rows, such + as horizontal bars. + """ + if not verbatim_elements: + verbatim_elements = [] + + nelements = len(elements) + # add sep to all but the very last element + elements = [elements[ie] + sep for ie in range(nelements - 1)] + [elements[-1]] + wls = [len(elem) for elem in elements] + wls_percentile = [wl for iw, wl in enumerate(wls) if iw not in verbatim_elements] + # from pudb import debugger + # debugger.Debugger().set_trace() + + # get the nth percentile as a good representation of average width + averlen = int(percentile(sorted(wls_percentile), 0.9)) + 2 # include extra space + aver_per_row = width // averlen + 1 + + if aver_per_row == 1: + # one line per row, output directly since this is trivial + # we use rstrip here to remove extra spaces added by sep + return [ + crop(element.rstrip(), width) + " " * max(0, width - len(element.rstrip())) + for iel, element in enumerate(elements) + ] + + indices = [averlen * ind for ind in range(aver_per_row - 1)] + + rows = [] + ic = 0 + row = "" + for ie, element in enumerate(elements): + + wl = wls[ie] + lrow = len(row) + debug = row.replace(" ", ".") + + if lrow + wl > width: + # this slot extends outside grid, move to next line + row += " " * (width - lrow) + rows.append(row) + if wl >= width: + # remove sep if this fills the entire line + element = element.rstrip() + row = crop(element, width) + ic = 0 + elif ic >= aver_per_row - 1: + # no more slots available on this line + row += " " * max(0, (width - lrow)) + rows.append(row) + row = crop(element, width) + ic = 0 + else: + try: + while lrow > max(0, indices[ic]): + # slot too wide, extend into adjacent slot + ic += 1 + row += " " * max(0, indices[ic] - lrow) + except IndexError: + # we extended past edge of grid, crop or move to next line + if ic == 0: + row = crop(element, width) + else: + row += " " * max(0, width - lrow) + rows.append(row) + ic = 0 + else: + # add a new slot + row += element + " " * max(0, averlen - wl) + ic += 1 + + if ie >= nelements - 1: + # last element, make sure to store + row += " " * max(0, width - len(row)) + rows.append(row) + + return rows
+ +
[docs]def get_evennia_pids(): """ Get the currently valid PIDs (Process IDs) of the Portal and @@ -1706,13 +1889,13 @@ Examples: This can be used to determine if we are in a subprocess by - something like: ```python self_pid = os.getpid() server_pid, portal_pid = get_evennia_pids() is_subprocess = self_pid not in (server_pid, portal_pid) ``` + """ server_pidfile = os.path.join(settings.GAME_DIR, "server.pid") portal_pidfile = os.path.join(settings.GAME_DIR, "portal.pid") @@ -1928,16 +2111,15 @@ query (str, optional): The search query used to produce `matches`. quiet (bool, optional): If `True`, no messages will be echoed to caller on errors. - Keyword Args: nofound_string (str): Replacement string to echo on a notfound error. multimatch_string (str): Replacement string to echo on a multimatch error. Returns: processed_result (Object or None): This is always a single result - or `None`. If `None`, any error reporting/handling should - already have happened. The returned object is of the type we are - checking multimatches for (e.g. Objects or Commands) + or `None`. If `None`, any error reporting/handling should + already have happened. The returned object is of the type we are + checking multimatches for (e.g. Objects or Commands) """ @@ -1996,10 +2178,10 @@ Keyword Args: size_limit (int): Use this to limit the number of elements - alloweds to be in this list. By default the overshooting elements - will be removed in FIFO order. + alloweds to be in this list. By default the overshooting elements + will be removed in FIFO order. fifo (bool, optional): Defaults to `True`. Remove overshooting elements - in FIFO order. If `False`, remove in FILO order. + in FIFO order. If `False`, remove in FILO order. """ super().__init__() @@ -2066,10 +2248,10 @@ from this parent. Returns: - typeclasses (dict): On the form {"typeclass.path": typeclass, ...} + dict: On the form `{"typeclass.path": typeclass, ...}` Notes: - This will dynamicall retrieve all abstract django models inheriting at any distance + This will dynamically retrieve all abstract django models inheriting at any distance from the TypedObject base (aka a Typeclass) so it will work fine with any custom classes being added. @@ -2092,14 +2274,19 @@
[docs]def interactive(func): """ - Decorator to make a method pausable with yield(seconds) and able to ask for - user-input with `response=yield(question)`. For the question-asking to - work, 'caller' must the name of an argument or kwarg to the decorated - function. + Decorator to make a method pausable with `yield(seconds)` + and able to ask for user-input with `response=yield(question)`. + For the question-asking to work, one of the args or kwargs to the + decorated function must be named 'caller'. - Example: - :: + Raises: + ValueError: If asking an interactive question but the decorated + function has no arg or kwarg named 'caller'. + ValueError: If passing non int/float to yield using for pausing. + Examples: + + ```python @interactive def myfunc(caller): caller.msg("This is a test") @@ -2111,9 +2298,10 @@ yield(5) else: # ... + ``` Notes: - This turns the method into a generator! + This turns the decorated function or method into a generator. """ from evennia.utils.evmenu import get_input diff --git a/docs/0.9.5/_modules/evennia/utils/validatorfuncs.html b/docs/0.9.5/_modules/evennia/utils/validatorfuncs.html index 34c14e6706..5aa1bda835 100644 --- a/docs/0.9.5/_modules/evennia/utils/validatorfuncs.html +++ b/docs/0.9.5/_modules/evennia/utils/validatorfuncs.html @@ -89,12 +89,10 @@ account (AccountDB): The Account performing this lookup. Unless `from_tz` is provided, the account's timezone option will be used. from_tz (pytz.timezone): An instance of a pytz timezone object from the - user. If not provided, tries to use the timezone option of the `account`. + user. If not provided, tries to use the timezone option of `account`. If neither one is provided, defaults to UTC. - Returns: datetime in UTC. - Raises: ValueError: If encountering a malformed timezone, date string or other format error. diff --git a/docs/0.9.5/api/evennia-api.html b/docs/0.9.5/api/evennia-api.html index 7fb80cbcbd..a0b27971be 100644 --- a/docs/0.9.5/api/evennia-api.html +++ b/docs/0.9.5/api/evennia-api.html @@ -266,8 +266,14 @@
  • evennia.utils
  • diff --git a/docs/0.9.5/api/evennia.commands.command.html b/docs/0.9.5/api/evennia.commands.command.html index 68600c8417..2d21e377e4 100644 --- a/docs/0.9.5/api/evennia.commands.command.html +++ b/docs/0.9.5/api/evennia.commands.command.html @@ -374,17 +374,6 @@ commands the caller can use.

    -
    -
    -client_height()[source]
    -

    Get the client screenheight for the session using this command.

    -
    -
    Returns
    -

    client height (int) – The height (in characters) of the client window.

    -
    -
    -
    -
    styled_table(*args, **kwargs)[source]
    @@ -437,6 +426,11 @@ detailing the contents of the table.

    save_for_next = False
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'command', 'tags': '', 'text': '\n Base command\n\n Usage:\n command [args]\n\n This is the base command class. Inherit from this\n to create new commands.\n\n The cmdhandler makes the following variables available to the\n command methods (so you can always assume them to be there):\n self.caller - the game object calling the command\n self.cmdstring - the command name used to trigger this command (allows\n you to know which alias was used, for example)\n cmd.args - everything supplied to the command following the cmdstring\n (this is usually what is parsed in self.parse())\n cmd.cmdset - the cmdset from which this command was matched (useful only\n seldomly, notably for help-type commands, to create dynamic\n help entries and lists)\n cmd.obj - the object on which this command is defined. If a default command,\n this is usually the same as caller.\n cmd.rawstring - the full raw string input, including any args and no parsing.\n\n The following class properties can/should be defined on your child class:\n\n key - identifier for command (e.g. "look")\n aliases - (optional) list of aliases (e.g. ["l", "loo"])\n locks - lock string (default is "cmd:all()")\n help_category - how to organize this help entry in help system\n (default is "General")\n auto_help - defaults to True. Allows for turning off auto-help generation\n arg_regex - (optional) raw string regex defining how the argument part of\n the command should look in order to match for this command\n (e.g. must it be a space between cmdname and arg?)\n auto_help_display_key - (optional) if given, this replaces the string shown\n in the auto-help listing. This is particularly useful for system-commands\n whose actual key is not really meaningful.\n\n (Note that if auto_help is on, this initial string is also used by the\n system to create the help entry for the command, so it\'s a good idea to\n format it similar to this one). This behavior can be changed by\n overriding the method \'get_help\' of a command: by default, this\n method returns cmd.__doc__ (that is, this very docstring, or\n the docstring of your command). You can, however, extend or\n replace this without disabling auto_help.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.commands.default.account.html b/docs/0.9.5/api/evennia.commands.default.account.html index dbbe4f2cda..c7d615620c 100644 --- a/docs/0.9.5/api/evennia.commands.default.account.html +++ b/docs/0.9.5/api/evennia.commands.default.account.html @@ -98,6 +98,11 @@ method. Otherwise all text will be returned to all connected sessions.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'l ls', 'category': 'general', 'key': 'look', 'tags': '', 'text': '\n look while out-of-character\n\n Usage:\n look\n\n Look in the ooc state.\n '}
    +
    +
    @@ -152,6 +157,11 @@ as you the account have access right to puppet it.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'puppet', 'category': 'general', 'key': 'ic', 'tags': '', 'text': '\n control an object you have permission to puppet\n\n Usage:\n ic <character>\n\n Go in-character (IC) as a given Character.\n\n This will attempt to "become" a different object assuming you have\n the right to do so. Note that it\'s the ACCOUNT character that puppets\n characters/objects and which needs to have the correct permission!\n\n You cannot become an object that is already controlled by another\n account. In principle <character> can be any in-game object as long\n as you the account have access right to puppet it.\n '}
    +
    +
    @@ -201,6 +211,11 @@ as you the account have access right to puppet it.

    lock_storage = 'cmd:pperm(Player)'
    +
    +
    +search_index_entry = {'aliases': 'unpuppet', 'category': 'general', 'key': 'ooc', 'tags': '', 'text': '\n stop puppeting and go ooc\n\n Usage:\n ooc\n\n Go out-of-character (OOC).\n\n This will leave your current character and put you in a incorporeal OOC state.\n '}
    +
    +
    @@ -249,6 +264,11 @@ as you the account have access right to puppet it.

    lock_storage = 'cmd:pperm(Player)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'password', 'tags': '', 'text': '\n change your password\n\n Usage:\n password <old password> = <new password>\n\n Changes your password. Make sure to pick a safe one.\n '}
    +
    +
    @@ -305,6 +325,11 @@ game. Use the /all switch to disconnect from all sessions.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'quit', 'tags': '', 'text': '\n quit the game\n\n Usage:\n quit\n\n Switch:\n all - disconnect all connected sessions\n\n Gracefully disconnect your current session from the\n game. Use the /all switch to disconnect from all sessions.\n '}
    +
    +
    @@ -356,6 +381,11 @@ if you want.

    lock_storage = 'cmd:pperm(Player)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'charcreate', 'tags': '', 'text': '\n create a new character\n\n Usage:\n charcreate <charname> [= desc]\n\n Create a new character, optionally giving it a description. You\n may use upper-case letters in the name - you will nevertheless\n always be able to access your character using lower-case letters\n if you want.\n '}
    +
    +
    @@ -414,6 +444,11 @@ later connecting with a client with different capabilities.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'options', 'category': 'general', 'key': 'option', 'tags': '', 'text': '\n Set an account option\n\n Usage:\n option[/save] [name = value]\n\n Switches:\n save - Save the current option settings for future logins.\n clear - Clear the saved options.\n\n This command allows for viewing and setting client interface\n settings. Note that saved options may not be able to be used if\n later connecting with a client with different capabilities.\n\n\n '}
    +
    +
    @@ -462,6 +497,11 @@ later connecting with a client with different capabilities.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'sessions', 'tags': '', 'text': '\n check your connected session(s)\n\n Usage:\n sessions\n\n Lists the sessions currently connected to your account.\n\n '}
    +
    +
    @@ -512,6 +552,11 @@ also for those with all permissions.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'doing', 'category': 'general', 'key': 'who', 'tags': '', 'text': '\n list who is currently online\n\n Usage:\n who\n doing\n\n Shows who is currently online. Doing is an alias that limits info\n also for those with all permissions.\n '}
    +
    +
    @@ -591,6 +636,11 @@ Takes a table of columns [[val,val,…],[val,val,…],…]

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'color', 'tags': '', 'text': '\n testing which colors your client support\n\n Usage:\n color ansi||xterm256\n\n Prints a color map along with in-mud color codes to use to produce\n them. It also tests what is supported in your client. Choices are\n 16-color ansi (supported in most muds) or the 256-color xterm256\n standard. No checking is done to determine your client supports\n color - if not you will see rubbish appear.\n '}
    +
    +
    @@ -646,6 +696,11 @@ Use the unquell command to revert back to normal operation.

    lock_storage = 'cmd:pperm(Player)'
    +
    +
    +search_index_entry = {'aliases': 'unquell', 'category': 'general', 'key': 'quell', 'tags': '', 'text': "\n use character's permissions instead of account's\n\n Usage:\n quell\n unquell\n\n Normally the permission level of the Account is used when puppeting a\n Character/Object to determine access. This command will switch the lock\n system to make use of the puppeted Object's permissions instead. This is\n useful mainly for testing.\n Hierarchical permission quelling only work downwards, thus an Account cannot\n use a higher-permission Character to escalate their permission level.\n Use the unquell command to revert back to normal operation.\n "}
    +
    +
    @@ -689,6 +744,11 @@ Use the unquell command to revert back to normal operation.

    lock_storage = 'cmd:pperm(Player)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'chardelete', 'tags': '', 'text': '\n delete a character - this cannot be undone!\n\n Usage:\n chardelete <charname>\n\n Permanently deletes one of your characters.\n '}
    +
    +
    @@ -746,6 +806,11 @@ to all the variables defined therein.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'style', 'tags': '', 'text': '\n In-game style options\n\n Usage:\n style\n style <option> = <value>\n\n Configure stylings for in-game display elements like table borders, help\n entriest etc. Use without arguments to see all available options.\n\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.commands.default.admin.html b/docs/0.9.5/api/evennia.commands.default.admin.html index b085ad5862..2f6a00356b 100644 --- a/docs/0.9.5/api/evennia.commands.default.admin.html +++ b/docs/0.9.5/api/evennia.commands.default.admin.html @@ -89,6 +89,11 @@ supplied it will be echoed to the user unless /quiet is set.

    lock_storage = 'cmd:perm(boot) or perm(Admin)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'admin', 'key': 'boot', 'tags': '', 'text': '\n kick an account from the server.\n\n Usage\n boot[/switches] <account obj> [: reason]\n\n Switches:\n quiet - Silently boot without informing account\n sid - boot by session id instead of name or dbref\n\n Boot an account object from the server. If a reason is\n supplied it will be echoed to the user unless /quiet is set.\n '}
    +
    +
    @@ -163,6 +168,11 @@ values in each tuple is set to the empty string.

    lock_storage = 'cmd:perm(ban) or perm(Developer)'
    +
    +
    +search_index_entry = {'aliases': 'bans', 'category': 'admin', 'key': 'ban', 'tags': '', 'text': "\n ban an account from the server\n\n Usage:\n ban [<name or ip> [: reason]]\n\n Without any arguments, shows numbered list of active bans.\n\n This command bans a user from accessing the game. Supply an optional\n reason to be able to later remember why the ban was put in place.\n\n It is often preferable to ban an account from the server than to\n delete an account with accounts/delete. If banned by name, that account\n account can no longer be logged into.\n\n IP (Internet Protocol) address banning allows blocking all access\n from a specific address or subnet. Use an asterisk (*) as a\n wildcard.\n\n Examples:\n ban thomas - ban account 'thomas'\n ban/ip 134.233.2.111 - ban specific ip address\n ban/ip 134.233.2.* - ban all in a subnet\n ban/ip 134.233.*.* - even wider ban\n\n A single IP filter can be easy to circumvent by changing computers\n or requesting a new IP address. Setting a wide IP block filter with\n wildcards might be tempting, but remember that it may also\n accidentally block innocent users connecting from the same country\n or region.\n\n "}
    +
    +
    @@ -209,6 +219,11 @@ unban.

    lock_storage = 'cmd:perm(unban) or perm(Developer)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'admin', 'key': 'unban', 'tags': '', 'text': '\n remove a ban from an account\n\n Usage:\n unban <banid>\n\n This will clear an account name/ip ban previously set with the ban\n command. Use this command without an argument to view a numbered\n list of bans. Use the numbers in this list to select which one to\n unban.\n\n '}
    +
    +
    @@ -238,7 +253,7 @@ to accounts respectively.

    -aliases = ['remit', 'pemit']
    +aliases = ['pemit', 'remit']
    @@ -267,6 +282,11 @@ to accounts respectively.

    lock_storage = 'cmd:perm(emit) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'pemit remit', 'category': 'admin', 'key': 'emit', 'tags': '', 'text': '\n admin command for emitting message to multiple objects\n\n Usage:\n emit[/switches] [<obj>, <obj>, ... =] <message>\n remit [<obj>, <obj>, ... =] <message>\n pemit [<obj>, <obj>, ... =] <message>\n\n Switches:\n room - limit emits to rooms only (default)\n accounts - limit emits to accounts only\n contents - send to the contents of matched objects too\n\n Emits a message to the selected objects or to\n your immediate surroundings. If the object is a room,\n send to its contents. remit and pemit are just\n limited forms of emit, for sending to rooms and\n to accounts respectively.\n '}
    +
    +
    @@ -310,6 +330,11 @@ to accounts respectively.

    lock_storage = 'cmd:perm(newpassword) or perm(Admin)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'admin', 'key': 'userpassword', 'tags': '', 'text': "\n change the password of an account\n\n Usage:\n userpassword <user obj> = <new password>\n\n Set an account's password.\n "}
    +
    +
    @@ -363,6 +388,11 @@ or account. If no permission is given, list all permissions on <object>.lock_storage = 'cmd:perm(perm) or perm(Developer)'
    +
    +
    +search_index_entry = {'aliases': 'setperm', 'category': 'admin', 'key': 'perm', 'tags': '', 'text': '\n set the permissions of an account/object\n\n Usage:\n perm[/switch] <object> [= <permission>[,<permission>,...]]\n perm[/switch] *<account> [= <permission>[,<permission>,...]]\n\n Switches:\n del - delete the given permission from <object> or <account>.\n account - set permission on an account (same as adding * to name)\n\n This command sets/clears individual permission strings on an object\n or account. If no permission is given, list all permissions on <object>.\n '}
    +
    +
    @@ -407,6 +437,11 @@ including all currently unlogged in.

    lock_storage = 'cmd:perm(wall) or perm(Admin)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'admin', 'key': 'wall', 'tags': '', 'text': '\n make an announcement to all\n\n Usage:\n wall <message>\n\n Announces a message to all connected sessions\n including all currently unlogged in.\n '}
    +
    +
    @@ -456,6 +491,11 @@ including all currently unlogged in.

    lock_storage = 'cmd:perm(spawn) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'building', 'key': 'force', 'tags': '', 'text': '\n forces an object to execute a command\n\n Usage:\n force <object>=<command string>\n\n Example:\n force bob=get stick\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.commands.default.batchprocess.html b/docs/0.9.5/api/evennia.commands.default.batchprocess.html index bbf5a95917..92365d3567 100644 --- a/docs/0.9.5/api/evennia.commands.default.batchprocess.html +++ b/docs/0.9.5/api/evennia.commands.default.batchprocess.html @@ -103,6 +103,11 @@ skipping, reloading etc.

    lock_storage = 'cmd:perm(batchcommands) or perm(Developer)'
    +
    +
    +search_index_entry = {'aliases': 'batchcommand batchcmd', 'category': 'building', 'key': 'batchcommands', 'tags': '', 'text': '\n build from batch-command file\n\n Usage:\n batchcommands[/interactive] <python.path.to.file>\n\n Switch:\n interactive - this mode will offer more control when\n executing the batch file, like stepping,\n skipping, reloading etc.\n\n Runs batches of commands from a batch-cmd text file (*.ev).\n\n '}
    +
    +
    @@ -161,6 +166,11 @@ object copies behind when testing out the script.

    lock_storage = 'cmd:superuser()'
    +
    +
    +search_index_entry = {'aliases': 'batchcodes', 'category': 'building', 'key': 'batchcode', 'tags': '', 'text': '\n build from batch-code file\n\n Usage:\n batchcode[/interactive] <python path to file>\n\n Switch:\n interactive - this mode will offer more control when\n executing the batch file, like stepping,\n skipping, reloading etc.\n debug - auto-delete all objects that has been marked as\n deletable in the script file (see example files for\n syntax). This is useful so as to to not leave multiple\n object copies behind when testing out the script.\n\n Runs batches of commands from a batch-code text file (*.py).\n\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.commands.default.building.html b/docs/0.9.5/api/evennia.commands.default.building.html index 73e739260c..ca38b95a61 100644 --- a/docs/0.9.5/api/evennia.commands.default.building.html +++ b/docs/0.9.5/api/evennia.commands.default.building.html @@ -85,6 +85,11 @@ the cases, see the module doc.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'command', 'tags': '', 'text': "\n This is a parent class for some of the defining objmanip commands\n since they tend to have some more variables to define new objects.\n\n Each object definition can have several components. First is\n always a name, followed by an optional alias list and finally an\n some optional data, such as a typeclass or a location. A comma ','\n separates different objects. Like this:\n\n name1;alias;alias;alias:option, name2;alias;alias ...\n\n Spaces between all components are stripped.\n\n A second situation is attribute manipulation. Such commands\n are simpler and offer combinations\n\n objname/attr/attr/attr, objname/attr, ...\n\n "}
    +
    +
    @@ -146,6 +151,11 @@ by everyone.

    lock_storage = 'cmd:perm(setobjalias) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'setobjalias', 'category': 'building', 'key': 'alias', 'tags': '', 'text': "\n adding permanent aliases for object\n\n Usage:\n alias <obj> [= [alias[,alias,alias,...]]]\n alias <obj> =\n alias/category <obj> = [alias[,alias,...]:<category>\n\n Switches:\n category - requires ending input with :category, to store the\n given aliases with the given category.\n\n Assigns aliases to an object so it can be referenced by more\n than one name. Assign empty to remove all aliases from object. If\n assigning a category, all aliases given will be using this category.\n\n Observe that this is not the same thing as personal aliases\n created with the 'nick' command! Aliases set with alias are\n changing the object in question, making those aliases usable\n by everyone.\n "}
    +
    +
    @@ -191,6 +201,11 @@ one exact copy of the original object will be created with the name lock_storage = 'cmd:perm(copy) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'building', 'key': 'copy', 'tags': '', 'text': "\n copy an object and its properties\n\n Usage:\n copy <original obj> [= <new_name>][;alias;alias..]\n [:<new_location>] [,<new_name2> ...]\n\n Create one or more copies of an object. If you don't supply any targets,\n one exact copy of the original object will be created with the name *_copy.\n "}
    +
    +
    @@ -283,6 +298,11 @@ required and get the attribute from the object.

    lock_storage = 'cmd:perm(cpattr) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'building', 'key': 'cpattr', 'tags': '', 'text': "\n copy attributes between objects\n\n Usage:\n cpattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]\n cpattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...]\n cpattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]\n cpattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]\n\n Switches:\n move - delete the attribute from the source object after copying.\n\n Example:\n cpattr coolness = Anna/chillout, Anna/nicety, Tom/nicety\n ->\n copies the coolness attribute (defined on yourself), to attributes\n on Anna and Tom.\n\n Copy the attribute one object to one or more attributes on another object.\n If you don't supply a source object, yourself is used.\n "}
    +
    +
    @@ -337,6 +357,11 @@ object. If you don’t supply a source object, yourself is used.

    lock_storage = 'cmd:perm(mvattr) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'building', 'key': 'mvattr', 'tags': '', 'text': "\n move attributes between objects\n\n Usage:\n mvattr[/switch] <obj>/<attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]\n mvattr[/switch] <obj>/<attr> = <obj1> [,<obj2>,<obj3>,...]\n mvattr[/switch] <attr> = <obj1>/<attr1> [,<obj2>/<attr2>,<obj3>/<attr3>,...]\n mvattr[/switch] <attr> = <obj1>[,<obj2>,<obj3>,...]\n\n Switches:\n copy - Don't delete the original after moving.\n\n Move an attribute from one object to one or more attributes on another\n object. If you don't supply a source object, yourself is used.\n "}
    +
    +
    @@ -405,6 +430,11 @@ object of this type like this:

    lock_storage = 'cmd:perm(create) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'building', 'key': 'create', 'tags': '', 'text': "\n create new objects\n\n Usage:\n create[/drop] <objname>[;alias;alias...][:typeclass], <objname>...\n\n switch:\n drop - automatically drop the new object into your current\n location (this is not echoed). This also sets the new\n object's home to the current location rather than to you.\n\n Creates one or more new objects. If typeclass is given, the object\n is created as a child of this typeclass. The typeclass script is\n assumed to be located under types/ and any further\n directory structure is given in Python notation. So if you have a\n correct typeclass 'RedButton' defined in\n types/examples/red_button.py, you could create a new\n object of this type like this:\n\n create/drop button;red : examples.red_button.RedButton\n\n "}
    +
    +
    @@ -461,6 +491,11 @@ describe the current room.

    lock_storage = 'cmd:perm(desc) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'describe', 'category': 'building', 'key': 'desc', 'tags': '', 'text': '\n describe an object or the current room.\n\n Usage:\n desc [<obj> =] <description>\n\n Switches:\n edit - Open up a line editor for more advanced editing.\n\n Sets the "desc" attribute on an object. If an object is not given,\n describe the current room.\n '}
    +
    +
    @@ -493,7 +528,7 @@ You can specify the /force switch to bypass this confirmation.

    -aliases = ['delete', 'del']
    +aliases = ['del', 'delete']
    @@ -532,6 +567,11 @@ You can specify the /force switch to bypass this confirmation.

    lock_storage = 'cmd:perm(destroy) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'del delete', 'category': 'building', 'key': 'destroy', 'tags': '', 'text': '\n permanently delete objects\n\n Usage:\n destroy[/switches] [obj, obj2, obj3, [dbref-dbref], ...]\n\n Switches:\n override - The destroy command will usually avoid accidentally\n destroying account objects. This switch overrides this safety.\n force - destroy without confirmation.\n Examples:\n destroy house, roof, door, 44-78\n destroy 5-10, flower, 45\n destroy/force north\n\n Destroys one or many objects. If dbrefs are used, a range to delete can be\n given, e.g. 4-10. Also the end points will be deleted. This command\n displays a confirmation before destroying, to make sure of your choice.\n You can specify the /force switch to bypass this confirmation.\n '}
    +
    +
    @@ -601,6 +641,11 @@ would be ‘north;no;n’.

    lock_storage = 'cmd:perm(dig) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'building', 'key': 'dig', 'tags': '', 'text': "\n build new rooms and connect them to the current location\n\n Usage:\n dig[/switches] <roomname>[;alias;alias...][:typeclass]\n [= <exit_to_there>[;alias][:typeclass]]\n [, <exit_to_here>[;alias][:typeclass]]\n\n Switches:\n tel or teleport - move yourself to the new room\n\n Examples:\n dig kitchen = north;n, south;s\n dig house:myrooms.MyHouseTypeclass\n dig sheer cliff;cliff;sheer = climb up, climb down\n\n This command is a convenient way to build rooms quickly; it creates the\n new room and you can optionally set up exits back and forth between your\n current room and the new one. You can add as many aliases as you\n like to the name of the room and the exits in question; an example\n would be 'north;no;n'.\n "}
    +
    +
    @@ -671,6 +716,11 @@ For more flexibility and power in creating rooms, use dig.

    lock_storage = 'cmd: perm(tunnel) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'tun', 'category': 'building', 'key': 'tunnel', 'tags': '', 'text': '\n create new rooms in cardinal directions only\n\n Usage:\n tunnel[/switch] <direction>[:typeclass] [= <roomname>[;alias;alias;...][:typeclass]]\n\n Switches:\n oneway - do not create an exit back to the current location\n tel - teleport to the newly created room\n\n Example:\n tunnel n\n tunnel n = house;mike\'s place;green building\n\n This is a simple way to build using pre-defined directions:\n |wn,ne,e,se,s,sw,w,nw|n (north, northeast etc)\n |wu,d|n (up and down)\n |wi,o|n (in and out)\n The full names (north, in, southwest, etc) will always be put as\n main name for the exit, using the abbreviation as an alias (so an\n exit will always be able to be used with both "north" as well as\n "n" for example). Opposite directions will automatically be\n created back from the new room unless the /oneway switch is given.\n For more flexibility and power in creating rooms, use dig.\n '}
    +
    +
    @@ -726,6 +776,11 @@ currently set destination.

    lock_storage = 'cmd:perm(link) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'building', 'key': 'link', 'tags': '', 'text': '\n link existing rooms together with exits\n\n Usage:\n link[/switches] <object> = <target>\n link[/switches] <object> =\n link[/switches] <object>\n\n Switch:\n twoway - connect two exits. For this to work, BOTH <object>\n and <target> must be exit objects.\n\n If <object> is an exit, set its destination to <target>. Two-way operation\n instead sets the destination to the *locations* of the respective given\n arguments.\n The second form (a lone =) sets the destination to None (same as\n the unlink command) and the third form (without =) just shows the\n currently set destination.\n '}
    +
    +
    @@ -776,6 +831,11 @@ and call func in CmdLink

    lock_storage = 'cmd:perm(unlink) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'building', 'key': 'unlink', 'tags': '', 'text': '\n remove exit-connections between rooms\n\n Usage:\n unlink <Object>\n\n Unlinks an object, for example an exit, disconnecting\n it from whatever it was connected to.\n '}
    +
    +
    @@ -824,6 +884,11 @@ It is also a convenient target of the “home” command.

    lock_storage = 'cmd:perm(sethome) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'building', 'key': 'sethome', 'tags': '', 'text': '\n set an object\'s home location\n\n Usage:\n sethome <obj> [= <home_location>]\n sethom <obj>\n\n The "home" location is a "safety" location for objects; they\n will be moved there if their current location ceases to exist. All\n objects should always have a home location for this reason.\n It is also a convenient target of the "home" command.\n\n If no location is given, just view the object\'s home location.\n '}
    +
    +
    @@ -868,6 +933,11 @@ to a user. Defaults to yourself.

    lock_storage = 'cmd:perm(listcmdsets) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'listcmsets', 'category': 'building', 'key': 'cmdsets', 'tags': '', 'text': '\n list command sets defined on an object\n\n Usage:\n cmdsets <obj>\n\n This displays all cmdsets assigned\n to a user. Defaults to yourself.\n '}
    +
    +
    @@ -912,6 +982,11 @@ rename an account.

    lock_storage = 'cmd:perm(rename) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'rename', 'category': 'building', 'key': 'name', 'tags': '', 'text': '\n change the name and/or aliases of an object\n\n Usage:\n name <obj> = <newname>;alias1;alias2\n\n Rename an object to something new. Use *obj to\n rename an account.\n\n '}
    +
    +
    @@ -973,6 +1048,11 @@ as well as the self.create_exit() method.

    lock_storage = 'cmd:perm(open) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'building', 'key': 'open', 'tags': '', 'text': '\n open a new exit from the current room\n\n Usage:\n open <new exit>[;alias;alias..][:typeclass] [,<return exit>[;alias;..][:typeclass]]] = <destination>\n\n Handles the creation of exits. If a destination is given, the exit\n will point there. The <return exit> argument sets up an exit at the\n destination leading back to the current room. Destination name\n can be given both as a #dbref and a name, if that name is globally\n unique.\n\n '}
    +
    +
    @@ -1128,6 +1208,11 @@ with older attrs that might have been named with []’s.

    lock_storage = 'cmd:perm(set) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'building', 'key': 'set', 'tags': '', 'text': '\n set attribute on an object or account\n\n Usage:\n set <obj>/<attr> = <value>\n set <obj>/<attr> =\n set <obj>/<attr>\n set *<account>/<attr> = <value>\n\n Switch:\n edit: Open the line editor (string values only)\n script: If we\'re trying to set an attribute on a script\n channel: If we\'re trying to set an attribute on a channel\n account: If we\'re trying to set an attribute on an account\n room: Setting an attribute on a room (global search)\n exit: Setting an attribute on an exit (global search)\n char: Setting an attribute on a character (global search)\n character: Alias for char, as above.\n\n Sets attributes on objects. The second example form above clears a\n previously set attribute while the third form inspects the current value of\n the attribute (if any). The last one (with the star) is a shortcut for\n operating on a player Account rather than an Object.\n\n The most common data to save with this command are strings and\n numbers. You can however also set Python primitives such as lists,\n dictionaries and tuples on objects (this might be important for\n the functionality of certain custom objects). This is indicated\n by you starting your value with one of |c\'|n, |c"|n, |c(|n, |c[|n\n or |c{ |n.\n\n Once you have stored a Python primitive as noted above, you can include\n |c[<key>]|n in <attr> to reference nested values in e.g. a list or dict.\n\n Remember that if you use Python primitives like this, you must\n write proper Python syntax too - notably you must include quotes\n around your strings or you will get an error.\n\n '}
    +
    +
    @@ -1182,7 +1267,7 @@ server settings.

    -aliases = ['parent', 'swap', 'type', 'update']
    +aliases = ['swap', 'parent', 'update', 'type']
    @@ -1211,6 +1296,11 @@ server settings.

    lock_storage = 'cmd:perm(typeclass) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'swap parent update type', 'category': 'building', 'key': 'typeclass', 'tags': '', 'text': "\n set or change an object's typeclass\n\n Usage:\n typeclass[/switch] <object> [= typeclass.path]\n typeclass/prototype <object> = prototype_key\n\n typeclass/list/show [typeclass.path]\n swap - this is a shorthand for using /force/reset flags.\n update - this is a shorthand for using the /force/reload flag.\n\n Switch:\n show, examine - display the current typeclass of object (default) or, if\n given a typeclass path, show the docstring of that typeclass.\n update - *only* re-run at_object_creation on this object\n meaning locks or other properties set later may remain.\n reset - clean out *all* the attributes and properties on the\n object - basically making this a new clean object.\n force - change to the typeclass also if the object\n already has a typeclass of the same name.\n list - show available typeclasses. Only typeclasses in modules actually\n imported or used from somewhere in the code will show up here\n (those typeclasses are still available if you know the path)\n prototype - clean and overwrite the object with the specified\n prototype key - effectively making a whole new object.\n\n Example:\n type button = examples.red_button.RedButton\n type/prototype button=a red button\n\n If the typeclass_path is not given, the current object's typeclass is\n assumed.\n\n View or set an object's typeclass. If setting, the creation hooks of the\n new typeclass will be run on the object. If you have clashing properties on\n the old class, use /reset. By default you are protected from changing to a\n typeclass of the same name as the one you already have - use /force to\n override this protection.\n\n The given typeclass must be identified by its location using python\n dot-notation pointing to the correct module and class. If no typeclass is\n given (or a wrong typeclass is given). Errors in the path or new typeclass\n will lead to the old typeclass being kept. The location of the typeclass\n module is searched from the default typeclass directory, as defined in the\n server settings.\n\n "}
    +
    +
    @@ -1258,6 +1348,11 @@ matching the given attribute-wildcard search string.

    lock_storage = 'cmd:perm(wipe) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'building', 'key': 'wipe', 'tags': '', 'text': "\n clear all attributes from an object\n\n Usage:\n wipe <object>[/<attr>[/<attr>...]]\n\n Example:\n wipe box\n wipe box/colour\n\n Wipes all of an object's attributes, or optionally only those\n matching the given attribute-wildcard search string.\n "}
    +
    +
    @@ -1325,6 +1420,11 @@ them by ‘;’, i.e:

    lock_storage = 'cmd: perm(locks) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'locks', 'category': 'building', 'key': 'lock', 'tags': '', 'text': "\n assign a lock definition to an object\n\n Usage:\n lock <object or *account>[ = <lockstring>]\n or\n lock[/switch] <object or *account>/<access_type>\n\n Switch:\n del - delete given access type\n view - view lock associated with given access type (default)\n\n If no lockstring is given, shows all locks on\n object.\n\n Lockstring is of the form\n access_type:[NOT] func1(args)[ AND|OR][ NOT] func2(args) ...]\n Where func1, func2 ... valid lockfuncs with or without arguments.\n Separator expressions need not be capitalized.\n\n For example:\n 'get: id(25) or perm(Admin)'\n The 'get' lock access_type is checked e.g. by the 'get' command.\n An object locked with this example lock will only be possible to pick up\n by Admins or by an object with id=25.\n\n You can add several access_types after one another by separating\n them by ';', i.e:\n 'get:id(25); delete:perm(Builder)'\n "}
    +
    +
    @@ -1351,7 +1451,7 @@ If object is not specified, the current location is examined.

    -aliases = ['ex', 'exam']
    +aliases = ['exam', 'ex']
    @@ -1446,6 +1546,11 @@ non-persistent data stored on object

    lock_storage = 'cmd:perm(examine) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'exam ex', 'category': 'building', 'key': 'examine', 'tags': '', 'text': '\n get detailed information about an object\n\n Usage:\n examine [<object>[/attrname]]\n examine [*<account>[/attrname]]\n\n Switch:\n account - examine an Account (same as adding *)\n object - examine an Object (useful when OOC)\n\n The examine command shows detailed game info about an\n object and optionally a specific attribute on it.\n If object is not specified, the current location is examined.\n\n Append a * before the search string to examine an account.\n\n '}
    +
    +
    @@ -1477,7 +1582,7 @@ one is given.

    -aliases = ['locate', 'search']
    +aliases = ['search', 'locate']
    @@ -1506,6 +1611,11 @@ one is given.

    lock_storage = 'cmd:perm(find) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'search locate', 'category': 'building', 'key': 'find', 'tags': '', 'text': '\n search the database for objects\n\n Usage:\n find[/switches] <name or dbref or *account> [= dbrefmin[-dbrefmax]]\n locate - this is a shorthand for using the /loc switch.\n\n Switches:\n room - only look for rooms (location=None)\n exit - only look for exits (destination!=None)\n char - only look for characters (BASE_CHARACTER_TYPECLASS)\n exact - only exact matches are returned.\n loc - display object location if exists and match has one result\n startswith - search for names starting with the string, rather than containing\n\n Searches the database for an object of a particular name or exact #dbref.\n Use *accountname to search for an account. The switches allows for\n limiting object matches to certain game entities. Dbrefmin and dbrefmax\n limits matches to within the given dbrefs range, or above/below if only\n one is given.\n '}
    +
    +
    @@ -1579,6 +1689,11 @@ teleported to the target location.

    lock_storage = 'cmd:perm(teleport) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'teleport', 'category': 'building', 'key': 'tel', 'tags': '', 'text': "\n teleport object to another location\n\n Usage:\n tel/switch [<object> to||=] <target location>\n\n Examples:\n tel Limbo\n tel/quiet box = Limbo\n tel/tonone box\n\n Switches:\n quiet - don't echo leave/arrive messages to the source/target\n locations for the move.\n intoexit - if target is an exit, teleport INTO\n the exit object instead of to its destination\n tonone - if set, teleport the object to a None-location. If this\n switch is set, <target location> is ignored.\n Note that the only way to retrieve\n an object from a None location is by direct #dbref\n reference. A puppeted object cannot be moved to None.\n loc - teleport object to the target's location instead of its contents\n\n Teleports an object somewhere. If no object is given, you yourself are\n teleported to the target location.\n "}
    +
    +
    @@ -1636,6 +1751,11 @@ the object.

    lock_storage = 'cmd:perm(script) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'addscript', 'category': 'building', 'key': 'script', 'tags': '', 'text': '\n attach a script to an object\n\n Usage:\n script[/switch] <obj> [= script_path or <scriptkey>]\n\n Switches:\n start - start all non-running scripts on object, or a given script only\n stop - stop all scripts on objects, or a given script only\n\n If no script path/key is given, lists all scripts active on the given\n object.\n Script path can be given from the base location for scripts as given in\n settings. If adding a new script, it will be started automatically\n (no /start switch is needed). Using the /start or /stop switches on an\n object without specifying a script key/path will start/stop ALL scripts on\n the object.\n '}
    +
    +
    @@ -1702,6 +1822,11 @@ enough to for most grouping schemes.

    lock_storage = 'cmd:perm(tag) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'tags', 'category': 'building', 'key': 'tag', 'tags': '', 'text': '\n handles the tags of an object\n\n Usage:\n tag[/del] <obj> [= <tag>[:<category>]]\n tag/search <tag>[:<category]\n\n Switches:\n search - return all objects with a given Tag\n del - remove the given tag. If no tag is specified,\n clear all tags on object.\n\n Manipulates and lists tags on objects. Tags allow for quick\n grouping of and searching for objects. If only <obj> is given,\n list all tags on the object. If /search is used, list objects\n with the given tag.\n The category can be used for grouping tags themselves, but it\n should be used with restrain - tags on their own are usually\n enough to for most grouping schemes.\n '}
    +
    +
    @@ -1808,6 +1933,11 @@ displays a list of available prototypes.

    lock_storage = 'cmd:perm(spawn) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'olc', 'category': 'building', 'key': 'spawn', 'tags': '', 'text': '\n spawn objects from prototype\n\n Usage:\n spawn[/noloc] <prototype_key>\n spawn[/noloc] <prototype_dict>\n\n spawn/search [prototype_keykey][;tag[,tag]]\n spawn/list [tag, tag, ...]\n spawn/list modules - list only module-based prototypes\n spawn/show [<prototype_key>]\n spawn/update <prototype_key>\n\n spawn/save <prototype_dict>\n spawn/edit [<prototype_key>]\n olc - equivalent to spawn/edit\n\n Switches:\n noloc - allow location to be None if not specified explicitly. Otherwise,\n location will default to caller\'s current location.\n search - search prototype by name or tags.\n list - list available prototypes, optionally limit by tags.\n show, examine - inspect prototype by key. If not given, acts like list.\n raw - show the raw dict of the prototype as a one-line string for manual editing.\n save - save a prototype to the database. It will be listable by /list.\n delete - remove a prototype from database, if allowed to.\n update - find existing objects with the same prototype_key and update\n them with latest version of given prototype. If given with /save,\n will auto-update all objects with the old version of the prototype\n without asking first.\n edit, menu, olc - create/manipulate prototype in a menu interface.\n\n Example:\n spawn GOBLIN\n spawn {"key":"goblin", "typeclass":"monster.Monster", "location":"#2"}\n spawn/save {"key": "grunt", prototype: "goblin"};;mobs;edit:all()\n \x0c\n Dictionary keys:\n |wprototype_parent |n - name of parent prototype to use. Required if typeclass is\n not set. Can be a path or a list for multiple inheritance (inherits\n left to right). If set one of the parents must have a typeclass.\n |wtypeclass |n - string. Required if prototype_parent is not set.\n |wkey |n - string, the main object identifier\n |wlocation |n - this should be a valid object or #dbref\n |whome |n - valid object or #dbref\n |wdestination|n - only valid for exits (object or dbref)\n |wpermissions|n - string or list of permission strings\n |wlocks |n - a lock-string\n |waliases |n - string or list of strings.\n |wndb_|n<name> - value of a nattribute (ndb_ is stripped)\n\n |wprototype_key|n - name of this prototype. Unique. Used to store/retrieve from db\n and update existing prototyped objects if desired.\n |wprototype_desc|n - desc of this prototype. Used in listings\n |wprototype_locks|n - locks of this prototype. Limits who may use prototype\n |wprototype_tags|n - tags of this prototype. Used to find prototype\n\n any other keywords are interpreted as Attributes and their values.\n\n The available prototypes are defined globally in modules set in\n settings.PROTOTYPE_MODULES. If spawn is used without arguments it\n displays a list of available prototypes.\n\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.commands.default.comms.html b/docs/0.9.5/api/evennia.commands.default.comms.html index 728dd26ab2..d179a186d2 100644 --- a/docs/0.9.5/api/evennia.commands.default.comms.html +++ b/docs/0.9.5/api/evennia.commands.default.comms.html @@ -63,7 +63,7 @@ aliases to an already joined channel.

    -aliases = ['aliaschan', 'chanalias']
    +aliases = ['chanalias', 'aliaschan']
    @@ -92,6 +92,11 @@ aliases to an already joined channel.

    lock_storage = 'cmd:not pperm(channel_banned)'
    +
    +
    +search_index_entry = {'aliases': 'chanalias aliaschan', 'category': 'comms', 'key': 'addcom', 'tags': '', 'text': '\n add a channel alias and/or subscribe to a channel\n\n Usage:\n addcom [alias=] <channel>\n\n Joins a given channel. If alias is given, this will allow you to\n refer to the channel by this alias rather than the full channel\n name. Subsequent calls of this command can be used to add multiple\n aliases to an already joined channel.\n '}
    +
    +
    @@ -144,6 +149,11 @@ for that channel.

    lock_storage = 'cmd:not perm(channel_banned)'
    +
    +
    +search_index_entry = {'aliases': 'delchanalias delaliaschan', 'category': 'comms', 'key': 'delcom', 'tags': '', 'text': "\n remove a channel alias and/or unsubscribe from channel\n\n Usage:\n delcom <alias or channel>\n delcom/all <channel>\n\n If the full channel name is given, unsubscribe from the\n channel. If an alias is given, remove the alias but don't\n unsubscribe. If the 'all' switch is used, remove all aliases\n for that channel.\n "}
    +
    +
    @@ -195,6 +205,11 @@ channels that you control.

    lock_storage = 'cmd: not pperm(channel_banned)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'comms', 'key': 'allcom', 'tags': '', 'text': "\n perform admin operations on all channels\n\n Usage:\n allcom [on | off | who | destroy]\n\n Allows the user to universally turn off or on all channels they are on, as\n well as perform a 'who' for all channels they are on. Destroy deletes all\n channels that you control.\n\n Without argument, works like comlist.\n "}
    +
    +
    @@ -218,7 +233,7 @@ Use addcom/delcom to join and leave channels

    -aliases = ['comlist', 'clist', 'all channels', 'channellist', 'chanlist']
    +aliases = ['comlist', 'chanlist', 'channellist', 'clist', 'all channels']
    @@ -247,6 +262,11 @@ Use addcom/delcom to join and leave channels

    lock_storage = 'cmd: not pperm(channel_banned)'
    +
    +
    +search_index_entry = {'aliases': 'comlist chanlist channellist clist all channels', 'category': 'comms', 'key': 'channels', 'tags': '', 'text': "\n list all channels available to you\n\n Usage:\n channels\n clist\n comlist\n\n Lists all channels available to you, whether you listen to them or not.\n Use 'comlist' to only view your current channel subscriptions.\n Use addcom/delcom to join and leave channels\n "}
    +
    +
    @@ -295,6 +315,11 @@ Use addcom/delcom to join and leave channels

    lock_storage = 'cmd: not pperm(channel_banned)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'comms', 'key': 'cdestroy', 'tags': '', 'text': '\n destroy a channel you created\n\n Usage:\n cdestroy <channel>\n\n Destroys a channel that you control.\n '}
    +
    +
    @@ -350,6 +375,11 @@ Use addcom/delcom to join and leave channels

    lock_storage = 'cmd: not pperm(channel_banned)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'comms', 'key': 'cboot', 'tags': '', 'text': "\n kick an account from a channel you control\n\n Usage:\n cboot[/quiet] <channel> = <account> [:reason]\n\n Switch:\n quiet - don't notify the channel\n\n Kicks an account or object from a channel you control.\n\n "}
    +
    +
    @@ -408,6 +438,11 @@ provide the /sendername switch.

    lock_storage = 'cmd: not pperm(channel_banned) and pperm(Player)'
    +
    +
    +search_index_entry = {'aliases': 'cmsg', 'category': 'comms', 'key': 'cemit', 'tags': '', 'text': "\n send an admin message to a channel you control\n\n Usage:\n cemit[/switches] <channel> = <message>\n\n Switches:\n sendername - attach the sender's name before the message\n quiet - don't echo the message back to sender\n\n Allows the user to broadcast a message over a channel as long as\n they control it. It does not show the user's name unless they\n provide the /sendername switch.\n\n "}
    +
    +
    @@ -456,6 +491,11 @@ provide the /sendername switch.

    lock_storage = 'cmd: not pperm(channel_banned)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'comms', 'key': 'cwho', 'tags': '', 'text': '\n show who is listening to a channel\n\n Usage:\n cwho <channel>\n\n List who is connected to a given channel you have access to.\n '}
    +
    +
    @@ -504,6 +544,11 @@ provide the /sendername switch.

    lock_storage = 'cmd:not pperm(channel_banned) and pperm(Player)'
    +
    +
    +search_index_entry = {'aliases': 'channelcreate', 'category': 'comms', 'key': 'ccreate', 'tags': '', 'text': '\n create a new channel\n\n Usage:\n ccreate <new channel>[;alias;alias...] = description\n\n Creates a new channel owned by you.\n '}
    +
    +
    @@ -553,6 +598,11 @@ lockstring was given, view the current lock definitions.

    lock_storage = 'cmd:not pperm(channel_banned)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'comms', 'key': 'clock', 'tags': '', 'text': '\n change channel locks of a channel you control\n\n Usage:\n clock <channel> [= <lockstring>]\n\n Changes the lock access restrictions of a channel. If no\n lockstring was given, view the current lock definitions.\n '}
    +
    +
    @@ -602,6 +652,11 @@ channel lists.

    lock_storage = 'cmd:not pperm(channel_banned)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'comms', 'key': 'cdesc', 'tags': '', 'text': '\n describe a channel you control\n\n Usage:\n cdesc <channel> = <description>\n\n Changes the description of the channel as shown in\n channel lists.\n '}
    +
    +
    @@ -661,6 +716,11 @@ argument is given, you will get a list of your latest messages.

    lock_storage = 'cmd:not pperm(page_banned)'
    +
    +
    +search_index_entry = {'aliases': 'tell', 'category': 'comms', 'key': 'page', 'tags': '', 'text': "\n send a private message to another account\n\n Usage:\n page[/switches] [<account>,<account>,... = <message>]\n tell ''\n page <number>\n\n Switch:\n last - shows who you last messaged\n list - show your last <number> of tells/pages (default)\n\n Send a message to target user (if online). If no\n argument is given, you will get a list of your latest messages.\n "}
    +
    +
    @@ -738,6 +798,11 @@ Provide an optional bot class path to use a custom bot.

    lock_storage = 'cmd:serversetting(IRC_ENABLED) and pperm(Developer)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'comms', 'key': 'irc2chan', 'tags': '', 'text': '\n Link an evennia channel to an external IRC channel\n\n Usage:\n irc2chan[/switches] <evennia_channel> = <ircnetwork> <port> <#irchannel> <botname>[:typeclass]\n irc2chan/delete botname|#dbid\n\n Switches:\n /delete - this will delete the bot and remove the irc connection\n to the channel. Requires the botname or #dbid as input.\n /remove - alias to /delete\n /disconnect - alias to /delete\n /list - show all irc<->evennia mappings\n /ssl - use an SSL-encrypted connection\n\n Example:\n irc2chan myircchan = irc.dalnet.net 6667 #mychannel evennia-bot\n irc2chan public = irc.freenode.net 6667 #evgaming #evbot:accounts.mybot.MyBot\n\n This creates an IRC bot that connects to a given IRC network and\n channel. If a custom typeclass path is given, this will be used\n instead of the default bot class.\n The bot will relay everything said in the evennia channel to the\n IRC channel and vice versa. The bot will automatically connect at\n server start, so this command need only be given once. The\n /disconnect switch will permanently delete the bot. To only\n temporarily deactivate it, use the |wservices|n command instead.\n Provide an optional bot class path to use a custom bot.\n '}
    +
    +
    @@ -789,6 +854,11 @@ messages sent to either channel will be lost.

    lock_storage = 'cmd:serversetting(IRC_ENABLED) and perm(ircstatus) or perm(Builder))'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'comms', 'key': 'ircstatus', 'tags': '', 'text': "\n Check and reboot IRC bot.\n\n Usage:\n ircstatus [#dbref ping||nicklist||reconnect]\n\n If not given arguments, will return a list of all bots (like\n irc2chan/list). The 'ping' argument will ping the IRC network to\n see if the connection is still responsive. The 'nicklist' argument\n (aliases are 'who' and 'users') will return a list of users on the\n remote IRC channel. Finally, 'reconnect' will force the client to\n disconnect and reconnect again. This may be a last resort if the\n client has silently lost connection (this may happen if the remote\n network experience network issues). During the reconnection\n messages sent to either channel will be lost.\n\n "}
    +
    +
    @@ -861,6 +931,11 @@ to identify the connection uniquely.

    lock_storage = 'cmd:serversetting(RSS_ENABLED) and pperm(Developer)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'comms', 'key': 'rss2chan', 'tags': '', 'text': '\n link an evennia channel to an external RSS feed\n\n Usage:\n rss2chan[/switches] <evennia_channel> = <rss_url>\n\n Switches:\n /disconnect - this will stop the feed and remove the connection to the\n channel.\n /remove - "\n /list - show all rss->evennia mappings\n\n Example:\n rss2chan rsschan = http://code.google.com/feeds/p/evennia/updates/basic\n\n This creates an RSS reader that connects to a given RSS feed url. Updates\n will be echoed as a title and news link to the given channel. The rate of\n updating is set with the RSS_UPDATE_INTERVAL variable in settings (default\n is every 10 minutes).\n\n When disconnecting you need to supply both the channel and url again so as\n to identify the connection uniquely.\n '}
    +
    +
    @@ -934,6 +1009,11 @@ must be added to game settings.

    lock_storage = 'cmd:serversetting(GRAPEVINE_ENABLED) and pperm(Developer)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'comms', 'key': 'grapevine2chan', 'tags': '', 'text': '\n Link an Evennia channel to an exteral Grapevine channel\n\n Usage:\n grapevine2chan[/switches] <evennia_channel> = <grapevine_channel>\n grapevine2chan/disconnect <connection #id>\n\n Switches:\n /list - (or no switch): show existing grapevine <-> Evennia\n mappings and available grapevine chans\n /remove - alias to disconnect\n /delete - alias to disconnect\n\n Example:\n grapevine2chan mygrapevine = gossip\n\n This creates a link between an in-game Evennia channel and an external\n Grapevine channel. The game must be registered with the Grapevine network\n (register at https://grapevine.haus) and the GRAPEVINE_* auth information\n must be added to game settings.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.commands.default.general.html b/docs/0.9.5/api/evennia.commands.default.general.html index 1855adb271..b4504174b6 100644 --- a/docs/0.9.5/api/evennia.commands.default.general.html +++ b/docs/0.9.5/api/evennia.commands.default.general.html @@ -85,6 +85,11 @@ lock_storage = 'cmd:perm(home) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'home', 'tags': '', 'text': "\n move to your character's home location\n\n Usage:\n home\n\n Teleports you to your home location.\n "}
    +
    +
    @@ -135,6 +140,11 @@ look *<account&g lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'l ls', 'category': 'general', 'key': 'look', 'tags': '', 'text': '\n look at location or object\n\n Usage:\n look\n look <obj>\n look *<account>\n\n Observes your location or objects in your vicinity.\n '}
    +
    +
    @@ -224,6 +234,11 @@ for everyone to use, you need build privileges and the alias command.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'nickname nicks', 'category': 'general', 'key': 'nick', 'tags': '', 'text': '\n define a personal alias/nick by defining a string to\n match and replace it with another on the fly\n\n Usage:\n nick[/switches] <string> [= [replacement_string]]\n nick[/switches] <template> = <replacement_template>\n nick/delete <string> or number\n nicks\n\n Switches:\n inputline - replace on the inputline (default)\n object - replace on object-lookup\n account - replace on account-lookup\n list - show all defined aliases (also "nicks" works)\n delete - remove nick by index in /list\n clearall - clear all nicks\n\n Examples:\n nick hi = say Hello, I\'m Sarah!\n nick/object tom = the tall man\n nick build $1 $2 = create/drop $1;$2\n nick tell $1 $2=page $1=$2\n nick tm?$1=page tallman=$1\n nick tm\\=$1=page tallman=$1\n\n A \'nick\' is a personal string replacement. Use $1, $2, ... to catch arguments.\n Put the last $-marker without an ending space to catch all remaining text. You\n can also use unix-glob matching for the left-hand side <string>:\n\n * - matches everything\n ? - matches 0 or 1 single characters\n [abcd] - matches these chars in any order\n [!abcd] - matches everything not among these chars\n \\= - escape literal \'=\' you want in your <string>\n\n Note that no objects are actually renamed or changed by this command - your nicks\n are only available to you. If you want to permanently add keywords to an object\n for everyone to use, you need build privileges and the alias command.\n\n '}
    +
    +
    @@ -244,7 +259,7 @@ inv

    -aliases = ['inv', 'i']
    +aliases = ['i', 'inv']
    @@ -273,6 +288,11 @@ inv

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'i inv', 'category': 'general', 'key': 'inventory', 'tags': '', 'text': '\n view inventory\n\n Usage:\n inventory\n inv\n\n Shows your inventory.\n '}
    +
    +
    @@ -323,6 +343,11 @@ look at you.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'setdesc', 'tags': '', 'text': '\n describe yourself\n\n Usage:\n setdesc <description>\n\n Add a description to yourself. This\n will be visible to people when they\n look at you.\n '}
    +
    +
    @@ -372,6 +397,11 @@ your inventory.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'grab', 'category': 'general', 'key': 'get', 'tags': '', 'text': '\n pick up something\n\n Usage:\n get <obj>\n\n Picks up an object from your location and puts it in\n your inventory.\n '}
    +
    +
    @@ -421,6 +451,11 @@ location you are currently in.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'drop', 'tags': '', 'text': '\n drop something\n\n Usage:\n drop <obj>\n\n Lets you drop an object from your inventory into the\n location you are currently in.\n '}
    +
    +
    @@ -475,6 +510,11 @@ placing it in their inventory.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'give', 'tags': '', 'text': '\n give away something to someone\n\n Usage:\n give <inventory obj> <to||=> <target>\n\n Gives an items from your inventory to another character,\n placing it in their inventory.\n '}
    +
    +
    @@ -518,6 +558,11 @@ placing it in their inventory.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '" \'', 'category': 'general', 'key': 'say', 'tags': '', 'text': '\n speak as your character\n\n Usage:\n say <message>\n\n Talk to those in your current location.\n '}
    +
    +
    @@ -563,6 +608,11 @@ others in the room being informed.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'whisper', 'tags': '', 'text': '\n Speak privately as your character to another\n\n Usage:\n whisper <character> = <message>\n whisper <char1>, <char2> = <message>\n\n Talk privately to one or more characters in your current location, without\n others in the room being informed.\n '}
    +
    +
    @@ -590,7 +640,7 @@ automatically begin with your name.

    -aliases = ['emote', ':']
    +aliases = [':', 'emote']
    @@ -624,6 +674,11 @@ space.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': ': emote', 'category': 'general', 'key': 'pose', 'tags': '', 'text': "\n strike a pose\n\n Usage:\n pose <pose text>\n pose's <pose text>\n\n Example:\n pose is standing by the wall, smiling.\n -> others will see:\n Tom is standing by the wall, smiling.\n\n Describe an action being taken. The pose text will\n automatically begin with your name.\n "}
    +
    +
    @@ -673,6 +728,11 @@ which permission groups you are a member of.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'hierarchy groups', 'category': 'general', 'key': 'access', 'tags': '', 'text': '\n show your current game access\n\n Usage:\n access\n\n This command shows you the permission hierarchy and\n which permission groups you are a member of.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.commands.default.help.html b/docs/0.9.5/api/evennia.commands.default.help.html index 699f3ee531..6c9d93564f 100644 --- a/docs/0.9.5/api/evennia.commands.default.help.html +++ b/docs/0.9.5/api/evennia.commands.default.help.html @@ -125,7 +125,7 @@ entry is displayed.

    -static format_help_list(hdict_cmds, hdict_db)[source]
    +format_help_list(hdict_cmds, hdict_db)[source]

    Output a category-ordered list. The input are the pre-loaded help files for commands and database-helpfiles respectively. You can override this method to return a @@ -199,6 +199,11 @@ False: the command shouldn’t appear in the table.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '?', 'category': 'general', 'key': 'help', 'tags': '', 'text': '\n View help or a list of topics\n\n Usage:\n help <topic or command>\n help list\n help all\n\n This will search for help on commands and other\n topics related to the game.\n '}
    +
    +
    @@ -261,6 +266,11 @@ is to let everyone read the help file.

    lock_storage = 'cmd:perm(Helper)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'building', 'key': 'sethelp', 'tags': '', 'text': '\n Edit the help database.\n\n Usage:\n help[/switches] <topic>[[;alias;alias][,category[,locks]] [= <text>]\n\n Switches:\n edit - open a line editor to edit the topic\'s help text.\n replace - overwrite existing help topic.\n append - add text to the end of existing topic with a newline between.\n extend - as append, but don\'t add a newline.\n delete - remove help topic.\n\n Examples:\n sethelp throw = This throws something at ...\n sethelp/append pickpocketing,Thievery = This steals ...\n sethelp/replace pickpocketing, ,attr(is_thief) = This steals ...\n sethelp/edit thievery\n\n This command manipulates the help database. A help entry can be created,\n appended/merged to and deleted. If you don\'t assign a category, the\n "General" category will be used. If no lockstring is specified, default\n is to let everyone read the help file.\n\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.commands.default.muxcommand.html b/docs/0.9.5/api/evennia.commands.default.muxcommand.html index cc6ddfdcfb..c102c54352 100644 --- a/docs/0.9.5/api/evennia.commands.default.muxcommand.html +++ b/docs/0.9.5/api/evennia.commands.default.muxcommand.html @@ -183,6 +183,11 @@ to all the variables defined therein.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'command', 'tags': '', 'text': "\n This sets up the basis for a MUX command. The idea\n is that most other Mux-related commands should just\n inherit from this and don't have to implement much\n parsing of their own unless they do something particularly\n advanced.\n\n Note that the class's __doc__ string (this text) is\n used by Evennia to create the automatic help entry for\n the command, so make sure to document consistently here.\n "}
    +
    +
    @@ -223,6 +228,11 @@ character is actually attached to this Account and Session.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'command', 'tags': '', 'text': '\n This is an on-Account version of the MuxCommand. Since these commands sit\n on Accounts rather than on Characters/Objects, we need to check\n this in the parser.\n\n Account commands are available also when puppeting a Character, it\'s\n just that they are applied with a lower priority and are always\n available, also when disconnected from a character (i.e. "ooc").\n\n This class makes sure that caller is always an Account object, while\n creating a new property "character" that is set only if a\n character is actually attached to this Account and Session.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.commands.default.syscommands.html b/docs/0.9.5/api/evennia.commands.default.syscommands.html index 48a6fbba4b..249ccd7db3 100644 --- a/docs/0.9.5/api/evennia.commands.default.syscommands.html +++ b/docs/0.9.5/api/evennia.commands.default.syscommands.html @@ -88,6 +88,11 @@ the line is just added to the editor buffer).

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': '__noinput_command', 'tags': '', 'text': '\n This is called when there is no input given\n '}
    +
    +
    @@ -126,6 +131,11 @@ the line is just added to the editor buffer).

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': '__nomatch_command', 'tags': '', 'text': '\n No command was found matching the given input.\n '}
    +
    +
    @@ -174,6 +184,11 @@ the raw_cmdname is the cmdname unmodified by eventual prefix-st lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': '__multimatch_command', 'tags': '', 'text': "\n Multiple command matches.\n\n The cmdhandler adds a special attribute 'matches' to this\n system command.\n\n matches = [(cmdname, args, cmdobj, cmdlen, mratio, raw_cmdname) , (cmdname, ...), ...]\n\n Here, `cmdname` is the command's name and `args` the rest of the incoming string,\n without said command name. `cmdobj` is the Command instance, the cmdlen is\n the same as len(cmdname) and mratio is a measure of how big a part of the\n full input string the cmdname takes up - an exact match would be 1.0. Finally,\n the `raw_cmdname` is the cmdname unmodified by eventual prefix-stripping.\n\n "}
    +
    +
    @@ -288,6 +303,11 @@ the already formatted input.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': '__send_to_channel_command', 'tags': '', 'text': '\n This is a special command that the cmdhandler calls\n when it detects that the command given matches\n an existing Channel object key (or alias).\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.commands.default.system.html b/docs/0.9.5/api/evennia.commands.default.system.html index f74f2eb9c5..21cd324e22 100644 --- a/docs/0.9.5/api/evennia.commands.default.system.html +++ b/docs/0.9.5/api/evennia.commands.default.system.html @@ -82,6 +82,11 @@ reset to purge) and at_reload() hooks will be called.

    lock_storage = 'cmd:perm(reload) or perm(Developer)'
    +
    +
    +search_index_entry = {'aliases': 'restart', 'category': 'system', 'key': 'reload', 'tags': '', 'text': '\n reload the server\n\n Usage:\n reload [reason]\n\n This restarts the server. The Portal is not\n affected. Non-persistent scripts will survive a reload (use\n reset to purge) and at_reload() hooks will be called.\n '}
    +
    +
    @@ -134,6 +139,11 @@ cmdsets etc will be wiped.

    lock_storage = 'cmd:perm(reload) or perm(Developer)'
    +
    +
    +search_index_entry = {'aliases': 'reboot', 'category': 'system', 'key': 'reset', 'tags': '', 'text': '\n reset and reboot the server\n\n Usage:\n reset\n\n Notes:\n For normal updating you are recommended to use reload rather\n than this command. Use shutdown for a complete stop of\n everything.\n\n This emulates a cold reboot of the Server component of Evennia.\n The difference to shutdown is that the Server will auto-reboot\n and that it does not affect the Portal, so no users will be\n disconnected. Contrary to reload however, all shutdown hooks will\n be called and any non-database saved scripts, ndb-attributes,\n cmdsets etc will be wiped.\n\n '}
    +
    +
    @@ -177,6 +187,11 @@ cmdsets etc will be wiped.

    lock_storage = 'cmd:perm(shutdown) or perm(Developer)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'system', 'key': 'shutdown', 'tags': '', 'text': '\n stop the server completely\n\n Usage:\n shutdown [announcement]\n\n Gracefully shut down both Server and Portal.\n '}
    +
    +
    @@ -264,6 +279,11 @@ should only be accessible by trusted server admins/superusers.|n

    lock_storage = 'cmd:perm(py) or perm(Developer)'
    +
    +
    +search_index_entry = {'aliases': '!', 'category': 'system', 'key': 'py', 'tags': '', 'text': "\n execute a snippet of python code\n\n Usage:\n py [cmd]\n py/edit\n py/time <cmd>\n py/clientraw <cmd>\n py/noecho\n\n Switches:\n time - output an approximate execution time for <cmd>\n edit - open a code editor for multi-line code experimentation\n clientraw - turn off all client-specific escaping. Note that this may\n lead to different output depending on prototocol (such as angular brackets\n being parsed as HTML in the webclient but not in telnet clients)\n noecho - in Python console mode, turn off the input echo (e.g. if your client\n does this for you already)\n\n Without argument, open a Python console in-game. This is a full console,\n accepting multi-line Python code for testing and debugging. Type `exit()` to\n return to the game. If Evennia is reloaded, the console will be closed.\n\n Enter a line of instruction after the 'py' command to execute it\n immediately. Separate multiple commands by ';' or open the code editor\n using the /edit switch (all lines added in editor will be executed\n immediately when closing or using the execute command in the editor).\n\n A few variables are made available for convenience in order to offer access\n to the system (you can import more at execution time).\n\n Available variables in py environment:\n self, me : caller\n here : caller.location\n evennia : the evennia API\n inherits_from(obj, parent) : check object inheritance\n\n You can explore The evennia API from inside the game by calling\n the `__doc__` property on entities:\n py evennia.__doc__\n py evennia.managers.__doc__\n\n |rNote: In the wrong hands this command is a severe security risk. It\n should only be accessible by trusted server admins/superusers.|n\n\n "}
    +
    +
    @@ -327,6 +347,11 @@ required since whole classes of scripts often have the same name.

    lock_storage = 'cmd:perm(listscripts) or perm(Admin)'
    +
    +
    +search_index_entry = {'aliases': 'listscripts globalscript', 'category': 'system', 'key': 'scripts', 'tags': '', 'text': '\n list and manage all running scripts\n\n Usage:\n scripts[/switches] [#dbref, key, script.path or <obj>]\n\n Switches:\n start - start a script (must supply a script path)\n stop - stops an existing script\n kill - kills a script - without running its cleanup hooks\n validate - run a validation on the script(s)\n\n If no switches are given, this command just views all active\n scripts. The argument can be either an object, at which point it\n will be searched for all scripts defined on it, or a script name\n or #dbref. For using the /stop switch, a unique script #dbref is\n required since whole classes of scripts often have the same name.\n\n Use script for managing commands on objects.\n '}
    +
    +
    @@ -348,7 +373,7 @@ given, <nr> defaults to 10.

    -aliases = ['stats', 'listobjs', 'db', 'listobjects']
    +aliases = ['listobjs', 'listobjects', 'stats', 'db']
    @@ -372,6 +397,11 @@ given, <nr> defaults to 10.

    lock_storage = 'cmd:perm(listobjects) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'listobjs listobjects stats db', 'category': 'system', 'key': 'objects', 'tags': '', 'text': '\n statistics on objects in the database\n\n Usage:\n objects [<nr>]\n\n Gives statictics on objects in database as well as\n a list of <nr> latest objects in database. If not\n given, <nr> defaults to 10.\n '}
    +
    +
    @@ -429,6 +459,11 @@ in the list.

    lock_storage = 'cmd:perm(service) or perm(Developer)'
    +
    +
    +search_index_entry = {'aliases': 'services', 'category': 'system', 'key': 'service', 'tags': '', 'text': '\n manage system services\n\n Usage:\n service[/switch] <service>\n\n Switches:\n list - shows all available services (default)\n start - activates or reactivate a service\n stop - stops/inactivate a service (can often be restarted)\n delete - tries to permanently remove a service\n\n Service management system. Allows for the listing,\n starting, and stopping of services. If no switches\n are given, services will be listed. Note that to operate on the\n service you have to supply the full (green or red) name as given\n in the list.\n '}
    +
    +
    @@ -472,6 +507,11 @@ in the list.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'version', 'category': 'system', 'key': 'about', 'tags': '', 'text': '\n show Evennia info\n\n Usage:\n about\n\n Display info about the game engine.\n '}
    +
    +
    @@ -516,6 +556,11 @@ and the current time stamp.

    lock_storage = 'cmd:perm(time) or perm(Player)'
    +
    +
    +search_index_entry = {'aliases': 'uptime', 'category': 'system', 'key': 'time', 'tags': '', 'text': '\n show server time statistics\n\n Usage:\n time\n\n List Server time statistics such as uptime\n and the current time stamp.\n '}
    +
    +
    @@ -584,6 +629,11 @@ the released memory will instead be re-used by the program.

    lock_storage = 'cmd:perm(list) or perm(Developer)'
    +
    +
    +search_index_entry = {'aliases': 'serverprocess serverload', 'category': 'system', 'key': 'server', 'tags': '', 'text': "\n show server load and memory statistics\n\n Usage:\n server[/mem]\n\n Switches:\n mem - return only a string of the current memory usage\n flushmem - flush the idmapper cache\n\n This command shows server load statistics and dynamic memory\n usage. It also allows to flush the cache of accessed database\n objects.\n\n Some Important statistics in the table:\n\n |wServer load|n is an average of processor usage. It's usually\n between 0 (no usage) and 1 (100% usage), but may also be\n temporarily higher if your computer has multiple CPU cores.\n\n The |wResident/Virtual memory|n displays the total memory used by\n the server process.\n\n Evennia |wcaches|n all retrieved database entities when they are\n loaded by use of the idmapper functionality. This allows Evennia\n to maintain the same instances of an entity and allowing\n non-persistent storage schemes. The total amount of cached objects\n are displayed plus a breakdown of database object types.\n\n The |wflushmem|n switch allows to flush the object cache. Please\n note that due to how Python's memory management works, releasing\n caches may not show you a lower Residual/Virtual memory footprint,\n the released memory will instead be re-used by the program.\n\n "}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.commands.default.tests.html b/docs/0.9.5/api/evennia.commands.default.tests.html index 0edffe8f85..e73961150b 100644 --- a/docs/0.9.5/api/evennia.commands.default.tests.html +++ b/docs/0.9.5/api/evennia.commands.default.tests.html @@ -138,6 +138,18 @@ output sent to caller.msg in the game

    class evennia.commands.default.tests.TestHelp(methodName='runTest')[source]

    Bases: evennia.commands.default.tests.CommandTest

    +
    +
    +setUp()[source]
    +

    Sets up testing environment

    +
    + +
    +
    +tearDown()[source]
    +

    Hook method for deconstructing the test fixture after testing it.

    +
    +
    test_help()[source]
    @@ -599,6 +611,11 @@ set in self.parse())

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'interrupt', 'tags': '', 'text': '\n Base command\n\n Usage:\n command [args]\n\n This is the base command class. Inherit from this\n to create new commands.\n\n The cmdhandler makes the following variables available to the\n command methods (so you can always assume them to be there):\n self.caller - the game object calling the command\n self.cmdstring - the command name used to trigger this command (allows\n you to know which alias was used, for example)\n cmd.args - everything supplied to the command following the cmdstring\n (this is usually what is parsed in self.parse())\n cmd.cmdset - the cmdset from which this command was matched (useful only\n seldomly, notably for help-type commands, to create dynamic\n help entries and lists)\n cmd.obj - the object on which this command is defined. If a default command,\n this is usually the same as caller.\n cmd.rawstring - the full raw string input, including any args and no parsing.\n\n The following class properties can/should be defined on your child class:\n\n key - identifier for command (e.g. "look")\n aliases - (optional) list of aliases (e.g. ["l", "loo"])\n locks - lock string (default is "cmd:all()")\n help_category - how to organize this help entry in help system\n (default is "General")\n auto_help - defaults to True. Allows for turning off auto-help generation\n arg_regex - (optional) raw string regex defining how the argument part of\n the command should look in order to match for this command\n (e.g. must it be a space between cmdname and arg?)\n auto_help_display_key - (optional) if given, this replaces the string shown\n in the auto-help listing. This is particularly useful for system-commands\n whose actual key is not really meaningful.\n\n (Note that if auto_help is on, this initial string is also used by the\n system to create the help entry for the command, so it\'s a good idea to\n format it similar to this one). This behavior can be changed by\n overriding the method \'get_help\' of a command: by default, this\n method returns cmd.__doc__ (that is, this very docstring, or\n the docstring of your command). You can, however, extend or\n replace this without disabling auto_help.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.commands.default.unloggedin.html b/docs/0.9.5/api/evennia.commands.default.unloggedin.html index 3aa4819c13..4225389b61 100644 --- a/docs/0.9.5/api/evennia.commands.default.unloggedin.html +++ b/docs/0.9.5/api/evennia.commands.default.unloggedin.html @@ -58,7 +58,7 @@ connect “account name” “pass word”

    -aliases = ['con', 'conn', 'co']
    +aliases = ['conn', 'con', 'co']
    @@ -91,6 +91,11 @@ there is no object yet before the account has logged in)

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'conn con co', 'category': 'general', 'key': 'connect', 'tags': '', 'text': '\n connect to the game\n\n Usage (at login screen):\n connect accountname password\n connect "account name" "pass word"\n\n Use the create command to first create an account before logging in.\n\n If you have spaces in your name, enclose it in double quotes.\n '}
    +
    +
    @@ -112,7 +117,7 @@ create “account name” “pass word”

    -aliases = ['cre', 'cr']
    +aliases = ['cr', 'cre']
    @@ -141,6 +146,11 @@ create “account name” “pass word”

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'cr cre', 'category': 'general', 'key': 'create', 'tags': '', 'text': '\n create a new account account\n\n Usage (at login screen):\n create <accountname> <password>\n create "account name" "pass word"\n\n This creates a new account account.\n\n If you have spaces in your name, enclose it in double quotes.\n '}
    +
    +
    @@ -186,6 +196,11 @@ version is a bit more complicated.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'q qu', 'category': 'general', 'key': 'quit', 'tags': '', 'text': '\n quit when in unlogged-in state\n\n Usage:\n quit\n\n We maintain a different version of the quit command\n here for unconnected accounts for the sake of simplicity. The logged in\n version is a bit more complicated.\n '}
    +
    +
    @@ -207,7 +222,7 @@ All it does is display the connect screen.

    -aliases = ['look', 'l']
    +aliases = ['l', 'look']
    @@ -231,6 +246,11 @@ All it does is display the connect screen.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'l look', 'category': 'general', 'key': '__unloggedin_look_command', 'tags': '', 'text': '\n look when in unlogged-in state\n\n Usage:\n look\n\n This is an unconnected version of the look command for simplicity.\n\n This is called by the server and kicks everything in gear.\n All it does is display the connect screen.\n '}
    +
    +
    @@ -251,7 +271,7 @@ for simplicity. It shows a pane of info.

    -aliases = ['h', '?']
    +aliases = ['?', 'h']
    @@ -275,6 +295,11 @@ for simplicity. It shows a pane of info.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '? h', 'category': 'general', 'key': 'help', 'tags': '', 'text': '\n get help when in unconnected-in state\n\n Usage:\n help\n\n This is an unconnected version of the help command,\n for simplicity. It shows a pane of info.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.comms.channelhandler.html b/docs/0.9.5/api/evennia.comms.channelhandler.html index 1699fe5242..49ebdec220 100644 --- a/docs/0.9.5/api/evennia.comms.channelhandler.html +++ b/docs/0.9.5/api/evennia.comms.channelhandler.html @@ -140,6 +140,11 @@ the already formatted input.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'channel names', 'key': 'general', 'tags': '', 'text': '\n {channelkey} channel\n\n {channeldesc}\n\n Usage:\n {lower_channelkey} <message>\n {lower_channelkey}/history [start]\n {lower_channelkey} off - mutes the channel\n {lower_channelkey} on - unmutes the channel\n\n Switch:\n history: View 20 previous messages, either from the end or\n from <start> number of messages from the end.\n\n Example:\n {lower_channelkey} Hello World!\n {lower_channelkey}/history\n {lower_channelkey}/history 30\n\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.barter.html b/docs/0.9.5/api/evennia.contrib.barter.html index fdee182a79..8f69424a92 100644 --- a/docs/0.9.5/api/evennia.contrib.barter.html +++ b/docs/0.9.5/api/evennia.contrib.barter.html @@ -402,6 +402,11 @@ available to the command

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'command', 'tags': '', 'text': '\n Base command for Trade commands to inherit from. Implements the\n custom parsing.\n '}
    +
    +
    @@ -445,6 +450,11 @@ available to the command

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'trade', 'key': 'trade help', 'tags': '', 'text': '\n help command for the trade system.\n\n Usage:\n trade help\n\n Displays help for the trade commands.\n '}
    +
    +
    @@ -489,6 +499,11 @@ standing offer.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'trading', 'key': 'offer', 'tags': '', 'text': '\n offer one or more items in trade.\n\n Usage:\n offer <object> [, object2, ...][:emote]\n\n Offer objects in trade. This will replace the currently\n standing offer.\n '}
    +
    +
    @@ -536,6 +551,11 @@ the current offer using the ‘offers’ command.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'agree', 'category': 'trading', 'key': 'accept', 'tags': '', 'text': "\n accept the standing offer\n\n Usage:\n accept [:emote]\n agreee [:emote]\n\n This will accept the current offer. The other party must also accept\n for the deal to go through. You can use the 'decline' command to change\n your mind as long as the other party has not yet accepted. You can inspect\n the current offer using the 'offers' command.\n "}
    +
    +
    @@ -582,6 +602,11 @@ decline the old offer.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'trading', 'key': 'decline', 'tags': '', 'text': "\n decline the standing offer\n\n Usage:\n decline [:emote]\n\n This will decline a previously 'accept'ed offer (so this allows you to\n change your mind). You can only use this as long as the other party\n has not yet accepted the deal. Also, changing the offer will automatically\n decline the old offer.\n "}
    +
    +
    @@ -626,6 +651,11 @@ determine if it’s worth your while.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'eval', 'category': 'trading', 'key': 'evaluate', 'tags': '', 'text': "\n evaluate objects on offer\n\n Usage:\n evaluate <offered object>\n\n This allows you to examine any object currently on offer, to\n determine if it's worth your while.\n "}
    +
    +
    @@ -650,7 +680,7 @@ try to influence the other part in the deal.

    -aliases = ['offers', 'deal']
    +aliases = ['deal', 'offers']
    @@ -674,6 +704,11 @@ try to influence the other part in the deal.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'deal offers', 'category': 'trading', 'key': 'status', 'tags': '', 'text': "\n show a list of the current deal\n\n Usage:\n status\n deal\n offers\n\n Shows the currently suggested offers on each sides of the deal. To\n accept the current deal, use the 'accept' command. Use 'offer' to\n change your deal. You might also want to use 'say', 'emote' etc to\n try to influence the other part in the deal.\n "}
    +
    +
    @@ -718,6 +753,11 @@ finish trade [:say]

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'finish trade', 'category': 'trading', 'key': 'end trade', 'tags': '', 'text': '\n end the trade prematurely\n\n Usage:\n end trade [:say]\n finish trade [:say]\n\n This ends the trade prematurely. No trade will take place.\n\n '}
    +
    +
    @@ -792,6 +832,11 @@ info to your choice.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'barter', 'category': 'general', 'key': 'trade', 'tags': '', 'text': '\n Initiate trade with another party\n\n Usage:\n trade <other party> [:say]\n trade <other party> accept [:say]\n trade <other party> decline [:say]\n\n Initiate trade with another party. The other party needs to repeat\n this command with trade accept/decline within a minute in order to\n properly initiate the trade action. You can use the decline option\n yourself if you want to retract an already suggested trade. The\n optional say part works like the say command and allows you to add\n info to your choice.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.building_menu.html b/docs/0.9.5/api/evennia.contrib.building_menu.html index 2cb752aab6..3dc379308e 100644 --- a/docs/0.9.5/api/evennia.contrib.building_menu.html +++ b/docs/0.9.5/api/evennia.contrib.building_menu.html @@ -250,6 +250,11 @@ overloading evential same-named class properties.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': '__noinput_command', 'tags': '', 'text': 'No input has been found.'}
    +
    +
    @@ -296,6 +301,11 @@ overloading evential same-named class properties.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': '__nomatch_command', 'tags': '', 'text': 'No input has been found.'}
    +
    +
    @@ -860,6 +870,11 @@ set in self.parse())

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': '@edit', 'tags': '', 'text': "\n Generic building command.\n\n Syntax:\n @edit [object]\n\n Open a building menu to edit the specified object. This menu allows to\n change the object's key and description.\n\n Examples:\n @edit here\n @edit self\n @edit #142\n\n "}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.chargen.html b/docs/0.9.5/api/evennia.contrib.chargen.html index cbb8fa2301..8505639167 100644 --- a/docs/0.9.5/api/evennia.contrib.chargen.html +++ b/docs/0.9.5/api/evennia.contrib.chargen.html @@ -106,6 +106,11 @@ that is checked by the @ic command directly.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'l ls', 'category': 'general', 'key': 'look', 'tags': '', 'text': '\n ooc look\n\n Usage:\n look\n look <character>\n\n This is an OOC version of the look command. Since an Account doesn\'t\n have an in-game existence, there is no concept of location or\n "self".\n\n If any characters are available for you to control, you may look\n at them with this command.\n '}
    +
    +
    @@ -151,6 +156,11 @@ attribute on ourselves to remember it.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'create', 'tags': '', 'text': '\n creates a character\n\n Usage:\n create <character name>\n\n This will create a new character, assuming\n the given character name does not already exist.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.clothing.html b/docs/0.9.5/api/evennia.contrib.clothing.html index ab96510c15..26bcaa81fa 100644 --- a/docs/0.9.5/api/evennia.contrib.clothing.html +++ b/docs/0.9.5/api/evennia.contrib.clothing.html @@ -358,6 +358,11 @@ provide will be displayed after the clothing’s name.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'clothing', 'key': 'wear', 'tags': '', 'text': "\n Puts on an item of clothing you are holding.\n\n Usage:\n wear <obj> [wear style]\n\n Examples:\n wear shirt\n wear scarf wrapped loosely about the shoulders\n\n All the clothes you are wearing are appended to your description.\n If you provide a 'wear style' after the command, the message you\n provide will be displayed after the clothing's name.\n "}
    +
    +
    @@ -398,6 +403,11 @@ off the covering item first.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'clothing', 'key': 'remove', 'tags': '', 'text': "\n Takes off an item of clothing.\n\n Usage:\n remove <obj>\n\n Removes an item of clothing you are wearing. You can't remove\n clothes that are covered up by something else - you must take\n off the covering item first.\n "}
    +
    +
    @@ -438,6 +448,11 @@ You can’t remove an item of clothing if it’s covered.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'clothing', 'key': 'cover', 'tags': '', 'text': "\n Covers a worn item of clothing with another you're holding or wearing.\n\n Usage:\n cover <obj> [with] <obj>\n\n When you cover a clothing item, it is hidden and no longer appears in\n your description until it's uncovered or the item covering it is removed.\n You can't remove an item of clothing if it's covered.\n "}
    +
    +
    @@ -479,6 +494,11 @@ it is also covered by something else.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'clothing', 'key': 'uncover', 'tags': '', 'text': "\n Reveals a worn item of clothing that's currently covered up.\n\n Usage:\n uncover <obj>\n\n When you uncover an item of clothing, you allow it to appear in your\n description without having to take off the garment that's currently\n covering it. You can't uncover an item of clothing if the item covering\n it is also covered by something else.\n "}
    +
    +
    @@ -528,6 +548,11 @@ location you are currently in.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'drop', 'tags': '', 'text': '\n drop something\n\n Usage:\n drop <obj>\n\n Lets you drop an object from your inventory into the\n location you are currently in.\n '}
    +
    +
    @@ -577,6 +602,11 @@ placing it in their inventory.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'give', 'tags': '', 'text': '\n give away something to someone\n\n Usage:\n give <inventory obj> = <target>\n\n Gives an items from your inventory to another character,\n placing it in their inventory.\n '}
    +
    +
    @@ -597,7 +627,7 @@ inv

    -aliases = ['inv', 'i']
    +aliases = ['i', 'inv']
    @@ -626,6 +656,11 @@ inv

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'i inv', 'category': 'general', 'key': 'inventory', 'tags': '', 'text': '\n view inventory\n\n Usage:\n inventory\n inv\n\n Shows your inventory.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.dice.html b/docs/0.9.5/api/evennia.contrib.dice.html index 4e9c5e1529..dc5979facd 100644 --- a/docs/0.9.5/api/evennia.contrib.dice.html +++ b/docs/0.9.5/api/evennia.contrib.dice.html @@ -172,6 +172,11 @@ everyone but the person rolling.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'roll @dice', 'category': 'general', 'key': 'dice', 'tags': '', 'text': "\n roll dice\n\n Usage:\n dice[/switch] <nr>d<sides> [modifier] [success condition]\n\n Switch:\n hidden - tell the room the roll is being done, but don't show the result\n secret - don't inform the room about neither roll nor result\n\n Examples:\n dice 3d6 + 4\n dice 1d100 - 2 < 50\n\n This will roll the given number of dice with given sides and modifiers.\n So e.g. 2d6 + 3 means to 'roll a 6-sided die 2 times and add the result,\n then add 3 to the total'.\n Accepted modifiers are +, -, * and /.\n A success condition is given as normal Python conditionals\n (<,>,<=,>=,==,!=). So e.g. 2d6 + 3 > 10 means that the roll will succeed\n only if the final result is above 8. If a success condition is given, the\n outcome (pass/fail) will be echoed along with how much it succeeded/failed\n with. The hidden/secret switches will hide all or parts of the roll from\n everyone but the person rolling.\n "}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.email_login.html b/docs/0.9.5/api/evennia.contrib.email_login.html index 37d6689fa5..b58edfc7a8 100644 --- a/docs/0.9.5/api/evennia.contrib.email_login.html +++ b/docs/0.9.5/api/evennia.contrib.email_login.html @@ -73,7 +73,7 @@ the module given by settings.CONNECTION_SCREEN_MODULE.

    -aliases = ['con', 'conn', 'co']
    +aliases = ['conn', 'con', 'co']
    @@ -101,6 +101,11 @@ there is no object yet before the account has logged in)

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'conn con co', 'category': 'general', 'key': 'connect', 'tags': '', 'text': '\n Connect to the game.\n\n Usage (at login screen):\n connect <email> <password>\n\n Use the create command to first create an account before logging in.\n '}
    +
    +
    @@ -120,7 +125,7 @@ there is no object yet before the account has logged in)

    -aliases = ['cre', 'cr']
    +aliases = ['cr', 'cre']
    @@ -154,6 +159,11 @@ name enclosed in quotes:

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'cr cre', 'category': 'general', 'key': 'create', 'tags': '', 'text': '\n Create a new account.\n\n Usage (at login screen):\n create "accountname" <email> <password>\n\n This creates a new account account.\n\n '}
    +
    +
    @@ -194,6 +204,11 @@ version is a bit more complicated.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'q qu', 'category': 'general', 'key': 'quit', 'tags': '', 'text': '\n We maintain a different version of the `quit` command\n here for unconnected accounts for the sake of simplicity. The logged in\n version is a bit more complicated.\n '}
    +
    +
    @@ -210,7 +225,7 @@ All it does is display the connect screen.

    -aliases = ['look', 'l']
    +aliases = ['l', 'look']
    @@ -234,6 +249,11 @@ All it does is display the connect screen.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'l look', 'category': 'general', 'key': '__unloggedin_look_command', 'tags': '', 'text': '\n This is an unconnected version of the `look` command for simplicity.\n\n This is called by the server and kicks everything in gear.\n All it does is display the connect screen.\n '}
    +
    +
    @@ -249,7 +269,7 @@ for simplicity. It shows a pane of info.

    -aliases = ['h', '?']
    +aliases = ['?', 'h']
    @@ -273,6 +293,11 @@ for simplicity. It shows a pane of info.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '? h', 'category': 'general', 'key': 'help', 'tags': '', 'text': '\n This is an unconnected version of the help command,\n for simplicity. It shows a pane of info.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.extended_room.html b/docs/0.9.5/api/evennia.contrib.extended_room.html index 9ef0323c46..92eb9cdec2 100644 --- a/docs/0.9.5/api/evennia.contrib.extended_room.html +++ b/docs/0.9.5/api/evennia.contrib.extended_room.html @@ -293,6 +293,11 @@ look *<account&g lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'l ls', 'category': 'general', 'key': 'look', 'tags': '', 'text': '\n look\n\n Usage:\n look\n look <obj>\n look <room detail>\n look *<account>\n\n Observes your location, details at your location or objects in your vicinity.\n '}
    +
    +
    @@ -356,6 +361,11 @@ version of the desc command.

    lock_storage = 'cmd:perm(desc) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': 'describe', 'category': 'building', 'key': 'desc', 'tags': '', 'text': '\n `desc` - describe an object or room.\n\n Usage:\n desc[/switch] [<obj> =] <description>\n\n Switches for `desc`:\n spring - set description for <season> in current room.\n summer\n autumn\n winter\n\n Sets the "desc" attribute on an object. If an object is not given,\n describe the current room.\n\n You can also embed special time markers in your room description, like this:\n\n ```\n <night>In the darkness, the forest looks foreboding.</night>.\n ```\n\n Text marked this way will only display when the server is truly at the given\n timeslot. The available times are night, morning, afternoon and evening.\n\n Note that seasons and time-of-day slots only work on rooms in this\n version of the `desc` command.\n\n '}
    +
    +
    @@ -414,6 +424,11 @@ to all the variables defined therein.

    lock_storage = 'cmd:perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'building', 'key': '@detail', 'tags': '', 'text': '\n sets a detail on a room\n\n Usage:\n @detail[/del] <key> [= <description>]\n @detail <key>;<alias>;... = description\n\n Example:\n @detail\n @detail walls = The walls are covered in ...\n @detail castle;ruin;tower = The distant ruin ...\n @detail/del wall\n @detail/del castle;ruin;tower\n\n This command allows to show the current room details if you enter it\n without any argument. Otherwise, sets or deletes a detail on the current\n room, if this room supports details like an extended room. To add new\n detail, just use the @detail command, specifying the key, an equal sign\n and the description. You can assign the same description to several\n details using the alias syntax (replace key by alias1;alias2;alias3;...).\n To remove one or several details, use the @detail/del switch.\n\n '}
    +
    +
    @@ -457,6 +472,11 @@ to all the variables defined therein.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'time', 'tags': '', 'text': '\n Check the game time\n\n Usage:\n time\n\n Shows the current in-game time and season.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.fieldfill.html b/docs/0.9.5/api/evennia.contrib.fieldfill.html index 93dc162a2f..45c2097fc7 100644 --- a/docs/0.9.5/api/evennia.contrib.fieldfill.html +++ b/docs/0.9.5/api/evennia.contrib.fieldfill.html @@ -363,6 +363,11 @@ send

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'testmenu', 'tags': '', 'text': "\n This test command will initialize a menu that presents you with a form.\n You can fill out the fields of this form in any order, and then type in\n 'send' to send a message to another online player, which will reach them\n after a delay you specify.\n\n Usage:\n <field> = <new value>\n clear <field>\n help\n look\n quit\n send\n "}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.gendersub.html b/docs/0.9.5/api/evennia.contrib.gendersub.html index 85d4d71b19..6551b72603 100644 --- a/docs/0.9.5/api/evennia.contrib.gendersub.html +++ b/docs/0.9.5/api/evennia.contrib.gendersub.html @@ -109,6 +109,11 @@ default cmdset before it becomes available.

    lock_storage = 'cmd:all();call:all()'
    +
    +
    +search_index_entry = {'aliases': '@sex', 'category': 'general', 'key': '@gender', 'tags': '', 'text': '\n Sets gender on yourself\n\n Usage:\n @gender male||female||neutral||ambiguous\n\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.ingame_python.commands.html b/docs/0.9.5/api/evennia.contrib.ingame_python.commands.html index 6eb81b2dcc..280ca41aa2 100644 --- a/docs/0.9.5/api/evennia.contrib.ingame_python.commands.html +++ b/docs/0.9.5/api/evennia.contrib.ingame_python.commands.html @@ -51,7 +51,7 @@
    -aliases = ['@callbacks', '@calls', '@callback']
    +aliases = ['@calls', '@callback', '@callbacks']
    @@ -130,6 +130,11 @@ on user permission.

    lock_storage = 'cmd:perm(developer)'
    +
    +
    +search_index_entry = {'aliases': '@calls @callback @callbacks', 'category': 'building', 'key': '@call', 'tags': '', 'text': '\n Command to edit callbacks.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.mail.html b/docs/0.9.5/api/evennia.contrib.mail.html index 19600f6c5f..f51b7716ae 100644 --- a/docs/0.9.5/api/evennia.contrib.mail.html +++ b/docs/0.9.5/api/evennia.contrib.mail.html @@ -217,6 +217,11 @@ the newly created mails.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': 'mail', 'category': 'general', 'key': '@mail', 'tags': '', 'text': '\n Communicate with others by sending mail.\n\n Usage:\n @mail - Displays all the mail an account has in their mailbox\n @mail <#> - Displays a specific message\n @mail <accounts>=<subject>/<message>\n - Sends a message to the comma separated list of accounts.\n @mail/delete <#> - Deletes a specific message\n @mail/forward <account list>=<#>[/<Message>]\n - Forwards an existing message to the specified list of accounts,\n original message is delivered with optional Message prepended.\n @mail/reply <#>=<message>\n - Replies to a message #. Prepends message to the original\n message text.\n Switches:\n delete - deletes a message\n forward - forward a received message to another object with an optional message attached.\n reply - Replies to a received message, appending the original message to the bottom.\n Examples:\n @mail 2\n @mail Griatch=New mail/Hey man, I am sending you a message!\n @mail/delete 6\n @mail/forward feend78 Griatch=4/You guys should read this.\n @mail/reply 9=Thanks for the info!\n\n '}
    +
    +
    @@ -285,6 +290,11 @@ reply - Replies to a received message, appending the original message to the b lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': 'mail', 'category': 'general', 'key': '@mail', 'tags': '', 'text': '\n Communicate with others by sending mail.\n\n Usage:\n @mail - Displays all the mail an account has in their mailbox\n @mail <#> - Displays a specific message\n @mail <accounts>=<subject>/<message>\n - Sends a message to the comma separated list of accounts.\n @mail/delete <#> - Deletes a specific message\n @mail/forward <account list>=<#>[/<Message>]\n - Forwards an existing message to the specified list of accounts,\n original message is delivered with optional Message prepended.\n @mail/reply <#>=<message>\n - Replies to a message #. Prepends message to the original\n message text.\n Switches:\n delete - deletes a message\n forward - forward a received message to another object with an optional message attached.\n reply - Replies to a received message, appending the original message to the bottom.\n Examples:\n @mail 2\n @mail Griatch=New mail/Hey man, I am sending you a message!\n @mail/delete 6\n @mail/forward feend78 Griatch=4/You guys should read this.\n @mail/reply 9=Thanks for the info!\n\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.mapbuilder.html b/docs/0.9.5/api/evennia.contrib.mapbuilder.html index dcff3a2c7a..dd99ec66ee 100644 --- a/docs/0.9.5/api/evennia.contrib.mapbuilder.html +++ b/docs/0.9.5/api/evennia.contrib.mapbuilder.html @@ -232,6 +232,11 @@ how many times the map is iterated over.

    lock_storage = 'cmd:superuser()'
    +
    +
    +search_index_entry = {'aliases': '@buildmap', 'category': 'building', 'key': '@mapbuilder', 'tags': '', 'text': '\n Build a map from a 2D ASCII map.\n\n Usage:\n @mapbuilder[/switch] <path.to.file.MAPNAME> <path.to.file.MAP_LEGEND>\n\n Switches:\n one - execute build instructions once without automatic exit creation\n two - execute build instructions twice without automatic exit creation\n\n Example:\n @mapbuilder world.gamemap.MAP world.maplegend.MAP_LEGEND\n @mapbuilder evennia.contrib.mapbuilder.EXAMPLE1_MAP EXAMPLE1_LEGEND\n @mapbuilder/two evennia.contrib.mapbuilder.EXAMPLE2_MAP EXAMPLE2_LEGEND\n (Legend path defaults to map path)\n\n This is a command which takes two inputs:\n A string of ASCII characters representing a map and a dictionary of\n functions containing build instructions. The characters of the map are\n iterated over and compared to a list of trigger characters. When a match\n is found the corresponding function is executed generating the rooms,\n exits and objects as defined by the users build instructions. If a\n character is not a match to a provided trigger character (including spaces)\n it is simply skipped and the process continues. By default exits are\n automatically generated but is turned off by switches which also determines\n how many times the map is iterated over.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.menu_login.html b/docs/0.9.5/api/evennia.contrib.menu_login.html index 7c70f82e85..dedcdda565 100644 --- a/docs/0.9.5/api/evennia.contrib.menu_login.html +++ b/docs/0.9.5/api/evennia.contrib.menu_login.html @@ -141,6 +141,11 @@ to the menu’s own look command.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': '__unloggedin_look_command', 'tags': '', 'text': "\n An unloggedin version of the look command. This is called by the server\n when the account first connects. It sets up the menu before handing off\n to the menu's own look command.\n\n "}
    +
    + diff --git a/docs/0.9.5/api/evennia.contrib.multidescer.html b/docs/0.9.5/api/evennia.contrib.multidescer.html index 34dd03b012..569b9af8ee 100644 --- a/docs/0.9.5/api/evennia.contrib.multidescer.html +++ b/docs/0.9.5/api/evennia.contrib.multidescer.html @@ -115,6 +115,11 @@ description in use and db.multidesc to store all descriptions.< lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'desc', 'category': 'general', 'key': '+desc', 'tags': '', 'text': '\n Manage multiple descriptions\n\n Usage:\n +desc [key] - show current desc desc with <key>\n +desc <key> = <text> - add/replace desc with <key>\n +desc/list - list descriptions (abbreviated)\n +desc/list/full - list descriptions (full texts)\n +desc/edit <key> - add/edit desc <key> in line editor\n +desc/del <key> - delete desc <key>\n +desc/swap <key1>-<key2> - swap positions of <key1> and <key2> in list\n +desc/set <key> [+key+...] - set desc as default or combine multiple descs\n\n Notes:\n When combining multiple descs with +desc/set <key> + <key2> + ...,\n any keys not matching an actual description will be inserted\n as plain text. Use e.g. ansi line break ||/ to add a new\n paragraph and + + or ansi space ||_ to add extra whitespace.\n\n '}
    +
    + diff --git a/docs/0.9.5/api/evennia.contrib.puzzles.html b/docs/0.9.5/api/evennia.contrib.puzzles.html index 26326be846..d963b40c23 100644 --- a/docs/0.9.5/api/evennia.contrib.puzzles.html +++ b/docs/0.9.5/api/evennia.contrib.puzzles.html @@ -205,6 +205,11 @@ to all the variables defined therein.

    lock_storage = 'cmd:perm(puzzle) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '@puzzlerecipe', 'category': 'puzzles', 'key': '@puzzle', 'tags': '', 'text': "\n Creates a puzzle recipe. A puzzle consists of puzzle-parts that\n the player can 'use' together to create a specified result.\n\n Usage:\n @puzzle name,<part1[,part2,...>] = <result1[,result2,...]>\n\n Example:\n create/drop balloon\n create/drop glass of water\n create/drop water balloon\n @puzzle waterballon,balloon,glass of water = water balloon\n @del ballon, glass of water, water balloon\n @armpuzzle #1\n\n Notes:\n Each part and result are objects that must (temporarily) exist and be placed in their\n corresponding location in order to create the puzzle. After the creation of the puzzle,\n these objects are not needed anymore and can be deleted. Components of the puzzle\n will be re-created by use of the `@armpuzzle` command later.\n\n "}
    +
    +
    @@ -268,6 +273,11 @@ to all the variables defined therein.

    lock_storage = 'cmd:perm(puzzleedit) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'puzzles', 'key': '@puzzleedit', 'tags': '', 'text': "\n Edits puzzle properties\n\n Usage:\n @puzzleedit[/delete] <#dbref>\n @puzzleedit <#dbref>/use_success_message = <Custom message>\n @puzzleedit <#dbref>/use_success_location_message = <Custom message from {caller} producing {result_names}>\n @puzzleedit <#dbref>/mask = attr1[,attr2,...]>\n @puzzleedit[/addpart] <#dbref> = <obj[,obj2,...]>\n @puzzleedit[/delpart] <#dbref> = <obj[,obj2,...]>\n @puzzleedit[/addresult] <#dbref> = <obj[,obj2,...]>\n @puzzleedit[/delresult] <#dbref> = <obj[,obj2,...]>\n\n Switches:\n addpart - adds parts to the puzzle\n delpart - removes parts from the puzzle\n addresult - adds results to the puzzle\n delresult - removes results from the puzzle\n delete - deletes the recipe. Existing parts and results aren't modified\n\n mask - attributes to exclude during matching (e.g. location, desc, etc.)\n use_success_location_message containing {result_names} and {caller} will\n automatically be replaced with correct values. Both are optional.\n\n When removing parts/results, it's possible to remove all.\n\n "}
    +
    +
    @@ -315,6 +325,11 @@ to all the variables defined therein.

    lock_storage = 'cmd:perm(armpuzzle) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'puzzles', 'key': '@armpuzzle', 'tags': '', 'text': '\n Arms a puzzle by spawning all its parts.\n\n Usage:\n @armpuzzle <puzzle #dbref>\n\n Notes:\n Create puzzles with `@puzzle`; get list of\n defined puzzles using `@lspuzzlerecipes`.\n\n '}
    +
    +
    @@ -363,6 +378,11 @@ to all the variables defined therein.

    lock_storage = 'cmd:pperm(use) or pperm(Player)'
    +
    +
    +search_index_entry = {'aliases': 'combine', 'category': 'puzzles', 'key': 'use', 'tags': '', 'text': '\n Use an object, or a group of objects at once.\n\n\n Example:\n You look around you and see a pole, a long string, and a needle.\n\n use pole, long string, needle\n\n Genius! You built a fishing pole.\n\n\n Usage:\n use <obj1> [,obj2,...]\n '}
    +
    +
    @@ -407,6 +427,11 @@ to all the variables defined therein.

    lock_storage = 'cmd:perm(lspuzzlerecipes) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'puzzles', 'key': '@lspuzzlerecipes', 'tags': '', 'text': '\n Searches for all puzzle recipes\n\n Usage:\n @lspuzzlerecipes\n '}
    +
    +
    @@ -451,6 +476,11 @@ to all the variables defined therein.

    lock_storage = 'cmd:perm(lsarmedpuzzles) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'puzzles', 'key': '@lsarmedpuzzles', 'tags': '', 'text': '\n Searches for all armed puzzles\n\n Usage:\n @lsarmedpuzzles\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.rpsystem.html b/docs/0.9.5/api/evennia.contrib.rpsystem.html index 6397a55de3..7031c3d5de 100644 --- a/docs/0.9.5/api/evennia.contrib.rpsystem.html +++ b/docs/0.9.5/api/evennia.contrib.rpsystem.html @@ -265,7 +265,10 @@ langname can be None.

    Raises
    -

    rplanguage.LanguageError – If an invalid language was specified.

    +

    Notes

    @@ -550,6 +553,11 @@ mechanism. This is useful for adding masks/hoods etc.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'command', 'tags': '', 'text': 'simple parent'}
    +
    +
    @@ -603,6 +611,11 @@ a different language.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': ':', 'category': 'general', 'key': 'emote', 'tags': '', 'text': '\n Emote an action, allowing dynamic replacement of\n text in the emote.\n\n Usage:\n emote text\n\n Example:\n emote /me looks around.\n emote With a flurry /me attacks /tall man with his sword.\n emote "Hello", /me says.\n\n Describes an event in the world. This allows the use of /ref\n markers to replace with the short descriptions or recognized\n strings of objects in the same room. These will be translated to\n emotes to match each person seeing it. Use "..." for saying\n things and langcode"..." without spaces to say something in\n a different language.\n\n '}
    +
    +
    @@ -646,6 +659,11 @@ a different language.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '" \'', 'category': 'general', 'key': 'say', 'tags': '', 'text': '\n speak as your character\n\n Usage:\n say <message>\n\n Talk to those in your current location.\n '}
    +
    +
    @@ -689,6 +707,11 @@ a different language.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'sdesc', 'tags': '', 'text': '\n Assign yourself a short description (sdesc).\n\n Usage:\n sdesc <short description>\n\n Assigns a short description to yourself.\n\n '}
    +
    +
    @@ -747,6 +770,11 @@ sdesc in the emote, regardless of who is seeing it.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'pose', 'tags': '', 'text': "\n Set a static pose\n\n Usage:\n pose <pose>\n pose default <pose>\n pose reset\n pose obj = <pose>\n pose default obj = <pose>\n pose reset obj =\n\n Examples:\n pose leans against the tree\n pose is talking to the barkeep.\n pose box = is sitting on the floor.\n\n Set a static pose. This is the end of a full sentence that starts\n with your sdesc. If no full stop is given, it will be added\n automatically. The default pose is the pose you get when using\n pose reset. Note that you can use sdescs/recogs to reference\n people in your pose, but these always appear as that person's\n sdesc in the emote, regardless of who is seeing it.\n\n "}
    +
    +
    @@ -772,7 +800,7 @@ Using the command without arguments will list all current recogs.

    -aliases = ['recognize', 'forget']
    +aliases = ['forget', 'recognize']
    @@ -797,6 +825,11 @@ Using the command without arguments will list all current recogs.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': 'forget recognize', 'category': 'general', 'key': 'recog', 'tags': '', 'text': '\n Recognize another person in the same room.\n\n Usage:\n recog\n recog sdesc as alias\n forget alias\n\n Example:\n recog tall man as Griatch\n forget griatch\n\n This will assign a personal alias for a person, or forget said alias.\n Using the command without arguments will list all current recogs.\n\n '}
    +
    +
    @@ -841,6 +874,11 @@ set in self.parse())

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': 'unmask', 'category': 'general', 'key': 'mask', 'tags': '', 'text': "\n Wear a mask\n\n Usage:\n mask <new sdesc>\n unmask\n\n This will put on a mask to hide your identity. When wearing\n a mask, your sdesc will be replaced by the sdesc you pick and\n people's recognitions of you will be disabled.\n\n "}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.simpledoor.html b/docs/0.9.5/api/evennia.contrib.simpledoor.html index 844a428a2b..b91b8e7d30 100644 --- a/docs/0.9.5/api/evennia.contrib.simpledoor.html +++ b/docs/0.9.5/api/evennia.contrib.simpledoor.html @@ -179,6 +179,11 @@ unique.

    lock_storage = 'cmd:perm(open) or perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'building', 'key': 'open', 'tags': '', 'text': '\n open a new exit from the current room\n\n Usage:\n open <new exit>[;alias;alias..][:typeclass] [,<return exit>[;alias;..][:typeclass]]] = <destination>\n\n Handles the creation of exits. If a destination is given, the exit\n will point there. The <return exit> argument sets up an exit at the\n destination leading back to the current room. Destination name\n can be given both as a #dbref and a name, if that name is globally\n unique.\n\n '}
    +
    +
    @@ -222,6 +227,11 @@ close <door>

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'close', 'category': 'general', 'key': 'open', 'tags': '', 'text': '\n Open and close a door\n\n Usage:\n open <door>\n close <door>\n\n '}
    +
    + diff --git a/docs/0.9.5/api/evennia.contrib.slow_exit.html b/docs/0.9.5/api/evennia.contrib.slow_exit.html index fe21819461..6234747004 100644 --- a/docs/0.9.5/api/evennia.contrib.slow_exit.html +++ b/docs/0.9.5/api/evennia.contrib.slow_exit.html @@ -133,6 +133,11 @@ is assumed.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'setspeed', 'tags': '', 'text': "\n set your movement speed\n\n Usage:\n setspeed stroll|walk|run|sprint\n\n This will set your movement speed, determining how long time\n it takes to traverse exits. If no speed is set, 'walk' speed\n is assumed.\n "}
    +
    +
    @@ -172,6 +177,11 @@ stored deferred from the exit traversal above.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'stop', 'tags': '', 'text': '\n stop moving\n\n Usage:\n stop\n\n Stops the current movement, if any.\n '}
    +
    + diff --git a/docs/0.9.5/api/evennia.contrib.talking_npc.html b/docs/0.9.5/api/evennia.contrib.talking_npc.html index c8d6416183..df16543092 100644 --- a/docs/0.9.5/api/evennia.contrib.talking_npc.html +++ b/docs/0.9.5/api/evennia.contrib.talking_npc.html @@ -120,6 +120,11 @@ that NPC and give you options on what to talk about.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'talk', 'tags': '', 'text': '\n Talks to an npc\n\n Usage:\n talk\n\n This command is only available if a talkative non-player-character\n (NPC) is actually present. It will strike up a conversation with\n that NPC and give you options on what to talk about.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.tree_select.html b/docs/0.9.5/api/evennia.contrib.tree_select.html index 4c0ffaf8f6..970329f94b 100644 --- a/docs/0.9.5/api/evennia.contrib.tree_select.html +++ b/docs/0.9.5/api/evennia.contrib.tree_select.html @@ -369,6 +369,11 @@ set in self.parse())

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'namecolor', 'tags': '', 'text': '\n Set or remove a special color on your name. Just an example for the\n easy menu selection tree contrib.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.turnbattle.tb_basic.html b/docs/0.9.5/api/evennia.contrib.turnbattle.tb_basic.html index fb5d9b0057..5536932541 100644 --- a/docs/0.9.5/api/evennia.contrib.turnbattle.tb_basic.html +++ b/docs/0.9.5/api/evennia.contrib.turnbattle.tb_basic.html @@ -500,6 +500,11 @@ When it’s your turn, you can attack other characters.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'fight', 'tags': '', 'text': "\n Starts a fight with everyone in the same room as you.\n\n Usage:\n fight\n\n When you start a fight, everyone in the room who is able to\n fight is added to combat, and a turn order is randomly rolled.\n When it's your turn, you can attack other characters.\n "}
    +
    +
    @@ -539,6 +544,11 @@ a chance to hit, and if successful, will deal damage.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'attack', 'tags': '', 'text': '\n Attacks another character.\n\n Usage:\n attack <target>\n\n When in a fight, you may attack another character. The attack has\n a chance to hit, and if successful, will deal damage.\n '}
    +
    +
    @@ -559,7 +569,7 @@ if there are still any actions you can take.

    -aliases = ['hold', 'wait']
    +aliases = ['wait', 'hold']
    @@ -578,6 +588,11 @@ if there are still any actions you can take.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': 'wait hold', 'category': 'combat', 'key': 'pass', 'tags': '', 'text': '\n Passes on your turn.\n\n Usage:\n pass\n\n When in a fight, you can use this command to end your turn early, even\n if there are still any actions you can take.\n '}
    +
    +
    @@ -618,6 +633,11 @@ fight ends.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': 'spare', 'category': 'combat', 'key': 'disengage', 'tags': '', 'text': "\n Passes your turn and attempts to end combat.\n\n Usage:\n disengage\n\n Ends your turn early and signals that you're trying to end\n the fight. If all participants in a fight disengage, the\n fight ends.\n "}
    +
    +
    @@ -657,6 +677,11 @@ rest if you’re not in a fight.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'rest', 'tags': '', 'text': "\n Recovers damage.\n\n Usage:\n rest\n\n Resting recovers your HP to its maximum, but you can only\n rest if you're not in a fight.\n "}
    +
    +
    @@ -698,6 +723,11 @@ topics related to the game.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '?', 'category': 'general', 'key': 'help', 'tags': '', 'text': '\n View help or a list of topics\n\n Usage:\n help <topic or command>\n help list\n help all\n\n This will search for help on commands and other\n topics related to the game.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.turnbattle.tb_equip.html b/docs/0.9.5/api/evennia.contrib.turnbattle.tb_equip.html index fc690aa45f..7bfc60ea26 100644 --- a/docs/0.9.5/api/evennia.contrib.turnbattle.tb_equip.html +++ b/docs/0.9.5/api/evennia.contrib.turnbattle.tb_equip.html @@ -617,6 +617,11 @@ When it’s your turn, you can attack other characters.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'fight', 'tags': '', 'text': "\n Starts a fight with everyone in the same room as you.\n\n Usage:\n fight\n\n When you start a fight, everyone in the room who is able to\n fight is added to combat, and a turn order is randomly rolled.\n When it's your turn, you can attack other characters.\n "}
    +
    +
    @@ -656,6 +661,11 @@ a chance to hit, and if successful, will deal damage.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'attack', 'tags': '', 'text': '\n Attacks another character.\n\n Usage:\n attack <target>\n\n When in a fight, you may attack another character. The attack has\n a chance to hit, and if successful, will deal damage.\n '}
    +
    +
    @@ -676,7 +686,7 @@ if there are still any actions you can take.

    -aliases = ['hold', 'wait']
    +aliases = ['wait', 'hold']
    @@ -695,6 +705,11 @@ if there are still any actions you can take.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': 'wait hold', 'category': 'combat', 'key': 'pass', 'tags': '', 'text': '\n Passes on your turn.\n\n Usage:\n pass\n\n When in a fight, you can use this command to end your turn early, even\n if there are still any actions you can take.\n '}
    +
    +
    @@ -735,6 +750,11 @@ fight ends.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': 'spare', 'category': 'combat', 'key': 'disengage', 'tags': '', 'text': "\n Passes your turn and attempts to end combat.\n\n Usage:\n disengage\n\n Ends your turn early and signals that you're trying to end\n the fight. If all participants in a fight disengage, the\n fight ends.\n "}
    +
    +
    @@ -774,6 +794,11 @@ rest if you’re not in a fight.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'rest', 'tags': '', 'text': "\n Recovers damage.\n\n Usage:\n rest\n\n Resting recovers your HP to its maximum, but you can only\n rest if you're not in a fight.\n "}
    +
    +
    @@ -815,6 +840,11 @@ topics related to the game.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '?', 'category': 'general', 'key': 'help', 'tags': '', 'text': '\n View help or a list of topics\n\n Usage:\n help <topic or command>\n help list\n help all\n\n This will search for help on commands and other\n topics related to the game.\n '}
    +
    +
    @@ -858,6 +888,11 @@ currently wielding.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'wield', 'tags': '', 'text': '\n Wield a weapon you are carrying\n\n Usage:\n wield <weapon>\n\n Select a weapon you are carrying to wield in combat. If\n you are already wielding another weapon, you will switch\n to the weapon you specify instead. Using this command in\n combat will spend your action for your turn. Use the\n "unwield" command to stop wielding any weapon you are\n currently wielding.\n '}
    +
    +
    @@ -897,6 +932,11 @@ weapon you are currently wielding and become unarmed.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'unwield', 'tags': '', 'text': '\n Stop wielding a weapon.\n\n Usage:\n unwield\n\n After using this command, you will stop wielding any\n weapon you are currently wielding and become unarmed.\n '}
    +
    +
    @@ -937,6 +977,11 @@ command to remove any armor you are wearing.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'don', 'tags': '', 'text': '\n Don armor that you are carrying\n\n Usage:\n don <armor>\n\n Select armor to wear in combat. You can\'t use this\n command in the middle of a fight. Use the "doff"\n command to remove any armor you are wearing.\n '}
    +
    +
    @@ -977,6 +1022,11 @@ You can’t use this command in combat.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'doff', 'tags': '', 'text': "\n Stop wearing armor.\n\n Usage:\n doff\n\n After using this command, you will stop wearing any\n armor you are currently using and become unarmored.\n You can't use this command in combat.\n "}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.turnbattle.tb_items.html b/docs/0.9.5/api/evennia.contrib.turnbattle.tb_items.html index de559deab7..b90ea03ec1 100644 --- a/docs/0.9.5/api/evennia.contrib.turnbattle.tb_items.html +++ b/docs/0.9.5/api/evennia.contrib.turnbattle.tb_items.html @@ -651,6 +651,11 @@ When it’s your turn, you can attack other characters.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'fight', 'tags': '', 'text': "\n Starts a fight with everyone in the same room as you.\n\n Usage:\n fight\n\n When you start a fight, everyone in the room who is able to\n fight is added to combat, and a turn order is randomly rolled.\n When it's your turn, you can attack other characters.\n "}
    +
    +
    @@ -690,6 +695,11 @@ a chance to hit, and if successful, will deal damage.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'attack', 'tags': '', 'text': '\n Attacks another character.\n\n Usage:\n attack <target>\n\n When in a fight, you may attack another character. The attack has\n a chance to hit, and if successful, will deal damage.\n '}
    +
    +
    @@ -710,7 +720,7 @@ if there are still any actions you can take.

    -aliases = ['hold', 'wait']
    +aliases = ['wait', 'hold']
    @@ -729,6 +739,11 @@ if there are still any actions you can take.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': 'wait hold', 'category': 'combat', 'key': 'pass', 'tags': '', 'text': '\n Passes on your turn.\n\n Usage:\n pass\n\n When in a fight, you can use this command to end your turn early, even\n if there are still any actions you can take.\n '}
    +
    +
    @@ -769,6 +784,11 @@ fight ends.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': 'spare', 'category': 'combat', 'key': 'disengage', 'tags': '', 'text': "\n Passes your turn and attempts to end combat.\n\n Usage:\n disengage\n\n Ends your turn early and signals that you're trying to end\n the fight. If all participants in a fight disengage, the\n fight ends.\n "}
    +
    +
    @@ -808,6 +828,11 @@ rest if you’re not in a fight.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'rest', 'tags': '', 'text': "\n Recovers damage.\n\n Usage:\n rest\n\n Resting recovers your HP to its maximum, but you can only\n rest if you're not in a fight.\n "}
    +
    +
    @@ -849,6 +874,11 @@ topics related to the game.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '?', 'category': 'general', 'key': 'help', 'tags': '', 'text': '\n View help or a list of topics\n\n Usage:\n help <topic or command>\n help list\n help all\n\n This will search for help on commands and other\n topics related to the game.\n '}
    +
    +
    @@ -889,6 +919,11 @@ to attack others, and as such can only be used in combat.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'use', 'tags': '', 'text': '\n Use an item.\n\n Usage:\n use <item> [= target]\n\n An item can have various function - looking at the item may\n provide information as to its effects. Some items can be used\n to attack others, and as such can only be used in combat.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.turnbattle.tb_magic.html b/docs/0.9.5/api/evennia.contrib.turnbattle.tb_magic.html index 66a2341f19..6ad8b23441 100644 --- a/docs/0.9.5/api/evennia.contrib.turnbattle.tb_magic.html +++ b/docs/0.9.5/api/evennia.contrib.turnbattle.tb_magic.html @@ -523,6 +523,11 @@ When it’s your turn, you can attack other characters.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'fight', 'tags': '', 'text': "\n Starts a fight with everyone in the same room as you.\n\n Usage:\n fight\n\n When you start a fight, everyone in the room who is able to\n fight is added to combat, and a turn order is randomly rolled.\n When it's your turn, you can attack other characters.\n "}
    +
    +
    @@ -562,6 +567,11 @@ a chance to hit, and if successful, will deal damage.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'attack', 'tags': '', 'text': '\n Attacks another character.\n\n Usage:\n attack <target>\n\n When in a fight, you may attack another character. The attack has\n a chance to hit, and if successful, will deal damage.\n '}
    +
    +
    @@ -582,7 +592,7 @@ if there are still any actions you can take.

    -aliases = ['hold', 'wait']
    +aliases = ['wait', 'hold']
    @@ -601,6 +611,11 @@ if there are still any actions you can take.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': 'wait hold', 'category': 'combat', 'key': 'pass', 'tags': '', 'text': '\n Passes on your turn.\n\n Usage:\n pass\n\n When in a fight, you can use this command to end your turn early, even\n if there are still any actions you can take.\n '}
    +
    +
    @@ -641,6 +656,11 @@ fight ends.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': 'spare', 'category': 'combat', 'key': 'disengage', 'tags': '', 'text': "\n Passes your turn and attempts to end combat.\n\n Usage:\n disengage\n\n Ends your turn early and signals that you're trying to end\n the fight. If all participants in a fight disengage, the\n fight ends.\n "}
    +
    +
    @@ -694,6 +714,11 @@ fight ends.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'magic', 'key': 'learnspell', 'tags': '', 'text': "\n Learn a magic spell.\n\n Usage:\n learnspell <spell name>\n\n Adds a spell by name to your list of spells known.\n\n The following spells are provided as examples:\n\n |wmagic missile|n (3 MP): Fires three missiles that never miss. Can target\n up to three different enemies.\n\n |wflame shot|n (3 MP): Shoots a high-damage jet of flame at one target.\n\n |wcure wounds|n (5 MP): Heals damage on one target.\n\n |wmass cure wounds|n (10 MP): Like 'cure wounds', but can heal up to 5\n targets at once.\n\n |wfull heal|n (12 MP): Heals one target back to full HP.\n\n |wcactus conjuration|n (2 MP): Creates a cactus.\n "}
    +
    +
    @@ -741,6 +766,11 @@ function.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'magic', 'key': 'cast', 'tags': '', 'text': "\n Cast a magic spell that you know, provided you have the MP\n to spend on its casting.\n\n Usage:\n cast <spellname> [= <target1>, <target2>, etc...]\n\n Some spells can be cast on multiple targets, some can be cast\n on only yourself, and some don't need a target specified at all.\n Typing 'cast' by itself will give you a list of spells you know.\n "}
    +
    +
    @@ -780,6 +810,11 @@ only rest if you’re not in a fight.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'rest', 'tags': '', 'text': "\n Recovers damage and restores MP.\n\n Usage:\n rest\n\n Resting recovers your HP and MP to their maximum, but you can\n only rest if you're not in a fight.\n "}
    +
    +
    @@ -819,6 +854,11 @@ other targets in combat.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'status', 'tags': '', 'text': '\n Gives combat information.\n\n Usage:\n status\n\n Shows your current and maximum HP and your distance from\n other targets in combat.\n '}
    +
    +
    @@ -860,6 +900,11 @@ topics related to the game.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '?', 'category': 'general', 'key': 'help', 'tags': '', 'text': '\n View help or a list of topics\n\n Usage:\n help <topic or command>\n help list\n help all\n\n This will search for help on commands and other\n topics related to the game.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.turnbattle.tb_range.html b/docs/0.9.5/api/evennia.contrib.turnbattle.tb_range.html index 46813d862b..62782b3b9a 100644 --- a/docs/0.9.5/api/evennia.contrib.turnbattle.tb_range.html +++ b/docs/0.9.5/api/evennia.contrib.turnbattle.tb_range.html @@ -814,6 +814,11 @@ When it’s your turn, you can attack other characters.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'fight', 'tags': '', 'text': "\n Starts a fight with everyone in the same room as you.\n\n Usage:\n fight\n\n When you start a fight, everyone in the room who is able to\n fight is added to combat, and a turn order is randomly rolled.\n When it's your turn, you can attack other characters.\n "}
    +
    +
    @@ -855,6 +860,11 @@ you. Use the ‘approach’ command to get closer to a target.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'attack', 'tags': '', 'text': "\n Attacks another character in melee.\n\n Usage:\n attack <target>\n\n When in a fight, you may attack another character. The attack has\n a chance to hit, and if successful, will deal damage. You can only\n attack engaged targets - that is, targets that are right next to\n you. Use the 'approach' command to get closer to a target.\n "}
    +
    +
    @@ -897,6 +907,11 @@ nearby enemies.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'shoot', 'tags': '', 'text': "\n Attacks another character from range.\n\n Usage:\n shoot <target>\n\n When in a fight, you may shoot another character. The attack has\n a chance to hit, and if successful, will deal damage. You can attack\n any target in combat by shooting, but can't shoot if there are any\n targets engaged with you. Use the 'withdraw' command to retreat from\n nearby enemies.\n "}
    +
    +
    @@ -936,6 +951,11 @@ characters you are 0 spaces away from.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'approach', 'tags': '', 'text': '\n Approaches an object.\n\n Usage:\n approach <target>\n\n Move one space toward a character or object. You can only attack\n characters you are 0 spaces away from.\n '}
    +
    +
    @@ -974,6 +994,11 @@ characters you are 0 spaces away from.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'withdraw', 'tags': '', 'text': '\n Moves away from an object.\n\n Usage:\n withdraw <target>\n\n Move one space away from a character or object.\n '}
    +
    +
    @@ -994,7 +1019,7 @@ if there are still any actions you can take.

    -aliases = ['hold', 'wait']
    +aliases = ['wait', 'hold']
    @@ -1013,6 +1038,11 @@ if there are still any actions you can take.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': 'wait hold', 'category': 'combat', 'key': 'pass', 'tags': '', 'text': '\n Passes on your turn.\n\n Usage:\n pass\n\n When in a fight, you can use this command to end your turn early, even\n if there are still any actions you can take.\n '}
    +
    +
    @@ -1053,6 +1083,11 @@ fight ends.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': 'spare', 'category': 'combat', 'key': 'disengage', 'tags': '', 'text': "\n Passes your turn and attempts to end combat.\n\n Usage:\n disengage\n\n Ends your turn early and signals that you're trying to end\n the fight. If all participants in a fight disengage, the\n fight ends.\n "}
    +
    +
    @@ -1092,6 +1127,11 @@ rest if you’re not in a fight.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'rest', 'tags': '', 'text': "\n Recovers damage.\n\n Usage:\n rest\n\n Resting recovers your HP to its maximum, but you can only\n rest if you're not in a fight.\n "}
    +
    +
    @@ -1131,6 +1171,11 @@ other targets in combat.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'combat', 'key': 'status', 'tags': '', 'text': '\n Gives combat information.\n\n Usage:\n status\n\n Shows your current and maximum HP and your distance from\n other targets in combat.\n '}
    +
    +
    @@ -1172,6 +1217,11 @@ topics related to the game.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '?', 'category': 'general', 'key': 'help', 'tags': '', 'text': '\n View help or a list of topics\n\n Usage:\n help <topic or command>\n help list\n help all\n\n This will search for help on commands and other\n topics related to the game.\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.tutorial_examples.cmdset_red_button.html b/docs/0.9.5/api/evennia.contrib.tutorial_examples.cmdset_red_button.html index 5a870746c6..36cfe18046 100644 --- a/docs/0.9.5/api/evennia.contrib.tutorial_examples.cmdset_red_button.html +++ b/docs/0.9.5/api/evennia.contrib.tutorial_examples.cmdset_red_button.html @@ -86,6 +86,11 @@ push the lid of the button away.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'nudge', 'category': 'general', 'key': 'nudge lid', 'tags': '', 'text': "\n Try to nudge the button's lid\n\n Usage:\n nudge lid\n\n This command will have you try to\n push the lid of the button away.\n "}
    +
    +
    @@ -104,7 +109,7 @@ push the lid of the button away.

    -aliases = ['push', 'press', 'press button']
    +aliases = ['press button', 'push', 'press']
    @@ -133,6 +138,11 @@ lid-state respectively.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'press button push press', 'category': 'general', 'key': 'push button', 'tags': '', 'text': '\n Push the red button\n\n Usage:\n push button\n\n '}
    +
    +
    @@ -177,6 +187,11 @@ of causing the lamp to break.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'smash lid break lid smash', 'category': 'general', 'key': 'smash glass', 'tags': '', 'text': '\n smash glass\n\n Usage:\n smash glass\n\n Try to smash the glass of the button.\n '}
    +
    +
    @@ -195,7 +210,7 @@ of causing the lamp to break.

    -aliases = ['open button', 'open']
    +aliases = ['open', 'open button']
    @@ -219,6 +234,11 @@ of causing the lamp to break.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'open open button', 'category': 'general', 'key': 'open lid', 'tags': '', 'text': '\n open lid\n\n Usage:\n open lid\n\n '}
    +
    +
    @@ -262,6 +282,11 @@ of causing the lamp to break.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'close', 'category': 'general', 'key': 'close lid', 'tags': '', 'text': '\n close the lid\n\n Usage:\n close lid\n\n Closes the lid of the red button.\n '}
    +
    +
    @@ -281,7 +306,7 @@ of causing the lamp to break.

    -aliases = ['listen', 'feel', 'ex', 'get', 'examine', 'l']
    +aliases = ['examine', 'l', 'listen', 'get', 'ex', 'feel']
    @@ -305,6 +330,11 @@ of causing the lamp to break.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'examine l listen get ex feel', 'category': 'general', 'key': 'look', 'tags': '', 'text': "\n Looking around in darkness\n\n Usage:\n look <obj>\n\n ... not that there's much to see in the dark.\n\n "}
    +
    +
    @@ -347,6 +377,11 @@ of causing the lamp to break.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'h', 'category': 'general', 'key': 'help', 'tags': '', 'text': '\n Help function while in the blinded state\n\n Usage:\n help\n\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.tutorial_world.mob.html b/docs/0.9.5/api/evennia.contrib.tutorial_world.mob.html index b5fe984895..ac44210fd5 100644 --- a/docs/0.9.5/api/evennia.contrib.tutorial_world.mob.html +++ b/docs/0.9.5/api/evennia.contrib.tutorial_world.mob.html @@ -87,6 +87,11 @@ to turn on/off the mob.”

    lock_storage = 'cmd:superuser()'
    +
    +
    +search_index_entry = {'aliases': 'moboff', 'category': 'general', 'key': 'mobon', 'tags': '', 'text': "\n Activates/deactivates Mob\n\n Usage:\n mobon <mob>\n moboff <mob>\n\n This turns the mob from active (alive) mode\n to inactive (dead) mode. It is used during\n building to activate the mob once it's\n prepared.\n "}
    +
    +
    @@ -122,7 +127,7 @@ the way it came. If unset, the mob will remain stationary (idling) until attacked.

    aggressive: if set, will attack Characters in

    the same room using whatever Weapon it -carries (see tutorial_world.objects.Weapon). +carries (see tutorial_world.objects.TutorialWeapon). if unset, the mob will never engage in combat no matter what.

    diff --git a/docs/0.9.5/api/evennia.contrib.tutorial_world.objects.html b/docs/0.9.5/api/evennia.contrib.tutorial_world.objects.html index c22c66fa5c..1da18d6e9f 100644 --- a/docs/0.9.5/api/evennia.contrib.tutorial_world.objects.html +++ b/docs/0.9.5/api/evennia.contrib.tutorial_world.objects.html @@ -49,8 +49,8 @@ TutorialClimbable Obelisk LightSource CrumblingWall -Weapon -WeaponRack

    +TutorialWeapon +TutorialWeaponRack

    class evennia.contrib.tutorial_world.objects.TutorialObject(*args, **kwargs)[source]
    @@ -133,6 +133,11 @@ Attribute “readable_text” on the object and displays that.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'tutorialworld', 'key': 'read', 'tags': '', 'text': '\n Usage:\n read [obj]\n\n Read some text of a readable object.\n '}
    +
    +
    @@ -230,6 +235,11 @@ Attribute and add the readable cmdset.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'tutorialworld', 'key': 'climb', 'tags': '', 'text': '\n Climb an object\n\n Usage:\n climb <object>\n\n This allows you to climb.\n '}
    +
    +
    @@ -350,7 +360,7 @@ of the object. We overload it with our own version.

    -aliases = ['light', 'burn']
    +aliases = ['burn', 'light']
    @@ -375,6 +385,11 @@ to sit on a “lightable” object, we operate only on self.obj.

    lock_storage = 'cmd:holds()'
    +
    +
    +search_index_entry = {'aliases': 'burn light', 'category': 'tutorialworld', 'key': 'on', 'tags': '', 'text': '\n Creates light where there was none. Something to burn.\n '}
    +
    +
    @@ -476,7 +491,7 @@ shift green root up/down

    -aliases = ['shiftroot', 'move', 'push', 'pull']
    +aliases = ['move', 'push', 'pull', 'shiftroot']
    @@ -510,6 +525,11 @@ yellow/green - horizontal roots

    lock_storage = 'cmd:locattr(is_lit)'
    +
    +
    +search_index_entry = {'aliases': 'move push pull shiftroot', 'category': 'tutorialworld', 'key': 'shift', 'tags': '', 'text': '\n Shifts roots around.\n\n Usage:\n shift blue root left/right\n shift red root left/right\n shift yellow root up/down\n shift green root up/down\n\n '}
    +
    +
    @@ -524,7 +544,7 @@ yellow/green - horizontal roots

    -aliases = ['button', 'push button', 'press button']
    +aliases = ['push button', 'press button', 'button']
    @@ -548,6 +568,11 @@ yellow/green - horizontal roots

    lock_storage = 'cmd:objattr(button_exposed) and objlocattr(is_lit)'
    +
    +
    +search_index_entry = {'aliases': 'push button press button button', 'category': 'tutorialworld', 'key': 'press', 'tags': '', 'text': '\n Presses a button.\n '}
    +
    +
    @@ -689,7 +714,7 @@ parry - forgoes your attack but will make you harder to hit on next

    -aliases = ['fight', 'parry', 'kill', 'defend', 'thrust', 'chop', 'bash', 'stab', 'hit', 'slash', 'pierce']
    +aliases = ['thrust', 'parry', 'defend', 'stab', 'kill', 'slash', 'hit', 'pierce', 'chop', 'bash', 'fight']
    @@ -713,6 +738,11 @@ parry - forgoes your attack but will make you harder to hit on next

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'thrust parry defend stab kill slash hit pierce chop bash fight', 'category': 'tutorialworld', 'key': 'attack', 'tags': '', 'text': '\n Attack the enemy. Commands:\n\n stab <enemy>\n slash <enemy>\n parry\n\n stab - (thrust) makes a lot of damage but is harder to hit with.\n slash - is easier to land, but does not make as much damage.\n parry - forgoes your attack but will make you harder to hit on next\n enemy attack.\n\n '}
    +
    +
    @@ -734,8 +764,8 @@ parry - forgoes your attack but will make you harder to hit on next

    -
    -class evennia.contrib.tutorial_world.objects.Weapon(*args, **kwargs)[source]
    +
    +class evennia.contrib.tutorial_world.objects.TutorialWeapon(*args, **kwargs)[source]

    Bases: evennia.contrib.tutorial_world.objects.TutorialObject

    This defines a bladed weapon.

    @@ -748,38 +778,38 @@ damage - base damage given (modified by hit success and

    -
    -at_object_creation()[source]
    +
    +at_object_creation()[source]

    Called at first creation of the object

    -
    -reset()[source]
    +
    +reset()[source]

    When reset, the weapon is simply deleted, unless it has a place to return to.

    -
    -exception DoesNotExist
    +
    +exception DoesNotExist

    Bases: evennia.contrib.tutorial_world.objects.TutorialObject.DoesNotExist

    -
    -exception MultipleObjectsReturned
    +
    +exception MultipleObjectsReturned

    Bases: evennia.contrib.tutorial_world.objects.TutorialObject.MultipleObjectsReturned

    -
    -path = 'evennia.contrib.tutorial_world.objects.Weapon'
    +
    +path = 'evennia.contrib.tutorial_world.objects.TutorialWeapon'
    -
    -typename = 'Weapon'
    +
    +typename = 'TutorialWeapon'
    @@ -825,6 +855,11 @@ itself handle all messages.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'tutorialworld', 'key': 'get weapon', 'tags': '', 'text': '\n Usage:\n get weapon\n\n This will try to obtain a weapon from the container.\n '}
    +
    +
    @@ -851,8 +886,8 @@ itself handle all messages.

    -
    -class evennia.contrib.tutorial_world.objects.WeaponRack(*args, **kwargs)[source]
    +
    +class evennia.contrib.tutorial_world.objects.TutorialWeaponRack(*args, **kwargs)[source]

    Bases: evennia.contrib.tutorial_world.objects.TutorialObject

    This object represents a weapon store. When people use the “get weapon” command on this rack, it will produce one @@ -870,14 +905,14 @@ grab another one.

    -
    -at_object_creation()[source]
    +
    +at_object_creation()[source]

    called at creation

    -
    -produce_weapon(caller)[source]
    +
    +produce_weapon(caller)[source]

    This will produce a new weapon from the rack, assuming the caller hasn’t already gotten one. When doing so, the caller will get Tagged with the id @@ -886,25 +921,25 @@ pulling weapons from it indefinitely.

    -
    -exception DoesNotExist
    +
    +exception DoesNotExist

    Bases: evennia.contrib.tutorial_world.objects.TutorialObject.DoesNotExist

    -
    -exception MultipleObjectsReturned
    +
    +exception MultipleObjectsReturned

    Bases: evennia.contrib.tutorial_world.objects.TutorialObject.MultipleObjectsReturned

    -
    -path = 'evennia.contrib.tutorial_world.objects.WeaponRack'
    +
    +path = 'evennia.contrib.tutorial_world.objects.TutorialWeaponRack'
    -
    -typename = 'WeaponRack'
    +
    +typename = 'TutorialWeaponRack'
    diff --git a/docs/0.9.5/api/evennia.contrib.tutorial_world.rooms.html b/docs/0.9.5/api/evennia.contrib.tutorial_world.rooms.html index 029fdde9ba..d8892d7672 100644 --- a/docs/0.9.5/api/evennia.contrib.tutorial_world.rooms.html +++ b/docs/0.9.5/api/evennia.contrib.tutorial_world.rooms.html @@ -86,6 +86,11 @@ called tutorial_info and display that.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'tut', 'category': 'tutorialworld', 'key': 'tutorial', 'tags': '', 'text': '\n Get help during the tutorial\n\n Usage:\n tutorial [obj]\n\n This command allows you to get behind-the-scenes info\n about an object or the current location.\n\n '}
    +
    +
    @@ -139,6 +144,11 @@ the set_detail method and uses it.

    lock_storage = 'cmd:perm(Builder)'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'tutorialworld', 'key': '@detail', 'tags': '', 'text': '\n sets a detail on a room\n\n Usage:\n @detail <key> = <description>\n @detail <key>;<alias>;... = description\n\n Example:\n @detail walls = The walls are covered in ...\n @detail castle;ruin;tower = The distant ruin ...\n\n This sets a "detail" on the object this command is defined on\n (TutorialRoom for this tutorial). This detail can be accessed with\n the TutorialRoomLook command sitting on TutorialRoom objects (details\n are set as a simple dictionary on the room). This is a Builder command.\n\n We custom parse the key for the ;-separator in order to create\n multiple aliases to the detail all at once.\n '}
    +
    +
    @@ -186,6 +196,11 @@ code except for adding in the details.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'l ls', 'category': 'tutorialworld', 'key': 'look', 'tags': '', 'text': '\n looks at the room and on details\n\n Usage:\n look <obj>\n look <room detail>\n look *<account>\n\n Observes your location, details at your location or objects\n in your vicinity.\n\n Tutorial: This is a child of the default Look command, that also\n allows us to look at "details" in the room. These details are\n things to examine and offers some extra description without\n actually having to be actual database objects. It uses the\n return_detail() hook on TutorialRooms for this.\n '}
    +
    +
    @@ -222,6 +237,11 @@ to all the variables defined therein.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': 'abort', 'category': 'general', 'key': 'give up', 'tags': '', 'text': '\n Give up the tutorial-world quest and return to Limbo, the start room of the\n server.\n\n '}
    +
    +
    @@ -427,6 +447,11 @@ set in self.parse())

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'intro', 'tags': '', 'text': '\n Start the Evennia intro wizard.\n\n Usage:\n intro\n\n '}
    +
    +
    @@ -556,6 +581,11 @@ on the bridge, 0 - 4.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'e', 'category': 'tutorialworld', 'key': 'east', 'tags': '', 'text': '\n Go eastwards across the bridge.\n\n Tutorial info:\n This command relies on the caller having two Attributes\n (assigned by the room when entering):\n - east_exit: a unique name or dbref to the room to go to\n when exiting east.\n - west_exit: a unique name or dbref to the room to go to\n when exiting west.\n The room must also have the following Attributes\n - tutorial_bridge_posistion: the current position on\n on the bridge, 0 - 4.\n\n '}
    +
    +
    @@ -614,6 +644,11 @@ on the bridge, 0 - 4.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'w', 'category': 'tutorialworld', 'key': 'west', 'tags': '', 'text': '\n Go westwards across the bridge.\n\n Tutorial info:\n This command relies on the caller having two Attributes\n (assigned by the room when entering):\n - east_exit: a unique name or dbref to the room to go to\n when exiting east.\n - west_exit: a unique name or dbref to the room to go to\n when exiting west.\n The room must also have the following property:\n - tutorial_bridge_posistion: the current position on\n on the bridge, 0 - 4.\n\n '}
    +
    +
    @@ -658,6 +693,11 @@ if they fall off the bridge.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'l', 'category': 'tutorialworld', 'key': 'look', 'tags': '', 'text': '\n looks around at the bridge.\n\n Tutorial info:\n This command assumes that the room has an Attribute\n "fall_exit", a unique name or dbref to the place they end upp\n if they fall off the bridge.\n '}
    +
    +
    @@ -672,7 +712,7 @@ if they fall off the bridge.

    -aliases = ['h', '?']
    +aliases = ['?', 'h']
    @@ -696,6 +736,11 @@ if they fall off the bridge.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '? h', 'category': 'tutorial world', 'key': 'help', 'tags': '', 'text': '\n Overwritten help command while on the bridge.\n '}
    +
    +
    @@ -819,7 +864,7 @@ to find something.

    -aliases = ['fiddle', 'feel', 'feel around', 'search', 'l']
    +aliases = ['l', 'search', 'fiddle', 'feel around', 'feel']
    @@ -845,6 +890,11 @@ random chance of eventually finding a light source.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': 'l search fiddle feel around feel', 'category': 'tutorialworld', 'key': 'look', 'tags': '', 'text': '\n Look around in darkness\n\n Usage:\n look\n\n Look around in the darkness, trying\n to find something.\n '}
    +
    +
    @@ -883,6 +933,11 @@ random chance of eventually finding a light source.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'tutorialworld', 'key': 'help', 'tags': '', 'text': '\n Help command for the dark state.\n '}
    +
    +
    @@ -925,6 +980,11 @@ suggestions)

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': '__nomatch_command', 'tags': '', 'text': "\n This is a system command. Commands with special keys are used to\n override special sitations in the game. The CMD_NOMATCH is used\n when the given command is not found in the current command set (it\n replaces Evennia's default behavior or offering command\n suggestions)\n "}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.contrib.unixcommand.html b/docs/0.9.5/api/evennia.contrib.unixcommand.html index 463f7835ef..336776b9f2 100644 --- a/docs/0.9.5/api/evennia.contrib.unixcommand.html +++ b/docs/0.9.5/api/evennia.contrib.unixcommand.html @@ -317,6 +317,11 @@ use its add_argument method.

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'command', 'tags': '', 'text': '\n Unix-type commands, supporting short and long options.\n\n This command syntax uses the Unix-style commands with short options\n (-X) and long options (--something). The `argparse` module is\n used to parse the command.\n\n In order to use it, you should override two methods:\n - `init_parser`: this method is called when the command is created.\n It can be used to set options in the parser. `self.parser`\n contains the `argparse.ArgumentParser`, so you can add arguments\n here.\n - `func`: this method is called to execute the command, but after\n the parser has checked the arguments given to it are valid.\n You can access the namespace of valid arguments in `self.opts`\n at this point.\n\n The help of UnixCommands is derived from the docstring, in a\n slightly different way than usual: the first line of the docstring\n is used to represent the program description (the very short\n line at the top of the help message). The other lines below are\n used as the program\'s "epilog", displayed below the options. It\n means in your docstring, you don\'t have to write the options.\n They will be automatically provided by the parser and displayed\n accordingly. The `argparse` module provides a default \'-h\' or\n \'--help\' option on the command. Typing |whelp commandname|n will\n display the same as |wcommandname -h|n, though this behavior can\n be changed.\n\n '}
    +
    + diff --git a/docs/0.9.5/api/evennia.help.models.html b/docs/0.9.5/api/evennia.help.models.html index 6ec8b1aaf7..b3c84370c2 100644 --- a/docs/0.9.5/api/evennia.help.models.html +++ b/docs/0.9.5/api/evennia.help.models.html @@ -139,6 +139,12 @@ access_type - type of access sought default - what to return if no lock of access_type was found

    +
    +
    +property search_index_entry
    +

    Property for easily retaining a search index entry for this object.

    +
    +
    web_get_admin_url()[source]
    diff --git a/docs/0.9.5/api/evennia.html b/docs/0.9.5/api/evennia.html index c3fb30e709..216e311a07 100644 --- a/docs/0.9.5/api/evennia.html +++ b/docs/0.9.5/api/evennia.html @@ -371,8 +371,14 @@ with ‘q’, remove the break line and restart server when finished.

  • evennia.utils
  • +
    +
    +load()[source]
    +

    Retrieves all objects from database. Used for initializing.

    +
    +
    Returns
    +

    Objects (list of ObjectDB)

    +
    +
    +
    +
    init()[source]
    @@ -77,11 +88,14 @@ handler is defined

    -get(exclude=None)[source]
    +get(exclude=None, content_type=None)[source]

    Return the contents of the cache.

    Parameters
    -

    exclude (Object or list of Object) – object(s) to ignore

    +
      +
    • exclude (Object or list of Object) – object(s) to ignore

    • +
    • content_type (str or None) – Filter list by a content-type. If None, don’t filter.

    • +
    Returns

    objects (list) – the Objects inside this location

    diff --git a/docs/0.9.5/api/evennia.objects.objects.html b/docs/0.9.5/api/evennia.objects.objects.html index 7f2a1674cc..5ae613659c 100644 --- a/docs/0.9.5/api/evennia.objects.objects.html +++ b/docs/0.9.5/api/evennia.objects.objects.html @@ -197,21 +197,26 @@ currently connected to this object.

    -contents_get(exclude=None)[source]
    +contents_get(exclude=None, content_type=None)[source]

    Returns the contents of this object, i.e. all objects that has this object set as its location. This should be publically available.

    Parameters
    -

    exclude (Object) – Object to exclude from returned -contents list

    +
      +
    • exclude (Object) – Object to exclude from returned +contents list

    • +
    • content_type (str) – A content_type to filter by. None for no +filtering.

    • +
    Returns

    contents (list) – List of contents of this Object.

    Notes

    -

    Also available as the contents property.

    +

    Also available as the contents property, minus exclusion +and filtering.

    @@ -228,15 +233,20 @@ objects that has this object set as its location. This should be publically available.

    Parameters
    -

    exclude (Object) – Object to exclude from returned -contents list

    +
      +
    • exclude (Object) – Object to exclude from returned +contents list

    • +
    • content_type (str) – A content_type to filter by. None for no +filtering.

    • +
    Returns

    contents (list) – List of contents of this Object.

    Notes

    -

    Also available as the contents property.

    +

    Also available as the contents property, minus exclusion +and filtering.

    @@ -300,7 +310,7 @@ plural (str): The determined plural form of the key, including the count.

    -search(searchdata, global_search=False, use_nicks=True, typeclass=None, location=None, attribute_name=None, quiet=False, exact=False, candidates=None, nofound_string=None, multimatch_string=None, use_dbref=None)[source]
    +search(searchdata, global_search=False, use_nicks=True, typeclass=None, location=None, attribute_name=None, quiet=False, exact=False, candidates=None, nofound_string=None, multimatch_string=None, use_dbref=None, stacked=0)[source]

    Returns an Object matching a search string/condition

    Perform a standard object search in the database, handling multiple results and lack thereof gracefully. By default, only @@ -362,14 +372,22 @@ to find an object (globally) by its database-id 123. If False, will be treated like a normal string. If None (default), the ability to query by #dbref is turned on if self has the permission ‘Builder’ and is turned off otherwise.

    +
  • stacked (int, optional) – If > 0, multimatches will be analyzed to determine if they +only contains identical objects; these are then assumed ‘stacked’ and no multi-match +error will be generated, instead stacked number of matches will be returned. If +stacked is larger than number of matches, returns that number of matches. If +the found stack is a mix of objects, return None and handle the multi-match +error depending on the value of quiet.

  • Returns
    -

    match (Object, None or list)

    -
    -
    will return an Object/None if quiet=False,

    otherwise it will return a list of 0, 1 or more matches.

    -
    -
    +

    Object – If finding a match an quiet=False +None: If not finding a unique match and quiet=False. +list: With 0, 1 or more matching objects if quiet=True +list: With 2 or more matching objects if stacked is a positive integer and

    +
    +

    the matched stack has only object-copies.

    +

    @@ -1493,6 +1511,36 @@ errors (list): A list of errors in string form, if any.

    +
    +
    +classmethod normalize_name(name)[source]
    +

    Normalize the character name prior to creating. Note that this should be refactored +to support i18n for non-latin scripts, but as we (currently) have no bug reports requesting better +support of non-latin character sets, requiring character names to be latinified is an acceptable option.

    +
    +
    Parameters
    +

    name (str) – The name of the character

    +
    +
    Returns
    +

    latin_name (str) – A valid name.

    +
    +
    +
    + +
    +
    +classmethod validate_name(name)[source]
    +

    Validate the character name prior to creating. Overload this function to add custom validators

    +
    +
    Parameters
    +

    name (str) – The name of the character

    +
    +
    Returns
    +

    valid (bool) – True if character creation should continue; False if it should fail

    +
    +
    +
    +
    basetype_setup()[source]
    @@ -1722,6 +1770,11 @@ overriding the call (unused by default).

    lock_storage = 'cmd:all();'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'command', 'tags': '', 'text': '\n This is a command that simply cause the caller to traverse\n the object it is attached to.\n\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.server.portal.portalsessionhandler.html b/docs/0.9.5/api/evennia.server.portal.portalsessionhandler.html index d747cc1e17..5c42a771c5 100644 --- a/docs/0.9.5/api/evennia.server.portal.portalsessionhandler.html +++ b/docs/0.9.5/api/evennia.server.portal.portalsessionhandler.html @@ -62,6 +62,17 @@ to the server using the AMP connection.

    At this point, the AMP connection is already established.

    +
    +
    +generate_sessid()[source]
    +

    Simply generates a sessid that’s guaranteed to be unique for this Portal run.

    +
    +
    Returns
    +

    sessid

    +
    +
    +
    +
    connect(session)[source]
    diff --git a/docs/0.9.5/api/evennia.server.portal.ssh.html b/docs/0.9.5/api/evennia.server.portal.ssh.html index 5849973acb..efb91d7dbb 100644 --- a/docs/0.9.5/api/evennia.server.portal.ssh.html +++ b/docs/0.9.5/api/evennia.server.portal.ssh.html @@ -224,18 +224,18 @@ reaching this point.

    are considered.

    Keyword Arguments
    -

    options (dict) –

    Send-option flags:

    +

    options (dict) –

    Send-option flags (booleans)

    diff --git a/docs/0.9.5/api/evennia.server.portal.telnet.html b/docs/0.9.5/api/evennia.server.portal.telnet.html index c815019cbf..d2f715df35 100644 --- a/docs/0.9.5/api/evennia.server.portal.telnet.html +++ b/docs/0.9.5/api/evennia.server.portal.telnet.html @@ -241,19 +241,25 @@ disconnect this protocol.

    are considered.

    Keyword Arguments
    -

    options (dict) –

    Send-option flags:

    +

    options (dict) –

    Send-option flags

    diff --git a/docs/0.9.5/api/evennia.server.portal.telnet_oob.html b/docs/0.9.5/api/evennia.server.portal.telnet_oob.html index 98b08d2c8b..af19203274 100644 --- a/docs/0.9.5/api/evennia.server.portal.telnet_oob.html +++ b/docs/0.9.5/api/evennia.server.portal.telnet_oob.html @@ -46,19 +46,15 @@ commands, by contrast, can have many forms and it is up to the client how and if they are handled. Examples of OOB instructions could be to instruct the client to play sounds or to update a graphical health bar.

    -

    > Note that in Evennia’s Web client, all send commands are “OOB commands”, -(including the “text” one), there is no equivalence to MSDP/GMCP for the -webclient since it doesn’t need it.

    +

    Note that in Evennia’s Web client, all send commands are “OOB +commands”, (including the “text” one), there is no equivalence to +MSDP/GMCP for the webclient since it doesn’t need it.

    This implements the following telnet OOB communication protocols:

    -

    Following the lead of KaVir’s protocol snippet, we first check if client -supports MSDP and if not, we fallback to GMCP with a MSDP header where -applicable.


    @@ -138,17 +134,17 @@ supported.

    Notes

    The output of this encoding will be MSDP structures on these forms:

    -
    [cmdname, [], {}]          -> VAR cmdname VAL ""
    -[cmdname, [arg], {}]       -> VAR cmdname VAL arg
    -[cmdname, [args],{}]       -> VAR cmdname VAL ARRAYOPEN VAL arg VAL arg ... ARRAYCLOSE
    -[cmdname, [], {kwargs}]    -> VAR cmdname VAL TABLEOPEN VAR key VAL val ... TABLECLOSE
    +
    [cmdname, [], {}]           -> VAR cmdname VAL ""
    +[cmdname, [arg], {}]        -> VAR cmdname VAL arg
    +[cmdname, [args],{}]        -> VAR cmdname VAL ARRAYOPEN VAL arg VAL arg ... ARRAYCLOSE
    +[cmdname, [], {kwargs}]     -> VAR cmdname VAL TABLEOPEN VAR key VAL val ... TABLECLOSE
     [cmdname, [args], {kwargs}] -> VAR cmdname VAL ARRAYOPEN VAL arg VAL arg ... ARRAYCLOSE
                                    VAR cmdname VAL TABLEOPEN VAR key VAL val ... TABLECLOSE
     
    -

    Further nesting is not supported, so if an array argument consists -of an array (for example), that array will be json-converted to a -string.

    +

    Further nesting is not supported, so if an array argument +consists of an array (for example), that array will be +json-converted to a string.

    @@ -175,12 +171,11 @@ be stripped on the Evennia side.

    [cmd.name, [arg], {}] -> Cmd.Name arg [cmd.name, [args],{}] -> Cmd.Name [args] [cmd.name, [], {kwargs}] -> Cmd.Name {kwargs} -[cmdname, [args, {kwargs}] -> Core.Cmdname [[args],{kwargs}] +[cmdname, [args, {kwargs}] -> Core.Cmdname [[args],{kwargs}]

    Notes

    -

    There are also a few default mappings between evennia outputcmds and -GMCP:

    +

    There are also a few default mappings between evennia outputcmds and GMCP:

    client_options -> Core.Supports.Get
     get_inputfuncs -> Core.Commands.Get
     get_value      -> Char.Value.Get
    diff --git a/docs/0.9.5/api/evennia.server.profiling.dummyrunner_settings.html b/docs/0.9.5/api/evennia.server.profiling.dummyrunner_settings.html
    index 154eaae626..f00316e1fb 100644
    --- a/docs/0.9.5/api/evennia.server.profiling.dummyrunner_settings.html
    +++ b/docs/0.9.5/api/evennia.server.profiling.dummyrunner_settings.html
    @@ -42,13 +42,17 @@
     

    This module defines dummyrunner settings and sets up the actions available to dummy accounts.

    The settings are global variables:

    -

    TIMESTEP - time in seconds between each ‘tick’ -CHANCE_OF_ACTION - chance 0-1 of action happening -CHANCE_OF_LOGIN - chance 0-1 of login happening -TELNET_PORT - port to use, defaults to settings.TELNET_PORT -ACTIONS - see below

    +
      +
    • TIMESTEP - time in seconds between each ‘tick’

    • +
    • CHANCE_OF_ACTION - chance 0-1 of action happening

    • +
    • CHANCE_OF_LOGIN - chance 0-1 of login happening

    • +
    • TELNET_PORT - port to use, defaults to settings.TELNET_PORT

    • +
    • ACTIONS - see below

    • +

    ACTIONS is a tuple

    -

    (login_func, logout_func, (0.3, func1), (0.1, func2) … )

    +
    (login_func, logout_func, (0.3, func1), (0.1, func2) ... )
    +
    +

    where the first entry is the function to call on first connect, with a chance of occurring given by CHANCE_OF_LOGIN. This function is usually responsible for logging in the account. The second entry is always @@ -65,28 +69,22 @@ returns a string or a list of command strings to execute. Use the client object for optionally saving data between actions.

    The client object has the following relevant properties and methods:

      -
    • -
      key - an optional client key. This is only used for dummyrunner output.

      Default is “Dummy-<cid>”

      -
      -
      -
    • +
    • key - an optional client key. This is only used for dummyrunner output. +Default is “Dummy-<cid>”

    • cid - client id

    • gid - globally unique id, hashed with time stamp

    • istep - the current step

    • exits - an empty list. Can be used to store exit names

    • objs - an empty list. Can be used to store object names

    • -
    • -
      counter() - returns a unique increasing id, hashed with time stamp

      to make it unique also between dummyrunner instances.

      -
      -
      -
    • +
    • counter() - returns a unique increasing id, hashed with time stamp +to make it unique also between dummyrunner instances.

    The return should either be a single command string or a tuple of command strings. This list of commands will always be executed every TIMESTEP with a chance given by CHANCE_OF_ACTION by in the order given (no randomness) and allows for setting up a more complex chain of commands (such as creating an account and logging in).

    -

    +
    evennia.server.profiling.dummyrunner_settings.c_login(client)[source]
    diff --git a/docs/0.9.5/api/evennia.server.server.html b/docs/0.9.5/api/evennia.server.server.html index b1be222e92..505401017f 100644 --- a/docs/0.9.5/api/evennia.server.server.html +++ b/docs/0.9.5/api/evennia.server.server.html @@ -38,11 +38,11 @@

    evennia.server.server

    -

    This module implements the main Evennia server process, the core of -the game engine.

    -

    This module should be started with the ‘twistd’ executable since it -sets up all the networking features. (this is done automatically -by evennia/server/server_runner.py).

    +

    This module implements the main Evennia server process, the core of the game +engine.

    +

    This module should be started with the ‘twistd’ executable since it sets up all +the networking features. (this is done automatically by +evennia/server/server_runner.py).

    class evennia.server.server.Evennia(application)[source]
    @@ -99,20 +99,20 @@ Once finished the last_initial_setup_step is set to -1.

    shutdown(mode='reload', _reactor_stopping=False)[source]

    Shuts down the server from inside it.

    -
    -
    Keyword Arguments
    -
      -
    • mode (str) – Sets the server restart mode:

    • -
    • 'reload' (-) – server restarts, no “persistent” scripts +

      +
      mode - sets the server restart mode.
        +
      • ‘reload’ - server restarts, no “persistent” scripts are stopped, at_reload hooks called.

      • -
      • 'reset' - server restarts, non-persistent scripts stopped, (-) – at_shutdown hooks called but sessions will not +

      • ‘reset’ - server restarts, non-persistent scripts stopped, +at_shutdown hooks called but sessions will not be disconnected.

      • -
      • - like reset, but server will not auto-restart. (-'shutdown') –

      • -
      • _reactor_stopping – This is set if server is stopped by a kill -command OR this method was already called -once - in both cases the reactor is dead/stopping already.

      • +
      • ‘shutdown’ - like reset, but server will not auto-restart.

      +
      _reactor_stopping - this is set if server is stopped by a kill

      command OR this method was already called +once - in both cases the reactor is +dead/stopping already.

      +
    diff --git a/docs/0.9.5/api/evennia.server.serversession.html b/docs/0.9.5/api/evennia.server.serversession.html index bd1ae44a21..273211c3c3 100644 --- a/docs/0.9.5/api/evennia.server.serversession.html +++ b/docs/0.9.5/api/evennia.server.serversession.html @@ -43,126 +43,6 @@ a connection to the outside world but don’t know any details about how the connection actually happens (so it’s the same for telnet, web, ssh etc).

    It is stored on the Server side (as opposed to protocol-specific sessions which are stored on the Portal side)

    -
    -
    -class evennia.server.serversession.NDbHolder(obj, name, manager_name='attributes')[source]
    -

    Bases: object

    -

    Holder for allowing property access of attributes

    -
    -
    -__init__(obj, name, manager_name='attributes')[source]
    -

    Initialize self. See help(type(self)) for accurate signature.

    -
    - -
    -
    -get_all()[source]
    -
    - -
    -
    -property all
    -
    - -
    - -
    -
    -class evennia.server.serversession.NAttributeHandler(obj)[source]
    -

    Bases: object

    -

    NAttributeHandler version without recache protection. -This stand-alone handler manages non-database saving. -It is similar to AttributeHandler and is used -by the .ndb handler in the same way as .db does -for the AttributeHandler.

    -
    -
    -__init__(obj)[source]
    -

    Initialized on the object

    -
    - -
    -
    -has(key)[source]
    -

    Check if object has this attribute or not.

    -
    -
    Parameters
    -

    key (str) – The Nattribute key to check.

    -
    -
    Returns
    -

    has_nattribute (bool) – If Nattribute is set or not.

    -
    -
    -
    - -
    -
    -get(key, default=None)[source]
    -

    Get the named key value.

    -
    -
    Parameters
    -

    key (str) – The Nattribute key to get.

    -
    -
    Returns
    -

    the value of the Nattribute.

    -
    -
    -
    - -
    -
    -add(key, value)[source]
    -

    Add new key and value.

    -
    -
    Parameters
    -
      -
    • key (str) – The name of Nattribute to add.

    • -
    • value (any) – The value to store.

    • -
    -
    -
    -
    - -
    -
    -remove(key)[source]
    -

    Remove Nattribute from storage.

    -
    -
    Parameters
    -

    key (str) – The name of the Nattribute to remove.

    -
    -
    -
    - -
    -
    -clear()[source]
    -

    Remove all NAttributes from handler.

    -
    - -
    -
    -all(return_tuples=False)[source]
    -

    List the contents of the handler.

    -
    -
    Parameters
    -

    return_tuples (bool, optional) – Defines if the Nattributes -are returns as a list of keys or as a list of (key, value).

    -
    -
    Returns
    -

    nattributes (list)

    -
    -
    A list of keys [key, key, …] or a

    list of tuples [(key, value), …] depending on the -setting of return_tuples.

    -
    -
    -

    -
    -
    -
    - -
    -
    class evennia.server.serversession.ServerSession[source]
    @@ -183,6 +63,11 @@ through their session.

    property cmdset_storage
    +
    +
    +property id
    +
    +
    at_sync()[source]
    @@ -295,7 +180,7 @@ idle timers and command counters.

    Update the protocol_flags and sync them with Portal.

    Keyword Arguments
    -

    any – A key:value pair to set in the +

    protocol_flag (any) – A key and value to set in the protocol_flags dictionary.

    @@ -328,7 +213,7 @@ for the protocol(s).

    the respective inputfuncs.

    Keyword Arguments
    -

    any – Incoming data from protocol on +

    kwargs (any) – Incoming data from protocol on the form {“commandname”: ((args), {kwargs}),…}

    @@ -345,12 +230,12 @@ this data off to self.sessionhandler.call_inputfuncs(self, **kwargs)

    Wrapper to mimic msg() functionality of Objects and Accounts.

    Parameters
    -
      -
    • text (str) – String input.

    • -
    • kwargs (str or tuple) – Send-commands identified +

      text (str) – String input.

      +
      +
      Keyword Arguments
      +

      any (str or tuple) – Send-commands identified by their keys. Or “options”, carrying options -for the protocol(s).

    • -
    +for the protocol(s).

    diff --git a/docs/0.9.5/api/evennia.server.sessionhandler.html b/docs/0.9.5/api/evennia.server.sessionhandler.html index 0b5964ffcf..be28c169c7 100644 --- a/docs/0.9.5/api/evennia.server.sessionhandler.html +++ b/docs/0.9.5/api/evennia.server.sessionhandler.html @@ -41,8 +41,7 @@

    This module defines handlers for storing sessions when handles sessions of users connecting to the server.

    There are two similar but separate stores of sessions:

    -
    -
      +
      • ServerSessionHandler - this stores generic game sessions

        for the game. These sessions has no knowledge about how they are connected to the world.

        @@ -56,7 +55,6 @@ handle network communication but holds no game info.

      -
    class evennia.server.sessionhandler.DummySession[source]
    @@ -120,30 +118,22 @@ sessions in store.

    Parameters
    • session (Session) – The relevant session instance.

    • -
    • kwargs (dict) –

      send-instruction, with the keyword itself being the name -of the instruction (like “text”). Suitable values for each -keyword are:

      -
      arg                ->  [[arg], {}]
      -[args]             ->  [[args], {}]
      -{kwargs}           ->  [[], {kwargs}]
      -[args, {kwargs}]   ->  [[arg], {kwargs}]
      -[[args], {kwargs}] ->  [[args], {kwargs}]
      -
      -
      -

    • +
    • kwargs (dict) – of the instruction (like “text”). Suitable values for each +keyword are: +- arg -> [[arg], {}] +- [args] -> [[args], {}] +- {kwargs} -> [[], {kwargs}] +- [args, {kwargs}] -> [[arg], {kwargs}] +- [[args], {kwargs}] -> [[args], {kwargs}]

    Returns
    -

    kwargs (dict)

    -
    -
    A cleaned dictionary of cmdname:[[args],{kwargs}] pairs,

    where the keys, args and kwargs have all been converted to +

    kwargs (dict) – A cleaned dictionary of cmdname:[[args],{kwargs}] pairs, +where the keys, args and kwargs have all been converted to send-safe entities (strings or numbers), and inlinefuncs have been applied.

    -

    -
    -
    @@ -492,12 +482,13 @@ object.

    sessions_from_csessid(csessid)[source]

    Given a client identification hash (for session types that offer them) return all sessions with a matching hash.

    -
    -
    Parameters
    -

    csessid (str) – The session hash.

    +
    +
    Args

    csessid (str): The session hash.

    -
    Returns
    -

    sessions (list) – The sessions with matching .csessid, if any.

    +
    +
    +
    Returns
    +

    sessions (list) – The sessions with matching .csessid, if any.

    @@ -554,17 +545,17 @@ this class’ sessionhandler.call_inputfunc with the
    call_inputfuncs(session, **kwargs)[source]
    -

    Split incoming data into its inputfunc counterparts. -This should be called by the serversession.data_in -as sessionhandler.call_inputfunc(self, **kwargs).

    +

    Split incoming data into its inputfunc counterparts. This should be +called by the serversession.data_in as +sessionhandler.call_inputfunc(self, **kwargs).

    We also intercept OOB communication here.

    Parameters

    sessions (Session) – Session.

    Keyword Arguments
    -

    kwargs (any) – Incoming data from protocol on -the form {“commandname”: ((args), {kwargs}),…}

    +

    any (tuple) – Incoming data from protocol, each +on the form commandname=((args), {kwargs}).

    diff --git a/docs/0.9.5/api/evennia.server.signals.html b/docs/0.9.5/api/evennia.server.signals.html index ccf5929847..7ea4491ce3 100644 --- a/docs/0.9.5/api/evennia.server.signals.html +++ b/docs/0.9.5/api/evennia.server.signals.html @@ -38,22 +38,20 @@

    evennia.server.signals

    -

    This module brings Django Signals into Evennia. These are events that -can be subscribed to by importing a given Signal and using the -following code.

    -
    THIS_SIGNAL.connect(callback, sender_object**)
    +

    This module brings Django Signals into Evennia. These are events that can be +subscribed to by importing a given Signal and using the following code.

    +
    THIS_SIGNAL.connect(callback, sender_object)
     
    -

    When other code calls THIS_SIGNAL.send(sender, **kwargs), the callback -will be triggered.

    -

    Callbacks must be in the following format:

    +

    When other code calls THIS_SIGNAL.send(sender, **kwargs), the callback will +be triggered.

    +

    Callbacks must be on the following format:

    def my_callback(sender, **kwargs):
    -    ...
    +    # ...
     
    -

    This is used on top of hooks to make certain features easier to -add to contribs without necessitating a full takeover of hooks -that may be in high demand.

    +

    This is used on top of hooks to make certain features easier to add to contribs +without necessitating a full takeover of hooks that may be in high demand.

    diff --git a/docs/0.9.5/api/evennia.typeclasses.attributes.html b/docs/0.9.5/api/evennia.typeclasses.attributes.html index 0e87486a5c..4fd095d1b3 100644 --- a/docs/0.9.5/api/evennia.typeclasses.attributes.html +++ b/docs/0.9.5/api/evennia.typeclasses.attributes.html @@ -44,9 +44,9 @@ both pure-string values and pickled arbitrary data.

    the Attribute- and NickHandlers as well as the NAttributeHandler, which is a non-db version of Attributes.

    -
    -class evennia.typeclasses.attributes.Attribute(*args, **kwargs)[source]
    -

    Bases: evennia.utils.idmapper.models.SharedMemoryModel

    +
    +class evennia.typeclasses.attributes.IAttribute[source]
    +

    Bases: object

    Attributes are things that are specific to different types of objects. For example, a drink container needs to store its fill level, whereas an exit needs to store its open/closed/locked/unlocked state. These are done via @@ -81,6 +81,106 @@ attributes on the fly as we like.

    +

    This class is an API/Interface/Abstract base class; do not instantiate it directly.

    +
    +
    +locks[source]
    +
    + +
    +
    +property key
    +
    + +
    +
    +property strvalue
    +
    + +
    +
    +property category
    +
    + +
    +
    +property model
    +
    + +
    +
    +property attrtype
    +
    + +
    +
    +property date_created
    +
    + +
    +
    +property lock_storage
    +
    + +
    +
    +access(accessing_obj, access_type='read', default=False, **kwargs)[source]
    +

    Determines if another object has permission to access.

    +
    +
    Parameters
    +
      +
    • accessing_obj (object) – Entity trying to access this one.

    • +
    • access_type (str, optional) – Type of access sought, see +the lock documentation.

    • +
    • default (bool, optional) – What result to return if no lock +of access_type was found. The default, False, means a lockdown +policy, only allowing explicit access.

    • +
    • kwargs (any, optional) – Not used; here to make the API consistent with +other access calls.

    • +
    +
    +
    Returns
    +

    result (bool) – If the lock was passed or not.

    +
    +
    +
    + +
    + +
    +
    +class evennia.typeclasses.attributes.InMemoryAttribute(pk, **kwargs)[source]
    +

    Bases: evennia.typeclasses.attributes.IAttribute

    +

    This Attribute is used purely for NAttributes/NAttributeHandler. It has no database backend.

    +
    +
    +__init__(pk, **kwargs)[source]
    +

    Create an Attribute that exists only in Memory.

    +
    +
    Parameters
    +
      +
    • pk (int) – This is a fake ‘primary key’ / id-field. It doesn’t actually have to be unique, but is fed an +incrementing number from the InMemoryBackend by default. This is needed only so Attributes can be +sorted. Some parts of the API also see the lack of a .pk field as a sign that the Attribute was +deleted.

    • +
    • **kwargs – Other keyword arguments are used to construct the actual Attribute.

    • +
    +
    +
    +
    + +
    +
    +property value
    +
    + +
    + +
    +
    +class evennia.typeclasses.attributes.Attribute(*args, **kwargs)[source]
    +

    Bases: evennia.typeclasses.attributes.IAttribute, evennia.utils.idmapper.models.SharedMemoryModel

    +

    This attribute is stored via Django. Most Attributes will be using this class.

    db_key
    @@ -137,41 +237,6 @@ object the first time, the query is executed.

    object the first time, the query is executed.

    -
    -
    -locks[source]
    -
    - -
    -
    -property key
    -
    - -
    -
    -property strvalue
    -
    - -
    -
    -property category
    -
    - -
    -
    -property model
    -
    - -
    -
    -property attrtype
    -
    - -
    -
    -property date_created
    -
    -
    property lock_storage
    @@ -186,29 +251,6 @@ as storing a dbobj which is then deleted elsewhere) out-of-sync. The overhead of unpickling seems hard to avoid.

    -
    -
    -access(accessing_obj, access_type='attrread', default=False, **kwargs)[source]
    -

    Determines if another object has permission to access.

    -
    -
    Parameters
    -
      -
    • accessing_obj (object) – Entity trying to access this one.

    • -
    • access_type (str, optional) – Type of access sought, see -the lock documentation.

    • -
    • default (bool, optional) – What result to return if no lock -of access_type was found. The default, False, means a lockdown -policy, only allowing explicit access.

    • -
    • kwargs (any, optional) – Not used; here to make the API consistent with -other access calls.

    • -
    -
    -
    Returns
    -

    result (bool) – If the lock was passed or not.

    -
    -
    -
    -
    exception DoesNotExist
    @@ -237,6 +279,18 @@ instances.

    class built by **create_forward_many_to_many_manager()** defined below.

    +
    +
    +property attrtype
    +

    A wrapper for getting database field db_attrtype.

    +
    + +
    +
    +property category
    +

    A wrapper for getting database field db_category.

    +
    +
    channeldb_set
    @@ -253,6 +307,12 @@ instances.

    class built by **create_forward_many_to_many_manager()** defined below.

    +
    +
    +property date_created
    +

    A wrapper for getting database field db_date_created.

    +
    +
    get_next_by_db_date_created(*, field=<django.db.models.fields.DateTimeField: db_date_created>, is_next=True, **kwargs)
    @@ -270,6 +330,18 @@ class built by **create_forward_many_to_many_manager()** define object the first time, the query is executed.

    +
    +
    +property key
    +

    A wrapper for getting database field db_key.

    +
    + +
    +
    +property model
    +

    A wrapper for getting database field db_model.

    +
    +
    objectdb_set
    @@ -307,6 +379,12 @@ instances.

    class built by **create_forward_many_to_many_manager()** defined below.

    +
    +
    +property strvalue
    +

    A wrapper for getting database field db_strvalue.

    +
    +
    typename = 'SharedMemoryModelBase'
    @@ -314,21 +392,544 @@ class built by **create_forward_many_to_many_manager()** define
    +
    +
    +class evennia.typeclasses.attributes.IAttributeBackend(handler, attrtype)[source]
    +

    Bases: object

    +

    Abstract interface for the backends used by the Attribute Handler.

    +

    All Backends must implement this base class.

    +
    +
    +__init__(handler, attrtype)[source]
    +

    Initialize self. See help(type(self)) for accurate signature.

    +
    + +
    +
    +query_all()[source]
    +

    Fetch all Attributes from this object.

    +
    +
    Returns
    +

    attrlist (list) – A list of Attribute objects.

    +
    +
    +
    + +
    +
    +query_key(key, category)[source]
    +
    +
    Parameters
    +
      +
    • key (str) – The key of the Attribute being searched for.

    • +
    • category (str or None) – The category of the desired Attribute.

    • +
    +
    +
    Returns
    +

    attribute (IAttribute) – A single Attribute.

    +
    +
    +
    + +
    +
    +query_category(category)[source]
    +

    Returns every matching Attribute as a list, given a category.

    +

    This method calls up whatever storage the backend uses.

    +
    +
    Parameters
    +

    category (str or None) – The category to query.

    +
    +
    Returns
    +

    attrs (list) – The discovered Attributes.

    +
    +
    +
    + +
    +
    +get(key=None, category=None)[source]
    +

    Frontend for .get_cache. Retrieves Attribute(s).

    +
    +
    Parameters
    +
      +
    • key (str, optional) – Attribute key to query for

    • +
    • category (str, optional) – Attribiute category

    • +
    +
    +
    Returns
    +

    args (list)

    +
    +
    Returns a list of zero or more matches

    found from cache or database.

    +
    +
    +

    +
    +
    +
    + +
    +
    +reset_cache()[source]
    +

    Reset cache from the outside.

    +
    + +
    +
    +do_create_attribute(key, category, lockstring, value, strvalue)[source]
    +

    Does the hard work of actually creating Attributes, whatever is needed.

    +
    +
    Parameters
    +
      +
    • key (str) – The Attribute’s key.

    • +
    • category (str or None) – The Attribute’s category, or None

    • +
    • lockstring (str) – Any locks for the Attribute.

    • +
    • value (obj) – The Value of the Attribute.

    • +
    • strvalue (bool) – Signifies if this is a strvalue Attribute. Value MUST be a string or +this will lead to Trouble. Ignored for InMemory attributes.

    • +
    +
    +
    Returns
    +

    attr (IAttribute) – The new Attribute.

    +
    +
    +
    + +
    +
    +create_attribute(key, category, lockstring, value, strvalue=False, cache=True)[source]
    +

    Creates Attribute (using the class specified for the backend), (optionally) caches it, and returns it.

    +

    This MUST actively save the Attribute to whatever database backend is used, AND +call self.set_cache(key, category, new_attrobj)

    +
    +
    Parameters
    +
      +
    • key (str) – The Attribute’s key.

    • +
    • category (str or None) – The Attribute’s category, or None

    • +
    • lockstring (str) – Any locks for the Attribute.

    • +
    • value (obj) – The Value of the Attribute.

    • +
    • strvalue (bool) – Signifies if this is a strvalue Attribute. Value MUST be a string or +this will lead to Trouble. Ignored for InMemory attributes.

    • +
    • cache (bool) – Whether to cache the new Attribute

    • +
    +
    +
    Returns
    +

    attr (IAttribute) – The new Attribute.

    +
    +
    +
    + +
    +
    +do_update_attribute(attr, value)[source]
    +

    Simply sets a new Value to an Attribute.

    +
    +
    Parameters
    +
      +
    • attr (IAttribute) – The Attribute being changed.

    • +
    • value (obj) – The Value for the Attribute.

    • +
    +
    +
    +
    + +
    +
    +do_batch_update_attribute(attr_obj, category, lock_storage, new_value, strvalue)[source]
    +

    Called opnly by batch add. For the database backend, this is a method +of updating that can alter category and lock-storage.

    +
    +
    Parameters
    +
      +
    • attr_obj (IAttribute) – The Attribute being altered.

    • +
    • category (str or None) – The attribute’s (new) category.

    • +
    • lock_storage (str) – The attribute’s new locks.

    • +
    • new_value (obj) – The Attribute’s new value.

    • +
    • strvalue (bool) – Signifies if this is a strvalue Attribute. Value MUST be a string or +this will lead to Trouble. Ignored for InMemory attributes.

    • +
    +
    +
    +
    + +
    +
    +do_batch_finish(attr_objs)[source]
    +

    Called after batch_add completed. Used for handling database operations +and/or caching complications.

    +
    +
    Parameters
    +

    attr_objs (list of IAttribute) – The Attributes created/updated thus far.

    +
    +
    +
    + +
    +
    +batch_add(*args, **kwargs)[source]
    +

    Batch-version of .add(). This is more efficient than repeat-calling +.add when having many Attributes to add.

    +
    +
    Parameters
    +

    *args (tuple) –

    Tuples of varying length representing the +Attribute to add to this object. Supported tuples are

    +
      +
    • (key, value)

    • +
    • (key, value, category)

    • +
    • (key, value, category, lockstring)

    • +
    • (key, value, category, lockstring, default_access)

    • +
    +

    +
    +
    Raises
    +

    RuntimeError – If trying to pass a non-iterable as argument.

    +
    +
    +

    Notes

    +

    The indata tuple order matters, so if you want a lockstring but no +category, set the category to None. This method does not have the +ability to check editing permissions and is mainly used internally. +It does not use the normal self.add but applies the Attributes +directly to the database.

    +
    + +
    +
    +do_delete_attribute(attr)[source]
    +

    Does the hard work of actually deleting things.

    +
    +
    Parameters
    +

    attr (IAttribute) – The attribute to delete.

    +
    +
    +
    + +
    +
    +delete_attribute(attr)[source]
    +

    Given an Attribute, deletes it. Also remove it from cache.

    +
    +
    Parameters
    +

    attr (IAttribute) – The attribute to delete.

    +
    +
    +
    + +
    +
    +update_attribute(attr, value)[source]
    +

    Simply updates an Attribute.

    +
    +
    Parameters
    +
      +
    • attr (IAttribute) – The attribute to delete.

    • +
    • value (obj) – The new value.

    • +
    +
    +
    +
    + +
    +
    +do_batch_delete(attribute_list)[source]
    +

    Given a list of attributes, deletes them all. +The default implementation is fine, but this is overridable since some databases may allow +for a better method.

    +
    +
    Parameters
    +

    attribute_list (list of IAttribute) –

    +
    +
    +
    + +
    +
    +clear_attributes(category, accessing_obj, default_access)[source]
    +

    Remove all Attributes on this object.

    +
    +
    Parameters
    +
      +
    • category (str, optional) – If given, clear only Attributes +of this category.

    • +
    • accessing_obj (object, optional) – If given, check the +attredit lock on each Attribute before continuing.

    • +
    • default_access (bool, optional) – Use this permission as +fallback if access_obj is given but there is no lock of +type attredit on the Attribute in question.

    • +
    +
    +
    +
    + +
    +
    +get_all_attributes()[source]
    +

    Simply returns all Attributes of this object, sorted by their IDs.

    +
    +
    Returns
    +

    attributes (list of IAttribute)

    +
    +
    +
    + +
    + +
    +
    +class evennia.typeclasses.attributes.InMemoryAttributeBackend(handler, attrtype)[source]
    +

    Bases: evennia.typeclasses.attributes.IAttributeBackend

    +

    This Backend for Attributes stores NOTHING in the database. Everything is kept in memory, and normally lost +on a crash, reload, shared memory flush, etc. It generates IDs for the Attributes it manages, but these are +of little importance beyond sorting and satisfying the caching logic to know an Attribute hasn’t been +deleted out from under the cache’s nose.

    +
    +
    +__init__(handler, attrtype)[source]
    +

    Initialize self. See help(type(self)) for accurate signature.

    +
    + +
    +
    +query_all()[source]
    +

    Fetch all Attributes from this object.

    +
    +
    Returns
    +

    attrlist (list) – A list of Attribute objects.

    +
    +
    +
    + +
    +
    +query_key(key, category)[source]
    +
    +
    Parameters
    +
      +
    • key (str) – The key of the Attribute being searched for.

    • +
    • category (str or None) – The category of the desired Attribute.

    • +
    +
    +
    Returns
    +

    attribute (IAttribute) – A single Attribute.

    +
    +
    +
    + +
    +
    +query_category(category)[source]
    +

    Returns every matching Attribute as a list, given a category.

    +

    This method calls up whatever storage the backend uses.

    +
    +
    Parameters
    +

    category (str or None) – The category to query.

    +
    +
    Returns
    +

    attrs (list) – The discovered Attributes.

    +
    +
    +
    + +
    +
    +do_create_attribute(key, category, lockstring, value, strvalue)[source]
    +

    See parent class.

    +

    strvalue has no meaning for InMemory attributes.

    +
    + +
    +
    +do_update_attribute(attr, value)[source]
    +

    Simply sets a new Value to an Attribute.

    +
    +
    Parameters
    +
      +
    • attr (IAttribute) – The Attribute being changed.

    • +
    • value (obj) – The Value for the Attribute.

    • +
    +
    +
    +
    + +
    +
    +do_batch_update_attribute(attr_obj, category, lock_storage, new_value, strvalue)[source]
    +

    No need to bother saving anything. Just set some values.

    +
    + +
    +
    +do_batch_finish(attr_objs)[source]
    +

    Nothing to do here for In-Memory.

    +
    +
    Parameters
    +

    attr_objs (list of IAttribute) – The Attributes created/updated thus far.

    +
    +
    +
    + +
    +
    +do_delete_attribute(attr)[source]
    +

    Removes the Attribute from local storage. Once it’s out of the cache, garbage collection will handle the rest.

    +
    +
    Parameters
    +

    attr (IAttribute) – The attribute to delete.

    +
    +
    +
    + +
    + +
    +
    +class evennia.typeclasses.attributes.ModelAttributeBackend(handler, attrtype)[source]
    +

    Bases: evennia.typeclasses.attributes.IAttributeBackend

    +

    Uses Django models for storing Attributes.

    +
    +
    +__init__(handler, attrtype)[source]
    +

    Initialize self. See help(type(self)) for accurate signature.

    +
    + +
    +
    +query_all()[source]
    +

    Fetch all Attributes from this object.

    +
    +
    Returns
    +

    attrlist (list) – A list of Attribute objects.

    +
    +
    +
    + +
    +
    +query_key(key, category)[source]
    +
    +
    Parameters
    +
      +
    • key (str) – The key of the Attribute being searched for.

    • +
    • category (str or None) – The category of the desired Attribute.

    • +
    +
    +
    Returns
    +

    attribute (IAttribute) – A single Attribute.

    +
    +
    +
    + +
    +
    +query_category(category)[source]
    +

    Returns every matching Attribute as a list, given a category.

    +

    This method calls up whatever storage the backend uses.

    +
    +
    Parameters
    +

    category (str or None) – The category to query.

    +
    +
    Returns
    +

    attrs (list) – The discovered Attributes.

    +
    +
    +
    + +
    +
    +do_create_attribute(key, category, lockstring, value, strvalue)[source]
    +

    Does the hard work of actually creating Attributes, whatever is needed.

    +
    +
    Parameters
    +
      +
    • key (str) – The Attribute’s key.

    • +
    • category (str or None) – The Attribute’s category, or None

    • +
    • lockstring (str) – Any locks for the Attribute.

    • +
    • value (obj) – The Value of the Attribute.

    • +
    • strvalue (bool) – Signifies if this is a strvalue Attribute. Value MUST be a string or +this will lead to Trouble. Ignored for InMemory attributes.

    • +
    +
    +
    Returns
    +

    attr (IAttribute) – The new Attribute.

    +
    +
    +
    + +
    +
    +do_update_attribute(attr, value)[source]
    +

    Simply sets a new Value to an Attribute.

    +
    +
    Parameters
    +
      +
    • attr (IAttribute) – The Attribute being changed.

    • +
    • value (obj) – The Value for the Attribute.

    • +
    +
    +
    +
    + +
    +
    +do_batch_update_attribute(attr_obj, category, lock_storage, new_value, strvalue)[source]
    +

    Called opnly by batch add. For the database backend, this is a method +of updating that can alter category and lock-storage.

    +
    +
    Parameters
    +
      +
    • attr_obj (IAttribute) – The Attribute being altered.

    • +
    • category (str or None) – The attribute’s (new) category.

    • +
    • lock_storage (str) – The attribute’s new locks.

    • +
    • new_value (obj) – The Attribute’s new value.

    • +
    • strvalue (bool) – Signifies if this is a strvalue Attribute. Value MUST be a string or +this will lead to Trouble. Ignored for InMemory attributes.

    • +
    +
    +
    +
    + +
    +
    +do_batch_finish(attr_objs)[source]
    +

    Called after batch_add completed. Used for handling database operations +and/or caching complications.

    +
    +
    Parameters
    +

    attr_objs (list of IAttribute) – The Attributes created/updated thus far.

    +
    +
    +
    + +
    +
    +do_delete_attribute(attr)[source]
    +

    Does the hard work of actually deleting things.

    +
    +
    Parameters
    +

    attr (IAttribute) – The attribute to delete.

    +
    +
    +
    + +
    +
    -class evennia.typeclasses.attributes.AttributeHandler(obj)[source]
    +class evennia.typeclasses.attributes.AttributeHandler(obj, backend_class)[source]

    Bases: object

    Handler for adding Attributes to the object.

    -__init__(obj)[source]
    -

    Initialize handler.

    -
    - -
    -
    -reset_cache()[source]
    -

    Reset cache from the outside.

    +__init__(obj, backend_class)[source] +

    Setup the AttributeHandler.

    +
    +
    Parameters
    +
      +
    • obj (TypedObject) – An Account, Object, Channel, ServerSession (not technically a typed object), etc.

    • +
    • backend_class (IAttributeBackend class) – The class of the backend to use.

    • +
    +
    +
    @@ -443,14 +1044,12 @@ repeat-calling add when having many Attributes to add.

    *args (tuple) –

    Each argument should be a tuples (can be of varying length) representing the Attribute to add to this object. Supported tuples are

    -
    -
      -
    • (key, value)

    • -
    • (key, value, category)

    • -
    • (key, value, category, lockstring)

    • -
    • (key, value, category, lockstring, default_access)

    • +
        +
      • (key, value)

      • +
      • (key, value, category)

      • +
      • (key, value, category, lockstring)

      • +
      • (key, value, category, lockstring, default_access)

      -

    Keyword Arguments
    @@ -549,6 +1148,34 @@ Attributes has no lock of type attrread defined on them.

    +
    +
    +reset_cache()[source]
    +
    + +
    + +
    +
    +class evennia.typeclasses.attributes.DbHolder(obj, name, manager_name='attributes')[source]
    +

    Bases: object

    +

    Holder for allowing property access of attributes

    +
    +
    +__init__(obj, name, manager_name='attributes')[source]
    +

    Initialize self. See help(type(self)) for accurate signature.

    +
    + +
    +
    +get_all()[source]
    +
    + +
    +
    +property all
    +
    +
    @@ -570,17 +1197,15 @@ matched by the in_template.

    Returns
    -

    (regex, str)

    -
    -
    Regex to match against strings and a template

    Template with markers {arg1}, {arg2}, etc for -replacement using the standard .format method.

    -
    -
    -

    +

    regex (regex) – Regex to match against strings +template (str): Template with markers **{arg1}, {arg2}**, etc for +replacement using the standard .format method.

    Raises
    -

    attributes.NickTemplateInvalid – If the in/out template does not have a matching -number of $args.

    +
      +
    • evennia.typecalasses.attributes.NickTemplateInvalid – If the in/out

    • +
    • template does not have a matching number of $args.

    • +
    @@ -613,7 +1238,15 @@ They also always use the strvalue fields for their data.

    __init__(*args, **kwargs)[source]
    -

    Initialize handler.

    +

    Setup the AttributeHandler.

    +
    +
    Parameters
    +
      +
    • obj (TypedObject) – An Account, Object, Channel, ServerSession (not technically a typed object), etc.

    • +
    • backend_class (IAttributeBackend class) – The class of the backend to use.

    • +
    +
    +
    @@ -726,102 +1359,6 @@ with nicks stored on the Account level.

    -
    -
    -class evennia.typeclasses.attributes.NAttributeHandler(obj)[source]
    -

    Bases: object

    -

    This stand-alone handler manages non-database saving. -It is similar to AttributeHandler and is used -by the .ndb handler in the same way as .db does -for the AttributeHandler.

    -
    -
    -__init__(obj)[source]
    -

    Initialized on the object

    -
    - -
    -
    -has(key)[source]
    -

    Check if object has this attribute or not.

    -
    -
    Parameters
    -

    key (str) – The Nattribute key to check.

    -
    -
    Returns
    -

    has_nattribute (bool) – If Nattribute is set or not.

    -
    -
    -
    - -
    -
    -get(key)[source]
    -

    Get the named key value.

    -
    -
    Parameters
    -

    key (str) – The Nattribute key to get.

    -
    -
    Returns
    -

    the value of the Nattribute.

    -
    -
    -
    - -
    -
    -add(key, value)[source]
    -

    Add new key and value.

    -
    -
    Parameters
    -
      -
    • key (str) – The name of Nattribute to add.

    • -
    • value (any) – The value to store.

    • -
    -
    -
    -
    - -
    -
    -remove(key)[source]
    -

    Remove Nattribute from storage.

    -
    -
    Parameters
    -

    key (str) – The name of the Nattribute to remove.

    -
    -
    -
    - -
    -
    -clear()[source]
    -

    Remove all NAttributes from handler.

    -
    - -
    -
    -all(return_tuples=False)[source]
    -

    List the contents of the handler.

    -
    -
    Parameters
    -

    return_tuples (bool, optional) – Defines if the Nattributes -are returns as a list of keys or as a list of (key, value).

    -
    -
    Returns
    -

    nattributes (list)

    -
    -
    A list of keys [key, key, …] or a

    list of tuples [(key, value), …] depending on the -setting of return_tuples.

    -
    -
    -

    -
    -
    -
    - -
    - diff --git a/docs/0.9.5/api/evennia.typeclasses.managers.html b/docs/0.9.5/api/evennia.typeclasses.managers.html index 48f78e4f9a..988dd8293f 100644 --- a/docs/0.9.5/api/evennia.typeclasses.managers.html +++ b/docs/0.9.5/api/evennia.typeclasses.managers.html @@ -49,15 +49,13 @@ all Attributes and TypedObjects).

    get_attribute(key=None, category=None, value=None, strvalue=None, obj=None, attrtype=None, **kwargs)[source]
    -

    Return Attribute objects by key, by category, by value, by -strvalue, by object (it is stored on) or with a combination of -those criteria.

    +

    Return Attribute objects by key, by category, by value, by strvalue, by +object (it is stored on) or with a combination of those criteria.

    Parameters
      -
    • key (str, optional) – The attribute’s key to search for.

    • -
    • category (str, optional) – The category of the attribute(s) -to search for.

    • +
    • key (str, optional) – The attribute’s key to search for

    • +
    • category (str, optional) – The category of the attribute(s) to search for.

    • value (str, optional) – The attribute value to search for. Note that this is not a very efficient operation since it will query for a pickled entity. Mutually exclusive to @@ -68,14 +66,14 @@ mutually exclusive to the value keyword and will take precedence if given.

    • obj (Object, optional) – On which object the Attribute to search for is.

    • -
    • attrtype (str, optional) – An attribute-type to search for. +

    • attrype (str, optional) – An attribute-type to search for. By default this is either None (normal Attributes) or “nick”.

    • -
    • kwargs (any) – Currently unused. Reserved for future use.

    • +
    • **kwargs (any) – Currently unused. Reserved for future use.

    Returns
    -

    attributes (list) – The matching Attributes.

    +

    list – The matching Attributes.

    @@ -167,7 +165,7 @@ stored on) or with a combination of those criteria.

    to search for.

  • obj (Object, optional) – On which object the Tag to search for is.

  • -
  • tagtype (str, optional) – One of None (normal tags), +

  • tagtype (str, optional) – One of None (normal tags), “alias” or “permission”

  • global_search (bool, optional) – Include all possible tags, not just tags on this object

  • diff --git a/docs/0.9.5/api/evennia.typeclasses.models.html b/docs/0.9.5/api/evennia.typeclasses.models.html index dfa7cdfde4..ed4fefd8ed 100644 --- a/docs/0.9.5/api/evennia.typeclasses.models.html +++ b/docs/0.9.5/api/evennia.typeclasses.models.html @@ -59,7 +59,6 @@ The admin should usually not have to deal directly with the database object layer.

    This module also contains the Managers for the respective models; inherit from these to create custom managers.

    -
    class evennia.typeclasses.models.TypedObject(*args, **kwargs)[source]
    @@ -158,10 +157,10 @@ a class based on the db_typeclass_path database field rather than use the one in the model.

    Parameters
    -
      -
    • *args – Passed through to parent.

    • -
    • **kwargs – Passed through to parent.

    • -
    +

    through to parent. (Passed) –

    +
    +
    Keyword Arguments
    +

    through to parent. (Passed) –

    Notes

    @@ -367,7 +366,7 @@ superuser lock bypass (be careful with this one).

    Keyword Arguments
    -

    kwargs (any) – Ignored, but is there to make the api +

    kwar (any) – Ignored, but is there to make the api consistent with the object-typeclass method access, which use it to feed to its hook methods.

    @@ -400,36 +399,30 @@ without involving any locks.

    property db

    Attribute handler wrapper. Allows for the syntax

    obj.db.attrname = value
    -  and
    +# and
     value = obj.db.attrname
    -  and
    +# and
     del obj.db.attrname
    -  and
    +# and
     all_attr = obj.db.all()
    +# (unless there is an attribute
    +#  named 'all', in which case that will be returned instead).
     
    -

    (unless there is an attribute named ‘all’, in which case that will be -returned instead).

    property ndb
    -

    A non-attr_obj store (NonDataBase). Everything stored to this is -guaranteed to be cleared when a server is shutdown. Syntax is same as -for the .db property, e.g.

    -
    obj.ndb.attrname = value
    -  and
    -value = obj.ndb.attrname
    -  and
    -del obj.ndb.attrname
    -  and
    -all_attr = obj.ndb.all()
    -
    -
    -

    What makes this preferable over just assigning properties directly on -the object is that Evennia can track caching for these properties and -for example avoid wiping objects with set .ndb data on cache flushes.

    +

    NonDataBase). Everything stored +to this is guaranteed to be cleared when a server is shutdown. +Syntax is same as for the _get_db_holder() method and +property, e.g. obj.ndb.attr = value etc.

    +
    +
    Type
    +

    A non-attr_obj store (ndb

    +
    +
    @@ -516,27 +509,22 @@ at/getting information for this object.

    classmethod web_get_create_url()[source]

    Returns the URI path for a View that allows users to create new instances of this object.

    +

    ex. Chargen = ‘/characters/create/’

    +

    For this to work, the developer must have defined a named view somewhere +in urls.py that follows the format ‘modelname-action’, so in this case +a named view of ‘character-create’ would be referenced by this method.

    +

    ex. +url(r’characters/create/’, ChargenView.as_view(), name=’character-create’)

    +

    If no View has been created and defined in urls.py, returns an +HTML anchor.

    +

    This method is naive and simply returns a path. Securing access to +the actual view and limiting who can create new objects is the +developer’s responsibility.

    Returns

    path (str) – URI path to object creation page, if defined.

    -

    Examples

    -
    Chargen = '/characters/create/'
    -
    -
    -

    For this to work, the developer must have defined a named view somewhere -in urls.py that follows the format ‘modelname-action’, so in this case -a named view of ‘character-create’ would be referenced by this method.

    -
    url(r'characters/create/', ChargenView.as_view(), name='character-create')
    -
    -
    -

    If no View has been created and defined in urls.py, returns an -HTML anchor.

    -

    Notes

    -

    This method is naive and simply returns a path. Securing access to -the actual view and limiting who can create new objects is the -developer’s responsibility.

    @@ -556,12 +544,12 @@ this object.

    For this to work, the developer must have defined a named view somewhere in urls.py that follows the format ‘modelname-action’, so in this case a named view of ‘character-detail’ would be referenced by this method.

    -
    CharDetailView.as_view(), name='character-detail')
    +
    url(r'characters/(?P<slug>[\w\d\-]+)/(?P<pk>[0-9]+)/$',
    +    CharDetailView.as_view(), name='character-detail')
     

    If no View has been created and defined in urls.py, returns an HTML anchor.

    -

    Notes

    This method is naive and simply returns a path. Securing access to the actual view and limiting who can view this object is the developer’s responsibility.

    @@ -574,7 +562,7 @@ developer’s responsibility.

    object.

    Returns
    -

    path (str) – URI path to object puppet page, if defined.

    +

    str – URI path to object puppet page, if defined.

    Examples

    @@ -590,7 +578,6 @@ a named view of ‘character-puppet’ would be referenced by this method.

    If no View has been created and defined in urls.py, returns an HTML anchor.

    -

    Notes

    This method is naive and simply returns a path. Securing access to the actual view and limiting who can view this object is the developer’s responsibility.

    @@ -603,7 +590,7 @@ responsibility.

    object.

    Returns
    -

    path (str) – URI path to object update page, if defined.

    +

    str – URI path to object update page, if defined.

    Examples

    @@ -619,7 +606,6 @@ a named view of ‘character-update’ would be referenced by this method.

    If no View has been created and defined in urls.py, returns an HTML anchor.

    -

    Notes

    This method is naive and simply returns a path. Securing access to the actual view and limiting who can modify objects is the developer’s responsibility.

    @@ -638,19 +624,19 @@ responsibility.

    Oscar (Character) = '/characters/oscar/1/delete/'
     
    -

    For this to work, the developer must have defined a named view somewhere -in urls.py that follows the format ‘modelname-action’, so in this case -a named view of ‘character-detail’ would be referenced by this method.

    +

    For this to work, the developer must have defined a named view +somewhere in urls.py that follows the format ‘modelname-action’, so +in this case a named view of ‘character-detail’ would be referenced +by this method.

    url(r'characters/(?P<slug>[\w\d\-]+)/(?P<pk>[0-9]+)/delete/$',
         CharDeleteView.as_view(), name='character-delete')
     
    -

    If no View has been created and defined in urls.py, returns an -HTML anchor.

    -

    Notes

    +

    If no View has been created and defined in urls.py, returns an HTML +anchor.

    This method is naive and simply returns a path. Securing access to -the actual view and limiting who can delete this object is the developer’s -responsibility.

    +the actual view and limiting who can delete this object is the +developer’s responsibility.

    @@ -676,12 +662,12 @@ this object.

    For this to work, the developer must have defined a named view somewhere in urls.py that follows the format ‘modelname-action’, so in this case a named view of ‘character-detail’ would be referenced by this method.

    -
    CharDetailView.as_view(), name='character-detail')
    +
    url(r'characters/(?P<slug>[\w\d\-]+)/(?P<pk>[0-9]+)/$',
    +    CharDetailView.as_view(), name='character-detail')
     

    If no View has been created and defined in urls.py, returns an HTML anchor.

    -

    Notes

    This method is naive and simply returns a path. Securing access to the actual view and limiting who can view this object is the developer’s responsibility.

    diff --git a/docs/0.9.5/api/evennia.typeclasses.tags.html b/docs/0.9.5/api/evennia.typeclasses.tags.html index e4c99d30e6..9ed3374673 100644 --- a/docs/0.9.5/api/evennia.typeclasses.tags.html +++ b/docs/0.9.5/api/evennia.typeclasses.tags.html @@ -269,6 +269,33 @@ existing Tag object, this will be re-used and no new Tag will be created.

    +
    +
    +has(tag=None, category=None, return_list=False)[source]
    +

    Checks if the given Tag (or list of Tags) exists on the object.

    +
    +
    Parameters
    +
      +
    • tag (str or iterable) – The Tag key or tags to check for. +If None, search by category.

    • +
    • category (str, optional) – Limit the check to Tags with this +category (note, that None is the default category).

    • +
    +
    +
    Returns
    +

    has_tag (bool or list)

    +
    +
    If the Tag exists on this object or not.

    If tag was given as an iterable then the return is a list of booleans.

    +
    +
    +

    +
    +
    Raises
    +

    ValueError – If neither tag nor category is given.

    +
    +
    +
    +
    get(key=None, default=None, category=None, return_tagobj=False, return_list=False)[source]
    diff --git a/docs/0.9.5/api/evennia.utils.ansi.html b/docs/0.9.5/api/evennia.utils.ansi.html index f91da60e6b..b5d17cab10 100644 --- a/docs/0.9.5/api/evennia.utils.ansi.html +++ b/docs/0.9.5/api/evennia.utils.ansi.html @@ -39,24 +39,25 @@

    evennia.utils.ansi

    ANSI - Gives colour to text.

    -

    Use the codes defined in ANSIPARSER in your text to apply colour to text -according to the ANSI standard.

    -
    This is |rRed text|n and this is normal again.
    +

    Use the codes defined in ANSIPARSER in your text +to apply colour to text according to the ANSI standard.

    +

    Examples:

    +
    "This is |rRed text|n and this is normal again."
     
    -

    Mostly you should not need to call parse_ansi() explicitly; it is run by -Evennia just before returning data to/from the user. Depreciated/decativated -example forms are available in contribs by extending the ansi mapping

    -

    This module also contains the ANSIString custom string-type, which correctly -wraps/manipulates and tracks lengths of strings containing ANSI-markup.

    -
    +

    Mostly you should not need to call parse_ansi() explicitly; +it is run by Evennia just before returning data to/from the +user. Depreciated example forms are available by extending +the ansi mapping.

    class evennia.utils.ansi.ANSIParser[source]

    Bases: object

    -

    A class that parses ANSI markup to ANSI command sequences

    -

    We also allow to escape colour codes by prepending with -an extra |, so ||r will literally print |r.

    +

    A class that parses ANSI markup +to ANSI command sequences

    +

    We also allow to escape colour codes +by prepending with a for xterm256, +an extra | for Merc-style codes

    ansi_map = [('|n', '\x1b[0m'), ('|/', '\r\n'), ('|-', '\t'), ('|_', ' '), ('|*', '\x1b[7m'), ('|^', '\x1b[5m'), ('|u', '\x1b[4m'), ('|r', '\x1b[1m\x1b[31m'), ('|g', '\x1b[1m\x1b[32m'), ('|y', '\x1b[1m\x1b[33m'), ('|b', '\x1b[1m\x1b[34m'), ('|m', '\x1b[1m\x1b[35m'), ('|c', '\x1b[1m\x1b[36m'), ('|w', '\x1b[1m\x1b[37m'), ('|x', '\x1b[1m\x1b[30m'), ('|R', '\x1b[22m\x1b[31m'), ('|G', '\x1b[22m\x1b[32m'), ('|Y', '\x1b[22m\x1b[33m'), ('|B', '\x1b[22m\x1b[34m'), ('|M', '\x1b[22m\x1b[35m'), ('|C', '\x1b[22m\x1b[36m'), ('|W', '\x1b[22m\x1b[37m'), ('|X', '\x1b[22m\x1b[30m'), ('|h', '\x1b[1m'), ('|H', '\x1b[22m'), ('|!R', '\x1b[31m'), ('|!G', '\x1b[32m'), ('|!Y', '\x1b[33m'), ('|!B', '\x1b[34m'), ('|!M', '\x1b[35m'), ('|!C', '\x1b[36m'), ('|!W', '\x1b[37m'), ('|!X', '\x1b[30m'), ('|[R', '\x1b[41m'), ('|[G', '\x1b[42m'), ('|[Y', '\x1b[43m'), ('|[B', '\x1b[44m'), ('|[M', '\x1b[45m'), ('|[C', '\x1b[46m'), ('|[W', '\x1b[47m'), ('|[X', '\x1b[40m')]
    @@ -417,15 +418,9 @@ occurrence of the separator rather than the first.

    Returns
    -

    result (tuple)

    -
      -
    • prefix (ANSIString): The part of the string before the -separator

    • -
    • sep (ANSIString): The separator itself

    • -
    • postfix (ANSIString): The part of the string after the -separator.

    • -
    -

    +

    ANSIString – The part of the string before the separator +ANSIString: The separator itself +ANSIString: The part of the string after the separator.

    @@ -771,12 +766,15 @@ left untouched. Characters mapped to None are deleted.

    join(iterable)[source]

    Joins together strings in an iterable, using this string between each one.

    +

    NOTE: This should always be used for joining strings when ANSIStrings +are involved. Otherwise color information will be discarded by python, +due to details in the C implementation of strings.

    Parameters

    iterable (list of strings) – A list of strings to join together

    Returns
    -

    result (ANSIString)

    +

    ANSIString

    A single string with all of the iterable’s

    contents concatenated, with this string between each.

    @@ -785,18 +783,10 @@ one.

    Examples

    -
    -
    ::

    ANSIString(‘, ‘).join([‘up’, ‘right’, ‘left’, ‘down’])

    -
    -
    -

    Would return

    -
    ANSIString('up, right, left, down')
    +
    >>> ANSIString(', ').join(['up', 'right', 'left', 'down'])
    +ANSIString('up, right, left, down')
     
    -

    Notes

    -

    This should always be used for joining strings when ANSIStrings are -involved. Otherwise color information will be discarded by python, -due to details in the C implementation of strings.

    diff --git a/docs/0.9.5/api/evennia.utils.batchprocessors.html b/docs/0.9.5/api/evennia.utils.batchprocessors.html index 234417375c..9e95cd1f19 100644 --- a/docs/0.9.5/api/evennia.utils.batchprocessors.html +++ b/docs/0.9.5/api/evennia.utils.batchprocessors.html @@ -39,23 +39,21 @@

    evennia.utils.batchprocessors

    This module contains the core methods for the Batch-command- and -Batch-code-processors respectively. In short, these are two different -ways to build a game world using a normal text-editor without having -to do so ‘on the fly’ in-game. They also serve as an automatic backup -so you can quickly recreate a world also after a server reset. The -functions in this module is meant to form the backbone of a system -called and accessed through game commands.

    -

    The Batch-command processor is the simplest. It simply runs a list of -in-game commands in sequence by reading them from a text file. The -advantage of this is that the builder only need to remember the normal -in-game commands. They are also executing with full permission checks -etc, making it relatively safe for builders to use. The drawback is -that in-game there is really a builder-character walking around -building things, and it can be important to create rooms and objects -in the right order, so the character can move between them. Also -objects that affects players (such as mobs, dark rooms etc) will -affect the building character too, requiring extra care to turn -off/on.

    +Batch-code-processors respectively. In short, these are two different ways to +build a game world using a normal text-editor without having to do so ‘on the +fly’ in-game. They also serve as an automatic backup so you can quickly +recreate a world also after a server reset. The functions in this module is +meant to form the backbone of a system called and accessed through game +commands.

    +

    The Batch-command processor is the simplest. It simply runs a list of in-game +commands in sequence by reading them from a text file. The advantage of this is +that the builder only need to remember the normal in-game commands. They are +also executing with full permission checks etc, making it relatively safe for +builders to use. The drawback is that in-game there is really a +builder-character walking around building things, and it can be important to +create rooms and objects in the right order, so the character can move between +them. Also objects that affects players (such as mobs, dark rooms etc) will +affect the building character too, requiring extra care to turn off/on.

    The Batch-code processor is a more advanced system that accepts full Python code, executing in chunks. The advantage of this is much more power; practically anything imaginable can be coded and handled using @@ -68,33 +66,38 @@ etc. You also need to know Python and Evennia’s API. Hence it’s recommended that the batch-code processor is limited only to superusers or highly trusted staff.

    -

    Batch-Command processor file syntax

    +

    Batch-command processor file syntax

    The batch-command processor accepts ‘batchcommand files’ e.g batch.ev, containing a sequence of valid Evennia commands in a simple format. The engine runs each command in sequence, as if they had been run at the game prompt.

    Each Evennia command must be delimited by a line comment to mark its -end. This way entire game worlds can be created and planned offline; it is +end.

    +
    look
    +# delimiting comment
    +create/drop box
    +# another required comment
    +
    +
    +

    One can also inject another batchcmdfile:

    +
    #INSERT path.batchcmdfile
    +
    +
    +

    This way entire game worlds can be created and planned offline; it is especially useful in order to create long room descriptions where a real offline text editor is often much better than any online text editor or prompt.

    -

    There is only one batchcommand-specific entry to use in a batch-command -files (all others are just like in-game commands):

    -
      -
    • #INSERT path.batchcmdfile - this as the first entry on a line will -import and run a batch.ev file in this position, as if it was -written in this file.

    • -
    -

    Example of batch.ev file:

    +
    +

    Example of batch.ev file:

    # batch file
     # all lines starting with # are comments; they also indicate
     # that a command definition is over.
     
    -@create box
    +create box
     
     # this comment ends the @create command.
     
    -@set box/desc = A large box.
    +set box/desc = A large box.
     
     Inside are some scattered piles of clothing.
     
    @@ -107,24 +110,25 @@ written in this file.

    # (so two empty lines becomes a new paragraph). -@teleport #221 +teleport #221 # (Assuming #221 is a warehouse or something.) # (remember, this comment ends the @teleport command! Don'f forget it) # Example of importing another file at this point. -#INSERT examples.batch +#IMPORT examples.batch -@drop box +drop box # Done, the box is in the warehouse! (this last comment is not necessary to -# close the @drop command since it's the end of the file) +# close the drop command since it's the end of the file)

    An example batch file is contrib/examples/batch_example.ev.

    +
    -

    Batch-Code processor file syntax

    +

    Batch-code processor file syntax

    The Batch-code processor accepts full python modules (e.g. batch.py) that looks identical to normal Python files. The difference from importing and running any Python module is that the batch-code module @@ -155,13 +159,17 @@ this file.

    Importing works as normal. The following variables are automatically made available in the script namespace.

      -
    • caller - The object executing the batchscript

    • -
    • DEBUG - This is a boolean marking if the batchprocessor is running -in debug mode. It can be checked to e.g. delete created objects +

    • caller - The object executing the batchscript

    • +
    • +
      DEBUG - This is a boolean marking if the batchprocessor is running

      in debug mode. It can be checked to e.g. delete created objects when running a CODE block multiple times during testing. -(avoids creating a slew of same-named db objects)

    • +(avoids creating a slew of same-named db objects)

      + +
    + -

    Example batch.py file:

    +
    +

    Example batch.py file

    #HEADER
     
     from django.conf import settings
    @@ -189,7 +197,6 @@ when running a CODE block multiple times during testing.
     script = create.create_script()
     
    -
    evennia.utils.batchprocessors.read_batchfile(pythonpath, file_ending='.py')[source]
    @@ -206,7 +213,7 @@ or .py). The ending should not be included in the python path.

    Returns
    -

    str – The text content of the batch file.

    +

    text (str) – The text content of the batch file.

    Raises

    IOError – If problems reading file.

    @@ -222,13 +229,22 @@ or .py). The ending should not be included in the python path.

    parse_file(pythonpath)[source]
    -

    This parses the lines of a batchfile according to the following -rules:

    +

    This parses the lines of a batch-command-file.

    +
    +
    Parameters
    +

    pythonpath (str) – The dot-python path to the file.

    +
    +
    Returns
    +

    list – A list of all parsed commands with arguments, as strings.

    +
    +
    +

    Notes

    +

    Parsing follows the following rules:

      -
    1. # at the beginning of a line marks the end of the command before +

    2. A # at the beginning of a line marks the end of the command before it. It is also a comment and any number of # can exist on subsequent lines (but not inside comments).

    3. -
    4. #INSERT at the beginning of a line imports another +

    5. #INSERT at the beginning of a line imports another batch-cmd file file and pastes it into the batch file as if it was written there.

    6. Commands are placed alone at the beginning of a line and their @@ -263,30 +279,28 @@ a newline (so two empty lines is a paragraph).

    7. parse_file(pythonpath)[source]
      -

      This parses the lines of a batchfile according to the following -rules:

      +

      This parses the lines of a batch-code file

      Parameters

      pythonpath (str) – The dot-python path to the file.

      Returns
      -

      codeblocks (list)

      +

      list

      -
      A list of all #CODE blocks, each with

      prepended #HEADER data. If no #CODE blocks were found, -this will be a list of one element.

      +
      A list of all #CODE blocks, each with

      prepended #HEADER block data. If no #CODE +blocks were found, this will be a list of one element +containing all code in the file (so a normal Python file).

      Notes

      +

      Parsing is done according to the following rules:

        -
      1. -
        Code before a #CODE/HEADER block are considered part of

        the first code/header block or is the ONLY block if no -#CODE/HEADER blocks are defined.

        -
        -
        -
      2. +
      3. Code before a #CODE/HEADER block are considered part of +the first code/header block or is the ONLY block if no +#CODE/HEADER blocks are defined.

      4. Lines starting with #HEADER starts a header block (ends other blocks)

      5. Lines starting with #CODE begins a code block (ends other blocks)

      6. Lines starting with #INSERT are on form #INSERT filename. Code from @@ -319,6 +333,7 @@ namespace.

      +
    @@ -345,8 +360,14 @@ namespace.

    Table of Contents

    diff --git a/docs/0.9.5/api/evennia.utils.create.html b/docs/0.9.5/api/evennia.utils.create.html index b8aae93351..830785c882 100644 --- a/docs/0.9.5/api/evennia.utils.create.html +++ b/docs/0.9.5/api/evennia.utils.create.html @@ -38,25 +38,15 @@

    evennia.utils.create

    -

    This module gathers all the essential database-creation -functions for the game engine’s various object types.

    -

    Only objects created ‘stand-alone’ are in here, e.g. object Attributes -are always created directly through their respective objects.

    -

    Each creation_* function also has an alias named for the entity being -created, such as create_object() and object(). This is for -consistency with the utils.search module and allows you to do the -shorter “create.object()”.

    -

    The respective object managers hold more methods for manipulating and -searching objects already existing in the database.

    -
    -
    Models covered:

    Objects -Scripts -Help -Message -Channel -Accounts

    -
    -
    +

    This module gathers all the essential database-creation functions for the game +engine’s various object types.

    +

    Only objects created ‘stand-alone’ are in here. E.g. object Attributes are +always created through their respective objects handlers.

    +

    Each creation_* function also has an alias named for the entity being created, +such as create_object() and object(). This is for consistency with the +utils.search module and allows you to do the shorter create.object().

    +

    The respective object managers hold more methods for manipulating and searching +objects already existing in the database.

    evennia.utils.create.create_object(typeclass=None, key=None, location=None, home=None, permissions=None, locks=None, aliases=None, tags=None, destination=None, report_to=None, nohome=False, attributes=None, nattributes=None)[source]
    @@ -66,15 +56,14 @@ Accounts

    • typeclass (class or str) – Class or python path to a typeclass.

    • key (str) – Name of the new object. If not set, a name of -#dbref will be set.

    • +#dbref will be set.

    • home (Object or str) – Obj or #dbref to use as the object’s home location.

    • permissions (list) – A list of permission strings or tuples (permstring, category).

    • locks (str) – one or more lockstrings, separated by semicolons.

    • aliases (list) – A list of alternative keys or tuples (aliasstring, category).

    • tags (list) – List of tag keys or tuples (tagkey, category) or (tagkey, category, data).

    • -
    • destination (Object or str) – Obj or #dbref to use as an Exit’s -target.

    • +
    • destination (Object or str) – Obj or #dbref to use as an Exit’s target.

    • report_to (Object) – The object to return error messages to.

    • nohome (bool) – This allows the creation of objects without a default home location; only used when creating the default diff --git a/docs/0.9.5/api/evennia.utils.dbserialize.html b/docs/0.9.5/api/evennia.utils.dbserialize.html index 42b657b260..17658e27af 100644 --- a/docs/0.9.5/api/evennia.utils.dbserialize.html +++ b/docs/0.9.5/api/evennia.utils.dbserialize.html @@ -87,7 +87,7 @@ will save to when they update. It must have a ‘value’ property that saves assigned data to the database. Skip if not serializing onto a given object. If db_obj is given, this function will convert lists, dicts and sets to their -_SaverList, _SaverDict and _SaverSet counterparts.

    • +_SaverList, _SaverDict and _SaverSet counterparts.

    Returns
    diff --git a/docs/0.9.5/api/evennia.utils.eveditor.html b/docs/0.9.5/api/evennia.utils.eveditor.html index c5c27fb64e..f955aa0686 100644 --- a/docs/0.9.5/api/evennia.utils.eveditor.html +++ b/docs/0.9.5/api/evennia.utils.eveditor.html @@ -39,47 +39,39 @@

    evennia.utils.eveditor

    EvEditor (Evennia Line Editor)

    -

    This implements an advanced line editor for editing longer texts -in-game. The editor mimics the command mechanisms of the “VI” editor -(a famous line-by-line editor) as far as reasonable.

    +

    This implements an advanced line editor for editing longer texts in-game. The +editor mimics the command mechanisms of the “VI” editor (a famous line-by-line +editor) as far as reasonable.

    Features of the editor:

    -
    -
      +
      • undo/redo.

      • edit/replace on any line of the buffer.

      • search&replace text anywhere in buffer.

      • formatting of buffer, or selection, to certain width + indentations.

      • allow to echo the input or not, depending on your client.

      • +
      • in-built help

      -
    -

    To use the editor, just import EvEditor from this module -and initialize it:

    +

    To use the editor, just import EvEditor from this module and initialize it:

    from evennia.utils.eveditor import EvEditor
    -EvEditor(caller, loadfunc=None, savefunc=None, quitfunc=None, key="", persistent=True)
    +
    +# set up an editor to edit the caller's 'desc' Attribute
    +def _loadfunc(caller):
    +    return caller.db.desc
    +
    +def _savefunc(caller, buffer):
    +    caller.db.desc = buffer.strip()
    +    return True
    +
    +def _quitfunc(caller):
    +    caller.msg("Custom quit message")
    +
    +# start the editor
    +EvEditor(caller, loadfunc=None, savefunc=None, quitfunc=None, key="",
    +         persistent=True, code=False)
     
    -
      -
    • caller is the user of the editor, the one to see all feedback.

    • -
    • loadfunc(caller) is called when the editor is first launched; the -return from this function is loaded as the starting buffer in the -editor.

    • -
    • safefunc(caller, buffer) is called with the current buffer when -saving in the editor. The function should return True/False depending -on if the saving was successful or not.

    • -
    • quitfunc(caller) is called when the editor exits. If this is given, -no automatic quit messages will be given.

    • -
    • key is an optional identifier for the editing session, to be -displayed in the editor.

    • -
    • persistent means the editor state will be saved to the database making it -survive a server reload. Note that using this mode, the load- save- -and quit-funcs must all be possible to pickle - notable unusable -callables are class methods and functions defined inside other -functions. With persistent=False, no such restriction exists.

    • -
    • code set to True activates features on the EvEditor to enter Python code.

    • -
    -

    In addition, the EvEditor can be used to enter Python source code, -and offers basic handling of indentation.

    -
    +

    The editor can also be used to format Python code and be made to +survive a reload. See the EvEditor class for more details.

    class evennia.utils.eveditor.CmdSaveYesNo(**kwargs)[source]
    @@ -123,6 +115,11 @@ command was given specifically as “no” or “n”.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '__noinput_command', 'category': 'general', 'key': '__nomatch_command', 'tags': '', 'text': '\n Save the editor state on quit. This catches\n nomatches (defaults to Yes), and avoid saves only if\n command was given specifically as "no" or "n".\n '}
    +
    +
    @@ -181,17 +178,19 @@ command was given specifically as “no” or “n”.

    parse()[source]
    -

    Handles pre-parsing

    -
    -
    Usage:

    :cmd [li] [w] [txt]

    -
    -
    +

    Handles pre-parsing. Editor commands are on the form

    +
    :cmd [li] [w] [txt]
    +
    +

    Where all arguments are optional.

      -
    • li - line number (int), starting from 1. This could also -be a range given as <l>:<l>.

    • -
    • w - word(s) (string), could be encased in quotes.

    • -
    • txt - extra text (string), could be encased in quotes.

    • +
    • +
      li - line number (int), starting from 1. This could also

      be a range given as <l>:<l>.

      +
      +
      +
    • +
    • w - word(s) (string), could be encased in quotes.

    • +
    • txt - extra text (string), could be encased in quotes.

    @@ -215,6 +214,11 @@ be a range given as <l>:<l>.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '', 'category': 'general', 'key': 'command', 'tags': '', 'text': '\n Base parent for editor commands\n '}
    +
    +
    @@ -250,6 +254,11 @@ indentation.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': '__noinput_command', 'category': 'general', 'key': '__nomatch_command', 'tags': '', 'text': '\n No command match - Inputs line of text into buffer.\n '}
    +
    +
    @@ -264,7 +273,7 @@ indentation.

    -aliases = [':p', ':', ':r', ':w', ':UU', ':uu', ':<', ':f', ':y', ':dw', ':dd', ':>', ':q', ':!', ':S', '::', ':echo', ':j', ':::', ':s', ':u', ':=', ':q!', ':DD', ':x', ':fi', ':fd', ':A', ':i', ':wq', ':I', ':h']
    +aliases = [':>', ':x', ':UU', ':', ':!', ':w', ':=', ':dd', ':S', ':DD', ':p', ':::', ':wq', ':u', ':I', ':A', ':uu', ':h', ':y', ':echo', ':r', ':fi', ':q!', ':s', ':dw', '::', ':j', ':fd', ':i', ':<', ':q', ':f']
    @@ -290,6 +299,11 @@ efficient presentation.

    lock_storage = 'cmd:all()'
    +
    +
    +search_index_entry = {'aliases': ':> :x :UU : :! :w := :dd :S :DD :p ::: :wq :u :I :A :uu :h :y :echo :r :fi :q! :s :dw :: :j :fd :i :< :q :f', 'category': 'general', 'key': ':editor_command_group', 'tags': '', 'text': '\n Commands for the editor\n '}
    +
    +
    diff --git a/docs/0.9.5/api/evennia.utils.evform.html b/docs/0.9.5/api/evennia.utils.evform.html index 1a5dd2c9ba..b00c4b068d 100644 --- a/docs/0.9.5/api/evennia.utils.evform.html +++ b/docs/0.9.5/api/evennia.utils.evform.html @@ -72,6 +72,7 @@ object when displaying the form.

    | cccccccc | cccccccccccccccccBccccccccccccccccc | | | | ------------------------------------------------- +'''

    The first line of the FORM string is ignored. The forms and table @@ -162,16 +163,16 @@ EvCell or Tables.

    __init__(filename=None, cells=None, tables=None, form=None, **kwargs)[source]
    -

    Initiate the form.

    +

    Initiate the form

    Keyword Arguments
    • filename (str) – Path to template file.

    • -
    • cells (dict) – A dictionary mapping of {id:text}.

    • -
    • tables (dict) – A dictionary mapping of {id:EvTable}.

    • -
    • form (dict) – A dictionary of +

    • cells (dict) – A dictionary mapping {id: text}

    • +
    • tables (dict) – A dictionary mapping {id: EvTable}.

    • +
    • form (dict) – A dictionary {“FORMCHAR”:char, “TABLECHAR”:char, “FORM”:templatestring}. -if this is given, filename is not read.

    • +If this is given, filename is not read.

    diff --git a/docs/0.9.5/api/evennia.utils.evmenu.html b/docs/0.9.5/api/evennia.utils.evmenu.html index 09b8fdbdd6..2ff2990b3f 100644 --- a/docs/0.9.5/api/evennia.utils.evmenu.html +++ b/docs/0.9.5/api/evennia.utils.evmenu.html @@ -38,9 +38,10 @@

    evennia.utils.evmenu

    -

    The EvMenu is a full in-game menu system for Evennia.

    -

    To start the menu, just import the EvMenu class from this module.

    -

    Example usage:

    +

    EvMenu

    +

    This implements a full menu system for Evennia.

    +

    To start the menu, just import the EvMenu class from this module. +Example usage:

    from evennia.utils.evmenu import EvMenu
     
     EvMenu(caller, menu_module_path,
    @@ -50,8 +51,8 @@
     

    Where caller is the Object to use the menu on - it will get a new -cmdset while using the Menu. The menu_module_path is the python path -to a python module containing function definitions. By adjusting the +cmdset while using the Menu. The menu_module_path is the python path +to a python module containing function definitions. By adjusting the keyword options of the Menu() initialization call you can start the menu at different places in the menu definition file, adjust if the menu command should overload the normal commands or not, etc.

    @@ -77,7 +78,7 @@ command definition too) with function definitions:

    return text, options
    -

    Where caller is the object using the menu and input_string is the +

    Where caller is the object using the menu and input_string is the command entered by the user on the previous node (the command entered to get to this node). The node function code will only be executed once per node-visit and the system will accept nodes with @@ -91,50 +92,43 @@ deleted when the menu is exited.

    returned as None as well. If the options are returned as None, the menu is immediately exited and the default “look” command is called.

      -
    • text (str, tuple or None): Text shown at this node. If a tuple, the -second element in the tuple is a help text to display at this -node when the user enters the menu help command there.

    • +
    • +
      text (str, tuple or None): Text shown at this node. If a tuple, the

      second element in the tuple is a help text to display at this +node when the user enters the menu help command there.

      +
      +
      +
    • options (tuple, dict or None): If None, this exits the menu. If a single dict, this is a single-option node. If a tuple, -it should be a tuple of option dictionaries. Option dicts have -the following keys:

      +it should be a tuple of option dictionaries. Option dicts have the following keys:

        -
      • -
        key (str or tuple, optional): What to enter to choose this option.

        If a tuple, it must be a tuple of strings, where the first string is the +

      • key (str or tuple, optional): What to enter to choose this option. +If a tuple, it must be a tuple of strings, where the first string is the key which will be shown to the user and the others are aliases. If unset, the options’ number will be used. The special key _default marks this option as the default fallback when no other option matches the user input. There can only be one _default option per node. It -will not be displayed in the list.

        -
      • -
        -
      • +will not be displayed in the list.

      • desc (str, optional): This describes what choosing the option will do.

      • -
      • -
        goto (str, tuple or callable): If string, should be the name of node to go to

        when this option is selected. If a callable, it has the signature +

      • goto (str, tuple or callable): If string, should be the name of node to go to +when this option is selected. If a callable, it has the signature callable(caller[,raw_input][,**kwargs]). If a tuple, the first element -is the callable and the second is a dict with the kwargs to pass to +is the callable and the second is a dict with the **kwargs to pass to the callable. Those kwargs will also be passed into the next node if possible. Such a callable should return either a str or a (str, dict), where the string is the name of the next node to go to and the dict is the new, (possibly modified) kwarg to pass into the next node. If the callable returns -None or the empty string, the current node will be revisited.

        -
      • -
        -
      • -
      • -
        exec (str, callable or tuple, optional): This takes the same input as goto above

        and runs before it. If given a node name, the node will be executed but will not +None or the empty string, the current node will be revisited.

      • +
      • exec (str, callable or tuple, optional): This takes the same input as goto above +and runs before it. If given a node name, the node will be executed but will not be considered the next node. If node/callback returns str or (str, dict), these will replace the goto step (goto callbacks will not fire), with the string being the next node name and the optional dict acting as the kwargs-input for the next node. -If an exec callable returns None, the current node is re-run.

        -
    -
    - +If an exec callable returns the empty string (only), the current node is re-run.

    -

    If key is not given, the option will automatically be identified by +

    If key is not given, the option will automatically be identified by its number 1..N.

    Example:

    # in menu_module.py
    @@ -188,9 +182,8 @@ same Using help will show the help text, otherwise a list of
     available commands while in menu mode.

    The menu tree is exited either by using the in-menu quit command or by reaching a node without any options.

    -

    For a menu demo, import CmdTestMenu from this module and add it to -your default cmdset. Run it with this module, like testmenu -evennia.utils.evmenu.

    +

    For a menu demo, import CmdTestMenu from this module and add it to +your default cmdset. Run it with this module, like testmenu evennia.utils.evmenu.