evennia.contrib.tutorials.evadventure.commands

EvAdventure commands and cmdsets. We don’t need that many stand-alone new commands since a lot of functionality is managed in menus. These commands are in additional to normal Evennia commands and should be added to the CharacterCmdSet

New commands:

inventory wield/wear <item> unwield/remove <item> give <item or coin> to <character> talk <npc>

To install, add the EvAdventureCmdSet from this module to the default character cmdset:

# in mygame/commands/default_cmds.py

from evennia.contrib.tutorials.evadventure.commands import EvAdventureCmdSet  # <---

# ...

class CharacterCmdSet(CmdSet):
    def at_cmdset_creation(self):
        # ...
        self.add(EvAdventureCmdSet)   # <-----
class evennia.contrib.tutorials.evadventure.commands.EvAdventureCommand(**kwargs)[源代码]

基类:evennia.commands.command.Command

Base EvAdventure command. This is on the form

command <args>

where whitespace around the argument(s) are stripped.

parse()[源代码]

Once the cmdhandler has identified this as the command we want, this function is run. If many of your commands have a similar syntax (for example ‘cmd arg1 = arg2’) you should simply define this once and just let other commands of the same form inherit from this. See the docstring of this module for which object properties are available to use (notably self.args).

aliases = []
help_category = 'general'
key = 'command'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': '', 'category': 'general', 'key': 'command', 'no_prefix': ' ', 'tags': '', 'text': '\n Base EvAdventure command. This is on the form\n\n command <args>\n\n where whitespace around the argument(s) are stripped.\n\n '}
class evennia.contrib.tutorials.evadventure.commands.CmdInventory(**kwargs)[源代码]

基类:evennia.contrib.tutorials.evadventure.commands.EvAdventureCommand

View your inventory

Usage:

inventory

key = 'inventory'
aliases = ['inv', 'i']
func()[源代码]

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())

help_category = 'general'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': 'inv i', 'category': 'general', 'key': 'inventory', 'no_prefix': ' inv i', 'tags': '', 'text': '\n View your inventory\n\n Usage:\n inventory\n\n '}
class evennia.contrib.tutorials.evadventure.commands.CmdWieldOrWear(**kwargs)[源代码]

基类:evennia.contrib.tutorials.evadventure.commands.EvAdventureCommand

Wield a weapon/shield, or wear a piece of armor or a helmet.

Usage:

wield <item> wear <item>

The item will automatically end up in the suitable spot, replacing whatever was there previously.

key = 'wield'
aliases = ['wear']
out_txts = {<WieldLocation.BACKPACK: 'backpack'>: 'You shuffle the position of {key} around in your backpack.', <WieldLocation.TWO_HANDS: 'two_handed_weapons'>: 'You hold {key} with both hands.', <WieldLocation.WEAPON_HAND: 'weapon_hand'>: 'You hold {key} in your strongest hand, ready for action.', <WieldLocation.SHIELD_HAND: 'shield_hand'>: 'You hold {key} in your off hand, ready to protect you.', <WieldLocation.BODY: 'body'>: 'You strap {key} on yourself.', <WieldLocation.HEAD: 'head'>: 'You put {key} on your head.'}
func()[源代码]

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())

help_category = 'general'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': 'wear', 'category': 'general', 'key': 'wield', 'no_prefix': ' wear', 'tags': '', 'text': '\n Wield a weapon/shield, or wear a piece of armor or a helmet.\n\n Usage:\n wield <item>\n wear <item>\n\n The item will automatically end up in the suitable spot, replacing whatever\n was there previously.\n\n '}
class evennia.contrib.tutorials.evadventure.commands.CmdRemove(**kwargs)[源代码]

基类:evennia.contrib.tutorials.evadventure.commands.EvAdventureCommand

Remove a remove a weapon/shield, armor or helmet.

Usage:

remove <item> unwield <item> unwear <item>

To remove an item from the backpack, use |wdrop|n instead.

key = 'remove'
aliases = ['unwield', 'unwear']
func()[源代码]

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())

help_category = 'general'
lock_storage = 'cmd:all();'
search_index_entry = {'aliases': 'unwield unwear', 'category': 'general', 'key': 'remove', 'no_prefix': ' unwield unwear', 'tags': '', 'text': '\n Remove a remove a weapon/shield, armor or helmet.\n\n Usage:\n remove <item>\n unwield <item>\n unwear <item>\n\n To remove an item from the backpack, use |wdrop|n instead.\n\n '}
evennia.contrib.tutorials.evadventure.commands.node_give(caller, raw_string, **kwargs)[源代码]

This will show to the giver until receiver accepts/declines. It allows them to rescind their offer.

The caller here is the one giving the item. We also make sure to feed the ‘item’ and ‘receiver’ into the Evmenu.

evennia.contrib.tutorials.evadventure.commands.node_receive(caller, raw_string, **kwargs)[源代码]

Will show to the receiver and allow them to accept/decline the offer for as long as the giver didn’t rescind it.

The caller here is the one receiving the item. We also make sure to feed the ‘item’ and ‘giver’ into the EvMenu.

evennia.contrib.tutorials.evadventure.commands.node_end(caller, raw_string, **kwargs)[源代码]
class evennia.contrib.tutorials.evadventure.commands.CmdGive(**kwargs)[源代码]

基类:evennia.contrib.tutorials.evadventure.commands.EvAdventureCommand

Give item or money to another person. Items need to be accepted before they change hands. Money changes hands immediately with no wait.

Usage:

give <item> to <receiver> give <number of coins> [coins] to receiver

If item name includes ‘ to ‘, surround it in quotes.

实际案例

give apple to ranger give “road to happiness” to sad ranger give 10 coins to ranger give 12 to ranger

key = 'give'
parse()[源代码]

Parsing is a little more complex for this command.

func()[源代码]

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': 'give', 'no_prefix': ' ', 'tags': '', 'text': '\n Give item or money to another person. Items need to be accepted before\n they change hands. Money changes hands immediately with no wait.\n\n Usage:\n give <item> to <receiver>\n give <number of coins> [coins] to receiver\n\n If item name includes \' to \', surround it in quotes.\n\n Examples:\n give apple to ranger\n give "road to happiness" to sad ranger\n give 10 coins to ranger\n give 12 to ranger\n\n '}
class evennia.contrib.tutorials.evadventure.commands.CmdTalk(**kwargs)[源代码]

基类:evennia.contrib.tutorials.evadventure.commands.EvAdventureCommand

Start a conversations with shop keepers and other NPCs in the world.

参数

<npc> (talk) –

key = 'talk'
func()[源代码]

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': 'talk', 'no_prefix': ' ', 'tags': '', 'text': '\n Start a conversations with shop keepers and other NPCs in the world.\n\n Args:\n talk <npc>\n\n '}
class evennia.contrib.tutorials.evadventure.commands.EvAdventureCmdSet(cmdsetobj=None, key=None)[源代码]

基类:evennia.commands.cmdset.CmdSet

Groups all commands in one cmdset which can be added in one go to the DefaultCharacter cmdset.

key = 'evadventure'
at_cmdset_creation()[源代码]

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.evadventure.commands.EvAdventureCmdSet'