Decompiled source of Cartel Enforcer IL2CPP v1.3.2

CartelEnforcer-IL2Cpp.dll

Decompiled 8 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading;
using CartelEnforcer_IL2Cpp;
using HarmonyLib;
using Il2CppFishNet;
using Il2CppFishNet.Connection;
using Il2CppFishNet.Object;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppScheduleOne;
using Il2CppScheduleOne.AvatarFramework.Equipping;
using Il2CppScheduleOne.Cartel;
using Il2CppScheduleOne.Combat;
using Il2CppScheduleOne.DevUtilities;
using Il2CppScheduleOne.Dialogue;
using Il2CppScheduleOne.Doors;
using Il2CppScheduleOne.Economy;
using Il2CppScheduleOne.GameTime;
using Il2CppScheduleOne.ItemFramework;
using Il2CppScheduleOne.Map;
using Il2CppScheduleOne.Messaging;
using Il2CppScheduleOne.Money;
using Il2CppScheduleOne.NPCs;
using Il2CppScheduleOne.NPCs.Behaviour;
using Il2CppScheduleOne.NPCs.CharacterClasses;
using Il2CppScheduleOne.NPCs.Schedules;
using Il2CppScheduleOne.Persistence;
using Il2CppScheduleOne.PlayerScripts;
using Il2CppScheduleOne.Product;
using Il2CppScheduleOne.Quests;
using Il2CppScheduleOne.Storage;
using Il2CppScheduleOne.UI;
using Il2CppScheduleOne.UI.MainMenu;
using Il2CppScheduleOne.UI.Phone.Messages;
using Il2CppScheduleOne.Vehicles;
using Il2CppScheduleOne.Vehicles.AI;
using Il2CppScheduleOne.VoiceOver;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppTMPro;
using MelonLoader;
using MelonLoader.Utils;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering;
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: MelonInfo(typeof(global::CartelEnforcer_IL2Cpp.CartelEnforcer_IL2Cpp), "Cartel Enforcer", "1.3.2", "XOWithSauce", null)]
[assembly: MelonColor]
[assembly: MelonOptionalDependencies(new string[] { "FishNet.Runtime" })]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("CartelEnforcer-IL2Cpp")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CartelEnforcer-IL2Cpp")]
[assembly: AssemblyTitle("CartelEnforcer-IL2Cpp")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CartelEnforcer_IL2Cpp;

public static class BuildInfo
{
	public const string Name = "Cartel Enforcer";

	public const string Description = "Cartel - Modded and configurable";

	public const string Author = "XOWithSauce";

	public const string Company = null;

	public const string Version = "1.3.2";

	public const string DownloadLink = null;
}
public class ModConfig
{
	public bool debugMode = false;

	public float activityFrequency = 0f;

	public float activityInfluenceMin = 0f;

	public float ambushFrequency = 1f;

	public float deadDropStealFrequency = 1f;

	public float cartelCustomerDealFrequency = 1f;

	public float cartelRobberyFrequency = 1f;

	public bool driveByEnabled = true;

	public bool realRobberyEnabled = true;

	public bool miniQuestsEnabled = true;

	public bool interceptDeals = true;
}
public class NewAmbushConfig
{
	public int mapRegion = 0;

	public Vector3 ambushPosition = Vector3.zero;

	public List<Vector3> spawnPoints = new List<Vector3>();

	public float detectionRadius = 10f;
}
public class ListNewAmbush
{
	public List<NewAmbushConfig> addedAmbushes = new List<NewAmbushConfig>();
}
public static class ConfigLoader
{
	public class SerializeStolenItems
	{
		public string ID;

		public int Quality;

		public int Quantity;
	}

	public class StolenItemsList
	{
		public List<SerializeStolenItems> items;
	}

	private static string pathModConfig = Path.Combine(MelonEnvironment.ModsDirectory, "CartelEnforcer", "config.json");

	private static string pathAmbushes = Path.Combine(MelonEnvironment.ModsDirectory, "CartelEnforcer", "Ambush", "ambush.json");

	private static string pathDefAmbushes = Path.Combine(MelonEnvironment.ModsDirectory, "CartelEnforcer", "Ambush", "default.json");

	private static string pathCartelStolen = Path.Combine(MelonEnvironment.ModsDirectory, "CartelEnforcer", "CartelItems");

	public static ModConfig Load()
	{
		ModConfig modConfig;
		if (File.Exists(pathModConfig))
		{
			try
			{
				string text = File.ReadAllText(pathModConfig);
				modConfig = JsonConvert.DeserializeObject<ModConfig>(text);
				modConfig.activityFrequency = Mathf.Clamp(modConfig.activityFrequency, -1f, 1f);
				modConfig.activityInfluenceMin = Mathf.Clamp(modConfig.activityInfluenceMin, -1f, 1f);
			}
			catch (Exception ex)
			{
				modConfig = new ModConfig();
				MelonLogger.Warning("Failed to read CartelEnforcer config: " + ex);
			}
		}
		else
		{
			modConfig = new ModConfig();
			Save(modConfig);
		}
		return modConfig;
	}

	public static void Save(ModConfig config)
	{
		try
		{
			string contents = JsonConvert.SerializeObject((object)config, (Formatting)1);
			Directory.CreateDirectory(Path.GetDirectoryName(pathModConfig));
			File.WriteAllText(pathModConfig, contents);
		}
		catch (Exception ex)
		{
			MelonLogger.Warning("Failed to save CartelEnforcer config: " + ex);
		}
	}

	public static ListNewAmbush LoadAmbushConfig()
	{
		ListNewAmbush listNewAmbush;
		if (File.Exists(pathAmbushes))
		{
			try
			{
				string text = File.ReadAllText(pathAmbushes);
				listNewAmbush = JsonConvert.DeserializeObject<ListNewAmbush>(text);
			}
			catch (Exception ex)
			{
				listNewAmbush = new ListNewAmbush();
				listNewAmbush.addedAmbushes = new List<NewAmbushConfig>();
				MelonLogger.Warning("Failed to read CartelEnforcer config: " + ex);
			}
		}
		else
		{
			listNewAmbush = new ListNewAmbush();
			listNewAmbush.addedAmbushes = new List<NewAmbushConfig>();
			Save(listNewAmbush);
		}
		return listNewAmbush;
	}

	public static void Save(ListNewAmbush config)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		try
		{
			JsonSerializerSettings val = new JsonSerializerSettings
			{
				ContractResolver = (IContractResolver)(object)new UnityContractResolver()
			};
			string contents = JsonConvert.SerializeObject((object)config, (Formatting)1, val);
			Directory.CreateDirectory(Path.GetDirectoryName(pathAmbushes));
			File.WriteAllText(pathAmbushes, contents);
		}
		catch (Exception ex)
		{
			MelonLogger.Warning("Failed to save CartelEnforcer config: " + ex);
		}
	}

	public static ListNewAmbush LoadDefaultAmbushConfig()
	{
		ListNewAmbush result;
		if (File.Exists(pathDefAmbushes))
		{
			try
			{
				string text = File.ReadAllText(pathDefAmbushes);
				result = JsonConvert.DeserializeObject<ListNewAmbush>(text);
			}
			catch (Exception ex)
			{
				result = new ListNewAmbush();
				MelonLogger.Warning("Failed to read default.json config: " + ex);
			}
		}
		else
		{
			result = GenerateAmbushState();
		}
		return result;
	}

	public static ListNewAmbush GenerateAmbushState()
	{
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Expected O, but got Unknown
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Expected I4, but got Unknown
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		ListNewAmbush listNewAmbush = new ListNewAmbush();
		listNewAmbush.addedAmbushes = new List<NewAmbushConfig>();
		try
		{
			CartelRegionActivities[] array = Il2CppArrayBase<CartelRegionActivities>.op_Implicit(Object.FindObjectsOfType<CartelRegionActivities>(true));
			CartelRegionActivities[] array2 = array;
			foreach (CartelRegionActivities val in array2)
			{
				foreach (CartelAmbushLocation item in (Il2CppArrayBase<CartelAmbushLocation>)(object)val.AmbushLocations)
				{
					NewAmbushConfig config = new NewAmbushConfig();
					config.mapRegion = (int)val.Region;
					config.ambushPosition = ((Component)item).transform.position;
					config.spawnPoints = ((IEnumerable<Transform>)item.AmbushPoints).Select((Transform tr) => tr.position).ToList();
					config.detectionRadius = item.DetectionRadius;
					if (!listNewAmbush.addedAmbushes.Any((NewAmbushConfig existingConfig) => existingConfig.mapRegion == config.mapRegion && existingConfig.ambushPosition == config.ambushPosition))
					{
						listNewAmbush.addedAmbushes.Add(config);
					}
				}
			}
			JsonSerializerSettings val2 = new JsonSerializerSettings
			{
				ContractResolver = (IContractResolver)(object)new UnityContractResolver()
			};
			string contents = JsonConvert.SerializeObject((object)listNewAmbush, (Formatting)1, val2);
			Directory.CreateDirectory(Path.GetDirectoryName(pathDefAmbushes));
			File.WriteAllText(pathDefAmbushes, contents);
		}
		catch (Exception ex)
		{
			MelonLogger.Warning("Failed to save default.json config: " + ex);
		}
		return listNewAmbush;
	}

	public static string SanitizeAndFormatName(string orgName)
	{
		string text = orgName;
		if (text != null)
		{
			text = text.Replace(" ", "_").ToLower();
			text = text.Replace(",", "");
			text = text.Replace(".", "");
			text = text.Replace("<", "");
			text = text.Replace(">", "");
			text = text.Replace(":", "");
			text = text.Replace("\"", "");
			text = text.Replace("/", "");
			text = text.Replace("\\", "");
			text = text.Replace("|", "");
			text = text.Replace("?", "");
			text = text.Replace("*", "");
		}
		return text + ".json";
	}

	public static List<QualityItemInstance> LoadStolenItems()
	{
		SaveInfo activeSaveInfo = Singleton<LoadManager>.Instance.ActiveSaveInfo;
		string orgName = ((activeSaveInfo != null) ? activeSaveInfo.OrganisationName : null);
		string path = SanitizeAndFormatName(orgName);
		StolenItemsList stolenItemsList;
		if (File.Exists(Path.Combine(pathCartelStolen, path)))
		{
			try
			{
				string text = File.ReadAllText(Path.Combine(pathCartelStolen, path));
				stolenItemsList = JsonConvert.DeserializeObject<StolenItemsList>(text);
			}
			catch (Exception ex)
			{
				stolenItemsList = new StolenItemsList();
				MelonLogger.Warning("Failed to read Cartel Stolen Items data: " + ex);
			}
		}
		else
		{
			stolenItemsList = new StolenItemsList();
		}
		List<QualityItemInstance> list = new List<QualityItemInstance>();
		if (stolenItemsList.items != null && stolenItemsList.items.Count > 0)
		{
			MelonLogger.Msg("Serialize Quality");
			foreach (SerializeStolenItems item2 in stolenItemsList.items)
			{
				ItemDefinition item = Registry.GetItem(item2.ID);
				ItemInstance defaultInstance = item.GetDefaultInstance(item2.Quantity);
				QualityItemInstance val = ((Il2CppObjectBase)defaultInstance).TryCast<QualityItemInstance>();
				if (val != null)
				{
					switch (item2.Quality)
					{
					case 0:
						val.Quality = (EQuality)0;
						break;
					case 1:
						val.Quality = (EQuality)1;
						break;
					case 2:
						val.Quality = (EQuality)2;
						break;
					case 3:
						val.Quality = (EQuality)3;
						break;
					case 4:
						val.Quality = (EQuality)4;
						break;
					}
				}
				list.Add(val);
			}
		}
		return list;
	}

	public static void Save(List<QualityItemInstance> stolenItems)
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Expected I4, but got Unknown
		StolenItemsList stolenItemsList = new StolenItemsList();
		stolenItemsList.items = new List<SerializeStolenItems>();
		foreach (QualityItemInstance stolenItem in stolenItems)
		{
			SerializeStolenItems item = new SerializeStolenItems
			{
				ID = ((ItemInstance)stolenItem).ID,
				Quality = (int)stolenItem.Quality,
				Quantity = ((ItemInstance)stolenItem).Quantity
			};
			stolenItemsList.items.Add(item);
		}
		try
		{
			SaveInfo activeSaveInfo = Singleton<LoadManager>.Instance.ActiveSaveInfo;
			string orgName = ((activeSaveInfo != null) ? activeSaveInfo.OrganisationName : null);
			string path = SanitizeAndFormatName(orgName);
			string path2 = Path.Combine(pathCartelStolen, path);
			string contents = JsonConvert.SerializeObject((object)stolenItemsList, (Formatting)1);
			Directory.CreateDirectory(Path.GetDirectoryName(path2));
			File.WriteAllText(path2, contents);
		}
		catch (Exception ex)
		{
			MelonLogger.Warning("Failed to save Cartel Stolen Items data: " + ex);
		}
	}
}
public class UnityContractResolver : DefaultContractResolver
{
	protected override JsonObjectContract CreateObjectContract(Type objectType)
	{
		JsonObjectContract val = ((DefaultContractResolver)this).CreateObjectContract(objectType);
		if (objectType == typeof(Vector3))
		{
			for (int num = ((Collection<JsonProperty>)(object)val.Properties).Count - 1; num >= 0; num--)
			{
				JsonProperty val2 = ((Collection<JsonProperty>)(object)val.Properties)[num];
				if (val2.PropertyName == "normalized" || val2.PropertyName == "magnitude" || val2.PropertyName == "sqrMagnitude")
				{
					((Collection<JsonProperty>)(object)val.Properties).RemoveAt(num);
				}
			}
		}
		return val;
	}
}
public class CartelEnforcer_IL2Cpp : MelonMod
{
	public class NpcQuestStatus
	{
		public bool HasAskedQuestToday { get; set; }

