Decompiled source of BetterSMT v1.3.1

BepInEx/plugins/ViViKo.BetterSMT.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("ViViKo.BetterSMT")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("BetterSMT")]
[assembly: AssemblyFileVersion("1.3.1.0")]
[assembly: AssemblyInformationalVersion("1.3.1")]
[assembly: AssemblyProduct("BetterSMT")]
[assembly: AssemblyTitle("ViViKo.BetterSMT")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.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 BetterSMT
{
	[BepInPlugin("ViViKo.BetterSMT", "BetterSMT", "1.3.1")]
	public class BetterSMT : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("ViViKo.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> EmployeeCheckoutPerPerk;

		public static ConfigEntry<bool> OneHitThief;

		public static ConfigEntry<bool> ReplaceCommasWithPeriods;

		public static ConfigEntry<bool> FasterCheckout;

		internal static ManualLogSource Logger { get; private set; }

		private void Awake()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Expected O, but got Unknown
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Expected O, but got Unknown
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Expected O, but got Unknown
			Instance = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			EmployeesPerPerk = ((BaseUnityPlugin)this).Config.Bind<int>("Perks", "Employees Per Perk", 1, new ConfigDescription("Adjust the amount of employees you gain per perk", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 5), Array.Empty<object>()));
			EmployeeSpeedPerPerk = ((BaseUnityPlugin)this).Config.Bind<float>("Perks", "Employee Speed Per Perk", 0.2f, new ConfigDescription("Adjust the amount of speed employees gain per perk", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 1f), Array.Empty<object>()));
			EmployeeRestockPerPerk = ((BaseUnityPlugin)this).Config.Bind<float>("Perks", "Employee Restock Time Reduction Per Perk", 0.05f, new ConfigDescription("Adjust the amount of time it takes for employees to restock per perk", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 0.1f), Array.Empty<object>()));
			EmployeeCheckoutPerPerk = ((BaseUnityPlugin)this).Config.Bind<float>("Perks", "Employee Checkout Time Reduction Per Perk", 0.1f, new ConfigDescription("Adjust the amount of time employees wait to scan items in checkout per perk (Lower = slower)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.01f, 0.25f), Array.Empty<object>()));
			CustomersPerPerk = ((BaseUnityPlugin)this).Config.Bind<int>("Perks", "Extra Customers Per Perk", 1, new ConfigDescription("Adjust the amount of customers you gain per perk", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
			FasterCheckout = ((BaseUnityPlugin)this).Config.Bind<bool>("Customers", "Faster Checkout", true, 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", true, (ConfigDescription)null);
			harmony.PatchAll();
			Logger.LogInfo((object)"Plugin BetterSMT v1.3.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 class PluginInfo
	{
		public const string PLUGIN_GUID = "ViViKo.BetterSMT";

		public const string PLUGIN_NAME = "BetterSMT";

		public const string PLUGIN_VERSION = "1.3.1";
	}
}
namespace BetterSMT.Patches
{
	[HarmonyPatch(typeof(GameData))]
	public class GameDataPatch
	{
		[HarmonyPatch("OnStartClient")]
		[HarmonyPostfix]
		private static void OnStartClientPatch(GameData __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(OpenDoorsCoroutine());
		}

		[HarmonyPatch("LightsOffControl")]
		[HarmonyPostfix]
		private static void LightsOffControlPatch(GameData __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(OpenDoorsCoroutine());
		}

		private static IEnumerator OpenDoorsCoroutine()
		{
			yield return (object)new WaitForSeconds(5f);
			OpenDoors();
		}

		public static void OpenDoors()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("Level_Supermarket/Doors");
			if ((Object)(object)val == (Object)null)
			{
				BetterSMT.Logger.LogWarning((object)"OpenDoors No DOORS");
				return;
			}
			Transform child = val.transform.GetChild(0);
			if ((Object)(object)child != (Object)null)
			{
				child.GetChild(0).localRotation = Quaternion.Euler(0f, 270f, 0f);
				child.GetChild(1).localRotation = Quaternion.Euler(0f, 90f, 0f);
			}
			Transform child2 = val.transform.GetChild(1);
			if ((Object)(object)child2 != (Object)null)
			{
				child2.GetChild(0).localRotation = Quaternion.Euler(0f, 270f, 0f);
				child2.GetChild(1).localRotation = Quaternion.Euler(0f, 90f, 0f);
			}
			Transform child3 = val.transform.GetChild(2);
			if ((Object)(object)child3 != (Object)null)
			{
				child3.GetChild(0).localRotation = Quaternion.Euler(0f, 270f, 0f);
				child3.GetChild(1).localRotation = Quaternion.Euler(0f, 90f, 0f);
			}
		}
	}
	[HarmonyPatch(typeof(NPC_Info))]
	public class NPC_InfoPatch
	{
		[HarmonyPatch("PlaceProducts")]
		[HarmonyPrefix]
		private static void PlaceProductsPatch(NPC_Info __instance)
		{
			__instance.productItemPlaceWait = (BetterSMT.FasterCheckout.Value ? 0f : 0.5f);
		}
	}
	[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()
		{
			if (Object.op_Implicit((Object)(object)pNetwork.marketPriceTMP))
			{
				((TMP_Text)pNetwork.marketPriceTMP).text = BetterSMT.ReplaceCommas(((TMP_Text)pNetwork.marketPriceTMP).text);
			}
			if (Object.op_Implicit((Object)(object)pNetwork.yourPriceTMP))
			{
				((TMP_Text)pNetwork.yourPriceTMP).text = BetterSMT.ReplaceCommas(((TMP_Text)pNetwork.yourPriceTMP).text);
			}
		}

		[HarmonyPatch("PriceSetFromNumpad")]
		[HarmonyPostfix]
		private static void PriceSetFromNumpadPatch(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)
		{
			switch (newEquippedItem)
			{
			case 0:
				ClearHighlightedShelves();
				break;
			case 1:
				if (((NetworkBehaviour)__instance).isLocalPlayer && __instance.extraParameter1 >= 0)
				{
					HighlightShelvesByProduct(__instance.extraParameter1);
				}
				break;
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Expected O, but got Unknown
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Expected O, but got Unknown
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Expected O, but got Unknown
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Expected O, but got Unknown
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Expected O, but got Unknown
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Expected O, but got Unknown
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Expected O, but got Unknown
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Expected O, but got Unknown
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Expected O, but got Unknown
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Expected O, but got Unknown
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Expected O, but got Unknown
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Expected O, but got Unknown
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: 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_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_011d: Unknown result type (might be due to invalid IL or missing references)
			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];
						_ = 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)
					{
						result = component3.productInfoArray[siblingIndex2 * 2];
					}
				}
			}
			return result;
		}

		public static void HighlightShelvesByProduct(int productID)
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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);
				int[] productInfoArray = ((Component)child).gameObject.GetComponent<Data_Container>().productInfoArray;
				int num = productInfoArray.Length / 2;
				bool value = false;
				for (int j = 0; j < num; j++)
				{
					bool flag = productInfoArray[j * 2] == productID;
					Transform child2 = ((Component)child.Find("Labels")).transform.GetChild(j);
					if (flag)
					{
						value = true;
					}
					HighlightShelf(child2, flag, Color.yellow);
				}
				HighlightShelf(child, value, Color.red);
			}
		}

		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 num = ((Component)child).gameObject.GetComponent<Data_Container>().productInfoArray.Length / 2;
				for (int j = 0; j < num; j++)
				{
					HighlightShelf(((Component)child.Find("Labels")).transform.GetChild(j), value: false);
				}
				HighlightShelf(child, value: false);
			}
		}

		public static void HighlightShelf(Transform t, bool value, Color? color = null)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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.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)
		{
			switch (perkIndex)
			{
			case 0:
			{
				NPC_Manager instance20 = NPC_Manager.Instance;
				instance20.maxEmployees += BetterSMT.EmployeesPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
				break;
			}
			case 1:
			{
				NPC_Manager instance19 = NPC_Manager.Instance;
				instance19.maxEmployees += BetterSMT.EmployeesPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
				break;
			}
			case 2:
			{
				NPC_Manager instance18 = NPC_Manager.Instance;
				instance18.maxEmployees += BetterSMT.EmployeesPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
				break;
			}
			case 3:
			{
				NPC_Manager instance17 = NPC_Manager.Instance;
				instance17.maxEmployees += BetterSMT.EmployeesPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
				break;
			}
			case 4:
			{
				NPC_Manager instance16 = NPC_Manager.Instance;
				instance16.maxEmployees += BetterSMT.EmployeesPerPerk.Value;
				NPC_Manager.Instance.UpdateEmployeesNumberInBlackboard();
				break;
			}
			case 5:
			{
				NPC_Manager instance15 = NPC_Manager.Instance;
				instance15.extraEmployeeSpeedFactor += BetterSMT.EmployeeSpeedPerPerk.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.EmployeeCheckoutPerPerk.Value;
				break;
			}
			case 17:
			{
				NPC_Manager instance7 = NPC_Manager.Instance;
				instance7.productCheckoutWait -= BetterSMT.EmployeeCheckoutPerPerk.Value;
				break;
			}
			case 18:
			{
				NPC_Manager instance6 = NPC_Manager.Instance;
				instance6.productCheckoutWait -= BetterSMT.EmployeeCheckoutPerPerk.Value;
				break;
			}
			case 19:
			{
				NPC_Manager instance5 = NPC_Manager.Instance;
				instance5.employeeItemPlaceWait -= BetterSMT.EmployeeRestockPerPerk.Value;
				break;
			}
			case 20:
			{
				NPC_Manager instance4 = NPC_Manager.Instance;
				instance4.employeeItemPlaceWait -= BetterSMT.EmployeeRestockPerPerk.Value;
				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, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	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();
	}

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