Decompiled source of SnowtimeToybox v1.2.1

plugins/SnowtimeSkins.dll

Decompiled 5 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using MonoMod.RuntimeDetour;
using MonoMod.RuntimeDetour.HookGen;
using RoR2;
using RuneFoxMods.DynamicSkins;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace SnowtimeSkins
{
	[BepInPlugin("com.winterwonderland.SnowtimeSkins", "Snowtime Skins", "1.0.0")]
	public class SnowtimeSkinsPlugin : BaseUnityPlugin
	{
		public class DynamicSkinExtension
		{
			private Modification SnowtimeSkinsVRCSnowtime01snowtime_snowflakeModification;

			private Modification SnowtimeSkinsVRCSnowtime01snowtime_weaponModification;

			private Modification SnowtimeSkinsVRCSnowtime01outfit_extendedModification;

			private Modification SnowtimeSkinsVRCSnowtime01neko_hair_updModification;

			private Modification SnowtimeSkinsVRCSnowtime01neko_ears_updModification;

			private Modification SnowtimeSkinsVRCSnowtime01neko_tail_updModification;

			private Modification SnowtimeSkinsVRCShortcakeshortcake_hair01Modification;

			private Modification SnowtimeSkinsVRCShortcakeshortcake_hair02Modification;

			internal void BeforeStart()
			{
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				_DynamicSkinManager.InstanceLogger = ((BaseUnityPlugin)Instance).Logger;
				new Hook((MethodBase)typeof(SkinDef).GetMethod("Apply"), (Delegate)new Action<Action<SkinDef, GameObject>, SkinDef, GameObject>(_DynamicSkinManager.SkinDefApply)).Apply();
			}

			internal void AfterStart()
			{
				InitializeModifications();
				InitializeDynamicBones();
				AddModificationsToList();
			}

			internal void BeforeBodyCatalogInit()
			{
				DroneTechBodySnowtimeSkinsVRCSnowtime01SkinAddedEvent += onSkinAdded;
				MageBodySnowtimeSkinsVRCShortcakeSkinAddedEvent += onSkinAdded;
			}

			internal void AfterBodyCatalogInit()
			{
			}

			private void InitializeModifications()
			{
				SnowtimeSkinsVRCSnowtime01snowtime_snowflakeModification = new Modification("snowtime_snowflake.prefab", "head", "DroneTechBody", "WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME01_NAME", -1, AffectsBaseModel: false, assetBundle);
				SnowtimeSkinsVRCSnowtime01snowtime_weaponModification = new Modification("snowtime_weapon.prefab", "weapon_M", "DroneTechBody", "WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME01_NAME", -2, AffectsBaseModel: false, assetBundle);
				SnowtimeSkinsVRCSnowtime01outfit_extendedModification = new Modification("outfit_extended.prefab", "pelvis", "DroneTechBody", "WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME01_NAME", -3, AffectsBaseModel: false, assetBundle);
				SnowtimeSkinsVRCSnowtime01neko_hair_updModification = new Modification("neko_hair_upd.prefab", "head", "DroneTechBody", "WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME01_NAME", -4, AffectsBaseModel: false, assetBundle);
				SnowtimeSkinsVRCSnowtime01neko_ears_updModification = new Modification("neko_ears_upd.prefab", "head", "DroneTechBody", "WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME01_NAME", -5, AffectsBaseModel: false, assetBundle);
				SnowtimeSkinsVRCSnowtime01neko_tail_updModification = new Modification("neko_tail_upd.prefab", "pelvis", "DroneTechBody", "WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME01_NAME", -6, AffectsBaseModel: false, assetBundle);
				SnowtimeSkinsVRCShortcakeshortcake_hair01Modification = new Modification("shortcake_hair01.prefab", "head", "MageBody", "WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSHORTCAKE_NAME", -1, AffectsBaseModel: false, assetBundle);
				SnowtimeSkinsVRCShortcakeshortcake_hair02Modification = new Modification("shortcake_hair02.prefab", "head", "MageBody", "WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSHORTCAKE_NAME", -2, AffectsBaseModel: false, assetBundle);
			}

			private void InitializeDynamicBones()
			{
				//IL_003d: 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_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_013b: Unknown result type (might be due to invalid IL or missing references)
				//IL_014f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0163: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_025a: Unknown result type (might be due to invalid IL or missing references)
				//IL_026e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0282: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_030c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0363: Unknown result type (might be due to invalid IL or missing references)
				//IL_0377: Unknown result type (might be due to invalid IL or missing references)
				//IL_038b: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_0401: 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)
				SnowtimeSkinsVRCSnowtime01snowtime_snowflakeModification.dynamicBoneData = new DynamicBoneData("dynamicboneroot", 0.2f, null, 0.05f, null, 0.5f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0);
				SnowtimeSkinsVRCSnowtime01snowtime_weaponModification.dynamicBoneData = new DynamicBoneData("db_one", 0.1f, null, 0.1f, null, 0.1f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0);
				SnowtimeSkinsVRCSnowtime01outfit_extendedModification.dynamicBoneData = new DynamicBoneData("coat_root01", 0.35f, null, 0.1f, null, 0.4f, null, 0.15f, null, 0f, null, 1.7f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string> { "coat_root01", "coat_woah" }, (FreezeAxis)0);
				SnowtimeSkinsVRCSnowtime01neko_hair_updModification.dynamicBoneData = new DynamicBoneData("ponytail_root", 0.35f, null, 0.1f, null, 0.3f, null, 0.05f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string> { "ponytail_root" }, (FreezeAxis)0);
				SnowtimeSkinsVRCSnowtime01neko_ears_updModification.dynamicBoneData = new DynamicBoneData("neko_root", 0.35f, null, 0.1f, null, 0.8f, null, 0f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string> { "neko_root" }, (FreezeAxis)0);
				SnowtimeSkinsVRCSnowtime01neko_tail_updModification.dynamicBoneData = new DynamicBoneData("tail_root", 0.35f, null, 0.1f, null, 0.3f, null, 0.1f, null, 0f, null, 1f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string>(), (FreezeAxis)0);
				SnowtimeSkinsVRCShortcakeshortcake_hair01Modification.dynamicBoneData = new DynamicBoneData("hair_root", 0.5f, null, 0.3f, null, 0.7f, null, 0.25f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string> { "hair_root" }, (FreezeAxis)0);
				SnowtimeSkinsVRCShortcakeshortcake_hair02Modification.dynamicBoneData = new DynamicBoneData("ears_root", 0.35f, null, 0.1f, null, 0.3f, null, 0.05f, null, 0f, null, 0f, new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, 0f), new List<DynamicBoneColliderData>(), new List<string> { "ears_root" }, (FreezeAxis)0);
			}

			private void AddModificationsToList()
			{
				_DynamicSkinManager.AddModification("WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME01_NAME", -1, SnowtimeSkinsVRCSnowtime01snowtime_snowflakeModification);
				_DynamicSkinManager.AddModification("WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME01_NAME", -2, SnowtimeSkinsVRCSnowtime01snowtime_weaponModification);
				_DynamicSkinManager.AddModification("WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME01_NAME", -3, SnowtimeSkinsVRCSnowtime01outfit_extendedModification);
				_DynamicSkinManager.AddModification("WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME01_NAME", -4, SnowtimeSkinsVRCSnowtime01neko_hair_updModification);
				_DynamicSkinManager.AddModification("WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME01_NAME", -5, SnowtimeSkinsVRCSnowtime01neko_ears_updModification);
				_DynamicSkinManager.AddModification("WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME01_NAME", -6, SnowtimeSkinsVRCSnowtime01neko_tail_updModification);
				_DynamicSkinManager.AddModification("WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSHORTCAKE_NAME", -1, SnowtimeSkinsVRCShortcakeshortcake_hair01Modification);
				_DynamicSkinManager.AddModification("WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSHORTCAKE_NAME", -2, SnowtimeSkinsVRCShortcakeshortcake_hair02Modification);
			}

			private static void onSkinAdded(object sender, SkinAddedArgs e)
			{
				_DynamicSkinManager.AddSkinDef(e.skinDef);
			}
		}

		public delegate void VoidDelegate();

		public class SkinAddedArgs : EventArgs
		{
			public SkinDef skinDef { get; }

			public GameObject bodyPrefab { get; }

			public SkinAddedArgs(SkinDef newSkinDef, GameObject newGameObject)
			{
				skinDef = newSkinDef;
				bodyPrefab = newGameObject;
			}
		}

		private class FieldException : Exception
		{
			public FieldException(string message, Exception innerException)
				: base(message, innerException)
			{
			}
		}

		private class ElementException : Exception
		{
			public int Index { get; }

			public ElementException(int index, string message)
				: base(message)
			{
				Index = index;
			}
		}

		private static DynamicSkinExtension _DynamicSkinExtension = new DynamicSkinExtension();

		private static DynamicSkinManager _DynamicSkinManager = new DynamicSkinManager();

		private static VoidDelegate BeforeStartDelegate;

		private static VoidDelegate AfterStartDelegate;

		private static VoidDelegate BeforeBodyCatalogDelegate;

		private static VoidDelegate AfterBodyCatalogDelegate;

		private static AssetBundle assetBundle;

		internal static SnowtimeSkinsPlugin Instance { get; private set; }

		internal static ManualLogSource InstanceLogger
		{
			get
			{
				SnowtimeSkinsPlugin instance = Instance;
				if (instance == null)
				{
					return null;
				}
				return ((BaseUnityPlugin)instance).Logger;
			}
		}

		private static event EventHandler<SkinAddedArgs> DroneTechBodySnowtimeSkinsVRCSnowtime01SkinAddedEvent;

		private static event EventHandler<SkinAddedArgs> DTGunnerDroneBodySnowtimeSkinsVRCSnowtime02SkinAddedEvent;

		private static event EventHandler<SkinAddedArgs> Drone1BodySnowtimeSkinsVRCSnowtime02_genericSkinAddedEvent;

		private static event EventHandler<SkinAddedArgs> MissileDroneBodySnowtimeSkinsVRCSnowtime03SkinAddedEvent;

		private static event EventHandler<SkinAddedArgs> MegaDroneBodySnowtimeSkinsVRCSnowtime04SkinAddedEvent;

		private static event EventHandler<SkinAddedArgs> BackupDroneBodySnowtimeSkinsVRCSnowtime05SkinAddedEvent;

		private static event EventHandler<SkinAddedArgs> MageBodySnowtimeSkinsVRCShortcakeSkinAddedEvent;

		private void Start()
		{
			Instance = this;
			BeforeStart();
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("SnowtimeSkins.winterwonderlandsnowtimeskins"))
			{
				assetBundle = AssetBundle.LoadFromStream(stream);
			}
			((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)BodyCatalogInit);
			HookEndpointManager.Add((MethodBase)typeof(Language).GetMethod("LoadStrings"), (Delegate)new Action<Action<Language>, Language>(LanguageLoadStrings));
			AfterStart();
		}

		private void BeforeStart()
		{
			BeforeStartDelegate = (VoidDelegate)Delegate.Combine(BeforeStartDelegate, new VoidDelegate(_DynamicSkinExtension.BeforeStart));
			BeforeStartDelegate?.Invoke();
		}

		private void AfterStart()
		{
			AfterStartDelegate = (VoidDelegate)Delegate.Combine(AfterStartDelegate, new VoidDelegate(_DynamicSkinExtension.AfterStart));
			AfterStartDelegate?.Invoke();
		}

		private static void BeforeBodyCatalogInit()
		{
			BeforeBodyCatalogDelegate = (VoidDelegate)Delegate.Combine(BeforeBodyCatalogDelegate, new VoidDelegate(_DynamicSkinExtension.BeforeBodyCatalogInit));
			BeforeBodyCatalogDelegate?.Invoke();
		}

		private static void AfterBodyCatalogInit()
		{
			AfterBodyCatalogDelegate = (VoidDelegate)Delegate.Combine(AfterBodyCatalogDelegate, new VoidDelegate(_DynamicSkinExtension.AfterBodyCatalogInit));
			AfterBodyCatalogDelegate?.Invoke();
		}

		private static void LanguageLoadStrings(Action<Language> orig, Language self)
		{
			orig(self);
			self.SetStringByToken("WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME02_NAME", "B4NSH33");
			self.SetStringByToken("WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME02_GENERIC_NAME", "B4NSH33");
			self.SetStringByToken("WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME03_NAME", "B4NSH33");
			self.SetStringByToken("WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME04_NAME", "B4NSH33");
			self.SetStringByToken("WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME05_NAME", "B4NSH33");
			self.SetStringByToken("WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSHORTCAKE_NAME", "Kate (Shortcake)");
			self.SetStringByToken("WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME01_NAME", "Anastasia Winters (SnowySnowtime)");
		}

		private static void BodyCatalogInit()
		{
			BeforeBodyCatalogInit();
			AddDTGunnerDroneBodySnowtimeSkinsVRCSnowtime02Skin();
			AddDrone1BodySnowtimeSkinsVRCSnowtime02_genericSkin();
			AddMissileDroneBodySnowtimeSkinsVRCSnowtime03Skin();
			AddMegaDroneBodySnowtimeSkinsVRCSnowtime04Skin();
			AddBackupDroneBodySnowtimeSkinsVRCSnowtime05Skin();
			AddMageBodySnowtimeSkinsVRCShortcakeSkin();
			AddDroneTechBodySnowtimeSkinsVRCSnowtime01Skin();
			AfterBodyCatalogInit();
		}

		private static void DTGunnerDroneBodySnowtimeSkinsVRCSnowtime02SkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SnowtimeSkinsPlugin.DTGunnerDroneBodySnowtimeSkinsVRCSnowtime02SkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab));
		}

		private static void AddDTGunnerDroneBodySnowtimeSkinsVRCSnowtime02Skin()
		{
			string text = "DTGunnerDroneBody";
			string text2 = "SnowtimeSkinsVRCSnowtime02";
			try
			{
				GameObject val = BodyCatalog.FindBodyPrefab(text);
				if (!Object.op_Implicit((Object)(object)val))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist"));
					return;
				}
				ModelLocator component = val.GetComponent<ModelLocator>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component"));
					return;
				}
				GameObject gameObject = ((Component)component.modelTransform).gameObject;
				ModelSkinController val2 = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null);
				if (!Object.op_Implicit((Object)(object)val2))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component"));
					return;
				}
				Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true);
				gameObject.GetComponentsInChildren<Light>(true);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				SkinDefParams skinParams = ScriptableObject.CreateInstance<SkinDefParams>();
				skin.skinDefParams = skinParams;
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets/snowtime/halo/hunkevolved/Icons/HaloCESpartan_SnowtimeIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME02_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = Array.Empty<SkinDef>();
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_0078: Unknown result type (might be due to invalid IL or missing references)
					//IL_007d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0093: Unknown result type (might be due to invalid IL or missing references)
					//IL_0098: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cf: 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_012f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0130: Unknown result type (might be due to invalid IL or missing references)
					skinParams.gameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[2]
					{
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Renderer>(0, "There is no renderer with the name \"Drone1Mesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Drone1Mesh")))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = true,
							localPosition = new Vector3(0.5f, -1.3f, -4f),
							localRotation = new Vector3(0f, 0f, 20f),
							localScale = new Vector3(1f, 1f, 1f),
							prefab = assetBundle.LoadAsset<GameObject>("Assets/snowtime/halo/hunkevolved/prefab/banshee_fx_ce.prefab")
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Renderer>(1, "There is no renderer with the name \"Drone1BladeActive\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Drone1BladeActive")))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						}
					};
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_002f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0078: Unknown result type (might be due to invalid IL or missing references)
					//IL_0079: Unknown result type (might be due to invalid IL or missing references)
					skinParams.rendererInfos = (RendererInfo[])(object)new RendererInfo[1]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/snowtime/templatematerial/banshee/banshee.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)2,
							ignoreOverlays = false,
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"Drone1Mesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Drone1Mesh")))
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_0068: Unknown result type (might be due to invalid IL or missing references)
					//IL_0069: Unknown result type (might be due to invalid IL or missing references)
					skinParams.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[1]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\SnowtimeSkins\\Meshes\\unnamed base superhigh.mesh"),
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"Drone1Mesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Drone1Mesh")))
						}
					};
				});
				TryCatchThrow("Light Infos", delegate
				{
					skinParams.lightReplacements = (LightInfo[])(object)new LightInfo[0];
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skinParams.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skinParams.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref val2.skins, val2.skins.Length + 1);
				val2.skins[val2.skins.Length - 1] = skin;
				DTGunnerDroneBodySnowtimeSkinsVRCSnowtime02SkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				if (ex.InnerException is ElementException ex2)
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)$"Field causing issue: {ex.Message}, element: {ex2.Index}");
					InstanceLogger.LogWarning((object)ex2.Message);
					InstanceLogger.LogError((object)ex.InnerException);
				}
				else
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message));
					InstanceLogger.LogError((object)ex.InnerException);
				}
			}
			catch (Exception ex3)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex3);
			}
		}

		private static void Drone1BodySnowtimeSkinsVRCSnowtime02_genericSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SnowtimeSkinsPlugin.Drone1BodySnowtimeSkinsVRCSnowtime02_genericSkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab));
		}

		private static void AddDrone1BodySnowtimeSkinsVRCSnowtime02_genericSkin()
		{
			string text = "Drone1Body";
			string text2 = "SnowtimeSkinsVRCSnowtime02_generic";
			try
			{
				GameObject val = BodyCatalog.FindBodyPrefab(text);
				if (!Object.op_Implicit((Object)(object)val))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist"));
					return;
				}
				ModelLocator component = val.GetComponent<ModelLocator>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component"));
					return;
				}
				GameObject gameObject = ((Component)component.modelTransform).gameObject;
				ModelSkinController val2 = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null);
				if (!Object.op_Implicit((Object)(object)val2))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component"));
					return;
				}
				Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true);
				gameObject.GetComponentsInChildren<Light>(true);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				SkinDefParams skinParams = ScriptableObject.CreateInstance<SkinDefParams>();
				skin.skinDefParams = skinParams;
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets/snowtime/halo/hunkevolved/Icons/HaloCESpartan_SnowtimeIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME02_GENERIC_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = Array.Empty<SkinDef>();
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_0078: Unknown result type (might be due to invalid IL or missing references)
					//IL_007d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0093: Unknown result type (might be due to invalid IL or missing references)
					//IL_0098: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cf: 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_012f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0130: Unknown result type (might be due to invalid IL or missing references)
					skinParams.gameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[2]
					{
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Renderer>(0, "There is no renderer with the name \"Drone1Mesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Drone1Mesh")))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = true,
							localPosition = new Vector3(0.5f, -1.3f, -4f),
							localRotation = new Vector3(0f, 0f, 20f),
							localScale = new Vector3(1f, 1f, 1f),
							prefab = assetBundle.LoadAsset<GameObject>("Assets/snowtime/halo/hunkevolved/prefab/banshee_fx_h2.prefab")
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Renderer>(1, "There is no renderer with the name \"Drone1BladeActive\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Drone1BladeActive")))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						}
					};
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_002f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0078: Unknown result type (might be due to invalid IL or missing references)
					//IL_0079: Unknown result type (might be due to invalid IL or missing references)
					skinParams.rendererInfos = (RendererInfo[])(object)new RendererInfo[1]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/snowtime/templatematerial/banshee/banshee_heretic.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)2,
							ignoreOverlays = false,
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"Drone1Mesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Drone1Mesh")))
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_0068: Unknown result type (might be due to invalid IL or missing references)
					//IL_0069: Unknown result type (might be due to invalid IL or missing references)
					skinParams.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[1]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\SnowtimeSkins\\Meshes\\unnamed base superhigh.mesh"),
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"Drone1Mesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Drone1Mesh")))
						}
					};
				});
				TryCatchThrow("Light Infos", delegate
				{
					skinParams.lightReplacements = (LightInfo[])(object)new LightInfo[0];
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skinParams.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skinParams.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref val2.skins, val2.skins.Length + 1);
				val2.skins[val2.skins.Length - 1] = skin;
				Drone1BodySnowtimeSkinsVRCSnowtime02_genericSkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				if (ex.InnerException is ElementException ex2)
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)$"Field causing issue: {ex.Message}, element: {ex2.Index}");
					InstanceLogger.LogWarning((object)ex2.Message);
					InstanceLogger.LogError((object)ex.InnerException);
				}
				else
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message));
					InstanceLogger.LogError((object)ex.InnerException);
				}
			}
			catch (Exception ex3)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex3);
			}
		}

		private static void MissileDroneBodySnowtimeSkinsVRCSnowtime03SkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SnowtimeSkinsPlugin.MissileDroneBodySnowtimeSkinsVRCSnowtime03SkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab));
		}

		private static void AddMissileDroneBodySnowtimeSkinsVRCSnowtime03Skin()
		{
			string text = "MissileDroneBody";
			string text2 = "SnowtimeSkinsVRCSnowtime03";
			try
			{
				GameObject val = BodyCatalog.FindBodyPrefab(text);
				if (!Object.op_Implicit((Object)(object)val))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist"));
					return;
				}
				ModelLocator component = val.GetComponent<ModelLocator>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component"));
					return;
				}
				GameObject gameObject = ((Component)component.modelTransform).gameObject;
				ModelSkinController val2 = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null);
				if (!Object.op_Implicit((Object)(object)val2))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component"));
					return;
				}
				Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true);
				gameObject.GetComponentsInChildren<Light>(true);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				SkinDefParams skinParams = ScriptableObject.CreateInstance<SkinDefParams>();
				skin.skinDefParams = skinParams;
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets/snowtime/halo/hunkevolved/Icons/HaloCESpartan_SnowtimeIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME03_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = Array.Empty<SkinDef>();
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					//IL_0010: 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_0068: Unknown result type (might be due to invalid IL or missing references)
					//IL_0071: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
					skinParams.gameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[2]
					{
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Renderer>(0, "There is no renderer with the name \"Blades\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Blades")))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Renderer>(1, "There is no renderer with the name \"Blades2\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Blades2")))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						}
					};
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_002f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0078: Unknown result type (might be due to invalid IL or missing references)
					//IL_0079: Unknown result type (might be due to invalid IL or missing references)
					skinParams.rendererInfos = (RendererInfo[])(object)new RendererInfo[1]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/snowtime/templatematerial/hornet/hornet.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)2,
							ignoreOverlays = false,
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"MissileDroneMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "MissileDroneMesh")))
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_0068: Unknown result type (might be due to invalid IL or missing references)
					//IL_0069: Unknown result type (might be due to invalid IL or missing references)
					skinParams.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[1]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\SnowtimeSkins\\Meshes\\hornet.mesh"),
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"MissileDroneMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "MissileDroneMesh")))
						}
					};
				});
				TryCatchThrow("Light Infos", delegate
				{
					skinParams.lightReplacements = (LightInfo[])(object)new LightInfo[0];
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skinParams.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skinParams.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref val2.skins, val2.skins.Length + 1);
				val2.skins[val2.skins.Length - 1] = skin;
				MissileDroneBodySnowtimeSkinsVRCSnowtime03SkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				if (ex.InnerException is ElementException ex2)
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)$"Field causing issue: {ex.Message}, element: {ex2.Index}");
					InstanceLogger.LogWarning((object)ex2.Message);
					InstanceLogger.LogError((object)ex.InnerException);
				}
				else
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message));
					InstanceLogger.LogError((object)ex.InnerException);
				}
			}
			catch (Exception ex3)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex3);
			}
		}

		private static void MegaDroneBodySnowtimeSkinsVRCSnowtime04SkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SnowtimeSkinsPlugin.MegaDroneBodySnowtimeSkinsVRCSnowtime04SkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab));
		}

		private static void AddMegaDroneBodySnowtimeSkinsVRCSnowtime04Skin()
		{
			string text = "MegaDroneBody";
			string text2 = "SnowtimeSkinsVRCSnowtime04";
			try
			{
				GameObject val = BodyCatalog.FindBodyPrefab(text);
				if (!Object.op_Implicit((Object)(object)val))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist"));
					return;
				}
				ModelLocator component = val.GetComponent<ModelLocator>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component"));
					return;
				}
				GameObject mdl = ((Component)component.modelTransform).gameObject;
				ModelSkinController skinController = (Object.op_Implicit((Object)(object)mdl) ? mdl.GetComponent<ModelSkinController>() : null);
				if (!Object.op_Implicit((Object)(object)skinController))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component"));
					return;
				}
				Renderer[] renderers = mdl.GetComponentsInChildren<Renderer>(true);
				mdl.GetComponentsInChildren<Light>(true);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				SkinDefParams skinParams = ScriptableObject.CreateInstance<SkinDefParams>();
				skin.skinDefParams = skinParams;
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets/snowtime/halo/hunkevolved/Icons/HaloCESpartan_SnowtimeIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME04_NAME";
				skin.rootObject = mdl;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = (SkinDef[])(object)new SkinDef[1] { ThrowIfOutOfBounds(0, "Index 0 is out of bounds of skins array", skinController.skins, 0) };
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0053: Unknown result type (might be due to invalid IL or missing references)
					//IL_0054: Unknown result type (might be due to invalid IL or missing references)
					//IL_005d: Unknown result type (might be due to invalid IL or missing references)
					//IL_009f: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
					//IL_00eb: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
					//IL_0137: Unknown result type (might be due to invalid IL or missing references)
					//IL_0138: Unknown result type (might be due to invalid IL or missing references)
					//IL_0141: Unknown result type (might be due to invalid IL or missing references)
					//IL_0183: Unknown result type (might be due to invalid IL or missing references)
					//IL_0184: Unknown result type (might be due to invalid IL or missing references)
					//IL_018d: Unknown result type (might be due to invalid IL or missing references)
					//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
					//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
					//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
					//IL_021b: 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_0225: Unknown result type (might be due to invalid IL or missing references)
					//IL_0267: Unknown result type (might be due to invalid IL or missing references)
					//IL_0268: Unknown result type (might be due to invalid IL or missing references)
					//IL_0271: Unknown result type (might be due to invalid IL or missing references)
					//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
					//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
					//IL_02be: Unknown result type (might be due to invalid IL or missing references)
					//IL_0301: Unknown result type (might be due to invalid IL or missing references)
					//IL_0302: Unknown result type (might be due to invalid IL or missing references)
					//IL_030c: Unknown result type (might be due to invalid IL or missing references)
					//IL_034f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0350: Unknown result type (might be due to invalid IL or missing references)
					skinParams.gameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[11]
					{
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Transform>(0, "There is no renderer at path \"MegaDroneArmature/Base/BlinkyForwardRedLight\"", mdl.transform.Find("MegaDroneArmature/Base/BlinkyForwardRedLight"))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Transform>(1, "There is no renderer at path \"MegaDroneArmature/Base/Rotor/WingRoll.l/WingPitch.l/WingPitch.l_end/BlinkyBackLight\"", mdl.transform.Find("MegaDroneArmature/Base/Rotor/WingRoll.l/WingPitch.l/WingPitch.l_end/BlinkyBackLight"))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Transform>(2, "There is no renderer at path \"MegaDroneArmature/Base/Rotor/WingRoll.r/WingPitch.r/WingPitch.r_end/BlinkyBackLight\"", mdl.transform.Find("MegaDroneArmature/Base/Rotor/WingRoll.r/WingPitch.r/WingPitch.r_end/BlinkyBackLight"))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Transform>(3, "There is no renderer at path \"MegaDroneArmature/Base/Rotor/WingRoll.l/WingPitch.l/WingPitch.l_end/GreenFlare\"", mdl.transform.Find("MegaDroneArmature/Base/Rotor/WingRoll.l/WingPitch.l/WingPitch.l_end/GreenFlare"))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Transform>(4, "There is no renderer at path \"MegaDroneArmature/Base/Rotor/WingRoll.r/WingPitch.r/WingPitch.r_end/RedFlare\"", mdl.transform.Find("MegaDroneArmature/Base/Rotor/WingRoll.r/WingPitch.r/WingPitch.r_end/RedFlare"))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Transform>(5, "There is no renderer at path \"MegaDroneArmature/Base/Rotor/WingRoll.l/WingPitch.l/WingPitch.l_end/JetCenter/ExhaustLight\"", mdl.transform.Find("MegaDroneArmature/Base/Rotor/WingRoll.l/WingPitch.l/WingPitch.l_end/JetCenter/ExhaustLight"))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Transform>(6, "There is no renderer at path \"MegaDroneArmature/Base/Rotor/WingRoll.l/WingPitch.l/WingPitch.l_end/JetCenter/Flames\"", mdl.transform.Find("MegaDroneArmature/Base/Rotor/WingRoll.l/WingPitch.l/WingPitch.l_end/JetCenter/Flames"))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Transform>(7, "There is no renderer at path \"MegaDroneArmature/Base/Rotor/WingRoll.l/WingPitch.l/WingPitch.l_end/JetCenter/Distortion\"", mdl.transform.Find("MegaDroneArmature/Base/Rotor/WingRoll.l/WingPitch.l/WingPitch.l_end/JetCenter/Distortion"))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Transform>(8, "There is no renderer at path \"MegaDroneArmature/Base/Rotor/WingRoll.r/WingPitch.r/WingPitch.r_end/JetCenter/ExhaustLight\"", mdl.transform.Find("MegaDroneArmature/Base/Rotor/WingRoll.r/WingPitch.r/WingPitch.r_end/JetCenter/ExhaustLight"))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Transform>(9, "There is no renderer at path \"MegaDroneArmature/Base/Rotor/WingRoll.r/WingPitch.r/WingPitch.r_end/JetCenter/Flames\"", mdl.transform.Find("MegaDroneArmature/Base/Rotor/WingRoll.r/WingPitch.r/WingPitch.r_end/JetCenter/Flames"))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Transform>(10, "There is no renderer at path \"MegaDroneArmature/Base/Rotor/WingRoll.r/WingPitch.r/WingPitch.r_end/JetCenter/Distortion\"", mdl.transform.Find("MegaDroneArmature/Base/Rotor/WingRoll.r/WingPitch.r/WingPitch.r_end/JetCenter/Distortion"))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						}
					};
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_002f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0078: Unknown result type (might be due to invalid IL or missing references)
					//IL_0079: Unknown result type (might be due to invalid IL or missing references)
					skinParams.rendererInfos = (RendererInfo[])(object)new RendererInfo[1]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/snowtime/templatematerial/hornet/vulture.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)2,
							ignoreOverlays = false,
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"MegaDroneMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "MegaDroneMesh")))
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_0068: Unknown result type (might be due to invalid IL or missing references)
					//IL_0069: Unknown result type (might be due to invalid IL or missing references)
					skinParams.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[1]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\SnowtimeSkins\\Meshes\\Vulture_ForArchive.mesh"),
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"MegaDroneMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "MegaDroneMesh")))
						}
					};
				});
				TryCatchThrow("Light Infos", delegate
				{
					skinParams.lightReplacements = (LightInfo[])(object)new LightInfo[0];
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skinParams.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skinParams.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref skinController.skins, skinController.skins.Length + 1);
				skinController.skins[skinController.skins.Length - 1] = skin;
				MegaDroneBodySnowtimeSkinsVRCSnowtime04SkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				if (ex.InnerException is ElementException ex2)
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)$"Field causing issue: {ex.Message}, element: {ex2.Index}");
					InstanceLogger.LogWarning((object)ex2.Message);
					InstanceLogger.LogError((object)ex.InnerException);
				}
				else
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message));
					InstanceLogger.LogError((object)ex.InnerException);
				}
			}
			catch (Exception ex3)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex3);
			}
		}

		private static void BackupDroneBodySnowtimeSkinsVRCSnowtime05SkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SnowtimeSkinsPlugin.BackupDroneBodySnowtimeSkinsVRCSnowtime05SkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab));
		}

		private static void AddBackupDroneBodySnowtimeSkinsVRCSnowtime05Skin()
		{
			string text = "BackupDroneBody";
			string text2 = "SnowtimeSkinsVRCSnowtime05";
			try
			{
				GameObject val = BodyCatalog.FindBodyPrefab(text);
				if (!Object.op_Implicit((Object)(object)val))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist"));
					return;
				}
				ModelLocator component = val.GetComponent<ModelLocator>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component"));
					return;
				}
				GameObject gameObject = ((Component)component.modelTransform).gameObject;
				ModelSkinController val2 = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null);
				if (!Object.op_Implicit((Object)(object)val2))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component"));
					return;
				}
				Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true);
				gameObject.GetComponentsInChildren<Light>(true);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				SkinDefParams skinParams = ScriptableObject.CreateInstance<SkinDefParams>();
				skin.skinDefParams = skinParams;
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets/snowtime/halo/hunkevolved/Icons/HaloCESpartan_SnowtimeIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME05_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = Array.Empty<SkinDef>();
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					//IL_0010: 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_0068: Unknown result type (might be due to invalid IL or missing references)
					//IL_0071: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
					//IL_0129: Unknown result type (might be due to invalid IL or missing references)
					//IL_012a: Unknown result type (might be due to invalid IL or missing references)
					skinParams.gameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[3]
					{
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Renderer>(0, "There is no renderer with the name \"mdlBackupDrone\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "mdlBackupDrone")))).gameObject,
							shouldActivate = true,
							spawnPrefabOnModelObject = false
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Renderer>(1, "There is no renderer with the name \"Blades\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Blades")))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						},
						new GameObjectActivation
						{
							gameObject = ((Component)ThrowIfNull<Renderer>(2, "There is no renderer with the name \"Blades2\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Blades2")))).gameObject,
							shouldActivate = false,
							spawnPrefabOnModelObject = false
						}
					};
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_002f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0078: Unknown result type (might be due to invalid IL or missing references)
					//IL_0079: Unknown result type (might be due to invalid IL or missing references)
					skinParams.rendererInfos = (RendererInfo[])(object)new RendererInfo[1]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/snowtime/templatematerial/vampire/vampire.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)2,
							ignoreOverlays = false,
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"mdlBackupDrone\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "mdlBackupDrone")))
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_0068: Unknown result type (might be due to invalid IL or missing references)
					//IL_0069: Unknown result type (might be due to invalid IL or missing references)
					skinParams.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[1]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\SnowtimeSkins\\Meshes\\Vampire.mesh"),
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"mdlBackupDrone\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "mdlBackupDrone")))
						}
					};
				});
				TryCatchThrow("Light Infos", delegate
				{
					skinParams.lightReplacements = (LightInfo[])(object)new LightInfo[0];
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skinParams.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skinParams.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref val2.skins, val2.skins.Length + 1);
				val2.skins[val2.skins.Length - 1] = skin;
				BackupDroneBodySnowtimeSkinsVRCSnowtime05SkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				if (ex.InnerException is ElementException ex2)
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)$"Field causing issue: {ex.Message}, element: {ex2.Index}");
					InstanceLogger.LogWarning((object)ex2.Message);
					InstanceLogger.LogError((object)ex.InnerException);
				}
				else
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message));
					InstanceLogger.LogError((object)ex.InnerException);
				}
			}
			catch (Exception ex3)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex3);
			}
		}

		private static void MageBodySnowtimeSkinsVRCShortcakeSkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SnowtimeSkinsPlugin.MageBodySnowtimeSkinsVRCShortcakeSkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab));
		}

		private static void AddMageBodySnowtimeSkinsVRCShortcakeSkin()
		{
			if (!((BaseUnityPlugin)Instance).Config.Bind<bool>("SnowtimeSkinsVRCShortcake", "Enabled", true, (ConfigDescription)null).Value)
			{
				return;
			}
			string text = "MageBody";
			string text2 = "SnowtimeSkinsVRCShortcake";
			try
			{
				GameObject val = BodyCatalog.FindBodyPrefab(text);
				if (!Object.op_Implicit((Object)(object)val))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist"));
					return;
				}
				ModelLocator component = val.GetComponent<ModelLocator>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component"));
					return;
				}
				GameObject gameObject = ((Component)component.modelTransform).gameObject;
				ModelSkinController val2 = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null);
				if (!Object.op_Implicit((Object)(object)val2))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component"));
					return;
				}
				Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true);
				gameObject.GetComponentsInChildren<Light>(true);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				SkinDefParams skinParams = ScriptableObject.CreateInstance<SkinDefParams>();
				skin.skinDefParams = skinParams;
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets\\SkinMods\\SnowtimeSkins\\Icons\\SnowtimeSkinsVRCShortcakeIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSHORTCAKE_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = Array.Empty<SkinDef>();
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					skinParams.gameObjectActivations = Array.Empty<GameObjectActivation>();
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_002f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0078: Unknown result type (might be due to invalid IL or missing references)
					//IL_0079: Unknown result type (might be due to invalid IL or missing references)
					//IL_0082: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
					//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
					skinParams.rendererInfos = (RendererInfo[])(object)new RendererInfo[2]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/snowtime/updated/mats/Binah_mat_Face.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)2,
							ignoreOverlays = true,
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"MageMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "MageMesh")))
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/snowtime/guns/gem_basic.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)2,
							ignoreOverlays = true,
							renderer = ThrowIfNull<Renderer>(1, "There is no renderer with the name \"MageCapeMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "MageCapeMesh")))
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_0068: Unknown result type (might be due to invalid IL or missing references)
					//IL_0069: Unknown result type (might be due to invalid IL or missing references)
					//IL_0072: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
					skinParams.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[2]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\SnowtimeSkins\\Meshes\\MageMesh_shortcake.mesh"),
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"MageMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "MageMesh")))
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\SnowtimeSkins\\Meshes\\MageCapeMesh_shortcake.mesh"),
							renderer = ThrowIfNull<Renderer>(1, "There is no renderer with the name \"MageCapeMesh\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "MageCapeMesh")))
						}
					};
				});
				TryCatchThrow("Light Infos", delegate
				{
					skinParams.lightReplacements = (LightInfo[])(object)new LightInfo[0];
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					skinParams.minionSkinReplacements = Array.Empty<MinionSkinReplacement>();
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skinParams.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref val2.skins, val2.skins.Length + 1);
				val2.skins[val2.skins.Length - 1] = skin;
				MageBodySnowtimeSkinsVRCShortcakeSkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				if (ex.InnerException is ElementException ex2)
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)$"Field causing issue: {ex.Message}, element: {ex2.Index}");
					InstanceLogger.LogWarning((object)ex2.Message);
					InstanceLogger.LogError((object)ex.InnerException);
				}
				else
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message));
					InstanceLogger.LogError((object)ex.InnerException);
				}
			}
			catch (Exception ex3)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex3);
			}
		}

		private static void DroneTechBodySnowtimeSkinsVRCSnowtime01SkinAdded(SkinDef skinDef, GameObject bodyPrefab)
		{
			SnowtimeSkinsPlugin.DroneTechBodySnowtimeSkinsVRCSnowtime01SkinAddedEvent(Instance, new SkinAddedArgs(skinDef, bodyPrefab));
		}

		private static void AddDroneTechBodySnowtimeSkinsVRCSnowtime01Skin()
		{
			if (!((BaseUnityPlugin)Instance).Config.Bind<bool>("SnowtimeSkinsVRCSnowtime01", "Enabled", true, (ConfigDescription)null).Value)
			{
				return;
			}
			string text = "DroneTechBody";
			string text2 = "SnowtimeSkinsVRCSnowtime01";
			try
			{
				GameObject val = BodyCatalog.FindBodyPrefab(text);
				if (!Object.op_Implicit((Object)(object)val))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin because \"" + text + "\" doesn't exist"));
					return;
				}
				ModelLocator component = val.GetComponent<ModelLocator>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelLocator\" component"));
					return;
				}
				GameObject gameObject = ((Component)component.modelTransform).gameObject;
				ModelSkinController val2 = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<ModelSkinController>() : null);
				if (!Object.op_Implicit((Object)(object)val2))
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\" because it doesn't have \"ModelSkinController\" component"));
					return;
				}
				Renderer[] renderers = gameObject.GetComponentsInChildren<Renderer>(true);
				gameObject.GetComponentsInChildren<Light>(true);
				SkinDef skin = ScriptableObject.CreateInstance<SkinDef>();
				SkinDefParams skinParams = ScriptableObject.CreateInstance<SkinDefParams>();
				skin.skinDefParams = skinParams;
				TryCatchThrow("Icon", delegate
				{
					skin.icon = assetBundle.LoadAsset<Sprite>("Assets/snowtime/halo/hunkevolved/Icons/HaloCESpartan_SnowtimeIcon.png");
				});
				((Object)skin).name = text2;
				skin.nameToken = "WINTERWONDERLAND_SKIN_SNOWTIMESKINSVRCSNOWTIME01_NAME";
				skin.rootObject = gameObject;
				TryCatchThrow("Base Skins", delegate
				{
					skin.baseSkins = Array.Empty<SkinDef>();
				});
				TryCatchThrow("Unlockable Name", delegate
				{
					skin.unlockableDef = null;
				});
				TryCatchThrow("Game Object Activations", delegate
				{
					skinParams.gameObjectActivations = Array.Empty<GameObjectActivation>();
				});
				TryCatchThrow("Renderer Infos", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_002f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0078: Unknown result type (might be due to invalid IL or missing references)
					//IL_0079: Unknown result type (might be due to invalid IL or missing references)
					//IL_0082: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
					//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
					//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
					//IL_0113: Unknown result type (might be due to invalid IL or missing references)
					//IL_015c: Unknown result type (might be due to invalid IL or missing references)
					//IL_015d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0166: Unknown result type (might be due to invalid IL or missing references)
					//IL_0185: Unknown result type (might be due to invalid IL or missing references)
					//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
					//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
					//IL_01d8: 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_0240: 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_024a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0269: Unknown result type (might be due to invalid IL or missing references)
					//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
					//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
					skinParams.rendererInfos = (RendererInfo[])(object)new RendererInfo[6]
					{
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/snowtime/templatematerial/dronetechthing.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)2,
							ignoreOverlays = true,
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"DroneTech_Body\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "DroneTech_Body")))
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/snowtime_skin/DOLOSart/1.Milltina/Material/Milltina_Body_Poi.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)2,
							ignoreOverlays = true,
							renderer = ThrowIfNull<Renderer>(1, "There is no renderer with the name \"DroneTech_Gun\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "DroneTech_Gun")))
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/snowtime/Milltina_Eyes.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)0,
							ignoreOverlays = true,
							renderer = ThrowIfNull<Renderer>(2, "There is no renderer with the name \"Operator_Glow_01\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Operator_Glow_01")))
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/snowtime_skin/Vellie/Urban Grace/MaterialPack/Top_Pants_Belt/Basics/Blue_Black.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)2,
							ignoreOverlays = true,
							renderer = ThrowIfNull<Renderer>(3, "There is no renderer with the name \"Operator_Glow_02\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Operator_Glow_02")))
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/snowtime_skin/Vellie/Urban Grace/MaterialPack/Top_Pants_Belt/Basics/HaloMetallic.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)2,
							ignoreOverlays = true,
							renderer = ThrowIfNull<Renderer>(4, "There is no renderer with the name \"Operator_Glow_03\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Operator_Glow_03")))
						},
						new RendererInfo
						{
							defaultMaterial = assetBundle.LoadAsset<Material>("Assets/snowtime_skin/DOLOSart/1.Milltina/Material/Milltina_Body_Poi.mat"),
							defaultShadowCastingMode = (ShadowCastingMode)2,
							ignoreOverlays = true,
							renderer = ThrowIfNull<Renderer>(5, "There is no renderer with the name \"Operator_Glow_04\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Operator_Glow_04")))
						}
					};
				});
				TryCatchThrow("Mesh Replacements", delegate
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_0068: Unknown result type (might be due to invalid IL or missing references)
					//IL_0069: Unknown result type (might be due to invalid IL or missing references)
					//IL_0072: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
					//IL_012c: Unknown result type (might be due to invalid IL or missing references)
					//IL_012d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0136: Unknown result type (might be due to invalid IL or missing references)
					//IL_018e: Unknown result type (might be due to invalid IL or missing references)
					//IL_018f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0198: Unknown result type (might be due to invalid IL or missing references)
					//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
					//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
					//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
					//IL_0252: Unknown result type (might be due to invalid IL or missing references)
					//IL_0253: Unknown result type (might be due to invalid IL or missing references)
					skinParams.meshReplacements = (MeshReplacement[])(object)new MeshReplacement[6]
					{
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\SnowtimeSkins\\Meshes\\_dronetech.mesh"),
							renderer = ThrowIfNull<Renderer>(0, "There is no renderer with the name \"DroneTech_Body\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "DroneTech_Body")))
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\SnowtimeSkins\\Meshes\\_face.mesh"),
							renderer = ThrowIfNull<Renderer>(1, "There is no renderer with the name \"DroneTech_Gun\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "DroneTech_Gun")))
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\SnowtimeSkins\\Meshes\\_eyes.mesh"),
							renderer = ThrowIfNull<Renderer>(2, "There is no renderer with the name \"Operator_Glow_01\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Operator_Glow_01")))
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\SnowtimeSkins\\Meshes\\_outfitfix.mesh"),
							renderer = ThrowIfNull<Renderer>(3, "There is no renderer with the name \"Operator_Glow_02\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Operator_Glow_02")))
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\SnowtimeSkins\\Meshes\\_metalfix.mesh"),
							renderer = ThrowIfNull<Renderer>(4, "There is no renderer with the name \"Operator_Glow_03\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Operator_Glow_03")))
						},
						new MeshReplacement
						{
							mesh = assetBundle.LoadAsset<Mesh>("Assets\\SkinMods\\SnowtimeSkins\\Meshes\\_face_nooverlay.mesh"),
							renderer = ThrowIfNull<Renderer>(5, "There is no renderer with the name \"Operator_Glow_04\"", ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "Operator_Glow_04")))
						}
					};
				});
				TryCatchThrow("Light Infos", delegate
				{
					skinParams.lightReplacements = (LightInfo[])(object)new LightInfo[0];
				});
				TryCatchThrow("Minion Skin Replacements", delegate
				{
					//IL_0010: 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_0040: Unknown result type (might be due to invalid IL or missing references)
					//IL_0078: Unknown result type (might be due to invalid IL or missing references)
					//IL_0079: Unknown result type (might be due to invalid IL or missing references)
					//IL_0082: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
					//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
					//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
					//IL_011e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0124: Unknown result type (might be due to invalid IL or missing references)
					//IL_015c: Unknown result type (might be due to invalid IL or missing references)
					//IL_015d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0166: Unknown result type (might be due to invalid IL or missing references)
					//IL_0190: Unknown result type (might be due to invalid IL or missing references)
					//IL_0196: Unknown result type (might be due to invalid IL or missing references)
					//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
					//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
					//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
					//IL_0202: Unknown result type (might be due to invalid IL or missing references)
					//IL_0208: Unknown result type (might be due to invalid IL or missing references)
					//IL_0240: 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)
					skinParams.minionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[5]
					{
						new MinionSkinReplacement
						{
							minionBodyPrefab = BodyCatalog.FindBodyPrefab("DTGunnerDroneBody"),
							minionSkin = ThrowIfNull<SkinDef>(0, "There is no skin with the name \"SnowtimeSkinsVRCSnowtime02\" for body \"DTGunnerDroneBody\"", ((IEnumerable<SkinDef>)SkinCatalog.FindSkinsForBody(ThrowIfEquals<BodyIndex>(0, "Body \"DTGunnerDroneBody\" doesn't exist", BodyCatalog.FindBodyIndex("DTGunnerDroneBody"), (BodyIndex)(-1)))).FirstOrDefault((Func<SkinDef, bool>)((SkinDef s) => ((Object)s).name == "SnowtimeSkinsVRCSnowtime02")))
						},
						new MinionSkinReplacement
						{
							minionBodyPrefab = BodyCatalog.FindBodyPrefab("Drone1Body"),
							minionSkin = ThrowIfNull<SkinDef>(1, "There is no skin with the name \"SnowtimeSkinsVRCSnowtime02_generic\" for body \"Drone1Body\"", ((IEnumerable<SkinDef>)SkinCatalog.FindSkinsForBody(ThrowIfEquals<BodyIndex>(1, "Body \"Drone1Body\" doesn't exist", BodyCatalog.FindBodyIndex("Drone1Body"), (BodyIndex)(-1)))).FirstOrDefault((Func<SkinDef, bool>)((SkinDef s) => ((Object)s).name == "SnowtimeSkinsVRCSnowtime02_generic")))
						},
						new MinionSkinReplacement
						{
							minionBodyPrefab = BodyCatalog.FindBodyPrefab("MissileDroneBody"),
							minionSkin = ThrowIfNull<SkinDef>(2, "There is no skin with the name \"SnowtimeSkinsVRCSnowtime03\" for body \"MissileDroneBody\"", ((IEnumerable<SkinDef>)SkinCatalog.FindSkinsForBody(ThrowIfEquals<BodyIndex>(2, "Body \"MissileDroneBody\" doesn't exist", BodyCatalog.FindBodyIndex("MissileDroneBody"), (BodyIndex)(-1)))).FirstOrDefault((Func<SkinDef, bool>)((SkinDef s) => ((Object)s).name == "SnowtimeSkinsVRCSnowtime03")))
						},
						new MinionSkinReplacement
						{
							minionBodyPrefab = BodyCatalog.FindBodyPrefab("MegaDroneBody"),
							minionSkin = ThrowIfNull<SkinDef>(3, "There is no skin with the name \"SnowtimeSkinsVRCSnowtime04\" for body \"MegaDroneBody\"", ((IEnumerable<SkinDef>)SkinCatalog.FindSkinsForBody(ThrowIfEquals<BodyIndex>(3, "Body \"MegaDroneBody\" doesn't exist", BodyCatalog.FindBodyIndex("MegaDroneBody"), (BodyIndex)(-1)))).FirstOrDefault((Func<SkinDef, bool>)((SkinDef s) => ((Object)s).name == "SnowtimeSkinsVRCSnowtime04")))
						},
						new MinionSkinReplacement
						{
							minionBodyPrefab = BodyCatalog.FindBodyPrefab("BackupDroneBody"),
							minionSkin = ThrowIfNull<SkinDef>(4, "There is no skin with the name \"SnowtimeSkinsVRCSnowtime05\" for body \"BackupDroneBody\"", ((IEnumerable<SkinDef>)SkinCatalog.FindSkinsForBody(ThrowIfEquals<BodyIndex>(4, "Body \"BackupDroneBody\" doesn't exist", BodyCatalog.FindBodyIndex("BackupDroneBody"), (BodyIndex)(-1)))).FirstOrDefault((Func<SkinDef, bool>)((SkinDef s) => ((Object)s).name == "SnowtimeSkinsVRCSnowtime05")))
						}
					};
				});
				TryCatchThrow("Projectile Ghost Replacements", delegate
				{
					skinParams.projectileGhostReplacements = Array.Empty<ProjectileGhostReplacement>();
				});
				Array.Resize(ref val2.skins, val2.skins.Length + 1);
				val2.skins[val2.skins.Length - 1] = skin;
				DroneTechBodySnowtimeSkinsVRCSnowtime01SkinAdded(skin, val);
			}
			catch (FieldException ex)
			{
				if (ex.InnerException is ElementException ex2)
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)$"Field causing issue: {ex.Message}, element: {ex2.Index}");
					InstanceLogger.LogWarning((object)ex2.Message);
					InstanceLogger.LogError((object)ex.InnerException);
				}
				else
				{
					InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
					InstanceLogger.LogWarning((object)("Field causing issue: " + ex.Message));
					InstanceLogger.LogError((object)ex.InnerException);
				}
			}
			catch (Exception ex3)
			{
				InstanceLogger.LogWarning((object)("Failed to add \"" + text2 + "\" skin to \"" + text + "\""));
				InstanceLogger.LogError((object)ex3);
			}
		}

		private static T ThrowIfEquals<T>(int index, string message, T value, T expected) where T : Enum
		{
			if (value.Equals(expected))
			{
				throw new ElementException(index, message);
			}
			return value;
		}

		private static T ThrowIfOutOfBounds<T>(int index, string message, T[] array, int elementIndex) where T : class
		{
			if (array == null || array.Length <= elementIndex)
			{
				throw new ElementException(index, message);
			}
			return array[elementIndex];
		}

		private static T ThrowIfNull<T>(int index, string message, T value) where T : class
		{
			if (value == null)
			{
				throw new ElementException(index, message);
			}
			return value;
		}

		private static void TryCatchThrow(string message, Action action)
		{
			try
			{
				action?.Invoke();
			}
			catch (Exception innerException)
			{
				throw new FieldException(message, innerException);
			}
		}

		private static void TryAddComponent<T>(GameObject obj) where T : Component
		{
			if (Object.op_Implicit((Object)(object)obj) && !Object.op_Implicit((Object)(object)obj.GetComponent<T>()))
			{
				obj.AddComponent<T>();
			}
		}
	}
}
namespace RuneFoxMods
{
	internal class Utils
	{
		public static void PrintBodyCatalog()
		{
			Debug.Log((object)"\nBodyCatalog");
			foreach (GameObject allBodyPrefab in BodyCatalog.allBodyPrefabs)
			{
				Debug.Log((object)((Object)allBodyPrefab).name);
			}
			Debug.Log((object)"\n");
		}

