diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-25 15:00:56 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-25 15:00:56 -0400 |
| commit | 6a9ff88b6c07a7f7d236da008f8a328418c49571 (patch) | |
| tree | 1e1d4c16321661eac5a9dce18e748f6ef61079c4 /AnodyneArchipelago/Patches | |
| parent | 955399d1d873a68fafd703c878533d330a720e5b (diff) | |
| download | anodyne-archipelago-6a9ff88b6c07a7f7d236da008f8a328418c49571.tar.gz anodyne-archipelago-6a9ff88b6c07a7f7d236da008f8a328418c49571.tar.bz2 anodyne-archipelago-6a9ff88b6c07a7f7d236da008f8a328418c49571.zip | |
Trade items, trade locations, windmill, some AP bugs
Diffstat (limited to 'AnodyneArchipelago/Patches')
| -rw-r--r-- | AnodyneArchipelago/Patches/GameplayPatches.cs | 96 |
1 files changed, 96 insertions, 0 deletions
| diff --git a/AnodyneArchipelago/Patches/GameplayPatches.cs b/AnodyneArchipelago/Patches/GameplayPatches.cs index 9db87a5..ba33457 100644 --- a/AnodyneArchipelago/Patches/GameplayPatches.cs +++ b/AnodyneArchipelago/Patches/GameplayPatches.cs | |||
| @@ -10,6 +10,11 @@ using System; | |||
| 10 | using System.Collections.Generic; | 10 | using System.Collections.Generic; |
| 11 | using System.Reflection; | 11 | using System.Reflection; |
| 12 | using Microsoft.Xna.Framework; | 12 | using Microsoft.Xna.Framework; |
| 13 | using AnodyneSharp.Entities.Interactive.Npc.RunningTradeNPCs; | ||
| 14 | using AnodyneSharp.Dialogue; | ||
| 15 | using AnodyneSharp.Sounds; | ||
| 16 | using AnodyneSharp.States; | ||
| 17 | using AnodyneSharp.Entities.Interactive.Npc; | ||
| 13 | 18 | ||
| 14 | namespace AnodyneArchipelago.Patches | 19 | namespace AnodyneArchipelago.Patches |
| 15 | { | 20 | { |
| @@ -225,4 +230,95 @@ namespace AnodyneArchipelago.Patches | |||
| 225 | } | 230 | } |
| 226 | } | 231 | } |
| 227 | } | 232 | } |
| 233 | |||
| 234 | [HarmonyPatch(typeof(Box), nameof(Box.PlayerInteraction))] | ||
| 235 | class BoxOpenPatch | ||
| 236 | { | ||
| 237 | static bool Prefix(Box __instance, ref bool __result) | ||
| 238 | { | ||
| 239 | if (!GlobalState.events.SpookedMonster) | ||
| 240 | { | ||
| 241 | __result = false; | ||
| 242 | return false; | ||
| 243 | } | ||
| 244 | |||
| 245 | __instance.Play("open"); | ||
| 246 | SoundManager.PlaySoundEffect("broom_hit"); | ||
| 247 | GlobalState.StartCutscene = OnOpened(__instance); | ||
| 248 | __result = true; | ||
| 249 | return false; | ||
| 250 | } | ||
| 251 | |||
| 252 | static IEnumerator<CutsceneState.CutsceneEvent> OnOpened(Box box) | ||
| 253 | { | ||
| 254 | MethodInfo openedMethod = typeof(Box).GetMethod("OnOpened", BindingFlags.NonPublic | BindingFlags.Instance); | ||
| 255 | IEnumerator<CutsceneState.CutsceneEvent> subCutscene = (IEnumerator<CutsceneState.CutsceneEvent>)openedMethod.Invoke(box, new object[] { }); | ||
| 256 | |||
| 257 | yield return subCutscene.Current; | ||
| 258 | while (subCutscene.MoveNext()) | ||
| 259 | { | ||
| 260 | yield return subCutscene.Current; | ||
| 261 | } | ||
| 262 | |||
| 263 | GlobalState.inventory.tradeState = InventoryManager.TradeState.NONE; | ||
| 264 | |||
| 265 | Plugin.ArchipelagoManager.SendLocation("Fields - Cardboard Box"); | ||
| 266 | } | ||
| 267 | } | ||
| 268 | |||
| 269 | [HarmonyPatch(typeof(ShopKeep), nameof(ShopKeep.PlayerInteraction))] | ||
| 270 | class ShopKeepTalkPatch | ||
| 271 | { | ||
| 272 | static bool Prefix(ShopKeep __instance) | ||
| 273 | { | ||
| 274 | if (GlobalState.events.GetEvent("ReceivedCardboardBox") == 1 && GlobalState.events.GetEvent("UsedCardboardBox") == 0) | ||
| 275 | { | ||
| 276 | GlobalState.Dialogue = GetDiag(2) + " " + GetDiag(4); | ||
| 277 | GlobalState.events.SetEvent("UsedCardboardBox", 1); | ||
| 278 | |||
| 279 | EntityPreset preset = PatchHelper.GetEntityPreset(typeof(ShopKeep), __instance); | ||
| 280 | preset.Activated = true; | ||
| 281 | |||
| 282 | Plugin.ArchipelagoManager.SendLocation("Fields - Shopkeeper Trade"); | ||
| 283 | |||
| 284 | return false; | ||
| 285 | } | ||
| 286 | |||
| 287 | return true; | ||
| 288 | } | ||
| 289 | |||
| 290 | static string GetDiag(int i) => DialogueManager.GetDialogue("misc", "any", "tradenpc", i); | ||
| 291 | } | ||
| 292 | |||
| 293 | [HarmonyPatch(typeof(MitraFields), "GetInteractionText")] | ||
| 294 | class MitraFieldsTextPatch | ||
| 295 | { | ||
| 296 | static bool Prefix(ref string __result) | ||
| 297 | { | ||
| 298 | if (GlobalState.events.GetEvent("ReceivedBikingShoes") == 1 && GlobalState.events.GetEvent("UsedBikingShoes") == 0) | ||
| 299 | { | ||
| 300 | __result = DialogueManager.GetDialogue("misc", "any", "mitra", 1); | ||
| 301 | |||
| 302 | GlobalState.events.SetEvent("UsedBikingShoes", 1); | ||
| 303 | |||
| 304 | Plugin.ArchipelagoManager.SendLocation("Fields - Mitra Trade"); | ||
| 305 | |||
| 306 | return false; | ||
| 307 | } | ||
| 308 | |||
| 309 | return true; | ||
| 310 | } | ||
| 311 | } | ||
| 312 | |||
| 313 | [HarmonyPatch("AnodyneSharp.Entities.Interactive.Npc.Windmill.Console", "PlayerInteraction")] | ||
| 314 | class WindmillInteractPatch | ||
| 315 | { | ||
| 316 | static void Prefix(object __instance) | ||
| 317 | { | ||
| 318 | if ((__instance as Entity).CurAnimName == "active") | ||
| 319 | { | ||
| 320 | Plugin.ArchipelagoManager.SendLocation("Windmill - Activation"); | ||
| 321 | } | ||
| 322 | } | ||
| 323 | } | ||
| 228 | } | 324 | } |
