Decompiled source of Augmentum v1.1.2

Augmentum/BransItems.dll

Decompiled 2 months 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.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BransItems.Modules.ColorCatalogEntry;
using BransItems.Modules.Compatability;
using BransItems.Modules.ItemTiers;
using BransItems.Modules.ItemTiers.CoreTier;
using BransItems.Modules.ItemTiers.HighlanderTier;
using BransItems.Modules.Pickups;
using BransItems.Modules.Pickups.EliteEquipments;
using BransItems.Modules.Pickups.Items.CoreItems;
using BransItems.Modules.Pickups.Items.Essences;
using BransItems.Modules.Pickups.Items.HighlanderItems;
using BransItems.Modules.Pickups.Items.NoTier;
using BransItems.Modules.Pickups.Items.Tier1;
using BransItems.Modules.Pickups.Items.Tier2;
using BransItems.Modules.Pickups.Items.Tier3;
using BransItems.Modules.StandaloneBuffs;
using BransItems.Modules.Utils;
using EntityStates.VagrantMonster;
using HG;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using On.RoR2;
using On.RoR2.Items;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Projectile;
using ShareSuite;
using TMPro;
using TPDespair.ZetAspects;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BransItems")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+22f6b04c979267ca7f3ba7a8c25789771c0d3540")]
[assembly: AssemblyProduct("BransItems")]
[assembly: AssemblyTitle("BransItems")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BransItems
{
	[BepInDependency("com.bepis.r2api", "5.1.1")]
	[NetworkCompatibility(/*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.BrandonRosa.Augmentum", "Augmentum", "1.1.2")]
	public class BransItems : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Init <0>__RegisterVoidPairings;
		}

		public const string ModGuid = "com.BrandonRosa.Augmentum";

		public const string ModName = "Augmentum";

		public const string ModVer = "1.1.2";

		internal static ManualLogSource ModLogger;

		public static ConfigFile AugConfig;

		public static ConfigFile AugBackupConfig;

		public static bool _preVersioning = false;

		public static AssetBundle MainAssets;

		public List<BuffBase> Buffs = new List<BuffBase>();

		public List<ItemBase> Items = new List<ItemBase>();

		public List<EquipmentBase> Equipments = new List<EquipmentBase>();

		public List<ItemTierBase> ItemTiers = new List<ItemTierBase>();

		public List<EliteEquipmentBase> EliteEquipments = new List<EliteEquipmentBase>();

		public List<ArtifactBase> Artifacts = new List<ArtifactBase>();

		public static HashSet<ItemDef> BlacklistedFromPrinter = new HashSet<ItemDef>();

		public static Dictionary<ItemBase, bool> ItemStatusDictionary = new Dictionary<ItemBase, bool>();

		public static Dictionary<EquipmentBase, bool> EquipmentStatusDictionary = new Dictionary<EquipmentBase, bool>();

		public static Dictionary<BuffBase, bool> BuffStatusDictionary = new Dictionary<BuffBase, bool>();

		public static Dictionary<EliteEquipmentBase, bool> EliteEquipmentStatusDictionary = new Dictionary<EliteEquipmentBase, bool>();

		public static Dictionary<ArtifactBase, bool> ArtifactStatusDictionary = new Dictionary<ArtifactBase, bool>();

		public static ConfigEntry<bool> enableAutoConfig { get; set; }

		public static ConfigEntry<string> latestVersion { get; set; }

		public static string EssenceKeyword => "<color=#" + ColorCatalog.GetColorHexString(Colors.TempCoreLight) + ">Essence</color>";

		public static string EssencesKeyword => "<color=#" + ColorCatalog.GetColorHexString(Colors.TempCoreLight) + ">Essences</color>";

		public static string CoreColorString => "<color=#" + ColorCatalog.GetColorHexString(Colors.TempCoreLight) + ">";

		public void Awake()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			ModLogger = ((BaseUnityPlugin)this).Logger;
			AugConfig = ((BaseUnityPlugin)this).Config;
			AugBackupConfig = new ConfigFile(Paths.ConfigPath + "\\com.BrandonRosa.Augmentum..Backup.cfg", true);
			AugBackupConfig.Bind<string>(": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :", ": DO NOT MODIFY THIS FILES CONTENTS :");
			enableAutoConfig = AugConfig.Bind<bool>("Config", "Enable Auto Config Sync", true, "Disabling this would stop Augmentum from syncing config whenever a new version is found.");
			_preVersioning = !((Dictionary<ConfigDefinition, string>)AccessTools.DeclaredPropertyGetter(typeof(ConfigFile), "OrphanedEntries").Invoke(AugConfig, null)).Keys.Any((ConfigDefinition x) => x.Key == "Latest Version");
			latestVersion = AugConfig.Bind<string>("Config", "Latest Version", "1.1.2", "DO NOT CHANGE THIS");
			if (enableAutoConfig.Value && (_preVersioning || latestVersion.Value != "1.1.2"))
			{
				latestVersion.Value = "1.1.2";
				ConfigManager.VersionChanged = true;
				ModLogger.LogInfo((object)"Config Autosync Enabled.");
			}
		}

		private void Start()
		{
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Expected O, but got Unknown
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("BransItems.bransitems_assets"))
			{
				MainAssets = AssetBundle.LoadFromStream(stream);
			}
			Colors.Init();
			ItemTierPickupVFXHelper.SystemInitializer();
			bool flag = true;
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(ItemTierBase))
				select type;
			ModLogger.LogInfo((object)"-----------------ITEMTIERS---------------------");
			foreach (Type item in enumerable)
			{
				ItemTierBase itemTierBase = (ItemTierBase)Activator.CreateInstance(item);
				bool flag2 = true;
				itemTierBase.Init();
				ModLogger.LogInfo((object)("ItemTier: " + itemTierBase.TierName + " Initialized!"));
			}
			bool flag3 = true;
			IEnumerable<Type> enumerable2 = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(BuffBase))
				select type;
			ModLogger.LogInfo((object)"--------------BUFFS---------------------");
			foreach (Type item2 in enumerable2)
			{
				BuffBase buffBase = (BuffBase)Activator.CreateInstance(item2);
				if (ValidateBuff(buffBase, Buffs))
				{
					buffBase.Init(((BaseUnityPlugin)this).Config);
					ModLogger.LogInfo((object)("Buff: " + buffBase.BuffName + " Initialized!"));
				}
			}
			if (!ConfigManager.ConfigOption("Items", "Disable All Items?", defaultvalue: false, "Do you wish to disable every item in BransItems?"))
			{
				IEnumerable<Type> enumerable3 = from type in Assembly.GetExecutingAssembly().GetTypes()
					where !type.IsAbstract && type.IsSubclassOf(typeof(ItemBase))
					select type;
				ModLogger.LogInfo((object)"----------------------ITEMS--------------------");
				foreach (Type item3 in enumerable3)
				{
					ItemBase itemBase = (ItemBase)Activator.CreateInstance(item3);
					if (!itemBase.BlacklistFromPreLoad && ValidateItem(itemBase, Items))
					{
						itemBase.Init(((BaseUnityPlugin)this).Config);
						ModLogger.LogInfo((object)("Item: " + itemBase.ItemName + " Initialized!"));
					}
				}
				object obj = <>O.<0>__RegisterVoidPairings;
				if (obj == null)
				{
					hook_Init val = ItemBase.RegisterVoidPairings;
					<>O.<0>__RegisterVoidPairings = val;
					obj = (object)val;
				}
				ContagiousItemManager.Init += (hook_Init)obj;
			}
			if (!ConfigManager.ConfigOption("Equipment", "Disable All Equipment?", defaultvalue: false, "Do you wish to disable every equipment in BransItems?"))
			{
				IEnumerable<Type> enumerable4 = from type in Assembly.GetExecutingAssembly().GetTypes()
					where !type.IsAbstract && type.IsSubclassOf(typeof(EquipmentBase))
					select type;
				ModLogger.LogInfo((object)"-----------------EQUIPMENT---------------------");
				foreach (Type item4 in enumerable4)
				{
					EquipmentBase equipmentBase = (EquipmentBase)Activator.CreateInstance(item4);
					if (ValidateEquipment(equipmentBase, Equipments))
					{
						equipmentBase.Init(((BaseUnityPlugin)this).Config);
						ModLogger.LogInfo((object)("Equipment: " + equipmentBase.EquipmentName + " Initialized!"));
					}
				}
			}
			IEnumerable<Type> enumerable5 = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(EliteEquipmentBase))
				select type;
			ModLogger.LogInfo((object)"-------------ELITE EQUIPMENT---------------------");
			foreach (Type item5 in enumerable5)
			{
				EliteEquipmentBase eliteEquipmentBase = (EliteEquipmentBase)Activator.CreateInstance(item5);
				if (ValidateEliteEquipment(eliteEquipmentBase, EliteEquipments))
				{
					eliteEquipmentBase.Init(((BaseUnityPlugin)this).Config);
					ModLogger.LogInfo((object)("Elite Equipment: " + eliteEquipmentBase.EliteEquipmentName + " Initialized!"));
				}
			}
			IEnumerable<Type> enumerable6 = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(ArtifactBase))
				select type;
			ModLogger.LogInfo((object)"-------------ARTIFACTS---------------------");
			foreach (Type item6 in enumerable6)
			{
				ArtifactBase artifactBase = (ArtifactBase)Activator.CreateInstance(item6);
				if (ValidateArtifact(artifactBase, Artifacts))
				{
					artifactBase.Init(((BaseUnityPlugin)this).Config);
					ModLogger.LogInfo((object)("Artifact: " + artifactBase.ArtifactName + " Initialized!"));
				}
			}
			ModLogger.LogInfo((object)"-------------COMPATIBILITY---------------------");
			ValidateModCompatability();
		}

		private void ValidateModCompatability()
		{
			string defaultvalue = "ITEM_MINI_MATROYSHKA,ITEM_ABYSSAL_BEACON,ITEM_AUGMENTED_CONTACT,ITEM_CURVED_HORN,ITEM_GOAT_LEG,ITEM_MEDIUM_MATROYSHKA,ITEM_CHARM_OF_DESIRES,ITEM_MASSIVE_MATROYSHKA,ITEM_BLOODBURST_CLAM,ITEM_DISCOVERY_MEDALLION,ITEM_MEGA_MATROYSHKA";
			bool flag = ConfigManager.ConfigOption("Mod Compatability: ShareSuite", "Enable Compatability Patches?", defaultvalue: true, "Attempt to patch ShareSuite (if installed) to work with this mod?");
			string customBlacklist = ConfigManager.ConfigOption("Mod Compatability: ShareSuite", "ShareSuite Blacklist", defaultvalue, "Add items to ShareSuite blacklist?");
			if (ModCompatability.ShareSuiteCompat.IsShareSuiteInstalled && flag)
			{
				ModLogger.LogInfo((object)"ModCompatability: ShareSuite Recognized!");
				ModCompatability.ShareSuiteCompat.AddTierToShareSuite();
				ModLogger.LogInfo((object)"ModCompatability: ShareSuite CoreTier added to Whitelist!");
				ModCompatability.ShareSuiteCompat.AddBransItemsBlacklist(customBlacklist);
				ModLogger.LogInfo((object)"ModCompatability: ShareSuite Blacklist added to Whitelist!");
			}
			bool flag2 = ConfigManager.ConfigOption("Mod Compatability: HighItemVizability", "Enable Compatability Patches?", defaultvalue: true, "Attempt to patch HighItemVizability (if installed) to work with this mod?");
			if (ModCompatability.HighItemVizabilityCompat.IsHighItemVizabilityInstalled && flag2)
			{
				ModLogger.LogInfo((object)"ModCompatability: HighItemVizability Recognized!");
			}
			bool flag3 = ConfigManager.ConfigOption("Mod Compatability: ProperSave", "Enable Compatability Patches?", defaultvalue: true, "Attempt to add Propersave compatability (if installed)?");
			if (ModCompatability.ProperSaveCompat.IsProperSaveInstalled && flag3)
			{
				ModLogger.LogInfo((object)"ModCompatability: ProperSave Recognized!");
				ModCompatability.ProperSaveCompat.AddProperSaveFunctionality = true;
			}
			bool flag4 = ConfigManager.ConfigOption("Mod Compatability: ZetAspects", "Enable Compatability Patches?", defaultvalue: true, "Attempt to force ZetAspects compatability (if installed)?");
			if (ModCompatability.ZetAspectsCompat.IsZetAspectsInstalled && flag4)
			{
				ModLogger.LogInfo((object)"ModCompatability: ZetAspects Recognized!");
				ModCompatability.ZetAspectsCompat.ForceZetAspectCompat();
			}
			bool flag5 = ConfigManager.ConfigOption("Mod Compatability: Judgment", "Enable Compatability Patches?", defaultvalue: true, "Attempt to add Judgment compatability (if installed)?");
			if (ModCompatability.JudgementCompat.IsJudgementInstalled && flag5)
			{
				ModLogger.LogInfo((object)"ModCompatability: Judgment Recognized!");
				ModCompatability.JudgementCompat.AddJudgementCompat = true;
			}
			if (flag || flag2 || flag3)
			{
				ModCompatability.FinishedLoading();
			}
		}

		public bool ValidateItem(ItemBase item, List<ItemBase> itemList)
		{
			bool flag = ConfigManager.ConfigOption("Item: " + item.ConfigItemName, "Enable Item?", defaultvalue: true, "Should this item appear in runs?");
			bool flag2 = ConfigManager.ConfigOption("Item: " + item.ConfigItemName, "Blacklist Item from AI Use?", defaultvalue: false, "Should the AI not be able to obtain this item?");
			bool flag3 = ConfigManager.ConfigOption("Item: " + item.ConfigItemName, "Blacklist Item from Printers?", defaultvalue: false, "Should the printers be able to print this item?");
			bool flag4 = ConfigManager.ConfigOption("Item: " + item.ConfigItemName, "Require Unlock", defaultvalue: true, "Should we require this item to be unlocked before it appears in runs? (Will only affect items with associated unlockables.)");
			ItemStatusDictionary.Add(item, flag);
			if (flag)
			{
				itemList.Add(item);
				if (flag2)
				{
					item.AIBlacklisted = true;
				}
				if (flag3)
				{
					item.PrinterBlacklisted = true;
				}
			}
			return flag;
		}

		public bool ValidateBuff(BuffBase buff, List<BuffBase> buffList)
		{
			BuffStatusDictionary.Add(buff, ((Behaviour)this).enabled);
			bool flag = true;
			buffList.Add(buff);
			return ((Behaviour)this).enabled;
		}

		public bool ValidateEquipment(EquipmentBase equipment, List<EquipmentBase> equipmentList)
		{
			bool flag = ConfigManager.ConfigOption("Equipment: " + equipment.EquipmentName, "Enable Equipment?", defaultvalue: true, "Should this equipment appear in runs?");
			EquipmentStatusDictionary.Add(equipment, flag);
			if (flag)
			{
				equipmentList.Add(equipment);
				return true;
			}
			return false;
		}

		public bool ValidateEliteEquipment(EliteEquipmentBase eliteEquipment, List<EliteEquipmentBase> eliteEquipmentList)
		{
			bool flag = ConfigManager.ConfigOption("Elite: " + eliteEquipment.EliteModifier, "Enable Elite Equipment?", defaultvalue: true, "Should this elite equipment appear in runs? If disabled, the associated elite will not appear in runs either.");
			EliteEquipmentStatusDictionary.Add(eliteEquipment, flag);
			if (flag)
			{
				eliteEquipmentList.Add(eliteEquipment);
				return true;
			}
			return false;
		}

		public bool ValidateArtifact(ArtifactBase artifact, List<ArtifactBase> artifactList)
		{
			bool flag = ConfigManager.ConfigOption("Artifact: " + artifact.ArtifactName, "Enable Artifact?", defaultvalue: true, "Should this artifact appear in the menu? If disabled, the associated artifact will not appear.");
			ArtifactStatusDictionary.Add(artifact, flag);
			if (flag)
			{
				artifactList.Add(artifact);
				return true;
			}
			return false;
		}

		private void Update()
		{
			bool flag = false;
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}
namespace BransItems.Modules.Utils
{
	public static class ColorCatalogUtils
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_GetColor <0>__ColorCatalog_GetColor;

			public static hook_GetColorHexString <1>__ColorCatalog_GetColorHexString;
		}

		private static bool _hookEnabled = false;

		private static List<Color32> indexToColor32 = new List<Color32>();

		private static List<string> indexToHexString = new List<string>();

		internal static void SetHooks()
		{
			//IL_001d: 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_0028: Expected O, but got Unknown
			//IL_003e: 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_0049: Expected O, but got Unknown
			if (!_hookEnabled)
			{
				object obj = <>O.<0>__ColorCatalog_GetColor;
				if (obj == null)
				{
					hook_GetColor val = ColorCatalog_GetColor;
					<>O.<0>__ColorCatalog_GetColor = val;
					obj = (object)val;
				}
				ColorCatalog.GetColor += (hook_GetColor)obj;
				object obj2 = <>O.<1>__ColorCatalog_GetColorHexString;
				if (obj2 == null)
				{
					hook_GetColorHexString val2 = ColorCatalog_GetColorHexString;
					<>O.<1>__ColorCatalog_GetColorHexString = val2;
					obj2 = (object)val2;
				}
				ColorCatalog.GetColorHexString += (hook_GetColorHexString)obj2;
				_hookEnabled = true;
			}
		}

		private static Color DamageColor_FindColor(orig_FindColor orig, DamageColorIndex colorIndex)
		{
			//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_0008: 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)
			return orig.Invoke(colorIndex);
		}

		private static string ColorCatalog_GetColorHexString(orig_GetColorHexString orig, ColorIndex colorIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_001a: 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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected I4, but got Unknown
			if ((int)colorIndex < 0)
			{
				return indexToHexString[-1 - colorIndex];
			}
			return orig.Invoke(colorIndex);
		}

		private static Color32 ColorCatalog_GetColor(orig_GetColor orig, ColorIndex colorIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_001a: 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_000f: 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_0016: Expected I4, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if ((int)colorIndex < 0)
			{
				return indexToColor32[-1 - colorIndex];
			}
			return orig.Invoke(colorIndex);
		}

		public static ColorIndex RegisterColor(Color color)
		{
			//IL_0016: 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_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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			SetHooks();
			int num = -indexToColor32.Count - 1;
			ColorIndex result = (ColorIndex)num;
			indexToColor32.Add(Color32.op_Implicit(color));
			indexToHexString.Add(Util.RGBToHex(Color32.op_Implicit(color)));
			return result;
		}
	}
	public class ConfigManager
	{
		internal static bool ConfigChanged;

		internal static bool VersionChanged;

		public static T HandleConfig<T>(ConfigEntryBase entry, ConfigFile config, string name)
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			MethodInfo methodInfo = (from x in typeof(ConfigFile).GetMethods()
				where x.Name == "Bind"
				select x).First();
			methodInfo = methodInfo.MakeGenericMethod(typeof(T));
			object[] parameters = new object[3]
			{
				(object)new ConfigDefinition(Regex.Replace(config.ConfigFilePath, "\\W", "") + " : " + entry.Definition.Section, name),
				entry.DefaultValue,
				(object)new ConfigDescription(entry.Description.Description, (AcceptableValueBase)null, Array.Empty<object>())
			};
			ConfigEntryBase val = (ConfigEntryBase)methodInfo.Invoke(config, parameters);
			if (BransItems._preVersioning)
			{
				entry.BoxedValue = entry.DefaultValue;
			}
			if (!ConfigEqual(val.DefaultValue, val.BoxedValue) && VersionChanged)
			{
				entry.BoxedValue = entry.DefaultValue;
				val.BoxedValue = val.DefaultValue;
			}
			return default(T);
		}

		private static bool ConfigEqual(object a, object b)
		{
			if (a.Equals(b))
			{
				return true;
			}
			if (float.TryParse(a.ToString(), out var result) && float.TryParse(b.ToString(), out var result2) && (double)Mathf.Abs(result - result2) < 0.0001)
			{
				return true;
			}
			return false;
		}

		public static T ConfigOption<T>(string section, string key, T defaultvalue, string description)
		{
			ConfigEntry<T> val = BransItems.AugConfig.Bind<T>(section, key, defaultvalue, description);
			HandleConfig<T>((ConfigEntryBase)(object)val, BransItems.AugBackupConfig, key);
			return val.Value;
		}
	}
	public static class EffectHelpers
	{
		public static void SetParticleSystemColorOverTime(ref ParticleSystem particleSystem, MinMaxGradient color)
		{
			//IL_0003: 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_000b: Unknown result type (might be due to invalid IL or missing references)
			ColorOverLifetimeModule colorOverLifetime = particleSystem.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = color;
		}

		public static void SetParticleSystemLightColor(ref ParticleSystem particleSystem, Color color)
		{
			//IL_0003: 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_0010: Unknown result type (might be due to invalid IL or missing references)
			LightsModule lights = particleSystem.lights;
			((LightsModule)(ref lights)).light.color = color;
		}

		public static void SetTextureInParticleSystemRenderer(ref ParticleSystemRenderer particleSystemRenderer, string name, Texture2D texture)
		{
			((Renderer)particleSystemRenderer).GetMaterial().SetTexture(name, (Texture)(object)texture);
		}
	}
	public static class ExtensionMethods
	{
		public static void FilterElites(this BullseyeSearch search)
		{
			if (search.candidatesEnumerable.Any())
			{
				search.candidatesEnumerable = search.candidatesEnumerable.Where((CandidateInfo x) => Object.op_Implicit((Object)(object)x.hurtBox) && x.hurtBox.IsHurtboxAnElite()).ToList();
			}
		}

		public static void FilterOutItemWielders(this BullseyeSearch search, ItemDef item)
		{
			if (search.candidatesEnumerable.Any())
			{
				search.candidatesEnumerable = search.candidatesEnumerable.Where((CandidateInfo x) => Object.op_Implicit((Object)(object)x.hurtBox) && !x.hurtBox.DoesHurtboxHaveItem(item)).ToList();
			}
		}

		public static void FilterOutItemWielders(this BullseyeSearch search, List<ItemDef> items)
		{
			List<CandidateInfo> list = search.candidatesEnumerable.ToList();
			if (!list.Any())
			{
				return;
			}
			foreach (ItemDef item in items)
			{
				list.RemoveAll((CandidateInfo x) => Object.op_Implicit((Object)(object)x.hurtBox) && x.hurtBox.DoesHurtboxHaveItem(item));
			}
			search.candidatesEnumerable = list;
		}

		public static bool DoesHurtboxHaveItem(this HurtBox hurtbox, ItemDef item)
		{
			if (!Object.op_Implicit((Object)(object)hurtbox.healthComponent) || !Object.op_Implicit((Object)(object)hurtbox.healthComponent.body) || !Object.op_Implicit((Object)(object)item))
			{
				BransItems.ModLogger.LogError((object)"Can't check if the hurtbox has the item, some information is missing!");
				return false;
			}
			CharacterBody body = hurtbox.healthComponent.body;
			if (body.inventory.GetItemCount(item) > 0)
			{
				return true;
			}
			return false;
		}

		public static bool IsHurtboxAnElite(this HurtBox hurtbox)
		{
			if (!Object.op_Implicit((Object)(object)hurtbox.healthComponent) || !Object.op_Implicit((Object)(object)hurtbox.healthComponent.body))
			{
				BransItems.ModLogger.LogError((object)"Can't check if the hurtbox is an elite, some information is missing!");
				return false;
			}
			return hurtbox.healthComponent.body.isElite;
		}
	}
	internal class ItemHelpers
	{
		public class BossGroupDamageTakenTracker : MonoBehaviour
		{
			public float TotalDamageTaken;

			public static Dictionary<float, List<Action<BossGroup, DamageInfo, int>>> PercentLostActionList = new Dictionary<float, List<Action<BossGroup, DamageInfo, int>>>();

			private void Awake()
			{
				TotalDamageTaken = 0f;
			}

			public static void AddToPercentLostActionList(float percent, Action<BossGroup, DamageInfo, int> action)
			{
				if (!PercentLostActionList.ContainsKey(percent))
				{
					PercentLostActionList.Add(percent, new List<Action<BossGroup, DamageInfo, int>>());
				}
				if (PercentLostActionList[percent] == null)
				{
					PercentLostActionList[percent] = new List<Action<BossGroup, DamageInfo, int>>();
				}
				PercentLostActionList[percent].Add(action);
			}

			public void UpdateValues(BossGroup bossGroup, DamageInfo damageInfo, float damageTaken)
			{
				float totalDamageTaken = TotalDamageTaken;
				TotalDamageTaken += damageTaken;
				float[] array = PercentLostActionList.Keys.ToArray();
				for (int i = 0; i < PercentLostActionList.Count; i++)
				{
					float num = array[i];
					int num2 = (int)(TotalDamageTaken / (num * bossGroup.totalMaxObservedMaxHealth));
					int num3 = (int)(totalDamageTaken / (num * bossGroup.totalMaxObservedMaxHealth));
					int arg = num2 - num3;
					foreach (Action<BossGroup, DamageInfo, int> item in PercentLostActionList[num])
					{
						item(bossGroup, damageInfo, arg);
					}
				}
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_TakeDamage <0>__HealthComponent_TakeDamage;
		}

		private static bool _IsBossGroupDamageHookEnabled;

		public static bool IsBossGroupDamageHookEnabled => _IsBossGroupDamageHookEnabled;

		public static RendererInfo[] ItemDisplaySetup(GameObject obj, bool IgnoreOverlays = false, bool debugmode = false)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			List<Renderer> list = new List<Renderer>();
			MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>();
			if (componentsInChildren.Length != 0)
			{
				list.AddRange((IEnumerable<Renderer>)(object)componentsInChildren);
			}
			SkinnedMeshRenderer[] componentsInChildren2 = obj.GetComponentsInChildren<SkinnedMeshRenderer>();
			if (componentsInChildren2.Length != 0)
			{
				list.AddRange((IEnumerable<Renderer>)(object)componentsInChildren2);
			}
			RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[list.Count];
			for (int i = 0; i < list.Count; i++)
			{
				if (debugmode)
				{
				}
				array[i] = new RendererInfo
				{
					defaultMaterial = ((list[i] is SkinnedMeshRenderer) ? list[i].sharedMaterial : list[i].material),
					renderer = list[i],
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false
				};
			}
			return array;
		}

		public static string OrderManifestLoreFormatter(string deviceName, string estimatedDelivery, string sentTo, string trackingNumber, string devicePickupDesc, string shippingMethod, string orderDetails)
		{
			string[] value = new string[19]
			{
				"<align=left>Estimated Delivery:<indent=70%>Sent To:</indent></align>",
				"<align=left>" + estimatedDelivery + "<indent=70%>" + sentTo + "</indent></align>",
				"",
				"<indent=1%><style=cIsDamage><size=125%><u>  Shipping Details:</u></size></style></indent>",
				"",
				"<indent=2%>-Order: <style=cIsUtility>" + deviceName + "</style></indent>",
				"<indent=4%><style=cStack>Tracking Number:  " + trackingNumber + "</style></indent>",
				"",
				"<indent=2%>-Order Description: " + devicePickupDesc + "</indent>",
				"",
				"<indent=2%>-Shipping Method: <style=cIsHealth>" + shippingMethod + "</style></indent>",
				"",
				"",
				"",
				"<indent=2%>-Order Details: " + orderDetails + "</indent>",
				"",
				"",
				"",
				"<style=cStack>Delivery being brought to you by the brand new </style><style=cIsUtility>Orbital Drop-Crate System (TM)</style>. <style=cStack><u>No refunds.</u></style>"
			};
			return string.Join("\n", value);
		}

		public static void RefreshTimedBuffs(CharacterBody body, BuffDef buffDef, float duration)
		{
			//IL_0039: 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)
			if (!Object.op_Implicit((Object)(object)body) || body.GetBuffCount(buffDef) <= 0)
			{
				return;
			}
			foreach (TimedBuff timedBuff in body.timedBuffs)
			{
				if (buffDef.buffIndex == timedBuff.buffIndex)
				{
					timedBuff.timer = duration;
				}
			}
		}

		public static void RefreshTimedBuffs(CharacterBody body, BuffDef buffDef, float taperStart, float taperDuration)
		{
			//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)
			if (!Object.op_Implicit((Object)(object)body) || body.GetBuffCount(buffDef) <= 0)
			{
				return;
			}
			int num = 0;
			foreach (TimedBuff timedBuff in body.timedBuffs)
			{
				if (buffDef.buffIndex == timedBuff.buffIndex)
				{
					timedBuff.timer = taperStart + (float)num * taperDuration;
					num++;
				}
			}
		}

		public static void AddBuffAndDot(BuffDef buff, float duration, int stackCount, CharacterBody body)
		{
			//IL_0024: 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_002c: Invalid comparison between Unknown and I4
			//IL_0042: 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)
			DotIndex val = (DotIndex)Array.FindIndex(DotController.dotDefs, (DotDef dotDef) => (Object)(object)dotDef.associatedBuff == (Object)(object)buff);
			for (int i = 0; i < stackCount; i++)
			{
				if ((int)val != -1)
				{
					DotController.InflictDot(((Component)body).gameObject, ((Component)body).gameObject, val, duration, 0.25f, (uint?)null);
				}
				else if (NetworkServer.active)
				{
					body.AddTimedBuff(buff.buffIndex, duration);
				}
			}
		}

		public static DotIndex FindAssociatedDotForBuff(BuffDef buff)
		{
			//IL_0024: 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_0026: 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)
			return (DotIndex)Array.FindIndex(DotController.dotDefs, (DotDef dotDef) => (Object)(object)dotDef.associatedBuff == (Object)(object)buff);
		}

		public static T[] GetRandomSelectionFromArray<T>(List<T> itemList, int maxCount, Xoroshiro128Plus rng)
		{
			int num = Math.Min(itemList.Count, maxCount);
			T[] array = new T[num];
			HashSet<T> hashSet = new HashSet<T>();
			for (int i = 0; i < num; i++)
			{
				T val;
				do
				{
					val = itemList[rng.RangeInt(0, itemList.Count)];
				}
				while (hashSet.Contains(val));
				array[i] = val;
				hashSet.Add(val);
			}
			return array;
		}

		public static List<ItemDef> ItemDefsWithTier(ItemTierDef itemTierDef)
		{
			//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_0028: Invalid comparison between Unknown and I4
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			HashSet<ItemDef> hashSet = new HashSet<ItemDef>();
			Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ItemDef current = enumerator.Current;
					if ((int)current.itemIndex != -1 && current.tier == itemTierDef.tier)
					{
						hashSet.Add(current);
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			return hashSet.ToList();
		}

		public static List<PickupDef> PickupDefsWithTier(ItemTierDef itemTierDef)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Invalid comparison between Unknown and I4
			//IL_0027: 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)
			HashSet<PickupDef> hashSet = new HashSet<PickupDef>();
			foreach (PickupDef allPickup in PickupCatalog.allPickups)
			{
				if ((int)allPickup.itemIndex != -1 && allPickup.itemTier == itemTierDef.tier)
				{
					hashSet.Add(allPickup);
				}
			}
			return hashSet.ToList();
		}

		public static bool ToggleBossGroupDamageHooks(bool enable)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			if (enable == IsBossGroupDamageHookEnabled)
			{
				return false;
			}
			_IsBossGroupDamageHookEnabled = enable;
			if (enable)
			{
				object obj = <>O.<0>__HealthComponent_TakeDamage;
				if (obj == null)
				{
					hook_TakeDamage val = HealthComponent_TakeDamage;
					<>O.<0>__HealthComponent_TakeDamage = val;
					obj = (object)val;
				}
				HealthComponent.TakeDamage += (hook_TakeDamage)obj;
			}
			else
			{
				object obj2 = <>O.<0>__HealthComponent_TakeDamage;
				if (obj2 == null)
				{
					hook_TakeDamage val2 = HealthComponent_TakeDamage;
					<>O.<0>__HealthComponent_TakeDamage = val2;
					obj2 = (object)val2;
				}
				HealthComponent.TakeDamage -= (hook_TakeDamage)obj2;
			}
			return true;
		}

		private static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			float num = 0f;
			BossGroup val = null;
			orig.Invoke(self, damageInfo);
			if (!Object.op_Implicit((Object)(object)self.body) || !self.body.isBoss || !self.alive || !(self.health > 0f))
			{
				return;
			}
			val = BossGroup.FindBossGroup(self.body);
			if ((Object)(object)val != (Object)null)
			{
				BossGroupDamageTakenTracker bossGroupDamageTakenTracker = ((Component)val).GetComponent<BossGroupDamageTakenTracker>();
				if (!Object.op_Implicit((Object)(object)bossGroupDamageTakenTracker))
				{
					bossGroupDamageTakenTracker = ((Component)val).gameObject.AddComponent<BossGroupDamageTakenTracker>();
				}
				num = damageInfo.damage;
				if (val.totalObservedHealth > 0f)
				{
					bossGroupDamageTakenTracker.UpdateValues(val, damageInfo, num);
				}
			}
		}
	}
	public class ItemTierPickupVFXHelper : MonoBehaviour
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_DestroyModel <0>__PickupDisplay_DestroyModel;

			public static hook_RebuildModel <1>__PickupDisplay_RebuildModel;
		}

		private PickupDisplay display;

		private GameObject effectInstance;

		[SystemInitializer(new Type[]
		{
			typeof(ItemTierCatalog),
			typeof(ItemTierBase)
		})]
		public static void SystemInitializer()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			object obj = <>O.<0>__PickupDisplay_DestroyModel;
			if (obj == null)
			{
				hook_DestroyModel val = PickupDisplay_DestroyModel;
				<>O.<0>__PickupDisplay_DestroyModel = val;
				obj = (object)val;
			}
			PickupDisplay.DestroyModel += (hook_DestroyModel)obj;
			object obj2 = <>O.<1>__PickupDisplay_RebuildModel;
			if (obj2 == null)
			{
				hook_RebuildModel val2 = PickupDisplay_RebuildModel;
				<>O.<1>__PickupDisplay_RebuildModel = val2;
				obj2 = (object)val2;
			}
			PickupDisplay.RebuildModel += (hook_RebuildModel)obj2;
		}

		private static void PickupDisplay_RebuildModel(orig_RebuildModel orig, PickupDisplay self, GameObject modelObjectOverride)
		{
			ItemTierPickupVFXHelper component = ((Component)self).gameObject.GetComponent<ItemTierPickupVFXHelper>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				((Component)self).gameObject.AddComponent<ItemTierPickupVFXHelper>();
				component = ((Component)self).gameObject.GetComponent<ItemTierPickupVFXHelper>();
			}
			orig.Invoke(self, modelObjectOverride);
			component.OnPickupDisplayRebuildModel();
		}

		private static void PickupDisplay_DestroyModel(orig_DestroyModel orig, PickupDisplay self)
		{
			ItemTierPickupVFXHelper component = ((Component)self).gameObject.GetComponent<ItemTierPickupVFXHelper>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				((Component)self).gameObject.AddComponent<ItemTierPickupVFXHelper>();
				component = ((Component)self).gameObject.GetComponent<ItemTierPickupVFXHelper>();
			}
			orig.Invoke(self);
			component.OnPickupDisplayDestroyModel();
		}

		private void Awake()
		{
			display = ((Component)this).GetComponent<PickupDisplay>();
		}

		private void OnPickupDisplayRebuildModel()
		{
			//IL_001e: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Invalid comparison between Unknown and I4
			//IL_0045: 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_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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Expected O, but got Unknown
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)display))
			{
				return;
			}
			PickupDef pickupDef = PickupCatalog.GetPickupDef(display.pickupIndex);
			ItemIndex val = (ItemIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.itemIndex));
			if ((int)val == -1)
			{
				return;
			}
			ItemTier tier = ItemCatalog.GetItemDef(val).tier;
			ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(tier);
			if (Object.op_Implicit((Object)(object)itemTierDef) && ItemTierBase.IsBransCustomTier(itemTierDef, out var itemTierBase) && itemTierBase != null && Object.op_Implicit((Object)(object)itemTierBase.PickupDisplayVFX))
			{
				effectInstance = Object.Instantiate<GameObject>(itemTierBase.PickupDisplayVFX, ((Component)display).gameObject.transform);
				Transform transform = effectInstance.transform;
				transform.position -= Vector3.up * 1.5f;
				effectInstance.SetActive(true);
				Color32 color = ColorCatalog.GetColor(itemTierDef.colorIndex);
				ParticleSystem[] componentsInChildren = effectInstance.GetComponentsInChildren<ParticleSystem>();
				ParticleSystem[] array = componentsInChildren;
				foreach (ParticleSystem val2 in array)
				{
					((Component)val2).gameObject.SetActive(true);
					MainModule main = val2.main;
					((MainModule)(ref main)).startColor = new MinMaxGradient(Color32.op_Implicit(color));
				}
				if (ModCompatability.HighItemVizabilityCompat.IsHighItemVizabilityInstalled)
				{
					float num = 0f;
					float num2 = default(float);
					float num3 = default(float);
					Color.RGBToHSV(Color32.op_Implicit(color), ref num2, ref num3, ref num);
					Color32 val3 = Color32.op_Implicit(Color.HSVToRGB(num2, 1f, num));
					GameObject gameObject = ((Component)display).gameObject;
					Vector3 position = ((Component)display).transform.position;
					Vector3 val4 = position + new Vector3(0f, 100f, 0f);
					LineRenderer val5 = gameObject.AddComponent<LineRenderer>();
					val5.positionCount = 2;
					((Renderer)val5).material = new Material(LegacyShaderAPI.Find("Hopoo Games/FX/Vertex Colors Only"));
					val5.startColor = Color32.op_Implicit(val3);
					val5.endColor = Color32.op_Implicit(val3);
					val5.startWidth = 0.25f;
					val5.endWidth = 0f;
					val5.SetPosition(0, position);
					val5.SetPosition(1, val4);
				}
			}
		}

		private void OnPickupDisplayDestroyModel()
		{
			if (Object.op_Implicit((Object)(object)effectInstance))
			{
				Object.Destroy((Object)(object)effectInstance);
			}
		}
	}
}
namespace BransItems.Modules.StandaloneBuffs
{
	public abstract class BuffBase<T> : BuffBase where T : BuffBase<T>
	{
		public static T instance { get; private set; }

		public BuffBase()
		{
			if (instance != null)
			{
				throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting BuffBase was instantiated twice");
			}
			instance = this as T;
		}
	}
	public abstract class BuffBase
	{
		public BuffDef BuffDef;

		public abstract string BuffName { get; }

		public abstract Color Color { get; }

		public virtual bool CanStack { get; } = false;


		public virtual bool IsDebuff { get; } = false;


		public virtual bool IsCooldown { get; } = true;


		public virtual bool IsHidden { get; } = false;


		public virtual Sprite BuffIcon { get; } = Resources.Load<Sprite>("Textures/MiscIcons/texMysteryIcon");


		public abstract void Init(ConfigFile config);

		public void CreateBuff()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			BuffDef = ScriptableObject.CreateInstance<BuffDef>();
			((Object)BuffDef).name = BuffName;
			BuffDef.buffColor = Color;
			BuffDef.canStack = CanStack;
			BuffDef.isDebuff = IsDebuff;
			BuffDef.iconSprite = BuffIcon;
			BuffDef.isCooldown = IsCooldown;
			BuffDef.isHidden = IsHidden;
			ContentAddition.AddBuffDef(BuffDef);
		}

		public abstract void Hooks();
	}
	public class Fortified : BuffBase<Fortified>
	{
		public override string BuffName => "Fortified";

		public override Color Color => Color32.op_Implicit(new Color32((byte)245, (byte)245, (byte)245, byte.MaxValue));

		public override Sprite BuffIcon => BransItems.MainAssets.LoadAsset<Sprite>("Assets/Textrures/Icons/Buff/Fortified.png");

		public override bool CanStack => true;

		public override bool IsDebuff => false;

		public override bool IsCooldown => false;

		public override void Init(ConfigFile config)
		{
			CreateBuff();
			Hooks();
		}

		public override void Hooks()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
		}

		private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			bool flag = false;
			if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body) && self.body.GetBuffCount(BuffDef) > 0)
			{
				self.itemCounts.armorPlate += self.body.GetBuffCount(BuffDef);
				orig.Invoke(self, damageInfo);
				flag = true;
				self.itemCounts.armorPlate -= self.body.GetBuffCount(BuffDef);
			}
			if (!flag)
			{
				orig.Invoke(self, damageInfo);
			}
		}

		private void OnLoadModCompat()
		{
		}
	}
	public class Laceration : BuffBase<Laceration>
	{
		public override string BuffName => "Laceration";

		public override Color Color => Color32.op_Implicit(new Color32((byte)240, (byte)0, (byte)0, byte.MaxValue));

		public override Sprite BuffIcon => Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/ArmorReductionOnHit/texBuffPulverizeIcon.tif").WaitForCompletion();

		public override bool CanStack => true;

		public override bool IsDebuff => true;

		public override bool IsCooldown => false;

		public override void Init(ConfigFile config)
		{
			CreateBuff();
			Hooks();
		}

		public override void Hooks()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
		}

		private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			bool flag = false;
			if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body) && self.body.GetBuffCount(BuffDef) > 0)
			{
				damageInfo.damage += (float)self.body.GetBuffCount(BuffDef) * 0.1f;
				orig.Invoke(self, damageInfo);
				flag = true;
			}
			if (!flag)
			{
				orig.Invoke(self, damageInfo);
			}
		}

		private void OnLoadModCompat()
		{
		}
	}
	public class Safegaurd : BuffBase<Safegaurd>
	{
		public override string BuffName => "Safegaurd";

		public override Color Color => Color32.op_Implicit(new Color32(byte.MaxValue, (byte)215, (byte)0, byte.MaxValue));

		public override bool CanStack => true;

		public override bool IsDebuff => false;

		public override bool IsCooldown => false;

		public override void Init(ConfigFile config)
		{
			CreateBuff();
			Hooks();
		}

		public override void Hooks()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
		}

		private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body))
			{
				int buffCount = self.body.GetBuffCount(BuffDef);
				if (buffCount > 0)
				{
					float num = (100f - (float)buffCount) / 100f * self.fullCombinedHealth;
					if (damageInfo.damage > num)
					{
						damageInfo.damage = num;
					}
				}
			}
			orig.Invoke(self, damageInfo);
		}

		private void OnLoadModCompat()
		{
		}
	}
	public class TemporaryShield : BuffBase<TemporaryShield>
	{
		public override string BuffName => "Temporary Shield";

		public override Color Color => Color32.op_Implicit(new Color32((byte)68, (byte)94, (byte)182, byte.MaxValue));

		public override Sprite BuffIcon => Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texBuffGenericShield.tif").WaitForCompletion();

		public override bool CanStack => true;

		public override bool IsDebuff => false;

		public override bool IsCooldown => false;

		public override void Init(ConfigFile config)
		{
			CreateBuff();
			Hooks();
		}

		public override void Hooks()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
		}

		private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			args.baseShieldAdd += (float)sender.GetBuffCount(BuffDef);
		}

		private void OnLoadModCompat()
		{
		}
	}
}
namespace BransItems.Modules.Pickups
{
	public abstract class ArtifactBase<T> : ArtifactBase where T : ArtifactBase<T>
	{
		public static T instance { get; private set; }

		public ArtifactBase()
		{
			if (instance != null)
			{
				throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting ItemBase was instantiated twice");
			}
			instance = this as T;
		}
	}
	public abstract class ArtifactBase
	{
		public ArtifactDef ArtifactDef;

		public abstract string ArtifactName { get; }

		public string ConfigItemName => ArtifactName.Replace("'", "");

		public abstract string ArtifactLangTokenName { get; }

		public abstract string ArtifactFullDescription { get; }

		public virtual GameObject ArtifactModel { get; } = Resources.Load<GameObject>("Prefabs/PickupModels/PickupMystery");


		public virtual Sprite ArtifactIconDeselected { get; } = Resources.Load<Sprite>("Textures/MiscIcons/texMysteryIcon");


		public virtual Sprite ArtifactIconSelected { get; } = Resources.Load<Sprite>("Textures/MiscIcons/texMysteryIcon");


		public abstract void Init(ConfigFile config);

		protected void CreateLang()
		{
			LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_NAME", ArtifactName);
			LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION", ArtifactFullDescription);
		}

		protected void CreateArtifact()
		{
			ArtifactDef = ScriptableObject.CreateInstance<ArtifactDef>();
			ArtifactDef.cachedName = "ARTIFACT_" + ArtifactLangTokenName;
			ArtifactDef.nameToken = "ARTIFACT_" + ArtifactLangTokenName + "_NAME";
			ArtifactDef.descriptionToken = "ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION";
			ArtifactDef.pickupModelPrefab = ArtifactModel;
			ArtifactDef.smallIconDeselectedSprite = ArtifactIconDeselected;
			ArtifactDef.smallIconSelectedSprite = ArtifactIconSelected;
			FixScriptableObjectName();
			ContentAddition.AddArtifactDef(ArtifactDef);
		}

		public abstract void Hooks();

		public bool IsSelectedAndInRun()
		{
			return Object.op_Implicit((Object)(object)RunArtifactManager.instance) && RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef);
		}

		public void FixScriptableObjectName()
		{
			((Object)ArtifactDef).name = ArtifactDef.cachedName;
		}
	}
	public abstract class EliteEquipmentBase<T> : EliteEquipmentBase where T : EliteEquipmentBase<T>
	{
		public static T instance { get; private set; }

		public EliteEquipmentBase()
		{
			if (instance != null)
			{
				throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting EquipmentBoilerplate/Equipment was instantiated twice");
			}
			instance = this as T;
		}
	}
	public abstract class EliteEquipmentBase
	{
		public class EliteOverlayManager : MonoBehaviour
		{
			public TemporaryOverlay Overlay;

			public CharacterBody Body;

			public BuffDef EliteBuffDef;

			public void FixedUpdate()
			{
				if (!Body.HasBuff(EliteBuffDef))
				{
					Object.Destroy((Object)(object)Overlay);
					Object.Destroy((Object)(object)this);
				}
			}
		}

		public enum TargetingType
		{
			Enemies,
			Friendlies
		}

		public class TargetingControllerComponent : MonoBehaviour
		{
			public GameObject TargetObject;

			public GameObject VisualizerPrefab;

			public Indicator Indicator;

			public BullseyeSearch TargetFinder;

			public Action<BullseyeSearch> AdditionalBullseyeFunctionality = delegate
			{
			};

			public void Awake()
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Expected O, but got Unknown
				Indicator = new Indicator(((Component)this).gameObject, (GameObject)null);
			}

			public void OnDestroy()
			{
				Invalidate();
			}

			public void Invalidate()
			{
				TargetObject = null;
				Indicator.targetTransform = null;
			}

			public void ConfigureTargetFinderBase(EquipmentSlot self)
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: 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_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_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Expected O, but got Unknown
				if (TargetFinder == null)
				{
					TargetFinder = new BullseyeSearch();
				}
				TargetFinder.teamMaskFilter = TeamMask.allButNeutral;
				((TeamMask)(ref TargetFinder.teamMaskFilter)).RemoveTeam(self.characterBody.teamComponent.teamIndex);
				TargetFinder.sortMode = (SortMode)2;
				TargetFinder.filterByLoS = true;
				float num = default(float);
				Ray val = CameraRigController.ModifyAimRayIfApplicable(self.GetAimRay(), ((Component)self).gameObject, ref num);
				TargetFinder.searchOrigin = ((Ray)(ref val)).origin;
				TargetFinder.searchDirection = ((Ray)(ref val)).direction;
				TargetFinder.maxAngleFilter = 10f;
				TargetFinder.viewer = self.characterBody;
			}

			public void ConfigureTargetFinderForEnemies(EquipmentSlot self)
			{
				//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_0024: Unknown result type (might be due to invalid IL or missing references)
				ConfigureTargetFinderBase(self);
				TargetFinder.teamMaskFilter = TeamMask.GetUnprotectedTeams(self.characterBody.teamComponent.teamIndex);
				TargetFinder.RefreshCandidates();
				TargetFinder.FilterOutGameObject(((Component)self).gameObject);
				AdditionalBullseyeFunctionality(TargetFinder);
				PlaceTargetingIndicator(TargetFinder.GetResults());
			}

			public void ConfigureTargetFinderForFriendlies(EquipmentSlot self)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: 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)
				ConfigureTargetFinderBase(self);
				TargetFinder.teamMaskFilter = TeamMask.none;
				((TeamMask)(ref TargetFinder.teamMaskFilter)).AddTeam(self.characterBody.teamComponent.teamIndex);
				TargetFinder.RefreshCandidates();
				TargetFinder.FilterOutGameObject(((Component)self).gameObject);
				AdditionalBullseyeFunctionality(TargetFinder);
				PlaceTargetingIndicator(TargetFinder.GetResults());
			}

			public void PlaceTargetingIndicator(IEnumerable<HurtBox> TargetFinderResults)
			{
				HurtBox val = (TargetFinderResults.Any() ? TargetFinderResults.First() : null);
				if (Object.op_Implicit((Object)(object)val))
				{
					TargetObject = ((Component)val.healthComponent).gameObject;
					Indicator.visualizerPrefab = VisualizerPrefab;
					Indicator.targetTransform = ((Component)val).transform;
				}
				else
				{
					Invalidate();
				}
				Indicator.active = Object.op_Implicit((Object)(object)val);
			}
		}

		public EquipmentDef EliteEquipmentDef;

		public BuffDef EliteBuffDef;

		public EliteDef EliteDef;

		public static List<EliteEquipmentBase> elites = new List<EliteEquipmentBase>();

		public GameObject TargetingIndicatorPrefabBase = null;

		public abstract string EliteEquipmentName { get; }

		public abstract string EliteAffixToken { get; }

		public abstract string EliteEquipmentPickupDesc { get; }

		public abstract string EliteEquipmentFullDescription { get; }

		public abstract string EliteEquipmentLore { get; }

		public abstract string EliteModifier { get; }

		public virtual bool AppearsInSinglePlayer { get; } = true;


		public virtual bool AppearsInMultiPlayer { get; } = true;


		public virtual bool CanDrop { get; } = false;


		public virtual float Cooldown { get; } = 60f;


		public virtual bool EnigmaCompatible { get; } = false;


		public virtual bool IsBoss { get; } = false;


		public virtual bool IsLunar { get; } = false;


		public abstract GameObject EliteEquipmentModel { get; }

		public virtual GameObject EliteBodyModel { get; } = null;


		public abstract Sprite EliteEquipmentIcon { get; }

		public abstract Sprite EliteBuffIcon { get; }

		public virtual Color EliteBuffColor { get; set; } = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue));


		public virtual EliteTierDef[] CanAppearInEliteTiers { get; set; } = EliteAPI.GetCombatDirectorEliteTiers();


		public virtual Material EliteMaterial { get; set; } = null;


		public virtual float HealthMultiplier { get; set; } = 1f;


		public virtual float DamageMultiplier { get; set; } = 1f;


		public virtual float CostMultiplierOfElite { get; set; } = 1f;


		public virtual int VanillaTier { get; set; } = 0;


		public virtual float DropChance { get; set; } = 0.00025f;


		public static Color AffixColor { get; set; } = Color.grey;


		public static Color AffixLightColor { get; set; } = Color.white;


		public virtual bool UseTargeting { get; } = false;


		public virtual TargetingType TargetingTypeEnum { get; } = TargetingType.Enemies;


		public abstract void Init(ConfigFile config);

		public abstract ItemDisplayRuleDict CreateItemDisplayRules();

		protected void CreateLang()
		{
			LanguageAPI.Add("BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_NAME", EliteEquipmentName);
			LanguageAPI.Add("BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_PICKUP", EliteEquipmentPickupDesc);
			LanguageAPI.Add("BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_DESCRIPTION", EliteEquipmentFullDescription);
			LanguageAPI.Add("BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_LORE", EliteEquipmentLore);
			LanguageAPI.Add("BRANS_ELITE_" + EliteAffixToken + "_MODIFIER", EliteModifier + " {0}");
		}

		protected void CreateEquipment()
		{
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Expected O, but got Unknown
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Expected O, but got Unknown
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Expected O, but got Unknown
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Expected O, but got Unknown
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Expected O, but got Unknown
			EliteEquipmentDef = ScriptableObject.CreateInstance<EquipmentDef>();
			((Object)EliteEquipmentDef).name = "BRANS_ELITE_EQUIPMENT_" + EliteAffixToken;
			EliteEquipmentDef.nameToken = "BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_NAME";
			EliteEquipmentDef.pickupToken = "BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_PICKUP";
			EliteEquipmentDef.descriptionToken = "BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_DESCRIPTION";
			EliteEquipmentDef.loreToken = "BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_LORE";
			EliteEquipmentDef.pickupModelPrefab = EliteEquipmentModel;
			EliteEquipmentDef.pickupIconSprite = EliteEquipmentIcon;
			EliteEquipmentDef.appearsInSinglePlayer = AppearsInSinglePlayer;
			EliteEquipmentDef.appearsInMultiPlayer = AppearsInMultiPlayer;
			EliteEquipmentDef.canDrop = CanDrop;
			EliteEquipmentDef.cooldown = Cooldown;
			EliteEquipmentDef.enigmaCompatible = EnigmaCompatible;
			EliteEquipmentDef.isBoss = IsBoss;
			EliteEquipmentDef.isLunar = IsLunar;
			EliteEquipmentDef.passiveBuffDef = EliteBuffDef;
			EliteEquipmentDef.dropOnDeathChance = DropChance;
			elites.Add(this);
			DefaultTexture();
			ItemAPI.Add(new CustomEquipment(EliteEquipmentDef, CreateItemDisplayRules()));
			EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(PerformEquipmentAction);
			if (UseTargeting && Object.op_Implicit((Object)(object)TargetingIndicatorPrefabBase))
			{
				EquipmentSlot.Update += new hook_Update(UpdateTargeting);
			}
			if (Object.op_Implicit((Object)(object)EliteMaterial))
			{
				CharacterBody.FixedUpdate += new hook_FixedUpdate(OverlayManager);
			}
			CombatDirector.Init += new hook_Init(CombatDirector_Init);
		}

		private void CombatDirector_Init(orig_Init orig)
		{
			orig.Invoke();
			foreach (EliteEquipmentBase elite in elites)
			{
				switch (elite.VanillaTier)
				{
				case 1:
					ArrayUtils.ArrayAppend<EliteDef>(ref EliteAPI.VanillaEliteTiers[1].eliteTypes, ref elite.EliteDef);
					break;
				case 2:
					ArrayUtils.ArrayAppend<EliteDef>(ref EliteAPI.VanillaEliteTiers[3].eliteTypes, ref elite.EliteDef);
					break;
				}
			}
		}

		protected void CreateAffixBuffDef()
		{
			//IL_0031: 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)
			EliteBuffDef = ScriptableObject.CreateInstance<BuffDef>();
			((Object)EliteBuffDef).name = EliteAffixToken;
			EliteBuffDef.isDebuff = false;
			EliteBuffDef.buffColor = EliteBuffColor;
			EliteBuffDef.canStack = false;
			EliteBuffDef.iconSprite = EliteBuffIcon;
		}

		private void DefaultTexture()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			EliteEquipmentDef.pickupModelPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteFire/PickupEliteFire.prefab").WaitForCompletion(), "PickupAffixAdaptive", false);
			Material val = Object.Instantiate<Material>(((Renderer)EliteEquipmentDef.pickupModelPrefab.GetComponentInChildren<MeshRenderer>()).material);
			val.color = AffixColor;
			Renderer[] componentsInChildren = EliteEquipmentDef.pickupModelPrefab.GetComponentsInChildren<Renderer>();
			foreach (Renderer val2 in componentsInChildren)
			{
				val2.material = val;
			}
		}

		public virtual void OverlayManager(orig_FixedUpdate orig, CharacterBody self)
		{
			if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.modelLocator) && Object.op_Implicit((Object)(object)self.modelLocator.modelTransform) && self.HasBuff(EliteBuffDef) && !Object.op_Implicit((Object)(object)((Component)self).GetComponent<EliteOverlayManager>()))
			{
				TemporaryOverlay val = ((Component)self.modelLocator.modelTransform).gameObject.AddComponent<TemporaryOverlay>();
				val.duration = float.PositiveInfinity;
				val.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
				val.animateShaderAlpha = true;
				val.destroyComponentOnEnd = true;
				val.originalMaterial = EliteMaterial;
				val.AddToCharacerModel(((Component)self.modelLocator.modelTransform).GetComponent<CharacterModel>());
				EliteOverlayManager eliteOverlayManager = ((Component)self).gameObject.AddComponent<EliteOverlayManager>();
				eliteOverlayManager.Overlay = val;
				eliteOverlayManager.Body = self;
				eliteOverlayManager.EliteBuffDef = EliteBuffDef;
			}
			orig.Invoke(self);
		}

		protected void CreateElite()
		{
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Expected O, but got Unknown
			EliteDef = ScriptableObject.CreateInstance<EliteDef>();
			((Object)EliteDef).name = "BRANS_ELITE_" + EliteAffixToken;
			EliteDef.modifierToken = "BRANS_ELITE_" + EliteAffixToken + "_MODIFIER";
			EliteDef.eliteEquipmentDef = EliteEquipmentDef;
			EliteDef.healthBoostCoefficient = HealthMultiplier;
			EliteDef.damageBoostCoefficient = DamageMultiplier;
			EliteTierDef[] baseEliteTierDefs = EliteAPI.GetCombatDirectorEliteTiers();
			if (VanillaTier != 0)
			{
				if (!CanAppearInEliteTiers.All((EliteTierDef x) => baseEliteTierDefs.Contains(x)))
				{
					IEnumerable<EliteTierDef> enumerable = CanAppearInEliteTiers.Except(baseEliteTierDefs);
					foreach (EliteTierDef eliteTierDef in enumerable)
					{
						int num = Array.FindIndex(baseEliteTierDefs, (EliteTierDef x) => x.costMultiplier >= eliteTierDef.costMultiplier);
						if (num >= 0)
						{
							EliteAPI.AddCustomEliteTier(eliteTierDef, num);
						}
						else
						{
							EliteAPI.AddCustomEliteTier(eliteTierDef);
						}
						baseEliteTierDefs = EliteAPI.GetCombatDirectorEliteTiers();
					}
				}
				EliteAPI.Add(new CustomElite(EliteDef, (IEnumerable<EliteTierDef>)CanAppearInEliteTiers));
			}
			EliteBuffDef.eliteDef = EliteDef;
			ContentAddition.AddBuffDef(EliteBuffDef);
		}

		protected bool PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef)
		{
			if ((Object)(object)equipmentDef == (Object)(object)EliteEquipmentDef)
			{
				return ActivateEquipment(self);
			}
			return orig.Invoke(self, equipmentDef);
		}

		protected abstract bool ActivateEquipment(EquipmentSlot slot);

		public abstract void Hooks();

		protected void UpdateTargeting(orig_Update orig, EquipmentSlot self)
		{
			//IL_000a: 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)
			orig.Invoke(self);
			if (self.equipmentIndex != EliteEquipmentDef.equipmentIndex)
			{
				return;
			}
			TargetingControllerComponent targetingControllerComponent = ((Component)self).GetComponent<TargetingControllerComponent>();
			if (!Object.op_Implicit((Object)(object)targetingControllerComponent))
			{
				targetingControllerComponent = ((Component)self).gameObject.AddComponent<TargetingControllerComponent>();
				targetingControllerComponent.VisualizerPrefab = TargetingIndicatorPrefabBase;
			}
			if (self.stock > 0)
			{
				switch (TargetingTypeEnum)
				{
				case TargetingType.Enemies:
					targetingControllerComponent.ConfigureTargetFinderForEnemies(self);
					break;
				case TargetingType.Friendlies:
					targetingControllerComponent.ConfigureTargetFinderForFriendlies(self);
					break;
				}
			}
			else
			{
				targetingControllerComponent.Invalidate();
				targetingControllerComponent.Indicator.active = false;
			}
		}
	}
	public abstract class EquipmentBase<T> : EquipmentBase where T : EquipmentBase<T>
	{
		public static T instance { get; private set; }

		public EquipmentBase()
		{
			if (instance != null)
			{
				throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting EquipmentBoilerplate/Equipment was instantiated twice");
			}
			instance = this as T;
		}
	}
	public abstract class EquipmentBase
	{
		public enum TargetingType
		{
			Enemies,
			Friendlies,
			Interactables,
			Items
		}

		public class TargetingControllerComponent : MonoBehaviour
		{
			public GameObject TargetObject;

			public GameObject VisualizerPrefab;

			public Indicator Indicator;

			public BullseyeSearch TargetFinder;

			public Action<BullseyeSearch> AdditionalBullseyeFunctionality = delegate
			{
			};

			public void Awake()
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Expected O, but got Unknown
				Indicator = new Indicator(((Component)this).gameObject, (GameObject)null);
			}

			public void OnDestroy()
			{
				Invalidate();
			}

			public void Invalidate()
			{
				TargetObject = null;
				Indicator.targetTransform = null;
			}

			public void ConfigureTargetFinderBase(EquipmentSlot self)
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: 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_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_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Expected O, but got Unknown
				if (TargetFinder == null)
				{
					TargetFinder = new BullseyeSearch();
				}
				TargetFinder.teamMaskFilter = TeamMask.allButNeutral;
				((TeamMask)(ref TargetFinder.teamMaskFilter)).RemoveTeam(self.characterBody.teamComponent.teamIndex);
				TargetFinder.sortMode = (SortMode)2;
				TargetFinder.filterByLoS = true;
				float num = default(float);
				Ray val = CameraRigController.ModifyAimRayIfApplicable(self.GetAimRay(), ((Component)self).gameObject, ref num);
				TargetFinder.searchOrigin = ((Ray)(ref val)).origin;
				TargetFinder.searchDirection = ((Ray)(ref val)).direction;
				TargetFinder.maxAngleFilter = 10f;
				TargetFinder.viewer = self.characterBody;
			}

			public void ConfigureTargetFinderForEnemies(EquipmentSlot self)
			{
				//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_0024: Unknown result type (might be due to invalid IL or missing references)
				ConfigureTargetFinderBase(self);
				TargetFinder.teamMaskFilter = TeamMask.GetUnprotectedTeams(self.characterBody.teamComponent.teamIndex);
				TargetFinder.RefreshCandidates();
				TargetFinder.FilterOutGameObject(((Component)self).gameObject);
				AdditionalBullseyeFunctionality(TargetFinder);
				PlaceTargetingIndicator(TargetFinder.GetResults());
			}

			public void ConfigureTargetFinderForFriendlies(EquipmentSlot self)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: 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)
				ConfigureTargetFinderBase(self);
				TargetFinder.teamMaskFilter = TeamMask.none;
				((TeamMask)(ref TargetFinder.teamMaskFilter)).AddTeam(self.characterBody.teamComponent.teamIndex);
				TargetFinder.RefreshCandidates();
				TargetFinder.FilterOutGameObject(((Component)self).gameObject);
				AdditionalBullseyeFunctionality(TargetFinder);
				PlaceTargetingIndicator(TargetFinder.GetResults());
			}

			public void PlaceTargetingIndicator(IEnumerable<HurtBox> TargetFinderResults)
			{
				HurtBox val = (TargetFinderResults.Any() ? TargetFinderResults.First() : null);
				if (Object.op_Implicit((Object)(object)val))
				{
					TargetObject = ((Component)val.healthComponent).gameObject;
					Indicator.visualizerPrefab = VisualizerPrefab;
					Indicator.targetTransform = ((Component)val).transform;
				}
				else
				{
					Invalidate();
				}
				Indicator.active = Object.op_Implicit((Object)(object)val);
			}

			internal void ConfigureTargetFinderForInteractables(EquipmentSlot self)
			{
				throw new NotImplementedException();
			}

			internal void ConfigureTargetFinderForItems(EquipmentSlot self)
			{
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				ConfigureTargetFinderBase(self);
				((TeamMask)(ref TargetFinder.teamMaskFilter)).AddTeam(self.characterBody.teamComponent.teamIndex);
				TargetFinder.RefreshCandidates();
				TargetFinder.FilterOutGameObject(((Component)self).gameObject);
				AdditionalBullseyeFunctionality(TargetFinder);
				PlaceTargetingIndicator(TargetFinder.GetResults());
			}
		}

		public EquipmentDef EquipmentDef;

		public GameObject TargetingIndicatorPrefabBase = null;

		public abstract string EquipmentName { get; }

		public abstract string EquipmentLangTokenName { get; }

		public abstract string EquipmentPickupDesc { get; }

		public abstract string EquipmentFullDescription { get; }

		public abstract string EquipmentLore { get; }

		public virtual GameObject EquipmentModel { get; } = Resources.Load<GameObject>("Prefabs/PickupModels/PickupMystery");


		public virtual Sprite EquipmentIcon { get; } = Resources.Load<Sprite>("Textures/MiscIcons/texMysteryIcon");


		public virtual bool AppearsInSinglePlayer { get; } = true;


		public virtual bool AppearsInMultiPlayer { get; } = true;


		public virtual bool CanDrop { get; } = true;


		public virtual float Cooldown { get; } = 60f;


		public virtual bool EnigmaCompatible { get; } = true;


		public virtual bool IsBoss { get; } = false;


		public virtual bool IsLunar { get; } = false;


		public virtual bool UseTargeting { get; } = false;


		public virtual TargetingType TargetingTypeEnum { get; } = TargetingType.Enemies;


		public abstract void Init(ConfigFile config);

		protected void CreateLang()
		{
			LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_NAME", EquipmentName);
			LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_PICKUP", EquipmentPickupDesc);
			LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_DESCRIPTION", EquipmentFullDescription);
			LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_LORE", EquipmentLore);
		}

		public abstract ItemDisplayRuleDict CreateItemDisplayRules();

		protected void CreateEquipment()
		{
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Expected O, but got Unknown
			EquipmentDef = ScriptableObject.CreateInstance<EquipmentDef>();
			((Object)EquipmentDef).name = "EQUIPMENT_" + EquipmentLangTokenName;
			EquipmentDef.nameToken = "EQUIPMENT_" + EquipmentLangTokenName + "_NAME";
			EquipmentDef.pickupToken = "EQUIPMENT_" + EquipmentLangTokenName + "_PICKUP";
			EquipmentDef.descriptionToken = "EQUIPMENT_" + EquipmentLangTokenName + "_DESCRIPTION";
			EquipmentDef.loreToken = "EQUIPMENT_" + EquipmentLangTokenName + "_LORE";
			EquipmentDef.pickupModelPrefab = EquipmentModel;
			EquipmentDef.pickupIconSprite = EquipmentIcon;
			EquipmentDef.appearsInSinglePlayer = AppearsInSinglePlayer;
			EquipmentDef.appearsInMultiPlayer = AppearsInMultiPlayer;
			EquipmentDef.canDrop = CanDrop;
			EquipmentDef.cooldown = Cooldown;
			EquipmentDef.enigmaCompatible = EnigmaCompatible;
			EquipmentDef.isBoss = IsBoss;
			EquipmentDef.isLunar = IsLunar;
			ItemAPI.Add(new CustomEquipment(EquipmentDef, CreateItemDisplayRules()));
			EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(PerformEquipmentAction);
		}

		private bool PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef)
		{
			if ((Object)(object)equipmentDef == (Object)(object)EquipmentDef)
			{
				return ActivateEquipment(self);
			}
			return orig.Invoke(self, equipmentDef);
		}

		protected abstract bool ActivateEquipment(EquipmentSlot slot);

		public abstract void Hooks();

		protected void UpdateTargeting(orig_Update orig, EquipmentSlot self)
		{
			//IL_000a: 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)
			orig.Invoke(self);
			if (self.equipmentIndex != EquipmentDef.equipmentIndex)
			{
				return;
			}
			TargetingControllerComponent targetingControllerComponent = ((Component)self).GetComponent<TargetingControllerComponent>();
			if (!Object.op_Implicit((Object)(object)targetingControllerComponent))
			{
				targetingControllerComponent = ((Component)self).gameObject.AddComponent<TargetingControllerComponent>();
				targetingControllerComponent.VisualizerPrefab = TargetingIndicatorPrefabBase;
			}
			if (self.stock > 0)
			{
				switch (TargetingTypeEnum)
				{
				case TargetingType.Enemies:
					targetingControllerComponent.ConfigureTargetFinderForEnemies(self);
					break;
				case TargetingType.Friendlies:
					targetingControllerComponent.ConfigureTargetFinderForFriendlies(self);
					break;
				case TargetingType.Interactables:
					targetingControllerComponent.ConfigureTargetFinderForInteractables(self);
					break;
				case TargetingType.Items:
					targetingControllerComponent.ConfigureTargetFinderForItems(self);
					break;
				}
			}
			else
			{
				targetingControllerComponent.Invalidate();
				targetingControllerComponent.Indicator.active = false;
			}
		}
	}
	public abstract class ItemBase<T> : ItemBase where T : ItemBase<T>
	{
		public static T instance { get; private set; }

		public ItemBase()
		{
			if (instance != null)
			{
				throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting ItemBase was instantiated twice");
			}
			instance = this as T;
		}
	}
	public abstract class ItemBase
	{
		public ItemDef ItemDef;

		public abstract string ItemName { get; }

		public string ConfigItemName => ItemName.Replace("'", "");

		public abstract string ItemLangTokenName { get; }

		public abstract string ItemPickupDesc { get; }

		public abstract string ItemFullDescription { get; }

		public abstract string ItemLore { get; }

		public virtual ItemTierDef ModdedTierDef { get; } = null;


		public abstract ItemTier Tier { get; }

		public virtual ItemTag[] ItemTags { get; } = (ItemTag[])(object)new ItemTag[0];


		public virtual GameObject ItemModel { get; } = Resources.Load<GameObject>("Prefabs/PickupModels/PickupMystery");


		public virtual Sprite ItemIcon { get; } = Resources.Load<Sprite>("Textures/MiscIcons/texMysteryIcon");


		public virtual bool CanRemove { get; } = true;


		public virtual bool Hidden { get; } = false;


		public bool AIBlacklisted { get; internal set; }

		public bool PrinterBlacklisted { get; internal set; }

		public virtual bool BlacklistFromPreLoad { get; internal set; } = false;


		public virtual string[] CorruptsItem { get; set; } = null;


		public abstract void Init(ConfigFile config);

		protected void CreateLang()
		{
			LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_NAME", ItemName);
			LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_PICKUP", ItemPickupDesc);
			LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_DESCRIPTION", ItemFullDescription);
			LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_LORE", ItemLore);
		}

		public abstract ItemDisplayRuleDict CreateItemDisplayRules();

		protected void CreateItem()
		{
			//IL_0103: 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_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected O, but got Unknown
			ItemDef = ScriptableObject.CreateInstance<ItemDef>();
			((Object)ItemDef).name = "ITEM_" + ItemLangTokenName;
			ItemDef.nameToken = "ITEM_" + ItemLangTokenName + "_NAME";
			ItemDef.pickupToken = "ITEM_" + ItemLangTokenName + "_PICKUP";
			ItemDef.descriptionToken = "ITEM_" + ItemLangTokenName + "_DESCRIPTION";
			ItemDef.loreToken = "ITEM_" + ItemLangTokenName + "_LORE";
			ItemDef.pickupModelPrefab = ItemModel;
			ItemDef.pickupIconSprite = ItemIcon;
			ItemDef.hidden = Hidden;
			ItemDef.canRemove = CanRemove;
			if ((Object)(object)ModdedTierDef == (Object)null)
			{
				ItemDef.deprecatedTier = Tier;
			}
			else
			{
				ItemDef._itemTierDef = ModdedTierDef;
			}
			ItemDef.tags = ItemTags;
			ItemDisplayRuleDict val = CreateItemDisplayRules();
			ItemAPI.Add(new CustomItem(ItemDef, val));
		}

		public abstract void Hooks();

		public int GetCount(CharacterBody body)
		{
			if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory))
			{
				return 0;
			}
			return body.inventory.GetItemCount(ItemDef);
		}

		public int GetCount(CharacterMaster master)
		{
			if (!Object.op_Implicit((Object)(object)master) || !Object.op_Implicit((Object)(object)master.inventory))
			{
				return 0;
			}
			return master.inventory.GetItemCount(ItemDef);
		}

		internal static void RegisterVoidPairings(orig_Init orig)
		{
			//IL_00a2: 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_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)
			ItemTier[] array = new ItemTier[4];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			ItemTier[] source = (ItemTier[])(object)array;
			foreach (KeyValuePair<ItemBase, bool> item2 in BransItems.ItemStatusDictionary)
			{
				if (!item2.Value)
				{
					continue;
				}
				ItemBase item = item2.Key;
				if (!Object.op_Implicit((Object)(object)item.ItemDef) || !source.Any((ItemTier x) => item.ItemDef.tier == x))
				{
					continue;
				}
				int i;
				for (i = 0; i < item.CorruptsItem.Count(); i++)
				{
					ItemDef val = ((IEnumerable<ItemDef>)(object)ItemCatalog.allItemDefs).Where((ItemDef x) => x.nameToken == item.CorruptsItem[i]).FirstOrDefault();
					if (!Object.op_Implicit((Object)(object)val))
					{
						BransItems.ModLogger.LogError((object)("Tried to add " + item.ItemName + " in a Void item tier but no relationship was set for what it corrupts or could not be found. Aborting!"));
						continue;
					}
					Pair[] array2 = (Pair[])(object)new Pair[1]
					{
						new Pair
						{
							itemDef1 = val,
							itemDef2 = item.ItemDef
						}
					};
					ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem] = CollectionExtensions.AddRangeToArray<Pair>(ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem], array2);
				}
			}
			orig.Invoke();
		}
	}
}
namespace BransItems.Modules.Pickups.Equipments
{
	internal class AirTotem : EquipmentBase<AirTotem>
	{
		public static GameObject ItemBodyModelPrefab;

		public override string EquipmentName => "Reducer";

		public override string EquipmentLangTokenName => "Reducer";

		public override string EquipmentPickupDesc => "Transform an item to its " + BransItems.EssencesKeyword + ".";

		public override string EquipmentFullDescription => "<style=cIsUtility>Transform</style> an item to an " + BransItems.EssenceKeyword + " which gives a slight <style=cIsUtility>stat boost</style>.<style=cIsUtility> Scales with item rarity</style>.";

		public override string EquipmentLore => "";

		public override bool UseTargeting => true;

		public override GameObject EquipmentModel => SetupModel();

		public override Sprite EquipmentIcon => BransItems.MainAssets.LoadAsset<Sprite>("Assets/Textrures/Icons/Equipment/Reducer/ReducerIcon.png");

		public override float Cooldown { get; } = 30f;


		public override void Init(ConfigFile config)
		{
			CreateLang();
			CreateTargetingIndicator();
			CreateEquipment();
			Hooks();
		}

		private void CreateTargetingIndicator()
		{
			//IL_0027: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			TargetingIndicatorPrefabBase = PrefabAPI.InstantiateClone(Resources.Load<GameObject>("Prefabs/RecyclerIndicator"), "AirTotemIndicator", false);
			TargetingIndicatorPrefabBase.GetComponentInChildren<SpriteRenderer>().color = Color.white;
			((Component)TargetingIndicatorPrefabBase.GetComponentInChildren<SpriteRenderer>()).transform.rotation = Quaternion.identity;
			((Graphic)TargetingIndicatorPrefabBase.GetComponentInChildren<TextMeshPro>()).color = new Color(0.423f, 1f, 0.749f);
		}

		private GameObject SetupModel()
		{
			//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)
			GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Recycle/PickupRecycler.prefab").WaitForCompletion(), "Reducer", false);
			Texture2D val2 = BransItems.MainAssets.LoadAsset<Texture2D>("Assets/Textrures/Icons/Equipment/Reducer/ReducerTexture.png");
			((Renderer)val.GetComponentInChildren<MeshRenderer>()).GetMaterial().SetTexture("_MainTex", (Texture)(object)val2);
			return val;
		}

		public override ItemDisplayRuleDict CreateItemDisplayRules()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			ItemBodyModelPrefab = EquipmentModel;
			ItemDisplay val = ItemBodyModelPrefab.AddComponent<ItemDisplay>();
			val.rendererInfos = ItemHelpers.ItemDisplaySetup(ItemBodyModelPrefab);
			return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
		}

		public override void Hooks()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			EquipmentSlot.UpdateTargets += new hook_UpdateTargets(UpdateTargets);
		}

		protected override bool ActivateEquipment(EquipmentSlot slot)
		{
			//IL_0038: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_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_007b: 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_0084: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Expected I4, but got Unknown
			//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_013d: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: 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_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)slot.currentTarget.pickupController) && Object.op_Implicit((Object)(object)Run.instance))
			{
				ItemTier tier = ItemTierCatalog.GetItemTierDef(ItemCatalog.GetItemDef(((PickupIndex)(ref slot.currentTarget.pickupController.pickupIndex)).itemIndex).tier).tier;
				bool flag = false;
				Transform transform = ((Component)slot).transform;
				Vector3 position = ((Component)slot).transform.position;
				Vector3 val = position - slot.characterBody.corePosition;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				PickupIndex essenceIndex = EssenceHelpers.GetEssenceIndex(slot.rng);
				int itemCount = slot.inventory.GetItemCount(ItemBase<LootedBloodburstClam>.instance.ItemDef.itemIndex);
				Ray aimRay = slot.GetAimRay();
				Vector3 direction = ((Ray)(ref aimRay)).direction;
				BransItems.ModLogger.LogInfo((object)("Dir" + ((object)(Vector3)(ref direction)).ToString()));
				int num = 0;
				ItemTier val2 = tier;
				ItemTier val3 = val2;
				switch ((int)val3)
				{
				case 0:
				case 6:
					num = 1;
					break;
				case 1:
				case 7:
					num = 3;
					break;
				case 2:
				case 8:
					num = 15;
					break;
				case 4:
					num = 8;
					break;
				case 3:
					essenceIndex = PickupCatalog.FindPickupIndex(Items.LunarSpecialReplacement.itemIndex);
					PickupDropletController.CreatePickupDroplet(essenceIndex, position, direction * 40f);
					Object.Destroy((Object)(object)slot.currentTarget.rootObject);
					return true;
				}
				num += itemCount * BloodburstClam.AdditionalDrops;
				for (int i = 1; i <= num; i++)
				{
					essenceIndex = EssenceHelpers.GetEssenceIndex(slot.rng);
					PickupDropletController.CreatePickupDroplet(essenceIndex, position + new Vector3(0.1f * (float)i, 3f, 0f), direction * 40f);
				}
				Object.Destroy((Object)(object)slot.currentTarget.rootObject);
				return true;
			}
			return false;
		}

		private void UpdateTargets(orig_UpdateTargets orig, EquipmentSlot self, EquipmentIndex targetingEquipmentIndex, bool userShouldAnticipateTarget)
		{
			//IL_0001: 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_002a: 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_0045: 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)
			if (targetingEquipmentIndex != EquipmentDef.equipmentIndex)
			{
				orig.Invoke(self, targetingEquipmentIndex, userShouldAnticipateTarget);
				return;
			}
			self.currentTarget = new UserTargetInfo(self.FindPickupController(self.GetAimRay(), 10f, 30f, true, true));
			TargetingControllerComponent component = ((Component)self).GetComponent<TargetingControllerComponent>();
			if ((Object)(object)self.currentTarget.rootObject != (Object)null)
			{
				bool flag = true;
				self.targetIndicator.visualizerPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/RecyclerIndicator");
				self.targetIndicator.active = true;
				self.targetIndicator.targetTransform = self.currentTarget.transformToIndicateAt;
			}
			else
			{
				self.targetIndicator.active = false;
			}
		}
	}
	internal class EarthTotem : EquipmentBase<EarthTotem>
	{
		public static GameObject ItemBodyModelPrefab;

		public float StartCooldown = 15f;

		public override string EquipmentName => "Reuser";

		public override string EquipmentLangTokenName => "REUSER";

		public override string EquipmentPickupDesc => "Absorb an equipment and gain its effect.";

		public override string EquipmentFullDescription => "<style=cIsUtility>Absorb</style> an equipment and add its effect to this equipment.";

		public override string EquipmentLore => "";

		public override bool UseTargeting => true;

		public override GameObject EquipmentModel => SetupModel();

		public override Sprite EquipmentIcon => BransItems.MainAssets.LoadAsset<Sprite>("Assets/Textrures/Icons/Equipment/Reuser/ReuserIcon.png");

		public override float Cooldown { get; } = 15f;


		public override void Init(ConfigFile config)
		{
			CreateLang();
			CreateTargetingIndicator();
			CreateEquipment();
			Hooks();
		}

		private void CreateTargetingIndicator()
		{
			//IL_0027: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			TargetingIndicatorPrefabBase = PrefabAPI.InstantiateClone(Resources.Load<GameObject>("Prefabs/RecyclerIndicator"), "AirTotemIndicator", false);
			TargetingIndicatorPrefabBase.GetComponentInChildren<SpriteRenderer>().color = Color.white;
			((Component)TargetingIndicatorPrefabBase.GetComponentInChildren<SpriteRenderer>()).transform.rotation = Quaternion.identity;
			((Graphic)TargetingIndicatorPrefabBase.GetComponentInChildren<TextMeshPro>()).color = new Color(0.423f, 1f, 0.749f);
		}

		private GameObject SetupModel()
		{
			//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)
			GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Recycle/PickupRecycler.prefab").WaitForCompletion(), "Reuser", false);
			Texture2D val2 = BransItems.MainAssets.LoadAsset<Texture2D>("Assets/Textrures/Icons/Equipment/Reuser/ReuserTexture.png");
			((Renderer)val.GetComponentInChildren<MeshRenderer>()).GetMaterial().SetTexture("_MainTex", (Texture)(object)val2);
			return val;
		}

		public override ItemDisplayRuleDict CreateItemDisplayRules()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			ItemBodyModelPrefab = EquipmentModel;
			ItemDisplay val = ItemBodyModelPrefab.AddComponent<ItemDisplay>();
			val.rendererInfos = ItemHelpers.ItemDisplaySetup(ItemBodyModelPrefab);
			return new ItemDisplayRuleDict(Array.Empty<ItemDisplayRule>());
		}

		public override 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
			EquipmentSlot.MyFixedUpdate += new hook_MyFixedUpdate(EquipmentSlot_MyFixedUpdate);
			EquipmentSlot.UpdateTargets += new hook_UpdateTargets(UpdateTargets);
		}

		private void EquipmentSlot_MyFixedUpdate(orig_MyFixedUpdate orig, EquipmentSlot self, float deltaTime)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid