Decompiled source of BRCTools v0.1.3

plugins/BRCTools/BRCTools.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Reptile;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BRCTools")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BRCTools")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0e6996c8-02c7-4f5c-9c27-e45d0d5fc80c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BRCTools;

[BepInPlugin("speedrunning.brc.brctools", "BRCTools", "0.1.3")]
public class Plugin : BaseUnityPlugin
{
	public const string pluginGuid = "speedrunning.brc.brctools";

	public const string pluginName = "BRCTools";

	public const string pluginVersion = "0.1.3";

	private GameObject _mod;

	private void Awake()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		_mod = new GameObject();
		_mod.AddComponent<ToolsConfig>();
		_mod.AddComponent<ToolsGame>();
		_mod.AddComponent<ToolsFunctions>();
		_mod.AddComponent<ToolsMenu>();
		_mod.AddComponent<ToolsBindings>();
		_mod.AddComponent<ToolsFun>();
		_mod.AddComponent<ToolsPatcher>();
		_mod.AddComponent<ToolsRef>();
		Object.DontDestroyOnLoad((Object)(object)_mod);
	}
}
internal class ToolsBindings : MonoBehaviour
{
	public delegate void KeysToCheck();

	public static bool acceptKeys = true;

	public static KeysToCheck keysToCheck;

	private void Update()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		if (!acceptKeys)
		{
			return;
		}
		if (Input.GetKeyDown(ToolsConfig.KeyBinds.key_MenuToggle))
		{
			if (ToolsGUI.menuIsVisible && !ToolsGUI.menuInAnimation)
			{
				ToolsRef.toolsGUI.MenuHide();
			}
			else if (!ToolsGUI.menuIsVisible && !ToolsGUI.menuInAnimation)
			{
				ToolsRef.toolsGUI.MenuShow();
			}
		}
		if (Input.GetKeyDown(ToolsConfig.KeyBinds.key_MenuMouse))
		{
			ToolsRef.toolsGUI.MenuToggleFocus();
		}
		keysToCheck();
	}
}
internal class ToolsConfig : MonoBehaviour
{
	public class KeyBinds
	{
		public static KeyCode key_MenuToggle = (KeyCode)59;

		public static KeyCode key_MenuMouse = (KeyCode)112;

		public static KeyCode key_Refill = (KeyCode)114;

		public static KeyCode key_Invulnerable = (KeyCode)105;

		public static KeyCode key_EndWanted = (KeyCode)107;

		public static KeyCode key_InfBoost = (KeyCode)117;

		public static KeyCode key_DisPolice = (KeyCode)111;

		public static KeyCode key_CharPrev = (KeyCode)0;

		public static KeyCode key_CharNext = (KeyCode)0;

		public static KeyCode key_Save = (KeyCode)104;

		public static KeyCode key_Load = (KeyCode)106;

		public static KeyCode key_StylePrev = (KeyCode)0;

		public static KeyCode key_StyleNext = (KeyCode)0;

		public static KeyCode key_OutfitPrev = (KeyCode)0;

		public static KeyCode key_OutfitNext = (KeyCode)0;

		public static KeyCode key_LevelPrev = (KeyCode)91;

		public static KeyCode key_LevelNext = (KeyCode)93;

		public static KeyCode key_GoToLevel = (KeyCode)48;

		public static KeyCode key_LockFPS = (KeyCode)108;

		public static KeyCode key_SetTimescale = (KeyCode)116;

		public static KeyCode key_Noclip = (KeyCode)92;

		public static KeyCode key_Fly = (KeyCode)47;

		public static KeyCode key_Triggers = (KeyCode)120;

		public static KeyCode key_DisSaving = (KeyCode)98;

		public static KeyCode key_DisCars = (KeyCode)99;

		public static KeyCode key_ResGraf = (KeyCode)110;

		public static KeyCode key_ResGame = (KeyCode)118;

		public static KeyCode key_ResLevel = (KeyCode)103;

		public static KeyCode key_prevSave = (KeyCode)45;

		public static KeyCode key_nextSave = (KeyCode)61;

		public static KeyCode key_goToSave = (KeyCode)8;

		public static KeyCode key_autoGraf = (KeyCode)109;

		public static KeyCode key_refillHP = (KeyCode)122;

		public static KeyCode key_saveGame = (KeyCode)46;

		public static KeyCode key_spawnPrev = (KeyCode)0;

		public static KeyCode key_spawnNext = (KeyCode)0;

		public static KeyCode key_dreamPrev = (KeyCode)0;

		public static KeyCode key_dreamNext = (KeyCode)0;
	}

	public class Settings
	{
		public static bool shouldFocusMenuOnShow = false;

		public static bool shouldMenuStartShown = true;

		internal static bool _shouldUseAllGraffitis = false;

		public static bool shouldHideCords = false;

		public static bool shouldHideSpeed = false;

		public static bool shouldTieLabels = false;

		public static bool shouldAllowCutsceneSkip = true;

		public static bool speedUpCutsceneSkip = false;

		public static bool shouldHaveSpecial = false;

		public static bool shouldLaunchToMenu = false;

		public static bool shouldUseAllGraffitis
		{
			get
			{
				return _shouldUseAllGraffitis;
			}
			set
			{
				_shouldUseAllGraffitis = value;
				ToolsFunctions.used_graffiti.Clear();
			}
		}
	}

	public static ToolsConfig Instance;

	private const string folderName = "BRCTools";

	private const string saveFolderName = "SAVES";

	private const string descFileName = "descriptions";

	private const string keybindFileName = "Keybinds";

	private const string settingFileName = "Settings";

	public static string ext_saves = ".brctools";

	public static string folder_config = Path.Combine(Paths.ConfigPath, "BRCTools");

	public static string folder_saves = Path.Combine(folder_config, "SAVES");

	public static string file_desc = Path.Combine(folder_saves, "descriptions.txt");

	public static HashSet<string> desc_contents = new HashSet<string>();

	private static List<string> saves = new List<string>();

	public static Dictionary<string, string> files_saves = new Dictionary<string, string>();

	private ConfigFile keybinds;

	private ConfigFile settings;

	private Dictionary<KeyCode, string> keyToString = new Dictionary<KeyCode, string>
	{
		{
			(KeyCode)48,
			"0"
		},
		{
			(KeyCode)49,
			"1"
		},
		{
			(KeyCode)50,
			"2"
		},
		{
			(KeyCode)51,
			"3"
		},
		{
			(KeyCode)52,
			"4"
		},
		{
			(KeyCode)53,
			"5"
		},
		{
			(KeyCode)54,
			"6"
		},
		{
			(KeyCode)55,
			"7"
		},
		{
			(KeyCode)56,
			"8"
		},
		{
			(KeyCode)57,
			"9"
		},
		{
			(KeyCode)256,
			"N0"
		},
		{
			(KeyCode)257,
			"N1"
		},
		{
			(KeyCode)258,
			"N2"
		},
		{
			(KeyCode)259,
			"N3"
		},
		{
			(KeyCode)260,
			"N4"
		},
		{
			(KeyCode)261,
			"N5"
		},
		{
			(KeyCode)262,
			"N6"
		},
		{
			(KeyCode)263,
			"N7"
		},
		{
			(KeyCode)264,
			"N8"
		},
		{
			(KeyCode)265,
			"N9"
		},
		{
			(KeyCode)266,
			"N."
		},
		{
			(KeyCode)267,
			"N/"
		},
		{
			(KeyCode)268,
			"N*"
		},
		{
			(KeyCode)269,
			"N-"
		},
		{
			(KeyCode)271,
			"NRTN"
		},
		{
			(KeyCode)272,
			"N="
		},
		{
			(KeyCode)8,
			"BKS"
		},
		{
			(KeyCode)127,
			"DEL"
		},
		{
			(KeyCode)9,
			"TAB"
		},
		{
			(KeyCode)12,
			"CLR"
		},
		{
			(KeyCode)13,
			"RTN"
		},
		{
			(KeyCode)19,
			"PSE"
		},
		{
			(KeyCode)27,
			"ESC"
		},
		{
			(KeyCode)32,
			"SPC"
		},
		{
			(KeyCode)273,
			"UP"
		},
		{
			(KeyCode)274,
			"DWN"
		},
		{
			(KeyCode)275,
			"LFT"
		},
		{
			(KeyCode)276,
			"RGT"
		},
		{
			(KeyCode)33,
			"!"
		},
		{
			(KeyCode)34,
			"\""
		},
		{
			(KeyCode)35,
			"#"
		},
		{
			(KeyCode)36,
			"$"
		},
		{
			(KeyCode)37,
			"%"
		},
		{
			(KeyCode)38,
			"&"
		},
		{
			(KeyCode)39,
			"'"
		},
		{
			(KeyCode)40,
			"("
		},
		{
			(KeyCode)41,
			")"
		},
		{
			(KeyCode)42,
			"*"
		},
		{
			(KeyCode)43,
			"+"
		},
		{
			(KeyCode)44,
			","
		},
		{
			(KeyCode)45,
			"-"
		},
		{
			(KeyCode)46,
			"."
		},
		{
			(KeyCode)47,
			"/"
		},
		{
			(KeyCode)58,
			":"
		},
		{
			(KeyCode)59,
			";"
		},
		{
			(KeyCode)60,
			"<"
		},
		{
			(KeyCode)61,
			"="
		},
		{
			(KeyCode)62,
			">"
		},
		{
			(KeyCode)63,
			"?"
		},
		{
			(KeyCode)64,
			"@"
		},
		{
			(KeyCode)91,
			"["
		},
		{
			(KeyCode)92,
			"\\"
		},
		{
			(KeyCode)93,
			"]"
		},
		{
			(KeyCode)94,
			"^"
		},
		{
			(KeyCode)95,
			"_"
		},
		{
			(KeyCode)96,
			"`"
		},
		{
			(KeyCode)123,
			"{"
		},
		{
			(KeyCode)124,
			"|"
		},
		{
			(KeyCode)125,
			"}"
		},
		{
			(KeyCode)126,
			"~"
		},
		{
			(KeyCode)323,
			"M0"
		},
		{
			(KeyCode)324,
			"M1"
		},
		{
			(KeyCode)325,
			"M2"
		},
		{
			(KeyCode)326,
			"M3"
		},
		{
			(KeyCode)327,
			"M4"
		},
		{
			(KeyCode)328,
			"M5"
		},
		{
			(KeyCode)329,
			"M6"
		},
		{
			(KeyCode)0,
			""
		}
	};

	public Dictionary<string, string> charToName;

	public Dictionary<string, string> styleToName;

	public Dictionary<int, string> outfitToName;

	public Dictionary<int, string> levelToName;

	public Dictionary<int, string> chapterToName;

	public ToolsConfig()
	{
		//IL_0458: Unknown result type (might be due to invalid IL or missing references)
		//IL_0472: Unknown result type (might be due to invalid IL or missing references)
		//IL_048c: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04da: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_050e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0528: Unknown result type (might be due to invalid IL or missing references)
		//IL_0543: Unknown result type (might be due to invalid IL or missing references)
		//IL_055e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0579: Unknown result type (might be due to invalid IL or missing references)
		//IL_0594: Unknown result type (might be due to invalid IL or missing references)
		//IL_05af: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0600: Unknown result type (might be due to invalid IL or missing references)
		//IL_061b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0636: Unknown result type (might be due to invalid IL or missing references)
		//IL_0651: Unknown result type (might be due to invalid IL or missing references)
		//IL_066c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0687: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_06bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0718: Unknown result type (might be due to invalid IL or missing references)
		//IL_0732: Unknown result type (might be due to invalid IL or missing references)
		//IL_074c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0766: Unknown result type (might be due to invalid IL or missing references)
		Dictionary<string, string> dictionary = new Dictionary<string, string>();
		Characters val = (Characters)0;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Vinyl");
		val = (Characters)1;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Frank");
		val = (Characters)2;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Coil");
		val = (Characters)3;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Red");
		val = (Characters)4;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Tryce");
		val = (Characters)5;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Bel");
		val = (Characters)6;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Rave");
		val = (Characters)7;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "DOT EXE");
		val = (Characters)8;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Solace");
		val = (Characters)9;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "DJ Cyber");
		val = (Characters)10;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Eclipse");
		val = (Characters)11;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Devil Theory");
		val = (Characters)12;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Faux");
		val = (Characters)13;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Flesh Prince");
		val = (Characters)14;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Irene Rietveld");
		val = (Characters)15;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Felix");
		val = (Characters)16;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Old Head");
		val = (Characters)17;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Base");
		val = (Characters)18;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Jay");
		val = (Characters)19;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Mesh");
		val = (Characters)20;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Futurism");
		val = (Characters)21;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Rise");
		val = (Characters)22;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Shine");
		val = (Characters)23;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Faux (No Jetpack)");
		val = (Characters)24;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "DOT EXE (Boss)");
		val = (Characters)25;
		dictionary.Add(((object)(Characters)(ref val)).ToString(), "Felix (Red)");
		charToName = dictionary;
		Dictionary<string, string> dictionary2 = new Dictionary<string, string>();
		MoveStyle val2 = (MoveStyle)1;
		dictionary2.Add(((object)(MoveStyle)(ref val2)).ToString(), "BMX");
		val2 = (MoveStyle)2;
		dictionary2.Add(((object)(MoveStyle)(ref val2)).ToString(), "Skateboard");
		val2 = (MoveStyle)3;
		dictionary2.Add(((object)(MoveStyle)(ref val2)).ToString(), "Inline");
		val2 = (MoveStyle)4;
		dictionary2.Add(((object)(MoveStyle)(ref val2)).ToString(), "Special");
		styleToName = dictionary2;
		outfitToName = new Dictionary<int, string>
		{
			{ 0, "Spring" },
			{ 1, "Summer" },
			{ 2, "Autumn" },
			{ 3, "Winter" }
		};
		levelToName = new Dictionary<int, string>
		{
			{ 8, "Prelude" },
			{ 5, "Hideout" },
			{ 4, "Versum Hill" },
			{ 11, "Square" },
			{ 12, "Brink Terminal" },
			{ 6, "Millennium Mall" },
			{ 9, "Pyramid" },
			{ 7, "Mataan" }
		};
		chapterToName = new Dictionary<int, string>
		{
			{ 1, "Chapter 1" },
			{ 2, "Chapter 2" },
			{ 3, "Chapter 3" },
			{ 4, "Chapter 4" },
			{ 5, "Chapter 5" },
			{ 6, "Chapter 6" }
		};
		((MonoBehaviour)this)..ctor();
		Instance = this;
	}

	private void HandleSettingsEntry(string entry, ref bool setting)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		settings.Bind<bool>("Settings", entry, setting, (ConfigDescription)null);
		ConfigEntry<bool> val = default(ConfigEntry<bool>);
		settings.TryGetEntry<bool>(new ConfigDefinition("Settings", entry), ref val);
		if (val != null)
		{
			setting = val.Value;
		}
	}

	private void Awake()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Expected O, but got Unknown
		//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0413: Unknown result type (might be due to invalid IL or missing references)
		//IL_0438: Unknown result type (might be due to invalid IL or missing references)
		//IL_043d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0475: Unknown result type (might be due to invalid IL or missing references)
		if (!Directory.Exists(folder_config))
		{
			Directory.CreateDirectory(folder_config);
		}
		if (!Directory.Exists(folder_config))
		{
			return;
		}
		settings = new ConfigFile(GetAsCFGPath("Settings"), true);
		HandleSettingsEntry("Start Menu Open", ref Settings.shouldMenuStartShown);
		HandleSettingsEntry("Enable Mouse On Showing Menu", ref Settings.shouldFocusMenuOnShow);
		HandleSettingsEntry("Auto Graffiti Uses All Graffiti", ref Settings._shouldUseAllGraffitis);
		HandleSettingsEntry("Start Coords Hidden", ref Settings.shouldHideCords);
		HandleSettingsEntry("Start Speed Hidden", ref Settings.shouldHideSpeed);
		HandleSettingsEntry("Coord & Speed Visibility Based On Menu", ref Settings.shouldTieLabels);
		HandleSettingsEntry("Allow All Cutscene Skipping", ref Settings.shouldAllowCutsceneSkip);
		HandleSettingsEntry("Speed Up Cutscene Skip If All", ref Settings.speedUpCutsceneSkip);
		HandleSettingsEntry("Style Includes Special Skateboard", ref Settings.shouldHaveSpecial);
		HandleSettingsEntry("Launch Game To Menu", ref Settings.shouldLaunchToMenu);
		keybinds = new ConfigFile(GetAsCFGPath("Keybinds"), true);
		Dictionary<string, string> dictionary = new Dictionary<string, string>
		{
			{ "key_MenuToggle", "Toggle Menu" },
			{ "key_MenuMouse", "Toggle Mouse Input" },
			{ "key_Refill", "Refill Boost" },
			{ "key_Invulnerable", "Become Invulnerable" },
			{ "key_EndWanted", "End Wanted State" },
			{ "key_InfBoost", "Infinite Boost" },
			{ "key_DisPolice", "Disable Police" },
			{ "key_CharPrev", "Previous Character" },
			{ "key_CharNext", "Next Character" },
			{ "key_Save", "Save Position" },
			{ "key_Load", "Load Position" },
			{ "key_StylePrev", "Previous Style" },
			{ "key_StyleNext", "Next Style" },
			{ "key_OutfitPrev", "Previous Outfit" },
			{ "key_OutfitNext", "Next Outfit" },
			{ "key_LevelPrev", "Previous Level" },
			{ "key_LevelNext", "Next Level" },
			{ "key_GoToLevel", "Load Level" },
			{ "key_LockFPS", "Lock FPS" },
			{ "key_SetTimescale", "Set Timescale" },
			{ "key_Noclip", "Toggle Noclip" },
			{ "key_Fly", "Toggle Flying" },
			{ "key_Triggers", "Toggle Triggers" },
			{ "key_DisSaving", "Disable Saving" },
			{ "key_DisCars", "Disable Cars" },
			{ "key_ResGraf", "Reset Graffiti" },
			{ "key_ResGame", "Load Current Save" },
			{ "key_ResLevel", "Restart Level" },
			{ "key_prevSave", "Previous Save" },
			{ "key_nextSave", "Next Save" },
			{ "key_goToSave", "Load Selected Save" },
			{ "key_autoGraf", "Auto Graffiti" },
			{ "key_refillHP", "Refill Health" },
			{ "key_saveGame", "Create Save File" },
			{ "key_spawnPrev", "Previous Spawn" },
			{ "key_spawnNext", "Next Spawn" },
			{ "key_dreamPrev", "Previous Dream Spawn" },
			{ "key_dreamNext", "Next Dream Spawn" }
		};
		int num = 0;
		FieldInfo[] fields = typeof(KeyBinds).GetFields(BindingFlags.Static | BindingFlags.Public);
		foreach (FieldInfo fieldInfo in fields)
		{
			string text = $"NO_DESC_{num++}";
			if (dictionary.TryGetValue(fieldInfo.Name, out var value))
			{
				text = value;
			}
			else
			{
				dictionary.Add(fieldInfo.Name, text);
			}
			keybinds.Bind<string>("Keybinds", text, GetKeyString((KeyCode)fieldInfo.GetValue(null)), (ConfigDescription)null);
		}
		num = 0;
		ConfigEntry<string> val2 = default(ConfigEntry<string>);
		foreach (ConfigDefinition item in keybinds.Keys)
		{
			KeyCode val = (KeyCode)0;
			if (keybinds.TryGetEntry<string>(item, ref val2))
			{
				val = GetStringKey(val2.Value.ToUpper());
			}
			string key2 = dictionary.FirstOrDefault((KeyValuePair<string, string> key) => key.Value == item.Key).Key;
			if (key2 != null)
			{
				typeof(KeyBinds).GetField(key2, BindingFlags.Static | BindingFlags.Public).SetValue(null, val);
			}
		}
		UpdateSaveFiles();
	}

	public void UpdateSaveFiles()
	{
		saves.Clear();
		files_saves.Clear();
		if (!Directory.Exists(folder_saves))
		{
			Directory.CreateDirectory(folder_saves);
		}
		if (!Directory.Exists(folder_saves))
		{
			return;
		}
		string[] files = Directory.GetFiles(folder_saves);
		foreach (string text in files)
		{
			if (text.EndsWith(ext_saves))
			{
				string item = Path.Combine(folder_saves, text);
				saves.Add(item);
			}
		}
		saves.Sort();
		if (!File.Exists(file_desc))
		{
			File.CreateText(file_desc);
		}
		if (saves.Count <= 0 || !File.Exists(file_desc))
		{
			return;
		}
		foreach (string safe in saves)
		{
			string saveFile = safe.Remove(0, safe.LastIndexOf("\\") + 1) + ":";
			string text2 = File.ReadAllLines(file_desc).FirstOrDefault((string x) => x.StartsWith(saveFile));
			if (text2 == null)
			{
				text2 = saveFile + " " + saveFile.Substring(0, saveFile.Length - 1).Replace(ext_saves, string.Empty);
				File.AppendAllText(file_desc, "\n" + text2);
			}
			string text3 = text2.Remove(0, saveFile.Length);
			text3 = text3.Replace("\t", string.Empty);
			string text4 = text3.Replace(" ", string.Empty);
			while (text3.Length > 0 && text4 != "" && text3.StartsWith(" "))
			{
				text3 = text3.Remove(0, 1);
			}
			if (text3.Count() > 30)
			{
				text3 = text3.Substring(0, 30);
			}
			if (!files_saves.Keys.ToArray().Contains(safe))
			{
				files_saves.Add(safe, text3);
			}
		}
		desc_contents = File.ReadAllLines(file_desc).ToHashSet();
		files_saves = files_saves.OrderBy<KeyValuePair<string, string>, string>((KeyValuePair<string, string> x) => x.Key, StringComparer.OrdinalIgnoreCase).ToDictionary((KeyValuePair<string, string> x) => x.Key, (KeyValuePair<string, string> y) => y.Value);
	}

	private string GetAsCFGPath(string file)
	{
		return Path.Combine(folder_config, file + ".cfg");
	}

	public string GetKeyString(KeyCode keycode)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		if (keyToString.TryGetValue(keycode, out var value))
		{
			return value;
		}
		if (((object)(KeyCode)(ref keycode)).ToString().Length <= 4)
		{
			return ((object)(KeyCode)(ref keycode)).ToString().ToUpper();
		}
		return ((object)(KeyCode)(ref keycode)).ToString().Substring(0, 4).ToUpper();
	}

	public KeyCode GetStringKey(string key)
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		int num = 0;
		foreach (string value in keyToString.Values)
		{
			if (value == key)
			{
				return keyToString.Keys.ToArray()[num];
			}
			num++;
		}
		if (Enum.TryParse<KeyCode>(key, out KeyCode result))
		{
			return result;
		}
		return (KeyCode)0;
	}
}
internal class ToolsFun : MonoBehaviour
{
	private Color rainbowColor;

	private int currentIndex;

	private Color[] colors = (Color[])(object)new Color[6]
	{
		Color.red,
		Color.yellow,
		Color.green,
		Color.cyan,
		Color.blue,
		Color.magenta
	};

	private float timer;

	private float transitionInterval = 0.2f;

	private float updateTimer;

	private float updateInterval = 0.05f;

	private Text nText;

	private string pluginVersion = "0.1.3";

	private void Start()
	{
		((MonoBehaviour)this).StartCoroutine(FindText());
	}

	private IEnumerator FindText()
	{
		while ((Object)(object)nText == (Object)null)
		{
			if ((Object)(object)ToolsGUI.stripText != (Object)null)
			{
				nText = ToolsGUI.stripText.GetComponent<Text>();
			}
			yield return null;
		}
	}

	private void Update()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: 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_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
		if (ToolsGUI.menuIsVisible && updateTimer >= updateInterval)
		{
			rainbowColor = Color.Lerp(colors[currentIndex], colors[(currentIndex + 1) % colors.Length], timer / transitionInterval);
			if (timer >= transitionInterval)
			{
				currentIndex = (currentIndex + 1) % colors.Length;
				rainbowColor = colors[currentIndex];
				timer = 0f;
			}
			timer += Time.deltaTime;
			if ((Object)(object)nText != (Object)null)
			{
				nText.text = "BRCTools (" + pluginVersion + ") - by <color=#" + ColorUtility.ToHtmlStringRGB(rainbowColor) + ">Ninja Cookie</color>";
			}
			updateTimer = 0f;
		}
		updateTimer += Time.deltaTime;
	}
}
internal class ToolsFunctions : MonoBehaviour
{
	public class Toggles : MonoBehaviour
	{
		private static bool _invulnerable;

		private static bool _police;

