Add last used pill effect info for VURP;
Added Echo Chamber itemreminder feature
This commit is contained in:
1 parent
3b8e2b770e
commit
f8de2683ab
4 files changed
+90
-11
No files matched your search
+21
-9
@@ -510,14 +510,7 @@ function EID:getObjectName(Type, Variant, SubType)
|
|||||||
return name or (not string.find(vanillaName, "^#") and vanillaName) or EID.descriptions["en_us"][tableName][SubType][2] or vanillaName
|
return name or (not string.find(vanillaName, "^#") and vanillaName) or EID.descriptions["en_us"][tableName][SubType][2] or vanillaName
|
||||||
elseif tableName == "pills" or tableName == "horsepills" then
|
elseif tableName == "pills" or tableName == "horsepills" then
|
||||||
local adjustedSubtype = EID:getAdjustedSubtype(Type, Variant, SubType)
|
local adjustedSubtype = EID:getAdjustedSubtype(Type, Variant, SubType)
|
||||||
local vanillaName = ""
|
return EID:getPillName(adjustedSubtype, tableName == "horsepills")
|
||||||
if adjustedSubtype == 9999 then
|
|
||||||
vanillaName = "Golden Pill" -- only used for languages that haven't defined a Golden Pill name
|
|
||||||
else
|
|
||||||
vanillaName = EID.itemConfig:GetPillEffect(adjustedSubtype - 1).Name
|
|
||||||
end
|
|
||||||
name = name or (not string.find(vanillaName, "^#") and vanillaName) or EID.descriptions["en_us"][tableName][adjustedSubtype][2] or vanillaName
|
|
||||||
return string.gsub(name,"I'm Excited!!!","I'm Excited!!") -- prevent markup trigger
|
|
||||||
elseif tableName == "sacrifice" then
|
elseif tableName == "sacrifice" then
|
||||||
return EID:getDescriptionEntry("sacrificeHeader")
|
return EID:getDescriptionEntry("sacrificeHeader")
|
||||||
elseif tableName == "dice" then
|
elseif tableName == "dice" then
|
||||||
@@ -528,6 +521,25 @@ function EID:getObjectName(Type, Variant, SubType)
|
|||||||
return Type.."."..Variant.."."..SubType
|
return Type.."."..Variant.."."..SubType
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- returns the name of a pill based on the pilleffect id
|
||||||
|
function EID:getPillName(pillID, isHorsepill)
|
||||||
|
local moddedDesc = EID:getDescriptionEntry("custom", "5.70."..pillID)
|
||||||
|
local legacyModdedDescription = EID:getLegacyModDescription(5, 70, pillID)
|
||||||
|
local tableName = isHorsepill and "horsepills" or "pills"
|
||||||
|
local defaultDesc = EID:getDescriptionEntry(tableName, pillID)
|
||||||
|
|
||||||
|
local name = moddedDesc or legacyModdedDescription or defaultDesc
|
||||||
|
|
||||||
|
local vanillaName = ""
|
||||||
|
if pillID == 9999 then
|
||||||
|
vanillaName = "Golden Pill" -- only used for languages that haven't defined a Golden Pill name
|
||||||
|
else
|
||||||
|
vanillaName = EID.itemConfig:GetPillEffect(pillID - 1).Name
|
||||||
|
end
|
||||||
|
name = name and name[2] or (not string.find(vanillaName, "^#") and vanillaName) or EID.descriptions["en_us"][tableName][pillID][2] or vanillaName
|
||||||
|
return string.gsub(name,"I'm Excited!!!","I'm Excited!!") -- prevent markup trigger
|
||||||
|
end
|
||||||
|
|
||||||
-- tries to get the ingame description of an object, based on their description in the XML files
|
-- tries to get the ingame description of an object, based on their description in the XML files
|
||||||
function EID:getXMLDescription(Type, Variant, SubType)
|
function EID:getXMLDescription(Type, Variant, SubType)
|
||||||
local tableName = EID:getTableName(Type, Variant, SubType)
|
local tableName = EID:getTableName(Type, Variant, SubType)
|
||||||
@@ -1563,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 = {}}
|
EID.PlayerItemInteractions[i] = {LastTouch = 0, actives = {}, pills = {}, altActives = {}, altPills = {}, history = {pills = {},altPills = {}}}
|
||||||
end
|
end
|
||||||
EID.RecentlyTouchedItems[i] = EID.RecentlyTouchedItems[i] or {}
|
EID.RecentlyTouchedItems[i] = EID.RecentlyTouchedItems[i] or {}
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ local rainbowWormEffects = { [0] = 9, 11, 65, 27, 10, 12, 26, 66, 96, 144 }
|
|||||||
-- Mysterious Paper does not play well with displaying Error 404's effect
|
-- Mysterious Paper does not play well with displaying Error 404's effect
|
||||||
local mysteriousPaperBlacklist = { [23] = true, [48] = true }
|
local mysteriousPaperBlacklist = { [23] = true, [48] = true }
|
||||||
|
|
||||||
|
|
||||||
function EID:getHoldMapDescription(player, checkingTwin)
|
function EID:getHoldMapDescription(player, checkingTwin)
|
||||||
EID.InsideItemReminder = true
|
EID.InsideItemReminder = true
|
||||||
-- Starting Blacklist: Recall, Hold
|
-- Starting Blacklist: Recall, Hold
|
||||||
@@ -66,6 +67,27 @@ function EID:getHoldMapDescription(player, checkingTwin)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 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.."#"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
append("{{Collectible700}}", EID:getObjectName(5,100,700), pillNames)
|
||||||
|
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
|
||||||
|
|||||||
@@ -462,6 +462,38 @@ if REPENTANCE then
|
|||||||
return descObj
|
return descObj
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Handle VURP description addition
|
||||||
|
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 lastUsedPill = nil
|
||||||
|
local i = 1
|
||||||
|
while(i <= #pillHistoryTable) do
|
||||||
|
if tonumber(pillHistoryTable[i][1]) ~= PillEffect.PILLEFFECT_VURP + 1 then
|
||||||
|
lastUsedPill = tonumber(pillHistoryTable[i][1])
|
||||||
|
break
|
||||||
|
end
|
||||||
|
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)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return descObj
|
||||||
|
end
|
||||||
|
|
||||||
-- Handle False PHD description addition
|
-- Handle False PHD description addition
|
||||||
local function FalsePHDCallback(descObj)
|
local function FalsePHDCallback(descObj)
|
||||||
local adjustedID = EID:getAdjustedSubtype(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType)
|
local adjustedID = EID:getAdjustedSubtype(descObj.ObjType, descObj.ObjVariant, descObj.ObjSubType)
|
||||||
@@ -578,6 +610,7 @@ if REPENTANCE then
|
|||||||
elseif descObj.ObjVariant == PickupVariant.PICKUP_PILL then
|
elseif descObj.ObjVariant == PickupVariant.PICKUP_PILL then
|
||||||
if EID.collectiblesOwned[654] then table.insert(callbacks, FalsePHDCallback) end
|
if EID.collectiblesOwned[654] then table.insert(callbacks, FalsePHDCallback) end
|
||||||
if EID.collectiblesOwned[348] then table.insert(callbacks, PlaceboCallback) end
|
if EID.collectiblesOwned[348] then table.insert(callbacks, PlaceboCallback) end
|
||||||
|
table.insert(callbacks, VurpCallback)
|
||||||
|
|
||||||
if EID.pillPlayer == nil and #EID.coopAllPlayers > 1 then
|
if EID.pillPlayer == nil and #EID.coopAllPlayers > 1 then
|
||||||
table.insert(callbacks, CoopPillCallback)
|
table.insert(callbacks, CoopPillCallback)
|
||||||
|
|||||||
@@ -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 = {}}
|
EID.PlayerItemInteractions[playerID] = {LastTouch = 0, actives = {}, pills = {}, altActives = {}, altPills = {}, history = {pills = {},altPills = {}}}
|
||||||
end
|
end
|
||||||
-- Dead Tainted Lazarus exceptions
|
-- Dead Tainted Lazarus exceptions
|
||||||
local activesTable = EID.PlayerItemInteractions[playerID].actives
|
local activesTable = EID.PlayerItemInteractions[playerID].actives
|
||||||
@@ -1604,19 +1604,31 @@ if REPENTANCE then
|
|||||||
EID:AddCallback(ModCallbacks.MC_USE_ITEM, OnUseGenesis, CollectibleType.COLLECTIBLE_GENESIS)
|
EID:AddCallback(ModCallbacks.MC_USE_ITEM, OnUseGenesis, CollectibleType.COLLECTIBLE_GENESIS)
|
||||||
end
|
end
|
||||||
|
|
||||||
function EID:OnUsePill(pillEffectID, player)
|
function EID:OnUsePill(pillEffectID, player, useFlags)
|
||||||
player = player or EID.player --AB+ doesn't receive player in callback arguments!
|
player = player or EID.player --AB+ doesn't receive player in callback arguments!
|
||||||
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
|
||||||
|
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)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user