Decompiled source of DvergerAutomation v0.12.4

plugins/DvergerAutomation.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DvergerAutomation.Common;
using EpicLootAPI;
using EquipmentAndQuickSlotsAPI;
using GUIFramework;
using HarmonyLib;
using JetBrains.Annotations;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using SimpleJson;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("DvergerAutomation")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DvergerAutomation")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.12.4")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.12.4.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace EquipmentAndQuickSlotsAPI
{
	public static class EAQS
	{
		public static readonly Logger logger = new Logger();

		private static Method API_GetApiVersion;

		private static Method API_GetPluginVersion;

		private static Method API_HasEndpoint;

		private static Method API_AddSlot;

		private static Method API_RemoveSlot;

		private static Method API_GetSlotIdsJson;

		private static Method API_GetSlotInfoJson;

		private static Method API_TryGetSlotItem;

		private static Method API_IsSlotCell;

		private static Method API_GetQuickSlotItems;

		private static Method API_GetEquipmentSlotItems;

		private static Method API_GetVisibleRows;

		private static Method API_GetFullHeight;

		private static Method API_AddSlotChangedListener;

		private static Method API_RemoveSlotChangedListener;

		private static Method API_AddSlotItemChangedListener;

		private static Method API_RemoveSlotItemChangedListener;

		private static Method Resolve(ref Method cache, string name)
		{
			return cache ?? (cache = new Method(name));
		}

		public static bool IsLoaded()
		{
			return Method.ApiTypeExists();
		}

		public static int GetApiVersion()
		{
			object[] array = Resolve(ref API_GetApiVersion, "GetApiVersion").Invoke();
			return (int)(((array != null) ? array[0] : null) ?? ((object)0));
		}

		public static string GetPluginVersion()
		{
			object[] array = Resolve(ref API_GetPluginVersion, "GetPluginVersion").Invoke();
			return (string)(((array != null) ? array[0] : null) ?? "");
		}

		public static bool HasEndpoint(string name)
		{
			object[] array = Resolve(ref API_HasEndpoint, "HasEndpoint").Invoke(name);
			return (bool)(((array != null) ? array[0] : null) ?? ((object)false));
		}

		public static bool AddSlot(string slotId, string ownerPluginGuid, string nameToken, Func<ItemData, bool> isValid, Func<bool> isActive)
		{
			object[] array = Resolve(ref API_AddSlot, "AddSlot").Invoke(slotId, ownerPluginGuid, nameToken, isValid, isActive);
			return (bool)(((array != null) ? array[0] : null) ?? ((object)false));
		}

		public static bool RemoveSlot(string slotId)
		{
			object[] array = Resolve(ref API_RemoveSlot, "RemoveSlot").Invoke(slotId);
			return (bool)(((array != null) ? array[0] : null) ?? ((object)false));
		}

		public static string GetSlotIdsJson()
		{
			object[] array = Resolve(ref API_GetSlotIdsJson, "GetSlotIdsJson").Invoke();
			return (string)(((array != null) ? array[0] : null) ?? "[]");
		}

		public static List<string> GetSlotIds()
		{
			List<string> list = new List<string>();
			string[] array = GetSlotIdsJson().Trim('[', ']').Split(new char[1] { ',' });
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i].Trim().Trim(new char[1] { '"' });
				if (text.Length > 0)
				{
					list.Add(text.Replace("\\\"", "\"").Replace("\\\\", "\\"));
				}
			}
			return list;
		}

		public static string GetSlotInfoJson(string slotId)
		{
			object[] array = Resolve(ref API_GetSlotInfoJson, "GetSlotInfoJson").Invoke(slotId);
			return (string)((array != null) ? array[0] : null);
		}

		public static bool TryGetSlotItem(string slotId, out ItemData item)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			item = null;
			object[] array = Resolve(ref API_TryGetSlotItem, "TryGetSlotItem").Invoke(slotId, item);
			if (array == null)
			{
				return false;
			}
			item = (ItemData)array[2];
			return (bool)(array[0] ?? ((object)false));
		}

		public static bool IsSlotCell(int x, int y, out string slotId)
		{
			slotId = null;
			object[] array = Resolve(ref API_IsSlotCell, "IsSlotCell").Invoke(x, y, slotId);
			if (array == null)
			{
				return false;
			}
			slotId = (string)array[3];
			return (bool)(array[0] ?? ((object)false));
		}

		public static List<ItemData> GetQuickSlotItems()
		{
			object[] array = Resolve(ref API_GetQuickSlotItems, "GetQuickSlotItems").Invoke();
			return (List<ItemData>)(((array != null) ? array[0] : null) ?? new List<ItemData>());
		}

		public static List<ItemData> GetEquipmentSlotItems()
		{
			object[] array = Resolve(ref API_GetEquipmentSlotItems, "GetEquipmentSlotItems").Invoke();
			return (List<ItemData>)(((array != null) ? array[0] : null) ?? new List<ItemData>());
		}

		public static int GetVisibleRows()
		{
			object[] array = Resolve(ref API_GetVisibleRows, "GetVisibleRows").Invoke();
			return (int)(((array != null) ? array[0] : null) ?? ((object)4));
		}

		public static int GetFullHeight()
		{
			object[] array = Resolve(ref API_GetFullHeight, "GetFullHeight").Invoke();
			return (int)(((array != null) ? array[0] : null) ?? ((object)4));
		}

		public static void AddSlotChangedListener(Action<string> listener)
		{
			Resolve(ref API_AddSlotChangedListener, "AddSlotChangedListener").Invoke(listener);
		}

		public static void RemoveSlotChangedListener(Action<string> listener)
		{
			Resolve(ref API_RemoveSlotChangedListener, "RemoveSlotChangedListener").Invoke(listener);
		}

		public static void AddSlotItemChangedListener(Action<string, ItemData, ItemData> listener)
		{
			Resolve(ref API_AddSlotItemChangedListener, "AddSlotItemChangedListener").Invoke(listener);
		}

		public static void RemoveSlotItemChangedListener(Action<string, ItemData, ItemData> listener)
		{
			Resolve(ref API_RemoveSlotItemChangedListener, "RemoveSlotItemChangedListener").Invoke(listener);
		}
	}
	public class Logger
	{
		private const string Prefix = "[EquipmentAndQuickSlotsAPI] ";

		public void LogDebug(string message)
		{
		}

		public void LogInfo(string message)
		{
			Debug.Log((object)("[EquipmentAndQuickSlotsAPI] " + message));
		}

		public void LogWarning(string message)
		{
			Debug.LogWarning((object)("[EquipmentAndQuickSlotsAPI] " + message));
		}

		public void LogError(string message)
		{
			Debug.LogError((object)("[EquipmentAndQuickSlotsAPI] " + message));
		}
	}
	internal class Method
	{
		private const string Namespace = "EquipmentAndQuickSlots";

		private const string ClassName = "API";

		private const string Assembly = "EquipmentAndQuickSlots";

		internal const string API_LOCATION = "EquipmentAndQuickSlots.API, EquipmentAndQuickSlots";

		private static readonly Dictionary<string, Type> CachedTypes = new Dictionary<string, Type>();

		private readonly MethodInfo info;

		public bool IsResolved => info != null;

		public object[] Invoke(params object[] args)
		{
			if (info == null)
			{
				return null;
			}
			object obj = info.Invoke(null, args);
			object[] array = new object[args.Length + 1];
			array[0] = obj;
			Array.Copy(args, 0, array, 1, args.Length);
			return array;
		}

		public Method(string methodName, BindingFlags bindingFlags = BindingFlags.Static | BindingFlags.Public)
		{
			if (TryGetType("EquipmentAndQuickSlots.API, EquipmentAndQuickSlots", out Type type) && !(type == null))
			{
				info = type.GetMethod(methodName, bindingFlags);
				if (info == null)
				{
					EAQS.logger.LogWarning("Failed to find public static method '" + methodName + "' in type '" + type.FullName + "'. The installed EquipmentAndQuickSlots version may be older than this shim; gate on EAQS.HasEndpoint().");
				}
			}
		}

		private static bool TryGetType(string typeNameWithAssembly, out Type type)
		{
			if (CachedTypes.TryGetValue(typeNameWithAssembly, out type))
			{
				return type != null;
			}
			type = Type.GetType(typeNameWithAssembly);
			CachedTypes[typeNameWithAssembly] = type;
			if (type == null)
			{
				EAQS.logger.LogWarning("Failed to resolve type: '" + typeNameWithAssembly + "'. Is EquipmentAndQuickSlots installed?");
			}
			return type != null;
		}

		internal static bool ApiTypeExists()
		{
			return Type.GetType("EquipmentAndQuickSlots.API, EquipmentAndQuickSlots") != null;
		}
	}
}
namespace EpicLootAPI
{
	[Serializable]
	[PublicAPI]
	public enum AbilityActivationMode
	{
		Passive,
		Triggerable,
		Activated
	}
	[Serializable]
	[PublicAPI]
	public enum AbilityAction
	{
		Custom,
		StatusEffect
	}
	[Serializable]
	[PublicAPI]
	public class AbilityDefinition
	{
		public string ID = "";

		public string IconAsset = "";

		public AbilityActivationMode ActivationMode;

		public float Cooldown;

		public AbilityAction Action;

		public List<string> ActionParams = new List<string>();

		internal static readonly Method API_AddAbility = new Method("AddAbility");

		internal static readonly Method API_UpdateAbility = new Method("UpdateAbility");

		internal static List<AbilityDefinition> Abilities = new List<AbilityDefinition>();

		[Description("Register a status effect ability which activates on player input")]
		public AbilityDefinition(string ID, string iconAsset, float cooldown, string statusEffectName)
		{
			this.ID = ID;
			ActivationMode = AbilityActivationMode.Activated;
			Cooldown = cooldown;
			Action = AbilityAction.StatusEffect;
			ActionParams.Add(statusEffectName);
			IconAsset = iconAsset;
			Abilities.Add(this);
		}

		internal AbilityDefinition(string ID, AbilityActivationMode mode)
		{
			this.ID = ID;
			ActivationMode = mode;
		}

		public AbilityDefinition()
		{
		}

		public static void RegisterAll()
		{
			foreach (AbilityDefinition item in new List<AbilityDefinition>(Abilities))
			{
				item.Register();
			}
		}

		public bool Register()
		{
			string text = JsonConvert.SerializeObject((object)this);
			if (!(API_AddAbility.Invoke(text)[0] is string value))
			{
				return false;
			}
			RunTimeRegistry.Register(this, value);
			Abilities.Remove(this);
			EpicLoot.logger.LogDebug("Registered ability: " + ID);
			return true;
		}

		public bool Update()
		{
			if (!RunTimeRegistry.TryGetValue(this, out string value))
			{
				return false;
			}
			string text = JsonConvert.SerializeObject((object)this);
			bool flag = (bool)(API_UpdateAbility.Invoke(value, text)[0] ?? ((object)false));
			EpicLoot.logger.LogDebug($"Updated ability {ID}: {flag}");
			return flag;
		}
	}
	[PublicAPI]
	public class AbilityProxyDefinition
	{
		public readonly AbilityDefinition Ability;

		public readonly Dictionary<string, Delegate> Callbacks = new Dictionary<string, Delegate>();

		internal static readonly List<AbilityProxyDefinition> ProxyAbilities = new List<AbilityProxyDefinition>();

		internal static readonly Method API_RegisterProxyAbility = new Method("RegisterProxyAbility");

		internal static readonly Method API_UpdateProxyAbility = new Method("UpdateProxyAbility");

		[Description("Register a complex ability behavior using Proxy class")]
		public AbilityProxyDefinition(string ID, AbilityActivationMode mode, Proxy definition)
		{
			Ability = new AbilityDefinition(ID, mode);
			RegisterCallbacks(definition);
			ProxyAbilities.Add(this);
		}

		[Description("Register a complex ability behavior using Proxy class")]
		public AbilityProxyDefinition(string ID, AbilityActivationMode mode, Type type)
		{
			Ability = new AbilityDefinition(ID, mode);
			if (!typeof(Proxy).IsAssignableFrom(type))
			{
				EpicLoot.logger.LogError("Ability Proxy " + ID + " Type " + type.Name + " does not implement Proxy class");
				return;
			}
			try
			{
				object obj = Activator.CreateInstance(type);
				RegisterCallbacks((Proxy)obj);
				ProxyAbilities.Add(this);
			}
			catch (Exception ex)
			{
				EpicLoot.logger.LogError("Failed to create instance of " + type.Name + ": " + ex.Message);
			}
		}

