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 _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("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()); ((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()); GUILayout.Label("Set Checkout Multiplier:", Array.Empty()); _checkoutMultiplierConfig.Value = GUILayout.HorizontalSlider(_checkoutMultiplierConfig.Value, 0.5f, 5f, Array.Empty()); if (GUILayout.Button("Apply Settings", Array.Empty())) { 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 _lightCostMultiplierConfig; private readonly ConfigEntry _rentCostMultiplierConfig; private readonly ConfigEntry _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("Cost Settings", "Light Cost Multiplier", 1f, new ConfigDescription("Multiplier for light costs", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Browsable = false } })); _rentCostMultiplierConfig = config.Bind("Cost Settings", "Rent Cost Multiplier", 1f, new ConfigDescription("Multiplier for rent costs", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Browsable = false } })); _employeesCostMultiplierConfig = config.Bind("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()); ((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()); _lightCostMultiplierConfig.Value = GUILayout.HorizontalSlider(_lightCostMultiplierConfig.Value, 0.5f, 5f, Array.Empty()); GUILayout.Label($"Rent Cost Multiplier: {_rentCostMultiplierConfig.Value}", Array.Empty()); _rentCostMultiplierConfig.Value = GUILayout.HorizontalSlider(_rentCostMultiplierConfig.Value, 0.5f, 5f, Array.Empty()); GUILayout.Label($"Employees Cost Multiplier: {_employeesCostMultiplierConfig.Value}", Array.Empty()); _employeesCostMultiplierConfig.Value = GUILayout.HorizontalSlider(_employeesCostMultiplierConfig.Value, 0.5f, 5f, Array.Empty()); if (GUILayout.Button("Apply Settings", Array.Empty())) { 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(); 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 _maxEmployeesConfig; private readonly ConfigEntry _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("Employee Settings", "Max Employees", 1, new ConfigDescription("Maximum number of employees", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Browsable = false } })); _employeeSpeedConfig = config.Bind("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()); ((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()); GUILayout.Label($"Employee Speed Factor: {_employeeSpeedConfig.Value}", Array.Empty()); GUILayout.Label("Set Max Employees:", Array.Empty()); _maxEmployeesConfig.Value = (int)GUILayout.HorizontalSlider((float)_maxEmployeesConfig.Value, 1f, 100f, Array.Empty()); GUILayout.Label("Set Employee Speed Factor:", Array.Empty()); _employeeSpeedConfig.Value = GUILayout.HorizontalSlider(_employeeSpeedConfig.Value, 0.1f, 5f, Array.Empty()); if (GUILayout.Button("Apply Settings", Array.Empty())) { 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 _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("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()); ((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()); if (GUILayout.Button("Generate Random Trash (1-5)|Only Host!!!", Array.Empty())) { 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 _timeConfig; public ConfigEntry _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("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("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()); ((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()); GUILayout.Label("Set Time (format HH:MM):", Array.Empty()); _tempTimeInput = GUILayout.TextField(_tempTimeInput, Array.Empty()); if (GUILayout.Button("Confirm", Array.Empty())) { 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()); GUILayout.Label("The store can only be opened and closed if the time is correct.", Array.Empty()); GUILayout.Label("Open time:8:00; Closing time:22:30", Array.Empty()); 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 _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("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()); ((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()); GUILayout.Label("Add Gold Amount:", Array.Empty()); _tempGoldAmount = GUILayout.TextField(_tempGoldAmount, Array.Empty()); if (GUILayout.Button("Confirm", Array.Empty())) { 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 _walkSpeedConfig; private readonly ConfigEntry _sprintSpeedConfig; private readonly ConfigEntry _airSpeedConfig; private readonly ConfigEntry _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("Move", "Walk Speed", 5f, new ConfigDescription("Default Walk Speed", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Browsable = false } })); _sprintSpeedConfig = config.Bind("Move", "Sprint Speed", 10f, new ConfigDescription("Default Sprint Speed", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Browsable = false } })); _airSpeedConfig = config.Bind("Move", "Air Speed", 3f, new ConfigDescription("Default Air Speed", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { Browsable = false } })); _crouchSpeedConfig = config.Bind("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()); ((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()); _tempWalkSpeed = GUILayout.HorizontalSlider(_tempWalkSpeed, 5f, 20f, Array.Empty()); GUILayout.Label($"Current Sprint Speed: {_tempSprintSpeed:F2}", Array.Empty()); _tempSprintSpeed = GUILayout.HorizontalSlider(_tempSprintSpeed, 10f, 20f, Array.Empty()); GUILayout.Label($"Current Air Speed: {_tempAirSpeed:F2}", Array.Empty()); _tempAirSpeed = GUILayout.HorizontalSlider(_tempAirSpeed, 3f, 20f, Array.Empty()); GUILayout.Label($"Current Crouch Speed: {_tempCrouchSpeed:F2}", Array.Empty()); _tempCrouchSpeed = GUILayout.HorizontalSlider(_tempCrouchSpeed, 4f, 20f, Array.Empty()); if (GUILayout.Button("Confirm", Array.Empty())) { 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 _isGoldWindowEnabled; private ConfigEntry _isPointWindowEnabled; private ConfigEntry _isEmployeesWindowEnabled; private ConfigEntry _isCheckoutWindowEnabled; private ConfigEntry _isCostWindowEnabled; private ConfigEntry _isGlobalWindowEnabled; private ConfigEntry _isFunWindowEnabled; private ConfigEntry _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("Trainer", "Gold Trainer", false, "Enable or disable the display of the Gold Trainer window."); _isPointWindowEnabled = ((BaseUnityPlugin)this).Config.Bind("Trainer", "Point Trainer", false, "Enable or disable the display of the Point Trainer window."); _isEmployeesWindowEnabled = ((BaseUnityPlugin)this).Config.Bind("Trainer", "Employees Trainer(Host)", false, "Enable or disable the display of the Employees Trainer window."); _isCheckoutWindowEnabled = ((BaseUnityPlugin)this).Config.Bind("Trainer", "Checkout Trainer(Host)", false, "Enable or disable the display of the Checkout Trainer window."); _isCostWindowEnabled = ((BaseUnityPlugin)this).Config.Bind("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("Trainer", "Global Time Trainer(Host)", false, "Enable or disable the display of the Global Time Trainer window."); _isFunWindowEnabled = ((BaseUnityPlugin)this).Config.Bind("Trainer", "Fun Manager(Host)", false, "Enable or disable the display of the Fun Manager window."); _isMoveWindowEnabled = ((BaseUnityPlugin)this).Config.Bind("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 _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("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()); ((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()); GUILayout.Label("Set New Point Amount:", Array.Empty()); _tempPointAmount = GUILayout.TextField(_tempPointAmount, Array.Empty()); if (GUILayout.Button("Confirm", Array.Empty())) { 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 _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("AutoFill", "Product ID", 0, new ConfigDescription($"Product ID to add (Range: {_minProductID} - {_maxProductID})", (AcceptableValueBase)(object)new AcceptableValueRange(_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()); ((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()); GUILayout.Label($"Enter Product ID (Range: {_minProductID}-{_maxProductID}):", Array.Empty()); _tempProductID = GUILayout.TextField(_tempProductID, Array.Empty()); if (GUILayout.Button("Submit", Array.Empty())) { 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(); 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"; } }