Decompiled source of Augmentum v1.1.9

Augmentum/Augmentum.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using Augmentum.Modules.ColorCatalogEntry;
using Augmentum.Modules.Compatability;
using Augmentum.Modules.ItemTiers;
using Augmentum.Modules.ItemTiers.CoreTier;
using Augmentum.Modules.ItemTiers.HighlanderTier;
using Augmentum.Modules.Pickups;
using Augmentum.Modules.Pickups.EliteEquipments;
using Augmentum.Modules.Pickups.Equipments;
using Augmentum.Modules.Pickups.Items.CoreItems;
using Augmentum.Modules.Pickups.Items.Essences;
using Augmentum.Modules.Pickups.Items.HighlanderItems;
using Augmentum.Modules.Pickups.Items.Lunar;
using Augmentum.Modules.Pickups.Items.NoTier;
using Augmentum.Modules.Pickups.Items.Tier1;
using Augmentum.Modules.Pickups.Items.Tier2;
using Augmentum.Modules.Pickups.Items.Tier3;
using Augmentum.Modules.StandaloneBuffs;
using Augmentum.Modules.Utils;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates.VagrantMonster;
using HG;
using HarmonyLib;
using LookingGlass.ItemStatsNameSpace;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using On.RoR2;
using On.RoR2.Items;
using ProperSave;
using ProperSave.Data;
using R2API;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.WwiseUtils;
using RoR2BepInExPack.GameAssetPaths.Version_1_35_0;
using RoR2BepInExPack.GameAssetPathsBetter;
using ShareSuite;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.UI;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Augmentum
{
	[BepInDependency("com.bepis.r2api", "5.3.0")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.BrandonRosa.Augmentum", "Augmentum", "1.1.9")]
	public class Augmentum : 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.9";

		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) + ">" + Language.GetString("TIER_CORE_ESSENCE_KEYWORD") + "</color>";

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

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

		public void Awake()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			ModLogger = ((BaseUnityPlugin)this).Logger;
			Log.Init(((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.9", "DO NOT CHANGE THIS");
			if (enableAutoConfig.Value && (_preVersioning || latestVersion.Value != "1.1.9"))
			{
				latestVersion.Value = "1.1.9";
				ConfigManager.VersionChanged = true;
				ModLogger.LogInfo((object)"Config Autosync Enabled.");
			}
		}

		private void Start()
		{
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Expected O, but got Unknown
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Expected O, but got Unknown
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Expected O, but got Unknown
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Augmentum.bransitems_assets"))
			{
				MainAssets = AssetBundle.LoadFromStream(stream);
			}
			Colors.Init();
			ItemTierPickupVFXHelper.SystemInitializer();
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(ItemTierBase))
				select type;
			ModLogger.LogInfo((object)"-----------------ITEMTIERS---------------------");
			foreach (Type item2 in enumerable)
			{
				ItemTierBase itemTierBase = (ItemTierBase)Activator.CreateInstance(item2);
				itemTierBase.Init();
				ModLogger.LogInfo((object)("ItemTier: " + itemTierBase.TierName + " Initialized!"));
			}
			IEnumerable<Type> enumerable2 = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(BuffBase))
				select type;
			ModLogger.LogInfo((object)"--------------BUFFS---------------------");
			foreach (Type item3 in enumerable2)
			{
				BuffBase buffBase = (BuffBase)Activator.CreateInstance(item3);
				if (ValidateBuff(buffBase, Buffs))
				{
					buffBase.Init(((BaseUnityPlugin)this).Config);
					ModLogger.LogInfo((object)("Buff: " + buffBase.BuffName + " Initialized!"));
				}
			}
			if (!ConfigManager.ConfigOptionValue("Items", "Disable All Items?", defaultvalue: false, "Do you wish to disable every item in Augmentum?", restartRequired: true))
			{
				IEnumerable<Type> enumerable3 = from type in Assembly.GetExecutingAssembly().GetTypes()
					where !type.IsAbstract && type.IsSubclassOf(typeof(ItemBase))
					select type;
				ModLogger.LogInfo((object)"----------------------ITEMS--------------------");
				foreach (Type item4 in enumerable3)
				{
					ItemBase item = (ItemBase)Activator.CreateInstance(item4);
					if (!item.BlacklistFromPreLoad && ValidateItem(item, Items))
					{
						item.Init(((BaseUnityPlugin)this).Config);
						((BaseUnityPlugin)this).Config.SettingChanged += delegate
						{
							item.UpdateDescriptionToken();
						};
						Language.LoadStrings += (hook_LoadStrings)delegate(orig_LoadStrings orig, Language self)
						{
							orig.Invoke(self);
							item.UpdateDescriptionToken();
						};
						Language.SetCurrentLanguage += (hook_SetCurrentLanguage)delegate(orig_SetCurrentLanguage orig, string languageName, bool forceUnload)
						{
							orig.Invoke(languageName, forceUnload);
							item.UpdateDescriptionToken();
						};
						ModLogger.LogInfo((object)("Item: " + item.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.ConfigOptionValue("Equipment", "Disable All Equipment?", defaultvalue: false, "Do you wish to disable every equipment in Augmentum?", restartRequired: true))
			{
				IEnumerable<Type> enumerable4 = from type in Assembly.GetExecutingAssembly().GetTypes()
					where !type.IsAbstract && type.IsSubclassOf(typeof(EquipmentBase))
					select type;
				ModLogger.LogInfo((object)"-----------------EQUIPMENT---------------------");
				foreach (Type item5 in enumerable4)
				{
					EquipmentBase equipment = (EquipmentBase)Activator.CreateInstance(item5);
					if (ValidateEquipment(equipment, Equipments))
					{
						equipment.Init(((BaseUnityPlugin)this).Config);
						((BaseUnityPlugin)this).Config.SettingChanged += delegate
						{
							equipment.EquipmentDef.descriptionToken = equipment.EquipmentFullDescriptionFormatted;
						};
						ModLogger.LogInfo((object)("Equipment: " + equipment.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 item6 in enumerable5)
			{
				EliteEquipmentBase eliteEquipment = (EliteEquipmentBase)Activator.CreateInstance(item6);
				if (ValidateEliteEquipment(eliteEquipment, EliteEquipments))
				{
					eliteEquipment.Init(((BaseUnityPlugin)this).Config);
					((BaseUnityPlugin)this).Config.SettingChanged += delegate
					{
						eliteEquipment.EliteEquipmentDef.descriptionToken = eliteEquipment.EliteEquipmentFullDescriptionFormatted;
					};
					ModLogger.LogInfo((object)("Elite Equipment: " + eliteEquipment.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 item7 in enumerable6)
			{
				ArtifactBase artifactBase = (ArtifactBase)Activator.CreateInstance(item7);
				if (ValidateArtifact(artifactBase, Artifacts))
				{
					artifactBase.Init(((BaseUnityPlugin)this).Config);
					ModLogger.LogInfo((object)("Artifact: " + artifactBase.ArtifactName + " Initialized!"));
				}
			}
			ModLogger.LogInfo((object)"-------------COMPATIBILITY---------------------");
			ValidateModCompatability();
			OptionPickupFix.Init();
		}

		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.ConfigOptionValue("Mod Compatability: ShareSuite", "Enable Compatability Patches?", defaultvalue: true, "Attempt to patch ShareSuite (if installed) to work with this mod?", restartRequired: true);
			string customBlacklist = ConfigManager.ConfigOptionValue("Mod Compatability: ShareSuite", "ShareSuite Blacklist", defaultvalue, "Add items to ShareSuite blacklist?", restartRequired: true);
			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.ConfigOptionValue("Mod Compatability: ProperSave", "Enable Compatability Patches?", defaultvalue: true, "Attempt to add Propersave compatability (if installed)?", restartRequired: true);
			if (ModCompatability.ProperSaveCompat.IsProperSaveInstalled && flag2)
			{
				ModLogger.LogInfo((object)"ModCompatability: ProperSave Recognized!");
				ModCompatability.ProperSaveCompat.AddProperSaveFunctionality = true;
			}
			bool flag3 = ConfigManager.ConfigOptionValue("Mod Compatability: LookingGlass", "Enable Compatability Patches?", defaultvalue: true, "Add item stats to LookingGlass (if installed)?", restartRequired: true);
			if (ModCompatability.LookingGlassCompat.IsLookingGlassInstalled && flag3)
			{
				ModLogger.LogInfo((object)"ModCompatability: LookingGlass Recognized!");
				ModCompatability.LookingGlassCompat.Init();
			}
			if (flag || flag2)
			{
				ModCompatability.FinishedLoading();
			}
		}

		public bool ValidateItem(ItemBase item, List<ItemBase> itemList)
		{
			bool value = ConfigManager.ConfigOption("Item: " + item.ConfigItemName, "Enable Item?", defaultvalue: true, "Should this item appear in runs?", restartRequired: true).Value;
			bool flag = ConfigManager.ConfigOptionValue("Item: " + item.ConfigItemName, "Blacklist Item from AI Use?", defaultvalue: false, "Should the AI not be able to obtain this item?");
			bool flag2 = ConfigManager.ConfigOptionValue("Item: " + item.ConfigItemName, "Blacklist Item from Printers?", defaultvalue: false, "Should the printers be able to print this item?", restartRequired: true);
			_ = 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.)", restartRequired: true).Value;
			ItemStatusDictionary.Add(item, value);
			if (value)
			{
				itemList.Add(item);
				if (flag)
				{
					item.AIBlacklisted = true;
				}
				if (flag2)
				{
					item.PrinterBlacklisted = true;
				}
			}
			return value;
		}

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

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

		public bool ValidateEliteEquipment(EliteEquipmentBase eliteEquipment, List<EliteEquipmentBase> eliteEquipmentList)
		{
			bool value = 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.", restartRequired: true).Value;
			EliteEquipmentStatusDictionary.Add(eliteEquipment, value);
			if (value)
			{
				eliteEquipmentList.Add(eliteEquipment);
				return true;
			}
			return false;
		}

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

		private void Update()
		{
		}
	}
	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);
		}
	}
	internal static class OptionPickupFix
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_DestroyModel <0>__PickupDisplay_DestroyModel;
		}

		private static bool _initialized;

		public static void Init()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			if (!_initialized)
			{
				_initialized = true;
				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;
			}
		}

		private static void PickupDisplay_DestroyModel(orig_DestroyModel orig, PickupDisplay self)
		{
			if (!Object.op_Implicit((Object)(object)self) || !self.dontInstantiatePickupModel)
			{
				orig.Invoke(self);
			}
		}
	}
}
namespace Augmentum.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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			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_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return orig.Invoke(colorIndex);
		}

		private static string ColorCatalog_GetColorHexString(orig_GetColorHexString orig, ColorIndex colorIndex)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0013: 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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected I4, but got Unknown
			//IL_000c: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			SetHooks();
			int num = -indexToColor32.Count - 1;
			indexToColor32.Add(Color32.op_Implicit(color));
			indexToHexString.Add(Util.RGBToHex(Color32.op_Implicit(color)));
			return (ColorIndex)num;
		}
	}
	public class ConfigManager
	{
		internal static bool ConfigChanged;

		internal static bool VersionChanged;

		public static T HandleConfig<T>(ConfigEntryBase entry, ConfigFile config, string name)
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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 (Augmentum._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 ConfigEntry<T> ConfigOption<T>(string section, string key, T defaultvalue, string description, bool restartRequired = false)
		{
			ConfigEntry<T> val = Augmentum.AugConfig.Bind<T>(section, key, defaultvalue, description);
			HandleConfig<T>((ConfigEntryBase)(object)val, Augmentum.AugBackupConfig, key);
			if (ModCompatability.RiskOfOptionsCompatability.IsShareSuiteInstalled)
			{
				ModCompatability.RiskOfOptionsCompatability.AddConfig<ConfigEntry<T>>(val, restartRequired);
			}
			return val;
		}

		public static T ConfigOptionValue<T>(string section, string key, T defaultvalue, string description, bool restartRequired = false)
		{
			return ConfigOption(section, key, defaultvalue, description, restartRequired).Value;
		}
	}
	public static class EffectHelpers
	{
		public static void SetParticleSystemColorOverTime(ref ParticleSystem particleSystem, MinMaxGradient color)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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))
			{
				Augmentum.ModLogger.LogError((object)"Can't check if the hurtbox has the item, some information is missing!");
				return false;
			}
			if (hurtbox.healthComponent.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))
			{
				Augmentum.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_0042: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			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++)
			{
				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_002a: 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)
			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_002c: 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)
			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 DotIndex FindAssociatedDotForBuff(BuffDef buff)
		{
			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_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			//IL_0028: 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)
			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/*cast due to .constrained prefix*/).Dispose();
			}
			return hashSet.ToList();
		}

		public static List<PickupDef> PickupDefsWithTier(ItemTierDef itemTierDef)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			//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)
			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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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 static void DelayChatMessage(string message, float delay)
		{
			((MonoBehaviour)Run.instance).StartCoroutine(DelayedChatMessageCoroutine(message, delay));
		}

		public static IEnumerator DelayedChatMessageCoroutine(string message, float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
			{
				baseToken = message
			});
		}
	}
	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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			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>();
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)component))
			{
				component.OnPickupDisplayDestroyModel();
			}
		}

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

		private void OnPickupDisplayRebuildModel()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Invalid comparison between Unknown and I4
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)display))
			{
				return;
			}
			PickupDef pickupDef = PickupCatalog.GetPickupDef(display.GetPickupIndex());
			ItemIndex val = (ItemIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.itemIndex));
			if ((int)val == -1)
			{
				return;
			}
			ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(ItemCatalog.GetItemDef(val).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>();
				foreach (ParticleSystem obj in componentsInChildren)
				{
					((Component)obj).gameObject.SetActive(true);
					MainModule main = obj.main;
					((MainModule)(ref main)).startColor = new MinMaxGradient(Color32.op_Implicit(color));
				}
			}
		}

		private void OnPickupDisplayDestroyModel()
		{
			if (Object.op_Implicit((Object)(object)effectInstance))
			{
				Object.Destroy((Object)(object)effectInstance);
			}
		}
	}
}
namespace Augmentum.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; }

		public virtual bool IsDebuff { get; }

		public virtual bool IsCooldown { get; } = true;

		public virtual bool IsHidden { get; }

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

		public abstract void Init(ConfigFile config);

		public void CreateBuff()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			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 => Augmentum.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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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 class TemporaryShieldTracker : MonoBehaviour
		{
			private struct Grant
			{
				public int amount;

				public float expiresAt;
			}

			private readonly List<Grant> grants = new List<Grant>();

			private CharacterBody body;

			private void Awake()
			{
				body = ((Component)this).GetComponent<CharacterBody>();
			}

			public void Add(int amount, float duration)
			{
				grants.Add(new Grant
				{
					amount = amount,
					expiresAt = Time.fixedTime + duration
				});
				ChangeCount(amount);
			}

			private void ChangeCount(int delta)
			{
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				BuffIndex buffIndex = BuffBase<TemporaryShield>.instance.BuffDef.buffIndex;
				body.SetBuffCount(buffIndex, Math.Max(0, body.GetBuffCount(buffIndex) + delta));
			}

			private void FixedUpdate()
			{
				if (!NetworkServer.active || !Object.op_Implicit((Object)(object)body))
				{
					Object.Destroy((Object)(object)this);
					return;
				}
				int num = 0;
				for (int num2 = grants.Count - 1; num2 >= 0; num2--)
				{
					if (grants[num2].expiresAt <= Time.fixedTime)
					{
						num += grants[num2].amount;
						grants.RemoveAt(num2);
					}
				}
				if (num > 0)
				{
					ChangeCount(-num);
				}
			}
		}

		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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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);
		}

		public static void AddTemporaryShield(CharacterBody body, int amount, float duration)
		{
			if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && amount > 0 && !(duration <= 0f))
			{
				TemporaryShieldTracker temporaryShieldTracker = ((Component)body).GetComponent<TemporaryShieldTracker>();
				if (!Object.op_Implicit((Object)(object)temporaryShieldTracker))
				{
					temporaryShieldTracker = ((Component)body).gameObject.AddComponent<TemporaryShieldTracker>();
				}
				temporaryShieldTracker.Add(amount, duration);
			}
		}

		private void OnLoadModCompat()
		{
		}
	}
}
namespace Augmentum.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()
		{
			if (Object.op_Implicit((Object)(object)ArtifactDef) && Augmentum.ArtifactStatusDictionary.GetValueOrDefault(this, defaultValue: false) && Object.op_Implicit((Object)(object)RunArtifactManager.instance))
			{
				return RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef);
			}
			return false;
		}

		public static bool IsActive(ArtifactBase artifact)
		{
			return artifact?.IsSelectedAndInRun() ?? false;
		}

		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_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: 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_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: 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_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: 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_0018: 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_0022: 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_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: 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 CustomElite CustomEliteDef;

		public CustomElite CustomEliteDefHonor;

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

		public GameObject TargetingIndicatorPrefabBase;

		public abstract string EliteEquipmentName { get; }

		public abstract string EliteAffixToken { get; }

		public abstract string EliteEquipmentPickupDesc { get; }

		public abstract string EliteEquipmentFullDescriptionRaw { get; }

		public abstract string EliteEquipmentFullDescriptionFormatted { 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; }

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

		public virtual bool EnigmaCompatible { get; }

		public virtual bool IsBoss { get; }

		public virtual bool IsLunar { get; }

		public virtual bool AllowHonor { get; } = true;

		public abstract GameObject EliteEquipmentModel { get; }

		public virtual GameObject EliteBodyModel { get; }

		public virtual Texture2D RampTexture { get; }

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

		public EliteDef EliteDef => CustomEliteDef.EliteDef;

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

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

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

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

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

		public virtual VanillaEliteTier VanillaTier { get; set; } = (VanillaEliteTier)1;

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

		public virtual TargetingType TargetingTypeEnum { get; }

		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", EliteEquipmentFullDescriptionRaw);
			LanguageAPI.Add("BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_LORE", EliteEquipmentLore);
			LanguageAPI.Add("BRANS_ELITE_" + EliteAffixToken + "_MODIFIER", EliteModifier + " {0}");
		}

		public string GetLangDesc()
		{
			return Language.GetString("BRANS_ELITE_EQUIPMENT_" + EliteAffixToken + "_DESCRIPTION");
		}

		protected void CreateEquipment()
		{
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Expected O, but got Unknown
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Expected O, but got Unknown
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Expected O, but got Unknown
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: 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 = EliteEquipmentFullDescriptionFormatted;
			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();
		}

		protected void CreateAffixBuffDef()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			EliteBuffDef = ScriptableObject.CreateInstance<BuffDef>();
			((Object)EliteBuffDef).name = EliteAffixToken;
			EliteBuffDef.isDebuff = false;
			EliteBuffDef.buffColor = EliteBuffColor;
			EliteBuffDef.canStack = false;
			EliteBuffDef.iconSprite = EliteBuffIcon;
			ContentAddition.AddBuffDef(EliteBuffDef);
		}

		private void DefaultTexture()
		{
			//IL_000b: 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_0044: 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>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].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_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_00aa: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Expected O, but got Unknown
			VanillaEliteTier vanillaTier = VanillaTier;
			string text = "BRANS_ELITE_" + EliteAffixToken + "_MODIFIER";
			IEnumerable<EliteTierDef> source;
			if ((int)vanillaTier == 0)
			{
				EliteTierDef[] combatDirectorEliteTiers = EliteAPI.GetCombatDirectorEliteTiers();
				EliteTierDef[] array = CanAppearInEliteTiers.Except(combatDirectorEliteTiers).ToArray();
				for (int i = 0; i < array.Length; i++)
				{
					EliteAPI.AddCustomEliteTier(array[i]);
				}
				source = CanAppearInEliteTiers;
			}
			else
			{
				source = EliteAPI.GetEliteTierEnumerable(vanillaTier);
			}
			source = source.Where((EliteTierDef x) => x != null).ToArray();
			if (!source.Any())
			{
				Augmentum.ModLogger.LogError((object)$"Elite {EliteModifier}: no valid elite tiers found for {vanillaTier}, it will not spawn.");
			}
			CustomEliteDef = new CustomElite("BRANS_ELITE_" + EliteAffixToken, EliteEquipmentDef, Color32.op_Implicit(EliteBuffColor), text, source, RampTexture);
			EliteDef.healthBoostCoefficient = HealthMultiplier;
			EliteDef.damageBoostCoefficient = DamageMultiplier;
			EliteBuffDef.eliteDef = EliteDef;
			EliteAPI.Add(CustomEliteDef);
			if (AllowHonor && (int)vanillaTier != 0)
			{
				EliteTierDef[] array2 = (from x in EliteAPI.GetHonorEliteTierEnumerable(vanillaTier)
					where x != null
					select x).ToArray();
				if (array2.Length != 0)
				{
					CustomEliteDefHonor = new CustomElite("BRANS_ELITE_" + EliteAffixToken + "_HONOR", EliteEquipmentDef, Color32.op_Implicit(EliteBuffColor), text, (IEnumerable<EliteTierDef>)array2, RampTexture);
					CustomEliteDefHonor.EliteDef.healthBoostCoefficient = HonorHealthMultiplier;
					CustomEliteDefHonor.EliteDef.damageBoostCoefficient = HonorDamageMultiplier;
					EliteAPI.Add(CustomEliteDefHonor);
				}
			}
		}

		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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			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_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: 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_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: 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_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: 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_0018: 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_0022: 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_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: 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_001d: 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;

		public abstract string EquipmentName { get; }

		public abstract string EquipmentLangTokenName { get; }

		public abstract string EquipmentPickupDesc { get; }

		public abstract string EquipmentFullDescriptionRaw { get; }

		public abstract string EquipmentFullDescriptionFormatted { 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; }

		public virtual bool IsLunar { get; }

		public virtual bool UseTargeting { get; }

		public virtual TargetingType TargetingTypeEnum { get; }

		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", EquipmentFullDescriptionRaw);
			LanguageAPI.Add("EQUIPMENT_" + EquipmentLangTokenName + "_LORE", EquipmentLore);
		}

		public string GetLangDesc()
		{
			return Language.GetString("EQUIPMENT_" + EquipmentLangTokenName + "_DESCRIPTION");
		}

		public abstract ItemDisplayRuleDict CreateItemDisplayRules();

		protected void CreateEquipment()
		{
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: 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 = EquipmentFullDescriptionFormatted;
			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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			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 ItemFullDescriptionRaw { get; }

		public abstract string ItemFullDescriptionFormatted { get; }

		public abstract string ItemLore { get; }

		public virtual ItemTierDef ModdedTierDef { get; }

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

		public bool AIBlacklisted { get; internal set; }

		public bool PrinterBlacklisted { get; internal set; }

		public virtual bool BlacklistFromPreLoad { get; internal set; }

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

		public string FormattedDescriptionToken => "ITEM_" + ItemLangTokenName + "_DESCRIPTION_FORMATTED";

		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", ItemFullDescriptionRaw);
			LanguageAPI.Add("ITEM_" + ItemLangTokenName + "_LORE", ItemLore);
		}

		public string GetLangDesc()
		{
			return Language.GetString("ITEM_" + ItemLangTokenName + "_DESCRIPTION");
		}

		public void UpdateDescriptionToken()
		{
			if (Object.op_Implicit((Object)(object)ItemDef))
			{
				Language currentLanguage = Language.currentLanguage;
				if (currentLanguage != null)
				{
					currentLanguage.SetStringByToken(FormattedDescriptionToken, ItemFullDescriptionFormatted);
				}
				ItemDef.descriptionToken = FormattedDescriptionToken;
			}
		}

		public abstract ItemDisplayRuleDict CreateItemDisplayRules();

		protected void CreateItem()
		{
			//IL_00e5: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Expected O, but got Unknown
			ItemDef = ScriptableObject.CreateInstance<ItemDef>();
			((Object)ItemDef).name = "ITEM_" + ItemLangTokenName;
			ItemDef.nameToken = "ITEM_" + ItemLangTokenName + "_NAME";
			ItemDef.pickupToken = "ITEM_" + ItemLangTokenName + "_PICKUP";
			UpdateDescriptionToken();
			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));
		}

		protected virtual void SetLogbookCameraPosition()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			ModelPanelParameters obj = ItemModel.AddComponent<ModelPanelParameters>();
			obj.focusPointTransform = ItemModel.transform.Find("FocusPoint");
			obj.cameraPositionTransform = ItemModel.transform.Find("CameraPosition");
			obj.modelRotation = new Quaternion(0f, 0f, 0f, 1f);
			obj.minDistance = 1f;
			obj.maxDistance = 3f;
		}

		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 GetCount(body.inventory);
		}

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

		public int GetCount(Inventory inventory)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			if (!Object.op_Implicit((Object)(object)inventory) || !Object.op_Implicit((Object)(object)ItemDef) || (int)ItemDef.itemIndex == -1)
			{
				return 0;
			}
			return inventory.GetItemCount(ItemDef);
		}

		internal static void RegisterVoidPairings(orig_Init orig)
		{
			//IL_0091: 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_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: 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 Augmentum.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))
					{
						Augmentum.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 Augmentum.Modules.Pickups.Equipments
{
	internal class AirTotem : EquipmentBase<AirTotem>
	{
		public static GameObject ItemBodyModelPrefab;

		public static ConfigEntry<int> T1EssenceCountEntry;

		public static ConfigEntry<int> T2EssenceCountEntry;

		public static ConfigEntry<int> T3EssenceCountEntry;

		public static ConfigEntry<int> BossEssenceCountEntry;

		public override string EquipmentName => "Reducer";

		public override string EquipmentLangTokenName => "Reducer";

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

		public override string EquipmentFullDescriptionRaw => "<style=cIsUtility>Transform</style> an item to an {0} which gives a slight <style=cIsUtility>stat boost</style>.<style=cIsUtility> Scales with item rarity</style>.";

		public override string EquipmentFullDescriptionFormatted => string.Format(GetLangDesc(), Augmentum.EssenceKeyword);

		public override string EquipmentLore => "";

		public override bool UseTargeting => true;

		public override GameObject EquipmentModel => SetupModel();

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

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

		public static int T1EssenceCount
		{
			get
			{
				if (T1EssenceCountEntry == null)
				{
					return 0;
				}
				return T1EssenceCountEntry.Value;
			}
		}

		public static int T2EssenceCount
		{
			get
			{
				if (T2EssenceCountEntry == null)
				{
					return 0;
				}
				return T2EssenceCountEntry.Value;
			}
		}

		public static int T3EssenceCount
		{
			get
			{
				if (T3EssenceCountEntry == null)
				{
					return 0;
				}
				return T3EssenceCountEntry.Value;
			}
		}

		public static int BossEssenceCount
		{
			get
			{
				if (BossEssenceCountEntry == null)
				{
					return 0;
				}
				return BossEssenceCountEntry.Value;
			}
		}

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

		private void CreateConfig(ConfigFile config)
		{
			T1EssenceCountEntry = ConfigManager.ConfigOption("Equipment: " + EquipmentName, "Drops from T1 items", 1, "How many essences should drop from T1 Items?");
			T2EssenceCountEntry = ConfigManager.ConfigOption("Equipment: " + EquipmentName, "Drops from T2 items", 3, "How many essences should drop from T2 Items?");
			T3EssenceCountEntry = ConfigManager.ConfigOption("Equipment: " + EquipmentName, "Drops from T3 items", 15, "How many essences should drop from T3 Items?");
			BossEssenceCountEntry = ConfigManager.ConfigOption("Equipment: " + EquipmentName, "Drops from Boss items", 8, "How many essences should drop from Boss Items?");
		}

		private void CreateTargetingIndicator()
		{
			//IL_0026: 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_0064: 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_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Recycle/PickupRecycler.prefab").WaitForCompletion(), "Reducer", false);
			Texture2D val = Augmentum.MainAssets.LoadAsset<Texture2D>("Assets/Textrures/Icons/Equipment/Reducer/ReducerTexture.png");
			((Renderer)obj.GetComponentInChildren<MeshRenderer>()).GetMaterial().SetTexture("_MainTex", (Texture)(object)val);
			return obj;
		}

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

		public override void Hooks()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			EquipmentSlot.UpdateTargets += new hook_UpdateTargets(UpdateTargets);
			Language.LoadStrings += (hook_LoadStrings)delegate(orig_LoadStrings orig, Language self)
			{
				orig.Invoke(self);
				EquipmentDef.pickupToken = EquipmentPickupDesc;
			};
			Language.SetCurrentLanguage += (hook_SetCurrentLanguage)delegate(orig_SetCurrentLanguage orig, string languageName, bool forceUnload)
			{
				orig.Invoke(languageName, forceUnload);
				EquipmentDef.pickupToken = EquipmentPickupDesc;
			};
		}

		protected override bool ActivateEquipment(EquipmentSlot slot)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected I4, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Run.instance) || !Object.op_Implicit((Object)(object)slot) || !Object.op_Implicit((Object)(object)slot.characterBody))
			{
				return false;
			}
			GenericPickupController pickupController = slot.currentTarget.pickupController;
			if (!TryGetReducibleItem(pickupController, out var itemDef))
			{
				return false;
			}
			Vector3 position = ((Component)slot).transform.position;
			Ray aimRay = slot.GetAimRay();
			Vector3 direction = ((Ray)(ref aimRay)).direction;
			int num = 0;
			ItemTier tier = itemDef.tier;
			switch ((int)tier)
			{
			case 0:
			case 6:
				num = T1EssenceCount;
				break;
			case 1:
			case 7:
				num = T2EssenceCount;
				break;
			case 2:
			case 8:
				num = T3EssenceCount;
				break;
			case 4:
			case 9:
				num = BossEssenceCount;
				break;
			case 3:
				ConsumePickup(pickupController);
				PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(Items.LunarSpecialReplacement.itemIndex), position, direction * 40f);
				return true;
			}
			if (Object.op_Implicit((Object)(object)ItemBase<LootedBloodburstClam>.instance?.ItemDef) && Object.op_Implicit((Object)(object)slot.inventory))
			{
				num += slot.inventory.GetItemCount(ItemBase<LootedBloodburstClam>.instance.ItemDef) * BloodburstClam.AdditionalDrops;
			}
			ConsumePickup(pickupController);
			for (int i = 1; i <= num; i++)
			{
				PickupDropletController.CreatePickupDroplet(EssenceHelpers.GetEssenceIndex(slot.rng), position + new Vector3(0.1f * (float)i, 3f, 0f), direction * 40f);
			}
			return true;
		}

		public static bool TryGetReducibleItem(GenericPickupController pickupController, out ItemDef itemDef)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Invalid comparison between Unknown and I4
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Invalid comparison between Unknown and I4
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Invalid comparison between Unknown and I4
			itemDef = null;
			if (!IsUsablePickup(pickupController))
			{
				return false;
			}
			PickupDef pic