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
+42 -34

No files matched your search

+14 -1
View File
@@ -1575,7 +1575,7 @@ function EID:evaluateQueuedItems()
for i = 0, game:GetNumPlayers() - 1 do for i = 0, game:GetNumPlayers() - 1 do
local player = Isaac.GetPlayer(i) local player = Isaac.GetPlayer(i)
if not EID.PlayerItemInteractions[i] then 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 end
EID.RecentlyTouchedItems[i] = EID.RecentlyTouchedItems[i] or {} EID.RecentlyTouchedItems[i] = EID.RecentlyTouchedItems[i] or {}
end end
@@ -1663,3 +1663,16 @@ end
function EID:SetPillEffectUnidentifyable(pillEffectID, isUnidentifyable) function EID:SetPillEffectUnidentifyable(pillEffectID, isUnidentifyable)
EID.UnidentifyablePillEffects[pillEffectID + 1] = isUnidentifyable or nil EID.UnidentifyablePillEffects[pillEffectID + 1] = isUnidentifyable or nil
end 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
+15 -13
View File
@@ -70,21 +70,23 @@ function EID:getHoldMapDescription(player, checkingTwin)
-- Echo Chamber Description -- Echo Chamber Description
if REPENTANCE and player:HasCollectible(700) then if REPENTANCE and player:HasCollectible(700) then
local playerID = player:GetPlayerType() local playerID = player:GetPlayerType()
if EID.PlayerItemInteractions[playerID].history then local pickupHistory = EID.PlayerItemInteractions[playerID].pickupHistory
local pillHistoryTable = EID.PlayerItemInteractions[playerID].history.pills if pickupHistory then
-- Dead Tainted Lazarus local pickupNames = ""
if playerID == 38 then for i = 1, math.min(3, #pickupHistory) do
pillHistoryTable = EID.PlayerItemInteractions[playerID].history.altPills or pillHistoryTable if pickupHistory[i][2] == playerID and pickupHistory[i][4] then -- Echo chamber is owned
end if pickupHistory[i][1] == "pill" then
local pillNames = "" local name = EID:getPillName(pickupHistory[i][3], false)
for i = 1, math.min(3,#pillHistoryTable) do pickupNames = pickupNames .. "{{Pill}} " .. name .. "#"
if pillHistoryTable[i][2] then -- Echo chamber is owned else
local lastUsedPill = tonumber(pillHistoryTable[i][1]) local name = EID:getObjectName(5, 300, pickupHistory[i][3])
local name = EID:getPillName(lastUsedPill, false) pickupNames = pickupNames .. "{{Card" .. pickupHistory[i][3] .. "}} " .. name .. "#"
pillNames = pillNames..name.."#"
end end
end end
append("{{Collectible700}}", EID:getObjectName(5,100,700), pillNames) end
if pickupNames ~= "" then
append("{{Collectible700}}", EID:getObjectName(5, 100, 700), pickupNames)
end
end end
end end
+6 -9
View File
@@ -468,18 +468,15 @@ if REPENTANCE then
if adjustedID - 1 ~= PillEffect.PILLEFFECT_VURP then return descObj end if adjustedID - 1 ~= PillEffect.PILLEFFECT_VURP then return descObj end
local playerID = EID.player:GetPlayerType() local playerID = EID.player:GetPlayerType()
if EID.PlayerItemInteractions[playerID].history then local pickupHistory = EID.PlayerItemInteractions[playerID].pickupHistory
local pillHistoryTable = EID.PlayerItemInteractions[playerID].history.pills if pickupHistory then
-- Dead Tainted Lazarus
if playerID == 38 then
pillHistoryTable = EID.PlayerItemInteractions[playerID].history.altPills or pillHistoryTable
end
local lastUsedPill = nil local lastUsedPill = nil
local i = 1 local i = 1
while(i <= #pillHistoryTable) do while (i <= #pickupHistory) do
if tonumber(pillHistoryTable[i][1]) ~= PillEffect.PILLEFFECT_VURP + 1 then local entry = pickupHistory[i]
lastUsedPill = tonumber(pillHistoryTable[i][1]) if entry[1] == "pill" and entry[2] == playerID and entry[3] ~= PillEffect.PILLEFFECT_VURP + 1 then
lastUsedPill = entry[3]
break break
end end
i = i + 1 i = i + 1
+7 -11
View File
@@ -1551,7 +1551,7 @@ local function AddActiveItemProgress(player, isD4)
EID.ForceRefreshCache = true EID.ForceRefreshCache = true
local playerID = EID:getPlayerID(player) local playerID = EID:getPlayerID(player)
if not EID.PlayerItemInteractions[playerID] then 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 end
-- Dead Tainted Lazarus exceptions -- Dead Tainted Lazarus exceptions
local activesTable = EID.PlayerItemInteractions[playerID].actives local activesTable = EID.PlayerItemInteractions[playerID].actives
@@ -1610,13 +1610,8 @@ function EID:OnUsePill(pillEffectID, player, useFlags)
-- Dead Tainted Lazarus exceptions -- Dead Tainted Lazarus exceptions
local pillsTable = EID.PlayerItemInteractions[playerID].pills 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 if player:GetPlayerType() == 38 then
pillsTable = EID.PlayerItemInteractions[playerID].altPills or pillsTable pillsTable = EID.PlayerItemInteractions[playerID].altPills or pillsTable
pillHistoryTable = EID.PlayerItemInteractions[playerID].history.altPills or pillHistoryTable
end end
local effectID = tostring(pillEffectID+1) local effectID = tostring(pillEffectID+1)
if not pillsTable[effectID] then if not pillsTable[effectID] then
@@ -1624,14 +1619,15 @@ function EID:OnUsePill(pillEffectID, player, useFlags)
end end
pillsTable[effectID] = pillsTable[effectID] + 1 pillsTable[effectID] = pillsTable[effectID] + 1
if REPENTANCE and useFlags & UseFlag.USE_MIMIC == UseFlag.USE_MIMIC then return end -- dont add mimic pills to history EID:AddPickupToHistory("pill", pillEffectID+1, player, useFlags)
table.insert(pillHistoryTable, 1, {effectID, REPENTANCE and player:HasCollectible(700)})
for k,v in ipairs(pillHistoryTable) do
print(k,v[1])
end
end end
EID:AddCallback(ModCallbacks.MC_USE_PILL, EID.OnUsePill) 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 -- only save and load configs when using MCM. Otherwise Config file changes arent valid
if EID.MCMLoaded or REPENTANCE then if EID.MCMLoaded or REPENTANCE then