		public static void ReadChildren(GameObject parent, int tabs, bool includecomponents = true)
		{
			//IL_0082: 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)
			string text = "";
			for (int i = 0; i < tabs; i++)
			{
				text += "  ";
			}
			for (int j = 0; j < parent.transform.childCount; j++)
			{
				Transform child = parent.transform.GetChild(j);
				if ((Object)(object)child == (Object)null)
				{
					break;
				}
				string text2 = ((Component)child).gameObject.activeInHierarchy.ToString();
				string[] obj = new string[6]
				{
					text,
					((Object)child).name,
					" ",
					text2,
					" ",
					null
				};
				Vector3 position = ((Component)child).transform.position;
				obj[5] = ((object)(Vector3)(ref position)).ToString();
				Debug.Log((object)string.Concat(obj));
				if (includecomponents)
				{
					ReadComponents(((Component)child).gameObject, tabs + 1);
					Debug.Log((object)"");
				}
				ReadChildren(((Component)child).gameObject, tabs + 1, includecomponents);
			}
		}

		public static void readheiarchy(GameObject parent, bool includeComponents = true)
		{
			Debug.Log((object)((Object)parent).name);
			if (includeComponents)
			{
				ReadComponents(parent, 1);
				Debug.Log((object)"");
			}
			ReadChildren(parent, 1, includeComponents);
		}

