evennia.contrib.tutorials.tutorial_world.rooms¶
Room Typeclasses for the TutorialWorld.
This defines special types of Rooms available in the tutorial. To keep everything in one place we define them together with the custom commands needed to control them. Those commands could also have been in a separate module (e.g. if they could have been re-used elsewhere.)
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
CmdTutorial
(**kwargs)[source]¶ Bases:
evennia.commands.command.Command
Get help during the tutorial
- Usage:
tutorial [obj]
This command allows you to get behind-the-scenes info about an object or the current location.
-
key
= 'tutorial'¶
-
aliases
= ['tut']¶
-
locks
= 'cmd:all()'¶
-
help_category
= 'tutorialworld'¶
-
func
()[source]¶ All we do is to scan the current location for an Attribute called tutorial_info and display that.
-
lock_storage
= 'cmd:all()'¶
-
search_index_entry
= {'aliases': 'tut', 'category': 'tutorialworld', 'key': 'tutorial', 'no_prefix': ' tut', '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 '}¶
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
CmdTutorialSetDetail
(**kwargs)[source]¶ Bases:
evennia.commands.default.muxcommand.MuxCommand
sets a detail on a room
- Usage:
@detail <key> = <description> @detail <key>;<alias>;… = description
Example
@detail walls = The walls are covered in … @detail castle;ruin;tower = The distant ruin …
This sets a “detail” on the object this command is defined on (TutorialRoom for this tutorial). This detail can be accessed with the TutorialRoomLook command sitting on TutorialRoom objects (details are set as a simple dictionary on the room). This is a Builder command.
We custom parse the key for the ;-separator in order to create multiple aliases to the detail all at once.
-
key
= '@detail'¶
-
locks
= 'cmd:perm(Builder)'¶
-
help_category
= 'tutorialworld'¶
-
aliases
= []¶
-
lock_storage
= 'cmd:perm(Builder)'¶
-
search_index_entry
= {'aliases': '', 'category': 'tutorialworld', 'key': '@detail', 'no_prefix': '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 '}¶
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
CmdTutorialLook
(**kwargs)[source]¶ Bases:
evennia.commands.default.general.CmdLook
looks at the room and on details
- Usage:
look <obj> look <room detail> look *<account>
Observes your location, details at your location or objects in your vicinity.
Tutorial: This is a child of the default Look command, that also allows us to look at “details” in the room. These details are things to examine and offers some extra description without actually having to be actual database objects. It uses the return_detail() hook on TutorialRooms for this.
-
help_category
= 'tutorialworld'¶
-
func
()[source]¶ Handle the looking. This is a copy of the default look code except for adding in the details.
-
aliases
= ['ls', 'l']¶
-
key
= 'look'¶
-
lock_storage
= 'cmd:all()'¶
-
search_index_entry
= {'aliases': 'ls l', 'category': 'tutorialworld', 'key': 'look', 'no_prefix': ' ls l', '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 '}¶
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
CmdTutorialGiveUp
(**kwargs)[source]¶ Bases:
evennia.commands.default.muxcommand.MuxCommand
Give up the tutorial-world quest and return to Limbo, the start room of the server.
-
key
= 'give up'¶
-
aliases
= ['abort']¶
-
func
()[source]¶ This is the hook function that actually does all the work. It is called by the cmdhandler right after self.parser() finishes, and so has access to all the variables defined therein.
-
help_category
= 'general'¶
-
lock_storage
= 'cmd:all();'¶
-
search_index_entry
= {'aliases': 'abort', 'category': 'general', 'key': 'give up', 'no_prefix': ' abort', 'tags': '', 'text': '\n Give up the tutorial-world quest and return to Limbo, the start room of the\n server.\n\n '}¶
-
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
TutorialRoomCmdSet
(cmdsetobj=None, key=None)[source]¶ Bases:
evennia.commands.cmdset.CmdSet
Implements the simple tutorial cmdset. This will overload the look command in the default CharacterCmdSet since it has a higher priority (ChracterCmdSet has prio 0)
-
key
= 'tutorial_cmdset'¶
-
priority
= 1¶
-
path
= 'evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoomCmdSet'¶
-
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
TutorialRoom
(*args, **kwargs)[source]¶ Bases:
evennia.objects.objects.DefaultRoom
This is the base room type for all rooms in the tutorial world. It defines a cmdset on itself for reading tutorial info about the location.
-
at_object_receive
(new_arrival, source_location, move_type='move', **kwargs)[source]¶ When an object enter a tutorial room we tell other objects in the room about it by trying to call a hook on them. The Mob object uses this to cheaply get notified of enemies without having to constantly scan for them.
- Parameters
new_arrival (Object) – the object that just entered this room.
source_location (Object) – the previous location of new_arrival.
-
return_detail
(detailkey)[source]¶ This looks for an Attribute “obj_details” and possibly returns the value of it.
- Parameters
detailkey (str) – The detail being looked at. This is case-insensitive.
-
set_detail
(detailkey, description)[source]¶ This sets a new detail, using an Attribute “details”.
- Parameters
detailkey (str) – The detail identifier to add (for aliases you need to add multiple keys to the same description). Case-insensitive.
description (str) – The text to return when looking at the given detailkey.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶ Bases:
evennia.objects.objects.DefaultRoom.MultipleObjectsReturned
-
path
= 'evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom'¶
-
typename
= 'TutorialRoom'¶
-
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
TutorialStartExit
(*args, **kwargs)[source]¶ Bases:
evennia.objects.objects.DefaultExit
This is like a normal exit except it makes the intro command available on itself. We put it on the exit in order to provide this command to the Limbo room without modifying Limbo itself - deleting the tutorial exit will also clean up the intro command.
-
at_object_creation
()[source]¶ Called once, when this object is first created. This is the normal hook to overload for most object types.
-
exception
DoesNotExist
¶
-
exception
MultipleObjectsReturned
¶ Bases:
evennia.objects.objects.DefaultExit.MultipleObjectsReturned
-
path
= 'evennia.contrib.tutorials.tutorial_world.rooms.TutorialStartExit'¶
-
typename
= 'TutorialStartExit'¶
-
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
WeatherRoom
(*args, **kwargs)[source]¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom
This should probably better be called a rainy room…
This sets up an outdoor room typeclass. At irregular intervals, the effects of weather will show in the room. Outdoor rooms should inherit from this.
-
at_object_creation
()[source]¶ Called when object is first created. We set up a ticker to update this room regularly.
Note that we could in principle also use a Script to manage the ticking of the room; the TickerHandler works fine for simple things like this though.
-
update_weather
(*args, **kwargs)[source]¶ Called by the tickerhandler at regular intervals. Even so, we only update 20% of the time, picking a random weather message when we do. The tickerhandler requires that this hook accepts any arguments and keyword arguments (hence the *args, **kwargs even though we don’t actually use them in this example)
-
exception
DoesNotExist
¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom.MultipleObjectsReturned
-
path
= 'evennia.contrib.tutorials.tutorial_world.rooms.WeatherRoom'¶
-
typename
= 'WeatherRoom'¶
-
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
CmdEvenniaIntro
(**kwargs)[source]¶ Bases:
evennia.commands.command.Command
Start the Evennia intro wizard.
- Usage:
intro
-
key
= 'intro'¶
-
func
()[source]¶ This is the actual executing part of the command. It is called directly after self.parse(). See the docstring of this module for which object properties are available (beyond those set in self.parse())
-
aliases
= []¶
-
help_category
= 'general'¶
-
lock_storage
= 'cmd:all();'¶
-
search_index_entry
= {'aliases': '', 'category': 'general', 'key': 'intro', 'no_prefix': ' ', 'tags': '', 'text': '\n Start the Evennia intro wizard.\n\n Usage:\n intro\n\n '}¶
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
CmdSetEvenniaIntro
(cmdsetobj=None, key=None)[source]¶ Bases:
evennia.commands.cmdset.CmdSet
-
key
= 'Evennia Intro StartSet'¶
-
at_cmdset_creation
()[source]¶ Hook method - this should be overloaded in the inheriting class, and should take care of populating the cmdset by use of self.add().
-
path
= 'evennia.contrib.tutorials.tutorial_world.rooms.CmdSetEvenniaIntro'¶
-
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
IntroRoom
(*args, **kwargs)[source]¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom
Intro room
- properties to customize:
char_health - integer > 0 (default 20)
-
at_object_receive
(character, source_location, move_type='move', **kwargs)[source]¶ Assign properties on characters
-
exception
DoesNotExist
¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom.MultipleObjectsReturned
-
path
= 'evennia.contrib.tutorials.tutorial_world.rooms.IntroRoom'¶
-
typename
= 'IntroRoom'¶
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
CmdEast
(**kwargs)[source]¶ Bases:
evennia.commands.command.Command
Go eastwards across the bridge.
- Tutorial info:
This command relies on the caller having two Attributes (assigned by the room when entering):
east_exit: a unique name or dbref to the room to go to when exiting east.
west_exit: a unique name or dbref to the room to go to when exiting west.
- The room must also have the following Attributes
tutorial_bridge_posistion: the current position on on the bridge, 0 - 4.
-
key
= 'east'¶
-
aliases
= ['e']¶
-
locks
= 'cmd:all()'¶
-
help_category
= 'tutorialworld'¶
-
lock_storage
= 'cmd:all()'¶
-
search_index_entry
= {'aliases': 'e', 'category': 'tutorialworld', 'key': 'east', 'no_prefix': ' e', '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 '}¶
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
CmdWest
(**kwargs)[source]¶ Bases:
evennia.commands.command.Command
Go westwards across the bridge.
- Tutorial info:
This command relies on the caller having two Attributes (assigned by the room when entering):
east_exit: a unique name or dbref to the room to go to when exiting east.
west_exit: a unique name or dbref to the room to go to when exiting west.
- The room must also have the following property:
tutorial_bridge_posistion: the current position on on the bridge, 0 - 4.
-
key
= 'west'¶
-
aliases
= ['w']¶
-
locks
= 'cmd:all()'¶
-
help_category
= 'tutorialworld'¶
-
lock_storage
= 'cmd:all()'¶
-
search_index_entry
= {'aliases': 'w', 'category': 'tutorialworld', 'key': 'west', 'no_prefix': ' w', '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 '}¶
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
CmdLookBridge
(**kwargs)[source]¶ Bases:
evennia.commands.command.Command
looks around at the bridge.
- Tutorial info:
This command assumes that the room has an Attribute “fall_exit”, a unique name or dbref to the place they end upp if they fall off the bridge.
-
key
= 'look'¶
-
aliases
= ['l']¶
-
locks
= 'cmd:all()'¶
-
help_category
= 'tutorialworld'¶
-
lock_storage
= 'cmd:all()'¶
-
search_index_entry
= {'aliases': 'l', 'category': 'tutorialworld', 'key': 'look', 'no_prefix': ' l', '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 '}¶
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
CmdBridgeHelp
(**kwargs)[source]¶ Bases:
evennia.commands.command.Command
Overwritten help command while on the bridge.
-
key
= 'help'¶
-
aliases
= ['?', 'h']¶
-
locks
= 'cmd:all()'¶
-
help_category
= 'tutorial world'¶
-
lock_storage
= 'cmd:all()'¶
-
search_index_entry
= {'aliases': '? h', 'category': 'tutorial world', 'key': 'help', 'no_prefix': ' ? h', 'tags': '', 'text': '\n Overwritten help command while on the bridge.\n '}¶
-
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
BridgeCmdSet
(cmdsetobj=None, key=None)[source]¶ Bases:
evennia.commands.cmdset.CmdSet
This groups the bridge commands. We will store it on the room.
-
key
= 'Bridge commands'¶
-
priority
= 2¶
-
path
= 'evennia.contrib.tutorials.tutorial_world.rooms.BridgeCmdSet'¶
-
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
BridgeRoom
(*args, **kwargs)[source]¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.WeatherRoom
The bridge room implements an unsafe bridge. It also enters the player into a state where they get new commands so as to try to cross the bridge.
We want this to result in the account getting a special set of commands related to crossing the bridge. The result is that it will take several steps to cross it, despite it being represented by only a single room.
We divide the bridge into steps:
- self.db.west_exit - - | - - self.db.east_exit
0 1 2 3 4
The position is handled by a variable stored on the character when entering and giving special move commands will increase/decrease the counter until the bridge is crossed.
We also has self.db.fall_exit, which points to a gathering location to end up if we happen to fall off the bridge (used by the CmdLookBridge command).
-
update_weather
(*args, **kwargs)[source]¶ This is called at irregular intervals and makes the passage over the bridge a little more interesting.
-
at_object_receive
(character, source_location, move_type='move', **kwargs)[source]¶ This hook is called by the engine whenever the player is moved into this room.
-
at_object_leave
(character, target_location, move_type='move', **kwargs)[source]¶ This is triggered when the player leaves the bridge room.
-
exception
DoesNotExist
¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.WeatherRoom.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.WeatherRoom.MultipleObjectsReturned
-
path
= 'evennia.contrib.tutorials.tutorial_world.rooms.BridgeRoom'¶
-
typename
= 'BridgeRoom'¶
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
CmdLookDark
(**kwargs)[source]¶ Bases:
evennia.commands.command.Command
Look around in darkness
- Usage:
look
Look around in the darkness, trying to find something.
-
key
= 'look'¶
-
aliases
= ['feel', 'feel around', 'l', 'fiddle', 'search']¶
-
locks
= 'cmd:all()'¶
-
help_category
= 'tutorialworld'¶
-
func
()[source]¶ Implement the command.
This works both as a look and a search command; there is a random chance of eventually finding a light source.
-
lock_storage
= 'cmd:all()'¶
-
search_index_entry
= {'aliases': 'feel feel around l fiddle search', 'category': 'tutorialworld', 'key': 'look', 'no_prefix': ' feel feel around l fiddle search', '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 '}¶
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
CmdDarkHelp
(**kwargs)[source]¶ Bases:
evennia.commands.command.Command
Help command for the dark state.
-
key
= 'help'¶
-
locks
= 'cmd:all()'¶
-
help_category
= 'tutorialworld'¶
-
aliases
= []¶
-
lock_storage
= 'cmd:all()'¶
-
search_index_entry
= {'aliases': '', 'category': 'tutorialworld', 'key': 'help', 'no_prefix': ' ', 'tags': '', 'text': '\n Help command for the dark state.\n '}¶
-
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
CmdDarkNoMatch
(**kwargs)[source]¶ Bases:
evennia.commands.command.Command
This is a system command. Commands with special keys are used to override special sitations in the game. The CMD_NOMATCH is used when the given command is not found in the current command set (it replaces Evennia’s default behavior or offering command suggestions)
-
key
= '__nomatch_command'¶
-
locks
= 'cmd:all()'¶
-
aliases
= []¶
-
help_category
= 'general'¶
-
lock_storage
= 'cmd:all()'¶
-
search_index_entry
= {'aliases': '', 'category': 'general', 'key': '__nomatch_command', 'no_prefix': ' ', '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 "}¶
-
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
DarkCmdSet
(cmdsetobj=None, key=None)[source]¶ Bases:
evennia.commands.cmdset.CmdSet
Groups the commands of the dark room together. We also import the default say command here so that players can still talk in the darkness.
We give the cmdset the mergetype “Replace” to make sure it completely replaces whichever command set it is merged onto (usually the default cmdset)
-
key
= 'darkroom_cmdset'¶
-
mergetype
= 'Replace'¶
-
priority
= 2¶
-
path
= 'evennia.contrib.tutorials.tutorial_world.rooms.DarkCmdSet'¶
-
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
DarkRoom
(*args, **kwargs)[source]¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom
A dark room. This tries to start the DarkState script on all objects entering. The script is responsible for making sure it is valid (that is, that there is no light source shining in the room).
The is_lit Attribute is used to define if the room is currently lit or not, so as to properly echo state changes.
Since this room (in the tutorial) is meant as a sort of catch-all, we also make sure to heal characters ending up here, since they may have been beaten up by the ghostly apparition at this point.
-
check_light_state
(exclude=None)[source]¶ This method checks if there are any light sources in the room. If there isn’t it makes sure to add the dark cmdset to all characters in the room. It is called whenever characters enter the room and also by the Light sources when they turn on.
- Parameters
exclude (Object) – An object to not include in the light check.
-
at_object_receive
(obj, source_location, move_type='move', **kwargs)[source]¶ Called when an object enters the room.
-
at_object_leave
(obj, target_location, move_type='move', **kwargs)[source]¶ In case people leave with the light, we make sure to clear the DarkCmdSet if necessary. This also works if they are teleported away.
-
exception
DoesNotExist
¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom.MultipleObjectsReturned
-
path
= 'evennia.contrib.tutorials.tutorial_world.rooms.DarkRoom'¶
-
typename
= 'DarkRoom'¶
-
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
TeleportRoom
(*args, **kwargs)[source]¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom
Teleporter - puzzle room.
- Important attributes (set at creation):
puzzle_key - which attr to look for on character puzzle_value - what char.db.puzzle_key must be set to success_teleport_to - where to teleport in case if success success_teleport_msg - message to echo while teleporting to success failure_teleport_to - where to teleport to in case of failure failure_teleport_msg - message to echo while teleporting to failure
-
at_object_receive
(character, source_location, move_type='move', **kwargs)[source]¶ This hook is called by the engine whenever the player is moved into this room.
-
exception
DoesNotExist
¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom.MultipleObjectsReturned
-
path
= 'evennia.contrib.tutorials.tutorial_world.rooms.TeleportRoom'¶
-
typename
= 'TeleportRoom'¶
-
class
evennia.contrib.tutorials.tutorial_world.rooms.
OutroRoom
(*args, **kwargs)[source]¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom
Outro room.
Called when exiting the tutorial, cleans the character of tutorial-related attributes.
-
at_object_leave
(character, destination, move_type='move', **kwargs)[source]¶ Called just before an object leaves from inside this object
- Parameters
moved_obj (DefaultObject) – The object leaving
target_location (DefaultObject) – Where moved_obj is going.
move_type (str) – The type of move. “give”, “traverse”, etc. This is an arbitrary string provided to obj.move_to(). Useful for altering messages or altering logic depending on the kind of movement.
**kwargs – Arbitrary, optional arguments for users overriding the call (unused by default).
-
exception
DoesNotExist
¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom.DoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
evennia.contrib.tutorials.tutorial_world.rooms.TutorialRoom.MultipleObjectsReturned
-
path
= 'evennia.contrib.tutorials.tutorial_world.rooms.OutroRoom'¶
-
typename
= 'OutroRoom'¶
-