Skip to content

Commit

Permalink
Core/Units: only set spellClickHandled to true when spell cast was su…
Browse files Browse the repository at this point in the history
…ccesful (TrinityCore#30388)
  • Loading branch information
Golrag authored Oct 31, 2024
1 parent f689a80 commit 214580d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12345,6 +12345,7 @@ void Unit::HandleSpellClick(Unit* clicker, int8 seatId /*= -1*/)
SpellInfo const* spellEntry = sSpellMgr->AssertSpellInfo(clickPair.second.spellId, caster->GetMap()->GetDifficultyID());
// if (!spellEntry) should be checked at npc_spellclick load

SpellCastResult castResult = SPELL_FAILED_SUCCESS;
if (seatId > -1)
{
uint8 i = 0;
Expand All @@ -12370,7 +12371,7 @@ void Unit::HandleSpellClick(Unit* clicker, int8 seatId /*= -1*/)
CastSpellExtraArgs args(flags);
args.OriginalCaster = origCasterGUID;
args.AddSpellMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + i), seatId + 1);
caster->CastSpell(target, clickPair.second.spellId, args);
castResult = caster->CastSpell(target, clickPair.second.spellId, args);
}
else // This can happen during Player::_LoadAuras
{
Expand All @@ -12392,7 +12393,7 @@ void Unit::HandleSpellClick(Unit* clicker, int8 seatId /*= -1*/)
else
{
if (IsInMap(caster))
caster->CastSpell(target, spellEntry->Id, CastSpellExtraArgs().SetOriginalCaster(origCasterGUID));
castResult = caster->CastSpell(target, spellEntry->Id, CastSpellExtraArgs().SetOriginalCaster(origCasterGUID));
else
{
AuraCreateInfo createInfo(ObjectGuid::Create<HighGuid::Cast>(SPELL_CAST_SOURCE_NORMAL, GetMapId(), spellEntry->Id, GetMap()->GenerateLowGuid<HighGuid::Cast>()), spellEntry, GetMap()->GetDifficultyID(), MAX_EFFECT_MASK, this);
Expand All @@ -12404,7 +12405,7 @@ void Unit::HandleSpellClick(Unit* clicker, int8 seatId /*= -1*/)
}
}

spellClickHandled = true;
spellClickHandled = castResult == SPELL_FAILED_SUCCESS;
}

Creature* creature = ToCreature();
Expand Down

0 comments on commit 214580d

Please sign in to comment.