Decompiled source of BetterSMT v1.8.1

BepInEx/plugins/BetterSMT.dll

Decompiled 5 days ago
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 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("1.8.1.0")]
[assembly: AssemblyInformationalVersion("1.8.1+32e8711e93baacd5cfbc2da3b875aeb8b3502b34")]
[assembly: AssemblyProduct("BetterSMT")]
[assembly: AssemblyTitle("BetterSMT")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.8.1.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 DoublePrices.Patches
{
	[HarmonyPatch(typeof(LocalizationManager))]
	internal class LocalizationHandler
	{
		[HarmonyPatch("GetLocalizationString")]
		[HarmonyPrefix]
		public static bool noLocalization_Prefix(ref string key, ref string __result)
		{
			if (key[0] == '`')
			{
				__result = key.Substring(1);
				return false;
			}
			return true;
		}
	}
}
namespace BetterSMT
{
	[BepInPlugin("BetterSMT", "BetterSMT", "1.8.1")]
	public class BetterSMT : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("BetterSMT");

		public static BetterSMT Instance;

		public static ConfigEntry<int> EmployeesPerPerk;

		public static ConfigEntry<int> CustomersPerPerk;

		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<float> LightCostMod;

		public static ConfigEntry<float> RentCostMod;

		public static ConfigEntry<float> EmployeeCostMod;

		public static ConfigEntry<bool> OneHitThief;

		public static ConfigEntry<bool> StartWithEmployee;

		public static ConfigEntry<int> StartEmployeeAmount;

		public static ConfigEntry<bool> ReplaceCommasWithPeriods;

		public static ConfigEntry<bool> FasterCheckout;

		public static ConfigEntry<bool> ShowFPS;

		public static ConfigEntry<bool> DisableAllThieves;

		public static ConfigEntry<bool> AllNPCAreThieves;

		public static ConfigEntry<bool> ShowPing;

		public static ConfigEntry<bool> DisableTrash;

		public static ConfigEntry<bool> AlwaysDeleteMode;

		public static ConfigEntry<bool> DeleteProduct;

		public static string KeyboardShortcutDoublePriceKey = "Double price toggle";

		public static string KeyboardShortcutRoundDownSwitchKey = "Round down switch";

		public static string KeyboardShortcutRoundDownToggleKey = "Round down toggle";

		public static string roundDownKey = "Round down";

		public static string NearestFiveKey = "Round down to nearest 0.05";

		public static string NearestTenKey = "Round down to nearest 0.10";

		public static ConfigEntry<KeyboardShortcut> KeyboardShortcutDoublePrice;

		public static ConfigEntry<KeyboardShortcut> KeyboardShortcutRoundDownSwitch;

		public static ConfigEntry<KeyboardShortcut> KeyboardShortcutRoundDownToggle;

		public static ConfigEntry<bool> roundDown;

		public static ConfigEntry<bool> NearestFive;

		public static ConfigEntry<bool> NearestTen;

		public static bool doublePrice = true;

		public static bool notify = false;

		public static string notificationType;

		internal static ManualLogSource Logger { get; private set; } = null;


		private void Awake()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Expected O, but got Unknown
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Expected O, but got Unknown
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Expected O, but got Unknown
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Expected O, but got Unknown
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Expected O, but got Unknown
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Expected O, but got Unknown
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Expected O, but got Unknown
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Expected O, but got Unknown
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Expected O, but got Unknown
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Expected O, but got Unknown
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Expected O, but got Unknown
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Expected O, but got Unknown
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Expected O, but got Unknown
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_0450: Expected O, but got Unknown
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Expected O, but got Unknown
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: Expected O, but got Unknown
			KeyboardShortcutDoublePrice = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", KeyboardShortcutDoublePriceKey, new KeyboardShortcut((KeyCode)113, Array.Empty<KeyCode>()), (ConfigDescription)null);
			roundDown = ((BaseUnityPlugin)this).Config.Bind<bool>("Round Down", roundDownKey, false, (ConfigDescription)null);
			NearestFive = ((BaseUnityPlugin)this).Config.Bind<bool>("Round Down", NearestFiveKey, true, (ConfigDescription)null);
			NearestTen = ((BaseUnityPlugin)this).Config.Bind<bool>("Round Down", NearestTenKey, false, (ConfigDescription)null);
			KeyboardShortcutRoundDownSwitch = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Round Down Shortucts", KeyboardShortcutRoundDownSwitchKey, new KeyboardShortcut((KeyCode)113, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), (ConfigDescription)null);
			KeyboardShortcutRoundDownToggle = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Round Down Shortucts", KeyboardShortcutRoundDownToggleKey, new KeyboardShortcut((KeyCode)113, (KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)306,
				(KeyCode)304
			}), (ConfigDescription)null);
			Instance = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			EmployeesPerPerk = ((BaseUnityPlugin)this).Config.Bind<int>("Employees", "Employees Per Perk", 1, new ConfigDescription("Adjust the amount of employees you gain per perk (Higher number = more employees)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 5), 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.2f, 3f), 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.1f), 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, 50f), 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>()));
			DisableTrash = ((BaseUnityPlugin)this).Config.Bind<bool>("Trash", "Disables all trash from spawning", false, new ConfigDescription("Disables trash from spawning", (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, 50f), 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, 50f), 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.25f), 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.25f), 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.25f), 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.25f), 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, 10), 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>()));
			DeleteProduct = ((BaseUnityPlugin)this).Config.Bind<bool>("Building", "Delete shelves with product", false, new ConfigDescription("***WARNING*** THIS WILL ALLOW YOU TO DELETE SHELVES WITH PRODUCT. THIS WILL NOT REFUND MONEY.", (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>()));
			ReplaceCommasWithPeriods = ((BaseUnityPlugin)this).Config.Bind<bool>("Other", "Replace Commas with Periods", false, (ConfigDescription)null);
			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);
			harmony.PatchAll();
			Logger.LogInfo((object)"Plugin BetterSMT v1.8.1 is loaded!");
		}

		public static string ReplaceCommas(string text)
		{
			if (!ReplaceCommasWithPeriods.Value)
			{
				return text;
			}
			text = text.Replace("$", string.Empty);
			text = text.Replace(char.Parse(","), char.Parse("."));
			if (!text.Contains("."))
			{
				text += ".00";
			}
			return "$" + text;
		}

		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_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			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)
		{
			SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null);
			if (val != null && (val.ChangedSetting.Definition.Key == NearestFiveKey || val.ChangedSetting.Definition.Key == NearestTenKey) && 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 = "1.8.1";
	}
}
namespace BetterSMT.Patches
{
	[HarmonyPatch(typeof(Builder_Main), "WorkingDayControl")]
	public class Builder_MainPatch
	{
		[HarmonyPatch("DeleteBehaviour")]
		[HarmonyPostfix]
		private static void DeleteBehaviourPatch(Builder_Main __instance)
		{
			DeleteWheneverPatch(__instance);
		}