		private void RegisterCallbacks(Proxy implementation)
		{
			Type type = implementation.GetType();
			MethodInfo[] methods = typeof(Proxy).GetMethods();
			foreach (MethodInfo methodInfo in methods)
			{
				try
				{
					Type[] array = (from p in methodInfo.GetParameters()
						select p.ParameterType).ToArray();
					MethodInfo method = type.GetMethod(methodInfo.Name, array);
					if (method == null)
					{
						EpicLoot.logger.LogWarning("Method " + methodInfo.Name + " not found in implementation");
						continue;
					}
					Type type2 = ((!(methodInfo.ReturnType == typeof(void))) ? Expression.GetFuncType(array.Concat(new Type[1] { methodInfo.ReturnType }).ToArray()) : ((array.Length != 0) ? Expression.GetActionType(array) : typeof(Action)));
					Delegate value = Delegate.CreateDelegate(type2, implementation, method);
					Callbacks[methodInfo.Name] = value;
				}
				catch (Exception ex)
				{
					EpicLoot.logger.LogError("Failed to register callback for method " + methodInfo.Name + ": " + ex.Message);
				}
			}
		}

		public static void RegisterAll()
		{
			foreach (AbilityProxyDefinition item in new List<AbilityProxyDefinition>(ProxyAbilities))
			{
				item.Register();
			}
		}

		public bool Register()
		{
			string text = JsonConvert.SerializeObject((object)Ability);
			if (!(API_RegisterProxyAbility.Invoke(text, Callbacks)[0] is string value))
			{
				return false;
			}
			RunTimeRegistry.Register(this, value);
			ProxyAbilities.Remove(this);
			EpicLoot.logger.LogDebug("Registered proxy ability: " + Ability.ID);
			return true;
		}

		public bool Update()
		{
			if (!RunTimeRegistry.TryGetValue(this, out string value))
			{
				return false;
			}
			string text = JsonConvert.SerializeObject((object)Ability);
			bool flag = (bool)(API_UpdateProxyAbility.Invoke(value, text, Callbacks)[0] ?? ((object)false));
			EpicLoot.logger.LogDebug($"Updated proxy ability: {Ability.ID}, {flag}");
			return flag;
		}
	}
	[Description("Functions are converted into delegates when registered to epic loot")]
	[PublicAPI]
	public class Proxy
	{
		protected Player Player;

		public string AbilityID = "";

		public float Cooldown;

		public virtual string CooldownEndKey => "EpicLoot." + AbilityID + ".CooldownEnd";

		public virtual void Initialize(Player player, string id, float cooldown)
		{
			Player = player;
			AbilityID = id;
			Cooldown = cooldown;
		}

		public virtual void OnUpdate()
		{
		}

		public virtual bool ShouldTrigger()
		{
			return false;
		}

		public virtual bool IsOnCooldown()
		{
			if (HasCooldown())
			{
				return GetTime() < GetCooldownEndTime();
			}
			return false;
		}

		public virtual float TimeUntilCooldownEnds()
		{
			return Mathf.Max(0f, GetCooldownEndTime() - GetTime());
		}

		public virtual float PercentCooldownComplete()
		{
			if (HasCooldown() && IsOnCooldown())
			{
				return 1f - TimeUntilCooldownEnds() / Cooldown;
			}
			return 1f;
		}

		public virtual bool CanActivate()
		{
			return !IsOnCooldown();
		}

		public virtual void TryActivate()
		{
			if (CanActivate())
			{
				Activate();
			}
		}

		public virtual void Activate()
		{
			if (HasCooldown())
			{
				float cooldownEndTime = GetTime() + Cooldown;
				SetCooldownEndTime(cooldownEndTime);
			}
		}

		public virtual void ActivateCustomAction()
		{
		}

		public virtual void ActivateStatusEffectAction()
		{
		}

		public virtual bool HasCooldown()
		{
			return Cooldown > 0f;
		}

		public virtual void SetCooldownEndTime(float cooldownEndTime)
		{
			if (!((Object)(object)Player == (Object)null))
			{
				((Character)Player).m_nview.GetZDO().Set(CooldownEndKey, cooldownEndTime);
			}
		}

		public virtual float GetCooldownEndTime()
		{
			if ((Object)(object)Player == (Object)null)
			{
				return 0f;
			}
			return ((Character)Player).m_nview.GetZDO().GetFloat(CooldownEndKey, 0f);
		}

		public virtual void OnRemoved()
		{
		}

		protected static float GetTime()
		{
			return (float)ZNet.instance.GetTimeSeconds();
		}
	}
	public static class EpicLoot
	{
		[PublicAPI]
		public static class ChangeReason
		{
			public const string Enchant = "Enchant";

			public const string Augment = "Augment";

			public const string Disenchant = "Disenchant";

			public const string Rune = "Rune";

			public const string Temper = "Temper";

			public const string Socket = "Socket";

			public const string Unsocket = "Unsocket";

			public const string LootRoll = "LootRoll";

			public const string Transfer = "Transfer";

			public const string AddSocket = "AddSocket";

			public const string Unspecified = "Unspecified";
		}

		public static readonly Logger logger = new Logger();

		private static readonly Method API_GetTotalActiveMagicEffectValue = new Method("GetTotalActiveMagicEffectValue");

		private static readonly Method API_GetTotalActiveMagicEffectValueForWeapon = new Method("GetTotalActiveMagicEffectValueForWeapon");

		private static readonly Method API_HasActiveMagicEffect = new Method("HasActiveMagicEffect");

		private static readonly Method API_HasActiveMagicEffectOnWeapon = new Method("HasActiveMagicEffectOnWeapon");

		private static readonly Method API_GetTotalActiveSetEffectValue = new Method("GetTotalActiveSetEffectValue");

		private static readonly Method API_GetAllActiveMagicEffects = new Method("GetAllActiveMagicEffects");

		private static readonly Method API_GetAllSetMagicEffects = new Method("GetAllActiveSetMagicEffects");

		private static readonly Method API_GetPlayerTotalActiveMagicEffectValue = new Method("GetTotalPlayerActiveMagicEffectValue");

		private static readonly Method API_PlayerHasActiveMagicEffect = new Method("PlayerHasActiveMagicEffect");

		private static readonly Method API_HasLegendaryItem = new Method("HasLegendaryItem");

		private static readonly Method API_HasLegendarySet = new Method("HasLegendarySet");

		private static readonly Method API_RegisterAsset = new Method("RegisterAsset");

		private static readonly Method API_GetMagicItemJson = new Method("GetMagicItemJson");

		private static readonly Method API_RegisterMagicEffectRequirement = new Method("RegisterMagicEffectRequirement", typeof(string), typeof(Func<ItemData, object, string, bool, bool, bool, bool>));

		private static readonly Method API_AddMagicItemChangedListener = new Method("AddMagicItemChangedListener", typeof(Action<ItemData, string>));

		private static readonly Method API_RemoveMagicItemChangedListener = new Method("RemoveMagicItemChangedListener", typeof(Action<ItemData, string>));

		private static readonly Method API_AddLootGeneratedListener = new Method("AddLootGeneratedListener", typeof(Action<ItemData>));

		private static readonly Method API_RemoveLootGeneratedListener = new Method("RemoveLootGeneratedListener", typeof(Action<ItemData>));

		private static readonly Method API_AddBountyCompletedListener = new Method("AddBountyCompletedListener", typeof(Action<Player, string>));

		private static readonly Method API_RemoveBountyCompletedListener = new Method("RemoveBountyCompletedListener", typeof(Action<Player, string>));

		private static readonly Method API_TryMakeMagicItem = new Method("TryMakeMagicItem");

		private static readonly Method API_RollMagicItemJson = new Method("RollMagicItemJson");

		private static readonly Method API_ApplyMagicItemJson = new Method("ApplyMagicItemJson");

		private static readonly Method API_GetLuckFactor = new Method("GetLuckFactor");

		private static readonly Method API_RollEffectCountForRarity = new Method("RollEffectCountForRarity");

		private static readonly Method API_GetLegendaryIDs = new Method("GetLegendaryIDs");

		private static readonly Method API_GetLegendaryInfoJson = new Method("GetLegendaryInfoJson");

		private static readonly Method API_GetAvailableEffectTypes = new Method("GetAvailableEffectTypes");

		private static readonly Method API_AddLootTables = new Method("AddLootTables");

		private static readonly Method API_UpdateLootTables = new Method("UpdateLootTables");

		private static readonly Method API_RegisterInventoryProvider = new Method("RegisterInventoryProvider", typeof(string), typeof(Func<List<ItemData>>), typeof(Func<string, int>), typeof(Func<string, int, int>), typeof(Func<ItemData, int, int>));

		private static readonly Method API_UnregisterInventoryProvider = new Method("UnregisterInventoryProvider");

		private static readonly Method API_RegisterInventoryProviderSaveHandler = new Method("RegisterInventoryProviderSaveHandler", typeof(string), typeof(Func<ItemData, bool>));

		private static readonly Method API_RegisterEquipmentProvider = new Method("RegisterEquipmentProvider", typeof(string), typeof(Func<Player, List<ItemData>>));

		private static readonly Method API_UnregisterEquipmentProvider = new Method("UnregisterEquipmentProvider");

		private static readonly Method API_RegisterSacrificeFilter = new Method("RegisterSacrificeFilter", typeof(string), typeof(Func<ItemData, bool>));

		private static readonly Method API_UnregisterSacrificeFilter = new Method("UnregisterSacrificeFilter");

		private static readonly Method API_InvalidatePlayerEffectCache = new Method("InvalidatePlayerEffectCache");

		private static readonly Method API_GetRegisteredProviders = new Method("GetRegisteredProviders");

		private static readonly Method API_GetApiVersion = new Method("GetApiVersion");

		private static readonly Method API_GetPluginVersion = new Method("GetPluginVersion");

		private static readonly Method API_HasEndpoint = new Method("HasEndpoint");

		private static readonly Method API_IsMagicItem = new Method("IsMagicItem");

		private static readonly Method API_TryGetRarity = new Method("TryGetRarity");

		private static readonly Method API_GetRarityCount = new Method("GetRarityCount");

		private static readonly Method API_GetRarityColorByIndex = new Method("GetRarityColorByIndex");

		private static readonly Method API_GetRarityDisplayNameByIndex = new Method("GetRarityDisplayNameByIndex");

		private static readonly Method API_GetItemRarityColor = new Method("GetItemRarityColor");

		private static readonly Method API_IsEpicLootItem = new Method("IsEpicLootItem");

		private static readonly Method API_IsShardStone = new Method("IsShardStone");

		private static readonly Method API_IsRunestone = new Method("IsRunestone");

		private static readonly Method API_IsMagicCraftingMaterial = new Method("IsMagicCraftingMaterial");

		private static readonly Method API_IsUnidentified = new Method("IsUnidentified");

		private static readonly Method API_CanBeMagicItem = new Method("CanBeMagicItem");

		private static readonly Method API_ItemHasMagicEffect = new Method("ItemHasMagicEffect");

		private static readonly Method API_GetAllMagicEffectTypes = new Method("GetAllMagicEffectTypes");

		private static readonly Method API_GetEnchantCostsJson = new Method("GetEnchantCostsJson");

		private static readonly Method API_GetSacrificeProductsJson = new Method("GetSacrificeProductsJson");

		private static readonly Method API_GetItemDisplayName = new Method("GetItemDisplayName");

		private static readonly Method API_GetItemDecoratedName = new Method("GetItemDecoratedName", typeof(ItemData), typeof(string));

		private static readonly Method API_ApplyMagicItemBackground = new Method("ApplyMagicItemBackground", typeof(GameObject), typeof(GameObject), typeof(ItemData), typeof(bool));

		private static readonly Method API_ApplyMagicItemBackgroundToIcon = new Method("ApplyMagicItemBackgroundToIcon", typeof(GameObject), typeof(ItemData));

		[PublicAPI]
		[Description("Send all your custom conversions, effects, item definitions, etc... to Epic Loot")]
		public static void RegisterAll()
		{
			MaterialConversion.RegisterAll();
			MagicItemEffectDefinition.RegisterAll();
			AbilityDefinition.RegisterAll();
			CustomRecipe.RegisterAll();
			Sacrifice.RegisterAll();
			TreasureMap.RegisterAll();
			SecretStashItem.RegisterAll();
			LegendaryInfo.RegisterAll();
			LegendarySetInfo.RegisterAll();
			BountyTarget.RegisterAll();
			AbilityProxyDefinition.RegisterAll();
		}

		[PublicAPI]
		[Description("Register asset into EpicLoot in order to target them in your definitions")]
		public static bool RegisterAsset(string name, object asset)
		{
			bool flag = (bool)(API_RegisterAsset.Invoke(name, asset)[0] ?? ((object)false));
			logger.LogDebug($"Registered asset: {name}, {flag}");
			return flag;
		}

		[PublicAPI]
		public static bool RegisterMagicEffectRequirement(string externalRequirement, Func<ItemData, object, string, bool, bool, bool, bool> requirement)
		{
			bool flag = (bool)(API_RegisterMagicEffectRequirement.Invoke(externalRequirement, requirement)[0] ?? ((object)false));
			logger.LogDebug($"Registered magic effect requirement: {externalRequirement}, {flag}");
			return flag;
		}

		[PublicAPI]
		public static bool HasLegendaryItem(this Player player, string legendaryItemID)
		{
			bool flag = (bool)(API_HasLegendaryItem.Invoke(player, legendaryItemID)[0] ?? ((object)false));
			logger.LogDebug($"Has legendary item: {legendaryItemID}, {flag} ");
			return flag;
		}

