diff --git a/.gitignore b/.gitignore index 2e42a3a2..038f5fe5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ save1.dat save2.dat save3.dat +/scripts/eid_savegames.lua /.vscode \ No newline at end of file diff --git a/descriptions/ab+/en_us.lua b/descriptions/ab+/en_us.lua index 88ad54d8..cb9c3fd0 100644 --- a/descriptions/ab+/en_us.lua +++ b/descriptions/ab+/en_us.lua @@ -873,6 +873,8 @@ EID.descriptions[languageCode].transformations={ EID.descriptions[languageCode].VoidText = "If absorbed, gain:" EID.descriptions[languageCode].VoidNames = {"Speed", "Tears", "Damage", "Range", "Shot Speed", "Luck"} +EID.descriptions[languageCode].CollectionPageInfo = "This item needs to be picked up for the collection page!" + EID.descriptions[languageCode].MCM = { DemoObjectName = "Demo Object Name", DemoObjectTransformation = "Demo Transformation", diff --git a/eid_api.lua b/eid_api.lua index b271b96d..ba6da516 100644 --- a/eid_api.lua +++ b/eid_api.lua @@ -1258,3 +1258,9 @@ function EID:resumeCoroutines() if coroutine.resume(v) == false then EID:removeCoroutine(k) end end end + +-- Returns true if an item needs to be collected for the collection page +function EID:requiredForCollectionPage(itemID) + if not EID.SaveGame or EID.Config["SaveGameNumber"] == 0 then return false end + return not EID.SaveGame[EID.Config["SaveGameNumber"]].ItemCollection[itemID] +end diff --git a/eid_config.lua b/eid_config.lua index b776121a..33f67c5d 100644 --- a/eid_config.lua +++ b/eid_config.lua @@ -294,6 +294,20 @@ EID.UserConfig = { -- Default = none (-1) ["CraftingResultButton"] = -1, + + ---------- Mouse Controls ------------ + + -- Savegame which should be used for savegame specific features (for example: Item Collection page progress) + -- Possible values: 0,1,2,3 + -- Default: 0 (Deactivate all Savegame features) + ["SaveGameNumber"] = 0, + + -- Color in which the name of an item should be highlighted, which needs to be collected for the collection page + -- Color names are defined in "eid_data.lua" (line 365) + -- Default: "ColorFade" + ["ItemCollectionColor"] = "ColorFade", + + ---------- Mouse Controls ------------ -- Toggles HUD descriptions based on the mouse position @@ -318,11 +332,11 @@ EID.UserConfig = { -- Default = [Effect not defined] ["ErrorMessage"] = "[Effect not defined]", -- Set the color of the default description text - -- Color names are defined in "eid_data.lua" (line 300) + -- Color names are defined in "eid_data.lua" (line 365) -- Default = "ColorEIDText" ["TextColor"] = "ColorEIDText", -- Set the color of the error description text - -- Color names are defined in "eid_data.lua" (line 300) + -- Color names are defined in "eid_data.lua" (line 365) -- Default = "ColorEIDError" ["ErrorColor"] = "ColorEIDError", -- Enables or disables custom descriptions for entities @@ -416,6 +430,8 @@ EID.DefaultConfig = { ["CraftingResultButton"] = -1, ["SpindownDiceResults"] = 3, ["SpindownDiceSkipLocked"] = false, + ["SaveGameNumber"] = 0, + ["ItemCollectionColor"] = "ColorFade", ["EnableMouseControls"] = false, ["ShowCursor"] = false, ["ErrorMessage"] = "[Effect not defined]", diff --git a/eid_modifiers.lua b/eid_modifiers.lua index 40a192c3..153eeb5b 100644 --- a/eid_modifiers.lua +++ b/eid_modifiers.lua @@ -391,6 +391,14 @@ if REPENTANCE then return descObj end + -- Handle Item Collection description addition + local function ItemCollectionPageCallback(descObj) + descObj.Name = "{{"..EID.Config["ItemCollectionColor"].."}}"..descObj.Name + local text = EID:getDescriptionEntry("CollectionPageInfo") + + EID:appendToDescription(descObj, "#{{Warning}} {{"..EID.Config["ItemCollectionColor"].."}}"..text) + return descObj + end -------------------------------- -- Although individual conditions/callbacks work well for mods to be able to add through the API, -- As we kept adding callbacks for vanilla items, a lot of code got repeated over and over @@ -410,6 +418,8 @@ if REPENTANCE then -- Using magic numbers here in case it's slightly faster, and because the callback names give context -- Check Birthright first because it overwrites the description instead of appending to it if descObj.ObjSubType == 619 then table.insert(callbacks, BirthrightCallback) end + + if EID:requiredForCollectionPage(descObj.ObjSubType) then table.insert(callbacks, ItemCollectionPageCallback) end if collectiblesOwned[664] then table.insert(callbacks, BingeEaterCallback) end if collectiblesOwned[59] then table.insert(callbacks, BookOfBelialCallback) end diff --git a/main.lua b/main.lua index 7e1c35d2..b29612bb 100644 --- a/main.lua +++ b/main.lua @@ -87,6 +87,7 @@ for _,lang in ipairs(EID.Languages) do end table.sort(EID.Languages) +pcall(require,"scripts.eid_savegames") require("mod_config_menu") require("eid_data") require("eid_xmldata") diff --git a/mod_config_menu.lua b/mod_config_menu.lua index b19d86ef..6835380f 100644 --- a/mod_config_menu.lua +++ b/mod_config_menu.lua @@ -1197,12 +1197,74 @@ if MCMLoaded then ) end + --------------------------------------------------------------------------- + ----------------------------Savegame Config-------------------------------- + if EID.SaveGame then + -- Show Item needs Collection + MCM.AddSetting( + "EID", + "Save Game", + { + Type = ModConfigMenu.OptionType.NUMBER, + CurrentSetting = function() + return EID.Config["SaveGameNumber"] + end, + Minimum = 0, + Maximum = 3, + Display = function() + if EID.Config["SaveGameNumber"] == 0 then + return "Current Save Game: 0 (Deactivated)" + end + return "Current Save Game: " .. EID.Config["SaveGameNumber"] + end, + OnChange = function(currentNum) + EID.MCM_OptionChanged = true + EID.Config["SaveGameNumber"] = currentNum + end, + Info = {"Save game you are currently on. This info needs to be set to get the correct lookup tables"} + } + ) + + -- Needs collection Color + MCM.AddSetting( + "EID", + "Save Game", + { + Type = ModConfigMenu.OptionType.NUMBER, + CurrentSetting = function() + return AnIndexOf(colorNameArray, EID.Config["ItemCollectionColor"]) + end, + Minimum = 0, + Maximum = 1000, + Display = function() + if EID.Config["ItemCollectionColor"] == nil then EID.Config["ItemCollectionColor"] = EID.DefaultConfig["ItemCollectionColor"] end + EID.MCMCompat_isDisplayingEIDTab = "Visuals"; + return "Collection Page Highlight color: " .. string.gsub(EID.Config["ItemCollectionColor"], "Color", "").. " ("..AnIndexOf(colorNameArray, EID.Config["ItemCollectionColor"]).."/"..#colorNameArray..")" + end, + OnChange = function(currentNum) + EID.MCM_OptionChanged = true + if currentNum == 0 then currentNum = #colorNameArray end + if currentNum > #colorNameArray then currentNum = 1 end + EID.Config["ItemCollectionColor"] = colorNameArray[currentNum] + end, + Info = {"Color in which item names are colored to highlight that this item needs to be collected for the collection page"} + } + ) + else + MCM.AddSpace("EID", "Save Game") + MCM.AddSpace("EID", "Save Game") + MCM.AddText("EID", "Save Game", "To enable savegame related features,") + MCM.AddText("EID", "Save Game", "please run \"scripts\\savegame_reader.exe\"") + MCM.AddText("EID", "Save Game", "found in the EID mod folder") + end + + --------------------------------------------------------------------------- -----------------------------Mouse Controls-------------------------------- - MCM.AddText("EID", "Mouse", function() return "! THIS FEATURE IS IN EARLY DEVELOPMENT !" end) + MCM.AddText("EID", "Mouse", "! THIS FEATURE IS IN EARLY DEVELOPMENT !") MCM.AddSpace("EID", "Mouse") - MCM.AddText("EID", "Mouse", function() return "MCM -> General -> Hud Offset" end) - MCM.AddText("EID", "Mouse", function() return "to adjust Hud Offset" end) + MCM.AddText("EID", "Mouse", "MCM -> General -> Hud Offset") + MCM.AddText("EID", "Mouse", "to adjust Hud Offset") MCM.AddSpace("EID", "Mouse") -- Enable mouse controls MCM.AddSetting( diff --git a/scripts/README.txt b/scripts/README.txt new file mode 100644 index 00000000..0a835c04 --- /dev/null +++ b/scripts/README.txt @@ -0,0 +1,20 @@ +The "Savegame_Reader.exe" application can be used to create a LUA readable version of your savegame files. + +The resulting informations can then be used by EID to enable the following features: +- Indicate if an item needs to be collected for the collection page + + +You may need to install "Microsoft .NET 6.0" or greater for this tool to work. + + + +The source code of the application can be found here: +https://github.com/wofsauge/IsaacSavegameReader + + + +SHA-256 Hash: +6ecf16b85ad3ddb1001e43bf54c79f03b04c3c4bd6497b1eb0500be498d26c90 + +Virus total scan: +https://www.virustotal.com/gui/file/6ecf16b85ad3ddb1001e43bf54c79f03b04c3c4bd6497b1eb0500be498d26c90/detection \ No newline at end of file diff --git a/scripts/savegame_reader.dll b/scripts/savegame_reader.dll new file mode 100644 index 00000000..dab324a1 Binary files /dev/null and b/scripts/savegame_reader.dll differ diff --git a/scripts/savegame_reader.exe b/scripts/savegame_reader.exe new file mode 100644 index 00000000..ddd030a6 Binary files /dev/null and b/scripts/savegame_reader.exe differ diff --git a/scripts/savegame_reader.runtimeconfig.json b/scripts/savegame_reader.runtimeconfig.json new file mode 100644 index 00000000..e7b3b03d --- /dev/null +++ b/scripts/savegame_reader.runtimeconfig.json @@ -0,0 +1,12 @@ +{ + "runtimeOptions": { + "tfm": "net6.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "6.0.0" + }, + "configProperties": { + "System.Reflection.Metadata.MetadataUpdater.IsSupported": false + } + } +} \ No newline at end of file