		private static bool _infBoost;

		private static bool _tfps;

		private static bool _timescale;

		private static bool _noclip;

		private static bool _fly;

		private static bool _triggers;

		private static bool _saving;

		private static bool _cars;

		private static bool _autograf;

		public static bool invulnerable
		{
			get
			{
				return _invulnerable;
			}
			set
			{
				_invulnerable = value;
				ToolsRef.toolsGUI.UpdateLinks();
			}
		}

		public static bool police
		{
			get
			{
				return _police;
			}
			set
			{
				_police = value;
				ToolsRef.toolsGUI.UpdateLinks();
			}
		}

		public static bool infBoost
		{
			get
			{
				return _infBoost;
			}
			set
			{
				_infBoost = value;
				ToolsRef.toolsGUI.UpdateLinks();
			}
		}

		public static bool tfps
		{
			get
			{
				return _tfps;
			}
			set
			{
				_tfps = value;
				ToolsRef.toolsGUI.UpdateLinks();
			}
		}

		public static bool timescale
		{
			get
			{
				return _timescale;
			}
			set
			{
				_timescale = value;
				ToolsRef.toolsGUI.UpdateLinks();
			}
		}

		public static bool noclip
		{
			get
			{
				return _noclip;
			}
			set
			{
				_noclip = value;
				ToolsRef.toolsGUI.UpdateLinks();
			}
		}

		public static bool fly
		{
			get
			{
				return _fly;
			}
			set
			{
				_fly = value;
				ToolsRef.toolsGUI.UpdateLinks();
			}
		}

		public static bool triggers
		{
			get
			{
				return _triggers;
			}
			set
			{
				_triggers = value;
				ToolsRef.toolsGUI.UpdateLinks();
			}
		}

		public static bool saving
		{
			get
			{
				return _saving;
			}
			set
			{
				_saving = value;
				ToolsRef.toolsGUI.UpdateLinks();
			}
		}

		public static bool cars
		{
			get
			{
				return _cars;
			}
			set
			{
				_cars = value;
				ToolsRef.toolsGUI.UpdateLinks();
			}
		}

		public static bool autograf
		{
			get
			{
				return _autograf;
			}
			set
			{
				_autograf = value;
				ToolsRef.toolsGUI.UpdateLinks();
			}
		}
	}

	public class Attributes : MonoBehaviour
	{
		private static Vector3 _savedPos = Vector3.zero;

		private static float _savedStorage = 0f;

		private static float _savedBoost = 0f;

		private static float _savedSpeed = 0f;

		private static Ability _savedAbility = null;

		private static bool _savedHasBoost = true;

		private static bool _savedHasDash = true;

		private static int _savedAnim = -1;

		private static Vector3 _savedSpeedVector = Vector3.zero;

		private static Vector3 _savedVelDir = Vector3.zero;

		private static Quaternion _savedRot = Quaternion.identity;

		private static MoveStyle _savedMovestyleCurrent = (MoveStyle)0;

		private static MoveStyle _savedMovestyleEquip = (MoveStyle)0;

		private static bool _savedEquipmentUsing = false;

		private static int _charIndex = 3;

		private static int _styleIndex = 2;

		private static int _outfitIndex = 0;

		private static int _levelIndex = 0;

		private static int _saveIndex = 0;

		private static int _spawnIndex = 0;

		private static int _dreamSpawnIndex = 0;

		private static int _framerate = 30;

		private static float _timescale = 0.1f;

		private static float _noclip = 50f;

		private static float _fly = 25f;

		private static Vector3 _levelSpawnPos = Vector3.zero;

		private static Vector3 _levelSpawnRot = Vector3.zero;

		public static float savedPosX
		{
			get
			{
				return _savedPos.x;
			}
			set
			{
				_savedPos.x = value;
				ToolsRef.toolsGUI.UpdateFields("savedPosX", value);
			}
		}

		public static float savedPosY
		{
			get
			{
				return _savedPos.y;
			}
			set
			{
				_savedPos.y = value;
				ToolsRef.toolsGUI.UpdateFields("savedPosY", value);
			}
		}

		public static float savedPosZ
		{
			get
			{
				return _savedPos.z;
			}
			set
			{
				_savedPos.z = value;
				ToolsRef.toolsGUI.UpdateFields("savedPosZ", value);
			}
		}

