Improved stability of EID:getObjectName()

This commit is contained in:
Wofsauge committed 2024-11-30 17:33:08 +01:00
1 parent 5eb7750b75
commit db1c73f7ac
1 file changed
+6 -3
+6 -3
View File
@@ -636,14 +636,17 @@ function EID:getObjectName(Type, Variant, SubType)
if tableName == "collectibles" then
if EID.itemConfig:GetCollectible(SubType) == nil then return Type.."."..Variant.."."..SubType end
local vanillaName = EID.itemConfig:GetCollectible(SubType).Name
return name or (not string.find(vanillaName, "^#") and vanillaName) or (EID.descriptions["en_us"][tableName][SubType] and EID.descriptions["en_us"][tableName][SubType][2]) or vanillaName
local englishName = EID.descriptions["en_us"][tableName][SubType] and EID.descriptions["en_us"][tableName][SubType][2]
return name or (not string.find(vanillaName, "^#") and vanillaName) or englishName or vanillaName
elseif tableName == "trinkets" then
local adjustedSubtype = EID:getAdjustedSubtype(Type, Variant, SubType)
local vanillaName = EID.itemConfig:GetTrinket(adjustedSubtype).Name
return name or (not string.find(vanillaName, "^#") and vanillaName) or EID.descriptions["en_us"][tableName][adjustedSubtype][2] or vanillaName
local englishName = EID.descriptions["en_us"][tableName][adjustedSubtype] and EID.descriptions["en_us"][tableName][adjustedSubtype][2]
return name or (not string.find(vanillaName, "^#") and vanillaName) or englishName or vanillaName
elseif tableName == "cards" then
local vanillaName = EID.itemConfig:GetCard(SubType).Name
return name or (not string.find(vanillaName, "^#") and vanillaName) or EID.descriptions["en_us"][tableName][SubType][2] or vanillaName
local englishName = EID.descriptions["en_us"][tableName][SubType] and EID.descriptions["en_us"][tableName][SubType][2]
return name or (not string.find(vanillaName, "^#") and vanillaName) or englishName or vanillaName
elseif tableName == "pills" or tableName == "horsepills" then
local adjustedSubtype = EID:getAdjustedSubtype(Type, Variant, SubType)
return EID:getPillName(adjustedSubtype, tableName == "horsepills")