Decompiled source of ArtificerExtended v3.6.4

ArtificerExtended.dll

Decompiled 3 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using AncientScepter;
using ArtificerExtended.Components;
using ArtificerExtended.CoreModules;
using ArtificerExtended.EntityState;
using ArtificerExtended.Helpers;
using ArtificerExtended.Passive;
using ArtificerExtended.Properties;
using ArtificerExtended.Skills;
using ArtificerExtended.Unlocks;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using ChillRework;
using EntityStates;
using EntityStates.Huntress;
using EntityStates.Mage;
using EntityStates.Mage.Weapon;
using EntityStates.Toolbot;
using EntityStates.Treebot.Weapon;
using HG;
using IL.RoR2.UI;
using JetBrains.Annotations;
using KinematicCharacterController;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Mage;
using On.EntityStates.Mage.Weapon;
using On.RoR2;
using On.RoR2.Skills;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using RiskyMod.Survivors.Mage.Components;
using RoR2;
using RoR2.Achievements;
using RoR2.ContentManagement;
using RoR2.EntityLogic;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.Stats;
using RoR2.UI;
using ThreeEyedGames;
using UnityEngine;
using UnityEngine.Networking;
using VRAPI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ArtificerExtended")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ArtificerExtended")]
[assembly: AssemblyTitle("ArtificerExtended")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace ArtificerExtended
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[R2APISubmoduleDependency(new string[] { "UnlockableAPI", "LanguageAPI", "LoadoutAPI", "PrefabAPI", "DamageAPI" })]
	[BepInPlugin("com.Borbo.ArtificerExtended", "ArtificerExtended", "3.6.4")]
	public class ArtificerExtendedPlugin : BaseUnityPlugin
	{
		public delegate TCheese GiveCheese<TCheese>();

		private struct FreezeInfo
		{
			public GameObject frozenBy;

			public Vector3 frozenAt;

			public FreezeInfo(GameObject frozenBy, Vector3 frozenAt)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				this.frozenAt = frozenAt;
				this.frozenBy = frozenBy;
			}
		}

		private class FlamethrowerContext
		{
			public AltArtiPassive passive;

			public float timer;

			public FlamethrowerContext(AltArtiPassive passive)
			{
				this.passive = passive;
				timer = 0f;
			}
		}

		private class PrepWallContext
		{
			public AltArtiPassive passive;

			public AltArtiPassive.BatchHandle handle;

			public PrepWallContext(AltArtiPassive passive, AltArtiPassive.BatchHandle handle)
			{
				this.passive = passive;
				this.handle = handle;
			}
		}

		private class NanoBombContext
		{
			public AltArtiPassive passive;

			public AltArtiPassive.BatchHandle handle;

			public float timer;

			public NanoBombContext(AltArtiPassive passive, AltArtiPassive.BatchHandle handle)
			{
				this.passive = passive;
				this.handle = handle;
				timer = 0f;
			}
		}

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

			public static hook_FromSkillSlot <>9__41_0;

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

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

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

			public static Action<List<StripDisplayData>, StripDisplayData, GenericSkill> <>9__41_4;

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

			public static Func<Row, Row> <>9__41_11;

			public static Manipulator <>9__41_2;

			public static Func<Type, bool> <>9__49_0;

			public static Func<Type, bool> <>9__54_0;

			public static Func<Type, bool> <>9__55_0;

			internal object <CreateMagePassiveSlot>b__41_0(orig_FromSkillSlot orig, LoadoutPanelController owner, BodyIndex bodyI, int slotI, GenericSkill slot)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Expected O, but got Unknown
				Row val = (Row)orig.Invoke(owner, bodyI, slotI, slot);
				if (((Object)slot.skillFamily).name.Contains("Passive"))
				{
					Transform val2 = ((Transform)val.rowPanelTransform).Find("SlotLabel") ?? ((Transform)val.rowPanelTransform).Find("LabelContainer").Find("SlotLabel");
					if (Object.op_Implicit((Object)(object)val2))
					{
						((Component)val2).GetComponent<LanguageTextMeshController>().token = "Misc";
					}
				}
				return val;
			}

			internal bool <CreateMagePassiveSlot>b__41_6(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdfld(x, typeof(GenericSkill).GetField("hideInCharacterSelect"));
			}

			internal bool <CreateMagePassiveSlot>b__41_8(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdfld(x, typeof(Variant).GetField("skillDef"));
			}

			internal bool <CreateMagePassiveSlot>b__41_10(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(List<StripDisplayData>).GetMethod("Add"));
			}

			internal void <CreateMagePassiveSlot>b__41_4(List<StripDisplayData> list, StripDisplayData disp, GenericSkill skill)
			{
				//IL_0029: 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)
				if (((Object)skill.skillFamily).name == "MageBodyPassive")
				{
					list.Insert(0, disp);
				}
				else
				{
					list.Add(disp);
				}
			}

			internal void <CreateMagePassiveSlot>b__41_2(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(Row).GetMethod("FromSkillSlot", (BindingFlags)(-1)))
				}))
				{
					return;
				}
				val.EmitDelegate<Func<Row, Row>>((Func<Row, Row>)delegate(Row orig)
				{
					Transform val2 = ((Transform)orig.rowPanelTransform).Find("SlotLabel") ?? ((Transform)orig.rowPanelTransform).Find("LabelContainer").Find("SlotLabel");
					if (Object.op_Implicit((Object)(object)val2) && ((Component)val2).GetComponent<LanguageTextMeshController>().token == "Misc")
					{
						((Transform)orig.rowPanelTransform).SetSiblingIndex(0);
					}
					return orig;
				});
			}

			internal bool <CreateMagePassiveSlot>b__41_12(Instruction x)
			{
				return ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(Row).GetMethod("FromSkillSlot", (BindingFlags)(-1)));
			}

			internal Row <CreateMagePassiveSlot>b__41_11(Row orig)
			{
				Transform val = ((Transform)orig.rowPanelTransform).Find("SlotLabel") ?? ((Transform)orig.rowPanelTransform).Find("LabelContainer").Find("SlotLabel");
				if (Object.op_Implicit((Object)(object)val) && ((Component)val).GetComponent<LanguageTextMeshController>().token == "Misc")
				{
					((Transform)orig.rowPanelTransform).SetSiblingIndex(0);
				}
				return orig;
			}

			internal bool <InitializeUnlocks>b__49_0(Type type)
			{
				return !type.IsAbstract && type.IsSubclassOf(typeof(UnlockBase));
			}

			internal bool <InitializeSkills>b__54_0(Type type)
			{
				return !type.IsAbstract && type.IsSubclassOf(typeof(SkillBase));
			}

			internal bool <InitializeScepterSkills>b__55_0(Type type)
			{
				return !type.IsAbstract && type.IsSubclassOf(typeof(ScepterSkillBase));
			}
		}

		public const string guid = "com.Borbo.ArtificerExtended";

		public const string modName = "ArtificerExtended";

		public const string version = "3.6.4";

		public static AssetBundle iconBundle = Tools.LoadAssetBundle(Resources.artiskillicons);

		public static string iconsPath = "Assets/AESkillIcons/";

		public static string TokenName = "ARTIFICEREXTENDED_";

		public static bool isScepterLoaded = Tools.isLoaded("com.DestroyedClone.AncientScepter");

		public static bool autosprintLoaded = Tools.isLoaded("com.johnedwa.RTAutoSprintEx");

		public static bool is2r4rLoaded = Tools.isLoaded("com.HouseOfFruits.RiskierRain");

		public static bool isRiskyModLoaded = Tools.isLoaded("com.RiskyLives.RiskyMod");

		public static GameObject mageObject;

		public static CharacterBody mageBody;

		public static SkillLocator mageSkillLocator;

		public static GenericSkill magePassive;

		public static SkillFamily magePassiveFamily;

		public static SkillFamily magePrimary;

		public static SkillFamily mageSecondary;

		public static SkillFamily mageUtility;

		public static SkillFamily mageSpecial;

		public static float artiBoltDamage = 2.8f;

		public static float artiNanoDamage = 20f;

		public static float artiUtilCooldown = 12f;

		public static float meleeRangeChannel = 21f;

		public static float meleeRangeSingle = meleeRangeChannel + 4f;

		public static Dictionary<UnlockBase, UnlockableDef> UnlockBaseDictionary = new Dictionary<UnlockBase, UnlockableDef>();

		public static List<Type> entityStates = new List<Type>();

		public static List<SkillBase> Skills = new List<SkillBase>();

		public static List<ScepterSkillBase> ScepterSkills = new List<ScepterSkillBase>();

		public static Dictionary<SkillBase, bool> SkillStatusDictionary = new Dictionary<SkillBase, bool>();

		private readonly Dictionary<GameObject, GameObject> frozenBy = new Dictionary<GameObject, GameObject>();

		private readonly Dictionary<Flamethrower, FlamethrowerContext> flamethrowerContext = new Dictionary<Flamethrower, FlamethrowerContext>();

		private readonly Dictionary<PrepWall, PrepWallContext> prepWallContext = new Dictionary<PrepWall, PrepWallContext>();

		private readonly Dictionary<BaseChargeBombState, NanoBombContext> nanoBombContext = new Dictionary<BaseChargeBombState, NanoBombContext>();

		internal static ConfigFile CustomConfigFile { get; set; }

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

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

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

		private void Awake()
		{
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Expected O, but got Unknown
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Expected O, but got Unknown
			mageObject = LegacyResourcesAPI.Load<GameObject>("prefabs/characterbodies/MageBody");
			mageObject.AddComponent<ElementCounter>();
			mageBody = mageObject.GetComponent<CharacterBody>();
			mageSkillLocator = mageObject.GetComponent<SkillLocator>();
			if (Object.op_Implicit((Object)(object)mageObject) && Object.op_Implicit((Object)(object)mageBody) && Object.op_Implicit((Object)(object)mageSkillLocator))
			{
				Debug.Log((object)"ARTIFICEREXTENDED setup succeeded!");
			}
			magePassive = CreateMagePassiveSlot(mageObject, mageSkillLocator);
			magePassiveFamily = magePassive.skillFamily;
			magePrimary = mageSkillLocator.primary.skillFamily;
			mageSecondary = mageSkillLocator.secondary.skillFamily;
			mageUtility = mageSkillLocator.utility.skillFamily;
			mageSpecial = mageSkillLocator.special.skillFamily;
			InitializeConfig();
			InitializeUnlocks();
			Debug.Log((object)"ArtificerExtended setup succeeded!");
			CreateMagePassives(magePassiveFamily);
			SkillCatalog.Init += new hook_Init(ReplaceSkillDefs);
			SkillCatalog.Init += new hook_Init(ReplaceScepterSkillDefs);
			if (is2r4rLoaded)
			{
				artiNanoDamage = 12f;
				artiUtilCooldown = 8f;
			}
			AddHooks();
			Assets.CreateZapDamageType();
			Buffs.CreateBuffs();
			Projectiles.CreateLightningSwords();
			Effects.DoEffects();
			ArtiChanges();
			InitializeSkills();
			if (isScepterLoaded)
			{
				InitializeScepterSkills();
			}
			CharacterMaster.OnBodyStart += new hook_OnBodyStart(AddAEBodyFX);
			new ContentPacks().Initialize();
			VRStuff.SetupVR();
		}

		private GenericSkill CreateMagePassiveSlot(GameObject body, SkillLocator skillLocator)
		{
			//IL_00e8: 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_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			GenericSkill[] components = body.GetComponents<GenericSkill>();
			foreach (GenericSkill val in components)
			{
				if (((Object)val.skillFamily).name.ToLower().Contains("passive"))
				{
					return val;
				}
			}
			SkillFamily passiveFamily = ScriptableObject.CreateInstance<SkillFamily>();
			passiveFamily.variants = (Variant[])(object)new Variant[1];
			GenericSkill val2 = body.gameObject.AddComponent<GenericSkill>();
			val2._skillFamily = passiveFamily;
			((Object)val2.skillFamily).name = "MageBodyPassive";
			ContentPacks.skillFamilies.Add(passiveFamily);
			skillLocator.passiveSkill.enabled = false;
			EntityStateMachine[] components2 = body.GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val3 in components2)
			{
				if (val3.customName == "Body")
				{
					val3.mainStateType = new SerializableEntityStateType(typeof(GenericCharacterMain));
				}
			}
			object obj = <>c.<>9__41_0;
			if (obj == null)
			{
				hook_FromSkillSlot val4 = delegate(orig_FromSkillSlot orig, LoadoutPanelController owner, BodyIndex bodyI, int slotI, GenericSkill slot)
				{
					//IL_0003: Unknown result type (might be due to invalid IL or missing references)
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0013: Expected O, but got Unknown
					Row val9 = (Row)orig.Invoke(owner, bodyI, slotI, slot);
					if (((Object)slot.skillFamily).name.Contains("Passive"))
					{
						Transform val10 = ((Transform)val9.rowPanelTransform).Find("SlotLabel") ?? ((Transform)val9.rowPanelTransform).Find("LabelContainer").Find("SlotLabel");
						if (Object.op_Implicit((Object)(object)val10))
						{
							((Component)val10).GetComponent<LanguageTextMeshController>().token = "Misc";
						}
					}
					return val9;
				};
				<>c.<>9__41_0 = val4;
				obj = (object)val4;
			}
			Row.FromSkillSlot += (hook_FromSkillSlot)obj;
			CharacterSelectController.BuildSkillStripDisplayData += (Manipulator)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_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_014f: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val8 = new ILCursor(il);
				int skillIndex = -1;
				int defIndex = -1;
				ILLabel label = val8.DefineLabel();
				if (val8.TryGotoNext(new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref skillIndex),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(GenericSkill).GetField("hideInCharacterSelect")),
					(Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref label)
				}) && skillIndex != -1 && val8.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(Variant).GetField("skillDef")),
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref defIndex)
				}))
				{
					val8.Emit(OpCodes.Ldloc, defIndex);
					val8.EmitDelegate<Func<SkillDef, bool>>((Func<SkillDef, bool>)((SkillDef def) => (Object)(object)def == (Object)(object)passiveFamily.variants[0].skillDef));
					val8.Emit(OpCodes.Brtrue, (object)label);
					if (val8.TryGotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(List<StripDisplayData>).GetMethod("Add"))
					}))
					{
						val8.Remove();
						val8.Emit(OpCodes.Ldloc, skillIndex);
						val8.EmitDelegate<Action<List<StripDisplayData>, StripDisplayData, GenericSkill>>((Action<List<StripDisplayData>, StripDisplayData, GenericSkill>)delegate(List<StripDisplayData> list, StripDisplayData disp, GenericSkill skill)
						{
							//IL_0029: 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)
							if (((Object)skill.skillFamily).name == "MageBodyPassive")
							{
								list.Insert(0, disp);
							}
							else
							{
								list.Add(disp);
							}
						});
					}
				}
			};
			object obj2 = <>c.<>9__41_2;
			if (obj2 == 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
					ILCursor val6 = new ILCursor(il);
					if (val6.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(Row).GetMethod("FromSkillSlot", (BindingFlags)(-1)))
					}))
					{
						val6.EmitDelegate<Func<Row, Row>>((Func<Row, Row>)delegate(Row orig)
						{
							Transform val7 = ((Transform)orig.rowPanelTransform).Find("SlotLabel") ?? ((Transform)orig.rowPanelTransform).Find("LabelContainer").Find("SlotLabel");
							if (Object.op_Implicit((Object)(object)val7) && ((Component)val7).GetComponent<LanguageTextMeshController>().token == "Misc")
							{
								((Transform)orig.rowPanelTransform).SetSiblingIndex(0);
							}
							return orig;
						});
					}
				};
				<>c.<>9__41_2 = val5;
				obj2 = (object)val5;
			}
			LoadoutPanelController.Rebuild += (Manipulator)obj2;
			return val2;
		}

		public void CreateMagePassives(SkillFamily passiveFamily)
		{
			//IL_0093: 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)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Expected O, but got Unknown
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Expected O, but got Unknown
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			PassiveSkillDef passiveSkillDef = ScriptableObject.CreateInstance<PassiveSkillDef>();
			((SkillDef)passiveSkillDef).skillNameToken = mageSkillLocator.passiveSkill.skillNameToken;
			((Object)passiveSkillDef).name = mageSkillLocator.passiveSkill.skillNameToken;
			((SkillDef)passiveSkillDef).skillDescriptionToken = mageSkillLocator.passiveSkill.skillDescriptionToken;
			((SkillDef)passiveSkillDef).icon = mageSkillLocator.passiveSkill.icon;
			((SkillDef)passiveSkillDef).canceledFromSprinting = false;
			((SkillDef)passiveSkillDef).cancelSprintingOnActivation = false;
			passiveSkillDef.stateMachineDefaults = new PassiveSkillDef.StateMachineDefaults[1]
			{
				new PassiveSkillDef.StateMachineDefaults
				{
					machineName = "Body",
					initalState = new SerializableEntityStateType(typeof(MageCharacterMain)),
					mainState = new SerializableEntityStateType(typeof(MageCharacterMain)),
					defaultInitalState = new SerializableEntityStateType(typeof(GenericCharacterMain)),
					defaultMainState = new SerializableEntityStateType(typeof(GenericCharacterMain))
				}
			};
			LanguageAPI.Add("MAGE_PASSIVE_ENERGY_NAME", "Energetic Resonance");
			LanguageAPI.Add("MAGE_PASSIVE_ENERGY_DESC", "- <style=cIsUtility>Incinerate</style> increases in intensity for each <style=cIsDamage>FIRE</style> skill.\n- <style=cIsUtility>Arctic Blasts</style> increase in power for each <style=cIsDamage>ICE</style> skill.\n- <style=cIsUtility>Lightning Bolts</style> are created for each <style=cIsDamage>LIGHTNING</style> skill.");
			LanguageAPI.Add("ARTIFICEREXTENDED_KEYWORD_MELT", "<style=cKeywordName>Incinerate</style><style=cSub><style=cIsUtility>On ANY Cast:</style> Gain a buff that temporarily increases the <style=cIsDamage>burn damage</style> from Ignite by <style=cIsDamage>" + Tools.ConvertDecimal(AltArtiPassive.burnDamageMult) + " per stack.</style>");
			LanguageAPI.Add("ARTIFICEREXTENDED_KEYWORD_ARCTICBLAST", "<style=cKeywordName>Arctic Blast</style><style=cSub><style=cIsUtility>Applying 10 stacks</style> of Chill or <style=cIsUtility>killing Chilled enemies</style> causes an <style=cIsUtility>Arctic Blast,</style> clearing the effect and <style=cIsDamage>Freezing nearby enemies.</style></style>");
			LanguageAPI.Add("ARTIFICEREXTENDED_KEYWORD_BOLTS", "<style=cKeywordName>Lightning Bolts</style><style=cSub><style=cIsUtility>On ANY Cast:</style> Summon spears of energy that <style=cIsUtility>seek out enemies in front of you</style> for <style=cIsDamage>" + Tools.ConvertDecimal(AltArtiPassive.lightningDamageMult) + " damage.</style>");
			PassiveSkillDef passiveSkillDef2 = ScriptableObject.CreateInstance<PassiveSkillDef>();
			((SkillDef)passiveSkillDef2).skillNameToken = "MAGE_PASSIVE_ENERGY_NAME";
			((SkillDef)passiveSkillDef2).skillDescriptionToken = "MAGE_PASSIVE_ENERGY_DESC";
			((SkillDef)passiveSkillDef2).icon = iconBundle.LoadAsset<Sprite>(iconsPath + "ElementalIntensity.png");
			((SkillDef)passiveSkillDef2).canceledFromSprinting = false;
			((SkillDef)passiveSkillDef2).cancelSprintingOnActivation = false;
			passiveSkillDef2.stateMachineDefaults = new PassiveSkillDef.StateMachineDefaults[1]
			{
				new PassiveSkillDef.StateMachineDefaults
				{
					machineName = "Jet",
					initalState = new SerializableEntityStateType(typeof(AltArtiPassive)),
					mainState = new SerializableEntityStateType(typeof(AltArtiPassive)),
					defaultInitalState = new SerializableEntityStateType(typeof(Idle)),
					defaultMainState = new SerializableEntityStateType(typeof(Idle))
				}
			};
			((SkillDef)passiveSkillDef2).keywordTokens = new string[3] { "ARTIFICEREXTENDED_KEYWORD_MELT", "ARTIFICEREXTENDED_KEYWORD_ARCTICBLAST", "ARTIFICEREXTENDED_KEYWORD_BOLTS" };
			Variant[] array = new Variant[2];
			Variant val = new Variant
			{
				skillDef = (SkillDef)(object)passiveSkillDef,
				unlockableName = ""
			};
			((Variant)(ref val)).viewableNode = new Node(((SkillDef)passiveSkillDef).skillNameToken, false, (Node)null);
			array[0] = val;
			val = new Variant
			{
				skillDef = (SkillDef)(object)passiveSkillDef2,
				unlockableDef = passiveSkillDef2.GetUnlockDef(typeof(ArtificerEnergyPassiveUnlock))
			};
			((Variant)(ref val)).viewableNode = new Node(((SkillDef)passiveSkillDef2).skillNameToken, false, (Node)null);
			array[1] = val;
			passiveFamily.variants = (Variant[])(object)array;
			ContentPacks.skillDefs.Add((SkillDef)(object)passiveSkillDef);
			ContentPacks.skillDefs.Add((SkillDef)(object)passiveSkillDef2);
		}

		private void ReplaceSkillDefs(orig_Init orig)
		{
			//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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke();
			SkillDef val = LegacyResourcesAPI.Load<SkillDef>("skilldefs/magebody/MageBodyFlyUp");
			if ((Object)(object)val != (Object)null)
			{
				Debug.Log((object)"Changing ion surge");
				if (SurgeRework.Value)
				{
					SkillBase.RegisterEntityState(typeof(AlternateIonSurge));
					LanguageAPI.Add(SkillBase.Token + "ALTIONSURGE_DESC", "Burst forward up to 3 times. <style=cIsDamage>Can attack while dashing.</style> Trigger again to cancel early.");
					val.activationState = new SerializableEntityStateType(typeof(AlternateIonSurge));
					val.baseRechargeInterval = 6f;
					val.skillDescriptionToken = SkillBase.Token + "ALTIONSURGE_DESC";
					val.keywordTokens = new string[0];
				}
				else
				{
					SkillBase.RegisterEntityState(typeof(VanillaIonSurge));
					val.activationState = new SerializableEntityStateType(typeof(VanillaIonSurge));
				}
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private void ReplaceScepterSkillDefs(orig_Init orig)
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke();
			SkillDef val = LegacyResourcesAPI.Load<SkillDef>("skilldefs/magebody/MageBodyFlyUp");
			if (SurgeRework.Value && (Object)(object)val != (Object)null)
			{
				SkillDef skillDef = SkillCatalog.GetSkillDef(SkillCatalog.FindSkillIndexByName(val.skillName + "Scepter"));
				if ((Object)(object)skillDef != (Object)null)
				{
					SkillBase.RegisterEntityState(typeof(AlternateIonSurge2));
					LanguageAPI.Add(SkillBase.Token + "ALTANTISURGE_LIGHTNING", "Antimatter Surge");
					LanguageAPI.Add(SkillBase.Token + "ALTANTISURGE_DESC", "Burst forward up to 3 times. <style=cIsDamage>Can attack while dashing.</style> Trigger again to cancel early.\n<color=#d299ff>SCEPTER: Each burst reduces ALL cooldowns.</color>");
					skillDef.activationState = new SerializableEntityStateType(typeof(AlternateIonSurge2));
					skillDef.baseRechargeInterval = 6f;
					skillDef.skillDescriptionToken = SkillBase.Token + "ALTANTISURGE_DESC";
					skillDef.skillNameToken = SkillBase.Token + "ALTANTISURGE_LIGHTNING";
					skillDef.keywordTokens = new string[0];
				}
			}
			else
			{
				Debug.LogError((object)"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\nArtificerExtended could not replace Ancient Scepter's Antimatter Surge. Antimatter Surge WILL break Artificer Extended's alt passives. \nEither turn on ArtificerExtended's Ion Surge rework to use ArtificerExtended's Antimatter Surge, avoid using Antimatter Surge with ArtificerExtended's alt passive, or tell the Ancient Scepter developers to get in contact to fix Antimatter Surge. \nThis is NOT an error that can be fixed on the ArtificerExtended side.\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
			}
		}

		private void AddAEBodyFX(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body)
		{
			orig.Invoke(self, body);
			AEBodyEffects aEBodyEffects = ((Component)body).gameObject.AddComponent<AEBodyEffects>();
			aEBodyEffects.body = body;
		}

		private void InitializeConfig()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			CustomConfigFile = new ConfigFile(Paths.ConfigPath + "\\ArtificerExtended.cfg", true);
			AllowBrokenSFX = CustomConfigFile.Bind<bool>("Cosmetic", "Allow Broken SFX", false, "Some SFX (the snapfreeze cast sound, specifically) create an unstoppable droning/ringing sound. \nThey are disabled by default, but if you would like to have SFX and dont mind the bug, then you may enable them.");
			SurgeRework = CustomConfigFile.Bind<bool>("Ion Surge", "Enable Rework", true, "Determines whether Ion Surge gets reworked. Note that vanilla Ion Surge is INCOMPATIBLE with ALL alt-passives. Use at your own risk.");
		}

		private void ArtiChanges()
		{
			LanguageAPI.Add("MAGE_OUTRO_FLAVOR", "..and so she left, her heart fixed on new horizons.");
			GameObject val = LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/MageIcewallPillarProjectile");
			ProjectileImpactExplosion componentInChildren = val.GetComponentInChildren<ProjectileImpactExplosion>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				componentInChildren.destroyOnEnemy = false;
			}
			LanguageAPI.Add("MAGE_UTILITY_ICE_DESCRIPTION", "<style=cIsUtility>Freezing</style>. Create a barrier that hurts enemies for up to <style=cIsDamage>12x100% damage</style>.");
			SkillDef skillDef = mageSpecial.variants[0].skillDef;
			if ((Object)(object)skillDef != (Object)null)
			{
				skillDef.mustKeyPress = true;
			}
		}

		private void InitializeUnlocks()
		{
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(UnlockBase))
				select type;
			MethodInfo method = typeof(UnlockableAPI).GetMethod("AddUnlockable", new Type[1] { typeof(bool) });
			Debug.Log((object)"ARTIFICEREXTENDED Initializing unlocks!:");
			foreach (Type item in enumerable)
			{
				UnlockBase unlockBase = (UnlockBase)Activator.CreateInstance(item);
				Debug.Log((object)item);
				if (!unlockBase.HideUnlock)
				{
					unlockBase.Init(CustomConfigFile);
					UnlockableDef value = (UnlockableDef)method.MakeGenericMethod(item).Invoke(null, new object[1] { true });
					bool flag = unlockBase.ForceDisable;
					if (!flag)
					{
						flag = CustomConfigFile.Bind<bool>("Config: UNLOCKS", "Force Unlock Achievement: " + unlockBase.UnlockName, false, "Force this achievement to unlock: " + unlockBase.UnlockName + "?").Value;
					}
					if (!flag)
					{
						UnlockBaseDictionary.Add(unlockBase, value);
					}
					else
					{
						UnlockBaseDictionary.Add(unlockBase, ScriptableObject.CreateInstance<UnlockableDef>());
					}
				}
			}
		}

		private void InitializeSkills()
		{
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(SkillBase))
				select type;
			foreach (Type item in enumerable)
			{
				SkillBase skillBase = (SkillBase)Activator.CreateInstance(item);
				if (ValidateSkill(skillBase))
				{
					skillBase.Init(CustomConfigFile);
				}
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private void InitializeScepterSkills()
		{
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(ScepterSkillBase))
				select type;
			foreach (Type item in enumerable)
			{
				ScepterSkillBase scepterSkillBase = (ScepterSkillBase)Activator.CreateInstance(item);
				if (ValidateScepterSkill(scepterSkillBase))
				{
					scepterSkillBase.Init(CustomConfigFile);
				}
			}
		}

		private bool ValidateSkill(SkillBase item)
		{
			bool flag = true;
			if (flag)
			{
				Skills.Add(item);
			}
			SkillStatusDictionary.Add(item, flag);
			return flag;
		}

		private bool ValidateScepterSkill(ScepterSkillBase item)
		{
			bool flag = isScepterLoaded;
			if (flag)
			{
				ScepterSkills.Add(item);
			}
			return flag;
		}

		public static SkillDef CloneSkillDef(SkillDef oldDef)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
			val.skillName = oldDef.skillName;
			val.skillNameToken = oldDef.skillNameToken;
			val.skillDescriptionToken = oldDef.skillDescriptionToken;
			val.icon = oldDef.icon;
			val.activationStateMachineName = oldDef.activationStateMachineName;
			val.activationState = oldDef.activationState;
			val.interruptPriority = oldDef.interruptPriority;
			val.baseRechargeInterval = oldDef.baseRechargeInterval;
			val.baseMaxStock = oldDef.baseMaxStock;
			val.rechargeStock = oldDef.rechargeStock;
			val.requiredStock = oldDef.requiredStock;
			val.stockToConsume = oldDef.stockToConsume;
			val.beginSkillCooldownOnSkillEnd = oldDef.beginSkillCooldownOnSkillEnd;
			val.fullRestockOnAssign = oldDef.fullRestockOnAssign;
			val.dontAllowPastMaxStocks = oldDef.dontAllowPastMaxStocks;
			val.resetCooldownTimerOnUse = oldDef.resetCooldownTimerOnUse;
			val.isCombatSkill = oldDef.isCombatSkill;
			val.cancelSprintingOnActivation = oldDef.cancelSprintingOnActivation;
			val.canceledFromSprinting = oldDef.canceledFromSprinting;
			val.forceSprintDuringState = oldDef.forceSprintDuringState;
			val.mustKeyPress = oldDef.mustKeyPress;
			val.keywordTokens = oldDef.keywordTokens;
			return val;
		}

		public void DoHooks()
		{
			AddHooks();
		}

		private void RemoveHooks()
		{
		}

		private void AddHooks()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			FireFireBolt.FireGauntlet += new hook_FireGauntlet(FireFireBolt_FireGauntlet);
			BaseChargeBombState.OnEnter += new hook_OnEnter(BaseChargeBombState_OnEnter);
			BaseChargeBombState.FixedUpdate += new hook_FixedUpdate(BaseChargeBombState_FixedUpdate);
			BaseChargeBombState.OnExit += new hook_OnExit(BaseChargeBombState_OnExit);
			PrepWall.OnEnter += new hook_OnEnter(PrepWall_OnEnter);
			PrepWall.OnExit += new hook_OnExit(PrepWall_OnExit);
			Flamethrower.OnEnter += new hook_OnEnter(Flamethrower_OnEnter);
			Flamethrower.FixedUpdate += new hook_FixedUpdate(Flamethrower_FixedUpdate);
			Flamethrower.OnExit += new hook_OnExit(Flamethrower_OnExit);
			HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
			GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_OnCharacterDeath;
			CharacterMaster.OnBodyStart += new hook_OnBodyStart(CharacterMaster_OnBodyStart);
			ChillRework.OnMaxChill += FrostNovaOnMaxChill;
		}

		private void CharacterMaster_OnBodyStart(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body)
		{
			ElementCounter component = ((Component)body).GetComponent<ElementCounter>();
			if ((Object)(object)component != (Object)null)
			{
				component.GetPowers(body.skillLocator);
			}
			orig.Invoke(self, body);
		}

		private void GlobalEventManager_OnCharacterDeath(DamageReport damageReport)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			CharacterBody attackerBody = damageReport.attackerBody;
			if (damageReport != null && Object.op_Implicit((Object)(object)damageReport.victimBody) && Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)damageReport.victimBody.healthComponent))
			{
				ElementCounter.Power icePowerLevelFromBody = ElementCounter.GetIcePowerLevelFromBody(attackerBody);
				int num = damageReport.victimBody.GetBuffCount(Buffs.Slow80);
				if (num == 0 && (((Enum)damageReport.damageInfo.damageType).HasFlag((Enum)(object)(DamageType)256) || ((Enum)damageReport.damageInfo.damageType).HasFlag((Enum)(object)(DamageType)8)))
				{
					num++;
				}
				if (num > 0 && icePowerLevelFromBody > ElementCounter.Power.None)
				{
					AltArtiPassive.DoNova(attackerBody, icePowerLevelFromBody, ((Component)damageReport.victim).transform.position, num);
				}
			}
		}

		private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_0055: 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)
			if (((Enum)damageInfo.damageType).HasFlag((Enum)(object)(DamageType)256))
			{
				frozenBy[((Component)self).gameObject] = damageInfo.attacker;
			}
			orig.Invoke(self, damageInfo);
			if ((damageInfo.dotIndex != Buffs.burnDot && damageInfo.dotIndex != Buffs.strongBurnDot) || !Object.op_Implicit((Object)(object)damageInfo.attacker))
			{
				return;
			}
			CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			int buffCount = component.GetBuffCount(Buffs.meltBuff);
			if (buffCount >= 0)
			{
				damageInfo.damage *= 1f + AltArtiPassive.burnDamageMult * (float)buffCount;
				if (Util.CheckRoll((float)(buffCount / 15 * 100), component.master))
				{
					EffectManager.SimpleImpactEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/MagmaOrbExplosion"), damageInfo.position, Vector3.up, true);
				}
			}
		}

		private void FrostNovaOnMaxChill(DamageInfo damageInfo, CharacterBody vBody)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody val = null;
			if ((Object)(object)damageInfo.attacker != (Object)null)
			{
				val = damageInfo.attacker.GetComponent<CharacterBody>();
			}
			if ((Object)(object)val != (Object)null)
			{
				ElementCounter.Power icePowerLevelFromBody = ElementCounter.GetIcePowerLevelFromBody(val);
				if (icePowerLevelFromBody > ElementCounter.Power.None)
				{
					vBody.ClearTimedBuffs(Buffs.Slow80);
					AltArtiPassive.DoNova(val, icePowerLevelFromBody, damageInfo.position);
				}
			}
		}

		private void Flamethrower_OnEnter(orig_OnEnter orig, Flamethrower self)
		{
			orig.Invoke(self);
			GameObject gameObject = ((Component)((EntityState)self).outer).gameObject;
			if (AltArtiPassive.instanceLookup.ContainsKey(gameObject))
			{
				AltArtiPassive altArtiPassive = AltArtiPassive.instanceLookup[gameObject];
				FlamethrowerContext value = new FlamethrowerContext(altArtiPassive);
				altArtiPassive.SkillCast();
				flamethrowerContext[self] = value;
			}
		}

		private void Flamethrower_FixedUpdate(orig_FixedUpdate orig, Flamethrower self)
		{
			orig.Invoke(self);
			if (this.flamethrowerContext.ContainsKey(self))
			{
				FlamethrowerContext flamethrowerContext = this.flamethrowerContext[self];
				flamethrowerContext.timer += Time.fixedDeltaTime * flamethrowerContext.passive.ext_attackSpeedStat;
				int num = 0;
				while (flamethrowerContext.timer >= flamethrowerContext.passive.ext_flamethrowerInterval && num <= flamethrowerContext.passive.ext_flamethrowerMaxPerTick)
				{
					flamethrowerContext.passive.SkillCast();
					num++;
					flamethrowerContext.timer -= flamethrowerContext.passive.ext_flamethrowerInterval;
				}
			}
		}

		private void Flamethrower_OnExit(orig_OnExit orig, Flamethrower self)
		{
			orig.Invoke(self);
			if (this.flamethrowerContext.ContainsKey(self))
			{
				FlamethrowerContext flamethrowerContext = this.flamethrowerContext[self];
				flamethrowerContext.passive.SkillCast();
				this.flamethrowerContext.Remove(self);
			}
		}

		private void PrepWall_OnEnter(orig_OnEnter orig, PrepWall self)
		{
			orig.Invoke(self);
			GameObject gameObject = ((Component)((EntityState)self).outer).gameObject;
			if (AltArtiPassive.instanceLookup.ContainsKey(gameObject))
			{
				AltArtiPassive altArtiPassive = AltArtiPassive.instanceLookup[gameObject];
				AltArtiPassive.BatchHandle handle = new AltArtiPassive.BatchHandle();
				altArtiPassive.SkillCast(handle);
				PrepWallContext value = new PrepWallContext(altArtiPassive, handle);
				prepWallContext[self] = value;
			}
		}

		private void PrepWall_OnExit(orig_OnExit orig, PrepWall self)
		{
			orig.Invoke(self);
			if (this.prepWallContext.ContainsKey(self))
			{
				PrepWallContext prepWallContext = this.prepWallContext[self];
				prepWallContext.handle.Fire(prepWallContext.passive.ext_prepWallMinDelay, prepWallContext.passive.ext_prepWallMaxDelay);
				this.prepWallContext.Remove(self);
			}
		}

		private void BaseChargeBombState_OnEnter(orig_OnEnter orig, BaseChargeBombState self)
		{
			orig.Invoke(self);
			GameObject gameObject = ((Component)((EntityState)self).outer).gameObject;
			if (AltArtiPassive.instanceLookup.ContainsKey(gameObject))
			{
				AltArtiPassive altArtiPassive = AltArtiPassive.instanceLookup[gameObject];
				AltArtiPassive.BatchHandle handle = new AltArtiPassive.BatchHandle();
				NanoBombContext value = new NanoBombContext(altArtiPassive, handle);
				nanoBombContext[self] = value;
				altArtiPassive.SkillCast(handle);
			}
		}

		private void BaseChargeBombState_FixedUpdate(orig_FixedUpdate orig, BaseChargeBombState self)
		{
			orig.Invoke(self);
			if (this.nanoBombContext.ContainsKey(self))
			{
				NanoBombContext nanoBombContext = this.nanoBombContext[self];
				nanoBombContext.timer += Time.fixedDeltaTime * nanoBombContext.passive.ext_attackSpeedStat;
				int num = 0;
				while (nanoBombContext.timer >= nanoBombContext.passive.ext_nanoBombInterval && num <= nanoBombContext.passive.ext_nanoBombMaxPerTick)
				{
					num++;
					nanoBombContext.passive.SkillCast(nanoBombContext.handle);
					nanoBombContext.timer -= nanoBombContext.passive.ext_nanoBombInterval;
				}
			}
		}

		private void BaseChargeBombState_OnExit(orig_OnExit orig, BaseChargeBombState self)
		{
			orig.Invoke(self);
			if (this.nanoBombContext.ContainsKey(self))
			{
				NanoBombContext nanoBombContext = this.nanoBombContext[self];
				int num = 0;
				while (nanoBombContext.timer >= nanoBombContext.passive.ext_nanoBombInterval && num <= nanoBombContext.passive.ext_nanoBombMaxPerTick)
				{
					num++;
					nanoBombContext.passive.SkillCast(nanoBombContext.handle);
					nanoBombContext.timer -= nanoBombContext.passive.ext_nanoBombInterval;
				}
				nanoBombContext.handle.Fire(nanoBombContext.passive.ext_nanoBombMinDelay, nanoBombContext.passive.ext_nanoBombMaxDelay);
				this.nanoBombContext.Remove(self);
			}
		}

		private void FireFireBolt_FireGauntlet(orig_FireGauntlet orig, FireFireBolt self)
		{
			orig.Invoke(self);
			GameObject gameObject = ((Component)((EntityState)self).outer).gameObject;
			if (AltArtiPassive.instanceLookup.TryGetValue(gameObject, out var value))
			{
				value.SkillCast();
			}
		}
	}
	public class AEBodyEffects : MonoBehaviour
	{
		public CharacterBody body;

		private TemporaryVisualEffect blizzardArmorTempEffect;

		private void Update()
		{
			UpdateSingleTemporaryVisualEffect(ref blizzardArmorTempEffect, _1FrostbiteSkill.blizzardArmorVFX, body.radius * 0.5f, body.GetBuffCount(_1FrostbiteSkill.artiIceShield) + body.GetBuffCount(FrostbiteSkill2.artiIceShield));
		}

		private void UpdateSingleTemporaryVisualEffect(ref TemporaryVisualEffect tempEffect, GameObject obj, float effectRadius, int count, string childLocatorOverride = "")
		{
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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)
			bool flag = (Object)(object)tempEffect != (Object)null;
			if (flag == count > 0)
			{
				return;
			}
			if (count > 0)
			{
				if (flag)
				{
					return;
				}
				GameObject val = Object.Instantiate<GameObject>(obj, body.corePosition, Quaternion.identity);
				tempEffect = val.GetComponent<TemporaryVisualEffect>();
				tempEffect.parentTransform = body.coreTransform;
				tempEffect.visualState = (VisualState)0;
				tempEffect.healthComponent = body.healthComponent;
				tempEffect.radius = effectRadius;
				LocalCameraEffect component = val.GetComponent<LocalCameraEffect>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.targetCharacter = ((Component)this).gameObject;
				}
				if (string.IsNullOrEmpty(childLocatorOverride))
				{
					return;
				}
				ModelLocator modelLocator = body.modelLocator;
				ChildLocator val2;
				if ((Object)(object)modelLocator == (Object)null)
				{
					val2 = null;
				}
				else
				{
					Transform modelTransform = modelLocator.modelTransform;
					val2 = (((Object)(object)modelTransform != (Object)null) ? ((Component)modelTransform).GetComponent<ChildLocator>() : null);
				}
				ChildLocator val3 = val2;
				if (Object.op_Implicit((Object)(object)val3))
				{
					Transform val4 = val3.FindChild(childLocatorOverride);
					if (Object.op_Implicit((Object)(object)val4))
					{
						tempEffect.parentTransform = val4;
					}
				}
			}
			else if (Object.op_Implicit((Object)(object)tempEffect))
			{
				tempEffect.visualState = (VisualState)1;
			}
		}
	}
	internal class ContentPacks : IContentPackProvider
	{
		public static List<SkillFamily> skillFamilies = new List<SkillFamily>();

		public static List<SkillDef> skillDefs = new List<SkillDef>();

		public static List<GameObject> projectilePrefabs = new List<GameObject>();

		public static List<GameObject> networkedObjectPrefabs = new List<GameObject>();

		public static List<BuffDef> buffDefs = new List<BuffDef>();

		public static List<EffectDef> effectDefs = new List<EffectDef>();

		internal ContentPack contentPack = new ContentPack();

		public string identifier => "ArtificerExtended";

		public void Initialize()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
		}

		private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
		{
			addContentPackProvider.Invoke((IContentPackProvider)(object)this);
		}

		public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
		{
			contentPack.identifier = identifier;
			contentPack.buffDefs.Add(buffDefs.ToArray());
			contentPack.effectDefs.Add(effectDefs.ToArray());
			contentPack.entityStateTypes.Add(ArtificerExtendedPlugin.entityStates.ToArray());
			contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray());
			contentPack.skillDefs.Add(skillDefs.ToArray());
			contentPack.skillFamilies.Add(skillFamilies.ToArray());
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
		{
			ContentPack.Copy(contentPack, args.output);
			args.ReportProgress(1f);
			yield break;
		}

		public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
		{
			args.ReportProgress(1f);
			yield break;
		}
	}
	public static class Tools
	{
		public static string modPrefix = string.Format("@{0}+{1}", "ArtificerExtended", "artiskillicons");

		public static AssetBundle LoadAssetBundle(byte[] resourceBytes)
		{
			if (resourceBytes == null)
			{
				throw new ArgumentNullException("resourceBytes");
			}
			return AssetBundle.LoadFromMemory(resourceBytes);
		}

		public static string GetModPrefix(this BaseUnityPlugin plugin, string bundleName)
		{
			return $"@{plugin.Info.Metadata.Name}+{bundleName}";
		}

		public static string ConvertDecimal(float f)
		{
			return f * 100f + "%";
		}

		internal static bool isLoaded(string modguid)
		{
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				string key = pluginInfo.Key;
				PluginInfo value = pluginInfo.Value;
				if (key == modguid)
				{
					return true;
				}
			}
			return false;
		}

		internal static void GetMaterial(GameObject model, string childObject, Color color, ref Material material, float scaleMultiplier = 1f, bool replaceAll = false)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>();
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				Renderer val2 = val;
				if (string.Equals(((Object)val).name, childObject))
				{
					if (color == Color.clear)
					{
						Object.Destroy((Object)(object)val);
						break;
					}
					if ((Object)(object)material == (Object)null)
					{
						material = new Material(val.material);
						material.mainTexture = val.material.mainTexture;
						material.shader = val.material.shader;
						material.color = color;
					}
					val.material = material;
					Transform transform = ((Component)val).transform;
					transform.localScale *= scaleMultiplier;
					if (!replaceAll)
					{
						break;
					}
				}
			}
		}

		internal static void DebugMaterial(GameObject model)
		{
			Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>();
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				Renderer val2 = val;
				Debug.Log((object)("Material: " + ((Object)val2).name.ToString()));
			}
		}

		internal static void GetParticle(GameObject model, string childObject, Color color, float sizeMultiplier = 1f, bool replaceAll = false)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem[] componentsInChildren = model.GetComponentsInChildren<ParticleSystem>();
			ParticleSystem[] array = componentsInChildren;
			foreach (ParticleSystem val in array)
			{
				ParticleSystem val2 = val;
				MainModule main = val2.main;
				ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
				ColorBySpeedModule colorBySpeed = val2.colorBySpeed;
				if (string.Equals(((Object)val2).name, childObject))
				{
					((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color);
					((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * sizeMultiplier;
					((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(color);
					((ColorBySpeedModule)(ref colorBySpeed)).color = MinMaxGradient.op_Implicit(color);
					if (!replaceAll)
					{
						break;
					}
				}
			}
		}

		internal static void DebugParticleSystem(GameObject model)
		{
			ParticleSystem[] componentsInChildren = model.GetComponentsInChildren<ParticleSystem>();
			ParticleSystem[] array = componentsInChildren;
			foreach (ParticleSystem val in array)
			{
				ParticleSystem val2 = val;
				Debug.Log((object)("Particle: " + ((Object)val2).name.ToString()));
			}
		}

		internal static void GetLight(GameObject model, string childObject, Color color, bool replaceAll = false)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Light[] componentsInChildren = model.GetComponentsInChildren<Light>();
			Light[] array = componentsInChildren;
			foreach (Light val in array)
			{
				Light val2 = val;
				if (string.Equals(((Object)val2).name, childObject))
				{
					val2.color = color;
					if (!replaceAll)
					{
						break;
					}
				}
			}
		}

		internal static void DebugLight(GameObject model)
		{
			Light[] componentsInChildren = model.GetComponentsInChildren<Light>();
			Light[] array = componentsInChildren;
			foreach (Light val in array)
			{
				Light val2 = val;
				Debug.Log((object)("Light: " + ((Object)val2).name.ToString()));
			}
		}
	}
	public static class VRStuff
	{
		public static bool VRInstalled;

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void SetupVR()
		{
			if (Chainloader.PluginInfos.ContainsKey("com.DrBibop.VRAPI"))
			{
				VRInstalled = VR.enabled && MotionControls.enabled;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static Ray GetVRHandAimRay(bool dominant)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: 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 dominant ? MotionControls.dominantHand.aimRay : MotionControls.nonDominantHand.aimRay;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AnimateVRHand(bool dominant, string triggerName)
		{
			HandController val = (dominant ? MotionControls.dominantHand : MotionControls.nonDominantHand);
			val.animator.SetTrigger(triggerName);
		}
	}
}
namespace ArtificerExtended.Unlocks
{
	internal class ArtificerColdFusionUnlock : UnlockBase
	{
		public ulong killRequirementTotal = 5uL;

		public StatDef postmortemKillCounter = UnlockBase.GetCareerStatTotal("artificerKillsPostMortem");

		public override string UnlockLangTokenName => "COLDFUSION";

		public override string UnlockName => "When Icicles Die...";

		public override string AchievementName => "When Icicles Die...";

		public override string AchievementDesc => $"kill {killRequirementTotal} enemies post-mortem.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("ColdFusion");

		public override bool HideUnlock => true;

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

		public override void OnInstall()
		{
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			((ModdedUnlockable)this).OnUninstall();
		}

		private void ColdFusionKillCounter(DamageReport damageReport)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_004e: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Invalid comparison between Unknown and I4
			BodyIndex attackerBodyIndex = damageReport.attackerBodyIndex;
			CharacterMaster attackerMaster = damageReport.attackerMaster;
			string? text = ((object)(BodyIndex)(ref attackerBodyIndex)).ToString();
			BodyIndex val = ((BaseAchievement)this).LookUpRequiredBodyIndex();
			Debug.Log((object)(text + " + " + ((object)(BodyIndex)(ref val)).ToString()));
			if (!Object.op_Implicit((Object)(object)attackerMaster) || (attackerBodyIndex != ((BaseAchievement)this).LookUpRequiredBodyIndex() && (int)attackerBodyIndex != -1))
			{
				return;
			}
			CharacterBody attackerBody = damageReport.attackerBody;
			if ((Object)(object)attackerBody == (Object)null || !attackerBody.healthComponent.alive)
			{
				StatSheet currentStats = attackerMaster.playerStatsComponent.currentStats;
				currentStats.PushStatValue(postmortemKillCounter, 1uL);
				ulong statValueULong = ((BaseAchievement)this).userProfile.statSheet.GetStatValueULong(postmortemKillCounter);
				Debug.Log((object)statValueULong);
				if (statValueULong >= killRequirementTotal)
				{
					((BaseAchievement)this).Grant();
				}
			}
		}
	}
	internal class ArtificerEnergyPassiveUnlock : UnlockBase
	{
		public override string UnlockLangTokenName => "ENERGYPASSIVE";

		public override string UnlockName => "Elemental Intensity";

		public override string AchievementName => "Elemental Intensity";

		public override string AchievementDesc => "equip 4 abilities of a single element at once.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("ElementalIntensity");

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

		public override void OnInstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			MageCharacterMain.OnEnter += new hook_OnEnter(PowerCheck);
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			MageCharacterMain.OnEnter -= new hook_OnEnter(PowerCheck);
			((ModdedUnlockable)this).OnUninstall();
		}

		private void PowerCheck(orig_OnEnter orig, MageCharacterMain self)
		{
			orig.Invoke(self);
			CharacterBody characterBody = ((EntityState)self).characterBody;
			ElementCounter elementCounter = ((characterBody != null) ? ((Component)characterBody).GetComponent<ElementCounter>() : null);
			if ((Object)(object)elementCounter != (Object)null && (elementCounter.firePower >= ElementCounter.Power.Extreme || elementCounter.icePower >= ElementCounter.Power.Extreme || elementCounter.lightningPower >= ElementCounter.Power.Extreme))
			{
				((BaseAchievement)this).Grant();
			}
		}
	}
	internal class ArtificerExtendedSkinUnlock : UnlockBase
	{
		private static readonly int requirement = 10;

		private List<SceneDef> visitedScenes;

		public override bool HideUnlock => true;

		public override bool ForceDisable => true;

		public override string UnlockLangTokenName => "ARTIEXTENDED";

		public override string UnlockName => "...To Explore";

		public override string AchievementName => "...To Explore";

		public override string AchievementDesc => "visit all but 2 stages in a single run, and win.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("");

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

		public override void OnBodyRequirementMet()
		{
			((ModdedUnlockable)this).OnBodyRequirementMet();
			visitedScenes = CollectionPool<SceneDef, List<SceneDef>>.RentCollection();
			SceneCatalog.onMostRecentSceneDefChanged += HandleMostRecentSceneDefChanged;
		}

		public override void OnBodyRequirementBroken()
		{
			SceneCatalog.onMostRecentSceneDefChanged -= HandleMostRecentSceneDefChanged;
			visitedScenes = CollectionPool<SceneDef, List<SceneDef>>.ReturnCollection(visitedScenes);
			((ModdedUnlockable)this).OnBodyRequirementBroken();
		}

		private void HandleMostRecentSceneDefChanged(SceneDef newSceneDef)
		{
			if (!visitedScenes.Contains(newSceneDef))
			{
				visitedScenes.Add(newSceneDef);
			}
		}

		public void ClearCheck(Run run, RunReport runReport)
		{
		}

		public override void OnInstall()
		{
			((ModdedUnlockable)this).OnInstall();
			Run.onClientGameOverGlobal += ClearCheck;
		}

		public override void OnUninstall()
		{
			((ModdedUnlockable)this).OnUninstall();
			Run.onClientGameOverGlobal -= ClearCheck;
		}
	}
	internal class ArtificerFlameBurstUnlock : UnlockBase
	{
		public int burnRequirementTotal = 15;

		public int burnCounter = 0;

		public override string UnlockLangTokenName => "FLAMEBURST";

		public override string UnlockName => "To Fight Fire";

		public override string AchievementName => "To Fight Fire";

		public override string AchievementDesc => $"kill {burnRequirementTotal} Blazing Elites with burn damage in a single run.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("Fireskill2icon");

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

		public override void OnInstall()
		{
			GlobalEventManager.onCharacterDeathGlobal += AddBurnCounter;
			Run.onRunStartGlobal += ResetBurnCounter;
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			GlobalEventManager.onCharacterDeathGlobal -= AddBurnCounter;
			Run.onRunStartGlobal -= ResetBurnCounter;
			((ModdedUnlockable)this).OnUninstall();
		}

		private void ResetBurnCounter(Run obj)
		{
			burnCounter = 0;
		}

		private void AddBurnCounter(DamageReport obj)
		{
			//IL_0029: 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_0056: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Invalid comparison between Unknown and I4
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Invalid comparison between Unknown and I4
			CharacterBody attackerBody = obj.attackerBody;
			CharacterBody victimBody = obj.victimBody;
			if (!Object.op_Implicit((Object)(object)attackerBody) || !Object.op_Implicit((Object)(object)victimBody) || attackerBody.bodyIndex != ((BaseAchievement)this).LookUpRequiredBodyIndex() || !victimBody.HasBuff(Buffs.AffixRed))
			{
				return;
			}
			DamageInfo damageInfo = obj.damageInfo;
			bool flag = ((Enum)damageInfo.damageType).HasFlag((Enum)(object)(DamageType)128) || ((Enum)damageInfo.damageType).HasFlag((Enum)(object)(DamageType)8192);
			bool flag2 = (int)damageInfo.dotIndex == 1 || (int)damageInfo.dotIndex == 3 || (int)damageInfo.dotIndex == 7;
			if (flag || flag2)
			{
				burnCounter++;
				if (burnCounter >= burnRequirementTotal)
				{
					((BaseAchievement)this).Grant();
				}
			}
		}
	}
	internal class ArtificerFrostbiteUnlock : UnlockBase
	{
		public override string UnlockLangTokenName => "FROSTBITE";

		public override string UnlockName => "Absolute Zero";

		public override string AchievementName => "Absolute Zero";

		public override string AchievementDesc => "freeze and execute the King of Nothing.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("frostbitesketch1");

		private void ExecuteMithrixCheck(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			CharacterBody body = self.body;
			BodyIndex bodyIndex = body.bodyIndex;
			if ((bodyIndex == BodyCatalog.FindBodyIndex("BrotherBody") || bodyIndex == BodyCatalog.FindBodyIndex("BrotherGlassBody") || bodyIndex == BodyCatalog.FindBodyIndex("BrotherHauntBody") || bodyIndex == BodyCatalog.FindBodyIndex("BrotherHurtBody")) && self.isInFrozenState)
			{
				flag = true;
			}
			orig.Invoke(self, damageInfo);
			if (!flag || self.alive)
			{
				return;
			}
			GameObject attacker = damageInfo.attacker;
			CharacterBody val = ((attacker != null) ? attacker.GetComponent<CharacterBody>() : null);
			if ((Object)(object)val != (Object)null)
			{
				BodyIndex bodyIndex2 = val.bodyIndex;
				if (bodyIndex2 == ((BaseAchievement)this).LookUpRequiredBodyIndex())
				{
					((BaseAchievement)this).Grant();
				}
			}
		}

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

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

		public override void OnUninstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			HealthComponent.TakeDamage -= new hook_TakeDamage(ExecuteMithrixCheck);
			((ModdedUnlockable)this).OnUninstall();
		}
	}
	internal class ArtificerIceShardsUnlock : UnlockBase
	{
		public static float timeRequirement = 600f;

		public override bool ForceDisable => false;

		public override string UnlockLangTokenName => "ICESHARDS";

		public override string UnlockName => "Flawless Execution";

		public override string AchievementName => "Flawless Execution";

		public override string AchievementDesc => "fully charge the third teleporter before the timer reaches 10 minutes.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("IceShardsIcon");

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

		public override void OnInstall()
		{
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			((ModdedUnlockable)this).OnUninstall();
		}

		private void OnTeleporterChargedGlobal(TeleporterInteraction teleporterInteraction)
		{
			if (Run.instance.GetRunStopwatch() < timeRequirement && Run.instance.stageClearCount == 2 && ((BaseAchievement)this).isUserAlive)
			{
				((BaseAchievement)this).Grant();
			}
		}

		public override void OnBodyRequirementMet()
		{
			TeleporterInteraction.onTeleporterChargedGlobal += OnTeleporterChargedGlobal;
			((ModdedUnlockable)this).OnBodyRequirementMet();
		}

		public override void OnBodyRequirementBroken()
		{
			TeleporterInteraction.onTeleporterChargedGlobal -= OnTeleporterChargedGlobal;
			((ModdedUnlockable)this).OnBodyRequirementBroken();
		}
	}
	internal class ArtificerLaserUnlock : UnlockBase
	{
		public ulong stunRequirementTotal = 100uL;

		public StatDef stunCounter = UnlockBase.GetCareerStatTotal("artificerTotalEnemiesStunned");

		public override string UnlockLangTokenName => "LASERBOLTCAREER";

		public override string UnlockName => "Stunning Precision";

		public override string AchievementName => "Stunning Precision";

		public override string AchievementDesc => $"stun {stunRequirementTotal} enemies.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("LaserboltIcon");

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

		public override void OnInstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			SetStateOnHurt.OnTakeDamageServer += new hook_OnTakeDamageServer(AddStunCounter);
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			SetStateOnHurt.OnTakeDamageServer -= new hook_OnTakeDamageServer(AddStunCounter);
			((ModdedUnlockable)this).OnUninstall();
		}

		private void AddStunCounter(orig_OnTakeDamageServer orig, SetStateOnHurt self, DamageReport damageReport)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			DamageInfo damageInfo = damageReport.damageInfo;
			if (damageInfo.procCoefficient > 0f && damageReport.attackerBodyIndex == ((BaseAchievement)this).LookUpRequiredBodyIndex())
			{
				HealthComponent val = self.targetStateMachine?.commonComponents.healthComponent;
				bool flag = false;
				if ((Object)(object)val != (Object)null && val.isInFrozenState)
				{
					flag = true;
				}
				if (self.canBeStunned && !flag && ((Enum)damageInfo.damageType).HasFlag((Enum)(object)(DamageType)32))
				{
					StatSheet val2 = damageReport.attackerMaster.playerStatsComponent?.currentStats;
					if (val2 != null)
					{
						val2.PushStatValue(stunCounter, 1uL);
						if (((BaseAchievement)this).userProfile.statSheet.GetStatValueULong(stunCounter) >= stunRequirementTotal)
						{
							((BaseAchievement)this).Grant();
						}
					}
				}
			}
			orig.Invoke(self, damageReport);
		}
	}
	internal class ArtificerMeteorUnlock : UnlockBase
	{
		private GameObject meteorGameObject = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/MeteorStorm");

		public override string UnlockLangTokenName => "METEOR";

		public override string UnlockName => "Cloudy, With A Chance Of...";

		public override string AchievementName => "Cloudy, With A Chance Of...";

		public override string AchievementDesc => "kill yourself with a Glowing Meteorite.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("meteoricon");

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

		public override void OnInstall()
		{
			GlobalEventManager.onCharacterDeathGlobal += MeteorCheck;
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			GlobalEventManager.onCharacterDeathGlobal -= MeteorCheck;
			((ModdedUnlockable)this).OnUninstall();
		}

		private void MeteorCheck(DamageReport obj)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody attackerBody = obj.attackerBody;
			CharacterBody victimBody = obj.victimBody;
			if ((Object)(object)attackerBody == (Object)(object)victimBody && attackerBody.bodyIndex == ((BaseAchievement)this).LookUpRequiredBodyIndex())
			{
				GameObject inflictor = obj.damageInfo.inflictor;
				MeteorStormController component = inflictor.GetComponent<MeteorStormController>();
				if ((Object)(object)component != (Object)null)
				{
					((BaseAchievement)this).Grant();
				}
			}
		}
	}
	internal class ArtificerNapalmUnlock : UnlockBase
	{
		public int burnRequirementTotal = 25;

		public override string UnlockLangTokenName => "NAPALM";

		public override string UnlockName => "Meltdown";

		public override string AchievementName => "Meltdown";

		public override string AchievementDesc => $"apply {burnRequirementTotal} stacks of burn to a single target.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("napalmicon");

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

		public override void OnInstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(CountBurn);
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			GlobalEventManager.OnHitEnemy -= new hook_OnHitEnemy(CountBurn);
			((ModdedUnlockable)this).OnUninstall();
		}

		private void CountBurn(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			if (damageInfo.procCoefficient == 0f || damageInfo.rejected || !NetworkServer.active)
			{
				return;
			}
			CharacterBody component = victim.GetComponent<CharacterBody>();
			CharacterBody val = null;
			if ((Object)(object)damageInfo.attacker != (Object)null)
			{
				val = damageInfo.attacker.GetComponent<CharacterBody>();
			}
			if ((Object)(object)component != (Object)null && (Object)(object)val != (Object)null && val.bodyIndex == ((BaseAchievement)this).LookUpRequiredBodyIndex())
			{
				int num = component.GetBuffCount(Buffs.OnFire) + component.GetBuffCount(Buffs.StrongerBurn) + 1;
				if (num >= burnRequirementTotal)
				{
					((BaseAchievement)this).Grant();
				}
			}
			orig.Invoke(self, damageInfo, victim);
		}
	}
	internal class ArtificerShockwaveUnlock : UnlockBase
	{
		private float overkillAmount = 1f;

		public override string UnlockLangTokenName => "SHOCKWAVE";

		public override string UnlockName => "Nuked!";

		public override string AchievementName => "Nuked!";

		public override string AchievementDesc => $"overkill an Overloading Elite enemy by more than {overkillAmount * 100f}% of it's Combined Maximum Health.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("shockwaveicon");

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

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

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

		private void OverkillCheck(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_006d: 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)
			CharacterBody body = self.body;
			bool flag = body.HasBuff(Buffs.AffixBlue);
			float combinedHealth = self.combinedHealth;
			float fullHealth = self.fullHealth;
			orig.Invoke(self, damageInfo);
			if (!(!self.alive && flag))
			{
				return;
			}
			CharacterBody val = null;
			if ((Object)(object)damageInfo.attacker != (Object)null)
			{
				val = damageInfo.attacker.GetComponent<CharacterBody>();
			}
			if ((Object)(object)val != (Object)null && val.bodyIndex == ((BaseAchievement)this).LookUpRequiredBodyIndex())
			{
				float num = damageInfo.damage - combinedHealth;
				if (num > fullHealth * overkillAmount)
				{
					((BaseAchievement)this).Grant();
				}
			}
		}
	}
	internal class ArtificerSnowballUnlock : UnlockBase
	{
		public int freezeRequirementTotal = 20;

		public int freezeCounter = 0;

		public override string UnlockLangTokenName => "SNOWBALL";

		public override string UnlockName => "Freeze Tag!";

		public override string AchievementName => "Freeze Tag!";

		public override string AchievementDesc => $"freeze Glacial Elites {freezeRequirementTotal} times in a single run.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("SnowballIcon");

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

		public override void OnInstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			SetStateOnHurt.OnTakeDamageServer += new hook_OnTakeDamageServer(AddFreezeCounter);
			Run.onRunStartGlobal += ResetFreezeCounter;
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			SetStateOnHurt.OnTakeDamageServer -= new hook_OnTakeDamageServer(AddFreezeCounter);
			Run.onRunStartGlobal -= ResetFreezeCounter;
			((ModdedUnlockable)this).OnUninstall();
		}

		private void ResetFreezeCounter(Run obj)
		{
			freezeCounter = 0;
		}

		private void AddFreezeCounter(orig_OnTakeDamageServer orig, SetStateOnHurt self, DamageReport damageReport)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_0050: Invalid comparison between Unknown and I4
			DamageInfo damageInfo = damageReport.damageInfo;
			if (damageReport.attackerBodyIndex == ((BaseAchievement)this).LookUpRequiredBodyIndex() && damageReport.victimBody.HasBuff(Buffs.AffixWhite) && damageInfo.procCoefficient > 0f && self.canBeFrozen && (damageInfo.damageType & 0x100) > 0)
			{
				freezeCounter++;
				if (freezeCounter >= freezeRequirementTotal)
				{
					((BaseAchievement)this).Grant();
				}
			}
			orig.Invoke(self, damageReport);
		}
	}
	internal class ArtificerTempDropUnlock : UnlockBase
	{
		public int freezeRequirementTotal = 4;

		private static BuffDef AvalancheBuff;

		public override string UnlockLangTokenName => "TEMPDROP";

		public override string UnlockName => "Avalanche!";

		public override string AchievementName => "Avalanche!";

		public override string AchievementDesc => $"have {freezeRequirementTotal} monsters frozen at once.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("AvalancheIcon");

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

		private static void CreateBuff(orig_Init orig)
		{
			//IL_0036: 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)
			orig.Invoke();
			AvalancheBuff = Buffs.OnFire;
			BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
			((Object)val).name = "avalancheUnlockTracker";
			val.iconSprite = LegacyResourcesAPI.Load<Sprite>("textures/bufficons/texBuffGenericShield");
			val.buffColor = Color.red;
			val.canStack = true;
			val.isDebuff = false;
		}

		private void AddFreezeCounter(orig_OnTakeDamageServer orig, SetStateOnHurt self, DamageReport damageReport)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			if (damageReport != null && Object.op_Implicit((Object)(object)self.targetStateMachine) && self.spawnedOverNetwork)
			{
				DamageInfo damageInfo = damageReport.damageInfo;
				if (damageReport.attackerBodyIndex == ((BaseAchievement)this).LookUpRequiredBodyIndex())
				{
					HealthComponent val = self.targetStateMachine?.commonComponents.healthComponent;
					bool flag = false;
					if ((Object)(object)val != (Object)null)
					{
						flag = val.isInFrozenState;
					}
					if (damageInfo.procCoefficient > 0f && self.canBeFrozen && !flag && (damageInfo.damageType & 0x100) != 0 && (Object)(object)damageReport.attackerBody != (Object)null)
					{
						Debug.Log((object)((Object)damageReport.attackerBody).name);
						damageReport.attackerBody.AddTimedBuffAuthority(Buffs.OnFire.buffIndex, 2f * damageInfo.procCoefficient);
						int buffCount = damageReport.attackerBody.GetBuffCount(Buffs.OnFire);
						if (buffCount >= freezeRequirementTotal)
						{
							((BaseAchievement)this).Grant();
						}
					}
				}
			}
			orig.Invoke(self, damageReport);
		}

		public override void OnInstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			BuffCatalog.Init += new hook_Init(CreateBuff);
			SetStateOnHurt.OnTakeDamageServer += new hook_OnTakeDamageServer(AddFreezeCounter);
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			BuffCatalog.Init -= new hook_Init(CreateBuff);
			SetStateOnHurt.OnTakeDamageServer -= new hook_OnTakeDamageServer(AddFreezeCounter);
			((ModdedUnlockable)this).OnUninstall();
		}
	}
	internal class ArtificerThunderUnlock : UnlockBase
	{
		public override string UnlockLangTokenName => "THUNDER";

		public override string UnlockName => "Ugorn’s Music";

		public override string AchievementName => "Ugorn’s Music";

		public override string AchievementDesc => "land the killing blow on an Imp Overlord with a powerful lightning strike.";

		public override string PrerequisiteUnlockableIdentifier => "FreeMage";

		public override Sprite Sprite => GetSpriteProvider("thundericon");

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

		public override void OnInstall()
		{
			GlobalEventManager.onCharacterDeathGlobal += ImpBossSmiteCheck;
			((ModdedUnlockable)this).OnInstall();
		}

		public override void OnUninstall()
		{
			GlobalEventManager.onCharacterDeathGlobal -= ImpBossSmiteCheck;
			((ModdedUnlockable)this).OnUninstall();
		}

		private void ImpBossSmiteCheck(DamageReport obj)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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)
			CharacterBody attackerBody = obj.attackerBody;
			CharacterBody victimBody = obj.victimBody;
			DamageInfo damageInfo = obj.damageInfo;
			if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)victimBody) && damageInfo != null)
			{
				bool flag = victimBody.bodyIndex == BodyCatalog.FindBodyIndex("ImpBossBody");
				if (attackerBody.bodyIndex == ((BaseAchievement)this).LookUpRequiredBodyIndex() && flag && (damageInfo.force == Vector3.down * 1500f || (damageInfo.force == Vector3.down * 3000f && ((Enum)damageInfo.damageType).HasFlag((Enum)(object)(DamageType)32))) && (Object)(object)damageInfo.inflictor == (Object)null)
				{
					((BaseAchievement)this).Grant();
				}
			}
		}
	}
	public abstract class UnlockBase<T> : UnlockBase where T : UnlockBase<T>
	{
		public static T instance { get; private set; }

		public UnlockBase()
		{
			if (instance != null)
			{
				throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting UnlockBase was instantiated twice");
			}
			instance = this as T;
		}
	}
	public abstract class UnlockBase : ModdedUnlockable
	{
		public static string Token = ArtificerExtendedPlugin.TokenName + "UNLOCK_";

		public abstract string UnlockLangTokenName { get; }

		public abstract string UnlockName { get; }

		public abstract string AchievementName { get; }

		public abstract string AchievementDesc { get; }

		public virtual bool ForceDisable => false;

		public override string AchievementIdentifier => Token + UnlockLangTokenName + "_ACHIEVEMENT_ID";

		public override string UnlockableIdentifier => Token + UnlockLangTokenName + "_REWARD_ID";

		public override string AchievementNameToken => Token + UnlockLangTokenName + "_ACHIEVEMENT_NAME";

		public override string AchievementDescToken => Token + UnlockLangTokenName + "_ACHIEVEMENT_DESC";

		public override string UnlockableNameToken => Token + UnlockLangTokenName + "_UNLOCKABLE_NAME";

		public virtual bool HideUnlock => false;

		public override Func<string> GetHowToUnlock => () => Language.GetStringFormatted("UNLOCK_VIA_ACHIEVEMENT_FORMAT", new object[2]
		{
			Language.GetString(((ModdedUnlockable)this).AchievementNameToken),
			Language.GetString(((ModdedUnlockable)this).AchievementDescToken)
		});

		public override Func<string> GetUnlocked => () => Language.GetStringFormatted("UNLOCKED_FORMAT", new object[2]
		{
			Language.GetString(((ModdedUnlockable)this).AchievementNameToken),
			Language.GetString(((ModdedUnlockable)this).AchievementDescToken)
		});

		internal Sprite GetSpriteProvider(string iconName)
		{
			return ArtificerExtendedPlugin.iconBundle.LoadAsset<Sprite>(ArtificerExtendedPlugin.iconsPath + iconName + ".png");
		}

		public override BodyIndex LookUpRequiredBodyIndex()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return BodyCatalog.FindBodyIndex("MageBody");
		}

		public abstract void Init(ConfigFile config);

		protected void CreateLang()
		{
			LanguageAPI.Add(((ModdedUnlockable)this).AchievementNameToken, "Artificer: " + AchievementName);
			LanguageAPI.Add(((ModdedUnlockable)this).AchievementDescToken, "As Artificer, " + AchievementDesc);
			LanguageAPI.Add(((ModdedUnlockable)this).UnlockableNameToken, "Artificer: " + UnlockName);
		}

		public static StatDef GetCareerStatTotal(string name)
		{
			StatDef val = StatDef.Find(name);
			if (val == null)
			{
				val = StatDef.Register(name, (StatRecordType)0, (StatDataType)0, 0.0, (DisplayValueFormatterDelegate)null);
			}
			return val;
		}
	}
}
namespace ArtificerExtended.Skills
{
	internal class _1IceShardsSkill : SkillBase
	{
		public static GameObject tracerShotgun;

