mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Items: Changed how azerite item bonuses are applied at login to avoid applying them twice
This commit is contained in:
@@ -7925,20 +7925,18 @@ void Player::ApplyAzeritePowers(Item* item, bool apply)
|
||||
{
|
||||
// milestone powers
|
||||
for (uint32 azeriteItemMilestonePowerId : azeriteItem->m_azeriteItemData->UnlockedEssenceMilestones)
|
||||
ApplyAzeriteItemMilestonePower(item, sAzeriteItemMilestonePowerStore.AssertEntry(azeriteItemMilestonePowerId), apply);
|
||||
ApplyAzeriteItemMilestonePower(azeriteItem, sAzeriteItemMilestonePowerStore.AssertEntry(azeriteItemMilestonePowerId), apply);
|
||||
|
||||
// essences
|
||||
if (UF::SelectedAzeriteEssences const* selectedEssences = azeriteItem->GetSelectedAzeriteEssences())
|
||||
for (uint8 slot = 0; slot < MAX_AZERITE_ESSENCE_SLOT; ++slot)
|
||||
if (selectedEssences->AzeriteEssenceID[slot])
|
||||
ApplyAzeriteEssence(item, selectedEssences->AzeriteEssenceID[slot], azeriteItem->GetEssenceRank(selectedEssences->AzeriteEssenceID[slot]),
|
||||
ApplyAzeriteEssence(azeriteItem, selectedEssences->AzeriteEssenceID[slot], azeriteItem->GetEssenceRank(selectedEssences->AzeriteEssenceID[slot]),
|
||||
AzeriteItemMilestoneType(sDB2Manager.GetAzeriteItemMilestonePower(slot)->Type) == AzeriteItemMilestoneType::MajorEssence, apply);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void Player::ApplyAzeriteItemMilestonePower(Item* item, AzeriteItemMilestonePowerEntry const* azeriteItemMilestonePower, bool apply)
|
||||
void Player::ApplyAzeriteItemMilestonePower(AzeriteItem* item, AzeriteItemMilestonePowerEntry const* azeriteItemMilestonePower, bool apply)
|
||||
{
|
||||
AzeriteItemMilestoneType type = AzeriteItemMilestoneType(azeriteItemMilestonePower->Type);
|
||||
if (type == AzeriteItemMilestoneType::BonusStamina)
|
||||
@@ -7953,7 +7951,7 @@ void Player::ApplyAzeriteItemMilestonePower(Item* item, AzeriteItemMilestonePowe
|
||||
}
|
||||
}
|
||||
|
||||
void Player::ApplyAzeriteEssence(Item* item, uint32 azeriteEssenceId, uint32 rank, bool major, bool apply)
|
||||
void Player::ApplyAzeriteEssence(AzeriteItem* item, uint32 azeriteEssenceId, uint32 rank, bool major, bool apply)
|
||||
{
|
||||
for (uint32 currentRank = 1; currentRank <= rank; ++currentRank)
|
||||
{
|
||||
@@ -7971,7 +7969,7 @@ void Player::ApplyAzeriteEssence(Item* item, uint32 azeriteEssenceId, uint32 ran
|
||||
}
|
||||
}
|
||||
|
||||
void Player::ApplyAzeriteEssencePower(Item* item, AzeriteEssencePowerEntry const* azeriteEssencePower, bool major, bool apply)
|
||||
void Player::ApplyAzeriteEssencePower(AzeriteItem* item, AzeriteEssencePowerEntry const* azeriteEssencePower, bool major, bool apply)
|
||||
{
|
||||
if (SpellInfo const* powerSpell = sSpellMgr->GetSpellInfo(azeriteEssencePower->MinorPowerDescription))
|
||||
{
|
||||
@@ -8308,7 +8306,6 @@ void Player::_RemoveAllItemMods()
|
||||
|
||||
ApplyItemEquipSpell(m_items[i], false);
|
||||
ApplyEnchantment(m_items[i], false);
|
||||
ApplyAzeritePowers(m_items[i], false);
|
||||
ApplyArtifactPowers(m_items[i], false);
|
||||
}
|
||||
}
|
||||
@@ -8361,7 +8358,6 @@ void Player::_ApplyAllItemMods()
|
||||
|
||||
ApplyItemEquipSpell(m_items[i], true);
|
||||
ApplyArtifactPowers(m_items[i], true);
|
||||
ApplyAzeritePowers(m_items[i], true);
|
||||
ApplyEnchantment(m_items[i], true);
|
||||
}
|
||||
}
|
||||
@@ -8383,6 +8379,20 @@ void Player::_ApplyAllLevelScaleItemMods(bool apply)
|
||||
}
|
||||
}
|
||||
|
||||
void Player::ApplyAllAzeriteItemMods(bool apply)
|
||||
{
|
||||
for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
|
||||
{
|
||||
if (m_items[i])
|
||||
{
|
||||
if (!m_items[i]->IsAzeriteItem() || m_items[i]->IsBroken() || !CanUseAttackType(Player::GetAttackBySlot(i, m_items[i]->GetTemplate()->GetInventoryType())))
|
||||
continue;
|
||||
|
||||
ApplyAzeritePowers(m_items[i], apply);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ObjectGuid Player::GetLootWorldObjectGUID(ObjectGuid const& lootObjectGuid) const
|
||||
{
|
||||
auto itr = m_AELootView.find(lootObjectGuid);
|
||||
@@ -18892,6 +18902,8 @@ void Player::_LoadInventory(PreparedQueryResult result, PreparedQueryResult arti
|
||||
}
|
||||
//if (IsAlive())
|
||||
_ApplyAllItemMods();
|
||||
// Apply all azerite item mods, azerite empowered item mods will get applied through its spell script
|
||||
ApplyAllAzeriteItemMods(true);
|
||||
}
|
||||
|
||||
void Player::_LoadVoidStorage(PreparedQueryResult result)
|
||||
|
||||
@@ -2014,6 +2014,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
void _RemoveAllItemMods();
|
||||
void _ApplyAllItemMods();
|
||||
void _ApplyAllLevelScaleItemMods(bool apply);
|
||||
void ApplyAllAzeriteItemMods(bool apply);
|
||||
void _ApplyItemBonuses(Item* item, uint8 slot, bool apply);
|
||||
void _ApplyWeaponDamage(uint8 slot, Item* item, bool apply);
|
||||
bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) const;
|
||||
@@ -2028,9 +2029,9 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
|
||||
void ApplyArtifactPowers(Item* item, bool apply);
|
||||
void ApplyArtifactPowerRank(Item* artifact, ArtifactPowerRankEntry const* artifactPowerRank, bool apply);
|
||||
void ApplyAzeritePowers(Item* item, bool apply);
|
||||
void ApplyAzeriteItemMilestonePower(Item* item, AzeriteItemMilestonePowerEntry const* azeriteItemMilestonePower, bool apply);
|
||||
void ApplyAzeriteEssence(Item* item, uint32 azeriteEssenceId, uint32 rank, bool major, bool apply);
|
||||
void ApplyAzeriteEssencePower(Item* item, AzeriteEssencePowerEntry const* azeriteEssencePower, bool major, bool apply);
|
||||
void ApplyAzeriteItemMilestonePower(AzeriteItem* item, AzeriteItemMilestonePowerEntry const* azeriteItemMilestonePower, bool apply);
|
||||
void ApplyAzeriteEssence(AzeriteItem* item, uint32 azeriteEssenceId, uint32 rank, bool major, bool apply);
|
||||
void ApplyAzeriteEssencePower(AzeriteItem* item, AzeriteEssencePowerEntry const* azeriteEssencePower, bool major, bool apply);
|
||||
|
||||
void CastItemCombatSpell(DamageInfo const& damageInfo);
|
||||
void CastItemCombatSpell(DamageInfo const& damageInfo, Item* item, ItemTemplate const* proto);
|
||||
|
||||
@@ -789,6 +789,7 @@ void Player::_ApplyAllStatBonuses()
|
||||
|
||||
_ApplyAllAuraStatMods();
|
||||
_ApplyAllItemMods();
|
||||
ApplyAllAzeriteItemMods(true);
|
||||
|
||||
SetCanModifyStats(true);
|
||||
|
||||
@@ -799,6 +800,7 @@ void Player::_RemoveAllStatBonuses()
|
||||
{
|
||||
SetCanModifyStats(false);
|
||||
|
||||
ApplyAllAzeriteItemMods(false);
|
||||
_RemoveAllItemMods();
|
||||
_RemoveAllAuraStatMods();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user