Decompiled source of LemurFusion v1.8.1

LemurFusion.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates.AI.Walker;
using HarmonyLib;
using IL.EntityStates.AI.Walker;
using IL.RoR2;
using KinematicCharacterController;
using LemurFusion;
using LemurFusion.Compat;
using LemurFusion.Config;
using LemurFusion.Devotion;
using LemurFusion.Devotion.Components;
using LemurianNames;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using Newtonsoft.Json.Utilities;
using On;
using On.RoR2;
using On.RoR2.Projectile;
using On.RoR2.UI;
using ProperSave;
using ProperSave.Data;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RiskyMod.Allies;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Projectile;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LemurFusion")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+7b65a918fcc7f779975a4f6de51a461f64ecaa50")]
[assembly: AssemblyProduct("LemurFusion")]
[assembly: AssemblyTitle("LemurFusion")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class BetterLemurController : DevotedLemurianController
{
	public BetterInventoryController BetterInventoryController => base._devotionInventoryController as BetterInventoryController;

	public Inventory LemurianInventory
	{
		get
		{
			if (!Object.op_Implicit((Object)(object)base._lemurianMaster))
			{
				return null;
			}
			return base._lemurianMaster.inventory;
		}
	}

	public CharacterBody LemurianBody
	{
		get
		{
			if (!Object.op_Implicit((Object)(object)base._lemurianMaster))
			{
				return null;
			}
			return base._lemurianMaster.GetBody();
		}
	}

	public Inventory PersonalInventory { get; set; }

	public void InitializeDevotedLemurian()
	{
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		base._leashDistSq = PluginConfig.teleportDistance.Value * PluginConfig.teleportDistance.Value;
		if (!Object.op_Implicit((Object)(object)PersonalInventory))
		{
			PersonalInventory = ((Component)base._lemurianMaster).GetComponents<Inventory>().Last();
		}
		if (Object.op_Implicit((Object)(object)LemurianInventory))
		{
			Inventory inventory = base._lemurianMaster.inventory;
			if (inventory.GetItemCount(Items.LemurianHarness) == 0)
			{
				inventory.AddItemsFrom(((DevotionInventoryController)BetterInventoryController)._devotionMinionInventory, ConfigExtended.Blacklist_Filter);
			}
			ShareItem(((DevotedLemurianController)this).DevotionItem);
			inventory.GiveItem(((DevotedLemurianController)this).DevotionItem, 1);
			inventory.GiveItem(Items.LemurianHarness.itemIndex, 1);
			inventory.ResetItem(Items.MinionLeash.itemIndex, 1);
			inventory.ResetItem(Items.UseAmbientLevel.itemIndex, 1);
			inventory.ResetItem(Items.TeleportWhenOob.itemIndex, 1);
			if (LemurFusionPlugin.riskyInstalled)
			{
				AddRiskyAllyItem();
			}
		}
	}

	public void ShareItem(ItemIndex item)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)PersonalInventory))
		{
			PersonalInventory.GiveItem(item, 1);
		}
		if (!PluginConfig.enableSharedInventory.Value)
		{
			return;
		}
		foreach (BetterLemurController friend in BetterInventoryController.GetFriends(this))
		{
			friend.LemurianInventory.GiveItem(item, 1);
		}
	}

	[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
	public void AddRiskyAllyItem()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		LemurianInventory.ResetItem(AllyItems.AllyMarkerItem.itemIndex, 1);
	}

	public void KillYourSelf()
	{
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Expected O, but got Unknown
		//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Expected O, but got Unknown
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Expected O, but got Unknown
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: 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_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		bool flag = DevotionTweaks.instance.EnableSharedInventory && Object.op_Implicit((Object)(object)BetterInventoryController);
		List<BetterLemurController> list = (flag ? BetterInventoryController.GetFriends() : new List<BetterLemurController>());
		if (Object.op_Implicit((Object)(object)PersonalInventory))
		{
			foreach (ItemIndex item in PersonalInventory.itemAcquisitionOrder.ToList())
			{
				int itemCount = PersonalInventory.GetItemCount(item);
				if (itemCount <= 0)
				{
					continue;
				}
				if (flag)
				{
					((DevotionInventoryController)BetterInventoryController).RemoveItem(item, Math.Min(itemCount, ((DevotionInventoryController)BetterInventoryController)._devotionMinionInventory.GetItemCount(item)));
					foreach (BetterLemurController item2 in list)
					{
						item2.LemurianInventory.RemoveItem(item, Math.Min(itemCount, item2.LemurianInventory.GetItemCount(item)));
					}
				}
				PickupIndex val = FindPickupIndex(item);
				if (val != PickupIndex.none)
				{
					int num = ((!ConfigExtended.DeathDrop_DropAll.Value) ? 1 : itemCount);
					for (int i = 0; i < num; i++)
					{
						PickupDropletController.CreatePickupDroplet(val, LemurianBody.corePosition, Vector2.op_Implicit(Random.insideUnitCircle * 15f));
					}
				}
			}
		}
		RaycastHit val2 = default(RaycastHit);
		if (ConfigExtended.DeathDrop_DropEgg.Value && Object.op_Implicit((Object)(object)LemurianBody) && Physics.Raycast(LemurianBody.corePosition, Vector3.down, ref val2, float.PositiveInfinity, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)))
		{
			DirectorPlacementRule val3 = new DirectorPlacementRule
			{
				placementMode = (PlacementMode)0,
				position = ((RaycastHit)(ref val2)).point
			};
			DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/CU8/LemurianEgg/iscLemurianEgg.asset").WaitForCompletion(), val3, new Xoroshiro128Plus(0uL)));
		}
		if (Object.op_Implicit((Object)(object)base._lemurianMaster))
		{
			Object.Destroy((Object)(object)((Component)base._lemurianMaster).gameObject, 1f);
		}
	}

	public PickupIndex FindPickupIndex(ItemIndex itemIndex)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Invalid comparison between Unknown and I4
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Expected I4, but got Unknown
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Invalid comparison between Unknown and I4
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		if ((int)itemIndex != -1 && Object.op_Implicit((Object)(object)LemurianBody))
		{
			switch (ConfigExtended.DeathDrop_ItemType.Value)
			{
			case DevotionTweaks.DeathItem.Scrap:
			{
				ItemTier tier = ItemCatalog.GetItemDef(itemIndex).tier;
				return (PickupIndex)((int)tier switch
				{
					0 => PickupCatalog.FindPickupIndex("ItemIndex.ScrapWhite"), 
					1 => PickupCatalog.FindPickupIndex("ItemIndex.ScrapGreen"), 
					2 => PickupCatalog.FindPickupIndex("ItemIndex.ScrapRed"), 
					4 => PickupCatalog.FindPickupIndex("ItemIndex.ScrapYellow"), 
					_ => PickupIndex.none, 
				});
			}
			case DevotionTweaks.DeathItem.Original:
				return PickupCatalog.FindPickupIndex(itemIndex);
			case DevotionTweaks.DeathItem.Custom:
			{
				ItemDef itemDef = ItemCatalog.GetItemDef(itemIndex);
				if (Object.op_Implicit((Object)(object)itemDef) && ConfigExtended.DeathDrops_TierToItem_Map.TryGetValue(itemDef.tier, out var value) && (int)value != -1)
				{
					return PickupCatalog.FindPickupIndex(value);
				}
				break;
			}
			}
		}
		return PickupIndex.none;
	}
}
namespace LemurFusion
{
	public static class FuckMyAss
	{
		public static bool FuckingNullCheckNetId(CharacterMaster master, out NetworkUserId netId)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			netId = default(NetworkUserId);
			MinionOwnership minionOwnership = master.minionOwnership;
			if (!Object.op_Implicit((Object)(object)minionOwnership))
			{
				return false;
			}
			CharacterMaster ownerMaster = minionOwnership.ownerMaster;
			if (!Object.op_Implicit((Object)(object)ownerMaster))
			{
				return false;
			}
			PlayerCharacterMasterController playerCharacterMasterController = ownerMaster.playerCharacterMasterController;
			if (!Object.op_Implicit((Object)(object)playerCharacterMasterController))
			{
				return false;
			}
			NetworkUser networkUser = playerCharacterMasterController.networkUser;
			if (!Object.op_Implicit((Object)(object)networkUser))
			{
				return false;
			}
			netId = networkUser.id;
			return true;
		}

		public static bool FuckingNullCheckPing(CharacterMaster master, out GameObject target)
		{
			target = null;
			if (!Object.op_Implicit((Object)(object)master))
			{
				return false;
			}
			MinionOwnership minionOwnership = master.minionOwnership;
			if (!Object.op_Implicit((Object)(object)minionOwnership))
			{
				return false;
			}
			CharacterMaster ownerMaster = minionOwnership.ownerMaster;
			if (!Object.op_Implicit((Object)(object)ownerMaster))
			{
				return false;
			}
			PlayerCharacterMasterController playerCharacterMasterController = ownerMaster.playerCharacterMasterController;
			if (!Object.op_Implicit((Object)(object)playerCharacterMasterController))
			{
				return false;
			}
			PingerController pingerController = playerCharacterMasterController.pingerController;
			if (!Object.op_Implicit((Object)(object)pingerController))
			{
				return false;
			}
			target = ((PingInfo)(ref pingerController.currentPing)).targetGameObject;
			if (pingerController.currentPing.active)
			{
				return Object.op_Implicit((Object)(object)target);
			}
			return false;
		}