		public static GameObject tracerBuckshot;

		private float totalShards = FireIceShard.bulletCountBuckshot + FireIceShard.bulletCountPoint + FireIceShard.bulletCountSpread;

		public override string SkillName => "Ice Shards";

		public override string SkillDescription => "Fire a blast of ice shards for " + $"<style=cIsDamage>up to {totalShards}x{Tools.ConvertDecimal(FireIceShard.damageCoefficient / totalShards)} damage</style> total, " + "which <style=cIsUtility>Chills</style> enemies. Hold up to 4.";

		public override string SkillLangTokenName => "ICESHARDS";

		public override UnlockableDef UnlockDef => GetUnlockDef(typeof(ArtificerIceShardsUnlock));

		public override string IconName => "IceShardsIcon";

		public override MageElement Element => (MageElement)2;

		public override Type ActivationState => typeof(FireIceShard);

		public override SkillFamily SkillSlot => ArtificerExtendedPlugin.magePrimary;

		public override SimpleSkillData SkillData => new SimpleSkillData(4, 1.3f, beginSkillCooldownOnSkillEnd: false, canceledFromSprinting: false, cancelSprintingOnActivation: true, dontAllowPastMaxStocks: true, fullRestockOnAssign: true, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: false, (!ArtificerExtendedPlugin.isRiskyModLoaded) ? 1 : 0);

