1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Hnadling of Shrine messages now matches H3

This commit is contained in:
Ivan Savenko
2023-10-17 16:35:34 +03:00
parent 927ce4e60e
commit eedaa63f5f
5 changed files with 66 additions and 18 deletions

View File

@@ -293,13 +293,28 @@ void Rewardable::Info::configureRewards(
info.visitType = event;
info.message = loadMessage(reward["message"], TextIdentifier(objectTextID, modeName, i));
info.description = loadMessage(reward["description"], TextIdentifier(objectTextID, "description", modeName, i));
info.description = loadMessage(reward["description"], TextIdentifier(objectTextID, "description", modeName, i), EMetaText::GENERAL_TXT);
for (const auto & artifact : info.reward.artifacts )
{
info.message.replaceLocalString(EMetaText::ART_NAMES, artifact.getNum());
info.description.replaceLocalString(EMetaText::ART_NAMES, artifact.getNum());
}
for (const auto & artifact : info.reward.spells )
{
info.message.replaceLocalString(EMetaText::SPELL_NAME, artifact.getNum());
info.description.replaceLocalString(EMetaText::SPELL_NAME, artifact.getNum());
}
for (const auto & variable : object.variables.values )
{
if( boost::algorithm::starts_with(variable.first, "spell"))
{
info.message.replaceLocalString(EMetaText::SPELL_NAME, variable.second);
info.description.replaceLocalString(EMetaText::SPELL_NAME, variable.second);
}
}
object.info.push_back(info);
}
@@ -331,6 +346,10 @@ void Rewardable::Info::configureObject(Rewardable::Configuration & object, CRand
Rewardable::VisitInfo onVisited;
onVisited.visitType = Rewardable::EEventType::EVENT_ALREADY_VISITED;
onVisited.message = loadMessage(parameters["onVisitedMessage"], TextIdentifier(objectTextID, "onVisited"));
for (const auto & variable : object.variables.values )
if( boost::algorithm::starts_with(variable.first, "spell"))
onVisited.message.replaceLocalString(EMetaText::SPELL_NAME, variable.second);
object.info.push_back(onVisited);
}
@@ -339,6 +358,10 @@ void Rewardable::Info::configureObject(Rewardable::Configuration & object, CRand
Rewardable::VisitInfo onEmpty;
onEmpty.visitType = Rewardable::EEventType::EVENT_NOT_AVAILABLE;
onEmpty.message = loadMessage(parameters["onEmptyMessage"], TextIdentifier(objectTextID, "onEmpty"));
for (const auto & variable : object.variables.values )
if( boost::algorithm::starts_with(variable.first, "spell"))
onEmpty.message.replaceLocalString(EMetaText::SPELL_NAME, variable.second);
object.info.push_back(onEmpty);
}
@@ -371,7 +394,8 @@ void Rewardable::Info::configureObject(Rewardable::Configuration & object, CRand
}
}
configureLimiter(object, rng, object.visitLimiter, parameters["visitLimiter"]);
if (object.visitMode == Rewardable::VISIT_LIMITER)
configureLimiter(object, rng, object.visitLimiter, parameters["visitLimiter"]);
}