mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
fix(Scripts/AN): Ensure only the watchers minions start the event (#24371)
This commit is contained in:
@@ -118,22 +118,41 @@ public:
|
|||||||
|
|
||||||
void OnUnitDeath(Unit* unit) override
|
void OnUnitDeath(Unit* unit) override
|
||||||
{
|
{
|
||||||
if (unit->EntryEquals(NPC_WATCHER_GASHRA, NPC_WATCHER_NARJIL, NPC_WATCHER_SILTHIK, NPC_ANUBAR_SHADOWCASTER, NPC_ANUBAR_SKIRMISHER, NPC_ANUBAR_WARRIOR))
|
if (!unit->EntryEquals(NPC_WATCHER_GASHRA, NPC_WATCHER_NARJIL, NPC_WATCHER_SILTHIK, NPC_ANUBAR_SHADOWCASTER, NPC_ANUBAR_SKIRMISHER, NPC_ANUBAR_WARRIOR))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Creature* creature = unit->ToCreature();
|
||||||
|
if (!creature)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// For trash mobs, ensure their leader is a Watcher
|
||||||
|
if (unit->EntryEquals(NPC_ANUBAR_SHADOWCASTER, NPC_ANUBAR_SKIRMISHER, NPC_ANUBAR_WARRIOR))
|
||||||
{
|
{
|
||||||
if (Creature* creature = unit->ToCreature())
|
CreatureGroup* formation = creature->GetFormation();
|
||||||
{
|
if (!formation)
|
||||||
ObjectGuid creatureGuid = creature->GetGUID();
|
return;
|
||||||
scheduler.CancelAll();
|
|
||||||
scheduler.Schedule(1s, [this, creatureGuid](TaskContext /*context*/)
|
Creature* leader = formation->GetLeader();
|
||||||
{
|
if (!leader || !leader->EntryEquals(NPC_WATCHER_GASHRA, NPC_WATCHER_NARJIL, NPC_WATCHER_SILTHIK))
|
||||||
if (Creature* creature = instance->GetCreature(creatureGuid))
|
return;
|
||||||
if (CreatureGroup* formation = creature->GetFormation())
|
|
||||||
if (!formation->IsAnyMemberAlive())
|
|
||||||
if (Creature* krikthir = GetCreature(DATA_KRIKTHIR))
|
|
||||||
krikthir->AI()->DoAction(ACTION_MINION_DIED);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ObjectGuid creatureGuid = creature->GetGUID();
|
||||||
|
|
||||||
|
scheduler.CancelAll();
|
||||||
|
scheduler.Schedule(1s, [this, creatureGuid](TaskContext /*context*/)
|
||||||
|
{
|
||||||
|
Creature* creature = instance->GetCreature(creatureGuid);
|
||||||
|
if (!creature)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CreatureGroup* formation = creature->GetFormation();
|
||||||
|
if (!formation || formation->IsAnyMemberAlive())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Creature* krikthir = GetCreature(DATA_KRIKTHIR))
|
||||||
|
krikthir->AI()->DoAction(ACTION_MINION_DIED);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user