		public override bool useSteppedDef { get; set; } = true;


		public override void Hooks()
		{
		}

		private void CreateTracerEffects()
		{
			//IL_0054: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			tracerShotgun = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/effects/tracers/TracerCommandoShotgun"), "tracerMageIceShard", false);
			Tracer component = tracerShotgun.GetComponent<Tracer>();
			component.speed = 100f;
			component.length = 3f;
			component.beamDensity = 5f;
			VFXAttributes val = tracerShotgun.AddComponent<VFXAttributes>();
			val.vfxPriority = (VFXPriority)1;
			val.vfxIntensity = (VFXIntensity)1;
			tracerBuckshot = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/effects/tracers/TracerCommandoShotgun"), "tracerMageIceShardBuckshot", false);
			Tracer component2 = tracerBuckshot.GetComponent<Tracer>();
			component2.speed = 60f;
			component2.length = 2f;
			component2.beamDensity = 3f;
			VFXAttributes val2 = tracerBuckshot.AddComponent<VFXAttributes>();
			val2.vfxPriority = (VFXPriority)1;
			val2.vfxIntensity = (VFXIntensity)1;
			Effects.CreateEffect(tracerShotgun);
			Effects.CreateEffect(tracerBuckshot);
		}

		public override void Init(ConfigFile config)
		{
			FireIceShard.maxRange = config.Bind<float>("Skills Config: " + SkillName, "Max Range", FireIceShard.maxRange, "Determines the cutoff radius for Ice Shards bullets. Damage falloff still applies.").Value;
			FireIceShard.damageCoefficient = config.Bind<float>("Skills Config: " + SkillName, "Damage Per Pellet", FireIceShard.damageCoefficient / totalShards, "Determines the max damage coefficient per Ice Shards pellet. Damage falloff still applies.").Value * totalShards;
			KeywordTokens = new string[1] { "2R4R_KEYWORD_CHILL" };
			CreateTracerEffects();
			CreateLang();
			CreateSkill();
		}
	}
	internal class _2FireSkill2Skill : SkillBase
	{
		public static GameObject outerFireball;

