Decompiled source of DeflectGods v1.1.2

DeflectGods.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using DM;
using DeflectGodsFunctions;
using FhpSLib;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.AI.Components.Modifiers;
using Landfall.TABS.UnitEditor;
using SLMA;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DeflectGods")]
[assembly: AssemblyDescription("DeflectGods")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("GeeztJeez")]
[assembly: AssemblyProduct("DeflectGods")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f3b85c2a-4e7e-4b3f-8919-5b0f191c273e")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.2.0")]
[module: UnverifiableCode]
namespace DeflectGods
{
	public static class UManager
	{
		public class Utility : MonoBehaviour
		{
			public static class ItemCategorizer
			{
				public static void SetTag(GameObject item, string categoryName = "Deflect Gods", TagType tagType = 0)
				{
					//IL_0018: Unknown result type (might be due to invalid IL or missing references)
					//IL_0020: Unknown result type (might be due to invalid IL or missing references)
					//IL_0021: Unknown result type (might be due to invalid IL or missing references)
					//IL_002e: Unknown result type (might be due to invalid IL or missing references)
					try
					{
						CharacterItem componentInChildren = item.GetComponentInChildren<CharacterItem>();
						if (Object.op_Implicit((Object)(object)componentInChildren))
						{
							componentInChildren.tags = new List<Tag>
							{
								new Tag
								{
									tagType = tagType,
									value = categoryName
								}
							};
						}
					}
					catch (Exception ex)
					{
						Debug.Log((object)ex);
					}
				}
			}

			public static class PrimitiveHelper
			{
				private static Dictionary<PrimitiveType, Mesh> primitiveMeshes;

				public static GameObject CreatePrimitive(PrimitiveType type, bool withCollider)
				{
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					//IL_001c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0022: Unknown result type (might be due to invalid IL or missing references)
					//IL_002d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0035: Expected O, but got Unknown
					//IL_0003: Unknown result type (might be due to invalid IL or missing references)
					if (withCollider)
					{
						return GameObject.CreatePrimitive(type);
					}
					GameObject val = new GameObject(((object)(PrimitiveType)(ref type)).ToString());
					val.AddComponent<MeshFilter>().sharedMesh = GetPrimitiveMesh(type);
					val.AddComponent<MeshRenderer>();
					return val;
				}

				public static Mesh GetPrimitiveMesh(PrimitiveType type)
				{
					//IL_0005: Unknown result type (might be due to invalid IL or missing references)
					//IL_0019: Unknown result type (might be due to invalid IL or missing references)
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					if (!primitiveMeshes.ContainsKey(type))
					{
						CreatePrimitiveMesh(type);
					}
					return primitiveMeshes[type];
				}

				private static Mesh CreatePrimitiveMesh(PrimitiveType type)
				{
					//IL_0000: Unknown result type (might be due to invalid IL or missing references)
					//IL_001c: Unknown result type (might be due to invalid IL or missing references)
					GameObject obj = GameObject.CreatePrimitive(type);
					Mesh sharedMesh = obj.GetComponent<MeshFilter>().sharedMesh;
					Object.Destroy((Object)(object)obj);
					primitiveMeshes[type] = sharedMesh;
					return sharedMesh;
				}

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

			public static class GameObjectHelper
			{
				public static GameObject InstantiateEmpty(string name, Vector3 position, Quaternion rotation, Transform parent)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_000c: 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_001e: Unknown result type (might be due to invalid IL or missing references)
					//IL_002b: Expected O, but got Unknown
					GameObject val = new GameObject(name);
					val.transform.position = position;
					val.transform.rotation = rotation;
					val.transform.parent = parent;
					return val;
				}
			}

			private static Dictionary<DatabaseID, GameObject> CharacterProps
			{
				get
				{
					Dictionary<DatabaseID, GameObject> dictionary = HelpLibrary.m_characterProps;
					if (dictionary == null)
					{
						dictionary = (HelpLibrary.m_characterProps = new Dictionary<DatabaseID, GameObject>());
					}
					return dictionary;
				}
			}

			private static Dictionary<DatabaseID, GameObject> UnitBases
			{
				get
				{
					Dictionary<DatabaseID, GameObject> dictionary = HelpLibrary.m_unitBases;
					if (dictionary == null)
					{
						dictionary = (HelpLibrary.m_unitBases = new Dictionary<DatabaseID, GameObject>());
					}
					return dictionary;
				}
			}

			private static Dictionary<DatabaseID, GameObject> CombatMoves
			{
				get
				{
					Dictionary<DatabaseID, GameObject> dictionary = HelpLibrary.m_combatMoves;
					if (dictionary == null)
					{
						dictionary = (HelpLibrary.m_combatMoves = new Dictionary<DatabaseID, GameObject>());
					}
					return dictionary;
				}
			}

			private static Dictionary<DatabaseID, Faction> Factions
			{
				get
				{
					Dictionary<DatabaseID, Faction> dictionary = HelpLibrary.m_factions;
					if (dictionary == null)
					{
						dictionary = (HelpLibrary.m_factions = new Dictionary<DatabaseID, Faction>());
					}
					return dictionary;
				}
			}

