Core/Items: Implement azerite essences

Port From (https://github.com/TrinityCore/TrinityCore/commit/ec9d624aec9e0a39b1bcee7d4077f46be358faad)
This commit is contained in:
hondacrx
2019-11-22 21:39:35 -05:00
parent c05d592f4c
commit 796c11795f
30 changed files with 1231 additions and 74 deletions
+41
View File
@@ -5747,6 +5747,47 @@ namespace Game.Spells
unitTarget.ToPlayer().GetSession().GetCollectionMgr().AddTransmogSet((uint)effectInfo.MiscValue);
}
[SpellEffectHandler(SpellEffectName.LearnAzeriteEssencePower)]
void EffectLearnAzeriteEssencePower(uint effIndex)
{
if (effectHandleMode != SpellEffectHandleMode.HitTarget)
return;
Player playerTarget = unitTarget != null ? unitTarget.ToPlayer() : null;
if (!playerTarget)
return;
Item heartOfAzeroth = playerTarget.GetItemByEntry(PlayerConst.ItemIdHeartOfAzeroth);
if (heartOfAzeroth == null)
return;
AzeriteItem azeriteItem = heartOfAzeroth.ToAzeriteItem();
if (azeriteItem == null)
return;
// remove old rank and apply new one
if (azeriteItem.IsEquipped())
{
SelectedAzeriteEssences selectedEssences = azeriteItem.GetSelectedAzeriteEssences();
if (selectedEssences != null)
{
for (int slot = 0; slot < SharedConst.MaxAzeriteEssenceSlot; ++slot)
{
if (selectedEssences.AzeriteEssenceID[slot] == effectInfo.MiscValue)
{
bool major = (AzeriteItemMilestoneType)Global.DB2Mgr.GetAzeriteItemMilestonePower(slot).Type == AzeriteItemMilestoneType.MajorEssence;
playerTarget.ApplyAzeriteEssence(azeriteItem, (uint)effectInfo.MiscValue, SharedConst.MaxAzeriteEssenceRank, major, false);
playerTarget.ApplyAzeriteEssence(azeriteItem, (uint)effectInfo.MiscValue, (uint)effectInfo.MiscValueB, major, false);
break;
}
}
}
}
azeriteItem.SetEssenceRank((uint)effectInfo.MiscValue, (uint)effectInfo.MiscValueB);
azeriteItem.SetState(ItemUpdateState.Changed, playerTarget);
}
}
public class DispelableAura