		public static GameObject innerFireball;

		public override string SkillName => "Flame Burst";

		public override string SkillDescription => "Ignite. Charge a spread of 3 fireballs for <style=cIsDamage>" + Tools.ConvertDecimal(ChargeFireBlast.minDamageCoefficient) + "-" + Tools.ConvertDecimal(ChargeFireBlast.maxDamageCoefficient) + " damage each</style> that converge on a point in front of you.";

		public override string SkillLangTokenName => "FIREBALLS";

		public override UnlockableDef UnlockDef => GetUnlockDef(typeof(ArtificerFlameBurstUnlock));

		public override string IconName => "Fireskill2icon";

		public override MageElement Element => (MageElement)1;

		public override Type ActivationState => typeof(ChargeFireBlast);

		public override SkillFamily SkillSlot => ArtificerExtendedPlugin.magePrimary;

		public override SimpleSkillData SkillData => new SimpleSkillData(1, 2f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, cancelSprintingOnActivation: true, dontAllowPastMaxStocks: true, fullRestockOnAssign: true, (InterruptPriority)0);

		public override void Hooks()
		{
		}

		public override void Init(ConfigFile config)
		{
			ChargeFireBlast.minDamageCoefficient = config.Bind<float>("Skills Config: " + SkillName, "Minimum Damage Coefficient", ChargeFireBlast.minDamageCoefficient, "Determines the minimum damage of Fire Blast.").Value;
			ChargeFireBlast.maxDamageCoefficient = config.Bind<float>("Skills Config: " + SkillName, "Max Damage Coefficient", ChargeFireBlast.maxDamageCoefficient, "Determines the max damage of Fire Blast. ").Value;
			KeywordTokens = new string[1] { "KEYWORD_IGNITE" };
			CreateProjectiles();
			CreateLang();
			CreateSkill();
		}

