Decompiled source of AbyssalEyeMod v0.0.1

AbyssalEye.dll

Decompiled a week 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.Runtime.Versioning;
using System.Xml;
using AbyssalEye.AssetManagement;
using AbyssalEye.TABSSimp;
using BepInEx;
using DM;
using Landfall.TABS;
using Landfall.TABS.UnitEditor;
using Sirenix.Serialization;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[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.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AbyssalEye
{
	[BepInPlugin("abyssaleye.mod", "Abyssal Eye Mod", "1.0.0")]
	public class Launcher : BaseUnityPlugin
	{
		public Launcher()
		{
			Debug.Log((object)"Starting Abyssal Eye Mod!");
			AssetImporter.Initialize();
			new Main();
		}
	}
	public class Main : Mod
	{
		private string comment;

		public Main()
		{
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_059a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0612: Unknown result type (might be due to invalid IL or missing references)
			//IL_063a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0662: Unknown result type (might be due to invalid IL or missing references)
			//IL_068a: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_091e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0947: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e14: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f9e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1008: Unknown result type (might be due to invalid IL or missing references)
			//IL_1093: Unknown result type (might be due to invalid IL or missing references)
			//IL_12ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_1382: Unknown result type (might be due to invalid IL or missing references)
			//IL_13aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_13d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_13fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_1422: Unknown result type (might be due to invalid IL or missing references)
			//IL_144a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1776: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b37: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b5f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b87: Unknown result type (might be due to invalid IL or missing references)
			//IL_1baf: Unknown result type (might be due to invalid IL or missing references)
			//IL_1bd7: Unknown result type (might be due to invalid IL or missing references)
			//IL_1bff: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c27: Unknown result type (might be due to invalid IL or missing references)
			//IL_1c4f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1d9a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1df7: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ea1: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"========== ABYSSALEYE TEST 123456 ==========");
			comment = "CHANGE THIS TO FALSE BEFORE RELEASING YOUR MOD!!!";
			Mod.DEV_MODE = false;
			ModFaction modFaction = Mod.CreateFaction("粉丝");
			modFaction.Icon = Mod.GetIcon("Cheerleader");
			modFaction.Color("#FFFF00");
			ModUnit modUnit = modFaction.NewUnit("时光之主");
			modUnit.Health = 700f;
			modUnit.Cost = 4000;
			modUnit.Icon = Mod.GetIcon("Fire");
			modUnit.Size = 1.1f;
			modUnit.Mass = 1.5f;
			modUnit.Speed = 4f;
			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 = 4f;
			modWeapon.AttackRange = 20f;
			modWeapon.StartCooldown = false;
			modWeapon.Damage = 80f;
			modWeapon.Ranged.Projectile = Mod.GetProjectile("Plasma Shot");
			modWeapon.Ranged.ProjectileAmount = 8;
			modWeapon.Ranged.Spread = 20f;
			ModWeapon modWeapon2 = Mod.CreateWeapon("时光之主左手武器", "Chronomancer Time Manipulation");
			modWeapon2.Cooldown = 1f;
			modWeapon2.AttackRange = 16f;
			modWeapon2.StartCooldown = false;
			modWeapon2.Damage = 50f;
			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 = Mod.GetIcon("Peasent");
			Debug.Log((object)("ark. DamageMultiplier = " + modUnit2.internalObject.damageMultiplier));
			modUnit2.Health = 1500f;
			modUnit2.Mass = 3f;
			modUnit2.Speed = 1.2f;
			modUnit2.Size = 1.2f;
			modUnit2.TwoHanded = false;
			modUnit2.Cost = 3500;
			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 = 14f;
			modWeapon3.StartCooldown = false;
			modWeapon3.Damage = 320f;
			ModWeapon modWeapon4 = Mod.CreateWeapon("方舟左手武器", "Thunderbolt Throw");
			modWeapon4.Cooldown = 1f;
			modWeapon4.AttackRange = 16f;
			modWeapon4.StartCooldown = false;
			modWeapon4.Damage = 60f;
			modWeapon3.AttackSpeed = 2.2f;
			modWeapon4.AttackSpeed = 2.2f;
			modUnit2.RightWeapon = modWeapon3;
			modUnit2.LeftWeapon = modWeapon4;
			modUnit2.Moves.Add("Ice Arena", "Thor Lightning", "Fire Wave", "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 = Mod.GetIcon("Assassin");
			modUnit3.Base = Mod.GetBase("Void Monarch 2");
			modUnit3.internalObject.damageMultiplier = 1f;
			modUnit3.Health = 2500f;
			modUnit3.Mass = 1.2f;
			modUnit3.Speed = 1f;
			modUnit3.Size = 2f;
			modUnit3.TwoHanded = true;
			modUnit3.Cost = 10000;
			modUnit3.internalObject.attackSpeedMultiplier = 1.5f;
			modUnit3.internalObject.weaponSeparation = 0.5f;
			modUnit3.Voice.Alive = "Fantasy Dark Attack Vocals/DarkKingTransformed";
			modUnit3.Voice.Death = "Fantasy Dark Death Vocals/DarkKingTransformed";
			modUnit3.Voice.Pitch = 1f;
			modUnit3.internalObject.VocalPathData.Category = "Fantasy Dark Attack Vocals";
			modUnit3.internalObject.VocalPathData.Effect = "DarkKingTransformed";
			modUnit3.internalObject.VocalPathData.EffectPitch = 1f;
			modUnit3.internalObject.VocalPathData.EffectVolume = 1f;
			ModWeapon rightWeapon = Mod.CreateWeapon("虚空领主右手武器", "Void Monarch Claymore");
			modUnit3.RightWeapon = rightWeapon;
			modUnit3.Moves.Add("Shogun Dodge", "Giant Foot Stomp", "Demon Wings", "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", "Legacy neckpiece 00", "Legacy shirt 02", "Samurai wrist guard 01", "Fantasy Good shoes 04", "Fantasy Evil pants 02", "Fantasy Evil leg guard 00");
			modUnit3.Clothes.List[7].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit3.Clothes.List[6].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit3.Clothes.List[9].ColorInternal(0, Utilities.HexColor("#000000"));
			ModUnit modUnit4 = modFaction.NewUnit("lucky");
			modUnit4.internalObject.damageMultiplier = 1f;
			modUnit4.Health = 600f;
			modUnit4.Cost = 4000;
			modUnit4.Icon = Mod.GetIcon("AWP");
			modUnit4.Size = 1f;
			modUnit4.Mass = 1.2f;
			modUnit4.Speed = 1f;
			modUnit4.TwoHanded = true;
			modUnit4.internalObject.attackSpeedMultiplier = 0.8f;
			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 modWeapon5 = Mod.CreateWeapon("lucky右手武器", "AWP");
			modWeapon5.Cooldown = 4f;
			modWeapon5.AttackRange = 400f;
			modWeapon5.StartCooldown = false;
			modWeapon5.Damage = 200f;
			modWeapon5.Ranged.Projectile = Mod.GetProjectile("Beam Shot");
			modWeapon5.Ranged.Projectile.Damage = 700f;
			modWeapon5.Force = 100f;
			modWeapon5.Ranged.ProjectileAmount = 3;
			modWeapon5.Ranged.Spread = 15f;
			modWeapon5.Ranged.Recoil = 10f;
			modWeapon5.Ranged.Ammo = 6;
			modUnit4.RightWeapon = modWeapon5;
			modWeapon5.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("Giant Fear", "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 modWeapon6 = Mod.CreateWeapon("摔跤手右手武器", "Minotaur Grab");
			modWeapon6.Cooldown = 1f;
			modWeapon6.AttackRange = 2f;
			modWeapon6.StartCooldown = false;
			modWeapon6.Damage = 100f;
			ModWeapon modWeapon7 = Mod.CreateWeapon("摔跤手左手武器", "Minotaur Grab");
			modWeapon7.Cooldown = 1f;
			modWeapon7.AttackRange = 2f;
			modWeapon7.StartCooldown = false;
			modWeapon7.Damage = 100f;
			modUnit5.RightWeapon = modWeapon6;
			modUnit5.LeftWeapon = modWeapon7;
			modUnit5.TwoHanded = false;
			modWeapon6.AttackSpeed = 1f;
			modWeapon7.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.Health = 200f;
			modUnit6.Cost = 500;
			modUnit6.Icon = Mod.GetIcon("Skewer");
			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 modWeapon8 = Mod.CreateWeapon("大厨右手武器", "Spatula");
			modWeapon8.Cooldown = 1f;
			modWeapon8.AttackRange = 2f;
			modWeapon8.StartCooldown = false;
			modWeapon8.Damage = 100f;
			modWeapon8.AttackSpeed = 1f;
			modWeapon8.Scale = new Vector3(0.7f, 0.7f, 0.7f);
			ModWeapon modWeapon9 = Mod.CreateWeapon("大厨左手武器", "Shallow Pot");
			modWeapon9.Cooldown = 1f;
			modWeapon9.AttackRange = 2f;
			modWeapon9.StartCooldown = false;
			modWeapon9.Damage = 100f;
			modWeapon9.AttackSpeed = 1f;
			modWeapon9.Scale = new Vector3(0.7f, 0.7f, 0.7f);
			modUnit6.RightWeapon = modWeapon8;
			modUnit6.LeftWeapon = modWeapon9;
			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.internalObject.damageMultiplier = 3f;
			modUnit7.Health = 1000f;
			modUnit7.Cost = 5000;
			modUnit7.Icon = Mod.GetIcon("Quick Draw");
			modUnit7.Size = 1f;
			modUnit7.Mass = 1f;
			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 modWeapon10 = Mod.CreateWeapon("燕双鹰右手远程武器", "Revolver Quickdraw");
			modWeapon10.Cooldown = 0.1f;
			modWeapon10.AttackRange = 70f;
			modWeapon10.StartCooldown = false;
			modWeapon10.Damage = 75f;
			modWeapon10.Ranged.Projectile = Mod.GetProjectile("Barrett Bullet");
			modWeapon10.Ranged.Projectile.Damage = 75f;
			modWeapon10.Force = 20f;
			modWeapon10.Ranged.ProjectileAmount = 3;
			modWeapon10.Ranged.Recoil = 3f;
			modWeapon10.Ranged.Ammo = 12;
			modWeapon10.AttackSpeed = 4f;
			ModWeapon modWeapon11 = Mod.CreateWeapon("燕双鹰左手近战武器", "Shogun's Katana");
			modWeapon11.Cooldown = 1f;
			modWeapon11.AttackRange = 2f;
			modWeapon11.StartCooldown = false;
			modWeapon11.Damage = 100f;
			modWeapon11.AttackSpeed = 1f;
			modWeapon11.Scale = new Vector3(0.9f, 0.75f, 0.9f);
			modUnit7.RightWeapon = modWeapon10;
			modUnit7.LeftWeapon = modWeapon11;
			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 = 500f;
			modUnit8.Cost = 800;
			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 rightWeapon2 = Mod.CreateWeapon("鸡腿盾兵右手武器", "Wall Shield");
			modUnit8.RightWeapon = rightWeapon2;
			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.Health = 1500f;
			modUnit9.Cost = 2000;
			modUnit9.Icon = Mod.GetIcon("Jarl");
			modUnit9.Size = 1.4f;
			modUnit9.Mass = 3f;
			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 modWeapon12 = Mod.CreateWeapon("冰帝右手武器", "Ice King Sword");
			modWeapon12.Cooldown = 0.4f;
			modWeapon12.AttackRange = 2f;
			modWeapon12.StartCooldown = false;
			modWeapon12.Damage = 200f;
			modWeapon12.AttackSpeed = 1f;
			modWeapon12.Scale = new Vector3(1.5f, 1.3f, 1.5f);
			modUnit9.RightWeapon = modWeapon12;
			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", "Lightning Projectile Block", "Banshee Scream");
			ModUnit modUnit10 = modFaction.NewUnit("电光人");
			modUnit10.internalObject.damageMultiplier = 1f;
			modUnit10.Health = 200f;
			modUnit10.Cost = 800;
			modUnit10.Icon = Mod.GetIcon("Thor");
			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 modWeapon13 = Mod.CreateWeapon("电光人右手武器", "Thunderbolt Throw");
			modWeapon13.Cooldown = 1f;
			modWeapon13.AttackRange = 22f;
			modWeapon13.StartCooldown = false;
			modWeapon13.Damage = 40f;
			modWeapon13.AttackSpeed = 0.8f;
			modWeapon13.Ranged.Projectile = Mod.GetProjectile("Tesla Shot");
			modWeapon13.Ranged.ProjectileAmount = 1;
			modWeapon13.Ranged.Spread = 15f;
			modWeapon13.Ranged.Projectile.Damage = 40f;
			modWeapon13.Force = 5f;
			modWeapon13.Ranged.Recoil = 1f;
			modWeapon13.Ranged.Ammo = 1;
			ModWeapon modWeapon14 = Mod.CreateWeapon("电光人左手武器", "Thunderbolt Throw");
			modWeapon14.Cooldown = 1f;
			modWeapon14.AttackRange = 22f;
			modWeapon14.StartCooldown = false;
			modWeapon14.Damage = 40f;
			modWeapon14.AttackSpeed = 0.8f;
			modWeapon14.Ranged.Projectile = Mod.GetProjectile("Stasis Shot");
			modWeapon14.Ranged.ProjectileAmount = 1;
			modWeapon14.Ranged.Spread = 15f;
			modWeapon14.Ranged.Projectile.Damage = 40f;
			modWeapon14.Force = 5f;
			modWeapon14.Ranged.Recoil = 1f;
			modWeapon14.Ranged.Ammo = 1;
			modUnit10.RightWeapon = modWeapon13;
			modUnit10.LeftWeapon = modWeapon14;
			modUnit10.TwoHanded = false;
			modUnit10.Clothes.Add("TABG hoodie 02", "TABG balaklava 00", "Wilnyls gloves 00", "TABG pants 12", "Roman belt 00", "Farmer shoes 03");
			modUnit10.Clothes.List[1].ColorInternal(0, Utilities.HexColor("#00FFFF"));
			modUnit10.Clothes.List[2].ColorInternal(0, Utilities.HexColor("#00FFFF"));
			modUnit10.Clothes.List[0].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit10.Clothes.List[3].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit10.Clothes.List[3].ColorInternal(1, Utilities.HexColor("#000000"));
			modUnit10.Clothes.List[3].ColorInternal(2, Utilities.HexColor("#000000"));
			modUnit10.Clothes.List[3].ColorInternal(3, Utilities.HexColor("#000000"));
			modUnit10.Clothes.List[5].ColorInternal(0, Utilities.HexColor("#000000"));
			modUnit10.Moves.Add("Reaper Explosion");
			ModUnit modUnit11 = modFaction.NewUnit("拖把大爷");
			modUnit11.internalObject.damageMultiplier = 1f;
			modUnit11.Health = 90f;
			modUnit11.Cost = 50;
			modUnit11.Icon = Mod.GetIcon("Banjo");
			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 modWeapon15 = Mod.CreateWeapon("拖把大爷右手武器", "Mop");
			modWeapon15.Scale = new Vector3(1f, 1f, 1f);
			modWeapon15.Cooldown = 1f;
			modWeapon15.AttackRange = 2f;
			modWeapon15.StartCooldown = false;
			modWeapon15.Damage = 40f;
			ModWeapon modWeapon16 = Mod.CreateWeapon("拖把大爷左手武器", "Mop");
			modWeapon16.Scale = new Vector3(1f, 1f, 1f);
			modWeapon16.Cooldown = 1f;
			modWeapon16.AttackRange = 2f;
			modWeapon16.StartCooldown = false;
			modWeapon16.Damage = 40f;
			modUnit11.RightWeapon = modWeapon15;
			modUnit11.LeftWeapon = modWeapon16;
			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");
		}
	}
	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_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Expected O, but got Unknown
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0473: 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 val = Object.Instantiate<Faction>(GetFaction("Medieval"));
			val.Entity.GenerateNewID();
			val.Entity.Name = "Base Faction";
			val.Units = Array.Empty<UnitBlueprint>();
			val.index = database.GetFactions().ToList().Count;
			val.m_FactionColor = HexColor("#888888");
			val.m_displayFaction = false;
			AddFactionToDatabase(val);
			baseFaction = new ModFaction(val);
			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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_005c: 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)
			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)
		{
			Object[] source = Resources.FindObjectsOfTypeAll(typeof(T));
			return (T)(object)((IEnumerable<Object>)source).FirstOrDefault((Func<Object, bool>)((Object x) => x.name.Contains(obj)));
		}

		public static string IncrementName(string name)
		{
			return name.Contains(";") ? (name.Split(new char[1] { ';' })[0] + int.Parse(name.Split(new char[1] { ';' })[1]) + 1) : (name + ";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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: 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;
			}
			if (flag)
			{
				Renderer[] 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;
			Renderer[] array2 = bestRenderers;
			foreach (Renderer val4 in array2)
			{
				Material[] materials3 = val4.materials;
				List<TeamColor> list2 = ((Component)val4).GetComponents<TeamColor>().ToList();
				for (int num3 = 0; num3 < materials3.Length; num3++)
				{
					if (num + num3 != index)
					{
						continue;
					}
					materials3[num3] = val;
					foreach (TeamColor item2 in list2)
					{
						if (item2.materialID == num3)
						{
							Object.DestroyImmediate((Object)(object)item2);
						}
					}
				}
				num++;
				val4.materials = materials3;
			}
		}

		public static void SetClothScale(ModClothing clothing, Vector3 scale)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: 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_01a1: 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>();
				foreach (MeshRenderer val in componentsInChildren)
				{
					((Component)val).transform.localScale = scale;
				}
			}
			if (!((Object)(object)internalObject.GetComponentInChildren<SkinnedMeshRenderer>() != (Object)null))
			{
				return;
			}
			Vector3 localScale = internalObject.transform.localScale;
			SkinnedMeshRenderer[] componentsInChildren2 = internalObject.GetComponentsInChildren<SkinnedMeshRenderer>();
			foreach (SkinnedMeshRenderer val2 in componentsInChildren2)
			{
				val2.sharedMesh = Object.Instantiate<Mesh>(val2.sharedMesh);
				Mesh sharedMesh = val2.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 k = 0; k < array.Length; k++)
				{
					Vector3 val3 = vertices[k];
					val3.x /= localScale.x;
					val3.y /= localScale.y;
					val3.z /= localScale.z;
					val3.x *= scale.x;
					val3.y *= scale.y;
					val3.z *= scale.z;
					array[k] = val3;
				}
				internalObject.transform.localScale = scale;
				sharedMesh.vertices = array;
				sharedMesh.RecalculateBounds();
				val2.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;
			return ((Object)(object)gameObject != (Object)null) ? gameObject.gameObject : null;
		}

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

		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_0048: Unknown result type (might be due to invalid IL or missing references)
			UnitBlueprint val = FindVanillaObject(database.GetUnitBlueprints(), name, (UnitBlueprint u) => u.Entity.Name);
			return ((Object)(object)val != (Object)null) ? database.GetUnitBlueprint(val.Entity.GUID) : null;
		}

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

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

		public static GameObject GetModel(string name)
		{
			GameObject val = FindVanillaObject(AssetImporter.Models, name, (GameObject m) => ((Object)m.gameObject).name);
			return ((Object)(object)val != (Object)null) ? val.gameObject : null;
		}

		public static void SetFlagsChildren(Transform child, HideFlags flag)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			((Object)((Component)child).gameObject).hideFlags = flag;
			for (int i = 0; i < child.childCount; i++)
			{
				SetFlagsChildren(child.GetChild(i), flag);
			}
		}
	}
}
namespace AbyssalEye.TABSSimp
{
	public abstract class Mod
	{
		private const string KEY_BASES = "bases";

