Decompiled source of All Your Clients Will Order v1.54.0

AllYourClientsWillOrder.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json;
using System.Text.RegularExpressions;
using AllYourClientsWillOrder;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppScheduleOne.DevUtilities;
using Il2CppScheduleOne.Economy;
using Il2CppScheduleOne.GameTime;
using Il2CppScheduleOne.ItemFramework;
using Il2CppScheduleOne.PlayerScripts;
using Il2CppScheduleOne.Product;
using Il2CppScheduleOne.Quests;
using Il2CppScheduleOne.UI.Handover;
using Il2CppScheduleOne.UI.Phone;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using MelonLoader.Utils;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(AllYourClientsWillOrderMod), "All Your Clients Will Order", "1.54.0", "ionutbuzz", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("AllYourClientsWillOrder")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AllYourClientsWillOrder")]
[assembly: AssemblyTitle("AllYourClientsWillOrder")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AllYourClientsWillOrder;

public class AllYourClientsWillOrderMod : MelonMod
{
	private KeyCode forceOrderKey = (KeyCode)112;

	private KeyCode autoTransferKey = (KeyCode)114;

	private bool showHUD;

	private Rect hudWindowRect = new Rect(100f, 100f, 320f, 400f);

	private bool isDragging;

	private Vector2 dragOffset;

	private Rect infoHudRect = new Rect(20f, 200f, 280f, 150f);

	private bool infoHudDragging;

	private Vector2 infoHudDragOffset;

	private bool showProductCounter = true;

	private bool showClock;

	private bool showDealCounter;

	private string configPath;

	private bool capturingForceOrderKey;

	private bool capturingAutoTransferKey;

	private GUIStyle infoBoxStyle;

	private GUIStyle infoHudStyle;

	private GUIStyle infoHudTitleStyle;

	private GUIStyle infoHudContentStyle;

	private GUIStyle clockStyle;

	private GUIStyle productStyle;

	private GUIStyle dealCounterStyle;

	private GUIStyle notificationStyle;

	private bool stylesInitialized;

	private GUIStyle hudV2HeaderStyle;

	private Texture2D hudV2BgTex;

	private Texture2D hudV2HeaderTex;

	private Texture2D hudV2SeparatorTex;

	private Texture2D hudV2SectionBgTex;

	private Texture2D hudV2AccentTex;

	private Dictionary<string, int> cachedProductRequirements = new Dictionary<string, int>();

	private float lastRequirementsUpdate;

	private const float REQUIREMENTS_UPDATE_INTERVAL = 0.5f;

	private int cachedActiveDealCount;

	private string notificationMessage = "";

	private float notificationEndTime;

	private Color notificationColor = Color.white;

	private const float NOTIFICATION_DURATION = 3f;

	private bool isAutoTransferRunning;

	private bool phoneAppInjected;

	private GameObject phoneAppButton;

	private Sprite modAppIconSprite;

	private TimeManager cachedTimeManager;

	private bool timeManagerSearched;

	private bool timeValuesLogged;

	public override void OnInitializeMelon()
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		configPath = Path.Combine(MelonEnvironment.UserDataDirectory, "AllYourClientsWillOrder.json");
		MigrateOldConfig();
		LoadConfig();
		MelonLogger.Msg("All Your Clients Will Order v1.54.0 loaded!");
		MelonLogger.Msg($"Force Order Key: {forceOrderKey}, Auto Transfer Key: {autoTransferKey}");
		MelonLogger.Msg("Open settings via the phone app (AYCWO icon on home screen)");
	}

	public override void OnUpdate()
	{
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Invalid comparison between Unknown and I4
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Invalid comparison between Unknown and I4
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Invalid comparison between Unknown and I4
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		if (capturingForceOrderKey || capturingAutoTransferKey)
		{
			foreach (KeyCode value in Enum.GetValues(typeof(KeyCode)))
			{
				if ((int)value != 0 && (int)value != 323 && (int)value != 324 && (int)value != 325 && Input.GetKeyDown(value))
				{
					if ((int)value == 27)
					{
						capturingForceOrderKey = false;
						capturingAutoTransferKey = false;
					}
					else if (capturingForceOrderKey)
					{
						forceOrderKey = value;
						capturingForceOrderKey = false;
						SaveConfig();
						MelonLogger.Msg($"Force Order Key set to: {forceOrderKey}");
					}
					else if (capturingAutoTransferKey)
					{
						autoTransferKey = value;
						capturingAutoTransferKey = false;
						SaveConfig();
						MelonLogger.Msg($"Auto Transfer Key set to: {autoTransferKey}");
					}
					break;
				}
			}
			return;
		}
		if (!phoneAppInjected)
		{
			TryInjectPhoneApp();
		}
		if (Input.GetKeyDown(forceOrderKey) && !showHUD)
		{
			ForceAllPlayerClientsToOrder();
		}
		if (Input.GetKeyDown(autoTransferKey) && !showHUD)
		{
			TryAutoTransfer();
		}
	}

	private Sprite CreateModIconSprite()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Expected O, but got Unknown
		//IL_0412: Unknown result type (might be due to invalid IL or missing references)
		//IL_0421: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0393: Unknown result type (might be due to invalid IL or missing references)
		//IL_0398: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)modAppIconSprite != (Object)null)
		{
			return modAppIconSprite;
		}
		int num = 128;
		Texture2D val = new Texture2D(num, num, (TextureFormat)4, false);
		((Texture)val).filterMode = (FilterMode)1;
		((Texture)val).wrapMode = (TextureWrapMode)1;
		Color[] array = (Color[])(object)new Color[num * num];
		Color val2 = default(Color);
		((Color)(ref val2))..ctor(0.85f, 0.1f, 0.45f, 1f);
		Color val3 = default(Color);
		((Color)(ref val3))..ctor(0.55f, 0.05f, 0.3f, 1f);
		Color val4 = default(Color);
		((Color)(ref val4))..ctor(1f, 1f, 1f, 1f);
		Color val5 = default(Color);
		((Color)(ref val5))..ctor(0.3f, 0.02f, 0.15f, 1f);
		float num2 = 20f;
		for (int i = 0; i < num; i++)
		{
			for (int j = 0; j < num; j++)
			{
				float num3 = 0f;
				float num4 = 0f;
				if ((float)j < num2 && (float)i < num2)
				{
					num3 = num2 - (float)j;
					num4 = num2 - (float)i;
				}
				else if ((float)j > (float)num - num2 && (float)i < num2)
				{
					num3 = (float)j - ((float)num - num2);
					num4 = num2 - (float)i;
				}
				else if ((float)j < num2 && (float)i > (float)num - num2)
				{
					num3 = num2 - (float)j;
					num4 = (float)i - ((float)num - num2);
				}
				else if ((float)j > (float)num - num2 && (float)i > (float)num - num2)
				{
					num3 = (float)j - ((float)num - num2);
					num4 = (float)i - ((float)num - num2);
				}
				if (Mathf.Sqrt(num3 * num3 + num4 * num4) > num2)
				{
					array[i * num + j] = Color.clear;
					continue;
				}
				float num5 = (float)j / (float)num - 0.5f;
				float num6 = (float)i / (float)num - 0.5f;
				float num7 = Mathf.Sqrt(num5 * num5 + num6 * num6) * 2f;
				array[i * num + j] = Color.Lerp(val2, val3, num7);
			}
		}
		float num8 = (float)num / 2f;
		float num9 = (float)num / 2f;
		for (int k = 0; k < num; k++)
		{
			for (int l = 0; l < num; l++)
			{
				if (array[k * num + l].a < 0.1f)
				{
					continue;
				}
				float num10 = (float)l - num8;
				float num11 = (float)k - num9;
				bool flag = false;
				float num12 = -18f;
				float num13 = 28f;
				if (num10 >= num12 && num10 <= num13)
				{
					float num14 = (num10 - num12) / (num13 - num12);
					float num15 = 6f + num14 * 22f;
					if (num11 >= 0f - num15 && num11 <= num15)
					{
						flag = true;
					}
				}
				if (num10 >= -30f && num10 <= -16f && num11 >= -6f && num11 <= 6f)
				{
					flag = true;
				}
				float num16 = num10 + 30f;
				float num17 = num11;
				if (Mathf.Sqrt(num16 * num16 + num17 * num17) <= 8f)
				{
					flag = true;
				}
				float num18 = 30f;
				float num19 = num10 - num18;
				float num20 = Mathf.Sqrt(num19 * num19 + num11 * num11);
				if (num20 >= 8f && num20 <= 12f && num19 > 0f && Mathf.Abs(num11) < num20 * 0.85f)
				{
					flag = true;
				}
				if (num20 >= 17f && num20 <= 20f && num19 > 0f && Mathf.Abs(num11) < num20 * 0.75f)
				{
					flag = true;
				}
				if (!flag)
				{
					continue;
				}
				int num21 = k - 2;
				int num22 = l + 2;
				if (num21 >= 0 && num21 < num && num22 >= 0 && num22 < num)
				{
					int num23 = num21 * num + num22;
					if (array[num23].a > 0.1f && array[num23] != val4)
					{
						array[num23] = Color.Lerp(array[num23], val5, 0.4f);
					}
				}
				array[k * num + l] = val4;
			}
		}
		val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
		val.Apply(true, false);
		Object.DontDestroyOnLoad((Object)(object)val);
		modAppIconSprite = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 100f);
		Object.DontDestroyOnLoad((Object)(object)modAppIconSprite);
		MelonLogger.Msg($"[PhoneApp] Created icon sprite: {((Object)modAppIconSprite).name}, texture: {((Texture)val).width}x{((Texture)val).height}, format: {val.format}");
		return modAppIconSprite;
	}

	private void TryInjectPhoneApp()
	{
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_030f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			HomeScreen instance = PlayerSingleton<HomeScreen>.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			RectTransform appIconContainer = instance.appIconContainer;
			GameObject appIconPrefab = instance.appIconPrefab;
			if ((Object)(object)appIconContainer == (Object)null || (Object)(object)appIconPrefab == (Object)null)
			{
				return;
			}
			MelonLogger.Msg("[PhoneApp] HomeScreen found! Injecting mod app icon...");
			phoneAppButton = Object.Instantiate<GameObject>(appIconPrefab, (Transform)(object)appIconContainer);
			((Object)phoneAppButton).name = "AYCWO_ModApp";
			phoneAppButton.SetActive(true);
			Sprite sprite = CreateModIconSprite();
			Il2CppArrayBase<Image> componentsInChildren = phoneAppButton.GetComponentsInChildren<Image>(true);
			if (componentsInChildren != null)
			{
				foreach (Image item in componentsInChildren)
				{
					if ((Object)(object)item != (Object)null)
					{
						MelonLogger.Msg($"[PhoneApp] Found Image child: '{((Object)((Component)item).gameObject).name}' (isRoot={(Object)(object)((Component)item).gameObject == (Object)(object)phoneAppButton})");
					}
				}
			}
			bool flag = false;
			string[] array = new string[6] { "Icon", "icon", "Image", "image", "AppIcon", "appicon" };
			if (componentsInChildren != null)
			{
				string[] array2 = array;
				foreach (string value in array2)
				{
					foreach (Image item2 in componentsInChildren)
					{
						if ((Object)(object)item2 != (Object)null && (Object)(object)((Component)item2).gameObject != (Object)(object)phoneAppButton && ((Object)((Component)item2).gameObject).name.Equals(value, StringComparison.OrdinalIgnoreCase))
						{
							item2.sprite = sprite;
							((Graphic)item2).color = Color.white;
							item2.preserveAspect = true;
							flag = true;
							MelonLogger.Msg("[PhoneApp] ✅ Set icon sprite on preferred child: '" + ((Object)((Component)item2).gameObject).name + "'");
							break;
						}
					}
					if (flag)
					{
						break;
					}
				}
				if (!flag)
				{
					foreach (Image item3 in componentsInChildren)
					{
						if ((Object)(object)item3 != (Object)null && (Object)(object)((Component)item3).gameObject != (Object)(object)phoneAppButton && !((Object)((Component)item3).gameObject).name.Equals("Outline", StringComparison.OrdinalIgnoreCase))
						{
							item3.sprite = sprite;
							((Graphic)item3).color = Color.white;
							item3.preserveAspect = true;
							flag = true;
							MelonLogger.Msg("[PhoneApp] Set icon sprite on fallback child: '" + ((Object)((Component)item3).gameObject).name + "'");
							break;
						}
					}
				}
				if (!flag)
				{
					foreach (Image item4 in componentsInChildren)
					{
						if ((Object)(object)item4 != (Object)null)
						{
							item4.sprite = sprite;
							((Graphic)item4).color = Color.white;
							item4.preserveAspect = true;
							MelonLogger.Msg("[PhoneApp] Set icon sprite on (last resort): '" + ((Object)((Component)item4).gameObject).name + "'");
						}
					}
				}
			}
			bool flag2 = false;
			try
			{
				Il2CppArrayBase<Component> componentsInChildren2 = phoneAppButton.GetComponentsInChildren<Component>(true);
				if (componentsInChildren2 != null)
				{
					foreach (Component item5 in componentsInChildren2)
					{
						if (!((Object)(object)item5 != (Object)null) || !((object)item5).GetType().Name.Contains("TMP_Text"))
						{
							continue;
						}
						try
						{
							PropertyInfo property = ((object)item5).GetType().GetProperty("text");
							if (property != null)
							{
								property.SetValue(item5, "AYCWO");
								flag2 = true;
								MelonLogger.Msg("[PhoneApp] Set TMPro label: AYCWO on '" + ((Object)item5.gameObject).name + "'");
							}
						}
						catch
						{
						}
					}
				}
			}
			catch
			{
			}
			if (!flag2)
			{
				Il2CppArrayBase<Text> componentsInChildren3 = phoneAppButton.GetComponentsInChildren<Text>(true);
				if (componentsInChildren3 != null)
				{
					foreach (Text item6 in componentsInChildren3)
					{
						if ((Object)(object)item6 != (Object)null)
						{
							item6.text = "AYCWO";
							item6.fontSize = Mathf.Min(item6.fontSize, 14);
							MelonLogger.Msg("[PhoneApp] Set legacy Text label: AYCWO");
						}
					}
				}
			}
			Button component = phoneAppButton.GetComponent<Button>();
			if ((Object)(object)component != (Object)null)
			{
				((UnityEventBase)component.onClick).RemoveAllListeners();
				((UnityEvent)component.onClick).AddListener(UnityAction.op_Implicit((Action)OnPhoneAppClicked));
				MelonLogger.Msg("[PhoneApp] Click handler registered!");
			}
			else
			{
				MelonLogger.Warning("[PhoneApp] No Button component found on prefab!");
			}
			phoneAppInjected = true;
			MelonLogger.Msg("[PhoneApp] ✅ Mod app icon successfully added to phone home screen!");
		}
		catch (Exception ex)
		{
			if (!ex.Message.Contains("NullReference") && !ex.Message.Contains("not found"))
			{
				MelonLogger.Warning("[PhoneApp] Injection attempt: " + ex.Message);
			}
		}
	}

	private void OnPhoneAppClicked()
	{
		MelonLogger.Msg("[PhoneApp] AYCWO app clicked! Toggling settings...");
		showHUD = !showHUD;
		MelonLogger.Msg("[PhoneApp] Settings HUD is now: " + (showHUD ? "OPEN" : "CLOSED"));
	}

	public override void OnGUI()
	{
		//IL_0030: 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_00c6: Invalid comparison between Unknown and I4
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Invalid comparison between Unknown and I4
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0208: 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)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0296: Unknown result type (might be due to invalid IL or missing references)
		//IL_027b: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0363: Unknown result type (might be due to invalid IL or missing references)
		//IL_0348: Unknown result type (might be due to invalid IL or missing references)
		//IL_039d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0513: Unknown result type (might be due to invalid IL or missing references)
		//IL_0542: Unknown result type (might be due to invalid IL or missing references)
		//IL_056a: Unknown result type (might be due to invalid IL or missing references)
		//IL_059a: Unknown result type (might be due to invalid IL or missing references)
		if (!stylesInitialized)
		{
			InitStyles();
		}
		DrawAutoTransferInfoBox();
		DrawInfoHUD();
		DrawNotification();
		if (!showHUD)
		{
			return;
		}
		Event current = Event.current;
		if ((int)current.type == 0 && current.button == 0)
		{
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref hudWindowRect)).x, ((Rect)(ref hudWindowRect)).y, ((Rect)(ref hudWindowRect)).width, 25f);
			if (((Rect)(ref val)).Contains(current.mousePosition))
			{
				isDragging = true;
				dragOffset = current.mousePosition - new Vector2(((Rect)(ref hudWindowRect)).x, ((Rect)(ref hudWindowRect)).y);
				current.Use();
			}
		}
		else if ((int)current.type == 1 && current.button == 0)
		{
			if (isDragging)
			{
				isDragging = false;
				SaveConfig();
			}
		}
		else if ((int)current.type == 3 && isDragging)
		{
			((Rect)(ref hudWindowRect)).x = current.mousePosition.x - dragOffset.x;
			((Rect)(ref hudWindowRect)).y = current.mousePosition.y - dragOffset.y;
			((Rect)(ref hudWindowRect)).x = Mathf.Clamp(((Rect)(ref hudWindowRect)).x, 0f, (float)Screen.width - ((Rect)(ref hudWindowRect)).width);
			((Rect)(ref hudWindowRect)).y = Mathf.Clamp(((Rect)(ref hudWindowRect)).y, 0f, (float)Screen.height - ((Rect)(ref hudWindowRect)).height);
			current.Use();
		}
		GUI.Box(hudWindowRect, "");
		GUILayout.BeginArea(hudWindowRect);
		GUI.backgroundColor = new Color(0.2f, 0.2f, 0.3f, 1f);
		GUILayout.Box("All Your Clients Will Order v1.54.0", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) });
		GUI.backgroundColor = Color.white;
		GUILayout.Space(10f);
		GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
		GUILayout.Label("Force Order Key:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) });
		string obj = (capturingForceOrderKey ? "Press any key..." : ((object)(KeyCode)(ref forceOrderKey)).ToString());
		GUI.backgroundColor = (capturingForceOrderKey ? new Color(0.6f, 0.3f, 0.3f, 1f) : new Color(0.3f, 0.3f, 0.5f, 1f));
		if (GUILayout.Button(obj, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) }))
		{
			capturingForceOrderKey = !capturingForceOrderKey;
			capturingAutoTransferKey = false;
		}
		GUI.backgroundColor = Color.white;
		GUILayout.EndHorizontal();
		GUILayout.Space(5f);
		GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
		GUILayout.Label("Auto Transfer Key:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) });
		string obj2 = (capturingAutoTransferKey ? "Press any key..." : ((object)(KeyCode)(ref autoTransferKey)).ToString());
		GUI.backgroundColor = (capturingAutoTransferKey ? new Color(0.6f, 0.3f, 0.3f, 1f) : new Color(0.3f, 0.3f, 0.5f, 1f));
		if (GUILayout.Button(obj2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) }))
		{
			capturingAutoTransferKey = !capturingAutoTransferKey;
			capturingForceOrderKey = false;
		}
		GUI.backgroundColor = Color.white;
		GUILayout.EndHorizontal();
		GUILayout.Space(10f);
		GUILayout.Box("Info HUD Options", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(22f) });
		GUILayout.Space(5f);
		GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
		bool flag = GUILayout.Toggle(showProductCounter, " Show Product Counter", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) });
		if (flag != showProductCounter)
		{
			showProductCounter = flag;
			SaveConfig();
		}
		GUILayout.EndHorizontal();
		GUILayout.Space(3f);
		GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
		bool flag2 = GUILayout.Toggle(showClock, " Show Clock Display", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) });
		if (flag2 != showClock)
		{
			showClock = flag2;
			SaveConfig();
		}
		GUILayout.EndHorizontal();
		GUILayout.Space(3f);
		GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
		bool flag3 = GUILayout.Toggle(showDealCounter, " Show Deal Counter", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) });
		if (flag3 != showDealCounter)
		{
			showDealCounter = flag3;
			SaveConfig();
		}
		GUILayout.EndHorizontal();
		GUILayout.Space(10f);
		GUILayout.Label("Click on key buttons to change keybinds", (Il2CppReferenceArray<GUILayoutOption>)null);
		GUILayout.Label("Press ESC to cancel keybind capture", (Il2CppReferenceArray<GUILayoutOption>)null);
		GUILayout.Space(5f);
		GUILayout.Label("Open settings via phone app (AYCWO icon)", (Il2CppReferenceArray<GUILayoutOption>)null);
		GUILayout.Space(10f);
		GUI.backgroundColor = new Color(0.2f, 0.5f, 0.2f, 1f);
		if (GUILayout.Button("Force All Orders Now", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
		{
			ForceAllPlayerClientsToOrder();
		}
		GUI.backgroundColor = Color.white;
		GUILayout.Space(10f);
		GUI.backgroundColor = new Color(0.5f, 0.2f, 0.2f, 1f);
		if (GUILayout.Button("Close", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) }))
		{
			showHUD = false;
		}
		GUI.backgroundColor = Color.white;
		GUILayout.EndArea();
	}

	private void ShowNotification(string message, Color color)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		notificationMessage = message;
		notificationColor = color;
		notificationEndTime = Time.time + 3f;
	}

	private void DrawNotification()
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Expected O, but got Unknown
		if (!(Time.time > notificationEndTime) && !string.IsNullOrEmpty(notificationMessage) && IsHandoverScreenOpen())
		{
			float num = 400f;
			float num2 = 50f;
			float num3 = ((float)Screen.width - num) / 2f;
			float num4 = 100f;
			Rect val = new Rect(num3, num4, num, num2);
			GUI.backgroundColor = new Color(0f, 0f, 0f, 0.9f);
			GUI.Box(val, "", GUI.skin.box);
			GUI.backgroundColor = Color.white;
			if (notificationStyle == null)
			{
				notificationStyle = new GUIStyle(GUI.skin.label);
				notificationStyle.fontSize = 20;
				notificationStyle.fontStyle = (FontStyle)1;
				notificationStyle.alignment = (TextAnchor)4;
			}
			notificationStyle.normal.textColor = notificationColor;
			GUI.Label(val, notificationMessage, notificationStyle);
		}
	}

	private void DrawInfoHUD()
	{
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Invalid comparison between Unknown and I4
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Invalid comparison between Unknown and I4
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0338: Unknown result type (might be due to invalid IL or missing references)
		//IL_0340: Unknown result type (might be due to invalid IL or missing references)
		//IL_0360: Unknown result type (might be due to invalid IL or missing references)
		//IL_0368: Unknown result type (might be due to invalid IL or missing references)
		//IL_037c: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0421: Unknown result type (might be due to invalid IL or missing references)
		//IL_043d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0454: Unknown result type (might be due to invalid IL or missing references)
		//IL_0478: Unknown result type (might be due to invalid IL or missing references)
		//IL_048e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0495: Expected O, but got Unknown
		//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0506: Unknown result type (might be due to invalid IL or missing references)
		//IL_050d: Expected O, but got Unknown
		//IL_0531: Unknown result type (might be due to invalid IL or missing references)
		//IL_054a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0554: Expected O, but got Unknown
		//IL_055c: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_072e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0747: Unknown result type (might be due to invalid IL or missing references)
		//IL_077c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0795: Unknown result type (might be due to invalid IL or missing references)
		//IL_0669: Unknown result type (might be due to invalid IL or missing references)
		//IL_0682: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			Dictionary<string, int> playerContractRequirements = GetPlayerContractRequirements();
			bool flag = playerContractRequirements.Count > 0;
			int activeDealCount = GetActiveDealCount();
			if ((!showClock && !showDealCounter && !flag) || (!showProductCounter && !showClock && !showDealCounter))
			{
				return;
			}
			Event current = Event.current;
			if ((int)current.type == 0 && current.button == 0)
			{
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(((Rect)(ref infoHudRect)).x, ((Rect)(ref infoHudRect)).y, ((Rect)(ref infoHudRect)).width, 36f);
				if (((Rect)(ref val)).Contains(current.mousePosition))
				{
					infoHudDragging = true;
					infoHudDragOffset = current.mousePosition - new Vector2(((Rect)(ref infoHudRect)).x, ((Rect)(ref infoHudRect)).y);
					current.Use();
				}
			}
			else if ((int)current.type == 1 && current.button == 0)
			{
				if (infoHudDragging)
				{
					infoHudDragging = false;
					SaveConfig();
				}
			}
			else if ((int)current.type == 3 && infoHudDragging)
			{
				((Rect)(ref infoHudRect)).x = current.mousePosition.x - infoHudDragOffset.x;
				((Rect)(ref infoHudRect)).y = current.mousePosition.y - infoHudDragOffset.y;
				((Rect)(ref infoHudRect)).x = Mathf.Clamp(((Rect)(ref infoHudRect)).x, 0f, (float)Screen.width - ((Rect)(ref infoHudRect)).width);
				((Rect)(ref infoHudRect)).y = Mathf.Clamp(((Rect)(ref infoHudRect)).y, 0f, (float)Screen.height - ((Rect)(ref infoHudRect)).height);
				current.Use();
			}
			float width = 340f;
			float num = 36f;
			float num2 = 6f;
			float num3 = 24f;
			float num4 = 2f;
			float num5 = 10f;
			bool num6 = showDealCounter;
			bool flag2 = showProductCounter && flag;
			bool flag3 = showClock;
			int num7 = 0;
			float num8 = 0f;
			if (num6)
			{
				num7++;
				num8 += num2 + num3 + num2;
			}
			if (flag2)
			{
				if (num7 > 0)
				{
					num8 += num4;
				}
				num7++;
				num8 += num2 + (float)playerContractRequirements.Count * num3 + num2;
			}
			if (flag3)
			{
				if (num7 > 0)
				{
					num8 += num4;
				}
				num7++;
				num8 += num2 + 2f * num3 + num2;
			}
			float num9 = num + num8 + num5;
			((Rect)(ref infoHudRect)).width = width;
			((Rect)(ref infoHudRect)).height = Mathf.Max(num9, 80f);
			float x = ((Rect)(ref infoHudRect)).x;
			float y = ((Rect)(ref infoHudRect)).y;
			float width2 = ((Rect)(ref infoHudRect)).width;
			float height = ((Rect)(ref infoHudRect)).height;
			Color col = default(Color);
			((Color)(ref col))..ctor(0f, 0f, 0f, 0.3f);
			Color col2 = default(Color);
			((Color)(ref col2))..ctor(0f, 0f, 0f, 0.15f);
			GUI.DrawTexture(new Rect(x + 4f, y + 4f, width2, height), (Texture)(object)MakeTex(2, 2, col));
			GUI.DrawTexture(new Rect(x + 6f, y + 6f, width2, height), (Texture)(object)MakeTex(2, 2, col2));
			GUI.DrawTexture(new Rect(x, y, width2, height), (Texture)(object)hudV2BgTex);
			Color col3 = default(Color);
			((Color)(ref col3))..ctor(0.25f, 0.65f, 0.85f, 0.6f);
			DrawBorderRect(x, y, width2, height, col3, 1);
			Color col4 = default(Color);
			((Color)(ref col4))..ctor(0.3f, 0.75f, 0.95f, 0.25f);
			GUI.DrawTexture(new Rect(x + 1f, y + 1f, width2 - 2f, 1f), (Texture)(object)MakeTex(2, 2, col4));
			GUI.DrawTexture(new Rect(x + 1f, y + 1f, 1f, height - 2f), (Texture)(object)MakeTex(2, 2, new Color(0.3f, 0.75f, 0.95f, 0.12f)));
			GUI.DrawTexture(new Rect(x, y, width2, num), (Texture)(object)hudV2HeaderTex);
			GUI.DrawTexture(new Rect(x, y + num - 2f, width2, 2f), (Texture)(object)hudV2AccentTex);
			GUIStyle val2 = new GUIStyle(hudV2HeaderStyle);
			val2.normal.textColor = new Color(0f, 0f, 0f, 0.6f);
			GUI.Label(new Rect(x + 2f, y + 2f, width2, num), "ACTIVE ORDERS", val2);
			GUI.Label(new Rect(x, y, width2, num), "ACTIVE ORDERS", hudV2HeaderStyle);
			GUIStyle val3 = new GUIStyle(GUI.skin.label);
			val3.fontSize = 9;
			val3.normal.textColor = new Color(0.5f, 0.7f, 0.85f, 0.7f);
			val3.alignment = (TextAnchor)5;
			val3.padding = new RectOffset(0, 10, 0, 0);
			GUI.Label(new Rect(x, y, width2, num), "AYCWO", val3);
			float num10 = y + num;
			int num11 = 0;
			if (num6)
			{
				num10 += num2;
				string value = activeDealCount.ToString();
				DrawHudLine(x, num10, width2, num3, "Active Deals", value, new Color(1f, 0.78f, 0.2f, 1f), new Color(1f, 0.92f, 0.55f, 1f));
				num10 += num3 + num2;
				num11++;
			}
			if (flag2)
			{
				if (num11 > 0)
				{
					DrawSeparator(x + 12f, num10, width2 - 24f, num4);
					num10 += num4;
				}
				num10 += num2;
				foreach (KeyValuePair<string, int> item in playerContractRequirements)
				{
					string value2 = item.Value + "x";
					DrawHudLine(x, num10, width2, num3, item.Key, value2, new Color(0.35f, 1f, 0.45f, 1f), new Color(0.7f, 1f, 0.75f, 1f));
					num10 += num3;
				}
				num10 += num2;
				num11++;
			}
			if (flag3)
			{
				if (num11 > 0)
				{
					DrawSeparator(x + 12f, num10, width2 - 24f, num4);
					num10 += num4;
				}
				num10 += num2;
				string gameTimeString = GetGameTimeString();
				string value3 = DateTime.Now.ToString("HH:mm");
				DrawHudLine(x, num10, width2, num3, "Game", gameTimeString, new Color(0.4f, 0.85f, 1f, 0.7f), new Color(0.4f, 0.95f, 1f, 1f));
				num10 += num3;
				DrawHudLine(x, num10, width2, num3, "Real", value3, new Color(0.4f, 0.85f, 1f, 0.7f), new Color(0.4f, 0.95f, 1f, 1f));
				num10 += num3 + num2;
				num11++;
			}
		}
		catch (Exception)
		{
		}
	}

	private void DrawHudLine(float x, float curY, float w, float lineH, string label, string value, Color labelCol, Color valueCol)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Expected O, but got Unknown
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Expected O, but got Unknown
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Expected O, but got Unknown
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Expected O, but got Unknown
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Expected O, but got Unknown
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		GUIStyle val = new GUIStyle(GUI.skin.label);
		val.fontSize = 14;
		val.fontStyle = (FontStyle)1;
		val.normal.textColor = new Color(0f, 0f, 0f, 0.5f);
		val.alignment = (TextAnchor)3;
		val.padding = new RectOffset(16, 0, 0, 0);
		GUIStyle val2 = new GUIStyle(val);
		val2.alignment = (TextAnchor)5;
		val2.padding = new RectOffset(0, 16, 0, 0);
		GUIStyle val3 = new GUIStyle(val);
		val3.normal.textColor = labelCol;
		GUI.Label(new Rect(x + 1f, curY + 1f, w, lineH), label, val);
		GUI.Label(new Rect(x, curY, w, lineH), label, val3);
		GUIStyle val4 = new GUIStyle(val2);
		val4.normal.textColor = valueCol;
		val4.fontSize = 15;
		GUI.Label(new Rect(x + 1f, curY + 1f, w, lineH), value, val2);
		GUI.Label(new Rect(x, curY, w, lineH), value, val4);
	}

	private void DrawSeparator(float x, float y, float w, float h)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		GUI.DrawTexture(new Rect(x, y, w, h), (Texture)(object)hudV2SeparatorTex);
	}

	private void DrawBorderRect(float x, float y, float w, float h, Color col, int thickness)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		Texture2D val = MakeTex(2, 2, col);
		GUI.DrawTexture(new Rect(x, y, w, (float)thickness), (Texture)(object)val);
		GUI.DrawTexture(new Rect(x, y + h - (float)thickness, w, (float)thickness), (Texture)(object)val);
		GUI.DrawTexture(new Rect(x, y, (float)thickness, h), (Texture)(object)val);
		GUI.DrawTexture(new Rect(x + w - (float)thickness, y, (float)thickness, h), (Texture)(object)val);
	}

	private void DrawTextWithShadow(string text, GUIStyle style)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		GUIStyle val = new GUIStyle(style);
		val.normal.textColor = Color.black;
		Rect rect = GUILayoutUtility.GetRect(new GUIContent(text), style);
		GUI.Label(new Rect(((Rect)(ref rect)).x + 2f, ((Rect)(ref rect)).y + 2f, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, val);
		GUI.Label(new Rect(((Rect)(ref rect)).x + 1f, ((Rect)(ref rect)).y + 1f, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, val);
		GUI.Label(rect, text, style);
	}

	private string FormatProductName(string rawName)
	{
		if (string.IsNullOrEmpty(rawName))
		{
			return rawName;
		}
		if (new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
		{
			{ "ogkush", "OG Kush" },
			{ "og kush", "OG Kush" },
			{ "grandaddypurple", "Granddaddy Purple" },
			{ "granddaddypurple", "Granddaddy Purple" },
			{ "greencrack", "Green Crack" },
			{ "sourdiesel", "Sour Diesel" },
			{ "bluedream", "Blue Dream" },
			{ "whiterhino", "White Rhino" },
			{ "ultrarhino", "Ultra Rhino" },
			{ "purplehaze", "Purple Haze" },
			{ "goldleaf", "Gold Leaf" },
			{ "granddaddyballs", "Granddaddy Balls" },
			{ "meth", "Meth" },
			{ "cocaine", "Cocaine" },
			{ "weed", "Weed" },
			{ "ogmclovin", "OG McLovin" },
			{ "mclovin", "McLovin" }
		}.TryGetValue(rawName, out var value))
		{
			return value;
		}
		string input = Regex.Replace(rawName, "([a-z])([A-Z])", "$1 $2");
		input = Regex.Replace(input, "\\bMc ([A-Z])", "Mc$1");
		if (input.Length > 0)
		{
			input = char.ToUpper(input[0]) + input.Substring(1);
		}
		return input;
	}

	private Dictionary<string, int> GetPlayerContractRequirements()
	{
		if (Time.time - lastRequirementsUpdate < 0.5f)
		{
			return cachedProductRequirements;
		}
		cachedProductRequirements.Clear();
		cachedActiveDealCount = 0;
		lastRequirementsUpdate = Time.time;
		try
		{
			List<Customer> unlockedCustomers = Customer.UnlockedCustomers;
			if (unlockedCustomers == null)
			{
				return cachedProductRequirements;
			}
			Enumerator<Customer> enumerator = unlockedCustomers.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Customer current = enumerator.Current;
				if ((Object)(object)current == (Object)null || (Object)(object)current.AssignedDealer != (Object)null)
				{
					continue;
				}
				Contract currentContract = current.CurrentContract;
				if ((Object)(object)currentContract == (Object)null)
				{
					continue;
				}
				cachedActiveDealCount++;
				ProductList productList = currentContract.ProductList;
				if (productList == null || productList.entries == null)
				{
					continue;
				}
				Enumerator<Entry> enumerator2 = productList.entries.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					Entry current2 = enumerator2.Current;
					if (current2 == null)
					{
						continue;
					}
					string productID = current2.ProductID;
					if (!string.IsNullOrEmpty(productID))
					{
						string key = FormatProductName(productID);
						if (cachedProductRequirements.ContainsKey(key))
						{
							cachedProductRequirements[key] += current2.Quantity;
						}
						else
						{
							cachedProductRequirements[key] = current2.Quantity;
						}
					}
				}
			}
		}
		catch (Exception)
		{
		}
		return cachedProductRequirements;
	}

	private int GetActiveDealCount()
	{
		return cachedActiveDealCount;
	}

	private string GetGameTimeString()
	{
		try
		{
			if (!timeManagerSearched || (Object)(object)cachedTimeManager == (Object)null)
			{
				timeManagerSearched = true;
				cachedTimeManager = Object.FindObjectOfType<TimeManager>();
				if ((Object)(object)cachedTimeManager != (Object)null)
				{
					MelonLogger.Msg("[GameTime] Found TimeManager via FindObjectOfType");
				}
			}
			if ((Object)(object)cachedTimeManager != (Object)null)
			{
				if (!timeValuesLogged)
				{
					try
					{
						MelonLogger.Msg($"[TIME DEBUG] CurrentTime={cachedTimeManager.CurrentTime}, DefaultTime={cachedTimeManager.DefaultTime}, ElapsedDays={cachedTimeManager.ElapsedDays}, NormalizedTimeOfDay={cachedTimeManager.NormalizedTimeOfDay}");
						timeValuesLogged = true;
					}
					catch
					{
					}
				}
				try
				{
					float num = cachedTimeManager.NormalizedTimeOfDay * 24f;
					int num2 = (int)num;
					int value = (int)((num - (float)num2) * 60f);
					string value2 = ((num2 >= 12) ? "PM" : "AM");
					num2 %= 12;
					if (num2 == 0)
					{
						num2 = 12;
					}
					return $"{num2}:{value:D2} {value2}";
				}
				catch
				{
				}
				try
				{
					string text = TimeManager.Get12HourTime(cachedTimeManager.NormalizedTimeOfDay, true);
					if (!string.IsNullOrEmpty(text))
					{
						return text;
					}
				}
				catch
				{
				}
			}
			return "??:??";
		}
		catch
		{
			return "??:??";
		}
	}

	private void InitStyles()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Expected O, but got Unknown
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Expected O, but got Unknown
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Expected O, but got Unknown
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Expected O, but got Unknown
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Expected O, but got Unknown
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Expected O, but got Unknown
		//IL_0196: 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_01b4: Expected O, but got Unknown
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c9: Expected O, but got Unknown
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Expected O, but got Unknown
		//IL_0225: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Expected O, but got Unknown
		//IL_0262: Unknown result type (might be due to invalid IL or missing references)
		//IL_0276: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Expected O, but got Unknown
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Expected O, but got Unknown
		//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e6: Expected O, but got Unknown
		//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0327: Unknown result type (might be due to invalid IL or missing references)
		//IL_0340: Unknown result type (might be due to invalid IL or missing references)
		//IL_0367: Unknown result type (might be due to invalid IL or missing references)
		//IL_038e: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0402: Unknown result type (might be due to invalid IL or missing references)
		//IL_040c: Expected O, but got Unknown
		//IL_0450: Unknown result type (might be due to invalid IL or missing references)
		//IL_0464: Unknown result type (might be due to invalid IL or missing references)
		//IL_046e: Expected O, but got Unknown
		//IL_0479: Unknown result type (might be due to invalid IL or missing references)
		//IL_0483: Expected O, but got Unknown
		//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
		infoBoxStyle = new GUIStyle(GUI.skin.box);
		infoBoxStyle.fontSize = 16;
		infoBoxStyle.fontStyle = (FontStyle)1;
		infoBoxStyle.alignment = (TextAnchor)4;
		infoBoxStyle.normal.textColor = Color.white;
		infoBoxStyle.padding = new RectOffset(10, 10, 10, 10);
		infoHudStyle = new GUIStyle(GUI.skin.box);
		infoHudStyle.normal.background = MakeTexWithBorder(64, 64, new Color(0f, 0f, 0f, 1f), new Color(0f, 0.8f, 1f, 1f), 3);
		infoHudStyle.border = new RectOffset(4, 4, 4, 4);
		infoHudTitleStyle = new GUIStyle(GUI.skin.box);
		infoHudTitleStyle.fontSize = 18;
		infoHudTitleStyle.fontStyle = (FontStyle)1;
		infoHudTitleStyle.alignment = (TextAnchor)4;
		infoHudTitleStyle.normal.textColor = Color.white;
		infoHudTitleStyle.normal.background = MakeTex(2, 2, new Color(0f, 0.5f, 0.7f, 1f));
		infoHudContentStyle = new GUIStyle(GUI.skin.label);
		infoHudContentStyle.fontSize = 18;
		infoHudContentStyle.fontStyle = (FontStyle)1;
		infoHudContentStyle.normal.textColor = Color.white;
		infoHudContentStyle.padding = new RectOffset(8, 8, 4, 4);
		clockStyle = new GUIStyle(GUI.skin.label);
		clockStyle.fontSize = 18;
		clockStyle.fontStyle = (FontStyle)1;
		clockStyle.normal.textColor = new Color(0f, 1f, 1f);
		clockStyle.padding = new RectOffset(8, 8, 4, 4);
		productStyle = new GUIStyle(GUI.skin.label);
		productStyle.fontSize = 18;
		productStyle.fontStyle = (FontStyle)1;
		productStyle.normal.textColor = new Color(0.2f, 1f, 0.2f);
		productStyle.padding = new RectOffset(8, 8, 4, 4);
		dealCounterStyle = new GUIStyle(GUI.skin.label);
		dealCounterStyle.fontSize = 18;
		dealCounterStyle.fontStyle = (FontStyle)1;
		dealCounterStyle.normal.textColor = new Color(1f, 0.85f, 0.2f);
		dealCounterStyle.padding = new RectOffset(8, 8, 4, 4);
		hudV2BgTex = MakeTex(2, 2, new Color(0.06f, 0.08f, 0.12f, 0.95f));
		hudV2HeaderTex = MakeVerticalGradientTex(64, 36, new Color(0.08f, 0.18f, 0.3f, 0.98f), new Color(0.05f, 0.12f, 0.22f, 0.98f));
		hudV2SeparatorTex = MakeTex(2, 2, new Color(0.3f, 0.55f, 0.7f, 0.3f));
		hudV2SectionBgTex = MakeTex(2, 2, new Color(0.08f, 0.1f, 0.15f, 0.5f));
		hudV2AccentTex = MakeHorizontalGradientTex(64, 2, new Color(0.15f, 0.5f, 0.8f, 0f), new Color(0.2f, 0.7f, 1f, 0.8f), new Color(0.15f, 0.5f, 0.8f, 0f));
		hudV2HeaderStyle = new GUIStyle(GUI.skin.label);
		hudV2HeaderStyle.fontSize = 15;
		hudV2HeaderStyle.fontStyle = (FontStyle)1;
		hudV2HeaderStyle.alignment = (TextAnchor)4;
		hudV2HeaderStyle.normal.textColor = new Color(0.85f, 0.92f, 1f, 1f);
		hudV2HeaderStyle.padding = new RectOffset(0, 0, 0, 0);
		notificationStyle = new GUIStyle(GUI.skin.label);
		notificationStyle.fontSize = 20;
		notificationStyle.fontStyle = (FontStyle)1;
		notificationStyle.alignment = (TextAnchor)4;
		notificationStyle.normal.textColor = Color.white;
		stylesInitialized = true;
	}

	private Texture2D MakeTex(int width, int height, Color col)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		Color[] array = (Color[])(object)new Color[width * height];
		for (int i = 0; i < array.Length; i++)
		{
			array[i] = col;
		}
		Texture2D val = new Texture2D(width, height);
		val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
		val.Apply();
		return val;
	}

	private Texture2D MakeVerticalGradientTex(int width, int height, Color topColor, Color bottomColor)
	{
		//IL_0015: 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)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		Color[] array = (Color[])(object)new Color[width * height];
		for (int i = 0; i < height; i++)
		{
			float num = (float)i / (float)(height - 1);
			Color val = Color.Lerp(topColor, bottomColor, num);
			for (int j = 0; j < width; j++)
			{
				array[i * width + j] = val;
			}
		}
		Texture2D val2 = new Texture2D(width, height);
		val2.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
		val2.Apply();
		return val2;
	}

	private Texture2D MakeHorizontalGradientTex(int width, int height, Color leftColor, Color centerColor, Color rightColor)
	{
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Expected O, but got Unknown
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		Color[] array = (Color[])(object)new Color[width * height];
		int num = width / 2;
		for (int i = 0; i < height; i++)
		{
			for (int j = 0; j < width; j++)
			{
				Color val;
				if (j <= num)
				{
					float num2 = (float)j / (float)num;
					val = Color.Lerp(leftColor, centerColor, num2);
				}
				else
				{
					float num2 = (float)(j - num) / (float)(width - num - 1);
					val = Color.Lerp(centerColor, rightColor, num2);
				}
				array[i * width + j] = val;
			}
		}
		Texture2D val2 = new Texture2D(width, height);
		val2.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
		val2.Apply();
		return val2;
	}

	private Texture2D MakeTexWithBorder(int width, int height, Color fillColor, Color borderColor, int borderWidth)
	{
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Expected O, but got Unknown
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		Color[] array = (Color[])(object)new Color[width * height];
		for (int i = 0; i < height; i++)
		{
			for (int j = 0; j < width; j++)
			{
				if (j < borderWidth || j >= width - borderWidth || i < borderWidth || i >= height - borderWidth)
				{
					array[i * width + j] = borderColor;
				}
				else
				{
					array[i * width + j] = fillColor;
				}
			}
		}
		Texture2D val = new Texture2D(width, height);
		val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
		val.Apply();
		return val;
	}

	private bool IsHandoverScreenOpen()
	{
		try
		{
			HandoverScreen instance = Singleton<HandoverScreen>.Instance;
			if ((Object)(object)instance != (Object)null && instance.IsOpen)
			{
				return true;
			}
		}
		catch
		{
		}
		return false;
	}

	private void DrawAutoTransferInfoBox()
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (IsHandoverScreenOpen())
			{
				float num = 280f;
				float num2 = 40f;
				float num3 = 20f;
				float num4 = (float)Screen.width - num - num3;
				float num5 = (float)Screen.height - num2 - num3 - 100f;
				Rect val = new Rect(num4, num5, num, num2);
				GUI.backgroundColor = new Color(0.1f, 0.1f, 0.2f, 0.9f);
				GUI.Box(val, "", GUI.skin.box);
				GUI.backgroundColor = Color.white;
				string text = ((object)(KeyCode)(ref autoTransferKey)).ToString();
				GUI.Label(val, "Press [" + text + "] for auto transfer!", infoBoxStyle);
			}
		}
		catch
		{
		}
	}

	private void TryAutoTransfer()
	{
		//IL_0acf: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0391: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a31: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a0c: Unknown result type (might be due to invalid IL or missing references)
		//IL_09b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a77: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a56: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			HandoverScreen instance = Singleton<HandoverScreen>.Instance;
			if ((Object)(object)instance == (Object)null || !instance.IsOpen)
			{
				return;
			}
			MelonLogger.Msg("[AutoTransfer v1.51] ========================================");
			MelonLogger.Msg("[AutoTransfer v1.54] R pressed - AUTO-TRANSFER v1.54.0");
			MelonLogger.Msg("[AutoTransfer v1.51] ========================================");
			Contract currentContract = instance.CurrentContract;
			if ((Object)(object)currentContract == (Object)null)
			{
				MelonLogger.Warning("[AutoTransfer v1.51] No current contract found!");
				ShowNotification("No active deal found!", new Color(1f, 0.5f, 0f));
				return;
			}
			ProductList productList = currentContract.ProductList;
			if (productList == null)
			{
				MelonLogger.Warning("[AutoTransfer v1.51] No product list found!");
				ShowNotification("No products required!", new Color(1f, 0.5f, 0f));
				return;
			}
			List<Entry> entries = productList.entries;
			if (entries == null || entries.Count == 0)
			{
				MelonLogger.Warning("[AutoTransfer v1.51] Product list empty!");
				ShowNotification("No products required!", new Color(1f, 0.5f, 0f));
				return;
			}
			MelonLogger.Msg($"[AutoTransfer v1.51] Contract requires {entries.Count} product type(s)");
			Il2CppReferenceArray<ItemSlot> customerSlots = instance.CustomerSlots;
			if (customerSlots == null || ((Il2CppArrayBase<ItemSlot>)(object)customerSlots).Length == 0)
			{
				MelonLogger.Warning("[AutoTransfer v1.51] No customer slots!");
				ShowNotification("No slots available!", new Color(1f, 0.5f, 0f));
				return;
			}
			MelonLogger.Msg($"[AutoTransfer v1.51] Customer has {((Il2CppArrayBase<ItemSlot>)(object)customerSlots).Length} slots");
			PlayerInventory instance2 = PlayerSingleton<PlayerInventory>.Instance;
			if ((Object)(object)instance2 == (Object)null)
			{
				MelonLogger.Warning("[AutoTransfer v1.51] PlayerInventory not found!");
				ShowNotification("Inventory error!", new Color(1f, 0.3f, 0.3f));
				return;
			}
			List<HotbarSlot> hotbarSlots = instance2.hotbarSlots;
			if (hotbarSlots == null)
			{
				MelonLogger.Warning("[AutoTransfer v1.51] Hotbar slots not found!");
				ShowNotification("Inventory error!", new Color(1f, 0.3f, 0.3f));
				return;
			}
			int num = 0;
			int i = 0;
			string text = "";
			bool flag = true;
			bool flag2 = false;
			for (int j = 0; j < entries.Count; j++)
			{
				Entry val = entries[j];
				if (val == null)
				{
					continue;
				}
				string productID = val.ProductID;
				int quantity = val.Quantity;
				text = FormatProductName(productID);
				MelonLogger.Msg("[AutoTransfer v1.51] ----------------------------------------");
				MelonLogger.Msg($"[AutoTransfer v1.51] NEED: {quantity}x {productID}");
				int num2 = 0;
				bool flag3 = false;
				for (int k = 0; k < hotbarSlots.Count; k++)
				{
					HotbarSlot val2 = hotbarSlots[k];
					if (val2 == null)
					{
						continue;
					}
					ItemInstance itemInstance = ((ItemSlot)val2).ItemInstance;
					if (itemInstance == null)
					{
						continue;
					}
					try
					{
						ItemDefinition definition = itemInstance.Definition;
						if (!((Object)(object)definition == (Object)null))
						{
							string iD = definition.ID;
							if (!string.IsNullOrEmpty(iD) && (iD.Equals(productID, StringComparison.OrdinalIgnoreCase) || iD.Contains(productID, StringComparison.OrdinalIgnoreCase) || productID.Contains(iD, StringComparison.OrdinalIgnoreCase)))
							{
								flag3 = true;
								num2 += ((ItemSlot)val2).Quantity;
							}
						}
					}
					catch
					{
					}
				}
				if (!flag3)
				{
					MelonLogger.Warning("[AutoTransfer v1.51] Product '" + productID + "' not found in inventory!");
					ShowNotification("Product '" + text + "' not found!", new Color(1f, 0.3f, 0.3f));
					continue;
				}
				flag = false;
				if (num2 < quantity)
				{
					MelonLogger.Warning($"[AutoTransfer v1.51] Not enough! Need {quantity}, have {num2}");
					flag2 = true;
				}
				int num3 = 0;
				for (int l = 0; l < hotbarSlots.Count && num3 < quantity; l++)
				{
					HotbarSlot val3 = hotbarSlots[l];
					if (val3 == null)
					{
						continue;
					}
					ItemInstance itemInstance2 = ((ItemSlot)val3).ItemInstance;
					if (itemInstance2 == null)
					{
						continue;
					}
					ItemDefinition val4 = null;
					string text2 = "";
					string text3 = "";
					try
					{
						val4 = itemInstance2.Definition;
						if ((Object)(object)val4 == (Object)null)
						{
							continue;
						}
						text2 = val4.ID;
						text3 = val4.Name;
						goto IL_045c;
					}
					catch
					{
					}
					continue;
					IL_045c:
					if (string.IsNullOrEmpty(text2) || (!text2.Equals(productID, StringComparison.OrdinalIgnoreCase) && !text2.Contains(productID, StringComparison.OrdinalIgnoreCase) && !productID.Contains(text2, StringComparison.OrdinalIgnoreCase)))
					{
						continue;
					}
					int quantity2 = ((ItemSlot)val3).Quantity;
					if (quantity2 <= 0)
					{
						continue;
					}
					int num4 = quantity - num3;
					int num5 = Math.Min(quantity2, num4);
					MelonLogger.Msg($"[AutoTransfer v1.51] FOUND: {quantity2}x '{text3}' ({text2}) in player slot {l}");
					MelonLogger.Msg($"[AutoTransfer v1.51] WILL TRANSFER: {num5}x (need {num4} more)");
					ItemSlot val5 = null;
					int value = -1;
					for (; i < ((Il2CppArrayBase<ItemSlot>)(object)customerSlots).Length; i++)
					{
						ItemSlot val6 = ((Il2CppArrayBase<ItemSlot>)(object)customerSlots)[i];
						if (val6 != null && val6.ItemInstance == null)
						{
							val5 = val6;
							value = i;
							i++;
							break;
						}
					}
					if (val5 == null)
					{
						MelonLogger.Warning("[AutoTransfer v1.51] No empty customer slot!");
						break;
					}
					MelonLogger.Msg($"[AutoTransfer v1.51] TARGET: Customer slot {value}");
					try
					{
						ItemInstance val7 = null;
						try
						{
							val7 = itemInstance2.GetCopy(num5);
							MelonLogger.Msg($"[AutoTransfer v1.51] Created copy via GetCopy({num5})");
						}
						catch (Exception ex)
						{
							MelonLogger.Warning($"[AutoTransfer v1.51] GetCopy({num5}) failed: {ex.Message}");
							try
							{
								val7 = itemInstance2.GetCopy(1);
								MelonLogger.Msg("[AutoTransfer v1.51] Fallback: GetCopy(1)");
								goto end_IL_062e;
							}
							catch (Exception ex2)
							{
								MelonLogger.Error("[AutoTransfer v1.51] All copy methods failed: " + ex2.Message);
							}
							goto end_IL_05e7;
							end_IL_062e:;
						}
						if (val7 == null)
						{
							MelonLogger.Error("[AutoTransfer v1.51] Failed to create item copy!");
							continue;
						}
						val5.SetStoredItem(val7, true);
						MelonLogger.Msg($"[AutoTransfer v1.51] SET: Item placed in customer slot {value}");
						try
						{
							int quantity3 = val5.Quantity;
							MelonLogger.Msg($"[AutoTransfer v1.51] Customer slot quantity after set: {quantity3}");
							if (quantity3 != num5)
							{
								int num6 = num5 - quantity3;
								if (num6 > 0)
								{
									val5.ChangeQuantity(num6, true);
									MelonLogger.Msg($"[AutoTransfer v1.51] Adjusted customer slot: +{num6}");
								}
							}
						}
						catch (Exception ex3)
						{
							MelonLogger.Warning("[AutoTransfer v1.51] Quantity adjustment: " + ex3.Message);
						}
						int quantity4 = ((ItemSlot)val3).Quantity;
						((ItemSlot)val3).ChangeQuantity(-num5, true);
						int quantity5 = ((ItemSlot)val3).Quantity;
						MelonLogger.Msg($"[AutoTransfer v1.51] PLAYER: {quantity4} -> {quantity5} (removed {num5})");
						num3 += num5;
						num += num5;
						MelonLogger.Msg($"[AutoTransfer v1.51] PROGRESS: {num3}/{quantity} for {productID}");
						end_IL_05e7:;
					}
					catch (Exception ex4)
					{
						MelonLogger.Error("[AutoTransfer v1.51] Transfer error: " + ex4.Message);
					}
				}
				if (num3 < quantity)
				{
					MelonLogger.Warning($"[AutoTransfer v1.51] INCOMPLETE: {num3}/{quantity} of {productID}");
				}
				else
				{
					MelonLogger.Msg($"[AutoTransfer v1.51] COMPLETE: {num3}x {productID}");
				}
			}
			MelonLogger.Msg("[AutoTransfer v1.51] ========================================");
			if (num > 0)
			{
				MelonLogger.Msg($"[AutoTransfer v1.51] TOTAL: {num} items transferred");
				if (flag2)
				{
					ShowNotification("Not enough products to complete the order", new Color(1f, 0.6f, 0.2f));
				}
				else
				{
					ShowNotification($"Transfer successful: {num}x {text}", new Color(0.3f, 1f, 0.3f));
				}
			}
			else if (flag)
			{
				ShowNotification("You don't have the required product in inventory", new Color(1f, 0.3f, 0.3f));
			}
			else if (flag2)
			{
				ShowNotification("Not enough products to complete the order", new Color(1f, 0.6f, 0.2f));
			}
			else
			{
				ShowNotification("No items transferred! Check your inventory.", new Color(1f, 0.6f, 0.2f));
			}
			MelonLogger.Msg("[AutoTransfer v1.51] ========================================");
		}
		catch (Exception value2)
		{
			MelonLogger.Error($"[AutoTransfer v1.51] Error: {value2}");
			ShowNotification("Transfer error! Check logs.", new Color(1f, 0.3f, 0.3f));
		}
	}

	private void ForceAllPlayerClientsToOrder()
	{
		try
		{
			List<Customer> unlockedCustomers = Customer.UnlockedCustomers;
			if (unlockedCustomers == null || unlockedCustomers.Count == 0)
			{
				MelonLogger.Msg("No unlocked customers found.");
				return;
			}
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			Type typeFromHandle = typeof(Customer);
			PropertyInfo property = typeFromHandle.GetProperty("OfferedContract");
			PropertyInfo property2 = typeFromHandle.GetProperty("HoursUntilNextDealRequest");
			Enumerator<Customer> enumerator = unlockedCustomers.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Customer current = enumerator.Current;
				if ((Object)(object)current == (Object)null)
				{
					continue;
				}
				if ((Object)(object)current.AssignedDealer != (Object)null)
				{
					num3++;
					continue;
				}
				if ((Object)(object)current.CurrentContract != (Object)null)
				{
					num2++;
					continue;
				}
				try
				{
					if (property != null && property.GetValue(current) != null)
					{
						num4++;
						continue;
					}
				}
				catch
				{
				}
				try
				{
					if (property2 != null && property2.CanWrite)
					{
						property2.SetValue(current, 0);
					}
				}
				catch
				{
				}
				try
				{
					current.ForceDealOffer();
					num++;
				}
				catch (Exception ex)
				{
					MelonLogger.Warning("[ForceOrder] Failed for customer: " + ex.Message);
				}
			}
			string text = $"Forced {num} clients to send orders.";
			if (num2 > 0)
			{
				text += $" ({num2} with active deals)";
			}
			if (num3 > 0)
			{
				text += $" ({num3} assigned to dealers)";
			}
			if (num4 > 0)
			{
				text += $" ({num4} with pending offers)";
			}
			MelonLogger.Msg(text);
		}
		catch (Exception ex2)
		{
			MelonLogger.Error("Error forcing client orders: " + ex2.Message);
		}
	}

	private void SaveConfig()
	{
		try
		{
			Dictionary<string, object> value = new Dictionary<string, object>
			{
				{
					"ForceOrderKey",
					((object)(KeyCode)(ref forceOrderKey)).ToString()
				},
				{
					"AutoTransferKey",
					((object)(KeyCode)(ref autoTransferKey)).ToString()
				},
				{
					"HudPosX",
					((Rect)(ref hudWindowRect)).x
				},
				{
					"HudPosY",
					((Rect)(ref hudWindowRect)).y
				},
				{
					"InfoHudPosX",
					((Rect)(ref infoHudRect)).x
				},
				{
					"InfoHudPosY",
					((Rect)(ref infoHudRect)).y
				},
				{ "ShowProductCounter", showProductCounter },
				{ "ShowClock", showClock },
				{ "ShowDealCounter", showDealCounter }
			};
			JsonSerializerOptions options = new JsonSerializerOptions
			{
				WriteIndented = true
			};
			string contents = JsonSerializer.Serialize(value, options);
			File.WriteAllText(configPath, contents);
		}
		catch (Exception ex)
		{
			MelonLogger.Error("Failed to save config: " + ex.Message);
		}
	}

	private void LoadConfig()
	{
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (File.Exists(configPath))
			{
				Dictionary<string, JsonElement> dictionary = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(File.ReadAllText(configPath));
				if (dictionary != null)
				{
					if (dictionary.TryGetValue("ForceOrderKey", out var value) && Enum.TryParse<KeyCode>(value.GetString(), out KeyCode result))
					{
						forceOrderKey = result;
					}
					if (dictionary.TryGetValue("AutoTransferKey", out var value2) && Enum.TryParse<KeyCode>(value2.GetString(), out KeyCode result2))
					{
						autoTransferKey = result2;
					}
					if (dictionary.TryGetValue("HudPosX", out var value3))
					{
						((Rect)(ref hudWindowRect)).x = (float)value3.GetDouble();
					}
					if (dictionary.TryGetValue("HudPosY", out var value4))
					{
						((Rect)(ref hudWindowRect)).y = (float)value4.GetDouble();
					}
					if (dictionary.TryGetValue("InfoHudPosX", out var value5))
					{
						((Rect)(ref infoHudRect)).x = (float)value5.GetDouble();
					}
					if (dictionary.TryGetValue("InfoHudPosY", out var value6))
					{
						((Rect)(ref infoHudRect)).y = (float)value6.GetDouble();
					}
					if (dictionary.TryGetValue("ShowProductCounter", out var value7))
					{
						showProductCounter = value7.GetBoolean();
					}
					if (dictionary.TryGetValue("ShowClock", out var value8))
					{
						showClock = value8.GetBoolean();
					}
					if (dictionary.TryGetValue("ShowDealCounter", out var value9))
					{
						showDealCounter = value9.GetBoolean();
					}
					MelonLogger.Msg("Config loaded from AllYourClientsWillOrder.json");
				}
			}
			else
			{
				SaveConfig();
				MelonLogger.Msg("Default config created: AllYourClientsWillOrder.json");
			}
		}
		catch (Exception ex)
		{
			MelonLogger.Error("Failed to load config: " + ex.Message);
		}
	}

	private void MigrateOldConfig()
	{
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: 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_01de: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			string path = Path.Combine(MelonEnvironment.UserDataDirectory, "AllYourClientsWillOrder.cfg");
			if (!File.Exists(path) || File.Exists(configPath))
			{
				return;
			}
			MelonLogger.Msg("Migrating old .cfg config to .json format...");
			string[] array = File.ReadAllLines(path);
			for (int i = 0; i < array.Length; i++)
			{
				string[] array2 = array[i].Split('=');
				if (array2.Length != 2)
				{
					continue;
				}
				string text = array2[0].Trim();
				string text2 = array2[1].Trim();
				switch (text)
				{
				case "ForceOrderKey":
				{
					if (Enum.TryParse<KeyCode>(text2, out KeyCode result2))
					{
						forceOrderKey = result2;
					}
					break;
				}
				case "AutoTransferKey":
				{
					if (Enum.TryParse<KeyCode>(text2, out KeyCode result6))
					{
						autoTransferKey = result6;
					}
					break;
				}
				case "HudPosX":
				{
					if (float.TryParse(text2, out var result8))
					{
						((Rect)(ref hudWindowRect)).x = result8;
					}
					break;
				}
				case "HudPosY":
				{
					if (float.TryParse(text2, out var result4))
					{
						((Rect)(ref hudWindowRect)).y = result4;
					}
					break;
				}
				case "InfoHudPosX":
				{
					if (float.TryParse(text2, out var result9))
					{
						((Rect)(ref infoHudRect)).x = result9;
					}
					break;
				}
				case "InfoHudPosY":
				{
					if (float.TryParse(text2, out var result7))
					{
						((Rect)(ref infoHudRect)).y = result7;
					}
					break;
				}
				case "ShowProductCounter":
				{
					if (bool.TryParse(text2, out var result5))
					{
						showProductCounter = result5;
					}
					break;
				}
				case "ShowClock":
				{
					if (bool.TryParse(text2, out var result3))
					{
						showClock = result3;
					}
					break;
				}
				case "ShowDealCounter":
				{
					if (bool.TryParse(text2, out var result))
					{
						showDealCounter = result;
					}
					break;
				}
				}
			}
			SaveConfig();
			MelonLogger.Msg("Config migrated successfully to .json format!");
		}
		catch (Exception ex)
		{
			MelonLogger.Error("Failed to migrate old config: " + ex.Message);
		}
	}
}