From 95fe6b492b6a6037e92783d5dbf0cc8f6cf7f05a Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Fri, 24 Feb 2023 03:21:35 -0500 Subject: [PATCH] fix: use trick names for scrub and house of skulltula hints (#2528) * update writealllocations to always write trickname and start seeing where things break * handle simple vs complex items * always grab a trick name --------- Co-authored-by: briaguya --- .../randomizer/3drando/spoiler_log.cpp | 69 +++++++++---------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp index baf6165f5..eeaf94722 100644 --- a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp @@ -726,43 +726,40 @@ static void WriteAllLocations(int language) { break; } - // Eventually check for other things here like fake name - if (location->HasScrubsanityPrice() || location->HasShopsanityPrice()) { - jsonData["locations"][location->GetName()]["item"] = placedItemName; - if (location->GetPlacedItemKey() == ICE_TRAP && location->IsCategory(Category::cShop)) { - switch (language) { - case 0: - default: - jsonData["locations"][location->GetName()]["model"] = - ItemFromGIID(iceTrapModels[location->GetRandomizerCheck()]).GetName().english; - jsonData["locations"][location->GetName()]["trickName"] = - NonShopItems[TransformShopIndex(GetShopIndex(key))].Name.english; - break; - case 2: - jsonData["locations"][location->GetName()]["model"] = - ItemFromGIID(iceTrapModels[location->GetRandomizerCheck()]).GetName().french; - jsonData["locations"][location->GetName()]["trickName"] = - NonShopItems[TransformShopIndex(GetShopIndex(key))].Name.french; - break; - } - } - jsonData["locations"][location->GetName()]["price"] = location->GetPrice(); - } else if (location->GetPlacedItemKey() == ICE_TRAP && iceTrapModels.contains(location->GetRandomizerCheck())) { - jsonData["locations"][location->GetName()]["item"] = placedItemName; - switch (language) { - case 0: - default: - jsonData["locations"][location->GetName()]["model"] = - ItemFromGIID(iceTrapModels[location->GetRandomizerCheck()]).GetName().english; - break; - case 2: - jsonData["locations"][location->GetName()]["model"] = - ItemFromGIID(iceTrapModels[location->GetRandomizerCheck()]).GetName().french; - break; - } - } else { - jsonData["locations"][location->GetName()] = placedItemName; + // If it's a simple item (not an ice trap, doesn't have a price) + // just add the name of the item and move on + if (!location->HasScrubsanityPrice() && + !location->HasShopsanityPrice() && + location->GetPlacedItemKey() != ICE_TRAP) { + + jsonData["locations"][location->GetName()] = placedItemName; + continue; } + + // We're dealing with a complex item, build out the json object for it + jsonData["locations"][location->GetName()]["item"] = placedItemName; + + if (location->HasScrubsanityPrice() || location->HasShopsanityPrice()) { + jsonData["locations"][location->GetName()]["price"] = location->GetPrice(); + } + + if (location->GetPlacedItemKey() == ICE_TRAP) { + switch (language) { + case 0: + default: + jsonData["locations"][location->GetName()]["model"] = + ItemFromGIID(iceTrapModels[location->GetRandomizerCheck()]).GetName().english; + jsonData["locations"][location->GetName()]["trickName"] = + GetIceTrapName(iceTrapModels[location->GetRandomizerCheck()]).english; + break; + case 2: + jsonData["locations"][location->GetName()]["model"] = + ItemFromGIID(iceTrapModels[location->GetRandomizerCheck()]).GetName().french; + jsonData["locations"][location->GetName()]["trickName"] = + GetIceTrapName(iceTrapModels[location->GetRandomizerCheck()]).french; + break; + } + } } }