diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-23 08:45:59 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-05-23 08:45:59 -0400 |
| commit | c35f790350e8494677bcf200438561c3099c9c4a (patch) | |
| tree | a6ffdf7e39bbb7c2716667a2d74a70d65bc0d938 /AnodyneArchipelago | |
| parent | 6ef358e1a1cddd853ff0245bb27669cdcc049dc6 (diff) | |
| download | anodyne-archipelago-c35f790350e8494677bcf200438561c3099c9c4a.tar.gz anodyne-archipelago-c35f790350e8494677bcf200438561c3099c9c4a.tar.bz2 anodyne-archipelago-c35f790350e8494677bcf200438561c3099c9c4a.zip | |
Added Card item
Diffstat (limited to 'AnodyneArchipelago')
| -rw-r--r-- | AnodyneArchipelago/ArchipelagoManager.cs | 7 | ||||
| -rw-r--r-- | AnodyneArchipelago/Plugin.cs | 10 |
2 files changed, 15 insertions, 2 deletions
| diff --git a/AnodyneArchipelago/ArchipelagoManager.cs b/AnodyneArchipelago/ArchipelagoManager.cs index 781a335..a882cd8 100644 --- a/AnodyneArchipelago/ArchipelagoManager.cs +++ b/AnodyneArchipelago/ArchipelagoManager.cs | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | using AnodyneSharp.Entities; | 1 | using AnodyneSharp.Entities; |
| 2 | using AnodyneSharp.Entities.Enemy.Redcave; | 2 | using AnodyneSharp.Entities.Enemy.Redcave; |
| 3 | using AnodyneSharp.Entities.Gadget.Treasures; | ||
| 3 | using AnodyneSharp.Registry; | 4 | using AnodyneSharp.Registry; |
| 4 | using AnodyneSharp.Sounds; | 5 | using AnodyneSharp.Sounds; |
| 5 | using Archipelago.MultiClient.Net; | 6 | using Archipelago.MultiClient.Net; |
| @@ -189,6 +190,12 @@ namespace AnodyneArchipelago | |||
| 189 | { | 190 | { |
| 190 | GlobalState.events.IncEvent("ProgressiveRedGrotto"); | 191 | GlobalState.events.IncEvent("ProgressiveRedGrotto"); |
| 191 | } | 192 | } |
| 193 | else if (itemName == "Card") | ||
| 194 | { | ||
| 195 | CardTreasure cardTreasure = new(Plugin.Player.Position, GlobalState.inventory.CardCount); | ||
| 196 | cardTreasure.GetTreasure(); | ||
| 197 | GlobalState.SpawnEntity(cardTreasure); | ||
| 198 | } | ||
| 192 | 199 | ||
| 193 | string message; | 200 | string message; |
| 194 | if (item.Player == _session.ConnectionInfo.Slot) | 201 | if (item.Player == _session.ConnectionInfo.Slot) |
| diff --git a/AnodyneArchipelago/Plugin.cs b/AnodyneArchipelago/Plugin.cs index 24345fc..26f1274 100644 --- a/AnodyneArchipelago/Plugin.cs +++ b/AnodyneArchipelago/Plugin.cs | |||
| @@ -6,6 +6,7 @@ using AnodyneSharp.Entities.Gadget; | |||
| 6 | using AnodyneSharp.Entities.Gadget.Treasures; | 6 | using AnodyneSharp.Entities.Gadget.Treasures; |
| 7 | using AnodyneSharp.Entities.Interactive; | 7 | using AnodyneSharp.Entities.Interactive; |
| 8 | using AnodyneSharp.Registry; | 8 | using AnodyneSharp.Registry; |
| 9 | using AnodyneSharp.States; | ||
| 9 | using AnodyneSharp.Utilities; | 10 | using AnodyneSharp.Utilities; |
| 10 | using BepInEx; | 11 | using BepInEx; |
| 11 | using BepInEx.NET.Common; | 12 | using BepInEx.NET.Common; |
| @@ -23,6 +24,7 @@ namespace AnodyneArchipelago | |||
| 23 | public class Plugin : BasePlugin | 24 | public class Plugin : BasePlugin |
| 24 | { | 25 | { |
| 25 | public static Plugin Instance = null; | 26 | public static Plugin Instance = null; |
| 27 | public static Player Player = null; | ||
| 26 | 28 | ||
| 27 | public override void Load() | 29 | public override void Load() |
| 28 | { | 30 | { |
| @@ -48,11 +50,15 @@ namespace AnodyneArchipelago | |||
| 48 | } | 50 | } |
| 49 | } | 51 | } |
| 50 | 52 | ||
| 51 | [HarmonyPatch(typeof(AnodyneSharp.States.PlayState), nameof(AnodyneSharp.States.PlayState.Create))] | 53 | [HarmonyPatch(typeof(PlayState), nameof(PlayState.Create))] |
| 52 | class PlayStateCreatePatch | 54 | class PlayStateCreatePatch |
| 53 | { | 55 | { |
| 54 | static void Prefix() | 56 | static void Prefix(PlayState __instance) |
| 55 | { | 57 | { |
| 58 | // Get player for later access. | ||
| 59 | FieldInfo playerField = typeof(PlayState).GetField("_player", BindingFlags.NonPublic | BindingFlags.Instance); | ||
| 60 | Plugin.Player = (Player)playerField.GetValue(__instance); | ||
| 61 | |||
| 56 | // Handle Red Grotto stuff. | 62 | // Handle Red Grotto stuff. |
| 57 | GlobalState.events.SetEvent("red_cave_l_ss", 999); | 63 | GlobalState.events.SetEvent("red_cave_l_ss", 999); |
| 58 | GlobalState.events.SetEvent("red_cave_n_ss", 999); | 64 | GlobalState.events.SetEvent("red_cave_n_ss", 999); |
