1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-01 20:15:33 +00:00

Do not show magnitude for ingredients

This commit is contained in:
Frederic Chardon 2019-05-06 23:48:13 +00:00 committed by Alexei Dobrohotov
parent 310e19d47f
commit 6619150b23
6 changed files with 15 additions and 3 deletions

View file

@ -156,6 +156,7 @@ namespace MWClass
info.effects = list; info.effects = list;
info.text = text; info.text = text;
info.isIngredient = true;
return info; return info;
} }

View file

@ -249,6 +249,7 @@ namespace MWGui
params.mAttribute = effectKey.mArg; params.mAttribute = effectKey.mArg;
params.mIsConstant = true; params.mIsConstant = true;
params.mNoTarget = true; params.mNoTarget = true;
params.mNoMagnitude = true;
params.mKnown = mAlchemy->knownEffect(effectIndex, MWBase::Environment::get().getWorld()->getPlayerPtr()); params.mKnown = mAlchemy->knownEffect(effectIndex, MWBase::Environment::get().getWorld()->getPlayerPtr());

View file

@ -486,7 +486,9 @@ namespace MWGui
effectsWidget->setEffectList(info.effects); effectsWidget->setEffectList(info.effects);
std::vector<MyGUI::Widget*> effectItems; std::vector<MyGUI::Widget*> effectItems;
effectsWidget->createEffectWidgets(effectItems, effectArea, coord, true, info.isPotion ? Widgets::MWEffectList::EF_NoTarget : 0); int flag = info.isPotion ? Widgets::MWEffectList::EF_NoTarget : 0;
flag |= info.isIngredient ? Widgets::MWEffectList::EF_NoMagnitude : 0;
effectsWidget->createEffectWidgets(effectItems, effectArea, coord, true, flag);
totalSize.height += coord.top-6; totalSize.height += coord.top-6;
totalSize.width = std::max(totalSize.width, coord.width); totalSize.width = std::max(totalSize.width, coord.width);
} }

View file

@ -22,6 +22,7 @@ namespace MWGui
: imageSize(32) : imageSize(32)
, remainingEnchantCharge(-1) , remainingEnchantCharge(-1)
, isPotion(false) , isPotion(false)
, isIngredient(false)
, wordWrap(true) , wordWrap(true)
{} {}
@ -41,6 +42,7 @@ namespace MWGui
std::vector<std::string> notes; std::vector<std::string> notes;
bool isPotion; // potions do not show target in the tooltip bool isPotion; // potions do not show target in the tooltip
bool isIngredient; // ingredients have no effect magnitude
bool wordWrap; bool wordWrap;
}; };

View file

@ -235,6 +235,7 @@ namespace MWGui
params.mRange = effectInfo.mRange; params.mRange = effectInfo.mRange;
params.mIsConstant = (flags & MWEffectList::EF_Constant) != 0; params.mIsConstant = (flags & MWEffectList::EF_Constant) != 0;
params.mNoTarget = (flags & MWEffectList::EF_NoTarget); params.mNoTarget = (flags & MWEffectList::EF_NoTarget);
params.mNoMagnitude = (flags & MWEffectList::EF_NoMagnitude);
effect->setSpellEffect(params); effect->setSpellEffect(params);
effects.push_back(effect); effects.push_back(effect);
coord.top += effect->getHeight(); coord.top += effect->getHeight();
@ -293,6 +294,7 @@ namespace MWGui
effect = creator->createWidget<MWSpellEffect>("MW_EffectImage", coord, MyGUI::Align::Default); effect = creator->createWidget<MWSpellEffect>("MW_EffectImage", coord, MyGUI::Align::Default);
effectInfo.mIsConstant = (flags & EF_Constant) || effectInfo.mIsConstant; effectInfo.mIsConstant = (flags & EF_Constant) || effectInfo.mIsConstant;
effectInfo.mNoTarget = (flags & EF_NoTarget) || effectInfo.mNoTarget; effectInfo.mNoTarget = (flags & EF_NoTarget) || effectInfo.mNoTarget;
effectInfo.mNoMagnitude = (flags & EF_NoMagnitude) || effectInfo.mNoMagnitude;
effect->setSpellEffect(effectInfo); effect->setSpellEffect(effectInfo);
effects.push_back(effect); effects.push_back(effect);
if (effect->getRequestedWidth() > maxwidth) if (effect->getRequestedWidth() > maxwidth)
@ -421,7 +423,7 @@ namespace MWGui
spellLine += formatter.str(); spellLine += formatter.str();
} }
else if ( displayType != ESM::MagicEffect::MDT_None ) { else if ( displayType != ESM::MagicEffect::MDT_None && !mEffectParams.mNoMagnitude) {
spellLine += " " + MyGUI::utility::toString(mEffectParams.mMagnMin); spellLine += " " + MyGUI::utility::toString(mEffectParams.mMagnMin);
if (mEffectParams.mMagnMin != mEffectParams.mMagnMax) if (mEffectParams.mMagnMin != mEffectParams.mMagnMax)
spellLine += to + MyGUI::utility::toString(mEffectParams.mMagnMax); spellLine += to + MyGUI::utility::toString(mEffectParams.mMagnMax);

View file

@ -38,6 +38,7 @@ namespace MWGui
SpellEffectParams() SpellEffectParams()
: mNoTarget(false) : mNoTarget(false)
, mIsConstant(false) , mIsConstant(false)
, mNoMagnitude(false)
, mKnown(true) , mKnown(true)
, mEffectID(-1) , mEffectID(-1)
, mSkill(-1) , mSkill(-1)
@ -52,6 +53,7 @@ namespace MWGui
bool mNoTarget; // potion effects for example have no target (target is always the player) bool mNoTarget; // potion effects for example have no target (target is always the player)
bool mIsConstant; // constant effect means that duration will not be displayed bool mIsConstant; // constant effect means that duration will not be displayed
bool mNoMagnitude; // effect magnitude will not be displayed (e.g ingredients)
bool mKnown; // is this effect known to the player? (If not, will display as a question mark instead) bool mKnown; // is this effect known to the player? (If not, will display as a question mark instead)
@ -218,7 +220,9 @@ namespace MWGui
enum EffectFlags enum EffectFlags
{ {
EF_NoTarget = 0x01, // potions have no target (target is always the player) EF_NoTarget = 0x01, // potions have no target (target is always the player)
EF_Constant = 0x02 // constant effect means that duration will not be displayed EF_Constant = 0x02, // constant effect means that duration will not be displayed
EF_NoMagnitude = 0x04 // ingredients have no magnitude
}; };
void setEffectList(const SpellEffectList& list); void setEffectList(const SpellEffectList& list);