diff --git a/ValensHasThePower/Patches.cs b/ValensHasThePower/Patches.cs index 63ac755..2be8200 100644 --- a/ValensHasThePower/Patches.cs +++ b/ValensHasThePower/Patches.cs @@ -1,7 +1,7 @@ -using System.Reflection; -using Aki.Reflection.Patching; +using Aki.Reflection.Patching; using Aki.Reflection.Utils; using EFT; +using System.Reflection; namespace ValensHasThePower { diff --git a/ValensHasThePower/PowerOn.cs b/ValensHasThePower/PowerOn.cs index 56aa952..837979b 100644 Binary files a/ValensHasThePower/PowerOn.cs and b/ValensHasThePower/PowerOn.cs differ diff --git a/ValensHasThePower/PowerOn.cs~RF1b442bb4.TMP b/ValensHasThePower/PowerOn.cs~RF1b442bb4.TMP new file mode 100644 index 0000000..a9e9490 --- /dev/null +++ b/ValensHasThePower/PowerOn.cs~RF1b442bb4.TMP @@ -0,0 +1,109 @@ +using BepInEx; +using BepInEx.Configuration; +using EFT.Interactive; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using UnityEngine; + +namespace ValensHasThePower +{ + [BepInPlugin("com.Valens.HasThePower", "ValensHasThePower", "1.1.0")] + public class Plugin : BaseUnityPlugin + { + public static ConfigEntry configCustoms; + public static ConfigEntry configInterchange; + public static ConfigEntry configReserve; + + private void Awake() + { + /* Example Config + configGreeting = Config.Bind("General", // The section under which the option is shown + "GreetingText", // The key of the configuration option in the configuration file + "Hello, world!", // The default value + "A greeting text to show when the game is launched"); // Description of the option to show in the config file*/ + + configCustoms = Config.Bind("General.Toggles", + "Customs Power On Chance", + 100, + "Percentage Chance that Power will be On at Raid Start for the Customs Map. Default is 100."); + + configInterchange = Config.Bind("General.Toggles", + "Interchange Power On Chance", + 100, + "Percentage Chance that Power will be On at Raid Start for the Interchange Map. Default is 100."); + + configReserve = Config.Bind("General.Toggles", + "Reserve Power On Chance", + 100, + "Percentage Chance that Power will be On at Raid Start for the Reserve Map. Default is 100."); + + Logger.LogInfo($"Valens...has the POWER!!!"); + new PatchThePower().Enable(); + } + } + + public static class PowerOn + { + + public static void Start() + { + List PowerSwitches = Object.FindObjectsOfType().ToList(); + + foreach (var switcher in PowerSwitches) + { + // Customs Power Switch + if (switcher.Id == "custom_DesignStuff_00034" && switcher.name == "reserve_electric_switcher_lever") + { + System.Random chance = new System.Random(); + var percent = chance.Next(0, 100); + if (percent <= Plugin.configCustoms.Value) + { + PowerSwitch(switcher); + } + } + + // Interchange Power Station + if (switcher.Id == "Shopping_Mall_DesignStuff_00055" && switcher.name == "reserve_electric_switcher_lever") + { + System.Random chance = new System.Random(); + var percent = chance.Next(0, 100); + if (percent <= Plugin.configCustoms.Value) + { + PowerSwitch(switcher); + } + } + + // Interchange Secret Container + if (switcher.Id == "Shopping_Mall_DesignStuff_00061" && switcher.Id == "reserve_electric_switcher_lever") + { + System.Random chance = new System.Random(); + var percent = chance.Next(0, 100); + if (percent <= Plugin.configCustoms.Value) + { + PowerSwitch(switcher); + } + } + + // Reserve D2 Switch + if (switcher.Id == "autoId_00000_D2_LEVER" && switcher.name == "reserve_electric_switcher_lever") + { + System.Random chance = new System.Random(); + var percent = chance.Next(0, 100); + if (percent <= Plugin.configCustoms.Value) + { + PowerSwitch(switcher); + } + } + } + } + + private static void PowerSwitch(Switch switcher) + { + switcher.GetType().GetMethod("Open", BindingFlags.NonPublic | BindingFlags.Instance) + .Invoke(switcher, new object[0]); + } + } +} \ No newline at end of file diff --git a/ValensHasThePower/ValensHasThePower-1.0.1/BepInEx/plugins/ValensHasThePower.dll b/ValensHasThePower/ValensHasThePower-1.0.1/BepInEx/plugins/ValensHasThePower.dll deleted file mode 100644 index 376a0ea..0000000 Binary files a/ValensHasThePower/ValensHasThePower-1.0.1/BepInEx/plugins/ValensHasThePower.dll and /dev/null differ diff --git a/ValensHasThePower/ValensHasThePower-1.1.0/BepInEx/plugins/ValensHasThePower.dll b/ValensHasThePower/ValensHasThePower-1.1.0/BepInEx/plugins/ValensHasThePower.dll new file mode 100644 index 0000000..35598f3 Binary files /dev/null and b/ValensHasThePower/ValensHasThePower-1.1.0/BepInEx/plugins/ValensHasThePower.dll differ diff --git a/ValensHasThePower/ValensHasThePower-1.0.1/user/mods/ValensHasThePower-1.0.0/LICENSE.txt b/ValensHasThePower/ValensHasThePower-1.1.0/user/mods/ValensHasThePower-1.1.0/LICENSE.txt similarity index 100% rename from ValensHasThePower/ValensHasThePower-1.0.1/user/mods/ValensHasThePower-1.0.0/LICENSE.txt rename to ValensHasThePower/ValensHasThePower-1.1.0/user/mods/ValensHasThePower-1.1.0/LICENSE.txt diff --git a/ValensHasThePower/ValensHasThePower-1.0.1/user/mods/ValensHasThePower-1.0.0/README.md b/ValensHasThePower/ValensHasThePower-1.1.0/user/mods/ValensHasThePower-1.1.0/README.md similarity index 100% rename from ValensHasThePower/ValensHasThePower-1.0.1/user/mods/ValensHasThePower-1.0.0/README.md rename to ValensHasThePower/ValensHasThePower-1.1.0/user/mods/ValensHasThePower-1.1.0/README.md diff --git a/ValensHasThePower/ValensHasThePower-1.0.1/user/mods/ValensHasThePower-1.0.0/package.js b/ValensHasThePower/ValensHasThePower-1.1.0/user/mods/ValensHasThePower-1.1.0/package.js similarity index 100% rename from ValensHasThePower/ValensHasThePower-1.0.1/user/mods/ValensHasThePower-1.0.0/package.js rename to ValensHasThePower/ValensHasThePower-1.1.0/user/mods/ValensHasThePower-1.1.0/package.js diff --git a/ValensHasThePower/ValensHasThePower-1.0.1/user/mods/ValensHasThePower-1.0.0/package.json b/ValensHasThePower/ValensHasThePower-1.1.0/user/mods/ValensHasThePower-1.1.0/package.json similarity index 86% rename from ValensHasThePower/ValensHasThePower-1.0.1/user/mods/ValensHasThePower-1.0.0/package.json rename to ValensHasThePower/ValensHasThePower-1.1.0/user/mods/ValensHasThePower-1.1.0/package.json index ad90ac4..7ba621b 100644 --- a/ValensHasThePower/ValensHasThePower-1.0.1/user/mods/ValensHasThePower-1.0.0/package.json +++ b/ValensHasThePower/ValensHasThePower-1.1.0/user/mods/ValensHasThePower-1.1.0/package.json @@ -1,7 +1,7 @@ { "name": "Valens Has The Power", "author": "Valens", - "version": "1.0.1", + "version": "1.1.0", "license": "CC BY-NC-SA 4.0", "main": "package.js", "akiVersion": "2.3.1"