Fixed error with some search queries with no results

This commit is contained in:
Wofsauge committed 2024-06-03 19:41:18 +02:00
1 parent de18cd3c4c
commit 3620f6250e
2 files changed
+6 -12

No files matched your search

+1 -10
View File
@@ -491,6 +491,7 @@ function EID:getDescriptionEntry(objTable, objID, noFallback)
else return (translatedTable and translatedTable[objID]) or (EID.descriptions["en_us"][objTable] and EID.descriptions["en_us"][objTable][objID]) end
end
end
function EID:getDescriptionEntryEnglish(objTable, objID)
if not objID then
return EID.descriptions["en_us"][objTable]
@@ -511,16 +512,6 @@ function EID:getDescriptionData(Type, Variant, SubType)
return moddedDesc or legacyModdedDescription or defaultDesc
end
function EID:getDescriptionDataEnglish(Type, Variant, SubType)
local fullString = Type.."."..Variant
local adjustedID = EID:getAdjustedSubtype(Type, Variant, SubType)
local moddedDesc = EID:getDescriptionEntryEnglish("custom", fullString.."."..adjustedID)
local tableName = EID:getTableName(Type, Variant, SubType)
local legacyModdedDescription = EID:getLegacyModDescription(Type, Variant, adjustedID)
local defaultDesc = EID:getDescriptionEntryEnglish(tableName, adjustedID)
return moddedDesc or legacyModdedDescription or defaultDesc
end
-- Returns an adjusted SubType id for special cases like Horse Pills and Golden Trinkets
function EID:getAdjustedSubtype(Type, Variant, SubType)
+5 -2
View File
@@ -1307,15 +1307,18 @@ function EID:handleBagOfCraftingRendering(ignoreRefreshRate)
if EID:BoCSGetSearchEnabled() then
-- Filter out item names that don't match our search term
for _,id in ipairs(sortedIDs) do
local searchValid = #currentRecipesList[id] > 0 and (not EID:BoCSGetSearchEnabled() or EID:BoCSCheckItemName(EID:getDescriptionData(5, 100, id)[2]))
local searchValid = #currentRecipesList[id] > 0 and EID:BoCSCheckItemName(EID:getObjectName(5, 100, id))
if (searchValid) then table.insert(IDsToCheck, id) end
end
-- Nothing in our recipe list passed the test; try checking English names as a backup
if #IDsToCheck == 0 then
local curLang = EID:getLanguage()
EID.Config["Language"] = "en_us"
for _,id in ipairs(sortedIDs) do
local searchValid = not EID:BoCSGetSearchEnabled() or EID:BoCSCheckItemName(EID:getDescriptionDataEnglish(5, 100, id)[2])
local searchValid = EID:BoCSCheckItemName(EID:getObjectName(5, 100, id))
if (searchValid) then table.insert(IDsToCheck, id) end
end
EID.Config["Language"] = curLang
end
else IDsToCheck = sortedIDs end