From f765809aed0387fcc9ab8ba66b77ba1c66175d0f Mon Sep 17 00:00:00 2001 From: Kinglykrab Date: Wed, 25 Jun 2025 23:25:04 -0400 Subject: [PATCH] Push --- zone/quest_parser_collection.cpp | 97 +++++++++++++++++--------------- 1 file changed, 51 insertions(+), 46 deletions(-) diff --git a/zone/quest_parser_collection.cpp b/zone/quest_parser_collection.cpp index 0c668a037..9535cb89a 100644 --- a/zone/quest_parser_collection.cpp +++ b/zone/quest_parser_collection.cpp @@ -1556,44 +1556,46 @@ QuestInterface* QuestParserCollection::GetQIByZoneQuest(std::string& filename) return nullptr; } - const std::string& global_path = fmt::format( - "{}/{}", - path.GetQuestsPath(), - QUEST_GLOBAL_DIRECTORY - ); - - const std::string& zone_path = fmt::format( - "{}/{}", - path.GetQuestsPath(), - zone->GetShortName() - ); - - const std::string& zone_versioned_path = fmt::format( - "{}/{}/v{}", - path.GetQuestsPath(), - zone->GetShortName(), - zone->GetInstanceVersion() - ); - - std::vector file_names = { - fmt::format("{}/zone", zone_versioned_path), // Local versioned by Instance Version ./quests/zone/v0/zone.ext - fmt::format("{}/zone_v{}", zone_path, zone->GetInstanceVersion()), // Local by Instance Version - fmt::format("{}/zone", zone_path), // Local - fmt::format("{}/zone", global_path) // Global - }; - std::string file_name; - for (auto & file : file_names) { - for (auto* e: _load_precedence) { - file_name = fmt::format( - "{}.{}", - file, - _extensions.find(e->GetIdentifier())->second - ); + for (auto& dir: PathManager::Instance()->GetQuestPaths()) { + const std::string& global_path = fmt::format( + "{}/{}", + dir, + QUEST_GLOBAL_DIRECTORY + ); - if (File::Exists(file_name)) { - filename = file_name; - return e; + const std::string& zone_path = fmt::format( + "{}/{}", + dir, + zone->GetShortName() + ); + + const std::string& zone_versioned_path = fmt::format( + "{}/{}/v{}", + dir, + zone->GetShortName(), + zone->GetInstanceVersion() + ); + + std::vector file_names = { + fmt::format("{}/zone", zone_versioned_path), // Local versioned by Instance Version ./quests/zone/v0/zone.ext + fmt::format("{}/zone_v{}", zone_path, zone->GetInstanceVersion()), // Local by Instance Version + fmt::format("{}/zone", zone_path), // Local + fmt::format("{}/zone", global_path) // Global + }; + + for (auto& file: file_names) { + for (auto* e: _load_precedence) { + file_name = fmt::format( + "{}.{}", + file, + _extensions.find(e->GetIdentifier())->second + ); + + if (File::Exists(file_name)) { + filename = file_name; + return e; + } } } } @@ -1608,17 +1610,20 @@ QuestInterface* QuestParserCollection::GetQIByGlobalZoneQuest(std::string& filen } std::string file_name; - for (auto* e: _load_precedence) { - file_name = fmt::format( - "{}/{}/global_zone.{}", - path.GetQuestsPath(), - QUEST_GLOBAL_DIRECTORY, - _extensions.find(e->GetIdentifier())->second - ); - if (File::Exists(file_name)) { - filename = file_name; - return e; + for (auto& dir: PathManager::Instance()->GetQuestPaths()) { + for (auto* e: _load_precedence) { + file_name = fmt::format( + "{}/{}/global_zone.{}", + dir, + QUEST_GLOBAL_DIRECTORY, + _extensions.find(e->GetIdentifier())->second + ); + + if (File::Exists(file_name)) { + filename = file_name; + return e; + } } }