		public static void ReadComponents(GameObject obj, int tabs)
		{
			string text = "";
			for (int i = 0; i < tabs; i++)
			{
				text += "  ";
			}
			Component[] components = obj.GetComponents(typeof(Component));
			foreach (Component val in components)
			{
				string text2 = "";
				Debug.Log((object)(text + "Comp: " + ((object)val).GetType().ToString() + "  " + text2));
			}
		}

		public static void PrintAllPaths(GameObject parent)
		{
			Debug.Log((object)((Object)parent).name);
			PrintAllPathsInner(parent, ((Object)parent).name);
		}

		private static void PrintAllPathsInner(GameObject parent, string parent_string)
		{
			int childCount = parent.transform.childCount;
			for (int i = 0; i < childCount; i++)
			{
				Transform child = parent.transform.GetChild(i);
				if (!((Object)child).name.EndsWith("_end"))
				{
					string text = parent_string + "/" + ((Object)child).name;
					Debug.Log((object)("  " + ((Object)child).name + "\t\t" + text));
					PrintAllPathsInner(((Component)child).gameObject, text);
					continue;
				}
				break;
			}
		}

		public static void PrintDynamicBone(DynamicBone DB)
		{
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)("Root: " + (object)DB.m_Root));
			Debug.Log((object)("Damping: " + DB.m_Damping));
			Debug.Log((object)("Damping Dist: " + (object)DB.m_DampingDistrib));
			Debug.Log((object)("Elasticity: " + DB.m_Elasticity));
			Debug.Log((object)("Elasticity Dist: " + (object)DB.m_ElasticityDistrib));
			Debug.Log((object)("Stiffness: " + DB.m_Stiffness));
			Debug.Log((object)("Stiffness Dist: " + (object)DB.m_StiffnessDistrib));
			Debug.Log((object)("Inert: " + DB.m_Inert));
			Debug.Log((object)("Inert Dist: " + (object)DB.m_InertDistrib));
			Debug.Log((object)("Radius: " + DB.m_Radius));
			Debug.Log((object)("Radius Dist: " + (object)DB.m_RadiusDistrib));
			Debug.Log((object)("End Length: " + DB.m_EndLength));
			Vector3 val = DB.m_EndOffset;
			Debug.Log((object)("End Offset: " + ((object)(Vector3)(ref val)).ToString()));
			val = DB.m_Gravity;
			Debug.Log((object)("Gravity: " + ((object)(Vector3)(ref val)).ToString()));
			val = DB.m_Force;
			Debug.Log((object)("Force: " + ((object)(Vector3)(ref val)).ToString()));
			Debug.Log((object)("FreezeAxis: " + ((object)(FreezeAxis)(ref DB.m_FreezeAxis)).ToString()));
			Debug.Log((object)("Colliders: " + DB.m_Colliders.Count));
			foreach (DynamicBoneCollider collider in DB.m_Colliders)
			{
				Debug.Log((object)("\t Parent: " + ((Object)((Component)collider).transform).name));
				Debug.Log((object)("\t Direction: " + ((object)(Direction)(ref collider.m_Direction)).ToString()));
				val = collider.m_Center;
				Debug.Log((object)("\t Center " + ((object)(Vector3)(ref val)).ToString()));
				Debug.Log((object)("\t Bound " + ((object)(Bound)(ref collider.m_Bound)).ToString()));
				Debug.Log((object)("\t Radius " + collider.m_Radius));
				Debug.Log((object)("\t Height " + collider.m_Height));
			}
			Debug.Log((object)("Exclusions: " + DB.m_Exclusions.Count));
			foreach (Transform exclusion in DB.m_Exclusions)
			{
				Debug.Log((object)("\t Transform: " + ((Object)exclusion).name));
			}
		}

		public static ChildLocator GetChildLocator(GameObject body)
		{
			ChildLocator val = null;
			Transform child = body.transform.GetChild(0);
			if (Object.op_Implicit((Object)(object)child))
			{
				Transform child2 = child.GetChild(0);
				if (Object.op_Implicit((Object)(object)child2))
				{
					val = ((Component)child2).GetComponent<ChildLocator>();
					if (Object.op_Implicit((Object)(object)val))
					{
						Debug.Log((object)"Locator Found");
					}
				}
			}
			return val;
		}

		public static Transform FindChildInTree(Transform Root, string name)
		{
			Queue<Transform> queue = new Queue<Transform>();
			queue.Enqueue(Root);
			while (queue.Count != 0)
			{
				Transform val = queue.Dequeue();
				if (((Object)val).name == name)
				{
					return val;
				}
				for (int i = 0; i < val.childCount; i++)
				{
					Transform child = val.GetChild(i);
					queue.Enqueue(child);
				}
			}
			return null;
		}

		public static string RemoveCloneNaming(string str)
		{
			return str.Remove(str.Length - 7);
		}
	}
}
namespace RuneFoxMods.DynamicSkins
{
	public static class DynamicSkinHelpers
	{
		public static SkinnedMeshRenderer[] GetBaseSkinRenderers(GameObject modelObject)
		{
			SkinnedMeshRenderer[] componentsInChildren = modelObject.GetComponentsInChildren<SkinnedMeshRenderer>(true);
			List<SkinnedMeshRenderer> list = new List<SkinnedMeshRenderer>();
			SkinnedMeshRenderer[] array = componentsInChildren;
			foreach (SkinnedMeshRenderer val in array)
			{
				if ((Object)(object)((Component)val).transform.parent == (Object)(object)modelObject.transform)
				{
					list.Add(val);
				}
			}
			return list.ToArray();
		}