		public static bool FuckingNullCheckHurtBox(HurtBox hurtBox, out CharacterBody body, out Vector3 position)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			body = null;
			position = Vector3.zero;
			if (!Object.op_Implicit((Object)(object)hurtBox))
			{
				return false;
			}
			HealthComponent healthComponent = hurtBox.healthComponent;
			if (!Object.op_Implicit((Object)(object)healthComponent))
			{
				return false;
			}
			body = healthComponent.body;
			if (!Object.op_Implicit((Object)(object)body))
			{
				return false;
			}
			position = ((Component)hurtBox).transform.position;
			if (Object.op_Implicit((Object)(object)body.characterMotor))
			{
				return !body.hasCloakBuff;
			}
			return false;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.score.LemurFusion", "LemurFusion", "1.8.1")]
	public class LemurFusionPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.score.LemurFusion";

		public const string PluginName = "LemurFusion";

		public const string PluginVersion = "1.8.1";

		private static ManualLogSource _logger;

		public static LemurFusionPlugin instance { get; private set; }

		public static bool rooInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");

		public static bool lemNamesInstalled => Chainloader.PluginInfos.ContainsKey("bouncyshield.LemurianNames");

		public static bool properSaveInstalled => Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.ProperSave");

		public static bool riskyInstalled => Chainloader.PluginInfos.ContainsKey("com.RiskyLives.RiskyMod");

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public void Awake()
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			instance = this;
			_logger = ((BaseUnityPlugin)this).Logger;
			PluginConfig.myConfig = ((BaseUnityPlugin)this).Config;
			ConfigReader.Init();
			DevotionTweaks.Init();
			DevotedInventoryTweaks.Init();
			LemurControllerTweaks.Init();
			AITweaks.Init();
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(MechaLemur.Init));
			ContentAddition.AddMaster(DevotionTweaks.instance.bruiserMasterPrefab);
			Harmony harmony = new Harmony("com.score.LemurFusion");
			if (lemNamesInstalled)
			{
				CreateLemNameCompat(harmony);
			}
			if (properSaveInstalled)
			{
				CreateProperSaveCompat(harmony);
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void CreateLemNameCompat(Harmony harmony)
		{
			harmony.CreateClassProcessor(typeof(LemurianUpdateNameFriend)).Patch();
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void CreateProperSaveCompat(Harmony harmony)
		{
			harmony.CreateClassProcessor(typeof(FixProperSave)).Patch();
			ProperSaveManager.Init();
		}

		public static void LogDebug(string message)
		{
		}

		public static void LogInfo(string message)
		{
			Log((LogLevel)16, message);
		}

		public static void LogMessage(string message)
		{
			Log((LogLevel)8, message);
		}

		public static void LogWarning(string message)
		{
			Log((LogLevel)4, message);
		}

		public static void LogError(string message)
		{
			Log((LogLevel)2, message);
		}

		public static void LogFatal(string message)
		{
			Log((LogLevel)1, message);
		}

		public static void Log(LogLevel logLevel, string message)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (PluginConfig.enableDetailedLogs.Value)
			{
				_logger.Log(logLevel, (object)message);
			}
		}
	}
	public static class Utils
	{
		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsDevoted(CharacterBody body)
		{
			if (Object.op_Implicit((Object)(object)body))
			{
				return IsDevoted(body.master);
			}
			return false;
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		public static bool IsDevoted(CharacterMaster master)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between Unknown and I4
			BetterLemurController betterLemurController = default(BetterLemurController);
			if (Object.op_Implicit((Object)(object)master) && (int)master.teamIndex == 1 && master.hasBody && ((Component)master).TryGetComponent<BetterLemurController>(ref betterLemurController))
			{
				return Object.op_Implicit((Object)(object)betterLemurController.LemurianInventory);
			}
			return false;
		}

		public static void ResetItem(this Inventory self, ItemIndex itemIndex, int count)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (count == 0)
			{
				self.itemAcquisitionOrder.Remove(itemIndex);
				self.ResetItem(itemIndex);
			}
			else
			{
				if ((long)(ulong)itemIndex >= (long)self.itemStacks.Length)
				{
					return;
				}
				ref int reference = ref self.itemStacks[itemIndex];
				if (reference != count)
				{
					if (reference == 0)
					{
						self.itemAcquisitionOrder.Add(itemIndex);
						((NetworkBehaviour)self).SetDirtyBit(8u);
					}
					reference = count;
					((NetworkBehaviour)self).SetDirtyBit(1u);
					self.HandleInventoryChanged();
				}
			}
		}

		public static float GetVanillaStatModifier(int configValue, int meldCount, int evolutionCount)
		{
			int num;
			switch (evolutionCount)
			{
			case 0:
			case 2:
				num = 10;
				break;
			case 1:
				num = 20;
				break;
			default:
				num = 17 + evolutionCount;
				break;
			}
			int num2 = num;
			return (float)meldCount * ((float)configValue * 0.01f) + (float)num2 * 0.1f;
		}

		public static float GetFusionStatMultiplier(int configValue, int meldCount, int evolutionCount)
		{
			int num = Mathf.Clamp(evolutionCount, 0, 4);
			float num2 = (float)PluginConfig.statMultEvo.Value * 0.01f;
			return (float)meldCount * ((float)configValue * 0.01f) + (float)num * num2 * 0.1f;
		}

		public static float GetLevelModifier(int evolutionCount)
		{
			if (!Object.op_Implicit((Object)(object)Run.instance))
			{
				return 0f;
			}
			int num = Mathf.Clamp(Run.instance.stageClearCount + 1, 1, 4);
			int num2 = Mathf.Clamp(evolutionCount, 0, 4);
			float num3 = (float)PluginConfig.statMultEvo.Value * 0.01f;
			return (float)num * num3 + (float)num2 * num3;
		}

		public static Vector3 ClosestPointOnCollider(Collider collider, Vector3 worldPoint, out float distance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = collider.ClosestPoint(worldPoint);
			Vector3 val2 = val - worldPoint;
			if (((Vector3)(ref val2)).sqrMagnitude < 0.001f)
			{
				return ClosestPointOnTransform(((Component)collider).transform, worldPoint, out distance);
			}
			val2 = val - worldPoint;
			distance = ((Vector3)(ref val2)).sqrMagnitude;
			return val;
		}

		public static Vector3 ClosestPointOnTransform(Transform transform, Vector3 worldPoint, out float distance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			Vector3 otherPoint = transform.InverseTransformPoint(worldPoint);
			Vector3 val = transform.TransformPoint(ClosestPointOnBounds(Vector3.zero, Vector3.one, otherPoint, out distance));
			float num = Mathf.Sign(distance);
			Vector3 val2 = val - worldPoint;
			distance = num * ((Vector3)(ref val2)).sqrMagnitude;
			return val;
		}

		public static Vector3 ClosestPointOnBounds(Vector3 position, Vector3 size, Vector3 otherPoint, out float distance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			Bounds bounds = default(Bounds);
			((Bounds)(ref bounds))..ctor(position, size);
			Vector3 val;
			Vector3 val2;
			if (((Bounds)(ref bounds)).Contains(otherPoint))
			{
				val = bounds.ClosestPointInternal(otherPoint);
				val2 = val - otherPoint;
				distance = 0f - ((Vector3)(ref val2)).sqrMagnitude;
			}
			else
			{
				val = ((Bounds)(ref bounds)).ClosestPoint(otherPoint);
				val2 = val - otherPoint;
				distance = ((Vector3)(ref val2)).sqrMagnitude;
			}
			return val;
		}

		public static Vector3 ClosestPointInternal(this ref Bounds bounds, Vector3 localPoint)
		{
			//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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_003d: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: 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_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			Vector3 max = ((Bounds)(ref bounds)).max;
			Vector3 min = ((Bounds)(ref bounds)).min;
			Plane val = default(Plane);
			((Plane)(ref val))..ctor(Vector3.right, max.x);
			Vector3 val2 = ((Plane)(ref val)).ClosestPointOnPlane(localPoint);
			Vector3 val3 = val2 - localPoint;
			float num = ((Vector3)(ref val3)).sqrMagnitude;
			((Plane)(ref val)).distance = min.x;
			Vector3 val4 = ((Plane)(ref val)).ClosestPointOnPlane(localPoint);
			val3 = val4 - localPoint;
			float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
			if (sqrMagnitude < num)
			{
				num = sqrMagnitude;
				val2 = val4;
			}
			((Plane)(ref val)).distance = max.y;
			((Plane)(ref val)).normal = Vector3.up;
			val4 = ((Plane)(ref val)).ClosestPointOnPlane(localPoint);
			val3 = val4 - localPoint;
			sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
			if (sqrMagnitude < num)
			{
				num = sqrMagnitude;
				val2 = val4;
			}
			((Plane)(ref val)).distance = min.y;
			val4 = ((Plane)(ref val)).ClosestPointOnPlane(localPoint);
			val3 = val4 - localPoint;
			sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
			if (sqrMagnitude < num)
			{
				num = sqrMagnitude;
				val2 = val4;
			}
			((Plane)(ref val)).distance = max.z;
			((Plane)(ref val)).normal = Vector3.forward;
			val4 = ((Plane)(ref val)).ClosestPointOnPlane(localPoint);
			val3 = val4 - localPoint;
			sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
			if (sqrMagnitude < num)
			{
				num = sqrMagnitude;
				val2 = val4;
			}
			((Plane)(ref val)).distance = min.z;
			val4 = ((Plane)(ref val)).ClosestPointOnPlane(localPoint);
			val3 = val4 - localPoint;
			sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
			if (sqrMagnitude < num)
			{
				num = sqrMagnitude;
				val2 = val4;
			}
			return Vector3.MoveTowards(localPoint, val2, 0f - num);
		}

		public static T GetOrAddComponent<T>(this GameObject go) where T : Component
		{
			T component = go.GetComponent<T>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return go.AddComponent<T>();
			}
			return component;
		}

		public static T GetOrAddComponent<T>(this Component c) where T : Component
		{
			T component = c.GetComponent<T>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return c.gameObject.AddComponent<T>();
			}
			return component;
		}
	}
}
namespace LemurFusion.Devotion
{
	public class AITweaks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__Combat_UpdateAI;
		}

		public static ConfigEntry<bool> disableFallDamage;

		public static ConfigEntry<bool> immuneToVoidDeath;

		public static ConfigEntry<bool> improveAI;

		public static ConfigEntry<bool> enableProjectileTracking;

		public static ConfigEntry<bool> visualizeProjectileTracking;

		public static ConfigEntry<float> updateFrequency;

		public static ConfigEntry<int> detectionRadius;

		public const string SKILL_STRAFE_NAME = "StrafeAroundExplosion";

		public const string SKILL_ESCAPE_NAME = "BackUpFromExplosion";

		public static AITweaks instance { get; private set; }

		public static void Init()
		{
			if (instance == null)
			{
				instance = new AITweaks();
			}
		}

		private AITweaks()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			if (!improveAI.Value)
			{
				return;
			}
			object obj = <>O.<0>__Combat_UpdateAI;
			if (obj == null)
			{
				Manipulator val = Combat_UpdateAI;
				<>O.<0>__Combat_UpdateAI = val;
				obj = (object)val;
			}
			Combat.UpdateAI += (Manipulator)obj;
			LemHitboxGroupRevealer.Init();
			GameObject masterPrefab = DevotionTweaks.instance.masterPrefab;
			masterPrefab.AddComponent<MatrixDodgingController>();
			masterPrefab.AddComponent<LineRenderer>();
			BaseAI component = masterPrefab.GetComponent<BaseAI>();
			component.fullVision = true;
			component.aimVectorDampTime = 0.05f;
			component.aimVectorMaxSpeed = 200f;
			AISkillDriver obj2 = masterPrefab.AddComponent<AISkillDriver>();
			obj2.customName = "BackUpFromExplosion";
			obj2.skillSlot = (SkillSlot)0;
			obj2.maxDistance = (float)detectionRadius.Value * 0.5f;
			obj2.minDistance = 0f;
			obj2.aimType = (AimType)2;
			obj2.moveTargetType = (TargetType)3;
			obj2.movementType = (MovementType)3;
			obj2.ignoreNodeGraph = true;
			obj2.shouldSprint = true;
			obj2.driverUpdateTimerOverride = Mathf.Clamp(updateFrequency.Value * 1.5f, 0.3f, 1f);
			AISkillDriver obj3 = masterPrefab.AddComponent<AISkillDriver>();
			obj3.customName = "StrafeAroundExplosion";
			obj3.skillSlot = (SkillSlot)0;
			obj3.maxDistance = detectionRadius.Value;
			obj3.minDistance = (float)detectionRadius.Value * 0.5f;
			obj3.aimType = (AimType)2;
			obj3.moveTargetType = (TargetType)3;
			obj3.movementType = (MovementType)2;
			obj3.ignoreNodeGraph = true;
			obj3.shouldSprint = true;
			obj3.driverUpdateTimerOverride = Mathf.Clamp(updateFrequency.Value * 1.5f, 0.3f, 1f);
			AISkillDriver[] components = masterPrefab.GetComponents<AISkillDriver>();
			foreach (AISkillDriver val2 in components)
			{
				switch (val2.customName)
				{
				case "DevotedSecondarySkill":
					val2.minUserHealthFraction = 0.6f;
					val2.shouldSprint = false;
					val2.activationRequiresAimConfirmation = true;
					val2.maxDistance = 10f;
					break;
				case "StrafeAndShoot":
					val2.maxDistance = 100f;
					val2.activationRequiresAimTargetLoS = true;
					val2.shouldSprint = false;
					break;
				case "ReturnToLeaderDefault":
					val2.driverUpdateTimerOverride = 0.2f;
					val2.shouldSprint = true;
					val2.resetCurrentEnemyOnNextDriverSelection = true;
					break;
				case "WaitNearLeaderDefault":
					val2.driverUpdateTimerOverride = 0.2f;
					val2.resetCurrentEnemyOnNextDriverSelection = true;
					break;
				case "StrafeNearbyEnemies":
					val2.shouldSprint = true;
					break;
				}
			}
		}

		private static void Combat_UpdateAI(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[2]
			{
				(Instruction i) => ILPatternMatchingExt.MatchLdcI4(i, 0),
				(Instruction i) => ILPatternMatchingExt.MatchStloc(i, 13)
			}))
			{
				val.Emit(OpCodes.Ldloc, 12);
				val.Emit(OpCodes.Ldloc, 15);
				val.Emit(OpCodes.Ldarg_0);
				val.Emit<Combat>(OpCodes.Ldfld, "dominantSkillDriver");
				val.EmitDelegate<Func<Vector3, Vector3, AISkillDriver, Vector3>>((Func<Vector3, Vector3, AISkillDriver, Vector3>)((Vector3 position, Vector3 fleeDirection, AISkillDriver skillDriver) => (Object.op_Implicit((Object)(object)skillDriver) && (skillDriver.customName == "StrafeAroundExplosion" || skillDriver.customName == "StrafeNearbyEnemies")) ? (position - fleeDirection * 0.5f) : position));
				val.Emit(OpCodes.Stloc, 12);
			}
			else
			{
				LemurFusionPlugin.LogError("EntityStates.AI.Walker.Combat.UpdateAI IL Hook failed");
			}
		}
	}
	public class DevotedInventoryTweaks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__EvolveDevotedLumerian;

			public static hook_Init <1>__DevotionInventoryController_Init;

			public static Func<Func<bool>, bool> <2>__DevotionInventoryController_isDevotionEnable;

			public static ArtifactStateChangeDelegate <3>__OnDevotionArtifactDisabled;
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Action<Run> <>9__6_0;

			public static ArtifactStateChangeDelegate <>9__6_1;

			public static Func<Instruction, bool> <>9__8_0;

			public static Func<Instruction, bool> <>9__8_1;

			public static Action<DevotedLemurianController> <>9__8_2;

			internal void <DevotionInventoryController_Init>b__6_0(Run _)
			{
				BetterInventoryController.OnRunStartGlobal();
			}

			internal void <DevotionInventoryController_Init>b__6_1(RunArtifactManager _, ArtifactDef _)
			{
				BetterInventoryController.OnRunStartGlobal();
			}

			internal bool <EvolveDevotedLumerian>b__8_0(Instruction i)
			{
				return ILPatternMatchingExt.MatchLdstr(i, "shouldn't evolve!");
			}

			internal bool <EvolveDevotedLumerian>b__8_1(Instruction i)
			{
				return ILPatternMatchingExt.MatchCall<Debug>(i, "LogError");
			}

			internal void <EvolveDevotedLumerian>b__8_2(DevotedLemurianController lem)
			{
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				List<EquipmentIndex> list = (PluginConfig.highTierElitesOnly.Value ? BetterInventoryController.gigaChadLvl : DevotionInventoryController.highLevelEliteBuffs);
				int index = Random.Range(0, list.Count);
				lem.LemurianInventory.SetEquipmentIndex(list[index]);
			}
		}

		public static DevotedInventoryTweaks instance { get; private set; }

		public static void Init()
		{
			if (instance == null)
			{
				instance = new DevotedInventoryTweaks();
			}
		}

		private DevotedInventoryTweaks()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			object obj = <>O.<0>__EvolveDevotedLumerian;
			if (obj == null)
			{
				Manipulator val = EvolveDevotedLumerian;
				<>O.<0>__EvolveDevotedLumerian = val;
				obj = (object)val;
			}
			DevotionInventoryController.EvolveDevotedLumerian += (Manipulator)obj;
			object obj2 = <>O.<1>__DevotionInventoryController_Init;
			if (obj2 == null)
			{
				hook_Init val2 = DevotionInventoryController_Init;
				<>O.<1>__DevotionInventoryController_Init = val2;
				obj2 = (object)val2;
			}
			DevotionInventoryController.Init += (hook_Init)obj2;
			DevotionInventoryController.UpdateMinionInventory += new hook_UpdateMinionInventory(UpdateMinionInventory);
			DevotionInventoryController.UpdateAllMinions += new hook_UpdateAllMinions(UpdateAllMinions);
			new Hook((MethodBase)AccessTools.PropertyGetter(typeof(DevotionInventoryController), "isDevotionEnable"), (Delegate)new Func<Func<bool>, bool>(DevotionInventoryController_isDevotionEnable));
		}

		private static void DevotionInventoryController_Init(orig_Init orig)
		{
			//IL_0038: 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_0043: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			Run.onRunStartGlobal += delegate
			{
				BetterInventoryController.OnRunStartGlobal();
			};
			object obj = <>c.<>9__6_1;
			if (obj == null)
			{
				ArtifactStateChangeDelegate val = delegate
				{
					BetterInventoryController.OnRunStartGlobal();
				};
				<>c.<>9__6_1 = val;
				obj = (object)val;
			}
			RunArtifactManager.onArtifactEnabledGlobal += (ArtifactStateChangeDelegate)obj;
			object obj2 = <>O.<3>__OnDevotionArtifactDisabled;
			if (obj2 == null)
			{
				ArtifactStateChangeDelegate val2 = BetterInventoryController.OnDevotionArtifactDisabled;
				<>O.<3>__OnDevotionArtifactDisabled = val2;
				obj2 = (object)val2;
			}
			RunArtifactManager.onArtifactDisabledGlobal += (ArtifactStateChangeDelegate)obj2;
		}

		private static bool DevotionInventoryController_isDevotionEnable(Func<bool> orig)
		{
			if (!PluginConfig.permaDevotion.Value)
			{
				return orig();
			}
			return true;
		}

		private static void EvolveDevotedLumerian(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)1, new Func<Instruction, bool>[2]
			{
				(Instruction i) => ILPatternMatchingExt.MatchLdstr(i, "shouldn't evolve!"),
				(Instruction i) => ILPatternMatchingExt.MatchCall<Debug>(i, "LogError")
			}))
			{
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Action<DevotedLemurianController>>((Action<DevotedLemurianController>)delegate(DevotedLemurianController lem)
				{
					//IL_002e: Unknown result type (might be due to invalid IL or missing references)
					List<EquipmentIndex> list = (PluginConfig.highTierElitesOnly.Value ? BetterInventoryController.gigaChadLvl : DevotionInventoryController.highLevelEliteBuffs);
					int index = Random.Range(0, list.Count);
					lem.LemurianInventory.SetEquipmentIndex(list[index]);
				});
				val.RemoveRange(2);
			}
			else
			{
				LemurFusionPlugin.LogError("Hook failed for DevotionInventoryController_EvolveDevotedLumerian #2");
			}
		}

		private void UpdateAllMinions(orig_UpdateAllMinions orig, DevotionInventoryController self, bool shouldEvolve)
		{
			if (shouldEvolve)
			{
				orig.Invoke(self, shouldEvolve);
			}
		}

		private void UpdateMinionInventory(orig_UpdateMinionInventory orig, DevotionInventoryController self, DevotedLemurianController lem, bool shouldEvolve)
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !(lem is BetterLemurController betterLemurController) || !Object.op_Implicit((Object)(object)betterLemurController) || !Object.op_Implicit((Object)(object)((DevotedLemurianController)betterLemurController)._lemurianMaster))
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)betterLemurController.PersonalInventory))
			{
				foreach (ItemIndex item in betterLemurController.PersonalInventory.itemAcquisitionOrder.ToList())
				{
					if (Object.op_Implicit((Object)(object)betterLemurController.BetterInventoryController))
					{
						((DevotionInventoryController)betterLemurController.BetterInventoryController).GiveItem(item, 1);
					}
					if (Object.op_Implicit((Object)(object)betterLemurController.LemurianInventory))
					{
						betterLemurController.LemurianInventory.GiveItem(item, 1);
					}
					betterLemurController.ShareItem(item);
				}
			}
			if (Object.op_Implicit((Object)(object)DevotionInventoryController.activationSoundEventDef))
			{
				EffectManager.SimpleSoundEffect(DevotionInventoryController.activationSoundEventDef.index, betterLemurController.LemurianBody.transform.position, true);
			}
			int devotedEvolutionLevel = ((DevotedLemurianController)betterLemurController).DevotedEvolutionLevel;
			((DevotedLemurianController)betterLemurController).DevotedEvolutionLevel = devotedEvolutionLevel + 1;
			self.EvolveDevotedLumerian((DevotedLemurianController)(object)betterLemurController);
		}
	}
	public class DevotionTweaks
	{
		public enum DeathItem
		{
			None,
			Scrap,
			Original,
			Custom
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__PopulateScene;

			public static hook_DefaultFilterCallbackImplementation <1>__BulletAttack_DefaultFilterCallbackImplementation;

			public static hook_IgnoreCollisionsWithOwner <2>__ProjectileController_IgnoreCollisionsWithOwner;
		}

		public GameObject masterPrefab;

		public GameObject bruiserMasterPrefab;

		public GameObject bodyPrefab;

		public GameObject bigBodyPrefab;

		public const string devotedPrefix = "Devoted";

		public const string devotedMasterName = "DevotedLemurianMaster";

		public const string devotedBruiserMasterName = "DevotedLemurianBruiserMaster";

		public const string devotedLemBodyName = "DevotedLemurianBody";

		public const string devotedBigLemBodyName = "DevotedLemurianBruiserBody";

		public readonly bool EnableSharedInventory;

		public static DevotionTweaks instance { get; private set; }

		public static void Init()
		{
			if (instance == null)
			{
				instance = new DevotionTweaks();
			}
		}

		private DevotionTweaks()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			EnableSharedInventory = PluginConfig.enableSharedInventory.Value;
			LoadAssets();
			if (ConfigExtended.Blacklist_Enable.Value)
			{
				PickupPickerController.SetOptionsFromInteractor += new hook_SetOptionsFromInteractor(PickupPickerController_SetOptionsFromInteractor);
			}
			object obj = <>O.<0>__PopulateScene;
			if (obj == null)
			{
				Manipulator val = PopulateScene;
				<>O.<0>__PopulateScene = val;
				obj = (object)val;
			}
			SceneDirector.PopulateScene += (Manipulator)obj;
			if (PluginConfig.disableTeamCollision.Value)
			{
				object obj2 = <>O.<1>__BulletAttack_DefaultFilterCallbackImplementation;
				if (obj2 == null)
				{
					hook_DefaultFilterCallbackImplementation val2 = BulletAttack_DefaultFilterCallbackImplementation;
					<>O.<1>__BulletAttack_DefaultFilterCallbackImplementation = val2;
					obj2 = (object)val2;
				}
				BulletAttack.DefaultFilterCallbackImplementation += (hook_DefaultFilterCallbackImplementation)obj2;
				object obj3 = <>O.<2>__ProjectileController_IgnoreCollisionsWithOwner;
				if (obj3 == null)
				{
					hook_IgnoreCollisionsWithOwner val3 = ProjectileController_IgnoreCollisionsWithOwner;
					<>O.<2>__ProjectileController_IgnoreCollisionsWithOwner = val3;
					obj3 = (object)val3;
				}
				ProjectileController.IgnoreCollisionsWithOwner += (hook_IgnoreCollisionsWithOwner)obj3;
			}
		}

		private static bool BulletAttack_DefaultFilterCallbackImplementation(orig_DefaultFilterCallbackImplementation orig, BulletAttack bulletAttack, ref BulletHit hitInfo)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Invalid comparison between Unknown and I4
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			if (orig.Invoke(bulletAttack, ref hitInfo))
			{
				TeamComponent val = default(TeamComponent);
				if (Object.op_Implicit((Object)(object)hitInfo.hitHurtBox) && Object.op_Implicit((Object)(object)hitInfo.hitHurtBox.healthComponent) && Object.op_Implicit((Object)(object)bulletAttack.owner) && bulletAttack.owner.TryGetComponent<TeamComponent>(ref val) && (int)val.teamIndex == 1)
				{
					return FriendlyFireManager.ShouldDirectHitProceed(hitInfo.hitHurtBox.healthComponent, val.teamIndex);
				}
				return true;
			}
			return false;
		}

		private static void ProjectileController_IgnoreCollisionsWithOwner(orig_IgnoreCollisionsWithOwner orig, ProjectileController self, bool shouldIgnore)
		{
			//IL_000b: 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: Invalid comparison between Unknown and I4
			orig.Invoke(self, shouldIgnore);
			if (!shouldIgnore || (int)FriendlyFireManager.friendlyFireMode != 0 || (int)self.teamFilter.teamIndex != 1 || self.myColliders.Length == 0 || !Object.op_Implicit((Object)(object)self.owner))
			{
				return;
			}
			foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)1))
			{
				if (!Utils.IsDevoted(teamMember.body) || !Object.op_Implicit((Object)(object)teamMember.body.hurtBoxGroup) || !((Object)(object)((Component)teamMember).gameObject != (Object)(object)self.owner))
				{
					continue;
				}
				HurtBox[] hurtBoxes = teamMember.body.hurtBoxGroup.hurtBoxes;
				for (int i = 0; i < hurtBoxes.Length; i++)
				{
					for (int j = 0; j < self.myColliders.Length; j++)
					{
						Physics.IgnoreCollision(hurtBoxes[i].collider, self.myColliders[j], shouldIgnore);
					}
				}
			}
		}

		private void LoadAssets()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			bodyPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/CU8/DevotedLemurianBody.prefab").WaitForCompletion();
			CharacterBody component = bodyPrefab.GetComponent<CharacterBody>();
			component.bodyFlags = (BodyFlags)(component.bodyFlags | 0xA002);
			component.baseMaxHealth = 360f;
			component.levelMaxHealth = 11f;
			component.baseMoveSpeed = 7f;
			bigBodyPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/CU8/DevotedLemurianBruiserBody.prefab").WaitForCompletion();
			CharacterBody component2 = bigBodyPrefab.GetComponent<CharacterBody>();
			component2.bodyFlags = (BodyFlags)(component2.bodyFlags | 0xA002);
			component2.baseMaxHealth = 720f;
			component2.levelMaxHealth = 22f;
			component2.baseMoveSpeed = 10f;
			GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/DevotionMinionInventory");
			Object.DestroyImmediate((Object)(object)val.GetComponent<DevotionInventoryController>());
			((DevotionInventoryController)val.AddComponent<BetterInventoryController>()).sfxLocator = val.GetComponent<SfxLocator>();
			DevotionInventoryController.s_effectPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/OrbEffects/ItemTakenOrbEffect");
			LegacyResourcesAPI.LoadAsyncCallback<NetworkSoundEventDef>("NetworkSoundEventDefs/nseNullifiedBuffApplied", (Action<NetworkSoundEventDef>)delegate(NetworkSoundEventDef asset)
			{
				DevotionInventoryController.activationSoundEventDef = asset;
			});
			masterPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/CU8/LemurianEgg/DevotedLemurianMaster.prefab").WaitForCompletion();
			Object.DestroyImmediate((Object)(object)masterPrefab.GetComponent<DevotedLemurianController>());
			masterPrefab.AddComponent<BetterLemurController>();
			masterPrefab.AddComponent<Inventory>();
			masterPrefab.GetComponent<CharacterMaster>().bodyPrefab = bodyPrefab;
			bruiserMasterPrefab = PrefabAPI.InstantiateClone(masterPrefab, "DevotedLemurianBruiserMaster", true);
			bruiserMasterPrefab.GetComponent<CharacterMaster>().bodyPrefab = bigBodyPrefab;
			ItemDef val2 = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/CU8/Harness/LemurianHarness.asset").WaitForCompletion();
			List<ItemTag> list = new List<ItemTag>();
			list.AddRange(val2.tags.Concat(new <>z__ReadOnlyArray<ItemTag>((ItemTag[])(object)new ItemTag[2]
			{
				(ItemTag)11,
				(ItemTag)12
			})).Distinct());
			val2.tags = list.ToArray();
		}

		private void PickupPickerController_SetOptionsFromInteractor(orig_SetOptionsFromInteractor orig, PickupPickerController self, Interactor activator)
		{
			//IL_0050: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody val = default(CharacterBody);
			if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<LemurianEggController>()) || !Object.op_Implicit((Object)(object)activator) || !((Component)activator).TryGetComponent<CharacterBody>(ref val) || !Object.op_Implicit((Object)(object)val.inventory))
			{
				orig.Invoke(self, activator);
				return;
			}
			List<Option> list = new List<Option>();
			foreach (ItemIndex item in val.inventory.itemAcquisitionOrder)
			{
				if (ConfigExtended.Blacklist_Filter(item))
				{
					PickupIndex val2 = PickupCatalog.FindPickupIndex(item);
					if (val2 != PickupIndex.none)
					{
						list.Add(new Option
						{
							available = true,
							pickupIndex = val2
						});
					}
				}
			}
			self.SetOptionsServer(list.ToArray());
		}

		public CharacterMaster MasterSummon_Perform(orig_Perform orig, MasterSummon self)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody val = default(CharacterBody);
			if (Object.op_Implicit((Object)(object)self.masterPrefab) && (Object)(object)self.masterPrefab == (Object)(object)masterPrefab && Object.op_Implicit((Object)(object)self.summonerBodyObject) && self.summonerBodyObject.TryGetComponent<CharacterBody>(ref val) && val.isPlayerControlled)
			{
				CharacterMaster val2 = null;
				int num = int.MaxValue;
				int num2 = 0;
				MinionGroup val3 = MinionGroup.FindGroup(val.masterObjectId);
				if (val3 != null)
				{
					MinionOwnership[] members = val3.members;
					BetterLemurController betterLemurController = default(BetterLemurController);
					foreach (MinionOwnership val4 in members)
					{
						if (Object.op_Implicit((Object)(object)val4) && ((Component)val4).TryGetComponent<BetterLemurController>(ref betterLemurController) && Object.op_Implicit((Object)(object)betterLemurController.LemurianInventory))
						{
							num2++;
							int itemCount = betterLemurController.LemurianInventory.GetItemCount(Items.LemurianHarness);
							if (itemCount < num)
							{
								num = itemCount;
								val2 = ((DevotedLemurianController)betterLemurController)._lemurianMaster;
							}
						}
					}
				}
				if (Object.op_Implicit((Object)(object)val2) && num2 >= PluginConfig.maxLemurs.Value)
				{
					return val2;
				}
			}
			return orig.Invoke(self);
		}

		private static void PopulateScene(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction i) => ILPatternMatchingExt.MatchCall<RunArtifactManager>(i, "get_instance"),
				(Instruction i) => ILPatternMatchingExt.MatchLdsfld(i, "RoR2.CU8Content/Artifacts", "Devotion"),
				(Instruction i) => ILPatternMatchingExt.MatchCallvirt<RunArtifactManager>(i, "IsArtifactEnabled")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<bool, SceneDirector, bool>>((Func<bool, SceneDirector, bool>)((bool isArtifactEnabled, SceneDirector self) => (PluginConfig.permaDevotion.Value || isArtifactEnabled) && self.rng.RangeInt(0, 100) < PluginConfig.eggSpawnChance.Value));
			}
			else
			{
				LemurFusionPlugin.LogError("IL Hook failed for SceneDirector_PopulateScene");
			}
		}
	}
	internal class LemurControllerTweaks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_InitializeDevotedLemurian <0>__DevotedLemurianController_InitializeDevotedLemurian;

			public static hook_OnDevotedBodyDead <1>__DevotedLemurianController_OnDevotedBodyDead;
		}

		public static LemurControllerTweaks Instance { get; private set; }

		public static void Init()
		{
			if (Instance == null)
			{
				Instance = new LemurControllerTweaks();
			}
		}

		private LemurControllerTweaks()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			object obj = <>O.<0>__DevotedLemurianController_InitializeDevotedLemurian;
			if (obj == null)
			{
				hook_InitializeDevotedLemurian val = DevotedLemurianController_InitializeDevotedLemurian;
				<>O.<0>__DevotedLemurianController_InitializeDevotedLemurian = val;
				obj = (object)val;
			}
			DevotedLemurianController.InitializeDevotedLemurian += (hook_InitializeDevotedLemurian)obj;
			object obj2 = <>O.<1>__DevotedLemurianController_OnDevotedBodyDead;
			if (obj2 == null)
			{
				hook_OnDevotedBodyDead val2 = DevotedLemurianController_OnDevotedBodyDead;
				<>O.<1>__DevotedLemurianController_OnDevotedBodyDead = val2;
				obj2 = (object)val2;
			}
			DevotedLemurianController.OnDevotedBodyDead += (hook_OnDevotedBodyDead)obj2;
		}

		private static void DevotedLemurianController_InitializeDevotedLemurian(orig_InitializeDevotedLemurian orig, DevotedLemurianController self, ItemIndex itemIndex, DevotionInventoryController devInvCtrl)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, itemIndex, devInvCtrl);
			if (self is BetterLemurController betterLemurController && Object.op_Implicit((Object)(object)betterLemurController))
			{
				betterLemurController.InitializeDevotedLemurian();
			}
		}

		private static void DevotedLemurianController_OnDevotedBodyDead(orig_OnDevotedBodyDead orig, DevotedLemurianController self)
		{
			if (self is BetterLemurController betterLemurController && Object.op_Implicit((Object)(object)betterLemurController) && Object.op_Implicit((Object)(object)((DevotedLemurianController)betterLemurController)._lemurianMaster) && !((MonoBehaviour)((DevotedLemurianController)betterLemurController)._lemurianMaster).IsInvoking("RespawnExtraLife") && !((MonoBehaviour)((DevotedLemurianController)betterLemurController)._lemurianMaster).IsInvoking("RespawnExtraLifeShrine") && !((MonoBehaviour)((DevotedLemurianController)betterLemurController)._lemurianMaster).IsInvoking("RespawnExtraLifeVoid"))
			{
				betterLemurController.KillYourSelf();
			}
		}
	}
	public static class StatTweaks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_GetBestMasterName <0>__Util_GetBestMasterName;

			public static hook_GetDisplayName <1>__CharacterBody_GetDisplayName;

			public static hook_Rebuild <2>__ScoreboardController_Rebuild;

			public static StatHookEventHandler <3>__RecalculateStatsAPI_GetStatCoefficients;

			public static Action<CharacterBody> <4>__CharacterBody_onBodyStartGlobal;
		}

		public static void InitHooks()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0050: 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_005b: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			object obj = <>O.<0>__Util_GetBestMasterName;
			if (obj == null)
			{
				hook_GetBestMasterName val = Util_GetBestMasterName;
				<>O.<0>__Util_GetBestMasterName = val;
				obj = (object)val;
			}
			Util.GetBestMasterName += (hook_GetBestMasterName)obj;
			object obj2 = <>O.<1>__CharacterBody_GetDisplayName;
			if (obj2 == null)
			{
				hook_GetDisplayName val2 = CharacterBody_GetDisplayName;
				<>O.<1>__CharacterBody_GetDisplayName = val2;
				obj2 = (object)val2;
			}
			CharacterBody.GetDisplayName += (hook_GetDisplayName)obj2;
			object obj3 = <>O.<2>__ScoreboardController_Rebuild;
			if (obj3 == null)
			{
				hook_Rebuild val3 = ScoreboardController_Rebuild;
				<>O.<2>__ScoreboardController_Rebuild = val3;
				obj3 = (object)val3;
			}
			ScoreboardController.Rebuild += (hook_Rebuild)obj3;
			object obj4 = <>O.<3>__RecalculateStatsAPI_GetStatCoefficients;
			if (obj4 == null)
			{
				StatHookEventHandler val4 = RecalculateStatsAPI_GetStatCoefficients;
				<>O.<3>__RecalculateStatsAPI_GetStatCoefficients = val4;
				obj4 = (object)val4;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj4;
			CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal;
		}

		public static void RemoveHooks()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0050: 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_005b: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			object obj = <>O.<0>__Util_GetBestMasterName;
			if (obj == null)
			{
				hook_GetBestMasterName val = Util_GetBestMasterName;
				<>O.<0>__Util_GetBestMasterName = val;
				obj = (object)val;
			}
			Util.GetBestMasterName -= (hook_GetBestMasterName)obj;
			object obj2 = <>O.<1>__CharacterBody_GetDisplayName;
			if (obj2 == null)
			{
				hook_GetDisplayName val2 = CharacterBody_GetDisplayName;
				<>O.<1>__CharacterBody_GetDisplayName = val2;
				obj2 = (object)val2;
			}
			CharacterBody.GetDisplayName -= (hook_GetDisplayName)obj2;
			object obj3 = <>O.<2>__ScoreboardController_Rebuild;
			if (obj3 == null)
			{
				hook_Rebuild val3 = ScoreboardController_Rebuild;
				<>O.<2>__ScoreboardController_Rebuild = val3;
				obj3 = (object)val3;
			}
			ScoreboardController.Rebuild -= (hook_Rebuild)obj3;
			object obj4 = <>O.<3>__RecalculateStatsAPI_GetStatCoefficients;
			if (obj4 == null)
			{
				StatHookEventHandler val4 = RecalculateStatsAPI_GetStatCoefficients;
				<>O.<3>__RecalculateStatsAPI_GetStatCoefficients = val4;
				obj4 = (object)val4;
			}
			RecalculateStatsAPI.GetStatCoefficients -= (StatHookEventHandler)obj4;
			CharacterBody.onBodyStartGlobal -= CharacterBody_onBodyStartGlobal;
		}

		private static string Util_GetBestMasterName(orig_GetBestMasterName orig, CharacterMaster characterMaster)
		{
			if (!Utils.IsDevoted(characterMaster))
			{
				return orig.Invoke(characterMaster);
			}
			CharacterBody body = characterMaster.GetBody();
			if (body == null)
			{
				return null;
			}
			return body.GetDisplayName();
		}

		private static string CharacterBody_GetDisplayName(orig_GetDisplayName orig, CharacterBody self)
		{
			string text = orig.Invoke(self);
			if (!string.IsNullOrEmpty(text) && Utils.IsDevoted(self))
			{
				int itemCount = ((Component)self.master).GetComponent<BetterLemurController>().LemurianInventory.GetItemCount(Items.LemurianHarness);
				if (itemCount > 0)
				{
					return $"{text} <style=cStack>x{itemCount}</style>";
				}
			}
			return text;
		}

		private static void ScoreboardController_Rebuild(orig_Rebuild orig, ScoreboardController self)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!PluginConfig.enableMinionScoreboard.Value)
			{
				return;
			}
			List<BetterLemurController> list = new List<BetterLemurController>();
			BetterLemurController betterLemurController = default(BetterLemurController);
			foreach (PlayerCharacterMasterController item in PlayerCharacterMasterController.instances.Where((PlayerCharacterMasterController m) => m.hasEffectiveAuthority))
			{
				MinionGroup val = MinionGroup.FindGroup(((NetworkBehaviour)item).netId);
				if (val == null)
				{
					continue;
				}
				MinionOwnership[] members = val.members;
				foreach (MinionOwnership val2 in members)
				{
					if (Object.op_Implicit((Object)(object)val2) && ((Component)val2).TryGetComponent<BetterLemurController>(ref betterLemurController) && Object.op_Implicit((Object)(object)betterLemurController.LemurianInventory))
					{
						list.Add(betterLemurController);
					}
				}
			}
			if (!list.Any())
			{
				return;
			}
			int count = self.stripAllocator.elements.Count;
			self.SetStripCount(count + list.Count);
			for (int j = 0; j < list.Count; j++)
			{
				self.stripAllocator.elements[count + j].SetMaster(((DevotedLemurianController)list[j])._lemurianMaster);
				if (PluginConfig.showPersonalInventory.Value)
				{
					self.stripAllocator.elements[count + j].itemInventoryDisplay.SetSubscribedInventory(list[j].PersonalInventory);
				}
			}
		}

		private static void CharacterBody_onBodyStartGlobal(CharacterBody lemBody)
		{
			//IL_0019: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			if (!Utils.IsDevoted(lemBody))
			{
				return;
			}
			if (AITweaks.disableFallDamage.Value)
			{
				lemBody.bodyFlags = (BodyFlags)(lemBody.bodyFlags | 0x41);
			}
			if (AITweaks.immuneToVoidDeath.Value)
			{
				lemBody.bodyFlags = (BodyFlags)(lemBody.bodyFlags | 0xA00);
			}
			if (PluginConfig.disableTeamCollision.Value)
			{
				((Component)lemBody).gameObject.layer = LayerIndex.fakeActor.intVal;
				if (Object.op_Implicit((Object)(object)lemBody.characterMotor))
				{
					((BaseCharacterController)lemBody.characterMotor).Motor.RebuildCollidableLayers();
				}
			}
			if (!NetworkClient.active)
			{
				return;
			}
			Transform val = (Object.op_Implicit((Object)(object)lemBody.modelLocator) ? lemBody.modelLocator.modelTransform : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				if (PluginConfig.miniElders.Value && lemBody.bodyIndex == BodyCatalog.FindBodyIndex("DevotedLemurianBruiserBody"))
				{
					float num = (float)PluginConfig.initScaleValue.Value * 0.01f;
					float num2 = (float)PluginConfig.scaleValue.Value * 0.01f;
					int itemCount = lemBody.master.inventory.GetItemCount(Items.LemurianHarness);
					val.localScale = Vector3.one * (num + num2 * (float)itemCount);
				}
				FootstepHandler val2 = default(FootstepHandler);
				if (((Component)val).TryGetComponent<FootstepHandler>(ref val2))
				{
					val2.baseFootstepString = "";
				}
			}
		}

		private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			BetterLemurController betterLemurController = default(BetterLemurController);
			if (Utils.IsDevoted(sender) && ((Component)sender.master).TryGetComponent<BetterLemurController>(ref betterLemurController) && Object.op_Implicit((Object)(object)betterLemurController.LemurianInventory))
			{
				int itemCount = betterLemurController.LemurianInventory.GetItemCount(Items.LemurianHarness);
				if (PluginConfig.rebalanceHealthScaling.Value)
				{
					float num = sender.level * sender.levelMaxHealth * Utils.GetLevelModifier(((DevotedLemurianController)betterLemurController).DevotedEvolutionLevel);
					args.baseHealthAdd += num;
					args.baseRegenAdd += num * 0.01f * Utils.GetLevelModifier(((DevotedLemurianController)betterLemurController).DevotedEvolutionLevel);
					args.armorAdd += Utils.GetLevelModifier(((DevotedLemurianController)betterLemurController).DevotedEvolutionLevel);
					args.healthMultAdd += Utils.GetFusionStatMultiplier(PluginConfig.statMultHealth.Value, itemCount, ((DevotedLemurianController)betterLemurController).DevotedEvolutionLevel);
					args.damageMultAdd += Utils.GetFusionStatMultiplier(PluginConfig.statMultDamage.Value, itemCount, ((DevotedLemurianController)betterLemurController).DevotedEvolutionLevel);
					args.attackSpeedMultAdd += Utils.GetFusionStatMultiplier(PluginConfig.statMultAttackSpeed.Value, itemCount, ((DevotedLemurianController)betterLemurController).DevotedEvolutionLevel);
				}
				else
				{
					args.healthMultAdd += Utils.GetVanillaStatModifier(PluginConfig.statMultHealth.Value, itemCount, ((DevotedLemurianController)betterLemurController).DevotedEvolutionLevel);
					args.damageMultAdd += Utils.GetVanillaStatModifier(PluginConfig.statMultHealth.Value, itemCount, ((DevotedLemurianController)betterLemurController).DevotedEvolutionLevel);
					args.attackSpeedMultAdd += Utils.GetVanillaStatModifier(PluginConfig.statMultHealth.Value, itemCount, 0);
				}
			}
		}
	}
}
namespace LemurFusion.Devotion.Components
{
	public class BetterInventoryController : DevotionInventoryController
	{
		public static List<EquipmentIndex> gigaChadLvl = new List<EquipmentIndex>();

