fix(Scripts/DurnholdeKeep): Captain Skarloc spawning double/wrong adds (#17667)
* fix(Scripts/DurnholdeKeep): Captain Skarloc spawning double/wrong adds * Ss * DoForAllSummons
This commit is contained in:
+29
-23
@@ -61,11 +61,13 @@ struct boss_captain_skarloc : public BossAI
|
|||||||
}
|
}
|
||||||
|
|
||||||
SummonList summons;
|
SummonList summons;
|
||||||
|
bool _spawnedAdds;
|
||||||
|
|
||||||
void Reset() override
|
void Reset() override
|
||||||
{
|
{
|
||||||
_Reset();
|
_Reset();
|
||||||
summons.DespawnAll();
|
summons.DespawnAll();
|
||||||
|
_spawnedAdds = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JustSummoned(Creature* summon) override
|
void JustSummoned(Creature* summon) override
|
||||||
@@ -108,27 +110,31 @@ struct boss_captain_skarloc : public BossAI
|
|||||||
if (type != ESCORT_MOTION_TYPE)
|
if (type != ESCORT_MOTION_TYPE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Xinef: we can rely here on internal counting
|
if (!_spawnedAdds)
|
||||||
if (id == 1)
|
|
||||||
{
|
{
|
||||||
me->SummonCreature(NPC_DURNHOLDE_MAGE, 2038.549f, 273.303f, 63.420f, 5.30f, TEMPSUMMON_MANUAL_DESPAWN);
|
if (id == 1)
|
||||||
me->SummonCreature(NPC_DURNHOLDE_VETERAN, 2032.810f, 269.416f, 63.561f, 5.30f, TEMPSUMMON_MANUAL_DESPAWN);
|
|
||||||
}
|
|
||||||
else if (id == 2)
|
|
||||||
{
|
|
||||||
me->Dismount();
|
|
||||||
me->SetWalk(true);
|
|
||||||
for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
|
|
||||||
{
|
{
|
||||||
if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
|
me->SummonCreature(NPC_DURNHOLDE_WARDEN, 2038.549f, 273.303f, 63.420f, 5.30f, TEMPSUMMON_MANUAL_DESPAWN);
|
||||||
{
|
me->SummonCreature(NPC_DURNHOLDE_VETERAN, 2032.810f, 269.416f, 63.561f, 5.30f, TEMPSUMMON_MANUAL_DESPAWN);
|
||||||
summon->SetWalk(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (Creature* mount = me->SummonCreature(NPC_SKARLOC_MOUNT, 2049.12f, 252.31f, 62.855f, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN))
|
else if (id == 2)
|
||||||
{
|
{
|
||||||
mount->SetImmuneToNPC(true);
|
me->Dismount();
|
||||||
mount->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
me->SetWalk(true);
|
||||||
|
summons.DoForAllSummons([&](WorldObject* summon)
|
||||||
|
{
|
||||||
|
if (summon)
|
||||||
|
{
|
||||||
|
summon->ToCreature()->SetWalk(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (Creature* mount = me->SummonCreature(NPC_SKARLOC_MOUNT, 2049.12f, 252.31f, 62.855f, me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN))
|
||||||
|
{
|
||||||
|
mount->SetImmuneToNPC(true);
|
||||||
|
mount->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
_spawnedAdds = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,17 +146,17 @@ struct boss_captain_skarloc : public BossAI
|
|||||||
{
|
{
|
||||||
me->SetImmuneToAll(false);
|
me->SetImmuneToAll(false);
|
||||||
me->SetInCombatWithZone();
|
me->SetInCombatWithZone();
|
||||||
for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
|
summons.DoForAllSummons([&](WorldObject* summon)
|
||||||
{
|
{
|
||||||
if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
|
if (Creature* adds = summon->ToCreature())
|
||||||
{
|
{
|
||||||
if (summon->GetEntry() != NPC_SKARLOC_MOUNT)
|
if (adds->GetEntry() != NPC_SKARLOC_MOUNT)
|
||||||
{
|
{
|
||||||
summon->SetImmuneToAll(false);
|
adds->SetImmuneToAll(false);
|
||||||
summon->SetInCombatWithZone();
|
adds->SetInCombatWithZone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}, 8s);
|
}, 8s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user