using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
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 HighlightPlus;
using HutongGames.PlayMaker;
using Microsoft.CodeAnalysis;
using Mirror;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;
[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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Mirror")]
[assembly: IgnoresAccessChecksTo("PlayMaker")]
[assembly: IgnoresAccessChecksTo("Rewired_Core")]
[assembly: AssemblyCompany("BetterSMT")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("BetterSMT")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0+870f83df10db7ef4a44982c0d50a93d5c179cb7f")]
[assembly: AssemblyProduct("BetterSMT")]
[assembly: AssemblyTitle("BetterSMT")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 BetterSMT
{
[BepInPlugin("BetterSMT", "BetterSMT", "2.0.0")]
public class BetterSMT : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("BetterSMT");
public static BetterSMT Instance;
public static ConfigEntry<bool> AutoPayInvoices;
public static ConfigEntry<int> SalesAmount;
public static ConfigEntry<bool> AutoSaveEnabled;
public static ConfigEntry<int> AutoSaveTimer;
public static ConfigEntry<bool> AutoSaveDuringDay;
public static ConfigEntry<int> CustomersPerPerk;
public static ConfigEntry<int> MaxCustomerInStore;
public static ConfigEntry<int> BaseCustomerSpawns;
public static ConfigEntry<int> BaseCustomerCart;
public static ConfigEntry<int> MaxCustomerCart;
public static ConfigEntry<int> EmployeesLevel;
public static ConfigEntry<bool> EmployeesEnabled;
public static ConfigEntry<float> EmployeeSpeedPerPerk;
public static ConfigEntry<float> EmployeeRestockPerPerk;
public static ConfigEntry<float> EmployeeCheckoutPerPerk1;
public static ConfigEntry<float> EmployeeCheckoutPerPerk2;
public static ConfigEntry<float> EmployeeCheckoutPerPerk3;
public static ConfigEntry<float> EmployeExtraCheckoutMoney;
public static ConfigEntry<bool> StartWithEmployee;
public static ConfigEntry<float> LightCostMod;
public static ConfigEntry<float> RentCostMod;
public static ConfigEntry<float> EmployeeCostMod;
public static ConfigEntry<bool> OneHitThief;
public static ConfigEntry<bool> SelfCheckoutTheft;
public static ConfigEntry<bool> DisableAllThieves;
public static ConfigEntry<bool> AllNPCAreThieves;
public static ConfigEntry<bool> FasterCheckout;
public static ConfigEntry<bool> ShowFPS;
public static ConfigEntry<bool> ShowPing;
public static ConfigEntry<bool> DisableTrash;
public static ConfigEntry<bool> AlwaysDeleteMode;
public static ConfigEntry<bool> DeleteOnlyCheckout;
public static ConfigEntry<bool> DisableBoxCollision;
public static ConfigEntry<bool> AllRecyclers;
public static ConfigEntry<bool> roundDown;
public static ConfigEntry<bool> NearestFive;
public static ConfigEntry<bool> NearestTen;
public static bool doublePrice = true;
public static ConfigEntry<bool> ToggleDoublePrice;
public static ConfigEntry<bool> AutoAdjustPriceDaily;
public static ConfigEntry<float> AutoAdjustPriceDailyValue;
public static ConfigEntry<bool> Highlighting;
public static ConfigEntry<bool> ThirdPersonToggle;
public static ConfigEntry<KeyboardShortcut> ThirdPersonHotkey;
public static ConfigEntry<bool> EnablePalletDisplays;
public static ConfigEntry<KeyboardShortcut> KeyboardShortcutDoublePrice;
public static ConfigEntry<KeyboardShortcut> KeyboardShortcutRoundDownSwitch;
public static ConfigEntry<KeyboardShortcut> KeyboardShortcutRoundDownToggle;
public static ConfigEntry<KeyboardShortcut> PricingGunHotkey;
public static ConfigEntry<bool> PricingGunToggle;
public static ConfigEntry<KeyboardShortcut> BroomHotkey;
public static ConfigEntry<bool> BroomToggle;
public static ConfigEntry<KeyboardShortcut> DLCTabletHotkey;
public static ConfigEntry<bool> DLCTabletToggle;
public static ConfigEntry<KeyboardShortcut> EmptyHandsHotkey;
public static ConfigEntry<bool> SledgeToggle;
public static ConfigEntry<KeyboardShortcut> SledgeHotkey;
public static ConfigEntry<bool> OsMartToggle;
public static ConfigEntry<KeyboardShortcut> OsMartHotkey;
public static ConfigEntry<bool> TrayToggle;
public static ConfigEntry<KeyboardShortcut> TrayHotkey;
public static ConfigEntry<bool> SalesToggle;
public static ConfigEntry<KeyboardShortcut> SalesHotkey;
public static bool notify = false;
public static string notificationType;
public static ConfigEntry<int> SelfCheckoutLimit;
public static ConfigEntry<bool> TooExpensive;
public static ConfigEntry<bool> MissingProduct;
public static ConfigEntry<int> MaxBoxSize;
public static ConfigEntry<bool> BoxCollision;
public static ConfigEntry<bool> FastBoxSpawns;
public static ConfigEntry<float> ClockSpeed;
public static ConfigEntry<KeyboardShortcut> ClockHotkey;
public static ConfigEntry<bool> ClockToggle;
public static ConfigEntry<bool> ClockMorning;
internal static ManualLogSource Logger { get; private set; } = null;
private void Awake()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Expected O, but got Unknown
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Expected O, but got Unknown
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Expected O, but got Unknown
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Expected O, but got Unknown
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Expected O, but got Unknown
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Expected O, but got Unknown
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Expected O, but got Unknown
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Expected O, but got Unknown
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Expected O, but got Unknown
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Expected O, but got Unknown
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_0289: Expected O, but got Unknown
//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Expected O, but got Unknown
//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
//IL_02eb: Expected O, but got Unknown
//IL_030c: Unknown result type (might be due to invalid IL or missing references)
//IL_0316: Expected O, but got Unknown
//IL_0349: Unknown result type (might be due to invalid IL or missing references)
//IL_0353: Expected O, but got Unknown
//IL_0374: Unknown result type (might be due to invalid IL or missing references)
//IL_037e: Expected O, but got Unknown
//IL_039f: Unknown result type (might be due to invalid IL or missing references)
//IL_03a9: Expected O, but got Unknown
//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
//IL_03df: Expected O, but got Unknown
//IL_0412: Unknown result type (might be due to invalid IL or missing references)
//IL_041c: Expected O, but got Unknown
//IL_043d: Unknown result type (might be due to invalid IL or missing references)
//IL_0447: Expected O, but got Unknown
//IL_0468: Unknown result type (might be due to invalid IL or missing references)
//IL_0472: Expected O, but got Unknown
//IL_0493: Unknown result type (might be due to invalid IL or missing references)
//IL_049d: Expected O, but got Unknown
//IL_04be: Unknown result type (might be due to invalid IL or missing references)
//IL_04c8: Expected O, but got Unknown
//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
//IL_04f3: Expected O, but got Unknown
//IL_050f: Unknown result type (might be due to invalid IL or missing references)
//IL_051f: Unknown result type (might be due to invalid IL or missing references)
//IL_0529: Expected O, but got Unknown
//IL_054a: Unknown result type (might be due to invalid IL or missing references)
//IL_0554: Expected O, but got Unknown
//IL_0575: Unknown result type (might be due to invalid IL or missing references)
//IL_057f: Expected O, but got Unknown
//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
//IL_05aa: Expected O, but got Unknown
//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
//IL_05d5: Expected O, but got Unknown
//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0601: Unknown result type (might be due to invalid IL or missing references)
//IL_060b: Expected O, but got Unknown
//IL_062c: Unknown result type (might be due to invalid IL or missing references)
//IL_0636: Expected O, but got Unknown
//IL_0652: Unknown result type (might be due to invalid IL or missing references)
//IL_0662: Unknown result type (might be due to invalid IL or missing references)
//IL_066c: Expected O, but got Unknown
//IL_068d: Unknown result type (might be due to invalid IL or missing references)
//IL_0697: Expected O, but got Unknown
//IL_06b3: Unknown result type (might be due to invalid IL or missing references)
//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
//IL_06cd: Expected O, but got Unknown
//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
//IL_06f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0703: Expected O, but got Unknown
//IL_071f: Unknown result type (might be due to invalid IL or missing references)
//IL_072f: Unknown result type (might be due to invalid IL or missing references)
//IL_0739: Expected O, but got Unknown
//IL_075a: Unknown result type (might be due to invalid IL or missing references)
//IL_0764: Expected O, but got Unknown
//IL_0785: Unknown result type (might be due to invalid IL or missing references)
//IL_078f: Expected O, but got Unknown
//IL_07b0: Unknown result type (might be due to invalid IL or missing references)
//IL_07ba: Expected O, but got Unknown
//IL_07df: Unknown result type (might be due to invalid IL or missing references)
//IL_07ef: Unknown result type (might be due to invalid IL or missing references)
//IL_07f9: Expected O, but got Unknown
//IL_0826: Unknown result type (might be due to invalid IL or missing references)
//IL_0836: Unknown result type (might be due to invalid IL or missing references)
//IL_0840: Expected O, but got Unknown
//IL_0868: Unknown result type (might be due to invalid IL or missing references)
//IL_0872: Expected O, but got Unknown
//IL_0893: Unknown result type (might be due to invalid IL or missing references)
//IL_089d: Expected O, but got Unknown
//IL_08c5: Unknown result type (might be due to invalid IL or missing references)
//IL_08cf: Expected O, but got Unknown
//IL_08f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0901: Expected O, but got Unknown
//IL_0934: Unknown result type (might be due to invalid IL or missing references)
//IL_093e: Expected O, but got Unknown
//IL_0971: Unknown result type (might be due to invalid IL or missing references)
//IL_097b: Expected O, but got Unknown
//IL_09ae: Unknown result type (might be due to invalid IL or missing references)
//IL_09b8: Expected O, but got Unknown
//IL_09d9: Unknown result type (might be due to invalid IL or missing references)
//IL_09e3: Expected O, but got Unknown
//IL_0a04: Unknown result type (might be due to invalid IL or missing references)
//IL_0a0e: Expected O, but got Unknown
//IL_0a2f: Unknown result type (might be due to invalid IL or missing references)
//IL_0a39: Expected O, but got Unknown
//IL_0a5a: Unknown result type (might be due to invalid IL or missing references)
//IL_0a64: Expected O, but got Unknown
//IL_0a97: Unknown result type (might be due to invalid IL or missing references)
//IL_0aa1: Expected O, but got Unknown
//IL_0ad4: Unknown result type (might be due to invalid IL or missing references)
//IL_0ade: Expected O, but got Unknown
//IL_0b11: Unknown result type (might be due to invalid IL or missing references)
//IL_0b1b: Expected O, but got Unknown
//IL_0b4e: Unknown result type (might be due to invalid IL or missing references)
//IL_0b58: Expected O, but got Unknown
//IL_0b8b: Unknown result type (might be due to invalid IL or missing references)
//IL_0b95: Expected O, but got Unknown
//IL_0bc8: Unknown result type (might be due to invalid IL or missing references)
//IL_0bd2: Expected O, but got Unknown
//IL_0bfb: Unknown result type (might be due to invalid IL or missing references)
//IL_0c05: Expected O, but got Unknown
//IL_0c2d: Unknown result type (might be due to invalid IL or missing references)
//IL_0c37: Expected O, but got Unknown
//IL_0c5f: Unknown result type (might be due to invalid IL or missing references)
//IL_0c69: Expected O, but got Unknown
//IL_0c95: Unknown result type (might be due to invalid IL or missing references)
//IL_0c9f: Expected O, but got Unknown
//IL_0cc6: Unknown result type (might be due to invalid IL or missing references)
//IL_0cd0: Expected O, but got Unknown
//IL_0cf1: Unknown result type (might be due to invalid IL or missing references)
//IL_0cfb: Expected O, but got Unknown
//IL_0d1c: Unknown result type (might be due to invalid IL or missing references)
//IL_0d26: Expected O, but got Unknown
//IL_0d47: Unknown result type (might be due to invalid IL or missing references)
//IL_0d51: Expected O, but got Unknown
EnablePalletDisplays = ((BaseUnityPlugin)this).Config.Bind<bool>("QoL", "Enable pallet displays", false, new ConfigDescription("Enables pallet displays without unlocking the perk.", (AcceptableValueBase)null, Array.Empty<object>()));
StartWithEmployee = ((BaseUnityPlugin)this).Config.Bind<bool>("Employees", "Start with an employee", false, new ConfigDescription("Start the game with 1 hireable employee.", (AcceptableValueBase)null, Array.Empty<object>()));
AllRecyclers = ((BaseUnityPlugin)this).Config.Bind<bool>("QoL", "All Recyclers", false, new ConfigDescription("Turns the nearest trash can into a recycler without the perk.", (AcceptableValueBase)null, Array.Empty<object>()));
SledgeHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Utility", "Sledgehammer Hotkey", new KeyboardShortcut((KeyCode)106, Array.Empty<KeyCode>()), new ConfigDescription("Hotkey to spawn a Sledgehammer in your hands.", (AcceptableValueBase)null, Array.Empty<object>()));
SledgeToggle = ((BaseUnityPlugin)this).Config.Bind<bool>("Utility", "Sledgehammer Toggle", false, new ConfigDescription("Enables the hotkey to activate Sledgehammer", (AcceptableValueBase)null, Array.Empty<object>()));
OsMartHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Utility", "Os Mart 2.0 Tablet Hotkey", new KeyboardShortcut((KeyCode)104, Array.Empty<KeyCode>()), new ConfigDescription("Hotkey to spawn a Os Mart 2.0 Tablet in your hands.", (AcceptableValueBase)null, Array.Empty<object>()));
OsMartToggle = ((BaseUnityPlugin)this).Config.Bind<bool>("Utility", "Os Mart 2.0 Toggle", false, new ConfigDescription("Enables the hotkey to activate Os Mart 2.0", (AcceptableValueBase)null, Array.Empty<object>()));
TrayHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Utility", "Tray Hotkey", new KeyboardShortcut((KeyCode)107, Array.Empty<KeyCode>()), new ConfigDescription("Hotkey to spawn a Tray in your hands.", (AcceptableValueBase)null, Array.Empty<object>()));
TrayToggle = ((BaseUnityPlugin)this).Config.Bind<bool>("Utility", "Tray Toggle", false, new ConfigDescription("Enables the hotkey to activate Tray", (AcceptableValueBase)null, Array.Empty<object>()));
SalesHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Utility", "Sales Tablet Hotkey", new KeyboardShortcut((KeyCode)108, Array.Empty<KeyCode>()), new ConfigDescription("Hotkey to spawn a Sales Tablet in your hands.", (AcceptableValueBase)null, Array.Empty<object>()));
SalesToggle = ((BaseUnityPlugin)this).Config.Bind<bool>("Utility", "Sales Tablet Toggle", false, new ConfigDescription("Enables the hotkey to activate Sales Tablet", (AcceptableValueBase)null, Array.Empty<object>()));
AutoPayInvoices = ((BaseUnityPlugin)this).Config.Bind<bool>("Utility", "Enables or disables automatic invoice payment", false, new ConfigDescription("Enables or disables paying for invoices automatically", (AcceptableValueBase)null, Array.Empty<object>()));
SalesAmount = ((BaseUnityPlugin)this).Config.Bind<int>("Sales", "Amount of sales unlocked each perk", 2, new ConfigDescription("Adjusts the amount of sales you unlock for each perk", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
AutoSaveEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Auto Saving", "Enables Auto Saving", false, new ConfigDescription("Enables or disables automatic saving", (AcceptableValueBase)null, Array.Empty<object>()));
AutoSaveTimer = ((BaseUnityPlugin)this).Config.Bind<int>("Auto Saving", "Amount of time between saves", 120, new ConfigDescription("Adjusts the amount of time between auto saves in seconds, default is 120seconds or 2minutes", (AcceptableValueBase)(object)new AcceptableValueRange<int>(30, 900), Array.Empty<object>()));
AutoSaveDuringDay = ((BaseUnityPlugin)this).Config.Bind<bool>("Auto Saving", "Enables Auto Saving during the day", false, new ConfigDescription("Enables or disables saving while the store is open, default only autosaves while closed", (AcceptableValueBase)null, Array.Empty<object>()));
AutoAdjustPriceDaily = ((BaseUnityPlugin)this).Config.Bind<bool>("QoL", "Auto Adjust Prices Daily", false, new ConfigDescription("Enables or disables automatically doubling the price of products daily", (AcceptableValueBase)null, Array.Empty<object>()));
AutoAdjustPriceDailyValue = ((BaseUnityPlugin)this).Config.Bind<float>("QoL", "Adjust the amount prices are automatically set to every day", 2f, new ConfigDescription("Adjusts the amount prices are set to be multiplied by daily. Value of 2x is 2$ * 2 = 4$. Value of 1.99x is 2$*1.99=3.98", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 2f), Array.Empty<object>()));
ClockMorning = ((BaseUnityPlugin)this).Config.Bind<bool>("Clocks", "Enables clock usage in morning", false, new ConfigDescription("Enables or disables using the clock in the morning", (AcceptableValueBase)null, Array.Empty<object>()));
ClockToggle = ((BaseUnityPlugin)this).Config.Bind<bool>("Clocks", "Enable hotkey for clock", false, new ConfigDescription("Enables or disabled hotkey activating clock.", (AcceptableValueBase)null, Array.Empty<object>()));
ClockHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Clocks", "Toggle Clock", new KeyboardShortcut((KeyCode)111, Array.Empty<KeyCode>()), new ConfigDescription("Hotkey to enable/disable the clock", (AcceptableValueBase)null, Array.Empty<object>()));
ClockSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Clocks", "Clock Speed", 5f, new ConfigDescription("Adjust the amount of speed enabling the clock gives", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>()));
DeleteOnlyCheckout = ((BaseUnityPlugin)this).Config.Bind<bool>("Building", "Enable or disable deleting all checkout lanes", false, new ConfigDescription("Adds the ability to delete every checkout lane", (AcceptableValueBase)null, Array.Empty<object>()));
BoxCollision = ((BaseUnityPlugin)this).Config.Bind<bool>("Boxes", "Enable or disable collision with boxes", false, new ConfigDescription("Enables or disables collision with boxes allowing them to stack inside of each other https://i.imgur.com/ffJrHOA.jpeg", (AcceptableValueBase)null, Array.Empty<object>()));
FastBoxSpawns = ((BaseUnityPlugin)this).Config.Bind<bool>("Boxes", "Enable or disable fast spawning of boxes", false, new ConfigDescription("Enables or disables making purchases boxes spawn quickly https://i.imgur.com/92Ex4V6.png", (AcceptableValueBase)null, Array.Empty<object>()));
MissingProduct = ((BaseUnityPlugin)this).Config.Bind<bool>("Notifications", "Enable or disable notification Missing Product", false, new ConfigDescription("Enables or disables the notification for missing products", (AcceptableValueBase)null, Array.Empty<object>()));
TooExpensive = ((BaseUnityPlugin)this).Config.Bind<bool>("Notifications", "Enable or disable notification Too Expensive", false, new ConfigDescription("Enables or disables the notification for too expensive products", (AcceptableValueBase)null, Array.Empty<object>()));
ThirdPersonHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Third Person", "Third Person Hotkey", new KeyboardShortcut((KeyCode)103, Array.Empty<KeyCode>()), new ConfigDescription("Hotkey to enter and leave third person/first person.", (AcceptableValueBase)null, Array.Empty<object>()));
ThirdPersonToggle = ((BaseUnityPlugin)this).Config.Bind<bool>("Third Person", "Enable or disable third person", false, new ConfigDescription("Enables or disables the hotkey to enter and leave third person/first person", (AcceptableValueBase)null, Array.Empty<object>()));
ToggleDoublePrice = ((BaseUnityPlugin)this).Config.Bind<bool>("Double Price", "Enable or disable double price module", false, new ConfigDescription("Enables or disables the price gun automatically having 2x the market price", (AcceptableValueBase)null, Array.Empty<object>()));
Highlighting = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Enable or disable highlighting", false, new ConfigDescription("Enables or disables highlighting of product and storage shelves when holding a box", (AcceptableValueBase)null, Array.Empty<object>()));
PricingGunToggle = ((BaseUnityPlugin)this).Config.Bind<bool>("Utility", "Pricing Gun Toggle", false, new ConfigDescription("Enables the hotkey to activate Pricing Gun", (AcceptableValueBase)null, Array.Empty<object>()));
PricingGunHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Utility", "Pricing Gun Hotkey", new KeyboardShortcut((KeyCode)121, Array.Empty<KeyCode>()), new ConfigDescription("Hotkey to spawn a Pricing Gun in your hands.", (AcceptableValueBase)null, Array.Empty<object>()));
BroomToggle = ((BaseUnityPlugin)this).Config.Bind<bool>("Utility", "Broom Toggle", false, new ConfigDescription("Enables the hotkey to activate Broom", (AcceptableValueBase)null, Array.Empty<object>()));
BroomHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Utility", "Broom Hotkey", new KeyboardShortcut((KeyCode)117, Array.Empty<KeyCode>()), new ConfigDescription("Hotkey to spawn a Broom in your hands.", (AcceptableValueBase)null, Array.Empty<object>()));
DLCTabletToggle = ((BaseUnityPlugin)this).Config.Bind<bool>("Utility", "DLC Tablet Toggle", false, new ConfigDescription("Enables the hotkey to activate DLC Tablet", (AcceptableValueBase)null, Array.Empty<object>()));
DLCTabletHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Utility", "DLC Tablet Hotkey", new KeyboardShortcut((KeyCode)105, Array.Empty<KeyCode>()), new ConfigDescription("Hotkey to spawn a DLC Tablet in your hands.", (AcceptableValueBase)null, Array.Empty<object>()));
EmptyHandsHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Utility", "Empty Hands Hotkey", new KeyboardShortcut((KeyCode)114, Array.Empty<KeyCode>()), new ConfigDescription("Hotkey to remove active item in your hand.", (AcceptableValueBase)null, Array.Empty<object>()));
KeyboardShortcutDoublePrice = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Double Price", "Enable Double Price module", new KeyboardShortcut((KeyCode)113, Array.Empty<KeyCode>()), new ConfigDescription("Hotkey to enable and disable double price module", (AcceptableValueBase)null, Array.Empty<object>()));
roundDown = ((BaseUnityPlugin)this).Config.Bind<bool>("Double Price", "Enable rounding down", false, new ConfigDescription("Enables rounding down to prevent 'Too Expensive'", (AcceptableValueBase)null, Array.Empty<object>()));
NearestFive = ((BaseUnityPlugin)this).Config.Bind<bool>("Double Price", "Enable rounding down to nearest 0.05", true, new ConfigDescription("Enable rounding down to the nearest fifth", (AcceptableValueBase)null, Array.Empty<object>()));
NearestTen = ((BaseUnityPlugin)this).Config.Bind<bool>("Double Price", "Enable rounding down to nearest 0.10", false, new ConfigDescription("Enable rounding down to the nearest tenth", (AcceptableValueBase)null, Array.Empty<object>()));
KeyboardShortcutRoundDownSwitch = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Double Price", "Round Down Shortcuts", new KeyboardShortcut((KeyCode)113, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), new ConfigDescription("Hotkey to round down the double price", (AcceptableValueBase)null, Array.Empty<object>()));
KeyboardShortcutRoundDownToggle = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Double Price", "Round Down Hotkey", new KeyboardShortcut((KeyCode)113, (KeyCode[])(object)new KeyCode[2]
{
(KeyCode)306,
(KeyCode)304
}), new ConfigDescription("Hotkey to round down to setting set", (AcceptableValueBase)null, Array.Empty<object>()));
EmployeesLevel = ((BaseUnityPlugin)this).Config.Bind<int>("Employees", "Employees Level", 0, new ConfigDescription("Adjust the level of employee's that spawn (1 sets all of their stats to minimum, 11 sets them all to max)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 30), Array.Empty<object>()));
EmployeesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Employees", "Employees Level Toggle", false, new ConfigDescription("Enables modifying employee levels", (AcceptableValueBase)null, Array.Empty<object>()));
SelfCheckoutLimit = ((BaseUnityPlugin)this).Config.Bind<int>("Self-Checkout", "Product limit on self checkout", 4, new ConfigDescription("Limits the amount of item's a customer can have before using the self checkout", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
MaxBoxSize = ((BaseUnityPlugin)this).Config.Bind<int>("Boxes", "Modify amount of products in boxes", 1, new ConfigDescription("** WARNING THIS IS EXTREMELY BUGGY IN MULTIPLAYER ** Multiples the amount of product in a box, aswell as it's cost. Higher = more products in box and higher cost https://imgur.com/a/QT5l2Ky", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 25), Array.Empty<object>()));
EmployeeSpeedPerPerk = ((BaseUnityPlugin)this).Config.Bind<float>("Employees", "Employee Speed Per Perk", 0.2f, new ConfigDescription("Adjust the amount of speed employees gain per perk (Higher = faster)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 0.6f), Array.Empty<object>()));
EmployeeRestockPerPerk = ((BaseUnityPlugin)this).Config.Bind<float>("Employees", "Employee Restock Time Reduction Per Perk", 0.05f, new ConfigDescription("Adjust the amount of time it takes for employees to restock per perk (Lower = faster)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 0.15f), Array.Empty<object>()));
LightCostMod = ((BaseUnityPlugin)this).Config.Bind<float>("Immersion", "Adjust the cost of Lights at the end of the day", 10f, new ConfigDescription("Adjust the cost of lights at the end of the day (Higher = more expensive)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 30f), Array.Empty<object>()));
AllNPCAreThieves = ((BaseUnityPlugin)this).Config.Bind<bool>("Thieves", "All Thieves", false, new ConfigDescription("Causes every NPC to be a thief", (AcceptableValueBase)null, Array.Empty<object>()));
SelfCheckoutTheft = ((BaseUnityPlugin)this).Config.Bind<bool>("Self-Checkout", "Self-Checkout Theft", true, new ConfigDescription("Enables or disables default game's theft from self checkout", (AcceptableValueBase)null, Array.Empty<object>()));
DisableTrash = ((BaseUnityPlugin)this).Config.Bind<bool>("Trash", "Despawns trash", false, new ConfigDescription("Despawns all trash at the end of the day", (AcceptableValueBase)null, Array.Empty<object>()));
DisableAllThieves = ((BaseUnityPlugin)this).Config.Bind<bool>("Thieves", "Disable Thieves", false, new ConfigDescription("Prevent thieves from spawning (Does not stop checkout-related thieves)", (AcceptableValueBase)null, Array.Empty<object>()));
EmployeeCostMod = ((BaseUnityPlugin)this).Config.Bind<float>("Immersion", "Adjust the cost of Employee at the end of the day", 10f, new ConfigDescription("Adjust the cost of Employee at the end of the day (Higher = more expensive)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 30f), Array.Empty<object>()));
RentCostMod = ((BaseUnityPlugin)this).Config.Bind<float>("Immersion", "Adjust the cost of Rent at the end of the day", 10f, new ConfigDescription("Adjust the cost of Rent at the end of the day (Higher = more expensive)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 30f), Array.Empty<object>()));
EmployeExtraCheckoutMoney = ((BaseUnityPlugin)this).Config.Bind<float>("Employees", "Employe Increased Income While Checking Customer Out Perk", 0.1f, new ConfigDescription("Adjust the amount of extra income you receive when an employee checks out a customer (Higher = more income)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.3f), Array.Empty<object>()));
EmployeeCheckoutPerPerk1 = ((BaseUnityPlugin)this).Config.Bind<float>("Employees", "Employee Checkout Time Reduction Perk 1", 0.15f, new ConfigDescription("Adjust the amount of time employees wait to scan items in checkout (Perk 1) (Lower = slower)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 0.45f), Array.Empty<object>()));
EmployeeCheckoutPerPerk2 = ((BaseUnityPlugin)this).Config.Bind<float>("Employees", "Employee Checkout Time Reduction Perk 2", 0.2f, new ConfigDescription("Adjust the amount of time employees wait to scan items in checkout (Perk 2) (Lower = slower)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 0.6f), Array.Empty<object>()));
EmployeeCheckoutPerPerk3 = ((BaseUnityPlugin)this).Config.Bind<float>("Employees", "Employee Checkout Time Reduction Perk 3", 0.15f, new ConfigDescription("Adjust the amount of time employees wait to scan items in checkout (Perk 3) (Lower = slower)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 0.45f), Array.Empty<object>()));
MaxCustomerCart = ((BaseUnityPlugin)this).Config.Bind<int>("Customers", "Maximum amount of product customers will buy", 25, new ConfigDescription("Adjust the maximum amount of product customers will buy", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 75), Array.Empty<object>()));
BaseCustomerCart = ((BaseUnityPlugin)this).Config.Bind<int>("Customers", "Minimum amount of product customers will buy", 5, new ConfigDescription("Adjust the minimum amount of product customers will buy", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 15), Array.Empty<object>()));
BaseCustomerSpawns = ((BaseUnityPlugin)this).Config.Bind<int>("Customers", "Minimum amount of customers that will spawn", 3, new ConfigDescription("Adjust the minimum amount of customer's that can spawn", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 9), Array.Empty<object>()));
MaxCustomerInStore = ((BaseUnityPlugin)this).Config.Bind<int>("Customers", "Max amount of customers in store", 70, new ConfigDescription("Adjust the amount of customers that can spawn at one time", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 210), Array.Empty<object>()));
CustomersPerPerk = ((BaseUnityPlugin)this).Config.Bind<int>("Customers", "Extra Customers per perk", 1, new ConfigDescription("Adjust the amount of customers you gain per perk (Higher number = more customers)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 5), Array.Empty<object>()));
AlwaysDeleteMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Building", "Always access to delete", false, new ConfigDescription("Delete shelves and others while customers are in store and store is open", (AcceptableValueBase)null, Array.Empty<object>()));
OneHitThief = ((BaseUnityPlugin)this).Config.Bind<bool>("Thieves", "Thiefs Drop Everything On Hit", false, new ConfigDescription("Thiefs Drop Everything On Hit", (AcceptableValueBase)null, Array.Empty<object>()));
FasterCheckout = ((BaseUnityPlugin)this).Config.Bind<bool>("Customers", "Faster Checkout", false, new ConfigDescription("Customers place all items instantly on to the checkout", (AcceptableValueBase)null, Array.Empty<object>()));
ShowFPS = ((BaseUnityPlugin)this).Config.Bind<bool>("Other", "Show FPS Counter", false, (ConfigDescription)null);
ShowPing = ((BaseUnityPlugin)this).Config.Bind<bool>("Other", "Show Ping Counter", false, (ConfigDescription)null);
Instance = this;
Logger = ((BaseUnityPlugin)this).Logger;
harmony.PatchAll();
Logger.LogInfo((object)"Plugin BetterSMT v2.0.0 is loaded!");
}
public static void CreateCanvasNotification(string text)
{
GameObject val = Object.Instantiate<GameObject>(GameCanvas.Instance.notificationPrefab, GameCanvas.Instance.notificationParentTransform);
((TMP_Text)val.GetComponent<TextMeshProUGUI>()).text = text;
val.SetActive(true);
}
public static void CreateImportantNotification(string text)
{
GameObject val = Object.Instantiate<GameObject>(GameCanvas.Instance.importantNotificationPrefab, GameCanvas.Instance.importantNotificationParentTransform);
((TMP_Text)val.GetComponent<TextMeshProUGUI>()).text = text;
val.SetActive(true);
}
private void Update()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
if (!ToggleDoublePrice.Value)
{
return;
}
KeyboardShortcut value = KeyboardShortcutDoublePrice.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
doublePrice = !doublePrice;
notificationType = "priceToggle";
notify = true;
return;
}
value = KeyboardShortcutRoundDownSwitch.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
if (NearestTen.Value)
{
NearestTen.Value = false;
NearestFive.Value = true;
}
else
{
NearestTen.Value = true;
NearestFive.Value = false;
}
notificationType = "roundDownSwitch";
notify = true;
}
else
{
value = KeyboardShortcutRoundDownToggle.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
roundDown.Value = !roundDown.Value;
notificationType = "roundDownToggle";
notify = true;
}
}
}
private void ConfigSettingChanged(object sender, EventArgs e)
{
if (NearestFive.Value && NearestTen.Value && NearestFive.Value)
{
NearestTen.Value = false;
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "BetterSMT";
public const string PLUGIN_NAME = "BetterSMT";
public const string PLUGIN_VERSION = "2.0.0";
}
}
namespace BetterSMT.Patches
{
[HarmonyPatch(typeof(BoxData))]
public static class BoxDataPatch
{
private static int _initialLayer = -1;
[HarmonyPostfix]
[HarmonyPatch("OnStartClient")]
public static void OnStartClientPostfix(BoxData __instance)
{
if (BetterSMT.BoxCollision.Value && !((Object)(object)((__instance != null) ? ((Component)__instance).gameObject : null) == (Object)null))
{
ApplyCollisionChanges(((Component)__instance).gameObject);
}
}
private static void ApplyCollisionChanges(GameObject boxObject)
{
if (_initialLayer == -1)
{
_initialLayer = boxObject.layer;
}
boxObject.layer = 20;
Physics.IgnoreLayerCollision(20, 20, true);
}
}
[HarmonyPatch(typeof(Builder_Main))]
public class Builder_MainPatch
{
[HarmonyPatch("DeleteBehaviour")]
[HarmonyPrefix]
private static bool DeleteBehaviourPatch(Builder_Main __instance)
{
return DeleteWheneverPatch(__instance);
}
public static bool DeleteWheneverPatch(Builder_Main __instance)
{
HandleMovableObjects(__instance);
HandleDecorations(__instance);
return false;
}
private static bool HandleMovableObjects(Builder_Main __instance)
{
//IL_000b: 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_0027: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(((Component)Camera.main).transform.position, ((Component)Camera.main).transform.forward, ref val, 4f, LayerMask.op_Implicit(__instance.lMask)))
{
if (((Component)((RaycastHit)(ref val)).transform).gameObject.CompareTag("Movable"))
{
if ((Object)(object)__instance.oldHitOBJ2 != (Object)null && (Object)(object)((Component)((RaycastHit)(ref val)).transform).gameObject != (Object)(object)__instance.oldHitOBJ2 && (Object)(object)__instance.hEffect2 != (Object)null)
{
__instance.hEffect2.highlighted = false;
}
__instance.hEffect2 = ((Component)((RaycastHit)(ref val)).transform).GetComponent<HighlightEffect>();
if ((Object)(object)__instance.hEffect2 != (Object)null)
{
__instance.hEffect2.highlighted = true;
}
else
{
Debug.LogWarning((object)"HighlightEffect not found on Movable object!");
}
if (__instance.MainPlayer.GetButtonDown("Build") || __instance.MainPlayer.GetButtonDown("Main Action") || __instance.MainPlayer.GetButtonDown("Secondary Action"))
{
if (!BetterSMT.AlwaysDeleteMode.Value)
{
if (GameData.Instance.isSupermarketOpen)
{
GameCanvas.Instance.CreateCanvasNotification("message15");
return false;
}
if (NPC_Manager.Instance.customersnpcParentOBJ.transform.childCount > 0)
{
GameCanvas.Instance.CreateCanvasNotification("message16");
return false;
}
}
if (__instance.FurnitureContainsProduct(((RaycastHit)(ref val)).transform) && !__instance.MainPlayer.GetButton("Drop Item"))
{
GameCanvas.Instance.CreateCanvasNotification("message17a");
return false;
}
if ((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<Data_Container>() != (Object)null)
{
int containerID = ((Component)((RaycastHit)(ref val)).transform).GetComponent<Data_Container>().containerID;
if (!BetterSMT.DeleteOnlyCheckout.Value && (containerID == 6 || containerID == 7) && ((Component)((Component)GameData.Instance).GetComponent<NetworkSpawner>().levelPropsOBJ.transform.GetChild(2)).transform.childCount == 1)
{
GameCanvas.Instance.CreateCanvasNotification("checkoutwarning");
return false;
}
}
if ((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<NetworkIdentity>() != (Object)null)
{
float num = (float)((Component)((RaycastHit)(ref val)).transform).GetComponent<Data_Container>().cost * 0.9f;
if (__instance.MainPlayer.GetButton("Drop Item"))
{
try
{
MethodInfo method = typeof(Builder_Main).GetMethod("CalculateShelfProductCost", BindingFlags.Instance | BindingFlags.NonPublic);
if (method != null)
{
num += (float)method.Invoke(__instance, new object[1] { ((RaycastHit)(ref val)).transform });
}
}
catch (Exception ex)
{
Debug.LogError((object)("Reflection error: " + ex.Message));
}
}
GameData.Instance.CmdAlterFundsWithoutExperience(num);
((Component)GameData.Instance).GetComponent<NetworkSpawner>().CmdDestroyBox(((Component)((RaycastHit)(ref val)).transform).gameObject);
}
}
__instance.oldHitOBJ2 = ((Component)((RaycastHit)(ref val)).transform).gameObject;
return true;
}
if ((Object)(object)__instance.hEffect2 != (Object)null)
{
__instance.hEffect2.highlighted = false;
}
}
else if ((Object)(object)__instance.hEffect2 != (Object)null)
{
__instance.hEffect2.highlighted = false;
}
return false;
}
private static bool HandleDecorations(Builder_Main __instance)
{
//IL_000b: 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_0027: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(((Component)Camera.main).transform.position, ((Component)Camera.main).transform.forward, ref val, 4f, LayerMask.op_Implicit(__instance.lMask)))
{
if (((Component)((RaycastHit)(ref val)).transform).gameObject.CompareTag("Decoration"))
{
if ((Object)(object)__instance.oldHitOBJ != (Object)null && (Object)(object)((Component)((RaycastHit)(ref val)).transform).gameObject != (Object)(object)__instance.oldHitOBJ && (Object)(object)__instance.hEffect != (Object)null)
{
((Behaviour)__instance.hEffect).enabled = false;
}
Transform obj = ((RaycastHit)(ref val)).transform.Find("Mesh");
HighlightEffect val2 = ((obj != null) ? ((Component)obj).GetComponent<HighlightEffect>() : null);
if ((Object)(object)val2 != (Object)null)
{
__instance.hEffect = val2;
((Behaviour)__instance.hEffect).enabled = true;
}
else
{
Debug.LogWarning((object)"HighlightEffect not found on Decoration!");
}
if ((__instance.MainPlayer.GetButtonDown("Build") || __instance.MainPlayer.GetButtonDown("Main Action") || __instance.MainPlayer.GetButtonDown("Secondary Action")) && (Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<NetworkIdentity>() != (Object)null)
{
float num = ((Component)((RaycastHit)(ref val)).transform).GetComponent<BuildableInfo>().cost * 0.9f;
GameData.Instance.CmdAlterFundsWithoutExperience(num);
((Component)GameData.Instance).GetComponent<NetworkSpawner>().CmdDestroyBox(((Component)((RaycastHit)(ref val)).transform).gameObject);
}
__instance.oldHitOBJ = ((Component)((RaycastHit)(ref val)).transform).gameObject;
return true;
}
if ((Object)(object)__instance.hEffect != (Object)null)
{
((Behaviour)__instance.hEffect).enabled = false;
}
}
else if ((Object)(object)__instance.hEffect != (Object)null)
{
((Behaviour)__instance.hEffect).enabled = false;
}
return false;
}
}
[HarmonyPatch(typeof(CustomCameraController), "LateUpdate")]
public class LateUpdateRaycastPatch
{
private static bool isThirdPersonEnabled;
private static void Postfix(CustomCameraController __instance)
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
if (!FsmVariables.GlobalVariables.GetFsmBool("InChat").Value && BetterSMT.ThirdPersonToggle.Value && !((Object)(object)__instance == (Object)null) && !__instance.inVehicle && !__instance.isInCameraEvent)
{
KeyboardShortcut value = BetterSMT.ThirdPersonHotkey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
isThirdPersonEnabled = !isThirdPersonEnabled;
}
__instance.inEmoteEvent = isThirdPersonEnabled;
if ((Object)(object)__instance.thirdPersonFollow != (Object)null)
{
__instance.thirdPersonFollow.CameraDistance = (isThirdPersonEnabled ? 2f : 0f);
__instance.thirdPersonFollow.CameraCollisionFilter = (isThirdPersonEnabled ? __instance.thirdPersonDefaultLayerMask : LayerMask.op_Implicit(0));
}
__instance.ShowCharacter(isThirdPersonEnabled);
}
}
}
[HarmonyPatch(typeof(DebtManager))]
public static class DebtManagerPatch
{
[HarmonyPostfix]
[HarmonyPatch("OnStartClient")]
private static void EnableAutoPay(DebtManager __instance)
{
if (BetterSMT.AutoPayInvoices.Value)
{
__instance.autopayInvoices = true;
}
}
}
[HarmonyPatch(typeof(EmployeesDataGeneration))]
public class EmployeesDataGenerationPatch
{
[HarmonyPatch("GenerateTodayEmployeesData")]
[HarmonyPostfix]
private static void GenerateTodayEmployeesDataPatch(EmployeesDataGeneration __instance)
{
EmployeeLevelPatch(__instance);
}
public static void EmployeeLevelPatch(EmployeesDataGeneration __instance)
{
int num = Random.Range(0, 5);
int num2 = Random.Range(5, 10);
for (int i = 0; i < 10; i++)
{
int num3 = Random.Range(0, 7);
int num4;
int num5;
int num6;
int num7;
if (i == num)
{
num4 = Random.Range(6, 11);
num5 = Random.Range(7, 11);
num6 = Random.Range(6, 11);
num7 = Random.Range(7, 11);
}
else if (i == num2)
{
num4 = Random.Range(5, 11);
num5 = Random.Range(4, 11);
num6 = Random.Range(5, 11);
num7 = Random.Range(4, 11);
}
else
{
num4 = Random.Range(1, 11);
num5 = Random.Range(1, 11);
num6 = Random.Range(1, 11);
num7 = Random.Range(1, 11);
}
if (BetterSMT.EmployeesEnabled.Value)
{
num4 = BetterSMT.EmployeesLevel.Value;
num5 = BetterSMT.EmployeesLevel.Value;
num6 = BetterSMT.EmployeesLevel.Value;
num7 = BetterSMT.EmployeesLevel.Value;
}
int num8 = (num4 + num5 + num6 + num7) * Random.Range(3, 6) + Random.Range(-2, 3) * 10;
num8 = Mathf.Clamp(num8, 30, 1000);
string text = num3 + "|" + num8 + "|" + num4 + "|" + num5 + "|" + num6 + "|" + num7;
__instance.managerComponent.todaysEmployeesData[i] = text;
__instance.managerComponent.UpdateTodayEmployeesOnClients(i, text);
}
}
}
[HarmonyPatch(typeof(GameCanvas))]
internal class NotificationHandler
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
public static void NotificationHandler_Postfix(GameCanvas __instance, ref bool ___inCooldown)
{
if (BetterSMT.ToggleDoublePrice.Value && BetterSMT.notify)
{
___inCooldown = false;
BetterSMT.notify = false;
string text = "`";
switch (BetterSMT.notificationType)
{
case "priceToggle":
text = text + "Double Price: " + (BetterSMT.doublePrice ? "ON" : "OFF");
break;
case "roundDownSwitch":
text = text + "Rounding to nearest " + (BetterSMT.NearestTen.Value ? "ten" : "five") + ((!BetterSMT.roundDown.Value) ? "\r\n(Currently disabled)" : "");
break;
case "roundDownToggle":
text = text + "Rounding has been " + (BetterSMT.roundDown.Value ? "enabled" : "disabled");
break;
}
__instance.CreateCanvasNotification(text);
}
}
}
[HarmonyPatch(typeof(GameData), "WorkingDayControl")]
public class GameDataPatch
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static UnityAction <>9__7_0;
internal void <UpdateEscapeMenu>b__7_0()
{
((MonoBehaviour)GameData.Instance).StartCoroutine(SaveGame());
}
}
public static readonly Dictionary<int, string> productNames = new Dictionary<int, string>
{
{ 0, "Pasta Penne" },
{ 1, "Water Bottle" },
{ 2, "Honey Cereals" },
{ 3, "Rice" },
{ 4, "Salt" },
{ 5, "Sugar" },
{ 6, "Margarine" },
{ 7, "Flour" },
{ 8, "Apple Juice" },
{ 9, "Olive Oil" },
{ 10, "Ketchup" },
{ 11, "Sliced Bread" },
{ 12, "Pepper" },
{ 13, "Orange Juice" },
{ 14, "Barbaque Sauce" },
{ 15, "Mustard Sauce" },
{ 16, "Spaghetti Box" },
{ 17, "Tuna Pate" },
{ 18, "Fiber Cereals" },
{ 19, "Supreme Flour" },
{ 20, "Black Coffee" },
{ 21, "Egg Box" },
{ 22, "Houmous" },
{ 23, "White Flour" },
{ 24, "Cane Sugar Box" },
{ 25, "Sugar" },
{ 26, "Macarroni" },
{ 27, "Ecologic Sugar" },
{ 28, "Brown Sugar" },
{ 29, "Sunflower Oil" },
{ 30, "Mash Potatoes" },
{ 31, "Potato Bag" },
{ 32, "Espresso Coffee" },
{ 33, "Basmati Rice" },
{ 34, "Long Grain Rice" },
{ 35, "Coffee" },
{ 36, "Supreme Pasta" },
{ 37, "Chocolate Cereals" },
{ 38, "Premium Water" },
{ 39, "Spring Water" },
{ 40, "Powdered Sugar" },
{ 41, "Sugar - Big Box" },
{ 42, "Brown Sugar - Big Box" },
{ 43, "Emmental Cheese" },
{ 44, "Gruyere Cheese" },
{ 45, "Skimmed Cheese" },
{ 46, "Fruit Yoghurt" },
{ 47, "Vanilla Yoghurt" },
{ 48, "Milk Brick" },
{ 49, "Butter" },
{ 50, "Parmigiano Cheese" },
{ 51, "Reggiano Cheese" },
{ 52, "Mozzarella Cheese" },
{ 53, "Skimmed Yoghurt" },
{ 54, "Cola Pack" },
{ 55, "Soda Pack" },
{ 56, "Decaf Soda Pack" },
{ 57, "Soda Bottle" },
{ 58, "Cola Bottle" },
{ 59, "Sugar Free Soda Bottle" },
{ 60, "Premium Soda" },
{ 61, "Pizza Barbaque" },
{ 62, "Fondue" },
{ 63, "Crocanti Ham" },
{ 64, "Ham Cheese Crepe" },
{ 65, "French Fries" },
{ 66, "Crispy Potato Pops" },
{ 67, "Green Beans" },
{ 68, "Four Cheese Pizza" },
{ 69, "Four Seasons Pizza" },
{ 70, "Vegetable Mix" },
{ 71, "Chicken Mix" },
{ 72, "Bolognaise Lasagna" },
{ 73, "Vegetable Lasagna" },
{ 74, "Toothpaste" },
{ 75, "Toilet Paper" },
{ 76, "Hand Soap" },
{ 77, "Avocado Shampoo" },
{ 78, "Egg Shampoo" },
{ 79, "Bath Gel" },
{ 80, "Toilet Paper" },
{ 81, "Mango Soap" },
{ 82, "Extra Soft Shampoo" },
{ 83, "Jojoba Honey Shampoo" },
{ 84, "Argan Oil Shampoo" },
{ 85, "Paper Towel" },
{ 86, "Double Side Toilet Paper" },
{ 87, "Lemon Soap" },
{ 88, "Premium Bath Gel" },
{ 89, "Shampoo For Babies" },
{ 90, "Detergent" },
{ 91, "Stain Remover" },
{ 92, "Glass Cleaner" },
{ 93, "Detergent Tables" },
{ 94, "Dishwasher" },
{ 95, "Bleach" },
{ 96, "Bleach - Big Bottle" },
{ 97, "Softener" },
{ 98, "Premium Detergent" },
{ 99, "Insecticide" },
{ 100, "Cleaning Cloths" },
{ 101, "Premium Capsules" },
{ 102, "Premium Bleach" },
{ 103, "Ammonia" },
{ 104, "Cookie Jar" },
{ 105, "Maxi Cone" },
{ 106, "Chocolate Spread" },
{ 107, "Chocolate Powder" },
{ 108, "Chips" },
{ 109, "Sweet Bonbek" },
{ 110, "Peach Jam" },
{ 111, "Ice Cream Box" },
{ 112, "Chocolate Box" },
{ 113, "Chocolate Biscuit" },
{ 114, "Vanilate Biscuit" },
{ 115, "Madeleine" },
{ 116, "Strawberry Jam" },
{ 117, "Peanut Butter" },
{ 118, "Chipos" },
{ 119, "Marshmallow" },
{ 120, "Lemon Biscuit" },
{ 121, "Hazelnut Biscuit" },
{ 122, "Premium Ice Cream" },
{ 123, "Honey" },
{ 124, "Premium Chocolate Box" },
{ 125, "Foditos" },
{ 126, "Premium Cake" },
{ 127, "Chopped Beef" },
{ 128, "Pure Beef" },
{ 129, "Veal" },
{ 130, "Chicken Wings" },
{ 131, "Chicken" },
{ 132, "Parma Ham" },
{ 133, "Sliced Ham" },
{ 134, "Peas - Big" },
{ 135, "Tuna - Big" },
{ 136, "Red Beans" },
{ 137, "Cat Food" },
{ 138, "Cat Food" },
{ 139, "Dog Food" },
{ 140, "Green Tea" },
{ 141, "Lemon Tea" },
{ 142, "Black Tea" },
{ 143, "Peppermint" },
{ 144, "Mint" },
{ 145, "Valerian" },
{ 146, "Big Sushi" },
{ 147, "Small Sushi" },
{ 148, "Smoked Salmon" },
{ 149, "Crab Sticks" },
{ 150, "Book - Electromagnetic" },
{ 151, "Book - Surprise" },
{ 152, "Book - ABC" },
{ 153, "Book - Mother And Child" },
{ 154, "Book - Colors" },
{ 155, "Book - Piticha" },
{ 156, "Book - OnceUpon" },
{ 157, "Book - Krok" },
{ 158, "Book - Adventures" },
{ 159, "Book - Donnine" },
{ 160, "Book - Vintage" },
{ 161, "Book - I Wont Share" },
{ 162, "Beer Pack" },
{ 163, "Beer Pack" },
{ 164, "Beer Pack" },
{ 165, "Beer Barrel" },
{ 166, "Beer Barrel" },
{ 167, "Vodka" },
{ 168, "Red Wine" },
{ 169, "Rose Wine" },
{ 170, "White Wine" },
{ 171, "Beer Barrel" },
{ 172, "Premium Vodka" },
{ 173, "Japanese Whisky" },
{ 174, "Premium Whisky" },
{ 175, "Premium Whisky" },
{ 176, "Hydrogen Peroxide" },
{ 177, "Disinfectant" },
{ 178, "Ibuprofen" },
{ 179, "Paracetamol" },
{ 180, "Adhesive Bandages" },
{ 181, "Laxative" },
{ 182, "Antihistamine" },
{ 183, "Zinc Supplement" },
{ 184, "Antioxidant" },
{ 185, "Fish Oil" },
{ 186, "Algae Pills" },
{ 187, "Vitamins" },
{ 188, "Melatonin" },
{ 189, "Sunscreen" },
{ 190, "Stretch Cream" },
{ 191, "Red Apple Tray" },
{ 192, "Green Apple Tray" },
{ 193, "Clementine Tray" },
{ 194, "Orange Tray" },
{ 195, "Pear Tray" },
{ 196, "Lemon Tray" },
{ 197, "Mango Tray" },
{ 198, "Avocado Tray" },
{ 199, "Kiwi Tray" },
{ 200, "Papaya Tray" },
{ 201, "Strawberry Tray" },
{ 202, "Cherry Tray" },
{ 203, "Artichoke Tray" },
{ 204, "Zucchini Tray" },
{ 205, "Carrot Tray" },
{ 206, "Tomato Tray" },
{ 207, "Potato Tray" },
{ 208, "Onion Tray" },
{ 209, "Banana Pack" },
{ 210, "Melon" },
{ 211, "Pineapple" },
{ 212, "Pumpkin" },
{ 213, "Watermelon" },
{ 214, "Baby Food: Vegetables" },
{ 215, "Baby Food: Fish" },
{ 216, "Baby Food: Fruits" },
{ 217, "Baby Food: Meat" },
{ 218, "Nutritive Milk Mix" },
{ 219, "Nutritive Milk Powder" },
{ 220, "Ecologic Diapers" },
{ 221, "Basic Diapers" },
{ 222, "Toddler Diapers" },
{ 223, "Premium Diapers" },
{ 224, "Aloe Baby Wipes " },
{ 225, "Basic Baby Wipes" },
{ 226, "Baby Powder" },
{ 227, "Orange Soda" },
{ 228, "Pineapple Soda" },
{ 229, "Tropical Soda" },
{ 230, "Green Tea Drink" },
{ 231, "Red Tea Drink" },
{ 232, "Lemon Tea Drink" },
{ 233, "Cold Brew Coffee" },
{ 234, "Blueberry Energy Drink" },
{ 235, "Guava Energy Drink" },
{ 236, "Lima Energy Drink" },
{ 237, "Fruit Punch Energy Drink" },
{ 238, "Mango Energy Drink" },
{ 239, "Cola Energy Drink" },
{ 240, "Sugar Free Energy Drink" },
{ 241, "Basic Strawberry Ice Cream" },
{ 242, "Lemon Ice Cream" },
{ 243, "Coffee Ice Cream" },
{ 244, "Stracciatella Ice Cream" },
{ 245, "Strawberry Meringue Ice Cream" },
{ 246, "Caramel Ice Cream" },
{ 247, "Premium Strawberry Ice Cream" },
{ 248, "Strawberry Cheesecake Ice Cream" },
{ 249, "Premium Caramel Ice Cream" },
{ 250, "Pink Strawberry Ice Cream" },
{ 251, "Alcoholic Ice Cream" },
{ 252, "Chickpeas" },
{ 253, "Meatballs" },
{ 254, "Lentils" },
{ 255, "Tomato Soup" },
{ 256, "Canned Corn" },
{ 257, "Canned Peas" },
{ 258, "Strawberry Seeds" },
{ 259, "Raspberry Seeds" },
{ 260, "Blueberry Seeds" },
{ 261, "Pineapple Seeds" },
{ 262, "Meyer Lemon Seeds" },
{ 263, "Tomato Seeds" },
{ 264, "Pepper Seeds" },
{ 265, "Cucumber Seeds" },
{ 266, "Radish Seeds" },
{ 267, "Carrots Seeds" },
{ 268, "Lawn Seeds" },
{ 269, "Poppy Seeds" },
{ 270, "Tulip Seeds" },
{ 271, "Sunflower Seeds" },
{ 272, "Petunia Seeds" },
{ 273, "Hand Rake (A)" },
{ 274, "Hand Rake (B)" },
{ 275, "Hand Shovel" },
{ 276, "Hand Cultivator" },
{ 277, "Potting Soil" },
{ 278, "Fertilizer" },
{ 279, "Plant Pot Dish" },
{ 280, "Plant Pot" },
{ 281, "AA Batteries" },
{ 282, "AAA Batteries" },
{ 283, "C Batteries" },
{ 284, "9V Batteries" },
{ 285, "Universal TV Remote" },
{ 286, "Universal Phone Charger" },
{ 287, "Basic Prepaid Phone" },
{ 288, "Basic Mouse" },
{ 289, "Wifi Dongle" },
{ 290, "Basic Earbuds" },
{ 291, "Basic Keyboard" },
{ 292, "Basic Gamepad" },
{ 293, "USB Flash Drive (128GB)" },
{ 294, "USB Flash Drive (256GB)" },
{ 295, "USB Flash Drive (512GB)" },
{ 296, "USB Flash Drive (1TB)" },
{ 297, "Basic Speaker" },
{ 298, "Basic Headphones" },
{ 299, "Basic Gaming Console" }
};
[HarmonyPatch("OnStartClient")]
[HarmonyPostfix]
private static void OnStartClientPatch()
{
ShowCounters();
UpdateEscapeMenu();
}
[HarmonyPatch(typeof(GameData), "ServerCalculateNewInflation")]
[HarmonyPostfix]
private static void OptimizePricesDaily()
{
OptimizeProductPrices();
}
[HarmonyPatch("WorkingDayControl")]
[HarmonyPostfix]
private static void WorkingDayControlPatch(GameData __instance)
{
WorkingDayLightControlPatch(__instance);
WorkingDayEmployeeControlPatch(__instance);
WorkingDayRentControlPatch(__instance);
}
[HarmonyPatch("TrashManager")]
[HarmonyPostfix]
private static void TrashManagerPatch(GameData __instance)
{
NextTimeToSpawnTrashPatch(__instance);
}
[HarmonyPatch(typeof(GameData), "UserCode_CmdOpenSupermarket")]
[HarmonyPostfix]
private static void UserCode_CmdOpenSupermarketPatch(GameData __instance)
{
MaxCustomersNPCsPatch(__instance);
}
public static void OptimizeProductPrices()
{
if (!BetterSMT.AutoAdjustPriceDaily.Value)
{
return;
}
GameObject[] productPrefabs = ProductListing.Instance.productPrefabs;
ProductListing instance = ProductListing.Instance;
List<float> list = new List<float>();
for (int i = 0; i < productPrefabs.Length; i++)
{
if (i < productPrefabs.Length)
{
Data_Product component = productPrefabs[i].GetComponent<Data_Product>();
list.Add(component.basePricePerUnit);
}
}
float[] array = list.ToArray();
float[] tierInflation = instance.tierInflation;
float value = BetterSMT.AutoAdjustPriceDailyValue.Value;
for (int j = 0; j < array.Length; j++)
{
Data_Product component2 = productPrefabs[j].GetComponent<Data_Product>();
float num = array[j] * tierInflation[component2.productTier] * value;
float num2 = Mathf.Floor(num * 100f) / 100f;
instance.CmdUpdateProductPrice(j, num2);
}
}
private static void UpdateEscapeMenu()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Expected O, but got Unknown
GameObject val = GameObject.Find("MasterOBJ/MasterCanvas/Menus/EscapeMenu/");
GameObject gameObject = ((Component)val.transform.Find("OptionsButton")).gameObject;
GameObject gameObject2 = ((Component)val.transform.Find("QuitButton")).gameObject;
gameObject2.transform.localPosition = new Vector3(0f, 0f, 0f);
GameObject gameObject3 = ((Component)val.transform.Find("MainMenuButton")).gameObject;
gameObject3.transform.localPosition = new Vector3(0f, 85f, 0f);
GameObject val2 = Object.Instantiate<GameObject>(gameObject2, val.transform);
((Object)val2).name = "SaveButton";
PlayMakerFSM[] components = val2.GetComponents<PlayMakerFSM>();
components.ToList().ForEach((Action<PlayMakerFSM>)Object.Destroy);
Object.Destroy((Object)(object)val2.GetComponent<EventTrigger>());
val2.transform.position = gameObject2.transform.position;
val2.transform.localScale = gameObject2.transform.localScale;
val2.transform.localPosition = new Vector3(0f, -85f, 0f);
((TMP_Text)val2.GetComponentInChildren<TextMeshProUGUI>()).text = "Save Game";
Button component = val2.GetComponent<Button>();
ButtonClickedEvent onClick = component.onClick;
object obj = <>c.<>9__7_0;
if (obj == null)
{
UnityAction val3 = delegate
{
((MonoBehaviour)GameData.Instance).StartCoroutine(SaveGame());
};
<>c.<>9__7_0 = val3;
obj = (object)val3;
}
((UnityEvent)onClick).AddListener((UnityAction)obj);
if (!((NetworkBehaviour)GameData.Instance).isServer)
{
val2.SetActive(false);
}
}
public static IEnumerator SaveGame()
{
NetworkSpawner nSpawnerComponent = ((Component)GameData.Instance).GetComponent<NetworkSpawner>();
if (!nSpawnerComponent.isSaving)
{
BetterSMT.CreateImportantNotification("Saving Game");
GameData.Instance.DoDaySaveBackup();
GameData.Instance.DoDaySaveBackup();
PlayMakerFSM fsm = GameData.Instance.SaveOBJ.GetComponent<PlayMakerFSM>();
fsm.FsmVariables.GetFsmBool("IsSaving").Value = true;
fsm.SendEvent("Send_Data");
while (fsm.FsmVariables.GetFsmBool("IsSaving").Value)
{
yield return null;
}
yield return nSpawnerComponent.SavePropsCoroutine();
BetterSMT.CreateImportantNotification("Saving Finished");
}
else
{
BetterSMT.CreateImportantNotification("Saving already in progress");
}
}
public static void ShowCounters()
{
if (BetterSMT.ShowPing.Value)
{
GameObject val = GameObject.Find("MasterOBJ/MasterCanvas/Ping");
if ((Object)(object)val == (Object)null)
{
BetterSMT.Logger.LogWarning((object)"Couldnt find Ping object");
return;
}
val.SetActive(true);
}
if (BetterSMT.ShowFPS.Value)
{
GameObject val2 = GameObject.Find("MasterOBJ/MasterCanvas/FPSDisplay");
if ((Object)(object)val2 == (Object)null)
{
BetterSMT.Logger.LogWarning((object)"Couldnt find FPSDisplay object");
}
else
{
val2.SetActive(true);
}
}
}
public static void WorkingDayLightControlPatch(GameData __instance)
{
UpgradesManager component = ((Component)__instance).GetComponent<UpgradesManager>();
if ((Object)(object)component != (Object)null)
{
float lightCost = BetterSMT.LightCostMod.Value + (float)component.spaceBought + (float)component.storageBought;
__instance.lightCost = lightCost;
}
else
{
__instance.lightCost = 10f + (float)component.spaceBought + (float)component.storageBought;
}
}
[HarmonyPatch("AddExpensiveList")]
[HarmonyPostfix]
public static void CustomerNPCControlPatch(GameData __instance, int productID)
{
AddExpensiveListPatch(__instance, productID);
}
[HarmonyPatch("AddNotFoundList")]
[HarmonyPostfix]
public static void AddNotFoundList(GameData __instance, int productID)
{
AddNotFoundListPatch(__instance, productID);
}
public static void AddExpensiveListPatch(GameData __instance, int productID)
{
if (__instance.productsTooExpensiveList.Count == 0)
{
__instance.productsTooExpensiveList.Add(productID);
}
foreach (int productsTooExpensive in __instance.productsTooExpensiveList)
{
if (productsTooExpensive == productID)
{
if (BetterSMT.MissingProduct.Value)
{
string text = (productNames.ContainsKey(productID) ? productNames[productID] : $"Product {productID}");
PlayerObjectController val = Object.FindObjectOfType<PlayerObjectController>();
string text2 = text + " is not found on the shelf.";
val.CmdSendMessage(text2, (NetworkConnectionToClient)null);
Debug.Log((object)text2);
}
return;
}
}
__instance.productsTooExpensiveList.Add(productID);
}
public static void AddNotFoundListPatch(GameData __instance, int productID)
{
if (__instance.productsNotFoundList.Count == 0)
{
__instance.productsNotFoundList.Add(productID);
}
foreach (int productsNotFound in __instance.productsNotFoundList)
{
if (productsNotFound == productID)
{
if (BetterSMT.MissingProduct.Value)
{
string text = (productNames.ContainsKey(productID) ? productNames[productID] : $"Product {productID}");
PlayerObjectController val = Object.FindObjectOfType<PlayerObjectController>();
string text2 = text + " is not found on the shelf.";
val.CmdSendMessage(text2, (NetworkConnectionToClient)null);
Debug.Log((object)text2);
}
return;
}
}
__instance.productsNotFoundList.Add(productID);
}
public static void MaxCustomersNPCsPatch(GameData __instance)
{
if (__instance.isSupermarketOpen || (__instance.timeOfDay < 23f && __instance.timeOfDay > 8f))
{
__instance.maxProductsCustomersToBuy = BetterSMT.BaseCustomerCart.Value + __instance.gameDay / 2 + NetworkServer.connections.Count + __instance.difficulty;
__instance.maxProductsCustomersToBuy = Mathf.Clamp(__instance.maxProductsCustomersToBuy, BetterSMT.BaseCustomerCart.Value, BetterSMT.MaxCustomerCart.Value + NetworkServer.connections.Count + __instance.difficulty);
__instance.maxCustomersNPCs = BetterSMT.BaseCustomerSpawns.Value + __instance.gameDay + (NetworkServer.connections.Count - 1) * 4 + __instance.extraCustomersPerk + __instance.difficulty * 2;
__instance.maxCustomersNPCs = Mathf.Clamp(__instance.maxCustomersNPCs, BetterSMT.BaseCustomerSpawns.Value, BetterSMT.MaxCustomerInStore.Value + NetworkServer.connections.Count);
}
}
public static void NextTimeToSpawnTrashPatch(GameData __instance)
{
if (BetterSMT.DisableTrash.Value)
{
__instance.nextTimeToSpawnTrash = 99999f;
}
}
public static void WorkingDayRentControlPatch(GameData __instance)
{
UpgradesManager component = ((Component)__instance).GetComponent<UpgradesManager>();
if ((Object)(object)component != (Object)null)
{
float rentCost = BetterSMT.RentCostMod.Value + (float)(component.spaceBought * 5) + (float)(component.storageBought * 10);
__instance.rentCost = rentCost;
}
else
{
__instance.rentCost = 10f + (float)(component.spaceBought * 5) + (float)(component.storageBought * 10);
}
}
public static void WorkingDayEmployeeControlPatch(GameData __instance)
{
UpgradesManager component = ((Component)__instance).GetComponent<UpgradesManager>();
if ((Object)(object)component != (Object)null)
{
float employeesCost = BetterSMT.EmployeeCostMod.Value + (float)(NPC_Manager.Instance.maxEmployees * 60);
__instance.employeesCost = employeesCost;
}
else
{
__instance.employeesCost = NPC_Manager.Instance.maxEmployees * 60;
}
}
}
[HarmonyPatch(typeof(LocalizationManager))]
internal class LocalizationHandler
{
[HarmonyPatch("GetLocalizationString")]
[HarmonyPrefix]
public static bool NoLocalization_Prefix(ref string key, ref string __result)
{
if (key[0] == '`')
{
string text = key;
__result = text.Substring(1, text.Length - 1);
return false;
}
return true;
}
}
[HarmonyPatch(typeof(ManagerBlackboard))]
public class RemoveBoxSpawnTimePatch
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> InstantCargoSpawner(IEnumerable<CodeInstruction> instructions)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
return BetterSMT.FastBoxSpawns.Value ? new CodeMatcher(instructions, (ILGenerator)null).Start().MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
{
new CodeMatch((OpCode?)OpCodes.Newobj, (object)AccessTools.Constructor(typeof(WaitForSeconds), new Type[1] { typeof(float) }, false), (string)null)
}).Repeat((Action<CodeMatcher>)delegate(CodeMatcher matcher)
{
matcher.Advance(-1);
matcher.SetOperandAndAdvance((object)0.01f);
matcher.Advance(1);
}, (Action<string>)null)
.InstructionEnumeration() : instructions;
}
}
[HarmonyPatch(typeof(NPC_Info))]
public class NPC_InfoPatch
{
[HarmonyPatch(typeof(NPC_Info))]
public class DisableThievesPatch
{
[HarmonyPatch("CreateNPCCharacter")]
[HarmonyPostfix]
private static void MakeNPCsThieves(ref bool ___isAThief)
{
___isAThief = BetterSMT.AllNPCAreThieves.Value || (!BetterSMT.DisableAllThieves.Value & ___isAThief);
}
}
[HarmonyPatch("PlaceProducts")]
[HarmonyPrefix]
private static void PlaceProductsPatch(NPC_Info __instance)
{
__instance.productItemPlaceWait = (BetterSMT.FasterCheckout.Value ? 0f : 0.5f);
}
[HarmonyPatch("AuxiliarAnimationPlay")]
[HarmonyPrefix]
private static bool AuxiliarAnimationPlayPatch(NPC_Info __instance, ref int animationIndex)
{
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
if (!BetterSMT.OneHitThief.Value)
{
return true;
}
if (!__instance.beingPushed)
{
((MonoBehaviour)__instance).StartCoroutine(__instance.StopSpeed());
}
if (__instance.isAThief && __instance.productsIDCarrying.Count > 0)
{
int count = __instance.productsIDCarrying.Count;
for (int i = 0; i < count; i++)
{
GameObject val = Object.Instantiate<GameObject>(__instance.stolenProductPrefab, NPC_Manager.Instance.droppedProductsParentOBJ.transform);
val.transform.position = ((Component)__instance).transform.position + new Vector3(Random.Range(-0.4f, 0.4f), 0f, Random.Range(-0.4f, 0.4f));
val.GetComponent<StolenProductSpawn>().NetworkproductID = __instance.productsIDCarrying[0];
val.GetComponent<StolenProductSpawn>().NetworkproductCarryingPrice = __instance.productsCarryingPrice[0] * 0.8f;
NetworkServer.Spawn(val, (NetworkConnection)null);
__instance.productsIDCarrying.RemoveAt(0);
__instance.productsCarryingPrice.RemoveAt(0);
}
}
if (__instance.isAThief && __instance.productsIDCarrying.Count == 0 && Object.op_Implicit((Object)(object)((Component)((Component)__instance).transform.Find("ThiefCanvas")).gameObject) && ((Component)((Component)__instance).transform.Find("ThiefCanvas")).gameObject.activeSelf)
{
__instance.RpcHideThief();
}
int num = Random.Range(0, 9);
__instance.RpcAnimationPlay(animationIndex);
__instance.RPCNotificationAboveHead("NPCmessagehit" + num, "");
return false;
}
}
[HarmonyPatch(typeof(NPC_Manager))]
public class NPC_ManagerPatch
{
[HarmonyPatch("GetAvailableSelfCheckout")]
[HarmonyPostfix]
private static void GetAvailableSelfCheckoutPatch(NPC_Info npcInfo, NPC_Manager __instance)
{
SelfCheckoutPatch(npcInfo, __instance);
}
public static int SelfCheckoutPatch(NPC_Info npcInfo, NPC_Manager __instance)
{
if (npcInfo.productsIDCarrying.Count > 18 + __instance.selfcheckoutExtraProductsFromPerk || npcInfo.productsIDCarrying.Count == 0)
{
return -1;
}
float num = Mathf.Clamp((float)((18 + __instance.selfcheckoutExtraProductsFromPerk) / npcInfo.productsIDCarrying.Count), 0f, 1f);
if (__instance.selfcheckoutChanceCurve.Evaluate(num) < Random.value)
{
for (int i = 0; i < __instance.selfCheckoutOBJ.transform.childCount; i++)
{
if (!((Component)__instance.selfCheckoutOBJ.transform.GetChild(i)).GetComponent<Data_Container>().checkoutQueue[0])
{
if (!BetterSMT.SelfCheckoutTheft.Value && npcInfo.productsIDCarrying.Count > 6 && Random.value < 0.02f + (float)GameData.Instance.difficulty * 0.005f)
{
int index = Random.Range(0, npcInfo.productsIDCarrying.Count);
npcInfo.productsIDCarrying.RemoveAt(index);
npcInfo.productsCarryingPrice.RemoveAt(index);
}
return i;
}
}
}
return -1;
}
}
[HarmonyPatch(typeof(PlayerNetwork))]
public class PlayerNetworkPatch
{
public enum ShelfType
{
ProductDisplay,
Storage
}
private struct ShelfData
{
public string highlightsName;
public string highlightsOriginalName;
public ShelfType shelfType;
public ShelfData(ShelfType shelfType)
{
if (shelfType == ShelfType.ProductDisplay)
{
highlightsName = "Labels";
highlightsOriginalName = "";
this.shelfType = ShelfType.ProductDisplay;
}
else
{
highlightsName = "HighlightsMarker";
highlightsOriginalName = "Highlights";
this.shelfType = ShelfType.Storage;
}
}
}
[HarmonyPatch(typeof(PlayerNetwork), "UserCode_CmdChangeEquippedItem__Int32")]
public static class PatchEquippedItemChange
{
[HarmonyPrefix]
public static void Prefix(int selectedItem)
{
Debug.Log((object)selectedItem);
}
}
private static readonly Stopwatch stopwatch = new Stopwatch();
private static PlayerNetwork pNetwork = null;
private static UpgradesManager upgradesManager;
private static readonly Dictionary<int, Transform> highlightObjectCache = new Dictionary<int, Transform>();
public static bool IsHighlightCacheUsed { get; set; } = true;
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void UpdatePatch(PlayerNetwork __instance, ref float ___pPrice, TextMeshProUGUI ___marketPriceTMP, ref TextMeshProUGUI ___yourPriceTMP)
{
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
if (BetterSMT.AutoSaveEnabled.Value && ((NetworkBehaviour)GameData.Instance).isServer)
{
if (!stopwatch.IsRunning)
{
stopwatch.Start();
}
if (stopwatch.Elapsed.TotalSeconds > (double)BetterSMT.AutoSaveTimer.Value)
{
stopwatch.Restart();
if (BetterSMT.AutoSaveDuringDay.Value || !GameData.Instance.NetworkisSupermarketOpen)
{
Debug.Log((object)"saved");
((MonoBehaviour)GameData.Instance).StartCoroutine(GameDataPatch.SaveGame());
}
}
}
if (FsmVariables.GlobalVariables.GetFsmBool("InChat").Value)
{
return;
}
KeyboardShortcut value;
if (BetterSMT.SledgeToggle.Value)
{
value = BetterSMT.SledgeHotkey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
__instance.CmdChangeEquippedItem(7);
}
}
if (BetterSMT.OsMartToggle.Value)
{
value = BetterSMT.OsMartHotkey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
__instance.CmdChangeEquippedItem(6);
}
}
if (BetterSMT.TrayToggle.Value)
{
value = BetterSMT.TrayHotkey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
__instance.CmdChangeEquippedItem(9);
}
}
if (BetterSMT.SalesToggle.Value)
{
value = BetterSMT.SalesHotkey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
__instance.CmdChangeEquippedItem(10);
}
}
if (BetterSMT.PricingGunToggle.Value)
{
value = BetterSMT.PricingGunHotkey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
__instance.CmdChangeEquippedItem(2);
}
}
if (BetterSMT.BroomToggle.Value)
{
value = BetterSMT.BroomHotkey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
__instance.CmdChangeEquippedItem(5);
}
}
if (BetterSMT.DLCTabletToggle.Value)
{
value = BetterSMT.DLCTabletHotkey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
__instance.CmdChangeEquippedItem(3);
}
}
if (BetterSMT.PricingGunToggle.Value || BetterSMT.BroomToggle.Value || BetterSMT.DLCTabletToggle.Value || BetterSMT.SledgeToggle.Value || BetterSMT.OsMartToggle.Value || BetterSMT.TrayToggle.Value || BetterSMT.SalesToggle.Value)
{
value = BetterSMT.EmptyHandsHotkey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
__instance.CmdChangeEquippedItem(0);
}
}
if (BetterSMT.ClockToggle.Value)
{
value = BetterSMT.ClockHotkey.Value;
if (((KeyboardShortcut)(ref value)).IsDown())
{
if ((Object)(object)upgradesManager == (Object)null)
{
TimeAccelerationWatcher val = Object.FindObjectOfType<TimeAccelerationWatcher>();
if ((Object)(object)val != (Object)null)
{
upgradesManager = ((Component)val).GetComponent<UpgradesManager>();
}
}
if ((Object)(object)upgradesManager != (Object)null)
{
bool flag = !upgradesManager.NetworkacceleratedTime;
upgradesManager.NetworkacceleratedTime = flag;
upgradesManager.RpcTimeAcceleration(flag);
}
}
}
if (!BetterSMT.ToggleDoublePrice.Value || !BetterSMT.doublePrice || !((Object)(object)___marketPriceTMP != (Object)null))
{
return;
}
string text = ((TMP_Text)___marketPriceTMP).text;
if (float.TryParse(text.Substring(1, text.Length - 1).Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
{
___pPrice = result * 2f;
if (BetterSMT.roundDown.Value)
{
___pPrice = (BetterSMT.NearestTen.Value ? ((float)(Math.Floor(___pPrice * 10f) / 10.0)) : ((float)(Math.Floor(___pPrice * 20f) / 20.0)));
}
((TMP_Text)___yourPriceTMP).text = "$" + ___pPrice;
}
}
[HarmonyPatch("ChangeEquipment")]
[HarmonyPostfix]
private static void ChangeEquipmentPatch(int newEquippedItem)
{
if (newEquippedItem == 0)
{
ClearHighlightedShelves();
}
}
[HarmonyPatch("Start")]
[HarmonyPrefix]
private static void StartPatch(PlayerNetwork __instance)
{
if (((NetworkBehaviour)__instance).isLocalPlayer)
{
pNetwork = __instance;
}
}
[HarmonyPatch("UpdateBoxContents")]
[HarmonyPostfix]
private static void UpdateBoxContentsPatch(int productIndex)
{
HighlightShelvesByProduct(productIndex);
}
[HarmonyPatch(typeof(Data_Container), "BoxSpawner")]
[HarmonyPostfix]
private static void BoxSpawnerPatch(Data_Container __instance)
{
AddHighlightMarkersToStorage(((Component)__instance).transform);
}
[HarmonyPatch(typeof(NetworkSpawner), "UserCode_CmdSpawn__Int32__Vector3__Vector3")]
[HarmonyPostfix]
private static void NewBuildableConstructed(NetworkSpawner __instance, int prefabID)
{
if (BetterSMT.Highlighting.Value)
{
GameObject val = __instance.buildables[prefabID];
if (((Object)val).name.Contains("StorageShelf"))
{
int parentIndex = val.GetComponent<Data_Container>().parentIndex;
Transform child = __instance.levelPropsOBJ.transform.GetChild(parentIndex);
GameObject gameObject = ((Component)child.GetChild(child.childCount - 1)).gameObject;
AddHighlightMarkersToStorage(gameObject.transform);
}
}
}
public static int GetProductFromRaycast()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
if (!BetterSMT.Highlighting.Value)
{
return -1;
}
int result = -1;
RaycastHit val = default(RaycastHit);
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(((Component)Camera.main).transform.position, ((Component)Camera.main).transform.forward, ref val, 4f, LayerMask.op_Implicit(pNetwork.interactableMask)))
{
if (((Object)((Component)((RaycastHit)(ref val)).transform).gameObject).name == "SubContainer")
{
int siblingIndex = ((RaycastHit)(ref val)).transform.GetSiblingIndex();
Transform transform = ((RaycastHit)(ref val)).transform;
object obj;
if (transform == null)
{
obj = null;
}
else
{
Transform parent = transform.parent;
if (parent == null)
{
obj = null;
}
else
{
Transform transform2 = ((Component)parent).transform;
obj = ((transform2 != null) ? transform2.parent : null);
}
}
if (!Object.op_Implicit((Object)obj))
{
return result;
}
Data_Container component = ((Component)((Component)((RaycastHit)(ref val)).transform.parent).transform.parent).GetComponent<Data_Container>();
if ((Object)(object)component != (Object)null && component.containerClass < 20)
{
result = component.productInfoArray[siblingIndex * 2];
}
}
}
else if (Physics.Raycast(((Component)Camera.main).transform.position, ((Component)Camera.main).transform.forward, ref val2, 4f, LayerMask.op_Implicit(pNetwork.lMask)))
{
if (((Component)((RaycastHit)(ref val2)).transform).gameObject.tag == "Interactable" && Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val2)).transform).GetComponent<BoxData>()))
{
BoxData component2 = ((Component)((RaycastHit)(ref val2)).transform).GetComponent<BoxData>();
if ((Object)(object)component2 != (Object)null)
{
result = component2.productID;
}
}
else
{
int siblingIndex2 = ((RaycastHit)(ref val2)).transform.GetSiblingIndex();
Transform transform3 = ((RaycastHit)(ref val2)).transform;
object obj2;
if (transform3 == null)
{
obj2 = null;
}
else
{
Transform parent2 = transform3.parent;
if (parent2 == null)
{
obj2 = null;
}
else
{
Transform transform4 = ((Component)parent2).transform;
obj2 = ((transform4 != null) ? transform4.parent : null);
}
}
if (!Object.op_Implicit((Object)obj2))
{
return result;
}
Data_Container component3 = ((Component)((Component)((RaycastHit)(ref val2)).transform.parent).transform.parent).GetComponent<Data_Container>();
if ((Object)(object)component3 != (Object)null && component3.containerClass == 69)
{
int num = component3.productInfoArray[siblingIndex2 * 2];
result = num;
}
}
}
return result;
}
public static void HighlightShelvesByProduct(int productID)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
if (BetterSMT.Highlighting.Value)
{
HighlightShelfTypeByProduct(productID, Color.yellow, ShelfType.ProductDisplay);
HighlightShelfTypeByProduct(productID, Color.red, ShelfType.Storage);
}
}
public static void ClearHighlightedShelves()
{
if (!BetterSMT.Highlighting.Value)
{
return;
}
if (IsHighlightCacheUsed)
{
foreach (KeyValuePair<int, Transform> item in highlightObjectCache)
{
HighlightShelf(item.Value, isEnableHighlight: false);
}
highlightObjectCache.Clear();
}
else
{
ClearHighlightShelvesByProduct(ShelfType.ProductDisplay);
ClearHighlightShelvesByProduct(ShelfType.Storage);
}
}
private static void ClearHighlightShelvesByProduct(ShelfType shelfType)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
HighlightShelfTypeByProduct(-1, Color.white, shelfType);
}
private static void HighlightShelfTypeByProduct(int productID, Color shelfHighlightColor, ShelfType shelfType)
{
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
if (!BetterSMT.Highlighting.Value)
{
return;
}
GameObject val = GameObject.Find(GetGameObjectStringPath(shelfType));
for (int i = 0; i < val.transform.childCount; i++)
{
Transform child = val.transform.GetChild(i);
int[] productInfoArray = ((Component)child).gameObject.GetComponent<Data_Container>().productInfoArray;
int num = productInfoArray.Length / 2;
bool isEnableHighlight = false;
for (int j = 0; j < num; j++)
{
if (productID >= 0 && productInfoArray[j * 2] == productID)
{
isEnableHighlight = true;
Transform val2 = child.Find(new ShelfData(shelfType).highlightsName);
if ((Object)(object)val2 != (Object)null)
{
Transform t = ((shelfType == ShelfType.Storage) ? val2.GetChild(j).GetChild(0) : val2.GetChild(j));
HighlightShelf(t, isEnableHighlight: true, Color.yellow);
}
}
}
HighlightShelf(child, isEnableHighlight, shelfHighlightColor);
}
}
public static string GetGameObjectStringPath(ShelfType shelfType)
{
if (1 == 0)
{
}
string result = shelfType switch
{
ShelfType.ProductDisplay => "Level_SupermarketProps/Shelves",
ShelfType.Storage => "Level_SupermarketProps/StorageShelves",
_ => throw new NotImplementedException(),
};
if (1 == 0)
{
}
return result;
}
public static void HighlightShelf(Transform t, bool isEnableHighlight, Color? color = null)
{
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Expected O, but got Unknown
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
if (!BetterSMT.Highlighting.Value)
{
return;
}
HighlightEffect val = ((Component)t).GetComponent<HighlightEffect>() ?? ((Component)t).gameObject.AddComponent<HighlightEffect>();
if (IsHighlightCacheUsed)
{
if (isEnableHighlight == val.highlighted)
{
return;
}
if (isEnableHighlight && !highlightObjectCache.ContainsKey(((Object)t).GetInstanceID()))
{
highlightObjectCache.Add(((Object)t).GetInstanceID(), t);
}
MeshRenderer component = ((Component)t).GetComponent<MeshRenderer>();
if ((Object)(object)component != (Object)null)
{
((Renderer)component).allowOcclusionWhenDynamic = !isEnableHighlight;
}
}
if (color.HasValue)
{
val.outlineColor = color.Value;
}
val.outlineQuality = (QualityLevel)1;
val.outlineVisibility = (Visibility)1;
val.outlineContourStyle = (ContourStyle)1;
val.outlineIndependent = true;
val.outline = (isEnableHighlight ? 1f : 0f);
val.glow = (isEnableHighlight ? 0f : 1f);
val.Refresh(false);
val.highlighted = isEnableHighlight;
foreach (Transform item in t)
{
Transform val2 = item;
if (((Object)val2).name.Contains("PriceLabel"))
{
HighlightEffect val3 = ((Component)val2).GetComponent<HighlightEffect>() ?? ((Component)val2).gameObject.AddComponent<HighlightEffect>();
if (color.HasValue)
{
val3.outlineColor = color.Value;
}
val3.outlineQuality = (QualityLevel)1;
val3.outlineVisibility = (Visibility)1;
val3.outlineContourStyle = (ContourStyle)1;
val3.outlineIndependent = true;
val3.outline = (isEnableHighlight ? 1f : 0f);
val3.glow = (isEnableHighlight ? 0f : 1f);
val3.Refresh(false);
val3.highlighted = isEnableHighlight;
}
}
}
public static void AddHighlightMarkersToStorage(Transform storage)
{
if (!BetterSMT.Highlighting.Value)
{
return;
}
ShelfData shelfData = new ShelfData(ShelfType.Storage);
Transform val = ((Component)storage).transform.Find(shelfData.highlightsName);
if (!((Object)(object)val != (Object)null))
{
val = Object.Instantiate<GameObject>(((Component)storage.Find(shelfData.highlightsOriginalName)).gameObject, storage).transform;
((Object)val).name = shelfData.highlightsName;
for (int i = 0; i < val.childCount; i++)
{
((Component)val.GetChild(i)).gameObject.SetActive(true);
Transform child = val.GetChild(i).GetChild(0);
((Component)child).gameObject.SetActive(true);
HighlightShelf(child, isEnableHighlight: false);
}
}
}
}
[HarmonyPatch]
public class AutoProductPatch
{
private static bool _hasPatched;
[HarmonyPostfix]
[HarmonyPatch(typeof(ProductListing), "OnStartClient")]
public static void Postfix(ProductListing __instance)
{
if (_hasPatched)
{
return;
}
_hasPatched = true;
GameObject[] productPrefabs = __instance.productPrefabs;
foreach (GameObject val in productPrefabs)
{
Data_Product component = val.GetComponent<Data_Product>();
if ((Object)(object)component != (Object)null)
{
component.maxItemsPerBox *= BetterSMT.MaxBoxSize.Value;
}
}
}
}
[HarmonyPatch(typeof(UpgradesManager))]
public class UpgradesManagerPatch
{
[HarmonyPatch(typeof(UpgradesManager))]
[HarmonyPatch("OnStartClient")]
public class ClockSpeedPatch
{
[HarmonyPostfix]
public static void Postfix(UpgradesManager __instance)
{
typeof(UpgradesManager).GetField("acceleratedTimeFactor", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(__instance, BetterSMT.ClockSpeed.Value);
if (BetterSMT.AllRecyclers.Value)
{
__instance.normalTrashContainerOBJ.SetActive(false);
__instance.recycleContainerOBJ.SetActive(true);
NPC_Manager.Instance.closestRecyclePerk = true;
}
if (BetterSMT.StartWithEmployee.Value && NPC_Manager.Instance.maxEmployees == 0)
{
NPC_Manager instance = NPC_Manager.Instance;
instance.maxEmployees++;
}
if (BetterSMT.EnablePalletDisplays.Value)
{
((MonoBehaviour)__instance).StartCoroutine(ForceEnablePalletDisplays(__instance));
}
}
private static IEnumerator ForceEnablePalletDisplays(UpgradesManager __instance)
{
yield return (object)new WaitForSeconds(1f);
for (int i = 0; i < __instance.UIpalletsOBJsArray.Length; i++)
{
GameObject obj = __instance.UIpalletsOBJsArray[i];
obj.transform.SetParent(__instance.UIBuildablesParentOBJ.transform);
obj.transform.SetSiblingIndex(__instance.UIBuildablesParentOBJ.transform.childCount - 2);
obj.SetActive(true);
yield return null;
}
while (!Object.op_Implicit((Object)(object)GameCanvas.Instance))
{
yield return null;
}
((Component)GameCanvas.Instance).GetComponent<Builder_Main>().ReassignBuildablesData();
}
}
[HarmonyPatch("ManageExtraPerks")]
[HarmonyPrefix]
private static bool ManageExtraPerksPatch(UpgradesManager __instance, int perkIndex)
{
switch (perkIndex)
{
case 5:
{
NPC_Manager instance12 = NPC_Manager.Instance;
instance12.extraEmployeeSpeedFactor += BetterSMT.EmployeeSpeedPerPerk.Value;
NPC_Manager.Instance.UpdateEmployeeStats();
break;
}
case 6:
{
NPC_Manager instance11 = NPC_Manager.Instance;
instance11.extraCheckoutMoney += BetterSMT.EmployeExtraCheckoutMoney.Value;
NPC_Manager.Instance.UpdateEmployeeStats();
break;
}
case 7:
{
NPC_Manager instance10 = NPC_Manager.Instance;
instance10.extraEmployeeSpeedFactor += BetterSMT.EmployeeSpeedPerPerk.Value;
NPC_Manager.Instance.UpdateEmployeeStats();
break;
}
case 9:
{
GameData component5 = ((Component)__instance).GetComponent<GameData>();
component5.extraCustomersPerk += BetterSMT.CustomersPerPerk.Value;
break;
}
case 10:
{
GameData component4 = ((Component)__instance).GetComponent<GameData>();
component4.extraCustomersPerk += BetterSMT.CustomersPerPerk.Value;
break;
}
case 16:
{
NPC_Manager instance9 = NPC_Manager.Instance;
instance9.productCheckoutWait -= BetterSMT.EmployeeCheckoutPerPerk1.Value;
break;
}
case 17:
{
NPC_Manager instance8 = NPC_Manager.Instance;
instance8.productCheckoutWait -= BetterSMT.EmployeeCheckoutPerPerk2.Value;
break;
}
case 18:
{
NPC_Manager instance7 = NPC_Manager.Instance;
instance7.productCheckoutWait -= BetterSMT.EmployeeCheckoutPerPerk3.Value;
break;
}
case 19:
{
NPC_Manager instance6 = NPC_Manager.Instance;
instance6.employeeItemPlaceWait -= BetterSMT.EmployeeRestockPerPerk.Value;
NPC_Manager.Instance.UpdateEmployeeStats();
break;
}
case 20:
{
NPC_Manager instance5 = NPC_Manager.Instance;
instance5.employeeItemPlaceWait -= BetterSMT.EmployeeRestockPerPerk.Value;
NPC_Manager.Instance.UpdateEmployeeStats();
break;
}
case 21:
{
NPC_Manager instance4 = NPC_Manager.Instance;
instance4.extraEmployeeSpeedFactor += BetterSMT.EmployeeSpeedPerPerk.Value;
NPC_Manager.Instance.UpdateEmployeeStats();
break;
}
case 22:
{
NPC_Manager instance3 = NPC_Manager.Instance;
instance3.extraEmployeeSpeedFactor += BetterSMT.EmployeeSpeedPerPerk.Value;
NPC_Manager.Instance.UpdateEmployeeStats();
break;
}
case 23:
{
NPC_Manager instance2 = NPC_Manager.Instance;
instance2.extraEmployeeSpeedFactor += BetterSMT.EmployeeSpeedPerPerk.Value;
NPC_Manager.Instance.UpdateEmployeeStats();
break;
}
case 25:
{
NPC_Manager instance = NPC_Manager.Instance;
instance.selfcheckoutExtraProductsFromPerk += BetterSMT.SelfCheckoutLimit.Value;
break;
}
case 35:
{
ProductListing component3 = ((Component)__instance).GetComponent<ProductListing>();
component3.allowedSimultaneousSales += BetterSMT.SalesAmount.Value;
break;
}
case 36:
{
ProductListing component2 = ((Component)__instance).GetComponent<ProductListing>();
component2.allowedSimultaneousSales += BetterSMT.SalesAmount.Value;
break;
}
case 37:
{
ProductListing component = ((Component)__instance).GetComponent<ProductListing>();
component.allowedSimultaneousSales += BetterSMT.SalesAmount.Value;
break;
}
default:
return true;
}
GameObject gameObject = ((Component)__instance.UIPerksParent.transform.GetChild(perkIndex)).gameObject;
gameObject.GetComponent<CanvasGroup>().alpha = 1f;
gameObject.tag = "Untagged";
((Component)gameObject.transform.Find("Highlight2")).gameObject.SetActive(true);
return false;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}