		public static Vector3 savedPos
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return _savedPos;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				savedPosX = value.x;
				savedPosY = value.y;
				savedPosZ = value.z;
			}
		}

		public static float savedStorage
		{
			get
			{
				return _savedStorage;
			}
			set
			{
				_savedStorage = value;
				ToolsRef.toolsGUI.UpdateFields("savedStorage", value);
			}
		}

		public static float savedBoost
		{
			get
			{
				return _savedBoost;
			}
			set
			{
				_savedBoost = Mathf.Round(value * 100f) / 100f;
				ToolsRef.toolsGUI.UpdateFields("savedBoost", _savedBoost);
			}
		}

		public static float savedSpeed
		{
			get
			{
				return _savedSpeed;
			}
			set
			{
				_savedSpeed = value;
				ToolsRef.toolsGUI.UpdateFields("savedSpeed", value);
			}
		}

		public static Ability savedAbility
		{
			get
			{
				return _savedAbility;
			}
			set
			{
				_savedAbility = value;
			}
		}

		public static bool savedHasBoost
		{
			get
			{
				return _savedHasBoost;
			}
			set
			{
				_savedHasBoost = value;
			}
		}

		public static bool savedHasDash
		{
			get
			{
				return _savedHasDash;
			}
			set
			{
				_savedHasDash = value;
			}
		}

		public static int savedAnim
		{
			get
			{
				return _savedAnim;
			}
			set
			{
				_savedAnim = value;
			}
		}

		public static Vector3 savedSpeedVector
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return _savedSpeedVector;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				_savedSpeedVector = value;
			}
		}

		public static Vector3 savedVelDir
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return _savedVelDir;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				_savedVelDir = value;
			}
		}

		public static Quaternion savedRot
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return _savedRot;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				_savedRot = value;
			}
		}

		public static MoveStyle savedMovestyleCurrent
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return _savedMovestyleCurrent;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				_savedMovestyleCurrent = value;
			}
		}

		public static MoveStyle savedMovestyleEquip
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return _savedMovestyleEquip;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				_savedMovestyleEquip = value;
			}
		}

		public static bool savedEquipmentUsing
		{
			get
			{
				return _savedEquipmentUsing;
			}
			set
			{
				_savedEquipmentUsing = value;
			}
		}

		public static int charIndex
		{
			get
			{
				return _charIndex;
			}
			set
			{
				_charIndex = value;
				ToolsRef.toolsGUI.UpdateSelectors(ToolsRef.toolsFunctions.FuncChangePlayer, ToolsRef.toolsFunctions.CharToName(value));
			}
		}

		public static int styleIndex
		{
			get
			{
				return _styleIndex;
			}
			set
			{
				_styleIndex = value;
				ToolsRef.toolsGUI.UpdateSelectors(ToolsRef.toolsFunctions.FuncChangeStyle, ToolsRef.toolsFunctions.StyleToName(value));
			}
		}

		public static int outfitIndex
		{
			get
			{
				return _outfitIndex;
			}
			set
			{
				_outfitIndex = value;
				ToolsRef.toolsGUI.UpdateSelectors(ToolsRef.toolsFunctions.FuncChangeOutfit, ToolsRef.toolsFunctions.OutfitToName(value));
			}
		}

		public static int levelIndex
		{
			get
			{
				return _levelIndex;
			}
			set
			{
				_levelIndex = value;
				ToolsRef.toolsGUI.UpdateSelectors(ToolsRef.toolsFunctions.FuncChangeLevel, ToolsRef.toolsFunctions.LevelToName(value));
			}
		}

		public static int saveIndex
		{
			get
			{
				return _saveIndex;
			}
			set
			{
				_saveIndex = value;
				ToolsRef.toolsGUI.UpdateSelectors(ToolsRef.toolsFunctions.FuncChangeSave, ToolsRef.toolsFunctions.SaveToName(value));
			}
		}

		public static int spawnIndex
		{
			get
			{
				return _spawnIndex;
			}
			set
			{
				_spawnIndex = value;
				ToolsRef.toolsGUI.UpdateSelectors(ToolsRef.toolsFunctions.FuncChangeSpawn, ToolsRef.toolsFunctions.SpawnToName(value));
			}
		}

		public static int dreamSpawnIndex
		{
			get
			{
				return _dreamSpawnIndex;
			}
			set
			{
				_dreamSpawnIndex = value;
				ToolsRef.toolsGUI.UpdateSelectors(ToolsRef.toolsFunctions.FuncChangeDreamSpawn, ToolsRef.toolsFunctions.DreamSpawnToName(value));
			}
		}

		public static int framerate
		{
			get
			{
				return _framerate;
			}
			set
			{
				_framerate = Mathf.Max(value, 1);
				ToolsRef.toolsGUI.UpdateFields("framerate", Mathf.RoundToInt((float)_framerate));
			}
		}

		public static float timescale
		{
			get
			{
				return _timescale;
			}
			set
			{
				_timescale = Mathf.Max(value, 0.01f);
				ToolsRef.toolsGUI.UpdateFields("timescale", _timescale);
			}
		}

		public static float noclip
		{
			get
			{
				return _noclip;
			}
			set
			{
				_noclip = Mathf.Max(value, 0f);
				ToolsRef.toolsGUI.UpdateFields("noclip", value);
			}
		}

		public static float fly
		{
			get
			{
				return _fly;
			}
			set
			{
				_fly = Mathf.Max(value, 0f);
				ToolsRef.toolsGUI.UpdateFields("fly", value);
			}
		}

		public static Vector3 levelSpawnPos
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return _levelSpawnPos;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				_levelSpawnPos = value;
			}
		}

		public static Vector3 levelSpawnRot
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return _levelSpawnRot;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				_levelSpawnRot = value;
			}
		}
	}

	private delegate void ActiveFunctions();

	private delegate void ActiveFunctionsFixed();

	private delegate void ActiveFlyNoclipFixed();

	private enum ErrorType
	{
		PLAYER_NOT_FOUND,
		BAD_CONDS,
		NO_ACTIVE_GAME,
		NO_SAVE,
		NO_SAVESLOT,
		SAVE_FILE_CORRUPT,
		FATEL,
		SAVE_CREATED
	}

	private class SavedData
	{
		public Vector3 position
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return Attributes.savedPos;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				Attributes.savedPos = value;
			}
		}

		public Vector3 velocityDir
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return Attributes.savedVelDir;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				Attributes.savedVelDir = value;
			}
		}

		public float velocity
		{
			get
			{
				return Attributes.savedSpeed;
			}
			set
			{
				Attributes.savedSpeed = value;
			}
		}

		public Vector3 velocityVector
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return Attributes.savedSpeedVector;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				Attributes.savedSpeedVector = value;
			}
		}

		public Quaternion rotation
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return Attributes.savedRot;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				Attributes.savedRot = value;
			}
		}

		public float boost
		{
			get
			{
				return Attributes.savedBoost;
			}
			set
			{
				Attributes.savedBoost = value;
			}
		}

		public MoveStyle moveStyleCurrent
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return Attributes.savedMovestyleCurrent;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				Attributes.savedMovestyleCurrent = value;
			}
		}

		public MoveStyle moveStyleEquip
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return Attributes.savedMovestyleEquip;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				Attributes.savedMovestyleEquip = value;
			}
		}

		public bool usingEquipment
		{
			get
			{
				return Attributes.savedEquipmentUsing;
			}
			set
			{
				Attributes.savedEquipmentUsing = value;
			}
		}

		public float storageSpeed
		{
			get
			{
				return Attributes.savedStorage;
			}
			set
			{
				Attributes.savedStorage = value;
			}
		}

		public Ability ability
		{
			get
			{
				return Attributes.savedAbility;
			}
			set
			{
				Attributes.savedAbility = value;
			}
		}

		public int animation
		{
			get
			{
				return Attributes.savedAnim;
			}
			set
			{
				Attributes.savedAnim = value;
			}
		}

		public bool hasBoost
		{
			get
			{
				return Attributes.savedHasBoost;
			}
			set
			{
				Attributes.savedHasBoost = value;
			}
		}

		public bool hasDash
		{
			get
			{
				return Attributes.savedHasDash;
			}
			set
			{
				Attributes.savedHasDash = value;
			}
		}
	}

	public class TriggerRender : MonoBehaviour
	{
		private GameObject targetObject;

		private Mesh mesh;

		private MeshFilter filter;

		private MeshRenderer renderer;

		private Material originalMaterial;

		private Material triggerMaterial;

		private bool wasEnabled;

		private float alpha = 0.1f;

		private void Awake()
		{
			targetObject = ((Component)this).gameObject;
			HandleEdgeCases();
			SetUpMesh();
			SetUpFilter();
			SetUpRenderer();
		}

		private void HandleEdgeCases()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: 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_0262: Unknown result type (might be due to invalid IL or missing references)
			BoxCollider val = default(BoxCollider);
			BoxCollider val3 = default(BoxCollider);
			BoxCollider val5 = default(BoxCollider);
			if (((Object)targetObject).name == "DH_MarketShield" && targetObject.TryGetComponent<BoxCollider>(ref val))
			{
				GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)3);
				val2.transform.SetPositionAndRotation(((Component)this).transform.TransformPoint(val.center), ((Component)val).transform.rotation);
				val2.transform.localScale = new Vector3(val.size.x + 0.5f, ((Component)this).transform.TransformVector(val.size).y, ((Component)this).transform.TransformVector(val.size).x);
				Object.Destroy((Object)(object)val2.GetComponent<Collider>());
				val2.GetComponent<Renderer>().enabled = false;
				targetObject = val2;
			}
			else if (((Object)targetObject).name == "DH_BRect_EdgeBISBIS (45)" && targetObject.TryGetComponent<BoxCollider>(ref val3))
			{
				GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)3);
				val4.transform.SetPositionAndRotation(((Component)this).transform.TransformPoint(val3.center), ((Component)val3).transform.rotation);
				val4.transform.localScale = new Vector3(((Component)this).transform.TransformVector(val3.size).x + 1f, ((Component)this).transform.TransformVector(val3.size).y, ((Component)this).transform.TransformVector(val3.size).z - 3.4f);
				Object.Destroy((Object)(object)val4.GetComponent<Collider>());
				val4.GetComponent<Renderer>().enabled = false;
				targetObject = val4;
			}
			else if (((Object)targetObject).name == "Tower_OfficeRow (1)" && targetObject.TryGetComponent<BoxCollider>(ref val5))
			{
				GameObject val6 = GameObject.CreatePrimitive((PrimitiveType)3);
				val6.transform.SetPositionAndRotation(((Component)this).transform.TransformPoint(val5.center), ((Component)val5).transform.rotation);
				val6.transform.Rotate(0f, 90f, 0f);
				val6.transform.localScale = new Vector3(((Component)this).transform.TransformVector(val5.size).x, ((Component)this).transform.TransformVector(val5.size).y, ((Component)this).transform.TransformVector(val5.size).z);
				Object.Destroy((Object)(object)val6.GetComponent<Collider>());
				val6.GetComponent<Renderer>().enabled = false;
				targetObject = val6;
			}
		}

		private void SetUpMesh()
		{
			if ((Object)(object)cubeMesh == (Object)null)
			{
				GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3);
				cubeMesh = obj.GetComponent<MeshFilter>().mesh;
				Object.Destroy((Object)(object)obj);
			}
			mesh = Object.Instantiate<Mesh>(cubeMesh);
		}

		private void SetUpFilter()
		{
			if (!targetObject.TryGetComponent<MeshFilter>(ref filter))
			{
				filter = targetObject.AddComponent<MeshFilter>();
				filter.mesh = mesh;
				filter.mesh.RecalculateNormals();
				filter.mesh.RecalculateBounds();
				filter.mesh.Optimize();
			}
			else
			{
				filter = targetObject.GetComponent<MeshFilter>();
				mesh = filter.mesh;
			}
		}

		private void SetUpRenderer()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			triggerMaterial = Object.Instantiate<Material>(triggerMat);
			triggerMaterial.color = GetMaterialColor();
			if (!targetObject.TryGetComponent<MeshRenderer>(ref renderer))
			{
				renderer = targetObject.AddComponent<MeshRenderer>();
				wasEnabled = false;
			}
			else
			{
				if (((Renderer)renderer).material.HasProperty("_Color"))
				{
					triggerMaterial.color = new Color(((Renderer)renderer).material.color.r, ((Renderer)renderer).material.color.g, ((Renderer)renderer).material.color.b, alpha);
				}
				wasEnabled = ((Renderer)renderer).enabled;
			}
			originalMaterial = ((Renderer)renderer).material;
			((Renderer)renderer).material = triggerMaterial;
		}

		private Color GetMaterialColor()
		{
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			switch ((targetObject.tag.ToLower() != "untagged") ? targetObject.tag.ToLower() : ((Object)targetObject).name.ToLower())
			{
			case "spawner":
				return new Color(0f, 1f, 0f, alpha);
			case "npc":
				return new Color(0.961f, 0.671f, 0.251f, alpha);
			case "trigger":
				return new Color(0.961f, 0.671f, 0.251f, alpha);
			case "progressobject":
				return new Color(0.961f, 0.671f, 0.251f, alpha);
			case "machine":
				return new Color(1f, 1f, 0.351f, alpha);
			case "boostchargeparented":
				return new Color(0f, 0f, 1f, alpha);
			case "camerazone":
				return new Color(0.5f, 0.5f, 1f, alpha);
			case "dh_marketshield":
				return new Color(0.71f, 0.15f, 0.8f, alpha);
			case "dh_brect_edgebisbis (45)":
				return new Color(0.71f, 0.15f, 0.8f, alpha);
			case "tower_officerow (1)":
				return new Color(0.71f, 0.15f, 0.8f, alpha);
			case "collbox":
				return new Color(0.71f, 0.15f, 0.8f, alpha);
			default:
				if (((Object)targetObject).name.Contains("trigger"))
				{
					return new Color(0.961f, 0.671f, 0.251f, alpha);
				}
				return new Color(0f, 1f, 1f, alpha);
			}
		}

		private void Update()
		{
			((Renderer)renderer).material = (Toggles.triggers ? triggerMaterial : originalMaterial);
			((Renderer)renderer).enabled = Toggles.triggers || wasEnabled;
		}
	}

	public static ToolsFunctions Instance;

	private ActiveFunctions activeFunctions;

	private ActiveFunctions activeFunctionsFixed;

	private ActiveFunctions activeFlyNoclipFixed;

	public Text errorMessage;

	private CancellationTokenSource tokenSrc;

	private static int prevVSync = QualitySettings.vSyncCount;

	private static int prevFPS = -1;

	public static bool loadingFile = false;

	private static SavedData savedData = new SavedData();

	private float timeUpdate = Time.time;

	private const float updateRate = 0.25f;

	private int step;

	public static Mesh cubeMesh;

	public static Material triggerMat;

	public static List<GraffitiArt> used_graffiti = new List<GraffitiArt>();

	public ToolsFunctions()
	{
		Instance = this;
	}

	public void UpdateMenuInfo()
	{
		PropertyInfo[] properties = typeof(Attributes).GetProperties(BindingFlags.Static | BindingFlags.Public);
		foreach (PropertyInfo propertyInfo in properties)
		{
			propertyInfo.SetValue(propertyInfo, propertyInfo.GetValue(propertyInfo));
		}
	}

	private void ShowError(string error)
	{
		tokenSrc?.Cancel();
		Task.Run(() => ShowErrorTask(error));
	}

	private async Task ShowErrorTask(string error)
	{
		tokenSrc = new CancellationTokenSource();
		if ((Object)(object)errorMessage != (Object)null)
		{
			string text = "Error: " + error + "...";
			if (error == "Save Created")
			{
				text = "Save Created";
			}
			errorMessage.text = text;
			((Component)errorMessage).gameObject.SetActive(true);
			await Task.Delay(TimeSpan.FromSeconds(3.0), tokenSrc.Token);
			((Component)errorMessage).gameObject.SetActive(false);
		}
	}

	private void Error(ErrorType error, params string[] conds)
	{
		switch (error)
		{
		case ErrorType.PLAYER_NOT_FOUND:
			ShowError("Player Not Found");
			break;
		case ErrorType.BAD_CONDS:
		{
			string text = string.Join(", ", conds);
			ShowError("Coniditon(s) Not Met: " + text);
			break;
		}
		case ErrorType.NO_ACTIVE_GAME:
			ShowError("No Active Game Found");
			break;
		case ErrorType.NO_SAVE:
			ShowError("No Save Found");
			break;
		case ErrorType.NO_SAVESLOT:
			ShowError("No Active Save Slot Found");
			break;
		case ErrorType.SAVE_FILE_CORRUPT:
			ShowError("Save File Could Not Be Loaded");
			break;
		case ErrorType.FATEL:
			ShowError("Something Went Wrong That Shouldn't");
			break;
		case ErrorType.SAVE_CREATED:
			ShowError("Save Created");
			break;
		}
	}

	public void Update()
	{
		activeFunctions?.Invoke();
	}

	public void FixedUpdate()
	{
		activeFunctionsFixed?.Invoke();
		activeFlyNoclipFixed?.Invoke();
	}

	public void FuncRefill()
	{
		Player player = ToolsGame.Game.GetPlayer();
		if ((Object)(object)player != (Object)null && ToolsGame.Game.TryGetValue<float>(ToolsGame.Game.fiPlayer, player, "maxBoostCharge", out var result))
		{
			player.AddBoostCharge(result);
			return;
		}
		if ((Object)(object)player == (Object)null)
		{
			Error(ErrorType.PLAYER_NOT_FOUND);
			return;
		}
		Error(ErrorType.BAD_CONDS, "Max Boost Not Found");
	}

	public void FuncInfBoost()
	{
		ToggleInfBoost();
	}

	private void ToggleInfBoost(bool forceOff = false)
	{
		if ((!forceOff) ? (Toggles.infBoost = !Toggles.infBoost) : (Toggles.infBoost = false))
		{
			activeFunctions = (ActiveFunctions)Delegate.Combine(activeFunctions, new ActiveFunctions(UpdateInfBoost));
		}
		else
		{
			activeFunctions = (ActiveFunctions)Delegate.Remove(activeFunctions, new ActiveFunctions(UpdateInfBoost));
		}
	}

	private void UpdateInfBoost()
	{
		Player player = ToolsGame.Game.GetPlayer();
		if ((Object)(object)player != (Object)null && ToolsGame.Game.TryGetValue<float>(ToolsGame.Game.fiPlayer, player, "maxBoostCharge", out var result))
		{
			player.boostCharge = result;
		}
	}

	public void FuncResetGraf()
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Invalid comparison between Unknown and I4
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Invalid comparison between Unknown and I4
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		WorldHandler worldHandler = ToolsGame.Game.GetWorldHandler();
		SaveManager saveManager = ToolsGame.Game.GetSaveManager();
		if ((Object)(object)worldHandler != (Object)null && worldHandler.SceneObjectsRegister != null)
		{
			foreach (GraffitiSpot grafSpot in worldHandler.SceneObjectsRegister.grafSpots)
			{
				if (grafSpot.isOpen)
				{
					grafSpot.ResetFirstTime();
					if ((int)grafSpot.topCrew == 1)
					{
						grafSpot.topCrew = (Crew)0;
					}
					if ((int)grafSpot.bottomCrew == 1)
					{
						grafSpot.bottomCrew = (Crew)0;
					}
					((AProgressable)grafSpot).SetDefaultData((StageProgress)null);
					grafSpot.SetState((GraffitiState)(-1));
					((AProgressable)grafSpot).WriteToData();
				}
			}
			Player player = ToolsGame.Game.GetPlayer();
			if ((Object)(object)player != (Object)null)
			{
				ToolsGame.Game.TrySetValue(ToolsGame.Game.fiPlayer, player, "rep", 0f);
				ToolsGame.Game.invoke(player, "SetRepLabel", new object[1] { 0f }, ToolsGame.Game.miPlayer);
				foreach (GameObject item in from x in Object.FindObjectsOfType<GameObject>()
					where Object.op_Implicit((Object)(object)x.GetComponent<DynamicRepPickup>())
					select x)
				{
					Object.Destroy((Object)(object)item);
				}
			}
			if (saveManager != null && saveManager.CurrentSaveSlot != null && saveManager.CurrentSaveSlot.GetCurrentStageProgress() != null)
			{
				saveManager.CurrentSaveSlot.GetCurrentStageProgress().reputation = 0;
				saveManager.CurrentSaveSlot.SetCurrentStageProgress(saveManager.CurrentSaveSlot.CurrentStage);
				saveManager.SaveCurrentSaveSlotImmediate();
			}
			else
			{
				Error(ErrorType.FATEL);
			}
		}
		else
		{
			Error(ErrorType.NO_ACTIVE_GAME);
		}
	}

	public void FuncResLevel()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		Player player = ToolsGame.Game.GetPlayer();
		BaseModule baseModule = ToolsGame.Game.GetBaseModule();
		SaveManager saveManager = ToolsGame.Game.GetSaveManager();
		if ((Object)(object)player != (Object)null && (Object)(object)baseModule != (Object)null && saveManager != null && saveManager.CurrentSaveSlot != null)
		{
			StageProgress currentStageProgress = saveManager.CurrentSaveSlot.GetCurrentStageProgress();
			currentStageProgress.respawnPos = Attributes.levelSpawnPos;
			currentStageProgress.respawnRot = Attributes.levelSpawnRot;
			saveManager.SaveCurrentSaveSlot();
			baseModule.UnPauseGame((PauseType)65535);
			baseModule.StageManager.ExitCurrentStage(baseModule.CurrentStage, (Stage)(-1));
		}
		else
		{
			Error(ErrorType.NO_ACTIVE_GAME);
		}
	}

	public void FuncRefillHP()
	{
		Player player = ToolsGame.Game.GetPlayer();
		if ((Object)(object)player != (Object)null)
		{
			if (ToolsGame.Game.TryGetValue<float>(ToolsGame.Game.fiPlayer, player, "maxHP", out var result))
			{
				ToolsGame.Game.TrySetValue(ToolsGame.Game.fiPlayer, player, "HP", result);
			}
		}
		else
		{
			Error(ErrorType.PLAYER_NOT_FOUND);
		}
	}

	public void FuncInvulnerable()
	{
		ToggleInvulnerable();
	}

	public void ToggleInvulnerable(bool forceOff = false)
	{
		if ((!forceOff) ? (Toggles.invulnerable = !Toggles.invulnerable) : (Toggles.invulnerable = false))
		{
			activeFunctions = (ActiveFunctions)Delegate.Combine(activeFunctions, new ActiveFunctions(UpdateInvulnerable));
		}
		else
		{
			activeFunctions = (ActiveFunctions)Delegate.Remove(activeFunctions, new ActiveFunctions(UpdateInvulnerable));
		}
	}

	private void UpdateInvulnerable()
	{
		Player player = ToolsGame.Game.GetPlayer();
		if ((Object)(object)player != (Object)null && ToolsGame.Game.TryGetValue<float>(ToolsGame.Game.fiPlayer, player, "maxHP", out var result))
		{
			ToolsGame.Game.TrySetValue(ToolsGame.Game.fiPlayer, player, "HP", result);
		}
	}

	public void FuncPolice()
	{
		TogglePolice();
	}

	private void TogglePolice(bool forceOff = false)
	{
		if ((!forceOff) ? (Toggles.police = !Toggles.police) : (Toggles.police = false))
		{
			activeFunctions = (ActiveFunctions)Delegate.Combine(activeFunctions, new ActiveFunctions(UpdatePolice));
		}
		else
		{
			activeFunctions = (ActiveFunctions)Delegate.Remove(activeFunctions, new ActiveFunctions(UpdatePolice));
		}
	}

	private void UpdatePolice()
	{
		if ((Object)(object)WantedManager.instance != (Object)null)
		{
			WantedManager.instance.StopPlayerWantedStatus(false);
		}
	}

	public void FuncDisCars()
	{
		ToggleDisCars();
	}

	private void ToggleDisCars(bool forceOff = false)
	{
		if ((!forceOff) ? (Toggles.cars = !Toggles.cars) : (Toggles.cars = false))
		{
			activeFunctions = (ActiveFunctions)Delegate.Combine(activeFunctions, new ActiveFunctions(UpdateDisCars));
		}
		else
		{
			activeFunctions = (ActiveFunctions)Delegate.Remove(activeFunctions, new ActiveFunctions(UpdateDisCars));
		}
	}

	private void UpdateDisCars()
	{
	}

	public void FuncLockFPS()
	{
		prevVSync = QualitySettings.vSyncCount;
		ToggleLockFPS();
	}

	private void ToggleLockFPS(bool forceOff = false)
	{
		if ((!forceOff) ? (Toggles.tfps = !Toggles.tfps) : (Toggles.tfps = false))
		{
			activeFunctions = (ActiveFunctions)Delegate.Combine(activeFunctions, new ActiveFunctions(UpdateLockFPS));
			return;
		}
		QualitySettings.vSyncCount = prevVSync;
		Application.targetFrameRate = prevFPS;
		activeFunctions = (ActiveFunctions)Delegate.Remove(activeFunctions, new ActiveFunctions(UpdateLockFPS));
	}

	private void UpdateLockFPS()
	{
		QualitySettings.vSyncCount = 0;
		Application.targetFrameRate = Attributes.framerate;
	}

	public void FuncSetTimescale()
	{
		ToggleSetTimescale();
	}

	private void ToggleSetTimescale(bool forceOff = false)
	{
		if ((!forceOff) ? (Toggles.timescale = !Toggles.timescale) : (Toggles.timescale = false))
		{
			activeFunctions = (ActiveFunctions)Delegate.Combine(activeFunctions, new ActiveFunctions(UpdateSetTimescale));
			return;
		}
		Time.timeScale = 1f;
		activeFunctions = (ActiveFunctions)Delegate.Remove(activeFunctions, new ActiveFunctions(UpdateSetTimescale));
	}

	private void UpdateSetTimescale()
	{
		Time.timeScale = Attributes.timescale;
	}

	public void FuncNoclip()
	{
		ToggleNoclip();
	}

	private void ToggleNoclip(bool forceOff = false)
	{
		if ((Object)(object)ToolsGame.Game.GetPlayer() != (Object)null)
		{
			if ((!forceOff) ? (Toggles.noclip = !Toggles.noclip) : (Toggles.noclip = false))
			{
				if (Toggles.fly)
				{
					Toggles.fly = false;
				}
				activeFlyNoclipFixed = UpdateFlyNoclip;
			}
			else if (!Toggles.fly)
			{
				EndFlyNoclip();
			}
		}
		else
		{
			EndFlyNoclip();
		}
	}

	public void FuncFly()
	{
		ToggleFly();
	}

	private void ToggleFly(bool forceOff = false)
	{
		if ((Object)(object)ToolsGame.Game.GetPlayer() != (Object)null)
		{
			if ((!forceOff) ? (Toggles.fly = !Toggles.fly) : (Toggles.fly = false))
			{
				if (Toggles.noclip)
				{
					Toggles.noclip = false;
				}
				activeFlyNoclipFixed = UpdateFlyNoclip;
			}
			else if (!Toggles.noclip)
			{
				EndFlyNoclip();
			}
		}
		else
		{
			EndFlyNoclip();
		}
	}

	private void UpdateFlyNoclip()
	{
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: 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_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: 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_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		Player player = ToolsGame.Game.GetPlayer();
		GameInput gameInput = ToolsGame.Game.GetGameInput();
		if ((Toggles.noclip || Toggles.fly) && (Object)(object)player != (Object)null && gameInput != null)
		{
			if (Toggles.noclip)
			{
				((Component)player).GetComponent<Collider>().enabled = false;
				player.interactionCollider.enabled = false;
			}
			else
			{
				((Component)player).GetComponent<Collider>().enabled = true;
				player.interactionCollider.enabled = true;
			}
			if ((Object)(object)Camera.main != (Object)null)
			{
				Camera.main.farClipPlane = 20000f;
			}
			ToolsGame.Game.TrySetValue(ToolsGame.Game.fiPlayer, player, "userInputEnabled", value: false);
			if (!ToolsGame.Game.TryGetValue<Transform>(ToolsGame.Game.fiWorldHandler, ToolsGame.Game.GetWorldHandler(), "currentCameraTransform", out var result))
			{
				return;
			}
			Vector3 val = Vector3.zero;
			float num = (Toggles.fly ? Attributes.fly : Attributes.noclip);
			player.CompletelyStop();
			if (gameInput != null)
			{
				Vector3 val2 = gameInput.GetAxis(5, 0) * result.right * num;
				Vector3 val3 = gameInput.GetAxis(6, 0) * Vector3.Normalize(new Vector3(result.forward.x, 0f, result.forward.z)) * num;
				Vector3 val4 = val2 + val3;
				val4.y = 0f;
				if (((Vector3)(ref val4)).magnitude > num)
				{
					val4 = ((Vector3)(ref val4)).normalized * num;
				}
				val = val4;
				if (val != Vector3.zero)
				{
					player.motor.rotation = Quaternion.Euler(new Vector3(0f, result.eulerAngles.y, result.eulerAngles.z));
				}
			}
			if (Input.GetKey((KeyCode)32) || (gameInput != null && gameInput.GetButtonHeld(7, 0)))
			{
				if (player.IsGrounded())
				{
					player.motor.ForcedUnground();
					player.Jump();
				}
				val.y = 20f;
			}
			else if (Input.GetKey((KeyCode)306) || (gameInput != null && gameInput.GetButtonHeld(65, 0)))
			{
				val.y = -20f;
			}
			else
			{
				val.y = 0f;
			}
			player.SetVelocity(val);
		}
		else
		{
			EndFlyNoclip();
		}
	}

	private void EndFlyNoclip()
	{
		if (Toggles.fly)
		{
			Toggles.fly = false;
		}
		if (Toggles.noclip)
		{
			Toggles.noclip = false;
		}
		activeFlyNoclipFixed = null;
		Player player = ToolsGame.Game.GetPlayer();
		if ((Object)(object)player != (Object)null)
		{
			if ((Object)(object)Camera.main != (Object)null)
			{
				Camera.main.farClipPlane = 1000f;
			}
			ToolsGame.Game.TrySetValue(ToolsGame.Game.fiPlayer, player, "userInputEnabled", value: true);
			player.interactionCollider.enabled = true;
			((Component)player).GetComponent<Collider>().enabled = true;
		}
	}

	public void FuncDisSaving()
	{
		ToggleDisSaving();
	}

	private void ToggleDisSaving(bool forceOff = false)
	{
		if ((!forceOff) ? (Toggles.saving = !Toggles.saving) : (Toggles.saving = false))
		{
			activeFunctions = (ActiveFunctions)Delegate.Combine(activeFunctions, new ActiveFunctions(UpdateDisSaving));
		}
		else
		{
			activeFunctions = (ActiveFunctions)Delegate.Remove(activeFunctions, new ActiveFunctions(UpdateDisSaving));
		}
	}

	private void UpdateDisSaving()
	{
	}

	public void FuncEndWanted()
	{
		if ((Object)(object)WantedManager.instance != (Object)null)
		{
			WantedManager.instance.StopPlayerWantedStatus(false);
		}
		else
		{
			Error(ErrorType.NO_ACTIVE_GAME);
		}
	}

	public void FuncSetStorage()
	{
		SetStorageSpeed();
	}

	private void SetStorageSpeed()
	{
		WallrunLineAbility wallrunLineAbility = ToolsGame.Game.GetWallrunLineAbility();
		if (wallrunLineAbility == null || !ToolsGame.Game.TrySetValue(ToolsGame.Game.fiWallrun, wallrunLineAbility, "lastSpeed", savedData.storageSpeed))
		{
			Error((wallrunLineAbility != null) ? ErrorType.FATEL : ErrorType.PLAYER_NOT_FOUND);
		}
	}

	public float GetStorageSpeed()
	{
		WallrunLineAbility wallrunLineAbility = ToolsGame.Game.GetWallrunLineAbility();
		if (wallrunLineAbility != null && ToolsGame.Game.TryGetValue<float>(ToolsGame.Game.fiWallrun, wallrunLineAbility, "lastSpeed", out var result))
		{
			return result;
		}
		return 0f;
	}

	public string FuncChangePlayer(int i)
	{
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		int num = Attributes.charIndex + i;
		Attributes.charIndex = ((num < 0) ? 25 : ((num < 26) ? num : 0));
		Player player = ToolsGame.Game.GetPlayer();
		if ((Object)(object)player != (Object)null && ToolsGame.Game.TryGetValue<bool>(ToolsGame.Game.fiPlayer, player, "usingEquippedMovestyle", out var result))
		{
			player.SetCharacter((Characters)Attributes.charIndex, Attributes.outfitIndex);
			RefreshPlayer();
			player.SwitchToEquippedMovestyle(result, false, true, false);
			if (Core.Instance.SaveManager != null && Core.Instance.SaveManager.CurrentSaveSlot != null && Core.Instance.SaveManager.CurrentSaveSlot.GetCharacterProgress((Characters)Attributes.charIndex) != null)
			{
				Core.Instance.SaveManager.CurrentSaveSlot.GetCharacterProgress((Characters)Attributes.charIndex).character = (Characters)Attributes.charIndex;
			}
		}
		return CharToName(Attributes.charIndex);
	}

	public string CharToName(int i)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		Characters val = (Characters)i;
		string text = ((object)(Characters)(ref val)).ToString();
		if (ToolsRef.toolsConfig.charToName.TryGetValue(text, out var value))
		{
			return value;
		}
		return text;
	}

	public string FuncChangeStyle(int i)
	{
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		int num = Attributes.styleIndex + i;
		int num2 = (ToolsConfig.Settings.shouldHaveSpecial ? 5 : 4);
		Attributes.styleIndex = ((num < 1) ? (num2 - 1) : ((num >= num2) ? 1 : num));
		Player player = ToolsGame.Game.GetPlayer();
		if ((Object)(object)player != (Object)null && ToolsGame.Game.TryGetValue<bool>(ToolsGame.Game.fiPlayer, player, "usingEquippedMovestyle", out var result))
		{
			player.SetCurrentMoveStyleEquipped((MoveStyle)Attributes.styleIndex, true, true);
			RefreshPlayer();
			player.SwitchToEquippedMovestyle(result, false, true, false);
			if (Core.Instance.SaveManager != null && Core.Instance.SaveManager.CurrentSaveSlot != null && Core.Instance.SaveManager.CurrentSaveSlot.GetCharacterProgress((Characters)Attributes.charIndex) != null)
			{
				Core.Instance.SaveManager.CurrentSaveSlot.GetCharacterProgress((Characters)Attributes.charIndex).moveStyle = (MoveStyle)Attributes.styleIndex;
			}
		}
		return StyleToName(Attributes.styleIndex);
	}

	public string StyleToName(int i)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		MoveStyle val = (MoveStyle)i;
		string text = ((object)(MoveStyle)(ref val)).ToString();
		if (ToolsRef.toolsConfig.styleToName.TryGetValue(text, out var value))
		{
			return value;
		}
		return text;
	}

	public string FuncChangeOutfit(int i)
	{
		int num = Attributes.outfitIndex + i;
		int num2 = ToolsRef.toolsConfig.outfitToName.Keys.Count - 1;
		Attributes.outfitIndex = ((num < 0) ? num2 : ((num <= num2) ? num : 0));
		Player player = ToolsGame.Game.GetPlayer();
		if ((Object)(object)player != (Object)null)
		{
			player.SetOutfit(Attributes.outfitIndex);
		}
		return OutfitToName(Attributes.outfitIndex);
	}

	public string OutfitToName(int i)
	{
		if (ToolsRef.toolsConfig.outfitToName.TryGetValue(i, out var value))
		{
			return value;
		}
		return i.ToString();
	}

	public string FuncChangeLevel(int i)
	{
		int num = Attributes.levelIndex + i;
		int num2 = ToolsRef.toolsConfig.levelToName.Keys.Count - 1;
		Attributes.levelIndex = ((num < 0) ? num2 : ((num <= num2) ? num : 0));
		return LevelToName(Attributes.levelIndex);
	}

	public string LevelToName(int i)
	{
		if (ToolsRef.toolsConfig.levelToName.TryGetValue(ToolsRef.toolsConfig.levelToName.Keys.ToArray()[i], out var value))
		{
			return value;
		}
		return i.ToString();
	}

	private void UpdateSaveFiles()
	{
		if (Directory.Exists(ToolsConfig.folder_saves) && File.Exists(ToolsConfig.file_desc))
		{
			string[] source = (from x in Directory.GetFiles(ToolsConfig.folder_saves)
				where x.EndsWith(ToolsConfig.ext_saves)
				select x).ToArray();
			if (source.Count() != ToolsConfig.files_saves.Keys.Count() || !source.All((string x) => ToolsConfig.files_saves.Keys.Contains(x)) || !File.ReadAllLines(ToolsConfig.file_desc).ToHashSet().SequenceEqual(ToolsConfig.desc_contents))
			{
				ToolsConfig.Instance.UpdateSaveFiles();
			}
		}
		else
		{
			ToolsConfig.files_saves.Clear();
		}
	}

	public string FuncChangeSave(int i)
	{
		UpdateSaveFiles();
		int num = Attributes.saveIndex + i;
		int num2 = ToolsConfig.files_saves.Keys.Count - 1;
		Attributes.saveIndex = ((num < 0) ? Mathf.Max(num2, 0) : ((num <= num2) ? num : 0));
		return SaveToName(Attributes.saveIndex);
	}

	public string SaveToName(int i)
	{
		if (ToolsConfig.files_saves.Count > 0 && ToolsConfig.files_saves.TryGetValue(ToolsConfig.files_saves.Keys.ToArray()[i], out var value))
		{
			return value;
		}
		return i.ToString();
	}

	public void FuncLoadSaveFile()
	{
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Expected O, but got Unknown
		if (ToolsConfig.files_saves.Count > 0)
		{
			BaseModule baseModule = ToolsGame.Game.GetBaseModule();
			SaveManager saveManager = ToolsGame.Game.GetSaveManager();
			SaveSlotHandler saveSlotHandler = ToolsGame.Game.GetSaveSlotHandler();
			string path = Path.Combine(ToolsConfig.folder_saves, ToolsConfig.files_saves.Keys.ToArray()[Attributes.saveIndex]);
			if (File.Exists(path) && (Object)(object)baseModule != (Object)null && saveManager != null && saveManager.CurrentSaveSlot != null && (Object)(object)ToolsGame.Game.GetPlayer() != (Object)null && saveSlotHandler != null)
			{
				try
				{
					using BinaryReader binaryReader = new BinaryReader(File.Open(path, FileMode.Open, FileAccess.Read, FileShare.None));
					SaveSlotData val = new SaveSlotData();
					val.Read(binaryReader);
					val.saveSlotId = saveManager.CurrentSaveSlot.saveSlotId;
					if (ToolsGame.Game.TrySetValue<SaveSlotData>(ToolsGame.Game.fiSaveSlotHandler, saveSlotHandler, "currentSaveSlot", val))
					{
						loadingFile = true;
						saveManager.SaveCurrentSaveSlotImmediate();
						baseModule.UnPauseGame((PauseType)65535);
						baseModule.UnloadCurrentStage();
						Core.Instance.Platform.User.LogOut();
						if (ToolsGame.Game.TryGetValue<List<ASceneSetupInstruction>>(ToolsGame.Game.fiBaseMod, baseModule, "currentSceneSetupInstructions", out var result))
						{
							for (int num = result.Count - 1; num >= 0; num--)
							{
								ToolsGame.Game.invoke(baseModule, "StopLoadInstruction", new object[1] { result[num] }, ToolsGame.Game.miBaseMod);
							}
						}
						baseModule.StartGameToStage((Stage)8);
					}
					return;
				}
				catch (Exception ex)
				{
					Debug.LogError((object)ex);
					Error(ErrorType.SAVE_FILE_CORRUPT);
					return;
				}
			}
			if (!File.Exists(path))
			{
				Error(ErrorType.NO_SAVE);
			}
			else if ((Object)(object)ToolsGame.Game.GetPlayer() == (Object)null)
			{
				Error(ErrorType.NO_SAVESLOT);
			}
			else
			{
				Error(ErrorType.FATEL);
			}
		}
		else
		{
			Error(ErrorType.NO_SAVE);
		}
	}

	private string GetCurrentFileName(SaveSlotHandler saveSlotHandler, int i)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Expected I4, but got Unknown
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		if (saveSlotHandler != null && saveSlotHandler.CurrentSaveSlot != null && (Object)(object)ToolsGame.Game.GetPlayer() != (Object)null)
		{
			return string.Format("{0}-{1}-{2}", ((int)Story.GetCurrentObjectiveInfo().chapter).ToString("D3"), i.ToString("D4"), saveSlotHandler.CurrentSaveSlot.CurrentStoryObjective);
		}
		return $"no_file_name-{i}";
	}

	public void FuncCreateSaveFile()
	{
		SaveSlotHandler saveSlotHandler = ToolsGame.Game.GetSaveSlotHandler();
		if (saveSlotHandler != null && saveSlotHandler.CurrentSaveSlot != null && (Object)(object)ToolsGame.Game.GetPlayer() != (Object)null)
		{
			int num = ToolsConfig.files_saves.Count();
			string currentFileName = GetCurrentFileName(saveSlotHandler, num);
			string text = Path.Combine(ToolsConfig.folder_saves, currentFileName);
			bool flag = true;
			if (File.Exists(text + ToolsConfig.ext_saves))
			{
				while (File.Exists(Path.Combine(ToolsConfig.folder_saves, currentFileName + ToolsConfig.ext_saves)))
				{
					num++;
					if (num > 9999)
					{
						flag = false;
						break;
					}
					currentFileName = GetCurrentFileName(saveSlotHandler, num);
				}
				text = Path.Combine(ToolsConfig.folder_saves, currentFileName);
			}
			if (!flag)
			{
				return;
			}
			string text2 = text + ToolsConfig.ext_saves;
			using (BinaryWriter binaryWriter = new BinaryWriter(new FileStream(text2, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)))
			{
				saveSlotHandler.CurrentSaveSlot.Write(binaryWriter);
			}
			if (File.Exists(ToolsConfig.file_desc))
			{
				File.AppendAllText(ToolsConfig.file_desc, "\n" + currentFileName + ToolsConfig.ext_saves + ": " + currentFileName);
				ToolsConfig.files_saves.Add(text2, currentFileName);
				ToolsConfig.files_saves = ToolsConfig.files_saves.OrderBy<KeyValuePair<string, string>, string>((KeyValuePair<string, string> x) => x.Key, StringComparer.OrdinalIgnoreCase).ToDictionary((KeyValuePair<string, string> x) => x.Key, (KeyValuePair<string, string> y) => y.Value);
				Attributes.saveIndex = ToolsConfig.files_saves.Keys.ToList().IndexOf(text2);
			}
			Error(ErrorType.SAVE_CREATED);
		}
		else if ((Object)(object)ToolsGame.Game.GetPlayer() == (Object)null)
		{
			Error(ErrorType.NO_SAVESLOT);
		}
		else
		{
			Error(ErrorType.FATEL);
		}
	}

	public void FuncResGame()
	{
		BaseModule baseModule = ToolsGame.Game.GetBaseModule();
		Player player = ToolsGame.Game.GetPlayer();
		if ((Object)(object)baseModule != (Object)null && (Object)(object)player != (Object)null && (Object)(object)Core.Instance.UIManager != (Object)null && !Core.Instance.UIManager.Overlay.IsShowingLoadingScreen)
		{
			baseModule.UnPauseGame((PauseType)65535);
			baseModule.UnloadCurrentStage();
			Core.Instance.Platform.User.LogOut();
			if (ToolsGame.Game.TryGetValue<List<ASceneSetupInstruction>>(ToolsGame.Game.fiBaseMod, baseModule, "currentSceneSetupInstructions", out var result))
			{
				for (int num = result.Count - 1; num >= 0; num--)
				{
					ToolsGame.Game.invoke(baseModule, "StopLoadInstruction", new object[1] { result[num] }, ToolsGame.Game.miBaseMod);
				}
			}
			baseModule.StartGameToStage((Stage)8);
		}
		else
		{
			Error(ErrorType.NO_ACTIVE_GAME);
		}
	}

	public void FuncSave()
	{
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		Player player = ToolsGame.Game.GetPlayer();
		WallrunLineAbility wallrunLineAbility = ToolsGame.Game.GetWallrunLineAbility();
		if ((Object)(object)player != (Object)null && wallrunLineAbility != null && ToolsGame.Game.TryGetValue<float>(ToolsGame.Game.fiPlayer, player, "boostCharge", out var result) && ToolsGame.Game.TryGetValue<MoveStyle>(ToolsGame.Game.fiPlayer, player, "moveStyle", out var result2) && ToolsGame.Game.TryGetValue<MoveStyle>(ToolsGame.Game.fiPlayer, player, "moveStyleEquipped", out var result3) && ToolsGame.Game.TryGetValue<bool>(ToolsGame.Game.fiPlayer, player, "usingEquippedMovestyle", out var result4) && ToolsGame.Game.TryGetValue<float>(ToolsGame.Game.fiWallrun, wallrunLineAbility, "lastSpeed", out var result5) && ToolsGame.Game.TryGetValue<Ability>(ToolsGame.Game.fiPlayer, player, "ability", out var result6) && ToolsGame.Game.TryGetValue<int>(ToolsGame.Game.fiPlayer, player, "curAnim", out var result7) && ToolsGame.Game.TryGetValue<BoostAbility>(ToolsGame.Game.fiPlayer, player, "boostAbility", out var result8) && ToolsGame.Game.TryGetValue<AirDashAbility>(ToolsGame.Game.fiPlayer, player, "airDashAbility", out var result9))
		{
			SavedData obj = new SavedData
			{
				position = player.tf.position
			};
			Vector3 velocity = player.motor.velocity;
			obj.velocityDir = ((Vector3)(ref velocity)).normalized;
			velocity = player.motor.velocity;
			obj.velocity = ((Vector3)(ref velocity)).magnitude;
			obj.velocityVector = player.motor.velocity;
			obj.rotation = player.motor.rotation;
			obj.boost = result;
			obj.moveStyleCurrent = result2;
			obj.moveStyleEquip = result3;
			obj.usingEquipment = result4;
			obj.storageSpeed = result5;
			obj.ability = result6;
			obj.animation = result7;
			obj.hasBoost = result8.haveAirStartBoost;
			obj.hasDash = result9.haveAirDash;
			savedData = obj;
		}
		else
		{
			Error((!((Object)(object)player == (Object)null)) ? ErrorType.FATEL : ErrorType.PLAYER_NOT_FOUND);
		}
	}

	private void RefreshPlayer()
	{
		Player player = ToolsGame.Game.GetPlayer();
		if ((Object)(object)player != (Object)null)
		{
			ToolsGame.Game.invoke(player, "InitHitboxes", null, ToolsGame.Game.miPlayer);
			ToolsGame.Game.invoke(player, "InitCuffs", null, ToolsGame.Game.miPlayer);
		}
	}

	public void FuncLoad()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Expected I4, but got Unknown
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		Player player = ToolsGame.Game.GetPlayer();
		if ((Object)(object)player != (Object)null)
		{
			ToolsGame.Game.invoke(player, "InitCuffs", null, ToolsGame.Game.miPlayer);
			WorldHandler worldHandler = ToolsGame.Game.GetWorldHandler();
			if (worldHandler != null)
			{
				worldHandler.PlaceCurrentPlayerAt(savedData.position, savedData.rotation, true);
			}
			Vector3 val = savedData.velocityDir * savedData.velocity;
			player.SetVelocity(new Vector3(val.x, savedData.velocityVector.y, val.z));
			player.AddBoostCharge(0f - player.boostCharge);
			player.AddBoostCharge(savedData.boost);
			if ((int)savedData.moveStyleEquip != 0)
			{
				player.SetCurrentMoveStyleEquipped(savedData.moveStyleEquip, true, false);
				player.SwitchToEquippedMovestyle(savedData.usingEquipment, false, true, false);
				Attributes.styleIndex = (int)savedData.moveStyleEquip;
			}
			if (Core.Instance.SaveManager != null && Core.Instance.SaveManager.CurrentSaveSlot != null && Core.Instance.SaveManager.CurrentSaveSlot.GetCharacterProgress(Core.Instance.SaveManager.CurrentSaveSlot.currentCharacter) != null)
			{
				Core.Instance.SaveManager.CurrentSaveSlot.GetCharacterProgress(Core.Instance.SaveManager.CurrentSaveSlot.currentCharacter).moveStyle = (MoveStyle)Attributes.styleIndex;
			}
			SetStorageSpeed();
			if (savedData.animation != -1)
			{
				player.PlayAnim(savedData.animation, true, true, 0f);
			}
			if (ToolsGame.Game.TryGetValue<BoostAbility>(ToolsGame.Game.fiPlayer, player, "boostAbility", out var result) && ToolsGame.Game.TryGetValue<AirDashAbility>(ToolsGame.Game.fiPlayer, player, "airDashAbility", out var result2))
			{
				result.haveAirStartBoost = savedData.hasBoost;
				result2.haveAirDash = savedData.hasDash;
			}
			if (savedData.ability != null)
			{
				Type type = ((object)savedData.ability).GetType();
				if (type == typeof(GrindAbility))
				{
					Ability ability = savedData.ability;
					((GrindAbility)((ability is GrindAbility) ? ability : null)).cooldown = 0f;
				}
				else if (type == typeof(WallrunLineAbility))
				{
					Ability ability2 = savedData.ability;
					((WallrunLineAbility)((ability2 is WallrunLineAbility) ? ability2 : null)).cooldownTimer = 0f;
				}
				else if (type == typeof(HandplantAbility))
				{
					Ability ability3 = savedData.ability;
					((HandplantAbility)((ability3 is HandplantAbility) ? ability3 : null)).cooldownTimer = 0f;
				}
			}
		}
		else
		{
			Error(ErrorType.PLAYER_NOT_FOUND);
		}
	}

	public void FuncGoToLevel()
	{
		BaseModule baseModule = ToolsGame.Game.GetBaseModule();
		if ((Object)(object)baseModule != (Object)null && (Object)(object)ToolsGame.Game.GetPlayer() != (Object)null)
		{
			baseModule.UnPauseGame((PauseType)65535);
			baseModule.StageManager.ExitCurrentStage((Stage)ToolsRef.toolsConfig.levelToName.Keys.ToArray()[Attributes.levelIndex], (Stage)(-1));
		}
		else
		{
			Error(ErrorType.NO_ACTIVE_GAME);
		}
	}

	public void FuncTriggers()
	{
		ToggleTriggers();
		HandleTriggers();
	}

	private void ToggleTriggers(bool forceOff = false)
	{
		if ((!forceOff) ? (Toggles.triggers = !Toggles.triggers) : (Toggles.triggers = false))
		{
			timeUpdate = Time.time;
			activeFunctionsFixed = (ActiveFunctions)Delegate.Combine(activeFunctionsFixed, new ActiveFunctions(UpdateTriggers));
		}
		else
		{
			activeFunctionsFixed = (ActiveFunctions)Delegate.Remove(activeFunctionsFixed, new ActiveFunctions(UpdateTriggers));
		}
	}

	private void UpdateTriggers()
	{
		if (Toggles.triggers && Time.time >= timeUpdate + 0.25f)
		{
			timeUpdate = Time.time;
			HandleTriggers();
		}
	}

	public void HandleTriggers()
	{
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		WorldHandler worldHandler = ToolsGame.Game.GetWorldHandler();
		Player player = ToolsGame.Game.GetPlayer();
		bool flag = (Object)(object)worldHandler != (Object)null && (Object)(object)worldHandler.CurrentCamera != (Object)null;
		if (Toggles.triggers && (Object)(object)player != (Object)null && flag)
		{
			if ((Object)(object)triggerMat == (Object)null)
			{
				triggerMat = new Material(Shader.Find("TextMeshPro/Sprite"));
			}
			worldHandler.CurrentCamera.cullingMask = -1;
			TriggerRender triggerRender = default(TriggerRender);
			GrindLine val3 = default(GrindLine);
			StreetLife val4 = default(StreetLife);
			List<Collider> list = (from x in Physics.OverlapSphere(((Component)player).transform.position, 150f)
				where ((Component)x).gameObject.activeInHierarchy && !((Component)x).gameObject.TryGetComponent<TriggerRender>(ref triggerRender) && !((Component)x).gameObject.TryGetComponent<GrindLine>(ref val3) && !((Component)x).gameObject.TryGetComponent<StreetLife>(ref val4) && ((Component)x).tag != "walkZone"
				select x).ToList();
			if (list.Count <= 0)
			{
				return;
			}
			List<Collider> list2 = new List<Collider>();
			switch (step)
			{
			case 0:
				list2 = list.Where((Collider filter) => ((Object)filter).name == "PyramidWoodsCollider" || ((Object)filter).name == "CollBox" || filter.isTrigger || ((Component)filter).tag != "Untagged" || ((Object)(object)filter.material == (Object)null && filter.enabled)).ToList();
				step++;
				break;
			case 1:
			{
				MeshRenderer val = default(MeshRenderer);
				list2 = list.Where((Collider filter) => ((Component)filter).gameObject.TryGetComponent<MeshRenderer>(ref val) && (((Object)((Renderer)val).material).name.Contains("ProCollisionMat") || ((Object)((Renderer)val).material).name.Contains("ProBuilderDefault"))).ToList();
				step++;
				break;
			}
			case 2:
				list2 = list.Where(delegate(Collider filter)
				{
					//IL_002f: 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_0037: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					if (!(((Object)filter).name == "DH_BRect_EdgeBISBIS (45)"))
					{
						BoxCollider val2 = default(BoxCollider);
						if (((Object)filter).name == "DH_MarketShield" && ((Component)filter).TryGetComponent<BoxCollider>(ref val2))
						{
							Bounds bounds = ((Collider)val2).bounds;
							Vector3 center = ((Bounds)(ref bounds)).center;
							if (((object)(Vector3)(ref center)).ToString() == "(-2815.61, 135.45, -90.82)")
							{
								goto IL_0067;
							}
						}
						return ((Object)filter).name == "Tower_OfficeRow (1)";
					}
					goto IL_0067;
					IL_0067:
					return true;
				}).ToList();
				step = 0;
				break;
			}
			{
				foreach (Collider item in list2)
				{
					((Component)item).gameObject.AddComponent<TriggerRender>();
				}
				return;
			}
		}
		if (flag)
		{
			worldHandler.CurrentCamera.cullingMask = WorldHandler.GetGameplayCameraCullingMask();
		}
	}

	public void FuncAutoGraf()
	{
		ToggleAutoGraf();
	}

	public void ToggleAutoGraf(bool forceOff = false)
	{
		if ((!forceOff) ? (Toggles.autograf = !Toggles.autograf) : (Toggles.autograf = false))
		{
			activeFunctions = (ActiveFunctions)Delegate.Combine(activeFunctions, new ActiveFunctions(UpdateAutoGraf));
		}
		else
		{
			activeFunctions = (ActiveFunctions)Delegate.Remove(activeFunctions, new ActiveFunctions(UpdateAutoGraf));
		}
	}

	private void UpdateAutoGraf()
	{
	}

	public string FuncChangeSpawn(int i)
	{
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		Player player = ToolsGame.Game.GetPlayer();
		WorldHandler worldHandler = ToolsGame.Game.GetWorldHandler();
		if ((Object)(object)player != (Object)null && (Object)(object)worldHandler != (Object)null)
		{
			List<PlayerSpawner> playerSpawners = worldHandler.SceneObjectsRegister.playerSpawners;
			int num = Attributes.spawnIndex + i;
			int num2 = playerSpawners.Count() - 1;
			Attributes.spawnIndex = ((num < 0) ? num2 : ((num <= num2) ? num : 0));
			worldHandler.PlaceCurrentPlayerAt(((Component)playerSpawners[Attributes.spawnIndex]).transform.position, ((Component)playerSpawners[Attributes.spawnIndex]).transform.rotation, true);
		}
		return SpawnToName(Attributes.spawnIndex);
	}

	public string SpawnToName(int i)
	{
		return $"{i}";
	}

	public string FuncChangeDreamSpawn(int i)
	{
		//IL_007e: 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)
		Player player = ToolsGame.Game.GetPlayer();
		WorldHandler worldHandler = ToolsGame.Game.GetWorldHandler();
		if ((Object)(object)player != (Object)null && (Object)(object)worldHandler != (Object)null && (Object)(object)worldHandler.SceneObjectsRegister.RetrieveDreamEncounter() != (Object)null)
		{
			EncounterCheckpoint[] checkpoints = ((Encounter)worldHandler.SceneObjectsRegister.RetrieveDreamEncounter()).checkpoints;
			if (checkpoints.Count() > 0)
			{
				int num = Attributes.dreamSpawnIndex + i;
				int num2 = checkpoints.Count() - 1;
				Attributes.dreamSpawnIndex = ((num < 0) ? num2 : ((num <= num2) ? num : 0));
				worldHandler.PlaceCurrentPlayerAt(checkpoints[Attributes.dreamSpawnIndex].spawnLocation.position, checkpoints[Attributes.dreamSpawnIndex].spawnLocation.rotation, true);
			}
		}
		return DreamSpawnToName(Attributes.dreamSpawnIndex);
	}

	public string DreamSpawnToName(int i)
	{
		return $"{i}";
	}

	public void FuncUnlock()
	{
		Player player = ToolsGame.Game.GetPlayer();
		SaveManager saveManager = ToolsGame.Game.GetSaveManager();
		if ((Object)(object)player != (Object)null && saveManager != null && saveManager.CurrentSaveSlot != null)
		{
			player.LockCameraApp(false);
			player.LockBoostAbility(false);
			player.LockBoostpack(false);
			player.LockCharacterSelect(false);
			for (int i = 0; i < 6; i++)
			{
				saveManager.CurrentSaveSlot.dancesUnlocked[i] = true;
			}
			player.LockFortuneApp(false);
			player.LockPhone(false);
			player.LockSpraycan(false);
			player.LockSwitchToEquippedMoveStyle(false);
			saveManager.CurrentSaveSlot.taxiLocked = false;
		}
		else
		{
			Error((!((Object)(object)player == (Object)null)) ? ErrorType.NO_SAVE : ErrorType.PLAYER_NOT_FOUND);
		}
	}

	public void FuncUnlockChars()
	{
		Player player = ToolsGame.Game.GetPlayer();
		SaveManager saveManager = ToolsGame.Game.GetSaveManager();
		if ((Object)(object)player != (Object)null && saveManager != null && saveManager.CurrentSaveSlot != null)
		{
			for (int i = 0; i < 26; i++)
			{
				saveManager.CurrentSaveSlot.UnlockCharacter((Characters)i);
			}
		}
		else
		{
			Error((!((Object)(object)player == (Object)null)) ? ErrorType.NO_SAVE : ErrorType.PLAYER_NOT_FOUND);
		}
	}

	public void FuncForcePolice()
	{
		Player player = ToolsGame.Game.GetPlayer();
		WantedManager instance = WantedManager.instance;
		SaveManager saveManager = ToolsGame.Game.GetSaveManager();
		if ((Object)(object)player != (Object)null && (Object)(object)instance != (Object)null && saveManager != null && saveManager.CurrentSaveSlot != null)
		{
			float maxWantedStars = saveManager.CurrentSaveSlot.maxWantedStars;
			saveManager.CurrentSaveSlot.maxWantedStars = 6f;
			ToolsGame.Instance.InvokeMethod(instance, "ProcessCrime", new object[1] { (object)(Crime)3 });
			ToolsGame.Instance.InvokeMethod(instance, "MakePlayerWanted", new object[1] { (object)(Crime)3 });
			saveManager.CurrentSaveSlot.maxWantedStars = maxWantedStars;
			saveManager.SaveCurrentSaveSlotImmediate();
		}
		else if ((Object)(object)player == (Object)null)
		{
			Error(ErrorType.PLAYER_NOT_FOUND);
		}
		else if ((Object)(object)instance == (Object)null)
		{
			Error(ErrorType.BAD_CONDS, "No Wanted Manager");
		}
		else
		{
			Error(ErrorType.NO_SAVE);
		}
	}
}
internal class ToolsGame : MonoBehaviour
{
	public class CompatibilityFunctions
	{
		public static object GetFieldValue(object classObject, string field)
		{
			return classObject.GetType().GetField(field, Instance.bindingFlags).GetValue(classObject);
		}

