Decompiled source of CustomAssetsLibraryPluginIntegratedExtension v2.5.0

CustomAssetsLibraryPluginIntegratedExtension.dll

Decompiled 11 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Cryptography;
using System.Text;
using System.Windows.Forms;
using BepInEx;
using BepInEx.Configuration;
using Bounce.Mathematics;
using Bounce.Singletons;
using Bounce.Unmanaged;
using DataModel;
using HarmonyLib;
using Newtonsoft.Json;
using RadialUI;
using TMPro;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.SceneManagement;

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

[BepInPlugin("org.lordashes.plugins.customassetslibraryintegratedextension", "Custom Assets Library Plugin Integrated Extension", "2.5.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class CustomAssetsLibraryPluginIntegratedExtention : BaseUnityPlugin
{
	public static class Data
	{
		public class SlabInfo
		{
			public float3 position { get; set; }

			public string code { get; set; } = "";

		}

		public class Locations
		{
			public readonly string root = "0.0,0.0,0.0,0.0,0.0,0.0";

			public string head { get; set; } = "0.0,0.7,0.0,0.0,0.0,0.0";


			public string hit { get; set; } = "0.0,0.5,0.0,0.0,0.0,0.0";


			public string spell { get; set; } = "0.0,0.5,0.0,0.0,0.0,0.0";


			public string torch { get; set; } = "0.0,0.5,0.0,0.0,0.0,0.0";


			public string handRight { get; set; } = "0.3,1.25,0.0,0.0,0.0,0.0";


			public string handLeft { get; set; } = "-0.3,1.25,0.0,0.0,0.0,0.0";

		}

		public class Collider
		{
			public string center { get; set; } = "0.5,0.5,0.5";


			public string extent { get; set; } = "0.5,0.5,0.5";

		}

		public class MeshAdjustments
		{
			public string size { get; set; } = "1.0,1.0,1.0";


			public string rotationOffset { get; set; } = "0.0,0.0,0.0";


			public string positionOffset { get; set; } = "0.0,0.0,0.0";

		}

		public class LinkRequest
		{
			public string key { get; set; } = "";


			public string value { get; set; } = "";


			public bool legacy { get; set; } = true;

		}

		public class AssetInfo
		{
			public string id { get; set; } = "";


			public string name { get; set; } = "";


			public string prefab { get; set; } = "";


			public string kind { get; set; } = "";


			public string category { get; set; } = "";


			public string groupName { get; set; } = "";


			public string description { get; set; } = "";


			public string tags { get; set; } = "";


			public string author { get; set; } = "Anonymous";


			public string version { get; set; } = "Unversioned";


			public string comment { get; set; } = "";


			public string[] variants { get; set; } = null;


			public string chainLoad { get; set; } = null;


			public string anchor { get; set; } = "root";


			public float timeToLive { get; set; } = 0f;


			public float size { get; set; } = 1f;


			public string code { get; set; } = "";


			public string location { get; set; } = "";


			public string assetBase { get; set; } = "DEFAULT";


			public MeshAdjustments mesh { get; set; } = new MeshAdjustments();


			public Collider collider { get; set; } = new Collider();


			public Locations locations { get; set; } = new Locations();


			public LinkRequest[] linkRequests { get; set; } = new LinkRequest[0];


			public bool isDeprecated { get; set; } = false;


			public AssetInfo Clone()
			{
				return new AssetInfo
				{
					id = id,
					name = name,
					prefab = prefab,
					kind = kind,
					category = category,
					groupName = groupName,
					description = description,
					tags = tags,
					variants = variants,
					chainLoad = chainLoad,
					anchor = anchor,
					author = author,
					version = version,
					comment = comment,
					timeToLive = timeToLive,
					size = size,
					code = code,
					location = location,
					assetBase = assetBase,
					mesh = mesh,
					collider = collider,
					locations = locations,
					linkRequests = linkRequests,
					isDeprecated = isDeprecated
				};
			}
		}

		public class LoaderDataType
		{
			public string BundleId { get; set; } = "";


			public string AssetName { get; set; } = "";

		}

		public class AssetType
		{
			public LoaderDataType LoaderData { get; set; } = null;


			public string Position { get; set; } = "0,0,0";


			public string Rotation { get; set; } = "0,0,0,0";


			public string Scale { get; set; } = "1,1,1";

		}

		public class BoundsType
		{
			public string m_Center { get; set; } = "0,0,0";


			public string m_Extent { get; set; } = "0,0,0";

		}

		public class RegionType
		{
			public string serializedVersion { get; set; } = "";


			public float x { get; set; } = 0f;


			public float y { get; set; } = 0f;


			public float width { get; set; } = 0f;


			public float height { get; set; } = 0f;

		}

		public class IconType
		{
			public int AtlasIndex { get; set; } = 0;


			public RegionType Region { get; set; } = null;

		}

		public class TileAndPropsType
		{
			public string Id { get; set; } = "";


			public string Name { get; set; } = "";


			public bool IsDeprecated { get; set; } = false;


			public string GroupTag { get; set; } = "";


			public List<string> Tags { get; set; } = new List<string>();


			public List<AssetType> Assets { get; set; } = new List<AssetType>();


			public bool IsInteractable { get; set; } = false;


			public BoundsType ColliderBoundsBound { get; set; } = null;


			public IconType Icon { get; set; } = null;

		}

		public class CreatureType
		{
			public string Id { get; set; } = "";


			public string Name { get; set; } = "";


			public bool IsDeprecated { get; set; } = false;


			public string GroupTag { get; set; } = "";


			public List<string> Tags { get; set; } = new List<string>();


			public AssetType MiniAsset { get; set; } = null;


			public AssetType BaseAsset { get; set; } = null;


			public float DefaultScale { get; set; } = 0f;


			public IconType Icon { get; set; } = null;

		}

		public class MusicType
		{
			public string Id { get; set; } = "";


			public string Name { get; set; } = "";


			public bool IsDeprecated { get; set; } = false;


			public string GroupTag { get; set; } = "";


			public List<string> Tags { get; set; } = new List<string>();


			public LoaderDataType Assets { get; set; } = null;

		}

		public class IconsAtlasesType
		{
			public string Path { get; set; } = "";

		}

		public class Index
		{
			public string assetPackId { get; set; } = "";


			public List<TileAndPropsType> Tiles { get; set; } = new List<TileAndPropsType>();


			public List<TileAndPropsType> Props { get; set; } = new List<TileAndPropsType>();


			public List<CreatureType> Creatures { get; set; } = new List<CreatureType>();


			public List<MusicType> Music { get; set; } = new List<MusicType>();


			public List<IconsAtlasesType> IconsAtlas { get; set; } = new List<IconsAtlasesType>();

		}
	}

	public static class Helpers
	{
		public static Dictionary<string, string> shaderNames = new Dictionary<string, string>();

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

		public static void SpawnPrevent()
		{
			if (Diagnostics() >= DiagnosticMode.high)
			{
				Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Helpers: Preventing Asset Spawn");
			}
			if (SingletonBehaviour<BoardToolManager>.HasInstance)
			{
				SingletonBehaviour<BoardToolManager>.Instance.SwitchToTool<DefaultBoardTool>((Type)0);
			}
		}

		public static CreatureGuid SpawnCreature(CreatureDataV2 creatureData)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Invalid comparison between Unknown and I4
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			if (Diagnostics() >= DiagnosticMode.high)
			{
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Helpers: Creating Mini Of Type " + ((object)(BoardObjectGuid)(ref creatureData.BoardAssetIds[0])).ToString() + " Which " + (((CreatureDataV2)(ref creatureData)).ExplicitlyHidden ? "Is" : "Is Not") + " Hidden"));
			}
			if (Diagnostics() >= DiagnosticMode.ultra)
			{
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Helpers: Creature Spawn: Alias = " + creatureData.Alias));
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Helpers: Creature Spawn: CreatureId = " + ((object)(CreatureGuid)(ref creatureData.CreatureId)).ToString()));
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Helpers: Creature Spawn: BoardAssetIds = " + string.Join(",", creatureData.BoardAssetIds) + " (Active " + Convert.ToString(((CreatureDataV2)(ref creatureData)).GetActiveBoardAssetId()) + ")"));
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Helpers: Creature Spawn: ActiveMorphIndex = " + Convert.ToString(creatureData.ActiveMorphIndex)));
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Helpers: Creature Spawn: ExplicitlyHidden = " + ((CreatureDataV2)(ref creatureData)).ExplicitlyHidden));
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Helpers: Creature Spawn: Flying = " + ((CreatureDataV2)(ref creatureData)).Flying));
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Helpers: Creature Spawn: Link = " + creatureData.Link));
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Helpers: Creature Spawn: Position = " + creatureData.Position.x + "," + creatureData.Position.y + "," + creatureData.Position.z));
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Helpers: Creature Spawn: Rotation = " + ((bam3)(ref creatureData.Rotation)).ToEulerDegrees().x + "," + ((bam3)(ref creatureData.Rotation)).ToEulerDegrees().y + "," + ((bam3)(ref creatureData.Rotation)).ToEulerDegrees().z));
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Helpers: Creature Spawn: UniqueId = " + ((object)(UniqueCreatureGuid)(ref creatureData.UniqueId)).ToString()));
			}
			float3 val = default(float3);
			((float3)(ref val))..ctor(creatureData.Position.x, creatureData.Position.y, creatureData.Position.z);
			Quaternion val2 = Quaternion.Euler(new Vector3(((bam)(ref creatureData.Rotation.x)).ToDegrees(), ((bam)(ref creatureData.Rotation.y)).ToDegrees(), ((bam)(ref creatureData.Rotation.z)).ToDegrees()));
			if (Diagnostics() >= DiagnosticMode.high)
			{
				Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Helpers: Executing Spawn");
			}
			if (spawnCreature == null)
			{
				MethodInfo[] array = typeof(CreatureManager).GetRuntimeMethods().ToArray();
				foreach (MethodInfo methodInfo in array)
				{
					if (methodInfo.Name == "AddOrRequestAddCreature")
					{
						spawnCreature = methodInfo;
						break;
					}
				}
			}
			SpawnCreatureResult val3 = (SpawnCreatureResult)spawnCreature.Invoke(null, new object[4]
			{
				creatureData,
				new PlayerGuid[1] { LocalPlayer.Id },
				true,
				true
			});
			if (Diagnostics() >= DiagnosticMode.high)
			{
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Helpers: Spawn Result = " + ((object)(SpawnCreatureResult)(ref val3)).ToString()));
			}
			if ((int)val3 == 0)
			{
				if (Diagnostics() >= DiagnosticMode.high)
				{
					Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Adding To History");
				}
				BuildingBoardTool.RecordInBuildHistory(((CreatureDataV2)(ref creatureData)).GetActiveBoardAssetId().Value);
			}
			return creatureData.CreatureId;
		}

		public static void SpawnCreatureByNGuid(NGuid nguid, string alias = "")
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			if (Diagnostics() >= DiagnosticMode.high)
			{
				Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Helpers: Spawning Creature By NGuid");
			}
			CreatureBoardAsset val = default(CreatureBoardAsset);
			CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref val);
			Vector3 val2 = (((Object)(object)val != (Object)null) ? ((MovableBoardAsset)val).CorrectPos : Vector3.zero);
			Quaternion val3 = (((Object)(object)val != (Object)null) ? ((MovableBoardAsset)val).CorrectRotation : Quaternion.Euler(Vector3.zero));
			CreatureDataV2 creatureData = default(CreatureDataV2);
			((CreatureDataV2)(ref creatureData))..ctor(new BoardObjectGuid(nguid));
			creatureData.Alias = alias;
			creatureData.CreatureId = new CreatureGuid(System.Guid.NewGuid().ToString());
			creatureData.PackedScales = new ScalesPack(0.1875f);
			creatureData.Position = float3.op_Implicit(val2);
			creatureData.Rotation = bam3.FromEulerDegrees(float3.op_Implicit(((Quaternion)(ref val3)).eulerAngles));
			((CreatureDataV2)(ref creatureData)).ExplicitlyHidden = false;
			((CreatureDataV2)(ref creatureData)).Flying = false;
			SpawnCreature(creatureData);
		}

		public static IEnumerator ShowHide(CreatureBoardAsset __instance, float pause = 0.1f)
		{
			if (Diagnostics() >= DiagnosticMode.ultra)
			{
				Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Helpers: Hide/Show Update");
			}
			yield return (object)new WaitForSeconds(pause);
			if ((Object)(object)__instance != (Object)null)
			{
				bool visible = true;
				if (!((MovableBoardAsset)__instance).IsVisible)
				{
					visible = false;
				}
				if (__instance.IsExplicitlyHidden)
				{
					visible = false;
				}
				ShaderStateRef shaderStateRef = __instance.ShaderStateRef;
				ShaderState state = ((ShaderStateRef)(ref shaderStateRef)).State;
				if (((ShaderState)(ref state)).IsCreatureHiddenByVolume)
				{
					visible = false;
				}
				shaderStateRef = __instance.ShaderStateRef;
				state = ((ShaderStateRef)(ref shaderStateRef)).State;
				if (!((ShaderState)(ref state)).InActiveLineOfSight && !LocalClient.IsInGmMode)
				{
					visible = false;
				}
				if (Diagnostics() >= DiagnosticMode.ultra)
				{
					string[] obj = new string[13]
					{
						"Custom Assets Library Plugin Integrated Extension: ",
						Utility.GetCreatureName(__instance.Name),
						" Show = ",
						visible.ToString(),
						" (Hide: ",
						__instance.IsExplicitlyHidden.ToString(),
						", HideVolume: ",
						null,
						null,
						null,
						null,
						null,
						null
					};
					shaderStateRef = __instance.ShaderStateRef;
					state = ((ShaderStateRef)(ref shaderStateRef)).State;
					obj[7] = ((ShaderState)(ref state)).IsCreatureHiddenByVolume.ToString();
					obj[8] = ", HeightBar: ";
					obj[9] = (!((MovableBoardAsset)__instance).IsVisible).ToString();
					obj[10] = ", LOS: ";
					shaderStateRef = __instance.ShaderStateRef;
					state = ((ShaderStateRef)(ref shaderStateRef)).State;
					obj[11] = ((ShaderState)(ref state)).InActiveLineOfSight.ToString();
					obj[12] = ")";
					Debug.Log((object)string.Concat(obj));
				}
				Renderer[] ren = ((Component)__instance).GetComponentsInChildren<Renderer>();
				Renderer[] array = ren;
				foreach (Renderer renderer in array)
				{
					if (Diagnostics() >= DiagnosticMode.ultra)
					{
						Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Creature '" + __instance.Name + "' has " + ((object)renderer).GetType().ToString() + " '" + ((Object)renderer).name + "' material '" + ((Object)renderer.material).name + "' shader '" + ((Object)renderer.material.shader).name + "'"));
					}
					if (!((Object)renderer.material.shader).name.StartsWith("Taleweaver"))
					{
						if (Diagnostics() >= DiagnosticMode.ultra)
						{
							Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Setting Creature '" + __instance.Name + "' has " + ((object)renderer).GetType().ToString() + " '" + ((Object)renderer).name + "' Enabled = " + visible));
						}
						renderer.enabled = visible;
					}
				}
			}
			else if (Diagnostics() >= DiagnosticMode.ultra)
			{
				Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Instance In Null");
			}
		}

		public static string ModifyKindBasedOnModifier(string kind)
		{
			if (modifierMode.Value == ModifierMode.normal || (modifierMode.Value == ModifierMode.scrollock && Control.IsKeyLocked((Keys)145)))
			{
				if (Diagnostics() >= DiagnosticMode.ultra)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Checking Modifiers (Mode " + modifierMode.Value.ToString() + ")"));
				}
				if (Input.GetKey((KeyCode)305))
				{
					return "Creature";
				}
				if (Input.GetKey((KeyCode)303))
				{
					return "Transform";
				}
				if (Input.GetKey((KeyCode)307))
				{
					return "Audio";
				}
				if (Input.GetKey((KeyCode)304))
				{
					return "Effect";
				}
				if (Input.GetKey((KeyCode)306))
				{
					return "Aura";
				}
				if (Input.GetKey((KeyCode)308))
				{
					return "Filter";
				}
			}
			return kind;
		}

		public static Dictionary<string, string> GetAssetTags(BoardObjectGuid nguid)
		{
			//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)
			DbEntry val = default(DbEntry);
			AssetDb.TryGetIndexData(nguid.Value, ref val);
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			string[] tags = val.Tags;
			foreach (string text in tags)
			{
				if (text.Contains(":"))
				{
					dictionary.Add(text.Substring(0, text.IndexOf(":")), text.Substring(text.IndexOf(":") + 1));
				}
				else
				{
					dictionary.Add(text, text);
				}
			}
			return dictionary;
		}

		public static Dictionary<string, object> GetAssetInfo(BoardObjectGuid nguid)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			string text = GetAssetTags(nguid)["Prefab"];
			Dictionary<string, object> result = null;
			foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles())
			{
				if (((Object)allLoadedAssetBundle).name == text)
				{
					string text2 = allLoadedAssetBundle.LoadAsset<TextAsset>("Info.txt").text;
					result = JsonConvert.DeserializeObject<Dictionary<string, object>>(text2);
				}
			}
			return result;
		}
	}

	public static class Patches
	{
		[HarmonyPatch(typeof(UI_AssetBrowserSlotItem), "Spawn")]
		public class PatchSpawn
		{
			public static bool Prefix(UI_AssetBrowserSlotItem __instance, NGuid ____nGuid)
			{
				//IL_0034: 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)
				if (Diagnostics() >= DiagnosticMode.low)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Library Selection Made (Asset Id " + ((object)(NGuid)(ref ____nGuid)).ToString() + ")"));
				}
				return PreSpawnHandlerRouter(____nGuid, AssetDb.GetIndexData(____nGuid));
			}
		}

		[HarmonyPatch(typeof(CreatureBoardAsset), "OnBaseLoaded")]
		public static class PatcheOnBaseLoaded
		{
			public static bool Prefix(CreatureBoardAsset __instance)
			{
				string nameBlock = ((__instance.Name != null) ? __instance.Name : ((((Object)__instance).name != null) ? ((Object)__instance).name : "(Unknown)"));
				nameBlock = Utility.GetCreatureName(nameBlock);
				if (Diagnostics() >= DiagnosticMode.high)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Board Placement Of " + nameBlock));
				}
				spawnList.Add(__instance);
				return true;
			}
		}

		[HarmonyPatch(typeof(CreatureBoardAsset), "OnVisibilityChanged")]
		public static class PatchOnVisibilityChanged
		{
			public static void Postfix(ref CreatureBoardAsset __instance)
			{
				if (Diagnostics() >= DiagnosticMode.high)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Synchronizing The Hide State For Non-TS Shader Content On Creature '" + __instance.Name + "'"));
				}
				((MonoBehaviour)_self).StartCoroutine(Helpers.ShowHide(__instance));
			}
		}

		public static List<CreatureBoardAsset> spawnList = new List<CreatureBoardAsset>();
	}

	public static class RequestHandler
	{
		public enum BlendShapeTransitionStyle
		{
			Single = 1,
			PingPong,
			Loop
		}

		public class BlendShapeApplication
		{
			public BlendShapeTransitionStyle style = BlendShapeTransitionStyle.Single;

			public Tuple<SkinnedMeshRenderer, int> skin { get; set; } = null;


			public float start { get; set; } = 0f;


			public float current { get; set; } = 0f;


			public float end { get; set; } = 100f;


			public float step { get; set; } = 1f;

		}

		public class BlendShapeRequest
		{
			public BlendShapeTransitionStyle style = BlendShapeTransitionStyle.Single;

			public int blendShapeIndex = 0;

			public float start { get; set; } = 0f;


			public float end { get; set; } = 100f;


			public float step { get; set; } = 1f;

		}

		public class BlendShapeSequence
		{
			public List<BlendShapeRequest> elements = new List<BlendShapeRequest>();
		}

		public class BlendShapeSequences
		{
			public List<BlendShapeSequence> blendshapes = new List<BlendShapeSequence>();
		}

		private static List<BlendShapeApplication> blendShapesInProgress = new List<BlendShapeApplication>();

		public static void ApplyAnimate(CreatureGuid cid, string selection)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameObject asset = Utility.GetAssetLoader(cid);
				if ((Object)(object)asset != (Object)null)
				{
					Animation anim = asset.GetComponentInChildren<Animation>();
					if ((Object)(object)anim != (Object)null)
					{
						if (selection == "-1")
						{
							if (Diagnostics() >= DiagnosticMode.low)
							{
								Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Stopping Animation On " + ((Object)asset).name));
							}
							anim.Stop();
							return;
						}
						if (selection == "0")
						{
							SystemMessage.AskForTextInput("Animation", "Animation Name:", "OK", (Action<string>)delegate(string animName)
							{
								Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Starting Animation '" + animName + "' On " + ((Object)asset).name));
								anim.Play(animName);
							}, (Action)null, "Cancel", (Action)null, "");
							return;
						}
						int result = 0;
						if (int.TryParse(selection, out result))
						{
							if (Diagnostics() >= DiagnosticMode.ultra)
							{
								Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Looking Up Animation '" + selection + "' On " + ((Object)asset).name));
							}
							selection = GetAnimationName(anim, result);
						}
						if (Diagnostics() >= DiagnosticMode.low)
						{
							Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Playing '" + selection + "' On " + ((Object)asset).name));
						}
						anim.Play(selection);
					}
					else if (Diagnostics() >= DiagnosticMode.high)
					{
						Debug.LogWarning((object)("Custom Assets Library Plugin Integrated Extension: Unable To Find Animation Component On Asset " + ((Object)asset).name));
					}
				}
				else if (Diagnostics() >= DiagnosticMode.high)
				{
					Debug.LogWarning((object)"Custom Assets Library Plugin Integrated Extension: No Selected Asset To Animate");
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Custom Assets Library Plugin Integrated Extension: Error Processing Animate " + selection + " On " + ((object)(CreatureGuid)(ref cid)).ToString()));
				if (Diagnostics() >= DiagnosticMode.high)
				{
					Debug.LogWarning((object)ex);
				}
			}
		}

		public static void ApplyAudio(CreatureGuid cid, int selection)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameObject assetLoader = Utility.GetAssetLoader(cid);
				if ((Object)(object)assetLoader != (Object)null)
				{
					AudioSource componentInChildren = assetLoader.GetComponentInChildren<AudioSource>();
					if ((Object)(object)componentInChildren != (Object)null)
					{
						if (selection == -1)
						{
							if (Diagnostics() >= DiagnosticMode.low)
							{
								Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Stopping Audio On " + ((Object)assetLoader).name));
							}
							componentInChildren.Stop();
						}
						else
						{
							if (Diagnostics() >= DiagnosticMode.low)
							{
								Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Starting Audio On " + ((Object)assetLoader).name));
							}
							componentInChildren.Play();
						}
					}
					else if (Diagnostics() >= DiagnosticMode.low)
					{
						Debug.LogWarning((object)("Custom Assets Library Plugin Integrated Extension: Unable To Find AudioSource Component On Asset " + ((Object)assetLoader).name));
					}
				}
				else if (Diagnostics() >= DiagnosticMode.low)
				{
					Debug.LogWarning((object)"Custom Assets Library Plugin Integrated Extension: No Selected Asset For Audio Function");
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Custom Assets Library Plugin Integrated Extension: Error Processing Audio " + selection + " On " + ((object)(CreatureGuid)(ref cid)).ToString()));
				if (Diagnostics() >= DiagnosticMode.high)
				{
					Debug.LogWarning((object)ex);
				}
			}
		}

		public static void ApplyAura(CreatureGuid targetCid, CreatureGuid auraCid)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			if (Diagnostics() >= DiagnosticMode.low)
			{
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Apply Aura " + ((object)(CreatureGuid)(ref auraCid)).ToString()));
			}
			GameObject baseLoader = Utility.GetBaseLoader(targetCid);
			GameObject assetLoader = Utility.GetAssetLoader(targetCid);
			GameObject baseLoader2 = Utility.GetBaseLoader(auraCid);
			GameObject assetLoader2 = Utility.GetAssetLoader(auraCid);
			((Object)baseLoader2).name = "CustomContent:Base:" + ((object)(CreatureGuid)(ref targetCid)).ToString() + ":" + ((object)(CreatureGuid)(ref auraCid)).ToString();
			((Object)assetLoader2).name = "CustomContent:Aura:" + ((object)(CreatureGuid)(ref targetCid)).ToString() + ":" + ((object)(CreatureGuid)(ref auraCid)).ToString();
			if ((Object)(object)assetLoader != (Object)null && (Object)(object)baseLoader != (Object)null && (Object)(object)assetLoader2 != (Object)null && (Object)(object)baseLoader2 != (Object)null)
			{
				if (Diagnostics() >= DiagnosticMode.ultra)
				{
					Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Apply Aura: Syncing Aura Base Position");
				}
				baseLoader2.transform.position = baseLoader.transform.position;
				baseLoader2.transform.rotation = assetLoader.transform.rotation;
				baseLoader2.transform.SetParent(assetLoader.transform);
				if (Diagnostics() >= DiagnosticMode.ultra)
				{
					Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Apply Aura: Syncing Aura Position");
				}
				assetLoader2.transform.position = baseLoader.transform.position;
				assetLoader2.transform.rotation = assetLoader.transform.rotation;
				assetLoader2.transform.SetParent(assetLoader.transform);
				if (Diagnostics() >= DiagnosticMode.ultra)
				{
					Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Apply Aura: Removing Base");
				}
				Renderer[] componentsInChildren = baseLoader2.GetComponentsInChildren<Renderer>();
				foreach (Renderer val in componentsInChildren)
				{
					val.enabled = false;
				}
			}
			else
			{
				Debug.LogWarning((object)"Custom Assets Library Plugin Integrated Extension: Apply Aura: Unable To Access Asset");
			}
		}

		public static void RemoveAura(string identityCid, string auraCid)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (auraCid.Contains("@"))
			{
				auraCid = auraCid.Substring(0, auraCid.IndexOf("@"));
			}
			if (Diagnostics() >= DiagnosticMode.low)
			{
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Remove Aura " + auraCid + " From " + identityCid));
			}
			CreatureBoardAsset val = null;
			CreaturePresenter.TryGetAsset(new CreatureGuid(auraCid), ref val);
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			if (Diagnostics() >= DiagnosticMode.ultra)
			{
				Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Removing Aura From Talespire History");
			}
			val.RequestDelete();
			string[] array = new string[2]
			{
				"CustomContent:Base:" + identityCid + ":" + auraCid,
				"CustomContent:Aura:" + identityCid + ":" + auraCid
			};
			foreach (string text in array)
			{
				if (Diagnostics() >= DiagnosticMode.ultra)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Removing Object '" + text + "'"));
				}
				Object.Destroy((Object)(object)GameObject.Find(text));
			}
		}

		public static void ApplyBlendShapeSequence(CreatureGuid cid, int selection)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			if (Diagnostics() >= DiagnosticMode.low)
			{
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Applying BlendShape Sequence " + selection + " On Creature " + ((object)(CreatureGuid)(ref cid)).ToString()));
			}
			if (selection == -1)
			{
				blendShapesInProgress.Clear();
				return;
			}
			CreatureBoardAsset val = null;
			CreaturePresenter.TryGetAsset(cid, ref val);
			Dictionary<string, object> dictionary = new Dictionary<string, object>();
			if ((Object)(object)val != (Object)null)
			{
				dictionary = Helpers.GetAssetInfo(val.BoardObjectId);
			}
			if (!dictionary.ContainsKey("blendshapes"))
			{
				return;
			}
			try
			{
				BlendShapeSequences blendShapeSequences = JsonConvert.DeserializeObject<BlendShapeSequences>("{\"blendshapes\": " + dictionary["blendshapes"].ToString() + "\r\n}");
				if (blendShapeSequences.blendshapes.Count < selection)
				{
					return;
				}
				BlendShapeSequence blendShapeSequence = blendShapeSequences.blendshapes[selection - 1];
				foreach (BlendShapeRequest element in blendShapeSequence.elements)
				{
					ApplyBlendShape(cid, element);
				}
			}
			catch (Exception ex)
			{
				Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Exception While Blend Shaping");
				Debug.LogException(ex);
			}
		}

		public static void ApplyBlendShape(CreatureGuid cid, BlendShapeRequest req)
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (Diagnostics() >= DiagnosticMode.low)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Requesting Global Blend Shape " + req.blendShapeIndex + " From " + req.start + " To " + req.end + " By " + req.step + " (Style " + req.style.ToString() + ")"));
				}
				GameObject assetLoader = Utility.GetAssetLoader(cid);
				if ((Object)(object)assetLoader != (Object)null)
				{
					SkinnedMeshRenderer[] componentsInChildren = assetLoader.GetComponentsInChildren<SkinnedMeshRenderer>();
					List<Tuple<SkinnedMeshRenderer, int>> list = new List<Tuple<SkinnedMeshRenderer, int>>();
					int num = 0;
					SkinnedMeshRenderer[] array = componentsInChildren;
					foreach (SkinnedMeshRenderer val in array)
					{
						for (int j = 0; j < val.sharedMesh.blendShapeCount; j++)
						{
							if (Diagnostics() >= DiagnosticMode.ultra)
							{
								Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Global Blend Shape " + num + " = Renderer '" + ((Object)val).name + "' Blend Shape '" + val.sharedMesh.GetBlendShapeName(j) + "' (Index: " + j + ")"));
							}
							list.Add(new Tuple<SkinnedMeshRenderer, int>(val, j));
							num++;
						}
					}
					if (componentsInChildren != null)
					{
						try
						{
							if (Diagnostics() >= DiagnosticMode.ultra)
							{
								Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Adding Blend Shape Sequence (" + req.blendShapeIndex + ") '" + ((Object)list[req.blendShapeIndex - 1].Item1).name + "." + list[req.blendShapeIndex - 1].Item1.sharedMesh.GetBlendShapeName(list[req.blendShapeIndex - 1].Item2) + "': " + req.start + " To " + req.end + " By " + req.step + " (" + req.style.ToString() + ")"));
							}
							blendShapesInProgress.Add(new BlendShapeApplication
							{
								skin = list[req.blendShapeIndex - 1],
								style = req.style,
								start = req.start,
								current = req.start,
								end = req.end,
								step = req.step
							});
							return;
						}
						catch (Exception)
						{
							Debug.LogWarning((object)("Custom Assets Library Plugin Integrated Extension: Unable To Access Blend Shape " + req.blendShapeIndex));
							return;
						}
					}
					Debug.LogWarning((object)("Custom Assets Library Plugin Integrated Extension: Unable To Find SkinnedMeshRenderer Component On Asset " + ((Object)assetLoader).name));
				}
				else
				{
					Debug.LogWarning((object)"Custom Assets Library Plugin Integrated Extension: No Selected Asset To Blend Shape");
				}
			}
			catch (Exception ex2)
			{
				Debug.LogError((object)("Custom Assets Library Plugin Integrated Extension: Error Processing Blend Shape " + req.blendShapeIndex + " On " + ((object)(CreatureGuid)(ref cid)).ToString()));
				if (Diagnostics() >= DiagnosticMode.high)
				{
					Debug.LogWarning((object)ex2);
				}
			}
		}

		public static void UpdateBlendShape()
		{
			try
			{
				for (int i = 0; i < blendShapesInProgress.Count; i++)
				{
					blendShapesInProgress[i].current = blendShapesInProgress[i].current + blendShapesInProgress[i].step;
					if ((blendShapesInProgress[i].step < 0f && blendShapesInProgress[i].current <= blendShapesInProgress[i].end) || (blendShapesInProgress[i].step > 0f && blendShapesInProgress[i].current >= blendShapesInProgress[i].end))
					{
						blendShapesInProgress[i].current = blendShapesInProgress[i].end;
						blendShapesInProgress[i].skin.Item1.SetBlendShapeWeight(blendShapesInProgress[i].skin.Item2, blendShapesInProgress[i].current);
						switch (blendShapesInProgress[i].style)
						{
						case BlendShapeTransitionStyle.Single:
							if (Diagnostics() >= DiagnosticMode.ultra)
							{
								Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Sequence '" + ((Object)blendShapesInProgress[i].skin.Item1).name + "." + blendShapesInProgress[i].skin.Item1.sharedMesh.GetBlendShapeName(blendShapesInProgress[i].skin.Item2) + "' Mode '" + blendShapesInProgress[i].style.ToString() + "' End Reached. Ending."));
							}
							blendShapesInProgress.RemoveAt(i);
							i--;
							break;
						case BlendShapeTransitionStyle.PingPong:
							if (Diagnostics() >= DiagnosticMode.ultra)
							{
								Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Sequence '" + ((Object)blendShapesInProgress[i].skin.Item1).name + "." + blendShapesInProgress[i].skin.Item1.sharedMesh.GetBlendShapeName(blendShapesInProgress[i].skin.Item2) + "' Mode '" + blendShapesInProgress[i].style.ToString() + "' End Reached. Reversing."));
							}
							blendShapesInProgress[i].style = BlendShapeTransitionStyle.Single;
							blendShapesInProgress[i].step = -1f * blendShapesInProgress[i].step;
							blendShapesInProgress[i].end = blendShapesInProgress[i].start;
							blendShapesInProgress[i].start = blendShapesInProgress[i].current;
							break;
						case BlendShapeTransitionStyle.Loop:
							if (Diagnostics() >= DiagnosticMode.ultra)
							{
								Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Sequence '" + ((Object)blendShapesInProgress[i].skin.Item1).name + "." + blendShapesInProgress[i].skin.Item1.sharedMesh.GetBlendShapeName(blendShapesInProgress[i].skin.Item2) + "' Mode '" + blendShapesInProgress[i].style.ToString() + "' End Reached. Looping."));
							}
							blendShapesInProgress[i].step = -1f * blendShapesInProgress[i].step;
							blendShapesInProgress[i].end = blendShapesInProgress[i].start;
							blendShapesInProgress[i].start = blendShapesInProgress[i].current;
							break;
						}
						continue;
					}
					if (Diagnostics() >= DiagnosticMode.ultra)
					{
						Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Setting Sequence '" + ((Object)blendShapesInProgress[i].skin.Item1).name + "." + blendShapesInProgress[i].skin.Item1.sharedMesh.GetBlendShapeName(blendShapesInProgress[i].skin.Item2) + "' Mode '" + blendShapesInProgress[i].style.ToString() + "' To " + blendShapesInProgress[i].current));
					}
					try
					{
						blendShapesInProgress[i].skin.Item1.SetBlendShapeWeight(blendShapesInProgress[i].skin.Item2, blendShapesInProgress[i].current);
					}
					catch
					{
						if (Diagnostics() >= DiagnosticMode.ultra)
						{
							Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Blendshape Failure. Removing Sequence");
						}
						blendShapesInProgress.RemoveAt(i);
						i--;
					}
				}
			}
			catch (Exception ex)
			{
				if (Diagnostics() >= DiagnosticMode.ultra)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Blendshape Failure: " + ex));
				}
			}
		}

		public static void ApplyFilter(CreatureGuid filterCid)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			if (Diagnostics() >= DiagnosticMode.low)
			{
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Apply Filter " + ((object)(CreatureGuid)(ref filterCid)).ToString()));
			}
			GameObject gameObject = ((Component)ActiveCameraManager.ActiveCamera).gameObject;
			GameObject assetLoader = Utility.GetAssetLoader(filterCid);
			GameObject baseLoader = Utility.GetBaseLoader(filterCid);
			if ((Object)(object)assetLoader != (Object)null)
			{
				if (Diagnostics() >= DiagnosticMode.ultra)
				{
					Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Apply Filter: Syncing Filter Position");
				}
				assetLoader.transform.position = gameObject.transform.position;
				assetLoader.transform.rotation = gameObject.transform.rotation;
				assetLoader.transform.SetParent(gameObject.transform);
				((Object)assetLoader).name = "CustomContent:Filter:" + ((object)(CreatureGuid)(ref filterCid)).ToString();
				baseLoader.transform.position = gameObject.transform.position;
				baseLoader.transform.rotation = gameObject.transform.rotation;
				baseLoader.transform.SetParent(gameObject.transform);
				((Object)baseLoader).name = "CustomContent:Base:" + ((object)(CreatureGuid)(ref filterCid)).ToString();
				if (Diagnostics() >= DiagnosticMode.ultra)
				{
					Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Apply Filter: Removing Base");
				}
				Renderer[] componentsInChildren = baseLoader.GetComponentsInChildren<Renderer>();
				foreach (Renderer val in componentsInChildren)
				{
					val.enabled = false;
				}
			}
			else
			{
				Debug.LogWarning((object)"Custom Assets Library Plugin Integrated Extension: Apply Filter: Unable To Access Filter");
			}
		}

		public static void RemoveFilter(CreatureGuid filterCid)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Remove Filter: Removing Current Camera Filter (" + ((object)(CreatureGuid)(ref filterCid)).ToString() + ")"));
			CreatureBoardAsset val = null;
			CreaturePresenter.TryGetAsset(filterCid, ref val);
			if ((Object)(object)val != (Object)null)
			{
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Remove Filter: Camera Filter Object (" + val.Name + ") Remove Requested"));
				val.RequestDelete();
				string[] array = new string[2]
				{
					"CustomContent:Base:" + ((object)(CreatureGuid)(ref filterCid)).ToString(),
					"CustomContent:Filter:" + ((object)(CreatureGuid)(ref filterCid)).ToString()
				};
				foreach (string text in array)
				{
					if (Diagnostics() >= DiagnosticMode.ultra)
					{
						Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Removing Object '" + text + "'"));
					}
					Object.Destroy((Object)(object)GameObject.Find(text));
				}
			}
			else
			{
				Debug.LogWarning((object)"Custom Assets Library Plugin Integrated Extension: Remove Filter: Unable To Access Filter");
			}
		}

		public static void BuildSlabs(CreatureGuid unused1, object unused2)
		{
			if (Diagnostics() >= DiagnosticMode.low)
			{
				Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Paste Slab Or Multi-Slab Activated");
			}
			string text = DirtyClipboardHelper.PullFromClipboard();
			if (Diagnostics() >= DiagnosticMode.ultra)
			{
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Got:\r\n" + text));
			}
			((MonoBehaviour)_self).StartCoroutine(BuildMultipleSlabs(DirtyClipboardHelper.PullFromClipboard(), 0.1f));
		}

		public static void Analyze(CreatureGuid cid, object unused)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				CreatureBoardAsset val = null;
				CreaturePresenter.TryGetAsset(cid, ref val);
				if ((Object)(object)val != (Object)null)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Analyzing Mini " + ((Object)val).name));
					AnalyzeCreature(val);
				}
			}
			catch (Exception ex)
			{
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Error Processing Analyze On " + ((object)(CreatureGuid)(ref cid)).ToString()));
				if (Diagnostics() >= DiagnosticMode.high)
				{
					Debug.LogWarning((object)ex);
				}
			}
		}

		public static IEnumerator BuildMultipleSlabs(string slabCode, float delay)
		{
			List<Data.SlabInfo> slabs;
			try
			{
				slabs = JsonConvert.DeserializeObject<List<Data.SlabInfo>>(slabCode);
				if (Diagnostics() >= DiagnosticMode.high)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Content Looks Like Multi-Slab Data With " + slabs.Count + " Parts"));
				}
			}
			catch (Exception)
			{
				slabs = new List<Data.SlabInfo>
				{
					new Data.SlabInfo
					{
						position = new float3(0f, 0f, 0f),
						code = slabCode
					}
				};
				if (Diagnostics() >= DiagnosticMode.high)
				{
					Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Content Looks Single-Slab Data With 1 Part");
				}
			}
			foreach (Data.SlabInfo slab in slabs)
			{
				if (Diagnostics() >= DiagnosticMode.high)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Processing Slab At " + Convert.ToString(slab.position)));
				}
				if (Diagnostics() >= DiagnosticMode.ultra)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Processing Slab Code:\r\n" + slab.code));
				}
				Copied copied = null;
				if ((int)BoardSessionManager.Board.PushStringToTsClipboard(slab.code, ref copied) == 0)
				{
					if (Diagnostics() >= DiagnosticMode.high)
					{
						Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Slab Code Loaded");
					}
					Copied mostRecentCopied_LocalOnly = BoardSessionManager.Board.GetMostRecentCopied_LocalOnly();
					if (mostRecentCopied_LocalOnly != null)
					{
						if (Diagnostics() >= DiagnosticMode.high)
						{
							Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Placing Slab. X:" + slab.position.x + " y:" + slab.position.x + " z:" + slab.position.z + " Slab: " + slab.code));
						}
						BoardSessionManager.Board.PasteCopied(slab.position, (byte)0, 0uL);
						if (Diagnostics() >= DiagnosticMode.ultra)
						{
							Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Post Slab Placement Delay = " + delay));
						}
						yield return (object)new WaitForSeconds(delay);
					}
					else
					{
						Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Unable To Process Most Recent Copied");
					}
				}
				else
				{
					Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Unable To Push Slab Code To TS Clipboard");
				}
			}
		}

		public static void Clean(CreatureGuid cid, object unused)
		{
			//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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Cleaning Board");
			foreach (CreatureBoardAsset item in (IEnumerable<CreatureBoardAsset>)CreaturePresenter.GetTempReadOnlyViewOfAllCreatureAssets())
			{
				if (Diagnostics() >= DiagnosticMode.high)
				{
					string[] obj = new string[5]
					{
						"Custom Assets Library Plugin Integrated Extension: Cleaning Asset ",
						Utility.GetCreatureName(item.Name),
						" (",
						null,
						null
					};
					CreatureGuid creatureId = item.CreatureId;
					obj[3] = ((object)(CreatureGuid)(ref creatureId)).ToString();
					obj[4] = ")";
					Debug.Log((object)string.Concat(obj));
				}
				ApplyAnimate(item.CreatureId, "-1");
				ApplyAudio(item.CreatureId, -1);
				ApplyBlendShapeSequence(item.CreatureId, -1);
			}
			if (Diagnostics() >= DiagnosticMode.high)
			{
				Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Removing Custom Asset Addons Such As Filters And Auras");
			}
			GameObject[] array = (from g in Object.FindObjectsByType<GameObject>((FindObjectsSortMode)0)
				where ((Object)g).name.StartsWith("CustomContent:")
				select g).ToArray();
			for (int i = 0; i < array.Count(); i++)
			{
				Object.Destroy((Object)(object)array[i]);
			}
			array = null;
		}

		private static void AnalyzeCreature(CreatureBoardAsset asset)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			string[] obj = new string[7]
			{
				"Custom Assets Library Plugin Integrated Extension: Object '",
				Utility.GetCreatureName(asset.Name),
				"' (Cid: ",
				null,
				null,
				null,
				null
			};
			CreatureGuid creatureId = asset.CreatureId;
			obj[3] = ((object)(CreatureGuid)(ref creatureId)).ToString();
			obj[4] = ", Type: ";
			BoardObjectGuid boardObjectId = asset.BoardObjectId;
			obj[5] = ((object)(BoardObjectGuid)(ref boardObjectId)).ToString();
			obj[6] = ")";
			Debug.Log((object)string.Concat(obj));
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Object '" + Utility.GetCreatureName(asset.Name) + "' is " + (asset.IsExplicitlyHidden ? "Hidden" : "Not Hidden")));
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Object '" + Utility.GetCreatureName(asset.Name) + "' is " + (((MovableBoardAsset)asset).IsFlying ? "Flying" : "Not Flying")));
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Object '" + Utility.GetCreatureName(asset.Name) + "' is " + (((MovableBoardAsset)asset).IsVisible ? "Visible" : "Not Visible")));
			string creatureName = Utility.GetCreatureName(asset.Name);
			ShaderStateRef shaderStateRef = asset.ShaderStateRef;
			ShaderState state = ((ShaderStateRef)(ref shaderStateRef)).State;
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Object '" + creatureName + "' is " + (((ShaderState)(ref state)).IsCreatureHiddenByVolume ? "In Hide Volume" : "Not In Hide Volume")));
			string creatureName2 = Utility.GetCreatureName(asset.Name);
			shaderStateRef = asset.ShaderStateRef;
			state = ((ShaderStateRef)(ref shaderStateRef)).State;
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Object '" + creatureName2 + "' is " + (((ShaderState)(ref state)).InActiveLineOfSight ? "In LOS" : "Out Of LOS")));
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Object '" + Utility.GetCreatureName(asset.Name) + "' JSON is " + asset.Name));
			AnalyzeGameObjectAnimations(((Component)asset).gameObject);
			AnalyzeGameObject(Utility.GetAssetLoader(asset.CreatureId), 0);
		}

		private static void AnalyzeGameObjectAnimations(GameObject asset)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			Animation componentInChildren = asset.GetComponentInChildren<Animation>();
			List<AnimationState> list = new List<AnimationState>(((IEnumerable)componentInChildren).Cast<AnimationState>());
			foreach (AnimationState item in list)
			{
				string[] obj = new string[10]
				{
					"Custom Assets Library Plugin Integrated Extension: Animation '",
					item.name,
					"', time: ",
					item.time.ToString(),
					", length: ",
					item.length.ToString(),
					", blend: ",
					null,
					null,
					null
				};
				AnimationBlendMode blendMode = item.blendMode;
				obj[7] = ((object)(AnimationBlendMode)(ref blendMode)).ToString();
				obj[8] = ", mode: ";
				WrapMode wrapMode = item.wrapMode;
				obj[9] = ((object)(WrapMode)(ref wrapMode)).ToString();
				Debug.Log((object)string.Concat(obj));
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Clip '" + ((Object)item.clip).name + "', rate: " + item.clip.frameRate + ", length: " + item.clip.length + ", legacy: " + item.clip.legacy + ", loop: " + ((Motion)item.clip).isLooping));
			}
		}

		private static void AnalyzeGameObject(GameObject go, int depth)
		{
			Renderer[] componentsInChildren = go.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Renderer '" + ((Object)val).name + "' uses material with shader '" + ((Object)val.material.shader).name + "'"));
				Material[] materials = val.materials;
				foreach (Material val2 in materials)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: " + ((object)val).GetType().ToString() + " Renderer '" + ((Object)val).name + "' has material with shader '" + ((Object)val2.shader).name + "'"));
				}
			}
			Component[] components = go.GetComponents<Component>();
			foreach (Component val3 in components)
			{
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Component '" + ((Object)val3).name + "' (Type " + ((object)val3).GetType().ToString() + ")"));
			}
			MeshFilter[] components2 = go.GetComponents<MeshFilter>();
			foreach (MeshFilter val4 in components2)
			{
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Component '" + ((Object)val4).name + "' (Type " + ((object)val4).GetType().ToString() + ")"));
				for (int m = 0; m < 10; m++)
				{
					try
					{
						Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Component '" + ((Object)val4).name + "' (Type " + ((object)val4).GetType().ToString() + ") Blend Shape " + m + " Is Named " + Convert.ToString(val4.mesh.GetBlendShapeName(m))));
					}
					catch
					{
					}
				}
			}
			SkinnedMeshRenderer[] components3 = go.GetComponents<SkinnedMeshRenderer>();
			foreach (SkinnedMeshRenderer val5 in components3)
			{
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Component '" + ((Object)val5).name + "' (Type " + ((object)val5).GetType().ToString() + ")"));
				for (int num = 0; num < 10; num++)
				{
					try
					{
						Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Component '" + ((Object)val5).name + "' (Type " + ((object)val5).GetType().ToString() + ") Blend Shape " + num + " Is Named " + Convert.ToString(val5.sharedMesh.GetBlendShapeName(num))));
					}
					catch
					{
					}
				}
			}
			foreach (Transform item in ExtensionMethods.Children(go.transform))
			{
				if ((Object)(object)((Component)item).gameObject != (Object)null && depth < 5)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Child @ Level " + depth));
					AnalyzeGameObject(((Component)item).gameObject, depth + 1);
				}
			}
		}

		private static string GetAnimationName(Animation animation, int index)
		{
			string[] array = animationNames.Value.Split(new char[1] { ',' });
			List<AnimationState> list = new List<AnimationState>(((IEnumerable)animation).Cast<AnimationState>());
			try
			{
				if (Diagnostics() >= DiagnosticMode.high)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Trying Animation '" + array[index - 1] + "'"));
				}
				foreach (AnimationState item in list)
				{
					if (item.name == array[index - 1])
					{
						if (Diagnostics() >= DiagnosticMode.high)
						{
							Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Loading Animation By State '" + array[index - 1] + "'"));
						}
						return item.name;
					}
				}
				for (int i = 0; i < array.Length; i++)
				{
					array[i] = "Anim" + (i + 1).ToString("00");
				}
				if (Diagnostics() >= DiagnosticMode.high)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Trying Animation '" + array[index - 1] + "'"));
				}
				foreach (AnimationState item2 in list)
				{
					if (item2.name == array[index - 1])
					{
						if (Diagnostics() >= DiagnosticMode.high)
						{
							Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Loading Animation By Default Anim Name '" + array[index - 1] + "'"));
						}
						return item2.name;
					}
				}
				if (Diagnostics() >= DiagnosticMode.high)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Loading Animation By Index '" + index + "'"));
				}
				return list[index - 1].name;
			}
			catch
			{
				Debug.LogWarning((object)"Custom Assets Library Plugin Integrated Extension: Animation Selection Not Supported On This Asset");
				return list[0].name;
			}
		}
	}

	public static class Utility
	{
		public static void PostOnMainPage(MemberInfo plugin)
		{
			SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode mode)
			{
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Expected O, but got Unknown
				try
				{
					if (((Scene)(ref scene)).name == "UI")
					{
						TextMeshProUGUI uITextByName = GetUITextByName("BETA");
						if (Object.op_Implicit((Object)(object)uITextByName))
						{
							((TMP_Text)uITextByName).text = "INJECTED BUILD - unstable mods";
						}
					}
					else
					{
						TextMeshProUGUI uITextByName2 = GetUITextByName("TextMeshPro Text");
						if (Object.op_Implicit((Object)(object)uITextByName2))
						{
							BepInPlugin val = (BepInPlugin)Attribute.GetCustomAttribute(plugin, typeof(BepInPlugin));
							if (((TMP_Text)uITextByName2).text.EndsWith("</size>"))
							{
								((TMP_Text)uITextByName2).text = ((TMP_Text)uITextByName2).text + "\n\nMods Currently Installed:\n";
							}
							TextMeshProUGUI val2 = uITextByName2;
							((TMP_Text)val2).text = ((TMP_Text)val2).text + "\nLord Ashes' " + val.Name + " - " + val.Version;
						}
					}
				}
				catch (Exception ex)
				{
					Debug.Log((object)ex);
				}
			};
		}

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

		public static bool StrictKeyCheck(KeyboardShortcut check)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (!((KeyboardShortcut)(ref check)).IsUp())
			{
				return false;
			}
			KeyCode[] array = new KeyCode[6];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			KeyCode[] array2 = (KeyCode[])(object)array;
			foreach (KeyCode val in array2)
			{
				if (Input.GetKey(val) != ((KeyboardShortcut)(ref check)).Modifiers.Contains(val))
				{
					return false;
				}
			}
			return true;
		}

		public static Guid GuidFromString(string input)
		{
			using MD5 mD = MD5.Create();
			byte[] b = mD.ComputeHash(Encoding.Default.GetBytes(input));
			return new Guid(b);
		}

		public static GameObject GetBaseLoader(CreatureGuid cid)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				CreatureBoardAsset val = null;
				CreaturePresenter.TryGetAsset(cid, ref val);
				if ((Object)(object)val != (Object)null)
				{
					Transform match = null;
					Traverse(((Component)val).transform, "BaseLoader", 0, 10, ref match);
					if ((Object)(object)match != (Object)null)
					{
						return ((Component)match.GetChild(0)).gameObject;
					}
					return null;
				}
				return null;
			}
			catch
			{
				return null;
			}
		}

		public static GameObject GetAssetLoader(CreatureGuid cid)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				CreatureBoardAsset val = null;
				CreaturePresenter.TryGetAsset(cid, ref val);
				if ((Object)(object)val != (Object)null)
				{
					Transform match = null;
					Traverse(((Component)val).transform, "AssetLoader", 0, 10, ref match);
					if ((Object)(object)match != (Object)null)
					{
						if (match.childCount > 0)
						{
							return ((Component)match.GetChild(0)).gameObject;
						}
						return null;
					}
					return null;
				}
				return null;
			}
			catch
			{
				return null;
			}
		}

		public static void Traverse(Transform root, string seek, int depth, int depthMax, ref Transform match)
		{
			try
			{
				if ((Object)(object)match != (Object)null)
				{
					return;
				}
				if (((Object)root).name == seek)
				{
					match = root;
					return;
				}
				foreach (Transform item in ExtensionMethods.Children(root))
				{
					if (depth < depthMax)
					{
						Traverse(item, seek, depth + 1, depthMax, ref match);
					}
				}
			}
			catch
			{
			}
		}

		public static void DeleteChildrenCustomContent(Transform root, string seek, int depth, int depthMax)
		{
			try
			{
				if (Diagnostics() >= DiagnosticMode.ultra)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Deleting Children Custom Objects: Found '" + ((Object)root).name + " (" + ((Object)((Component)root).gameObject).name + ")', Seeking '" + seek + "', Depth=" + depth));
				}
				if (((Object)root).name.StartsWith(seek) || ((Object)((Component)root).gameObject).name.StartsWith(seek))
				{
					if (Diagnostics() >= DiagnosticMode.high)
					{
						Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Deleting Game Object " + ((Object)root).name + " (" + ((Object)((Component)root).gameObject).name + ")"));
					}
					Object.Destroy((Object)(object)((Component)root).gameObject);
				}
				foreach (Transform item in ExtensionMethods.Children(root))
				{
					if (depth < depthMax)
					{
						DeleteChildrenCustomContent(item, seek, depth + 1, depthMax);
					}
				}
			}
			catch
			{
			}
		}

		public static string GetCreatureName(string nameBlock)
		{
			if (nameBlock == null)
			{
				return "(Unknown)";
			}
			if (!nameBlock.Contains("<size=0>"))
			{
				return nameBlock;
			}
			return nameBlock.Substring(0, nameBlock.IndexOf("<size=0>")).Trim();
		}

		private static TextMeshProUGUI GetUITextByName(string name)
		{
			TextMeshProUGUI[] array = Object.FindObjectsOfType<TextMeshProUGUI>();
			for (int i = 0; i < array.Length; i++)
			{
				if (((Object)array[i]).name == name)
				{
					return array[i];
				}
			}
			return null;
		}
	}

	public enum DiagnosticMode
	{
		none,
		low,
		high,
		ultra
	}

	public enum OperationMode
	{
		rebuildIndexAlways,
		rebuildIndexIfMissing,
		rebuildNever
	}

	public class KeyboardHandler
	{
		public KeyboardShortcut trigger { get; set; }

		public string handlerMethod { get; set; }

		public object handlerParameter { get; set; }
	}

	public enum ModifierMode
	{
		diabled = 1,
		normal,
		scrollock
	}

	public const string Name = "Custom Assets Library Plugin Integrated Extension";

	public const string Guid = "org.lordashes.plugins.customassetslibraryintegratedextension";

	public const string Version = "2.5.0.0";

	public static CustomAssetsLibraryPluginIntegratedExtention _self = null;

	public bool pluginOk = false;

	public int tryCount = 0;

	public static Dictionary<string, KeyboardHandler> keyboardHandlers = new Dictionary<string, KeyboardHandler>
	{
		{
			"Play Animaton 01",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)49, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }),
				handlerMethod = "Animate",
				handlerParameter = 1
			}
		},
		{
			"Play Animaton 02",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)50, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }),
				handlerMethod = "Animate",
				handlerParameter = 2
			}
		},
		{
			"Play Animaton 03",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)51, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }),
				handlerMethod = "Animate",
				handlerParameter = 3
			}
		},
		{
			"Play Animaton 04",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)52, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }),
				handlerMethod = "Animate",
				handlerParameter = 4
			}
		},
		{
			"Play Animaton 05",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)53, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }),
				handlerMethod = "Animate",
				handlerParameter = 5
			}
		},
		{
			"Play Animaton 06",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)54, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }),
				handlerMethod = "Animate",
				handlerParameter = 6
			}
		},
		{
			"Play Animaton 07",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)55, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }),
				handlerMethod = "Animate",
				handlerParameter = 7
			}
		},
		{
			"Apply Blend Shape 01",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)49, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }),
				handlerMethod = "BlendShape",
				handlerParameter = 1
			}
		},
		{
			"Apply Blend Shape 02",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)50, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }),
				handlerMethod = "BlendShape",
				handlerParameter = 2
			}
		},
		{
			"Apply Blend Shape 03",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)51, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }),
				handlerMethod = "BlendShape",
				handlerParameter = 3
			}
		},
		{
			"Apply Blend Shape 04",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)52, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }),
				handlerMethod = "BlendShape",
				handlerParameter = 4
			}
		},
		{
			"Apply Blend Shape 05",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)53, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }),
				handlerMethod = "BlendShape",
				handlerParameter = 5
			}
		},
		{
			"Apply Blend Shape 06",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)54, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }),
				handlerMethod = "BlendShape",
				handlerParameter = 6
			}
		},
		{
			"Apply Blend Shape 07",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)55, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }),
				handlerMethod = "BlendShape",
				handlerParameter = 7
			}
		},
		{
			"Play Audio",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)57, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }),
				handlerMethod = "Audio",
				handlerParameter = -1
			}
		},
		{
			"Stop All",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)48, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }),
				handlerMethod = "Stop",
				handlerParameter = -1
			}
		},
		{
			"Stop All (Alternate)",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)48, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }),
				handlerMethod = "Stop",
				handlerParameter = -1
			}
		}
	};

	public static Dictionary<string, KeyboardHandler> keyboardHandlersForLocalActions = new Dictionary<string, KeyboardHandler>
	{
		{
			"Paste Multi-Slab",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)115, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }),
				handlerMethod = "BuildSlabs",
				handlerParameter = -1
			}
		},
		{
			"Analyze Game Object",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)97, (KeyCode[])(object)new KeyCode[1] { (KeyCode)305 }),
				handlerMethod = "Analyze",
				handlerParameter = -1
			}
		},
		{
			"Clean",
			new KeyboardHandler
			{
				trigger = new KeyboardShortcut((KeyCode)278, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }),
				handlerMethod = "Clean",
				handlerParameter = -1
			}
		}
	};

	private static MethodInfo spawnCreature = null;

	private ConfigEntry<DiagnosticMode> diagnosticMode { get; set; }

	public static ConfigEntry<ModifierMode> modifierMode { get; set; }

	public static ConfigEntry<float> showHideUpdateDelay { get; set; }

	public static ConfigEntry<string> animationNames { get; set; }

	public IEnumerator PostSpawnHandlerRouter(object[] inputs)
	{
		CreatureDataV2 creatureData = (CreatureDataV2)inputs[0];
		DbEntry databaseData = (DbEntry)inputs[1];
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Mini " + ((object)(CreatureGuid)(ref creatureData.CreatureId)).ToString() + " Placed (" + databaseData.Name + ")"));
		}
		yield return (object)new WaitForSeconds(0.1f);
		if (creatureData.Link == "SpawnMode=CodeSpawn")
		{
			creatureData.Link = "";
			yield break;
		}
		Dictionary<string, string> tags = new Dictionary<string, string>();
		string[] tags2 = ((DbEntry)inputs[1]).Tags;
		foreach (string item in tags2)
		{
			if (item.Contains(":"))
			{
				tags.Add(item.Substring(0, item.IndexOf(":")).ToUpper(), item.Substring(item.IndexOf(":") + 1));
			}
			else
			{
				tags.Add(item, item);
			}
		}
		if (!tags.ContainsKey("KIND"))
		{
			tags.Add("KIND", "Creature");
		}
		string kind = Helpers.ModifyKindBasedOnModifier(tags["KIND"]);
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Asset is kind " + tags["KIND"] + " being treated as " + kind));
		}
		((MonoBehaviour)_self).StartCoroutine("PostSpawn" + kind + "Handler", (object)new object[3] { creatureData, databaseData, tags });
		if (creatureData.Link != null && creatureData.Link.Trim() != "")
		{
			try
			{
			}
			catch (Exception)
			{
				Debug.LogWarning((object)"Custom Assets Library Plugin Integrated Extension: AssetDataPlugin Not Available. Notification Ignored");
			}
		}
	}

	public IEnumerator PostSpawnAudioHandler(object[] inputs)
	{
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Processing Audio");
		}
		CreatureDataV2 creatureData = (CreatureDataV2)inputs[0];
		_ = (DbEntry)inputs[1];
		_ = (Dictionary<string, string>)inputs[2];
		RequestHandler.ApplyAudio(creatureData.CreatureId, 1);
		yield return (object)new WaitForSeconds(0.1f);
	}

	public IEnumerator PostSpawnAuraHandler(object[] inputs)
	{
		CreatureDataV2 creatureData = (CreatureDataV2)inputs[0];
		_ = (DbEntry)inputs[1];
		_ = (Dictionary<string, string>)inputs[2];
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Processing Aura " + ((object)(CreatureGuid)(ref creatureData.CreatureId)).ToString()));
		}
		CreatureGuid selectedCreatureId = LocalClient.SelectedCreatureId;
		AssetDataPlugin.SetInfo(((object)(CreatureGuid)(ref selectedCreatureId)).ToString(), "org.lordashes.plugins.customassetslibraryintegratedextension.aura", ((object)(CreatureGuid)(ref creatureData.CreatureId)).ToString() + "@" + DateTime.UtcNow, false);
		yield return (object)new WaitForSeconds(0.1f);
	}

	public IEnumerator PostSpawnCreatureHandler(object[] inputs)
	{
		CreatureDataV2 creatureData = (CreatureDataV2)inputs[0];
		_ = (DbEntry)inputs[1];
		Dictionary<string, string> tags = (Dictionary<string, string>)inputs[2];
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Processing Creature " + ((object)(CreatureGuid)(ref creatureData.CreatureId)).ToString()));
		}
		yield return (object)new WaitForSeconds(0.1f);
		CreatureBoardAsset asset = null;
		CreaturePresenter.TryGetAsset(creatureData.CreatureId, ref asset);
		if ((Object)(object)asset != (Object)null)
		{
			((MonoBehaviour)_self).StartCoroutine(Helpers.ShowHide(asset, showHideUpdateDelay.Value));
		}
		if (Diagnostics() >= DiagnosticMode.ultra)
		{
			Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Looking For Variants");
		}
		if (!tags.ContainsKey("VARIANTS"))
		{
			yield break;
		}
		if (Diagnostics() >= DiagnosticMode.ultra)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Variants Tag Is " + Convert.ToString(tags["VARIANTS"])));
		}
		if (tags["VARIANTS"] == null || !(tags["VARIANTS"] != ""))
		{
			yield break;
		}
		List<ElemData> morphs = new List<ElemData>();
		string[] array = tags["VARIANTS"].Split(new string[1] { "|" }, StringSplitOptions.RemoveEmptyEntries);
		foreach (string stringId in array)
		{
			if (Diagnostics() >= DiagnosticMode.ultra)
			{
				Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Ading Moprh '" + stringId + "'"));
			}
			morphs.Add(new ElemData(new BoardObjectGuid(stringId), 1f));
		}
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Applying Moprhs List");
		}
		CreatureManager.SendMorphListChanges(asset.CreatureId, morphs);
	}

	public IEnumerator PostSpawnEffectHandler(object[] inputs)
	{
		CreatureDataV2 creatureData = (CreatureDataV2)inputs[0];
		_ = (DbEntry)inputs[1];
		_ = (Dictionary<string, string>)inputs[2];
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Processing Effect " + ((object)(CreatureGuid)(ref creatureData.CreatureId)).ToString()));
		}
		yield return (object)new WaitForSeconds(0.1f);
		CreatureBoardAsset asset = null;
		CreaturePresenter.TryGetAsset(creatureData.CreatureId, ref asset);
		if ((Object)(object)asset != (Object)null)
		{
			((MonoBehaviour)_self).StartCoroutine(Helpers.ShowHide(asset, showHideUpdateDelay.Value));
		}
	}

	public IEnumerator PostSpawnEncounterHandler(object[] inputs)
	{
		CreatureDataV2 creatureData = (CreatureDataV2)inputs[0];
		_ = (DbEntry)inputs[1];
		_ = (Dictionary<string, string>)inputs[2];
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Processing Encounter " + ((object)(CreatureGuid)(ref creatureData.CreatureId)).ToString()));
		}
		yield return (object)new WaitForSeconds(0.1f);
	}

	public IEnumerator PostSpawnFilterHandler(object[] inputs)
	{
		CreatureDataV2 filterData = (CreatureDataV2)inputs[0];
		_ = (DbEntry)inputs[1];
		_ = (Dictionary<string, string>)inputs[2];
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Processing Filter " + ((object)(CreatureGuid)(ref filterData.CreatureId)).ToString()));
		}
		AssetDataPlugin.SetInfo(((object)(CreatureGuid)(ref CreatureGuid.Empty)).ToString(), "org.lordashes.plugins.customassetslibraryintegratedextension.filter", ((object)(CreatureGuid)(ref filterData.CreatureId)).ToString(), false);
		yield return (object)new WaitForSeconds(0.1f);
	}

	public IEnumerator PostSpawnPropHandler(object[] inputs)
	{
		CreatureDataV2 creatureData = (CreatureDataV2)inputs[0];
		_ = (DbEntry)inputs[1];
		_ = (Dictionary<string, string>)inputs[2];
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Processing Prop " + ((object)(CreatureGuid)(ref creatureData.CreatureId)).ToString()));
		}
		yield return (object)new WaitForSeconds(0.1f);
	}

	public IEnumerator PostSpawnSlabHandler(object[] inputs)
	{
		CreatureDataV2 creatureData = (CreatureDataV2)inputs[0];
		_ = (DbEntry)inputs[1];
		_ = (Dictionary<string, string>)inputs[2];
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Processing Slab " + ((object)(CreatureGuid)(ref creatureData.CreatureId)).ToString()));
		}
		yield return (object)new WaitForSeconds(0.1f);
	}

	public IEnumerator PostSpawnTileHandler(object[] inputs)
	{
		CreatureDataV2 creatureData = (CreatureDataV2)inputs[0];
		_ = (DbEntry)inputs[1];
		_ = (Dictionary<string, string>)inputs[2];
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Processing Tile " + ((object)(CreatureGuid)(ref creatureData.CreatureId)).ToString()));
		}
		yield return (object)new WaitForSeconds(0.1f);
	}

	public IEnumerator PostSpawnTransformHandler(object[] inputs)
	{
		CreatureDataV2 creatureData = (CreatureDataV2)inputs[0];
		_ = (DbEntry)inputs[1];
		_ = (Dictionary<string, string>)inputs[2];
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Processing Transform " + ((object)(CreatureGuid)(ref creatureData.CreatureId)).ToString()));
		}
		CreatureBoardAsset assetOrig = default(CreatureBoardAsset);
		CreaturePresenter.TryGetAsset(LocalClient.SelectedCreatureId, ref assetOrig);
		CreatureBoardAsset assetNew = default(CreatureBoardAsset);
		CreaturePresenter.TryGetAsset(creatureData.CreatureId, ref assetNew);
		Utility.GetAssetLoader(creatureData.CreatureId);
		if ((Object)(object)assetOrig != (Object)null && (Object)(object)assetNew != (Object)null)
		{
			Vector3 pos = ((MovableBoardAsset)assetOrig).CorrectPos;
			Quaternion rot = ((MovableBoardAsset)assetOrig).CorrectRotation;
			float height = ((MovableBoardAsset)assetOrig).CorrectHeight;
			if (Diagnostics() >= DiagnosticMode.high)
			{
				Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Removing Old Asset");
			}
			assetOrig.RequestDelete();
			if (Diagnostics() >= DiagnosticMode.high)
			{
				Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Adjusting New Asset");
			}
			((MovableBoardAsset)assetNew).CorrectPos = pos;
			((MovableBoardAsset)assetNew).CorrectRotation = rot;
			((MovableBoardAsset)assetNew).CorrectHeight = height;
		}
		yield return (object)new WaitForSeconds(0.1f);
	}

	public static bool PreSpawnHandlerRouter(NGuid guid, DbEntry entry)
	{
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		Dictionary<string, string> dictionary = new Dictionary<string, string>();
		string[] tags = entry.Tags;
		foreach (string text in tags)
		{
			if (text.Contains(":"))
			{
				dictionary.Add(text.Substring(0, text.IndexOf(":")).ToUpper(), text.Substring(text.IndexOf(":") + 1));
			}
			else
			{
				dictionary.Add(text, text);
			}
		}
		if (!dictionary.ContainsKey("KIND"))
		{
			dictionary.Add("KIND", "Creature");
		}
		string text2 = Helpers.ModifyKindBasedOnModifier(dictionary["KIND"]);
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Pre Spawn Router: Asset is kind " + dictionary["KIND"] + " being treated as " + text2));
		}
		return (bool)typeof(CustomAssetsLibraryPluginIntegratedExtention).GetMethod("PreSpawn" + text2 + "Handler").Invoke(null, new object[3] { guid, entry, dictionary });
	}

	public static bool PreSpawnAudioHandler(NGuid nguid, DbEntry databaseData, Dictionary<string, string> tags)
	{
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Processing Audio Of Type " + ((object)(NGuid)(ref nguid)).ToString()));
		}
		return true;
	}

	public static bool PreSpawnAuraHandler(NGuid nguid, DbEntry databaseData, Dictionary<string, string> tags)
	{
		//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_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Processing Aura Of Type " + ((object)(NGuid)(ref nguid)).ToString()));
		}
		Helpers.SpawnPrevent();
		CreatureGuid selectedCreatureId = LocalClient.SelectedCreatureId;
		string text = AssetDataPlugin.ReadInfo(((object)(CreatureGuid)(ref selectedCreatureId)).ToString(), "org.lordashes.plugins.customassetslibraryintegratedextension.aura");
		if (Diagnostics() >= DiagnosticMode.ultra)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Aura Status = '" + text + "'"));
		}
		if (text != null && text != "")
		{
			if (Diagnostics() >= DiagnosticMode.ultra)
			{
				Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Clearing Previous Aura");
			}
			string text2 = text.Substring(text.IndexOf("@") + 1);
			selectedCreatureId = LocalClient.SelectedCreatureId;
			AssetDataPlugin.ClearInfo(((object)(CreatureGuid)(ref selectedCreatureId)).ToString(), "org.lordashes.plugins.customassetslibraryintegratedextension.aura", false);
		}
		Helpers.SpawnCreatureByNGuid(nguid);
		return false;
	}

	public static bool PreSpawnCreatureHandler(NGuid nguid, DbEntry databaseData, Dictionary<string, string> tags)
	{
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Processing Creature Of Type " + ((object)(NGuid)(ref nguid)).ToString()));
		}
		return true;
	}

	public static bool PreSpawnEffectHandler(NGuid nguid, DbEntry databaseData, Dictionary<string, string> tags)
	{
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Processing Effect Of Type " + ((object)(NGuid)(ref nguid)).ToString()));
		}
		return true;
	}

	public static bool PreSpawnEncounterHandler(NGuid nguid, DbEntry databaseData, Dictionary<string, string> tags)
	{
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Processing Encounter Of Type " + ((object)(NGuid)(ref nguid)).ToString()));
		}
		SystemMessage.DisplayInfoText("Encounter Type Is Not Yet Supported", 2.5f);
		Helpers.SpawnPrevent();
		return false;
	}

	public static bool PreSpawnFilterHandler(NGuid nguid, DbEntry databaseData, Dictionary<string, string> tags)
	{
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Processing Filter Of Type " + ((object)(NGuid)(ref nguid)).ToString()));
		}
		Helpers.SpawnPrevent();
		if (Diagnostics() >= DiagnosticMode.ultra)
		{
			Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Checking For Existing Camera Filter");
		}
		string text = AssetDataPlugin.ReadInfo(((object)(CreatureGuid)(ref CreatureGuid.Empty)).ToString(), "org.lordashes.plugins.customassetslibraryintegratedextension.filter");
		if (Diagnostics() >= DiagnosticMode.ultra)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Requested NGuid '" + ((object)(NGuid)(ref nguid)).ToString() + "', Previous NGuid '" + text + "'"));
		}
		if (text != null && text != "" && text != ((object)(NGuid)(ref NGuid.Empty)).ToString())
		{
			if (Diagnostics() >= DiagnosticMode.ultra)
			{
				Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Clearing Previous Filter");
			}
			AssetDataPlugin.ClearInfo(((object)(CreatureGuid)(ref CreatureGuid.Empty)).ToString(), "org.lordashes.plugins.customassetslibraryintegratedextension.filter", false);
		}
		else
		{
			if (Diagnostics() >= DiagnosticMode.ultra)
			{
				Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Spawning Selected Filter");
			}
			Helpers.SpawnCreatureByNGuid(nguid);
		}
		return false;
	}

	public static bool PreSpawnPropHandler(NGuid nguid, DbEntry databaseData, Dictionary<string, string> tags)
	{
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Processing Prop Of Type " + ((object)(NGuid)(ref nguid)).ToString()));
		}
		return true;
	}

	public static bool PreSpawnSlabHandler(NGuid nguid, DbEntry databaseData, Dictionary<string, string> tags)
	{
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Processing Slab Of Type " + ((object)(NGuid)(ref nguid)).ToString()));
		}
		Helpers.SpawnPrevent();
		string text = tags["ASSETBUNDLE"];
		AssetBundle val = null;
		foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles())
		{
			if (allLoadedAssetBundle.GetAllAssetNames().Contains<string>(Path.GetFileNameWithoutExtension(text)))
			{
				val = allLoadedAssetBundle;
			}
		}
		if ((Object)(object)val == (Object)null)
		{
			val = AssetBundle.LoadFromFile(text);
		}
		string code = JsonConvert.DeserializeObject<Data.AssetInfo>(val.LoadAsset<TextAsset>("Info.txt").text).code;
		((MonoBehaviour)_self).StartCoroutine(RequestHandler.BuildMultipleSlabs(code, 0.1f));
		return false;
	}

	public static bool PreSpawnTileHandler(NGuid nguid, DbEntry databaseData, Dictionary<string, string> tags)
	{
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Processing Tile Of Type " + ((object)(NGuid)(ref nguid)).ToString()));
		}
		return true;
	}

	public static bool PreSpawnTransformHandler(NGuid nguid, DbEntry databaseData, Dictionary<string, string> tags)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		if (Diagnostics() >= DiagnosticMode.high)
		{
			Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Pre Spawn Handler: Processing Transform Of Type " + ((object)(NGuid)(ref nguid)).ToString()));
		}
		Helpers.SpawnPrevent();
		Helpers.SpawnCreatureByNGuid(nguid);
		return false;
	}

	public static void RemoteRequestRouter(DatumChange request)
	{
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_06b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_064e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0623: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0666: Unknown result type (might be due to invalid IL or missing references)
		//IL_0577: Unknown result type (might be due to invalid IL or missing references)
		//IL_0679: Unknown result type (might be due to invalid IL or missing references)
		//IL_068f: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b3: 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_05ca: Unknown result type (might be due to invalid IL or missing references)
		ChangeAction action;
		if (Diagnostics() >= DiagnosticMode.low)
		{
			string[] obj = new string[10] { "Custom Assets Library Plugin Integrated Extension: Remote ", null, null, null, null, null, null, null, null, null };
			action = request.action;
			obj[1] = ((object)(ChangeAction)(ref action)).ToString();
			obj[2] = " Request For ";
			obj[3] = request.key;
			obj[4] = " (For ";
			obj[5] = request.source;
			obj[6] = ") ";
			obj[7] = request.previous?.ToString();
			obj[8] = "->";
			obj[9] = request.value?.ToString();
			Debug.Log((object)string.Concat(obj));
		}
		request.key = request.key.Substring("org.lordashes.plugins.customassetslibraryintegratedextension".Length + 1);
		string text = request.key.ToLower();
		action = request.action;
		request.key = text + "." + ((object)(ChangeAction)(ref action)).ToString().ToLower();
		request.value = (request.value.ToString() + "@").Substring(0, (request.value.ToString() + "@").IndexOf("@"));
		switch (request.key)
		{
		case "animate.initial":
		case "animate.add":
		case "animate.modify":
			RequestHandler.ApplyAnimate(new CreatureGuid(request.source), request.value.ToString());
			break;
		case "animate.remove":
			RequestHandler.ApplyAnimate(new CreatureGuid(request.source), "-1");
			break;
		case "audio.initial":
		case "audio.add":
		case "audio.modify":
			RequestHandler.ApplyAudio(new CreatureGuid(request.source), 1);
			break;
		case "audio.remove":
			RequestHandler.ApplyAudio(new CreatureGuid(request.source), -1);
			break;
		case "aura.initial":
		case "aura.add":
		case "aura.modify":
			RequestHandler.ApplyAura(new CreatureGuid(request.source), new CreatureGuid(request.value.ToString()));
			break;
		case "aura.remove":
			RequestHandler.RemoveAura(request.source, Convert.ToString(request.previous));
			break;
		case "blendshape.initial":
		case "blendshape.add":
		case "blendshape.modify":
			RequestHandler.ApplyBlendShapeSequence(new CreatureGuid(request.source), int.Parse(request.value.ToString()));
			break;
		case "filter.initial":
		case "filter.add":
		case "filter.modify":
			RequestHandler.ApplyFilter(new CreatureGuid(Convert.ToString(request.value)));
			break;
		case "filter.remove":
			RequestHandler.RemoveFilter(new CreatureGuid(Convert.ToString(request.previous)));
			break;
		case "stop.initial":
		case "stop.add":
		case "stop.modify":
		case "stop.remove":
			RequestHandler.ApplyAnimate(new CreatureGuid(request.source), "-1");
			RequestHandler.ApplyAudio(new CreatureGuid(request.source), -1);
			RequestHandler.ApplyBlendShapeSequence(new CreatureGuid(request.source), -1);
			break;
		case "analyze.initial":
		case "analyze.add":
		case "analyze.modify":
		case "anazyle.remove":
			RequestHandler.Analyze(new CreatureGuid(request.source), -1);
			break;
		}
	}

	private void Awake()
	{
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Expected O, but got Unknown
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: 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_0257: Unknown result type (might be due to invalid IL or missing references)
		//IL_025d: Expected O, but got Unknown
		_self = this;
		diagnosticMode = ((BaseUnityPlugin)this).Config.Bind<DiagnosticMode>("Troubleshooting", "Diagnostic Mode", DiagnosticMode.high, (ConfigDescription)null);
		Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: " + ((object)this).GetType().AssemblyQualifiedName + " Active. Diagnostic Level = " + diagnosticMode.Value));
		showHideUpdateDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Delay After Spawn To Update Non-TS Shader Content", 3f, (ConfigDescription)null);
		animationNames = ((BaseUnityPlugin)this).Config.Bind<string>("Settings", "Animation Names", "Idle,Ready,Melee,Range,Dead,Magic", (ConfigDescription)null);
		modifierMode = ((BaseUnityPlugin)this).Config.Bind<ModifierMode>("Settings", "Modifier Mode", ModifierMode.normal, (ConfigDescription)null);
		RadialUIPlugin.AddCustomButtonOnCharacter("org.lordashes.plugins.customassetslibraryintegratedextension.RemoveAura", new ItemArgs
		{
			Action = delegate
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				if (Diagnostics() >= DiagnosticMode.ultra)
				{
					Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Clearing Aura On " + Convert.ToString(LocalClient.SelectedCreatureId)));
				}
				CreatureGuid selectedCreatureId = LocalClient.SelectedCreatureId;
				AssetDataPlugin.ClearInfo(((object)(CreatureGuid)(ref selectedCreatureId)).ToString(), "org.lordashes.plugins.customassetslibraryintegratedextension.aura", false);
			},
			FadeName = true,
			CloseMenuOnActivate = true,
			Icon = Image.LoadSprite("RemoveAura.png", (CacheType)999),
			Title = "Remove Aura"
		}, (Func<NGuid, NGuid, bool>)null);
		for (int i = 0; i < keyboardHandlers.Count; i++)
		{
			keyboardHandlers[keyboardHandlers.ElementAt(i).Key].trigger = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", keyboardHandlers.ElementAt(i).Key, keyboardHandlers.ElementAt(i).Value.trigger, (ConfigDescription)null).Value;
		}
		for (int j = 0; j < keyboardHandlersForLocalActions.Count; j++)
		{
			keyboardHandlersForLocalActions[keyboardHandlersForLocalActions.ElementAt(j).Key].trigger = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", keyboardHandlersForLocalActions.ElementAt(j).Key, keyboardHandlersForLocalActions.ElementAt(j).Value.trigger, (ConfigDescription)null).Value;
		}
		BoardSessionManager.OnCurrentBoardChanged += delegate
		{
			Debug.Log((object)"Custom Assets Library Plugin Integrated Extension: Board Change. Removing All Board Filters.");
			GameObject[] array4 = (from g in Object.FindObjectsByType<GameObject>((FindObjectsSortMode)0)
				where ((Object)g).name.StartsWith("CustomContent:Filter:") || ((Object)g).name.StartsWith("CustomContent:Base:")
				select g).ToArray();
			for (int n = 0; n < array4.Count(); n++)
			{
				Object.Destroy((Object)(object)array4[n]);
			}
			array4 = null;
		};
		Harmony val = new Harmony("org.lordashes.plugins.customassetslibraryintegratedextension");
		try
		{
			val.PatchAll();
			pluginOk = true;
			string[] array = new string[4] { "animate", "audio", "blendshape", "stop" };
			foreach (string text in array)
			{
				AssetDataPlugin.Subscribe("org.lordashes.plugins.customassetslibraryintegratedextension." + text, (Action<DatumChange>)RemoteRequestRouter, (Func<DatumChange, bool>)Checker.CheckSourceAsCreature);
			}
			string[] array2 = new string[1] { "aura" };
			foreach (string text2 in array2)
			{
				AssetDataPlugin.Subscribe("org.lordashes.plugins.customassetslibraryintegratedextension." + text2, (Action<DatumChange>)RemoteRequestRouter, (Func<DatumChange, bool>)Checker.CheckSourceAndValueAsCreature);
			}
			string[] array3 = new string[1] { "filter" };
			foreach (string text3 in array3)
			{
				AssetDataPlugin.Subscribe("org.lordashes.plugins.customassetslibraryintegratedextension." + text3, (Action<DatumChange>)RemoteRequestRouter, (Func<DatumChange, bool>)delegate(DatumChange dc)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Invalid comparison between Unknown and I4
					//IL_0052: Unknown result type (might be due to invalid IL or missing references)
					if ((int)dc.action != 1)
					{
						if (Diagnostics() >= DiagnosticMode.high)
						{
							Debug.Log((object)("Custom Assets Library Plugin Integrated Extension: Post Spawn Handler: Checking Filter " + dc.value));
						}
						CreatureBoardAsset val2 = null;
						CreaturePresenter.TryGetAsset(new CreatureGuid(dc.value.ToString()), ref val2);
						if ((Object)(object)val2 != (Object)null)
						{
							return true;
						}
						return false;
					}
					if (Diagnostics() >= DiagnosticMode.high)
					{
						Debug.Log((object)"Custom Assets Library Plugin