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 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
@@ -1662,4 +1662,17 @@ end
-- Set a pilleffect to be permanently unidentifyable by EID -- Set a pilleffect to be permanently unidentifyable by EID
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
-- 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 end
+16 -14
View File
@@ -70,24 +70,26 @@ 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 end
append("{{Collectible700}}", EID:getObjectName(5,100,700), pillNames) if pickupNames ~= "" then
append("{{Collectible700}}", EID:getObjectName(5, 100, 700), pickupNames)
end
end end
end end
-- Recently Acquired Item Descriptions -- Recently Acquired Item Descriptions
if EID.Config["ItemReminderShowRecentItem"] > 0 then if EID.Config["ItemReminderShowRecentItem"] > 0 then
local printedItems = 0 local printedItems = 0
+11 -14
View File
@@ -466,29 +466,26 @@ if REPENTANCE then
local function VurpCallback(descObj) local function VurpCallback(descObj)
local adjustedID = EID:getAdjustedSubtype(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType) local adjustedID = EID:getAdjustedSubtype(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType)
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
end end
if lastUsedPill then if lastUsedPill then
local tableName = EID:getTableName(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType) local tableName = EID:getTableName(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType)
local name = EID:getPillName(lastUsedPill, tableName == "horsepills") local name = EID:getPillName(lastUsedPill, tableName == "horsepills")
EID:appendToDescription(descObj, "#{{Pill}} {{ColorSilver}}"..name) EID:appendToDescription(descObj, "#{{Pill}} {{ColorSilver}}" .. name)
end end
end end
return descObj return descObj
+9 -13
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
@@ -1609,29 +1609,25 @@ function EID:OnUsePill(pillEffectID, player, useFlags)
local playerID = EID:getPlayerID(player) local playerID = EID:getPlayerID(player)
-- 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
pillsTable[effectID] = 0 pillsTable[effectID] = 0
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