Mercurial > fife-parpg
comparison demos/rpg/scripts/scene.py @ 529:d0bce896a526
Changed the quest format in the object xml file.
Quests can now required gold or items to complete.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 28 May 2010 16:25:00 +0000 |
parents | 796d49ab9380 |
children | ea26e7b6f56c |
comparison
equal
deleted
inserted
replaced
528:796d49ab9380 | 529:d0bce896a526 |
---|---|
100 if modeldict["type"] == "QUESTGIVER": | 100 if modeldict["type"] == "QUESTGIVER": |
101 actor = QuestGiver(self._gamecontroller, modeldict["model"], npc, True) | 101 actor = QuestGiver(self._gamecontroller, modeldict["model"], npc, True) |
102 questcount = modelsettings.get(npc, "questcount", 0) | 102 questcount = modelsettings.get(npc, "questcount", 0) |
103 for x in range(1,questcount+1): | 103 for x in range(1,questcount+1): |
104 quest = "quest" + str(x) | 104 quest = "quest" + str(x) |
105 (qname, qtext) = modelsettings.get(npc, quest, []) | 105 questdict = modelsettings.get(npc, quest, {}) |
106 actor.addQuest(Quest(actor, qname, qtext)) | 106 quest = Quest(actor, questdict['name'], questdict['desc']) |
107 | |
108 for ritem in questdict['items'].split(" , "): | |
109 if ritem == "GoldStack": | |
110 quest.addRequiredGold(int(questdict['value'])) | |
111 else: | |
112 quest.addRequiredItem(ritem) | |
113 | |
114 actor.addQuest(quest) | |
107 | 115 |
108 elif modeldict["type"] == "NPC": | 116 elif modeldict["type"] == "NPC": |
109 actor = Actor(self._gamecontroller, modeldict["model"], npc, True) | 117 actor = Actor(self._gamecontroller, modeldict["model"], npc, True) |
110 | 118 |
111 actor.setMapPosition(float(objdict["posx"]), float(objdict["posy"])) | 119 actor.setMapPosition(float(objdict["posx"]), float(objdict["posy"])) |
174 target_mapcoord = self._cameras[self._maincameraname].toMapCoordinates(clickpoint, False) | 182 target_mapcoord = self._cameras[self._maincameraname].toMapCoordinates(clickpoint, False) |
175 target_mapcoord.z = 0 | 183 target_mapcoord.z = 0 |
176 location = fife.Location(self._actorlayer) | 184 location = fife.Location(self._actorlayer) |
177 location.setMapCoordinates(target_mapcoord) | 185 location.setMapCoordinates(target_mapcoord) |
178 return location | 186 return location |
179 | 187 |
188 def addObjectToScene(self, obj): | |
189 self._objectlist[obj.id] = obj | |
190 | |
191 def removeObjectFromScene(self, obj): | |
192 obj.destroy() | |
193 del self._objectlist[obj.id] | |
194 | |
180 def updateScene(self): | 195 def updateScene(self): |
181 pass | 196 pass |
182 | 197 |
183 def _getActorLayer(self): | 198 def _getActorLayer(self): |
184 return self._actorlayer | 199 return self._actorlayer |