implement golden wolf checks

This commit is contained in:
gymnast86
2026-04-27 04:05:36 -07:00
parent 8acdbf03bf
commit 3149f929c1
12 changed files with 600 additions and 374 deletions
@@ -67,6 +67,9 @@ std::optional<std::string> RandomizerContext::WriteToFile() {
const std::unordered_map<u16, u16> u16SkyCharacterOverrides(this->mSkyCharacterOverrides.begin(), this->mSkyCharacterOverrides.end());
out["mSkyCharacterOverrides"] = u16SkyCharacterOverrides;
const std::unordered_map<u16, u16> u16GoldenWolfOverrides(this->mGoldenWolfOverrides.begin(), this->mGoldenWolfOverrides.end());
out["mGoldenWolfOverrides"] = u16GoldenWolfOverrides;
out["mItemLocations"] = this->mItemLocations;
out["mStartHour"] = static_cast<u16>(this->mStartHour);
@@ -172,6 +175,13 @@ std::optional<std::string> RandomizerContext::LoadFromHash(const std::string& ha
this->mSkyCharacterOverrides[key] = itemId;
}
// Golden Wolves
for (const auto& goldenWolfNode : in["mGoldenWolfOverrides"]) {
u16 key = goldenWolfNode.first.as<u16>();
u8 itemId = goldenWolfNode.second.as<u8>();
this->mGoldenWolfOverrides[key] = itemId;
}
// Items we call by location name
for (const auto& locationNode : in["mItemLocations"]) {
const auto& locationName = locationNode.first.as<std::string>();
@@ -624,6 +634,14 @@ void GenerateAndWriteSeed(std::string& generationStatusMsg) {
randoData.mSkyCharacterOverrides[key] = itemId;
}
// Golden Wolves
// Keyed by u16 of the event flag for obtaining the golden wolf item
if (location->HasCategories("Golden Wolf")) {
u16 flag = metaData[0]["Flag"].as<u16>();
u8 itemId = location->GetCurrentItem()->GetID();
randoData.mGoldenWolfOverrides[flag] = itemId;
}
// Items that we lookup just by calling their location name
if (location->HasCategories("Location Name Lookup")) {
const auto& locationName = metaData.as<std::string>();
@@ -833,4 +851,4 @@ void GenerateAndWriteSeed(std::string& generationStatusMsg) {
}
generationStatusMsg = fmt::format("Seed generated! Hash: {}", randoData.mHash);
}
}