mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 05:23:51 +00:00
Feature #1130: Add auto-calculated NPC spells
This commit is contained in:
parent
851a7d5014
commit
5de8c7fe29
1 changed files with 14 additions and 2 deletions
|
@ -141,7 +141,7 @@ namespace
|
|||
*
|
||||
* and by adding class, race, specialization bonus.
|
||||
*/
|
||||
void autoCalculateSkills(const ESM::NPC* npc, MWMechanics::NpcStats& npcStats)
|
||||
void autoCalculateSkills(const ESM::NPC* npc, MWMechanics::NpcStats& npcStats, const MWWorld::Ptr& ptr)
|
||||
{
|
||||
const ESM::Class *class_ =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(npc->mClass);
|
||||
|
@ -190,6 +190,18 @@ namespace
|
|||
majorMultiplier = 1.0f;
|
||||
break;
|
||||
}
|
||||
if (class_->mData.mSkills[k][1] == skillIndex)
|
||||
{
|
||||
// Major skill -> add starting spells for this skill if existing
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
MWWorld::Store<ESM::Spell>::iterator it = store.get<ESM::Spell>().begin();
|
||||
for (; it != store.get<ESM::Spell>().end(); ++it)
|
||||
{
|
||||
if (it->mData.mFlags & ESM::Spell::F_Autocalc
|
||||
&& MWMechanics::spellSchoolToSkill(MWMechanics::getSpellSchool(&*it, ptr)) == skillIndex)
|
||||
npcStats.getSpells().add(it->mId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// is this skill in the same Specialization as the class?
|
||||
|
@ -302,7 +314,7 @@ namespace MWClass
|
|||
data->mNpcStats.setReputation(ref->mBase->mNpdt12.mReputation);
|
||||
|
||||
autoCalculateAttributes(ref->mBase, data->mNpcStats);
|
||||
autoCalculateSkills(ref->mBase, data->mNpcStats);
|
||||
autoCalculateSkills(ref->mBase, data->mNpcStats, ptr);
|
||||
}
|
||||
|
||||
if (data->mNpcStats.getFactionRanks().size())
|
||||
|
|
Loading…
Reference in a new issue