			private static Dictionary<DatabaseID, GameObject> Weapons
			{
				get
				{
					Dictionary<DatabaseID, GameObject> dictionary = HelpLibrary.m_weapons;
					if (dictionary == null)
					{
						dictionary = (HelpLibrary.m_weapons = new Dictionary<DatabaseID, GameObject>());
					}
					return dictionary;
				}
			}

			private static Dictionary<DatabaseID, GameObject> Projectiles
			{
				get
				{
					Dictionary<DatabaseID, GameObject> dictionary = HelpLibrary.m_projectiles;
					if (dictionary == null)
					{
						dictionary = (HelpLibrary.m_projectiles = new Dictionary<DatabaseID, GameObject>());
					}
					return dictionary;
				}
			}

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

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

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

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

			public static int IDChecker(AssetType type, int startId = 1)
			{
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				int num = Math.Max(1, startId);
				DatabaseID id = default(DatabaseID);
				((DatabaseID)(ref id))..ctor(num);
				while (IsOccupied(type, id))
				{
					Debug.LogWarning((object)$"[IDChecker] ID {num} in use for {type}, trying {num + 1}…");
					num++;
					((DatabaseID)(ref id))..ctor(num);
				}
				Debug.Log((object)$"[IDChecker] Found free ID for {type}: {num}");
				return num;
			}

			private static bool IsOccupied(AssetType type, DatabaseID id)
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				return type switch
				{
					AssetType.Prop => CharacterProps.ContainsKey(id), 
					AssetType.UnitBase => UnitBases.ContainsKey(id), 
					AssetType.Faction => Factions.ContainsKey(id), 
					AssetType.Ability => CombatMoves.ContainsKey(id), 
					AssetType.Weapon => Weapons.ContainsKey(id), 
					AssetType.Projectile => Projectiles.ContainsKey(id), 
					_ => throw new ArgumentOutOfRangeException("type", type, null), 
				};
			}
		}

		public enum AssetType
		{
			Prop,
			UnitBase,
			Faction,
			Ability,
			Weapon,
			Projectile
		}

		private static string comment;

		public static AssetBundle bundle;

