From aa2b2599b27d563a24bb20604eec41b7ae770377 Mon Sep 17 00:00:00 2001 From: Hondacrx Date: Mon, 13 Oct 2025 16:19:14 -0400 Subject: [PATCH] Core/Spells: Implemented setting spell to cast on arrival from SPELL_EFFECT_JUMP_CHARGE in database Port From (https://github.com/TrinityCore/TrinityCore/commit/b6b0eced74676816ae41d46ddb0ae7fa74068d3f) --- Source/Game/Globals/ObjectManager.cs | 14 ++++++++++++-- Source/Game/Movement/MotionMaster.cs | 1 + Source/Game/Spells/SpellEffects.cs | 5 +++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index 7c0da2adb..0b2f47d2a 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -10757,8 +10757,8 @@ namespace Game // need for reload case _jumpChargeParams.Clear(); - // 0 1 2 3 4 5 6 - SQLResult result = DB.World.Query("SELECT id, speed, treatSpeedAsMoveTimeSeconds, jumpGravity, spellVisualId, progressCurveId, parabolicCurveId FROM jump_charge_params"); + // 0 1 2 3 4 5 6 7 + SQLResult result = DB.World.Query("SELECT id, speed, treatSpeedAsMoveTimeSeconds, jumpGravity, spellVisualId, progressCurveId, parabolicCurveId, triggerSpellId FROM jump_charge_params"); if (result.IsEmpty()) return; @@ -10771,6 +10771,7 @@ namespace Game uint? spellVisualId = null; uint? progressCurveId = null; uint? parabolicCurveId = null; + uint? triggerSpellId = null; if (speed <= 0.0f) { @@ -10808,6 +10809,14 @@ namespace Game Log.outError(LogFilter.Sql, $"Table `jump_charge_params` references non-existing parabolic Curve: {result.Read(6)} for id {id}, ignored."); } + if (!result.IsNull(7)) + { + if (Global.SpellMgr.GetSpellInfo(result.Read(7), Difficulty.None) != null) + triggerSpellId = result.Read(7); + else + Log.outDebug(LogFilter.Sql, $"Table `jump_charge_params` references non-existing trigger spell id: {result.Read(7)} for id {id}, ignored."); + } + JumpChargeParams jumpParams = new(); jumpParams.Speed = speed; jumpParams.TreatSpeedAsMoveTimeSeconds = treatSpeedAsMoveTimeSeconds; @@ -10815,6 +10824,7 @@ namespace Game jumpParams.SpellVisualId = spellVisualId; jumpParams.ProgressCurveId = progressCurveId; jumpParams.ParabolicCurveId = parabolicCurveId; + jumpParams.TriggerSpellId = triggerSpellId; _jumpChargeParams[id] = jumpParams; } while (result.NextRow()); diff --git a/Source/Game/Movement/MotionMaster.cs b/Source/Game/Movement/MotionMaster.cs index e95736e1c..be24bccc2 100644 --- a/Source/Game/Movement/MotionMaster.cs +++ b/Source/Game/Movement/MotionMaster.cs @@ -1339,6 +1339,7 @@ namespace Game.Movement public uint? SpellVisualId; public uint? ProgressCurveId; public uint? ParabolicCurveId; + public uint? TriggerSpellId; } public struct ChaseRange diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index b0db3968b..cc6596779 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -5668,10 +5668,11 @@ namespace Game.Spells facing = target; JumpArrivalCastArgs arrivalCast = null; - if (effectInfo.TriggerSpell != 0) + if (effectInfo.TriggerSpell != 0 || jumpParams.TriggerSpellId.HasValue) { arrivalCast = new(); - arrivalCast.SpellId = effectInfo.TriggerSpell; + arrivalCast.SpellId = jumpParams.TriggerSpellId.HasValue ? jumpParams.TriggerSpellId.Value : effectInfo.TriggerSpell; + arrivalCast.Target = unitTarget != null ? unitTarget.GetGUID() : ObjectGuid.Empty; } SpellEffectExtraData effectExtra = null;