mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-14 22:19:25 +01:00
Core/CreatureAI: Implement an OnSpellClick hook instead of the ugly way that uses DoAction with EVENT_SPELLCLICK.
Core/SmartAI: Implement SMART_EVENT_ON_SPELLCLICK. Parameter is the clicker. If someone could update the wiki accordingly for SAI I would appreciate that. Thanks to @Shauren for some help!
This commit is contained in:
@@ -1013,11 +1013,8 @@ class npc_dream_portal : public CreatureScript
|
||||
{
|
||||
}
|
||||
|
||||
void DoAction(int32 const action)
|
||||
void OnSpellClick(Unit* /*clicker*/)
|
||||
{
|
||||
if (action != EVENT_SPELLCLICK)
|
||||
return;
|
||||
|
||||
_used = true;
|
||||
me->DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
@@ -720,20 +720,18 @@ class boss_flame_leviathan_overload_device : public CreatureScript
|
||||
{
|
||||
}
|
||||
|
||||
void DoAction(const int32 param)
|
||||
void OnSpellClick(Unit* /*clicker*/)
|
||||
{
|
||||
if (param == EVENT_SPELLCLICK)
|
||||
if (me->GetVehicle())
|
||||
{
|
||||
if (me->GetVehicle())
|
||||
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
|
||||
if (Unit* player = me->GetVehicle()->GetPassenger(SEAT_PLAYER))
|
||||
{
|
||||
me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
if (Unit* player = me->GetVehicle()->GetPassenger(SEAT_PLAYER))
|
||||
{
|
||||
me->GetVehicleBase()->CastSpell(player, SPELL_SMOKE_TRAIL, true);
|
||||
player->GetMotionMaster()->MoveKnockbackFrom(me->GetVehicleBase()->GetPositionX(), me->GetVehicleBase()->GetPositionY(), 30, 30);
|
||||
player->ExitVehicle();
|
||||
}
|
||||
me->GetVehicleBase()->CastSpell(player, SPELL_SMOKE_TRAIL, true);
|
||||
player->GetMotionMaster()->MoveKnockbackFrom(me->GetVehicleBase()->GetPositionX(), me->GetVehicleBase()->GetPositionY(), 30, 30);
|
||||
player->ExitVehicle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user