mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 08:45:33 +00:00
ESSImport: convert selected spell / selected enchant item
This commit is contained in:
parent
8e5c8aa562
commit
09f11fbff2
3 changed files with 29 additions and 6 deletions
|
@ -226,7 +226,28 @@ public:
|
|||
|
||||
ESM::NpcStats& npcStats = mContext->mPlayer.mObject.mNpcStats;
|
||||
convertNpcData(refr.mActorData, npcStats);
|
||||
|
||||
mSelectedSpell = refr.mActorData.mSelectedSpell;
|
||||
if (!refr.mActorData.mSelectedEnchantItem.empty())
|
||||
{
|
||||
ESM::InventoryState& invState = mContext->mPlayer.mObject.mInventory;
|
||||
|
||||
for (unsigned int i=0; i<invState.mItems.size(); ++i)
|
||||
{
|
||||
// FIXME: in case of conflict (multiple items with this refID) use the already equipped one?
|
||||
if (Misc::StringUtils::ciEqual(invState.mItems[i].mRef.mRefID, refr.mActorData.mSelectedEnchantItem))
|
||||
invState.mSelectedEnchantItem = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
virtual void write(ESM::ESMWriter& esm)
|
||||
{
|
||||
esm.startRecord(ESM::REC_ASPL);
|
||||
esm.writeHNString("ID__", mSelectedSpell);
|
||||
esm.endRecord(ESM::REC_ASPL);
|
||||
}
|
||||
private:
|
||||
std::string mSelectedSpell;
|
||||
};
|
||||
|
||||
class ConvertPCDT : public Converter
|
||||
|
|
|
@ -62,17 +62,16 @@ namespace ESSImport
|
|||
|
||||
// unsure at which point between LSTN and CHRD
|
||||
if (esm.isNextSub("APUD"))
|
||||
esm.skipHSub(); // 40 bytes, starts with string "ancestor guardian"...
|
||||
esm.skipHSub(); // 40 bytes, starts with string "ancestor guardian". maybe spellcasting in progress?
|
||||
|
||||
if (esm.isNextSub("WNAM"))
|
||||
{
|
||||
esm.skipHSub(); // seen values: "ancestor guardian", "bound dagger_en". Summoned creature / bound weapons?
|
||||
std::string id = esm.getHString();
|
||||
|
||||
if (esm.isNextSub("XNAM"))
|
||||
{
|
||||
// "demon tanto", probably the ID of spell/item that created the bound weapon/crature?
|
||||
esm.skipHSub();
|
||||
}
|
||||
mSelectedEnchantItem = esm.getHString();
|
||||
else
|
||||
mSelectedSpell = id;
|
||||
|
||||
if (esm.isNextSub("YNAM"))
|
||||
esm.skipHSub(); // 4 byte, 0
|
||||
|
|
|
@ -52,6 +52,9 @@ namespace ESSImport
|
|||
// to change them ingame
|
||||
int mCombatStats[3][2];
|
||||
|
||||
std::string mSelectedSpell;
|
||||
std::string mSelectedEnchantItem;
|
||||
|
||||
SCRI mSCRI;
|
||||
|
||||
void load(ESM::ESMReader& esm);
|
||||
|
|
Loading…
Reference in a new issue