using BepInEx; using BepInEx.Configuration; using EFT.Interactive; using System.Collections.Generic; using System.Linq; using UnityEngine; namespace ValensHasThePower { [BepInPlugin("com.Valens.HasThePower", "ValensHasThePower", "1.3.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.Maps", "Customs", 100, "Percentage Chance that Power will be On at Raid Start for the Customs Map." + "Default is 100."); configInterchange = Config.Bind("General.Maps", "Interchange", 100, "Percentage Chance that Power will be On at Raid Start for the Interchange Map." + "Default is 100."); configReserve = Config.Bind("General.Maps", "Reserve", 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 class PowerOn : MonoBehaviour { public void Start() { List PowerSwitches = FindObjectsOfType().ToList(); foreach (var switcher in PowerSwitches) { // Customs Power Switch if (switcher.Id == "custom_DesignStuff_00034" && switcher.name == "reserve_electric_switcher_lever") { int percent = RandomGen(); if (percent <= Plugin.configCustoms.Value) { PowerSwitch(switcher); } } // Interchange Power Station if (switcher.Id == "Shopping_Mall_DesignStuff_00055" && switcher.name == "reserve_electric_switcher_lever") { int percent = RandomGen(); if (percent <= Plugin.configInterchange.Value) { PowerSwitch(switcher); } } // Reserve D2 Switch if (switcher.Id == "autoId_00000_D2_LEVER" && switcher.name == "reserve_electric_switcher_lever") { int percent = RandomGen(); if (percent <= Plugin.configReserve.Value) { PowerSwitch(switcher); } } } } private static int RandomGen() { System.Random chance = new System.Random(); int percent = chance.Next(1, 99); return percent; } private static void PowerSwitch(Switch switcher) { switcher.Open(); } } }