		public bool HasActiveQuest { get; set; }
	}

	[HarmonyPatch(typeof(SaveManager), "Save", new Type[] { typeof(string) })]
	public static class SaveManager_Save_String_Patch
	{
		public static bool Prefix(SaveManager __instance, string saveFolderPath)
		{
			lock (cartelItemLock)
			{
				ConfigLoader.Save(cartelStolenItems);
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(SaveManager), "Save", new Type[] { })]
	public static class SaveManager_Save_Patch
	{
		public static bool Prefix(SaveManager __instance)
		{
			return true;
		}
	}

	[HarmonyPatch(typeof(LoadManager), "ExitToMenu")]
	public static class LoadManager_ExitToMenu_Patch
	{
		public static bool Prefix(LoadManager __instance, SaveInfo autoLoadSave = null, Data mainMenuPopup = null, bool preventLeaveLobby = false)
		{
			lock (cartelItemLock)
			{
				ConfigLoader.Save(cartelStolenItems);
			}
			ExitPreTask();
			return true;
		}
	}

	[HarmonyPatch(typeof(DeathScreen), "LoadSaveClicked")]
	public static class DeathScreen_LoadSaveClicked_Patch
	{
		public static bool Prefix(DeathScreen __instance)
		{
			ExitPreTask();
			return true;
		}
	}

	public class HrPassParameterMap
	{
		public string itemDesc { get; set; }

		public Func<int> Getter { get; set; }

		public Action<int> Setter { get; set; }

		public Action HourPassAction { get; set; }

		public int modTicksPassed { get; set; }

		public int currentModHours { get; set; }

		public Func<bool> CanPassHour { get; set; }
	}

	public class CartelRegActivityHours
	{
		public int region;

		public int cartelActivityClass = 0;

		public int hoursUntilEnable = 0;
	}

