2017-09-20 16:56:32 +00:00
|
|
|
#include "importsplm.h"
|
|
|
|
|
2022-01-22 14:58:41 +00:00
|
|
|
#include <components/esm3/esmreader.hpp>
|
2017-09-20 16:56:32 +00:00
|
|
|
|
|
|
|
namespace ESSImport
|
|
|
|
{
|
|
|
|
|
|
|
|
void SPLM::load(ESM::ESMReader& esm)
|
|
|
|
{
|
|
|
|
while (esm.isNextSub("NAME"))
|
|
|
|
{
|
|
|
|
ActiveSpell spell;
|
|
|
|
esm.getHT(spell.mIndex);
|
2023-12-17 13:03:45 +00:00
|
|
|
esm.getHNT("SPDT", spell.mSPDT.mType, spell.mSPDT.mId.mData, spell.mSPDT.mUnknown,
|
|
|
|
spell.mSPDT.mCasterId.mData, spell.mSPDT.mSourceId.mData, spell.mSPDT.mUnknown2);
|
2017-09-20 16:56:32 +00:00
|
|
|
spell.mTarget = esm.getHNOString("TNAM");
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2017-09-20 16:56:32 +00:00
|
|
|
while (esm.isNextSub("NPDT"))
|
2022-09-22 18:26:05 +00:00
|
|
|
{
|
2017-09-20 16:56:32 +00:00
|
|
|
ActiveEffect effect;
|
2023-12-17 13:03:45 +00:00
|
|
|
esm.getHT(effect.mNPDT.mAffectedActorId.mData, effect.mNPDT.mUnknown, effect.mNPDT.mMagnitude,
|
|
|
|
effect.mNPDT.mSecondsActive, effect.mNPDT.mUnknown2);
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2017-09-20 16:56:32 +00:00
|
|
|
// Effect-specific subrecords can follow:
|
|
|
|
// - INAM for disintegration and bound effects
|
|
|
|
// - CNAM for summoning and command effects
|
|
|
|
// - VNAM for vampirism
|
|
|
|
// NOTE: There can be multiple INAMs per effect.
|
|
|
|
// TODO: Needs more research.
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2017-09-20 16:56:32 +00:00
|
|
|
esm.skipHSubUntil("NAM0"); // sentinel
|
|
|
|
esm.getSubName();
|
|
|
|
esm.skipHSub();
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2017-09-20 16:56:32 +00:00
|
|
|
spell.mActiveEffects.push_back(effect);
|
2022-09-22 18:26:05 +00:00
|
|
|
}
|
|
|
|
|
2017-09-20 16:56:32 +00:00
|
|
|
unsigned char xnam; // sentinel
|
|
|
|
esm.getHNT(xnam, "XNAM");
|
2022-09-22 18:26:05 +00:00
|
|
|
|
2017-09-20 16:56:32 +00:00
|
|
|
mActiveSpells.push_back(spell);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|