From f5b99896018e2467ac18f9dc01a0c6d95f71b59b Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sun, 13 Jun 2021 23:38:43 +0200 Subject: [PATCH] Scripts/BRC: converted Ascendant Lord Obsidius' achievement to world state handling --- .../world/4.3.4/2021_06_13_06_world.sql | 6 +++ .../BlackrockCaverns/blackrock_caverns.h | 5 ++ .../boss_ascendant_lord_obsidius.cpp | 46 ++----------------- 3 files changed, 16 insertions(+), 41 deletions(-) create mode 100644 sql/updates/world/4.3.4/2021_06_13_06_world.sql diff --git a/sql/updates/world/4.3.4/2021_06_13_06_world.sql b/sql/updates/world/4.3.4/2021_06_13_06_world.sql new file mode 100644 index 00000000000..92007517784 --- /dev/null +++ b/sql/updates/world/4.3.4/2021_06_13_06_world.sql @@ -0,0 +1,6 @@ +DELETE FROM `achievement_criteria_data` WHERE `ScriptName`= 'achievement_ascendant_descending'; + +DELETE FROM `world_states` WHERE `ID`= 5637; +INSERT INTO `world_states` (`ID`, `DefaultValue`, `MapID`, `Comment`) VALUES +(5637, 0, 645, 'Blackrock Caverns - Ascendant Lord Obsidius - Ascendant Descending'); + diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.h b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.h index 9401326ccd3..8077a5e7d89 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.h +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/blackrock_caverns.h @@ -90,6 +90,11 @@ enum BRCRazAreaIndex RAZ_AREA_INDEX_OBSIDIUS = 2 }; +enum BRCWorldStates +{ + WORLD_STATE_ID_ASCENDANT_DESCENDING = 5637 +}; + Position const RazTheCrazedSummonPositions[] = { { 249.2639f, 949.1614f, 191.7866f, 3.141593f }, diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_ascendant_lord_obsidius.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_ascendant_lord_obsidius.cpp index 18c48f54d1e..c00d22d499c 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_ascendant_lord_obsidius.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockCaverns/boss_ascendant_lord_obsidius.cpp @@ -65,8 +65,7 @@ enum Events enum Data { - DATA_DEAD_ELEMENTAL_WARDEN = 0, - DATA_ASCENDANT_DESCENDING + DATA_DEAD_ELEMENTAL_WARDEN = 0 }; Position const ShadowOfObsidiusPositions[] = @@ -85,7 +84,6 @@ struct boss_ascendant_lord_obsidius : public BossAI _Reset(); _transformationCount = 0; _deadElementalWardenCount = 0; - _achievementEnligible = true; if (instance->GetData(DATA_RAZ_LAST_AREA_INDEX) == RAZ_AREA_INDEX_OBSIDIUS) { @@ -110,6 +108,7 @@ struct boss_ascendant_lord_obsidius : public BossAI { BossAI::JustEngagedWith(who); instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me); + instance->instance->SetWorldState(WORLD_STATE_ID_ASCENDANT_DESCENDING, 0); Talk(SAY_AGGRO); events.ScheduleEvent(EVENT_STONE_BLOW, 8s); events.ScheduleEvent(EVENT_TWILIGHT_CORRUPTION, 12s); @@ -182,22 +181,11 @@ struct boss_ascendant_lord_obsidius : public BossAI DoCastAOE(SPELL_STOP_HEART); } break; - case DATA_ASCENDANT_DESCENDING: - _achievementEnligible = false; - break; default: break; } } - uint32 GetData(uint32 data) const override - { - if (data == DATA_ASCENDANT_DESCENDING) - return _achievementEnligible; - - return 0; - } - void UpdateAI(uint32 diff) override { if (!UpdateVictim()) @@ -235,7 +223,6 @@ struct boss_ascendant_lord_obsidius : public BossAI private: uint8 _transformationCount; uint8 _deadElementalWardenCount; - bool _achievementEnligible; }; class spell_obsidius_twitchy : public AuraScript @@ -331,14 +318,9 @@ class spell_obsidius_crepuscular_veil : public SpellScript return; if (aura->GetStackAmount() == GetSpellInfo()->StackAmount) - { - InstanceScript* instance = target->GetInstanceScript(); - if (!instance) - return; - - if (Creature* obsidius = instance->GetCreature(DATA_ASCENDANT_LORD_OBSIDIUS)) - obsidius->AI()->SetData(DATA_ASCENDANT_DESCENDING, FAIL); - } + if (InstanceScript* instance = target->GetInstanceScript()) + if (!instance->instance->GetWorldStateValue(WORLD_STATE_ID_ASCENDANT_DESCENDING)) + instance->instance->SetWorldState(WORLD_STATE_ID_ASCENDANT_DESCENDING, 1); } void Register() override @@ -366,23 +348,6 @@ class spell_obsidius_shadow_of_obsidius : public AuraScript } }; -class achievement_ascendant_descending : public AchievementCriteriaScript -{ - public: - achievement_ascendant_descending() : AchievementCriteriaScript("achievement_ascendant_descending") { } - - bool OnCheck(Player* /*source*/, Unit* target) override - { - if (!target) - return false; - - if (target->IsAIEnabled) - return target->GetAI()->GetData(DATA_ASCENDANT_DESCENDING); - - return false; - } -}; - void AddSC_boss_ascendant_lord_obsidius() { RegisterBlackrockCavernsCreatureAI(boss_ascendant_lord_obsidius); @@ -392,5 +357,4 @@ void AddSC_boss_ascendant_lord_obsidius() RegisterSpellScript(spell_obsidius_transformation_scale); RegisterSpellScript(spell_obsidius_crepuscular_veil); RegisterSpellScript(spell_obsidius_shadow_of_obsidius); - new achievement_ascendant_descending(); }