		private void CreateProjectiles()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			float blastRadius = 4f;
			float num = 0.5f;
			outerFireball = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/MageFireBombProjectile"), "mageFireballOuter", true);
			outerFireball.transform.localScale = Vector3.one * num;
			ProjectileSimple component = outerFireball.GetComponent<ProjectileSimple>();
			component.desiredForwardSpeed = 80f;
			component.lifetime = 0.3f;
			component.updateAfterFiring = true;
			component.oscillate = true;
			component.oscillateSpeed = 25f;
			component.oscillateMagnitude = 60f;
			ProjectileImpactExplosion component2 = outerFireball.GetComponent<ProjectileImpactExplosion>();
			((ProjectileExplosion)component2).blastRadius = blastRadius;
			((ProjectileExplosion)component2).falloffModel = (FalloffModel)0;
			((ProjectileExplosion)component2).bonusBlastForce = Vector3.zero;
			component2.lifetime = 0.275f;
			innerFireball = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/MageFireBombProjectile"), "mageFireballInner", true);
			innerFireball.transform.localScale = Vector3.one * num;
			ProjectileSimple component3 = innerFireball.GetComponent<ProjectileSimple>();
			component3.desiredForwardSpeed = component.desiredForwardSpeed;
			component3.lifetime = component.lifetime + 0.05f;
			component3.updateAfterFiring = component.updateAfterFiring;
			ProjectileImpactExplosion component4 = innerFireball.GetComponent<ProjectileImpactExplosion>();
			((ProjectileExplosion)component4).blastRadius = blastRadius;
			((ProjectileExplosion)component4).falloffModel = (FalloffModel)0;
			((ProjectileExplosion)component4).bonusBlastForce = Vector3.zero;
			component4.lifetime = component2.lifetime + 0.05f;
			ContentPacks.projectilePrefabs.Add(outerFireball);
			ContentPacks.projectilePrefabs.Add(innerFireball);
		}
	}
	internal class _3LaserBoltsSkill : SkillBase
	{
		public static GameObject tracerLaser;

		private int maxStock = 4;

		public override string SkillName => "Laserbolts";

		public override string SkillDescription => "Fire a long-range laser for <style=cIsDamage>" + Tools.ConvertDecimal(FireLaserbolts.damageCoefficient) + " damage</style>. Hold up to 4, recharging all at once.";

		public override string SkillLangTokenName => "LASERS";

		public override UnlockableDef UnlockDef => GetUnlockDef(typeof(ArtificerLaserUnlock));

		public override string IconName => "LaserboltIcon";

		public override MageElement Element => (MageElement)3;

		public override Type ActivationState => typeof(FireLaserbolts);

		public override SkillFamily SkillSlot => ArtificerExtendedPlugin.magePrimary;

		public override SimpleSkillData SkillData => new SimpleSkillData(maxStock, 2f, beginSkillCooldownOnSkillEnd: true, canceledFromSprinting: false, cancelSprintingOnActivation: true, dontAllowPastMaxStocks: true, fullRestockOnAssign: true, (InterruptPriority)0, isCombatSkill: true, mustKeyPress: false, maxStock, 1, resetCooldownTimerOnUse: true);

		public override bool useSteppedDef { get; set; } = true;


		public override void Hooks()
		{
		}

		public override void Init(ConfigFile config)
		{
			FireLaserbolts.maxRange = config.Bind<float>("Skills Config: " + Skill