diff options
Diffstat (limited to 'AnodyneArchipelago/Patches')
-rw-r--r-- | AnodyneArchipelago/Patches/GameplayPatches.cs | 10 | ||||
-rw-r--r-- | AnodyneArchipelago/Patches/StatePatches.cs | 22 |
2 files changed, 21 insertions, 11 deletions
diff --git a/AnodyneArchipelago/Patches/GameplayPatches.cs b/AnodyneArchipelago/Patches/GameplayPatches.cs index ada4159..9db87a5 100644 --- a/AnodyneArchipelago/Patches/GameplayPatches.cs +++ b/AnodyneArchipelago/Patches/GameplayPatches.cs | |||
@@ -69,15 +69,15 @@ namespace AnodyneArchipelago.Patches | |||
69 | 69 | ||
70 | if (preset.Frame == 0) | 70 | if (preset.Frame == 0) |
71 | { | 71 | { |
72 | ArchipelagoManager.SendLocation("Temple of the Seeing One - Green Key"); | 72 | Plugin.ArchipelagoManager.SendLocation("Temple of the Seeing One - Green Key"); |
73 | } | 73 | } |
74 | else if (preset.Frame == 1) | 74 | else if (preset.Frame == 1) |
75 | { | 75 | { |
76 | ArchipelagoManager.SendLocation("Red Grotto - Red Key"); | 76 | Plugin.ArchipelagoManager.SendLocation("Red Grotto - Red Key"); |
77 | } | 77 | } |
78 | else if (preset.Frame == 2) | 78 | else if (preset.Frame == 2) |
79 | { | 79 | { |
80 | ArchipelagoManager.SendLocation("Mountain Cavern - Blue Key"); | 80 | Plugin.ArchipelagoManager.SendLocation("Mountain Cavern - Blue Key"); |
81 | } | 81 | } |
82 | } | 82 | } |
83 | } | 83 | } |
@@ -134,7 +134,7 @@ namespace AnodyneArchipelago.Patches | |||
134 | 134 | ||
135 | if (Locations.LocationsByGuid.ContainsKey(preset.EntityID)) | 135 | if (Locations.LocationsByGuid.ContainsKey(preset.EntityID)) |
136 | { | 136 | { |
137 | ArchipelagoManager.SendLocation(Locations.LocationsByGuid[preset.EntityID]); | 137 | Plugin.ArchipelagoManager.SendLocation(Locations.LocationsByGuid[preset.EntityID]); |
138 | } | 138 | } |
139 | } | 139 | } |
140 | } | 140 | } |
@@ -221,7 +221,7 @@ namespace AnodyneArchipelago.Patches | |||
221 | 221 | ||
222 | if (Locations.LocationsByGuid.ContainsKey(preset.EntityID)) | 222 | if (Locations.LocationsByGuid.ContainsKey(preset.EntityID)) |
223 | { | 223 | { |
224 | ArchipelagoManager.SendLocation(Locations.LocationsByGuid[preset.EntityID]); | 224 | Plugin.ArchipelagoManager.SendLocation(Locations.LocationsByGuid[preset.EntityID]); |
225 | } | 225 | } |
226 | } | 226 | } |
227 | } | 227 | } |
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 | } |