Decompiled source of LegendAPI v2.2.1

LegendApi.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
using IL;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using MonoMod.RuntimeDetour.HookGen;
using On;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("LegendApi")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+2285e781dd3b0066bbfabac47ba5758a06dd1bdf")]
[assembly: AssemblyProduct("LegendApi")]
[assembly: AssemblyTitle("LegendApi")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace LegendAPI;

public static class Dialog
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_HandleShowOptions <>9__3_2;

		public static hook_Awake <>9__3_0;

		public static hook_InitObjReferences <>9__3_1;

		internal void <Awake>b__3_0(orig_Awake orig, GameController self)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			orig.Invoke(self);
			if (hooked)
			{
				return;
			}
			object obj = <>9__3_2;
			if (obj == null)
			{
				hook_HandleShowOptions val = delegate(orig_HandleShowOptions val2, DialogManager val3, DialogMessage message)
				{
					val2.Invoke(val3, message);
					((MonoBehaviour)val3).StartCoroutine(ShowOptionsAddon(message));
				};
				<>9__3_2 = val;
				obj = (object)val;
			}
			DialogManager.HandleShowOptions += (hook_HandleShowOptions)obj;
			hooked = true;
			init = true;
		}

		internal void <Awake>b__3_2(orig_HandleShowOptions orig2, DialogManager self2, DialogMessage message)
		{
			orig2.Invoke(self2, message);
			((MonoBehaviour)self2).StartCoroutine(ShowOptionsAddon(message));
		}

		internal void <Awake>b__3_1(orig_InitObjReferences orig, DialogManager self)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			LegendAPI.Logger.LogDebug((object)(((object)((Component)self.dialogBoxBGImage).transform.position/*cast due to .constrained prefix*/).ToString() + "\n" + ((object)((Component)self.leftPortraitFillImage).transform.position/*cast due to .constrained prefix*/).ToString() + "\n" + ((object)((Component)self.leftBackgroundImage).transform.position/*cast due to .constrained prefix*/).ToString() + "\n" + ((object)((Component)self.leftPortraitImage).transform.position/*cast due to .constrained prefix*/).ToString() + "\n" + ((object)((Component)self.leftPortraitBorderImage).transform.position/*cast due to .constrained prefix*/).ToString() + "\n" + ((object)((Component)self.continuePrompt).transform.position/*cast due to .constrained prefix*/).ToString() + "\n" + ((object)((Component)self.optionsConfirmButtonImage).transform.position/*cast due to .constrained prefix*/).ToString() + "\n" + ((object)((Component)self.optionsCancelButtonImage).transform.position/*cast due to .constrained prefix*/).ToString()));
		}
	}

	internal static bool enabled = true;

	internal static bool hooked = false;

	internal static bool init = false;

	public static void Awake()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Expected O, but got Unknown
		object obj = <>c.<>9__3_0;
		if (obj == null)
		{
			hook_Awake val = delegate(orig_Awake orig, GameController self)
			{
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Expected O, but got Unknown
				orig.Invoke(self);
				if (!hooked)
				{
					object obj3 = <>c.<>9__3_2;
					if (obj3 == null)
					{
						hook_HandleShowOptions val3 = delegate(orig_HandleShowOptions val4, DialogManager val5, DialogMessage message)
						{
							val4.Invoke(val5, message);
							((MonoBehaviour)val5).StartCoroutine(ShowOptionsAddon(message));
						};
						<>c.<>9__3_2 = val3;
						obj3 = (object)val3;
					}
					DialogManager.HandleShowOptions += (hook_HandleShowOptions)obj3;
					hooked = true;
					init = true;
				}
			};
			<>c.<>9__3_0 = val;
			obj = (object)val;
		}
		GameController.Awake += (hook_Awake)obj;
		object obj2 = <>c.<>9__3_1;
		if (obj2 == null)
		{
			hook_InitObjReferences val2 = delegate(orig_InitObjReferences orig, DialogManager self)
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: Unknown result type (might be due to invalid IL or missing references)
				//IL_0147: Unknown result type (might be due to invalid IL or missing references)
				//IL_014c: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				LegendAPI.Logger.LogDebug((object)(((object)((Component)self.dialogBoxBGImage).transform.position/*cast due to .constrained prefix*/).ToString() + "\n" + ((object)((Component)self.leftPortraitFillImage).transform.position/*cast due to .constrained prefix*/).ToString() + "\n" + ((object)((Component)self.leftBackgroundImage).transform.position/*cast due to .constrained prefix*/).ToString() + "\n" + ((object)((Component)self.leftPortraitImage).transform.position/*cast due to .constrained prefix*/).ToString() + "\n" + ((object)((Component)self.leftPortraitBorderImage).transform.position/*cast due to .constrained prefix*/).ToString() + "\n" + ((object)((Component)self.continuePrompt).transform.position/*cast due to .constrained prefix*/).ToString() + "\n" + ((object)((Component)self.optionsConfirmButtonImage).transform.position/*cast due to .constrained prefix*/).ToString() + "\n" + ((object)((Component)self.optionsCancelButtonImage).transform.position/*cast due to .constrained prefix*/).ToString()));
			};
			<>c.<>9__3_1 = val2;
			obj2 = (object)val2;
		}
		DialogManager.InitObjReferences += (hook_InitObjReferences)obj2;
	}

	public static void LateInit()
	{
		if (enabled)
		{
			enabled = false;
		}
		if (!enabled && hooked)
		{
			hooked = false;
		}
	}

	private static void CatalogToDict(orig_ResetAvailableItems orig)
	{
		LateInit();
		orig.Invoke();
	}

	private static IEnumerator ShowOptionsAddon(DialogMessage message)
	{
		LegendAPI.Logger.LogDebug((object)"OptionhookEnumaraterTest");
		yield break;
	}
}
public static class Elements
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_ctor <>9__1_0;

		public static hook_StrToElement <>9__1_1;

		public static hook_IsPrimaryElement <>9__1_2;

		public static hook_IsSubElement <>9__1_3;

		public static Func<Instruction, bool> <>9__1_23;

		public static Func<Instruction, bool> <>9__1_21;

		public static Func<Instruction, bool> <>9__1_22;

		public static Manipulator <>9__1_4;

		public static hook_ctor <>9__1_5;

		public static Func<Instruction, bool> <>9__1_26;

		public static Func<Instruction, bool> <>9__1_27;

		public static Func<ElementType, bool> <>9__1_28;

		public static Action<SpellBookUI> <>9__1_25;

		public static Manipulator <>9__1_6;

		public static Func<ElementType, bool> <>9__1_29;

		public static hook_InitMiniElementIndicator <>9__1_7;

		public static Func<int, List<SkillState>, int> <>9__1_30;

		public static Func<ElementType, bool> <>9__1_31;

		public static hook_SetObjectReferences <>9__1_8;

		public static hook_Start <>9__1_9;

		public static hook_ctor <>9__1_10;

		public static hook_SetModStatus <>9__1_11;

		public static hook_OnTakeDamageActual <>9__1_12;

		public static Func<Instruction, bool> <>9__1_34;

		public static Func<Instruction, bool> <>9__1_36;

		public static Func<ElementalResistanceUp, bool> <>9__1_33;

		public static Manipulator <>9__1_13;

		public static Action<BurstOnDotItem, ElementType> <>9__1_37;

		public static Manipulator <>9__1_14;

		public static Action<AttackInfo, Vector2, ElementType> <>9__1_38;

		public static Manipulator <>9__1_15;

		public static hook_SetEventHandlers <>9__1_16;

		public static GlobalOnTakeDamageHandler <>9__1_17;

		public static Func<ElementInfo, bool> <>9__1_39;

		public static hook_LoadStatDict <>9__1_18;

		public static hook_ElementToStatusEffect <>9__1_19;

		public static Func<Instruction, bool> <>9__1_44;

		public static Func<Instruction, bool> <>9__1_45;

		public static Func<Instruction, bool> <>9__1_46;

		public static Func<ElementInfo, bool> <>9__1_48;

		public static Func<int, int> <>9__1_40;

		public static Func<Instruction, bool> <>9__1_41;

		public static Func<Instruction, bool> <>9__1_42;

		public static Func<ElementInfo, bool> <>9__1_49;

		public static Func<int, RandomDisasters, bool> <>9__1_43;

		public static Manipulator <>9__1_20;

		public static Func<Instruction, bool> <>9__6_1;

		public static Func<Instruction, bool> <>9__6_2;

		public static Func<int, int> <>9__6_0;

		public static Func<Instruction, bool> <>9__7_1;

		public static Func<HealthProxy, ElementType, bool> <>9__7_0;

		public static Func<Instruction, bool> <>9__8_1;

		public static Func<Health, ElementType, bool> <>9__8_0;

		public static Func<Instruction, bool> <>9__9_1;

		public static Func<Instruction, bool> <>9__9_2;

		public static Func<Instruction, bool> <>9__9_3;

		public static Action<Health> <>9__9_0;

		internal void <Awake>b__1_0(orig_ctor orig, Health self)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			orig.Invoke(self);
			foreach (ElementType key in eleDict.Keys)
			{
				if (!eleDict[key].isSubElement)
				{
					self.elemModDict.Add(key, new SyncedNumVarStat(1f));
				}
				if ((object)eleDict[key].statusEffectType != null)
				{
					self.statusResDict.Add(key, new SyncedNumVarStat(1f));
				}
			}
		}

		internal ElementType <Awake>b__1_1(orig_StrToElement orig, string name)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			foreach (KeyValuePair<ElementType, ElementInfo> item in eleDict)
			{
				if (item.Value.name == name)
				{
					return item.Key;
				}
			}
			return orig.Invoke(name);
		}

		internal bool <Awake>b__1_2(orig_IsPrimaryElement orig, ElementType element)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return eleDict.ContainsKey(element) ? (!eleDict[element].isSubElement) : orig.Invoke(element);
		}

		internal bool <Awake>b__1_3(orig_IsSubElement orig, ElementType element)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return eleDict.ContainsKey(element) ? eleDict[element].isSubElement : orig.Invoke(element);
		}

		internal void <Awake>b__1_4(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "elementType")
			}))
			{
				val.Index -= 2;
				val.Emit(OpCodes.Pop);
				MethodReference val2 = default(MethodReference);
				val.GotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2),
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2)
				});
				int index = val.Index;
				val.Index = index + 1;
				val.RemoveRange(2);
				val.EmitDelegate<Func<string, ElementType>>((Func<string, ElementType>)Globals.StrToElement);
			}
			else
			{
				LegendAPI.Logger.LogError((object)"SetSkillData hook failed,skills will not associate with custom elements.");
			}
		}

		internal bool <Awake>b__1_23(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdstr(x, "elementType");
		}

		internal bool <Awake>b__1_21(Instruction x)
		{
			MethodReference val = default(MethodReference);
			return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val);
		}

		internal bool <Awake>b__1_22(Instruction x)
		{
			MethodReference val = default(MethodReference);
			return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val);
		}

		internal void <Awake>b__1_5(orig_ctor orig, NewSpellHandler self)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass1_0 CS$<>8__locals3 = new <>c__DisplayClass1_0
			{
				self = self
			};
			orig.Invoke(CS$<>8__locals3.self);
			foreach (ElementType item in eleDict.Keys.Where((ElementType key) => !eleDict[key].isSubElement && !CS$<>8__locals3.self.elementUnlockCount.ContainsKey(key)))
			{
				CS$<>8__locals3.self.elementUnlockCount.Add(item, 0);
			}
		}

		internal void <Awake>b__1_6(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(Player).GetField("skillsDict"))
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<SpellBookUI>>((Action<SpellBookUI>)delegate(SpellBookUI self)
				{
					//IL_0092: Unknown result type (might be due to invalid IL or missing references)
					//IL_0097: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
					int count = self.eleIndexDict.Count;
					self.eleIndexDict.Add(count++, (ElementType)5);
					self.eleSpellDict.Add((ElementType)5, new List<SkillState>());
					self.eleOverdriveDict.Add((ElementType)5, new List<SkillState>());
					self.infoEleSkillTupleList.Add(new Tuple<ElementType, List<SkillState>>((ElementType)5, new List<SkillState>()));
					foreach (ElementType item in eleDict.Keys.Where((ElementType key) => !eleDict[key].isSubElement))
					{
						self.eleIndexDict.Add(count++, item);
						self.eleSpellDict.Add(item, new List<SkillState>());
						self.eleOverdriveDict.Add(item, new List<SkillState>());
						self.infoEleSkillTupleList.Add(new Tuple<ElementType, List<SkillState>>(item, new List<SkillState>()));
					}
				});
			}
			else
			{
				LegendAPI.Logger.LogError((object)"LoadEleSkillDict hook failed,spellbook won't be able to show spells with custom elements");
			}
		}

		internal bool <Awake>b__1_26(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdarg(x, 1);
		}

		internal bool <Awake>b__1_27(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdfld(x, typeof(Player).GetField("skillsDict"));
		}

		internal void <Awake>b__1_25(SpellBookUI self)
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			int count = self.eleIndexDict.Count;
			self.eleIndexDict.Add(count++, (ElementType)5);
			self.eleSpellDict.Add((ElementType)5, new List<SkillState>());
			self.eleOverdriveDict.Add((ElementType)5, new List<SkillState>());
			self.infoEleSkillTupleList.Add(new Tuple<ElementType, List<SkillState>>((ElementType)5, new List<SkillState>()));
			foreach (ElementType item in eleDict.Keys.Where((ElementType key) => !eleDict[key].isSubElement))
			{
				self.eleIndexDict.Add(count++, item);
				self.eleSpellDict.Add(item, new List<SkillState>());
				self.eleOverdriveDict.Add(item, new List<SkillState>());
				self.infoEleSkillTupleList.Add(new Tuple<ElementType, List<SkillState>>(item, new List<SkillState>()));
			}
		}

		internal bool <Awake>b__1_28(ElementType key)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return !eleDict[key].isSubElement;
		}

		internal void <Awake>b__1_7(orig_InitMiniElementIndicator orig, SBCardInfoPageUI self)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			foreach (ElementType item in eleDict.Keys.Where((ElementType key) => !eleDict[key].isSubElement))
			{
				self.miniEleIconDict[item] = Object.Instantiate<GameObject>(self.miniEleIconDict[(ElementType)0], self.miniElementIcons);
				self.miniEleIconDict[item].GetComponent<Image>().sprite = eleDict[item].icon ?? IconManager.ItemIcons[IconManager.unavailableItemName];
			}
		}

		internal bool <Awake>b__1_29(ElementType key)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return !eleDict[key].isSubElement;
		}

		internal void <Awake>b__1_8(orig_SetObjectReferences orig, SpellBookUI self)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			self.maxOverdriveCount = self.eleOverdriveDict?.Values.Aggregate(6, (int longest, List<SkillState> next) => (next.Count > longest) ? next.Count : longest) ?? 6;
			orig.Invoke(self);
			foreach (ElementType item in eleDict.Keys.Where((ElementType key) => !eleDict[key].isSubElement))
			{
				self.sbRef.eleInkIconDict[item] = Object.Instantiate<GameObject>(self.sbRef.eleInkIconDict[(ElementType)0], self.sbRef.inkElementsObj.transform);
				self.sbRef.eleInkIconDict[item].GetComponent<Image>().sprite = eleDict[item].iconInk ?? IconManager.ItemIcons[IconManager.unavailableItemName];
			}
		}

		internal int <Awake>b__1_30(int longest, List<SkillState> next)
		{
			return (next.Count > longest) ? next.Count : longest;
		}

		internal bool <Awake>b__1_31(ElementType key)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return !eleDict[key].isSubElement;
		}

		internal void <Awake>b__1_9(orig_Start orig, ElementSelectionUI self)
		{
			<>c__DisplayClass1_1 CS$<>8__locals3 = new <>c__DisplayClass1_1
			{
				self = self
			};
			orig.Invoke(CS$<>8__locals3.self);
			foreach (ElementInfo item in eleDict.Values.Where((ElementInfo info) => !CS$<>8__locals3.self.elementSprites.ContainsKey(info.name)))
			{
				CS$<>8__locals3.self.elementSprites[item.name] = item.icon;
			}
		}

		internal void <Awake>b__1_10(orig_ctor orig, ElementalResistanceUpOnHurt self)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			foreach (ElementType key in eleDict.Keys)
			{
				self.elementList.Add(key);
			}
		}

		internal void <Awake>b__1_11(orig_SetModStatus orig, ElementalResistanceUpOnHurt self, bool flag)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, flag);
			for (int i = 5; i < self.elementList.Count(); i++)
			{
				ElementType key = self.elementList[i];
				if (eleDict.ContainsKey(key))
				{
					if (!eleDict[key].isSubElement)
					{
						((VarStat<float>)(object)((Item)self).parentEntity.health.elemModDict[key]).Modify((VarStatMod<float>)(object)self.resistMod, flag);
					}
					if ((object)eleDict[key].statusEffectType != null)
					{
						((VarStat<float>)(object)((Item)self).parentEntity.health.statusResDict[key]).Modify((VarStatMod<float>)(object)self.resistMod, flag);
					}
				}
			}
		}

		internal void <Awake>b__1_12(orig_OnTakeDamageActual orig, ElementalResistanceUpOnHurt self, AttackInfo atk, Entity ent)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, atk, ent);
			for (int i = 5; i < self.elementList.Count(); i++)
			{
				ElementType key = self.elementList[i];
				if (eleDict.ContainsKey(key))
				{
					if (!eleDict[key].isSubElement)
					{
						((VarStat<float>)(object)((Item)self).parentEntity.health.elemModDict[key]).Modify((VarStatMod<float>)(object)self.resistMod, true);
					}
					if ((object)eleDict[key].statusEffectType != null)
					{
						((VarStat<float>)(object)((Item)self).parentEntity.health.statusResDict[key]).Modify((VarStatMod<float>)(object)self.resistMod, true);
					}
				}
			}
		}

		internal void <Awake>b__1_13(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass1_2 CS$<>8__locals3 = new <>c__DisplayClass1_2();
			ILCursor val = new ILCursor(il);
			CS$<>8__locals3.lab = val.DefineLabel();
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(Health), "statusResDict")
			}) && val.TryGotoPrev(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref CS$<>8__locals3.lab)
			}) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(VarStat<float>).GetMethod("Modify"))
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<ElementalResistanceUp, bool>>((Func<ElementalResistanceUp, bool>)((ElementalResistanceUp self) => !eleDict.ContainsKey(self.element) || (object)eleDict[self.element].statusEffectType != null));
				val.Emit(OpCodes.Brfalse, (object)CS$<>8__locals3.lab);
			}
		}

		internal bool <Awake>b__1_34(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdfld(x, typeof(Health), "statusResDict");
		}

		internal bool <Awake>b__1_36(Instruction x)
		{
			return ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(VarStat<float>).GetMethod("Modify"));
		}

		internal bool <Awake>b__1_33(ElementalResistanceUp self)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			return !eleDict.ContainsKey(self.element) || (object)eleDict[self.element].statusEffectType != null;
		}

		internal void <Awake>b__1_14(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.Index = -1;
			val.MoveAfterLabels();
			val.Emit(OpCodes.Ldarg_0);
			val.Emit(OpCodes.Ldarg_1);
			val.EmitDelegate<Action<BurstOnDotItem, ElementType>>((Action<BurstOnDotItem, ElementType>)delegate(BurstOnDotItem self, ElementType element)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				if (eleDict.ContainsKey(element) && (object)eleDict[element].elementalBurstType != null)
				{
					eleDict[element].elementalBurstType.GetMethod("CreateBurst").Invoke(null, new object[5]
					{
						((Entity)((Item)self).parentPlayer).hurtBoxTransform.position,
						((Entity)((Item)self).parentPlayer).skillCategory,
						((Item)self).ID,
						1,
						BurstOnDotItem.burstRadius
					});
				}
			});
		}

		internal void <Awake>b__1_37(BurstOnDotItem self, ElementType element)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (eleDict.ContainsKey(element) && (object)eleDict[element].elementalBurstType != null)
			{
				eleDict[element].elementalBurstType.GetMethod("CreateBurst").Invoke(null, new object[5]
				{
					((Entity)((Item)self).parentPlayer).hurtBoxTransform.position,
					((Entity)((Item)self).parentPlayer).skillCategory,
					((Item)self).ID,
					1,
					BurstOnDotItem.burstRadius
				});
			}
		}

		internal void <Awake>b__1_15(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.Index = -1;
			val.MoveAfterLabels();
			val.Emit(OpCodes.Ldloc, 0);
			val.Emit(OpCodes.Ldloc, 1);
			val.Emit(OpCodes.Ldarg, 2);
			val.EmitDelegate<Action<AttackInfo, Vector2, ElementType>>((Action<AttackInfo, Vector2, ElementType>)delegate(AttackInfo info, Vector2 vec, ElementType element)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				if (eleDict.ContainsKey(element) && (object)eleDict[element].elementalBurstType != null && (object)eleDict[element].statusEffectType != null)
				{
					eleDict[element].elementalBurstType.GetMethod("CreateBurst").Invoke(null, new object[3]
					{
						vec,
						info,
						AoEStatusEffects.burstRadius
					});
				}
			});
		}

		internal void <Awake>b__1_38(AttackInfo info, Vector2 vec, ElementType element)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			if (eleDict.ContainsKey(element) && (object)eleDict[element].elementalBurstType != null && (object)eleDict[element].statusEffectType != null)
			{
				eleDict[element].elementalBurstType.GetMethod("CreateBurst").Invoke(null, new object[3]
				{
					vec,
					info,
					AoEStatusEffects.burstRadius
				});
			}
		}

		internal void <Awake>b__1_16(orig_SetEventHandlers orig, RandomElementalEnemies self, bool active)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, active);
			foreach (KeyValuePair<ElementType, ElementInfo> item in eleDict)
			{
				if (!item.Value.isSubElement)
				{
					((VarStat<float>)(object)((Entity)((Item)self).parentPlayer).health.elemModDict[item.Key]).Modify((VarStatMod<float>)(object)self.resistMod, active);
				}
				if ((object)item.Value.statusEffectType != null)
				{
					((VarStat<float>)(object)((Entity)((Item)self).parentPlayer).health.statusResDict[item.Key]).Modify((VarStatMod<float>)(object)self.resistMod, active);
				}
			}
		}

		internal void <Awake>b__1_17(AttackInfo givenInfo, Entity atkEnt, Entity caller)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			if (givenInfo == null || !Object.op_Implicit((Object)(object)caller))
			{
				return;
			}
			if (eleDict.ContainsKey(givenInfo.elementType) && HandleCustomStatus(caller.health, givenInfo, givenInfo.elementType, atkEnt))
			{
				caller.health.statusElementType = givenInfo.elementType;
			}
			foreach (ElementType key in eleDict.Keys)
			{
				if (key != givenInfo.elementType && HandleCustomStatus(caller.health, givenInfo, key, atkEnt))
				{
					caller.health.statusElementType = key;
					break;
				}
			}
		}

		internal void <Awake>b__1_18(orig_LoadStatDict orig, StatData self, SkillStats givenSS)
		{
			orig.Invoke(self, givenSS);
			float[] collection = new float[givenSS.burnChance.Count()];
			foreach (ElementInfo item in eleDict.Values.Where((ElementInfo item) => (object)item.statusEffectType != null))
			{
				List<float> value = new List<float>(collection);
				self.statDict.Add(item.statusEffectChanceString, value);
			}
		}

		internal bool <Awake>b__1_39(ElementInfo item)
		{
			return (object)item.statusEffectType != null;
		}

		internal string <Awake>b__1_19(orig_ElementToStatusEffect orig, ElementalStatusUp self, ElementType element)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			return eleDict.ContainsKey(element) ? eleDict[element].statusEffectChanceString : orig.Invoke(self, element);
		}

		internal void <Awake>b__1_20(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Expected O, but got Unknown
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass1_3 CS$<>8__locals3 = new <>c__DisplayClass1_3();
			ILCursor val = new ILCursor(il);
			CS$<>8__locals3.rand = -1;
			ILLabel val2 = val.DefineLabel();
			ILLabel val3 = default(ILLabel);
			if (!val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 5),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val3),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref CS$<>8__locals3.rand)
			}))
			{
				return;
			}
			val.Index += 2;
			val.EmitDelegate<Func<int, int>>((Func<int, int>)((int coun) => coun + eleDict.Values.Count((ElementInfo el) => el.spawnDisaster != null)));
			ILLabel[] array = default(ILLabel[]);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchSwitch(x, ref array),
				(Instruction x) => ILPatternMatchingExt.MatchBr(x, ref val3)
			});
			val.GotoLabel((ILLabel)val.Prev.Operand, (MoveType)1, false);
			val2 = (ILLabel)val.Prev.Operand;
			val.Emit(OpCodes.Ldloc, CS$<>8__locals3.rand);
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<int, RandomDisasters, bool>>((Func<int, RandomDisasters, bool>)delegate(int ran, RandomDisasters self)
			{
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				if (ran == 4)
				{
					return false;
				}
				((MonoBehaviour)((Item)self).parentEntity).StartCoroutine(eleDict.Values.Where((ElementInfo el) => el.spawnDisaster != null).ElementAt(ran - 4).spawnDisaster?.Invoke(self.parentPosition));
				return true;
			});
			val.Emit(OpCodes.Brtrue, (object)val2);
		}

		internal bool <Awake>b__1_44(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdcI4(x, 0);
		}

		internal bool <Awake>b__1_45(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdcI4(x, 5);
		}

		internal bool <Awake>b__1_46(Instruction x)
		{
			MethodReference val = default(MethodReference);
			return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val);
		}

		internal int <Awake>b__1_40(int coun)
		{
			return coun + eleDict.Values.Count((ElementInfo el) => el.spawnDisaster != null);
		}

		internal bool <Awake>b__1_48(ElementInfo el)
		{
			return el.spawnDisaster != null;
		}

		internal bool <Awake>b__1_41(Instruction x)
		{
			ILLabel[] array = default(ILLabel[]);
			return ILPatternMatchingExt.MatchSwitch(x, ref array);
		}

		internal bool <Awake>b__1_42(Instruction x)
		{
			ILLabel val = default(ILLabel);
			return ILPatternMatchingExt.MatchBr(x, ref val);
		}

		internal bool <Awake>b__1_43(int ran, RandomDisasters self)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (ran == 4)
			{
				return false;
			}
			((MonoBehaviour)((Item)self).parentEntity).StartCoroutine(eleDict.Values.Where((ElementInfo el) => el.spawnDisaster != null).ElementAt(ran - 4).spawnDisaster?.Invoke(self.parentPosition));
			return true;
		}

		internal bool <Awake>b__1_49(ElementInfo el)
		{
			return el.spawnDisaster != null;
		}

		internal bool <DefaultToCustomElementSwitchCase>b__6_1(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdcI4(x, 0);
		}

		internal bool <DefaultToCustomElementSwitchCase>b__6_2(Instruction x)
		{
			return ILPatternMatchingExt.MatchRet(x);
		}

		internal int <DefaultToCustomElementSwitchCase>b__6_0(int input)
		{
			return eleDict.ContainsKey((ElementType)input) ? input : 0;
		}

		internal bool <ElementalDamageModifierProxy>b__7_1(Instruction x)
		{
			return ILPatternMatchingExt.MatchStfld(x, typeof(HealthProxy).GetField("eleDmgMulti", (BindingFlags)(-1)));
		}

		internal bool <ElementalDamageModifierProxy>b__7_0(HealthProxy self, ElementType element)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			if (eleDict.ContainsKey(((Health)self).entityElement) && eleDict[((Health)self).entityElement].weakTo.Contains(element))
			{
				self.eleDmgMulti = 2;
				return true;
			}
			if (eleDict.ContainsKey(element) && eleDict[element].weakTo.Contains(((Health)self).entityElement))
			{
				self.eleDmgMulti = -1;
				return true;
			}
			return false;
		}

		internal bool <ElementalDamageModifier>b__8_1(Instruction x)
		{
			return ILPatternMatchingExt.MatchStfld(x, typeof(Health).GetField("eleDmgModVal", (BindingFlags)(-1)));
		}

		internal bool <ElementalDamageModifier>b__8_0(Health self, ElementType element)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			if (eleDict.ContainsKey(self.tempEleType) && eleDict[self.entityElement].weakTo.Contains(element))
			{
				self.eleDmgModVal = 2;
				return true;
			}
			if (eleDict.ContainsKey(element) && eleDict[element].weakTo.Contains(self.tempEleType))
			{
				self.eleDmgModVal = -1;
				return true;
			}
			return false;
		}

		internal bool <HookTakeDamage>b__9_1(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdfld(x, typeof(AttackInfo).GetField("subElementType", (BindingFlags)(-1)));
		}

		internal bool <HookTakeDamage>b__9_2(Instruction x)
		{
			ILLabel[] array = default(ILLabel[]);
			return ILPatternMatchingExt.MatchSwitch(x, ref array);
		}

		internal bool <HookTakeDamage>b__9_3(Instruction x)
		{
			ILLabel val = default(ILLabel);
			return ILPatternMatchingExt.MatchBr(x, ref val);
		}

		internal void <HookTakeDamage>b__9_0(Health self)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (eleDict.ContainsKey(self.currentAtkInfo.subElementType))
			{
				self.impactAudioID = eleDict[self.currentAtkInfo.subElementType].impactAudioID ?? self.impactAudioID;
			}
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass1_0
	{
		public NewSpellHandler self;

		public Func<ElementType, bool> <>9__24;

		internal bool <Awake>b__24(ElementType key)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			return !eleDict[key].isSubElement && !self.elementUnlockCount.ContainsKey(key);
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass1_1
	{
		public ElementSelectionUI self;

		public Func<ElementInfo, bool> <>9__32;

		internal bool <Awake>b__32(ElementInfo info)
		{
			return !self.elementSprites.ContainsKey(info.name);
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass1_2
	{
		public ILLabel lab;

		internal bool <Awake>b__35(Instruction x)
		{
			return ILPatternMatchingExt.MatchBrfalse(x, ref lab);
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass1_3
	{
		public int rand;

		internal bool <Awake>b__47(Instruction x)
		{
			return ILPatternMatchingExt.MatchStloc(x, ref rand);
		}
	}

	public static Dictionary<ElementType, ElementInfo> eleDict = new Dictionary<ElementType, ElementInfo>();

	public static void Awake()
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Expected O, but got Unknown
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Expected O, but got Unknown
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Expected O, but got Unknown
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Expected O, but got Unknown
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Expected O, but got Unknown
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Expected O, but got Unknown
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Expected O, but got Unknown
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Expected O, but got Unknown
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Expected O, but got Unknown
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Expected O, but got Unknown
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Expected O, but got Unknown
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Expected O, but got Unknown
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01db: Expected O, but got Unknown
		//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0200: Expected O, but got Unknown
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0225: Expected O, but got Unknown
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		//IL_024a: Expected O, but got Unknown
		//IL_0264: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Expected O, but got Unknown
		//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ab: Expected O, but got Unknown
		//IL_0289: Unknown result type (might be due to invalid IL or missing references)
		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0294: Expected O, but got Unknown
		//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02df: Expected O, but got Unknown
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d0: Expected O, but got Unknown
		//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fe: Expected O, but got Unknown
		//IL_0318: Unknown result type (might be due to invalid IL or missing references)
		//IL_031d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0323: Expected O, but got Unknown
		//IL_0355: Unknown result type (might be due to invalid IL or missing references)
		//IL_035f: Expected O, but got Unknown
		//IL_0367: Unknown result type (might be due to invalid IL or missing references)
		//IL_0371: Expected O, but got Unknown
		//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0424: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0342: Unknown result type (might be due to invalid IL or missing references)
		//IL_0348: Expected O, but got Unknown
		object obj = <>c.<>9__1_0;
		if (obj == null)
		{
			hook_ctor val = delegate(orig_ctor orig, Health self)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Expected O, but got Unknown
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Expected O, but got Unknown
				orig.Invoke(self);
				foreach (ElementType key2 in eleDict.Keys)
				{
					if (!eleDict[key2].isSubElement)
					{
						self.elemModDict.Add(key2, new SyncedNumVarStat(1f));
					}
					if ((object)eleDict[key2].statusEffectType != null)
					{
						self.statusResDict.Add(key2, new SyncedNumVarStat(1f));
					}
				}
			};
			<>c.<>9__1_0 = val;
			obj = (object)val;
		}
		Health.ctor += (hook_ctor)obj;
		Globals.IntToElement += new Manipulator(DefaultToCustomElementSwitchCase);
		Globals.ElementToInt += new Manipulator(DefaultToCustomElementSwitchCase);
		object obj2 = <>c.<>9__1_1;
		if (obj2 == null)
		{
			hook_StrToElement val2 = delegate(orig_StrToElement orig, string name)
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				foreach (KeyValuePair<ElementType, ElementInfo> item in eleDict)
				{
					if (item.Value.name == name)
					{
						return item.Key;
					}
				}
				return orig.Invoke(name);
			};
			<>c.<>9__1_1 = val2;
			obj2 = (object)val2;
		}
		Globals.StrToElement += (hook_StrToElement)obj2;
		object obj3 = <>c.<>9__1_2;
		if (obj3 == null)
		{
			hook_IsPrimaryElement val3 = (orig_IsPrimaryElement orig, ElementType element) => eleDict.ContainsKey(element) ? (!eleDict[element].isSubElement) : orig.Invoke(element);
			<>c.<>9__1_2 = val3;
			obj3 = (object)val3;
		}
		ElementTypeMethods.IsPrimaryElement += (hook_IsPrimaryElement)obj3;
		object obj4 = <>c.<>9__1_3;
		if (obj4 == null)
		{
			hook_IsSubElement val4 = (orig_IsSubElement orig, ElementType element) => eleDict.ContainsKey(element) ? eleDict[element].isSubElement : orig.Invoke(element);
			<>c.<>9__1_3 = val4;
			obj4 = (object)val4;
		}
		ElementTypeMethods.IsSubElement += (hook_IsSubElement)obj4;
		object obj5 = <>c.<>9__1_4;
		if (obj5 == null)
		{
			Manipulator val5 = delegate(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val22 = new ILCursor(il);
				if (val22.TryGotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "elementType")
				}))
				{
					val22.Index -= 2;
					val22.Emit(OpCodes.Pop);
					MethodReference val23 = default(MethodReference);
					val22.GotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val23),
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val23)
					});
					int index = val22.Index;
					val22.Index = index + 1;
					val22.RemoveRange(2);
					val22.EmitDelegate<Func<string, ElementType>>((Func<string, ElementType>)Globals.StrToElement);
				}
				else
				{
					LegendAPI.Logger.LogError((object)"SetSkillData hook failed,skills will not associate with custom elements.");
				}
			};
			<>c.<>9__1_4 = val5;
			obj5 = (object)val5;
		}
		SkillState.SetSkillData += (Manipulator)obj5;
		object obj6 = <>c.<>9__1_5;
		if (obj6 == null)
		{
			hook_ctor val6 = delegate(orig_ctor orig, NewSpellHandler self)
			{
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				foreach (ElementType item2 in eleDict.Keys.Where((ElementType key) => !eleDict[key].isSubElement && !self.elementUnlockCount.ContainsKey(key)))
				{
					self.elementUnlockCount.Add(item2, 0);
				}
			};
			<>c.<>9__1_5 = val6;
			obj6 = (object)val6;
		}
		NewSpellHandler.ctor += (hook_ctor)obj6;
		object obj7 = <>c.<>9__1_6;
		if (obj7 == null)
		{
			Manipulator val7 = delegate(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val22 = new ILCursor(il);
				if (val22.TryGotoNext(new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(Player).GetField("skillsDict"))
				}))
				{
					val22.Emit(OpCodes.Ldarg_0);
					val22.EmitDelegate<Action<SpellBookUI>>((Action<SpellBookUI>)delegate(SpellBookUI self)
					{
						//IL_0092: Unknown result type (might be due to invalid IL or missing references)
						//IL_0097: Unknown result type (might be due to invalid IL or missing references)
						//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
						//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
						//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
						//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
						int count = self.eleIndexDict.Count;
						self.eleIndexDict.Add(count++, (ElementType)5);
						self.eleSpellDict.Add((ElementType)5, new List<SkillState>());
						self.eleOverdriveDict.Add((ElementType)5, new List<SkillState>());
						self.infoEleSkillTupleList.Add(new Tuple<ElementType, List<SkillState>>((ElementType)5, new List<SkillState>()));
						foreach (ElementType item3 in eleDict.Keys.Where((ElementType key) => !eleDict[key].isSubElement))
						{
							self.eleIndexDict.Add(count++, item3);
							self.eleSpellDict.Add(item3, new List<SkillState>());
							self.eleOverdriveDict.Add(item3, new List<SkillState>());
							self.infoEleSkillTupleList.Add(new Tuple<ElementType, List<SkillState>>(item3, new List<SkillState>()));
						}
					});
				}
				else
				{
					LegendAPI.Logger.LogError((object)"LoadEleSkillDict hook failed,spellbook won't be able to show spells with custom elements");
				}
			};
			<>c.<>9__1_6 = val7;
			obj7 = (object)val7;
		}
		SpellBookUI.LoadEleSkillDict += (Manipulator)obj7;
		object obj8 = <>c.<>9__1_7;
		if (obj8 == null)
		{
			hook_InitMiniElementIndicator val8 = delegate(orig_InitMiniElementIndicator orig, SBCardInfoPageUI self)
			{
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				foreach (ElementType item4 in eleDict.Keys.Where((ElementType key) => !eleDict[key].isSubElement))
				{
					self.miniEleIconDict[item4] = Object.Instantiate<GameObject>(self.miniEleIconDict[(ElementType)0], self.miniElementIcons);
					self.miniEleIconDict[item4].GetComponent<Image>().sprite = eleDict[item4].icon ?? IconManager.ItemIcons[IconManager.unavailableItemName];
				}
			};
			<>c.<>9__1_7 = val8;
			obj8 = (object)val8;
		}
		SBCardInfoPageUI.InitMiniElementIndicator += (hook_InitMiniElementIndicator)obj8;
		object obj9 = <>c.<>9__1_8;
		if (obj9 == null)
		{
			hook_SetObjectReferences val9 = delegate(orig_SetObjectReferences orig, SpellBookUI self)
			{
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				self.maxOverdriveCount = self.eleOverdriveDict?.Values.Aggregate(6, (int longest, List<SkillState> next) => (next.Count > longest) ? next.Count : longest) ?? 6;
				orig.Invoke(self);
				foreach (ElementType item5 in eleDict.Keys.Where((ElementType key) => !eleDict[key].isSubElement))
				{
					self.sbRef.eleInkIconDict[item5] = Object.Instantiate<GameObject>(self.sbRef.eleInkIconDict[(ElementType)0], self.sbRef.inkElementsObj.transform);
					self.sbRef.eleInkIconDict[item5].GetComponent<Image>().sprite = eleDict[item5].iconInk ?? IconManager.ItemIcons[IconManager.unavailableItemName];
				}
			};
			<>c.<>9__1_8 = val9;
			obj9 = (object)val9;
		}
		SpellBookUI.SetObjectReferences += (hook_SetObjectReferences)obj9;
		object obj10 = <>c.<>9__1_9;
		if (obj10 == null)
		{
			hook_Start val10 = delegate(orig_Start orig, ElementSelectionUI self)
			{
				orig.Invoke(self);
				foreach (ElementInfo item6 in eleDict.Values.Where((ElementInfo info) => !self.elementSprites.ContainsKey(info.name)))
				{
					self.elementSprites[item6.name] = item6.icon;
				}
			};
			<>c.<>9__1_9 = val10;
			obj10 = (object)val10;
		}
		ElementSelectionUI.Start += (hook_Start)obj10;
		object obj11 = <>c.<>9__1_10;
		if (obj11 == null)
		{
			hook_ctor val11 = delegate(orig_ctor orig, ElementalResistanceUpOnHurt self)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				foreach (ElementType key3 in eleDict.Keys)
				{
					self.elementList.Add(key3);
				}
			};
			<>c.<>9__1_10 = val11;
			obj11 = (object)val11;
		}
		ElementalResistanceUpOnHurt.ctor += (hook_ctor)obj11;
		object obj12 = <>c.<>9__1_11;
		if (obj12 == null)
		{
			hook_SetModStatus val12 = delegate(orig_SetModStatus orig, ElementalResistanceUpOnHurt self, bool flag)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, flag);
				for (int i = 5; i < self.elementList.Count(); i++)
				{
					ElementType key = self.elementList[i];
					if (eleDict.ContainsKey(key))
					{
						if (!eleDict[key].isSubElement)
						{
							((VarStat<float>)(object)((Item)self).parentEntity.health.elemModDict[key]).Modify((VarStatMod<float>)(object)self.resistMod, flag);
						}
						if ((object)eleDict[key].statusEffectType != null)
						{
							((VarStat<float>)(object)((Item)self).parentEntity.health.statusResDict[key]).Modify((VarStatMod<float>)(object)self.resistMod, flag);
						}
					}
				}
			};
			<>c.<>9__1_11 = val12;
			obj12 = (object)val12;
		}
		ElementalResistanceUpOnHurt.SetModStatus += (hook_SetModStatus)obj12;
		object obj13 = <>c.<>9__1_12;
		if (obj13 == null)
		{
			hook_OnTakeDamageActual val13 = delegate(orig_OnTakeDamageActual orig, ElementalResistanceUpOnHurt self, AttackInfo atk, Entity ent)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, atk, ent);
				for (int i = 5; i < self.elementList.Count(); i++)
				{
					ElementType key = self.elementList[i];
					if (eleDict.ContainsKey(key))
					{
						if (!eleDict[key].isSubElement)
						{
							((VarStat<float>)(object)((Item)self).parentEntity.health.elemModDict[key]).Modify((VarStatMod<float>)(object)self.resistMod, true);
						}
						if ((object)eleDict[key].statusEffectType != null)
						{
							((VarStat<float>)(object)((Item)self).parentEntity.health.statusResDict[key]).Modify((VarStatMod<float>)(object)self.resistMod, true);
						}
					}
				}
			};
			<>c.<>9__1_12 = val13;
			obj13 = (object)val13;
		}
		ElementalResistanceUpOnHurt.OnTakeDamageActual += (hook_OnTakeDamageActual)obj13;
		object obj14 = <>c.<>9__1_13;
		if (obj14 == null)
		{
			Manipulator val14 = delegate(ILContext il)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Expected O, but got Unknown
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val22 = new ILCursor(il);
				ILLabel lab = val22.DefineLabel();
				if (val22.TryGotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(Health), "statusResDict")
				}) && val22.TryGotoPrev(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref lab)
				}) && val22.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(VarStat<float>).GetMethod("Modify"))
				}))
				{
					val22.Emit(OpCodes.Ldarg_0);
					val22.EmitDelegate<Func<ElementalResistanceUp, bool>>((Func<ElementalResistanceUp, bool>)((ElementalResistanceUp self) => !eleDict.ContainsKey(self.element) || (object)eleDict[self.element].statusEffectType != null));
					val22.Emit(OpCodes.Brfalse, (object)lab);
				}
			};
			<>c.<>9__1_13 = val14;
			obj14 = (object)val14;
		}
		ElementalResistanceUp.SetModStatus += (Manipulator)obj14;
		object obj15 = <>c.<>9__1_14;
		if (obj15 == null)
		{
			Manipulator val15 = delegate(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val22 = new ILCursor(il);
				val22.Index = -1;
				val22.MoveAfterLabels();
				val22.Emit(OpCodes.Ldarg_0);
				val22.Emit(OpCodes.Ldarg_1);
				val22.EmitDelegate<Action<BurstOnDotItem, ElementType>>((Action<BurstOnDotItem, ElementType>)delegate(BurstOnDotItem self, ElementType element)
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_0013: Unknown result type (might be due to invalid IL or missing references)
					//IL_002e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0057: Unknown result type (might be due to invalid IL or missing references)
					if (eleDict.ContainsKey(element) && (object)eleDict[element].elementalBurstType != null)
					{
						eleDict[element].elementalBurstType.GetMethod("CreateBurst").Invoke(null, new object[5]
						{
							((Entity)((Item)self).parentPlayer).hurtBoxTransform.position,
							((Entity)((Item)self).parentPlayer).skillCategory,
							((Item)self).ID,
							1,
							BurstOnDotItem.burstRadius
						});
					}
				});
			};
			<>c.<>9__1_14 = val15;
			obj15 = (object)val15;
		}
		BurstOnDotItem.OnDotApply += (Manipulator)obj15;
		object obj16 = <>c.<>9__1_15;
		if (obj16 == null)
		{
			Manipulator val16 = delegate(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val22 = new ILCursor(il);
				val22.Index = -1;
				val22.MoveAfterLabels();
				val22.Emit(OpCodes.Ldloc, 0);
				val22.Emit(OpCodes.Ldloc, 1);
				val22.Emit(OpCodes.Ldarg, 2);
				val22.EmitDelegate<Action<AttackInfo, Vector2, ElementType>>((Action<AttackInfo, Vector2, ElementType>)delegate(AttackInfo info, Vector2 vec, ElementType element)
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_0013: Unknown result type (might be due to invalid IL or missing references)
					//IL_002e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0045: Unknown result type (might be due to invalid IL or missing references)
					//IL_0063: Unknown result type (might be due to invalid IL or missing references)
					if (eleDict.ContainsKey(element) && (object)eleDict[element].elementalBurstType != null && (object)eleDict[element].statusEffectType != null)
					{
						eleDict[element].elementalBurstType.GetMethod("CreateBurst").Invoke(null, new object[3]
						{
							vec,
							info,
							AoEStatusEffects.burstRadius
						});
					}
				});
			};
			<>c.<>9__1_15 = val16;
			obj16 = (object)val16;
		}
		AoEStatusEffects.OnDoTEvent += (Manipulator)obj16;
		object obj17 = <>c.<>9__1_16;
		if (obj17 == null)
		{
			hook_SetEventHandlers val17 = delegate(orig_SetEventHandlers orig, RandomElementalEnemies self, bool active)
			{
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, active);
				foreach (KeyValuePair<ElementType, ElementInfo> item7 in eleDict)
				{
					if (!item7.Value.isSubElement)
					{
						((VarStat<float>)(object)((Entity)((Item)self).parentPlayer).health.elemModDict[item7.Key]).Modify((VarStatMod<float>)(object)self.resistMod, active);
					}
					if ((object)item7.Value.statusEffectType != null)
					{
						((VarStat<float>)(object)((Entity)((Item)self).parentPlayer).health.statusResDict[item7.Key]).Modify((VarStatMod<float>)(object)self.resistMod, active);
					}
				}
			};
			<>c.<>9__1_16 = val17;
			obj17 = (object)val17;
		}
		RandomElementalEnemies.SetEventHandlers += (hook_SetEventHandlers)obj17;
		Health.TakeDamage += new Manipulator(HookTakeDamage);
		GlobalOnTakeDamageHandler globalTakeDamageActualHandlers = Health.globalTakeDamageActualHandlers;
		object obj18 = <>c.<>9__1_17;
		if (obj18 == null)
		{
			GlobalOnTakeDamageHandler val18 = delegate(AttackInfo givenInfo, Entity atkEnt, Entity caller)
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_009a: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				if (givenInfo == null || !Object.op_Implicit((Object)(object)caller))
				{
					return;
				}
				if (eleDict.ContainsKey(givenInfo.elementType) && HandleCustomStatus(caller.health, givenInfo, givenInfo.elementType, atkEnt))
				{
					caller.health.statusElementType = givenInfo.elementType;
				}
				foreach (ElementType key4 in eleDict.Keys)
				{
					if (key4 != givenInfo.elementType && HandleCustomStatus(caller.health, givenInfo, key4, atkEnt))
					{
						caller.health.statusElementType = key4;
						break;
					}
				}
			};
			<>c.<>9__1_17 = val18;
			obj18 = (object)val18;
		}
		Health.globalTakeDamageActualHandlers = (GlobalOnTakeDamageHandler)Delegate.Combine((Delegate?)(object)globalTakeDamageActualHandlers, (Delegate?)obj18);
		object obj19 = <>c.<>9__1_18;
		if (obj19 == null)
		{
			hook_LoadStatDict val19 = delegate(orig_LoadStatDict orig, StatData self, SkillStats givenSS)
			{
				orig.Invoke(self, givenSS);
				float[] collection = new float[givenSS.burnChance.Count()];
				foreach (ElementInfo item8 in eleDict.Values.Where((ElementInfo item) => (object)item.statusEffectType != null))
				{
					List<float> value = new List<float>(collection);
					self.statDict.Add(item8.statusEffectChanceString, value);
				}
			};
			<>c.<>9__1_18 = val19;
			obj19 = (object)val19;
		}
		StatData.LoadStatDict += (hook_LoadStatDict)obj19;
		object obj20 = <>c.<>9__1_19;
		if (obj20 == null)
		{
			hook_ElementToStatusEffect val20 = (orig_ElementToStatusEffect orig, ElementalStatusUp self, ElementType element) => eleDict.ContainsKey(element) ? eleDict[element].statusEffectChanceString : orig.Invoke(self, element);
			<>c.<>9__1_19 = val20;
			obj20 = (object)val20;
		}
		ElementalStatusUp.ElementToStatusEffect += (hook_ElementToStatusEffect)obj20;
		object obj21 = <>c.<>9__1_20;
		if (obj21 == null)
		{
			Manipulator val21 = delegate(ILContext il)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Expected O, but got Unknown
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				//IL_0144: Expected O, but got Unknown
				//IL_0150: Unknown result type (might be due to invalid IL or missing references)
				//IL_0156: Expected O, but got Unknown
				//IL_0157: Unknown result type (might be due to invalid IL or missing references)
				//IL_0169: Unknown result type (might be due to invalid IL or missing references)
				//IL_019b: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val22 = new ILCursor(il);
				int rand = -1;
				ILLabel val23 = val22.DefineLabel();
				ILLabel val24 = default(ILLabel);
				if (val22.TryGotoNext(new Func<Instruction, bool>[4]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 5),
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val24),
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref rand)
				}))
				{
					val22.Index += 2;
					val22.EmitDelegate<Func<int, int>>((Func<int, int>)((int coun) => coun + eleDict.Values.Count((ElementInfo el) => el.spawnDisaster != null)));
					ILLabel[] array = default(ILLabel[]);
					val22.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchSwitch(x, ref array),
						(Instruction x) => ILPatternMatchingExt.MatchBr(x, ref val24)
					});
					val22.GotoLabel((ILLabel)val22.Prev.Operand, (MoveType)1, false);
					val23 = (ILLabel)val22.Prev.Operand;
					val22.Emit(OpCodes.Ldloc, rand);
					val22.Emit(OpCodes.Ldarg_0);
					val22.EmitDelegate<Func<int, RandomDisasters, bool>>((Func<int, RandomDisasters, bool>)delegate(int ran, RandomDisasters self)
					{
						//IL_0057: Unknown result type (might be due to invalid IL or missing references)
						if (ran == 4)
						{
							return false;
						}
						((MonoBehaviour)((Item)self).parentEntity).StartCoroutine(eleDict.Values.Where((ElementInfo el) => el.spawnDisaster != null).ElementAt(ran - 4).spawnDisaster?.Invoke(self.parentPosition));
						return true;
					});
					val22.Emit(OpCodes.Brtrue, (object)val23);
				}
			};
			<>c.<>9__1_20 = val21;
			obj21 = (object)val21;
		}
		RandomDisasters.SpawnDisaster += (Manipulator)obj21;
		Health.GetElementalDamageModifier += new Manipulator(ElementalDamageModifier);
		HealthProxy.GetElementalDamageModifier += new Manipulator(ElementalDamageModifierProxy);
		new Hook((MethodBase)typeof(Enum).GetMethod("ToString", Type.EmptyTypes), typeof(Elements).GetMethod("ToStringRedir", (BindingFlags)(-1)));
		new Hook((MethodBase)typeof(Enum).GetMethod("Parse", new Type[2]
		{
			typeof(Type),
			typeof(string)
		}), typeof(Elements).GetMethod("ParseRedir", (BindingFlags)(-1)));
		new Hook((MethodBase)typeof(SpellBookUI).GetProperty("MaxSpellPageCount", (BindingFlags)(-1)).GetGetMethod(nonPublic: true), typeof(Elements).GetMethod("SBPageCount"));
	}

	public static int SBPageCount(Func<SpellBookUI, int> orig, SpellBookUI self)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		orig(self);
		return Player.elementSkillDict[self.currentElement].Count / SBSpellPageUI.MaxSpellCount;
	}

	public static string ToStringRedir(Func<Enum, string> orig, Enum self)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		return ((object)self.GetType() == typeof(ElementType) && eleDict.ContainsKey((ElementType)(object)self)) ? eleDict[(ElementType)(object)self].name : orig(self);
	}

	public static Enum ParseRedir(Func<Type, string, Enum> orig, Type type, string data)
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		if ((object)type == typeof(ElementType))
		{
			foreach (KeyValuePair<ElementType, ElementInfo> item in eleDict)
			{
				if (item.Value.name == data || ((object)item.Key/*cast due to .constrained prefix*/).ToString() == data)
				{
					return (Enum)(object)item.Key;
				}
			}
		}
		return orig(type, data);
	}

	public static ElementType Register(ElementInfo info)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Invalid comparison between Unknown and I4
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Invalid comparison between Unknown and I4
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		ElementType val = (ElementType)info.name.GetHashCode();
		int num = 1;
		while (((int)val >= 0 && (int)val <= 9) || eleDict.ContainsKey(val))
		{
			val = (ElementType)(val + num % 2 * ((object)Unsafe.As<Color, Color>(ref info.color)/*cast due to .constrained prefix*/).GetHashCode() + (num % 2 + 1) * info.name.GetHashCode());
			if (num++ > 10)
			{
				LegendAPI.Logger.LogError((object)"Element Registration failed due to hash collision,this really shouldn't be happening unless you are adding the same element repeatedly.");
				return (ElementType)0;
			}
		}
		if (Object.op_Implicit((Object)(object)info.icon) && !Object.op_Implicit((Object)(object)info.iconInk))
		{
			info.iconInk = info.icon;
		}
		if ((object)info.statusEffectType != null && info.statusEffectChanceString == null)
		{
			info.statusEffectChanceString = info.name + "StatusChance";
		}
		eleDict.Add(val, info);
		if (!info.isSubElement)
		{
			Player.elementSkillDict.Add(val, new List<string>());
		}
		if (info.weakTo.Count() != 0)
		{
			Health.eleWheelDict[val] = info.weakTo.First();
			Ward.addedWeakenessDict[val] = info.weakTo.First();
		}
		ElementalStatusEffect.elementColorDictionary.Add(val, info.color);
		return val;
	}

	internal static void DefaultToCustomElementSwitchCase(ILContext il)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected O, but got Unknown
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		ILCursor val = new ILCursor(il);
		val.Index = -1;
		if (val.TryGotoPrev(new Func<Instruction, bool>[2]
		{
			(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
			(Instruction x) => ILPatternMatchingExt.MatchRet(x)
		}))
		{
			int index = val.Index;
			val.Index = index + 1;
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<int, int>>((Func<int, int>)((int input) => eleDict.ContainsKey((ElementType)input) ? input : 0));
		}
		else
		{
			LegendAPI.Logger.LogError((object)"Element <=> Int conversion hook failed,relevant functions will break");
		}
	}

	internal static void ElementalDamageModifierProxy(ILContext il)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Expected O, but got Unknown
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		ILCursor val = new ILCursor(il);
		ILLabel lab = val.DefineLabel();
		if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
		{
			(Instruction x) => ILPatternMatchingExt.MatchStfld(x, typeof(HealthProxy).GetField("eleDmgMulti", (BindingFlags)(-1))),
			(Instruction x) => ILPatternMatchingExt.MatchBr(x, ref lab)
		}))
		{
			val.MoveAfterLabels();
			val.Emit(OpCodes.Ldarg_0);
			val.Emit(OpCodes.Ldarg_1);
			val.EmitDelegate<Func<HealthProxy, ElementType, bool>>((Func<HealthProxy, ElementType, bool>)delegate(HealthProxy self, ElementType element)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				if (eleDict.ContainsKey(((Health)self).entityElement) && eleDict[((Health)self).entityElement].weakTo.Contains(element))
				{
					self.eleDmgMulti = 2;
					return true;
				}
				if (eleDict.ContainsKey(element) && eleDict[element].weakTo.Contains(((Health)self).entityElement))
				{
					self.eleDmgMulti = -1;
					return true;
				}
				return false;
			});
			val.Emit(OpCodes.Brtrue, (object)lab);
		}
		else
		{
			LegendAPI.Logger.LogError((object)"Element weakness hook failed,custom elements may ignore weaknessess");
		}
	}

	internal static void ElementalDamageModifier(ILContext il)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Expected O, but got Unknown
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		ILCursor val = new ILCursor(il);
		ILLabel lab = val.DefineLabel();
		if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
		{
			(Instruction x) => ILPatternMatchingExt.MatchStfld(x, typeof(Health).GetField("eleDmgModVal", (BindingFlags)(-1))),
			(Instruction x) => ILPatternMatchingExt.MatchBr(x, ref lab)
		}))
		{
			val.MoveAfterLabels();
			val.Emit(OpCodes.Ldarg_0);
			val.Emit(OpCodes.Ldarg_1);
			val.EmitDelegate<Func<Health, ElementType, bool>>((Func<Health, ElementType, bool>)delegate(Health self, ElementType element)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				if (eleDict.ContainsKey(self.tempEleType) && eleDict[self.entityElement].weakTo.Contains(element))
				{
					self.eleDmgModVal = 2;
					return true;
				}
				if (eleDict.ContainsKey(element) && eleDict[element].weakTo.Contains(self.tempEleType))
				{
					self.eleDmgModVal = -1;
					return true;
				}
				return false;
			});
			val.Emit(OpCodes.Brtrue, (object)lab);
		}
		else
		{
			LegendAPI.Logger.LogError((object)"Element weakness hook failed,custom elements may ignore weaknessess");
		}
	}

	internal static void HookTakeDamage(ILContext il)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected O, but got Unknown
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		ILCursor val = new ILCursor(il);
		ILLabel[] array = default(ILLabel[]);
		ILLabel val2 = default(ILLabel);
		if (!val.TryGotoNext(new Func<Instruction, bool>[1]
		{
			(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(AttackInfo).GetField("subElementType", (BindingFlags)(-1)))
		}) || !val.TryGotoNext(new Func<Instruction, bool>[2]
		{
			(Instruction x) => ILPatternMatchingExt.MatchSwitch(x, ref array),
			(Instruction x) => ILPatternMatchingExt.MatchBr(x, ref val2)
		}))
		{
			return;
		}
		val.Emit(OpCodes.Ldarg_0);
		val.EmitDelegate<Action<Health>>((Action<Health>)delegate(Health self)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (eleDict.ContainsKey(self.currentAtkInfo.subElementType))
			{
				self.impactAudioID = eleDict[self.currentAtkInfo.subElementType].impactAudioID ?? self.impactAudioID;
			}
		});
	}

	internal static bool HandleCustomStatus(Health caller, AttackInfo givenInfo, ElementType element, Entity atkEnt = null)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Expected O, but got Unknown
		if (givenInfo.skillLevel >= 0 && eleDict.ContainsKey(element) && (object)eleDict[element].statusEffectType != null)
		{
			ElementInfo elementInfo = eleDict[element];
			List<float> extraAttackInfo = Utility.GetExtraAttackInfo<List<float>>(givenInfo, elementInfo.statusEffectChanceString);
			if (extraAttackInfo == null || extraAttackInfo.Count <= givenInfo.skillLevel)
			{
				return false;
			}
			float num = extraAttackInfo.ElementAt(givenInfo.skillLevel);
			if (num > 0f && num * ((VarStat<float>)(object)caller.statusResDict[element]).CurrentValue > Random.value)
			{
				((ComponentBase)caller).entityScript.dotManager.AddDot((DoTEffect)Activator.CreateInstance(elementInfo.statusEffectType, givenInfo.skillCategory, givenInfo.skillLevel, ((ComponentBase)caller).entityScript, atkEnt));
				return true;
			}
		}
		return false;
	}
}
public class ElementInfo
{
	public string name = "";

