From db1c73f7aca3f61b11e2c2c3e4da958eacd2c568 Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Sat, 30 Nov 2024 17:33:08 +0100 Subject: [PATCH] Improved stability of EID:getObjectName() --- features/eid_api.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/features/eid_api.lua b/features/eid_api.lua index 1b268c9f..5d252d43 100644 --- a/features/eid_api.lua +++ b/features/eid_api.lua @@ -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")