mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-06 12:45:34 +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)
|
||||
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))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace MWMechanics
|
|||
if (baseMagicka < iAutoSpellTimesCanCast * spell->mData.mCost)
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
/// Is this spell ID in mList?
|
||||
bool exists(const std::string& spell) const;
|
||||
|
||||
void load(ESMReader &esm);
|
||||
void save(ESMWriter &esm) const;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue