Make config option "TranslateItemName" work in all usecases, fixing wrong behavior in Item reminder and other features
This commit is contained in:
1 parent
9efa77309e
commit
78bc8fcb43
2 files changed
+28
-17
No files matched your search
+28
-3
@@ -100,7 +100,6 @@ local dynamicSpriteCache = {} -- used to store sprite objects of collectible ico
|
|||||||
---@field Icon EID_Icon
|
---@field Icon EID_Icon
|
||||||
---@field Entity Entity?
|
---@field Entity Entity?
|
||||||
---@field ShowWhenUnidentified boolean?
|
---@field ShowWhenUnidentified boolean?
|
||||||
---@field PermanentTextEnglish string?
|
|
||||||
---@field IgnoreBulletPointIconConfig boolean?
|
---@field IgnoreBulletPointIconConfig boolean?
|
||||||
---@field ItemType integer?
|
---@field ItemType integer?
|
||||||
---@field ChargeType integer?
|
---@field ChargeType integer?
|
||||||
@@ -526,7 +525,7 @@ end
|
|||||||
---@param permName1 string
|
---@param permName1 string
|
||||||
---@param permName2 string?
|
---@param permName2 string?
|
||||||
function EID:displayPermanentText(descriptionObject, permName1, permName2)
|
function EID:displayPermanentText(descriptionObject, permName1, permName2)
|
||||||
descriptionObject.PermanentTextEnglish = EID:getDescriptionEntryEnglish(permName1, permName2)
|
descriptionObject.Name = EID:getDescriptionEntryEnglish(permName1, permName2)
|
||||||
EID.permanentDisplayTextObj = descriptionObject
|
EID.permanentDisplayTextObj = descriptionObject
|
||||||
EID.isDisplayingPermanent = true
|
EID.isDisplayingPermanent = true
|
||||||
end
|
end
|
||||||
@@ -938,11 +937,12 @@ function EID:getTransformationName(id)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---Tries to get the ingame name of an item based on its ID
|
---Tries to get the ingame name of an item based on its ID
|
||||||
|
--- Used internally by EID:getObjectName, which also handles the TranslateItemName config option
|
||||||
---@param Type EntityType
|
---@param Type EntityType
|
||||||
---@param Variant integer
|
---@param Variant integer
|
||||||
---@param SubType integer
|
---@param SubType integer
|
||||||
---@return string
|
---@return string
|
||||||
function EID:getObjectName(Type, Variant, SubType)
|
local function getObjectName_internal(Type, Variant, SubType)
|
||||||
local fallbackName = Type.."."..Variant.."."..SubType
|
local fallbackName = Type.."."..Variant.."."..SubType
|
||||||
local tableName = EID:getTableName(Type, Variant, SubType)
|
local tableName = EID:getTableName(Type, Variant, SubType)
|
||||||
|
|
||||||
@@ -990,6 +990,31 @@ function EID:getObjectName(Type, Variant, SubType)
|
|||||||
return fallbackName
|
return fallbackName
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Tries to get the ingame name of an item based on its ID
|
||||||
|
---@param Type EntityType
|
||||||
|
---@param Variant integer
|
||||||
|
---@param SubType integer
|
||||||
|
---@return string
|
||||||
|
function EID:getObjectName(Type, Variant, SubType)
|
||||||
|
local combinedName = getObjectName_internal(Type, Variant, SubType)
|
||||||
|
if EID.Config["TranslateItemName"] ~= 2 then
|
||||||
|
local curLanguage = EID.Config["Language"]
|
||||||
|
if EID:getLanguage() ~= EID.DefaultLanguageCode then
|
||||||
|
EID.Config["Language"] = EID.DefaultLanguageCode
|
||||||
|
local englishName = getObjectName_internal(Type, Variant, SubType)
|
||||||
|
EID.Config["Language"] = curLanguage
|
||||||
|
if englishName ~= combinedName then
|
||||||
|
if EID.Config["TranslateItemName"] == 1 then
|
||||||
|
combinedName = englishName
|
||||||
|
elseif EID.Config["TranslateItemName"] == 3 and combinedName ~= englishName then
|
||||||
|
combinedName = combinedName.." ("..englishName..")"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return combinedName
|
||||||
|
end
|
||||||
|
|
||||||
---Returns the name of a player based on their ID
|
---Returns the name of a player based on their ID
|
||||||
---@param id PlayerType
|
---@param id PlayerType
|
||||||
---@param altFallback? string
|
---@param altFallback? string
|
||||||
|
|||||||
@@ -641,19 +641,6 @@ function EID:printDescription(desc, cachedID)
|
|||||||
local curName = ""
|
local curName = ""
|
||||||
if EID.Config["ShowItemName"] and desc.Name then
|
if EID.Config["ShowItemName"] and desc.Name then
|
||||||
curName = desc.Name
|
curName = desc.Name
|
||||||
if EID.Config["TranslateItemName"] ~= 2 and desc.ObjType ~= -999 then
|
|
||||||
local curLanguage = EID.Config["Language"]
|
|
||||||
if EID:getLanguage() ~= EID.DefaultLanguageCode then
|
|
||||||
EID.Config["Language"] = EID.DefaultLanguageCode
|
|
||||||
local englishName = desc.PermanentTextEnglish or EID:getObjectName(desc.ObjType, desc.ObjVariant, desc.ObjSubType)
|
|
||||||
EID.Config["Language"] = curLanguage
|
|
||||||
if EID.Config["TranslateItemName"] == 1 then
|
|
||||||
curName = englishName
|
|
||||||
elseif EID.Config["TranslateItemName"] == 3 and curName ~= englishName then
|
|
||||||
curName = curName.." ("..englishName..")"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
-- Display Entity ID
|
-- Display Entity ID
|
||||||
if EID.Config["ShowObjectID"] and desc.ObjType and desc.ObjType > 0 then
|
if EID.Config["ShowObjectID"] and desc.ObjType and desc.ObjType > 0 then
|
||||||
@@ -1679,7 +1666,6 @@ function EID:OnRender()
|
|||||||
if EID.Config["ItemReminderEnabled"] and EID.holdTabCounter >= 30 and EID.TabDescThisFrame == false and EID.holdTabPlayer ~= nil then
|
if EID.Config["ItemReminderEnabled"] and EID.holdTabCounter >= 30 and EID.TabDescThisFrame == false and EID.holdTabPlayer ~= nil then
|
||||||
EID:ItemReminderHandleInputs()
|
EID:ItemReminderHandleInputs()
|
||||||
local demoDescObj = EID:getDescriptionObj(-999, -1, 1)
|
local demoDescObj = EID:getDescriptionObj(-999, -1, 1)
|
||||||
demoDescObj.PermanentTextEnglish = EID:getDescriptionEntryEnglish("ItemReminder", "Title")
|
|
||||||
-- check for scrolling being enabled here and append scroll controls to the title?
|
-- check for scrolling being enabled here and append scroll controls to the title?
|
||||||
demoDescObj.Description = EID:ItemReminderGetDescription()
|
demoDescObj.Description = EID:ItemReminderGetDescription()
|
||||||
demoDescObj.Name = EID:ItemReminderGetTitle()
|
demoDescObj.Name = EID:ItemReminderGetTitle()
|
||||||
|
|||||||
Reference in new issue
Block a user