From fff44bfc93cdad489a3b09f951934b8f936f0a07 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sat, 17 May 2025 10:50:17 +0200 Subject: [PATCH] Add blacksmith master project --- Projects/BlacksmithMaster/.clang-format | 3 + .../.vs/BlacksmithMaster/v16/.suo | Bin 0 -> 56832 bytes .../BlacksmithMaster/.vs/Ereshor/v16/.suo | Bin 0 -> 56320 bytes .../BlacksmithMaster/BlacksmithMaster.sln | 16 + .../BlacksmithMaster/BlacksmithMaster.csproj | 94 ++++ .../BlacksmithMaster/Class1.cs | 48 ++ .../BlacksmithMaster/CykUtil.cs | 28 + .../BlacksmithMaster/ModuleBoosterManager.cs | 84 +++ .../BlacksmithMaster/ModuleEnergyManager.cs | 67 +++ .../ModuleEnergyStoreManager.cs | 60 ++ .../BlacksmithMaster/ModuleFuelTankManager.cs | 67 +++ .../BlacksmithMaster/ModuleGyroManager.cs | 60 ++ .../BlacksmithMaster/ModuleHeartManager.cs | 76 +++ .../ModuleItemHolderManager.cs | 164 ++++++ .../ModuleItemProducerManager.cs | 77 +++ .../ModuleRemoteChargerManager.cs | 77 +++ .../ModuleShieldGeneratorManager.cs | 88 +++ .../ModuleWeaponGunManager.cs | 121 ++++ .../BlacksmithMaster/ModuleWeaponManager.cs | 60 ++ .../BlacksmithMaster/ModuleWheelsManager.cs | 71 +++ .../BlacksmithMaster/ModuleWingManager.cs | 83 +++ .../BlacksmithMaster/MultiBuy.cs | 71 +++ .../BlacksmithMaster/ObjectFieldMultiplier.cs | 531 ++++++++++++++++++ .../BlacksmithMaster/Patches.cs | 24 + .../BlacksmithMaster/ProjectilePatch.cs | 22 + .../Properties/AssemblyInfo.cs | 35 ++ .../SeekingProjectileManager.cs | 30 + .../BlacksmithMaster/TankBeamManager.cs | 53 ++ .../BlacksmithMaster/TankManager.cs | 53 ++ .../BlacksmithMaster/UISnapshotPanelBuyAll.cs | 181 ++++++ .../BlacksmithMaster/BlacksmithMaster/log.cs | 14 + Projects/BlacksmithMaster/sync.yml | 3 + 32 files changed, 2361 insertions(+) create mode 100644 Projects/BlacksmithMaster/.clang-format create mode 100644 Projects/BlacksmithMaster/.vs/BlacksmithMaster/v16/.suo create mode 100644 Projects/BlacksmithMaster/.vs/Ereshor/v16/.suo create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster.sln create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/BlacksmithMaster.csproj create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/Class1.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/CykUtil.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ModuleBoosterManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ModuleEnergyManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ModuleEnergyStoreManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ModuleFuelTankManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ModuleGyroManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ModuleHeartManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ModuleItemHolderManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ModuleItemProducerManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ModuleRemoteChargerManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ModuleShieldGeneratorManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ModuleWeaponGunManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ModuleWeaponManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ModuleWheelsManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ModuleWingManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/MultiBuy.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ObjectFieldMultiplier.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/Patches.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/ProjectilePatch.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/Properties/AssemblyInfo.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/SeekingProjectileManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/TankBeamManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/TankManager.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/UISnapshotPanelBuyAll.cs create mode 100644 Projects/BlacksmithMaster/BlacksmithMaster/log.cs create mode 100644 Projects/BlacksmithMaster/sync.yml diff --git a/Projects/BlacksmithMaster/.clang-format b/Projects/BlacksmithMaster/.clang-format new file mode 100644 index 0000000..d53bf86 --- /dev/null +++ b/Projects/BlacksmithMaster/.clang-format @@ -0,0 +1,3 @@ +BasedOnStyle: Google +IndentWidth: 4 +ColumnLimit: 120 \ No newline at end of file diff --git a/Projects/BlacksmithMaster/.vs/BlacksmithMaster/v16/.suo b/Projects/BlacksmithMaster/.vs/BlacksmithMaster/v16/.suo new file mode 100644 index 0000000000000000000000000000000000000000..a50e4b3bb022342543b51f74a48f7b059288153b GIT binary patch literal 56832 zcmeHQO^_Q$6&^W1ID`O6i1SObNlfAdOVRFXwYzqHtiQD#yz$1nwnHLf>u=YxrPU&7 z{S&VV$$(~AI^?R?o-@Nzk%^&>iH+TI@v!o}rYqU=<-=JM@Iv>FCHu?XHntqM{ zKfQeUGEZLvz@bV*R0Bt}3O;phOiO92_^oOe*p!~r4(+;To8Q*quAlzo|9cgu!M=Ku_=$H-E1?8ctpHd= zU1R`-Mn0#Xo!Yj5U;M}Luu!8T9oE)?rKA->KVij$If*k>C&Z2O#Lqr@9f0NNkX^t0 zEquS%$oMFJ|7Rv(3m#Lxd==#k0m6Vs0ONp3z+-^jfCyj$z`W1kcN#DQm<8+s>;*gy zcmnVw;3>d9KnxHEBmhZ33NQ!Q4>$lg2zVOsHNYXjJb*Y3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ff --git a/Projects/BlacksmithMaster/.vs/Ereshor/v16/.suo b/Projects/BlacksmithMaster/.vs/Ereshor/v16/.suo new file mode 100644 index 0000000000000000000000000000000000000000..112ae7ca414c0de354ac8a1cc52bdfc802a22e17 GIT binary patch literal 56320 zcmeHQeQ+Dcbw9}8mZMg2?IwwxL4u&9RJ0gTA4v^c0)Zn12_#qm z)Q3gYsjZ}6Q>TA)ntI~eZpZ&5ZZmQJ>a7O2_$vAD3)a^|AuhU8G%w#;7OvCmW*>!Bxh(&>|P_?YlvddUJd4HvacVhz9wJpvq^t z3swm=s8}{&3T=@C*iO1;r=8Z8NW0~qKxQX7m=F$IizuaJ6@fotRx5c7F%_At=~0#c zVWeO^nkLk4EaCb;od0*?{C_$E&Nat0f#G(f`6U2(!LI-qcL&b5IM;XMd>ddp;Db)w zHs^egb5?or*|iLZk$=i5L(g{*aYKM%z+S*Uz^4EY0UicC0(cZK0vH9P0b_s+U>vX? zZ~$-+@M*vVK;{1!u8Gei&d0QPb^kcx*vI(>_f(oj=K|7`-ev%^fYX2?;0)j_pal33 zpwY9P#;xc0|Hh3kh2tOn*G=PJ(T(B*q-&0M6|crE$N!B0j(?7Aj{jQ$P~$or|D>MlFHC{b^3M1=2kI&aYKvhN zQiiEqx#1(Z}1E59dD6NM*N#PSZ~%D|WFLD?E^jWGTqT*{KCk$T)a&9D9t zw?5wdcH4J!s%`h->$U%1b{gt>@BeWA4W zn+FdrfE$zR&(-ncPUIi16}f(7@GJkgn2T!GQItHrBKz=(0yyz$F*9KPiR?x`iU*2J zTO8CnmdX6eKY=nRg&l^}$1~f(3|j<==<=SO>Fyjs9;zq-uX9|Cwj%_RKgw!#J-0sSn^i$Vwp916n(||mH)MW!^0M!36t*QT;L;O6T3|IjCHh?-}N=aN7ECS8}&I43g z`uQ^Ae+TfibAJrj90DfPHRm92l~J-Ez2h-Y*a7-uUy~Ms(%%%)att!4l^s_+9O)H@ z=9N950@`mRcgd$o16v}u;SXslX!&dp_52tx&U?7PBx0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>;#agjEU$INMTJfB{*LKq7OSx*b zAIX-ME{&wpgURH`P&A%Njzp8==~Q%RC^Zs|r;-ChiTIvmYA|^j=too&6d&!r+KqKv zm2OL`CXRei_0CGvCnDSH;&$ikfx%pAIv%wX$vsiD{SbP(FcaNl=VlVaN!w1OhGX$~ zd@wPzS9I{2F%WfnV&V?T0}TqWl-^ zi00v^qdN`{;z`y)lpe9RdEbGmi+Ecm6jlBENZ#V-pckR6pnnQg7CD%K=7b`HP6*!3 zx|vGrGqBwH+UfQ0asMCsWu7#3Ty0}B)=BQw6|KjkZLV`llH+! zX>D_iiSHPf1R;~0mrw$~SKf#De-d9Qi$Urf1(DYvd!EKs39X~I!y{{6pE1;eUu~al zyDnrK+>e#=KEF$!M%`ycZEqDE!TWZkiRnJad+fVl!gu1Si1pT*Ozru-*~O||sb+J9 zx#E1WTC3!05CE!}EQ%#N%jw_F*Q(JLLW*_;Qip|Jo*L5 zU+@v>oz-6kIO>kXY0Oc=kyv1x2lh%1Z7#^^@A4Oa`jvOT_5B-Pwcok@z30ze{Zjpx zzt?u}rQr4V>oxb@n~}}bcVB(vl{fY+e(&UuzP#(T*Pr;>&u+Q${xeU%xAg~CzWLJC z7hdgqhj=d=!EK99u0s89sQ>LQyGp44EkllPN>%Y0x-aEJE zjOpd_RD`T1JgfA-{WGcQd?7y&O(k-}(d3?ZBAQDLCZa?6V$sz8hWcOat + + + + Debug + C:\Games\Blacksmith.Master.Early.Access + $(GAME_DIR)/Blacksmith Master_Data/Managed + $(GAME_DIR)/BepInEx + AnyCPU + {EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE} + Library + Properties + BlacksmithMaster + BlacksmithMaster + v4.8 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + $(GAME_BEPINEX)/core/0Harmony.dll + + + $(GAME_BEPINEX)/core/BepInEx.dll + + + $(GAME_MANAGED)/UnityEngine.dll + + + $(GAME_MANAGED)/UnityEngine.CoreModule.dll + + + $(GAME_MANAGED)/Assembly-CSharp.dll + + + $(GAME_BEPINEX)/plugins/ConfigurationManager/ConfigurationManager.dll + + + + + \ No newline at end of file diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/Class1.cs b/Projects/BlacksmithMaster/BlacksmithMaster/Class1.cs new file mode 100644 index 0000000..9d219d9 --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/Class1.cs @@ -0,0 +1,48 @@ +using System; +using System.Linq; +using BepInEx; +using BepInEx.Configuration; +using HarmonyLib; +using HarmonyLib.Tools; + +namespace BlacksmithMaster { + [BepInPlugin(PluginGuid, PluginName, PluginVersion)] + public class Main : BaseUnityPlugin { + private const string PluginGuid = "Cykasmith"; + private const string PluginName = "Cykasmith"; + private const string PluginVersion = "1.0.0"; + + public static ConfigEntry debug; + + public static ConfigEntry xpMultiplier; + + public void Awake() { + debug = Config.Bind("General", "Debug", false); + + xpMultiplier = + Config.Bind("General", "XP Multiplier", 1f, + new ConfigDescription("XP Multiplier", new AcceptableValueRange(0.01f, 1024f))); + + Logger.LogInfo("Cykasmith loaded"); + HarmonyFileLog.Enabled = true; + Harmony harmony = new Harmony(PluginGuid); + harmony.PatchAll(); + var originalMethods = harmony.GetPatchedMethods(); + Logger.LogInfo("Patched " + originalMethods.Count() + " methods"); + } + + public static void LogDebug(string message) { + if (Main.debug.Value) + Console.WriteLine(message); + } + } + + [HarmonyPatch(typeof(StaffBase), "AddXp")] + public class TavernData_AddXp { + public static void Prefix(ref int amount) { + Main.LogDebug("Original XP amount: " + amount); + amount = (int)((float)amount * Main.xpMultiplier.Value); + Main.LogDebug("Modified XP amount: " + amount); + } + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/CykUtil.cs b/Projects/BlacksmithMaster/BlacksmithMaster/CykUtil.cs new file mode 100644 index 0000000..2a6cc7d --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/CykUtil.cs @@ -0,0 +1,28 @@ +using System; + +namespace BlacksmithMaster { + public class CykUtil { + public static bool IsPlayerTank(Module module) { + if (module == null) + return false; + TankBlock block = module.block; + if (block == null) + return false; + Tank tank = block.tank; + if (tank == null) + return false; + return tank.ControllableByLocalPlayer; + } + + public static Func isObjectPlayerTank = obj => { + if (obj == null) + return false; + try { + return IsPlayerTank(obj as Module); + } catch (Exception e) { + Console.WriteLine("Failed to check if object is a player tank: " + e.Message); + return false; + } + }; + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/ModuleBoosterManager.cs b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleBoosterManager.cs new file mode 100644 index 0000000..0de44fe --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleBoosterManager.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using BepInEx.Configuration; +using HarmonyLib; + +namespace BlacksmithMaster { + [HarmonyPatch] + public class ModuleBoosterManager { + private static readonly MultipliedObjectManager FanManager = + new MultipliedObjectManager(ConfigureFanThruster); + private static readonly MultipliedObjectManager JetManager = + new MultipliedObjectManager(ConfigureJetThruster); + + private static ConfigEntry playerOnly; + private static ConfigEntry fanThrustMultiplier; + private static ConfigEntry jetThrustMultiplier; + + public static void Setup(ConfigFile config) { + float min = 0.01f; + float max = 32f; + + playerOnly = config.Bind("Booster", "Player Only", false, new ConfigDescription("Player Only")); + playerOnly.SettingChanged += (sender, args) => DoPatch(); + + fanThrustMultiplier = + config.Bind("Booster", "Fan Thrust Multiplier", 1f, + new ConfigDescription("Fan Thrust Multiplier", new AcceptableValueRange(min, max))); + fanThrustMultiplier.SettingChanged += (sender, args) => DoPatch(); + + jetThrustMultiplier = + config.Bind("Booster", "Jet Thrust Multiplier", 1f, + new ConfigDescription("Jet Thrust Multiplier", new AcceptableValueRange(min, max))); + jetThrustMultiplier.SettingChanged += (sender, args) => DoPatch(); + } + + private static void ConfigureFanThruster(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("m_Force", fanThrustMultiplier, ShouldApply)); + } + + private static void ConfigureJetThruster(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("m_Force", jetThrustMultiplier, ShouldApply)); + } + + private static readonly Func ShouldApply = obj => { + if (!playerOnly.Value) + return true; + return CykUtil.isObjectPlayerTank(obj); + }; + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleBooster), "OnAttached")] + public static void PostfixCreate(ModuleBooster __instance) { + var trav = Traverse.Create(__instance); + var fans = trav.Field("fans").GetValue>(); + var jets = trav.Field("jets").GetValue>(); + + foreach (var fan in fans) FanManager.OnObjectAttached(fan); + foreach (var jet in jets) JetManager.OnObjectAttached(jet); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleBooster), "OnDetaching")] + public static void PostfixDestroy(ModuleBooster __instance) { + var trav = Traverse.Create(__instance); + var fans = trav.Field("fans").GetValue>(); + var jets = trav.Field("jets").GetValue>(); + + foreach (var fan in fans) FanManager.OnObjectDetached(fan); + foreach (var jet in jets) JetManager.OnObjectDetached(jet); + } + + private static void DoPatch() { + FanManager.ApplyAll(); + JetManager.ApplyAll(); + } + + public static readonly Func Register = obj => { + if (Main.debug.Value) + Console.WriteLine("Registering ModuleBooster: {0}", obj); + PostfixCreate(obj as ModuleBooster); + return true; + }; + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/ModuleEnergyManager.cs b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleEnergyManager.cs new file mode 100644 index 0000000..6cba354 --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleEnergyManager.cs @@ -0,0 +1,67 @@ +using System; +using BepInEx.Configuration; +using HarmonyLib; + +namespace BlacksmithMaster { + [HarmonyPatch] + public class ModuleEnergyManager { + private static readonly MultipliedObjectManager Manager = + new MultipliedObjectManager(ConfigureModuleEnergy); + + private static ConfigEntry playerOnly; + private static ConfigEntry outputMultiplier; + private static ConfigEntry powerUpDelayMultiplier; + + public static void Setup(ConfigFile config) { + float min = 0.01f; + float max = 32f; + + playerOnly = config.Bind("Energy", "Player Only", false, new ConfigDescription("Player Only")); + playerOnly.SettingChanged += (sender, args) => DoPatch(); + + outputMultiplier = + config.Bind("Energy", "Output Multiplier", 1f, + new ConfigDescription("Output Multiplier", new AcceptableValueRange(min, max))); + outputMultiplier.SettingChanged += (sender, args) => DoPatch(); + + powerUpDelayMultiplier = config.Bind( + "Energy", "Power Up Delay Multiplier", 1f, + new ConfigDescription("Power Up Delay Multiplier", new AcceptableValueRange(min, max))); + powerUpDelayMultiplier.SettingChanged += (sender, args) => DoPatch(); + } + + private static void ConfigureModuleEnergy(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("m_OutputPerSecond", outputMultiplier, ShouldApply)); + obj.AddField(new FieldConfiguration("m_PowerUpDelay", powerUpDelayMultiplier, ShouldApply)); + } + + private static readonly Func ShouldApply = obj => { + if (!playerOnly.Value) + return true; + return CykUtil.IsPlayerTank(obj as Module); + }; + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleEnergy), "OnAnchorStatusChanged")] + public static void PostfixCreate(ModuleEnergy __instance) { + Manager.OnObjectAttached(__instance); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleEnergy), "OnDetaching")] + public static void PostfixDestroy(ModuleEnergy __instance) { + Manager.OnObjectDetached(__instance); + } + + private static void DoPatch() { + Manager.ApplyAll(); + } + + public static readonly Func Register = obj => { + if (Main.debug.Value) + Console.WriteLine("Registering ModuleEnergy: {0}", obj); + PostfixCreate(obj as ModuleEnergy); + return true; + }; + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/ModuleEnergyStoreManager.cs b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleEnergyStoreManager.cs new file mode 100644 index 0000000..e47862f --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleEnergyStoreManager.cs @@ -0,0 +1,60 @@ +using System; +using BepInEx.Configuration; +using HarmonyLib; + +namespace BlacksmithMaster { + [HarmonyPatch] + public class ModuleEnergyStoreManager { + private static readonly MultipliedObjectManager Manager = + new MultipliedObjectManager(ConfigureModuleEnergyStore); + + private static ConfigEntry playerOnly; + private static ConfigEntry capacityMultiplier; + + public static void Setup(ConfigFile config) { + float min = 0.01f; + float max = 32f; + + playerOnly = config.Bind("Energy", "Player Only", false, new ConfigDescription("Player Only")); + playerOnly.SettingChanged += (sender, args) => DoPatch(); + + capacityMultiplier = + config.Bind("Energy", "Capacity Multiplier", 1f, + new ConfigDescription("Capacity Multiplier", new AcceptableValueRange(min, max))); + capacityMultiplier.SettingChanged += (sender, args) => DoPatch(); + } + + private static void ConfigureModuleEnergyStore(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("m_Capacity", capacityMultiplier, ShouldApply)); + } + + private static readonly Func ShouldApply = obj => { + if (!playerOnly.Value) + return true; + return CykUtil.IsPlayerTank(obj as Module); + }; + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleEnergyStore), "OnAttached")] + public static void PostfixCreate(ModuleEnergyStore __instance) { + Manager.OnObjectAttached(__instance); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleEnergyStore), "OnDetaching")] + public static void PostfixDestroy(ModuleEnergyStore __instance) { + Manager.OnObjectDetached(__instance); + } + + private static void DoPatch() { + Manager.ApplyAll(); + } + + public static readonly Func Register = obj => { + if (Main.debug.Value) + Console.WriteLine("Registering ModuleEnergyStore: {0}", obj); + PostfixCreate(obj as ModuleEnergyStore); + return true; + }; + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/ModuleFuelTankManager.cs b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleFuelTankManager.cs new file mode 100644 index 0000000..64dbaef --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleFuelTankManager.cs @@ -0,0 +1,67 @@ +using System; +using BepInEx.Configuration; +using HarmonyLib; + +namespace BlacksmithMaster { + [HarmonyPatch] + public class ModuleFuelTankManager { + private static readonly MultipliedObjectManager Manager = + new MultipliedObjectManager(ConfigureFuelTank); + + private static ConfigEntry playerOnly; + private static ConfigEntry fuelCapacityMultiplier; + private static ConfigEntry fuelRefillMultiplier; + + public static void Setup(ConfigFile config) { + float min = 0.01f; + float max = 32f; + + playerOnly = config.Bind("FuelTank", "Player Only", false, new ConfigDescription("Player Only")); + playerOnly.SettingChanged += (sender, args) => DoPatch(); + + fuelCapacityMultiplier = config.Bind( + "FuelTank", "Fuel Capacity Multiplier", 1f, + new ConfigDescription("Fuel Capacity Multiplier", new AcceptableValueRange(min, max))); + fuelCapacityMultiplier.SettingChanged += (sender, args) => DoPatch(); + + fuelRefillMultiplier = + config.Bind("FuelTank", "Fuel Refill Multiplier", 1f, + new ConfigDescription("Fuel Refill Multiplier", new AcceptableValueRange(min, max))); + fuelRefillMultiplier.SettingChanged += (sender, args) => DoPatch(); + } + + private static void ConfigureFuelTank(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("m_Capacity", fuelCapacityMultiplier, ShouldApply)); + obj.AddField(new FieldConfiguration("m_RefillRate", fuelRefillMultiplier, ShouldApply)); + } + + private static readonly Func ShouldApply = obj => { + if (!playerOnly.Value) + return true; + return CykUtil.isObjectPlayerTank(obj); + }; + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleFuelTank), "OnAttached")] + public static void PostfixCreate(ModuleFuelTank __instance) { + Manager.OnObjectAttached(__instance); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleFuelTank), "OnDetaching")] + public static void PostfixDestroy(ModuleFuelTank __instance) { + Manager.OnObjectDetached(__instance); + } + + private static void DoPatch() { + Manager.ApplyAll(); + } + + public static readonly Func Register = obj => { + if (Main.debug.Value) + Console.WriteLine("Registering ModuleFuelTank: {0}", obj); + PostfixCreate(obj as ModuleFuelTank); + return true; + }; + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/ModuleGyroManager.cs b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleGyroManager.cs new file mode 100644 index 0000000..4622c7c --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleGyroManager.cs @@ -0,0 +1,60 @@ +using System; +using BepInEx.Configuration; +using HarmonyLib; + +namespace BlacksmithMaster { + [HarmonyPatch] + public class ModuleGyroManager { + private static readonly MultipliedObjectManager Manager = + new MultipliedObjectManager(ConfigureModuleGyro); + + private static ConfigEntry playerOnly; + private static ConfigEntry activeSpeedMultiplier; + + public static void Setup(ConfigFile config) { + float min = 0.01f; + float max = 32f; + + playerOnly = config.Bind("Gyro", "Player Only", false, new ConfigDescription("Player Only")); + playerOnly.SettingChanged += (sender, args) => DoPatch(); + + activeSpeedMultiplier = config.Bind( + "Gyro", "Active Speed Multiplier", 1f, + new ConfigDescription("Active Speed Multiplier", new AcceptableValueRange(min, max))); + activeSpeedMultiplier.SettingChanged += (sender, args) => DoPatch(); + } + + private static void ConfigureModuleGyro(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("m_ActiveSpeed", activeSpeedMultiplier, ShouldApply)); + } + + private static readonly Func ShouldApply = obj => { + if (!playerOnly.Value) + return true; + return CykUtil.IsPlayerTank(obj as Module); + }; + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleGyro), "OnAttached")] + public static void PostfixCreate(ModuleGyro __instance) { + Manager.OnObjectAttached(__instance); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleGyro), "OnDetaching")] + public static void PostfixDestroy(ModuleGyro __instance) { + Manager.OnObjectDetached(__instance); + } + + private static void DoPatch() { + Manager.ApplyAll(); + } + + public static readonly Func Register = obj => { + if (Main.debug.Value) + Console.WriteLine("Registering ModuleGyro: {0}", obj); + PostfixCreate(obj as ModuleGyro); + return true; + }; + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/ModuleHeartManager.cs b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleHeartManager.cs new file mode 100644 index 0000000..28ad2d1 --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleHeartManager.cs @@ -0,0 +1,76 @@ +using System; +using BepInEx.Configuration; +using HarmonyLib; + +namespace BlacksmithMaster { + [HarmonyPatch] + public class ModuleHeartManager { + private static readonly MultipliedObjectManager Manager = + new MultipliedObjectManager(ConfigureHeart); + + private static ConfigEntry playerOnly; + private static ConfigEntry eventHorizonRadiusMultiplier; + private static ConfigEntry setupTimeMultiplier; + private static ConfigEntry startShrinkingRadiusMultiplier; + + public static void Setup(ConfigFile config) { + float min = 0.01f; + float max = 32f; + + playerOnly = config.Bind("Heart", "Player Only", false, new ConfigDescription("Player Only")); + playerOnly.SettingChanged += (sender, args) => DoPatch(); + + eventHorizonRadiusMultiplier = config.Bind( + "Heart", "Event Horizon Radius Multiplier", 1f, + new ConfigDescription("Event Horizon Radius Multiplier", new AcceptableValueRange(min, max))); + eventHorizonRadiusMultiplier.SettingChanged += (sender, args) => DoPatch(); + + setupTimeMultiplier = + config.Bind("Heart", "Setup Time Multiplier", 1f, + new ConfigDescription("Setup Time Multiplier", new AcceptableValueRange(min, max))); + setupTimeMultiplier.SettingChanged += (sender, args) => DoPatch(); + + startShrinkingRadiusMultiplier = config.Bind( + "Heart", "Start Shrinking Radius Multiplier", 1f, + new ConfigDescription("Start Shrinking Radius Multiplier", new AcceptableValueRange(min, max))); + startShrinkingRadiusMultiplier.SettingChanged += (sender, args) => DoPatch(); + } + + private static void ConfigureHeart(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("m_EventHorizonRadius", eventHorizonRadiusMultiplier, + ShouldApply)); + obj.AddField(new FieldConfiguration("m_SetupTime", setupTimeMultiplier, ShouldApply)); + obj.AddField(new FieldConfiguration("m_StartShrinkingRadius", startShrinkingRadiusMultiplier, + ShouldApply)); + } + + private static readonly Func ShouldApply = obj => { + if (!playerOnly.Value) + return true; + return CykUtil.isObjectPlayerTank(obj); + }; + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleHeart), "OnAttached")] + public static void PostfixCreate(ModuleHeart __instance) { + Manager.OnObjectAttached(__instance); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleHeart), "OnDetaching")] + public static void PostfixDestroy(ModuleHeart __instance) { + Manager.OnObjectDetached(__instance); + } + + private static void DoPatch() { + Manager.ApplyAll(); + } + + public static readonly Func Register = obj => { + if (Main.debug.Value) + Console.WriteLine("Registering ModuleHeart: {0}", obj); + PostfixCreate(obj as ModuleHeart); + return true; + }; + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/ModuleItemHolderManager.cs b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleItemHolderManager.cs new file mode 100644 index 0000000..d9fbc51 --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleItemHolderManager.cs @@ -0,0 +1,164 @@ +using System; +using BepInEx.Configuration; +using HarmonyLib; + +namespace BlacksmithMaster { + [HarmonyPatch] + public class ModuleItemHolderManager { + private static readonly MultipliedObjectManager BeamManager = + new MultipliedObjectManager(ConfigureBeam); + private static readonly MultipliedObjectManager BeamHolderManager = + new MultipliedObjectManager(ConfigureBeamHolder); + private static readonly MultipliedObjectManager BeamPickupManager = + new MultipliedObjectManager(ConfigureBeamPickup); + + private static readonly MultipliedObjectManager MagnetHolderManager = + new MultipliedObjectManager(ConfigureMagnetHolder); + private static readonly MultipliedObjectManager MagnetPickupManager = + new MultipliedObjectManager(ConfigureMagnetPickup); + + private static ConfigEntry playerOnly; + private static ConfigEntry capacityPerStackMultiplier; + private static ConfigEntry beamStrengthMultiplier; + private static ConfigEntry beamHeightIncrementScaleMultiplier; + private static ConfigEntry beamPickupRangeMultiplier; + private static ConfigEntry magnetStrengthMultiplier; + private static ConfigEntry magnetPickupRangeMultiplier; + + public static void Setup(ConfigFile config) { + float min = 0.01f; + float max = 32f; + + playerOnly = config.Bind("Item Holder", "Player Only", false, new ConfigDescription("Player Only")); + playerOnly.SettingChanged += (sender, args) => DoPatch(); + + capacityPerStackMultiplier = config.Bind( + "Item Holder", "Capacity Per Stack Multiplier", 1f, + new ConfigDescription("Capacity Per Stack Multiplier", new AcceptableValueRange(min, max))); + capacityPerStackMultiplier.SettingChanged += (sender, args) => DoPatch(); + + beamStrengthMultiplier = config.Bind( + "Item Holder", "Beam Strength Multiplier", 1f, + new ConfigDescription("Beam Strength Multiplier", new AcceptableValueRange(min, max))); + beamStrengthMultiplier.SettingChanged += (sender, args) => DoPatch(); + + beamHeightIncrementScaleMultiplier = + config.Bind("Item Holder", "Beam Height Increment Scale Multiplier", 1f, + new ConfigDescription("Beam Height Increment Scale Multiplier", + new AcceptableValueRange(min, max))); + beamHeightIncrementScaleMultiplier.SettingChanged += (sender, args) => DoPatch(); + + beamPickupRangeMultiplier = config.Bind( + "Item Holder", "Beam Pickup Range Multiplier", 1f, + new ConfigDescription("Beam Pickup Range Multiplier", new AcceptableValueRange(min, max))); + beamPickupRangeMultiplier.SettingChanged += (sender, args) => DoPatch(); + + magnetStrengthMultiplier = config.Bind( + "Item Holder", "Magnet Strength Multiplier", 1f, + new ConfigDescription("Magnet Strength Multiplier", new AcceptableValueRange(min, max))); + magnetStrengthMultiplier.SettingChanged += (sender, args) => DoPatch(); + + magnetPickupRangeMultiplier = config.Bind( + "Item Holder", "Magnet Pickup Range Multiplier", 1f, + new ConfigDescription("Magnet Pickup Range Multiplier", new AcceptableValueRange(min, max))); + magnetPickupRangeMultiplier.SettingChanged += (sender, args) => DoPatch(); + } + + private static void ConfigureBeam(MultipliedObject obj) { + obj.AddField( + new FieldConfiguration("m_CapacityPerStack", capacityPerStackMultiplier, ShouldApply)); + } + + private static void ConfigureBeamHolder(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("m_BeamStrength", beamStrengthMultiplier, ShouldApply)); + obj.AddField(new FieldConfiguration("m_HeightIncrementScale", + beamHeightIncrementScaleMultiplier, ShouldApply)); + } + + private static void ConfigureBeamPickup(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("m_PickupRange", beamPickupRangeMultiplier, ShouldApply)); + } + + private static void ConfigureMagnetHolder(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("m_Strength", magnetStrengthMultiplier, ShouldApply)); + } + + private static void ConfigureMagnetPickup(MultipliedObject obj) { + obj.AddField( + new FieldConfiguration("m_PickupRange", magnetPickupRangeMultiplier, ShouldApply)); + } + + private static readonly Func ShouldApply = obj => { + if (!playerOnly.Value) + return true; + return CykUtil.IsPlayerTank(obj as Module); + }; + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemHolder), "OnAttached")] + public static void PostfixCreate(ModuleItemHolder __instance) { + BeamManager.OnObjectAttached(__instance); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemHolder), "OnDetaching")] + public static void PostfixDestroy(ModuleItemHolder __instance) { + BeamManager.OnObjectDetached(__instance); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemHolderBeam), "OnAttached")] + public static void PostfixCreate(ModuleItemHolderBeam __instance) { + var trav = Traverse.Create(__instance); + var pickup = trav.Field("m_Pickup").GetValue(); + + BeamHolderManager.OnObjectAttached(__instance); + BeamPickupManager.OnObjectAttached(pickup); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemHolderBeam), "OnDetaching")] + public static void PostfixDestroy(ModuleItemHolderBeam __instance) { + var trav = Traverse.Create(__instance); + var pickup = trav.Field("m_Pickup").GetValue(); + + BeamHolderManager.OnObjectDetached(__instance); + BeamPickupManager.OnObjectDetached(pickup); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemHolderMagnet), "OnAttached")] + public static void PostfixCreate(ModuleItemHolderMagnet __instance) { + var trav = Traverse.Create(__instance); + var pickup = trav.Field("m_Pickup").GetValue(); + + MagnetHolderManager.OnObjectAttached(__instance); + MagnetPickupManager.OnObjectAttached(pickup); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemHolderMagnet), "OnDetaching")] + public static void PostfixDestroy(ModuleItemHolderMagnet __instance) { + var trav = Traverse.Create(__instance); + var pickup = trav.Field("m_Pickup").GetValue(); + + MagnetHolderManager.OnObjectDetached(__instance); + MagnetPickupManager.OnObjectDetached(pickup); + } + + private static void DoPatch() { + BeamManager.ApplyAll(); + BeamHolderManager.ApplyAll(); + BeamPickupManager.ApplyAll(); + MagnetHolderManager.ApplyAll(); + MagnetPickupManager.ApplyAll(); + } + + public static readonly Func Register = obj => { + if (Main.debug.Value) + Console.WriteLine("Registering ModuleItemHolder: {0}", obj); + PostfixCreate(obj as ModuleItemHolder); + return true; + }; + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/ModuleItemProducerManager.cs b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleItemProducerManager.cs new file mode 100644 index 0000000..b6322a8 --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleItemProducerManager.cs @@ -0,0 +1,77 @@ +using System; +using BepInEx.Configuration; +using HarmonyLib; + +namespace BlacksmithMaster { + [HarmonyPatch] + public class ModuleItemProducerManager { + private static readonly MultipliedObjectManager Manager = + new MultipliedObjectManager(ConfigureModuleItemProducer); + + private static ConfigEntry playerOnly; + private static ConfigEntry resourceGroundRadiusMultiplier; + private static ConfigEntry minDispenseIntervalMultiplier; + private static ConfigEntry secPerItemProducedMultiplier; + + public static void Setup(ConfigFile config) { + float min = 0.01f; + float max = 32f; + + playerOnly = config.Bind("Item Producer", "Player Only", false, new ConfigDescription("Player Only")); + playerOnly.SettingChanged += (sender, args) => DoPatch(); + + resourceGroundRadiusMultiplier = config.Bind( + "Item Producer", "Resource Ground Radius Multiplier", 1f, + new ConfigDescription("Resource Ground Radius Multiplier", new AcceptableValueRange(min, max))); + resourceGroundRadiusMultiplier.SettingChanged += (sender, args) => DoPatch(); + + minDispenseIntervalMultiplier = config.Bind( + "Item Producer", "Min Dispense Interval Multiplier", 1f, + new ConfigDescription("Min Dispense Interval Multiplier", new AcceptableValueRange(min, max))); + minDispenseIntervalMultiplier.SettingChanged += (sender, args) => DoPatch(); + + secPerItemProducedMultiplier = config.Bind( + "Item Producer", "Sec Per Item Produced Multiplier", 1f, + new ConfigDescription("Sec Per Item Produced Multiplier", new AcceptableValueRange(min, max))); + secPerItemProducedMultiplier.SettingChanged += (sender, args) => DoPatch(); + } + + private static void ConfigureModuleItemProducer(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("m_ResourceGroundRadius", resourceGroundRadiusMultiplier, + ShouldApply)); + obj.AddField(new FieldConfiguration("m_MinDispenseInterval", minDispenseIntervalMultiplier, + ShouldApply)); + obj.AddField(new FieldConfiguration("m_SecPerItemProduced", secPerItemProducedMultiplier, + ShouldApply)); + } + + private static readonly Func ShouldApply = obj => { + if (!playerOnly.Value) + return true; + return CykUtil.IsPlayerTank(obj as Module); + }; + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemProducer), "GetClosestResourceReservoirInRange")] + public static void PostfixCreate(ModuleItemProducer __instance) { + Manager.OnObjectAttached(__instance); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleItemProducer), "OnDetaching")] + public static void PostfixDestroy(ModuleItemProducer __instance) { + Manager.OnObjectDetached(__instance); + } + + private static void DoPatch() { + Manager.ApplyAll(); + } + + public static readonly Func Register = obj => { + if (Main.debug.Value) + Console.WriteLine("Registering ModuleItemProducer: {0}", obj); + PostfixCreate(obj as ModuleItemProducer); + return true; + }; + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/ModuleRemoteChargerManager.cs b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleRemoteChargerManager.cs new file mode 100644 index 0000000..e4725cd --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleRemoteChargerManager.cs @@ -0,0 +1,77 @@ +using System; +using BepInEx.Configuration; +using HarmonyLib; + +namespace BlacksmithMaster { + [HarmonyPatch] + public class ModuleRemoteChargerManager { + private static readonly MultipliedObjectManager Manager = + new MultipliedObjectManager(ConfigureModuleRemoteCharger); + + private static ConfigEntry playerOnly; + private static ConfigEntry arcFiringIntervalMultiplier; + private static ConfigEntry chargingRadiusMultiplier; + private static ConfigEntry powerTransferPerArcMultiplier; + + public static void Setup(ConfigFile config) { + const float min = 0.01f; + const float max = 32f; + + playerOnly = config.Bind("Remote Charger", "Player Only", false, new ConfigDescription("Player Only")); + playerOnly.SettingChanged += (sender, args) => DoPatch(); + + arcFiringIntervalMultiplier = config.Bind( + "Remote Charger", "Arc Firing Interval Multiplier", 1f, + new ConfigDescription("Arc Firing Interval Multiplier", new AcceptableValueRange(min, max))); + arcFiringIntervalMultiplier.SettingChanged += (sender, args) => DoPatch(); + + chargingRadiusMultiplier = config.Bind( + "Remote Charger", "Charging Radius Multiplier", 1f, + new ConfigDescription("Charging Radius Multiplier", new AcceptableValueRange(min, max))); + chargingRadiusMultiplier.SettingChanged += (sender, args) => DoPatch(); + + powerTransferPerArcMultiplier = config.Bind( + "Remote Charger", "Power Transfer Per Arc Multiplier", 1f, + new ConfigDescription("Power Transfer Per Arc Multiplier", new AcceptableValueRange(min, max))); + powerTransferPerArcMultiplier.SettingChanged += (sender, args) => DoPatch(); + } + + private static void ConfigureModuleRemoteCharger(MultipliedObject obj) { + obj.AddField( + new FieldConfiguration("m_ArcFiringInterval", arcFiringIntervalMultiplier, ShouldApply)); + obj.AddField( + new FieldConfiguration("m_ChargingRadius", chargingRadiusMultiplier, ShouldApply)); + obj.AddField(new FieldConfiguration("m_PowerTransferPerArc", powerTransferPerArcMultiplier, + ShouldApply)); + } + + private static readonly Func ShouldApply = obj => { + if (!playerOnly.Value) + return true; + return CykUtil.IsPlayerTank(obj as Module); + }; + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleRemoteCharger), "OnAttached")] + public static void PostfixCreate(ModuleRemoteCharger __instance) { + Manager.OnObjectAttached(__instance); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleRemoteCharger), "OnDetaching")] + public static void PostfixDestroy(ModuleRemoteCharger __instance) { + Manager.OnObjectDetached(__instance); + } + + private static void DoPatch() { + Manager.ApplyAll(); + } + + public static readonly Func Register = obj => { + if (Main.debug.Value) + Console.WriteLine("Registering ModuleRemoteCharger: {0}", obj); + PostfixCreate(obj as ModuleRemoteCharger); + return true; + }; + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/ModuleShieldGeneratorManager.cs b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleShieldGeneratorManager.cs new file mode 100644 index 0000000..8924a87 --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleShieldGeneratorManager.cs @@ -0,0 +1,88 @@ +using System; +using BepInEx.Configuration; +using HarmonyLib; + +namespace BlacksmithMaster { + [HarmonyPatch] + public class ModuleShieldGeneratorManager { + private static readonly MultipliedObjectManager Manager = + new MultipliedObjectManager(ConfigureShieldGenerator); + + private static ConfigEntry playerOnly; + private static ConfigEntry radiusMultiplier; + private static ConfigEntry radiusMultiplierHealing; + private static ConfigEntry heartbeatIntervalMultiplier; + private static ConfigEntry powerUpDelayMultiplier; + + public static void Setup(ConfigFile config) { + const float min = 0.01f; + const float max = 32f; + + playerOnly = config.Bind("Shield", "Player Only", false, new ConfigDescription("Player Only")); + playerOnly.SettingChanged += (sender, args) => DoPatch(); + + radiusMultiplier = + config.Bind("Shield", "Radius Multiplier", 1f, + new ConfigDescription("Radius Multiplier", new AcceptableValueRange(min, max))); + radiusMultiplier.SettingChanged += (sender, args) => DoPatch(); + + heartbeatIntervalMultiplier = config.Bind( + "Shield", "Heartbeat Interval Multiplier", 1f, + new ConfigDescription("Heartbeat Interval Multiplier", new AcceptableValueRange(min, max))); + heartbeatIntervalMultiplier.SettingChanged += (sender, args) => DoPatch(); + + powerUpDelayMultiplier = config.Bind( + "Shield", "Power Up Delay Multiplier", 1f, + new ConfigDescription("Power Up Delay Multiplier", new AcceptableValueRange(min, max))); + powerUpDelayMultiplier.SettingChanged += (sender, args) => DoPatch(); + + radiusMultiplierHealing = config.Bind( + "Shield", "Radius Multiplier Healing", 1f, + new ConfigDescription("Radius Multiplier Healing", new AcceptableValueRange(min, max))); + radiusMultiplierHealing.SettingChanged += (sender, args) => DoPatch(); + } + + private static void ConfigureShieldGenerator(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("m_HealingHeartbeatInterval", heartbeatIntervalMultiplier, + ShouldApply)); + + obj.AddField(new FieldConfiguration("m_Radius", radiusMultiplier, __instance => { + if (!ShouldApply(__instance)) + return radiusMultiplier; + var shield = (ModuleShieldGenerator)__instance; + return shield.m_Healing ? radiusMultiplierHealing : radiusMultiplier; + })); + + obj.AddField(new FieldConfiguration("m_PowerUpDelay", powerUpDelayMultiplier, ShouldApply)); + } + + private static readonly Func ShouldApply = obj => { + if (!playerOnly.Value) + return true; + return CykUtil.IsPlayerTank(obj as Module); + }; + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleShieldGenerator), "OnAttached")] + public static void PostfixCreate(ModuleShieldGenerator __instance) { + Manager.OnObjectAttached(__instance); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleShieldGenerator), "OnDetaching")] + public static void PostfixDestroy(ModuleShieldGenerator __instance) { + Manager.OnObjectDetached(__instance); + } + + private static void DoPatch() { + Manager.ApplyAll(); + } + + public static readonly Func Register = obj => { + if (Main.debug.Value) + Console.WriteLine("Registering ModuleShieldGenerator: {0}", obj); + PostfixCreate(obj as ModuleShieldGenerator); + return true; + }; + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/ModuleWeaponGunManager.cs b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleWeaponGunManager.cs new file mode 100644 index 0000000..65cea2c --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleWeaponGunManager.cs @@ -0,0 +1,121 @@ +using System; +using BepInEx.Configuration; +using HarmonyLib; + +namespace BlacksmithMaster { + [HarmonyPatch] + public class ModuleWeaponGunManager { + private static readonly MultipliedObjectManager Manager = + new MultipliedObjectManager(ConfigureManager); + private static readonly MultipliedObjectManager FireDataManager = + new MultipliedObjectManager(ConfigureFireData); + + private static ConfigEntry playerOnly; + private static ConfigEntry kickbackStrengthMultiplier; + private static ConfigEntry muzzleVelocityMultiplier; + private static ConfigEntry burstCooldownMultiplier; + private static ConfigEntry burstShotCountMultiplier; + private static ConfigEntry shotCooldownMultiplier; + private static ConfigEntry seekingRoundsAll; + private static ConfigEntry resetBurstOnInterruptAll; + + public static void Setup(ConfigFile config) { + const float min = 0.01f; + const float max = 32f; + + playerOnly = config.Bind("WeaponGun", "Player Only", false, new ConfigDescription("Player Only")); + playerOnly.SettingChanged += (sender, args) => DoPatch(); + + kickbackStrengthMultiplier = config.Bind( + "FireData", "Kickback Strength Multiplier", 1f, + new ConfigDescription("Kickback Strength Multiplier", new AcceptableValueRange(min, max))); + kickbackStrengthMultiplier.SettingChanged += (sender, args) => DoPatch(); + + muzzleVelocityMultiplier = config.Bind( + "FireData", "Muzzle Velocity Multiplier", 1f, + new ConfigDescription("Muzzle Velocity Multiplier", new AcceptableValueRange(min, max))); + muzzleVelocityMultiplier.SettingChanged += (sender, args) => DoPatch(); + + burstCooldownMultiplier = config.Bind( + "FireData", "Burst Cooldown Multiplier", 1f, + new ConfigDescription("Burst Cooldown Multiplier", new AcceptableValueRange(min, max))); + burstCooldownMultiplier.SettingChanged += (sender, args) => DoPatch(); + + burstShotCountMultiplier = config.Bind( + "FireData", "Burst Shot Count Multiplier", 1f, + new ConfigDescription("Burst Shot Count Multiplier", new AcceptableValueRange(min, max))); + burstShotCountMultiplier.SettingChanged += (sender, args) => DoPatch(); + + shotCooldownMultiplier = config.Bind( + "FireData", "Shot Cooldown Multiplier", 1f, + new ConfigDescription("Shot Cooldown Multiplier", new AcceptableValueRange(min, max))); + shotCooldownMultiplier.SettingChanged += (sender, args) => DoPatch(); + + seekingRoundsAll = + config.Bind("FireData", "Seeking Rounds All", false, + new ConfigDescription("Seeking Rounds All", new AcceptableValueRange(false, true))); + seekingRoundsAll.SettingChanged += (sender, args) => DoPatch(); + + resetBurstOnInterruptAll = config.Bind( + "FireData", "Reset Burst On Interrupt All", false, + new ConfigDescription("Reset Burst On Interrupt All", new AcceptableValueRange(false, true))); + resetBurstOnInterruptAll.SettingChanged += (sender, args) => DoPatch(); + } + + private static void ConfigureManager(MultipliedObject obj) { + obj.AddBooleanField(new BooleanFieldConfiguration("m_SeekingRounds", seekingRoundsAll, ShouldApply)); + obj.AddBooleanField( + new BooleanFieldConfiguration("m_ResetBurstOnInterrupt", resetBurstOnInterruptAll, ShouldApply)); + obj.AddField(new FieldConfiguration("m_BurstCooldown", burstCooldownMultiplier, ShouldApply)); + obj.AddField(new FieldConfiguration("m_BurstShotCount", burstShotCountMultiplier, ShouldApply)); + obj.AddField(new FieldConfiguration("m_ShotCooldown", shotCooldownMultiplier, ShouldApply)); + } + + private static void ConfigureFireData(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("m_MuzzleVelocity", muzzleVelocityMultiplier)); + obj.AddField(new FieldConfiguration("m_KickbackStrength", kickbackStrengthMultiplier)); + } + + private static readonly Func ShouldApply = obj => { + if (!playerOnly.Value) + return true; + return CykUtil.IsPlayerTank(obj as Module); + }; + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWeaponGun), "OnAttached")] + public static void PostfixCreate(ModuleWeaponGun __instance) { + Manager.OnObjectAttached(__instance); + if (playerOnly.Value && !CykUtil.IsPlayerTank(__instance)) + return; + + var trav = Traverse.Create(__instance); + var firingData = trav.Field("m_FiringData"); + FireDataManager.OnObjectAttached(firingData.GetValue()); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWeaponGun), "OnDetaching")] + public static void PostfixDestroy(ModuleWeaponGun __instance) { + Manager.OnObjectAttached(__instance); + var trav = Traverse.Create(__instance); + if (playerOnly.Value && !CykUtil.IsPlayerTank(__instance)) + return; + + var firingData = trav.Field("m_FiringData"); + FireDataManager.OnObjectDetached(firingData.GetValue()); + } + + private static void DoPatch() { + FireDataManager.ApplyAll(); + Manager.ApplyAll(); + } + + public static readonly Func Register = obj => { + if (Main.debug.Value) + Console.WriteLine("Registering ModuleWeaponGun: {0}", obj); + PostfixCreate(obj as ModuleWeaponGun); + return true; + }; + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/ModuleWeaponManager.cs b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleWeaponManager.cs new file mode 100644 index 0000000..6a1a7c8 --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleWeaponManager.cs @@ -0,0 +1,60 @@ +using System; +using BepInEx.Configuration; +using HarmonyLib; + +namespace BlacksmithMaster { + [HarmonyPatch] + public class ModuleWeaponManager { + private static readonly MultipliedObjectManager Manager = + new MultipliedObjectManager(ConfigureManager); + + private static ConfigEntry playerOnly; + private static ConfigEntry rotateSpeedMultiplier; + + public static void Setup(ConfigFile config) { + const float min = 0.01f; + const float max = 32f; + + playerOnly = config.Bind("ModuleWeapon", "Player Only", false, new ConfigDescription("Player Only")); + playerOnly.SettingChanged += (sender, args) => DoPatch(); + + rotateSpeedMultiplier = config.Bind( + "ModuleWeapon", "Rotate Speed Multiplier", 1f, + new ConfigDescription("Rotate Speed Multiplier", new AcceptableValueRange(min, max))); + rotateSpeedMultiplier.SettingChanged += (sender, args) => DoPatch(); + } + + private static void ConfigureManager(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("m_RotateSpeed", rotateSpeedMultiplier, ShouldApply)); + } + + private static readonly Func ShouldApply = obj => { + if (!playerOnly.Value) + return true; + return CykUtil.IsPlayerTank(obj as Module); + }; + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWeapon), "OnAttached")] + public static void PostfixCreate(ModuleWeapon __instance) { + Manager.OnObjectAttached(__instance); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWeapon), "OnDetaching")] + public static void PostfixDestroy(ModuleWeapon __instance) { + Manager.OnObjectDetached(__instance); + } + + private static void DoPatch() { + Manager.ApplyAll(); + } + + public static readonly Func Register = obj => { + if (Main.debug.Value) + Console.WriteLine("Registering ModuleWeapon: {0}", obj); + PostfixCreate(obj as ModuleWeapon); + return true; + }; + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/ModuleWheelsManager.cs b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleWheelsManager.cs new file mode 100644 index 0000000..a32b42b --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleWheelsManager.cs @@ -0,0 +1,71 @@ +using System; +using BepInEx.Configuration; +using HarmonyLib; + +namespace BlacksmithMaster { + [HarmonyPatch] + public class ModuleWheelsManager { + private static readonly MultipliedObjectManager TorqueParamsManager = + new MultipliedObjectManager(ConfigureTorqueParams); + + private static ConfigEntry playerOnly; + private static ConfigEntry torqueRpmMultiplier; + private static ConfigEntry torqueMultiplier; + + public static void Setup(ConfigFile config) { + const float min = 0.01f; + const float max = 32f; + + playerOnly = config.Bind("TorqueParams", "Player Only", false, new ConfigDescription("Player Only")); + playerOnly.SettingChanged += (sender, args) => DoPatch(); + + torqueRpmMultiplier = + config.Bind("TorqueParams", "Torque RPM Multiplier", 1f, + new ConfigDescription("Torque RPM Multiplier", new AcceptableValueRange(min, max))); + torqueRpmMultiplier.SettingChanged += (sender, args) => DoPatch(); + + torqueMultiplier = + config.Bind("TorqueParams", "Torque Multiplier", 1f, + new ConfigDescription("Torque Multiplier", new AcceptableValueRange(min, max))); + torqueMultiplier.SettingChanged += (sender, args) => DoPatch(); + } + + private static void ConfigureTorqueParams(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("torqueCurveMaxRpm", torqueRpmMultiplier, ShouldApply)); + obj.AddField(new FieldConfiguration("torqueCurveMaxTorque", torqueMultiplier, ShouldApply)); + } + + private static readonly Func ShouldApply = obj => { + if (!playerOnly.Value) + return true; + return CykUtil.IsPlayerTank(obj as Module); + }; + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWheels), "OnAttached")] + public static void PostfixCreate(ModuleWheels __instance) { + var trav = Traverse.Create(__instance); + var torqueParams = trav.Field("torqueParams"); + TorqueParamsManager.OnObjectAttached(torqueParams.GetValue()); + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWheels), "OnDetaching")] + public static void PostfixDestroy(ModuleWheels __instance) { + var trav = Traverse.Create(__instance); + var torqueParams = trav.Field("torqueParams"); + TorqueParamsManager.OnObjectDetached(torqueParams.GetValue()); + } + + private static void DoPatch() { + TorqueParamsManager.ApplyAll(); + } + + public static readonly Func Register = obj => { + if (Main.debug.Value) + Console.WriteLine("Registering ModuleWheels: {0}", obj); + PostfixCreate(obj as ModuleWheels); + return true; + }; + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/ModuleWingManager.cs b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleWingManager.cs new file mode 100644 index 0000000..d35c4dd --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/ModuleWingManager.cs @@ -0,0 +1,83 @@ +using System; +using BepInEx.Configuration; +using HarmonyLib; + +namespace BlacksmithMaster { + [HarmonyPatch] + public class ModuleWingManager { + private static readonly MultipliedObjectManager Manager = + new MultipliedObjectManager(ConfigureAerofoil); + + private static ConfigEntry playerOnly; + private static ConfigEntry angleRangeMultiplier; + private static ConfigEntry turnSpeedMultiplier; + private static ConfigEntry liftStrengthMultiplier; + + public static void Setup(ConfigFile config) { + const float min = 0.01f; + const float max = 32f; + + playerOnly = config.Bind("Aerofoil", "Player Only", false, new ConfigDescription("Player Only")); + playerOnly.SettingChanged += (sender, args) => DoPatch(); + + angleRangeMultiplier = + config.Bind("Aerofoil", "Angle Range Multiplier", 1f, + new ConfigDescription("Angle Range Multiplier", new AcceptableValueRange(min, max))); + angleRangeMultiplier.SettingChanged += (sender, args) => DoPatch(); + + turnSpeedMultiplier = + config.Bind("Aerofoil", "Turn Speed Multiplier", 1f, + new ConfigDescription("Turn Speed Multiplier", new AcceptableValueRange(min, max))); + turnSpeedMultiplier.SettingChanged += (sender, args) => DoPatch(); + + liftStrengthMultiplier = config.Bind( + "Aerofoil", "Lift Strength Multiplier", 1f, + new ConfigDescription("Lift Strength Multiplier", new AcceptableValueRange(min, max))); + liftStrengthMultiplier.SettingChanged += (sender, args) => DoPatch(); + } + + private static void ConfigureAerofoil(MultipliedObject obj) { + obj.AddField(new FieldConfiguration("flapAngleRangeActual", angleRangeMultiplier)); + obj.AddField(new FieldConfiguration("flapAngleRangeVisual", angleRangeMultiplier)); + + obj.AddField(new FieldConfiguration("flapTurnSpeed", turnSpeedMultiplier)); + obj.AddField(new FieldConfiguration("liftStrength", liftStrengthMultiplier)); + } + + private static readonly Func ShouldApply = obj => { + if (!playerOnly.Value) + return true; + return CykUtil.IsPlayerTank(obj as Module); + }; + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWing), "OnAttached")] + public static void PostfixCreate(ModuleWing __instance) { + if (playerOnly.Value && !CykUtil.IsPlayerTank(__instance)) + return; + for (int i = 0; i < __instance.m_Aerofoils.Length; i++) { + var aerofoil = __instance.m_Aerofoils[i]; + Manager.OnObjectAttached(aerofoil); + } + } + + [HarmonyPrefix] + [HarmonyPatch(typeof(ModuleWing), "OnDetaching")] + public static void PostfixDestroy(ModuleWing __instance) { + if (playerOnly.Value && !CykUtil.IsPlayerTank(__instance)) + return; + foreach (var aerofoil in __instance.m_Aerofoils) Manager.OnObjectDetached(aerofoil); + } + + private static void DoPatch() { + Manager.ApplyAll(); + } + + public static readonly Func Register = obj => { + if (Main.debug.Value) + Console.WriteLine("Registering ModuleWing: {0}", obj); + PostfixCreate(obj as ModuleWing); + return true; + }; + } +} diff --git a/Projects/BlacksmithMaster/BlacksmithMaster/MultiBuy.cs b/Projects/BlacksmithMaster/BlacksmithMaster/MultiBuy.cs new file mode 100644 index 0000000..b275fbb --- /dev/null +++ b/Projects/BlacksmithMaster/BlacksmithMaster/MultiBuy.cs @@ -0,0 +1,71 @@ +using System; +using System.Reflection; +using HarmonyLib; +using UnityEngine; +using UnityEngine.EventSystems; +using UnityEngine.UI; + +namespace BlacksmithMaster { + [HarmonyPatch] + public class MultiBuy { + public static UIShopBlockSelect panel; + public static Traverse panelTraverse; + + [HarmonyPostfix] + [HarmonyPatch(typeof(UIShopBlockSelect), "OnSpawn")] + public static void PostfixCreate(UIShopBlockSelect __instance) { + panel = __instance; + if (Main.debugBuyAll.Value) + Console.WriteLine("UISnapshotPanel.OnPool: {0}", __instance); + panelTraverse = Traverse.Create(__instance); + var placeButton = panelTraverse.Field("m_PurchaseBlockButton").GetValue