Decompiled source of CustomHoward v1.1.0

Mods/CustomHoward.dll

Decompiled 4 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using CustomHoward;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppRUMBLE.Environment.Howard;
using Il2CppRUMBLE.Interactions.InteractionBase;
using Il2CppRUMBLE.MoveSystem;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppTMPro;
using MelonLoader;
using MelonLoader.Utils;
using RumbleModUI;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(CustomHowardClass), "CustomHoward", "1.1.0", "Baumritter", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: VerifyLoaderVersion(0, 6, 4, true)]
[assembly: MelonColor(200, 0, 200, 0)]
[assembly: MelonAuthorColor(200, 0, 200, 0)]
[assembly: AssemblyTitle("CustomHoward")]
[assembly: AssemblyDescription("Makes Howard do scary things")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CustomHoward")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("119ab8f3-317c-4577-b08c-ba93dd1bbd2c")]
[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 CustomHoward;

internal class General
{
	internal class Delay
	{
		private readonly bool debug = false;

		private DateTime debugTime;

		private object CRObj;

		public string name;

		private bool Running = false;

		public bool Done = false;

		private DateTime StartTime;

		private double Wait;

		public void Delay_Start(double WaitTime, bool AllowRetrigger = false)
		{
			if (!Running || AllowRetrigger)
			{
				if (Running)
				{
					MelonCoroutines.Stop(CRObj);
				}
				Done = false;
				Wait = WaitTime;
				StartTime = DateTime.Now;
				debugTime = DateTime.Now;
				CRObj = MelonCoroutines.Start(WaitLoop());
				if (debug)
				{
					MelonLogger.Msg(name + " - Started");
				}
			}
		}

		public void Delay_Stop(bool Done = false)
		{
			if (Done)
			{
				this.Done = true;
			}
			if (Running)
			{
				MelonCoroutines.Stop(CRObj);
			}
			Running = false;
			if (debug && Done)
			{
				MelonLogger.Msg(name + " - Done");
			}
			if (debug && !Done)
			{
				MelonLogger.Msg(name + " - Stopped");
			}
			TimeSpan timeSpan = DateTime.Now - debugTime;
			if (debug && Done)
			{
				MelonLogger.Msg(name + " - " + timeSpan.TotalMilliseconds);
			}
		}

		private IEnumerator WaitLoop()
		{
			WaitForFixedUpdate waitForFixedUpdate = new WaitForFixedUpdate();
			Running = true;
			while (true)
			{
				if (DateTime.Now >= StartTime.AddSeconds(Wait))
				{
					Delay_Stop(Done: true);
					yield return null;
				}
				yield return waitForFixedUpdate;
			}
		}
	}

	internal class Folders
	{
		private readonly bool debug = false;

		private string UserData = "UserData";

		private string ModFolder;

		private List<string> SubFolders = new List<string>();

		public void SetModFolderCustom(string ModName)
		{
			ModFolder = ModName;
			if (debug)
			{
				MelonLogger.Msg("Set ModFolder to " + ModFolder);
			}
		}

		public void SetModFolderNamespace()
		{
			ModFolder = GetType().Namespace;
			if (debug)
			{
				MelonLogger.Msg("Set ModFolder to " + ModFolder);
			}
		}

		public void AddSubFolder(string FolderName)
		{
			SubFolders.Add(FolderName);
			if (debug)
			{
				MelonLogger.Msg("Added Subfolder " + FolderName);
			}
		}

		public void RemoveSubFolder(string FolderName)
		{
			SubFolders.Remove(FolderName);
			if (debug)
			{
				MelonLogger.Msg("Removed Subfolder " + FolderName);
			}
		}

		public void CheckAllFoldersExist()
		{
			CreateFolderIfNotExisting(GetFolderString());
			if (SubFolders.Count <= 0)
			{
				return;
			}
			foreach (string subFolder in SubFolders)
			{
				CreateFolderIfNotExisting(GetFolderString(subFolder));
			}
		}

		public void RemoveOtherFolders()
		{
			if (debug)
			{
				MelonLogger.Msg("Folder Removal: Start");
			}
			string[] directories = Directory.GetDirectories(GetFolderString("", IgnoreList: true));
			string[] array = directories;
			foreach (string text in array)
			{
				if (debug)
				{
					MelonLogger.Msg(text);
				}
				string text2 = text.Split(new char[1] { '\\' })[^1];
				if (CheckIfFolderInList(text2))
				{
					Directory.Delete(GetFolderString(text2, IgnoreList: true), recursive: true);
					if (debug)
					{
						MelonLogger.Msg("Deleted: " + GetFolderString(text2, IgnoreList: true));
					}
				}
			}
			if (debug)
			{
				MelonLogger.Msg("Folder Removal: End");
			}
		}

		private string GetFolderString(string SubFolder = "", bool IgnoreList = false)
		{
			string text = UserData + "\\" + ModFolder;
			if (SubFolder != "" && (SubFolders.Contains(SubFolder) || IgnoreList))
			{
				text = ((!IgnoreList) ? (text + "\\" + SubFolders.FirstOrDefault((string x) => x.Contains(SubFolder))) : (text + "\\" + SubFolder));
				if (debug)
				{
					MelonLogger.Msg("Generated Path: " + text);
				}
			}
			else if (debug)
			{
				MelonLogger.Msg("Generated Path with no SubFolder: " + text);
			}
			return text;
		}

		private void CreateFolderIfNotExisting(string Path)
		{
			if (debug && !Directory.Exists(Path))
			{
				MelonLogger.Msg("Path doesn't exist: " + Path);
			}
			else if (debug && Directory.Exists(Path))
			{
				MelonLogger.Msg("Path does exist: " + Path);
			}
			if (!Directory.Exists(Path))
			{
				Directory.CreateDirectory(Path);
			}
		}

		private bool CheckIfFolderInList(string FolderName)
		{
			bool flag = false;
			string folderString = GetFolderString(FolderName, IgnoreList: true);
			if (!SubFolders.Contains(FolderName) && Directory.Exists(folderString))
			{
				flag = true;
			}
			if (debug && flag)
			{
				MelonLogger.Msg("Folder not in List " + folderString);
			}
			else if (debug && !flag)
			{
				MelonLogger.Msg("Folder in List " + folderString);
			}
			return flag;
		}
	}

	internal class Button
	{
		private GameObject ButtonTemplate;

		public List<GameObject> Buttons = new List<GameObject>();

		public void GetTemplateButton()
		{
			if ((Object)(object)ButtonTemplate == (Object)null)
			{
				GameObject val = GameObject.Find("------------TUTORIAL------------/Static tutorials/RUMBLE Starter Guide/Next Page Button/InteractionButton");
				ButtonTemplate = Object.Instantiate<GameObject>(val);
				((UnityEventBase)((Component)ButtonTemplate.transform.GetChild(0)).GetComponent<InteractionButton>().OnPressed).m_PersistentCalls.Clear();
				((Object)ButtonTemplate).name = "ButtonTemplate";
				ButtonTemplate.SetActive(false);
				Object.DontDestroyOnLoad((Object)(object)ButtonTemplate);
			}
		}

		public void AddButton(string name)
		{
			GameObject val = Object.Instantiate<GameObject>(ButtonTemplate);
			((Object)val).name = name;
			Buttons.Add(val);
		}

		public void RemoveButton(string name)
		{
			Enumerator<GameObject> enumerator = Buttons.GetEnumerator();
			while (enumerator.MoveNext())
			{
				GameObject current = enumerator.Current;
				if (((Object)current).name == name)
				{
					GameObject val = current;
					Buttons.Remove(val);
					break;
				}
			}
		}

		public UnityEvent OnPressed(string name = "", int index = -1)
		{
			if (name != "")
			{
				int num = SearchButtonList(name);
				if (num != -1)
				{
					return ((Component)Buttons[num].transform.GetChild(0)).GetComponent<InteractionButton>().OnPressed;
				}
				return ((Component)Buttons[0].transform.GetChild(0)).GetComponent<InteractionButton>().OnPressed;
			}
			if (index != -1)
			{
				return ((Component)Buttons[index].transform.GetChild(0)).GetComponent<InteractionButton>().OnPressed;
			}
			return ((Component)Buttons[0].transform.GetChild(0)).GetComponent<InteractionButton>().OnPressed;
		}

		private int SearchButtonList(string name)
		{
			for (int i = 0; i < Buttons.Count; i++)
			{
				if (((Object)Buttons[i]).name == name)
				{
					return i;
				}
			}
			return -1;
		}
	}

	internal class StringExtension
	{
		public static string SanitizeName(string Input)
		{
			bool flag = false;
			char[] array = Input.ToCharArray();
			string text = "";
			if (Input.Contains("<u>"))
			{
				Input.Replace("<u>", "");
			}
			if (Input.Contains(","))
			{
				Input.Replace(",", "");
			}
			for (int i = 0; i < Input.Length; i++)
			{
				if (array[i] == '<' && i != Input.Length && (array[i + 1] == '#' || array[i + 1] == 'c'))
				{
					flag = true;
				}
				if (!flag)
				{
					text += array[i];
				}
				if (array[i] == '>')
				{
					flag = false;
				}
			}
			return text;
		}
	}
}
public static class BuildInfo
{
	public const string ModName = "CustomHoward";

	public const string ModVersion = "1.1.0";

	public const string Description = "Makes Howard do scary things";

	public const string Author = "Baumritter";

	public const string Company = "";
}
public class LogicData : MonoBehaviour
{
	public string LogicName { get; set; }

	public float MaxHP { get; set; }

	public float DecisionMin { get; set; }

	public float DecisionMax { get; set; }

	public float ReactionTime { get; set; }

	public Color HeadLight { get; set; }

	public Color IdleColor { get; set; }

	public Color ActiveColor { get; set; }

	public float Chance_DoSeq { get; set; }

	public float Chance_Dodge { get; set; }

	public float Chance_Nothing { get; set; }
}
public class SeqGenData : MonoBehaviour
{
	public string SeqName { get; set; }

	public string AtkName { get; set; }

	public float Weight { get; set; }

	public float WeightDec { get; set; }

	public float PreWait { get; set; }

	public float PostWait { get; set; }

	public float RangeMin { get; set; }

	public float RangeMax { get; set; }
}
public class PoseGenData : MonoBehaviour
{
	public int StackNumber { get; set; }

	public float PreWait { get; set; }

	public float PostWait { get; set; }

	public string AnimationName { get; set; }
}
public class CustomHowardClass : MelonMod
{
	private const double SceneDelay = 8.0;

	private const string MoveFolder = "CustomMoveSet";

	private const int Stack_Parry = 3;

	private const int Stack_Cube = 5;

	private const int Stack_Uppercut = 7;

	private const int Stack_Wall = 8;

	private const int Stack_Kick = 10;

	private const int Stack_Ball = 11;

	private const int Stack_Stomp = 12;

	private const int Stack_Pillar = 13;

	private const int Stack_Straight = 14;

	private const string Anim_Straight = "Straight";

	private const string Anim_Kick = "Kick";

	private const string Anim_Spawn = "SpawnStructure";

	private readonly bool debug = false;

	private readonly bool debug2 = false;

	private readonly bool debug3 = false;

	private bool LogicLoaded = false;

	private int currentlogicindex = 0;

	private string currentscene;

	private string MoveSetPath;

	private string CurrentLogicName;

	private DateTime ButtonDelay = DateTime.Now;

	private int LogicMaxPage;

	private int LogicCurPage = 0;

	private int LogicLoopMax;

	private bool LogicLoopRun = false;

	private GameObject Howard_Obj;

	private HowardLogic[] Base_Logic_Array = (HowardLogic[])(object)new HowardLogic[3];

	private List<Stack> StackList;

	private GameObject LogicText_Obj;

	private GameObject Lamp_Obj;

	private List<string> LogicNames = new List<string>();

	private General.Folders Folders = new General.Folders();

	private Mod Mod = new Mod();

	private UI UI = UI.instance;

	private ModSetting<bool> Reload;

	private General.Delay Delay = new General.Delay();

	private General.Delay Haptics = new General.Delay();

	private General.Delay PageScroll = new General.Delay();

	public override void OnLateInitializeMelon()
	{
		((MelonBase)this).OnLateInitializeMelon();
		Folders.SetModFolderCustom("CustomHoward");
		Folders.AddSubFolder("CustomMoveSet");
		Folders.CheckAllFoldersExist();
		UI.UI_Initialized += OnUIInit;
		MoveSetPath = MelonEnvironment.UserDataDirectory + "\\CustomHoward\\CustomMoveSet\\";
	}

	public override void OnUpdate()
	{
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0264: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0294: Unknown result type (might be due to invalid IL or missing references)
		((MelonBase)this).OnUpdate();
		if (!(currentscene == "Gym") || !Delay.Done)
		{
			return;
		}
		if ((Object)(object)Howard_Obj == (Object)null)
		{
			Howard_Obj = GameObject.Find("--------------LOGIC--------------/Heinhouser products/Howard root");
			if (debug)
			{
				MelonLogger.Msg("Got Howard Object");
			}
			Howard_Obj.GetComponent<Howard>().howardAnimator.changeLevelAnimationWaitTime = 0.5f;
			if (debug)
			{
				MelonLogger.Msg("Changed Animation Speed");
			}
			Base_Logic_Array = Il2CppArrayBase<HowardLogic>.op_Implicit((Il2CppArrayBase<HowardLogic>)(object)Howard_Obj.GetComponent<Howard>().LogicLevels);
			if (debug)
			{
				MelonLogger.Msg("Got Base Logic Objects");
			}
			StackList = GameObject.Find("Player Controller(Clone)").GetComponent<PlayerStackProcessor>().availableStacks;
			if (debug)
			{
				MelonLogger.Msg("Available Stacks:");
			}
			Enumerator<Stack> enumerator = StackList.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Stack current = enumerator.Current;
				if (debug)
				{
					MelonLogger.Msg(((Object)current).name);
				}
			}
			GetFromFile();
			if (debug)
			{
				MelonLogger.Msg("GotFromFile");
			}
			ModifyHowardConsole();
			LogicText_Obj = GameObject.Find("--------------LOGIC--------------/Heinhouser products/Howard root/Howards console/Base Plate Custom/Upper Canvas/LogicText");
			Lamp_Obj = GameObject.Find("--------------LOGIC--------------/Heinhouser products/Howard root/Howards console/Base Plate Custom/Status Lamp");
		}
		else
		{
			if ((bool)((ModSetting)Reload).Value && ButtonDelay <= DateTime.Now)
			{
				ButtonHandler(2);
				((ModSetting)Reload).Value = false;
				Haptics.Delay_Start(0.5);
			}
			if (Haptics.Done)
			{
				UI.ForceRefresh();
				Haptics.Done = false;
			}
			if (LogicLoaded && UI.IsUIVisible() && UI.IsModSelected("CustomHoward") && UI.IsOptionSelected("Description") && PageScroll.Done)
			{
				PageScrollLogic();
			}
			if (ButtonDelay <= DateTime.Now)
			{
				((Renderer)((Component)Lamp_Obj.transform).GetComponent<MeshRenderer>()).material.SetColor("_EmissionColor", Color.green);
			}
			else
			{
				((Renderer)((Component)Lamp_Obj.transform).GetComponent<MeshRenderer>()).material.SetColor("_EmissionColor", Color.red);
			}
		}
	}

	private void OnUIInit()
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Expected O, but got Unknown
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Expected O, but got Unknown
		Mod.ModName = "CustomHoward";
		Mod.ModVersion = "1.1.0";
		Mod.SetFolder("CustomHoward");
		Mod.AddDescription("Description", "", "Makes Howard do scary things", new Tags());
		Reload = Mod.AddToList("Reload all Movesets", false, 0, "Reloads all Moveset Files", new Tags());
		Mod.GetFromFile();
		UI.AddMod(Mod);
		MelonLogger.Msg("Added Mod.");
	}

	private SequenceSet CreatePoseSequence(List<PoseGenData> PGD, SeqGenData SGD)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Expected O, but got Unknown
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Expected O, but got Unknown
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: 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_0076: Expected O, but got Unknown
		//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Expected O, but got Unknown
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		SequenceSet val = new SequenceSet();
		HowardSequence val2 = new HowardSequence();
		HowardBehaviourTiming[] array = (HowardBehaviourTiming[])(object)new HowardBehaviourTiming[1];
		HowardAttackBehaviour val3 = new HowardAttackBehaviour();
		TimedStack[] array2 = (TimedStack[])(object)new TimedStack[PGD.Count];
		for (int i = 0; i < array2.Length; i++)
		{
			array2[i] = new TimedStack
			{
				PreWaitTime = PGD[i].PreWait,
				PostWaitTime = PGD[i].PostWait,
				AnimationTriggerName = PGD[i].AnimationName
			};
			Enumerator<Stack> enumerator = StackList.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Stack current = enumerator.Current;
				if (((Object)current).name == MatchStack(PGD[i].StackNumber))
				{
					array2[i].Stack = current;
					break;
				}
			}
			if (debug3)
			{
				MelonLogger.Msg(((Object)array2[i].Stack).name);
			}
			if (PGD[i].StackNumber == 14 || PGD[i].StackNumber == 10 || PGD[i].StackNumber == 7 || PGD[i].StackNumber == 3 || PGD[i].StackNumber == 12)
			{
				array2[i].IsPersistentStack = true;
			}
			else
			{
				array2[i].IsPersistentStack = false;
			}
		}
		((Object)val3).name = SGD.AtkName;
		val3.timedStacks = Il2CppReferenceArray<TimedStack>.op_Implicit(array2);
		val3.usePrediction = true;
		array[0] = new HowardBehaviourTiming
		{
			Behaviour = (HowardBehaviour)(object)val3,
			PreActivationWaitTime = SGD.PreWait,
			PostActivationWaitTime = SGD.PostWait
		};
		((Object)val2).name = SGD.SeqName;
		val2.BehaviourTimings = Il2CppReferenceArray<HowardBehaviourTiming>.op_Implicit(array);
		val.Sequence = val2;
		val.Weight = SGD.Weight;
		val.WeightDecrementationWhenSelected = SGD.WeightDec;
		val.RequiredMinMaxRange = new Vector2(SGD.RangeMin, SGD.RangeMax);
		return val;
	}

	private string MatchStack(int StackNumber)
	{
		return StackNumber switch
		{
			3 => "Parry", 
			5 => "SpawnCube", 
			7 => "Uppercut", 
			8 => "SpawnWall", 
			10 => "Kick", 
			11 => "SpawnBall", 
			12 => "Stomp", 
			13 => "SpawnPillar", 
			14 => "Straight", 
			15 => "Disc", 
			_ => "Disc", 
		};
	}

	public void ModifyHowardConsole()
	{
		//IL_027d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0332: Unknown result type (might be due to invalid IL or missing references)
		//IL_0341: Unknown result type (might be due to invalid IL or missing references)
		//IL_0350: Unknown result type (might be due to invalid IL or missing references)
		//IL_0391: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0418: Unknown result type (might be due to invalid IL or missing references)
		//IL_0519: 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_0537: Unknown result type (might be due to invalid IL or missing references)
		//IL_0570: Unknown result type (might be due to invalid IL or missing references)
		//IL_057f: Unknown result type (might be due to invalid IL or missing references)
		//IL_058e: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_05fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0635: Unknown result type (might be due to invalid IL or missing references)
		//IL_0683: Unknown result type (might be due to invalid IL or missing references)
		//IL_0694: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_06df: Unknown result type (might be due to invalid IL or missing references)
		//IL_0768: Unknown result type (might be due to invalid IL or missing references)
		//IL_076a: Unknown result type (might be due to invalid IL or missing references)
		//IL_076f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0774: Unknown result type (might be due to invalid IL or missing references)
		//IL_078d: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_07eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0806: Unknown result type (might be due to invalid IL or missing references)
		//IL_0814: Unknown result type (might be due to invalid IL or missing references)
		int num = 3;
		float num2 = 0.3f;
		List<GameObject> list = new List<GameObject>();
		Vector3 localPosition = default(Vector3);
		((Vector3)(ref localPosition))..ctor(-7.57f, 0.1f, -3.51f);
		Vector3 localPosition2 = default(Vector3);
		((Vector3)(ref localPosition2))..ctor(11.39f, 1.275f, 0.07f);
		Vector3 localEulerAngles = default(Vector3);
		((Vector3)(ref localEulerAngles))..ctor(330f, 91f, 0f);
		Vector3 localScale = default(Vector3);
		((Vector3)(ref localScale))..ctor(0.6f, 0.6f, 0.6f);
		Vector3 localPosition3 = default(Vector3);
		((Vector3)(ref localPosition3))..ctor(-0.12f, 0.12f, 0.34f);
		Vector3 localPosition4 = default(Vector3);
		((Vector3)(ref localPosition4))..ctor(0f, 0.04f, 0f);
		Vector3 localEulerAngles2 = default(Vector3);
		((Vector3)(ref localEulerAngles2))..ctor(90f, 0f, 0f);
		Vector3 localPosition5 = default(Vector3);
		((Vector3)(ref localPosition5))..ctor(-0.6f, 0.07f, -0.55f);
		Vector3 localEulerAngles3 = default(Vector3);
		((Vector3)(ref localEulerAngles3))..ctor(0f, 0f, 270f);
		Vector3 localScale2 = default(Vector3);
		((Vector3)(ref localScale2))..ctor(1f, 0.7f, 0.5f);
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor(-0.4f, 0.105f, -0.53f);
		Vector3 val2 = default(Vector3);
		((Vector3)(ref val2))..ctor(num2, 0f, 0f);
		Vector3 localEulerAngles4 = default(Vector3);
		((Vector3)(ref localEulerAngles4))..ctor(0f, 180f, 0f);
		Vector3 localScale3 = default(Vector3);
		((Vector3)(ref localScale3))..ctor(1.25f, 1.25f, 1.25f);
		Vector3 val3 = default(Vector3);
		((Vector3)(ref val3))..ctor(-0.4f, -0.73f, -0.07f);
		Vector3 localEulerAngles5 = default(Vector3);
		((Vector3)(ref localEulerAngles5))..ctor(0f, 0f, 0f);
		Vector3 localPosition6 = default(Vector3);
		((Vector3)(ref localPosition6))..ctor(0.5166f, 0.03f, 0.503f);
		Vector3 localEulerAngles6 = default(Vector3);
		((Vector3)(ref localEulerAngles6))..ctor(90f, 0f, 0f);
		Vector3 localScale4 = default(Vector3);
		((Vector3)(ref localScale4))..ctor(1f, 1f, 1f);
		GameObject gameObject = GameObject.Find("--------------LOGIC--------------/Heinhouser products/Howard root/Howards console").gameObject;
		GameObject val4 = Object.Instantiate<GameObject>(GameObject.Find("--------------LOGIC--------------/Heinhouser products/MoveLearning/MoveLearnSelector/Model/Move selector"));
		GameObject val5 = GameObject.Find("--------------LOGIC--------------/Slabbuddy menu variant/MenuForm/Base/ControlsSlab/GameSlabCanvas");
		GameObject val6 = GameObject.Find("--------------LOGIC--------------/Heinhouser products/Leaderboard/Text Objects/Titleplate/LeaderboardTitlePlate");
		GameObject val7 = GameObject.Find("------------TUTORIAL------------/Static tutorials/RUMBLE Starter Guide/Next Page Button/InteractionButton");
		GameObject val8 = Object.Instantiate<GameObject>(val7);
		((UnityEventBase)((Component)val8.transform.GetChild(0)).GetComponent<InteractionButton>().OnPressed).m_PersistentCalls.Clear();
		if (debug)
		{
			MelonLogger.Msg("Got Objects");
		}
		((Component)gameObject.transform.GetChild(0).GetChild(1)).gameObject.SetActive(false);
		((Component)gameObject.transform.GetChild(1).GetChild(4)).gameObject.SetActive(false);
		gameObject.transform.localPosition = localPosition;
		if (debug)
		{
			MelonLogger.Msg("Did Stuff");
		}
		((Object)val4).name = "Base Plate Custom";
		val4.transform.SetParent(gameObject.transform);
		val4.transform.localPosition = localPosition2;
		val4.transform.localEulerAngles = localEulerAngles;
		val4.transform.localScale = localScale;
		if (debug)
		{
			MelonLogger.Msg("Did Stuff");
		}
		GameObject val9 = Object.Instantiate<GameObject>(val6);
		((Object)val9).name = "Lower Plate";
		val9.transform.SetParent(val4.transform);
		val9.transform.localPosition = localPosition5;
		val9.transform.localEulerAngles = localEulerAngles3;
		val9.transform.localScale = localScale2;
		GameObject val10 = Object.Instantiate<GameObject>(GameObject.Find("--------------LOGIC--------------/Heinhouser products/Telephone 2.0 REDUX special edition/Notification Screen/NotificationLight"));
		((Object)val10).name = "Status Lamp";
		val10.transform.SetParent(val4.transform);
		val10.transform.localPosition = localPosition6;
		val10.transform.localEulerAngles = localEulerAngles6;
		((Renderer)((Component)val10.transform).GetComponent<MeshRenderer>()).material = ((Renderer)GameObject.Find("--------------LOGIC--------------/Heinhouser products/Howard root/DummyRoot/Howard/Dummy").GetComponent<SkinnedMeshRenderer>()).material;
		((Renderer)((Component)val10.transform).GetComponent<MeshRenderer>()).material.EnableKeyword("_EMISSION");
		((Renderer)((Component)val10.transform).GetComponent<MeshRenderer>()).material.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)2;
		((Renderer)((Component)val10.transform).GetComponent<MeshRenderer>()).material.SetColor("_EmissionColor", Color.green);
		GameObject val11 = Object.Instantiate<GameObject>(val5);
		((Object)val11).name = "SlabCanvas";
		val11.transform.SetParent(val4.transform);
		if (debug)
		{
			MelonLogger.Msg("Did Stuff");
		}
		((Object)val11.transform.GetChild(0).GetChild(0).GetChild(1)).name = "Text";
		((Component)val11.transform.GetChild(0)).gameObject.SetActive(false);
		val11.SetActive(false);
		GameObject gameObject2 = ((Component)val11.transform.GetChild(0).GetChild(0).GetChild(1)).gameObject;
		if (debug)
		{
			MelonLogger.Msg("Did Stuff");
		}
		GameObject val12 = Object.Instantiate<GameObject>(val11);
		GameObject val13 = Object.Instantiate<GameObject>(val11);
		val12.SetActive(true);
		((Object)val12).name = "Upper Canvas";
		val12.transform.SetParent(val4.transform);
		val12.transform.localPosition = localPosition3;
		val12.transform.localEulerAngles = localEulerAngles2;
		val12.transform.localScale = localScale4;
		val13.SetActive(true);
		((Object)val13).name = "Lower Canvas";
		val13.transform.SetParent(val4.transform);
		val13.transform.localPosition = localPosition4;
		val13.transform.localEulerAngles = localEulerAngles2;
		val13.transform.localScale = localScale4;
		if (debug)
		{
			MelonLogger.Msg("Did Stuff");
		}
		GameObject val14 = Object.Instantiate<GameObject>(gameObject2);
		((Object)val14).name = "LogicText";
		val14.transform.SetParent(val12.transform);
		val14.transform.localPosition = Vector3.zero;
		val14.transform.localEulerAngles = Vector3.zero;
		val14.transform.localScale = localScale4;
		((TMP_Text)val14.GetComponent<TextMeshProUGUI>()).text = "Level 1";
		((TMP_Text)val14.GetComponent<TextMeshProUGUI>()).fontSize = 0.18f;
		val14.GetComponent<RectTransform>().sizeDelta = new Vector2(2f, 0.24f);
		if (debug)
		{
			MelonLogger.Msg("Did Stuff");
		}
		val14 = Object.Instantiate<GameObject>(gameObject2);
		((Object)val14).name = "LogicText";
		val14.transform.SetParent(val13.transform);
		val14.transform.localPosition = Vector3.zero;
		val14.transform.localEulerAngles = Vector3.zero;
		val14.transform.localScale = localScale4;
		((TMP_Text)val14.GetComponent<TextMeshProUGUI>()).text = "";
		((TMP_Text)val14.GetComponent<TextMeshProUGUI>()).fontSize = 0.22f;
		val14.GetComponent<RectTransform>().sizeDelta = new Vector2(2f, 0.24f);
		if (debug)
		{
			MelonLogger.Msg("Did Stuff");
		}
		for (int i = 0; i < num; i++)
		{
			list.Add(Object.Instantiate<GameObject>(val8));
			((Object)list[i]).name = "SlabButton" + (i + 1);
			list[i].transform.SetParent(val4.transform);
			list[i].transform.localPosition = val + val2 * (float)i;
			list[i].transform.localEulerAngles = localEulerAngles4;
			list[i].transform.localScale = localScale3;
			val14 = Object.Instantiate<GameObject>(gameObject2);
			val14.transform.SetParent(val13.transform);
			((Object)val14).name = "ButtonText" + (i + 1);
			val14.transform.localPosition = val3 + val2 * (float)i;
			val14.transform.localEulerAngles = localEulerAngles5;
			val14.transform.localScale = localScale4;
			switch (i)
			{
			case 0:
				((TMP_Text)val14.GetComponent<TextMeshProUGUI>()).text = "Prev";
				((TMP_Text)val14.GetComponent<TextMeshProUGUI>()).fontSize = 0.1f;
				((Component)list[i].transform.GetChild(0)).GetComponent<InteractionButton>().OnPressed.AddListener(UnityAction.op_Implicit((Action)delegate
				{
					ButtonHandler(0);
				}));
				break;
			case 1:
				((TMP_Text)val14.GetComponent<TextMeshProUGUI>()).text = "Next";
				((TMP_Text)val14.GetComponent<TextMeshProUGUI>()).fontSize = 0.1f;
				((Component)list[i].transform.GetChild(0)).GetComponent<InteractionButton>().OnPressed.AddListener(UnityAction.op_Implicit((Action)delegate
				{
					ButtonHandler(1);
				}));
				break;
			case 2:
				((TMP_Text)val14.GetComponent<TextMeshProUGUI>()).text = "Reload";
				((TMP_Text)val14.GetComponent<TextMeshProUGUI>()).fontSize = 0.1f;
				((Component)list[i].transform.GetChild(0)).GetComponent<InteractionButton>().OnPressed.AddListener(UnityAction.op_Implicit((Action)delegate
				{
					ButtonHandler(2);
				}));
				break;
			}
			((TMP_Text)val14.GetComponent<TextMeshProUGUI>()).autoSizeTextContainer = true;
		}
		Object.Destroy((Object)(object)val11);
		Object.Destroy((Object)(object)((Component)val12.transform.GetChild(0)).gameObject);
		Object.Destroy((Object)(object)((Component)val13.transform.GetChild(0)).gameObject);
		Object.Destroy((Object)(object)GameObject.Find("InteractionButton(Clone)"));
		Object.Destroy((Object)(object)GameObject.Find("Title(Clone)"));
		if (debug)
		{
			MelonLogger.Msg("Did Stuff");
		}
	}

	public void ButtonHandler(int Number)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: 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_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		if (ButtonDelay <= DateTime.Now)
		{
			DateTime now;
			switch (Number)
			{
			case 0:
				DecreaseLogicIndex();
				now = DateTime.Now;
				ButtonDelay = ((DateTime)(ref now)).AddSeconds(1.0);
				break;
			case 1:
				IncreaseLogicIndex();
				now = DateTime.Now;
				ButtonDelay = ((DateTime)(ref now)).AddSeconds(1.0);
				break;
			case 2:
				TriggerReload();
				now = DateTime.Now;
				ButtonDelay = ((DateTime)(ref now)).AddSeconds(3.0);
				break;
			}
			if (debug2)
			{
				MelonLogger.Msg("Button pressed");
			}
		}
	}

	public void DecreaseLogicIndex()
	{
		if (currentlogicindex > 0)
		{
			currentlogicindex--;
			Howard_Obj.GetComponent<Howard>().SetCurrentLogicLevel(currentlogicindex);
			CurrentLogicName = LogicNameSanitization(((Object)((Il2CppArrayBase<HowardLogic>)(object)Howard_Obj.GetComponent<Howard>().LogicLevels)[currentlogicindex]).name);
			((TMP_Text)LogicText_Obj.GetComponent<TextMeshProUGUI>()).text = CurrentLogicName;
			if (debug2)
			{
				MelonLogger.Msg("Howard Logic to " + CurrentLogicName);
			}
		}
	}

	public void IncreaseLogicIndex()
	{
		if (currentlogicindex < ((Il2CppArrayBase<HowardLogic>)(object)Howard_Obj.GetComponent<Howard>().LogicLevels).Count - 1)
		{
			currentlogicindex++;
			Howard_Obj.GetComponent<Howard>().SetCurrentLogicLevel(currentlogicindex);
			CurrentLogicName = LogicNameSanitization(((Object)((Il2CppArrayBase<HowardLogic>)(object)Howard_Obj.GetComponent<Howard>().LogicLevels)[currentlogicindex]).name);
			((TMP_Text)LogicText_Obj.GetComponent<TextMeshProUGUI>()).text = CurrentLogicName;
			if (debug2)
			{
				MelonLogger.Msg("Howard Logic to " + CurrentLogicName);
			}
		}
	}

	public void TriggerReload()
	{
		Howard_Obj.GetComponent<Howard>().SetHowardLogicActive(false);
		Howard_Obj.GetComponent<Howard>().SetCurrentLogicLevel(0);
		currentlogicindex = 0;
		CurrentLogicName = LogicNameSanitization(((Object)((Il2CppArrayBase<HowardLogic>)(object)Howard_Obj.GetComponent<Howard>().LogicLevels)[currentlogicindex]).name);
		((TMP_Text)LogicText_Obj.GetComponent<TextMeshProUGUI>()).text = CurrentLogicName;
		GetFromFile();
		if (debug2)
		{
			MelonLogger.Msg("Refreshed Logic Files");
		}
	}

	public void GetFromFile()
	{
		//IL_0487: Unknown result type (might be due to invalid IL or missing references)
		//IL_0571: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_065b: Unknown result type (might be due to invalid IL or missing references)
		//IL_058f: 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_0679: Unknown result type (might be due to invalid IL or missing references)
		//IL_067e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1244: Unknown result type (might be due to invalid IL or missing references)
		//IL_1249: Unknown result type (might be due to invalid IL or missing references)
		//IL_1257: Unknown result type (might be due to invalid IL or missing references)
		//IL_1265: Unknown result type (might be due to invalid IL or missing references)
		//IL_1274: Unknown result type (might be due to invalid IL or missing references)
		//IL_127f: Unknown result type (might be due to invalid IL or missing references)
		//IL_128d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1290: Unknown result type (might be due to invalid IL or missing references)
		//IL_129b: Unknown result type (might be due to invalid IL or missing references)
		//IL_129e: Unknown result type (might be due to invalid IL or missing references)
		//IL_12a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_12ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_12bc: Expected O, but got Unknown
		//IL_12f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_12fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_1306: Unknown result type (might be due to invalid IL or missing references)
		//IL_130f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1318: Unknown result type (might be due to invalid IL or missing references)
		//IL_1321: Unknown result type (might be due to invalid IL or missing references)
		//IL_132d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1339: Unknown result type (might be due to invalid IL or missing references)
		//IL_1343: Expected O, but got Unknown
		//IL_1381: Unknown result type (might be due to invalid IL or missing references)
		//IL_13a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_13c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_13f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_13fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_1405: Unknown result type (might be due to invalid IL or missing references)
		//IL_1410: Unknown result type (might be due to invalid IL or missing references)
		//IL_1419: Unknown result type (might be due to invalid IL or missing references)
		//IL_1427: Expected O, but got Unknown
		//IL_144f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1456: Expected O, but got Unknown
		//IL_14b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_14b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_14c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_14d2: Expected O, but got Unknown
		//IL_14ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_14ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_14fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_1504: Unknown result type (might be due to invalid IL or missing references)
		//IL_150d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1516: Unknown result type (might be due to invalid IL or missing references)
		//IL_1522: Unknown result type (might be due to invalid IL or missing references)
		//IL_152e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1538: Expected O, but got Unknown
		bool flag = false;
		bool flag2 = false;
		float weight = 0f;
		float weightDecrementationWhenSelected = 0f;
		float anglePerSecond = 0f;
		float minAngle = 0f;
		float maxAngle = 0f;
		float anglePerSecond2 = 0f;
		float minAngle2 = 0f;
		float maxAngle2 = 0f;
		CultureInfo provider = new CultureInfo("en-US");
		LogicData logicData = new LogicData();
		SeqGenData seqGenData = new SeqGenData();
		string[] array = new string[2];
		string[] array2 = new string[4];
		List<HowardLogic> list = new List<HowardLogic>();
		List<PoseGenData> list2 = new List<PoseGenData>();
		List<SequenceSet> val = new List<SequenceSet>();
		LogicNames.Clear();
		string[] files = Directory.GetFiles(MoveSetPath);
		for (int i = 0; i < files.Length; i++)
		{
			string[] array3 = File.ReadAllLines(files[i]);
			if (debug)
			{
				MelonLogger.Msg("Filename: " + files[i]);
			}
			if (debug)
			{
				MelonLogger.Msg("FileLength: " + array3.Length);
			}
			for (int j = 0; j < array3.Length; j++)
			{
				if (array3[j].Contains("!"))
				{
					continue;
				}
				if (array3[j].Contains("LogicName: "))
				{
					array.Initialize();
					array = array3[j].Split(new char[1] { ':' });
					array[1] = array[1].Trim(new char[1] { ' ' });
					logicData.LogicName = array[1];
					LogicNames.Add(array[1]);
					if (debug)
					{
						MelonLogger.Msg("Name: " + logicData.LogicName);
					}
				}
				if (array3[j].Contains("MaxHP: "))
				{
					array.Initialize();
					array = array3[j].Split(new char[1] { ':' });
					array[1] = array[1].Trim(new char[1] { ' ' });
					logicData.MaxHP = float.Parse(array[1], provider);
					if (debug)
					{
						MelonLogger.Msg("MaxHP: " + logicData.MaxHP);
					}
				}
				if (array3[j].Contains("DecisionMin: "))
				{
					array.Initialize();
					array = array3[j].Split(new char[1] { ':' });
					array[1] = array[1].Trim(new char[1] { ' ' });
					logicData.DecisionMin = float.Parse(array[1], provider);
					if (debug)
					{
						MelonLogger.Msg("DecisionMin: " + logicData.DecisionMin);
					}
				}
				if (array3[j].Contains("DecisionMax: "))
				{
					array.Initialize();
					array = array3[j].Split(new char[1] { ':' });
					array[1] = array[1].Trim(new char[1] { ' ' });
					logicData.DecisionMax = float.Parse(array[1], provider);
					if (debug)
					{
						MelonLogger.Msg("DecisionMax: " + logicData.DecisionMax);
					}
				}
				if (array3[j].Contains("ReactionTime: "))
				{
					array.Initialize();
					array = array3[j].Split(new char[1] { ':' });
					array[1] = array[1].Trim(new char[1] { ' ' });
					logicData.ReactionTime = float.Parse(array[1], provider);
					if (debug)
					{
						MelonLogger.Msg("ReactionTime: " + logicData.ReactionTime);
					}
				}
				Color val2;
				if (array3[j].Contains("HeadLight: "))
				{
					array.Initialize();
					array2.Initialize();
					array = array3[j].Split(new char[1] { ':' });
					array[1] = array[1].Trim(new char[1] { ' ' });
					array2 = array[1].Split(new char[1] { ',' });
					logicData.HeadLight = new Color(float.Parse(array2[0]) / 255f, float.Parse(array2[1]) / 255f, float.Parse(array2[2]) / 255f, float.Parse(array2[3]) / 255f);
					if (debug)
					{
						val2 = logicData.HeadLight;
						MelonLogger.Msg("HeadLight: " + ((object)(Color)(ref val2)).ToString());
					}
				}
				if (array3[j].Contains("IdleColor: "))
				{
					array.Initialize();
					array2.Initialize();
					array = array3[j].Split(new char[1] { ':' });
					array[1] = array[1].Trim(new char[1] { ' ' });
					array2 = array[1].Split(new char[1] { ',' });
					logicData.IdleColor = new Color(float.Parse(array2[0]) / 255f, float.Parse(array2[1]) / 255f, float.Parse(array2[2]) / 255f, float.Parse(array2[3]) / 255f);
					if (debug)
					{
						val2 = logicData.IdleColor;
						MelonLogger.Msg("IdleColor: " + ((object)(Color)(ref val2)).ToString());
					}
				}
				if (array3[j].Contains("ActiveColor: "))
				{
					array.Initialize();
					array2.Initialize();
					array = array3[j].Split(new char[1] { ':' });
					array[1] = array[1].Trim(new char[1] { ' ' });
					array2 = array[1].Split(new char[1] { ',' });
					logicData.ActiveColor = new Color(float.Parse(array2[0]) / 255f, float.Parse(array2[1]) / 255f, float.Parse(array2[2]) / 255f, float.Parse(array2[3]) / 255f);
					if (debug)
					{
						val2 = logicData.ActiveColor;
						MelonLogger.Msg("ActiveColor: " + ((object)(Color)(ref val2)).ToString());
					}
				}
				if (array3[j].Contains("DoMove: "))
				{
					array.Initialize();
					array = array3[j].Split(new char[1] { ':' });
					array[1] = array[1].Trim(new char[1] { ' ' });
					logicData.Chance_DoSeq = float.Parse(array[1], provider);
					if (debug)
					{
						MelonLogger.Msg("DoMove: " + logicData.Chance_DoSeq);
					}
				}
				if (array3[j].Contains("Dodge: "))
				{
					array.Initialize();
					array = array3[j].Split(new char[1] { ':' });
					array[1] = array[1].Trim(new char[1] { ' ' });
					logicData.Chance_Dodge = float.Parse(array[1], provider);
					if (debug)
					{
						MelonLogger.Msg("Dodge: " + logicData.Chance_Dodge);
					}
				}
				if (array3[j].Contains("DoNothing: "))
				{
					array.Initialize();
					array = array3[j].Split(new char[1] { ':' });
					array[1] = array[1].Trim(new char[1] { ' ' });
					logicData.Chance_Nothing = float.Parse(array[1], provider);
					if (debug)
					{
						MelonLogger.Msg("DoNothing: " + logicData.Chance_Nothing);
					}
				}
				if (array3[j].Contains("Sequence - Init"))
				{
					val = new List<SequenceSet>();
				}
				if (array3[j].Contains("Sequence - BaseMovement"))
				{
					array = array3[j + 1].Split(new char[1] { ':' });
					flag2 = bool.Parse(array[1].Trim(new char[1] { ' ' }));
					if (debug)
					{
						MelonLogger.Msg("Movement Enable: " + flag2);
					}
					if (flag2)
					{
						array = array3[j + 2].Split(new char[1] { ':' });
						weight = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
						if (debug)
						{
							MelonLogger.Msg("Movement Weight: " + weight);
						}
						array = array3[j + 3].Split(new char[1] { ':' });
						weightDecrementationWhenSelected = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
						if (debug)
						{
							MelonLogger.Msg("Movement WeightDec: " + weightDecrementationWhenSelected);
						}
						array = array3[j + 4].Split(new char[1] { ':' });
						anglePerSecond = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
						if (debug)
						{
							MelonLogger.Msg("Movement Speed: " + anglePerSecond);
						}
						array = array3[j + 5].Split(new char[1] { ':' });
						minAngle = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
						if (debug)
						{
							MelonLogger.Msg("Movement Min Angle: " + minAngle);
						}
						array = array3[j + 6].Split(new char[1] { ':' });
						maxAngle = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
						if (debug)
						{
							MelonLogger.Msg("Movement Max Angle: " + maxAngle);
						}
					}
				}
				if (array3[j].Contains("Sequence - Dodge"))
				{
					array = array3[j + 1].Split(new char[1] { ':' });
					anglePerSecond2 = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
					if (debug)
					{
						MelonLogger.Msg("Dodge Speed: " + anglePerSecond2);
					}
					array = array3[j + 2].Split(new char[1] { ':' });
					minAngle2 = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
					if (debug)
					{
						MelonLogger.Msg("Dodge Min Angle: " + minAngle2);
					}
					array = array3[j + 3].Split(new char[1] { ':' });
					maxAngle2 = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
					if (debug)
					{
						MelonLogger.Msg("Dodge Max Angle: " + maxAngle2);
					}
				}
				if (array3[j].Contains("Sequence - Start") && !flag)
				{
					flag = true;
					list2 = new List<PoseGenData>();
					if (debug)
					{
						MelonLogger.Msg("Sequence - Start");
					}
				}
				if (flag)
				{
					if (array3[j].Contains("Sequence - Data"))
					{
						seqGenData = new SeqGenData();
						array.Initialize();
						array = array3[j + 1].Split(new char[1] { ':' });
						seqGenData.SeqName = array[1].Trim(new char[1] { ' ' }) + "Seq";
						if (debug)
						{
							MelonLogger.Msg("SeqName: " + seqGenData.SeqName);
						}
						seqGenData.AtkName = array[1].Trim(new char[1] { ' ' }) + "Atk";
						if (debug)
						{
							MelonLogger.Msg("AtkName: " + seqGenData.AtkName);
						}
						array = array3[j + 2].Split(new char[1] { ':' });
						seqGenData.Weight = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
						if (debug)
						{
							MelonLogger.Msg("Weight: " + array[1].Trim(new char[1] { ' ' }));
						}
						array = array3[j + 3].Split(new char[1] { ':' });
						seqGenData.WeightDec = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
						if (debug)
						{
							MelonLogger.Msg("Weight_Decrease: " + array[1].Trim(new char[1] { ' ' }));
						}
						array = array3[j + 4].Split(new char[1] { ':' });
						seqGenData.PreWait = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
						if (debug)
						{
							MelonLogger.Msg("PreWait: " + array[1].Trim(new char[1] { ' ' }));
						}
						array = array3[j + 5].Split(new char[1] { ':' });
						seqGenData.PostWait = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
						if (debug)
						{
							MelonLogger.Msg("PostWait: " + array[1].Trim(new char[1] { ' ' }));
						}
						array = array3[j + 6].Split(new char[1] { ':' });
						seqGenData.RangeMin = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
						if (debug)
						{
							MelonLogger.Msg("RangeMin: " + array[1].Trim(new char[1] { ' ' }));
						}
						array = array3[j + 7].Split(new char[1] { ':' });
						seqGenData.RangeMax = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
						if (debug)
						{
							MelonLogger.Msg("RangeMax: " + array[1].Trim(new char[1] { ' ' }));
						}
					}
					if (array3[j].Contains("Sequence - MoveData"))
					{
						PoseGenData poseGenData = new PoseGenData();
						array = array3[j + 1].Split(new char[1] { ':' });
						poseGenData.StackNumber = int.Parse(array[1].Trim(new char[1] { ' ' }));
						if (debug)
						{
							MelonLogger.Msg("MoveNumber: " + poseGenData.StackNumber);
						}
						array = array3[j + 2].Split(new char[1] { ':' });
						poseGenData.PreWait = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
						if (debug)
						{
							MelonLogger.Msg("PreWait: " + poseGenData.PreWait);
						}
						array = array3[j + 3].Split(new char[1] { ':' });
						poseGenData.PostWait = float.Parse(array[1].Trim(new char[1] { ' ' }), provider);
						if (debug)
						{
							MelonLogger.Msg("PostWait: " + poseGenData.PostWait);
						}
						switch (poseGenData.StackNumber)
						{
						case 10:
							poseGenData.AnimationName = "Kick";
							break;
						case 5:
						case 8:
						case 11:
						case 13:
							poseGenData.AnimationName = "SpawnStructure";
							break;
						default:
							poseGenData.AnimationName = "Straight";
							break;
						}
						if (debug)
						{
							MelonLogger.Msg("AnimName: " + poseGenData.AnimationName.ToString());
						}
						list2.Add(poseGenData);
					}
				}
				if (array3[j].Contains("Sequence - End") && flag)
				{
					flag = false;
					val.Add(CreatePoseSequence(list2, seqGenData));
					if (debug)
					{
						MelonLogger.Msg("Sequence - End");
					}
				}
				if (!array3[j].Contains("Logic - End"))
				{
					continue;
				}
				if (list.Count > 0)
				{
					foreach (HowardLogic item in list)
					{
						if (((Object)item).name == logicData.LogicName)
						{
							logicData.LogicName += "_";
						}
					}
				}
				if (debug)
				{
					MelonLogger.Msg("Got Duplicates");
				}
				list.Add(new HowardLogic
				{
					name = logicData.LogicName,
					maxHealth = logicData.MaxHP,
					MinMaxDecisionTime = new Vector2(logicData.DecisionMin, logicData.DecisionMax),
					standStillReactiontime = logicData.ReactionTime,
					howardHeadlightColor = logicData.HeadLight,
					howardIdleLevelColor = logicData.IdleColor,
					howardLevelColor = logicData.ActiveColor
				});
				if (debug)
				{
					MelonLogger.Msg("Logic Init");
				}
				int index = list.Count - 1;
				if (debug)
				{
					MelonLogger.Msg("Logic Count");
				}
				HowardMoveBehaviour dodgeBehaviour = new HowardMoveBehaviour
				{
					name = "CustomDodge",
					AnglePerSecond = anglePerSecond2,
					minAngle = minAngle2,
					maxAngle = maxAngle2,
					negativeMoveAnimationTrigger = "RockSlideLeft",
					positiveMoveAnimationTrigger = "RockSlideRight",
					randomizeMovementSign = true
				};
				list[index].DodgeBehaviour = dodgeBehaviour;
				if (debug)
				{
					MelonLogger.Msg("Logic Dodge");
				}
				((Il2CppArrayBase<ReactionChance>)(object)list[index].reactions)[0] = ModifyReactions(0, logicData.Chance_DoSeq);
				((Il2CppArrayBase<ReactionChance>)(object)list[index].reactions)[1] = ModifyReactions(1, logicData.Chance_Dodge);
				((Il2CppArrayBase<ReactionChance>)(object)list[index].reactions)[2] = ModifyReactions(2, logicData.Chance_Nothing);
				if (debug)
				{
					MelonLogger.Msg("Logic Reactions");
				}
				if (flag2)
				{
					val.Add(new SequenceSet
					{
						RequiredMinMaxRange = new Vector2(0f, float.MaxValue),
						Weight = weight,
						WeightDecrementationWhenSelected = weightDecrementationWhenSelected
					});
					if (debug)
					{
						MelonLogger.Msg("1");
					}
					SequenceSet obj = val[val.Count - 1];
					HowardSequence val3 = new HowardSequence();
					((Object)val3).name = "CustomMovement";
					val3.BehaviourTimings = Il2CppReferenceArray<HowardBehaviourTiming>.op_Implicit((HowardBehaviourTiming[])(object)new HowardBehaviourTiming[1]);
					obj.Sequence = val3;
					if (debug)
					{
						MelonLogger.Msg("2");
					}
					((Il2CppArrayBase<HowardBehaviourTiming>)(object)val[val.Count - 1].Sequence.BehaviourTimings)[0] = new HowardBehaviourTiming
					{
						PostActivationWaitTime = 0f,
						PreActivationWaitTime = 0.5f
					};
					if (debug)
					{
						MelonLogger.Msg("3");
					}
					HowardMoveBehaviour behaviour = new HowardMoveBehaviour
					{
						name = "CustomMovement",
						AnglePerSecond = anglePerSecond,
						minAngle = minAngle,
						maxAngle = maxAngle,
						negativeMoveAnimationTrigger = "RockSlideLeft",
						positiveMoveAnimationTrigger = "RockSlideRight",
						randomizeMovementSign = true
					};
					if (debug)
					{
						MelonLogger.Msg("4");
					}
					((Il2CppArrayBase<HowardBehaviourTiming>)(object)val[val.Count - 1].Sequence.BehaviourTimings)[0].Behaviour = (HowardBehaviour)(object)behaviour;
					if (debug)
					{
						MelonLogger.Msg("Logic Sequence Move");
					}
				}
				list[index].SequenceSets = val;
				if (debug)
				{
					MelonLogger.Msg("Logic Sequence Custom");
				}
				if (debug)
				{
					MelonLogger.Msg("Logic Applied");
				}
			}
		}
		int count = list.Count;
		int num = Base_Logic_Array.Length;
		if (debug)
		{
			MelonLogger.Msg("Get Length: " + count + "|" + num);
		}
		HowardLogic[] array4 = (HowardLogic[])(object)new HowardLogic[num + count];
		if (debug)
		{
			MelonLogger.Msg("Size Array");
		}
		for (int k = 0; k < array4.Length; k++)
		{
			if (k < num)
			{
				array4[k] = Base_Logic_Array[k];
			}
			if (k >= num)
			{
				array4[k] = list[k - num];
			}
			if (debug)
			{
				MelonLogger.Msg("Loop: " + k);
			}
		}
		if (debug)
		{
			MelonLogger.Msg("Applied new logic");
		}
		Howard_Obj.GetComponent<Howard>().LogicLevels = Il2CppReferenceArray<HowardLogic>.op_Implicit(array4);
		if (debug)
		{
			MelonLogger.Msg("Applied all logic");
		}
		LogicLoaded = true;
	}

	private ReactionChance ModifyReactions(int Index, float Input)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		ReactionChance val = default(ReactionChance);
		val.Type = (ReactionType)0;
		val.Weight = 0f;
		ReactionChance result = val;
		switch (Index)
		{
		case 0:
			result.Type = (ReactionType)2;
			result.Weight = Input;
			break;
		case 1:
			result.Type = (ReactionType)1;
			result.Weight = Input;
			break;
		case 2:
			result.Type = (ReactionType)0;
			result.Weight = Input;
			break;
		}
		return result;
	}

	private string LogicNameSanitization(string Input)
	{
		switch (Input)
		{
		case "HowardLevel1":
			return "Level 1";
		case "HowardLevel2":
			return "Level 2";
		case "HowardLevel3":
			return "Level 3";
		default:
			if (Input.Length == 0)
			{
				((TMP_Text)LogicText_Obj.GetComponent<TextMeshProUGUI>()).fontSize = 0.18f;
				return "No Name";
			}
			if (Input.Length >= 12)
			{
				float num = ((float)Input.Length - 12f) / 150f;
				((TMP_Text)LogicText_Obj.GetComponent<TextMeshProUGUI>()).fontSize = 0.18f - num;
				return Input;
			}
			((TMP_Text)LogicText_Obj.GetComponent<TextMeshProUGUI>()).fontSize = 0.18f;
			return Input;
		}
	}

	private void PageScrollLogic()
	{
		string text = "Makes Howard do scary things" + Environment.NewLine;
		text = text + "Custom Movesets: " + Environment.NewLine;
		if (LogicNames.Count <= 10)
		{
			foreach (string logicName in LogicNames)
			{
				text = text + logicName + Environment.NewLine;
			}
			Mod.Settings[0].Description = text;
			UI.ForceRefresh();
			LogicLoaded = false;
		}
		else
		{
			if (LogicNames.Count <= 10 || !PageScroll.Done)
			{
				return;
			}
			if (!LogicLoopRun)
			{
				LogicMaxPage = LogicNames.Count / 10 + 1;
				LogicCurPage = 1;
				LogicLoopRun = true;
			}
			if (LogicCurPage == LogicMaxPage)
			{
				for (int i = (LogicMaxPage - 1) * 10; i < LogicNames.Count; i++)
				{
					text = text + LogicNames[i] + Environment.NewLine;
				}
				LogicLoopRun = false;
			}
			if (LogicCurPage < LogicMaxPage)
			{
				LogicLoopMax = LogicCurPage * 10;
				for (int j = LogicLoopMax - 10; j < LogicLoopMax; j++)
				{
					text = text + LogicNames[j] + Environment.NewLine;
				}
				LogicCurPage++;
			}
			Mod.Settings[0].Description = text;
			UI.ForceRefresh();
			PageScroll.Delay_Start(3.0);
		}
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		((MelonMod)this).OnSceneWasLoaded(buildIndex, sceneName);
		currentscene = sceneName;
		Delay.Delay_Start(8.0, AllowRetrigger: true);
		PageScroll.Delay_Start(1.0);
	}
}