From b50197652e8083b37f8d3667abc51c673cb47ff8 Mon Sep 17 00:00:00 2001 From: Skjalf <47818697+Nyeriah@users.noreply.github.com> Date: Mon, 26 Aug 2024 19:49:28 -0300 Subject: [PATCH] feat: Implement option to stop requiring attunements prematurely --- conf/progression_system.conf.dist | 8 ++++++++ src/ProgressionSystem.cpp | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/conf/progression_system.conf.dist b/conf/progression_system.conf.dist index 6bbec566..0993756b 100644 --- a/conf/progression_system.conf.dist +++ b/conf/progression_system.conf.dist @@ -159,3 +159,11 @@ ProgressionSystem.70.SerpentshrineCavern.RequireAllBosses = 1 # ProgressionSystem.70.TheEye.RequireAllBosses = 1 + +# ProgressionSystem.DisabledAttunements +# Description: Clears the selected attunements (dungeon_access_requirement) from database, even if SQL reapply mode is on. +# Use this to end an attunement requirement prematurely, or debug. +# Use `dungeon_access_id` separated by a comma, e.g "32, 64" to disable the attunements for Hyjal & Black Temple, respectively. +# + +ProgressionSystem.DisabledAttunements = "" diff --git a/src/ProgressionSystem.cpp b/src/ProgressionSystem.cpp index af53d3c1..39d0ed17 100644 --- a/src/ProgressionSystem.cpp +++ b/src/ProgressionSystem.cpp @@ -4,6 +4,8 @@ #include "ProgressionSystem.h" #include "DBUpdater.h" +#include "Tokenize.h" +#include "StringConvert.h" inline std::vector GetDatabaseDirectories(std::string const& folderName) { @@ -74,6 +76,15 @@ class ProgressionSystemLoadingDBUpdates : public DatabaseScript DBUpdater::Update(WorldDatabase, &worldDatabaseDirectories); } } + + // Remove disabled attunements + std::string disabledAttunements = sConfigMgr->GetOption("ProgressionSystem.DisabledAttunements", ""); + std::vector attunementIds; + for (auto& itr : Acore::Tokenize(disabledAttunements, ',', false)) + attunementIds.push_back(Acore::StringTo(itr).value()); + + for (auto const& id : attunementIds) + WorldDatabase.Query("DELETE FROM dungeon_access_requirements WHERE dungeon_access_id = {}", id); } };