clean up/fix mq dungeon and required trial parsing logic (#4979)

This commit is contained in:
briaguya 2025-02-01 19:11:56 -08:00 committed by GitHub
parent b62808dc2d
commit f4604673e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 16 deletions

View File

@ -1419,17 +1419,16 @@ std::array<DungeonInfo*, 12> Dungeons::GetDungeonList() {
size_t Dungeons::GetDungeonListSize() const { size_t Dungeons::GetDungeonListSize() const {
return dungeonList.size(); return dungeonList.size();
} }
void Dungeons::ParseJson(nlohmann::json spoilerFileJson) { void Dungeons::ParseJson(nlohmann::json spoilerFileJson) {
nlohmann::json mqDungeonsJson = spoilerFileJson["masterQuestDungeons"]; nlohmann::json mqDungeonsJson = spoilerFileJson["masterQuestDungeons"];
for (auto it = mqDungeonsJson.begin(); it != mqDungeonsJson.end(); ++it) {
std::string dungeonName = it.value().get<std::string>(); for (auto& dungeon : dungeonList) {
for (auto& dungeon : dungeonList) { dungeon.ClearMQ();
if (dungeon.GetName() == dungeonName) {
dungeon.SetMQ(); if (std::find(mqDungeonsJson.begin(), mqDungeonsJson.end(), dungeon.GetName()) != mqDungeonsJson.end()) {
} else { dungeon.SetMQ();
dungeon.ClearMQ();
}
} }
} }
} }
} // namespace Rando } // namespace Rando

View File

@ -71,13 +71,13 @@ size_t Trials::GetTrialListSize() const {
void Trials::ParseJson(nlohmann::json spoilerFileJson) { void Trials::ParseJson(nlohmann::json spoilerFileJson) {
nlohmann::json trialsJson = spoilerFileJson["requiredTrials"]; nlohmann::json trialsJson = spoilerFileJson["requiredTrials"];
for (auto it = trialsJson.begin(); it != trialsJson.end(); ++it) {
std::string trialName = it.value().get<std::string>(); for (auto& trial : mTrials) {
for (auto& trial : mTrials) { trial.SetAsSkipped();
if (trial.GetName() == trialName) {
for (auto nameInLang : trial.GetName().GetAllMessages()) {
if (std::find(trialsJson.begin(), trialsJson.end(), nameInLang) != trialsJson.end()) {
trial.SetAsRequired(); trial.SetAsRequired();
} else {
trial.SetAsSkipped();
} }
} }
} }
@ -91,4 +91,4 @@ std::unordered_map<uint32_t, RandomizerHintTextKey> Trials::GetAllTrialHintHeys(
return output; return output;
} }
} // namespace Rando } // namespace Rando