Add regiments mods

This commit is contained in:
2024-04-17 13:24:26 +02:00
parent 229eb2d26a
commit 26a4e88101
19 changed files with 730 additions and 26 deletions

View File

@@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Regiments", "Regiments\Regiments.csproj", "{DA9D274E-486F-4F82-84FF-CD9388CB0B09}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DA9D274E-486F-4F82-84FF-CD9388CB0B09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA9D274E-486F-4F82-84FF-CD9388CB0B09}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA9D274E-486F-4F82-84FF-CD9388CB0B09}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA9D274E-486F-4F82-84FF-CD9388CB0B09}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,14 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CRegiments_005CRegiments_005Clibs_005C0Harmony_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CRegiments_005CRegiments_005Clibs_005CAssembly_002DCSharp_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CRegiments_005CRegiments_005Clibs_005CBepInEx_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CRegiments_005CRegiments_005Clibs_005CMainAssembly_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CRegiments_005CRegiments_005Clibs_005CUnityEngine_002ECoreModule_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CRegiments_005CRegiments_005Clibs_005CUnityEngine_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CJetbrains_005CRiderProjects_005CBepinex_005CProjects_005CRegiments_005CRegiments_005Clibs_005C0Harmony_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CJetbrains_005CRiderProjects_005CBepinex_005CProjects_005CRegiments_005CRegiments_005Clibs_005CAssembly_002DCSharp_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CJetbrains_005CRiderProjects_005CBepinex_005CProjects_005CRegiments_005CRegiments_005Clibs_005CBepInEx_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CJetbrains_005CRiderProjects_005CBepinex_005CProjects_005CRegiments_005CRegiments_005Clibs_005CConfigurationManager_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CJetbrains_005CRiderProjects_005CBepinex_005CProjects_005CRegiments_005CRegiments_005Clibs_005CMainAssembly_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CJetbrains_005CRiderProjects_005CBepinex_005CProjects_005CRegiments_005CRegiments_005Clibs_005CUnityEngine_002ECoreModule_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CJetbrains_005CRiderProjects_005CBepinex_005CProjects_005CRegiments_005CRegiments_005Clibs_005CUnityEngine_002Edll/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -0,0 +1,96 @@
using System.Linq;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using HarmonyLib.Tools;
namespace Regiments {
[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
public class Main : BaseUnityPlugin {
private const string pluginGuid = "CykaMod";
private const string pluginName = "CykaMod";
private const string pluginVersion = "1.0.0";
public static ConfigEntry<float> SPMultiplier;
public static ConfigEntry<float> TPMultiplier;
public static ConfigEntry<float> SupplyAOEMultiplier;
public static ConfigEntry<float> HQAOEMultiplier;
public static ConfigEntry<float> SupplyAmountMultiplier;
public static ConfigEntry<float> FireRateMultiplier;
public static ConfigEntry<float> AimIntervalMultiplier;
public static ConfigEntry<float> SupplyRateMultiplier;
// public static ConfigEntry<float> magnetRadiusMultiplier;
// public static ConfigEntry<float> beamStrenghtMultiplier;
// public static ConfigEntry<float> beamRadiusMultiplier;
// public static ConfigEntry<float> fuelTankRefillMultiplier;
// public static ConfigEntry<float> fuelTankCapacityMultiplier;
// public static ConfigEntry<float> minerGroundArea;
// public static ConfigEntry<float> minerMiningSpeed;
// public static ConfigEntry<float> wheelTorqueMultiplier;
// public static ConfigEntry<float> wheelSpeedMultiplier;
// public static ConfigEntry<float> jetThrustMultiplier;
public void Awake() {
SPMultiplier = Config.Bind("General", "SP Multiplier", 1f,
new ConfigDescription("SP Multiplier", new AcceptableValueRange<float>(1f, 32f)));
TPMultiplier = Config.Bind("General", "TP Multiplier", 1f,
new ConfigDescription("TP Multiplier", new AcceptableValueRange<float>(1f, 32f)));
SupplyAOEMultiplier = Config.Bind("General", "Supply AOE Multiplier", 1f,
new ConfigDescription("Supply AOE Multiplier", new AcceptableValueRange<float>(1f, 32f)));
SupplyAmountMultiplier = Config.Bind("General", "Supply Point Amount Multiplier", 1f,
new ConfigDescription("Supply Point Amount Multiplier", new AcceptableValueRange<float>(1f, 32f)));
SupplyRateMultiplier = Config.Bind("General", "The rate at which HP and ammo is resupplied", 1f,
new ConfigDescription("The rate at which HP and ammo is resupplied", new AcceptableValueRange<float>(1f, 16f)));
HQAOEMultiplier = Config.Bind("General", "HQ AOE Multiplier", 1f,
new ConfigDescription("HQ AOE Multiplier", new AcceptableValueRange<float>(1f, 32f)));
FireRateMultiplier = Config.Bind("General", "Fire Rate Multiplier", 1f,
new ConfigDescription("Fire Rate Multiplier",
new AcceptableValueRange<float>(0.1f, 32f)));
AimIntervalMultiplier = Config.Bind("General", "Aiming Interval Multiplier", 1f,
new ConfigDescription("Aiming Interval Multiplier", new AcceptableValueRange<float>(0.1f, 32f)));
// beamStrenghtMultiplier = Config.Bind("Attractors", "Beam Strength Multiplier", 1f,
// new ConfigDescription("Beam Strength Multiplier", new AcceptableValueRange<float>(1f, 16f)));
// beamRadiusMultiplier = Config.Bind("Attractors", "Beam Radius Multiplier", 1f,
// new ConfigDescription("Beam Radius Multiplier", new AcceptableValueRange<float>(1f, 16f)));
//
// fuelTankRefillMultiplier = Config.Bind("Propulsion", "Fuel Tank Refill Rate Multiplier", 1f,
// new ConfigDescription("Fuel Tank Refill Rate Multiplier", new AcceptableValueRange<float>(1f, 32f)));
// fuelTankCapacityMultiplier = Config.Bind("Propulsion", "Fuel Tank Capacity Multiplier", 1f,
// new ConfigDescription("Fuel Tank Capacity Multiplier", new AcceptableValueRange<float>(1f, 32f)));
// wheelTorqueMultiplier = Config.Bind("Propulsion", "Wheel Torque Multiplier", 1f,
// new ConfigDescription("Wheel Torque Multiplier", new AcceptableValueRange<float>(1f, 32f)));
// wheelSpeedMultiplier = Config.Bind("Propulsion", "Wheel Max RPM Multiplier", 1f,
// new ConfigDescription("Wheel Max RPM Multiplier", new AcceptableValueRange<float>(1f, 32f)));
// jetThrustMultiplier = Config.Bind("Propulsion", "Jet Thrust Multiplier", 1f,
// new ConfigDescription("Jet Thrust Multiplier", new AcceptableValueRange<float>(1f, 32f)));
//
// minerGroundArea = Config.Bind("Production", "Miner Ground Deposit Scan Area", 1f,
// new ConfigDescription("Miner Ground Deposit Scan Area", new AcceptableValueRange<float>(1f, 32f)));
// minerMiningSpeed = Config.Bind("Production", "Miner Mining Speed", 1f,
// new ConfigDescription("Miner Mining Speed", new AcceptableValueRange<float>(1f, 32f)));
//
// allProjectilesHoming = Config.Bind("General", "Make All Projectiles Home", false);
// shootingSpeedMultiplier.SettingChanged += (sender, args) => WeaponPropertiesManager.DoPatch();
// energyGenMultiplier.SettingChanged += (sender, args) => GeneratorPropertiesManager.DoPatch();
// magnetStrenghtMultiplier.SettingChanged += (sender, args) => MagnetPropertiesManager.DoPatch();
// magnetRadiusMultiplier.SettingChanged += (sender, args) => MagnetPropertiesManager.DoPatch();
// beamStrenghtMultiplier.SettingChanged += (sender, args) => BeamPropertiesManager.DoPatch();
// beamRadiusMultiplier.SettingChanged += (sender, args) => BeamPropertiesManager.DoPatch();
// fuelTankRefillMultiplier.SettingChanged += (sender, args) => FuelPropertiesManager.DoPatch();
// fuelTankCapacityMultiplier.SettingChanged += (sender, args) => FuelPropertiesManager.DoPatch();
// wheelTorqueMultiplier.SettingChanged += (sender, args) => WheelPropertiesManager.DoPatch();
// wheelSpeedMultiplier.SettingChanged += (sender, args) => WheelPropertiesManager.DoPatch();
// jetThrustMultiplier.SettingChanged += (sender, args) => ThrusterPropertiesManager.DoPatch();
// minerGroundArea.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch();
// minerMiningSpeed.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch();
Logger.LogInfo("Cyka mod loaded");
HarmonyFileLog.Enabled = true;
Harmony harmony = new Harmony(pluginGuid);
harmony.PatchAll();
var originalMethods = harmony.GetPatchedMethods();
Logger.LogInfo("Patched " + originalMethods.Count() + " methods");
}
}
}

View File

@@ -1,24 +1,167 @@
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using birdseye;
using birdseye.Regiments;
using birdseye.Regiments.Commanders;
using birdseye.Regiments.GameModes;
using birdseye.Regiments.Menu.GUI;
using birdseye.Regiments.Platoons;
using birdseye.Regiments.Platoons.Modules;
using birdseye.Regiments.Units.WeaponSystems;
using birdseye.Regiments.Zones;
using HarmonyLib;
using UnityEngine;
namespace TerraTech {
[HarmonyPatch]
public class Patches {
[HarmonyPrefix]
[HarmonyPatch(typeof(ManLicenses), "AddXP")]
static void XPMulti(FactionSubTypes corporation, ref int xp, bool showUI = true) {
xp = (int)(xp * Main.xpMultiplier.Value);
}
// Patch maxSupPoints in PlatoonSupplyModule
// Patch Operational Authority point gain
[HarmonyPrefix]
[HarmonyPatch(typeof(ManPlayer), "AddMoney")]
static void MoneyMulti(ref int amount) {
amount = (int)(amount * Main.moneyMultiplier.Value);
}
namespace Regiments {
[HarmonyPatch]
public class Patches {
private static float baseHqValue = 0;
private static float baseSupplyValue = 0;
[HarmonyPrefix]
[HarmonyPatch(typeof(TechHolders), "SetHeartbeatInterval")]
static void HeartbeatMulti(ref float interval) {
interval *= Main.heartbeatIntervalMultiplier.Value;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(SupplyPointsController), "AddSPs")]
static void SpMultiplier(ref float value) {
if (value == 0) {
return;
}
float multiplier = Main.SPMultiplier.Value;
// Console.WriteLine("Multiplying SP {0} by {1}", value, multiplier);
value *= multiplier;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(TacAidPointsController), "AddTP")]
static void TpMultiplier(ref float val) {
if (val == 0) {
return;
}
float multiplier = Main.TPMultiplier.Value;
// Console.WriteLine("Multiplying TP {0} by {1}", val, multiplier);
val *= multiplier;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(MapZoneFactory), "MakeRefitZone")]
static void SupplyAoeMultiplier(ref eSides side, ref Vector3 position, ref float size) {
float multiplier = Main.SupplyAOEMultiplier.Value;
Console.WriteLine("Multiplying supply aoe {0} by {1}", size, multiplier);
size *= multiplier;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(PlatoonHQVisuals), "Start")]
static void HqAoeMultiplier(PlatoonHQVisuals __instance) {
Console.WriteLine("Patching HQ radius - base range {0}", baseHqValue);
if (baseHqValue == 0) {
baseHqValue = __instance.platoon.parameters.HQRadius;
Console.WriteLine("Base range is 0, assigning new: {0}", baseHqValue);
}
__instance.platoon.parameters.HQRadius = baseHqValue * Main.HQAOEMultiplier.Value;
Console.WriteLine("HQ radius patched to: {0}", __instance.platoon.parameters.HQRadius);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(PlatoonSupplyModule), "Start")]
static void SupplyAoeMultiplier(PlatoonSupplyModule __instance) {
Console.WriteLine("Patching supply amount - base amount {0}", baseSupplyValue);
if (baseSupplyValue == 0) {
baseSupplyValue = __instance.platoon.parameters.supplyPointsPerUnit;
Console.WriteLine("Base amount is 0, assigning new: {0}", baseSupplyValue);
}
__instance.platoon.parameters.supplyPointsPerUnit =
(int)(baseSupplyValue * Main.SupplyAmountMultiplier.Value);
Console.WriteLine("Supply amount patched to: {0}", __instance.platoon.parameters.supplyPointsPerUnit);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(WeaponAttackBase), "GetReloadInterval")]
static void FireRateMultiplier(ref float __result) {
Console.WriteLine("Patching fire rate");
__result *= Main.FireRateMultiplier.Value;
Console.WriteLine("Fire rate patched to: {0}", __result);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(WeaponAttackBase), "GetAimInterval")]
static void AimingIntervalMultiplier(ref float __result) {
Console.WriteLine("Patching aim interval - base amount {0}", baseSupplyValue);
__result *= Main.AimIntervalMultiplier.Value;
Console.WriteLine("Aim interval patched to: {0}", __result);
}
[HarmonyPrefix]
[HarmonyPatch(typeof(TimerManager), "GetPersistentTimer")]
static void Transpiler(ref float interval, ref string hint) {
if (hint == "burst") {
Console.WriteLine("Patching burst interval from: {0}", interval);
interval *= Main.FireRateMultiplier.Value;
Console.WriteLine("Burst interval patched to: {0}", interval);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(RefitZone), "OnRefitStep")]
static void SupplyRateMultiplier(ref float hpVal, ref float ammoVal) {
Console.WriteLine("Patching refit step from: {0} {1}", hpVal, ammoVal);
hpVal *= Main.SupplyRateMultiplier.Value;
ammoVal *= Main.SupplyRateMultiplier.Value;
Console.WriteLine("Patching refit step to: {0} {1}", hpVal, ammoVal);
}
// [HarmonyPatch(typeof(AdvancedRulesData), "Validate")]
// static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
// var codes = new List<CodeInstruction>(instructions);
//
// foreach (var code in codes) {
// if (code.opcode == OpCodes.Ldc_R4) {
// Console.WriteLine("Changing " + code);
// code.operand = (float)code.operand * 2;
// Console.WriteLine("Changed " + code);
// }
// }
//
// return codes.AsEnumerable();
// }
// [HarmonyPatch(typeof(AdvancedRulesData), "IsWithinLimits")]
// static IEnumerable<CodeInstruction> Transpiler2(IEnumerable<CodeInstruction> instructions) {
// var codes = new List<CodeInstruction>(instructions);
//
// foreach (var code in codes) {
// if (code.opcode == OpCodes.Ldc_R4) {
// Console.WriteLine("Changing " + code);
// code.operand = (float)code.operand * 2;
// Console.WriteLine("Changed " + code);
// }
// }
//
// return codes.AsEnumerable();
// }
// private static float baseAccuracy;
//
// [HarmonyPostfix]
// [HarmonyPatch(typeof(SkirmishAdvancedRules), "Update")]
// static void AccuracyPatch(SkirmishAdvancedRules __instance) {
// var accMod = Traverse.Create(__instance).Field("currentARD").Field("accuracyModifier");
// if (baseAccuracy == 0) {
// baseAccuracy = (float)accMod.GetValue();
// Console.WriteLine("Base accuracy set to {0}", baseAccuracy);
// }
//
// accMod.SetValue(baseAccuracy * 4f);
// Console.WriteLine("Accuracy now: {0}", accMod.GetValue());
// }
}
}

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Regiments")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Regiments")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("DA9D274E-486F-4F82-84FF-CD9388CB0B09")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DA9D274E-486F-4F82-84FF-CD9388CB0B09}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Regiments</RootNamespace>
<AssemblyName>Regiments</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>libs\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>libs\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="BepInEx">
<HintPath>libs\BepInEx.dll</HintPath>
</Reference>
<Reference Include="ConfigurationManager">
<HintPath>libs\ConfigurationManager.dll</HintPath>
</Reference>
<Reference Include="MainAssembly">
<HintPath>libs\MainAssembly.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>libs\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>libs\UnityEngine.CoreModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Patches.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Transpiler.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -1,5 +1,274 @@
namespace Regiments {
public class Transpiler {
}
}
// 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<float> skillCap;
// public static ConfigEntry<float> workSpeed;
// public static ConfigEntry<float> workResult;
// public static ConfigEntry<bool> alwaysCritical;
// public static ConfigEntry<float> gameSpeed;
// public static ConfigEntry<int> fans;
// public static ConfigEntry<long> 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<CodeInstruction> codes, int index, List<CodeInstruction> 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<CodeInstruction> codes, int index, List<CodeInstruction> 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<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
// var codes = new List<CodeInstruction>(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<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
// var codes = new List<CodeInstruction>(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<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
// var codes = new List<CodeInstruction>(instructions);
//
// List<CodeInstruction> matcher = new List<CodeInstruction>();
// 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<CodeInstruction> patch = new List<CodeInstruction>();
// 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<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
// var codes = new List<CodeInstruction>(instructions);
// int methodIndex = -1;
// List<CodeInstruction> pattern = new List<CodeInstruction>();
//
// List<CodeInstruction> matcher = new List<CodeInstruction>();
// 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<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
// var codes = new List<CodeInstruction>(instructions);
//
// List<CodeInstruction> matcher = new List<CodeInstruction>();
// 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;
// }
// }
// }

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]

