From 3f8dedfb7a30967ba3985a1fdf3c80ced9f63b5e Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 13 Sep 2023 21:03:36 -0400 Subject: [PATCH] Core/Creatures: Clean up temporary summon duplicate level initialization Port From (https://github.com/TrinityCore/TrinityCore/commit/1cae07870b4ff3c33669326756392d9086dac50f) --- Source/Game/Entities/TemporarySummon.cs | 2 +- Source/Game/Spells/SpellEffects.cs | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Source/Game/Entities/TemporarySummon.cs b/Source/Game/Entities/TemporarySummon.cs index 9b8d00389..cb5b47345 100644 --- a/Source/Game/Entities/TemporarySummon.cs +++ b/Source/Game/Entities/TemporarySummon.cs @@ -503,7 +503,7 @@ namespace Game.Entities { base.InitStats(summoner, duration); - InitStatsForLevel(GetOwner().GetLevel()); + InitStatsForLevel(GetLevel()); // level is already initialized in TempSummon::InitStats, so use that if (GetOwner().IsTypeId(TypeId.Player) && HasUnitTypeMask(UnitTypeMask.ControlableGuardian)) GetCharmInfo().InitCharmCreateSpells(); diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 3ef231427..8bc53e919 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -1575,7 +1575,7 @@ namespace Game.Spells { Position pos; if (count == 0) - pos = destTarget; + pos = destTarget.GetPosition(); else // randomize position for multiple summons pos = caster.GetRandomPoint(destTarget, radius); @@ -4599,7 +4599,7 @@ namespace Game.Spells { Position pos; if (count == 0) - pos = destTarget; + pos = destTarget.GetPosition(); else // randomize position for multiple summons pos = unitCaster.GetRandomPoint(destTarget, radius); @@ -4608,12 +4608,8 @@ namespace Game.Spells if (summon == null) return; - if (summon.HasUnitTypeMask(UnitTypeMask.Guardian)) + if (summon.IsGuardian()) { - uint level = summon.GetLevel(); - if (properties != null && !properties.GetFlags().HasFlag(SummonPropertiesFlags.UseCreatureLevel)) - level = unitCaster.GetLevel(); - // level of pet summoned using engineering item based at engineering skill level if (m_CastItem && unitCaster.IsPlayer()) { @@ -4624,12 +4620,10 @@ namespace Game.Spells { ushort skill202 = unitCaster.ToPlayer().GetSkillValue(SkillType.Engineering); if (skill202 != 0) - level = skill202 / 5u; + ((Guardian)summon).InitStatsForLevel((uint)(skill202 / 5)); } } } - - ((Guardian)summon).InitStatsForLevel(level); } if (summon.HasUnitTypeMask(UnitTypeMask.Minion) && m_targets.HasDst())