		public static bool initialized { get; set; }

		public static void CreateEliteLists()
		{
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Invalid comparison between Unknown and I4
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			HashSet<EquipmentIndex> hashSet = new HashSet<EquipmentIndex>();
			HashSet<EquipmentIndex> hashSet2 = new HashSet<EquipmentIndex>();
			HashSet<EquipmentIndex> hashSet3 = new HashSet<EquipmentIndex>();
			foreach (EliteTierDef item in (EliteAPI.GetCombatDirectorEliteTiers() ?? Array.Empty<EliteTierDef>()).ToList())
			{
				if (item == null || item.eliteTypes.Length == 0 || item.eliteTypes.Any((EliteDef ed) => (Object)(object)ed != (Object)null && ((Object)ed).name.Contains("Honor")))
				{
					continue;
				}
				bool flag = false;
				bool flag2 = false;
				EliteDef[] eliteTypes = item.eliteTypes;
				foreach (EliteDef val in eliteTypes)
				{
					if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.eliteEquipmentDef))
					{
						if ((Object)(object)val.eliteEquipmentDef == (Object)(object)Equipment.AffixPoison || (Object)(object)val.eliteEquipmentDef == (Object)(object)Equipment.AffixLunar)
						{
							flag = true;
							break;
						}
						if ((Object)(object)val.eliteEquipmentDef == (Object)(object)Equipment.AffixBlue)
						{
							flag2 = true;
							break;
						}
					}
				}
				if (!(flag2 || flag))
				{
					continue;
				}
				eliteTypes = item.eliteTypes;
				foreach (EliteDef val2 in eliteTypes)
				{
					if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.eliteEquipmentDef) && (int)val2.eliteEquipmentDef.equipmentIndex != -1 && Object.op_Implicit((Object)(object)val2.eliteEquipmentDef.passiveBuffDef) && val2.eliteEquipmentDef.passiveBuffDef.isElite)
					{
						if (flag2)
						{
							hashSet.Add(val2.eliteEquipmentDef.equipmentIndex);
							hashSet2.Add(val2.eliteEquipmentDef.equipmentIndex);
						}
						if (flag)
						{
							hashSet2.Add(val2.eliteEquipmentDef.equipmentIndex);
							hashSet3.Add(val2.eliteEquipmentDef.equipmentIndex);
						}
					}
				}
			}
			DevotionInventoryController.lowLevelEliteBuffs = hashSet.ToList();
			DevotionInventoryController.highLevelEliteBuffs = hashSet2.ToList();
			gigaChadLvl = hashSet3.ToList();
		}

		public static void ClearEliteLists()
		{
			gigaChadLvl.Clear();
			DevotionInventoryController.lowLevelEliteBuffs.Clear();
			DevotionInventoryController.highLevelEliteBuffs.Clear();
		}

		public static void OnRunStartGlobal()
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			if (!initialized && (PluginConfig.permaDevotion.Value || RunArtifactManager.instance.IsArtifactEnabled(Artifacts.Devotion)))
			{
				initialized = true;
				Run.onRunDestroyGlobal += DevotionInventoryController.OnRunDestroy;
				BossGroup.onBossGroupDefeatedServer += DevotionInventoryController.OnBossGroupDefeatedServer;
				MasterSummon.Perform += new hook_Perform(DevotionTweaks.instance.MasterSummon_Perform);
				StatTweaks.InitHooks();
				CreateEliteLists();
			}
		}

		public static void OnDevotionArtifactDisabled(RunArtifactManager runArtifactManager, ArtifactDef artifactDef)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			if (initialized && !PluginConfig.permaDevotion.Value && (Object)(object)artifactDef == (Object)(object)Artifacts.Devotion)
			{
				initialized = false;
				Run.onRunDestroyGlobal -= DevotionInventoryController.OnRunDestroy;
				BossGroup.onBossGroupDefeatedServer -= DevotionInventoryController.OnBossGroupDefeatedServer;
				MasterSummon.Perform -= new hook_Perform(DevotionTweaks.instance.MasterSummon_Perform);
				StatTweaks.RemoveHooks();
				ClearEliteLists();
			}
		}

		public List<BetterLemurController> GetFriends(BetterLemurController self = null)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			List<BetterLemurController> list = new List<BetterLemurController>();
			if (Object.op_Implicit((Object)(object)((DevotionInventoryController)this).SummonerMaster))
			{
				MinionGroup val = MinionGroup.FindGroup(((NetworkBehaviour)((DevotionInventoryController)this).SummonerMaster).netId);
				if (val != null)
				{
					MinionOwnership[] members = val.members;
					BetterLemurController betterLemurController = default(BetterLemurController);
					foreach (MinionOwnership val2 in members)
					{
						if (Object.op_Implicit((Object)(object)val2) && ((Component)val2).TryGetComponent<BetterLemurController>(ref betterLemurController) && Object.op_Implicit((Object)(object)betterLemurController) && (Object)(object)betterLemurController != (Object)(object)self && Object.op_Implicit((Object)(object)betterLemurController.LemurianInventory))
						{
							list.Add(betterLemurController);
						}
					}
				}
			}
			return list;
		}

		public static List<BetterLemurController> GetFriends(NetworkInstanceId masterID)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			List<BetterLemurController> list = new List<BetterLemurController>();
			MinionGroup val = MinionGroup.FindGroup(masterID);
			if (val != null)
			{
				MinionOwnership[] members = val.members;
				BetterLemurController betterLemurController = default(BetterLemurController);
				foreach (MinionOwnership val2 in members)
				{
					if (Object.op_Implicit((Object)(object)val2) && ((Component)val2).TryGetComponent<BetterLemurController>(ref betterLemurController) && Object.op_Implicit((Object)(object)betterLemurController) && Object.op_Implicit((Object)(object)betterLemurController.PersonalInventory))
					{
						list.Add(betterLemurController);
					}
				}
			}
			return list;
		}
	}
	public class LemHitboxGroupRevealer : MonoBehaviour
	{
		public static GameObject prefab;

		public LemHitboxRevealer[] _revealers = Array.Empty<LemHitboxRevealer>();

		private bool _revealed;

		public static void Init()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			prefab = PrefabAPI.InstantiateClone(new GameObject(), "RevealerPrefab", false);
			prefab.AddComponent<MeshFilter>().sharedMesh = Addressables.LoadAssetAsync<Mesh>((object)"Decalicious/DecalCube.asset").WaitForCompletion();
			((Renderer)prefab.AddComponent<MeshRenderer>()).material = new Material(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Engi/matBlueprintsOk.mat").WaitForCompletion());
			((Renderer)prefab.GetComponent<MeshRenderer>()).enabled = false;
			prefab.AddComponent<LemHitboxRevealer>();
			prefab.transform.localPosition = Vector3.zero;
			prefab.transform.localRotation = Quaternion.identity;
			prefab.transform.localScale = Vector3.one;
		}

		public void Start()
		{
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			HitBoxGroup val = default(HitBoxGroup);
			ProjectileController val2 = default(ProjectileController);
			ProjectileExplosion val3 = default(ProjectileExplosion);
			if (((Component)this).TryGetComponent<HitBoxGroup>(ref val))
			{
				_revealers = new LemHitboxRevealer[val.hitBoxes.Length];
				for (int i = 0; i < val.hitBoxes.Length; i++)
				{
					_revealers[i] = Object.Instantiate<GameObject>(prefab, ((Component)val.hitBoxes[i]).transform).GetComponent<LemHitboxRevealer>();
				}
			}
			else if (((Component)this).TryGetComponent<ProjectileController>(ref val2) && val2.myColliders.Length != 0)
			{
				_revealers = new LemHitboxRevealer[val2.myColliders.Length];
				for (int j = 0; j < _revealers.Length; j++)
				{
					_revealers[j] = Object.Instantiate<GameObject>(prefab, ((Component)val2.myColliders[j]).transform).GetComponent<LemHitboxRevealer>();
				}
			}
			else if (((Component)this).TryGetComponent<ProjectileExplosion>(ref val3))
			{
				_revealers = new LemHitboxRevealer[1] { Object.Instantiate<GameObject>(prefab, ((Component)this).transform).GetComponent<LemHitboxRevealer>() };
				((Component)_revealers[0]).transform.localScale = Vector3.one * val3.blastRadius;
			}
			else
			{
				_revealers = new LemHitboxRevealer[1] { Object.Instantiate<GameObject>(prefab, ((Component)this).transform).GetComponent<LemHitboxRevealer>() };
			}
			Reveal(active: true);
		}

		public void Reveal(bool active)
		{
			_revealed = active;
			for (int i = 0; i < _revealers.Length; i++)
			{
				if (Object.op_Implicit((Object)(object)_revealers[i]))
				{
					((Behaviour)_revealers[i]).enabled = active;
				}
			}
		}

		private void OnDestroy()
		{
			Reveal(active: false);
			for (int i = 0; i < _revealers.Length; i++)
			{
				if (Object.op_Implicit((Object)(object)_revealers[i]))
				{
					Object.Destroy((Object)(object)((Component)_revealers[i]).gameObject);
				}
			}
		}
	}
	public class LemHitboxRevealer : MonoBehaviour
	{
		private MeshFilter meshFilter;

		public MeshRenderer renderer;

		private void Awake()
		{
			renderer = ((Component)this).GetComponent<MeshRenderer>();
			meshFilter = ((Component)this).GetComponent<MeshFilter>();
			((Renderer)renderer).enabled = false;
			((Behaviour)this).enabled = false;
		}

		private void OnEnable()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//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_0046: Unknown result type (might be due to invalid IL or missing references)
			MaterialPropertyBlock val = new MaterialPropertyBlock();
			((Renderer)renderer).GetPropertyBlock(val);
			Color val2 = Random.ColorHSV(0f, 1f, 0.5f, 0.5f, 0.3f, 0.6f, 0.3f, 0.6f);
			val.SetColor("_Color", val2);
			((Renderer)renderer).SetPropertyBlock(val);
			((Renderer)renderer).enabled = true;
		}

		private void OnDisable()
		{
			if (Object.op_Implicit((Object)(object)renderer))
			{
				((Renderer)renderer).enabled = false;
			}
		}
	}
	public class MatrixDodgingController : MonoBehaviour
	{
		private int escapeSkillIndex;

		private int strafeSkillIndex;

		private float escapeDistance;

		private float safeDistance;

		private BaseAI ai;

		private CharacterMaster master;

		private CharacterBody body;

		private LineRenderer laserLineComponent;

		private void OnEnable()
		{
			ai = ((Component)this).GetComponent<BaseAI>();
			master = ((Component)this).GetComponent<CharacterMaster>();
			laserLineComponent = ((Component)(object)this).GetOrAddComponent<LineRenderer>();
			DisableLaser();
			escapeSkillIndex = CollectionUtils.IndexOf<AISkillDriver>((IEnumerable<AISkillDriver>)ai.skillDrivers, (Func<AISkillDriver, bool>)((AISkillDriver s) => s.customName == "BackUpFromExplosion"));
			strafeSkillIndex = CollectionUtils.IndexOf<AISkillDriver>((IEnumerable<AISkillDriver>)ai.skillDrivers, (Func<AISkillDriver, bool>)((AISkillDriver s) => s.customName == "StrafeAroundExplosion"));
			((MonoBehaviour)this).StartCoroutine(UpdateSkillDrivers());
		}

		private IEnumerator UpdateSkillDrivers()
		{
			while (Object.op_Implicit((Object)(object)master))
			{
				while (!Object.op_Implicit((Object)(object)body) || !AITweaks.enableProjectileTracking.Value)
				{
					yield return (object)new WaitForSeconds(2f);
					if (!Object.op_Implicit((Object)(object)master))
					{
						break;
					}
					body = master.GetBody();
				}
				float distance;
				bool shouldJump;
				while (FindProjectiles(out distance, out shouldJump))
				{
					AISkillDriver val = ((distance < escapeDistance) ? ai.skillDrivers[escapeSkillIndex] : ai.skillDrivers[strafeSkillIndex]);
					if (val.customName != ai.selectedSkilldriverName || ai.skillDriverUpdateTimer > 0.2f)
					{
						val.driverUpdateTimerOverride = Mathf.Clamp(AITweaks.updateFrequency.Value * 1.5f, 0.3f, 1f);
						ai.BeginSkillDriver(new SkillDriverEvaluation
						{
							target = ai.customTarget,
							aimTarget = ai.currentEnemy,
							dominantSkillDriver = val,
							separationSqrMagnitude = distance
						});
					}
					if (body.characterMotor.isGrounded && shouldJump)
					{
						body.characterMotor.airControl = 1f;
						body.characterMotor.Jump(0.75f, 0.75f, false);
					}
					yield return (object)new WaitForSeconds(AITweaks.updateFrequency.Value);
					yield return (object)new WaitForFixedUpdate();
				}
				yield return (object)new WaitForSeconds(AITweaks.updateFrequency.Value);
			}
		}

		private bool FindProjectiles(out float distance, out bool shouldJump)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: 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_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			escapeDistance = (float)AITweaks.detectionRadius.Value * 0.5f * ((float)AITweaks.detectionRadius.Value * 0.5f);
			safeDistance = AITweaks.detectionRadius.Value * AITweaks.detectionRadius.Value;
			distance = safeDistance;
			shouldJump = false;
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)master))
			{
				return false;
			}
			GameObject target = null;
			Vector3 closestPoint = Vector3.zero;
			Vector3 footPosition = body.footPosition;
			TeamMask enemyTeams = TeamMask.GetEnemyTeams(body.master.teamIndex);
			HitBoxGroup val2 = default(HitBoxGroup);
			ProjectileExplosion val5 = default(ProjectileExplosion);
			foreach (ProjectileController instances in InstanceTracker.GetInstancesList<ProjectileController>())
			{
				if (!Object.op_Implicit((Object)(object)instances) || !((TeamMask)(ref enemyTeams)).HasTeam(instances.teamFilter.teamIndex))
				{
					continue;
				}
				if (((Object)((Component)instances).gameObject).name.Contains("Sunder"))
				{
					Vector3 val = ((Component)instances).transform.position - footPosition;
					if (((Vector3)(ref val)).sqrMagnitude < safeDistance * 9f)
					{
						shouldJump = true;
					}
				}
				if (((Component)instances).TryGetComponent<HitBoxGroup>(ref val2))
				{
					for (int i = 0; i < val2.hitBoxes.Length; i++)
					{
						float distance2;
						Vector3 val3 = Utils.ClosestPointOnTransform(((Component)val2.hitBoxes[i]).transform, footPosition, out distance2);
						if (distance2 < distance)
						{
							distance = distance2;
							closestPoint = val3;
							target = ((Component)instances).gameObject;
						}
					}
				}
				else if (instances.myColliders.Length != 0)
				{
					for (int j = 0; j < instances.myColliders.Length; j++)
					{
						float distance3;
						Vector3 val4 = Utils.ClosestPointOnCollider(instances.myColliders[j], footPosition, out distance3);
						if (distance3 < distance)
						{
							distance = distance3;
							closestPoint = val4;
							target = ((Component)instances).gameObject;
						}
					}
				}
				else if (((Component)this).TryGetComponent<ProjectileExplosion>(ref val5))
				{
					float distance4;
					Vector3 val6 = Utils.ClosestPointOnBounds(((Component)instances).transform.position, Vector3.one * val5.blastRadius, footPosition, out distance4);
					if (distance4 < distance)
					{
						distance = distance4;
						closestPoint = val6;
						target = ((Component)instances).gameObject;
					}
				}
				else
				{
					float distance5;
					Vector3 val7 = Utils.ClosestPointOnTransform(((Component)instances).transform, footPosition, out distance5);
					if (distance5 < distance)
					{
						distance = distance5;
						closestPoint = val7;
						target = ((Component)instances).gameObject;
					}
				}
			}
			return SetAITarget(target, closestPoint);
		}

		private bool SetAITarget(GameObject target, Vector3 closestPoint)
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			LemHitboxGroupRevealer lemHitboxGroupRevealer = default(LemHitboxGroupRevealer);
			if (Object.op_Implicit((Object)(object)ai.customTarget.gameObject) && (Object)(object)ai.customTarget.gameObject != (Object)(object)target && ai.customTarget.gameObject.TryGetComponent<LemHitboxGroupRevealer>(ref lemHitboxGroupRevealer))
			{
				lemHitboxGroupRevealer.Reveal(active: false);
			}
			if (Object.op_Implicit((Object)(object)target))
			{
				ai.customTarget._gameObject = target;
				ai.customTarget.lastKnownBullseyePosition = closestPoint;
				ai.customTarget.lastKnownBullseyePositionTime = FixedTimeStamp.now;
				ai.customTarget.unset = false;
				EnableLaser();
			}
			else
			{
				ai.customTarget._gameObject = null;
				ai.customTarget.lastKnownBullseyePosition = null;
				ai.customTarget.lastKnownBullseyePositionTime = FixedTimeStamp.negativeInfinity;
				ai.customTarget.unset = true;
				DisableLaser();
			}
			return Object.op_Implicit((Object)(object)ai.customTarget.gameObject);
		}

		private void EnableLaser()
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			if (AITweaks.visualizeProjectileTracking.Value)
			{
				ai.customTarget.gameObject.GetOrAddComponent<LemHitboxGroupRevealer>().Reveal(active: true);
				((Renderer)laserLineComponent).enabled = true;
				laserLineComponent.startWidth = 0.1f;
				laserLineComponent.endWidth = 0.1f;
				Vector3 val = default(Vector3);
				ai.customTarget.GetBullseyePosition(ref val);
				laserLineComponent.SetPositions((Vector3[])(object)new Vector3[2] { body.footPosition, val });
			}
		}

		private void DisableLaser()
		{
			laserLineComponent.startWidth = 0f;
			laserLineComponent.endWidth = 0f;
			((Renderer)laserLineComponent).enabled = false;
		}
	}
	public class MechaLemur
	{
		private static GameObject chaingunDisplay;

		private static GameObject launcherDisplay;

		private static GameObject robotArm;

		private static Material mechaMat;

		private static Material