		public static Transform[] BoneArrayBuilder(Transform NewBoneRoot)
		{
			List<Transform> list = new List<Transform>();
			BoneArrayBuilderHelper(NewBoneRoot, list);
			return list.ToArray();
		}

		public static void BoneArrayBuilderHelper(Transform parent, List<Transform> list)
		{
			if (!((Object)parent).name.EndsWith("_end"))
			{
				list.Add(parent);
			}
			for (int i = 0; i < parent.childCount; i++)
			{
				BoneArrayBuilderHelper(parent.GetChild(i), list);
			}
		}

		public static Transform GetArmature(GameObject obj)
		{
			return GetArmatureHelper(obj);
		}

		public static Transform GetArmatureHelper(GameObject obj)
		{
			if (((Object)obj).name.ToLower().Contains("armature"))
			{
				return obj.transform;
			}
			for (int i = 0; i < obj.transform.childCount; i++)
			{
				Transform armatureHelper = GetArmatureHelper(((Component)obj.transform.GetChild(i)).gameObject);
				if (Object.op_Implicit((Object)(object)armatureHelper))
				{
					return armatureHelper;
				}
			}
			return null;
		}

		public static Transform GetTopParent(Transform obj)
		{
			Transform val = obj;
			while ((Object)(object)val.parent != (Object)null)
			{
				val = val.parent;
			}
			return val;
		}

		public static string GetPrevBoneInList(Transform targetBone, SkinnedMeshRenderer meshRenderer)
		{
			Transform[] bones = meshRenderer.bones;
			for (int i = 0; i <= bones.Length - 1; i++)
			{
				if (((Object)bones[i + 1]).name == ((Object)targetBone).name)
				{
					return ((Object)bones[i]).name;
				}
			}
			return null;
		}

		public static int GetBoneIndexInList(Transform targetBone, SkinnedMeshRenderer meshRenderer)
		{
			Transform[] bones = meshRenderer.bones;
			for (int i = 0; i <= bones.Length; i++)
			{
				if (((Object)bones[i]).name == ((Object)targetBone).name)
				{
					return i;
				}
			}
			return -1;
		}

		public static int GetPrevBoneIndexInList(Transform targetBone, SkinnedMeshRenderer meshRenderer)
		{
			Transform[] bones = meshRenderer.bones;
			for (int i = 0; i <= bones.Length - 1; i++)
			{
				if (((Object)bones[i + 1]).name == ((Object)targetBone).name)
				{
					return i;
				}
			}
			return -1;
		}
	}
	internal class DynamicSkinManager
	{
		internal Dictionary<string, SkinDef> SkinDefs = new Dictionary<string, SkinDef>();

		private GameObject LastModelObject;

		internal Dictionary<string, SortedList<int, Modification>> ModificationList = new Dictionary<string, SortedList<int, Modification>>();

		private Dictionary<GameObject, AppliedModifications> ModifiedObjects = new Dictionary<GameObject, AppliedModifications>();

		internal ManualLogSource InstanceLogger;

		internal void AddModification(string skinNameToken, int boneIndex, Modification modification)
		{
			if (!ModificationList.TryGetValue(skinNameToken, out var value))
			{
				value = new SortedList<int, Modification>();
				ModificationList.Add(skinNameToken, value);
			}
			value.Add(boneIndex, modification);
		}

		internal void AddSkinDef(SkinDef skinDef)
		{
			SkinDefs.Add(skinDef.nameToken, skinDef);
		}

		internal void SkinDefApply(Action<SkinDef, GameObject> orig, SkinDef self, GameObject modelObject)
		{
			orig(self, modelObject);
			RemoveInvalidModelObjects();
			ModifiedObjects.TryGetValue(modelObject, out var value);
			try
			{
				if (!SkinDefs.TryGetValue(self.nameToken, out var _))
				{
					if (value != null)
					{
						ClearSkinModifications(LastModelObject, value);
					}
				}
				else if (value == null)
				{
					AppliedModifications appliedModifications = new AppliedModifications();
					ModifiedObjects.Add(modelObject, appliedModifications);
					ApplySkinModifications(self, modelObject, appliedModifications);
				}
			}
			catch (Exception ex)
			{
				InstanceLogger.LogWarning((object)"An error occured while adding accessories to a skin");
				InstanceLogger.LogError((object)ex);
			}
		}

		private void RemoveInvalidModelObjects()
		{
			foreach (GameObject item in ModifiedObjects.Keys.Where((GameObject el) => !Object.op_Implicit((Object)(object)el)).ToList())
			{
				ModifiedObjects.Remove(item);
			}
		}

		private void ClearSkinModifications(GameObject modelObject, AppliedModifications modifications)
		{
			while (modifications.BaseModelModifications.Count != 0)
			{
				Modification modification = modifications.BaseModelModifications.Pop();
				clearModification(modification, modelObject, modifications);
			}
			while (modifications.OtherModifications.Count != 0)
			{
				clearModification(modifications.OtherModifications[0], modelObject, modifications);
			}
			ModifiedObjects.Remove(modelObject);
		}

		private void ApplySkinModifications(SkinDef skindef, GameObject modelObject, AppliedModifications modifications)
		{
			CharacterModel component = modelObject.GetComponent<CharacterModel>();
			LastModelObject = modelObject;
			if (!ModificationList.TryGetValue(skindef.nameToken, out var value))
			{
				return;
			}
			foreach (KeyValuePair<int, Modification> item in value)
			{
				ApplyModification(modelObject, component, item.Value, modifications);
			}
		}

		private static void ApplyModification(GameObject modelObject, CharacterModel characterModel, Modification modification, AppliedModifications modifications)
		{
			_ = modification.bodyname;
			string parentname = modification.parentname;
			Transform val = Utils.FindChildInTree(modelObject.transform, parentname);
			GameObject val2;
			if (modification.affectsbasemodel)
			{
				val2 = Object.Instantiate<GameObject>(modification.prefab, val, false);
				((Object)val2).name = Utils.RemoveCloneNaming(((Object)val2).name);
				modification.instance = val2;
				modification.inst_armature = val2;
				ModificationApplyBones(modelObject, modification, modifications);
			}
			else
			{
				val2 = Object.Instantiate<GameObject>(modification.prefab, modelObject.transform, false);
				((Object)val2).name = Utils.RemoveCloneNaming(((Object)val2).name);
				modification.instance = val2;
				Transform armature = DynamicSkinHelpers.GetArmature(val2);
				((Component)armature).transform.SetParent(val, false);
				modification.inst_armature = ((Component)armature).gameObject;
			}
			modification.instance = val2;
			if (modification.dynamicBoneData != null)
			{
				ModificationApplyDynamicBones(modelObject, modification);
			}
			ModificationAddRenderers(val2, characterModel);
			modifications.OtherModifications.Add(modification);
		}

		private static void ModificationApplyBones(GameObject modelObject, Modification modification, AppliedModifications modifications)
		{
			SkinnedMeshRenderer[] baseSkinRenderers = DynamicSkinHelpers.GetBaseSkinRenderers(modelObject);
			List<Transform> list = baseSkinRenderers[0].bones.ToList();
			Transform[] array = DynamicSkinHelpers.BoneArrayBuilder(modification.instance.transform);
			list.InsertRange(modification.boneIndex, array);
			modification.boneCount = array.Length;
			SkinnedMeshRenderer[] array2 = baseSkinRenderers;
			for (int i = 0; i < array2.Length; i++)
			{
				array2[i].bones = list.ToArray();
			}
			modifications.BaseModelModifications.Push(modification);
		}

