Package parpg :: Module dialogueactions :: Class DialogueAction
[hide private]
[frames] | no frames]

Class DialogueAction

source code

object --+
         |
        DialogueAction
Known Subclasses:

Abstract base class for subclasses that represent dialogue actions embedded within a DialogueSection or DialogueResponse.

Subclasses must define the keyword class variable and implement both the __init__ and __call__ methods.

Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
Initialize a new DialogueAction instance.
source code
 
__call__(self, game_state)
Execute the DialogueAction.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
 
registerAction(cls, dialogue_action_type)
Register a DialogueAction subclass for easy reference.
source code
Class Variables [hide private]
  logger = logging.getLogger('dialogueaction.DialogueAction')
  registered_actions = {'complete_quest': <class 'parpg.dialogue...
basestring keyword
keyword used by the DialogueParser to recognize the DialogueAction in serialized Dialogues.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

registerAction(cls, dialogue_action_type)
Class Method

source code 

Register a DialogueAction subclass for easy reference.

Parameters:
  • dialogue_action_type (DialogueAction subclass) - dialogue action to register.

__init__(self, *args, **kwargs)
(Constructor)

source code 

Initialize a new DialogueAction instance.

Parameters:
  • args (list of objects) - positional arguments passed by the DialogueParser after reading a serialized Dialogue.
  • kwargs (dict of objects) - keyword arguments passed by the DialogueParser after reading a serialized Dialogue.
Overrides: object.__init__

__call__(self, game_state)
(Call operator)

source code 

Execute the DialogueAction.

Parameters:
  • game_state (dict of objects) - variables and functions that make up the current game state.

Class Variable Details [hide private]

registered_actions

Value:
{'complete_quest': <class 'parpg.dialogueactions.CompleteQuestAction'>\
,
 'decrease_quest_variable': <class 'parpg.dialogueactions.DecreaseQues\
tVariableAction'>,
 'fail_quest': <class 'parpg.dialogueactions.FailQuestAction'>,
 'give_stuff': <class 'parpg.dialogueactions.GiveStuffAction'>,
 'increase_quest_variable': <class 'parpg.dialogueactions.IncreaseQues\
tVariableAction'>,
...