		public static void SetFieldValue(object classObject, string field, object value)
		{
			classObject.GetType().GetField(field, Instance.bindingFlags).SetValue(classObject, value);
		}
	}

	public class Game : ToolsGame
	{
		private enum PType
		{
			pi,
			fi,
			mi
		}

		private static Core _Game_Core;

		private static BaseModule _Game_BaseModule;

		private static Dictionary<string, PropertyInfo> _piBaseMod = new Dictionary<string, PropertyInfo>();

		private static Dictionary<string, FieldInfo> _fiBaseMod = new Dictionary<string, FieldInfo>();

		private static Dictionary<string, MethodInfo> _miBaseMod = new Dictionary<string, MethodInfo>();

		private static SaveManager _Game_SaveManager;

		private static Dictionary<string, PropertyInfo> _piSaveManager = new Dictionary<string, PropertyInfo>();

		private static Dictionary<string, FieldInfo> _fiSaveManager = new Dictionary<string, FieldInfo>();

		private static Dictionary<string, MethodInfo> _miSaveManager = new Dictionary<string, MethodInfo>();

		private static Dictionary<string, PropertyInfo> _piSaveSlotHandler = new Dictionary<string, PropertyInfo>();

		private static Dictionary<string, FieldInfo> _fiSaveSlotHandler = new Dictionary<string, FieldInfo>();

