Compare commits
92 Commits
Supermarke
...
90edaaf5c8
Author | SHA1 | Date | |
---|---|---|---|
90edaaf5c8 | |||
1740f7f4ba | |||
a95bf892ab | |||
b786897b9f | |||
259446cfbe | |||
9476ddabf3 | |||
5bd4d341f8 | |||
fcf24a7cbe | |||
d0b0a45f3a | |||
c7a55276e2 | |||
1a81695349 | |||
ef58960245 | |||
f663d28109 | |||
df73f0cb07 | |||
c2508563e0 | |||
0306be5dfb | |||
1f8a0bbf21 | |||
abf53a9cd0 | |||
519e6e3a6c | |||
7b3f628215 | |||
335fc98ac2 | |||
289bb5be8e | |||
3d48f4fded | |||
9347202722 | |||
105fb30dd7 | |||
e7672fadba | |||
32f62fff02 | |||
fda4abd0ea | |||
ffc398c202 | |||
dee8e85eb9 | |||
f0e4a2d64b | |||
34ad8bef4d | |||
2e030b6fe2 | |||
c05212a860 | |||
21963d9013 | |||
306b95644b | |||
ace4fba19e | |||
1904f12d6c | |||
4afa45fa4e | |||
761b524f20 | |||
4cf2eb9e9b | |||
2273610965 | |||
e95e86092a | |||
bf982418ca | |||
54294574de | |||
d432d5df96 | |||
2c2ba060cc | |||
02f370fd66 | |||
ec5dd30826 | |||
a4c81ea445 | |||
d704437cc7 | |||
c0852dcc68 | |||
fa822cedd4 | |||
1ce4d4368e | |||
efdab6cb38 | |||
a4ac6d63cd | |||
8f8f3a1969 | |||
8eaaaadcd0 | |||
b36d7717eb | |||
2e4fe4e7e3 | |||
10e8218d07 | |||
2e7f8015c5 | |||
b8b06f2efe | |||
be05eb013e | |||
8fc5fa8c26 | |||
4eee4d89e3 | |||
6d782ef9ed | |||
0a48ce2f63 | |||
1e479005a1 | |||
bdf34571be | |||
2f42e410e8 | |||
64b52c0e95 | |||
bbe92da556 | |||
d32cda849e | |||
a48fc8ad10 | |||
d8d717c53a | |||
0ee56fc7b1 | |||
a87821f2ad | |||
74668188ce | |||
72c9b4baa3 | |||
762a1707af | |||
a0edd9edec | |||
59e94959da | |||
454939d0eb | |||
00a9ad69bb | |||
b4eb299415 | |||
92cb8b7ca4 | |||
ed67c49c04 | |||
f216cfddb3 | |||
12c4be7c10 | |||
42acdd9204 | |||
2876c0c41b |
14
.gitmodules
vendored
Normal file
14
.gitmodules
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
[submodule "Projects/CaptainOfIndustry/CaptainOfCheats"]
|
||||
path = Projects/CaptainOfIndustry/CaptainOfCheats
|
||||
url = https://github.com/altmank/CaptainOfCheats
|
||||
url = https://github.com/Keranik/COI-Extended
|
||||
[submodule "Projects/CaptainOfIndustry/DoubleQoLMod"]
|
||||
path = Projects/CaptainOfIndustry/DoubleQoLMod
|
||||
url = https://github.com/PhatDave/DoubleQoLMod
|
||||
url = https://github.com/Keranik/COI-Extended
|
||||
[submodule "Projects/CaptainOfIndustry/COI_MineDumpControl"]
|
||||
path = Projects/CaptainOfIndustry/COI_MineDumpControl
|
||||
url = https://github.com/hreintke/COI_MineDumpControl
|
||||
[submodule "Projects/CaptainOfIndustry/DifficultySettingsMod"]
|
||||
path = Projects/CaptainOfIndustry/DifficultySettingsMod
|
||||
url = https://github.com/KptKosmit91/CaptainOfIndustry-DifficultySettingsMod
|
16
Projects/AirportCEO/AirportCEO.sln
Normal file
16
Projects/AirportCEO/AirportCEO.sln
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AirportCEO", "AirportCEO\AirportCEO.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
|
4
Projects/AirportCEO/AirportCEO.sln.DotSettings.user
Normal file
4
Projects/AirportCEO/AirportCEO.sln.DotSettings.user
Normal file
@@ -0,0 +1,4 @@
|
||||
<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:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" />
|
||||
</AssemblyExplorer></s:String></wpf:ResourceDictionary>
|
6
Projects/AirportCEO/AirportCEO/.editorconfig
Normal file
6
Projects/AirportCEO/AirportCEO/.editorconfig
Normal file
@@ -0,0 +1,6 @@
|
||||
# CSharp formatting rules:
|
||||
[*.cs]
|
||||
csharp_new_line_before_open_brace = none
|
||||
csharp_new_line_before_else = false
|
||||
csharp_new_line_before_catch = false
|
||||
csharp_new_line_before_finally = false
|
62
Projects/AirportCEO/AirportCEO/AirportCEO.csproj
Normal file
62
Projects/AirportCEO/AirportCEO/AirportCEO.csproj
Normal file
@@ -0,0 +1,62 @@
|
||||
<?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>
|
||||
<GAME_DIR>C:/Games/Airport CEO</GAME_DIR>
|
||||
<GAME_MANAGED>$(GAME_DIR)/Airport CEO_Data/Managed</GAME_MANAGED>
|
||||
<GAME_BEPINEX>$(GAME_DIR)/BepInEx</GAME_BEPINEX>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{DA9D274E-486F-4F82-84FF-CD9388CB0B09}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DaveCEO</RootNamespace>
|
||||
<AssemblyName>DaveCEO</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>
|
||||
<Compile Include="DaveCEO.cs"/>
|
||||
<Compile Include="Properties\AssemblyInfo.cs"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>$(GAME_BEPINEX)/core/0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>$(GAME_BEPINEX)/core/BepInEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ConfigurationManager">
|
||||
<HintPath>$(GAME_BEPINEX)/plugins/ConfigurationManager/ConfigurationManager.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>$(GAME_MANAGED)/Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>$(GAME_MANAGED)/UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>$(GAME_MANAGED)/UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
||||
</Project>
|
41
Projects/AirportCEO/AirportCEO/DaveCEO.cs
Normal file
41
Projects/AirportCEO/AirportCEO/DaveCEO.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using HarmonyLib.Tools;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace DaveCEO {
|
||||
[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
|
||||
public class Main : BaseUnityPlugin {
|
||||
private const string pluginGuid = "DaveCEO";
|
||||
private const string pluginName = "DaveCEO";
|
||||
private const string pluginVersion = "1.0.0";
|
||||
|
||||
public static ConfigEntry<float> moneyMultiplier;
|
||||
|
||||
public void Awake() {
|
||||
moneyMultiplier = Config.Bind("General", "MoneyMultiplier", 1f);
|
||||
|
||||
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");
|
||||
foreach (var method in originalMethods) {
|
||||
Logger.LogInfo("Patched " + method.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public class Patches {
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(EconomyController), "AddFunds")]
|
||||
public static void Prefix(ref float sum) {
|
||||
sum *= Main.moneyMultiplier.Value;
|
||||
}
|
||||
}
|
||||
}
|
35
Projects/AirportCEO/AirportCEO/Properties/AssemblyInfo.cs
Normal file
35
Projects/AirportCEO/AirportCEO/Properties/AssemblyInfo.cs
Normal 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("DaveCEO")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DaveCEO")]
|
||||
[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")]
|
1
Projects/AirportCEO/AirportCEO/sync
Normal file
1
Projects/AirportCEO/AirportCEO/sync
Normal file
@@ -0,0 +1 @@
|
||||
bin/Release/DaveCEO.dll,"C:\Games\Airport CEO\BepInEx\plugins\DaveCEO.dll"
|
@@ -0,0 +1,4 @@
|
||||
<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:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" />
|
||||
</AssemblyExplorer></s:String></wpf:ResourceDictionary>
|
@@ -0,0 +1,4 @@
|
||||
<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:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" />
|
||||
</AssemblyExplorer></s:String></wpf:ResourceDictionary>
|
@@ -1 +0,0 @@
|
||||
C:/Program Files (x86)/Steam/steamapps/common/Captain of Industry/BepInex
|
1
Projects/CaptainOfIndustry/COI_MineDumpControl
Submodule
1
Projects/CaptainOfIndustry/COI_MineDumpControl
Submodule
Submodule Projects/CaptainOfIndustry/COI_MineDumpControl added at 3c83562726
1
Projects/CaptainOfIndustry/CaptainOfCheats
Submodule
1
Projects/CaptainOfIndustry/CaptainOfCheats
Submodule
Submodule Projects/CaptainOfIndustry/CaptainOfCheats added at ab65eeed05
@@ -1,28 +0,0 @@
|
||||
<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_005CTerraTech_005Clibs_005C0Harmony_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CAssembly_002DCSharp_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CBepInEx_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CConfigurationManager_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CUnityEngine_002ECoreModule_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CUnityEngine_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005C0Harmony_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CAssembly_002DCSharp_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CBepInEx_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CConfigurationManager_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CcopyLibs_002Esh/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005Clibs_002Etxt/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CMafi_002EBase_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CMafi_002ECore_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CMafi_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CMafi_002EModsAuthoringSupport_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CMafi_002EUnity_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CSirenix_002EOdinInspector_002EAttributes_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CSirenix_002EOdinInspector_002ECompatibilityLayer_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CSirenix_002ESerialization_002EConfig_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CSirenix_002ESerialization_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CSirenix_002EUtilities_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CUnityEngine_002ECoreModule_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CSeafile_005CProjects_002DRider_005CRiderProjects_005CBepinex_005CProjects_005CCaptainOfIndustry_005Clibs_005CUnityEngine_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer /></s:String>
|
||||
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</s:String>
|
||||
<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/BuildTool/MsbuildVersion/@EntryValue">262144</s:Int64></wpf:ResourceDictionary>
|
@@ -1,97 +0,0 @@
|
||||
<?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>{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CaptainOfIndustry</RootNamespace>
|
||||
<AssemblyName>CaptainOfIndustry</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</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>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="Patches.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<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="Mafi">
|
||||
<HintPath>..\libs\Mafi.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mafi.Base">
|
||||
<HintPath>..\libs\Mafi.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mafi.Core">
|
||||
<HintPath>..\libs\Mafi.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mafi.ModsAuthoringSupport">
|
||||
<HintPath>..\libs\Mafi.ModsAuthoringSupport.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mafi.Unity">
|
||||
<HintPath>..\libs\Mafi.Unity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Sirenix.OdinInspector.Attributes">
|
||||
<HintPath>..\libs\Sirenix.OdinInspector.Attributes.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Sirenix.OdinInspector.CompatibilityLayer">
|
||||
<HintPath>..\libs\Sirenix.OdinInspector.CompatibilityLayer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Sirenix.Serialization">
|
||||
<HintPath>..\libs\Sirenix.Serialization.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Sirenix.Serialization.Config">
|
||||
<HintPath>..\libs\Sirenix.Serialization.Config.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Sirenix.Utilities">
|
||||
<HintPath>..\libs\Sirenix.Utilities.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>..\libs\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>..\libs\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
</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>
|
@@ -1,75 +0,0 @@
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using HarmonyLib.Tools;
|
||||
|
||||
// TODO: Make shield and repair bigger
|
||||
// TODO: Maybe make props faster, thrusters work fine
|
||||
|
||||
namespace CaptainOfIndustry {
|
||||
[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<int> excavatorCapacityMultiplier;
|
||||
public static ConfigEntry<int> truckCapacityMultiplier;
|
||||
public static ConfigEntry<int> cargoShipCapacityMultiplier;
|
||||
public static ConfigEntry<float> excavatorMiningAreaMultiplier;
|
||||
public static ConfigEntry<float> excavatorMinReachMultiplier;
|
||||
public static ConfigEntry<float> excavatorMaxReachMultiplier;
|
||||
public static ConfigEntry<float> bufferCapacityMultiplier;
|
||||
public static ConfigEntry<float> unityGenerationMultiplier;
|
||||
public static ConfigEntry<float> depotTransferSpeedMultiplier;
|
||||
public static ConfigEntry<float> worldMineSpeedMultiplier;
|
||||
public static ConfigEntry<float> housingCapacityMultiplier;
|
||||
public static ConfigEntry<float> dumpDelayMultiplier;
|
||||
public static ConfigEntry<float> transportSpeedMultiplier;
|
||||
public static ConfigEntry<float> shipyardCargoMultiplier;
|
||||
|
||||
public void Awake() {
|
||||
excavatorCapacityMultiplier = Config.Bind("General", "Excavator Capacity Multiplier", 1, new ConfigDescription("Excavator Capacity Multiplier"));
|
||||
truckCapacityMultiplier = Config.Bind("General", "Truck Capacity Multiplier", 1, new ConfigDescription("Truck Capacity Multiplier"));
|
||||
cargoShipCapacityMultiplier = Config.Bind("General", "Cargo Ship Capacity Multiplier", 1, new ConfigDescription("Cargo Ship Capacity Multiplier"));
|
||||
excavatorMiningAreaMultiplier = Config.Bind("General", "Excavator Mining Area Multiplier", 1f, new ConfigDescription("Excavator Mining Area Multiplier"));
|
||||
excavatorMinReachMultiplier = Config.Bind("General", "Excavator Min Reach Multiplier", 1f, new ConfigDescription("Excavator Min Reach Multiplier"));
|
||||
excavatorMaxReachMultiplier = Config.Bind("General", "Excavator Max Reach Multiplier", 1f, new ConfigDescription("Excavator Max Reach Multiplier"));
|
||||
bufferCapacityMultiplier = Config.Bind("General", "Buffer Capacity Multiplier", 1f, new ConfigDescription("Buffer Capacity Multiplier"));
|
||||
storageCapacityMultiplier = Config.Bind("General", "Storage Capacity Multiplier", 1f, new ConfigDescription("Storage Capacity Multiplier"));
|
||||
unityGenerationMultiplier = Config.Bind("General", "Unity Generation Multiplier", 1f, new ConfigDescription("Unity Generation Multiplier"));
|
||||
depotTransferSpeedMultiplier = Config.Bind("General", "Depot Transfer Speed Multiplier", 1f, new ConfigDescription("Depot Transfer Speed Multiplier"));
|
||||
worldMineSpeedMultiplier = Config.Bind("General", "World Mine Speed Multiplier", 1f, new ConfigDescription("World Mine Speed Multiplier"));
|
||||
housingCapacityMultiplier = Config.Bind("General", "Housing Capacity Multiplier", 1f, new ConfigDescription("Housing Capacity Multiplier"));
|
||||
dumpDelayMultiplier = Config.Bind("General", "Dump Delay Multiplier", 1f, new ConfigDescription("Dump Delay Multiplier"));
|
||||
transportSpeedMultiplier = Config.Bind("General", "Transport Speed Multiplier", 1f, new ConfigDescription("Transport Speed Multiplier"));
|
||||
shipyardCargoMultiplier = Config.Bind("General", "Shipyard Cargo Multiplier", 1f, new ConfigDescription("Shipyard Cargo Multiplier"));
|
||||
|
||||
// shootingSpeedMultiplier.SettingChanged += (sender, args) => WeaponPropertiesManager.DoPatch();
|
||||
// energyGenMultiplier.SettingChanged += (sender, args) => GeneratorPropertiesManager.DoPatch();
|
||||
// magnetStrenghtMultiplier.SettingChanged += (sender, args) => MagnetPropertiesManager.DoPatch();
|
||||
// magnetRadiusMultiplier.SettingChanged += (sender, args) => MagnetPropertiesManager.DoPatch();
|
||||
// beamStrenghtMultiplier.SettingChanged += (sender, args) => BeamPropertiesManager.DoPatch();
|
||||
// beamRadiusMultiplier.SettingChanged += (sender, args) => BeamPropertiesManager.DoPatch();
|
||||
// fuelTankRefillMultiplier.SettingChanged += (sender, args) => FuelPropertiesManager.DoPatch();
|
||||
// fuelTankCapacityMultiplier.SettingChanged += (sender, args) => FuelPropertiesManager.DoPatch();
|
||||
// wheelTorqueMultiplier.SettingChanged += (sender, args) => WheelPropertiesManager.DoPatch();
|
||||
// wheelSpeedMultiplier.SettingChanged += (sender, args) => WheelPropertiesManager.DoPatch();
|
||||
// jetThrustMultiplier.SettingChanged += (sender, args) => ThrusterPropertiesManager.DoPatch();
|
||||
// minerGroundArea.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch();
|
||||
// minerMiningSpeed.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch();
|
||||
// wirelessChargingPowerPerArcMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch();
|
||||
// wirelessChargingArcFiringIntervalMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch();
|
||||
// wirelessChargingRadiusMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch();
|
||||
|
||||
Logger.LogInfo("Cyka mod loaded");
|
||||
HarmonyFileLog.Enabled = true;
|
||||
Harmony harmony = new Harmony(pluginGuid);
|
||||
harmony.PatchAll();
|
||||
var originalMethods = harmony.GetPatchedMethods();
|
||||
// Logger.LogInfo("Patched " + originalMethods.Count() + " methods");
|
||||
}
|
||||
|
||||
public static ConfigEntry<float> storageCapacityMultiplier;
|
||||
}
|
||||
}
|
@@ -1,466 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using HarmonyLib;
|
||||
using Mafi;
|
||||
using Mafi.Collections.ImmutableCollections;
|
||||
using Mafi.Core;
|
||||
using Mafi.Core.Buildings.Cargo.Modules;
|
||||
using Mafi.Core.Buildings.Cargo.Ships.Modules;
|
||||
using Mafi.Core.Buildings.Settlements;
|
||||
using Mafi.Core.Buildings.Shipyard;
|
||||
using Mafi.Core.Buildings.Storages;
|
||||
using Mafi.Core.Entities;
|
||||
using Mafi.Core.Entities.Dynamic;
|
||||
using Mafi.Core.Entities.Static;
|
||||
using Mafi.Core.Entities.Static.Layout;
|
||||
using Mafi.Core.Factory.Machines;
|
||||
using Mafi.Core.Factory.Transports;
|
||||
using Mafi.Core.Population;
|
||||
using Mafi.Core.Ports.Io;
|
||||
using Mafi.Core.Products;
|
||||
using Mafi.Core.Prototypes;
|
||||
using Mafi.Core.Terrain;
|
||||
using Mafi.Core.World.Entities;
|
||||
|
||||
namespace CaptainOfIndustry {
|
||||
[HarmonyPatch]
|
||||
public class Patches {
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ExcavatorProtoBuilder.ExcavatorProtoBuilderState), "SetCapacity")]
|
||||
static void excavatorCapacityMultiplier(ref int quantity) {
|
||||
// Console.WriteLine("IndustrialCyka: Old excavator capacity: {0}", quantity);
|
||||
quantity *= Main.excavatorCapacityMultiplier.Value;
|
||||
// Console.WriteLine("IndustrialCyka: Old excavator capacity: {0}", quantity);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ExcavatorProtoBuilder.ExcavatorProtoBuilderState), "SetMinedThicknessByDistanceMeters")]
|
||||
static void excavatorMiningAreaMultiplier(ref float[] thicknessMeters) {
|
||||
for (int i = 0; i < thicknessMeters.Length; i++) {
|
||||
// Console.WriteLine("IndustrialCyka: Old mining area: {0}", thicknessMeters[i]);
|
||||
thicknessMeters[i] *= Main.excavatorMiningAreaMultiplier.Value;
|
||||
// Console.WriteLine("IndustrialCyka: New mining area: {0}", thicknessMeters[i]);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ExcavatorProtoBuilder.ExcavatorProtoBuilderState), "SetMaxMiningDistance")]
|
||||
static void excavatorReachMultiplier(ref RelTile1i minMiningDistance, ref RelTile1i maxMiningDistance) {
|
||||
Console.WriteLine("Min distance: {0}, max distance: {1}", minMiningDistance, maxMiningDistance);
|
||||
minMiningDistance = new RelTile1i((int)(minMiningDistance.Value * Main.excavatorMinReachMultiplier.Value));
|
||||
maxMiningDistance = new RelTile1i((int)(maxMiningDistance.Value * Main.excavatorMaxReachMultiplier.Value));
|
||||
Console.WriteLine("Min distance: {0}, max distance: {1}", minMiningDistance, maxMiningDistance);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(TruckProtoBuilder.TruckProtoBuilderState), "SetCapacity")]
|
||||
static void truckCapacityMultiplier(ref int quantity) {
|
||||
// Console.WriteLine("IndustrialCyka: Old truck capacity: {0}", quantity);
|
||||
quantity *= Main.truckCapacityMultiplier.Value;
|
||||
// Console.WriteLine("IndustrialCyka: New truck capacity: {0}", quantity);
|
||||
}
|
||||
|
||||
// [HarmonyPrefix]
|
||||
// [HarmonyPatch(typeof(StorageProtoBuilder.State), "SetCapacity")]
|
||||
// static void storageCapacityMultiplier(ref int capacity) {
|
||||
// // Console.WriteLine("IndustrialCyka: Old storage capacity: {0}", capacity);
|
||||
// capacity = (int)(capacity * Main.storageCapacityMultiplier.Value);
|
||||
// // Console.WriteLine("IndustrialCyka: New storage capacity: {0}", capacity);
|
||||
// }
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(CargoShipModuleProto), MethodType.Constructor,
|
||||
new[] {
|
||||
typeof(Proto.ID), typeof(Proto.Str), typeof(ProductType), typeof(Quantity),
|
||||
typeof(CargoShipModuleProto.Gfx)
|
||||
})]
|
||||
static void cargoShipCapacityMultiplier(CargoShipModuleProto __instance) {
|
||||
// Console.WriteLine("IndustrialCyka: Old ship capacity: {0}", __instance.Capacity.Value);
|
||||
__instance.Capacity = new Quantity(__instance.Capacity.Value * Main.cargoShipCapacityMultiplier.Value);
|
||||
// Console.WriteLine("IndustrialCyka: New ship capacity: {0}", __instance.Capacity.Value);
|
||||
}
|
||||
|
||||
// No workey... idk how it's supposed to work, speed is always 1 or 100%
|
||||
// [HarmonyPrefix]
|
||||
// [HarmonyPatch(typeof(DrivingEntity), "SetSpeedFactor")]
|
||||
// static void vehicleSpeedMultiplier(ref Percent speedFactor) {
|
||||
// // Console.WriteLine("IndustrialCyka: Old speed: {0}", speedFactor.ToString());
|
||||
// // typeof(Percent)
|
||||
// // .GetField("RawValue",BindingFlags.Instance|BindingFlags.NonPublic)
|
||||
// // .SetValue(speedFactor,speedFactor.ToFloat() / Main.vehicleSpeedMultiplier.Value);
|
||||
// Percent newSpeedFactor = Percent.FromFloat(speedFactor.ToFloat() / Main.vehicleSpeedMultiplier.Value);
|
||||
// speedFactor = newSpeedFactor;
|
||||
// // Console.WriteLine("IndustrialCyka: New speed: {1}", newSpeedFactor.RawValue.ToString());
|
||||
// }
|
||||
|
||||
// [HarmonyPostfix]
|
||||
// [HarmonyPatch(typeof(SmoothDriver), "SetSpeedFactor")]
|
||||
// static void vehicleSpeedMultiplier(SmoothDriver __instance) {
|
||||
// Fix32 speedMulti = Fix32.FromFloat(Main.vehicleSpeedMultiplier.Value);
|
||||
//
|
||||
// Traverse traverse = Traverse.Create(__instance);
|
||||
// Traverse maxForwardsSpeedField = traverse.Field("m_maxForwardsSpeed");
|
||||
// Traverse maxBackwardsSpeedField = traverse.Field("m_maxBackwardsSpeed");
|
||||
// Traverse maxAccelerationField = traverse.Field("m_maxAcceleration");
|
||||
//
|
||||
// // Console.WriteLine("IndustrialCyka: Old speeds: (F) {0}, (B) {1}, (A) {2}", maxForwardsSpeedField.GetValue(),
|
||||
// // maxBackwardsSpeedField.GetValue(), maxAccelerationField.GetValue());
|
||||
//
|
||||
// maxForwardsSpeedField.SetValue((Fix32)maxForwardsSpeedField.GetValue() * speedMulti);
|
||||
// maxBackwardsSpeedField.SetValue((Fix32)maxBackwardsSpeedField.GetValue() * speedMulti);
|
||||
// maxAccelerationField.SetValue((Fix32)maxAccelerationField.GetValue() * speedMulti);
|
||||
//
|
||||
// // Console.WriteLine("IndustrialCyka: New speeds: (F) {0}, (B) {1}, (A) {2}", maxForwardsSpeedField.GetValue(),
|
||||
// // maxBackwardsSpeedField.GetValue(), maxAccelerationField.GetValue());
|
||||
// }
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(StorageBaseProto), MethodType.Constructor,
|
||||
new[] {
|
||||
typeof(StaticEntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(EntityLayout),
|
||||
typeof(Quantity),
|
||||
typeof(EntityCosts),
|
||||
typeof(LayoutEntityProto.Gfx),
|
||||
typeof(Quantity),
|
||||
typeof(Duration),
|
||||
typeof(IEnumerable<Tag>)
|
||||
})]
|
||||
static void storageCapacityMultiplier(StorageProto __instance) {
|
||||
// Console.WriteLine("IndustrialCyka: Old storage capacity: {0}", __instance.Capacity.Value);
|
||||
// Console.WriteLine("IndustrialCyka: Old storage transfer limit: {0}", __instance.TransferLimit.Value);
|
||||
Traverse traverse = Traverse.Create(__instance);
|
||||
|
||||
traverse.Field("Capacity")
|
||||
.SetValue(new Quantity((int)(__instance.Capacity.Value * Main.storageCapacityMultiplier.Value)));
|
||||
traverse.Field("TransferLimit").SetValue(new Quantity(10000));
|
||||
traverse.Field("TransferLimitDuration").SetValue(Duration.FromTicks(1));
|
||||
|
||||
// Console.WriteLine("IndustrialCyka: New storage capacity: {0}", __instance.Capacity.Value);
|
||||
// Console.WriteLine("IndustrialCyka: New storage transfer limit: {0}", __instance.TransferLimit.Value);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(UpointsManager), "GenerateUnity")]
|
||||
static void unityGenerationMultiplier(Proto.ID categoryId, ref Upoints generated) {
|
||||
// Console.WriteLine("IndustrialCyka: Old generated {0} unity", generated.Value);
|
||||
Fix32 multi = Fix32.FromFloat(Main.unityGenerationMultiplier.Value);
|
||||
generated = new Upoints(generated.Value * multi);
|
||||
// Console.WriteLine("IndustrialCyka: New generated {0} unity", generated.Value);
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(Machine), "updateWorkOnRecipes")]
|
||||
static IEnumerable<CodeInstruction> unityBooster(IEnumerable<CodeInstruction> instructions) {
|
||||
Dictionary<int, OpCode> matchTable = new Dictionary<int, OpCode>();
|
||||
matchTable[0] = OpCodes.Ldsfld;
|
||||
matchTable[1] = OpCodes.Br;
|
||||
matchTable[2] = OpCodes.Ldc_I4_2;
|
||||
int matches = 0;
|
||||
int totalMatch = matchTable.Count;
|
||||
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
for (int i = 0; i < codes.Count; i++) {
|
||||
if (matches >= totalMatch) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (codes[i].opcode.Equals(matchTable[matches])) {
|
||||
if (matches == totalMatch - 1) {
|
||||
codes[i].opcode = OpCodes.Ldc_I4_6;
|
||||
}
|
||||
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
|
||||
// for (int i = 0; i < codes.Count; i++) {
|
||||
// Console.WriteLine(codes[i].ToString());
|
||||
// }
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
|
||||
// Could not make this work either... idk why... Doesn't make sense...
|
||||
// [HarmonyPostfix]
|
||||
// [HarmonyPatch(typeof(SimpleVirtualResource), "MineResourceAt")]
|
||||
// static void infiniteGroundResources(SimpleVirtualResource __instance) {
|
||||
// // Console.WriteLine("IndustrialCyka: Patching ground resources (Capacity)");
|
||||
// Traverse traverse = Traverse.Create(__instance);
|
||||
// Traverse capacityField = traverse.Field("Capacity");
|
||||
// capacityField.SetValue(1000000000);
|
||||
// Traverse quantityField = traverse.Field("Quantity");
|
||||
// quantityField.SetValue(1000000000);
|
||||
// }
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ProductBuffer), "ForceNewCapacityTo")]
|
||||
static void bufferCapacityMultiplier(ref Quantity newCapacity) {
|
||||
if (newCapacity.Value <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Quantity newNewCapacity = new Quantity((int)(newCapacity.Value * Main.bufferCapacityMultiplier.Value));
|
||||
newCapacity = newNewCapacity;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(CargoDepotModuleProto), MethodType.Constructor,
|
||||
new[] {
|
||||
typeof(CargoDepotModuleProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(EntityLayout),
|
||||
typeof(ProductType),
|
||||
typeof(Option<CargoDepotModuleProto>),
|
||||
typeof(Quantity),
|
||||
typeof(Quantity),
|
||||
typeof(Duration),
|
||||
typeof(Electricity),
|
||||
typeof(bool),
|
||||
typeof(Percent),
|
||||
typeof(EntityCosts),
|
||||
typeof(CargoDepotModuleProto.Gfx),
|
||||
typeof(IEnumerable<Tag>),
|
||||
})]
|
||||
static void depotTransferSpeedMultiplier(CargoDepotModuleProto __instance) {
|
||||
// Console.WriteLine("IndustrialCyka: Old storage capacity: {0}", __instance.Capacity.Value);
|
||||
Traverse traverse = Traverse.Create(__instance);
|
||||
|
||||
traverse.Field("QuantityPerExchange")
|
||||
.SetValue(new Quantity((int)(__instance.QuantityPerExchange.Value *
|
||||
Main.depotTransferSpeedMultiplier.Value)));
|
||||
|
||||
// Console.WriteLine("IndustrialCyka: New storage capacity: {0}", __instance.Capacity.Value);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(WorldMapMineProto), MethodType.Constructor,
|
||||
new[] {
|
||||
typeof(EntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(ProductQuantity),
|
||||
typeof(Duration),
|
||||
typeof(Upoints),
|
||||
typeof(UpointsCategoryProto),
|
||||
typeof(EntityCosts),
|
||||
typeof(Func<int, EntityCosts>),
|
||||
typeof(int),
|
||||
typeof(Quantity),
|
||||
typeof(WorldMapEntityProto.Gfx),
|
||||
typeof(int),
|
||||
typeof(int),
|
||||
typeof(IEnumerable<Tag>),
|
||||
})]
|
||||
static void worldMineSpeedMultiplier(WorldMapMineProto __instance) {
|
||||
// Console.WriteLine("Before: {0}", __instance.ProducedProductPerStep.Quantity.Value);
|
||||
ProductQuantity newProductQuantity = new ProductQuantity(__instance.ProducedProductPerStep.Product,
|
||||
new Quantity((int)(__instance.ProducedProductPerStep.Quantity.Value *
|
||||
Main.worldMineSpeedMultiplier.Value)));
|
||||
|
||||
Traverse.Create(__instance)
|
||||
.Field("ProducedProductPerStep")
|
||||
.SetValue(newProductQuantity);
|
||||
// Console.WriteLine("After: {0}", __instance.ProducedProductPerStep.Quantity.Value);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(WorldMapMineProto), MethodType.Constructor,
|
||||
new[] {
|
||||
typeof(EntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(ProductQuantity),
|
||||
typeof(Duration),
|
||||
typeof(Upoints),
|
||||
typeof(UpointsCategoryProto),
|
||||
typeof(EntityCosts),
|
||||
typeof(Func<int, EntityCosts>),
|
||||
typeof(int),
|
||||
typeof(Quantity),
|
||||
typeof(WorldMapEntityProto.Gfx),
|
||||
typeof(int),
|
||||
typeof(int),
|
||||
typeof(IEnumerable<Tag>),
|
||||
})]
|
||||
static void worldMineLevelIncrementMultiplier(WorldMapMineProto __instance) {
|
||||
Traverse traverse = Traverse.Create(__instance);
|
||||
|
||||
// int level = traverse.Field("Level").GetValue<int>();
|
||||
int maxLevel = traverse.Field("MaxLevel").GetValue<int>();
|
||||
// int levelsPerUpgrade = traverse.Field("LevelsPerUpgrade").GetValue<int>();
|
||||
|
||||
int newLevelsPerUpgrade = 10;
|
||||
int newMaxLevel = (int)Math.Ceiling((double)maxLevel / newLevelsPerUpgrade) * newLevelsPerUpgrade;
|
||||
|
||||
// Console.WriteLine("Level: {0}, MaxLevel: {1}, LevelsPerUpgrade: {2}", level, maxLevel, levelsPerUpgrade);
|
||||
// Console.WriteLine("NewMaxLevel: {0}", newMaxLevel);
|
||||
|
||||
traverse.Field("MaxLevel").SetValue(newMaxLevel);
|
||||
traverse.Field("LevelsPerUpgrade").SetValue(newLevelsPerUpgrade);
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(WorldMapMineProto), MethodType.Constructor,
|
||||
new[] {
|
||||
typeof(EntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(ProductQuantity),
|
||||
typeof(Duration),
|
||||
typeof(Upoints),
|
||||
typeof(UpointsCategoryProto),
|
||||
typeof(EntityCosts),
|
||||
typeof(Func<int, EntityCosts>),
|
||||
typeof(int),
|
||||
typeof(Quantity),
|
||||
typeof(WorldMapEntityProto.Gfx),
|
||||
typeof(int),
|
||||
typeof(int),
|
||||
typeof(IEnumerable<Tag>),
|
||||
})]
|
||||
static IEnumerable<CodeInstruction> cookWorldMineLevelIncrementMultiplier(
|
||||
IEnumerable<CodeInstruction> instructions) {
|
||||
Dictionary<int, OpCode> matchTable = new Dictionary<int, OpCode>();
|
||||
matchTable[0] = OpCodes.Rem;
|
||||
matchTable[1] = OpCodes.Ldfld;
|
||||
matchTable[2] = OpCodes.Ldarg_0;
|
||||
matchTable[3] = OpCodes.Ldfld;
|
||||
matchTable[4] = OpCodes.Ldarg_0;
|
||||
int matches = 0;
|
||||
int totalMatch = matchTable.Count;
|
||||
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
for (int i = codes.Count - 1; i >= 0; i--) {
|
||||
if (matches >= totalMatch) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (codes[i].opcode.Equals(matchTable[matches])) {
|
||||
if (matches == totalMatch - 1) {
|
||||
codes[i + 4].opcode = OpCodes.Add;
|
||||
codes[i + 5].opcode = OpCodes.Brtrue_S;
|
||||
break;
|
||||
}
|
||||
|
||||
matches++;
|
||||
}
|
||||
else {
|
||||
matches = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(SettlementHousingModuleProto), MethodType.Constructor, new[] {
|
||||
typeof(StaticEntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(EntityLayout),
|
||||
typeof(EntityCosts),
|
||||
typeof(int),
|
||||
typeof(Upoints),
|
||||
typeof(ImmutableArray<KeyValuePair<ImmutableArray<PopNeedProto>, Percent>>),
|
||||
typeof(IReadOnlyDictionary<PopNeedProto, Percent>),
|
||||
typeof(Option<SettlementHousingModuleProto>),
|
||||
typeof(SettlementHousingModuleProto.Gfx),
|
||||
})]
|
||||
static void housingCapacityMultiplier(SettlementHousingModuleProto __instance) {
|
||||
Traverse.Create(__instance).Field<int>("Capacity").Value =
|
||||
(int)(__instance.Capacity * Main.housingCapacityMultiplier.Value);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(StackerProto), MethodType.Constructor, new[] {
|
||||
typeof(StaticEntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(EntityLayout),
|
||||
typeof(EntityCosts),
|
||||
typeof(Electricity),
|
||||
typeof(ThicknessTilesI),
|
||||
typeof(RelTile3i),
|
||||
typeof(Duration),
|
||||
typeof(Duration),
|
||||
typeof(StackerProto.Gfx),
|
||||
typeof(ThicknessTilesI),
|
||||
typeof(IEnumerable<Tag>),
|
||||
})]
|
||||
static void dumpDelayMultiplier(StackerProto __instance) {
|
||||
Duration newDelay =
|
||||
new Duration(Math.Max((int)(__instance.DumpDelay.Ticks * Main.dumpDelayMultiplier.Value), 1));
|
||||
Traverse.Create(__instance).Field("DumpDelay").SetValue(newDelay);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(TransportProto), MethodType.Constructor, new[] {
|
||||
typeof(StaticEntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(ThicknessTilesF),
|
||||
typeof(Quantity),
|
||||
typeof(RelTile1f),
|
||||
typeof(RelTile1f),
|
||||
typeof(RelTile1i),
|
||||
typeof(bool),
|
||||
typeof(bool),
|
||||
typeof(Option<TerrainTileSurfaceProto>),
|
||||
typeof(RelTile1i),
|
||||
typeof(IoPortShapeProto),
|
||||
typeof(Electricity),
|
||||
typeof(Percent),
|
||||
typeof(bool),
|
||||
typeof(bool),
|
||||
typeof(EntityCosts),
|
||||
typeof(RelTile1i),
|
||||
typeof(Duration),
|
||||
typeof(Option<TransportProto>),
|
||||
typeof(VirtualProductProto),
|
||||
typeof(Quantity),
|
||||
typeof(TransportProto.Gfx),
|
||||
})]
|
||||
static void transportSpeedMultiplier(ref StaticEntityProto.ID id, ref Proto.Str strings,
|
||||
ref ThicknessTilesF surfaceRelativeHeight, ref Quantity maxQuantityPerTransportedProduct,
|
||||
ref RelTile1f transportedProductsSpacing, ref RelTile1f speedPerTick, ref RelTile1i zStepLength,
|
||||
ref bool needsPillarsAtGround, ref bool canBeBuried,
|
||||
ref Option<TerrainTileSurfaceProto> tileSurfaceWhenOnGround, ref RelTile1i maxPillarSupportRadius,
|
||||
ref IoPortShapeProto portsShape, ref Electricity baseElectricityCost, ref Percent cornersSharpnessPercent,
|
||||
ref bool allowMixedProducts, ref bool isBuildable, ref EntityCosts costs, ref RelTile1i lengthPerCost,
|
||||
ref Duration constructionDurationPerProduct, ref Option<TransportProto> nextTier,
|
||||
ref VirtualProductProto maintenanceProduct, Quantity maintenancePerTile, ref TransportProto.Gfx graphics) {
|
||||
if (TransportPillarProto.MAX_PILLAR_HEIGHT.Value < 25)
|
||||
typeof(TransportPillarProto).GetField("MAX_PILLAR_HEIGHT").SetValue(null, new ThicknessTilesI(25));
|
||||
if (IoPort.MAX_TRANSFER_PER_TICK.Value < 10000)
|
||||
typeof(IoPort).GetField("MAX_TRANSFER_PER_TICK").SetValue(null, new Quantity(10000));
|
||||
|
||||
maxQuantityPerTransportedProduct *= 1000;
|
||||
maxQuantityPerTransportedProduct = maxQuantityPerTransportedProduct.Min(new Quantity(10000));
|
||||
Console.WriteLine("maxQuantityPerTransportedProduct {0}", maxQuantityPerTransportedProduct);
|
||||
|
||||
speedPerTick *= 10;
|
||||
transportedProductsSpacing = speedPerTick;
|
||||
zStepLength = RelTile1i.One;
|
||||
canBeBuried = true;
|
||||
maxPillarSupportRadius = new RelTile1i(8);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ShipyardProto), MethodType.Constructor, new[] {
|
||||
typeof(StaticEntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(EntityLayout),
|
||||
typeof(EntityCosts),
|
||||
typeof(bool),
|
||||
typeof(Quantity),
|
||||
typeof(Option<ShipyardProto>),
|
||||
typeof(ImmutableArray<ImmutableArray<RectangleTerrainArea2iRelative>>),
|
||||
typeof(StackerProto.Gfx),
|
||||
typeof(ImmutableArray<String>),
|
||||
typeof(bool),
|
||||
})]
|
||||
static void shipyardCargoMultiplier(ShipyardProto __instance) {
|
||||
Traverse.Create(__instance).Field("CargoCapacity").SetValue(new Quantity(
|
||||
(int)(__instance.CargoCapacity.Value * Main.shipyardCargoMultiplier.Value)));
|
||||
}
|
||||
}
|
||||
}
|
107
Projects/CaptainOfIndustry/CykaOfIndustry/Class1.cs
Normal file
107
Projects/CaptainOfIndustry/CykaOfIndustry/Class1.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using System.Linq;
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using HarmonyLib.Tools;
|
||||
|
||||
// TODO: Make shield and repair bigger
|
||||
// TODO: Maybe make props faster, thrusters work fine
|
||||
namespace CykaOfIndustry {
|
||||
[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<int> excavatorCapacityMultiplier;
|
||||
public static ConfigEntry<float> excavatorMineTileIterationsMultiplier;
|
||||
public static ConfigEntry<int> truckCapacityMultiplier;
|
||||
public static ConfigEntry<int> cargoShipCapacityMultiplier;
|
||||
public static ConfigEntry<float> excavatorMiningCapacityMultiplier;
|
||||
public static ConfigEntry<int> excavatorMiningAreaMultiplier;
|
||||
public static ConfigEntry<float> excavatorMinReachMultiplier;
|
||||
public static ConfigEntry<float> excavatorMaxReachMultiplier;
|
||||
public static ConfigEntry<float> bufferCapacityMultiplier;
|
||||
public static ConfigEntry<float> unityGenerationMultiplier;
|
||||
public static ConfigEntry<float> depotTransferSpeedMultiplier;
|
||||
public static ConfigEntry<float> worldMineSpeedMultiplier;
|
||||
public static ConfigEntry<float> housingCapacityMultiplier;
|
||||
public static ConfigEntry<float> dumpDelayMultiplier;
|
||||
public static ConfigEntry<float> transportSpeedMultiplier;
|
||||
public static ConfigEntry<float> shipyardCargoMultiplier;
|
||||
public static ConfigEntry<int> autosaveInterval;
|
||||
|
||||
public static ConfigEntry<bool> debugMode;
|
||||
|
||||
public void Awake() {
|
||||
excavatorCapacityMultiplier = Config.Bind("General", "Excavator Capacity Multiplier", 1,
|
||||
new ConfigDescription("Excavator Capacity Multiplier"));
|
||||
excavatorMineTileIterationsMultiplier = Config.Bind("General", "Excavator Mine Tile Iterations Multiplier",
|
||||
1f,
|
||||
new ConfigDescription("Excavator Mine Tile Iterations Multiplier"));
|
||||
truckCapacityMultiplier = Config.Bind("General", "Truck Capacity Multiplier", 1,
|
||||
new ConfigDescription("Truck Capacity Multiplier"));
|
||||
cargoShipCapacityMultiplier = Config.Bind("General", "Cargo Ship Capacity Multiplier", 1,
|
||||
new ConfigDescription("Cargo Ship Capacity Multiplier"));
|
||||
excavatorMiningAreaMultiplier = Config.Bind("General", "Excavator Mining Area Multiplier", 1,
|
||||
new ConfigDescription("Excavator Mining Area Multiplier"));
|
||||
excavatorMiningCapacityMultiplier = Config.Bind("General", "Excavator Mining Capacity Multiplier", 1f,
|
||||
new ConfigDescription("Excavator Mining Capacity Multiplier"));
|
||||
excavatorMinReachMultiplier = Config.Bind("General", "Excavator Min Reach Multiplier", 1f,
|
||||
new ConfigDescription("Excavator Min Reach Multiplier"));
|
||||
excavatorMaxReachMultiplier = Config.Bind("General", "Excavator Max Reach Multiplier", 1f,
|
||||
new ConfigDescription("Excavator Max Reach Multiplier"));
|
||||
bufferCapacityMultiplier = Config.Bind("General", "Buffer Capacity Multiplier", 1f,
|
||||
new ConfigDescription("Buffer Capacity Multiplier"));
|
||||
storageCapacityMultiplier = Config.Bind("General", "Storage Capacity Multiplier", 1f,
|
||||
new ConfigDescription("Storage Capacity Multiplier"));
|
||||
unityGenerationMultiplier = Config.Bind("General", "Unity Generation Multiplier", 1f,
|
||||
new ConfigDescription("Unity Generation Multiplier"));
|
||||
depotTransferSpeedMultiplier = Config.Bind("General", "Depot Transfer Speed Multiplier", 1f,
|
||||
new ConfigDescription("Depot Transfer Speed Multiplier"));
|
||||
worldMineSpeedMultiplier = Config.Bind("General", "World Mine Speed Multiplier", 1f,
|
||||
new ConfigDescription("World Mine Speed Multiplier"));
|
||||
housingCapacityMultiplier = Config.Bind("General", "Housing Capacity Multiplier", 1f,
|
||||
new ConfigDescription("Housing Capacity Multiplier"));
|
||||
dumpDelayMultiplier = Config.Bind("General", "Dump Delay Multiplier", 1f,
|
||||
new ConfigDescription("Dump Delay Multiplier"));
|
||||
transportSpeedMultiplier = Config.Bind("General", "Transport Speed Multiplier", 1f,
|
||||
new ConfigDescription("Transport Speed Multiplier"));
|
||||
shipyardCargoMultiplier = Config.Bind("General", "Shipyard Cargo Multiplier", 1f,
|
||||
new ConfigDescription("Shipyard Cargo Multiplier"));
|
||||
autosaveInterval = Config.Bind("General", "Autosave Interval", 1,
|
||||
new ConfigDescription("Autosave Interval in minutes"));
|
||||
|
||||
debugMode = Config.Bind("General", "Debug Mode", false, new ConfigDescription("Debug Mode"));
|
||||
|
||||
// shootingSpeedMultiplier.SettingChanged += (sender, args) => WeaponPropertiesManager.DoPatch();
|
||||
// energyGenMultiplier.SettingChanged += (sender, args) => GeneratorPropertiesManager.DoPatch();
|
||||
// magnetStrenghtMultiplier.SettingChanged += (sender, args) => MagnetPropertiesManager.DoPatch();
|
||||
// magnetRadiusMultiplier.SettingChanged += (sender, args) => MagnetPropertiesManager.DoPatch();
|
||||
// beamStrenghtMultiplier.SettingChanged += (sender, args) => BeamPropertiesManager.DoPatch();
|
||||
// beamRadiusMultiplier.SettingChanged += (sender, args) => BeamPropertiesManager.DoPatch();
|
||||
// fuelTankRefillMultiplier.SettingChanged += (sender, args) => FuelPropertiesManager.DoPatch();
|
||||
// fuelTankCapacityMultiplier.SettingChanged += (sender, args) => FuelPropertiesManager.DoPatch();
|
||||
// wheelTorqueMultiplier.SettingChanged += (sender, args) => WheelPropertiesManager.DoPatch();
|
||||
// wheelSpeedMultiplier.SettingChanged += (sender, args) => WheelPropertiesManager.DoPatch();
|
||||
// jetThrustMultiplier.SettingChanged += (sender, args) => ThrusterPropertiesManager.DoPatch();
|
||||
// minerGroundArea.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch();
|
||||
// minerMiningSpeed.SettingChanged += (sender, args) => MinerPropertiesManager.DoPatch();
|
||||
// wirelessChargingPowerPerArcMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch();
|
||||
// wirelessChargingArcFiringIntervalMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch();
|
||||
// wirelessChargingRadiusMultiplier.SettingChanged += (sender, args) => WirelessChargerPropertiesManager.DoPatch();
|
||||
|
||||
Logger.LogInfo("Cyka mod loaded");
|
||||
HarmonyFileLog.Enabled = true;
|
||||
Harmony harmony = new Harmony(pluginGuid);
|
||||
harmony.PatchAll();
|
||||
var originalMethods = harmony.GetPatchedMethods();
|
||||
Logger.LogInfo("Patched " + originalMethods.Count() + " methods");
|
||||
foreach (var method in originalMethods) {
|
||||
Logger.LogInfo("Patched " + method.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public static ConfigEntry<float> storageCapacityMultiplier;
|
||||
}
|
||||
}
|
@@ -0,0 +1,63 @@
|
||||
<?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>
|
||||
<GAME_DIR>C:/Program Files (x86)/Steam/steamapps/common/Captain of Industry</GAME_DIR>
|
||||
<GAME_MANAGED>$(GAME_DIR)/Captain of Industry_Data/Managed</GAME_MANAGED>
|
||||
<GAME_BEPINEX>$(GAME_DIR)/BepInEx</GAME_BEPINEX>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CykaOfIndustry</RootNamespace>
|
||||
<AssemblyName>CykaOfIndustry</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>
|
||||
<Compile Include="Class1.cs" />
|
||||
<Compile Include="Patches.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>$(GAME_BEPINEX)/core/0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>$(GAME_BEPINEX)/core/BepInEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>$(GAME_MANAGED)/UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>$(GAME_MANAGED)/UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mafi">
|
||||
<HintPath>$(GAME_MANAGED)/Mafi.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mafi.Core">
|
||||
<HintPath>$(GAME_MANAGED)/Mafi.Core.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
||||
</Project>
|
@@ -1,6 +1,6 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptainOfIndustry", "CaptainOfIndustry\CaptainOfIndustry.csproj", "{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CykaOfIndustry", "CykaOfIndustry.csproj", "{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
@@ -0,0 +1,3 @@
|
||||
<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_005CProgram_0020Files_0020_0028x86_0029_005CSteam_005Csteamapps_005Ccommon_005CCaptain_0020of_0020Industry_005CCaptain_0020of_0020Industry_005FData_005CManaged_005CUnityEngine_002ECoreModule_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CProgram_0020Files_0020_0028x86_0029_005CSteam_005Csteamapps_005Ccommon_005CCaptain_0020of_0020Industry_005CCaptain_0020of_0020Industry_005FData_005CManaged_005CUnityEngine_002Edll/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
600
Projects/CaptainOfIndustry/CykaOfIndustry/Patches.cs
Normal file
600
Projects/CaptainOfIndustry/CykaOfIndustry/Patches.cs
Normal file
@@ -0,0 +1,600 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using HarmonyLib;
|
||||
using Mafi;
|
||||
using Mafi.Collections.ImmutableCollections;
|
||||
using Mafi.Core;
|
||||
using Mafi.Core.Buildings.Cargo.Modules;
|
||||
using Mafi.Core.Buildings.Cargo.Ships.Modules;
|
||||
using Mafi.Core.Buildings.Settlements;
|
||||
using Mafi.Core.Buildings.Shipyard;
|
||||
using Mafi.Core.Buildings.Storages;
|
||||
using Mafi.Core.Entities;
|
||||
using Mafi.Core.Entities.Dynamic;
|
||||
using Mafi.Core.Entities.Static;
|
||||
using Mafi.Core.Entities.Static.Layout;
|
||||
using Mafi.Core.Factory.Machines;
|
||||
using Mafi.Core.Factory.Transports;
|
||||
using Mafi.Core.Population;
|
||||
using Mafi.Core.Ports.Io;
|
||||
using Mafi.Core.Products;
|
||||
using Mafi.Core.Prototypes;
|
||||
using Mafi.Core.SaveGame;
|
||||
using Mafi.Core.Terrain;
|
||||
using Mafi.Core.Vehicles.Excavators;
|
||||
using Mafi.Core.World.Entities;
|
||||
|
||||
namespace CykaOfIndustry {
|
||||
[HarmonyPatch]
|
||||
public class Patches {
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ExcavatorProtoBuilder.ExcavatorProtoBuilderState), "SetCapacity")]
|
||||
static void excavatorCapacityMultiplier(ref int quantity) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Old excavator capacity {0}", quantity);
|
||||
quantity *= Main.excavatorCapacityMultiplier.Value;
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: New excavator capacity {0}", quantity);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ExcavatorProtoBuilder.ExcavatorProtoBuilderState), "SetMinedThicknessByDistanceMeters")]
|
||||
static void excavatorMiningAreaMultiplier(ref float[] thicknessMeters) {
|
||||
for (int i = 0; i < thicknessMeters.Length; i++) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Old mining area {0}", thicknessMeters[i]);
|
||||
thicknessMeters[i] *= Main.excavatorMiningCapacityMultiplier.Value;
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: New mining area {0}", thicknessMeters[i]);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ExcavatorProtoBuilder.ExcavatorProtoBuilderState), "SetMaxMiningDistance")]
|
||||
static void excavatorReachMultiplier(ref RelTile1i minMiningDistance, ref RelTile1i maxMiningDistance) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Old min mining distance {0}, max mining distance {1}",
|
||||
minMiningDistance, maxMiningDistance);
|
||||
minMiningDistance = new RelTile1i((int)(minMiningDistance.Value * Main.excavatorMinReachMultiplier.Value));
|
||||
maxMiningDistance = new RelTile1i((int)(maxMiningDistance.Value * Main.excavatorMaxReachMultiplier.Value));
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: New min mining distance {0}, max mining distance {1}",
|
||||
minMiningDistance, maxMiningDistance);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(TruckProtoBuilder.TruckProtoBuilderState), "SetCapacity")]
|
||||
static void truckCapacityMultiplier(ref int quantity) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Old truck capacity {0}", quantity);
|
||||
quantity *= Main.truckCapacityMultiplier.Value;
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: New truck capacity {0}", quantity);
|
||||
}
|
||||
|
||||
// [HarmonyPrefix]
|
||||
// [HarmonyPatch(typeof(StorageProtoBuilder.State), "SetCapacity")]
|
||||
// static void storageCapacityMultiplier(ref int capacity) {
|
||||
// // Console.WriteLine("IndustrialCyka: Old storage capacity: {0}", capacity);
|
||||
// capacity = (int)(capacity * Main.storageCapacityMultiplier.Value);
|
||||
// // Console.WriteLine("IndustrialCyka: New storage capacity: {0}", capacity);
|
||||
// }
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(CargoShipModuleProto), MethodType.Constructor,
|
||||
new[] {
|
||||
typeof(Proto.ID), typeof(Proto.Str), typeof(ProductType), typeof(Quantity),
|
||||
typeof(CargoShipModuleProto.Gfx)
|
||||
})]
|
||||
static void cargoShipCapacityMultiplier(CargoShipModuleProto __instance) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Old ship capacity {0}", __instance.Capacity);
|
||||
__instance.Capacity = new Quantity(__instance.Capacity.Value * Main.cargoShipCapacityMultiplier.Value);
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: New ship capacity {0}", __instance.Capacity);
|
||||
}
|
||||
|
||||
// No workey... idk how it's supposed to work, speed is always 1 or 100%
|
||||
// [HarmonyPrefix]
|
||||
// [HarmonyPatch(typeof(DrivingEntity), "SetSpeedFactor")]
|
||||
// static void vehicleSpeedMultiplier(ref Percent speedFactor) {
|
||||
// // Console.WriteLine("IndustrialCyka: Old speed: {0}", speedFactor.ToString());
|
||||
// // typeof(Percent)
|
||||
// // .GetField("RawValue",BindingFlags.Instance|BindingFlags.NonPublic)
|
||||
// // .SetValue(speedFactor,speedFactor.ToFloat() / Main.vehicleSpeedMultiplier.Value);
|
||||
// Percent newSpeedFactor = Percent.FromFloat(speedFactor.ToFloat() / Main.vehicleSpeedMultiplier.Value);
|
||||
// speedFactor = newSpeedFactor;
|
||||
// // Console.WriteLine("IndustrialCyka: New speed: {1}", newSpeedFactor.RawValue.ToString());
|
||||
// }
|
||||
|
||||
// [HarmonyPostfix]
|
||||
// [HarmonyPatch(typeof(SmoothDriver), "SetSpeedFactor")]
|
||||
// static void vehicleSpeedMultiplier(SmoothDriver __instance) {
|
||||
// Fix32 speedMulti = Fix32.FromFloat(Main.vehicleSpeedMultiplier.Value);
|
||||
//
|
||||
// Traverse traverse = Traverse.Create(__instance);
|
||||
// Traverse maxForwardsSpeedField = traverse.Field("m_maxForwardsSpeed");
|
||||
// Traverse maxBackwardsSpeedField = traverse.Field("m_maxBackwardsSpeed");
|
||||
// Traverse maxAccelerationField = traverse.Field("m_maxAcceleration");
|
||||
//
|
||||
// // Console.WriteLine("IndustrialCyka: Old speeds: (F) {0}, (B) {1}, (A) {2}", maxForwardsSpeedField.GetValue(),
|
||||
// // maxBackwardsSpeedField.GetValue(), maxAccelerationField.GetValue());
|
||||
//
|
||||
// maxForwardsSpeedField.SetValue((Fix32)maxForwardsSpeedField.GetValue() * speedMulti);
|
||||
// maxBackwardsSpeedField.SetValue((Fix32)maxBackwardsSpeedField.GetValue() * speedMulti);
|
||||
// maxAccelerationField.SetValue((Fix32)maxAccelerationField.GetValue() * speedMulti);
|
||||
//
|
||||
// // Console.WriteLine("IndustrialCyka: New speeds: (F) {0}, (B) {1}, (A) {2}", maxForwardsSpeedField.GetValue(),
|
||||
// // maxBackwardsSpeedField.GetValue(), maxAccelerationField.GetValue());
|
||||
// }
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(StorageBaseProto), MethodType.Constructor,
|
||||
new[] {
|
||||
typeof(StaticEntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(EntityLayout),
|
||||
typeof(Quantity),
|
||||
typeof(EntityCosts),
|
||||
typeof(LayoutEntityProto.Gfx),
|
||||
typeof(Quantity),
|
||||
typeof(Duration),
|
||||
typeof(IEnumerable<Tag>)
|
||||
})]
|
||||
static void storageCapacityMultiplier(StorageProto __instance) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Old storage capacity {0}", __instance.Capacity);
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Old storage transfer limit {0}", __instance.TransferLimit);
|
||||
Traverse traverse = Traverse.Create(__instance);
|
||||
|
||||
traverse.Field("Capacity")
|
||||
.SetValue(new Quantity((int)(__instance.Capacity.Value * Main.storageCapacityMultiplier.Value)));
|
||||
traverse.Field("TransferLimit").SetValue(new Quantity(10000));
|
||||
traverse.Field("TransferLimitDuration").SetValue(Duration.FromTicks(1));
|
||||
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: New storage capacity {0}", __instance.Capacity);
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: New storage transfer limit {0}", __instance.TransferLimit);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(UpointsManager), "GenerateUnity")]
|
||||
static void unityGenerationMultiplier(Proto.ID categoryId, ref Upoints generated) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Old generated {0} unity", generated.Value);
|
||||
Fix32 multi = Fix32.FromFloat(Main.unityGenerationMultiplier.Value);
|
||||
generated = new Upoints(generated.Value * multi);
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: New generated {0} unity", generated.Value);
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(Machine), "updateWorkOnRecipes")]
|
||||
static IEnumerable<CodeInstruction> unityBooster(IEnumerable<CodeInstruction> instructions) {
|
||||
Dictionary<int, OpCode> matchTable = new Dictionary<int, OpCode>();
|
||||
matchTable[0] = OpCodes.Ldsfld;
|
||||
matchTable[1] = OpCodes.Br;
|
||||
matchTable[2] = OpCodes.Ldc_I4_2;
|
||||
int matches = 0;
|
||||
int totalMatch = matchTable.Count;
|
||||
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
for (int i = 0; i < codes.Count; i++) {
|
||||
if (matches >= totalMatch) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (codes[i].opcode.Equals(matchTable[matches])) {
|
||||
if (matches == totalMatch - 1) {
|
||||
codes[i].opcode = OpCodes.Ldc_I4_6;
|
||||
}
|
||||
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
|
||||
// for (int i = 0; i < codes.Count; i++) {
|
||||
// Console.WriteLine(codes[i].ToString());
|
||||
// }
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
|
||||
// Could not make this work either... idk why... Doesn't make sense...
|
||||
// [HarmonyPostfix]
|
||||
// [HarmonyPatch(typeof(SimpleVirtualResource), "MineResourceAt")]
|
||||
// static void infiniteGroundResources(SimpleVirtualResource __instance) {
|
||||
// // Console.WriteLine("IndustrialCyka: Patching ground resources (Capacity)");
|
||||
// Traverse traverse = Traverse.Create(__instance);
|
||||
// Traverse capacityField = traverse.Field("Capacity");
|
||||
// capacityField.SetValue(1000000000);
|
||||
// Traverse quantityField = traverse.Field("Quantity");
|
||||
// quantityField.SetValue(1000000000);
|
||||
// }
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ProductBuffer), "ForceNewCapacityTo")]
|
||||
static void bufferCapacityMultiplier(ref Quantity newCapacity) {
|
||||
if (newCapacity.Value <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Old buffer capacity {0}", newCapacity);
|
||||
Quantity newNewCapacity = new Quantity((int)(newCapacity.Value * Main.bufferCapacityMultiplier.Value));
|
||||
newCapacity = newNewCapacity;
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: New buffer capacity {0}", newCapacity);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(CargoDepotModuleProto), MethodType.Constructor,
|
||||
new[] {
|
||||
typeof(CargoDepotModuleProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(EntityLayout),
|
||||
typeof(ProductType),
|
||||
typeof(Option<CargoDepotModuleProto>),
|
||||
typeof(Quantity),
|
||||
typeof(Quantity),
|
||||
typeof(Duration),
|
||||
typeof(Electricity),
|
||||
typeof(bool),
|
||||
typeof(Percent),
|
||||
typeof(EntityCosts),
|
||||
typeof(CargoDepotModuleProto.Gfx),
|
||||
typeof(IEnumerable<Tag>),
|
||||
})]
|
||||
static void depotTransferSpeedMultiplier(CargoDepotModuleProto __instance) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Old depot transfer speed {0}", __instance.QuantityPerExchange);
|
||||
Traverse traverse = Traverse.Create(__instance);
|
||||
|
||||
traverse.Field("QuantityPerExchange")
|
||||
.SetValue(new Quantity((int)(__instance.QuantityPerExchange.Value *
|
||||
Main.depotTransferSpeedMultiplier.Value)));
|
||||
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: New depot transfer speed {0}", __instance.QuantityPerExchange);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(WorldMapMineProto), MethodType.Constructor,
|
||||
new[] {
|
||||
typeof(EntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(ProductQuantity),
|
||||
typeof(Duration),
|
||||
typeof(Upoints),
|
||||
typeof(UpointsCategoryProto),
|
||||
typeof(EntityCosts),
|
||||
typeof(Func<int, EntityCosts>),
|
||||
typeof(int),
|
||||
typeof(Quantity),
|
||||
typeof(WorldMapEntityProto.Gfx),
|
||||
typeof(int),
|
||||
typeof(int),
|
||||
typeof(IEnumerable<Tag>),
|
||||
})]
|
||||
static void worldMineSpeedMultiplier(WorldMapMineProto __instance) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Old world mine speed {0}",
|
||||
__instance.ProducedProductPerStep.Quantity);
|
||||
ProductQuantity newProductQuantity = new ProductQuantity(__instance.ProducedProductPerStep.Product,
|
||||
new Quantity((int)(__instance.ProducedProductPerStep.Quantity.Value *
|
||||
Main.worldMineSpeedMultiplier.Value)));
|
||||
|
||||
Traverse.Create(__instance)
|
||||
.Field("ProducedProductPerStep")
|
||||
.SetValue(newProductQuantity);
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: New world mine speed {0}",
|
||||
__instance.ProducedProductPerStep.Quantity);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(WorldMapMineProto), MethodType.Constructor,
|
||||
new[] {
|
||||
typeof(EntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(ProductQuantity),
|
||||
typeof(Duration),
|
||||
typeof(Upoints),
|
||||
typeof(UpointsCategoryProto),
|
||||
typeof(EntityCosts),
|
||||
typeof(Func<int, EntityCosts>),
|
||||
typeof(int),
|
||||
typeof(Quantity),
|
||||
typeof(WorldMapEntityProto.Gfx),
|
||||
typeof(int),
|
||||
typeof(int),
|
||||
typeof(IEnumerable<Tag>),
|
||||
})]
|
||||
static void worldMineLevelIncrementMultiplier(WorldMapMineProto __instance) {
|
||||
Traverse traverse = Traverse.Create(__instance);
|
||||
|
||||
// int level = traverse.Field("Level").GetValue<int>();
|
||||
int maxLevel = traverse.Field("MaxLevel").GetValue<int>();
|
||||
// int levelsPerUpgrade = traverse.Field("LevelsPerUpgrade").GetValue<int>();
|
||||
|
||||
int newLevelsPerUpgrade = 10;
|
||||
int newMaxLevel = (int)Math.Ceiling((double)maxLevel / newLevelsPerUpgrade) * newLevelsPerUpgrade;
|
||||
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Old max level {0}, new max level {1}", maxLevel, newMaxLevel);
|
||||
traverse.Field("MaxLevel").SetValue(newMaxLevel);
|
||||
traverse.Field("LevelsPerUpgrade").SetValue(newLevelsPerUpgrade);
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(WorldMapMineProto), MethodType.Constructor,
|
||||
new[] {
|
||||
typeof(EntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(ProductQuantity),
|
||||
typeof(Duration),
|
||||
typeof(Upoints),
|
||||
typeof(UpointsCategoryProto),
|
||||
typeof(EntityCosts),
|
||||
typeof(Func<int, EntityCosts>),
|
||||
typeof(int),
|
||||
typeof(Quantity),
|
||||
typeof(WorldMapEntityProto.Gfx),
|
||||
typeof(int),
|
||||
typeof(int),
|
||||
typeof(IEnumerable<Tag>),
|
||||
})]
|
||||
static IEnumerable<CodeInstruction> cookWorldMineLevelIncrementMultiplier(
|
||||
IEnumerable<CodeInstruction> instructions) {
|
||||
Dictionary<int, OpCode> matchTable = new Dictionary<int, OpCode>();
|
||||
matchTable[0] = OpCodes.Rem;
|
||||
matchTable[1] = OpCodes.Ldfld;
|
||||
matchTable[2] = OpCodes.Ldarg_0;
|
||||
matchTable[3] = OpCodes.Ldfld;
|
||||
matchTable[4] = OpCodes.Ldarg_0;
|
||||
int matches = 0;
|
||||
int totalMatch = matchTable.Count;
|
||||
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
for (int i = codes.Count - 1; i >= 0; i--) {
|
||||
if (matches >= totalMatch) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (codes[i].opcode.Equals(matchTable[matches])) {
|
||||
if (matches == totalMatch - 1) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Patching world mine level increment");
|
||||
codes[i + 4].opcode = OpCodes.Add;
|
||||
codes[i + 5].opcode = OpCodes.Brtrue_S;
|
||||
break;
|
||||
}
|
||||
|
||||
matches++;
|
||||
}
|
||||
else {
|
||||
matches = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(SettlementHousingModuleProto), MethodType.Constructor, new[] {
|
||||
typeof(StaticEntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(EntityLayout),
|
||||
typeof(EntityCosts),
|
||||
typeof(int),
|
||||
typeof(Upoints),
|
||||
typeof(ImmutableArray<KeyValuePair<ImmutableArray<PopNeedProto>, Percent>>),
|
||||
typeof(IReadOnlyDictionary<PopNeedProto, Percent>),
|
||||
typeof(Option<SettlementHousingModuleProto>),
|
||||
typeof(SettlementHousingModuleProto.Gfx),
|
||||
})]
|
||||
static void housingCapacityMultiplier(SettlementHousingModuleProto __instance) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Old housing capacity {0}", __instance.Capacity);
|
||||
Traverse.Create(__instance).Field<int>("Capacity").Value =
|
||||
(int)(__instance.Capacity * Main.housingCapacityMultiplier.Value);
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: New housing capacity {0}", __instance.Capacity);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(StackerProto), MethodType.Constructor, new[] {
|
||||
typeof(StaticEntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(EntityLayout),
|
||||
typeof(EntityCosts),
|
||||
typeof(Electricity),
|
||||
typeof(ThicknessTilesI),
|
||||
typeof(RelTile3i),
|
||||
typeof(Duration),
|
||||
typeof(Duration),
|
||||
typeof(StackerProto.Gfx),
|
||||
typeof(ThicknessTilesI),
|
||||
typeof(IEnumerable<Tag>),
|
||||
})]
|
||||
static void dumpDelayMultiplier(StackerProto __instance) {
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Old dumpDelay {0}", __instance.DumpDelay);
|
||||
Duration newDelay =
|
||||
new Duration(Math.Max((int)(__instance.DumpDelay.Ticks * Main.dumpDelayMultiplier.Value), 1));
|
||||
Traverse.Create(__instance).Field("DumpDelay").SetValue(newDelay);
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: New dumpDelay {0}", __instance.DumpDelay);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(TransportProto), MethodType.Constructor, new[] {
|
||||
typeof(StaticEntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(ThicknessTilesF),
|
||||
typeof(Quantity),
|
||||
typeof(RelTile1f),
|
||||
typeof(RelTile1f),
|
||||
typeof(RelTile1i),
|
||||
typeof(bool),
|
||||
typeof(bool),
|
||||
typeof(Option<TerrainTileSurfaceProto>),
|
||||
typeof(RelTile1i),
|
||||
typeof(IoPortShapeProto),
|
||||
typeof(Electricity),
|
||||
typeof(Percent),
|
||||
typeof(bool),
|
||||
typeof(bool),
|
||||
typeof(EntityCosts),
|
||||
typeof(RelTile1i),
|
||||
typeof(Duration),
|
||||
typeof(Option<TransportProto>),
|
||||
typeof(VirtualProductProto),
|
||||
typeof(Quantity),
|
||||
typeof(TransportProto.Gfx),
|
||||
})]
|
||||
static void transportSpeedMultiplier(ref StaticEntityProto.ID id, ref Proto.Str strings,
|
||||
ref ThicknessTilesF surfaceRelativeHeight, ref Quantity maxQuantityPerTransportedProduct,
|
||||
ref RelTile1f transportedProductsSpacing, ref RelTile1f speedPerTick, ref RelTile1i zStepLength,
|
||||
ref bool needsPillarsAtGround, ref bool canBeBuried,
|
||||
ref Option<TerrainTileSurfaceProto> tileSurfaceWhenOnGround, ref RelTile1i maxPillarSupportRadius,
|
||||
ref IoPortShapeProto portsShape, ref Electricity baseElectricityCost, ref Percent cornersSharpnessPercent,
|
||||
ref bool allowMixedProducts, ref bool isBuildable, ref EntityCosts costs, ref RelTile1i lengthPerCost,
|
||||
ref Duration constructionDurationPerProduct, ref Option<TransportProto> nextTier,
|
||||
ref VirtualProductProto maintenanceProduct, Quantity maintenancePerTile, ref TransportProto.Gfx graphics) {
|
||||
if (TransportPillarProto.MAX_PILLAR_HEIGHT.Value < 25)
|
||||
typeof(TransportPillarProto).GetField("MAX_PILLAR_HEIGHT").SetValue(null, new ThicknessTilesI(25));
|
||||
if (IoPort.MAX_TRANSFER_PER_TICK.Value < 10000)
|
||||
typeof(IoPort).GetField("MAX_TRANSFER_PER_TICK").SetValue(null, new Quantity(10000));
|
||||
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Old maxQuantityPerTransportedProduct {0}",
|
||||
maxQuantityPerTransportedProduct);
|
||||
maxQuantityPerTransportedProduct *= 1000;
|
||||
maxQuantityPerTransportedProduct = maxQuantityPerTransportedProduct.Min(new Quantity(10000));
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: New maxQuantityPerTransportedProduct {0}",
|
||||
maxQuantityPerTransportedProduct);
|
||||
|
||||
speedPerTick *= 10;
|
||||
transportedProductsSpacing = speedPerTick;
|
||||
zStepLength = RelTile1i.One;
|
||||
canBeBuried = true;
|
||||
maxPillarSupportRadius = new RelTile1i(8);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ShipyardProto), MethodType.Constructor, new[] {
|
||||
typeof(StaticEntityProto.ID),
|
||||
typeof(Proto.Str),
|
||||
typeof(EntityLayout),
|
||||
typeof(EntityCosts),
|
||||
typeof(bool),
|
||||
typeof(Quantity),
|
||||
typeof(Option<ShipyardProto>),
|
||||
typeof(ImmutableArray<ImmutableArray<RectangleTerrainArea2iRelative>>),
|
||||
typeof(StackerProto.Gfx),
|
||||
typeof(ImmutableArray<String>),
|
||||
typeof(bool),
|
||||
})]
|
||||
static void shipyardCargoMultiplier(ShipyardProto __instance) {
|
||||
Traverse.Create(__instance).Field("CargoCapacity").SetValue(new Quantity(
|
||||
(int)(__instance.CargoCapacity.Value * Main.shipyardCargoMultiplier.Value)));
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(SaveManager), "isTimeForAutoSave")]
|
||||
static void autosaveInterval(ref bool __result, SaveManager __instance) {
|
||||
if (Main.autosaveInterval.Value <= 0) {
|
||||
__result = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var trav = Traverse.Create(__instance);
|
||||
var lastSaveTime = trav.Field("m_lastSaveTime").GetValue<long>();
|
||||
var num = (Environment.TickCount - lastSaveTime).Abs() / 1000L;
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Autosave interval: {0}", num);
|
||||
__result = num > Main.autosaveInterval.Value;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Excavator), "MineMixedAt")]
|
||||
public class MineMixedAtPatch {
|
||||
public static Dictionary<ExcavatorProto, Quantity>
|
||||
originalCapacity = new Dictionary<ExcavatorProto, Quantity>();
|
||||
|
||||
public static Dictionary<ExcavatorProto, ImmutableArray<ThicknessTilesF>> originalMinedThicknessByDistance =
|
||||
new Dictionary<ExcavatorProto, ImmutableArray<ThicknessTilesF>>();
|
||||
|
||||
public static Dictionary<ExcavatorProto.Timings, int> originalMineTileIterations =
|
||||
new Dictionary<ExcavatorProto.Timings, int>();
|
||||
|
||||
public static Dictionary<ExcavatorProto, RelTile1i> originalMaxMiningDistance =
|
||||
new Dictionary<ExcavatorProto, RelTile1i>();
|
||||
|
||||
static void Prefix(ref Excavator __instance) {
|
||||
if (!originalCapacity.ContainsKey(__instance.Prototype)) {
|
||||
originalCapacity.Add(__instance.Prototype, __instance.Prototype.Capacity);
|
||||
}
|
||||
|
||||
var trav = Traverse.Create(__instance.Prototype);
|
||||
trav.Field("Capacity")
|
||||
.SetValue(new Quantity(originalCapacity[__instance.Prototype].Value *
|
||||
Main.excavatorCapacityMultiplier.Value));
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Excavator capacity: {0}", __instance.Prototype.Capacity.Value);
|
||||
|
||||
if (!originalMinedThicknessByDistance.ContainsKey(__instance.Prototype)) {
|
||||
originalMinedThicknessByDistance.Add(__instance.Prototype,
|
||||
trav.Field("MinedThicknessByDistance").GetValue<ImmutableArray<ThicknessTilesF>>());
|
||||
}
|
||||
|
||||
trav.Field("MinedThicknessByDistance")
|
||||
.SetValue(originalMinedThicknessByDistance[__instance.Prototype]
|
||||
.SelectMany(t => Enumerable.Repeat(t, Main.excavatorMiningAreaMultiplier.Value))
|
||||
.Select(t =>
|
||||
new ThicknessTilesF((int)(t.Value.ToFloat() * Main.excavatorMiningCapacityMultiplier.Value)))
|
||||
.ToImmutableArray());
|
||||
if (Main.debugMode.Value)
|
||||
originalMinedThicknessByDistance[__instance.Prototype].ForEach(t => Console.WriteLine(t.Value));
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Excavator mined thickness: {0}",
|
||||
__instance.Prototype.MinedThicknessByDistance);
|
||||
|
||||
if (!originalMaxMiningDistance.ContainsKey(__instance.Prototype)) {
|
||||
originalMaxMiningDistance.Add(__instance.Prototype,
|
||||
trav.Field("MaxMiningDistance").GetValue<RelTile1i>());
|
||||
}
|
||||
|
||||
var value = originalMaxMiningDistance[__instance.Prototype];
|
||||
var newValueMiningDistance = new RelTile1i((int)(value.Value * Main.excavatorMaxReachMultiplier.Value));
|
||||
trav.Field("MaxMiningDistance")
|
||||
.SetValue(newValueMiningDistance);
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Excavator max mining distance: {0}",
|
||||
__instance.Prototype.MaxMiningDistance);
|
||||
|
||||
var trav2 = Traverse.Create(__instance.Prototype.MineTimings);
|
||||
if (!originalMineTileIterations.ContainsKey(__instance.Prototype.MineTimings)) {
|
||||
originalMineTileIterations.Add(__instance.Prototype.MineTimings,
|
||||
trav2.Field("MineTileIterations").GetValue<int>());
|
||||
}
|
||||
|
||||
var newValue = (int)(originalMineTileIterations[__instance.Prototype.MineTimings] *
|
||||
Main.excavatorMineTileIterationsMultiplier.Value);
|
||||
trav2.Field("MineTileIterations").SetValue(newValue);
|
||||
trav2.Field("PrepareToMineDuration").SetValue(new Duration(1));
|
||||
trav2.Field("MineDuration").SetValue(new Duration(1));
|
||||
trav2.Field("PrepareToDumpDuration").SetValue(new Duration(1));
|
||||
trav2.Field("DumpDuration").SetValue(new Duration(1));
|
||||
if (Main.debugMode.Value)
|
||||
Console.WriteLine("IndustrialCyka: Excavator mine tile iterations 2: {0}",
|
||||
trav2.Field("MineTileIterations").GetValue<int>());
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,11 +4,11 @@ using System.Runtime.InteropServices;
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CaptainOfIndustry")]
|
||||
[assembly: AssemblyTitle("CykaOfIndustry")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CaptainOfIndustry")]
|
||||
[assembly: AssemblyProduct("CykaOfIndustry")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
1
Projects/CaptainOfIndustry/CykaOfIndustry/sync
Normal file
1
Projects/CaptainOfIndustry/CykaOfIndustry/sync
Normal file
@@ -0,0 +1 @@
|
||||
bin/Release/CykaOfIndustry.dll,"C:\Program Files (x86)\Steam\steamapps\common\Captain of Industry\BepInEx\plugins\CykaOfIndustry.dll"
|
1
Projects/CaptainOfIndustry/DifficultySettingsMod
Submodule
1
Projects/CaptainOfIndustry/DifficultySettingsMod
Submodule
Submodule Projects/CaptainOfIndustry/DifficultySettingsMod added at 6ab4d6bf69
1
Projects/CaptainOfIndustry/DoubleQoLMod
Submodule
1
Projects/CaptainOfIndustry/DoubleQoLMod
Submodule
Submodule Projects/CaptainOfIndustry/DoubleQoLMod added at 99be285f06
@@ -1,11 +0,0 @@
|
||||
<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_005CTerraTech_005Clibs_005C0Harmony_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CAssembly_002DCSharp_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CBepInEx_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CConfigurationManager_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CUnityEngine_002ECoreModule_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=C_003A_005CUsers_005CAdministrator_005CRiderProjects_005CBepinex_005CProjects_005CTerraTech_005Clibs_005CUnityEngine_002Edll/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer /></s:String>
|
||||
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</s:String>
|
||||
<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/BuildTool/MsbuildVersion/@EntryValue">262144</s:Int64>
|
||||
</wpf:ResourceDictionary>
|
@@ -1 +0,0 @@
|
||||
cp CaptainOfIndustry/bin/Release/CaptainOfIndustry.dll bepinex/plugins/CaptainOfIndustry.dll
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
for lib in $(cat libs.txt); do find 'C:\Games\Against.the.Storm.v1.0.2r' -name "$lib" | sed 's|\\|/|g' | xargs -I% -- cp '%' .; done
|
@@ -1,11 +0,0 @@
|
||||
0Harmony.dll
|
||||
Assembly-CSharp.dll
|
||||
BepInEx.dll
|
||||
ConfigurationManager.dll
|
||||
UnityEngine.CoreModule.dll
|
||||
UnityEngine.dll
|
||||
Mafi.Base.dll
|
||||
Mafi.Core.dll
|
||||
Mafi.dll
|
||||
Mafi.Unity.dll
|
||||
Mafi.Security.dll
|
16
Projects/InfectionFreeZone/InfectionFreeZone.sln
Normal file
16
Projects/InfectionFreeZone/InfectionFreeZone.sln
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InfectionFreeZone", "InfectionFreeZone\InfectionFreeZone.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
|
@@ -0,0 +1,6 @@
|
||||
# CSharp formatting rules:
|
||||
[*.cs]
|
||||
csharp_new_line_before_open_brace = none
|
||||
csharp_new_line_before_else = false
|
||||
csharp_new_line_before_catch = false
|
||||
csharp_new_line_before_finally = false
|
@@ -0,0 +1,746 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Runtime.CompilerServices;
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using Controllers;
|
||||
using Controllers.CharacterLogic;
|
||||
using Controllers.Time;
|
||||
using Controllers.Weather;
|
||||
using Data.Resorces;
|
||||
using GameCustomization;
|
||||
using Gameplay;
|
||||
using Gameplay.Buildings;
|
||||
using Gameplay.GameResources;
|
||||
using Gameplay.InGameResources;
|
||||
using Gameplay.Production;
|
||||
using Gameplay.Rebuilding;
|
||||
using Gameplay.Rebuilding.Towers;
|
||||
using Gameplay.Rebuilding.Walls;
|
||||
using Gameplay.Scavenge;
|
||||
using Gameplay.Units.Characters;
|
||||
using Gameplay.Units.Icons;
|
||||
using Gameplay.Units.Movements;
|
||||
using Gameplay.Units.Workers.WorkSystem.Works;
|
||||
using Gameplay.Vehicles;
|
||||
using HarmonyLib;
|
||||
using HarmonyLib.Tools;
|
||||
using MapEssentials.Temp;
|
||||
using ScriptableObjectScripts.Radio;
|
||||
using UI.InfoPanels.NestedUIElements;
|
||||
using UnityEngine;
|
||||
using Zenject;
|
||||
|
||||
// See:
|
||||
// ConstructableWork
|
||||
// ProductionWork
|
||||
// GatherResourcesWork
|
||||
// GatherableObject
|
||||
// AreaWork
|
||||
// Gameplay.Vehicles.Vehicle.Update() : void @060044A1
|
||||
// System.Single Gameplay.Units.Movements.Movement::CalculateSpeed()
|
||||
// GameConfig looks interesting
|
||||
// See dayLengthInSeconds (defaults to 720 actually)
|
||||
// System.Single Controllers.Time.TimeController::GetSunsetHour(System.Int32,System.Double,System.Double)
|
||||
|
||||
namespace InfectionFreeZone {
|
||||
[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
|
||||
public class Main : BaseUnityPlugin {
|
||||
private const string pluginGuid = "InfectionFreeDave";
|
||||
private const string pluginName = "InfectionFreeDave";
|
||||
private const string pluginVersion = "1.0.0";
|
||||
|
||||
public static ConfigEntry<bool> resourceMultiplierDebug;
|
||||
public static ConfigEntry<float> resourceMultiplier;
|
||||
|
||||
public static ConfigEntry<bool> peopleMultiplierDebug;
|
||||
public static ConfigEntry<float> peopleMultiplier;
|
||||
|
||||
public static ConfigEntry<bool> resourceGatheringMultiplierDebug;
|
||||
public static ConfigEntry<float> resourceGatheringMultiplier;
|
||||
|
||||
public static ConfigEntry<bool> resourceScavengingMultiplierDebug;
|
||||
public static ConfigEntry<float> resourceScavengingMultiplier;
|
||||
|
||||
public static ConfigEntry<bool> buildingStorageCapacityMultiplierDebug;
|
||||
public static ConfigEntry<float> buildingStorageCapacityMultiplier;
|
||||
|
||||
public static ConfigEntry<bool> buildingQuartersCapacityMultiplierDebug;
|
||||
public static ConfigEntry<float> buildingQuartersCapacityMultiplier;
|
||||
|
||||
public static ConfigEntry<bool> buildingDeconstructionResourcesMultiplierDebug;
|
||||
public static ConfigEntry<float> buildingDeconstructionResourcesMultiplier;
|
||||
|
||||
public static ConfigEntry<float> humanMovementSpeedMultiplier;
|
||||
public static ConfigEntry<float> vehicleMovementSpeedMultiplier;
|
||||
|
||||
public static ConfigEntry<bool> vehicleTrunkCapacityMultiplierDebug;
|
||||
public static ConfigEntry<float> vehicleTrunkCapacityMultiplier;
|
||||
|
||||
public static ConfigEntry<bool> deconstructionTimeMultiplierDebug;
|
||||
public static ConfigEntry<float> deconstructionTimeMultiplier;
|
||||
public static ConfigEntry<float> deconstructionWorkersPer100m;
|
||||
|
||||
public static ConfigEntry<bool> constructionTimeMultiplierDebug;
|
||||
public static ConfigEntry<float> constructionTimeMultiplier;
|
||||
|
||||
public static ConfigEntry<bool> productionTimeMultiplierDebug;
|
||||
public static ConfigEntry<float> productionTimeMultiplier;
|
||||
|
||||
public static ConfigEntry<bool> birthingConfigDebug;
|
||||
public static ConfigEntry<int> maxCitizensInZoneToChildrenBorn;
|
||||
public static ConfigEntry<float> moraleInfluenceFloorParam;
|
||||
public static ConfigEntry<float> moraleInfluenceCeilingParam;
|
||||
public static ConfigEntry<float> foodStockInfluenceFloorParam;
|
||||
public static ConfigEntry<float> foodStockInfluenceCeilingParam;
|
||||
public static ConfigEntry<float> quartersRatioInfluenceFloorParam;
|
||||
public static ConfigEntry<float> quartersRatioInfluenceCeilingParam;
|
||||
public static ConfigEntry<float> childToAdultRatioInfluenceFloorParam;
|
||||
public static ConfigEntry<float> childToAdultRatioInfluenceCeilingParam;
|
||||
public static ConfigEntry<int> adultAge;
|
||||
public static ConfigEntry<int> oldAge;
|
||||
|
||||
public static ConfigEntry<float> rotationTimestepMultiplier; // This is NOT unused!
|
||||
public static ConfigEntry<float> sunsetHourOffset;
|
||||
public static ConfigEntry<float> sunriseHourOffset;
|
||||
|
||||
public static ConfigEntry<bool> productionProfitMultiplierDebug;
|
||||
public static ConfigEntry<string> productionProfitMultiplier;
|
||||
public static Dictionary<ResourceID, float> productionProfitMultiplierDict;
|
||||
|
||||
public static ConfigEntry<bool> towerEchoSelectionDebug;
|
||||
public static ConfigEntry<bool> towerEchoSelection;
|
||||
public static List<WeakReference<StructureDefenceModule>> towerEchoSelectionList;
|
||||
|
||||
public static ConfigEntry<bool> buildingMaxVolumeDebug;
|
||||
public static ConfigEntry<float> buildingMaxVolume;
|
||||
|
||||
// See System.Void UI.InfoPanels.NestedUIElements.SelectWeaponPanel::OnWeaponItemClicked(UI.InfoPanels.NestedUIElements.WeaponItem)
|
||||
|
||||
public void Awake() {
|
||||
resourceMultiplierDebug = Config.Bind("General", "Resource Multiplier Debug", false);
|
||||
resourceMultiplier = Config.Bind("General", "Resource Multiplier", 1f);
|
||||
|
||||
peopleMultiplierDebug = Config.Bind("General", "People Multiplier Debug", false);
|
||||
peopleMultiplier = Config.Bind("General", "People Multiplier", 1f);
|
||||
|
||||
resourceGatheringMultiplierDebug = Config.Bind("General", "Resource Gathering Multiplier Debug", false);
|
||||
resourceGatheringMultiplier = Config.Bind("General", "Resource Gathering Multiplier", 1f);
|
||||
|
||||
resourceScavengingMultiplierDebug = Config.Bind("General", "Resource Scavenging Multiplier Debug", false);
|
||||
resourceScavengingMultiplier = Config.Bind("General", "Resource Scavenging Multiplier", 1f);
|
||||
|
||||
buildingStorageCapacityMultiplierDebug =
|
||||
Config.Bind("General", "Building Storage Capacity Multiplier Debug", false);
|
||||
buildingStorageCapacityMultiplier = Config.Bind("General", "Building Storage Capacity Multiplier", 1f);
|
||||
|
||||
buildingQuartersCapacityMultiplierDebug =
|
||||
Config.Bind("General", "Building Quarters Capacity Multiplier Debug", false);
|
||||
buildingQuartersCapacityMultiplier = Config.Bind("General", "Building Quarters Capacity Multiplier", 1f);
|
||||
|
||||
buildingDeconstructionResourcesMultiplierDebug = Config.Bind("General",
|
||||
"Building Deconstruction Resources Multiplier Debug", false);
|
||||
buildingDeconstructionResourcesMultiplier =
|
||||
Config.Bind("General", "Building Deconstruction Resources Multiplier", 1f);
|
||||
deconstructionWorkersPer100m =
|
||||
Config.Bind("General", "Building Deconstruction Workers Per 100m", 0.0045f);
|
||||
|
||||
|
||||
humanMovementSpeedMultiplier = Config.Bind("General", "Human Movement Speed Multiplier", 1f);
|
||||
vehicleMovementSpeedMultiplier = Config.Bind("General", "Vehicle Movement Speed Multiplier", 1f);
|
||||
|
||||
vehicleTrunkCapacityMultiplierDebug =
|
||||
Config.Bind("General", "Vehicle Trunk Capacity Multiplier Debug", false);
|
||||
vehicleTrunkCapacityMultiplier = Config.Bind("General", "Vehicle Trunk Capacity Multiplier", 1f);
|
||||
|
||||
deconstructionTimeMultiplierDebug = Config.Bind("General", "Deconstruction Time Multiplier Debug", false);
|
||||
deconstructionTimeMultiplier = Config.Bind("General", "Deconstruction Time Multiplier", 1f);
|
||||
|
||||
constructionTimeMultiplierDebug = Config.Bind("General", "Construction Time Multiplier Debug", false);
|
||||
constructionTimeMultiplier = Config.Bind("General", "Construction Time Multiplier", 1f);
|
||||
|
||||
productionTimeMultiplierDebug = Config.Bind("General", "Production Time Multiplier Debug", false);
|
||||
productionTimeMultiplier = Config.Bind("General", "Production Time Multiplier", 1f);
|
||||
|
||||
birthingConfigDebug = Config.Bind("Birthing Config", "Birthing Config Debug", false);
|
||||
maxCitizensInZoneToChildrenBorn =
|
||||
Config.Bind("Birthing Config", "Max Citizens in Zone to Children Born", 600);
|
||||
moraleInfluenceFloorParam = Config.Bind("Birthing Config", "Morale Influence Floor Param", 0.3f);
|
||||
moraleInfluenceCeilingParam = Config.Bind("Birthing Config", "Morale Influence Ceiling Param", 2f);
|
||||
foodStockInfluenceFloorParam = Config.Bind("Birthing Config", "Food Stock Influence Floor Param", 0f);
|
||||
foodStockInfluenceCeilingParam = Config.Bind("Birthing Config", "Food Stock Influence Ceiling Param", 1f);
|
||||
quartersRatioInfluenceFloorParam =
|
||||
Config.Bind("Birthing Config", "Quarters Ratio Influence Floor Param", 0.6f);
|
||||
quartersRatioInfluenceCeilingParam =
|
||||
Config.Bind("Birthing Config", "Quarters Ratio Influence Ceiling Param", 1.4f);
|
||||
childToAdultRatioInfluenceFloorParam =
|
||||
Config.Bind("Birthing Config", "Child to Adult Ratio Influence Floor Param", 1f);
|
||||
childToAdultRatioInfluenceCeilingParam =
|
||||
Config.Bind("Birthing Config", "Child to Adult Ratio Influence Ceiling Param", 0f);
|
||||
adultAge = Config.Bind("Birthing Config", "Adult Age", 12);
|
||||
oldAge = Config.Bind("Birthing Config", "Old Age", 60);
|
||||
|
||||
rotationTimestepMultiplier = Config.Bind("General", "Rotation Timestep Multiplier", 1f);
|
||||
sunsetHourOffset = Config.Bind("General", "Sunset Hour Offset", 0f);
|
||||
sunriseHourOffset = Config.Bind("General", "Sunrise Hour Offset", 0f);
|
||||
|
||||
productionProfitMultiplierDebug = Config.Bind("General", "Production Profit Multiplier Debug", false);
|
||||
productionProfitMultiplier =
|
||||
Config.Bind("General", "Production Profit Multiplier (Resource ID: multiplier)", "");
|
||||
productionProfitMultiplierDict = new Dictionary<ResourceID, float>();
|
||||
productionProfitMultiplier.SettingChanged += delegate { UpdateProductionProfitMultiplierDict(); };
|
||||
UpdateProductionProfitMultiplierDict();
|
||||
|
||||
towerEchoSelectionDebug = Config.Bind("General", "Tower Echo Selection Debug", false);
|
||||
towerEchoSelection = Config.Bind("General", "Tower Echo Selection", false);
|
||||
towerEchoSelectionList = new List<WeakReference<StructureDefenceModule>>();
|
||||
|
||||
buildingMaxVolumeDebug = Config.Bind("General", "Building Max Volume Debug", false);
|
||||
buildingMaxVolume = Config.Bind("General", "Building Max Volume", 50000f);
|
||||
|
||||
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");
|
||||
foreach (var method in originalMethods) {
|
||||
Logger.LogInfo("Patched " + method.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateProductionProfitMultiplierDict() {
|
||||
Main.productionProfitMultiplierDict.Clear();
|
||||
var str = productionProfitMultiplier.Value;
|
||||
if (str == "")
|
||||
return;
|
||||
var split = str.Split(',');
|
||||
foreach (var s in split) {
|
||||
if (productionProfitMultiplierDebug.Value)
|
||||
Console.WriteLine($"Parsing {s}");
|
||||
var split2 = s.Split(':');
|
||||
if (split2.Length != 2)
|
||||
continue;
|
||||
var success = Enum.TryParse<ResourceID>(split2[0], out var resourceID);
|
||||
if (!success) {
|
||||
Console.WriteLine($"Failed to parse {split2[0]} as a resource ID");
|
||||
continue;
|
||||
}
|
||||
|
||||
var multiplier = float.Parse(split2[1]);
|
||||
productionProfitMultiplierDict.Add(resourceID, multiplier);
|
||||
if (productionProfitMultiplierDebug.Value)
|
||||
Console.WriteLine($"Added {resourceID} with multiplier {multiplier}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public class Patches {
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(GameCustomize), "LoadResourcesSettings")]
|
||||
public static void PostfixResourceMultiplier(ref float multiplier) {
|
||||
if (Main.resourceMultiplierDebug.Value)
|
||||
Console.WriteLine($"Resource multiplier is {multiplier}");
|
||||
if (multiplier > 0) {
|
||||
multiplier = (int)(multiplier * Main.resourceMultiplier.Value);
|
||||
if (Main.resourceMultiplierDebug.Value)
|
||||
Console.WriteLine($"Resource multiplier modified to {multiplier}");
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(GameCustomize), "LoadPeopleSettings")]
|
||||
public static void PostfixPeopleMultiplier(ref float people) {
|
||||
if (Main.peopleMultiplierDebug.Value)
|
||||
Console.WriteLine($"People multiplier is {people}");
|
||||
if (people > 0) {
|
||||
people = (int)(people * Main.peopleMultiplier.Value);
|
||||
if (Main.peopleMultiplierDebug.Value)
|
||||
Console.WriteLine($"People multiplier modified to {people}");
|
||||
}
|
||||
}
|
||||
|
||||
// [HarmonyPostfix]
|
||||
// [HarmonyPatch(typeof(ScavengeWork), MethodType.Constructor,
|
||||
// typeof(float), typeof(List<ResourceCrate>))]
|
||||
public static void PostfixScavengeWork(ref ScavengeWork __instance) {
|
||||
// This is saved to save file...
|
||||
// So every time it's fucking modified
|
||||
// Fuck me
|
||||
if (Main.resourceScavengingMultiplierDebug.Value)
|
||||
Console.WriteLine($"Scavenge work created");
|
||||
if (Main.resourceGatheringMultiplier.Value > 0) {
|
||||
for (int i = 0; i < __instance.ResourcesToFind.Count; i++) {
|
||||
var resource = __instance.ResourcesToFind[i];
|
||||
if (Main.resourceScavengingMultiplierDebug.Value)
|
||||
Console.WriteLine($"Resource {resource} to find");
|
||||
var rtraverse = Traverse.Create(resource);
|
||||
var resourceCount = rtraverse.Field<float>($"_quantity");
|
||||
if (Main.resourceScavengingMultiplierDebug.Value)
|
||||
Console.WriteLine($"Resource count is {resourceCount}");
|
||||
resourceCount.Value *= Main.resourceGatheringMultiplier.Value;
|
||||
if (Main.resourceScavengingMultiplierDebug.Value)
|
||||
Console.WriteLine($"Resource count modified to {resourceCount}");
|
||||
rtraverse.Field<float>($"_quantity").Value = resourceCount.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(GatherResourcesWork), "InstantiateResources", new Type[] { })]
|
||||
public static void PrefixGatheredResource(ref ScavengeWork __instance) {
|
||||
var trav = Traverse.Create(__instance);
|
||||
var resourcesToDropNew = new Dictionary<ResourceID, int>();
|
||||
var resourcesToDrop = trav.Field<Dictionary<ResourceID, int>>("_resourcesToDrop");
|
||||
if (Main.resourceGatheringMultiplierDebug.Value)
|
||||
Console.WriteLine($"Resources to drop: {resourcesToDrop}");
|
||||
if (resourcesToDrop.Value.Count > 0) {
|
||||
foreach (KeyValuePair<ResourceID, int> resource in resourcesToDrop.Value) {
|
||||
if (Main.resourceGatheringMultiplierDebug.Value)
|
||||
Console.WriteLine($"Resource {resource.Key} to drop: {resource.Value}");
|
||||
var newResourceValue = (int)(resource.Value * Main.resourceScavengingMultiplier.Value);
|
||||
resourcesToDropNew.Add(resource.Key, newResourceValue);
|
||||
if (Main.resourceGatheringMultiplierDebug.Value)
|
||||
Console.WriteLine($"Resource {resource.Key} to drop modified to: {newResourceValue}");
|
||||
}
|
||||
}
|
||||
|
||||
resourcesToDrop.Value = resourcesToDropNew;
|
||||
if (Main.resourceGatheringMultiplierDebug.Value)
|
||||
Console.WriteLine($"Resources to drop modified: {resourcesToDrop}");
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PlaceableObjectDraft), "GetCapacity", typeof(float), typeof(float))]
|
||||
public static void PostfixGetCapacity(ref int __result) {
|
||||
if (Main.buildingStorageCapacityMultiplier.Value <= 0)
|
||||
return;
|
||||
|
||||
if (Main.buildingStorageCapacityMultiplierDebug.Value)
|
||||
Console.WriteLine($"Building capacity is {__result}");
|
||||
__result = (int)(__result * Main.buildingStorageCapacityMultiplier.Value);
|
||||
if (Main.buildingStorageCapacityMultiplierDebug.Value)
|
||||
Console.WriteLine($"Building capacity modified to {__result}");
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PlaceableObjectDraft), "GetLivingCapacity")]
|
||||
public static void PostfixGetLivingCapacity(ref int __result) {
|
||||
if (Main.buildingQuartersCapacityMultiplier.Value <= 0)
|
||||
return;
|
||||
|
||||
if (Main.buildingQuartersCapacityMultiplierDebug.Value)
|
||||
Console.WriteLine($"Building capacity is {__result}");
|
||||
__result = (int)(__result * Main.buildingQuartersCapacityMultiplier.Value);
|
||||
if (Main.buildingQuartersCapacityMultiplierDebug.Value)
|
||||
Console.WriteLine($"Building capacity modified to {__result}");
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(Building), "DeconstructionResources", MethodType.Getter)]
|
||||
public static ResourceQuantity[] PostfixDeconstructionResources(ResourceQuantity[] __result) {
|
||||
if (Main.buildingDeconstructionResourcesMultiplier.Value <= 0)
|
||||
return __result;
|
||||
|
||||
ResourceQuantity[] modifiedResult = new ResourceQuantity[__result.Length];
|
||||
for (int i = 0; i < __result.Length; i++) {
|
||||
var resourceQuantity = __result[i];
|
||||
if (Main.buildingDeconstructionResourcesMultiplierDebug.Value)
|
||||
Console.WriteLine($"Resource quantity is {resourceQuantity}");
|
||||
|
||||
if (Main.buildingDeconstructionResourcesMultiplierDebug.Value)
|
||||
Console.WriteLine($"Resource quantity value is {resourceQuantity.value}");
|
||||
modifiedResult[i] = new ResourceQuantity(resourceQuantity.resourceType,
|
||||
resourceQuantity.value * Main.buildingDeconstructionResourcesMultiplier.Value);
|
||||
// resourceQuantity.value *= Main.buildingDeconstructionResourcesMultiplier.Value;
|
||||
if (Main.buildingDeconstructionResourcesMultiplierDebug.Value)
|
||||
Console.WriteLine($"Resource quantity value modified to {modifiedResult[i].value}");
|
||||
}
|
||||
|
||||
return modifiedResult;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(BuildingDestruction), "Initialize")]
|
||||
public static void PrefixBuildingDeconstruction(ref BuildingDestruction __instance) {
|
||||
if (Main.deconstructionWorkersPer100m.Value <= 0)
|
||||
return;
|
||||
|
||||
var trav = Traverse.Create(__instance);
|
||||
var config = trav.Field<BuildingDestructionConfig>("_deconstructionConfig");
|
||||
var configV = config.Value;
|
||||
if (Main.buildingDeconstructionResourcesMultiplierDebug.Value)
|
||||
Console.WriteLine(
|
||||
$"Building deconstruction workers per 100m is {configV.deconstructWorkersPer100m3OfBuilding}");
|
||||
|
||||
configV.deconstructWorkersPer100m3OfBuilding = Main.deconstructionWorkersPer100m.Value;
|
||||
config.Value = configV;
|
||||
if (Main.buildingDeconstructionResourcesMultiplierDebug.Value)
|
||||
Console.WriteLine(
|
||||
$"Building deconstruction workers per 100m modified to {configV.deconstructWorkersPer100m3OfBuilding}");
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(Movement), "CalculateSpeed")]
|
||||
public static void PostfixCalculateSpeedHuman(Movement __instance, ref float __result) {
|
||||
// Humans are "Human(Clone)", infected are "inf_human(Clone)" and vehicles are "ve_<name>"
|
||||
var name = __instance.ToString();
|
||||
if (name.StartsWith("Human"))
|
||||
__result *= Main.humanMovementSpeedMultiplier.Value;
|
||||
if (name.StartsWith("ve_"))
|
||||
__result *= Main.vehicleMovementSpeedMultiplier.Value;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(Vehicle), "Constructor",
|
||||
typeof(GroupIconsPool), typeof(SignalBus), typeof(WeatherController))]
|
||||
public static void PostfixVehicle(ref Vehicle __instance) {
|
||||
if (Main.vehicleTrunkCapacityMultiplier.Value <= 0)
|
||||
return;
|
||||
|
||||
if (Main.vehicleTrunkCapacityMultiplierDebug.Value)
|
||||
Console.WriteLine($"Vehicle trunk capacity is {__instance.Trunk.Capacity}");
|
||||
__instance.Trunk.SetCapacity((int)(__instance.Trunk.Capacity * Main.vehicleTrunkCapacityMultiplier.Value),
|
||||
true);
|
||||
if (Main.vehicleTrunkCapacityMultiplierDebug.Value)
|
||||
Console.WriteLine($"Vehicle trunk capacity modified to {__instance.Trunk.Capacity}");
|
||||
}
|
||||
|
||||
// GatherResourcesWork
|
||||
// ResearchWork
|
||||
// AreaWork
|
||||
// ProductionWork
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DisassembleWork), MethodType.Constructor,
|
||||
typeof(Structure), typeof(float), typeof(int), typeof(ResourcesController), typeof(SignalBus))]
|
||||
public static void PrefixDisassembleWork(Structure structure, ref float timeToDeconstruct) {
|
||||
if (Main.deconstructionTimeMultiplier.Value <= 0)
|
||||
return;
|
||||
|
||||
if (Main.deconstructionTimeMultiplierDebug.Value)
|
||||
Console.WriteLine($"Deconstruction time is {timeToDeconstruct}");
|
||||
timeToDeconstruct *= Main.deconstructionTimeMultiplier.Value;
|
||||
if (Main.deconstructionTimeMultiplierDebug.Value)
|
||||
Console.WriteLine($"Deconstruction time modified to {timeToDeconstruct}");
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ConstructableWork), MethodType.Constructor,
|
||||
typeof(Structure), typeof(Dictionary<ResourceID, int>), typeof(float), typeof(StockroomsController),
|
||||
typeof(SignalBus))]
|
||||
public static void PrefixConstructWork(Structure structure, Dictionary<ResourceID, int> cost,
|
||||
ref float timeToConstruct) {
|
||||
if (Main.deconstructionTimeMultiplier.Value <= 0)
|
||||
return;
|
||||
|
||||
if (Main.constructionTimeMultiplierDebug.Value)
|
||||
Console.WriteLine($"Construction time is {timeToConstruct}");
|
||||
timeToConstruct *= Main.constructionTimeMultiplier.Value;
|
||||
if (Main.constructionTimeMultiplierDebug.Value)
|
||||
Console.WriteLine($"Construction time modified to {timeToConstruct}");
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ProductionData), "GetProductionTime")]
|
||||
public static void PostfixProductionTime(ref float __result) {
|
||||
if (Main.productionTimeMultiplier.Value <= 0)
|
||||
return;
|
||||
|
||||
if (Main.productionTimeMultiplierDebug.Value)
|
||||
Console.WriteLine($"Production time is {__result}");
|
||||
__result *= Main.productionTimeMultiplier.Value;
|
||||
if (Main.productionTimeMultiplierDebug.Value)
|
||||
Console.WriteLine($"Production time modified to {__result}");
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CitizensController), "IncreasePopulation")]
|
||||
// Could not find a better way to do this
|
||||
public static void PostfixCharactersConfig(ref CitizensController __instance) {
|
||||
if (Main.birthingConfigDebug.Value)
|
||||
Console.WriteLine($"Citizens controller IncreasePopulation");
|
||||
var trav = Traverse.Create(__instance);
|
||||
var charactersConfig = trav.Field<CharactersConfig>("_charactersConfig");
|
||||
var charactersConfigV = charactersConfig.Value;
|
||||
var bornConfig = charactersConfigV.bornConfig;
|
||||
|
||||
charactersConfigV.adultAge = Main.adultAge.Value;
|
||||
if (Main.birthingConfigDebug.Value)
|
||||
Console.WriteLine($"Adult age is {charactersConfigV.adultAge}");
|
||||
|
||||
charactersConfigV.oldAge = Main.oldAge.Value;
|
||||
if (Main.birthingConfigDebug.Value)
|
||||
Console.WriteLine($"Old age is {charactersConfigV.oldAge}");
|
||||
|
||||
bornConfig.MaxCitizensInZoneToChildrenBorn = Main.maxCitizensInZoneToChildrenBorn.Value;
|
||||
if (Main.birthingConfigDebug.Value)
|
||||
Console.WriteLine(
|
||||
$"Max citizens in zone to children born is {bornConfig.MaxCitizensInZoneToChildrenBorn}");
|
||||
|
||||
bornConfig.MoraleInfluenceFloorParam = Main.moraleInfluenceFloorParam.Value;
|
||||
if (Main.birthingConfigDebug.Value)
|
||||
Console.WriteLine($"Morale influence floor param is {bornConfig.MoraleInfluenceFloorParam}");
|
||||
|
||||
bornConfig.MoraleInfluenceCeilingParam = Main.moraleInfluenceCeilingParam.Value;
|
||||
if (Main.birthingConfigDebug.Value)
|
||||
Console.WriteLine(
|
||||
$"Morale influence ceiling param is {bornConfig.MoraleInfluenceCeilingParam}");
|
||||
|
||||
bornConfig.FoodStockInfluenceFloorParam = Main.foodStockInfluenceFloorParam.Value;
|
||||
if (Main.birthingConfigDebug.Value)
|
||||
Console.WriteLine(
|
||||
$"Food stock influence floor param is {bornConfig.FoodStockInfluenceFloorParam}");
|
||||
|
||||
bornConfig.FoodStockInfluenceCeilingParam = Main.foodStockInfluenceCeilingParam.Value;
|
||||
if (Main.birthingConfigDebug.Value)
|
||||
Console.WriteLine(
|
||||
$"Food stock influence ceiling param is {bornConfig.FoodStockInfluenceCeilingParam}");
|
||||
|
||||
bornConfig.QuartersRatioInfluenceFloorParam = Main.quartersRatioInfluenceFloorParam.Value;
|
||||
if (Main.birthingConfigDebug.Value)
|
||||
Console.WriteLine(
|
||||
$"Quarters ratio influence floor param is {bornConfig.QuartersRatioInfluenceFloorParam}");
|
||||
|
||||
bornConfig.QuartersRatioInfluenceCeilingParam = Main.quartersRatioInfluenceCeilingParam.Value;
|
||||
if (Main.birthingConfigDebug.Value)
|
||||
Console.WriteLine(
|
||||
$"Quarters ratio influence ceiling param is {bornConfig.QuartersRatioInfluenceCeilingParam}");
|
||||
|
||||
bornConfig.ChildToAdultRatioInfluenceFloorParam =
|
||||
Main.childToAdultRatioInfluenceFloorParam.Value;
|
||||
if (Main.birthingConfigDebug.Value)
|
||||
Console.WriteLine(
|
||||
$"Child to adult ratio influence floor param is {bornConfig.ChildToAdultRatioInfluenceFloorParam}");
|
||||
|
||||
bornConfig.ChildToAdultRatioInfluenceCeilingParam =
|
||||
Main.childToAdultRatioInfluenceCeilingParam.Value;
|
||||
if (Main.birthingConfigDebug.Value)
|
||||
Console.WriteLine(
|
||||
$"Child to adult ratio influence ceiling param is {bornConfig.ChildToAdultRatioInfluenceCeilingParam}");
|
||||
|
||||
charactersConfigV.bornConfig = bornConfig;
|
||||
charactersConfig.Value = charactersConfigV;
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(PlaceObjectsInSingleLineCursor), "RotateRight")]
|
||||
public static IEnumerable<CodeInstruction> PostfixRotateRight(IEnumerable<CodeInstruction> instructions) {
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
for (var i = 0; i < codes.Count; i++) {
|
||||
var code = codes[i];
|
||||
Console.WriteLine($"Opcode is {code.opcode}");
|
||||
if (code.opcode == OpCodes.Ldc_R4 && Mathf.Approximately((float)code.operand, 100f)) {
|
||||
Console.WriteLine($"Operand is {code.operand}");
|
||||
codes[i] = new CodeInstruction(OpCodes.Ldsfld,
|
||||
AccessTools.Field(typeof(Main), "rotationTimestepMultiplier"));
|
||||
codes.Insert(i + 1,
|
||||
new CodeInstruction(OpCodes.Call,
|
||||
AccessTools.PropertyGetter(typeof(Main).GetField("rotationTimestepMultiplier").FieldType,
|
||||
"Value")));
|
||||
Console.WriteLine($"Operand modified to {codes[i].operand}");
|
||||
}
|
||||
}
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(PlaceObjectsInSingleLineCursor), "RotateLeft")]
|
||||
public static IEnumerable<CodeInstruction> PostfixRotateLeft(IEnumerable<CodeInstruction> instructions) {
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
for (var i = 0; i < codes.Count; i++) {
|
||||
var code = codes[i];
|
||||
Console.WriteLine($"Opcode is {code.opcode}");
|
||||
if (code.opcode == OpCodes.Ldc_R4 && Mathf.Approximately((float)code.operand, 100f)) {
|
||||
Console.WriteLine($"Operand is {code.operand}");
|
||||
codes[i] = new CodeInstruction(OpCodes.Ldsfld,
|
||||
AccessTools.Field(typeof(Main), "rotationTimestepMultiplier"));
|
||||
codes.Insert(i + 1,
|
||||
new CodeInstruction(OpCodes.Call,
|
||||
AccessTools.PropertyGetter(typeof(Main).GetField("rotationTimestepMultiplier").FieldType,
|
||||
"Value")));
|
||||
Console.WriteLine($"Operand modified to {codes[i].operand}");
|
||||
}
|
||||
}
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(TimeController), "GetSunsetHour")]
|
||||
public static void PostfixGetSunsetHour(ref float __result) {
|
||||
__result += Main.sunsetHourOffset.Value;
|
||||
__result = Mathf.Clamp(__result, 0f, 24f);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(TimeController), "GetSunriseHour")]
|
||||
public static void PostfixGetSunriseHour(ref float __result) {
|
||||
__result += Main.sunriseHourOffset.Value;
|
||||
__result = Mathf.Clamp(__result, 0f, 24f);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ProductionWork), "ProduceResources")]
|
||||
public static void PrefixProduceResources(List<ProductionDataPart> productionDataParts) {
|
||||
if (Main.productionProfitMultiplierDict.Count == 0)
|
||||
return;
|
||||
if (productionDataParts.Count == 0)
|
||||
return;
|
||||
|
||||
for (var i = 0; i < productionDataParts.Count; i++) {
|
||||
var productionDataPart = productionDataParts[i];
|
||||
if (Main.productionProfitMultiplierDebug.Value)
|
||||
Console.WriteLine(
|
||||
$"Production data part is {productionDataPart.type} x {productionDataPart.amount}");
|
||||
if (Main.productionProfitMultiplierDict.TryGetValue(productionDataPart.type, out var setpoint)) {
|
||||
if (Main.productionProfitMultiplierDebug.Value)
|
||||
Console.WriteLine($"Production data part has setpoint {setpoint}");
|
||||
productionDataPart.amount = (int)setpoint;
|
||||
if (Main.productionProfitMultiplierDebug.Value)
|
||||
Console.WriteLine(
|
||||
$"Production data part modified to {productionDataPart.type} x {productionDataPart.amount}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(StructureDefenceModule), "Awake")]
|
||||
public static void PostfixStructureDefenceModule(StructureDefenceModule __instance) {
|
||||
if (Main.towerEchoSelectionDebug.Value)
|
||||
Console.WriteLine($"Structure defence module created");
|
||||
Main.towerEchoSelectionList.Add(new WeakReference<StructureDefenceModule>(__instance));
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(SelectWeaponPanel), "OnWeaponItemClicked")]
|
||||
public static void PostfixSelectWeaponPanel(WeaponItem selectedItem) {
|
||||
if (!Main.towerEchoSelection.Value)
|
||||
return;
|
||||
if (selectedItem == null) {
|
||||
if (Main.towerEchoSelectionDebug.Value)
|
||||
Console.WriteLine("Selected weapon item is null !?");
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedItem.WeaponData == null) {
|
||||
if (Main.towerEchoSelectionDebug.Value)
|
||||
Console.WriteLine("Selected weapon data is null !?");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Main.towerEchoSelectionDebug.Value) {
|
||||
Console.WriteLine($"Selected weapon item is {selectedItem.name}");
|
||||
Console.WriteLine($"Echoing weapon to {Main.towerEchoSelectionList.Count} towers");
|
||||
}
|
||||
|
||||
for (var i = 0; i < Main.towerEchoSelectionList.Count; i++) {
|
||||
try {
|
||||
var towerEchoSelection = Main.towerEchoSelectionList[i];
|
||||
if (towerEchoSelection.TryGetTarget(out var towerEchoSelectionT)) {
|
||||
if (towerEchoSelectionT == null) {
|
||||
if (Main.towerEchoSelectionDebug.Value)
|
||||
Console.WriteLine("Tower defence module is null !?");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Main.towerEchoSelectionDebug.Value)
|
||||
Console.WriteLine(
|
||||
$"Tower defence weapon is {towerEchoSelectionT.SelectedWeapon.ToString()}");
|
||||
|
||||
towerEchoSelectionT.SetFieldOfView(selectedItem.WeaponData);
|
||||
towerEchoSelectionT.SetupWeapon(selectedItem.WeaponData);
|
||||
|
||||
var selectedWeapon = towerEchoSelectionT.SelectedWeapon == null
|
||||
? "null"
|
||||
: towerEchoSelectionT.SelectedWeapon.ToString();
|
||||
if (Main.towerEchoSelectionDebug.Value)
|
||||
Console.WriteLine($"Tower defence weapon modified to {selectedWeapon}");
|
||||
}
|
||||
} catch (NullReferenceException e) {
|
||||
Console.WriteLine($"Failed to set tower defence weapon: {e}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Add toggle for this
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(ValidatableStructure), "Awake")]
|
||||
public static IEnumerable<CodeInstruction> PostfixValidatableStructure(
|
||||
IEnumerable<CodeInstruction> instructions) {
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
int start = 0;
|
||||
int start2 = 0;
|
||||
int end = 0;
|
||||
int end2 = 0;
|
||||
for (var i = 0; i < codes.Count; i++) {
|
||||
if (codes[i].opcode == OpCodes.Ldc_I4_5) {
|
||||
Console.WriteLine($"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
|
||||
codes[i] = new CodeInstruction(OpCodes.Ldc_I4_2); // Array size after our deletion is 3 from 5
|
||||
}
|
||||
|
||||
if (codes[i].opcode == OpCodes.Ldstr && codes[i].operand.ToString() == "Tower") {
|
||||
Console.WriteLine($"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
|
||||
start2 = i - 2;
|
||||
end2 = i + 2;
|
||||
}
|
||||
|
||||
if (codes[i].opcode == OpCodes.Ldstr && codes[i].operand.ToString() == "Farmland") {
|
||||
Console.WriteLine($"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
|
||||
Console.WriteLine(
|
||||
$"Opcode is {codes[i - 1].opcode} and operand is {codes[i - 1].operand} at index {i - 1}");
|
||||
codes[i - 1].opcode =
|
||||
OpCodes.Ldc_I4_1; // Because we deleted the previous element this one is now index 1 instead of 2
|
||||
}
|
||||
|
||||
if (codes[i].opcode == OpCodes.Ldstr && codes[i].operand.ToString() == "Wall") {
|
||||
Console.WriteLine($"Opcode is {codes[i].opcode} and operand is {codes[i].operand} at index {i}");
|
||||
start = i - 2;
|
||||
end = i + 6;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Console.WriteLine($"Start is {start} with opcode {codes[start].opcode} and operand {codes[start].operand}");
|
||||
Console.WriteLine($"End is {end} with opcode {codes[end].opcode} and operand {codes[end].operand}");
|
||||
codes.RemoveRange(start, end - start);
|
||||
Console.WriteLine($"Removed {end - start} instructions");
|
||||
|
||||
Console.WriteLine(
|
||||
$"Start2 is {start2} with opcode {codes[start2].opcode} and operand {codes[start2].operand}");
|
||||
Console.WriteLine($"End2 is {end2} with opcode {codes[end2].opcode} and operand {codes[end2].operand}");
|
||||
codes.RemoveRange(start2, end2 - start2);
|
||||
Console.WriteLine($"Removed {end2 - start2} instructions");
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
|
||||
// TODO: Add toggle for this
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(WallConstructor), MethodType.Constructor,
|
||||
typeof(Wall.Factory), typeof(WorkersRadio), typeof(WallConfig))]
|
||||
public static void PostfixWallConstructor(Wall.Factory factory, WorkersRadio workersRadio,
|
||||
ref WallConfig wallConfig) {
|
||||
Console.WriteLine($"Wall config created");
|
||||
wallConfig.maxAngel = 2f;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(AdaptController), MethodType.Constructor, typeof(AdaptConfig))]
|
||||
public static void PostfixAdaptConfig(ref AdaptConfig adaptConfig) {
|
||||
var trav = Traverse.Create(adaptConfig);
|
||||
var buildingsMaxVolume = trav.Field<float>("buildingsMaxVolume");
|
||||
|
||||
if (Main.buildingMaxVolumeDebug.Value)
|
||||
Console.WriteLine($"Building max volume is {buildingsMaxVolume.Value}");
|
||||
|
||||
buildingsMaxVolume.Value = Main.buildingMaxVolume.Value;
|
||||
|
||||
if (Main.buildingMaxVolumeDebug.Value)
|
||||
Console.WriteLine($"Building max volume modified to {buildingsMaxVolume.Value}");
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
<?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>
|
||||
<GAME_DIR>C:/Games/Infection.Free.Zone.v0.24.8.21a</GAME_DIR>
|
||||
<GAME_MANAGED>$(GAME_DIR)/Infection Free Zone_Data/Managed</GAME_MANAGED>
|
||||
<GAME_BEPINEX>$(GAME_DIR)/BepInEx</GAME_BEPINEX>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{DA9D274E-486F-4F82-84FF-CD9388CB0B09}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>InfectionFreeZone</RootNamespace>
|
||||
<AssemblyName>InfectionFreeZone</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>
|
||||
<Compile Include="InfectionFreeZone.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>$(GAME_BEPINEX)/core/0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>$(GAME_BEPINEX)/core/BepInEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ConfigurationManager">
|
||||
<HintPath>$(GAME_BEPINEX)/plugins/ConfigurationManager/ConfigurationManager.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>$(GAME_MANAGED)/Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>$(GAME_MANAGED)/UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>$(GAME_MANAGED)/UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Ifz">
|
||||
<HintPath>$(GAME_MANAGED)/Ifz.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Zenject">
|
||||
<HintPath>$(GAME_MANAGED)/Zenject.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Sirenix.Serialization">
|
||||
<HintPath>$(GAME_MANAGED)/Sirenix.Serialization.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="JutsuGamesConfig">
|
||||
<HintPath>$(GAME_MANAGED)/JutsuGamesConfig.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
||||
</Project>
|
@@ -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("InfectionFreeZone")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("InfectionFreeZone")]
|
||||
[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")]
|
1
Projects/InfectionFreeZone/sync
Normal file
1
Projects/InfectionFreeZone/sync
Normal file
@@ -0,0 +1 @@
|
||||
InfectionFreeZone/bin/Release/InfectionFreeZone.dll,"C:\Games\Infection.Free.Zone.v0.24.8.21a\BepInEx\plugins\InfectionFreeZone.dll"
|
16
Projects/SupermarketSimulator/SupermarketSimulator.sln
Normal file
16
Projects/SupermarketSimulator/SupermarketSimulator.sln
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SupermarketSimulator", "SupermarketSimulator\SupermarketSimulator.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
|
@@ -0,0 +1,4 @@
|
||||
<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:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" />
|
||||
</AssemblyExplorer></s:String></wpf:ResourceDictionary>
|
@@ -0,0 +1,6 @@
|
||||
# CSharp formatting rules:
|
||||
[*.cs]
|
||||
csharp_new_line_before_open_brace = none
|
||||
csharp_new_line_before_else = false
|
||||
csharp_new_line_before_catch = false
|
||||
csharp_new_line_before_finally = false
|
52
Projects/SupermarketSimulator/SupermarketSimulator/Class1.cs
Normal file
52
Projects/SupermarketSimulator/SupermarketSimulator/Class1.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using HarmonyLib.Tools;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace DavesPhatStore {
|
||||
[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
|
||||
public class Main : BaseUnityPlugin {
|
||||
private const string pluginGuid = "DavesPhatStore";
|
||||
private const string pluginName = "DavesPhatStore";
|
||||
private const string pluginVersion = "1.0.0";
|
||||
|
||||
public CustomerManager customermanager;
|
||||
private float timer = 0f;
|
||||
public static ConfigEntry<float> spawnTimer;
|
||||
|
||||
public void Awake() {
|
||||
spawnTimer = Config.Bind("General", "SpawnTimer", 10f);
|
||||
|
||||
SceneManager.sceneLoaded += this.OnSceneLoaded;
|
||||
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");
|
||||
foreach (var method in originalMethods) {
|
||||
Logger.LogInfo("Patched " + method.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnSceneLoaded(Scene scene, LoadSceneMode mode) {
|
||||
if (scene.name.Equals("Main Scene")) {
|
||||
customermanager = FindObjectOfType<CustomerManager>();
|
||||
}
|
||||
}
|
||||
|
||||
void Update() {
|
||||
timer += Time.deltaTime;
|
||||
|
||||
if (timer >= spawnTimer.Value) {
|
||||
Console.WriteLine("Cyka spawning customer");
|
||||
customermanager.SpawnCustomer();
|
||||
timer = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -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("DavesPhatStore")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DavesPhatStore")]
|
||||
[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")]
|
@@ -0,0 +1,65 @@
|
||||
<?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>
|
||||
<GAME_DIR>C:\Games\Supermarket Simulator</GAME_DIR>
|
||||
<GAME_MANAGED>$(GAME_DIR)/Supermarket Simulator_Data/Managed</GAME_MANAGED>
|
||||
<GAME_BEPINEX>$(GAME_DIR)/BepInEx</GAME_BEPINEX>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{DA9D274E-486F-4F82-84FF-CD9388CB0B09}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DavesPhatStore</RootNamespace>
|
||||
<AssemblyName>DavesPhatStore</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>
|
||||
<Compile Include="Class1.cs"/>
|
||||
<Compile Include="Properties\AssemblyInfo.cs"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>$(GAME_BEPINEX)/core/0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>$(GAME_BEPINEX)/core/BepInEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ConfigurationManager">
|
||||
<HintPath>$(GAME_BEPINEX)/plugins/ConfigurationManager/ConfigurationManager.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>$(GAME_MANAGED)/Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>$(GAME_MANAGED)/UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>$(GAME_MANAGED)/UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MyBox">
|
||||
<HintPath>$(GAME_MANAGED)/MyBox.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
||||
</Project>
|
1
Projects/SupermarketSimulator/SupermarketSimulator/sync
Normal file
1
Projects/SupermarketSimulator/SupermarketSimulator/sync
Normal file
@@ -0,0 +1 @@
|
||||
bin/Release/DavesPhatStore.dll,"C:\Games\Supermarket Simulator\BepInEx\plugins\DavesPhatStore.dll"
|
@@ -0,0 +1,4 @@
|
||||
<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:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" />
|
||||
</AssemblyExplorer></s:String></wpf:ResourceDictionary>
|
@@ -0,0 +1,6 @@
|
||||
# CSharp formatting rules:
|
||||
[*.cs]
|
||||
csharp_new_line_before_open_brace = none
|
||||
csharp_new_line_before_else = false
|
||||
csharp_new_line_before_catch = false
|
||||
csharp_new_line_before_finally = false
|
173
Projects/SupermarketTogether/SupermarketTogether/AutoPricer.cs
Normal file
173
Projects/SupermarketTogether/SupermarketTogether/AutoPricer.cs
Normal file
@@ -0,0 +1,173 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.Emit;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DavesPhatStore {
|
||||
[HarmonyPatch]
|
||||
public class AutoPricer {
|
||||
// This does not work as I would like it to
|
||||
// We'll have to do it differently...
|
||||
// [HarmonyTranspiler]
|
||||
// [HarmonyPatch(typeof(PlayerNetwork), "Update")]
|
||||
// static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
|
||||
// Console.WriteLine("Transpiling PlayerNetwork.Update");
|
||||
// var codes = new List<CodeInstruction>(instructions);
|
||||
|
||||
// for (int i = 0; i < codes.Count; i++) {
|
||||
// var codeInstruction = codes[i];
|
||||
// if (codeInstruction.operand == null) {
|
||||
// Console.WriteLine($"{i}: '{codeInstruction.opcode}' '{codeInstruction.operand}'");
|
||||
// continue;
|
||||
// }
|
||||
// Console.WriteLine($"{i}: '{codeInstruction.opcode}' '{codeInstruction.operand}' ('{codeInstruction.operand.GetType()}')");
|
||||
// }
|
||||
|
||||
// int beqLoc = -1;
|
||||
// int startMove = -1;
|
||||
// int endMove = -1;
|
||||
// bool part1 = false;
|
||||
|
||||
// for (int i = 0; i < codes.Count; i++) {
|
||||
// if (codes[i].opcode == OpCodes.Beq) {
|
||||
// beqLoc = i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// for (int i = 0; i < codes.Count; i++) {
|
||||
// if (codes[i].opcode == OpCodes.Ldfld
|
||||
// && codes[i].operand.ToString() == "System.Single[] tierInflation") {
|
||||
// startMove = i - 1;
|
||||
// }
|
||||
// if (startMove != -1
|
||||
// && codes[i].opcode == OpCodes.Stloc_S
|
||||
// && codes[i].operand.ToString() == "System.Single (24)"
|
||||
// && codes[i - 1].opcode == OpCodes.Div) {
|
||||
// endMove = i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (beqLoc != -1 && startMove != -1 && endMove != -1) {
|
||||
// Console.WriteLine($"Moving {endMove - startMove + 1} instructions from {startMove} to {beqLoc}");
|
||||
// List<CodeInstruction> blockToMove = codes.GetRange(startMove, endMove - startMove + 1);
|
||||
// codes.RemoveRange(startMove, endMove - startMove + 1);
|
||||
// codes.InsertRange(beqLoc, blockToMove);
|
||||
// part1 = true;
|
||||
// }
|
||||
|
||||
// if (!part1) {
|
||||
// Console.WriteLine("Failed mvoing local variables above BEQ, bailing");
|
||||
// return new List<CodeInstruction>(instructions);
|
||||
// }
|
||||
|
||||
// CodeInstruction savedStfld = null;
|
||||
// CodeInstruction savedLdloc = null;
|
||||
|
||||
// for (int rep = 0; rep < 2; rep++) {
|
||||
// int start = -1, end = -1;
|
||||
// for (int i = 2; i < codes.Count; i++) {
|
||||
// var codeInstruction = codes[i];
|
||||
|
||||
// if (savedLdloc == null
|
||||
// && codeInstruction.opcode == OpCodes.Ldloc_S
|
||||
// && codeInstruction.operand.ToString() == "System.Single (24)") {
|
||||
// savedLdloc = codeInstruction;
|
||||
// }
|
||||
|
||||
// if (codeInstruction.opcode == OpCodes.Stfld
|
||||
// && codeInstruction.operand.ToString() == "System.Single pPrice"
|
||||
// && codes[i - 1].opcode != OpCodes.Call
|
||||
// && codes[i - 2].opcode == OpCodes.Ldc_R4) {
|
||||
// savedStfld = codeInstruction;
|
||||
// end = i;
|
||||
// for (int j = i; j > Math.Max(0, i - 20); j--) {
|
||||
// if (codes[j].opcode == OpCodes.Ldarg_0
|
||||
// && codes[j + 1].opcode == OpCodes.Ldarg_0) {
|
||||
// start = j;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (start != -1 && end != -1) {
|
||||
// Console.WriteLine("Start: " + start + ", End: " + end);
|
||||
// if (savedStfld == null) {
|
||||
// Console.WriteLine("SavedStfld is null");
|
||||
// continue;
|
||||
// }
|
||||
// codes.RemoveRange(start, end - start + 1);
|
||||
// codes.Insert(start, new CodeInstruction(OpCodes.Ldarg_0));
|
||||
// codes.Insert(start + 1, savedLdloc);
|
||||
// codes.Insert(start + 2, new CodeInstruction(OpCodes.Ldc_R4, 2f));
|
||||
// codes.Insert(start + 3, new CodeInstruction(OpCodes.Mul));
|
||||
// codes.Insert(start + 4, savedStfld);
|
||||
// Console.WriteLine($"Patched set price to 2x at {start}");
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// for (int i = 0; i < codes.Count; i++) {
|
||||
// var codeInstruction = codes[i];
|
||||
// if (codeInstruction.operand == null) {
|
||||
// Console.WriteLine($"{i}: '{codeInstruction.opcode}' '{codeInstruction.operand}'");
|
||||
// continue;
|
||||
// }
|
||||
// Console.WriteLine($"{i}: '{codeInstruction.opcode}' '{codeInstruction.operand}' ('{codeInstruction.operand.GetType()}')");
|
||||
// }
|
||||
|
||||
// return codes.AsEnumerable();
|
||||
// }
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ProductListing), nameof(ProductListing.CmdUpdateProductPrice))]
|
||||
public static void CmdUpdateProductPricePrefix(ref int productID, ref float newPrice) {
|
||||
Console.WriteLine($"Called CmdUpdateProductPricePrefix with {productID} and {newPrice}");
|
||||
var inflationPrice = ProductListing.Instance.tierInflation[ProductListing.Instance.productPrefabs[productID].GetComponent<Data_Product>().productTier];
|
||||
float realPricePerUnit = ProductListing.Instance.productPrefabs[productID].GetComponent<Data_Product>().basePricePerUnit * inflationPrice;
|
||||
realPricePerUnit = Mathf.Round(realPricePerUnit * 100f) / 100f;
|
||||
newPrice = realPricePerUnit * Main.setPriceMultiplier.Value;
|
||||
Console.WriteLine($"Adjusted price to {newPrice} for product {productID}");
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(PlayerNetwork), "Update")]
|
||||
static IEnumerable<CodeInstruction> UpdateTranspiler(IEnumerable<CodeInstruction> instructions) {
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
|
||||
// for (int i = 0; i < codes.Count; i++) {
|
||||
// var codeInstruction = codes[i];
|
||||
// if (codeInstruction.operand == null) {
|
||||
// Console.WriteLine($"{i}: '{codeInstruction.opcode}' '{codeInstruction.operand}'");
|
||||
// continue;
|
||||
// }
|
||||
// Console.WriteLine($"{i}: '{codeInstruction.opcode}' '{codeInstruction.operand}' ('{codeInstruction.operand.GetType()}')");
|
||||
// }
|
||||
|
||||
int start = 0, end = 0;
|
||||
for (int i = 0; i < codes.Count; ++i) {
|
||||
if (codes[i].opcode == OpCodes.Brfalse
|
||||
&& codes[i + 1].opcode == OpCodes.Ldsfld
|
||||
&& codes[i + 2].opcode == OpCodes.Ldfld
|
||||
&& codes[i + 2].operand.ToString().Equals("System.Single[] productPlayerPricing")) {
|
||||
start = i;
|
||||
}
|
||||
|
||||
if (codes[i].opcode == OpCodes.Beq
|
||||
&& codes[i - 1].opcode == OpCodes.Ldfld
|
||||
&& codes[i - 2].opcode == OpCodes.Ldarg_0
|
||||
&& codes[i - 1].operand.ToString().Equals("System.Single pPrice")) {
|
||||
end = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Console.WriteLine($"Found UpdateTranspiler start at {start}, end at {end}");
|
||||
codes.RemoveRange(start, end - start + 1);
|
||||
|
||||
return instructions;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using HarmonyLib;
|
||||
using HutongGames.PlayMaker.Actions;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DavesPhatStore {
|
||||
[HarmonyPatch]
|
||||
public class BuilderDecoration {
|
||||
// private static Transform lastValidPosition = null;
|
||||
|
||||
// [HarmonyPostfix]
|
||||
// [HarmonyPatch(typeof(Builder_Decoration), "Update")]
|
||||
// public static void Update(Builder_Decoration __instance) {
|
||||
// var instanceT = Traverse.Create(__instance);
|
||||
// var dummyOBJ = instanceT.Field("dummyOBJ").GetValue<GameObject>();
|
||||
// if (dummyOBJ == null) {
|
||||
// Console.WriteLine("No dummyOBJ");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// var canPlace = instanceT.Field("canPlace").GetValue<bool>();
|
||||
// if (canPlace) {
|
||||
// Console.WriteLine($"Can place at {dummyOBJ.transform}");
|
||||
// lastValidPosition = dummyOBJ.transform;
|
||||
// } else {
|
||||
// Console.WriteLine($"Cannot place, reverting to {lastValidPosition.position}");
|
||||
// dummyOBJ.transform.position = lastValidPosition.position;
|
||||
// }
|
||||
// }
|
||||
|
||||
// [HarmonyPrefix]
|
||||
// [HarmonyPatch(typeof(NetworkSpawner), "UserCode_CmdSpawn__Int32__Vector3__Vector3")]
|
||||
// public static void UserCode_CmdSpawn__Int32__Vector3__Vector3(ref int prefabID, ref Vector3 pos, ref Vector3 rot) {
|
||||
// Console.WriteLine(new StackTrace().ToString());
|
||||
// Console.WriteLine($"Spawning {prefabID} at {pos.ToString()} with rot {rot.ToString()}");
|
||||
// }
|
||||
|
||||
// [HarmonyPrefix]
|
||||
// [HarmonyPatch(typeof(NetworkSpawner), "CmdSpawn")]
|
||||
// public static void CmdSpawn(ref int prefabID, ref Vector3 pos, ref Vector3 rot) {
|
||||
// Console.WriteLine(new StackTrace().ToString());
|
||||
// Console.WriteLine($"Spawning {prefabID} at {pos.ToString()} with rot {rot.ToString()}");
|
||||
// }
|
||||
|
||||
// [HarmonyPrefix]
|
||||
// [HarmonyPatch(typeof(CallMethod), "DoMethodCall")]
|
||||
// public static void DoMethodCall(CallMethod __instance) {
|
||||
// var traverse = Traverse.Create(__instance);
|
||||
// Console.WriteLine($"DoMethodCall cachedMethodInfo: {traverse.Field("cachedMethodInfo").GetValue()}");
|
||||
// Console.WriteLine($"DoMethodCall cachedBehaviour: {traverse.Field("cachedBehaviour").GetValue()}");
|
||||
// Console.WriteLine($"DoMethodCall parameters: {traverse.Field("parameters").GetValue()}");
|
||||
// Console.WriteLine(new StackTrace().ToString());
|
||||
// }
|
||||
|
||||
// [HarmonyPostfix]
|
||||
// [HarmonyPatch(typeof(CallMethod), "DoMethodCall")]
|
||||
// public static void PostDoMethodCall(CallMethod __instance) {
|
||||
// var traverse = Traverse.Create(__instance);
|
||||
// Console.WriteLine($"DoMethodCall cachedMethodInfo: {traverse.Field("cachedMethodInfo").GetValue()}");
|
||||
// Console.WriteLine($"DoMethodCall cachedBehaviour: {traverse.Field("cachedBehaviour").GetValue()}");
|
||||
// Console.WriteLine($"DoMethodCall parameters: {traverse.Field("parameters").GetValue()}");
|
||||
// Console.WriteLine(new StackTrace().ToString());
|
||||
// }
|
||||
}
|
||||
}
|
@@ -7,17 +7,36 @@ using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using HarmonyLib.Tools;
|
||||
|
||||
namespace CykaMod {
|
||||
namespace DavesPhatStore {
|
||||
[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
|
||||
public class Main : BaseUnityPlugin {
|
||||
private const string pluginGuid = "SupermarketTogether";
|
||||
private const string pluginName = "SupermarketTogether";
|
||||
private const string pluginGuid = "DavesPhatStore";
|
||||
private const string pluginName = "DavesPhatStore";
|
||||
private const string pluginVersion = "1.0.0";
|
||||
|
||||
public static ConfigEntry<int> playersAdded;
|
||||
|
||||
public static ConfigEntry<int> employeePerPerk;
|
||||
public static ConfigEntry<float> employeeSpeedPerk;
|
||||
public static ConfigEntry<float> employeeExtraMoneyPerk;
|
||||
public static ConfigEntry<float> productCheckoutWait;
|
||||
public static ConfigEntry<float> productItemPlaceWait;
|
||||
public static ConfigEntry<float> employeeItemPlaceWait;
|
||||
public static ConfigEntry<float> experienceMultiplier;
|
||||
public static ConfigEntry<float> setPriceMultiplier;
|
||||
|
||||
public void Awake() {
|
||||
playersAdded = Config.Bind("General", "PlayersAdded", 0);
|
||||
employeePerPerk = Config.Bind("General", "EmployeePerPerk", 1);
|
||||
employeeSpeedPerk = Config.Bind("General", "EmployeeSpeedPerk", 0.2f);
|
||||
employeeExtraMoneyPerk = Config.Bind("General", "EmployeeExtraMoneyPerk", 0.1f);
|
||||
productCheckoutWait = Config.Bind("General", "ProductCheckoutWait", 0.75f);
|
||||
productItemPlaceWait = Config.Bind("General", "ProductItemPlaceWait", 0.5f);
|
||||
employeeItemPlaceWait = Config.Bind("General", "EmployeeItemPlaceWait", 0.2f);
|
||||
experienceMultiplier = Config.Bind("General", "ExperienceMultiplier", 0.2f);
|
||||
setPriceMultiplier = Config.Bind("General", "SetPriceMultiplier", 2f);
|
||||
|
||||
WaitTimes wt = gameObject.AddComponent<WaitTimes>();
|
||||
wt.init();
|
||||
|
||||
Logger.LogInfo("Cyka mod loaded");
|
||||
HarmonyFileLog.Enabled = true;
|
||||
@@ -25,6 +44,44 @@ namespace CykaMod {
|
||||
harmony.PatchAll();
|
||||
var originalMethods = harmony.GetPatchedMethods();
|
||||
Logger.LogInfo("Patched " + originalMethods.Count() + " methods");
|
||||
foreach (var method in originalMethods) {
|
||||
Logger.LogInfo("Patched " + method.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(GameData), "UserCode_CmdAlterFunds__Single")]
|
||||
public static class ExperiencePatch {
|
||||
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
|
||||
// foreach (var codeInstruction in codes) {
|
||||
// Console.WriteLine(codeInstruction);
|
||||
// }
|
||||
|
||||
CodeInstruction previous = codes[0];
|
||||
for (int i = 1; i < codes.Count; i++) {
|
||||
if (previous.opcode == OpCodes.Mul && codes[i].opcode == OpCodes.Sub) {
|
||||
Console.WriteLine("Found Mul and Sub:");
|
||||
Console.WriteLine(previous);
|
||||
Console.WriteLine(codes[i]);
|
||||
|
||||
codes.Insert(i + 1,
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(Main), "experienceMultiplier")));
|
||||
codes.Insert(i + 2,
|
||||
new CodeInstruction(OpCodes.Call,
|
||||
AccessTools.PropertyGetter(typeof(Main).GetField("experienceMultiplier").FieldType, "Value")));
|
||||
codes.Insert(i + 3, new CodeInstruction(OpCodes.Add));
|
||||
}
|
||||
|
||||
previous = codes[i];
|
||||
}
|
||||
|
||||
// foreach (var codeInstruction in codes) {
|
||||
// Console.WriteLine(codeInstruction);
|
||||
// }
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,90 +94,4 @@ namespace CykaMod {
|
||||
Console.WriteLine($"maxCustomersNPCs: {__instance.maxCustomersNPCs}");
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(UpgradesManager), "ManageExtraPerks")]
|
||||
public static class ConsoleProductionReductionPatch {
|
||||
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
|
||||
for (int i = 0; i < codes.Count; i++) {
|
||||
if (codes[i].opcode == OpCodes.Ldc_I4_1) {
|
||||
Console.WriteLine("Found Ldc_I4_1");
|
||||
codes[i].opcode = OpCodes.Ldc_I4_2;
|
||||
}
|
||||
}
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
}
|
||||
|
||||
// region player faking
|
||||
[HarmonyPatch(typeof(GameData), "UserCode_CmdOpenSupermarket")]
|
||||
public static class PlayersAddedTranspilePatch {
|
||||
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
|
||||
// foreach (var codeInstruction in codes) {
|
||||
// Console.WriteLine(codeInstruction);
|
||||
// }
|
||||
|
||||
CodeInstruction previous = codes[0];
|
||||
for (int i = 1; i < codes.Count; i++) {
|
||||
if (previous.opcode == OpCodes.Ldsfld && codes[i].opcode == OpCodes.Callvirt) {
|
||||
Console.WriteLine("Found Ldsfld and Callvirt");
|
||||
Console.WriteLine(previous);
|
||||
Console.WriteLine(codes[i]);
|
||||
codes.Insert(i + 1,
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(Main), "playersAdded")));
|
||||
codes.Insert(i + 2,
|
||||
new CodeInstruction(OpCodes.Call,
|
||||
AccessTools.PropertyGetter(typeof(Main).GetField("playersAdded").FieldType, "Value")));
|
||||
codes.Insert(i + 3, new CodeInstruction(OpCodes.Add));
|
||||
}
|
||||
|
||||
previous = codes[i];
|
||||
}
|
||||
|
||||
// foreach (var codeInstruction in codes) {
|
||||
// Console.WriteLine(codeInstruction);
|
||||
// }
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(NPC_Manager), "SpawnCustomerNCP")]
|
||||
public static class PlayersAddedTranspilePatch2 {
|
||||
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
|
||||
// foreach (var codeInstruction in codes) {
|
||||
// Console.WriteLine(codeInstruction);
|
||||
// }
|
||||
|
||||
CodeInstruction previous = codes[0];
|
||||
for (int i = 1; i < codes.Count; i++) {
|
||||
if (previous.opcode == OpCodes.Ldsfld && codes[i].opcode == OpCodes.Callvirt) {
|
||||
Console.WriteLine("Found Ldsfld and Callvirt:");
|
||||
Console.WriteLine(previous);
|
||||
Console.WriteLine(codes[i]);
|
||||
codes.Insert(i + 1,
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(Main), "playersAdded")));
|
||||
codes.Insert(i + 2,
|
||||
new CodeInstruction(OpCodes.Call,
|
||||
AccessTools.PropertyGetter(typeof(Main).GetField("playersAdded").FieldType, "Value")));
|
||||
codes.Insert(i + 3, new CodeInstruction(OpCodes.Add));
|
||||
}
|
||||
|
||||
previous = codes[i];
|
||||
}
|
||||
|
||||
// foreach (var codeInstruction in codes) {
|
||||
// Console.WriteLine(codeInstruction);
|
||||
// }
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
}
|
||||
// endregion
|
||||
}
|
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace DavesPhatStore {
|
||||
[HarmonyPatch]
|
||||
public class EmployeeBuffs {
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(UpgradesManager), "ManageExtraPerks")]
|
||||
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) {
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
|
||||
for (int i = 0; i < codes.Count; i++) {
|
||||
var codeInstruction = codes[i];
|
||||
// if (codeInstruction.operand != null) {
|
||||
// Console.WriteLine($"'{codeInstruction.operand.ToString()}'");
|
||||
// Console.WriteLine(codeInstruction.operand.ToString() == "NPC_Manager::extraEmployeeSpeedFactor");
|
||||
// }
|
||||
|
||||
if (codeInstruction.opcode == OpCodes.Ldfld &&
|
||||
codeInstruction.operand?.ToString() == "System.Int32 maxEmployees") {
|
||||
Console.WriteLine($"Found {codeInstruction.operand}");
|
||||
codes[i + 1].opcode = OpCodes.Nop;
|
||||
codes.Insert(i + 2,
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(Main), "employeePerPerk")));
|
||||
codes.Insert(i + 3,
|
||||
new CodeInstruction(OpCodes.Call,
|
||||
AccessTools.PropertyGetter(typeof(Main).GetField("employeePerPerk").FieldType, "Value")));
|
||||
}
|
||||
|
||||
if (codeInstruction.opcode == OpCodes.Ldfld &&
|
||||
codeInstruction.operand?.ToString() == "System.Single extraEmployeeSpeedFactor") {
|
||||
Console.WriteLine($"Found {codeInstruction.operand}");
|
||||
codes[i + 1].opcode = OpCodes.Nop;
|
||||
codes.Insert(i + 2,
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(Main), "employeeSpeedPerk")));
|
||||
codes.Insert(i + 3,
|
||||
new CodeInstruction(OpCodes.Call,
|
||||
AccessTools.PropertyGetter(typeof(Main).GetField("employeeSpeedPerk").FieldType, "Value")));
|
||||
}
|
||||
|
||||
if (codeInstruction.opcode == OpCodes.Ldfld &&
|
||||
codeInstruction.operand?.ToString() == "System.Single extraCheckoutMoney") {
|
||||
Console.WriteLine($"Found {codeInstruction.operand}");
|
||||
codes[i + 1].opcode = OpCodes.Nop;
|
||||
codes.Insert(i + 2,
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(Main), "employeeExtraMoneyPerk")));
|
||||
codes.Insert(i + 3,
|
||||
new CodeInstruction(OpCodes.Call,
|
||||
AccessTools.PropertyGetter(typeof(Main).GetField("employeeExtraMoneyPerk").FieldType,
|
||||
"Value")));
|
||||
}
|
||||
}
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace DavesPhatStore {
|
||||
[HarmonyPatch]
|
||||
public class PlayerFaking {
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(GameData), "UserCode_CmdOpenSupermarket")]
|
||||
static IEnumerable<CodeInstruction> TranspilerOpenMarket(IEnumerable<CodeInstruction> instructions) {
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
|
||||
// foreach (var codeInstruction in codes) {
|
||||
// Console.WriteLine(codeInstruction);
|
||||
// }
|
||||
|
||||
CodeInstruction previous = codes[0];
|
||||
for (int i = 1; i < codes.Count; i++) {
|
||||
if (previous.opcode == OpCodes.Ldsfld && codes[i].opcode == OpCodes.Callvirt) {
|
||||
Console.WriteLine("Found Ldsfld and Callvirt");
|
||||
Console.WriteLine(previous);
|
||||
Console.WriteLine(codes[i]);
|
||||
codes.Insert(i + 1,
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(Main), "playersAdded")));
|
||||
codes.Insert(i + 2,
|
||||
new CodeInstruction(OpCodes.Call,
|
||||
AccessTools.PropertyGetter(typeof(Main).GetField("playersAdded").FieldType, "Value")));
|
||||
codes.Insert(i + 3, new CodeInstruction(OpCodes.Add));
|
||||
}
|
||||
|
||||
previous = codes[i];
|
||||
}
|
||||
|
||||
// foreach (var codeInstruction in codes) {
|
||||
// Console.WriteLine(codeInstruction);
|
||||
// }
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(typeof(NPC_Manager), "SpawnCustomerNCP")]
|
||||
static IEnumerable<CodeInstruction> TranspilerSpawnNPC(IEnumerable<CodeInstruction> instructions) {
|
||||
var codes = new List<CodeInstruction>(instructions);
|
||||
|
||||
// foreach (var codeInstruction in codes) {
|
||||
// Console.WriteLine(codeInstruction);
|
||||
// }
|
||||
|
||||
CodeInstruction previous = codes[0];
|
||||
for (int i = 1; i < codes.Count; i++) {
|
||||
if (previous.opcode == OpCodes.Ldsfld && codes[i].opcode == OpCodes.Callvirt) {
|
||||
Console.WriteLine("Found Ldsfld and Callvirt:");
|
||||
Console.WriteLine(previous);
|
||||
Console.WriteLine(codes[i]);
|
||||
codes.Insert(i + 1,
|
||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(Main), "playersAdded")));
|
||||
codes.Insert(i + 2,
|
||||
new CodeInstruction(OpCodes.Call,
|
||||
AccessTools.PropertyGetter(typeof(Main).GetField("playersAdded").FieldType, "Value")));
|
||||
codes.Insert(i + 3, new CodeInstruction(OpCodes.Add));
|
||||
}
|
||||
|
||||
previous = codes[i];
|
||||
}
|
||||
|
||||
// foreach (var codeInstruction in codes) {
|
||||
// Console.WriteLine(codeInstruction);
|
||||
// }
|
||||
|
||||
return codes.AsEnumerable();
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,11 +4,11 @@ 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: AssemblyTitle("DavesPhatStore")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Regiments")]
|
||||
[assembly: AssemblyProduct("DavesPhatStore")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
@@ -10,8 +10,8 @@
|
||||
<ProjectGuid>{DA9D274E-486F-4F82-84FF-CD9388CB0B09}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SupermarketTogether</RootNamespace>
|
||||
<AssemblyName>SupermarketTogether</AssemblyName>
|
||||
<RootNamespace>DavesPhatStore</RootNamespace>
|
||||
<AssemblyName>DavesPhatStore</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
@@ -35,8 +35,13 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AutoPricer.cs" />
|
||||
<Compile Include="Class1.cs"/>
|
||||
<Compile Include="EmployeeBuffs.cs" />
|
||||
<Compile Include="PlayerFaking.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs"/>
|
||||
<Compile Include="WaitTimes.cs" />
|
||||
<Compile Include="BuilderDecoration.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
@@ -57,6 +62,12 @@
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>$(GAME_MANAGED)/UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mirror">
|
||||
<HintPath>$(GAME_MANAGED)/Mirror.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PlayMaker">
|
||||
<HintPath>$(GAME_MANAGED)/PlayMaker.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
||||
</Project>
|
||||
|
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DavesPhatStore {
|
||||
[HarmonyPatch]
|
||||
public class WaitTimes : MonoBehaviour {
|
||||
public static List<WeakReference<NPC_Info>> NpcInfos = new List<WeakReference<NPC_Info>>();
|
||||
|
||||
public void init() {
|
||||
InvokeRepeating(nameof(UpdateNpcs), 1f, 0.5f);
|
||||
}
|
||||
|
||||
private static NPC_Info GetNpcInfo(int index) {
|
||||
if (index < 0 || index >= NpcInfos.Count)
|
||||
return null;
|
||||
|
||||
NPC_Info npcInfo;
|
||||
if (NpcInfos[index].TryGetTarget(out npcInfo)) {
|
||||
return npcInfo;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(NPC_Info), MethodType.Constructor)]
|
||||
static void Postfix(NPC_Info __instance) {
|
||||
NpcInfos.Add(new WeakReference<NPC_Info>(__instance));
|
||||
// This does not work for some reason
|
||||
// I'm assuming times are updated by the game whenever the npc decides to do something
|
||||
// __instance.productItemPlaceWait = Main.productItemPlaceWait.Value;
|
||||
// __instance.productCheckoutWait = Main.productCheckoutWait.Value;
|
||||
// __instance.employeeItemPlaceWait = Main.employeeItemPlaceWait.Value;
|
||||
// Console.WriteLine(
|
||||
// $"Updated npc info with values: {__instance.productItemPlaceWait}, {__instance.productCheckoutWait}, {__instance.employeeItemPlaceWait}");
|
||||
}
|
||||
|
||||
public void UpdateNpcs() {
|
||||
Main.productCheckoutWait.Value = Math.Max(Main.productCheckoutWait.Value, 0.02f);
|
||||
Main.productItemPlaceWait.Value = Math.Max(Main.productItemPlaceWait.Value, 0.02f);
|
||||
Main.employeeItemPlaceWait.Value = Math.Max(Main.employeeItemPlaceWait.Value, 0.02f);
|
||||
|
||||
int n = 0;
|
||||
for (var i = 0; i < NpcInfos.Count; i++) {
|
||||
var npcInfo = GetNpcInfo(i);
|
||||
if (npcInfo == null) {
|
||||
NpcInfos.RemoveAt(i);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
n++;
|
||||
npcInfo.productCheckoutWait = Main.productCheckoutWait.Value;
|
||||
npcInfo.productItemPlaceWait = Main.productItemPlaceWait.Value;
|
||||
npcInfo.employeeItemPlaceWait = Main.employeeItemPlaceWait.Value;
|
||||
}
|
||||
|
||||
Console.WriteLine($"Updated {n} npc infos");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1 +1 @@
|
||||
bin/Release/SupermarketTogether.dll,"C:/Program Files (x86)/Steam/steamapps/common/Supermarket Together/BepInEx/plugins/SupermarketTogether.dll"
|
||||
bin/Release/DavesPhatStore.dll,"C:/Program Files (x86)/Steam/steamapps/common/Supermarket Together/BepInEx/plugins/DavesPhatStore.dll"
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
for lib in $(cat libs.txt); do find 'C:\Program Files (x86)\Steam\steamapps\common\Mad Games Tycoon 2' -name "$lib" | sed 's|\\|/|g' | xargs -I% -- cp '%' .; done
|
@@ -1,6 +0,0 @@
|
||||
0Harmony.dll
|
||||
Assembly-CSharp.dll
|
||||
BepInEx.dll
|
||||
ConfigurationManager.dll
|
||||
UnityEngine.CoreModule.dll
|
||||
UnityEngine.dll
|
4
Projects/TavernMaster/AirportCEO.sln.DotSettings.user
Normal file
4
Projects/TavernMaster/AirportCEO.sln.DotSettings.user
Normal file
@@ -0,0 +1,4 @@
|
||||
<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:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" />
|
||||
</AssemblyExplorer></s:String></wpf:ResourceDictionary>
|
@@ -0,0 +1,4 @@
|
||||
<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:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" />
|
||||
</AssemblyExplorer></s:String></wpf:ResourceDictionary>
|
@@ -0,0 +1,4 @@
|
||||
<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:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" />
|
||||
</AssemblyExplorer></s:String></wpf:ResourceDictionary>
|
16
Projects/TavernMaster/TavernMaster.sln
Normal file
16
Projects/TavernMaster/TavernMaster.sln
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TavernMaster", "TavernMaster\TavernMaster.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
|
4
Projects/TavernMaster/TavernMaster.sln.DotSettings.user
Normal file
4
Projects/TavernMaster/TavernMaster.sln.DotSettings.user
Normal file
@@ -0,0 +1,4 @@
|
||||
<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:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" />
|
||||
</AssemblyExplorer></s:String></wpf:ResourceDictionary>
|
6
Projects/TavernMaster/TavernMaster/.editorconfig
Normal file
6
Projects/TavernMaster/TavernMaster/.editorconfig
Normal file
@@ -0,0 +1,6 @@
|
||||
# CSharp formatting rules:
|
||||
[*.cs]
|
||||
csharp_new_line_before_open_brace = none
|
||||
csharp_new_line_before_else = false
|
||||
csharp_new_line_before_catch = false
|
||||
csharp_new_line_before_finally = false
|
@@ -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("DaveCEO")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DaveCEO")]
|
||||
[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")]
|
103
Projects/TavernMaster/TavernMaster/TavernDave.cs
Normal file
103
Projects/TavernMaster/TavernMaster/TavernDave.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using HarmonyLib.Tools;
|
||||
|
||||
namespace TavernDave {
|
||||
[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
|
||||
public class Main : BaseUnityPlugin {
|
||||
private const string pluginGuid = "TavernDave";
|
||||
private const string pluginName = "TavernDave";
|
||||
private const string pluginVersion = "1.0.0";
|
||||
|
||||
public static ConfigEntry<bool> debug;
|
||||
|
||||
public static ConfigEntry<float> moneyMultiplier;
|
||||
public static ConfigEntry<int> fastSpeed;
|
||||
public static ConfigEntry<float> staffXpMultiplier;
|
||||
public static ConfigEntry<float> peoplePerMinuteMultiplier;
|
||||
public static ConfigEntry<float> peoplePerMinuteOffset;
|
||||
public static ConfigEntry<float> prestigeMultiplier;
|
||||
|
||||
public void Awake() {
|
||||
debug = Config.Bind("General", "Debug", false);
|
||||
|
||||
moneyMultiplier = Config.Bind("General", "MoneyMultiplier", 1f);
|
||||
fastSpeed = Config.Bind("General", "FastSpeed", 1);
|
||||
staffXpMultiplier = Config.Bind("General", "StaffXpMultiplier", 1f);
|
||||
peoplePerMinuteMultiplier = Config.Bind("General", "PeoplePerMinuteMultiplier", 1f);
|
||||
peoplePerMinuteOffset = Config.Bind("General", "PeoplePerMinuteOffset", 0f);
|
||||
prestigeMultiplier = Config.Bind("General", "PrestigeMultiplier", 1f);
|
||||
|
||||
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");
|
||||
foreach (var method in originalMethods) {
|
||||
Logger.LogInfo("Patched " + method.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch]
|
||||
public class Patches {
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(TavernModel), "ChangeMoney")]
|
||||
public static void PrefixMoney(ref int value) {
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Money is {value}");
|
||||
if (value > 0) {
|
||||
value = (int)(value * Main.moneyMultiplier.Value);
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Money modified to {value}");
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(UiController), "ChangeGameSpeed")]
|
||||
public static void PrefixSpeed(ref int gameSpeed) {
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Game speed is {gameSpeed}");
|
||||
if (gameSpeed > 1) {
|
||||
gameSpeed = Main.fastSpeed.Value;
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Game speed modified to {gameSpeed}");
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StaffModel), "UpdateXp")]
|
||||
public static void PrefixXp(ref int id, ref int amount) {
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Staff xp is {amount}");
|
||||
if (amount > 0) {
|
||||
amount = (int)(amount * Main.staffXpMultiplier.Value);
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Staff xp modified to {amount}");
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(TechTreeModel), nameof(TechTreeModel.GetBonusPeoplePerMinute))]
|
||||
public static void PostfixPeoplePerMinute(ref float __result) {
|
||||
__result *= Main.peoplePerMinuteMultiplier.Value;
|
||||
__result += Main.peoplePerMinuteOffset.Value;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(TavernModel), nameof(TavernModel.GetQuality))]
|
||||
public static void PostfixQuality(ref int __result) {
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Quality is {__result}");
|
||||
if (__result > 0) {
|
||||
__result = (int)(__result * Main.prestigeMultiplier.Value);
|
||||
if (Main.debug.Value)
|
||||
Console.WriteLine($"Quality modified to {__result}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
62
Projects/TavernMaster/TavernMaster/TavernMaster.csproj
Normal file
62
Projects/TavernMaster/TavernMaster/TavernMaster.csproj
Normal file
@@ -0,0 +1,62 @@
|
||||
<?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>
|
||||
<GAME_DIR>C:/Games/Tavern Master</GAME_DIR>
|
||||
<GAME_MANAGED>$(GAME_DIR)/Tavern Master_Data/Managed</GAME_MANAGED>
|
||||
<GAME_BEPINEX>$(GAME_DIR)/BepInEx</GAME_BEPINEX>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{DA9D274E-486F-4F82-84FF-CD9388CB0B09}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TavernDave</RootNamespace>
|
||||
<AssemblyName>TavernDave</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>
|
||||
<Compile Include="TavernDave.cs"/>
|
||||
<Compile Include="Properties\AssemblyInfo.cs"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>$(GAME_BEPINEX)/core/0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BepInEx">
|
||||
<HintPath>$(GAME_BEPINEX)/core/BepInEx.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ConfigurationManager">
|
||||
<HintPath>$(GAME_BEPINEX)/plugins/ConfigurationManager/ConfigurationManager.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>$(GAME_MANAGED)/Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>$(GAME_MANAGED)/UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>$(GAME_MANAGED)/UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
||||
</Project>
|
1
Projects/TavernMaster/TavernMaster/sync
Normal file
1
Projects/TavernMaster/TavernMaster/sync
Normal file
@@ -0,0 +1 @@
|
||||
bin/Release/TavernDave.dll,"C:\Games\Tavern Master\BepInEx\plugins\TavernDave.dll"
|
BIN
sinai-dev-UnityExplorer/UnityExplorer.BIE5.Mono.dll
Normal file
BIN
sinai-dev-UnityExplorer/UnityExplorer.BIE5.Mono.dll
Normal file
Binary file not shown.
BIN
sinai-dev-UnityExplorer/UniverseLib.Mono.dll
Normal file
BIN
sinai-dev-UnityExplorer/UniverseLib.Mono.dll
Normal file
Binary file not shown.
Reference in New Issue
Block a user