# HG changeset patch # User KarstenBock@gmx.net # Date 1316777744 -7200 # Node ID bb0e09112a1f15bd4c90c2cc7899f78e89231cf2 # Parent 2f928c913c78983466569e10a406fd702a0d814d take_stuff and give_stuff in dialogues work again. diff -r 2f928c913c78 -r bb0e09112a1f src/parpg/dialogueactions.py --- a/src/parpg/dialogueactions.py Fri Sep 23 13:30:41 2011 +0200 +++ b/src/parpg/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)