Mercurial > fife-parpg
comparison demos/rpg/scripts/quests/questmanager.py @ 567:9152ed2b5bb8
Created SimpleXMLSerializer which makes loading and saving variables to an XML file simple. In the process I removed the the XML code from the Settings class. It now uses SimpleXMLSerializer to load and save settings.
I have also updated the RPG demo to use the SimpleXMLSerializer for loading and saving game specific data.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 28 Jun 2010 18:41:23 +0000 |
parents | 69d50e751c9a |
children |
comparison
equal
deleted
inserted
replaced
566:90d369c788c0 | 567:9152ed2b5bb8 |
---|---|
24 # #################################################################### | 24 # #################################################################### |
25 # This is the rio de hola client for FIFE. | 25 # This is the rio de hola client for FIFE. |
26 | 26 |
27 from fife import fife | 27 from fife import fife |
28 | 28 |
29 from fife.extensions.fife_settings import Setting | 29 from fife.extensions.serializers.simplexml import SimpleXMLSerializer |
30 from scripts.quests.basequest import Quest, ReturnItemQuest, QuestTypes | 30 from scripts.quests.basequest import Quest, ReturnItemQuest, QuestTypes |
31 from scripts.misc.serializer import Serializer | 31 from scripts.misc.serializer import Serializer |
32 | 32 |
33 class QuestManager(Serializer): | 33 class QuestManager(Serializer): |
34 def __init__(self, gamecontroller): | 34 def __init__(self, gamecontroller): |
44 pass | 44 pass |
45 | 45 |
46 def deserialize(self, valuedict=None): | 46 def deserialize(self, valuedict=None): |
47 questfile = self._gamecontroller.settings.get("RPG", "QuestFile", "maps/quests.xml") | 47 questfile = self._gamecontroller.settings.get("RPG", "QuestFile", "maps/quests.xml") |
48 | 48 |
49 self._questsettings = Setting(settings_file=questfile) | 49 self._questsettings = SimpleXMLSerializer(questfile) |
50 | 50 |
51 for identifier in self._questsettings.get("QuestGivers", "list", []): | 51 for identifier in self._questsettings.get("QuestGivers", "list", []): |
52 for quest in self._questsettings.get(identifier, "questlist", []): | 52 for quest in self._questsettings.get(identifier, "questlist", []): |
53 questdict = self._questsettings.get(identifier, quest, {}) | 53 questdict = self._questsettings.get(identifier, quest, {}) |
54 if questdict['type'] == "RETURN_ITEM": | 54 if questdict['type'] == "RETURN_ITEM": |