		[PublicAPI]
		public static bool HasLegendarySet(this Player player, string legendarySetID, out int count)
		{
			count = 0;
			object[] array = API_HasLegendarySet.Invoke(player, legendarySetID, count);
			count = (int)(array[3] ?? ((object)0));
			bool flag = (bool)(array[0] ?? ((object)false));
			logger.LogDebug($"Has legendary set: {legendarySetID}, {flag}, count: {count}");
			return flag;
		}

		[PublicAPI]
		public static bool HasActiveMagicEffectOnWeapon(Player player, ItemData item, string effectType, out float effectValue)
		{
			effectValue = 0f;
			object[] array = API_HasActiveMagicEffectOnWeapon.Invoke(player, item, effectType, effectValue);
			effectValue = (float)(array[4] ?? ((object)0f));
			bool flag = (bool)(array[0] ?? ((object)false));
			logger.LogDebug($"Has magic effect on weapon: {effectType}, {flag}, value: {effectValue}");
			return flag;
		}

		[PublicAPI]
		public static float GetTotalActiveMagicEffectValue(Player player, ItemData item, string effectType, float scale = 1f)
		{
			float num = (float)(API_GetTotalActiveMagicEffectValue.Invoke(player, item, effectType, scale)[0] ?? ((object)0f));
			logger.LogDebug($"Total magic effect value: {effectType}, amount: {num}");
			return num;
		}

		[PublicAPI]
		public static float GetTotalActiveMagicEffectValueForWeapon(Player player, ItemData item, string effectType, float scale = 1f)
		{
			float num = (float)(API_GetTotalActiveMagicEffectValueForWeapon.Invoke(player, item, effectType, scale)[0] ?? ((object)0f));
			logger.LogDebug($"Total effect on weapon: {effectType}, amount: {num}");
			return num;
		}

		[PublicAPI]
		public static bool HasActiveMagicEffect(Player player, string effectType, ItemData item, out float effectValue)
		{
			effectValue = 0f;
			object[] array = API_HasActiveMagicEffect.Invoke(player, effectType, item, effectValue);
			effectValue = (float)(array[4] ?? ((object)0f));
			bool flag = (bool)(array[0] ?? ((object)false));
			logger.LogDebug($"Has active effect: {effectType}, {flag}, value: {effectValue}");
			return flag;
		}

		[PublicAPI]
		public static float GetTotalActiveSetEffectValue(Player player, string effectType, float scale = 1f)
		{
			float num = (float)(API_GetTotalActiveSetEffectValue.Invoke(player, effectType, scale)[0] ?? ((object)0f));
			logger.LogDebug($"Total effect value: {effectType}, amount: {num}");
			return num;
		}

		[PublicAPI]
		public static List<MagicItemEffect> GetAllActiveMagicEffects(this Player player, string effectType = null)
		{
			List<string> list = (List<string>)(API_GetAllActiveMagicEffects.Invoke(player, effectType)[0] ?? new List<string>());
			if (list.Count <= 0)
			{
				return new List<MagicItemEffect>();
			}
			List<MagicItemEffect> list2 = new List<MagicItemEffect>();
			list2.DeserializeList(list);
			return list2;
		}

		[PublicAPI]
		public static List<MagicItemEffect> GetAllActiveSetMagicEffects(this Player player, string effectType = null)
		{
			List<string> list = (List<string>)(API_GetAllSetMagicEffects.Invoke(player, effectType)[0] ?? new List<string>());
			if (list.Count <= 0)
			{
				return new List<MagicItemEffect>();
			}
			List<MagicItemEffect> list2 = new List<MagicItemEffect>();
			list2.DeserializeList(list);
			return list2;
		}

		private static void DeserializeList<T>(this List<T> output, List<string> input)
		{
			foreach (string item in input)
			{
				try
				{
					T val = JsonConvert.DeserializeObject<T>(item);
					if (val != null)
					{
						output.Add(val);
					}
				}
				catch
				{
					logger.LogWarning("Failed to parse " + typeof(T).Name);
				}
			}
		}

		[PublicAPI]
		public static float GetTotalActiveMagicEffectValue(this Player player, string effectType, float scale = 1f, ItemData ignoreThisItem = null)
		{
			float num = (float)(API_GetPlayerTotalActiveMagicEffectValue.Invoke(player, effectType, scale, ignoreThisItem)[0] ?? ((object)0f));
			logger.LogDebug($"Total magic effect: {effectType}, value: {num}");
			return num;
		}

		[PublicAPI]
		public static bool HasActiveMagicEffect(this Player player, string effectType, out float effectValue, float scale = 1f, ItemData ignoreThisItem = null)
		{
			effectValue = 0f;
			object[] array = API_PlayerHasActiveMagicEffect.Invoke(player, effectType, effectValue, scale, ignoreThisItem);
			effectValue = (float)(array[3] ?? ((object)0f));
			bool flag = (bool)(array[0] ?? ((object)false));
			logger.LogDebug($"Has active magic effect: {effectType}, value: {flag}");
			return flag;
		}

		[PublicAPI]
		public static MagicItem GetMagicItem(this ItemData itemData)
		{
			string text = (string)(API_GetMagicItemJson.Invoke(itemData)[0] ?? "");
			if (string.IsNullOrEmpty(text))
			{
				return null;
			}
			return JsonConvert.DeserializeObject<MagicItem>(text);
		}

