fix(Core/Script): Trial of the Crusader (#2888)

* The floor will remain broken after a wipe

* Anub'arak will respawn correctly after wiping
This commit is contained in:
lineagedr
2020-05-27 22:58:28 +03:00
committed by GitHub
parent 3c5bb73f29
commit 2743874e5d
2 changed files with 58 additions and 38 deletions

View File

@@ -59,6 +59,40 @@ public:
uint64 GO_WebDoorGUID; uint64 GO_WebDoorGUID;
uint64 GO_FloorGUID; uint64 GO_FloorGUID;
void SpawnAnubArak()
{
if (InstanceProgress == INSTANCE_PROGRESS_ANUB_ARAK)
{
if (Creature* barrett = instance->GetCreature(NPC_BarrettGUID))
{
barrett->SetVisible(false);
if (AttemptsLeft)
if (!ObjectAccessor::GetCreature(*barrett, NPC_AnubarakGUID))
barrett->SummonCreature(NPC_ANUBARAK, Locs[LOC_ANUB].GetPositionX(), Locs[LOC_ANUB].GetPositionY(), Locs[LOC_ANUB].GetPositionZ(), Locs[LOC_ANUB].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 630000000);
}
// move corpses
const uint64 npcs[4] = { NPC_IcehowlGUID, NPC_JaraxxusGUID, NPC_LightbaneGUID, NPC_DarkbaneGUID };
for (const uint64 i : npcs)
{
if (Creature* c = instance->GetCreature(i))
{
if (c->GetGUID() == NPC_IcehowlGUID)
c->UpdatePosition(626.57f, 162.8f, 140.25f, 4.44f, true);
else if (c->GetGUID() == NPC_JaraxxusGUID)
c->UpdatePosition(603.92f, 102.61f, 141.85f, 1.4f, true);
else if (c->GetGUID() == NPC_LightbaneGUID)
c->UpdatePosition(634.58f, 147.16f, 140.5f, 3.02f, true);
else if (c->GetGUID() == NPC_DarkbaneGUID)
c->UpdatePosition(630.88f, 131.39f, 140.8f, 3.02f, true);
c->StopMovingOnCurrentPos();
c->DestroyForNearbyPlayers();
}
}
}
}
bool IsValidDedicatedInsanityItem(const ItemTemplate* item) bool IsValidDedicatedInsanityItem(const ItemTemplate* item)
{ {
if (!item) // should not happen, but checked in GetAverageItemLevel() if (!item) // should not happen, but checked in GetAverageItemLevel()
@@ -230,6 +264,8 @@ public:
break; break;
case GO_ARGENT_COLISEUM_FLOOR: case GO_ARGENT_COLISEUM_FLOOR:
GO_FloorGUID = go->GetGUID(); GO_FloorGUID = go->GetGUID();
if (InstanceProgress == INSTANCE_PROGRESS_ANUB_ARAK)
go->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
break; break;
case GO_SOUTH_PORTCULLIS: case GO_SOUTH_PORTCULLIS:
case GO_NORTH_PORTCULLIS: case GO_NORTH_PORTCULLIS:
@@ -1301,37 +1337,8 @@ public:
if( Creature* t = c->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f, true) ) if( Creature* t = c->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f, true) )
t->DespawnOrUnsummon(); t->DespawnOrUnsummon();
if( Creature* barrett = instance->GetCreature(NPC_BarrettGUID) ) InstanceProgress = INSTANCE_PROGRESS_ANUB_ARAK;
{ SpawnAnubArak();
barrett->SetVisible(false);
barrett->SummonCreature(NPC_ANUBARAK, Locs[LOC_ANUB].GetPositionX(), Locs[LOC_ANUB].GetPositionY(), Locs[LOC_ANUB].GetPositionZ(), Locs[LOC_ANUB].GetOrientation(), TEMPSUMMON_CORPSE_TIMED_DESPAWN, 630000000);
}
// move corpses:
if( Creature* c = instance->GetCreature(NPC_IcehowlGUID) )
{
c->UpdatePosition(626.57f, 162.8f, 140.25f, 4.44f, true);
c->StopMovingOnCurrentPos();
c->DestroyForNearbyPlayers();
}
if( Creature* c = instance->GetCreature(NPC_JaraxxusGUID) )
{
c->UpdatePosition(603.92f, 102.61f, 141.85f, 1.4f, true);
c->StopMovingOnCurrentPos();
c->DestroyForNearbyPlayers();
}
if( Creature* c = instance->GetCreature(NPC_LightbaneGUID) )
{
c->UpdatePosition(634.58f, 147.16f, 140.5f, 3.02f, true);
c->StopMovingOnCurrentPos();
c->DestroyForNearbyPlayers();
}
if( Creature* c = instance->GetCreature(NPC_DarkbaneGUID) )
{
c->UpdatePosition(630.88f, 131.39f, 140.8f, 3.02f, true);
c->StopMovingOnCurrentPos();
c->DestroyForNearbyPlayers();
}
} }
events.PopEvent(); events.PopEvent();
events.RescheduleEvent(EVENT_SCENE_410, 2000); events.RescheduleEvent(EVENT_SCENE_410, 2000);
@@ -1427,6 +1434,9 @@ public:
if( DoNeedCleanup(true) ) if( DoNeedCleanup(true) )
InstanceCleanup(); InstanceCleanup();
// if missing spawn anub'arak
SpawnAnubArak();
events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL); events.RescheduleEvent(EVENT_CHECK_PLAYERS, CLEANUP_CHECK_INTERVAL);
} }
@@ -1533,14 +1543,23 @@ public:
NPC_LightbaneGUID = 0; NPC_LightbaneGUID = 0;
break; break;
case INSTANCE_PROGRESS_VALKYR_DEAD: case INSTANCE_PROGRESS_VALKYR_DEAD:
if( GameObject* floor = instance->GetGameObject(GO_FloorGUID) ) case INSTANCE_PROGRESS_ANUB_ARAK:
floor->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); /*if( GameObject* floor = instance->GetGameObject(GO_FloorGUID) )
if( Creature* c = instance->GetCreature(NPC_BarrettGUID) ) floor->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);*/
if (Creature* c = instance->GetCreature(NPC_BarrettGUID))
{ {
c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); if (InstanceProgress == INSTANCE_PROGRESS_ANUB_ARAK)
c->SetVisible(true); {
c->SetFacingTo(c->GetOrientation()); c->SetVisible(false);
if( Creature* t = c->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f, true) ) c->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
else
{
c->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
c->SetVisible(true);
c->SetFacingTo(c->GetOrientation());
}
if (Creature* t = c->FindNearestCreature(NPC_WORLD_TRIGGER, 500.0f, true))
t->DespawnOrUnsummon(); t->DespawnOrUnsummon();
} }
if( Creature* c = instance->GetCreature(NPC_LichKingGUID) ) if( Creature* c = instance->GetCreature(NPC_LichKingGUID) )

View File

@@ -39,6 +39,7 @@ enum Progress
INSTANCE_PROGRESS_JARAXXUS_DEAD, INSTANCE_PROGRESS_JARAXXUS_DEAD,
INSTANCE_PROGRESS_FACTION_CHAMPIONS_DEAD = 6, INSTANCE_PROGRESS_FACTION_CHAMPIONS_DEAD = 6,
INSTANCE_PROGRESS_VALKYR_DEAD = 8, INSTANCE_PROGRESS_VALKYR_DEAD = 8,
INSTANCE_PROGRESS_ANUB_ARAK,
INSTANCE_PROGRESS_DONE = 10, INSTANCE_PROGRESS_DONE = 10,
}; };