Decompiled source of Shadows of Doubt Debug Menu v0.1.0

BepInEx/plugins/Khundian-Shadows_of_Doubt_Debug_Menu/Khundian.SoD.DebugMenu.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Khundian.SoD.DebugMenu
{
	public class DebugMenuBehaviour : MonoBehaviour
	{
		private Vector2 _casesScroll;

		private string _murdererFingerprintEvidenceId = string.Empty;

		private bool _open;

		private Rect _windowRect = new Rect(100f, 100f, 680f, 680f);

		private Vector2 _contentScroll;

		private bool _sizedOnOpen;

		private int _lastHotkeyFrame = -1;

		private int _tabIndex;

		private SessionData? _sd;

		private GameplayController? _gc;

		private InteractionController? _ic;

		private Player? _player;

		private Game? _game;

		private AssetLoader? _assets;

		private bool _noclipGhost;

		private int _moneyDelta = 100;

		private int _scDelta = 50;

		private int _lockpicksDelta = 1;

		private float _timeMultiplier = 1f;

		private int _timeSpeedEnum = 1;

		private float _rain;

		private float _wind;

		private float _snow;

		private float _lightning;

		private float _fog;

		private float _weatherFreq = 0.5f;

		private float _biasRain = 1f;

		private float _biasWind = 1f;

		private float _biasSnow = 1f;

		private string _spawnSearch = string.Empty;

		private List<InteractablePreset> _spawnPresets = new List<InteractablePreset>();

		private Vector2 _spawnScroll;

		private float _statDelta = 10f;

		private bool _invincible;

		private float _uiScale = 1f;

		private const string UiScalePrefKey = "Khundian.DebugMenu.UiScale";

		private bool _captureHotkey;

		private static GUIStyle? _cachedBox;

		private bool _dragging;

		private Vector2 _dragStartMouse;

		private Vector2 _dragStartPos;

		private bool _resizing;

		private Vector2 _resizeStartMouse;

		private Vector2 _resizeStartSize;

		private bool _uiSetDesktop;

		private bool _uiPaused;

		private bool _uiDisabledMove;

		private bool _uiPrevCursorVisible;

		private bool _uiPrevCrosshair;

		private bool _uiPrevTextInput;

		private CursorLockMode _uiPrevCursorLock;

		private const float EconButtonW = 160f;

		private string _moneyDeltaBuf = string.Empty;

		private bool _moneyDeltaEditing;

		private bool _moneyDeltaInit;

		private string _moneyDeductBuf = string.Empty;

		private bool _moneyDeductEditing;

		private bool _moneyDeductInit;

		private int _moneyDeduct = 100;

		private string _scDeltaBuf = string.Empty;

		private bool _scDeltaEditing;

		private bool _scDeltaInit;

		private string _scDeductBuf = string.Empty;

		private bool _scDeductEditing;

		private bool _scDeductInit;

		private int _scDeduct = 50;

		private string _lpDeltaBuf = string.Empty;

		private bool _lpDeltaEditing;

		private bool _lpDeltaInit;

		private string _lpDeductBuf = string.Empty;

		private bool _lpDeductEditing;

		private bool _lpDeductInit;

		private int _lockpicksDeduct = 1;

		private bool _spawnOnlyInventory;

		private int _spawnCount = 1;

		private string _spawnCountBuf = string.Empty;

		private bool _spawnCountEditing;

		private bool _spawnCountBufInitialized;

		private float _spawnDistance = 1.2f;

		private const float _spawnRowHeight = 28f;

		private const float _spawnViewHeight = 320f;

		private int _spawnVirtFirst;

		private int _spawnVirtCount;

		private int _spawnVirtTotal;

		private List<NewDoor>? _ktcOriginalKeys;

		private List<NewDoor>? _ktcAddedKeys;

		private int _ktcLastScanFrame;

		private StatusController? _statusController;

		private Dictionary<string, StatusPreset>? _statusPresetMap;

		private static readonly Dictionary<string, string> _statusPresetAliases = new Dictionary<string, string> { { "Stinky", "Smelly" } };

		private string _passOverrideBuf = "1000";

		private bool _passOverrideEditing;

		private bool _passOverrideInit;

		private int _passOverrideVal = 1000;

		private const float ToggleW = 180f;

		private Vector2 _syncScroll;

		private void DrawCases()
		{
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: 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_0094: 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_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("Murder & Kidnap Cases", (Il2CppReferenceArray<GUILayoutOption>)null);
			MurderController mc = MurderController._instance;
			Case ac = (((Object)(object)mc != (Object)null) ? mc.currentActiveCase : null);
			if ((Object)(object)mc == (Object)null)
			{
				GUILayout.Label("MurderController not found.", (Il2CppReferenceArray<GUILayoutOption>)null);
				return;
			}
			if (ac == null)
			{
				GUILayout.Label("No active case found.", (Il2CppReferenceArray<GUILayoutOption>)null);
				return;
			}
			try
			{
				string value = ac.name ?? "(unnamed)";
				CaseType caseType = ac.caseType;
				string value2 = ((object)(CaseType)(ref caseType)).ToString();
				CaseStatus caseStatus = ac.caseStatus;
				string value3 = ((object)(CaseStatus)(ref caseStatus)).ToString();
				GUILayout.Label($"Active Case: {value}  —  Type: {value2}  —  Status: {value3}", (Il2CppReferenceArray<GUILayoutOption>)null);
			}
			catch
			{
			}
			GUILayout.Space(4f);
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			if (GUILayout.Button("Preview/Refresh Murder Resolve Data", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(260f) }))
			{
				Try(delegate
				{
					mc.UpdateResolveQuestions(true);
					mc.UpdateCorrectResolveAnswers();
					_murdererFingerprintEvidenceId = FindMurdererFingerprintEvidenceId(mc) ?? string.Empty;
				});
			}
			if (GUILayout.Button("Auto-fill Correct Answers", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }))
			{
				Try(delegate
				{
					AutoFillMurderAnswers(ac);
				});
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(6f);
			GUILayout.Label("Resolve Questions", (Il2CppReferenceArray<GUILayoutOption>)null);
			_casesScroll = GUILayout.BeginScrollView(_casesScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) });
			try
			{
				List<ResolveQuestion> resolveQuestions = ac.resolveQuestions;
				if (resolveQuestions == null || resolveQuestions.Count == 0)
				{
					GUILayout.Label("(no resolve questions — click Refresh above)", (Il2CppReferenceArray<GUILayoutOption>)null);
					return;
				}
				for (int i = 0; i < resolveQuestions.Count; i++)
				{
					ResolveQuestion q = resolveQuestions[i];
					if (q == null)
					{
						continue;
					}
					GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>());
					GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
					string text = q.name ?? $"Question {i + 1}";
					string text2 = string.Empty;
					try
					{
						InputType inputType = q.inputType;
						text2 = ((object)(InputType)(ref inputType)).ToString();
					}
					catch
					{
					}
					string text3 = string.Empty;
					try
					{
						text3 = q.inputtedEvidence ?? string.Empty;
					}
					catch
					{
					}
					string text4 = (string.IsNullOrEmpty(text3) ? string.Empty : SafeFormatEvidence(text3));
					if (string.IsNullOrEmpty(text4))
					{
						try
						{
							string text5 = q.input ?? string.Empty;
							if (!string.IsNullOrEmpty(text5))
							{
								text4 = text5;
							}
						}
						catch
						{
						}
					}
					GUILayout.Label(text, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) });
					GUILayout.Label("Type: " + text2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) });
					GUILayout.Label(string.IsNullOrEmpty(text4) ? "Input: (empty)" : ("Input: " + Shorten(text4, 40)), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(260f) });
					if (GUILayout.Button("Clear", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
					{
						Try(delegate
						{
							q.input = string.Empty;
							q.inputtedEvidence = string.Empty;
							if (ac != null)
							{
								ac.OnQuestionProgressChange(q);
							}
						});
					}
					GUILayout.EndHorizontal();
					try
					{
						string text6 = string.Empty;
						string text7 = text2 ?? string.Empty;
						Murder val = (((Object)(object)mc != (Object)null) ? mc.GetCurrentMurder() : null);
						switch (text7)
						{
						case "citizen":
							text6 = GetHumanFullName((val != null) ? val.murderer : (((Object)(object)mc != (Object)null) ? mc.currentMurderer : null));
							break;
						case "location":
							text6 = FormatAddress(GetKillerAddressForQuestion(mc, q));
							break;
						case "item":
						{
							Interactable val2 = ((val != null) ? val.weapon : null);
							text6 = ((val2 != null) ? SafeObjectName(val2.name, $"Item #{TryGetInt(val2.id)}") : string.Empty);
							break;
						}
						}
						if (string.IsNullOrEmpty(text6) && q.correctAnswers != null && q.correctAnswers.Count > 0)
						{
							string text8 = q.correctAnswers[0] ?? string.Empty;
							text6 = (string.IsNullOrEmpty(text8) ? string.Empty : SafeFormatEvidence(text8));
						}
						try
						{
							if ((text2 ?? string.Empty) == "item")
							{
								string text9 = (q.name ?? string.Empty).ToLowerInvariant();
								if (!text9.Contains("weapon") && !text9.Contains("gun") && !text9.Contains("knife"))
								{
									text6 = (string.IsNullOrEmpty(_murdererFingerprintEvidenceId) ? string.Empty : SafeFormatEvidence(_murdererFingerprintEvidenceId));
								}
							}
						}
						catch
						{
						}
						GUILayout.Label(string.IsNullOrEmpty(text6) ? "Correct: (unknown)" : ("Correct hint: " + Shorten(text6, 80)), (Il2CppReferenceArray<GUILayoutOption>)null);
					}
					catch
					{
					}
					GUILayout.EndVertical();
				}
			}
			finally
			{
				GUILayout.EndScrollView();
			}
		}

		private static string Shorten(string s, int max)
		{
			if (string.IsNullOrEmpty(s))
			{
				return s;
			}
			if (s.Length > max)
			{
				return s.Substring(0, max - 1) + "…";
			}
			return s;
		}

		private void AutoFillMurderAnswers(Case ac)
		{
			//IL_00f6: 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)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			if (ac == null)
			{
				return;
			}
			MurderController instance = MurderController._instance;
			GameplayController instance2 = GameplayController._instance;
			if ((Object)(object)instance == (Object)null || (Object)(object)instance2 == (Object)null)
			{
				return;
			}
			try
			{
				instance.UpdateCorrectResolveAnswers();
			}
			catch
			{
			}
			Dictionary<string, Evidence> evidenceDictionary = instance2.evidenceDictionary;
			string text = string.Empty;
			try
			{
				text = FindMurdererFingerprintEvidenceId(instance) ?? string.Empty;
			}
			catch
			{
			}
			try
			{
				List<ResolveQuestion> resolveQuestions = ac.resolveQuestions;
				if (resolveQuestions == null)
				{
					return;
				}
				for (int i = 0; i < resolveQuestions.Count; i++)
				{
					ResolveQuestion val = resolveQuestions[i];
					if (val == null)
					{
						continue;
					}
					bool flag = false;
					try
					{
						if (val.correctAnswers != null)
						{
							for (int j = 0; j < val.correctAnswers.Count; j++)
							{
								string text2 = val.correctAnswers[j];
								if (string.IsNullOrEmpty(text2))
								{
									continue;
								}
								try
								{
									if (evidenceDictionary != null && evidenceDictionary.ContainsKey(text2) && evidenceDictionary[text2] != null)
									{
										val.inputtedEvidence = text2;
										flag = true;
										break;
									}
								}
								catch
								{
								}
							}
						}
					}
					catch
					{
					}
					InputType inputType;
					if (!flag)
					{
						inputType = val.inputType;
						if (((object)(InputType)(ref inputType)).ToString() == "item")
						{
							string text3 = (val.name ?? string.Empty).ToLowerInvariant();
							if (text3.Contains("weapon") || text3.Contains("gun") || text3.Contains("knife"))
							{
								string text4 = TryMapMurderAnswerToEvidenceId(instance, val);
								if (!string.IsNullOrEmpty(text4))
								{
									val.inputtedEvidence = text4;
									flag = true;
								}
							}
						}
						else
						{
							string text5 = TryMapMurderAnswerToEvidenceId(instance, val);
							if (!string.IsNullOrEmpty(text5))
							{
								val.inputtedEvidence = text5;
								flag = true;
							}
						}
					}
					try
					{
						if (!string.IsNullOrEmpty(val.inputtedEvidence))
						{
							val.input = SafeFormatEvidence(val.inputtedEvidence);
						}
					}
					catch
					{
					}
					try
					{
						if (string.IsNullOrEmpty(val.inputtedEvidence))
						{
							inputType = val.inputType;
							if (((object)(InputType)(ref inputType)).ToString() == "location")
							{
								NewAddress killerAddressForQuestion = GetKillerAddressForQuestion(instance, val);
								if ((Object)(object)killerAddressForQuestion != (Object)null)
								{
									val.input = FormatAddress(killerAddressForQuestion);
								}
							}
						}
					}
					catch
					{
					}
					try
					{
						inputType = val.inputType;
						if (((object)(InputType)(ref inputType)).ToString() == "item")
						{
							string text6 = (val.name ?? string.Empty).ToLowerInvariant();
							if (!text6.Contains("weapon") && !text6.Contains("gun") && !text6.Contains("knife") && !string.IsNullOrEmpty(text))
							{
								val.inputtedEvidence = text;
							}
						}
					}
					catch
					{
					}
					try
					{
						ac.OnQuestionProgressChange(val);
					}
					catch
					{
					}
				}
			}
			catch
			{
			}
		}

		private static string TryMapMurderAnswerToEvidenceId(MurderController mc, ResolveQuestion q)
		{
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//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)
			try
			{
				GameplayController instance = GameplayController._instance;
				if ((Object)(object)instance == (Object)null)
				{
					return string.Empty;
				}
				Dictionary<string, Evidence> evidenceDictionary = instance.evidenceDictionary;
				if (evidenceDictionary == null)
				{
					return string.Empty;
				}
				string text = string.Empty;
				try
				{
					if (q.correctAnswers != null && q.correctAnswers.Count > 0)
					{
						text = q.correctAnswers[0] ?? string.Empty;
					}
				}
				catch
				{
				}
				text = ((text != null) ? text.ToLowerInvariant() : string.Empty);
				InputType inputType;
				if (!text.Contains("purp"))
				{
					inputType = q.inputType;
					if (!(((object)(InputType)(ref inputType)).ToString() == "citizen"))
					{
						goto IL_010e;
					}
				}
				Human val = (((Object)(object)mc != (Object)null) ? mc.currentMurderer : null);
				if ((Object)(object)val != (Object)null)
				{
					Enumerator<string, Evidence> enumerator = evidenceDictionary.GetEnumerator();
					while (enumerator.MoveNext())
					{
						KeyValuePair<string, Evidence> current = enumerator.Current;
						try
						{
							Evidence value = current.Value;
							if (value != null && (Object)(object)value.belongsTo == (Object)(object)val)
							{
								return current.Key;
							}
						}
						catch
						{
						}
					}
				}
				goto IL_010e;
				IL_010e:
				inputType = q.inputType;
				if (((object)(InputType)(ref inputType)).ToString() == "item")
				{
					try
					{
						Murder val2 = (((Object)(object)mc != (Object)null) ? mc.GetCurrentMurder() : null);
						Interactable val3 = ((val2 != null) ? val2.weapon : null);
						if (val3 != null)
						{
							Enumerator<string, Evidence> enumerator = evidenceDictionary.GetEnumerator();
							while (enumerator.MoveNext())
							{
								KeyValuePair<string, Evidence> current2 = enumerator.Current;
								try
								{
									Evidence value2 = current2.Value;
									if (value2 != null && value2.interactable == val3)
									{
										return current2.Key;
									}
								}
								catch
								{
								}
							}
						}
					}
					catch
					{
					}
				}
			}
			catch
			{
			}
			return string.Empty;
		}

		private static string SafeFormatEvidence(string evidenceId)
		{
			try
			{
				GameplayController instance = GameplayController._instance;
				if ((Object)(object)instance == (Object)null)
				{
					return evidenceId;
				}
				Dictionary<string, Evidence> evidenceDictionary = instance.evidenceDictionary;
				if (evidenceDictionary == null)
				{
					return evidenceId;
				}
				if (!evidenceDictionary.ContainsKey(evidenceId))
				{
					return evidenceId;
				}
				Evidence val = evidenceDictionary[evidenceId];
				if (val == null)
				{
					return evidenceId;
				}
				try
				{
					string text = ((CaseComponent)val).GenerateName();
					if (!string.IsNullOrEmpty(text))
					{
						return text;
					}
				}
				catch
				{
				}
				try
				{
					if ((Object)(object)val.belongsTo != (Object)null)
					{
						return GetHumanFullName(val.belongsTo);
					}
				}
				catch
				{
				}
				try
				{
					if (val.interactable != null)
					{
						return SafeObjectName(val.interactable.name, $"Item #{TryGetInt(val.interactable.id)}");
					}
				}
				catch
				{
				}
				return evidenceId;
			}
			catch
			{
				return evidenceId;
			}
		}

		private static string GetHumanFullName(Human? h)
		{
			try
			{
				if ((Object)(object)h == (Object)null)
				{
					return string.Empty;
				}
				string obj = h.firstName ?? string.Empty;
				string text = h.surName ?? string.Empty;
				string text2 = (obj + " " + text).Trim();
				if (!string.IsNullOrWhiteSpace(text2))
				{
					return text2;
				}
				string text3 = h.citizenName ?? string.Empty;
				if (!string.IsNullOrWhiteSpace(text3))
				{
					return text3;
				}
			}
			catch
			{
			}
			return "(unknown)";
		}

		private static string SafeObjectName(string candidate, string fallback)
		{
			if (!string.IsNullOrEmpty(candidate))
			{
				return candidate;
			}
			return fallback;
		}

		private static int TryGetInt(int v)
		{
			return v;
		}

		private static string FormatAddress(NewAddress? addr)
		{
			try
			{
				if ((Object)(object)addr == (Object)null)
				{
					return string.Empty;
				}
				string name = ((Object)addr).name;
				if (!string.IsNullOrEmpty(name))
				{
					return name;
				}
				try
				{
					if (addr.company != null && !string.IsNullOrEmpty(addr.company.name))
					{
						return addr.company.name;
					}
				}
				catch
				{
				}
				try
				{
					return $"Address {addr.id}";
				}
				catch
				{
					return "(address)";
				}
			}
			catch
			{
				return string.Empty;
			}
		}

		private static NewAddress? GetKillerAddressForQuestion(MurderController? mc, ResolveQuestion? q)
		{
			try
			{
				Murder val = (((Object)(object)mc != (Object)null) ? mc.GetCurrentMurder() : null);
				Human val2 = ((val != null) ? val.murderer : (((Object)(object)mc != (Object)null) ? mc.currentMurderer : null));
				if ((Object)(object)val2 == (Object)null)
				{
					return null;
				}
				if (((q != null) ? (q.name ?? string.Empty) : string.Empty).ToLowerInvariant().Contains("den") && (Object)(object)val2.den != (Object)null)
				{
					return val2.den;
				}
				if ((Object)(object)val2.home != (Object)null)
				{
					return val2.home;
				}
			}
			catch
			{
			}
			return null;
		}

		private static string? FindMurdererFingerprintEvidenceId(MurderController? mc)
		{
			try
			{
				GameplayController instance = GameplayController._instance;
				if ((Object)(object)instance == (Object)null)
				{
					return null;
				}
				Dictionary<string, Evidence> evidenceDictionary = instance.evidenceDictionary;
				if (evidenceDictionary == null || evidenceDictionary.Count == 0)
				{
					return null;
				}
				Murder val = (((Object)(object)mc != (Object)null) ? mc.GetCurrentMurder() : null);
				Human val2 = ((val != null) ? val.murderer : (((Object)(object)mc != (Object)null) ? mc.currentMurderer : null));
				if ((Object)(object)val2 == (Object)null)
				{
					return null;
				}
				Enumerator<string, Evidence> enumerator = evidenceDictionary.GetEnumerator();
				while (enumerator.MoveNext())
				{
					KeyValuePair<string, Evidence> current = enumerator.Current;
					Evidence value = current.Value;
					if (value == null)
					{
						continue;
					}
					try
					{
						if (!((Object)(object)value.belongsTo == (Object)(object)val2))
						{
							continue;
						}
						bool flag = false;
						try
						{
							if ((SoCustomComparison)(object)value.interactablePreset != (SoCustomComparison)null && !string.IsNullOrEmpty(((Object)value.interactablePreset).name) && ((Object)value.interactablePreset).name.ToLowerInvariant().Contains("finger"))
							{
								flag = true;
							}
						}
						catch
						{
						}
						if (!flag)
						{
							try
							{
								string text = ((CaseComponent)value).GenerateName();
								if (!string.IsNullOrEmpty(text) && text.ToLowerInvariant().Contains("finger"))
								{
									flag = true;
								}
							}
							catch
							{
							}
						}
						if (flag)
						{
							return current.Key;
						}
					}
					catch
					{
					}
				}
			}
			catch
			{
			}
			return null;
		}

		public void Awake()
		{
			((Object)this).hideFlags = (HideFlags)61;
			TryRefreshRefs();
			LoadInitialStateFromGame();
			try
			{
				_uiScale = Plugin.UiScale;
			}
			catch
			{
				_uiScale = 1f;
			}
		}

		public void Update()
		{
			//IL_000b: 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)
			if (!_captureHotkey && Input.GetKeyDown(Plugin.Hotkey))
			{
				if (_lastHotkeyFrame == Time.frameCount)
				{
					return;
				}
				_lastHotkeyFrame = Time.frameCount;
				if (_open || IsInGameScene())
				{
					_open = !_open;
					if (_open)
					{
						TryRefreshRefs();
						LoadInitialStateFromGame();
						if (!_sizedOnOpen)
						{
							float num = ((Plugin.WindowWidth > 0f) ? Plugin.WindowWidth : 0f);
							float num2 = ((Plugin.WindowHeight > 0f) ? Plugin.WindowHeight : 0f);
							if (num > 0f && num2 > 0f)
							{
								((Rect)(ref _windowRect)).width = Mathf.Max(360f, num);
								((Rect)(ref _windowRect)).height = Mathf.Max(240f, num2);
							}
							else
							{
								((Rect)(ref _windowRect)).width = Mathf.Round(((Rect)(ref _windowRect)).width * 1.5f);
							}
							if (Plugin.WindowX >= 0f && Plugin.WindowY >= 0f)
							{
								((Rect)(ref _windowRect)).x = Plugin.WindowX;
								((Rect)(ref _windowRect)).y = Plugin.WindowY;
							}
							else
							{
								CenterWindow();
							}
							_sizedOnOpen = true;
						}
						else if (Plugin.WindowX >= 0f && Plugin.WindowY >= 0f)
						{
							((Rect)(ref _windowRect)).x = Plugin.WindowX;
							((Rect)(ref _windowRect)).y = Plugin.WindowY;
						}
						else
						{
							CenterWindow();
						}
						Try(delegate
						{
							ApplyUiCapture(want: true);
						});
					}
					else
					{
						Try(delegate
						{
							ApplyUiCapture(want: false);
						});
					}
				}
			}
			if (!_open)
			{
				return;
			}
			if (_open && !IsInGameScene())
			{
				_open = false;
				Try(delegate
				{
					ApplyUiCapture(want: false);
				});
				return;
			}
			if (Time.frameCount % 60 == 0)
			{
				TryRefreshRefs();
			}
			if (!_open)
			{
				return;
			}
			if (!Cursor.visible)
			{
				Cursor.visible = true;
			}
			if ((int)Cursor.lockState != 0)
			{
				Cursor.lockState = (CursorLockMode)0;
			}
			try
			{
				KtcEnsureAllDoors();
			}
			catch
			{
			}
		}

		public void OnGUI()
		{
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_0447: Invalid comparison between Unknown and I4
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Invalid comparison between Unknown and I4
			//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c5: Invalid comparison between Unknown and I4
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: 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_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Invalid comparison between Unknown and I4
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Invalid comparison between Unknown and I4
			//IL_0453: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Invalid comparison between Unknown and I4
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Invalid comparison between Unknown and I4
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: 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_016e: Invalid comparison between Unknown and I4
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Invalid comparison between Unknown and I4
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: 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_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			if (!_open)
			{
				return;
			}
			if (!IsInGameScene())
			{
				_open = false;
				Try(delegate
				{
					ApplyUiCapture(want: false);
				});
				return;
			}
			GUI.depth = 0;
			if (_cachedBox == null)
			{
				_cachedBox = new GUIStyle(GUI.skin.box);
			}
			GUIStyle window = GUI.skin.window;
			GUI.Box(_windowRect, "Shadows of Doubt Debug Menu", window);
			RectOffset padding = window.padding;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref _windowRect)).x + (float)padding.left, ((Rect)(ref _windowRect)).y + (float)padding.top, ((Rect)(ref _windowRect)).width - (float)(padding.left + padding.right), ((Rect)(ref _windowRect)).height - (float)(padding.top + padding.bottom));
			Matrix4x4 matrix = GUI.matrix;
			float num = Mathf.Clamp(Plugin.UiScale, 0.8f, 2f);
			GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(num, num, 1f)) * GUI.matrix;
			GUILayout.BeginArea(new Rect(((Rect)(ref val)).x / num, ((Rect)(ref val)).y / num, ((Rect)(ref val)).width / num, ((Rect)(ref val)).height / num));
			Event current = Event.current;
			if (current != null && _captureHotkey && (int)current.type == 4)
			{
				if ((int)current.keyCode == 27)
				{
					_captureHotkey = false;
					current.Use();
				}
				else if ((int)current.keyCode != 0)
				{
					try
					{
						if (Plugin.HotkeyEntry != null)
						{
							Plugin.HotkeyEntry.Value = current.keyCode;
						}
						Plugin.SaveConfigSafe();
					}
					catch
					{
					}
					_captureHotkey = false;
					current.Use();
				}
			}
			if (current != null && (int)current.type == 4 && (int)current.keyCode == 27 && !_captureHotkey)
			{
				DoClose();
				current.Use();
				GUILayout.EndArea();
				return;
			}
			if (current != null && (int)current.type == 4 && current.keyCode == Plugin.Hotkey && !_captureHotkey && _lastHotkeyFrame != Time.frameCount)
			{
				_lastHotkeyFrame = Time.frameCount;
				DoClose();
				current.Use();
				GUILayout.EndArea();
				return;
			}
			DrawHeaderBar();
			_contentScroll = GUILayout.BeginScrollView(_contentScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) });
			DrawBody();
			GUILayout.EndScrollView();
			GUILayout.EndArea();
			GUI.matrix = matrix;
			Event current2 = Event.current;
			float num2 = Mathf.Max(20f, (float)padding.top);
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(((Rect)(ref _windowRect)).x, ((Rect)(ref _windowRect)).y, ((Rect)(ref _windowRect)).width, num2);
			if ((int)current2.type == 0 && ((Rect)(ref val2)).Contains(current2.mousePosition))
			{
				_dragging = true;
				_dragStartMouse = current2.mousePosition;
				_dragStartPos = ((Rect)(ref _windowRect)).position;
				current2.Use();
			}
			else if ((int)current2.type == 3 && _dragging)
			{
				Vector2 val3 = current2.mousePosition - _dragStartMouse;
				((Rect)(ref _windowRect)).position = _dragStartPos + val3;
				current2.Use();
			}
			else if ((int)current2.type == 1 && _dragging)
			{
				_dragging = false;
				current2.Use();
				try
				{
					if (Plugin.WindowXEntry != null)
					{
						Plugin.WindowXEntry.Value = ((Rect)(ref _windowRect)).x;
					}
					if (Plugin.WindowYEntry != null)
					{
						Plugin.WindowYEntry.Value = ((Rect)(ref _windowRect)).y;
					}
					Plugin.SaveConfigSafe();
				}
				catch
				{
				}
			}
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(((Rect)(ref _windowRect)).xMax - 16f, ((Rect)(ref _windowRect)).yMax - 16f, 16f, 16f);
			DrawCornerHandle(r);
			if ((int)current2.type == 0 && ((Rect)(ref r)).Contains(current2.mousePosition))
			{
				_resizing = true;
				_resizeStartMouse = current2.mousePosition;
				_resizeStartSize = new Vector2(((Rect)(ref _windowRect)).width, ((Rect)(ref _windowRect)).height);
				current2.Use();
			}
			else if ((int)current2.type == 3 && _resizing)
			{
				Vector2 val4 = current2.mousePosition - _resizeStartMouse;
				((Rect)(ref _windowRect)).width = Mathf.Max(360f, _resizeStartSize.x + val4.x);
				((Rect)(ref _windowRect)).height = Mathf.Max(240f, _resizeStartSize.y + val4.y);
				current2.Use();
			}
			else
			{
				if ((int)current2.type != 1 || !_resizing)
				{
					return;
				}
				_resizing = false;
				current2.Use();
				try
				{
					if (Plugin.WindowWidthEntry != null)
					{
						Plugin.WindowWidthEntry.Value = ((Rect)(ref _windowRect)).width;
					}
					if (Plugin.WindowHeightEntry != null)
					{
						Plugin.WindowHeightEntry.Value = ((Rect)(ref _windowRect)).height;
					}
					Plugin.SaveConfigSafe();
				}
				catch
				{
				}
			}
		}

		private void TryRefreshRefs()
		{
			if (_sd == null)
			{
				_sd = SessionData._instance;
			}
			if (_gc == null)
			{
				_gc = GameplayController._instance;
			}
			if (_ic == null)
			{
				_ic = InteractionController._instance;
			}
			if (_assets == null)
			{
				_assets = AssetLoader.instance;
			}
			if ((Object)(object)_player == (Object)null)
			{
				_player = Object.FindObjectOfType<Player>();
			}
			if ((Object)(object)_game == (Object)null)
			{
				_game = Object.FindObjectOfType<Game>();
			}
			if (_spawnPresets.Count != 0 || _assets == null)
			{
				return;
			}
			try
			{
				List<InteractablePreset> allInteractables = _assets.GetAllInteractables();
				if (allInteractables == null)
				{
					return;
				}
				_spawnPresets.Clear();
				Enumerator<InteractablePreset> enumerator = allInteractables.GetEnumerator();
				while (enumerator.MoveNext())
				{
					InteractablePreset current = enumerator.Current;
					try
					{
						if ((SoCustomComparison)(object)current != (SoCustomComparison)null && current.spawnable)
						{
							_spawnPresets.Add(current);
						}
					}
					catch
					{
					}
				}
			}
			catch
			{
			}
		}

		private void LoadInitialStateFromGame()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected I4, but got Unknown
			try
			{
				if ((Object)(object)_sd != (Object)null)
				{
					_timeMultiplier = _sd.currentTimeMultiplier;
					_timeSpeedEnum = (int)_sd.currentTimeSpeed;
					try
					{
						_rain = _sd.currentRain;
						_wind = _sd.currentWind;
						_snow = _sd.currentSnow;
						_lightning = _sd.currentLightning;
						_fog = _sd.currentFog;
					}
					catch
					{
					}
				}
				if ((Object)(object)_game != (Object)null)
				{
					_invincible = _game.invinciblePlayer;
					try
					{
						_weatherFreq = _game.weatherChangeFrequency;
						return;
					}
					catch
					{
						return;
					}
				}
			}
			catch
			{
			}
		}

		private void DoClose()
		{
			_open = false;
			Try(delegate
			{
				ApplyUiCapture(want: false);
			});
		}

		private void CenterWindow()
		{
			float x = Mathf.Round(((float)Screen.width - ((Rect)(ref _windowRect)).width) * 0.5f);
			float y = Mathf.Round(((float)Screen.height - ((Rect)(ref _windowRect)).height) * 0.5f);
			((Rect)(ref _windowRect)).x = x;
			((Rect)(ref _windowRect)).y = y;
		}

		private static bool IsInGameScene()
		{
			try
			{
				foreach (Canvas item in Object.FindObjectsOfType<Canvas>())
				{
					if (!((Object)(object)item == (Object)null))
					{
						GameObject gameObject = ((Component)item).gameObject;
						if (!((Object)(object)gameObject == (Object)null) && gameObject.activeInHierarchy && (((Object)gameObject).name ?? string.Empty).IndexOf("MenuCanvas", StringComparison.OrdinalIgnoreCase) >= 0)
						{
							return false;
						}
					}
				}
			}
			catch
			{
			}
			try
			{
				return (Object)(object)Object.FindObjectOfType<Player>() != (Object)null;
			}
			catch
			{
				return false;
			}
		}

		private static void Try(Action act)
		{
			try
			{
				act();
			}
			catch (Exception value)
			{
				Debug.LogError(Object.op_Implicit($"[DebugMenu] {value}"));
			}
		}

		private static float SliderRow(string label, float value)
		{
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label(label + ":", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) });
			value = GUILayout.HorizontalSlider(value, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) });
			GUILayout.Label(value.ToString("F2"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) });
			GUILayout.EndHorizontal();
			return value;
		}

		private static float FloatField(string label, float value, float width)
		{
			GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(24f) });
			if (float.TryParse(GUILayout.TextField(value.ToString("F2"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(width) }), out var result))
			{
				value = result;
			}
			return value;
		}

		private static int IntField(string label, int value, float labelWidth, float fieldWidth)
		{
			GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(labelWidth) });
			if (int.TryParse(GUILayout.TextField(value.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(fieldWidth) }), out var result))
			{
				value = result;
			}
			return value;
		}

		private static List<InteractablePreset> FilterPresets(List<InteractablePreset> source, string query)
		{
			if (source == null)
			{
				return new List<InteractablePreset>();
			}
			if (string.IsNullOrWhiteSpace(query))
			{
				return source;
			}
			query = query.ToLowerInvariant();
			List<InteractablePreset> list = new List<InteractablePreset>();
			foreach (InteractablePreset item in source)
			{
				try
				{
					if (!((SoCustomComparison)(object)item == (SoCustomComparison)null) && (((Object)item).name?.ToLowerInvariant() ?? string.Empty).Contains(query))
					{
						list.Add(item);
					}
				}
				catch
				{
				}
			}
			return list;
		}

		private static void DrawCornerHandle(Rect r)
		{
			//IL_0000: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: 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)
			Color color = GUI.color;
			GUI.color = new Color(1f, 1f, 1f, 0.3f);
			GUI.Box(r, GUIContent.none);
			GUI.color = new Color(1f, 1f, 1f, 0.6f);
			GUI.Label(new Rect(((Rect)(ref r)).x + ((Rect)(ref r)).width - 12f, ((Rect)(ref r)).y + ((Rect)(ref r)).height - 6f, 10f, 2f), GUIContent.none, GUI.skin.box);
			GUI.Label(new Rect(((Rect)(ref r)).x + ((Rect)(ref r)).width - 10f, ((Rect)(ref r)).y + ((Rect)(ref r)).height - 10f, 8f, 2f), GUIContent.none, GUI.skin.box);
			GUI.Label(new Rect(((Rect)(ref r)).x + ((Rect)(ref r)).width - 6f, ((Rect)(ref r)).y + ((Rect)(ref r)).height - 12f, 6f, 2f), GUIContent.none, GUI.skin.box);
			GUI.color = color;
		}

		private void ApplyUiCapture(bool want)
		{
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			InterfaceController val = Object.FindObjectOfType<InterfaceController>();
			Player val2 = (Player)(((Object)(object)_player != (Object)null) ? ((object)_player) : ((object)Object.FindObjectOfType<Player>()));
			if (want)
			{
				_uiPrevCursorVisible = Cursor.visible;
				_uiPrevCursorLock = Cursor.lockState;
				try
				{
					if ((Object)(object)val != (Object)null)
					{
						_uiPrevCrosshair = val.crosshairVisible;
						_uiPrevTextInput = val.playerTextInputActive;
						try
						{
							val.SetPlayerTextInput(true);
						}
						catch
						{
							val.playerTextInputActive = true;
						}
						try
						{
							val.SetCrosshairVisible(false);
						}
						catch
						{
							val.crosshairVisible = false;
						}
						try
						{
							if (!val.desktopMode)
							{
								val.SetDesktopMode(true, false);
								_uiSetDesktop = true;
							}
						}
						catch
						{
							_uiSetDesktop = false;
						}
					}
				}
				catch
				{
				}
				try
				{
					SessionData? sd = _sd;
					if (sd != null)
					{
						sd.PauseGame(false, true, false);
					}
					_uiPaused = true;
				}
				catch
				{
					_uiPaused = false;
				}
				try
				{
					if ((Object)(object)val2 != (Object)null)
					{
						val2.EnablePlayerMovement(false, true);
						val2.EnablePlayerMouseLook(false, false);
						_uiDisabledMove = true;
					}
				}
				catch
				{
					_uiDisabledMove = false;
				}
				Cursor.visible = true;
				Cursor.lockState = (CursorLockMode)0;
				return;
			}
			try
			{
				if ((Object)(object)val != (Object)null && _uiSetDesktop && val.desktopMode)
				{
					val.SetDesktopMode(false, false);
				}
			}
			catch
			{
			}
			_uiSetDesktop = false;
			try
			{
				if ((Object)(object)val != (Object)null)
				{
					try
					{
						val.SetPlayerTextInput(_uiPrevTextInput);
					}
					catch
					{
						val.playerTextInputActive = _uiPrevTextInput;
					}
					try
					{
						val.SetCrosshairVisible(_uiPrevCrosshair);
					}
					catch
					{
						val.crosshairVisible = _uiPrevCrosshair;
					}
				}
			}
			catch
			{
			}
			try
			{
				if (_uiPaused)
				{
					SessionData? sd2 = _sd;
					if (sd2 != null)
					{
						sd2.ResumeGame();
					}
				}
			}
			catch
			{
			}
			_uiPaused = false;
			try
			{
				if ((Object)(object)val2 != (Object)null && _uiDisabledMove)
				{
					val2.EnablePlayerMovement(true, true);
					val2.EnablePlayerMouseLook(true, false);
				}
			}
			catch
			{
			}
			_uiDisabledMove = false;
			Cursor.visible = _uiPrevCursorVisible;
			Cursor.lockState = _uiPrevCursorLock;
		}

		private void DrawDebugSettings()
		{
			GUILayout.Label("Settings", (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>());
			GUILayout.Label("UI Scale", (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label("Scale:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
			_uiScale = Plugin.UiScale;
			float uiScale = _uiScale;
			_uiScale = GUILayout.HorizontalSlider(_uiScale, 0.8f, 2f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) });
			GUILayout.Label(_uiScale.ToString("F2"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) });
			if (GUILayout.Button("Reset", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }))
			{
				_uiScale = 1f;
			}
			if (!Mathf.Approximately(uiScale, _uiScale))
			{
				try
				{
					if (Plugin.UiScaleEntry != null)
					{
						Plugin.UiScaleEntry.Value = _uiScale;
					}
					Plugin.SaveConfigSafe();
				}
				catch
				{
				}
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(8f);
			GUILayout.Label("Hotkey", (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label("Key:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
			GUILayout.Label(((object)(KeyCode)(ref Plugin.Hotkey)).ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) });
			if (!_captureHotkey)
			{
				if (GUILayout.Button("Change", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }))
				{
					_captureHotkey = true;
				}
			}
			else
			{
				GUILayout.Label("Listening... press any key", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
				if (GUILayout.Button("Cancel", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
				{
					_captureHotkey = false;
				}
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
		}

		private static void CommitIntBuffer(ref string buf, ref int value)
		{
			try
			{
				if (!string.IsNullOrEmpty(buf) && int.TryParse(buf, out var result))
				{
					value = result;
				}
				else
				{
					buf = value.ToString();
				}
			}
			catch
			{
			}
		}

		private void DrawEconomy()
		{
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Invalid comparison between Unknown and I4
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Invalid comparison between Unknown and I4
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Invalid comparison between Unknown and I4
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Invalid comparison between Unknown and I4
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Invalid comparison between Unknown and I4
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Invalid comparison between Unknown and I4
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Invalid comparison between Unknown and I4
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Invalid comparison between Unknown and I4
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Invalid comparison between Unknown and I4
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_049f: Invalid comparison between Unknown and I4
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Invalid comparison between Unknown and I4
			//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Invalid comparison between Unknown and I4
			//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Invalid comparison between Unknown and I4
			//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e9: Invalid comparison between Unknown and I4
			//IL_05ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f7: Invalid comparison between Unknown and I4
			//IL_0717: Unknown result type (might be due to invalid IL or missing references)
			//IL_071d: Invalid comparison between Unknown and I4
			//IL_0721: Unknown result type (might be due to invalid IL or missing references)
			//IL_0728: Invalid comparison between Unknown and I4
			//IL_072c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0736: Invalid comparison between Unknown and I4
			GUILayout.Label("Economy", (Il2CppReferenceArray<GUILayoutOption>)null);
			Try(delegate
			{
				int value = 0;
				bool flag14 = false;
				int value2 = -1;
				bool flag15 = false;
				int value3 = -1;
				bool flag16 = false;
				try
				{
					if ((Object)(object)_gc != (Object)null)
					{
						value = _gc.money;
						flag14 = true;
					}
				}
				catch
				{
				}
				try
				{
					if ((Object)(object)_gc != (Object)null)
					{
						value2 = _gc.GetCurrentSocialCreditLevel();
						flag15 = true;
					}
				}
				catch
				{
				}
				try
				{
					if ((Object)(object)_gc != (Object)null)
					{
						value3 = _gc.GetNextSocialCreditLevelThreshold();
						flag16 = true;
					}
				}
				catch
				{
				}
				GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.Label(flag14 ? $"Money: {value}" : "Money: ?", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) });
				GUILayout.Label(flag15 ? $"SC Level: {value2}" : "SC Level: ?", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) });
				GUILayout.Label(flag16 ? $"Next SC Threshold: {value3}" : "Next SC Threshold: ?", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) });
				GUILayout.FlexibleSpace();
				GUILayout.EndHorizontal();
			});
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			if (!_moneyDeltaInit)
			{
				_moneyDeltaBuf = _moneyDelta.ToString();
				_moneyDeltaInit = true;
			}
			GUILayout.Label("Add Money ", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
			GUI.SetNextControlName("dm_money_add");
			string text = GUILayout.TextField(_moneyDeltaBuf, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
			if (!Object.ReferenceEquals(Object.op_Implicit(text), Object.op_Implicit(_moneyDeltaBuf)))
			{
				_moneyDeltaBuf = text;
			}
			bool flag = GUI.GetNameOfFocusedControl() == "dm_money_add";
			bool flag2 = false;
			Event current = Event.current;
			if (_moneyDeltaEditing && !flag)
			{
				flag2 = true;
			}
			if (current != null && (int)current.type == 4 && ((int)current.keyCode == 13 || (int)current.keyCode == 271) && flag)
			{
				flag2 = true;
			}
			_moneyDeltaEditing = flag;
			if (flag2)
			{
				CommitIntBuffer(ref _moneyDeltaBuf, ref _moneyDelta);
			}
			if (GUILayout.Button("Add Money", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }))
			{
				Try(delegate
				{
					CommitIntBuffer(ref _moneyDeltaBuf, ref _moneyDelta);
					GameplayController? gc6 = _gc;
					if (gc6 != null)
					{
						gc6.AddMoney(_moneyDelta, true, "DebugMenu");
					}
				});
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			if (!_moneyDeductInit)
			{
				_moneyDeductBuf = _moneyDeduct.ToString();
				_moneyDeductInit = true;
			}
			GUILayout.Label("Deduct Money ", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
			GUI.SetNextControlName("dm_money_deduct");
			string text2 = GUILayout.TextField(_moneyDeductBuf, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
			if (!Object.ReferenceEquals(Object.op_Implicit(text2), Object.op_Implicit(_moneyDeductBuf)))
			{
				_moneyDeductBuf = text2;
			}
			bool flag3 = GUI.GetNameOfFocusedControl() == "dm_money_deduct";
			bool flag4 = false;
			Event current2 = Event.current;
			if (_moneyDeductEditing && !flag3)
			{
				flag4 = true;
			}
			if (current2 != null && (int)current2.type == 4 && ((int)current2.keyCode == 13 || (int)current2.keyCode == 271) && flag3)
			{
				flag4 = true;
			}
			_moneyDeductEditing = flag3;
			if (flag4)
			{
				CommitIntBuffer(ref _moneyDeductBuf, ref _moneyDeduct);
			}
			if (GUILayout.Button("Deduct Money", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }))
			{
				Try(delegate
				{
					CommitIntBuffer(ref _moneyDeductBuf, ref _moneyDeduct);
					GameplayController? gc5 = _gc;
					if (gc5 != null)
					{
						gc5.AddMoney(-Mathf.Abs(_moneyDeduct), true, "DebugMenu");
					}
				});
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			if (!_scDeltaInit)
			{
				_scDeltaBuf = _scDelta.ToString();
				_scDeltaInit = true;
			}
			GUILayout.Label("Add SC ", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
			GUI.SetNextControlName("dm_sc_add");
			string text3 = GUILayout.TextField(_scDeltaBuf, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
			if (!Object.ReferenceEquals(Object.op_Implicit(text3), Object.op_Implicit(_scDeltaBuf)))
			{
				_scDeltaBuf = text3;
			}
			bool flag5 = GUI.GetNameOfFocusedControl() == "dm_sc_add";
			bool flag6 = false;
			Event current3 = Event.current;
			if (_scDeltaEditing && !flag5)
			{
				flag6 = true;
			}
			if (current3 != null && (int)current3.type == 4 && ((int)current3.keyCode == 13 || (int)current3.keyCode == 271) && flag5)
			{
				flag6 = true;
			}
			_scDeltaEditing = flag5;
			if (flag6)
			{
				CommitIntBuffer(ref _scDeltaBuf, ref _scDelta);
			}
			if (GUILayout.Button("Add Social Credit", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }))
			{
				Try(delegate
				{
					CommitIntBuffer(ref _scDeltaBuf, ref _scDelta);
					GameplayController? gc4 = _gc;
					if (gc4 != null)
					{
						gc4.AddSocialCredit(_scDelta, true, "DebugMenu");
					}
				});
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			if (!_scDeductInit)
			{
				_scDeductBuf = _scDeduct.ToString();
				_scDeductInit = true;
			}
			GUILayout.Label("Deduct SC ", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
			GUI.SetNextControlName("dm_sc_deduct");
			string text4 = GUILayout.TextField(_scDeductBuf, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
			if (!Object.ReferenceEquals(Object.op_Implicit(text4), Object.op_Implicit(_scDeductBuf)))
			{
				_scDeductBuf = text4;
			}
			bool flag7 = GUI.GetNameOfFocusedControl() == "dm_sc_deduct";
			bool flag8 = false;
			Event current4 = Event.current;
			if (_scDeductEditing && !flag7)
			{
				flag8 = true;
			}
			if (current4 != null && (int)current4.type == 4 && ((int)current4.keyCode == 13 || (int)current4.keyCode == 271) && flag7)
			{
				flag8 = true;
			}
			_scDeductEditing = flag7;
			if (flag8)
			{
				CommitIntBuffer(ref _scDeductBuf, ref _scDeduct);
			}
			if (GUILayout.Button("Deduct Social Credit", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }))
			{
				Try(delegate
				{
					CommitIntBuffer(ref _scDeductBuf, ref _scDeduct);
					GameplayController? gc3 = _gc;
					if (gc3 != null)
					{
						gc3.AddSocialCredit(-Mathf.Abs(_scDeduct), true, "DebugMenu");
					}
				});
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			if (!_lpDeltaInit)
			{
				_lpDeltaBuf = _lockpicksDelta.ToString();
				_lpDeltaInit = true;
			}
			GUILayout.Label("Add LP ", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
			GUI.SetNextControlName("dm_lp_add");
			string text5 = GUILayout.TextField(_lpDeltaBuf, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
			if (!Object.ReferenceEquals(Object.op_Implicit(text5), Object.op_Implicit(_lpDeltaBuf)))
			{
				_lpDeltaBuf = text5;
			}
			bool flag9 = GUI.GetNameOfFocusedControl() == "dm_lp_add";
			bool flag10 = false;
			Event current5 = Event.current;
			if (_lpDeltaEditing && !flag9)
			{
				flag10 = true;
			}
			if (current5 != null && (int)current5.type == 4 && ((int)current5.keyCode == 13 || (int)current5.keyCode == 271) && flag9)
			{
				flag10 = true;
			}
			_lpDeltaEditing = flag9;
			if (flag10)
			{
				CommitIntBuffer(ref _lpDeltaBuf, ref _lockpicksDelta);
			}
			if (GUILayout.Button("Add Lockpicks", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }))
			{
				Try(delegate
				{
					CommitIntBuffer(ref _lpDeltaBuf, ref _lockpicksDelta);
					GameplayController? gc2 = _gc;
					if (gc2 != null)
					{
						gc2.AddLockpicks(_lockpicksDelta, true);
					}
				});
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			if (!_lpDeductInit)
			{
				_lpDeductBuf = _lockpicksDeduct.ToString();
				_lpDeductInit = true;
			}
			GUILayout.Label("Deduct LP ", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) });
			GUI.SetNextControlName("dm_lp_deduct");
			string text6 = GUILayout.TextField(_lpDeductBuf, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) });
			if (!Object.ReferenceEquals(Object.op_Implicit(text6), Object.op_Implicit(_lpDeductBuf)))
			{
				_lpDeductBuf = text6;
			}
			bool flag11 = GUI.GetNameOfFocusedControl() == "dm_lp_deduct";
			bool flag12 = false;
			Event current6 = Event.current;
			if (_lpDeductEditing && !flag11)
			{
				flag12 = true;
			}
			if (current6 != null && (int)current6.type == 4 && ((int)current6.keyCode == 13 || (int)current6.keyCode == 271) && flag11)
			{
				flag12 = true;
			}
			_lpDeductEditing = flag11;
			if (flag12)
			{
				CommitIntBuffer(ref _lpDeductBuf, ref _lockpicksDeduct);
			}
			if (GUILayout.Button("Deduct Lockpicks", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }))
			{
				Try(delegate
				{
					CommitIntBuffer(ref _lpDeductBuf, ref _lockpicksDeduct);
					GameplayController? gc = _gc;
					if (gc != null)
					{
						gc.AddLockpicks(-Mathf.Abs(_lockpicksDeduct), true);
					}
				});
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(6f);
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			if (GUILayout.Button("Grant Next SC Level", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }))
			{
				Try(delegate
				{
					if ((Object)(object)_gc != (Object)null)
					{
						int num = 0;
						int num2 = 0;
						int num3 = 0;
						try
						{
							num = _gc.GetCurrentSocialCreditLevel();
						}
						catch
						{
						}
						try
						{
							num2 = _gc.GetNextSocialCreditLevelThreshold();
						}
						catch
						{
						}
						try
						{
							num3 = _gc.GetSocialCreditThresholdForLevel(num);
						}
						catch
						{
						}
						int num4 = num2 - num3;
						if (num4 <= 0)
						{
							num4 = 1;
						}
						_gc.AddSocialCredit(num4, true, "DebugMenu");
					}
				});
			}
			bool flag13 = false;
			try
			{
				if ((Object)(object)_game != (Object)null)
				{
					flag13 = _game.allowSocialCreditPerks;
				}
			}
			catch
			{
			}
			bool newPerks = GUILayout.Toggle(flag13, "Allow Social Credit Perks", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) });
			if (newPerks != flag13)
			{
				Try(delegate
				{
					if ((Object)(object)_game != (Object)null)
					{
						_game.allowSocialCreditPerks = newPerks;
					}
				});
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
		}

		private void DrawHeaderBar()
		{
			try
			{
				GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
				if (GUILayout.Toggle(_tabIndex == 0, "Player", GUI.skin.button, (Il2CppReferenceArray<GUILayoutOption>)null))
				{
					_tabIndex = 0;
				}
				if (GUILayout.Toggle(_tabIndex == 1, "Sync Disk Manager", GUI.skin.button, (Il2CppReferenceArray<GUILayoutOption>)null))
				{
					_tabIndex = 1;
				}
				if (GUILayout.Toggle(_tabIndex == 2, "Murder & Kidnap Cases", GUI.skin.button, (Il2CppReferenceArray<GUILayoutOption>)null))
				{
					_tabIndex = 2;
				}
				if (GUILayout.Toggle(_tabIndex == 3, "Item Spawning", GUI.skin.button, (Il2CppReferenceArray<GUILayoutOption>)null))
				{
					_tabIndex = 3;
				}
				if (GUILayout.Toggle(_tabIndex == 4, "Time & Weather", GUI.skin.button, (Il2CppReferenceArray<GUILayoutOption>)null))
				{
					_tabIndex = 4;
				}
				if (GUILayout.Toggle(_tabIndex == 5, "Settings", GUI.skin.button, (Il2CppReferenceArray<GUILayoutOption>)null))
				{
					_tabIndex = 5;
				}
				GUILayout.FlexibleSpace();
				if (GUILayout.Button("Center", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
				{
					CenterWindow();
				}
				if (GUILayout.Button("Close", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
				{
					DoClose();
				}
				GUILayout.EndHorizontal();
			}
			catch (Exception ex)
			{
				GUILayout.Label("Header error: " + ex.Message, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
		}

		private void DrawBody()
		{
			try
			{
				GUILayout.Space(6f);
				GUILayout.BeginVertical((GUIStyle)((_cachedBox != null) ? ((object)_cachedBox) : ((object)GUI.skin.box)), Array.Empty<GUILayoutOption>());
				switch (_tabIndex)
				{
				case 0:
					DrawPlayer();
					break;
				case 1:
					DrawSyncDiskManager();
					break;
				case 2:
					DrawCases();
					break;
				case 3:
					DrawItemSpawning();
					break;
				case 4:
					DrawTimeWeather();
					break;
				case 5:
					DrawDebugSettings();
					break;
				default:
					GUILayout.Label("Unknown tab", (Il2CppReferenceArray<GUILayoutOption>)null);
					break;
				}
				GUILayout.EndVertical();
			}
			catch (Exception ex)
			{
				GUILayout.Label("Error drawing body: " + ex.Message, (Il2CppReferenceArray<GUILayoutOption>)null);
			}
		}

		private void DrawItemSpawning()
		{
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Invalid comparison between Unknown and I4
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Invalid comparison between Unknown and I4
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Invalid comparison between Unknown and I4
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("Item Spawning", (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label("Search:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
			_spawnSearch = GUILayout.TextField(_spawnSearch ?? string.Empty, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) });
			if (GUILayout.Button("Refresh", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
			{
				_spawnPresets.Clear();
				_assets = null;
				TryRefreshRefs();
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			_spawnOnlyInventory = GUILayout.Toggle(_spawnOnlyInventory, "Only inventory", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) });
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Label("Count:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (!_spawnCountBufInitialized)
			{
				_spawnCountBuf = _spawnCount.ToString();
				_spawnCountBufInitialized = true;
			}
			GUI.SetNextControlName("dm_spawn_count");
			string text = GUILayout.TextField(_spawnCountBuf, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
			if (!Object.ReferenceEquals(Object.op_Implicit(text), Object.op_Implicit(_spawnCountBuf)))
			{
				_spawnCountBuf = text;
			}
			bool flag = GUI.GetNameOfFocusedControl() == "dm_spawn_count";
			bool flag2 = false;
			Event current = Event.current;
			if (_spawnCountEditing && !flag)
			{
				flag2 = true;
			}
			if (current != null && (int)current.type == 4 && ((int)current.keyCode == 13 || (int)current.keyCode == 271) && flag)
			{
				flag2 = true;
			}
			_spawnCountEditing = flag;
			if (flag2)
			{
				if (int.TryParse(_spawnCountBuf, out var result))
				{
					_spawnCount = Mathf.Max(1, result);
				}
				else
				{
					_spawnCountBuf = _spawnCount.ToString();
				}
			}
			GUILayout.Space(8f);
			GUILayout.Label("Ahead:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			_spawnDistance = Mathf.Clamp(GUILayout.HorizontalSlider(_spawnDistance, 0.2f, 3f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }), 0.2f, 3f);
			GUILayout.Label(_spawnDistance.ToString("F1"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) });
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			List<InteractablePreset> source = FilterPresets(_spawnPresets, _spawnSearch);
			source = ApplyItemSpawningFilters(source, _spawnOnlyInventory);
			_spawnScroll = GUILayout.BeginScrollView(_spawnScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(320f) });
			List<InteractablePreset> list = source;
			if (list == null)
			{
				list = new List<InteractablePreset>();
			}
			int count = list.Count;
			if (((Event.current == null) ? 7 : ((int)Event.current.type)) == 8)
			{
				int num = ((count > 0) ? Mathf.Clamp((int)(_spawnScroll.y / 28f), 0, count - 1) : 0);
				int spawnVirtCount = Mathf.Clamp(Mathf.CeilToInt(11.428572f) + 2, 0, Mathf.Max(0, count - num));
				_spawnVirtFirst = num;
				_spawnVirtCount = spawnVirtCount;
				_spawnVirtTotal = count;
			}
			int num2 = Mathf.Clamp(_spawnVirtFirst, 0, Mathf.Max(0, count - 1));
			int num3 = Mathf.Clamp(_spawnVirtCount, 0, Mathf.Max(0, count - num2));
			if (num2 > 0)
			{
				GUILayout.Space((float)num2 * 28f);
			}
			for (int i = 0; i < num3; i++)
			{
				int num4 = num2 + i;
				if (num4 < 0 || num4 >= count || num4 < 0 || num4 >= list.Count)
				{
					break;
				}
				InteractablePreset p = list[num4];
				if ((SoCustomComparison)(object)p == (SoCustomComparison)null)
				{
					continue;
				}
				GUILayout.BeginHorizontal(GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) });
				GUILayout.Label(((Object)p).name ?? string.Empty, (Il2CppReferenceArray<GUILayoutOption>)null);
				GUILayout.FlexibleSpace();
				if (GUILayout.Button("Spawn", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }))
				{
					Try(delegate
					{
						CommitSpawnCount();
						SpawnPreset(p, worldOnly: true);
					});
				}
				bool flag3 = false;
				try
				{
					flag3 = p.isInventoryItem;
				}
				catch
				{
					flag3 = false;
				}
				bool enabled = GUI.enabled;
				GUI.enabled = enabled && flag3;
				if (GUILayout.Button("In Inv", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }))
				{
					Try(delegate
					{
						CommitSpawnCount();
						SpawnPreset(p, worldOnly: false);
					});
				}
				GUI.enabled = enabled;
				GUILayout.EndHorizontal();
			}
			int num5 = Mathf.Max(0, count - (num2 + num3));
			if (num5 > 0)
			{
				GUILayout.Space((float)num5 * 28f);
			}
			GUILayout.EndScrollView();
		}

		private static List<InteractablePreset> ApplyItemSpawningFilters(List<InteractablePreset> source, bool onlyInventory)
		{
			List<InteractablePreset> list = new List<InteractablePreset>();
			foreach (InteractablePreset item in source)
			{
				if ((SoCustomComparison)(object)item == (SoCustomComparison)null)
				{
					continue;
				}
				try
				{
					if (item.spawnable && (!onlyInventory || item.isInventoryItem))
					{
						list.Add(item);
					}
				}
				catch
				{
				}
			}
			return list;
		}

		private void SpawnPreset(InteractablePreset preset, bool worldOnly)
		{
			//IL_005c: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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)
			CommitSpawnCount();
			if (!worldOnly)
			{
				int num = Mathf.Max(1, _spawnCount);
				for (int i = 0; i < num; i++)
				{
					try
					{
						preset.SpawnIntoInventory();
					}
					catch
					{
					}
				}
				return;
			}
			InteractableCreator instance = InteractableCreator._instance;
			if ((Object)(object)instance == (Object)null || (Object)(object)_player == (Object)null)
			{
				return;
			}
			for (int j = 0; j < Mathf.Max(1, _spawnCount); j++)
			{
				Vector3 val = ((Component)_player).transform.position + ((Component)_player).transform.forward * _spawnDistance;
				Quaternion rotation = ((Component)_player).transform.rotation;
				Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
				try
				{
					instance.CreateWorldInteractable(preset, (Human)null, (Human)null, (Human)null, val, eulerAngles, (List<Passed>)null, (Object)null, "");
				}
				catch
				{
				}
			}
		}

		private void CommitSpawnCount()
		{
			try
			{
				if (!string.IsNullOrEmpty(_spawnCountBuf) && int.TryParse(_spawnCountBuf, out var result))
				{
					_spawnCount = Mathf.Max(1, result);
				}
				else
				{
					_spawnCountBuf = _spawnCount.ToString();
				}
			}
			catch
			{
			}
		}

		private void EnsureStatusSystems()
		{
			try
			{
				if ((Object)(object)_statusController == (Object)null)
				{
					_statusController = Object.FindObjectOfType<StatusController>();
				}
				if (_statusPresetMap != null)
				{
					return;
				}
				_statusPresetMap = new Dictionary<string, StatusPreset>(StringComparer.OrdinalIgnoreCase);
				Toolbox val = Object.FindObjectOfType<Toolbox>();
				if (!((Object)(object)val != (Object)null) || val.allStatuses == null)
				{
					return;
				}
				for (int i = 0; i < val.allStatuses.Count; i++)
				{
					StatusPreset val2 = val.allStatuses[i];
					if (!((SoCustomComparison)(object)val2 == (SoCustomComparison)null))
					{
						string key = ((Object)val2).name ?? string.Empty;
						if (!_statusPresetMap.ContainsKey(key))
						{
							_statusPresetMap[key] = val2;
						}
					}
				}
			}
			catch
			{
			}
		}

		private void RemoveStatus(string presetName)
		{
			try
			{
				EnsureStatusSystems();
				if ((Object)(object)_statusController == (Object)null || _statusPresetMap == null)
				{
					return;
				}
				if ((!_statusPresetMap.TryGetValue(presetName, out StatusPreset value) || (SoCustomComparison)(object)value == (SoCustomComparison)null) && _statusPresetAliases.TryGetValue(presetName, out string value2) && !string.IsNullOrEmpty(value2))
				{
					_statusPresetMap.TryGetValue(value2, out value);
				}
				if ((SoCustomComparison)(object)value != (SoCustomComparison)null)
				{
					_statusController.RemoveAllCounts(value);
					try
					{
						_statusController.ForceStatusCheck(false);
						return;
					}
					catch
					{
						_statusController.ForceStatusCheck();
						return;
					}
				}
				List<StatusPreset> list = new List<StatusPreset>();
				string value3 = (presetName ?? string.Empty).Trim();
				foreach (KeyValuePair<string, StatusPreset> item in _statusPresetMap)
				{
					try
					{
						if ((item.Key ?? string.Empty).IndexOf(value3, StringComparison.OrdinalIgnoreCase) >= 0 && (SoCustomComparison)(object)item.Value != (SoCustomComparison)null)
						{
							list.Add(item.Value);
						}
					}
					catch
					{
					}
				}
				foreach (StatusPreset item2 in list)
				{
					try
					{
						_statusController.RemoveAllCounts(item2);
					}
					catch
					{
					}
				}
				try
				{
					_statusController.ForceStatusCheck(false);
				}
				catch
				{
					try
					{
						_statusController.ForceStatusCheck();
					}
					catch
					{
					}
				}
			}
			catch
			{
			}
		}

		private void DrawPlayer()
		{
			//IL_0554: Unknown result type (might be due to invalid IL or missing references)
			//IL_055a: Invalid comparison between Unknown and I4
			//IL_055e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0565: Invalid comparison between Unknown and I4
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_0573: Invalid comparison between Unknown and I4
			GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>());
			Try(delegate
			{
				DrawEconomy();
			});
			GUILayout.EndVertical();
			GUILayout.Space(8f);
			GUILayout.BeginVertical(GUI.skin.box, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Player", (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			bool flag = GUILayout.Toggle(_invincible, "God Mode (invincible)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) });
			if (flag != _invincible)
			{
				_invincible = flag;
				if ((Object)(object)_game != (Object)null)
				{
					_game.invinciblePlayer = _invincible;
				}
			}
			if (GUILayout.Button("Heal to max", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) }))
			{
				Try(delegate
				{
					Player? player44 = _player;
					if (player44 != null)
					{
						((Actor)player44).ResetHealthToMaximum();
					}
				});
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			bool flag2 = GUILayout.Toggle(_noclipGhost, "Noclip: Ghost", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) });
			bool flag3 = false;
			try
			{
				if ((Object)(object)_game != (Object)null)
				{
					flag3 = _game.disableFallDamage;
				}
			}
			catch
			{
			}
			bool newRowDisableFall = GUILayout.Toggle(flag3, "Disable Fall Damage", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) });
			if (newRowDisableFall != flag3)
			{
				Try(delegate
				{
					if ((Object)(object)_game != (Object)null)
					{
						_game.disableFallDamage = newRowDisableFall;
					}
				});
			}
			bool flag4 = false;
			try
			{
				if ((Object)(object)_game != (Object)null)
				{
					flag4 = _game.routeTeleport;
				}
			}
			catch
			{
			}
			bool newRouteTp = GUILayout.Toggle(flag4, "Teleport to end of Route", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) });
			if (newRouteTp != flag4)
			{
				Try(delegate
				{
					if ((Object)(object)_game != (Object)null)
					{
						_game.routeTeleport = newRouteTp;
					}
				});
			}
			if (flag2 != _noclipGhost)
			{
				_noclipGhost = flag2;
				Try(delegate
				{
					Player? player43 = _player;
					if (player43 != null)
					{
						player43.EnableGhostMovement(_noclipGhost, false, 0f);
					}
				});
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(8f);
			GUILayout.Label("Stealth & Legality", (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			bool flag5 = false;
			try
			{
				if ((Object)(object)_game != (Object)null)
				{
					flag5 = _game.invisiblePlayer;
				}
			}
			catch
			{
			}
			bool newInvPlTop = GUILayout.Toggle(flag5, "Invisible Player", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) });
			if (newInvPlTop != flag5)
			{
				Try(delegate
				{
					if ((Object)(object)_game != (Object)null)
					{
						_game.invisiblePlayer = newInvPlTop;
					}
				});
			}
			bool flag6 = false;
			try
			{
				if ((Object)(object)_game != (Object)null)
				{
					flag6 = _game.inaudiblePlayer;
				}
			}
			catch
			{
			}
			bool newInaudTop = GUILayout.Toggle(flag6, "Inaudible Player", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) });
			if (newInaudTop != flag6)
			{
				Try(delegate
				{
					if ((Object)(object)_game != (Object)null)
					{
						_game.inaudiblePlayer = newInaudTop;
					}
				});
			}
			bool flag7 = false;
			try
			{
				if ((Object)(object)_game != (Object)null)
				{
					flag7 = _game.everywhereIllegal;
				}
			}
			catch
			{
			}
			bool newEverywhereTop = GUILayout.Toggle(flag7, "Everywhere Illegal", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) });
			if (newEverywhereTop != flag7)
			{
				Try(delegate
				{
					if ((Object)(object)_game != (Object)null)
					{
						_game.everywhereIllegal = newEverywhereTop;
					}
				});
			}
			bool flag8 = false;
			try
			{
				if ((Object)(object)_game != (Object)null)
				{
					flag8 = _game.keysToTheCity;
				}
			}
			catch
			{
			}
			bool newKeysCity = GUILayout.Toggle(flag8, "Keys to the City", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) });
			if (newKeysCity != flag8)
			{
				Try(delegate
				{
					if ((Object)(object)_game != (Object)null)
					{
						_game.keysToTheCity = newKeysCity;
					}
					Player val6 = (Player)(((Object)(object)_player != (Object)null) ? ((object)_player) : ((object)Object.FindObjectOfType<Player>()));
					if ((Object)(object)val6 != (Object)null)
					{
						if (newKeysCity)
						{
							try
							{
								HashSet<NewDoor> hashSet = new HashSet<NewDoor>();
								_ktcOriginalKeys = new List<NewDoor>();
								if (((Actor)val6).keyring != null)
								{
									for (int j = 0; j < ((Actor)val6).keyring.Count; j++)
									{
										NewDoor val7 = ((Actor)val6).keyring[j];
										if ((Object)(object)val7 != (Object)null)
										{
											_ktcOriginalKeys.Add(val7);
											hashSet.Add(val7);
										}
									}
								}
								_ktcAddedKeys = new List<NewDoor>();
								bool flag13 = false;
								try
								{
									CityData val8 = Object.FindObjectOfType<CityData>();
									if ((Object)(object)val8 != (Object)null && val8.doorDictionary != null)
									{
										Enumerator<int, NewDoor> enumerator = val8.doorDictionary.GetEnumerator();
										while (enumerator.MoveNext())
										{
											NewDoor value15 = enumerator.Current.Value;
											if (!((Object)(object)value15 == (Object)null) && !hashSet.Contains(value15))
											{
												((Actor)val6).AddToKeyring(value15, false);
												_ktcAddedKeys.Add(value15);
											}
										}
										flag13 = true;
									}
								}
								catch
								{
									flag13 = false;
								}
								if (!flag13)
								{
									Il2CppArrayBase<NewDoor> val9 = Object.FindObjectsOfType<NewDoor>();
									for (int k = 0; k < val9.Length; k++)
									{
										NewDoor val10 = val9[k];
										if (!((Object)(object)val10 == (Object)null) && !hashSet.Contains(val10))
										{
											((Actor)val6).AddToKeyring(val10, false);
											_ktcAddedKeys.Add(val10);
										}
									}
								}
								_ktcLastScanFrame = Time.frameCount;
								return;
							}
							catch
							{
								return;
							}
						}
						try
						{
							if (_ktcAddedKeys != null)
							{
								for (int l = 0; l < _ktcAddedKeys.Count; l++)
								{
									NewDoor val11 = _ktcAddedKeys[l];
									if ((Object)(object)val11 != (Object)null)
									{
										((Actor)val6).RemoveFromKeyring(val11);
									}
								}
							}
							if (_ktcOriginalKeys != null)
							{
								HashSet<NewDoor> hashSet2 = new HashSet<NewDoor>();
								if (((Actor)val6).keyring != null)
								{
									for (int m = 0; m < ((Actor)val6).keyring.Count; m++)
									{
										NewDoor val12 = ((Actor)val6).keyring[m];
										if ((Object)(object)val12 != (Object)null)
										{
											hashSet2.Add(val12);
										}
									}
								}
								for (int n = 0; n < _ktcOriginalKeys.Count; n++)
								{
									NewDoor val13 = _ktcOriginalKeys[n];
									if ((Object)(object)val13 != (Object)null && !hashSet2.Contains(val13))
									{
										((Actor)val6).AddToKeyring(val13, false);
									}
								}
							}
						}
						catch
						{
						}
						finally
						{
							_ktcAddedKeys = null;
							_ktcOriginalKeys = null;
						}
					}
				});
			}
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			bool flag9 = false;
			try
			{
				if ((Object)(object)_game != (Object)null)
				{
					flag9 = _game.disableTrespass;
				}
			}
			catch
			{
			}
			bool newDisableTres = GUILayout.Toggle(flag9, "Disable Trespassing", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) });
			if (newDisableTres != flag9)
			{
				Try(delegate
				{
					if ((Object)(object)_game != (Object)null)
					{
						_game.disableTrespass = newDisableTres;
					}
				});
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal((Il2CppReferenceArray<GUILayoutOption>)null);
			bool flag10 = false;
			try
			{
				if ((Object)(object)_game != (Object)null)
				{
					flag10 = _game.overridePasscodes;
				}
			}
			catch
			{
			}
			bool newPassEnabled = GUILayout.Toggle(flag10, "Passcode Override", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) });
			if (newPassEnabled != flag10)
			{
				Try(delegate
				{
					Game? game2 = _game;
					if (game2 != null)
					{
						game2.SetPasscodeOverrideToggle(newPassEnabled);
					}
				});
			}
			if (!_passOverrideInit)
			{
				_passOverrideBuf = Mathf.Clamp(_passOverrideVal, 0, 9999).ToString("D4");
				_passOverrideInit = true;
			}
			GUILayout.Label("Code:", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) });
			GUI.SetNextControlName("dm_pass_override");
			string text = GUILayout.TextField(_passOverrideBuf, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
			if (!Object.ReferenceEquals(Object.op_Implicit(text), Object.op_Implicit(_passOverrideBuf)))
			{
				_passOverrideBuf = text;
			}
			bool flag11 = GUI.GetNameOfFocusedControl() == "dm_pass_override";
			bool flag12 = false;
			Event current = Event.current;
			if (_passOverrideEditing && !flag11)
			{
				flag12 = true;
			}
			if (current != null && (int)current.type == 4 && ((int)current.keyCode == 13 || (int)current.keyCode == 271) && flag11)
			{
				flag12 = true;
			}
			_passOverrideEditing = flag11;
			if (flag12)
			{
				CommitPassOverride();
			}
			if (GUILayout.Button("Apply", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }))
			{
				Try(delegate
				{
					CommitPassOverride();
				});
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			GUILayout.Space(8f);
			GUILayout.Label("Status", (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Space(10f);
			GUILayout.Label("Statuses -- Needs, Wellness & Buffs/Debuffs", (Il2CppReferenceArray<GUILayoutOption>)null);
			DrawStatusRow(delegate
			{
				DrawStatusPair("Hungry", delegate
				{
					Try(delegate
					{
						Player? player42 = _player;
						if (player42 != null)
						{
							((Human)player42).AddNourishment(0f - Mathf.Abs(_statDelta));
						}
						StatusController? statusController61 = _statusController;
						if (statusController61 != null)
						{
							statusController61.ForceStatusCheck(false);
						}
					});
				}, delegate
				{
					Try(delegate
					{
						Player? player41 = _player;
						if (player41 != null)
						{
							((Human)player41).AddNourishment(Mathf.Abs(_statDelta));
						}
						StatusController? statusController60 = _statusController;
						if (statusController60 != null)
						{
							statusController60.ForceStatusCheck(false);
						}
					});
				}, enableAdd: true, enableRemove: true);
				DrawStatusPair("Thirsty", delegate
				{
					Try(delegate
					{
						Player? player40 = _player;
						if (player40 != null)
						{
							((Human)player40).AddHydration(0f - Mathf.Abs(_statDelta));
						}
						StatusController? statusController59 = _statusController;
						if (statusController59 != null)
						{
							statusController59.ForceStatusCheck(false);
						}
					});
				}, delegate
				{
					Try(delegate
					{
						Player? player39 = _player;
						if (player39 != null)
						{
							((Human)player39).AddHydration(Mathf.Abs(_statDelta));
						}
						StatusController? statusController58 = _statusController;
						if (statusController58 != null)
						{
							statusController58.ForceStatusCheck(false);
						}
					});
				}, enableAdd: true, enableRemove: true);
				DrawStatusPair("Tired", delegate
				{
					Try(delegate
					{
						Player? player38 = _player;
						if (player38 != null)
						{
							((Human)player38).AddEnergy(0f - Mathf.Abs(_statDelta));
						}
						StatusController? statusController57 = _statusController;
						if (statusController57 != null)
						{
							statusController57.ForceStatusCheck(false);
						}
					});
				}, delegate
				{
					Try(delegate
					{
						if ((Object)(object)_statusController != (Object)null && _statusPresetMap != null && _statusPresetMap.TryGetValue("Tired", out StatusPreset value14))
						{
							_statusController.RemoveAllCounts(value14);
						}
						Player? player37 = _player;
						if (player37 != null)
						{
							((Human)player37).AddEnergy(Mathf.Abs(_statDelta));
						}
						StatusController? statusController56 = _statusController;
						if (statusController56 != null)
						{
							statusController56.ForceStatusCheck(false);
						}
					});
				}, enableAdd: true, enableRemove: true);
				DrawStatusPair("WellRested", delegate
				{
					Try(delegate
					{
						Player? player36 = _player;
						if (player36 != null)
						{
							((Human)player36).AddWellRested(Mathf.Abs(_statDelta));
						}
						StatusController? statusController55 = _statusController;
						if (statusController55 != null)
						{
							statusController55.ForceStatusCheck(false);
						}
					});
				}, delegate
				{
					Try(delegate
					{
						if ((Object)(object)_statusController != (Object)null && _statusPresetMap != null && _statusPresetMap.TryGetValue("WellRested", out StatusPreset value13))
						{
							_statusController.RemoveAllCounts(value13);
						}
						try
						{
							Player? player35 = _player;
							if (player35 != null)
							{
								((Human)player35).AddWellRested(0f - Mathf.Abs(_statDelta));
							}
						}
						catch
						{
						}
						StatusController? statusController54 = _statusController;
						if (statusController54 != null)
						{
							statusController54.ForceStatusCheck(false);
						}
					});
				}, enableAdd: true, enableRemove: true);
				DrawStatusPair("Focused", delegate
				{
					Try(delegate
					{
						Player? player34 = _player;
						if (player34 != null)
						{
							((Human)player34).AddAlertness(Mathf.Abs(_statDelta));
						}
						StatusController? statusController53 = _statusController;
						if (statusController53 != null)
						{
							statusController53.ForceStatusCheck(false);
						}
					});
				}, delegate
				{
					Try(delegate
					{
						if ((Object)(object)_statusController != (Object)null && _statusPresetMap != null && _statusPresetMap.TryGetValue("Focused", out StatusPreset value12))
						{
							_statusController.RemoveAllCounts(value12);
						}
						try
						{
							Player? player33 = _player;
							if (player33 != null)
							{
								((Human)player33).AddAlertness(0f - Mathf.Abs(_statDelta));
							}
						}
						catch
						{
						}
						StatusController? statusController52 = _statusController;
						if (statusController52 != null)
						{
							statusController52.ForceStatusCheck(false);
						}
					});
				}, enableAdd: true, enableRemove: true);
			});
			DrawStatusRow(delegate
			{
				DrawStatusPair("StarchAddiction", delegate
				{
					Try(delegate
					{
						Player? player32 = _player;
						if (player32 != null)
						{
							((Human)player32).AddStarchAddiction(_statDelta);
						}
						StatusController? statusController51 = _statusController;
						if (statusController51 != null)
						{
							statusController51.ForceStatusCheck(false);
						}
					});
				}, delegate
				{
					Try(delegate
					{
						StatusController? statusController49 = _statusController;
						if (statusController49 != null)
						{
							statusController49.RemoveAllCounts((_statusPresetMap != null && _statusPresetMap.TryGetValue("StarchAddiction", out StatusPreset value11)) ? value11 : null);
						}
						Player? player31 = _player;
						if (player31 != null)
						{
							((Human)player31).AddStarchAddiction(0f - Mathf.Abs(_statDelta));
						}
						StatusController? statusController50 = _statusController;
						if (statusController50 != null)
						{
							statusController50.ForceStatusCheck(false);
						}
					});
				}, enableAdd: true, enableRemove: true);
				DrawStatusPair("Stinky", delegate
				{
					Try(delegate
					{
						Player? player30 = _player;
						if (player30 != null)
						{
							((Human)player30).AddHygiene(0f - Mathf.Abs(_statDelta));
						}
						StatusController? statusController48 = _statusController;
						if (statusController48 != null)
						{
							statusController48.ForceStatusCheck(false);
						}
					});
				}, delegate
				{
					Try(delegate
					{
						RemoveStatus("Stinky");
						Player? player29 = _player;
						if (player29 != null)
						{
							((Human)player29).AddHygiene(Mathf.Abs(_statDelta));
						}
						StatusController? statusController47 = _statusController;
						if (statusController47 != null)
						{
							statusController47.ForceStatusCheck(false);
						}
					});
				}, enableAdd: true, enableRemove: true);
				DrawStatusPair("Hiding", delegate
				{
					Try(delegate
					{
						Player? player28 = _player;
						if (player28 != null)
						{
							((Actor)player28).SetHiding(true, (Interactable)null);
						}
						StatusController? statusController46 = _statusController;
						if (statusController46 != null)
						{
							statusController46.ForceStatusCheck(false);
						}
					});
				}, delegate
				{
					Try(delegate
					{
						Player? player27 = _player;
						if (player27 != null)
						{
							((Actor)player27).SetHiding(false, (Interactable)null);
						}
						StatusController? statusController45 = _statusController;
						if (statusController45 != null)
						{
							statusController45.ForceStatusCheck(false);
						}
					});
				}, enableAdd: true, enableRemove: true);
				DrawStatusPair("GuestPass", delegate
				{
					Try(delegate
					{
						NewAddress val5 = ((!((Object)(object)_player != (Object)null)) ? null : ((!((Object)(object)((Actor)_player).currentRoom != (Object)null)) ? null : (((Object)(object)((Actor)_player).currentRoom.gameLocation != (Object)null) ? ((Actor)_player).currentRoom.gameLocation.thisAsAddress : null)));
						if ((Object)(object)val5 != (Object)null)
						{
							if ((Object)(object)_gc != (Object)null)
							{
								_gc.AddGuestPass(val5, 2f);
							}
							StatusController? statusController44 = _statusController;
							if (statusController44 != null)
							{
								statusController44.ForceStatusCheck(false);
							}
						}
					});
				}, delegate
				{
					Try(delegate
					{
						RemoveStatus("GuestPass");
						NewAddress val4 = ((!((Object)(object)_player != (Object)null)) ? null : ((!((Object)(object)((Actor)_player).currentRoom != (Object)null)) ? null : (((Object)(object)((Actor)_player).currentRoom.gameLocation != (Object)null) ? ((Actor)_player).currentRoom.gameLocation.thisAsAddress : null)));
						if ((Object)(object)_gc != (Object)null && (Object)(object)val4 != (Object)null)
						{
							try
							{
								if (_gc.guestPasses != null && _gc.guestPasses.ContainsKey(val4))
								{
									_gc.guestPasses.Remove(val4);
								}
							}
							catch
							{
							}
						}
						StatusController? statusController43 = _statusController;
						if (statusController43 != null)
						{
							statusController43.ForceStatusCheck(false);
						}
					});
				}, enableAdd: true, enableRemove: true);
				DrawStatusPair("Detained", delegate
				{
					Try(delegate
					{
						NewBuilding val3 = ((!((Object)(object)_player != (Object)null)) ? null : ((!((Object)(object)((Actor)_player).currentRoom != (Object)null)) ? null : (((Object)(object)((Actor)_player).currentRoom.gameLocation != (Object)null) ? ((Actor)_player).currentRoom.gameLocation.building : ((Actor)_player).currentRoom.building)));
						if ((Object)(object)val3 != (Object)null)
						{
							StatusController? statusController41 = _statusController;
							if (statusController41 != null)
							{
								statusController41.SetDetainedInBuilding(val3, true);
							}
							StatusController? statusController42 = _statusController;
							if (statusController42 != null)
							{
								statusController42.ForceStatusCheck(false);
							}
						}
					});
				}, delegate
				{
					Try(delegate
					{
						NewBuilding val2 = ((!((Object)(object)_player != (Object)null)) ? null : ((!((Object)(object)((Actor)_player).currentRoom != (Object)null)) ? null : (((Object)(object)((Actor)_player).currentRoom.gameLocation != (Object)null) ? ((Actor)_player).currentRoom.gameLocation.building : ((Actor)_player).currentRoom.building)));
						if ((Object)(object)val2 != (Object)null)
						{
							StatusController? statusController39 = _statusController;
							if (statusController39 != null)
							{
								statusController39.SetDetainedInBuilding(val2, false);
							}
						}
						RemoveStatus("Detained");
						StatusController? statusController40 = _statusController;
						if (statusController40 != null)
						{
							statusController40.ForceStatusCheck(false);
						}
					});
				}, enableAdd: true, enableRemove: true);
			});
			GUILayout.Label("Statuses -- Injuries & Impairments", (Il2CppReferenceArray<GUILayoutOption>)null);
			DrawStatusRow(delegate
			{
				DrawStatusPair("BrokenLeg", delegate
				{
					Try(delegate
					{
						Player? player26 = _player;
						if (player26 != null)
						{
							((Human)player26).AddBrokenLeg(_statDelta);
						}
						StatusController? statusController38 = _statusController;
						if (statusController38 != null)
						{
							statusController38.ForceStatusCheck(false);
						}
					});
				}, delegate
				{
					Try(delegate
					{
						StatusController? statusController36 = _statusController;
						if (statusController36 != null)
						{
							statusController36.RemoveAllCounts((_statusPresetMap != null && _statusPresetMap.TryGetValue("BrokenLeg", out StatusPreset value10)) ? value10 : null);
						}
						Player? player25 = _player;
						if (player25 != null)
						{
							((Human)player25).AddBrokenLeg(0f - Mathf.Abs(_statDelta));
						}
						StatusController? statusController37 = _statusController;
						if (statusController37 != null)
						{
							statusController37.ForceStatusCheck(false);
						}
					});
				}, enableAdd: true, enableRemove: true);
				DrawStatusPair("Bruised", delegate
				{
					Try(delegate
					{
						Player? player24 = _player;
						if (player24 != null)
						{
							((Human)player24).AddBruised(_statDelta);
						}
						StatusController? statusController35 = _statusController;
						if (statusController35 != null)
						{
							statusController35.ForceStatusCheck(false);
						}
					});
				}, delegate
				{
					Try(delegate
					{
						StatusController? statusController33 = _statusController;
						if (statusController33 != null)
						{
							statusController33.RemoveAllCounts((_statusPresetMap != null && _statusPresetMap.TryGetValue("Bruised", out StatusPreset value9)) ? value9 : null);
						}
						Player? player23 = _player;
						if (player23 != null)
						{
							((Human)player23).AddBruised(0f - Mathf.Abs(_statDelta));
						}
						StatusController? statusController34 = _statusController;
						if (statusController34 != null)
						{
							statusController34.ForceStatusCheck(false);
						}
					});
				}, enableAdd: true, enableRemove: true);
				DrawStatusPair("BlackEye", delegate
				{
					Try(delegate
					{
						Player? player22 = _player;
						if (player22 != null)
						{
							((Human)player22).AddBlackEye(_statDelta);
						}
						StatusController? statusController32 = _statusController;
						if (statusController32 != null)
						{
							statusController32.ForceStatusCheck(false);
						}
					});
				}, delegate
				{
					Try(delegate
					{
						StatusController? statusController30 = _statusController;
						if (statusController30 != null)
						{
							statusController30.RemoveAllCounts((_statusPresetMap != null && _statusPresetMap.TryGetValue("BlackEye", out StatusPreset value8)) ? value8 : null);
						}
						Player? player21 = _player;
						if (player21 != null)
						{
							((Human)player21).AddBlackEye(0f - Mathf.Abs(_statDelta));
						}
						StatusController? statusController31 = _statusController;
						if (statusController31 != null)
						{
							statusController31.ForceStatusCheck(false);
						}
					});
				}, enableAdd: true, enableRemove: true);
				DrawStatusPair("BlackedOut", delegate
				{
					Try(delegate
					{
						Player? player20 = _player;
						if (player20 != null)
						{
							((Human)player20).AddBlackedOut(_statDelta);
						}
						StatusController? statusController29 = _statusController;
						if (statusController29 != null)
						{
							statusController29.ForceStatusCheck(false);
						}
					});
				}, delegate
				{
					Try(delegate
					{
						StatusController? statusController27 = _statusController;
						if (statusController27 != null)
						{
							statusController27.RemoveAllCounts((_statusPresetMap != null && _statusPresetMap.TryGetValue("BlackedOut", out StatusPreset value7)) ? value7 : null);
						}
						Player? player19 = _player;
						if (player19 != null)
						{
							((Human)player19).AddBlackedOut(0f - Mathf.Abs(_statDelta));
						}
						StatusController? statusController28 = _statusController;
						if (statusController28 != null)
						{
							statusController28.ForceStatusCheck(false);
						}
					});
				}, enableAdd: true, enableRemove: true);
				DrawStatusPair("Numb", delegate
				{
					Try(delegate
					{
						Player? player18 = _player;
						if (p