Decompiled source of DeflectGods v1.1.1

DeflectGods.dll

Decompiled 8 months 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 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 © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7acfaef0-7669-4401-8bff-5a9a02e18c75")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.1.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 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;
		}
	}

	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, 15000);
			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 = 6000f;
			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, 50000);
			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 = 12000f;
			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)
	{
		//IL_0026: 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)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Expected O, but got Unknown
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Expected O, but got Unknown
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0333: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Expected O, but got Unknown
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Expected O, but got Unknown
		//IL_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ef: Expected O, but got Unknown
		//IL_0408: Unknown result type (might be due to invalid IL or missing references)
		//IL_0412: Expected O, but got Unknown
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Expected O, but got Unknown
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0214: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		//IL_0233: Expected O, but got Unknown
		//IL_0243: Unknown result type (might be due to invalid IL or missing references)
		//IL_0248: Unknown result type (might be due to invalid IL or missing references)
		//IL_025c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0261: Unknown result type (might be due to invalid IL or missing references)
		//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0300: Expected O, but got Unknown
		if (unit.Entity.Name == "Godslayer_Base")
		{
			Transform transform = ((Component)unit).gameObject.transform;
			transform.localScale *= 2.2f;
			unit.neverStopRunning = true;
			unit.data.takeFallDamage = false;
			unit.targetingPriorityMultiplier = 1.5f;
			((Component)unit).GetComponentInChildren<RigidbodyHolder>().randomizeRigidbodySizes = false;
			GameObject val = UPool.MyPool.AddObject("Godslayer_Eye", ((Component)unit).GetComponentInChildren<EyeSpawner>().eyeObject, true, (HideFlags)52, (Sprite)null, 0, false);
			((Renderer)val.GetComponentsInChildren<MeshRenderer>()[0]).material = (Material)SLMALoader.SDic["materials"]["EyeBlack"];
			((Renderer)val.GetComponentsInChildren<MeshRenderer>()[1]).material = (Material)SLMALoader.SDic["materials"]["Glow_Neon_Chill"];
			((Component)val.GetComponentsInChildren<MeshRenderer>()[1]).transform.localScale = new Vector3(0.05f, 0.002f, 0.002f);
			((Component)unit).GetComponentInChildren<EyeSpawner>().eyeObject = val;
			((Component)unit).GetComponentInChildren<EyeSpawner>().randomizeEyes = false;
			Collider[] componentsInChildren = ((Component)unit).gameObject.GetComponentsInChildren<Collider>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				((Component)componentsInChildren[i]).gameObject.AddComponent<UnitBaseDeflect>();
			}
			TeamColor[] componentsInChildren2 = ((Component)unit).GetComponentsInChildren<TeamColor>();
			foreach (TeamColor obj in componentsInChildren2)
			{
				obj.redMaterial = new Material(obj.redMaterial);
				obj.blueMaterial = new Material(obj.blueMaterial);
				obj.redMaterial.color = new Color(0.5f, 0.3f, 0.3f);
				obj.blueMaterial.color = new Color(0.3f, 0.3f, 0.5f);
			}
			ParticleTeamColor[] componentsInChildren3 = ((Component)unit).GetComponentsInChildren<ParticleTeamColor>();
			foreach (ParticleTeamColor obj2 in componentsInChildren3)
			{
				obj2.redMat = new Material(Shader.Find("Standard"))
				{
					color = new Color(0.15f, 0f, 0.1f)
				};
				obj2.blueMat = new Material(Shader.Find("Standard"))
				{
					color = new Color(0.1f, 0f, 0.15f)
				};
				obj2.redColor = new Color(0f, 0f, 0f);
				obj2.blueColor = new Color(0f, 0f, 0f);
			}
			ParticleSystem[] componentsInChildren4 = ((Component)unit).GetComponentsInChildren<ParticleSystem>();
			foreach (ParticleSystem obj3 in componentsInChildren4)
			{
				obj3.startSize *= 2f;
				obj3.startColor = new Color(0f, 0f, 0f);
			}
			ParticleSystemRenderer[] componentsInChildren5 = ((Component)unit).GetComponentsInChildren<ParticleSystemRenderer>();
			for (int k = 0; k < componentsInChildren5.Length; k++)
			{
				((Renderer)componentsInChildren5[k]).material = new Material(Shader.Find("Standard"))
				{
					color = new Color(0.15f, 0f, 0.15f)
				};
			}
		}
		if (unit.Entity.Name == "Bastion_Base")
		{
			Transform transform2 = ((Component)unit).gameObject.transform;
			transform2.localScale *= 4.8f;
			((Component)unit).gameObject.AddComponent<OnDeathRigidUnitbase>();
			unit.neverStopRunning = true;
			unit.data.takeFallDamage = false;
			unit.targetingPriorityMultiplier = 100f;
			((Component)unit).GetComponentInChildren<RigidbodyHolder>().randomizeRigidbodySizes = false;
			FootSupport[] componentsInChildren6 = ((Component)unit).GetComponentsInChildren<FootSupport>();
			foreach (FootSupport obj4 in componentsInChildren6)
			{
				obj4.extraSupportTime = float.PositiveInfinity;
				obj4.extraNoSupportTime = 0f;
				obj4.slippery = null;
			}
			TeamColor[] componentsInChildren2 = ((Component)unit).GetComponentsInChildren<TeamColor>();
			foreach (TeamColor obj5 in componentsInChildren2)
			{
				obj5.redMaterial = (Material)SLMALoader.SDic["materials"]["M_Viking_Stone002"];
				obj5.blueMaterial = (Material)SLMALoader.SDic["materials"]["M_Viking_Stone002"];
			}
			Collider[] componentsInChildren7 = ((Component)unit).gameObject.GetComponentsInChildren<Collider>();
			for (int l = 0; l < componentsInChildren7.Length; l++)
			{
				((Component)componentsInChildren7[l]).gameObject.AddComponent<UnitBaseDeflect>();
			}
			Object.Destroy((Object)(object)((Component)unit).GetComponentInChildren<EyeSpawner>());
		}
	}

	public static void Init(LandfallContentDatabase db)
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Expected O, but got Unknown
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Expected O, but got Unknown
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: Expected O, but got Unknown
		//IL_0254: Unknown result type (might be due to invalid IL or missing references)
		//IL_0268: Expected O, but got Unknown
		comment = "-------------------------------------------------------------- Custom Object --------------------------------------------------------------";
		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, 49575867, true), "Deflect Gods", (TagType)0);
		Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("VengriefBlade", Utility.LoadBundleGameObject("VengriefBlade"), true, (HideFlags)52, val2, 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, 72086379, true), "Deflect Gods", (TagType)0);
		Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_EliteCombatant", Utility.LoadBundleGameObject("Move_EliteCombatant"), true, (HideFlags)52, val2, 72086375, true), "Deflect Gods", (TagType)0);
		Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_WitheredWings", Utility.LoadBundleGameObject("Move_WitheredWings"), true, (HideFlags)52, val2, 72086376, true), "Deflect Gods", (TagType)0);
		Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_EternalSlash", Utility.LoadBundleGameObject("Move_EternalSlash"), true, (HideFlags)52, val2, 72086377, true), "Deflect Gods", (TagType)0);
		Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Move_WatchfulDeflect", Utility.LoadBundleGameObject("Move_WatchfulDeflect"), true, (HideFlags)52, val2, 802106481, true), "Deflect Gods", (TagType)0);
		comment = "-------------------------------------------------------------- Unit Bases --------------------------------------------------------------";
		Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Bastion_Base", (GameObject)SLMALoader.SDic["bases"]["Humanoid"], true, (HideFlags)52, val, 61644007, true), "Deflect Gods", (TagType)0);
		Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Godslayer_Base", (GameObject)SLMALoader.SDic["bases"]["Humanoid"], true, (HideFlags)52, val2, 61644008, true), "Deflect Gods", (TagType)0);
		comment = "-------------------------------------------------------------- Clothes --------------------------------------------------------------";
		Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Bastion_Helmet", Utility.LoadBundleGameObject("Bastion_Helmet"), true, (HideFlags)52, val, 38023503, true), "Deflect Gods", (TagType)0);
		Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("Bastion_Shoulder", Utility.LoadBundleGameObject("Bastion_Shoulder"), true, (HideFlags)52, val, 380355323, true), "Deflect Gods", (TagType)0);
		Utility.ItemCategorizer.SetTag(UPool.MyPool.AddObject("GodslayerHelmet", Utility.LoadBundleGameObject("GodslayerHelmet"), true, (HideFlags)52, val2, 38023504, 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<SwordTwirl>();
			MeshRenderer[] componentsInChildren = weapon.GetComponentsInChildren<MeshRenderer>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				TextureOffsetAnimation textureOffsetAnimation = ((Component)componentsInChildren[i]).gameObject.AddComponent<TextureOffsetAnimation>();
				textureOffsetAnimation.id = 3;
				textureOffsetAnimation.speed = 5f;
			}
		}
		if ((Object)(object)weapon == (Object)(object)UPool.MyPool.GetObject("BastionGate_Shield"))
		{
			Collider[] componentsInChildren2 = weapon.GetComponentsInChildren<Collider>();
			for (int j = 0; j < componentsInChildren2.Length; j++)
			{
				((Component)componentsInChildren2[j]).gameObject.AddComponent<SurfaceDeflect>();
			}
		}
	}

	public static void LoadBundle(string assetBundleName)
	{
		using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(assetBundleName);
		bundle = AssetBundle.LoadFromStream(stream);
	}

	public static void SetMoves(GameObject move, LandfallContentDatabase db)
	{
		if ((Object)(object)move == (Object)(object)UPool.MyPool.GetObject("Move_WitheredWings"))
		{
			SkinnedMeshRenderer[] componentsInChildren = move.GetComponentsInChildren<SkinnedMeshRenderer>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				TextureOffsetAnimation textureOffsetAnimation = ((Component)componentsInChildren[i]).gameObject.AddComponent<TextureOffsetAnimation>();
				textureOffsetAnimation.id = 0;
				textureOffsetAnimation.speed = 3f;
			}
		}
	}
}
[BepInPlugin("GeeztJeez.DeflectGods", "DeflectGods", "1.1.1")]
internal class Loader : BaseUnityPlugin
{
	private void Awake()
	{
		((MonoBehaviour)this).StartCoroutine("Call");
	}

