Decompiled source of ChouChou s Unit v0.0.3

ChouChou's Units.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 ChouChousUnit;
using DM;
using FhpSLib;
using FhpSLib.BundleModCore;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.UnitEditor;
using Landfall.TABS.Workshop;
using SLMA;
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("ChouChou的兵种")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("made in SFTBM by FhpSlime")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3a45c3cf-230c-4310-952f-0887d4266a22")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ChouChousUnit
{
	public static class UManager
	{
		public static class Units
		{
			public static void FireGiant(LandfallContentDatabase db)
			{
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Expected O, but got Unknown
				//IL_00ba: Expected O, but got Unknown
				mod.GetAssetBundle("Mod").LoadAsset<GameObject>("熔岩发射").AddComponent<StoneThrower>()
					.stonePrefab = mod.GetAssetBundle("Mod").LoadAsset<GameObject>("石头");
				mod.GetAssetBundle("Mod").LoadAsset<GameObject>("石头").AddComponent<StoneThrower.DestorySelf>();
				UnitBlueprint val = SLMATool.CreateUnit("熔岩巨人", (UnitBlueprint)SLMALoader.SDic["blueprints"]["UNIT_SECRET_ICEGIANT"], (Faction)SLMALoader.SDic["factions"]["Secret"], mod.GetAssetBundle("Mod").LoadAsset<Sprite>("火巨人"));
				val.UnitBase = mod.GetAssetBundle("Mod").LoadAsset<GameObject>("熔岩巨人");
				val.RightWeapon = mod.GetAssetBundle("Mod").LoadAsset<GameObject>("熔岩巨人拳");
				val.LeftWeapon = val.RightWeapon;
				mod.GetAssetBundle("Mod").LoadAsset<GameObject>("红温").AddComponent<DoMoveWhenEffect>();
				val.m_props = (GameObject[])(object)new GameObject[2]
				{
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("火巨人服装 - 副本"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("火巨人服装")
				};
				val.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[2]
				{
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("熔岩发射"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("红温")
				};
				val.Entity.SetUnlockKey("FireGiant");
				val.health = 12000f;
				val.forceCost = 10000u;
			}

			public static void Gladiator(LandfallContentDatabase db)
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Expected O, but got Unknown
				UnitBlueprint val = SLMATool.CreateUnit("角斗士", (UnitBlueprint)null, (Faction)SLMALoader.SDic["factions"]["Secret"], mod.GetAssetBundle("Mod").LoadAsset<Sprite>("短剑角斗士图标"));
				val.UnitBase = mod.GetAssetBundle("Mod").LoadAsset<GameObject>("角斗士模型");
				val.RightWeapon = mod.GetAssetBundle("Mod").LoadAsset<GameObject>("角斗士剑");
				val.LeftWeapon = mod.GetAssetBundle("Mod").LoadAsset<GameObject>("角斗士拳");
				WeaponAddEffectPoss weaponAddEffectPoss = mod.GetAssetBundle("Mod").LoadAsset<GameObject>("角斗士拳").AddComponent<WeaponAddEffectPoss>();
				weaponAddEffectPoss.poss = 30.1f;
				weaponAddEffectPoss.EffectPrefab = mod.GetAssetBundle("Mod").LoadAsset<GameObject>("E_眩晕").GetComponentInChildren<UnitEffectBase>();
				val.m_props = (GameObject[])(object)new GameObject[8]
				{
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("角斗士01"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("角斗士02"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("角斗士03"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("角斗士04"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("角斗士05"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("角斗士06"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("角斗士07"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("角斗士08")
				};
				val.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { mod.GetAssetBundle("Mod").LoadAsset<GameObject>("狂暴") };
				val.Entity.SetUnlockKey("Gladiator");
				val.VocalPathData.Category = "Viking Attack Vocals";
				val.VocalPathData.Effect = "Berserker";
				val.VocalPathData.EffectPitch = 1f;
				val.VocalPathData.EffectVolume = 1f;
				s.SetField<UnitBlueprint>(val, "deathRef", (object)"Viking Death Vocals/Berserker");
				s.SetField<UnitBlueprint>(val, "vocalRef", (object)"Viking Attack Vocals/Berserker");
				val.health = 580f;
				val.forceCost = 500u;
				val.massMultiplier = 1.5f;
			}

			public static void Dwarves(LandfallContentDatabase db)
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Expected O, but got Unknown
				UnitBlueprint val = SLMATool.CreateUnit("重装矮人", (UnitBlueprint)null, (Faction)SLMALoader.SDic["factions"]["Secret"], mod.GetAssetBundle("Mod").LoadAsset<Sprite>("重装矮人图标"));
				val.UnitBase = mod.GetAssetBundle("Mod").LoadAsset<GameObject>("矮人体型");
				val.RightWeapon = mod.GetAssetBundle("Mod").LoadAsset<GameObject>("重装战锤");
				mod.GetAssetBundle("Mod").LoadAsset<GameObject>("重装战锤").AddComponent<CanChangeMode>();
				val.LeftWeapon = mod.GetAssetBundle("Mod").LoadAsset<GameObject>("重装盾牌");
				val.m_props = (GameObject[])(object)new GameObject[9]
				{
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("矮人01"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("矮人02"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("矮人03"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("矮人04"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("矮人05"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("矮人06"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("矮人07"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("矮人08"),
					mod.GetAssetBundle("Mod").LoadAsset<GameObject>("矮人09")
				};
				val.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[1] { mod.GetAssetBundle("Mod").LoadAsset<GameObject>("锤子形态切换") };
				HammerChageMode hammerChageMode = mod.GetAssetBundle("Mod").LoadAsset<GameObject>("锤子形态切换").AddComponent<HammerChageMode>();
				hammerChageMode.green = mod.GetAssetBundle("Mod").LoadAsset<Material>("Glow Green");
				hammerChageMode.red = mod.GetAssetBundle("Mod").LoadAsset<Material>("Glow Red");
				hammerChageMode.Heal = mod.GetAssetBundle("Mod").LoadAsset<GameObject>("E_治愈");
				val.voiceBundle = mod.GetAssetBundle("Mod").LoadAsset<VoiceBundle>("矮人Voice");
				val.Validate();
				val.health = 1800f;
				val.forceCost = 1500u;
				val.massMultiplier = 20f;
				val.Entity.SetUnlockKey("Dwarves");
				val.sizeMultiplier = 1.2f;
				val.movementSpeedMuiltiplier = 1.2f;
			}
		}

		public static string modname;

		public static string modder;

		private static string com;

		public static SLMABundleMod mod;

		public static List<Unit> bases;

		public static GameObject hiteffect;

		static UManager()
		{
			modname = "ChineseMythology";
			modder = "FhpSlime";
			bases = new List<Unit>();
		}

		public static void EditBlueprint(UnitBlueprint unit, LandfallContentDatabase db)
		{
		}

		public static void EditClothes(GameObject cloth, CharacterItem item, PropItemData data, Unit unit, int index, LandfallContentDatabase db)
		{
		}

		public static void EditProjectiles(GameObject proj, ProjectileHit projhit, Unit unit, LandfallContentDatabase db)
		{
		}

		public static void EditCombatMoves(GameObject move, int index, Unit unit, LandfallContentDatabase db)
		{
		}

		public static void CodeAfterSpawn(Unit unit, LandfallContentDatabase db)
		{
		}

		public static void Init(LandfallContentDatabase db)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_057f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0772: Unknown result type (might be due to invalid IL or missing references)
			//IL_0807: Unknown result type (might be due to invalid IL or missing references)
			//IL_080c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0817: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_079a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0786: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0525: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("ChouChouUnits").PatchAll();
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("chouchou");
			AssetBundle val = AssetBundle.LoadFromStream(stream);
			mod = SLMABundleMod.CreatSLMABundleMod("ChouChou", "1.0");
			mod.AddAssetBundle("Mod", val);
			GameObject[] array = val.LoadAllAssets<GameObject>();
			foreach (GameObject val2 in array)
			{
				Debug.Log((object)((Object)val2).name);
				if (Object.op_Implicit((Object)(object)val2.GetComponent<WeaponItem>()) && !HelpLibrary.m_weapons.ContainsKey(((CharacterItem)val2.GetComponent<WeaponItem>()).Entity.GUID))
				{
					_ = val2.gameObject;
					Dictionary<DatabaseID, GameObject> weapons = HelpLibrary.m_weapons;
					weapons.Add(((CharacterItem)val2.GetComponentInChildren<WeaponItem>()).Entity.GUID, val2.gameObject);
					HelpLibrary.m_weapons = weapons;
					Dictionary<DatabaseID, Object> dictionary = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
					dictionary.Add(((CharacterItem)val2.GetComponentInChildren<WeaponItem>()).Entity.GUID, (Object)(object)val2.gameObject);
					typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(ContentDatabase.Instance().AssetLoader, dictionary);
				}
				if (Object.op_Implicit((Object)(object)val2.GetComponent<ProjectileEntity>()) && !HelpLibrary.m_weapons.ContainsKey(val2.GetComponent<ProjectileEntity>().Entity.GUID))
				{
					_ = val2.gameObject;
					Dictionary<DatabaseID, GameObject> projectiles = HelpLibrary.m_projectiles;
					projectiles.Add(val2.GetComponentInChildren<ProjectileEntity>().Entity.GUID, val2.gameObject);
					HelpLibrary.m_projectiles = projectiles;
					Dictionary<DatabaseID, Object> dictionary2 = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
					dictionary2.Add(val2.GetComponentInChildren<ProjectileEntity>().Entity.GUID, (Object)(object)val2.gameObject);
					typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(ContentDatabase.Instance().AssetLoader, dictionary2);
				}
				if (Object.op_Implicit((Object)(object)val2.GetComponent<PropItem>()) && !HelpLibrary.m_characterProps.ContainsKey(((CharacterItem)val2.GetComponent<PropItem>()).Entity.GUID))
				{
					_ = val2.gameObject;
					Dictionary<DatabaseID, GameObject> characterProps = HelpLibrary.m_characterProps;
					characterProps.Add(((CharacterItem)val2.GetComponentInChildren<PropItem>()).Entity.GUID, val2.gameObject);
					HelpLibrary.m_characterProps = characterProps;
					Dictionary<DatabaseID, Object> dictionary3 = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
					dictionary3.Add(((CharacterItem)val2.GetComponentInChildren<PropItem>()).Entity.GUID, (Object)(object)val2.gameObject);
					typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(ContentDatabase.Instance().AssetLoader, dictionary3);
				}
				if (Object.op_Implicit((Object)(object)val2.GetComponent<SpecialAbility>()) && !HelpLibrary.m_combatMoves.ContainsKey(((CharacterItem)val2.GetComponent<SpecialAbility>()).Entity.GUID))
				{
					_ = val2.gameObject;
					Dictionary<DatabaseID, GameObject> combatMoves = HelpLibrary.m_combatMoves;
					combatMoves.Add(((CharacterItem)val2.GetComponentInChildren<SpecialAbility>()).Entity.GUID, val2.gameObject);
					HelpLibrary.m_combatMoves = combatMoves;
					Dictionary<DatabaseID, Object> dictionary4 = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
					dictionary4.Add(((CharacterItem)val2.GetComponentInChildren<SpecialAbility>()).Entity.GUID, (Object)(object)val2.gameObject);
					typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(ContentDatabase.Instance().AssetLoader, dictionary4);
				}
				if (Object.op_Implicit((Object)(object)val2.GetComponent<Unit>()) && !HelpLibrary.m_unitBases.ContainsKey(val2.GetComponent<Unit>().Entity.GUID))
				{
					GameObject gameObject = val2.gameObject;
					if (Object.op_Implicit((Object)(object)gameObject.GetComponentInChildren<TeamColor>()))
					{
						TeamColor[] componentsInChildren = gameObject.GetComponentsInChildren<TeamColor>();
						foreach (TeamColor val3 in componentsInChildren)
						{
							if ((Object)(object)val3.redMaterial == (Object)null)
							{
								int materialID = val3.materialID;
								s.DeepCopyOf<TeamColor>(val3, ((GameObject)SLMALoader.SDic["bases"]["Humanoid"]).GetComponentInChildren<TeamColor>());
								val3.materialID = materialID;
							}
						}
					}
					if (Object.op_Implicit((Object)(object)gameObject.GetComponentInChildren<EyeSpawner>()))
					{
						gameObject.GetComponentInChildren<EyeSpawner>().eyeObject = ((GameObject)SLMALoader.SDic["bases"]["Humanoid"]).GetComponentInChildren<EyeSpawner>().eyeObject;
					}
					Dictionary<DatabaseID, GameObject> unitBases = HelpLibrary.m_unitBases;
					bases.Add(val2.GetComponentInChildren<Unit>());
					unitBases.Add(val2.GetComponentInChildren<Unit>().Entity.GUID, val2.gameObject);
					HelpLibrary.m_unitBases = unitBases;
					Dictionary<DatabaseID, Object> dictionary5 = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
					dictionary5.Add(val2.GetComponentInChildren<Unit>().Entity.GUID, (Object)(object)val2.gameObject);
					typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(ContentDatabase.Instance().AssetLoader, dictionary5);
				}
				if (Object.op_Implicit((Object)(object)val2.GetComponent<SpecialAbility>()) && !HelpLibrary.m_combatMoves.ContainsKey(((CharacterItem)val2.GetComponent<SpecialAbility>()).Entity.GUID))
				{
					_ = val2.gameObject;
					Dictionary<DatabaseID, GameObject> combatMoves2 = HelpLibrary.m_combatMoves;
					combatMoves2.Add(((CharacterItem)val2.GetComponentInChildren<SpecialAbility>()).Entity.GUID, val2.gameObject);
					HelpLibrary.m_combatMoves = combatMoves2;
					Dictionary<DatabaseID, Object> dictionary6 = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
					dictionary6.Add(((CharacterItem)val2.GetComponentInChildren<SpecialAbility>()).Entity.GUID, (Object)(object)val2.gameObject);
					typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(ContentDatabase.Instance().AssetLoader, dictionary6);
				}
			}
			Material[] array2 = val.LoadAllAssets<Material>();
			foreach (Material val4 in array2)
			{
				if (Object.op_Implicit((Object)(object)Shader.Find(((Object)val4.shader).name)))
				{
					val4.shader = Shader.Find(((Object)val4.shader).name);
				}
			}
			SoundBank[] array3 = val.LoadAllAssets<SoundBank>();
			foreach (SoundBank obj in array3)
			{
				SoundBank soundBank = ServiceLocator.GetService<SoundPlayer>().soundBank;
				List<SoundBankCategory> list = soundBank.Categories.ToList();
				SoundBankCategory[] categories = obj.Categories;
				foreach (SoundBankCategory item in categories)
				{
					list.Add(item);
				}
				soundBank.Categories = list.ToArray();
			}
			Dictionary<DatabaseID, Object> dictionary7 = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
			Dictionary<DatabaseID, VoiceBundle> dictionary8 = (Dictionary<DatabaseID, VoiceBundle>)typeof(LandfallContentDatabase).GetField("m_voiceBundles", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(HelpLibrary.landfallContentDatabase);
			VoiceBundle[] array4 = val.LoadAllAssets<VoiceBundle>();
			foreach (VoiceBundle val5 in array4)
			{
				if (!dictionary8.ContainsKey(val5.Entity.GUID))
				{
					dictionary8.Add(val5.Entity.GUID, val5);
				}
				dictionary7.Add(val5.Entity.GUID, (Object)(object)val5);
			}
			typeof(LandfallContentDatabase).GetField("m_voiceBundles", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(HelpLibrary.landfallContentDatabase, dictionary8);
			typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(ContentDatabase.Instance().AssetLoader, dictionary7);
			ServiceLocator.GetService<CustomContentLoaderModIO>().QuickRefresh((WorkshopContentType)0, (Action)null);
			new GameObject
			{
				name = "MapsCore",
				hideFlags = (HideFlags)52
			}.AddComponent<ScenesManager>();
			Init2(db);
			Init3();
			DoTrans();
		}

		public static void EditWeapons(GameObject weapon, Team team, Unit unit, MeleeWeapon melee, RangeWeapon range, LandfallContentDatabase db)
		{
		}

		public static void TryChangeColorbyindex(this GameObject gameObject, Color color, int index)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			Material val = new Material(Shader.Find("Standard"));
			val.SetColor("_Color", color);
			val.SetFloat("_Mode", 3f);
			val.SetInt("_SrcBlend", 5);
			val.SetInt("_DstBlend", 10);
			val.EnableKeyword("_ALPHABLEND_ON");
			val.renderQueue = 3000;
			if (Object.op_Implicit((Object)(object)gameObject.GetComponentInChildren<TeamColor>()))
			{
				Object.Destroy((Object)(object)gameObject.GetComponentInChildren<TeamColor>());
			}
			Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Material[] materials = componentsInChildren[i].materials;
				int num = 0;
				if (num < materials.Length)
				{
					componentsInChildren[i].materials[num] = val;
					break;
				}
			}
		}

		public static Sprite GetSprite(string name)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name);
			Texture2D val = new Texture2D(4, 4);
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, (int)stream.Length);
			ImageConversion.LoadImage(val, array);
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		}

		public static void DestoryAll<T>(this GameObject game) where T : Object
		{
			if (Object.op_Implicit((Object)(object)game.GetComponentInChildren<T>()))
			{
				T[] componentsInChildren = game.GetComponentsInChildren<T>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					Object.Destroy((Object)(object)componentsInChildren[i]);
				}
			}
		}

		public static GameObject CreateNewMove(string name, int id = 0)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			GameObject obj = UPool.MyPool.AddObject(name, (GameObject)SLMALoader.SDic["moves"]["Halfling_Jump"], true, (HideFlags)52, (Sprite)null, id, false);
			obj.DestoryAll<DodgeMove>();
			((UnityEventBase)obj.GetComponentInChildren<ConditionalEvent>().events[0].turnOnEvent).RemoveAllListeners();
			((UnityEventBase)obj.GetComponentInChildren<ConditionalEvent>().events[0].continuousEvent).RemoveAllListeners();
			return obj;
		}

		public static void SetMoveConditionalValue(this ConditionalEventInstance gameObject, ConditionType type, ValueType valuet, float value)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_004d: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			bool flag = false;
			EventCondition[] conditions = gameObject.conditions;
			foreach (EventCondition val in conditions)
			{
				if (val.conditionType == type)
				{
					val.valueType = valuet;
					val.value = value;
					flag = true;
				}
			}
			if (!flag)
			{
				List<EventCondition> list = gameObject.conditions.ToList();
				list.Add(new EventCondition
				{
					conditionType = type,
					valueType = valuet,
					value = value
				});
				gameObject.conditions = list.ToArray();
			}
		}

		public static bool LoadAssetBundle(SLMABundleMod mod, string name)
		{
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			AssetBundle assetBundle = mod.GetAssetBundle(name);
			if (!Object.op_Implicit((Object)(object)assetBundle))
			{
				return false;
			}
			GameObject[] array = assetBundle.LoadAllAssets<GameObject>();
			foreach (GameObject val in array)
			{
				if (val.GetComponentInChildren<IDatabaseEntity>() != null)
				{
					IDatabaseEntity componentInChildren = val.GetComponentInChildren<IDatabaseEntity>();
					Dictionary<DatabaseID, GameObject> dictionary = new Dictionary<DatabaseID, GameObject>();
					if (componentInChildren is WeaponItem)
					{
						dictionary = HelpLibrary.m_weapons;
					}
					else if (componentInChildren is SpecialAbility)
					{
						dictionary = HelpLibrary.m_combatMoves;
					}
					else if (componentInChildren is PropItem)
					{
						dictionary = HelpLibrary.m_characterProps;
					}
					else if (componentInChildren is Unit)
					{
						dictionary = HelpLibrary.m_unitBases;
					}
					else if (componentInChildren is ProjectileEntity)
					{
						dictionary = HelpLibrary.m_projectiles;
					}
					Debug.Log((object)("[FhpSlib]Load:" + val.GetComponentInChildren<IDatabaseEntity>().Entity.Name));
					dictionary.Add(val.GetComponentInChildren<IDatabaseEntity>().Entity.GUID, val.gameObject);
					Dictionary<DatabaseID, Object> dictionary2 = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
					dictionary2.Add(val.GetComponentInChildren<IDatabaseEntity>().Entity.GUID, (Object)(object)val.gameObject);
					typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(ContentDatabase.Instance().AssetLoader, dictionary2);
					if (componentInChildren is WeaponItem)
					{
						HelpLibrary.m_weapons = dictionary;
					}
					else if (componentInChildren is SpecialAbility)
					{
						HelpLibrary.m_combatMoves = dictionary;
					}
					else if (componentInChildren is PropItem)
					{
						HelpLibrary.m_characterProps = dictionary;
					}
					else if (componentInChildren is Unit)
					{
						HelpLibrary.m_unitBases = dictionary;
					}
					else if (componentInChildren is ProjectileEntity)
					{
						HelpLibrary.m_projectiles = dictionary;
					}
				}
			}
			UnitBlueprint[] array2 = assetBundle.LoadAllAssets<UnitBlueprint>();
			foreach (UnitBlueprint val2 in array2)
			{
				Dictionary<DatabaseID, UnitBlueprint> unitBlueprints = HelpLibrary.m_unitBlueprints;
				unitBlueprints.Add(val2.Entity.GUID, val2);
				Dictionary<DatabaseID, Object> dictionary3 = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
				dictionary3.Add(val2.Entity.GUID, (Object)(object)val2);
				typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(ContentDatabase.Instance().AssetLoader, dictionary3);
				HelpLibrary.m_unitBlueprints = unitBlueprints;
			}
			Faction[] array3 = assetBundle.LoadAllAssets<Faction>();
			foreach (Faction val3 in array3)
			{
				Dictionary<DatabaseID, Faction> factions = HelpLibrary.m_factions;
				factions.Add(val3.Entity.GUID, val3);
				Dictionary<DatabaseID, Object> dictionary4 = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().AssetLoader);
				dictionary4.Add(val3.Entity.GUID, (Object)(object)val3);
				typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(ContentDatabase.Instance().AssetLoader, dictionary4);
				HelpLibrary.m_factions = factions;
			}
			return true;
		}

		public static void Init2(LandfallContentDatabase db)
		{
			Units.FireGiant(db);
			Units.Gladiator(db);
			Units.Dwarves(db);
		}

		public static void Init3()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			List<UnitBlueprint> list = new List<UnitBlueprint>();
			UnitBlueprint[] units = ((Faction)SLMALoader.SDic["factions"]["Secret"]).Units;
			foreach (UnitBlueprint item in units)
			{
				list.Add(item);
			}
			list.Sort((UnitBlueprint unit1, UnitBlueprint unit2) => unit1.GetUnitCost(true).CompareTo(unit2.GetUnitCost(true)));
			((Faction)SLMALoader.SDic["factions"]["Secret"]).Units = list.ToArray();
		}

		public static void AddTransl(string key, string trans)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<int, Language> dictionary = new Dictionary<int, Language>();
			dictionary.Add(0, (Language)7);
			dictionary.Add(1, (Language)0);
			dictionary.Add(2, (Language)8);
			dictionary.Add(3, (Language)3);
			dictionary.Add(4, (Language)1);
			dictionary.Add(5, (Language)6);
			dictionary.Add(6, (Language)4);
			dictionary.Add(7, (Language)2);
			Dictionary<Language, Dictionary<string, string>> dictionary2 = (Dictionary<Language, Dictionary<string, string>>)typeof(Localizer).GetField("m_localization", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
			string[] array = trans.Split(new string[1] { "#" }, StringSplitOptions.RemoveEmptyEntries);
			for (int i = 0; i < dictionary.Count; i++)
			{
				dictionary2[dictionary[i]].Add(key, array[i]);
			}
			typeof(Localizer).GetField("m_localization", BindingFlags.Static | BindingFlags.NonPublic).SetValue(typeof(Localizer), dictionary2);
		}

		public static void DoTrans()
		{
			AddTransl("重装矮人", "重装矮人#Heavy Dwarf#ヘビー・ドワーフ#Schwere Zwerg#Nain lourd#Тяжелый гном#Anão Pesado#Nano pesante");
			AddTransl("角斗士", "角斗士#Gladiator#グラディエーター#Gladiator#Gladiateur#Гладиатор#Gladiador#Gladiaore");
			AddTransl("熔岩巨人", "熔岩巨人#Lava Giant#溶岩巨人#Lavagigant#Géant de lave#Лавовый гигант#Gigante de Lava#Gigante di lava");
			AddTransl("瘟疫医生", "瘟疫医生#Plague Doctor#ペスト医師#Pestarzt#Docteur de la peste#Чума Доктор#Médico da Peste#Medico della Peste");
			AddTransl("角斗士体型", "角斗士体型#Gladiator Form#グラディエーター形態#Gladiator Form#Forme de gladiateur#Форма гладиатора#Forma de Gladiador#Forma di Gladiatore");
			AddTransl("熔岩巨人体型", "熔岩巨人体型#Lava Giant Form#溶岩巨人形態#Lavagigant Form#Forme de géant de lave#Форма лавового гиганта#Forma de Gigante de Lava#Forma di Gigante di Lava");
			AddTransl("矮人体型", "矮人体型#Dwarf Form#ドワーフ形態#Zwerg Form#Forme de nain#Форма гнома#Forma de Anão#Forma di Nano");
			AddTransl("病变体", "病变体#Mutant#ミュータント#Mutant#Mutant#Мутант#Mutante#Mutante");
			AddTransl("吐毒", "吐毒#Poison Spit#毒吐き#Giftspritzen#Crachat empoisonné#Ядовитый плевок#Cuspe Venenoso#Sputo Velenoso");
			AddTransl("黑雾", "黑雾#Dark Mist#闇の霧#Dunkler Nebel#Brume noire#Темный туман#Névoa Negra#Nebbia Oscura");
			AddTransl("瘟疫召唤", "瘟疫召唤#Plague Summon#疫病召喚#Seuchenbeschwörung#Invocation de peste#Вызов чумы#Invocação de Peste#Invocazione di Peste");
			AddTransl("熔岩发射", "熔岩发射#Lava Blast#溶岩ブラスト#Lavageschoss#Tir de lave#Выстрел лавы#Explosão de Lava#Esplosione di Lava");
			AddTransl("暴怒", "暴怒#Rage#激怒#Wut#Rage#Ярость#Raiva#Rabbia");
			AddTransl("锤子切换", "锤子切换#Hammer Switch#ハンマー切り替え#Hammerwechsel#Changement de marteau#Переключение молота#Troca de Martelo#Cambio di Martello");
			AddTransl("熔岩巨人拳", "熔岩巨人拳#Lava Giant Fist#溶岩巨人拳#Lavagigantenfaust#Poing de géant de lave#Кулак лавового гиганта#Punho de Gigante de Lava#Pugno di Gigante di Lava");
			AddTransl("重装战锤", "重装战锤#Heavy Warhammer#重装戦鎚#Schwere Kriegshammer#Marteau de guerre lourd#Тяжелый боевой молот#Martelo de Guerra Pesado#Mazza da Guerra Pesante");
			AddTransl("重装盾牌", "重装盾牌#Heavy Shield#重装シールド#Schwerer Schild#Bouclier lourd#Тяжелый щит#Escudo Pesado#Scudo Pesante");
			AddTransl("西福斯短剑", "西福斯短剑#Sefos Shortsword#セフォス短剣#Sefos Kurzschwert#Épée courte de Sefos#Короткий меч Сефоса#Espada Curta de Sefos#Spada Corta di Sefos");
			AddTransl("角斗士拳", "角斗士拳#Gladiator's Fist#グラディエーターの拳#Gladiatorenfaust#Poing de gladiateur#Кулак гладиатора#Punho de Gladiador#Pugno di Gladiatore");
			AddTransl("手杖", "手杖#Staff#杖#Stab#Bâton#Посох#Cajado#Bastone");
			AddTransl("提灯", "提灯#Lantern#提灯#Laterne#Lanterne#Фонарь#Lanterna#Lanterna");
			AddTransl("病变魔之盾", "病变魔之盾#Mutant Demon's Shield#ミュータントデーモンの盾#Mutanten Dämonenschild#Bouclier de démon mutant#Щит демона-мутанта#Escudo de Demônio Mutante#Scudo di Demone Mutante");
			AddTransl("病变魔之剑", "病变魔之剑#Mutant Demon's Sword#ミュータントデーモンの剣#Mutanten Dänomenschwert#Épée de démon mutant#Меч демона-мутанта#Espada de Demônio Mutante#Spada di Demone Mutante");
			AddTransl("树杈", "树杈#Branch#枝#Zweig#Branche#Ветка#Ramo#Ramo");
		}
	}
	[BepInPlugin("chouchou", "fhp.cc.chouchou", "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));
			yield return (object)new WaitForSecondsRealtime(0.3f);
			SLMALoader.GetInstance();
			LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
			UManager.Init(landfallContentDatabase);
			new Harmony(UManager.modname).PatchAll();
			GOSLMA.EditWeapons = ((GOSLMA.EditWeapons == null) ? new Action<GameObject, Team, Unit, MeleeWeapon, RangeWeapon, LandfallContentDatabase>(UManager.EditWeapons) : ((Action<GameObject, Team, Unit, MeleeWeapon, RangeWeapon, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, Team, Unit, MeleeWeapon, RangeWeapon, LandfallContentDatabase>(UManager.EditWeapons), GOSLMA.EditWeapons)));
			GOSLMA.EditClothes = ((GOSLMA.EditClothes == null) ? new Action<GameObject, CharacterItem, PropItemData, Unit, int, LandfallContentDatabase>(UManager.EditClothes) : ((Action<GameObject, CharacterItem, PropItemData, Unit, int, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, CharacterItem, PropItemData, Unit, int, LandfallContentDatabase>(UManager.EditClothes), GOSLMA.EditClothes)));
			GOSLMA.EditCombatMoves = ((GOSLMA.EditCombatMoves == null) ? new Action<GameObject, int, Unit, LandfallContentDatabase>(UManager.EditCombatMoves) : ((Action<GameObject, int, Unit, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, int, Unit, LandfallContentDatabase>(UManager.EditCombatMoves), GOSLMA.EditCombatMoves)));
			GOSLMA.CodeAfterSpawn = ((GOSLMA.CodeAfterSpawn == null) ? new Action<Unit, LandfallContentDatabase>(UManager.CodeAfterSpawn) : ((Action<Unit, LandfallContentDatabase>)Delegate.Combine(new Action<Unit, LandfallContentDatabase>(UManager.CodeAfterSpawn), GOSLMA.CodeAfterSpawn)));
			GOSLMA.EditProjectiles = ((GOSLMA.EditProjectiles == null) ? new Action<GameObject, ProjectileHit, Unit, LandfallContentDatabase>(UManager.EditProjectiles) : ((Action<GameObject, ProjectileHit, Unit, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, ProjectileHit, Unit, LandfallContentDatabase>(UManager.EditProjectiles), GOSLMA.EditProjectiles)));
			UnitBlueprint[] array = Resources.FindObjectsOfTypeAll<UnitBlueprint>();
			for (int i = 0; i < array.Length; i++)
			{
				UManager.EditBlueprint(array[i], landfallContentDatabase);
			}
			Debug.Log((object)("Loaded " + UManager.modname + " Successfully"));
			Debug.Log((object)(UManager.modname + "is made in SFT by FhpSlime"));
			Debug.Log((object)(UManager.modder + "wished you a pleasant trip"));
		}
	}
}
public static class STool
{
	public static void RendererColorChanger(Renderer[] renderers, Color color)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < renderers.Length; i++)
		{
			Material[] materials = renderers[i].materials;
			for (int j = 0; j < materials.Length; j++)
			{
				materials[j].color = color;
			}
		}
	}

	public static List<T> ToList<T>(T[] ts)
	{
		List<T> list = new List<T>();
		foreach (T item in ts)
		{
			list.Add(item);
		}
		return list;
	}

	public static void RendererColorChanger(MeshRenderer[] renderers, Color color)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < renderers.Length; i++)
		{
			Material[] materials = ((Renderer)renderers[i]).materials;
			for (int j = 0; j < materials.Length; j++)
			{
				materials[j].color = color;
			}
		}
	}

	public static void RendererColorChanger(SkinnedMeshRenderer[] renderers, Color color)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < renderers.Length; i++)
		{
			Material[] materials = ((Renderer)renderers[i]).materials;
			for (int j = 0; j < materials.Length; j++)
			{
				materials[j].color = color;
			}
		}
	}

	public static void RendererColorChanger(Renderer[] renderers, Material[] color)
	{
		for (int i = 0; i < renderers.Length; i++)
		{
			renderers[i].materials = color;
		}
	}

	public static void RendererColorChanger(MeshRenderer[] renderers, Material[] color)
	{
		for (int i = 0; i < renderers.Length; i++)
		{
			((Renderer)renderers[i]).materials = color;
		}
	}

	public static void RendererColorChanger(SkinnedMeshRenderer[] renderers, Material[] color)
	{
		for (int i = 0; i < renderers.Length; i++)
		{
			((Renderer)renderers[i]).materials = color;
		}
	}

	public static Vector3 AddV3(Vector3 vector3, float x, float y, float z)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		return new Vector3(vector3.x + x, vector3.y + y, vector3.z + z);
	}
}
public class ScenesManager : MonoBehaviour
{
	public ScenesManager()
	{
		SceneManager.sceneLoaded += SceneLoaded;
	}

