[Client] Add and use enchantmentType argument for unequipItemsByEffect()

0.6.2
David Cernat 7 years ago
parent 6c4bb8c423
commit d19d8b0a34

@ -856,7 +856,7 @@ void LocalPlayer::setAttributes()
// fortify the attribute
if (ptrCreatureStats->getAttribute(attributeIndex).getModifier() > 0)
{
MechanicsHelper::unequipItemsByEffect(ptrPlayer, ESM::MagicEffect::FortifyAttribute, attributeIndex, -1);
MechanicsHelper::unequipItemsByEffect(ptrPlayer, ESM::Enchantment::ConstantEffect, ESM::MagicEffect::FortifyAttribute, attributeIndex, -1);
mwmp::Main::get().getGUIController()->refreshGuiMode(MWGui::GM_Inventory);
}
}
@ -887,7 +887,7 @@ void LocalPlayer::setSkills()
// fortify the skill
if (ptrNpcStats->getSkill(skillIndex).getModifier() > 0)
{
MechanicsHelper::unequipItemsByEffect(ptrPlayer, ESM::MagicEffect::FortifySkill, -1, skillIndex);
MechanicsHelper::unequipItemsByEffect(ptrPlayer, ESM::Enchantment::ConstantEffect, ESM::MagicEffect::FortifySkill, -1, skillIndex);
mwmp::Main::get().getGUIController()->refreshGuiMode(MWGui::GM_Inventory);
}
}

@ -233,7 +233,7 @@ bool MechanicsHelper::doesEffectListContainEffect(const ESM::EffectList& effectL
return false;
}
void MechanicsHelper::unequipItemsByEffect(const MWWorld::Ptr& ptr, short effectId, short attributeId, short skillId)
void MechanicsHelper::unequipItemsByEffect(const MWWorld::Ptr& ptr, short enchantmentType, short effectId, short attributeId, short skillId)
{
MWBase::World *world = MWBase::Environment::get().getWorld();
MWWorld::InventoryStore &ptrInventory = ptr.getClass().getInventoryStore(ptr);
@ -249,7 +249,7 @@ void MechanicsHelper::unequipItemsByEffect(const MWWorld::Ptr& ptr, short effect
{
const ESM::Enchantment* enchantment = world->getStore().get<ESM::Enchantment>().find(enchantmentName);
if (doesEffectListContainEffect(enchantment->mEffects, effectId, attributeId, skillId))
if (enchantment->mData.mType == enchantmentType && doesEffectListContainEffect(enchantment->mEffects, effectId, attributeId, skillId))
ptrInventory.unequipSlot(slot, ptr);
}
}

@ -25,7 +25,7 @@ namespace MechanicsHelper
void processAttack(mwmp::Attack attack, const MWWorld::Ptr& attacker);
bool doesEffectListContainEffect(const ESM::EffectList& effectList, short effectId, short attributeId = -1, short skillId = -1);
void unequipItemsByEffect(const MWWorld::Ptr& ptr, short effectId, short attributeId = -1, short skillId = -1);
void unequipItemsByEffect(const MWWorld::Ptr& ptr, short enchantmentType, short effectId, short attributeId = -1, short skillId = -1);
}

Loading…
Cancel
Save