	[HarmonyPatch(typeof(CartelActivities), "TryStartActivity")]
	public static class CartelActivities_TryStartActivityPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(CartelActivities __instance)
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			Log("[GLOBACT] TryStartGlobalActivity");
			__instance.HoursUntilNextGlobalActivity = CartelActivities.GetNewCooldown();
			if (!__instance.CanNewActivityBegin())
			{
				Log("[GLOBACT]    NewActivity Cant Begin");
				return false;
			}
			List<CartelActivity> list = new List<CartelActivity>();
			Enumerator<CartelActivity> enumerator = __instance.GetActivitiesReadyToStart().GetEnumerator();
			while (enumerator.MoveNext())
			{
				CartelActivity current = enumerator.Current;
				list.Add(current);
			}
			List<EMapRegion> list2 = new List<EMapRegion>();
			Enumerator<EMapRegion> enumerator2 = __instance.GetValidRegionsForActivity().GetEnumerator();
			while (enumerator2.MoveNext())
			{
				EMapRegion current2 = enumerator2.Current;
				list2.Add(current2);
			}
			if (list.Count == 0 || list2.Count == 0)
			{
				Log("[GLOBACT]    No Activities or Regions ready to start");
				return false;
			}
			Log($"[GLOBACT]    Total Activities ready to start: {list.Count}");
			list2.Sort((EMapRegion a, EMapRegion b) => NetworkSingleton<Cartel>.Instance.Influence.GetInfluence(b).CompareTo(NetworkSingleton<Cartel>.Instance.Influence.GetInfluence(a)));
			EMapRegion val = (EMapRegion)0;
			bool flag = false;
			foreach (EMapRegion item in list2)
			{
				float influence = NetworkSingleton<Cartel>.Instance.Influence.GetInfluence(item);
				float num = 0f;
				float num2 = 0f;
				if (currentConfig.activityInfluenceMin == 0f)
				{
					num = 0.7f;
					num2 = influence * num;
					if (Random.Range(0f, 1f) < num2)
					{
						val = item;
						flag = true;
						break;
					}
					continue;
				}
				if (currentConfig.activityInfluenceMin > 0f)
				{
					num2 = Mathf.Lerp(influence * 0.7f, 1f, currentConfig.activityInfluenceMin);
					if (!(Random.Range(0f, 1f) > num2))
					{
						continue;
					}
					val = item;
					flag = true;
					break;
				}
				float num3 = 0f - currentConfig.activityInfluenceMin;
				num = Mathf.Lerp(1f, 0f, currentConfig.activityInfluenceMin);
				num2 = influence * num;
				if (!(Random.Range(0f, 1f) > num2))
				{
					continue;
				}
				val = item;
				flag = true;
				break;
			}
			if (!flag)
			{
				Log("[GLOBACT]    Ambush Random Roll not triggered");
				return false;
			}
			Log("[GLOBACT]    Check the Ambush hours");
			if (regActivityHours[0].hoursUntilEnable > 0)
			{
				Log("[GLOBACT]    Ambush not ready");
				return false;
			}
			int count = list.Count;
			Log($"[GLOBACT]    Ambush Pos ReadyCount: {count}");
			do
			{
				count = list.Count;
				if (count == 0)
				{
					break;
				}
				int index = Random.Range(0, count);
				if (list[index].IsRegionValidForActivity(val))
				{
					int num4 = NetworkSingleton<Cartel>.Instance.Activities.GlobalActivities.IndexOf(list[index]);
					if (num4 != -1)
					{
						Log($"[GLOBACT]   idx: {num4} | {((Object)list[index]).name}");
						Log("[GLOBACT]    Start Global Activity");
						NetworkSingleton<Cartel>.Instance.Activities.StartGlobalActivity((NetworkConnection)null, val, 0);
						regActivityHours[0].hoursUntilEnable = GetActivityHours(currentConfig.ambushFrequency);
						break;
					}
				}
				else
				{
					list.Remove(list[index]);
				}
			}
			while (count != 0);
			Log("[GLOBACT] TryStartGlobalActivity Finished");
			return false;
		}
	}

	[HarmonyPatch(typeof(CartelRegionActivities), "TryStartActivity")]
	public static class CartelRegionActivities_TryStartActivityPatch
	{
		[HarmonyPrefix]
		public static bool Prefix(CartelRegionActivities __instance)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Invalid comparison between I4 and Unknown
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			__instance.HoursUntilNextActivity = CartelRegionActivities.GetNewCooldown(__instance.Region);
			Log("[REGACT] TryStartRegionalActivity");
			List<CartelActivity> list = new List<CartelActivity>();
			Enumerator<CartelActivity> enumerator = __instance.Activities.GetEnumerator();
			while (enumerator.MoveNext())
			{
				CartelActivity current = enumerator.Current;
				list.Add(current);
			}
			List<int> list2 = new List<int>();
			for (int i = 0; i < regActivityHours.Count; i++)
			{
				if (regActivityHours[i].region == (int)__instance.Region)
				{
					list2.Add(i);
				}
			}
			Dictionary<CartelActivity, List<int>> dictionary = new Dictionary<CartelActivity, List<int>>();
			foreach (CartelActivity item in list)
			{
				int num = 0;
				num = ((!(item is StealDeadDrop)) ? ((item is CartelCustomerDeal) ? 1 : 2) : 0);
				for (int j = 0; j < list2.Count; j++)
				{
					if (regActivityHours[list2[j]].cartelActivityClass == num && regActivityHours[list2[j]].hoursUntilEnable <= 0 && !dictionary.ContainsKey(item))
					{
						List<int> value = new List<int>
						{
							list2[j],
							num
						};
						dictionary.Add(item, value);
					}
				}
			}
			if (dictionary.Count == 0)
			{
				Log("[REGACT]    No Regional Activities can be enabled at this moment");
				return false;
			}
			Log("[REGACT]    Enabled Activities Count: " + dictionary.Count);
			int count;
			do
			{
				count = dictionary.Count;
				if (count == 0)
				{
					break;
				}
				KeyValuePair<CartelActivity, List<int>> keyValuePair = dictionary.ElementAtOrDefault(Random.Range(0, count));
				if (keyValuePair.Key.IsRegionValidForActivity(__instance.Region))
				{
					__instance.StartActivity((NetworkConnection)null, __instance.Activities.IndexOf(keyValuePair.Key));
					Log("[REGACT]    Starting Activity!");
					if (keyValuePair.Value[1] == 0)
					{
						regActivityHours[keyValuePair.Value[0]].hoursUntilEnable = GetActivityHours(currentConfig.deadDropStealFrequency);
					}
					else if (keyValuePair.Value[1] == 1)
					{
						regActivityHours[keyValuePair.Value[0]].hoursUntilEnable = GetActivityHours(currentConfig.cartelCustomerDealFrequency);
					}
					else if (keyValuePair.Value[1] == 2)
					{
						regActivityHours[keyValuePair.Value[0]].hoursUntilEnable = GetActivityHours(currentConfig.cartelRobberyFrequency);
					}
					break;
				}
				dictionary.Remove(keyValuePair.Key);
			}
			while (count != 0);
			Log("[REGACT] Finished TryStartRegionalActivity");
			return false;
		}
	}

	[HarmonyPatch(typeof(Dealer), "TryRobDealer")]
	public static class DealerRobberyPatch
	{
		[CompilerGenerated]
		private sealed class <RobberyCombatCoroutine>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Dealer dealer;

			private EMapRegion <region>5__1;

			private Vector3 <spawnPos>5__2;

			private int <maxAttempts>5__3;

			private int <j>5__4;

			private CartelGoon <goon>5__5;

			private string <text>5__6;

			private ICombatTargetable <targetable>5__7;

			private int <i>5__8;

			private Vector3 <randomDirection>5__9;

			private float <randomRadius>5__10;

			private Vector3 <randomPoint>5__11;

			private int <>s__12;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <RobberyCombatCoroutine>d__3(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<goon>5__5 = null;
				<text>5__6 = null;
				<targetable>5__7 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Expected O, but got Unknown
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0152: Unknown result type (might be due to invalid IL or missing references)
				//IL_0157: Unknown result type (might be due to invalid IL or missing references)
				//IL_0199: Unknown result type (might be due to invalid IL or missing references)
				//IL_019f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_01af: 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_01c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: 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_0102: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0126: Expected O, but got Unknown
				//IL_0207: Unknown result type (might be due to invalid IL or missing references)
				//IL_020c: Unknown result type (might be due to invalid IL or missing references)
				//IL_022a: Unknown result type (might be due to invalid IL or missing references)
				//IL_02da: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e6: Expected O, but got Unknown
				//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0304: Unknown result type (might be due to invalid IL or missing references)
				//IL_030e: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if (!registered)
					{
						return false;
					}
					<region>5__1 = (EMapRegion)0;
					<i>5__8 = 0;
					while (<i>5__8 < ((Il2CppArrayBase<MapRegionData>)(object)Singleton<Map>.Instance.Regions).Length)
					{
						if (((Il2CppArrayBase<MapRegionData>)(object)Singleton<Map>.Instance.Regions)[<i>5__8].RegionBounds.IsPointInsidePolygon(((NPC)dealer).CenterPointTransform.position))
						{
							<region>5__1 = ((Il2CppArrayBase<MapRegionData>)(object)Singleton<Map>.Instance.Regions)[<i>5__8].Region;
						}
						<i>5__8++;
					}
					<spawnPos>5__2 = Vector3.zero;
					<maxAttempts>5__3 = 6;
					<j>5__4 = 0;
					goto IL_0115;
				case 2:
					<>1__state = -1;
					if (!registered)
					{
						return false;
					}
					Log("[TRY ROB]    Finding Spawn Robber Position");
					<randomDirection>5__9 = Random.onUnitSphere;
					<randomDirection>5__9.y = 0f;
					((Vector3)(ref <randomDirection>5__9)).Normalize();
					<randomRadius>5__10 = Random.Range(8f, 16f);
					<randomPoint>5__11 = ((Component)dealer).transform.position + <randomDirection>5__9 * <randomRadius>5__10;
					((NPC)dealer).Movement.GetClosestReachablePoint(<randomPoint>5__11, ref <spawnPos>5__2);
					if (!(<spawnPos>5__2 == Vector3.zero) || <j>5__4 > <maxAttempts>5__3)
					{
						if (<spawnPos>5__2 == Vector3.zero)
						{
							return false;
						}
						<goon>5__5 = NetworkSingleton<Cartel>.Instance.GoonPool.SpawnGoon(<spawnPos>5__2);
						<text>5__6 = "";
						int num = Random.Range(0, 5);
						<>s__12 = num;
						switch (<>s__12)
						{
						case 0:
							<text>5__6 = "HELP BOSS!! Benzies are trying to ROB ME!!";
							break;
						case 1:
							<text>5__6 = "BOSS!! I'm getting robbed!";
							break;
						case 2:
							<text>5__6 = "I'm being jumped, come back me up!";
							break;
						case 3:
							<text>5__6 = "Benzies set me up!! Come help quick!";
							break;
						case 4:
							<text>5__6 = "Help, boss! I'm getting ambushed!";
							break;
						default:
							<text>5__6 = "HELP BOSS!! Benzies are trying to ROB ME!!";
							break;
						}
						((NPC)dealer).MSGConversation.SendMessage(new Message(<text>5__6, (ESenderType)1, false, -1), true, true);
						((NPC)<goon>5__5).Movement.Warp(<spawnPos>5__2);
						<>2__current = (object)new WaitForSeconds(0.5f);
						<>1__state = 3;
						return true;
					}
					goto IL_0115;
				case 3:
					{
						<>1__state = -1;
						if (!registered)
						{
							return false;
						}
						((NPC)<goon>5__5).Behaviour.CombatBehaviour.DefaultWeapon = null;
						((NPC)dealer).Behaviour.CombatBehaviour.SetTarget((NetworkConnection)null, ((NetworkBehaviour)dealer).NetworkObject);
						((Behaviour)((NPC)dealer).Behaviour.CombatBehaviour).Begin();
						((Behaviour)((NPC)dealer).Behaviour.CombatBehaviour).Enable_Networked((NetworkConnection)null);
						<targetable>5__7 = ((Component)((NetworkBehaviour)dealer).NetworkObject).GetComponent<ICombatTargetable>();
						if (<targetable>5__7 != null)
						{
							coros.Add(MelonCoroutines.Start(StateRobberyCombat(dealer, <goon>5__5, <region>5__1)));
							<goon>5__5.AttackEntity(<targetable>5__7, true);
						}
						else
						{
							MelonLogger.Warning("ICombatTargetable Not Found");
						}
						return false;
					}
					IL_0115:
					<>2__current = (object)new WaitForSeconds(0.3f);
					<>1__state = 2;
					return true;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static bool IsPlayerNearby(Dealer dealer, float maxDistance = 60f)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			return Vector3.Distance(((Component)dealer).transform.position, ((Component)Player.Local).transform.position) < maxDistance;
		}

		private static void Original(Dealer __instance)
		{
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Expected O, but got Unknown
			Log("[TRY ROB ORIGINAL] Evaluate Result - Check Inv");
			float num = 0f;
			Enumerator<ItemSlot> enumerator = ((NPC)__instance).Inventory.ItemSlots.GetEnumerator();
			while (enumerator.MoveNext())
			{
				ItemSlot current = enumerator.Current;
				if (current.ItemInstance != null)
				{
					StorableItemDefinition val = ((Il2CppObjectBase)current.ItemInstance.Definition).TryCast<StorableItemDefinition>();
					if ((Object)(object)val != (Object)null)
					{
						num = Mathf.Max(num, val.CombatUtilityForNPCs);
					}
					else
					{
						Log("[TRY ROB ORIGINAL] Evaluate Result - Temp Definition is null");
					}
				}
			}
			float num2 = Random.Range(0f, 1f);
			num2 = Mathf.Lerp(num2, 1f, num * 0.5f);
			Log("[TRY ROB ORIGINAL] Evaluate Result - Evaluate Random roll, Combat and Inventory states");
			if (num2 > 0.67f)
			{
				((NPC)__instance).MSGConversation.SendMessage(new Message(((NPC)__instance).DialogueHandler.Database.GetLine((EDialogueModule)6, "dealer_rob_defended"), (ESenderType)1, false, -1), true, true);
				return;
			}
			if (num2 > 0.25f)
			{
				((NPC)__instance).MSGConversation.SendMessage(new Message(((NPC)__instance).DialogueHandler.Database.GetLine((EDialogueModule)6, "dealer_rob_partially_defended"), (ESenderType)1, false, -1), true, true);
				List<ItemInstance> list = new List<ItemInstance>();
				float num3 = 1f - Mathf.InverseLerp(0.25f, 0.67f, num2);
				Log("[TRY ROB ORIGINAL] Partial Move Items");
				for (int i = 0; i < ((NPC)__instance).Inventory.ItemSlots.Count; i++)
				{
					if (((NPC)__instance).Inventory.ItemSlots[i].ItemInstance != null)
					{
						float num4 = num3 * 0.8f;
						if (Random.Range(0f, 1f) < num4)
						{
							int num5 = Mathf.RoundToInt((float)((NPC)__instance).Inventory.ItemSlots[i].ItemInstance.Quantity * num3);
							list.Add(((NPC)__instance).Inventory.ItemSlots[i].ItemInstance.GetCopy(num5));
							((NPC)__instance).Inventory.ItemSlots[i].ChangeQuantity(-num5, false);
						}
					}
				}
				__instance.TryMoveOverflowItems();
				float num6 = __instance.Cash * num3;
				__instance.ChangeCash(0f - num6);
				SummarizeLosses(__instance, list, num6);
				return;
			}
			Log("[TRY ROB ORIGINAL] Full Rob Items");
			((NPC)__instance).MSGConversation.SendMessage(new Message(((NPC)__instance).DialogueHandler.Database.GetLine((EDialogueModule)6, "dealer_rob_loss"), (ESenderType)1, false, -1), true, true);
			List<ItemInstance> list2 = new List<ItemInstance>();
			Enumerator<ItemSlot> enumerator2 = ((NPC)__instance).Inventory.ItemSlots.GetEnumerator();
			while (enumerator2.MoveNext())
			{
				ItemSlot current2 = enumerator2.Current;
				if (current2.ItemInstance != null)
				{
					list2.Add(current2.ItemInstance.GetCopy(current2.ItemInstance.Quantity));
				}
			}
			((NPC)__instance).Inventory.Clear();
			foreach (ItemSlot item in (Il2CppArrayBase<ItemSlot>)(object)__instance.overflowSlots)
			{
				if (item.ItemInstance != null)
				{
					list2.Add(item.ItemInstance.GetCopy(item.ItemInstance.Quantity));
					item.ClearStoredInstance(false);
				}
			}
			float cash2 = __instance.Cash;
			__instance.ChangeCash(0f - cash2);
			SummarizeLosses(__instance, list2, cash2);
			static void SummarizeLosses(Dealer __instance, List<ItemInstance> items, float cash)
			{
				//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e4: Expected O, but got Unknown
				//IL_0146: Unknown result type (might be due to invalid IL or missing references)
				//IL_014b: Unknown result type (might be due to invalid IL or missing references)
				Log("[TRY ROB ORIGINAL] Sum Loss");
				if (items.Count > 0)
				{
					coros.Add(MelonCoroutines.Start(CartelStealsItems(items, delegate
					{
						Log($"[CARTEL INV]    Succesfully stolen {items.Count} unique items");
					})));
				}
				if (items.Count != 0 || !(cash <= 0f))
				{
					List<string> list3 = new List<string>();
					for (int j = 0; j < items.Count; j++)
					{
						string text = items[j].Quantity + "x ";
						ProductItemInstance val2 = ((Il2CppObjectBase)items[j]).TryCast<ProductItemInstance>();
						if (val2 != null && (Object)(object)val2.AppliedPackaging != (Object)null)
						{
							text = text + ((ItemDefinition)val2.AppliedPackaging).Name + " of ";
						}
						text += items[j].Definition.Name;
						QualityItemInstance val3 = ((Il2CppObjectBase)items[j]).TryCast<QualityItemInstance>();
						if (val3 != null)
						{
							string text2 = text;
							EQuality quality = val3.Quality;
							text = text2 + " (" + ((object)(EQuality)(ref quality)).ToString() + " quality)";
						}
						list3.Add(text);
					}
					if (cash > 0f)
					{
						list3.Add(MoneyManager.FormatAmount(cash, false, false) + " cash");
					}
					string text3 = "This is what they got:\n" + string.Join("\n", list3);
					((NPC)__instance).MSGConversation.SendMessage(new Message(text3, (ESenderType)1, true, -1), false, true);
				}
			}
		}

		[HarmonyPrefix]
		public static bool Prefix(Dealer __instance)
		{
			if (((NPC)__instance).RelationData.Unlocked && __instance.IsRecruited)
			{
				if (IsPlayerNearby(__instance) && currentConfig.realRobberyEnabled)
				{
					Log("[TRY ROB]    Run Custom");
					if (!((NPC)__instance).isInBuilding && !((NPC)__instance).Health.IsDead && !((NPC)__instance).Health.IsKnockedOut)
					{
						coros.Add(MelonCoroutines.Start(RobberyCombatCoroutine(__instance)));
					}
				}
				else
				{
					Log("[TRY ROB]    Run original");
					Original(__instance);
				}
			}
			return false;
		}

		[IteratorStateMachine(typeof(<RobberyCombatCoroutine>d__3))]
		private static IEnumerator RobberyCombatCoroutine(Dealer dealer)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <RobberyCombatCoroutine>d__3(0)
			{
				dealer = dealer
			};
		}
	}

	public class DriveByTrigger
	{
		public Vector3 triggerPosition;

		public float radius;

		public Vector3 spawnEulerAngles;

		public Vector3 startPosition;

		public Vector3 endPosition;
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass45_0
	{
		public NewAmbushConfig config;

		internal bool <AddUserModdedAmbush>b__0(CartelRegionActivities act)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			return (int)act.Region == config.mapRegion;
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass49_0
	{
		public CartelActivities instanceActivities;

		public CartelDealManager instanceDealMgr;

		internal int <PopulateParameterMap>b__0()
		{
			return instanceActivities.HoursUntilNextGlobalActivity;
		}

		internal void <PopulateParameterMap>b__1(int value)
		{
			instanceActivities.HoursUntilNextGlobalActivity = value;
		}

		internal void <PopulateParameterMap>b__2()
		{
			instanceActivities.HourPass();
		}

		internal int <PopulateParameterMap>b__8()
		{
			return instanceDealMgr.HoursUntilNextDealRequest;
		}

		internal void <PopulateParameterMap>b__9(int value)
		{
			instanceDealMgr.HoursUntilNextDealRequest = value;
		}

		internal void <PopulateParameterMap>b__10()
		{
			instanceDealMgr.HourPass();
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass49_1
	{
		public CartelRegionActivities act;

		internal int <PopulateParameterMap>b__4()
		{
			return act.HoursUntilNextActivity;
		}

		internal void <PopulateParameterMap>b__5(int value)
		{
			act.HoursUntilNextActivity = value;
		}

		internal void <PopulateParameterMap>b__6()
		{
			act.HourPass();
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass59_0
	{
		public CartelGoon goon;
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass73_0
	{
		public bool opened;

		public List<EMapRegion> mapReg;

		public DeadDrop entity;

		public UnityAction onOpenedAction;
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass78_0
	{
		public CartelDealer dealer;

		public Customer customer;

		public bool changeInfluence;

		public EMapRegion region;

		public string cGuid;

		public NPCSignal_HandleDeal ev2;

		public NPCEvent_StayInBuilding ev1;

		public Contract contract;
	}

	[CompilerGenerated]
	private sealed class <AddUserModdedAmbush>d__45 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		private CartelRegionActivities[] <regAct>5__1;

		private int <i>5__2;

		private List<NewAmbushConfig>.Enumerator <>s__3;

		private <>c__DisplayClass45_0 <>8__4;

		private CartelRegionActivities <regActivity>5__5;

		private Transform <nextParent>5__6;

		private GameObject <newAmbushObj>5__7;

		private CartelAmbushLocation <baseComp>5__8;

		private GameObject <spawnPointsTr>5__9;

		private int <j>5__10;

		private CartelAmbushLocation[] <originalLocations>5__11;

		private CartelAmbushLocation[] <newLocations>5__12;

		private List<Vector3>.Enumerator <>s__13;

		private Vector3 <spawnPoint>5__14;

		private string <name>5__15;

		private GameObject <newSpawnPoint>5__16;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <AddUserModdedAmbush>d__45(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<regAct>5__1 = null;
			<>s__3 = default(List<NewAmbushConfig>.Enumerator);
			<>8__4 = null;
			<regActivity>5__5 = null;
			<nextParent>5__6 = null;
			<newAmbushObj>5__7 = null;
			<baseComp>5__8 = null;
			<spawnPointsTr>5__9 = null;
			<originalLocations>5__11 = null;
			<newLocations>5__12 = null;
			<>s__13 = default(List<Vector3>.Enumerator);
			<name>5__15 = null;
			<newSpawnPoint>5__16 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Expected O, but got Unknown
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Expected O, but got Unknown
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Expected O, but got Unknown
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(2f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				Log("Adding User Modded Ambushes to existing ones");
				<regAct>5__1 = Il2CppArrayBase<CartelRegionActivities>.op_Implicit((Il2CppArrayBase<CartelRegionActivities>)(object)NetworkSingleton<Cartel>.Instance.Activities.RegionalActivities);
				<i>5__2 = 1;
				if (ambushConfig.addedAmbushes != null && ambushConfig.addedAmbushes.Count > 0)
				{
					<>s__3 = ambushConfig.addedAmbushes.GetEnumerator();
					try
					{
						while (<>s__3.MoveNext())
						{
							<>8__4 = new <>c__DisplayClass45_0();
							<>8__4.config = <>s__3.Current;
							<regActivity>5__5 = ((IEnumerable<CartelRegionActivities>)<regAct>5__1).FirstOrDefault((Func<CartelRegionActivities, bool>)((CartelRegionActivities act) => (int)act.Region == <>8__4.config.mapRegion));
							Log($"  Generating Ambush object {<i>5__2} in region: {<regActivity>5__5.Region}");
							<nextParent>5__6 = ((Component)<regActivity>5__5).transform.Find("Ambush locations");
							<newAmbushObj>5__7 = new GameObject($"AmbushLocation ({<nextParent>5__6.childCount})");
							<baseComp>5__8 = <newAmbushObj>5__7.AddComponent<CartelAmbushLocation>();
							<newAmbushObj>5__7.transform.position = <>8__4.config.ambushPosition;
							<baseComp>5__8.DetectionRadius = <>8__4.config.detectionRadius;
							<spawnPointsTr>5__9 = new GameObject("SpawnPoints");
							<spawnPointsTr>5__9.transform.parent = <newAmbushObj>5__7.transform;
							<baseComp>5__8.AmbushPoints = Il2CppReferenceArray<Transform>.op_Implicit((Transform[])(object)new Transform[<>8__4.config.spawnPoints.Count]);
							<j>5__10 = 0;
							<>s__13 = <>8__4.config.spawnPoints.GetEnumerator();
							try
							{
								while (<>s__13.MoveNext())
								{
									<spawnPoint>5__14 = <>s__13.Current;
									Log($"    - Making Spawn point {<j>5__10}: {<spawnPoint>5__14}");
									<name>5__15 = "SP" + ((<j>5__10 == 0) ? "" : (" (" + <j>5__10 + ")"));
									<newSpawnPoint>5__16 = new GameObject(<name>5__15);
									<newSpawnPoint>5__16.transform.position = <spawnPoint>5__14;
									<newSpawnPoint>5__16.transform.parent = <spawnPointsTr>5__9.transform;
									((Il2CppArrayBase<Transform>)(object)<baseComp>5__8.AmbushPoints)[<j>5__10] = <newSpawnPoint>5__16.transform;
									((Behaviour)<baseComp>5__8).enabled = true;
									<j>5__10++;
									<name>5__15 = null;
									<newSpawnPoint>5__16 = null;
								}
							}
							finally
							{
								((IDisposable)<>s__13).Dispose();
							}
							<>s__13 = default(List<Vector3>.Enumerator);
							<i>5__2++;
							<originalLocations>5__11 = Il2CppArrayBase<CartelAmbushLocation>.op_Implicit((Il2CppArrayBase<CartelAmbushLocation>)(object)<regActivity>5__5.AmbushLocations);
							<newLocations>5__12 = (CartelAmbushLocation[])(object)new CartelAmbushLocation[<originalLocations>5__11.Length + 1];
							Array.Copy(<originalLocations>5__11, <newLocations>5__12, <originalLocations>5__11.Length);
							<newLocations>5__12[<newLocations>5__12.Length - 1] = <baseComp>5__8;
							<regActivity>5__5.AmbushLocations = Il2CppReferenceArray<CartelAmbushLocation>.op_Implicit(<newLocations>5__12);
							<newAmbushObj>5__7.transform.parent = <nextParent>5__6;
							<regActivity>5__5 = null;
							<nextParent>5__6 = null;
							<newAmbushObj>5__7 = null;
							<baseComp>5__8 = null;
							<spawnPointsTr>5__9 = null;
							<originalLocations>5__11 = null;
							<newLocations>5__12 = null;
							<>8__4 = null;
						}
					}
					finally
					{
						((IDisposable)<>s__3).Dispose();
					}
					<>s__3 = default(List<NewAmbushConfig>.Enumerator);
					Log("Done adding User Modded Ambushes");
				}
				else
				{
					Log("No User Added Ambushes found");
				}
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <AfterAmbushInitComplete>d__36 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <AfterAmbushInitComplete>d__36(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = MelonCoroutines.Start(PopulateParameterMap());
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>2__current = MelonCoroutines.Start(ApplyInfluenceConfig());
				<>1__state = 2;
				return true;
			case 2:
			{
				<>1__state = -1;
				coros.Add(MelonCoroutines.Start(TickOverrideHourPass()));
				Log("Adding HourPass Function to callbacks");
				TimeManager instance = NetworkSingleton<TimeManager>.Instance;
				instance.onHourPass += Action.op_Implicit((Action)OnHourPassReduceCartelRegActHours);
				if (currentConfig.debugMode)
				{
					<>2__current = MelonCoroutines.Start(SpawnAmbushAreaVisual());
					<>1__state = 3;
					return true;
				}
				break;
			}
			case 3:
				<>1__state = -1;
				break;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <ApplyAdrenalineRush>d__60 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public CartelGoon goon;

		private float <origWalk>5__1;

		private float <origRun>5__2;

		private int <i>5__3;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ApplyAdrenalineRush>d__60(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<origWalk>5__1 = ((NPC)goon).Movement.WalkSpeed;
				<origRun>5__2 = ((NPC)goon).Movement.RunSpeed;
				((NPC)goon).Movement.WalkSpeed = ((NPC)goon).Movement.WalkSpeed * 3.3f;
				((NPC)goon).Movement.RunSpeed = ((NPC)goon).Movement.RunSpeed * 2.5f;
				((NPC)goon).Movement.MoveSpeedMultiplier = 1.6f;
				((NPC)goon).Health.Health = Mathf.Round(Mathf.Lerp(((NPC)goon).Health.Health, 100f, 0.4f));
				<i>5__3 = 0;
				break;
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				((NPC)goon).Movement.WalkSpeed = Mathf.Lerp(((NPC)goon).Movement.WalkSpeed, <origWalk>5__1, 0.035f);
				((NPC)goon).Movement.RunSpeed = Mathf.Lerp(((NPC)goon).Movement.RunSpeed, <origRun>5__2, 0.035f);
				((NPC)goon).Movement.MoveSpeedMultiplier = Mathf.Lerp(((NPC)goon).Movement.MoveSpeedMultiplier, 1f, 0.06f);
				<i>5__3++;
				break;
			}
			if (<i>5__3 < 15)
			{
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 1;
				return true;
			}
			((NPC)goon).Movement.WalkSpeed = <origWalk>5__1;
			((NPC)goon).Movement.RunSpeed = <origRun>5__2;
			((NPC)goon).Movement.MoveSpeedMultiplier = 1f;
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <ApplyGameDefaultAmbush>d__44 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		private CartelRegionActivities[] <regAct>5__1;

		private int <i>5__2;

		private CartelRegionActivities[] <>s__3;

		private int <>s__4;

		private CartelRegionActivities <act>5__5;

		private IEnumerator<CartelAmbushLocation> <>s__6;

		private CartelAmbushLocation <loc>5__7;

		private List<Vector3> <defaultData>5__8;

		private NewAmbushConfig <loadedConfig>5__9;

		private int <j>5__10;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ApplyGameDefaultAmbush>d__44(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<regAct>5__1 = null;
			<>s__3 = null;
			<act>5__5 = null;
			<>s__6 = null;
			<loc>5__7 = null;
			<defaultData>5__8 = null;
			<loadedConfig>5__9 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(5f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				ambushConfig = ConfigLoader.LoadAmbushConfig();
				gameDefaultAmbush = ConfigLoader.LoadDefaultAmbushConfig();
				Log("Loaded Ambush Config Data");
				<regAct>5__1 = Il2CppArrayBase<CartelRegionActivities>.op_Implicit(Object.FindObjectsOfType<CartelRegionActivities>(true));
				Log("Applying Game Defaults Cartel Ambushes");
				<i>5__2 = 0;
				<>s__3 = <regAct>5__1;
				for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++)
				{
					<act>5__5 = <>s__3[<>s__4];
					<>s__6 = ((Il2CppArrayBase<CartelAmbushLocation>)(object)<act>5__5.AmbushLocations).GetEnumerator();
					try
					{
						while (<>s__6.MoveNext())
						{
							<loc>5__7 = <>s__6.Current;
							<defaultData>5__8 = ((IEnumerable<Transform>)<loc>5__7.AmbushPoints).Select((Transform tr) => tr.position).ToList();
							<loadedConfig>5__9 = gameDefaultAmbush.addedAmbushes.ElementAt(<i>5__2);
							Log($"  Checking Default Ambush {<i>5__2}");
							<i>5__2++;
							if (<loadedConfig>5__9.spawnPoints.Count != <defaultData>5__8.Count)
							{
								Log("    - SpawnPoints count diff Skipping");
								continue;
							}
							if (((Component)<loc>5__7).transform.position != <loadedConfig>5__9.ambushPosition)
							{
								Log("    - Changing Default ambush position");
								((Component)<loc>5__7).transform.position = <loadedConfig>5__9.ambushPosition;
							}
							if (<loc>5__7.DetectionRadius != <loadedConfig>5__9.detectionRadius)
							{
								Log("    - Override default detection radius");
								<loc>5__7.DetectionRadius = <loadedConfig>5__9.detectionRadius;
							}
							<j>5__10 = 0;
							while (<j>5__10 < <loadedConfig>5__9.spawnPoints.Count)
							{
								if (<loadedConfig>5__9.spawnPoints[<j>5__10] != <defaultData>5__8[<j>5__10])
								{
									Log("    - Override default ambush spawn points");
									((Il2CppArrayBase<Transform>)(object)<loc>5__7.AmbushPoints)[<j>5__10].position = <loadedConfig>5__9.spawnPoints[<j>5__10];
								}
								<j>5__10++;
							}
							<defaultData>5__8 = null;
							<loadedConfig>5__9 = null;
							<loc>5__7 = null;
						}
					}
					finally
					{
						if (<>s__6 != null)
						{
							<>s__6.Dispose();
						}
					}
					<>s__6 = null;
					<act>5__5 = null;
				}
				<>s__3 = null;
				Log("Done Applying Game Default Ambushes");
				<>2__current = null;
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <ApplyInfluenceConfig>d__55 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		private CartelActivities <instanceActivities>5__1;

		private CartelRegionActivities[] <regAct>5__2;

		private Enumerator<CartelActivity> <>s__3;

		private CartelActivity <act>5__4;

		private float <result>5__5;

		private CartelRegionActivities[] <>s__6;

		private int <>s__7;

		private CartelRegionActivities <act>5__8;

		private Enumerator<CartelActivity> <>s__9;

		private CartelActivity <activity>5__10;

		private float <result>5__11;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ApplyInfluenceConfig>d__55(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<instanceActivities>5__1 = null;
			<regAct>5__2 = null;
			<>s__3 = null;
			<act>5__4 = null;
			<>s__6 = null;
			<act>5__8 = null;
			<>s__9 = null;
			<activity>5__10 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(2f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				if (currentConfig.activityInfluenceMin != 0f)
				{
					Log("Changing Activity Influence Requirements");
					<instanceActivities>5__1 = NetworkSingleton<Cartel>.Instance.Activities;
					<>s__3 = <instanceActivities>5__1.GlobalActivities.GetEnumerator();
					while (<>s__3.MoveNext())
					{
						<act>5__4 = <>s__3.Current;
						<result>5__5 = 0f;
						if (currentConfig.activityInfluenceMin > 0f && <act>5__4.InfluenceRequirement > 0f)
						{
							<result>5__5 = Mathf.Lerp(<act>5__4.InfluenceRequirement, 1f, currentConfig.activityInfluenceMin);
						}
						else
						{
							<result>5__5 = Mathf.Lerp(<act>5__4.InfluenceRequirement, 0f, 0f - currentConfig.activityInfluenceMin);
						}
						Log($"Changing Global Activity Influence from {<act>5__4.InfluenceRequirement} to {<result>5__5}");
						<act>5__4.InfluenceRequirement = <result>5__5;
						<act>5__4 = null;
					}
					<>s__3 = null;
					<regAct>5__2 = Il2CppArrayBase<CartelRegionActivities>.op_Implicit(Object.FindObjectsOfType<CartelRegionActivities>(true));
					<>s__6 = <regAct>5__2;
					for (<>s__7 = 0; <>s__7 < <>s__6.Length; <>s__7++)
					{
						<act>5__8 = <>s__6[<>s__7];
						<>s__9 = <act>5__8.Activities.GetEnumerator();
						while (<>s__9.MoveNext())
						{
							<activity>5__10 = <>s__9.Current;
							<result>5__11 = 0f;
							if (currentConfig.activityInfluenceMin > 0f && <activity>5__10.InfluenceRequirement > 0f)
							{
								<result>5__11 = Mathf.Lerp(<activity>5__10.InfluenceRequirement, 1f, currentConfig.activityInfluenceMin);
							}
							else
							{
								<result>5__11 = Mathf.Lerp(<activity>5__10.InfluenceRequirement, 0f, 0f - currentConfig.activityInfluenceMin);
							}
							Log($"Changing Regional Activity Influence from {<activity>5__10.InfluenceRequirement} to {<result>5__11}");
							<activity>5__10.InfluenceRequirement = <result>5__11;
							<activity>5__10 = null;
						}
						<>s__9 = null;
						<act>5__8 = null;
					}
					<>s__6 = null;
					<instanceActivities>5__1 = null;
					<regAct>5__2 = null;
				}
				Log("Finished changing Activity Influence Requirements");
				<>2__current = null;
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <BeginDriveBy>d__64 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public DriveByTrigger trig;

		private Player <player>5__1;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <BeginDriveBy>d__64(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<player>5__1 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
			{
				<>1__state = -1;
				if (driveByActive || !registered)
				{
					return false;
				}
				driveByActive = true;
				Log("[DRIVE BY] Beginning Drive By Event");
				float num = default(float);
				<player>5__1 = Player.GetClosestPlayer(trig.triggerPosition, ref num, (List<Player>)null);
				driveByVeh.ExitPark_Networked((NetworkConnection)null, false);
				<>2__current = (object)new WaitForSeconds(0.1f);
				<>1__state = 1;
				return true;
			}
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				driveByVeh.SetTransform_Server(trig.startPosition, Quaternion.Euler(trig.spawnEulerAngles));
				<>2__current = (object)new WaitForSeconds(0.1f);
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				driveByTp.MoveToRoadNetwork(false);
				<>2__current = (object)new WaitForSeconds(0.1f);
				<>1__state = 3;
				return true;
			case 3:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				driveByAgent.Navigate(trig.endPosition, (NavigationSettings)null, NavigationCallback.op_Implicit((Action<ENavigationResult>)DriveByNavComplete));
				driveByAgent.AutoDriving = true;
				((Component)thomasInstance).gameObject.SetActive(true);
				coros.Add(MelonCoroutines.Start(DriveByShooting(<player>5__1)));
				<>2__current = null;
				<>1__state = 4;
				return true;
			case 4:
				<>1__state = -1;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <BeginIntercept>d__78 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public CartelDealer dealer;

		public Contract contract;

		public Customer customer;

		public EMapRegion region;

		public NPCEvent_StayInBuilding ev1;

		public NPCSignal_HandleDeal ev2;

		public string cGuid;

		private <>c__DisplayClass78_0 <>8__1;

		private List<EMapRegion> <mapReg>5__2;

		private Enumerator<EMapRegion> <>s__3;

		private EMapRegion <unlmapReg>5__4;

		private int <i>5__5;

		private List<ItemInstance> <fromPool>5__6;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <BeginIntercept>d__78(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>8__1 = null;
			<mapReg>5__2 = null;
			<>s__3 = null;
			<fromPool>5__6 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>8__1 = new <>c__DisplayClass78_0();
				<>8__1.dealer = dealer;
				<>8__1.customer = customer;
				<>8__1.region = region;
				<>8__1.cGuid = cGuid;
				<>8__1.ev2 = ev2;
				<>8__1.ev1 = ev1;
				<>8__1.contract = contract;
				<>2__current = (object)new WaitForSeconds(Random.Range(10f, 30f));
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				<mapReg>5__2 = new List<EMapRegion>();
				<>s__3 = Singleton<Map>.Instance.GetUnlockedRegions().GetEnumerator();
				while (<>s__3.MoveNext())
				{
					<unlmapReg>5__4 = <>s__3.Current;
					<mapReg>5__2.Add(<unlmapReg>5__4);
				}
				<>s__3 = null;
				<>8__1.changeInfluence = false;
				if (InstanceFinder.IsServer && <mapReg>5__2.Contains(<>8__1.region))
				{
					<>8__1.changeInfluence = true;
				}
				if ((Object)(object)<>8__1.customer.CurrentContract == (Object)null)
				{
					if (<>8__1.changeInfluence)
					{
						NetworkSingleton<Cartel>.Instance.Influence.ChangeInfluence(<>8__1.region, -0.1f);
					}
					contractGuids.Remove(<>8__1.cGuid);
					interceptingDeal = false;
					return false;
				}
				((Quest)<>8__1.contract).BopHUDUI();
				((Quest)<>8__1.contract).CompletionXP = Mathf.RoundToInt((float)((Quest)<>8__1.contract).CompletionXP * 0.5f);
				<>8__1.contract.completedContractsIncremented = false;
				<i>5__5 = 0;
				while (<i>5__5 < ((NPC)<>8__1.dealer).Inventory.ItemSlots.Count)
				{
					if (((NPC)<>8__1.dealer).Inventory.ItemSlots[<i>5__5].ItemInstance == null)
					{
						<fromPool>5__6 = GetFromPool(1);
						if (<fromPool>5__6.Count > 0)
						{
							((NPC)<>8__1.dealer).Inventory.ItemSlots[<i>5__5].ItemInstance = <fromPool>5__6[0];
						}
						<fromPool>5__6 = null;
					}
					<i>5__5++;
				}
				((Quest)<>8__1.contract).onQuestEnd.AddListener(UnityAction<EQuestState>.op_Implicit((Action<EQuestState>)<>8__1.<BeginIntercept>g__OnQuestEndEvaluateResult|0));
				<>8__1.dealer.SetIsAcceptingDeals(true);
				((Dealer)<>8__1.dealer).AddContract(<>8__1.contract);
				if ((Object)(object)<>8__1.ev1 != (Object)null)
				{
					((NPCAction)<>8__1.ev1).StartTime = 402;
					((NPCEvent)<>8__1.ev1).EndTime = 1800;
					((NPCAction)<>8__1.ev1).End();
					((NPCAction)<>8__1.ev1).HasStarted = false;
					((Behaviour)<>8__1.ev1).enabled = false;
				}
				if ((Object)(object)<>8__1.ev2 != (Object)null)
				{
					((NPCAction)<>8__1.ev2).Started();
					((NPCAction)<>8__1.ev2).HasStarted = true;
					((Component)<>8__1.ev2).gameObject.SetActive(true);
				}
				((Dealer)<>8__1.dealer).CheckAttendStart();
				if ((Object)(object)<>8__1.customer.CurrentContract != (Object)null && (Object)(object)<>8__1.customer.CurrentContract.Dealer != (Object)null)
				{
					<>8__1.customer.CurrentContract.Dealer = null;
				}
				<>2__current = null;
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <CartelStealsItems>d__74 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public List<ItemInstance> items;

		public Action cb;

		private object <>s__1;

		private bool <>s__2;

		private int <i>5__3;

		private int <realQty>5__4;

		private QualityItemInstance <tempQt>5__5;

		private int <foundIdx>5__6;

		private ProductItemInstance <pTemp>5__7;

		private int <j>5__8;

		private string <>s__9;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <CartelStealsItems>d__74(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>s__1 = null;
			<tempQt>5__5 = null;
			<pTemp>5__7 = null;
			<>s__9 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00f1: 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)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>s__1 = cartelItemLock;
				<>s__2 = false;
				try
				{
					Monitor.Enter(<>s__1, ref <>s__2);
					Log("[CARTEL INV] Lock Acquired");
					<i>5__3 = 0;
					while (<i>5__3 < items.Count)
					{
						<realQty>5__4 = 1;
						<tempQt>5__5 = ((Il2CppObjectBase)items[<i>5__3]).TryCast<QualityItemInstance>();
						if (<tempQt>5__5 != null)
						{
							<foundIdx>5__6 = -1;
							if (cartelStolenItems.Count > 0)
							{
								<j>5__8 = 0;
								while (<j>5__8 < cartelStolenItems.Count)
								{
									if (((ItemInstance)cartelStolenItems[<j>5__8]).ID == ((ItemInstance)<tempQt>5__5).ID && cartelStolenItems[<j>5__8].Quality == <tempQt>5__5.Quality)
									{
										<foundIdx>5__6 = <j>5__8;
										Log("[CARTEL INV]    Item Already exists, append");
										break;
									}
									<j>5__8++;
								}
							}
							<pTemp>5__7 = ((Il2CppObjectBase)items[<i>5__3]).TryCast<ProductItemInstance>();
							if (<pTemp>5__7 != null && <pTemp>5__7.PackagingID != null)
							{
								string packagingID = <pTemp>5__7.PackagingID;
								<>s__9 = packagingID;
								string text = <>s__9;
								if (!(text == "jar"))
								{
									if (text == "brick")
									{
										<realQty>5__4 = 20;
									}
									else
									{
										<realQty>5__4 = 1;
									}
								}
								else
								{
									<realQty>5__4 = 5;
								}
								<>s__9 = null;
								Log($"[CARTEL INV]   Real Qty: {((ItemInstance)<pTemp>5__7).ID} = {<realQty>5__4}");
							}
							if (<foundIdx>5__6 >= 0)
							{
								Log($"[CARTEL INV]    EXISTS ADD: {items[<i>5__3].Name}x{((ItemInstance)<tempQt>5__5).Quantity * <realQty>5__4}");
								QualityItemInstance obj = cartelStolenItems[<foundIdx>5__6];
								((ItemInstance)obj).Quantity = ((ItemInstance)obj).Quantity + ((ItemInstance)<tempQt>5__5).Quantity * <realQty>5__4;
							}
							else
							{
								Log($"[CARTEL INV]    ADD: {items[<i>5__3].Name}x{((ItemInstance)<tempQt>5__5).Quantity * <realQty>5__4}");
								((ItemInstance)<tempQt>5__5).Quantity = ((ItemInstance)<tempQt>5__5).Quantity * <realQty>5__4;
								cartelStolenItems.Add(<tempQt>5__5);
							}
							<pTemp>5__7 = null;
						}
						<tempQt>5__5 = null;
						<i>5__3++;
					}
				}
				finally
				{
					if (<>s__2)
					{
						Monitor.Exit(<>s__1);
					}
				}
				<>s__1 = null;
				Log("[CARTEL INV] Lock Released");
				if (cb != null)
				{
					cb();
				}
				<>2__current = null;
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <CreateDropContent>d__73 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public DeadDrop entity;

		public List<ItemInstance> filledItems;

		public NPC npc;

		private <>c__DisplayClass73_0 <>8__1;

		private float <duration>5__2;

		private int <i>5__3;

		private Enumerator<EMapRegion> <>s__4;

		private EMapRegion <unlmapReg>5__5;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <CreateDropContent>d__73(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>8__1 = null;
			<>s__4 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Expected O, but got Unknown
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>8__1 = new <>c__DisplayClass73_0();
				<>8__1.entity = entity;
				<>2__current = (object)new WaitForSeconds(5f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				Log("[MINI QUEST]    MiniQuest Drop at: " + <>8__1.entity.DeadDropName);
				<i>5__3 = 0;
				while (<i>5__3 < filledItems.Count)
				{
					((StorageEntity)<>8__1.entity.Storage).InsertItem(filledItems[<i>5__3], true);
					Log($"[MINI QUEST]    MiniQuest Reward: {filledItems[<i>5__3].Name} x {filledItems[<i>5__3].Quantity}");
					<i>5__3++;
				}
				<>8__1.mapReg = new List<EMapRegion>();
				<>s__4 = Singleton<Map>.Instance.GetUnlockedRegions().GetEnumerator();
				while (<>s__4.MoveNext())
				{
					<unlmapReg>5__5 = <>s__4.Current;
					<>8__1.mapReg.Add(<unlmapReg>5__5);
				}
				<>s__4 = null;
				<>8__1.opened = false;
				<>8__1.onOpenedAction = null;
				<>8__1.onOpenedAction = UnityAction.op_Implicit((Action)<>8__1.<CreateDropContent>g__WrapOnOpenCallback|0);
				((StorageEntity)<>8__1.entity.Storage).onOpened.AddListener(<>8__1.onOpenedAction);
				<duration>5__2 = Random.Range(60f, 120f);
				<>2__current = (object)new WaitForSeconds(<duration>5__2);
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				if (!<>8__1.opened)
				{
					if (InstanceFinder.IsServer && <>8__1.mapReg.Contains(<>8__1.entity.Region))
					{
						NetworkSingleton<Cartel>.Instance.Influence.ChangeInfluence(<>8__1.entity.Region, 0.05f);
					}
					((StorageEntity)<>8__1.entity.Storage).ClearContents();
				}
				((StorageEntity)<>8__1.entity.Storage).onOpened.RemoveListener(<>8__1.onOpenedAction);
				Log($"[MINI QUEST] Removed MiniQuest Reward. Quest Duration: {<duration>5__2}");
				<>2__current = null;
				<>1__state = 3;
				return true;
			case 3:
				<>1__state = -1;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <DespawnSoon>d__58 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public CartelGoon goon;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <DespawnSoon>d__58(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(60f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				if (!((Behaviour)((NPC)goon).Behaviour.CombatBehaviour).enabled)
				{
					((Behaviour)((NPC)goon).Behaviour.CombatBehaviour).Enable_Networked((NetworkConnection)null);
				}
				if (((NPC)goon).IgnoreImpacts)
				{
					((NPC)goon).IgnoreImpacts = false;
				}
				if (goon.IsGoonSpawned)
				{
					Log("[TRY ROB]    Despawned Goon");
					goon.Despawn();
				}
				<>2__current = null;
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <DisposeChoice>d__72 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public DialogueController controller;

		public NPC npc;

		private List<DialogueChoice> <oldChoices>5__1;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <DisposeChoice>d__72(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<oldChoices>5__1 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(0.4f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				<oldChoices>5__1 = controller.Choices;
				<oldChoices>5__1.RemoveAt(<oldChoices>5__1.Count - 1);
				controller.Choices = <oldChoices>5__1;
				Log("[MINI QUEST]    Disposed Choice");
				<>2__current = null;
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <DriveByShooting>d__65 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public Player player;

		private float <distToPlayer>5__1;

		private int <maxBulletsShot>5__2;

		private int <bulletsShot>5__3;

		private int <playerLayer>5__4;

		private int <obstacleLayerMask>5__5;

		private Transform <thomasTransform>5__6;

		private Vector3 <offsetPosition>5__7;

		private Vector3 <toPlayer>5__8;

		private float <angleToPlayer>5__9;

		private bool <wepHits>5__10;

		private RaycastHit[] <hits>5__11;

		private RaycastHit[] <>s__12;

		private int <>s__13;

		private RaycastHit <hit>5__14;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <DriveByShooting>d__65(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<thomasTransform>5__6 = null;
			<hits>5__11 = null;
			<>s__12 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//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_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<maxBulletsShot>5__2 = Random.Range(4, 9);
				<bulletsShot>5__3 = 0;
				((NPC)thomasInstance).Behaviour.CombatBehaviour.SetTarget((NetworkConnection)null, ((NetworkBehaviour)player).NetworkObject);
				((NPC)thomasInstance).Behaviour.CombatBehaviour.SetWeaponRaised(true);
				<playerLayer>5__4 = LayerMask.NameToLayer("Player");
				<obstacleLayerMask>5__5 = LayerMask.GetMask(new string[3] { "Terrain", "Default", "Vehicle" });
				goto IL_05f5;
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				if (<bulletsShot>5__3 >= <maxBulletsShot>5__2)
				{
					goto IL_0603;
				}
				<distToPlayer>5__1 = Vector3.Distance(((Component)thomasInstance).transform.position, player.CenterPointTransform.position);
				<thomasTransform>5__6 = ((Component)thomasInstance).transform;
				<offsetPosition>5__7 = <thomasTransform>5__6.position + <thomasTransform>5__6.up * 1.7f - <thomasTransform>5__6.right * 0.8f;
				<toPlayer>5__8 = player.CenterPointTransform.position - <offsetPosition>5__7;
				<angleToPlayer>5__9 = Vector3.SignedAngle(((Component)thomasInstance).transform.forward, <toPlayer>5__8, Vector3.up);
				<wepHits>5__10 = false;
				<hits>5__11 = Il2CppArrayBase<RaycastHit>.op_Implicit((Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(<offsetPosition>5__7, <toPlayer>5__8, 50f));
				Array.Sort(<hits>5__11, (RaycastHit x, RaycastHit y) => ((RaycastHit)(ref x)).distance.CompareTo(((RaycastHit)(ref y)).distance));
				<>s__12 = <hits>5__11;
				for (<>s__13 = 0; <>s__13 < <>s__12.Length; <>s__13++)
				{
					<hit>5__14 = <>s__12[<>s__13];
					if ((<obstacleLayerMask>5__5 & (1 << ((Component)((RaycastHit)(ref <hit>5__14)).collider).gameObject.layer)) != 0)
					{
						<wepHits>5__10 = false;
						break;
					}
					if (((Component)((RaycastHit)(ref <hit>5__14)).collider).gameObject.layer == <playerLayer>5__4)
					{
						<wepHits>5__10 = true;
						break;
					}
				}
				<>s__12 = null;
				Log($"[DRIVE BY]    Angle: {<angleToPlayer>5__9} - Dist: {<distToPlayer>5__1} -  WeaponHits: {<wepHits>5__10}");
				if (<wepHits>5__10)
				{
					if (<angleToPlayer>5__9 < -10f && <angleToPlayer>5__9 > -80f)
					{
						if (<distToPlayer>5__1 < 15f)
						{
							if (Random.Range(0f, 1f) > 0.1f || (<angleToPlayer>5__9 < -20f && <angleToPlayer>5__9 > -80f))
							{
								((NPC)thomasInstance).Behaviour.CombatBehaviour.Shoot();
								<bulletsShot>5__3++;
							}
						}
						else if (<distToPlayer>5__1 < 25f)
						{
							if (Random.Range(0f, 1f) > 0.2f || (<angleToPlayer>5__9 < -25f && <angleToPlayer>5__9 > -70f))
							{
								((NPC)thomasInstance).Behaviour.CombatBehaviour.Shoot();
								<bulletsShot>5__3++;
							}
						}
						else if (<distToPlayer>5__1 < 35f)
						{
							if (Random.Range(0f, 1f) > 0.4f || (<angleToPlayer>5__9 < -30f && <angleToPlayer>5__9 > -60f))
							{
								((NPC)thomasInstance).Behaviour.CombatBehaviour.Shoot();
								<bulletsShot>5__3++;
							}
						}
						else if (<distToPlayer>5__1 < 45f)
						{
							if (Random.Range(0f, 1f) > 0.7f || (<angleToPlayer>5__9 < -40f && <angleToPlayer>5__9 > -80f))
							{
								((NPC)thomasInstance).Behaviour.CombatBehaviour.Shoot();
								<bulletsShot>5__3++;
							}
						}
						else if (<wepHits>5__10 && <angleToPlayer>5__9 < -30f && <angleToPlayer>5__9 > -80f && Random.Range(0f, 1f) > 0.9f)
						{
							((NPC)thomasInstance).Behaviour.CombatBehaviour.Shoot();
							<bulletsShot>5__3++;
						}
					}
					<thomasTransform>5__6 = null;
					<hits>5__11 = null;
				}
				goto IL_05f5;
			case 2:
				{
					<>1__state = -1;
					return false;
				}
				IL_05f5:
				if (driveByActive)
				{
					<>2__current = (object)new WaitForSeconds(Random.Range(0.25f, 0.5f));
					<>1__state = 1;
					return true;
				}
				goto IL_0603;
				IL_0603:
				Log($"[DRIVE BY]    Drive By Bullets shot: {<bulletsShot>5__3}/{<maxBulletsShot>5__2}");
				<>2__current = null;
				<>1__state = 2;
				return true;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <EvaluateCartelIntercepts>d__76 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		private float <frequency>5__1;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <EvaluateCartelIntercepts>d__76(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Invalid comparison between Unknown and I4
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(5f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				Log("Starting Cartel Intercepts Evaluation");
				<frequency>5__1 = 90f;
				if (currentConfig.activityFrequency >= 0f)
				{
					<frequency>5__1 = Mathf.Lerp(<frequency>5__1, 60f, currentConfig.activityFrequency);
				}
				else
				{
					<frequency>5__1 = Mathf.Lerp(<frequency>5__1, 480f, 0f - currentConfig.activityFrequency);
				}
				break;
			case 2:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				if ((NetworkSingleton<TimeManager>.Instance.CurrentTime >= 1800 || NetworkSingleton<TimeManager>.Instance.CurrentTime <= 400) && (int)NetworkSingleton<Cartel>.Instance.Status == 2 && !interceptingDeal)
				{
					coros.Add(MelonCoroutines.Start(StartInterceptDeal()));
				}
				break;
			}
			if (registered)
			{
				<>2__current = (object)new WaitForSeconds(Random.Range(<frequency>5__1, <frequency>5__1 * 2f));
				<>1__state = 2;
				return true;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <EvaluateDriveBy>d__63 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		private float <elapsedSec>5__1;

		private List<DriveByTrigger>.Enumerator <>s__2;

		private DriveByTrigger <trig>5__3;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <EvaluateDriveBy>d__63(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			int num = <>1__state;
			if (num == -3 || num == 5)
			{
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
			}
			<>s__2 = default(List<DriveByTrigger>.Enumerator);
			<trig>5__3 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Invalid comparison between Unknown and I4
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: 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_00e8: Expected O, but got Unknown
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Expected O, but got Unknown
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Expected O, but got Unknown
			bool result;
			try
			{
				switch (<>1__state)
				{
				default:
					result = false;
					break;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(5f);
					<>1__state = 1;
					result = true;
					break;
				case 1:
					<>1__state = -1;
					if (!registered)
					{
						result = false;
						break;
					}
					if (!InstanceFinder.NetworkManager.IsServer)
					{
						Log("Not Server instance, returning from Drive By Evaluation");
						result = false;
						break;
					}
					Log("Starting Drive By Evaluation");
					<elapsedSec>5__1 = 0f;
					goto IL_036c;
				case 2:
					<>1__state = -1;
					<elapsedSec>5__1 += 2f;
					if (!registered)
					{
						result = false;
						break;
					}
					if ((int)NetworkSingleton<Cartel>.Instance.Status != 2 || driveByActive)
					{
						<>2__current = (object)new WaitForSeconds(60f);
						<>1__state = 3;
						result = true;
						break;
					}
					if (driveByActive)
					{
						<>2__current = (object)new WaitForSeconds(60f);
						<>1__state = 4;
						result = true;
						break;
					}
					if (<elapsedSec>5__1 >= 60f)
					{
						if (hoursUntilDriveBy != 0)
						{
							hoursUntilDriveBy--;
						}
						<elapsedSec>5__1 -= 60f;
					}
					if ((NetworkSingleton<TimeManager>.Instance.CurrentTime >= 2230 || NetworkSingleton<TimeManager>.Instance.CurrentTime <= 500) && hoursUntilDriveBy <= 0)
					{
						<>s__2 = driveByLocations.GetEnumerator();
						<>1__state = -3;
						goto IL_0304;
					}
					<>2__current = (object)new WaitForSeconds(30f);
					<>1__state = 6;
					result = true;
					break;
				case 3:
					<>1__state = -1;
					goto IL_036c;
				case 4:
					<>1__state = -1;
					<elapsedSec>5__1 += 60f;
					goto IL_036c;
				case 5:
					<>1__state = -3;
					<elapsedSec>5__1 += 0.5f;
					if (!registered)
					{
						result = false;
						<>m__Finally1();
						break;
					}
					if (Vector3.Distance(Player.Local.CenterPointTransform.position, <trig>5__3.triggerPosition) <= <trig>5__3.radius)
					{
						coros.Add(MelonCoroutines.Start(BeginDriveBy(<trig>5__3)));
					}
					<trig>5__3 = null;
					goto IL_0304;
				case 6:
					<>1__state = -1;
					<elapsedSec>5__1 += 30f;
					goto IL_036c;
				case 7:
					{
						<>1__state = -1;
						result = false;
						break;
					}
					IL_0304:
					if (<>s__2.MoveNext())
					{
						<trig>5__3 = <>s__2.Current;
						<>2__current = (object)new WaitForSeconds(0.5f);
						<>1__state = 5;
						result = true;
						break;
					}
					<>m__Finally1();
					<>s__2 = default(List<DriveByTrigger>.Enumerator);
					goto IL_036c;
					IL_036c:
					if (registered)
					{
						<>2__current = (object)new WaitForSeconds(2f);
						<>1__state = 2;
						result = true;
					}
					else
					{
						<>2__current = null;
						<>1__state = 7;
						result = true;
					}
					break;
				}
			}
			catch
			{
				//try-fault
				((IDisposable)this).Dispose();
				throw;
			}
			return result;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		private void <>m__Finally1()
		{
			<>1__state = -1;
			((IDisposable)<>s__2).Dispose();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <EvaluateMiniQuestCreation>d__69 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		private List<NPC> <listOf>5__1;

		private NPC <random>5__2;

		private float <chance>5__3;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <EvaluateMiniQuestCreation>d__69(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<listOf>5__1 = null;
			<random>5__2 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				Log("Starting Mini Quest Dialogue Random Generation");
				break;
			case 1:
				<>1__state = -1;
				<listOf>5__1 = null;
				<random>5__2 = null;
				break;
			}
			if (registered)
			{
				Log("[MINI QUEST] Try Generate");
				<listOf>5__1 = targetNPCs.Keys.ToList();
				<random>5__2 = <listOf>5__1[Random.Range(0, <listOf>5__1.Count)];
				if (targetNPCs.ContainsKey(<random>5__2) && !targetNPCs[<random>5__2].HasActiveQuest && !targetNPCs[<random>5__2].HasAskedQuestToday)
				{
					<chance>5__3 = 1f;
					if (!<random>5__2.RelationData.Unlocked)
					{
						<chance>5__3 = Random.Range(0f, 1f);
					}
					if (<chance>5__3 > 0.7f)
					{
						targetNPCs[<random>5__2].HasActiveQuest = true;
						InitMiniQuestDialogue(<random>5__2);
					}
				}
				<>2__current = (object)new WaitForSeconds(Random.Range(480f, 960f));
				<>1__state = 1;
				return true;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <FetchUIElementsInit>d__79 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		private RectTransform <rt>5__1;

		private int <i>5__2;

		private Transform <msgItem>5__3;

		private Transform <nameTr>5__4;

		private Text <text>5__5;

		private Transform <iconMask>5__6;

		private Transform <icon>5__7;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <FetchUIElementsInit>d__79(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<rt>5__1 = null;
			<msgItem>5__3 = null;
			<nameTr>5__4 = null;
			<text>5__5 = null;
			<iconMask>5__6 = null;
			<icon>5__7 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(10f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				<rt>5__1 = PlayerSingleton<MessagesApp>.Instance.conversationEntryContainer;
				if ((Object)(object)<rt>5__1 == (Object)null)
				{
					Log("Conversation entry container is null");
					return false;
				}
				for (<i>5__2 = 0; <i>5__2 < ((Transform)<rt>5__1).childCount && <i>5__2 <= ((Transform)<rt>5__1).childCount; <i>5__2++)
				{
					<msgItem>5__3 = ((Transform)<rt>5__1).GetChild(<i>5__2);
					if ((Object)(object)<msgItem>5__3 != (Object)null)
					{
						<nameTr>5__4 = <msgItem>5__3.Find("Name");
						if ((Object)(object)<nameTr>5__4 != (Object)null && (Object)(object)((Component)<nameTr>5__4).gameObject != (Object)null)
						{
							<text>5__5 = ((Component)<nameTr>5__4).gameObject.GetComponent<Text>();
							if (!((Object)(object)<text>5__5 != (Object)null) || !(<text>5__5.text == "Thomas Benzies"))
							{
								continue;
							}
							<iconMask>5__6 = <msgItem>5__3.Find("IconMask");
							if ((Object)(object)<iconMask>5__6 != (Object)null)
							{
								<icon>5__7 = <iconMask>5__6.Find("Icon");
								if ((Object)(object)<icon>5__7 != (Object)null && (Object)(object)((Component)<icon>5__7).gameObject != (Object)null)
								{
									benziesLogo = ((Component)<icon>5__7).gameObject.GetComponent<Image>().sprite;
									Log("Benzies Logo Assigned");
								}
								<icon>5__7 = null;
							}
							<iconMask>5__6 = null;
							<text>5__5 = null;
						}
						else
						{
							Log("NameTr is null");
						}
						<nameTr>5__4 = null;
					}
					else
					{
						Log("Msg Item is Null");
					}
					<msgItem>5__3 = null;
				}
				Log("Fetched Benzies Logo UI Element");
				<>2__current = null;
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <HelperSet>d__54 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public HrPassParameterMap hpmap;

		private float <ticksReqForPass>5__1;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <HelperSet>d__54(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(0.1f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				if (!registered)
				{
					return false;
				}
				if (!hpmap.CanPassHour())
				{
					return false;
				}
				if (!InstanceFinder.IsServer)
				{
					return false;
				}
				if (!registered)
				{
					return false;
				}
				if (currentConfig.activityFrequency > 0f)
				{
					hpmap.HourPassAction();
				}
				else
				{
					if (hpmap.Getter() < 2)
					{
						return false;
					}
					<ticksReqForPass>5__1 = Mathf.Lerp(1f, 10f, 0f - currentConfig.activityFrequency);
					if (hpmap.Getter() < hpmap.currentModHours)
					{
						hpmap.Setter(hpmap.currentModHours);
					}
					else
					{
						hpmap.modTicksPassed = 0;
						hpmap.currentModHours = hpmap.Getter();
					}
					hpmap.modTicksPassed++;
					if ((float)hpmap.modTicksPassed >= <ticksReqForPass>5__1)
					{
						hpmap.HourPassAction();
						hpmap.modTicksPassed = 0;
						hpmap.currentModHours -= 1;
					}
				}
				<>2__current = null;
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -