Core/GameObjects: only add GameObject uses when the triggered cast is successful

This commit is contained in:
Shauren authored and Ovahlord committed 2026-06-09 16:53:26 +02:00
1 parent 5bb76804db
commit 490ed994bc
1 file changed
+9 -5
@@ -1860,6 +1860,7 @@ void GameObject::Use(Unit* user)
Unit* spellCaster = user;
uint32 spellId = 0;
bool triggered = false;
bool addUse = false;
if (Player* playerUser = user->ToPlayer())
{
@@ -2296,9 +2297,8 @@ void GameObject::Use(Unit* user)
if (m_goInfo->spellcaster.playerCast != 0 && user->IsPlayer())
caster = user;
if (caster->CastSpell(user, spellId) == SPELL_CAST_OK)
AddUse();
return;
addUse = true;
break;
}
case GAMEOBJECT_TYPE_MEETINGSTONE: //23
{
@@ -2467,10 +2467,14 @@ void GameObject::Use(Unit* user)
if (Player* player = user->ToPlayer())
sOutdoorPvPMgr->HandleCustomSpell(player, spellId, this);
SpellCastResult castResult;
if (spellCaster)
spellCaster->CastSpell(user, spellId, triggered);
castResult = spellCaster->CastSpell(user, spellId, triggered);
else
CastSpell(user, spellId);
castResult = CastSpell(user, spellId);
if (addUse && castResult == SPELL_CAST_OK)
AddUse();
}
void GameObject::SendCustomAnim(uint32 anim)