		private static void ModificationApplyDynamicBones(GameObject modelObject, Modification modification)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			DynamicBone val = (modification.inst_dynamicBone = modification.instance.AddComponent<DynamicBone>());
			List<DynamicBoneCollider> list = new List<DynamicBoneCollider>();
			foreach (DynamicBoneColliderData collider in modification.dynamicBoneData.m_Colliders)
			{
				DynamicBoneCollider val2 = ((Component)Utils.FindChildInTree(modelObject.transform, collider.m_parent_name)).gameObject.AddComponent<DynamicBoneCollider>();
				val2.m_Direction = collider.m_Direction;
				val2.m_Center = collider.m_Center;
				val2.m_Bound = collider.m_Bound;
				val2.m_Radius = collider.m_Radius;
				val2.m_Height = collider.m_Height;
				list.Add(val2);
			}
			modification.inst_DB_colliders = list;
			Transform root = (val.m_Root = Utils.FindChildInTree(modification.inst_armature.transform, modification.dynamicBoneData.m_Root));
			val.m_Damping = modification.dynamicBoneData.m_Damping;
			val.m_DampingDistrib = modification.dynamicBoneData.m_DampingDistrib;
			val.m_Elasticity = modification.dynamicBoneData.m_Elasticity;
			val.m_ElasticityDistrib = modification.dynamicBoneData.m_ElasticityDistrib;
			val.m_Stiffness = modification.dynamicBoneData.m_Stiffness;
			val.m_StiffnessDistrib = modification.dynamicBoneData.m_StiffnessDistrib;
			val.m_Inert = modification.dynamicBoneData.m_Inert;
			val.m_InertDistrib = modification.dynamicBoneData.m_InertDistrib;
			val.m_Radius = modification.dynamicBoneData.m_Radius;
			val.m_RadiusDistrib = modification.dynamicBoneData.m_RadiusDistrib;
			val.m_EndLength = modification.dynamicBoneData.m_EndLength;
			val.m_EndOffset = modification.dynamicBoneData.m_EndOffset;
			val.m_Gravity = modification.dynamicBoneData.m_Gravity;
			val.m_Force = modification.dynamicBoneData.m_Force;
			val.m_Colliders = list;
			val.m_Exclusions = new List<Transform>();
			foreach (string exclusion in modification.dynamicBoneData.m_Exclusions)
			{
				Transform val3 = Utils.FindChildInTree(root, exclusion);
				if ((Object)(object)val3 != (Object)null)
				{
					val.

plugins/SnowtimeToybox.dll

Decompiled 5 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.SnowtimeToybox_FireHaloWeapon;
using EntityStates.SnowtimeToybox_FriendlyTurret;
using Grumpy;
using HG;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.CharacterAI;
using R2API;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPaths.Version_1_39_0;
using Ror2AggroTools;
using ShaderSwapper;
using SnowtimeToybox;
using SnowtimeToybox.Buffs;
using SnowtimeToybox.Components;
using SnowtimeToybox.FriendlyTurretChecks;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SnowtimeToybox")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c61a4fe2af16f7008418bd8815ea50c188dba91d")]
[assembly: AssemblyProduct("SnowtimeToybox")]
[assembly: AssemblyTitle("SnowtimeToybox")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace EntityStates.SnowtimeToybox_FireHaloWeapon
{
	public class FirePlasmaRifle : GenericBulletBaseState
	{
		public string muzzleName = "NanoPistolOrigin";

		public static GameObject MuzzleFlashObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/DroneTech/PlasmaRifle/PlasmaRifleMuzzleFlashVFX.prefab");

		public static GameObject TracerObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/DroneTech/PlasmaRifle/TracerPlasmaRifle.prefab");

		public static GameObject HitObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/DroneTech/PlasmaRifle/PlasmaRifleImpactVFX.prefab");

		public GameObject muzzleFlashPrefab = MuzzleFlashObject;

		public GameObject tracerEffectPrefab = TracerObject;

		public GameObject hitEffectPrefab = HitObject;

		public string fireSoundString = "Play_Plasma_Rifle_Fire";

		public float procCoefficient = 0.7f;

		public float damageCoefficient = 0.6f;

		public float bulletRadius = 1.25f;

		public float maxDistance = 128f;

		public float baseDuration = 0.04f;

		public float bounceDamageCoefficient = 0.4f;

		public float RecoilY = 0.8f;

		public float RecoilX = 0.2f;

		public float orbSpeed = 100f;

		public bool shouldBounce = true;

		public bool useSmartCollision = true;

		public Transform muzzleTransform;

		public float additionalStocks = 26f;

		private DroneTechController controller;

		private GameObject currentDrone;

		public override void OnEnter()
		{
			controller = ((EntityState)this).GetComponent<DroneTechController>();
			((GenericBulletBaseState)this).OnEnter();
			base.duration = baseDuration / (((BaseState)this).attackSpeedStat / 4f);
			additionalStocks = 23f + ((BaseState)this).attackSpeedStat * 3.5f;
			((EntityState)this).skillLocator.primary.maxStock = (int)additionalStocks;
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}

		public override void PlayFireAnimation()
		{
			Animator modelAnimator = ((EntityState)this).GetModelAnimator();
			string text = ((Object.op_Implicit((Object)(object)modelAnimator) && (modelAnimator.GetBool("isCarried") || modelAnimator.GetBool("inLeap"))) ? "FullBody, Override" : "Gesture, Override");
			((EntityState)this).PlayAnimation(text, "FireNanoPistol");
		}

		public override void DoFireEffects()
		{
			Util.PlaySound(fireSoundString, ((EntityState)this).gameObject);
			EffectManager.SimpleMuzzleFlash(muzzleFlashPrefab, ((EntityState)this).gameObject, muzzleName, false);
		}

		public override void FireBullet(Ray aimRay)
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			TrajectoryAimAssist.ApplyTrajectoryAimAssist(ref aimRay, maxDistance, ((EntityState)this).gameObject, 1f);
			if (Object.op_Implicit((Object)(object)controller) && Object.op_Implicit((Object)(object)controller.CurrentDrone?.characterBody))
			{
				currentDrone = ((Component)controller.CurrentDrone.characterBody).gameObject;
			}
			base.recoilAmplitudeY = RecoilY;
			base.recoilAmplitudeX = RecoilX;
			((GenericBulletBaseState)this).FireBullet(aimRay);
		}

		public override void ModifyBullet(BulletAttack bulletAttack)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			((GenericBulletBaseState)this).ModifyBullet(bulletAttack);
			bulletAttack.damage = damageCoefficient * ((EntityState)this).characterBody.damage;
			bulletAttack.damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)128), (DamageTypeExtended)0, (DamageSource)1);
			DamageAPI.AddModdedDamageType(bulletAttack, SnowtimeToyboxMod.HaloRicochetOnHit);
			bulletAttack.muzzleName = muzzleName;
			bulletAttack.tracerEffectPrefab = tracerEffectPrefab;
			bulletAttack.hitEffectPrefab = hitEffectPrefab;
			bulletAttack.weapon = ((EntityState)this).gameObject;
			bulletAttack.maxDistance = maxDistance;
			bulletAttack.filterCallback = new FilterCallback(IgnoreAlliesAndCurrentDrone);
			bulletAttack.falloffModel = (FalloffModel)1;
		}

		private bool IgnoreAlliesAndCurrentDrone(BulletAttack bullet, ref BulletHit hit)
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			HurtBox component = ((Component)hit.collider).GetComponent<HurtBox>();
			if ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.healthComponent) && ((Object)(object)((Component)component.healthComponent).gameObject == (Object)(object)bullet.weapon || (Object)(object)((Component)component.healthComponent).gameObject == (Object)(object)currentDrone)) || (Object)(object)hit.entityObject == (Object)(object)((EntityState)this).gameObject || (Object)(object)hit.entityObject == (Object)(object)bullet.weapon)
			{
				return false;
			}
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.healthComponent))
			{
				return FriendlyFireManager.ShouldDirectHitProceed(component.healthComponent, ((EntityState)this).teamComponent.teamIndex);
			}
			return true;
		}
	}
}
namespace EntityStates.SnowtimeToybox_FriendlyTurret
{
	public class FireAcanthiBeam : BaseState
	{
		private struct LerpHelper
		{
			private float startTime;

			private float endTime;

			private float invTimeSpan;

			private float timeSpan;

			private bool hasStartTime;

			private bool hasEndTime;

			public void Push(float currentTime)
			{
				startTime = endTime;
				endTime = currentTime;
				hasStartTime = hasEndTime;
				hasEndTime = true;
				float num = endTime - startTime;
				if (hasStartTime && num != timeSpan)
				{
					timeSpan = num;
					invTimeSpan = 0.5f / timeSpan;
				}
			}

			public readonly float CalcLerpValue(float currentTime)
			{
				if (hasStartTime)
				{
					return (currentTime - startTime) * invTimeSpan;
				}
				return 0.5f;
			}
		}

		public static GameObject laserObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Acanthi/Skills/laseracanthi.prefab");

		public GameObject laserPrefab = laserObject;

		public string muzzleString = "Muzzle";

		public string attackSoundPlayString = "Play_HWLocust_Fire";

		public string attackSoundStopString = "Stop_HWLocust_Fire";

		public float damageCoefficient = 1f;

		public float procCoefficient = 0.4f;

		public float force;

		public float minSpread;

		public float maxSpread;

		public int bulletCount = 1;

		public float fireFrequency = 5f;

		public float maxDistance = 80f;

		private float fireStopwatch;

		private Ray laserRay;

		private Transform modelTransform;

		private GameObject laserVfxInstance;

		private Transform laserVfxInstanceEndTransform;

		private Vector3? newestRaycastHitPoint;

		private Vector3? previousRaycastHitPoint;

		private float raycastLerpValue;

		private LerpHelper vfxLerpHelper;

		private BulletAttack bulletAttack;

		private EffectManagerHelper _emh_laserEffect;

		private HitCallback hitCallback;

		private Vector3? bulletEndPos;

		private static int FireLaserStateHash = Animator.StringToHash("acanthi_firing7s");

		private static int FireLaser1StateHash = Animator.StringToHash("acanthi_firingloop");

		private static int FireLaser2StateHash = Animator.StringToHash("acanthi_firingend");

		private float firingTime;

