diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp index ed439fbe9..00df3864f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp @@ -51,7 +51,8 @@ public: SummonedRend = false; if (instance->GetBossState(DATA_GYTH) == IN_PROGRESS) { - instance->SetBossState(DATA_GYTH, DONE); + instance->SetBossState(DATA_GYTH, NOT_STARTED); + summons.DespawnAll(); me->DespawnOrUnsummon(); } } @@ -83,10 +84,16 @@ public: } } + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + summon->AI()->AttackStart(me->SelectVictim()); + } + void UpdateAI(uint32 diff) { - if (!SummonedRend && HealthBelowPct(5)) + if (!SummonedRend && HealthBelowPct(25)) { DoCast(me, SPELL_SUMMON_REND); me->RemoveAura(SPELL_REND_MOUNTS); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp index 584b958f8..f67d0272e 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp @@ -53,57 +53,64 @@ enum Misc REND_PATH_2 = 1379681, }; -/* + struct Wave { uint32 entry; float x_pos; float y_pos; float z_pos; - float o_pos; +}; + +static Wave Wave1[] = // 22 sec +{ + { 10447, 202.511f, -421.307f, 110.9877f }, + { 10442, 204.015f, -418.443f, 110.989f }, + { 10442, 203.142f, -423.999f, 110.986f }, + { 10442, 201.008f, -416.648f, 110.974f } }; static Wave Wave2[]= // 22 sec { - { 10447, 209.8637f, -428.2729f, 110.9877f, 0.6632251f }, - { 10442, 209.3122f, -430.8724f, 110.9814f, 2.9147f }, - { 10442, 211.3309f, -425.9111f, 111.0006f, 1.727876f } + { 10447, 209.8637f, -428.2729f, 110.9877f }, + { 10442, 209.3122f, -430.8724f, 110.9814f }, + { 10442, 211.3309f, -425.9111f, 111.0006f } }; static Wave Wave3[]= // 60 sec { - { 10742, 208.6493f, -424.5787f, 110.9872f, 5.8294f }, - { 10447, 203.9482f, -428.9446f, 110.982f, 4.677482f }, - { 10442, 203.3441f, -426.8668f, 110.9772f, 4.712389f }, - { 10442, 206.3079f, -424.7509f, 110.9943f, 4.08407f } + { 10742, 208.6493f, -424.5787f, 110.9872f }, + { 10447, 203.9482f, -428.9446f, 110.982f, }, + { 10442, 203.3441f, -426.8668f, 110.9772f }, + { 10442, 206.3079f, -424.7509f, 110.9943f } }; static Wave Wave4[]= // 49 sec { - { 10742, 212.3541f, -412.6826f, 111.0352f, 5.88176f }, - { 10447, 212.5754f, -410.2841f, 111.0296f, 2.740167f }, - { 10442, 212.3449f, -414.8659f, 111.0348f, 2.356194f }, - { 10442, 210.6568f, -412.1552f, 111.0124f, 0.9773844f } + { 10742, 212.3541f, -412.6826f, 111.0352f }, + { 10447, 212.5754f, -410.2841f, 111.0296f }, + { 10442, 212.3449f, -414.8659f, 111.0348f }, + { 10442, 210.6568f, -412.1552f, 111.0124f } }; static Wave Wave5[]= // 60 sec { - { 10742, 210.2188f, -410.6686f, 111.0211f, 5.8294f }, - { 10447, 209.4078f, -414.13f, 111.0264f, 4.677482f }, - { 10442, 208.0858f, -409.3145f, 111.0118f, 4.642576f }, - { 10442, 207.9811f, -413.0728f, 111.0098f, 5.288348f }, - { 10442, 208.0854f, -412.1505f, 111.0057f, 4.08407f } + { 10742, 210.2188f, -410.6686f, 111.0211f }, + { 10447, 209.4078f, -414.13f, 111.0264f }, + { 10442, 208.0858f, -409.3145f, 111.0118f }, + { 10442, 207.9811f, -413.0728f, 111.0098f }, + { 10442, 208.0854f, -412.1505f, 111.0057f } }; static Wave Wave6[]= // 27 sec { - { 10742, 213.9138f, -426.512f, 111.0013f, 3.316126f }, - { 10447, 213.7121f, -429.8102f, 110.9888f, 1.413717f }, - { 10447, 213.7157f, -424.4268f, 111.009f, 3.001966f }, - { 10442, 210.8935f, -423.913f, 111.0125f, 5.969026f }, - { 10442, 212.2642f, -430.7648f, 110.9807f, 5.934119f } + { 10742, 213.9138f, -426.512f, 111.0013f }, + { 10447, 213.7121f, -429.8102f, 110.9888f }, + { 10447, 213.7157f, -424.4268f, 111.009f, }, + { 10442, 210.8935f, -423.913f, 111.0125f }, + { 10442, 212.2642f, -430.7648f, 110.9807f } }; -*/ + /*Position const GythLoc = { 211.762f, -397.5885f, 111.1817f, 4.747295f }; Position const Teleport1Loc = { 194.2993f, -474.0814f, 121.4505f, -0.01225555f }; @@ -157,9 +164,53 @@ public: void Reset() { _Reset(); + + if (instance->GetBossState(DATA_GYTH) == IN_PROGRESS) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_PREPARATION); + return; + } + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_PREPARATION); gythEvent = false; victorGUID = 0; - portcullisGUID = 0; + waveDoorGUID = 0; + + summons.DespawnAll(); + + if (Creature* victor = me->FindNearestCreature(NPC_LORD_VICTOR_NEFARIUS, 5.0f, true)) + victor->Respawn(true); + + if (GameObject* exitDoor = me->GetMap()->GetGameObject(instance->GetData64(GO_GYTH_ENTRY_DOOR))) + exitDoor->SetGoState(GO_STATE_ACTIVE); + + instance->SetBossState(DATA_WARCHIEF_REND_BLACKHAND, NOT_STARTED); + } + + void SummonWave(Wave* wave) + { + for (uint8 i = 0; i < sizeof(wave); ++i) + me->SummonCreature(wave[i].entry, wave[i].x_pos, wave[i].y_pos, wave[i].z_pos, M_PI); + + if (GameObject* waveDoor = me->GetMap()->GetGameObject(waveDoorGUID)) + waveDoor->UseDoorOrButton(); + } + + void JustSummoned(Creature* summon) + { + summons.Summon(summon); + + if (summon->GetEntry() == NPC_GYTH) + { + summon->AI()->SetData(1, 1); + me->DespawnOrUnsummon(); + return; + } + + if (Unit* target = SelectTargetFromPlayerList(100.0f)) + summon->AI()->AttackStart(target); + else + Reset(); } void EnterCombat(Unit* /*who*/) @@ -175,6 +226,11 @@ public: _JustDied(); if (Creature* victor = me->FindNearestCreature(NPC_LORD_VICTOR_NEFARIUS, 75.0f, true)) victor->AI()->SetData(1, 2); + + if (GameObject* exitDoor = me->GetMap()->GetGameObject(instance->GetData64(GO_GYTH_ENTRY_DOOR))) + exitDoor->SetGoState(GO_STATE_ACTIVE); + + instance->SetBossState(DATA_WARCHIEF_REND_BLACKHAND, DONE); } void SetData(uint32 type, uint32 data) @@ -185,11 +241,18 @@ public: { gythEvent = true; - if (Creature* victor = me->FindNearestCreature(NPC_LORD_VICTOR_NEFARIUS, 5.0f, true)) + Creature* victor = me->FindNearestCreature(NPC_LORD_VICTOR_NEFARIUS, 5.0f, false); + + if (victor) + victor->Respawn(); + else + victor = me->FindNearestCreature(NPC_LORD_VICTOR_NEFARIUS, 5.0f, true); + + if (victor) victorGUID = victor->GetGUID(); if (GameObject* portcullis = me->FindNearestGameObject(GO_DR_PORTCULLIS, 50.0f)) - portcullisGUID = portcullis->GetGUID(); + waveDoorGUID = portcullis->GetGUID(); events.ScheduleEvent(EVENT_TURN_TO_PLAYER, 0); events.ScheduleEvent(EVENT_START_1, 1000); @@ -206,11 +269,6 @@ public: case 5: events.ScheduleEvent(EVENT_TELEPORT_1, 2000); break; - case 11: - if (Creature* gyth = me->FindNearestCreature(NPC_GYTH, 10.0f, true)) - gyth->AI()->SetData(1, 1); - me->DespawnOrUnsummon(1000); - break; } } } @@ -226,8 +284,14 @@ public: switch (eventId) { case EVENT_START_1: + instance->SetBossState(DATA_WARCHIEF_REND_BLACKHAND, IN_PROGRESS); + if (Creature* victor = ObjectAccessor::GetCreature(*me, victorGUID)) victor->AI()->Talk(SAY_NEFARIUS_0); + + if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetData64(GO_GYTH_ENTRY_DOOR))) + door2->SetGoState(GO_STATE_READY); + events.ScheduleEvent(EVENT_START_2, 4000); break; case EVENT_START_2: @@ -342,46 +406,29 @@ public: break; case EVENT_TELEPORT_1: me->NearTeleportTo(194.2993f, -474.0814f, 121.4505f, -0.01225555f); - events.ScheduleEvent(EVENT_TELEPORT_2, 50000); + events.ScheduleEvent(EVENT_TELEPORT_2, 13000); break; case EVENT_TELEPORT_2: me->NearTeleportTo(216.485f, -434.93f, 110.888f, -0.01225555f); me->SummonCreature(NPC_GYTH, 211.762f, -397.5885f, 111.1817f, 4.747295f); break; case EVENT_WAVE_1: - if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID)) - portcullis->UseDoorOrButton(); - // move wave + SummonWave(Wave1); break; case EVENT_WAVE_2: - // spawn wave - if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID)) - portcullis->UseDoorOrButton(); - // move wave + SummonWave(Wave2); break; case EVENT_WAVE_3: - // spawn wave - if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID)) - portcullis->UseDoorOrButton(); - // move wave + SummonWave(Wave3); break; case EVENT_WAVE_4: - // spawn wave - if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID)) - portcullis->UseDoorOrButton(); - // move wave + SummonWave(Wave4); break; case EVENT_WAVE_5: - // spawn wave - if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID)) - portcullis->UseDoorOrButton(); - // move wave + SummonWave(Wave5); break; case EVENT_WAVE_6: - // spawn wave - if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID)) - portcullis->UseDoorOrButton(); - // move wave + SummonWave(Wave6); break; default: break; @@ -421,7 +468,7 @@ public: private: bool gythEvent; uint64 victorGUID; - uint64 portcullisGUID; + uint64 waveDoorGUID; }; CreatureAI* GetAI(Creature* creature) const diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp index de42cb7ee..18151303b 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp @@ -147,8 +147,7 @@ public: break; case GO_EMBERSEER_IN: go_emberseerin = go->GetGUID(); - if (GetBossState(DATA_DRAGONSPIRE_ROOM) == DONE) - HandleGameObject(0, true, go); + HandleGameObject(0, GetBossState(DATA_DRAGONSPIRE_ROOM) == DONE, go); break; case GO_DOORS: go_doors = go->GetGUID(); @@ -506,6 +505,8 @@ public: HandleGameObject(0, true, door1); if (GameObject* door2 = instance->GetGameObject(go_doors)) HandleGameObject(0, true, door2); + if (GameObject* door3 = instance->GetGameObject(go_emberseerin)) + HandleGameObject(0, true, door3); } } @@ -629,7 +630,14 @@ public: if (!instance) return false; - if (Creature* rend = player->FindNearestCreature(NPC_WARCHIEF_REND_BLACKHAND, 50.0f)) + Creature* rend; + if (instance->GetBossState(DATA_WARCHIEF_REND_BLACKHAND) == NOT_STARTED) + { + if ((rend = player->FindNearestCreature(NPC_WARCHIEF_REND_BLACKHAND, 100.0f, false))) + rend->Respawn(true); + } + + if ((rend = player->FindNearestCreature(NPC_WARCHIEF_REND_BLACKHAND, 100.0f))) { rend->AI()->SetData(AREATRIGGER, AREATRIGGER_BLACKROCK_STADIUM); return true;