	public void SceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
	{
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Expected O, but got Unknown
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: Expected O, but got Unknown
		//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Expected O, but got Unknown
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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")
		{
			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 basis in UManager.bases)
			{
				UnitBlueprint val = SLMATool.CreateUnit("MoreContent Custom:" + basis.Entity.Name, (UnitBlueprint)SLMALoader.SDic["blueprints"]["CustomWobbler"], (Faction)null, (Sprite)null);
				val.UnitBase = ((Component)basis).gameObject;
				list.Add(new UnitBaseWrapper
				{
					BaseDisplayName = basis.Entity.Name,
					BaseIcon = basis.Entity.SpriteIcon,
					UnitBaseBlueprint = val,
					UnitBaseRestriction = (UnitBaseRestrictions)0
				});
			}
			component.UnitBases = list.ToArray();
		}
		if (((Scene)(ref scene)).name == "01_Lvl2_Tribal_VC")
		{
			GameObject val2 = new GameObject();
			((Object)val2).name = "Core";
			val2.transform.position = Vector3.zero;
			Object.Instantiate<GameObject>(UManager.mod.GetAssetBundle("Mod").LoadAsset<GameObject>("UnlockFireGiant"), val2.transform);
		}
		if (((Scene)(ref scene)).name == "03_Lvl2_Ancient_VC")
		{
			GameObject val3 = new GameObject();
			((Object)val3).name = "Core";
			val3.transform.position = Vector3.zero;
			Object.Instantiate<GameObject>(UManager.mod.GetAssetBundle("Mod").LoadAsset<GameObject>("UnlockGladiator"), val3.transform);
		}
		if (((Scene)(ref scene)).name == "05_Lvl2_Medieval_VC")
		{
			GameObject val4 = new GameObject();
			((Object)val4).name = "Core";
			val4.transform.position = Vector3.zero;
			Object.Instantiate<GameObject>(UManager.mod.GetAssetBundle("Mod").LoadAsset<GameObject>("UnlockDwarves 1"), val4.transform);
		}
	}
}
namespace ChouChousUnit
{
	public class WeaponTrail : MonoBehaviour
	{
		public void Update()
		{
			if (!((Component)this).GetComponentInChildren<MeleeWeapon>().isSwinging)
			{
				if (((Component)this).GetComponentInChildren<TrailRenderer>().emitting)
				{
					((Component)this).GetComponentInChildren<TrailRenderer>().emitting = false;
					((Component)this).GetComponentsInChildren<TrailRenderer>()[1].emitting = false;
				}
			}
			else if (!((Component)this).GetComponentInChildren<TrailRenderer>().emitting)
			{
				((Component)this).GetComponentInChildren<TrailRenderer>().emitting = true;
				((Component)this).GetComponentsInChildren<TrailRenderer>()[1].emitting = true;
			}
		}
	}
}
public class AddEffectToTarget : Move
{
	public GameObject effect;