View File

@@ -0,0 +1 @@
609c169d30d10d3da64fccb9258a6c7730d0c5b3

View File

@@ -0,0 +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

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]

View File

@@ -0,0 +1 @@
62832bf141ce1cb53e10d7dfb818aaddf62d910680fd3ce46ffa60a38ed43870

View File

@@ -0,0 +1,14 @@
C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\Regiments.dll
C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\Regiments.pdb
C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\0Harmony.dll
C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\Assembly-CSharp.dll
C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\BepInEx.dll
C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\ConfigurationManager.dll
C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\UnityEngine.CoreModule.dll
C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\UnityEngine.dll
C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Release\Regiments.csproj.AssemblyReference.cache
C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Release\Regiments.csproj.CoreCompileInputs.cache
C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Release\Regiments.csproj.CopyComplete
C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Release\Regiments.dll
C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\obj\Release\Regiments.pdb
C:\Users\Administrator\Seafile\Jetbrains\RiderProjects\Bepinex\Projects\Regiments\Regiments\bin\Release\MainAssembly.dll

View File

@@ -0,0 +1 @@
cp 'C:/Users/Administrator/RiderProjects/Bepinex/Projects/Regiments/Regiments/obj/Release/Regiments.dll' 'C:/Program Files (x86)/Steam/steamapps/common/Regiments/BepInEx/plugins'