30 Commits

Author SHA1 Message Date
b8b06f2efe Add debug option 2024-09-26 15:25:28 +02:00
be05eb013e Fix quality patch 2024-09-26 15:24:44 +02:00
8fc5fa8c26 Add config manager bindings 2024-09-26 15:17:02 +02:00
4eee4d89e3 More peoples and more prestiges 2024-09-26 15:16:01 +02:00
6d782ef9ed Add xp patch 2024-09-26 14:44:45 +02:00
0a48ce2f63 Fix issue with game speed patch 2024-09-26 14:41:13 +02:00
1e479005a1 Add logs to taverndave 2024-09-26 14:40:09 +02:00
bdf34571be Add speed modifier to tavernmaster 2024-09-26 14:38:32 +02:00
2f42e410e8 Update airportceo 2024-09-26 14:36:07 +02:00
64b52c0e95 Add tavernmaster 2024-09-26 14:36:07 +02:00
bbe92da556 Add airportCEO 2024-08-24 21:17:30 +02:00
d32cda849e Add supermarket simulator 2024-08-24 21:15:12 +02:00
a48fc8ad10 Add unity explorer 2024-08-24 21:15:09 +02:00
d8d717c53a Add failed builderdecoration 2024-08-23 21:41:30 +02:00
0ee56fc7b1 Enable setting prices even when they're the same 2024-08-23 21:41:24 +02:00
a87821f2ad Implement auto pricer
Sets prices to price * multiplier automatically
2024-08-23 12:16:07 +02:00
74668188ce Add editorconfig 2024-08-23 12:15:46 +02:00
72c9b4baa3 Begin work on auto pricer 2024-08-23 09:19:37 +02:00
762a1707af Refactor employee patches 2024-08-23 09:18:25 +02:00
a0edd9edec Refactor player faking 2024-08-23 09:12:28 +02:00
59e94959da Refactor wait times into their own class 2024-08-23 09:10:45 +02:00
454939d0eb Fix sync script 2024-08-22 20:10:20 +02:00
00a9ad69bb Rename assembly names 2024-08-22 20:07:27 +02:00
b4eb299415 Add mirror 2024-08-22 20:05:12 +02:00
92cb8b7ca4 Add patch for manipulating npc wait timers 2024-08-22 20:03:49 +02:00
ed67c49c04 Add patch for employee extra money 2024-08-22 19:25:41 +02:00
f216cfddb3 Rework employee speed perk patch 2024-08-22 19:24:29 +02:00
12c4be7c10 Make employee perk transpile more robust 2024-08-22 19:21:48 +02:00
42acdd9204 Add config for employee per perk 2024-08-22 19:11:43 +02:00
2876c0c41b Remove libs 2024-08-22 16:01:32 +02:00
47 changed files with 1116 additions and 102 deletions

View 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

View 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">&lt;AssemblyExplorer&gt;&#xD;
&lt;Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" /&gt;&#xD;
&lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary>

View 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

View 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>

View 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;
}
}
}

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("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")]

View File

@@ -0,0 +1 @@
bin/Release/DaveCEO.dll,"C:\Games\Airport CEO\BepInEx\plugins\DaveCEO.dll"

View 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">&lt;AssemblyExplorer&gt;&#xD;
&lt;Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" /&gt;&#xD;
&lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary>

View 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">&lt;AssemblyExplorer&gt;&#xD;
&lt;Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" /&gt;&#xD;
&lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary>

View 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

View 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">&lt;AssemblyExplorer&gt;&#xD;
&lt;Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" /&gt;&#xD;
&lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary>

View 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

View 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;
}
}
}
}

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("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")]

View File

@@ -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>

View File

@@ -0,0 +1 @@
bin/Release/DavesPhatStore.dll,"C:\Games\Supermarket Simulator\BepInEx\plugins\DavesPhatStore.dll"

View 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">&lt;AssemblyExplorer&gt;&#xD;
&lt;Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" /&gt;&#xD;
&lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary>

View 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

View 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;
}
}
}

View File

@@ -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());
// }
}
}

View File

@@ -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
}

View File

@@ -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();
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -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("")]

View File

@@ -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>

View File

@@ -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");
}
}
}

View File

@@ -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"

View File

@@ -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

View File

@@ -1,6 +0,0 @@
0Harmony.dll
Assembly-CSharp.dll
BepInEx.dll
ConfigurationManager.dll
UnityEngine.CoreModule.dll
UnityEngine.dll

View 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">&lt;AssemblyExplorer&gt;&#xD;
&lt;Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" /&gt;&#xD;
&lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary>

View 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">&lt;AssemblyExplorer&gt;&#xD;
&lt;Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" /&gt;&#xD;
&lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary>

View 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">&lt;AssemblyExplorer&gt;&#xD;
&lt;Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" /&gt;&#xD;
&lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary>

View 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

View 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">&lt;AssemblyExplorer&gt;&#xD;
&lt;Assembly Path="C:\Users\Administrator\RiderProjects\Bepinex\Projects\SupermarketTogether\SupermarketTogether\bin\Release\Assembly-CSharp.dll" /&gt;&#xD;
&lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary>

View 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

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("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")]

View 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}");
}
}
}
}

View 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>

View File

@@ -0,0 +1 @@
bin/Release/TavernDave.dll,"C:\Games\Tavern Master\BepInEx\plugins\TavernDave.dll"

Binary file not shown.

Binary file not shown.