diff --git a/features/eid_api.lua b/features/eid_api.lua index 3042a761..97f3fc67 100644 --- a/features/eid_api.lua +++ b/features/eid_api.lua @@ -3429,3 +3429,20 @@ function EID:WriteErrorMsg(str) EID:WriteDebugMsg("EID ERROR: " .. str) end +--- Helper function to evaluate if a pill color is identified +--- @param pillColor any +--- @return boolean +function EID:ShouldShowPillAsIdentified(pillColor) + local identified = game:GetItemPool():IsPillIdentified(pillColor) and not EID.Config["OnlyShowPillWhenUsedAtLeastOnce"] + if EID.isRepentance and pillColor % PillColor.PILL_GIANT_FLAG == PillColor.PILL_GOLD then identified = true end + local pillEffectID = EID:getAdjustedSubtype(5, 70, pillColor) + local wasUsed = EID:WasPillUsed(pillColor) + + if (identified or wasUsed or EID.Config["ShowUnidentifiedPillDescriptions"]) and not EID.UnidentifyablePillEffects[pillEffectID] then + -- show identified pill + return true + else + -- show unidentified pill description + return false + end +end diff --git a/features/eid_data.lua b/features/eid_data.lua index 9af22e11..218e09c0 100644 --- a/features/eid_data.lua +++ b/features/eid_data.lua @@ -91,28 +91,47 @@ EID.HUDElements = { local id = EID.player:GetCard(0) if id ~= 0 then return EID:getDescriptionObj(5, 300, id) end id = EID.player:GetPill(0) - if id ~= 0 then return EID:getDescriptionObj(5, 70, id) end + if id ~= 0 then + if not EID:ShouldShowPillAsIdentified(id) then + return { Description = "UnidentifiedPill", Entity = EID.player} + end + return EID:getDescriptionObj(5, 70, id) end return nil end}, ["Pocket2"] = {x = 0,y = 40, width = 30, height = 30, anchors={"BOTTOM","RIGHT"}, descriptionObj = function() local id = EID.player:GetCard(1) if id ~= 0 then return EID:getDescriptionObj(5, 300, id) end id = EID.player:GetPill(1) - if id ~= 0 then return EID:getDescriptionObj(5, 70, id) end + if id ~= 0 then + if not EID:ShouldShowPillAsIdentified(id) then + return { Description = "UnidentifiedPill", Entity = EID.player} + end + return EID:getDescriptionObj(5, 70, id) + end return nil end}, ["Pocket3"] = {x = 0,y = 70, width = 30, height = 25, anchors={"BOTTOM","RIGHT"}, descriptionObj = function() local id = EID.player:GetCard(2) if id ~= 0 then return EID:getDescriptionObj(5, 300, id) end id = EID.player:GetPill(2) - if id ~= 0 then return EID:getDescriptionObj(5, 70, id) end + if id ~= 0 then + if not EID:ShouldShowPillAsIdentified(id) then + return { Description = "UnidentifiedPill", Entity = EID.player} + end + return EID:getDescriptionObj(5, 70, id) + end return nil end}, ["Pocket4"] = {x = 0,y = 95, width = 30, height = 20, anchors={"BOTTOM","RIGHT"}, descriptionObj = function() local id = EID.player:GetCard(3) if id ~= 0 then return EID:getDescriptionObj(5, 300, id) end id = EID.player:GetPill(3) - if id ~= 0 then return EID:getDescriptionObj(5, 70, id) end + if id ~= 0 then + if not EID:ShouldShowPillAsIdentified(id) then + return { Description = "UnidentifiedPill", Entity = EID.player} + end + return EID:getDescriptionObj(5, 70, id) + end return nil end} } @@ -132,7 +151,7 @@ EID.TextReplacementPairs = { {"\r\n", "#"}, -- Line break for long strings {"\n", "#"}, -- Line break for long strings {"\r", "#"}, -- Line break for long strings - {"\t", ""}, -- Remove Tabs, useful for formatting logn string texts inside a file, without activating the EID markup system to control the bulletpoint icons + {"\t", ""}, -- Remove Tabs, useful for formatting long string texts inside a file, without activating the EID markup system to control the bulletpoint icons {"{{Hashtag}}", "ǂ"}, -- Hashtag {"{{CR}}", "{{ColorReset}}"}, -- Shortcut for Color Resetting {"{{EthernalHeart}}", "{{EternalHeart}}"}, -- fix spelling error diff --git a/main.lua b/main.lua index aa5a3061..0c9f4529 100644 --- a/main.lua +++ b/main.lua @@ -1632,13 +1632,7 @@ function EID:OnRender() end if not wasHidden then local pillColor = closest.SubType - local pool = game:GetItemPool() - local identified = pool:IsPillIdentified(pillColor) and not EID.Config["OnlyShowPillWhenUsedAtLeastOnce"] - if EID.isRepentance and pillColor % PillColor.PILL_GIANT_FLAG == PillColor.PILL_GOLD then identified = true end - local pillEffectID = EID:getAdjustedSubtype(closest.Type, closest.Variant, pillColor) - local wasUsed = EID:WasPillUsed(pillColor) - - if (identified or wasUsed or EID.Config["ShowUnidentifiedPillDescriptions"]) and not EID.UnidentifyablePillEffects[pillEffectID] then + if EID:ShouldShowPillAsIdentified(pillColor) then -- show identified pill local descEntry = EID:getDescriptionObj(closest.Type, closest.Variant, pillColor, closest) EID:addDescriptionToPrint(descEntry)