fix: Pill names now get evaluated correctly, when ItemNames table entry is present

This commit is contained in:
Wofsauge committed 2026-02-20 18:14:49 +01:00
1 parent 13ba58808f
commit c0e7034e00
1 file changed
+8 -3
+8 -3
View File
@@ -1016,19 +1016,24 @@ function EID:getPillName(pillID, isHorsepill)
local moddedDesc = EID:getDescriptionEntry("custom", "5.70."..pillID) local moddedDesc = EID:getDescriptionEntry("custom", "5.70."..pillID)
local legacyModdedDescription = EID:getLegacyModDescription(5, 70, pillID) local legacyModdedDescription = EID:getLegacyModDescription(5, 70, pillID)
local tableName = isHorsepill and "horsepills" or "pills" local tableName = isHorsepill and "horsepills" or "pills"
local translatedName = EID.ItemNames[EID:getLanguage()]["5.70."..pillID] local defaultDesc = EID:getDescriptionEntry(tableName, pillID)
local defaultDesc = translatedName or EID:getDescriptionEntry(tableName, pillID)
local name = moddedDesc or legacyModdedDescription or defaultDesc local name = moddedDesc or legacyModdedDescription or defaultDesc
local vanillaName = "" local vanillaName = ""
if pillID == 9999 then if pillID == 9999 then
vanillaName = "Golden Pill" -- only used for languages that haven't defined a Golden Pill name vanillaName = "Golden Pill" -- only used for languages that haven't defined a Golden Pill name
else
if EID.itemConfig:GetPillEffect(pillID - 1) == nil then
return "<INVALID PILL ID>"
else else
vanillaName = EID.itemConfig:GetPillEffect(pillID - 1).Name vanillaName = EID.itemConfig:GetPillEffect(pillID - 1).Name
end end
name = name and name[2] or (not string.find(vanillaName, "^#") and vanillaName) or EID.descriptions[EID.DefaultLanguageCode][tableName][pillID][2] or vanillaName end
local translatedName = EID.ItemNames[EID:getLanguage()]["5.70."..pillID-1]
name = name and name[2] or translatedName or (not string.find(vanillaName, "^#") and vanillaName) or EID.descriptions[EID.DefaultLanguageCode][tableName][pillID][2] or vanillaName
name = string.gsub(name,"I'm Excited!!!","I'm Excited!!") -- prevent markup trigger name = string.gsub(name,"I'm Excited!!!","I'm Excited!!") -- prevent markup trigger
return name return name
end end