From 26a4e88101616fcd14d08a9f3c91b17ed1260f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Majdand=C5=BEi=C4=87?= Date: Wed, 17 Apr 2024 13:24:26 +0200 Subject: [PATCH] Add regiments mods --- Projects/Regiments/Regiments.sln | 16 + .../Regiments/Regiments.sln.DotSettings.user | 14 + Projects/Regiments/Regiments/Class1.cs | 96 ++++++ Projects/Regiments/Regiments/Patches.cs | 185 ++++++++++-- .../Regiments/Properties/AssemblyInfo.cs | 35 +++ Projects/Regiments/Regiments/Regiments.csproj | 76 +++++ Projects/Regiments/Regiments/Transpiler.cs | 279 +++++++++++++++++- ...amework,Version=v4.0.AssemblyAttributes.cs | 4 + ...ework,Version=v4.8.1.AssemblyAttributes.cs | 4 + .../Regiments.csproj.AssemblyReference.cache | Bin 0 -> 14694 bytes .../obj/Debug/Regiments.csproj.CopyComplete | 0 .../Regiments.csproj.CoreCompileInputs.cache | 1 + .../Regiments.csproj.FileListAbsolute.txt | 26 ++ ...ework,Version=v4.8.1.AssemblyAttributes.cs | 4 + .../Regiments.csproj.AssemblyReference.cache | Bin 0 -> 15813 bytes .../obj/Release/Regiments.csproj.CopyComplete | 0 .../Regiments.csproj.CoreCompileInputs.cache | 1 + .../Regiments.csproj.FileListAbsolute.txt | 14 + Projects/Regiments/deploy.sh | 1 + 19 files changed, 730 insertions(+), 26 deletions(-) create mode 100644 Projects/Regiments/Regiments.sln create mode 100644 Projects/Regiments/Regiments.sln.DotSettings.user create mode 100644 Projects/Regiments/Regiments/Class1.cs create mode 100644 Projects/Regiments/Regiments/Properties/AssemblyInfo.cs create mode 100644 Projects/Regiments/Regiments/Regiments.csproj create mode 100644 Projects/Regiments/Regiments/obj/Debug/.NETFramework,Version=v4.0.AssemblyAttributes.cs create mode 100644 Projects/Regiments/Regiments/obj/Debug/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs create mode 100644 Projects/Regiments/Regiments/obj/Debug/Regiments.csproj.AssemblyReference.cache create mode 100644 Projects/Regiments/Regiments/obj/Debug/Regiments.csproj.CopyComplete create mode 100644 Projects/Regiments/Regiments/obj/Debug/Regiments.csproj.CoreCompileInputs.cache create mode 100644 Projects/Regiments/Regiments/obj/Debug/Regiments.csproj.FileListAbsolute.txt create mode 100644 Projects/Regiments/Regiments/obj/Release/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs create mode 100644 Projects/Regiments/Regiments/obj/Release/Regiments.csproj.AssemblyReference.cache create mode 100644 Projects/Regiments/Regiments/obj/Release/Regiments.csproj.CopyComplete create mode 100644 Projects/Regiments/Regiments/obj/Release/Regiments.csproj.CoreCompileInputs.cache create mode 100644 Projects/Regiments/Regiments/obj/Release/Regiments.csproj.FileListAbsolute.txt create mode 100644 Projects/Regiments/deploy.sh diff --git a/Projects/Regiments/Regiments.sln b/Projects/Regiments/Regiments.sln new file mode 100644 index 0000000..4dd3990 --- /dev/null +++ b/Projects/Regiments/Regiments.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Regiments", "Regiments\Regiments.csproj", "{DA9D274E-486F-4F82-84FF-CD9388CB0B09}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DA9D274E-486F-4F82-84FF-CD9388CB0B09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DA9D274E-486F-4F82-84FF-CD9388CB0B09}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DA9D274E-486F-4F82-84FF-CD9388CB0B09}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DA9D274E-486F-4F82-84FF-CD9388CB0B09}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Projects/Regiments/Regiments.sln.DotSettings.user b/Projects/Regiments/Regiments.sln.DotSettings.user new file mode 100644 index 0000000..b5f9d9d --- /dev/null +++ b/Projects/Regiments/Regiments.sln.DotSettings.user @@ -0,0 +1,14 @@ + + True + True + True + True + True + True + True + True + True + True + True + True + True \ No newline at end of file diff --git a/Projects/Regiments/Regiments/Class1.cs b/Projects/Regiments/Regiments/Class1.cs new file mode 100644 index 0000000..ca8b6e4 --- /dev/null +++ b/Projects/Regiments/Regiments/Class1.cs @@ -0,0 +1,96 @@ +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"); + } + } +} diff --git a/Projects/Regiments/Regiments/Patches.cs b/Projects/Regiments/Regiments/Patches.cs index 8bc5ea8..cfac95e 100644 --- a/Projects/Regiments/Regiments/Patches.cs +++ b/Projects/Regiments/Regiments/Patches.cs @@ -1,24 +1,167 @@ -using HarmonyLib; +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; -namespace TerraTech { - [HarmonyPatch] - public class Patches { - [HarmonyPrefix] - [HarmonyPatch(typeof(ManLicenses), "AddXP")] - static void XPMulti(FactionSubTypes corporation, ref int xp, bool showUI = true) { - xp = (int)(xp * Main.xpMultiplier.Value); - } +// Patch maxSupPoints in PlatoonSupplyModule +// Patch Operational Authority point gain - [HarmonyPrefix] - [HarmonyPatch(typeof(ManPlayer), "AddMoney")] - static void MoneyMulti(ref int amount) { - amount = (int)(amount * Main.moneyMultiplier.Value); - } +namespace Regiments { + [HarmonyPatch] + public class Patches { + private static float baseHqValue = 0; + private static float baseSupplyValue = 0; - [HarmonyPrefix] - [HarmonyPatch(typeof(TechHolders), "SetHeartbeatInterval")] - static void HeartbeatMulti(ref float interval) { - interval *= Main.heartbeatIntervalMultiplier.Value; - } - } -} \ No newline at end of file + [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/Properties/AssemblyInfo.cs b/Projects/Regiments/Regiments/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..659f97b --- /dev/null +++ b/Projects/Regiments/Regiments/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Regiments")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Regiments")] +[assembly: AssemblyCopyright("Copyright © 2023")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("DA9D274E-486F-4F82-84FF-CD9388CB0B09")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/Projects/Regiments/Regiments/Regiments.csproj b/Projects/Regiments/Regiments/Regiments.csproj new file mode 100644 index 0000000..4b89eb4 --- /dev/null +++ b/Projects/Regiments/Regiments/Regiments.csproj @@ -0,0 +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 + + + + + + + + + + + + diff --git a/Projects/Regiments/Regiments/Transpiler.cs b/Projects/Regiments/Regiments/Transpiler.cs index 6a9a782..2bc9b04 100644 --- a/Projects/Regiments/Regiments/Transpiler.cs +++ b/Projects/Regiments/Regiments/Transpiler.cs @@ -1,5 +1,274 @@ -namespace Regiments { - public class Transpiler { - - } -} \ No newline at end of file +// using System; +// using System.Collections.Generic; +// using System.Linq; +// using System.Reflection.Emit; +// 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 skillCap; +// public static ConfigEntry workSpeed; +// public static ConfigEntry workResult; +// public static ConfigEntry alwaysCritical; +// public static ConfigEntry gameSpeed; +// public static ConfigEntry fans; +// public static ConfigEntry money; +// +// // +// // private void Awake() +// // { +// // 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 +// // +// +// public void Awake() { +// skillCap = Config.Bind("General", "Skill Cap", 100f); +// workSpeed = Config.Bind("General", "Work Speed Multiplier", 4f); +// workResult = Config.Bind("General", "Work Result Multiplier", 4f); +// alwaysCritical = Config.Bind("General", "Work Always Critical", false); +// gameSpeed = Config.Bind("General", "Game Speed Multiplier", 3f); +// fans = Config.Bind("General", "Fans Multiplier", 2); +// money = Config.Bind("General", "Money Multiplier", 2L); +// +// 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"); +// } +// +// public static bool IsMatch(List codes, int index, List matcher) { +// for (var i = 0; i < matcher.Count; i++) { +// if (codes[index + i].opcode != matcher[i].opcode) { +// return false; +// } +// } +// return true; +// } +// +// public static void InsertAt(List codes, int index, List toInsert) { +// for (var i = 0; i < toInsert.Count; i++) { +// codes.Insert(index + i, toInsert[i]); +// } +// } +// } +// +// [HarmonyPatch(typeof(characterScript), "GetSkillCap")] +// public class SkillCapPatch { +// static void Postfix(ref float __result) { +// // Console.WriteLine("GetSkillCap Postfix! Result is " + __result); +// __result = Main.skillCap.Value; +// } +// } +// +// [HarmonyPatch(typeof(characterScript), "GetSkillCap_Skill")] +// public class SkillCapSkillPatch { +// static void Postfix(ref float __result) { +// // Console.WriteLine("GetSkillCap_Skill Postfix! Result is " + __result); +// __result = Main.skillCap.Value; +// } +// } +// +// [HarmonyPatch(typeof(characterScript), "GetWorkSpeed")] +// public class GetWorkSpeedPatch { +// static void Postfix(ref float __result) { +// // Console.WriteLine("GetWorkSpeed Postfix! Result is " + __result); +// __result *= Main.workSpeed.Value; +// } +// } +// +// [HarmonyPatch(typeof(characterScript), "GetWorkResult")] +// public class GetWorkResultPatch { +// static void Prefix(ref float f) { +// // Console.WriteLine("GetWorkResult Postfix! f is " + f); +// f *= Main.workResult.Value; +// } +// } +// +// [HarmonyPatch(typeof(characterScript), "GetCritic")] +// public class GetCriticPatch { +// static void Postfix(ref bool __result) { +// // Console.WriteLine("GetWorkResult Postfix! f is " + f); +// if (Main.alwaysCritical.Value) { +// __result = true; +// } +// } +// } +// +// [HarmonyPatch(typeof(mainScript), "SetGameSpeed")] +// public class GameSpeedPatch { +// static void Prefix(ref float f) { +// // Console.WriteLine("SetGameSpeed Prefix! Argument is " + f); +// if (f > 1) { +// f *= Main.gameSpeed.Value; +// // Console.WriteLine("Argument modified to " + f); +// } +// } +// } +// +// [HarmonyPatch(typeof(characterScript), "Learn")] +// public static class LearnManyPatch { +// static IEnumerable Transpiler(IEnumerable instructions) { +// var codes = new List(instructions); +// +// for (var i = 0; i < 5; i++) { +// if (codes[i].opcode == OpCodes.Ldc_R4) { +// Console.WriteLine("Changing " + codes[i]); +// codes[i].operand = (float)codes[i].operand * 64; +// Console.WriteLine("Changed " + codes[i]); +// } +// } +// +// return codes.AsEnumerable(); +// } +// } +// +// [HarmonyPatch(typeof(arbeitsmarkt), "ArbeitsmarktUpdaten")] +// public static class ManyEmployeesPatch { +// static IEnumerable Transpiler(IEnumerable instructions) { +// var codes = new List(instructions); +// +// for (var i = codes.Count - 1; i > 0; i--) { +// if (codes[i].opcode == OpCodes.Ldc_I4_3) { +// Console.WriteLine("Changing " + codes[i]); +// codes[i] = new CodeInstruction(OpCodes.Ldc_I4, 64); +// Console.WriteLine("Changed " + codes[i]); +// break; +// } +// } +// +// return codes.AsEnumerable(); +// } +// } +// +// // [HarmonyPatch(typeof(AILerp), "MovementUpdate")] +// public class MovementSpeedPatch { +// static void Prefix(ref float deltaTime) { +// Console.WriteLine("MovementUpdate Prefix! deltaTime is " + deltaTime); +// deltaTime *= 16f; +// } +// } +// +// // [HarmonyPatch(typeof(movementScript), "Move")] +// public static class EmployeeMovementSpeedPatch { +// static IEnumerable Transpiler(IEnumerable instructions) { +// var codes = new List(instructions); +// +// List matcher = new List(); +// matcher.Add(new CodeInstruction(OpCodes.Ldarg_0, null)); +// matcher.Add(new CodeInstruction(OpCodes.Ldfld, null)); +// matcher.Add(new CodeInstruction(OpCodes.Ldarg_0, null)); +// matcher.Add(new CodeInstruction(OpCodes.Ldfld, null)); +// matcher.Add(new CodeInstruction(OpCodes.Mul, null)); +// +// List patch = new List(); +// patch.Add(new CodeInstruction(OpCodes.Ldc_R4, 8)); +// patch.Add(new CodeInstruction(OpCodes.Mul, null)); +// +// for (var i = codes.Count - 1; i > 0; i--) { +// if (Main.IsMatch(codes, i, matcher)) { +// Main.InsertAt(codes, i + 5, patch); +// Console.WriteLine("Movement speed patched"); +// for (var j = 0; j < 15; j++) { +// Console.WriteLine(codes[i + j]); +// } +// break; +// } +// } +// Console.WriteLine("Return"); +// return codes.AsEnumerable(); +// } +// } +// +// [HarmonyPatch(typeof(mainScript), "WochenUpdates")] +// public static class ContractWorkAmount { +// static IEnumerable Transpiler(IEnumerable instructions) { +// var codes = new List(instructions); +// int methodIndex = -1; +// List pattern = new List(); +// +// List matcher = new List(); +// matcher.Add(new CodeInstruction(OpCodes.Ldarg_0, null)); +// matcher.Add(new CodeInstruction(OpCodes.Ldfld, null)); +// matcher.Add(new CodeInstruction(OpCodes.Ldc_I4_0, null)); +// matcher.Add(new CodeInstruction(OpCodes.Callvirt, null)); +// +// for (var i = 0; i < codes.Count; i++) { +// if (codes[i].operand != null) { +// if (codes[i].operand.ToString().Contains("UpdateContractWork")) { +// methodIndex = i; +// pattern.Add(codes[i - 3]); +// pattern.Add(codes[i - 2]); +// pattern.Add(codes[i - 1]); +// pattern.Add(codes[i]); +// break; +// } +// } +// } +// pattern[2].opcode = OpCodes.Ldc_I4_1; +// +// for (int i = 0; i < 16; i++) { +// for (int j = 0; j < pattern.Count; j++) { +// codes.Insert(methodIndex + i + j, pattern[j]); +// } +// } +// +// return codes.AsEnumerable(); +// } +// } +// +// [HarmonyPatch(typeof(platformScript), "SellPlayer")] +// public static class ConsoleProductionReductionPatch { +// static IEnumerable Transpiler(IEnumerable instructions) { +// var codes = new List(instructions); +// +// List matcher = new List(); +// matcher.Add(new CodeInstruction(OpCodes.Ldarg_0, null)); +// matcher.Add(new CodeInstruction(OpCodes.Ldarg_0, null)); +// matcher.Add(new CodeInstruction(OpCodes.Ldfld, null)); +// matcher.Add(new CodeInstruction(OpCodes.Ldc_R4, null)); +// matcher.Add(new CodeInstruction(OpCodes.Ldc_R4, null)); +// matcher.Add(new CodeInstruction(OpCodes.Call, null)); +// matcher.Add(new CodeInstruction(OpCodes.Add, null)); +// matcher.Add(new CodeInstruction(OpCodes.Stfld, null)); +// +// for (var i = 0; i < codes.Count; i++) { +// if (Main.IsMatch(codes, i, matcher)) { +// codes[i + 3].operand = (float)codes[i + 3].operand * 8f; +// codes[i + 4].operand = (float)codes[i + 4].operand * 8f; +// Console.WriteLine("ConsoleProductionReductionPatch patched"); +// break; +// } +// } +// +// return codes.AsEnumerable(); +// } +// } +// +// [HarmonyPatch(typeof(mainScript), "AddFans")] +// public static class AddFansPatch { +// static void Prefix(ref int i) { +// // Console.WriteLine("GetWorkResult Postfix! f is " + f); +// i *= Main.fans.Value; +// } +// } +// +// [HarmonyPatch(typeof(mainScript), "Earn")] +// public static class AddMoneyPatch { +// static void Prefix(ref long amount) { +// // Console.WriteLine("GetWorkResult Postfix! f is " + f); +// amount *= Main.money.Value; +// } +// } +// } diff --git a/Projects/Regiments/Regiments/obj/Debug/.NETFramework,Version=v4.0.AssemblyAttributes.cs b/Projects/Regiments/Regiments/obj/Debug/.NETFramework,Version=v4.0.AssemblyAttributes.cs new file mode 100644 index 0000000..5d01041 --- /dev/null +++ b/Projects/Regiments/Regiments/obj/Debug/.NETFramework,Version=v4.0.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")] 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 new file mode 100644 index 0000000..0af6d86 --- /dev/null +++ b/Projects/Regiments/Regiments/obj/Debug/.NETFramework,Version=v4.8.1.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +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 new file mode 100644 index 0000000000000000000000000000000000000000..30db482d58282a986c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vTqZtw|KV#QIkNKfqf zz{;zHKMh?|rD*X0o2e;i6)c*XHjB0=%Gha1wy-~v&afmqs!!(S^q&tt&#JSE8ArE1 zxkFqo)YghYV+4Y!*^bruu{B$zorL}KjgnUCUH@l2J=}Q5DK^t)r?7d>u2HjdY|AyK zADAfygQ2V0skH%^f!V~3A;}nOZP6`vC~I$$PTUp$$kY0t6~Qri7`<8c0keIg +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/Release/Regiments.csproj.AssemblyReference.cache b/Projects/Regiments/Regiments/obj/Release/Regiments.csproj.AssemblyReference.cache new file mode 100644 index 0000000000000000000000000000000000000000..feb07abde7a6a384898df480439c6b7fbe135427 GIT binary patch literal 15813 zcmd5@&2Qtz6&Ksh#ui$U1&lzZzqGL&L6qe!AT*$fC&%3n69Fuvy1@VO)x|#EqIF}Ex!y|bk{UYxe^YB~C=BvxE-nv^bx**10 zKzPtBwYrqiAmmQy^QKLlLy)R@pM(e8p)6?DXp3-=_$R~-gXS9PQASRL3gQbj(xzR) z;MVXA1PPkU+YaygtUnOxi{JnC&VT;-@tk28bLmavDE8EL!)9l66sGT})UP2ds+<>te#Xn6fSoxMt1->taewuugRUW_s=BQUer5eYUz{ z-UU@I-(0dHFN`=@Wh4RxdN-G<5sbY17U|dhBf?f$1TaE^i{b+WPX}5GF7D(HDY&>O z2fkp;!Ra3!H5=D&fAY)0Wk6c6`$0&$rsZ>Dd=>5p6UiU{E7*L+XTE6>mwNJN=K<(K z4s0A&^~1ls^x+@>{$uf|{6`@6HGx&}TjpL!y}-DZ+z8AFsgRzqb6w${PhEoVp(+;iUgV%kDV5H*lx>|NbC#r{{9d z#HN#KH2EtoN~K?T9BbM5>CC(;$1meto4H#<9|Qk7r;iCQP<$+J!f;<6dD}b9$FA)$ z8um9>8$zCRG%)MPBV*Mofb+QVuf^IH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ED0efgL_NwtYQXGyeJPHdbe6sv%DyQc^#zjDG@CN*?KiU`xqL!wvgZo09G7 zElZ?b8=SnOmOs^Yu&|1Oi4WVsBOB!Z-|Z}2?O?4f(iF@lZUnhcUuzTdg#*gq{aKGV x0THj*YI@u1y;*dufI7THE2)e3Y*XrS&=D3c52G{9K5e>>chtJ&)G~bU`M*tXcbEVG literal 0 HcmV?d00001 diff --git a/Projects/Regiments/Regiments/obj/Release/Regiments.csproj.CopyComplete b/Projects/Regiments/Regiments/obj/Release/Regiments.csproj.CopyComplete new file mode 100644 index 0000000..e69de29 diff --git a/Projects/Regiments/Regiments/obj/Release/Regiments.csproj.CoreCompileInputs.cache b/Projects/Regiments/Regiments/obj/Release/Regiments.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..6c21eb7 --- /dev/null +++ b/Projects/Regiments/Regiments/obj/Release/Regiments.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +62832bf141ce1cb53e10d7dfb818aaddf62d910680fd3ce46ffa60a38ed43870 diff --git a/Projects/Regiments/Regiments/obj/Release/Regiments.csproj.FileListAbsolute.txt b/Projects/Regiments/Regiments/obj/Release/Regiments.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..ac86d51 --- /dev/null +++ b/Projects/Regiments/Regiments/obj/Release/Regiments.csproj.FileListAbsolute.txt @@ -0,0 +1,14 @@ +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\Regiments.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\Regiments.pdb +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\0Harmony.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\Assembly-CSharp.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\BepInEx.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\ConfigurationManager.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\UnityEngine.CoreModule.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\UnityEngine.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Release\Regiments.csproj.AssemblyReference.cache +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Release\Regiments.csproj.CoreCompileInputs.cache +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Release\Regiments.csproj.CopyComplete +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Release\Regiments.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Release\Regiments.pdb +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\MainAssembly.dll diff --git a/Projects/Regiments/deploy.sh b/Projects/Regiments/deploy.sh new file mode 100644 index 0000000..c27608f --- /dev/null +++ b/Projects/Regiments/deploy.sh @@ -0,0 +1 @@ +cp 'C:/Users/Administrator/RiderProjects/Bepinex/Projects/Regiments/Regiments/obj/Release/Regiments.dll' 'C:/Program Files (x86)/Steam/steamapps/common/Regiments/BepInEx/plugins' \ No newline at end of file