mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-20 05:16:24 -04:00
location name overrides for item service
This commit is contained in:
@@ -255,7 +255,7 @@ std::optional<std::string> RandomizerContext::LoadFromHash(const std::string& ha
|
||||
|
||||
// Items we call by location name
|
||||
for (const auto& locationNode : in["mItemLocations"]) {
|
||||
const auto& locationName = locationNode.first.as<std::string>();
|
||||
const auto& locationName = nameLookupOverride(locationNode.first.as<std::string>());
|
||||
retrieveItemData(this->mItemLocations[locationName], locationNode.second);
|
||||
}
|
||||
|
||||
@@ -857,7 +857,7 @@ std::vector<u8> HexToBytes(std::string hex) {
|
||||
}
|
||||
|
||||
int randomizer_getItemAtLocation(const std::string& locationName) {
|
||||
return randomizer_GetContext().mItemLocations[locationName].itemId;
|
||||
return randomizer_GetContext().mItemLocations[nameLookupOverride(locationName)].itemId;
|
||||
}
|
||||
|
||||
void randomizer_checkAndOverrideEntranceData(const char*& stageName, s8& roomNo, s16& pointNo, s8& mapLayer) {
|
||||
@@ -893,7 +893,7 @@ void randomizer_setTempFlag(RandomizerContext::itemLocationData data) {
|
||||
}
|
||||
|
||||
void randomizer_setTempFlagForLocation(const std::string& locationName) {
|
||||
randomizer_setTempFlag(randomizer_GetContext().mItemLocations[locationName]);
|
||||
randomizer_setTempFlag(randomizer_GetContext().mItemLocations[nameLookupOverride(locationName)]);
|
||||
}
|
||||
|
||||
void randomizer_setTempFlagForFLWOverride(u32 key) {
|
||||
@@ -1357,7 +1357,7 @@ RandomizerContext WriteSeedData(randomizer::logic::world::World* world) {
|
||||
// Items that we lookup just by calling their location name
|
||||
if (location->HasCategories("Name Lookup")) {
|
||||
for (const auto& locationNameNode : metaData["Name Lookup"]) {
|
||||
const auto& locationName = locationNameNode.as<std::string>();
|
||||
const auto& locationName = nameLookupOverride(locationNameNode.as<std::string>());
|
||||
const int itemId = location->GetCurrentItem()->GetID();
|
||||
randoData.mItemLocations[locationName].itemId = itemId;
|
||||
getNodeFlags(randoData.mItemLocations[locationName], metaData);
|
||||
|
||||
@@ -112,7 +112,7 @@ void observe_give(ModContext*, const ItemGiveInfo* info, void*) {
|
||||
randomizer_setTempFlagForLocation(info->check_name);
|
||||
}
|
||||
|
||||
if (std::strcmp(info->check_name, "Arbiters Grounds Dungeon Reward") == 0) {
|
||||
if (std::strcmp(info->check_name, "dungeon_reward:D_MN10") == 0) {
|
||||
dComIfGs_onItem(0x9E, -1);
|
||||
} else if (auto key = parse_derived(info->check_name, "freestanding:");
|
||||
key && key->stage_id == Ook)
|
||||
|
||||
@@ -501,6 +501,55 @@ randomizer::logic::item_pool::ItemPool getSaveItemPool(randomizer::logic::world:
|
||||
return pool;
|
||||
}
|
||||
|
||||
// overriding location names from generator to match item service api format
|
||||
std::string nameLookupOverride(const std::string& locationName) {
|
||||
// [generator name], [service name]
|
||||
static std::unordered_map<std::string, std::string> nameLookup = {
|
||||
{"Arbiters Grounds Dungeon Reward", "dungeon_reward:D_MN10"},
|
||||
{"Ashei Sketch", "ashei_sketch"},
|
||||
{"Auru Gift To Fyer", "auru_memo"},
|
||||
{"Cave of Ordeals Great Fairy Reward", "fairy_reward:D_SB01"},
|
||||
{"Charlo Donation Blessing", "prayer_reward"},
|
||||
{"Coro Bottle", "coro_bottle"},
|
||||
{"Gift From Ralis", "coral_earring"},
|
||||
{"Goron Mines Gor Amato Key Shard", "key_shard_1:D_MN04"},
|
||||
{"Goron Mines Gor Ebizo Key Shard", "key_shard_2:D_MN04"},
|
||||
{"Goron Mines Gor Liggs Key Shard", "key_shard_3:D_MN04"},
|
||||
{"Herding Goats Reward", "goats_reward"},
|
||||
{"Hyrule Castle King Bulblin Key", "bulblin_key:D_MN09"},
|
||||
{"Ilia Charm", "ilia_charm"},
|
||||
{"Iza Helping Hand", "iza_reward_1"},
|
||||
{"Iza Raging Rapids Minigame", "iza_reward_2"},
|
||||
{"Jovani 20 Poe Soul Reward", "jovani_reward_1"},
|
||||
{"Jovani 60 Poe Soul Reward", "jovani_reward_2"},
|
||||
{"Ordon Cat Rescue", "sera_reward"},
|
||||
{"Ordon Shield", "ordon_shield"},
|
||||
{"Ordon Sword", "ordon_sword"},
|
||||
{"Plumm Fruit Balloon Minigame", "plumm_minigame_reward"},
|
||||
{"Renados Letter", "renado_letter"},
|
||||
{"Rutelas Blessing", "zora_armor"},
|
||||
{"Skybook From Impaz", "skybook"},
|
||||
{"Snowboard Racing Prize", "snowboard_race_reward"},
|
||||
{"Snowpeak Ruins Ball and Chain", "ball_and_chain:D_MN11"},
|
||||
{"Snowpeak Ruins Mansion Map", "dungeon_map:D_MN11"},
|
||||
{"STAR Prize 1", "star_reward_1"},
|
||||
{"STAR Prize 2", "star_reward_2"},
|
||||
{"Talo Sharpshooting", "archery_reward:F_SP109"},
|
||||
{"Telma Invoice", "telma_invoice"},
|
||||
{"Uli Cradle Delivery", "uli_cradle_reward"},
|
||||
{"Wooden Statue", "wood_statue"},
|
||||
{"Zoras Domain Underwater Goron", "goron_reward:F_SP113"},
|
||||
};
|
||||
|
||||
for (auto& [oldName, newName] : nameLookup) {
|
||||
if (locationName == oldName) {
|
||||
return newName;
|
||||
}
|
||||
}
|
||||
|
||||
return locationName;
|
||||
}
|
||||
|
||||
bool isLocationObtained(randomizer::logic::location::Location* location) {
|
||||
auto& locationMeta = location->GetMetadata();
|
||||
if (auto& chestNode = locationMeta["Chest"]) {
|
||||
@@ -604,7 +653,7 @@ int getLocationItem(randomizer::logic::location::Location* location) {
|
||||
return context.mFlowItemMessageOverrides[key].itemId;
|
||||
}
|
||||
if (auto& nameNode = locationMeta["Name Lookup"]) {
|
||||
auto name = nameNode[0].as<std::string>();
|
||||
auto name = nameLookupOverride(nameNode[0].as<std::string>());
|
||||
return context.mItemLocations[name].itemId;
|
||||
}
|
||||
return -1;
|
||||
|
||||
@@ -29,6 +29,8 @@ int numFusedShadows();
|
||||
int numMirrorShards();
|
||||
int getTempleKeysFound(int saveId);
|
||||
|
||||
std::string nameLookupOverride(const std::string& locationName);
|
||||
|
||||
/*
|
||||
* Reads the current player inventory and returns an ItemPool that can be used for logic searches
|
||||
*
|
||||
|
||||
@@ -4086,7 +4086,7 @@ void daB_DS_c::executeBattle2Dead() {
|
||||
dComIfGs_onStageBossEnemy(0x13);
|
||||
#if TARGET_PC
|
||||
// This reward has no original grant at this point in the cutscene.
|
||||
dusk::mods::item_check_enqueue("Arbiters Grounds Dungeon Reward", dItemNo_NONE_e);
|
||||
dusk::mods::item_check_enqueue("dungeon_reward:D_MN10", dItemNo_NONE_e);
|
||||
#endif
|
||||
/* dSv_event_flag_c::F_0265 - Arbiter's Grounds - Arbiter's Grounds clear */
|
||||
dComIfGs_onEventBit(0x2010);
|
||||
|
||||
Reference in New Issue
Block a user