Item Pool information for collectibles (#916)

* test : show item pools for certain item

* item pool icon, pool for item icon

* item pool markup

* item pool mcm options

- also renames 'Display Item Pool *' to 'Current Item Pool*' to avoid confusion

* add api for custom item pool markup assign for REPENTOGON

* fix field name issue

* add api for add item pool name

* fix config values

* limit item pool feature to collectibles for now

* move cached check to top

* oopsie

* more fixes

* add Unknown Item Pool icon

* Update main.lua

* item pool name eng fallback
This commit is contained in:
리셰 authored and GitHub committed 2025-09-17 13:50:23 +02:00
1 parent 0f44f3cec9
commit e9f37c3213
7 files changed
+113 -5

No files matched your search

+5
View File
@@ -190,6 +190,10 @@ EID.UserConfig = {
-- REPENTANCE ONLY!!! -- REPENTANCE ONLY!!!
-- Default = true -- Default = true
["ShowQuality"] = true, ["ShowQuality"] = true,
-- Enables or disables collectible's item pool from which can be appeared
-- REPENTANCE ONLY!!!
-- Default = false
["ShowContainItemPool"] = false,
-- Enables or disables collectible's item pool when collected after item name -- Enables or disables collectible's item pool when collected after item name
-- REPENTANCE ONLY!!! -- REPENTANCE ONLY!!!
-- Default = false -- Default = false
@@ -589,6 +593,7 @@ EID.DefaultConfig = {
["DisplayTrinketInfo"] = true, ["DisplayTrinketInfo"] = true,
["ItemNameColor"] = "ColorEIDObjName", ["ItemNameColor"] = "ColorEIDObjName",
["ShowQuality"] = true, ["ShowQuality"] = true,
["ShowContainItemPool"] = false,
["ShowItemPoolIcon"] = false, ["ShowItemPoolIcon"] = false,
["ShowItemPoolText"] = false, ["ShowItemPoolText"] = false,
["ItemPoolTextColor"] = "ColorSilver", ["ItemPoolTextColor"] = "ColorSilver",
+75
View File
@@ -3019,6 +3019,81 @@ function EID:WatchForGlitchedCrown()
end end
end end
--- Cached table for item pool infos
EID.CachedCollectibleItemPools = {}
---Check Item Pools that contain certain collectible, updates EID.CachedCollectibleItemPools to returned value
---@param collectibleType CollectibleType
---@return table
function EID:GetPoolsForCollectible(collectibleType)
if not EID.isRepentance then return end
local cached = EID.CachedCollectibleItemPools[collectibleType]
if cached then return cached end
local poolTable = {}
if not REPENTOGON then
-- non-rgon : catch from xmldata
local CraftingItemPools = EID.XMLItemPools
local ItemPoolTypeToXMLPool = { -- did this in case for excluding greed pools
[0] = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15,
16, 17, 18, 20, 21, 19, 22, -- greed pools, enum does not match with xmldata
23, 24, 25, 26, 27, 28, 29, 30
}
for i = 0, ItemPoolType.NUM_ITEMPOOLS - 1 do
local xmlPool = ItemPoolTypeToXMLPool[i]
local t = CraftingItemPools[xmlPool + 1]
for _, element in ipairs(t) do
if element[1] == collectibleType and element[2] > 0 and not Isaac.GetItemConfig():GetCollectible(collectibleType).Hidden then
table.insert(poolTable, i)
break
end
end
end
else
-- rgon : catch from pool directly
local pool = game:GetItemPool()
local numPools = pool:GetNumItemPools()
for i = ItemPoolType.POOL_TREASURE, numPools - 1 do
local t = pool:GetCollectiblesFromPool(i)
for _, element in ipairs(t) do
if element.itemID == collectibleType and element.initialWeight > 0 and not Isaac.GetItemConfig():GetCollectible(collectibleType).Hidden then
table.insert(poolTable, i)
break
end
end
end
end
EID.CachedCollectibleItemPools[collectibleType] = poolTable
return poolTable
end
---Assign Item Pool Markup for Custom item pools
---Normally this does nothing if REPENTOGON is not active
---@param itemPoolType ItemPoolType
---@param str String
function EID:assignItemPoolMarkup(itemPoolType, str)
if str ~= nil and type(str) == "string" then
EID.ItemPoolTypeToMarkup[itemPoolType] = str
end
end
---Adds name for a item pool.
---Normally this does nothing if REPENTOGON is not active
---@param id ItemPoolType
---@param poolName string
---@param language EID_LanguageCode? @Default: "en_us"
function EID:addItemPoolName(id, poolName, language)
poolName = poolName or nil
language = language or EID.DefaultLanguageCode
if id == -1 then
EID:WriteErrorMsg("Trying to add item pool name to id = -1, which is not allowed! (Name: "..tostring(poolName)..")")
return
end
EID:CreateDescriptionTableIfMissing("itemPoolNames", language)
EID.descriptions[language].itemPoolNames[id] = poolName
end
---Replaces Variable placeholders in string with a given value ---Replaces Variable placeholders in string with a given value
---Example: "My {1} message" --> "My test message" ---Example: "My {1} message" --> "My test message"
---varID can be omitted to replace {1} (or pass in a string table, to replace {1}, {2}, etc.) ---varID can be omitted to replace {1} (or pass in a string table, to replace {1}, {2}, etc.)
+4
View File
@@ -629,6 +629,8 @@ EID.InlineIcons = {
["ItemPoolWoodenChest"] = {"ItemPools", 29, 11, 11, 0, 0}, ["ItemPoolWoodenChest"] = {"ItemPools", 29, 11, 11, 0, 0},
["ItemPoolRottenBeggar"] = {"ItemPools", 30, 11, 11, 0, 0}, ["ItemPoolRottenBeggar"] = {"ItemPools", 30, 11, 11, 0, 0},
["ItemPoolUnknown"] = {"Misc", 20, 11, 11, 0, 0},
-- Wisps -- Wisps
["InnerWisp"] = {"Wisps", 0, 10, 10, 0, -3}, ["InnerWisp"] = {"Wisps", 0, 10, 10, 0, -3},
["MiddleWisp"] = {"Wisps", 1, 10, 10, 0, -3}, ["MiddleWisp"] = {"Wisps", 1, 10, 10, 0, -3},
@@ -663,6 +665,8 @@ EID.InlineIcons = {
["DailyRunSmall"] = {"Misc", 15, 12, 12, 0, 1}, ["DailyRunSmall"] = {"Misc", 15, 12, 12, 0, 1},
["MagnifyingLens"] = {"Misc", 16, 13, 13, 0, -1}, ["MagnifyingLens"] = {"Misc", 16, 13, 13, 0, -1},
["Padlock"] = {"Misc", 17, 8, 10, 1, 0}, ["Padlock"] = {"Misc", 17, 8, 10, 1, 0},
["ItemPool"] = {"Misc", 18, 12, 11, -1, -1},
["RolledItemPool"] = {"Misc", 19, 12, 11, -1, -1},
["QuestionMark"] = {"CurseOfBlind", 0, 14, 14, 6, 7, EID.IconSprite}, ["QuestionMark"] = {"CurseOfBlind", 0, 14, 14, 6, 7, EID.IconSprite},
} }
-- General Stats (Adjust automatically according to the current DLC) -- General Stats (Adjust automatically according to the current DLC)
+3 -2
View File
@@ -613,8 +613,9 @@ if MCMLoaded then
EID:AddBooleanSetting("Visuals", "TransformationText", "Display Transformation Name") EID:AddBooleanSetting("Visuals", "TransformationText", "Display Transformation Name")
EID:AddBooleanSetting("Visuals", "TransformationIcons", "Display Transformation Icon") EID:AddBooleanSetting("Visuals", "TransformationIcons", "Display Transformation Icon")
EID:AddBooleanSetting("Visuals", "TransformationProgress", "Display Transformation Progress") EID:AddBooleanSetting("Visuals", "TransformationProgress", "Display Transformation Progress")
EID:AddBooleanSetting("Visuals", "ShowItemPoolIcon", "Display Item Pool Icon", {repOnly = true, infoText = "Displays the icon of the expected item pool for full rerolls."}) EID:AddBooleanSetting("Visuals", "ShowContainItemPool", "Item Pool Info", {repOnly = true, infoText = "Displays the icons of item pools for collectible would appear. REPENTOGON is needed for modded items"})
EID:AddBooleanSetting("Visuals", "ShowItemPoolText", "Display Item Pool Name", {repOnly = true, infoText = "Displays the name of the expected item pool for full rerolls."}) EID:AddBooleanSetting("Visuals", "ShowItemPoolIcon", "Current Item Pool Icon", {repOnly = true, infoText = "Displays the icon of the expected item pool for full rerolls."})
EID:AddBooleanSetting("Visuals", "ShowItemPoolText", "Current Item Pool Name", {repOnly = true, infoText = "Displays the name of the expected item pool for full rerolls."})
EID:AddBooleanSetting("Visuals", "ShowObjectID", "Display ID") EID:AddBooleanSetting("Visuals", "ShowObjectID", "Display ID")
-------Mod indicator for modded items--------- -------Mod indicator for modded items---------
+22 -2
View File
@@ -658,7 +658,7 @@ function EID:printDescription(desc, cachedID)
if not EID.Config["ShowQuality"] then if not EID.Config["ShowQuality"] then
curName = curName.." - " curName = curName.." - "
end end
curName = curName..""..(EID.ItemPoolTypeToMarkup[desc.ItemPoolType] or "{{ItemPoolTreasure}}") curName = curName..""..(EID.ItemPoolTypeToMarkup[desc.ItemPoolType] or "{{ItemPoolUnknown}}")
end end
end end
-- Display the mod this item is from -- Display the mod this item is from
@@ -720,6 +720,25 @@ function EID:printDescription(desc, cachedID)
end end
end end
end end
-- Display Possible Pool for Collectible
if EID.isRepentance and EID.Config["ShowContainItemPool"] and (desc.ObjType == 5 and desc.ObjVariant == 100 and desc.ObjSubType ~= nil) then
local itemConfig = EID.itemConfig:GetCollectible(desc.ObjSubType)
if itemConfig:IsCollectible() then
local pools = EID:GetPoolsForCollectible(desc.ObjSubType)
if pools and #pools > 0 then
local poolName = "{{ItemPool}} {{NoLB}}"
for _, pool in ipairs(pools) do
if EID.ItemPoolTypeToMarkup[pool] then
poolName = poolName .. "" .. EID.ItemPoolTypeToMarkup[pool]
end
end
renderPos = EID:printBulletPoints(poolName, renderPos, desc.IgnoreBulletPointIconConfig)
end
end
end
-- Display Last Pool for Collectible for full reroll effects (name) -- Display Last Pool for Collectible for full reroll effects (name)
if desc.ItemPoolType and not EID.InsideItemReminder and EID.Config["ShowItemPoolText"] then if desc.ItemPoolType and not EID.InsideItemReminder and EID.Config["ShowItemPoolText"] then
local itemConfig = EID.itemConfig:GetCollectible(desc.ObjSubType) local itemConfig = EID.itemConfig:GetCollectible(desc.ObjSubType)
@@ -729,7 +748,8 @@ function EID:printDescription(desc, cachedID)
local poolName = "" local poolName = ""
local poolDescPrepend = EID:getDescriptionEntry("itemPoolFor") local poolDescPrepend = EID:getDescriptionEntry("itemPoolFor")
local poolDescTable = EID:getDescriptionEntry("itemPoolNames") local poolDescTable = EID:getDescriptionEntry("itemPoolNames")
poolName = "{{"..EID.Config["ItemPoolTextColor"].."}}"..poolDescPrepend..""..(EID.ItemPoolTypeToMarkup[lastPool] or "{{ItemPoolTreasure}}")..poolDescTable[lastPool] .. "{{CR}}#" local poolDescTableEng = EID:getDescriptionEntryEnglish("itemPoolNames")
poolName = "{{RolledItemPool}} {{NoLB}}{{"..EID.Config["ItemPoolTextColor"].."}}"..poolDescPrepend..""..(EID.ItemPoolTypeToMarkup[lastPool] or "{{ItemPoolUnknown}}")..(poolDescTable[lastPool] or poolDescTableEng[lastPool] or "Modded item pool") .. "{{CR}}#"
renderPos = EID:printBulletPoints(poolName, renderPos, desc.IgnoreBulletPointIconConfig) renderPos = EID:printBulletPoints(poolName, renderPos, desc.IgnoreBulletPointIconConfig)
end end
+4 -1
View File
@@ -1,5 +1,5 @@
<AnimatedActor> <AnimatedActor>
<Info CreatedBy="Unknown" CreatedOn="11.09.2025 18:17:58" Version="218" Fps="30"/> <Info CreatedBy="Unknown" CreatedOn="2025-09-17 00:18:43" Version="221" Fps="30"/>
<Content> <Content>
<Spritesheets> <Spritesheets>
<Spritesheet Path="eid_inline_icons.png" Id="0"/> <Spritesheet Path="eid_inline_icons.png" Id="0"/>
@@ -535,6 +535,9 @@
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="242" YCrop="183" Width="11" Height="9" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/> <Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="242" YCrop="183" Width="11" Height="9" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="0" YCrop="114" Width="13" Height="13" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/> <Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="0" YCrop="114" Width="13" Height="13" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="20" YCrop="115" Width="9" Height="10" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/> <Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="20" YCrop="115" Width="9" Height="10" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="179" YCrop="80" Width="12" Height="14" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="179" YCrop="96" Width="12" Height="14" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="242" YCrop="319" Width="11" Height="11" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
</LayerAnimation> </LayerAnimation>
<LayerAnimation LayerId="1" Visible="true"/> <LayerAnimation LayerId="1" Visible="true"/>
</LayerAnimations> </LayerAnimations>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 33 KiB