		public override void Reset()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).Reset();
			fireStopwatch = 0f;
			firingTime = 0f;
			newestRaycastHitPoint = null;
			previousRaycastHitPoint = null;
			modelTransform = null;
			laserVfxInstance = null;
			laserVfxInstanceEndTransform = null;
			laserRay = default(Ray);
			vfxLerpHelper = default(LerpHelper);
			if (bulletAttack != null)
			{
				bulletAttack.Reset();
			}
			_emh_laserEffect = null;
		}

		public override void OnEnter()
		{
			//IL_00c9: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			Util.PlaySound(attackSoundPlayString, ((EntityState)this).gameObject);
			((EntityState)this).PlayAnimation("Gesture", FireLaserStateHash);
			fireStopwatch = 0f;
			firingTime = 0f;
			modelTransform = ((EntityState)this).GetModelTransform();
			if (!Object.op_Implicit((Object)(object)modelTransform))
			{
				return;
			}
			ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			Transform val = component.FindChild(muzzleString);
			if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)laserPrefab))
			{
				if (!EffectManager.ShouldUsePooledEffect(laserPrefab))
				{
					laserVfxInstance = Object.Instantiate<GameObject>(laserPrefab, val.position, val.rotation);
				}
				else
				{
					_emh_laserEffect = EffectManager.GetAndActivatePooledEffect(laserPrefab, val.position, val.rotation);
					laserVfxInstance = ((Component)_emh_laserEffect).gameObject;
				}
				if (Object.op_Implicit((Object)(object)laserVfxInstance))
				{
					ChildLocator component2 = laserVfxInstance.GetComponent<ChildLocator>();
					laserVfxInstanceEndTransform = component2.FindChild("LaserEnd");
				}
				laserVfxInstance.transform.parent = val;
			}
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)laserVfxInstance))
			{
				if ((Object)(object)_emh_laserEffect != (Object)null && _emh_laserEffect.OwningPool != null)
				{
					((GenericPool<EffectManagerHelper>)(object)_emh_laserEffect.OwningPool).ReturnObject(_emh_laserEffect);
				}
				else
				{
					EntityState.Destroy((Object)(object)laserVfxInstance);
				}
			}
			laserVfxInstance = null;
			laserVfxInstanceEndTransform = null;
			_emh_laserEffect = null;
			Util.PlaySound(attackSoundStopString, ((EntityState)this).gameObject);
			((EntityState)this).PlayAnimation("Gesture", FireLaser2StateHash);
			((EntityState)this).OnExit();
		}

		private void UpdateBeamVFX(float time)
		{
			//IL_003c: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = UnityObjectExtensions.AsValidOrNull<GameObject>(laserVfxInstance);
			if (obj != null)
			{
				obj.SetActive(newestRaycastHitPoint.HasValue);
			}
			if (Object.op_Implicit((Object)(object)laserVfxInstanceEndTransform) && newestRaycastHitPoint.HasValue)
			{
				Ray val = GetLaserRay();
				float num = vfxLerpHelper.CalcLerpValue(time);
				Vector3 val2 = Vector3.Lerp((previousRaycastHitPoint ?? newestRaycastHitPoint).Value, newestRaycastHitPoint.Value, num) - ((Ray)(ref val)).origin;
				float magnitude = ((Vector3)(ref val2)).magnitude;
				laserVfxInstanceEndTransform.position = ((Ray)(ref val)).GetPoint(magnitude);
			}
		}

		public override void Update()
		{
			((EntityState)this).Update();
			UpdateBeamVFX(Time.time);
		}

		public override void FixedUpdate()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (Time.fixedDeltaTime > 0f)
			{
				laserRay = GetLaserRay();
				fireStopwatch += Time.fixedDeltaTime;
				firingTime += Time.fixedDeltaTime;
				if (firingTime > 7f)
				{
					firingTime = 7f;
				}
				float num = Math.Clamp(0.7f / (1f + firingTime / 7f), 0.35f, 0.6f);
				procCoefficient = Math.Clamp(firingTime / 14f, 0.05f, 0.5f);
				float num2 = fireFrequency;
				float num3 = num / num2;
				if (fireStopwatch > num3)
				{
					fireStopwatch = 0f;
					FireBullet(laserRay, muzzleString, Time.fixedTime);
				}
				if (((EntityState)this).isAuthority && !ShouldFireLaser())
				{
					((EntityState)this).outer.SetNextState(GetNextState());
				}
			}
		}

		protected Vector3 GetBeamEndPoint()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			Vector3 point = ((Ray)(ref laserRay)).GetPoint(maxDistance);
			RaycastHit val = default(RaycastHit);
			if (Util.CharacterRaycast(((EntityState)this).gameObject, laserRay, ref val, maxDistance, LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)), (QueryTriggerInteraction)0))
			{
				point = ((RaycastHit)(ref val)).point;
			}
			return point;
		}

		protected virtual EntityState GetNextState()
		{
			return EntityStateCatalog.InstantiateState(ref ((EntityState)this).outer.mainStateType);
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}

		public virtual bool ShouldFireLaser()
		{
			if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank))
			{
				return ((EntityState)this).inputBank.skill1.down;
			}
			return false;
		}

		public virtual Ray GetLaserRay()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return ((BaseState)this).GetAimRay();
		}

		private void FireBullet(Ray laserRay, string targetMuzzle, float time)
		{
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			previousRaycastHitPoint = newestRaycastHitPoint;
			RaycastHit val = default(RaycastHit);
			if (((EntityState)this).isAuthority)
			{
				if (bulletAttack == null)
				{
					bulletAttack = new BulletAttack();
				}
				bulletAttack.owner = ((EntityState)this).gameObject;
				bulletAttack.weapon = ((EntityState)this).gameObject;
				bulletAttack.origin = ((Ray)(ref laserRay)).origin;
				bulletAttack.aimVector = ((Ray)(ref laserRay)).direction;
				bulletAttack.minSpread = minSpread;
				bulletAttack.maxSpread = maxSpread;
				bulletAttack.bulletCount = 1u;
				bulletAttack.damage = damageCoefficient * base.damageStat + base.attackSpeedStat;
				bulletAttack.procCoefficient = procCoefficient;
				bulletAttack.force = force;
				bulletAttack.muzzleName = targetMuzzle;
				bulletAttack.hitEffectPrefab = null;
				bulletAttack.isCrit = Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master);
				bulletAttack.HitEffectNormal = false;
				bulletAttack.radius = 0f;
				bulletAttack.maxDistance = maxDistance;
				bulletAttack.hitCallback = hitCallback;
				bulletAttack.damageType = DamageTypeCombo.op_Implicit((DamageType)0);
				bulletAttack.damageType.damageSource = (DamageSource)1;
				DamageAPI.AddModdedDamageType(bulletAttack, AcanthiBleeding.Acanthi_ButHeresTheBleeder);
				bulletAttack.Fire();
				newestRaycastHitPoint = bulletEndPos;
				bulletEndPos = null;
			}
			else if (Object.op_Implicit((Object)(object)laserVfxInstanceEndTransform) && Util.CharacterRaycast(((EntityState)this).gameObject, laserRay, ref val, maxDistance, LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)), (QueryTriggerInteraction)0))
			{
				newestRaycastHitPoint = ((RaycastHit)(ref val)).point;
			}
			if (!newestRaycastHitPoint.HasValue)
			{
				newestRaycastHitPoint = ((Ray)(ref laserRay)).GetPoint(maxDistance);
			}
			vfxLerpHelper.Push(time + Time.fixedDeltaTime);
		}

		public FireAcanthiBeam()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			hitCallback = new HitCallback(OnBulletHitAuthority);
		}

		private bool OnBulletHitAuthority(BulletAttack bulletAttack, ref BulletHit hitInfo)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			bool result = BulletAttack.defaultHitCallback.Invoke(bulletAttack, ref hitInfo);
			bulletEndPos = (Vector3)(((??)bulletEndPos) ?? hitInfo.point);
			return result;
		}
	}
	public class ChargeBorboLaser : BaseState
	{
		public static float baseDuration = 2.5f;

		public static float laserMaxWidth = 0.2f;

		public static GameObject effectPrefabObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Borbo/Skills/ChargeBorbo.prefab");

		public static GameObject laserPrefabObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Borbo/Skills/LaserBorbo.prefab");

		public static GameObject effectPrefab = effectPrefabObject;

		public static GameObject laserPrefab = laserPrefabObject;

		public static string attackSoundString = "Play_Borbo_Laser_Charge";

		private float duration;

		private uint chargePlayID;

		private GameObject chargeEffect;

		private GameObject laserEffect;

		private LineRenderer laserLineComponent;

		private Vector3 laserDirection;

		private Vector3 visualEndPosition;

		private float flashTimer;

		private bool laserOn;

		protected EffectManagerHelper _efh_Charge;

		private static int ChargeLaserStateHash = Animator.StringToHash("ChargeLaser");

		private static int ChargeLaserParamHash = Animator.StringToHash("ChargeLaser.playbackRate");

		public override void Reset()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).Reset();
			duration = 0f;
			chargePlayID = 0u;
			chargeEffect = null;
			laserLineComponent = null;
			laserDirection = Vector3.zero;
			visualEndPosition = Vector3.zero;
			flashTimer = 0f;
			laserOn = false;
			_efh_Charge = null;
		}

		public override void OnEnter()
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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)
			((BaseState)this).OnEnter();
			((EntityState)this).SetAIUpdateFrequency(true);
			duration = baseDuration;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			chargePlayID = Util.PlayAttackSpeedSound(attackSoundString, ((EntityState)this).gameObject, base.attackSpeedStat);
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Transform val = component.FindChild("Muzzle");
					if (Object.op_Implicit((Object)(object)val))
					{
						if (Object.op_Implicit((Object)(object)effectPrefab))
						{
							if (!EffectManager.ShouldUsePooledEffect(effectPrefab))
							{
								chargeEffect = Object.Instantiate<GameObject>(effectPrefab, val.position, val.rotation);
							}
							else
							{
								_efh_Charge = EffectManager.GetAndActivatePooledEffect(effectPrefab, val.position, val.rotation);
								chargeEffect = ((Component)_efh_Charge).gameObject;
							}
							chargeEffect.transform.parent = val;
							ScaleParticleSystemDuration component2 = chargeEffect.GetComponent<ScaleParticleSystemDuration>();
							if (Object.op_Implicit((Object)(object)component2))
							{
								component2.newDuration = duration;
							}
						}
						if (Object.op_Implicit((Object)(object)laserPrefab) && (Object)(object)laserEffect == (Object)null)
						{
							laserEffect = Object.Instantiate<GameObject>(laserPrefab, val.position, val.rotation);
						}
						if ((Object)(object)laserEffect != (Object)null)
						{
							if (!laserEffect.activeInHierarchy)
							{
								laserEffect.SetActive(true);
							}
							if ((Object)(object)laserEffect.transform.parent != (Object)(object)val)
							{
								laserEffect.transform.parent = val;
							}
							laserLineComponent = laserEffect.GetComponent<LineRenderer>();
						}
					}
				}
			}
			((EntityState)this).PlayAnimation("Gesture", ChargeLaserStateHash, ChargeLaserParamHash, duration);
			flashTimer = 0f;
			laserOn = true;
		}

		public override void OnExit()
		{
			AkSoundEngine.StopPlayingID(chargePlayID);
			((EntityState)this).OnExit();
			((EntityState)this).SetAIUpdateFrequency(false);
			if (Object.op_Implicit((Object)(object)chargeEffect))
			{
				if (!EffectManager.UsePools)
				{
					EntityState.Destroy((Object)(object)chargeEffect);
				}
				else if ((Object)(object)_efh_Charge != (Object)null && _efh_Charge.OwningPool != null)
				{
					if (!((PrefabComponentPool<EffectManagerHelper>)(object)_efh_Charge.OwningPool).IsObjectInPool(_efh_Charge))
					{
						((GenericPool<EffectManagerHelper>)(object)_efh_Charge.OwningPool).ReturnObject(_efh_Charge);
					}
				}
				else
				{
					_ = (Object)(object)_efh_Charge != (Object)null;
					EntityState.Destroy((Object)(object)chargeEffect);
				}
			}
			if (Object.op_Implicit((Object)(object)laserEffect) && laserEffect.activeInHierarchy)
			{
				laserEffect.SetActive(false);
			}
		}

		public override void Update()
		{
			//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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).Update();
			if (!Object.op_Implicit((Object)(object)laserEffect) || !Object.op_Implicit((Object)(object)laserLineComponent))
			{
				return;
			}
			float num = 1000f;
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 position = laserEffect.transform.parent.position;
			Vector3 point = ((Ray)(ref aimRay)).GetPoint(num);
			laserDirection = point - position;
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(aimRay, ref val, num, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)))
			{
				point = ((RaycastHit)(ref val)).point;
			}
			laserLineComponent.SetPosition(0, position);
			laserLineComponent.SetPosition(1, point);
			float num2;
			if (duration - ((EntityState)this).age > 0.5f)
			{
				num2 = ((EntityState)this).age / duration;
			}
			else
			{
				flashTimer -= Time.deltaTime;
				if (flashTimer <= 0f)
				{
					laserOn = !laserOn;
					flashTimer = 1f / 30f;
				}
				num2 = (laserOn ? 1f : 0f);
			}
			num2 *= laserMaxWidth;
			laserLineComponent.startWidth = num2;
			laserLineComponent.endWidth = num2;
		}

		public override void FixedUpdate()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				FireBorboLaser fireBorboLaser = new FireBorboLaser();
				fireBorboLaser.laserDirection = laserDirection;
				((EntityState)this).outer.SetNextState((EntityState)(object)fireBorboLaser);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public class FireBorboLaser : BaseState
	{
		public static GameObject effectPrefabObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Borbo/Skills/MuzzleflashBorbo.prefab");

		public static GameObject hitEffectPrefabObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Borbo/Skills/ExplosionBorbo.prefab");

		public static GameObject tracerEffectPrefabObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Borbo/Skills/TracerBorbo.prefab");

		public static GameObject effectPrefab = effectPrefabObject;

		public static GameObject hitEffectPrefab = hitEffectPrefabObject;

		public static GameObject tracerEffectPrefab = tracerEffectPrefabObject;

		public static Component TracerWaow;

		public static float damageCoefficient = 15f;

		public static float blastRadius = 8f;

		public static float force = 5000f;

		public static float minSpread = 0f;

		public static float maxSpread = 0f;

		public static int bulletCount = 1;

		public static float baseDuration = 5f;

		public static string attackSoundString = "Play_Borbo_Laser_Fire";

		public static string attackFoleySoundString = "Play_Borbo_Laser_Overheat";

		public Vector3 laserDirection;

		public float selfKnockbackForce = 10f;

		private float duration;

		private Ray modifiedAimRay;

		private static int FireLaserStateHash = Animator.StringToHash("FireLaser");

		private static int FireLaserParamHash = Animator.StringToHash("FireLaser.playbackRate");

		public override void OnEnter()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Expected O, but got Unknown
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Expected O, but got Unknown
			((BaseState)this).OnEnter();
			if (!Object.op_Implicit((Object)(object)tracerEffectPrefabObject.GetComponent<TracerComponentLinger>()))
			{
				tracerEffectPrefabObject.AddComponent<TracerComponentLinger>();
			}
			duration = baseDuration;
			modifiedAimRay = ((BaseState)this).GetAimRay();
			((Ray)(ref modifiedAimRay)).direction = laserDirection;
			((EntityState)this).GetModelAnimator();
			((EntityState)this).characterBody.characterMotor.ApplyForce((0f - selfKnockbackForce) * laserDirection, false, false);
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			Util.PlaySound(attackSoundString, ((EntityState)this).gameObject);
			Util.PlaySound(attackFoleySoundString, ((EntityState)this).gameObject);
			string text = "Muzzle";
			((EntityState)this).PlayAnimation("Gesture", FireLaserStateHash, FireLaserParamHash, duration);
			if (Object.op_Implicit((Object)(object)effectPrefab))
			{
				EffectManager.SimpleMuzzleFlash(effectPrefab, ((EntityState)this).gameObject, text, false);
			}
			if (!((EntityState)this).isAuthority)
			{
				return;
			}
			float num = 1000f;
			Vector3 val = ((Ray)(ref modifiedAimRay)).origin + ((Ray)(ref modifiedAimRay)).direction * num;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(modifiedAimRay, ref val2, num, LayerMask.op_Implicit(CommonMasks.laser)))
			{
				val = ((RaycastHit)(ref val2)).point;
			}
			BlastAttack val3 = new BlastAttack
			{
				attacker = ((EntityState)this).gameObject,
				inflictor = ((EntityState)this).gameObject,
				teamIndex = TeamComponent.GetObjectTeam(((EntityState)this).gameObject),
				baseDamage = base.damageStat * damageCoefficient * Math.Clamp(base.attackSpeedStat / 2f, 1f, 69420f),
				baseForce = force * 0.2f,
				position = val,
				radius = blastRadius,
				falloffModel = (FalloffModel)2,
				bonusForce = force * ((Ray)(ref modifiedAimRay)).direction,
				damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)0, (DamageSource)1)
			};
			DamageAPI.AddModdedDamageType(val3, SnowtimeToyboxMod.BorboSuperDebuffOnHit);
			val3.Fire();
			_ = ((Ray)(ref modifiedAimRay)).origin;
			if (!Object.op_Implicit((Object)(object)modelTransform))
			{
				return;
			}
			ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
			if (Object.op_Implicit((Object)(object)component))
			{
				int num2 = component.FindChildIndex(text);
				if (Object.op_Implicit((Object)(object)tracerEffectPrefab))
				{
					EffectData val4 = new EffectData
					{
						origin = val,
						start = ((Ray)(ref modifiedAimRay)).origin
					};
					val4.SetChildLocatorTransformReference(((EntityState)this).gameObject, num2);
					EffectManager.SpawnEffect(tracerEffectPrefab, val4, true);
					EffectManager.SpawnEffect(hitEffectPrefab, val4, true);
				}
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public class FireBreadBeam : BaseState
	{
		private struct LerpHelper
		{
			private float startTime;

			private float endTime;

			private float invTimeSpan;

			private float timeSpan;

			private bool hasStartTime;

			private bool hasEndTime;

			public void Push(float currentTime)
			{
				startTime = endTime;
				endTime = currentTime;
				hasStartTime = hasEndTime;
				hasEndTime = true;
				float num = endTime - startTime;
				if (hasStartTime && num != timeSpan)
				{
					timeSpan = num;
					invTimeSpan = 0.5f / timeSpan;
				}
			}

			public readonly float CalcLerpValue(float currentTime)
			{
				if (hasStartTime)
				{
					return (currentTime - startTime) * invTimeSpan;
				}
				return 0.5f;
			}
		}

		public static float baseDuration = 0.5f;

		public static GameObject healBeamPrefab = SnowtimeToyboxMod.FriendlyTurretBreadBeamL;

		public static GameObject healBeamPrefabR = SnowtimeToyboxMod.FriendlyTurretBreadBeamR;

		public HurtBox target;

		private float duration;

		private Transform modelTransform;

		private EffectManagerHelper _emh_laserEffect;

		private EffectManagerHelper _emh_laserEffect2;

		private GameObject laserVfxInstance;

		private GameObject laserVfxInstance2;

		private Transform laserVfxInstanceStartTransform;

		private Transform laserVfxInstanceStartTransform2;

		private Transform laserVfxInstanceEndTransform;

		private Transform laserVfxInstanceEndTransform2;

		private LerpHelper vfxLerpHelper;

		private Ray laserRay;

		private Vector3? newestRaycastHitPoint;

		private Vector3? previousRaycastHitPoint;

		private Transform muzzleL;

		private Transform muzzleR;

		private ChildLocator childLocator;

		protected ref ButtonState skillButtonState => ref ((EntityState)this).inputBank.skill1;

		public override void Reset()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			Log.Debug("redsrt");
			((BaseState)this).Reset();
			modelTransform = null;
			laserVfxInstance = null;
			laserVfxInstance2 = null;
			laserVfxInstanceEndTransform = null;
			laserVfxInstanceEndTransform2 = null;
			laserRay = default(Ray);
			vfxLerpHelper = default(LerpHelper);
			_emh_laserEffect = null;
			_emh_laserEffect2 = null;
		}

		public override void OnEnter()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration;
			modelTransform = ((EntityState)this).GetModelTransform();
			if (!Object.op_Implicit((Object)(object)modelTransform))
			{
				return;
			}
			childLocator = ((Component)modelTransform).GetComponent<ChildLocator>();
			if (!Object.op_Implicit((Object)(object)childLocator))
			{
				return;
			}
			muzzleL = childLocator.FindChild("Muzzle_L");
			muzzleR = childLocator.FindChild("Muzzle_R");
			Ray aimRay = ((BaseState)this).GetAimRay();
			BullseyeSearch val = new BullseyeSearch();
			val.teamMaskFilter = TeamMask.none;
			if (Object.op_Implicit((Object)(object)((EntityState)this).teamComponent))
			{
				((TeamMask)(ref val.teamMaskFilter)).AddTeam(((EntityState)this).teamComponent.teamIndex);
			}
			val.filterByLoS = false;
			val.maxDistanceFilter = 50f;
			val.maxAngleFilter = 180f;
			val.searchOrigin = ((Ray)(ref aimRay)).origin;
			val.searchDirection = ((Ray)(ref aimRay)).direction;
			val.sortMode = (SortMode)2;
			val.RefreshCandidates();
			val.FilterOutGameObject(((EntityState)this).gameObject);
			target = val.GetResults().FirstOrDefault();
			if (!((Object)(object)_emh_laserEffect != (Object)null) && !((Object)(object)_emh_laserEffect2 != (Object)null) && Object.op_Implicit((Object)(object)((EntityState)this).transform) && Object.op_Implicit((Object)(object)healBeamPrefab) && Object.op_Implicit((Object)(object)healBeamPrefabR))
			{
				if (!EffectManager.ShouldUsePooledEffect(healBeamPrefab))
				{
					laserVfxInstance = Object.Instantiate<GameObject>(healBeamPrefab, muzzleL.position, muzzleL.rotation);
				}
				else
				{
					_emh_laserEffect = EffectManager.GetAndActivatePooledEffect(healBeamPrefab, muzzleL.position, muzzleL.rotation);
					laserVfxInstance = ((Component)_emh_laserEffect).gameObject;
				}
				if (!EffectManager.ShouldUsePooledEffect(healBeamPrefabR))
				{
					laserVfxInstance2 = Object.Instantiate<GameObject>(healBeamPrefabR, muzzleR.position, muzzleR.rotation);
				}
				else
				{
					_emh_laserEffect2 = EffectManager.GetAndActivatePooledEffect(healBeamPrefabR, muzzleR.position, muzzleR.rotation);
					laserVfxInstance2 = ((Component)_emh_laserEffect2).gameObject;
				}
				if (Object.op_Implicit((Object)(object)laserVfxInstance))
				{
					ChildLocator component = laserVfxInstance.GetComponent<ChildLocator>();
					laserVfxInstanceEndTransform = component.FindChild("LaserEnd");
					laserVfxInstanceStartTransform = laserVfxInstance.transform.Find("HealBeamStartPoint");
				}
				if (Object.op_Implicit((Object)(object)laserVfxInstance2))
				{
					ChildLocator component2 = laserVfxInstance2.GetComponent<ChildLocator>();
					laserVfxInstanceEndTransform2 = component2.FindChild("LaserEnd");
					laserVfxInstanceStartTransform2 = laserVfxInstance2.transform.Find("HealBeamStartPoint");
				}
				laserVfxInstance.transform.parent = ((EntityState)this).transform;
				laserVfxInstance2.transform.parent = ((EntityState)this).transform;
			}
		}

		private void UpdateBeamVFX(float time)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = UnityObjectExtensions.AsValidOrNull<GameObject>(laserVfxInstance);
			if (obj != null)
			{
				obj.SetActive(newestRaycastHitPoint.HasValue);
			}
			GameObject obj2 = UnityObjectExtensions.AsValidOrNull<GameObject>(laserVfxInstance2);
			if (obj2 != null)
			{
				obj2.SetActive(newestRaycastHitPoint.HasValue);
			}
			if (Object.op_Implicit((Object)(object)laserVfxInstanceEndTransform) && Object.op_Implicit((Object)(object)laserVfxInstanceEndTransform2) && newestRaycastHitPoint.HasValue)
			{
				laserVfxInstanceEndTransform.position = ((Component)target).transform.position;
				laserVfxInstanceEndTransform2.position = ((Component)target).transform.position;
				laserVfxInstanceStartTransform.position = muzzleL.position;
				laserVfxInstanceStartTransform2.position = muzzleR.position;
			}
		}

		private void UpdateEndPoint(Ray laserRay)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			previousRaycastHitPoint = newestRaycastHitPoint;
			if (Object.op_Implicit((Object)(object)target))
			{
				newestRaycastHitPoint = ((Component)target).transform.position;
			}
			vfxLerpHelper.Push(0.01f + Time.fixedDeltaTime);
		}

		public override void FixedUpdate()
		{
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration || !Object.op_Implicit((Object)(object)target))
			{
				_ = ((EntityState)this).isAuthority;
			}
			if (((EntityState)this).isAuthority && !skillButtonState.down)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			if (!Object.op_Implicit((Object)(object)((EntityState)this).transform) || !Object.op_Implicit((Object)(object)target) || !Object.op_Implicit((Object)(object)target) || !Object.op_Implicit((Object)(object)target?.healthComponent) || !Object.op_Implicit((Object)(object)target?.healthComponent?.body))
			{
				return;
			}
			CharacterBody body = target.healthComponent.body;
			if (body.HasBuff(SnowtimeToyboxMod.BreadTurretBuffFortune) && NetworkServer.active)
			{
				foreach (TimedBuff timedBuff in target.healthComponent.body.timedBuffs)
				{
					if (timedBuff.buffIndex == SnowtimeToyboxMod.BreadTurretBuffFortune.buffIndex)
					{
						timedBuff.timer = 0.5f;
					}
				}
				return;
			}
			if (NetworkServer.active)
			{
				body.AddTimedBuff(SnowtimeToyboxMod.BreadTurretBuffFortune, 0.5f);
			}
		}

		public override void Update()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).Update();
			UpdateEndPoint(laserRay);
			UpdateBeamVFX(Time.time);
		}

		public override void OnExit()
		{
			if (Object.op_Implicit((Object)(object)laserVfxInstance))
			{
				if ((Object)(object)_emh_laserEffect != (Object)null && _emh_laserEffect.OwningPool != null)
				{
					((GenericPool<EffectManagerHelper>)(object)_emh_laserEffect.OwningPool).ReturnObject(_emh_laserEffect);
					((GenericPool<EffectManagerHelper>)(object)_emh_laserEffect2.OwningPool).ReturnObject(_emh_laserEffect2);
				}
				else
				{
					EntityState.Destroy((Object)(object)laserVfxInstance);
					EntityState.Destroy((Object)(object)laserVfxInstance2);
				}
			}
			laserVfxInstance = null;
			laserVfxInstance2 = null;
			laserVfxInstanceEndTransform = null;
			laserVfxInstanceEndTransform2 = null;
			_emh_laserEffect = null;
			_emh_laserEffect2 = null;
			((EntityState)this).OnExit();
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//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)
			((EntityState)this).OnSerialize(writer);
			HurtBoxReference val = HurtBoxReference.FromHurtBox(target);
			((HurtBoxReference)(ref val)).Write(writer);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnDeserialize(reader);
			HurtBoxReference val = default(HurtBoxReference);
			((HurtBoxReference)(ref val)).Read(reader);
			GameObject obj = ((HurtBoxReference)(ref val)).ResolveGameObject();
			target = ((obj != null) ? obj.GetComponent<HurtBox>() : null);
		}
	}
	public class Shenanigans : BaseSkillState
	{
		public static float hopPower = 7f;

		public static string playtimeSoundString = "Play_Item_FriendUnit_VO_Whistle";

		public static string stopSoundString = "Play_Item_FriendUnit_VO_Happy";

		public static float baseDuration = 2f;

		public static float timeBetweenHops = 0.2f;

		private float hopTimer;

		private uint soundID;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			hopTimer = 0f;
			soundID = Util.PlaySound(playtimeSoundString, ((Component)((EntityState)this).outer).gameObject);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (hopTimer > 0f)
			{
				hopTimer -= Time.deltaTime;
			}
			if (((EntityState)this).characterMotor.isGrounded && hopTimer <= 0f)
			{
				((BaseState)this).SmallHop(((EntityState)this).characterMotor, hopPower);
				hopTimer += timeBetweenHops;
			}
			if (((EntityState)this).isAuthority && !((BaseSkillState)this).IsKeyDownAuthority())
			{
				AkSoundEngine.StopPlayingID(soundID);
				Util.PlaySound(stopSoundString, ((Component)((EntityState)this).outer).gameObject);
				((EntityState)this).outer.SetNextStateToMain();
			}
		}
	}
	public class ShortcakeTaunt : BaseState
	{
		public static GameObject effectPrefab;

		public static GameObject hitEffectPrefab;

		public static GameObject tracerEffectPrefab;

		public static float damageCoefficient = 0.7f;

		public static float radius = 45f;

		public static float baseDuration = 2f;

		private float duration;

		private int max = 999;

		public override void OnEnter()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			if (!SnowtimeToyboxMod.FriendlyTurretShortcakeAggroType.Value)
			{
				((EntityState)this).characterBody.AddTimedBuff(AggroToolsPlugin.priorityAggro, 0.5f);
			}
			duration = baseDuration / base.attackSpeedStat;
			TeamIndex teamIndex = ((EntityState)this).gameObject.GetComponent<TeamComponent>().teamIndex;
			HurtBox[] hurtBoxes = new SphereSearch
			{
				origin = ((EntityState)this).characterBody.corePosition,
				radius = radius,
				mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
				queryTriggerInteraction = (QueryTriggerInteraction)0
			}.RefreshCandidates().FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(teamIndex)).OrderCandidatesByDistance()
				.FilterCandidatesByDistinctHurtBoxEntities()
				.GetHurtBoxes();
			if (((EntityState)this).isAuthority)
			{
				for (int i = 0; i < Mathf.Min(max, hurtBoxes.Length); i++)
				{
					SnowtimeOrbs snowtimeOrbs = new SnowtimeOrbs();
					snowtimeOrbs.attacker = ((EntityState)this).gameObject;
					snowtimeOrbs.speed = 300f;
					snowtimeOrbs.damageColorIndex = (DamageColorIndex)0;
					snowtimeOrbs.damageValue = ((EntityState)this).characterBody.damage * damageCoefficient;
					snowtimeOrbs.isCrit = Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master);
					snowtimeOrbs.snowtimeOrbType = SnowtimeOrbs.OrbTypes.ShortcakeTaunt;
					((Orb)snowtimeOrbs).origin = ((EntityState)this).characterBody.corePosition;
					snowtimeOrbs.procCoefficient = 0f;
					snowtimeOrbs.range = 0f;
					snowtimeOrbs.teamIndex = teamIndex;
					((Orb)snowtimeOrbs).target = hurtBoxes[i];
					OrbManager.instance.AddOrb((Orb)(object)snowtimeOrbs);
				}
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public class SnowtimeCryoGaussFire : BaseState
	{
		public static GameObject muzzleflashEffectObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Snowtime/Skills/CryoGaussMuzzleFlash.prefab");

		public static GameObject muzzleflashEffectPrefab = muzzleflashEffectObject;

		public static GameObject projectileObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Snowtime/Skills/CryoGaussProjectile.prefab");

		public static GameObject projectilePrefab = projectileObject;

		public static GameObject projectileGhostObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Snowtime/Skills/CryoGaussProjectileGhost.prefab");

		public static GameObject projectileExplosionObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Snowtime/Skills/CryoGaussExplosion.prefab");

		public static Component TracerWaow;

		public static float damageCoefficient = 4f;

		public static float blastRadius = 4f;

		public static float force = 400f;

		public static float minSpread = 0f;

		public static float maxSpread = 0f;

		public static int bulletCount = 1;

		public static float baseDuration = 0.9f;

		public static string attackSoundString = "Play_Snowtime_Gauss";

		public Vector3 laserDirection;

		public float selfKnockbackForce = 1f;

		private float duration;

		private Ray modifiedAimRay;

		private static int FireLaserStateHash = Animator.StringToHash("FireWeapon");

		public override void OnEnter()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration;
			Ray aimRay = ((BaseState)this).GetAimRay();
			((Ray)(ref modifiedAimRay)).direction = laserDirection;
			((EntityState)this).GetModelAnimator();
			((EntityState)this).characterBody.characterMotor.ApplyForce((0f - selfKnockbackForce) * laserDirection, false, false);
			((EntityState)this).GetModelTransform();
			Util.PlaySound(attackSoundString, ((EntityState)this).gameObject);
			string text = "Muzzle";
			projectileObject.GetComponent<ProjectileController>().ghostPrefab = projectileGhostObject;
			((EntityState)this).PlayAnimation("Gesture", FireLaserStateHash);
			if (Object.op_Implicit((Object)(object)muzzleflashEffectPrefab))
			{
				EffectManager.SimpleMuzzleFlash(muzzleflashEffectPrefab, ((EntityState)this).gameObject, text, false);
			}
			if (((EntityState)this).isAuthority)
			{
				TrajectoryAimAssist.ApplyTrajectoryAimAssist(ref aimRay, projectilePrefab, ((EntityState)this).gameObject, 1f);
				FireProjectileInfo val = default(FireProjectileInfo);
				val.projectilePrefab = projectilePrefab;
				val.position = ((Ray)(ref aimRay)).origin;
				val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
				val.owner = ((EntityState)this).gameObject;
				val.damage = damageCoefficient * (base.damageStat + (base.attackSpeedStat - 1f));
				val.force = force;
				val.crit = Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master);
				val.damageTypeOverride = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)8), (DamageTypeExtended)131072, (DamageSource)1);
				FireProjectileInfo val2 = val;
				ProjectileManager.instance.FireProjectile(val2);
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
}
namespace SnowtimeToybox
{
	public class SnowtimeHaloRicochetOrb : GenericDamageOrb
	{
		public class RicochetOrb : GenericDamageOrb
		{
			public GameObject effectPrefab;

