Decompiled source of Middle Earth Ring v1.0.2

MiddleEarthRing.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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 CustomClasses;
using DM;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.AI.Components.Modifiers;
using Landfall.TABS.AI.Systems;
using Landfall.TABS.UnitEditor;
using Landfall.TABS.Workshop;
using SLMA;
using Unity.Entities;
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("MiddleEarthRing")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("GeeztJeez")]
[assembly: AssemblyProduct("MiddleEarthRing")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[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.2.0")]
[module: UnverifiableCode]
namespace MiddleEarthRing
{
	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 void SetTag(GameObject item, string categoryName = "Middle Earth Ring", 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
								}
							};
						}
						else
						{
							Debug.LogError((object)(((Object)item).name + "doesn't contain CharacterItem!"));
						}
					}
					catch (Exception ex)
					{
						Debug.LogError((object)ex);
					}
				}
			}

			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 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 AudioClip LoadBundleAudioClip(string name)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				return (AudioClip)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
				return (Material)bundle.LoadAsset(name);
			}

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

			public static Faction SetFactionHidden(Faction faction)
			{
				s.SetField<Faction>(faction, "m_isSecret", (object)true);
				s.SetField<Faction>(faction, "m_lockSecrets", (object)true);
				return faction;
			}
		}

		public static string comment;

		public static AssetBundle bundle;

		public static void Init(LandfallContentDatabase db)
		{
			//IL_0053: 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_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Expected O, but got Unknown
			//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cc: Expected O, but got Unknown
			LoadBundle("middleearthringbundle");
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Customizing Faction";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Faction val = SLMATool.CreateFaction("Immortal Warlords", (UnitBlueprint[])null, Utility.LoadBundleTextureToSprite("Nordic_warlord"), 12435343);
			val.m_FactionColor = new Color(0.1f, 0.1f, 0.1f);
			s.SetField<Faction>(val, "m_isSecret", (object)true);
			s.SetField<Faction>(val, "m_lockSecrets", (object)true);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Units";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "--------- Main Units ----------";
			SLMATool.CreateUnit("Ancient Warrior", (UnitBlueprint)null, val, Utility.LoadBundleTextureToSprite("Ancient_Sword_Shield_Soldier"));
			SLMATool.CreateUnit("Ancient Archer", (UnitBlueprint)null, val, Utility.LoadBundleTextureToSprite("Ancient_Archers"));
			SLMATool.CreateUnit("Stone Man", (UnitBlueprint)null, val, Utility.LoadBundleTextureToSprite("Golem"));
			SLMATool.CreateUnit("Semi-Undead Blacksmith", (UnitBlueprint)null, val, Utility.LoadBundleTextureToSprite("Half-Revenant_Smith"));
			SLMATool.CreateUnit("Half-Undead Warrior", (UnitBlueprint)null, val, Utility.LoadBundleTextureToSprite("Half-Revenant_Warrior"));
			SLMATool.CreateUnit("Warlord Necromancer", (UnitBlueprint)null, val, Utility.LoadBundleTextureToSprite("Necromancer"));
			SLMATool.CreateUnit("Warlord Commander", (UnitBlueprint)null, val, Utility.LoadBundleTextureToSprite("Warlord_Monitor"));
			comment = "--------- Secret Units ----------";
			SLMATool.AddUnitToFaction(SLMATool.CreateUnit("Black Swordsman", (UnitBlueprint)null, (Faction)null, Utility.LoadBundleTextureToSprite("icon_guts")), Utility.SetFactionHidden((Faction)SLMALoader.SDic["factions"]["FantasyEvil"]), 8);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Weapons";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Thrown_Soulfire", Utility.LoadBundleGameObject("Thrown_Soulfire"), true, (HideFlags)52, (Sprite)null, 62342432, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("UndeadWarhammer", Utility.LoadBundleGameObject("UndeadWarhammer"), true, (HideFlags)52, (Sprite)null, 124512442, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("ChoppedSteelSlasherSword", Utility.LoadBundleGameObject("ChoppedSteelSlasherSword"), true, (HideFlags)52, (Sprite)null, 52894398, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("FirefistPunch", Utility.LoadBundleGameObject("FirefistPunch"), true, (HideFlags)52, (Sprite)null, 32532412, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("IronworkerHammer", Utility.LoadBundleGameObject("IronworkerHammer"), true, (HideFlags)52, (Sprite)null, 325431342, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("UndeadBook", Utility.LoadBundleGameObject("UndeadBook"), true, (HideFlags)52, (Sprite)null, 67345352, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("UndeadStaff", Utility.LoadBundleGameObject("UndeadStaff"), true, (HideFlags)52, (Sprite)null, 235236234, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("SimpleHeavyAxe", Utility.LoadBundleGameObject("SimpleHeavyAxe"), true, (HideFlags)52, (Sprite)null, 7345234, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("AncientArcherBow", Utility.LoadBundleGameObject("AncientArcherBow"), true, (HideFlags)52, (Sprite)null, 34243452, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("AncientWarriorShield", Utility.LoadBundleGameObject("AncientWarriorShield"), true, (HideFlags)52, (Sprite)null, 7545234, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("AncientWarriorSword", Utility.LoadBundleGameObject("AncientWarriorSword"), true, (HideFlags)52, (Sprite)null, 64234323, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("GutsDragonslayer", Utility.LoadBundleGameObject("GutsDragonslayer"), true, (HideFlags)52, (Sprite)null, 63443234, true), "Middle Earth Ring", (TagType)0);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Abilities";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_BackpoofDodge", Utility.LoadBundleGameObject("Move_BackpoofDodge"), true, (HideFlags)52, (Sprite)null, 5324122, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_HellfireAppraisal", Utility.LoadBundleGameObject("Move_HellfireAppraisal"), true, (HideFlags)52, (Sprite)null, 5234343, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_SummonReinforcement", Utility.LoadBundleGameObject("Move_SummonReinforcement"), true, (HideFlags)52, (Sprite)null, 62344323, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_GrapplingCharge", Utility.LoadBundleGameObject("Move_GrapplingCharge"), true, (HideFlags)52, (Sprite)null, 2145312, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_GolemCarve", Utility.LoadBundleGameObject("Move_GolemCarve"), true, (HideFlags)52, (Sprite)null, 32523324, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_HardenedBodyPassive", Utility.LoadBundleGameObject("Move_HardenedBodyPassive"), true, (HideFlags)52, (Sprite)null, 23524234, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_SoulsAttackCommand", Utility.LoadBundleGameObject("Move_SoulsAttackCommand"), true, (HideFlags)52, (Sprite)null, 62431256, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_HardRockPassive", Utility.LoadBundleGameObject("Move_HardRockPassive"), true, (HideFlags)52, (Sprite)null, 23451231, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_StrugglerPassive", Utility.LoadBundleGameObject("Move_StrugglerPassive"), true, (HideFlags)52, (Sprite)null, 23423423, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_BattlefieldExperience", (GameObject)SLMALoader.SDic["moves"]["Head_up"], true, (HideFlags)52, (Sprite)null, 53242213, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_JumpSlam", Utility.LoadBundleGameObject("Move_JumpSlam"), true, (HideFlags)52, (Sprite)null, 643534213, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_StrongParry", Utility.LoadBundleGameObject("Move_StrongParry"), true, (HideFlags)52, (Sprite)null, 53243221, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_BigSlash", Utility.LoadBundleGameObject("Move_BigSlash"), true, (HideFlags)52, (Sprite)null, 513213213, true), "Middle Earth Ring", (TagType)0);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Unit Bases";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Humanoid_Undead_Buff", Utility.LoadBundleGameObject("Humanoid_Undead_Buff"), true, (HideFlags)52, (Sprite)null, 235236324, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("HumanoidRottenBase", Utility.LoadBundleGameObject("HumanoidRottenBase"), true, (HideFlags)52, (Sprite)null, 5234233, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("StoneMan_UnitBase", Utility.LoadBundleGameObject("StoneMan_UnitBase"), true, (HideFlags)52, (Sprite)null, 9052831, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("AncientArcherBase", Utility.LoadBundleGameObject("AncientArcherBase"), true, (HideFlags)52, (Sprite)null, 2342412, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Humanoid_Buff", Utility.LoadBundleGameObject("Humanoid_Buff"), true, (HideFlags)52, (Sprite)null, 32432123, true), "Middle Earth Ring", (TagType)0);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Clothing";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("SpawnEyes_HalfUndead", Utility.LoadBundleGameObject("SpawnEyes_HalfUndead"), true, (HideFlags)52, (Sprite)null, 1245213, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("WarBossArmor", Utility.LoadBundleGameObject("WarBossArmor"), true, (HideFlags)52, (Sprite)null, 8353523, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("HalfUndeadWarriorArmor", Utility.LoadBundleGameObject("HalfUndeadWarriorArmor"), true, (HideFlags)52, (Sprite)null, 14689129, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("HalfUndeadBlacksmithArmor", Utility.LoadBundleGameObject("HalfUndeadBlacksmithArmor"), true, (HideFlags)52, (Sprite)null, 52324234, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("UndeadMageRobe", Utility.LoadBundleGameObject("UndeadMageRobe"), true, (HideFlags)52, (Sprite)null, 623422143, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("StoneManClothes", Utility.LoadBundleGameObject("StoneManClothes"), true, (HideFlags)52, (Sprite)null, 324123541, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("GutsArmor", Utility.LoadBundleGameObject("GutsArmor"), true, (HideFlags)52, (Sprite)null, 5312323, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("AncientCalfArmor", Utility.LoadBundleGameObject("AncientCalfArmor"), true, (HideFlags)52, (Sprite)null, 75532122, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("AncientMetalHandguard", Utility.LoadBundleGameObject("AncientMetalHandguard"), true, (HideFlags)52, (Sprite)null, 63241231, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("AncientArmletHandarmor", Utility.LoadBundleGameObject("AncientArmletHandarmor"), true, (HideFlags)52, (Sprite)null, 12462131, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("BrokenAncientShoulderArmor", Utility.LoadBundleGameObject("BrokenAncientShoulderArmor"), true, (HideFlags)52, (Sprite)null, 5632412, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("AncientShoulderArmor", Utility.LoadBundleGameObject("AncientShoulderArmor"), true, (HideFlags)52, (Sprite)null, 346234, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("AncientShoulderMetalArmor", Utility.LoadBundleGameObject("AncientShoulderMetalArmor"), true, (HideFlags)52, (Sprite)null, 24315123, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("AncientArcherQuiver", Utility.LoadBundleGameObject("AncientArcherQuiver"), true, (HideFlags)52, (Sprite)null, 532612312, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("AncientArcherSuit", Utility.LoadBundleGameObject("AncientArcherSuit"), true, (HideFlags)52, (Sprite)null, 234532412, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("AncientEyes", Utility.LoadBundleGameObject("AncientEyes"), true, (HideFlags)52, (Sprite)null, 2343253, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("AncientWarriorSuit", Utility.LoadBundleGameObject("AncientWarriorSuit"), true, (HideFlags)52, (Sprite)null, 8345342, true), "Middle Earth Ring", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("SpawnEyes_Guts", Utility.LoadBundleGameObject("SpawnEyes_Guts"), true, (HideFlags)52, (Sprite)null, 64352343, true), "Middle Earth Ring", (TagType)0);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Projectiles";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			UPool.MyPool.AddObject("P_Soulfire", Utility.LoadBundleGameObject("P_Soulfire"), true, (HideFlags)52, (Sprite)null, 513213242, true);
			UPool.MyPool.AddObject("P_AncientBow", Utility.LoadBundleGameObject("P_AncientBow"), true, (HideFlags)52, (Sprite)null, 635234423, true);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Effect";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			UPool.MyPool.AddObject("Eff_SoulsfireChange", Utility.LoadBundleGameObject("Eff_SoulsfireChange"), true, (HideFlags)52, (Sprite)null, 0, true);
			UPool.MyPool.AddObject("Eff_FieryEmbers", Utility.LoadBundleGameObject("Eff_FieryEmbers"), true, (HideFlags)52, (Sprite)null, 0, true);
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			comment = "Custom Explosions";
			comment = "----------------------------------------------------------------------------------------------------------------------------";
			UPool.MyPool.AddObject("Exp_ReinforcementPoof", Utility.LoadBundleGameObject("Exp_ReinforcementPoof"), true, (HideFlags)52, (Sprite)null, 0, true);
			UPool.MyPool.AddObject("Exp_HellfireAppraisal", Utility.LoadBundleGameObject("Exp_HellfireAppraisal"), true, (HideFlags)52, (Sprite)null, 0, true);
			UPool.MyPool.AddObject("Exp_SoulsfireChange", Utility.LoadBundleGameObject("Exp_SoulsfireChange"), true, (HideFlags)52, (Sprite)null, 0, true);
			UPool.MyPool.AddObject("E_StoneManCarve", Utility.LoadBundleGameObject("E_StoneManCarve"), true, (HideFlags)52, (Sprite)null, 0, true);
			UPool.MyPool.AddObject("E_NecromancerPoof", Utility.LoadBundleGameObject("E_NecromancerPoof"), true, (HideFlags)52, (Sprite)null, 0, true);
		}

		public static void SetBlueprint(UnitBlueprint unit, LandfallContentDatabase db)
		{
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Expected O, but got Unknown
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Expected O, but got Unknown
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Expected O, but got Unknown
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Expected O, but got Unknown
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Expected O, but got Unknown
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Expected O, but got Unknown
			//IL_0684: Unknown result type (might be due to invalid IL or missing references)
			//IL_068a: Expected O, but got Unknown
			//IL_079e: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0800: Expected O, but got Unknown
			//IL_081b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0821: Expected O, but got Unknown
			//IL_083c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0842: Expected O, but got Unknown
			//IL_09ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c0: Expected O, but got Unknown
			//IL_0b17: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0baa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb0: Expected O, but got Unknown
			//IL_0bcb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd1: Expected O, but got Unknown
			//IL_0bec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf2: Expected O, but got Unknown
			//IL_0c0d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c13: Expected O, but got Unknown
			//IL_0c2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c35: Expected O, but got Unknown
			//IL_0c51: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c57: Expected O, but got Unknown
			if (unit.Entity.Name == "Ancient Warrior")
			{
				SLMATool.UnitCost(unit, 200);
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Ancient Attack Vocals/Hoplite");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Ancient Death Vocals/Hoplite");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Medium");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.75f);
				unit.health = 200f;
				unit.maxSizeRandom = 1f;
				unit.minSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.massMultiplier = 5f;
				unit.LeftWeapon = UPool.MyPool.GetObject("AncientWarriorShield");
				unit.RightWeapon = UPool.MyPool.GetObject("AncientWarriorSword");
				unit.m_props = (GameObject[])(object)new GameObject[2]
				{
					UPool.MyPool.GetObject("AncientEyes"),
					UPool.MyPool.GetObject("AncientWarriorSuit")
				};
			}
			if (unit.Entity.Name == "Ancient Archer")
			{
				SLMATool.UnitCost(unit, 240);
				unit.UnitBase = UPool.MyPool.GetObject("AncientArcherBase");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Halloween Attack Vocals/SkeletonArcher");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Halloween Death Vocals/SkeletonArcher");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Skeleton");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.75f);
				unit.health = 100f;
				unit.maxSizeRandom = 1f;
				unit.minSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.massMultiplier = 5f;
				unit.holdinigWithTwoHands = true;
				unit.leftProjectile = UPool.MyPool.GetObject("P_AncientBow").GetComponentInChildren<ProjectileEntity>();
				unit.RightWeapon = UPool.MyPool.GetObject("AncientArcherBow");
				unit.m_props = (GameObject[])(object)new GameObject[8]
				{
					UPool.MyPool.GetObject("AncientCalfArmor"),
					UPool.MyPool.GetObject("AncientMetalHandguard"),
					UPool.MyPool.GetObject("AncientArmletHandarmor"),
					UPool.MyPool.GetObject("BrokenAncientShoulderArmor"),
					UPool.MyPool.GetObject("AncientShoulderArmor"),
					UPool.MyPool.GetObject("AncientShoulderMetalArmor"),
					UPool.MyPool.GetObject("AncientArcherQuiver"),
					UPool.MyPool.GetObject("AncientArcherSuit")
				};
				unit.m_propData = (PropItemData[])(object)new PropItemData[6]
				{
					new PropItemData
					{
						m_equip = (EquipType)1
					},
					new PropItemData
					{
						m_equip = (EquipType)1
					},
					new PropItemData
					{
						m_equip = (EquipType)2
					},
					new PropItemData
					{
						m_equip = (EquipType)1
					},
					new PropItemData
					{
						m_equip = (EquipType)2
					},
					new PropItemData
					{
						m_equip = (EquipType)2
					}
				};
			}
			if (unit.Entity.Name == "Stone Man")
			{
				SLMATool.UnitCost(unit, 500);
				unit.UnitBase = UPool.MyPool.GetObject("StoneMan_UnitBase");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Effects/TombStoneImpact");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Effects/TombStonePush");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Minotaur");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.8f);
				unit.health = 400f;
				unit.maxSizeRandom = 1f;
				unit.minSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.massMultiplier = 20f;
				unit.movementSpeedMuiltiplier = 0.8f;
				unit.holdinigWithTwoHands = true;
				unit.RightWeapon = UPool.MyPool.GetObject("SimpleHeavyAxe");
				unit.m_props = (GameObject[])(object)new GameObject[1] { UPool.MyPool.GetObject("StoneManClothes") };
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { UPool.MyPool.GetObject("Move_HardRockPassive") };
			}
			if (unit.Entity.Name == "Warlord Necromancer")
			{
				SLMATool.UnitCost(unit, 1000);
				unit.UnitBase = UPool.MyPool.GetObject("HumanoidRottenBase");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Medieval Attack Vocals/Priest");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Medieval Death Vocals/Priest");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Medium");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.55f);
				unit.health = 400f;
				unit.maxSizeRandom = 1f;
				unit.minSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.massMultiplier = 3f;
				unit.holdinigWithTwoHands = false;
				unit.LeftWeapon = UPool.MyPool.GetObject("UndeadStaff");
				unit.RightWeapon = UPool.MyPool.GetObject("UndeadBook");
				unit.m_props = (GameObject[])(object)new GameObject[1] { UPool.MyPool.GetObject("UndeadMageRobe") };
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { UPool.MyPool.GetObject("Move_SoulsAttackCommand") };
			}
			if (unit.Entity.Name == "Semi-Undead Blacksmith")
			{
				SLMATool.UnitCost(unit, 800);
				unit.UnitBase = UPool.MyPool.GetObject("Humanoid_Undead_Buff");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Viking Attack Vocals/Brawler");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Viking Death Vocals/Brawler");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Big");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.6f);
				unit.health = 700f;
				unit.maxSizeRandom = 1f;
				unit.minSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.massMultiplier = 10f;
				unit.holdinigWithTwoHands = false;
				unit.LeftWeapon = UPool.MyPool.GetObject("FirefistPunch");
				unit.RightWeapon = UPool.MyPool.GetObject("IronworkerHammer");
				unit.m_props = (GameObject[])(object)new GameObject[1] { UPool.MyPool.GetObject("HalfUndeadBlacksmithArmor") };
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[3]
				{
					UPool.MyPool.GetObject("Move_GolemCarve"),
					UPool.MyPool.GetObject("Move_HardenedBodyPassive"),
					(GameObject)SLMALoader.SDic["moves"]["Dodge"]
				};
			}
			if (unit.Entity.Name == "Half-Undead Warrior")
			{
				SLMATool.UnitCost(unit, 1000);
				unit.UnitBase = UPool.MyPool.GetObject("Humanoid_Undead_Buff");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Viking Attack Vocals/Brawler");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Viking Death Vocals/Brawler");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Big");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.6f);
				unit.health = 700f;
				unit.maxSizeRandom = 1f;
				unit.minSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.massMultiplier = 10f;
				unit.holdinigWithTwoHands = true;
				unit.RightWeapon = UPool.MyPool.GetObject("ChoppedSteelSlasherSword");
				unit.m_props = (GameObject[])(object)new GameObject[2]
				{
					UPool.MyPool.GetObject("SpawnEyes_HalfUndead"),
					UPool.MyPool.GetObject("HalfUndeadWarriorArmor")
				};
				unit.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(NeverStopRunning) };
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[5]
				{
					UPool.MyPool.GetObject("Move_GrapplingCharge"),
					UPool.MyPool.GetObject("Move_HardenedBodyPassive"),
					(GameObject)SLMALoader.SDic["moves"]["SwordArtParry"],
					(GameObject)SLMALoader.SDic["moves"]["Boxer_Dodge"],
					(GameObject)SLMALoader.SDic["moves"]["Dodge"]
				};
			}
			if (unit.Entity.Name == "Warlord Commander")
			{
				SLMATool.UnitCost(unit, 1600);
				unit.UnitBase = UPool.MyPool.GetObject("Humanoid_Buff");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Viking Attack Vocals/Brawler");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Viking Death Vocals/Brawler");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Big");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.6f);
				unit.health = 1500f;
				unit.maxSizeRandom = 1f;
				unit.minSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.massMultiplier = 200f;
				unit.holdinigWithTwoHands = false;
				unit.LeftWeapon = UPool.MyPool.GetObject("UndeadWarhammer");
				unit.RightWeapon = UPool.MyPool.GetObject("Thrown_Soulfire");
				unit.m_props = (GameObject[])(object)new GameObject[1] { UPool.MyPool.GetObject("WarBossArmor") };
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[5]
				{
					UPool.MyPool.GetObject("Move_HellfireAppraisal"),
					UPool.MyPool.GetObject("Move_BackpoofDodge"),
					UPool.MyPool.GetObject("Move_SummonReinforcement"),
					UPool.MyPool.GetObject("Move_HardenedBodyPassive"),
					(GameObject)SLMALoader.SDic["moves"]["Dodge"]
				};
			}
			if (unit.Entity.Name == "Black Swordsman")
			{
				SLMATool.UnitCost(unit, 6000);
				unit.Entity.SetUnlockKey("SECRET_GUTSBERSERK");
				unit.UnitBase = UPool.MyPool.GetObject("Humanoid_Buff");
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)"Viking Attack Vocals/Jarl");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)"Viking Death Vocals/Jarl");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Big");
				s.SetField<UnitBlueprint>(unit, "VoicePitch", (object)0.65f);
				unit.health = 3000f;
				unit.maxSizeRandom = 1f;
				unit.minSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.stepMultiplier = 2f;
				unit.massMultiplier = 30f;
				unit.balanceMultiplier = 100f;
				unit.animationMultiplier = 2f;
				unit.removeCloseRangeMiss = true;
				unit.movementSpeedMuiltiplier = 1.25f;
				unit.holdinigWithTwoHands = true;
				unit.RightWeapon = UPool.MyPool.GetObject("GutsDragonslayer");
				unit.m_props = (GameObject[])(object)new GameObject[2]
				{
					UPool.MyPool.GetObject("GutsArmor"),
					UPool.MyPool.GetObject("SpawnEyes_Guts")
				};
				unit.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(NeverStopRunning) };
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[11]
				{
					UPool.MyPool.GetObject("Move_StrugglerPassive"),
					UPool.MyPool.GetObject("Move_BattlefieldExperience"),
					UPool.MyPool.GetObject("Move_JumpSlam"),
					UPool.MyPool.GetObject("Move_StrongParry"),
					UPool.MyPool.GetObject("Move_BigSlash"),
					(GameObject)SLMALoader.SDic["moves"]["Small_Hover"],
					(GameObject)SLMALoader.SDic["moves"]["MinotaurCharge"],
					(GameObject)SLMALoader.SDic["moves"]["Jump_BerserkerShort"],
					(GameObject)SLMALoader.SDic["moves"]["Shogun_Dodge"],
					(GameObject)SLMALoader.SDic["moves"]["Boxer_Dodge"],
					(GameObject)SLMALoader.SDic["moves"]["Dodge"]
				};
			}
		}

		public static void SetEffects(GameObject effect)
		{
		}

		public static void SetExplosion(GameObject explosion)
		{
		}

		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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)((Component)unit).gameObject).name == ((Object)UPool.MyPool.GetObject("HumanoidRottenBase")).name)
			{
				Transform transform = ((Component)unit).transform;
				transform.localScale *= 1.1f;
				AncientArcherDeathEvent ancientArcherDeathEvent = ((Component)unit).gameObject.AddComponent<AncientArcherDeathEvent>();
				ancientArcherDeathEvent.skull = Utility.LoadBundleGameObject("AncientSkullVFX");
				ancientArcherDeathEvent.bones = Utility.LoadBundleGameObject("AncientSkullVFX");
				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("AncientArcherBase")).name)
			{
				Transform transform2 = ((Component)unit).transform;
				transform2.localScale *= 1.25f;
				AncientArcherDeathEvent ancientArcherDeathEvent2 = ((Component)unit).gameObject.AddComponent<AncientArcherDeathEvent>();
				ancientArcherDeathEvent2.skull = Utility.LoadBundleGameObject("AncientSkullVFX");
				ancientArcherDeathEvent2.bones = Utility.LoadBundleGameObject("AncientBonesVFX");
				SkinnedMeshRenderer[] componentsInChildren2 = ((Component)unit).GetComponentsInChildren<SkinnedMeshRenderer>();
				for (int j = 0; j < componentsInChildren2.Length; j++)
				{
					((Component)componentsInChildren2[j]).gameObject.tag = "UnitMesh";
				}
			}
			if (((Object)((Component)unit).gameObject).name == ((Object)UPool.MyPool.GetObject("StoneMan_UnitBase")).name)
			{
				Transform transform3 = ((Component)unit).transform;
				transform3.localScale *= 1.25f;
				((Component)unit).gameObject.AddComponent<StoneManBehaviour>().soundEffect = "Effects/TombStonePush";
				((Component)unit).GetComponentInChildren<RigidbodyHolder>().randomizeRigidbodySizes = false;
				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("Humanoid_Undead_Buff")).name)
			{
				Transform transform4 = ((Component)unit).transform;
				transform4.localScale *= 1.25f;
				unit.data.canFall = false;
				unit.data.cantFallForSeconds = float.PositiveInfinity;
				((Component)unit).GetComponentInChildren<RigidbodyHolder>().randomizeRigidbodySizes = false;
				((Component)unit).GetComponentInChildren<EyeSpawner>().randomizeEyes = 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("Humanoid_Buff")).name)
			{
				Transform transform5 = ((Component)unit).transform;
				transform5.localScale *= 1.25f;
				unit.data.canFall = false;
				unit.data.cantFallForSeconds = float.PositiveInfinity;
				unit.targetingPriorityMultiplier = 1.5f;
				((Component)unit).GetComponentInChildren<RigidbodyHolder>().randomizeRigidbodySizes = false;
				((Component)unit).GetComponentInChildren<EyeSpawner>().randomizeEyes = false;
				SkinnedMeshRenderer[] componentsInChildren5 = ((Component)unit).GetComponentsInChildren<SkinnedMeshRenderer>();
				for (int m = 0; m < componentsInChildren5.Length; m++)
				{
					((Component)componentsInChildren5[m]).gameObject.tag = "UnitMesh";
				}
			}
		}

		public static void SetWeapon(GameObject weapon, HandType hand, Team team, Unit unit, MeleeWeapon melee, RangeWeapon range, LandfallContentDatabase db)
		{
			if ((Object)(object)weapon == (Object)(object)UPool.MyPool.GetObject("UndeadBook"))
			{
				weapon.AddComponent<UndeadBookBehaviors>();
			}
		}

		public static void SetProjectile(GameObject proj, ProjectileHit projhit, LandfallContentDatabase db)
		{
		}

		public static void SetCombatMove(GameObject move, DodgeMove dodge, BlockMove block, SpawnObject spawn, Cost cost, Wings wings, ReaperWings reaper, LandfallContentDatabase db)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_SummonReinforcement"))
			{
				move.AddComponent<RandomUnitBlueprintSpawner>().unitBlueprints = (UnitBlueprint[])(object)new UnitBlueprint[2]
				{
					(UnitBlueprint)SLMATool.SLMADic["Semi-Undead Blacksmith"],
					(UnitBlueprint)SLMATool.SLMADic["Half-Undead Warrior"]
				};
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_GolemCarve"))
			{
				move.GetComponentInChildren<UnitSpawner>().unitBlueprint = (UnitBlueprint)SLMATool.SLMADic["Stone Man"];
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_HardenedBodyPassive"))
			{
				move.AddComponent<HardenedBodyPassiveMovement>();
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_HardRockPassive"))
			{
				move.AddComponent<HardRockPassiveMovement>();
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_StrugglerPassive"))
			{
				move.AddComponent<StrugglerPassiveMovement>();
			}
			if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_BattlefieldExperience"))
			{
				move.AddComponent<BattlefieldAI>();
			}
		}

		public static void SetClothes(GameObject cloth, CharacterItem ci, Renderer render, MeshRenderer mesh, SkinnedMeshRenderer skinnedMesh, LandfallContentDatabase db)
		{
		}

		public static void SetAllGameObject(GameObject all, LandfallContentDatabase db)
		{
		}

		public static void LoadBundle(string assetBundleName)
		{
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(assetBundleName);
			bundle = AssetBundle.LoadFromStream(stream);
		}
	}
	[BepInPlugin("GeeztJeez.MiddleEarthRing", "MiddleEarthRing", "1.0.2")]
	internal class Loader : BaseUnityPlugin
	{
		public bool debug;

		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));
			yield return (object)new WaitForSeconds(0.01f);
			Debug.Log((object)"Loading MiddleEarthRing!");
			SLMALoader.GetInstance();
			LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
			UManager.Init(landfallContentDatabase);
			new Harmony("MiddleEarthRing").PatchAll();
			UnitBlueprint[] array = Resources.FindObjectsOfTypeAll<UnitBlueprint>();
			for (int i = 0; i < array.Length; i++)
			{
				if (debug)
				{
					Debug.Log((object)("Blueprint currently debugged : " + array[i].Entity.Name));
				}
				UManager.SetBlueprint(array[i], landfallContentDatabase);
				array[i].Validate();
			}
			GameObject[] array2 = Resources.FindObjectsOfTypeAll<GameObject>();
			for (int j = 0; j < array2.Length; j++)
			{
				if (debug)
				{
					Debug.Log((object)("Current Debugged Game Object : " + ((Object)array2[j]).name));
				}
				if (Object.op_Implicit((Object)(object)array2[j].GetComponent<Explosion>()))
				{
					if (debug)
					{
						Debug.Log((object)("Currently editing Explosion : " + ((Object)array2[j]).name));
					}
					UManager.SetExplosion(array2[j]);
				}
				if (Object.op_Implicit((Object)(object)array2[j].GetComponent<WeaponItem>()))
				{
					if (debug)
					{
						Debug.Log((object)("Currently editing Weapon : " + ((Object)array2[j]).name));
					}
					UManager.SetWeapon(array2[j], array2[j].GetComponent<HandType>(), array2[j].GetComponent<Team>(), array2[j].GetComponent<Unit>(), array2[j].GetComponent<MeleeWeapon>(), array2[j].GetComponent<RangeWeapon>(), landfallContentDatabase);
					if (Object.op_Implicit((Object)(object)array2[j].GetComponent<MeleeWeapon>()))
					{
						array2[j].GetComponentInChildren<MeleeWeapon>().Validate();
					}
					if (Object.op_Implicit((Object)(object)array2[j].GetComponent<RangeWeapon>()))
					{
						array2[j].GetComponentInChildren<RangeWeapon>().Validate();
					}
				}
				if (Object.op_Implicit((Object)(object)array2[j].GetComponent<ProjectileHit>()))
				{
					if (debug)
					{
						Debug.Log((object)("Currently editing Projectile : " + ((Object)array2[j]).name));
					}
					UManager.SetProjectile(array2[j], array2[j].GetComponent<ProjectileHit>(), landfallContentDatabase);
				}
				if (Object.op_Implicit((Object)(object)array2[j].GetComponent<PlaySoundEffect>()))
				{
					if (debug)
					{
						Debug.Log((object)("Currently editing Effect : " + ((Object)array2[j]).name));
					}
					UManager.SetEffects(array2[j]);
				}
				if (Object.op_Implicit((Object)(object)array2[j].GetComponent<Unit>()))
				{
					if (debug)
					{
						Debug.Log((object)("Currently editing Unit : " + ((Object)array2[j]).name));
					}
					UManager.SetUnits(array2[j].GetComponent<Unit>(), landfallContentDatabase);
				}
				if (Object.op_Implicit((Object)(object)array2[j].GetComponent<SpecialAbility>()))
				{
					if (debug)
					{
						Debug.Log((object)("Currently editing Movement : " + ((Object)array2[j]).name));
					}
					UManager.SetCombatMove(array2[j], array2[j].GetComponent<DodgeMove>(), array2[j].GetComponent<BlockMove>(), array2[j].GetComponentInChildren<SpawnObject>(), array2[j].GetComponent<Cost>(), array2[j].GetComponent<Wings>(), array2[j].GetComponent<ReaperWings>(), landfallContentDatabase);
				}
				if (Object.op_Implicit((Object)(object)array2[j].GetComponent<PropItem>()))
				{
					if (debug)
					{
						Debug.Log((object)("Currently editing Clothing : " + ((Object)array2[j]).name));
					}
					UManager.SetClothes(array2[j], array2[j].GetComponent<CharacterItem>(), array2[j].GetComponent<Renderer>(), array2[j].GetComponent<MeshRenderer>(), array2[j].GetComponent<SkinnedMeshRenderer>(), landfallContentDatabase);
				}
				if (Object.op_Implicit((Object)(object)array2[j].GetComponentInChildren<PlaySoundEffect>()))
				{
					if (debug)
					{
						Debug.Log((object)("Current Validated Sound Effect : " + ((Object)array2[j]).name));
					}
					PlaySoundEffect[] componentsInChildren = array2[j].GetComponentsInChildren<PlaySoundEffect>();
					for (int k = 0; k < componentsInChildren.Length; k++)
					{
						componentsInChildren[k].Validate();
					}
				}
				UManager.SetAllGameObject(array2[j], landfallContentDatabase);
			}
			ServiceLocator.GetService<CustomContentLoaderModIO>().QuickRefresh((WorkshopContentType)5, (Action)null);
			Debug.Log((object)"Successfully loaded MiddleEarthRing!");
			SceneManager.sceneLoaded += SceneLoaded;
		}

		public void SceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
		{
			if (((Scene)(ref scene)).name == "05_Sandbox_Medieval_VC")
			{
				Object.Instantiate<GameObject>(UManager.Utility.LoadBundleGameObject("GutsSecretProp"));
			}
		}
	}
}
namespace CustomClasses
{
	public class ChangeLRotationXYZ : MonoBehaviour
	{
		public float xscale;

		public float yscale;

		public float zscale;

		public void Start()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).gameObject.transform.localRotation = Quaternion.Euler(xscale, yscale, zscale);
		}
	}
	public class ChangePositionVector : MonoBehaviour
	{
		public float xscale;

		public float yscale;

		public float zscale;

		public void Start()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).gameObject.transform.localPosition = new Vector3(xscale, yscale, zscale);
		}
	}
	public class ClothApplyUnitCollider : MonoBehaviour
	{
		public Unit unit;

		public void Start()
		{
			unit = ((Component)((Component)this).gameObject.transform.root).GetComponentInChildren<Unit>();
			if (Object.op_Implicit((Object)(object)unit))
			{
				CapsuleCollider[] componentsInChildren = ((Component)unit).GetComponentsInChildren<CapsuleCollider>();
				Cloth[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<Cloth>();
				for (int i = 0; i < componentsInChildren2.Length; i++)
				{
					componentsInChildren2[i].capsuleColliders = componentsInChildren;
				}
			}
		}
	}
	public class DamageCollision : MonoBehaviour
	{
		public Unit unit;

		public float damage = 1000f;

		public float damageOffset = 1000f;

		public UnitEffectBase EffectPrefab;

		private float counter;

		private float timer = 0.1f;

		private void OnCollisionEnter(Collision collision)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Expected O, but got Unknown
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)collision.gameObject != (Object)null) || !(counter >= timer))
			{
				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))
			{
				return;
			}
			counter = 0f;
			ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect("Effects/DarkPeasantHandThrowImpact", 1f, collision.gameObject.transform.position, (MaterialType)0, (Transform)null, 0.75f);
			((Damagable)componentInChildren.data.healthHandler).TakeDamage(Random.Range(damage, damage + damageOffset), collision.gameObject.transform.position, unit, (DamageType)0);
			Rigidbody[] allRigs = componentInChildren.data.allRigs.AllRigs;
			for (int i = 0; i < allRigs.Length; i++)
			{
				ServiceLocator.GetService<ParticlePlayer>().PlayEffect(1, allRigs[i].position, Vector3.up, (SkinnedMeshRenderer)null);
			}
			if (!Object.op_Implicit((Object)(object)EffectPrefab))
			{
				return;
			}
			Type type = ((object)EffectPrefab).GetType();
			UnitEffectBase val = (UnitEffectBase)((Component)((Component)componentInChildren).transform).GetComponentInChildren(type);
			if ((Object)(object)val == (Object)null)
			{
				GameObject val2 = Object.Instantiate<GameObject>(((Component)EffectPrefab).gameObject, ((Component)componentInChildren).transform);
				val2.transform.position = componentInChildren.data.mainRig.position;
				if (Object.op_Implicit((Object)(object)val2.GetComponentInChildren<UnitEffectBase>()))
				{
					val2.GetComponentInChildren<UnitEffectBase>().Ping();
					val2.GetComponentInChildren<UnitEffectBase>().DoEffect();
				}
			}
			else
			{
				val.Ping();
			}
		}

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

		public void Update()
		{
			counter += Time.deltaTime;
		}
	}
	public class StrugglerPassiveMovement : MonoBehaviour
	{
		private Unit unit;

		private ConditionalEvent conditionalEvent;

		public void Start()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			unit = ((Component)((Component)this).gameObject.transform.root).GetComponentInChildren<Unit>();
			conditionalEvent = ((Component)this).gameObject.GetComponentInChildren<ConditionalEvent>();
			conditionalEvent.events[0].turnOnEvent.AddListener(new UnityAction(Buffs));
		}

		public void Buffs()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			unit.AddAttackSpeed(unit.attackSpeedMultiplier);
			ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect("Viking Attack Vocals/Jarl", 1f, unit.data.mainRig.position, (MaterialType)0, (Transform)null, 0.65f);
		}
	}
	public class BattlefieldAI : MonoBehaviour
	{
		private Vector3 lastKnownDamagePosition;

		private Unit unit;

		private DataHandler unitData;

		private TeamSystem teamSystem;

		private float originalWalkSpeed;

		private List<Unit> rangedFriends;

		private List<Unit> meleeFriends;

		private List<Unit> rangedEnemy;

		private List<Unit> meleeEnemy;

		private List<Vector3> damagePositions;

		public float force;

		private MovementHandler movementHandler;

		private float counter;

		private float timer = 5f;

		private AnimationHandler animationHandler;

		private void Start()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			try
			{
				teamSystem = World.Active.GetOrCreateManager<TeamSystem>();
				unit = ((Component)((Component)this).transform.root).GetComponentInChildren<Unit>();
				unitData = unit.data;
				unitData.healthHandler.deathEvent.AddListener(new UnityAction(DeathEvent));
				unitData.healthHandler.AssignDamageAction((Action)TakeDamage);
				movementHandler = ((Component)unit).GetComponentInChildren<MovementHandler>();
				originalWalkSpeed = movementHandler.multiplier;
				animationHandler = ((Component)unit).GetComponentInChildren<AnimationHandler>();
			}
			catch (Exception ex)
			{
				Debug.LogError((object)ex);
			}
		}

		private void ScanForUnits()
		{
			//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)
			//IL_0012: 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)
			Team team = unitData.team;
			List<Unit> teamUnits = teamSystem.GetTeamUnits(team);
			List<Unit> teamUnits2 = teamSystem.GetTeamUnits(OppTeams(team));
			HandleUnits(teamUnits, teamUnits2);
		}

		private void EvaluatePosition()
		{
			float rangedEnemyCounts = rangedEnemy.Count;
			float meleeEnemyCounts = meleeEnemy.Count;
			float rangedFriendCounts = rangedFriends.Count;
			float meleeFriendCounts = meleeFriends.Count;
			if (Object.op_Implicit((Object)(object)unitData) && Object.op_Implicit((Object)(object)unitData.targetData))
			{
				Unit target = unitData.targetData.unit;
				float num = unitData.maxHealth / 2f;
				if (unitData.health >= num)
				{
					AboveHalfHealthActions(target, rangedEnemyCounts, meleeEnemyCounts, rangedFriendCounts, meleeFriendCounts);
				}
				else
				{
					BelowHalfHealthActions(target, rangedEnemyCounts, meleeEnemyCounts, rangedFriendCounts, meleeFriendCounts);
				}
			}
		}

		private void Advance()
		{
			movementHandler.multiplier = originalWalkSpeed;
			animationHandler.currentState = 2;
		}

		private void HoldPosition()
		{
			movementHandler.multiplier = 0f;
			animationHandler.currentState = 0;
		}

		private string GetDamageKey(Vector3 position)
		{
			return ((object)(Vector3)(ref position)).ToString();
		}

		private void Update()
		{
			counter += Time.deltaTime;
			if (Object.op_Implicit((Object)(object)unit) && !unit.data.Dead)
			{
				if (counter >= timer)
				{
					damagePositions.Clear();
				}
				DamageHistoryDetection();
				ScanForUnits();
			}
			else
			{
				DeathEvent();
			}
		}

		public BattlefieldAI()
		{
			rangedFriends = new List<Unit>();
			meleeFriends = new List<Unit>();
			rangedEnemy = new List<Unit>();
			meleeEnemy = new List<Unit>();
			damagePositions = new List<Vector3>();
			force = 25f;
		}

		private void DeathEvent()
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private Team OppTeams(Team team)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			if ((int)team == 0)
			{
				return (Team)1;
			}
			return (Team)0;
		}

		private void HandleUnits(List<Unit> friends, List<Unit> foes)
		{
			try
			{
				ClearUnitLists();
				CategorizeUnits(friends, foes);
				EvaluatePosition();
			}
			catch (Exception ex)
			{
				Debug.LogError((object)ex);
			}
		}

		private void TakeDamage()
		{
			//IL_000c: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			string damageKey = GetDamageKey(unitData.mainRig.position);
			if (damagePositions.Count > 4)
			{
				damagePositions.Clear();
			}
			if (!damagePositions.Contains(unitData.mainRig.position))
			{
				damagePositions.Add(unitData.mainRig.position);
			}
			else
			{
				Debug.LogWarning((object)("Already accounted damage history at: " + damageKey));
			}
		}

		private void Retreat()
		{
			animationHandler.currentState = 3;
			movementHandler.multiplier = originalWalkSpeed * -0.2f;
		}

		private void DamageHistoryDetection()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005c: 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)
			foreach (Vector3 damagePosition in damagePositions)
			{
				if (Vector3.Distance(unitData.mainRig.position, damagePosition) <= 1f)
				{
					Rigidbody[] allRigs = unitData.allRigs.AllRigs;
					for (int i = 0; i < allRigs.Length; i++)
					{
						allRigs[i].AddForce((unitData.mainRig.position - damagePosition) * force, (ForceMode)5);
					}
				}
			}
		}

		private void ClearUnitLists()
		{
			rangedFriends.Clear();
			meleeFriends.Clear();
			rangedEnemy.Clear();
			meleeEnemy.Clear();
		}

		private void CategorizeUnits(List<Unit> friends, List<Unit> foes)
		{
			foreach (Unit fo in foes)
			{
				if (IsRangedUnit(fo))
				{
					rangedEnemy.Add(fo);
				}
				else
				{
					meleeEnemy.Add(fo);
				}
			}
			foreach (Unit friend in friends)
			{
				if (IsRangedUnit(friend))
				{
					rangedFriends.Add(friend);
				}
				else
				{
					meleeFriends.Add(friend);
				}
			}
		}

		private bool IsRangedUnit(Unit unit)
		{
			if (!Object.op_Implicit((Object)(object)unit.data.weaponHandler.rightWeapon) || !unit.data.weaponHandler.rightWeapon.isRange)
			{
				if (Object.op_Implicit((Object)(object)unit.data.weaponHandler.leftWeapon))
				{
					return unit.data.weaponHandler.leftWeapon.isRange;
				}
				return false;
			}
			return true;
		}

		private void AboveHalfHealthActions(Unit target, float rangedEnemyCounts, float meleeEnemyCounts, float rangedFriendCounts, float meleeFriendCounts)
		{
			if (target.unitBlueprint.GetUnitCost(true) >= unit.unitBlueprint.GetUnitCost(true))
			{
				Advance();
			}
			else if (rangedEnemyCounts > Mathf.Round(rangedFriendCounts / 2f))
			{
				if (meleeEnemyCounts > Mathf.Round(meleeFriendCounts / 2f))
				{
					HoldPosition();
				}
				else
				{
					Advance();
				}
			}
			else if (meleeEnemyCounts > Mathf.Round(meleeFriendCounts / 2f))
			{
				Advance();
			}
			else
			{
				HoldPosition();
			}
		}

		private void BelowHalfHealthActions(Unit target, float rangedEnemyCounts, float meleeEnemyCounts, float rangedFriendCounts, float meleeFriendCounts)
		{
			if (target.unitBlueprint.GetUnitCost(true) >= unit.unitBlueprint.GetUnitCost(true))
			{
				Retreat();
			}
			else if (rangedEnemyCounts <= Mathf.Round(rangedFriendCounts / 2f))
			{
				HoldPosition();
			}
			else if (meleeEnemyCounts > Mathf.Round(meleeFriendCounts / 2f))
			{
				HoldPosition();
			}
			else
			{
				Retreat();
			}
		}
	}
	public class StoneManBehaviour : MonoBehaviour
	{
		private Unit unit;

		public string soundEffect;

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

		private void DeathAction()
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)unit))
			{
				((Component)unit).gameObject.AddComponent<SinkOnDeath>().Sink();
				for (int i = 0; i < unit.data.allRigs.AllRigs.Length; i++)
				{
					unit.data.allRigs.AllRigs[i].isKinematic = true;
				}
				SpawnParticles();
				ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect(soundEffect, 1.3f, unit.data.mainRig.position, (MaterialType)0, (Transform)null, 1f);
			}
		}

		public void Update()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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 (unit.data.Dead)
			{
				ConfigurableJointMotion val = (ConfigurableJointMotion)2;
				ConfigurableJoint[] componentsInChildren = ((Component)unit).GetComponentsInChildren<ConfigurableJoint>();
				foreach (ConfigurableJoint obj in componentsInChildren)
				{
					obj.xMotion = val;
					obj.yMotion = val;
					obj.zMotion = val;
					obj.angularXMotion = val;
					obj.angularYMotion = val;
					obj.angularZMotion = val;
				}
			}
		}

		public bool SwitchBool(bool currentBool)
		{
			return !currentBool;
		}

		public void SpawnParticles()
		{
			//IL_001b: 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)
			Rigidbody[] componentsInChildren = ((Component)unit).GetComponentsInChildren<Rigidbody>();
			foreach (Rigidbody val in componentsInChildren)
			{
				ServiceLocator.GetService<ParticlePlayer>().PlayEffect(0, val.position, Vector3.up, (SkinnedMeshRenderer)null);
			}
		}
	}
	public class HardRockPassiveMovement : MonoBehaviour
	{
	}
	[HarmonyPatch(typeof(HealthHandler), "TakeDamage")]
	internal class TakeDamagePatch
	{
		private static void Prefix(HealthHandler __instance, float damage)
		{
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			if (!float.IsNaN(damage) && !float.IsInfinity(damage) && damage != 0f)
			{
				FieldInfo field = typeof(HealthHandler).GetField("data", (BindingFlags)(-1));
				object? obj = ((field != null) ? field.GetValue(__instance) : null);
				DataHandler val = (DataHandler)((obj is DataHandler) ? obj : null);
				FieldInfo field2 = typeof(HealthHandler).GetField("isInvulnerable", (BindingFlags)(-1));
				bool? flag = ((field2 != null) ? field2.GetValue(__instance) : null) as bool?;
				if ((!flag.HasValue || !flag.Value) && Object.op_Implicit((Object)(object)val) && !val.Dead && val.lifeTime >= 0.3f && (val.immunityForSeconds <= 0f || damage <= 0f) && (Object)(object)((Component)val.unit).gameObject.GetComponentInChildren<HardRockPassiveMovement>() != (Object)null && damage < 200f)
				{
					val.health += damage;
					ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect("Effects/TombStonePush", 0.6f, val.mainRig.position, (MaterialType)0, (Transform)null, 0.6f);
				}
				else if ((!flag.HasValue || !flag.Value) && Object.op_Implicit((Object)(object)val) && !val.Dead && val.lifeTime >= 0.3f && (val.immunityForSeconds <= 0f || damage <= 0f) && (Object)(object)((Component)val.unit).gameObject.GetComponentInChildren<HardenedBodyPassiveMovement>() != (Object)null && Random.Range(0f, 1f) <= 0.1f)
				{
					val.health += damage;
					ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect("Effects/BoneSpell", 1f, val.mainRig.position, (MaterialType)0, (Transform)null, 0.7f);
				}
			}
		}
	}
	public class AncientArcherDeathEvent : MonoBehaviour
	{
		private Unit unit;

		public GameObject skull;

		public GameObject bones;

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

		private void Execute()
		{
			//IL_001b: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			Object.Instantiate<GameObject>(skull, ((Component)unit.data.head).transform.position, randomQuaternion());
			Rigidbody[] allRigs = unit.data.allRigs.AllRigs;
			foreach (Rigidbody val in allRigs)
			{
				Object.Instantiate<GameObject>(bones, ((Component)val).transform.position, randomQuaternion());
			}
			ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect("Footsteps/Skeleton", 1f, unit.data.mainRig.position, (MaterialType)0, (Transform)null, 0.8f);
			Object.Destroy((Object)(object)((Component)unit).gameObject);
		}

		private Quaternion randomQuaternion()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			float num = Random.Range(0f, 359f);
			float num2 = Random.Range(0f, 359f);
			float num3 = Random.Range(0f, 359f);
			return Quaternion.Euler(num, num2, num3);
		}
	}
	public class UndeadBookBehaviors : MonoBehaviour
	{
		public void Start()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			UnitSpawner[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren<UnitSpawner>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].unitBlueprint = (UnitBlueprint)SLMALoader.SDic["blueprints"]["UNIT_HALLOWEEN_SKELETONWARRIOR"];
			}
		}
	}
	public class HardenedBodyPassiveMovement : MonoBehaviour
	{
	}
	public class RandomUnitBlueprintSpawner : MonoBehaviour
	{
		public UnitBlueprint[] unitBlueprints;

		public UnitSpawner[] unitSpawners;

		private void ChangeUnit(GameObject gameObject)
		{
			UnitSpawner[] array = unitSpawners;
			for (int i = 0; i < array.Length; i++)
			{
				array[i].unitBlueprint = RandomUnit();
			}
		}

		public void Start()
		{
			unitSpawners = ((Component)this).gameObject.GetComponentsInChildren<UnitSpawner>();
			UnitSpawner[] array = unitSpawners;
			for (int i = 0; i < array.Length; i++)
			{
				array[i].spawnUnitAction = ChangeUnit;
				array[i].unitBlueprint = RandomUnit();
			}
		}

		private UnitBlueprint RandomUnit()
		{
			return unitBlueprints[Random.Range(0, unitBlueprints.Length)];
		}
	}
}