mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +02:00
Seerhut meta strings
This commit is contained in:
parent
00c8c2eb82
commit
41da252e67
@ -181,20 +181,20 @@ bool CQuest::checkQuest(const CGHeroInstance * h) const
|
||||
|
||||
void CQuest::getVisitText(MetaString &iwText, std::vector<Component> &components, bool isCustom, bool firstVisit, const CGHeroInstance * h) const
|
||||
{
|
||||
std::string text;
|
||||
MetaString text;
|
||||
bool failRequirements = (h ? !checkQuest(h) : true);
|
||||
|
||||
if(firstVisit)
|
||||
{
|
||||
isCustom = isCustomFirst;
|
||||
text = firstVisitText;
|
||||
iwText.appendRawString(text);
|
||||
iwText.appendRawString(text.toString());
|
||||
}
|
||||
else if(failRequirements)
|
||||
{
|
||||
isCustom = isCustomNext;
|
||||
text = nextVisitText;
|
||||
iwText.appendRawString(text);
|
||||
iwText.appendRawString(text.toString());
|
||||
}
|
||||
switch (missionType)
|
||||
{
|
||||
@ -223,7 +223,7 @@ void CQuest::getVisitText(MetaString &iwText, std::vector<Component> &components
|
||||
case MISSION_KILL_HERO:
|
||||
components.emplace_back(Component::EComponentType::HERO_PORTRAIT, heroPortrait, 0, 0);
|
||||
if(!isCustom)
|
||||
addReplacements(iwText, text);
|
||||
addReplacements(iwText, text.toString());
|
||||
break;
|
||||
case MISSION_HERO:
|
||||
//FIXME: portrait may not match hero, if custom portrait was set in map editor
|
||||
@ -236,7 +236,7 @@ void CQuest::getVisitText(MetaString &iwText, std::vector<Component> &components
|
||||
components.emplace_back(stackToKill);
|
||||
if(!isCustom)
|
||||
{
|
||||
addReplacements(iwText, text);
|
||||
addReplacements(iwText, text.toString());
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -286,7 +286,7 @@ void CQuest::getVisitText(MetaString &iwText, std::vector<Component> &components
|
||||
case MISSION_PLAYER:
|
||||
components.emplace_back(Component::EComponentType::FLAG, m13489val, 0, 0);
|
||||
if(!isCustom)
|
||||
iwText.replaceRawString(VLC->generaltexth->colors[m13489val]);
|
||||
iwText.replaceLocalString(EMetaText::COLOR, m13489val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -380,7 +380,7 @@ void CQuest::getRolloverText(MetaString &ms, bool onHover) const
|
||||
|
||||
void CQuest::getCompletionText(MetaString &iwText) const
|
||||
{
|
||||
iwText.appendRawString(completedText);
|
||||
iwText.appendRawString(completedText.toString());
|
||||
switch(missionType)
|
||||
{
|
||||
case CQuest::MISSION_LEVEL:
|
||||
@ -388,22 +388,22 @@ void CQuest::getCompletionText(MetaString &iwText) const
|
||||
iwText.replaceNumber(m13489val);
|
||||
break;
|
||||
case CQuest::MISSION_PRIMARY_STAT:
|
||||
if (vstd::contains (completedText,'%')) //there's one case when there's nothing to replace
|
||||
{
|
||||
MetaString loot;
|
||||
assert(m2stats.size() <= 4);
|
||||
for (int i = 0; i < m2stats.size(); ++i)
|
||||
{
|
||||
MetaString loot;
|
||||
for (int i = 0; i < 4; ++i)
|
||||
if (m2stats[i])
|
||||
{
|
||||
if (m2stats[i])
|
||||
{
|
||||
loot.appendRawString("%d %s");
|
||||
loot.replaceNumber(m2stats[i]);
|
||||
loot.replaceRawString(VLC->generaltexth->primarySkillNames[i]);
|
||||
}
|
||||
loot.appendRawString("%d %s");
|
||||
loot.replaceNumber(m2stats[i]);
|
||||
loot.replaceRawString(VLC->generaltexth->primarySkillNames[i]);
|
||||
}
|
||||
if (!isCustomComplete)
|
||||
iwText.replaceRawString(loot.buildList());
|
||||
}
|
||||
if (!isCustomComplete)
|
||||
iwText.replaceRawString(loot.buildList());
|
||||
break;
|
||||
}
|
||||
case CQuest::MISSION_ART:
|
||||
{
|
||||
MetaString loot;
|
||||
@ -447,7 +447,7 @@ void CQuest::getCompletionText(MetaString &iwText) const
|
||||
case MISSION_KILL_HERO:
|
||||
case MISSION_KILL_CREATURE:
|
||||
if (!isCustomComplete)
|
||||
addReplacements(iwText, completedText);
|
||||
addReplacements(iwText, completedText.toString());
|
||||
break;
|
||||
case MISSION_HERO:
|
||||
if (!isCustomComplete)
|
||||
@ -470,9 +470,9 @@ void CQuest::serializeJson(JsonSerializeFormat & handler, const std::string & fi
|
||||
{
|
||||
auto q = handler.enterStruct(fieldName);
|
||||
|
||||
handler.serializeString("firstVisitText", firstVisitText);
|
||||
handler.serializeString("nextVisitText", nextVisitText);
|
||||
handler.serializeString("completedText", completedText);
|
||||
handler.serializeStruct("firstVisitText", firstVisitText);
|
||||
handler.serializeStruct("nextVisitText", nextVisitText);
|
||||
handler.serializeStruct("completedText", completedText);
|
||||
|
||||
if(!handler.saving)
|
||||
{
|
||||
@ -585,16 +585,16 @@ void CGSeerHut::initObj(CRandomGenerator & rand)
|
||||
std::string questName = quest->missionName(quest->missionType);
|
||||
|
||||
if(!quest->isCustomFirst)
|
||||
quest->firstVisitText = VLC->generaltexth->translate("core.seerhut.quest." + questName + "." + quest->missionState(0), quest->textOption);
|
||||
quest->firstVisitText.appendTextID(TextIdentifier("core", "seerhut", "quest", questName, quest->missionState(0), quest->textOption).get());
|
||||
if(!quest->isCustomNext)
|
||||
quest->nextVisitText = VLC->generaltexth->translate("core.seerhut.quest." + questName + "." + quest->missionState(1), quest->textOption);
|
||||
quest->firstVisitText.appendTextID(TextIdentifier("core", "seerhut", "quest", questName, quest->missionState(1), quest->textOption).get());
|
||||
if(!quest->isCustomComplete)
|
||||
quest->completedText = VLC->generaltexth->translate("core.seerhut.quest." + questName + "." + quest->missionState(2), quest->textOption);
|
||||
quest->firstVisitText.appendTextID(TextIdentifier("core", "seerhut", "quest", questName, quest->missionState(2), quest->textOption).get());
|
||||
}
|
||||
else
|
||||
{
|
||||
quest->progress = CQuest::COMPLETE;
|
||||
quest->firstVisitText = VLC->generaltexth->seerEmpty[quest->completedOption];
|
||||
quest->firstVisitText.appendTextID(TextIdentifier("core", "seehut", "empty", quest->completedOption).get());
|
||||
}
|
||||
|
||||
quest->getCompletionText(configuration.onSelect);
|
||||
@ -639,7 +639,7 @@ void CQuest::addReplacements(MetaString &out, const std::string &base) const
|
||||
}
|
||||
break;
|
||||
case MISSION_KILL_HERO:
|
||||
out.replaceRawString(heroName);
|
||||
out.replaceTextID(heroName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "CRewardableObject.h"
|
||||
#include "../ResourceSet.h"
|
||||
#include "../MetaString.h"
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
@ -70,7 +71,7 @@ public:
|
||||
std::string heroName; //backup of hero name
|
||||
si32 heroPortrait;
|
||||
|
||||
std::string firstVisitText, nextVisitText, completedText;
|
||||
MetaString firstVisitText, nextVisitText, completedText;
|
||||
bool isCustomFirst;
|
||||
bool isCustomNext;
|
||||
bool isCustomComplete;
|
||||
|
@ -2072,9 +2072,9 @@ void CMapLoaderH3M::readQuest(IQuestObject * guard, const int3 & position)
|
||||
}
|
||||
|
||||
guard->quest->lastDay = reader->readInt32();
|
||||
guard->quest->firstVisitText = readLocalizedString(TextIdentifier("quest", position.x, position.y, position.z, "firstVisit"));
|
||||
guard->quest->nextVisitText = readLocalizedString(TextIdentifier("quest", position.x, position.y, position.z, "nextVisit"));
|
||||
guard->quest->completedText = readLocalizedString(TextIdentifier("quest", position.x, position.y, position.z, "completed"));
|
||||
guard->quest->firstVisitText.appendTextID(readLocalizedString(TextIdentifier("quest", position.x, position.y, position.z, "firstVisit")));
|
||||
guard->quest->nextVisitText.appendTextID(readLocalizedString(TextIdentifier("quest", position.x, position.y, position.z, "nextVisit")));
|
||||
guard->quest->completedText.appendTextID(readLocalizedString(TextIdentifier("quest", position.x, position.y, position.z, "completed")));
|
||||
guard->quest->isCustomFirst = !guard->quest->firstVisitText.empty();
|
||||
guard->quest->isCustomNext = !guard->quest->nextVisitText.empty();
|
||||
guard->quest->isCustomComplete = !guard->quest->completedText.empty();
|
||||
|
Loading…
x
Reference in New Issue
Block a user