Merge branch 'master' of https://github.com/wofsauge/External-Item-Descriptions into master
This commit is contained in:
commit
e4795a42d2
1 file changed
+19
-3
+19
-3
@@ -407,7 +407,7 @@ end
|
||||
---@param description string
|
||||
---@param language? EID_LanguageCode @Default: "en_us"
|
||||
function EID:addEntity(id, variant, subtype, entityName, description, language)
|
||||
subtype = subtype or nil
|
||||
subtype = subtype or -1
|
||||
language = language or "en_us"
|
||||
if id == EntityType.ENTITY_EFFECT then
|
||||
EID.effectList[variant] = true
|
||||
@@ -738,8 +738,24 @@ function EID:getDescriptionEntry(objTable, objIdentifier, noFallback)
|
||||
else return EID.descriptions[EID:getLanguage()][objTable] or EID.descriptions["en_us"][objTable] end
|
||||
else
|
||||
local translatedTable = EID.descriptions[EID:getLanguage()][objTable]
|
||||
if noFallback then return translatedTable and translatedTable[objIdentifier]
|
||||
else return (translatedTable and translatedTable[objIdentifier]) or (EID.descriptions["en_us"][objTable] and EID.descriptions["en_us"][objTable][objIdentifier]) end
|
||||
local description
|
||||
if noFallback then description = translatedTable and translatedTable[objIdentifier]
|
||||
else description = (translatedTable and translatedTable[objIdentifier]) or (EID.descriptions["en_us"][objTable] and EID.descriptions["en_us"][objTable][objIdentifier]) end
|
||||
--Try looking for a -1 that would encompass all subtypes of the variant
|
||||
if not description then
|
||||
local subtype
|
||||
for i = string.len(objIdentifier), 1, -1 do
|
||||
if string.sub(objIdentifier, i, i) == "." then
|
||||
subtype = string.sub(objIdentifier, i + 1, -1)
|
||||
objIdentifier = string.gsub(objIdentifier, "." .. subtype, "") .. ".-1"
|
||||
if subtype ~= "-1" then
|
||||
return EID:getDescriptionEntry(objTable, objIdentifier, noFallback)
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
return description
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user