		[PublicAPI]
		public static bool AddMagicItemChangedListener(Action<ItemData, string> listener)
		{
			return (bool)(API_AddMagicItemChangedListener.Invoke(listener)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool RemoveMagicItemChangedListener(Action<ItemData, string> listener)
		{
			return (bool)(API_RemoveMagicItemChangedListener.Invoke(listener)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool AddLootGeneratedListener(Action<ItemData> listener)
		{
			return (bool)(API_AddLootGeneratedListener.Invoke(listener)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool RemoveLootGeneratedListener(Action<ItemData> listener)
		{
			return (bool)(API_RemoveLootGeneratedListener.Invoke(listener)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool AddBountyCompletedListener(Action<Player, string> listener)
		{
			return (bool)(API_AddBountyCompletedListener.Invoke(listener)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool RemoveBountyCompletedListener(Action<Player, string> listener)
		{
			return (bool)(API_RemoveBountyCompletedListener.Invoke(listener)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool TryMakeMagicItem(this ItemData item, ItemRarity rarity, float luck = 0f, string? legendaryID = null)
		{
			bool flag = (bool)(API_TryMakeMagicItem.Invoke(item, (int)rarity, luck, legendaryID ?? "")[0] ?? ((object)false));
			logger.LogDebug($"Made magic item: {item?.m_shared?.m_name}, {rarity}, {flag}");
			return flag;
		}

		[PublicAPI]
		public static MagicItem? RollMagicItem(ItemRarity rarity, ItemData item, float luck = 0f)
		{
			string text = (string)(API_RollMagicItemJson.Invoke((int)rarity, item, luck)[0] ?? "");
			if (string.IsNullOrEmpty(text))
			{
				return null;
			}
			try
			{
				return JsonConvert.DeserializeObject<MagicItem>(text);
			}
			catch
			{
				logger.LogWarning("Failed to parse rolled magic item");
				return null;
			}
		}

		[PublicAPI]
		public static bool ApplyMagicItem(this ItemData item, MagicItem magicItem)
		{
			if (magicItem == null)
			{
				return false;
			}
			string text = JsonConvert.SerializeObject((object)magicItem);
			return (bool)(API_ApplyMagicItemJson.Invoke(item, text)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static float GetLuckFactor(Vector3 position)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			return (float)(API_GetLuckFactor.Invoke(position)[0] ?? ((object)0f));
		}

		[PublicAPI]
		public static int RollEffectCountForRarity(ItemRarity rarity)
		{
			return (int)(API_RollEffectCountForRarity.Invoke((int)rarity)[0] ?? ((object)0));
		}

		[PublicAPI]
		public static List<string> GetLegendaryIDs(ItemRarity rarity)
		{
			return (List<string>)(API_GetLegendaryIDs.Invoke((int)rarity)[0] ?? new List<string>());
		}

		[PublicAPI]
		public static LegendaryInfo? GetLegendaryInfo(string legendaryID)
		{
			string text = (string)(API_GetLegendaryInfoJson.Invoke(legendaryID)[0] ?? "");
			if (string.IsNullOrEmpty(text))
			{
				return null;
			}
			try
			{
				return JsonConvert.DeserializeObject<LegendaryInfo>(text);
			}
			catch
			{
				logger.LogWarning("Failed to parse legendary info for " + legendaryID);
				return null;
			}
		}

		[PublicAPI]
		public static List<string> GetAvailableEffectTypes(this ItemData item, ItemRarity rarity, MagicItem? magicItem = null)
		{
			string text = ((magicItem == null) ? "" : JsonConvert.SerializeObject((object)magicItem));
			return (List<string>)(API_GetAvailableEffectTypes.Invoke(item, text, (int)rarity)[0] ?? new List<string>());
		}

		[PublicAPI]
		public static bool AddLootTables(string json)
		{
			if (!(API_AddLootTables.Invoke(json)[0] is string value))
			{
				return false;
			}
			RunTimeRegistry.Register(json, value);
			logger.LogDebug("Registered external loot tables");
			return true;
		}

		[PublicAPI]
		public static bool UpdateLootTables(string originalJson, string json)
		{
			if (!RunTimeRegistry.TryGetValue(originalJson, out string value))
			{
				return false;
			}
			return (bool)(API_UpdateLootTables.Invoke(value, json)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool RegisterInventoryProvider(string id, Func<List<ItemData>> getItems, Func<string, int> countItem, Func<string, int, int> removeItem, Func<ItemData, int, int> removeExactItem)
		{
			bool flag = (bool)(API_RegisterInventoryProvider.Invoke(id, getItems, countItem, removeItem, removeExactItem)[0] ?? ((object)false));
			logger.LogDebug($"Registered inventory provider: {id}, {flag}");
			return flag;
		}

		[PublicAPI]
		public static bool UnregisterInventoryProvider(string id)
		{
			return (bool)(API_UnregisterInventoryProvider.Invoke(id)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool RegisterInventoryProviderSaveHandler(string id, Func<ItemData, bool> saveItem)
		{
			bool flag = (bool)(API_RegisterInventoryProviderSaveHandler.Invoke(id, saveItem)[0] ?? ((object)false));
			logger.LogDebug($"Registered inventory provider save handler: {id}, {flag}");
			return flag;
		}

		[PublicAPI]
		public static bool RegisterEquipmentProvider(string id, Func<Player, List<ItemData>> getExtraEquipped)
		{
			bool flag = (bool)(API_RegisterEquipmentProvider.Invoke(id, getExtraEquipped)[0] ?? ((object)false));
			logger.LogDebug($"Registered equipment provider: {id}, {flag}");
			return flag;
		}

		[PublicAPI]
		public static bool UnregisterEquipmentProvider(string id)
		{
			return (bool)(API_UnregisterEquipmentProvider.Invoke(id)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static void InvalidatePlayerEffectCache(this Player player)
		{
			API_InvalidatePlayerEffectCache.Invoke(player);
		}

		[PublicAPI]
		public static bool RegisterSacrificeFilter(string id, Func<ItemData, bool> canSacrifice)
		{
			bool flag = (bool)(API_RegisterSacrificeFilter.Invoke(id, canSacrifice)[0] ?? ((object)false));
			logger.LogDebug($"Registered sacrifice filter: {id}, {flag}");
			return flag;
		}

		[PublicAPI]
		public static bool UnregisterSacrificeFilter(string id)
		{
			return (bool)(API_UnregisterSacrificeFilter.Invoke(id)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static Dictionary<string, List<string>> GetRegisteredProviders()
		{
			return (Dictionary<string, List<string>>)(API_GetRegisteredProviders.Invoke()[0] ?? new Dictionary<string, List<string>>());
		}

		[PublicAPI]
		public static int GetApiVersion()
		{
			return (int)(API_GetApiVersion.Invoke()[0] ?? ((object)0));
		}

		[PublicAPI]
		public static bool IsLoaded()
		{
			return GetApiVersion() > 0;
		}

		[PublicAPI]
		public static string GetPluginVersion()
		{
			return (string)(API_GetPluginVersion.Invoke()[0] ?? "");
		}

		[PublicAPI]
		public static bool HasEndpoint(string name)
		{
			return (bool)(API_HasEndpoint.Invoke(name)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool IsMagicItem(this ItemData item)
		{
			return (bool)(API_IsMagicItem.Invoke(item)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool TryGetRarity(this ItemData item, out ItemRarity rarity)
		{
			rarity = ItemRarity.Magic;
			int num = 0;
			object[] array = API_TryGetRarity.Invoke(item, num);
			if ((bool)(array[0] ?? ((object)false)))
			{
				rarity = (ItemRarity)(int)(array[2] ?? ((object)0));
				return true;
			}
			return false;
		}

		[PublicAPI]
		public static string GetDisplayName(this ItemData item)
		{
			return (string)(API_GetItemDisplayName.Invoke(item)[0] ?? "");
		}

		[PublicAPI]
		public static string GetDecoratedName(this ItemData item, string colorOverride = null)
		{
			return (string)(API_GetItemDecoratedName.Invoke(item, colorOverride)[0] ?? "");
		}

		[PublicAPI]
		public static int GetRarityCount()
		{
			return (int)(API_GetRarityCount.Invoke()[0] ?? ((object)0));
		}

		[PublicAPI]
		public static string GetRarityColor(ItemRarity rarity)
		{
			return (string)(API_GetRarityColorByIndex.Invoke((int)rarity)[0] ?? "#FFFFFF");
		}

		[PublicAPI]
		public static string GetRarityDisplayName(ItemRarity rarity)
		{
			return (string)(API_GetRarityDisplayNameByIndex.Invoke((int)rarity)[0] ?? "");
		}

		[PublicAPI]
		public static string GetItemRarityColor(this ItemData item)
		{
			return (string)(API_GetItemRarityColor.Invoke(item)[0] ?? "#FFFFFF");
		}

		[PublicAPI]
		public static bool IsEpicLootItem(this ItemData item)
		{
			return (bool)(API_IsEpicLootItem.Invoke(item)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool IsShardStone(this ItemData item)
		{
			return (bool)(API_IsShardStone.Invoke(item)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool IsRunestone(this ItemData item)
		{
			return (bool)(API_IsRunestone.Invoke(item)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool IsMagicCraftingMaterial(this ItemData item)
		{
			return (bool)(API_IsMagicCraftingMaterial.Invoke(item)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool IsUnidentified(this ItemData item)
		{
			return (bool)(API_IsUnidentified.Invoke(item)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool CanBeMagicItem(this ItemData item)
		{
			return (bool)(API_CanBeMagicItem.Invoke(item)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool HasMagicEffect(this ItemData item, string effectType, bool includeSocketed = true)
		{
			return (bool)(API_ItemHasMagicEffect.Invoke(item, effectType, includeSocketed)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static List<string> GetAllMagicEffectTypes()
		{
			return (List<string>)(API_GetAllMagicEffectTypes.Invoke()[0] ?? new List<string>());
		}

		[PublicAPI]
		public static List<ItemAmount> GetEnchantCosts(this ItemData item, ItemRarity rarity)
		{
			return DeserializeAmounts((string)(API_GetEnchantCostsJson.Invoke(item, (int)rarity)[0] ?? "[]"));
		}

		[PublicAPI]
		public static List<ItemAmount> GetSacrificeProducts(this ItemData item)
		{
			return DeserializeAmounts((string)(API_GetSacrificeProductsJson.Invoke(item)[0] ?? "[]"));
		}

		private static List<ItemAmount> DeserializeAmounts(string json)
		{
			try
			{
				return JsonConvert.DeserializeObject<List<ItemAmount>>(json) ?? new List<ItemAmount>();
			}
			catch
			{
				logger.LogWarning("Failed to parse item amount list");
				return new List<ItemAmount>();
			}
		}

		[PublicAPI]
		public static bool ApplyMagicItemBackground(GameObject slotRoot, GameObject equippedOverlay, ItemData item, bool inventoryGrid)
		{
			return (bool)(API_ApplyMagicItemBackground.Invoke(slotRoot, equippedOverlay, item, inventoryGrid)[0] ?? ((object)false));
		}

		[PublicAPI]
		public static bool ApplyMagicItemBackgroundToIcon(GameObject iconObject, ItemData item)
		{
			return (bool)(API_ApplyMagicItemBackgroundToIcon.Invoke(iconObject, item)[0] ?? ((object)false));
		}
	}
	[Serializable]
	[PublicAPI]
	public class BountyMinion
	{
		public string ID = "";

		public int Count;

		public BountyMinion(string ID, int count)
		{
			this.ID = ID;
			Count = count;
		}

		public BountyMinion()
		{
		}
	}
	[Serializable]
	[PublicAPI]
	public class BountyTarget
	{
		public Biome Biome;

		public string TargetID = "";

		public int RewardGold;

		public int RewardIron;

		public int RewardCoins;

		public List<BountyMinion> Adds = new List<BountyMinion>();

		internal static readonly List<BountyTarget> BountyTargets = new List<BountyTarget>();

		internal static readonly Method API_AddBountyTarget = new Method("AddBountyTarget");

		internal static readonly Method API_UpdateBountyTarget = new Method("UpdateBountyTarget");

		public BountyTarget(Biome biome, string targetID)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			Biome = biome;
			TargetID = targetID;
			BountyTargets.Add(this);
		}

		public BountyTarget()
		{
		}

		public static void RegisterAll()
		{
			foreach (BountyTarget item in new List<BountyTarget>(BountyTargets))
			{
				item.Register();
			}
		}

		public bool Register()
		{
			string text = JsonConvert.SerializeObject((object)this);
			if (!(API_AddBountyTarget.Invoke(text)[0] is string value))
			{
				return false;
			}
			RunTimeRegistry.Register(this, value);
			BountyTargets.Remove(this);
			EpicLoot.logger.LogDebug("Registered bounty: " + TargetID);
			return true;
		}

		public bool Update()
		{
			if (!RunTimeRegistry.TryGetValue(this, out string value))
			{
				return false;
			}
			string text = JsonConvert.SerializeObject((object)this);
			bool flag = (bool)(API_UpdateBountyTarget.Invoke(value, text)[0] ?? ((object)false));
			EpicLoot.logger.LogDebug($"Updated bounty target: {TargetID}, {flag}");
			return flag;
		}
	}
	[Serializable]
	[PublicAPI]
	public class RecipeRequirement
	{
		public string item;

		public int amount;

		public RecipeRequirement(string item, int amount = 1)
		{
			this.item = item;
			this.amount = amount;
		}
	}
	internal static class RecipeApi
	{
		internal const string Obsolete = "Epic Loot removed recipes.json in 0.13.0 and no longer ships a recipe config, so this no longer has anywhere to register into. Add recipes with Jotunn's ItemManager instead.";
	}
	[Serializable]
	[PublicAPI]
	[Obsolete("Epic Loot removed recipes.json in 0.13.0 and no longer ships a recipe config, so this no longer has anywhere to register into. Add recipes with Jotunn's ItemManager instead.")]
	public class CustomRecipe
	{
		public string name = "";

		public string item = "";

		public int amount;

		public string craftingStation = "";

		public int minStationLevel = 1;

		public bool enabled = true;

		public string repairStation = "";

		public List<RecipeRequirement> resources = new List<RecipeRequirement>();

		internal static readonly List<CustomRecipe> Recipes = new List<CustomRecipe>();

		internal static readonly Method API_AddRecipe = new Method("AddRecipe");

		public CustomRecipe(string name, string item, CraftingTable craftingTable, int amount = 1)
		{
			this.name = name;
			this.item = item;
			this.amount = amount;
			craftingStation = craftingTable.GetInternalName();
			Recipes.Add(this);
		}

		public CustomRecipe()
		{
		}

		[PublicAPI]
		[Obsolete("Epic Loot removed recipes.json in 0.13.0 and no longer ships a recipe config, so this no longer has anywhere to register into. Add recipes with Jotunn's ItemManager instead.")]
		public static void RegisterAll()
		{
			foreach (CustomRecipe item in new List<CustomRecipe>(Recipes))
			{
				item.Register();
			}
		}

		[Obsolete("Epic Loot removed recipes.json in 0.13.0 and no longer ships a recipe config, so this no longer has anywhere to register into. Add recipes with Jotunn's ItemManager instead.")]
		public bool Register()
		{
			string text = JsonConvert.SerializeObject((object)this);
			if (!(API_AddRecipe.Invoke(text)[0] is string value))
			{
				return false;
			}
			RunTimeRegistry.Register(this, value);
			Recipes.Remove(this);
			EpicLoot.logger.LogDebug("Registered recipe: " + name);
			return true;
		}
	}
	[PublicAPI]
	public enum CraftingTable
	{
		[InternalName("piece_workbench")]
		Workbench,
		[InternalName("piece_cauldron")]
		Cauldron,
		[InternalName("forge")]
		Forge,
		[InternalName("piece_artisanstation")]
		ArtisanTable,
		[InternalName("piece_stonecutter")]
		StoneCutter,
		[InternalName("piece_magetable")]
		MageTable,
		[InternalName("blackforge")]
		BlackForge,
		[InternalName("piece_preptable")]
		FoodPreparationTable,
		[InternalName("piece_MeadCauldron")]
		MeadKetill
	}
	internal class InternalName : Attribute
	{
		public readonly string internalName;

		public InternalName(string internalName)
		{
			this.internalName = internalName;
		}
	}
	[PublicAPI]
	public static class EffectType
	{
		public static string DvergerCirclet = "DvergerCirclet";

		public static string InstantMead = "InstantMead";

		public static string AutoMead = "AutoMead";

		public static string DecreaseMeadCooldown = "DecreaseMeadCooldown";

		public static string Megingjord = "Megingjord";

		public static string Wishbone = "Wishbone";

		public static string Andvaranaut = "Andvaranaut";

		public static string ModifyDamage = "ModifyDamage";

		public static string ModifyPhysicalDamage = "ModifyPhysicalDamage";

		public static string ModifyElementalDamage = "ModifyElementalDamage";

		public static string ModifyDurability = "ModifyDurability";

		public static string ModifyDrawStaminaUse = "ModifyDrawStaminaUse";

		public static string ReduceWeight = "ReduceWeight";

		public static string RemoveSpeedPenalty = "RemoveSpeedPenalty";

		public static string ModifyBlockPower = "ModifyBlockPower";

		public static string ModifyBlockForce = "ModifyBlockForce";

		public static string ModifyParry = "ModifyParry";

		public static string ModifyArmor = "ModifyArmor";

		public static string ModifyBackstab = "ModifyBackstab";

		public static string IncreaseMiningDrop = "IncreaseMiningDrop";

		public static string IncreaseTreeDrop = "IncreaseTreeDrop";

		public static string IncreaseHealth = "IncreaseHealth";

		public static string IncreaseHeatResistance = "IncreaseHeatResistance";

		public static string IncreaseStamina = "IncreaseStamina";

		public static string IncreaseEitr = "IncreaseEitr";

		public static string DecreaseForsakenCooldown = "DecreaseForsakenCooldown";

		public static string ModifyHealthRegen = "ModifyHealthRegen";

		public static string AddHealthRegen = "AddHealthRegen";

		public static string ModifyStaminaRegen = "ModifyStaminaRegen";

		public static string ModifyEitrRegen = "ModifyEitrRegen";

		public static string AddBluntDamage = "AddBluntDamage";

		public static string AddSlashingDamage = "AddSlashingDamage";

		public static string AddPiercingDamage = "AddPiercingDamage";

		public static string AddFireDamage = "AddFireDamage";

		public static string AddFrostDamage = "AddFrostDamage";

		public static string AddLightningDamage = "AddLightningDamage";

		public static string AddPoisonDamage = "AddPoisonDamage";

		public static string AddSpiritDamage = "AddSpiritDamage";

		public static string AddFireResistancePercentage = "AddFireResistancePercentage";

		public static string AddFrostResistancePercentage = "AddFrostResistancePercentage";

		public static string AddLightningResistancePercentage = "AddLightningResistancePercentage";

		public static string AddPoisonResistancePercentage = "AddPoisonResistancePercentage";

		public static string AddSpiritResistancePercentage = "AddSpiritResistancePercentage";

		public static string AddElementalResistancePercentage = "AddElementalResistancePercentage";

		public static string AddBluntResistancePercentage = "AddBluntResistancePercentage";

		public static string AddSlashingResistancePercentage = "AddSlashingResistancePercentage";

		public static string AddPiercingResistancePercentage = "AddPiercingResistancePercentage";

		public static string AddChoppingResistancePercentage = "AddChoppingResistancePercentage";

		public static string AddPhysicalResistancePercentage = "AddPhysicalResistancePercentage";

		public static string ModifyMovementSpeed = "ModifyMovementSpeed";

		public static string ModifySprintStaminaUse = "ModifySprintStaminaUse";

		public static string ModifyNoise = "ModifyNoise";

		public static string ModifyBuildDistance = "ModifyBuildDistance";

		public static string ModifyPickupRange = "ModifyPickupRange";

		public static string ModifyMagicFireRate = "ModifyMagicFireRate";

		public static string AmmoConservation = "AmmoConservation";

		public static string ModifyProjectileSpeed = "ModifyProjectileSpeed";

		public static string ModifyDodgeStaminaUse = "ModifyDodgeStaminaUse";

		public static string ModifyJumpStaminaUse = "ModifyJumpStaminaUse";

		public static string ModifyAttackStaminaUse = "ModifyAttackStaminaUse";

		public static string ModifyAttackEitrUse = "ModifyAttackEitrUse";

		public static string ModifyAttackHealthUse = "ModifyAttackHealthUse";

		public static string ModifyBlockStaminaUse = "ModifyBlockStaminaUse";

		public static string ModifySummonHealth = "ModifySummonHealth";

		public static string ModifySummonDamage = "ModifySummonDamage";

		public static string ModifyWispRange = "ModifyWispRange";

		public static string Indestructible = "Indestructible";

		public static string CoinHoarder = "CoinHoarder";

		public static string Weightless = "Weightless";

		public static string LifeSteal = "LifeSteal";

		public static string EitrLeech = "EitrLeech";

		public static string Bloodlust = "Bloodlust";

		public static string AddCarryWeight = "AddCarryWeight";

		public static string ModifyAttackSpeed = "ModifyAttackSpeed";

		public static string Throwable = "Throwable";

		public static string Waterproof = "Waterproof";

		public static string Warmth = "Warmth";

		public static string Paralyze = "Paralyze";

		public static string DoubleJump = "DoubleJump";

		public static string ExplosiveArrows = "ExplosiveArrows";

		public static string QuickDraw = "QuickDraw";

		public static string AddSwordsSkill = "AddSwordsSkill";

		public static string AddKnivesSkill = "AddKnivesSkill";

		public static string AddClubsSkill = "AddClubsSkill";

		public static string AddPolearmsSkill = "AddPolearmsSkill";

		public static string AddSpearsSkill = "AddSpearsSkill";

		public static string AddBlockingSkill = "AddBlockingSkill";

		public static string AddAxesSkill = "AddAxesSkill";

		public static string AddBowsSkill = "AddBowsSkill";

		public static string AddCrossbowsSkill = "AddCrossbowsSkill";

		public static string AddUnarmedSkill = "AddUnarmedSkill";

		public static string AddPickaxesSkill = "AddPickaxesSkill";

		public static string AddFishingSkill = "AddFishingSkill";

		public static string AddElementalMagicSkill = "AddElementalMagicSkill";

		public static string AddBloodMagicSkill = "AddBloodMagicSkill";

		public static string AddMovementSkills = "AddMovementSkills";

		public static string AddCrafterSkills = "AddCrafterSkills";

		public static string ModifyStaggerDuration = "ModifyStaggerDuration";

		public static string QuickLearner = "QuickLearner";

		public static string RecallWeapon = "RecallWeapon";

		public static string ReflectDamage = "ReflectDamage";

		public static string AvoidDamageTaken = "AvoidDamageTaken";

		public static string StaggerOnDamageTaken = "StaggerOnDamageTaken";

		public static string FeatherFall = "FeatherFall";

		public static string ModifyDiscoveryRadius = "ModifyDiscoveryRadius";

		public static string FreeBuild = "FreeBuild";

		public static string Comfortable = "Comfortable";

		public static string ModifyLowHealth = "ModifyLowHealth";

		public static string ModifyMovementSpeedLowHealth = "ModifyMovementSpeedLowHealth";

		public static string ModifyHealthRegenLowHealth = "ModifyHealthRegenLowHealth";

		public static string ModifyStaminaRegenLowHealth = "ModifyStaminaRegenLowHealth";

		public static string ModifyEitrRegenLowHealth = "ModifyEitrRegenLowHealth";

		public static string ModifyArmorLowHealth = "ModifyArmorLowHealth";

		public static string ModifyDamageLowHealth = "ModifyDamageLowHealth";

		public static string ModifyBlockPowerLowHealth = "ModifyBlockPowerLowHealth";

		public static string ModifyParryLowHealth = "ModifyParryLowHealth";

		public static string ModifyAttackSpeedLowHealth = "ModifyAttackSpeedLowHealth";

		public static string AvoidDamageTakenLowHealth = "AvoidDamageTakenLowHealth";

		public static string LifeStealLowHealth = "LifeStealLowHealth";

		public static string Glowing = "Glowing";

		public static string Executioner = "Executioner";

		public static string Riches = "Riches";

		public static string Opportunist = "Opportunist";

		public static string Duelist = "Duelist";

		public static string Immovable = "Immovable";

		public static string ModifyStaggerDamage = "ModifyStaggerDamage";

		public static string Luck = "Luck";

		public static string ModifyParryWindow = "ModifyParryWindow";

		public static string Slow = "Slow";

		public static string FrostDamageAOE = "FrostDamageAOE";

		public static string DoubleMagicShot = "DoubleMagicShot";

		public static string TripleBowShot = "TripleBowShot";

		public static string SpellSword = "SpellSword";

		public static string BulkUp = "BulkUp";

		public static string EitrWeave = "EitrWeave";

		public static string DartingThoughts = "DartingThoughts";

		public static string HeadHunter = "HeadHunter";

		public static string DodgeBuff = "DodgeBuff";

		public static string OffSetAttack = "OffSetAttack";

		public static string ChainLightning = "ChainLightning";

		public static string Apportation = "Apportation";

		public static string ModifyFireRate = "ModifyFireRate";

		public static string Bulwark = "Bulwark";

		public static string Undying = "Undying";

		public static string DamageTakenGivesAdrenaline = "DamageTakenGivesAdrenaline";

		public static string UseAdrenalineAsStamina = "UseAdrenalineAsStamina";

		public static string EitrUseGivesAdrenaline = "EitrUseGivesAdrenaline";

		public static string BurningAdrenaline = "BurningAdrenaline";

		public static string GainAdrenalineFromHarvesting = "GainAdrenalineFromHarvesting";

		public static string SummonBatWhenActivatingAdrenaline = "SummonBatWhenActivatingAdrenaline";

		public static string AdrenalineFrostWave = "AdrenalineFrostWave";

		public static string GainAdrenalineWhenApplyingPoison = "GainAdrenalineWhenApplyingPoison";

		public static string GainAdrenalineWhenSacrificingHealth = "GainAdrenalineWhenSacrificingHealth";

		public static string StormFury = "StormFury";

		public static string AdrenalineIncreasesHealthRegen = "AdrenalineIncreasesHealthRegen";

		public static string AdrenalineCharge = "AdrenalineCharge";

		public static string PerfectDodge = "PerfectDodge";

		public static string PerfectDodgeGivesHealth = "PerfectDodgeGivesHealth";

		public static string PerfectDodgeGivesStamina = "PerfectDodgeGivesStamina";

		public static string PerfectDodgeGivesEitr = "PerfectDodgeGivesEitr";

		public static string DecreaseDodgeCost = "DecreaseDodgeCost";

		public static string IncreaseDamageDuringNighttime = "IncreaseDamageDuringNighttime";

		public static string NightStaminaRegenIncrease = "NightStaminaRegenIncrease";

		public static string DamageReductionAtNight = "DamageReductionAtNight";

		public static string IncreaseDamageDuringDaytime = "IncreaseDamageDuringDaytime";

		public static string DayDiscovery = "DayDiscovery";

		public static string DayArmor = "DayArmor";

		public static string DayStaminaRegen = "DayStaminaRegen";

		public static string DayHealthRegen = "DayHealthRegen";

		public static string DayBlocker = "DayBlocker";

		public static string NightBlocker = "NightBlocker";

		public static string PercentHealth = "PercentHealth";

		public static string PercentStamina = "PercentStamina";

		public static string PercentEitr = "PercentEitr";

		public static string HealthGainPerXDamageDone = "HealthGainPerXDamageDone";

		public static string HealthOnEitrUse = "HealthOnEitrUse";

		public static string LifeGainOnHit = "LifeGainOnHit";

		public static string PhysToFire = "PhysToFire";

		public static string PhysToFrost = "PhysToFrost";

		public static string PhysToPoison = "PhysToPoison";

		public static string PhysToLightning = "PhysToLightning";

		public static string PhysToFireOnBlock = "PhysToFireOnBlock";

		public static string PhysToFrostOnBlock = "PhysToFrostOnBlock";

		public static string PhysToPoisonOnBlock = "PhysToPoisonOnBlock";

		public static string PhysToLightningOnBlock = "PhysToLightningOnBlock";

		public static string ConvertPhysicalDamageToLightning = "ConvertPhysicalDamageToLightning";

		public static string EitrImbueAttack = "EitrImbueAttack";

		public static string StaminaReturnFromEitr = "StaminaReturnFromEitr";

		public static string EnergeticEitr = "EnergeticEitr";

		public static string ConvertEitrCostToStaminaCost = "ConvertEitrCostToStaminaCost";

		public static string ConsumeEitrFirstForBloodCosts = "ConsumeEitrFirstForBloodCosts";

		public static string RunningOnEmpty = "RunningOnEmpty";

		public static string EveryXPointsOfEitrIncreasesStamina = "EveryXPointsOfEitrIncreasesStamina";

		public static string EitrShield = "EitrShield";

		public static string LifeGainOnBlock = "LifeGainOnBlock";

		public static string StaminaGainOnBlock = "StaminaGainOnBlock";

		public static string EitrGainOnBlock = "EitrGainOnBlock";

		public static string Kindling = "Kindling";

		public static string DamageBonusFromPlayerWeight = "DamageBonusFromPlayerWeight";

		public static string StaminaRegenBonusFromPlayerWeight = "StaminaRegenBonusFromPlayerWeight";

		public static string GainMaxStaminaBasedOnPlayerMaxHealth = "GainMaxStaminaBasedOnPlayerMaxHealth";

		public static string GainMaxCarryWeightFromRested = "GainMaxCarryWeightFromRested";

		public static string DamageIncreaseFromMovementPenalty = "DamageIncreaseFromMovementPenalty";

		public static string IncreaseXPGainFromMovementPenalty = "IncreaseXPGainFromMovementPenalty";

		public static string CarryWeightForMovementPenalty = "CarryWeightForMovementPenalty";

		public static string StaminaIncreaseForMovementPenalty = "StaminaIncreaseForMovementPenalty";

		public static string BurdenedBlock = "BurdenedBlock";

		public static string AnchoredBlock = "AnchoredBlock";

		public static string IncreaseHarvestDamage = "IncreaseHarvestDamage";

		public static string IncreaseHarvestXPGain = "IncreaseHarvestXPGain";

		public static string BountifulHarvest = "BountifulHarvest";

		public static string Mercenary = "Mercenary";

		public static string Coinplated = "Coinplated";

		public static string Wager = "Wager";

		public static string LuckWhileFishing = "LuckWhileFishing";

		public static string ChanceDoubleDamage = "ChanceDoubleDamage";

		public static string Inspiration = "Inspiration";

		public static string LuckyLoot = "LuckyLoot";

		public static string SailingSpeed = "SailingSpeed";

		public static string PotionEfficacy = "PotionEfficacy";

		public static string IncreaseMeleeSkills = "IncreaseMeleeSkills";

		public static string IncreaseRangedSkills = "IncreaseRangedSkills";

		public static string BloodStaggerBlock = "BloodStaggerBlock";

		public static string BloodBaseBlock = "BloodBaseBlock";

		public static string Warding = "Warding";

		public static string ElementalWarding = "ElementalWarding";

		public static string LuckyBlock = "LuckyBlock";

		public static string BlockAsDodgeAsBlock = "BlockAsDodgeAsBlock";

		public static string BlockAsWoodCuttingAndPickaxes = "BlockAsWoodCuttingAndPickaxes";

		public static string StaggerOnBlock = "StaggerOnBlock";

		public static string IncreaseAllPoisonDamageDone = "IncreaseAllPoisonDamageDone";

		public static string KillsReduceNextBloodCost = "KillsReduceNextBloodCost";

		public static string BloodMagicLevelIncreasesHealthRegen = "BloodMagicLevelIncreasesHealthRegen";

		public static string ChanceToCritOnHit = "ChanceToCritOnHit";

		public static string Bloodrage = "Bloodrage";

		public static string BloodDrinker = "BloodDrinker";

		public static string Trailblazer = "Trailblazer";

		public static string ReduceFallDamage = "ReduceFallDamage";

		public static string RollCleanse = "RollCleanse";

		public static string StormRider = "StormRider";

		public static string StaminaOnKill = "StaminaOnKill";

		public static string HeartyEitr = "HeartyEitr";

		public static string BurningSpeed = "BurningSpeed";

		public static string PerfectDodgeGivesSpeed = "PerfectDodgeGivesSpeed";

		public static string NightCarryWeight = "NightCarryWeight";

		public static string DaySailingSpeed = "DaySailingSpeed";

		public static string ArmorFromMovementPenalty = "ArmorFromMovementPenalty";

		public static string ReduceEitrCost = "ReduceEitrCost";

		public static string ReduceFishingStaminaCost = "ReduceFishingStaminaCost";

		public static string ReduceArmorIncreaseDamage = "ReduceArmorIncreaseDamage";

		public static string PoisonToTrueDamage = "PoisonToTrueDamage";

		public static string IcyWeight = "IcyWeight";

		public static string GainEitrWhenSacrificingHealth = "GainEitrWhenSacrificingHealth";

		public static string LuckyCraft = "LuckyCraft";

		public static string Conduit = "Conduit";

		public static string RestingHealthRegen = "RestingHealthRegen";

		public static string TravelLight = "TravelLight";

		public static string StrikeCausesLightning = "StrikeCausesLightning";

		public static string BatteringRam = "BatteringRam";

		public static string ShockingCharge = "ShockingCharge";

		public static string ForestsAid = "ForestsAid";

		public static string CorpseRot = "CorpseRot";

		public static string IcyRetribution = "IcyRetribution";

		public static string MeteorSummoner = "MeteorSummoner";

		public static string Everflow = "Everflow";

		public static string NecroticFire = "NecroticFire";
	}
	public static class Helpers
	{
		[PublicAPI]
		public static void Add<T>(this List<T> list, params T[] items)
		{
			list.AddRange(items);
		}

		[PublicAPI]
		public static void AddMinion(this List<BountyMinion> list, string ID, int count)
		{
			list.Add(new BountyMinion(ID, count));
		}

		[PublicAPI]
		public static void Add(this List<ItemAmount> list, string item, int amount = 1)
		{
			list.Add(new ItemAmount(item, amount));
		}

		[PublicAPI]
		public static void Add(this List<MaterialConversionRequirement> list, string item, int amount = 1)
		{
			list.Add(new MaterialConversionRequirement(item, amount));
		}

		internal static string GetInternalName(this CraftingTable table)
		{
			MemberInfo[] member = typeof(CraftingTable).GetMember(table.ToString());
			if (member.Length == 0)
			{
				return table.ToString();
			}
			InternalName internalName = (InternalName)Attribute.GetCustomAttribute(member[0], typeof(InternalName));
			if (internalName == null)
			{
				return table.ToString();
			}
			return internalName.internalName;
		}

		[PublicAPI]
		public static void Add(this List<RecipeRequirement> list, string item, int amount = 1)
		{
			list.Add(new RecipeRequirement(item, amount));
		}

		[PublicAPI]
		public static void Add(this List<SetBonusInfo> list, int count, string type, float min = 1f, float max = 1f, float increment = 1f)
		{
			list.Add(new SetBonusInfo(count, type, min, max, increment));
		}

		[PublicAPI]
		public static void Add(this List<GuaranteedMagicEffect> list, string type, float min = 1f, float max = 1f, float increment = 1f)
		{
			list.Add(new GuaranteedMagicEffect(type, min, max, increment));
		}
	}
	[Serializable]
	[PublicAPI]
	public class GuaranteedMagicEffect
	{
		public string Type = "";

		public ValueDef Values = new ValueDef();

		[JsonProperty(/*Could not decode attribute arguments.*/)]
		public RarityValueOverrides? ValuesPerRarity;

		public GuaranteedMagicEffect(string type, ValueDef values)
		{
			Type = type;
			Values = values;
		}

		public GuaranteedMagicEffect(string type, float min = 1f, float max = 1f, float increment = 1f)
			: this(type, new ValueDef(min, max, increment))
		{
		}

		public GuaranteedMagicEffect()
		{
		}

		public GuaranteedMagicEffect SetValuesForRarity(ItemRarity rarity, float min, float max, float increment = 1f)
		{
			if (ValuesPerRarity == null)
			{
				ValuesPerRarity = new RarityValueOverrides();
			}
			ValuesPerRarity.Set(rarity, new ValueDef(min, max, increment));
			return this;
		}
	}
	[Serializable]
	[PublicAPI]
	public class RarityValueOverrides
	{
		[JsonProperty(/*Could not decode attribute arguments.*/)]
		public ValueDef? Magic;

		[JsonProperty(/*Could not decode attribute arguments.*/)]
		public ValueDef? Rare;

		[JsonProperty(/*Could not decode attribute arguments.*/)]
		public ValueDef? Epic;

		[JsonProperty(/*Could not decode attribute arguments.*/)]
		public ValueDef? Legendary;

		[JsonProperty(/*Could not decode attribute arguments.*/)]
		public ValueDef? Mythic;

		[JsonProperty(/*Could not decode attribute arguments.*/)]
		public ValueDef? Ancient;

		public void Set(ItemRarity rarity, ValueDef values)
		{
			switch (rarity)
			{
			case ItemRarity.Magic:
				Magic = values;
				break;
			case ItemRarity.Rare:
				Rare = values;
				break;
			case ItemRarity.Epic:
				Epic = values;
				break;
			case ItemRarity.Legendary:
				Legendary = values;
				break;
			case ItemRarity.Mythic:
				Mythic = values;
				break;
			case ItemRarity.Ancient:
				Ancient = values;
				break;
			}
		}
	}
	[Serializable]
	[PublicAPI]
	public class TextureReplacement
	{
		public string ItemID = "";

		public string MainTexture = "";

		public string ChestTex = "";

		public string LegsTex = "";

		public TextureReplacement(string itemID, string mainTex = "", string chestTex = "", string legsTex = "")
		{
			ItemID = itemID;
			MainTexture = mainTex;
			ChestTex = chestTex;
			LegsTex = legsTex;
		}

		public TextureReplacement()
		{
		}
	}
	[Serializable]
	[PublicAPI]
	public class LegendaryInfo
	{
		public string ID = "";

		public string Name = "";

		public string Description = "";

		public List<ItemRarity> Rarities = new List<ItemRarity>();

		public MagicItemEffectRequirements Requirements = new MagicItemEffectRequirements();

		public List<GuaranteedMagicEffect> GuaranteedMagicEffects = new List<GuaranteedMagicEffect>();

		public int GuaranteedEffectCount = -1;

		public float SelectionWeight = 1f;

		public string EquipFx = "";

		public FxAttachMode EquipFxMode = FxAttachMode.Player;

		public List<TextureReplacement> TextureReplacements = new List<TextureReplacement>();

		public bool IsSetItem;

		public bool Enchantable;

		public List<RecipeRequirement> EnchantCost = new List<RecipeRequirement>();

		private string type = "Legendary";

		internal static readonly List<LegendaryInfo> LegendaryItems = new List<LegendaryInfo>();

		internal static readonly Method API_AddLegendaryItem = new Method("AddLegendaryItem");

		internal static readonly Method API_UpdateLegendaryItem = new Method("UpdateLegendaryItem");

		public LegendaryInfo(LegendaryType type, string ID, string name, string description)
		{
			this.ID = ID;
			Name = name;
			Description = description;
			this.type = type.ToString();
			LegendaryItems.Add(this);
		}

		public LegendaryInfo(string ID, string name, string description, params ItemRarity[] rarities)
		{
			this.ID = ID;
			Name = name;
			Description = description;
			Rarities.AddRange(rarities);
			type = ((rarities.Length != 0) ? rarities[0].ToString() : "Legendary");
			LegendaryItems.Add(this);
		}

		public LegendaryInfo()
		{
		}

		public static void RegisterAll()
		{
			foreach (LegendaryInfo item in new List<LegendaryInfo>(LegendaryItems))
			{
				item.Register();
			}
		}

		public bool Register()
		{
			string text = JsonConvert.SerializeObject((object)this);
			if (!(API_AddLegendaryItem.Invoke(type, text)[0] is string value))
			{
				return false;
			}
			RunTimeRegistry.Register(this, value);
			LegendaryItems.Remove(this);
			EpicLoot.logger.LogDebug("Registered legendary item: " + ID);
			return true;
		}

		public bool Update()
		{
			if (!RunTimeRegistry.TryGetValue(this, out string value))
			{
				return false;
			}
			string text = JsonConvert.SerializeObject((object)this);
			bool flag = (bool)(API_UpdateLegendaryItem.Invoke(value, text)[0] ?? ((object)false));
			EpicLoot.logger.LogDebug($"Updated legendary item: {ID}, {flag}");
			return flag;
		}
	}
	[PublicAPI]
	public enum LegendaryType
	{
		Legendary,
		Mythic
	}
	[Serializable]
	[PublicAPI]
	public class SetBonusInfo
	{
		public int Count;

		public GuaranteedMagicEffect Effect = new GuaranteedMagicEffect();

		public SetBonusInfo(int count, string type, ValueDef values)
		{
			Count = count;
			Effect = new GuaranteedMagicEffect(type, values);
		}

		public SetBonusInfo(int count, string type, float min, float max, float increment)
			: this(count, type, new ValueDef(min, max, increment))
		{
		}

		public SetBonusInfo()
		{
		}
	}
	[Serializable]
	[PublicAPI]
	public class LegendarySetInfo
	{
		public string ID = "";

		public string Name = "";

		public List<ItemRarity> Rarities = new List<ItemRarity>();

		public List<string> LegendaryIDs = new List<string>();

		public List<SetBonusInfo> SetBonuses = new List<SetBonusInfo>();

		private string type = "Legendary";

		internal static readonly List<LegendarySetInfo> LegendarySets = new List<LegendarySetInfo>();

		internal static readonly Method API_AddLegendarySet = new Method("AddLegendarySet");

		internal static readonly Method API_UpdateLegendarySet = new Method("UpdateLegendarySet");

		public LegendarySetInfo(LegendaryType type, string ID, string name)
		{
			this.ID = ID;
			Name = name;
			this.type = type.ToString();
			LegendarySets.Add(this);
		}

		public LegendarySetInfo(string ID, string name, params ItemRarity[] rarities)
		{
			this.ID = ID;
			Name = name;
			Rarities.AddRange(rarities);
			type = ((rarities.Length != 0) ? rarities[0].ToString() : "Legendary");
			LegendarySets.Add(this);
		}

		public LegendarySetInfo()
		{
		}

		public static void RegisterAll()
		{
			foreach (LegendarySetInfo item in new List<LegendarySetInfo>(LegendarySets))
			{
				item.Register();
			}
		}

		public bool Register()
		{
			string text = JsonConvert.SerializeObject((object)this);
			if (!(API_AddLegendarySet.Invoke(type, text)[0] is string value))
			{
				return false;
			}
			RunTimeRegistry.Register(this, value);
			EpicLoot.logger.LogDebug("Registered legendary set: " + ID);
			return true;
		}

		public bool Update()
		{
			if (!RunTimeRegistry.TryGetValue(this, out string value))
			{
				return false;
			}
			string text = JsonConvert.SerializeObject((object)this);
			bool flag = (bool)(API_UpdateLegendarySet.Invoke(value, text)[0] ?? ((object)false));
			EpicLoot.logger.LogDebug($"Updated legendary set: {ID}, {flag}");
			return flag;
		}
	}
	public class Logger
	{
		public event Action<string> OnError;

		public event Action<string> OnDebug;

		public event Action<string> OnWarning;

		public void LogError(string message)
		{
			this.OnError?.Invoke(message);
		}

		public void LogDebug(string message)
		{
			this.OnDebug?.Invoke(message);
		}

		public void LogWarning(string message)
		{
			this.OnWarning?.Invoke(message);
		}
	}
	[Serializable]
	[PublicAPI]
	public class MagicItem
	{
		public int Version = 3;

		public ItemRarity Rarity;

		public List<MagicItemEffect> Effects = new List<MagicItemEffect>();

		public string TypeNameOverride = "";

		public int AugmentedEffectIndex = -1;

		public List<int> AugmentedEffectIndices = new List<int>();

		public List<int> TemperedEffectIndices = new List<int>();

		public string DisplayName = "";

		public string LegendaryID = "";

		public string SetID = "";

		public bool IsUnidentified;

		public int SocketCount;

		public List<SocketedEffect> Sockets = new List<SocketedEffect>();
	}
	[Serializable]
	[PublicAPI]
	public class SocketedEffect
	{
		public int Version = 2;

		public MagicItemEffect? Effect;

		public string SourcePrefab = "";

		public ItemRarity SourceRarity;

		public ShardType ShardType = ShardType.None;

		public float StackMultiplier = 1f;

		public SocketedEffect()
		{
		}

		public SocketedEffect(MagicItemEffect effect, string sourcePrefab, ItemRarity sourceRarity)
		{
			Effect = effect;
			SourcePrefab = sourcePrefab;
			SourceRarity = sourceRarity;
		}
	}
	[PublicAPI]
	public enum FxAttachMode
	{
		None,
		Player,
		ItemRoot,
		EquipRoot
	}
	[PublicAPI]
	public enum ItemRarity
	{
		Magic,
		Rare,
		Epic,
		Legendary,
		Mythic,
		Ancient
	}
	[Serializable]
	[PublicAPI]
	public class MagicItemEffect
	{
		public int Version = 1;

		public string EffectType = "";

		public float EffectValue;

		public MagicItemEffect(string type, float value = 1f)
		{
			EffectType = type;
			EffectValue = value;
		}

		public MagicItemEffect()
		{
		}
	}
	[Serializable]
	[PublicAPI]
	public class ValueDef
	{
		public float MinValue;

		public float MaxValue;

		public float Increment;

		public ValueDef()
		{
		}

		public ValueDef(float min, float max, float increment)
		{
			MinValue = min;
			MaxValue = max;
			Increment = increment;
		}

		public void Set(float min, float max, float increment = 1f)
		{
			MinValue = min;
			MaxValue = max;
			Increment = increment;
		}
	}
	[Serializable]
	[PublicAPI]
	public class ValuesPerRarityDef
	{
		public ValueDef Magic = new ValueDef();

		public ValueDef Rare = new ValueDef();

		public ValueDef Epic = new ValueDef();

		public ValueDef Legendary = new ValueDef();

		public ValueDef Mythic = new ValueDef();

		public ValueDef Ancient = new ValueDef();
	}
	[Serializable]
	[PublicAPI]
	public class MagicItemEffectDefinition
	{
		public string Type = "";

		public string DisplayText = "";

		public string Description = "";

		public MagicItemEffectRequirements Requirements = new MagicItemEffectRequirements();

		public ValuesPerRarityDef ValuesPerRarity = new ValuesPerRarityDef();

		public float SelectionWeight = 1f;

		public bool CanBeAugmented = true;

		public bool CanBeDisenchanted = true;

		public string Comment = "";

		public List<string> Prefixes = new List<string>();

		public List<string> Suffixes = new List<string>();

		public string EquipFx = "";

		public FxAttachMode EquipFxMode = FxAttachMode.Player;

		public string Ability = "";

		internal static readonly List<MagicItemEffectDefinition> MagicEffects = new List<MagicItemEffectDefinition>();

		internal static readonly Method API_AddMagicEffect = new Method("AddMagicEffect");

		internal static readonly Method API_UpdateMagicEffect = new Method("UpdateMagicEffect");

		internal static readonly Method API_GetMagicEffectDefinitionCopy = new Method("GetMagicItemEffectDefinition");

		[Description("Adds your new magic item definition to a list, use Register to send to epic loot")]
		public MagicItemEffectDefinition(string effectType, string displayText = "", string description = "")
		{
			Type = effectType;
			DisplayText = displayText;
			Description = description;
			MagicEffects.Add(this);
		}

		public MagicItemEffectDefinition()
		{
		}

		public static void RegisterAll()
		{
			foreach (MagicItemEffectDefinition item in new List<MagicItemEffectDefinition>(MagicEffects))
			{
				item.Register();
			}
		}

		public static MagicItemEffectDefinition Copy(string effectType)
		{
			string text = (string)(API_GetMagicEffectDefinitionCopy.Invoke(effectType)[0] ?? "");
			if (string.IsNullOrEmpty(text))
			{
				return null;
			}
			try
			{
				return JsonConvert.DeserializeObject<MagicItemEffectDefinition>(text);
			}
			catch
			{
				EpicLoot.logger.LogWarning("Failed to parse magic item effect definition json");
				return null;
			}
		}

		public bool Register()
		{
			//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_001e: Expected O, but got Unknown
			MagicEffects.Remove(this);
			string text = JsonConvert.SerializeObject((object)this, new JsonSerializerSettings
			{
				NullValueHandling = (NullValueHandling)0
			});
			if (!(API_AddMagicEffect.Invoke(text)[0] is string value))
			{
				return false;
			}
			RunTimeRegistry.Register(this, value);
			EpicLoot.logger.LogDebug("Registered magic effect: " + Type);
			return true;
		}

		public bool Update()
		{
			if (!RunTimeRegistry.TryGetValue(this, out string value))
			{
				return false;
			}
			string text = JsonConvert.SerializeObject((object)this);
			bool flag = (bool)(API_UpdateMagicEffect.Invoke(value, text)[0] ?? ((object)false));
			EpicLoot.logger.LogDebug($"Updated magic effect: {Type}, {flag}");
			return flag;
		}
	}
	[Serializable]
	[PublicAPI]
	public class MagicItemEffectRequirements
	{
		private static List<string> _flags = new List<string>();

		public bool NoRoll;

		public bool ExclusiveSelf = true;

		public List<string> ExclusiveEffectTypes = new List<string>();

		public List<string> MustHaveEffectTypes = new List<string>();

		public List<string> AllowedItemTypes = new List<string>();

		public List<string> ExcludedItemTypes = new List<string>();

		public List<ItemRarity> AllowedRarities = new List<ItemRarity>();

		public List<ItemRarity> ExcludedRarities = new List<ItemRarity>();

		public List<SkillType> AllowedSkillTypes = new List<SkillType>();

		public List<SkillType> ExcludedSkillTypes = new List<SkillType>();

		public List<string> AllowedItemNames = new List<string>();

		public List<string> ExcludedItemNames = new List<string>();

		public bool? ItemHasPhysicalDamage;

		public bool? ItemHasElementalDamage;

		public bool? ItemHasChopDamage;

		public bool? ItemUsesDurability;

		public bool? ItemHasNegativeMovementSpeedModifier;

		public bool? ItemHasBlockPower;

		public bool? ItemHasParryPower;

		public bool? ItemHasNoParryPower;

		public bool? ItemHasArmor;

		public bool? ItemHasBackstabBonus;

		public bool? ItemUsesStaminaOnAttack;

		public bool? ItemUsesEitrOnAttack;

		public bool? ItemUsesHealthOnAttack;

		public bool? ItemUsesDrawStaminaOnAttack;

		public bool? ItemGivesAdrenaline;

		public bool? ItemHasAdrenaline;

		public List<string> CustomFlags = new List<string>();

		public List<string> ExternalRequirements = new List<string>();

		public unsafe void AddAllowedItemTypes(params ItemType[] types)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < types.Length; i++)
			{
				ItemType val = types[i];
				AllowedItemTypes.Add(((object)(*(ItemType*)(&val))/*cast due to .constrained prefix*/).ToString());
			}
		}

		public unsafe void AddExcludedItemTypes(params ItemType[] types)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < types.Length; i++)
			{
				ItemType val = types[i];
				ExcludedItemTypes.Add(((object)(*(ItemType*)(&val))/*cast due to .constrained prefix*/).ToString());
			}
		}
	}
	[Serializable]
	[PublicAPI]
	public enum MaterialConversionType
	{
		Upgrade,
		Convert,
		Junk,
		ShardUpgrade
	}
	[Serializable]
	[PublicAPI]
	public class MaterialConversionRequirement
	{
		public string Item = "";

		public int Amount;

		public MaterialConversionRequirement(string item, int amount = 1)
		{
			Item = item;
			Amount = amount;
		}

		public MaterialConversionRequirement()
		{
		}
	}
	[Serializable]
	[PublicAPI]
	public class MaterialConversion
	{
		public string Name = "";

		public string Product = "";

		public int Amount;

		public MaterialConversionType Type;

		public List<MaterialConversionRequirement> Resources = new List<MaterialConversionRequirement>();

		internal static readonly Method API_AddMaterialConversion = new Method("AddMaterialConversion");

		internal static readonly Method API_UpdateMaterialConversion = new Method("UpdateMaterialConversion");

		internal static readonly List<MaterialConversion> MaterialConversions = new List<MaterialConversion>();

		[Description("Creates a new material conversion definition.")]
		public MaterialConversion(MaterialConversionType type, string name, string product, int amount = 1)
		{
			Name = name;
			Product = product;
			Amount = amount;
			Type = type;
			MaterialConversions.Add(this);
		}

		public MaterialConversion()
		{
		}

		public static void RegisterAll()
		{
			foreach (MaterialConversion item in new List<MaterialConversion>(MaterialConversions))
			{
				item.Register();
			}
		}

		[Description("serializes to json and sends to EpicLoot")]
		public bool Register()
		{
			string text = JsonConvert.SerializeObject((object)this);
			if (!(API_AddMaterialConversion.Invoke(text)[0] is string value))
			{
				return false;
			}
			MaterialConversions.Remove(this);
			RunTimeRegistry.Register(this, value);
			EpicLoot.logger.LogDebug("Registered material conversion: " + Name);
			return true;
		}

		public bool Update()
		{
			if (!RunTimeRegistry.TryGetValue(this, out string value))
			{
				return false;
			}
			string text = JsonConvert.SerializeObject((object)this);
			bool flag = (bool)(API_UpdateMaterialConversion.Invoke(value, text)[0] ?? ((object)false));
			EpicLoot.logger.LogDebug($"Updated material conversion: {Name}, {flag}");
			return flag;
		}
	}
	internal class Method
	{
		private const string Namespace = "EpicLoot";

		private const string ClassName = "API";

		private const string Assembly = "EpicLoot";

		private const string API_LOCATION = "EpicLoot.API, EpicLoot";

		private static readonly Dictionary<string, Type> CachedTypes = new Dictionary<string, Type>();

		private readonly MethodInfo info;

		public object[] Invoke(params object[] args)
		{
			object obj = info?.Invoke(null, args);
			object[] array = new object[args.Length + 1];
			array[0] = obj;
			Array.Copy(args, 0, array, 1, args.Length);
			return array;
		}

		public Method(string typeNameWithAssembly, string methodName, BindingFlags bindingFlags = BindingFlags.Static | BindingFlags.Public)
		{
			if (!TryGetType(typeNameWithAssembly, out Type type))
			{
				return;
			}
			if (type == null)
			{
				EpicLoot.logger.LogWarning("Type resolution returned null for: '" + typeNameWithAssembly + "'");
				return;
			}
			info = type.GetMethod(methodName, bindingFlags);
			if (info == null)
			{
				EpicLoot.logger.LogWarning("Failed to find public static method '" + methodName + "' in type '" + type.FullName + "'. Verify the method name is correct, the method exists, and it is marked as public static. ");
			}
		}

		public Method(string methodName, BindingFlags bindingFlags = BindingFlags.Static | BindingFlags.Public)
			: this("EpicLoot.API, EpicLoot", methodName, bindingFlags)
		{
		}

		private static bool TryGetType(string typeNameWithAssembly, out Type type)
		{
			if (CachedTypes.TryGetValue(typeNameWithAssembly, out type))
			{
				return true;
			}
			Type type2 = Type.GetType(typeNameWithAssembly);
			if ((object)type2 == null)
			{
				EpicLoot.logger.LogWarning("Failed to resolve type: '" + typeNameWithAssembly + "'. Verify the namespace, class name, and assembly name are correct. Ensure the assembly is loaded and accessible.");
				return false;
			}
			type = type2;
			CachedTypes[typeNameWithAssembly] = type2;
			return true;
		}

		public Method(string typeNameWithAssembly, string methodName, params Type[] types)
		{
			if (!TryGetType(typeNameWithAssembly, out Type type))
			{
				return;
			}
			if (type == null)
			{
				EpicLoot.logger.LogWarning("Type resolution returned null for: '" + typeNameWithAssembly + "'");
				return;
			}
			info = type.GetMethod(methodName, types);
			if (info == null)
			{
				EpicLoot.logger.LogWarning("Failed to find public static method '" + methodName + "' in type '" + type.FullName + "'. Verify the method name is correct, the method exists, and it is marked as public static. ");
			}
		}

		public Method(string methodName, params Type[] types)
			: this("EpicLoot.API, EpicLoot", methodName, types)
		{
		}

		[PublicAPI]
		public ParameterInfo[] GetParameters()
		{
			return info?.GetParameters() ?? Array.Empty<ParameterInfo>();
		}

		[PublicAPI]
		public static void ClearCache()
		{
			CachedTypes.Clear();
		}
	}
	internal static class RunTimeRegistry
	{
		private static readonly Dictionary<object, string> registry = new Dictionary<object, string>();

		public static void Register(object key, string value)
		{
			registry[key] = value;
		}

		public static bool TryGetValue(object key, out string value)
		{
			return registry.TryGetValue(key, out value);
		}
	}
	[Serializable]
	[PublicAPI]
	public class ItemAmount
	{
		public string Item = "";

		public int Amount;

		public ItemAmount(string item, int amount = 1)
		{
			Item = item;
			Amount = amount;
		}

		public ItemAmount()
		{
		}
	}
	[Serializable]
	[PublicAPI]
	public class Sacrifice
	{
		[Description("Conditional, checks item needs to be magic")]
		public bool IsMagic;

		[Description("Can be null")]
		public ItemRarity Rarity;

		[Description("Conditional, if empty, does not check if item is of correct type")]
		public List<string> ItemTypes = new List<string>();

		[Description("Conditional, if empty, does not check if item shared name is in list")]
		public List<string> ItemNames = new List<string>();

		[Description("Disenchant product entry")]
		public List<ItemAmount> Products = new List<ItemAmount>();

		internal static readonly List<Sacrifice> Sacrifices = new List<Sacrifice>();

		internal static readonly Method API_AddSacrifice = new Method("AddSacrifice");

		internal static readonly Method API_UpdateSacrifice = new Method("UpdateSacrifice");

		public Sacrifice()
		{
			Sacrifices.Add(this);
		}

		public unsafe void AddRequiredItemType(params ItemType[] types)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < types.Length; i++)
			{
				ItemType val = types[i];
				ItemTypes.Add(((object)(*(ItemType*)(&val))/*cast due to .constrained prefix*/).ToString());
			}
		}

		public static void RegisterAll()
		{
			foreach (Sacrifice item in new List<Sacrifice>(Sacrifices))
			{
				item.Register();
			}
		}

		public bool Register()
		{
			string text = JsonConvert.SerializeObject((object)this);
			if (!(API_AddSacrifice.Invoke(text)[0] is string value))
			{
				return false;
			}
			Sacrifices.Remove(this);
			RunTimeRegistry.Register(this, value);
			EpicLoot.logger.LogDebug("Registered sacrifice");
			return true;
		}

		public bool Update()
		{
			if (!RunTimeRegistry.TryGetValue(this, out string value))
			{
				return false;
			}
			string text = JsonConvert.SerializeObject((object)this);
			bool flag = (bool)(API_UpdateSacrifice.Invoke(value, text)[0] ?? ((object)false));
			EpicLoot.logger.LogDebug($"Updated sacrifice: {flag}");
			return flag;
		}
	}
	[PublicAPI]
	public enum SecretStashType
	{
		Materials,
		RandomItems,
		OtherItems,
		Gamble,
		Sale
	}
	[Serializable]
	[PublicAPI]
	public class SecretStashItem
	{
		public string Item = "";

		public int CoinsCost;

		public int ForestTokenCost;

		public int IronBountyTokenCost;

		public int GoldBountyTokenCost;

		private SecretStashType type;

		internal static readonly List<SecretStashItem> SecretStashes = new List<SecretStashItem>();

		internal static readonly Method API_AddSecretStashItem = new Method("AddSecretStashItem");

		internal static readonly Method API_UpdateSecretStashItem = new Method("UpdateSecretStashItem");

		public SecretStashItem(SecretStashType type, string item)
		{
			Item = item;
			this.type = type;
			SecretStashes.Add(this);
		}

		public SecretStashItem()
		{
		}

		public static void RegisterAll()
		{
			foreach (SecretStashItem item in new List<SecretStashItem>(SecretStashes))
			{
				item.Register();
			}
		}

		public bool Register()
		{
			string text = JsonConvert.SerializeObject((object)this);
			if (!(API_AddSecretStashItem.Invoke(type.ToString(), text)[0] is string value))
			{
				return false;
			}
			SecretStashes.Remove(this);
			RunTimeRegistry.Register(this, value);
			EpicLoot.logger.LogDebug("Registered secret stash " + Item);
			return true;
		}

		public bool Update()
		{
			if (!RunTimeRegistry.TryGetValue(this, out string value))
			{
				return false;
			}
			string text = JsonConvert.SerializeObject((object)this);
			bool flag = (bool)(API_UpdateSecretStashItem.Invoke(value, text)[0] ?? ((object)false));
			EpicLoot.logger.LogDebug($"Updated secret stash {Item}, {flag}");
			return flag;
		}
	}
	[PublicAPI]
	public enum ShardType
	{
		Red = 0,
		Yellow = 1,
		Cyan = 2,
		Black = 3,
		Green = 4,
		Orange = 5,
		Pink = 6,
		Purple = 7,
		White = 8,
		Grey = 9,
		DarkGreen = 30,
		DarkPurple = 31,
		DarkRed = 32,
		DarkBlue = 33,
		Golden = 34,
		LightBlue = 40,
		LightGreen = 41,
		Peach = 42,
		Firewalker = 70,
		Stormcaller = 71,
		Eikthyr = 90,
		Elder = 91,
		Bonemass = 92,
		Moder = 93,
		Yagluth = 94,
		Queen = 95,
		Fader = 96,
		None = 97
	}
	[Serializable]
	[PublicAPI]
	public class TreasureMap
	{
		public Biome Biome;

		public int Cost;

		public int ForestTokens;

		public int GoldTokens;

		public int IronTokens;

		public int Coins;

		public float MinRadius;

		public float MaxRadius;

		internal static readonly List<TreasureMap> Treasures = new List<TreasureMap>();

		private static readonly Method API_AddTreasureMap = new Method("AddTreasureMap");

		private static readonly Method API_UpdateTreasureMap = new Method("UpdateTreasureMap");

		public TreasureMap(Biome biome, int cost, float minRadius, float maxRadius)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			Biome = biome;
			Cost = cost;
			MinRadius = minRadius;
			MaxRadius = maxRadius;
			Treasures.Add(this);
		}

		public TreasureMap()
		{
		}

		public static void RegisterAll()
		{
			foreach (TreasureMap item in new List<TreasureMap>(Treasures))
			{
				item.Register();
			}
		}

		public bool Register()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			string text = JsonConvert.SerializeObject((object)this);
			if (!(API_AddTreasureMap.Invoke(text)[0] is string value))
			{
				return false;
			}
			RunTimeRegistry.Register(this, value);
			Treasures.Remove(this);
			EpicLoot.logger.LogDebug($"Added treasure map: {Biome}");
			return true;
		}

		public bool Update()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (!RunTimeRegistry.TryGetValue(this, out string value))
			{
				return false;
			}
			string text = JsonConvert.SerializeObject((object)this);
			bool flag = (bool)(API_UpdateTreasureMap.Invoke(value, text)[0] ?? ((object)false));
			EpicLoot.logger.LogDebug($"Updated treasure map: {Biome}, {flag}");
			return flag;
		}
	}
}
namespace DvergerAutomation
{
	public class CoreSockets : MonoBehaviour
	{
		public Switch[] Switches;

		public GameObject[] SlotVisuals;

		public GameObject[] SlotEffects;

		public GameObject ActiveVisuals;

		public string ItemPrefab = "BlackCore";

		public string MaskKey = "DA_seek_cores";

		public string HoverName = "";

		public string AddMessage = "$DA_Add_BlackCore";

		public string RemoveMessage = "$DA_Remove_BlackCore";

		public string NeedMessage = "$DA_Need_BlackCore";

		internal Func<string> StatusLine;

		private ZNetView nview;

		private int maskHash;

		private string requestRpc;

		private string resultRpc;

		private string revokeRpc;

		private string refreshRpc;

		private int shownMask = -1;

		private Coroutine awaitingMask;

		private const float MaskWait = 5f;

		internal int SlotCount
		{
			get
			{
				if (Switches == null)
				{
					return 0;
				}
				return Switches.Length;
			}
		}

		private int Mask
		{
			get
			{
				if ((Object)(object)nview == (Object)null || !nview.IsValid())
				{
					return 0;
				}
				return nview.GetZDO().GetInt(maskHash, 0);
			}
		}

		internal int Count
		{
			get
			{
				int mask = Mask;
				int num = 0;
				for (int i = 0; i < SlotCount; i++)
				{
					if ((mask & (1 << i)) != 0)
					{
						num++;
					}
				}
				return num;
			}
		}

		internal event Action Changed;

		private void Awake()
		{
			nview = ((Component)this).GetComponentInParent<ZNetView>();
			maskHash = StringExtensionMethods.GetStableHashCode(MaskKey);
			requestRpc = MaskKey + "_request";
			resultRpc = MaskKey + "_result";
			revokeRpc = MaskKey + "_revoke";
			refreshRpc = MaskKey + "_refresh";
			if ((Object)(object)nview != (Object)null && nview.GetZDO() != null)
			{
				nview.Register<int, bool>(requestRpc, (Action<long, int, bool>)RPC_Request);
				nview.Register<int, bool>(resultRpc, (Action<long, int, bool>)RPC_Result);
				nview.Register<int>(revokeRpc, (Action<long, int>)RPC_Revoke);
				nview.Register(refreshRpc, (Action<long>)RPC_Refresh);
				WearNTear componentInParent = ((Component)this).GetComponentInParent<WearNTear>();
				if ((Object)(object)componentInParent != (Object)null)
				{
					componentInParent.m_onDestroyed = (Action)Delegate.Combine(componentInParent.m_onDestroyed, new Action(OnDestroyedDropCores));
				}
			}
			if (Switches != null)
			{
				for (int i = 0; i < Switches.Length; i++)
				{
					WireSwitch(i);
				}
			}
			CheckMask();
			((MonoBehaviour)this).InvokeRepeating("CheckMaskTimer", 1f, 4f);
		}

		private void OnDisable()
		{
			awaitingMask = null;
		}

		private bool IsFilled(int slot)
		{
			return (Mask & (1 << slot)) != 0;
		}

		private GameObject FindItemPrefab()
		{
			if (!((Object)(object)ObjectDB.instance != (Object)null))
			{
				return null;
			}
			return ObjectDB.instance.GetItemPrefab(ItemPrefab);
		}

		private static string SharedName(GameObject prefab)
		{
			return prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_name;
		}

		private void RPC_Request(long sender, int slot, bool insert)
		{
			if (!((Object)(object)nview == (Object)null) && nview.IsValid() && nview.IsOwner() && slot >= 0 && slot < SlotCount)
			{
				int mask = Mask;
				int num = 1 << slot;
				if ((mask & num) != 0 != insert)
				{
					nview.GetZDO().Set(maskHash, insert ? (mask | num) : (mask & ~num), false);
					nview.InvokeRPC(sender, resultRpc, new object[2] { slot, insert });
					nview.InvokeRPC(ZNetView.Everybody, refreshRpc, Array.Empty<object>());
				}
			}
		}

		private void RPC_Revoke(long sender, int slot)
		{
			if (!((Object)(object)nview == (Object)null) && nview.IsValid() && nview.IsOwner() && slot >= 0 && slot < SlotCount && IsFilled(slot))
			{
				nview.GetZDO().Set(maskHash, Mask & ~(1 << slot), false);
				nview.InvokeRPC(ZNetView.Everybody, refreshRpc, Array.Empty<object>());
			}
		}

		private void RPC_Result(long sender, int slot, bool inserted)
		{
			if (!Settle(inserted))
			{
				nview.InvokeRPC(revokeRpc, new object[1] { slot });
			}
		}

		private bool Settle(bool inserted)
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			Player localPlayer = Player.m_localPlayer;
			GameObject val = FindItemPrefab();
			if ((Object)(object)val == (Object)null)
			{
				return true;
			}
			if ((Object)(object)localPlayer == (Object)null)
			{
				if (inserted)
				{
					return false;
				}
				ItemData obj = val.GetComponent<ItemDrop>().m_itemData.Clone();
				obj.m_stack = 1;
				obj.m_dropPrefab = val;
				obj.m_worldLevel = Game.m_worldLevel;
				PlayerDelivery.Give(obj);
				return true;
			}
			Inventory inventory = ((Humanoid)localPlayer).GetInventory();
			if (inserted)
			{
				string text = SharedName(val);
				if (inventory.CountItems(text, -1, true) <= 0)
				{
					return false;
				}
				inventory.RemoveItem(text, 1, -1, true);
				((Character)localPlayer).Message((MessageType)2, AddMessage, 0, (Sprite)null, false);
			}
			else
			{
				if (!inventory.AddItem(val, 1))
				{
					Vector3 val2 = ((Component)localPlayer).transform.position + Vector3.up * 0.5f;
					ItemDrop.OnCreateNew(Object.Instantiate<GameObject>(val, val2, Quaternion.identity), false);
				}
				((Character)localPlayer).Message((MessageType)2, RemoveMessage, 0, (Sprite)null, false);
			}
			return true;
		}

		private void RPC_Refresh(long sender)
		{
			if (!CheckMask() && awaitingMask == null)
			{
				awaitingMask = ((MonoBehaviour)this).StartCoroutine(AwaitMask());
			}
		}

		private IEnumerator AwaitMask()
		{
			for (float waited = 0f; waited < 5f; waited += Time.deltaTime)
			{
				yield return null;
				if (CheckMask())
				{
					break;
				}
			}
			awaitingMask = null;
		}

		private void CheckMaskTimer()
		{
			CheckMask();
		}

		private bool CheckMask()
		{
			if ((Object)(object)nview == (Object)null || !nview.IsValid())
			{
				return false;
			}
			int mask = Mask;
			if (mask == shownMask)
			{
				return false;
			}
			bool num = shownMask < 0;
			shownMask = mask;
			UpdateVisuals(mask);
			if (!num)
			{
				this.Changed?.Invoke();
			}
			return true;
		}

		private void WireSwitch(int slot)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			Switch val = Switches[slot];
			if (!((Object)(object)val == (Object)null))
			{
				val.m_onUse = new Callback(OnSwitchUsed);
				val.m_onHover = (TooltipCallback)(() => GetSwitchHover(slot));
				val.m_name = HoverName;
			}
		}

		internal void SetHoverName(string name)
		{
			HoverName = name;
			if (Switches == null)
			{
				return;
			}
			Switch[] switches = Switches;
			foreach (Switch val in switches)
			{
				if ((Object)(object)val != (Object)null)
				{
					val.m_name = name;
				}
			}
		}

		private int SlotFor(Switch caller)
		{
			if (Switches == null)
			{
				return -1;
			}
			return Array.IndexOf(Switches, caller);
		}

		private bool OnSwitchUsed(Switch caller, Humanoid user, ItemData item)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			int num = SlotFor(caller);
			if (num >= 0)
			{
				Player val = (Player)(object)((user is Player) ? user : null);
				if (val != null)
				{
					if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false))
					{
						return false;
					}
					if ((Object)(object)nview == (Object)null || !nview.IsValid())
					{
						return fals