From 034042bf0e57648e15e7768d59682527ce71278e Mon Sep 17 00:00:00 2001 From: Hoo-Knows <73412292+Hoo-Knows@users.noreply.github.com> Date: Thu, 16 May 2024 03:40:00 -0700 Subject: [PATCH] RSM Interop and logic fixes --- LostArtifacts/LostArtifacts.cs | 4 +++ LostArtifacts/LostArtifacts.csproj | 17 +++++----- LostArtifacts/RandoInterop/RSMInterop.cs | 40 ++++++++++++++++++++++++ LostArtifacts/RandoInterop/RandoMenu.cs | 24 ++++++++++++-- LostArtifacts/Resources/logic.json | 2 +- 5 files changed, 76 insertions(+), 11 deletions(-) create mode 100644 LostArtifacts/RandoInterop/RSMInterop.cs diff --git a/LostArtifacts/LostArtifacts.cs b/LostArtifacts/LostArtifacts.cs index a274118..fe4f933 100644 --- a/LostArtifacts/LostArtifacts.cs +++ b/LostArtifacts/LostArtifacts.cs @@ -165,6 +165,10 @@ public override void Initialize(DictionaryLostArtifacts A Hollow Knight Mod Copyright © 2022 - 1.1.1.0 - 1.1.1.0 + 1.1.1.1 + 1.1.1.1 bin\$(Configuration)\ latest @@ -59,7 +59,7 @@ $(HollowKnightRefs)/Assembly-CSharp-firstpass.dll - ..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mods\DebugMod\DebugMod.dll + ..\..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mods\DebugMod\DebugMod.dll $(HollowKnightRefs)/GalaxyCSharp.dll @@ -68,7 +68,7 @@ ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mods\ItemChanger\ItemChanger.dll - ..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mods\MenuChanger\MenuChanger.dll + ..\..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mods\MenuChanger\MenuChanger.dll $(HollowKnightRefs)/MMHOOK_Assembly-CSharp.dll @@ -98,13 +98,16 @@ $(HollowKnightRefs)/PlayMaker.dll - ..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mods\RandomizerCore\RandomizerCore.dll + ..\..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mods\RandomizerCore\RandomizerCore.dll - ..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mods\RandomizerCore.Json\RandomizerCore.Json.dll + ..\..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mods\RandomizerCore.Json\RandomizerCore.Json.dll - ..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mods\Randomizer 4\RandomizerMod.dll + ..\..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mods\Randomizer 4\RandomizerMod.dll + + + ..\..\..\..\Program Files (x86)\Steam\steamapps\common\Hollow Knight\hollow_knight_Data\Managed\Mods\RandoSettingsManager\RandoSettingsManager.dll $(HollowKnightRefs)\Mods\Satchel\Satchel.dll diff --git a/LostArtifacts/RandoInterop/RSMInterop.cs b/LostArtifacts/RandoInterop/RSMInterop.cs new file mode 100644 index 0000000..1e6489a --- /dev/null +++ b/LostArtifacts/RandoInterop/RSMInterop.cs @@ -0,0 +1,40 @@ +using RandoSettingsManager; +using RandoSettingsManager.SettingsManagement; +using RandoSettingsManager.SettingsManagement.Versioning; + +namespace LostArtifacts.Rando +{ + internal static class RSMInterop + { + public static void Hook() + { + RandoSettingsManagerMod.Instance.RegisterConnection(new ArtifactRandoSettings()); + } + } + + internal class ArtifactRandoSettings : RandoSettingsProxy + { + public override string ModKey => LostArtifacts.Instance.GetName(); + + public override VersioningPolicy VersioningPolicy { get; } + = new EqualityVersioningPolicy(LostArtifacts.Instance.GetVersion()); + + public override void ReceiveSettings(RandoSettings settings) + { + if(settings != null) + { + RandoMenu.Apply(settings); + } + else + { + RandoMenu.Disable(); + } + } + + public override bool TryProvideSettings(out RandoSettings settings) + { + settings = LostArtifacts.RandoSettings; + return settings.EnableArtifacts; + } + } +} \ No newline at end of file diff --git a/LostArtifacts/RandoInterop/RandoMenu.cs b/LostArtifacts/RandoInterop/RandoMenu.cs index a77b2fd..b1c8e74 100644 --- a/LostArtifacts/RandoInterop/RandoMenu.cs +++ b/LostArtifacts/RandoInterop/RandoMenu.cs @@ -1,4 +1,5 @@ -using MenuChanger; +using ItemChanger; +using MenuChanger; using MenuChanger.Extensions; using MenuChanger.MenuElements; using MenuChanger.MenuPanels; @@ -33,12 +34,12 @@ public static void ConstructMenu(MenuPage landingPage) enableArtifactsToggle = (ToggleButton)factory.ElementLookup[nameof(LostArtifacts.RandoSettings.EnableArtifacts)]; randomizeArtifactsToggle = (ToggleButton)factory.ElementLookup[nameof(LostArtifacts.RandoSettings.RandomizeArtifacts)]; - artifactGroupField = (NumericEntryField)factory.ElementLookup[nameof(LostArtifacts.RandoSettings.ArtifactGroup)]; useCustomLocations = (ToggleButton)factory.ElementLookup[nameof(LostArtifacts.RandoSettings.UseCustomLocations)]; + artifactGroupField = (NumericEntryField)factory.ElementLookup[nameof(LostArtifacts.RandoSettings.ArtifactGroup)]; enableArtifactsToggle.SelfChanged += EnableArtifactsChanged; randomizeArtifactsToggle.SelfChanged += RandomizeArtifactsChanged; - artifactGroupField.SelfChanged += ArtifactGroupChanged; useCustomLocations.SelfChanged += UseCustomLocationsChanged; + artifactGroupField.SelfChanged += ArtifactGroupChanged; if(!LostArtifacts.RandoSettings.RandomizeArtifacts) { @@ -104,5 +105,22 @@ private static void ChangeTopLevelColor() if(LostArtifacts.RandoSettings.RandomizeArtifacts) pageRootButton.Text.color = Colors.TRUE_COLOR; } } + + // RSM Interop + public static void Apply(RandoSettings settings) + { + enableArtifactsToggle.SetValue(settings.EnableArtifacts); + randomizeArtifactsToggle.SetValue(settings.RandomizeArtifacts); + useCustomLocations.SetValue(settings.UseCustomLocations); + artifactGroupField.SetValue(settings.ArtifactGroup); + } + + public static void Disable() + { + enableArtifactsToggle.SetValue(false); + randomizeArtifactsToggle.SetValue(false); + useCustomLocations.SetValue(false); + artifactGroupField.SetValue(-1); + } } } diff --git a/LostArtifacts/Resources/logic.json b/LostArtifacts/Resources/logic.json index a77b88d..657e9f0 100644 --- a/LostArtifacts/Resources/logic.json +++ b/LostArtifacts/Resources/logic.json @@ -77,7 +77,7 @@ }, { "name": "AttunedJewel", - "logic": "GG_Workshop + GG_Atrium + *Boss_Geo-Vengefly_King + Defeated_Gruz_Mother + Defeated_False_Knight + *Boss_Geo-Massive_Moss_Charger + Defeated_Hornet_1 + Defeated_Gorb + Defeated_Elegant_Warrior + Defeated_Brooding_Mawlek + Defeated_Xero + Defeated_Colosseum_2 + Defeated_Mantis_Lords + Defeated_Marmu + Defeated_Flukemarm + Defeated_Galien + Defeated_Hive_Knight + Defeated_Elder_Hu + Defeated_Collector + Defeated_Grimm + Defeated_Watcher_Knights + Defeated_Uumuu + Defeated_Nosk + Defeated_Hornet_2 + Defeated_Enraged_Guardian + Defeated_Lost_Kin + Defeated_No_Eyes + Defeated_Traitor_Lord + Defeated_White_Defender + Defeated_Soul_Tyrant + Defeated_Markoth + Defeated_Failed_Champion" + "logic": "GG_Atrium + WINGS + LEFTCLAW + VOIDHEART + *Boss_Geo-Vengefly_King + Defeated_Gruz_Mother + Defeated_False_Knight + *Boss_Geo-Massive_Moss_Charger + Defeated_Hornet_1 + Defeated_Gorb + Defeated_Elegant_Warrior + Defeated_Brooding_Mawlek + Defeated_Xero + Defeated_Colosseum_2 + Defeated_Mantis_Lords + Defeated_Marmu + Defeated_Flukemarm + Defeated_Galien + Defeated_Hive_Knight + Defeated_Elder_Hu + Defeated_Collector + Defeated_Grimm + Defeated_Watcher_Knights + Defeated_Uumuu + Defeated_Nosk + Defeated_Hornet_2 + Defeated_Enraged_Guardian + Defeated_Lost_Kin + Defeated_No_Eyes + Defeated_Traitor_Lord + Defeated_White_Defender + Defeated_Soul_Tyrant + Defeated_Markoth + Defeated_Failed_Champion + Defeated_Grey_Prince_Zote" }, { "name": "HiddenMemento",