mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 02:20:27 +00:00
fix(Scripts/Hyjal): correctly despawn summoned creatures on Jaina/Thrall death (#18997)
* init * change logic despawning of bosses is not really done the normal way, but it's forced with a set amount of guids. So we simply need to register the summons as guids as well * small fixes * Delete creature_scripts.sql * Update boss_azgalor.cpp
This commit is contained in:
@@ -32,11 +32,6 @@ enum Spells
|
||||
SPELL_INFERNAL_IMMOLATION = 31304
|
||||
};
|
||||
|
||||
enum Misc
|
||||
{
|
||||
NPC_TOWERING_INFERNAL = 17818
|
||||
};
|
||||
|
||||
enum Texts
|
||||
{
|
||||
SAY_ONDEATH = 0,
|
||||
@@ -59,22 +54,6 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
void EnterEvadeMode(EvadeReason /*why*/) override
|
||||
{
|
||||
std::list<Creature* > infernalList;
|
||||
me->GetCreatureListWithEntryInGrid(infernalList, NPC_TOWERING_INFERNAL, 100.0f);
|
||||
if (infernalList.size() > 0)
|
||||
{
|
||||
for (Creature* infernal : infernalList)
|
||||
{
|
||||
infernal->DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
infernalList.clear();
|
||||
instance->SetData(DATA_RESET_ALLIANCE, 0);
|
||||
me->DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit * who) override
|
||||
{
|
||||
BossAI::JustEngagedWith(who);
|
||||
@@ -157,7 +136,6 @@ public:
|
||||
|
||||
private:
|
||||
bool _recentlySpoken;
|
||||
|
||||
};
|
||||
|
||||
class spell_anetheron_sleep : public SpellScript
|
||||
|
||||
@@ -30,11 +30,6 @@ enum Spells
|
||||
SPELL_BERSERK = 26662
|
||||
};
|
||||
|
||||
enum Misc
|
||||
{
|
||||
NPC_LESSER_DOOMGUARD = 17864
|
||||
};
|
||||
|
||||
enum Texts
|
||||
{
|
||||
SAY_ONDEATH = 0,
|
||||
@@ -57,22 +52,6 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
void EnterEvadeMode(EvadeReason /*why*/) override
|
||||
{
|
||||
std::list<Creature* > doomguardList;
|
||||
me->GetCreatureListWithEntryInGrid(doomguardList, NPC_LESSER_DOOMGUARD, 100.0f);
|
||||
if (doomguardList.size() > 0)
|
||||
{
|
||||
for (Creature* doomguard : doomguardList)
|
||||
{
|
||||
doomguard->DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
doomguardList.clear();
|
||||
instance->SetData(DATA_RESET_HORDE, 0);
|
||||
me->DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
void JustEngagedWith(Unit * who) override
|
||||
{
|
||||
BossAI::JustEngagedWith(who);
|
||||
@@ -137,7 +116,6 @@ public:
|
||||
|
||||
private:
|
||||
bool _recentlySpoken;
|
||||
|
||||
};
|
||||
|
||||
class spell_azgalor_doom : public AuraScript
|
||||
|
||||
@@ -120,7 +120,11 @@ enum HyjalCreaturesIds
|
||||
NPC_KAZROGAL = 17888,
|
||||
NPC_AZGALOR = 17842,
|
||||
NPC_ARCHIMONDE = 17968,
|
||||
NPC_WORLD_TRIGGER_TINY = 21987
|
||||
NPC_WORLD_TRIGGER_TINY = 21987,
|
||||
|
||||
// Boss summons
|
||||
NPC_TOWERING_INFERNAL = 17818,
|
||||
NPC_LESSER_DOOMGUARD = 17864
|
||||
};
|
||||
|
||||
enum HyjalGameobjectIds
|
||||
|
||||
@@ -102,6 +102,7 @@ public:
|
||||
trash = 0;
|
||||
_currentWave = 0;
|
||||
_encounterNPCs.clear();
|
||||
_summonedNPCs.clear();
|
||||
_baseAlliance.clear();
|
||||
_baseHorde.clear();
|
||||
_infernalTargets.clear();
|
||||
@@ -200,6 +201,13 @@ public:
|
||||
_encounterNPCs.insert(creature->GetGUID()); // Used for despawning on wipe
|
||||
}
|
||||
break;
|
||||
case NPC_TOWERING_INFERNAL:
|
||||
case NPC_LESSER_DOOMGUARD:
|
||||
if (creature->IsSummon())
|
||||
{
|
||||
_summonedNPCs.insert(creature->GetGUID());
|
||||
}
|
||||
break;
|
||||
}
|
||||
InstanceScript::OnCreatureCreate(creature);
|
||||
}
|
||||
@@ -233,6 +241,10 @@ public:
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NPC_TOWERING_INFERNAL:
|
||||
case NPC_LESSER_DOOMGUARD:
|
||||
_summonedNPCs.erase(unit->ToCreature()->GetGUID());
|
||||
break;
|
||||
case NPC_WINTERCHILL:
|
||||
case NPC_ANETHERON:
|
||||
case NPC_KAZROGAL:
|
||||
@@ -402,6 +414,11 @@ public:
|
||||
if (Creature* creature = instance->GetCreature(guid))
|
||||
creature->DespawnOrUnsummon();
|
||||
|
||||
// also force despawn boss summons
|
||||
for (ObjectGuid const& guid : _summonedNPCs)
|
||||
if (Creature* creature = instance->GetCreature(guid))
|
||||
creature->DespawnOrUnsummon();
|
||||
|
||||
_scheduler.Schedule(300s, [this](TaskContext)
|
||||
{
|
||||
for (ObjectGuid const& guid : _baseAlliance)
|
||||
@@ -420,6 +437,11 @@ public:
|
||||
if (Creature* creature = instance->GetCreature(guid))
|
||||
creature->DespawnOrUnsummon();
|
||||
|
||||
// also force despawn boss summons
|
||||
for (ObjectGuid const& guid : _summonedNPCs)
|
||||
if (Creature* creature = instance->GetCreature(guid))
|
||||
creature->DespawnOrUnsummon();
|
||||
|
||||
_scheduler.Schedule(300s, [this](TaskContext)
|
||||
{
|
||||
for (ObjectGuid const& guid : _baseHorde)
|
||||
@@ -455,6 +477,7 @@ public:
|
||||
case DATA_RESET_WAVES:
|
||||
_scheduler.CancelGroup(CONTEXT_GROUP_WAVES);
|
||||
_encounterNPCs.clear();
|
||||
_summonedNPCs.clear();
|
||||
_currentWave = 0;
|
||||
trash = 0;
|
||||
_bossWave = 0;
|
||||
@@ -546,6 +569,7 @@ public:
|
||||
uint8 _retreat;
|
||||
TaskScheduler _scheduler;
|
||||
GuidSet _encounterNPCs;
|
||||
GuidSet _summonedNPCs;
|
||||
GuidSet _baseAlliance;
|
||||
GuidSet _baseHorde;
|
||||
GuidVector _infernalTargets;
|
||||
|
||||
Reference in New Issue
Block a user