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,16 +1419,15 @@ std::array<DungeonInfo*, 12> Dungeons::GetDungeonList() {
size_t Dungeons::GetDungeonListSize() const {
return dungeonList.size();
}
void Dungeons::ParseJson(nlohmann::json spoilerFileJson) {
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) {
if (dungeon.GetName() == dungeonName) {
dungeon.SetMQ();
} else {
dungeon.ClearMQ();
}
for (auto& dungeon : dungeonList) {
dungeon.ClearMQ();
if (std::find(mqDungeonsJson.begin(), mqDungeonsJson.end(), dungeon.GetName()) != mqDungeonsJson.end()) {
dungeon.SetMQ();
}
}
}

View File

@ -71,13 +71,13 @@ size_t Trials::GetTrialListSize() const {
void Trials::ParseJson(nlohmann::json spoilerFileJson) {
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) {
if (trial.GetName() == trialName) {
for (auto& trial : mTrials) {
trial.SetAsSkipped();
for (auto nameInLang : trial.GetName().GetAllMessages()) {
if (std::find(trialsJson.begin(), trialsJson.end(), nameInLang) != trialsJson.end()) {
trial.SetAsRequired();
} else {
trial.SetAsSkipped();
}
}
}