Improved colors and code of new item unlock-state functions
This commit is contained in:
1 parent
1766c52648
commit
b7a28b8739
3 files changed
+12
-28
No files matched your search
+3
-11
@@ -751,12 +751,11 @@ end
|
|||||||
|
|
||||||
-- Converts a given CollectibleID into the respective Spindown dice result
|
-- Converts a given CollectibleID into the respective Spindown dice result
|
||||||
function EID:getSpindownResult(collectibleID)
|
function EID:getSpindownResult(collectibleID)
|
||||||
local config = Isaac.GetItemConfig()
|
|
||||||
local newID = collectibleID
|
local newID = collectibleID
|
||||||
repeat
|
repeat
|
||||||
newID = newID - 1
|
newID = newID - 1
|
||||||
--note: the order of the SkipLocked check statement is important so that the item is checked for being in a pool either way (to display a ? if it isn't)
|
--note: the order of the SkipLocked check statement is important so that the item is checked for being in a pool either way (to display a ? if it isn't)
|
||||||
until (config:GetCollectible(newID) and (EID:isCollectibleUnlockedAnyPool(newID) or not EID.Config["SpindownDiceSkipLocked"]) and not config:GetCollectible(newID).Hidden) or newID == CollectibleType.COLLECTIBLE_NULL
|
until (EID.itemConfig:GetCollectible(newID) and (EID:isCollectibleUnlockedAnyPool(newID) or not EID.Config["SpindownDiceSkipLocked"]) and not EID.itemConfig:GetCollectible(newID).Hidden) or newID == CollectibleType.COLLECTIBLE_NULL
|
||||||
return newID
|
return newID
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -764,7 +763,7 @@ function EID:GetMaxCollectibleID()
|
|||||||
local id = CollectibleType.NUM_COLLECTIBLES-1
|
local id = CollectibleType.NUM_COLLECTIBLES-1
|
||||||
local step = 16
|
local step = 16
|
||||||
while step > 0 do
|
while step > 0 do
|
||||||
if Isaac.GetItemConfig():GetCollectible(id+step) ~= nil then
|
if EID.itemConfig:GetCollectible(id+step) ~= nil then
|
||||||
id = id + step
|
id = id + step
|
||||||
else
|
else
|
||||||
step = step // 2
|
step = step // 2
|
||||||
@@ -784,7 +783,6 @@ function EID:isCollectibleUnlocked(collectibleID, itemPoolOfItem)
|
|||||||
itemPool:AddRoomBlacklist(i)
|
itemPool:AddRoomBlacklist(i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local room = Game():GetRoom()
|
|
||||||
local isUnlocked = false
|
local isUnlocked = false
|
||||||
for i = 0,1 do -- some samples to make sure
|
for i = 0,1 do -- some samples to make sure
|
||||||
local collID = itemPool:GetCollectible(itemPoolOfItem, false)
|
local collID = itemPool:GetCollectible(itemPoolOfItem, false)
|
||||||
@@ -798,35 +796,29 @@ function EID:isCollectibleUnlocked(collectibleID, itemPoolOfItem)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function EID:isCollectibleUnlockedAnyPool(collectibleID)
|
function EID:isCollectibleUnlockedAnyPool(collectibleID)
|
||||||
local itemConfig = Isaac.GetItemConfig()
|
local item = EID.itemConfig:GetCollectible(collectibleID)
|
||||||
local item = itemConfig:GetCollectible(collectibleID)
|
|
||||||
if EID.itemUnlockStates[collectibleID] == nil then
|
if EID.itemUnlockStates[collectibleID] == nil then
|
||||||
--whitelist all quest items and items with no associated achievement
|
--whitelist all quest items and items with no associated achievement
|
||||||
if (item.AchievementID == -1 or item.Tags & ItemConfig.TAG_QUEST == ItemConfig.TAG_QUEST) then
|
if (item.AchievementID == -1 or item.Tags & ItemConfig.TAG_QUEST == ItemConfig.TAG_QUEST) then
|
||||||
--print("item " .. tostring(collectibleID) .. " is tagged as quest or has no achievement ID!")
|
|
||||||
EID.itemUnlockStates[collectibleID] = true
|
EID.itemUnlockStates[collectibleID] = true
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
--blacklist all hidden items
|
--blacklist all hidden items
|
||||||
if (item.Hidden) then
|
if (item.Hidden) then
|
||||||
--print("item " .. tostring(collectibleID) .. " is tagged as hidden!")
|
|
||||||
EID.itemUnlockStates[collectibleID] = false
|
EID.itemUnlockStates[collectibleID] = false
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
--iterate through the pools this item can be in
|
--iterate through the pools this item can be in
|
||||||
for k,v in ipairs(EID.CollectiblesPools[collectibleID]) do
|
for k,v in ipairs(EID.CollectiblesPools[collectibleID]) do
|
||||||
if (EID:isCollectibleUnlocked(collectibleID, v)) then
|
if (EID:isCollectibleUnlocked(collectibleID, v)) then
|
||||||
--print("found item " .. tostring(collectibleID) .. " unlocked in pool " .. tostring(v))
|
|
||||||
EID.itemUnlockStates[collectibleID] = true
|
EID.itemUnlockStates[collectibleID] = true
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--note: some items will still be missed by this, if they've been taken out of their pools (especially when in Greed Mode)
|
--note: some items will still be missed by this, if they've been taken out of their pools (especially when in Greed Mode)
|
||||||
--print("couldn't find item " .. tostring(collectibleID) .. " in any item pools")
|
|
||||||
EID.itemUnlockStates[collectibleID] = false
|
EID.itemUnlockStates[collectibleID] = false
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
--print("item " .. tostring(collectibleID) .. " was already cached: " .. tostring(EID.itemUnlockStates[collectibleID]))
|
|
||||||
return EID.itemUnlockStates[collectibleID]
|
return EID.itemUnlockStates[collectibleID]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+6
-17
@@ -760,11 +760,9 @@ function EID:handleBagOfCraftingRendering()
|
|||||||
--fix bug with being allowed to go to an empty page if recipe count = multiple of page size (or if we refresh on last page)
|
--fix bug with being allowed to go to an empty page if recipe count = multiple of page size (or if we refresh on last page)
|
||||||
if (EID.bagOfCraftingOffset >= #results) then EID.bagOfCraftingOffset = EID.bagOfCraftingOffset - EID.Config["BagOfCraftingResults"] end
|
if (EID.bagOfCraftingOffset >= #results) then EID.bagOfCraftingOffset = EID.bagOfCraftingOffset - EID.Config["BagOfCraftingResults"] end
|
||||||
|
|
||||||
local resultCount = 0
|
|
||||||
local skips = 0
|
|
||||||
local prevItem = 0
|
local prevItem = 0
|
||||||
|
|
||||||
local qualities = { [0] = "{{ColorSilver}}", "{{ColorLime}}", "{{ColorTransform}}", "{{ColorObjName}}", "{{ColorGold}}" }
|
local qualities = { [0] = "{{ColorSilver}}", "{{ColorLime}}", "{{ColorPastelBlue}}", "{{ColorLavender}}", "{{ColorLightOrange}}" }
|
||||||
local prefix = "#{{Blank}} "
|
local prefix = "#{{Blank}} "
|
||||||
if (EID.lockedResults) then
|
if (EID.lockedResults) then
|
||||||
prefix = "#{{Trinket159}} "
|
prefix = "#{{Trinket159}} "
|
||||||
@@ -776,17 +774,17 @@ function EID:handleBagOfCraftingRendering()
|
|||||||
end
|
end
|
||||||
for i=EID.bagOfCraftingOffset+1,EID.bagOfCraftingOffset+EID.Config["BagOfCraftingResults"] do
|
for i=EID.bagOfCraftingOffset+1,EID.bagOfCraftingOffset+EID.Config["BagOfCraftingResults"] do
|
||||||
local v = results[i]
|
local v = results[i]
|
||||||
if (not v) then break end
|
if not v then break end
|
||||||
|
|
||||||
if (not EID.Config["BagOfCraftingDisplayNames"]) then
|
if not EID.Config["BagOfCraftingDisplayNames"] then
|
||||||
customDescObj.Description = customDescObj.Description.."# {{Collectible"..v[2].."}} "
|
customDescObj.Description = customDescObj.Description.."# {{Collectible"..v[2].."}} "
|
||||||
--tack on Breakfast image to locked recipes
|
--tack on Breakfast image to locked recipes
|
||||||
if (v[3]) then customDescObj.Description = customDescObj.Description.."{{Collectible25}}" end
|
if v[3] then customDescObj.Description = customDescObj.Description.."({{Collectible25}})" end
|
||||||
--color the equals sign with the item quality, so the order of the list can make sense
|
--color the equals sign with the item quality, so the order of the list can make sense
|
||||||
customDescObj.Description = customDescObj.Description.. qualities[EID.itemWeightsLookup[v[2]]] .. "={{CR}}"
|
customDescObj.Description = customDescObj.Description.. qualities[EID.itemWeightsLookup[v[2]]] .. "={{CR}}"
|
||||||
--only display the item name if it's the first occurrence
|
--only display the item name if it's the first occurrence
|
||||||
else
|
else
|
||||||
if (prevItem ~= v[2]) then
|
if prevItem ~= v[2] then
|
||||||
--substring the first 18 characters of the item name so it fits on one line; is there a way to get around desc line length limits?
|
--substring the first 18 characters of the item name so it fits on one line; is there a way to get around desc line length limits?
|
||||||
customDescObj.Description = customDescObj.Description.."# {{Collectible"..v[2].."}} ".. qualities[EID.itemWeightsLookup[v[2]]] ..
|
customDescObj.Description = customDescObj.Description.."# {{Collectible"..v[2].."}} ".. qualities[EID.itemWeightsLookup[v[2]]] ..
|
||||||
string.sub(EID:getObjectName(5, 100, v[2]),1,18).."#"
|
string.sub(EID:getObjectName(5, 100, v[2]),1,18).."#"
|
||||||
@@ -794,7 +792,7 @@ function EID:handleBagOfCraftingRendering()
|
|||||||
customDescObj.Description = customDescObj.Description.."#"
|
customDescObj.Description = customDescObj.Description.."#"
|
||||||
end
|
end
|
||||||
--replace recipe bulletpoint with Breakfast on locked recipes
|
--replace recipe bulletpoint with Breakfast on locked recipes
|
||||||
if (v[3]) then customDescObj.Description = customDescObj.Description.." {{Collectible25}} " end
|
if v[3] then customDescObj.Description = customDescObj.Description.." {{Collectible25}} " end
|
||||||
end
|
end
|
||||||
|
|
||||||
customDescObj.Description = customDescObj.Description..EID:tableToCraftingIconsMerged(v[1])
|
customDescObj.Description = customDescObj.Description..EID:tableToCraftingIconsMerged(v[1])
|
||||||
@@ -807,12 +805,3 @@ function EID:handleBagOfCraftingRendering()
|
|||||||
EID:printDescription(customDescObj)
|
EID:printDescription(customDescObj)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
|
||||||
Isaac.DebugString("Calculating: {1, 1, 1, 1, 1, 1, 1, 1}")
|
|
||||||
Isaac.DebugString(EID:calculateBagOfCrafting({1, 1, 1, 1, 1, 1, 1, 1}))
|
|
||||||
Isaac.DebugString("Calculating: {1, 1, 1, 1, 1, 1, 1, 2}")
|
|
||||||
Isaac.DebugString(EID:calculateBagOfCrafting({1, 1, 1, 1, 1, 1, 1, 2}))
|
|
||||||
Isaac.DebugString("Calculating: {1, 1, 1, 1, 1, 1, 1, 3}")
|
|
||||||
Isaac.DebugString(EID:calculateBagOfCrafting({1, 1, 1, 1, 1, 1, 1, 3}))
|
|
||||||
]]--
|
|
||||||
@@ -291,6 +291,9 @@ EID.InlineColors = {
|
|||||||
["ColorTeal"] = KColor(0, 0.5, 0.5, 1),
|
["ColorTeal"] = KColor(0, 0.5, 0.5, 1),
|
||||||
["ColorNavy"] = KColor(0, 0, 0.5, 1),
|
["ColorNavy"] = KColor(0, 0, 0.5, 1),
|
||||||
["ColorOrange"] = KColor(1, 0.54, 0, 1),
|
["ColorOrange"] = KColor(1, 0.54, 0, 1),
|
||||||
|
["ColorPastelBlue"] = KColor(0.3882, 0.5216, 1, 1),
|
||||||
|
["ColorLavender"] = KColor(0.7451, 0.3686, 1, 1),
|
||||||
|
["ColorLightOrange"] = KColor(1, 0.6353, 0.3686, 1),
|
||||||
-- Swag Colors
|
-- Swag Colors
|
||||||
|
|
||||||
-- Rainbow color effect
|
-- Rainbow color effect
|
||||||
|
|||||||
Reference in new issue
Block a user