1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 06:23:53 +00:00

Merge branch 'levelincrease' into 'master'

Update both instances of level detail text

See merge request OpenMW/openmw!2282
This commit is contained in:
psi29a 2022-08-16 07:17:04 +00:00
commit 1d270e1683

View file

@ -331,6 +331,19 @@ namespace MWGui
MWWorld::Ptr player = MWMechanics::getPlayer(); MWWorld::Ptr player = MWMechanics::getPlayer();
const MWMechanics::NpcStats &PCstats = player.getClass().getNpcStats(player); const MWMechanics::NpcStats &PCstats = player.getClass().getNpcStats(player);
std::string detailText;
std::stringstream detail;
for (int attribute = 0; attribute < ESM::Attribute::Length; ++attribute)
{
float mult = PCstats.getLevelupAttributeMultiplier(attribute);
mult = std::min(mult, 100 - PCstats.getAttribute(attribute).getBase());
if (mult > 1)
detail << (detail.str().empty() ? "" : "\n") << "#{"
<< MyGUI::TextIterator::toTagsString(ESM::Attribute::sGmstAttributeIds[attribute])
<< "} x" << MyGUI::utility::toString(mult);
}
detailText = MyGUI::LanguageManager::getInstance().replaceTags(detail.str());
// level progress // level progress
MyGUI::Widget* levelWidget; MyGUI::Widget* levelWidget;
for (int i=0; i<2; ++i) for (int i=0; i<2; ++i)
@ -342,18 +355,8 @@ namespace MWGui
levelWidget->setUserString("Range_LevelProgress", MyGUI::utility::toString(max)); levelWidget->setUserString("Range_LevelProgress", MyGUI::utility::toString(max));
levelWidget->setUserString("Caption_LevelProgressText", MyGUI::utility::toString(PCstats.getLevelProgress()) + "/" levelWidget->setUserString("Caption_LevelProgressText", MyGUI::utility::toString(PCstats.getLevelProgress()) + "/"
+ MyGUI::utility::toString(max)); + MyGUI::utility::toString(max));
levelWidget->setUserString("Caption_LevelDetailText", detailText);
} }
std::stringstream detail;
for (int attribute = 0; attribute < ESM::Attribute::Length; ++attribute)
{
float mult = PCstats.getLevelupAttributeMultiplier(attribute);
mult = std::min(mult, 100 - PCstats.getAttribute(attribute).getBase());
if (mult > 1)
detail << (detail.str().empty() ? "" : "\n") << "#{"
<< MyGUI::TextIterator::toTagsString(ESM::Attribute::sGmstAttributeIds[attribute])
<< "} x" << MyGUI::utility::toString(mult);
}
levelWidget->setUserString("Caption_LevelDetailText", MyGUI::LanguageManager::getInstance().replaceTags(detail.str()));
setFactions(PCstats.getFactionRanks()); setFactions(PCstats.getFactionRanks());
setExpelled(PCstats.getExpelled ()); setExpelled(PCstats.getExpelled ());