mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Core/Scripts: Always run OnSpellClick AI hook, even if there are no spells defined for spellclick event.
This commit is contained in:
@@ -169,7 +169,7 @@ class CreatureAI : public UnitAI
|
||||
|
||||
virtual void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool /*apply*/) {}
|
||||
|
||||
virtual void OnSpellClick(Unit* /*clicker*/) { }
|
||||
virtual void OnSpellClick(Unit* /*clicker*/, bool& /*result*/) { }
|
||||
|
||||
virtual bool CanSeeAlways(WorldObject const* /*obj*/) { return false; }
|
||||
protected:
|
||||
|
||||
@@ -828,8 +828,11 @@ void SmartAI::sOnGameEvent(bool start, uint16 eventId)
|
||||
GetScript()->ProcessEventsFor(start ? SMART_EVENT_GAME_EVENT_START : SMART_EVENT_GAME_EVENT_END, NULL, eventId);
|
||||
}
|
||||
|
||||
void SmartAI::OnSpellClick(Unit* clicker)
|
||||
void SmartAI::OnSpellClick(Unit* clicker, bool& result)
|
||||
{
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_ON_SPELLCLICK, clicker);
|
||||
}
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ class SmartAI : public CreatureAI
|
||||
|
||||
void RemoveAuras();
|
||||
|
||||
void OnSpellClick(Unit* clicker);
|
||||
void OnSpellClick(Unit* clicker, bool& result);
|
||||
|
||||
private:
|
||||
uint32 mFollowCreditType;
|
||||
|
||||
@@ -16801,12 +16801,9 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
|
||||
result = true;
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
Creature* creature = ToCreature();
|
||||
if (creature && creature->IsAIEnabled)
|
||||
creature->AI()->OnSpellClick(clicker);
|
||||
}
|
||||
Creature* creature = ToCreature();
|
||||
if (creature && creature->IsAIEnabled)
|
||||
creature->AI()->OnSpellClick(clicker, result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1013,8 +1013,11 @@ class npc_dream_portal : public CreatureScript
|
||||
{
|
||||
}
|
||||
|
||||
void OnSpellClick(Unit* /*clicker*/)
|
||||
void OnSpellClick(Unit* /*clicker*/, bool& result)
|
||||
{
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
_used = true;
|
||||
me->DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
@@ -709,8 +709,11 @@ class boss_flame_leviathan_overload_device : public CreatureScript
|
||||
{
|
||||
}
|
||||
|
||||
void OnSpellClick(Unit* /*clicker*/)
|
||||
void OnSpellClick(Unit* /*clicker*/, bool& result)
|
||||
{
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
if (me->GetVehicle())
|
||||
{
|
||||
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
|
||||
|
||||
@@ -1421,8 +1421,10 @@ class npc_descend_into_madness : public CreatureScript
|
||||
{
|
||||
npc_descend_into_madnessAI(Creature* creature) : PassiveAI(creature), _instance(creature->GetInstanceScript()) { }
|
||||
|
||||
void OnSpellClick(Unit* clicker)
|
||||
void OnSpellClick(Unit* clicker, bool& result)
|
||||
{
|
||||
if (!result)
|
||||
return;
|
||||
clicker->RemoveAurasDueToSpell(SPELL_BRAIN_LINK);
|
||||
me->DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user