Decompiled source of LemurFusion v1.9.2

LemurFusion.dll

Decompiled 2 weeks 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;
using EntityStates.LemurianBruiserMonster;
using EntityStates.LemurianMonster;
using HG;
using HarmonyLib;
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 MiscFixes.Modules;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using Newtonsoft.Json.Utilities;
using On;
using On.EntityStates.LemurianBruiserMonster;
using On.EntityStates.LemurianMonster;
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 RoR2;
using RoR2.CharacterAI;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using RoR2BepInExPack.GameAssetPathsBetter;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;

[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+d6f54a028098336f7b14d7143f95b162396b7a1e")]
[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]
[CompilerGenerated]
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int ICollection.Count => _items.Length;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => _items.Length;

	T IReadOnlyList<T>.this[int index] => _items[index];

	int ICollection<T>.Count => _items.Length;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyArray(T[] items)
	{
		_items = items;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return ((IEnumerable)_items).GetEnumerator();
	}

	void ICollection.CopyTo(Array array, int index)
	{
		((ICollection)_items).CopyTo(array, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return ((IList)_items).Contains(value);
	}

	int IList.IndexOf(object value)
	{
		return ((IList)_items).IndexOf(value);
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return ((IEnumerable<T>)_items).GetEnumerator();
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return ((ICollection<T>)_items).Contains(item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		((ICollection<T>)_items).CopyTo(array, arrayIndex);
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return ((IList<T>)_items).IndexOf(item);
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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 int FusionCount => LemurianInventory.GetItemCountPermanent(Items.LemurianHarness);

	public CharacterBody LemurianBody => UnityObjectExtensions.AsValidOrNull<CharacterMaster>(base._lemurianMaster).GetBody();

	public CharacterMaster LemurianMaster => base._lemurianMaster;

	public Inventory LemurianInventory { get; private set; }

	public Inventory PersonalInventory { get; private set; }

	private void Awake()
	{
		base._lemurianMaster = ((Component)this).GetComponent<CharacterMaster>();
		LemurianInventory = ((Component)this).GetComponent<Inventory>();
		PersonalInventory = ((Component)this).GetComponents<Inventory>().Last();
	}

	public void InitializeDevotedLemurian()
	{
		//IL_0038: 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_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		base._leashDistSq = PluginConfig.teleportDistance.Value * PluginConfig.teleportDistance.Value;
		if (FusionCount == 0)
		{
			BetterInventoryController.TakeItemsFromGroup(this);
		}
		BetterInventoryController.ShareInitialItem(this, ((DevotedLemurianController)this).DevotionItem);
		LemurianInventory.GiveItemPermanent(Items.LemurianHarness.itemIndex, 1);
		LemurianInventory.ResetItem(Items.MinionLeash.itemIndex, 1);
		LemurianInventory.ResetItem(Items.UseAmbientLevel.itemIndex, 1);
		LemurianInventory.ResetItem(Items.TeleportWhenOob.itemIndex, 1);
	}

	public void KillYourSelf()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: 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_0053: 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_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: 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_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: 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_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Expected O, but got Unknown
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Expected O, but got Unknown
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Expected O, but got Unknown
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: 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_0098: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)BetterInventoryController) && Object.op_Implicit((Object)(object)LemurianBody))
		{
			List<ItemIndex> list = default(List<ItemIndex>);
			DisposableRental<ItemIndex, List<ItemIndex>> val = CollectionPool<ItemIndex, List<ItemIndex>>.RentCollection(ref list);
			try
			{
				((ItemCollection)(ref PersonalInventory.permanentItemStacks)).GetNonZeroIndices(list);
				foreach (ItemIndex item in list)
				{
					PickupIndex val2 = FindPickupIndex(item);
					if (val2 != PickupIndex.none)
					{
						int num = ((!ConfigExtended.DeathDrop_DropAll.Value) ? 1 : PersonalInventory.GetItemCountPermanent(item));
						for (int i = 0; i < num; i++)
						{
							PickupDropletController.CreatePickupDroplet(new UniquePickup(val2), LemurianBody.corePosition, Vector2.op_Implicit(Random.insideUnitCircle * 15f), false);
						}
					}
				}
				BetterInventoryController.RemovesItemFromGroup(this);
				RaycastHit val3 = default(RaycastHit);
				if (ConfigExtended.DeathDrop_DropEgg.Value && Object.op_Implicit((Object)(object)LemurianBody) && Physics.Raycast(LemurianBody.corePosition, Vector3.down, ref val3, float.PositiveInfinity, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)))
				{
					DirectorPlacementRule val4 = new DirectorPlacementRule
					{
						placementMode = (PlacementMode)0,
						position = ((RaycastHit)(ref val3)).point
					};
					DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/CU8/LemurianEgg/iscLemurianEgg.asset").WaitForCompletion(), val4, new Xoroshiro128Plus(0uL)));
				}
			}
			finally
			{
				val.Dispose();
			}
		}
		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.9.2")]
	public class LemurFusionPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.score.LemurFusion";

		public const string PluginName = "LemurFusion";

		public const string PluginVersion = "1.9.2";

		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);
			}
		}

		[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)
		{
		}

		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, out BetterLemurController lemCtrl)
		{
			return IsDevoted(Object.op_Implicit((Object)(object)body) ? body.master : null, out lemCtrl);
		}

		public static bool IsDevoted(CharacterMaster master, out BetterLemurController lemCtrl)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			lemCtrl = null;
			if (Object.op_Implicit((Object)(object)master) && (int)master.teamIndex == 1 && master.hasBody)
			{
				lemCtrl = ((Component)master).GetComponent<BetterLemurController>();
			}
			if (Object.op_Implicit((Object)(object)lemCtrl))
			{
				return Object.op_Implicit((Object)(object)lemCtrl.LemurianInventory);
			}
			return false;
		}

		public static void ResetItem(this Inventory self, ItemIndex itemIndex, int target)
		{
			//IL_0001: 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)
			int itemCountPermanent = self.GetItemCountPermanent(itemIndex);
			if (itemCountPermanent != target)
			{
				self.GiveItemPermanent(itemIndex, target - itemCountPermanent);
			}
		}

		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.01f)
			{
				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_000e: Unknown result type (might be due to invalid IL or missing references)
			Bounds bounds = default(Bounds);
			((Bounds)(ref bounds))..ctor(position, size);
			return bounds.ClosestPointOnBounds(ref otherPoint, out distance);
		}

		public static Vector3 ClosestPointOnBounds(this ref Bounds bounds, ref Vector3 otherPoint, out float distance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			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;
		}

		private 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);
		}
	}
}
namespace LemurFusion.Devotion
{
	public class AITweaks
	{
		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_0067: 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_0097: 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_00e8: 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_011e: 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)
			if (!improveAI.Value)
			{
				return;
			}
			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 obj = masterPrefab.AddComponent<AISkillDriver>();
			obj.customName = "BackUpFromExplosion";
			obj.skillSlot = (SkillSlot)0;
			obj.maxDistance = (float)detectionRadius.Value * 0.5f;
			obj.minDistance = 0f;
			obj.aimType = (AimType)2;
			obj.moveTargetType = (TargetType)3;
			obj.movementType = (MovementType)3;
			obj.ignoreNodeGraph = true;
			obj.shouldSprint = true;
			obj.driverUpdateTimerOverride = Mathf.Clamp(updateFrequency.Value * 1.5f, 0.3f, 1f);
			AISkillDriver obj2 = masterPrefab.AddComponent<AISkillDriver>();
			obj2.customName = "StrafeAroundExplosion";
			obj2.skillSlot = (SkillSlot)0;
			obj2.maxDistance = detectionRadius.Value;
			obj2.minDistance = (float)detectionRadius.Value * 0.5f;
			obj2.aimType = (AimType)2;
			obj2.moveTargetType = (TargetType)3;
			obj2.movementType = (MovementType)2;
			obj2.ignoreNodeGraph = true;
			obj2.shouldSprint = true;
			obj2.driverUpdateTimerOverride = Mathf.Clamp(updateFrequency.Value * 1.5f, 0.3f, 1f);
			AISkillDriver[] components = masterPrefab.GetComponents<AISkillDriver>();
			foreach (AISkillDriver val in components)
			{
				switch (val.customName)
				{
				case "DevotedSecondarySkill":
					val.minUserHealthFraction = 0.6f;
					val.shouldSprint = false;
					val.activationRequiresAimConfirmation = true;
					val.maxDistance = 10f;
					break;
				case "StrafeAndShoot":
					val.maxDistance = 100f;
					val.activationRequiresAimTargetLoS = true;
					val.shouldSprint = false;
					break;
				case "ReturnToLeaderDefault":
					val.driverUpdateTimerOverride = 0.2f;
					val.shouldSprint = true;
					val.resetCurrentEnemyOnNextDriverSelection = true;
					break;
				case "WaitNearLeaderDefault":
					val.driverUpdateTimerOverride = 0.2f;
					val.resetCurrentEnemyOnNextDriverSelection = true;
					break;
				case "StrafeNearbyEnemies":
					val.shouldSprint = true;
					break;
				}
			}
		}
	}
	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 Action<DevotedLemurianController> <>9__8_1;

			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 x)
			{
				ILLabel[] array = default(ILLabel[]);
				return ILPatternMatchingExt.MatchSwitch(x, ref array);
			}

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

		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 (!orig())
			{
				return PluginConfig.permaDevotion.Value;
			}
			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_0039: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel[] array = default(ILLabel[]);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchSwitch(x, ref array)
			}))
			{
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Action<DevotedLemurianController>>((Action<DevotedLemurianController>)delegate(DevotedLemurianController lem)
				{
					//IL_0034: Unknown result type (might be due to invalid IL or missing references)
					List<EquipmentIndex> list = (PluginConfig.highTierElitesOnly.Value ? BetterInventoryController.gigaChadLvl : DevotionInventoryController.highLevelEliteBuffs);
					if (list.Any())
					{
						lem.LemurianInventory.SetEquipmentIndex(list[Random.Range(0, list.Count)]);
					}
				});
			}
			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_004b: 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)
			if (NetworkServer.active && lem is BetterLemurController betterLemurController && Object.op_Implicit((Object)(object)betterLemurController) && self is BetterInventoryController betterInventoryController)
			{
				betterInventoryController.GiveItemsToGroup(betterLemurController);
				CharacterBody lemurianBody = betterLemurController.LemurianBody;
				if (Object.op_Implicit((Object)(object)DevotionInventoryController.activationSoundEventDef) && Object.op_Implicit((Object)(object)lemurianBody))
				{
					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_OnServerDamageDealt <1>__AffixAurelioniteBehavior_OnServerDamageDealt;

			public static hook_OnEnter <2>__Bite_OnEnter;

			public static hook_FireFlame <3>__Flamebreath_FireFlame;

			public static hook_DefaultFilterCallbackImplementation <4>__BulletAttack_DefaultFilterCallbackImplementation;

			public static hook_IgnoreCollisionsWithOwner <5>__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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//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)
			//IL_0094: Expected O, but got Unknown
			//IL_00a9: 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_00b4: Expected O, but got Unknown
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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;
			object obj2 = <>O.<1>__AffixAurelioniteBehavior_OnServerDamageDealt;
			if (obj2 == null)
			{
				hook_OnServerDamageDealt val2 = AffixAurelioniteBehavior_OnServerDamageDealt;
				<>O.<1>__AffixAurelioniteBehavior_OnServerDamageDealt = val2;
				obj2 = (object)val2;
			}
			AffixAurelioniteBehavior.OnServerDamageDealt += (hook_OnServerDamageDealt)obj2;
			object obj3 = <>O.<2>__Bite_OnEnter;
			if (obj3 == null)
			{
				hook_OnEnter val3 = Bite_OnEnter;
				<>O.<2>__Bite_OnEnter = val3;
				obj3 = (object)val3;
			}
			Bite.OnEnter += (hook_OnEnter)obj3;
			object obj4 = <>O.<3>__Flamebreath_FireFlame;
			if (obj4 == null)
			{
				hook_FireFlame val4 = Flamebreath_FireFlame;
				<>O.<3>__Flamebreath_FireFlame = val4;
				obj4 = (object)val4;
			}
			Flamebreath.FireFlame += (hook_FireFlame)obj4;
			if (PluginConfig.disableTeamCollision.Value)
			{
				object obj5 = <>O.<4>__BulletAttack_DefaultFilterCallbackImplementation;
				if (obj5 == null)
				{
					hook_DefaultFilterCallbackImplementation val5 = BulletAttack_DefaultFilterCallbackImplementation;
					<>O.<4>__BulletAttack_DefaultFilterCallbackImplementation = val5;
					obj5 = (object)val5;
				}
				BulletAttack.DefaultFilterCallbackImplementation += (hook_DefaultFilterCallbackImplementation)obj5;
				object obj6 = <>O.<5>__ProjectileController_IgnoreCollisionsWithOwner;
				if (obj6 == null)
				{
					hook_IgnoreCollisionsWithOwner val6 = ProjectileController_IgnoreCollisionsWithOwner;
					<>O.<5>__ProjectileController_IgnoreCollisionsWithOwner = val6;
					obj6 = (object)val6;
				}
				ProjectileController.IgnoreCollisionsWithOwner += (hook_IgnoreCollisionsWithOwner)obj6;
			}
		}

		private static void Flamebreath_FireFlame(orig_FireFlame orig, Flamebreath self, string muzzleString)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (self.bulletAttack != null)
			{
				self.bulletAttack.damageType.damageSource = (DamageSource)2;
			}
			orig.Invoke(self, muzzleString);
		}

		private static void Bite_OnEnter(orig_OnEnter orig, Bite self)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			self.attack.damageType.damageSource = (DamageSource)2;
		}

		private static void AffixAurelioniteBehavior_OnServerDamageDealt(orig_OnServerDamageDealt orig, AffixAurelioniteBehavior self, DamageReport damageReport)
		{
			if (!Utils.IsDevoted(damageReport.attackerBody, out var _) || ((DamageTypeCombo)(ref damageReport.damageInfo.damageType)).IsDamageSourceSkillBased)
			{
				orig.Invoke(self, damageReport);
			}
		}

		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, out var _) || !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_00c6: 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_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_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			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 = 11f;
			component2.baseMoveSpeed = 10f;
			component2.baseArmor = 0f;
			component2.levelArmor = 0.5f;
			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;
			LegacyResourcesAPI.LoadAsyncCallback<GameObject>("Prefabs/NetworkedObjects/DevotionMinionInventory", (Action<GameObject>)delegate(GameObject asset)
			{
				Object.DestroyImmediate((Object)(object)asset.GetComponent<DevotionInventoryController>());
				((DevotionInventoryController)asset.AddComponent<BetterInventoryController>()).sfxLocator = asset.GetComponent<SfxLocator>();
			});
			LegacyResourcesAPI.LoadAsyncCallback<GameObject>("Prefabs/Effects/OrbEffects/ItemTakenOrbEffect", (Action<GameObject>)delegate(GameObject asset)
			{
				DevotionInventoryController.s_effectPrefab = asset;
			});
			LegacyResourcesAPI.LoadAsyncCallback<NetworkSoundEventDef>("NetworkSoundEventDefs/nseNullifiedBuffApplied", (Action<NetworkSoundEventDef>)delegate(NetworkSoundEventDef asset)
			{
				DevotionInventoryController.activationSoundEventDef = asset;
			});
			AsyncOperationHandle<SkillDef> val = Addressables.LoadAssetAsync<SkillDef>((object)RoR2_Base_LemurianBruiser.LemurianBruiserBodyPrimary_asset);
			val.Completed += delegate(AsyncOperationHandle<SkillDef> task)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				task.Result.interruptPriority = (InterruptPriority)0;
			};
			val = Addressables.LoadAssetAsync<SkillDef>((object)RoR2_Base_LemurianBruiser.LemurianBruiserBodySecondary_asset);
			val.Completed += delegate(AsyncOperationHandle<SkillDef> task)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				task.Result.interruptPriority = (InterruptPriority)0;
			};
			AsyncOperationHandle<ItemDef> val2 = Addressables.LoadAssetAsync<ItemDef>((object)RoR2_CU8_Harness.LemurianHarness_asset);
			val2.Completed += delegate(AsyncOperationHandle<ItemDef> task)
			{
				task.Result.tags = task.Result.tags.Concat(new <>z__ReadOnlyArray<ItemTag>((ItemTag[])(object)new ItemTag[2]
				{
					(ItemTag)11,
					(ItemTag)12
				})).Distinct().ToArray();
			};
			AsyncOperationHandle<GameObject> val3 = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Lemurian.Fireball_prefab);
			val3.Completed += delegate(AsyncOperationHandle<GameObject> task)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				task.Result.GetComponent<ProjectileDamage>().damageType.damageSource = (DamageSource)1;
			};
			val3 = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_LemurianBruiser.LemurianBigFireball_prefab);
			val3.Completed += delegate(AsyncOperationHandle<GameObject> task)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				task.Result.GetComponent<ProjectileDamage>().damageType.damageSource = (DamageSource)1;
			};
		}

		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)
			//IL_0098: 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,
							pickup = new UniquePickup(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 fusionCount = betterLemurController.FusionCount;
							if (fusionCount < num)
							{
								num = fusionCount;
								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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0064: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int loc = 0;
			if (val.TryGotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<SceneDirector>(x, "lumerianEgg"),
				(Instruction i) => ILPatternMatchingExt.MatchStloc(i, ref loc)
			}))
			{
				int index = val.Index;
				val.Index = index + 1;
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Ldloc, loc);
			}
			else
			{
				LemurFusionPlugin.LogError("IL Hook failed for SceneDirector_PopulateScene 1");
			}
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction i) => ILPatternMatchingExt.MatchNewobj(i, typeof(DirectorPlacementRule))
			}) && val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction i) => ILPatternMatchingExt.MatchNewobj(i, typeof(DirectorSpawnRequest))
			}) && val.TryGotoPrev((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<DirectorCard>(x, "GetSpawnCard")
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<SpawnCard, SceneDirector, SpawnCard>>((Func<SpawnCard, SceneDirector, SpawnCard>)delegate(SpawnCard originalCard, SceneDirector self)
				{
					//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)
					if (!DevotionInventoryController.isDevotionEnable)
					{
						return originalCard;
					}
					InteractableSpawnCard val2 = (InteractableSpawnCard)(object)((originalCard is InteractableSpawnCard) ? originalCard : null);
					return (val2 != null && val2.skipSpawnWhenDevotionArtifactEnabled && self.rng.RangeInt(0, 100) < Math.Clamp(PluginConfig.eggSpawnChance.Value, 0, 100)) ? (self.lumerianEgg?.spawnCard ?? Addressables.LoadAssetAsync<SpawnCard>((object)RoR2_CU8_LemurianEgg.iscLemurianEgg_asset).WaitForCompletion()) : originalCard;
				});
			}
			else
			{
				LemurFusionPlugin.LogError("IL Hook failed for SceneDirector_PopulateScene 2");
			}
		}
	}
	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)betterLemurController.LemurianMaster) && !((MonoBehaviour)betterLemurController.LemurianMaster).IsInvoking("RespawnExtraLife") && !((MonoBehaviour)betterLemurController.LemurianMaster).IsInvoking("RespawnExtraLifeShrine") && !((MonoBehaviour)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, out var _))
			{
				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, out var lemCtrl))
			{
				int fusionCount = lemCtrl.FusionCount;
				if (fusionCount > 0)
				{
					return $"{text} <style=cStack>x{fusionCount}</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 num2 = 0; num2 < list.Count; num2++)
			{
				self.stripAllocator.elements[count + num2].SetMaster(((DevotedLemurianController)list[num2])._lemurianMaster);
				if (PluginConfig.showPersonalInventory.Value)
				{
					self.stripAllocator.elements[count + num2].itemInventoryDisplay.SetSubscribedInventory(list[num2].PersonalInventory);
				}
			}
		}

		private static void CharacterBody_onBodyStartGlobal(CharacterBody lemBody)
		{
			//IL_001b: 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_0022: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			if (!Utils.IsDevoted(lemBody, out var lemCtrl))
			{
				return;
			}
			if (AITweaks.disableFallDamage.Value)
			{
				lemBody.bodyFlags = (BodyFlags)(lemBody.bodyFlags | 1);
			}
			if (AITweaks.immuneToVoidDeath.Value)
			{
				lemBody.bodyFlags = (BodyFlags)(lemBody.bodyFlags | 0xA40);
			}
			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 = Mathf.Max(0.01f, (float)PluginConfig.initScaleValue.Value * 0.01f);
					float num2 = (float)PluginConfig.scaleValue.Value * 0.01f;
					val.localScale = Vector3.one * (num + num2 * (float)lemCtrl.FusionCount);
				}
				FootstepHandler val2 = default(FootstepHandler);
				if (((Component)val).TryGetComponent<FootstepHandler>(ref val2))
				{
					val2.baseFootstepString = "";
				}
			}
		}

		private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (Utils.IsDevoted(sender, out var lemCtrl))
			{
				int fusionCount = lemCtrl.FusionCount;
				if (PluginConfig.rebalanceStatScaling.Value)
				{
					float num = sender.level * sender.levelMaxHealth * Utils.GetLevelModifier(((DevotedLemurianController)lemCtrl).DevotedEvolutionLevel);
					args.baseHealthAdd += num;
					args.baseRegenAdd += num * 0.005f * Utils.GetLevelModifier(((DevotedLemurianController)lemCtrl).DevotedEvolutionLevel);
					args.healthMultAdd += Utils.GetFusionStatMultiplier(PluginConfig.statMultHealth.Value, fusionCount, ((DevotedLemurianController)lemCtrl).DevotedEvolutionLevel);
					args.damageMultAdd += Utils.GetFusionStatMultiplier(PluginConfig.statMultDamage.Value, fusionCount, ((DevotedLemurianController)lemCtrl).DevotedEvolutionLevel);
					args.attackSpeedMultAdd += Utils.GetFusionStatMultiplier(PluginConfig.statMultAttackSpeed.Value, fusionCount, ((DevotedLemurianController)lemCtrl).DevotedEvolutionLevel);
				}
				else
				{
					args.healthMultAdd += Utils.GetVanillaStatModifier(PluginConfig.statMultHealth.Value, fusionCount, ((DevotedLemurianController)lemCtrl).DevotedEvolutionLevel);
					args.damageMultAdd += Utils.GetVanillaStatModifier(PluginConfig.statMultDamage.Value, fusionCount, ((DevotedLemurianController)lemCtrl).DevotedEvolutionLevel);
				}
			}
		}
	}
}
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) && Object.op_Implicit((Object)(object)betterLemurController.PersonalInventory))
						{
							list.Add(betterLemurController);
						}
					}
				}
			}
			return list;
		}

		public static List<BetterLemurController> GetFriends(NetworkInstanceId netId)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			List<BetterLemurController> list = new List<BetterLemurController>();
			MinionGroup val = MinionGroup.FindGroup(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.op_Implicit((Object)(object)betterLemurController.LemurianInventory) && Object.op_Implicit((Object)(object)betterLemurController.PersonalInventory))
					{
						list.Add(betterLemurController);
					}
				}
			}
			return list;
		}

		private void Awake()
		{
			base._devotionMinionInventory = ((Component)this).GetComponent<Inventory>();
		}

		public void ShareInitialItem(BetterLemurController lem, ItemIndex item)
		{
			//IL_0001: 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_001b: 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)
			((DevotionInventoryController)this).GiveItem(item, 1);
			lem.PersonalInventory.GiveItemPermanent(item, 1);
			lem.LemurianInventory.GiveItemPermanent(item, 1);
			if (!DevotionTweaks.instance.EnableSharedInventory)
			{
				return;
			}
			foreach (BetterLemurController friend in GetFriends(lem))
			{
				friend.LemurianInventory.GiveItemChanneled(item, 1);
			}
		}

		public void GiveItemsToGroup(BetterLemurController lem)
		{
			//IL_0013: 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_001b: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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_0103: 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)
			Inventory personalInventory = lem.PersonalInventory;
			if ((Object)(object)personalInventory == (Object)null)
			{
				return;
			}
			List<ItemIndex> list = default(List<ItemIndex>);
			DisposableRental<ItemIndex, List<ItemIndex>> val = CollectionPool<ItemIndex, List<ItemIndex>>.RentCollection(ref list);
			try
			{
				int[] array = default(int[]);
				DisposableRental<int> val2 = PerItemBufferPool.RequestTemp<int>(ref array);
				try
				{
					((ItemCollection)(ref personalInventory.permanentItemStacks)).GetNonZeroIndices(list);
					personalInventory.WriteAllPermanentItemStacks((Span<int>)array);
					Inventory devotionMinionInventory = base._devotionMinionInventory;
					if (Object.op_Implicit((Object)(object)devotionMinionInventory))
					{
						InventoryChangeScope val3 = default(InventoryChangeScope);
						((InventoryChangeScope)(ref val3))..ctor(devotionMinionInventory);
						try
						{
							for (int i = 0; i < list.Count; i++)
							{
								ItemIndex val4 = list[i];
								devotionMinionInventory.ChangeItemStacksCount<GiveItemPermanentImpl>(new GiveItemPermanentImpl
								{
									inventory = devotionMinionInventory
								}, val4, array[val4]);
							}
						}
						finally
						{
							((InventoryChangeScope)(ref val3)).Dispose();
						}
					}
					InventoryChangeScope val5 = default(InventoryChangeScope);
					foreach (BetterLemurController friend in GetFriends())
					{
						if (!DevotionTweaks.instance.EnableSharedInventory && (Object)(object)friend != (Object)(object)lem)
						{
							continue;
						}
						devotionMinionInventory = friend.LemurianInventory;
						((InventoryChangeScope)(ref val5))..ctor(devotionMinionInventory);
						try
						{
							for (int j = 0; j < list.Count; j++)
							{
								ItemIndex val6 = list[j];
								devotionMinionInventory.ChangeItemStacksCount<GiveItemChanneledImpl>(new GiveItemChanneledImpl
								{
									inventory = devotionMinionInventory
								}, val6, array[val6]);
							}
						}
						finally
						{
							((InventoryChangeScope)(ref val5)).Dispose();
						}
					}
				}
				finally
				{
					val2.Dispose();
				}
			}
			finally
			{
				val.Dispose();
			}
		}

		public void TakeItemsFromGroup(BetterLemurController lem)
		{
			//IL_0020: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: 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_007f: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: 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)
			if (!DevotionTweaks.instance.EnableSharedInventory)
			{
				return;
			}
			Inventory lemurianInventory = lem.LemurianInventory;
			if ((Object)(object)lemurianInventory == (Object)null)
			{
				return;
			}
			HashSet<ItemIndex> hashSet = default(HashSet<ItemIndex>);
			DisposableRental<ItemIndex, HashSet<ItemIndex>> val = CollectionPool<ItemIndex, HashSet<ItemIndex>>.RentCollection(ref hashSet);
			try
			{
				int[] array = default(int[]);
				DisposableRental<int> val2 = PerItemBufferPool.RequestTemp<int>(ref array);
				try
				{
					List<ItemIndex> list = default(List<ItemIndex>);
					DisposableRental<ItemIndex, List<ItemIndex>> val3 = CollectionPool<ItemIndex, List<ItemIndex>>.RentCollection(ref list);
					try
					{
						foreach (BetterLemurController friend in GetFriends(lem))
						{
							Inventory personalInventory = friend.PersonalInventory;
							list.Clear();
							((ItemCollection)(ref personalInventory.permanentItemStacks)).GetNonZeroIndices(list);
							for (int i = 0; i < list.Count; i++)
							{
								ItemIndex val4 = list[i];
								hashSet.Add(val4);
								array[val4] += ((ItemCollection)(ref personalInventory.permanentItemStacks)).GetStackValue(val4) * (1 + ((DevotedLemurianController)friend).DevotedEvolutionLevel);
							}
						}
						InventoryChangeScope val5 = new InventoryChangeScope(lemurianInventory);
						try
						{
							foreach (ItemIndex item in hashSet)
							{
								lemurianInventory.ChangeItemStacksCount<GiveItemChanneledImpl>(new GiveItemChanneledImpl
								{
									inventory = lemurianInventory
								}, item, array[item]);
							}
						}
						finally
						{
							((InventoryChangeScope)(ref val5)).Dispose();
						}
					}
					finally
					{
						val3.Dispose();
					}
				}
				finally
				{
					val2.Dispose();
				}
			}
			finally
			{
				val.Dispose();
			}
		}

		public void RemovesItemFromGroup(BetterLemurController lem)
		{
			//IL_0013: 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_001b: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_00fb: 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)
			Inventory personalInventory = lem.PersonalInventory;
			if ((Object)(object)personalInventory == (Object)null)
			{
				return;
			}
			List<ItemIndex> list = default(List<ItemIndex>);
			DisposableRental<ItemIndex, List<ItemIndex>> val = CollectionPool<ItemIndex, List<ItemIndex>>.RentCollection(ref list);
			try
			{
				int[] array = default(int[]);
				DisposableRental<int> val2 = PerItemBufferPool.RequestTemp<int>(ref array);
				try
				{
					((ItemCollection)(ref personalInventory.permanentItemStacks)).GetNonZeroIndices(list);
					personalInventory.WriteAllPermanentItemStacks((Span<int>)array);
					Inventory devotionMinionInventory = base._devotionMinionInventory;
					if (Object.op_Implicit((Object)(object)devotionMinionInventory))
					{
						InventoryChangeScope val3 = default(InventoryChangeScope);
						((InventoryChangeScope)(ref val3))..ctor(devotionMinionInventory);
						try
						{
							for (int i = 0; i < list.Count; i++)
							{
								ItemIndex val4 = list[i];
								devotionMinionInventory.ChangeItemStacksCount<GiveItemPermanentImpl>(new GiveItemPermanentImpl
								{
									inventory = devotionMinionInventory
								}, val4, -array[val4]);
							}
						}
						finally
						{
							((InventoryChangeScope)(ref val3)).Dispose();
						}
					}
					if (!DevotionTweaks.instance.EnableSharedInventory)
					{
						return;
					}
					InventoryChangeScope val5 = default(InventoryChangeScope);
					foreach (BetterLemurController friend in GetFriends(lem))
					{
						devotionMinionInventory = friend.LemurianInventory;
						((InventoryChangeScope)(ref val5))..ctor(devotionMinionInventory);
						try
						{
							for (int j = 0; j < list.Count; j++)
							{
								ItemIndex val6 = list[j];
								devotionMinionInventory.ChangeItemStacksCount<GiveItemChanneledImpl>(new GiveItemChanneledImpl
								{
									inventory = devotionMinionInventory
								}, val6, -array[val6]);
							}
						}
						finally
						{
							((InventoryChangeScope)(ref val5)).Dispose();
						}
					}
				}
				finally
				{
					val2.Dispose();
				}
			}
			finally
			{
				val.Dispose();
			}
		}
	}
	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 re