		private static Dictionary<string, MethodInfo> _miSaveSlotHandler = new Dictionary<string, MethodInfo>();

		private static GameInput _Game_GameInput;

		private static AudioManager _Game_AudioManager;

		private static GameVersion _Game_GameVersion;

		private static UIManager _Game_UIManager;

		private static WorldHandler _Game_WorldHandler;

		private static Dictionary<string, PropertyInfo> _piWorldHandler = new Dictionary<string, PropertyInfo>();

		private static Dictionary<string, FieldInfo> _fiWorldHandler = new Dictionary<string, FieldInfo>();

		private static Dictionary<string, MethodInfo> _miWorldHandler = new Dictionary<string, MethodInfo>();

		private static Player _Game_Player;

		private static Dictionary<string, PropertyInfo> _piPlayer = new Dictionary<string, PropertyInfo>();

		private static Dictionary<string, FieldInfo> _fiPlayer = new Dictionary<string, FieldInfo>();

		private static Dictionary<string, MethodInfo> _miPlayer = new Dictionary<string, MethodInfo>();

		private static Dictionary<string, PropertyInfo> _piWallrun = new Dictionary<string, PropertyInfo>();

		private static Dictionary<string, FieldInfo> _fiWallrun = new Dictionary<string, FieldInfo>();

