diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-25 13:11:17 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-25 13:11:17 -0400 |
commit | 189fcfc1087764961e61c470ffea642ff46d164d (patch) | |
tree | 77890701aeb8e8e89b1dffb7084559dc6c8e7364 /AnodyneArchipelago/Patches/StatePatches.cs | |
parent | ca34b22c8dbeecda5ac5f66ca24fbe69a617b4dd (diff) | |
download | anodyne-archipelago-189fcfc1087764961e61c470ffea642ff46d164d.tar.gz anodyne-archipelago-189fcfc1087764961e61c470ffea642ff46d164d.tar.bz2 anodyne-archipelago-189fcfc1087764961e61c470ffea642ff46d164d.zip |
You can connect now!
Diffstat (limited to 'AnodyneArchipelago/Patches/StatePatches.cs')
-rw-r--r-- | AnodyneArchipelago/Patches/StatePatches.cs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/AnodyneArchipelago/Patches/StatePatches.cs b/AnodyneArchipelago/Patches/StatePatches.cs index 4b29295..40b30fe 100644 --- a/AnodyneArchipelago/Patches/StatePatches.cs +++ b/AnodyneArchipelago/Patches/StatePatches.cs | |||
@@ -8,6 +8,7 @@ using AnodyneSharp.Drawing.Effects; | |||
8 | using AnodyneSharp.States.MainMenu; | 8 | using AnodyneSharp.States.MainMenu; |
9 | using static AnodyneSharp.AnodyneGame; | 9 | using static AnodyneSharp.AnodyneGame; |
10 | using AnodyneSharp.Drawing; | 10 | using AnodyneSharp.Drawing; |
11 | using System.IO; | ||
11 | 12 | ||
12 | namespace AnodyneArchipelago.Patches | 13 | namespace AnodyneArchipelago.Patches |
13 | { | 14 | { |
@@ -16,7 +17,10 @@ namespace AnodyneArchipelago.Patches | |||
16 | { | 17 | { |
17 | static void Postfix() | 18 | static void Postfix() |
18 | { | 19 | { |
19 | ArchipelagoManager.Update(); | 20 | if (Plugin.ArchipelagoManager != null) |
21 | { | ||
22 | Plugin.ArchipelagoManager.Update(); | ||
23 | } | ||
20 | } | 24 | } |
21 | } | 25 | } |
22 | 26 | ||
@@ -63,6 +67,17 @@ namespace AnodyneArchipelago.Patches | |||
63 | } | 67 | } |
64 | } | 68 | } |
65 | 69 | ||
70 | [HarmonyPatch(typeof(GlobalState.Save), nameof(GlobalState.Save.SaveTo))] | ||
71 | class SaveToPatch | ||
72 | { | ||
73 | static bool Prefix(GlobalState.Save __instance) | ||
74 | { | ||
75 | File.WriteAllText(string.Format("{0}Saves/Save_zzAP{1}_{2}.dat", GameConstants.SavePath, Plugin.ArchipelagoManager.GetSeed(), Plugin.ArchipelagoManager.GetPlayer()), __instance.ToString()); | ||
76 | |||
77 | return false; | ||
78 | } | ||
79 | } | ||
80 | |||
66 | [HarmonyPatch(typeof(PlayState), nameof(PlayState.Create))] | 81 | [HarmonyPatch(typeof(PlayState), nameof(PlayState.Create))] |
67 | class PlayStateCreatePatch | 82 | class PlayStateCreatePatch |
68 | { | 83 | { |
@@ -76,11 +91,6 @@ namespace AnodyneArchipelago.Patches | |||
76 | GlobalState.events.SetEvent("red_cave_l_ss", 999); | 91 | GlobalState.events.SetEvent("red_cave_l_ss", 999); |
77 | GlobalState.events.SetEvent("red_cave_n_ss", 999); | 92 | GlobalState.events.SetEvent("red_cave_n_ss", 999); |
78 | GlobalState.events.SetEvent("red_cave_r_ss", 999); | 93 | GlobalState.events.SetEvent("red_cave_r_ss", 999); |
79 | |||
80 | // Connect to archipelago. | ||
81 | Plugin.Instance.Log.LogInfo("Connecting to Archipelago!"); | ||
82 | |||
83 | ArchipelagoManager.Connect("localhost:38281", "Anodyne", ""); | ||
84 | } | 94 | } |
85 | } | 95 | } |
86 | } | 96 | } |