mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
fix(Core/Player): Make sure OnEquip spells from items are added after revive (#24238)
This commit is contained in:
@@ -272,6 +272,13 @@ public:
|
||||
[[nodiscard]] uint32 GetCount() const { return GetUInt32Value(ITEM_FIELD_STACK_COUNT); }
|
||||
void SetCount(uint32 value) { SetUInt32Value(ITEM_FIELD_STACK_COUNT, value); }
|
||||
[[nodiscard]] uint32 GetMaxStackCount() const { return GetTemplate()->GetMaxStackSize(); }
|
||||
void GetOnEquipSpellIDs(std::vector<uint32>& spellEquipID) const
|
||||
{
|
||||
if (ItemTemplate const* proto = GetTemplate())
|
||||
proto->GetOnEquipSpellIDs(spellEquipID);
|
||||
else
|
||||
spellEquipID.clear();
|
||||
};
|
||||
// Checks if this item has sockets, whether built-in or added by an upgrade.
|
||||
[[nodiscard]] bool HasSocket() const;
|
||||
[[nodiscard]] uint8 GetGemCountWithID(uint32 GemID) const;
|
||||
|
||||
@@ -729,6 +729,14 @@ struct ItemTemplate
|
||||
return (Stackable == 2147483647 || Stackable <= 0) ? uint32(0x7FFFFFFF - 1) : uint32(Stackable);
|
||||
}
|
||||
|
||||
void GetOnEquipSpellIDs(std::vector<uint32>& spellEquipID) const
|
||||
{
|
||||
spellEquipID.clear();
|
||||
for (auto const& spell : Spells)
|
||||
if (spell.SpellId && spell.SpellTrigger == ITEM_SPELLTRIGGER_ON_EQUIP)
|
||||
spellEquipID.push_back(spell.SpellId);
|
||||
}
|
||||
|
||||
[[nodiscard]] float getDPS() const
|
||||
{
|
||||
if (Delay == 0)
|
||||
|
||||
@@ -319,6 +319,23 @@ void Player::Update(uint32 p_time)
|
||||
{
|
||||
m_regenTimer += p_time;
|
||||
RegenerateAll();
|
||||
|
||||
// Apply buffs from items with Apply on Equip trigger if they are not present.
|
||||
for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
|
||||
{
|
||||
if (!m_items[i])
|
||||
continue;
|
||||
|
||||
std::vector<uint32> spellIDs;
|
||||
m_items[i]->GetOnEquipSpellIDs(spellIDs);
|
||||
bool apply = false;
|
||||
for (uint32 spellID : spellIDs)
|
||||
if (!apply && !HasAura(spellID))
|
||||
apply = true;
|
||||
|
||||
if (apply)
|
||||
ApplyItemEquipSpell(m_items[i], true, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_deathState == DeathState::JustDied)
|
||||
|
||||
@@ -14711,7 +14711,7 @@ void Unit::setDeathState(DeathState s, bool despawn)
|
||||
}
|
||||
else if (s == DeathState::JustRespawned)
|
||||
{
|
||||
RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
|
||||
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); // clear skinnable for creature and player (at battleground)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user