diff --git a/Projects/AgainstTheStorm/AgainstTheStorm.sln b/Projects/AgainstTheStorm/AgainstTheStorm.sln index 91fb4d8..40f5d04 100644 --- a/Projects/AgainstTheStorm/AgainstTheStorm.sln +++ b/Projects/AgainstTheStorm/AgainstTheStorm.sln @@ -1,16 +1,16 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgainstTheStorm", "AgainstTheStorm\AgainstTheStorm.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 + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AgainstTheStorm", "AgainstTheStorm\AgainstTheStorm.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/AgainstTheStorm/AgainstTheStorm/AgainstTheStorm.csproj b/Projects/AgainstTheStorm/AgainstTheStorm/AgainstTheStorm.csproj index 9dee184..713705d 100644 --- a/Projects/AgainstTheStorm/AgainstTheStorm/AgainstTheStorm.csproj +++ b/Projects/AgainstTheStorm/AgainstTheStorm/AgainstTheStorm.csproj @@ -1,82 +1,82 @@ - - - - - Debug - AnyCPU - {DA9D274E-486F-4F82-84FF-CD9388CB0B09} - Library - Properties - AgainstTheStorm - AgainstTheStorm - 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\Sirenix.Serialization.dll - - - - - - - libs\UnityEngine.dll - - - libs\UnityEngine.CoreModule.dll - - - - - - - - - - - - - - - + + + + + Debug + AnyCPU + {DA9D274E-486F-4F82-84FF-CD9388CB0B09} + Library + Properties + AgainstTheStorm + AgainstTheStorm + 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\Sirenix.Serialization.dll + + + + + + + libs\UnityEngine.dll + + + libs\UnityEngine.CoreModule.dll + + + + + + + + + + + + + + + diff --git a/Projects/AgainstTheStorm/AgainstTheStorm/Properties/AssemblyInfo.cs b/Projects/AgainstTheStorm/AgainstTheStorm/Properties/AssemblyInfo.cs index 659f97b..e756fd4 100644 --- a/Projects/AgainstTheStorm/AgainstTheStorm/Properties/AssemblyInfo.cs +++ b/Projects/AgainstTheStorm/AgainstTheStorm/Properties/AssemblyInfo.cs @@ -1,35 +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")] +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/AgainstTheStorm/AgainstTheStorm/Transpiler.cs b/Projects/AgainstTheStorm/AgainstTheStorm/Transpiler.cs index 2bc9b04..9aa461f 100644 --- a/Projects/AgainstTheStorm/AgainstTheStorm/Transpiler.cs +++ b/Projects/AgainstTheStorm/AgainstTheStorm/Transpiler.cs @@ -1,274 +1,274 @@ -// 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; -// } -// } -// } +// 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/AgainstTheStorm/AgainstTheStorm/obj/Debug/AgainstTheStorm.csproj.CoreCompileInputs.cache b/Projects/AgainstTheStorm/AgainstTheStorm/obj/Debug/AgainstTheStorm.csproj.CoreCompileInputs.cache index 7286ee8..b65fb04 100644 --- a/Projects/AgainstTheStorm/AgainstTheStorm/obj/Debug/AgainstTheStorm.csproj.CoreCompileInputs.cache +++ b/Projects/AgainstTheStorm/AgainstTheStorm/obj/Debug/AgainstTheStorm.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -151279b84fdcbaafd9f0fcb1f7663654a57733b1df3836fc5634a1051692a2db +151279b84fdcbaafd9f0fcb1f7663654a57733b1df3836fc5634a1051692a2db diff --git a/Projects/AgainstTheStorm/AgainstTheStorm/obj/Debug/AgainstTheStorm.csproj.FileListAbsolute.txt b/Projects/AgainstTheStorm/AgainstTheStorm/obj/Debug/AgainstTheStorm.csproj.FileListAbsolute.txt index ad193b7..6c830c0 100644 --- a/Projects/AgainstTheStorm/AgainstTheStorm/obj/Debug/AgainstTheStorm.csproj.FileListAbsolute.txt +++ b/Projects/AgainstTheStorm/AgainstTheStorm/obj/Debug/AgainstTheStorm.csproj.FileListAbsolute.txt @@ -1,14 +1,14 @@ -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\AgainstTheStorm.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\AgainstTheStorm.pdb -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\0Harmony.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\Assembly-CSharp.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\BepInEx.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\ConfigurationManager.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\Sirenix.Serialization.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\UnityEngine.CoreModule.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\UnityEngine.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\obj\Debug\AgainstTheStorm.csproj.AssemblyReference.cache -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\obj\Debug\AgainstTheStorm.csproj.CoreCompileInputs.cache -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\obj\Debug\AgainstTheStorm.csproj.CopyComplete -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\obj\Debug\AgainstTheStorm.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\obj\Debug\AgainstTheStorm.pdb +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\AgainstTheStorm.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\AgainstTheStorm.pdb +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\0Harmony.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\Assembly-CSharp.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\BepInEx.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\ConfigurationManager.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\Sirenix.Serialization.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\UnityEngine.CoreModule.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\bin\Debug\UnityEngine.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\obj\Debug\AgainstTheStorm.csproj.AssemblyReference.cache +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\obj\Debug\AgainstTheStorm.csproj.CoreCompileInputs.cache +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\obj\Debug\AgainstTheStorm.csproj.CopyComplete +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\obj\Debug\AgainstTheStorm.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\AgainstTheStorm\AgainstTheStorm\obj\Debug\AgainstTheStorm.pdb diff --git a/Projects/CaptainOfIndustry/CaptainOfIndustry.sln b/Projects/CaptainOfIndustry/CaptainOfIndustry.sln index 850345b..904d957 100644 --- a/Projects/CaptainOfIndustry/CaptainOfIndustry.sln +++ b/Projects/CaptainOfIndustry/CaptainOfIndustry.sln @@ -1,16 +1,16 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptainOfIndustry", "CaptainOfIndustry\CaptainOfIndustry.csproj", "{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptainOfIndustry", "CaptainOfIndustry\CaptainOfIndustry.csproj", "{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Projects/CaptainOfIndustry/CaptainOfIndustry/CaptainOfIndustry.csproj b/Projects/CaptainOfIndustry/CaptainOfIndustry/CaptainOfIndustry.csproj index 1ed6736..f92b93e 100644 --- a/Projects/CaptainOfIndustry/CaptainOfIndustry/CaptainOfIndustry.csproj +++ b/Projects/CaptainOfIndustry/CaptainOfIndustry/CaptainOfIndustry.csproj @@ -1,97 +1,97 @@ - - - - - Debug - AnyCPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE} - Library - Properties - CaptainOfIndustry - CaptainOfIndustry - v4.8 - 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\Mafi.dll - - - ..\libs\Mafi.Base.dll - - - ..\libs\Mafi.Core.dll - - - ..\libs\Mafi.ModsAuthoringSupport.dll - - - ..\libs\Mafi.Unity.dll - - - ..\libs\Sirenix.OdinInspector.Attributes.dll - - - ..\libs\Sirenix.OdinInspector.CompatibilityLayer.dll - - - ..\libs\Sirenix.Serialization.dll - - - ..\libs\Sirenix.Serialization.Config.dll - - - ..\libs\Sirenix.Utilities.dll - - - ..\libs\UnityEngine.dll - - - ..\libs\UnityEngine.CoreModule.dll - - - - + + + + + Debug + AnyCPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE} + Library + Properties + CaptainOfIndustry + CaptainOfIndustry + v4.8 + 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\Mafi.dll + + + ..\libs\Mafi.Base.dll + + + ..\libs\Mafi.Core.dll + + + ..\libs\Mafi.ModsAuthoringSupport.dll + + + ..\libs\Mafi.Unity.dll + + + ..\libs\Sirenix.OdinInspector.Attributes.dll + + + ..\libs\Sirenix.OdinInspector.CompatibilityLayer.dll + + + ..\libs\Sirenix.Serialization.dll + + + ..\libs\Sirenix.Serialization.Config.dll + + + ..\libs\Sirenix.Utilities.dll + + + ..\libs\UnityEngine.dll + + + ..\libs\UnityEngine.CoreModule.dll + + + + \ No newline at end of file diff --git a/Projects/CaptainOfIndustry/CaptainOfIndustry/Properties/AssemblyInfo.cs b/Projects/CaptainOfIndustry/CaptainOfIndustry/Properties/AssemblyInfo.cs index f966ba7..78bdafe 100644 --- a/Projects/CaptainOfIndustry/CaptainOfIndustry/Properties/AssemblyInfo.cs +++ b/Projects/CaptainOfIndustry/CaptainOfIndustry/Properties/AssemblyInfo.cs @@ -1,35 +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("CaptainOfIndustry")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("CaptainOfIndustry")] -[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("EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE")] - -// 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")] +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("CaptainOfIndustry")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CaptainOfIndustry")] +[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("EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE")] + +// 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")] diff --git a/Projects/Escapists2/Escapists2.sln b/Projects/Escapists2/Escapists2.sln index b650b64..7ef7abe 100644 --- a/Projects/Escapists2/Escapists2.sln +++ b/Projects/Escapists2/Escapists2.sln @@ -1,16 +1,16 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Escapists2", "Escapists2\Escapists2.csproj", "{20F983A2-1743-4E96-BFDB-CF5A4F134D2D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {20F983A2-1743-4E96-BFDB-CF5A4F134D2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {20F983A2-1743-4E96-BFDB-CF5A4F134D2D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {20F983A2-1743-4E96-BFDB-CF5A4F134D2D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {20F983A2-1743-4E96-BFDB-CF5A4F134D2D}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Escapists2", "Escapists2\Escapists2.csproj", "{20F983A2-1743-4E96-BFDB-CF5A4F134D2D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {20F983A2-1743-4E96-BFDB-CF5A4F134D2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20F983A2-1743-4E96-BFDB-CF5A4F134D2D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20F983A2-1743-4E96-BFDB-CF5A4F134D2D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20F983A2-1743-4E96-BFDB-CF5A4F134D2D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Projects/Escapists2/Escapists2/Class1.cs b/Projects/Escapists2/Escapists2/Class1.cs index ce6989f..82b435f 100644 --- a/Projects/Escapists2/Escapists2/Class1.cs +++ b/Projects/Escapists2/Escapists2/Class1.cs @@ -1,95 +1,95 @@ -using System.Linq; -using BepInEx; -using BepInEx.Configuration; -using HarmonyLib; -using HarmonyLib.Tools; - -namespace Escapists2 { - [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 xpMultiplier; - - public void Awake() { - xpMultiplier = Config.Bind("General", "XP Multiplier", 1f, new ConfigDescription("XP Multiplier", new AcceptableValueRange(1f, 32f))); - // moneyMultiplier = Config.Bind("General", "Money Multiplier", 1f, - // new ConfigDescription("Money Multiplier", new AcceptableValueRange(1f, 32f))); - // energyGenMultiplier = Config.Bind("General", "Energy Generation Multiplier", 1f, - // new ConfigDescription("Energy Generation Multiplier", new AcceptableValueRange(1f, 64f))); - // heartbeatIntervalMultiplier = Config.Bind("General", "Heartbeat Interval Multiplier", 1f, - // new ConfigDescription("Heartbeat Interval Multiplier", new AcceptableValueRange(0.1f, 2f))); - // - // shootingSpeedMultiplier = Config.Bind("Weapons", "Shooting Speed Multiplier", 1f, - // new ConfigDescription("Shooting Speed Multiplier", new AcceptableValueRange(0.2f, 8f))); - // muzzleVelocityMultiplier = Config.Bind("Weapons", "Muzzle Velocity Multiplier", 1f, - // new ConfigDescription("Muzzle Velocity Multiplier", new AcceptableValueRange(0.2f, 32f))); - // seekingProjectileVisionConeAngleMultiplier = Config.Bind("Weapons", "Seeking Projectile Cone Vision Angle Multiplier", 1f, - // new ConfigDescription("Seeking Projectile Cone Vision Angle Multiplier", new AcceptableValueRange(0.2f, 32f))); - // seekingProjectileVisionRangeMultiplier = Config.Bind("Weapons", "Seeking Projectile Vision Range Multiplier", 1f, - // new ConfigDescription("Seeking Projectile Vision Range Multiplier", new AcceptableValueRange(0.2f, 32f))); - // seekingProjectileTurningSpeedMultiplier = Config.Bind("Weapons", "Seeking Projectile Turn Speed Multiplier", 1f, - // new ConfigDescription("Seeking Projectile Turn Speed Multiplier", new AcceptableValueRange(0.2f, 32f))); - // - // magnetStrenghtMultiplier = Config.Bind("Attractors", "Magnet Strength Multiplier", 1f, - // new ConfigDescription("Magnet Strength Multiplier", new AcceptableValueRange(1f, 16f))); - // magnetRadiusMultiplier = Config.Bind("Attractors", "Magnet Radius Multiplier", 1f, - // new ConfigDescription("Magnet Radius Multiplier", new AcceptableValueRange(1f, 16f))); - // 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))); - // - // wirelessChargingRadiusMultiplier = Config.Bind("Power", "Wireless Charger Radius Multiplier", 1f, - // new ConfigDescription("Wireless Charger Radius Multiplier", new AcceptableValueRange(0.2f, 16f))); - // wirelessChargingArcFiringIntervalMultiplier = Config.Bind("Power", "Wireless Charger Arc Firing Interval", 1f, - // new ConfigDescription("Wireless Charger Arc Firing Interval", new AcceptableValueRange(0.02f, 16f))); - // wirelessChargingPowerPerArcMultiplier = Config.Bind("Power", "Wireless Charger Power Per Arc", 1f, - // new ConfigDescription("Wireless Charger Power Per Arc", new AcceptableValueRange(0.2f, 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(); - // wirelessChargingPowerPerArcMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); - // wirelessChargingArcFiringIntervalMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); - // wirelessChargingRadiusMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.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 Escapists2 { + [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 xpMultiplier; + + public void Awake() { + xpMultiplier = Config.Bind("General", "XP Multiplier", 1f, new ConfigDescription("XP Multiplier", new AcceptableValueRange(1f, 32f))); + // moneyMultiplier = Config.Bind("General", "Money Multiplier", 1f, + // new ConfigDescription("Money Multiplier", new AcceptableValueRange(1f, 32f))); + // energyGenMultiplier = Config.Bind("General", "Energy Generation Multiplier", 1f, + // new ConfigDescription("Energy Generation Multiplier", new AcceptableValueRange(1f, 64f))); + // heartbeatIntervalMultiplier = Config.Bind("General", "Heartbeat Interval Multiplier", 1f, + // new ConfigDescription("Heartbeat Interval Multiplier", new AcceptableValueRange(0.1f, 2f))); + // + // shootingSpeedMultiplier = Config.Bind("Weapons", "Shooting Speed Multiplier", 1f, + // new ConfigDescription("Shooting Speed Multiplier", new AcceptableValueRange(0.2f, 8f))); + // muzzleVelocityMultiplier = Config.Bind("Weapons", "Muzzle Velocity Multiplier", 1f, + // new ConfigDescription("Muzzle Velocity Multiplier", new AcceptableValueRange(0.2f, 32f))); + // seekingProjectileVisionConeAngleMultiplier = Config.Bind("Weapons", "Seeking Projectile Cone Vision Angle Multiplier", 1f, + // new ConfigDescription("Seeking Projectile Cone Vision Angle Multiplier", new AcceptableValueRange(0.2f, 32f))); + // seekingProjectileVisionRangeMultiplier = Config.Bind("Weapons", "Seeking Projectile Vision Range Multiplier", 1f, + // new ConfigDescription("Seeking Projectile Vision Range Multiplier", new AcceptableValueRange(0.2f, 32f))); + // seekingProjectileTurningSpeedMultiplier = Config.Bind("Weapons", "Seeking Projectile Turn Speed Multiplier", 1f, + // new ConfigDescription("Seeking Projectile Turn Speed Multiplier", new AcceptableValueRange(0.2f, 32f))); + // + // magnetStrenghtMultiplier = Config.Bind("Attractors", "Magnet Strength Multiplier", 1f, + // new ConfigDescription("Magnet Strength Multiplier", new AcceptableValueRange(1f, 16f))); + // magnetRadiusMultiplier = Config.Bind("Attractors", "Magnet Radius Multiplier", 1f, + // new ConfigDescription("Magnet Radius Multiplier", new AcceptableValueRange(1f, 16f))); + // 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))); + // + // wirelessChargingRadiusMultiplier = Config.Bind("Power", "Wireless Charger Radius Multiplier", 1f, + // new ConfigDescription("Wireless Charger Radius Multiplier", new AcceptableValueRange(0.2f, 16f))); + // wirelessChargingArcFiringIntervalMultiplier = Config.Bind("Power", "Wireless Charger Arc Firing Interval", 1f, + // new ConfigDescription("Wireless Charger Arc Firing Interval", new AcceptableValueRange(0.02f, 16f))); + // wirelessChargingPowerPerArcMultiplier = Config.Bind("Power", "Wireless Charger Power Per Arc", 1f, + // new ConfigDescription("Wireless Charger Power Per Arc", new AcceptableValueRange(0.2f, 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(); + // wirelessChargingPowerPerArcMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); + // wirelessChargingArcFiringIntervalMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); + // wirelessChargingRadiusMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.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"); + } + } } \ No newline at end of file diff --git a/Projects/Escapists2/Escapists2/Escapists2.csproj b/Projects/Escapists2/Escapists2/Escapists2.csproj index 8ef58ff..d608577 100644 --- a/Projects/Escapists2/Escapists2/Escapists2.csproj +++ b/Projects/Escapists2/Escapists2/Escapists2.csproj @@ -1,69 +1,69 @@ - - - - - Debug - AnyCPU - {20F983A2-1743-4E96-BFDB-CF5A4F134D2D} - Library - Properties - Escapists2 - Escapists2 - v4.0 - 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\UnityEngine.dll - - - - - - - - - - - + + + + + Debug + AnyCPU + {20F983A2-1743-4E96-BFDB-CF5A4F134D2D} + Library + Properties + Escapists2 + Escapists2 + v4.0 + 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\UnityEngine.dll + + + + + + + + + + + diff --git a/Projects/Escapists2/Escapists2/Properties/AssemblyInfo.cs b/Projects/Escapists2/Escapists2/Properties/AssemblyInfo.cs index 116e5a4..bf027d9 100644 --- a/Projects/Escapists2/Escapists2/Properties/AssemblyInfo.cs +++ b/Projects/Escapists2/Escapists2/Properties/AssemblyInfo.cs @@ -1,35 +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("Escapists2")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Escapists2")] -[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("20F983A2-1743-4E96-BFDB-CF5A4F134D2D")] - -// 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")] +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("Escapists2")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Escapists2")] +[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("20F983A2-1743-4E96-BFDB-CF5A4F134D2D")] + +// 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/Escapists2/Escapists2/XPPatch.cs b/Projects/Escapists2/Escapists2/XPPatch.cs index 48611c0..97ebd07 100644 --- a/Projects/Escapists2/Escapists2/XPPatch.cs +++ b/Projects/Escapists2/Escapists2/XPPatch.cs @@ -1,12 +1,12 @@ -using HarmonyLib; - -namespace Escapists2 { - [HarmonyPatch] - public class XPPatch { - [HarmonyPrefix] - [HarmonyPatch(typeof(CharacterStats), "ModifyStat_Internal")] - static void XPMulti(ref float change, ref HiddenFloat stat, ref float max) { - change *= Main.xpMultiplier.Value; - } - } +using HarmonyLib; + +namespace Escapists2 { + [HarmonyPatch] + public class XPPatch { + [HarmonyPrefix] + [HarmonyPatch(typeof(CharacterStats), "ModifyStat_Internal")] + static void XPMulti(ref float change, ref HiddenFloat stat, ref float max) { + change *= Main.xpMultiplier.Value; + } + } } \ No newline at end of file diff --git a/Projects/Escapists2/Escapists2/obj/Debug/.NETFramework,Version=v4.0.AssemblyAttributes.cs b/Projects/Escapists2/Escapists2/obj/Debug/.NETFramework,Version=v4.0.AssemblyAttributes.cs index 5d01041..9e65edd 100644 --- a/Projects/Escapists2/Escapists2/obj/Debug/.NETFramework,Version=v4.0.AssemblyAttributes.cs +++ b/Projects/Escapists2/Escapists2/obj/Debug/.NETFramework,Version=v4.0.AssemblyAttributes.cs @@ -1,4 +1,4 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")] +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")] diff --git a/Projects/Escapists2/Escapists2/obj/Debug/Escapists2.csproj.AssemblyReference.cache b/Projects/Escapists2/Escapists2/obj/Debug/Escapists2.csproj.AssemblyReference.cache index 9092ba7..5a98aa5 100644 Binary files a/Projects/Escapists2/Escapists2/obj/Debug/Escapists2.csproj.AssemblyReference.cache and b/Projects/Escapists2/Escapists2/obj/Debug/Escapists2.csproj.AssemblyReference.cache differ diff --git a/Projects/Escapists2/Escapists2/obj/Debug/Escapists2.csproj.CoreCompileInputs.cache b/Projects/Escapists2/Escapists2/obj/Debug/Escapists2.csproj.CoreCompileInputs.cache index d60b30f..d3126c8 100644 --- a/Projects/Escapists2/Escapists2/obj/Debug/Escapists2.csproj.CoreCompileInputs.cache +++ b/Projects/Escapists2/Escapists2/obj/Debug/Escapists2.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -09ea03cdb969439a4f3eb3dedfa28a8d8654a867 +09ea03cdb969439a4f3eb3dedfa28a8d8654a867 diff --git a/Projects/Escapists2/Escapists2/obj/Debug/Escapists2.csproj.FileListAbsolute.txt b/Projects/Escapists2/Escapists2/obj/Debug/Escapists2.csproj.FileListAbsolute.txt index 458e449..b104f70 100644 --- a/Projects/Escapists2/Escapists2/obj/Debug/Escapists2.csproj.FileListAbsolute.txt +++ b/Projects/Escapists2/Escapists2/obj/Debug/Escapists2.csproj.FileListAbsolute.txt @@ -1,12 +1,12 @@ -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\bin\Debug\Escapists2.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\bin\Debug\Escapists2.pdb -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\obj\Debug\Escapists2.csproj.AssemblyReference.cache -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\obj\Debug\Escapists2.csproj.CoreCompileInputs.cache -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\obj\Debug\Escapists2.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\obj\Debug\Escapists2.pdb -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\bin\Debug\0Harmony.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\bin\Debug\Assembly-CSharp.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\bin\Debug\BepInEx.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\bin\Debug\ConfigurationManager.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\bin\Debug\UnityEngine.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\obj\Debug\Escapists2.csproj.CopyComplete +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\bin\Debug\Escapists2.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\bin\Debug\Escapists2.pdb +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\obj\Debug\Escapists2.csproj.AssemblyReference.cache +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\obj\Debug\Escapists2.csproj.CoreCompileInputs.cache +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\obj\Debug\Escapists2.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\obj\Debug\Escapists2.pdb +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\bin\Debug\0Harmony.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\bin\Debug\Assembly-CSharp.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\bin\Debug\BepInEx.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\bin\Debug\ConfigurationManager.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\bin\Debug\UnityEngine.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Escapists2\Escapists2\obj\Debug\Escapists2.csproj.CopyComplete diff --git a/Projects/HouseFlipper/HouseFlipper.sln b/Projects/HouseFlipper/HouseFlipper.sln index 19c10fa..d85ff46 100644 --- a/Projects/HouseFlipper/HouseFlipper.sln +++ b/Projects/HouseFlipper/HouseFlipper.sln @@ -1,16 +1,16 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HouseFlipper", "HouseFlipper\HouseFlipper.csproj", "{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HouseFlipper", "HouseFlipper\HouseFlipper.csproj", "{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Projects/HouseFlipper/HouseFlipper/BeamPropertiesManager.cs b/Projects/HouseFlipper/HouseFlipper/BeamPropertiesManager.cs index 0f05b08..4d98c9c 100644 --- a/Projects/HouseFlipper/HouseFlipper/BeamPropertiesManager.cs +++ b/Projects/HouseFlipper/HouseFlipper/BeamPropertiesManager.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class BeamPropertiesManager { - private static Dictionary strenghts = new Dictionary(); - private static Dictionary radii = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleItemHolderBeam), "OnAttached")] - static void PostfixCreate(ModuleItemHolderBeam __instance) { - // Console.WriteLine("ModuleItemHolderBeam.OnAttached"); - if (!strenghts.ContainsKey(__instance)) { - strenghts.Add(__instance, GetStrength(__instance)); - radii.Add(__instance, GetRadius(__instance)); - // Console.WriteLine("Patching {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleItemHolderBeam), "OnDetaching")] - static void PostfixDestroy(ModuleItemHolderBeam __instance) { - // Console.WriteLine("ModuleItemHolderBeam.OnDetaching"); - // Console.WriteLine("Restoring {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - strenghts.Remove(__instance); - radii.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleItemHolderBeam", strenghts.Count); - foreach (KeyValuePair keyValuePair in strenghts) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleItemHolderBeam moduleItemHolderBeam) { - SetStrength(moduleItemHolderBeam, strenghts[moduleItemHolderBeam] * Main.beamStrenghtMultiplier.Value); - SetRadius(moduleItemHolderBeam, radii[moduleItemHolderBeam] * Main.beamRadiusMultiplier.Value); - } - - static void DoRestoreSingle(ModuleItemHolderBeam moduleItemHolderBeam) { - if (strenghts.ContainsKey(moduleItemHolderBeam)) { - SetStrength(moduleItemHolderBeam, strenghts[moduleItemHolderBeam]); - SetRadius(moduleItemHolderBeam, radii[moduleItemHolderBeam]); - } - } - - private static float GetStrength(ModuleItemHolderBeam moduleItemHolderBeam) { - return Traverse.Create(moduleItemHolderBeam).Field("m_BeamStrength").GetValue() as float? ?? 0f; - } - - private static void SetStrength(ModuleItemHolderBeam moduleItemHolderBeam, float value) { - Traverse.Create(moduleItemHolderBeam).Field("m_BeamStrength").SetValue(value); - } - - private static float GetRadius(ModuleItemHolderBeam moduleItemHolderBeam) { - ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderBeam).Field("m_Pickup").GetValue() as ModuleItemPickup; - if (moduleItemPickup) { - float radius = Traverse.Create(moduleItemPickup).Field("m_PickupRange").GetValue() as float? ?? 0f; - return radius; - } - return 0f; - } - - private static void SetRadius(ModuleItemHolderBeam moduleItemHolderBeam, float value) { - ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderBeam).Field("m_Pickup").GetValue() as ModuleItemPickup; - if (moduleItemPickup) { - Traverse.Create(moduleItemPickup).Field("m_PickupRange").SetValue(value); - } - } - } +using System; +using System.Collections.Generic; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class BeamPropertiesManager { + private static Dictionary strenghts = new Dictionary(); + private static Dictionary radii = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemHolderBeam), "OnAttached")] + static void PostfixCreate(ModuleItemHolderBeam __instance) { + // Console.WriteLine("ModuleItemHolderBeam.OnAttached"); + if (!strenghts.ContainsKey(__instance)) { + strenghts.Add(__instance, GetStrength(__instance)); + radii.Add(__instance, GetRadius(__instance)); + // Console.WriteLine("Patching {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemHolderBeam), "OnDetaching")] + static void PostfixDestroy(ModuleItemHolderBeam __instance) { + // Console.WriteLine("ModuleItemHolderBeam.OnDetaching"); + // Console.WriteLine("Restoring {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + strenghts.Remove(__instance); + radii.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleItemHolderBeam", strenghts.Count); + foreach (KeyValuePair keyValuePair in strenghts) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleItemHolderBeam moduleItemHolderBeam) { + SetStrength(moduleItemHolderBeam, strenghts[moduleItemHolderBeam] * Main.beamStrenghtMultiplier.Value); + SetRadius(moduleItemHolderBeam, radii[moduleItemHolderBeam] * Main.beamRadiusMultiplier.Value); + } + + static void DoRestoreSingle(ModuleItemHolderBeam moduleItemHolderBeam) { + if (strenghts.ContainsKey(moduleItemHolderBeam)) { + SetStrength(moduleItemHolderBeam, strenghts[moduleItemHolderBeam]); + SetRadius(moduleItemHolderBeam, radii[moduleItemHolderBeam]); + } + } + + private static float GetStrength(ModuleItemHolderBeam moduleItemHolderBeam) { + return Traverse.Create(moduleItemHolderBeam).Field("m_BeamStrength").GetValue() as float? ?? 0f; + } + + private static void SetStrength(ModuleItemHolderBeam moduleItemHolderBeam, float value) { + Traverse.Create(moduleItemHolderBeam).Field("m_BeamStrength").SetValue(value); + } + + private static float GetRadius(ModuleItemHolderBeam moduleItemHolderBeam) { + ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderBeam).Field("m_Pickup").GetValue() as ModuleItemPickup; + if (moduleItemPickup) { + float radius = Traverse.Create(moduleItemPickup).Field("m_PickupRange").GetValue() as float? ?? 0f; + return radius; + } + return 0f; + } + + private static void SetRadius(ModuleItemHolderBeam moduleItemHolderBeam, float value) { + ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderBeam).Field("m_Pickup").GetValue() as ModuleItemPickup; + if (moduleItemPickup) { + Traverse.Create(moduleItemPickup).Field("m_PickupRange").SetValue(value); + } + } + } } \ No newline at end of file diff --git a/Projects/HouseFlipper/HouseFlipper/Class1.cs b/Projects/HouseFlipper/HouseFlipper/Class1.cs index 9cc05d5..00f030e 100644 --- a/Projects/HouseFlipper/HouseFlipper/Class1.cs +++ b/Projects/HouseFlipper/HouseFlipper/Class1.cs @@ -1,121 +1,121 @@ -using System.Linq; -using BepInEx; -using BepInEx.Configuration; -using HarmonyLib; -using HarmonyLib.Tools; - -// TODO: Make shield and repair bigger -// TODO: Maybe make props faster, thrusters work fine - -namespace HouseFlipper { - [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 xpMultiplier; - public static ConfigEntry moneyMultiplier; - public static ConfigEntry energyGenMultiplier; - public static ConfigEntry heartbeatIntervalMultiplier; - public static ConfigEntry shootingSpeedMultiplier; - public static ConfigEntry muzzleVelocityMultiplier; - public static ConfigEntry allProjectilesHoming; - public static ConfigEntry magnetStrenghtMultiplier; - 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 static ConfigEntry seekingProjectileVisionConeAngleMultiplier; - public static ConfigEntry seekingProjectileVisionRangeMultiplier; - public static ConfigEntry seekingProjectileTurningSpeedMultiplier; - public static ConfigEntry wirelessChargingRadiusMultiplier; - public static ConfigEntry wirelessChargingPowerPerArcMultiplier; - public static ConfigEntry wirelessChargingArcFiringIntervalMultiplier; - - public void Awake() { - xpMultiplier = Config.Bind("General", "XP Multiplier", 1f, new ConfigDescription("XP Multiplier", new AcceptableValueRange(1f, 32f))); - moneyMultiplier = Config.Bind("General", "Money Multiplier", 1f, - new ConfigDescription("Money Multiplier", new AcceptableValueRange(1f, 32f))); - energyGenMultiplier = Config.Bind("General", "Energy Generation Multiplier", 1f, - new ConfigDescription("Energy Generation Multiplier", new AcceptableValueRange(1f, 64f))); - heartbeatIntervalMultiplier = Config.Bind("General", "Heartbeat Interval Multiplier", 1f, - new ConfigDescription("Heartbeat Interval Multiplier", new AcceptableValueRange(0.1f, 2f))); - - shootingSpeedMultiplier = Config.Bind("Weapons", "Shooting Speed Multiplier", 1f, - new ConfigDescription("Shooting Speed Multiplier", new AcceptableValueRange(0.2f, 8f))); - muzzleVelocityMultiplier = Config.Bind("Weapons", "Muzzle Velocity Multiplier", 1f, - new ConfigDescription("Muzzle Velocity Multiplier", new AcceptableValueRange(0.2f, 32f))); - seekingProjectileVisionConeAngleMultiplier = Config.Bind("Weapons", "Seeking Projectile Cone Vision Angle Multiplier", 1f, - new ConfigDescription("Seeking Projectile Cone Vision Angle Multiplier", new AcceptableValueRange(0.2f, 32f))); - seekingProjectileVisionRangeMultiplier = Config.Bind("Weapons", "Seeking Projectile Vision Range Multiplier", 1f, - new ConfigDescription("Seeking Projectile Vision Range Multiplier", new AcceptableValueRange(0.2f, 32f))); - seekingProjectileTurningSpeedMultiplier = Config.Bind("Weapons", "Seeking Projectile Turn Speed Multiplier", 1f, - new ConfigDescription("Seeking Projectile Turn Speed Multiplier", new AcceptableValueRange(0.2f, 32f))); - - magnetStrenghtMultiplier = Config.Bind("Attractors", "Magnet Strength Multiplier", 1f, - new ConfigDescription("Magnet Strength Multiplier", new AcceptableValueRange(1f, 16f))); - magnetRadiusMultiplier = Config.Bind("Attractors", "Magnet Radius Multiplier", 1f, - new ConfigDescription("Magnet Radius Multiplier", new AcceptableValueRange(1f, 16f))); - 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))); - - wirelessChargingRadiusMultiplier = Config.Bind("Power", "Wireless Charger Radius Multiplier", 1f, - new ConfigDescription("Wireless Charger Radius Multiplier", new AcceptableValueRange(0.2f, 16f))); - wirelessChargingArcFiringIntervalMultiplier = Config.Bind("Power", "Wireless Charger Arc Firing Interval", 1f, - new ConfigDescription("Wireless Charger Arc Firing Interval", new AcceptableValueRange(0.02f, 16f))); - wirelessChargingPowerPerArcMultiplier = Config.Bind("Power", "Wireless Charger Power Per Arc", 1f, - new ConfigDescription("Wireless Charger Power Per Arc", new AcceptableValueRange(0.2f, 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(); - wirelessChargingPowerPerArcMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); - wirelessChargingArcFiringIntervalMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); - wirelessChargingRadiusMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.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; + +// TODO: Make shield and repair bigger +// TODO: Maybe make props faster, thrusters work fine + +namespace HouseFlipper { + [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 xpMultiplier; + public static ConfigEntry moneyMultiplier; + public static ConfigEntry energyGenMultiplier; + public static ConfigEntry heartbeatIntervalMultiplier; + public static ConfigEntry shootingSpeedMultiplier; + public static ConfigEntry muzzleVelocityMultiplier; + public static ConfigEntry allProjectilesHoming; + public static ConfigEntry magnetStrenghtMultiplier; + 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 static ConfigEntry seekingProjectileVisionConeAngleMultiplier; + public static ConfigEntry seekingProjectileVisionRangeMultiplier; + public static ConfigEntry seekingProjectileTurningSpeedMultiplier; + public static ConfigEntry wirelessChargingRadiusMultiplier; + public static ConfigEntry wirelessChargingPowerPerArcMultiplier; + public static ConfigEntry wirelessChargingArcFiringIntervalMultiplier; + + public void Awake() { + xpMultiplier = Config.Bind("General", "XP Multiplier", 1f, new ConfigDescription("XP Multiplier", new AcceptableValueRange(1f, 32f))); + moneyMultiplier = Config.Bind("General", "Money Multiplier", 1f, + new ConfigDescription("Money Multiplier", new AcceptableValueRange(1f, 32f))); + energyGenMultiplier = Config.Bind("General", "Energy Generation Multiplier", 1f, + new ConfigDescription("Energy Generation Multiplier", new AcceptableValueRange(1f, 64f))); + heartbeatIntervalMultiplier = Config.Bind("General", "Heartbeat Interval Multiplier", 1f, + new ConfigDescription("Heartbeat Interval Multiplier", new AcceptableValueRange(0.1f, 2f))); + + shootingSpeedMultiplier = Config.Bind("Weapons", "Shooting Speed Multiplier", 1f, + new ConfigDescription("Shooting Speed Multiplier", new AcceptableValueRange(0.2f, 8f))); + muzzleVelocityMultiplier = Config.Bind("Weapons", "Muzzle Velocity Multiplier", 1f, + new ConfigDescription("Muzzle Velocity Multiplier", new AcceptableValueRange(0.2f, 32f))); + seekingProjectileVisionConeAngleMultiplier = Config.Bind("Weapons", "Seeking Projectile Cone Vision Angle Multiplier", 1f, + new ConfigDescription("Seeking Projectile Cone Vision Angle Multiplier", new AcceptableValueRange(0.2f, 32f))); + seekingProjectileVisionRangeMultiplier = Config.Bind("Weapons", "Seeking Projectile Vision Range Multiplier", 1f, + new ConfigDescription("Seeking Projectile Vision Range Multiplier", new AcceptableValueRange(0.2f, 32f))); + seekingProjectileTurningSpeedMultiplier = Config.Bind("Weapons", "Seeking Projectile Turn Speed Multiplier", 1f, + new ConfigDescription("Seeking Projectile Turn Speed Multiplier", new AcceptableValueRange(0.2f, 32f))); + + magnetStrenghtMultiplier = Config.Bind("Attractors", "Magnet Strength Multiplier", 1f, + new ConfigDescription("Magnet Strength Multiplier", new AcceptableValueRange(1f, 16f))); + magnetRadiusMultiplier = Config.Bind("Attractors", "Magnet Radius Multiplier", 1f, + new ConfigDescription("Magnet Radius Multiplier", new AcceptableValueRange(1f, 16f))); + 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))); + + wirelessChargingRadiusMultiplier = Config.Bind("Power", "Wireless Charger Radius Multiplier", 1f, + new ConfigDescription("Wireless Charger Radius Multiplier", new AcceptableValueRange(0.2f, 16f))); + wirelessChargingArcFiringIntervalMultiplier = Config.Bind("Power", "Wireless Charger Arc Firing Interval", 1f, + new ConfigDescription("Wireless Charger Arc Firing Interval", new AcceptableValueRange(0.02f, 16f))); + wirelessChargingPowerPerArcMultiplier = Config.Bind("Power", "Wireless Charger Power Per Arc", 1f, + new ConfigDescription("Wireless Charger Power Per Arc", new AcceptableValueRange(0.2f, 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(); + wirelessChargingPowerPerArcMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); + wirelessChargingArcFiringIntervalMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); + wirelessChargingRadiusMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.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"); + } + } } \ No newline at end of file diff --git a/Projects/HouseFlipper/HouseFlipper/FuelPropertiesManager.cs b/Projects/HouseFlipper/HouseFlipper/FuelPropertiesManager.cs index 7aa9140..6246ca8 100644 --- a/Projects/HouseFlipper/HouseFlipper/FuelPropertiesManager.cs +++ b/Projects/HouseFlipper/HouseFlipper/FuelPropertiesManager.cs @@ -1,55 +1,55 @@ -using System; -using System.Collections.Generic; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class FuelPropertiesManager { - private static Dictionary refillRate = new Dictionary(); - private static Dictionary capacity = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleFuelTank), "OnAttached")] - static void PostfixCreate(ModuleFuelTank __instance) { - // Console.WriteLine("ModuleFuelTank.OnAttached"); - if (!refillRate.ContainsKey(__instance)) { - refillRate.Add(__instance, __instance.m_RefillRate); - capacity.Add(__instance, __instance.m_Capacity); - // Console.WriteLine("Patching {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleFuelTank), "OnDetaching")] - static void PostfixDestroy(ModuleFuelTank __instance) { - // Console.WriteLine("ModuleFuelTank.OnAttached"); - // Console.WriteLine("Restoring {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - refillRate.Remove(__instance); - capacity.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleFuelTank", refillRate.Count); - foreach (KeyValuePair keyValuePair in refillRate) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleFuelTank moduleFuelTank) { - moduleFuelTank.m_RefillRate = refillRate[moduleFuelTank] * Main.fuelTankRefillMultiplier.Value; - moduleFuelTank.m_Capacity = capacity[moduleFuelTank] * Main.fuelTankCapacityMultiplier.Value; - } - - static void DoRestoreSingle(ModuleFuelTank moduleFuelTank) { - if (refillRate.ContainsKey(moduleFuelTank)) { - moduleFuelTank.m_RefillRate = refillRate[moduleFuelTank]; - moduleFuelTank.m_Capacity = capacity[moduleFuelTank]; - } - } - } +using System; +using System.Collections.Generic; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class FuelPropertiesManager { + private static Dictionary refillRate = new Dictionary(); + private static Dictionary capacity = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleFuelTank), "OnAttached")] + static void PostfixCreate(ModuleFuelTank __instance) { + // Console.WriteLine("ModuleFuelTank.OnAttached"); + if (!refillRate.ContainsKey(__instance)) { + refillRate.Add(__instance, __instance.m_RefillRate); + capacity.Add(__instance, __instance.m_Capacity); + // Console.WriteLine("Patching {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleFuelTank), "OnDetaching")] + static void PostfixDestroy(ModuleFuelTank __instance) { + // Console.WriteLine("ModuleFuelTank.OnAttached"); + // Console.WriteLine("Restoring {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + refillRate.Remove(__instance); + capacity.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleFuelTank", refillRate.Count); + foreach (KeyValuePair keyValuePair in refillRate) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleFuelTank moduleFuelTank) { + moduleFuelTank.m_RefillRate = refillRate[moduleFuelTank] * Main.fuelTankRefillMultiplier.Value; + moduleFuelTank.m_Capacity = capacity[moduleFuelTank] * Main.fuelTankCapacityMultiplier.Value; + } + + static void DoRestoreSingle(ModuleFuelTank moduleFuelTank) { + if (refillRate.ContainsKey(moduleFuelTank)) { + moduleFuelTank.m_RefillRate = refillRate[moduleFuelTank]; + moduleFuelTank.m_Capacity = capacity[moduleFuelTank]; + } + } + } } \ No newline at end of file diff --git a/Projects/HouseFlipper/HouseFlipper/GeneratorPropertiesManager.cs b/Projects/HouseFlipper/HouseFlipper/GeneratorPropertiesManager.cs index 3dd068f..dfd6ed0 100644 --- a/Projects/HouseFlipper/HouseFlipper/GeneratorPropertiesManager.cs +++ b/Projects/HouseFlipper/HouseFlipper/GeneratorPropertiesManager.cs @@ -1,58 +1,58 @@ -using System; -using System.Collections.Generic; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class GeneratorPropertiesManager { - private static Dictionary generators = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleEnergy), "OnAttached")] - static void PostfixCreate(ModuleEnergy __instance) { - // Console.WriteLine("ModuleEnergy.OnAttached"); - if (!generators.ContainsKey(__instance)) { - generators.Add(__instance, GetValue(__instance)); - // Console.WriteLine("Patching {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleEnergy), "OnDetaching")] - static void PostfixDestroy(ModuleEnergy __instance) { - // Console.WriteLine("ModuleEnergy.OnDetaching"); - // Console.WriteLine("Restoring {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); - generators.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleEnergy", generators.Count); - foreach (KeyValuePair keyValuePair in generators) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleEnergy moduleEnergy) { - SetValue(moduleEnergy, generators[moduleEnergy] * Main.energyGenMultiplier.Value); - } - - static void DoRestoreSingle(ModuleEnergy moduleEnergy) { - if (generators.ContainsKey(moduleEnergy)) { - SetValue(moduleEnergy, generators[moduleEnergy]); - } - } - - private static float GetValue(ModuleEnergy moduleEnergy) { - return Traverse.Create(moduleEnergy).Field("m_OutputPerSecond").GetValue() as float? ?? 0f; - } - - private static void SetValue(ModuleEnergy moduleEnergy, float value) { - Traverse.Create(moduleEnergy).Field("m_OutputPerSecond").SetValue(value); - } - } +using System; +using System.Collections.Generic; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class GeneratorPropertiesManager { + private static Dictionary generators = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleEnergy), "OnAttached")] + static void PostfixCreate(ModuleEnergy __instance) { + // Console.WriteLine("ModuleEnergy.OnAttached"); + if (!generators.ContainsKey(__instance)) { + generators.Add(__instance, GetValue(__instance)); + // Console.WriteLine("Patching {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleEnergy), "OnDetaching")] + static void PostfixDestroy(ModuleEnergy __instance) { + // Console.WriteLine("ModuleEnergy.OnDetaching"); + // Console.WriteLine("Restoring {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); + generators.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleEnergy", generators.Count); + foreach (KeyValuePair keyValuePair in generators) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleEnergy moduleEnergy) { + SetValue(moduleEnergy, generators[moduleEnergy] * Main.energyGenMultiplier.Value); + } + + static void DoRestoreSingle(ModuleEnergy moduleEnergy) { + if (generators.ContainsKey(moduleEnergy)) { + SetValue(moduleEnergy, generators[moduleEnergy]); + } + } + + private static float GetValue(ModuleEnergy moduleEnergy) { + return Traverse.Create(moduleEnergy).Field("m_OutputPerSecond").GetValue() as float? ?? 0f; + } + + private static void SetValue(ModuleEnergy moduleEnergy, float value) { + Traverse.Create(moduleEnergy).Field("m_OutputPerSecond").SetValue(value); + } + } } \ No newline at end of file diff --git a/Projects/HouseFlipper/HouseFlipper/HomingAndVelocityProjectilePatch.cs b/Projects/HouseFlipper/HouseFlipper/HomingAndVelocityProjectilePatch.cs index b88dca9..cc8bbbe 100644 --- a/Projects/HouseFlipper/HouseFlipper/HomingAndVelocityProjectilePatch.cs +++ b/Projects/HouseFlipper/HouseFlipper/HomingAndVelocityProjectilePatch.cs @@ -1,22 +1,22 @@ -using System.Collections.Generic; -using HarmonyLib; -using UnityEngine; - -namespace TerraTech { - [HarmonyPatch(typeof(Projectile), "Fire")] - public class HomingAndVelocityProjectilePatch { - private static Dictionary velocities = new Dictionary(); - - static void Prefix(Vector3 fireDirection, ref FireData fireData, ref ModuleWeaponGun weapon, Tank shooter, ref bool seekingRounds, bool replayRounds) { - if (Main.allProjectilesHoming.Value) { - seekingRounds = true; - } - if (!velocities.ContainsKey(fireData)) { - velocities.Add(fireData, fireData.m_MuzzleVelocity); - fireData.m_MuzzleVelocity *= Main.muzzleVelocityMultiplier.Value; - } else if (velocities[fireData] != fireData.m_MuzzleVelocity * Main.muzzleVelocityMultiplier.Value) { - fireData.m_MuzzleVelocity = velocities[fireData] * Main.muzzleVelocityMultiplier.Value; - } - } - } +using System.Collections.Generic; +using HarmonyLib; +using UnityEngine; + +namespace TerraTech { + [HarmonyPatch(typeof(Projectile), "Fire")] + public class HomingAndVelocityProjectilePatch { + private static Dictionary velocities = new Dictionary(); + + static void Prefix(Vector3 fireDirection, ref FireData fireData, ref ModuleWeaponGun weapon, Tank shooter, ref bool seekingRounds, bool replayRounds) { + if (Main.allProjectilesHoming.Value) { + seekingRounds = true; + } + if (!velocities.ContainsKey(fireData)) { + velocities.Add(fireData, fireData.m_MuzzleVelocity); + fireData.m_MuzzleVelocity *= Main.muzzleVelocityMultiplier.Value; + } else if (velocities[fireData] != fireData.m_MuzzleVelocity * Main.muzzleVelocityMultiplier.Value) { + fireData.m_MuzzleVelocity = velocities[fireData] * Main.muzzleVelocityMultiplier.Value; + } + } + } } \ No newline at end of file diff --git a/Projects/HouseFlipper/HouseFlipper/HouseFlipper.csproj b/Projects/HouseFlipper/HouseFlipper/HouseFlipper.csproj index 257846a..046b7c3 100644 --- a/Projects/HouseFlipper/HouseFlipper/HouseFlipper.csproj +++ b/Projects/HouseFlipper/HouseFlipper/HouseFlipper.csproj @@ -1,78 +1,78 @@ - - - - - Debug - AnyCPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE} - Library - Properties - TerraTech - TerraTech - v4.8 - 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\UnityEngine.dll - - - ..\libs\UnityEngine.CoreModule.dll - - - - + + + + + Debug + AnyCPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE} + Library + Properties + TerraTech + TerraTech + v4.8 + 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\UnityEngine.dll + + + ..\libs\UnityEngine.CoreModule.dll + + + + \ No newline at end of file diff --git a/Projects/HouseFlipper/HouseFlipper/MagnetPropertiesManager.cs b/Projects/HouseFlipper/HouseFlipper/MagnetPropertiesManager.cs index 121beb4..23a74c1 100644 --- a/Projects/HouseFlipper/HouseFlipper/MagnetPropertiesManager.cs +++ b/Projects/HouseFlipper/HouseFlipper/MagnetPropertiesManager.cs @@ -1,81 +1,81 @@ -using System; -using System.Collections.Generic; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class MagnetPropertiesManager { - private static Dictionary strenghts = new Dictionary(); - private static Dictionary radii = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleItemHolderMagnet), "OnAttached")] - static void PostfixCreate(ModuleItemHolderMagnet __instance) { - // Console.WriteLine("ModuleItemHolderMagnet.OnAttached"); - if (!strenghts.ContainsKey(__instance)) { - strenghts.Add(__instance, GetStrength(__instance)); - radii.Add(__instance, GetRadius(__instance)); - // Console.WriteLine("Patching {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleItemHolderMagnet), "OnDetaching")] - static void PostfixDestroy(ModuleItemHolderMagnet __instance) { - // Console.WriteLine("ModuleItemHolderMagnet.OnDetaching"); - // Console.WriteLine("Restoring {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - strenghts.Remove(__instance); - radii.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleItemHolderMagnet", strenghts.Count); - foreach (KeyValuePair keyValuePair in strenghts) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleItemHolderMagnet moduleItemHolderMagnet) { - SetStrength(moduleItemHolderMagnet, strenghts[moduleItemHolderMagnet] * Main.magnetStrenghtMultiplier.Value); - SetRadius(moduleItemHolderMagnet, radii[moduleItemHolderMagnet] * Main.magnetRadiusMultiplier.Value); - } - - static void DoRestoreSingle(ModuleItemHolderMagnet moduleItemHolderMagnet) { - if (strenghts.ContainsKey(moduleItemHolderMagnet)) { - SetStrength(moduleItemHolderMagnet, strenghts[moduleItemHolderMagnet]); - } - if (radii.ContainsKey(moduleItemHolderMagnet)) { - SetRadius(moduleItemHolderMagnet, radii[moduleItemHolderMagnet]); - } - } - - private static float GetStrength(ModuleItemHolderMagnet moduleItemHolderMagnet) { - return Traverse.Create(moduleItemHolderMagnet).Field("m_Strength").GetValue() as float? ?? 0f; - } - - private static void SetStrength(ModuleItemHolderMagnet moduleItemHolderMagnet, float value) { - Traverse.Create(moduleItemHolderMagnet).Field("m_Strength").SetValue(value); - } - - private static float GetRadius(ModuleItemHolderMagnet moduleItemHolderMagnet) { - ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderMagnet).Field("m_Pickup").GetValue() as ModuleItemPickup; - if (moduleItemPickup) { - float radius = Traverse.Create(moduleItemPickup).Field("m_PickupRange").GetValue() as float? ?? 0f; - return radius; - } - return 0f; - } - - private static void SetRadius(ModuleItemHolderMagnet moduleItemHolderMagnet, float value) { - ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderMagnet).Field("m_Pickup").GetValue() as ModuleItemPickup; - if (moduleItemPickup) { - Traverse.Create(moduleItemPickup).Field("m_PickupRange").SetValue(value); - } - } - } +using System; +using System.Collections.Generic; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class MagnetPropertiesManager { + private static Dictionary strenghts = new Dictionary(); + private static Dictionary radii = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemHolderMagnet), "OnAttached")] + static void PostfixCreate(ModuleItemHolderMagnet __instance) { + // Console.WriteLine("ModuleItemHolderMagnet.OnAttached"); + if (!strenghts.ContainsKey(__instance)) { + strenghts.Add(__instance, GetStrength(__instance)); + radii.Add(__instance, GetRadius(__instance)); + // Console.WriteLine("Patching {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemHolderMagnet), "OnDetaching")] + static void PostfixDestroy(ModuleItemHolderMagnet __instance) { + // Console.WriteLine("ModuleItemHolderMagnet.OnDetaching"); + // Console.WriteLine("Restoring {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + strenghts.Remove(__instance); + radii.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleItemHolderMagnet", strenghts.Count); + foreach (KeyValuePair keyValuePair in strenghts) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleItemHolderMagnet moduleItemHolderMagnet) { + SetStrength(moduleItemHolderMagnet, strenghts[moduleItemHolderMagnet] * Main.magnetStrenghtMultiplier.Value); + SetRadius(moduleItemHolderMagnet, radii[moduleItemHolderMagnet] * Main.magnetRadiusMultiplier.Value); + } + + static void DoRestoreSingle(ModuleItemHolderMagnet moduleItemHolderMagnet) { + if (strenghts.ContainsKey(moduleItemHolderMagnet)) { + SetStrength(moduleItemHolderMagnet, strenghts[moduleItemHolderMagnet]); + } + if (radii.ContainsKey(moduleItemHolderMagnet)) { + SetRadius(moduleItemHolderMagnet, radii[moduleItemHolderMagnet]); + } + } + + private static float GetStrength(ModuleItemHolderMagnet moduleItemHolderMagnet) { + return Traverse.Create(moduleItemHolderMagnet).Field("m_Strength").GetValue() as float? ?? 0f; + } + + private static void SetStrength(ModuleItemHolderMagnet moduleItemHolderMagnet, float value) { + Traverse.Create(moduleItemHolderMagnet).Field("m_Strength").SetValue(value); + } + + private static float GetRadius(ModuleItemHolderMagnet moduleItemHolderMagnet) { + ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderMagnet).Field("m_Pickup").GetValue() as ModuleItemPickup; + if (moduleItemPickup) { + float radius = Traverse.Create(moduleItemPickup).Field("m_PickupRange").GetValue() as float? ?? 0f; + return radius; + } + return 0f; + } + + private static void SetRadius(ModuleItemHolderMagnet moduleItemHolderMagnet, float value) { + ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderMagnet).Field("m_Pickup").GetValue() as ModuleItemPickup; + if (moduleItemPickup) { + Traverse.Create(moduleItemPickup).Field("m_PickupRange").SetValue(value); + } + } + } } \ No newline at end of file diff --git a/Projects/HouseFlipper/HouseFlipper/MinerPropertiesManager.cs b/Projects/HouseFlipper/HouseFlipper/MinerPropertiesManager.cs index 090e47b..4335a10 100644 --- a/Projects/HouseFlipper/HouseFlipper/MinerPropertiesManager.cs +++ b/Projects/HouseFlipper/HouseFlipper/MinerPropertiesManager.cs @@ -1,86 +1,86 @@ -using System; -using System.Collections.Generic; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class MinerPropertiesManager { - private static Dictionary area = new Dictionary(); - private static Dictionary speed = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleItemProducer), "GetClosestResourceReservoirInRange")] - static void PostfixCreate(ModuleItemProducer __instance) { - // Console.WriteLine("ModuleItemProducer.GetClosestResourceReservoirInRange"); - if (!area.ContainsKey(__instance)) { - area.Add(__instance, GetArea(__instance)); - speed.Add(__instance, GetSpeed(__instance)); - // Console.WriteLine("Patching {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), - // GetSpeed(__instance)); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), - // GetSpeed(__instance)); - } else { - if (GetArea(__instance) == area[__instance]) { - // Console.WriteLine("{0} area reset, patching again... m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, - // GetArea(__instance), GetSpeed(__instance)); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), - // GetSpeed(__instance)); - } - if (GetSpeed(__instance) == speed[__instance]) { - // Console.WriteLine("{0} speed reset, patching again... m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, - // GetArea(__instance), GetSpeed(__instance)); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), - // GetSpeed(__instance)); - } - } - } - - [HarmonyPostfix] - [HarmonyPatch(typeof(ModuleItemProducer), "OnDetaching")] - static void PostfixDestroy(ModuleItemProducer __instance) { - // Console.WriteLine("ModuleItemProducer.OnRecycle"); - DoRestoreSingle(__instance); - area.Remove(__instance); - speed.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleItemProducer", area.Count); - foreach (KeyValuePair keyValuePair in area) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleItemProducer moduleItemProducer) { - SetArea(moduleItemProducer, area[moduleItemProducer] * Main.minerGroundArea.Value); - SetSpeed(moduleItemProducer, speed[moduleItemProducer] / Main.minerMiningSpeed.Value); - } - - static void DoRestoreSingle(ModuleItemProducer moduleItemProducer) { - if (area.ContainsKey(moduleItemProducer)) { - SetArea(moduleItemProducer, area[moduleItemProducer]); - SetSpeed(moduleItemProducer, speed[moduleItemProducer]); - } - } - - private static float GetArea(ModuleItemProducer moduleItemProducer) { - return Traverse.Create(moduleItemProducer).Field("m_ResourceGroundRadius").GetValue() as float? ?? 0f; - } - - private static void SetArea(ModuleItemProducer moduleItemProducer, float value) { - Traverse.Create(moduleItemProducer).Field("m_ResourceGroundRadius").SetValue(value); - } - - private static float GetSpeed(ModuleItemProducer moduleItemProducer) { - return Traverse.Create(moduleItemProducer).Field("m_SecPerItemProduced").GetValue() as float? ?? 0f; - } - - private static void SetSpeed(ModuleItemProducer moduleItemProducer, float value) { - Traverse.Create(moduleItemProducer).Field("m_SecPerItemProduced").SetValue(value); - } - } +using System; +using System.Collections.Generic; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class MinerPropertiesManager { + private static Dictionary area = new Dictionary(); + private static Dictionary speed = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemProducer), "GetClosestResourceReservoirInRange")] + static void PostfixCreate(ModuleItemProducer __instance) { + // Console.WriteLine("ModuleItemProducer.GetClosestResourceReservoirInRange"); + if (!area.ContainsKey(__instance)) { + area.Add(__instance, GetArea(__instance)); + speed.Add(__instance, GetSpeed(__instance)); + // Console.WriteLine("Patching {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), + // GetSpeed(__instance)); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), + // GetSpeed(__instance)); + } else { + if (GetArea(__instance) == area[__instance]) { + // Console.WriteLine("{0} area reset, patching again... m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, + // GetArea(__instance), GetSpeed(__instance)); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), + // GetSpeed(__instance)); + } + if (GetSpeed(__instance) == speed[__instance]) { + // Console.WriteLine("{0} speed reset, patching again... m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, + // GetArea(__instance), GetSpeed(__instance)); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), + // GetSpeed(__instance)); + } + } + } + + [HarmonyPostfix] + [HarmonyPatch(typeof(ModuleItemProducer), "OnDetaching")] + static void PostfixDestroy(ModuleItemProducer __instance) { + // Console.WriteLine("ModuleItemProducer.OnRecycle"); + DoRestoreSingle(__instance); + area.Remove(__instance); + speed.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleItemProducer", area.Count); + foreach (KeyValuePair keyValuePair in area) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleItemProducer moduleItemProducer) { + SetArea(moduleItemProducer, area[moduleItemProducer] * Main.minerGroundArea.Value); + SetSpeed(moduleItemProducer, speed[moduleItemProducer] / Main.minerMiningSpeed.Value); + } + + static void DoRestoreSingle(ModuleItemProducer moduleItemProducer) { + if (area.ContainsKey(moduleItemProducer)) { + SetArea(moduleItemProducer, area[moduleItemProducer]); + SetSpeed(moduleItemProducer, speed[moduleItemProducer]); + } + } + + private static float GetArea(ModuleItemProducer moduleItemProducer) { + return Traverse.Create(moduleItemProducer).Field("m_ResourceGroundRadius").GetValue() as float? ?? 0f; + } + + private static void SetArea(ModuleItemProducer moduleItemProducer, float value) { + Traverse.Create(moduleItemProducer).Field("m_ResourceGroundRadius").SetValue(value); + } + + private static float GetSpeed(ModuleItemProducer moduleItemProducer) { + return Traverse.Create(moduleItemProducer).Field("m_SecPerItemProduced").GetValue() as float? ?? 0f; + } + + private static void SetSpeed(ModuleItemProducer moduleItemProducer, float value) { + Traverse.Create(moduleItemProducer).Field("m_SecPerItemProduced").SetValue(value); + } + } } \ No newline at end of file diff --git a/Projects/HouseFlipper/HouseFlipper/Patches.cs b/Projects/HouseFlipper/HouseFlipper/Patches.cs index 8bc5ea8..99769e9 100644 --- a/Projects/HouseFlipper/HouseFlipper/Patches.cs +++ b/Projects/HouseFlipper/HouseFlipper/Patches.cs @@ -1,24 +1,24 @@ -using HarmonyLib; - -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); - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ManPlayer), "AddMoney")] - static void MoneyMulti(ref int amount) { - amount = (int)(amount * Main.moneyMultiplier.Value); - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(TechHolders), "SetHeartbeatInterval")] - static void HeartbeatMulti(ref float interval) { - interval *= Main.heartbeatIntervalMultiplier.Value; - } - } +using HarmonyLib; + +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); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ManPlayer), "AddMoney")] + static void MoneyMulti(ref int amount) { + amount = (int)(amount * Main.moneyMultiplier.Value); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(TechHolders), "SetHeartbeatInterval")] + static void HeartbeatMulti(ref float interval) { + interval *= Main.heartbeatIntervalMultiplier.Value; + } + } } \ No newline at end of file diff --git a/Projects/HouseFlipper/HouseFlipper/Properties/AssemblyInfo.cs b/Projects/HouseFlipper/HouseFlipper/Properties/AssemblyInfo.cs index ca6f22b..e5c11ac 100644 --- a/Projects/HouseFlipper/HouseFlipper/Properties/AssemblyInfo.cs +++ b/Projects/HouseFlipper/HouseFlipper/Properties/AssemblyInfo.cs @@ -1,35 +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("TerraTech")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("TerraTech")] -[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("EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE")] - -// 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")] +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("TerraTech")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("TerraTech")] +[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("EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE")] + +// 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/HouseFlipper/HouseFlipper/SeekingProjectileManager.cs b/Projects/HouseFlipper/HouseFlipper/SeekingProjectileManager.cs index 7a41c5a..b0e1c63 100644 --- a/Projects/HouseFlipper/HouseFlipper/SeekingProjectileManager.cs +++ b/Projects/HouseFlipper/HouseFlipper/SeekingProjectileManager.cs @@ -1,24 +1,24 @@ -using System; -using HarmonyLib; - -namespace TerraTech { - public class SeekingProjectileManager { - [HarmonyPatch(typeof(SeekingProjectile), "OnSpawn")] - class Patch { - static void Postfix(SeekingProjectile __instance) { - Console.WriteLine("SeekingProjectile created"); - SetField(__instance, "m_VisionConeAngle", Main.seekingProjectileVisionConeAngleMultiplier.Value * GetField(__instance, "m_VisionConeAngle")); - SetField(__instance, "m_VisionRange", Main.seekingProjectileVisionRangeMultiplier.Value * GetField(__instance, "m_VisionRange")); - SetField(__instance, "m_TurnSpeed", Main.seekingProjectileTurningSpeedMultiplier.Value * GetField(__instance, "m_TurnSpeed")); - } - } - - private static float GetField(SeekingProjectile seekingProjectile, string field) { - return Traverse.Create(seekingProjectile).Field(field).GetValue() as float? ?? 0f; - } - - private static void SetField(SeekingProjectile seekingProjectile, string field, float value) { - Traverse.Create(seekingProjectile).Field(field).SetValue(value); - } - } +using System; +using HarmonyLib; + +namespace TerraTech { + public class SeekingProjectileManager { + [HarmonyPatch(typeof(SeekingProjectile), "OnSpawn")] + class Patch { + static void Postfix(SeekingProjectile __instance) { + Console.WriteLine("SeekingProjectile created"); + SetField(__instance, "m_VisionConeAngle", Main.seekingProjectileVisionConeAngleMultiplier.Value * GetField(__instance, "m_VisionConeAngle")); + SetField(__instance, "m_VisionRange", Main.seekingProjectileVisionRangeMultiplier.Value * GetField(__instance, "m_VisionRange")); + SetField(__instance, "m_TurnSpeed", Main.seekingProjectileTurningSpeedMultiplier.Value * GetField(__instance, "m_TurnSpeed")); + } + } + + private static float GetField(SeekingProjectile seekingProjectile, string field) { + return Traverse.Create(seekingProjectile).Field(field).GetValue() as float? ?? 0f; + } + + private static void SetField(SeekingProjectile seekingProjectile, string field, float value) { + Traverse.Create(seekingProjectile).Field(field).SetValue(value); + } + } } \ No newline at end of file diff --git a/Projects/HouseFlipper/HouseFlipper/ThrusterPropertiesManager.cs b/Projects/HouseFlipper/HouseFlipper/ThrusterPropertiesManager.cs index 7443f17..0b45476 100644 --- a/Projects/HouseFlipper/HouseFlipper/ThrusterPropertiesManager.cs +++ b/Projects/HouseFlipper/HouseFlipper/ThrusterPropertiesManager.cs @@ -1,89 +1,89 @@ -using System; -using System.Collections.Generic; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class ThrusterPropertiesManager { - private static Dictionary> boosters = new Dictionary>(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleBooster), "OnAttached")] - static void PostfixCreate(ModuleBooster __instance) { - // Console.WriteLine("ModuleBooster.OnAttached"); - if (!boosters.ContainsKey(__instance)) { - boosters.Add(__instance, Map(__instance)); - // Console.WriteLine("Patching {0}; force: {1}", __instance.name, GetForceAsString(__instance)); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; force: {1}", __instance.name, GetForceAsString(__instance)); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleBooster), "OnDetaching")] - static void PostfixDestroy(ModuleBooster __instance) { - // Console.WriteLine("ModuleBooster.OnDetaching"); - // Console.WriteLine("Restoring {0}; force: {1}", __instance.name, GetForceAsString(__instance)); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; force: {1}", __instance.name, GetForceAsString(__instance)); - boosters.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleBooster", boosters.Count); - foreach (KeyValuePair> keyValuePair in boosters) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleBooster moduleBooster) { - List jets = GetValue(moduleBooster); - for (var i = 0; i < jets.Count; i++) { - boosters[moduleBooster][jets[i]] = GetValue(jets[i]); - SetValue(jets[i], GetValue(jets[i]) * Main.jetThrustMultiplier.Value); - } - SetValue(moduleBooster, jets); - } - - static void DoRestoreSingle(ModuleBooster moduleBooster) { - if (boosters.ContainsKey(moduleBooster)) { - foreach (BoosterJet boosterJet in GetValue(moduleBooster)) { - SetValue(boosterJet, boosters[moduleBooster][boosterJet]); - } - } - } - - private static Dictionary Map(ModuleBooster moduleBooster) { - Dictionary jets = new Dictionary(); - foreach (BoosterJet boosterJet in GetValue(moduleBooster)) { - jets.Add(boosterJet, GetValue(boosterJet)); - } - return jets; - } - - private static List GetValue(ModuleBooster moduleBooster) { - return Traverse.Create(moduleBooster).Field("jets").GetValue() as List; - } - - private static void SetValue(ModuleBooster moduleBooster, List value) { - Traverse.Create(moduleBooster).Field("jets").SetValue(value); - } - - private static float GetValue(BoosterJet boosterJet) { - return Traverse.Create(boosterJet).Field("m_Force").GetValue() as float? ?? 0f; - } - - private static void SetValue(BoosterJet boosterJet, float value) { - Traverse.Create(boosterJet).Field("m_Force").SetValue(value); - } - - private static string GetForceAsString(ModuleBooster moduleBooster) { - string result = ""; - foreach (BoosterJet boosterJet in GetValue(moduleBooster)) { - result += GetValue(boosterJet) + ", "; - } - return result; - } - } +using System; +using System.Collections.Generic; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class ThrusterPropertiesManager { + private static Dictionary> boosters = new Dictionary>(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleBooster), "OnAttached")] + static void PostfixCreate(ModuleBooster __instance) { + // Console.WriteLine("ModuleBooster.OnAttached"); + if (!boosters.ContainsKey(__instance)) { + boosters.Add(__instance, Map(__instance)); + // Console.WriteLine("Patching {0}; force: {1}", __instance.name, GetForceAsString(__instance)); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; force: {1}", __instance.name, GetForceAsString(__instance)); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleBooster), "OnDetaching")] + static void PostfixDestroy(ModuleBooster __instance) { + // Console.WriteLine("ModuleBooster.OnDetaching"); + // Console.WriteLine("Restoring {0}; force: {1}", __instance.name, GetForceAsString(__instance)); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; force: {1}", __instance.name, GetForceAsString(__instance)); + boosters.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleBooster", boosters.Count); + foreach (KeyValuePair> keyValuePair in boosters) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleBooster moduleBooster) { + List jets = GetValue(moduleBooster); + for (var i = 0; i < jets.Count; i++) { + boosters[moduleBooster][jets[i]] = GetValue(jets[i]); + SetValue(jets[i], GetValue(jets[i]) * Main.jetThrustMultiplier.Value); + } + SetValue(moduleBooster, jets); + } + + static void DoRestoreSingle(ModuleBooster moduleBooster) { + if (boosters.ContainsKey(moduleBooster)) { + foreach (BoosterJet boosterJet in GetValue(moduleBooster)) { + SetValue(boosterJet, boosters[moduleBooster][boosterJet]); + } + } + } + + private static Dictionary Map(ModuleBooster moduleBooster) { + Dictionary jets = new Dictionary(); + foreach (BoosterJet boosterJet in GetValue(moduleBooster)) { + jets.Add(boosterJet, GetValue(boosterJet)); + } + return jets; + } + + private static List GetValue(ModuleBooster moduleBooster) { + return Traverse.Create(moduleBooster).Field("jets").GetValue() as List; + } + + private static void SetValue(ModuleBooster moduleBooster, List value) { + Traverse.Create(moduleBooster).Field("jets").SetValue(value); + } + + private static float GetValue(BoosterJet boosterJet) { + return Traverse.Create(boosterJet).Field("m_Force").GetValue() as float? ?? 0f; + } + + private static void SetValue(BoosterJet boosterJet, float value) { + Traverse.Create(boosterJet).Field("m_Force").SetValue(value); + } + + private static string GetForceAsString(ModuleBooster moduleBooster) { + string result = ""; + foreach (BoosterJet boosterJet in GetValue(moduleBooster)) { + result += GetValue(boosterJet) + ", "; + } + return result; + } + } } \ No newline at end of file diff --git a/Projects/HouseFlipper/HouseFlipper/WeaponPropertiesManager.cs b/Projects/HouseFlipper/HouseFlipper/WeaponPropertiesManager.cs index c48c2c4..50dc882 100644 --- a/Projects/HouseFlipper/HouseFlipper/WeaponPropertiesManager.cs +++ b/Projects/HouseFlipper/HouseFlipper/WeaponPropertiesManager.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using BepInEx.Configuration; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class WeaponPropertiesManager { - private static Dictionary shotCooldown = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleWeaponGun), "OnAttached")] - static void PostfixCreate(ModuleWeaponGun __instance) { - // Console.WriteLine("ModuleWeaponGun.OnAttached"); - if (!shotCooldown.ContainsKey(__instance)) { - shotCooldown.Add(__instance, __instance.m_ShotCooldown); - // Console.WriteLine("Patching {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleWeaponGun), "OnDetaching")] - static void PostfixDestroy(ModuleWeaponGun __instance) { - // Console.WriteLine("ModuleWeaponGun.OnDetaching"); - // Console.WriteLine("Restoring {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); - shotCooldown.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleWeaponGun", shotCooldown.Count); - foreach (KeyValuePair keyValuePair in shotCooldown) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleWeaponGun moduleWeaponGun) { - moduleWeaponGun.m_ShotCooldown = shotCooldown[moduleWeaponGun] / Main.shootingSpeedMultiplier.Value; - } - - static void DoRestoreSingle(ModuleWeaponGun moduleWeaponGun) { - if (shotCooldown.ContainsKey(moduleWeaponGun)) { - moduleWeaponGun.m_ShotCooldown = shotCooldown[moduleWeaponGun]; - } - } - } +using System; +using System.Collections.Generic; +using BepInEx.Configuration; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class WeaponPropertiesManager { + private static Dictionary shotCooldown = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWeaponGun), "OnAttached")] + static void PostfixCreate(ModuleWeaponGun __instance) { + // Console.WriteLine("ModuleWeaponGun.OnAttached"); + if (!shotCooldown.ContainsKey(__instance)) { + shotCooldown.Add(__instance, __instance.m_ShotCooldown); + // Console.WriteLine("Patching {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWeaponGun), "OnDetaching")] + static void PostfixDestroy(ModuleWeaponGun __instance) { + // Console.WriteLine("ModuleWeaponGun.OnDetaching"); + // Console.WriteLine("Restoring {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); + shotCooldown.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleWeaponGun", shotCooldown.Count); + foreach (KeyValuePair keyValuePair in shotCooldown) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleWeaponGun moduleWeaponGun) { + moduleWeaponGun.m_ShotCooldown = shotCooldown[moduleWeaponGun] / Main.shootingSpeedMultiplier.Value; + } + + static void DoRestoreSingle(ModuleWeaponGun moduleWeaponGun) { + if (shotCooldown.ContainsKey(moduleWeaponGun)) { + moduleWeaponGun.m_ShotCooldown = shotCooldown[moduleWeaponGun]; + } + } + } } \ No newline at end of file diff --git a/Projects/HouseFlipper/HouseFlipper/WheelPropertiesManager.cs b/Projects/HouseFlipper/HouseFlipper/WheelPropertiesManager.cs index 1483a90..75dec0b 100644 --- a/Projects/HouseFlipper/HouseFlipper/WheelPropertiesManager.cs +++ b/Projects/HouseFlipper/HouseFlipper/WheelPropertiesManager.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class WheelPropertiesManager { - private static Dictionary torques = new Dictionary(); - private static Dictionary maxRpm = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleWheels), "OnAttached")] - static void PostfixCreate(ModuleWheels __instance) { - // Console.WriteLine("ModuleWheels.OnAttached"); - if (!torques.ContainsKey(__instance)) { - torques.Add(__instance, __instance.m_TorqueParams.torqueCurveMaxTorque); - maxRpm.Add(__instance, __instance.m_TorqueParams.torqueCurveMaxRpm); - // Console.WriteLine("Patching {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, - // __instance.m_TorqueParams.torqueCurveMaxTorque, - // __instance.m_TorqueParams.torqueCurveMaxRpm); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, - // __instance.m_TorqueParams.torqueCurveMaxTorque, - // __instance.m_TorqueParams.torqueCurveMaxRpm); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleWheels), "OnDetaching")] - static void PostfixDestroy(ModuleWheels __instance) { - // Console.WriteLine("ModuleWheels.OnDetaching"); - // Console.WriteLine("Restoring {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, - // __instance.m_TorqueParams.torqueCurveMaxTorque, - // __instance.m_TorqueParams.torqueCurveMaxRpm); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, - // __instance.m_TorqueParams.torqueCurveMaxTorque, - // __instance.m_TorqueParams.torqueCurveMaxRpm); - torques.Remove(__instance); - maxRpm.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleWheels", torques.Count); - foreach (KeyValuePair keyValuePair in torques) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleWheels moduleWheels) { - moduleWheels.m_TorqueParams.torqueCurveMaxRpm = maxRpm[moduleWheels] * Main.wheelSpeedMultiplier.Value; - moduleWheels.m_TorqueParams.torqueCurveMaxTorque = torques[moduleWheels] * Main.wheelTorqueMultiplier.Value; - } - - static void DoRestoreSingle(ModuleWheels moduleWheels) { - if (torques.ContainsKey(moduleWheels)) { - moduleWheels.m_TorqueParams.torqueCurveMaxTorque = torques[moduleWheels]; - moduleWheels.m_TorqueParams.torqueCurveMaxRpm = maxRpm[moduleWheels]; - } - } - } +using System; +using System.Collections.Generic; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class WheelPropertiesManager { + private static Dictionary torques = new Dictionary(); + private static Dictionary maxRpm = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWheels), "OnAttached")] + static void PostfixCreate(ModuleWheels __instance) { + // Console.WriteLine("ModuleWheels.OnAttached"); + if (!torques.ContainsKey(__instance)) { + torques.Add(__instance, __instance.m_TorqueParams.torqueCurveMaxTorque); + maxRpm.Add(__instance, __instance.m_TorqueParams.torqueCurveMaxRpm); + // Console.WriteLine("Patching {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, + // __instance.m_TorqueParams.torqueCurveMaxTorque, + // __instance.m_TorqueParams.torqueCurveMaxRpm); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, + // __instance.m_TorqueParams.torqueCurveMaxTorque, + // __instance.m_TorqueParams.torqueCurveMaxRpm); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWheels), "OnDetaching")] + static void PostfixDestroy(ModuleWheels __instance) { + // Console.WriteLine("ModuleWheels.OnDetaching"); + // Console.WriteLine("Restoring {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, + // __instance.m_TorqueParams.torqueCurveMaxTorque, + // __instance.m_TorqueParams.torqueCurveMaxRpm); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, + // __instance.m_TorqueParams.torqueCurveMaxTorque, + // __instance.m_TorqueParams.torqueCurveMaxRpm); + torques.Remove(__instance); + maxRpm.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleWheels", torques.Count); + foreach (KeyValuePair keyValuePair in torques) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleWheels moduleWheels) { + moduleWheels.m_TorqueParams.torqueCurveMaxRpm = maxRpm[moduleWheels] * Main.wheelSpeedMultiplier.Value; + moduleWheels.m_TorqueParams.torqueCurveMaxTorque = torques[moduleWheels] * Main.wheelTorqueMultiplier.Value; + } + + static void DoRestoreSingle(ModuleWheels moduleWheels) { + if (torques.ContainsKey(moduleWheels)) { + moduleWheels.m_TorqueParams.torqueCurveMaxTorque = torques[moduleWheels]; + moduleWheels.m_TorqueParams.torqueCurveMaxRpm = maxRpm[moduleWheels]; + } + } + } } \ No newline at end of file diff --git a/Projects/HouseFlipper/HouseFlipper/WirelessChargerPropertiesManager.cs b/Projects/HouseFlipper/HouseFlipper/WirelessChargerPropertiesManager.cs index 92aedcb..d80193b 100644 --- a/Projects/HouseFlipper/HouseFlipper/WirelessChargerPropertiesManager.cs +++ b/Projects/HouseFlipper/HouseFlipper/WirelessChargerPropertiesManager.cs @@ -1,60 +1,60 @@ -using System.Collections.Generic; -using HarmonyLib; - -// TODO: Fix this, no workey -namespace TerraTech { - [HarmonyPatch] - public class WirelessChargerPropertiesManager { - private static Dictionary radius = new Dictionary(); - private static Dictionary transferPerArc = new Dictionary(); - private static Dictionary arcFiringInterval = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleRemoteCharger), "OnAttached")] - static void PostfixCreate(ModuleRemoteCharger __instance) { - // Console.WriteLine("ModuleRemoteCharger.OnAttached"); - if (!radius.ContainsKey(__instance)) { - radius.Add(__instance, __instance.m_ChargingRadius); - transferPerArc.Add(__instance, __instance.m_PowerTransferPerArc); - arcFiringInterval.Add(__instance, __instance.m_ArcFiringInterval); - // Console.WriteLine("Patching {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleRemoteCharger), "OnDetaching")] - static void PostfixDestroy(ModuleRemoteCharger __instance) { - // Console.WriteLine("ModuleRemoteCharger.OnAttached"); - // Console.WriteLine("Restoring {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - radius.Remove(__instance); - transferPerArc.Remove(__instance); - arcFiringInterval.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleRemoteCharger", radius.Count); - foreach (KeyValuePair keyValuePair in radius) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleRemoteCharger moduleRemoteCharger) { - moduleRemoteCharger.m_ChargingRadius = radius[moduleRemoteCharger] * Main.wirelessChargingRadiusMultiplier.Value; - moduleRemoteCharger.m_PowerTransferPerArc = radius[moduleRemoteCharger] * Main.wirelessChargingPowerPerArcMultiplier.Value; - moduleRemoteCharger.m_ArcFiringInterval = radius[moduleRemoteCharger] * Main.wirelessChargingArcFiringIntervalMultiplier.Value; - } - - static void DoRestoreSingle(ModuleRemoteCharger moduleRemoteCharger) { - if (radius.ContainsKey(moduleRemoteCharger)) { - moduleRemoteCharger.m_ChargingRadius = radius[moduleRemoteCharger]; - moduleRemoteCharger.m_PowerTransferPerArc = radius[moduleRemoteCharger]; - moduleRemoteCharger.m_ArcFiringInterval = radius[moduleRemoteCharger]; - } - } - } +using System.Collections.Generic; +using HarmonyLib; + +// TODO: Fix this, no workey +namespace TerraTech { + [HarmonyPatch] + public class WirelessChargerPropertiesManager { + private static Dictionary radius = new Dictionary(); + private static Dictionary transferPerArc = new Dictionary(); + private static Dictionary arcFiringInterval = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleRemoteCharger), "OnAttached")] + static void PostfixCreate(ModuleRemoteCharger __instance) { + // Console.WriteLine("ModuleRemoteCharger.OnAttached"); + if (!radius.ContainsKey(__instance)) { + radius.Add(__instance, __instance.m_ChargingRadius); + transferPerArc.Add(__instance, __instance.m_PowerTransferPerArc); + arcFiringInterval.Add(__instance, __instance.m_ArcFiringInterval); + // Console.WriteLine("Patching {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleRemoteCharger), "OnDetaching")] + static void PostfixDestroy(ModuleRemoteCharger __instance) { + // Console.WriteLine("ModuleRemoteCharger.OnAttached"); + // Console.WriteLine("Restoring {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + radius.Remove(__instance); + transferPerArc.Remove(__instance); + arcFiringInterval.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleRemoteCharger", radius.Count); + foreach (KeyValuePair keyValuePair in radius) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleRemoteCharger moduleRemoteCharger) { + moduleRemoteCharger.m_ChargingRadius = radius[moduleRemoteCharger] * Main.wirelessChargingRadiusMultiplier.Value; + moduleRemoteCharger.m_PowerTransferPerArc = radius[moduleRemoteCharger] * Main.wirelessChargingPowerPerArcMultiplier.Value; + moduleRemoteCharger.m_ArcFiringInterval = radius[moduleRemoteCharger] * Main.wirelessChargingArcFiringIntervalMultiplier.Value; + } + + static void DoRestoreSingle(ModuleRemoteCharger moduleRemoteCharger) { + if (radius.ContainsKey(moduleRemoteCharger)) { + moduleRemoteCharger.m_ChargingRadius = radius[moduleRemoteCharger]; + moduleRemoteCharger.m_PowerTransferPerArc = radius[moduleRemoteCharger]; + moduleRemoteCharger.m_ArcFiringInterval = radius[moduleRemoteCharger]; + } + } + } } \ No newline at end of file diff --git a/Projects/HouseFlipper/HouseFlipper/obj/Debug/.NETFramework,Version=v4.8.AssemblyAttributes.cs b/Projects/HouseFlipper/HouseFlipper/obj/Debug/.NETFramework,Version=v4.8.AssemblyAttributes.cs index 15efebf..3cf0af3 100644 --- a/Projects/HouseFlipper/HouseFlipper/obj/Debug/.NETFramework,Version=v4.8.AssemblyAttributes.cs +++ b/Projects/HouseFlipper/HouseFlipper/obj/Debug/.NETFramework,Version=v4.8.AssemblyAttributes.cs @@ -1,4 +1,4 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] diff --git a/Projects/HouseFlipper/HouseFlipper/obj/Debug/HouseFlipper.csproj.AssemblyReference.cache b/Projects/HouseFlipper/HouseFlipper/obj/Debug/HouseFlipper.csproj.AssemblyReference.cache index c8675f7..acfe63c 100644 Binary files a/Projects/HouseFlipper/HouseFlipper/obj/Debug/HouseFlipper.csproj.AssemblyReference.cache and b/Projects/HouseFlipper/HouseFlipper/obj/Debug/HouseFlipper.csproj.AssemblyReference.cache differ diff --git a/Projects/HouseFlipper/HouseFlipper/obj/Debug/TerraTech.csproj.FileListAbsolute.txt b/Projects/HouseFlipper/HouseFlipper/obj/Debug/TerraTech.csproj.FileListAbsolute.txt index 8de8814..5493c33 100644 --- a/Projects/HouseFlipper/HouseFlipper/obj/Debug/TerraTech.csproj.FileListAbsolute.txt +++ b/Projects/HouseFlipper/HouseFlipper/obj/Debug/TerraTech.csproj.FileListAbsolute.txt @@ -1,11 +1,11 @@ -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\TerraTech.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\TerraTech.pdb -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\0Harmony.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\Assembly-CSharp.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\BepInEx.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\UnityEngine.CoreModule.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\UnityEngine.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.csprojResolveAssemblyReference.cache -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.pdb -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\ConfigurationManager.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\TerraTech.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\TerraTech.pdb +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\0Harmony.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\Assembly-CSharp.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\BepInEx.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\UnityEngine.CoreModule.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\UnityEngine.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.csprojResolveAssemblyReference.cache +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.pdb +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\ConfigurationManager.dll diff --git a/Projects/Regiments/Regiments.sln b/Projects/Regiments/Regiments.sln index 4dd3990..3fb8afb 100644 --- a/Projects/Regiments/Regiments.sln +++ b/Projects/Regiments/Regiments.sln @@ -1,16 +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 + +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/Patches.cs b/Projects/Regiments/Regiments/Patches.cs index 1b583b8..b01e09b 100644 --- a/Projects/Regiments/Regiments/Patches.cs +++ b/Projects/Regiments/Regiments/Patches.cs @@ -56,7 +56,7 @@ namespace Regiments { Console.WriteLine("Base range is 0, assigning new: {0}", baseHqValue); } - var hqRadius = Traverse.Create(__instance).Field("platoon").Field("parameters").Field("HQRadius"); + var hqRadius = Traverse.Create(__instance.platoon.parameters).Field("HQRadius"); hqRadius.SetValue(baseHqValue * Main.HQAOEMultiplier.Value); Console.WriteLine("HQ radius patched to: {0}", __instance.platoon.parameters.HQRadius); } diff --git a/Projects/Regiments/Regiments/Properties/AssemblyInfo.cs b/Projects/Regiments/Regiments/Properties/AssemblyInfo.cs index 659f97b..e756fd4 100644 --- a/Projects/Regiments/Regiments/Properties/AssemblyInfo.cs +++ b/Projects/Regiments/Regiments/Properties/AssemblyInfo.cs @@ -1,35 +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")] +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/Transpiler.cs b/Projects/Regiments/Regiments/Transpiler.cs index 2bc9b04..9aa461f 100644 --- a/Projects/Regiments/Regiments/Transpiler.cs +++ b/Projects/Regiments/Regiments/Transpiler.cs @@ -1,274 +1,274 @@ -// 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; -// } -// } -// } +// 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 index 5d01041..9e65edd 100644 --- a/Projects/Regiments/Regiments/obj/Debug/.NETFramework,Version=v4.0.AssemblyAttributes.cs +++ b/Projects/Regiments/Regiments/obj/Debug/.NETFramework,Version=v4.0.AssemblyAttributes.cs @@ -1,4 +1,4 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 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/Regiments.csproj.CoreCompileInputs.cache b/Projects/Regiments/Regiments/obj/Debug/Regiments.csproj.CoreCompileInputs.cache index 61cfb55..1363cb1 100644 --- a/Projects/Regiments/Regiments/obj/Debug/Regiments.csproj.CoreCompileInputs.cache +++ b/Projects/Regiments/Regiments/obj/Debug/Regiments.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -609c169d30d10d3da64fccb9258a6c7730d0c5b3 +609c169d30d10d3da64fccb9258a6c7730d0c5b3 diff --git a/Projects/Regiments/Regiments/obj/Debug/Regiments.csproj.FileListAbsolute.txt b/Projects/Regiments/Regiments/obj/Debug/Regiments.csproj.FileListAbsolute.txt index d53cbab..1010287 100644 --- a/Projects/Regiments/Regiments/obj/Debug/Regiments.csproj.FileListAbsolute.txt +++ b/Projects/Regiments/Regiments/obj/Debug/Regiments.csproj.FileListAbsolute.txt @@ -1,26 +1,26 @@ -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.csproj.AssemblyReference.cache -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.csproj.CoreCompileInputs.cache -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\Regiments.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\Regiments.pdb -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\0Harmony.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\Assembly-CSharp.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\BepInEx.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\MainAssembly.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\UnityEngine.CoreModule.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\UnityEngine.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.csproj.CopyComplete -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.pdb -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\Regiments.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\Regiments.pdb -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\0Harmony.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\Assembly-CSharp.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\BepInEx.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\ConfigurationManager.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\UnityEngine.CoreModule.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\UnityEngine.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.csproj.AssemblyReference.cache -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.csproj.CoreCompileInputs.cache -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.csproj.CopyComplete -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.pdb +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.csproj.AssemblyReference.cache +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.csproj.CoreCompileInputs.cache +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\Regiments.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\Regiments.pdb +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\0Harmony.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\Assembly-CSharp.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\BepInEx.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\MainAssembly.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\UnityEngine.CoreModule.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\UnityEngine.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.csproj.CopyComplete +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.pdb +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\Regiments.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\Regiments.pdb +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\0Harmony.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\Assembly-CSharp.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\BepInEx.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\ConfigurationManager.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\UnityEngine.CoreModule.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Debug\UnityEngine.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.csproj.AssemblyReference.cache +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.csproj.CoreCompileInputs.cache +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.csproj.CopyComplete +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Debug\Regiments.pdb diff --git a/Projects/SevenDaysToDie/.gitignore b/Projects/SevenDaysToDie/.gitignore index add57be..d546405 100644 --- a/Projects/SevenDaysToDie/.gitignore +++ b/Projects/SevenDaysToDie/.gitignore @@ -1,5 +1,5 @@ -bin/ -obj/ -/packages/ -riderModule.iml +bin/ +obj/ +/packages/ +riderModule.iml /_ReSharper.Caches/ \ No newline at end of file diff --git a/Projects/SevenDaysToDie/SevenDaysToDie.sln b/Projects/SevenDaysToDie/SevenDaysToDie.sln index 755cacc..ba398c2 100644 --- a/Projects/SevenDaysToDie/SevenDaysToDie.sln +++ b/Projects/SevenDaysToDie/SevenDaysToDie.sln @@ -1,16 +1,16 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SevenDaysToDie", "SevenDaysToDie\SevenDaysToDie.csproj", "{1DDE7D09-633A-48E5-A548-4BD4BC4CB8D5}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1DDE7D09-633A-48E5-A548-4BD4BC4CB8D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1DDE7D09-633A-48E5-A548-4BD4BC4CB8D5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1DDE7D09-633A-48E5-A548-4BD4BC4CB8D5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1DDE7D09-633A-48E5-A548-4BD4BC4CB8D5}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SevenDaysToDie", "SevenDaysToDie\SevenDaysToDie.csproj", "{1DDE7D09-633A-48E5-A548-4BD4BC4CB8D5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1DDE7D09-633A-48E5-A548-4BD4BC4CB8D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1DDE7D09-633A-48E5-A548-4BD4BC4CB8D5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1DDE7D09-633A-48E5-A548-4BD4BC4CB8D5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1DDE7D09-633A-48E5-A548-4BD4BC4CB8D5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Projects/SevenDaysToDie/SevenDaysToDie.sln.DotSettings.user b/Projects/SevenDaysToDie/SevenDaysToDie.sln.DotSettings.user index 958592d..97f9a81 100644 --- a/Projects/SevenDaysToDie/SevenDaysToDie.sln.DotSettings.user +++ b/Projects/SevenDaysToDie/SevenDaysToDie.sln.DotSettings.user @@ -1,8 +1,8 @@ - - True - True - True - True - True - True + + True + True + True + True + True + True True \ No newline at end of file diff --git a/Projects/SevenDaysToDie/SevenDaysToDie/Class1.cs b/Projects/SevenDaysToDie/SevenDaysToDie/Class1.cs index 841e269..1b9f9fe 100644 --- a/Projects/SevenDaysToDie/SevenDaysToDie/Class1.cs +++ b/Projects/SevenDaysToDie/SevenDaysToDie/Class1.cs @@ -1,114 +1,114 @@ -using BepInEx.Configuration; -using HarmonyLib.Tools; -using MelonLoader; - -namespace SevenDaysToDie { - [assembly: MelonInfo(typeof(Main), "CykaMod", "1", "Cyka")] - public class Main : MelonMod { - private const string pluginGuid = "CykaMod"; - - public static ConfigEntry xpMultiplier; - public static ConfigEntry moneyMultiplier; - public static ConfigEntry energyGenMultiplier; - public static ConfigEntry heartbeatIntervalMultiplier; - public static ConfigEntry shootingSpeedMultiplier; - public static ConfigEntry muzzleVelocityMultiplier; - public static ConfigEntry allProjectilesHoming; - public static ConfigEntry magnetStrenghtMultiplier; - 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 static ConfigEntry seekingProjectileVisionConeAngleMultiplier; - public static ConfigEntry seekingProjectileVisionRangeMultiplier; - public static ConfigEntry seekingProjectileTurningSpeedMultiplier; - public static ConfigEntry wirelessChargingRadiusMultiplier; - public static ConfigEntry wirelessChargingPowerPerArcMultiplier; - public static ConfigEntry wirelessChargingArcFiringIntervalMultiplier; - - public void OnInitializeMelon() { - xpMultiplier = UnityDistantTerrain.Config.Bind("General", "XP Multiplier", 1f, new ConfigDescription("XP Multiplier", new AcceptableValueRange(1f, 512f))); - // moneyMultiplier = Config.Bind("General", "Money Multiplier", 1f, - // new ConfigDescription("Money Multiplier", new AcceptableValueRange(1f, 32f))); - // energyGenMultiplier = Config.Bind("General", "Energy Generation Multiplier", 1f, - // new ConfigDescription("Energy Generation Multiplier", new AcceptableValueRange(1f, 64f))); - // heartbeatIntervalMultiplier = Config.Bind("General", "Heartbeat Interval Multiplier", 1f, - // new ConfigDescription("Heartbeat Interval Multiplier", new AcceptableValueRange(0.1f, 2f))); - // - // shootingSpeedMultiplier = Config.Bind("Weapons", "Shooting Speed Multiplier", 1f, - // new ConfigDescription("Shooting Speed Multiplier", new AcceptableValueRange(0.2f, 8f))); - // muzzleVelocityMultiplier = Config.Bind("Weapons", "Muzzle Velocity Multiplier", 1f, - // new ConfigDescription("Muzzle Velocity Multiplier", new AcceptableValueRange(0.2f, 32f))); - // seekingProjectileVisionConeAngleMultiplier = Config.Bind("Weapons", "Seeking Projectile Cone Vision Angle Multiplier", 1f, - // new ConfigDescription("Seeking Projectile Cone Vision Angle Multiplier", new AcceptableValueRange(0.2f, 32f))); - // seekingProjectileVisionRangeMultiplier = Config.Bind("Weapons", "Seeking Projectile Vision Range Multiplier", 1f, - // new ConfigDescription("Seeking Projectile Vision Range Multiplier", new AcceptableValueRange(0.2f, 32f))); - // seekingProjectileTurningSpeedMultiplier = Config.Bind("Weapons", "Seeking Projectile Turn Speed Multiplier", 1f, - // new ConfigDescription("Seeking Projectile Turn Speed Multiplier", new AcceptableValueRange(0.2f, 32f))); - // - // magnetStrenghtMultiplier = Config.Bind("Attractors", "Magnet Strength Multiplier", 1f, - // new ConfigDescription("Magnet Strength Multiplier", new AcceptableValueRange(1f, 16f))); - // magnetRadiusMultiplier = Config.Bind("Attractors", "Magnet Radius Multiplier", 1f, - // new ConfigDescription("Magnet Radius Multiplier", new AcceptableValueRange(1f, 16f))); - // 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))); - // - // wirelessChargingRadiusMultiplier = Config.Bind("Power", "Wireless Charger Radius Multiplier", 1f, - // new ConfigDescription("Wireless Charger Radius Multiplier", new AcceptableValueRange(0.2f, 16f))); - // wirelessChargingArcFiringIntervalMultiplier = Config.Bind("Power", "Wireless Charger Arc Firing Interval", 1f, - // new ConfigDescription("Wireless Charger Arc Firing Interval", new AcceptableValueRange(0.02f, 16f))); - // wirelessChargingPowerPerArcMultiplier = Config.Bind("Power", "Wireless Charger Power Per Arc", 1f, - // new ConfigDescription("Wireless Charger Power Per Arc", new AcceptableValueRange(0.2f, 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(); - // wirelessChargingPowerPerArcMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); - // wirelessChargingArcFiringIntervalMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); - // wirelessChargingRadiusMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.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 BepInEx.Configuration; +using HarmonyLib.Tools; +using MelonLoader; + +namespace SevenDaysToDie { + [assembly: MelonInfo(typeof(Main), "CykaMod", "1", "Cyka")] + public class Main : MelonMod { + private const string pluginGuid = "CykaMod"; + + public static ConfigEntry xpMultiplier; + public static ConfigEntry moneyMultiplier; + public static ConfigEntry energyGenMultiplier; + public static ConfigEntry heartbeatIntervalMultiplier; + public static ConfigEntry shootingSpeedMultiplier; + public static ConfigEntry muzzleVelocityMultiplier; + public static ConfigEntry allProjectilesHoming; + public static ConfigEntry magnetStrenghtMultiplier; + 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 static ConfigEntry seekingProjectileVisionConeAngleMultiplier; + public static ConfigEntry seekingProjectileVisionRangeMultiplier; + public static ConfigEntry seekingProjectileTurningSpeedMultiplier; + public static ConfigEntry wirelessChargingRadiusMultiplier; + public static ConfigEntry wirelessChargingPowerPerArcMultiplier; + public static ConfigEntry wirelessChargingArcFiringIntervalMultiplier; + + public void OnInitializeMelon() { + xpMultiplier = UnityDistantTerrain.Config.Bind("General", "XP Multiplier", 1f, new ConfigDescription("XP Multiplier", new AcceptableValueRange(1f, 512f))); + // moneyMultiplier = Config.Bind("General", "Money Multiplier", 1f, + // new ConfigDescription("Money Multiplier", new AcceptableValueRange(1f, 32f))); + // energyGenMultiplier = Config.Bind("General", "Energy Generation Multiplier", 1f, + // new ConfigDescription("Energy Generation Multiplier", new AcceptableValueRange(1f, 64f))); + // heartbeatIntervalMultiplier = Config.Bind("General", "Heartbeat Interval Multiplier", 1f, + // new ConfigDescription("Heartbeat Interval Multiplier", new AcceptableValueRange(0.1f, 2f))); + // + // shootingSpeedMultiplier = Config.Bind("Weapons", "Shooting Speed Multiplier", 1f, + // new ConfigDescription("Shooting Speed Multiplier", new AcceptableValueRange(0.2f, 8f))); + // muzzleVelocityMultiplier = Config.Bind("Weapons", "Muzzle Velocity Multiplier", 1f, + // new ConfigDescription("Muzzle Velocity Multiplier", new AcceptableValueRange(0.2f, 32f))); + // seekingProjectileVisionConeAngleMultiplier = Config.Bind("Weapons", "Seeking Projectile Cone Vision Angle Multiplier", 1f, + // new ConfigDescription("Seeking Projectile Cone Vision Angle Multiplier", new AcceptableValueRange(0.2f, 32f))); + // seekingProjectileVisionRangeMultiplier = Config.Bind("Weapons", "Seeking Projectile Vision Range Multiplier", 1f, + // new ConfigDescription("Seeking Projectile Vision Range Multiplier", new AcceptableValueRange(0.2f, 32f))); + // seekingProjectileTurningSpeedMultiplier = Config.Bind("Weapons", "Seeking Projectile Turn Speed Multiplier", 1f, + // new ConfigDescription("Seeking Projectile Turn Speed Multiplier", new AcceptableValueRange(0.2f, 32f))); + // + // magnetStrenghtMultiplier = Config.Bind("Attractors", "Magnet Strength Multiplier", 1f, + // new ConfigDescription("Magnet Strength Multiplier", new AcceptableValueRange(1f, 16f))); + // magnetRadiusMultiplier = Config.Bind("Attractors", "Magnet Radius Multiplier", 1f, + // new ConfigDescription("Magnet Radius Multiplier", new AcceptableValueRange(1f, 16f))); + // 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))); + // + // wirelessChargingRadiusMultiplier = Config.Bind("Power", "Wireless Charger Radius Multiplier", 1f, + // new ConfigDescription("Wireless Charger Radius Multiplier", new AcceptableValueRange(0.2f, 16f))); + // wirelessChargingArcFiringIntervalMultiplier = Config.Bind("Power", "Wireless Charger Arc Firing Interval", 1f, + // new ConfigDescription("Wireless Charger Arc Firing Interval", new AcceptableValueRange(0.02f, 16f))); + // wirelessChargingPowerPerArcMultiplier = Config.Bind("Power", "Wireless Charger Power Per Arc", 1f, + // new ConfigDescription("Wireless Charger Power Per Arc", new AcceptableValueRange(0.2f, 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(); + // wirelessChargingPowerPerArcMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); + // wirelessChargingArcFiringIntervalMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); + // wirelessChargingRadiusMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.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"); + } + } } \ No newline at end of file diff --git a/Projects/SevenDaysToDie/SevenDaysToDie/Properties/AssemblyInfo.cs b/Projects/SevenDaysToDie/SevenDaysToDie/Properties/AssemblyInfo.cs index dd584d7..abe420e 100644 --- a/Projects/SevenDaysToDie/SevenDaysToDie/Properties/AssemblyInfo.cs +++ b/Projects/SevenDaysToDie/SevenDaysToDie/Properties/AssemblyInfo.cs @@ -1,35 +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("SevenDaysToDie")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SevenDaysToDie")] -[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("1DDE7D09-633A-48E5-A548-4BD4BC4CB8D5")] - -// 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")] +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("SevenDaysToDie")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("SevenDaysToDie")] +[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("1DDE7D09-633A-48E5-A548-4BD4BC4CB8D5")] + +// 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/SevenDaysToDie/SevenDaysToDie/SevenDaysToDie.csproj b/Projects/SevenDaysToDie/SevenDaysToDie/SevenDaysToDie.csproj index 69408c3..a83a5be 100644 --- a/Projects/SevenDaysToDie/SevenDaysToDie/SevenDaysToDie.csproj +++ b/Projects/SevenDaysToDie/SevenDaysToDie/SevenDaysToDie.csproj @@ -1,75 +1,75 @@ - - - - - Debug - AnyCPU - {1DDE7D09-633A-48E5-A548-4BD4BC4CB8D5} - Library - Properties - SevenDaysToDie - SevenDaysToDie - v4.0 - 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\MelonLoader.dll - - - - - - - libs\UnityEngine.dll - - - libs\UnityEngine.CoreModule.dll - - - - - - - - - - - + + + + + Debug + AnyCPU + {1DDE7D09-633A-48E5-A548-4BD4BC4CB8D5} + Library + Properties + SevenDaysToDie + SevenDaysToDie + v4.0 + 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\MelonLoader.dll + + + + + + + libs\UnityEngine.dll + + + libs\UnityEngine.CoreModule.dll + + + + + + + + + + + diff --git a/Projects/SevenDaysToDie/SevenDaysToDie/XPPatch.cs b/Projects/SevenDaysToDie/SevenDaysToDie/XPPatch.cs index 4f0bd09..1178ee2 100644 --- a/Projects/SevenDaysToDie/SevenDaysToDie/XPPatch.cs +++ b/Projects/SevenDaysToDie/SevenDaysToDie/XPPatch.cs @@ -1,12 +1,12 @@ -using HarmonyLib; - -namespace SevenDaysToDie { - [HarmonyPatch] - public class Patches { - [HarmonyPrefix] - [HarmonyPatch(typeof(Progression), "AddLevelExp")] - static void XPMulti(ref int _exp) { - _exp = (int)(_exp * Main.xpMultiplier.Value); - } - } +using HarmonyLib; + +namespace SevenDaysToDie { + [HarmonyPatch] + public class Patches { + [HarmonyPrefix] + [HarmonyPatch(typeof(Progression), "AddLevelExp")] + static void XPMulti(ref int _exp) { + _exp = (int)(_exp * Main.xpMultiplier.Value); + } + } } \ No newline at end of file diff --git a/Projects/TerraTech/TerraTech.sln b/Projects/TerraTech/TerraTech.sln index e788d9f..d254716 100644 --- a/Projects/TerraTech/TerraTech.sln +++ b/Projects/TerraTech/TerraTech.sln @@ -1,16 +1,16 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TerraTech", "TerraTech\TerraTech.csproj", "{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TerraTech", "TerraTech\TerraTech.csproj", "{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Projects/TerraTech/TerraTech/BeamPropertiesManager.cs b/Projects/TerraTech/TerraTech/BeamPropertiesManager.cs index 0f05b08..4d98c9c 100644 --- a/Projects/TerraTech/TerraTech/BeamPropertiesManager.cs +++ b/Projects/TerraTech/TerraTech/BeamPropertiesManager.cs @@ -1,79 +1,79 @@ -using System; -using System.Collections.Generic; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class BeamPropertiesManager { - private static Dictionary strenghts = new Dictionary(); - private static Dictionary radii = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleItemHolderBeam), "OnAttached")] - static void PostfixCreate(ModuleItemHolderBeam __instance) { - // Console.WriteLine("ModuleItemHolderBeam.OnAttached"); - if (!strenghts.ContainsKey(__instance)) { - strenghts.Add(__instance, GetStrength(__instance)); - radii.Add(__instance, GetRadius(__instance)); - // Console.WriteLine("Patching {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleItemHolderBeam), "OnDetaching")] - static void PostfixDestroy(ModuleItemHolderBeam __instance) { - // Console.WriteLine("ModuleItemHolderBeam.OnDetaching"); - // Console.WriteLine("Restoring {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - strenghts.Remove(__instance); - radii.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleItemHolderBeam", strenghts.Count); - foreach (KeyValuePair keyValuePair in strenghts) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleItemHolderBeam moduleItemHolderBeam) { - SetStrength(moduleItemHolderBeam, strenghts[moduleItemHolderBeam] * Main.beamStrenghtMultiplier.Value); - SetRadius(moduleItemHolderBeam, radii[moduleItemHolderBeam] * Main.beamRadiusMultiplier.Value); - } - - static void DoRestoreSingle(ModuleItemHolderBeam moduleItemHolderBeam) { - if (strenghts.ContainsKey(moduleItemHolderBeam)) { - SetStrength(moduleItemHolderBeam, strenghts[moduleItemHolderBeam]); - SetRadius(moduleItemHolderBeam, radii[moduleItemHolderBeam]); - } - } - - private static float GetStrength(ModuleItemHolderBeam moduleItemHolderBeam) { - return Traverse.Create(moduleItemHolderBeam).Field("m_BeamStrength").GetValue() as float? ?? 0f; - } - - private static void SetStrength(ModuleItemHolderBeam moduleItemHolderBeam, float value) { - Traverse.Create(moduleItemHolderBeam).Field("m_BeamStrength").SetValue(value); - } - - private static float GetRadius(ModuleItemHolderBeam moduleItemHolderBeam) { - ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderBeam).Field("m_Pickup").GetValue() as ModuleItemPickup; - if (moduleItemPickup) { - float radius = Traverse.Create(moduleItemPickup).Field("m_PickupRange").GetValue() as float? ?? 0f; - return radius; - } - return 0f; - } - - private static void SetRadius(ModuleItemHolderBeam moduleItemHolderBeam, float value) { - ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderBeam).Field("m_Pickup").GetValue() as ModuleItemPickup; - if (moduleItemPickup) { - Traverse.Create(moduleItemPickup).Field("m_PickupRange").SetValue(value); - } - } - } +using System; +using System.Collections.Generic; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class BeamPropertiesManager { + private static Dictionary strenghts = new Dictionary(); + private static Dictionary radii = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemHolderBeam), "OnAttached")] + static void PostfixCreate(ModuleItemHolderBeam __instance) { + // Console.WriteLine("ModuleItemHolderBeam.OnAttached"); + if (!strenghts.ContainsKey(__instance)) { + strenghts.Add(__instance, GetStrength(__instance)); + radii.Add(__instance, GetRadius(__instance)); + // Console.WriteLine("Patching {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemHolderBeam), "OnDetaching")] + static void PostfixDestroy(ModuleItemHolderBeam __instance) { + // Console.WriteLine("ModuleItemHolderBeam.OnDetaching"); + // Console.WriteLine("Restoring {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; m_BeamStrength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + strenghts.Remove(__instance); + radii.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleItemHolderBeam", strenghts.Count); + foreach (KeyValuePair keyValuePair in strenghts) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleItemHolderBeam moduleItemHolderBeam) { + SetStrength(moduleItemHolderBeam, strenghts[moduleItemHolderBeam] * Main.beamStrenghtMultiplier.Value); + SetRadius(moduleItemHolderBeam, radii[moduleItemHolderBeam] * Main.beamRadiusMultiplier.Value); + } + + static void DoRestoreSingle(ModuleItemHolderBeam moduleItemHolderBeam) { + if (strenghts.ContainsKey(moduleItemHolderBeam)) { + SetStrength(moduleItemHolderBeam, strenghts[moduleItemHolderBeam]); + SetRadius(moduleItemHolderBeam, radii[moduleItemHolderBeam]); + } + } + + private static float GetStrength(ModuleItemHolderBeam moduleItemHolderBeam) { + return Traverse.Create(moduleItemHolderBeam).Field("m_BeamStrength").GetValue() as float? ?? 0f; + } + + private static void SetStrength(ModuleItemHolderBeam moduleItemHolderBeam, float value) { + Traverse.Create(moduleItemHolderBeam).Field("m_BeamStrength").SetValue(value); + } + + private static float GetRadius(ModuleItemHolderBeam moduleItemHolderBeam) { + ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderBeam).Field("m_Pickup").GetValue() as ModuleItemPickup; + if (moduleItemPickup) { + float radius = Traverse.Create(moduleItemPickup).Field("m_PickupRange").GetValue() as float? ?? 0f; + return radius; + } + return 0f; + } + + private static void SetRadius(ModuleItemHolderBeam moduleItemHolderBeam, float value) { + ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderBeam).Field("m_Pickup").GetValue() as ModuleItemPickup; + if (moduleItemPickup) { + Traverse.Create(moduleItemPickup).Field("m_PickupRange").SetValue(value); + } + } + } } \ No newline at end of file diff --git a/Projects/TerraTech/TerraTech/Class1.cs b/Projects/TerraTech/TerraTech/Class1.cs index d0d2c5c..9670c73 100644 --- a/Projects/TerraTech/TerraTech/Class1.cs +++ b/Projects/TerraTech/TerraTech/Class1.cs @@ -1,121 +1,121 @@ -using System.Linq; -using BepInEx; -using BepInEx.Configuration; -using HarmonyLib; -using HarmonyLib.Tools; - -// TODO: Make shield and repair bigger -// TODO: Maybe make props faster, thrusters work fine - -namespace TerraTech { - [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 xpMultiplier; - public static ConfigEntry moneyMultiplier; - public static ConfigEntry energyGenMultiplier; - public static ConfigEntry heartbeatIntervalMultiplier; - public static ConfigEntry shootingSpeedMultiplier; - public static ConfigEntry muzzleVelocityMultiplier; - public static ConfigEntry allProjectilesHoming; - public static ConfigEntry magnetStrenghtMultiplier; - 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 static ConfigEntry seekingProjectileVisionConeAngleMultiplier; - public static ConfigEntry seekingProjectileVisionRangeMultiplier; - public static ConfigEntry seekingProjectileTurningSpeedMultiplier; - public static ConfigEntry wirelessChargingRadiusMultiplier; - public static ConfigEntry wirelessChargingPowerPerArcMultiplier; - public static ConfigEntry wirelessChargingArcFiringIntervalMultiplier; - - public void Awake() { - xpMultiplier = Config.Bind("General", "XP Multiplier", 1f, new ConfigDescription("XP Multiplier", new AcceptableValueRange(1f, 32f))); - moneyMultiplier = Config.Bind("General", "Money Multiplier", 1f, - new ConfigDescription("Money Multiplier", new AcceptableValueRange(1f, 32f))); - energyGenMultiplier = Config.Bind("General", "Energy Generation Multiplier", 1f, - new ConfigDescription("Energy Generation Multiplier", new AcceptableValueRange(1f, 64f))); - heartbeatIntervalMultiplier = Config.Bind("General", "Heartbeat Interval Multiplier", 1f, - new ConfigDescription("Heartbeat Interval Multiplier", new AcceptableValueRange(0.1f, 2f))); - - shootingSpeedMultiplier = Config.Bind("Weapons", "Shooting Speed Multiplier", 1f, - new ConfigDescription("Shooting Speed Multiplier", new AcceptableValueRange(0.2f, 8f))); - muzzleVelocityMultiplier = Config.Bind("Weapons", "Muzzle Velocity Multiplier", 1f, - new ConfigDescription("Muzzle Velocity Multiplier", new AcceptableValueRange(0.2f, 32f))); - seekingProjectileVisionConeAngleMultiplier = Config.Bind("Weapons", "Seeking Projectile Cone Vision Angle Multiplier", 1f, - new ConfigDescription("Seeking Projectile Cone Vision Angle Multiplier", new AcceptableValueRange(0.2f, 32f))); - seekingProjectileVisionRangeMultiplier = Config.Bind("Weapons", "Seeking Projectile Vision Range Multiplier", 1f, - new ConfigDescription("Seeking Projectile Vision Range Multiplier", new AcceptableValueRange(0.2f, 32f))); - seekingProjectileTurningSpeedMultiplier = Config.Bind("Weapons", "Seeking Projectile Turn Speed Multiplier", 1f, - new ConfigDescription("Seeking Projectile Turn Speed Multiplier", new AcceptableValueRange(0.2f, 32f))); - - magnetStrenghtMultiplier = Config.Bind("Attractors", "Magnet Strength Multiplier", 1f, - new ConfigDescription("Magnet Strength Multiplier", new AcceptableValueRange(1f, 16f))); - magnetRadiusMultiplier = Config.Bind("Attractors", "Magnet Radius Multiplier", 1f, - new ConfigDescription("Magnet Radius Multiplier", new AcceptableValueRange(1f, 16f))); - 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))); - - wirelessChargingRadiusMultiplier = Config.Bind("Power", "Wireless Charger Radius Multiplier", 1f, - new ConfigDescription("Wireless Charger Radius Multiplier", new AcceptableValueRange(0.2f, 16f))); - wirelessChargingArcFiringIntervalMultiplier = Config.Bind("Power", "Wireless Charger Arc Firing Interval", 1f, - new ConfigDescription("Wireless Charger Arc Firing Interval", new AcceptableValueRange(0.02f, 16f))); - wirelessChargingPowerPerArcMultiplier = Config.Bind("Power", "Wireless Charger Power Per Arc", 1f, - new ConfigDescription("Wireless Charger Power Per Arc", new AcceptableValueRange(0.2f, 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(); - wirelessChargingPowerPerArcMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); - wirelessChargingArcFiringIntervalMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); - wirelessChargingRadiusMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.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; + +// TODO: Make shield and repair bigger +// TODO: Maybe make props faster, thrusters work fine + +namespace TerraTech { + [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 xpMultiplier; + public static ConfigEntry moneyMultiplier; + public static ConfigEntry energyGenMultiplier; + public static ConfigEntry heartbeatIntervalMultiplier; + public static ConfigEntry shootingSpeedMultiplier; + public static ConfigEntry muzzleVelocityMultiplier; + public static ConfigEntry allProjectilesHoming; + public static ConfigEntry magnetStrenghtMultiplier; + 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 static ConfigEntry seekingProjectileVisionConeAngleMultiplier; + public static ConfigEntry seekingProjectileVisionRangeMultiplier; + public static ConfigEntry seekingProjectileTurningSpeedMultiplier; + public static ConfigEntry wirelessChargingRadiusMultiplier; + public static ConfigEntry wirelessChargingPowerPerArcMultiplier; + public static ConfigEntry wirelessChargingArcFiringIntervalMultiplier; + + public void Awake() { + xpMultiplier = Config.Bind("General", "XP Multiplier", 1f, new ConfigDescription("XP Multiplier", new AcceptableValueRange(1f, 32f))); + moneyMultiplier = Config.Bind("General", "Money Multiplier", 1f, + new ConfigDescription("Money Multiplier", new AcceptableValueRange(1f, 32f))); + energyGenMultiplier = Config.Bind("General", "Energy Generation Multiplier", 1f, + new ConfigDescription("Energy Generation Multiplier", new AcceptableValueRange(1f, 64f))); + heartbeatIntervalMultiplier = Config.Bind("General", "Heartbeat Interval Multiplier", 1f, + new ConfigDescription("Heartbeat Interval Multiplier", new AcceptableValueRange(0.1f, 2f))); + + shootingSpeedMultiplier = Config.Bind("Weapons", "Shooting Speed Multiplier", 1f, + new ConfigDescription("Shooting Speed Multiplier", new AcceptableValueRange(0.2f, 8f))); + muzzleVelocityMultiplier = Config.Bind("Weapons", "Muzzle Velocity Multiplier", 1f, + new ConfigDescription("Muzzle Velocity Multiplier", new AcceptableValueRange(0.2f, 32f))); + seekingProjectileVisionConeAngleMultiplier = Config.Bind("Weapons", "Seeking Projectile Cone Vision Angle Multiplier", 1f, + new ConfigDescription("Seeking Projectile Cone Vision Angle Multiplier", new AcceptableValueRange(0.2f, 32f))); + seekingProjectileVisionRangeMultiplier = Config.Bind("Weapons", "Seeking Projectile Vision Range Multiplier", 1f, + new ConfigDescription("Seeking Projectile Vision Range Multiplier", new AcceptableValueRange(0.2f, 32f))); + seekingProjectileTurningSpeedMultiplier = Config.Bind("Weapons", "Seeking Projectile Turn Speed Multiplier", 1f, + new ConfigDescription("Seeking Projectile Turn Speed Multiplier", new AcceptableValueRange(0.2f, 32f))); + + magnetStrenghtMultiplier = Config.Bind("Attractors", "Magnet Strength Multiplier", 1f, + new ConfigDescription("Magnet Strength Multiplier", new AcceptableValueRange(1f, 16f))); + magnetRadiusMultiplier = Config.Bind("Attractors", "Magnet Radius Multiplier", 1f, + new ConfigDescription("Magnet Radius Multiplier", new AcceptableValueRange(1f, 16f))); + 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))); + + wirelessChargingRadiusMultiplier = Config.Bind("Power", "Wireless Charger Radius Multiplier", 1f, + new ConfigDescription("Wireless Charger Radius Multiplier", new AcceptableValueRange(0.2f, 16f))); + wirelessChargingArcFiringIntervalMultiplier = Config.Bind("Power", "Wireless Charger Arc Firing Interval", 1f, + new ConfigDescription("Wireless Charger Arc Firing Interval", new AcceptableValueRange(0.02f, 16f))); + wirelessChargingPowerPerArcMultiplier = Config.Bind("Power", "Wireless Charger Power Per Arc", 1f, + new ConfigDescription("Wireless Charger Power Per Arc", new AcceptableValueRange(0.2f, 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(); + wirelessChargingPowerPerArcMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); + wirelessChargingArcFiringIntervalMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch(); + wirelessChargingRadiusMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.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"); + } + } } \ No newline at end of file diff --git a/Projects/TerraTech/TerraTech/FuelPropertiesManager.cs b/Projects/TerraTech/TerraTech/FuelPropertiesManager.cs index 7aa9140..6246ca8 100644 --- a/Projects/TerraTech/TerraTech/FuelPropertiesManager.cs +++ b/Projects/TerraTech/TerraTech/FuelPropertiesManager.cs @@ -1,55 +1,55 @@ -using System; -using System.Collections.Generic; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class FuelPropertiesManager { - private static Dictionary refillRate = new Dictionary(); - private static Dictionary capacity = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleFuelTank), "OnAttached")] - static void PostfixCreate(ModuleFuelTank __instance) { - // Console.WriteLine("ModuleFuelTank.OnAttached"); - if (!refillRate.ContainsKey(__instance)) { - refillRate.Add(__instance, __instance.m_RefillRate); - capacity.Add(__instance, __instance.m_Capacity); - // Console.WriteLine("Patching {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleFuelTank), "OnDetaching")] - static void PostfixDestroy(ModuleFuelTank __instance) { - // Console.WriteLine("ModuleFuelTank.OnAttached"); - // Console.WriteLine("Restoring {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - refillRate.Remove(__instance); - capacity.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleFuelTank", refillRate.Count); - foreach (KeyValuePair keyValuePair in refillRate) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleFuelTank moduleFuelTank) { - moduleFuelTank.m_RefillRate = refillRate[moduleFuelTank] * Main.fuelTankRefillMultiplier.Value; - moduleFuelTank.m_Capacity = capacity[moduleFuelTank] * Main.fuelTankCapacityMultiplier.Value; - } - - static void DoRestoreSingle(ModuleFuelTank moduleFuelTank) { - if (refillRate.ContainsKey(moduleFuelTank)) { - moduleFuelTank.m_RefillRate = refillRate[moduleFuelTank]; - moduleFuelTank.m_Capacity = capacity[moduleFuelTank]; - } - } - } +using System; +using System.Collections.Generic; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class FuelPropertiesManager { + private static Dictionary refillRate = new Dictionary(); + private static Dictionary capacity = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleFuelTank), "OnAttached")] + static void PostfixCreate(ModuleFuelTank __instance) { + // Console.WriteLine("ModuleFuelTank.OnAttached"); + if (!refillRate.ContainsKey(__instance)) { + refillRate.Add(__instance, __instance.m_RefillRate); + capacity.Add(__instance, __instance.m_Capacity); + // Console.WriteLine("Patching {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleFuelTank), "OnDetaching")] + static void PostfixDestroy(ModuleFuelTank __instance) { + // Console.WriteLine("ModuleFuelTank.OnAttached"); + // Console.WriteLine("Restoring {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + refillRate.Remove(__instance); + capacity.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleFuelTank", refillRate.Count); + foreach (KeyValuePair keyValuePair in refillRate) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleFuelTank moduleFuelTank) { + moduleFuelTank.m_RefillRate = refillRate[moduleFuelTank] * Main.fuelTankRefillMultiplier.Value; + moduleFuelTank.m_Capacity = capacity[moduleFuelTank] * Main.fuelTankCapacityMultiplier.Value; + } + + static void DoRestoreSingle(ModuleFuelTank moduleFuelTank) { + if (refillRate.ContainsKey(moduleFuelTank)) { + moduleFuelTank.m_RefillRate = refillRate[moduleFuelTank]; + moduleFuelTank.m_Capacity = capacity[moduleFuelTank]; + } + } + } } \ No newline at end of file diff --git a/Projects/TerraTech/TerraTech/GeneratorPropertiesManager.cs b/Projects/TerraTech/TerraTech/GeneratorPropertiesManager.cs index 3dd068f..dfd6ed0 100644 --- a/Projects/TerraTech/TerraTech/GeneratorPropertiesManager.cs +++ b/Projects/TerraTech/TerraTech/GeneratorPropertiesManager.cs @@ -1,58 +1,58 @@ -using System; -using System.Collections.Generic; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class GeneratorPropertiesManager { - private static Dictionary generators = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleEnergy), "OnAttached")] - static void PostfixCreate(ModuleEnergy __instance) { - // Console.WriteLine("ModuleEnergy.OnAttached"); - if (!generators.ContainsKey(__instance)) { - generators.Add(__instance, GetValue(__instance)); - // Console.WriteLine("Patching {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleEnergy), "OnDetaching")] - static void PostfixDestroy(ModuleEnergy __instance) { - // Console.WriteLine("ModuleEnergy.OnDetaching"); - // Console.WriteLine("Restoring {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); - generators.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleEnergy", generators.Count); - foreach (KeyValuePair keyValuePair in generators) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleEnergy moduleEnergy) { - SetValue(moduleEnergy, generators[moduleEnergy] * Main.energyGenMultiplier.Value); - } - - static void DoRestoreSingle(ModuleEnergy moduleEnergy) { - if (generators.ContainsKey(moduleEnergy)) { - SetValue(moduleEnergy, generators[moduleEnergy]); - } - } - - private static float GetValue(ModuleEnergy moduleEnergy) { - return Traverse.Create(moduleEnergy).Field("m_OutputPerSecond").GetValue() as float? ?? 0f; - } - - private static void SetValue(ModuleEnergy moduleEnergy, float value) { - Traverse.Create(moduleEnergy).Field("m_OutputPerSecond").SetValue(value); - } - } +using System; +using System.Collections.Generic; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class GeneratorPropertiesManager { + private static Dictionary generators = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleEnergy), "OnAttached")] + static void PostfixCreate(ModuleEnergy __instance) { + // Console.WriteLine("ModuleEnergy.OnAttached"); + if (!generators.ContainsKey(__instance)) { + generators.Add(__instance, GetValue(__instance)); + // Console.WriteLine("Patching {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleEnergy), "OnDetaching")] + static void PostfixDestroy(ModuleEnergy __instance) { + // Console.WriteLine("ModuleEnergy.OnDetaching"); + // Console.WriteLine("Restoring {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; m_OutputPerSecond: {1}", __instance.name, GetValue(__instance)); + generators.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleEnergy", generators.Count); + foreach (KeyValuePair keyValuePair in generators) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleEnergy moduleEnergy) { + SetValue(moduleEnergy, generators[moduleEnergy] * Main.energyGenMultiplier.Value); + } + + static void DoRestoreSingle(ModuleEnergy moduleEnergy) { + if (generators.ContainsKey(moduleEnergy)) { + SetValue(moduleEnergy, generators[moduleEnergy]); + } + } + + private static float GetValue(ModuleEnergy moduleEnergy) { + return Traverse.Create(moduleEnergy).Field("m_OutputPerSecond").GetValue() as float? ?? 0f; + } + + private static void SetValue(ModuleEnergy moduleEnergy, float value) { + Traverse.Create(moduleEnergy).Field("m_OutputPerSecond").SetValue(value); + } + } } \ No newline at end of file diff --git a/Projects/TerraTech/TerraTech/HomingAndVelocityProjectilePatch.cs b/Projects/TerraTech/TerraTech/HomingAndVelocityProjectilePatch.cs index b88dca9..cc8bbbe 100644 --- a/Projects/TerraTech/TerraTech/HomingAndVelocityProjectilePatch.cs +++ b/Projects/TerraTech/TerraTech/HomingAndVelocityProjectilePatch.cs @@ -1,22 +1,22 @@ -using System.Collections.Generic; -using HarmonyLib; -using UnityEngine; - -namespace TerraTech { - [HarmonyPatch(typeof(Projectile), "Fire")] - public class HomingAndVelocityProjectilePatch { - private static Dictionary velocities = new Dictionary(); - - static void Prefix(Vector3 fireDirection, ref FireData fireData, ref ModuleWeaponGun weapon, Tank shooter, ref bool seekingRounds, bool replayRounds) { - if (Main.allProjectilesHoming.Value) { - seekingRounds = true; - } - if (!velocities.ContainsKey(fireData)) { - velocities.Add(fireData, fireData.m_MuzzleVelocity); - fireData.m_MuzzleVelocity *= Main.muzzleVelocityMultiplier.Value; - } else if (velocities[fireData] != fireData.m_MuzzleVelocity * Main.muzzleVelocityMultiplier.Value) { - fireData.m_MuzzleVelocity = velocities[fireData] * Main.muzzleVelocityMultiplier.Value; - } - } - } +using System.Collections.Generic; +using HarmonyLib; +using UnityEngine; + +namespace TerraTech { + [HarmonyPatch(typeof(Projectile), "Fire")] + public class HomingAndVelocityProjectilePatch { + private static Dictionary velocities = new Dictionary(); + + static void Prefix(Vector3 fireDirection, ref FireData fireData, ref ModuleWeaponGun weapon, Tank shooter, ref bool seekingRounds, bool replayRounds) { + if (Main.allProjectilesHoming.Value) { + seekingRounds = true; + } + if (!velocities.ContainsKey(fireData)) { + velocities.Add(fireData, fireData.m_MuzzleVelocity); + fireData.m_MuzzleVelocity *= Main.muzzleVelocityMultiplier.Value; + } else if (velocities[fireData] != fireData.m_MuzzleVelocity * Main.muzzleVelocityMultiplier.Value) { + fireData.m_MuzzleVelocity = velocities[fireData] * Main.muzzleVelocityMultiplier.Value; + } + } + } } \ No newline at end of file diff --git a/Projects/TerraTech/TerraTech/MagnetPropertiesManager.cs b/Projects/TerraTech/TerraTech/MagnetPropertiesManager.cs index 121beb4..23a74c1 100644 --- a/Projects/TerraTech/TerraTech/MagnetPropertiesManager.cs +++ b/Projects/TerraTech/TerraTech/MagnetPropertiesManager.cs @@ -1,81 +1,81 @@ -using System; -using System.Collections.Generic; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class MagnetPropertiesManager { - private static Dictionary strenghts = new Dictionary(); - private static Dictionary radii = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleItemHolderMagnet), "OnAttached")] - static void PostfixCreate(ModuleItemHolderMagnet __instance) { - // Console.WriteLine("ModuleItemHolderMagnet.OnAttached"); - if (!strenghts.ContainsKey(__instance)) { - strenghts.Add(__instance, GetStrength(__instance)); - radii.Add(__instance, GetRadius(__instance)); - // Console.WriteLine("Patching {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleItemHolderMagnet), "OnDetaching")] - static void PostfixDestroy(ModuleItemHolderMagnet __instance) { - // Console.WriteLine("ModuleItemHolderMagnet.OnDetaching"); - // Console.WriteLine("Restoring {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); - strenghts.Remove(__instance); - radii.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleItemHolderMagnet", strenghts.Count); - foreach (KeyValuePair keyValuePair in strenghts) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleItemHolderMagnet moduleItemHolderMagnet) { - SetStrength(moduleItemHolderMagnet, strenghts[moduleItemHolderMagnet] * Main.magnetStrenghtMultiplier.Value); - SetRadius(moduleItemHolderMagnet, radii[moduleItemHolderMagnet] * Main.magnetRadiusMultiplier.Value); - } - - static void DoRestoreSingle(ModuleItemHolderMagnet moduleItemHolderMagnet) { - if (strenghts.ContainsKey(moduleItemHolderMagnet)) { - SetStrength(moduleItemHolderMagnet, strenghts[moduleItemHolderMagnet]); - } - if (radii.ContainsKey(moduleItemHolderMagnet)) { - SetRadius(moduleItemHolderMagnet, radii[moduleItemHolderMagnet]); - } - } - - private static float GetStrength(ModuleItemHolderMagnet moduleItemHolderMagnet) { - return Traverse.Create(moduleItemHolderMagnet).Field("m_Strength").GetValue() as float? ?? 0f; - } - - private static void SetStrength(ModuleItemHolderMagnet moduleItemHolderMagnet, float value) { - Traverse.Create(moduleItemHolderMagnet).Field("m_Strength").SetValue(value); - } - - private static float GetRadius(ModuleItemHolderMagnet moduleItemHolderMagnet) { - ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderMagnet).Field("m_Pickup").GetValue() as ModuleItemPickup; - if (moduleItemPickup) { - float radius = Traverse.Create(moduleItemPickup).Field("m_PickupRange").GetValue() as float? ?? 0f; - return radius; - } - return 0f; - } - - private static void SetRadius(ModuleItemHolderMagnet moduleItemHolderMagnet, float value) { - ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderMagnet).Field("m_Pickup").GetValue() as ModuleItemPickup; - if (moduleItemPickup) { - Traverse.Create(moduleItemPickup).Field("m_PickupRange").SetValue(value); - } - } - } +using System; +using System.Collections.Generic; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class MagnetPropertiesManager { + private static Dictionary strenghts = new Dictionary(); + private static Dictionary radii = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemHolderMagnet), "OnAttached")] + static void PostfixCreate(ModuleItemHolderMagnet __instance) { + // Console.WriteLine("ModuleItemHolderMagnet.OnAttached"); + if (!strenghts.ContainsKey(__instance)) { + strenghts.Add(__instance, GetStrength(__instance)); + radii.Add(__instance, GetRadius(__instance)); + // Console.WriteLine("Patching {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemHolderMagnet), "OnDetaching")] + static void PostfixDestroy(ModuleItemHolderMagnet __instance) { + // Console.WriteLine("ModuleItemHolderMagnet.OnDetaching"); + // Console.WriteLine("Restoring {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; m_Strength: {1}; m_Pickup.m_PickupRange: {2}", __instance.name, GetStrength(__instance), GetRadius(__instance)); + strenghts.Remove(__instance); + radii.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleItemHolderMagnet", strenghts.Count); + foreach (KeyValuePair keyValuePair in strenghts) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleItemHolderMagnet moduleItemHolderMagnet) { + SetStrength(moduleItemHolderMagnet, strenghts[moduleItemHolderMagnet] * Main.magnetStrenghtMultiplier.Value); + SetRadius(moduleItemHolderMagnet, radii[moduleItemHolderMagnet] * Main.magnetRadiusMultiplier.Value); + } + + static void DoRestoreSingle(ModuleItemHolderMagnet moduleItemHolderMagnet) { + if (strenghts.ContainsKey(moduleItemHolderMagnet)) { + SetStrength(moduleItemHolderMagnet, strenghts[moduleItemHolderMagnet]); + } + if (radii.ContainsKey(moduleItemHolderMagnet)) { + SetRadius(moduleItemHolderMagnet, radii[moduleItemHolderMagnet]); + } + } + + private static float GetStrength(ModuleItemHolderMagnet moduleItemHolderMagnet) { + return Traverse.Create(moduleItemHolderMagnet).Field("m_Strength").GetValue() as float? ?? 0f; + } + + private static void SetStrength(ModuleItemHolderMagnet moduleItemHolderMagnet, float value) { + Traverse.Create(moduleItemHolderMagnet).Field("m_Strength").SetValue(value); + } + + private static float GetRadius(ModuleItemHolderMagnet moduleItemHolderMagnet) { + ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderMagnet).Field("m_Pickup").GetValue() as ModuleItemPickup; + if (moduleItemPickup) { + float radius = Traverse.Create(moduleItemPickup).Field("m_PickupRange").GetValue() as float? ?? 0f; + return radius; + } + return 0f; + } + + private static void SetRadius(ModuleItemHolderMagnet moduleItemHolderMagnet, float value) { + ModuleItemPickup moduleItemPickup = Traverse.Create(moduleItemHolderMagnet).Field("m_Pickup").GetValue() as ModuleItemPickup; + if (moduleItemPickup) { + Traverse.Create(moduleItemPickup).Field("m_PickupRange").SetValue(value); + } + } + } } \ No newline at end of file diff --git a/Projects/TerraTech/TerraTech/MinerPropertiesManager.cs b/Projects/TerraTech/TerraTech/MinerPropertiesManager.cs index 090e47b..4335a10 100644 --- a/Projects/TerraTech/TerraTech/MinerPropertiesManager.cs +++ b/Projects/TerraTech/TerraTech/MinerPropertiesManager.cs @@ -1,86 +1,86 @@ -using System; -using System.Collections.Generic; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class MinerPropertiesManager { - private static Dictionary area = new Dictionary(); - private static Dictionary speed = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleItemProducer), "GetClosestResourceReservoirInRange")] - static void PostfixCreate(ModuleItemProducer __instance) { - // Console.WriteLine("ModuleItemProducer.GetClosestResourceReservoirInRange"); - if (!area.ContainsKey(__instance)) { - area.Add(__instance, GetArea(__instance)); - speed.Add(__instance, GetSpeed(__instance)); - // Console.WriteLine("Patching {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), - // GetSpeed(__instance)); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), - // GetSpeed(__instance)); - } else { - if (GetArea(__instance) == area[__instance]) { - // Console.WriteLine("{0} area reset, patching again... m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, - // GetArea(__instance), GetSpeed(__instance)); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), - // GetSpeed(__instance)); - } - if (GetSpeed(__instance) == speed[__instance]) { - // Console.WriteLine("{0} speed reset, patching again... m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, - // GetArea(__instance), GetSpeed(__instance)); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), - // GetSpeed(__instance)); - } - } - } - - [HarmonyPostfix] - [HarmonyPatch(typeof(ModuleItemProducer), "OnDetaching")] - static void PostfixDestroy(ModuleItemProducer __instance) { - // Console.WriteLine("ModuleItemProducer.OnRecycle"); - DoRestoreSingle(__instance); - area.Remove(__instance); - speed.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleItemProducer", area.Count); - foreach (KeyValuePair keyValuePair in area) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleItemProducer moduleItemProducer) { - SetArea(moduleItemProducer, area[moduleItemProducer] * Main.minerGroundArea.Value); - SetSpeed(moduleItemProducer, speed[moduleItemProducer] / Main.minerMiningSpeed.Value); - } - - static void DoRestoreSingle(ModuleItemProducer moduleItemProducer) { - if (area.ContainsKey(moduleItemProducer)) { - SetArea(moduleItemProducer, area[moduleItemProducer]); - SetSpeed(moduleItemProducer, speed[moduleItemProducer]); - } - } - - private static float GetArea(ModuleItemProducer moduleItemProducer) { - return Traverse.Create(moduleItemProducer).Field("m_ResourceGroundRadius").GetValue() as float? ?? 0f; - } - - private static void SetArea(ModuleItemProducer moduleItemProducer, float value) { - Traverse.Create(moduleItemProducer).Field("m_ResourceGroundRadius").SetValue(value); - } - - private static float GetSpeed(ModuleItemProducer moduleItemProducer) { - return Traverse.Create(moduleItemProducer).Field("m_SecPerItemProduced").GetValue() as float? ?? 0f; - } - - private static void SetSpeed(ModuleItemProducer moduleItemProducer, float value) { - Traverse.Create(moduleItemProducer).Field("m_SecPerItemProduced").SetValue(value); - } - } +using System; +using System.Collections.Generic; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class MinerPropertiesManager { + private static Dictionary area = new Dictionary(); + private static Dictionary speed = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemProducer), "GetClosestResourceReservoirInRange")] + static void PostfixCreate(ModuleItemProducer __instance) { + // Console.WriteLine("ModuleItemProducer.GetClosestResourceReservoirInRange"); + if (!area.ContainsKey(__instance)) { + area.Add(__instance, GetArea(__instance)); + speed.Add(__instance, GetSpeed(__instance)); + // Console.WriteLine("Patching {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), + // GetSpeed(__instance)); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), + // GetSpeed(__instance)); + } else { + if (GetArea(__instance) == area[__instance]) { + // Console.WriteLine("{0} area reset, patching again... m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, + // GetArea(__instance), GetSpeed(__instance)); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), + // GetSpeed(__instance)); + } + if (GetSpeed(__instance) == speed[__instance]) { + // Console.WriteLine("{0} speed reset, patching again... m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, + // GetArea(__instance), GetSpeed(__instance)); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_ResourceGroundRadius: {1}; m_SecPerItemProduced: {2}", __instance.name, GetArea(__instance), + // GetSpeed(__instance)); + } + } + } + + [HarmonyPostfix] + [HarmonyPatch(typeof(ModuleItemProducer), "OnDetaching")] + static void PostfixDestroy(ModuleItemProducer __instance) { + // Console.WriteLine("ModuleItemProducer.OnRecycle"); + DoRestoreSingle(__instance); + area.Remove(__instance); + speed.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleItemProducer", area.Count); + foreach (KeyValuePair keyValuePair in area) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleItemProducer moduleItemProducer) { + SetArea(moduleItemProducer, area[moduleItemProducer] * Main.minerGroundArea.Value); + SetSpeed(moduleItemProducer, speed[moduleItemProducer] / Main.minerMiningSpeed.Value); + } + + static void DoRestoreSingle(ModuleItemProducer moduleItemProducer) { + if (area.ContainsKey(moduleItemProducer)) { + SetArea(moduleItemProducer, area[moduleItemProducer]); + SetSpeed(moduleItemProducer, speed[moduleItemProducer]); + } + } + + private static float GetArea(ModuleItemProducer moduleItemProducer) { + return Traverse.Create(moduleItemProducer).Field("m_ResourceGroundRadius").GetValue() as float? ?? 0f; + } + + private static void SetArea(ModuleItemProducer moduleItemProducer, float value) { + Traverse.Create(moduleItemProducer).Field("m_ResourceGroundRadius").SetValue(value); + } + + private static float GetSpeed(ModuleItemProducer moduleItemProducer) { + return Traverse.Create(moduleItemProducer).Field("m_SecPerItemProduced").GetValue() as float? ?? 0f; + } + + private static void SetSpeed(ModuleItemProducer moduleItemProducer, float value) { + Traverse.Create(moduleItemProducer).Field("m_SecPerItemProduced").SetValue(value); + } + } } \ No newline at end of file diff --git a/Projects/TerraTech/TerraTech/Patches.cs b/Projects/TerraTech/TerraTech/Patches.cs index 8bc5ea8..99769e9 100644 --- a/Projects/TerraTech/TerraTech/Patches.cs +++ b/Projects/TerraTech/TerraTech/Patches.cs @@ -1,24 +1,24 @@ -using HarmonyLib; - -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); - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ManPlayer), "AddMoney")] - static void MoneyMulti(ref int amount) { - amount = (int)(amount * Main.moneyMultiplier.Value); - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(TechHolders), "SetHeartbeatInterval")] - static void HeartbeatMulti(ref float interval) { - interval *= Main.heartbeatIntervalMultiplier.Value; - } - } +using HarmonyLib; + +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); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ManPlayer), "AddMoney")] + static void MoneyMulti(ref int amount) { + amount = (int)(amount * Main.moneyMultiplier.Value); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(TechHolders), "SetHeartbeatInterval")] + static void HeartbeatMulti(ref float interval) { + interval *= Main.heartbeatIntervalMultiplier.Value; + } + } } \ No newline at end of file diff --git a/Projects/TerraTech/TerraTech/Properties/AssemblyInfo.cs b/Projects/TerraTech/TerraTech/Properties/AssemblyInfo.cs index ca6f22b..e5c11ac 100644 --- a/Projects/TerraTech/TerraTech/Properties/AssemblyInfo.cs +++ b/Projects/TerraTech/TerraTech/Properties/AssemblyInfo.cs @@ -1,35 +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("TerraTech")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("TerraTech")] -[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("EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE")] - -// 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")] +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("TerraTech")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("TerraTech")] +[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("EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE")] + +// 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/TerraTech/TerraTech/SeekingProjectileManager.cs b/Projects/TerraTech/TerraTech/SeekingProjectileManager.cs index 7a41c5a..b0e1c63 100644 --- a/Projects/TerraTech/TerraTech/SeekingProjectileManager.cs +++ b/Projects/TerraTech/TerraTech/SeekingProjectileManager.cs @@ -1,24 +1,24 @@ -using System; -using HarmonyLib; - -namespace TerraTech { - public class SeekingProjectileManager { - [HarmonyPatch(typeof(SeekingProjectile), "OnSpawn")] - class Patch { - static void Postfix(SeekingProjectile __instance) { - Console.WriteLine("SeekingProjectile created"); - SetField(__instance, "m_VisionConeAngle", Main.seekingProjectileVisionConeAngleMultiplier.Value * GetField(__instance, "m_VisionConeAngle")); - SetField(__instance, "m_VisionRange", Main.seekingProjectileVisionRangeMultiplier.Value * GetField(__instance, "m_VisionRange")); - SetField(__instance, "m_TurnSpeed", Main.seekingProjectileTurningSpeedMultiplier.Value * GetField(__instance, "m_TurnSpeed")); - } - } - - private static float GetField(SeekingProjectile seekingProjectile, string field) { - return Traverse.Create(seekingProjectile).Field(field).GetValue() as float? ?? 0f; - } - - private static void SetField(SeekingProjectile seekingProjectile, string field, float value) { - Traverse.Create(seekingProjectile).Field(field).SetValue(value); - } - } +using System; +using HarmonyLib; + +namespace TerraTech { + public class SeekingProjectileManager { + [HarmonyPatch(typeof(SeekingProjectile), "OnSpawn")] + class Patch { + static void Postfix(SeekingProjectile __instance) { + Console.WriteLine("SeekingProjectile created"); + SetField(__instance, "m_VisionConeAngle", Main.seekingProjectileVisionConeAngleMultiplier.Value * GetField(__instance, "m_VisionConeAngle")); + SetField(__instance, "m_VisionRange", Main.seekingProjectileVisionRangeMultiplier.Value * GetField(__instance, "m_VisionRange")); + SetField(__instance, "m_TurnSpeed", Main.seekingProjectileTurningSpeedMultiplier.Value * GetField(__instance, "m_TurnSpeed")); + } + } + + private static float GetField(SeekingProjectile seekingProjectile, string field) { + return Traverse.Create(seekingProjectile).Field(field).GetValue() as float? ?? 0f; + } + + private static void SetField(SeekingProjectile seekingProjectile, string field, float value) { + Traverse.Create(seekingProjectile).Field(field).SetValue(value); + } + } } \ No newline at end of file diff --git a/Projects/TerraTech/TerraTech/TerraTech.csproj b/Projects/TerraTech/TerraTech/TerraTech.csproj index 257846a..046b7c3 100644 --- a/Projects/TerraTech/TerraTech/TerraTech.csproj +++ b/Projects/TerraTech/TerraTech/TerraTech.csproj @@ -1,78 +1,78 @@ - - - - - Debug - AnyCPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE} - Library - Properties - TerraTech - TerraTech - v4.8 - 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\UnityEngine.dll - - - ..\libs\UnityEngine.CoreModule.dll - - - - + + + + + Debug + AnyCPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE} + Library + Properties + TerraTech + TerraTech + v4.8 + 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\UnityEngine.dll + + + ..\libs\UnityEngine.CoreModule.dll + + + + \ No newline at end of file diff --git a/Projects/TerraTech/TerraTech/ThrusterPropertiesManager.cs b/Projects/TerraTech/TerraTech/ThrusterPropertiesManager.cs index 7443f17..0b45476 100644 --- a/Projects/TerraTech/TerraTech/ThrusterPropertiesManager.cs +++ b/Projects/TerraTech/TerraTech/ThrusterPropertiesManager.cs @@ -1,89 +1,89 @@ -using System; -using System.Collections.Generic; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class ThrusterPropertiesManager { - private static Dictionary> boosters = new Dictionary>(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleBooster), "OnAttached")] - static void PostfixCreate(ModuleBooster __instance) { - // Console.WriteLine("ModuleBooster.OnAttached"); - if (!boosters.ContainsKey(__instance)) { - boosters.Add(__instance, Map(__instance)); - // Console.WriteLine("Patching {0}; force: {1}", __instance.name, GetForceAsString(__instance)); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; force: {1}", __instance.name, GetForceAsString(__instance)); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleBooster), "OnDetaching")] - static void PostfixDestroy(ModuleBooster __instance) { - // Console.WriteLine("ModuleBooster.OnDetaching"); - // Console.WriteLine("Restoring {0}; force: {1}", __instance.name, GetForceAsString(__instance)); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; force: {1}", __instance.name, GetForceAsString(__instance)); - boosters.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleBooster", boosters.Count); - foreach (KeyValuePair> keyValuePair in boosters) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleBooster moduleBooster) { - List jets = GetValue(moduleBooster); - for (var i = 0; i < jets.Count; i++) { - boosters[moduleBooster][jets[i]] = GetValue(jets[i]); - SetValue(jets[i], GetValue(jets[i]) * Main.jetThrustMultiplier.Value); - } - SetValue(moduleBooster, jets); - } - - static void DoRestoreSingle(ModuleBooster moduleBooster) { - if (boosters.ContainsKey(moduleBooster)) { - foreach (BoosterJet boosterJet in GetValue(moduleBooster)) { - SetValue(boosterJet, boosters[moduleBooster][boosterJet]); - } - } - } - - private static Dictionary Map(ModuleBooster moduleBooster) { - Dictionary jets = new Dictionary(); - foreach (BoosterJet boosterJet in GetValue(moduleBooster)) { - jets.Add(boosterJet, GetValue(boosterJet)); - } - return jets; - } - - private static List GetValue(ModuleBooster moduleBooster) { - return Traverse.Create(moduleBooster).Field("jets").GetValue() as List; - } - - private static void SetValue(ModuleBooster moduleBooster, List value) { - Traverse.Create(moduleBooster).Field("jets").SetValue(value); - } - - private static float GetValue(BoosterJet boosterJet) { - return Traverse.Create(boosterJet).Field("m_Force").GetValue() as float? ?? 0f; - } - - private static void SetValue(BoosterJet boosterJet, float value) { - Traverse.Create(boosterJet).Field("m_Force").SetValue(value); - } - - private static string GetForceAsString(ModuleBooster moduleBooster) { - string result = ""; - foreach (BoosterJet boosterJet in GetValue(moduleBooster)) { - result += GetValue(boosterJet) + ", "; - } - return result; - } - } +using System; +using System.Collections.Generic; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class ThrusterPropertiesManager { + private static Dictionary> boosters = new Dictionary>(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleBooster), "OnAttached")] + static void PostfixCreate(ModuleBooster __instance) { + // Console.WriteLine("ModuleBooster.OnAttached"); + if (!boosters.ContainsKey(__instance)) { + boosters.Add(__instance, Map(__instance)); + // Console.WriteLine("Patching {0}; force: {1}", __instance.name, GetForceAsString(__instance)); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; force: {1}", __instance.name, GetForceAsString(__instance)); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleBooster), "OnDetaching")] + static void PostfixDestroy(ModuleBooster __instance) { + // Console.WriteLine("ModuleBooster.OnDetaching"); + // Console.WriteLine("Restoring {0}; force: {1}", __instance.name, GetForceAsString(__instance)); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; force: {1}", __instance.name, GetForceAsString(__instance)); + boosters.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleBooster", boosters.Count); + foreach (KeyValuePair> keyValuePair in boosters) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleBooster moduleBooster) { + List jets = GetValue(moduleBooster); + for (var i = 0; i < jets.Count; i++) { + boosters[moduleBooster][jets[i]] = GetValue(jets[i]); + SetValue(jets[i], GetValue(jets[i]) * Main.jetThrustMultiplier.Value); + } + SetValue(moduleBooster, jets); + } + + static void DoRestoreSingle(ModuleBooster moduleBooster) { + if (boosters.ContainsKey(moduleBooster)) { + foreach (BoosterJet boosterJet in GetValue(moduleBooster)) { + SetValue(boosterJet, boosters[moduleBooster][boosterJet]); + } + } + } + + private static Dictionary Map(ModuleBooster moduleBooster) { + Dictionary jets = new Dictionary(); + foreach (BoosterJet boosterJet in GetValue(moduleBooster)) { + jets.Add(boosterJet, GetValue(boosterJet)); + } + return jets; + } + + private static List GetValue(ModuleBooster moduleBooster) { + return Traverse.Create(moduleBooster).Field("jets").GetValue() as List; + } + + private static void SetValue(ModuleBooster moduleBooster, List value) { + Traverse.Create(moduleBooster).Field("jets").SetValue(value); + } + + private static float GetValue(BoosterJet boosterJet) { + return Traverse.Create(boosterJet).Field("m_Force").GetValue() as float? ?? 0f; + } + + private static void SetValue(BoosterJet boosterJet, float value) { + Traverse.Create(boosterJet).Field("m_Force").SetValue(value); + } + + private static string GetForceAsString(ModuleBooster moduleBooster) { + string result = ""; + foreach (BoosterJet boosterJet in GetValue(moduleBooster)) { + result += GetValue(boosterJet) + ", "; + } + return result; + } + } } \ No newline at end of file diff --git a/Projects/TerraTech/TerraTech/WeaponPropertiesManager.cs b/Projects/TerraTech/TerraTech/WeaponPropertiesManager.cs index c48c2c4..50dc882 100644 --- a/Projects/TerraTech/TerraTech/WeaponPropertiesManager.cs +++ b/Projects/TerraTech/TerraTech/WeaponPropertiesManager.cs @@ -1,51 +1,51 @@ -using System; -using System.Collections.Generic; -using BepInEx.Configuration; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class WeaponPropertiesManager { - private static Dictionary shotCooldown = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleWeaponGun), "OnAttached")] - static void PostfixCreate(ModuleWeaponGun __instance) { - // Console.WriteLine("ModuleWeaponGun.OnAttached"); - if (!shotCooldown.ContainsKey(__instance)) { - shotCooldown.Add(__instance, __instance.m_ShotCooldown); - // Console.WriteLine("Patching {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleWeaponGun), "OnDetaching")] - static void PostfixDestroy(ModuleWeaponGun __instance) { - // Console.WriteLine("ModuleWeaponGun.OnDetaching"); - // Console.WriteLine("Restoring {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); - shotCooldown.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleWeaponGun", shotCooldown.Count); - foreach (KeyValuePair keyValuePair in shotCooldown) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleWeaponGun moduleWeaponGun) { - moduleWeaponGun.m_ShotCooldown = shotCooldown[moduleWeaponGun] / Main.shootingSpeedMultiplier.Value; - } - - static void DoRestoreSingle(ModuleWeaponGun moduleWeaponGun) { - if (shotCooldown.ContainsKey(moduleWeaponGun)) { - moduleWeaponGun.m_ShotCooldown = shotCooldown[moduleWeaponGun]; - } - } - } +using System; +using System.Collections.Generic; +using BepInEx.Configuration; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class WeaponPropertiesManager { + private static Dictionary shotCooldown = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWeaponGun), "OnAttached")] + static void PostfixCreate(ModuleWeaponGun __instance) { + // Console.WriteLine("ModuleWeaponGun.OnAttached"); + if (!shotCooldown.ContainsKey(__instance)) { + shotCooldown.Add(__instance, __instance.m_ShotCooldown); + // Console.WriteLine("Patching {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWeaponGun), "OnDetaching")] + static void PostfixDestroy(ModuleWeaponGun __instance) { + // Console.WriteLine("ModuleWeaponGun.OnDetaching"); + // Console.WriteLine("Restoring {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; m_ShotCooldown: {1}", __instance.name, __instance.m_ShotCooldown); + shotCooldown.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleWeaponGun", shotCooldown.Count); + foreach (KeyValuePair keyValuePair in shotCooldown) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleWeaponGun moduleWeaponGun) { + moduleWeaponGun.m_ShotCooldown = shotCooldown[moduleWeaponGun] / Main.shootingSpeedMultiplier.Value; + } + + static void DoRestoreSingle(ModuleWeaponGun moduleWeaponGun) { + if (shotCooldown.ContainsKey(moduleWeaponGun)) { + moduleWeaponGun.m_ShotCooldown = shotCooldown[moduleWeaponGun]; + } + } + } } \ No newline at end of file diff --git a/Projects/TerraTech/TerraTech/WheelPropertiesManager.cs b/Projects/TerraTech/TerraTech/WheelPropertiesManager.cs index 1483a90..75dec0b 100644 --- a/Projects/TerraTech/TerraTech/WheelPropertiesManager.cs +++ b/Projects/TerraTech/TerraTech/WheelPropertiesManager.cs @@ -1,63 +1,63 @@ -using System; -using System.Collections.Generic; -using HarmonyLib; - -namespace TerraTech { - [HarmonyPatch] - public class WheelPropertiesManager { - private static Dictionary torques = new Dictionary(); - private static Dictionary maxRpm = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleWheels), "OnAttached")] - static void PostfixCreate(ModuleWheels __instance) { - // Console.WriteLine("ModuleWheels.OnAttached"); - if (!torques.ContainsKey(__instance)) { - torques.Add(__instance, __instance.m_TorqueParams.torqueCurveMaxTorque); - maxRpm.Add(__instance, __instance.m_TorqueParams.torqueCurveMaxRpm); - // Console.WriteLine("Patching {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, - // __instance.m_TorqueParams.torqueCurveMaxTorque, - // __instance.m_TorqueParams.torqueCurveMaxRpm); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, - // __instance.m_TorqueParams.torqueCurveMaxTorque, - // __instance.m_TorqueParams.torqueCurveMaxRpm); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleWheels), "OnDetaching")] - static void PostfixDestroy(ModuleWheels __instance) { - // Console.WriteLine("ModuleWheels.OnDetaching"); - // Console.WriteLine("Restoring {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, - // __instance.m_TorqueParams.torqueCurveMaxTorque, - // __instance.m_TorqueParams.torqueCurveMaxRpm); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, - // __instance.m_TorqueParams.torqueCurveMaxTorque, - // __instance.m_TorqueParams.torqueCurveMaxRpm); - torques.Remove(__instance); - maxRpm.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleWheels", torques.Count); - foreach (KeyValuePair keyValuePair in torques) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleWheels moduleWheels) { - moduleWheels.m_TorqueParams.torqueCurveMaxRpm = maxRpm[moduleWheels] * Main.wheelSpeedMultiplier.Value; - moduleWheels.m_TorqueParams.torqueCurveMaxTorque = torques[moduleWheels] * Main.wheelTorqueMultiplier.Value; - } - - static void DoRestoreSingle(ModuleWheels moduleWheels) { - if (torques.ContainsKey(moduleWheels)) { - moduleWheels.m_TorqueParams.torqueCurveMaxTorque = torques[moduleWheels]; - moduleWheels.m_TorqueParams.torqueCurveMaxRpm = maxRpm[moduleWheels]; - } - } - } +using System; +using System.Collections.Generic; +using HarmonyLib; + +namespace TerraTech { + [HarmonyPatch] + public class WheelPropertiesManager { + private static Dictionary torques = new Dictionary(); + private static Dictionary maxRpm = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWheels), "OnAttached")] + static void PostfixCreate(ModuleWheels __instance) { + // Console.WriteLine("ModuleWheels.OnAttached"); + if (!torques.ContainsKey(__instance)) { + torques.Add(__instance, __instance.m_TorqueParams.torqueCurveMaxTorque); + maxRpm.Add(__instance, __instance.m_TorqueParams.torqueCurveMaxRpm); + // Console.WriteLine("Patching {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, + // __instance.m_TorqueParams.torqueCurveMaxTorque, + // __instance.m_TorqueParams.torqueCurveMaxRpm); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, + // __instance.m_TorqueParams.torqueCurveMaxTorque, + // __instance.m_TorqueParams.torqueCurveMaxRpm); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWheels), "OnDetaching")] + static void PostfixDestroy(ModuleWheels __instance) { + // Console.WriteLine("ModuleWheels.OnDetaching"); + // Console.WriteLine("Restoring {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, + // __instance.m_TorqueParams.torqueCurveMaxTorque, + // __instance.m_TorqueParams.torqueCurveMaxRpm); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; m_TorqueParams.torqueCurveMaxTorque: {1}; m_TorqueParams.torqueCurveMaxRpm: {2}", __instance.name, + // __instance.m_TorqueParams.torqueCurveMaxTorque, + // __instance.m_TorqueParams.torqueCurveMaxRpm); + torques.Remove(__instance); + maxRpm.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleWheels", torques.Count); + foreach (KeyValuePair keyValuePair in torques) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleWheels moduleWheels) { + moduleWheels.m_TorqueParams.torqueCurveMaxRpm = maxRpm[moduleWheels] * Main.wheelSpeedMultiplier.Value; + moduleWheels.m_TorqueParams.torqueCurveMaxTorque = torques[moduleWheels] * Main.wheelTorqueMultiplier.Value; + } + + static void DoRestoreSingle(ModuleWheels moduleWheels) { + if (torques.ContainsKey(moduleWheels)) { + moduleWheels.m_TorqueParams.torqueCurveMaxTorque = torques[moduleWheels]; + moduleWheels.m_TorqueParams.torqueCurveMaxRpm = maxRpm[moduleWheels]; + } + } + } } \ No newline at end of file diff --git a/Projects/TerraTech/TerraTech/WirelessChargerPropertiesManager.cs b/Projects/TerraTech/TerraTech/WirelessChargerPropertiesManager.cs index 92aedcb..d80193b 100644 --- a/Projects/TerraTech/TerraTech/WirelessChargerPropertiesManager.cs +++ b/Projects/TerraTech/TerraTech/WirelessChargerPropertiesManager.cs @@ -1,60 +1,60 @@ -using System.Collections.Generic; -using HarmonyLib; - -// TODO: Fix this, no workey -namespace TerraTech { - [HarmonyPatch] - public class WirelessChargerPropertiesManager { - private static Dictionary radius = new Dictionary(); - private static Dictionary transferPerArc = new Dictionary(); - private static Dictionary arcFiringInterval = new Dictionary(); - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleRemoteCharger), "OnAttached")] - static void PostfixCreate(ModuleRemoteCharger __instance) { - // Console.WriteLine("ModuleRemoteCharger.OnAttached"); - if (!radius.ContainsKey(__instance)) { - radius.Add(__instance, __instance.m_ChargingRadius); - transferPerArc.Add(__instance, __instance.m_PowerTransferPerArc); - arcFiringInterval.Add(__instance, __instance.m_ArcFiringInterval); - // Console.WriteLine("Patching {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - DoPatchSingle(__instance); - // Console.WriteLine("Patched {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - } - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ModuleRemoteCharger), "OnDetaching")] - static void PostfixDestroy(ModuleRemoteCharger __instance) { - // Console.WriteLine("ModuleRemoteCharger.OnAttached"); - // Console.WriteLine("Restoring {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - DoRestoreSingle(__instance); - // Console.WriteLine("Restored {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); - radius.Remove(__instance); - transferPerArc.Remove(__instance); - arcFiringInterval.Remove(__instance); - } - - public static void DoPatch() { - // Console.WriteLine("Modifying {0} ModuleRemoteCharger", radius.Count); - foreach (KeyValuePair keyValuePair in radius) { - DoRestoreSingle(keyValuePair.Key); - DoPatchSingle(keyValuePair.Key); - } - } - - static void DoPatchSingle(ModuleRemoteCharger moduleRemoteCharger) { - moduleRemoteCharger.m_ChargingRadius = radius[moduleRemoteCharger] * Main.wirelessChargingRadiusMultiplier.Value; - moduleRemoteCharger.m_PowerTransferPerArc = radius[moduleRemoteCharger] * Main.wirelessChargingPowerPerArcMultiplier.Value; - moduleRemoteCharger.m_ArcFiringInterval = radius[moduleRemoteCharger] * Main.wirelessChargingArcFiringIntervalMultiplier.Value; - } - - static void DoRestoreSingle(ModuleRemoteCharger moduleRemoteCharger) { - if (radius.ContainsKey(moduleRemoteCharger)) { - moduleRemoteCharger.m_ChargingRadius = radius[moduleRemoteCharger]; - moduleRemoteCharger.m_PowerTransferPerArc = radius[moduleRemoteCharger]; - moduleRemoteCharger.m_ArcFiringInterval = radius[moduleRemoteCharger]; - } - } - } +using System.Collections.Generic; +using HarmonyLib; + +// TODO: Fix this, no workey +namespace TerraTech { + [HarmonyPatch] + public class WirelessChargerPropertiesManager { + private static Dictionary radius = new Dictionary(); + private static Dictionary transferPerArc = new Dictionary(); + private static Dictionary arcFiringInterval = new Dictionary(); + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleRemoteCharger), "OnAttached")] + static void PostfixCreate(ModuleRemoteCharger __instance) { + // Console.WriteLine("ModuleRemoteCharger.OnAttached"); + if (!radius.ContainsKey(__instance)) { + radius.Add(__instance, __instance.m_ChargingRadius); + transferPerArc.Add(__instance, __instance.m_PowerTransferPerArc); + arcFiringInterval.Add(__instance, __instance.m_ArcFiringInterval); + // Console.WriteLine("Patching {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + DoPatchSingle(__instance); + // Console.WriteLine("Patched {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleRemoteCharger), "OnDetaching")] + static void PostfixDestroy(ModuleRemoteCharger __instance) { + // Console.WriteLine("ModuleRemoteCharger.OnAttached"); + // Console.WriteLine("Restoring {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + DoRestoreSingle(__instance); + // Console.WriteLine("Restored {0}; m_RefillRate: {1}; m_Capacity: {2}", __instance.name, __instance.m_RefillRate, __instance.m_Capacity); + radius.Remove(__instance); + transferPerArc.Remove(__instance); + arcFiringInterval.Remove(__instance); + } + + public static void DoPatch() { + // Console.WriteLine("Modifying {0} ModuleRemoteCharger", radius.Count); + foreach (KeyValuePair keyValuePair in radius) { + DoRestoreSingle(keyValuePair.Key); + DoPatchSingle(keyValuePair.Key); + } + } + + static void DoPatchSingle(ModuleRemoteCharger moduleRemoteCharger) { + moduleRemoteCharger.m_ChargingRadius = radius[moduleRemoteCharger] * Main.wirelessChargingRadiusMultiplier.Value; + moduleRemoteCharger.m_PowerTransferPerArc = radius[moduleRemoteCharger] * Main.wirelessChargingPowerPerArcMultiplier.Value; + moduleRemoteCharger.m_ArcFiringInterval = radius[moduleRemoteCharger] * Main.wirelessChargingArcFiringIntervalMultiplier.Value; + } + + static void DoRestoreSingle(ModuleRemoteCharger moduleRemoteCharger) { + if (radius.ContainsKey(moduleRemoteCharger)) { + moduleRemoteCharger.m_ChargingRadius = radius[moduleRemoteCharger]; + moduleRemoteCharger.m_PowerTransferPerArc = radius[moduleRemoteCharger]; + moduleRemoteCharger.m_ArcFiringInterval = radius[moduleRemoteCharger]; + } + } + } } \ No newline at end of file diff --git a/Projects/TerraTech/TerraTech/obj/Debug/TerraTech.csproj.FileListAbsolute.txt b/Projects/TerraTech/TerraTech/obj/Debug/TerraTech.csproj.FileListAbsolute.txt index ff00c4c..a42810d 100644 --- a/Projects/TerraTech/TerraTech/obj/Debug/TerraTech.csproj.FileListAbsolute.txt +++ b/Projects/TerraTech/TerraTech/obj/Debug/TerraTech.csproj.FileListAbsolute.txt @@ -1,12 +1,12 @@ -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\TerraTech.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\TerraTech.pdb -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\0Harmony.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\Assembly-CSharp.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\BepInEx.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\UnityEngine.CoreModule.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\UnityEngine.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.csprojResolveAssemblyReference.cache -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.dll -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.pdb -C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\ConfigurationManager.dll -C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.csprojResolveAssemblyReference.cache +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\TerraTech.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\TerraTech.pdb +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\0Harmony.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\Assembly-CSharp.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\BepInEx.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\UnityEngine.CoreModule.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\UnityEngine.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.csprojResolveAssemblyReference.cache +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.dll +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.pdb +C:\Users\Administrator\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\bin\Debug\ConfigurationManager.dll +C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\TerraTech\TerraTech\obj\Debug\TerraTech.csprojResolveAssemblyReference.cache diff --git a/Projects/WeedShop3/WeedShop.sln b/Projects/WeedShop3/WeedShop.sln index d17afae..6802307 100644 --- a/Projects/WeedShop3/WeedShop.sln +++ b/Projects/WeedShop3/WeedShop.sln @@ -1,16 +1,16 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeedShop", "WeedShop\WeedShop.csproj", "{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WeedShop", "WeedShop\WeedShop.csproj", "{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Projects/WeedShop3/WeedShop.sln.DotSettings.user b/Projects/WeedShop3/WeedShop.sln.DotSettings.user index d3b7dce..7a3f325 100644 --- a/Projects/WeedShop3/WeedShop.sln.DotSettings.user +++ b/Projects/WeedShop3/WeedShop.sln.DotSettings.user @@ -1,8 +1,8 @@ - - True - True - True - True - True - True + + True + True + True + True + True + True True \ No newline at end of file diff --git a/Projects/WeedShop3/WeedShop/Class1.cs b/Projects/WeedShop3/WeedShop/Class1.cs index a941c45..1838f34 100644 --- a/Projects/WeedShop3/WeedShop/Class1.cs +++ b/Projects/WeedShop3/WeedShop/Class1.cs @@ -1,50 +1,50 @@ -using System.Linq; -using almost; -using almost.WF; -using BepInEx; -using BepInEx.Configuration; -using com.ootii.Messages; -using HarmonyLib; -using HarmonyLib.Tools; -using MeshCombineStudio; - -namespace WeedShop { - [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 moneyMultiplier; - public static ConfigEntry weedQuantityMultiplier; - public static ConfigEntry weedQualityMultiplier; - - public void Awake() { - moneyMultiplier = Config.Bind("General", "Money Multiplier", 2f, new ConfigDescription("Money Multiplier", new AcceptableValueRange(2f, 32f))); - weedQuantityMultiplier = Config.Bind("General", "Weed Quantity Multiplier", 2f, new ConfigDescription("Weed Quantity Multiplier", new AcceptableValueRange(2f, 8f))); - weedQualityMultiplier = Config.Bind("General", "Weed Quality Multiplier", 1.5f, new ConfigDescription("Weed Quality Multiplier", new AcceptableValueRange(1.5f, 8f))); - - 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"); - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(WeedFactory), "OnMakeMoney")] - private void OnMakeMoney(ref IMessage message) { - Console.Log("OnMakeMoney " + message.Data); - message.Data = (long)message.Data * moneyMultiplier.Value; - } - - [HarmonyPrefix] - [HarmonyPatch(typeof(ShopInventory), "AddWeed")] - public virtual void AddWeed(BI item, ref float rawQuality, ref int quantity) { - Console.Log("AddWeed " + item + " " + rawQuality + " " + quantity); - quantity = (int)(quantity * weedQuantityMultiplier.Value); - rawQuality *= weedQualityMultiplier.Value; - } - } +using System.Linq; +using almost; +using almost.WF; +using BepInEx; +using BepInEx.Configuration; +using com.ootii.Messages; +using HarmonyLib; +using HarmonyLib.Tools; +using MeshCombineStudio; + +namespace WeedShop { + [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 moneyMultiplier; + public static ConfigEntry weedQuantityMultiplier; + public static ConfigEntry weedQualityMultiplier; + + public void Awake() { + moneyMultiplier = Config.Bind("General", "Money Multiplier", 2f, new ConfigDescription("Money Multiplier", new AcceptableValueRange(2f, 32f))); + weedQuantityMultiplier = Config.Bind("General", "Weed Quantity Multiplier", 2f, new ConfigDescription("Weed Quantity Multiplier", new AcceptableValueRange(2f, 8f))); + weedQualityMultiplier = Config.Bind("General", "Weed Quality Multiplier", 1.5f, new ConfigDescription("Weed Quality Multiplier", new AcceptableValueRange(1.5f, 8f))); + + 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"); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(WeedFactory), "OnMakeMoney")] + private void OnMakeMoney(ref IMessage message) { + Console.Log("OnMakeMoney " + message.Data); + message.Data = (long)message.Data * moneyMultiplier.Value; + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ShopInventory), "AddWeed")] + public virtual void AddWeed(BI item, ref float rawQuality, ref int quantity) { + Console.Log("AddWeed " + item + " " + rawQuality + " " + quantity); + quantity = (int)(quantity * weedQuantityMultiplier.Value); + rawQuality *= weedQualityMultiplier.Value; + } + } } \ No newline at end of file diff --git a/Projects/WeedShop3/WeedShop/Properties/AssemblyInfo.cs b/Projects/WeedShop3/WeedShop/Properties/AssemblyInfo.cs index ca6f22b..e5c11ac 100644 --- a/Projects/WeedShop3/WeedShop/Properties/AssemblyInfo.cs +++ b/Projects/WeedShop3/WeedShop/Properties/AssemblyInfo.cs @@ -1,35 +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("TerraTech")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("TerraTech")] -[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("EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE")] - -// 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")] +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("TerraTech")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("TerraTech")] +[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("EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE")] + +// 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/WeedShop3/WeedShop/WeedShop.csproj b/Projects/WeedShop3/WeedShop/WeedShop.csproj index 336c4fb..a40bb80 100644 --- a/Projects/WeedShop3/WeedShop/WeedShop.csproj +++ b/Projects/WeedShop3/WeedShop/WeedShop.csproj @@ -1,69 +1,69 @@ - - - - - Debug - AnyCPU - {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE} - Library - Properties - TerraTech - TerraTech - v4.8 - 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\ootii.dll - - - ..\libs\UnityEngine.dll - - - ..\libs\UnityEngine.CoreModule.dll - - - - + + + + + Debug + AnyCPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE} + Library + Properties + TerraTech + TerraTech + v4.8 + 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\ootii.dll + + + ..\libs\UnityEngine.dll + + + ..\libs\UnityEngine.CoreModule.dll + + + + \ No newline at end of file