Decompiled source of DevotionConfig v1.0.1

plugins/DevotionConfig.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DevotionConfig.Changes;
using On;
using On.RoR2;
using On.RoR2.CharacterAI;
using R2API;
using RoR2;
using RoR2.CharacterAI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("DevotionConfig")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DevotionConfig")]
[assembly: AssemblyTitle("DevotionConfig")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DevotionConfig
{
	public static class Configs
	{
		public static ConfigFile HeavyConfig;

		public static ConfigFile LightConfig;

		private const string Section_EnableConfig = "!Enable Config";

		private const string Section_BaseStats = "Minion Base Stats";

		private const string Section_Evolution = "Evolution Settings";

		private const string Section_Death = "Death Settings";

		private const string Section_Misc = "Misc Settings";

		private const string Section_ItemDrop = "Item Drop";

		private const string Section_Blacklist = "Item Blacklist";

		private const string Label_Enable = "!Enable Changes";

		private const string Desc_Enable = "Enables changes for this section.";

		public static string ConfigFolderPath => Path.Combine(Paths.ConfigPath, MainPlugin.pluginInfo.Metadata.GUID);

		public static void Setup()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			LightConfig = new ConfigFile(Path.Combine(ConfigFolderPath, "Light.cfg"), true);
			HeavyConfig = new ConfigFile(Path.Combine(ConfigFolderPath, "Heavy.cfg"), true);
			Read_LightConfig();
			Read_HeavyConfig();
		}

		private static void Read_HeavyConfig()
		{
			HeavyChanges.Enable = HeavyConfig.Bind<bool>("!Enable Config", "Enable Config", false, "Enables this entire part of the mod to function, may cause mod incompats.").Value;
			HeavyChanges.Evo_HPStages_Raw = HeavyConfig.Bind<string>("Minion Base Stats", "Health Multiplier", "E1, 1, E2, 2, E3, 1, E4, 2", "Health multiplier for devotion minions, per evolution stage. (1 = +100% health or effectively 200% health)").Value;
			HeavyChanges.Evo_DmgStages_Raw = HeavyConfig.Bind<string>("Minion Base Stats", "Damage Multiplier", "E1, 1, E2, 2, E3, 1, E4, 2", "Damage multiplier for devotion minions, per evolution stage. (1 = +100% damage or effectively 200% damage)").Value;
			HeavyChanges.Evo_RegenStages_Raw = HeavyConfig.Bind<string>("Minion Base Stats", "Base Regen", "E1, 0, E2, 0, E3, 0, E4, 0", "Base health regen added to devotion minions, per evolution stage. Scales with level.").Value;
			HeavyChanges.EvoMax = HeavyConfig.Bind<int>("Evolution Settings", "Evolution Level Cap", 0, "The maximum evolution level devotion minions can reach. (0 = Unlimited/Vanilla)").Value;
			HeavyChanges.EliteList_Raw = HeavyConfig.Bind<string>("Evolution Settings", "Elite Tiers", "edFire, 1, edIce, 1, edLightning, 1, edEarth, 1, edPoison, 2, edHaunted, 2, edLunar, 2", "List of Elite Types and their Tier.").Value;
			HeavyChanges.Evo_BodyStages_Raw = HeavyConfig.Bind<string>("Evolution Settings", "Evolution Body Stages", "LemurianBruiserBody, 3", "Change the Body type at specific evolution levels with a specific body name.").Value;
			HeavyChanges.Evo_EliteStages_Raw = HeavyConfig.Bind<string>("Evolution Settings", "Evolution Elite Stages", "T1, 2, T0, 3, T2, 4", "Change the Elite type at specific evolution levels with a maximum elite tier.").Value;
			HeavyChanges.Evo_BaseMaster_Raw = HeavyConfig.Bind<string>("Evolution Settings", "Base Stage Master", "DevotedLemurianMaster", "Master Name for the basic form, used for evolution stage 1.").Value;
			HeavyChanges.Death_Penalty = HeavyConfig.Bind<int>("Death Settings", "Penalty", 0, "What to do to a devotion minion when it dies. (0 = Kill/Vanilla, 1 = Devolve, 2 = Reset Evolution Level to 1) (For 1 and 2 it will kill them if they're at Evolution Level 1.)").Value;
			HeavyChanges.Death_EggDrop = HeavyConfig.Bind<bool>("Death Settings", "Egg On Death", false, "Should minions revert to an egg when they are killed off?").Value;
			HeavyChanges.EvoLevelTrack = HeavyConfig.Bind<bool>("Misc Settings", "Display Evolution Level", false, "Shows the evolution level of each minion on their name.").Value;
			HeavyChanges.Misc_LeashDistance = HeavyConfig.Bind<float>("Misc Settings", "Leash Distance", 400f, "Minion leash distance.").Value;
		}

		private static void Read_LightConfig()
		{
			LightChanges.ItemDrop_Enable = LightConfig.Bind<bool>("Item Drop", "!Enable Changes", false, "Enables changes for this section.").Value;
			LightChanges.ItemDrop_Type = LightConfig.Bind<int>("Item Drop", "Item Drop", 0, "What kind of item to drop when minions are removed. (0 = Scrap/Custom, 1 = Original Item, 2 = Nothing").Value;
			LightChanges.ItemDrop_CustomDropList_Raw = LightConfig.Bind<string>("Item Drop", "Custom Drop List", "Tier1Def, ScrapWhite, Tier2Def, ScrapGreen, Tier3Def, ScrapRed, BossTierDef, ScrapYellow, LunarTierDef, LunarTrinket, VoidTier1Def, TreasureCacheVoid, VoidTier2Def, TreasureCacheVoid, VoidTier3Def, TreasureCacheVoid, VoidBossDef, TreasureCacheVoid", "The item to drop for each tier when Item Drop is set to 0.").Value;
			LightChanges.Blacklist_Enable = LightConfig.Bind<bool>("Item Blacklist", "!Enable Changes", false, "Enables changes for this section.").Value;
			LightChanges.BlackList_Filter_CannotCopy = LightConfig.Bind<bool>("Item Blacklist", "Include CannotCopy", true, "Automatically blacklist items that are tagged as CannotCopy. (The same filter used for Engineer Turrets)").Value;
			LightChanges.BlackList_Filter_Scrap = LightConfig.Bind<bool>("Item Blacklist", "Include Scrap", true, "Automatically blacklist items that are tagged as Scrap.").Value;
			LightChanges.BlackList_ItemList_Raw = LightConfig.Bind<string>("Item Blacklist", "Item Blacklist", "WardOnLevel, BeetleGland", "Items to blacklist from being picked.").Value;
			LightChanges.BlackList_TierList_Raw = LightConfig.Bind<string>("Item Blacklist", "Tier Blacklist", "LunarTierDef, VoidTier1Def, VoidTier2Def, VoidTier3Def, VoidBossDef", "Tiers to blacklist from being picked.").Value;
			LightChanges.Misc_FixEvo = LightConfig.Bind<bool>("Misc Settings", "Fix When Disabled", true, "Fixes the item orb not showing when giving items to eggs and allows devotion minions to evolve even when the Artifact is disabled.").Value;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.kking117.DevotionConfig", "DevotionConfig", "1.0.1")]
	public class MainPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.kking117.DevotionConfig";

		public const string MODNAME = "DevotionConfig";

		public const string MODTOKEN = "KKING117_DEVOTIONCONFIG_";

		public const string MODVERSION = "1.0.1";

		public const string LOGNAME = "[DevotionConfig] ";

		internal static ManualLogSource ModLogger;

		public static PluginInfo pluginInfo;

		private void Awake()
		{
			ModLogger = ((BaseUnityPlugin)this).Logger;
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Configs.Setup();
			EnableChanges();
			((ResourceAvailability)(ref GameModeCatalog.availability)).CallWhenAvailable((Action)PostLoad);
		}

		private void EnableChanges()
		{
			new HeavyChanges();
			new LightChanges();
		}

		private void PostLoad()
		{
			LightChanges.PostLoad();
			HeavyChanges.PostLoad();
		}
	}
}
namespace DevotionConfig.Changes
{
	public class HeavyChanges
	{
		internal static bool Enable = true;

		internal static string Evo_HPStages_Raw;

		internal static string Evo_DmgStages_Raw;

		internal static string Evo_RegenStages_Raw;

		internal static float[] Evo_HPStages;

		internal static float[] Evo_DmgStages;

		internal static float[] Evo_RegenStages;

		internal static int EvoMax = -1;

		internal static string EliteList_Raw;

		internal static int[] EliteList;

		internal static List<int[]> EliteAspects = new List<int[]>();

		internal static string Evo_BodyStages_Raw;

		internal static List<BodyEvolutionStage> Evo_BodyStages;

		internal static string Evo_EliteStages_Raw;

		internal static List<EliteEvolutionStage> Evo_EliteStages;

		internal static string Evo_BaseMaster_Raw = "DevotedLemurianMaster";

		internal static GameObject Evo_BaseMaster;

		internal static string Evo_BaseBody_Raw = "LemurianBody";

		internal static int Death_Penalty = 0;

		internal static bool Death_EggDrop = false;

		internal static bool EvoLevelTrack = false;

		internal static float Misc_LeashDistance = 400f;

		private static string SFX_Evolve = "Play_obj_devotion_egg_evolve";

		internal static SpawnCard EggSpawnCard = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/CU8/LemurianEgg/iscLemurianEgg.asset").WaitForCompletion();

		internal static GameObject VFX_Hatch = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/LemurianEggHatching");

		public HeavyChanges()
		{
			if (Enable)
			{
				ClampConfig();
				Hooks();
			}
		}

		private void ClampConfig()
		{
			EvoMax--;
			Math.Max(0, Death_Penalty);
			Math.Min(2, Death_Penalty);
		}

		private void Hooks()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			LemurianEggController.SummonLemurian += new hook_SummonLemurian(OnHatchEgg);
			DevotionInventoryController.UpdateAllMinions += new hook_UpdateAllMinions(UpdateAllMinions);
			DevotionInventoryController.UpdateMinionInventory += new hook_UpdateMinionInventory(UpdateMinionInventory);
			DevotionInventoryController.EvolveDevotedLumerian += new hook_EvolveDevotedLumerian(Hook_EvolveDevotedLumerian);
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(GetStatCoefficients);
			if (EvoLevelTrack)
			{
				CharacterBody.GetDisplayName += new hook_GetDisplayName(GetDisplayName);
			}
			Run.onRunStartGlobal += OnRunStart;
			if (Death_Penalty > 0)
			{
				DevotedLemurianController.OnDevotedBodyDead += new hook_OnDevotedBodyDead(OnDevotedBodyDead_Penalty);
			}
			else
			{
				DevotedLemurianController.OnDevotedBodyDead += new hook_OnDevotedBodyDead(OnDevotedBodyDead_EggDrop);
			}
			if (Misc_LeashDistance != 400f)
			{
				DevotedLemurianController.CheckIfNeedTeleport += new hook_CheckIfNeedTeleport(CheckIfNeedTeleport);
			}
		}

		internal static void PostLoad()
		{
			if (!Enable)
			{
				return;
			}
			float[,] array = new float[999, 2];
			string[] array2 = Evo_HPStages_Raw.Split(new char[1] { ',' });
			int num = 0;
			for (int i = 0; i + 1 < array2.Length; i += 2)
			{
				array2[i] = array2[i].Trim();
				array2[i + 1] = array2[i + 1].Trim();
				string[] array3 = array2[i].Split(new char[1] { 'E' });
				if (array3.Length != 2)
				{
					continue;
				}
				if (int.TryParse(array3[1], out var result))
				{
					if (float.TryParse(array2[i + 1], out var result2))
					{
						if (result > -1 && result < array.Length)
						{
							array[result, 0] = result2;
							array[result, 1] = 1f;
							if (num < result)
							{
								num = result;
							}
						}
					}
					else
					{
						MainPlugin.ModLogger.LogWarning((object)string.Format("{0} [Health Multiplier] '{1}' Is not a valid float.", "[DevotionConfig] ", array3[1]));
					}
				}
				else
				{
					MainPlugin.ModLogger.LogWarning((object)string.Format("{0} [Health Multiplier] '{1}' Is not a valid Evolution Stage number.", "[DevotionConfig] ", array3[0]));
				}
			}
			if (num > 0)
			{
				Evo_HPStages = new float[num + 1];
				float num2 = 0f;
				for (int j = 0; j < num + 1; j++)
				{
					if (array[j, 1] > 0f)
					{
						Evo_HPStages[j] = array[j, 0];
						num2 = array[j, 0];
					}
					else
					{
						Evo_HPStages[j] = num2;
					}
				}
			}
			float[,] array4 = new float[999, 2];
			array2 = Evo_DmgStages_Raw.Split(new char[1] { ',' });
			num = 0;
			for (int k = 0; k + 1 < array2.Length; k += 2)
			{
				array2[k] = array2[k].Trim();
				array2[k + 1] = array2[k + 1].Trim();
				string[] array5 = array2[k].Split(new char[1] { 'E' });
				if (array5.Length != 2)
				{
					continue;
				}
				if (int.TryParse(array5[1], out var result3))
				{
					if (float.TryParse(array2[k + 1], out var result4))
					{
						if (result3 > -1 && result3 < array4.Length)
						{
							array4[result3, 0] = result4;
							array4[result3, 1] = 1f;
							if (num < result3)
							{
								num = result3;
							}
						}
					}
					else
					{
						MainPlugin.ModLogger.LogWarning((object)string.Format("{0} [Damage Multiplier] '{1}' Is not a valid float.", "[DevotionConfig] ", array5[1]));
					}
				}
				else
				{
					MainPlugin.ModLogger.LogWarning((object)string.Format("{0} [Damage Multiplier] '{1}' Is not a valid Evolution Stage number.", "[DevotionConfig] ", array5[0]));
				}
			}
			if (num > 0)
			{
				Evo_DmgStages = new float[num + 1];
				float num3 = 0f;
				for (int l = 0; l < num + 1; l++)
				{
					if (array4[l, 1] > 0f)
					{
						Evo_DmgStages[l] = array4[l, 0];
						num3 = array4[l, 0];
					}
					else
					{
						Evo_DmgStages[l] = num3;
					}
				}
			}
			float[,] array6 = new float[999, 2];
			array2 = Evo_RegenStages_Raw.Split(new char[1] { ',' });
			num = 0;
			for (int m = 0; m + 1 < array2.Length; m += 2)
			{
				array2[m] = array2[m].Trim();
				array2[m + 1] = array2[m + 1].Trim();
				string[] array7 = array2[m].Split(new char[1] { 'E' });
				if (array7.Length != 2)
				{
					continue;
				}
				if (int.TryParse(array7[1], out var result5))
				{
					if (float.TryParse(array2[m + 1], out var result6))
					{
						if (result5 > -1 && result5 < array6.Length)
						{
							array6[result5, 0] = result6;
							array6[result5, 1] = 1f;
							if (num < result5)
							{
								num = result5;
							}
						}
					}
					else
					{
						MainPlugin.ModLogger.LogWarning((object)string.Format("{0} [Base Regen] '{1}' Is not a valid float.", "[DevotionConfig] ", array7[1]));
					}
				}
				else
				{
					MainPlugin.ModLogger.LogWarning((object)string.Format("{0} [Base Regen] '{1}' Is not a valid Evolution Stage number.", "[DevotionConfig] ", array7[0]));
				}
			}
			if (num > 0)
			{
				Evo_RegenStages = new float[num + 1];
				float num4 = 0f;
				for (int n = 0; n < num + 1; n++)
				{
					if (array6[n, 1] > 0f)
					{
						Evo_RegenStages[n] = array6[n, 0];
						num4 = array6[n, 0];
					}
					else
					{
						Evo_RegenStages[n] = num4;
					}
				}
			}
			EliteList = new int[EliteCatalog.eliteList.Capacity];
			for (int num5 = 0; num5 < EliteList.Length; num5++)
			{
				EliteList[num5] = -1;
			}
			array2 = EliteList_Raw.Split(new char[1] { ',' });
			for (int num6 = 0; num6 + 1 < array2.Length; num6 += 2)
			{
				array2[num6] = array2[num6].Trim();
				array2[num6 + 1] = array2[num6 + 1].Trim();
				int eliteIndex = GetEliteIndex(array2[num6]);
				if (eliteIndex > -1)
				{
					if (eliteIndex > -1 && eliteIndex < EliteList.Length)
					{
						int result7 = -1;
						if (int.TryParse(array2[num6 + 1], out result7) && result7 > 0)
						{
							EliteList[eliteIndex] = result7;
						}
					}
				}
				else
				{
					MainPlugin.ModLogger.LogWarning((object)string.Format("{0}Could not find EliteDef '{1}' for Elite Tiers.", "[DevotionConfig] ", array2[num6].Trim()));
				}
			}
			array2 = Evo_EliteStages_Raw.Split(new char[1] { ',' });
			Evo_EliteStages = new List<EliteEvolutionStage>();
			for (int num7 = 0; num7 + 1 < array2.Length; num7 += 2)
			{
				array2[num7] = array2[num7].Trim();
				array2[num7 + 1] = array2[num7 + 1].Trim();
				string[] array8 = array2[num7].Split(new char[1] { 'T' });
				if (array8.Length != 2)
				{
					continue;
				}
				if (int.TryParse(array8[1], out var result8))
				{
					EliteEvolutionStage eliteEvolutionStage = new EliteEvolutionStage();
					eliteEvolutionStage.TierIndex = result8;
					if (int.TryParse(array2[num7 + 1], out result8))
					{
						eliteEvolutionStage.EvolutionStage = result8;
						Evo_EliteStages.Add(eliteEvolutionStage);
					}
				}
				else
				{
					MainPlugin.ModLogger.LogWarning((object)string.Format("{0}'{1}' Is not a valid Tier number.", "[DevotionConfig] ", array8[0]));
				}
			}
			array2 = Evo_BodyStages_Raw.Split(new char[1] { ',' });
			Evo_BodyStages = new List<BodyEvolutionStage>();
			for (int num8 = 0; num8 + 1 < array2.Length; num8 += 2)
			{
				array2[num8] = array2[num8].Trim();
				array2[num8 + 1] = array2[num8 + 1].Trim();
				if (int.TryParse(array2[num8 + 1], out var result9))
				{
					if (result9 > 1)
					{
						BodyEvolutionStage bodyEvolutionStage = new BodyEvolutionStage();
						bodyEvolutionStage.BodyName = array2[num8];
						bodyEvolutionStage.EvolutionStage = result9;
						Evo_BodyStages.Add(bodyEvolutionStage);
					}
					else
					{
						MainPlugin.ModLogger.LogWarning((object)string.Format("{0}'{1}' Is being assigned to an evolution stage lower than 2, ignoring.", "[DevotionConfig] ", array2[num8]));
					}
				}
			}
			Evo_BaseMaster = MasterCatalog.FindMasterPrefab(Evo_BaseMaster_Raw);
			if (Object.op_Implicit((Object)(object)Evo_BaseMaster))
			{
				MainPlugin.ModLogger.LogInfo((object)("Set [" + Evo_BaseMaster_Raw + "] as base master form."));
			}
			else
			{
				MainPlugin.ModLogger.LogWarning((object)string.Format("{0} Could not find master for [{1}] this will cause errors.", "[DevotionConfig] ", Evo_BaseMaster_Raw));
			}
			CharacterMaster component = Evo_BaseMaster.GetComponent<CharacterMaster>();
			if (Object.op_Implicit((Object)(object)component))
			{
				GameObject bodyPrefab = component.bodyPrefab;
				if (Object.op_Implicit((Object)(object)bodyPrefab))
				{
					Evo_BaseBody_Raw = ((Object)bodyPrefab).name;
					MainPlugin.ModLogger.LogInfo((object)("Base Master has [" + Evo_BaseBody_Raw + "] as base body form."));
				}
			}
		}

		private static int GetEliteIndex(string eliteDef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected I4, but got Unknown
			for (int i = 0; i < EliteCatalog.eliteDefs.Length; i++)
			{
				if (((Object)EliteCatalog.eliteDefs[i]).name == eliteDef)
				{
					return (int)EliteCatalog.eliteDefs[i].eliteIndex;
				}
			}
			return -1;
		}

		private void OnRunStart(Run self)
		{
			CreateEliteList();
		}

		private void GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (!Object.op_Implicit((Object)(object)sender.inventory))
			{
				return;
			}
			int itemCount = sender.inventory.GetItemCount(Items.LemurianHarness);
			if (itemCount > 0)
			{
				args.healthMultAdd += GetHPMult(itemCount);
				args.damageMultAdd += GetDmgMult(itemCount);
				float regenAdd = GetRegenAdd(itemCount);
				if (regenAdd != 0f)
				{
					args.baseRegenAdd += regenAdd;
					args.levelRegenAdd += regenAdd / 5f;
				}
			}
		}

		private float GetHPMult(int itemCount)
		{
			float result = 0f;
			if (Evo_HPStages != null)
			{
				if (itemCount > Evo_HPStages.Length - 1)
				{
					itemCount = Evo_HPStages.Length - 1;
				}
				return Evo_DmgStages[itemCount];
			}
			return result;
		}

		private float GetDmgMult(int itemCount)
		{
			float result = 0f;
			if (Evo_DmgStages != null)
			{
				if (itemCount > Evo_DmgStages.Length - 1)
				{
					itemCount = Evo_DmgStages.Length - 1;
				}
				return Evo_DmgStages[itemCount];
			}
			return result;
		}

		private float GetRegenAdd(int itemCount)
		{
			float result = 0f;
			if (Evo_RegenStages != null)
			{
				if (itemCount > Evo_RegenStages.Length - 1)
				{
					itemCount = Evo_RegenStages.Length - 1;
				}
				return Evo_RegenStages[itemCount];
			}
			return result;
		}

		private string GetDisplayName(orig_GetDisplayName orig, CharacterBody self)
		{
			Inventory inventory = self.inventory;
			if (Object.op_Implicit((Object)(object)inventory))
			{
				int itemCount = inventory.GetItemCount(Items.LemurianHarness);
				if (itemCount > 0)
				{
					return Language.GetString(self.baseNameToken) + $"({itemCount})";
				}
			}
			return orig.Invoke(self);
		}

		private void OnDevotedBodyDead_Penalty(orig_OnDevotedBodyDead orig, DevotedLemurianController self)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			int devotedEvolutionLevel = self._devotedEvolutionLevel;
			int num = 0;
			CharacterMaster lemurianMaster = self._lemurianMaster;
			if (lemurianMaster.IsDeadAndOutOfLivesServer())
			{
				bool flag = true;
				if (Death_Penalty > 0)
				{
					if (devotedEvolutionLevel > 0)
					{
						flag = false;
						num = ((Death_Penalty != 2) ? (-1) : (num - devotedEvolutionLevel));
					}
					else
					{
						num = -1;
					}
				}
				if (flag)
				{
					self.DevotedEvolutionLevel = -1;
					lemurianMaster.destroyOnBodyDeath = true;
					self._devotionInventoryController.DropScrapOnDeath(self._devotionItem, self.LemurianBody);
					if (Death_EggDrop)
					{
						PlaceDevotionEgg(self.LemurianBody.footPosition);
					}
					Object.Destroy((Object)(object)((Component)self._lemurianMaster).gameObject, 1f);
				}
				else
				{
					EvolveDevotedLemurian(self, num);
					((MonoBehaviour)lemurianMaster).Invoke("RespawnExtraLife", 2f);
				}
			}
			self._devotionInventoryController.UpdateAllMinions(false);
		}

		private void OnDevotedBodyDead_EggDrop(orig_OnDevotedBodyDead orig, DevotedLemurianController self)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (self._lemurianMaster.IsDeadAndOutOfLivesServer())
			{
				self._devotionInventoryController.DropScrapOnDeath(self._devotionItem, self.LemurianBody);
				if (Death_EggDrop)
				{
					PlaceDevotionEgg(self.LemurianBody.footPosition);
				}
			}
			self._devotionInventoryController.UpdateAllMinions(false);
		}

		private void UpdateAllMinions(orig_UpdateAllMinions orig, DevotionInventoryController self, bool shouldEvolve)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !Object.op_Implicit((Object)(object)self._summonerMaster))
			{
				return;
			}
			MinionGroup val = MinionGroup.FindGroup(((NetworkBehaviour)self._summonerMaster).netId);
			if (val != null)
			{
				MinionOwnership[] members = val.members;
				DevotedLemurianController val3 = default(DevotedLemurianController);
				foreach (MinionOwnership val2 in members)
				{
					if (!Object.op_Implicit((Object)(object)val2) || !((Component)((Component)val2).GetComponent<CharacterMaster>()).TryGetComponent<DevotedLemurianController>(ref val3))
					{
						continue;
					}
					CharacterMaster lemurianMaster = val3._lemurianMaster;
					CharacterBody lemurianBody = val3.LemurianBody;
					if (shouldEvolve)
					{
						EvolveDevotedLemurian(val3, 1);
					}
					if (Death_Penalty > 0)
					{
						if (val3.DevotedEvolutionLevel > -1)
						{
							lemurianMaster.destroyOnBodyDeath = false;
						}
						else
						{
							lemurianMaster.destroyOnBodyDeath = true;
						}
					}
				}
			}
			RefreshDevotedInventory(self);
		}

		private void UpdateMinionInventory(orig_UpdateMinionInventory orig, DevotionInventoryController self, DevotedLemurianController controller, bool shouldEvolve)
		{
		}

		private void Hook_EvolveDevotedLumerian(orig_EvolveDevotedLumerian orig, DevotionInventoryController self, DevotedLemurianController controller)
		{
		}

		private void RefreshDevotedInventory(DevotionInventoryController controller)
		{
			//IL_0028: 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_007e: Invalid comparison between Unknown and I4
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			Inventory devotionMinionInventory = controller._devotionMinionInventory;
			devotionMinionInventory.CleanInventory();
			if (!Object.op_Implicit((Object)(object)controller._summonerMaster))
			{
				return;
			}
			MinionGroup val = MinionGroup.FindGroup(((NetworkBehaviour)controller._summonerMaster).netId);
			if (val == null)
			{
				return;
			}
			MinionOwnership[] members = val.members;
			DevotedLemurianController val3 = default(DevotedLemurianController);
			foreach (MinionOwnership val2 in members)
			{
				if (Object.op_Implicit((Object)(object)val2) && ((Component)((Component)val2).GetComponent<CharacterMaster>()).TryGetComponent<DevotedLemurianController>(ref val3) && (int)val3.DevotionItem != -1)
				{
					devotionMinionInventory.GiveItem(val3.DevotionItem, val3.DevotedEvolutionLevel + 1);
				}
			}
			MinionOwnership[] members2 = val.members;
			DevotedLemurianController val5 = default(DevotedLemurianController);
			foreach (MinionOwnership val4 in members2)
			{
				if (Object.op_Implicit((Object)(object)val4) && ((Component)((Component)val4).GetComponent<CharacterMaster>()).TryGetComponent<DevotedLemurianController>(ref val5))
				{
					Inventory lemurianInventory = val5.LemurianInventory;
					lemurianInventory.CleanInventory();
					lemurianInventory.AddItemsFrom(devotionMinionInventory);
					lemurianInventory.GiveItem(Items.UseAmbientLevel, 1);
					lemurianInventory.GiveItem(Items.LemurianHarness, val5.DevotedEvolutionLevel + 1);
				}
			}
		}

		private bool CheckIfNeedTeleport(orig_CheckIfNeedTeleport orig, DevotedLemurianController self)
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			if (!self.LemurianBody.hasEffectiveAuthority)
			{
				return false;
			}
			CharacterMaster val = (Object.op_Implicit((Object)(object)self._lemurianMaster) ? self._lemurianMaster.minionOwnership.ownerMaster : null);
			CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetBody() : null);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				return false;
			}
			Vector3 corePosition = val2.corePosition;
			Vector3 corePosition2 = self.LemurianBody.corePosition;
			int result;
			if ((Object.op_Implicit((Object)(object)self.LemurianBody.characterMotor) && self.LemurianBody.characterMotor.walkSpeed > 0f) || self.LemurianBody.moveSpeed > 0f)
			{
				Vector3 val3 = corePosition2 - corePosition;
				result = ((((Vector3)(ref val3)).magnitude > Misc_LeashDistance) ? 1 : 0);
			}
			else
			{
				result = 0;
			}
			return (byte)result != 0;
		}

		private void OnHatchEgg(orig_SummonLemurian orig, LemurianEggController self, PickupIndex pickupIndex)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			ItemIndex itemIndex = ((PickupIndex)(ref pickupIndex)).itemIndex;
			MasterSummon val = new MasterSummon();
			val.masterPrefab = Evo_BaseMaster;
			val.position = ((Component)self).transform.position;
			val.rotation = ((Component)self).transform.rotation;
			Interactor interactor = self.interactor;
			val.summonerBodyObject = (((Object)(object)interactor != (Object)null) ? ((Component)interactor).gameObject : null);
			val.ignoreTeamMemberLimit = true;
			val.useAmbientLevel = true;
			CharacterMaster val2 = val.Perform();
			EffectData val3 = new EffectData
			{
				origin = ((Component)self).gameObject.transform.position
			};
			DevotionInventoryController orCreateDevotionInventoryController = DevotionInventoryController.GetOrCreateDevotionInventoryController(interactor);
			if (Object.op_Implicit((Object)(object)orCreateDevotionInventoryController) && Object.op_Implicit((Object)(object)val2))
			{
				if (itemIndex == Items.ExtraLife.itemIndex)
				{
					CreateTwin_ExtraLife(((Component)self).gameObject, Evo_BaseMaster, orCreateDevotionInventoryController);
					itemIndex = Items.ScrapRed.itemIndex;
				}
				else if (itemIndex == Items.ExtraLifeVoid.itemIndex)
				{
					CreateTwin_ExtraLifeVoid(((Component)self).gameObject, Evo_BaseMaster, orCreateDevotionInventoryController);
					itemIndex = Items.BearVoid.itemIndex;
				}
				SetDontDestroyOnLoad component = ((Component)val2).GetComponent<SetDontDestroyOnLoad>();
				if (!Object.op_Implicit((Object)(object)component))
				{
					component = ((Component)val2).gameObject.AddComponent<SetDontDestroyOnLoad>();
				}
				DevotedLemurianController val4 = ((Component)val2).GetComponent<DevotedLemurianController>();
				if (!Object.op_Implicit((Object)(object)val4))
				{
					val4 = ((Component)val2).gameObject.AddComponent<DevotedLemurianController>();
				}
				val4.InitializeDevotedLemurian(itemIndex, orCreateDevotionInventoryController);
				Util.PlaySound(self.sfxLocator.openSound, ((Component)self).gameObject);
				EffectManager.SpawnEffect(VFX_Hatch, val3, true);
				orCreateDevotionInventoryController.UpdateAllMinions(false);
			}
			Object.Destroy((Object)(object)((Component)self).gameObject);
		}

		private void EvolveDevotedLemurian(DevotedLemurianController controller, int levelAmount)
		{
			//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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Invalid comparison between Unknown and I4
			//IL_00e1: 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)
			if (!NetworkServer.active)
			{
				return;
			}
			CharacterBody lemurianBody = controller.LemurianBody;
			CharacterMaster lemurianMaster = controller._lemurianMaster;
			bool alive = lemurianBody.healthComponent.alive;
			int devotedEvolutionLevel = controller.DevotedEvolutionLevel;
			int devotedEvolutionLevel2 = controller.DevotedEvolutionLevel;
			devotedEvolutionLevel2 += levelAmount;
			if (EvoMax > -1)
			{
				Math.Min(EvoMax, devotedEvolutionLevel2);
			}
			Math.Max(0, devotedEvolutionLevel2);
			if (devotedEvolutionLevel2 == controller.DevotedEvolutionLevel)
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)lemurianBody))
			{
				Util.PlaySound(SFX_Evolve, ((Component)lemurianBody).gameObject);
			}
			controller.DevotedEvolutionLevel = devotedEvolutionLevel2;
			string text = FindLatestEvoBody(devotedEvolutionLevel2 + 1);
			int num = FindLatestEvoElite(devotedEvolutionLevel2 + 1, devotedEvolutionLevel + 1);
			BodyIndex val = BodyCatalog.FindBodyIndex(text);
			if ((int)val > -1)
			{
				if (alive)
				{
					if (val != lemurianBody.bodyIndex)
					{
						lemurianMaster.TransformBody(text);
					}
				}
				else
				{
					lemurianMaster.bodyPrefab = BodyCatalog.FindBodyPrefab(text);
				}
			}
			if (num > 0)
			{
				GenerateEliteBuff(lemurianBody, controller, num);
			}
			else if (num == 0)
			{
				lemurianBody.inventory.SetEquipmentIndex((EquipmentIndex)(-1));
			}
		}

		private string FindLatestEvoBody(int newLevel)
		{
			int num = -1;
			string result = Evo_BaseBody_Raw;
			for (int i = 0; i < Evo_BodyStages.Count; i++)
			{
				if (Evo_BodyStages[i].EvolutionStage > num && Evo_BodyStages[i].EvolutionStage <= newLevel)
				{
					num = Evo_BodyStages[i].EvolutionStage;
					result = Evo_BodyStages[i].BodyName;
				}
			}
			return result;
		}

		private int FindLatestEvoElite(int newLevel, int oldLevel)
		{
			int num = -1;
			for (int i = 0; i < Evo_EliteStages.Count; i++)
			{
				if (Evo_EliteStages[i].EvolutionStage > num && Evo_EliteStages[i].EvolutionStage <= oldLevel)
				{
					num = Evo_EliteStages[i].EvolutionStage;
				}
			}
			int num2 = -1;
			int result = 0;
			for (int j = 0; j < Evo_EliteStages.Count; j++)
			{
				if (Evo_EliteStages[j].EvolutionStage > num2 && Evo_EliteStages[j].EvolutionStage <= newLevel)
				{
					num2 = Evo_EliteStages[j].EvolutionStage;
					result = Evo_EliteStages[j].TierIndex;
				}
			}
			if (num != num2)
			{
				return result;
			}
			return -1;
		}

		private void GenerateEliteBuff(CharacterBody body, DevotedLemurianController controller, int eliteTier)
		{
			if (!NetworkServer.active)
			{
				return;
			}
			List<int> list = new List<int>();
			for (int i = 0; i < EliteAspects.Count; i++)
			{
				int[] array = EliteAspects[i];
				if (array[1] <= eliteTier)
				{
					list.Add(array[0]);
				}
			}
			if (list.Count > 0)
			{
				int index = Random.Range(0, list.Count);
				body.inventory.SetEquipmentIndex((EquipmentIndex)list[index]);
			}
		}

		private void CreateEliteList()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			EliteAspects = new List<int[]>();
			for (int i = 0; i < EliteList.Length; i++)
			{
				if (EliteList[i] > 0)
				{
					EliteDef eliteDef = EliteCatalog.GetEliteDef((EliteIndex)i);
					if (Object.op_Implicit((Object)(object)eliteDef) && eliteDef.IsAvailable())
					{
						RegisterEliteAspect(eliteDef.eliteEquipmentDef.equipmentIndex, EliteList[i]);
					}
				}
			}
		}

		private void RegisterEliteAspect(EquipmentIndex aspect, int tier)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected I4, but got Unknown
			EliteAspects.Add(new int[2]
			{
				(int)aspect,
				tier
			});
		}

		private void PlaceDevotionEgg(Vector3 spawnLoc)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0026: 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_0062: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//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)
			if ((Object)(object)EggSpawnCard != (Object)null)
			{
				RaycastHit val = default(RaycastHit);
				if (Physics.Raycast(spawnLoc + Vector3.up * 1f, Vector3.down, ref val, float.PositiveInfinity, LayerMask.GetMask(new string[1] { "World" })))
				{
					spawnLoc = ((RaycastHit)(ref val)).point;
				}
				DirectorPlacementRule val2 = new DirectorPlacementRule
				{
					placementMode = (PlacementMode)0,
					position = spawnLoc
				};
				DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(EggSpawnCard, val2, new Xoroshiro128Plus(0uL)));
			}
		}

		private void CreateTwin_ExtraLife(GameObject targetLocation, GameObject masterPrefab, DevotionInventoryController devotionInventoryController)
		{
			//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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			ItemIndex itemIndex = Items.ExtraLifeConsumed.itemIndex;
			if (!Object.op_Implicit((Object)(object)devotionInventoryController))
			{
				return;
			}
			CharacterMaster summonerMaster = devotionInventoryController._summonerMaster;
			if (!Object.op_Implicit((Object)(object)summonerMaster))
			{
				return;
			}
			CharacterBody body = summonerMaster.GetBody();
			if (!Object.op_Implicit((Object)(object)body))
			{
				return;
			}
			MasterSummon val = new MasterSummon();
			val.masterPrefab = masterPrefab;
			val.position = targetLocation.transform.position;
			val.rotation = targetLocation.transform.rotation;
			val.summonerBodyObject = ((Component)body).gameObject;
			val.ignoreTeamMemberLimit = true;
			val.useAmbientLevel = true;
			CharacterMaster val2 = val.Perform();
			if (Object.op_Implicit((Object)(object)val2))
			{
				DevotedLemurianController val3 = ((Component)val2).GetComponent<DevotedLemurianController>();
				if (!Object.op_Implicit((Object)(object)val3))
				{
					val3 = ((Component)val2).gameObject.AddComponent<DevotedLemurianController>();
				}
				val3.InitializeDevotedLemurian(itemIndex, devotionInventoryController);
			}
		}

		private void CreateTwin_ExtraLifeVoid(GameObject targetLocation, GameObject masterPrefab, DevotionInventoryController devotionInventoryController)
		{
			//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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			ItemIndex itemIndex = Items.BleedOnHitVoid.itemIndex;
			if (!Object.op_Implicit((Object)(object)devotionInventoryController))
			{
				return;
			}
			CharacterMaster summonerMaster = devotionInventoryController._summonerMaster;
			if (!Object.op_Implicit((Object)(object)summonerMaster))
			{
				return;
			}
			CharacterBody body = summonerMaster.GetBody();
			if (!Object.op_Implicit((Object)(object)body))
			{
				return;
			}
			MasterSummon val = new MasterSummon();
			val.masterPrefab = masterPrefab;
			val.position = targetLocation.transform.position;
			val.rotation = targetLocation.transform.rotation;
			val.summonerBodyObject = ((Component)body).gameObject;
			val.ignoreTeamMemberLimit = true;
			val.useAmbientLevel = true;
			CharacterMaster val2 = val.Perform();
			if (Object.op_Implicit((Object)(object)val2))
			{
				DevotedLemurianController val3 = ((Component)val2).GetComponent<DevotedLemurianController>();
				if (!Object.op_Implicit((Object)(object)val3))
				{
					val3 = ((Component)val2).gameObject.AddComponent<DevotedLemurianController>();
				}
				val3.InitializeDevotedLemurian(itemIndex, devotionInventoryController);
			}
		}
	}
	public class EliteEvolutionStage
	{
		public int TierIndex = 0;

		public int EvolutionStage = -1;
	}
	public class BodyEvolutionStage
	{
		public string BodyName = "LemurianBody";

		public int EvolutionStage = -1;
	}
	public class LightChanges
	{
		internal static string BlackList_TierList_Raw;

		internal static string BlackList_ItemList_Raw;

		internal static string ItemDrop_CustomDropList_Raw;

		internal static bool Blacklist_Enable = false;

		internal static bool BlackList_Filter_CannotCopy = true;

		internal static bool BlackList_Filter_Scrap = true;

		internal static List<ItemTier> BlackList_TierList;

		internal static List<ItemDef> BlackList_ItemList;

		internal static bool FilterItems = false;

		internal static bool FilterTiers = false;

		internal static bool ItemDrop_Enable = false;

		internal static ItemIndex[] ItemDrop_CustomDropList;

		internal static int ItemDrop_Type = 0;

		internal static bool Misc_FixEvo = true;

		internal static GameObject ItemTakeOrb = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/OrbEffects/ItemTakenOrbEffect");

		public LightChanges()
		{
			ClampConfig();
			UpdateItemDef();
			Hooks();
		}

		private void ClampConfig()
		{
			Math.Max(0, ItemDrop_Type);
			Math.Min(2, ItemDrop_Type);
		}

		private void UpdateItemDef()
		{
			//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)
			MainPlugin.ModLogger.LogInfo((object)"Changing Lemurian Harness");
			ItemDef val = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/CU8/Harness/items.LemurianHarness.asset").WaitForCompletion();
			if (Object.op_Implicit((Object)(object)val))
			{
				List<ItemTag> list = val.tags.ToList();
				list.Add((ItemTag)11);
				list.Add((ItemTag)13);
				list.Add((ItemTag)12);
				val.tags = list.ToArray();
			}
		}

		internal static void PostLoad()
		{
			//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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Invalid comparison between Unknown and I4
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Invalid comparison between Unknown and I4
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Expected I4, but got Unknown
			if (!Blacklist_Enable)
			{
				return;
			}
			BlackList_ItemList = new List<ItemDef>();
			string[] array = BlackList_ItemList_Raw.Split(new char[1] { ',' });
			for (int i = 0; i < array.Length; i++)
			{
				ItemIndex val = ItemCatalog.FindItemIndex(array[i].Trim());
				if ((int)val > -1)
				{
					ItemDef itemDef = ItemCatalog.GetItemDef(val);
					if (Object.op_Implicit((Object)(object)itemDef))
					{
						BlackList_ItemList.Add(itemDef);
						FilterItems = true;
					}
				}
			}
			BlackList_TierList = new List<ItemTier>();
			array = BlackList_TierList_Raw.Split(new char[1] { ',' });
			for (int j = 0; j < array.Length; j++)
			{
				ItemTierDef val2 = ItemTierCatalog.FindTierDef(array[j].Trim());
				if (Object.op_Implicit((Object)(object)val2))
				{
					BlackList_TierList.Add(val2.tier);
					FilterTiers = true;
				}
			}
			ItemDrop_CustomDropList = (ItemIndex[])(object)new ItemIndex[ItemTierCatalog.allItemTierDefs.Length];
			for (int k = 0; k < ItemDrop_CustomDropList.Length; k++)
			{
				ItemDrop_CustomDropList[k] = (ItemIndex)(-1);
			}
			array = ItemDrop_CustomDropList_Raw.Split(new char[1] { ',' });
			for (int l = 0; l + 1 < array.Length; l += 2)
			{
				ItemTierDef val3 = ItemTierCatalog.FindTierDef(array[l].Trim());
				if (!Object.op_Implicit((Object)(object)val3))
				{
					continue;
				}
				int itemTierIndex = GetItemTierIndex(val3);
				if (itemTierIndex > -1 && itemTierIndex < ItemDrop_CustomDropList.Length)
				{
					ItemIndex val4 = ItemCatalog.FindItemIndex(array[l + 1].Trim());
					if ((int)val4 > -1)
					{
						ItemDrop_CustomDropList[itemTierIndex] = (ItemIndex)(int)val4;
					}
				}
				else
				{
					MainPlugin.ModLogger.LogWarning((object)string.Format("{0}Could not find Tier '{1}' for Custom Drop List.", "[DevotionConfig] ", array[l].Trim()));
				}
			}
		}

		private unsafe static int GetItemTierIndex(ItemTierDef itemTier)
		{
			//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_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)
			for (int i = 0; i < ItemTierCatalog.allItemTierDefs.Length; i++)
			{
				if ((Object)Unsafe.Read<object>((void*)ItemTierCatalog.allItemTierDefs[i]) == (Object)(object)itemTier)
				{
					return i;
				}
			}
			return -1;
		}

		private void Hooks()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			if (Blacklist_Enable)
			{
				PickupPickerController.SetOptionsFromInteractor += new hook_SetOptionsFromInteractor(SetPickupPicker);
			}
			if (ItemDrop_Enable)
			{
				DevotionInventoryController.DropScrapOnDeath += new hook_DropScrapOnDeath(DropScrapOnDeath);
			}
			if (Misc_FixEvo)
			{
				DevotionInventoryController.OnBossGroupDefeatedServer += new hook_OnBossGroupDefeatedServer(OldBossGroupDefeatedServer);
				BossGroup.onBossGroupDefeatedServer += BossGroupDefeatedServer;
				LemurianEggController.CreateItemTakenOrb += new hook_CreateItemTakenOrb(CreateItemTakeOrb_Egg);
			}
		}

		private void BossGroupDefeatedServer(BossGroup group)
		{
			if (!SceneCatalog.GetSceneDefForCurrentScene().needSkipDevotionRespawn)
			{
				DevotionInventoryController.ActivateDevotedEvolution();
			}
		}

		private void OldBossGroupDefeatedServer(orig_OnBossGroupDefeatedServer orig, BossGroup bossGroup)
		{
		}

		private void CreateItemTakeOrb_Egg(orig_CreateItemTakenOrb orig, LemurianEggController self, Vector3 effectOrigin, GameObject targetObject, ItemIndex itemIndex)
		{
			//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)
			DevotionInventoryController.s_effectPrefab = ItemTakeOrb;
			orig.Invoke(self, effectOrigin, targetObject, itemIndex);
		}

		private void DropScrapOnDeath(orig_DropScrapOnDeath orig, DevotionInventoryController self, ItemIndex devotionItem, CharacterBody minionBody)
		{
			//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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_00c1: 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_00d2: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_005f: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			if (ItemDrop_Type == 2)
			{
				return;
			}
			PickupIndex val = PickupIndex.none;
			ItemDef itemDef = ItemCatalog.GetItemDef(devotionItem);
			if ((Object)(object)itemDef != (Object)null)
			{
				int itemTierIndex = GetItemTierIndex(ItemTierCatalog.GetItemTierDef(itemDef.tier));
				if (ItemDrop_Type == 1)
				{
					if (itemTierIndex > -1)
					{
						val = PickupCatalog.FindPickupIndex(devotionItem);
					}
				}
				else if (itemTierIndex > -1 && ItemDrop_CustomDropList != null && itemTierIndex < ItemDrop_CustomDropList.Length)
				{
					val = PickupCatalog.FindPickupIndex(ItemDrop_CustomDropList[itemTierIndex]);
				}
			}
			if (val != PickupIndex.none)
			{
				Vector3 val2 = Quaternion.AngleAxis(Random.Range(0f, 360f), Vector3.up) * minionBody.transform.forward;
				val2.y += 8f;
				PickupDropletController.CreatePickupDroplet(val, minionBody.footPosition + Vector3.up * 1f, ((Vector3)(ref val2)).normalized * 25f);
			}
		}

		private void SetPickupPicker(orig_SetOptionsFromInteractor orig, PickupPickerController self, Interactor activator)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: 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_0168: Unknown result type (might be due to invalid IL or missing references)
			LemurianEggController component = ((Component)self).GetComponent<LemurianEggController>();
			if (Object.op_Implicit((Object)(object)component))
			{
				if (!Object.op_Implicit((Object)(object)activator))
				{
					return;
				}
				CharacterBody component2 = ((Component)activator).GetComponent<CharacterBody>();
				if (!Object.op_Implicit((Object)(object)component2))
				{
					return;
				}
				Inventory inventory = component2.inventory;
				if (!Object.op_Implicit((Object)(object)inventory))
				{
					return;
				}
				List<Option> list = new List<Option>();
				for (int i = 0; i < inventory.itemAcquisitionOrder.Count; i++)
				{
					ItemIndex val = inventory.itemAcquisitionOrder[i];
					ItemDef itemDef = ItemCatalog.GetItemDef(val);
					ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(itemDef.tier);
					PickupIndex pickupIndex = PickupCatalog.FindPickupIndex(val);
					if (Object.op_Implicit((Object)(object)itemTierDef) && !itemDef.hidden && itemDef.canRemove && (!FilterTiers || !BlackList_TierList.Contains(itemTierDef.tier)) && (!BlackList_Filter_Scrap || (!itemDef.ContainsTag((ItemTag)10) && !itemDef.ContainsTag((ItemTag)14))) && (!BlackList_Filter_CannotCopy || !itemDef.ContainsTag((ItemTag)13)) && (!FilterItems || !BlackList_ItemList.Contains(itemDef)))
					{
						list.Add(new Option
						{
							available = true,
							pickupIndex = pickupIndex
						});
					}
				}
				self.SetOptionsServer(list.ToArray());
			}
			else
			{
				orig.Invoke(self, activator);
			}
		}
	}
}