comparison src/parpg/gui/dialoguegui.py @ 78:c25c734bd2a7

Modifications to make talking with npcs possible again. Special actions won't work yet though.
author KarstenBock@gmx.net
date Thu, 08 Sep 2011 15:18:39 +0200
parents d60f1dab8469
children 2e307c4f78e3
comparison
equal deleted inserted replaced
77:8a7bb62f9f5d 78:c25c734bd2a7
47 events = { 47 events = {
48 'end_button': self.handleEnd 48 'end_button': self.handleEnd
49 } 49 }
50 self.dialogue_gui.mapEvents(events) 50 self.dialogue_gui.mapEvents(events)
51 self.dialogue_gui.show() 51 self.dialogue_gui.show()
52 self.setNpcName(self.npc.name) 52 self.setNpcName(self.npc.description.view_name)
53 self.setAvatarImage(self.npc.dialogue.avatar_path) 53 self.setAvatarImage(self.npc.dialogue.dialogue.avatar_path)
54 54
55 game_state = {'npc': self.npc, 'pc': self.player_character, 55 game_state = {'npc': self.npc, 'pc': self.player_character,
56 'quest': self.quest_engine} 56 'quest': self.quest_engine}
57 try: 57 try:
58 self.dialogue_processor = DialogueProcessor(self.npc.dialogue, 58 self.dialogue_processor = DialogueProcessor(self.npc.dialogue.dialogue,
59 game_state) 59 game_state)
60 self.dialogue_processor.initiateDialogue() 60 self.dialogue_processor.initiateDialogue()
61 except (TypeError) as error: 61 except (TypeError) as error:
62 self._logger.error(str(error)) 62 self._logger.error(str(error))
63 else: 63 else:
104 def handleEnd(self): 104 def handleEnd(self):
105 """Handle the end of the conversation being reached, either from the 105 """Handle the end of the conversation being reached, either from the
106 GUI or from within the conversation itself.""" 106 GUI or from within the conversation itself."""
107 self.dialogue_gui.hide() 107 self.dialogue_gui.hide()
108 self.responses = [] 108 self.responses = []
109 self.npc.behaviour.state = 1 109 self.npc.fifeagent.behaviour.state = 1
110 self.npc.behaviour.idle() 110 self.npc.fifeagent.behaviour.idle()
111 self.active = False 111 self.active = False
112 112
113 def setNpcName(self, name): 113 def setNpcName(self, name):
114 """Set the NPC name to display on the dialogue GUI. 114 """Set the NPC name to display on the dialogue GUI.
115 @param name: name of the NPC to set 115 @param name: name of the NPC to set