Echo Chamber Reminder now supports Cards, Runes and pills

This commit is contained in:
Wofsauge committed 2022-08-31 21:06:53 +02:00
1 parent f8de2683ab
commit 44e11223e1
4 files changed
+50 -42

No files matched your search

+14 -1
View File
@@ -1575,7 +1575,7 @@ function EID:evaluateQueuedItems()
for i = 0, game:GetNumPlayers() - 1 do
local player = Isaac.GetPlayer(i)
if not EID.PlayerItemInteractions[i] then
EID.PlayerItemInteractions[i] = {LastTouch = 0, actives = {}, pills = {}, altActives = {}, altPills = {}, history = {pills = {},altPills = {}}}
EID.PlayerItemInteractions[i] = {LastTouch = 0, actives = {}, pills = {}, altActives = {}, altPills = {}, pickupHistory = {}}
end
EID.RecentlyTouchedItems[i] = EID.RecentlyTouchedItems[i] or {}
end
@@ -1662,4 +1662,17 @@ end
-- Set a pilleffect to be permanently unidentifyable by EID
function EID:SetPillEffectUnidentifyable(pillEffectID, isUnidentifyable)
EID.UnidentifyablePillEffects[pillEffectID + 1] = isUnidentifyable or nil
end
-- Add pickup usage to history of pickups used by the player
function EID:AddPickupToHistory(pickupType, effectID, player, useFlags)
if REPENTANCE and useFlags & UseFlag.USE_MIMIC == UseFlag.USE_MIMIC then return end -- dont add mimic pills to history
local playerID = EID:getPlayerID(player)
if not EID.PlayerItemInteractions[playerID].pickupHistory then
EID.PlayerItemInteractions[playerID].pickupHistory = {}
end
local historyTable = EID.PlayerItemInteractions[playerID].pickupHistory
-- pickupType = ["pill","card"], playerTypeID, effectID, hadEchoChamberWhenUsed
table.insert(historyTable, 1, {pickupType, player:GetPlayerType(), effectID, REPENTANCE and player:HasCollectible(700)})
end
+16 -14
View File
@@ -70,24 +70,26 @@ function EID:getHoldMapDescription(player, checkingTwin)
-- Echo Chamber Description
if REPENTANCE and player:HasCollectible(700) then
local playerID = player:GetPlayerType()
if EID.PlayerItemInteractions[playerID].history then
local pillHistoryTable = EID.PlayerItemInteractions[playerID].history.pills
-- Dead Tainted Lazarus
if playerID == 38 then
pillHistoryTable = EID.PlayerItemInteractions[playerID].history.altPills or pillHistoryTable
end
local pillNames = ""
for i = 1, math.min(3,#pillHistoryTable) do
if pillHistoryTable[i][2] then -- Echo chamber is owned
local lastUsedPill = tonumber(pillHistoryTable[i][1])
local name = EID:getPillName(lastUsedPill, false)
pillNames = pillNames..name.."#"
local pickupHistory = EID.PlayerItemInteractions[playerID].pickupHistory
if pickupHistory then
local pickupNames = ""
for i = 1, math.min(3, #pickupHistory) do
if pickupHistory[i][2] == playerID and pickupHistory[i][4] then -- Echo chamber is owned
if pickupHistory[i][1] == "pill" then
local name = EID:getPillName(pickupHistory[i][3], false)
pickupNames = pickupNames .. "{{Pill}} " .. name .. "#"
else
local name = EID:getObjectName(5, 300, pickupHistory[i][3])
pickupNames = pickupNames .. "{{Card" .. pickupHistory[i][3] .. "}} " .. name .. "#"
end
end
end
append("{{Collectible700}}", EID:getObjectName(5,100,700), pillNames)
if pickupNames ~= "" then
append("{{Collectible700}}", EID:getObjectName(5, 100, 700), pickupNames)
end
end
end
-- Recently Acquired Item Descriptions
if EID.Config["ItemReminderShowRecentItem"] > 0 then
local printedItems = 0
+11 -14
View File
@@ -466,29 +466,26 @@ if REPENTANCE then
local function VurpCallback(descObj)
local adjustedID = EID:getAdjustedSubtype(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType)
if adjustedID - 1 ~= PillEffect.PILLEFFECT_VURP then return descObj end
local playerID = EID.player:GetPlayerType()
if EID.PlayerItemInteractions[playerID].history then
local pillHistoryTable = EID.PlayerItemInteractions[playerID].history.pills
-- Dead Tainted Lazarus
if playerID == 38 then
pillHistoryTable = EID.PlayerItemInteractions[playerID].history.altPills or pillHistoryTable
end
local pickupHistory = EID.PlayerItemInteractions[playerID].pickupHistory
if pickupHistory then
local lastUsedPill = nil
local i = 1
while(i <= #pillHistoryTable) do
if tonumber(pillHistoryTable[i][1]) ~= PillEffect.PILLEFFECT_VURP + 1 then
lastUsedPill = tonumber(pillHistoryTable[i][1])
while (i <= #pickupHistory) do
local entry = pickupHistory[i]
if entry[1] == "pill" and entry[2] == playerID and entry[3] ~= PillEffect.PILLEFFECT_VURP + 1 then
lastUsedPill = entry[3]
break
end
i = i +1
i = i + 1
end
if lastUsedPill then
local tableName = EID:getTableName(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType)
local name = EID:getPillName(lastUsedPill, tableName == "horsepills")
EID:appendToDescription(descObj, "#{{Pill}} {{ColorSilver}}"..name)
EID:appendToDescription(descObj, "#{{Pill}} {{ColorSilver}}" .. name)
end
end
return descObj
+9 -13
View File
@@ -1551,7 +1551,7 @@ local function AddActiveItemProgress(player, isD4)
EID.ForceRefreshCache = true
local playerID = EID:getPlayerID(player)
if not EID.PlayerItemInteractions[playerID] then
EID.PlayerItemInteractions[playerID] = {LastTouch = 0, actives = {}, pills = {}, altActives = {}, altPills = {}, history = {pills = {},altPills = {}}}
EID.PlayerItemInteractions[playerID] = {LastTouch = 0, actives = {}, pills = {}, altActives = {}, altPills = {}, pickupHistory = {}}
end
-- Dead Tainted Lazarus exceptions
local activesTable = EID.PlayerItemInteractions[playerID].actives
@@ -1609,29 +1609,25 @@ function EID:OnUsePill(pillEffectID, player, useFlags)
local playerID = EID:getPlayerID(player)
-- Dead Tainted Lazarus exceptions
local pillsTable = EID.PlayerItemInteractions[playerID].pills
if not EID.PlayerItemInteractions[playerID].history then
EID.PlayerItemInteractions[playerID].history = {pills = {},altPills = {}}
end
local pillHistoryTable = EID.PlayerItemInteractions[playerID].history.pills
if player:GetPlayerType() == 38 then
pillsTable = EID.PlayerItemInteractions[playerID].altPills or pillsTable
pillHistoryTable = EID.PlayerItemInteractions[playerID].history.altPills or pillHistoryTable
end
local effectID = tostring(pillEffectID+1)
if not pillsTable[effectID] then
pillsTable[effectID] = 0
end
pillsTable[effectID] = pillsTable[effectID] + 1
if REPENTANCE and useFlags & UseFlag.USE_MIMIC == UseFlag.USE_MIMIC then return end -- dont add mimic pills to history
table.insert(pillHistoryTable, 1, {effectID, REPENTANCE and player:HasCollectible(700)})
for k,v in ipairs(pillHistoryTable) do
print(k,v[1])
end
EID:AddPickupToHistory("pill", pillEffectID+1, player, useFlags)
end
EID:AddCallback(ModCallbacks.MC_USE_PILL, EID.OnUsePill)
function EID:OnUseCard(cardID, player, useFlags)
player = player or EID.player --AB+ doesn't receive player in callback arguments!
EID:AddPickupToHistory("card", cardID, player, useFlags)
end
EID:AddCallback(ModCallbacks.MC_USE_CARD, EID.OnUseCard)
-- only save and load configs when using MCM. Otherwise Config file changes arent valid
if EID.MCMLoaded or REPENTANCE then