1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 05:23:51 +00:00

Use fWortChanceValue for making ingredient/potion effects visible

This commit is contained in:
scrawl 2013-11-21 05:01:55 +01:00
parent 320ba98097
commit 61ab6e1739
2 changed files with 13 additions and 9 deletions

View file

@ -156,6 +156,9 @@ namespace MWClass
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player); MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player);
int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase(); int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase();
static const float fWortChanceValue =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fWortChanceValue")->getFloat();
MWGui::Widgets::SpellEffectList list; MWGui::Widgets::SpellEffectList list;
for (int i=0; i<4; ++i) for (int i=0; i<4; ++i)
{ {
@ -166,10 +169,10 @@ namespace MWClass
params.mAttribute = ref->mBase->mData.mAttributes[i]; params.mAttribute = ref->mBase->mData.mAttributes[i];
params.mSkill = ref->mBase->mData.mSkills[i]; params.mSkill = ref->mBase->mData.mSkills[i];
params.mKnown = ( (i == 0 && alchemySkill >= 15) params.mKnown = ( (i == 0 && alchemySkill >= fWortChanceValue)
|| (i == 1 && alchemySkill >= 30) || (i == 1 && alchemySkill >= fWortChanceValue*2)
|| (i == 2 && alchemySkill >= 45) || (i == 2 && alchemySkill >= fWortChanceValue*3)
|| (i == 3 && alchemySkill >= 60)); || (i == 3 && alchemySkill >= fWortChanceValue*4));
list.push_back(params); list.push_back(params);
} }

View file

@ -137,13 +137,14 @@ namespace MWClass
MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player); MWMechanics::NpcStats& npcStats = MWWorld::Class::get(player).getNpcStats (player);
int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase(); int alchemySkill = npcStats.getSkill (ESM::Skill::Alchemy).getBase();
int i=0; int i=0;
static const float fWortChanceValue =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fWortChanceValue")->getFloat();
for (MWGui::Widgets::SpellEffectList::iterator it = info.effects.begin(); it != info.effects.end(); ++it) for (MWGui::Widgets::SpellEffectList::iterator it = info.effects.begin(); it != info.effects.end(); ++it)
{ {
/// \todo this code is duplicated from mwclass/ingredient, put it in a helper function it->mKnown = ( (i == 0 && alchemySkill >= fWortChanceValue)
it->mKnown = ( (i == 0 && alchemySkill >= 15) || (i == 1 && alchemySkill >= fWortChanceValue*2)
|| (i == 1 && alchemySkill >= 30) || (i == 2 && alchemySkill >= fWortChanceValue*3)
|| (i == 2 && alchemySkill >= 45) || (i == 3 && alchemySkill >= fWortChanceValue*4));
|| (i == 3 && alchemySkill >= 60));
++i; ++i;
} }