		public static void SetBlueprint(UnitBlueprint unit, LandfallContentDatabase db)
		{
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Expected O, but got Unknown
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Expected O, but got Unknown
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Expected O, but got Unknown
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Expected O, but got Unknown
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Expected O, but got Unknown
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Expected O, but got Unknown
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Expected O, but got Unknown
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Expected O, but got Unknown
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Expected O, but got Unknown
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Expected O, but got Unknown
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Expected O, but got Unknown
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Expected O, but got Unknown
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Expected O, but got Unknown
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Expected O, but got Unknown
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Expected O, but got Unknown
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Expected O, but got Unknown
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_0426: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Expected O, but got Unknown
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Expected O, but got Unknown
			//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0504: Expected O, but got Unknown
			//IL_0537: Unknown result type (might be due to invalid IL or missing references)
			//IL_053c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: Unknown result type (might be due to invalid IL or missing references)
			//IL_055f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0565: Expected O, but got Unknown
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c5: Expected O, but got Unknown
			//IL_05f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0611: Unknown result type (might be due to invalid IL or missing references)
			//IL_061a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0620: Expected O, but got Unknown
			//IL_0652: Unknown result type (might be due to invalid IL or missing references)
			//IL_0657: Unknown result type (might be due to invalid IL or missing references)
			//IL_066c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0671: Unknown result type (might be due to invalid IL or missing references)
			//IL_067b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0681: Expected O, but got Unknown
			//IL_06b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e3: Expected O, but got Unknown
			//IL_0716: Unknown result type (might be due to invalid IL or missing references)
			//IL_071b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0730: Unknown result type (might be due to invalid IL or missing references)
			//IL_0735: Unknown result type (might be due to invalid IL or missing references)
			//IL_073f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0745: Expected O, but got Unknown
			//IL_0778: Unknown result type (might be due to invalid IL or missing references)
			//IL_077d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0792: Unknown result type (might be due to invalid IL or missing references)
			//IL_0797: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a7: Expected O, but got Unknown
			//IL_07da: Unknown result type (might be due to invalid IL or missing references)
			//IL_07df: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0803: Unknown result type (might be due to invalid IL or missing references)
			//IL_0809: Expected O, but got Unknown
			//IL_083c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0841: Unknown result type (might be due to invalid IL or missing references)
			//IL_0856: Unknown result type (might be due to invalid IL or missing references)
			//IL_085b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0870: Unknown result type (might be due to invalid IL or missing references)
			//IL_0876: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ae: Expected O, but got Unknown
			//IL_0a25: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2b: Expected O, but got Unknown
			//IL_0a46: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4c: Expected O, but got Unknown
			//IL_0a67: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6d: Expected O, but got Unknown
			//IL_0a88: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a8e: Expected O, but got Unknown
			//IL_0aa9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aaf: Expected O, but got Unknown
			//IL_0aca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad0: Expected O, but got Unknown
			//IL_0aeb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af1: Expected O, but got Unknown
			//IL_0b0c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b12: Expected O, but got Unknown
			//IL_0b2d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b33: Expected O, but got Unknown
			//IL_0b4f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b55: Expected O, but got Unknown
			//IL_0b71: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b77: Expected O, but got Unknown
			//IL_0bac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb2: Expected O, but got Unknown
			//IL_0bd8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bde: Expected O, but got Unknown
			//IL_0c05: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c0b: Expected O, but got Unknown
			//IL_0c2c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c32: Expected O, but got Unknown
			//IL_0c59: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c5f: Expected O, but got Unknown
			//IL_0c86: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c8c: Expected O, but got Unknown
			//IL_0cb3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb9: Expected O, but got Unknown
			//IL_0cda: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce0: Expected O, but got Unknown
			//IL_0d06: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d0c: Expected O, but got Unknown
			//IL_0d34: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d3a: Expected O, but got Unknown
			//IL_0d62: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d68: Expected O, but got Unknown
			//IL_0d94: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d9a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dde: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de4: Expected O, but got Unknown
			//IL_0dff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e05: Expected O, but got Unknown
			//IL_0e20: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e26: Expected O, but got Unknown
			//IL_0e41: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e47: Expected O, but got Unknown
			//IL_0e62: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e68: Expected O, but got Unknown
			if (unit.Entity.Name == "Godslayer")
			{
				SLMATool.UnitCost(unit, 20000);
				unit.Entity.SetUnlockKey("SECRET_GODSLAYER");
				unit.UnitBase = UPool.MyPool.GetObject("Godslayer_Base");
				s.SetField<UnitBlueprint>(unit, "vocalRef", (object)"Medieval Attack Vocals/Knight");
				s.SetField<UnitBlueprint>(unit, "deathRef", (object)"Medieval Death Vocals/Knight");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Skeleton");
				s.SetField<UnitBlueprint>(unit, "voicePitch", (object)0.65f);
				unit.health = 8000f;
				unit.minSizeRandom = 1f;
				unit.maxSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.massMultiplier = 45f;
				unit.stepMultiplier = 1.6f;
				unit.balanceMultiplier = 1.6f;
				unit.animationMultiplier = 1.3f;
				unit.neckLimitMultiplier = 1.3f;
				unit.balanceForceMultiplier = 1.4f;
				unit.movementSpeedMuiltiplier = 1.8f;
				unit.LeftWeapon = UPool.MyPool.GetObject("VengriefBlade");
				unit.RightWeapon = UPool.MyPool.GetObject("VengriefBlade");
				unit.m_props = (GameObject[])(object)new GameObject[15]
				{
					(GameObject)SLMALoader.SDic["clothes"]["SkeletonMask002"],
					(GameObject)SLMALoader.SDic["clothes"]["cp_halloween_warrior_helmet001"],
					(GameObject)SLMALoader.SDic["clothes"]["Medieval_ShoulderPad003"],
					(GameObject)SLMALoader.SDic["clothes"]["Medieval_ChestArmor003"],
					(GameObject)SLMALoader.SDic["clothes"]["Medieval_KnightCape001"],
					(GameObject)SLMALoader.SDic["clothes"]["Medieval_ElbowArmor_Both"],
					(GameObject)SLMALoader.SDic["clothes"]["Medieval_HandGuard002"],
					(GameObject)SLMALoader.SDic["clothes"]["MummySuit001"],
					(GameObject)SLMALoader.SDic["clothes"]["Medieval_CalfArmor003"],
					(GameObject)SLMALoader.SDic["clothes"]["Crusader_Knight_Boots"],
					(GameObject)SLMALoader.SDic["clothes"]["Medieval_ThighArmor002"],
					(GameObject)SLMALoader.SDic["clothes"]["Viking_Belt001"],
					(GameObject)SLMALoader.SDic["clothes"]["raptorrider_waist001"],
					(GameObject)SLMALoader.SDic["clothes"]["Viking_Belt001"],
					UPool.MyPool.GetObject("GodslayerHelmet")
				};
				PropItemData[] array = new PropItemData[14];
				PropItemData val = new PropItemData();
				val.m_colors = new int[2] { 49, 49 };
				val.m_isTeamColor = new bool[2];
				val.m_positionOffset = new Vector3(0f, 0f, 0f);
				val.m_scale = new Vector3(1f, 1f, 1f);
				array[0] = val;
				val = new PropItemData();
				val.m_colors = new int[1] { 49 };
				val.m_isTeamColor = new bool[1];
				val.m_positionOffset = new Vector3(0f, 0f, 0f);
				val.m_scale = new Vector3(1f, 1f, 1f);
				array[1] = val;
				val = new PropItemData();
				val.m_colors = new int[1] { 49 };
				val.m_isTeamColor = new bool[1];
				val.m_positionOffset = new Vector3(0f, 0f, 0f);
				val.m_scale = new Vector3(1f, 1f, 1f);
				array[2] = val;
				val = new PropItemData();
				val.m_colors = new int[1] { 49 };
				val.m_isTeamColor = new bool[1];
				val.m_positionOffset = new Vector3(0f, 0f, 0f);
				val.m_scale = new Vector3(1f, 1f, 1f);
				array[3] = val;
				val = new PropItemData();
				val.m_colors = new int[1];
				val.m_isTeamColor = new bool[1] { true };
				val.m_positionOffset = new Vector3(0f, 0f, 0f);
				val.m_scale = new Vector3(1f, 1f, 1f);
				array[4] = val;
				val = new PropItemData();
				val.m_colors = new int[8] { 49, 39, 76, 79, 49, 39, 76, 79 };
				val.m_isTeamColor = new bool[8];
				val.m_positionOffset = new Vector3(0f, 0f, 0f);
				val.m_scale = new Vector3(1f, 1f, 1f);
				array[5] = val;
				val = new PropItemData();
				val.m_colors = new int[2] { 49, 79 };
				val.m_isTeamColor = new bool[2];
				val.m_positionOffset = new Vector3(0f, 0f, 0f);
				val.m_scale = new Vector3(1f, 1f, 1f);
				array[6] = val;
				val = new PropItemData();
				val.m_colors = new int[1] { 49 };
				val.m_isTeamColor = new bool[1];
				val.m_positionOffset = new Vector3(0f, 0f, 0f);
				val.m_scale = new Vector3(1f, 1f, 1f);
				array[7] = val;
				val = new PropItemData();
				val.m_colors = new int[2] { 48, 49 };
				val.m_isTeamColor = new bool[2];
				val.m_positionOffset = new Vector3(0f, 0f, 0f);
				val.m_scale = new Vector3(1f, 1f, 1f);
				array[8] = val;
				val = new PropItemData();
				val.m_colors = new int[4] { 35, 79, 76, 49 };
				val.m_isTeamColor = new bool[4];
				val.m_positionOffset = new Vector3(0f, 0f, 0f);
				val.m_scale = new Vector3(1f, 1f, 1f);
				array[9] = val;
				val = new PropItemData();
				val.m_colors = new int[3] { 76, 35, 79 };
				val.m_isTeamColor = new bool[3];
				val.m_positionOffset = new Vector3(0f, 0f, 0f);
				val.m_scale = new Vector3(1f, 1f, 1f);
				array[10] = val;
				val = new PropItemData();
				val.m_colors = new int[3] { 49, 46, 79 };
				val.m_isTeamColor = new bool[3];
				val.m_positionOffset = new Vector3(0f, 0f, 0f);
				val.m_scale = new Vector3(1f, 1f, 1f);
				array[11] = val;
				val = new PropItemData();
				val.m_colors = new int[4] { 76, 49, 49, 35 };
				val.m_isTeamColor = new bool[4];
				val.m_positionOffset = new Vector3(0f, 0f, 0f);
				val.m_scale = new Vector3(1f, 1f, 1f);
				array[12] = val;
				val = new PropItemData();
				val.m_colors = new int[3] { 49, -1, 79 };
				val.m_isTeamColor = new bool[3];
				val.m_positionOffset = new Vector3(0f, 0.2785997f, 0f);
				val.m_scale = new Vector3(1f, -1f, 1f);
				array[13] = val;
				unit.m_propData = (PropItemData[])(object)array;
				unit.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(NeverStopRunning) };
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[5]
				{
					(GameObject)SLMALoader.SDic["moves"]["Small_Hover"],
					UPool.MyPool.GetObject("Move_EliteCombatant"),
					UPool.MyPool.GetObject("Move_WitheredWings"),
					UPool.MyPool.GetObject("Move_EternalSlash"),
					UPool.MyPool.GetObject("Move_WatchfulDeflect")
				};
			}
			if (unit.Entity.Name == "Bastion")
			{
				SLMATool.UnitCost(unit, 800000);
				unit.Entity.SetUnlockKey("SECRET_BASTION");
				unit.UnitBase = UPool.MyPool.GetObject("Bastion_Base");
				s.SetField<UnitBlueprint>(unit, "vocalRef", (object)"Medieval Attack Vocals/TheKing");
				s.SetField<UnitBlueprint>(unit, "deathRef", (object)"Medieval Death Vocals/TheKing");
				s.SetField<UnitBlueprint>(unit, "footRef", (object)"Footsteps/Mammoth");
				s.SetField<UnitBlueprint>(unit, "voicePitch", (object)0.35f);
				unit.health = 500000f;
				unit.minSizeRandom = 1f;
				unit.maxSizeRandom = 1f;
				unit.sizeMultiplier = 1f;
				unit.massMultiplier = 3000f;
				unit.animationMultiplier = 0.25f;
				unit.stepMultiplier = 1.7f;
				unit.movementSpeedMuiltiplier = 1.7f;
				unit.holdinigWithTwoHands = true;
				unit.RightWeapon = UPool.MyPool.GetObject("BastionGate_Shield");
				unit.m_props = (GameObject[])(object)new GameObject[13]
				{
					(GameObject)SLMALoader.SDic["clothes"]["Medieval_CalfArmor002"],
					(GameObject)SLMALoader.SDic["clothes"]["Medieval_ThighArmor002"],
					(GameObject)SLMALoader.SDic["clothes"]["Renaissance_Leggings001"],
					(GameObject)SLMALoader.SDic["clothes"]["Crusader_Knight_Boots"],
					(GameObject)SLMALoader.SDic["clothes"]["MongolianArmor001"],
					(GameObject)SLMALoader.SDic["clothes"]["WetSuit001"],
					(GameObject)SLMALoader.SDic["clothes"]["wilnyl_Gloves001"],
					(GameObject)SLMALoader.SDic["clothes"]["Renaissance_HandGuard"],
					(GameObject)SLMALoader.SDic["clothes"]["Medieval_ElbowArmor002_L"],
					(GameObject)SLMALoader.SDic["clothes"]["Medieval_ElbowArmor_Both"],
					(GameObject)SLMALoader.SDic["clothes"]["Crusader_Knight_Cape"],
					UPool.MyPool.GetObject("Bastion_Helmet"),
					UPool.MyPool.GetObject("Bastion_Shoulder")
				};
				PropItemData[] array2 = new PropItemData[11];
				PropItemData val = new PropItemData();
				val.m_colors = new int[2] { 44, 44 };
				val.m_isTeamColor = new bool[2];
				array2[0] = val;
				val = new PropItemData();
				val.m_colors = new int[3] { 44, 44, 44 };
				val.m_isTeamColor = new bool[3];
				array2[1] = val;
				val = new PropItemData();
				val.m_colors = new int[1] { 44 };
				val.m_isTeamColor = new bool[1];
				array2[2] = val;
				val = new PropItemData();
				val.m_colors = new int[4] { 44, 44, 44, 44 };
				val.m_isTeamColor = new bool[4];
				array2[3] = val;
				val = new PropItemData();
				val.m_colors = new int[3] { 44, 44, 44 };
				val.m_isTeamColor = new bool[3];
				array2[4] = val;
				val = new PropItemData();
				val.m_colors = new int[3] { 44, 44, 44 };
				val.m_isTeamColor = new bool[3];
				array2[5] = val;
				val = new PropItemData();
				val.m_colors = new int[1] { 44 };
				val.m_isTeamColor = new bool[1];
				array2[6] = val;
				val = new PropItemData();
				val.m_colors = new int[2] { 44, 44 };
				val.m_isTeamColor = new bool[2];
				array2[7] = val;
				val = new PropItemData();
				val.m_colors = new int[4] { 44, 44, 44, 44 };
				val.m_isTeamColor = new bool[4];
				array2[8] = val;
				val = new PropItemData();
				val.m_colors = new int[8] { 44, 44, 44, 44, 44, 44, 44, 44 };
				val.m_isTeamColor = new bool[8];
				array2[9] = val;
				val = new PropItemData();
				val.m_colors = new int[1];
				val.m_isTeamColor = new bool[1] { true };
				array2[10] = val;
				unit.m_propData = (PropItemData[])(object)array2;
				unit.MovementComponents = new List<IMovementComponent> { (IMovementComponent)(object)default(NeverStopRunning) };
				unit.objectsToSpawnAsChildren = (GameObject[])(object)new GameObject[6]
				{
					UPool.MyPool.GetObject("Move_SacriteGateGuard"),
					(GameObject)SLMALoader.SDic["moves"]["Small_Hover"],
					(GameObject)SLMALoader.SDic["moves"]["Taekwondo_Damage_L"],
					(GameObject)SLMALoader.SDic["moves"]["Taekwondo_Damage_R"],
					(GameObject)SLMALoader.SDic["moves"]["SkeletonGiant_Damage_L"],
					(GameObject)SLMALoader.SDic["moves"]["SkeletonGiant_Damage_R"]
				};
			}
		}

		public static void SetUnits(Unit unit, LandfallContentDatabase db)
		{
			if (unit.Entity.Name == ((Object)UPool.MyPool.GetObject("Godslayer_Base")).name)
			{
				unit.neverStopRunning = true;
				unit.targetingPriorityMultiplier = 1.5f;
				Collider[] componentsInChildren = ((Component)unit).gameObject.GetComponentsInChildren<Collider>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					((Component)componentsInChildren[i]).gameObject.AddComponent<UnitBaseDeflect>();
				}
				SkinnedMeshRenderer[] componentsInChildren2 = ((Component)unit).GetComponentsInChildren<SkinnedMeshRenderer>();
				for (int j = 0; j < componentsInChildren2.Length; j++)
				{
					((Component)componentsInChildren2[j]).gameObject.tag = "UnitMesh";
				}
			}
			if (unit.Entity.Name == ((Object)UPool.MyPool.GetObject("Bastion_Base")).name)
			{
				((Component)unit).gameObject.AddComponent<OnDeathKinematic>();
				unit.neverStopRunning = true;
				unit.targetingPriorityMultiplier = 100f;
				Collider[] componentsInChildren3 = ((Component)unit).gameObject.GetComponentsInChildren<Collider>();
				for (int k = 0; k < componentsInChildren3.Length; k++)
				{
					((Component)componentsInChildren3[k]).gameObject.AddComponent<UnitBaseDeflect>();
				}
				SkinnedMeshRenderer[] componentsInChildren4 = ((Component)unit).GetComponentsInChildren<SkinnedMeshRenderer>();
				for (int l = 0; l < componentsInChildren4.Length; l++)
				{
					((Component)componentsInChildren4[l]).gameObject.tag = "UnitMesh";
				}
			}
		}

		public static void Init(LandfallContentDatabase db)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			LoadBundle("deflectgodsbundle");
			Sprite val = Utility.LoadBundleTextureToSprite("icon_bastion");
			Sprite val2 = Utility.LoadBundleTextureToSprite("icon_godslayer");
			comment = "-------------------------------------------------------------- Units --------------------------------------------------------------";
			SLMATool.CreateUnit("Bastion", (UnitBlueprint)null, (Faction)SLMALoader.SDic["factions"]["Secret"], val);
			SLMATool.CreateUnit("Godslayer", (UnitBlueprint)null, Utility.SetFactionHidden((Faction)SLMALoader.SDic["factions"]["FantasyEvil"]), val2);
			comment = "-------------------------------------------------------------- Weapons --------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("BastionGate_Shield", Utility.LoadBundleGameObject("BastionGate_Shield"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Weapon, 49575867), true), "Deflect Gods", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("VengriefBlade", Utility.LoadBundleGameObject("VengriefBlade"), true, (HideFlags)52, val2, Utility.IDChecker(AssetType.Weapon, 49575868), true), "Deflect Gods", (TagType)0);
			comment = "-------------------------------------------------------------- Combat Moves --------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_SacriteGateGuard", Utility.LoadBundleGameObject("Move_SacriteGateGuard"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Ability, 72086379), true), "Deflect Gods", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_EliteCombatant", Utility.LoadBundleGameObject("Move_EliteCombatant"), true, (HideFlags)52, val2, Utility.IDChecker(AssetType.Ability, 72086375), true), "Deflect Gods", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_WitheredWings", Utility.LoadBundleGameObject("Move_WitheredWings"), true, (HideFlags)52, val2, Utility.IDChecker(AssetType.Ability, 72086376), true), "Deflect Gods", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_EternalSlash", Utility.LoadBundleGameObject("Move_EternalSlash"), true, (HideFlags)52, val2, Utility.IDChecker(AssetType.Ability, 72086377), true), "Deflect Gods", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_WatchfulDeflect", Utility.LoadBundleGameObject("Move_WatchfulDeflect"), true, (HideFlags)52, val2, Utility.IDChecker(AssetType.Ability, 802106481), true), "Deflect Gods", (TagType)0);
			comment = "-------------------------------------------------------------- Clothes --------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Bastion_Helmet", Utility.LoadBundleGameObject("Bastion_Helmet"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Prop, 38023503), true), "Deflect Gods", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Bastion_Shoulder", Utility.LoadBundleGameObject("Bastion_Shoulder"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.Prop, 380355323), true), "Deflect Gods", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("GodslayerHelmet", Utility.LoadBundleGameObject("GodslayerHelmet"), true, (HideFlags)52, val2, Utility.IDChecker(AssetType.Prop, 38023504), true), "Deflect Gods", (TagType)0);
			comment = "-------------------------------------------------------------- Unit Bases --------------------------------------------------------------";
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Bastion_Base", Utility.LoadBundleGameObject("Bastion_Base"), true, (HideFlags)52, val, Utility.IDChecker(AssetType.UnitBase, 61644007), true), "Deflect Gods", (TagType)0);
			Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Godslayer_Base", Utility.LoadBundleGameObject("Godslayer_Base"), true, (HideFlags)52, val2, Utility.IDChecker(AssetType.UnitBase, 61644008), true), "Deflect Gods", (TagType)0);
		}

		public static void SetWeapon(GameObject weapon, LandfallContentDatabase db)
		{
			if ((Object)(object)weapon == (Object)(object)UPool.MyPool.GetObject("VengriefBlade"))
			{
				weapon.AddComponent<ForceWeaponHandle>();
				weapon.AddComponent<SwordTwirlBehaviour>();
			}
			if ((Object)(object)weapon == (Object)(object)UPool.MyPool.GetObject("BastionGate_Shield"))
			{
				weapon.AddComponent<ForceWeaponHandle>();
				Collider[] componentsInChildren = weapon.GetComponentsInChildren<Collider>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					((Component)componentsInChildren[i]).gameObject.AddComponent<SurfaceDeflect>();
				}
			}
		}

		public static void LoadBundle(string assetBundleName)
		{
			Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(assetBundleName);
			if (manifestResourceStream == null)
			{
				Debug.LogError((object)("[LoadBundle] Failed to find resource: " + assetBundleName));
			}
			else if (!manifestResourceStream.CanRead)
			{
				Debug.LogError((object)("[LoadBundle] Resource stream is not readable: " + assetBundleName));
			}
			else
			{
				bundle = AssetBundle.LoadFromStream(manifestResourceStream);
			}
		}

		public static void SetMoves(GameObject move, LandfallContentDatabase db)
		{
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("GeeztJeez.DeflectGods", "DeflectGods", "1.1.2")]
	internal class Loader : BaseUnityPlugin
	{
		private void Awake()
		{
			ApplyHarmony();
			((MonoBehaviour)this).StartCoroutine(Call());
		}

		private IEnumerator Call()
		{
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)Object.FindObjectOfType<ServiceLocator>() != (Object)null));
			yield return (object)new WaitUntil((Func<bool>)(() => ServiceLocator.GetService<ISaveLoaderService>() != null));
			Debug.Log((object)"Loading DeflectGods...");
			SLMALoader.GetInstance();
			LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
			UManager.Init(landfallContentDatabase);
			SceneManager.sceneLoaded += SceneLoaded;
			GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
			for (int i = 0; i < array.Length; i++)
			{
				if (Object.op_Implicit((Object)(object)array[i].GetComponent<Unit>()))
				{
					UManager.SetUnits(array[i].GetComponent<Unit>(), landfallContentDatabase);
				}
				if (Object.op_Implicit((Object)(object)array[i].GetComponent<WeaponItem>()))
				{
					UManager.SetWeapon(array[i], landfallContentDatabase);
				}
				if (Object.op_Implicit((Object)(object)array[i].GetComponent<SpecialAbility>()))
				{
					UManager.SetMoves(array[i], landfallContentDatabase);
				}
			}
			UnitBlueprint[] array2 = Resources.FindObjectsOfTypeAll<UnitBlueprint>();
			for (int j = 0; j < array2.Length; j++)
			{
				UManager.SetBlueprint(array2[j], landfallContentDatabase);
				array2[j].Validate();
			}
			Debug.Log((object)"Loaded DeflectGods Successfully!");
		}

		public void SceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
		{
			try
			{
				if (((Scene)(ref scene)).name == "09_Lvl1_Fantasy_Evil_VC")
				{
					Object.Instantiate<GameObject>(UManager.Utility.LoadBundleGameObject("GodslayerSecretProp"));
				}
				if (((Scene)(ref scene)).name == "05_Sandbox_Medieval_VC")
				{
					Object.Instantiate<GameObject>(UManager.Utility.LoadBundleGameObject("BastionSecretProp"));
				}
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"[Expansionary] SceneLoaded failed: {arg}");
			}
		}

		private void ApplyHarmony()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				new Harmony("DeflectGods").PatchAll(Assembly.GetExecutingAssembly());
				Debug.Log((object)"[DeflectGods] Harmony patched successfully!");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("[DeflectGods] Harmony patch failed: " + ex));
				Debug.Log((object)"Please contact Geezt Jeez or try reloading the game for proper installation...");
			}
		}
	}
}
namespace DeflectGodsFunctions
{
	public class SurfaceDeflect : ProjectileSurfaceEffect
	{
		public override bool DoEffect(HitData hit, GameObject projectile)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			if (!((Behaviour)this).enabled)
			{
				return false;
			}
			TeamHolder component = projectile.GetComponent<TeamHolder>();
			MoveTransform component2 = projectile.GetComponent<MoveTransform>();
			ProjectileHit component3 = projectile.GetComponent<ProjectileHit>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.SwitchTeam();
			}
			component3.damage *= 1f;
			component2.velocity *= -1f;
			component3.canHitOrgUnit = true;
			projectile.GetComponent<RaycastTrail>().ignoredFrames = 2;
			ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect("Effects/TombStoneImpact", 3f, projectile.transform.position, (MaterialType)0, (Transform)null, 1f);
			return true;
		}
	}
	public class UnitBaseDeflect : ProjectileSurfaceEffect
	{
		public override bool DoEffect(HitData hit, GameObject projectile)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			if (!((Behaviour)this).enabled)
			{
				return false;
			}
			MoveTransform component = projectile.GetComponent<MoveTransform>();
			TeamHolder component2 = projectile.GetComponent<TeamHolder>();
			ProjectileHit component3 = projectile.GetComponent<ProjectileHit>();
			RaycastTrail component4 = projectile.GetComponent<RaycastTrail>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.velocity *= -1f;
			}
			if (Object.op_Implicit((Object)(object)component2))
			{
				component2.SwitchTeam();
			}
			if (Object.op_Implicit((Object)(object)component3))
			{
				component3.damage *= 1.1f;
				component3.canHitOrgUnit = true;
			}
			if (Object.op_Implicit((Object)(object)component4))
			{
				component4.ignoredFrames = 2;
			}
			ServiceLocator.GetService<SoundPlayer>().PlaySoundEffect("Effects/Log", 1.3f, hit.point, (MaterialType)0, (Transform)null, 1.1f);
			return true;
		}
	}
	public class SwordTwirlBehaviour : MonoBehaviour
	{
		private MeleeWeapon meleeWeapon;

		private Transform cachedTransform;

		[HideInInspector]
		public Rigidbody weaponRig;

		private void Update()
		{
			if (!((Object)(object)meleeWeapon == (Object)null) && meleeWeapon.isSwinging)
			{
				float timeScale = Time.timeScale;
				float num = Random.Range(0f, 180f) * timeScale;
				float num2 = Random.Range(0f, 180f) * timeScale;
				float num3 = Random.Range(0f, 180f) * timeScale;
				cachedTransform.Rotate(num, num2, num3, (Space)1);
			}
		}

		private void Start()
		{
			meleeWeapon = ((Component)this).GetComponentInChildren<MeleeWeapon>();
			weaponRig = ((Component)this).GetComponentInChildren<Rigidbody>();
			cachedTransform = ((Component)this).transform;
		}
	}
	public class OnDeathKinematic : MonoBehaviour
	{
		private Unit unit;

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

		public void Update()
		{
			if (Object.op_Implicit((Object)(object)unit) && Object.op_Implicit((Object)(object)unit.data) && unit.data.Dead)
			{
				Rigidbody[] allRigs = unit.data.allRigs.AllRigs;
				for (int i = 0; i < allRigs.Length; i++)
				{
					allRigs[i].isKinematic = true;
				}
			}
		}
	}
	public class TextureOffsetAnimation : MonoBehaviour
	{
		public int id;

		private float offset;

		public float speed = 2f;

		public Renderer renderer;

		private void Update()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)renderer))
			{
				offset += Time.deltaTime;
				renderer.materials[id].SetTextureOffset("_MainTex", new Vector2(offset, offset) * speed);
			}
		}

		public void Start()
		{
			renderer = ((Component)this).gameObject.GetComponentInChildren<Renderer>();
		}
	}
	public class ForceWeaponHandle : MonoBehaviour
	{
		public enum WeaponType
		{
			Ranged,
			Melee,
			Hybrid
		}

		public Unit unit;

		private RangeWeapon rangeWeapon;

		private MeleeWeapon meleeWeapon;

		public WeaponType weaponType;

		private Rigidbody weaponRig;

		private Rigidbody leftHandRig;

		private Rigidbody rightHandRig;

		private Holdable holdable;

		private void Start()
		{
			unit = ((Component)((Component)this).transform.root).GetComponentInChildren<Unit>();
			holdable = ((Component)this).GetComponentInChildren<Holdable>();
			rangeWeapon = ((Component)this).GetComponentInChildren<RangeWeapon>();
			meleeWeapon = ((Component)this).GetComponentInChildren<MeleeWeapon>();
			if (Object.op_Implicit((Object)(object)rangeWeapon) && Object.op_Implicit((Object)(object)meleeWeapon))
			{
				weaponType = WeaponType.Hybrid;
			}
			else if (Object.op_Implicit((Object)(object)rangeWeapon))
			{
				weaponType = WeaponType.Ranged;
			}
			else
			{
				weaponType = WeaponType.Melee;
			}
			weaponRig = ((Component)this).GetComponentInChildren<Rigidbody>();
			if (Object.op_Implicit((Object)(object)unit) && (Object)(object)unit.data != (Object)null)
			{
				Transform leftHand = unit.data.leftHand;
				leftHandRig = (((Object)(object)leftHand != (Object)null) ? ((Component)leftHand).GetComponentInChildren<Rigidbody>() : null);
				Transform rightHand = unit.data.rightHand;
				rightHandRig = (((Object)(object)rightHand != (Object)null) ? ((Component)rightHand).GetComponentInChildren<Rigidbody>() : null);
			}
		}

		private void Update()
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)weaponRig != (Object)null && Object.op_Implicit((Object)(object)holdable) && holdable.holdableData != null && weaponRig.isKinematic && (Object)(object)unit != (Object)null && (Object)(object)unit.data != (Object)null && !unit.data.Dead)
			{
				Debug.LogError((object)"Weapon not connected to hands yet, connecting...");
				Debug.LogError((object)("HandLeftPos: " + leftHandRig.position));
				Vector3 val = Vector3.zero;
				Transform leftHand = holdable.holdableData.leftHand;
				if ((Object)(object)leftHand != (Object)null)
				{
					val = ((Component)leftHand).transform.position;
				}
				if ((Object)(object)leftHandRig != (Object)null)
				{
					leftHandRig.position = val;
				}
				Debug.LogError((object)("HandLeftSupposedToBe: " + val));
				Debug.LogError((object)("HandRightPos: " + rightHandRig.position));
				Vector3 val2 = Vector3.zero;
				Transform rightHand = holdable.holdableData.rightHand;
				if ((Object)(object)rightHand != (Object)null)
				{
					val2 = ((Component)rightHand).transform.position;
				}
				if ((Object)(object)rightHandRig != (Object)null)
				{
					rightHandRig.position = val2;
				}
				Debug.LogError((object)("HandRightSupposedToBe: " + val2));
			}
		}
	}
}