|
|
@@ -41,6 +41,7 @@
|
|
|
#include "../../lib/networkPacks/ArtifactLocation.h"
|
|
|
#include "../../lib/texts/CGeneralTextHandler.h"
|
|
|
#include "../../lib/texts/TextOperations.h"
|
|
|
+#include "../../lib/texts/Languages.h"
|
|
|
|
|
|
class CCreatureArtifactInstance;
|
|
|
class CSelectableSkill;
|
|
|
@@ -232,19 +233,23 @@ CStackWindow::ActiveSpellsSection::ActiveSpellsSection(CStackWindow * owner, int
|
|
|
|
|
|
if (hasGraphics)
|
|
|
{
|
|
|
- spellText = LIBRARY->generaltexth->allTexts[610]; //"%s, duration: %d rounds."
|
|
|
- boost::replace_first(spellText, "%s", spell->getNameTranslated());
|
|
|
- //FIXME: support permanent duration
|
|
|
auto spellBonuses = battleStack->getBonuses(Selector::source(BonusSource::SPELL_EFFECT, BonusSourceID(effect)));
|
|
|
if (spellBonuses->empty())
|
|
|
throw std::runtime_error("Failed to find effects for spell " + effect.toSpell()->getJsonKey());
|
|
|
|
|
|
int duration = spellBonuses->front()->turnsRemain;
|
|
|
- boost::replace_first(spellText, "%d", std::to_string(duration));
|
|
|
+ std::string preferredLanguage = LIBRARY->generaltexth->getPreferredLanguage();
|
|
|
+
|
|
|
+ MetaString spellText;
|
|
|
+ spellText.appendTextID(spell->getDescriptionTextID(0)); // TODO: select correct mastery level?
|
|
|
+ spellText.appendRawString("\n");
|
|
|
+ spellText.appendTextID(Languages::getPluralFormTextID( preferredLanguage, duration, "vcmi.battleResultsWindow.spellDurationRemaining"));
|
|
|
+ spellText.replaceNumber(duration);
|
|
|
+ std::string spellDescription = spellText.toString();
|
|
|
|
|
|
spellIcons.push_back(std::make_shared<CAnimImage>(AnimationPath::builtin("SpellInt"), effect + 1, 0, firstPos.x + offset.x * printed, firstPos.y + offset.y * printed));
|
|
|
labels.push_back(std::make_shared<CLabel>(firstPos.x + offset.x * printed + 46, firstPos.y + offset.y * printed + 36, EFonts::FONT_TINY, ETextAlignment::BOTTOMRIGHT, Colors::WHITE, std::to_string(duration)));
|
|
|
- clickableAreas.push_back(std::make_shared<LRClickableAreaWText>(Rect(firstPos + offset * printed, Point(50, 38)), spellText, spellText));
|
|
|
+ clickableAreas.push_back(std::make_shared<LRClickableAreaWText>(Rect(firstPos + offset * printed, Point(50, 38)), spellDescription, spellDescription));
|
|
|
if(++printed >= 8) // interface limit reached
|
|
|
break;
|
|
|
}
|