Decompiled source of AssetNavigationGenerationExecutionLibraryPlugin CCM v2.1.0

AssetNavigationGenerationExecutionLibraryPlugin_CCM.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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 System.Text.RegularExpressions;
using System.Windows.Forms;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Bounce.ManagedCollections;
using Bounce.Singletons;
using DataModel;
using HarmonyLib;
using ModP.B64;
using ModdingTales;
using Newtonsoft.Json;
using TaleSpire.ContentManagement;
using Unity.Collections;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("AssetNavigationGenerationExecutionLibraryPlugin_CCM")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Nth Dimension")]
[assembly: AssemblyProduct("AssetNavigationGenerationExecutionLibraryPlugin_CCM")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("AssetNavigationGenerationExecutionLibraryPlugin_CCM")]
[assembly: ComVisible(false)]
[assembly: Guid("c303405d-e66c-4316-9cdb-4e3ca15c6360")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("2.1.0.0")]
namespace LordAshes;

[BepInPlugin("org.lordashes.plugins.angel.ccm", "Asset Navigation and Generation Execution Library Plugin (CCM)", "2.1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class AssetNavigationGenerationExecutionLibraryPlugin : BaseUnityPlugin
{
	private class KeyboardBinding
	{
		public KeyboardShortcut binding { get; set; }

		public string handler { get; set; }

		public object parameter { get; set; }

		public KeyboardBinding(KeyboardShortcut binding, string handler, object parameter)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			this.binding = binding;
			this.handler = handler;
			this.parameter = parameter;
		}
	}

	[HarmonyPatch(typeof(CreatureBoardAsset), "OnBaseLoaded")]
	public class PatchOnBaseLoaded
	{
		public static void Postfix(CreatureBoardAsset __instance)
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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)
			CreatureGuid creatureId;
			if ((Object)(object)__instance != (Object)null && __instance.Link != null && IsAngelAsset(__instance.Link))
			{
				string[] obj = new string[6]
				{
					"OnBaseLoaded: ",
					((Object)__instance).name,
					" (",
					null,
					null,
					null
				};
				creatureId = __instance.CreatureId;
				obj[3] = ((object)(CreatureGuid)(ref creatureId)).ToString();
				obj[4] = "), ANGEL Asset. Link: ";
				obj[5] = __instance.Link;
				LoggingPlugin.LogInfo(string.Concat(obj));
				ApplyCustomContents(__instance, __instance.Link);
			}
			else
			{
				string[] obj2 = new string[6]
				{
					"OnBaseLoaded: ",
					((Object)__instance).name,
					" (",
					null,
					null,
					null
				};
				creatureId = __instance.CreatureId;
				obj2[3] = ((object)(CreatureGuid)(ref creatureId)).ToString();
				obj2[4] = "), Non-ANGEL Asset. Link: ";
				obj2[5] = __instance.Link;
				LoggingPlugin.LogInfo(string.Concat(obj2));
			}
		}
	}

	[HarmonyPatch(typeof(CreatureBoardAsset), "OnCreatureDataChanged")]
	public class PatchOnCreatureDataChanged
	{
		public static bool Prefix(CreatureBoardAsset __instance, in CreatureDataV3 newData)
		{
			//IL_0032: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance != (Object)null)
			{
				string[] obj = new string[8]
				{
					"OnCreatureDataChanged: ",
					((Object)__instance).name,
					" (",
					null,
					null,
					null,
					null,
					null
				};
				CreatureGuid creatureId = __instance.CreatureId;
				obj[3] = ((object)(CreatureGuid)(ref creatureId)).ToString();
				obj[4] = "), Link: ";
				obj[5] = ((__instance.Link == null) ? "Null" : __instance.Link);
				obj[6] = " => ";
				obj[7] = ((newData.Link == null) ? "Null" : newData.Link);
				LoggingPlugin.LogInfo(string.Concat(obj));
				if (__instance.Link != newData.Link)
				{
					RemoveCustomContents(__instance.CreatureId);
					if (GetAngelInfo(newData.Link).Count > 0)
					{
						LoggingPlugin.LogTrace("Asset Has ANGEL Content");
						ApplyCustomContents(__instance, newData.Link);
					}
					else
					{
						LoggingPlugin.LogTrace("Asset Has No ANGEL Content");
					}
				}
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(CreatureManager), "DeleteCreature")]
	public class PatchDeleteCreature
	{
		public static void Postfix(CreatureGuid creatureId, UniqueCreatureGuid uniqueId, bool deleteUniqueFromBackend)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			SafeCalls.Invoke("LordAshes.AssetDataPlugin, AssetDataPlugin", "ClearInfo", new object[3]
			{
				((object)(CreatureGuid)(ref creatureId)).ToString(),
				"org.lordashes.plugins.hidebase",
				false
			}, (object)null);
			RemoveCustomContents(creatureId);
			foreach (Action<CreatureGuid> item in _subscriptionsAssetRemove)
			{
				item(creatureId);
			}
		}
	}

	[HarmonyPatch(typeof(CreatureManager), "DeleteCreatures")]
	public class PatchDeleteCreatures
	{
		public static void Postfix(CreatureGuid[] creatureIds, BList<UniqueCreatureGuid> uniqueIds, bool deleteUniqueFromBackend)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			foreach (CreatureGuid creatureId in creatureIds)
			{
				PatchDeleteCreature.Postfix(creatureId, default(UniqueCreatureGuid), deleteUniqueFromBackend: false);
			}
		}
	}

	[HarmonyPatch(typeof(CreatureBoardAsset), "Select")]
	public class PatchSelect
	{
		public static void Postfix(CreatureBoardAsset __instance)
		{
			((MonoBehaviour)_self).StartCoroutine(setPortraitBadge(__instance));
		}
	}

	[HarmonyPatch(typeof(CreatureManager), "SetCreatureFlyingState")]
	public class PatchSetCreatureFlyingState
	{
		public static void Postfix(CreatureGuid creatureId, bool flyingState)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			CreatureBoardAsset val = null;
			CreaturePresenter.TryGetAsset(creatureId, ref val);
			if ((Object)(object)val != (Object)null)
			{
				string[] obj = new string[5] { val.Name, " (", null, null, null };
				CreatureGuid creatureId2 = val.CreatureId;
				obj[2] = ((object)(CreatureGuid)(ref creatureId2)).ToString();
				obj[3] = ") Changed Flying State To ";
				obj[4] = flyingState.ToString();
				LoggingPlugin.LogTrace(string.Concat(obj));
				if (val.Link != null && val.Link.ToUpper().Contains("ANGEL=") && val.IsExplicitlyHidden && flyingState)
				{
					string name = val.Name;
					creatureId2 = val.CreatureId;
					LoggingPlugin.LogTrace(name + " (" + ((object)(CreatureGuid)(ref creatureId2)).ToString() + "): Hidden Flying ANGEL Assets Not Supported. Removing Flying State.");
					CreatureManager.SetCreatureFlyingState(creatureId, false);
				}
			}
		}
	}

	[HarmonyPatch(typeof(CreatureManager), "SetCreatureExplicitHideState")]
	public class PatchSetCreatureExplicitHideState
	{
		public static void Postfix(CreatureGuid creatureId, bool hideState)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			CreatureBoardAsset val = null;
			CreaturePresenter.TryGetAsset(creatureId, ref val);
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			string[] obj = new string[5] { val.Name, " (", null, null, null };
			CreatureGuid creatureId2 = val.CreatureId;
			obj[2] = ((object)(CreatureGuid)(ref creatureId2)).ToString();
			obj[3] = ") Changed Hidden State To ";
			obj[4] = hideState.ToString();
			LoggingPlugin.LogTrace(string.Concat(obj));
			if (val.Link == null || !val.Link.ToUpper().Contains("ANGEL="))
			{
				return;
			}
			foreach (GameObject item in from gameObject in Object.FindObjectsByType<GameObject>((FindObjectsSortMode)0)
				where ((Object)gameObject).name.StartsWith(((object)(CreatureGuid)(ref creatureId)).ToString())
				select gameObject)
			{
				if ((Object)(object)item != (Object)null)
				{
					Renderer[] componentsInChildren = item.GetComponentsInChildren<Renderer>();
					foreach (Renderer val2 in componentsInChildren)
					{
						string[] obj2 = new string[9] { val.Name, " (", null, null, null, null, null, null, null };
						creatureId2 = val.CreatureId;
						obj2[2] = ((object)(CreatureGuid)(ref creatureId2)).ToString();
						obj2[3] = "): Setting ";
						obj2[4] = ((Object)item).name;
						obj2[5] = " Renderer ";
						obj2[6] = ((Object)val2).name;
						obj2[7] = " Enable To ";
						obj2[8] = (!hideState).ToString();
						LoggingPlugin.LogTrace(string.Concat(obj2));
						val2.enabled = !hideState;
					}
				}
			}
			if (hideState && ((MovableBoardAsset)val).IsFlying)
			{
				string name = val.Name;
				creatureId2 = val.CreatureId;
				LoggingPlugin.LogTrace(name + " (" + ((object)(CreatureGuid)(ref creatureId2)).ToString() + "): Hidden Flying ANGEL Assets Not Supported. Removing Flying State.");
				CreatureManager.SetCreatureFlyingState(creatureId, false);
			}
		}
	}

	private static class Provider
	{
		public static IEnumerator GetAngelAssets(ReadOnlyDictionary<string, AssetInfo> existingAssets, Func<Dictionary<string, AssetInfo>, IEnumerator> callback)
		{
			Dictionary<string, AssetInfo> assets = new Dictionary<string, AssetInfo>();
			List<string> potentialAssets = new List<string>();
			try
			{
				potentialAssets = (from f in File.Catalog(false)
					where f.Contains("CustomData/") && Path.GetFileNameWithoutExtension(f) == Path.GetFileName(f)
					select f).ToList();
				LoggingPlugin.LogTrace("Filter Based Potential Asset Detection");
			}
			catch
			{
				LoggingPlugin.LogTrace("Non-Filter Based Potential Asset Detection");
				List<string> fullAssets = File.Catalog(false).ToList();
				foreach (string assetPath in fullAssets)
				{
					try
					{
						string assetFileName = (assetPath.Contains("/") ? assetPath.Substring(assetPath.LastIndexOf("/") + 1) : assetPath);
						LoggingPlugin.LogTrace("Analyzing '" + assetPath + "' With Extension '" + Path.GetExtension(assetFileName) + "'");
						if (assetPath.Contains("CustomData/") && Path.GetFileNameWithoutExtension(assetPath) == Path.GetFileName(assetPath))
						{
							potentialAssets.Add(assetPath);
						}
					}
					catch (Exception ex)
					{
						LoggingPlugin.LogWarning("Unable To Determine Extension Of '" + assetPath + "'");
						LoggingPlugin.LogWarning("Details: " + ex.Message);
					}
				}
			}
			LoggingPlugin.LogDebug("Found " + potentialAssets.Count + " Potential Assets");
			string cacheFolder = Paths.PluginPath + "/.cache/org.lordashes.plugins.commoncustomsmenu/";
			for (int pa = 0; pa < potentialAssets.Count; pa++)
			{
				yield return (object)new WaitForEndOfFrame();
				string assetBundleName = potentialAssets[pa];
				_self.notification = "Registering... [Provider: ANGEL]";
				if (existingAssets.ContainsKey(assetBundleName))
				{
					continue;
				}
				string assetBundleLocation = File.Find(assetBundleName, (CacheType)999)[0];
				LoggingPlugin.LogTrace("Seeking " + assetBundleName + "...");
				if (assets.ContainsKey(assetBundleName))
				{
					continue;
				}
				AssetInfo info = GetAngelAssetInfo(assetBundleName, assetBundleLocation, cacheFolder);
				if (info == null)
				{
					continue;
				}
				if (info.name == "")
				{
					info.name = ((info.prefab != "") ? info.prefab : System.Guid.NewGuid().ToString());
				}
				if (info.kind == "")
				{
					info.kind = "Creature";
				}
				if (info.header == "")
				{
					info.header = "Medieval Fantasy";
				}
				if (info.groupName == "")
				{
					info.groupName = "Custom Content";
				}
				_self.notification = "Registering... [Provider: ANGEL, Pack: " + info.pack + ", Item: " + info.prefab + "]";
				assets.Add(assetBundleName, info);
				if (info.variants != null && info.variants.Length != 0)
				{
					string[] variants = info.variants;
					foreach (string variant in variants)
					{
						AssetInfo copy = info.Clone();
						_self.notification = "Registering... [Provider: ANGEL, Pack: " + copy.pack + ", Item: " + copy.prefab + ", Variant: " + variant + "]";
						copy.prefab = variant;
						copy.name = copy.name + " (" + variant + ")";
						assets.Add(assetBundleName + "." + variant, copy);
					}
				}
			}
			_self.notification = null;
			((MonoBehaviour)_self).StartCoroutine(callback(assets));
		}

		private static AssetInfo GetAngelAssetInfo(string assetBundleName, string assetLocation, string cacheFolder)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			LoggingPlugin.LogDebug("Asset Bundle " + assetBundleName + " Lookup...");
			AssetBundle val = AssetBundle.LoadFromFile(assetLocation);
			AssetInfo val2 = new AssetInfo();
			TextAsset val3 = null;
			if ((Object)(object)val != (Object)null)
			{
				try
				{
					LoggingPlugin.LogTrace("Asset " + assetBundleName + ": Reading Info.txt JSON Object");
					val3 = val.LoadAsset<TextAsset>("info.txt");
				}
				catch (Exception ex)
				{
					LoggingPlugin.LogWarning("Asset " + assetBundleName + ": Unable to read info.txt file. File is missing or corrupt.");
					LoggingPlugin.LogWarning("Details: " + ex.Message);
				}
				try
				{
					LoggingPlugin.LogTrace("Asset " + assetBundleName + ": Deserializing Info.txt Object");
					val2 = JsonConvert.DeserializeObject<AssetInfo>(val3.text);
				}
				catch (Exception ex2)
				{
					LoggingPlugin.LogWarning("Asset " + assetBundleName + ": Unable to deserialize info.txt file. File contains invalid JSON.");
					LoggingPlugin.LogWarning("Details: " + ex2.Message);
				}
				try
				{
					LoggingPlugin.LogTrace("Asset " + assetBundleName + ": Adjusting Info");
					val2.provider = "ANGEL";
					val2.filename = assetLocation;
					if (val2.kind != "" && (val2.category == "" || val2.category == null))
					{
						val2.category = val2.kind;
					}
					if (val2.category != "" && (val2.kind == "" || val2.kind == null))
					{
						val2.kind = val2.category;
					}
					val2.pack = val2.filename.Substring(Paths.PluginPath.Length);
					val2.pack = val2.pack.Substring(0, val2.pack.Length - assetBundleName.Length);
					val2.pack = val2.pack.Replace("/", "").Replace("\\", "");
					if (val2.blendshapes != null && val2.blendshapes.Length != 0)
					{
						val2.hasBlendshapes = true;
					}
				}
				catch (Exception ex3)
				{
					LoggingPlugin.LogWarning("Asset " + assetBundleName + ": Unable to adjust info settings.");
					LoggingPlugin.LogWarning("Details: " + ex3.Message);
				}
				try
				{
					LoggingPlugin.LogTrace("Asset " + assetBundleName + ": Getting Bundle Names");
					string[] allAssetNames = val.GetAllAssetNames();
					LoggingPlugin.LogTrace("Asset " + assetBundleName + ": Seeking File Types In Names");
					if (allAssetNames != null && allAssetNames.Length != 0)
					{
						string[] array = allAssetNames;
						foreach (string text in array)
						{
							if (text.ToLower().EndsWith(".prefab") && val2.prefab == "")
							{
								val2.prefab = Path.GetFileNameWithoutExtension(text);
							}
							if (text.ToLower().EndsWith(".anim"))
							{
								val2.hasAnimations = true;
							}
							if (text.ToLower().EndsWith(".mp3"))
							{
								val2.hasAudio = true;
							}
							if (text.ToLower().EndsWith(".wav"))
							{
								val2.hasAudio = true;
							}
						}
					}
					else
					{
						LoggingPlugin.LogWarning("Asset " + assetBundleName + ": Unable To Read Names Of Contents");
					}
				}
				catch (Exception ex4)
				{
					LoggingPlugin.LogWarning("Asset " + assetBundleName + ": Unable to read pack contents.");
					LoggingPlugin.LogWarning("Details: " + ex4.Message);
				}
				try
				{
					LoggingPlugin.LogTrace("Asset " + assetBundleName + ": Getting Portrait");
					Texture2D val4 = val.LoadAsset<Texture2D>("portrait.png");
					try
					{
						LoggingPlugin.LogTrace("Asset " + assetBundleName + ": Saving Portrait");
						byte[] array2 = ImageConversion.EncodeToPNG(val4);
						File.WriteAllBytes(cacheFolder + "/Portrait." + val2.prefab + ".png", array2, (CacheType)999);
						string[] variants = val2.variants;
						foreach (string text2 in variants)
						{
							File.WriteAllBytes(cacheFolder + "/Portrait." + text2 + ".png", array2, (CacheType)999);
						}
					}
					catch (Exception ex5)
					{
						LoggingPlugin.LogWarning("Asset " + assetBundleName + ": Unable to write Portrait to " + cacheFolder + " as Portrait." + val2.prefab + ".png");
						LoggingPlugin.LogWarning("Details: " + ex5.Message);
					}
				}
				catch (Exception ex6)
				{
					LoggingPlugin.LogWarning("Asset " + assetBundleName + ": Missing an Portrait.png file or it is corrupt.");
					LoggingPlugin.LogWarning("Details: " + ex6.Message);
				}
				val.Unload(true);
			}
			return val2;
		}
	}

	public class Sequencer
	{
		private string name = "";

		public Sequencer(Elements sequence)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			name = sequence.name;
			Element[] elements = sequence.elements;
			foreach (Element sequence2 in elements)
			{
				LoggingPlugin.LogDebug("Starting Sequencer " + sequence.name);
				sequencers.Add(sequence.target.CreatureId);
				((MonoBehaviour)_self).StartCoroutine(processSequence(sequence.target, sequence.name, sequence2));
			}
		}

		private IEnumerator processSequence(CreatureBoardAsset target, string name, Element sequence)
		{
			yield return (object)new WaitForSeconds(sequence.delay);
			AnimationStyle animStyle = (AnimationStyle)(sequence.style & 0xFF);
			bool animLoop = isSet(sequence.style, (AnimationStyle)128);
			bool animPingPong = isSet(sequence.style, (AnimationStyle)2);
			string animClamp = (isSet(sequence.style, (AnimationStyle)256) ? "Start" : (isSet(sequence.style, (AnimationStyle)1024) ? "End" : "None"));
			LoggingPlugin.LogDebug("Animation: " + name + ", Animation Style: " + ((object)(AnimationStyle)(ref animStyle)).ToString() + ", Loop: " + animLoop + ", Clamp: " + animClamp);
			AnimationStyle style;
			do
			{
				style = sequence.style;
				LoggingPlugin.LogDebug("Starting Forward Sequence Of Sequencer " + name + " With Style " + ((object)(AnimationStyle)(ref style)).ToString());
				CreatureGuid creatureId;
				if (sequence.audio != null && sequence.audio.Trim() != "")
				{
					int selection = int.Parse(sequence.audio);
					creatureId = target.CreatureId;
					Audio(selection, ((object)(CreatureGuid)(ref creatureId)).ToString());
				}
				if (sequence.animation != null && sequence.animation.Trim() != "")
				{
					int selection2 = int.Parse(sequence.animation);
					creatureId = target.CreatureId;
					Animation(selection2, ((object)(CreatureGuid)(ref creatureId)).ToString());
				}
				do
				{
					if ((int)sequence.style <= 0)
					{
						continue;
					}
					if (sequence.start < sequence.end)
					{
						for (float pace2 = sequence.start; pace2 < sequence.end; pace2 += Math.Abs(sequence.step))
						{
							yield return (object)new WaitForSeconds(0.1f);
							HandleBlendshape(target, sequence.blendShapeIndex, pace2);
							if (!sequencers.Contains(target.CreatureId))
							{
								break;
							}
						}
						continue;
					}
					for (float pace3 = sequence.start; pace3 > sequence.end; pace3 += -1f * Math.Abs(sequence.step))
					{
						yield return (object)new WaitForSeconds(0.1f);
						HandleBlendshape(target, sequence.blendShapeIndex, pace3);
						if (!sequencers.Contains(target.CreatureId))
						{
							break;
						}
					}
				}
				while (sequencers.Contains(target.CreatureId) && !animPingPong && animLoop);
				LoggingPlugin.LogDebug("Reverse Animation Condition: " + sequencers.Contains(target.CreatureId) + " && " + animPingPong);
				if (!(sequencers.Contains(target.CreatureId) && animPingPong))
				{
					continue;
				}
				style = sequence.style;
				LoggingPlugin.LogDebug("Starting Reverse Sequence Of Sequencer " + name + " With Style " + ((object)(AnimationStyle)(ref style)).ToString());
				if (sequence.end < sequence.start)
				{
					for (float pace4 = sequence.end; pace4 < sequence.start; pace4 += Math.Abs(sequence.step))
					{
						yield return (object)new WaitForSeconds(0.1f);
						HandleBlendshape(target, sequence.blendShapeIndex, pace4);
						if (!sequencers.Contains(target.CreatureId))
						{
							break;
						}
					}
					continue;
				}
				for (float pace = sequence.end; pace > sequence.start; pace += -1f * Math.Abs(sequence.step))
				{
					yield return (object)new WaitForSeconds(0.1f);
					HandleBlendshape(target, sequence.blendShapeIndex, pace);
					if (!sequencers.Contains(target.CreatureId))
					{
						break;
					}
				}
			}
			while (sequencers.Contains(target.CreatureId) && animLoop);
			if (isSet(sequence.style, (AnimationStyle)256))
			{
				LoggingPlugin.LogTrace("Ending Sequencer " + name + " Sequence With Starting Sequence Values");
				HandleBlendshape(target, sequence.blendShapeIndex, sequence.start);
			}
			else if (isSet(sequence.style, (AnimationStyle)1024))
			{
				LoggingPlugin.LogTrace("Ending Sequencer " + name + " Sequence With Ending Sequence Values");
				HandleBlendshape(target, sequence.blendShapeIndex, sequence.end);
			}
			else
			{
				LoggingPlugin.LogTrace("Ending Sequencer " + name + " Sequence With Current Sequence Values");
			}
			style = sequence.style;
			LoggingPlugin.LogDebug("Removing Sequencer " + name + " With Style " + ((object)(AnimationStyle)(ref style)).ToString());
			if (sequencers.Contains(target.CreatureId))
			{
				sequencers.Remove(target.CreatureId);
			}
		}

		private void HandleBlendshape(CreatureBoardAsset target, int blendShapeIndex, float blendShapeValue)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			string[] obj = new string[9]
			{
				"Requesting BlendShape ",
				(blendShapeIndex - 1).ToString(),
				" To ",
				blendShapeValue.ToString(),
				" On ",
				target.Name,
				" (",
				null,
				null
			};
			CreatureGuid creatureId = target.CreatureId;
			obj[7] = ((object)(CreatureGuid)(ref creatureId)).ToString();
			obj[8] = ")";
			LoggingPlugin.LogDebug(string.Concat(obj));
			SkinnedMeshRenderer componentInChildren = ((Component)target).GetComponentInChildren<SkinnedMeshRenderer>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				LoggingPlugin.LogTrace(componentInChildren.sharedMesh.blendShapeCount + " Blendshapes Available");
				LoggingPlugin.LogTrace("Setting BlendShape " + (blendShapeIndex - 1) + " (" + componentInChildren.sharedMesh.GetBlendShapeName(blendShapeIndex - 1) + ") To " + blendShapeValue);
				try
				{
					componentInChildren.SetBlendShapeWeight(blendShapeIndex - 1, (float)(int)blendShapeValue);
				}
				catch (Exception ex)
				{
					LoggingPlugin.LogWarning(ex.Message);
				}
			}
		}

		private bool isSet(AnimationStyle value, AnimationStyle mask)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			return (AnimationStyle)(value & mask) == mask;
		}
	}

	public static class Utility
	{
		public static bool isBoardLoaded()
		{
			return SimpleSingletonBehaviour<CameraController>.HasInstance && SingletonStateMBehaviour<BoardSessionManager, State<BoardSessionManager>>.HasInstance && !BoardSessionManager.IsLoading;
		}

		public static float ParseFloat(string value)
		{
			return float.Parse(value, CultureInfo.InvariantCulture);
		}

		public static GameObject FindInHierarchy(GameObject start, string seekName)
		{
			List<GameObject> results = new List<GameObject>();
			bool done = false;
			Traverse(start.transform, seekName, null, single: true, ref results, ref done);
			return (results.Count > 0) ? results.ElementAt(0) : null;
		}

		public static GameObject FindInHierarchyViaPartialName(GameObject start, string seekName)
		{
			List<GameObject> results = new List<GameObject>();
			bool done = false;
			Traverse(start.transform, seekName, null, single: true, ref results, ref done, partial: true);
			return (results.Count > 0) ? results.ElementAt(0) : null;
		}

		public static GameObject[] FindAllInHierarchy(GameObject start, string seekName)
		{
			List<GameObject> results = new List<GameObject>();
			bool done = false;
			Traverse(start.transform, seekName, null, single: false, ref results, ref done);
			return results.ToArray();
		}

		public static GameObject[] FindAllInHierarchyViaPartialName(GameObject start, string seekName)
		{
			List<GameObject> results = new List<GameObject>();
			bool done = false;
			Traverse(start.transform, seekName, null, single: false, ref results, ref done, partial: true);
			return results.ToArray();
		}

		public static GameObject FindWithComponentInHierarchy(GameObject start, string seekType)
		{
			List<GameObject> results = new List<GameObject>();
			bool done = false;
			Traverse(start.transform, null, seekType, single: true, ref results, ref done);
			return (results.Count > 0) ? results.ElementAt(0) : null;
		}

		public static GameObject[] FindAllWithComponentInHierarchy<T>(GameObject start, string seekType)
		{
			List<GameObject> results = new List<GameObject>();
			bool done = false;
			Traverse(start.transform, null, seekType, single: false, ref results, ref done);
			return results.ToArray();
		}

		public static void Traverse(Transform root, string seekName, string seekType, bool single, ref List<GameObject> results, ref bool done, bool partial = false)
		{
			try
			{
				if ((seekName == null || seekName == ((Object)((Component)root).gameObject).name || (partial && ((Object)((Component)root).gameObject).name.Contains(seekName))) && (seekType == null || (Object)(object)((Component)root).GetComponent(seekType) != (Object)null))
				{
					LoggingPlugin.LogTrace("Matched '" + ((Object)((Component)root).gameObject).name + "'");
					results.Add(((Component)root).gameObject);
					if (single)
					{
						done = true;
						return;
					}
				}
				foreach (Transform item in ExtensionMethods.Children(root))
				{
					if (!done)
					{
						Traverse(item, seekName, seekType, single, ref results, ref done, partial);
					}
				}
			}
			catch
			{
			}
		}

		public static object LookUp(in Dictionary<string, object> dictionary, string key)
		{
			foreach (KeyValuePair<string, object> item in dictionary)
			{
				if (item.Key.ToUpper() == key.ToUpper())
				{
					return item.Value;
				}
			}
			return null;
		}

		public static bool ScrollLock()
		{
			return Control.IsKeyLocked((Keys)145);
		}

		public static void PostOnMainPage(BaseUnityPlugin plugin)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			string text = "Lord Ashes" + ("Lord Ashes".ToUpper().EndsWith("S") ? "'" : "'s");
			ModdingUtils.Initialize(plugin, new ManualLogSource("Asset Navigation and Generation Execution Library Plugin (CCM)"), text, false);
		}
	}

	private static bool spawnAsMorph = false;

	private Dictionary<string, KeyboardBinding> bindings = new Dictionary<string, KeyboardBinding>();

	private string notification = null;

	private Rect registrationMessagePos = Rect.zero;

	private GUIStyle registrationMessageStyle = new GUIStyle();

	private static Vector3 flyingOffset = Vector3.zero;

	private static Vector3 flyingScale = new Vector3(1f, 1f, 1f);

	private static Vector3 nonflyingOffset = Vector3.zero;

	private static Vector3 nonflyingScale = new Vector3(1f, 1f, 1f);

	private static List<CreatureGuid> sequencers = new List<CreatureGuid>();

	public static Dictionary<string, KeyboardShortcut> modifiers = new Dictionary<string, KeyboardShortcut>
	{
		{
			"Creature",
			new KeyboardShortcut((KeyCode)306, Array.Empty<KeyCode>())
		},
		{
			"Prop",
			new KeyboardShortcut((KeyCode)305, Array.Empty<KeyCode>())
		},
		{
			"Aura",
			new KeyboardShortcut((KeyCode)308, Array.Empty<KeyCode>())
		},
		{
			"Effect",
			new KeyboardShortcut((KeyCode)307, Array.Empty<KeyCode>())
		},
		{
			"Filter",
			new KeyboardShortcut((KeyCode)304, Array.Empty<KeyCode>())
		},
		{
			"Morph",
			new KeyboardShortcut((KeyCode)303, Array.Empty<KeyCode>())
		}
	};

	private static List<Action<CreatureBoardAsset>> _subscriptionsAssetAdd = new List<Action<CreatureBoardAsset>>();

	private static List<Action<CreatureGuid>> _subscriptionsAssetRemove = new List<Action<CreatureGuid>>();

	public const string Name = "Asset Navigation and Generation Execution Library Plugin (CCM)";

	public const string Guid = "org.lordashes.plugins.angel.ccm";

	public const string Version = "2.1.0.0";

	public const string Author = "Lord Ashes";

	public static AssetNavigationGenerationExecutionLibraryPlugin _self = null;

	private bool boardLoaded = true;

	public static void RequestAnimation(int selection)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		object[] array = new object[4];
		CreatureGuid selectedCreatureId = LocalClient.SelectedCreatureId;
		array[0] = ((object)(CreatureGuid)(ref selectedCreatureId)).ToString();
		array[1] = "org.lordashes.plugins.angel.ccm.animate";
		array[2] = selection;
		array[3] = false;
		SafeCalls.Invoke("LordAshes.AssetDataPlugin, AssetDataPlugin", "SetInfo", array, (object)null);
	}

	public static void RemoteRequestAnimation(object action, object source, object key, object previous, object current)
	{
		Animation(int.Parse(current.ToString()), source.ToString());
	}

	public static void Animation(int selection, string target)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: 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)
		//IL_0463: Unknown result type (might be due to invalid IL or missing references)
		//IL_0468: Unknown result type (might be due to invalid IL or missing references)
		LoggingPlugin.LogDebug("Animate: Start");
		CreatureGuid val = (CreatureGuid)((target == null) ? LocalClient.SelectedCreatureId : new CreatureGuid(target));
		LoggingPlugin.LogTrace("Animate: Cid = " + ((object)(CreatureGuid)(ref val)).ToString());
		CreatureBoardAsset val2 = null;
		CreaturePresenter.TryGetAsset(val, ref val2);
		if ((Object)(object)val2 != (Object)null)
		{
			LoggingPlugin.LogTrace("Animate: Obtained Asset Reference");
			Animation animation = ((Component)((MovableBoardAsset)val2).Rotator).GetComponentInChildren<Animation>();
			List<AnimationState> anims = (((Object)(object)animation == (Object)null) ? null : new List<AnimationState>(((IEnumerable)animation).Cast<AnimationState>()));
			if ((Object)(object)animation != (Object)null && anims != null)
			{
				switch (selection)
				{
				case 0:
					LoggingPlugin.LogDebug("Animate: Stopping All Animations");
					animation.Stop();
					return;
				case 8:
					LoggingPlugin.LogDebug("Animate: Toggling Named Animation");
					SystemMessage.AskForTextInput("Play Animation", "Animation Name:", "Play", (Action<string>)delegate(string an)
					{
						LoggingPlugin.LogDebug("Animate: Seeking Animation '" + an + "'");
						foreach (AnimationState item in anims)
						{
							if (item.name.Contains(an))
							{
								LoggingPlugin.LogTrace("Animate: Playing Animation '" + item.name + "'");
								animation.Stop();
								animation.Play(item.name);
								break;
							}
						}
					}, (Action)null, "Cancel", (Action)null, "");
					return;
				}
				LoggingPlugin.LogDebug("Animate: Playing Animation By Index (" + selection + ")");
				string currentPrefab = GetAngelInfo(val2.Link).ElementAt(0).Substring(GetAngelInfo(val2.Link).ElementAt(0).IndexOf("@") + 1);
				AssetInfo val3 = (from registeredAsset in CommonCustomsMenuPlugin.GetAssets()
					where registeredAsset.prefab == currentPrefab
					select registeredAsset).FirstOrDefault();
				if (val3 == null)
				{
					foreach (AssetInfo asset in CommonCustomsMenuPlugin.GetAssets())
					{
						LoggingPlugin.LogWarning("Found Registered Asset Prefab '" + asset.prefab + "' While Seeking '" + currentPrefab + "'");
					}
					val3 = null;
				}
				LoggingPlugin.LogTrace("Animate: Asset Info = " + ((val3 != null) ? JsonConvert.SerializeObject((object)val3) : "Null"));
				LoggingPlugin.LogTrace("Animate: AnimationOrder = " + ((val3 != null && val3.animationOrder != null) ? JsonConvert.SerializeObject((object)val3.animationOrder) : "Default"));
				if (val3 != null && val3.animationOrder != null)
				{
					LoggingPlugin.LogTrace("Animate: Selection " + selection + " vs " + val3.animationOrder.Length + " Ordered Animations");
					if (selection - 1 < val3.animationOrder.Length)
					{
						LoggingPlugin.LogTrace("Animate: Playing Animation '" + val3.animationOrder[selection - 1] + "' (Asset Animation Order)");
						animation.Play(val3.animationOrder[selection - 1]);
						return;
					}
				}
				LoggingPlugin.LogTrace("Animate: Selection " + selection + " vs " + anims.Count + " Available Animations");
				if (selection <= anims.Count)
				{
					LoggingPlugin.LogTrace("Animate: Playing Animation '" + anims[selection - 1].name + "' (Unity Animation Order)");
					animation.Stop();
					animation.Play(anims[selection - 1].name);
				}
				else
				{
					LoggingPlugin.LogWarning("Animate: Asset " + val2.Name + " Does Not Have Animation " + selection);
					SystemMessage.DisplayInfoText("Asset " + val2.Name + " Does Not Have Animation " + selection, 2.5f, 0f);
				}
			}
			else
			{
				string[] obj = new string[5] { "Animate: Asset ", val2.Name, " (", null, null };
				CreatureGuid creatureId = val2.CreatureId;
				obj[3] = ((object)(CreatureGuid)(ref creatureId)).ToString();
				obj[4] = ") Does Not Have Any Animations";
				SystemMessage.DisplayInfoText(string.Concat(obj), 2.5f, 0f);
			}
		}
		else
		{
			SystemMessage.DisplayInfoText("Animate: No Asset Selected For Animation Activation", 2.5f, 0f);
		}
	}

	public static void RequestAudio(int selection)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		object[] array = new object[4];
		CreatureGuid selectedCreatureId = LocalClient.SelectedCreatureId;
		array[0] = ((object)(CreatureGuid)(ref selectedCreatureId)).ToString();
		array[1] = "org.lordashes.plugins.angel.ccm.audio";
		array[2] = selection;
		array[3] = false;
		SafeCalls.Invoke("LordAshes.AssetDataPlugin, AssetDataPlugin", "SetInfo", array, (object)null);
	}

	public static void RemoteRequestAudio(object action, object source, object key, object previous, object current)
	{
		Audio(int.Parse(current.ToString()), source.ToString());
	}

	public static void Audio(int selection, string target)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		CreatureGuid val = (CreatureGuid)((target == null) ? LocalClient.SelectedCreatureId : new CreatureGuid(target));
		CreatureBoardAsset val2 = null;
		CreaturePresenter.TryGetAsset(val, ref val2);
		if (!((Object)(object)val2 != (Object)null))
		{
			return;
		}
		AudioSource[] audios = ((Component)((MovableBoardAsset)val2).Rotator).GetComponentsInChildren<AudioSource>();
		CreatureGuid creatureId;
		if (audios != null)
		{
			switch (selection)
			{
			case 0:
			{
				LoggingPlugin.LogDebug("Audio: Stopping All Audio");
				AudioSource[] array = audios;
				foreach (AudioSource val3 in array)
				{
					val3.Stop();
				}
				return;
			}
			case 8:
				LoggingPlugin.LogDebug("Audio: Playing Named Audio");
				SystemMessage.AskForTextInput("Play Audio", "Audio Name:", "Play", (Action<string>)delegate(string an)
				{
					LoggingPlugin.LogDebug("Audio: Seeking Audio '" + an + "'");
					AudioSource[] array3 = audios;
					foreach (AudioSource val5 in array3)
					{
						if (((Object)val5.clip).name.Contains(an))
						{
							LoggingPlugin.LogTrace("Audio: Playing Audio '" + ((Object)val5.clip).name + "'");
							AudioSource[] array4 = audios;
							foreach (AudioSource val6 in array4)
							{
								val6.Stop();
							}
							val5.Play();
							break;
						}
					}
				}, (Action)null, "Cancel", (Action)null, "");
				return;
			}
			LoggingPlugin.LogDebug("Audio: Playing Audio " + selection);
			if (selection <= audios.Length)
			{
				LoggingPlugin.LogTrace("Audio: Playing Audio '" + ((Object)audios[selection - 1].clip).name + "'");
				AudioSource[] array2 = audios;
				foreach (AudioSource val4 in array2)
				{
					val4.Stop();
				}
				audios[selection - 1].Play();
			}
			else
			{
				string[] obj = new string[6] { "Asset ", val2.Name, " (", null, null, null };
				creatureId = val2.CreatureId;
				obj[3] = ((object)(CreatureGuid)(ref creatureId)).ToString();
				obj[4] = ") Does Not Have Audio ";
				obj[5] = selection.ToString();
				SystemMessage.DisplayInfoText(string.Concat(obj), 2.5f, 0f);
			}
		}
		else
		{
			string[] obj2 = new string[5] { "Audio: Asset ", val2.Name, " (", null, null };
			creatureId = val2.CreatureId;
			obj2[3] = ((object)(CreatureGuid)(ref creatureId)).ToString();
			obj2[4] = ") Does Not Have Any Audio";
			LoggingPlugin.LogTrace(string.Concat(obj2));
		}
	}

	public static void RequestSequence(int selection)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		object[] array = new object[4];
		CreatureGuid selectedCreatureId = LocalClient.SelectedCreatureId;
		array[0] = ((object)(CreatureGuid)(ref selectedCreatureId)).ToString();
		array[1] = "org.lordashes.plugins.angel.ccm.sequence";
		array[2] = selection;
		array[3] = false;
		SafeCalls.Invoke("LordAshes.AssetDataPlugin, AssetDataPlugin", "SetInfo", array, (object)null);
	}

	public static void RemoteRequestSequence(object action, object source, object key, object previous, object current)
	{
		Sequence(int.Parse(current.ToString()), source.ToString());
	}

	public static void Sequence(int selection, string target)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: 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_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		LoggingPlugin.LogDebug("HandleBlendsahpe Entry");
		CreatureGuid val = (CreatureGuid)((target == null) ? LocalClient.SelectedCreatureId : new CreatureGuid(target));
		LoggingPlugin.LogDebug("Cid = " + ((object)(CreatureGuid)(ref val)).ToString() + ", Selection = " + selection);
		if (selection < 10 && !sequencers.Contains(val))
		{
			LoggingPlugin.LogDebug("Getting Reference To Asset With Cid " + ((object)(CreatureGuid)(ref val)).ToString());
			CreatureBoardAsset val2 = null;
			CreaturePresenter.TryGetAsset(val, ref val2);
			LoggingPlugin.LogDebug("Getting AssetInfo For Asset With Cid " + ((object)(CreatureGuid)(ref val)).ToString());
			AssetInfo assetInfo = GetAssetInfo(val2.Link);
			LoggingPlugin.LogDebug("Info is null? " + (assetInfo == null));
			LoggingPlugin.LogDebug("Requesting Sequence " + selection + " (Of " + assetInfo.blendshapes.Length + " Sequences)");
			if (assetInfo.blendshapes != null && selection <= assetInfo.blendshapes.Length)
			{
				Elements val3 = assetInfo.blendshapes.ElementAt(selection - 1);
				val3.target = val2;
				new Sequencer(val3);
			}
			else
			{
				LoggingPlugin.LogWarning("Sequence: Asset " + val2.Name + " Does Not Have Sequence " + selection);
				SystemMessage.DisplayInfoText("Asset " + val2.Name + " Does Not Have Sequence " + selection, 2.5f, 0f);
			}
		}
		else
		{
			LoggingPlugin.LogDebug("Requesting Sequence Stop (blendShapeIndex=" + selection + ", AnimatingAssetsCount=" + sequencers.Count + ")");
			while (sequencers.Contains(val))
			{
				sequencers.Remove(val);
			}
		}
	}

	public static void AddMorphs(object unused)
	{
		LoggingPlugin.LogDebug("Add Morph Started");
		SystemMessage.DisplayInfoText("Select Morph...", 2.5f, 0f);
		CommonCustomsMenuPlugin._self.Open();
		spawnAsMorph = true;
	}

	public static void CycleMorphs(object unused)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		LoggingPlugin.LogDebug("Cycle Morphs");
		CreatureBoardAsset val = null;
		CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref val);
		if ((Object)(object)val != (Object)null)
		{
			List<string> angelInfo = GetAngelInfo(val.Link);
			if (angelInfo.Count() > 1)
			{
				for (int i = 0; i < angelInfo.Count; i++)
				{
					LoggingPlugin.LogTrace("Looking For Current Morph. Found '" + angelInfo[i] + "'");
					if (!angelInfo[i].ToUpper().StartsWith("CREATURE") && !angelInfo[i].ToUpper().StartsWith("PROP"))
					{
						continue;
					}
					LoggingPlugin.LogTrace("Found Current Moprh '" + angelInfo[i] + "'");
					int num = i + 1;
					if (num >= angelInfo.Count)
					{
						num = 0;
					}
					while (num != i && !angelInfo[num].ToUpper().StartsWith("MORPH"))
					{
						LoggingPlugin.LogTrace("Looking For Next Morph. Found '" + angelInfo[num] + "'");
						num++;
						if (num >= angelInfo.Count)
						{
							num = 0;
						}
					}
					if (num == i)
					{
						string[] obj = new string[5] { "Asset ", val.Name, " (", null, null };
						CreatureGuid creatureId = val.CreatureId;
						obj[3] = ((object)(CreatureGuid)(ref creatureId)).ToString();
						obj[4] = ")\r\nDoes Not Have Any Morphs";
						SystemMessage.DisplayInfoText(string.Concat(obj), 2.5f, 0f);
					}
					else
					{
						LoggingPlugin.LogTrace("Applying Morph Swap");
						angelInfo[i] = "Morph@" + angelInfo[i].Substring(angelInfo[i].IndexOf("@") + 1);
						angelInfo[num] = "Creature@" + angelInfo[num].Substring(angelInfo[num].IndexOf("@") + 1);
						string text = BuildFullLink(val.Link, angelInfo);
						CreatureManager.SetLink(val.CreatureId, text);
					}
					break;
				}
			}
			else
			{
				SystemMessage.DisplayInfoText("Selected Asset Has No Morphs", 2.5f, 0f);
			}
		}
		else
		{
			SystemMessage.DisplayInfoText("Cycle Morphs Requires A Selected Mini", 2.5f, 0f);
		}
	}

	public static void Rename(object unused)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		CreatureBoardAsset asset = null;
		CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref asset);
		if ((Object)(object)asset != (Object)null)
		{
			SystemMessage.AskForTextInput("Rename Mini...", "Name:", "OK", (Action<string>)delegate(string newName)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				CreatureManager.SetCreatureName(asset.CreatureId, newName);
			}, (Action)null, "Cancel", (Action)null, asset.Name);
		}
		else
		{
			SystemMessage.DisplayInfoText("No Selected Mini To Rename", 2.5f, 0f);
		}
	}

	public static void Edit(object unused)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		CreatureBoardAsset asset = null;
		CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref asset);
		if ((Object)(object)asset != (Object)null)
		{
			SystemMessage.AskForTextInput("Set Link...", "Link:", "OK", (Action<string>)delegate(string newLink)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				CreatureManager.SetLink(asset.CreatureId, newLink);
			}, (Action)null, "Cancel", (Action)null, asset.Link);
		}
		else
		{
			SystemMessage.DisplayInfoText("No Selected Mini To Rename", 2.5f, 0f);
		}
	}

	public static void Analyze(object unused)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_024f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0256: Expected O, but got Unknown
		//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_06cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0673: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_088f: Unknown result type (might be due to invalid IL or missing references)
		CreatureBoardAsset val = null;
		CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref val);
		List<Tuple<Transform, int>> list = new List<Tuple<Transform, int>>();
		list.Add(new Tuple<Transform, int>(((Component)val).gameObject.transform, 0));
		if (!((Object)(object)val != (Object)null))
		{
			return;
		}
		try
		{
			string[] obj = new string[5] { val.Name, ", Cid: ", null, null, null };
			CreatureGuid creatureId = val.CreatureId;
			obj[2] = ((object)(CreatureGuid)(ref creatureId)).ToString();
			obj[3] = ", Type: ";
			InternedContentAddress activeMorphAddress = val.ActiveMorphAddress;
			obj[4] = ((object)(InternedContentAddress)(ref activeMorphAddress)).ToString();
			LoggingPlugin.LogInfo(string.Concat(obj));
		}
		catch
		{
		}
		try
		{
			LoggingPlugin.LogInfo(val.Name + ", Hide: " + (val.IsExplicitlyHidden ? "Hidden" : "Not Hidden"));
		}
		catch
		{
		}
		try
		{
			LoggingPlugin.LogInfo(val.Name + ", Flying: " + (((MovableBoardAsset)val).IsFlying ? "Flying" : "Not Flying"));
		}
		catch
		{
		}
		try
		{
			LoggingPlugin.LogInfo(val.Name + ", Visible: " + (((MovableBoardAsset)val).IsVisible ? "Visible" : "Not Visible"));
		}
		catch
		{
		}
		ShaderStateRef shaderStateRef;
		ShaderState state;
		try
		{
			string name = val.Name;
			shaderStateRef = val.ShaderStateRef;
			state = ((ShaderStateRef)(ref shaderStateRef)).State;
			LoggingPlugin.LogInfo(name + ", In Hide Volume: " + (((ShaderState)(ref state)).IsCreatureHiddenByVolume ? "In Hide Volume" : "Not In Hide Volume"));
		}
		catch
		{
		}
		try
		{
			string name2 = val.Name;
			shaderStateRef = val.ShaderStateRef;
			state = ((ShaderStateRef)(ref shaderStateRef)).State;
			LoggingPlugin.LogInfo(name2 + ", LOS: " + (((ShaderState)(ref state)).InActiveLineOfSight ? "In LOS" : "Out Of LOS"));
		}
		catch
		{
		}
		try
		{
			GameObject val2 = Utility.FindWithComponentInHierarchy(((Component)val).gameObject, "Animation");
			LoggingPlugin.LogInfo(val.Name + ", Animations? " + ((Object)(object)val2 != (Object)null));
			if ((Object)(object)val2 != (Object)null)
			{
				Animation component = val2.GetComponent<Animation>();
				if ((Object)(object)component != (Object)null)
				{
					int num = 0;
					foreach (AnimationState item in component)
					{
						AnimationState val3 = item;
						try
						{
							string[] obj8 = new string[12]
							{
								"Animation ",
								num.ToString(),
								": ",
								val3.name,
								", Time: ",
								val3.time.ToString(),
								", Length: ",
								val3.length.ToString(),
								", Speed: ",
								val3.speed.ToString(),
								", Mode: ",
								null
							};
							WrapMode wrapMode = val3.wrapMode;
							obj8[11] = ((object)(WrapMode)(ref wrapMode)).ToString();
							LoggingPlugin.LogInfo(string.Concat(obj8));
						}
						catch
						{
						}
						num++;
					}
				}
			}
		}
		catch
		{
		}
		try
		{
			SkinnedMeshRenderer componentInChildren = ((Component)val).gameObject.GetComponentInChildren<SkinnedMeshRenderer>();
			Mesh val4 = (((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.sharedMesh != (Object)null) ? componentInChildren.sharedMesh : null);
			LoggingPlugin.LogInfo(val.Name + ", Blendshapes? " + ((Object)(object)val4 != (Object)null && val4.blendShapeCount > 0));
			if ((Object)(object)val4 != (Object)null && val4.blendShapeCount > 0)
			{
				int num2;
				for (num2 = 0; num2 < val4.blendShapeCount; num2++)
				{
					try
					{
						LoggingPlugin.LogInfo("Blendshape " + num2 + ": " + val4.GetBlendShapeName(num2));
					}
					catch
					{
					}
					num2++;
				}
			}
		}
		catch
		{
		}
		try
		{
			AudioSource[] componentsInChildren = ((Component)val).gameObject.GetComponentsInChildren<AudioSource>();
			LoggingPlugin.LogInfo(val.Name + ", Audio? " + (componentsInChildren != null && componentsInChildren.Length != 0));
			if (componentsInChildren != null && componentsInChildren.Length != 0)
			{
				int num3 = 0;
				AudioSource[] array = componentsInChildren;
				foreach (AudioSource val5 in array)
				{
					try
					{
						LoggingPlugin.LogInfo("Sound " + num3 + ": " + ((Object)val5.clip).name + ", Volume: " + val5.volume + ", Loop: " + val5.loop + ", Time: " + val5.time + ", Length: " + val5.clip.length);
					}
					catch
					{
					}
					num3++;
				}
			}
		}
		catch
		{
		}
		try
		{
			list.Add(new Tuple<Transform, int>(((Component)val).gameObject.transform, 0));
			while (list.Count > 0)
			{
				Tuple<Transform, int> tuple = list.ElementAt(0);
				list.RemoveAt(0);
				LoggingPlugin.LogInfo("[Level " + tuple.Item2 + ": Name = " + ((Object)((Component)tuple.Item1).gameObject).name + "]");
				Component[] components = ((Component)tuple.Item1).gameObject.GetComponents<Component>();
				foreach (Component val6 in components)
				{
					if (((object)val6).GetType() == typeof(CreatureBoardAsset))
					{
						try
						{
							LoggingPlugin.LogInfo("Level " + tuple.Item2 + " Component: Type = " + ((object)val6).GetType().ToString() + ", Name = " + ((CreatureBoardAsset)val6).Name + ", name = " + ((Object)val6).name);
						}
						catch
						{
						}
					}
					else if (((object)val6).GetType() == typeof(MeshRenderer))
					{
						Material[] materials = ((Renderer)(MeshRenderer)val6).materials;
						foreach (Material val7 in materials)
						{
							try
							{
								LoggingPlugin.LogInfo("Level " + tuple.Item2 + " Component: Type = " + ((object)val6).GetType().ToString() + ", Name = " + ((Object)val6).name + ", Material = " + ((Object)val7).name + ", Shader=" + ((Object)val7.shader).name);
							}
							catch
							{
							}
						}
					}
					else if (((object)val6).GetType() == typeof(SkinnedMeshRenderer))
					{
						Material[] materials2 = ((Renderer)(SkinnedMeshRenderer)val6).materials;
						foreach (Material val8 in materials2)
						{
							try
							{
								LoggingPlugin.LogInfo("Level " + tuple.Item2 + " Component: Type = " + ((object)val6).GetType().ToString() + ", Name = " + ((Object)val6).name + ", Material = " + ((Object)val8).name + ", Shader=" + ((Object)val8.shader).name);
							}
							catch
							{
							}
						}
					}
					else if (((object)val6).GetType() == typeof(ParticleSystemRenderer))
					{
						Material[] materials3 = ((Renderer)(SkinnedMeshRenderer)val6).materials;
						foreach (Material val9 in materials3)
						{
							try
							{
								LoggingPlugin.LogInfo("Level " + tuple.Item2 + " Component: Type = " + ((object)val6).GetType().ToString() + ", Name = " + ((Object)val6).name + ", Material = " + ((Object)val9).name + ", Shader=" + ((Object)val9.shader).name);
							}
							catch
							{
							}
						}
					}
					else
					{
						try
						{
							LoggingPlugin.LogInfo("Level " + tuple.Item2 + " Component: Type = " + ((object)val6).GetType().ToString() + ", Name = " + ((Object)val6).name);
						}
						catch
						{
						}
					}
				}
				foreach (Transform item2 in ExtensionMethods.Children(tuple.Item1))
				{
					list.Add(new Tuple<Transform, int>(item2, tuple.Item2 + 1));
				}
			}
		}
		catch
		{
		}
	}

	public static void CancelSpawnTool()
	{
		try
		{
			Type type = Type.GetType("BoardToolManager, Bouncyrock.TaleSpire.Runtime");
			if (type == null)
			{
				LoggingPlugin.LogWarning("BoardToolManager type not found.");
				return;
			}
			Type type2 = typeof(SingletonBehaviour<>).MakeGenericType(type);
			object obj = type2.GetProperty("Instance", BindingFlags.Static | BindingFlags.Public)?.GetValue(null);
			if (obj == null)
			{
				LoggingPlugin.LogWarning("BoardToolManager instance not found.");
				return;
			}
			Type type3 = Type.GetType("CreatureSpawnerBoardTool, Bouncyrock.TaleSpire.Runtime");
			if (type3 == null)
			{
				LoggingPlugin.LogWarning("CreatureSpawnerBoardTool type not found.");
				return;
			}
			Type type4 = Type.GetType("DefaultBoardTool, Bouncyrock.TaleSpire.Runtime");
			if (type4 == null)
			{
				LoggingPlugin.LogWarning("DefaultBoardTool type not found.");
				return;
			}
			object obj2 = type.GetProperty("CurrentTool", BindingFlags.Instance | BindingFlags.Public)?.GetValue(obj);
			if (obj2 != null && obj2.GetType() == type3)
			{
				LoggingPlugin.LogWarning("Current tool is not CreatureSpawnerBoardTool.");
				return;
			}
			MethodInfo methodInfo = type.GetMethods().FirstOrDefault((MethodInfo m) => m.Name == "SwitchToTool" && m.IsGenericMethod);
			if (methodInfo == null)
			{
				LoggingPlugin.LogWarning("SwitchToTool method not found.");
				return;
			}
			MethodInfo methodInfo2 = methodInfo.MakeGenericMethod(type4);
			object[] parameters = new object[1] { Enum.Parse(Type.GetType("BoardToolManager+Type, Bouncyrock.TaleSpire.Runtime"), "Normal") };
			methodInfo2.Invoke(obj, parameters);
		}
		catch (Exception ex)
		{
			LoggingPlugin.LogWarning("Exception calling SwitchToTool: " + ex.Message);
		}
	}

	public static bool IsAngelAsset(string fullLink)
	{
		if (fullLink.IndexOf("?ANGEL=") > -1)
		{
			return true;
		}
		if (fullLink.IndexOf("&ANGEL=") > -1)
		{
			return true;
		}
		return false;
	}

	public static string GetLink(string fullLink)
	{
		if (fullLink.IndexOf("?ANGEL=") > -1)
		{
			return fullLink.Substring(0, fullLink.IndexOf("?ANGEL="));
		}
		if (fullLink.IndexOf("&ANGEL=") > -1)
		{
			return fullLink.Substring(0, fullLink.IndexOf("&ANGEL="));
		}
		return fullLink;
	}

	public static List<string> GetAngelInfo(string fullLink)
	{
		fullLink = ((fullLink != null) ? fullLink : "");
		if (fullLink.IndexOf("?ANGEL=") > -1)
		{
			return fullLink.Substring(fullLink.IndexOf("?ANGEL=") + "?ANGEL=".Length).Split(new char[1] { ';' }).ToList();
		}
		if (fullLink.IndexOf("&ANGEL=") > -1)
		{
			return fullLink.Substring(fullLink.IndexOf("&ANGEL=") + "&ANGEL=".Length).Split(new char[1] { ';' }).ToList();
		}
		return new List<string>();
	}

	public static string AddAngelInfo(string fullLink, string newInfo)
	{
		List<string> angelInfo = GetAngelInfo(fullLink);
		angelInfo.Add(newInfo);
		return BuildFullLink(fullLink, angelInfo);
	}

	public static string RemoveAngelInfo(string fullLink, string removeInfo)
	{
		List<string> angelInfo = GetAngelInfo(fullLink);
		angelInfo.Remove(removeInfo);
		return BuildFullLink(fullLink, angelInfo);
	}

	public static string BuildFullLink(string fullLink, List<string> info)
	{
		string link = GetLink(fullLink);
		if (info.Count > 0)
		{
			string text = "ANGEL=" + string.Join(";", info);
			return link.Contains("?") ? (fullLink + "&" + text) : (link + "?" + text);
		}
		return link;
	}

	public static bool IsAssetAnAngelFilter(string input)
	{
		if (string.IsNullOrEmpty(input))
		{
			return false;
		}
		string pattern = "^[{(]?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}[)}]?\\..+$";
		return Regex.IsMatch(input, pattern);
	}

	public static AssetInfo GetAssetInfo(string fullLink)
	{
		LoggingPlugin.LogTrace("Link='" + fullLink + "'");
		List<string> angelInfo = GetAngelInfo(fullLink);
		LoggingPlugin.LogTrace("Angel Info='" + string.Join(";", angelInfo) + "'");
		string corePrefab = "";
		string text = "";
		LoggingPlugin.LogTrace("Seeking Prefab...");
		foreach (string item in angelInfo)
		{
			LoggingPlugin.LogTrace("Found '" + item + "'");
			if (!item.ToUpper().StartsWith("TYPE") && !item.ToUpper().StartsWith("MORPH") && !item.ToUpper().StartsWith("AURA"))
			{
				corePrefab = item.Substring(item.IndexOf("@") + 1);
				LoggingPlugin.LogTrace("Prefab='" + corePrefab + "'");
				break;
			}
			if (item.ToUpper().StartsWith("AURA"))
			{
				text = item.Substring(item.IndexOf("@") + 1);
				LoggingPlugin.LogTrace("Fallback Prefab='" + text + "'");
			}
		}
		if (corePrefab == "" && text != "")
		{
			LoggingPlugin.LogTrace("No Core Prefab But Found Fallback Prefab. This Looks Like An Aura On A Core Mini.");
			corePrefab = text;
		}
		AssetInfo[] array = (from item in CommonCustomsMenuPlugin.GetAssets()
			where item.prefab == corePrefab
			select item).ToArray();
		if (array.Length != 0)
		{
			LoggingPlugin.LogTrace("Prefab Info='" + JsonConvert.SerializeObject((object)array[0]) + "'");
			return array[0];
		}
		LoggingPlugin.LogWarning("Prefab='" + corePrefab + "', Prefab Info='Null'");
		return null;
	}

	public void Initialize()
	{
		//IL_002c: 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_007d: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: 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_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		//IL_021d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Unknown result type (might be due to invalid IL or missing references)
		//IL_026e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0305: Unknown result type (might be due to invalid IL or missing references)
		//IL_0310: Unknown result type (might be due to invalid IL or missing references)
		//IL_0356: Unknown result type (might be due to invalid IL or missing references)
		//IL_0361: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0403: Unknown result type (might be due to invalid IL or missing references)
		//IL_0449: Unknown result type (might be due to invalid IL or missing references)
		//IL_0454: Unknown result type (might be due to invalid IL or missing references)
		//IL_049a: 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_04eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_053c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0547: Unknown result type (might be due to invalid IL or missing references)
		//IL_058d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0598: Unknown result type (might be due to invalid IL or missing references)
		//IL_05de: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_062f: Unknown result type (might be due to invalid IL or missing references)
		//IL_063a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0680: Unknown result type (might be due to invalid IL or missing references)
		//IL_068b: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_06dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0722: Unknown result type (might be due to invalid IL or missing references)
		//IL_072d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0773: Unknown result type (might be due to invalid IL or missing references)
		//IL_077e: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0815: Unknown result type (might be due to invalid IL or missing references)
		//IL_0820: Unknown result type (might be due to invalid IL or missing references)
		//IL_0866: Unknown result type (might be due to invalid IL or missing references)
		//IL_0871: Unknown result type (might be due to invalid IL or missing references)
		//IL_08b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_08c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0908: Unknown result type (might be due to invalid IL or missing references)
		//IL_0913: Unknown result type (might be due to invalid IL or missing references)
		//IL_0959: Unknown result type (might be due to invalid IL or missing references)
		//IL_0964: Unknown result type (might be due to invalid IL or missing references)
		//IL_09aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_09b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_09fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a06: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a4c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a57: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a98: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aa3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ae4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b8d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b92: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bc3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bd9: Unknown result type (might be due to invalid IL or missing references)
		bindings.Add("Animation01", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Animation 01", new KeyboardShortcut((KeyCode)49, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), (ConfigDescription)null).Value, "RequestAnimation", 1));
		bindings.Add("Animation02", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Animation 02", new KeyboardShortcut((KeyCode)50, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), (ConfigDescription)null).Value, "RequestAnimation", 2));
		bindings.Add("Animation03", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Animation 03", new KeyboardShortcut((KeyCode)51, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), (ConfigDescription)null).Value, "RequestAnimation", 3));
		bindings.Add("Animation04", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Animation 04", new KeyboardShortcut((KeyCode)52, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), (ConfigDescription)null).Value, "RequestAnimation", 4));
		bindings.Add("Animation05", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Animation 05", new KeyboardShortcut((KeyCode)53, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), (ConfigDescription)null).Value, "RequestAnimation", 5));
		bindings.Add("Animation06", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Animation 06", new KeyboardShortcut((KeyCode)54, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), (ConfigDescription)null).Value, "RequestAnimation", 6));
		bindings.Add("Animation07", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Animation 07", new KeyboardShortcut((KeyCode)55, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), (ConfigDescription)null).Value, "RequestAnimation", 7));
		bindings.Add("AnimationByName", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Animation From Prompt", new KeyboardShortcut((KeyCode)56, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), (ConfigDescription)null).Value, "RequestAnimation", 8));
		bindings.Add("AnimationStop", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Animation Stop", new KeyboardShortcut((KeyCode)57, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), (ConfigDescription)null).Value, "RequestAnimation", 0));
		bindings.Add("Audio01", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Audio 01", new KeyboardShortcut((KeyCode)49, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), (ConfigDescription)null).Value, "RequestAudio", 1));
		bindings.Add("Audio02", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Audio 02", new KeyboardShortcut((KeyCode)50, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), (ConfigDescription)null).Value, "RequestAudio", 2));
		bindings.Add("Audio03", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Audio 03", new KeyboardShortcut((KeyCode)51, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), (ConfigDescription)null).Value, "RequestAudio", 3));
		bindings.Add("Audio04", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Audio 04", new KeyboardShortcut((KeyCode)52, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), (ConfigDescription)null).Value, "RequestAudio", 4));
		bindings.Add("Audio05", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Audio 05", new KeyboardShortcut((KeyCode)53, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), (ConfigDescription)null).Value, "RequestAudio", 5));
		bindings.Add("Audio06", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Audio 06", new KeyboardShortcut((KeyCode)54, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), (ConfigDescription)null).Value, "RequestAudio", 6));
		bindings.Add("Audio07", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Audio 07", new KeyboardShortcut((KeyCode)55, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), (ConfigDescription)null).Value, "RequestAudio", 7));
		bindings.Add("AudioByName", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Audio From Prompt", new KeyboardShortcut((KeyCode)56, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), (ConfigDescription)null).Value, "RequestAudio", 8));
		bindings.Add("AudioStop", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Audio Stop", new KeyboardShortcut((KeyCode)57, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), (ConfigDescription)null).Value, "RequestAudio", 0));
		bindings.Add("Sequence01", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Sequence 01", new KeyboardShortcut((KeyCode)49, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), (ConfigDescription)null).Value, "RequestSequence", 1));
		bindings.Add("Sequence02", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Sequence 02", new KeyboardShortcut((KeyCode)50, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), (ConfigDescription)null).Value, "RequestSequence", 2));
		bindings.Add("Sequence03", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Sequence 03", new KeyboardShortcut((KeyCode)51, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), (ConfigDescription)null).Value, "RequestSequence", 3));
		bindings.Add("Sequence04", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Sequence 04", new KeyboardShortcut((KeyCode)52, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), (ConfigDescription)null).Value, "RequestSequence", 4));
		bindings.Add("Sequence05", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Sequence 05", new KeyboardShortcut((KeyCode)53, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), (ConfigDescription)null).Value, "RequestSequence", 5));
		bindings.Add("Sequence06", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Sequence 06", new KeyboardShortcut((KeyCode)54, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), (ConfigDescription)null).Value, "RequestSequence", 6));
		bindings.Add("Sequence07", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Sequence 07", new KeyboardShortcut((KeyCode)55, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), (ConfigDescription)null).Value, "RequestSequence", 7));
		bindings.Add("SequenceByName", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Sequence From Prompt", new KeyboardShortcut((KeyCode)56, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), (ConfigDescription)null).Value, "RequestSequence", 8));
		bindings.Add("SequenceStop", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Trigger Sequence Stop", new KeyboardShortcut((KeyCode)57, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), (ConfigDescription)null).Value, "RequestSequence", 0));
		bindings.Add("AllStop01", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "All Stop Animation Trigger", new KeyboardShortcut((KeyCode)48, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), (ConfigDescription)null).Value, "RequestAnimation", 0));
		bindings.Add("AllStop02", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "All Stop Audio Trigger", new KeyboardShortcut((KeyCode)48, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), (ConfigDescription)null).Value, "RequestAudio", 0));
		bindings.Add("AllStop03", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "All Stop Sequence Trigger", new KeyboardShortcut((KeyCode)48, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), (ConfigDescription)null).Value, "RequestSequence", 0));
		bindings.Add("AddMorph", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Add Morph Trigger", new KeyboardShortcut((KeyCode)56, (KeyCode[])(object)new KeyCode[1] { (KeyCode)305 }), (ConfigDescription)null).Value, "AddMorphs", 0));
		bindings.Add("CycleMorphs", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Cycle Morphs Trigger", new KeyboardShortcut((KeyCode)57, (KeyCode[])(object)new KeyCode[1] { (KeyCode)305 }), (ConfigDescription)null).Value, "CycleMorphs", 0));
		bindings.Add("Analyze", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Analyze Selected Trigger", new KeyboardShortcut((KeyCode)49, (KeyCode[])(object)new KeyCode[1] { (KeyCode)305 }), (ConfigDescription)null).Value, "Analyze", null));
		bindings.Add("Rename", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Rename Selected Trigger", new KeyboardShortcut((KeyCode)50, (KeyCode[])(object)new KeyCode[1] { (KeyCode)305 }), (ConfigDescription)null).Value, "Rename", null));
		bindings.Add("EditLink", new KeyboardBinding(((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "Edit Selected Link Trigger", new KeyboardShortcut((KeyCode)51, (KeyCode[])(object)new KeyCode[1] { (KeyCode)305 }), (ConfigDescription)null).Value, "Edit", null));
		string text = CommonCustomsMenuPlugin.RegisterProviderV2("ANGEL", "Custom minis, auras, effects, mini based props, and filters", Application.version.ToString(), (Func<ReadOnlyDictionary<string, AssetInfo>, Func<Dictionary<string, AssetInfo>, IEnumerator>, IEnumerator>)Provider.GetAngelAssets, (Action<AssetInfo>)delegate(AssetInfo selectedAsset)
		{
			SpawnRequest(selectedAsset);
		});
		string[] array = text.Split(new char[1] { ',' });
		registrationMessagePos = new Rect((float)int.Parse(array[0]), (float)int.Parse(array[1]), (float)(Screen.width - int.Parse(array[0])), (float)(Screen.height - int.Parse(array[1])));
		registrationMessageStyle.fontSize = int.Parse(array[2]);
		registrationMessageStyle.fontStyle = (FontStyle)1;
		registrationMessageStyle.active.textColor = Color.white;
		registrationMessageStyle.normal.textColor = Color.white;
		SafeCalls.Invoke("LordAshes.AssetDataPlugin, AssetDataPlugin", "SubscribeViaReflection", new object[3]
		{
			"org.lordashes.plugins.angel.ccm.animate",
			((object)_self).GetType().AssemblyQualifiedName,
			"RemoteRequestAnimation"
		}, (object)null);
		SafeCalls.Invoke("LordAshes.AssetDataPlugin, AssetDataPlugin", "SubscribeViaReflection", new object[3]
		{
			"org.lordashes.plugins.angel.ccm.audio",
			((object)_self).GetType().AssemblyQualifiedName,
			"RemoteRequestAudio"
		}, (object)null);
		SafeCalls.Invoke("LordAshes.AssetDataPlugin, AssetDataPlugin", "SubscribeViaReflection", new object[3]
		{
			"org.lordashes.plugins.angel.ccm.sequence",
			((object)_self).GetType().AssemblyQualifiedName,
			"RemoteRequestSequence"
		}, (object)null);
	}

	private void Update()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0180: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		if (!boardLoaded && Utility.isBoardLoaded() && BoardSessionManager.CurrentBoardInfo.Id != BoardGuid.Empty)
		{
			boardLoaded = true;
			LoggingPlugin.LogTrace("Campaign/Board Loaded");
		}
		else if (boardLoaded && (!Utility.isBoardLoaded() || BoardSessionManager.CurrentBoardInfo.Id == BoardGuid.Empty))
		{
			boardLoaded = false;
			LoggingPlugin.LogTrace("Campaign/Board Unloaded");
			if ((Object)(object)Camera.main != (Object)null)
			{
				LoggingPlugin.LogTrace("Checking Camera Children (" + ((Component)Camera.main).transform.childCount + ")...");
				foreach (Transform item in ExtensionMethods.Children(((Component)Camera.main).transform))
				{
					if (IsAssetAnAngelFilter(((Object)item).name))
					{
						LoggingPlugin.LogTrace("Destroying Filter " + ((Object)item).name);
						Object.DestroyImmediate((Object)(object)((Component)item).gameObject);
					}
				}
			}
			else
			{
				LoggingPlugin.LogWarning("Main Camera Is Null");
			}
		}
		foreach (KeyValuePair<string, KeyboardBinding> action in bindings)
		{
			KeyboardShortcut binding = action.Value.binding;
			if (((KeyboardShortcut)(ref binding)).IsUp())
			{
				LoggingPlugin.LogDebug("Keyboard Selection: " + action.Key);
				MethodInfo methodInfo = (from mi in typeof(AssetNavigationGenerationExecutionLibraryPlugin).GetRuntimeMethods()
					where mi.Name == action.Value.handler
					select mi).First();
				if (methodInfo != null)
				{
					methodInfo.Invoke(null, new object[1] { action.Value.parameter });
				}
			}
		}
	}

	private void OnGUI()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		if (notification != null)
		{
			GUI.Label(registrationMessagePos, notification, registrationMessageStyle);
		}
	}

	public static void RemoveCustomContents(CreatureGuid cid)
	{
		string creatureIdPrefix = ((object)(CreatureGuid)(ref cid)).ToString() + ".";
		LoggingPlugin.LogTrace("Creature " + ((object)(CreatureGuid)(ref cid)).ToString() + "): Removing Customs Starting With " + ((object)(CreatureGuid)(ref cid)).ToString());
		foreach (GameObject item in from obj in Object.FindObjectsOfType<GameObject>()
			where ((Object)obj).name.StartsWith(creatureIdPrefix)
			select obj)
		{
			LoggingPlugin.LogTrace("Creature " + ((object)(CreatureGuid)(ref cid)).ToString() + "): Removing Existing Custom " + ((Object)item).name);
			Object.DestroyImmediate((Object)(object)item);
		}
	}

	public static void ApplyCustomContents(CreatureBoardAsset asset, string fullLink)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: 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_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: 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_0281: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_0256: Unknown result type (might be due to invalid IL or missing references)
		//IL_0360: Unknown result type (might be due to invalid IL or missing references)
		//IL_0365: Unknown result type (might be due to invalid IL or missing references)
		//IL_0424: Unknown result type (might be due to invalid IL or missing references)
		//IL_0429: Unknown result type (might be due to invalid IL or missing references)
		//IL_045a: Unknown result type (might be due to invalid IL or missing references)
		//IL_045f: Unknown result type (might be due to invalid IL or missing references)
		string name = asset.Name;
		CreatureGuid creatureId = asset.CreatureId;
		LoggingPlugin.LogTrace(name + " (" + ((object)(CreatureGuid)(ref creatureId)).ToString() + "): Checking For Chain Spawns");
		AssetInfo assetInfo = GetAssetInfo(fullLink);
		asset.DropAtCurrentLocation();
		if (asset.Name == "BlankBase")
		{
			string[] obj = new string[5] { asset.Name, " (", null, null, null };
			creatureId = asset.CreatureId;
			obj[2] = ((object)(CreatureGuid)(ref creatureId)).ToString();
			obj[3] = "): Setting Default Name Of ";
			obj[4] = assetInfo.name;
			LoggingPlugin.LogTrace(string.Concat(obj));
			CreatureManager.SetCreatureName(asset.CreatureId, assetInfo.name);
		}
		if (assetInfo.chain != null && assetInfo.chain.Length != 0)
		{
			string name2 = asset.Name;
			creatureId = asset.CreatureId;
			LoggingPlugin.LogTrace(name2 + " (" + ((object)(CreatureGuid)(ref creatureId)).ToString() + "): Processing Chain Spawns");
			Vector3 val2 = default(Vector3);
			for (int i = 0; i < assetInfo.chain.Length; i++)
			{
				AssetInfo val = assetInfo.Clone();
				val.prefab = assetInfo.chain[i].prefab;
				val.chain = null;
				((Vector3)(ref val2))..ctor(((Component)asset).transform.position.x + assetInfo.chain[i].offsetPosX, ((Component)asset).transform.position.y + assetInfo.chain[i].offsetPosY, ((Component)asset).transform.position.z + assetInfo.chain[i].offsetPosZ);
				if (i != 0)
				{
					val2.x += assetInfo.chain[0].offsetPosX;
					val2.y += assetInfo.chain[0].offsetPosY;
					val2.z += assetInfo.chain[0].offsetPosZ;
				}
				string[] obj2 = new string[8] { asset.Name, " (", null, null, null, null, null, null };
				creatureId = asset.CreatureId;
				obj2[2] = ((object)(CreatureGuid)(ref creatureId)).ToString();
				obj2[3] = "): Chain Spawn (Prefab='";
				obj2[4] = val.prefab;
				obj2[5] = "' At '";
				Vector3 val3 = val2;
				obj2[6] = ((object)(Vector3)(ref val3)).ToString();
				obj2[7] = "')";
				LoggingPlugin.LogTrace(string.Concat(obj2));
				SpawnProcess(val, val2);
			}
			CreatureManager.DeleteCreature(asset.CreatureId, asset.UniqueId, true);
			return;
		}
		string[] obj3 = new string[6] { asset.Name, " (", null, null, null, null };
		creatureId = asset.CreatureId;
		obj3[2] = ((object)(CreatureGuid)(ref creatureId)).ToString();
		obj3[3] = "): No Chain Spawns (";
		obj3[4] = ((assetInfo.chain == null) ? "Null" : "Empty");
		obj3[5] = ")";
		LoggingPlugin.LogTrace(string.Concat(obj3));
		List<string> angelInfo = GetAngelInfo(fullLink);
		foreach (string item in angelInfo)
		{
			string text = item.Split(new char[1] { '@' })[0].ToUpper();
			string text2 = item.Split(new char[1] { '@' })[1];
			string[] obj4 = new string[7] { asset.Name, " (", null, null, null, null, null };
			creatureId = asset.CreatureId;
			obj4[2] = ((object)(CreatureGuid)(ref creatureId)).ToString();
			obj4[3] = "): Applying Custom ";
			obj4[4] = text2;
			obj4[5] = " As ";
			obj4[6] = text;
			LoggingPlugin.LogTrace(string.Concat(obj4));
			string text3 = text;
			string text4 = text3;
			if (!(text4 == "TYPE") && !(text4 == "MORPH"))
			{
				Object targetAsset = (Object)(object)asset;
				string text5 = text2;
				if (text == "FILTER")
				{
					targetAsset = (Object)(object)Camera.main;
				}
				ApplyCustomContent(asset, targetAsset, text2);
				if (text == "EFFECT" || text == "FILTER")
				{
					string name3 = asset.Name;
					creatureId = asset.CreatureId;
					LoggingPlugin.LogTrace(name3 + " (" + ((object)(CreatureGuid)(ref creatureId)).ToString() + "): Hiding Base");
					object[] array = new object[4];
					creatureId = asset.CreatureId;
					array[0] = ((object)(CreatureGuid)(ref creatureId)).ToString();
					array[1] = "org.lordashes.plugins.hidebase";
					array[2] = false;
					array[3] = false;
					SafeCalls.Invoke("LordAshes.AssetDataPlugin, AssetDataPlugin", "SetInfo", array, (object)null);
				}
			}
		}
	}

	public static void ApplyCustomContent(CreatureBoardAsset sourceAsset, Object targetAsset, string prefabName)
	{
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: 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_02d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_09af: Unknown result type (might be due to invalid IL or missing references)
		//IL_09b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0be9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a26: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a2b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b97: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b9c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c83: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c88: 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)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ac5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aca: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b2e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b33: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c6: 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_0418: Unknown result type (might be due to invalid IL or missing references)
		//IL_041d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0442: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fc: 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)
		//IL_047a: Unknown result type (might be due to invalid IL or missing references)
		//IL_093a: Unknown result type (might be due to invalid IL or missing references)
		//IL_093f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05da: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0775: Unknown result type (might be due to invalid IL or missing references)
		//IL_077a: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_07fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0839: Unknown result type (might be due to invalid IL or missing references)
		//IL_084d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0852: Unknown result type (might be due to invalid IL or missing references)
		//IL_0873: Unknown result type (might be due to invalid IL or missing references)
		//IL_0899: Unknown result type (might be due to invalid IL or missing references)
		//IL_089e: Unknown result type (might be due to invalid IL or missing references)
		//IL_08cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_08d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0585: Unknown result type (might be due to invalid IL or missing references)
		//IL_058a: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		CreatureGuid creatureId;
		try
		{
			LoggingPlugin.LogDebug("ApplyCustomContent: Applying Custom Content");
			string[] obj = new string[6]
			{
				"ApplyCustomContent: Applying ",
				prefabName,
				" To ",
				((Object)(object)sourceAsset == (Object)null) ? "No One" : sourceAsset.Name,
				" ",
				null
			};
			object obj2;
			if (!((Object)(object)sourceAsset != (Object)null))
			{
				obj2 = "";
			}
			else
			{
				creatureId = sourceAsset.CreatureId;
				obj2 = "(" + ((object)(CreatureGuid)(ref creatureId)).ToString() + ")";
			}
			obj[5] = (string)obj2;
			LoggingPlugin.LogTrace(string.Concat(obj));
			AssetInfo val = null;
			try
			{
				val = (from entry in CommonCustomsMenuPlugin.GetAssets()
					where entry.prefab == prefabName
					select entry).ElementAt(0);
			}
			catch
			{
				string[] obj3 = new string[7] { "ApplyCustomContent: Unable To Get Asset Info For Prefab ", prefabName, " For ", sourceAsset.Name, " (", null, null };
				creatureId = sourceAsset.CreatureId;
				obj3[5] = ((object)(CreatureGuid)(ref creatureId)).ToString();
				obj3[6] = ")";
				LoggingPlugin.LogWarning(string.Concat(obj3));
				return;
			}
			LoggingPlugin.LogTrace("Asset:\r\n" + JsonConvert.SerializeObject((object)val));
			try
			{
				if (val != null && val.provider == "ANGEL")
				{
					string[] obj5 = new string[7] { "ApplyCustomContent: Loading Asset Bundle '", val.filename, " For ", sourceAsset.Name, " (", null, null };
					creatureId = sourceAsset.CreatureId;
					obj5[5] = ((object)(CreatureGuid)(ref creatureId)).ToString();
					obj5[6] = ")";
					LoggingPlugin.LogTrace(string.Concat(obj5));
					AssetBundle val2 = AssetBundle.LoadFromFile(val.filename);
					string[] obj6 = new string[7] { "ApplyCustomContent: Loading Prefab '", val.prefab, "' For ", sourceAsset.Name, " (", null, null };
					creatureId = sourceAsset.CreatureId;
					obj6[5] = ((object)(CreatureGuid)(ref creatureId)).ToString();
					obj6[6] = ")";
					LoggingPlugin.LogTrace(string.Concat(obj6));
					GameObject val3 = null;
					try
					{
						val3 = val2.LoadAsset<GameObject>(val.prefab);
						if ((Object)(object)val3 == (Object)null)
						{
							string[] obj7 = new string[7] { "ApplyCustomContent: Unable To Find Prefab '", val.prefab, "' For ", sourceAsset.Name, " (", null, null };
							creatureId = sourceAsset.CreatureId;
							obj7[5] = ((object)(CreatureGuid)(ref creatureId)).ToString();
							obj7[6] = ")";
							throw new Exception(string.Concat(obj7));
						}
					}
					catch
					{
						string[] obj8 = new string[7] { "ApplyCustomContent: Prefab '", val.prefab, "' Not Found For ", sourceAsset.Name, " (", null, null };
						creatureId = sourceAsset.CreatureId;
						obj8[5] = ((object)(CreatureGuid)(ref creatureId)).ToString();
						obj8[6] = "). Available Options Are...";
						LoggingPlugin.LogTrace(string.Concat(obj8));
						foreach (string item in from e in val2.GetAllAssetNames()
							where e.ToUpper().EndsWith(".PREFAB")
							select e)
						{
							LoggingPlugin.LogTrace("ApplyCustomContent: Option: Prefab '" + item + "'");
						}
						val3 = val2.LoadAsset<GameObject>((from e in val2.GetAllAssetNames()
							where e.ToUpper().EndsWith(".PREFAB")
							select e).ElementAt(0));
					}
					string[] obj10 = new string[5] { "ApplyCustomContent: Creating Prefab Instance For ", sourceAsset.Name, " (", null, null };
					creatureId = sourceAsset.CreatureId;
					obj10[3] = ((object)(CreatureGuid)(ref creatureId)).ToString();
					obj10[4] = ")";
					LoggingPlugin.LogTrace(string.Concat(obj10));
					GameObject val4 = Object.Instantiate<GameObject>(val3);
					Transform val5 = null;
					if (((object)targetAsset).GetType() == typeof(CreatureBoardAsset))
					{
						creatureId = ((CreatureBoardAsset)targetAsset).CreatureId;
						((Object)val4).name = ((object)(CreatureGuid)(ref creatureId)).ToString() + "." + prefabName;
						val5 = ((Component)((MovableBoardAsset)(CreatureBoardAsset)targetAsset).Rotator).transform;
					}
					else if (((object)targetAsset).GetType() == typeof(Camera))
					{
						creatureId = sourceAsset.CreatureId;
						((Object)val4).name = ((object)(CreatureGuid)(ref creatureId)).ToString() + "." + prefabName;
						val5 = ((Component)Camera.main).transform;
					}
					string[] obj11 = new string[9]
					{
						"ApplyCustomContent: Parenting Instance ",
						((Object)val4).name,
						" To ",
						((Object)((Component)val5).gameObject).name,
						" For ",
						sourceAsset.Name,
						" (",
						null,
						null
					};
					creatureId = sourceAsset.CreatureId;
					obj11[7] = ((object)(CreatureGuid)(ref creatureId)).ToString();
					obj11[8] = ")";
					LoggingPlugin.LogTrace(string.Concat(obj11));
					if (val.kind.ToUpper() == "CREATURE" && (Object)(object)sourceAsset != (Object)null)
					{
						string[] obj12 = new string[7]
						{
							"ApplyCustomContent: Applying Creature Scale Of ",
							((MovableBoardAsset)sourceAsset).Scale.ToString(),
							"x For ",
							sourceAsset.Name,
							" (",
							null,
							null
						};
						creatureId = sourceAsset.CreatureId;
						obj12[5] = ((object)(CreatureGuid)(ref creatureId)).ToString();
						obj12[6] = ")";
						LoggingPlugin.LogTrace(string.Concat(obj12));
						val4.transform.localScale = new Vector3(((MovableBoardAsset)sourceAsset).Scale, ((MovableBoardAsset)sourceAsset).Scale, ((MovableBoardAsset)sourceAsset).Scale);
					}
					val4.transform.position = val5.position;
					val4.transform.rotation = val5.rotation;
					val4.transform.SetParent(((Component)val5).transform);
					string[] obj13 = new string[25]
					{
						"ApplyCustomContent: Applying Adjustument t:",
						val.adjust.tX.ToString(),
						",",
						val.adjust.tY.ToString(),
						",",
						val.adjust.tZ.ToString(),
						" | r:",
						val.adjust.rW.ToString(),
						",",
						val.adjust.rX.ToString(),
						",",
						val.adjust.rY.ToString(),
						", ",
						val.adjust.rZ.ToString(),
						" | s:",
						val.adjust.sX.ToString(),
						",",
						val.adjust.sY.ToString(),
						",",
						val.adjust.sZ.ToString(),
						" For ",
						sourceAsset.Name,
						"(",
						null,
						null
					};
					creatureId = sourceAsset.CreatureId;
					obj13[23] = ((object)(CreatureGuid)(ref creatureId)).ToString();
					obj13[24] = ")";
					LoggingPlugin.LogTrace(string.Concat(obj13));
					val4.transform.localScale = new Vector3(val4.transform.localScale.x * val.adjust.sX, val4.transform.localScale.y * val.adjust.sY, val4.transform.localScale.z * val.adjust.sZ);
					val4.transform.localRotation = new Quaternion(val.adjust.rW, val.adjust.rX, val.adjust.rY, val.adjust.rZ) * Quaternion.Euler(180f, 90f, 270f);
					val4.transform.localPosition = new Vector3(0f, 0f, -1.25f) + new Vector3(val.adjust.tX, val.adjust.tY, val.adjust.tZ);
					string[] obj14 = new string[5] { "ApplyCustomContent: Unload AssetBundle For ", sourceAsset.Name, " (", null, null };
					creatureId = sourceAsset.CreatureId;
					obj14[3] = ((object)(CreatureGuid)(ref creatureId)).ToString();
					obj14[4] = ")";
					LoggingPlugin.LogTrace(string.Concat(obj14));
					Object.Destroy((Object)(object)val3);
					val2.Unload(false);
				}
				else
				{
					string[] obj15 = new string[7] { "ApplyCustomContent: Unable To Obtain AssetInfo For Prefab '", prefabName, "' For ", sourceAsset.Name, " (", null, null };
					creatureId = sourceAsset.CreatureId;
					obj15[5] = ((object)(CreatureGuid)(ref creatureId)).ToString();
					obj15[6] = ")";
					LoggingPlugin.LogWarning(string.Concat(obj15));
				}
			}
			catch
			{
				string[] obj16 = new string[9] { "ApplyCustomContent: Missing Custom Content Pack (Pack: ", val.pack, ", Prefab: ", val.prefab, ") For ", sourceAsset.Name, " (", null, null };
				creatureId = sourceAsset.CreatureId;
				obj16[7] = ((object)(CreatureGuid)(ref creatureId)).ToString();
				obj16[8] = ")";
				LoggingPlugin.LogWarning(string.Concat(obj16));
				SystemMessage.DisplayInfoText("Missing Content:\r\nPack: " + val.pack + "\r\nPrefab: " + val.prefab, 10f, 0f);
			}
			string[] obj18 = new string[5] { "ApplyCustomContent: Trigger OnLoad Callbacks For ", sourceAsset.Name, " (", null, null };
			creatureId = sourceAsset.CreatureId;
			obj18[3] = ((object)(CreatureGuid)(ref creatureId)).ToString();
			obj18[4] = ")";
			LoggingPlugin.LogTrace(string.Concat(obj18));
			if (_subscriptionsAssetAdd != null)
			{
				foreach (Action<CreatureBoardAsset> item2 in _subscriptionsAssetAdd)
				{
					if ((Object)(object)sourceAsset != (Object)null)
					{
						string[] obj19 = new string[7]