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:
7 files changed
+113
-5
No files matched your search
@@ -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.)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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---------
|
||||
|
||||
Reference in new issue
Block a user