	public override void DoMove(Rigidbody enemyWeapon, Rigidbody enemyTorso, DataHandler targetData)
	{
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: 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_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		Unit componentInParent = ((Component)enemyTorso).gameObject.GetComponentInParent<Unit>();
		GameObject val = Object.Instantiate<GameObject>(effect, UPool.MyPool.Pooler.transform);
		val.GetComponentsInChildren<ParticleSystemRenderer>();
		UnitEffectBase val2 = UnitEffectBase.AddEffectToTarget(((Component)((Component)componentInParent).transform).gameObject, val.GetComponent<UnitEffectBase>());
		if ((Object)(object)val2 == (Object)null)
		{
			GameObject obj = Object.Instantiate<GameObject>(val, ((Component)componentInParent).transform.root);
			obj.transform.position = ((Component)componentInParent).transform.position;
			obj.transform.rotation = Quaternion.LookRotation(componentInParent.data.mainRig.position);
			val2 = obj.GetComponent<UnitEffectBase>();
			TeamHolder.AddTeamHolder(obj, ((Component)((Component)this).transform.root).gameObject);
			val2.DoEffect();
		}
		((Component)val2).transform.rotation = Quaternion.LookRotation(componentInParent.data.mainRig.position);
		val2.Ping();
	}
}
public class StoneThrower : Move
{
	public class DestorySelf : MonoBehaviour
	{
		private void Start()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((Component)this).GetComponentInChildren<CollisionEvent>().collisionEvent.AddListener((UnityAction)delegate
			{
				Desrtoys();
			});
		}

		public void Desrtoys()
		{
			//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_003a: 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)
			Object.Instantiate<GameObject>(UManager.mod.GetAssetBundle("Mod").LoadAsset<GameObject>("E攻击效果 - 副本"), ((Component)this).transform.position, Quaternion.identity, (Transform)null).AddComponent<TeamHolder>().team = ((Component)this).GetComponentInChildren<TeamHolder>().team;
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}

	public class AddPos : MonoBehaviour
	{
		public Vector3 vector3;

		public void Start()
		{
			//IL_0007: 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)
			//IL_0012: 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)
			Transform transform = ((Component)this).transform;
			transform.position += vector3;
			((Component)this).transform.rotation = Quaternion.identity;
		}
	}

	public GameObject stonePrefab;

	public override void DoMove(Rigidbody enemyWeapon, Rigidbody enemyTorso, DataHandler targetData)
	{
		//IL_001c: 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_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		RangeWeapon componentInChildren = ((Component)((Component)this).transform.GetChild(0)).gameObject.GetComponentInChildren<RangeWeapon>();
		Vector3 position = ((Component)this).transform.position;
		Vector3 val = ((Component)this).transform.position - enemyTorso.position;
		((Weapon)componentInChildren).Attack(position, enemyTorso, ((Vector3)(ref val)).normalized, false);
	}

	private void Start()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		s.AddCopiedComponent<RangeWeapon>(((Component)((Component)this).transform.GetChild(0)).gameObject, ((GameObject)SLMALoader.SDic["weapons"]["CatapultRock"]).GetComponentInChildren<RangeWeapon>());
		((Component)((Component)this).transform.GetChild(0)).gameObject.GetComponentInChildren<RangeWeapon>().ObjectToSpawn = stonePrefab;
		((Weapon)((Component)((Component)this).transform.GetChild(0)).gameObject.GetComponentInChildren<RangeWeapon>()).connectedData = ((Component)this).GetComponentInParent<Unit>().data;
		((Component)((Component)this).transform.GetChild(0)).gameObject.GetComponentInChildren<RangeWeapon>().SoundRef = "";
		((Component)((Component)this).transform.GetChild(0)).gameObject.AddComponent<ShootPosition>();
	}
}
public class WeaponAddEffectPoss : CollisionWeaponEffect
{
	public UnitEffectBase EffectPrefab;

	public float poss;

	public bool ignoreTeamMates;

	public override void DoEffect(Transform hitTransform, Collision hit)
	{
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Expected O, but got Unknown
		//IL_00a4: 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_003c: Unknown result type (might be due to invalid IL or missing references)
		if (ignoreTeamMates)
		{
			Unit component = ((Component)((Component)this).transform.root).GetComponent<Unit>();
			Unit component2 = ((Component)hitTransform.root).GetComponent<Unit>();
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2) && component.Team == component2.Team)
			{
				return;
			}
		}
		Type type = ((object)EffectPrefab).GetType();
		if (Random.Range(0f, 100f) < poss)
		{
			UnitEffectBase val = (UnitEffectBase)((Component)hitTransform.root).GetComponentInChildren(type);
			if ((Object)(object)val == (Object)null)
			{
				GameObject obj = Object.Instantiate<GameObject>(((Component)EffectPrefab).gameObject, hitTransform.root);
				obj.transform.position = hitTransform.root.position;
				obj.GetComponent<UnitEffectBase>().DoEffect();
			}
			else
			{
				val.Ping();
			}
		}
	}
}
public class CanChangeMode : MonoBehaviour
{
}
public class HammerChageMode : Move
{
	public enum Mode
	{
		Common,
		Attack,
		Heal
	}

	public Mode mode;

	public Unit unit;

	public GameObject weapon;

	public Material red;

	public Material green;

	public GameObject Heal;

	public void Start()
	{
		unit = ((Component)this).GetComponentInParent<Unit>();
		weapon = ((Component)((Component)unit).GetComponentInChildren<WeaponHandler>().rightWeapon).gameObject;
		if (!Object.op_Implicit((Object)(object)weapon.GetComponent<CanChangeMode>()))
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
		mode = Mode.Common;
	}

	public override void DoMove(Rigidbody enemyWeapon, Rigidbody enemyTorso, DataHandler targetData)
	{
		if (mode == Mode.Common)
		{
			if (Random.Range(0, 2) == 1)
			{
				mode = Mode.Attack;
				((Component)weapon.transform.Find("Power")).GetComponentInChildren<ParticleSystem>().Play();
			}
			else
			{
				mode = Mode.Heal;
				((Component)weapon.transform.Find("Heal")).GetComponentInChildren<ParticleSystem>().Play();
				doHeal();
				doHeal();
			}
		}
		else if (mode == Mode.Attack)
		{
			mode = Mode.Heal;
			((Component)weapon.transform.Find("Heal")).GetComponentInChildren<ParticleSystem>().Play();
			doHeal();
			doHeal();
		}
		else if (mode == Mode.Heal)
		{
			mode = Mode.Attack;
			((Component)weapon.transform.Find("Power")).GetComponentInChildren<ParticleSystem>().Play();
		}
		CheckMat();
		CheckMode();
	}

	public void CheckMode()
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Expected O, but got Unknown
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Expected O, but got Unknown
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Expected O, but got Unknown
		if (mode == Mode.Attack)
		{
			weapon.GetComponentInChildren<CollisionWeapon>().dealDamageEvent = null;
			weapon.GetComponentInChildren<CollisionWeapon>().dealDamageEvent = new UnityEvent();
			weapon.GetComponentInChildren<CollisionWeapon>().dealDamageEvent.AddListener(new UnityAction(Explo));
			weapon.GetComponentInChildren<CollisionWeapon>().damage = 400f;
		}
		if (mode == Mode.Heal)
		{
			weapon.GetComponentInChildren<CollisionWeapon>().dealDamageEvent = null;
			weapon.GetComponentInChildren<CollisionWeapon>().dealDamageEvent = new UnityEvent();
			weapon.GetComponentInChildren<CollisionWeapon>().dealDamageEvent.AddListener(new UnityAction(doHeal));
			weapon.GetComponentInChildren<CollisionWeapon>().damage = 250f;
		}
	}

	public void CheckMat()
	{
		if (mode == Mode.Attack)
		{
			Material[] materials = ((Renderer)((Component)weapon.gameObject.transform.GetChild(3)).GetComponentInChildren<MeshRenderer>()).materials;
			((Renderer)((Component)weapon.gameObject.transform.GetChild(3)).GetComponentInChildren<MeshRenderer>()).materials = (Material[])(object)new Material[3]
			{
				materials[0],
				red,
				materials[2]
			};
			Debug.Log((object)mode);
			Debug.Log((object)((Renderer)((Component)weapon.gameObject.transform.GetChild(3)).GetComponentInChildren<MeshRenderer>()).materials[1]);
		}
		if (mode == Mode.Heal)
		{
			Material[] materials2 = ((Renderer)((Component)weapon.gameObject.transform.GetChild(3)).GetComponentInChildren<MeshRenderer>()).materials;
			((Renderer)((Component)weapon.gameObject.transform.GetChild(3)).GetComponentInChildren<MeshRenderer>()).materials = (Material[])(object)new Material[3]
			{
				materials2[0],
				green,
				materials2[2]
			};
			Debug.Log((object)mode);
			Debug.Log((object)((Renderer)((Component)weapon.gameObject.transform.GetChild(3)).GetComponentInChildren<MeshRenderer>()).materials[1]);
		}
	}

	public void Explo()
	{
		((Component)weapon.transform).GetComponentInChildren<Explosion>().Explode();
		((Component)((Component)weapon.GetComponentInChildren<Explosion>()).transform.GetChild(0)).GetComponentInChildren<ParticleSystem>().Play();
		((Component)((Component)weapon.GetComponentInChildren<Explosion>()).transform.GetChild(1)).GetComponentInChildren<ParticleSystem>().Play();
	}

	public void doHeal()
	{
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(Heal, UPool.MyPool.Pooler.transform);
		UnitEffectBase val2 = UnitEffectBase.AddEffectToTarget(((Component)((Component)unit).transform).gameObject, val.GetComponent<UnitEffectBase>());
		if ((Object)(object)val2 == (Object)null)
		{
			GameObject val3 = Object.Instantiate<GameObject>(val, ((Component)unit.data.hip).transform.root);
			val3.transform.position = ((Component)unit).transform.position;
			val3.transform.rotation = Quaternion.LookRotation(unit.data.mainRig.position);
			ParticleSystemRenderer[] componentsInChildren = val3.GetComponentsInChildren<ParticleSystemRenderer>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Object.Destroy((Object)(object)componentsInChildren[i]);
			}
			val2 = val3.GetComponent<UnitEffectBase>();
			TeamHolder.AddTeamHolder(val3, ((Component)unit).gameObject);
		}
		val2.DoEffect();
		((Component)val2).transform.rotation = Quaternion.LookRotation(unit.data.mainRig.position);
		val2.Ping();
	}
}
public class DoMoveWhenEffect : MonoBehaviour
{
	public Unit unit;

	private void Update()
	{
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Expected O, but got Unknown
		if (!Object.op_Implicit((Object)(object)((Component)unit).gameObject.GetComponentInChildren<UnitEffectBase>()))
		{
			return;
		}
		UnitEffectBase[] componentsInChildren = ((Component)unit).gameObject.GetComponentsInChildren<UnitEffectBase>();
		foreach (UnitEffectBase val in componentsInChildren)
		{
			if (((Object)val).name.ToUpper().Contains("FIRE") || ((Object)val).name.Contains("火"))
			{
				Object.Destroy((Object)(object)((Component)val).gameObject);
				Object.Instantiate<GameObject>(UManager.mod.GetAssetBundle("Mod").LoadAsset<GameObject>("火"), ((Component)((Component)((Component)this).GetComponentInParent<Unit>()).GetComponentInChildren<GooglyEye>()).gameObject.transform);
				((Component)this).GetComponentInChildren<ParticleSystem>().Play();
				((Component)this).GetComponentInChildren<CountEvent>().countEvent.AddListener((UnityAction)delegate
				{
					((Component)this).GetComponentInChildren<Explosion>().Explode();
				});
				((Component)this).GetComponentInChildren<CountEvent>().StartCounting();
				Object.Destroy((Object)(object)((Component)this).GetComponentInChildren<DoMoveWhenEffect>());
			}
		}
	}

	private void Start()
	{
		unit = ((Component)this).GetComponentInParent<Unit>();
	}
}

ChouChou's Units-part2.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 DARK;
using DM;
using FhpSLib.BundleModCore;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.AI.Components;
using Landfall.TABS.AI.Components.Tags;
using Landfall.TABS.AI.Systems;
using Landfall.TABS.GameMode;
using Landfall.TABS.GameState;
using Landfall.TABS.UnitEditor;
using SLMA;
using TFBGames;
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("fixmod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("made in SFT by FhpSlime")]
[assembly: AssemblyCopyright("Copyright ©  2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3a45c3cf-230c-4310-952f-0887d4266a22")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace DARK
{
	public static class UManager
	{
		public static string modname;

		public static string modder;

		private static string com;

		public static SLMABundleMod bundleMod;

		public static List<Unit> bases;

		static UManager()
		{
			modname = "SFT";
			modder = "FhpSlime";
			bases = new List<Unit>();
		}

		public static void SetRiders(UnitBlueprint me, UnitBlueprint[] riders)
		{
			s.SetField<UnitBlueprint>(me, "Riders", (object)riders);
		}

		public static void EditBlueprint(UnitBlueprint unit, LandfallContentDatabase db)
		{
			if (unit.Entity.Name == "瘟疫医生")
			{
				unit.voiceBundle = bundleMod.GetAssetBundle("dark").LoadAsset<VoiceBundle>("doctor_VoiceBundle 2");
				s.SetField<UnitBlueprint>(unit, "DeathRef", (object)unit.voiceBundle.DeathRef);
				s.SetField<UnitBlueprint>(unit, "VocalRef", (object)unit.voiceBundle.VocalRef);
				unit.UnitBase = bundleMod.GetAssetBundle("dark").LoadAsset<GameObject>("Humanoid 1");
				unit.health = 666f;
				unit.maxSizeRandom = 1f;
				unit.minSizeRandom = 1f;
				unit.forceCost = 3000u;
				unit.Entity.SetUnlockKey("darkon");
				unit.Validate();
				unit.sizeMultiplier = 1f;
				unit.RightWeapon = bundleMod.GetAssetBundle("dark").LoadAsset<GameObject>("手杖");
				unit.LeftWeapon = bundleMod.GetAssetBundle("dark").LoadAsset<GameObject>("提灯");
				ChineseLibrary.技能设置(unit, (GameObject[])(object)new GameObject[3]
				{
					bundleMod.GetAssetBundle("dark").LoadAsset<GameObject>("瘟疫召唤"),
					bundleMod.GetAssetBundle("dark").LoadAsset<GameObject>("黑雾"),
					bundleMod.GetAssetBundle("dark").LoadAsset<GameObject>("黑雾 1")
				});
				ChineseLibrary.服装设置(unit, (GameObject[])(object)new GameObject[7]
				{
					bundleMod.GetAssetBundle("dark").LoadAsset<GameObject>("医生上衣"),
					bundleMod.GetAssetBundle("dark").LoadAsset<GameObject>("医生帽子"),
					bundleMod.GetAssetBundle("dark").LoadAsset<GameObject>("医生披肩"),
					bundleMod.GetAssetBundle("dark").LoadAsset<GameObject>("医生腰带"),
					bundleMod.GetAssetBundle("dark").LoadAsset<GameObject>("医生裤子"),
					bundleMod.GetAssetBundle("dark").LoadAsset<GameObject>("医生面具"),
					bundleMod.GetAssetBundle("dark").LoadAsset<GameObject>("医生鞋子")
				});
			}
		}

		public static void EditClothes(GameObject cloth, CharacterItem item, PropItemData data, Unit unit, int index, LandfallContentDatabase db)
		{
		}

		public static void EditProjectiles(GameObject proj, ProjectileHit projhit, Unit unit, LandfallContentDatabase db)
		{
		}

		public static void EditCombatMoves(GameObject move, int index, Unit unit, 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_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_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_0097: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: 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_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Expected O, but got Unknown
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Expected O, but got Unknown
			if (unit.unitBlueprint.Entity.Name == "666" && Object.op_Implicit((Object)(object)move.GetComponentInChildren<DodgeMove>()) && index == 2)
			{
				move.GetComponentInChildren<DodgeMove>().moves[0].forceCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[5]
				{
					new Keyframe(0f, 0f),
					new Keyframe(1f, 1f),
					new Keyframe(2f, 1f),
					new Keyframe(0f, 0f),
					new Keyframe(0f, 0f)
				});
				move.GetComponentInChildren<DodgeMove>().forceMultiplier = -1f;
			}
			if (unit.unitBlueprint.Entity.Name == "666" && Object.op_Implicit((Object)(object)move.GetComponentInChildren<DodgeMove>()) && index == 3)
			{
				move.GetComponentInChildren<DodgeMove>().moves[0].forceCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[5]
				{
					new Keyframe(-1f, 1f),
					new Keyframe(1f, 1f),
					new Keyframe(5f, 4f),
					new Keyframe(0f, 0f),
					new Keyframe(0f, 0f)
				});
				move.GetComponentInChildren<DodgeMove>().forceMultiplier = -2f;
			}
			if (unit.unitBlueprint.Entity.Name == "666" && Object.op_Implicit((Object)(object)move.GetComponentInChildren<DodgeMove>()) && index == 4)
			{
				move.GetComponentInChildren<DodgeMove>().moves[0].forceCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[5]
				{
					new Keyframe(-1f, 1f),
					new Keyframe(1f, 1f),
					new Keyframe(5f, 4f),
					new Keyframe(0f, 0f),
					new Keyframe(0f, 0f)
				});
			}
		}

		public static void CodeAfterSpawn(Unit unit, LandfallContentDatabase db)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (unit.unitBlueprint.Entity.Name == "unit name")
			{
				Transform head = unit.data.head;
				head.localScale *= 2f;
			}
		}

		public static void Init(LandfallContentDatabase db)
		{
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Expected O, but got Unknown
			//IL_01b2: Expected O, but got Unknown
			com = "Bundle Mod Init";
			com = "Bundle Mod Init";
			AssetBundle val;
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("dark"))
			{
				val = AssetBundle.LoadFromStream(stream);
			}
			if (Loader.BundleMode)
			{
				SLMABundleMod obj = SLMABundleMod.CreatSLMABundleMod("TestMod", "0.0.1");
				obj.AddAssetBundle("dark", val);
				obj.Dev_mode = true;
				obj.LoadAssetBundle("dark");
				bundleMod = obj;
			}
			SoundBank soundBank = ServiceLocator.GetService<SoundPlayer>().soundBank;
			SoundBank[] array = bundleMod.GetAssetBundle("dark").LoadAllAssets<SoundBank>();
			if (array != null)
			{
				List<SoundBankCategory> list = soundBank.Categories.ToList();
				SoundBank[] array2 = array;
				foreach (SoundBank val2 in array2)
				{
					if ((Object)(object)val2 != (Object)null)
					{
						list.AddRange(val2.Categories);
					}
				}
				soundBank.Categories = list.ToArray();
			}
			VoiceBundle[] array3 = bundleMod.GetAssetBundle("dark").LoadAllAssets<VoiceBundle>();
			if (array3 != null && array3.Length != 0)
			{
				VoiceBundleDatabaseUpdater.AddVoiceBundles(array3.ToList());
			}
			else
			{
				Debug.LogError((object)"No VoiceBundle found in the loaded AssetBundle.");
			}
			new GameObject
			{
				name = "MapsCore",
				hideFlags = (HideFlags)52
			}.AddComponent<ScenesManager>();
			bundleMod.GetAssetBundle("dark").LoadAllAssets<VoiceBundle>();
			MyModItems.GetInstance();
			SLMATool.CreateUnit("瘟疫医生", (UnitBlueprint)SLMALoader.SDic["blueprints"]["UNIT_TRIBAL_THROWER_SPEAR"], (Faction)SLMALoader.SDic["factions"]["Secret"], bundleMod.GetAssetBundle("dark").LoadAsset<Sprite>("瘟疫医生图标2"));
			com = "——————————Fations and Units——————————";
			com = "——————————Clothes——————————";
			com = "——————————Weapons——————————";
			com = "——————————Effects——————————";
			com = "——————————Explosions——————————";
			com = "——————————UnitBases——————————";
			com = "——————————Projectiles——————————";
			com = "——————————Moves——————————";
		}

		public static void EditWeapons(GameObject weapon, Team team, Unit unit, MeleeWeapon melee, RangeWeapon range, LandfallContentDatabase db)
		{
		}

		public static void SetMoveConditionalValue(this ConditionalEventInstance gameObject, ConditionType type, ValueType valuet, float value)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_004d: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			bool flag = false;
			EventCondition[] conditions = gameObject.conditions;
			foreach (EventCondition val in conditions)
			{
				if (val.conditionType == type)
				{
					val.valueType = valuet;
					val.value = value;
					flag = true;
				}
			}
			if (!flag)
			{
				List<EventCondition> list = gameObject.conditions.ToList();
				list.Add(new EventCondition
				{
					conditionType = type,
					valueType = valuet,
					value = value
				});
				gameObject.conditions = list.ToArray();
			}
		}
	}
	[BepInPlugin("dark", "dark", "1.0.0")]
	internal class Loader : BaseUnityPlugin
	{
		public static bool BundleMode;

		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 WaitForSecondsRealtime(0.3f);
			SLMALoader.GetInstance();
			LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
			UManager.Init(landfallContentDatabase);
			new Harmony(UManager.modname).PatchAll();
			GOSLMA.EditWeapons = ((GOSLMA.EditWeapons == null) ? new Action<GameObject, Team, Unit, MeleeWeapon, RangeWeapon, LandfallContentDatabase>(UManager.EditWeapons) : ((Action<GameObject, Team, Unit, MeleeWeapon, RangeWeapon, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, Team, Unit, MeleeWeapon, RangeWeapon, LandfallContentDatabase>(UManager.EditWeapons), GOSLMA.EditWeapons)));
			GOSLMA.EditClothes = ((GOSLMA.EditClothes == null) ? new Action<GameObject, CharacterItem, PropItemData, Unit, int, LandfallContentDatabase>(UManager.EditClothes) : ((Action<GameObject, CharacterItem, PropItemData, Unit, int, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, CharacterItem, PropItemData, Unit, int, LandfallContentDatabase>(UManager.EditClothes), GOSLMA.EditClothes)));
			GOSLMA.EditCombatMoves = ((GOSLMA.EditCombatMoves == null) ? new Action<GameObject, int, Unit, LandfallContentDatabase>(UManager.EditCombatMoves) : ((Action<GameObject, int, Unit, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, int, Unit, LandfallContentDatabase>(UManager.EditCombatMoves), GOSLMA.EditCombatMoves)));
			GOSLMA.CodeAfterSpawn = ((GOSLMA.CodeAfterSpawn == null) ? new Action<Unit, LandfallContentDatabase>(UManager.CodeAfterSpawn) : ((Action<Unit, LandfallContentDatabase>)Delegate.Combine(new Action<Unit, LandfallContentDatabase>(UManager.CodeAfterSpawn), GOSLMA.CodeAfterSpawn)));
			GOSLMA.EditProjectiles = ((GOSLMA.EditProjectiles == null) ? new Action<GameObject, ProjectileHit, Unit, LandfallContentDatabase>(UManager.EditProjectiles) : ((Action<GameObject, ProjectileHit, Unit, LandfallContentDatabase>)Delegate.Combine(new Action<GameObject, ProjectileHit, Unit, LandfallContentDatabase>(UManager.EditProjectiles), GOSLMA.EditProjectiles)));
			UnitBlueprint[] array = Resources.FindObjectsOfTypeAll<UnitBlueprint>();
			for (int i = 0; i < array.Length; i++)
			{
				UManager.EditBlueprint(array[i], landfallContentDatabase);
			}
			Debug.Log((object)("Loaded " + UManager.modname + " Successfully"));
			Debug.Log((object)(UManager.modname + "is made in SFT by FhpSlime"));
			Debug.Log((object)(UManager.modder + "wished you a pleasant trip"));
		}

		static Loader()
		{
			BundleMode = true;
		}
	}
}
public class Item : MonoBehaviour
{
	public enum kind
	{
		Weapon,
		Cloth,
		Skill,
		Unit,
		Projectile,
		Other
	}

	public string name;

	public kind Kind;
}
namespace DARK
{
	public class MyModItems : MonoBehaviour
	{
		private static Dictionary<string, Item> items;

		private static MyModItems instance { get; set; }

		public static MyModItems GetInstance()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)instance == (Object)null)
			{
				instance = new GameObject("MyModItems").AddComponent<MyModItems>();
				Object.DontDestroyOnLoad((Object)(object)instance);
			}
			return instance;
		}

		public void AddItem(Item item)
		{
			items.Add(item.name, item);
		}

		public Item GetItem(string name)
		{
			Item value = new Item
			{
				name = null,
				Kind = Item.kind.Other
			};
			items.TryGetValue(name, out value);
			return value;
		}
	}
}
public class Example : MonoBehaviour
{
	public GameObject prefab;

	private void Start()
	{
		if ((Object)(object)prefab != (Object)null)
		{
			Transform[] componentsInChildren = prefab.GetComponentsInChildren<Transform>();
			if (componentsInChildren.Length > 1)
			{
				_ = componentsInChildren[1];
			}
		}
	}
}
public class VoiceBundleDatabaseUpdater
{
	public static void AddVoiceBundles(IEnumerable<VoiceBundle> newVoiceBundles)
	{
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
		FieldInfo field = typeof(LandfallContentDatabase).GetField("m_voiceBundles", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field == null)
		{
			Debug.LogError((object)"m_voiceBundles field not found.");
			return;
		}
		Dictionary<DatabaseID, VoiceBundle> voiceBundlesDictionary = (Dictionary<DatabaseID, VoiceBundle>)field.GetValue(landfallContentDatabase);
		if (voiceBundlesDictionary == null)
		{
			Debug.LogError((object)"m_voiceBundles dictionary is null.");
			return;
		}
		Func<VoiceBundle, bool> predicate = (VoiceBundle voiceBundle) => Object.op_Implicit((Object)(object)voiceBundle) && voiceBundlesDictionary != null && !voiceBundlesDictionary.ContainsKey(voiceBundle.Entity.GUID);
		foreach (VoiceBundle item in newVoiceBundles.Where(predicate))
		{
			voiceBundlesDictionary.Add(item.Entity.GUID, item);
		}
		field.SetValue(landfallContentDatabase, voiceBundlesDictionary);
		Debug.Log((object)$"{newVoiceBundles.Count()} VoiceBundles added to the database.");
	}
}
public class ChangeMaterial : MonoBehaviour
{
	private List<Material> originalMaterials = new List<Material>();

	private Team team;

	[Header("Material Settings")]
	public Renderer renderer;

	public int index;

	public Material newMaterial;

	[Header("Team Color Settings")]
	public Material redMaterial;

	public Material blueMaterial;

	public void Start()
	{
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: 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_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		Material[] materials = renderer.materials;
		foreach (Material val in materials)
		{
			originalMaterials.Add(Object.Instantiate<Material>(val));
		}
		Unit component = ((Component)((Component)this).transform.root).GetComponent<Unit>();
		TeamHolder component2 = ((Component)this).GetComponent<TeamHolder>();
		TeamHolder componentInParent = ((Component)this).GetComponentInParent<TeamHolder>();
		TeamHolder componentInChildren = ((Component)this).GetComponentInChildren<TeamHolder>();
		if (Object.op_Implicit((Object)(object)component))
		{
			team = component.Team;
		}
		else if (Object.op_Implicit((Object)(object)component2))
		{
			team = component2.team;
		}
		else if (Object.op_Implicit((Object)(object)componentInParent))
		{
			team = componentInParent.team;
		}
		else if (Object.op_Implicit((Object)(object)componentInChildren))
		{
			team = componentInChildren.team;
		}
	}

	public void MaterialChange(float speed)
	{
		((MonoBehaviour)this).StartCoroutine(DoMaterialChange(index, Object.Instantiate<Material>(renderer.materials[index]), newMaterial, speed));
	}

	public void MaterialRevert(float speed)
	{
		((MonoBehaviour)this).StopAllCoroutines();
		((MonoBehaviour)this).StartCoroutine(DoMaterialChange(index, newMaterial, originalMaterials[index], speed));
	}

	public void MaterialTeamChange(float speed)
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		((MonoBehaviour)this).StopAllCoroutines();
		((MonoBehaviour)this).StartCoroutine(DoMaterialChange(index, Object.Instantiate<Material>(renderer.materials[index]), ((int)team == 0) ? redMaterial : blueMaterial, speed));
	}

	public void MaterialTeamRevert(float speed)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		((MonoBehaviour)this).StopAllCoroutines();
		((MonoBehaviour)this).StartCoroutine(DoMaterialChange(index, ((int)team == 0) ? redMaterial : blueMaterial, originalMaterials[index], speed));
	}

	public void AllMaterialsChange(float speed)
	{
		((MonoBehaviour)this).StopAllCoroutines();
		for (int i = 0; i < renderer.materials.Length; i++)
		{
			((MonoBehaviour)this).StartCoroutine(DoMaterialChange(i, Object.Instantiate<Material>(renderer.materials[i]), newMaterial, speed));
		}
	}

	public void AllMaterialsRevert(float speed)
	{
		((MonoBehaviour)this).StopAllCoroutines();
		for (int i = 0; i < renderer.materials.Length; i++)
		{
			((MonoBehaviour)this).StartCoroutine(DoMaterialChange(i, newMaterial, originalMaterials[i], speed));
		}
	}

	public void AllMaterialsTeamChange(float speed)
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		((MonoBehaviour)this).StopAllCoroutines();
		for (int i = 0; i < renderer.materials.Length; i++)
		{
			((MonoBehaviour)this).StartCoroutine(DoMaterialChange(i, Object.Instantiate<Material>(renderer.materials[i]), ((int)team == 0) ? redMaterial : blueMaterial, speed));
		}
	}

	public void AllMaterialsTeamRevert(float speed)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		((MonoBehaviour)this).StopAllCoroutines();
		for (int i = 0; i < renderer.materials.Length; i++)
		{
			((MonoBehaviour)this).StartCoroutine(DoMaterialChange(i, ((int)team == 0) ? redMaterial : blueMaterial, originalMaterials[i], speed));
		}
	}

	public void Stop()
	{
		((MonoBehaviour)this).StopAllCoroutines();
	}

	private IEnumerator DoMaterialChange(int indexToLerp, Material materialToStartWith, Material matToLerpTo, float lerpSpeed)
	{
		float t = 0f;
		while (t < 1f && !Object.op_Implicit((Object)(object)((Component)((Component)this).transform.root).GetComponentsInChildren<UnitEffectBase>().ToList().Find((UnitEffectBase x) => x.effectID == 1987)))
		{
			t += Time.deltaTime * lerpSpeed;
			renderer.materials[indexToLerp].Lerp(materialToStartWith, matToLerpTo, Mathf.Clamp(t, 0f, 1f));
			yield return null;
		}
	}
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class DeathPatch
{
	[HarmonyPrefix]
	public static bool Prefix(DataHandler __instance, ref bool value)
	{
		if (value && !(bool)GetField(typeof(DataHandler), __instance, "dead"))
		{
			GameModeService service = ServiceLocator.GetService<GameModeService>();
			if (service.CurrentGameMode == null)
			{
				Debug.LogError((object)"Could not find CurrentGameMode!");
			}
			else if (!__instance.healthHandler.willBeRewived)
			{
				service.CurrentGameMode.OnUnitDied(__instance.unit);
			}
		}
		SetField(__instance, "dead", value);
		return false;
	}

	public static object GetField(Type type, object instance, string fieldName)
	{
		BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
		return type.GetField(fieldName, bindingAttr).GetValue(instance);
	}

	public static void SetField<T>(object originalObject, string fieldName, T newValue)
	{
		BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
		originalObject.GetType().GetField(fieldName, bindingAttr).SetValue(originalObject, newValue);
	}
}
public class Effect_Plague : UnitEffectBase
{
	public enum ZombificationType
	{
		Standard,
		Virus,
		Support
	}

	private Unit unit;

	private GameObject weapon1;

	private GameObject weapon2;

	private bool done;

	[Header("Zombification")]
	public ZombificationType zombieType;

	private float currentProgress;

	public float progressToAdd = 100f;

	[Header("Revive")]
	public UnityEvent reviveEvent;

	public float reviveDelay;

	[Range(0f, 1f)]
	public float reviveHealthMultiplier = 0.5f;

	public float reviveTargetingPriority = 0.2f;

	public GameObject reviveWeapon;

	public List<GameObject> reviveAbilities = new List<GameObject>();

	public GameObject reviveEye;

	public GameObject zombieStats;

	[Header("Color")]
	public UnitColorInstance color = new UnitColorInstance();

	private float lerpProgress;

	public float lerpSpeed = 1f;

	public override void DoEffect()
	{
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Invalid comparison between Unknown and I4
		unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
		if (Object.op_Implicit((Object)(object)unit.holdingHandler))
		{
			weapon1 = (Object.op_Implicit((Object)(object)unit.holdingHandler.rightObject) ? ((Component)unit.holdingHandler.rightObject).gameObject : null);
			weapon2 = (Object.op_Implicit((Object)(object)unit.holdingHandler.leftObject) ? ((Component)unit.holdingHandler.leftObject).gameObject : null);
			if (zombieType != ZombificationType.Virus)
			{
				if (Object.op_Implicit((Object)(object)weapon1) && Object.op_Implicit((Object)(object)weapon1.GetComponent<Holdable>()))
				{
					weapon1.GetComponent<Holdable>().ignoreDissarm = true;
				}
				if (Object.op_Implicit((Object)(object)weapon2) && Object.op_Implicit((Object)(object)weapon2.GetComponent<Holdable>()))
				{
					weapon2.GetComponent<Holdable>().ignoreDissarm = true;
				}
			}
		}
		UnitEffectBase val = ((Component)unit).GetComponentsInChildren<UnitEffectBase>().ToList().Find((UnitEffectBase x) => x.effectID == 1984);
		if ((Object.op_Implicit((Object)(object)val) && (Object)(object)val != (Object)(object)this) || (int)unit.unitType == 1)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			unit.data.healthHandler.RemoveDieAction((Action)Revive);
		}
		else
		{
			unit.data.healthHandler.AddDieAction((Action)Revive);
		}
		((UnitEffectBase)this).Ping();
	}

	public override void Ping()
	{
		if (!done)
		{
			currentProgress += Mathf.Clamp(progressToAdd / unit.data.health, 0f, 1f);
			if (zombieType != ZombificationType.Support)
			{
				AddLerpProgress();
			}
			else
			{
				((MonoBehaviour)this).StartCoroutine(DoZombieChecks());
			}
		}
	}

	public void AddLerpProgress()
	{
		if (!done || zombieType == ZombificationType.Support)
		{
			((MonoBehaviour)this).StopCoroutine(DoLerp());
			((MonoBehaviour)this).StartCoroutine(DoLerp());
		}
	}

	public IEnumerator DoLerp()
	{
		if (!done || zombieType == ZombificationType.Support)
		{
			float c = 0f;
			float startProgress = lerpProgress;
			while (c < 1f)
			{
				c += Mathf.Clamp(Time.deltaTime * lerpSpeed, 0f, 1f);
				lerpProgress = Mathf.Lerp(startProgress, currentProgress, c);
				yield return null;
			}
			((MonoBehaviour)this).StartCoroutine(DoZombieChecks());
		}
	}

	public IEnumerator DoZombieChecks()
	{
		if (done)
		{
			yield break;
		}
		yield return (object)new WaitForEndOfFrame();
		if (done)
		{
			yield break;
		}
		if (currentProgress >= 0.5f)
		{
			unit.data.healthHandler.willBeRewived = true;
			if (Object.op_Implicit((Object)(object)((Component)unit).GetComponentInChildren<AddRigidbodyOnDeath>()))
			{
				AddRigidbodyOnDeath[] componentsInChildren = ((Component)unit).GetComponentsInChildren<AddRigidbodyOnDeath>();
				foreach (AddRigidbodyOnDeath val in componentsInChildren)
				{
					unit.data.healthHandler.RemoveDieAction((Action)val.Die);
					Object.Destroy((Object)(object)val);
				}
			}
			if (Object.op_Implicit((Object)(object)((Component)unit).GetComponentInChildren<SinkOnDeath>()))
			{
				SinkOnDeath[] componentsInChildren2 = ((Component)unit).GetComponentsInChildren<SinkOnDeath>();
				foreach (SinkOnDeath val2 in componentsInChildren2)
				{
					unit.data.healthHandler.RemoveDieAction((Action)val2.Sink);
					Object.Destroy((Object)(object)val2);
				}
			}
			if (Object.op_Implicit((Object)(object)((Component)unit).GetComponentInChildren<RemoveJointsOnDeath>()))
			{
				RemoveJointsOnDeath[] componentsInChildren3 = ((Component)unit).GetComponentsInChildren<RemoveJointsOnDeath>();
				foreach (RemoveJointsOnDeath val3 in componentsInChildren3)
				{
					unit.data.healthHandler.RemoveDieAction((Action)val3.Die);
					Object.Destroy((Object)(object)val3);
				}
			}
			if (Object.op_Implicit((Object)(object)((Component)unit).GetComponentInChildren<DisableAllSkinnedClothes>()))
			{
				DisableAllSkinnedClothes[] componentsInChildren4 = ((Component)unit).GetComponentsInChildren<DisableAllSkinnedClothes>();
				for (int j = 0; j < componentsInChildren4.Length; j++)
				{
					Object.Destroy((Object)(object)componentsInChildren4[j]);
				}
			}
		}
		if (currentProgress >= 1f && zombieType != ZombificationType.Support)
		{
			((Damagable)unit.data.healthHandler).TakeDamage(unit.data.maxHealth, Vector3.zero, unit, (DamageType)3);
		}
	}

	public void Revive()
	{
		if (!done && unit.data.healthHandler.willBeRewived)
		{
			done = true;
			((MonoBehaviour)this).StartCoroutine(DoRevive());
		}
	}

	public IEnumerator DoRevive()
	{
		ServiceLocator.GetService<GameModeService>().CurrentGameMode.OnUnitDied(unit);
		Team newTeam = ((zombieType != ZombificationType.Support) ? ((Team)(((int)unit.data.team == 0) ? 1 : 0)) : unit.data.team);
		unit.data.team = newTeam;
		unit.Team = newTeam;
		unit.targetingPriorityMultiplier = reviveTargetingPriority;
		GameObjectEntity component = ((Component)unit).GetComponent<GameObjectEntity>();
		component.EntityManager.RemoveComponent<IsDead>(component.Entity);
		component.EntityManager.AddComponent(component.Entity, ComponentType.Create<UnitTag>());
		component.EntityManager.SetSharedComponentData<Team>(component.Entity, new Team
		{
			Value = (int)unit.Team
		});
		World.Active.GetOrCreateManager<TeamSystem>().AddUnit(component.Entity, ((Component)unit).gameObject, ((Component)unit).transform, unit.data.mainRig, unit.data, newTeam, unit, false);
		if (zombieType == ZombificationType.Support)
		{
			AddLerpProgress();
		}
		yield return (object)new WaitForSeconds(reviveDelay);
		unit.data.Dead = false;
		unit.dead = false;
		unit.data.hasBeenRevived = true;
		unit.data.healthHandler.willBeRewived = false;
		unit.data.ragdollControl = 1f;
		unit.data.muscleControl = 1f;
		unit.data.health = unit.data.maxHealth * reviveHealthMultiplier;
		if (zombieType == ZombificationType.Virus)
		{
			if (Object.op_Implicit((Object)(object)unit.holdingHandler))
			{
				if (Object.op_Implicit((Object)(object)weapon1))
				{
					weapon1.AddComponent<RemoveAfterSeconds>().shrink = true;
				}
				if (Object.op_Implicit((Object)(object)weapon2))
				{
					weapon1.AddComponent<RemoveAfterSeconds>().shrink = true;
				}
				unit.holdingHandler.LetGoOfAll();
				unit.unitBlueprint.SetWeapon(unit, newTeam, reviveWeapon, new PropItemData(), (HandType)0, unit.data.mainRig.rotation, new List<GameObject>(), false);
				unit.unitBlueprint.SetWeapon(unit, newTeam, reviveWeapon, new PropItemData(), (HandType)1, unit.data.mainRig.rotation, new List<GameObject>(), false);
			}
		}
		else
		{
			if (Object.op_Implicit((Object)(object)weapon1) && Object.op_Implicit((Object)(object)weapon1.GetComponent<Holdable>()))
			{
				weapon1.GetComponent<Holdable>().ignoreDissarm = false;
			}
			if (Object.op_Implicit((Object)(object)weapon2) && Object.op_Implicit((Object)(object)weapon2.GetComponent<Holdable>()))
			{
				weapon2.GetComponent<Holdable>().ignoreDissarm = false;
			}
		}
		foreach (GameObject reviveAbility in reviveAbilities)
		{
			Object.Instantiate<GameObject>(reviveAbility, ((Component)unit).transform.position, ((Component)unit).transform.rotation, ((Component)unit).transform);
		}
		if (Object.op_Implicit((Object)(object)((Component)unit).GetComponentInChildren<TeamColor>()))
		{
			TeamColor[] componentsInChildren = ((Component)unit).GetComponentsInChildren<TeamColor>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].SetTeamColor(newTeam);
			}
		}
		if (Object.op_Implicit((Object)(object)((Component)unit.data).GetComponent<StandingHandler>()) && (((Object)unit).name.Contains("Humanoid") || ((Object)unit).name.Contains("Stiffy") || ((Object)unit).name.Contains("Blackbeard") || ((Object)unit).name.Contains("Halfling")))
		{
			RandomCharacterStats obj = ((Component)unit.data).gameObject.AddComponent<RandomCharacterStats>();
			obj.minStandingOffset = zombieStats.GetComponent<RandomCharacterStats>().minStandingOffset;
			obj.maxStandingOffset = zombieStats.GetComponent<RandomCharacterStats>().maxStandingOffset;
			obj.minMovement = zombieStats.GetComponent<RandomCharacterStats>().minMovement;
			obj.maxMovemenmt = zombieStats.GetComponent<RandomCharacterStats>().maxMovemenmt;
			obj.randomCurve = zombieStats.GetComponent<RandomCharacterStats>().randomCurve;
		}
		if (Object.op_Implicit((Object)(object)((Component)unit).GetComponentInChildren<EyeSpawner>()))
		{
			EyeSpawner[] componentsInChildren2 = ((Component)unit).GetComponentsInChildren<EyeSpawner>();
			foreach (EyeSpawner val in componentsInChildren2)
			{
				foreach (GooglyEye spawnedEye in val.spawnedEyes)
				{
					GooglyEyes.instance.eyes.Remove(spawnedEye);
					Object.Destroy((Object)(object)((Component)spawnedEye).gameObject);
				}
				val.spawnedEyes.Clear();
				val.eyeObject = reviveEye;
				((object)val).GetType().GetMethod("Awake", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(val, new object[0]);
			}
		}
		unit.api.SetTargetingType(unit.unitBlueprint.TargetingComponent);
		ServiceLocator.GetService<UnitHealthbars>().HandleUnitSpawned(unit);
		unit.api.UpdateECSValues();
		unit.InitializeUnit(newTeam);
		reviveEvent.Invoke();
	}

	public void Update()
	{
		if (Object.op_Implicit((Object)(object)unit))
		{
			((Component)unit.data).GetComponent<UnitColorHandler>().SetColor(color, lerpProgress);
		}
	}
}
public class PlaguePhases : MonoBehaviour
{
	public enum PlagueState
	{
		Alive,
		Sickly,
		Zombie
	}

	private Unit unit;

	public PlagueState currentState;

	public Renderer renderer;

	public Renderer sickRenderer;

	public Renderer zombieRenderer;

	public ParticleSystem part;

	public List<Material> sicklyMaterials = new List<Material>();

	public List<int> aliveMaterialIndexes = new List<int>();

	public GameObject reviveEye;

	public float sickenTime = 6f;

	private void Start()
	{
		unit = ((Component)((Component)this).transform.root).GetComponent<Unit>();
		unit.data.healthHandler.willBeRewived = false;
	}

	public void BeginTransition()
	{
		((MonoBehaviour)this).StartCoroutine(DoSickening());
	}

	private IEnumerator DoSickening()
	{
		((MonoBehaviour)this).StartCoroutine(PlayPartWithDelay(sickenTime - 0.5f));
		List<Material> storedAliveMaterials = new List<Material>();
		foreach (int aliveMaterialIndex in aliveMaterialIndexes)
		{
			storedAliveMaterials.Add(Object.Instantiate<Material>(renderer.materials[aliveMaterialIndex]));
		}
		float t = 0f;
		while (t < sickenTime && !unit.data.Dead)
		{
			for (int i = 0; i < aliveMaterialIndexes.Count; i++)
			{
				renderer.materials[aliveMaterialIndexes[i]].Lerp(storedAliveMaterials[i], sicklyMaterials[i], t / sickenTime);
			}
			t += Time.deltaTime;
			yield return null;
		}
		if (unit.data.Dead)
		{
			part.Stop();
			Object.Destroy((Object)(object)((Component)this).gameObject);
			yield break;
		}
		currentState = PlagueState.Sickly;
		SetRenderer();
		if (Object.op_Implicit((Object)(object)((Component)unit).GetComponentInChildren<EyeSpawner>()))
		{
			EyeSpawner[] componentsInChildren = ((Component)unit).GetComponentsInChildren<EyeSpawner>();
			foreach (EyeSpawner val in componentsInChildren)
			{
				foreach (GooglyEye spawnedEye in val.spawnedEyes)
				{
					Object.Destroy((Object)(object)((Component)spawnedEye).gameObject);
				}
				val.spawnedEyes.Clear();
				val.eyeObject = reviveEye;
				((object)val).GetType().GetMethod("Awake", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(val, new object[0]);
			}
		}
		((MonoBehaviour)this).StartCoroutine(PlayPartWithDelay(0.5f));
	}

	public IEnumerator PlayPartWithDelay(float delay = 0f)
	{
		yield return (object)new WaitForSeconds(delay);
		part.Play();
	}

	public void SetRenderer()
	{
		if (currentState == PlagueState.Alive)
		{
			((Component)renderer).gameObject.SetActive(true);
			((Component)sickRenderer).gameObject.SetActive(false);
			((Component)zombieRenderer).gameObject.SetActive(false);
		}
		else if (currentState == PlagueState.Sickly)
		{
			((Component)renderer).gameObject.SetActive(false);
			((Component)sickRenderer).gameObject.SetActive(true);
			((Component)zombieRenderer).gameObject.SetActive(false);
		}
		else if (currentState == PlagueState.Zombie)
		{
			((Component)renderer).gameObject.SetActive(false);
			((Component)sickRenderer).gameObject.SetActive(false);
			((Component)zombieRenderer).gameObject.SetActive(true);
		}
	}
}
public class RiseOnSpawn : MonoBehaviour
{
	private DataHandler ownData;

	public float startDelay;

	public float time = 2f;

	public float moveMultiplier = 0.6f;

	public bool setRigsKinematic;

	public bool setArmsKinematic;

	private void Start()
	{
		ownData = ((Component)this).GetComponent<Unit>().data;
		((MonoBehaviour)this).StartCoroutine(DoRise());
	}

	private IEnumerator DoRise()
	{
		ownData.mainRig.isKinematic = true;
		yield return (object)new WaitForSeconds(startDelay);
		float t = 0f;
		Rigidbody[] allRigs;
		while (t < time)
		{
			allRigs = ownData.allRigs.AllRigs;
			foreach (Rigidbody val in allRigs)
			{
				if (setRigsKinematic && (setArmsKinematic || ((Object)(object)((Component)val).transform != (Object)(object)ownData.leftArm && (Object)(object)((Component)val).transform != (Object)(object)ownData.rightArm && (Object)(object)((Component)val).transform != (Object)(object)ownData.leftHand && (Object)(object)((Component)val).transform != (Object)(object)ownData.rightHand)))
				{
					val.isKinematic = true;
				}
			}
			Transform transform = ((Component)this).transform;
			transform.position += Vector3.up * (Mathf.Clamp(t * 0.1f, 0f, 1f) * Time.deltaTime * moveMultiplier);
			t += Time.deltaTime;
			yield return null;
		}
		allRigs = ownData.allRigs.AllRigs;
		for (int i = 0; i < allRigs.Length; i++)
		{
			allRigs[i].isKinematic = false;
		}
	}
}
public class ChangeSpriteColor : MonoBehaviour
{
	[Header("Material Settings")]
	public SpriteRenderer spriteRenderer;

	public Color newColor;

	public void SpriteColorChange(float speed)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		((MonoBehaviour)this).StartCoroutine(DoSpriteColorChange(newColor, speed));
	}

	public void AllSpritesColorChange(float speed)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		SpriteRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<SpriteRenderer>();
		foreach (SpriteRenderer targetRenderer in componentsInChildren)
		{
			((MonoBehaviour)this).StartCoroutine(DoSpriteColorChange(newColor, speed, targetRenderer));
		}
	}

	public void SpriteColorRevert(float speed)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		((MonoBehaviour)this).StartCoroutine(DoSpriteColorChange(spriteRenderer.color, speed));
	}

	public void AllSpritesColorRevert(float speed)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		SpriteRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<SpriteRenderer>();
		foreach (SpriteRenderer val in componentsInChildren)
		{
			((MonoBehaviour)this).StartCoroutine(DoSpriteColorChange(val.color, speed, val));
		}
	}

	private IEnumerator DoSpriteColorChange(Color targetColor, float lerpSpeed, SpriteRenderer targetRenderer = null)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		SpriteRenderer sr = (((Object)(object)targetRenderer != (Object)null) ? targetRenderer : spriteRenderer);
		float t = 0f;
		while (t < 1f)
		{
			t += Time.deltaTime * lerpSpeed;
			sr.color = Color.Lerp(sr.color, targetColor, Mathf.Clamp01(t));
			yield return null;
		}
	}
}
public class SCModTools
{
	public static UnitBlueprint CloneUnit(DatabaseID targetID)
	{
		//IL_002c: 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)
		Dictionary<DatabaseID, UnitBlueprint> dictionary = (Dictionary<DatabaseID, UnitBlueprint>)typeof(LandfallContentDatabase).GetField("m_unitBlueprints", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ContentDatabase.Instance().LandfallContentDatabase);
		if (dictionary.TryGetValue(targetID, out var value))
		{
			UnitBlueprint val = Object.Instantiate<UnitBlueprint>(value);
			((Object)val).name = value.Entity.Name + "_Clone";
			val.Entity.Name = value.Entity.Name + "_Clone";
			val.Entity.GenerateNewID();
			dictionary.Add(val.Entity.GUID, val);
			typeof(LandfallContentDatabase).GetField("m_unitBlueprints", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(ContentDatabase.Instance().LandfallContentDatabase, dictionary);
			return val;
		}
		return null;
	}

	public extern void GetSprite();

	public static Sprite GetSprite(string name)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name);
		Texture2D val = new Texture2D(4, 4);
		byte[] array = new byte[stream.Length];
		stream.Read(array, 0, (int)stream.Length);
		ImageConversion.LoadImage(val, array);
		return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
	}
}
public class newice : UnitEffectBase
{
	public float effectAmount = 10f;

	public float dragPerAmount = 1f;

	public float removeDragSpeed = 2f;

	private RigidbodyHolder rigHolder;

	private const float UpdateEffectColorTimeInterval = 0.6f;

	public Color fostColor;

	public UnitColorInstance color;

	public Material iceMaterial;

	public float amount;

	private float healthMultiplier = 1f;

	private WeaponHandler weapons;

	private DataHandler data;

	private DragHandler dragHandler;

	private UnitColorHandler colorHandler;

	private bool done;

	private float timer;

	private INetworkService m_networkService;

	private NetworkBattleController m_networkBattle;

	[SerializeField]
	private float maxAmount = 100f;

	private NetworkBattleController NetworkBattle
	{
		get
		{
			if ((Object)(object)m_networkBattle == (Object)null)
			{
				m_networkBattle = ServiceLocator.GetService<NetworkBattleController>();
			}
			return m_networkBattle;
		}
	}

	private void Start()
	{
		m_networkService = ServiceLocator.GetService<INetworkService>();
		m_networkBattle = ServiceLocator.GetService<NetworkBattleController>();
	}

	private void Update()
	{
		if (done || !Object.op_Implicit((Object)(object)rigHolder) || (data.Dead && !((UnitEffectBase)this).ShouldSkipDeadTests))
		{
			return;
		}
		bool flag = false;
		for (int i = 0; i < rigHolder.AllDrags.Length; i++)
		{
			if (rigHolder.AllDrags[i].x > rigHolder.defaultDrags[i].x)
			{
				flag = true;
				Vector2[] allDrags = rigHolder.AllDrags;
				int num = i;
				allDrags[num].x = allDrags[num].x - Time.deltaTime * removeDragSpeed * 0.5f;
			}
			if (rigHolder.AllDrags[i].y > rigHolder.defaultDrags[i].y)
			{
				flag = true;
				Vector2[] allDrags2 = rigHolder.AllDrags;
				int num2 = i;
				allDrags2[num2].y = allDrags2[num2].y - Time.deltaTime * removeDragSpeed * 0.5f;
			}
		}
		if (flag)
		{
			amount -= Time.deltaTime * removeDragSpeed * dragPerAmount * 0.5f;
		}
		timer += Time.deltaTime;
		if ((Object)(object)colorHandler != (Object)null)
		{
			colorHandler.SetColor(color, Mathf.Clamp(amount * 0.03f, 0f, 1f));
		}
		if ((Object)(object)dragHandler != (Object)null)
		{
			dragHandler.UpdateDrag();
		}
	}

	public override void DoEffect()
	{
		Add(effectAmount);
	}

	public override void Ping()
	{
		Add(effectAmount);
	}

	private void Add(float a)
	{
		if ((Object.op_Implicit((Object)(object)data) && data.Dead && !((UnitEffectBase)this).ShouldSkipDeadTests) || done)
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)rigHolder))
		{
			rigHolder = ((Component)((Component)this).transform.parent).GetComponentInChildren<RigidbodyHolder>();
			if (Object.op_Implicit((Object)(object)rigHolder))
			{
				dragHandler = ((Component)rigHolder).GetComponent<DragHandler>();
				data = ((Component)rigHolder).GetComponent<DataHandler>();
				colorHandler = ((Component)rigHolder).GetComponent<UnitColorHandler>();
				weapons = ((Component)rigHolder).GetComponent<WeaponHandler>();
				healthMultiplier = 1f / Mathf.Clamp(5f, 1f, float.PositiveInfinity);
			}
		}
		if ((Object.op_Implicit((Object)(object)data) && data.Dead && !((UnitEffectBase)this).ShouldSkipDeadTests) || !Object.op_Implicit((Object)(object)rigHolder))
		{
			return;
		}
		float num = 16.666668f - amount * 0.03f;
		a = Mathf.Min(a, num);
		a *= healthMultiplier;
		for (int i = 0; i < rigHolder.AllDrags.Length; i++)
		{
			Vector2[] allDrags = rigHolder.AllDrags;
			int num2 = i;
			allDrags[num2].x = allDrags[num2].x + a * dragPerAmount;
			Vector2[] allDrags2 = rigHolder.AllDrags;
			int num3 = i;
			allDrags2[num3].y = allDrags2[num3].y + a * dragPerAmount;
			if (allDrags[num2].x >= 25f)
			{
				allDrags[num2].x = allDrags[num2].x - a * dragPerAmount;
				allDrags2[num3].y = allDrags2[num3].y - a * dragPerAmount;
			}
		}
		amount += a;
		if ((Object)(object)dragHandler != (Object)null)
		{
			dragHandler.UpdateDrag();
		}
		timer = 0.1f;
	}

	private void Done()
	{
		if (!done && (!Object.op_Implicit((Object)(object)data) || !data.Dead || ((UnitEffectBase)this).ShouldSkipDeadTests))
		{
			PlaySoundEffect component = ((Component)this).GetComponent<PlaySoundEffect>();
			if ((Object)(object)component != (Object)null)
			{
				component.Go();
			}
			done = true;
		}
	}

	private void StandardDeath()
	{
		//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_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		Joint[] componentsInChildren = ((Component)((Component)this).transform.root).GetComponentsInChildren<Joint>();
		float num = 0f;
		Vector3 val = Vector3.zero;
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			Object.Destroy((Object)(object)componentsInChildren[i]);
		}
		for (int j = 0; j < data.allRigs.AllRigs.Length; j++)
		{
			Rigidbody val2 = data.allRigs.AllRigs[j];
			if (!((Object)(object)val2 == (Object)null))
			{
				num += val2.mass;
				val += val2.velocity / (float)data.allRigs.AllDrags.Length;
				Object.Destroy((Object)(object)val2);
			}
		}
		if (Object.op_Implicit((Object)(object)colorHandler))
		{
			colorHandler.SetMaterial(iceMaterial);
		}
		if (Object.op_Implicit((Object)(object)weapons))
		{
			if (Object.op_Implicit((Object)(object)weapons.leftWeapon) && Object.op_Implicit((Object)(object)weapons.leftWeapon.rigidbody))
			{
				Object.Destroy((Object)(object)weapons.leftWeapon.rigidbody);
			}
			if (Object.op_Implicit((Object)(object)weapons.rightWeapon) && Object.op_Implicit((Object)(object)weapons.rightWeapon.rigidbody))
			{
				Object.Destroy((Object)(object)weapons.rightWeapon.rigidbody);
			}
		}
		Rigidbody val3 = ((Component)((Component)data).transform.root).gameObject.AddComponent<Rigidbody>();
		data.mainRig = val3;
		val3.mass = num * 3f;
		val3.velocity = val;
		((Component)val3).gameObject.AddComponent<SinkOnDeath>().Sink();
		val3.drag = 1f;
		val3.angularDrag = 1f;
		val3.interpolation = (RigidbodyInterpolation)1;
		Collider component = ((Component)val3).GetComponent<Collider>();
		if (Object.op_Implicit((Object)(object)component))
		{
			Object.Destroy((Object)(object)component);
		}
		val3.ResetCenterOfMass();
		data.healthHandler.Die((Unit)null);
		Object.Destroy((Object)(object)((Component)this).gameObject);
		DatabaseID gUID = data.unit.unitBlueprint.Entity.GUID;
		if (gUID.m_modID == -1 && gUID.m_ID == 1610400248)
		{
			ServiceLocator.GetService<AchievementService>().UnlockAchievement("FREEZE_ICE_GIANT");
		}
	}
}
public class ScenesManager : MonoBehaviour
{
	public ScenesManager()
	{
		SceneManager.sceneLoaded += SceneLoaded;
	}

	public void SceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
	{
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Expected O, but got Unknown
		//IL_0119: 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_0081: Expected O, but got Unknown
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Expected O, but got Unknown
		if (((Scene)(ref scene)).name == "UnitCreator_GamepadUI")
		{
			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();
			UnitBlueprint val = SLMATool.CreateUnit("MoreContent Custom:病变体", (UnitBlueprint)SLMALoader.SDic["blueprints"]["CustomWobbler"], (Faction)null, (Sprite)null);
			val.UnitBase = UManager.bundleMod.GetAssetBundle("dark").LoadAsset<GameObject>("病变体");
			list.Add(new UnitBaseWrapper
			{
				BaseDisplayName = "病变体",
				BaseIcon = UManager.bundleMod.GetAssetBundle("dark").LoadAsset<Sprite>("瘟疫医生图标2"),
				UnitBaseBlueprint = val,
				UnitBaseRestriction = (UnitBaseRestrictions)0
			});
			component.UnitBases = list.ToArray();
		}
		if (((Scene)(ref scene)).name == "00_Lvl1_Halloween_VC")
		{
			GameObject val2 = new GameObject();
			((Object)val2).name = "dark123";
			val2.transform.position = Vector3.zero;
			Object.Instantiate<GameObject>(UManager.bundleMod.GetAssetBundle("dark").LoadAsset<GameObject>("Unlock1986"), val2.transform);
		}
	}
}
public class SecretUnlock2 : GameStateListener
{
	[SerializeField]
	private string m_secret_key = "";

	[SerializeField]
	private string m_secretDescription = "";

	[SerializeField]
	private Sprite m_secretIcon;

	[SerializeField]
	private float m_distanceToUnlock = 5f;

	private RotationShake m_rotationShake;

	private Rigidbody m_secretObject;

	private float m_lookValue;

	private float m_unlockValue;

	public AudioClip hitClip;

	private AudioSource loopSource;

	private Transform m_mainCamTransform;

	public UnityEvent unlockEvent;

	public UnityEvent hideEvent;

	private bool done;

	public Color glowColor;

	public GameObject unlockSparkEffect;

	[SerializeField]
	private int materialIndexToChange;

	public Renderer meshRenderer;

	protected override void Awake()
	{
		((GameStateListener)this).Awake();
		if ((Object)(object)m_mainCamTransform == (Object)null)
		{
			((GameStateListener)this).OnEnterNewScene();
		}
	}

	private void Update()
	{
		//IL_00d9: 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_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)m_mainCamTransform != (Object)null) || !Object.op_Implicit((Object)(object)m_secretObject) || done)
		{
			return;
		}
		loopSource.volume = ((m_unlockValue <= 0f) ? 0f : Mathf.Pow(m_unlockValue * 0.25f, 1.3f));
		if (float.IsNaN(loopSource.volume))
		{
			loopSource.volume = 0f;
		}
		float num = 1f + 1f * m_unlockValue;
		loopSource.pitch = ((num >= 0f) ? num : 0f);
		if (m_unlockValue > 0f || m_lookValue > 10f)
		{
			SetColor(materialIndexToChange);
		}
		float num2 = Vector3.Distance(m_secretObject.worldCenterOfMass, m_mainCamTransform.position);
		if (num2 > m_distanceToUnlock)
		{
			m_unlockValue -= Time.unscaledDeltaTime * 0.2f;
			return;
		}
		float num3 = Vector3.Angle(m_mainCamTransform.forward, m_secretObject.worldCenterOfMass - m_mainCamTransform.position);
		m_lookValue = 1000f / (num2 * num3);
		if (m_lookValue > 8f)
		{
			float num4 = 0.2f;
			m_unlockValue += num4 * Time.unscaledDeltaTime;
			UnlockProgressFeedback();
			if (m_unlockValue > 1f)
			{
				UnlockSecret();
			}
		}
		else
		{
			m_unlockValue -= Time.unscaledDeltaTime * 0.2f;
		}
	}

	private void UnlockProgressFeedback()
	{
		//IL_0051: 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_0066: 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_0020: 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)
		if (Object.op_Implicit((Object)(object)m_rotationShake))
		{
			if (m_unlockValue <= 0f)
			{
				m_rotationShake.AddForce(Random.onUnitSphere * 2f);
				m_unlockValue = 0f;
			}
			((Behaviour)m_rotationShake).enabled = true;
			m_rotationShake.AddForce(Random.onUnitSphere * m_unlockValue * Time.deltaTime * 50f);
		}
	}

	private void UnlockSecret()
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: 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_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		if (!((Behaviour)this).enabled || string.IsNullOrWhiteSpace(m_secret_key) || ServiceLocator.GetService<ISaveLoaderService>().HasUnlockedSecret(m_secret_key))
		{
			return;
		}
		if (Object.op_Implicit((Object)(object)ScreenShake.Instance))
		{
			ScreenShake.Instance.AddForce(Vector3.up * 8f, ((Component)m_secretObject).transform.position);
		}
		if (Object.op_Implicit((Object)(object)unlockSparkEffect))
		{
			Object.Instantiate<GameObject>(unlockSparkEffect, ((Component)m_secretObject).transform.position, ((Component)m_secretObject).transform.rotation).AddComponent<RemoveAfterSeconds>().seconds = 5f;
			((Component)m_secretObject).GetComponentInChildren<MeshRenderer>();
		}
		((Component)m_secretObject).gameObject.SetActive(false);
		UnityEvent val = unlockEvent;
		if (val != null)
		{
			val.Invoke();
		}
		loopSource.Stop();
		loopSource.volume = 1f;
		loopSource.PlayOneShot(hitClip);
		done = true;
		if (string.IsNullOrWhiteSpace(m_secret_key))
		{
			return;
		}
		List<SecretUnlockCondition> list = ServiceLocator.GetService<ISaveLoaderService>().UnlockSecret(m_secret_key);
		ServiceLocator.GetService<ModalPanel>().OpenUnlockPanel(m_secretDescription, m_secretIcon);
		if (list != null && list.Count > 0)
		{
			foreach (SecretUnlockCondition item in list)
			{
				ServiceLocator.GetService<ModalPanel>().OpenUnlockPanel(item.m_unlockDescription, item.m_unlockImage);
			}
		}
		PlacementUI val2 = Object.FindObjectOfType<PlacementUI>();
		if ((Object)(object)val2 != (Object)null)
		{
			val2.RedrawUI(m_secret_key);
		}
	}

	public override void OnEnterNewScene()
	{
		((GameStateListener)this).OnEnterNewScene();
		loopSource = ((Component)this).GetComponent<AudioSource>();
		if (Object.op_Implicit((Object)(object)loopSource))
		{
			loopSource.volume = 0f;
		}
		m_rotationShake = ((Component)this).GetComponentInChildren<RotationShake>();
		m_secretObject = ((Component)this).GetComponentInChildren<Rigidbody>();
		if (Object.op_Implicit((Object)(object)m_secretObject))
		{
			m_secretObject.isKinematic = true;
		}
		if (!string.IsNullOrWhiteSpace(m_secret_key) && ServiceLocator.GetService<ISaveLoaderService>().HasUnlockedSecret(m_secret_key))
		{
			if (Object.op_Implicit((Object)(object)m_secretObject))
			{
				((Component)m_secretObject).gameObject.SetActive(false);
			}
			((Behaviour)this).enabled = false;
			UnityEvent val = hideEvent;
			if (val != null)
			{
				val.Invoke();
			}
		}
		PlayerCamerasManager service = ServiceLocator.GetService<PlayerCamerasManager>();
		MainCam val2 = ((service != null) ? service.GetMainCam((Player)0) : null);
		m_mainCamTransform = (((Object)(object)val2 != (Object)null) ? ((Component)val2).transform : null);
	}

	public override void OnEnterPlacementState()
	{
	}

	public override void OnEnterBattleState()
	{
	}

	private void SetColor(int materialIndex)
	{
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		m_unlockValue = Mathf.Clamp(m_unlockValue, 0f, float.PositiveInfinity);
		if ((Object)(object)meshRenderer != (Object)null)
		{
			if (materialIndex < 0 || materialIndex >= meshRenderer.materials.Length)
			{
				Debug.LogError((object)("Invalid material index: " + materialIndex));
				return;
			}
			Material val = meshRenderer.materials[materialIndex];
			if (!(((Object)val.shader).name == "TFBG/EmitVertexColor") && val.HasProperty("_EmissionColor"))
			{
				val.EnableKeyword("_EMISSION");
				val.SetColor("_EmissionColor", glowColor * m_unlockValue * 2f);
			}
		}
		else
		{
			Debug.LogError((object)"Mesh Renderer not assigned!");
		}
	}
}
public class AddDeathEvent2 : MonoBehaviour
{
	public UnityEvent deathEvent;

	public bool addToParent;

	private HealthHandler healthHandler;

	public bool onStart;

	private void Start()
	{
		if (onStart)
		{
			Init();
		}
	}

	private void Die()
	{
		deathEvent.Invoke();
	}

	private void OnDestroy()
	{
		if (Object.op_Implicit((Object)(object)healthHandler))
		{
			healthHandler.RemoveDieAction((Action)Die);
		}
	}

	public void Init()
	{
		healthHandler = (addToParent ? ((Component)((Component)this).transform).GetComponentInParent<DataHandler>().healthHandler : ((Component)((Component)this).transform.root).GetComponentInChildren<DataHandler>().healthHandler);
		if (Object.op_Implicit((Object)(object)healthHandler))
		{
			healthHandler.AddDieAction((Action)Die);
		}
	}
}
public class UnitDeathEffect3 : MonoBehaviour
{
	public List<Collider> collisions = new List<Collider>();

	private List<MeshRenderer> renderersM = new List<MeshRenderer>();

	private List<SkinnedMeshRenderer> renderersS = new List<SkinnedMeshRenderer>();

	public bool teleportDown;

	public bool hideColliderParent;

	public bool autoRenderers;

	public void Go()
	{
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < collisions.Count; i++)
		{
			if (collisions[i].enabled)
			{
				collisions[i].enabled = false;
			}
			if (hideColliderParent && ((Component)((Component)collisions[i]).transform.parent).gameObject.activeInHierarchy)
			{
				((Component)((Component)collisions[i]).transform.parent).gameObject.SetActive(false);
			}
		}
		Rigidbody[] allRigs = ((Component)this).GetComponentInChildren<DataHandler>().allRigs.AllRigs;
		foreach (Rigidbody val in allRigs)
		{
			if (!val.isKinematic)
			{
				val.isKinematic = true;
			}
		}
		if (autoRenderers)
		{
			ManageRenderersManual();
		}
		else
		{
			ManageRenderers();
		}
		if (teleportDown)
		{
			((Component)((Component)this).GetComponentInChildren<DataHandler>()).gameObject.transform.position = new Vector3(0f, -100f, 0f);
		}
	}

	private void Start()
	{
		MeshRenderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<MeshRenderer>();
		foreach (MeshRenderer item in componentsInChildren)
		{
			renderersM.Add(item);
		}
		SkinnedMeshRenderer[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<SkinnedMeshRenderer>();
		foreach (SkinnedMeshRenderer item2 in componentsInChildren2)
		{
			renderersS.Add(item2);
		}
	}

	private void ManageRenderersManual()
	{
		for (int i = 0; i < renderersM.Count; i++)
		{
			if (((Renderer)renderersM[i]).enabled)
			{
				((Renderer)renderersM[i]).enabled = false;
			}
		}
		for (int j = 0; j < renderersS.Count; j++)
		{
			if (((Renderer)renderersS[j]).enabled)
			{
				((Renderer)renderersS[j]).enabled = false;
			}
		}
	}

	private void ManageRenderers()
	{
		List<Renderer> list = new List<Renderer>();
		Renderer[] componentsInChildren = ((Component)((Component)this).transform.root).GetComponentsInChildren<Renderer>();
		foreach (Renderer val in componentsInChildren)
		{
			if (!((Object)(object)((Component)val).gameObject.GetComponent<RangeWeapon>() != (Object)null) && !((Object)(object)((Component)val).gameObject.GetComponent<MeleeWeapon>() != (Object)null))
			{
				list.Add(val);
			}
		}
		foreach (Renderer item in list)
		{
			if (item.enabled)
			{
				item.enabled = false;
			}
		}
	}
}