Mercurial > fife-parpg
annotate demos/rpg/scripts/quests/questmanager.py @ 575:872a7a94563e
- Updated the soundmanager extension to reflect changes made in last commit.
- Made actor walk speed part of the ActorAttributes class.
- The ActorAttributes class now gets serialized correctly.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 02 Jul 2010 14:41:27 +0000 |
parents | 9152ed2b5bb8 |
children |
rev | line source |
---|---|
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
1 #!/usr/bin/env python |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
2 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
3 # -*- coding: utf-8 -*- |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
4 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
5 # #################################################################### |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
6 # Copyright (C) 2005-2010 by the FIFE team |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
7 # http://www.fifengine.net |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
8 # This file is part of FIFE. |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
9 # |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
10 # FIFE is free software; you can redistribute it and/or |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
11 # modify it under the terms of the GNU Lesser General Public |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
12 # License as published by the Free Software Foundation; either |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
13 # version 2.1 of the License, or (at your option) any later version. |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
14 # |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
15 # This library is distributed in the hope that it will be useful, |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
18 # Lesser General Public License for more details. |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
19 # |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
20 # You should have received a copy of the GNU Lesser General Public |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
21 # License along with this library; if not, write to the |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
22 # Free Software Foundation, Inc., |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
24 # #################################################################### |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
25 # This is the rio de hola client for FIFE. |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
26 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
27 from fife import fife |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
28 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
560
diff
changeset
|
29 from fife.extensions.serializers.simplexml import SimpleXMLSerializer |
551
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
30 from scripts.quests.basequest import Quest, ReturnItemQuest, QuestTypes |
560
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
31 from scripts.misc.serializer import Serializer |
551
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
32 |
560
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
33 class QuestManager(Serializer): |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
34 def __init__(self, gamecontroller): |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
35 self._gamecontroller = gamecontroller |
551
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
36 |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
37 self._questsettings = None |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
38 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
39 self._quests = {} |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
40 self._activequests = [] |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
41 self._completedquests = [] |
560
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
42 |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
43 def serialize(self): |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
44 pass |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
45 |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
46 def deserialize(self, valuedict=None): |
551
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
47 questfile = self._gamecontroller.settings.get("RPG", "QuestFile", "maps/quests.xml") |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
48 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
560
diff
changeset
|
49 self._questsettings = SimpleXMLSerializer(questfile) |
551
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
50 |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
51 for identifier in self._questsettings.get("QuestGivers", "list", []): |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
52 for quest in self._questsettings.get(identifier, "questlist", []): |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
53 questdict = self._questsettings.get(identifier, quest, {}) |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
54 if questdict['type'] == "RETURN_ITEM": |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
55 questobj = ReturnItemQuest(identifier, quest, questdict['name'], questdict['desc']) |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
56 for ritem in self._questsettings.get(quest+"_items", "itemlist", []): |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
57 itemdict = self._questsettings.get(quest+"_items", ritem, {}) |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
58 if itemdict["name"] == "GOLD_COINS": |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
59 questobj.addRequiredGold(int(itemdict['value'])) |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
60 else: |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
61 questobj.addRequiredItem(ritem) |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
62 else: |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
63 questobj = Quest(identifier, quest, questdict['name'], questdict['desc']) |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
64 |
560
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
65 if questdict.has_key("quest_incomplete_dialog"): |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
66 questobj._incomplete_dialog = questdict['quest_incomplete_dialog'] |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
67 |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
68 if questdict.has_key("quest_complete_dialog"): |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
69 questobj._complete_dialog = questdict['quest_complete_dialog'] |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
70 |
551
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
71 self._gamecontroller.questmanager.addQuest(questobj) |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
72 |
560
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
73 def reset(self): |
551
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
74 self._quests = {} |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
75 self._activequests = [] |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
76 self._completedquests = [] |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
77 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
78 def addQuest(self, quest): |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
79 if self._quests.has_key(quest.ownerid): |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
80 if not quest in self._quests[quest.ownerid]: |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
81 self._quests[quest.ownerid].append(quest) |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
82 else: |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
83 self._quests[quest.ownerid] = [quest] |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
84 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
85 def getQuest(self, questid): |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
86 for owner in self._quests: |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
87 for quest in self._quests[owner]: |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
88 if quest.id == questid: |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
89 return quest |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
90 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
91 return None |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
92 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
93 def getNextQuest(self, ownerid): |
560
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
94 if self._quests.has_key(ownerid): |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
95 for quest in self._quests[ownerid]: |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
96 if not quest in self._activequests and not quest in self._completedquests: |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
97 return quest |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
98 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
99 return None |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
100 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
101 def activateQuest(self, quest): |
560
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
102 """ |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
103 Adds the quest to the "active quests" list. Note that this does NOT affect |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
104 the quest in any way. It's just a way of keeping track of which quests |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
105 the player has accepted. |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
106 """ |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
107 if not quest in self._activequests: |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
108 self._activequests.append(quest) |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
109 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
110 def completeQuest(self, quest): |
560
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
111 """ |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
112 Marks the quest as completed. Note that this does NOT modify the quest in |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
113 any way. This is just a way to keep track of completed quests. |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
114 """ |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
115 if not quest in self._completedquests: |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
116 self._completedquests.append(quest) |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
117 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
118 if quest in self._activequests: |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
119 self._activequests.remove(quest) |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
120 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
121 def activateQuestById(self, questid): |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
122 quest = self.getQuest(questid) |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
123 if quest: |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
124 self.activateQuest(quest) |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
125 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
126 def completeQuestById(self, questid): |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
127 quest = self.getQuest(questid) |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
128 if quest: |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
129 self.completeQuest(quest) |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
130 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
131 def _getActiveQuests(self): |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
132 return self._activequests |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
133 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
134 def _getCompletedQuests(self): |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
135 return self._completedquests |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
136 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
137 def _getAllQuests(self): |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
138 return self._quests |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
139 |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
140 activequests = property(_getActiveQuests) |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
141 completedquests = property(_getCompletedQuests) |
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.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
142 quests = property(_getAllQuests) |