From 41efe05be4546e3399ccfe18ebaa4a0c88da0d0a Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 16 Aug 2022 13:59:10 -0700 Subject: [PATCH] Manually disambiguate Butterfly Dress from ~owls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There are two Neopets NC items named Butterfly Dress! ~owls disambiguates them by calling one of them "Butterfly Dress (from Faerie Festival event)". It'd be a bit more robust to cooperate with ~owls t o get item IDs served up in this case, but it's not a big deal esp. for only this one case, so like… this is fine! --- pages/api/allNCTradeValues.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pages/api/allNCTradeValues.js b/pages/api/allNCTradeValues.js index 3112776..e5ab75c 100644 --- a/pages/api/allNCTradeValues.js +++ b/pages/api/allNCTradeValues.js @@ -92,13 +92,23 @@ async function loadOWLSValuesByIdOrName() { // if it does! (I'm keeping the rest of the code the same because I // think that might happen for disambiguation, like Waka did.) Until // then, we just always key by name. - const normalizedItemName = normalizeItemName(itemName); + // HACK: With the exception of the Butterfly Dress, which has a special + // name in the OWLS database! We hardcodily disambiguate it here. But + // if they start serving item IDs, that would resolve it too! + let nameOrId; + if (itemName === "Butterfly Dress") { + nameOrId = 44775; + } else if (itemName === "Butterfly Dress (from Faerie Festival event)") { + nameOrId = 76073; + } else { + nameOrId = normalizeItemName(itemName); + } // We wrap it in an object with the key `valueText`, just to not break // potential external consumers of this endpoint if we add more fields. // (This is kinda silly and unnecessary, but it should get gzipped out and // shouldn't add substantial time to building or parsing, so like w/e!) - itemValuesByIdOrName[normalizedItemName] = { valueText }; + itemValuesByIdOrName[nameOrId] = { valueText }; } return itemValuesByIdOrName;