Work towards implementation of Configuration and 1.1.0 Release.
This commit is contained in:
parent
9d01c5753e
commit
2c890ca7bb
@ -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
|
||||
{
|
||||
|
Binary file not shown.
109
ValensHasThePower/PowerOn.cs~RF1b442bb4.TMP
Normal file
109
ValensHasThePower/PowerOn.cs~RF1b442bb4.TMP
Normal file
@ -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<int> configCustoms;
|
||||
public static ConfigEntry<int> configInterchange;
|
||||
public static ConfigEntry<int> 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<Switch> PowerSwitches = Object.FindObjectsOfType<Switch>().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]);
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -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"
|
Loading…
x
Reference in New Issue
Block a user