Crossfire Server, Trunk
CREMapInformation.cpp
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 2022 the Crossfire Development Team
5  *
6  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7  * welcome to redistribute it under certain conditions. For details, please
8  * see COPYING and LICENSE.
9  *
10  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
11  */
12 
13 #include "CREMapInformation.h"
14 #include "random_maps/RandomMap.h"
15 #include "quests/QuestWrapper.h"
16 #include "faces/FaceWrapper.h"
18 #include "scripts/ScriptFile.h"
20 
22 {
23  myDifficulty = 0;
25  myExperience = 0;
26  myShopGreed = 0;
27  myShopMin = 0;
28  myShopMax = 0;
29 }
30 
31 CREMapInformation::CREMapInformation(const QString& path) : AssetWrapper(nullptr, "Map")
32 {
33  myPath = path;
34  myDifficulty = 0;
36  myExperience = 0;
37  myShopGreed = 0;
38  myShopMin = 0;
39  myShopMax = 0;
40 }
41 
43 {
44  qDeleteAll(myRandomMaps);
45 }
46 
48 {
49  if (myName.isEmpty())
50  return myPath;
51  return myName;
52 }
53 
54 const QString& CREMapInformation::path() const
55 {
56  return myPath;
57 }
58 
59 void CREMapInformation::setPath(const QString& path)
60 {
61  myPath = path;
62 }
63 
64 const QString& CREMapInformation::name() const
65 {
66  return myName;
67 }
68 
69 void CREMapInformation::setName(const QString& name)
70 {
71  myName = name;
72 }
73 
75 {
76  return myBackgroundMusic;
77 }
78 
79 void CREMapInformation::setBackgroundMusic(const QString& music)
80 {
81  myBackgroundMusic = music;
82 }
83 
84 const QString& CREMapInformation::resetGroup() const
85 {
86  return myResetGroup;
87 }
88 
89 void CREMapInformation::setResetGroup(const QString& resetGroup)
90 {
92 }
93 
94 QStringList CREMapInformation::archetypes() const
95 {
96  return myArchetypes;
97 }
98 
100 {
101  if (!myArchetypes.contains(archetype))
102  myArchetypes.append(archetype);
103 }
104 
105 QStringList CREMapInformation::faces() const
106 {
107  return myFaces.values();
108 }
109 
110 void CREMapInformation::addFace(const QString& face)
111 {
112  myFaces.insert(face);
113 }
114 
115 QStringList CREMapInformation::animations() const
116 {
117  return myAnimations.values();
118 }
119 
121 {
122  myAnimations.insert(anim);
123 }
124 
125 const QDateTime& CREMapInformation::mapTime() const
126 {
127  return myMapTime;
128 }
129 
130 void CREMapInformation::setMapTime(const QDateTime& date)
131 {
132  myMapTime = date;
133 }
134 
135 QStringList CREMapInformation::exitsTo() const
136 {
137  return myExitsTo;
138 }
139 
140 void CREMapInformation::addExitTo(const QString& path)
141 {
142  if (!myExitsTo.contains(path))
143  myExitsTo.append(path);
144 }
145 
147 {
148  return myAccessedFrom;
149 }
150 
152 {
153  if (!myAccessedFrom.contains(path))
154  myAccessedFrom.append(path);
155 }
156 
158 {
159  return myDifficulty;
160 }
161 
163 {
165 }
166 
168 {
169  return myComputedDifficulty;
170 }
171 
172 void CREMapInformation::setComputedDifficulty(int computedDifficulty)
173 {
175 }
176 
177 qint64 CREMapInformation::experience() const
178 {
179  return myExperience;
180 }
181 
182 void CREMapInformation::setExperience(qint64 experience)
183 {
185 }
186 
187 const QString& CREMapInformation::region() const
188 {
189  return myRegion;
190 }
192 {
193  myRegion = region;
194 }
195 
196 QStringList CREMapInformation::messages() const
197 {
198  return myMessages;
199 }
200 
202 {
203  if (!myMessages.contains(message))
204  myMessages.append(message);
205 }
206 
207 QStringList CREMapInformation::quests() const
208 {
209  return myQuests;
210 }
211 
212 void CREMapInformation::addQuest(const QString& quest)
213 {
214  if (!myQuests.contains(quest))
215  myQuests.append(quest);
216 }
217 
218 QHash<QString, int>& CREMapInformation::shopItems()
219 {
220  return myShopItems;
221 }
222 
223 const QHash<QString, int>& CREMapInformation::shopItems() const
224 {
225  return myShopItems;
226 }
227 
228 double CREMapInformation::shopGreed() const
229 {
230  return myShopGreed;
231 }
232 
234 {
235  myShopGreed = greed;
236 }
237 
238 const QString& CREMapInformation::shopRace() const
239 {
240  return myShopRace;
241 }
242 
243 void CREMapInformation::setShopRace(const QString& race)
244 {
245  myShopRace = race;
246 }
247 
248 quint64 CREMapInformation::shopMin() const
249 {
250  return myShopMin;
251 }
252 
254 {
255  myShopMin = min;
256 }
257 
258 quint64 CREMapInformation::shopMax() const
259 {
260  return myShopMax;
261 }
262 
264 {
265  myShopMax = max;
266 }
267 
268 QList<RandomMap*> CREMapInformation::randomMaps() const
269 {
270  return myRandomMaps;
271 }
272 
274 {
275  myRandomMaps.append(map);
276 }
277 
278 AssetWrapper::PossibleUse CREMapInformation::uses(const AssetWrapper *asset, std::string &hint) const {
279  auto quest = dynamic_cast<const QuestWrapper *>(asset);
280  if (quest) {
281  return myQuests.indexOf(quest->wrappedItem()->quest_code) == -1 ? DoesntUse : Uses;
282  }
283  auto face = dynamic_cast<const FaceWrapper *>(asset);
284  if (face) {
285  return myFaces.find(face->wrappedItem()->name) == myFaces.end() ? DoesntUse : Uses;
286  }
287  auto anim = dynamic_cast<const AnimationWrapper *>(asset);
288  if (anim) {
289  return myAnimations.find(anim->wrappedItem()->name) == myAnimations.end() ? DoesntUse : Uses;
290  }
291  auto script = dynamic_cast<const ScriptFile *>(asset);
292  if (script) {
293  return script->forMap(this) ? Uses : DoesntUse;
294  }
295  auto arch = dynamic_cast<const ArchetypeWrapper *>(asset);
296  if (arch) {
297  if (myArchetypes.indexOf(arch->wrappedItem()->name) != -1) {
298  return Uses;
299  };
300  for (auto map : myRandomMaps) {
301  if (strcmp(arch->wrappedItem()->name, map->parameters()->final_exit_archetype) == 0) {
302  hint = "random map final exit";
303  return Uses;
304  }
305  }
306  return DoesntUse;
307  }
308  return DoesntUse;
309 }
QuestWrapper.h
ArchetypeWrapper.h
CREMapInformation::shopMax
quint64 shopMax
Definition: CREMapInformation.h:41
CREMapInformation::myBackgroundMusic
QString myBackgroundMusic
Definition: CREMapInformation.h:135
CREMapInformation::myFaces
QSet< QString > myFaces
Definition: CREMapInformation.h:119
CREMapInformation::myShopGreed
double myShopGreed
Definition: CREMapInformation.h:131
CREMapInformation::CREMapInformation
CREMapInformation()
Definition: CREMapInformation.cpp:21
CREMapInformation::accessedFrom
QStringList accessedFrom() const
Definition: CREMapInformation.cpp:146
CREMapInformation::shopGreed
double shopGreed
Definition: CREMapInformation.h:38
archininventory.arch
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
Definition: archininventory.py:16
CREMapInformation::mapTime
const QDateTime & mapTime() const
Definition: CREMapInformation.cpp:125
CREMapInformation::setPath
void setPath(const QString &path)
Definition: CREMapInformation.cpp:59
CREMapInformation::setShopRace
void setShopRace(const QString &race)
Definition: CREMapInformation.cpp:243
send.date
date
Definition: send.py:29
CREMapInformation::myResetGroup
QString myResetGroup
Definition: CREMapInformation.h:136
CREMapInformation::archetypes
QStringList archetypes() const
Definition: CREMapInformation.cpp:94
CREMapInformation::addRandomMap
void addRandomMap(RandomMap *map)
Definition: CREMapInformation.cpp:273
CREMapInformation::resetGroup
QString resetGroup
Definition: CREMapInformation.h:36
CREMapInformation::myRandomMaps
QList< RandomMap * > myRandomMaps
Definition: CREMapInformation.h:134
CREMapInformation::myComputedDifficulty
int myComputedDifficulty
Definition: CREMapInformation.h:125
CREMapInformation::computedDifficulty
int computedDifficulty
Definition: CREMapInformation.h:34
CREMapInformation::myExperience
qint64 myExperience
Definition: CREMapInformation.h:126
CREMapInformation::difficulty
int difficulty
Definition: CREMapInformation.h:33
CREMapInformation::setDifficulty
void setDifficulty(int difficulty)
Definition: CREMapInformation.cpp:162
CREMapInformation::displayName
virtual QString displayName() const override
Definition: CREMapInformation.cpp:47
RandomMap.h
CREMapInformation::shopItems
QHash< QString, int > & shopItems()
Definition: CREMapInformation.cpp:218
QuestWrapper
Definition: QuestWrapper.h:66
CREMapInformation::setResetGroup
void setResetGroup(const QString &resetGroup)
Definition: CREMapInformation.cpp:89
CREMapInformation::messages
QStringList messages() const
Definition: CREMapInformation.cpp:196
CREMapInformation::faces
QStringList faces() const
Definition: CREMapInformation.cpp:105
ArchetypeWrapper
Definition: ArchetypeWrapper.h:25
CREMapInformation::exitsTo
QStringList exitsTo() const
Definition: CREMapInformation.cpp:135
CREMapInformation::shopRace
QString shopRace
Definition: CREMapInformation.h:39
ScriptFile.h
CREMapInformation::myShopMax
quint64 myShopMax
Definition: CREMapInformation.h:133
AnimationWrapper.h
AssetWrapper
Definition: AssetWrapper.h:25
CREMapInformation::setComputedDifficulty
void setComputedDifficulty(int computed)
Definition: CREMapInformation.cpp:172
name
Plugin animator file specs[Config] name
Definition: animfiles.txt:4
CREMapInformation::animations
QStringList animations() const
Definition: CREMapInformation.cpp:115
CREMapInformation::setShopGreed
void setShopGreed(double greed)
Definition: CREMapInformation.cpp:233
CREMapInformation::region
const QString & region() const
Definition: CREMapInformation.cpp:187
quest
Definition: quest.py:1
CREMapInformation::name
QString name
Definition: CREMapInformation.h:32
FaceWrapper
Definition: FaceWrapper.h:24
CREMapInformation::setShopMax
void setShopMax(quint64 max)
Definition: CREMapInformation.cpp:263
CREMapInformation::myQuests
QStringList myQuests
Definition: CREMapInformation.h:129
disinfect.map
map
Definition: disinfect.py:4
CREMapInformation::myDifficulty
int myDifficulty
Definition: CREMapInformation.h:124
RandomMap
Definition: RandomMap.h:24
CREMapInformation::myShopItems
QHash< QString, int > myShopItems
Definition: CREMapInformation.h:130
CREMapInformation::setRegion
void setRegion(const QString &region)
Definition: CREMapInformation.cpp:191
FaceWrapper.h
ScriptFile
Definition: ScriptFile.h:48
CREMapInformation::uses
virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override
Definition: CREMapInformation.cpp:278
CREMapInformation::experience
qint64 experience
Definition: CREMapInformation.h:35
CREMapInformation::quests
QStringList quests() const
Definition: CREMapInformation.cpp:207
AnimationWrapper
Definition: AnimationWrapper.h:24
message
TIPS on SURVIVING Crossfire is populated with a wealth of different monsters These monsters can have varying immunities and attack types In some of them can be quite a bit smarter than others It will be important for new players to learn the abilities of different monsters and learn just how much it will take to kill them This section discusses how monsters can interact with players Most monsters in the game are out to mindlessly kill and destroy the players These monsters will help boost a player s after he kills them When fighting a large amount of monsters in a single attempt to find a narrower hallway so that you are not being attacked from all sides Charging into a room full of Beholders for instance would not be open the door and fight them one at a time For there are several maps designed for them Find these areas and clear them out All throughout these a player can find signs and books which they can read by stepping onto them and hitting A to apply the book sign These messages will help the player to learn the system One more always keep an eye on your food If your food drops to your character will soon so BE CAREFUL ! NPCs Non Player Character are special monsters which have intelligence Players may be able to interact with these monsters to help solve puzzles and find items of interest To speak with a monster you suspect to be a simply move to an adjacent square to them and push the double ie Enter your message
Definition: survival-guide.txt:34
script
Install Bug reporting Credits but rather whatever guild name you are using *With the current map and server there are three they and GreenGoblin *Whatever name you give the folder should but it will still use GUILD_TEMPLATE *You can change what guild it uses by editing the map files Modify Map or objects if you want to use the optional Python based Guild Storage hall The first three are on the main the next two are in the guild_hq and the final one is in hallofjoining Withe the Storage three objects are found on the main floor and the last two are in the basement It s not that but you will need a map editor You find the object that has the script
Definition: README.txt:19
CREMapInformation::addMessage
void addMessage(const QString &message)
Definition: CREMapInformation.cpp:201
CREMapInformation::setShopMin
void setShopMin(quint64 min)
Definition: CREMapInformation.cpp:253
say.max
dictionary max
Definition: say.py:148
CREMapInformation::~CREMapInformation
virtual ~CREMapInformation()
Definition: CREMapInformation.cpp:42
CREMapInformation::addAccessedFrom
void addAccessedFrom(const QString &path)
Definition: CREMapInformation.cpp:151
archetype
Definition: object.h:474
animate.anim
string anim
Definition: animate.py:20
AssetWrapper::PossibleUse
PossibleUse
Definition: AssetWrapper.h:32
CREMapInformation::myArchetypes
QStringList myArchetypes
Definition: CREMapInformation.h:118
path
pluglist shows those as well as a short text describing each the list will simply appear empty The keyword for the Python plugin is Python plugout< keyword > Unloads a given identified by its _keyword_ So if you want to unload the Python you need to do plugout Python plugin< libname > Loads a given whose _filename_ is libname So in the case of you d have to do a plugin cfpython so Note that all filenames are relative to the default plugin path(SHARE/plugins). Console messages. ----------------- When Crossfire starts
CREMapInformation::myRegion
QString myRegion
Definition: CREMapInformation.h:127
CREMapInformation::addAnimation
void addAnimation(const QString &anim)
Definition: CREMapInformation.cpp:120
CREMapInformation::myMessages
QStringList myMessages
Definition: CREMapInformation.h:128
AssetWrapper::Uses
@ Uses
Definition: AssetWrapper.h:32
CREMapInformation::addExitTo
void addExitTo(const QString &path)
Definition: CREMapInformation.cpp:140
CREMapInformation::myShopRace
QString myShopRace
Definition: CREMapInformation.h:132
region
Definition: map.h:273
CREMapInformation::shopMin
quint64 shopMin
Definition: CREMapInformation.h:40
CREMapInformation::myShopMin
quint64 myShopMin
Definition: CREMapInformation.h:133
CREMapInformation::addFace
void addFace(const QString &face)
Definition: CREMapInformation.cpp:110
CREMapInformation::setName
void setName(const QString &name)
Definition: CREMapInformation.cpp:69
CREMapInformation::myName
QString myName
Definition: CREMapInformation.h:117
CREMapInformation::myExitsTo
QStringList myExitsTo
Definition: CREMapInformation.h:122
CREMapInformation::addArchetype
void addArchetype(const QString &archetype)
Definition: CREMapInformation.cpp:99
CREMapInformation::backgroundMusic
QString backgroundMusic
Definition: CREMapInformation.h:37
CREMapInformation::randomMaps
QList< RandomMap * > randomMaps() const
Definition: CREMapInformation.cpp:268
CREMapInformation::setExperience
void setExperience(qint64 experience)
Definition: CREMapInformation.cpp:182
CREMapInformation::myMapTime
QDateTime myMapTime
Definition: CREMapInformation.h:121
CREMapInformation::path
QString path
Definition: CREMapInformation.h:31
CREMapInformation::myAccessedFrom
QStringList myAccessedFrom
Definition: CREMapInformation.h:123
CREMapInformation::myAnimations
QSet< QString > myAnimations
Definition: CREMapInformation.h:120
AssetWrapper::DoesntUse
@ DoesntUse
Definition: AssetWrapper.h:32
CREMapInformation::setMapTime
void setMapTime(const QDateTime &date)
Definition: CREMapInformation.cpp:130
CREMapInformation::myPath
QString myPath
Definition: CREMapInformation.h:116
CREMapInformation::addQuest
void addQuest(const QString &quest)
Definition: CREMapInformation.cpp:212
CREMapInformation::setBackgroundMusic
void setBackgroundMusic(const QString &music)
Definition: CREMapInformation.cpp:79
CREMapInformation.h