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