		private const string KEY_UNITS = "units";

		private const string KEY_FACTIONS = "factions";

		private const string KEY_WEAPONS = "weapons";

		private const string KEY_CLOTHES = "clothes";

		private const string KEY_PROJECTILES = "projectiles";

		private const string KEY_MOVES = "moves";

		private const string KEY_EXPLOSIONS = "explosions";

		private const string KEY_ICONS = "icons";

		private const string KEY_EFFECTS = "effects";

		private const string KEY_MODELS = "models";

		private static Dictionary<string, Dictionary<string, object>> vanilla;

		private static Dictionary<string, Dictionary<string, object>> modified;

		private static GameObject pool;

		public static bool DEV_MODE { get; protected set; }

		static Mod()
		{
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Expected O, but got Unknown
			DEV_MODE = true;
			vanilla = new Dictionary<string, Dictionary<string, object>>();
			modified = new Dictionary<string, Dictionary<string, object>>();
			vanilla["bases"] = new Dictionary<string, object>();
			vanilla["units"] = new Dictionary<string, object>();
			vanilla["factions"] = new Dictionary<string, object>();
			vanilla["weapons"] = new Dictionary<string, object>();
			vanilla["clothes"] = new Dictionary<string, object>();
			vanilla["projectiles"] = new Dictionary<string, object>();
			vanilla["moves"] = new Dictionary<string, object>();
			vanilla["explosions"] = new Dictionary<string, object>();
			vanilla["icons"] = new Dictionary<string, object>();
			vanilla["effects"] = new Dictionary<string, object>();
			vanilla["models"] = new Dictionary<string, object>();
			modified["bases"] = new Dictionary<string, object>();
			modified["units"] = new Dictionary<string, object>();
			modified["factions"] = new Dictionary<string, object>();
			modified["weapons"] = new Dictionary<string, object>();
			modified["clothes"] = new Dictionary<string, object>();
			modified["projectiles"] = new Dictionary<string, object>();
			modified["moves"] = new Dictionary<string, object>();
			modified["explosions"] = new Dictionary<string, object>();
			modified["icons"] = new Dictionary<string, object>();
			modified["effects"] = new Dictionary<string, object>();
			modified["models"] = new Dictionary<string, object>();
			GameObject val = new GameObject("Pool")
			{
				hideFlags = (HideFlags)61
			};
			val.transform.position = Vector3.down * -1000f;
			pool = val;
			pool.SetActive(false);
		}

