58 #include "resources/map/map.h"
70 this, mQuestsModel,
"extendedlistbox.xml", 13)),
73 "quests_list_background.xml")),
79 "quests_text_background.xml")),
82 mCompleteIcon(
Theme::getImageFromThemeXml(
"complete_icon.xml",
"")),
83 mIncompleteIcon(
Theme::getImageFromThemeXml(
"incomplete_icon.xml",
"")),
91 mNewQuestEffectId(
paths.getIntValue(
"newQuestEffectId")),
92 mCompleteQuestEffectId(
paths.getIntValue(
"completeQuestEffectId")),
162 const std::string &eventId =
event.getId();
163 if (eventId ==
"select")
170 else if (eventId ==
"close")
182 (*mVars)[var] =
QuestVar(val1, val2, val3, time1);
192 STD_VECTOR<QuestItem*> complete;
193 STD_VECTOR<QuestItem*> incomplete;
194 STD_VECTOR<QuestItem*> hidden;
195 int updatedQuest = -1;
196 int newCompleteStatus = -1;
200 const int var = (*it).first;
202 const STD_VECTOR<QuestItem*> &quests = (*mQuests)[var];
203 FOR_EACH (STD_VECTOR<QuestItem*>::const_iterator, it2, quests)
211 complete.push_back(quest);
217 incomplete.push_back(quest);
222 hidden.push_back(quest);
229 for (STD_VECTOR<QuestItem*>::const_iterator it = complete.begin(),
230 it_end = complete.end(); it != it_end; ++ it, k ++)
237 newCompleteStatus = 1;
242 names.push_back(quest->
name);
250 images.push_back(
nullptr);
254 for (STD_VECTOR<QuestItem*>::const_iterator it = incomplete.begin(),
255 it_end = incomplete.end(); it != it_end; ++ it, k ++)
261 newCompleteStatus = 0;
266 names.push_back(quest->
name);
274 images.push_back(
nullptr);
278 FOR_EACH (STD_VECTOR<QuestItem*>::const_iterator, it, hidden)
279 (*it)->completeFlag = -1;
281 if (updatedQuest == -1 || updatedQuest >=
CAST_S32(
286 if (updatedQuest >= 0)
292 switch (newCompleteStatus)
312 if (quest ==
nullptr)
315 const STD_VECTOR<QuestItemText> &texts = quest->
texts;
322 FOR_EACH (STD_VECTOR<QuestItemText>::const_iterator, it, texts)
325 std::string text =
data.text;
338 mText->
addRow(std::string(
"[").append(text).append(
"]"),
344 _(
"Reward:")).append(
352 _(
"Quest Giver:")).append(
394 if ((effect !=
nullptr) && name == effect->
map)
406 FOR_EACH (STD_VECTOR<const QuestEffect*>::const_iterator,
410 if (effect !=
nullptr)
413 if (varIt !=
mVars->end())
415 const std::set<int> &vals = effect->
values;
416 if (vals.find((*
mVars)[effect->
var].var1) != vals.end())
424 std::set<BeingTypeId> removeEffects;
425 std::map<BeingTypeId, int> addEffects;
436 removeEffects.insert(
id);
440 const QuestEffect *
const newEffect = (*itNew).second;
441 if (effect != newEffect)
443 addEffects[id] = newEffect->
effectId;
444 removeEffects.insert(
id);
457 if (itNew == oldNpc.end())
460 if (!removeEffects.empty() || !addEffects.empty())
466 if (being ==
nullptr)
469 const std::map<BeingTypeId, const QuestEffect*>::const_iterator
474 if (effect !=
nullptr)
486 const int listPos = (*it).second;
ActorManager * actorManager
#define fromBool(val, name)
void updateEffects(const std::map< BeingTypeId, int > &addEffects, const std::set< BeingTypeId > &removeEffects) const
BeingTypeId getSubType() const
void addSpecialEffect(const int effect)
void addRow(const std::string &row, const bool atTop)
void setLinkHandler(LinkHandler *linkHandler)
void setOpaque(Opaque opaque)
bool trigger(const int id, Being *const being, const int rotation)
std::vector< Image * > & getImages()
Font * getNpcFont() const
void setRowHeight(const int n, const int h)
void setRowHeight(unsigned int n)
void setSelected(const int selected)
const std::string getProperty(const std::string &name, const std::string &def) const
QuestsModel * mQuestsModel
ScrollArea * mQuestScrollArea
std::vector< const QuestEffect * > mMapEffects
void addEffect(Being *const being)
NpcQuestEffectMap mNpcEffects
void action(const ActionEvent &event)
int mCompleteQuestEffectId
ExtendedListBox * mQuestsListBox
ItemLinkHandler * mItemLinkHandler
std::map< int, int > mQuestReverseLinks
std::map< int, std::vector< QuestItem * > > * mQuests
void updateQuest(const int var, const int val1, const int val2, const int val3, const int time1)
std::vector< QuestItem * > mQuestLinks
void rebuild(const bool playSound)
ScrollArea * mTextScrollArea
void selectQuest(const int varId)
void showQuest(const QuestItem *const quest)
std::vector< QuestEffect * > * mAllEffects
void setMap(const Map *const map)
void registerWindowForReset(Window *const window)
void setSaveVisible(const bool save)
void setResizable(const bool resize)
ContainerPlacer getPlacer(const int x, const int y)
virtual void setVisible(Visible visible)
void setWindowName(const std::string &name)
void setMinHeight(const int height)
void setMinWidth(const int width)
void enableVisibleSound(bool b)
void setCloseButton(const bool flag)
void setStickyButtonLock(const bool sticky)
EffectManager * effectManager
#define FOR_EACHP(type, iter, array)
#define FOR_EACH(type, iter, array)
LocalPlayer * localPlayer
std::string toString(T const &value)
converts any type to a string
NpcQuestVarMap * getVars()
std::map< int, std::vector< QuestItem * > > * getQuests()
std::vector< QuestEffect * > * getAllEffects()
std::map< int, std::vector< QuestItem * > > mQuests
std::vector< QuestEffect * > mAllEffects
QuestsWindow * questsWindow
std::map< BeingTypeId, const QuestEffect * > NpcQuestEffectMap
NpcQuestEffectMap::const_iterator NpcQuestEffectMapCIter
NpcQuestVarMap::const_iterator NpcQuestVarMapCIter
SetupWindow * setupWindow
std::string & replaceAll(std::string &context, const std::string &from, const std::string &to)
std::string strprintf(const char *const format,...)
std::string timeDiffToString(int timeDiff)
std::vector< std::string > StringVect
std::vector< QuestItemText > texts
std::set< int > incomplete