mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 18:40:28 +00:00
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:
@@ -61,11 +61,13 @@ struct boss_captain_skarloc : public BossAI
|
||||
}
|
||||
|
||||
SummonList summons;
|
||||
bool _spawnedAdds;
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_Reset();
|
||||
summons.DespawnAll();
|
||||
_spawnedAdds = false;
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* summon) override
|
||||
@@ -108,27 +110,31 @@ struct boss_captain_skarloc : public BossAI
|
||||
if (type != ESCORT_MOTION_TYPE)
|
||||
return;
|
||||
|
||||
// Xinef: we can rely here on internal counting
|
||||
if (id == 1)
|
||||
if (!_spawnedAdds)
|
||||
{
|
||||
me->SummonCreature(NPC_DURNHOLDE_MAGE, 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);
|
||||
}
|
||||
else if (id == 2)
|
||||
{
|
||||
me->Dismount();
|
||||
me->SetWalk(true);
|
||||
for (SummonList::const_iterator itr = summons.begin(); itr != summons.end(); ++itr)
|
||||
if (id == 1)
|
||||
{
|
||||
if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
|
||||
{
|
||||
summon->SetWalk(true);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
mount->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||
me->Dismount();
|
||||
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->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);
|
||||
summon->SetInCombatWithZone();
|
||||
adds->SetImmuneToAll(false);
|
||||
adds->SetInCombatWithZone();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 8s);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user