Decompiled source of Random Units v1.0.0

RandomUnits.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using CustomShites;
using DM;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.AI.Components.Modifiers;
using Landfall.TABS.GameState;
using Landfall.TABS.UnitEditor;
using SLMA;
using TFBGames;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RandomUnits")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("RandomUnits")]
[assembly: AssemblyProduct("RandomUnits")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7acfaef0-7669-4401-8bff-5a9a02e18c75")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace RandomUnits
{
	public static class UManager
	{
		public class Utility : MonoBehaviour
		{
			public static class PrimitiveHelper
			{
				private static Dictionary<PrimitiveType, Mesh> primitiveMeshes;

				public static GameObject CreatePrimitive(PrimitiveType type, bool withCollider)
				{
					//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_0022: 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_0035: Expected O, but got Unknown
					//IL_0003: Unknown result type (might be due to invalid IL or missing references)
					if (withCollider)
					{
						return GameObject.CreatePrimitive(type);
					}
					GameObject val = new GameObject(((object)(PrimitiveType)(ref type)).ToString());
					val.AddComponent<MeshFilter>().sharedMesh = GetPrimitiveMesh(type);
					val.AddComponent<MeshRenderer>();
					return val;
				}

				public static Mesh GetPrimitiveMesh(PrimitiveType type)
				{
					//IL_0005: 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_000d: Unknown result type (might be due to invalid IL or missing references)
					if (!primitiveMeshes.ContainsKey(type))
					{
						CreatePrimitiveMesh(type);
					}
					return primitiveMeshes[type];
				}

				private static Mesh CreatePrimitiveMesh(PrimitiveType type)
				{
					//IL_0000: 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)
					GameObject obj = GameObject.CreatePrimitive(type);
					Mesh sharedMesh = obj.GetComponent<MeshFilter>().sharedMesh;
					Object.Destroy((Object)(object)obj);
					primitiveMeshes[type] = sharedMesh;
					return sharedMesh;
				}

				static PrimitiveHelper()
				{
					primitiveMeshes = new Dictionary<PrimitiveType, Mesh>();
				}
			}

			public static class ItemCategorizer
			{
				public static GameObject SetTag(GameObject item, string categoryName = "FACTION_MEDIEVAL", TagType tagType = 0)
				{
					//IL_0018: 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_002e: Unknown result type (might be due to invalid IL or missing references)
					try
					{
						CharacterItem componentInChildren = item.GetComponentInChildren<CharacterItem>();
						if (Object.op_Implicit((Object)(object)componentInChildren))
						{
							componentInChildren.tags = new List<Tag>
							{
								new Tag
								{
									tagType = tagType,
									value = categoryName
								}
							};
						}
						return item;
					}
					catch (Exception ex)
					{
						Debug.Log((object)ex);
						return item;
					}
				}
			}

			public static GameObject LoadBundleGameObject(string name)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (GameObject)bundle.LoadAsset(name);
			}

			public static Material LoadBundleMaterial(string name)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				try
				{
					return (Material)bundle.LoadAsset(name);
				}
				catch (Exception ex)
				{
					Debug.Log((object)("Bundle Reference Name:" + name));
					Debug.Log((object)ex);
					return null;
				}
			}

			public static Sprite LoadBundleTextureToSprite(string name)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				//IL_0031: 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)
				Texture2D val = (Texture2D)bundle.LoadAsset(name);
				((Texture)val).filterMode = (FilterMode)0;
				return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			}

			public static Sprite LoadBundleSprite(string name)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (Sprite)bundle.LoadAsset(name);
			}

			public static void AddLocalization()
			{
				(string, string, string, string, string)[] array = new(string, string, string, string, string)[1] { ("NYAN-CHAN-UNIT", "Nyan-chan", "にゃちゃん", "喵酱", "Нян-тян") };
				Dictionary<Language, Dictionary<string, string>> dictionary = (Dictionary<Language, Dictionary<string, string>>)typeof(Localizer).GetField("m_localization", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
				try
				{
					for (int i = 0; i < array.Length; i++)
					{
						dictionary[(Language)7].Add(array[i].Item1, array[i].Item4);
						dictionary[(Language)3].Add(array[i].Item1, array[i].Item2);
						dictionary[(Language)0].Add(array[i].Item1, array[i].Item2);
						dictionary[(Language)4].Add(array[i].Item1, array[i].Item2);
						dictionary[(Language)1].Add(array[i].Item1, array[i].Item2);
						dictionary[(Language)2].Add(array[i].Item1, array[i].Item2);
						dictionary[(Language)8].Add(array[i].Item1, array[i].Item3);
						dictionary[(Language)5].Add(array[i].Item1, array[i].Item2);
						dictionary[(Language)6].Add(array[i].Item1, array[i].Item5);
					}
				}
				catch
				{
				}
			}

			public static void AddToUnitLib(GameObject UnitBaseObject)
			{
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: 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)
				Unit component = UnitBaseObject.GetComponent<Unit>();
				if ((Object)(object)component == (Object)null || component.Entity == null)
				{
					Debug.LogError((object)"UnitBaseObject does not contain a valid Unit or Entity component.");
					return;
				}
				DatabaseID gUID = component.Entity.GUID;
				Debug.Log((object)$"Attempting to add Unit with GUID: {gUID}");
				unitBases.Add(UnitBaseObject.GetComponentInChildren<Unit>());
				unitBasesObject.Add(UnitBaseObject);
			}
		}

		private static string comment;

		public static AssetBundle bundle;

		public static List<Unit> unitBases;

		public static List<GameObject> unitBasesObject;

		public static void SetBlueprint(UnitBlueprint unit, LandfallContentDatabase db)
		{
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Expected O, but got Unknown
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Expected O, but got Unknown
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0576: Unknown result type (might be due to invalid IL or missing references)
			//IL_057c: Expected O, but got Unknown
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_059d: Expected O, but got Unknown
			//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05be: Expected O, but got Unknown
			//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cf: Expected O, but got Unknown
			//IL_07ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f0: Expected O, but got Unknown
			//IL_080b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0811: Expected O, but got Unknown
			//IL_0831: Unknown result type (might be due to invalid IL or missing references)
			//IL_0837: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a27: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2d: Expected O, but got Unknown
			//IL_0a48: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4e: Expected O, but got Unknown
			//IL_0a5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a62: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c1c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c22: Expected O, but got Unknown
			//IL_0c3d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c43: Expected O, but got Unknown
			//IL_0c51: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c57: Unknown result type (might be due to invalid IL or missing references)
			if (unit.Entity.Name == "Arsenico")
			{
				SLMATool.UnitCost(unit, 10000);
				unit.UnitBase = UPool.MyPool.GetObject("Arsenico_Base");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Ancient Attack Vocals/Archer_Snake");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Ancient Death Vocals/Archer_Snake");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Big");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.6f);
				unit.health = 2500f;
				unit.minSizeRandom = 1f;
				unit.maxSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.massMultiplier = 10f;
				unit.balanceMultiplier = 1f;
				unit.animationMultiplier = 1f;
				unit.balanceForceMultiplier = 1f;
				unit.movementSpeedMuiltiplier = 1.5f;
				unit.holdinigWithTwoHands = true;
				unit.RightWeapon = UPool.MyPool.GetObject("Hiveflail");
				unit.m_props = (GameObject[])(object)new GameObject[5]
				{
					UPool.MyPool.GetObject("ArsenicHatchlingThing"),
					UPool.MyPool.GetObject("LeatherWeatheredClothing"),
					UPool.MyPool.GetObject("LeatherWeatheredHood"),
					UPool.MyPool.GetObject("ClothWrapArmor"),
					UPool.MyPool.GetObject("ArsenicoSkinCovers")
				};
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[4]
				{
					(GameObject)SLMALoader.SDic["moves"]["Small_Hover"],
					UPool.MyPool.GetObject("Move_CondensedSpewspit"),
					UPool.MyPool.GetObject("Move_DispersingDodge"),
					UPool.MyPool.GetObject("Move_RadioactiveToxicity")
				};
				unit.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(KeepPreferredDistance) };
			}
			if (unit.Entity.Name == "NYAN-CHAN-UNIT")
			{
				SLMATool.UnitCost(unit, 10000);
				unit.UnitBase = UPool.MyPool.GetObject("NyanChan_UnitBase");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Fantasy Dark Attack Vocals/EvilTank");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Fantasy Dark Death Vocals/EvilTank");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Small");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.6f);
				unit.health = 4000f;
				unit.minSizeRandom = 1f;
				unit.maxSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.massMultiplier = 0.8f;
				unit.balanceMultiplier = 1f;
				unit.animationMultiplier = 1f;
				unit.balanceForceMultiplier = 1f;
				unit.movementSpeedMuiltiplier = 1f;
				unit.LeftWeapon = UPool.MyPool.GetObject("CwiticalCattack");
				unit.RightWeapon = UPool.MyPool.GetObject("CwiticalCattack");
				unit.m_props = (GameObject[])(object)new GameObject[4]
				{
					UPool.MyPool.GetObject("NyanChanHair"),
					UPool.MyPool.GetObject("NyanHeadCatMonitor"),
					UPool.MyPool.GetObject("NyanChanSuitArmor"),
					UPool.MyPool.GetObject("NyanChanCatTail")
				};
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[5]
				{
					UPool.MyPool.GetObject("Move_PurrfectPawwages"),
					UPool.MyPool.GetObject("Move_Meowrsenal"),
					UPool.MyPool.GetObject("Move_Zoomies"),
					UPool.MyPool.GetObject("Move_Woomies"),
					(GameObject)SLMALoader.SDic["moves"]["Small_Hover"]
				};
				unit.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(NeverStopRunning) };
			}
			comment = "Eliyah";
			if (unit.Entity.Name == "Gore Guild")
			{
				SLMATool.UnitCost(unit, 10000);
				unit.UnitBase = UPool.MyPool.GetObject("Eliyah_UnitBase");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Fantasy Dark Attack Vocals/DarkKingTransformed");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Fantasy Dark Death Vocals/DarkKingTransformed");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Minotaur");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.6f);
				unit.health = 4000f;
				unit.minSizeRandom = 1f;
				unit.maxSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.massMultiplier = 10f;
				unit.balanceMultiplier = 1f;
				unit.animationMultiplier = 1f;
				unit.balanceForceMultiplier = 1f;
				unit.movementSpeedMuiltiplier = 1f;
				unit.holdinigWithTwoHands = true;
				unit.RightWeapon = UPool.MyPool.GetObject("LumberjackChainsaw");
				unit.m_props = (GameObject[])(object)new GameObject[5]
				{
					UPool.MyPool.GetObject("LumberjackUniform"),
					UPool.MyPool.GetObject("LumberjackHair"),
					UPool.MyPool.GetObject("LumberjackBeard"),
					UPool.MyPool.GetObject("LumberjackBoots"),
					UPool.MyPool.GetObject("LumberjackPant")
				};
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[5]
				{
					(GameObject)SLMALoader.SDic["moves"]["Small_Hover"],
					(GameObject)SLMALoader.SDic["moves"]["SpinSlashKhopesh"],
					(GameObject)SLMALoader.SDic["moves"]["Fencer_Dodge"],
					UPool.MyPool.GetObject("Move_Breakthrough"),
					UPool.MyPool.GetObject("Move_SpawnBunyunCompanion")
				};
				unit.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(NeverStopRunning) };
			}
			if (unit.Entity.Name == "Bunyun16")
			{
				unit.UnitBase = UPool.MyPool.GetObject("Bunyun16_UnitBase");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Fantasy Dark Attack Vocals/EvilTank");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Fantasy Dark Death Vocals/EvilTank");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Small");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.6f);
				unit.health = 4000f;
				unit.minSizeRandom = 1f;
				unit.maxSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.massMultiplier = 0.8f;
				unit.balanceMultiplier = 1f;
				unit.animationMultiplier = 1f;
				unit.balanceForceMultiplier = 1f;
				unit.movementSpeedMuiltiplier = 1f;
				unit.LeftWeapon = UPool.MyPool.GetObject("PaleriteBlade");
				unit.RightWeapon = UPool.MyPool.GetObject("PaleriteBlade");
				unit.m_props = (GameObject[])(object)new GameObject[8]
				{
					UPool.MyPool.GetObject("BunyunHair"),
					UPool.MyPool.GetObject("VilepaleAgentBoots"),
					UPool.MyPool.GetObject("VilepaleAgentGlove"),
					UPool.MyPool.GetObject("VilepaleAgentHeadband"),
					UPool.MyPool.GetObject("VilepaleAgentPant"),
					UPool.MyPool.GetObject("VilepaleAgentShortSkirt"),
					UPool.MyPool.GetObject("VilepaleAgentShoulderpads"),
					UPool.MyPool.GetObject("VilepaleAgentUniform")
				};
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[4]
				{
					(GameObject)SLMALoader.SDic["moves"]["Small_Hover"],
					(GameObject)SLMALoader.SDic["moves"]["Boxer_Dodge"],
					(GameObject)SLMALoader.SDic["moves"]["SwordArtParry_Piratequeen"],
					UPool.MyPool.GetObject("Move_Infiltrate")
				};
				unit.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(NeverStopRunning) };
			}
			if (unit.Entity.Name == "Johnny Dawnedson")
			{
				SLMATool.UnitCost(unit, 10000);
				unit.UnitBase = UPool.MyPool.GetObject("JohnnyDawnedsonUnitBase");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Halloween Attack Vocals/Reaper");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Halloween Death Vocals/Reaper");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Mammoth");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.5f);
				unit.health = 15000f;
				unit.minSizeRandom = 1f;
				unit.maxSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.massMultiplier = 1000f;
				unit.balanceMultiplier = 1f;
				unit.animationMultiplier = 1f;
				unit.balanceForceMultiplier = 1f;
				unit.movementSpeedMuiltiplier = 0.5f;
				unit.LeftWeapon = UPool.MyPool.GetObject("BindingJaggedCombatKnife");
				unit.RightWeapon = UPool.MyPool.GetObject("BindingJaggedCombatKnife");
				unit.m_props = (GameObject[])(object)new GameObject[7]
				{
					UPool.MyPool.GetObject("CustomizableShadingProp"),
					UPool.MyPool.GetObject("DarkShadowCovers"),
					UPool.MyPool.GetObject("WickedSmile"),
					UPool.MyPool.GetObject("BigPastorGown"),
					UPool.MyPool.GetObject("JohnnyDawnedsonHair"),
					UPool.MyPool.GetObject("MuscularBodyBoots"),
					UPool.MyPool.GetObject("MuscularBodyPartsTights")
				};
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[4]
				{
					UPool.MyPool.GetObject("Move_TemperedDawn"),
					UPool.MyPool.GetObject("Move_Restriction"),
					(GameObject)SLMALoader.SDic["moves"]["Small_Hover"],
					(GameObject)SLMALoader.SDic["moves"]["SwordArtParry_Piratequeen"]
				};
				unit.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(NeverStopRunning) };
			}
			if (unit.Entity.Name == "Omni-Man")
			{
				SLMATool.UnitCost(unit, 10000);
				unit.UnitBase = UPool.MyPool.GetObject("SlightMuscularUnitBase");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Medieval Attack Vocals/TheKing");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Medieval Death Vocals/TheKing");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Big");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.6f);
				unit.health = 8000f;
				unit.minSizeRandom = 1f;
				unit.maxSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.massMultiplier = 10f;
				unit.balanceMultiplier = 1f;
				unit.animationMultiplier = 1f;
				unit.balanceForceMultiplier = 1f;
				unit.movementSpeedMuiltiplier = 5f;
				unit.LeftWeapon = UPool.MyPool.GetObject("SupersonicFist");
				unit.RightWeapon = UPool.MyPool.GetObject("SupersonicFist");
				unit.m_props = (GameObject[])(object)new GameObject[3]
				{
					UPool.MyPool.GetObject("OmniSuit"),
					UPool.MyPool.GetObject("OmniTight"),
					UPool.MyPool.GetObject("NolanHairAndMoustache")
				};
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[5]
				{
					UPool.MyPool.GetObject("Move_AirborneUppercut"),
					UPool.MyPool.GetObject("Move_KnockoutPunch"),
					UPool.MyPool.GetObject("Move_DynamicFlight"),
					(GameObject)SLMALoader.SDic["moves"]["Hover"],
					(GameObject)SLMALoader.SDic["moves"]["Hover"]
				};
				unit.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(NeverStopRunning) };
			}
		}

		public static void SetClothes(GameObject cloth, CharacterItem item, PropItemData data, LandfallContentDatabase db)
		{
			if ((Object)(object)cloth == (Object)(object)UPool.MyPool.GetObject("CustomizableShadingProp"))
			{
				cloth.AddComponent<ShadedClothing>();
			}
			if ((Object)(object)cloth == (Object)(object)UPool.MyPool.GetObject("WickedSmile"))
			{
				cloth.AddComponent<RemoveClothingIfDead>();
			}
		}

		public static void SetMoves(GameObject move, LandfallContentDatabase db)
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_PurrfectPawwages"))
			{
				move.AddComponent<AimedDrone>();
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_Zoomies"))
			{
				move.AddComponent<ZoomiesMovement>().particles = Utility.LoadBundleGameObject("ZoomiesParticle");
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_Woomies"))
			{
				move.AddComponent<WoomiesMovement>().particle = Utility.LoadBundleGameObject("WoomiesParticle");
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_BeegServalStretch"))
			{
				move.AddComponent<BEEGServalStretchPassive>();
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_Infiltrate"))
			{
				move.AddComponent<InfiltrateMovement>();
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_SpawnBunyunCompanion"))
			{
				move.AddComponent<UnitInstaSpawner>().unitBlueprint = (UnitBlueprint)SLMATool.SLMADic["Bunyun16"];
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_CondensedSpewspit"))
			{
				move.GetComponentInChildren<SpawnObject>().objectToSpawn = UPool.MyPool.GetObject("P_CondensedSpewspit");
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_RadioactiveToxicity"))
			{
				move.GetComponentInChildren<ExplosionAddEffect>().EffectPrefab = (UnitEffectBase)(object)UPool.MyPool.GetObject("Eff_GreenStrychnine").GetComponentInChildren<DamageOverTimeEffect>();
				move.GetComponentInChildren<AddObjectEffect>().EffectPrefab = (UnitEffectBase)(object)UPool.MyPool.GetObject("Eff_GreenStrychnine").GetComponentInChildren<DamageOverTimeEffect>();
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_AirborneUppercut"))
			{
				move.AddComponent<AirborneUppercutMovement>().explosion = UPool.MyPool.GetObject("E_AirborneUppercutGrounded");
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_KnockoutPunch"))
			{
				move.AddComponent<KnockoutPunchMovement>().explosion = UPool.MyPool.GetObject("E_AirborneUppercutGrounded");
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_DynamicFlight"))
			{
				DynamicFlightMovement dynamicFlightMovement = move.AddComponent<DynamicFlightMovement>();
				dynamicFlightMovement.trailObject = Utility.LoadBundleGameObject("OmnimanTrail");
				dynamicFlightMovement.redMaterial = Utility.LoadBundleMaterial("OmniRedTrail");
				dynamicFlightMovement.blueMaterial = Utility.LoadBundleMaterial("OmniBlueTrail");
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_Restriction"))
			{
				move.AddComponent<RestrictionMovementPassive>();
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_TemperedDawn"))
			{
				move.AddComponent<TemperedDawnPassive>();
			}
		}

		public static void SetUnits(Unit unit, LandfallContentDatabase db)
		{
			//IL_002d: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_0117: 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_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)((Component)unit).gameObject).name == ((Object)UPool.MyPool.GetObject("NyanChan_UnitBase")).name)
			{
				Transform transform = ((Component)unit).transform;
				transform.localScale *= 1.1f;
				((Component)unit).GetComponentInChildren<MovementHandler>().stopForTurns = false;
				((Component)unit).GetComponentInChildren<RigidbodyHolder>().randomizeRigidbodySizes = false;
				SkinnedMeshRenderer[] componentsInChildren = ((Component)unit).GetComponentsInChildren<SkinnedMeshRenderer>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					((Component)componentsInChildren[i]).gameObject.tag = "UnitMesh";
				}
			}
			if (((Object)((Component)unit).gameObject).name == ((Object)UPool.MyPool.GetObject("Eliyah_UnitBase")).name)
			{
				Transform transform2 = ((Component)unit).transform;
				transform2.localScale *= 1.2f;
				((Component)unit).GetComponentInChildren<RigidbodyHolder>().randomizeRigidbodySizes = false;
				TeamColor[] componentsInChildren2 = ((Component)unit).GetComponentsInChildren<TeamColor>();
				foreach (TeamColor obj in componentsInChildren2)
				{
					obj.redMaterial = new Material(obj.redMaterial);
					obj.blueMaterial = new Material(obj.blueMaterial);
					obj.redMaterial.color = new Color(0.65f, 0.4f, 0.4f);
					obj.blueMaterial.color = new Color(0.4f, 0.4f, 0.65f);
				}
				SkinnedMeshRenderer[] componentsInChildren3 = ((Component)unit).GetComponentsInChildren<SkinnedMeshRenderer>();
				for (int k = 0; k < componentsInChildren3.Length; k++)
				{
					((Component)componentsInChildren3[k]).gameObject.tag = "UnitMesh";
				}
			}
			if (((Object)((Component)unit).gameObject).name == ((Object)UPool.MyPool.GetObject("Bunyun16_UnitBase")).name)
			{
				Transform transform3 = ((Component)unit).transform;
				transform3.localScale *= 0.9f;
				((Component)unit).GetComponentInChildren<MovementHandler>().stopForTurns = false;
				((Component)unit).GetComponentInChildren<RigidbodyHolder>().randomizeRigidbodySizes = false;
				SkinnedMeshRenderer[] componentsInChildren4 = ((Component)unit).GetComponentsInChildren<SkinnedMeshRenderer>();
				for (int l = 0; l < componentsInChildren4.Length; l++)
				{
					((Component)componentsInChildren4[l]).gameObject.tag = "UnitMesh";
				}
			}
			if (((Object)((Component)unit).gameObject).name == ((Object)UPool.MyPool.GetObject("Arsenico_Base")).name)
			{
				Transform transform4 = ((Component)unit).transform;
				transform4.localScale *= 1.2f;
				((Component)unit).gameObject.AddComponent<OnDeathFadeAway>().particleObject = Utility.LoadBundleGameObject("ArsenicoDeathParticle");
				((Component)unit).GetComponentInChildren<MovementHandler>().stopForTurns = false;
				((Component)unit).GetComponentInChildren<RigidbodyHolder>().randomizeRigidbodySizes = false;
				SkinnedMeshRenderer[] componentsInChildren5 = ((Component)unit).GetComponentsInChildren<SkinnedMeshRenderer>();
				for (int m = 0; m < componentsInChildren5.Length; m++)
				{
					((Component)componentsInChildren5[m]).gameObject.tag = "UnitMesh";
				}
			}
			if (((Object)((Component)unit).gameObject).name == ((Object)UPool.MyPool.GetObject("JohnnyDawnedsonUnitBase")).name)
			{
				Transform transform5 = ((Component)unit).transform;
				transform5.localScale *= 1.5f;
				((Component)unit).GetComponentInChildren<MovementHandler>().stopForTurns = false;
				((Component)unit).GetComponentInChildren<RigidbodyHolder>().randomizeRigidbodySizes = false;
				SkinnedMeshRenderer[] componentsInChildren6 = ((Component)unit).GetComponentsInChildren<SkinnedMeshRenderer>();
				for (int n = 0; n < componentsInChildren6.Length; n++)
				{
					((Component)componentsInChildren6[n]).gameObject.tag = "UnitMesh";
				}
			}
			if (((Object)((Component)unit).gameObject).name == ((Object)UPool.MyPool.GetObject("SlightMuscularUnitBase")).name)
			{
				Transform transform6 = ((Component)unit).transform;
				transform6.localScale *= 1.25f;
				((Component)unit).GetComponentInChildren<MovementHandler>().stopForTurns = false;
				((Component)unit).GetComponentInChildren<EyeSpawner>().randomizeEyes = false;
				((Component)unit).GetComponentInChildren<RigidbodyHolder>().randomizeRigidbodySizes = false;
				SkinnedMeshRenderer[] componentsInChildren7 = ((Component)unit).GetComponentsInChildren<SkinnedMeshRenderer>();
				for (int num = 0; num < componentsInChildren7.Length; num++)
				{
					((Component)componentsInChildren7[num]).gameObject.tag = "UnitMesh";
				}
			}
		}

		public static void Init(LandfallContentDatabase db)
		{
			//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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Expected O, but got Unknown
			//IL_08f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_090d: Expected O, but got Unknown
			//IL_093c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0950: Expected O, but got Unknown
			//IL_097f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0993: Expected O, but got Unknown
			//IL_09f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a05: Expected O, but got Unknown
			//IL_0a34: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a48: Expected O, but got Unknown
			//IL_0b04: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b18: Expected O, but got Unknown
			//IL_0b47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b5b: Expected O, but got Unknown
			//IL_0b8a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9e: Expected O, but got Unknown
			//IL_0bcd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be1: Expected O, but got Unknown
			//IL_0c10: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c24: Expected O, but got Unknown
			LoadBundle("randomunitsbundle");
			Sprite val = Utility.LoadBundleTextureToSprite("spriterandomunits");
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Create Custom Faction";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Faction val2 = SLMATool.CreateFaction("Geezt Randoms Unit", (UnitBlueprint[])null, val, 52343241);
			val2.m_FactionColor = new Color(1f, 1f, 1f);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Create Custom Units";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			SLMATool.CreateUnit("Arsenico", (UnitBlueprint)null, val2, Utility.LoadBundleTextureToSprite("arsenico_icon"));
			SLMATool.CreateUnit("Gore Guild", (UnitBlueprint)null, val2, Utility.LoadBundleTextureToSprite("goreguild_icon"));
			SLMATool.CreateUnit("Bunyun16", (UnitBlueprint)null, (Faction)SLMALoader.SDic["factions"]["Subunits"], Utility.LoadBundleTextureToSprite("goreguild_icon"));
			SLMATool.CreateUnit("Johnny Dawnedson", (UnitBlueprint)null, val2, Utility.LoadBundleTextureToSprite("johnnydawnedson_icon"));
			SLMATool.CreateUnit("NYAN-CHAN-UNIT", (UnitBlueprint)null, val2, Utility.LoadBundleTextureToSprite("nyanchan_icon"));
			SLMATool.CreateUnit("Omni-Man", (UnitBlueprint)null, val2, Utility.LoadBundleTextureToSprite("omniman_icon"));
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Weapons";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("CwiticalCattack", Utility.LoadBundleGameObject("CwiticalCattack"), true, (HideFlags)52, val, 735454345, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("LumberjackChainsaw", Utility.LoadBundleGameObject("LumberjackChainsaw"), true, (HideFlags)52, val, 734345423, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("PaleriteBlade", Utility.LoadBundleGameObject("PaleriteBlade"), true, (HideFlags)52, val, 734123423, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Hiveflail", Utility.LoadBundleGameObject("Hiveflail"), true, (HideFlags)52, val, 463532431, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("SupersonicFist", Utility.LoadBundleGameObject("SupersonicFist"), true, (HideFlags)52, val, 735454323, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("BindingJaggedCombatKnife", Utility.LoadBundleGameObject("BindingJaggedCombatKnife"), true, (HideFlags)52, val, 643423432, true), "Random Units", (TagType)0);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Clothing";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("NyanChanHair", Utility.LoadBundleGameObject("NyanChanHair"), true, (HideFlags)52, val, 623432432, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("NyanHeadCatMonitor", Utility.LoadBundleGameObject("NyanHeadCatMonitor"), true, (HideFlags)52, val, 62434233, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("NyanChanSuitArmor", Utility.LoadBundleGameObject("NyanChanSuitArmor"), true, (HideFlags)52, val, 624324234, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("NyanChanCatTail", Utility.LoadBundleGameObject("NyanChanCatTail"), true, (HideFlags)52, val, 53243243, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("LumberjackUniform", Utility.LoadBundleGameObject("LumberjackUniform"), true, (HideFlags)52, val, 82489343, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("LumberjackHair", Utility.LoadBundleGameObject("LumberjackHair"), true, (HideFlags)52, val, 95235732, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("LumberjackBeard", Utility.LoadBundleGameObject("LumberjackBeard"), true, (HideFlags)52, val, 63243423, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("LumberjackBoots", Utility.LoadBundleGameObject("LumberjackBoots"), true, (HideFlags)52, val, 23432483, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("LumberjackPant", Utility.LoadBundleGameObject("LumberjackPant"), true, (HideFlags)52, val, 124532483, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("BunyunHair", Utility.LoadBundleGameObject("BunyunHair"), true, (HideFlags)52, val, 62344343, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("VilepaleAgentBoots", Utility.LoadBundleGameObject("VilepaleAgentBoots"), true, (HideFlags)52, val, 67345234, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("VilepaleAgentGlove", Utility.LoadBundleGameObject("VilepaleAgentGlove"), true, (HideFlags)52, val, 1236234732, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("VilepaleAgentHeadband", Utility.LoadBundleGameObject("VilepaleAgentHeadband"), true, (HideFlags)52, val, 734524432, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("VilepaleAgentPant", Utility.LoadBundleGameObject("VilepaleAgentPant"), true, (HideFlags)52, val, 314135133, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("VilepaleAgentShortSkirt", Utility.LoadBundleGameObject("VilepaleAgentShortSkirt"), true, (HideFlags)52, val, 643532434, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("VilepaleAgentShoulderpads", Utility.LoadBundleGameObject("VilepaleAgentShoulderpads"), true, (HideFlags)52, val, 231232341, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("VilepaleAgentUniform", Utility.LoadBundleGameObject("VilepaleAgentUniform"), true, (HideFlags)52, val, 424342343, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("ArsenicHatchlingThing", Utility.LoadBundleGameObject("ArsenicHatchlingThing"), true, (HideFlags)52, val, 365437643, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("LeatherWeatheredHood", Utility.LoadBundleGameObject("LeatherWeatheredHood"), true, (HideFlags)52, val, 1263122312, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("LeatherWeatheredClothing", Utility.LoadBundleGameObject("LeatherWeatheredClothing"), true, (HideFlags)52, val, 561231231, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("ClothWrapArmor", Utility.LoadBundleGameObject("ClothWrapArmor"), true, (HideFlags)52, val, 123432432, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("ArsenicoSkinCovers", Utility.LoadBundleGameObject("ArsenicoSkinCovers"), true, (HideFlags)52, val, 634523432, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("CustomizableShadingProp", Utility.LoadBundleGameObject("CustomizableShadingProp"), true, (HideFlags)52, val, 272442342, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("WickedSmile", Utility.LoadBundleGameObject("WickedSmile"), true, (HideFlags)52, val, 643532343, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("DarkShadowCovers", Utility.LoadBundleGameObject("DarkShadowCovers"), true, (HideFlags)52, val, 532332343, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("BigPastorGown", Utility.LoadBundleGameObject("BigPastorGown"), true, (HideFlags)52, val, 63543543, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("JohnnyDawnedsonHair", Utility.LoadBundleGameObject("JohnnyDawnedsonHair"), true, (HideFlags)52, val, 62342343, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("MuscularBodyBoots", Utility.LoadBundleGameObject("MuscularBodyBoots"), true, (HideFlags)52, val, 52432423, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("MuscularBodyPartsTights", Utility.LoadBundleGameObject("MuscularBodyPartsTights"), true, (HideFlags)52, val, 645324234, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("OmniSuit", Utility.LoadBundleGameObject("OmniSuit"), true, (HideFlags)52, val, 53343123, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("OmniTight", Utility.LoadBundleGameObject("OmniTight"), true, (HideFlags)52, val, 73243242, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("NolanHairAndMoustache", Utility.LoadBundleGameObject("NolanHairAndMoustache"), true, (HideFlags)52, val, 123151423, true), "Random Units", (TagType)0);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Ability";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_Meowrsenal", Utility.LoadBundleGameObject("Move_Meowrsenal"), true, (HideFlags)52, val, 344324432, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_PurrfectPawwages", Utility.LoadBundleGameObject("Move_PurrfectPawwages"), true, (HideFlags)52, val, 66243242, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_Zoomies", (GameObject)SLMALoader.SDic["moves"]["Head_up"], true, (HideFlags)52, val, 23423223, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_Woomies", (GameObject)SLMALoader.SDic["moves"]["Head_up"], true, (HideFlags)52, val, 62353432, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_BeegServalStretch", (GameObject)SLMALoader.SDic["moves"]["Head_up"], true, (HideFlags)52, val, 23562343, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_Breakthrough", Utility.LoadBundleGameObject("Move_Breakthrough"), true, (HideFlags)52, val, 62432324, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_Infiltrate", (GameObject)SLMALoader.SDic["moves"]["Head_up"], true, (HideFlags)52, val, 635321432, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_SpawnBunyunCompanion", (GameObject)SLMALoader.SDic["moves"]["Head_up"], true, (HideFlags)52, val, 345234324, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_CondensedSpewspit", Utility.LoadBundleGameObject("Move_CondensedSpewspit"), true, (HideFlags)52, val, 176453432, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_DispersingDodge", Utility.LoadBundleGameObject("Move_DispersingDodge"), true, (HideFlags)52, val, 236234343, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_RadioactiveToxicity", Utility.LoadBundleGameObject("Move_RadioactiveToxicity"), true, (HideFlags)52, val, 232563253, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_AirborneUppercut", (GameObject)SLMALoader.SDic["moves"]["Head_up"], true, (HideFlags)52, val, 83454345, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_KnockoutPunch", (GameObject)SLMALoader.SDic["moves"]["Head_up"], true, (HideFlags)52, val, 95465234, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_DynamicFlight", (GameObject)SLMALoader.SDic["moves"]["Head_up"], true, (HideFlags)52, val, 73454532, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_Restriction", (GameObject)SLMALoader.SDic["moves"]["Head_up"], true, (HideFlags)52, val, 12351243, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_TemperedDawn", (GameObject)SLMALoader.SDic["moves"]["Head_up"], true, (HideFlags)52, val, 62312231, true), "Random Units", (TagType)0);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Unit Bases";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.AddToUnitLib(Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("NyanChan_UnitBase", Utility.LoadBundleGameObject("NyanChan_UnitBase"), true, (HideFlags)52, val, 52723423, true), "Random Units", (TagType)0));
			Utility.AddToUnitLib(Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Eliyah_UnitBase", Utility.LoadBundleGameObject("Eliyah_UnitBase"), true, (HideFlags)52, val, 412651231, true), "Random Units", (TagType)0));
			Utility.AddToUnitLib(Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Bunyun16_UnitBase", Utility.LoadBundleGameObject("Bunyun16_UnitBase"), true, (HideFlags)52, val, 253433243, true), "Random Units", (TagType)0));
			Utility.AddToUnitLib(Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Arsenico_Base", Utility.LoadBundleGameObject("Arsenico_Base"), true, (HideFlags)52, val, 86465435, true), "Random Units", (TagType)0));
			Utility.AddToUnitLib(Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("SlightMuscularUnitBase", Utility.LoadBundleGameObject("SlightMuscularUnitBase"), true, (HideFlags)52, val, 63453343, true), "Random Units", (TagType)0));
			Utility.AddToUnitLib(Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("JohnnyDawnedsonUnitBase", Utility.LoadBundleGameObject("JohnnyDawnedsonUnitBase"), true, (HideFlags)52, val, 643523432, true), "Random Units", (TagType)0));
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Projectile";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("P_G4TOMissile", Utility.LoadBundleGameObject("P_G4TOMissile"), true, (HideFlags)52, val, 62341343, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("P_PawwagesLaser", Utility.LoadBundleGameObject("P_PawwagesLaser"), true, (HideFlags)52, val, 624324324, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("P_CondensedSpewspit", Utility.LoadBundleGameObject("P_CondensedSpewspit"), true, (HideFlags)52, val, 934332834, true), "Random Units", (TagType)0);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Effects";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Eff_Bunmark", Utility.LoadBundleGameObject("Eff_Bunmark"), true, (HideFlags)52, val, 0, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Eff_Rapture", Utility.LoadBundleGameObject("Eff_Rapture"), true, (HideFlags)52, val, 0, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Eff_GreenStrychnine", Utility.LoadBundleGameObject("Eff_GreenStrychnine"), true, (HideFlags)52, val, 0, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Eff_PurpleDoomspores", Utility.LoadBundleGameObject("Eff_PurpleDoomspores"), true, (HideFlags)52, val, 0, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Eff_YellowParalipowder", Utility.LoadBundleGameObject("Eff_YellowParalipowder"), true, (HideFlags)52, val, 0, true), "Random Units", (TagType)0);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Explosions";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("E_MiniGatoExplosion", Utility.LoadBundleGameObject("E_MiniGatoExplosion"), true, (HideFlags)52, val, 0, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("E_PawwagesLaser", Utility.LoadBundleGameObject("E_PawwagesLaser"), true, (HideFlags)52, val, 0, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("E_DelayedDeathClaw", Utility.LoadBundleGameObject("E_DelayedDeathClaw"), true, (HideFlags)52, val, 0, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("E_YellowParalipowder", Utility.LoadBundleGameObject("E_YellowParalipowder"), true, (HideFlags)52, val, 0, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("E_PurpleDoomspores", Utility.LoadBundleGameObject("E_PurpleDoomspores"), true, (HideFlags)52, val, 0, true), "Random Units", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("E_AirborneUppercutGrounded", Utility.LoadBundleGameObject("E_AirborneUppercutGrounded"), true, (HideFlags)52, val, 0, true), "Random Units", (TagType)0);
		}

		public static void SetWeapon(GameObject weapon, MeleeWeapon melee, RangeWeapon range, LandfallContentDatabase db)
		{
			if ((Object)(object)weapon == (Object)(object)UPool.MyPool.GetObject("CwiticalCattack"))
			{
				weapon.AddComponent<CwiticalDelayedExplosion>().explosion = UPool.MyPool.GetObject("E_DelayedDeathClaw");
			}
			if ((Object)(object)weapon == (Object)(object)UPool.MyPool.GetObject("PaleriteBlade"))
			{
				weapon.AddComponent<DamageCollisionTeardown>().bloodParticles = Utility.LoadBundleGameObject("BloodSplotchVFX");
				weapon.GetComponentInChildren<MeleeWeaponAddEffect>().EffectPrefab = (UnitEffectBase)(object)UPool.MyPool.GetObject("Eff_Bunmark").GetComponentInChildren<DamageOverTimeEffect>();
			}
			if ((Object)(object)weapon == (Object)(object)UPool.MyPool.GetObject("LumberjackChainsaw"))
			{
				weapon.AddComponent<ChainsawShake>();
				weapon.AddComponent<DamageCollisionTeardown>().bloodParticles = Utility.LoadBundleGameObject("BloodSplotchVFX");
				weapon.GetComponentInChildren<MeleeWeaponAddEffect>().EffectPrefab = (UnitEffectBase)(object)UPool.MyPool.GetObject("Eff_Rapture").GetComponentInChildren<DamageOverTimeEffect>();
			}
			if ((Object)(object)weapon == (Object)(object)UPool.MyPool.GetObject("SupersonicFist"))
			{
				weapon.AddComponent<OmniKnockbackEffect>();
			}
			if ((Object)(object)weapon == (Object)(object)UPool.MyPool.GetObject("BindingJaggedCombatKnife"))
			{
				weapon.AddComponent<BindingEffectStick>();
				weapon.AddComponent<DamageCollisionQuickknife>();
			}
		}

		public static void SetEffects(GameObject effect)
		{
			BunmarkEffectDetection bunmarkEffectDetection = default(BunmarkEffectDetection);
			if (Object.op_Implicit((Object)(object)(effect = UPool.MyPool.GetObject("Eff_Bunmark"))) && !effect.TryGetComponent<BunmarkEffectDetection>(ref bunmarkEffectDetection))
			{
				effect.AddComponent<BunmarkEffectDetection>();
			}
			RaptureEffectDetection raptureEffectDetection = default(RaptureEffectDetection);
			if (Object.op_Implicit((Object)(object)(effect = UPool.MyPool.GetObject("Eff_Rapture"))) && !effect.TryGetComponent<RaptureEffectDetection>(ref raptureEffectDetection))
			{
				effect.AddComponent<RaptureEffectDetection>();
			}
			GreenStrychnineEffect greenStrychnineEffect = default(GreenStrychnineEffect);
			if (Object.op_Implicit((Object)(object)(effect = UPool.MyPool.GetObject("Eff_GreenStrychnine"))) && !effect.TryGetComponent<GreenStrychnineEffect>(ref greenStrychnineEffect))
			{
				effect.AddComponent<GreenStrychnineEffect>();
			}
		}

		public static void LoadBundle(string assetBundleName)
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(assetBundleName);
			bundle = AssetBundle.LoadFromStream(stream);
		}

		public static void SetExplosion(GameObject explosion)
		{
		}

		public static void SetProjectile(GameObject proj, ProjectileHit projhit, LandfallContentDatabase db)
		{
			if ((Object)(object)proj == (Object)(object)UPool.MyPool.GetObject("P_CondensedSpewspit"))
			{
				proj.GetComponentInChildren<ExplosionAddEffect>().EffectPrefab = (UnitEffectBase)(object)UPool.MyPool.GetObject("Eff_GreenStrychnine").GetComponentInChildren<DamageOverTimeEffect>();
				proj.GetComponentInChildren<AddObjectEffect>().EffectPrefab = (UnitEffectBase)(object)UPool.MyPool.GetObject("Eff_GreenStrychnine").GetComponentInChildren<DamageOverTimeEffect>();
			}
		}

		static UManager()
		{
			unitBasesObject = new List<GameObject>();
			unitBases = new List<Unit>();
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("GeeztJeez.RandomUnits", "RandomUnits", "1.0.0")]
	internal class Loader : BaseUnityPlugin
	{
		private void Awake()
		{
			((MonoBehaviour)this).StartCoroutine("Call");
		}

		private IEnumerator Call()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)Object.FindObjectOfType<ServiceLocator>() != (Object)null));
			yield return (object)new WaitUntil((Func<bool>)(() => ServiceLocator.GetService<ISaveLoaderService>() != null));
			Debug.Log((object)"Loading RandomUnits!");
			SLMALoader.GetInstance();
			LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
			UManager.Init(landfallContentDatabase);
			UManager.Utility.AddLocalization();
			new Harmony("RandomUnits").PatchAll();
			GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
			for (int i = 0; i < array.Length; i++)
			{
				if (Object.op_Implicit((Object)(object)array[i].GetComponent<Explosion>()))
				{
					UManager.SetExplosion(array[i]);
				}
				if (Object.op_Implicit((Object)(object)array[i].GetComponent<ProjectileHit>()))
				{
					UManager.SetProjectile(array[i], array[i].GetComponent<ProjectileHit>(), landfallContentDatabase);
				}
				if (Object.op_Implicit((Object)(object)array[i].GetComponent<Unit>()))
				{
					UManager.SetUnits(array[i].GetComponent<Unit>(), landfallContentDatabase);
				}
				if (Object.op_Implicit((Object)(object)array[i].GetComponent<WeaponItem>()))
				{
					UManager.SetWeapon(array[i], array[i].GetComponent<MeleeWeapon>(), array[i].GetComponent<RangeWeapon>(), landfallContentDatabase);
				}
				if (Object.op_Implicit((Object)(object)array[i].GetComponent<PlaySoundEffect>()))
				{
					UManager.SetEffects(array[i]);
				}
				if (Object.op_Implicit((Object)(object)array[i].GetComponent<SpecialAbility>()))
				{
					UManager.SetMoves(array[i], landfallContentDatabase);
				}
				if (Object.op_Implicit((Object)(object)array[i].GetComponent<PropItem>()))
				{
					UManager.SetClothes(array[i], array[i].GetComponent<CharacterItem>(), array[i].GetComponent<PropItemData>(), landfallContentDatabase);
				}
			}
			UnitBlueprint[] array2 = Resources.FindObjectsOfTypeAll<UnitBlueprint>();
			for (int j = 0; j < array2.Length; j++)
			{
				UManager.SetBlueprint(array2[j], landfallContentDatabase);
				array2[j].Validate();
			}
			SceneManager.sceneLoaded += SceneLoaded;
			Debug.Log((object)"Loaded RandomUnits Successfully!");
		}

		public void SceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_00f5: Expected O, but got Unknown
			if (!(((Scene)(ref scene)).name == "UnitCreator_GamepadUI"))
			{
				return;
			}
			UnitEditorManager component = ((Scene)(ref scene)).GetRootGameObjects().ToList().Find((GameObject x) => Object.op_Implicit((Object)(object)x.GetComponent<UnitEditorManager>()))
				.GetComponent<UnitEditorManager>();
			List<UnitBaseWrapper> list = component.UnitBases.ToList();
			foreach (Unit unitBasis in UManager.unitBases)
			{
				UnitBlueprint val = SLMATool.CreateUnit("MoreContent Custom:" + unitBasis.Entity.Name, (UnitBlueprint)SLMALoader.SDic["blueprints"]["CustomWobbler"], (Faction)null, (Sprite)null);
				val.UnitBase = ((Component)unitBasis).gameObject;
				list.Add(new UnitBaseWrapper
				{
					BaseDisplayName = unitBasis.Entity.Name,
					BaseIcon = unitBasis.Entity.SpriteIcon,
					UnitBaseBlueprint = val,
					UnitBaseRestriction = (UnitBaseRestrictions)0
				});
			}
			component.UnitBases = list.ToArray();
		}
	}
}
namespace CustomShites
{
	public class ShadedClothing : MonoBehaviour
	{
		public Unit rootUnit;

		public SkinnedMeshRenderer skinnedMeshRenderer;

		public void Start()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			rootUnit = ((Component)((Component)this).gameObject.transform.root).GetComponentInChildren<Unit>();
			skinnedMeshRenderer = ((Component)this).GetComponentInChildren<SkinnedMeshRenderer>();
			if ((Object)(object)skinnedMeshRenderer != (Object)null && (Object)(object)((Renderer)skinnedMeshRenderer).material != (Object)null)
			{
				((Renderer)skinnedMeshRenderer).material = new Material(((Renderer)skinnedMeshRenderer).material);
			}
		}

		public void Update()
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)rootUnit) && !rootUnit.data.Dead)
			{
				float health = rootUnit.data.health;
				float maxHealth = rootUnit.data.maxHealth;
				float num = Mathf.Clamp01(1f - health / maxHealth);
				Color color = default(Color);
				((Color)(ref color))..ctor(0f, 0f, 0f, num);
				if ((Object)(object)skinnedMeshRenderer != (Object)null && (Object)(object)((Renderer)skinnedMeshRenderer).material != (Object)null)
				{
					((Renderer)skinnedMeshRenderer).material.color = color;
				}
			}
		}
	}
	public class BindingEffectStick : CollisionWeaponEffect
	{
		private Rigidbody rig;

		public Rigidbody otherRigidbody;

		[HideInInspector]
		public ConfigurableJoint joint;

		private GeneralInput input;

		private Holdable holdable;

		private ForcePoint forcePoint;

		private Unit holder;

		private Unit target;

		private void Start()
		{
			rig = ((Component)this).GetComponent<Rigidbody>();
			holdable = ((Component)this).GetComponent<Holdable>();
			holder = ((Component)((Component)this).transform.root).GetComponentInParent<Unit>();
			input = ((Component)holder).GetComponentInChildren<GeneralInput>();
			forcePoint = ((Component)this).GetComponentInChildren<ForcePoint>();
		}

		private void FixedUpdate()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)joint))
			{
				if (Object.op_Implicit((Object)(object)((Joint)joint).connectedBody) && (!Object.op_Implicit((Object)(object)holder.data) || !holder.data.Dead))
				{
					((Joint)joint).connectedBody.AddForce(Vector3.up, (ForceMode)0);
					input.inputDirection = Vector3.zero;
				}
				if ((Object.op_Implicit((Object)(object)target) && Object.op_Implicit((Object)(object)target.data) && target.data.Dead) || (Object.op_Implicit((Object)(object)holder.data) && holder.data.Dead) || !Object.op_Implicit((Object)(object)target) || !Object.op_Implicit((Object)(object)holder))
				{
					RemoveStickJoint();
				}
			}
		}

		public override void DoEffect(Transform hitTransform, Collision collision)
		{
			//IL_003f: 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)
			if (!Object.op_Implicit((Object)(object)joint))
			{
				target = ((Component)collision.transform).GetComponentInParent<Unit>();
				if ((!Object.op_Implicit((Object)(object)target) || !Object.op_Implicit((Object)(object)holder) || holder.Team != target.Team) && Object.op_Implicit((Object)(object)collision.rigidbody))
				{
					otherRigidbody = collision.rigidbody;
					joint = AttachJoint(rig, collision.rigidbody, ((Component)forcePoint).transform);
				}
			}
		}

		public void RemoveStickJoint()
		{
			if (Object.op_Implicit((Object)(object)joint))
			{
				Object.Destroy((Object)(object)joint);
			}
		}

		public static ConfigurableJoint AttachJoint(Rigidbody myRig, Rigidbody otherRig, Transform forcePoint)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_001b: 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_006b: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = forcePoint.position;
			ConfigurableJoint val = ((Component)myRig).gameObject.AddComponent<ConfigurableJoint>();
			((Joint)val).anchor = ((Component)myRig).transform.InverseTransformPoint(position);
			val.xMotion = (ConfigurableJointMotion)0;
			val.yMotion = (ConfigurableJointMotion)0;
			val.zMotion = (ConfigurableJointMotion)0;
			val.angularXMotion = (ConfigurableJointMotion)0;
			val.angularYMotion = (ConfigurableJointMotion)0;
			val.angularZMotion = (ConfigurableJointMotion)0;
			if (Object.op_Implicit((Object)(object)otherRig))
			{
				((Joint)val).connectedBody = otherRig;
			}
			val.projectionMode = (JointProjectionMode)1;
			JointDrive angularXDrive = val.angularXDrive;
			((JointDrive)(ref angularXDrive)).positionSpring = 10f;
			((JointDrive)(ref angularXDrive)).positionDamper = 2f;
			val.angularXDrive = angularXDrive;
			val.angularYZDrive = angularXDrive;
			((Joint)val).enablePreprocessing = false;
			return val;
		}
	}
	public class TemperedDawnPassive : MonoBehaviour
	{
		public void Start()
		{
		}
	}
	[HarmonyPatch(typeof(HealthHandler), "TakeDamage")]
	internal class TakeDamageRandomusPatch
	{
		private static void Prefix(HealthHandler __instance, float damage)
		{
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: 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_0261: Unknown result type (might be due to invalid IL or missing references)
			if (float.IsNaN(damage) || float.IsInfinity(damage) || damage == 0f)
			{
				return;
			}
			FieldInfo field = typeof(HealthHandler).GetField("data", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			object? obj = ((field != null) ? field.GetValue(__instance) : null);
			DataHandler val = (DataHandler)((obj is DataHandler) ? obj : null);
			FieldInfo field2 = typeof(HealthHandler).GetField("isInvulnerable", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			bool flag = (((field2 != null) ? field2.GetValue(__instance) : null) as bool?) ?? false;
			if ((Object)(object)val == (Object)null || val.Dead || flag)
			{
				return;
			}
			if (val.lifeTime >= 0.3f && (val.immunityForSeconds <= 0f || damage > 0f) && damage < val.health && !val.Dead && Object.op_Implicit((Object)(object)((Component)val.unit).gameObject.GetComponentInChildren<TemperedDawnPassive>()))
			{
				float health = val.health;
				float maxHealth = val.maxHealth;
				if (health >= maxHealth * 0.25f)
				{
					val.health += (damage *= Mathf.Clamp01(1f - health / maxHealth));
				}
				else if (Random.Range(0f, 1f) <= 0.75f)
				{
					val.health += damage;
				}
				else
				{
					val.health += (damage *= Mathf.Clamp01(1f - health / maxHealth));
				}
				ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect("Effects/PriestHeal", 0.7f, val.mainRig.position, (MaterialType)0, (Transform)null, 0.5f);
				ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect("Effects/Log", 1f, val.mainRig.position, (MaterialType)0, (Transform)null, 0.7f);
			}
			if (val.lifeTime >= 0.3f && (val.immunityForSeconds <= 0f || damage > 0f) && damage < val.health && !val.Dead && Object.op_Implicit((Object)(object)((Component)val.unit).gameObject.GetComponentInChildren<BunmarkEffectDetection>()))
			{
				if (damage > val.health)
				{
					val.healthHandler.Die((Unit)null);
				}
				else
				{
					val.health -= damage;
				}
				ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect("Effects/Slice", 1f, val.mainRig.position, (MaterialType)0, (Transform)null, 0.7f);
			}
			if (val.lifeTime >= 0.3f && (val.immunityForSeconds <= 0f || damage < 0f) && !val.Dead && Object.op_Implicit((Object)(object)((Component)val.unit).gameObject.GetComponentInChildren<RaptureEffectDetection>()))
			{
				val.health += damage;
				ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect("Effects/PotionEffect", 0.7f, val.mainRig.position, (MaterialType)0, (Transform)null, 0.5f);
			}
		}
	}
	public class RemoveClothingIfDead : MonoBehaviour
	{
		public Unit rootUnit;

		public void Start()
		{
			rootUnit = ((Component)((Component)this).gameObject.transform.root).GetComponentInChildren<Unit>();
		}

		public void Update()
		{
			if (Object.op_Implicit((Object)(object)rootUnit) && rootUnit.data.Dead)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class ContinuousDamageWeaponQuickfist : MonoBehaviour
	{
		private CollisionWeapon collisionWeapon;

		private Rigidbody rig;

		private float damageInterval = 0.5f;

		private float damageTimer;

		private void Start()
		{
			collisionWeapon = ((Component)this).GetComponent<CollisionWeapon>();
			rig = ((Component)this).GetComponent<Rigidbody>();
			if ((Object)(object)collisionWeapon == (Object)null)
			{
				Debug.LogError((object)"CollisionWeapon component missing!");
			}
			damageTimer = damageInterval;
		}

		private void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 velocity = rig.velocity;
			if (!(((Vector3)(ref velocity)).magnitude <= 0f))
			{
				damageTimer -= Time.deltaTime;
				if (damageTimer <= 0f)
				{
					ApplyContinuousDamage();
					damageTimer = damageInterval;
				}
			}
		}

		private void ApplyContinuousDamage()
		{
			//IL_0006: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 1.5f);
			foreach (Collider val in array)
			{
				if ((Object)(object)val.attachedRigidbody == (Object)null || (Object)(object)((Component)val).transform.root == (Object)(object)((Component)this).transform.root)
				{
					continue;
				}
				Damagable componentInParent = ((Component)val.attachedRigidbody).GetComponentInParent<Damagable>();
				if (!((Object)(object)componentInParent == (Object)null))
				{
					Vector3 val2 = ((Component)val).transform.position - ((Component)this).transform.position;
					Vector3 normalized = ((Vector3)(ref val2)).normalized;
					componentInParent.TakeDamage(collisionWeapon.damage, normalized, (Unit)null, (DamageType)0);
					UnityEvent dealDamageEvent = collisionWeapon.dealDamageEvent;
					if (dealDamageEvent != null)
					{
						dealDamageEvent.Invoke();
					}
				}
			}
		}
	}
	public class DamageCollisionQuickknife : MonoBehaviour
	{
		private CollisionWeapon collisionWeapon;

		private CollisionSound collisionSound;

		private BindingEffectStick bindingGrabStick;

		public Unit unit;

		private float counter;

		private float timer;

		private MeleeWeapon meleeWeapon;

		private void OnCollisionEnter(Collision collision)
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)collision.gameObject != (Object)null) || !(counter >= timer) || !meleeWeapon.isSwinging || Object.op_Implicit((Object)(object)collision.gameObject.GetComponentInParent<Weapon>()) || Object.op_Implicit((Object)(object)collision.gameObject.GetComponentInParent<RangeWeapon>()) || Object.op_Implicit((Object)(object)collision.gameObject.GetComponentInParent<MeleeWeapon>()))
			{
				return;
			}
			Unit componentInChildren = ((Component)collision.gameObject.transform.root).gameObject.GetComponentInChildren<Unit>();
			if (Object.op_Implicit((Object)(object)componentInChildren) && componentInChildren.Team != unit.Team && (Object)(object)componentInChildren != (Object)(object)unit)
			{
				counter = 0f;
				((Damagable)componentInChildren.data.healthHandler).TakeDamage(collisionWeapon.damage, collision.gameObject.transform.position, unit, (DamageType)0);
				_ = componentInChildren.data.allRigs.AllRigs;
				if (Object.op_Implicit((Object)(object)bindingGrabStick))
				{
					((CollisionWeaponEffect)bindingGrabStick).DoEffect(((Component)this).transform, collision);
				}
				if (Object.op_Implicit((Object)(object)collisionSound))
				{
					SoundPlayer service = ServiceLocator.GetService<SoundPlayer>();
					string soundEffectRef = collisionSound.SoundEffectRef;
					ContactPoint contact = collision.GetContact(0);
					service.PlaySoundEffect(soundEffectRef, 1f, ((ContactPoint)(ref contact)).point, (MaterialType)0, (Transform)null, 0.7f);
				}
			}
		}

		private void Start()
		{
			unit = ((Component)((Component)this).gameObject.transform.root).gameObject.GetComponentInChildren<Unit>();
			meleeWeapon = ((Component)this).GetComponentInChildren<MeleeWeapon>();
			collisionWeapon = ((Component)this).GetComponentInChildren<CollisionWeapon>();
			collisionSound = ((Component)this).GetComponentInChildren<CollisionSound>();
			bindingGrabStick = ((Component)this).GetComponentInChildren<BindingEffectStick>();
		}

		public void Update()
		{
			if (counter < timer)
			{
				counter += Time.deltaTime;
			}
			if (!Object.op_Implicit((Object)(object)bindingGrabStick))
			{
				bindingGrabStick = ((Component)this).GetComponentInChildren<BindingEffectStick>();
			}
		}

		public DamageCollisionQuickknife()
		{
			timer = 0.01f;
		}
	}
	public class RestrictionMovementPassive : MonoBehaviour
	{
		private MeleeWeapon[] meleeWeapons;

		private Unit unit;

		private Vector3 lastPosition;

		public float maxMovability;

		private float counter;

		public float cooldown;

		private Unit target;

		private List<ConfigurableJoint> joints;

		public float range = 10f;

		public void Start()
		{
			unit = ((Component)((Component)this).transform.root).GetComponentInChildren<Unit>();
			meleeWeapons = ((Component)unit).GetComponentsInChildren<MeleeWeapon>();
			counter = cooldown;
		}

		public void FixedUpdate()
		{
			//IL_003c: 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_01c4: 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_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			if (joints.Count > 0)
			{
				if (Object.op_Implicit((Object)(object)target))
				{
					Rigidbody[] allRigs = target.data.allRigs.AllRigs;
					foreach (Rigidbody obj in allRigs)
					{
						obj.velocity *= 0.25f;
					}
				}
				for (int num = joints.Count - 1; num >= 0; num--)
				{
					ConfigurableJoint val = joints[num];
					if (Object.op_Implicit((Object)(object)((Joint)val).connectedBody) && Object.op_Implicit((Object)(object)unit) && !unit.data.Dead)
					{
						((Joint)val).connectedBody.AddForce(Vector3.down, (ForceMode)0);
					}
					if (!Object.op_Implicit((Object)(object)target) || !Object.op_Implicit((Object)(object)unit) || (Object.op_Implicit((Object)(object)target.data) && target.data.Dead) || (Object.op_Implicit((Object)(object)unit.data) && unit.data.Dead))
					{
						RemoveStickJoint(val);
						joints.RemoveAt(num);
					}
				}
			}
			if (Object.op_Implicit((Object)(object)unit) && Object.op_Implicit((Object)(object)unit.data) && Object.op_Implicit((Object)(object)unit.data.targetData) && Object.op_Implicit((Object)(object)unit.data.targetData.unit))
			{
				target = unit.data.targetData.unit;
				Rigidbody mainRig = target.data.mainRig;
				float num2 = Vector3.Distance(mainRig.position, unit.data.mainRig.position);
				if (joints.Count <= 0 && Object.op_Implicit((Object)(object)target) && num2 <= range && CheckVelocityAndAngularVelocity(mainRig) && counter >= cooldown)
				{
					counter = 0f;
					DoMovement(target);
				}
				lastPosition = mainRig.position;
			}
		}

		private bool CheckVelocityAndAngularVelocity(Rigidbody rb)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = rb.velocity;
			if (!(((Vector3)(ref val)).magnitude > maxMovability))
			{
				val = rb.angularVelocity;
				return ((Vector3)(ref val)).magnitude > maxMovability;
			}
			return true;
		}

		public void DoMovement(Unit target)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = target.data.mainRig.position;
			Rigidbody[] allRigs = unit.data.allRigs.AllRigs;
			for (int i = 0; i < allRigs.Length; i++)
			{
				allRigs[i].position = position;
			}
			((Damagable)target.data.healthHandler).TakeDamage(300f, unit.data.mainRig.position, unit, (DamageType)1);
			MeleeWeapon[] array = meleeWeapons;
			foreach (MeleeWeapon obj in array)
			{
				Rigidbody componentInChildren = ((Component)obj).GetComponentInChildren<Rigidbody>();
				Transform transform = ((Component)((Component)obj).GetComponentInChildren<ForcePoint>()).transform;
				ConfigurableJoint item = AttachJoint(componentInChildren, target.data.mainRig, transform);
				joints.Add(item);
			}
		}

		public RestrictionMovementPassive()
		{
			maxMovability = 35f;
			cooldown = 4f;
			joints = new List<ConfigurableJoint>();
		}

		public static ConfigurableJoint AttachJoint(Rigidbody myRig, Rigidbody otherRig, Transform forcePoint)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_003f: 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_0041: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_0060: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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)
			((Component)myRig).transform.position = otherRig.position;
			ConfigurableJoint val = ((Component)myRig).gameObject.AddComponent<ConfigurableJoint>();
			((Joint)val).anchor = ((Component)myRig).transform.InverseTransformPoint(forcePoint.position);
			ConfigurableJointMotion val2 = (ConfigurableJointMotion)0;
			val.zMotion = (ConfigurableJointMotion)0;
			ConfigurableJointMotion xMotion = (val.yMotion = val2);
			val.xMotion = xMotion;
			val2 = (ConfigurableJointMotion)0;
			val.angularZMotion = (ConfigurableJointMotion)0;
			xMotion = (val.angularYMotion = val2);
			val.angularXMotion = xMotion;
			if (Object.op_Implicit((Object)(object)otherRig))
			{
				((Joint)val).connectedBody = otherRig;
			}
			val.projectionMode = (JointProjectionMode)1;
			JointDrive angularXDrive = val.angularXDrive;
			((JointDrive)(ref angularXDrive)).positionSpring = 10f;
			((JointDrive)(ref angularXDrive)).positionDamper = 2f;
			val.angularXDrive = angularXDrive;
			val.angularYZDrive = angularXDrive;
			((Joint)val).enablePreprocessing = false;
			return val;
		}

		public void Update()
		{
			counter += Time.deltaTime;
		}

		public void RemoveStickJoint(ConfigurableJoint joint)
		{
			if (Object.op_Implicit((Object)(object)joint))
			{
				Object.Destroy((Object)(object)joint);
			}
		}
	}
	public class DynamicFlightMovement : GameStateListener
	{
		private Unit unit;

		private bool onBattle;

		private List<Rigidbody> fists;

		private float orbitSpeed;

		private float angleHorizontal;

		private float angleVertical;

		private float orbitRadius;

		private Vector3 orbitOffsetDirection;

		private float randomizationTimer;

		public float flightForce;

		private float randomizationTimerCooldown;

		private float rotationSpeed;

		private float orbitMin;

		private float orbitMax;

		private float maxVelocity = 100f;

		public GameObject trailObject;

		public Material redMaterial;

		public Material blueMaterial;

		public void Start()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			unit = ((Component)((Component)this).gameObject.transform.root).GetComponentInChildren<Unit>();
			((Component)unit).GetComponentInChildren<GravityHandler>().gravityData = new GravityData
			{
				gravity = 0f
			};
			Rigidbody[] allRigs = unit.data.allRigs.AllRigs;
			foreach (Rigidbody val in allRigs)
			{
				val.useGravity = false;
				ParticleSystemRenderer componentInChildren = Object.Instantiate<GameObject>(trailObject, val.position, Quaternion.identity, ((Component)val).transform).gameObject.GetComponentInChildren<ParticleSystemRenderer>();
				if ((int)unit.Team == 0)
				{
					((Renderer)componentInChildren).material = redMaterial;
					componentInChildren.trailMaterial = redMaterial;
				}
				else
				{
					((Renderer)componentInChildren).material = blueMaterial;
					componentInChildren.trailMaterial = blueMaterial;
				}
			}
			MeleeWeapon[] componentsInChildren = ((Component)unit).gameObject.GetComponentsInChildren<MeleeWeapon>();
			foreach (MeleeWeapon val2 in componentsInChildren)
			{
				fists.Add(((Component)val2).GetComponent<Rigidbody>());
			}
			allRigs = unit.data.allRigs.AllRigs;
			foreach (Rigidbody item in allRigs)
			{
				fists.Add(item);
			}
			orbitRadius = Random.Range(orbitMin, orbitMax);
			angleHorizontal = Random.Range(0f, 360f);
			angleVertical = Random.Range(-30f, 30f);
			orbitOffsetDirection = Random.onUnitSphere;
		}

		protected override void Awake()
		{
			((GameStateListener)this).Awake();
		}

		public override void OnEnterBattleState()
		{
			onBattle = true;
		}

		public override void OnEnterPlacementState()
		{
			onBattle = false;
		}

		public void Update()
		{
			if (Object.op_Implicit((Object)(object)unit) && Object.op_Implicit((Object)(object)unit.data) && onBattle && !unit.data.Dead && Object.op_Implicit((Object)(object)unit.data.targetData) && !unit.data.targetData.Dead && Object.op_Implicit((Object)(object)unit.data.targetData.unit))
			{
				Rigidbody[] allRigs = unit.data.allRigs.AllRigs;
				for (int i = 0; i < allRigs.Length; i++)
				{
					allRigs[i].useGravity = false;
				}
				UpdateOrbit();
				Flight(fists, unit.data.targetData.unit);
			}
		}

		private void UpdateOrbit()
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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)
			angleHorizontal += orbitSpeed * Time.deltaTime;
			angleVertical += orbitSpeed * 0.5f * Time.deltaTime;
			randomizationTimer += Time.deltaTime;
			if (randomizationTimer >= randomizationTimerCooldown)
			{
				orbitRadius = Mathf.Lerp(orbitRadius, Random.Range(orbitMin, orbitMax), 0.75f);
				orbitOffsetDirection = Vector3.Slerp(orbitOffsetDirection, Random.onUnitSphere, 0.3f);
				randomizationTimer = 0f;
			}
		}

		private void Flight(List<Rigidbody> rigidbodies, Unit target)
		{
			//IL_000c: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0045: 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_0062: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_0080: 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)
			Vector3 val = SetRotationPivot(target.data.mainRig.position, orbitRadius);
			foreach (Rigidbody rigidbody in rigidbodies)
			{
				Vector3 val2 = val - rigidbody.position;
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				rigidbody.AddForce(normalized * flightForce, (ForceMode)5);
				Quaternion val3 = Quaternion.LookRotation(target.data.mainRig.position - rigidbody.position);
				rigidbody.MoveRotation(Quaternion.Slerp(rigidbody.rotation, val3, Time.deltaTime * rotationSpeed));
			}
		}

		public Vector3 SetRotationPivot(Vector3 targetPosition, float radius)
		{
			//IL_004f: 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_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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			float num = angleHorizontal * ((float)Math.PI / 180f);
			float num2 = angleVertical * ((float)Math.PI / 180f);
			float num3 = radius * Mathf.Cos(num2) * Mathf.Cos(num);
			float num4 = radius * Mathf.Sin(num2);
			float num5 = radius * Mathf.Cos(num2) * Mathf.Sin(num);
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(num3, num4, num5);
			return targetPosition + Quaternion.LookRotation(orbitOffsetDirection) * val;
		}

		public DynamicFlightMovement()
		{
			randomizationTimerCooldown = 2f;
			rotationSpeed = 25f;
			orbitMax = 15f;
			flightForce = 250f;
			fists = new List<Rigidbody>();
			orbitSpeed = 700f;
		}

		private void FixedUpdate()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			Rigidbody[] allRigs = unit.data.allRigs.AllRigs;
			foreach (Rigidbody val in allRigs)
			{
				Vector3 velocity = val.velocity;
				if (((Vector3)(ref velocity)).magnitude > maxVelocity)
				{
					velocity = val.velocity;
					val.velocity = ((Vector3)(ref velocity)).normalized * maxVelocity;
				}
			}
		}
	}
	public class OmniKnockbackEffect : CollisionWeaponEffect
	{
		private float force;

		private Unit holder;

		private Unit target;

		private Rigidbody rigidbody;

		private void Start()
		{
			holder = ((Component)((Component)this).transform.root).GetComponentInParent<Unit>();
			rigidbody = ((Component)this).GetComponentInChildren<Rigidbody>();
		}

		public override void DoEffect(Transform hitTransform, Collision collision)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_0070: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			target = ((Component)collision.transform).GetComponentInParent<Unit>();
			if (Object.op_Implicit((Object)(object)target) && Object.op_Implicit((Object)(object)holder))
			{
				Rigidbody[] allRigs = target.data.allRigs.AllRigs;
				foreach (Rigidbody obj in allRigs)
				{
					Vector3 val = obj.position - holder.data.mainRig.position;
					Vector3 normalized = ((Vector3)(ref val)).normalized;
					obj.AddForce(normalized * force, (ForceMode)5);
				}
			}
		}

		public OmniKnockbackEffect()
		{
			force = 4000f;
		}
	}
	public class AirborneUppercutMovement : MonoBehaviour
	{
		private Unit unit;

		private float counter;

		private float force;

		public float cooldown;

		public float range;

		public GameObject explosion;

		public void Start()
		{
			unit = ((Component)((Component)this).transform.root).GetComponentInChildren<Unit>();
			counter = cooldown;
		}

		public void DoMovement(Unit target)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: 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_00ce: Expected O, but got Unknown
			Vector3 position = target.data.mainRig.position;
			Rigidbody[] allRigs = unit.data.allRigs.AllRigs;
			for (int i = 0; i < allRigs.Length; i++)
			{
				allRigs[i].position = position;
			}
			Rigidbody[] allRigs2 = target.data.allRigs.AllRigs;
			for (int j = 0; j < allRigs2.Length; j++)
			{
				allRigs2[j].AddForce(Vector3.up * force, (ForceMode)5);
			}
			GameObject obj = Object.Instantiate<GameObject>(explosion, unit.data.mainRig.position, Quaternion.identity, (Transform)null);
			TeamHolder val = new TeamHolder
			{
				spawner = ((Component)unit).gameObject,
				team = unit.Team
			};
			TeamHolder.AddTeamHolder(obj, unit, val);
		}

		public void Update()
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			counter += Time.deltaTime;
			if (counter >= cooldown && Object.op_Implicit((Object)(object)unit) && Object.op_Implicit((Object)(object)unit.data) && Object.op_Implicit((Object)(object)unit.data.targetData) && Object.op_Implicit((Object)(object)unit.data.targetData.unit))
			{
				Unit val = unit.data.targetData.unit;
				if (Vector3.Distance(val.data.mainRig.position, unit.data.mainRig.position) <= range)
				{
					counter = 0f;
					DoMovement(val);
				}
			}
		}

		public AirborneUppercutMovement()
		{
			force = 13000f;
			cooldown = 2f;
			range = 12f;
		}
	}
	public class KnockoutPunchMovement : MonoBehaviour
	{
		private Unit unit;

		private float counter;

		private float force;

		public float cooldown;

		public float range;

		public GameObject explosion;

		public void Start()
		{
			unit = ((Component)((Component)this).transform.root).GetComponentInChildren<Unit>();
		}

		public void DoMovement(Unit target)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_008b: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_00f9: Expected O, but got Unknown
			Vector3 position = target.data.mainRig.position;
			Rigidbody[] allRigs = unit.data.allRigs.AllRigs;
			for (int i = 0; i < allRigs.Length; i++)
			{
				allRigs[i].position = position;
			}
			Rigidbody[] allRigs2 = target.data.allRigs.AllRigs;
			for (int j = 0; j < allRigs2.Length; j++)
			{
				Vector3 val = allRigs2[j].position - unit.data.mainRig.position;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				allRigs2[j].AddForce(normalized * force, (ForceMode)5);
			}
			GameObject obj = Object.Instantiate<GameObject>(explosion, unit.data.mainRig.position, Quaternion.identity, (Transform)null);
			TeamHolder val2 = new TeamHolder
			{
				spawner = ((Component)unit).gameObject,
				team = unit.Team
			};
			TeamHolder.AddTeamHolder(obj, unit, val2);
		}

		public void Update()
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			counter += Time.deltaTime;
			if (counter >= cooldown && Object.op_Implicit((Object)(object)unit) && Object.op_Implicit((Object)(object)unit.data) && Object.op_Implicit((Object)(object)unit.data.targetData) && Object.op_Implicit((Object)(object)unit.data.targetData.unit))
			{
				Unit val = unit.data.targetData.unit;
				if (Vector3.Distance(val.data.mainRig.position, unit.data.mainRig.position) <= range)
				{
					counter = 0f;
					DoMovement(val);
				}
			}
		}

		public KnockoutPunchMovement()
		{
			force = 8000f;
			cooldown = 0.5f;
			range = 12f;
		}
	}
	public class GreenStrychnineEffect : MonoBehaviour
	{
		public float duration = 5f;

		private Unit unit;

		private void Start()
		{
			unit = ((Component)((Component)this).transform.root).GetComponentInChildren<Unit>();
			((MonoBehaviour)this).StartCoroutine(SlowDownAllRigidbodies());
		}

		private IEnumerator SlowDownAllRigidbodies()
		{
			Rigidbody[] rigidbodies = unit.data.allRigs.AllRigs;
			float elapsedTime = 0f;
			Vector3[] originalVelocities = (Vector3[])(object)new Vector3[rigidbodies.Length];
			for (int i = 0; i < rigidbodies.Length; i++)
			{
				originalVelocities[i] = rigidbodies[i].velocity;
			}
			while (elapsedTime < duration)
			{
				elapsedTime += Time.deltaTime;
				float num = elapsedTime / duration;
				float num2 = 1f - Mathf.Pow(1f - num, 3f);
				for (int j = 0; j < rigidbodies.Length; j++)
				{
					if ((Object)(object)rigidbodies[j] != (Object)null)
					{
						Vector3 val = Vector3.Lerp(originalVelocities[j], Vector3.zero, num2);
						rigidbodies[j].velocity = new Vector3(val.x, rigidbodies[j].velocity.y, val.z);
					}
				}
				yield return null;
			}
			for (int k = 0; k < rigidbodies.Length; k++)
			{
				if ((Object)(object)rigidbodies[k] != (Object)null)
				{
					rigidbodies[k].velocity = new Vector3(0f, rigidbodies[k].velocity.y, 0f);
				}
			}
		}
	}
	public class OnDeathFadeAway : MonoBehaviour
	{
		private Unit unit;

		public GameObject particleObject;

		public void Start()
		{
			unit = ((Component)((Component)this).gameObject.transform.root).GetComponentInChildren<Unit>();
			unit.data.healthHandler.AddDieAction((Action)Execute);
		}

		private void Execute()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			Rigidbody[] allRigs = unit.data.allRigs.AllRigs;
			foreach (Rigidbody val in allRigs)
			{
				Object.Instantiate<GameObject>(particleObject, val.position, Quaternion.identity, (Transform)null);
			}
			Object.Destroy((Object)(object)((Component)unit).gameObject);
		}
	}
	public class DestroyIfUnitNull : MonoBehaviour
	{
		public Unit unit;

		public void Update()
		{
			if (!Object.op_Implicit((Object)(object)unit))
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class UnitInstaSpawner : MonoBehaviour
	{
		private Unit rootUnit;

		public UnitBlueprint unitBlueprint;

		public int amountToSpawn = 1;

		private TeamHolder teamHolder;

		private void Start()
		{
			teamHolder = ((Component)this).GetComponentInParent<TeamHolder>();
			rootUnit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
			for (int i = 0; i < amountToSpawn; i++)
			{
				Spawn();
			}
		}

		public void Spawn()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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)
			if (Object.op_Implicit((Object)(object)rootUnit))
			{
				try
				{
					Unit val = default(Unit);
					unitBlueprint.Spawn(rootUnit.data.mainRig.position, ((Component)this).transform.rotation, rootUnit.data.team, ref val, 1f, false, true, 0, (UnitPoolInfo?)null);
					((Component)val).gameObject.AddComponent<DestroyIfUnitNull>().unit = rootUnit;
				}
				catch (Exception ex)
				{
					Debug.Log((object)ex);
				}
			}
		}
	}
	public class ChainsawShake : MonoBehaviour
	{
		public Rigidbody rb;

		public float shakeIntensity = 100f;

		public float torqueIntensity = 100f;

		public float shakeFrequency = 0.05f;

		private float nextShakeTime;

		private void Start()
		{
			if ((Object)(object)rb == (Object)null)
			{
				rb = ((Component)this).GetComponent<Rigidbody>();
			}
		}

		private void FixedUpdate()
		{
			if (Time.time >= nextShakeTime)
			{
				ApplyShake();
				nextShakeTime = Time.time + shakeFrequency;
			}
		}

		private void ApplyShake()
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(Random.Range(0f - shakeIntensity, shakeIntensity), Random.Range(0f - shakeIntensity, shakeIntensity), Random.Range(0f - shakeIntensity, shakeIntensity));
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(Random