Don't sell racial spells (Fixes #1961)

deque
scrawl 10 years ago
parent cc63f7f051
commit 861cc26aa6

@ -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…
Cancel
Save