fix(Core/Player): Haunted Memento aura is present when item is in bank (#22811)

This commit is contained in:
Jelle Meeus
2025-09-06 06:28:01 -07:00
committed by GitHub
parent 809a06ad0b
commit d22f015e52
3 changed files with 11 additions and 5 deletions

View File

@@ -7067,6 +7067,14 @@ void Player::ApplyItemObtainSpells(Item* item, bool apply)
}
}
void Player::UpdateItemObtainSpells(Item* item, uint8 bag, uint8 slot)
{
if (IsBankPos(bag, slot))
ApplyItemObtainSpells(item, false);
else if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END))
ApplyItemObtainSpells(item, true);
}
SpellSchoolMask Player::GetMeleeDamageSchoolMask(WeaponAttackType attackType /*= BASE_ATTACK*/, uint8 damageIndex /*= 0*/) const
{
if (Item const* weapon = GetWeaponForAttack(attackType, true))

View File

@@ -2208,6 +2208,7 @@ public:
void CastAllObtainSpells();
void ApplyItemObtainSpells(Item* item, bool apply);
void UpdateItemObtainSpells(Item* item, uint8 bag, uint8 slot);
SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType attackType = BASE_ATTACK, uint8 damageIndex = 0) const override;

View File

@@ -2654,9 +2654,7 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool
AddEnchantmentDurations(pItem);
AddItemDurations(pItem);
if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END))
ApplyItemObtainSpells(pItem, true);
UpdateItemObtainSpells(pItem, bag, slot);
return pItem;
}
@@ -2694,8 +2692,7 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool
pItem2->SetState(ITEM_CHANGED, this);
if (bag == INVENTORY_SLOT_BAG_0 || (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END))
ApplyItemObtainSpells(pItem2, true);
UpdateItemObtainSpells(pItem2, bag, slot);
return pItem2;
}