Core/Units: only set spellClickHandled to true when spell cast was succesful

Port From (https://github.com/TrinityCore/TrinityCore/commit/214580d345616b492ce9654ef30c1a436d224b25)
This commit is contained in:
Hondacrx
2024-11-11 21:13:42 -05:00
parent 8375da8f88
commit f2d1a8fb40
+4 -3
View File
@@ -2752,6 +2752,7 @@ namespace Game.Entities
SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(clickInfo.spellId, caster.GetMap().GetDifficultyID()); SpellInfo spellEntry = Global.SpellMgr.GetSpellInfo(clickInfo.spellId, caster.GetMap().GetDifficultyID());
// if (!spellEntry) should be checked at npc_spellclick load // if (!spellEntry) should be checked at npc_spellclick load
SpellCastResult castResult = SpellCastResult.Success;
if (seatId > -1) if (seatId > -1)
{ {
byte i = 0; byte i = 0;
@@ -2777,7 +2778,7 @@ namespace Game.Entities
CastSpellExtraArgs args = new(flags); CastSpellExtraArgs args = new(flags);
args.OriginalCaster = origCasterGUID; args.OriginalCaster = origCasterGUID;
args.AddSpellMod(SpellValueMod.BasePoint0 + i, seatId + 1); args.AddSpellMod(SpellValueMod.BasePoint0 + i, seatId + 1);
caster.CastSpell(target, clickInfo.spellId, args); castResult = caster.CastSpell(target, clickInfo.spellId, args);
} }
else // This can happen during Player._LoadAuras else // This can happen during Player._LoadAuras
{ {
@@ -2798,7 +2799,7 @@ namespace Game.Entities
else else
{ {
if (IsInMap(caster)) if (IsInMap(caster))
caster.CastSpell(target, spellEntry.Id, new CastSpellExtraArgs().SetOriginalCaster(origCasterGUID)); castResult = caster.CastSpell(target, spellEntry.Id, new CastSpellExtraArgs().SetOriginalCaster(origCasterGUID));
else else
{ {
AuraCreateInfo createInfo = new(ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellEntry.Id, GetMap().GenerateLowGuid(HighGuid.Cast)), spellEntry, GetMap().GetDifficultyID(), SpellConst.MaxEffectMask, this); AuraCreateInfo createInfo = new(ObjectGuid.Create(HighGuid.Cast, SpellCastSource.Normal, GetMapId(), spellEntry.Id, GetMap().GenerateLowGuid(HighGuid.Cast)), spellEntry, GetMap().GetDifficultyID(), SpellConst.MaxEffectMask, this);
@@ -2809,7 +2810,7 @@ namespace Game.Entities
} }
} }
spellClickHandled = true; spellClickHandled = castResult == SpellCastResult.Success;
} }
Creature creature = ToCreature(); Creature creature = ToCreature();