		public static void DeleteWheneverPatch(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.op_Implicit((Object)(object)__instance.oldHitOBJ2) && (Object)(object)((Component)((RaycastHit)(ref val)).transform).gameObject != (Object)(object)__instance.oldHitOBJ2 && Object.op_Implicit((Object)(object)__instance.hEffect2))
					{
						__instance.hEffect2.highlighted = false;
					}
					__instance.hEffect2 = ((Component)((RaycastHit)(ref val)).transform).GetComponent<HighlightEffect>();
					__instance.hEffect2.highlighted = true;
					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;
							}
							if (NPC_Manager.Instance.customersnpcParentOBJ.transform.childCount > 0)
							{
								GameCanvas.Instance.CreateCanvasNotification("message16");
								return;
							}
						}
						if (!BetterSMT.DeleteProduct.Value && __instance.FurnitureContainsProduct(((RaycastHit)(ref val)).transform))
						{
							GameCanvas.Instance.CreateCanvasNotification("message17");
							return;
						}
						if (Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<Data_Container>()))
						{
							int containerID = ((Component)((RaycastHit)(ref val)).transform).GetComponent<Data_Container>().containerID;
							if ((containerID == 6 || containerID == 7) && ((Component)((Component)GameData.Instance).GetComponent<NetworkSpawner>().levelPropsOBJ.transform.GetChild(2)).transform.childCount == 1)
							{
								GameCanvas.Instance.CreateCanvasNotification("checkoutwarning");
								return;
							}
						}
						if (Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val)).transform).GetComponent<NetworkIdentity>()))
						{
							float num = (float)((Component)((RaycastHit)(ref val)).transform).GetComponent<Data_Container>().cost * 0.9f;
							GameData.Instance.CmdAlterFundsWithoutExperience(num);
							((Component)GameData.Instance).GetComponent<NetworkSpawner>().CmdDestroyBox(((Component)((RaycastHit)(ref val)).transform).gameObject);
						}
					}
					__instance.oldHitOBJ2 = ((Component)((RaycastHit)(ref val)).transform).gameObject;
				}
				else if (Object.op_Implicit((Object)(object)__instance.hEffect2))
				{
					__instance.hEffect2.highlighted = false;
				}
			}
			else if (Object.op_Implicit((Object)(object)__instance.hEffect2))
			{
				__instance.hEffect2.highlighted = false;
			}
		}
	}
	[HarmonyPatch(typeof(PlayerNetwork))]
	internal class DoublePrice
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void doublePrice_Postfix(ref float ___pPrice, TextMeshProUGUI ___marketPriceTMP, ref TextMeshProUGUI ___yourPriceTMP)
		{
			if (!BetterSMT.doublePrice || !((Object)(object)___marketPriceTMP != (Object)null) || !float.TryParse(((TMP_Text)___marketPriceTMP).text.Substring(1).Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
			{
				return;
			}
			___pPrice = result * 2f;
			if (BetterSMT.roundDown.Value)
			{
				if (BetterSMT.NearestTen.Value)
				{
					___pPrice = (float)(Math.Floor(___pPrice * 10f) / 10.0);
				}
				else
				{
					___pPrice = (float)(Math.Floor(___pPrice * 20f) / 20.0);
				}
			}
			((TMP_Text)___yourPriceTMP).text = "$" + ___pPrice;
		}
	}
	[HarmonyPatch(typeof(GameData), "WorkingDayControl")]
	public class GameDataPatch
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__4_0;

			internal void <UpdateEscapeMenu>b__4_0()
			{
				((MonoBehaviour)GameData.Instance).StartCoroutine(SaveGame());
			}
		}

		[HarmonyPatch("OnStartClient")]
		[HarmonyPostfix]
		private static void OnStartClientPatch(GameData __instance)
		{
			ShowCounters();
			UpdateEscapeMenu();
		}

		[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("UserCode_CmdOpenSupermarket")]
		[HarmonyPostfix]
		private static void UserCode_CmdOpenSupermarketPatch(GameData __instance)
		{
			maxCustomersNPCsPatch(__instance);
		}

		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__4_0;
			if (obj == null)
			{
				UnityAction val3 = delegate
				{
					((MonoBehaviour)GameData.Instance).StartCoroutine(SaveGame());
				};
				<>c.<>9__4_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;
			}
		}

		public static void maxCustomersNPCsPatch(GameData __instance)
		{
			if (((Component)__instance).GetComponent<NetworkSpawner>().levelPropsOBJ.transform.GetChild(2).childCount == 0)
			{
				__instance.RpcNoCheckoutsMessage();
			}
			else if (!__instance.isSupermarketOpen || __instance.timeOfDay > 23f || __instance.timeOfDay < 8f)
			{
				__instance.NetworkisSupermarketOpen = true;
				__instance.timeFactor = 1f;
				__instance.maxProductsCustomersToBuy = 5 + __instance.gameDay / 2 + NetworkServer.connections.Count + __instance.difficulty;
				__instance.maxProductsCustomersToBuy = Mathf.Clamp(__instance.maxProductsCustomersToBuy, 5, 25 + NetworkServer.connections.Count + __instance.difficulty);
				__instance.maxCustomersNPCs = 3 + __instance.gameDay + (NetworkServer.connections.Count - 1) * 4 + __instance.extraCustomersPerk + __instance.difficulty * 2;
				__instance.maxCustomersNPCs = Mathf.Clamp(__instance.maxCustomersNPCs, 160, 700 + NetworkServer.connections.Count);
				__instance.RpcOpenSupermarket();
			}
		}

		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(GameCanvas))]
	internal class NotificationHandler
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void NotificationHandler_Postfix(GameCanvas __instance, ref bool ___inCooldown)
		{
			if (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(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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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(PlayerNetwork))]
	public class PlayerNetworkPatch
	{
		private static PlayerNetwork pNetwork;

		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		private static void StartPatch(PlayerNetwork __instance)
		{
			if (((NetworkBehaviour)__instance).isLocalPlayer)
			{
				pNetwork = __instance;
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdatePatch(PlayerNetwork __instance)
		{
			if (Object.op_Implicit((Object)(object)__instance.marketPriceTMP))
			{
				((TMP_Text)__instance.marketPriceTMP).text = BetterSMT.ReplaceCommas(((TMP_Text)__instance.marketPriceTMP).text);
			}
			if (Object.op_Implicit((Object)(object)__instance.yourPriceTMP))
			{
				((TMP_Text)__instance.yourPriceTMP).text = BetterSMT.ReplaceCommas(((TMP_Text)__instance.yourPriceTMP).text);
			}
		}

		[HarmonyPatch("PriceSetFromNumpad")]
		[HarmonyPrefix]
		private static void PriceSetFromNumpadPrePatch(PlayerNetwork __instance, ref int productID)
		{
			if (Input.GetKeyDown((KeyCode)101))
			{
				Data_Product component = ProductListing.Instance.productPrefabs[productID].GetComponent<Data_Product>();
				float num = ((Component)ProductListing.Instance).GetComponent<ProductListing>().tierInflation[component.productTier];
				int maxItemsPerBox = component.maxItemsPerBox;
				float basePricePerUnit = component.basePricePerUnit;
				basePricePerUnit *= num;
				basePricePerUnit = Mathf.Round(basePricePerUnit * 100f) / 100f;
				float num2 = basePricePerUnit * (float)maxItemsPerBox;
				num2 = Mathf.Round(num2 * 100f) / 100f;
				((Component)GameData.Instance).GetComponent<ManagerBlackboard>().AddShoppingListProduct(productID, num2);
				string text = "product" + productID;
				string localizationString = LocalizationManager.instance.GetLocalizationString(text);
				BetterSMT.CreateCanvasNotification("Added " + localizationString + "[" + component.productBrand + "] to shopping list");
			}
		}

		[HarmonyPatch("PriceSetFromNumpad")]
		[HarmonyPostfix]
		private static void PriceSetFromNumpadPostPatch(PlayerNetwork __instance)
		{
			((TMP_Text)__instance.yourPriceTMP).text = BetterSMT.ReplaceCommas(((TMP_Text)__instance.yourPriceTMP).text);
		}

		[HarmonyPatch("ChangeEquipment")]
		[HarmonyPostfix]
		private static void ChangeEquipmentPatch(PlayerNetwork __instance, int newEquippedItem)
		{
			if (newEquippedItem == 0)
			{
				ClearHighlightedShelves();
			}
		}

		[HarmonyPatch("UpdateBoxContents")]
		[HarmonyPostfix]
		private static void UpdateBoxContentsPatch(PlayerNetwork __instance, int productIndex)
		{
			HighlightShelvesByProduct(productIndex);
		}

		[HarmonyPatch("Update")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Expected O, but got Unknown
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Expected O, but got Unknown
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Expected O, but got Unknown
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Expected O, but got Unknown
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Expected O, but got Unknown
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Expected O, but got Unknown
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Expected O, but got Unknown
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Expected O, but got Unknown
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Expected O, but got Unknown
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Expected O, but got Unknown
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Expected O, but got Unknown
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Expected O, but got Unknown
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Expected O, but got Unknown
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Expected O, but got Unknown
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			int num = list.FindIndex((CodeInstruction instruction) => instruction.opcode == OpCodes.Ldloca_S && instruction.operand is LocalBuilder localBuilder2 && localBuilder2.LocalIndex == 0) - 6;
			CodeInstructionExtensions.MoveLabelsFrom(list[num + 42], list[num]);
			list.RemoveRange(num, 42);
			object operand = list[num].operand;
			list.InsertRange(num, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[2]
			{
				CodeInstructionExtensions.MoveLabelsFrom(new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(PlayerNetworkPatch), "GetProductFromRaycast", (Type[])null, (Type[])null)), list[num]),
				new CodeInstruction(OpCodes.Stloc_S, operand)
			});
			int num2 = list.FindIndex((CodeInstruction i) => i.opcode == OpCodes.Ldfld && i.operand == AccessTools.Field(typeof(Data_Container), "productInfoArray")) + 6;
			Label label = generator.DefineLabel();
			CodeInstructionExtensions.WithLabels(list[num2], new Label[1] { label });
			num = new CodeMatcher((IEnumerable<CodeInstruction>)list, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
			{
				new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)(sbyte)(-5), (string)null),
				new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(typeof(PlayerNetwork), "oldProductID"), (string)null)
			}).Pos;
			int component2Loc = ((LocalBuilder)list[list.FindLastIndex((CodeInstruction i) => CodeInstructionExtensions.Calls(i, AccessTools.Method(typeof(Component), "GetComponent", (Type[])null, new Type[1] { typeof(Data_Container) }))) + 1].operand).LocalIndex;
			int localIndex = ((LocalBuilder)list[num2].operand).LocalIndex;
			list.InsertRange(num, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[7]
			{
				CodeInstructionExtensions.MoveLabelsFrom(new CodeInstruction(OpCodes.Ldnull, (object)null), list[num]),
				new CodeInstruction(OpCodes.Stloc_S, (object)component2Loc),
				new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(PlayerNetworkPatch), "GetProductFromRaycast", (Type[])null, (Type[])null)),
				new CodeInstruction(OpCodes.Stloc, (object)localIndex),
				new CodeInstruction(OpCodes.Ldloc, (object)localIndex),
				new CodeInstruction(OpCodes.Ldc_I4_M1, (object)null),
				new CodeInstruction(OpCodes.Bgt, (object)label)
			}));
			int index = list.FindIndex(num2, (CodeInstruction i) => i.opcode == OpCodes.Ldloc_S && i.operand is LocalBuilder localBuilder && localBuilder.LocalIndex == component2Loc) - 5;
			Label label2 = generator.DefineLabel();
			list.InsertRange(index, new <>z__ReadOnlyArray<CodeInstruction>((CodeInstruction[])(object)new CodeInstruction[5]
			{
				CodeInstructionExtensions.MoveLabelsFrom(new CodeInstruction(OpCodes.Ldloc_S, (object)component2Loc), list[index]),
				new CodeInstruction(OpCodes.Ldnull, (object)null),
				new CodeInstruction(OpCodes.Bgt_S, (object)label2),
				new CodeInstruction(OpCodes.Ret, (object)null),
				CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Nop, (object)null), new Label[1] { label2 })
			}));
			return list;
		}

		public static int GetProductFromRaycast()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			int result = -1;
			int num = 0;
			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];
						num = component.productInfoArray[siblingIndex * 2 + 1];
					}
				}
			}
			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 num2 = component3.productInfoArray[siblingIndex2 * 2];
						result = num2;
					}
				}
			}
			return result;
		}

		public static void HighlightShelvesByProduct(int productID)
		{
			//IL_00db: 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_019b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("Level_SupermarketProps/Shelves");
			for (int i = 0; i < val.transform.childCount; i++)
			{
				Transform child = val.transform.GetChild(i);
				Data_Container component = ((Component)child).gameObject.GetComponent<Data_Container>();
				if ((Object)(object)component == (Object)null)
				{
					continue;
				}
				int[] productInfoArray = component.productInfoArray;
				int num = productInfoArray.Length / 2;
				bool value = false;
				for (int j = 0; j < num; j++)
				{
					int num2 = productInfoArray[j * 2];
					bool flag = num2 == productID;
					Transform val2 = child.Find("Labels");
					if (!((Object)(object)val2 == (Object)null) && val2.childCount > j)
					{
						Transform child2 = val2.GetChild(j);
						if (flag)
						{
							value = true;
						}
						HighlightShelf(child2, flag, Color.yellow);
					}
				}
				HighlightShelf(child, value, Color.red);
			}
			GameObject val3 = GameObject.Find("Level_SupermarketProps/StorageShelves");
			for (int k = 0; k < val3.transform.childCount; k++)
			{
				Transform child3 = val3.transform.GetChild(k);
				int[] productInfoArray2 = ((Component)child3).gameObject.GetComponent<Data_Container>().productInfoArray;
				int num3 = productInfoArray2.Length / 2;
				for (int l = 0; l < num3; l++)
				{
					int num4 = productInfoArray2[l * 2];
					bool value2 = num4 == productID;
					Transform val4 = child3.Find("BoxContainer");
					if (!((Object)(object)val4 == (Object)null) && val4.childCount > l)
					{
						Transform child4 = val4.GetChild(l);
						HighlightShelf(child4, value2, Color.yellow);
					}
				}
			}
		}

		public static void ClearHighlightedShelves()
		{
			GameObject val = GameObject.Find("Level_SupermarketProps/Shelves");
			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;
				for (int j = 0; j < num; j++)
				{
					Transform val2 = child.Find("Labels");
					if (!((Object)(object)val2 == (Object)null) && val2.childCount > j)
					{
						Transform child2 = val2.GetChild(j);
						HighlightShelf(child2, value: false);
					}
				}
				HighlightShelf(child, value: false);
			}
			GameObject val3 = GameObject.Find("Level_SupermarketProps/StorageShelves");
			for (int k = 0; k < val3.transform.childCount; k++)
			{
				Transform child3 = val3.transform.GetChild(k);
				int[] productInfoArray2 = ((Component)child3).gameObject.GetComponent<Data_Container>().productInfoArray;
				int num2 = productInfoArray2.Length / 2;
				for (int l = 0; l < num2; l++)
				{
					Transform val4 = child3.Find("BoxContainer");
					if (!((Object)(object)val4 == (Object)null))
					{
						Transform child4 = val4.GetChild(l);
						if (!((Object)(object)child4 == (Object)null))
						{
							HighlightShelf(child4, value: false);
						}
					}
				}
			}
		}

		public static void HighlightShelf(Transform t, bool value, Color? color = null)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			HighlightEffect val = ((Component)t).GetComponent<HighlightEffect>();
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)t).gameObject.AddComponent<HighlightEffect>();
			}
			if (color.HasValue)
			{
				val.outlineColor = color.Value;
			}
			val.outlineQuality = (QualityLevel)1;
			val.outlineVisibility = (Visibility)1;
			val.outlineContourStyle = (ContourStyle)1;
			val.outlineIndependent = true;
			val.outline = (value ? 1f : 0f);
			val.glow = (value ? 0f : 1f);
			((Behaviour)val).enabled = true;
			val.SetHighlighted(value);
			val.Refresh(false);
			val.highlighted = value;
			val._highlighted = value;
		}
	}
	[HarmonyPatch(typeof(ProductListing))]
	public class ProductListingPatch
	{
		[HarmonyPatch("ConvertFloatToTextPrice")]
		[HarmonyPostfix]
		private static void ConvertFloatToTextPricePatch(ref string __result)
		{
			__result = BetterSMT.ReplaceCommas(__result);
		}
	}
	[HarmonyPatch(typeof(UpgradesManager))]
	public class UpgradesManagerPatch
	{
		[HarmonyPatch("ManageExtraPerks")]
		[HarmonyPrefix]
		private static bool ManageExtraPerksPatch(UpgradesManager __instance, int perkIndex)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				Debug.LogError((object)"UpgradesManager instance is null in ManageExtraPerksPatch.");
			}
			switch (perkIndex)
			{
			case 0:
			{
				NPC_Manager instance21 = NPC_Manager.Instance;
				instance21.maxEmployees += BetterSMT.EmployeesPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
				break;
			}
			case 1:
			{
				NPC_Manager instance20 = NPC_Manager.Instance;
				instance20.maxEmployees += BetterSMT.EmployeesPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
				break;
			}
			case 2:
			{
				NPC_Manager instance19 = NPC_Manager.Instance;
				instance19.maxEmployees += BetterSMT.EmployeesPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
				break;
			}
			case 3:
			{
				NPC_Manager instance18 = NPC_Manager.Instance;
				instance18.maxEmployees += BetterSMT.EmployeesPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
				break;
			}
			case 4:
			{
				NPC_Manager instance17 = NPC_Manager.Instance;
				instance17.maxEmployees += BetterSMT.EmployeesPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
				break;
			}
			case 5:
			{
				NPC_Manager instance16 = NPC_Manager.Instance;
				instance16.extraEmployeeSpeedFactor += BetterSMT.EmployeeSpeedPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeeStats();
				break;
			}
			case 6:
			{
				NPC_Manager instance15 = NPC_Manager.Instance;
				instance15.extraCheckoutMoney += BetterSMT.EmployeExtraCheckoutMoney.Value;
				NPC_Manager.Instance.UpdateEmployeeStats();
				break;
			}
			case 7:
			{
				NPC_Manager instance14 = NPC_Manager.Instance;
				instance14.extraEmployeeSpeedFactor += BetterSMT.EmployeeSpeedPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeeStats();
				break;
			}
			case 9:
			{
				GameData component2 = ((Component)__instance).GetComponent<GameData>();
				component2.extraCustomersPerk += BetterSMT.CustomersPerPerk.Value;
				break;
			}
			case 10:
			{
				GameData component = ((Component)__instance).GetComponent<GameData>();
				component.extraCustomersPerk += BetterSMT.CustomersPerPerk.Value;
				break;
			}
			case 11:
			{
				NPC_Manager instance13 = NPC_Manager.Instance;
				instance13.maxEmployees += BetterSMT.EmployeesPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
				break;
			}
			case 12:
			{
				NPC_Manager instance12 = NPC_Manager.Instance;
				instance12.maxEmployees += BetterSMT.EmployeesPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
				break;
			}
			case 13:
			{
				NPC_Manager instance11 = NPC_Manager.Instance;
				instance11.maxEmployees += BetterSMT.EmployeesPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
				break;
			}
			case 14:
			{
				NPC_Manager instance10 = NPC_Manager.Instance;
				instance10.maxEmployees += BetterSMT.EmployeesPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
				break;
			}
			case 15:
			{
				NPC_Manager instance9 = NPC_Manager.Instance;
				instance9.maxEmployees += BetterSMT.EmployeesPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
				break;
			}
			case 16:
			{
				NPC_Manager instance8 = NPC_Manager.Instance;
				instance8.productCheckoutWait -= BetterSMT.EmployeeCheckoutPerPerk1.Value;
				Debug.Log((object)("ProductCheckoutWait after perk 1: " + NPC_Manager.Instance.productCheckoutWait));
				break;
			}
			case 17:
			{
				NPC_Manager instance7 = NPC_Manager.Instance;
				instance7.productCheckoutWait -= BetterSMT.EmployeeCheckoutPerPerk2.Value;
				Debug.Log((object)("ProductCheckoutWait after perk 2: " + NPC_Manager.Instance.productCheckoutWait));
				break;
			}
			case 18:
			{
				NPC_Manager instance6 = NPC_Manager.Instance;
				instance6.productCheckoutWait -= BetterSMT.EmployeeCheckoutPerPerk3.Value;
				Debug.Log((object)("ProductCheckoutWait after perk 3: " + NPC_Manager.Instance.productCheckoutWait));
				break;
			}
			case 19:
			{
				NPC_Manager instance5 = NPC_Manager.Instance;
				instance5.employeeItemPlaceWait -= BetterSMT.EmployeeRestockPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeeStats();
				break;
			}
			case 20:
			{
				NPC_Manager instance4 = NPC_Manager.Instance;
				instance4.employeeItemPlaceWait -= BetterSMT.EmployeeRestockPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeeStats();
				break;
			}
			case 21:
			{
				NPC_Manager instance3 = NPC_Manager.Instance;
				instance3.extraEmployeeSpeedFactor += BetterSMT.EmployeeSpeedPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeeStats();
				break;
			}
			case 22:
			{
				NPC_Manager instance2 = NPC_Manager.Instance;
				instance2.extraEmployeeSpeedFactor += BetterSMT.EmployeeSpeedPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeeStats();
				break;
			}
			case 23:
			{
				NPC_Manager instance = NPC_Manager.Instance;
				instance.extraEmployeeSpeedFactor += BetterSMT.EmployeeSpeedPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeeStats();
				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)
		{
		}
	}
}
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int ICollection.Count => _items.Length;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => _items.Length;

	T IReadOnlyList<T>.this[int index] => _items[index];

	int ICollection<T>.Count => _items.Length;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyArray(T[] items)
	{
		_items = items;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return ((IEnumerable)_items).GetEnumerator();
	}

	void ICollection.CopyTo(Array array, int index)
	{
		((ICollection)_items).CopyTo(array, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return ((IList)_items).Contains(value);
	}

	int IList.IndexOf(object value)
	{
		return ((IList)_items).IndexOf(value);
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return ((IEnumerable<T>)_items).GetEnumerator();
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return ((ICollection<T>)_items).Contains(item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		((ICollection<T>)_items).CopyTo(array, arrayIndex);
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return ((IList<T>)_items).IndexOf(item);
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}