RGON: Added Donation Machine descriptions

This commit is contained in:
Wofsauge committed 2024-01-12 22:23:44 +01:00
1 parent 91f88f160f
commit 4400ac7271
4 files changed
+66 -2

No files matched your search

+5
View File
@@ -1196,3 +1196,8 @@ if EID.enableDebug then
EID.descriptions[languageCode].repCards = repCards
EID.descriptions[languageCode].repPills = repPills
end
if REPENTOGON then
EID.descriptions[languageCode].custom["6.8.0"] = {"0", "Donation Machine", "{1} of {2} coins remaining until next achievement#{{Luck}} 2% chance for +1 Luck when donating#{{AngelRoom}} Donating 10 coins increases Angel Room chance"}
EID.descriptions[languageCode].custom["6.11.0"] = {"0", "Greed Donation Machine", "{{ColorGold}}{1} of {2}{{CR}} coins remaining until next achievement"}
end
+5 -1
View File
@@ -433,7 +433,7 @@ EID.UserConfig = {
-- Default = false
["ShowCursor"] = false,
---------- Repentogon ----------
-- The following options only affect features that require the API extention "Repentogon" to be installed.
-- Website: https://repentogon.com/index.html
@@ -442,6 +442,9 @@ EID.UserConfig = {
-- Default = true
["RGON_ShowOnCollectionPage"] = true,
-- Toggles achievement progress descriptions for donation machines
-- Default = true
["RGON_DonationMachineDescriptions"] = true,
---------- Misc ----------
@@ -602,6 +605,7 @@ EID.DefaultConfig = {
["ShowCursor"] = false,
["RGON_ShowOnCollectionPage"] = true,
["RGON_DonationMachineDescriptions"] = true,
["ErrorMessage"] = "[Effect not defined]",
["TextColor"] = "ColorEIDText",
+6 -1
View File
@@ -728,7 +728,12 @@ if MCMLoaded then
Info = {"Color in which item names are colored to highlight that this item needs to be collected for the collection page"}
}
)
EID:AddBooleanSetting("Repentogon", "RGON_ShowOnCollectionPage", "Show descriptions on collection page", { infoText = "Displays item effects when navigating the collection page in the main menu."})
EID:AddBooleanSetting("Repentogon", "RGON_ShowOnCollectionPage", "Show descriptions on collection page", { infoText = "Displays item effects when navigating the collection page in the main menu."})
-- Achievement tracking section
MCM.AddSpace("EID", "Repentogon")
MCM.AddText("EID", "Repentogon", "Achievement tracking")
EID:AddBooleanSetting("Repentogon", "RGON_DonationMachineDescriptions", "Donation machine progress", { infoText = "Displays the number of coins required to gain the next achievement from donation machines"})
end
---------------------------------------------------------------------------
----------------------------Savegame Config--------------------------------
+50
View File
@@ -98,3 +98,53 @@ function EID:BoCTrackBagHolding() end
function EID:BoCDetectBagContentShift() end
-----------------------Descriptions & Modifiers --------------------------
local oldHasDescription = EID.hasDescription
function EID:hasDescription(entity)
local oldReturnVal = oldHasDescription(_,entity)
-- repentogon related checks
-- check if donation machines should have a description
if entity.Type == 6 and (entity.Variant == 8 or entity.Variant == 11) and entity.SubType == 0 then
local isGreed = entity.Variant == 11
local eventCounter = isGreed and EventCounter.GREED_DONATION_MACHINE_COUNTER or
EventCounter.DONATION_MACHINE_COUNTER
local totalDonations = Isaac.GetPersistentGameData():GetEventCounter(eventCounter)
return EID.Config["RGON_DonationMachineDescriptions"] and totalDonations < 1000
end
return oldReturnVal
end
local requirementsDonationMachine = { 10, 20, 50, 100, 150, 200, 400, 600, 900, 999 }
local requirementsGreedDonationMachine = { 2, 14, 33, 68, 111, 234, 439, 500, 666, 879, 999, 1000 }
local function DonationMachineCallback(descObj)
local isGreed = descObj.ObjVariant == 11
local eventCounter = isGreed and EventCounter.GREED_DONATION_MACHINE_COUNTER or
EventCounter.DONATION_MACHINE_COUNTER
local rewardsTable = isGreed and requirementsGreedDonationMachine or requirementsDonationMachine
local totalDonations = Isaac.GetPersistentGameData():GetEventCounter(eventCounter)
local coinsNeeded = 0
for _, value in ipairs(rewardsTable) do
if totalDonations < value then
coinsNeeded = value
break
end
end
descObj.Description = string.gsub(descObj.Description, "{1}", coinsNeeded - totalDonations)
descObj.Description = string.gsub(descObj.Description, "{2}", coinsNeeded)
descObj.Icon = EID.InlineIcons["DonationMachine"]
return descObj
end
local function RepentogonModifierConditions(descObj)
-- Donation machine and Greed donation machine description
if descObj.ObjType == 6 and (descObj.ObjVariant == 8 or descObj.ObjVariant == 11) then
return { DonationMachineCallback }
end
return false
end
EID:addDescriptionModifier("EID Repentogon", RepentogonModifierConditions, nil)