			public override GameObject GetOrbEffect()
			{
				return effectPrefab;
			}
		}

		public static GameObject orbEffectObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/DroneTech/PlasmaRifle/PlasmaRifleOrbEffect.prefab");

		public GameObject orbEffectPrefab = orbEffectObject;

		public override void Begin()
		{
			//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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			base.speed = 220f;
			((Orb)this).duration = Mathf.Max(((Orb)this).distanceToTarget / base.speed, 0.167f);
			EffectData val = new EffectData
			{
				scale = base.scale,
				origin = ((Orb)this).origin,
				genericFloat = ((Orb)this).duration
			};
			if (Object.op_Implicit((Object)(object)((Orb)this).target))
			{
				val.SetHurtBoxReference(((Orb)this).target);
			}
		}

		public override void OnArrival()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((Orb)this).target) && Object.op_Implicit((Object)(object)((Orb)this).target.healthComponent) && ((Orb)this).target.healthComponent.alive)
			{
				DamageInfo val = new DamageInfo();
				val.damage = base.damageValue;
				val.attacker = base.attacker;
				val.inflictor = null;
				val.force = Vector3.zero;
				val.crit = base.isCrit;
				val.procChainMask = base.procChainMask;
				val.procCoefficient = base.procCoefficient;
				val.position = ((Component)((Orb)this).target).transform.position;
				val.damageColorIndex = base.damageColorIndex;
				val.damageType = base.damageType;
				val.inflictedHurtbox = ((Orb)this).target;
				((Orb)this).target.healthComponent.TakeDamage(val);
				GlobalEventManager.instance.OnHitEnemy(val, ((Component)((Orb)this).target.healthComponent).gameObject);
				GlobalEventManager.instance.OnHitAll(val, ((Component)((Orb)this).target.healthComponent).gameObject);
			}
		}

		public static void CreateHaloRicochetOrb(DamageInfo damageInfo, TeamIndex attackerTeamIndex, CharacterBody victim, List<BodyIndex> killedBodies = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0034: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: 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)
			HurtBox val = null;
			BullseyeSearch val2 = new BullseyeSearch();
			val2.searchOrigin = damageInfo.position;
			val2.searchDirection = Vector3.zero;
			val2.teamMaskFilter = TeamMask.GetEnemyTeams(attackerTeamIndex);
			val2.filterByLoS = false;
			val2.sortMode = (SortMode)0;
			val2.maxAngleFilter = 180f;
			val2.maxDistanceFilter = 27f;
			val2.filterByDistinctEntity = true;
			val2.RefreshCandidates();
			if (Object.op_Implicit((Object)(object)victim))
			{
				val2.FilterOutGameObject(((Component)victim).gameObject);
			}
			IEnumerable<HurtBox> results = val2.GetResults();
			float num = float.PositiveInfinity;
			foreach (HurtBox item in results)
			{
				if (Object.op_Implicit((Object)(object)item.healthComponent) && (double)item.healthComponent.combinedHealth < (double)num && item.healthComponent.alive)
				{
					num = item.healthComponent.combinedHealth;
					val = item;
				}
			}
			if (Object.op_Implicit((Object)(object)val))
			{
				RicochetOrb ricochetOrb = new RicochetOrb();
				((Orb)ricochetOrb).origin = damageInfo.position;
				ricochetOrb.effectPrefab = orbEffectObject;
				((GenericDamageOrb)ricochetOrb).damageValue = damageInfo.damage * 0.75f;
				((GenericDamageOrb)ricochetOrb).isCrit = damageInfo.crit;
				((GenericDamageOrb)ricochetOrb).teamIndex = attackerTeamIndex;
				((GenericDamageOrb)ricochetOrb).attacker = damageInfo.attacker;
				((GenericDamageOrb)ricochetOrb).procChainMask = damageInfo.procChainMask;
				((GenericDamageOrb)ricochetOrb).procCoefficient = 0.3f;
				((GenericDamageOrb)ricochetOrb).damageType = DamageTypeCombo.op_Implicit((DamageType)0);
				((GenericDamageOrb)ricochetOrb).damageType.damageSource = (DamageSource)1;
				((GenericDamageOrb)ricochetOrb).damageColorIndex = (DamageColorIndex)0;
				((Orb)ricochetOrb).target = val;
				OrbManager.instance.AddOrb((Orb)(object)ricochetOrb);
			}
		}
	}
	public class SnowtimeOrbs : Orb
	{
		public enum OrbTypes
		{
			ShortcakeTaunt,
			ShortcakeRetaliate,
			ShortcakeRetaliateFriendly
		}

		public float speed = 200f;

		public float damageValue;

		public GameObject attacker;

		public GameObject inflictor;

		public TeamIndex teamIndex;

		public bool isCrit;

		public ProcChainMask procChainMask;

		public float procCoefficient = 1f;

		public DamageColorIndex damageColorIndex;

		public float range = 20f;

		public DamageTypeCombo damageType = DamageTypeCombo.op_Implicit((DamageType)0);

		public OrbTypes snowtimeOrbType;

		private bool isElectric;

		private bool isHealing;

		public static GameObject orbShortcakeRetaliateObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Shortcake/Skills/shortcakeretaliate_orbeffect.prefab");

		public static GameObject orbShortcakeRetaliateImpactObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Shortcake/Skills/shortcakeretaliate_impacteffect.prefab");

		public static GameObject orbShortcakeRetaliateFriendlyObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Shortcake/Skills/shortcakeretaliatefriendly_orbeffect.prefab");

		public static GameObject orbShortcakeRetaliateFriendlyImpactObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Shortcake/Skills/shortcakeretaliatefriendly_impacteffect.prefab");

		public GameObject orbShortcakeRetaliatePrefab = orbShortcakeRetaliateObject;

		public GameObject orbShortcakeRetaliateFriendlyPrefab = orbShortcakeRetaliateFriendlyObject;

		public static GameObject orbShortcakeTauntObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Shortcake/Skills/shortcaketaunt_orbeffect.prefab");

		public static GameObject orbShortcakeTauntImpactObject = SnowtimeToyboxMod._stcharacterAssetBundle.LoadAsset<GameObject>("Assets/SnowtimeMod/Assets/Characters/FriendlyTurrets/FriendlyTurretTestIngame/Shortcake/Skills/shortcaketaunt_impacteffect.prefab");

		public GameObject orbShortcakeTauntPrefab = orbShortcakeTauntObject;

		public override void Begin()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			((Orb)this).duration = Mathf.Max(((Orb)this).distanceToTarget / speed, 0.1f);
			GameObject val = null;
			switch (snowtimeOrbType)
			{
			case OrbTypes.ShortcakeTaunt:
				val = orbShortcakeTauntPrefab;
				isHealing = false;
				isElectric = false;
				break;
			case OrbTypes.ShortcakeRetaliate:
				val = orbShortcakeRetaliatePrefab;
				isHealing = false;
				isElectric = false;
				break;
			case OrbTypes.ShortcakeRetaliateFriendly:
				val = orbShortcakeRetaliateFriendlyPrefab;
				isHealing = true;
				isElectric = false;
				break;
			}
			EffectData val2 = new EffectData
			{
				origin = base.origin,
				genericFloat = ((Orb)this).duration * 2f
			};
			val2.SetHurtBoxReference(base.target);
			EffectManager.SpawnEffect(val, val2, true);
		}

		public override void OnArrival()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0078: 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_0046: 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_00ca: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)base.target))
			{
				return;
			}
			HealthComponent healthComponent = base.target.healthComponent;
			if (Object.op_Implicit((Object)(object)healthComponent))
			{
				DamageInfo val = new DamageInfo();
				if (!isHealing)
				{
					val.damage = damageValue;
					val.procChainMask = procChainMask;
					val.procCoefficient = procCoefficient;
				}
				else
				{
					healthComponent.Heal(base.target.healthComponent.fullHealth * 0.025f + damageValue, procChainMask, true);
					val.procCoefficient = 0f;
				}
				val.attacker = attacker;
				val.inflictor = inflictor;
				val.force = Vector3.zero;
				val.crit = isCrit;
				val.position = ((Component)base.target).transform.position;
				val.damageColorIndex = damageColorIndex;
				val.damageType = damageType;
				if (isElectric)
				{
					val.damageType.damageTypeExtended = (DamageTypeExtended)8192;
				}
				val.inflictedHurtbox = base.target;
				healthComponent.TakeDamage(val);
				GlobalEventManager.instance.OnHitEnemy(val, ((Component)healthComponent).gameObject);
				GlobalEventManager.instance.OnHitAll(val, ((Component)healthComponent).gameObject);
			}
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInPlugin("SnowySnowtime.SnowtimeToyboxMod", "SnowtimeToyboxMod", "1.1.8")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class SnowtimeToyboxMod : BaseUnityPlugin
	{
		public const string Author = "SnowySnowtime";

		public const string Name = "SnowtimeToyboxMod";

		public const string Version = "1.1.8";

		public const string GUID = "SnowySnowtime.SnowtimeToyboxMod";

		public static SnowtimeToyboxMod instance;

		public static DifficultyDef SnowtimeLegendaryDiffDef;

		public static DifficultyIndex SnowtimeLegendaryDiffIndex;

		public static SkillDef SnowtimePlasmaRifleSkillDef;

		public static GameObject MuzzleFlashObject;

		public static GameObject TracerObject;

		public static GameObject HitObject;

		public static GameObject OrbObject;

		public static GameObject FriendlyTurretUseEffect;

		public static SkillFamily FriendlyTurretBorboUtilSkillFamily;

		public static SkillDef FriendlyTurretBorboUtilSkillDef;

		public static SkillFamily FriendlyTurretShortcakeUtilSkillFamily;

		public static SkillDef FriendlyTurretShortcakeUtilSkillDef;

		public static SkillFamily FriendlyTurretSnowtimeUtilSkillFamily;

		public static SkillDef FriendlyTurretSnowtimeUtilSkillDef;

		public static SkillFamily FriendlyTurretAcanthiUtilSkillFamily;

		public static SkillDef FriendlyTurretAcanthiUtilSkillDef;

		public static SkillFamily FriendlyTurretBreadUtilSkillFamily;

		public static SkillDef FriendlyTurretBreadUtilSkillDef;

		public static DroneDef FriendlyTurretBorboDef;

		public static InteractableSpawnCard FriendlyTurretBorboIsc;

		public static SkillFamily FriendlyTurretBorboSkillFamily;

		public static SkillDef FriendlyTurretBorboSkillDef;

		public static GameObject FriendlyTurretBorboBody;

		public static GameObject FriendlyTurretBorboMaster;

		public static GameObject FriendlyTurretBorboBroken;

		public static DroneDef FriendlyTurretShortcakeDef;

		public static InteractableSpawnCard FriendlyTurretShortcakeIsc;

		public static SkillFamily FriendlyTurretShortcakeSkillFamily;

		public static SkillDef FriendlyTurretShortcakeSkillDef;

		public static GameObject FriendlyTurretShortcakeBody;

		public static GameObject FriendlyTurretShortcakeMaster;

		public static GameObject FriendlyTurretShortcakeBroken;

		public static DroneDef FriendlyTurretSnowtimeDef;

		public static InteractableSpawnCard FriendlyTurretSnowtimeIsc;

		public static SkillFamily FriendlyTurretSnowtimeSkillFamily;

		public static SkillDef FriendlyTurretSnowtimeSkillDef;

		public static GameObject FriendlyTurretSnowtimeBody;

		public static GameObject FriendlyTurretSnowtimeMaster;

		public static GameObject FriendlyTurretSnowtimeBroken;

		public static DroneDef FriendlyTurretAcanthiDef;

		public static InteractableSpawnCard FriendlyTurretAcanthiIsc;

		public static SkillFamily FriendlyTurretAcanthiSkillFamily;

		public static SkillDef FriendlyTurretAcanthiSkillDef;

		public static GameObject FriendlyTurretAcanthiBody;

		public static GameObject FriendlyTurretAcanthiMaster;

		public static GameObject FriendlyTurretAcanthiBroken;

		public static DroneDef FriendlyTurretBreadDef;

		public static InteractableSpawnCard FriendlyTurretBreadIsc;

		public static SkillFamily FriendlyTurretBreadSkillFamily;

		public static SkillDef FriendlyTurretBreadSkillDef;

		public static GameObject FriendlyTurretBreadBody;

		public static GameObject FriendlyTurretBreadMaster;

		public static GameObject FriendlyTurretBreadBroken;

		public static GameObject FriendlyTurretBreadBeamL;

		public static GameObject FriendlyTurretBreadBeamR;

		public static GameObject FriendlyTurretBreadGraceWard;

		public static List<GameObject> friendlyTurretList = new List<GameObject>();

		public static List<ItemTag> customItemTags;

		public static string[] friendlyTurretListNames;

		public static bool Legendary = false;

		public static string assetDirectory;

		public static AssetBundle _stdifficultyAssetBundle;

		public static AssetBundle _stcharacterAssetBundle;

		internal const string _stdifficultyAssetBundleName = "snowtimetoybox_difficulty";

		internal const string _stcharacterAssetBundleName = "snowtimetoybox_characters";

		public static List<EquipmentIndex> eliteDefsEquipInherit = new List<EquipmentIndex>();

		public static ModdedDamageType HaloRicochetOnHit = DamageAPI.ReserveDamageType();

		public static ModdedDamageType BorboSuperDebuffOnHit = DamageAPI.ReserveDamageType();

		private string interactablesuffering = " (UnityEngine.GameObject)";

		private string charactersuffering = "(Clone) (UnityEngine.GameObject)";

		private string interactablesmaster;

		private string charactersmaster;

		private float initialprice;

		public static BuffDef BorboTurretDebuff;

		public static BuffDef ShortcakeTurretBuff;

		public static BuffDef AcanthiTurretBuff;

		public static BuffDef AcanthiTurretDebuff;

		public static BuffDef BreadTurretBuffPassive;

		public static BuffDef BreadTurretBuffFortune;

		public static BuffDef BreadTurretBuffNearbyAllies;

		public static bool riskierLoaded => ModLoaded("com.RiskOfBrainrot.RiskierRain");

		public static ConfigEntry<bool> ToggleSpawnMessages { get; set; }

		public static ConfigEntry<bool> FriendlyTurretImmuneVoidDeath { get; set; }

		public static ConfigEntry<bool> FriendlyTurretFallImmunity { get; set; }

		public static ConfigEntry<bool> FriendlyTurretDrone { get; set; }

		public static ConfigEntry<bool> FriendlyTurretShortcakeAggroType { get; set; }

		public static ConfigEntry<bool> FriendlyTurretReducedCostForPartnersOrSelf { get; set; }

		public static bool ModLoaded(string modGuid)
		{
			if (!string.IsNullOrEmpty(modGuid))
			{
				return Chainloader.PluginInfos.ContainsKey(modGuid);
			}
			return false;
		}

		public void Awake()
		{
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			ToggleSpawnMessages = ((BaseUnityPlugin)this).Config.Bind<bool>("Friendly Turret Functions", "Spawn Message", true, "If true, the Friendly Turrets will give a message on every stage they spawn on, for insight on if and which turret spawned. Otherwise, friendly turrets are shy, and are also sad!");
			FriendlyTurretShortcakeAggroType = ((BaseUnityPlugin)this).Config.Bind<bool>("Friendly Turret Functions", "Strawberry Shortcake Aggro Method", false, "If true, the Strawberry Shortcake Turret will spawn with a native increase to its aggro. Else, it only gains aggro for ~0.5s when its main skill fires.");
			FriendlyTurretReducedCostForPartnersOrSelf = ((BaseUnityPlugin)this).Config.Bind<bool>("Friendly Turret Functions", "Reduced Cost...", false, "[This does not reduce cost for EVERYONE] If true, Friendly Turrets have their costs reduced by half for: Individuals referenced by the turret / Significant Other of referenced individual by the turret. It felt necessary to have as an option to prevent favoritism or issues with using steamids to determine costs of the interactable. This was added by majority request.");
			FriendlyTurretImmuneVoidDeath = ((BaseUnityPlugin)this).Config.Bind<bool>("Friendly Turret Flags", "Void Death Immunity", true, "If true, Friendly Turrets are immune to Void Death (Void Reaver implosions), this is because they are awful at avoiding them even with mods to make allies avoid them, and we get sad when they are detained.");
			FriendlyTurretFallImmunity = ((BaseUnityPlugin)this).Config.Bind<bool>("Friendly Turret Flags", "Fall Damage Immunity", true, "If true, Friendly Turrets are immune to fall damage, as navigating some maps can be a little difficult for them. Prevents any unexpected turret deaths, as we cant simply 'replace' them like Engineer can.");
			FriendlyTurretDrone = ((BaseUnityPlugin)this).Config.Bind<bool>("Friendly Turret Flags", "Drone", false, "If true, Friendly Turrets are flagged as drones. Probably comes with some oddities.");
			Language.collectLanguageRootFolders += CollectLanguageRootFolders;
			Run.onRunStartGlobal += delegate(Run run)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				Legendary = false;
				if (run.selectedDifficulty == SnowtimeLegendaryDiffIndex)
				{
					Legendary = true;
					CharacterMaster.onStartGlobal += CharacterMaster_OnStartGlobal;
				}
			};
			Run.onRunDestroyGlobal += delegate
			{
				Legendary = false;
				CharacterMaster.onStartGlobal -= CharacterMaster_OnStartGlobal;
			};
			GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(JustLetMeDamageMyFoesPleaseThankYou);
			SceneDirector.Start += new hook_Start(SceneDirectorOnStart);
			CharacterBody.FixedUpdate += new hook_FixedUpdate(ShortcakeTurretHandler);
			instance = this;
			string path = (assetDirectory = Path.Combine(Path.GetDirectoryName(typeof(SnowtimeToyboxMod).Assembly.Location), "assetbundles"));
			Debug.Log((object)"Ran Start!");
			_stcharacterAssetBundle = AssetBundle.LoadFromFile(Path.Combine(path, "snowtimetoybox_characters"));
			((MonoBehaviour)this).StartCoroutine(ShaderSwapper.UpgradeStubbedShadersAsync(_stcharacterAssetBundle));
			_stdifficultyAssetBundle = AssetBundle.LoadFromFile(Path.Combine(path, "snowtimetoybox_difficulty"));
			Debug.Log((object)_stcharacterAssetBundle);
			Debug.Log((object)_stdifficultyAssetBundle);
			AddDifficulty();
			AddCustomSkills();
			AddCustomAllies();
			AddCustomBuffs();
			ItemTag val = ItemAPI.AddItemTag("FriendTurret_Borbo_Whitelist");
			Log.Debug("FriendTurret_Borbo_Whitelist: " + ((object)(ItemTag)(ref val)).ToString());
			ItemTag val2 = ItemAPI.AddItemTag("FriendTurret_Shortcake_Whitelist");
			Log.Debug("FriendTurret_Shortcake_Whitelist: " + ((object)(ItemTag)(ref val2)).ToString());
			ItemTag val3 = ItemAPI.AddItemTag("FriendTurret_Snowtime_Whitelist");
			Log.Debug("FriendTurret_Snowtime_Whitelist: " + ((object)(ItemTag)(ref val3)).ToString());
			ItemTag val4 = ItemAPI.AddItemTag("FriendTurret_Acanthi_Whitelist");
			Log.Debug("FriendTurret_Acanthi_Whitelist: " + ((object)(ItemTag)(ref val4)).ToString());
			ItemTag val5 = ItemAPI.AddItemTag("FriendTurret_Bread_Whitelist");
			Log.Debug("FriendTurret_Acanthi_Whitelist: " + ((object)(ItemTag)(ref val5)).ToString());
			ItemTag val6 = ItemAPI.AddItemTag("GlobalFriendTurret_Whitelist");
			Log.Debug("GlobalFriendTurret_Whitelist: " + ((object)(ItemTag)(ref val6)).ToString());
			((ResourceAvailability)(ref ItemCatalog.availability)).CallWhenAvailable((Action)AddCustomTagsToItems);
			((ResourceAvailability)(ref EquipmentCatalog.availability)).CallWhenAvailable((Action)AddElitesToList);
		}

		public void AddCustomTagsToItems()
		{
			Log.Debug("SnowtimeToybox is adding custom tags to items for Friendly Turrets/Drones...");
			ItemDef[] array = (ItemDef[])(object)new ItemDef[7]
			{
				Items.Pearl,
				Items.ShinyPearl,
				Items.FallBoots,
				Items.BonusGoldPackOnKill,
				Items.FlatHealth,
				Items.Knurl,
				Items.CookedSteak
			};
			ItemDef[] array2 = (ItemDef[])(object)new ItemDef[5]
			{
				Items.Syringe,
				Items.BossDamageBonus,
				Items.PermanentDebuffOnHit,
				Items.MeteorAttackOnHighDamage,
				Items.AttackSpeedPerNearbyAllyOrEnemy
			};
			ItemDef[] array3 = (ItemDef[])(object)new ItemDef[17]
			{
				Items.Thorns,
				Items.BarrierOnKill,
				Items.HealWhileSafe,
				Items.ArmorPlate,
				Items.PersonalShield,
				Items.Infusion,
				Items.ChainLightning,
				Items.BarrierOnOverHeal,
				Items.Plant,
				Items.BounceNearby,
				Items.ShockNearby,
				Items.OutOfCombatArmor,
				Items.HalfSpeedDoubleHealth,
				Items.MissileVoid,
				Items.ChainLightningVoid,
				Items.ShieldBooster,
				Items.ShockDamageAura
			};
			ItemDef[] array4 = (ItemDef[])(object)new ItemDef[7]
			{
				Items.Syringe,
				Items.IceRing,
				Items.PersonalShield,
				Items.SlowOnHit,
				Items.ElementalRingVoid,
				Items.SlowOnHitVoid,
				Items.ShieldBooster
			};
			ItemDef[] array5 = (ItemDef[])(object)new ItemDef[13]
			{
				Items.Tooth,
				Items.BleedOnHit,
				Items.Syringe,
				Items.Clover,
				Items.LunarBadLuck,
				Items.DeathMark,
				Items.Seed,
				Items.Infusion,
				Items.IncreaseHealing,
				Items.NovaOnHeal,
				Items.BleedOnHitVoid,
				Items.TriggerEnemyDebuffs,
				Items.UltimateMeal
			};
			ItemDef[] array6 = (ItemDef[])(object)new ItemDef[8]
			{
				Items.WardOnLevel,
				Items.Medkit,
				Items.BarrierOnKill,
				Items.BarrierOnOverHeal,
				Items.SprintArmor,
				Items.ArmorReductionOnHit,
				Items.IncreaseHealing,
				Items.BoostAllStats
			};
			ItemDef[] array7 = array;
			foreach (ItemDef val in array7)
			{
				Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
			}
			array7 = array2;
			foreach (ItemDef val2 in array7)
			{
				Log.Debug("Added " + ((Object)val2).name + " to borbo turret's item whitelist");
				ItemAPI.ApplyTagToItem("FriendTurret_Borbo_Whitelist", val2);
			}
			array7 = array3;
			foreach (ItemDef val3 in array7)
			{
				Log.Debug("Added " + ((Object)val3).name + " to Strawberry Shortcake Turret's item whitelist");
				ItemAPI.ApplyTagToItem("FriendTurret_Shortcake_Whitelist", val3);
			}
			array7 = array4;
			foreach (ItemDef val4 in array7)
			{
				Log.Debug("Added " + ((Object)val4).name + " to Snowtime Turret's item whitelist");
				ItemAPI.ApplyTagToItem("FriendTurret_Snowtime_Whitelist", val4);
			}
			array7 = array5;
			foreach (ItemDef val5 in array7)
			{
				Log.Debug("Added " + ((Object)val5).name + " to acanthi turret's item whitelist");
				ItemAPI.ApplyTagToItem("FriendTurret_Acanthi_Whitelist", val5);
			}
			array7 = array6;
			foreach (ItemDef val6 in array7)
			{
				Log.Debug("Added " + ((Object)val6).name + " to bread turret's item whitelist");
				ItemAPI.ApplyTagToItem("FriendTurret_Bread_Whitelist", val6);
			}
			AddCustomTagsToModdedItems();
		}

		public void AddCustomTagsToModdedItems()
		{
			Log.Debug("SnowtimeToybox is adding custom tags to Modded items for Friendly Turrets/Drones...");
			ItemDef[] itemDefs = ItemCatalog.itemDefs;
			foreach (ItemDef val in itemDefs)
			{
				if (val.nameToken.Contains("ITEM_LUNARSOAP_NAME"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Acanthi_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Acanthi Turret's item whitelist");
				}
				if (val.nameToken.Contains("SEEKINTHEVOID_STRAWPAIRY_NAME"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Shortcake_Whitelist", val);
					ItemAPI.ApplyTagToItem("FriendTurret_Acanthi_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Strawberry Shortcake Turret's item whitelist");
					Log.Debug("Added " + ((Object)val).name + " to Acanthi Turret's item whitelist");
				}
				if (val.nameToken.Contains("NT_ITEM_HYDRATOOTH_NAME"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Acanthi_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Acanthi Turret's item whitelist");
				}
				if (val.nameToken.Contains("NT_ITEM_SHIMMERINGNAUTILUS_NAME"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Shortcake_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Strawberry Shortcake Turret's item whitelist");
				}
				if (val.nameToken.Contains("FirstAidSpray"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Shortcake_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Strawberry Shortcake Turret's item whitelist");
				}
				if (val.nameToken.Contains("PerfectApple"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Shortcake_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Strawberry Shortcake Turret's item whitelist");
				}
				if (val.nameToken.Contains("ITEM_BORBOFUSE"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Shortcake_Whitelist", val);
					ItemAPI.ApplyTagToItem("FriendTurret_Snowtime_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Strawberry Shortcake Turret's item whitelist");
					Log.Debug("Added " + ((Object)val).name + " to Snowtime Turret's item whitelist");
				}
				if (val.nameToken.Contains("ITEM_CHOCYCOIN"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Acanthi_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Acanthi Turret's item whitelist");
				}
				if (val.nameToken.Contains("ITEM_REWORKRACK"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Acanthi_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Acanthi Turret's item whitelist");
				}
				if (val.nameToken.Contains("ITEM_ICHORVIOLET"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Shortcake_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Strawberry Shortcake Turret's item whitelist");
				}
				if (val.nameToken.Contains("ITEM_DESIGNANOMALY"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Shortcake_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Strawberry Shortcake Turret's item whitelist");
				}
				if (val.nameToken.Contains("ITEM_VOIDLASERTURBINE"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Borbo_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to borbo turret's item whitelist");
				}
				if (val.nameToken.Contains("ITEM_GOODEXECUTIONITEM"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Snowtime_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Snowtime Turret's item whitelist");
				}
				if (val.nameToken.Contains("ITEM_SANDSWEPT_AMBER_KNIFE"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Acanthi_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Acanthi Turret's item whitelist");
				}
				if (val.nameToken.Contains("ITEM_SANDSWEPT_BLEEDING_WITNESS"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Acanthi_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Acanthi Turret's item whitelist");
				}
				if (val.nameToken.Contains("ITEM_SANDSWEPT_PRESERVED_ATOLL"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Shortcake_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Strawberry Shortcake Turret's item whitelist");
				}
				if (val.nameToken.Contains("ITEM_SANDSWEPT_SMOULDERING_DOCUMENT"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Acanthi_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Acanthi Turret's item whitelist");
				}
				if (val.nameToken.Contains("Bork"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Borbo_Whitelist", val);
					ItemAPI.ApplyTagToItem("FriendTurret_Snowtime_Whitelist", val);
					ItemAPI.ApplyTagToItem("FriendTurret_Acanthi_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to borbo turret's item whitelist");
					Log.Debug("Added " + ((Object)val).name + " to Snowtime Turret's item whitelist");
					Log.Debug("Added " + ((Object)val).name + " to Acanthi Turret's item whitelist");
				}
				if (val.nameToken.Contains("GuinsoosRageblade"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Acanthi_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Acanthi Turret's item whitelist");
				}
				if (val.nameToken.Contains("ImperialMandate"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Acanthi_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Acanthi Turret's item whitelist");
				}
				if (val.nameToken.Contains("KrakenSlayer"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Acanthi_Whitelist", val);
					ItemAPI.ApplyTagToItem("FriendTurret_Snowtime_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Acanthi Turret's item whitelist");
					Log.Debug("Added " + ((Object)val).name + " to Snowtime Turret's item whitelist");
				}
				if (val.nameToken.Contains("VV_ITEM_CRYOCANISTER_ITEM"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Snowtime_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Snowtime Turret's item whitelist");
				}
				if (val.nameToken.Contains("SS2_ITEM_ARMEDBACKPACK_NAME"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Shortcake_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Strawberry Shortcake Turret's item whitelist");
				}
				if (val.nameToken.Contains("SS2_ITEM_STRANGECAN_NAME"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Acanthi_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Acanthi Turret's item whitelist");
				}
				if (val.nameToken.Contains("SS2_ITEM_ICETOOL_NAME"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Snowtime_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to Snowtime Turret's item whitelist");
				}
				if (val.nameToken.Contains("ITEM_WoodenToolKit_Name"))
				{
					ItemAPI.ApplyTagToItem("FriendTurret_Bread_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to bread turret's item whitelist");
				}
				if (val.nameToken.Contains("SEEKINTHEVOID_COASTALCORAL_NAME"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (val.nameToken.Contains("NT_ITEM_VISCOUSPOT_NAME"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (val.nameToken.Contains("NT_ITEM_MOTHEROFPEARL_NAME"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (val.nameToken.Contains("NT_ITEM_MOBIUSNODE_NAME"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (val.nameToken.Contains("NT_ITEM_OSMIUMSHACKLES_NAME"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (val.nameToken.Contains("GreenHerb"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (val.nameToken.Contains("RedHerb"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (val.nameToken.Contains("MixedHerb"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (val.nameToken.Contains("GoldenApple"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (val.nameToken.Contains("HeavyBoot"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (val.nameToken.Contains("ITEM_EGG"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("let the swansong egg hunt begin...");
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (val.nameToken.Contains("ITEM_CUCKLER"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (val.nameToken.Contains("ITEM_DANGERCRIT"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (val.nameToken.Contains("ITEM_GAMMAKNIFE"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
					Log.Debug("...I dont think butter is supposed to be green...");
				}
				if (val.nameToken.Contains("ITEM_FROZENSHELL"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (val.nameToken.Contains("ITEM_MASSANOMALY"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (val.nameToken.Contains("ITEM_BLOODANOMALY"))
				{
					ItemAPI.ApplyTagToItem("GlobalFriendTurret_Whitelist", val);
					Log.Debug("Added " + ((Object)val).name + " to global friendly turret item whitelist");
				}
				if (