		private static Dictionary<string, MethodInfo> _miWallrun = new Dictionary<string, MethodInfo>();

		public static Dictionary<string, PropertyInfo> piBaseMod
		{
			get
			{
				if (_piBaseMod.Count == 0)
				{
					CreateInfo<BaseModule>(PType.pi, _piBaseMod);
				}
				return _piBaseMod;
			}
		}

		public static Dictionary<string, FieldInfo> fiBaseMod
		{
			get
			{
				if (_fiBaseMod.Count == 0)
				{
					CreateInfo<BaseModule>(PType.fi, null, _fiBaseMod);
				}
				return _fiBaseMod;
			}
		}

		public static Dictionary<string, MethodInfo> miBaseMod
		{
			get
			{
				if (_miBaseMod.Count == 0)
				{
					CreateInfo<BaseModule>(PType.mi, null, null, _miBaseMod);
				}
				return _miBaseMod;
			}
		}

		public static Dictionary<string, PropertyInfo> piSaveManager
		{
			get
			{
				if (_piSaveManager.Count == 0)
				{
					CreateInfo<SaveManager>(PType.pi, _piSaveManager);
				}
				return _piSaveManager;
			}
		}

		public static Dictionary<string, FieldInfo> fiSaveManager
		{
			get
			{
				if (_fiSaveManager.Count == 0)
				{
					CreateInfo<SaveManager>(PType.fi, null, _fiSaveManager);
				}
				return _fiSaveManager;
			}
		}