		public static GameObject PoolObject(GameObject gameObject)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			gameObject.transform.parent = pool.transform;
			gameObject.transform.localPosition = Vector3.zero;
			pool.transform.SetHideFlagsChildren((HideFlags)61);
			return gameObject;
		}

		public static GameObject CloneAndPoolObject(GameObject obj)
		{
			GameObject val = Object.Instantiate<GameObject>(obj, pool.transform);
			PoolObject(val);
			return val;
		}

		private static M CreateObject<M>(string key, Func<string, M> query, Action<M> processClone, string name, string originalName) where M : ModdingClass<M>
		{
			M val = null;
			M val2 = query(originalName);
			if (val2 != null)
			{
				val = val2.Clone();
				processClone?.Invoke(val);
				val.Name = name;
				modified[key][name] = val;
			}
			return val;
		}

		private static M GetObject<M, R>(string key, Func<string, R> query, Func<R, M> generate, string name)
		{
			M val = default(M);
			if (modified[key].ContainsKey(name))
			{
				val = (M)modified[key][name];
			}
			else if (vanilla[key].ContainsKey(name))
			{
				val = (M)vanilla[key][name];
			}
			else
			{
				R val2 = query(name);
				if (val2 != null)
				{
					val = generate(val2);
					vanilla[key][name] = val;
				}
			}
			if (val == null)
			{
				Debug.LogError((object)("[MFD] Could not find '" + name + "' in '" + key + "'."));
			}
			return val;
		}

		public static ModUnit GetUnit(string name)
		{
			return GetObject("units", Utilities.GetUnit, (UnitBlueprint u) => new ModUnit(u), name);
		}

