diff --git a/eid_config.lua b/eid_config.lua index 7d63842d..e68a362a 100644 --- a/eid_config.lua +++ b/eid_config.lua @@ -190,6 +190,10 @@ EID.UserConfig = { -- REPENTANCE ONLY!!! -- Default = 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 -- REPENTANCE ONLY!!! -- Default = false @@ -589,6 +593,7 @@ EID.DefaultConfig = { ["DisplayTrinketInfo"] = true, ["ItemNameColor"] = "ColorEIDObjName", ["ShowQuality"] = true, + ["ShowContainItemPool"] = false, ["ShowItemPoolIcon"] = false, ["ShowItemPoolText"] = false, ["ItemPoolTextColor"] = "ColorSilver", diff --git a/features/eid_api.lua b/features/eid_api.lua index 29f3b2a0..b3bcc6dd 100644 --- a/features/eid_api.lua +++ b/features/eid_api.lua @@ -3019,6 +3019,81 @@ function EID:WatchForGlitchedCrown() 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 ---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.) diff --git a/features/eid_data.lua b/features/eid_data.lua index 5bb3cad0..d65869cd 100644 --- a/features/eid_data.lua +++ b/features/eid_data.lua @@ -629,6 +629,8 @@ EID.InlineIcons = { ["ItemPoolWoodenChest"] = {"ItemPools", 29, 11, 11, 0, 0}, ["ItemPoolRottenBeggar"] = {"ItemPools", 30, 11, 11, 0, 0}, + ["ItemPoolUnknown"] = {"Misc", 20, 11, 11, 0, 0}, + -- Wisps ["InnerWisp"] = {"Wisps", 0, 10, 10, 0, -3}, ["MiddleWisp"] = {"Wisps", 1, 10, 10, 0, -3}, @@ -663,6 +665,8 @@ EID.InlineIcons = { ["DailyRunSmall"] = {"Misc", 15, 12, 12, 0, 1}, ["MagnifyingLens"] = {"Misc", 16, 13, 13, 0, -1}, ["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}, } -- General Stats (Adjust automatically according to the current DLC) diff --git a/features/eid_mcm.lua b/features/eid_mcm.lua index 5ae149a9..5c224bab 100644 --- a/features/eid_mcm.lua +++ b/features/eid_mcm.lua @@ -613,8 +613,9 @@ if MCMLoaded then EID:AddBooleanSetting("Visuals", "TransformationText", "Display Transformation Name") EID:AddBooleanSetting("Visuals", "TransformationIcons", "Display Transformation Icon") 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", "ShowItemPoolText", "Display Item Pool Name", {repOnly = true, infoText = "Displays the name 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", "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") -------Mod indicator for modded items--------- diff --git a/main.lua b/main.lua index a7390a5b..26b43e40 100644 --- a/main.lua +++ b/main.lua @@ -658,7 +658,7 @@ function EID:printDescription(desc, cachedID) if not EID.Config["ShowQuality"] then curName = curName.." - " end - curName = curName..""..(EID.ItemPoolTypeToMarkup[desc.ItemPoolType] or "{{ItemPoolTreasure}}") + curName = curName..""..(EID.ItemPoolTypeToMarkup[desc.ItemPoolType] or "{{ItemPoolUnknown}}") end end -- Display the mod this item is from @@ -720,6 +720,25 @@ function EID:printDescription(desc, cachedID) 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) if desc.ItemPoolType and not EID.InsideItemReminder and EID.Config["ShowItemPoolText"] then local itemConfig = EID.itemConfig:GetCollectible(desc.ObjSubType) @@ -729,7 +748,8 @@ function EID:printDescription(desc, cachedID) local poolName = "" local poolDescPrepend = EID:getDescriptionEntry("itemPoolFor") 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) end diff --git a/resources/gfx/eid_inline_icons.anm2 b/resources/gfx/eid_inline_icons.anm2 index 724bbd93..9b456688 100644 --- a/resources/gfx/eid_inline_icons.anm2 +++ b/resources/gfx/eid_inline_icons.anm2 @@ -1,5 +1,5 @@ - + @@ -535,6 +535,9 @@ + + + diff --git a/resources/gfx/eid_inline_icons.png b/resources/gfx/eid_inline_icons.png index d87bd5fa..0a44e202 100644 Binary files a/resources/gfx/eid_inline_icons.png and b/resources/gfx/eid_inline_icons.png differ