using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using StarterAssets;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SMTTrainer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+84470f845000279c7cb5121933fb84a37b750ec3")]
[assembly: AssemblyProduct("SuperMarketTogetherTrainer")]
[assembly: AssemblyTitle("SMTTrainer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace SMTTrainer
{
public class ConfigurationManagerAttributes
{
public bool? Browsable = false;
}
public class CheckoutManager
{
private readonly ConfigEntry<float> _checkoutMultiplierConfig;
private readonly ManualLogSource _logger;
private Rect _windowRect = new Rect(0f, 0f, 300f, 150f);
private bool _showWindow;
private bool _settingsApplied = false;
public CheckoutManager(ConfigFile config, ManualLogSource logger)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
_logger = logger;
_checkoutMultiplierConfig = config.Bind<float>("Checkout Settings", "Checkout Multiplier", 1f, new ConfigDescription("Multiplier for checkout payments", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
}
public void SetWindowVisibility(bool visible)
{
_showWindow = visible;
}
public void DrawWindow()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (_showWindow)
{
_windowRect = GUILayout.Window(3, _windowRect, new WindowFunction(DrawWindowContent), "Checkout Trainer", Array.Empty<GUILayoutOption>());
((Rect)(ref _windowRect)).x = ((float)Screen.width - ((Rect)(ref _windowRect)).width) / 2f;
((Rect)(ref _windowRect)).y = ((float)Screen.height - ((Rect)(ref _windowRect)).height) / 2f;
}
}
private void DrawWindowContent(int windowID)
{
GUILayout.Label($"Checkout Multiplier: {_checkoutMultiplierConfig.Value}", Array.Empty<GUILayoutOption>());
GUILayout.Label("Set Checkout Multiplier:", Array.Empty<GUILayoutOption>());
_checkoutMultiplierConfig.Value = GUILayout.HorizontalSlider(_checkoutMultiplierConfig.Value, 0.5f, 5f, Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Apply Settings", Array.Empty<GUILayoutOption>()))
{
ApplySettings();
}
GUI.DragWindow();
}
public void Update()
{
if (!_settingsApplied && (Object)(object)NPC_Manager.Instance != (Object)null)
{
ApplySettings();
_settingsApplied = true;
}
}
private void ApplySettings()
{
if ((Object)(object)NPC_Manager.Instance != (Object)null)
{
NPC_Manager.Instance.extraCheckoutMoney = _checkoutMultiplierConfig.Value;
_logger.LogInfo((object)"Checkout settings applied.");
}
else
{
_logger.LogWarning((object)"NPC_Manager.Instance is null, can't apply checkout settings.");
}
}
}
public class CostManager
{
private readonly ConfigEntry<float> _lightCostMultiplierConfig;
private readonly ConfigEntry<float> _rentCostMultiplierConfig;
private readonly ConfigEntry<float> _employeesCostMultiplierConfig;
private readonly ManualLogSource _logger;
private Rect _windowRect = new Rect(0f, 0f, 300f, 200f);
private bool _showWindow;
private bool _settingsApplied = false;
public CostManager(ConfigFile config, ManualLogSource logger)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected O, but got Unknown
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Expected O, but got Unknown
_logger = logger;
_lightCostMultiplierConfig = config.Bind<float>("Cost Settings", "Light Cost Multiplier", 1f, new ConfigDescription("Multiplier for light costs", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
_rentCostMultiplierConfig = config.Bind<float>("Cost Settings", "Rent Cost Multiplier", 1f, new ConfigDescription("Multiplier for rent costs", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
_employeesCostMultiplierConfig = config.Bind<float>("Cost Settings", "Employees Cost Multiplier", 1f, new ConfigDescription("Multiplier for employees costs", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
}
public void SetWindowVisibility(bool visible)
{
_showWindow = visible;
}
public void DrawWindow()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (_showWindow)
{
_windowRect = GUILayout.Window(4, _windowRect, new WindowFunction(DrawWindowContent), "Cost Trainer", Array.Empty<GUILayoutOption>());
((Rect)(ref _windowRect)).x = ((float)Screen.width - ((Rect)(ref _windowRect)).width) / 2f;
((Rect)(ref _windowRect)).y = ((float)Screen.height - ((Rect)(ref _windowRect)).height) / 2f;
}
}
private void DrawWindowContent(int windowID)
{
GUILayout.Label($"Light Cost Multiplier: {_lightCostMultiplierConfig.Value}", Array.Empty<GUILayoutOption>());
_lightCostMultiplierConfig.Value = GUILayout.HorizontalSlider(_lightCostMultiplierConfig.Value, 0.5f, 5f, Array.Empty<GUILayoutOption>());
GUILayout.Label($"Rent Cost Multiplier: {_rentCostMultiplierConfig.Value}", Array.Empty<GUILayoutOption>());
_rentCostMultiplierConfig.Value = GUILayout.HorizontalSlider(_rentCostMultiplierConfig.Value, 0.5f, 5f, Array.Empty<GUILayoutOption>());
GUILayout.Label($"Employees Cost Multiplier: {_employeesCostMultiplierConfig.Value}", Array.Empty<GUILayoutOption>());
_employeesCostMultiplierConfig.Value = GUILayout.HorizontalSlider(_employeesCostMultiplierConfig.Value, 0.5f, 5f, Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Apply Settings", Array.Empty<GUILayoutOption>()))
{
ApplySettings();
}
GUI.DragWindow();
}
public void Update()
{
if (!_settingsApplied && (Object)(object)GameData.Instance != (Object)null)
{
ApplySettings();
_settingsApplied = true;
}
}
private void ApplySettings()
{
if ((Object)(object)GameData.Instance != (Object)null)
{
UpgradesManager component = ((Component)GameData.Instance).GetComponent<UpgradesManager>();
GameData.Instance.lightCost = (10f + (float)component.spaceBought + (float)component.storageBought) * _lightCostMultiplierConfig.Value;
GameData.Instance.rentCost = (15f + (float)(component.spaceBought * 5) + (float)(component.storageBought * 10)) * _rentCostMultiplierConfig.Value;
GameData.Instance.employeesCost = (float)(NPC_Manager.Instance.maxEmployees * 60) * _employeesCostMultiplierConfig.Value;
_logger.LogInfo((object)"Cost settings applied.");
_logger.LogInfo((object)$"Applied settings: lightCost={GameData.Instance.lightCost}, rentCost={GameData.Instance.rentCost}, employeesCost={GameData.Instance.employeesCost}");
}
else
{
_logger.LogWarning((object)"GameData.Instance is null, can't apply cost settings.");
}
}
}
public class EmployeesManager
{
private readonly ConfigEntry<int> _maxEmployeesConfig;
private readonly ConfigEntry<float> _employeeSpeedConfig;
private readonly ManualLogSource _logger;
private Rect _windowRect = new Rect(0f, 0f, 300f, 150f);
private bool _showWindow;
private bool _settingsApplied = false;
public EmployeesManager(ConfigFile config, ManualLogSource logger)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
_logger = logger;
_maxEmployeesConfig = config.Bind<int>("Employee Settings", "Max Employees", 1, new ConfigDescription("Maximum number of employees", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
_employeeSpeedConfig = config.Bind<float>("Employee Settings", "Employee Speed Factor", 0f, new ConfigDescription("Speed factor for employees", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
}
public void SetWindowVisibility(bool visible)
{
_showWindow = visible;
}
public void DrawWindow()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (_showWindow)
{
_windowRect = GUILayout.Window(2, _windowRect, new WindowFunction(DrawWindowContent), "Employees Trainer", Array.Empty<GUILayoutOption>());
((Rect)(ref _windowRect)).x = ((float)Screen.width - ((Rect)(ref _windowRect)).width) / 2f;
((Rect)(ref _windowRect)).y = ((float)Screen.height - ((Rect)(ref _windowRect)).height) / 2f;
}
}
private void DrawWindowContent(int windowID)
{
GUILayout.Label($"Max Employees: {_maxEmployeesConfig.Value}", Array.Empty<GUILayoutOption>());
GUILayout.Label($"Employee Speed Factor: {_employeeSpeedConfig.Value}", Array.Empty<GUILayoutOption>());
GUILayout.Label("Set Max Employees:", Array.Empty<GUILayoutOption>());
_maxEmployeesConfig.Value = (int)GUILayout.HorizontalSlider((float)_maxEmployeesConfig.Value, 1f, 100f, Array.Empty<GUILayoutOption>());
GUILayout.Label("Set Employee Speed Factor:", Array.Empty<GUILayoutOption>());
_employeeSpeedConfig.Value = GUILayout.HorizontalSlider(_employeeSpeedConfig.Value, 0.1f, 5f, Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Apply Settings", Array.Empty<GUILayoutOption>()))
{
ApplySettings();
}
GUI.DragWindow();
}
public void Update()
{
if (!_settingsApplied && (Object)(object)NPC_Manager.Instance != (Object)null)
{
ApplySettings();
_settingsApplied = true;
}
}
private void ApplySettings()
{
if ((Object)(object)NPC_Manager.Instance != (Object)null)
{
NPC_Manager.Instance.maxEmployees = _maxEmployeesConfig.Value;
NPC_Manager.Instance.extraEmployeeSpeedFactor = _employeeSpeedConfig.Value;
NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
_logger.LogInfo((object)"Employee settings applied.");
}
else
{
_logger.LogWarning((object)"NPC_Manager.Instance is null, can't apply employee settings.");
}
}
}
public class FunManager
{
public readonly ConfigEntry<bool> _disableTrashGenerationConfig;
private readonly ManualLogSource _logger;
private Rect _windowRect = new Rect(0f, 0f, 300f, 150f);
private bool _showWindow;
public FunManager(ConfigFile config, ManualLogSource logger)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Expected O, but got Unknown
_logger = logger;
_disableTrashGenerationConfig = config.Bind<bool>("Trash Settings(Only Host!!!)", "Disable Trash Generation", false, new ConfigDescription("Enable or disable automatic trash generation in the game.", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
}
public void SetWindowVisibility(bool visible)
{
_showWindow = visible;
}
public void DrawWindow()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (_showWindow)
{
_windowRect = GUILayout.Window(6, _windowRect, new WindowFunction(DrawWindowContent), "Fun Manager", Array.Empty<GUILayoutOption>());
((Rect)(ref _windowRect)).x = ((float)Screen.width - ((Rect)(ref _windowRect)).width) / 2f;
((Rect)(ref _windowRect)).y = ((float)Screen.height - ((Rect)(ref _windowRect)).height) / 2f;
}
}
private void DrawWindowContent(int windowID)
{
_disableTrashGenerationConfig.Value = GUILayout.Toggle(_disableTrashGenerationConfig.Value, "Disable Trash Generation|Only Host!!!", Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Generate Random Trash (1-5)|Only Host!!!", Array.Empty<GUILayoutOption>()))
{
GenerateRandomTrash();
}
GUI.DragWindow();
}
private void GenerateRandomTrash()
{
if ((Object)(object)GameData.Instance != (Object)null)
{
int num = Random.Range(1, 6);
for (int i = 0; i < num; i++)
{
StartCoroutineForceSpawnTrash();
}
_logger.LogInfo((object)$"Generated {num} pieces of trash.");
}
else
{
_logger.LogWarning((object)"GameData.Instance is null, can't generate trash.");
}
}
private void StartCoroutineForceSpawnTrash()
{
if ((Object)(object)GameData.Instance != (Object)null)
{
MethodInfo method = typeof(GameData).GetMethod("SpawnTrash", BindingFlags.Instance | BindingFlags.NonPublic);
if (method != null)
{
IEnumerator enumerator = (IEnumerator)method.Invoke(GameData.Instance, null);
((MonoBehaviour)Plugin.Instance).StartCoroutine(enumerator);
}
else
{
_logger.LogError((object)"Failed to find SpawnTrash method via reflection.");
}
}
}
public void Update()
{
}
}
[HarmonyPatch(typeof(GameData), "TrashManager")]
public static class TrashManagerPatch
{
private static bool Prefix()
{
if (Plugin.Instance.FunManager._disableTrashGenerationConfig.Value)
{
return false;
}
return true;
}
}
public class GlobalManager
{
private readonly ConfigEntry<float> _timeConfig;
public ConfigEntry<bool> _lockTimeConfig;
private readonly ManualLogSource _logger;
private Rect _windowRect = new Rect(0f, 0f, 300f, 150f);
private bool _showWindow;
private string _tempTimeInput = "12:00";
private float _lockedTime = -1f;
public GlobalManager(ConfigFile config, ManualLogSource logger)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Expected O, but got Unknown
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
_logger = logger;
_timeConfig = config.Bind<float>("Global", "Time", 12f, new ConfigDescription("Current game time in hours, e.g., 12.5 = 12:30", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
_lockTimeConfig = config.Bind<bool>("Global", "Lock Time", false, new ConfigDescription("Lock the time at the current value", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
}
public void SetWindowVisibility(bool visible)
{
_showWindow = visible;
}
public void DrawWindow()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (_showWindow)
{
_windowRect = GUILayout.Window(5, _windowRect, new WindowFunction(DrawWindowContent), "Global Time Trainer", Array.Empty<GUILayoutOption>());
((Rect)(ref _windowRect)).x = ((float)Screen.width - ((Rect)(ref _windowRect)).width) / 2f;
((Rect)(ref _windowRect)).y = ((float)Screen.height - ((Rect)(ref _windowRect)).height) / 2f;
}
}
private void DrawWindowContent(int windowID)
{
GameData instance = GameData.Instance;
GUILayout.Label("Current Time: " + ConvertTimeToDisplay((instance != null) ? instance.NetworktimeOfDay : _timeConfig.Value), Array.Empty<GUILayoutOption>());
GUILayout.Label("Set Time (format HH:MM):", Array.Empty<GUILayoutOption>());
_tempTimeInput = GUILayout.TextField(_tempTimeInput, Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Confirm", Array.Empty<GUILayoutOption>()))
{
if (TryParseTimeInput(_tempTimeInput, out var parsedTime))
{
SetGameTime(parsedTime);
_logger.LogInfo((object)$"Time set to: {_tempTimeInput} (float value: {parsedTime})");
}
else
{
_logger.LogError((object)"Invalid time input. Please use HH:MM format.");
}
}
bool flag = GUILayout.Toggle(_lockTimeConfig.Value, "Lock Time", Array.Empty<GUILayoutOption>());
GUILayout.Label("The store can only be opened and closed if the time is correct.", Array.Empty<GUILayoutOption>());
GUILayout.Label("Open time:8:00; Closing time:22:30", Array.Empty<GUILayoutOption>());
if (flag != _lockTimeConfig.Value)
{
_lockTimeConfig.Value = flag;
if (flag)
{
_lockedTime = GameData.Instance.NetworktimeOfDay;
_logger.LogInfo((object)("Time locked at: " + ConvertTimeToDisplay(_lockedTime)));
}
else
{
_lockedTime = -1f;
_logger.LogInfo((object)"Time unlocked.");
}
}
GUI.DragWindow();
}
private void SetGameTime(float newTime)
{
if ((Object)(object)GameData.Instance != (Object)null)
{
_timeConfig.Value = newTime;
GameData.Instance.NetworktimeOfDay = newTime;
}
else
{
_logger.LogWarning((object)"GameData.Instance is null, can't set game time.");
}
}
private string ConvertTimeToDisplay(float timeValue)
{
int num = Mathf.FloorToInt(timeValue);
int num2 = Mathf.FloorToInt((timeValue - (float)num) * 60f);
return $"{num:D2}:{num2:D2}";
}
private bool TryParseTimeInput(string timeInput, out float parsedTime)
{
parsedTime = 0f;
string[] array = timeInput.Split(':');
if (array.Length != 2)
{
return false;
}
if (int.TryParse(array[0], out var result) && int.TryParse(array[1], out var result2) && result >= 0 && result < 24 && result2 >= 0 && result2 < 60)
{
parsedTime = (float)result + (float)result2 / 60f;
return true;
}
return false;
}
public void Update()
{
if (_lockTimeConfig.Value && (Object)(object)GameData.Instance != (Object)null && _lockedTime >= 0f)
{
GameData.Instance.NetworktimeOfDay = _lockedTime;
}
}
}
public class GoldManager
{
private readonly ConfigEntry<int> _goldAmountConfig;
private readonly ManualLogSource _logger;
private Rect _windowRect = new Rect(0f, 0f, 300f, 150f);
private bool _showWindow;
private string _tempGoldAmount;
public GoldManager(ConfigFile config, ManualLogSource logger)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
_logger = logger;
_goldAmountConfig = config.Bind<int>("Gold", "Add Gold Amount", 1000, new ConfigDescription("The amount of gold to add in the game", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
_tempGoldAmount = _goldAmountConfig.Value.ToString();
}
public void SetWindowVisibility(bool visible)
{
_showWindow = visible;
}
public void DrawWindow()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (_showWindow)
{
_windowRect = GUILayout.Window(0, _windowRect, new WindowFunction(DrawWindowContent), "Gold Trainer", Array.Empty<GUILayoutOption>());
((Rect)(ref _windowRect)).x = ((float)Screen.width - ((Rect)(ref _windowRect)).width) / 2f;
((Rect)(ref _windowRect)).y = ((float)Screen.height - ((Rect)(ref _windowRect)).height) / 2f;
}
}
private void DrawWindowContent(int windowID)
{
GUILayout.Label($"Last added Gold: {_goldAmountConfig.Value}", Array.Empty<GUILayoutOption>());
GUILayout.Label("Add Gold Amount:", Array.Empty<GUILayoutOption>());
_tempGoldAmount = GUILayout.TextField(_tempGoldAmount, Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Confirm", Array.Empty<GUILayoutOption>()))
{
if (int.TryParse(_tempGoldAmount, out var result))
{
SetGoldAmount(result);
_goldAmountConfig.Value = result;
}
else
{
_logger.LogError((object)"Invalid input! Please enter a valid integer for the gold amount.");
}
}
GUI.DragWindow();
}
private void SetGoldAmount(int newAmount)
{
if ((Object)(object)GameData.Instance != (Object)null)
{
GameData.Instance.CmdAlterFundsWithoutExperience((float)newAmount);
_logger.LogInfo((object)$"Gold in game set to: {newAmount}");
}
else
{
_logger.LogWarning((object)"GameData.Instance is null, can't set gold.");
}
}
}
public class MoveManager
{
private readonly ConfigEntry<float> _walkSpeedConfig;
private readonly ConfigEntry<float> _sprintSpeedConfig;
private readonly ConfigEntry<float> _airSpeedConfig;
private readonly ConfigEntry<float> _crouchSpeedConfig;
private readonly ManualLogSource _logger;
private Rect _windowRect = new Rect(0f, 0f, 300f, 300f);
private bool _showWindow;
private float _tempWalkSpeed;
private float _tempSprintSpeed;
private float _tempAirSpeed;
private float _tempCrouchSpeed;
public MoveManager(ConfigFile config, ManualLogSource logger)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Expected O, but got Unknown
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Expected O, but got Unknown
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
_logger = logger;
_walkSpeedConfig = config.Bind<float>("Move", "Walk Speed", 5f, new ConfigDescription("Default Walk Speed", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
_sprintSpeedConfig = config.Bind<float>("Move", "Sprint Speed", 10f, new ConfigDescription("Default Sprint Speed", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
_airSpeedConfig = config.Bind<float>("Move", "Air Speed", 3f, new ConfigDescription("Default Air Speed", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
_crouchSpeedConfig = config.Bind<float>("Move", "Crouch Speed", 4f, new ConfigDescription("Default Crouch Speed", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
_tempWalkSpeed = _walkSpeedConfig.Value;
_tempSprintSpeed = _sprintSpeedConfig.Value;
_tempAirSpeed = _airSpeedConfig.Value;
_tempCrouchSpeed = _crouchSpeedConfig.Value;
}
public void SetWindowVisibility(bool visible)
{
_showWindow = visible;
}
public void DrawWindow()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (_showWindow)
{
_windowRect = GUILayout.Window(2, _windowRect, new WindowFunction(DrawWindowContent), "Move Speed Manager", Array.Empty<GUILayoutOption>());
((Rect)(ref _windowRect)).x = ((float)Screen.width - ((Rect)(ref _windowRect)).width) / 2f;
((Rect)(ref _windowRect)).y = ((float)Screen.height - ((Rect)(ref _windowRect)).height) / 2f + 30f;
}
}
private void DrawWindowContent(int windowID)
{
GUILayout.Label($"Current Walk Speed: {_tempWalkSpeed:F2}", Array.Empty<GUILayoutOption>());
_tempWalkSpeed = GUILayout.HorizontalSlider(_tempWalkSpeed, 5f, 20f, Array.Empty<GUILayoutOption>());
GUILayout.Label($"Current Sprint Speed: {_tempSprintSpeed:F2}", Array.Empty<GUILayoutOption>());
_tempSprintSpeed = GUILayout.HorizontalSlider(_tempSprintSpeed, 10f, 20f, Array.Empty<GUILayoutOption>());
GUILayout.Label($"Current Air Speed: {_tempAirSpeed:F2}", Array.Empty<GUILayoutOption>());
_tempAirSpeed = GUILayout.HorizontalSlider(_tempAirSpeed, 3f, 20f, Array.Empty<GUILayoutOption>());
GUILayout.Label($"Current Crouch Speed: {_tempCrouchSpeed:F2}", Array.Empty<GUILayoutOption>());
_tempCrouchSpeed = GUILayout.HorizontalSlider(_tempCrouchSpeed, 4f, 20f, Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Confirm", Array.Empty<GUILayoutOption>()))
{
ApplySpeedSettings();
}
GUI.DragWindow();
}
private void ApplySpeedSettings()
{
_walkSpeedConfig.Value = _tempWalkSpeed;
_sprintSpeedConfig.Value = _tempSprintSpeed;
_airSpeedConfig.Value = _tempAirSpeed;
_crouchSpeedConfig.Value = _tempCrouchSpeed;
if ((Object)(object)FirstPersonController.Instance != (Object)null)
{
FirstPersonController.Instance.MoveSpeed = _walkSpeedConfig.Value;
FirstPersonController.Instance.SprintSpeed = _sprintSpeedConfig.Value;
FirstPersonController.Instance.airSpeed = _airSpeedConfig.Value;
FirstPersonController.Instance.CrouchSpeed = _crouchSpeedConfig.Value;
_logger.LogInfo((object)"Move speeds updated successfully.");
}
else
{
_logger.LogWarning((object)"FirstPersonController.Instance is null, unable to apply move speeds.");
}
}
}
[BepInPlugin("SMTTrainer", "SuperMarketTogetherTrainer", "1.1.0")]
[BepInProcess("Supermarket Together.exe")]
public class Plugin : BaseUnityPlugin
{
public static Plugin Instance;
private ConfigEntry<bool> _isGoldWindowEnabled;
private ConfigEntry<bool> _isPointWindowEnabled;
private ConfigEntry<bool> _isEmployeesWindowEnabled;
private ConfigEntry<bool> _isCheckoutWindowEnabled;
private ConfigEntry<bool> _isCostWindowEnabled;
private ConfigEntry<bool> _isGlobalWindowEnabled;
private ConfigEntry<bool> _isFunWindowEnabled;
private ConfigEntry<bool> _isMoveWindowEnabled;
private GoldManager _goldManager;
private PointManager _pointManager;
private EmployeesManager _employeesManager;
private CheckoutManager _checkoutManager;
private CostManager _costManager;
private Harmony _harmony;
public GlobalManager GlobalManager { get; private set; }
public FunManager FunManager { get; private set; }
public MoveManager MoveManager { get; private set; }
private void Awake()
{
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02ab: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SMTTrainer is loaded!");
_goldManager = new GoldManager(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger);
_pointManager = new PointManager(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger);
_employeesManager = new EmployeesManager(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger);
_checkoutManager = new CheckoutManager(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger);
_costManager = new CostManager(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger);
GlobalManager = new GlobalManager(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger);
FunManager = new FunManager(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger);
MoveManager = new MoveManager(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger);
_isGoldWindowEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Trainer", "Gold Trainer", false, "Enable or disable the display of the Gold Trainer window.");
_isPointWindowEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Trainer", "Point Trainer", false, "Enable or disable the display of the Point Trainer window.");
_isEmployeesWindowEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Trainer", "Employees Trainer(Host)", false, "Enable or disable the display of the Employees Trainer window.");
_isCheckoutWindowEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Trainer", "Checkout Trainer(Host)", false, "Enable or disable the display of the Checkout Trainer window.");
_isCostWindowEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Trainer", "Cost Trainer(Maybe Not Run!!)", false, "Maybe Not Run!!! Enable or disable the display of the Cost Trainer window.");
_isGlobalWindowEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Trainer", "Global Time Trainer(Host)", false, "Enable or disable the display of the Global Time Trainer window.");
_isFunWindowEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Trainer", "Fun Manager(Host)", false, "Enable or disable the display of the Fun Manager window.");
_isMoveWindowEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Trainer", "Move Manager", false, "Enable or disable the display of the Move Manager window.");
Instance = this;
_isGoldWindowEnabled.SettingChanged += OnGoldWindowEnableChanged;
_isPointWindowEnabled.SettingChanged += OnPointWindowEnableChanged;
_isEmployeesWindowEnabled.SettingChanged += OnEmployeesWindowEnableChanged;
_isCheckoutWindowEnabled.SettingChanged += OnCheckoutWindowEnableChanged;
_isCostWindowEnabled.SettingChanged += OnCostWindowEnableChanged;
_isGlobalWindowEnabled.SettingChanged += OnGlobalWindowEnableChanged;
_isFunWindowEnabled.SettingChanged += OnFunWindowEnableChanged;
_isMoveWindowEnabled.SettingChanged += OnMoveWindowEnableChanged;
_harmony = new Harmony("SMTTrainer");
_harmony.PatchAll();
}
private void OnGoldWindowEnableChanged(object sender, EventArgs e)
{
_goldManager.SetWindowVisibility(_isGoldWindowEnabled.Value);
}
private void OnPointWindowEnableChanged(object sender, EventArgs e)
{
_pointManager.SetWindowVisibility(_isPointWindowEnabled.Value);
}
private void OnEmployeesWindowEnableChanged(object sender, EventArgs e)
{
_employeesManager.SetWindowVisibility(_isEmployeesWindowEnabled.Value);
}
private void OnCheckoutWindowEnableChanged(object sender, EventArgs e)
{
_checkoutManager.SetWindowVisibility(_isCheckoutWindowEnabled.Value);
}
private void OnCostWindowEnableChanged(object sender, EventArgs e)
{
_costManager.SetWindowVisibility(_isCostWindowEnabled.Value);
}
private void OnGlobalWindowEnableChanged(object sender, EventArgs e)
{
GlobalManager.SetWindowVisibility(_isGlobalWindowEnabled.Value);
}
private void OnFunWindowEnableChanged(object sender, EventArgs e)
{
FunManager.SetWindowVisibility(_isFunWindowEnabled.Value);
}
private void OnMoveWindowEnableChanged(object sender, EventArgs e)
{
MoveManager.SetWindowVisibility(_isMoveWindowEnabled.Value);
}
private void OnGUI()
{
if (_isGoldWindowEnabled.Value)
{
_goldManager.DrawWindow();
}
if (_isPointWindowEnabled.Value)
{
_pointManager.DrawWindow();
}
if (_isEmployeesWindowEnabled.Value)
{
_employeesManager.DrawWindow();
}
if (_isCheckoutWindowEnabled.Value)
{
_checkoutManager.DrawWindow();
}
if (_isCostWindowEnabled.Value)
{
_costManager.DrawWindow();
}
if (_isGlobalWindowEnabled.Value)
{
GlobalManager.DrawWindow();
}
if (_isFunWindowEnabled.Value)
{
FunManager.DrawWindow();
}
if (_isMoveWindowEnabled.Value)
{
MoveManager.DrawWindow();
}
}
private void Update()
{
_employeesManager.Update();
_checkoutManager.Update();
_costManager.Update();
GlobalManager.Update();
FunManager.Update();
}
}
public class PointManager
{
private readonly ConfigEntry<int> _pointAmountConfig;
private readonly ManualLogSource _logger;
private Rect _windowRect = new Rect(0f, 0f, 300f, 150f);
private bool _showWindow;
private string _tempPointAmount;
public PointManager(ConfigFile config, ManualLogSource logger)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Expected O, but got Unknown
_logger = logger;
_pointAmountConfig = config.Bind<int>("Point", "Set Point Amount", 1, new ConfigDescription("The amount of points to set in the game", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
_tempPointAmount = _pointAmountConfig.Value.ToString();
}
public void SetWindowVisibility(bool visible)
{
_showWindow = visible;
}
public void DrawWindow()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (_showWindow)
{
_windowRect = GUILayout.Window(1, _windowRect, new WindowFunction(DrawWindowContent), "Point Trainer", Array.Empty<GUILayoutOption>());
((Rect)(ref _windowRect)).x = ((float)Screen.width - ((Rect)(ref _windowRect)).width) / 2f;
((Rect)(ref _windowRect)).y = ((float)Screen.height - ((Rect)(ref _windowRect)).height) / 2f;
}
}
private void DrawWindowContent(int windowID)
{
GUILayout.Label($"Current Points: {_pointAmountConfig.Value}", Array.Empty<GUILayoutOption>());
GUILayout.Label("Set New Point Amount:", Array.Empty<GUILayoutOption>());
_tempPointAmount = GUILayout.TextField(_tempPointAmount, Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Confirm", Array.Empty<GUILayoutOption>()))
{
if (int.TryParse(_tempPointAmount, out var result))
{
SetPointAmount(result);
_pointAmountConfig.Value = result;
}
else
{
_logger.LogError((object)"Invalid input! Please enter a valid integer for the point amount.");
}
}
GUI.DragWindow();
}
private void SetPointAmount(int newAmount)
{
if ((Object)(object)GameData.Instance != (Object)null)
{
GameData.Instance.NetworkgameFranchisePoints = newAmount;
_logger.LogInfo((object)$"Points in game set to: {newAmount}");
}
else
{
_logger.LogWarning((object)"GameData.Instance is null, can't set points.");
}
}
}
public class TestManager
{
private readonly ConfigEntry<int> _productIDConfig;
private readonly ManualLogSource _logger;
private Rect _windowRect = new Rect(0f, 0f, 300f, 200f);
private bool _showWindow;
private string _tempProductID;
private readonly int _minProductID = 0;
private readonly int _maxProductID = 175;
public TestManager(ConfigFile config, ManualLogSource logger)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
_logger = logger;
_productIDConfig = config.Bind<int>("AutoFill", "Product ID", 0, new ConfigDescription($"Product ID to add (Range: {_minProductID} - {_maxProductID})", (AcceptableValueBase)(object)new AcceptableValueRange<int>(_minProductID, _maxProductID), new object[1]
{
new ConfigurationManagerAttributes
{
Browsable = false
}
}));
_tempProductID = _productIDConfig.Value.ToString();
}
public void SetWindowVisibility(bool visible)
{
_showWindow = visible;
}
public void DrawWindow()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if (_showWindow)
{
_windowRect = GUILayout.Window(1, _windowRect, new WindowFunction(DrawWindowContent), "Test Trainer", Array.Empty<GUILayoutOption>());
((Rect)(ref _windowRect)).x = ((float)Screen.width - ((Rect)(ref _windowRect)).width) / 2f;
((Rect)(ref _windowRect)).y = ((float)Screen.height - ((Rect)(ref _windowRect)).height) / 2f;
}
}
private void DrawWindowContent(int windowID)
{
GUILayout.Label($"Current Product ID: {_productIDConfig.Value}", Array.Empty<GUILayoutOption>());
GUILayout.Label($"Enter Product ID (Range: {_minProductID}-{_maxProductID}):", Array.Empty<GUILayoutOption>());
_tempProductID = GUILayout.TextField(_tempProductID, Array.Empty<GUILayoutOption>());
if (GUILayout.Button("Submit", Array.Empty<GUILayoutOption>()))
{
if (int.TryParse(_tempProductID, out var result))
{
if (result >= _minProductID && result <= _maxProductID)
{
SetProductID(result);
_productIDConfig.Value = result;
}
else
{
_logger.LogError((object)$"Invalid Product ID! Please enter a value between {_minProductID} and {_maxProductID}.");
}
}
else
{
_logger.LogError((object)"Invalid input! Please enter a valid integer for the product ID.");
}
}
GUI.DragWindow();
}
private void SetProductID(int newProductID)
{
DEBUG_AutoFill val = Object.FindFirstObjectByType<DEBUG_AutoFill>();
if ((Object)(object)val != (Object)null)
{
Patch_DebugAutoFill.ProductID = newProductID;
_logger.LogInfo((object)$"Product with ID {newProductID} added successfully.");
}
else
{
_logger.LogError((object)"DEBUG_AutoFill instance not found.");
}
}
}
[HarmonyPatch(typeof(DEBUG_AutoFill), "Update")]
public static class Patch_DebugAutoFill
{
public static int ProductID;
private static void Prefix(DEBUG_AutoFill __instance)
{
__instance.productID = ProductID;
AccessTools.Method(typeof(DEBUG_AutoFill), "AddProduct", (Type[])null, (Type[])null).Invoke(__instance, null);
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "SMTTrainer";
public const string PLUGIN_NAME = "SuperMarketTogetherTrainer";
public const string PLUGIN_VERSION = "1.1.0";
}
}