comparison demos/rpg/scripts/scene.py @ 521:494c60cf61cf

Player can now receive a quest, accept it, and complete it. Quests do not have any requirements (i.e. bring me back an item.. etc etc) to be completed at this time.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 27 May 2010 17:31:28 +0000
parents b6bd314df28a
children d01eb65b2726
comparison
equal deleted inserted replaced
520:b6bd314df28a 521:494c60cf61cf
29 from fife import fife 29 from fife import fife
30 from fife.extensions.loaders import loadMapFile 30 from fife.extensions.loaders import loadMapFile
31 from fife.extensions.fife_settings import Setting 31 from fife.extensions.fife_settings import Setting
32 32
33 from scripts.actors.baseactor import Actor 33 from scripts.actors.baseactor import Actor
34 from scripts.actors.baseactor import QuestGiver 34 from scripts.actors.baseactor import QuestGiver, Quest
35 from scripts.actors.player import Player 35 from scripts.actors.player import Player
36 from scripts.objects.baseobject import GameObjectTypes 36 from scripts.objects.baseobject import GameObjectTypes
37 37
38 class Scene(object): 38 class Scene(object):
39 def __init__(self, gamecontroller): 39 def __init__(self, gamecontroller):
69 69
70 for npc in objectsettings.get(mapname[0], "npclist", []): 70 for npc in objectsettings.get(mapname[0], "npclist", []):
71 (objtype, modelname, posx, posy) = objectsettings.get(mapname[0], npc, ["NPC", "warrior", "0", "0"]) 71 (objtype, modelname, posx, posy) = objectsettings.get(mapname[0], npc, ["NPC", "warrior", "0", "0"])
72 if objtype == "QUESTGIVER": 72 if objtype == "QUESTGIVER":
73 actor = QuestGiver(self._gamecontroller, modelname, npc, True) 73 actor = QuestGiver(self._gamecontroller, modelname, npc, True)
74 questcount = objectsettings.get(npc, "questcount", 0)
75 for x in range(1,questcount+1):
76 quest = "quest" + str(x)
77 (qname, qtext) = objectsettings.get(npc, quest, [])
78 actor.addQuest(Quest(actor, qname, qtext))
79
74 elif objtype == "NPC": 80 elif objtype == "NPC":
75 actor = Actor(self._gamecontroller, modelname, npc, True) 81 actor = Actor(self._gamecontroller, modelname, npc, True)
76 82
77 actor.setMapPosition(float(posx), float(posy)) 83 actor.setMapPosition(float(posx), float(posy))
78 self._objectlist[actor.instance.getId()] = actor 84 self._objectlist[actor.instance.getId()] = actor