	private IEnumerator Call()
	{
		yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)Object.FindObjectOfType<ServiceLocator>() != (Object)null));
		yield return (object)new WaitUntil((Func<bool>)(() => ServiceLocator.GetService<ISaveLoaderService>() != null));
		Debug.Log((object)"Loading DeflectGods.");
		SLMALoader.GetInstance();
		LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
		UManager.Init(landfallContentDatabase);
		SceneManager.sceneLoaded += SceneLoaded;
		new Harmony("DeflectGods").PatchAll();
		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)
	{
		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"));
		}
	}
}
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 SwordTwirl : MonoBehaviour
{
	private MeleeWeapon meleeWeapon;

	public void Update()
	{
		if (meleeWeapon.isSwinging)
		{
			float num = Random.Range(0f, 180f) * Time.timeScale;
			float num2 = Random.Range(0f, 180f) * Time.timeScale;
			float num3 = Random.Range(0f, 180f) * Time.timeScale;
			((Component)this).transform.Rotate(num, num2, num3, (Space)1);
		}
	}

	public void Start()
	{
		meleeWeapon = ((Component)this).gameObject.GetComponentInChildren<MeleeWeapon>();
	}
}
public class OnDeathRigidUnitbase : MonoBehaviour
{
	private Unit unit;

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

	public void Update()
	{
		if (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>();
	}
}