comparison demos/rpg/scripts/scene.py @ 550:d0282579668c

Added QuestManager. The player can now move from map to map and the state of the quests remains persistent. Both quests the NPC gives you are now completable. Still have to clean up the quest loading code. Started adding more comments.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Tue, 15 Jun 2010 17:53:20 +0000
parents e59ece21ab3e
children 3b933753cba8
comparison
equal deleted inserted replaced
549:c9113e23b004 550:d0282579668c
78 78
79 for quest in self._questsettings.get(identifier, "questlist", []): 79 for quest in self._questsettings.get(identifier, "questlist", []):
80 questdict = self._questsettings.get(identifier, quest, {}) 80 questdict = self._questsettings.get(identifier, quest, {})
81 81
82 if questdict['type'] == "RETURN_ITEM": 82 if questdict['type'] == "RETURN_ITEM":
83 questobj = ReturnItemQuest(newobject, questdict['name'], questdict['desc']) 83 questobj = ReturnItemQuest(newobject.id, quest, questdict['name'], questdict['desc'])
84 for ritem in self._questsettings.get(quest+"_items", "itemlist", []): 84 for ritem in self._questsettings.get(quest+"_items", "itemlist", []):
85 itemdict = self._questsettings.get(quest+"_items", ritem, {}) 85 itemdict = self._questsettings.get(quest+"_items", ritem, {})
86 if itemdict["name"] == "GOLD_COINS": 86 if itemdict["name"] == "GOLD_COINS":
87 questobj.addRequiredGold(int(itemdict['value'])) 87 questobj.addRequiredGold(int(itemdict['value']))
88 else: 88 else:
89 questobj.addRequiredItem(ritem) 89 questobj.addRequiredItem(ritem)
90 else: 90 else:
91 questobj = Quest(actor, questdict['name'], questdict['desc']) 91 questobj = Quest(newobject.id, quest, questdict['name'], questdict['desc'])
92 92
93 newobject.addQuest(questobj) 93 newobject.addQuest(questobj)
94
95 #add quest to quest manager as well
96 self._gamecontroller.questmanager.addQuest(questobj)
94 97
95 elif objdict["type"] == "NPC": 98 elif objdict["type"] == "NPC":
96 newobject = Actor(self._gamecontroller, self.actorlayer, objdict["type"], objectname, modeldict["model"], identifier, True) 99 newobject = Actor(self._gamecontroller, self.actorlayer, objdict["type"], objectname, modeldict["model"], identifier, True)
97 else: 100 else:
98 return None 101 return None