Decompiled source of Section97 v1.3.0

Section97-1.3.0.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppScheduleOne;
using Il2CppScheduleOne.Clothing;
using Il2CppScheduleOne.DevUtilities;
using Il2CppScheduleOne.Economy;
using Il2CppScheduleOne.Equipping;
using Il2CppScheduleOne.Interaction;
using Il2CppScheduleOne.ItemFramework;
using Il2CppScheduleOne.Law;
using Il2CppScheduleOne.Money;
using Il2CppScheduleOne.NPCs;
using Il2CppScheduleOne.NPCs.Relation;
using Il2CppScheduleOne.NPCs.Responses;
using Il2CppScheduleOne.PlayerScripts;
using Il2CppScheduleOne.Quests;
using Il2CppScheduleOne.UI;
using Il2CppScheduleOne.VoiceOver;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using Section97;
using Section97.Crimes;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Sec97), "Section97", "1.3.0", "Assailent", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Section97")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+882debe5af26336effdb17fbb75faa0163006a93")]
[assembly: AssemblyProduct("Section97")]
[assembly: AssemblyTitle("Section97")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace Section97
{
	public class Sec97 : MelonMod
	{
		[HarmonyPatch(typeof(HotbarSlot), "Unequip")]
		private static class PawnstoreRobberyUnequipPatch
		{
			public static bool Prefix(ref HotbarSlot __instance)
			{
				try
				{
					if (((ItemSlot)__instance).ItemInstance.GetItemData().ID == "baseballbat")
					{
						foreach (GameObject robbableDisplayBench in _robbableDisplayBenches)
						{
							if ((Object)(object)robbableDisplayBench.GetComponent<InteractableObject>() != (Object)null)
							{
								InteractableObject component = robbableDisplayBench.GetComponent<InteractableObject>();
								((Behaviour)component).enabled = false;
							}
						}
					}
				}
				catch
				{
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(HotbarSlot), "Equip")]
		private static class PawnstoreRobberyPatch
		{
			public static bool Prefix(ref HotbarSlot __instance)
			{
				//IL_014f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0156: Unknown result type (might be due to invalid IL or missing references)
				//IL_0160: Unknown result type (might be due to invalid IL or missing references)
				//IL_0165: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					if (((ItemSlot)__instance).ItemInstance.GetItemData().ID != "baseballbat")
					{
						return true;
					}
					foreach (GameObject robbableDisplayBench in _robbableDisplayBenches)
					{
						GameObject gameObject = robbableDisplayBench;
						if (((Object)gameObject).name == "Display Bench" && !_canRobPawnShopBench0)
						{
							return true;
						}
						if (((Object)gameObject).name == "Display Bench (1)" && !_canRobPawnShopBench1)
						{
							return true;
						}
						if (((Object)gameObject).name == "Display Bench (2)" && !_canRobPawnShopBench2)
						{
							return true;
						}
						InteractableObject component;
						if ((Object)(object)gameObject.GetComponent<InteractableObject>() != (Object)null)
						{
							component = gameObject.GetComponent<InteractableObject>();
							((Behaviour)component).enabled = true;
							continue;
						}
						component = gameObject.AddComponent<InteractableObject>();
						component.message = "Smash";
						component.MaxInteractionRange = 4f;
						component.Priority = 10;
						Transform transform = ((Component)component).transform;
						transform.position += transform.up * 1.2f;
						component.displayLocationPoint = transform;
						component.onInteractEnd.AddListener(UnityAction.op_Implicit((Action)FuncThatCallsFunc));
						void FuncThatCallsFunc()
						{
							StartSmashin(gameObject);
						}
					}
				}
				catch
				{
				}
				return true;
			}

			private static async void StartSmashin(GameObject gameObject)
			{
				((Il2CppObjectBase)PlayerSingleton<PlayerInventory>.Instance.equippedSlot.Equippable).Cast<Equippable_MeleeWeapon>().Release();
				InteractableObject interactable = gameObject.GetComponent<InteractableObject>();
				((Behaviour)interactable).enabled = false;
				List<GameObject> benchItems = new List<GameObject>();
				if (((Object)gameObject).name == "Display Bench")
				{
					benchItems = _displayBench0Items;
					_canRobPawnShopBench0 = false;
				}
				else if (((Object)gameObject).name == "Display Bench (1)")
				{
					benchItems = _displayBench1Items;
					_canRobPawnShopBench1 = false;
				}
				else if (((Object)gameObject).name == "Display Bench (2)")
				{
					benchItems = _displayBench2Items;
					_canRobPawnShopBench2 = false;
				}
				foreach (GameObject item2 in benchItems)
				{
					item2.SetActive(false);
				}
				int robMoney = Random.Range(MelonPreferences.GetEntryValue<int>("Section97", "PawnStore_SmashNGrab_minimum_robbery_money"), MelonPreferences.GetEntryValue<int>("Section97", "PawnStore_SmashNGrab_maximum_robbery_money"));
				Type typeFromHandle = typeof(MoneyManager);
				FieldInfo field = typeFromHandle.GetField("Instance", BindingFlags.Static | BindingFlags.Public);
				if (field != null)
				{
					MoneyManager moneyManager2 = (MoneyManager)field.GetValue(null);
					if ((Object)(object)moneyManager2 != (Object)null)
					{
						moneyManager2.ChangeCashBalance((float)robMoney, true, true);
					}
				}
				else
				{
					MoneyManager moneyManager = Object.FindObjectOfType<MoneyManager>();
					if ((Object)(object)moneyManager != (Object)null)
					{
						moneyManager.ChangeCashBalance((float)robMoney, true, true);
					}
				}
				foreach (NPC npc in Object.FindObjectsOfType<NPC>())
				{
					if ((Object)(object)npc != (Object)null && npc.IsConscious && Object.op_Implicit((Object)(object)npc.awareness) && Object.op_Implicit((Object)(object)npc.awareness.VisionCone) && npc.awareness.VisionCone.sightedPlayers != null && npc.awareness.VisionCone.sightedPlayers.Contains(Player.Local) && (Object)(object)npc.dialogueHandler != (Object)null && (Object)(object)npc.actions != (Object)null)
					{
						npc.actions.SetCallPoliceBehaviourCrime((Crime)(object)new SmashNGrab());
						npc.actions.CallPolice_Networked(Player.Local);
						npc.SetPanicked();
						npc.dialogueHandler.PlayReaction("panic_start", 5f, true);
						if (!((Object)(object)npc.VoiceOverEmitter == (Object)null))
						{
							npc.VoiceOverEmitter.Play((EVOLineType)12);
						}
						break;
					}
				}
				await Task.Delay(TimeSpan.FromMinutes(5.0));
				if (((Object)gameObject).name == "Display Bench")
				{
					_canRobPawnShopBench0 = true;
				}
				else if (((Object)gameObject).name == "Display Bench (1)")
				{
					_canRobPawnShopBench1 = true;
				}
				else if (((Object)gameObject).name == "Display Bench (2)")
				{
					_canRobPawnShopBench2 = true;
				}
				foreach (GameObject item in benchItems)
				{
					item.SetActive(true);
				}
			}
		}

		[HarmonyPatch(typeof(DealCompletionPopup))]
		private static class RobberySatisfactionPatch
		{
			[HarmonyPatch("PlayPopup")]
			[HarmonyPrefix]
			public static void Prefix()
			{
				if (Robbing)
				{
					((Component)((Component)Singleton<DealCompletionPopup>.Instance).gameObject.transform.Find("Container").Find("Title")).gameObject.SetActive(false);
					((Component)((Component)Singleton<DealCompletionPopup>.Instance).gameObject.transform.Find("Container").Find("Payment")).gameObject.SetActive(false);
				}
				else
				{
					((Component)((Component)Singleton<DealCompletionPopup>.Instance).gameObject.transform.Find("Container").Find("Title")).gameObject.SetActive(true);
					((Component)((Component)Singleton<DealCompletionPopup>.Instance).gameObject.transform.Find("Container").Find("Payment")).gameObject.SetActive(true);
				}
			}
		}

		[HarmonyPatch(typeof(PickpocketScreen))]
		private static class MuggingPatch
		{
			[HarmonyPatch("Close")]
			[HarmonyPrefix]
			public static void Prefix(ref PickpocketScreen __instance)
			{
				if (Mugging)
				{
					NPC npc = __instance.npc;
					npc.actions.SetCallPoliceBehaviourCrime((Crime)(object)new Mugging());
					npc.actions.CallPolice_Networked(Player.Local);
					npc.SetPanicked();
					npc.dialogueHandler.PlayReaction("panic_start", 5f, true);
					if (!((Object)(object)npc.VoiceOverEmitter == (Object)null))
					{
						npc.VoiceOverEmitter.Play((EVOLineType)12);
					}
				}
			}
		}

		[HarmonyPatch(typeof(NPCResponses_Civilian), "RespondToAimedAt", new Type[] { typeof(Player) })]
		private static class RobberyPatch
		{
			public static bool Prefix(ref NPCResponses_Civilian __instance, ref Player __0)
			{
				//IL_0283: Unknown result type (might be due to invalid IL or missing references)
				//IL_0292: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					NPCScheduleManager component = ((Component)((Component)__instance).gameObject.transform.parent.Find("Schedule")).GetComponent<NPCScheduleManager>();
					if ((((Object)component.ActiveAction).name.Contains("Gas mart") || ((Object)component.ActiveAction).name.Contains("Gas station")) && ((Object)component.ActiveAction).name.Contains("worker"))
					{
						((NPCResponses)__instance).actions.Cower();
						Robbing = true;
						Singleton<DealCompletionPopup>.Instance.PlayPopup(((Component)component.Npc).gameObject.GetComponent<Customer>(), -0.5f, component.Npc.RelationData.RelationDelta, 0f, new List<BonusPayment>());
						NPCRelationData relationData = component.Npc.RelationData;
						NPCRelationData relationData2 = component.Npc.RelationData;
						float relationship = (relationData2.RelationDelta -= 0.5f);
						relationData.SetRelationship(relationship);
						StartRobberyRegisters(0);
						return false;
					}
					if (((Object)component.ActiveAction).name.Contains("Location-based action (Bar stand point) (3:00 PM - 5:00 AM)") && ((Object)((Component)__instance).gameObject.transform.parent).name.Contains("Philip"))
					{
						((NPCResponses)__instance).actions.Cower();
						Robbing = true;
						Singleton<DealCompletionPopup>.Instance.PlayPopup(((Component)component.Npc).gameObject.GetComponent<Customer>(), -0.5f, component.Npc.RelationData.RelationDelta, 0f, new List<BonusPayment>());
						NPCRelationData relationData3 = component.Npc.RelationData;
						NPCRelationData relationData4 = component.Npc.RelationData;
						float relationship = (relationData4.RelationDelta -= 0.5f);
						relationData3.SetRelationship(relationship);
						StartRobberyRegisters(2);
						return false;
					}
					if (((Object)component.ActiveAction).name.Contains("Cashier Stand Point"))
					{
						((NPCResponses)__instance).actions.Cower();
						Robbing = true;
						Singleton<DealCompletionPopup>.Instance.PlayPopup(((Component)component.Npc).gameObject.GetComponent<Customer>(), -0.5f, component.Npc.RelationData.RelationDelta, 0f, new List<BonusPayment>());
						NPCRelationData relationData5 = component.Npc.RelationData;
						NPCRelationData relationData6 = component.Npc.RelationData;
						float relationship = (relationData6.RelationDelta -= 0.5f);
						relationData5.SetRelationship(relationship);
						StartRobberyRegisters(3);
						return false;
					}
					if (Vector3.Distance(((Component)component.Npc).transform.position, ((Component)Player.Local).transform.position) <= 4f)
					{
						Mugging = true;
						Singleton<PickpocketScreen>.Instance.Open(component.Npc);
						for (int i = 0; i < ((Il2CppArrayBase<ItemSlotUI>)(object)Singleton<PickpocketScreen>.Instance.Slots).Count - 1; i++)
						{
							if (((Il2CppArrayBase<ItemSlotUI>)(object)Singleton<PickpocketScreen>.Instance.Slots)[i].assignedSlot.Quantity != 0)
							{
								Singleton<PickpocketScreen>.Instance.SetSlotLocked(i, false);
							}
						}
						foreach (NPC item in Object.FindObjectsOfType<NPC>())
						{
							if ((Object)(object)item != (Object)null && item.IsConscious && Object.op_Implicit((Object)(object)item.awareness) && Object.op_Implicit((Object)(object)item.awareness.VisionCone) && item.awareness.VisionCone.sightedPlayers != null && item.awareness.VisionCone.sightedPlayers.Contains(Player.Local) && (Object)(object)item.dialogueHandler != (Object)null && (Object)(object)item.actions != (Object)null && (Object)(object)item != (Object)(object)component.Npc)
							{
								item.actions.SetCallPoliceBehaviourCrime((Crime)(object)new Mugging());
								item.actions.CallPolice_Networked(Player.Local);
								item.SetPanicked();
								item.dialogueHandler.PlayReaction("panic_start", 5f, true);
								if (!((Object)(object)item.VoiceOverEmitter == (Object)null))
								{
									item.VoiceOverEmitter.Play((EVOLineType)12);
								}
								break;
							}
						}
						return false;
					}
					return true;
				}
				catch
				{
					return false;
				}
			}

			private static void StartRobbery(int x)
			{
				//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ef: Expected O, but got Unknown
				if ((Object)(object)Player.Local == (Object)null)
				{
					return;
				}
				int num = 0;
				switch (x)
				{
				case 0:
					num = Random.Range(MelonPreferences.GetEntryValue<int>("Section97", "GasMart_minimum_robbery_money"), MelonPreferences.GetEntryValue<int>("Section97", "GasMart_maximum_robbery_money"));
					break;
				case 2:
					num = Random.Range(MelonPreferences.GetEntryValue<int>("Section97", "Casino_minimum_robbery_money"), MelonPreferences.GetEntryValue<int>("Section97", "Casino_maximum_robbery_money"));
					break;
				case 3:
					num = Random.Range(MelonPreferences.GetEntryValue<int>("Section97", "TacoTicklers_minimum_robbery_money"), MelonPreferences.GetEntryValue<int>("Section97", "TacoTicklers_maximum_robbery_money"));
					break;
				}
				Type typeFromHandle = typeof(MoneyManager);
				FieldInfo field = typeFromHandle.GetField("Instance", BindingFlags.Static | BindingFlags.Public);
				if (field != null)
				{
					MoneyManager val = (MoneyManager)field.GetValue(null);
					if ((Object)(object)val != (Object)null)
					{
						val.ChangeCashBalance((float)num, true, true);
					}
				}
				else
				{
					MoneyManager val2 = Object.FindObjectOfType<MoneyManager>();
					if ((Object)(object)val2 != (Object)null)
					{
						val2.ChangeCashBalance((float)num, true, true);
					}
				}
				foreach (NPC item in Object.FindObjectsOfType<NPC>())
				{
					if ((Object)(object)item != (Object)null && item.IsConscious && Object.op_Implicit((Object)(object)item.awareness) && Object.op_Implicit((Object)(object)item.awareness.VisionCone) && item.awareness.VisionCone.sightedPlayers != null && item.awareness.VisionCone.sightedPlayers.Contains(Player.Local) && (Object)(object)item.dialogueHandler != (Object)null && (Object)(object)item.actions != (Object)null)
					{
						item.actions.SetCallPoliceBehaviourCrime((Crime)(object)new ArmedRobbery());
						item.actions.CallPolice_Networked(Player.Local);
						item.SetPanicked();
						item.dialogueHandler.PlayReaction("panic_start", 5f, true);
						if (!((Object)(object)item.VoiceOverEmitter == (Object)null))
						{
							item.VoiceOverEmitter.Play((EVOLineType)12);
						}
						break;
					}
				}
				foreach (GameObject robbableRegister in _robbableRegisters)
				{
					InteractableObject component = robbableRegister.GetComponent<InteractableObject>();
					((Behaviour)component).enabled = false;
				}
			}

			private static async void StartRobberyRegisters(int x)
			{
				foreach (GameObject gameObject2 in _robbableRegisters)
				{
					InteractableObject interactable3;
					if ((Object)(object)gameObject2.GetComponent<InteractableObject>() != (Object)null)
					{
						interactable3 = gameObject2.GetComponent<InteractableObject>();
						((Behaviour)interactable3).enabled = true;
						continue;
					}
					interactable3 = gameObject2.AddComponent<InteractableObject>();
					interactable3.message = "Rob";
					interactable3.MaxInteractionRange = 15f;
					interactable3.Priority = 10;
					interactable3.onInteractEnd.AddListener(UnityAction.op_Implicit((Action)FuncThatCallsFunc));
				}
				await Task.Delay(TimeSpan.FromSeconds(10.0));
				foreach (GameObject gameObject in _robbableRegisters)
				{
					InteractableObject interactable = gameObject.GetComponent<InteractableObject>();
					((Behaviour)interactable).enabled = false;
				}
				void FuncThatCallsFunc()
				{
					StartRobbery(x);
				}
			}
		}

		private static List<GameObject> _robbableDisplayBenches;

		private static List<GameObject> _displayBench0Items;

		private static List<GameObject> _displayBench1Items;

		private static List<GameObject> _displayBench2Items;

		private static bool _canRobPawnShopBench0;

		private static bool _canRobPawnShopBench1;

		private static bool _canRobPawnShopBench2;

		private static List<GameObject> _robbableRegisters;

		public static bool Mugging;

		public static bool Robbing;

		private MelonPreferences_Category? _preferenceCategory;

		private static readonly List<EClothingColor> AllColors;

		static Sec97()
		{
			_robbableDisplayBenches = new List<GameObject>();
			_displayBench0Items = new List<GameObject>();
			_displayBench1Items = new List<GameObject>();
			_displayBench2Items = new List<GameObject>();
			_canRobPawnShopBench1 = true;
			_canRobPawnShopBench2 = true;
			_robbableRegisters = new List<GameObject>();
			Mugging = false;
			Robbing = false;
			AllColors = new List<EClothingColor>
			{
				(EClothingColor)0,
				(EClothingColor)1,
				(EClothingColor)2,
				(EClothingColor)3,
				(EClothingColor)4,
				(EClothingColor)5,
				(EClothingColor)6,
				(EClothingColor)7,
				(EClothingColor)8,
				(EClothingColor)9,
				(EClothingColor)10,
				(EClothingColor)11,
				(EClothingColor)12,
				(EClothingColor)13,
				(EClothingColor)14,
				(EClothingColor)15,
				(EClothingColor)16,
				(EClothingColor)17,
				(EClothingColor)18,
				(EClothingColor)19,
				(EClothingColor)20,
				(EClothingColor)21,
				(EClothingColor)22,
				(EClothingColor)23,
				(EClothingColor)24,
				(EClothingColor)25,
				(EClothingColor)26
			};
			_canRobPawnShopBench0 = true;
		}

		public override void OnInitializeMelon()
		{
			_preferenceCategory = MelonPreferences.CreateCategory("Section97");
			_preferenceCategory.CreateEntry<int>("GasMart_minimum_robbery_money", 300, "Minimum Money From Robbery", "The minimum amount of $$$ you can get per gas mart robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("GasMart_maximum_robbery_money", 700, "Maximum Money From Robbery", "The maximum amount of $$$ you can get per gas mart robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("PawnStore_minimum_robbery_money", 500, "Minimum Money From Pawn Store Robbery", "The minimum amount of $$$ you can get per Pawn Store Robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("PawnStore_maximum_robbery_money", 1200, "Maximum Money From Pawn Store Robbery", "The maximum amount of $$$ you can get per Pawn Store Robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("Casino_minimum_robbery_money", 700, "Minimum Money From Casino Robbery", "The minimum amount of $$$ you can get per Casino Robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("Casino_maximum_robbery_money", 1500, "Maximum Money From Casino Robbery", "The maximum amount of $$$ you can get per Casino Robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("TacoTicklers_minimum_robbery_money", 300, "Minimum Money From TacoTicklers Robbery", "The minimum amount of $$$ you can get per TacoTicklers Robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("TacoTicklers_maximum_robbery_money", 600, "Maximum Money From TacoTicklers Robbery", "The maximum amount of $$$ you can get per TacoTicklers Robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("PawnStore_SmashNGrab_minimum_robbery_money", 200, "Minimum Money from the Pawn Store smash n grab.", "The minimum amount of $$$ from the Pawn Store Smash N Grab (Baseball bat robbery)", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("PawnStore_SmashNGrab_maximum_robbery_money", 600, "Maximum Money from the Pawn Store smash n grab.", "The maximum amount of $$$ from the Pawn Store Smash N Grab (Baseball bat robbery)", false, false, (ValueValidator)null, (string)null);
		}

		public override void OnDeinitializeMelon()
		{
			MelonPreferences_Category? preferenceCategory = _preferenceCategory;
			if (preferenceCategory != null)
			{
				preferenceCategory.SaveToFile(true);
			}
		}

		public override void OnSceneWasUnloaded(int buildIndex, string sceneName)
		{
			if (!(sceneName != "Main"))
			{
				_robbableRegisters.Clear();
			}
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			if (sceneName != "Main")
			{
				return;
			}
			foreach (GameObject item in Object.FindObjectsOfType<GameObject>())
			{
				if (((Object)item).name == "cash register")
				{
					_robbableRegisters.Add(item);
				}
				else if (((Object)item).name.ToLower().Contains("clothing rack"))
				{
					try
					{
						bool shirt = ((Object)item).name.EndsWith("shirts");
						bool pants = ((Object)item).name.EndsWith("pants");
						if (!(shirt || pants))
						{
							continue;
						}
						Transform val = item.transform.Find("clothing rack");
						if ((Object)(object)val != (Object)null)
						{
							Transform val2 = val.Find("Rack");
							if ((Object)(object)val2 != (Object)null)
							{
								InteractableObject val3 = ((Component)val2).gameObject.AddComponent<InteractableObject>();
								val3.message = (shirt ? "Shoplift Shirt" : "Shoplift Pants");
								val3.MaxInteractionRange = 2.5f;
								val3.onInteractEnd.AddListener(UnityAction.op_Implicit((Action)FuncThatCallsFunc));
							}
						}
						void FuncThatCallsFunc()
						{
							ShopliftRobbery(shirt, pants);
						}
					}
					catch
					{
					}
				}
				else if (((Object)item).name.Contains("Display Bench"))
				{
					_robbableDisplayBenches.Add(item);
					if (((Object)item).name.Contains("(2)"))
					{
						_displayBench2Items.Add(((Component)item.transform.Find("Square tub")).gameObject);
						_displayBench2Items.Add(((Component)item.transform.Find("Square tub (1)")).gameObject);
						_displayBench2Items.Add(((Component)item.transform.parent.Find("Saucepan")).gameObject);
						_displayBench2Items.Add(((Component)item.transform.parent.Find("Display cabinet (2)").Find("Champagne Bottle")).gameObject);
						_displayBench1Items.Add(((Component)item.transform.Find("Gold bar")).gameObject);
						_displayBench1Items.Add(((Component)item.transform.Find("Gold bar (1)")).gameObject);
						_displayBench1Items.Add(((Component)item.transform.Find("Gold bar (2)")).gameObject);
						_displayBench1Items.Add(((Component)item.transform.Find("Gold bar (3)")).gameObject);
					}
					else if (((Object)item).name == "Display Bench")
					{
						_displayBench1Items.Add(((Component)item.transform.Find("Flashlight")).gameObject);
						_displayBench1Items.Add(((Component)item.transform.Find("45 Bullet")).gameObject);
						_displayBench1Items.Add(((Component)item.transform.Find("45 Bullet (1)")).gameObject);
						_displayBench1Items.Add(((Component)item.transform.Find("45 Bullet (2)")).gameObject);
						_displayBench1Items.Add(((Component)item.transform.Find("45 Bullet (3)")).gameObject);
						_displayBench1Items.Add(((Component)item.transform.Find("45 Bullet (4)")).gameObject);
						_displayBench1Items.Add(((Component)item.transform.Find("45 Bullet (5)")).gameObject);
						_displayBench1Items.Add(((Component)item.transform.Find("45 Bullet (6)")).gameObject);
						_displayBench1Items.Add(((Component)item.transform.Find("Funnel")).gameObject);
						_displayBench1Items.Add(((Component)item.transform.Find("SmallBox")).gameObject);
						_displayBench1Items.Add(((Component)item.transform.Find("SmallBox (1)")).gameObject);
						_displayBench0Items.Add(((Component)item.transform.Find("Mortar")).gameObject);
						_displayBench0Items.Add(((Component)item.transform.Find("Frying Pan")).gameObject);
						_displayBench0Items.Add(((Component)item.transform.parent.Find("Display cabinet (2)").Find("Digital Alarm")).gameObject);
						_displayBench0Items.Add(((Component)item.transform.parent.Find("Display cabinet (2)").Find("Wall Clock")).gameObject);
						_displayBench0Items.Add(((Component)item.transform.parent.Find("Display cabinet (2)").Find("Biohazard Box")).gameObject);
					}
				}
			}
		}

		private void ShopliftRobbery(bool shirt, bool pants)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Invalid comparison between Unknown and I4
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Invalid comparison between Unknown and I4
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Invalid comparison between Unknown and I4
			if ((Object)(object)Singleton<Registry>.Instance == (Object)null)
			{
				return;
			}
			List<ClothingDefinition> list = new List<ClothingDefinition>();
			Enumerator<int, ItemRegister> enumerator = Singleton<Registry>.Instance.ItemDictionary.GetEnumerator();
			while (enumerator.MoveNext())
			{
				KeyValuePair<int, ItemRegister> current = enumerator.Current;
				if (current.value == null || !((Object)(object)current.value.Definition != (Object)null) || (int)current.value.Definition.Category != 11)
				{
					continue;
				}
				int hash = Registry.GetHash(current.value.Definition.ID);
				if (!Singleton<Registry>.Instance.ItemDictionary.ContainsKey(hash))
				{
					continue;
				}
				ItemRegister val = Singleton<Registry>.Instance.ItemDictionary[hash];
				if (val != null && (Object)(object)val.Definition != (Object)null)
				{
					ClothingDefinition val2 = (ClothingDefinition)val.Definition;
					if ((Object)(object)val2 != (Object)null && ((shirt && (int)val2.Slot == 3) || (pants && (int)val2.Slot == 1)))
					{
						list.Add(val2);
					}
				}
			}
			ClothingInstance val3 = ((Il2CppObjectBase)((ItemDefinition)list[Random.Range(0, list.Count - 1)]).GetDefaultInstance(1)).Cast<ClothingInstance>();
			Enumerator<HotbarSlot> enumerator2 = PlayerSingleton<PlayerInventory>.Instance.hotbarSlots.GetEnumerator();
			while (enumerator2.MoveNext())
			{
				HotbarSlot current2 = enumerator2.Current;
				if (((ItemSlot)current2).GetCapacityForItem((ItemInstance)(object)val3) == 0)
				{
					continue;
				}
				ClothingInstance val4 = ((Il2CppObjectBase)((ItemInstance)val3).GetCopy(1)).Cast<ClothingInstance>();
				EClothingColor color = AllColors[Random.Range(0, AllColors.Count)];
				val4.Color = color;
				((ItemSlot)current2).AddItem((ItemInstance)(object)val4, false);
				foreach (NPC item in Object.FindObjectsOfType<NPC>())
				{
					if ((Object)(object)item != (Object)null && item.IsConscious && Object.op_Implicit((Object)(object)item.awareness) && Object.op_Implicit((Object)(object)item.awareness.VisionCone) && item.awareness.VisionCone.sightedPlayers.Contains(Player.Local) && (Object)(object)item.actions != (Object)null)
					{
						item.actions.SetCallPoliceBehaviourCrime((Crime)(object)new Shoplifting());
						item.actions.CallPolice_Networked(Player.Local);
						if ((Object)(object)item.VoiceOverEmitter != (Object)null)
						{
							item.VoiceOverEmitter.Play((EVOLineType)4);
						}
						break;
					}
				}
			}
		}
	}
}
namespace Section97.Crimes
{
	public class ArmedRobbery : Crime
	{
		public override string CrimeName => "Armed Robbery";
	}
	public class Mugging : Crime
	{
		public override string CrimeName => "Mugging";
	}
	public class Shoplifting : Crime
	{
		public override string CrimeName => "Shoplifting";
	}
	public class SmashNGrab : Crime
	{
		public override string CrimeName => "Smash And Grab";
	}
}

Section97-Mono-1.3.0.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using HarmonyLib;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using ScheduleOne;
using ScheduleOne.Clothing;
using ScheduleOne.DevUtilities;
using ScheduleOne.Economy;
using ScheduleOne.Equipping;
using ScheduleOne.Interaction;
using ScheduleOne.ItemFramework;
using ScheduleOne.Law;
using ScheduleOne.Money;
using ScheduleOne.NPCs;
using ScheduleOne.NPCs.Relation;
using ScheduleOne.NPCs.Responses;
using ScheduleOne.PlayerScripts;
using ScheduleOne.Quests;
using ScheduleOne.UI;
using ScheduleOne.VoiceOver;
using Section97_Mono;
using Section97_Mono.Crimes;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Sec97), "Setion97-Mono", "1.3.0", "Assailent", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: IgnoresAccessChecksTo("AeLa.EasyFeedback.Demo")]
[assembly: IgnoresAccessChecksTo("AeLa.EasyFeedback")]
[assembly: IgnoresAccessChecksTo("AeLa.EasyFeedback.InputSystemSupport")]
[assembly: IgnoresAccessChecksTo("AmplifyImpostors")]
[assembly: IgnoresAccessChecksTo("AmplifyImpostors.Runtime")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("AstarPathfindingProject")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Boxophobic.AtmosphericHeightFog.Runtime")]
[assembly: IgnoresAccessChecksTo("Boxophobic.Utils.Scripts")]
[assembly: IgnoresAccessChecksTo("Cinemachine")]
[assembly: IgnoresAccessChecksTo("com.rlabrecque.steamworks.net")]
[assembly: IgnoresAccessChecksTo("CorgiGodRays")]
[assembly: IgnoresAccessChecksTo("EasyButtons")]
[assembly: IgnoresAccessChecksTo("Edgegap")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("FishNet.CodeAnalysis")]
[assembly: IgnoresAccessChecksTo("FishNet.Demos")]
[assembly: IgnoresAccessChecksTo("FishNet.Runtime")]
[assembly: IgnoresAccessChecksTo("GameKit.Dependencies")]
[assembly: IgnoresAccessChecksTo("GameKit.Utilities")]
[assembly: IgnoresAccessChecksTo("HBAO.Demo.Runtime")]
[assembly: IgnoresAccessChecksTo("HBAO.Demo.Universal.Runtime")]
[assembly: IgnoresAccessChecksTo("HBAO.Runtime")]
[assembly: IgnoresAccessChecksTo("HBAO.Universal.Runtime")]
[assembly: IgnoresAccessChecksTo("HSVPicker")]
[assembly: IgnoresAccessChecksTo("LokoSolo.PinchableScrollRect")]
[assembly: IgnoresAccessChecksTo("Mono.Security")]
[assembly: IgnoresAccessChecksTo("mscorlib")]
[assembly: IgnoresAccessChecksTo("netstandard")]
[assembly: IgnoresAccessChecksTo("Newtonsoft.Json")]
[assembly: IgnoresAccessChecksTo("Pathfinding.ClipperLib")]
[assembly: IgnoresAccessChecksTo("Pathfinding.Ionic.Zip.Reduced")]
[assembly: IgnoresAccessChecksTo("Pathfinding.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("RadiantGI")]
[assembly: IgnoresAccessChecksTo("RootMotion")]
[assembly: IgnoresAccessChecksTo("RuntimePreviewGenerator.Runtime")]
[assembly: IgnoresAccessChecksTo("sc.stylizedgrass.runtime")]
[assembly: IgnoresAccessChecksTo("sc.stylizedwater2.runtime")]
[assembly: IgnoresAccessChecksTo("StylizedWaterForURP")]
[assembly: IgnoresAccessChecksTo("VisualDesignCafe.Nature")]
[assembly: IgnoresAccessChecksTo("VisualDesignCafe.Packages")]
[assembly: IgnoresAccessChecksTo("VisualDesignCafe.ShaderX")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 Section97_Mono
{
	public class Sec97 : MelonMod
	{
		[HarmonyPatch(typeof(HotbarSlot), "Equip")]
		private static class PawnstoreRobberyPatch
		{
			public static bool Prefix(ref HotbarSlot __instance)
			{
				//IL_014c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0153: Unknown result type (might be due to invalid IL or missing references)
				//IL_015d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0162: Unknown result type (might be due to invalid IL or missing references)
				//IL_0185: Unknown result type (might be due to invalid IL or missing references)
				//IL_018f: Expected O, but got Unknown
				try
				{
					if (((ItemSlot)__instance).ItemInstance.GetItemData().ID != "baseballbat")
					{
						return true;
					}
					foreach (GameObject robbableDisplayBench in RobbableDisplayBenches)
					{
						GameObject gameObject = robbableDisplayBench;
						if (((Object)gameObject).name == "Display Bench" && !CanRobPawnShopBench0)
						{
							return true;
						}
						if (((Object)gameObject).name == "Display Bench (1)" && !CanRobPawnShopBench1)
						{
							return true;
						}
						if (((Object)gameObject).name == "DisplayBench(2)" && !CanRobPawnShopBench2)
						{
							return true;
						}
						InteractableObject component;
						if ((Object)(object)gameObject.GetComponent<InteractableObject>() != (Object)null)
						{
							component = gameObject.GetComponent<InteractableObject>();
							((Behaviour)component).enabled = true;
							continue;
						}
						component = gameObject.AddComponent<InteractableObject>();
						component.message = "Smash";
						component.MaxInteractionRange = 4f;
						component.Priority = 10;
						Transform transform = ((Component)component).transform;
						transform.position += transform.up * 1.2f;
						component.displayLocationPoint = transform;
						component.onInteractEnd.AddListener(new UnityAction(FuncThatCallsFunc));
						void FuncThatCallsFunc()
						{
							StartSmashing(gameObject);
						}
					}
				}
				catch
				{
				}
				return true;
			}

			private static async void StartSmashing(GameObject gameObject)
			{
				((Equippable_MeleeWeapon)PlayerSingleton<PlayerInventory>.Instance.equippedSlot.Equippable).Release();
				InteractableObject interactable = gameObject.GetComponent<InteractableObject>();
				((Behaviour)interactable).enabled = false;
				List<GameObject> benchItems = new List<GameObject>();
				if (((Object)gameObject).name == "Display Bench")
				{
					benchItems = DisplayBench0Items;
					CanRobPawnShopBench0 = false;
				}
				else if (((Object)gameObject).name == "Display Bench (1)")
				{
					benchItems = DisplayBench1Items;
					CanRobPawnShopBench1 = false;
				}
				else if (((Object)gameObject).name == "Display Bench (2)")
				{
					benchItems = DisplayBench2Items;
					CanRobPawnShopBench2 = false;
				}
				foreach (GameObject item2 in benchItems)
				{
					item2.SetActive(false);
				}
				int robMoney = Random.Range(MelonPreferences.GetEntryValue<int>("Section97", "PawnStore_SmashNGrab_minimum_robbery_money"), MelonPreferences.GetEntryValue<int>("Section97", "PawnStore_SmashNGrab_maximum_robbery_money"));
				Type typeFromHandle = typeof(MoneyManager);
				FieldInfo field = typeFromHandle.GetField("Instance", BindingFlags.Static | BindingFlags.Public);
				if (field != null)
				{
					MoneyManager moneyManager2 = (MoneyManager)field.GetValue(null);
					if ((Object)(object)moneyManager2 != (Object)null)
					{
						moneyManager2.ChangeCashBalance((float)robMoney, true, true);
					}
				}
				else
				{
					MoneyManager moneyManager = Object.FindObjectOfType<MoneyManager>();
					if ((Object)(object)moneyManager != (Object)null)
					{
						moneyManager.ChangeCashBalance((float)robMoney, true, true);
					}
				}
				NPC[] array = Object.FindObjectsOfType<NPC>();
				foreach (NPC npc in array)
				{
					if ((Object)(object)npc != (Object)null && npc.IsConscious && Object.op_Implicit((Object)(object)npc.awareness) && Object.op_Implicit((Object)(object)npc.awareness.VisionCone) && npc.awareness.VisionCone.sightedPlayers != null && npc.awareness.VisionCone.sightedPlayers.Contains(Player.Local) && (Object)(object)npc.dialogueHandler != (Object)null && (Object)(object)npc.actions != (Object)null)
					{
						npc.actions.SetCallPoliceBehaviourCrime((Crime)(object)new SmashNGrab());
						npc.actions.CallPolice_Networked(Player.Local);
						npc.SetPanicked();
						npc.dialogueHandler.PlayReaction("panic_start", 5f, true);
						if (!((Object)(object)npc.VoiceOverEmitter == (Object)null))
						{
							npc.VoiceOverEmitter.Play((EVOLineType)12);
						}
					}
				}
				await Task.Delay(TimeSpan.FromMinutes(5.0));
				if (((Object)gameObject).name == "Display Bench")
				{
					CanRobPawnShopBench0 = true;
				}
				else if (((Object)gameObject).name == "Display Bench (1)")
				{
					CanRobPawnShopBench1 = true;
				}
				else if (((Object)gameObject).name == "Display Bench (2)")
				{
					CanRobPawnShopBench2 = true;
				}
				foreach (GameObject item in benchItems)
				{
					item.SetActive(true);
				}
			}
		}

		[HarmonyPatch(typeof(DealCompletionPopup))]
		private static class RobberySatisfactionPatch
		{
			[HarmonyPatch("PlayPopup")]
			[HarmonyPrefix]
			public static void Prefix()
			{
				if (robbery)
				{
					((Component)((Component)Singleton<DealCompletionPopup>.Instance).gameObject.transform.Find("Container").Find("Title")).gameObject.SetActive(false);
					((Component)((Component)Singleton<DealCompletionPopup>.Instance).gameObject.transform.Find("Container").Find("Payment")).gameObject.SetActive(false);
				}
				else
				{
					((Component)((Component)Singleton<DealCompletionPopup>.Instance).gameObject.transform.Find("Container").Find("Title")).gameObject.SetActive(true);
					((Component)((Component)Singleton<DealCompletionPopup>.Instance).gameObject.transform.Find("Container").Find("Payment")).gameObject.SetActive(true);
				}
			}
		}

		[HarmonyPatch(typeof(PickpocketScreen))]
		private static class MuggingPatch
		{
			[HarmonyPatch("Close")]
			[HarmonyPrefix]
			public static void Prefix(ref PickpocketScreen __instance)
			{
				if (mugging)
				{
					NPC npc = __instance.npc;
					npc.actions.SetCallPoliceBehaviourCrime((Crime)(object)new Mugging());
					npc.actions.CallPolice_Networked(Player.Local);
					npc.SetPanicked();
					npc.dialogueHandler.PlayReaction("panic_start", 5f, true);
					if (!((Object)(object)npc.VoiceOverEmitter == (Object)null))
					{
						npc.VoiceOverEmitter.Play((EVOLineType)12);
					}
				}
			}
		}

		[HarmonyPatch(typeof(NPCResponses_Civilian), "RespondToAimedAt", new Type[] { typeof(Player) })]
		private static class RobberyPatch
		{
			public static bool Prefix(ref NPCResponses_Civilian __instance, ref Player __0)
			{
				//IL_0291: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
				NPCScheduleManager component = ((Component)((Component)__instance).gameObject.transform.parent.Find("Schedule")).GetComponent<NPCScheduleManager>();
				if ((((Object)component.ActiveAction).name.Contains("Gas mart") || ((Object)component.ActiveAction).name.Contains("Gas station")) && ((Object)component.ActiveAction).name.Contains("worker"))
				{
					((NPCResponses)__instance).actions.Cower();
					robbery = true;
					Singleton<DealCompletionPopup>.Instance.PlayPopup(((Component)component.Npc).gameObject.GetComponent<Customer>(), -0.5f, component.Npc.RelationData.RelationDelta, 0f, new List<BonusPayment>());
					NPCRelationData relationData = component.Npc.RelationData;
					NPCRelationData relationData2 = component.Npc.RelationData;
					float relationship = (relationData2.RelationDelta -= 0.5f);
					relationData.SetRelationship(relationship);
					StartRobberyRegisters(0, "Prefix");
					return false;
				}
				if (((Object)component.ActiveAction).name.Contains("Location-based action (Bar stand point) (3:00 PM - 5:00 AM)") && ((Object)((Component)__instance).gameObject.transform.parent).name.Contains("Philip"))
				{
					((NPCResponses)__instance).actions.Cower();
					robbery = true;
					Singleton<DealCompletionPopup>.Instance.PlayPopup(((Component)component.Npc).gameObject.GetComponent<Customer>(), -0.5f, component.Npc.RelationData.RelationDelta, 0f, new List<BonusPayment>());
					NPCRelationData relationData3 = component.Npc.RelationData;
					NPCRelationData relationData4 = component.Npc.RelationData;
					float relationship = (relationData4.RelationDelta -= 0.5f);
					relationData3.SetRelationship(relationship);
					StartRobberyRegisters(2, "Prefix");
					return false;
				}
				if (((Object)component.ActiveAction).name.Contains("Cashier Stand Point"))
				{
					((NPCResponses)__instance).actions.Cower();
					robbery = true;
					Singleton<DealCompletionPopup>.Instance.PlayPopup(((Component)component.Npc).gameObject.GetComponent<Customer>(), -0.5f, component.Npc.RelationData.RelationDelta, 0f, new List<BonusPayment>());
					NPCRelationData relationData5 = component.Npc.RelationData;
					NPCRelationData relationData6 = component.Npc.RelationData;
					float relationship = (relationData6.RelationDelta -= 0.5f);
					relationData5.SetRelationship(relationship);
					StartRobberyRegisters(3, "Prefix");
					return false;
				}
				if (Vector3.Distance(((Component)component.Npc).transform.position, ((Component)Player.Local).transform.position) <= 4f)
				{
					mugging = true;
					Singleton<PickpocketScreen>.Instance.Open(component.Npc);
					for (int i = 0; i < Singleton<PickpocketScreen>.Instance.Slots.Length - 1; i++)
					{
						if (Singleton<PickpocketScreen>.Instance.Slots[i].assignedSlot.Quantity != 0)
						{
							Singleton<PickpocketScreen>.Instance.SetSlotLocked(i, false);
						}
					}
					NPC[] array = Object.FindObjectsOfType<NPC>();
					foreach (NPC val in array)
					{
						if ((Object)(object)val != (Object)null && val.IsConscious && Object.op_Implicit((Object)(object)val.awareness) && Object.op_Implicit((Object)(object)val.awareness.VisionCone) && val.awareness.VisionCone.sightedPlayers != null && val.awareness.VisionCone.sightedPlayers.Contains(Player.Local) && (Object)(object)val.dialogueHandler != (Object)null && (Object)(object)val.actions != (Object)null && (Object)(object)val != (Object)(object)component.Npc)
						{
							val.actions.SetCallPoliceBehaviourCrime((Crime)(object)new Mugging());
							val.actions.CallPolice_Networked(Player.Local);
							val.SetPanicked();
							val.dialogueHandler.PlayReaction("panic_start", 5f, true);
							if (!((Object)(object)val.VoiceOverEmitter == (Object)null))
							{
								val.VoiceOverEmitter.Play((EVOLineType)12);
							}
							break;
						}
					}
					return false;
				}
				return true;
			}
		}

		public static List<GameObject> RobbableDisplayBenches = new List<GameObject>();

		public static List<GameObject> DisplayBench0Items = new List<GameObject>();

		public static List<GameObject> DisplayBench1Items = new List<GameObject>();

		public static List<GameObject> DisplayBench2Items = new List<GameObject>();

		public static bool CanRobPawnShopBench0 = true;

		public static bool CanRobPawnShopBench1 = true;

		public static bool CanRobPawnShopBench2 = true;

		public static List<GameObject> RobbableRegisters = new List<GameObject>();

		private MelonPreferences_Category _preferenceCategory;

		private static bool mugging = false;

		private static bool robbery = false;

		private static readonly List<EClothingColor> AllColors = new List<EClothingColor>(27)
		{
			(EClothingColor)0,
			(EClothingColor)1,
			(EClothingColor)2,
			(EClothingColor)3,
			(EClothingColor)4,
			(EClothingColor)5,
			(EClothingColor)6,
			(EClothingColor)7,
			(EClothingColor)8,
			(EClothingColor)9,
			(EClothingColor)10,
			(EClothingColor)11,
			(EClothingColor)12,
			(EClothingColor)13,
			(EClothingColor)14,
			(EClothingColor)15,
			(EClothingColor)16,
			(EClothingColor)17,
			(EClothingColor)18,
			(EClothingColor)19,
			(EClothingColor)20,
			(EClothingColor)21,
			(EClothingColor)22,
			(EClothingColor)23,
			(EClothingColor)24,
			(EClothingColor)25,
			(EClothingColor)26
		};

		public override void OnInitializeMelon()
		{
			_preferenceCategory = MelonPreferences.CreateCategory("Section97");
			_preferenceCategory.CreateEntry<int>("GasMart_minimum_robbery_money", 300, "Minimum Money From Robbery", "The minimum amount of $$$ you can get per gas mart robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("GasMart_maximum_robbery_money", 700, "Maximum Money From Robbery", "The maximum amount of $$$ you can get per gas mart robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("PawnStore_minimum_robbery_money", 500, "Minimum Money From Pawn Store Robbery", "The minimum amount of $$$ you can get per Pawn Store Robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("PawnStore_maximum_robbery_money", 1200, "Maximum Money From Pawn Store Robbery", "The maximum amount of $$$ you can get per Pawn Store Robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("Casino_minimum_robbery_money", 700, "Minimum Money From Casino Robbery", "The minimum amount of $$$ you can get per Casino Robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("Casino_maximum_robbery_money", 1500, "Maximum Money From Casino Robbery", "The maximum amount of $$$ you can get per Casino Robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("TacoTicklers_minimum_robbery_money", 300, "Minimum Money From TacoTicklers Robbery", "The minimum amount of $$$ you can get per TacoTicklers Robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("TacoTicklers_maximum_robbery_money", 600, "Maximum Money From TacoTicklers Robbery", "The maximum amount of $$$ you can get per TacoTicklers Robbery", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("PawnStore_SmashNGrab_minimum_robbery_money", 200, "Minimum Money from the Pawn Store smash n grab.", "The minimum amount of $$$ from the Pawn Store Smash N Grab (Baseball bat robbery)", false, false, (ValueValidator)null, (string)null);
			_preferenceCategory.CreateEntry<int>("PawnStore_SmashNGrab_maximum_robbery_money", 600, "Maximum Money from the Pawn Store smash n grab.", "The maximum amount of $$$ from the Pawn Store Smash N Grab (Baseball bat robbery)", false, false, (ValueValidator)null, (string)null);
		}

		public override void OnDeinitializeMelon()
		{
			_preferenceCategory.SaveToFile(true);
		}

		public override void OnSceneWasUnloaded(int buildIndex, string sceneName)
		{
			if (!(sceneName != "Main"))
			{
				RobbableRegisters.Clear();
			}
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Expected O, but got Unknown
			if (sceneName != "Main")
			{
				return;
			}
			GameObject[] array = Object.FindObjectsOfType<GameObject>();
			foreach (GameObject val in array)
			{
				bool shirt;
				bool pants;
				if (((Object)val).name == "cash register")
				{
					RobbableRegisters.Add(val);
				}
				else if (((Object)val).name.ToLower().Contains("clothing rack"))
				{
					shirt = ((Object)val).name.EndsWith("shirts");
					pants = ((Object)val).name.EndsWith("pants");
					if (!(shirt || pants))
					{
						continue;
					}
					Transform val2 = val.transform.Find("clothing rack");
					if (!((Object)(object)val2 == (Object)null))
					{
						Transform val3 = val2.Find("Rack");
						if (!((Object)(object)val2 == (Object)null))
						{
							InteractableObject val4 = ((Component)val3).gameObject.AddComponent<InteractableObject>();
							val4.SetMessage(shirt ? "Shoplift Shirt" : "Shoplift Pants");
							val4.MaxInteractionRange = 2.5f;
							val4.onInteractEnd.AddListener(new UnityAction(FuncThatCallsFunc));
						}
					}
				}
				else if (((Object)val).name.Contains("Display Bench"))
				{
					RobbableDisplayBenches.Add(val);
					if (((Object)val).name.Contains("(2)"))
					{
						DisplayBench2Items.Add(((Component)val.transform.Find("Square tub")).gameObject);
						DisplayBench2Items.Add(((Component)val.transform.Find("Square tub (1)")).gameObject);
						DisplayBench2Items.Add(((Component)val.transform.parent.Find("Saucepan")).gameObject);
						DisplayBench2Items.Add(((Component)val.transform.parent.Find("Display cabinet (2)").Find("Champagne Bottle")).gameObject);
						DisplayBench1Items.Add(((Component)val.transform.Find("Gold bar")).gameObject);
						DisplayBench1Items.Add(((Component)val.transform.Find("Gold bar (1)")).gameObject);
						DisplayBench1Items.Add(((Component)val.transform.Find("Gold bar (2)")).gameObject);
						DisplayBench1Items.Add(((Component)val.transform.Find("Gold bar (3)")).gameObject);
					}
					else if (((Object)val).name == "Display Bench")
					{
						DisplayBench1Items.Add(((Component)val.transform.Find("Flashlight")).gameObject);
						DisplayBench1Items.Add(((Component)val.transform.Find("45 Bullet")).gameObject);
						DisplayBench1Items.Add(((Component)val.transform.Find("45 Bullet (1)")).gameObject);
						DisplayBench1Items.Add(((Component)val.transform.Find("45 Bullet (2)")).gameObject);
						DisplayBench1Items.Add(((Component)val.transform.Find("45 Bullet (3)")).gameObject);
						DisplayBench1Items.Add(((Component)val.transform.Find("45 Bullet (4)")).gameObject);
						DisplayBench1Items.Add(((Component)val.transform.Find("45 Bullet (5)")).gameObject);
						DisplayBench1Items.Add(((Component)val.transform.Find("45 Bullet (6)")).gameObject);
						DisplayBench1Items.Add(((Component)val.transform.Find("Funnel")).gameObject);
						DisplayBench1Items.Add(((Component)val.transform.Find("SmallBox")).gameObject);
						DisplayBench1Items.Add(((Component)val.transform.Find("SmallBox (1)")).gameObject);
						DisplayBench0Items.Add(((Component)val.transform.Find("Mortar")).gameObject);
						DisplayBench0Items.Add(((Component)val.transform.Find("Frying Pan")).gameObject);
						DisplayBench0Items.Add(((Component)val.transform.parent.Find("Display cabinet (2)").Find("Digital Alarm")).gameObject);
						DisplayBench0Items.Add(((Component)val.transform.parent.Find("Display cabinet (2)").Find("Wall Clock")).gameObject);
						DisplayBench0Items.Add(((Component)val.transform.parent.Find("Display cabinet (2)").Find("Biohazard Box")).gameObject);
					}
				}
				void FuncThatCallsFunc()
				{
					ShopliftRobbery(shirt, pants);
				}
			}
		}

		public void ShopliftRobbery(bool shirt, bool pants)
		{
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Invalid comparison between Unknown and I4
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Expected O, but got Unknown
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Invalid comparison between Unknown and I4
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Invalid comparison between Unknown and I4
			if ((Object)(object)Singleton<Registry>.Instance == (Object)null)
			{
				return;
			}
			List<ClothingDefinition> list = new List<ClothingDefinition>();
			foreach (KeyValuePair<int, ItemRegister> item in Singleton<Registry>.Instance.ItemDictionary)
			{
				if (item.value == null || !((Object)(object)item.value.Definition != (Object)null) || (int)item.value.Definition.Category != 11)
				{
					continue;
				}
				int hash = Registry.GetHash(item.value.Definition.ID);
				if (!Singleton<Registry>.Instance.ItemDictionary.ContainsKey(hash))
				{
					continue;
				}
				ItemRegister val = Singleton<Registry>.Instance.ItemDictionary[hash];
				if (val != null && (Object)(object)val.Definition != (Object)null)
				{
					ClothingDefinition val2 = (ClothingDefinition)val.Definition;
					if ((Object)(object)val2 != (Object)null && ((shirt && (int)val2.Slot == 3) || (pants && (int)val2.Slot == 1)))
					{
						list.Add(val2);
					}
				}
			}
			ClothingInstance val3 = (ClothingInstance)((ItemDefinition)list[Random.Range(0, list.Count)]).GetDefaultInstance(1);
			foreach (HotbarSlot hotbarSlot in PlayerSingleton<PlayerInventory>.Instance.hotbarSlots)
			{
				if (((ItemSlot)hotbarSlot).GetCapacityForItem((ItemInstance)(object)val3) == 0)
				{
					continue;
				}
				ClothingInstance val4 = (ClothingInstance)((ItemInstance)val3).GetCopy(1);
				EClothingColor color = AllColors[Random.Range(0, AllColors.Count - 1)];
				val4.Color = color;
				((ItemSlot)hotbarSlot).AddItem((ItemInstance)(object)val4, false);
				NPC[] array = Object.FindObjectsOfType<NPC>();
				foreach (NPC val5 in array)
				{
					if ((Object)(object)val5 != (Object)null && val5.IsConscious && Object.op_Implicit((Object)(object)val5.awareness) && Object.op_Implicit((Object)(object)val5.awareness.VisionCone) && val5.awareness.VisionCone.sightedPlayers != null && val5.awareness.VisionCone.sightedPlayers.Contains(Player.Local) && (Object)(object)val5.dialogueHandler != (Object)null && (Object)(object)val5.actions != (Object)null)
					{
						val5.actions.SetCallPoliceBehaviourCrime((Crime)(object)new Shoplifting());
						val5.actions.CallPolice_Networked(Player.Local);
						val5.SetPanicked();
						val5.dialogueHandler.PlayReaction("panic_start", 5f, true);
						if (!((Object)(object)val5.VoiceOverEmitter == (Object)null))
						{
							val5.VoiceOverEmitter.Play((EVOLineType)12);
						}
					}
				}
			}
		}

		public static async void StartRobberyRegisters(int x, [CallerMemberName] string callerName = "")
		{
			foreach (GameObject gameObject2 in RobbableRegisters)
			{
				InteractableObject interactable3;
				if ((Object)(object)gameObject2.GetComponent<InteractableObject>() != (Object)null)
				{
					interactable3 = gameObject2.GetComponent<InteractableObject>();
					((Behaviour)interactable3).enabled = true;
					continue;
				}
				interactable3 = gameObject2.AddComponent<InteractableObject>();
				interactable3.message = "Rob";
				interactable3.MaxInteractionRange = 15f;
				interactable3.Priority = 10;
				interactable3.onInteractEnd.AddListener(new UnityAction(FuncThatCallsFunc));
			}
			await Task.Delay(TimeSpan.FromSeconds(10.0));
			foreach (GameObject gameObject in RobbableRegisters)
			{
				InteractableObject interactable = gameObject.GetComponent<InteractableObject>();
				((Behaviour)interactable).enabled = false;
			}
			void FuncThatCallsFunc()
			{
				startRobbery(x, "StartRobberyRegisters");
			}
		}

		private static void startRobbery(int x, [CallerMemberName] string callerName = "")
		{
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			if ((Object)(object)Player.Local == (Object)null)
			{
				return;
			}
			int num = 0;
			switch (x)
			{
			case 0:
				num = Random.Range(MelonPreferences.GetEntryValue<int>("Section97", "GasMart_minimum_robbery_money"), MelonPreferences.GetEntryValue<int>("Section97", "GasMart_maximum_robbery_money"));
				break;
			case 2:
				num = Random.Range(MelonPreferences.GetEntryValue<int>("Section97", "Casino_minimum_robbery_money"), MelonPreferences.GetEntryValue<int>("Section97", "Casino_maximum_robbery_money"));
				break;
			case 3:
				num = Random.Range(MelonPreferences.GetEntryValue<int>("Section97", "TacoTicklers_minimum_robbery_money"), MelonPreferences.GetEntryValue<int>("Section97", "TacoTicklers_maximum_robbery_money"));
				break;
			}
			Type typeFromHandle = typeof(MoneyManager);
			FieldInfo field = typeFromHandle.GetField("Instance", BindingFlags.Static | BindingFlags.Public);
			if (field != null)
			{
				MoneyManager val = (MoneyManager)field.GetValue(null);
				if ((Object)(object)val != (Object)null)
				{
					val.ChangeCashBalance((float)num, true, true);
				}
			}
			else
			{
				MoneyManager val2 = Object.FindObjectOfType<MoneyManager>();
				if ((Object)(object)val2 != (Object)null)
				{
					val2.ChangeCashBalance((float)num, true, true);
				}
			}
			NPC[] array = Object.FindObjectsOfType<NPC>();
			foreach (NPC val3 in array)
			{
				if ((Object)(object)val3 != (Object)null && val3.IsConscious && Object.op_Implicit((Object)(object)val3.awareness) && Object.op_Implicit((Object)(object)val3.awareness.VisionCone) && val3.awareness.VisionCone.sightedPlayers != null && val3.awareness.VisionCone.sightedPlayers.Contains(Player.Local) && (Object)(object)val3.dialogueHandler != (Object)null && (Object)(object)val3.actions != (Object)null)
				{
					val3.actions.SetCallPoliceBehaviourCrime((Crime)(object)new ArmedRobbery());
					val3.actions.CallPolice_Networked(Player.Local);
					val3.SetPanicked();
					val3.dialogueHandler.PlayReaction("panic_start", 5f, true);
					if (!((Object)(object)val3.VoiceOverEmitter == (Object)null))
					{
						val3.VoiceOverEmitter.Play((EVOLineType)12);
					}
				}
			}
			foreach (GameObject robbableRegister in RobbableRegisters)
			{
				InteractableObject component = robbableRegister.GetComponent<InteractableObject>();
				((Behaviour)component).enabled = false;
			}
		}
	}
}
namespace Section97_Mono.Crimes
{
	public class ArmedRobbery : Crime
	{
		public override string CrimeName => "Armed Robbery";
	}
	public class Mugging : Crime
	{
		public override string CrimeName => "Mugging";
	}
	public class Shoplifting : Crime
	{
		public override string CrimeName => "Shoplifting";
	}
	public class SmashNGrab : Crime
	{
		public override string CrimeName => "Smash And Grab";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}