Mercurial > parpg-core
annotate src/parpg/gamestate.py @ 150:3fc7cfa80771
Modified InventoryGrid to set a name for each slot containing the index.
Added getSlot method to InventoryGrid.
Renamed InventoryGUI class to CharacterGUI.
Added InventoryGUI class which handles the inventory part of the CharacterGUI.
An InventoryGUI instance is now created in CharacterGUI.
author | KarstenBock@gmx.net |
---|---|
date | Wed, 05 Oct 2011 12:59:22 +0200 |
parents | 0ffebdca7ba3 |
children | 191f89a22303 |
rev | line source |
---|---|
0
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
1 # This file is part of PARPG. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
2 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
3 # PARPG is free software: you can redistribute it and/or modify |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
4 # it under the terms of the GNU General Public License as published by |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
5 # the Free Software Foundation, either version 3 of the License, or |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
6 # (at your option) any later version. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
7 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
8 # PARPG is distributed in the hope that it will be useful, |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
11 # GNU General Public License for more details. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
12 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
13 # You should have received a copy of the GNU General Public License |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
14 # along with PARPG. If not, see <http://www.gnu.org/licenses/>. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
15 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
16 from parpg.quest_engine import QuestEngine |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
17 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
18 class GameState(object): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
19 """This class holds the current state of the game.""" |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
20 def __init__(self, quests_dir = None): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
21 self.player_character = None |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
22 self.quest_engine = QuestEngine(quests_dir) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
23 self.quest_engine.readQuests() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
24 self.objects = {} |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
25 self.object_ids = {} |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
26 self.current_map_name = None |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
27 self.maps = {} |
85
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
28 self.npcs_met = set() |
0
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
29 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
30 |
103
65aa498791ed
The addObject method of the GameState class now accepts an object_id parameter, instead of it getting that value from the object.
KarstenBock@gmx.net
parents:
85
diff
changeset
|
31 def addObject(self, object_id, map_id, game_object): |
0
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
32 """Adds an object to the objects and object_ids |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
33 dictionaries. |
103
65aa498791ed
The addObject method of the GameState class now accepts an object_id parameter, instead of it getting that value from the object.
KarstenBock@gmx.net
parents:
85
diff
changeset
|
34 @param object_id: ID of the object |
65aa498791ed
The addObject method of the GameState class now accepts an object_id parameter, instead of it getting that value from the object.
KarstenBock@gmx.net
parents:
85
diff
changeset
|
35 @type object_id: str |
0
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
36 @param map_id: ID of the map the object is on. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
37 If the object is in a container this has to be None |
103
65aa498791ed
The addObject method of the GameState class now accepts an object_id parameter, instead of it getting that value from the object.
KarstenBock@gmx.net
parents:
85
diff
changeset
|
38 @type map_id: str or None |
0
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
39 @param object: object to be added |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
40 @type object: GameObject |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
41 """ |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
42 if not self.object_ids.has_key(object_id): |
131 | 43 if not self.objects.has_key(map_id): |
44 self.objects[map_id] = {} | |
104
de741e83a422
Objects that are not on an actual map are now stored under the value None in the gamestates object dictionary.
KarstenBock@gmx.net
parents:
103
diff
changeset
|
45 self.objects[map_id][object_id] = game_object |
0
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
46 self.object_ids[object_id] = map_id |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
47 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
48 def deleteObject(self, object_id): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
49 """Removes an object from the dictionaries |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
50 @param object_id: ID of the object |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
51 @type object_id: str |
131 | 52 @returns The deleted object |
0
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
53 """ |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
54 if self.hasObject(object_id): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
55 map_id = self.getMapOfObject(object_id) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
56 if map_id: |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
57 inst = self.maps[map_id].agent_layer.getInstance(object_id) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
58 self.maps[map_id].agent_layer.deleteInstance(inst) |
131 | 59 obj = self.objects[map_id][object_id] |
104
de741e83a422
Objects that are not on an actual map are now stored under the value None in the gamestates object dictionary.
KarstenBock@gmx.net
parents:
103
diff
changeset
|
60 del self.objects[map_id][object_id] |
0
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
61 del self.object_ids[object_id] |
131 | 62 return obj |
63 return None | |
0
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
64 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
65 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
66 def getObjectsFromMap(self, map_id): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
67 """Gets all objects that are currently on the given map. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
68 @type map: String |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
69 @param map: The map name. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
70 @returns: The list of objects on this map. Or an empty list""" |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
71 if map_id in self.objects: |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
72 return [i for i in self.objects[map_id].values() \ |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
73 if map_id in self.objects] |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
74 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
75 return {} |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
76 |
118 | 77 def deleteObjectsFromMap(self, map_id): |
78 """Deletes all objects of the given map. | |
79 @type map: String | |
80 @param map: The map name. | |
81 @returns: None""" | |
131 | 82 deleted_objs = [] |
118 | 83 if map_id in self.objects: |
84 for obj in self.objects[map_id].copy(): | |
131 | 85 deleted_objs.append(self.deleteObject(obj)) |
86 return deleted_objs | |
118 | 87 |
0
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
88 def hasObject(self, object_id): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
89 """Check if an object with the given id is present |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
90 @param object_id: ID of the object |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
91 @type object_id: str |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
92 @return: True if there is an object False if not |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
93 """ |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
94 return self.object_ids.has_key(object_id) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
95 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
96 def getMapOfObject(self, object_id): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
97 """Returns the map the object is on. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
98 @param object_id: ID of the object |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
99 @type object_id: str |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
100 @return: Name of the map the object is on. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
101 If there is no such object or the object is in a container None is returned |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
102 """ |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
103 if self.object_ids.has_key(object_id): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
104 return self.object_ids[object_id] |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
105 return None |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
106 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
107 def getObjectById(self, obj_id, map_id = None): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
108 """Gets an object by its object id and map id |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
109 @type obj_id: String |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
110 @param obj_id: The id of the object. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
111 @type map_id: String |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
112 @param map_id: It id of the map containing the object. |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
113 @returns: The object or None.""" |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
114 if not map_id: |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
115 map_id = self.getMapOfObject(obj_id) |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
116 if not map_id in self.objects: |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
117 self.objects[map_id] = {} |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
118 if obj_id in self.objects[map_id]: |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
119 return self.objects[map_id][obj_id] |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
120 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
121 def clearObjects(self): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
122 """Delete all objects from the state |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
123 """ |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
124 self.objects = {} |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
125 self.object_ids = {} |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
126 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
127 def getStateForSaving(self): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
128 """Prepares state for saving |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
129 @type state: dictionary |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
130 @param state: State of the object |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
131 """ |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
132 ret_dict = {} |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
133 ret_dict["CurrentMap"] = self.current_map_name |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
134 ret_dict["Quests"] = self.quest_engine.getStateForSaving() |
131 | 135 ret_dict["NPCsMet"] = self.npcs_met |
0
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
136 return ret_dict |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
137 |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
138 def restoreFromState(self, state): |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
139 """Restores the state""" |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
140 self.current_map_name = state["CurrentMap"] |
131 | 141 self.npcs_met = state["NPCsMet"] |
0
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
142 self.quest_engine.readQuests() |
1fd2201f5c36
Initial commit of parpg-core.
M. George Hansen <technopolitica@gmail.com>
parents:
diff
changeset
|
143 self.quest_engine.restoreFromState(state["Quests"]) |
85
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
144 |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
145 def meet(self, npc): |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
146 """Record that the PC has met a certain NPC |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
147 @type npc: str |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
148 @param npc: The NPC's name or id""" |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
149 if npc in self.npcs_met: |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
150 # we could raise an error here, but should probably be a warn |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
151 # raise RuntimeError("I already know %s" % npc) |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
152 return |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
153 self.npcs_met.add(npc) |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
154 |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
155 def met(self, npc): |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
156 """Indicate whether the PC has met this npc before |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
157 @type npc: str |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
158 @param npc: The NPC's name or id |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
159 @return: None""" |
cd12294d1981
Added meet and met methods from the old player object to the gamestate.
KarstenBock@gmx.net
parents:
69
diff
changeset
|
160 return npc in self.npcs_met |