		public static Dictionary<string, MethodInfo> miSaveManager
		{
			get
			{
				if (_miSaveManager.Count == 0)
				{
					CreateInfo<SaveManager>(PType.mi, null, null, _miSaveManager);
				}
				return _miSaveManager;
			}
		}

		public static Dictionary<string, PropertyInfo> piSaveSlotHandler
		{
			get
			{
				if (_piSaveSlotHandler.Count == 0)
				{
					CreateInfo<SaveSlotHandler>(PType.pi, _piSaveSlotHandler);
				}
				return _piSaveSlotHandler;
			}
		}

		public static Dictionary<string, FieldInfo> fiSaveSlotHandler
		{
			get
			{
				if (_fiSaveSlotHandler.Count == 0)
				{
					CreateInfo<SaveSlotHandler>(PType.fi, null, _fiSaveSlotHandler);
				}
				return _fiSaveSlotHandler;
			}
		}

		public static Dictionary<string, MethodInfo> miSaveSlotHandler
		{
			get
			{
				if (_miSaveSlotHandler.Count == 0)
				{
					CreateInfo<SaveSlotHandler>(PType.mi, null, null, _miSaveSlotHandler);
				}
				return _miSaveSlotHandler;
			}
		}

		public static Dictionary<string, PropertyInfo> piWorldHandler
		{
			get
			{
				if (_piWorldHandler.Count == 0)
				{
					CreateInfo<WorldHandler>(PType.pi, _piWorldHandler);
				}
				return _piWorldHandler;
			}
		}

		public static Dictionary<string, FieldInfo> fiWorldHandler
		{
			get
			{
				if (_fiWorldHandler.Count == 0)
				{
					CreateInfo<WorldHandler>(PType.fi, null, _fiWorldHandler);
				}
				return _fiWorldHandler;
			}
		}

		public static Dictionary<string, MethodInfo> miWorldHandler
		{
			get
			{
				if (_miWorldHandler.Count == 0)
				{
					CreateInfo<WorldHandler>(PType.mi, null, null, _miWorldHandler);
				}
				return _miWorldHandler;
			}
		}

		public static Dictionary<string, PropertyInfo> piPlayer
		{
			get
			{
				if (_piPlayer.Count == 0)
				{
					CreateInfo<Player>(PType.pi, _piPlayer);
				}
				return _piPlayer;
			}
		}

		public static Dictionary<string, FieldInfo> fiPlayer
		{
			get
			{
				if (_fiPlayer.Count == 0)
				{
					CreateInfo<Player>(PType.fi, null, _fiPlayer);
				}
				return _fiPlayer;
			}
		}

		public static Dictionary<string, MethodInfo> miPlayer
		{
			get
			{
				if (_miPlayer.Count == 0)
				{
					CreateInfo<Player>(PType.mi, null, null, _miPlayer);
				}
				return _miPlayer;
			}
		}

		public static Dictionary<string, PropertyInfo> piWallrun
		{
			get
			{
				if (_piWallrun.Count == 0)
				{
					CreateInfo<WallrunLineAbility>(PType.pi, _piWallrun);
				}
				return _piWallrun;
			}
		}

		public static Dictionary<string, FieldInfo> fiWallrun
		{
			get
			{
				if (_fiWallrun.Count == 0)
				{
					CreateInfo<WallrunLineAbility>(PType.fi, null, _fiWallrun);
				}
				return _fiWallrun;
			}
		}

		public static Dictionary<string, MethodInfo> miWallrun
		{
			get
			{
				if (_miWallrun.Count == 0)
				{
					CreateInfo<WallrunLineAbility>(PType.mi, null, null, _miWallrun);
				}
				return _miWallrun;
			}
		}

		private static void CreateInfo<T>(PType pType, Dictionary<string, PropertyInfo> pi = null, Dictionary<string, FieldInfo> fi = null, Dictionary<string, MethodInfo> mi = null)
		{
			Type infoType = typeof(T);
			switch (pType)
			{
			case PType.pi:
				if (pi != null && pi.Count == 0)
				{
					PropertyInfo[] properties = infoType.GetProperties(Instance.bindingFlags);
					foreach (PropertyInfo propertyInfo in properties)
					{
						pi.Add(propertyInfo.Name, propertyInfo);
					}
				}
				break;
			case PType.fi:
				if (fi != null && fi.Count == 0)
				{
					FieldInfo[] fields = infoType.GetFields(Instance.bindingFlags);
					foreach (FieldInfo fieldInfo in fields)
					{
						fi.Add(fieldInfo.Name, fieldInfo);
					}
				}
				break;
			case PType.mi:
			{
				if (mi == null || mi.Count != 0)
				{
					break;
				}
				int num = 1;
				MethodInfo[] array = (from wmi in infoType.GetMethods(Instance.bindingFlags)
					where wmi.DeclaringType == infoType
					select wmi).ToArray();
				foreach (MethodInfo item in array)
				{
					string text = item.Name;
					if (mi.Keys.Any((string x) => item.Name == x))
					{
						text += $"{num++}";
					}
					mi.Add(tex