diff options
author | Shauren <shauren.trinity@gmail.com> | 2023-09-18 19:14:50 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2023-09-18 19:14:50 +0200 |
commit | 4370f2fe2933d54be4ed4dd815d62ff34a701ed2 (patch) | |
tree | 944a9cf914810451205aac073d3bb540fec322b5 | |
parent | 71f2f52303bc55f64301260e8810b4b9153f6a37 (diff) |
Scripts/Stratholme: Added missing dungeon encounter ids
12 files changed, 236 insertions, 231 deletions
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp index 6d83a03d636..4d67e50144e 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baron_rivendare.cpp @@ -16,7 +16,6 @@ */ #include "ScriptMgr.h" -#include "InstanceScript.h" #include "ScriptedCreature.h" #include "SpellInfo.h" #include "stratholme.h" @@ -62,23 +61,10 @@ uint32 const RaiseDeadSpells[6] = struct boss_baron_rivendare : public BossAI { public: - boss_baron_rivendare(Creature* creature) : BossAI(creature, TYPE_BARON), RaiseDead(false) { } - - void Reset() override - { - // needed until re-write of instance scripts is done - if (instance->GetData(TYPE_RAMSTEIN) == DONE) - instance->SetData(TYPE_BARON, NOT_STARTED); - - BossAI::Reset(); - } + boss_baron_rivendare(Creature* creature) : BossAI(creature, BOSS_RIVENDARE), RaiseDead(false) { } void JustEngagedWith(Unit* who) override { - // needed until re-write of instance scripts is done - if (instance->GetData(TYPE_BARON) == NOT_STARTED) - instance->SetData(TYPE_BARON, IN_PROGRESS); - events.ScheduleEvent(EVENT_SHADOWBOLT, 5s); events.ScheduleEvent(EVENT_CLEAVE, 8s); events.ScheduleEvent(EVENT_MORTALSTRIKE, 12s); @@ -87,14 +73,6 @@ public: BossAI::JustEngagedWith(who); } - void JustDied(Unit* killer) override - { - // needed until re-write of instance scripts is done - instance->SetData(TYPE_BARON, DONE); - - BossAI::JustDied(killer); - } - void UpdateAI(uint32 diff) override { if (!UpdateVictim()) diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp index 241af832759..dd2a0214de8 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp @@ -43,12 +43,14 @@ enum BaronessAnastariEvents struct boss_baroness_anastari : public BossAI { - boss_baroness_anastari(Creature* creature) : BossAI(creature, TYPE_BARONESS) { } + boss_baroness_anastari(Creature* creature) : BossAI(creature, BOSS_BARONESS_ANASTARI) { } ObjectGuid _possessedTargetGuid; void Reset() override { + _Reset(); + _possessedTargetGuid.Clear(); instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_POSSESS); @@ -66,13 +68,6 @@ struct boss_baroness_anastari : public BossAI events.ScheduleEvent(EVENT_SPELL_POSSESS, 20s, 30s); } - void JustDied(Unit* /*killer*/) override - { - // needed until crystals implemented, - // see line 305 instance_stratholme.cpp - instance->SetData(TYPE_BARONESS, IN_PROGRESS); - } - void UpdateAI(uint32 diff) override { if (!UpdateVictim()) diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp index c117560db30..56fa89e24de 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_cannon_master_willey.cpp @@ -90,9 +90,9 @@ public: return GetStratholmeAI<boss_cannon_master_willeyAI>(creature); } - struct boss_cannon_master_willeyAI : public ScriptedAI + struct boss_cannon_master_willeyAI : public BossAI { - boss_cannon_master_willeyAI(Creature* creature) : ScriptedAI(creature) + boss_cannon_master_willeyAI(Creature* creature) : BossAI(creature, BOSS_WILLEY_HOPEBREAKER) { Initialize(); } @@ -112,11 +112,15 @@ public: void Reset() override { + BossAI::Reset(); + Initialize(); } - void JustDied(Unit* /*killer*/) override + void JustDied(Unit* killer) override { + BossAI::JustDied(killer); + me->SummonCreature(11054, ADD_1X, ADD_1Y, ADD_1Z, ADD_1O, TEMPSUMMON_TIMED_DESPAWN, 4min); me->SummonCreature(11054, ADD_2X, ADD_2Y, ADD_2Z, ADD_2O, TEMPSUMMON_TIMED_DESPAWN, 4min); me->SummonCreature(11054, ADD_3X, ADD_3Y, ADD_3Z, ADD_3O, TEMPSUMMON_TIMED_DESPAWN, 4min); @@ -126,10 +130,6 @@ public: me->SummonCreature(11054, ADD_9X, ADD_9Y, ADD_9Z, ADD_9O, TEMPSUMMON_TIMED_DESPAWN, 4min); } - void JustEngagedWith(Unit* /*who*/) override - { - } - void UpdateAI(uint32 diff) override { //Return since we have no target diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp index 306a2bfa8eb..ca7bb764917 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_dathrohan_balnazzar.cpp @@ -79,9 +79,9 @@ public: return GetStratholmeAI<boss_dathrohan_balnazzarAI>(creature); } - struct boss_dathrohan_balnazzarAI : public ScriptedAI + struct boss_dathrohan_balnazzarAI : public BossAI { - boss_dathrohan_balnazzarAI(Creature* creature) : ScriptedAI(creature) + boss_dathrohan_balnazzarAI(Creature* creature) : BossAI(creature, BOSS_BALNAZZAR) { Initialize(); } @@ -111,24 +111,20 @@ public: void Reset() override { + BossAI::Reset(); + Initialize(); if (me->GetEntry() == NPC_BALNAZZAR) me->UpdateEntry(NPC_DATHROHAN); } - void JustDied(Unit* /*killer*/) override + void JustDied(Unit* killer) override { - static uint32 uiCount = sizeof(m_aSummonPoint)/sizeof(SummonDef); - - for (uint8 i=0; i<uiCount; ++i) - me->SummonCreature(NPC_ZOMBIE, - m_aSummonPoint[i].m_fX, m_aSummonPoint[i].m_fY, m_aSummonPoint[i].m_fZ, m_aSummonPoint[i].m_fOrient, - TEMPSUMMON_TIMED_DESPAWN, 1h); - } + BossAI::JustDied(killer); - void JustEngagedWith(Unit* /*who*/) override - { + for (SummonDef const& summon : m_aSummonPoint) + me->SummonCreature(NPC_ZOMBIE, summon.m_fX, summon.m_fY, summon.m_fZ, summon.m_fOrient, TEMPSUMMON_TIMED_DESPAWN, 1h); } void UpdateAI(uint32 uiDiff) override diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp index f67c3691e25..b8860a5b27d 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_magistrate_barthilas.cpp @@ -50,9 +50,9 @@ public: return GetStratholmeAI<boss_magistrate_barthilasAI>(creature); } - struct boss_magistrate_barthilasAI : public ScriptedAI + struct boss_magistrate_barthilasAI : public BossAI { - boss_magistrate_barthilasAI(Creature* creature) : ScriptedAI(creature) + boss_magistrate_barthilasAI(Creature* creature) : BossAI(creature, BOSS_MAGISTRATE_BARTHILAS) { Initialize(); } @@ -74,6 +74,8 @@ public: void Reset() override { + BossAI::Reset(); + Initialize(); if (me->IsAlive()) @@ -82,23 +84,13 @@ public: me->SetDisplayId(MODEL_HUMAN); } - void MoveInLineOfSight(Unit* who) override - + void JustDied(Unit* killer) override { - //nothing to see here yet - - ScriptedAI::MoveInLineOfSight(who); - } + BossAI::JustDied(killer); - void JustDied(Unit* /*killer*/) override - { me->SetDisplayId(MODEL_HUMAN); } - void JustEngagedWith(Unit* /*who*/) override - { - } - void UpdateAI(uint32 diff) override { //Return since we have no target diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp index 8aa0f5cb5d2..a79ca0cee98 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_maleki_the_pallid.cpp @@ -48,28 +48,18 @@ class boss_maleki_the_pallid : public CreatureScript public: boss_maleki_the_pallid() : CreatureScript("boss_maleki_the_pallid") { } - struct boss_maleki_the_pallidAI : public ScriptedAI + struct boss_maleki_the_pallidAI : public BossAI { - boss_maleki_the_pallidAI(Creature* creature) : ScriptedAI(creature) + boss_maleki_the_pallidAI(Creature* creature) : BossAI(creature, BOSS_MALEKI_THE_PALLID) { - instance = me->GetInstanceScript(); } - void Reset() override + void JustEngagedWith(Unit* who) override { - _events.Reset(); - } - - void JustEngagedWith(Unit* /*who*/) override - { - _events.ScheduleEvent(EVENT_FROSTBOLT, 1s); - _events.ScheduleEvent(EVENT_ICETOMB, 16s); - _events.ScheduleEvent(EVENT_DRAINLIFE, 31s); - } - - void JustDied(Unit* /*killer*/) override - { - instance->SetData(TYPE_PALLID, IN_PROGRESS); + _JustEngagedWith(who); + events.ScheduleEvent(EVENT_FROSTBOLT, 1s); + events.ScheduleEvent(EVENT_ICETOMB, 16s); + events.ScheduleEvent(EVENT_DRAINLIFE, 31s); } void UpdateAI(uint32 diff) override @@ -78,29 +68,29 @@ public: if (!UpdateVictim()) return; - _events.Update(diff); + events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; - while (uint32 eventId = _events.ExecuteEvent()) + while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_FROSTBOLT: if (rand32() % 90) DoCastVictim(SPELL_FROSTBOLT); - _events.ScheduleEvent(EVENT_FROSTBOLT, 3500ms); + events.ScheduleEvent(EVENT_FROSTBOLT, 3500ms); break; case EVENT_ICETOMB: if (rand32() % 65) DoCastVictim(SPELL_ICETOMB); - _events.ScheduleEvent(EVENT_ICETOMB, 28s); + events.ScheduleEvent(EVENT_ICETOMB, 28s); break; case EVENT_DRAINLIFE: if (rand32() % 55) DoCastVictim(SPELL_DRAINLIFE); - _events.ScheduleEvent(EVENT_DRAINLIFE, 31s); + events.ScheduleEvent(EVENT_DRAINLIFE, 31s); break; default: break; @@ -109,10 +99,6 @@ public: DoMeleeAttackIfReady(); } - - private: - EventMap _events; - InstanceScript* instance; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp index 16d9631b4b8..f9d76231d61 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_nerubenkan.cpp @@ -23,7 +23,6 @@ SDCategory: Stratholme EndScriptData */ #include "ScriptMgr.h" -#include "InstanceScript.h" #include "ScriptedCreature.h" #include "stratholme.h" @@ -45,12 +44,11 @@ public: return GetStratholmeAI<boss_nerubenkanAI>(creature); } - struct boss_nerubenkanAI : public ScriptedAI + struct boss_nerubenkanAI : public BossAI { - boss_nerubenkanAI(Creature* creature) : ScriptedAI(creature) + boss_nerubenkanAI(Creature* creature) : BossAI(creature, BOSS_NERUB_ENKAN) { Initialize(); - instance = me->GetInstanceScript(); } void Initialize() @@ -61,8 +59,6 @@ public: RaiseUndeadScarab_Timer = 3000; } - InstanceScript* instance; - uint32 EncasingWebs_Timer; uint32 PierceArmor_Timer; uint32 CryptScarabs_Timer; @@ -70,18 +66,10 @@ public: void Reset() override { + _Reset(); Initialize(); } - void JustEngagedWith(Unit* /*who*/) override - { - } - - void JustDied(Unit* /*killer*/) override - { - instance->SetData(TYPE_NERUB, IN_PROGRESS); - } - void RaiseUndeadScarab(Unit* victim) { if (Creature* pUndeadScarab = DoSpawnCreature(10876, float(irand(-9, 9)), float(irand(-9, 9)), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 180s)) diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp index 349af762e8e..8c7ecfca87a 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_postmaster_malown.cpp @@ -59,7 +59,7 @@ class boss_postmaster_malown : public CreatureScript struct boss_postmaster_malownAI : public BossAI { - boss_postmaster_malownAI(Creature* creature) : BossAI(creature, TYPE_MALOWN) { } + boss_postmaster_malownAI(Creature* creature) : BossAI(creature, BOSS_POSTMASTER_MALOWN) { } void Reset() override { } diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp index 0d8cb731f79..7245d066a28 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_ramstein_the_gorger.cpp @@ -23,7 +23,6 @@ SDCategory: Stratholme EndScriptData */ #include "ScriptMgr.h" -#include "InstanceScript.h" #include "ScriptedCreature.h" #include "stratholme.h" #include "TemporarySummon.h" @@ -49,12 +48,11 @@ public: return GetStratholmeAI<boss_ramstein_the_gorgerAI>(creature); } - struct boss_ramstein_the_gorgerAI : public ScriptedAI + struct boss_ramstein_the_gorgerAI : public BossAI { - boss_ramstein_the_gorgerAI(Creature* creature) : ScriptedAI(creature) + boss_ramstein_the_gorgerAI(Creature* creature) : BossAI(creature, BOSS_RAMSTEIN_THE_GORGER) { Initialize(); - instance = me->GetInstanceScript(); } void Initialize() @@ -63,29 +61,25 @@ public: Knockout_Timer = 12000; } - InstanceScript* instance; - uint32 Trample_Timer; uint32 Knockout_Timer; void Reset() override { + BossAI::Reset(); + Initialize(); } - void JustEngagedWith(Unit* /*who*/) override + void JustDied(Unit* killer) override { - } + BossAI::JustDied(killer); - void JustDied(Unit* /*killer*/) override - { for (uint8 i = 0; i < 30; ++i) { if (Creature* mob = me->SummonCreature(NPC_MINDLESS_UNDEAD, 3969.35f+irand(-10, 10), -3391.87f+irand(-10, 10), 119.11f, 5.91f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 30min)) mob->AI()->AttackStart(me->SelectNearestTarget(100.0f)); } - - instance->SetData(TYPE_RAMSTEIN, DONE); } void UpdateAI(uint32 diff) override @@ -111,7 +105,6 @@ public: DoMeleeAttackIfReady(); } }; - }; void AddSC_boss_ramstein_the_gorger() diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp index 79128416922..ca1123c4c13 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_timmy_the_cruel.cpp @@ -46,9 +46,9 @@ public: return GetStratholmeAI<boss_timmy_the_cruelAI>(creature); } - struct boss_timmy_the_cruelAI : public ScriptedAI + struct boss_timmy_the_cruelAI : public BossAI { - boss_timmy_the_cruelAI(Creature* creature) : ScriptedAI(creature) + boss_timmy_the_cruelAI(Creature* creature) : BossAI(creature, BOSS_TIMMY_THE_CRUEL) { Initialize(); } @@ -64,11 +64,15 @@ public: void Reset() override { + BossAI::Reset(); + Initialize(); } - void JustEngagedWith(Unit* /*who*/) override + void JustEngagedWith(Unit* who) override { + BossAI::JustEngagedWith(who); + if (!HasYelled) { Talk(SAY_SPAWN); diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp index 7529ae15ce2..c050d54fef0 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp @@ -49,13 +49,22 @@ enum StratholmeMisc Position const timmyTheCruelSpawnPosition = { 3625.358f, -3188.108f, 130.3985f, 4.834562f }; EllipseBoundary const beforeScarletGate(Position(3671.158f, -3181.79f), 60.0f, 40.0f); -DungeonEncounterData const encounters[] = +static constexpr DungeonEncounterData Encounters[] = { - { 1, {{ 479 }} }, // Baroness Anastari - { 2, {{ 480 }} }, // Nerub'enkan - { 3, {{ 481 }} }, // Maleki the Pallid - { 4, {{ 483 }} }, // Ramstein the Gorger - { 5, {{ 484 }} } // Lord Aurius Rivendare + { BOSS_HEARTHSINGER_FORRESTEN, {{ 473 }} }, // Hearthsinger Forresten + { BOSS_TIMMY_THE_CRUEL, {{ 474 }} }, // Timmy the Cruel + { BOSS_COMMANDER_MALOR, {{ 476 }} }, // Commander Malor + { BOSS_WILLEY_HOPEBREAKER, {{ 475 }} }, // Willey Hopebreaker + { BOSS_INSTRUCTOR_GALFORD, {{ 477 }} }, // Instructor Galford + { BOSS_BALNAZZAR, {{ 478 }} }, // Balnazzar + { BOSS_THE_UNFORGIVEN, {{ 472 }} }, // The Unforgiven + { BOSS_BARONESS_ANASTARI, {{ 479 }} }, // Baroness Anastari + { BOSS_NERUB_ENKAN, {{ 480 }} }, // Nerub'enkan + { BOSS_MALEKI_THE_PALLID, {{ 481 }} }, // Maleki the Pallid + { BOSS_MAGISTRATE_BARTHILAS, {{ 482 }} }, // Magistrate Barthilas + { BOSS_RAMSTEIN_THE_GORGER, {{ 483 }} }, // Ramstein the Gorger + { BOSS_RIVENDARE, {{ 484 }} }, // Lord Aurius Rivendare + { BOSS_POSTMASTER_MALOWN, {{ 1885 }} } // Postmaster Malown }; class instance_stratholme : public InstanceMapScript @@ -69,16 +78,20 @@ class instance_stratholme : public InstanceMapScript { SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); - LoadDungeonEncounterData(encounters); + LoadDungeonEncounterData(Encounters); for (uint8 i = 0; i < 5; ++i) IsSilverHandDead[i] = false; timmySpawned = false; scarletsKilled = 0; + brokenCrystals = 0; + baronRunState = NOT_STARTED; } uint8 scarletsKilled; + int32 brokenCrystals; + EncounterState baronRunState; bool IsSilverHandDead[5]; bool timmySpawned; @@ -126,13 +139,26 @@ class instance_stratholme : public InstanceMapScript } break; } + case NPC_HEARTHSINGER_FORRESTEN: + SetBossState(BOSS_HEARTHSINGER_FORRESTEN, DONE); + break; + case NPC_COMMANDER_MALOR: + SetBossState(BOSS_COMMANDER_MALOR, DONE); + break; + case NPC_INSTRUCTOR_GALFORD: + SetBossState(BOSS_INSTRUCTOR_GALFORD, DONE); + break; + case NPC_THE_UNFORGIVEN: + SetBossState(BOSS_THE_UNFORGIVEN, DONE); + break; + default: + break; } } bool StartSlaugtherSquare() { - //change to DONE when crystals implemented - if (GetBossState(1) == IN_PROGRESS && GetBossState(2) == IN_PROGRESS && GetBossState(3) == IN_PROGRESS) + if (brokenCrystals >= 3) { HandleGameObject(portGauntletGUID, true); HandleGameObject(portSlaugtherGUID, true); @@ -210,37 +236,37 @@ class instance_stratholme : public InstanceMapScript break; case GO_ZIGGURAT1: ziggurat1GUID = go->GetGUID(); - if (GetData(TYPE_BARONESS) == IN_PROGRESS) + if (GetBossState(BOSS_BARONESS_ANASTARI) == DONE) HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_ZIGGURAT2: ziggurat2GUID = go->GetGUID(); - if (GetData(TYPE_NERUB) == IN_PROGRESS) + if (GetBossState(BOSS_NERUB_ENKAN) == DONE) HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_ZIGGURAT3: ziggurat3GUID = go->GetGUID(); - if (GetData(TYPE_PALLID) == IN_PROGRESS) + if (GetBossState(BOSS_MALEKI_THE_PALLID) == DONE) HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_ZIGGURAT4: ziggurat4GUID = go->GetGUID(); - if (GetData(TYPE_BARON) == DONE || GetData(TYPE_RAMSTEIN) == DONE) + if (GetBossState(BOSS_RIVENDARE) == DONE || GetBossState(BOSS_RAMSTEIN_THE_GORGER) == DONE) HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_ZIGGURAT5: ziggurat5GUID = go->GetGUID(); - if (GetData(TYPE_BARON) == DONE || GetData(TYPE_RAMSTEIN) == DONE) + if (GetBossState(BOSS_RIVENDARE) == DONE || GetBossState(BOSS_RAMSTEIN_THE_GORGER) == DONE) HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_PORT_GAUNTLET: portGauntletGUID = go->GetGUID(); - if (GetData(TYPE_BARONESS) == IN_PROGRESS && GetData(TYPE_NERUB) == IN_PROGRESS && GetData(TYPE_PALLID) == IN_PROGRESS) + if (brokenCrystals >= 3) HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_PORT_SLAUGTHER: portSlaugtherGUID = go->GetGUID(); - if (GetData(TYPE_BARONESS) == IN_PROGRESS && GetData(TYPE_NERUB) == IN_PROGRESS && GetData(TYPE_PALLID) == IN_PROGRESS) + if (brokenCrystals >= 3) HandleGameObject(ObjectGuid::Empty, true, go); break; case GO_PORT_ELDERS: @@ -252,91 +278,45 @@ class instance_stratholme : public InstanceMapScript } } - void SetData(uint32 type, uint32 data) override + bool SetBossState(uint32 id, EncounterState state) override { - switch (type) - { - case TYPE_BARON_RUN: - switch (data) - { - case IN_PROGRESS: - if (GetBossState(0) == IN_PROGRESS || GetBossState(0) == FAIL) - break; - SetBossState(0, EncounterState(data)); - events.ScheduleEvent(EVENT_BARON_RUN, 45min); - TC_LOG_DEBUG("scripts", "Instance Stratholme: Baron run in progress."); - break; - case FAIL: - DoRemoveAurasDueToSpellOnPlayers(SPELL_BARON_ULTIMATUM); - if (Creature* ysida = instance->GetCreature(ysidaGUID)) - ysida->CastSpell(ysida, SPELL_PERM_FEIGN_DEATH, true); - SetBossState(0, EncounterState(data)); - break; - case DONE: - SetBossState(0, EncounterState(data)); - - if (Creature* ysida = instance->GetCreature(ysidaGUID)) - { - if (GameObject* cage = instance->GetGameObject(ysidaCageGUID)) - cage->UseDoorOrButton(); + if (!InstanceScript::SetBossState(id, state)) + return false; - float x, y, z; - //! This spell handles the Dead man's plea quest completion - ysida->CastSpell(nullptr, SPELL_YSIDA_SAVED, true); - ysida->SetWalk(true); - ysida->AI()->Talk(SAY_YSIDA_SAVED); - ysida->SetNpcFlag(UNIT_NPC_FLAG_QUESTGIVER); - ysida->GetClosePoint(x, y, z, ysida->GetObjectScale() / 3, 4.0f); - ysida->GetMotionMaster()->MovePoint(1, x, y, z); - - Map::PlayerList const& players = instance->GetPlayers(); - - for (auto const& i : players) - { - if (Player* player = i.GetSource()) - { - if (player->IsGameMaster()) - continue; - - //! im not quite sure what this one is supposed to do - //! this is server-side spell - player->CastSpell(ysida, SPELL_YSIDA_CREDIT_EFFECT, true); - } - } - } - events.CancelEvent(EVENT_BARON_RUN); - break; - } - break; - case TYPE_BARONESS: - SetBossState(1, EncounterState(data)); - if (data == IN_PROGRESS) + switch (id) + { + case BOSS_BARONESS_ANASTARI: + if (state == DONE) { HandleGameObject(ziggurat1GUID, true); - //change to DONE when crystals implemented + + //remove when crystals implemented + ++brokenCrystals; StartSlaugtherSquare(); } break; - case TYPE_NERUB: - SetBossState(2, EncounterState(data)); - if (data == IN_PROGRESS) + case BOSS_NERUB_ENKAN: + if (state == DONE) { HandleGameObject(ziggurat2GUID, true); - //change to DONE when crystals implemented + + //remove when crystals implemented + ++brokenCrystals; StartSlaugtherSquare(); } break; - case TYPE_PALLID: - SetBossState(3, EncounterState(data)); - if (data == IN_PROGRESS) + case BOSS_MALEKI_THE_PALLID: + if (state == DONE) { HandleGameObject(ziggurat3GUID, true); - //change to DONE when crystals implemented + + //remove when crystals implemented + ++brokenCrystals; StartSlaugtherSquare(); } break; - case TYPE_RAMSTEIN: - if (data == IN_PROGRESS) + case BOSS_RAMSTEIN_THE_GORGER: + if (state == IN_PROGRESS) { HandleGameObject(portGauntletGUID, false); @@ -360,28 +340,19 @@ class instance_stratholme : public InstanceMapScript TC_LOG_DEBUG("scripts", "Instance Stratholme: {} Abomnation left to kill.", count); } - if (data == NOT_STARTED) + if (state == NOT_STARTED) HandleGameObject(portGauntletGUID, true); - if (data == DONE) + if (state == DONE) { events.ScheduleEvent(EVENT_SLAUGHTER_SQUARE, 1min); TC_LOG_DEBUG("scripts", "Instance Stratholme: Slaugther event will continue in 1 minute."); } - SetBossState(4, EncounterState(data)); break; - case TYPE_BARON: - if (data == IN_PROGRESS) - { - HandleGameObject(ziggurat4GUID, false); - HandleGameObject(ziggurat5GUID, false); - } - if (data == DONE || data == NOT_STARTED) - { - HandleGameObject(ziggurat4GUID, true); - HandleGameObject(ziggurat5GUID, true); - } - if (data == DONE) + case BOSS_RIVENDARE: + HandleGameObject(ziggurat4GUID, GetBossState(BOSS_RAMSTEIN_THE_GORGER) == DONE && state != IN_PROGRESS); + HandleGameObject(ziggurat5GUID, GetBossState(BOSS_RAMSTEIN_THE_GORGER) == DONE && state != IN_PROGRESS); + if (state == DONE) { HandleGameObject(portGauntletGUID, true); if (GetData(TYPE_BARON_RUN) == IN_PROGRESS) @@ -389,7 +360,69 @@ class instance_stratholme : public InstanceMapScript SetData(TYPE_BARON_RUN, DONE); } - SetBossState(5, EncounterState(data)); + break; + default: + break; + } + + return true; + } + + void SetData(uint32 type, uint32 data) override + { + switch (type) + { + case TYPE_BARON_RUN: + switch (data) + { + case IN_PROGRESS: + if (baronRunState == IN_PROGRESS || baronRunState == FAIL) + break; + baronRunState = IN_PROGRESS; + events.ScheduleEvent(EVENT_BARON_RUN, 45min); + TC_LOG_DEBUG("scripts", "Instance Stratholme: Baron run in progress."); + break; + case FAIL: + DoRemoveAurasDueToSpellOnPlayers(SPELL_BARON_ULTIMATUM); + if (Creature* ysida = instance->GetCreature(ysidaGUID)) + ysida->CastSpell(ysida, SPELL_PERM_FEIGN_DEATH, true); + baronRunState = FAIL; + break; + case DONE: + baronRunState = DONE; + + if (Creature* ysida = instance->GetCreature(ysidaGUID)) + { + if (GameObject* cage = instance->GetGameObject(ysidaCageGUID)) + cage->UseDoorOrButton(); + + float x, y, z; + //! This spell handles the Dead man's plea quest completion + ysida->CastSpell(nullptr, SPELL_YSIDA_SAVED, true); + ysida->SetWalk(true); + ysida->AI()->Talk(SAY_YSIDA_SAVED); + ysida->SetNpcFlag(UNIT_NPC_FLAG_QUESTGIVER); + ysida->GetClosePoint(x, y, z, ysida->GetObjectScale() / 3, 4.0f); + ysida->GetMotionMaster()->MovePoint(1, x, y, z); + + Map::PlayerList const& players = instance->GetPlayers(); + + for (auto const& i : players) + { + if (Player* player = i.GetSource()) + { + if (player->IsGameMaster()) + continue; + + //! im not quite sure what this one is supposed to do + //! this is server-side spell + player->CastSpell(ysida, SPELL_YSIDA_CREDIT_EFFECT, true); + } + } + } + events.CancelEvent(EVENT_BARON_RUN); + break; + } break; case TYPE_SH_AELMAR: IsSilverHandDead[0] = (data) ? true : false; @@ -406,6 +439,8 @@ class instance_stratholme : public InstanceMapScript case TYPE_SH_VICAR: IsSilverHandDead[4] = (data) ? true : false; break; + default: + break; } } @@ -418,17 +453,19 @@ class instance_stratholme : public InstanceMapScript return 1; return 0; case TYPE_BARON_RUN: - return GetBossState(0); + return baronRunState; case TYPE_BARONESS: - return GetBossState(1); + return GetBossState(BOSS_BARONESS_ANASTARI); case TYPE_NERUB: - return GetBossState(2); + return GetBossState(BOSS_NERUB_ENKAN); case TYPE_PALLID: - return GetBossState(3); + return GetBossState(BOSS_MALEKI_THE_PALLID); case TYPE_RAMSTEIN: - return GetBossState(4); + return GetBossState(BOSS_RAMSTEIN_THE_GORGER); case TYPE_BARON: - return GetBossState(5); + return GetBossState(BOSS_RIVENDARE); + default: + break; } return 0; } @@ -443,6 +480,8 @@ class instance_stratholme : public InstanceMapScript return ysidaTriggerGUID; case NPC_YSIDA: return ysidaGUID; + default: + break; } return ObjectGuid::Empty; } @@ -476,6 +515,18 @@ class instance_stratholme : public InstanceMapScript } } } + + void AfterDataLoad() override + { + if (GetBossState(BOSS_BARONESS_ANASTARI) == DONE) + ++brokenCrystals; + if (GetBossState(BOSS_NERUB_ENKAN) == DONE) + ++brokenCrystals; + if (GetBossState(BOSS_MALEKI_THE_PALLID) == DONE) + ++brokenCrystals; + + baronRunState = FAIL; + } }; InstanceScript* GetInstanceScript(InstanceMap* map) const override diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h index 93a07f13830..f7c8705d7ff 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h @@ -23,6 +23,26 @@ #define StratholmeScriptName "instance_stratholme" #define DataHeader "STR" +enum STRBossIds +{ + BOSS_HEARTHSINGER_FORRESTEN = 0, + BOSS_TIMMY_THE_CRUEL = 1, + BOSS_COMMANDER_MALOR = 2, + BOSS_WILLEY_HOPEBREAKER = 3, + BOSS_INSTRUCTOR_GALFORD = 4, + BOSS_BALNAZZAR = 5, + BOSS_THE_UNFORGIVEN = 6, + BOSS_BARONESS_ANASTARI = 7, + BOSS_NERUB_ENKAN = 8, + BOSS_MALEKI_THE_PALLID = 9, + BOSS_MAGISTRATE_BARTHILAS = 10, + BOSS_RAMSTEIN_THE_GORGER = 11, + BOSS_RIVENDARE = 12, + BOSS_POSTMASTER_MALOWN = 13, + + MAX_ENCOUNTER +}; + enum STRDataTypes { TYPE_BARON_RUN = 1, @@ -32,8 +52,6 @@ enum STRDataTypes TYPE_RAMSTEIN = 5, TYPE_BARON = 6, - TYPE_MALOWN = 7, - DATA_BARON = 10, DATA_YSIDA_TRIGGER = 11, @@ -47,6 +65,11 @@ enum STRDataTypes enum STRCreatureIds { + NPC_HEARTHSINGER_FORRESTEN = 10558, + NPC_COMMANDER_MALOR = 11032, + NPC_INSTRUCTOR_GALFORD = 10811, + NPC_THE_UNFORGIVEN = 10516, + NPC_CRYSTAL = 10415, // ziggurat crystal NPC_BARON = 10440, // ziggurat crystal NPC_YSIDA_TRIGGER = 16100, // ziggurat crystal @@ -99,7 +122,6 @@ enum STRMisc { //! amount of crusade monsters required to be killed in order for timmy the cruel to spawn TIMMY_THE_CRUEL_CRUSADERS_REQUIRED = 15, - MAX_ENCOUNTER = 6 }; template <class AI, class T> |