Added descriptionObject variable "IgnoreBulletPointIconConfig" to prevent the config option to hide stat icons from triggering

This commit is contained in:
Wofsauge committed 2025-05-08 22:12:13 +02:00
1 parent 627ea005a1
commit 3a6b675280
2 files changed
+8 -7

No files matched your search

+3 -2
View File
@@ -117,6 +117,7 @@ local dynamicSpriteCache = {} -- used to store sprite objects of collectible ico
---@field Entity Entity?
---@field ShowWhenUnidentified boolean?
---@field PermanentTextEnglish string?
---@field IgnoreBulletPointIconConfig boolean?
---@field ItemType integer?
---@field ChargeType integer?
---@field Charges integer? @Max charges
@@ -1321,7 +1322,7 @@ end
---Also returns the first word if it was rejected (so it can be removed from the line)
---@param text string
---@return string, string?
function EID:handleBulletpointIcon(text)
function EID:handleBulletpointIcon(text, ignoreBPConfig)
-- Find the position where '}}' is followed by a space or letter
local firstMarkupPos, _ = string.find(text, "{{.-}}")
local startPos, endPos = string.find(text, "}}%s")
@@ -1332,7 +1333,7 @@ function EID:handleBulletpointIcon(text)
local firstWord = string.sub(text, 1, endPos - 1)
firstWord = EID:removeColorMarkup(firstWord)
if EID:getIcon(firstWord) ~= EID.InlineIcons["ERROR"] and string.find(firstWord, "{{.-}}")~=nil then
if not EID.Config["StatAndPickupBulletpoints"] and EID.StatPickupBulletpointBlacklist[firstWord] then
if ignoreBPConfig and not EID.Config["StatAndPickupBulletpoints"] and EID.StatPickupBulletpointBlacklist[firstWord] then
return "\007", firstWord
end
return firstWord
+5 -5
View File
@@ -730,16 +730,16 @@ function EID:printDescription(desc, cachedID)
local poolDescTable = EID:getDescriptionEntry("itemPoolNames")
poolName = "{{"..EID.Config["ItemPoolTextColor"].."}}"..poolDescPrepend..""..(EID.ItemPoolTypeToMarkup[lastPool] or "{{ItemPoolTreasure}}")..poolDescTable[lastPool] .. "{{CR}}#"
renderPos = EID:printBulletPoints(poolName, renderPos)
renderPos = EID:printBulletPoints(poolName, renderPos, desc.IgnoreBulletPointIconConfig)
end
end
if EID.Config["ShowItemDescription"] then
EID:printBulletPoints(desc.Description, renderPos)
EID:printBulletPoints(desc.Description, renderPos, desc.IgnoreBulletPointIconConfig)
end
end
function EID:printBulletPoints(description, renderPos)
function EID:printBulletPoints(description, renderPos, ignoreBPConfig)
local textboxWidth = tonumber(EID.Config["TextboxWidth"])
local textScale = Vector(EID.Scale, EID.Scale)
description = EID:replaceNameMarkupStrings(description)
@@ -751,7 +751,7 @@ function EID:printBulletPoints(description, renderPos)
for i, lineToPrint in ipairs(formatedLines) do
-- render bulletpoint
if i == 1 then
local bpIcon, rejectedIcon = EID:handleBulletpointIcon(lineToPrint)
local bpIcon, rejectedIcon = EID:handleBulletpointIcon(lineToPrint, ignoreBPConfig)
if EID:getIcon(bpIcon) ~= EID.InlineIcons["ERROR"] then
lineToPrint = string.gsub(lineToPrint, bpIcon, "", 1)
textColor = EID:renderString(bpIcon, renderPos + Vector(-3 * EID.Scale, 0), textScale , textColor, true)
@@ -860,7 +860,7 @@ function EID:renderUnidentifiedPill(entity)
)
if EID.Config["ShowItemDescription"] and descriptionObj.ShowWhenUnidentified then
renderPos.Y = renderPos.Y + EID.lineHeight * EID.Scale
EID:printBulletPoints(descriptionObj.Description, renderPos)
EID:printBulletPoints(descriptionObj.Description, renderPos, descriptionObj.IgnoreBulletPointIconConfig)
end
end