mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-10 05:21:35 +00:00
Don't sell racial spells (Fixes #1961)
This commit is contained in:
parent
cc63f7f051
commit
861cc26aa6
4 changed files with 21 additions and 1 deletions
|
@ -100,6 +100,15 @@ namespace MWGui
|
||||||
if (spell->mData.mType!=ESM::Spell::ST_Spell)
|
if (spell->mData.mType!=ESM::Spell::ST_Spell)
|
||||||
continue; // don't try to sell diseases, curses or powers
|
continue; // don't try to sell diseases, curses or powers
|
||||||
|
|
||||||
|
if (actor.getClass().isNpc())
|
||||||
|
{
|
||||||
|
const ESM::Race* race =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(
|
||||||
|
actor.get<ESM::NPC>()->mBase->mRace);
|
||||||
|
if (race->mPowers.exists(spell->mId))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (playerHasSpell(iter->first))
|
if (playerHasSpell(iter->first))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace MWMechanics
|
||||||
if (baseMagicka < iAutoSpellTimesCanCast * spell->mData.mCost)
|
if (baseMagicka < iAutoSpellTimesCanCast * spell->mData.mCost)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (race && std::find(race->mPowers.mList.begin(), race->mPowers.mList.end(), spell->mId) != race->mPowers.mList.end())
|
if (race && race->mPowers.exists(spell->mId))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!attrSkillCheck(spell, actorSkills, actorAttributes))
|
if (!attrSkillCheck(spell, actorSkills, actorAttributes))
|
||||||
|
|
|
@ -20,4 +20,12 @@ void SpellList::save(ESMWriter &esm) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SpellList::exists(const std::string &spell) const
|
||||||
|
{
|
||||||
|
for (std::vector<std::string>::const_iterator it = mList.begin(); it != mList.end(); ++it)
|
||||||
|
if (Misc::StringUtils::ciEqual(*it, spell))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,9 @@ namespace ESM
|
||||||
{
|
{
|
||||||
std::vector<std::string> mList;
|
std::vector<std::string> mList;
|
||||||
|
|
||||||
|
/// Is this spell ID in mList?
|
||||||
|
bool exists(const std::string& spell) const;
|
||||||
|
|
||||||
void load(ESMReader &esm);
|
void load(ESMReader &esm);
|
||||||
void save(ESMWriter &esm) const;
|
void save(ESMWriter &esm) const;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue