Decompiled source of AbyssalEyeMod v0.1.1

AbyssalEye.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Xml;
using AbyssalEye.AssetManagement;
using AbyssalEye.DeathAura;
using AbyssalEye.TABSSimp;
using BepInEx;
using BepInEx.Logging;
using DM;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.AI.Systems;
using Landfall.TABS.UnitEditor;
using Sirenix.Serialization;
using Unity.Entities;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AbyssalEye")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AbyssalEye")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1619c49c-bc45-486c-bbca-6b52cef4f478")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
namespace AbyssalEye
{
	[BepInPlugin("abyssaleye.mod", "Abyssal Eye Mod", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Launcher : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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)
			Debug.Log((object)"[AbyssalEye] Starting in Awake after optional SLMAcore dependency initialization.");
			Harmony val = new Harmony("abyssaleye.lifecycle.1.0.1");
			val.CreateClassProcessor(typeof(UnitButtonLocalizationPatch)).Patch();
			val.CreateClassProcessor(typeof(FactionButtonLocalizationPatch)).Patch();
			val.CreateClassProcessor(typeof(NativeMaterialTransitionPatch)).Patch();
			AssetImporter.Initialize();
			new Main();
		}
	}
	internal static class LocalizationRuntime
	{
		private static readonly FieldInfo UnitName = AccessTools.Field(typeof(UnitButton), "m_unitName");

		private static bool initialized;

		internal static void Initialize()
		{
			if (!initialized)
			{
				initialized = true;
				UnitButton[] array = Object.FindObjectsOfType<UnitButton>();
				for (int i = 0; i < array.Length; i++)
				{
					LocalizeUnit(array[i]);
				}
				ExpandedFactionButton[] array2 = Object.FindObjectsOfType<ExpandedFactionButton>();
				for (int i = 0; i < array2.Length; i++)
				{
					LocalizeFaction(array2[i]);
				}
			}
		}

		internal static void LocalizeUnit(UnitButton button)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (!initialized || (Object)(object)button == (Object)null)
			{
				return;
			}
			object? value = UnitName.GetValue(button);
			LocalizeText val = (LocalizeText)((value is LocalizeText) ? value : null);
			if (!((Object)(object)val == (Object)null))
			{
				UnitBlueprint unitBlueprint = ContentDatabase.Instance().GetUnitBlueprint(button.UnitID);
				if (!((Object)(object)unitBlueprint == (Object)null) && unitBlueprint.IsCustomUnit)
				{
					val.Localized = true;
					val.LocaleID = unitBlueprint.Entity.Name;
				}
			}
		}

		internal static void LocalizeFaction(ExpandedFactionButton button)
		{
			if (initialized && !((Object)(object)button == (Object)null) && !((Object)(object)button.factionName == (Object)null) && button.factionName.LocaleID == "Abyssal")
			{
				button.factionName.Localized = true;
				button.factionName.LocaleID = "Abyssal";
			}
		}
	}
	[HarmonyPatch]
	internal static class UnitButtonLocalizationPatch
	{
		private static IEnumerable<MethodBase> TargetMethods()
		{
			foreach (MethodInfo declaredMethod in AccessTools.GetDeclaredMethods(typeof(UnitButton)))
			{
				if (declaredMethod.Name == "SetupUnit")
				{
					yield return declaredMethod;
				}
			}
		}

		private static void Postfix(UnitButton __instance)
		{
			LocalizationRuntime.LocalizeUnit(__instance);
		}
	}
	[HarmonyPatch(typeof(ExpandedFactionButton), "Setup")]
	internal static class FactionButtonLocalizationPatch
	{
		private static void Postfix(ExpandedFactionButton __instance)
		{
			LocalizationRuntime.LocalizeFaction(__instance);
		}
	}
	public class Main : Mod
	{
		private class LocalizationHost : MonoBehaviour
		{
			private void Start()
			{
				((MonoBehaviour)this).StartCoroutine(WaitForLocalization());
			}

			private IEnumerator WaitForLocalization()
			{
				while (true)
				{
					FieldInfo field = typeof(Localizer).GetField("m_localization", BindingFlags.Static | BindingFlags.NonPublic);
					if (field != null && field.GetValue(null) is Dictionary<Language, Dictionary<string, string>> dictionary)
					{
						Language[] array = new Language[9];
						RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
						bool flag = true;
						Language[] array2 = (Language[])(object)array;
						foreach (Language key in array2)
						{
							if (!dictionary.ContainsKey(key) || dictionary[key] == null)
							{
								flag = false;
								break;
							}
						}
						if (flag)
						{
							break;
						}
					}
					yield return null;
				}
				Debug.Log((object)"[AbyssalEye] Localizer 已完成初始化,开始注册技能本地化");
				RegisterMoveLocalization();
				LocalizationRuntime.Initialize();
			}
		}

		private GameObject unityIceEmperorCall;

		private GameObject unityAbyssalSummon;

		private GameObject unityFootballCharge;

		private GameObject crusaderSword;

		private string comment;

		public object forwardCompensation { get; private set; }

		private unsafe void LoadTMEWeaponBundles()
		{
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			List<AssetBundle> list = new List<AssetBundle>();
			string[] manifestResourceNames = executingAssembly.GetManifestResourceNames();
			foreach (string text in manifestResourceNames)
			{
				if (!text.StartsWith("AbyssalEye.Assets.TMEBundles.", StringComparison.Ordinal))
				{
					continue;
				}
				try
				{
					using Stream stream = executingAssembly.GetManifestResourceStream(text);
					if (stream == null)
					{
						throw new InvalidOperationException("Embedded resource stream not found: " + text);
					}
					using MemoryStream memoryStream = new MemoryStream();
					stream.CopyTo(memoryStream);
					AssetBundle val = AssetBundle.LoadFromMemory(memoryStream.ToArray());
					if ((Object)(object)val == (Object)null)
					{
						throw new InvalidOperationException("Embedded AssetBundle load failed: " + text);
					}
					list.Add(val);
					Debug.Log((object)("[AbyssalEye] Embedded AssetBundle loaded: " + text + " | Bundle=" + ((Object)val).name));
				}
				catch (Exception ex)
				{
					Debug.LogError((object)("[AbyssalEye] Embedded AssetBundle load failed: " + text + "\n" + ex));
				}
			}
			if (list.Count == 0)
			{
				Debug.LogError((object)"[AbyssalEye] No embedded AssetBundles loaded; check Assets/TMEBundles embedded resources.");
				return;
			}
			foreach (AssetBundle item in list)
			{
				try
				{
					GameObject[] array = item.LoadAllAssets<GameObject>();
					if (array.Length != 0)
					{
						RegisterTMEWeapons(array);
					}
					RegisterUnityFootballCharge(array);
					RegisterUnitySummons(array);
					RegisterTMEContent(item);
				}
				catch (Exception ex2)
				{
					Debug.LogError((object)("[AbyssalEye] 注册包内容失败: " + ((Object)item).name + "\n" + ex2));
				}
			}
			DatabaseID val2 = default(DatabaseID);
			((DatabaseID)(ref val2))..ctor(DatabaseID._LOCAL_CONTENT, 8300001);
			UnitBlueprint unitBlueprint = ContentDatabase.Instance().LandfallContentDatabase.GetUnitBlueprint(val2);
			if (!((Object)(object)unitBlueprint != (Object)null) || unitBlueprint.objectsToSpawnAsChildren == null)
			{
				return;
			}
			GameObject[] objectsToSpawnAsChildren = unitBlueprint.objectsToSpawnAsChildren;
			foreach (GameObject val3 in objectsToSpawnAsChildren)
			{
				if ((Object)(object)val3 == (Object)null)
				{
					continue;
				}
				SpecialAbility component = val3.GetComponent<SpecialAbility>();
				if (!((Object)(object)component == (Object)null))
				{
					string name = ((CharacterItem)component).Entity.Name;
					DatabaseID gUID = ((CharacterItem)component).Entity.GUID;
					Debug.Log((object)("[AbyssalEye] Deadpool 技能引用: " + name + " / " + ((object)(*(DatabaseID*)(&gUID))/*cast due to .constrained prefix*/).ToString()));
					gUID = ((CharacterItem)component).Entity.GUID;
					if (((DatabaseID)(ref gUID)).Equals(new DatabaseID(DatabaseID._LOCAL_CONTENT, 8500001)))
					{
						unityFootballCharge = val3;
						RegisterUnityFootballCharge((GameObject[])(object)new GameObject[1] { val3 });
						Debug.Log((object)"[AbyssalEye] 使用 Deadpool 引用的 FootballCharge 预制体");
					}
				}
			}
		}

		private unsafe void RegisterUnitySummons(GameObject[] prefabs)
		{
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			DatabaseID val = default(DatabaseID);
			((DatabaseID)(ref val))..ctor(DatabaseID._LOCAL_CONTENT, 8500003);
			DatabaseID val2 = default(DatabaseID);
			((DatabaseID)(ref val2))..ctor(DatabaseID._LOCAL_CONTENT, 8500004);
			ContentDatabase val3 = ContentDatabase.Instance();
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
			Dictionary<DatabaseID, GameObject> dictionary = (Dictionary<DatabaseID, GameObject>)typeof(LandfallContentDatabase).GetField("m_combatMoves", bindingAttr).GetValue(val3.LandfallContentDatabase);
			Dictionary<DatabaseID, Object> dictionary2 = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", bindingAttr).GetValue(val3.AssetLoader);
			foreach (GameObject val4 in prefabs)
			{
				SpecialAbility component = val4.GetComponent<SpecialAbility>();
				if ((Object)(object)component == (Object)null)
				{
					continue;
				}
				DatabaseID gUID = ((CharacterItem)component).Entity.GUID;
				if (!((DatabaseID)(ref gUID)).Equals(val) && !((DatabaseID)(ref gUID)).Equals(val2))
				{
					continue;
				}
				if ((dictionary.ContainsKey(gUID) && (Object)(object)dictionary[gUID] != (Object)(object)val4) || (dictionary2.ContainsKey(gUID) && dictionary2[gUID] != (Object)(object)val4))
				{
					string name = ((CharacterItem)component).Entity.Name;
					DatabaseID val5 = gUID;
					throw new InvalidOperationException(name + " summon ID conflict: " + ((object)(*(DatabaseID*)(&val5))/*cast due to .constrained prefix*/).ToString());
				}
				UnitSpawner[] componentsInChildren = val4.GetComponentsInChildren<UnitSpawner>(true);
				UnitBlueprint[] array = (UnitBlueprint[])(object)new UnitBlueprint[componentsInChildren.Length];
				for (int j = 0; j < componentsInChildren.Length; j++)
				{
					UnitBlueprint exported = componentsInChildren[j].unitBlueprint;
					if ((Object)(object)exported == (Object)null || componentsInChildren[j].spawnRandomUnits || componentsInChildren[j].useSpawnerBlueprint)
					{
						continue;
					}
					array[j] = val3.LandfallContentDatabase.GetUnitBlueprint(exported.Entity.GUID);
					if ((Object)(object)array[j] == (Object)null)
					{
						array[j] = val3.LandfallContentDatabase.GetUnitBlueprints().FirstOrDefault((Func<UnitBlueprint, bool>)((UnitBlueprint candidate) => (Object)(object)candidate != (Object)null && candidate.Entity.Name == exported.Entity.Name));
					}
					if ((Object)(object)array[j] == (Object)null)
					{
						array[j] = Utilities.GetUnit(Utilities.GetProperName(exported.Entity.Name));
					}
					if ((Object)(object)array[j] == (Object)null)
					{
						throw new InvalidOperationException(((CharacterItem)component).Entity.Name + " summon unit not found: " + exported.Entity.Name);
					}
				}
				for (int num = 0; num < componentsInChildren.Length; num++)
				{
					if ((Object)(object)array[num] != (Object)null)
					{
						componentsInChildren[num].unitBlueprint = array[num];
					}
				}
				RegisterTMEAsset<GameObject>(val4, gUID, dictionary, dictionary2);
				if ((Object)(object)val3.LandfallContentDatabase.GetCombatMove(gUID) != (Object)(object)val4 || (Object)(object)val3.AssetLoader.GetNonStreamableAsset<GameObject>(gUID) != (Object)(object)val4)
				{
					throw new InvalidOperationException(((CharacterItem)component).Entity.Name + " registration read-back failed.");
				}
				if (((DatabaseID)(ref gUID)).Equals(val))
				{
					unityIceEmperorCall = val4;
				}
				else
				{
					unityAbyssalSummon = val4;
				}
				Debug.Log((object)("[AbyssalEye] Unity summon registered | Name=" + ((CharacterItem)component).Entity.Name + " | ID=" + gUID.m_ID));
			}
		}

		private void RegisterUnityFootballCharge(GameObject[] prefabs)
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			DatabaseID val = default(DatabaseID);
			((DatabaseID)(ref val))..ctor(DatabaseID._LOCAL_CONTENT, 8500001);
			ContentDatabase val2 = ContentDatabase.Instance();
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
			Dictionary<DatabaseID, GameObject> dictionary = (Dictionary<DatabaseID, GameObject>)typeof(LandfallContentDatabase).GetField("m_combatMoves", bindingAttr).GetValue(val2.LandfallContentDatabase);
			Dictionary<DatabaseID, Object> dictionary2 = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", bindingAttr).GetValue(val2.AssetLoader);
			foreach (GameObject val3 in prefabs)
			{
				SpecialAbility component = val3.GetComponent<SpecialAbility>();
				if ((Object)(object)component == (Object)null)
				{
					continue;
				}
				DatabaseID gUID = ((CharacterItem)component).Entity.GUID;
				if (((DatabaseID)(ref gUID)).Equals(val))
				{
					if ((Object)(object)unityFootballCharge != (Object)null && (Object)(object)unityFootballCharge != (Object)(object)val3)
					{
						Debug.LogError((object)("[AbyssalEye] FootballCharge ID 重复,跳过: " + ((Object)val3).name));
					}
					else if (RegisterTMEAsset<GameObject>(val3, val, dictionary, dictionary2) || (dictionary.ContainsKey(val) && (Object)(object)dictionary[val] == (Object)(object)val3 && dictionary2.ContainsKey(val) && dictionary2[val] == (Object)(object)val3))
					{
						unityFootballCharge = val3;
					}
				}
			}
		}

		private unsafe bool RegisterTMEAsset<T>(T asset, DatabaseID id, Dictionary<DatabaseID, T> table, Dictionary<DatabaseID, Object> assets) where T : Object
		{
			//IL_0001: 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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			DatabaseID val;
			if (table.ContainsKey(id))
			{
				if ((Object)(object)table[id] != (Object)(object)asset)
				{
					string name = ((Object)asset).name;
					val = id;
					Debug.LogWarning((object)("[AbyssalEye] ID 已存在,跳过: " + name + " / " + ((object)(*(DatabaseID*)(&val))/*cast due to .constrained prefix*/).ToString()));
				}
				return false;
			}
			if (assets.ContainsKey(id) && assets[id] != (Object)(object)asset)
			{
				string name2 = ((Object)asset).name;
				val = id;
				Debug.LogError((object)("[AbyssalEye] 资源 ID 冲突: " + name2 + " / " + ((object)(*(DatabaseID*)(&val))/*cast due to .constrained prefix*/).ToString()));
				return false;
			}
			table.Add(id, asset);
			if (!assets.ContainsKey(id))
			{
				assets.Add(id, (Object)(object)asset);
			}
			string[] obj = new string[6]
			{
				"[AbyssalEye] 注册成功: ",
				typeof(T).Name,
				" / ",
				((Object)asset).name,
				" / ",
				null
			};
			val = id;
			obj[5] = ((object)(*(DatabaseID*)(&val))/*cast due to .constrained prefix*/).ToString();
			Debug.Log((object)string.Concat(obj));
			return true;
		}

		private void RegisterTMEContent(AssetBundle bundle)
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			ContentDatabase val = ContentDatabase.Instance();
			BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
			Dictionary<DatabaseID, UnitBlueprint> table = (Dictionary<DatabaseID, UnitBlueprint>)typeof(LandfallContentDatabase).GetField("m_unitBlueprints", bindingAttr).GetValue(val.LandfallContentDatabase);
			Dictionary<DatabaseID, Faction> table2 = (Dictionary<DatabaseID, Faction>)typeof(LandfallContentDatabase).GetField("m_factions", bindingAttr).GetValue(val.LandfallContentDatabase);
			Dictionary<DatabaseID, Object> assets = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", bindingAttr).GetValue(val.AssetLoader);
			UnitBlueprint[] array = bundle.LoadAllAssets<UnitBlueprint>();
			foreach (UnitBlueprint val2 in array)
			{
				if (val2.Entity.GUID.m_modID == -2)
				{
					RegisterTMEAsset<UnitBlueprint>(val2, val2.Entity.GUID, table, assets);
				}
			}
			Faction[] array2 = bundle.LoadAllAssets<Faction>();
			foreach (Faction val3 in array2)
			{
				if (val3.Entity.GUID.m_modID != -2)
				{
					continue;
				}
				if (val3.Units != null)
				{
					array = val3.Units;
					foreach (UnitBlueprint val4 in array)
					{
						if (!Object.op_Implicit((Object)(object)val4))
						{
							Debug.LogError((object)("[AbyssalEye] 派系单位引用缺失: " + ((Object)val3).name));
						}
						else if (val4.Entity.GUID.m_modID == -2)
						{
							RegisterTMEAsset<UnitBlueprint>(val4, val4.Entity.GUID, table, assets);
						}
					}
				}
				RegisterTMEAsset<Faction>(val3, val3.Entity.GUID, table2, assets);
				Debug.Log((object)("[AbyssalEye] 派系状态: " + val3.Entity.Name + ", Display=" + val3.m_displayFaction));
			}
		}

		private unsafe void RegisterTMEWeapons(GameObject[] prefabs)
		{
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			if (prefabs == null || prefabs.Length == 0)
			{
				Debug.LogWarning((object)"[AbyssalEye] AssetBundle 中没有 GameObject");
				return;
			}
			ContentDatabase val = ContentDatabase.Instance();
			LandfallContentDatabase landfallContentDatabase = val.LandfallContentDatabase;
			FieldInfo field = typeof(LandfallContentDatabase).GetField("m_weapons", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field == null)
			{
				Debug.LogError((object)"[AbyssalEye] 找不到 LandfallContentDatabase.m_weapons");
				return;
			}
			Dictionary<DatabaseID, GameObject> dictionary = (Dictionary<DatabaseID, GameObject>)field.GetValue(landfallContentDatabase);
			AssetLoader assetLoader = val.AssetLoader;
			FieldInfo field2 = typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field2 == null)
			{
				Debug.LogError((object)"[AbyssalEye] 找不到 AssetLoader.m_nonStreamableAssets");
				return;
			}
			Dictionary<DatabaseID, Object> dictionary2 = (Dictionary<DatabaseID, Object>)field2.GetValue(assetLoader);
			foreach (GameObject val2 in prefabs)
			{
				if ((Object)(object)val2 == (Object)null)
				{
					continue;
				}
				WeaponItem component = val2.GetComponent<WeaponItem>();
				if ((Object)(object)component == (Object)null)
				{
					continue;
				}
				if (((CharacterItem)component).Entity.Name == "Crusader Sword")
				{
					crusaderSword = val2;
					Debug.Log((object)("[AbyssalEye] 已保存 Crusader Sword 引用: " + ((object)((CharacterItem)component).Entity.GUID/*cast due to .constrained prefix*/).ToString()));
				}
				DatabaseID gUID = ((CharacterItem)component).Entity.GUID;
				if (dictionary.ContainsKey(gUID))
				{
					string name = ((CharacterItem)component).Entity.Name;
					DatabaseID val3 = gUID;
					Debug.LogWarning((object)("[AbyssalEye] 武器 GUID 已存在,跳过: " + name + " / " + ((object)(*(DatabaseID*)(&val3))/*cast due to .constrained prefix*/).ToString()));
					continue;
				}
				dictionary.Add(gUID, val2);
				if (!dictionary2.ContainsKey(gUID))
				{
					dictionary2.Add(gUID, (Object)(object)val2);
				}
				Debug.Log((object)("[AbyssalEye] TME 武器注册成功: Name=" + ((CharacterItem)component).Entity.Name + ", GUID=" + ((object)((CharacterItem)component).Entity.GUID/*cast due to .constrained prefix*/).ToString() + ", ShowInEditor=" + ((CharacterItem)component).ShowInEditor));
			}
		}

		private Sprite LoadEmbeddedSprite(string resourceName)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName);
			if (stream == null)
			{
				Debug.LogError((object)("[AbyssalEye] 找不到资源: " + resourceName));
				return null;
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			Texture2D val = new Texture2D(1, 1);
			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));
		}

		private unsafe static void RegisterMoveLocalization()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			FieldInfo field = typeof(Localizer).GetField("m_localization", BindingFlags.Static | BindingFlags.NonPublic);
			if (field == null)
			{
				Debug.LogError((object)"[AbyssalEye] 找不到 Localizer.m_localization");
				return;
			}
			if (!(field.GetValue(null) is Dictionary<Language, Dictionary<string, string>> dictionary))
			{
				Debug.LogError((object)"[AbyssalEye] Localizer.m_localization 获取失败");
				return;
			}
			Language[] array = new Language[9];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			Language[] array2 = (Language[])(object)array;
			for (int i = 0; i < array2.Length; i++)
			{
				Language key = array2[i];
				if (!dictionary.ContainsKey(key) || dictionary[key] == null)
				{
					Debug.LogError((object)("[AbyssalEye] Localizer 语言尚未完全初始化:" + ((object)(*(Language*)(&key))/*cast due to .constrained prefix*/).ToString()));
					return;
				}
			}
			dictionary[(Language)0]["Abyssal Summon"] = "Abyssal Summon";
			dictionary[(Language)1]["Abyssal Summon"] = "Invocation abyssale";
			dictionary[(Language)2]["Abyssal Summon"] = "Evocazione abissale";
			dictionary[(Language)3]["Abyssal Summon"] = "Abyssale Beschwörung";
			dictionary[(Language)4]["Abyssal Summon"] = "Invocación abisal";
			dictionary[(Language)5]["Abyssal Summon"] = "Invocação abissal";
			dictionary[(Language)6]["Abyssal Summon"] = "Бездонный призыв";
			dictionary[(Language)7]["Abyssal Summon"] = "深渊召唤";
			dictionary[(Language)8]["Abyssal Summon"] = "深淵召喚";
			AddLocalization(dictionary, "FootballCharge", "Football Charge", "Charge de football américain", "Carica di football americano", "Football-Ansturm", "Embestida de fútbol americano", "Investida de futebol americano", "Рывок футболиста", "橄榄球撞击", "アメフトタックル");
			AddLocalization(dictionary, "Death Aura", "Ring of Death", "Cercle de la mort", "Anello della morte", "Ring des Todes", "Anillo de la muerte", "Anel da morte", "Кольцо смерти", "死亡之环", "死の輪");
			AddLocalization(dictionary, "IceEmperor Call", "Ice Emperor Summon", "Invocation de l’empereur des glaces", "Evocazione dell’imperatore del ghiaccio", "Beschwörung des Eiskaisers", "Invocación del emperador de hielo", "Invocação do imperador do gelo", "Призыв ледяного императора", "冰帝召唤", "氷帝の召喚");
			AddLocalization(dictionary, "时光之主", "Time Lord", "Seigneur du Temps", "Signore del Tempo", "Zeitherrscher", "Señor del Tiempo", "Senhor do Tempo", "Повелитель времени", "时光之主", "時の支配者");
			AddLocalization(dictionary, "方舟", "Ark", "Arche", "Arca", "Arche", "Arca", "Arca", "Ковчег", "方舟", "箱舟");
			AddLocalization(dictionary, "虚空领主", "Void Lord", "Seigneur du Vide", "Signore del Vuoto", "Leerenfürst", "Señor del Vacío", "Senhor do Vazio", "Владыка Пустоты", "虚空领主", "虚空の君主");
			AddLocalization(dictionary, "lucky", "Lucky", "Lucky", "Lucky", "Lucky", "Lucky", "Lucky", "Лаки", "lucky", "ラッキー");
			AddLocalization(dictionary, "摔跤手", "Wrestler", "Lutteur", "Lottatore", "Wrestler", "Luchador", "Lutador", "Борец", "摔跤手", "レスラー");
			AddLocalization(dictionary, "大厨", "Chef", "Chef", "Chef", "Koch", "Chef", "Chef", "Шеф-повар", "大厨", "シェフ");
			AddLocalization(dictionary, "燕双鹰", "Yan Shuangying", "Yan Shuangying", "Yan Shuangying", "Yan Shuangying", "Yan Shuangying", "Yan Shuangying", "Янь Шуанъин", "燕双鹰", "燕双鷹");
			AddLocalization(dictionary, "鸡腿盾兵", "Chicken Leg Shieldbearer", "Porte-bouclier à cuisse de poulet", "Portascudo con coscia di pollo", "Hühnerkeulen-Schildträger", "Portaescudos de muslo de pollo", "Porta-escudo de coxa de frango", "Щитоносец с куриной ножкой", "鸡腿盾兵", "チキンレッグ・シールドベアラー");
			AddLocalization(dictionary, "冰帝", "Ice Emperor", "Empereur de Glace", "Imperatore del Ghiaccio", "Eiskaiser", "Emperador de Hielo", "Imperador de Gelo", "Ледяной император", "冰帝", "氷帝");
			AddLocalization(dictionary, "电光人", "Electro", "Électro", "Electro", "Electro", "Electro", "Electro", "Электро", "电光人", "エレクトロ");
			AddLocalization(dictionary, "拖把大爷", "Mop Grandpa", "Grand-père à la serpillière", "Nonno Mop", "Mopp-Großvater", "Abuelo de la fregona", "Vovô do esfregão", "Дедушка с шваброй", "拖把大爷", "モップおじさん");
			AddLocalization(dictionary, "精神念师", "Psychic", "Psychique", "Psionico", "Psi", "Psíquico", "Psíquico", "Псионик", "精神念师", "サイキック");
			AddLocalization(dictionary, "玉面手雷王", "Grenade King", "Roi des Grenades", "Re delle Granate", "Granatenkönig", "Rey de las Granadas", "Rei das Granadas", "Король гранат", "玉面手雷王", "グレネードキング");
			AddLocalization(dictionary, "橄榄球手", "Football Player", "Joueur de football américain", "Giocatore di football americano", "Footballspieler", "Jugador de fútbol americano", "Jogador de futebol americano", "Игрок в американский футбол", "橄榄球手", "アメリカンフットボール選手");
			AddLocalization(dictionary, "Abyssal", "Abyssal", "Abyssal", "Abyssal", "Abyssal", "Abyssal", "Abyssal", "Abyssal", "深渊", "アビサル");
			Debug.Log((object)"[AbyssalEye] 技能多语言注册成功: Abyssal Summon, FootballCharge, Death Aura, IceEmperor Call");
		}

		private static void AddLocalization(Dictionary<Language, Dictionary<string, string>> localization, string key, string en, string fr, string it, string de, string es, string pt, string ru, string ch, string ja)
		{
			localization[(Language)0][key] = en;
			localization[(Language)1][key] = fr;
			localization[(Language)2][key] = it;
			localization[(Language)3][key] = de;
			localization[(Language)4][key] = es;
			localization[(Language)5][key] = pt;
			localization[(Language)6][key] = ru;
			localization[(Language)7][key] = ch;
			localization[(Language)8][key] = ja;
		}

		public Main()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0655: Unknown result type (might be due to invalid IL or missing references)
			//IL_067c: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0718: Unknown result type (might be due to invalid IL or missing references)
			//IL_073f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0766: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a36: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a84: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b23: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f8b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fb2: Unknown result type (might be due to invalid IL or missing references)
			//IL_112c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1190: Unknown result type (might be due to invalid IL or missing references)
			//IL_1216: Unknown result type (might be due to invalid IL or missing references)
			//IL_1456: Unknown result type (might be due to invalid IL or missing references)
			//IL_14e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_150b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1532: Unknown result type (might be due to invalid IL or missing references)
			//IL_1559: Unknown result type (might be due to invalid IL or missing references)
			//IL_1580: Unknown result type (might be due to invalid IL or missing references)
			//IL_15a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_18b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c68: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c8f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1cb6: Unknown result type (might be due to invalid IL or missing references)
			//IL_1cdd: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d04: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d2b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d52: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d79: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ec9: Unknown result type (might be due to invalid IL or missing references)
			//IL_1f21: Unknown result type (might be due to invalid IL or missing references)
			//IL_1fc3: Unknown result type (might be due to invalid IL or missing references)
			//IL_22aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_22d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_22f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_231f: Unknown result type (might be due to invalid IL or missing references)
			//IL_2346: Unknown result type (might be due to invalid IL or missing references)
			//IL_236d: Unknown result type (might be due to invalid IL or missing references)
			//IL_2394: Unknown result type (might be due to invalid IL or missing references)
			//IL_23bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_23e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_2409: Unknown result type (might be due to invalid IL or missing references)
			//IL_2430: Unknown result type (might be due to invalid IL or missing references)
			//IL_2457: Unknown result type (might be due to invalid IL or missing references)
			//IL_247e: Unknown result type (might be due to invalid IL or missing references)
			//IL_24a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_24cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_24f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_251a: Unknown result type (might be due to invalid IL or missing references)
			//IL_2541: Unknown result type (might be due to invalid IL or missing references)
			//IL_2568: Unknown result type (might be due to invalid IL or missing references)
			//IL_258f: Unknown result type (might be due to invalid IL or missing references)
			//IL_25b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_25df: Unknown result type (might be due to invalid IL or missing references)
			//IL_263c: Unknown result type (might be due to invalid IL or missing references)
			//IL_2173: Unknown result type (might be due to invalid IL or missing references)
			//IL_220a: Unknown result type (might be due to invalid IL or missing references)
			//IL_278b: Unknown result type (might be due to invalid IL or missing references)
			//IL_2899: Unknown result type (might be due to invalid IL or missing references)
			//IL_2927: Unknown result type (might be due to invalid IL or missing references)
			//IL_294e: Unknown result type (might be due to invalid IL or missing references)
			//IL_2975: Unknown result type (might be due to invalid IL or missing references)
			//IL_299c: Unknown result type (might be due to invalid IL or missing references)
			//IL_29c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_29ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_2a11: Unknown result type (might be due to invalid IL or missing references)
			//IL_2a38: Unknown result type (might be due to invalid IL or missing references)
			//IL_2c99: Unknown result type (might be due to invalid IL or missing references)
			//IL_2cc0: Unknown result type (might be due to invalid IL or missing references)
			//IL_2ce7: Unknown result type (might be due to invalid IL or missing references)
			//IL_2d0e: Unknown result type (might be due to invalid IL or missing references)
			//IL_2d35: Unknown result type (might be due to invalid IL or missing references)
			//IL_2d5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_2d83: Unknown result type (might be due to invalid IL or missing references)
			//IL_2daa: Unknown result type (might be due to invalid IL or missing references)
			//IL_2dd1: Unknown result type (might be due to invalid IL or missing references)
			//IL_2df8: Unknown result type (might be due to invalid IL or missing references)
			//IL_2e1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_2e46: Unknown result type (might be due to invalid IL or missing references)
			//IL_2e6d: Unknown result type (might be due to invalid IL or missing references)
			//IL_2e95: Unknown result type (might be due to invalid IL or missing references)
			//IL_2ebd: Unknown result type (might be due to invalid IL or missing references)
			string[] manifestResourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames();
			foreach (string text in manifestResourceNames)
			{
				Debug.Log((object)("[AbyssalEye] DLL资源 = " + text));
			}
			GameObject val = new GameObject("AbyssalEye_LocalizationHost");
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<LocalizationHost>();
			Debug.Log((object)"[AbyssalEye] LocalizationHost 已启动");
			Debug.Log((object)"========== ABYSSALEYE TEST 123456 ==========");
			comment = "CHANGE THIS TO FALSE BEFORE RELEASING YOUR MOD!!!";
			Mod.DEV_MODE = false;
			LoadTMEWeaponBundles();
			DeathAuraBootstrap.Initialize();
			ModFaction modFaction = Mod.CreateFaction("Abyssal");
			modFaction.Icon = Mod.GetIcon("Cheerleader");
			modFaction.Color("#FFFF00");
			if ((Object)(object)unityIceEmperorCall == (Object)null)
			{
				Debug.LogError((object)"[AbyssalEye] IceEmperor Call 8500003 missing; check embedded iceemperor call bundle.");
			}
			if ((Object)(object)unityAbyssalSummon == (Object)null)
			{
				Debug.LogError((object)"[AbyssalEye] Abyssal Summon 8500004 missing; check embedded abyssal summon bundle.");
			}
			ModUnit modUnit = modFaction.NewUnit("时光之主");
			modUnit.Icon = LoadEmbeddedSprite("AbyssalEye.Assets.Sprites.TimeLord.png");
			modUnit.Health = 700f;
			modUnit.Cost = 4000;
			modUnit.Size = 1.2f;
			modUnit.Mass = 1.5f;
			modUnit.Speed = 1.5f;
			modUnit.TwoHanded = false;
			modUnit.Voice.Alive = "Fantasy Light Attack Vocals/TimeNinjaTransformed";
			modUnit.Voice.Death = "Fantasy Light Death Vocals/TimeNinjaTransformed";
			modUnit.Voice.Pitch = 1f;
			modUnit.internalObject.VocalPathData.Category = "Fantasy Light Attack Vocals";
			modUnit.internalObject.VocalPathData.Effect = "TimeNinjaTransformed";
			modUnit.internalObject.VocalPathData.EffectPitch = 1f;
			modUnit.internalObject.VocalPathData.EffectVolume = 1f;
			ModWeapon modWeapon = Mod.CreateWeapon("时光之主右手武器", "Throw Dark Peasant");
			modWeapon.Cooldown = 1f;
			modWeapon.AttackRange = 15f;
			modWeapon.StartCooldown = false;
			modWeapon.Damage = 20f;
			modWeapon.Ranged.Projectile = Mod.GetProjectile("Plasma Shot");
			modWeapon.Ranged.Projectile.Damage = 50f;
			modWeapon.Force = 30f;
			modWeapon.Ranged.ProjectileAmount = 5;
			modWeapon.Ranged.Spread = 15f;
			modWeapon.Ranged.Recoil = 1f;
			modWeapon.Ranged.Ammo = 1;
			ModWeapon modWeapon2 = Mod.CreateWeapon("时光之主左手武器", "Chronomancer Time Manipulation");
			modWeapon2.Cooldown = 1f;
			modWeapon2.AttackRange = 18f;
			modWeapon2.StartCooldown = false;
			modWeapon2.Damage = 50f;
			modWeapon2.Ranged.Projectile.Damage = 100f;
			modWeapon2.Force = 100f;
			modUnit.RightWeapon = modWeapon;
			modUnit.LeftWeapon = modWeapon2;
			modWeapon.AttackSpeed = 1f;
			modWeapon2.AttackSpeed = 2f;
			modUnit.Clothes.Add("Fantasy Good necklace 00", "Fantasy Good gloria 00", "Fantasy Good shoulders 00", "Fantasy Good wrist guard 01", "Fantasy Good pants 04", "Fantasy Good leg rings 00", "Fantasy Good shoes 03", "TABG hair 01", "Banshee Chains", "Spooky cape 03", "Fantasy Evil shirt torn 00");
			modUnit.Clothes.List[8].ColorInternal(0, Utilities.HexColor("#FFFF00"));
			modUnit.Clothes.List[9].ColorInternal(0, Utilities.HexColor("#FFFFFF"));
			modUnit.Clothes.List[10].ColorInternal(0, Utilities.HexColor("#FFFFFF"));
			modUnit.Moves.Add("Melee Dodge", "Chronomancer Dial", "Solar Maelstrom", "Enrage");
			ModUnit modUnit2 = modFaction.NewUnit("方舟");
			modUnit2.Icon = LoadEmbeddedSprite("AbyssalEye.Assets.Sprites.ark.png");
			Debug.Log((object)("ark. DamageMultiplier = " + modUnit2.internalObject.damageMultiplier));
			modUnit2.Health = 1000f;
			modUnit2.Mass = 3f;
			modUnit2.Speed = 1.2f;
			modUnit2.Size = 1.2f;
			modUnit2.TwoHanded = false;
			modUnit2.Cost = 3000;
			modUnit2.Voice.Alive = "Legacy Attack Vocals/Pharaoh";
			modUnit2.Voice.Death = "Legacy Death Vocals/Pharaoh";
			modUnit2.Voice.Pitch = 1f;
			modUnit2.internalObject.VocalPathData.Category = "Legacy Attack Vocals";
			modUnit2.internalObject.VocalPathData.Effect = "Pharaoh";
			modUnit2.internalObject.VocalPathData.EffectPitch = 1f;
			modUnit2.internalObject.VocalPathData.EffectVolume = 1f;
			ModWeapon modWeapon3 = Mod.CreateWeapon("方舟右手武器", "Sacred Elephant Spear Throw");
			modWeapon3.Cooldown = 1f;
			modWeapon3.AttackRange = 25f;
			modWeapon3.StartCooldown = false;
			modWeapon3.Damage = 360f;
			ModWeapon modWeapon4 = Mod.CreateWeapon("方舟左手武器", "Thunderbolt Throw");
			modWeapon4.Cooldown = 1f;
			modWeapon4.AttackRange = 25f;
			modWeapon4.StartCooldown = false;
			modWeapon4.Damage = 80f;
			modWeapon3.AttackSpeed = 1.5f;
			modWeapon4.AttackSpeed = 1.5f;
			modUnit2.RightWeapon = modWeapon3;
			modUnit2.LeftWeapon = modWeapon4;
			modUnit2.Moves.Add("Ice Arena", "Thor Lightning", "Fire Wave", "Shogun Dodge", "Pirate Kick");
			modUnit2.Clothes.Add("Fantasy Good wrist guards 02", "Renaissance hair 00", "Turban 001", "Pirate pants 01", "Japanese leg wraps 00", "Fantasy Good leg guard 00", "Legacy shoes 00", "TABG carolean uniform 00", "Super Peasant Eyes");
			modUnit2.Clothes.List[3].ColorInternal(0, Utilities.HexColor("#FFFFFF"));
			modUnit2.Clothes.List[4].ColorInternal(0, Utilities.HexColor("#FFFFFF"));
			modUnit2.Clothes.List[5].ColorInternal(0, Utilities.HexColor("#FFFFFF"));
			modUnit2.Clothes.List[6].ColorInternal(0, Utilities.HexColor("#FFFFFF"));
			modUnit2.Clothes.List[7].ColorInternal(0, Utilities.HexColor("#FFFFFF"));
			modUnit2.Clothes.List[7].ColorInternal(2, Utilities.HexColor("#FFFFFF"));
			modUnit2.Clothes.List[7].ColorInternal(5, Utilities.HexColor("#333333"));
			modUnit2.Clothes.List[7].ColorInternal(6, Utilities.HexColor("#FFFFFF"));
			ModUnit modUnit3 = modFaction.NewUnit("虚空领主");
			modUnit3.Icon = LoadEmbeddedSprite("AbyssalEye.Assets.Sprites.voidLord.png");
			modUnit3.Base = Mod.GetBase("Void Monarch 2");
			modUnit3.internalObject.damageMultiplier = 1f;
			modUnit3.Health = 2000f;
			modUnit3.Mass = 5f;
			modUnit3.Speed = 1f;
			modUnit3.Size = 2f;
			modUnit3.TwoHanded = false;
			modUnit3.Cost = 7000;
			modUnit3.internalObject.attackSpeedMultiplier = 1.5f;
			modUnit3.internalObject.weaponSeparation = 0.5f;
			modUnit3.Voice.Alive = "Fantasy Dark Attack Vocals/DarkKingMonster";
			modUnit3.Voice.Death = "Fantasy Dark Death Vocals/DarkKingMonster";
			modUnit3.Voice.Pitch = 1f;
			modUnit3.internalObject.VocalPathData.Category = "Fantasy Dark Attack Vocals";
			modUnit3.internalObject.VocalPathData.Effect = "DarkKingMonster";
			modUnit3.internalObject.VocalPathData.EffectPitch = 1f;
			modUnit3.internalObject.VocalPathData.EffectVolume = 1f;
			ModWeapon modWeapon5 = Mod.CreateWeapon("虚空领主左手武器", "Void Monarch Claymore");
			modWeapon5.Damage = 200f;
			modUnit3.LeftWeapon = modWeapon5;
			ModWeapon modWeapon6 = Mod.CreateWeapon("虚空领主右手武器", "Void Monarch Claymore");
			modWeapon6.Damage = 200f;
			modUnit3.RightWeapon = modWeapon6;
			modUnit3.Moves.Add("Shogun Dodge", "Giant Foot Stomp", "Void Monarch Dodge", "Cavalry Charge", "Hover", "Hurricane Slash");
			modUnit3.Clothes.Add("Fantasy Evil crown 01", "Fantasy Evil chest armor 01", "Fantasy Evil wings 00", "Fantasy Evil wings 00", "Fantasy Evil kneepad 00", "Fantasy Evil pants 01", "Knight chest armor 00", "Legacy shirt 04", "Samurai wrist guard 01", "Fantasy Good shoes 04", "Fantasy Evil pants 02", "Fantasy Evil leg guard 00", "Fantasy Good chest piece 00", "Fantasy Evil arm guard 00", "Neon necklace 00", "Viking fur shoulders");
			modUnit3.Clothes.List[7].ColorInternal(0, Utilities.HexColor("#333333"));
			modUnit3.Clothes.List[7].ColorInternal(1, Utilities.HexColor("#000000"));
			modUnit3.Clothes.List[2].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit3.Clothes.List[3].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit3.Clothes.List[7].ColorInternal(2, Utilities.HexColor("#000000"));
			modUnit3.Clothes.List[6].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit3.Clothes.List[9].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit3.Clothes.List[11].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit3.Clothes.List[11].ColorInternal(0, Utilities.HexColor("#333333"));
			ModUnit modUnit4 = modFaction.NewUnit("lucky");
			modUnit4.Icon = LoadEmbeddedSprite("AbyssalEye.Assets.Sprites.lucky.png");
			modUnit4.internalObject.damageMultiplier = 1f;
			modUnit4.Health = 600f;
			modUnit4.Cost = 5555;
			modUnit4.Size = 1f;
			modUnit4.Mass = 1.2f;
			modUnit4.Speed = 1f;
			modUnit4.TwoHanded = true;
			modUnit4.internalObject.attackSpeedMultiplier = 0.4f;
			modUnit4.Voice.Alive = "Legacy Attack Vocals/Wizard";
			modUnit4.Voice.Death = "Legacy Death Vocals/Wizard";
			modUnit4.Voice.Alive = "Legacy Attack Vocals/DarkKingTransformed";
			modUnit4.Voice.Death = "Legacy Death Vocals/DarkKingTransformed";
			modUnit4.Voice.Pitch = 1f;
			modUnit4.internalObject.VocalPathData.Category = "Legacy Attack Vocals";
			modUnit4.internalObject.VocalPathData.Effect = "Wizard";
			modUnit4.internalObject.VocalPathData.EffectPitch = 1.2f;
			modUnit4.internalObject.VocalPathData.EffectVolume = 1f;
			ModWeapon modWeapon7 = Mod.CreateWeapon("lucky右手武器", "AWP");
			modWeapon7.Cooldown = 1f;
			modWeapon7.AttackRange = 1000f;
			modWeapon7.StartCooldown = false;
			modWeapon7.Damage = 200f;
			modWeapon7.Ranged.Projectile = Mod.GetProjectile("Beam Shot");
			modWeapon7.Ranged.Projectile.Damage = 2500f;
			modWeapon7.Force = 300f;
			modWeapon7.Ranged.ProjectileAmount = 1;
			modWeapon7.Ranged.Spread = 5f;
			modWeapon7.Ranged.Recoil = 10f;
			modWeapon7.Ranged.Ammo = 4;
			modUnit4.RightWeapon = modWeapon7;
			modWeapon7.AttackSpeed = 1f;
			modUnit4.Clothes.Add("Medieval shoes 00", "Pirate belt 04", "TABG helmet 05", "TABG vest 05", "TABG hoodie 01", "TABG pants 06", "TABG Marine Helmet 00", "TABG skiimask half 00");
			modUnit4.Moves.Add("Neon Mass Manipulator Field", "Shogun Dodge", "Taekwondo Kick");
			ModUnit modUnit5 = modFaction.NewUnit("摔跤手");
			modUnit5.Health = 160f;
			modUnit5.Cost = 200;
			modUnit5.Icon = Mod.GetIcon("Boxer");
			modUnit5.Size = 1.1f;
			modUnit5.Mass = 1.5f;
			modUnit5.Speed = 1.2f;
			modUnit5.TwoHanded = true;
			modUnit5.Voice.Alive = "Legacy Attack Vocals/Wizard";
			modUnit5.Voice.Death = "Legacy Death Vocals/Wizard";
			modUnit5.Voice.Pitch = 1.2f;
			modUnit5.internalObject.VocalPathData.Category = "Legacy Attack Vocals";
			modUnit5.internalObject.VocalPathData.Effect = "Wizard";
			modUnit5.internalObject.VocalPathData.EffectPitch = 1.2f;
			modUnit5.internalObject.VocalPathData.EffectVolume = 1f;
			ModWeapon modWeapon8 = Mod.CreateWeapon("摔跤手右手武器", "Minotaur Grab");
			modWeapon8.Cooldown = 1f;
			modWeapon8.AttackRange = 2f;
			modWeapon8.StartCooldown = false;
			modWeapon8.Damage = 100f;
			ModWeapon modWeapon9 = Mod.CreateWeapon("摔跤手左手武器", "Minotaur Grab");
			modWeapon9.Cooldown = 1f;
			modWeapon9.AttackRange = 2f;
			modWeapon9.StartCooldown = false;
			modWeapon9.Damage = 100f;
			modUnit5.RightWeapon = modWeapon8;
			modUnit5.LeftWeapon = modWeapon9;
			modUnit5.TwoHanded = false;
			modWeapon8.AttackSpeed = 1f;
			modWeapon9.AttackSpeed = 1f;
			modUnit5.Clothes.Add("TABG wrestling mask 00", "TABG wrestling outfit 00", "TABG Wrestling boots 00", "Viking belt 002");
			modUnit5.Clothes.List[3].ColorInternal(0, Utilities.HexColor("#FFFF00"));
			modUnit5.Clothes.List[3].ColorInternal(1, Utilities.HexColor("#FFD700"));
			modUnit5.Moves.Add("Halfling Jump", "Taekwondo Kick");
			ModUnit modUnit6 = modFaction.NewUnit("大厨");
			modUnit6.Icon = LoadEmbeddedSprite("AbyssalEye.Assets.Sprites.chef.png");
			modUnit6.Health = 200f;
			modUnit6.Cost = 500;
			modUnit6.Size = 1f;
			modUnit6.Mass = 1f;
			modUnit6.Speed = 1f;
			modUnit6.TwoHanded = false;
			modUnit6.Voice.Alive = "Legacy Attack Vocals/FlagBearer";
			modUnit6.Voice.Death = "Legacy Death Vocals/FlagBearer";
			modUnit6.Voice.Pitch = 1f;
			modUnit6.internalObject.VocalPathData.Category = "Legacy Attack Vocals";
			modUnit6.internalObject.VocalPathData.Effect = "FlagBearer";
			modUnit6.internalObject.VocalPathData.EffectPitch = 1f;
			modUnit6.internalObject.VocalPathData.EffectVolume = 1f;
			ModWeapon modWeapon10 = Mod.CreateWeapon("大厨右手武器", "Spatula");
			modWeapon10.Cooldown = 1f;
			modWeapon10.AttackRange = 2f;
			modWeapon10.StartCooldown = false;
			modWeapon10.Damage = 100f;
			modWeapon10.AttackSpeed = 1f;
			modWeapon10.Scale = new Vector3(0.7f, 0.7f, 0.7f);
			ModWeapon modWeapon11 = Mod.CreateWeapon("大厨左手武器", "Shallow Pot");
			modWeapon11.Cooldown = 1f;
			modWeapon11.AttackRange = 2f;
			modWeapon11.StartCooldown = false;
			modWeapon11.Damage = 100f;
			modWeapon11.AttackSpeed = 1f;
			modWeapon11.Scale = new Vector3(0.7f, 0.7f, 0.7f);
			modUnit6.RightWeapon = modWeapon10;
			modUnit6.LeftWeapon = modWeapon11;
			modUnit6.TwoHanded = false;
			modUnit6.Clothes.Add("Fantasy Evil shirt and apron 00", "Fantasy Good necklace 00", "TABG pants 04", "TABG boots 01", "Fantasy Good arm wraps 00", "TABG chefs hat 00", "TABG Princess Hair 00");
			modUnit6.Clothes.List[6].ColorInternal(2, Utilities.HexColor("#000000"));
			modUnit6.Moves.Add("Jester Dodge", "Fire Wave", "Teacher Parry");
			ModUnit modUnit7 = modFaction.NewUnit("燕双鹰");
			modUnit7.Icon = LoadEmbeddedSprite("AbyssalEye.Assets.Sprites.yanshuangying.png");
			modUnit7.internalObject.damageMultiplier = 3f;
			modUnit7.Health = 1000f;
			modUnit7.Cost = 4000;
			modUnit7.Size = 1.1f;
			modUnit7.Mass = 1.5f;
			modUnit7.Speed = 1f;
			modUnit7.TwoHanded = false;
			modUnit7.Voice.Alive = "Western Attack Vocals/Quickdraw";
			modUnit7.Voice.Death = "Western Death Vocals/Quickdraw";
			modUnit7.Voice.Pitch = 1.2f;
			modUnit7.internalObject.VocalPathData.Category = "Western Attack Vocals";
			modUnit7.internalObject.VocalPathData.Effect = "Quickdraw";
			modUnit7.internalObject.VocalPathData.EffectPitch = 1f;
			modUnit7.internalObject.VocalPathData.EffectVolume = 1.2f;
			ModWeapon modWeapon12 = Mod.CreateWeapon("燕双鹰右手远程武器", "Revolver Quickdraw");
			modWeapon12.Cooldown = 0.1f;
			modWeapon12.AttackRange = 70f;
			modWeapon12.StartCooldown = false;
			modWeapon12.Damage = 70f;
			modWeapon12.Ranged.Projectile = Mod.GetProjectile("Barrett Bullet");
			modWeapon12.Ranged.Projectile.Damage = 70f;
			modWeapon12.Force = 20f;
			modWeapon12.Ranged.ProjectileAmount = 3;
			modWeapon12.Ranged.Recoil = 3f;
			modWeapon12.Ranged.Ammo = 15;
			modWeapon12.AttackSpeed = 4f;
			ModWeapon modWeapon13 = Mod.CreateWeapon("燕双鹰左手近战武器", "Shogun's Katana");
			modWeapon13.Cooldown = 1f;
			modWeapon13.AttackRange = 2f;
			modWeapon13.StartCooldown = false;
			modWeapon13.Damage = 100f;
			modWeapon13.AttackSpeed = 1f;
			modWeapon13.Scale = new Vector3(0.9f, 0.75f, 0.9f);
			modUnit7.RightWeapon = modWeapon12;
			modUnit7.LeftWeapon = modWeapon13;
			modUnit7.TwoHanded = false;
			modUnit7.Clothes.Add("TABG sunglasses 00", "TABG coat 00", "Katana on back", "TABG boots 00", "TABG pants 07", "TABG Rockabilly Hair 01", "TABG shirt 04", "TABG fedora 01");
			modUnit7.Clothes.List[0].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit7.Clothes.List[1].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit7.Clothes.List[4].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit7.Clothes.List[6].ColorInternal(2, Utilities.HexColor("#666666"));
			modUnit7.Clothes.List[6].ColorInternal(3, Utilities.HexColor("#000000"));
			modUnit7.Clothes.List[7].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit7.Moves.Add("Quickdraw Dodge", "Hurricane Slash", "Shogun Dodge", "Giant Fear", "Assassin Poof", "Quickdraw Dodge");
			ModUnit modUnit8 = modFaction.NewUnit("鸡腿盾兵");
			modUnit8.Health = 200f;
			modUnit8.Cost = 600;
			modUnit8.Icon = Mod.GetIcon("Shield Wall");
			modUnit8.Size = 1.2f;
			modUnit8.Mass = 2f;
			modUnit8.Speed = 1f;
			modUnit8.TwoHanded = true;
			modUnit3.Voice.Alive = "Ancient Attack Vocals/Shield";
			modUnit3.Voice.Death = "Ancient Death Vocals/Shield";
			modUnit3.Voice.Pitch = 1f;
			modUnit3.internalObject.VocalPathData.Category = "Ancient Attack Vocals";
			modUnit3.internalObject.VocalPathData.Effect = "Shield";
			modUnit3.internalObject.VocalPathData.EffectPitch = 1f;
			modUnit3.internalObject.VocalPathData.EffectVolume = 1f;
			ModWeapon rightWeapon = Mod.CreateWeapon("鸡腿盾兵右手武器", "Wall Shield");
			modUnit8.RightWeapon = rightWeapon;
			modUnit8.TwoHanded = true;
			modUnit8.Clothes.Add("TABG turkey hat 00", "Renaissance shirt 02", "Fantasy Good chest armor 00", "Fantasy Evil pants 05", "Medieval calf armor 01");
			modUnit8.Moves.Add("Aegis Shield", "Lightning Projectile Block", "Slow Walk");
			ModUnit modUnit9 = modFaction.NewUnit("冰帝");
			modUnit9.Icon = LoadEmbeddedSprite("AbyssalEye.Assets.Sprites.berserker.png");
			modUnit9.Health = 1500f;
			modUnit9.Cost = 2500;
			modUnit9.Size = 1.4f;
			modUnit9.Mass = 5f;
			modUnit9.Speed = 1f;
			modUnit9.TwoHanded = true;
			modUnit9.Voice.Alive = "Viking Attack Vocals/Jarl";
			modUnit9.Voice.Death = "Viking Death Vocals/Jarl";
			modUnit9.Voice.Pitch = 1f;
			modUnit9.internalObject.VocalPathData.Category = "Viking Attack Vocals";
			modUnit9.internalObject.VocalPathData.Effect = "Jarl";
			modUnit9.internalObject.VocalPathData.EffectPitch = 1f;
			modUnit9.internalObject.VocalPathData.EffectVolume = 1f;
			ModWeapon modWeapon14 = Mod.CreateWeapon("冰帝右手武器", "Ice King Sword");
			modWeapon14.Cooldown = 0.4f;
			modWeapon14.AttackRange = 2f;
			modWeapon14.StartCooldown = false;
			modWeapon14.Damage = 250f;
			modWeapon14.AttackSpeed = 1f;
			modWeapon14.Scale = new Vector3(1.5f, 1.3f, 1.5f);
			modUnit9.RightWeapon = modWeapon14;
			modUnit9.TwoHanded = true;
			modUnit9.Clothes.Add("Ancient scarf 00", "Viking helmet 007", "Viking ullr helmet 00", "Beard and hair 003", "Roman chest armor 00", "Scarecrow shirt", "Vlad pants and shoes 00", "Samurai wrist guard 01", "Viking belt 001");
			modUnit9.Moves.Add("Enrage", "Giant Foot Stomp", "Banshee Scream");
			if ((Object)(object)unityIceEmperorCall != (Object)null)
			{
				modUnit9.Moves.Add(new ModMove(unityIceEmperorCall));
			}
			ModUnit modUnit10 = modFaction.NewUnit("电光人");
			modUnit10.Icon = LoadEmbeddedSprite("AbyssalEye.Assets.Sprites.dianguangren.png");
			modUnit10.internalObject.damageMultiplier = 1f;
			modUnit10.Health = 700f;
			modUnit10.Cost = 2500;
			modUnit10.Size = 1.1f;
			modUnit10.Mass = 1.5f;
			modUnit10.Speed = 1f;
			modUnit10.TwoHanded = false;
			modUnit10.Voice.Alive = "Tribal Attack Vocals/Club";
			modUnit10.Voice.Death = "Tribal Death Vocals/Club";
			modUnit10.Voice.Pitch = 1f;
			modUnit10.internalObject.VocalPathData.Category = "Tribal Attack Vocals";
			modUnit10.internalObject.VocalPathData.Effect = "Club";
			modUnit10.internalObject.VocalPathData.EffectPitch = 1.2f;
			modUnit10.internalObject.VocalPathData.EffectVolume = 1f;
			ModWeapon modWeapon15 = Mod.CreateWeapon("电光人右手武器", "Thunderbolt Throw");
			modWeapon15.Cooldown = 1.5f;
			modWeapon15.AttackRange = 22f;
			modWeapon15.StartCooldown = false;
			modWeapon15.Damage = 100f;
			modWeapon15.AttackSpeed = 0.5f;
			modWeapon15.Ranged.Projectile = Mod.GetProjectile("Tesla Shot");
			modWeapon15.Ranged.ProjectileAmount = 2;
			modWeapon15.Ranged.Spread = 15f;
			modWeapon15.Ranged.Projectile.Damage = 150f;
			modWeapon15.Force = 15f;
			modWeapon15.Ranged.Recoil = 1f;
			modWeapon15.Ranged.Ammo = 1;
			ModWeapon modWeapon16 = Mod.CreateWeapon("电光人左手武器", "Thunderbolt Throw");
			modWeapon16.Cooldown = 1.5f;
			modWeapon16.AttackRange = 22f;
			modWeapon16.StartCooldown = false;
			modWeapon16.Damage = 100f;
			modWeapon16.AttackSpeed = 0.5f;
			modWeapon16.Ranged.Projectile = Mod.GetProjectile("Stasis Shot");
			modWeapon16.Ranged.ProjectileAmount = 2;
			modWeapon16.Ranged.Spread = 15f;
			modWeapon16.Ranged.Projectile.Damage = 150f;
			modWeapon16.Force = 15f;
			modWeapon16.Ranged.Recoil = 1f;
			modWeapon16.Ranged.Ammo = 1;
			modUnit10.RightWeapon = modWeapon15;
			modUnit10.LeftWeapon = modWeapon16;
			modUnit10.TwoHanded = false;
			modUnit10.Clothes.Add("TABG balaklava 00", "Wilnyls gloves 00", "TABG hoodie 02", "TABG pants 12", "Roman belt 00", "Farmer shoes 03");
			modUnit10.Clothes.List[0].ColorInternal(0, Utilities.HexColor("#1F51FF"));
			modUnit10.Clothes.List[1].ColorInternal(0, Utilities.HexColor("#1F51FF"));
			modUnit10.Clothes.List[2].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit10.Clothes.List[3].ColorInternal(0, Utilities.HexColor("#333333"));
			modUnit10.Clothes.List[3].ColorInternal(1, Utilities.HexColor("#000000"));
			modUnit10.Clothes.List[3].ColorInternal(2, Utilities.HexColor("#333333"));
			modUnit10.Clothes.List[3].ColorInternal(3, Utilities.HexColor("#000000"));
			modUnit10.Clothes.List[5].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit10.Moves.Add("Reaper Explosion", "Thor Lightning");
			ModUnit modUnit11 = modFaction.NewUnit("拖把大爷");
			modUnit11.Icon = LoadEmbeddedSprite("AbyssalEye.Assets.Sprites.tuobaday.png");
			modUnit11.internalObject.damageMultiplier = 1f;
			modUnit11.Health = 90f;
			modUnit11.Cost = 50;
			modUnit11.Size = 1f;
			modUnit11.Mass = 1.3f;
			modUnit11.Speed = 1f;
			modUnit11.TwoHanded = false;
			modUnit10.Voice.Alive = "Legacy Attack Vocals/wizard";
			modUnit10.Voice.Death = "Legacy Death Vocals/wizard";
			modUnit10.Voice.Pitch = 1f;
			modUnit10.internalObject.VocalPathData.Category = "Legacy Attack Vocals";
			modUnit10.internalObject.VocalPathData.Effect = "wizard";
			modUnit10.internalObject.VocalPathData.EffectPitch = 1f;
			modUnit10.internalObject.VocalPathData.EffectVolume = 1f;
			ModWeapon modWeapon17 = Mod.CreateWeapon("拖把大爷右手武器", "Mop");
			modWeapon17.Scale = new Vector3(1f, 1f, 1f);
			modWeapon17.Cooldown = 1f;
			modWeapon17.AttackRange = 2f;
			modWeapon17.StartCooldown = false;
			modWeapon17.Damage = 50f;
			ModWeapon modWeapon18 = Mod.CreateWeapon("拖把大爷左手武器", "Mop");
			modWeapon18.Scale = new Vector3(1f, 1f, 1f);
			modWeapon18.Cooldown = 1f;
			modWeapon18.AttackRange = 2f;
			modWeapon18.StartCooldown = false;
			modWeapon18.Damage = 40f;
			modUnit11.RightWeapon = modWeapon17;
			modUnit11.LeftWeapon = modWeapon18;
			modUnit11.Clothes.Add("Wild West hair 03", "Wild West moustache 03", "Wild West shirt 03", "Wild West pants 02", "TABG shoes 02", "TABG glasses 01");
			modUnit11.Clothes.List[5].ColorInternal(1, Utilities.HexColor("#000000"));
			modUnit11.Moves.Add("Melee Dodge");
			ModUnit modUnit12 = modFaction.NewUnit("精神念师");
			modUnit12.Icon = LoadEmbeddedSprite("AbyssalEye.Assets.Sprites.jingshinianshi.png");
			modUnit12.internalObject.damageMultiplier = 2f;
			modUnit12.Health = 1000f;
			modUnit12.Cost = 10000;
			modUnit12.Size = 1f;
			modUnit12.Mass = 2f;
			modUnit12.Speed = 1f;
			modUnit12.TwoHanded = false;
			modUnit12.Voice.Alive = "Western Attack Vocals/Pickaxe";
			modUnit12.Voice.Death = "Western Attack Vocals/Pickaxe";
			modUnit12.Voice.Pitch = 1f;
			modUnit12.internalObject.VocalPathData.Category = "Western Attack Vocals/Pickaxe";
			modUnit12.internalObject.VocalPathData.Effect = "Pickaxe";
			modUnit12.internalObject.VocalPathData.EffectPitch = 1f;
			modUnit12.internalObject.VocalPathData.EffectVolume = 1f;
			UnitBlueprint unit = Utilities.GetUnit("Banshee");
			if ((Object)(object)unit != (Object)null && (Object)(object)unit.RightWeapon != (Object)null)
			{
				GameObject obj = Mod.CloneAndPoolObject(unit.RightWeapon);
				((Object)obj).name = "精神念师右手武器";
				modUnit12.RightWeapon = new ModWeapon(obj, isClone: true)
				{
					Cooldown = 0.5f,
					AttackRange = 30f,
					StartCooldown = false,
					Damage = 150f,
					AttackSpeed = 1f,
					Scale = new Vector3(1f, 1f, 1f)
				};
			}
			if ((Object)(object)unit != (Object)null && (Object)(object)unit.LeftWeapon != (Object)null)
			{
				GameObject obj2 = Mod.CloneAndPoolObject(unit.LeftWeapon);
				((Object)obj2).name = "精神念师左手武器";
				modUnit12.LeftWeapon = new ModWeapon(obj2, isClone: true)
				{
					Cooldown = 0.5f,
					AttackRange = 30f,
					StartCooldown = false,
					Damage = 150f,
					AttackSpeed = 1f,
					Scale = new Vector3(1f, 1f, 1f)
				};
			}
			modUnit12.TwoHanded = false;
			modUnit12.Clothes.Add("Spooky hood 00", "TABG balaklava 00", "Pattern Mask 02", "Roman chest armor 01", "Mongolian armor 00", "Fantasy Evil arm guard 00", "Samurai wrist guard 01", "Wilnyl shirt 00", "TABG pants 11", "Wild West boots 00", "Wilnyls gloves 00");
			modUnit12.Clothes.List[0].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit12.Clothes.List[1].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit12.Clothes.List[2].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit12.Clothes.List[2].ColorInternal(1, Utilities.HexColor("#000000"));
			modUnit12.Clothes.List[2].ColorInternal(2, Utilities.HexColor("#000000"));
			modUnit12.Clothes.List[2].ColorInternal(3, Utilities.HexColor("#DFFF00"));
			modUnit12.Clothes.List[3].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit12.Clothes.List[3].ColorInternal(1, Utilities.HexColor("#000000"));
			modUnit12.Clothes.List[3].ColorInternal(2, Utilities.HexColor("#333333"));
			modUnit12.Clothes.List[3].ColorInternal(3, Utilities.HexColor("#000000"));
			modUnit12.Clothes.List[4].ColorInternal(0, Utilities.HexColor("#333333"));
			modUnit12.Clothes.List[4].ColorInternal(1, Utilities.HexColor("#1A1A1A"));
			modUnit12.Clothes.List[4].ColorInternal(2, Utilities.HexColor("#000000"));
			modUnit12.Clothes.List[6].ColorInternal(0, Utilities.HexColor("#333333"));
			modUnit12.Clothes.List[6].ColorInternal(2, Utilities.HexColor("#FF0000"));
			modUnit12.Clothes.List[6].ColorInternal(1, Utilities.HexColor("#DFFF00"));
			modUnit12.Clothes.List[7].ColorInternal(1, Utilities.HexColor("#000000"));
			modUnit12.Clothes.List[7].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit12.Clothes.List[8].ColorInternal(1, Utilities.HexColor("#1A1A1A"));
			modUnit12.Clothes.List[8].ColorInternal(0, Utilities.HexColor("#333333"));
			modUnit12.Clothes.List[9].ColorInternal(0, Utilities.HexColor("#1A1A1A"));
			modUnit12.Clothes.List[10].ColorInternal(0, Utilities.HexColor("#333333"));
			modUnit12.Moves.Add("Hover", "Reaper Explosion", "Enrage", "Taekwondo Kick", "Shogun Dodge");
			GameObject combatMove = ContentDatabase.Instance().LandfallContentDatabase.GetCombatMove(new DatabaseID(DatabaseID._LOCAL_CONTENT, 8500002));
			if ((Object)(object)combatMove != (Object)null)
			{
				modUnit12.Moves.Add(new ModMove(combatMove));
			}
			else
			{
				Debug.LogError((object)"[AbyssalEye] Death Aura 8500002 missing; check embedded deathaura bundle.");
			}
			ModUnit modUnit13 = modFaction.NewUnit("玉面手雷王");
			modUnit13.Icon = LoadEmbeddedSprite("AbyssalEye.Assets.Sprites.grenadeKing.png");
			modUnit13.internalObject.damageMultiplier = 1f;
			modUnit13.Health = 150f;
			modUnit13.Cost = 800;
			modUnit13.Size = 1.2f;
			modUnit13.Mass = 1f;
			modUnit13.Speed = 2f;
			modUnit13.Voice.Alive = "Secret Attack Vocals/Jester";
			modUnit13.Voice.Death = "Secret Death Vocals/Jester";
			modUnit13.Voice.Pitch = 1f;
			modUnit13.internalObject.VocalPathData.Category = "Secret Attack Vocals";
			modUnit13.internalObject.VocalPathData.Effect = "Jester";
			modUnit13.internalObject.VocalPathData.EffectPitch = 1f;
			modUnit13.internalObject.VocalPathData.EffectVolume = 1f;
			ModWeapon modWeapon19 = Mod.CreateWeapon("玉面手雷王右手武器", "Bomb On A Stick 2");
			modWeapon19.Scale = new Vector3(1f, 1f, 1f);
			modWeapon19.Cooldown = 1f;
			modWeapon19.AttackRange = 3f;
			modWeapon19.StartCooldown = false;
			modWeapon19.Damage = 700f;
			modWeapon19.AttackSpeed = 2f;
			ModWeapon modWeapon20 = Mod.CreateWeapon("玉面手雷王左手武器", "Throw Dark Peasant");
			modWeapon20.Cooldown = 20f;
			modWeapon20.AttackRange = 10f;
			modWeapon20.StartCooldown = false;
			modWeapon20.Ranged.Projectile = Mod.GetProjectile("Bomb");
			modWeapon20.Damage = 75f;
			modWeapon20.Ranged.Projectile.Damage = 120f;
			modWeapon20.Force = 55f;
			modWeapon20.Ranged.ProjectileAmount = 6;
			modWeapon20.Ranged.Spread = 10f;
			modWeapon20.Ranged.Recoil = 1f;
			modWeapon20.Ranged.Ammo = 1;
			modWeapon20.Ranged.Projectile.Scale = new Vector3(2f, 2f, 2f);
			modUnit13.RightWeapon = modWeapon19;
			modUnit13.LeftWeapon = modWeapon20;
			modUnit13.TwoHanded = false;
			modUnit13.Clothes.Add("TABG dad hair 00", "TABG pants 04", "TABG shoes 02", "Pirate coat 01", "Legacy shirt 00", "World War belt 00", "Wild West belt 01", "Pirate belt 04");
			modUnit13.Clothes.List[0].ColorInternal(0, Utilities.HexColor("#1A1A1A"));
			modUnit13.Clothes.List[1].ColorInternal(0, Utilities.HexColor("#1A1A1A"));
			modUnit13.Clothes.List[1].ColorInternal(1, Utilities.HexColor("#333333"));
			modUnit13.Clothes.List[1].ColorInternal(2, Utilities.HexColor("#1A1A1A"));
			modUnit13.Clothes.List[3].ColorInternal(0, Utilities.HexColor("#333333"));
			modUnit13.Clothes.List[3].ColorInternal(1, Utilities.HexColor("#000000"));
			modUnit13.Clothes.List[4].ColorInternal(0, Utilities.HexColor("#FFFFFF"));
			modUnit13.Clothes.List[4].ColorInternal(1, Utilities.HexColor("#1A1A1A"));
			modUnit13.Moves.Add("Explosive Death", "Bomb Spin", "Super Jump");
			ModUnit modUnit14 = modFaction.NewUnit("橄榄球手");
			modUnit14.Icon = LoadEmbeddedSprite("AbyssalEye.Assets.Sprites.footballPlayer.png");
			modUnit14.internalObject.damageMultiplier = 1.3f;
			modUnit14.Health = 700f;
			modUnit14.Cost = 1500;
			modUnit14.Size = 1.1f;
			modUnit14.Mass = 1f;
			modUnit14.Speed = 5f;
			modUnit14.TwoHanded = false;
			modUnit14.Voice.Alive = "Pirate Attack Vocals/Blunderbus";
			modUnit14.Voice.Death = "Pirate Death Vocals/Blunderbus";
			modUnit14.Voice.Pitch = 1f;
			modUnit14.internalObject.VocalPathData.Category = "Pirate Attack Vocals";
			modUnit14.internalObject.VocalPathData.Effect = "Blunderbus";
			modUnit14.internalObject.VocalPathData.EffectPitch = 1f;
			modUnit14.internalObject.VocalPathData.EffectVolume = 1f;
			ModWeapon modWeapon21 = Mod.CreateWeapon("橄榄球手右手武器", "Minotaur Grab");
			modWeapon21.Cooldown = 1f;
			modWeapon21.AttackRange = 2f;
			modWeapon21.StartCooldown = false;
			modWeapon21.Damage = 100f;
			ModWeapon modWeapon22 = Mod.CreateWeapon("橄榄球手左手武器", "Minotaur Grab");
			modWeapon22.Cooldown = 1f;
			modWeapon22.AttackRange = 2f;
			modWeapon22.StartCooldown = false;
			modWeapon22.Damage = 100f;
			modUnit14.RightWeapon = modWeapon21;
			modUnit14.LeftWeapon = modWeapon22;
			modUnit14.TwoHanded = false;
			modWeapon21.AttackSpeed = 1f;
			modWeapon22.AttackSpeed = 1f;
			modUnit14.Clothes.Add("TABG pants 10", "TABG tracksuit jacket 00", "Roman wristguard 00", "Fantasy Good glove 00", "TABG skiimask half 00", "TABG vest 04", "TABG Football Helmet 00", "TABG pants 03", "TABG Wrestling boots 00", "Medieval wrist guard 00");
			modUnit14.Clothes.List[0].ColorInternal(0, Utilities.HexColor("#800020"));
			modUnit14.Clothes.List[1].ColorInternal(0, Utilities.HexColor("#800020"));
			modUnit14.Clothes.List[1].ColorInternal(1, Utilities.HexColor("#FFFF00"));
			modUnit14.Clothes.List[1].ColorInternal(2, Utilities.HexColor("#FFFF00"));
			modUnit14.Clothes.List[2].ColorInternal(0, Utilities.HexColor("#FFFF00"));
			modUnit14.Clothes.List[2].ColorInternal(1, Utilities.HexColor("#800020"));
			modUnit14.Clothes.List[3].ColorInternal(0, Utilities.HexColor("#800020"));
			modUnit14.Clothes.List[5].ColorInternal(0, Utilities.HexColor("#800020"));
			modUnit14.Clothes.List[5].ColorInternal(0, Utilities.HexColor("#800020"));
			modUnit14.Clothes.List[6].ColorInternal(2, Utilities.HexColor("#800020"));
			modUnit14.Clothes.List[7].ColorInternal(0, Utilities.HexColor("#800020"));
			modUnit14.Clothes.List[8].ColorInternal(1, Utilities.HexColor("#800020"));
			modUnit14.Clothes.List[8].ColorInternal(2, Utilities.HexColor("#800020"));
			modUnit14.Clothes.List[9].ColorInternal(0, Utilities.HexColor("#800020"));
			modUnit14.Clothes.List[9].ColorInternal(1, Utilities.HexColor("#800020"));
			modUnit14.Moves.Add("Melee Dodge");
			if ((Object)(object)unityFootballCharge != (Object)null)
			{
				modUnit14.Moves.Add(new ModMove(unityFootballCharge));
				Debug.Log((object)"[AbyssalEye] 橄榄球手已装备 Unity FootballCharge (8500001)");
			}
			else
			{
				Debug.LogError((object)"[AbyssalEye] 找不到 Unity FootballCharge (-2, 8500001),请检查 DLL 内嵌技能资源包。");
			}
		}
	}
	[DisallowMultipleComponent]
	[RequireComponent(typeof(CollisionWeapon))]
	[AddComponentMenu("Abyssal Eye/Max Health Weapon Damage")]
	public sealed class MaxHealthWeaponDamage : CollisionWeaponEffect
	{
		[Tooltip("0.10 means an extra 10% of the target's maximum health per valid weapon hit.")]
		[Range(0f, 1f)]
		public float maxHealthFraction = 0.1f;

		public override void DoEffect(Transform hitTransform, Collision collision)
		{
			//IL_00f2: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			if (!((Behaviour)this).isActiveAndEnabled || maxHealthFraction <= 0f)
			{
				return;
			}
			CollisionWeapon component = ((Component)this).GetComponent<CollisionWeapon>();
			HealthHandler val = (HealthHandler)(((Object)(object)component != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			DataHandler component2 = ((Component)val).GetComponent<DataHandler>();
			if (!((Object)(object)component2 == (Object)null) && !component2.Dead && !(component2.maxHealth <= 0f) && !float.IsNaN(component2.maxHealth) && !float.IsInfinity(component2.maxHealth))
			{
				Holdable component3 = ((Component)this).GetComponent<Holdable>();
				Unit val2 = (((Object)(object)component3 != (Object)null && (Object)(object)component3.holderData != (Object)null) ? ((Component)component3.holderData).GetComponentInParent<Unit>() : ((Component)this).GetComponentInParent<Unit>());
				if (!((Object)(object)val2 != (Object)null) || !((Object)(object)component2.unit != (Object)null) || val2.Team != component2.unit.Team)
				{
					((Damagable)val).TakeDamage(component2.maxHealth * Mathf.Clamp01(maxHealthFraction), Vector3.zero, val2, (DamageType)0);
				}
			}
		}
	}
	[HarmonyPatch(typeof(UnitColorHandler), "SetMaterial")]
	internal static class NativeMaterialTransitionPatch
	{
		private static void Prefix(UnitColorHandler __instance)
		{
			__instance.ForceReInitialize();
		}
	}
	public static class Utilities
	{
		private static readonly string[] sanitizationFilter;

		private static readonly Dictionary<GearType, string[]> boneDictionary;

		public static readonly Quaternion blenderToUnity;

		public static readonly string rootPath;

		public static Dictionary<string, string> language;

		public static readonly ContentDatabase fullDatabase;

		public static readonly LandfallContentDatabase database;

		public static Explosion[] explosions;

		public static UnitEffectBase[] effects;

		public static Sprite[] sprites;

		public static readonly ModExplosion unitSpawner;

		public static readonly ModFaction baseFaction;

		static Utilities()
		{
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Expected O, but got Unknown
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0445: Unknown result type (might be due to invalid IL or missing references)
			sanitizationFilter = new string[33]
			{
				"Icon_Legacy_", "Icons_128x128_", "Icons_", "Icon_", "CP_", "P_", "E_", " Prefabs_VB", " Effects_VB", "_1",
				"_2", "_3", " (1)", " (2)", " (3)", " (4)", " (5)", " (6)", "B_", "Move_",
				"Leg_", "1_", "12_", "15_", "6__", "7_", "14_", "2_", "8_", "10_",
				"16_", "5_", "3_"
			};
			boneDictionary = new Dictionary<GearType, string[]>
			{
				{
					(GearType)0,
					new string[1] { "M_Head" }
				},
				{
					(GearType)1,
					new string[1] { "M_Neck" }
				},
				{
					(GearType)2,
					new string[2] { "M_Shoulder_Right", "M_Shoulder_Left" }
				},
				{
					(GearType)3,
					new string[1] { "M_Torso" }
				},
				{
					(GearType)4,
					new string[2] { "M_Arm_Right", "M_Arm_Left" }
				},
				{
					(GearType)5,
					new string[2] { "M_Wrist_Right", "M_Wrist_Left" }
				},
				{
					(GearType)7,
					new string[1] { "M_Waist" }
				},
				{
					(GearType)8,
					new string[2] { "M_Leg_Right", "M_Leg_Left" }
				},
				{
					(GearType)9,
					new string[2] { "M_Foot_Right", "M_Foot_Left" }
				}
			};
			blenderToUnity = Quaternion.Euler(-90f, 0f, 0f);
			rootPath = Directory.GetParent(Assembly.GetExecutingAssembly().Location)?.ToString();
			language = Localizer.GetLanguage((Language)0);
			fullDatabase = ContentDatabase.Instance();
			database = ContentDatabase.Instance().LandfallContentDatabase;
			explosions = Resources.FindObjectsOfTypeAll<Explosion>();
			effects = Resources.FindObjectsOfTypeAll<UnitEffectBase>();
			sprites = Resources.FindObjectsOfTypeAll<Sprite>();
			unitSpawner = new ModExplosion(Mod.PoolObject(new GameObject("UnitSpawner", new Type[1] { typeof(UnitSpawner) })));
			List<string> source = (from z in (from z in language
					group z by z.Value into z
					where z.Count() > 1
					select z).SelectMany((IGrouping<string, KeyValuePair<string, string>> z) => z)
				select z.Key).ToList();
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			foreach (string item in source.Where((string v) => language[v] != null && language[v] != string.Empty))
			{
				if (!dictionary.ContainsKey(language[item]))
				{
					dictionary.Add(language[item], 1);
					continue;
				}
				dictionary[language[item]]++;
				language[item] = language[item] + " " + dictionary[language[item]];
			}
			Faction obj = Object.Instantiate<Faction>(GetFaction("Medieval"));
			obj.Entity.GenerateNewID();
			obj.Entity.Name = "Base Faction";
			obj.Units = Array.Empty<UnitBlueprint>();
			obj.index = database.GetFactions().ToList().Count;
			obj.m_FactionColor = HexColor("#888888");
			obj.m_displayFaction = false;
			AddFactionToDatabase(obj);
			baseFaction = new ModFaction(obj);
			if (Mod.DEV_MODE)
			{
				string text = Path.Combine(rootPath, "MFDPrints");
				if (!Directory.Exists(text))
				{
					Directory.CreateDirectory(text);
				}
				string contents = string.Join(Environment.NewLine, from GameObject weapon in database.GetWeapons()
					where (Object)(object)weapon != (Object)null
					select GetProperName(((CharacterItem)weapon.GetComponentInChildren<WeaponItem>()).Entity.Name));
				File.WriteAllText(Path.Combine(text, "weapons.txt"), contents);
				string contents2 = string.Join(Environment.NewLine, from GameObject unitBase in database.GetUnitBases()
					where (Object)(object)unitBase != (Object)null
					select GetProperName(unitBase.GetComponentInChildren<Unit>().Entity.Name));
				File.WriteAllText(Path.Combine(text, "bases.txt"), contents2);
				string contents3 = string.Join(Environment.NewLine, from GameObject clothing in database.GetCharacterProps()
					where (Object)(object)clothing != (Object)null
					select GetProperName(((CharacterItem)clothing.GetComponentInChildren<PropItem>()).Entity.Name));
				File.WriteAllText(Path.Combine(text, "clothing.txt"), contents3);
				string contents4 = string.Join(Environment.NewLine, from IDatabaseEntity unit in database.GetUnitBlueprints()
					select GetProperName(unit.Entity.Name));
				File.WriteAllText(Path.Combine(text, "unit.txt"), contents4);
				string contents5 = string.Join(Environment.NewLine, from IDatabaseEntity faction in database.GetFactions()
					select GetProperName(faction.Entity.Name));
				File.WriteAllText(Path.Combine(text, "factions.txt"), contents5);
				string contents6 = string.Join(Environment.NewLine, from Explosion explosion in explosions
					where (Object)(object)explosion != (Object)null
					select GetProperName(((Object)((Component)explosion).gameObject).name));
				File.WriteAllText(Path.Combine(text, "explosions.txt"), contents6);
				string contents7 = string.Join(Environment.NewLine, from UnitEffectBase effect in effects
					where (Object)(object)effect != (Object)null
					select GetProperName(((Object)((Component)effect).gameObject).name));
				File.WriteAllText(Path.Combine(text, "effects.txt"), contents7);
				string contents8 = string.Join(Environment.NewLine, from GameObject projectile in database.GetProjectiles()
					select GetProperName(projectile.GetComponentInChildren<ProjectileEntity>().Entity.Name));
				File.WriteAllText(Path.Combine(text, "projectiles.txt"), contents8);
				string contents9 = string.Join(Environment.NewLine, from GameObject move in database.GetCombatMoves()
					select GetProperName(((CharacterItem)move.GetComponentInChildren<SpecialAbility>()).Entity.Name));
				File.WriteAllText(Path.Combine(text, "moves.txt"), contents9);
				string contents10 = string.Join(Environment.NewLine, from FactionIcon icon in fullDatabase.GetFactionIcons()
					select GetProperName(icon.Entity.Name));
				File.WriteAllText(Path.Combine(text, "icons.txt"), contents10);
				string contents11 = string.Join(Environment.NewLine, from Sprite icon in Resources.FindObjectsOfTypeAll<Sprite>()
					select GetProperName(((Object)icon).name));
				File.WriteAllText(Path.Combine(text, "iconsExtra.txt"), contents11);
			}
		}

		public static object CallMethod(this object o, string methodName, params object[] args)
		{
			MethodInfo method = o.GetType().GetMethod(methodName, (BindingFlags)(-1));
			if (method != null)
			{
				return method.Invoke(o, args);
			}
			Debug.Log((object)("Call Method " + methodName + " nulled"));
			return null;
		}

		public static object GetField<T>(this T instance, string fieldName, BindingFlags flags = (BindingFlags)(-1))
		{
			FieldInfo field = typeof(T).GetField(fieldName, flags);
			try
			{
				field.GetValue(instance);
			}
			catch
			{
				Debug.Log((object)$"(GetField) Failed to get field '{fieldName}' for object '{typeof(T)}'. Try using manual BindingFlags.");
			}
			return field.GetValue(instance);
		}

		public static void SetField<T>(this T instance, string fieldName, object newValue, BindingFlags flags = (BindingFlags)(-1))
		{
			FieldInfo field = typeof(T).GetField(fieldName, flags);
			Debug.Log((object)field);
			try
			{
				field.SetValue(instance, newValue);
			}
			catch
			{
				Debug.Log((object)$"(SetField) Failed to set field '{fieldName}' for object '{typeof(T)}'. Try using manual BindingFlags.");
			}
		}

		public static Transform SetHideFlagsChildren(this Transform t, HideFlags hf = (HideFlags)52)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((Component)t).gameObject))
			{
				((Object)((Component)t).gameObject).hideFlags = hf;
			}
			if (t.childCount > 0)
			{
				for (int i = 0; i < t.childCount; i++)
				{
					t.GetChild(i).SetHideFlagsChildren(hf);
				}
			}
			return t;
		}

		public static Sprite CreateSprite(string path)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_004b: 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)
			if (string.IsNullOrEmpty(path))
			{
				return null;
			}
			if (!File.Exists(path))
			{
				return null;
			}
			byte[] array = File.ReadAllBytes(path);
			Texture2D val = new Texture2D(1, 1);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = (FilterMode)0;
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0f, 0f), 1f);
		}

		public static bool NullCheck(this object self, string flag = "Object")
		{
			Debug.Log((object)("[NULLCHECK] " + flag + " is " + ((self == null) ? "NULL" : "REAL") + "!"));
			return self == null;
		}

		public static T GetResourcesObj<T>(string obj)
		{
			return (T)(object)((IEnumerable<Object>)Resources.FindObjectsOfTypeAll(typeof(T))).FirstOrDefault((Func<Object, bool>)((Object x) => x.name.Contains(obj)));
		}

		public static string IncrementName(string name)
		{
			if (!name.Contains(";"))
			{
				return name + ";1";
			}
			return name.Split(new char[1] { ';' })[0] + int.Parse(name.Split(new char[1] { ';' })[1]) + 1;
		}

		public static void ForEach<T>(this IEnumerable<T> collection, Action<T> action)
		{
			foreach (T item in collection)
			{
				action(item);
			}
		}

		public static void ForEach<T>(this T[] array, Action<T> action)
		{
			foreach (T obj in array)
			{
				action(obj);
			}
		}

		public static Dictionary<V, U> Reverse<U, V>(this Dictionary<U, V> self)
		{
			Dictionary<V, U> dictionary = new Dictionary<V, U>();
			foreach (U key in self.Keys)
			{
				dictionary[self[key]] = key;
			}
			return dictionary;
		}

		public static Color HexColor(string hexCode)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			hexCode = (hexCode.StartsWith("#") ? hexCode : ("#" + hexCode)).ToUpper();
			Color result = default(Color);
			ColorUtility.TryParseHtmlString(hexCode, ref result);
			return result;
		}

		public static T FindVanillaObject<T>(IEnumerable<T> source, string name, Func<T, string> getName)
		{
			return source.FirstOrDefault((T o) => name == GetProperName(getName(o)));
		}

		public static string GetProperName(string name)
		{
			string text = null;
			if (language.ContainsKey(name))
			{
				text = language[name];
			}
			else
			{
				text = name;
				string[] array = sanitizationFilter;
				foreach (string oldValue in array)
				{
					text = text.Replace(oldValue, "");
				}
			}
			return text;
		}

		public static string DeepString(this GameObject self)
		{
			string text = "\nGameObject '" + ((Object)self).name + "':\n{\n\tComponents:\n\t{\n";
			text = string.Concat(text, string.Concat(from Component component in self.GetComponents<Component>()
				select "\t\t" + ((object)component).GetType().Name + "\n"));
			text += "\t}\n";
			if (self.transform.childCount > 0)
			{
				text += "\tChildren:\n\t{\n";
				text = string.Concat(text, string.Concat(from Transform child in (IEnumerable)self.transform
					select ((Component)child).gameObject.DeepString().Replace("\n", "\n\t\t")));
				text += "\n\t}\n";
			}
			return text + "}\n";
		}

		public static void PlaceMeshOnBone(SkinnedMeshRenderer renderer, GameObject mesh, GearType gearType)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			string text = boneDictionary[gearType][0];
			Transform[] bones = renderer.bones;
			foreach (Transform val in bones)
			{
				if (((Object)val).name == text)
				{
					mesh.transform.parent = ((Component)val).transform;
					mesh.transform.localPosition = Vector3.zero;
					mesh.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f);
				}
			}
		}

		public static void SetMeshRenderers(GameObject gameObject, bool enabled)
		{
			Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Type type = ((object)componentsInChildren[i]).GetType();
				if (type == typeof(MeshRenderer) || type == typeof(SkinnedMeshRenderer))
				{
					componentsInChildren[i].enabled = enabled;
				}
			}
		}

		public static void SetObjectColor(GameObject colorObject, int index, Color color, float glow)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			Renderer[] bestRenderers = GetBestRenderers(colorObject);
			Renderer bestRenderer = GetBestRenderer(colorObject);
			bool flag = (Object)(object)colorObject.GetComponentInChildren<LODGroup>() != (Object)null;
			Dictionary<Color, Material> dictionary = new Dictionary<Color, Material>();
			Material[] materials = bestRenderer.materials;
			Material val = new Material(Shader.Find("Standard"));
			val.color = color;
			if (glow > 0f)
			{
				val.EnableKeyword("_EMISSION");
				val.SetColor("_EmissionColor", val.color * glow);
			}
			val.SetFloat("_Glossiness", 0f);
			if (!Object.op_Implicit((Object)(object)bestRenderer))
			{
				return;
			}
			for (int i = 0; i < materials.Length; i++)
			{
				if (i == index)
				{
					dictionary[materials[i].color] = val;
				}
			}
			if (bestRenderers == null || bestRenderers.Length == 0)
			{
				return;
			}
			Renderer[] array;
			if (flag)
			{
				array = bestRenderers;
				foreach (Renderer val2 in array)
				{
					List<TeamColor> source = ((Component)val2).GetComponents<TeamColor>().ToList();
					List<TeamColor> removed = new List<TeamColor>();
					Material[] materials2 = val2.materials;
					List<Material> list = new List<Material>();
					int k;
					for (k = 0; k < materials2.Length; k++)
					{
						Material val3 = null;
						if (dictionary.ContainsKey(materials2[k].color))
						{
							val3 = dictionary[materials2[k].color];
						}
						if ((Object)(object)val3 != (Object)null)
						{
							list.Add(val3);
							foreach (TeamColor item in source.Where((TeamColor tc) => !removed.Contains(tc) && tc.materialID == k))
							{
								removed.Add(item);
								Object.DestroyImmediate((Object)(object)item);
							}
						}
						else
						{
							list.Add(materials2[k]);
						}
					}
					val2.materials = list.ToArray();
				}
				return;
			}
			int num = 0;
			array = bestRenderers;
			foreach (Renderer val4 in array)
			{
				Material[] materials3 = val4.materials;
				List<TeamColor> list2 = ((Component)val4).GetComponents<TeamColor>().ToList();
				for (int num2 = 0; num2 < materials3.Length; num2++)
				{
					if (num + num2 != index)
					{
						continue;
					}
					materials3[num2] = val;
					foreach (TeamColor item2 in list2)
					{
						if (item2.materialID == num2)
						{
							Object.DestroyImmediate((Object)(object)item2);
						}
					}
				}
				num++;
				val4.materials = materials3;
			}
		}

		public static void SetClothScale(ModClothing clothing, Vector3 scale)
		{
			//IL_004f: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: 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_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			GameObject internalObject = clothing.internalObject;
			if ((Object)(object)internalObject.GetComponentInChildren<MeshRenderer>() != (Object)null)
			{
				MeshRenderer[] componentsInChildren = internalObject.GetComponentsInChildren<MeshRenderer>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					((Component)componentsInChildren[i]).transform.localScale = scale;
				}
			}
			if (!((Object)(object)internalObject.GetComponentInChildren<SkinnedMeshRenderer>() != (Object)null))
			{
				return;
			}
			Vector3 localScale = internalObject.transform.localScale;
			SkinnedMeshRenderer[] componentsInChildren2 = internalObject.GetComponentsInChildren<SkinnedMeshRenderer>();
			foreach (SkinnedMeshRenderer val in componentsInChildren2)
			{
				val.sharedMesh = Object.Instantiate<Mesh>(val.sharedMesh);
				Mesh sharedMesh = val.sharedMesh;
				((Object)sharedMesh).name = clothing.Name + "sharedmesh";
				Vector3[] vertices = sharedMesh.vertices;
				if (vertices == null)
				{
					vertices = sharedMesh.vertices;
				}
				Debug.Log((object)("baseVertices " + vertices.Length));
				Vector3[] array = (Vector3[])(object)new Vector3[vertices.Length];
				for (int j = 0; j < array.Length; j++)
				{
					Vector3 val2 = vertices[j];
					val2.x /= localScale.x;
					val2.y /= localScale.y;
					val2.z /= localScale.z;
					val2.x *= scale.x;
					val2.y *= scale.y;
					val2.z *= scale.z;
					array[j] = val2;
				}
				internalObject.transform.localScale = scale;
				sharedMesh.vertices = array;
				sharedMesh.RecalculateBounds();
				val.sharedMesh = sharedMesh;
			}
		}

		public static Renderer GetBestRenderer(GameObject gameObject, Type rendererType = null)
		{
			if (rendererType == null)
			{
				rendererType = typeof(Renderer);
			}
			else if (!rendererType.IsSubclassOf(typeof(Renderer)))
			{
				return null;
			}
			Renderer val = null;
			Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>();
			bool flag = false;
			Renderer[] array = componentsInChildren;
			foreach (Renderer val2 in array)
			{
				if (((object)val2).GetType() == rendererType || rendererType == typeof(Renderer))
				{
					string name = ((Object)((Component)val2).gameObject).name;
					if (name.Contains("LOD0"))
					{
						val = val2;
						flag = true;
					}
					else if (name.Contains("CP_") && !flag)
					{
						val = val2;
						flag = true;
					}
					else if (name.ToLower().Contains(((Object)gameObject.gameObject).name.ToLower()) && !flag)
					{
						val = val2;
					}
					else if (!Object.op_Implicit((Object)(object)val) && name != "RightHand" && name != "LeftHand" && !flag)
					{
						val = val2;
					}
				}
			}
			return val;
		}

		public static Renderer[] GetBestRenderers(GameObject gameObject, Type rendererType = null)
		{
			if (rendererType == null)
			{
				rendererType = typeof(Renderer);
			}
			else if (!rendererType.IsSubclassOf(typeof(Renderer)))
			{
				return null;
			}
			Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>();
			List<Renderer> list = new List<Renderer>();
			bool flag = false;
			LODGroup componentInChildren = gameObject.GetComponentInChildren<LODGroup>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				flag = true;
				list.AddRange(componentInChildren.GetLODs().SelectMany((LOD lod) => lod.renderers));
			}
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				if (!list.Contains(val) && (((object)val).GetType() == rendererType || rendererType == typeof(Renderer)))
				{
					string name = ((Object)gameObject).name;
					if (name.Contains("LOD") && ((Object)((Component)val).transform.parent).name.ToLower().Contains("base"))
					{
						list.Add(val);
						flag = true;
					}
					else if (name.Contains("LOD"))
					{
						list.Add(val);
						flag = true;
					}
					else if (name.Contains("CP_") && !flag)
					{
						list.Add(val);
						flag = true;
					}
					else if (name.ToLower().Contains(((Object)gameObject).name.ToLower()) && !flag)
					{
						list.Add(val);
					}
					else if (list.Count <= 0 && name != "RightHand" && name != "LeftHand" && !flag)
					{
						list.Add(val);
					}
				}
			}
			return list.ToArray();
		}

		public static GameObject GetUnitBase(string name)
		{
			return FindVanillaObject(database.GetUnitBases(), name, (GameObject ub) => ub.GetComponentInChildren<Unit>().Entity.Name);
		}

		public static GameObject GetClothing(string name)
		{
			return FindVanillaObject(database.GetCharacterProps(), name, (GameObject c) => ((CharacterItem)c.GetComponentInChildren<PropItem>()).Entity.Name);
		}

		public static GameObject GetWeapon(string name)
		{
			return FindVanillaObject(database.GetWeapons(), name, (GameObject w) => ((CharacterItem)w.GetComponentInChildren<WeaponItem>()).Entity.Name);
		}

		public static GameObject GetMove(string name)
		{
			return FindVanillaObject(database.GetCombatMoves(), name, (GameObject m) => ((CharacterItem)m.GetComponentInChildren<SpecialAbility>()).Entity.Name);
		}

		public static GameObject GetProjectile(string name)
		{
			GameObject gameObject = FindVanillaObject(database.GetProjectiles(), name, (GameObject p) => p.GetComponent<ProjectileEntity>().Entity.Name).gameObject;
			if (!((Object)(object)gameObject != (Object)null))
			{
				return null;
			}
			return gameObject.gameObject;
		}

		public static GameObject GetExplosion(string name)
		{
			Explosion val = FindVanillaObject(explosions, name, (Explosion e) => ((Object)((Component)e).gameObject).name);
			if (!((Object)(object)val != (Object)null))
			{
				return null;
			}
			return ((Component)val).gameObject;
		}

		public static UnitEffectBase GetEffect(string name)
		{
			return FindVanillaObject(effects, name, (UnitEffectBase e) => ((Object)((Component)e).gameObject).name);
		}

		public static Sprite GetIcon(string name)
		{
			FactionIcon val = FindVanillaObject(fullDatabase.GetFactionIcons(), name, (FactionIcon i) => i.Entity.Name);
			if ((Object)(object)val != (Object)null)
			{
				return val.Entity.SpriteIcon;
			}
			Sprite val2 = FindVanillaObject(AssetImporter.Sprites, name, (Sprite s) => ((Object)s).name);
			if ((Object)(object)val2 != (Object)null)
			{
				return val2;
			}
			return FindVanillaObject(sprites, name, (Sprite s) => ((Object)s).name);
		}

		public static UnitBlueprint GetUnit(string name)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			UnitBlueprint val = FindVanillaObject(database.GetUnitBlueprints(), name, (UnitBlueprint u) => u.Entity.Name);
			if (!((Object)(object)val != (Object)null))
			{
				return null;
			}
			return database.GetUnitBlueprint(val.Entity.GUID);
		}

		public static Faction GetFaction(string name)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			Faction val = FindVanillaObject(database.GetFactions(), name, (Faction f) => f.Entity.Name);
			if (!((Object)(object)val != (Object)null))
			{
				return null;
			}
			return database.GetFaction(val.Entity.GUID);
		}

		public static void AddUnitToDatabase(UnitBlueprint unit)
		{
			//IL_0058: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<DatabaseID, Object> dictionary = (Dictionary<DatabaseID, Object>)typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(fullDatabase.AssetLoader);
			Dictionary<DatabaseID, UnitBlueprint> dictionary2 = (Dictionary<DatabaseID, UnitBlueprint>)typeof(LandfallContentDatabase).GetField("m_unitBlueprints", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(database);
			if (!dictionary2.ContainsKey(unit.Entity.GUID))
			{
				dictionary2.Add(unit.Entity.GUID, unit);
				dictionary.Add(unit.Entity.GUID, (Object)(object)unit);
			}
			typeof(LandfallContentDatabase).GetField("m_unitBlueprints", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(database, dictionary2);
			typeof(AssetLoader).GetField("m_nonStreamableAssets", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(fullDatabase.AssetLoader, dictionary);
		}

		public static void AddFactionToDatabase(Faction faction)
		{
			//IL_0058: 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_007d: Unknown result type (might be due to invalid I