# HG changeset patch # User KarstenBock@gmx.net # Date 1316777744 -7200 # Node ID e719bf53c25a8be9eef23f06a1630df2aff0a21b # Parent a57ec730e753c2a8d961ba16f55262e810a988ec take_stuff and give_stuff in dialogues work again. diff -r a57ec730e753 -r e719bf53c25a dialogueactions.py --- a/dialogueactions.py Fri Sep 23 13:30:41 2011 +0200 +++ b/dialogueactions.py Fri Sep 23 13:35:44 2011 +0200 @@ -18,6 +18,8 @@ """ import logging +from parpg.components import container + logger = logging.getLogger('dialogueaction') class DialogueAction(object): @@ -147,14 +149,15 @@ @type game_state: dict of objects """ item_types = self.item_types - for item_type in item_types: - item = game_state['npc'].inventory.findItem(item_type=item_type) + for item_type in item_types: + item = container.take_item(game_state['npc'].container, item_type) if (item): - game_state['npc'].give(item, game_state['pc']) - print("{0} gave you the {1}".format(game_state['npc'].name, + container.put_item(game_state['pc'].container, item) + print("{0} gave you the {1}".format(game_state['npc'].description.view_name, item_type)) else: - print("{0} doesn't have the {1}".format(game_state['npc'].name, + print("{0} doesn't have the {1}".format(game_state['npc']. + description.view_name, item_type)) DialogueAction.registerAction(TakeStuffAction) @@ -176,11 +179,12 @@ """ item_types = self.item_types for item_type in item_types: - item = game_state['npc'].inventory.findItem(item_type = item_type) + item = container.take_item(game_state['pc'].container, item_type) if (item): - game_state['pc'].give(item, game_state['npc']) + container.put_item(game_state['npc'].container, item) print("You give the {0} to {1}".format(item_type, - game_state['npc'].name)) + game_state['npc']. + description.view_name)) else: print("You don't have the {0}".format(item_type)) DialogueAction.registerAction(GiveStuffAction)