mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 18:10:26 +00:00
fix(Core/BWL): Suppression traps can be disarmed (#10163)
* Fix(Core/BWL): Suppression traps can be disarmed * missing override (why not present before?)
This commit is contained in:
@@ -51,7 +51,8 @@ enum Events
|
||||
|
||||
enum Actions
|
||||
{
|
||||
ACTION_DEACTIVATE = 0
|
||||
ACTION_DEACTIVATE = 0,
|
||||
ACTION_DISARMED = 1
|
||||
};
|
||||
|
||||
class boss_broodlord : public CreatureScript
|
||||
@@ -140,6 +141,19 @@ class go_suppression_device : public GameObjectScript
|
||||
public:
|
||||
go_suppression_device() : GameObjectScript("go_suppression_device") { }
|
||||
|
||||
void OnLootStateChanged(GameObject* go, uint32 state, Unit* /*unit*/) override
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
|
||||
case GO_JUST_DEACTIVATED: // This case prevents the Gameobject despawn by Disarm Trap
|
||||
go->SetLootState(GO_READY);
|
||||
case GO_ACTIVATED:
|
||||
go->AI()->DoAction(ACTION_DISARMED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
struct go_suppression_deviceAI : public GameObjectAI
|
||||
{
|
||||
go_suppression_deviceAI(GameObject* go) : GameObjectAI(go), _instance(go->GetInstanceScript()), _active(true) { }
|
||||
@@ -178,21 +192,6 @@ class go_suppression_device : public GameObjectScript
|
||||
}
|
||||
}
|
||||
|
||||
void OnLootStateChanged(uint32 state, Unit* /*unit*/)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case GO_ACTIVATED:
|
||||
Deactivate();
|
||||
_events.CancelEvent(EVENT_SUPPRESSION_CAST);
|
||||
_events.ScheduleEvent(EVENT_SUPPRESSION_RESET, 30000, 120000);
|
||||
break;
|
||||
case GO_JUST_DEACTIVATED: // This case prevents the Gameobject despawn by Disarm Trap
|
||||
me->SetLootState(GO_READY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DoAction(int32 action) override
|
||||
{
|
||||
if (action == ACTION_DEACTIVATE)
|
||||
@@ -200,6 +199,12 @@ class go_suppression_device : public GameObjectScript
|
||||
Deactivate();
|
||||
_events.CancelEvent(EVENT_SUPPRESSION_RESET);
|
||||
}
|
||||
else if (action == ACTION_DISARMED)
|
||||
{
|
||||
Deactivate();
|
||||
_events.CancelEvent(EVENT_SUPPRESSION_CAST);
|
||||
_events.ScheduleEvent(EVENT_SUPPRESSION_RESET, urand(30000, 120000));
|
||||
}
|
||||
}
|
||||
|
||||
void Activate()
|
||||
@@ -212,6 +217,7 @@ class go_suppression_device : public GameObjectScript
|
||||
me->SetLootState(GO_READY);
|
||||
me->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
|
||||
_events.ScheduleEvent(EVENT_SUPPRESSION_CAST, 1000);
|
||||
me->Respawn();
|
||||
}
|
||||
|
||||
void Deactivate()
|
||||
@@ -230,7 +236,7 @@ class go_suppression_device : public GameObjectScript
|
||||
bool _active;
|
||||
};
|
||||
|
||||
GameObjectAI* GetAI(GameObject* go) const
|
||||
GameObjectAI* GetAI(GameObject* go) const override
|
||||
{
|
||||
return new go_suppression_deviceAI(go);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user