diff --git a/Projects/Regiments/Regiments/Patches.cs b/Projects/Regiments/Regiments/Patches.cs index cfac95e..8de7bf8 100644 --- a/Projects/Regiments/Regiments/Patches.cs +++ b/Projects/Regiments/Regiments/Patches.cs @@ -1,167 +1,167 @@ -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.WeaponSystems; -using birdseye.Regiments.Zones; -using HarmonyLib; -using UnityEngine; - -// Patch maxSupPoints in PlatoonSupplyModule -// Patch Operational Authority point gain - -namespace Regiments { - [HarmonyPatch] - public class Patches { - private static float baseHqValue = 0; - private static float baseSupplyValue = 0; - - [HarmonyPrefix] - [HarmonyPatch(typeof(SupplyPointsController), "AddSPs")] - static void SpMultiplier(ref float value) { - if (value == 0) { - return; - } - - float multiplier = Main.SPMultiplier.Value; - // Console.WriteLine("Multiplying SP {0} by {1}", value, multiplier); - value *= multiplier; - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(TacAidPointsController), "AddTP")] - static void TpMultiplier(ref float val) { - if (val == 0) { - return; - } - - float multiplier = Main.TPMultiplier.Value; - // Console.WriteLine("Multiplying TP {0} by {1}", val, multiplier); - val *= multiplier; - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(MapZoneFactory), "MakeRefitZone")] - static void SupplyAoeMultiplier(ref eSides side, ref Vector3 position, ref float size) { - float multiplier = Main.SupplyAOEMultiplier.Value; - Console.WriteLine("Multiplying supply aoe {0} by {1}", size, multiplier); - size *= multiplier; - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(PlatoonHQVisuals), "Start")] - static void HqAoeMultiplier(PlatoonHQVisuals __instance) { - Console.WriteLine("Patching HQ radius - base range {0}", baseHqValue); - if (baseHqValue == 0) { - baseHqValue = __instance.platoon.parameters.HQRadius; - Console.WriteLine("Base range is 0, assigning new: {0}", baseHqValue); - } - - __instance.platoon.parameters.HQRadius = baseHqValue * Main.HQAOEMultiplier.Value; - Console.WriteLine("HQ radius patched to: {0}", __instance.platoon.parameters.HQRadius); - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(PlatoonSupplyModule), "Start")] - static void SupplyAoeMultiplier(PlatoonSupplyModule __instance) { - Console.WriteLine("Patching supply amount - base amount {0}", baseSupplyValue); - if (baseSupplyValue == 0) { - baseSupplyValue = __instance.platoon.parameters.supplyPointsPerUnit; - Console.WriteLine("Base amount is 0, assigning new: {0}", baseSupplyValue); - } - - __instance.platoon.parameters.supplyPointsPerUnit = - (int)(baseSupplyValue * Main.SupplyAmountMultiplier.Value); - Console.WriteLine("Supply amount patched to: {0}", __instance.platoon.parameters.supplyPointsPerUnit); - } - - [HarmonyPostfix] - [HarmonyPatch(typeof(WeaponAttackBase), "GetReloadInterval")] - static void FireRateMultiplier(ref float __result) { - Console.WriteLine("Patching fire rate"); - - __result *= Main.FireRateMultiplier.Value; - Console.WriteLine("Fire rate patched to: {0}", __result); - } - - [HarmonyPostfix] - [HarmonyPatch(typeof(WeaponAttackBase), "GetAimInterval")] - static void AimingIntervalMultiplier(ref float __result) { - Console.WriteLine("Patching aim interval - base amount {0}", baseSupplyValue); - - __result *= Main.AimIntervalMultiplier.Value; - Console.WriteLine("Aim interval patched to: {0}", __result); - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(TimerManager), "GetPersistentTimer")] - static void Transpiler(ref float interval, ref string hint) { - if (hint == "burst") { - Console.WriteLine("Patching burst interval from: {0}", interval); - interval *= Main.FireRateMultiplier.Value; - Console.WriteLine("Burst interval patched to: {0}", interval); - } - } - - [HarmonyPostfix] - [HarmonyPatch(typeof(RefitZone), "OnRefitStep")] - static void SupplyRateMultiplier(ref float hpVal, ref float ammoVal) { - Console.WriteLine("Patching refit step from: {0} {1}", hpVal, ammoVal); - hpVal *= Main.SupplyRateMultiplier.Value; - ammoVal *= Main.SupplyRateMultiplier.Value; - Console.WriteLine("Patching refit step to: {0} {1}", hpVal, ammoVal); - } - - // [HarmonyPatch(typeof(AdvancedRulesData), "Validate")] - // static IEnumerable Transpiler(IEnumerable instructions) { - // var codes = new List(instructions); - // - // foreach (var code in codes) { - // if (code.opcode == OpCodes.Ldc_R4) { - // Console.WriteLine("Changing " + code); - // code.operand = (float)code.operand * 2; - // Console.WriteLine("Changed " + code); - // } - // } - // - // return codes.AsEnumerable(); - // } - - // [HarmonyPatch(typeof(AdvancedRulesData), "IsWithinLimits")] - // static IEnumerable Transpiler2(IEnumerable instructions) { - // var codes = new List(instructions); - // - // foreach (var code in codes) { - // if (code.opcode == OpCodes.Ldc_R4) { - // Console.WriteLine("Changing " + code); - // code.operand = (float)code.operand * 2; - // Console.WriteLine("Changed " + code); - // } - // } - // - // return codes.AsEnumerable(); - // } - - // private static float baseAccuracy; - // - // [HarmonyPostfix] - // [HarmonyPatch(typeof(SkirmishAdvancedRules), "Update")] - // static void AccuracyPatch(SkirmishAdvancedRules __instance) { - // var accMod = Traverse.Create(__instance).Field("currentARD").Field("accuracyModifier"); - // if (baseAccuracy == 0) { - // baseAccuracy = (float)accMod.GetValue(); - // Console.WriteLine("Base accuracy set to {0}", baseAccuracy); - // } - // - // accMod.SetValue(baseAccuracy * 4f); - // Console.WriteLine("Accuracy now: {0}", accMod.GetValue()); - // } - } -} +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.WeaponSystems; +using birdseye.Regiments.Zones; +using HarmonyLib; +using UnityEngine; + +// Patch maxSupPoints in PlatoonSupplyModule +// Patch Operational Authority point gain + +namespace Regiments { + [HarmonyPatch] + public class Patches { + private static float baseHqValue = 0; + private static float baseSupplyValue = 0; + + [HarmonyPrefix] + [HarmonyPatch(typeof(SupplyPointsController), "AddSPs")] + static void SpMultiplier(ref float value) { + if (value == 0) { + return; + } + + float multiplier = Main.SPMultiplier.Value; + // Console.WriteLine("Multiplying SP {0} by {1}", value, multiplier); + value *= multiplier; + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(TacAidPointsController), "AddTP")] + static void TpMultiplier(ref float val) { + if (val == 0) { + return; + } + + float multiplier = Main.TPMultiplier.Value; + // Console.WriteLine("Multiplying TP {0} by {1}", val, multiplier); + val *= multiplier; + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(MapZoneFactory), "MakeRefitZone")] + static void SupplyAoeMultiplier(ref eSides side, ref Vector3 position, ref float size) { + float multiplier = Main.SupplyAOEMultiplier.Value; + Console.WriteLine("Multiplying supply aoe {0} by {1}", size, multiplier); + size *= multiplier; + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(PlatoonHQVisuals), "Start")] + static void HqAoeMultiplier(PlatoonHQVisuals __instance) { + Console.WriteLine("Patching HQ radius - base range {0}", baseHqValue); + if (baseHqValue == 0) { + baseHqValue = __instance.platoon.parameters.HQRadius; + Console.WriteLine("Base range is 0, assigning new: {0}", baseHqValue); + } + + __instance.platoon.parameters.HQRadius = baseHqValue * Main.HQAOEMultiplier.Value; + Console.WriteLine("HQ radius patched to: {0}", __instance.platoon.parameters.HQRadius); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(PlatoonSupplyModule), "Start")] + static void SupplyAoeMultiplier(PlatoonSupplyModule __instance) { + Console.WriteLine("Patching supply amount - base amount {0}", baseSupplyValue); + if (baseSupplyValue == 0) { + baseSupplyValue = __instance.platoon.parameters.supplyPointsPerUnit; + Console.WriteLine("Base amount is 0, assigning new: {0}", baseSupplyValue); + } + + __instance.platoon.parameters.supplyPointsPerUnit = + (int)(baseSupplyValue * Main.SupplyAmountMultiplier.Value); + Console.WriteLine("Supply amount patched to: {0}", __instance.platoon.parameters.supplyPointsPerUnit); + } + + [HarmonyPostfix] + [HarmonyPatch(typeof(WeaponAttackBase), "GetReloadInterval")] + static void FireRateMultiplier(ref float __result) { + Console.WriteLine("Patching fire rate"); + + __result *= Main.FireRateMultiplier.Value; + Console.WriteLine("Fire rate patched to: {0}", __result); + } + + [HarmonyPostfix] + [HarmonyPatch(typeof(WeaponAttackBase), "GetAimInterval")] + static void AimingIntervalMultiplier(ref float __result) { + Console.WriteLine("Patching aim interval - base amount {0}", baseSupplyValue); + + __result *= Main.AimIntervalMultiplier.Value; + Console.WriteLine("Aim interval patched to: {0}", __result); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(TimerManager), "GetPersistentTimer")] + static void Transpiler(ref float interval, ref string hint) { + if (hint == "burst") { + Console.WriteLine("Patching burst interval from: {0}", interval); + interval *= Main.FireRateMultiplier.Value; + Console.WriteLine("Burst interval patched to: {0}", interval); + } + } + + [HarmonyPostfix] + [HarmonyPatch(typeof(RefitZone), "OnRefitStep")] + static void SupplyRateMultiplier(ref float hpVal, ref float ammoVal) { + Console.WriteLine("Patching refit step from: {0} {1}", hpVal, ammoVal); + hpVal *= Main.SupplyRateMultiplier.Value; + ammoVal *= Main.SupplyRateMultiplier.Value; + Console.WriteLine("Patching refit step to: {0} {1}", hpVal, ammoVal); + } + + // [HarmonyPatch(typeof(AdvancedRulesData), "Validate")] + // static IEnumerable Transpiler(IEnumerable instructions) { + // var codes = new List(instructions); + // + // foreach (var code in codes) { + // if (code.opcode == OpCodes.Ldc_R4) { + // Console.WriteLine("Changing " + code); + // code.operand = (float)code.operand * 2; + // Console.WriteLine("Changed " + code); + // } + // } + // + // return codes.AsEnumerable(); + // } + + // [HarmonyPatch(typeof(AdvancedRulesData), "IsWithinLimits")] + // static IEnumerable Transpiler2(IEnumerable instructions) { + // var codes = new List(instructions); + // + // foreach (var code in codes) { + // if (code.opcode == OpCodes.Ldc_R4) { + // Console.WriteLine("Changing " + code); + // code.operand = (float)code.operand * 2; + // Console.WriteLine("Changed " + code); + // } + // } + // + // return codes.AsEnumerable(); + // } + + // private static float baseAccuracy; + // + // [HarmonyPostfix] + // [HarmonyPatch(typeof(SkirmishAdvancedRules), "Update")] + // static void AccuracyPatch(SkirmishAdvancedRules __instance) { + // var accMod = Traverse.Create(__instance).Field("currentARD").Field("accuracyModifier"); + // if (baseAccuracy == 0) { + // baseAccuracy = (float)accMod.GetValue(); + // Console.WriteLine("Base accuracy set to {0}", baseAccuracy); + // } + // + // accMod.SetValue(baseAccuracy * 4f); + // Console.WriteLine("Accuracy now: {0}", accMod.GetValue()); + // } + } +} diff --git a/Projects/Regiments/Regiments/Regiments.csproj b/Projects/Regiments/Regiments/Regiments.csproj index 4b89eb4..083cbda 100644 --- a/Projects/Regiments/Regiments/Regiments.csproj +++ b/Projects/Regiments/Regiments/Regiments.csproj @@ -1,76 +1,76 @@ - - - - - Debug - AnyCPU - {DA9D274E-486F-4F82-84FF-CD9388CB0B09} - Library - Properties - Regiments - Regiments - v4.8.1 - 512 - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - libs\0Harmony.dll - - - libs\Assembly-CSharp.dll - - - libs\BepInEx.dll - - - libs\ConfigurationManager.dll - - - libs\MainAssembly.dll - - - - - - - libs\UnityEngine.dll - - - libs\UnityEngine.CoreModule.dll - - - - - - - - - - - - + + + + + Debug + AnyCPU + {DA9D274E-486F-4F82-84FF-CD9388CB0B09} + Library + Properties + Regiments + Regiments + v4.8.1 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + C:\Program Files (x86)\Steam\steamapps\common\Regiments\BepInEx\core\0Harmony.dll + + + C:\Program Files (x86)\Steam\steamapps\common\Regiments\Regiments_Data\Managed\Assembly-CSharp.dll + + + C:\Program Files (x86)\Steam\steamapps\common\Regiments\BepInEx\core\BepInEx.dll + + + C:\Program Files (x86)\Steam\steamapps\common\Regiments\BepInEx\plugins\ConfigurationManager\ConfigurationManager.dll + + + C:\Program Files (x86)\Steam\steamapps\common\Regiments\Regiments_Data\Managed\MainAssembly.dll + + + + + + + C:\Program Files (x86)\Steam\steamapps\common\Regiments\Regiments_Data\Managed\UnityEngine.dll + + + C:\Program Files (x86)\Steam\steamapps\common\Regiments\Regiments_Data\Managed\UnityEngine.CoreModule.dll + + + + + + + + + + + + diff --git a/Projects/Regiments/Regiments/obj/Debug/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs b/Projects/Regiments/Regiments/obj/Debug/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs index 0af6d86..0851892 100644 --- a/Projects/Regiments/Regiments/obj/Debug/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs +++ b/Projects/Regiments/Regiments/obj/Debug/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs @@ -1,4 +1,4 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] diff --git a/Projects/Regiments/Regiments/obj/Debug/Regiments.csproj.AssemblyReference.cache b/Projects/Regiments/Regiments/obj/Debug/Regiments.csproj.AssemblyReference.cache index 30db482..c22973a 100644 Binary files a/Projects/Regiments/Regiments/obj/Debug/Regiments.csproj.AssemblyReference.cache and b/Projects/Regiments/Regiments/obj/Debug/Regiments.csproj.AssemblyReference.cache differ