Magic Effect descriptions: support feet / level modes.

Show proper suffixes for all magnitudes.
Drop extra 'times' symbol in 'timesInt format (not consistent
with other magnitude displays).
pull/37/head
Jordan Ayers 11 years ago
parent 296b2ab870
commit 6e4978643c

@ -172,7 +172,7 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->getGameSettingString( MWBase::Environment::get().getWindowManager()->getGameSettingString(
ESM::Attribute::sGmstAttributeIds[effectIt->mKey.mArg], "") + ")"; ESM::Attribute::sGmstAttributeIds[effectIt->mKey.mArg], "") + ")";
int displayType = effect->getMagnitudeDisplayType(); ESM::MagicEffect::MagnitudeDisplayType displayType = effect->getMagnitudeDisplayType();
if (displayType == ESM::MagicEffect::MDT_TimesInt) if (displayType == ESM::MagicEffect::MDT_TimesInt)
{ {
std::string timesInt = MWBase::Environment::get().getWindowManager()->getGameSettingString("sXTimesINT", ""); std::string timesInt = MWBase::Environment::get().getWindowManager()->getGameSettingString("sXTimesINT", "");
@ -182,15 +182,24 @@ namespace MWGui
} }
else if ( displayType != ESM::MagicEffect::MDT_None ) else if ( displayType != ESM::MagicEffect::MDT_None )
{ {
std::string pt = MWBase::Environment::get().getWindowManager()->getGameSettingString("spoint", "");
std::string pts = MWBase::Environment::get().getWindowManager()->getGameSettingString("spoints", "");
std::string pct = MWBase::Environment::get().getWindowManager()->getGameSettingString("spercent", "");
sourcesDescription += ": " + boost::lexical_cast<std::string>(effectIt->mMagnitude); sourcesDescription += ": " + boost::lexical_cast<std::string>(effectIt->mMagnitude);
if ( displayType == ESM::MagicEffect::MDT_Percentage ) if ( displayType == ESM::MagicEffect::MDT_Percentage )
sourcesDescription += pct; sourcesDescription += MWBase::Environment::get().getWindowManager()->getGameSettingString("spercent", "");
else if ( displayType == ESM::MagicEffect::MDT_Feet )
sourcesDescription += " " + MWBase::Environment::get().getWindowManager()->getGameSettingString("sfeet", "");
else if ( displayType == ESM::MagicEffect::MDT_Level )
{
sourcesDescription += " " + ((effectIt->mMagnitude > 1) ?
MWBase::Environment::get().getWindowManager()->getGameSettingString("sLevels", "") :
MWBase::Environment::get().getWindowManager()->getGameSettingString("sLevel", "") );
}
else // ESM::MagicEffect::MDT_Points else // ESM::MagicEffect::MDT_Points
sourcesDescription += " " + ((effectIt->mMagnitude > 1) ? pts : pt); {
sourcesDescription += " " + ((effectIt->mMagnitude > 1) ?
MWBase::Environment::get().getWindowManager()->getGameSettingString("spoints", "") :
MWBase::Environment::get().getWindowManager()->getGameSettingString("spoint", "") );
}
} }
} }

@ -409,6 +409,9 @@ namespace MWGui
std::string pt = MWBase::Environment::get().getWindowManager()->getGameSettingString("spoint", ""); std::string pt = MWBase::Environment::get().getWindowManager()->getGameSettingString("spoint", "");
std::string pts = MWBase::Environment::get().getWindowManager()->getGameSettingString("spoints", ""); std::string pts = MWBase::Environment::get().getWindowManager()->getGameSettingString("spoints", "");
std::string pct = MWBase::Environment::get().getWindowManager()->getGameSettingString("spercent", ""); std::string pct = MWBase::Environment::get().getWindowManager()->getGameSettingString("spercent", "");
std::string ft = MWBase::Environment::get().getWindowManager()->getGameSettingString("sfeet", "");
std::string lvl = MWBase::Environment::get().getWindowManager()->getGameSettingString("sLevel", "");
std::string lvls = MWBase::Environment::get().getWindowManager()->getGameSettingString("sLevels", "");
std::string to = " " + MWBase::Environment::get().getWindowManager()->getGameSettingString("sTo", "") + " "; std::string to = " " + MWBase::Environment::get().getWindowManager()->getGameSettingString("sTo", "") + " ";
std::string sec = " " + MWBase::Environment::get().getWindowManager()->getGameSettingString("ssecond", ""); std::string sec = " " + MWBase::Environment::get().getWindowManager()->getGameSettingString("ssecond", "");
std::string secs = " " + MWBase::Environment::get().getWindowManager()->getGameSettingString("sseconds", ""); std::string secs = " " + MWBase::Environment::get().getWindowManager()->getGameSettingString("sseconds", "");
@ -426,15 +429,14 @@ namespace MWGui
} }
if (mEffectParams.mMagnMin >= 0 || mEffectParams.mMagnMax >= 0) { if (mEffectParams.mMagnMin >= 0 || mEffectParams.mMagnMax >= 0) {
int displayType = magicEffect->getMagnitudeDisplayType(); ESM::MagicEffect::MagnitudeDisplayType displayType = magicEffect->getMagnitudeDisplayType();
if ( displayType == ESM::MagicEffect::MDT_TimesInt ) { if ( displayType == ESM::MagicEffect::MDT_TimesInt ) {
std::string timesInt = MWBase::Environment::get().getWindowManager()->getGameSettingString("sXTimesINT", ""); std::string timesInt = MWBase::Environment::get().getWindowManager()->getGameSettingString("sXTimesINT", "");
std::string times = MWBase::Environment::get().getWindowManager()->getGameSettingString("sXTimes", "");
std::stringstream formatter; std::stringstream formatter;
formatter << std::fixed << std::setprecision(1) << " " << (mEffectParams.mMagnMin / 10.0f); formatter << std::fixed << std::setprecision(1) << " " << (mEffectParams.mMagnMin / 10.0f);
if (mEffectParams.mMagnMin != mEffectParams.mMagnMax) if (mEffectParams.mMagnMin != mEffectParams.mMagnMax)
formatter << times << to << (mEffectParams.mMagnMax / 10.0f); formatter << to << (mEffectParams.mMagnMax / 10.0f);
formatter << timesInt; formatter << timesInt;
spellLine += formatter.str(); spellLine += formatter.str();
@ -446,6 +448,10 @@ namespace MWGui
if ( displayType == ESM::MagicEffect::MDT_Percentage ) if ( displayType == ESM::MagicEffect::MDT_Percentage )
spellLine += pct; spellLine += pct;
else if ( displayType == ESM::MagicEffect::MDT_Feet )
spellLine += " " + ft;
else if ( displayType == ESM::MagicEffect::MDT_Level )
spellLine += " " + ((mEffectParams.mMagnMin == 1 && mEffectParams.mMagnMax == 1) ? lvl : lvls );
else // ESM::MagicEffect::MDT_Points else // ESM::MagicEffect::MDT_Points
spellLine += " " + ((mEffectParams.mMagnMin == 1 && mEffectParams.mMagnMax == 1) ? pt : pts ); spellLine += " " + ((mEffectParams.mMagnMin == 1 && mEffectParams.mMagnMax == 1) ? pt : pts );
} }

Loading…
Cancel
Save