mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 02:20:27 +00:00
fix(Core/Player): Recast lost by death item obtain spells of any item… (#22736)
Co-authored-by: ariel- <ariel-@users.noreply.github.com>
This commit is contained in:
@@ -4550,6 +4550,9 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
|
||||
// update visibility
|
||||
UpdateObjectVisibility();
|
||||
|
||||
// recast lost by death auras of any items held in the inventory
|
||||
CastAllObtainSpells();
|
||||
|
||||
sScriptMgr->OnPlayerResurrect(this, restore_percent, applySickness);
|
||||
|
||||
if (!applySickness)
|
||||
@@ -7024,6 +7027,46 @@ void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingSt
|
||||
UpdateDamagePhysical(WeaponAttackType(attType));
|
||||
}
|
||||
|
||||
void Player::CastAllObtainSpells()
|
||||
{
|
||||
for (uint8 slot = INVENTORY_SLOT_ITEM_START; slot < INVENTORY_SLOT_ITEM_END; ++slot)
|
||||
if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
|
||||
ApplyItemObtainSpells(item, true);
|
||||
|
||||
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
|
||||
{
|
||||
Bag* bag = GetBagByPos(i);
|
||||
if (!bag)
|
||||
continue;
|
||||
|
||||
for (uint32 slot = 0; slot < bag->GetBagSize(); ++slot)
|
||||
if (Item* item = bag->GetItemByPos(slot))
|
||||
ApplyItemObtainSpells(item, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Player::ApplyItemObtainSpells(Item* item, bool apply)
|
||||
{
|
||||
ItemTemplate const* itemTemplate = item->GetTemplate();
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
{
|
||||
if (itemTemplate->Spells[i].SpellTrigger != ITEM_SPELLTRIGGER_ON_NO_DELAY_USE) // On obtain trigger
|
||||
continue;
|
||||
|
||||
int32 const spellId = itemTemplate->Spells[i].SpellId;
|
||||
if (spellId <= 0)
|
||||
continue;
|
||||
|
||||
if (apply)
|
||||
{
|
||||
if (!HasAura(spellId))
|
||||
CastSpell(this, spellId, true, item);
|
||||
}
|
||||
else
|
||||
RemoveAurasDueToSpell(spellId);
|
||||
}
|
||||
}
|
||||
|
||||
SpellSchoolMask Player::GetMeleeDamageSchoolMask(WeaponAttackType attackType /*= BASE_ATTACK*/, uint8 damageIndex /*= 0*/) const
|
||||
{
|
||||
if (Item const* weapon = GetWeaponForAttack(attackType, true))
|
||||
|
||||
Reference in New Issue
Block a user