		public static ModUnit CreateUnit(string name, string originalName = null)
		{
			return CreateObject("units", GetUnit, delegate(ModUnit mu)
			{
				if (originalName == null)
				{
					mu.Clothes.Clear();
				}
			}, name, (originalName == null) ? "Peasant" : originalName);
		}

		public static ModFaction GetFaction(string name)
		{
			return GetObject("factions", Utilities.GetFaction, (Faction f) => new ModFaction(f), name);
		}

		public static ModFaction CreateFaction(string name, string originalName = null)
		{
			return CreateObject("factions", GetFaction, delegate(ModFaction mf)
			{
				mf.Units.Clear();
				mf.Visible = true;
			}, name, (originalName == null) ? "Base Faction" : originalName);
		}

		public static ModWeapon GetWeapon(string name)
		{
			return GetObject("weapons", Utilities.GetWeapon, (GameObject w) => new ModWeapon(w), name);
		}

		public static ModWeapon CreateWeapon(string name, string originalName)
		{
			return CreateObject("weapons", GetWeapon, null, name, originalName);
		}

		public static ModClothing GetClothing(string name)
		{
			return GetObject("clothes", Utilities.GetClothing, (GameObject c) => new ModClothing(c), name);
		}

		public static ModClothing CreateClothing(string name, string originalName)
		{
			return CreateObject("clothes", GetClothing, null, name, originalName);
		}

		public static ModMove GetMove(string name)
		{
			return GetObject("moves", Utilities.GetMove, (GameObject m) => new ModMove(m), name);
		}

		public static ModMove CreateMove(string name, string originalName)
		{
			return CreateObject("moves", GetMove, null, name, originalName);
		}

		public static ModProjectile GetProjectile(string name)
		{
			return GetObject("projectiles", Utilities.GetProjectile, (GameObject p) => new ModProjectile(p), name);
		}

		public static ModProjectile CreateProjectile(string name, string originalName)
		{
			return CreateObject("projectiles", GetProjectile, null, name, originalName);
		}

		public static ModExplosion GetExplosion(string name)
		{
			return GetObject("explosions", Utilities.GetExplosion, (GameObject e) => new ModExplosion(e), name);
		}

		public static ModExplosion CreateExplosion(string name, string originalName)
		{
			return CreateObject("explosions", GetExplosion, null, name, originalName);
		}

		public static ModEffect GetEffect(string name)
		{
			return GetObject("effects", Utilities.GetEffect, (UnitEffectBase e) => new ModEffect(e), name);
		}

		public static ModEffect CreateEffect(string name, string originalName)
		{
			return CreateObject("effects", GetEffect, null, name, originalName);
		}

		public static ModBase GetBase(string name)
		{
			return GetObject("bases", Utilities.GetUnitBase, (GameObject b) => new ModBase(b), name);
		}

		public static ModBase CreateBase(string name, string originalName)
		{
			return CreateObject("bases", GetBase, null, name, originalName);
		}

		public static ModModel GetModel(string name)
		{
			return GetObject("models", Utilities.GetModel, (GameObject m) => new ModModel(m), name);
		}

		public static ModModel CreateModel(string name, string originalName)
		{
			return CreateObject("models", GetModel, null, name, originalName);
		}

