void CQuest::getRolloverText (MetaString &ms, bool onHover) const { if (onHover) ms << "\n\n"; ms << VLC->generaltexth->quests[missionType-1][onHover ? 3 : 4][textOption]; switch (missionType) { case MISSION_LEVEL: ms.addReplacement(m13489val); break; case MISSION_PRIMARY_STAT: { MetaString loot; for (int i = 0; i < 4; ++i) { if (m2stats[i]) { loot << "%d %s"; loot.addReplacement(m2stats[i]); loot.addReplacement(VLC->generaltexth->primarySkillNames[i]); } } ms.addReplacement(loot.buildList()); } break; case MISSION_KILL_HERO: ms.addReplacement(heroName); break; case MISSION_KILL_CREATURE: ms.addReplacement(stackToKill); break; case MISSION_ART: { MetaString loot; for (auto & elem : m5arts) { loot << "%s"; loot.addReplacement(MetaString::ART_NAMES, elem); } ms.addReplacement(loot.buildList()); } break; case MISSION_ARMY: { MetaString loot; for (auto & elem : m6creatures) { loot << "%s"; loot.addReplacement(elem); } ms.addReplacement(loot.buildList()); } break; case MISSION_RESOURCES: { MetaString loot; for (int i = 0; i < 7; ++i) { if (m7resources[i]) { loot << "%d %s"; loot.addReplacement(m7resources[i]); loot.addReplacement(MetaString::RES_NAMES, i); } } ms.addReplacement(loot.buildList()); } break; case MISSION_HERO: ms.addReplacement(VLC->heroh->heroes[m13489val]->name); break; case MISSION_PLAYER: ms.addReplacement(VLC->generaltexth->colors[m13489val]); break; default: break; } }
void CQuest::getCompletionText (MetaString &iwText, std::vector<Component> &components, bool isCustom, const CGHeroInstance * h) const { iwText << completedText; switch (missionType) { case CQuest::MISSION_LEVEL: if (!isCustomComplete) iwText.addReplacement(m13489val); break; case CQuest::MISSION_PRIMARY_STAT: if (vstd::contains (completedText,'%')) //there's one case when there's nothing to replace { MetaString loot; for (int i = 0; i < 4; ++i) { if (m2stats[i]) { loot << "%d %s"; loot.addReplacement(m2stats[i]); loot.addReplacement(VLC->generaltexth->primarySkillNames[i]); } } if (!isCustomComplete) iwText.addReplacement(loot.buildList()); } break; case CQuest::MISSION_ART: { MetaString loot; for (auto & elem : m5arts) { loot << "%s"; loot.addReplacement(MetaString::ART_NAMES, elem); } if (!isCustomComplete) iwText.addReplacement(loot.buildList()); } break; case CQuest::MISSION_ARMY: { MetaString loot; for (auto & elem : m6creatures) { loot << "%s"; loot.addReplacement(elem); } if (!isCustomComplete) iwText.addReplacement(loot.buildList()); } break; case CQuest::MISSION_RESOURCES: { MetaString loot; for (int i = 0; i < 7; ++i) { if (m7resources[i]) { loot << "%d %s"; loot.addReplacement(m7resources[i]); loot.addReplacement(MetaString::RES_NAMES, i); } } if (!isCustomComplete) iwText.addReplacement(loot.buildList()); } break; case MISSION_KILL_HERO: case MISSION_KILL_CREATURE: if (!isCustomComplete) addReplacements(iwText, completedText); break; case MISSION_HERO: if (!isCustomComplete) iwText.addReplacement(VLC->heroh->heroes[m13489val]->name); break; case MISSION_PLAYER: if (!isCustomComplete) iwText.addReplacement(VLC->generaltexth->colors[m13489val]); break; } }
void CQuest::getVisitText (MetaString &iwText, std::vector<Component> &components, bool isCustom, bool firstVisit, const CGHeroInstance * h) const { std::string text; bool failRequirements = (h ? !checkQuest(h) : true); if (firstVisit) { isCustom = isCustomFirst; iwText << (text = firstVisitText); } else if (failRequirements) { isCustom = isCustomNext; iwText << (text = nextVisitText); } switch (missionType) { case MISSION_LEVEL: components.push_back(Component (Component::EXPERIENCE, 0, m13489val, 0)); if (!isCustom) iwText.addReplacement(m13489val); break; case MISSION_PRIMARY_STAT: { MetaString loot; for (int i = 0; i < 4; ++i) { if (m2stats[i]) { components.push_back(Component (Component::PRIM_SKILL, i, m2stats[i], 0)); loot << "%d %s"; loot.addReplacement(m2stats[i]); loot.addReplacement(VLC->generaltexth->primarySkillNames[i]); } } if (!isCustom) iwText.addReplacement(loot.buildList()); } break; case MISSION_KILL_HERO: components.push_back(Component(Component::HERO_PORTRAIT, heroPortrait, 0, 0)); if (!isCustom) addReplacements(iwText, text); break; case MISSION_HERO: //FIXME: portrait may not match hero, if custom portrait was set in map editor components.push_back(Component (Component::HERO_PORTRAIT, VLC->heroh->heroes[m13489val]->imageIndex, 0, 0)); if (!isCustom) iwText.addReplacement(VLC->heroh->heroes[m13489val]->name); break; case MISSION_KILL_CREATURE: { components.push_back(Component(stackToKill)); if (!isCustom) { addReplacements(iwText, text); } } break; case MISSION_ART: { MetaString loot; for (auto & elem : m5arts) { components.push_back(Component (Component::ARTIFACT, elem, 0, 0)); loot << "%s"; loot.addReplacement(MetaString::ART_NAMES, elem); } if (!isCustom) iwText.addReplacement(loot.buildList()); } break; case MISSION_ARMY: { MetaString loot; for (auto & elem : m6creatures) { components.push_back(Component(elem)); loot << "%s"; loot.addReplacement(elem); } if (!isCustom) iwText.addReplacement(loot.buildList()); } break; case MISSION_RESOURCES: { MetaString loot; for (int i = 0; i < 7; ++i) { if (m7resources[i]) { components.push_back(Component (Component::RESOURCE, i, m7resources[i], 0)); loot << "%d %s"; loot.addReplacement(m7resources[i]); loot.addReplacement(MetaString::RES_NAMES, i); } } if (!isCustom) iwText.addReplacement(loot.buildList()); } break; case MISSION_PLAYER: components.push_back(Component (Component::FLAG, m13489val, 0, 0)); if (!isCustom) iwText.addReplacement(VLC->generaltexth->colors[m13489val]); break; } }