comparison demos/rpg/scripts/scene.py @ 525:19db5a8619a4

Added the GoldStack item class. The scene now loads the goldstack and assigns it's value based on the maps objects file.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 27 May 2010 21:34:36 +0000
parents 6037f79b0dcf
children 796d49ab9380
comparison
equal deleted inserted replaced
524:6037f79b0dcf 525:19db5a8619a4
32 32
33 from scripts.actors.baseactor import Actor 33 from scripts.actors.baseactor import Actor
34 from scripts.actors.baseactor import QuestGiver, Quest 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 from scripts.objects.items import BaseItem 37 from scripts.objects.items import BaseItem, GoldStack
38 38
39 class Scene(object): 39 class Scene(object):
40 def __init__(self, gamecontroller): 40 def __init__(self, gamecontroller):
41 self._gamecontroller = gamecontroller 41 self._gamecontroller = gamecontroller
42 42
73 73
74 for item in objectsettings.get("items", "itemlist", []): 74 for item in objectsettings.get("items", "itemlist", []):
75 itemdict = objectsettings.get("items", item, {}) 75 itemdict = objectsettings.get("items", item, {})
76 modeldict = itemsettings.get("models", itemdict["typename"]) 76 modeldict = itemsettings.get("models", itemdict["typename"])
77 77
78 newitem = BaseItem(self._gamecontroller, item, modeldict["model"]) 78 if itemdict["typename"] == "GoldStack":
79 newitem = GoldStack(self._gamecontroller, modeldict["model"], item)
80 #newitem.value = itemdict["value"]
81 print itemdict["value"]
82 else:
83 newitem = BaseItem(self._gamecontroller, modeldict["model"], item)
84
85 self._objectlist[newitem.instance.getId()] = newitem
79 86
80 for npc in objectsettings.get("npcs", "npclist", []): 87 for npc in objectsettings.get("npcs", "npclist", []):
81 objdict = objectsettings.get("npcs", npc, {}) 88 objdict = objectsettings.get("npcs", npc, {})
82 modeldict = itemsettings.get("models", objdict["typename"]) 89 modeldict = itemsettings.get("models", objdict["typename"])
83 90