		public static Sprite GetIcon(string name)
		{
			return GetObject("icons", Utilities.GetIcon, (Sprite s) => s, name);
		}
	}
	public class ModBase : ModdingClass<ModBase>
	{
		public GameObject internalObject { get; private set; }

		public override string Name
		{
			get
			{
				return ((Object)internalObject.gameObject).name;
			}
			set
			{
				((Object)internalObject.gameObject).name = value;
			}
		}

		public override void ColorInternal(int index, Color color, float glow = 0f)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Utilities.SetObjectColor(internalObject, index, color, glow);
		}

		public ModBase(GameObject unitBase)
		{
			internalObject = unitBase;
		}

		public override ModBase Clone()
		{
			GameObject unitBase = Mod.CloneAndPoolObject(internalObject);
			return new ModBase(unitBase);
		}

		public override void Separate()
		{
		}
	}
	public enum ClothingType
	{
		Static,
		Skinned
	}
	public class ModClothing : ModdingClass<ModClothing>
	{
		private PropItem item;

		private SkinnedMeshRenderer renderer;

		private ModModel model;

		public GameObject internalObject { get; private set; }

		public ClothingType Type { get; private set; }

		public override string Name
		{
			get
			{
				return ((CharacterItem)item).Entity.Name;
			}
			set
			{
				((CharacterItem)item).Entity.Name = value;
			}
		}

		public ModModel Model
		{
			get
			{
				return model;
			}
			set
			{
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				if (value != null)
				{
					Utilities.SetMeshRenderers(internalObject, enabled: false);
					model = value.Clone();
					if (Type == ClothingType.Static)
					{
						model.internalObject.transform.parent = internalObject.transform;
						model.internalObject.transform.localPosition = Vector3.zero;
						model.internalObject.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f);
					}
					else if (Type == ClothingType.Skinned)
					{
						Utilities.PlaceMeshOnBone(renderer, model.internalObject, ((CharacterItem)item).GearT);
					}
				}
				else
				{
					if (model != null)
					{
						Utilities.SetMeshRenderers(internalObject, enabled: true);
					}
					model = null;
				}
			}
		}

		public float Size
		{
			get
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				Vector3 localScale = internalObject.transform.localScale;
				return (localScale.x + localScale.y + localScale.z) / 3f;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				Utilities.SetClothScale(this, Vector3.one * value);
			}
		}

		public Vector3 Scale
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return internalObject.transform.localScale;
			}
			set
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				Utilities.SetClothScale(this, value);
			}
		}

		public override void ColorInternal(int index, Color color, float glow = 0f)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (model == null)
			{
				Utilities.SetObjectColor(internalObject, index, color, glow);
			}
			else
			{
				model.Color(index, color, glow);
			}
		}

		public ModClothing(GameObject prop)
		{
			internalObject = Mod.CloneAndPoolObject(prop);
			renderer = internalObject.GetComponentInChildren<SkinnedMeshRenderer>();
			Type = (((Object)(object)renderer != (Object)null) ? ClothingType.Skinned : ClothingType.Static);
			item = internalObject.GetComponentInChildren<PropItem>();
		}

		public override ModClothing Clone()
		{
			ModClothing modClothing = new ModClothing(internalObject)
			{
				Model = Model
			};
			modClothing.Separate();
			return modClothing;
		}

		public override void Separate()
		{
		}
	}
	public abstract class ModdingClass<T> where T : ModdingClass<T>
	{
		public abstract string Name { get; set; }

		public abstract T Clone();

		public abstract void Separate();

		public abstract void ColorInternal(int index, Color color, float glow = 0f);

		public void Color(Color color, float glow = 0f)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ColorInternal(0, color, glow);
		}

		public void Color(string color, float glow = 0f)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			Color(0, Utilities.HexColor(color), glow);
		}

		public void Color(int index, Color color, float glow = 0f)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			ColorInternal(index, color, glow);
		}

		public void Color(int index, string color, float glow = 0f)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			Color(index, Utilities.HexColor(color), glow);
		}

		public void Colors(params Color[] colors)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < colors.Length; i++)
			{
				Color(i, colors[i]);
			}
		}

		public void Colors(params string[] colors)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < colors.Length; i++)
			{
				Color(i, Utilities.HexColor(colors[i]));
			}
		}

		public void Colors(params (Color color, float glow)[] colors)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < colors.Length; i++)
			{
				Color(i, colors[i].color, colors[i].glow);
			}
		}

		public void Colors(params (string color, float glow)[] colors)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < colors.Length; i++)
			{
				Color(i, Utilities.HexColor(colors[i].color), colors[i].glow);
			}
		}
	}
	public class ModEffect : ModdingClass<ModEffect>
	{
		public UnitEffectBase internalObject { get; private set; }

		public override string Name
		{
			get
			{
				return ((Object)((Component)internalObject).gameObject).name;
			}
			set
			{
				((Object)((Component)internalObject).gameObject).name = value;
			}
		}

		public override void ColorInternal(int index, Color color, float glow = 0f)
		{
		}

		public ModEffect(UnitEffectBase effect)
		{
			internalObject = effect;
		}

		public override ModEffect Clone()
		{
			GameObject val = Mod.CloneAndPoolObject(((Component)internalObject).gameObject);
			return new ModEffect(val.GetComponent<UnitEffectBase>());
		}

		public override void Separate()
		{
		}
	}
	public class ModExplosion : ModdingClass<ModExplosion>
	{
		private Explosion explosion;

		private ExplosionAddEffect addEffect;

		private ModEffect effect;

		public GameObject internalObject { get; private set; }

		public override string Name
		{
			get
			{
				return ((Object)internalObject).name;
			}
			set
			{
				((Object)internalObject).name = value;
			}
		}

		public float Damage
		{
			get
			{
				if (Object.op_Implicit((Object)(object)explosion))
				{
					return explosion.damage;
				}
				return 0f;
			}
			set
			{
				if (Object.op_Implicit((Object)(object)explosion))
				{
					explosion.damage = value;
				}
			}
		}

		public float Force
		{
			get
			{
				if (Object.op_Implicit((Object)(object)explosion))
				{
					return explosion.force;
				}
				return 0f;
			}
			set
			{
				if (Object.op_Implicit((Object)(object)explosion))
				{
					explosion.force = value;
				}
			}
		}

		public ForceDirection ForceDirection
		{
			get
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)explosion))
				{
					return explosion.forceDirection;
				}
				return (ForceDirection)0;
			}
			set
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)explosion))
				{
					explosion.forceDirection = value;
				}
			}
		}

		public float Radius
		{
			get
			{
				if (Object.op_Implicit((Object)(object)explosion))
				{
					return explosion.radius;
				}
				return 0f;
			}
			set
			{
				if (Object.op_Implicit((Object)(object)explosion))
				{
					explosion.radius = value;
				}
			}
		}

		public ModEffect Effect
		{
			get
			{
				return effect;
			}
			set
			{
				effect = value;
				if (!Object.op_Implicit((Object)(object)addEffect))
				{
					addEffect = internalObject.AddComponent<ExplosionAddEffect>();
				}
				if (value != null)
				{
					addEffect.EffectPrefab = value.internalObject;
				}
				else
				{
					addEffect.EffectPrefab = null;
				}
			}
		}

		public float Size
		{
			get
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				Vector3 localScale = internalObject.transform.localScale;
				return (localScale.x + localScale.y + localScale.z) / 3f;
			}
			set
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				internalObject.transform.localScale = Vector3.one * value;
			}
		}

		public Vector3 Scale
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return internalObject.transform.localScale;
			}
			set
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				internalObject.transform.localScale = value;
			}
		}

		public override void ColorInternal(int index, Color color, float glow = 0f)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Utilities.SetObjectColor(internalObject, index, color, glow);
		}

		public ModExplosion(GameObject explosionObject)
		{
			internalObject = explosionObject;
			explosion = internalObject.GetComponentInChildren<Explosion>();
			addEffect = internalObject.GetComponentInChildren<ExplosionAddEffect>();
		}

		public override ModExplosion Clone()
		{
			GameObject explosionObject = Mod.CloneAndPoolObject(internalObject);
			ModExplosion modExplosion = new ModExplosion(explosionObject);
			if (Effect != null)
			{
				modExplosion.Effect = Effect;
			}
			return modExplosion;
		}

		public override void Separate()
		{
			if (Effect != null)
			{
				Effect = Effect.Clone();
			}
		}
	}
	public class ModFaction : ModdingClass<ModFaction>
	{
		public Faction internalObject { get; private set; }

		public WrapperDelineation<ModUnit> Units { get; private set; }

		public UnitBlueprint[] Blueprints => Units.List.Select((ModUnit w) => w.internalObject).ToArray();

		public override string Name
		{
			get
			{
				return internalObject.Entity.Name;
			}
			set
			{
				internalObject.Entity.Name = value;
			}
		}

		public bool Visible
		{
			get
			{
				return internalObject.m_displayFaction;
			}
			set
			{
				internalObject.m_displayFaction = value;
			}
		}

		public Sprite Icon
		{
			get
			{
				return internalObject.Entity.SpriteIcon;
			}
			set
			{
				internalObject.Entity.SetSpriteIcon(value);
			}
		}

		private void UpdateBlueprints(List<ModUnit> units)
		{
			internalObject.Units = (from ModUnit unit in units
				select unit.internalObject).ToArray();
		}

		public ModUnit NewUnit(string name, string originalName = null)
		{
			ModUnit modUnit = Mod.CreateUnit(name, originalName);
			Units.Add(modUnit);
			return modUnit;
		}

		public override void ColorInternal(int index, Color color, float glow = 0f)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			internalObject.m_FactionColor = color;
		}

		public ModFaction(Faction faction)
		{
			internalObject = faction;
			Units = new WrapperDelineation<ModUnit>(UpdateBlueprints, Mod.GetUnit)
			{
				List = (from UnitBlueprint blueprint in internalObject.Units
					select new ModUnit(blueprint)).ToList()
			};
		}

		public override ModFaction Clone()
		{
			Faction val = Object.Instantiate<Faction>(internalObject);
			val.Entity.GenerateNewID();
			val.Entity.Name = Utilities.IncrementName(Name);
			val.Units = Array.Empty<UnitBlueprint>();
			val.index = Utilities.database.GetFactions().ToList().Count;
			Utilities.AddFactionToDatabase(val);
			ModFaction modFaction = new ModFaction(val);
			modFaction.Separate();
			return modFaction;
		}

		public override void Separate()
		{
			Units.List = (from ModUnit unit in Units.List
				select unit.Clone()).ToList();
		}
	}
	public class ModModel : ModdingClass<ModModel>
	{
		private Vector3 position;

		private Quaternion rotation;

		public GameObject internalObject { get; private set; }

		public override string Name
		{
			get
			{
				return ((Object)internalObject.gameObject).name;
			}
			set
			{
				((Object)internalObject.gameObject).name = value;
			}
		}

		public Vector3 Position
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return position;
			}
			set
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: 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)
				position = value;
				internalObject.transform.localPosition = position;
			}
		}

		public Quaternion Rotation
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				return rotation;
			}
			set
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				rotation = value;
				internalObject.transform.localRotation = Utilities.blenderToUnity * rotation;
			}
		}

		public override void ColorInternal(int index, Color color, float glow = 0f)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Utilities.SetObjectColor(internalObject, index, color, glow);
		}

		public ModModel(GameObject model)
		{
			internalObject = model;
		}

		public override ModModel Clone()
		{
			GameObject model = Mod.CloneAndPoolObject(internalObject);
			return new ModModel(model);
		}

		public override void Separate()
		{
		}
	}
	public class ModMove : ModdingClass<ModMove>
	{
		private SpecialAbility specialAbility;

		public GameObject internalObject { get; private set; }

		public override string Name
		{
			get
			{
				return ((CharacterItem)specialAbility).Entity.Name;
			}
			set
			{
				((CharacterItem)specialAbility).Entity.Name = value;
			}
		}

		public override void ColorInternal(int index, Color color, float glow = 0f)
		{
		}

		public ModMove(GameObject move)
		{
			internalObject = move;
			specialAbility = move.GetComponentInChildren<SpecialAbility>();
		}

		public override ModMove Clone()
		{
			GameObject move = Mod.CloneAndPoolObject(internalObject);
			return new ModMove(move);
		}

		public override void Separate()
		{
		}
	}
	public enum ProjectileType
	{
		Regular,
		Physical,
		Other
	}
	public class ModProjectile : ModdingClass<ModProjectile>
	{
		private ProjectileEntity projectileEntity;

		private ProjectileHit rHit;

		private MoveTransform rMoveTransform;

		private ProjectileHitAddEffect rAddEffect;

		private CollisionWeapon pCollision;

		private AddForce pAddForce;

		private MeleeWeaponAddEffect pAddEffect;

		private MeleeWeaponSpawn pSpawner;

		private ModModel model;

		private ModEffect effect;

		private ModUnit unit;

		public GameObject internalObject { get; private set; }

		public override string Name
		{
			get
			{
				return projectileEntity.Entity.Name;
			}
			set
			{
				projectileEntity.Entity.Name = value;
			}
		}

		public ProjectileType Type { get; private set; }

		public ModModel Model
		{
			get
			{
				return model;
			}
			set
			{
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				if (value != null)
				{
					Utilities.SetMeshRenderers(internalObject, enabled: false);
					model = value.Clone();
					model.internalObject.transform.parent = internalObject.transform;
					model.internalObject.transform.localPosition = Vector3.zero;
					model.internalObject.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f);
				}
				else
				{
					if (model != null)
					{
						Utilities.SetMeshRenderers(internalObject, enabled: true);
					}
					model = null;
				}
			}
		}

		public ModEffect Effect
		{
			get
			{
				return effect;
			}
			set
			{
				effect = value;
				if (Type == ProjectileType.Regular)
				{
					if (!Object.op_Implicit((Object)(object)rAddEffect))
					{
						rAddEffect = ((Component)rHit).gameObject.AddComponent<ProjectileHitAddEffect>();
					}
					rAddEffect.EffectPrefab = value?.internalObject;
				}
				else if (Type == ProjectileType.Physical)
				{
					if (!Object.op_Implicit((Object)(object)pAddEffect))
					{
						pAddEffect = ((Component)pCollision).gameObject.AddComponent<MeleeWeaponAddEffect>();
					}
					pAddEffect.EffectPrefab = value?.internalObject;
				}
			}
		}

		public WrapperDelineation<ModExplosion> Explosions { get; private set; }

		public ModExplosion Explosion
		{
			get
			{
				ModExplosion result = null;
				if (Explosions.List.Count > 0)
				{
					result = Explosions.List[0];
				}
				return result;
			}
			set
			{
				Explosions.Clear();
				if (value != null)
				{
					Explosions.Add(value);
				}
			}
		}

		public ModUnit Unit
		{
			get
			{
				return unit;
			}
			set
			{
				unit = value;
				Explosions.Clear();
				ModExplosion modExplosion = Utilities.unitSpawner.Clone();
				modExplosion.internalObject.GetComponent<UnitSpawner>().unitBlueprint = unit.internalObject;
				Explosions.Add(modExplosion);
			}
		}

		public float Damage
		{
			get
			{
				if (Type == ProjectileType.Regular)
				{
					return rHit.damage;
				}
				if (Type == ProjectileType.Physical)
				{
					return pCollision.damage;
				}
				return 0f;
			}
			set
			{
				if (Type == ProjectileType.Regular)
				{
					rHit.damage = value;
				}
				else if (Type == ProjectileType.Physical)
				{
					pCollision.damage = value;
				}
			}
		}

		public float Force
		{
			get
			{
				if (Type == ProjectileType.Regular)
				{
					return rHit.force;
				}
				if (Type == ProjectileType.Physical)
				{
					return pCollision.onImpactForce;
				}
				return 0f;
			}
			set
			{
				if (Type == ProjectileType.Regular)
				{
					rHit.force = value;
				}
				else if (Type == ProjectileType.Physical)
				{
					pCollision.onImpactForce = value;
				}
			}
		}

		public float Speed
		{
			get
			{
				if (Type == ProjectileType.Regular)
				{
					return rMoveTransform.selfImpulse.z;
				}
				if (Type == ProjectileType.Physical)
				{
					return pAddForce.force.z;
				}
				return 0f;
			}
			set
			{
				if (Type == ProjectileType.Regular)
				{
					rMoveTransform.selfImpulse.z = value;
				}
				else if (Type == ProjectileType.Physical)
				{
					pAddForce.force.z = value;
				}
			}
		}

		public float Size
		{
			get
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				Vector3 localScale = internalObject.transform.localScale;
				return (localScale.x + localScale.y + localScale.z) / 3f;
			}
			set
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				internalObject.transform.localScale = Vector3.one * value;
			}
		}

		public Vector3 Scale
		{
			get
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				return internalObject.transform.localScale;
			}
			set
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				internalObject.transform.localScale = value;
			}
		}

		public void UpdateImpact(List<ModExplosion> explosions)
		{
			if (Type == ProjectileType.Regular)
			{
				rHit.objectsToSpawn = explosions.Cast<ModExplosion>().Select((Func<ModExplosion, ObjectToSpawn>)((ModExplosion explosion) => new ObjectToSpawn
				{
					objectToSpawn = explosion.internalObject
				})).ToArray();
			}
			else if (Type == ProjectileType.Physical && explosions.Count > 0)
			{
				if (Object.op_Implicit((Object)(object)pSpawner))
				{
					pSpawner.objectToSpawn = explosions[0].internalObject;
					return;
				}
				pSpawner = ((Component)pCollision).gameObject.AddComponent<MeleeWeaponSpawn>();
				pSpawner.objectToSpawn = explosions[0].internalObject;
			}
		}

		public override void ColorInternal(int index, Color color, float glow = 0f)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Utilities.SetObjectColor(internalObject, index, color, glow);
		}

		public ModProjectile(GameObject projectile, bool isClone = false)
		{
			internalObject = projectile;
			projectileEntity = internalObject.GetComponentInChildren<ProjectileEntity>();
			rHit = internalObject.GetComponentInChildren<ProjectileHit>();
			rMoveTransform = internalObject.GetComponentInChildren<MoveTransform>();
			rAddEffect = internalObject.GetComponentInChildren<ProjectileHitAddEffect>();
			pCollision = internalObject.GetComponentInChildren<CollisionWeapon>();
			pAddForce = internalObject.GetComponentInChildren<AddForce>();
			pAddEffect = internalObject.GetComponentInChildren<MeleeWeaponAddEffect>();
			pSpawner = internalObject.GetComponentInChildren<MeleeWeaponSpawn>();
			Explosions = new WrapperDelineation<ModExplosion>(UpdateImpact, Mod.GetExplosion);
			if (Object.op_Implicit((Object)(object)rHit))
			{
				Type = ProjectileType.Regular;
			}
			else if (Object.op_Implicit((Object)(object)pCollision))
			{
				Type = ProjectileType.Physical;
			}
			else
			{
				Type = ProjectileType.Other;
			}
			if (Type == ProjectileType.Regular)
			{
				ObjectToSpawn[] objectsToSpawn = rHit.objectsToSpawn;
				foreach (ObjectToSpawn val in objectsToSpawn)
				{
					if (val != null)
					{
						Explosions.Add(new ModExplosion(val.objectToSpawn));
					}
				}
				if (Object.op_Implicit((Object)(object)rAddEffect) && Object.op_Implicit((Object)(object)rAddEffect.EffectPrefab) && !isClone)
				{
					effect = new ModEffect(rAddEffect.EffectPrefab);
				}
			}
			else if (Type == ProjectileType.Physical)
			{
				if (Object.op_Implicit((Object)(object)pSpawner) && Object.op_Implicit((Object)(object)pSpawner.objectToSpawn))
				{
					Explosions.Add(new ModExplosion(pSpawner.objectToSpawn));
				}
				if (Object.op_Implicit((Object)(object)pAddEffect) && Object.op_Implicit((Object)(object)pAddEffect.EffectPrefab) && !isClone)
				{
					effect = new ModEffect(pAddEffect.EffectPrefab);
				}
			}
		}

		public override ModProjectile Clone()
		{
			GameObject projectile = Mod.CloneAndPoolObject(internalObject);
			ModProjectile modProjectile = new ModProjectile(projectile, isClone: true);
			modProjectile.Explosions.List = Explosions.List;
			modProjectile.Model = Model;
			ModProjectile modProjectile2 = modProjectile;
			string name = Utilities.IncrementName(modProjectile2.projectileEntity.Entity.Name);
			modProjectile2.projectileEntity.Entity.Name = name;
			((Object)modProjectile2.internalObject).name = name;
			if (Effect != null)
			{
				modProjectile2.Effect = Effect;
			}
			modProjectile2.Separate();
			return modProjectile2;
		}

		public override void Separate()
		{
			if (Effect != null)
			{
				Effect = Effect.Clone();
			}
			Explosions.List = (from ModExplosion explosion in Explosions.List
				select explosion.Clone()).ToList();
		}
	}
	public class ModUnit : ModdingClass<ModUnit>
	{
		public class ModVoice
		{
			public UnitBlueprint internalObject { get; private set; }

			public string Death
			{
				get
				{
					return internalObject.voiceBundle.DeathRef;
				}
				set
				{
					internalObject.voiceBundle.DeathRef = value;
				}
			}

			public string Alive
			{
				get
				{
					return internalObject.voiceBundle.VocalRef;
				}
				set
				{
					internalObject.voiceBundle.VocalRef = value;
				}
			}

			public float Pitch
			{
				get
				{
					return internalObject.VoicePitch;
				}
				set
				{
					internalObject.VoicePitch = value;
				}
			}

			public ModVoice(UnitBlueprint blueprint)
			{
				internalObject = blueprint;
				internalObject.voiceBundle = ScriptableObject.CreateInstance<VoiceBundle>();
			}
		}

		public UnitBlueprint internalObject;

		private ModWeapon rightWeapon;

		private ModWeapon leftWeapon;

		private ModBase unitBase;

		private ModUnit rider;

		public WrapperDelineation<ModClothing> Clothes { get; private set; }

		public WrapperDelineation<ModMove> Moves { get; private set; }

		public ModVoice Voice { get; private set; }

		public override string Name
		{
			get
			{
				return internalObject.Entity.Name;
			}
			set
			{
				internalObject.Entity.Name = value;
			}
		}

		public Sprite Icon
		{
			get
			{
				return internalObject.Entity.SpriteIcon;
			}
			set
			{
				internalObject.Entity.SetSpriteIcon(value);
			}
		}

		public float Health
		{
			get
			{
				return internalObject.health;
			}
			set
			{
				internalObject.health = value;
			}
		}

		public float Speed
		{
			get
			{
				return internalObject.movementSpeedMuiltiplier;
			}
			set
			{
				internalObject.movementSpeedMuiltiplier = value;
			}
		}

		public float TurnSpeed
		{
			get
			{
				return internalObject.TurnSpeed;
			}
			set
			{
				if ((Object)(object)internalObject.turningData != (Object)null)
				{
					internalObject.turningData.TurnSpeed = value;
				}
				internalObject.turnSpeed = value;
			}
		}

		public float Mass
		{
			get
			{
				return internalObject.massMultiplier;
			}
			set
			{
				internalObject.massMultiplier = value;
			}
		}

		public float Balance
		{
			get
			{
				return internalObject.balanceMultiplier;
			}
			set
			{
				internalObject.balanceMultiplier = value;
			}
		}

		public float BalanceStrength
		{
			get
			{
				return internalObject.balanceForceMultiplier;
			}
			set
			{
				internalObject.balanceForceMultiplier = value;
			}
		}

		public float Priority
		{
			get
			{
				return internalObject.targetingPriorityMultiplier;
			}
			set
			{
				internalObject.targetingPriorityMultiplier = value;
			}
		}

		public float Size
		{
			get
			{
				return internalObject.sizeMultiplier;
			}
			set
			{
				internalObject.sizeMultiplier = value;
			}
		}

		public bool TwoHanded
		{
			get
			{
				return internalObject.holdinigWithTwoHands;
			}
			set
			{
				internalObject.holdinigWithTwoHands = value;
			}
		}

		public int Cost
		{
			get
			{
				return (int)internalObject.GetUnitCost(true);
			}
			set
			{
				internalObject.useCustomCost = true;
				internalObject.customCost = value;
			}
		}

		public ModWeapon RightWeapon
		{
			get
			{
				return rightWeapon;
			}
			set
			{
				if (value != null)
				{
					rightWeapon = value;
					internalObject.RightWeapon = rightWeapon.internalObject;
				}
			}
		}

		public ModWeapon LeftWeapon
		{
			get
			{
				return leftWeapon;
			}
			set
			{
				if (value != null)
				{
					leftWeapon = value;
					internalObject.LeftWeapon = leftWeapon.internalObject;
				}
			}
		}

		public ModBase Base
		{
			get
			{
				return unitBase;
			}
			set
			{
				unitBase = value;
				internalObject.UnitBase = unitBase.internalObject;
			}
		}

		public Vector2 SizeRange
		{
			get
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				return new Vector2(internalObject.minSizeRandom, internalObject.maxSizeRandom);
			}
			set
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				internalObject.minSizeRandom = value.x;
				internalObject.maxSizeRandom = value.y;
			}
		}

		public ModUnit Rider
		{
			get
			{
				return rider;
			}
			set
			{
				rider = value;
				if (rider != null)
				{
					internalObject.SetField<UnitBlueprint>("Riders", new UnitBlueprint[1] { rider.internalObject });
				}
				else
				{
					internalObject.SetField<UnitBlueprint>("Riders", Array.Empty<UnitBlueprint>());
				}
			}
		}

		private void UpdateClothing(List<ModClothing> list)
		{
			internalObject.m_props = (from ModClothing clothing in list
				select clothing.internalObject).ToArray();
		}

		private void UpdateMoves(List<ModMove> list)
		{
			internalObject.objectsToSpawnAsChildren = (from ModMove move in list
				select move.internalObject).ToArray();
		}

		public override void ColorInternal(int index, Color color, float glow = 0f)
		{
		}

		public ModUnit(UnitBlueprint blueprint)
		{
			internalObject = blueprint;
			Clothes = new WrapperDelineation<ModClothing>(UpdateClothing, Mod.GetClothing);
			Moves = new WrapperDelineation<ModMove>(UpdateMoves, Mod.GetMove);
			Voice = new ModVoice(blueprint);
			if (internalObject.m_props != null)
			{
				Clothes.List = (from GameObject prop in internalObject.m_props
					where (Object)(object)prop != (Object)null
					select new ModClothing(prop)).ToList();
			}
			else
			{
				internalObject.m_props = Array.Empty<GameObject>();
			}
			if (Object.op_Implicit((Object)(object)internalObject.RightWeapon))
			{
				RightWeapon = new ModWeapon(internalObject.RightWeapon);
			}
			if (Object.op_Implicit((Object)(object)internalObject.LeftWeapon))
			{
				LeftWeapon = new ModWeapon(internalObject.LeftWeapon);
			}
		}

		public override ModUnit Clone()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			string name = Utilities.IncrementName(Name);
			UnitBlueprint val = Object.Instantiate<UnitBlueprint>(internalObject);
			val.Entity.GUID = DatabaseID.NewID();
			val.Entity.Name = name;
			Utilities.AddUnitToDatabase(val);
			ModUnit modUnit = new ModUnit(val);
			modUnit.Clothes.List = Clothes.List;
			modUnit.Moves.List = Moves.List;
			modUnit.Rider = Rider;
			modUnit.Cost = Cost;
			ModUnit modUnit2 = modUnit;
			modUnit2.Separate();
			return modUnit2;
		}

		public override void Separate()
		{
			if (RightWeapon != null)
			{
				RightWeapon = RightWeapon.Clone();
			}
			if (LeftWeapon != null)
			{
				LeftWeapon = LeftWeapon.Clone();
			}
			Clothes.List = (from ModClothing clothing in Clothes.List
				select clothing.Clone()).ToList();
			Moves.List = (from ModMove move in Moves.List
				select move.Clone()).ToList();
		}
	}
	public enum WeaponType
	{
		Melee,
		Ranged
	}
	public class ModWeapon : ModdingClass<ModWeapon>
	{
		public class ModMelee
		{
			private readonly ModWeapon internalWeapon;

			public float SwingSpeed
			{
				get
				{
					return (internalWeapon.Type == WeaponType.Melee) ? internalWeapon.internalMelee.curveForce : 0f;
				}
				set
				{
					if (internalWeapon.Type == WeaponType.Melee)
					{
						internalWeapon.internalMelee.curveForce = value;
					}
				}
			}

			public Vector3 SwingDirection
			{
				get
				{
					//IL_001f: Unknown result type (might be due to invalid IL or missing references)
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					return (internalWeapon.Type == WeaponType.Melee) ? internalWeapon.internalMelee.swingDirection : Vector3.zero;
				}
				set
				{
					//IL_001e: Unknown result type (might be due to invalid IL or missing references)
					//IL_001f: Unknown result type (might be due to invalid IL or missing references)
					if (internalWeapon.Type == WeaponType.Melee)
					{
						internalWeapon.internalMelee.swingDirection = value;
					}
				}
			}

			public float Impact
			{
				get
				{
					return (internalWeapon.Type == WeaponType.Melee) ? internalWeapon.mCollision.impactMultiplier : 0f;
				}
				set
				{
					if (internalWeapon.Type == WeaponType.Melee)
					{
						internalWeapon.mCollision.impactMultiplier = value;
					}
				}
			}

			public ModMelee(ModWeapon weapon)
			{
				internalWeapon = weapon;
			}
		}

		public class ModRanged
		{
			private readonly ModWeapon internalWeapon;

			public ModProjectile Projectile
			{
				get
				{
					return internalWeapon.projectile;
				}
				set
				{
					if (internalWeapon.Type == WeaponType.Ranged)
					{
						internalWeapon.projectile = value;
						internalWeapon.internalRanged.ObjectToSpawn = internalWeapon.projectile.internalObject;
					}
				}
			}

			public ModUnit UnitProjectile
			{
				get
				{
					return internalWeapon.unit;
				}
				set
				{
					internalWeapon.unit = value;
					if (internalWeapon.Type == WeaponType.Ranged)
					{
						Projectile = null;
						internalWeapon.internalRanged.unitToSpawn = internalWeapon.unit.internalObject;
					}
				}
			}

			public int Ammo
			{
				get
				{
					if (internalWeapon.Type == WeaponType.Ranged)
					{
						return internalWeapon.internalRanged.magSize;
					}
					return 0;
				}
				set
				{
					if (internalWeapon.Type == WeaponType.Ranged)
					{
						internalWeapon.internalRanged.magSize = value;
					}
				}
			}

			public int ProjectileAmount
			{
				get
				{
					if (internalWeapon.Type == WeaponType.Ranged)
					{
						return internalWeapon.internalRanged.numberOfObjects;
					}
					return 0;
				}
				set
				{
					if (internalWeapon.Type == WeaponType.Ranged)
					{
						internalWeapon.internalRanged.numberOfObjects = value;
					}
				}
			}

			public float Spread
			{
				get
				{
					if (internalWeapon.Type == WeaponType.Ranged)
					{
						return internalWeapon.internalRanged.spread;
					}
					return 0f;
				}
				set
				{
					if (internalWeapon.Type == WeaponType.Ranged)
					{
						internalWeapon.internalRanged.spread = value;
					}
				}
			}

			public float Recoil
			{
				get
				{
					if (internalWeapon.Type == WeaponType.Ranged)
					{
						return internalWeapon.internalRanged.shootRecoil;
					}
					return 0f;
				}
				set
				{
					if (internalWeapon.Type == WeaponType.Ranged)
					{
						internalWeapon.internalRanged.shootRecoil = value;
						internalWeapon.internalRanged.torsoRecoil = value * 0.1f;
					}
				}
			}

			public ModRanged(ModWeapon weapon)
			{
				internalWeapon = weapon;
			}
		}

		private WeaponItem item;

		private Weapon weapon;

		private RangeWeapon internalRanged;

		private MeleeWeapon internalMelee;

		private CollisionWeapon mCollision;

		private MeleeWeaponSpawn mSpawner;

		private MeleeWeaponAddEffect mAddEffect;

		private ModEffect effect;

		private ModExplosion explosion;

		private ModModel model;

		public ModMelee Melee;

		private ModProjectile projectile;

		private ModUnit unit;

		public ModRanged Ranged;

		public GameObject internalObject { get; private set; }

		public override string Name
		{
			get
			{
				return ((CharacterItem)item).Entity.Name;
			}
			set
			{
				((CharacterItem)item).Entity.Name = value;
			}
		}

		public WeaponType Type { get; private set; }

		public float Cooldown
		{
			get
			{
				return weapon.internalCooldown;
			}
			set
			{
				weapon.internalCooldown = value;
			}
		}

		public float AttackSpeed
		{
			get
			{
				return 1f / weapon.internalCooldown;
			}
			set
			{
				weapon.internalCooldown = 1f / value;
			}
		}

		public float AttackRange
		{
			get
			{
				return weapon.maxRange;
			}
			set
			{
				weapon.maxRange = value;
			}
		}

		public float AttackAngle
		{
			get
			{
				return weapon.maxAngle;
			}
			set
			{
				weapon.maxAngle = value;
			}
		}

		public bool StartCooldown
		{
			get
			{
				return weapon.startOnCooldown;
			}
			set
			{
				weapon.startOnCooldown = value;
			}
		}

		public float Damage
		{
			get
			{
				if (Type == WeaponType.Melee)
				{
					return mCollision.damage;
				}
				if (Type == WeaponType.Ranged)
				{
					return Ranged.Projectile.Damage;
				}
				return 0f;
			}
			set
			{
				if (Type == WeaponType.Melee)
				{
					mCollision.damage = value;
				}
				else if (Type == WeaponType.Ranged)
				{
					Ranged.Projectile.Damage = value;
				}
			}
		}

		public float Force
		{
			get
			{
				if (Type == WeaponType.Melee)
				{
					return mCollision.onImpactForce;
				}
				if (Type == WeaponType.Ranged)
				{
					return projectile.Force;
				}
				return 0f;
			}
			set
			{
				if (Type == WeaponType.Melee)
				{
					mCollision.onImpactForce = value;
				}
				else if (Type == WeaponType.Ranged)
				{
					projectile.Force = value;
				}
			}
		}

		public ModEffect Effect
		{
			get
			{
				if (Type == WeaponType.Melee)
				{
					return effect;
				}
				if (Type == WeaponType.Ranged)
				{
					return Ranged.Projectile.Effect;
				}
				return null;
			}
			set
			{
				effect = value;
				if (Type == WeaponType.Melee)
				{
					effect = value;
					if (!Object.op_Implicit((Object)(object)mAddEffect))
					{
						mAddEffect = internalObject.AddComponent<MeleeWeaponAddEffect>();
					}
					bool flag = effect != null && Object.op_Implicit((Object)(object)effect.internalObject);
					if (flag)
					{
						mAddEffect.EffectPrefab = effect.internalObject;
					}
					else
					{
						mAddEffect.EffectPrefab = null;
					}
					((Behaviour)mAddEffect).enabled = flag;
				}
				else if (Type == WeaponType.Ranged)
				{
					Ranged.Projectile.Effect = value;
				}
			}
		}

		public ModExplosion Explosion
		{
			get
			{
				if (Type == WeaponType.Melee)
				{
					return explosion;
				}
				if (Type == WeaponType.Ranged && projectile != null)
				{
					return projectile.Explosion;
				}
				return null;
			}
			set
			{
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				explosion = value;
				if (Type == WeaponType.Melee)
				{
					if (!Object.op_Implicit((Object)(object)mSpawner))
					{
						mSpawner = internalObject.AddComponent<MeleeWeaponSpawn>();
						mSpawner.pos = (Pos)1;
					}
					bool flag = explosion != null && Object.op_Implicit((Object)(object)explosion.internalObject);
					if (flag)
					{
						mSpawner.objectToSpawn = explosion.internalObject;
					}
					else
					{
						mSpawner.objectToSpawn = null;
					}
					((Behaviour)mSpawner).enabled = flag;
				}
				else if (Type == WeaponType.Ranged && projectile != null)
				{
					projectile.Explosion = value;
				}
			}
		}

		public ModModel Model
		{
			get
			{
				return model;
			}
			set
			{
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				if (value != null)
				{
					Utilities.SetMeshRenderers(internalObject, enabled: false);
					model = value.Clone();
					model.internalObject.transform.parent = internalObject.transform;
					model.internalObject.transform.localPosition = Vector3.zero;
					mode