	public Color color = Color.cyan;

	public List<ElementType> weakTo = new List<ElementType>();

	public bool isSubElement = false;

	public string impactAudioID = null;

	public Type statusEffectType = null;

	public string statusEffectChanceString = null;

	public Type elementalBurstType = null;

	public Func<Vector2, IEnumerator> spawnDisaster = null;

	public Sprite icon = null;

	public Sprite iconInk = null;
}
public static class Items
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_Awake <>9__6_0;

		public static Func<Instruction, bool> <>9__11_1;

		public static Action<Item> <>9__11_0;

		public static Func<string, bool> <>9__15_0;

		public static Func<Instruction, bool> <>9__16_1;

		public static Func<int, RunHistoryEntry, bool> <>9__16_0;

		internal void <Awake>b__6_0(orig_Awake orig, GameController self)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			orig.Invoke(self);
			if (!hooked)
			{
				TextManager.GetItemName += new hook_GetItemName(CustomItemText);
				LootManager.ResetAvailableItems += new hook_ResetAvailableItems(CatalogToDict);
				IconManager.GetItemIcon += new hook_GetItemIcon(CustomItemIcon);
				RunHistoryEntryUI.Load += new Manipulator(TrophyCaseUnknown);
				LootManager.GetLockedItemID += new Manipulator(CustomItemUnlock);
				Inventory.AddItem_Item_bool_bool += new Manipulator(GroupItemTrigger);
				hooked = true;
				init = true;
			}
		}

		internal bool <GroupItemTrigger>b__11_1(Instruction x)
		{
			return ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(Item).GetMethod("Activate"));
		}

		internal void <GroupItemTrigger>b__11_0(Item item)
		{
			item.GroupItemCreated(item.parentGroupID);
		}

		internal bool <CustomItemUnlock>b__15_0(string id)
		{
			return !ItemCatalog.ContainsKey(id) || ItemCatalog[id].unlockCondition();
		}

		internal bool <TrophyCaseUnknown>b__16_1(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdsfld(x, typeof(LootManager).GetField("completeItemDict", (BindingFlags)(-1)));
		}

		internal bool <TrophyCaseUnknown>b__16_0(int orig, RunHistoryEntry run)
		{
			return LootManager.completeItemDict.ContainsKey(run.relicIDs[orig]);
		}
	}

	internal static Dictionary<string, ItemInfo> ItemCatalog = new Dictionary<string, ItemInfo>();

	internal static Dictionary<string, string[]> RecipeCatalog = new Dictionary<string, string[]>();

	internal static Dictionary<string, List<string>> GroupCatalog = new Dictionary<string, List<string>>();

	internal static bool enabled = true;

	internal static bool hooked = false;

	internal static bool init = false;

	public static void Awake()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		object obj = <>c.<>9__6_0;
		if (obj == null)
		{
			hook_Awake val = delegate(orig_Awake orig, GameController self)
			{
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Expected O, but got Unknown
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Expected O, but got Unknown
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Expected O, but got Unknown
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Expected O, but got Unknown
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_006f: Expected O, but got Unknown
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: Expected O, but got Unknown
				orig.Invoke(self);
				if (!hooked)
				{
					TextManager.GetItemName += new hook_GetItemName(CustomItemText);
					LootManager.ResetAvailableItems += new hook_ResetAvailableItems(CatalogToDict);
					IconManager.GetItemIcon += new hook_GetItemIcon(CustomItemIcon);
					RunHistoryEntryUI.Load += new Manipulator(TrophyCaseUnknown);
					LootManager.GetLockedItemID += new Manipulator(CustomItemUnlock);
					Inventory.AddItem_Item_bool_bool += new Manipulator(GroupItemTrigger);
					hooked = true;
					init = true;
				}
			};
			<>c.<>9__6_0 = val;
			obj = (object)val;
		}
		GameController.Awake += (hook_Awake)obj;
	}

	public static void LateInit()
	{
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Expected O, but got Unknown
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Expected O, but got Unknown
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: Expected O, but got Unknown
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Expected O, but got Unknown
		if (ItemCatalog.Count == 0 && RecipeCatalog.Count == 0 && GroupCatalog.Count == 0)
		{
			enabled = false;
		}
		if (enabled)
		{
			foreach (string key in RecipeCatalog.Keys)
			{
				if (!ItemRecipe.recipes.ContainsKey(key))
				{
					ItemRecipe.recipes.Add(key, RecipeCatalog[key]);
				}
				else
				{
					ItemRecipe.recipes[key] = RecipeCatalog[key];
				}
			}
			{
				foreach (string key2 in GroupCatalog.Keys)
				{
					if (!LootManager.completeItemDict.ContainsKey(key2))
					{
						LegendAPI.Logger.LogError((object)("Group: " + key2 + " has no GroupItem associated,skipping."));
					}
					else if (!GroupItemManager.groupsDict.ContainsKey(key2))
					{
						GroupItemManager.groupsDict.Add(key2, GroupCatalog[key2]);
					}
					else
					{
						GroupItemManager.groupsDict[key2].AddRange(GroupCatalog[key2]);
					}
				}
				return;
			}
		}
		if (hooked)
		{
			TextManager.GetItemName -= new hook_GetItemName(CustomItemText);
			LootManager.ResetAvailableItems -= new hook_ResetAvailableItems(CatalogToDict);
			IconManager.GetItemIcon -= new hook_GetItemIcon(CustomItemIcon);
			LootManager.GetLockedItemID -= new Manipulator(CustomItemUnlock);
			hooked = false;
		}
	}

	public static void Register(ItemInfo Info)
	{
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Expected O, but got Unknown
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Expected O, but got Unknown
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Expected O, but got Unknown
		if (!enabled && init && !hooked)
		{
			TextManager.GetItemName += new hook_GetItemName(CustomItemText);
			LootManager.ResetAvailableItems += new hook_ResetAvailableItems(CatalogToDict);
			IconManager.GetItemIcon += new hook_GetItemIcon(CustomItemIcon);
			LootManager.GetLockedItemID += new Manipulator(CustomItemUnlock);
			hooked = true;
		}
		ref ItemInfo text = ref Info.text;
		object obj = (object)default(ItemInfo);
		if (((object)Unsafe.As<ItemInfo, ItemInfo>(ref text)/*cast due to .constrained prefix*/).Equals(obj))
		{
			Info.text = default(ItemInfo);
			Info.text.displayName = Info.name;
			Info.text.itemID = Info.item.ID;
			Info.text.description = Info.name;
		}
		if (!ItemCatalog.ContainsKey(Info.item.ID))
		{
			ItemCatalog.Add(Info.item.ID, Info);
		}
		else
		{
			ItemCatalog[Info.item.ID] = Info;
		}
		if (Info.group != null)
		{
			if (!GroupCatalog.ContainsKey(Info.group))
			{
				GroupCatalog.Add(Info.group, new List<string>());
			}
			GroupCatalog[Info.group].Add(Info.item.ID);
			if (Info.item.parentGroupID == null || Info.item.parentGroupID == string.Empty)
			{
				Info.item.parentGroupID = Info.group;
			}
		}
	}

	public static void Register(Item item)
	{
		ItemInfo itemInfo = new ItemInfo();
		itemInfo.item = item;
		itemInfo.name = itemInfo.item.ID;
		itemInfo.text.displayName = itemInfo.name;
		itemInfo.text.itemID = itemInfo.name;
		itemInfo.text.description = itemInfo.name;
		Register(itemInfo);
	}

	public static void RegisterRecipe(string Result, string[] ingredients)
	{
		if (!RecipeCatalog.ContainsKey(Result))
		{
			RecipeCatalog.Add(Result, ingredients);
		}
		else
		{
			RecipeCatalog[Result] = ingredients;
		}
	}

	private static void GroupItemTrigger(ILContext il)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected O, but got Unknown
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		ILCursor val = new ILCursor(il);
		if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
		{
			(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(Item).GetMethod("Activate"))
		}))
		{
			val.Emit(OpCodes.Ldarg_1);
			val.EmitDelegate<Action<Item>>((Action<Item>)delegate(Item item)
			{
				item.GroupItemCreated(item.parentGroupID);
			});
		}
	}

	private static void CatalogToDict(orig_ResetAvailableItems orig)
	{
		foreach (ItemInfo value in ItemCatalog.Values)
		{
			if (!LootManager.completeItemDict.ContainsKey(value.item.ID))
			{
				LootManager.completeItemDict.Add(value.item.ID, value.item);
			}
			else
			{
				LootManager.completeItemDict[value.item.ID] = value.item;
			}
			if (value.tier >= LootManager.maxItemTier)
			{
				for (int i = LootManager.maxItemTier; i <= value.tier; i++)
				{
					LootManager.itemTierDict.Add(i, new List<string>());
				}
				LootManager.maxItemTier = value.tier + 1;
			}
			foreach (List<string> value2 in LootManager.itemTierDict.Values)
			{
				if (value2.Contains(value.item.ID))
				{
					value2.Remove(value.item.ID);
				}
			}
			if (value.priceMultiplier != 1)
			{
				LootManager.PriceDict[value.item.ID] = ((value.priceMultiplier != -1) ? value.priceMultiplier : ((!value.item.isCursed) ? 1 : 0));
			}
			if (!value.item.isCursed)
			{
				LootManager.itemTierDict[value.tier].Add(value.item.ID);
			}
		}
		LateInit();
		orig.Invoke();
	}

	private static string CustomItemText(orig_GetItemName orig, string givenID)
	{
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		foreach (ItemInfo value in ItemCatalog.Values)
		{
			if (!TextManager.itemInfoDict.ContainsKey(value.item.ID))
			{
				TextManager.itemInfoDict.Add(value.item.ID, value.text);
			}
			else
			{
				TextManager.itemInfoDict[value.item.ID] = value.text;
			}
		}
		return orig.Invoke(givenID);
	}

	private static Sprite CustomItemIcon(orig_GetItemIcon orig, string givenID)
	{
		if (ItemCatalog.ContainsKey(givenID))
		{
			Sprite val = ItemCatalog[givenID].icon ?? IconManager.ItemIcons[IconManager.unavailableItemName];
			if (!IconManager.ItemIcons.ContainsKey(givenID))
			{
				IconManager.ItemIcons.Add(givenID, val);
			}
			else if ((Object)(object)IconManager.ItemIcons[givenID] != (Object)(object)val)
			{
				IconManager.ItemIcons[givenID] = val;
			}
		}
		return orig.Invoke(givenID);
	}

	private static void CustomItemUnlock(ILContext il)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Expected O, but got Unknown
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		ILCursor val = new ILCursor(il);
		ILLabel lab = val.DefineLabel();
		ILLabel val2 = val.DefineLabel();
		val.MarkLabel(val2);
		if (val.TryGotoNext(new Func<Instruction, bool>[1]
		{
			(Instruction x) => ILPatternMatchingExt.MatchBle(x, ref lab)
		}))
		{
			val.GotoLabel(lab, (MoveType)1, false);
			val.MoveBeforeLabels();
			val.Emit(OpCodes.Ldloc_0);
			val.EmitDelegate<Func<string, bool>>((