diff --git a/Projects/Regiments/Regiments/Class1.cs b/Projects/Regiments/Regiments/Class1.cs index ca8b6e4..daf4116 100644 --- a/Projects/Regiments/Regiments/Class1.cs +++ b/Projects/Regiments/Regiments/Class1.cs @@ -1,96 +1,53 @@ -using System.Linq; -using BepInEx; -using BepInEx.Configuration; -using HarmonyLib; -using HarmonyLib.Tools; - -namespace Regiments { - [BepInPlugin(pluginGuid, pluginName, pluginVersion)] - public class Main : BaseUnityPlugin { - private const string pluginGuid = "CykaMod"; - private const string pluginName = "CykaMod"; - private const string pluginVersion = "1.0.0"; - - public static ConfigEntry SPMultiplier; - public static ConfigEntry TPMultiplier; - public static ConfigEntry SupplyAOEMultiplier; - public static ConfigEntry HQAOEMultiplier; - public static ConfigEntry SupplyAmountMultiplier; - public static ConfigEntry FireRateMultiplier; - public static ConfigEntry AimIntervalMultiplier; - public static ConfigEntry SupplyRateMultiplier; - // public static ConfigEntry magnetRadiusMultiplier; - // public static ConfigEntry beamStrenghtMultiplier; - // public static ConfigEntry beamRadiusMultiplier; - // public static ConfigEntry fuelTankRefillMultiplier; - // public static ConfigEntry fuelTankCapacityMultiplier; - // public static ConfigEntry minerGroundArea; - // public static ConfigEntry minerMiningSpeed; - // public static ConfigEntry wheelTorqueMultiplier; - // public static ConfigEntry wheelSpeedMultiplier; - // public static ConfigEntry jetThrustMultiplier; - - public void Awake() { - SPMultiplier = Config.Bind("General", "SP Multiplier", 1f, - new ConfigDescription("SP Multiplier", new AcceptableValueRange(1f, 32f))); - TPMultiplier = Config.Bind("General", "TP Multiplier", 1f, - new ConfigDescription("TP Multiplier", new AcceptableValueRange(1f, 32f))); - SupplyAOEMultiplier = Config.Bind("General", "Supply AOE Multiplier", 1f, - new ConfigDescription("Supply AOE Multiplier", new AcceptableValueRange(1f, 32f))); - SupplyAmountMultiplier = Config.Bind("General", "Supply Point Amount Multiplier", 1f, - new ConfigDescription("Supply Point Amount Multiplier", new AcceptableValueRange(1f, 32f))); - SupplyRateMultiplier = Config.Bind("General", "The rate at which HP and ammo is resupplied", 1f, - new ConfigDescription("The rate at which HP and ammo is resupplied", new AcceptableValueRange(1f, 16f))); - HQAOEMultiplier = Config.Bind("General", "HQ AOE Multiplier", 1f, - new ConfigDescription("HQ AOE Multiplier", new AcceptableValueRange(1f, 32f))); - FireRateMultiplier = Config.Bind("General", "Fire Rate Multiplier", 1f, - new ConfigDescription("Fire Rate Multiplier", - new AcceptableValueRange(0.1f, 32f))); - AimIntervalMultiplier = Config.Bind("General", "Aiming Interval Multiplier", 1f, - new ConfigDescription("Aiming Interval Multiplier", new AcceptableValueRange(0.1f, 32f))); - // beamStrenghtMultiplier = Config.Bind("Attractors", "Beam Strength Multiplier", 1f, - // new ConfigDescription("Beam Strength Multiplier", new AcceptableValueRange(1f, 16f))); - // beamRadiusMultiplier = Config.Bind("Attractors", "Beam Radius Multiplier", 1f, - // new ConfigDescription("Beam Radius Multiplier", new AcceptableValueRange(1f, 16f))); - // - // fuelTankRefillMultiplier = Config.Bind("Propulsion", "Fuel Tank Refill Rate Multiplier", 1f, - // new ConfigDescription("Fuel Tank Refill Rate Multiplier", new AcceptableValueRange(1f, 32f))); - // fuelTankCapacityMultiplier = Config.Bind("Propulsion", "Fuel Tank Capacity Multiplier", 1f, - // new ConfigDescription("Fuel Tank Capacity Multiplier", new AcceptableValueRange(1f, 32f))); - // wheelTorqueMultiplier = Config.Bind("Propulsion", "Wheel Torque Multiplier", 1f, - // new ConfigDescription("Wheel Torque Multiplier", new AcceptableValueRange(1f, 32f))); - // wheelSpeedMultiplier = Config.Bind("Propulsion", "Wheel Max RPM Multiplier", 1f, - // new ConfigDescription("Wheel Max RPM Multiplier", new AcceptableValueRange(1f, 32f))); - // jetThrustMultiplier = Config.Bind("Propulsion", "Jet Thrust Multiplier", 1f, - // new ConfigDescription("Jet Thrust Multiplier", new AcceptableValueRange(1f, 32f))); - // - // minerGroundArea = Config.Bind("Production", "Miner Ground Deposit Scan Area", 1f, - // new ConfigDescription("Miner Ground Deposit Scan Area", new AcceptableValueRange(1f, 32f))); - // minerMiningSpeed = Config.Bind("Production", "Miner Mining Speed", 1f, - // new ConfigDescription("Miner Mining Speed", new AcceptableValueRange(1f, 32f))); - // - // allProjectilesHoming = Config.Bind("General", "Make All Projectiles Home", false); - - // shootingSpeedMultiplier.SettingChanged += (sender, args) => WeaponPropertiesManager.DoPatch(); - // energyGenMultiplier.SettingChanged += (sender, args) => GeneratorPropertiesManager.DoPatch(); - // magnetStrenghtMultiplier.SettingChanged += (sender, args) => MagnetPropertiesManager.DoPatch(); - // magnetRadiusMultiplier.SettingChanged += (sender, args) => MagnetPropertiesManager.DoPatch(); - // beamStrenghtMultiplier.SettingChanged += (sender, args) => BeamPropertiesManager.DoPatch(); - // beamRadiusMultiplier.SettingChanged += (sender, args) => BeamPropertiesManager.DoPatch(); - // fuelTankRefillMultiplier.SettingChanged += (sender, args) => FuelPropertiesManager.DoPatch(); - // fuelTankCapacityMultiplier.SettingChanged += (sender, args) => FuelPropertiesManager.DoPatch(); - // wheelTorqueMultiplier.SettingChanged += (sender, args) => WheelPropertiesManager.DoPatch(); - // wheelSpeedMultiplier.SettingChanged += (sender, args) => WheelPropertiesManager.DoPatch(); - // jetThrustMultiplier.SettingChanged += (sender, args) => ThrusterPropertiesManager.DoPatch(); - // minerGroundArea.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch(); - // minerMiningSpeed.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch(); - - Logger.LogInfo("Cyka mod loaded"); - HarmonyFileLog.Enabled = true; - Harmony harmony = new Harmony(pluginGuid); - harmony.PatchAll(); - var originalMethods = harmony.GetPatchedMethods(); - Logger.LogInfo("Patched " + originalMethods.Count() + " methods"); - } - } -} +using System.Linq; +using BepInEx; +using BepInEx.Configuration; +using HarmonyLib; +using HarmonyLib.Tools; + +namespace Regiments { + [BepInPlugin(pluginGuid, pluginName, pluginVersion)] + public class Main : BaseUnityPlugin { + private const string pluginGuid = "CykaMod"; + private const string pluginName = "CykaMod"; + private const string pluginVersion = "1.0.0"; + + public static ConfigEntry SPMultiplier; + public static ConfigEntry TPMultiplier; + public static ConfigEntry SupplyAOEMultiplier; + public static ConfigEntry HQAOEMultiplier; + public static ConfigEntry SupplyAmountMultiplier; + public static ConfigEntry FireRateMultiplier; + public static ConfigEntry AimIntervalMultiplier; + public static ConfigEntry SupplyRateMultiplier; + public static ConfigEntry MovementSpeedMultiplier; + + public void Awake() { + SPMultiplier = Config.Bind("General", "SP Multiplier", 1f, + new ConfigDescription("SP Multiplier", new AcceptableValueRange(1f, 32f))); + TPMultiplier = Config.Bind("General", "TP Multiplier", 1f, + new ConfigDescription("TP Multiplier", new AcceptableValueRange(1f, 32f))); + SupplyAOEMultiplier = Config.Bind("General", "Supply AOE Multiplier", 1f, + new ConfigDescription("Supply AOE Multiplier", new AcceptableValueRange(1f, 32f))); + SupplyAmountMultiplier = Config.Bind("General", "Supply Point Amount Multiplier", 1f, + new ConfigDescription("Supply Point Amount Multiplier", new AcceptableValueRange(1f, 32f))); + SupplyRateMultiplier = Config.Bind("General", "The rate at which HP and ammo is resupplied", 1f, + new ConfigDescription("The rate at which HP and ammo is resupplied", new AcceptableValueRange(1f, 16f))); + HQAOEMultiplier = Config.Bind("General", "HQ AOE Multiplier", 1f, + new ConfigDescription("HQ AOE Multiplier", new AcceptableValueRange(1f, 32f))); + FireRateMultiplier = Config.Bind("General", "Fire Rate Multiplier", 1f, + new ConfigDescription("Fire Rate Multiplier", + new AcceptableValueRange(0.1f, 32f))); + AimIntervalMultiplier = Config.Bind("General", "Aiming Interval Multiplier", 1f, + new ConfigDescription("Aiming Interval Multiplier", new AcceptableValueRange(0.1f, 32f))); + MovementSpeedMultiplier = Config.Bind("General", "Movement Speed Multiplier", 1f, + new ConfigDescription("Movement Speed Multiplier", new AcceptableValueRange(0.1f, 32f))); + + Logger.LogInfo("Cyka mod loaded"); + HarmonyFileLog.Enabled = true; + Harmony harmony = new Harmony(pluginGuid); + harmony.PatchAll(); + var originalMethods = harmony.GetPatchedMethods(); + Logger.LogInfo("Patched " + originalMethods.Count() + " methods"); + } + } +} diff --git a/Projects/Regiments/Regiments/Patches.cs b/Projects/Regiments/Regiments/Patches.cs index 930baba..1b583b8 100644 --- a/Projects/Regiments/Regiments/Patches.cs +++ b/Projects/Regiments/Regiments/Patches.cs @@ -1,22 +1,14 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection.Emit; using birdseye; using birdseye.Regiments; using birdseye.Regiments.Commanders; -using birdseye.Regiments.GameModes; -using birdseye.Regiments.Menu.GUI; -using birdseye.Regiments.Platoons; using birdseye.Regiments.Platoons.Modules; +using birdseye.Regiments.Units.Rigging; using birdseye.Regiments.Units.WeaponSystems; using birdseye.Regiments.Zones; using HarmonyLib; using UnityEngine; -// Patch maxSupPoints in PlatoonSupplyModule -// Patch Operational Authority point gain - namespace Regiments { [HarmonyPatch] public class Patches { @@ -120,6 +112,12 @@ namespace Regiments { Console.WriteLine("Patching refit step to: {0} {1}", hpVal, ammoVal); } + [HarmonyPostfix] + [HarmonyPatch(typeof(UnitMovementRig), nameof(UnitMovementRig.maxSpeed), MethodType.Getter)] + static void MovementSpeedMultiplier(ref float __result) { + __result *= Main.MovementSpeedMultiplier.Value; + } + // [HarmonyPatch(typeof(AdvancedRulesData), "Validate")] // static IEnumerable Transpiler(IEnumerable instructions) { // var codes = new List(instructions);