evennia.contrib.full_systems.evscaperoom.utils

Helper functions and classes for the evscaperoom contrib.

Most of these are available directly from wrappers in state/object/room classes and does not need to be imported from here.

evennia.contrib.full_systems.evscaperoom.utils.create_evscaperoom_object(typeclass=None, key='testobj', location=None, delete_duplicates=True, **kwargs)[源代码]

This is a convenience-wrapper for quickly building EvscapeRoom objects. This is called from the helper-method create_object on states, but is also useful for the object-create admin command.

Note that for the purpose of the Evscaperoom, we only allow one instance of each name, deleting the old version if it already exists.

关键字参数
  • typeclass (str) – This can take just the class-name in the evscaperoom’s objects.py module. Otherwise, a full path is needed.

  • key (str) – Name of object.

  • location (Object) – The location to create new object.

  • delete_duplicates (bool) – Delete old object with same key.

  • kwargs (any) – Will be passed into create_object.

返回

new_obj (Object) – The newly created object, if any.

evennia.contrib.full_systems.evscaperoom.utils.create_fantasy_word(length=5, capitalize=True)[源代码]

Create a random semi-pronouncable ‘word’.

关键字参数
  • length (int) – The desired length of the ‘word’.

  • capitalize (bool) – If the return should be capitalized or not

返回

word (str) – The fictous word of given length.

evennia.contrib.full_systems.evscaperoom.utils.parse_for_perspectives(string, you=None)[源代码]

Parse a string with special markers to produce versions both intended for the person doing the action (‘you’) and for those seeing the person doing that action. Also marks ‘things’ according to style. See example below.

参数
  • string (str) – String on 2nd person form with ~ markers (‘~you ~open …’)

  • you (str) – What others should see instead of you (Bob opens)

返回

second, third_person (tuple)

Strings replace to be shown in 2nd and 3rd person

perspective

示例

“~You ~open” -> “You open”, “Bob opens”

evennia.contrib.full_systems.evscaperoom.utils.parse_for_things(string, things_style=2, clr='|y')[源代码]

Parse string for special *thing markers and decorate it.

参数
  • string (str) – The string to parse.

  • things_style (int) – The style to handle *things marked: 0 - no marking (remove *) 1 - mark with color 2 - mark with color and [] (default)

  • clr (str) – Which color to use for marker..

示例

You open *door -> You open [door].

evennia.contrib.full_systems.evscaperoom.utils.add_msg_borders(text)[源代码]

Add borders above/below text block

evennia.contrib.full_systems.evscaperoom.utils.msg_cinematic(text, borders=True)[源代码]

Display a text as a ‘cinematic’ - centered and surrounded by borders.

参数
  • text (str) – Text to format.

  • borders (bool, optional) – Put borders above and below text.

返回

text (str) – Pretty-formatted text.