MystMod.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AncientScepter;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using EmotesAPI;
using EntityStates;
using EntityStates.Commando;
using HG;
using HG.BlendableTypes;
using MonoMod.RuntimeDetour;
using Moonstorm.Starstorm2;
using MystMod.Modules;
using MystMod.Modules.Components;
using MystMod.Modules.Survivors;
using MystMod.SkillStates;
using MystMod.SkillStates.BaseStates;
using MystMod.SkillStates.Emotes;
using MystMod.SkillStates.Myst;
using MystMod.SkillStates.Myst.Finishers;
using MystMod.SkillStates.Myst.Formchanges;
using MystMod.SkillStates.Myst.Formchanges.Berserk;
using MystMod.SkillStates.Myst.Limits;
using MystMod.SkillStates.Myst.Networking;
using MystMod.SkillStates.Myst.Passives;
using MystMod.SkillStates.Myst.Spells;
using MystMod.SkillStates.Myst.Spells.Orbs;
using MysticsItems;
using NS_KingKombatArena;
using On.RoR2;
using On.RoR2.CharacterSpeech;
using On.RoR2.UI;
using OrographicGambitBaseMod.Modules;
using OrographicGambitBaseMod.Modules.Components;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using Rewired;
using Rewired.Data;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.CharacterSpeech;
using RoR2.ContentManagement;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using TILER2;
using TMPro;
using ThinkInvisible.TinkersSatchel;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("0Harmony")]
[assembly: IgnoresAccessChecksTo("HGUnityUtils")]
[assembly: AssemblyCompany("MystMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MystMod")]
[assembly: AssemblyTitle("MystMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
internal class BodyInfo
{
	internal string bodyName = "";

	internal string bodyNameToken = "";

	internal string subtitleNameToken = "";

	internal Texture characterPortrait = null;

	internal GameObject crosshair = null;

	internal GameObject podPrefab = null;

	internal float maxHealth = 100f;

	internal float healthGrowth = 2f;

	internal float healthRegen = 0f;

	internal float shield = 0f;

	internal float shieldGrowth = 0f;

	internal float moveSpeed = 7f;

	internal float moveSpeedGrowth = 0f;

	internal float acceleration = 80f;

	internal float jumpPower = 15f;

	internal float jumpPowerGrowth = 0f;

	internal float damage = 12f;

	internal float attackSpeed = 1f;

	internal float attackSpeedGrowth = 0f;

	internal float armor = 0f;

	internal float armorGrowth = 0f;

	internal float crit = 1f;

	internal float critGrowth = 0f;

	internal int jumpCount = 1;

	internal Color bodyColor = Color.grey;
}
internal class CustomRendererInfo
{
	internal string childName;

	internal Material material;

	internal bool ignoreOverlays;
}
internal class SkillDefInfo
{
	public string skillName;

	public string skillNameToken;

	public string skillDescriptionToken;

	public Sprite skillIcon;

	public SerializableEntityStateType activationState;

	public string activationStateMachineName;

	public int baseMaxStock;

	public float baseRechargeInterval;

	public bool beginSkillCooldownOnSkillEnd;

	public bool canceledFromSprinting;

	public bool forceSprintDuringState;

	public bool fullRestockOnAssign;

	public InterruptPriority interruptPriority;

	public bool resetCooldownTimerOnUse;

	public bool isCombatSkill;

	public bool mustKeyPress;

	public bool cancelSprintingOnActivation;

	public int rechargeStock;

	public int requiredStock;

	public int stockToConsume;

	public string[] keywordTokens;
}
namespace MystMod
{
	[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.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.JavAngle.MystMod", "MystMod", "1.2.9")]
	[R2APISubmoduleDependency(new string[] { "PrefabAPI", "LanguageAPI", "SoundAPI", "NetworkingAPI", "ItemAPI", "DamageAPI" })]
	public class MystPlugin : BaseUnityPlugin
	{
		public const string MODUID = "com.JavAngle.MystMod";

		public const string MODNAME = "MystMod";

		public const string MODVERSION = "1.2.9";

		public const string developerPrefix = "JAVANGLE";

		public static bool scepterInstalled;

		public static bool SS2Installed;

		public static bool AetheriumInstalled;

		public static bool MysticsItemsInstalled;

		public static bool TinkersSatchelInstalled;

		public static bool scrollableLobbyInstalled;

		public static bool RiskOfOptionsInstalled;

		public static bool EmotesAPIInstalled;

		public static bool BadassEmotesInstalled;

		public static bool KKArenaInstalled;

		public static MystPlugin instance;

		private bool emoteAPIsetup = false;

		private void Awake()
		{
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			instance = this;
			if (Chainloader.PluginInfos.ContainsKey("com.DestroyedClone.AncientScepter"))
			{
				scepterInstalled = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.TeamMoonstorm.Starstorm2"))
			{
				SS2Installed = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.KomradeSpectre.Aetherium"))
			{
				AetheriumInstalled = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.themysticsword.mysticsitems"))
			{
				MysticsItemsInstalled = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.ThinkInvisible.TinkersSatchel"))
			{
				TinkersSatchelInstalled = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.ScrollableLobbyUI"))
			{
				scrollableLobbyInstalled = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
			{
				RiskOfOptionsInstalled = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.weliveinasociety.CustomEmotesAPI"))
			{
				EmotesAPIInstalled = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.weliveinasociety.badassemotes"))
			{
				BadassEmotesInstalled = true;
			}
			if (Chainloader.PluginInfos.ContainsKey("com.Kingpinush.KingKombatArena"))
			{
				KKArenaInstalled = true;
			}
			Assets.PopulateAssets();
			Config.ReadConfig();
			States.RegisterStates();
			Buffs.RegisterBuffs();
			Projectiles.RegisterProjectiles();
			Tokens.AddTokens();
			ItemDisplays.PopulateDisplays();
			NetworkingAPI.RegisterMessageType<MystNetworkComponent>();
			NetworkingAPI.RegisterMessageType<MystTargetEffect>();
			NetworkingAPI.RegisterMessageType<MystTextBoxSync>();
			Myst.CreateCharacter();
			MagiciteDefs.SetSortOrder();
			MagiciteDust.setUp();
			ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
			Hook();
			if (BadassEmotesInstalled)
			{
				Magicite magiciteDef = new Magicite
				{
					icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconIrresistibleDance"),
					name = "JAVANGLE_MYST_MAGICITE_DANCE_NAME",
					description = "JAVANGLE_MYST_MAGICITE_DANCE_DESCRIPTION",
					type = Magicite.MagiciteType.Spell,
					info = "JAVANGLE_MYST_MAGICITE_DANCE_INFO",
					color = Config.SpellMagicite.Value,
					Skillstate = new IrresistibleDance(),
					EXPperLevel = 25f,
					levelMAX = 5
				};
				MagiciteDefs.AddMagiciteDef(magiciteDef);
			}
		}

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

		private void Start()
		{
			ContentManager.onContentPacksAssigned += ContentManager_onContentPacksAssigned;
		}

		private void ContentManager_onContentPacksAssigned(ReadOnlyArray<ReadOnlyContentPack> obj)
		{
			Myst.InitializeItemDisplays();
			Myst.SetItemDisplays();
		}

		private void Hook()
		{
			//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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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
			CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
			CharacterMaster.OnInventoryChanged += new hook_OnInventoryChanged(CharacterMaster_OnInventoryChanged);
			CharacterBody.OnBuffFirstStackGained += new hook_OnBuffFirstStackGained(CharacterBody_OnBuffFirstStackGained);
			CharacterBody.OnBuffFinalStackLost += new hook_OnBuffFinalStackLost(CharacterBody_OnBuffFinalStackLost);
			HUD.Awake += new hook_Awake(MystSpellHuD);
			HUD.Awake += new hook_Awake(MystMagiciteMenu);
			HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
			GlobalEventManager.OnCharacterDeath += new hook_OnCharacterDeath(GlobalEventManager_OnCharacterDeath);
			AmmoPickup.OnTriggerStay += new hook_OnTriggerStay(AmmoPickup_OnTriggerStay);
			ChargedState.OnEnter += new hook_OnEnter(ChargedState_OnEnter);
			BrotherSpeechDriver.DoInitialSightResponse += new hook_DoInitialSightResponse(BrotherSpeechDriver_DoInitialSightResponse);
			BrotherSpeechDriver.OnBodyKill += new hook_OnBodyKill(BrotherSpeechDriver_OnBodyKill);
			if (EmotesAPIInstalled)
			{
				SetUpEmotes();
			}
			if (KKArenaInstalled)
			{
				SetupKKArenaCompat();
			}
			if (scepterInstalled)
			{
				SetupSceptreSupport();
			}
		}

		private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)self))
			{
				if (self.baseNameToken == "JAVANGLE_MYST_BODY_NAME")
				{
					MystPassiveManager component = ((Component)self).GetComponent<MystPassiveManager>();
					SkillLocator skillLocator = self.skillLocator;
					component.magicMAX = 45 + skillLocator.primary.maxStock * 5 + skillLocator.secondary.maxStock * 10 + skillLocator.utility.maxStock * 25 + skillLocator.special.maxStock * 15;
					component.MagicBarHandler();
				}
				if (self.HasBuff(Buffs.MystFortify))
				{
					self.armor += 100f;
				}
				if (self.HasBuff(Buffs.MystHaste))
				{
					self.moveSpeed *= 1.5f;
					self.attackSpeed *= 1.5f;
				}
				if (self.HasBuff(Buffs.TimeLock))
				{
					self.attackSpeed = 0f;
					self.moveSpeed = 0f;
					self.jumpPower = 0f;
				}
				if (self.HasBuff(Buffs.FormchangeBerserk))
				{
					self.moveSpeed *= FormChangeBerserk.moveSpeedModifier;
					self.jumpPower += FormChangeBerserk.jumpPowerModifier;
					self.armor += FormChangeBerserk.armourModifier;
				}
			}
		}

		private void CharacterMaster_OnInventoryChanged(orig_OnInventoryChanged orig, CharacterMaster self)
		{
			orig.Invoke(self);
			if (self.hasBody)
			{
				CharacterBody body = self.GetBody();
				if (Object.op_Implicit((Object)(object)body) && body.baseNameToken == "JAVANGLE_MYST_BODY_NAME")
				{
					MystPassiveManager component = ((Component)body).GetComponent<MystPassiveManager>();
					component.SetUpAccessorySlots();
				}
			}
		}

		private void CharacterBody_OnBuffFirstStackGained(orig_OnBuffFirstStackGained orig, CharacterBody self, BuffDef buffDef)
		{
			orig.Invoke(self, buffDef);
			if ((Object)(object)buffDef == (Object)(object)Buffs.TimeLock && Object.op_Implicit((Object)(object)self.skillLocator))
			{
				if (!Object.op_Implicit((Object)(object)EmptySkill.Empty))
				{
					EmptySkill.SetUpEmpty();
				}
				SkillLocator skillLocator = self.skillLocator;
				try
				{
					skillLocator.primary.SetSkillOverride((object)((Component)self).gameObject, EmptySkill.Empty, (SkillOverridePriority)3);
				}
				catch
				{
				}
				try
				{
					skillLocator.secondary.SetSkillOverride((object)((Component)self).gameObject, EmptySkill.Empty, (SkillOverridePriority)3);
				}
				catch
				{
				}
				try
				{
					skillLocator.utility.SetSkillOverride((object)((Component)self).gameObject, EmptySkill.Empty, (SkillOverridePriority)3);
				}
				catch
				{
				}
				try
				{
					skillLocator.special.SetSkillOverride((object)((Component)self).gameObject, EmptySkill.Empty, (SkillOverridePriority)3);
				}
				catch
				{
				}
			}
		}

		private void CharacterBody_OnBuffFinalStackLost(orig_OnBuffFinalStackLost orig, CharacterBody self, BuffDef buffDef)
		{
			orig.Invoke(self, buffDef);
			if ((Object)(object)buffDef == (Object)(object)Buffs.TimeLock && Object.op_Implicit((Object)(object)self.skillLocator))
			{
				if (!Object.op_Implicit((Object)(object)EmptySkill.Empty))
				{
					EmptySkill.SetUpEmpty();
				}
				SkillLocator skillLocator = self.skillLocator;
				try
				{
					skillLocator.primary.UnsetSkillOverride((object)((Component)self).gameObject, EmptySkill.Empty, (SkillOverridePriority)3);
				}
				catch
				{
				}
				try
				{
					skillLocator.secondary.UnsetSkillOverride((object)((Component)self).gameObject, EmptySkill.Empty, (SkillOverridePriority)3);
				}
				catch
				{
				}
				try
				{
					skillLocator.utility.UnsetSkillOverride((object)((Component)self).gameObject, EmptySkill.Empty, (SkillOverridePriority)3);
				}
				catch
				{
				}
				try
				{
					skillLocator.special.UnsetSkillOverride((object)((Component)self).gameObject, EmptySkill.Empty, (SkillOverridePriority)3);
				}
				catch
				{
				}
			}
		}

		private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo info)
		{
			//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_000e: Invalid comparison between Unknown and I4
			//IL_0095: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: 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_0227: Expected O, but got Unknown
			if ((int)DamageTypeCombo.op_Implicit(info.damageType) != 64 && self.body.baseNameToken == "JAVANGLE_MYST_BODY_NAME")
			{
				CharacterBody val = (Object.op_Implicit((Object)(object)info.attacker) ? info.attacker.GetComponent<CharacterBody>() : null);
				MystPassiveManager component = ((Component)self.body).GetComponent<MystPassiveManager>();
				if (Object.op_Implicit((Object)(object)component))
				{
					if (component.isParrying)
					{
						info.rejected = true;
						component.EnterParryExtend(info.damage * 3f);
						EffectManager.SpawnEffect(Assets.MystParryImpact, new EffectData
						{
							origin = self.body.corePosition,
							rootObject = ((Component)self.body).gameObject,
							scale = 1f
						}, true);
						float num = 40 + 12 * TeamManager.instance.GetTeamLevel((TeamIndex)2);
						float num2 = info.damage / num;
						component.GrantNetworkedLimit(num2 * 2f);
						float mana = Mathf.Clamp(info.damage / self.fullCombinedHealth, 0f, 1f) * component.magicMAX / 3f;
						component.GrantNetworkedMagic(mana);
					}
					else if (Object.op_Implicit((Object)(object)val) && component.isBlocking)
					{
						bool flag = false;
						Vector3 val2;
						if (BlockCheck(self.body, info.position))
						{
							val2 = self.body.corePosition - info.position;
							component.EnterBlockExtend(((Vector3)(ref val2)).normalized * info.procCoefficient);
							flag = true;
						}
						else if (BlockCheck(self.body, val.corePosition))
						{
							val2 = self.body.corePosition - val.corePosition;
							component.EnterBlockExtend(((Vector3)(ref val2)).normalized * info.procCoefficient);
							flag = true;
						}
						if (flag)
						{
							EffectManager.SpawnEffect(Assets.MystBlockImpact, new EffectData
							{
								origin = info.position,
								scale = 1f
							}, true);
							float num3 = 60 + 55 * TeamManager.instance.GetTeamLevel((TeamIndex)2);
							float num4 = info.damage / num3;
							component.GrantNetworkedLimit(num4 * 2f);
							info.damage *= 0.15f;
						}
					}
					if (component.isReflecting)
					{
						info.rejected = true;
						component.EnterReflextend();
					}
				}
			}
			orig.Invoke(self, info);
			if (Object.op_Implicit((Object)(object)info.attacker))
			{
				CharacterBody component2 = info.attacker.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component2) && component2.baseNameToken == "JAVANGLE_MYST_BODY_NAME")
				{
					MystPassiveManager component3 = ((Component)component2).GetComponent<MystPassiveManager>();
					float num5 = 80f + Config.limitDamageScaler.Value * (float)TeamManager.instance.GetTeamLevel((TeamIndex)2);
					float limit = info.damage / num5 * info.procCoefficient;
					component3.GrantNetworkedLimit(limit);
				}
			}
		}

		private bool BlockCheck(CharacterBody Defender, Vector3 Attacker)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Attacker - Defender.transform.position;
			float num = Vector3.Angle(Defender.characterDirection.forward, val);
			return num < 100f;
		}

		private void GlobalEventManager_OnCharacterDeath(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
		{
			orig.Invoke(self, damageReport);
			if (damageReport != null && Object.op_Implicit((Object)(object)damageReport.attacker))
			{
				CharacterBody component = damageReport.attacker.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component) && component.baseNameToken == "JAVANGLE_MYST_BODY_NAME")
				{
					MystPassiveManager component2 = ((Component)component).GetComponent<MystPassiveManager>();
					component2.GrantNetworkedMagiciteEXP(1f);
				}
			}
		}

		private void MystSpellHuD(orig_Awake orig, HUD self)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			Transform val = self.mainContainer.transform.Find("MainUIArea");
			val = val.Find("SpringCanvas");
			val = val.Find("BottomRightCluster");
			GameObject val2 = Object.Instantiate<GameObject>(Assets.MystHuD);
			val2.transform.SetParent(self.mainContainer.transform);
			RectTransform component = val2.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(1f, 0f);
			component.anchorMax = new Vector2(1f, 0f);
			component.sizeDelta = Vector2.zero;
			((Transform)component).localScale = Vector2.op_Implicit(Vector2.zero);
			component.anchoredPosition = new Vector2(-50f, 50f);
			ChildLocator component2 = val2.GetComponent<ChildLocator>();
			RectTransform component3 = ((Component)component2.FindChild("ResourceGauges")).GetComponent<RectTransform>();
			((Transform)component3).localScale = new Vector3(1.3f * (Config.UIscale.Value / 100f), 1.3f * (Config.UIscale.Value / 100f), 1f);
			Image[] abilityIcons = (Image[])(object)new Image[8]
			{
				((Component)component2.FindChild("AbilityIcon1")).GetComponent<Image>(),
				((Component)component2.FindChild("AbilityIcon2")).GetComponent<Image>(),
				((Component)component2.FindChild("AbilityIcon3")).GetComponent<Image>(),
				((Component)component2.FindChild("AbilityIcon4")).GetComponent<Image>(),
				((Component)component2.FindChild("AbilityIcon5")).GetComponent<Image>(),
				((Component)component2.FindChild("AbilityIcon6")).GetComponent<Image>(),
				((Component)component2.FindChild("AbilityIcon7")).GetComponent<Image>(),
				((Component)component2.FindChild("AbilityIcon8")).GetComponent<Image>()
			};
			Image component4 = ((Component)component2.FindChild("Magic")).GetComponent<Image>();
			Image[] array = (Image[])(object)new Image[3]
			{
				((Component)component2.FindChild("Limit1")).GetComponent<Image>(),
				((Component)component2.FindChild("Limit2")).GetComponent<Image>(),
				((Component)component2.FindChild("Limit3")).GetComponent<Image>()
			};
			Text component5 = ((Component)component2.FindChild("FormchangeText")).GetComponent<Text>();
			Image component6 = ((Component)component2.FindChild("FormchangeBar")).GetComponent<Image>();
			Animator component7 = val2.GetComponent<Animator>();
			Text[] keybinds = (Text[])(object)new Text[12]
			{
				((Component)component2.FindChild("Keybind_Skill1")).GetComponent<Text>(),
				((Component)component2.FindChild("Keybind_Skill2")).GetComponent<Text>(),
				((Component)component2.FindChild("Keybind_Skill3")).GetComponent<Text>(),
				((Component)component2.FindChild("Keybind_Skill4")).GetComponent<Text>(),
				((Component)component2.FindChild("Keybind_Skill5")).GetComponent<Text>(),
				((Component)component2.FindChild("Keybind_Skill6")).GetComponent<Text>(),
				((Component)component2.FindChild("Keybind_Skill7")).GetComponent<Text>(),
				((Component)component2.FindChild("Keybind_Skill8")).GetComponent<Text>(),
				((Component)component2.FindChild("Keybind_Inventory")).GetComponent<Text>(),
				((Component)component2.FindChild("Keybind_Sprint")).GetComponent<Text>(),
				((Component)component2.FindChild("Keybind_MagiciteMenu")).GetComponent<Text>(),
				((Component)component2.FindChild("Keybind_Equipment")).GetComponent<Text>()
			};
			MystRunComponent mystRunComponent = MystRunComponent.Instance;
			if (!Object.op_Implicit((Object)(object)mystRunComponent))
			{
				mystRunComponent = ((Component)Run.instance).gameObject.AddComponent<MystRunComponent>();
			}
			mystRunComponent.hud = self;
			mystRunComponent.MystHuD = val2;
			mystRunComponent.childLocator = component2;
			mystRunComponent.defaultUI = val;
			mystRunComponent.HUDrectTransform = component;
			mystRunComponent.HUDresourceGauges = component3;
			mystRunComponent.abilityIcons = abilityIcons;
			mystRunComponent.magicBar = component4;
			mystRunComponent.limitBars = array;
			mystRunComponent.FormchangeText = component5;
			mystRunComponent.FormchangeBar = component6;
			mystRunComponent.keybinds = keybinds;
			TooltipComponent tooltipComponent = ((Component)((Component)component4).transform.parent).gameObject.AddComponent<TooltipComponent>();
			tooltipComponent.tooltipName = "Magic Meter";
			tooltipComponent.tooltipColor = Color.blue;
			tooltipComponent.tooltipDescription = "A resource used for <style=cIsUtility>Spells</style>" + Environment.NewLine + "Upon full depletion, will fully replete after a recharge period" + Environment.NewLine + "Spells can be cast <style=cIsUtility>regardless of their cost</style> as long as you are not in Recharge" + Environment.NewLine + "Cooldown reduction effects Recharge Time, Stock items effect Maximum Magic";
			tooltipComponent.UpdateTooltip();
			Image[] array2 = array;
			foreach (Image val3 in array2)
			{
				tooltipComponent = ((Component)((Component)val3).gameObject.transform.parent).gameObject.AddComponent<TooltipComponent>();
				tooltipComponent.tooltipName = "Limit Gauges";
				tooltipComponent.tooltipColor = Color.yellow;
				tooltipComponent.tooltipDescription = "A resource used for <style=cIsHealth>Limit Breaks</style>" + Environment.NewLine + "Small amounts of <style=cIsHealth>Limit</style> is gained by dealing damage <style=cIsUtility>by any means</style>, and is <style=cIsUtility>persistent between stages</style>" + Environment.NewLine + "Limit is split between 3 Gauges, Limit Breaks will cost an entire gauge at a time (sometimes multiple), and cannot be used unless the required number of gauges are full";
				tooltipComponent.UpdateTooltip();
			}
			mystRunComponent.equipmentImage = ((Component)component2.FindChild("Equiptment Slot")).GetComponent<Image>();
			mystRunComponent.equipmentCooldown = ((Component)component2.FindChild("EquipmentCooldown")).GetComponent<Text>();
			mystRunComponent.equipmentStock = ((Component)component2.FindChild("EquipmentStock")).GetComponent<Text>();
			mystRunComponent.secondaryCooldown = ((Component)component2.FindChild("SecondaryCooldown")).GetComponent<Text>();
			mystRunComponent.hotbarAnimator = component7;
		}

		private void MystMagiciteMenu(orig_Awake orig, HUD self)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_069d: Unknown result type (might be due to invalid IL or missing references)
			//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b7: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			GameObject val = Object.Instantiate<GameObject>(Assets.MystMenu);
			val.transform.SetParent(self.mainContainer.transform);
			RectTransform component = val.GetComponent<RectTransform>();
			component.sizeDelta = Vector2.one;
			component.anchoredPosition = Vector2.zero;
			ChildLocator component2 = val.GetComponent<ChildLocator>();
			Animator component3 = val.GetComponent<Animator>();
			MystMenuManager mystMenuManager = val.AddComponent<MystMenuManager>();
			mystMenuManager.childLocator = component2;
			MystRunComponent mystRunComponent = MystRunComponent.Instance;
			if (!Object.op_Implicit((Object)(object)mystRunComponent))
			{
				mystRunComponent = ((Component)Run.instance).gameObject.AddComponent<MystRunComponent>();
			}
			Transform val2 = (Transform)(object)component;
			val2.localScale = Vector3.one;
			Image[] array = (Image[])(object)new Image[16]
			{
				((Component)component2.FindChild("EquippedMagiciteFrame1")).GetComponent<Image>(),
				((Component)component2.FindChild("EquippedMagiciteFrame2")).GetComponent<Image>(),
				((Component)component2.FindChild("EquippedMagiciteFrame3")).GetComponent<Image>(),
				((Component)component2.FindChild("EquippedMagiciteFrame4")).GetComponent<Image>(),
				((Component)component2.FindChild("EquippedMagiciteFrame5")).GetComponent<Image>(),
				((Component)component2.FindChild("EquippedMagiciteFrame6")).GetComponent<Image>(),
				((Component)component2.FindChild("EquippedMagiciteFrame7")).GetComponent<Image>(),
				((Component)component2.FindChild("EquippedMagiciteFrame8")).GetComponent<Image>(),
				((Component)component2.FindChild("EquippedMagiciteFrame9")).GetComponent<Image>(),
				((Component)component2.FindChild("EquippedMagiciteFrame10")).GetComponent<Image>(),
				((Component)component2.FindChild("EquippedMagiciteFrame11")).GetComponent<Image>(),
				((Component)component2.FindChild("EquippedMagiciteFrame12")).GetComponent<Image>(),
				((Component)component2.FindChild("EquippedMagiciteFrame13")).GetComponent<Image>(),
				((Component)component2.FindChild("EquippedMagiciteFrame14")).GetComponent<Image>(),
				((Component)component2.FindChild("EquippedMagiciteFrame15")).GetComponent<Image>(),
				((Component)component2.FindChild("EquippedMagiciteFrame16")).GetComponent<Image>()
			};
			Image[] array2 = (Image[])(object)new Image[100];
			Image[] array3 = (Image[])(object)new Image[100];
			Text[] array4 = (Text[])(object)new Text[100];
			Text[] array5 = (Text[])(object)new Text[100];
			Text[] array6 = (Text[])(object)new Text[100];
			Image[] array7 = (Image[])(object)new Image[100];
			Image[] array8 = (Image[])(object)new Image[100];
			RectTransform component4 = ((Component)component2.FindChild("InventoryList")).GetComponent<RectTransform>();
			for (int i = 0; i < 100; i++)
			{
				GameObject val3 = Object.Instantiate<GameObject>(Assets.MystIntEnt);
				val3.transform.SetParent((Transform)(object)component4, false);
				RectTransform component5 = val3.GetComponent<RectTransform>();
				component5.anchorMin = new Vector2(0.5f, 1f);
				component5.anchorMax = new Vector2(0.5f, 1f);
				component5.anchoredPosition = new Vector2(0f, -55f * (float)i);
				ChildLocator component6 = val3.GetComponent<ChildLocator>();
				array2[i] = ((Component)component6.FindChild("Frame")).GetComponent<Image>();
				array3[i] = ((Component)component6.FindChild("Icon")).GetComponent<Image>();
				array4[i] = ((Component)component6.FindChild("Name")).GetComponent<Text>();
				array5[i] = ((Component)component6.FindChild("Level")).GetComponent<Text>();
				array6[i] = ((Component)component6.FindChild("LVtext")).GetComponent<Text>();
				array7[i] = ((Component)component6.FindChild("Sell")).GetComponentInChildren<Image>();
				array8[i] = ((Component)component6.FindChild("SellIcon")).GetComponent<Image>();
				MenuMagiciteSlotHandler menuMagiciteSlotHandler = ((Component)array2[i]).gameObject.AddComponent<MenuMagiciteSlotHandler>();
				menuMagiciteSlotHandler.menuManager = mystMenuManager;
				menuMagiciteSlotHandler.slotNo = i;
				menuMagiciteSlotHandler.slotEQ = false;
				MenuDesynthesisSlotHandler menuDesynthesisSlotHandler = ((Component)array7[i]).gameObject.AddComponent<MenuDesynthesisSlotHandler>();
				menuDesynthesisSlotHandler.menuManager = mystMenuManager;
				menuDesynthesisSlotHandler.slotID = i;
			}
			mystRunComponent.inventoryMagiciteFrame = array2;
			mystRunComponent.inventoryMagiciteIcon = array3;
			mystRunComponent.inventoryMagiciteName = array4;
			mystRunComponent.inventoryMagiciteLevel = array5;
			mystRunComponent.inventoryMagiciteLVtex = array6;
			mystRunComponent.inventoryMagiciteSell = array7;
			mystRunComponent.inventoryMagiciteSellIcon = array8;
			ScrollRect component7 = ((Component)component2.FindChild("inventoryFrame")).GetComponent<ScrollRect>();
			BetterMystInventoryScroll betterMystInventoryScroll = ((Component)component2.FindChild("InventoryScrollRect")).gameObject.AddComponent<BetterMystInventoryScroll>();
			((ScrollRect)betterMystInventoryScroll).content = component7.content;
			((ScrollRect)betterMystInventoryScroll).horizontal = component7.horizontal;
			((ScrollRect)betterMystInventoryScroll).vertical = component7.vertical;
			((ScrollRect)betterMystInventoryScroll).movementType = component7.movementType;
			((ScrollRect)betterMystInventoryScroll).elasticity = component7.elasticity;
			((ScrollRect)betterMystInventoryScroll).inertia = component7.inertia;
			((ScrollRect)betterMystInventoryScroll).scrollSensitivity = component7.scrollSensitivity;
			((ScrollRect)betterMystInventoryScroll).viewport = component7.viewport;
			((ScrollRect)betterMystInventoryScroll).horizontalScrollbar = component7.horizontalScrollbar;
			((ScrollRect)betterMystInventoryScroll).verticalScrollbar = component7.verticalScrollbar;
			((ScrollRect)betterMystInventoryScroll).horizontalScrollbarVisibility = component7.horizontalScrollbarVisibility;
			((ScrollRect)betterMystInventoryScroll).verticalScrollbarVisibility = component7.verticalScrollbarVisibility;
			Object.Destroy((Object)(object)component7);
			int num = 0;
			Image[] array9 = array;
			foreach (Image val4 in array9)
			{
				MenuMagiciteSlotHandler menuMagiciteSlotHandler2 = ((Component)val4).gameObject.AddComponent<MenuMagiciteSlotHandler>();
				menuMagiciteSlotHandler2.menuManager = mystMenuManager;
				menuMagiciteSlotHandler2.slotNo = num;
				menuMagiciteSlotHandler2.slotEQ = true;
				num++;
			}
			Image[] array10 = (Image[])(object)new Image[7]
			{
				((Component)component2.FindChild("ShopEquip")).GetComponent<Image>(),
				((Component)component2.FindChild("ShopDust")).GetComponent<Image>(),
				((Component)component2.FindChild("ShopItem")).GetComponent<Image>(),
				((Component)component2.FindChild("ShopSpell")).GetComponent<Image>(),
				((Component)component2.FindChild("ShopLimit")).GetComponent<Image>(),
				((Component)component2.FindChild("ShopFinisher")).GetComponent<Image>(),
				((Component)component2.FindChild("ShopSupport")).GetComponent<Image>()
			};
			((Component)((Component)component2.FindChild("SortButton")).GetComponent<Image>()).gameObject.AddComponent<MenuSortSlotHandler>().menuManager = mystMenuManager;
			num = 0;
			Image[] array11 = array10;
			foreach (Image val5 in array11)
			{
				MenuSynthesisSlotHandler menuSynthesisSlotHandler = ((Component)val5).gameObject.AddComponent<MenuSynthesisSlotHandler>();
				menuSynthesisSlotHandler.menuManager = mystMenuManager;
				menuSynthesisSlotHandler.slotID = num;
				num++;
			}
			mystRunComponent.hud = self;
			mystRunComponent.menuManager = mystMenuManager;
			mystRunComponent.menuTransform = val2;
			mystRunComponent.menuChildLocator = component2;
			mystRunComponent.menuAnimator = component3;
			GameObject val6 = Object.Instantiate<GameObject>(Assets.MystCursor);
			val6.transform.SetParent(self.mainContainer.transform);
			RectTransform component8 = val6.GetComponent<RectTransform>();
			component8.anchorMin = new Vector2(0f, 0f);
			component8.anchorMax = new Vector2(0f, 0f);
			component8.sizeDelta = Vector2.one;
			component8.anchoredPosition = Vector2.zero;
			mystRunComponent.magiciteCursor = component8;
		}

		private void ChargedState_OnEnter(orig_OnEnter orig, BaseState self)
		{
			orig.Invoke(self);
			bool flag = Config.OmniStasis.Value;
			if (!flag)
			{
				ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers((TeamIndex)1);
				foreach (TeamComponent item in teamMembers)
				{
					if (Object.op_Implicit((Object)(object)item.body) && item.body.baseNameToken == "JAVANGLE_MYST_BODY_NAME")
					{
						Debug.Log((object)"MystDetected");
						flag = true;
					}
				}
			}
			if (flag && (Object)(object)MystStasisHandler.instance == (Object)null)
			{
				((Component)Object.FindObjectOfType<TeleporterInteraction>()).gameObject.AddComponent<MystStasisHandler>();
			}
		}

		private void AmmoPickup_OnTriggerStay(orig_OnTriggerStay orig, AmmoPickup self, Collider other)
		{
			//IL_0016: 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)
			if (NetworkServer.active && self.alive && TeamComponent.GetObjectTeam(((Component)other).gameObject) == self.teamFilter.teamIndex)
			{
				CharacterBody component = ((Component)other).GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component) && component.baseNameToken == "JAVANGLE_MYST_BODY_NAME")
				{
					MystPassiveManager component2 = ((Component)component).GetComponent<MystPassiveManager>();
					component2.GrantNetworkedMagic(15f);
				}
			}
			orig.Invoke(self, other);
		}

		private void BrotherSpeechDriver_DoInitialSightResponse(orig_DoInitialSightResponse orig, BrotherSpeechDriver self)
		{
			//IL_0017: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: 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_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			bool flag2 = false;
			ReadOnlyCollection<CharacterBody> readOnlyInstancesList = CharacterBody.readOnlyInstancesList;
			for (int i = 0; i < readOnlyInstancesList.Count; i++)
			{
				BodyIndex bodyIndex = readOnlyInstancesList[i].bodyIndex;
				flag |= bodyIndex == BodyCatalog.FindBodyIndex(Myst.characterPrefab);
				flag2 |= bodyIndex == BodyCatalog.FindBodyIndex("TitanGoldBody");
			}
			if (flag && !flag2)
			{
				SpeechInfo[] array = (SpeechInfo[])(object)new SpeechInfo[4]
				{
					new SpeechInfo
					{
						duration = 1f,
						maxWait = 0f,
						mustPlay = true,
						priority = 0f,
						token = "JAVANGLE_MYST_BODY_BROTHER_INITIALRESPONSE_MYST_1"
					},
					new SpeechInfo
					{
						duration = 1f,
						maxWait = 0f,
						mustPlay = true,
						priority = 0f,
						token = "JAVANGLE_MYST_BODY_BROTHER_INITIALRESPONSE_MYST_2"
					},
					new SpeechInfo
					{
						duration = 1f,
						maxWait = 0f,
						mustPlay = true,
						priority = 0f,
						token = "JAVANGLE_MYST_BODY_BROTHER_INITIALRESPONSE_MYST_3"
					},
					new SpeechInfo
					{
						duration = 1f,
						maxWait = 0f,
						mustPlay = true,
						priority = 0f,
						token = "JAVANGLE_MYST_BODY_BROTHER_INITIALRESPONSE_MYST_3"
					}
				};
				self.SendReponseFromPool(array);
			}
			orig.Invoke(self);
		}

		private void BrotherSpeechDriver_OnBodyKill(orig_OnBodyKill orig, BrotherSpeechDriver self, DamageReport damageReport)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)damageReport.victimBody) && damageReport.victimBodyIndex == BodyCatalog.FindBodyIndex(Myst.characterPrefab))
			{
				SpeechInfo[] array = (SpeechInfo[])(object)new SpeechInfo[4]
				{
					new SpeechInfo
					{
						duration = 1f,
						maxWait = 0f,
						mustPlay = true,
						priority = 0f,
						token = "JAVANGLE_MYST_BODY_BROTHER_ONBODYKILL_MYST_1"
					},
					new SpeechInfo
					{
						duration = 1f,
						maxWait = 0f,
						mustPlay = true,
						priority = 0f,
						token = "JAVANGLE_MYST_BODY_BROTHER_ONBODYKILL_MYST_2"
					},
					new SpeechInfo
					{
						duration = 1f,
						maxWait = 0f,
						mustPlay = true,
						priority = 0f,
						token = "JAVANGLE_MYST_BODY_BROTHER_ONBODYKILL_MYST_3"
					},
					new SpeechInfo
					{
						duration = 1f,
						maxWait = 0f,
						mustPlay = true,
						priority = 0f,
						token = "JAVANGLE_MYST_BODY_BROTHER_ONBODYKILL_MYST_3"
					}
				};
				self.SendReponseFromPool(array);
			}
			orig.Invoke(self, damageReport);
		}

		private void SetUpEmotes()
		{
			//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
			SurvivorCatalog.Init += (hook_Init)delegate(orig_Init orig)
			{
				orig.Invoke();
				if (!emoteAPIsetup)
				{
					emoteAPIsetup = true;
					foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs)
					{
						if (((Object)allSurvivorDef.bodyPrefab).name == "JavangleMystBody")
						{
							GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("Myst_emote");
							CustomEmotesAPI.ImportArmature(allSurvivorDef.bodyPrefab, val, 0, true);
							val.GetComponentInChildren<BoneMapper>().scale = 0.9f;
							CustomEmotesAPI.CreateNameTokenSpritePair("JAVANGLE_MYST_BODY_NAME", Assets.mainAssetBundle.LoadAsset<Sprite>("MystTauntIcon"));
						}
					}
				}
			};
			CustomEmotesAPI.animChanged += new AnimationChanged(MystHideMeshes);
		}

		private void MystHideMeshes(string newAnimation, BoneMapper mapper)
		{
			if (!(((Object)mapper).name == "Myst_emote"))
			{
				return;
			}
			if (newAnimation != "none")
			{
				Animator componentInParent = ((Component)((Component)mapper).transform.parent).gameObject.GetComponentInParent<Animator>();
				ChildLocator componentInParent2 = ((Component)mapper).gameObject.GetComponentInParent<ChildLocator>();
				DynamicBone component = ((Component)componentInParent2.FindChild("Cape1")).GetComponent<DynamicBone>();
				DynamicBone component2 = ((Component)componentInParent2.FindChild("Cape3")).GetComponent<DynamicBone>();
				if (!Object.op_Implicit((Object)(object)componentInParent))
				{
					Debug.LogError((object)"Could not find Animator");
					return;
				}
				if (!Object.op_Implicit((Object)(object)component))
				{
					Debug.LogError((object)"Could not find Mesh Cape1");
					return;
				}
				if (!Object.op_Implicit((Object)(object)component2))
				{
					Debug.LogError((object)"Could not find Mesh Cape2");
					return;
				}
				((Behaviour)component).enabled = true;
				((Behaviour)component2).enabled = true;
				componentInParent.Play("EmoteSwords", 8);
			}
			else
			{
				Animator componentInParent3 = ((Component)((Component)mapper).transform.parent).gameObject.GetComponentInParent<Animator>();
				ChildLocator componentInParent4 = ((Component)mapper).gameObject.GetComponentInParent<ChildLocator>();
				DynamicBone component3 = ((Component)componentInParent4.FindChild("Cape1")).GetComponent<DynamicBone>();
				DynamicBone component4 = ((Component)componentInParent4.FindChild("Cape3")).GetComponent<DynamicBone>();
				if (!Object.op_Implicit((Object)(object)componentInParent3))
				{
					Debug.LogError((object)"Could not find Animator");
					return;
				}
				if (!Object.op_Implicit((Object)(object)component3))
				{
					Debug.LogError((object)"Could not find Mesh Cape1");
					return;
				}
				if (!Object.op_Implicit((Object)(object)component4))
				{
					Debug.LogError((object)"Could not find Mesh Cape2");
					return;
				}
				((Behaviour)component3).enabled = false;
				((Behaviour)component4).enabled = false;
				componentInParent3.Play("BufferEmpty", 8);
			}
		}

		private void SetupKKArenaCompat()
		{
			MystPassiveManager.isKKAInstalled = true;
		}

		private void SetupSceptreSupport()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			string text = "JAVANGLE_MYST_BODY_";
			SkillDefInfo skillDefInfo = new SkillDefInfo();
			skillDefInfo.skillName = text + "BASEFORM_LIMITMENU_NAME";
			skillDefInfo.skillNameToken = text + "BASEFORM_LIMITMENU_NAME";
			skillDefInfo.skillDescriptionToken = text + "BASEFORM_LIMITMENU_DESCRIPTION";
			skillDefInfo.skillIcon = Assets.mainAssetBundle.LoadAsset<Sprite>("MystLimitMenu");
			skillDefInfo.activationState = new SerializableEntityStateType(typeof(LimitMenu));
			skillDefInfo.activationStateMachineName = "Weapon";
			skillDefInfo.baseMaxStock = 1;
			skillDefInfo.baseRechargeInterval = 0.5f;
			skillDefInfo.beginSkillCooldownOnSkillEnd = true;
			skillDefInfo.canceledFromSprinting = false;
			skillDefInfo.forceSprintDuringState = false;
			skillDefInfo.fullRestockOnAssign = true;
			skillDefInfo.interruptPriority = (InterruptPriority)1;
			skillDefInfo.resetCooldownTimerOnUse = false;
			skillDefInfo.isCombatSkill = false;
			skillDefInfo.mustKeyPress = false;
			skillDefInfo.cancelSprintingOnActivation = true;
			skillDefInfo.rechargeStock = 999999;
			skillDefInfo.requiredStock = 1;
			skillDefInfo.stockToConsume = 999999;
			SkillDef val = Skills.CreateSkillDef(skillDefInfo);
			ItemBase<AncientScepterItem>.instance.RegisterScepterSkill(val, "JavangleMystBody", (SkillSlot)3, 0);
		}
	}
	public class MagiciteDefs
	{
		private static Color colorSpecial = new Color(0.8f, 0f, 1f, 1f);

		private static string prefix = "JAVANGLE_MYST_MAGICITE_";

		public static Magicite[] magicites = new Magicite[46]
		{
			new Magicite(),
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "FIREBALL_NAME",
				description = prefix + "FIREBALL_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "FIREBALL_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new Flamebolt(),
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconConeOfFrost"),
				name = prefix + "CONEOFFROST_NAME",
				description = prefix + "CONEOFFROST_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "CONEOFFROST_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new ConeOfFrost(),
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconCallLightning"),
				name = prefix + "CALLLIGHTNING_NAME",
				description = prefix + "CALLLIGHTNING_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "CALLLIGHTNING_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new CallLightning(),
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconMagnet"),
				name = prefix + "MAGNET_NAME",
				description = prefix + "MAGNET_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "MAGNET_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new Magnet(),
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconReflect"),
				name = prefix + "REFLECT_NAME",
				description = prefix + "REFLECT_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "REFLECT_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new Reflect(),
				EXPperLevel = 25f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFortify"),
				name = prefix + "FORTIFY_NAME",
				description = prefix + "FORTIFY_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "FORTIFY_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new Fortify(),
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconHaste"),
				name = prefix + "HASTE_NAME",
				description = prefix + "HASTE_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "HASTE_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new Haste(),
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconMendWounds"),
				name = prefix + "MENDWOUNDS_NAME",
				description = prefix + "MENDWOUNDS_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "MENDWOUNDS_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new MendWounds(),
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconAcidSplash"),
				name = prefix + "ACIDSPLASH_NAME",
				description = prefix + "ACIDSPLASH_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "ACIDSPLASH_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new AcidSplash(),
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconUltima"),
				name = prefix + "ULTIMA_NAME",
				description = prefix + "ULTIMA_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "ULTIMA_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new Ultima(),
				EXPperLevel = 40f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconDoombolt"),
				name = prefix + "DOOMBOLT_NAME",
				description = prefix + "DOOMBOLT_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "DOOMBOLT_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new Doombolt(),
				EXPperLevel = 30f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconViciousMockery"),
				name = prefix + "VICIOUSMOCKERY_NAME",
				description = prefix + "VICIOUSMOCKERY_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "VICIOUSMOCKERY_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new ViciousMockery(),
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconPot"),
				name = prefix + "POT_NAME",
				description = prefix + "POT_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "POT_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new Pot(),
				EXPperLevel = 10f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconMagicMissile"),
				name = prefix + "MAGICMISSILE_NAME",
				description = prefix + "MAGICMISSILE_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "MAGICMISSILE_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new MagicMissile(),
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconDispelMagic"),
				name = prefix + "DISPELMAGIC_NAME",
				description = prefix + "DISPELMAGIC_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "DISPELMAGIC_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new DispelMagic(),
				EXPperLevel = 25f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconGust"),
				name = prefix + "GUST_NAME",
				description = prefix + "GUST_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "GUST_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new Gust(),
				EXPperLevel = 15f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "GIGASLASH_NAME",
				description = prefix + "GIGASLASH_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "GIGASLASH_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new IrresistibleDance(),
				EXPperLevel = 1000f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "ALL_NAME",
				description = prefix + "ALL_DESCRIPTION",
				type = Magicite.MagiciteType.Support,
				info = prefix + "ALL_INFO",
				color = Config.SupportMagicite.Value,
				Skillstate = null,
				EXPperLevel = 40f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "MULTI_NAME",
				description = prefix + "MULTI_DESCRIPTION",
				type = Magicite.MagiciteType.Support,
				info = prefix + "MULTI_INFO",
				color = Config.SupportMagicite.Value,
				Skillstate = null,
				EXPperLevel = 80f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "MPTURBO_NAME",
				description = prefix + "MPTURBO_DESCRIPTION",
				type = Magicite.MagiciteType.Support,
				info = prefix + "MPTURBO_INFO",
				color = Config.SupportMagicite.Value,
				Skillstate = null,
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "MPTHRIFT_NAME",
				description = prefix + "MPTHRIFT_DESCRIPTION",
				type = Magicite.MagiciteType.Support,
				info = prefix + "MPTHRIFT_INFO",
				color = Config.SupportMagicite.Value,
				Skillstate = null,
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "USEONCAST_NAME",
				description = prefix + "USEONCAST_DESCRIPTION",
				type = Magicite.MagiciteType.Support,
				info = prefix + "USEONCAST_INFO",
				color = Config.SupportMagicite.Value,
				Skillstate = null,
				EXPperLevel = 40f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "KILLONCAST_NAME",
				description = prefix + "KILLONCAST_DESCRIPTION",
				type = Magicite.MagiciteType.Support,
				info = prefix + "KILLONCAST_INFO",
				color = Config.SupportMagicite.Value,
				Skillstate = null,
				EXPperLevel = 40f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "HEALTHSYPHON_NAME",
				description = prefix + "HEALTHSYPHON_DESCRIPTION",
				type = Magicite.MagiciteType.Support,
				info = prefix + "HEALTHSYPHON_INFO",
				color = Config.SupportMagicite.Value,
				Skillstate = null,
				EXPperLevel = 40f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "LIMITSYPHON_NAME",
				description = prefix + "LIMITSYPHON_DESCRIPTION",
				type = Magicite.MagiciteType.Support,
				info = prefix + "LIMITSYPHON_INFO",
				color = Config.SupportMagicite.Value,
				Skillstate = null,
				EXPperLevel = 50f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "FATEDCIRCLE_NAME",
				description = prefix + "FATEDCIRCLE_DESCRIPTION",
				type = Magicite.MagiciteType.Finisher,
				info = prefix + "FATEDCIRCLE_INFO",
				color = Config.FinisherMagicite.Value,
				Skillstate = new FatedCircle(),
				EXPperLevel = 25f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "EXPLOSION_NAME",
				description = prefix + "EXPLOSION_DESCRIPTION",
				type = Magicite.MagiciteType.Finisher,
				info = prefix + "EXPLOSION_INFO",
				color = Config.FinisherMagicite.Value,
				Skillstate = new Explosion(),
				EXPperLevel = 25f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconBlastingZone"),
				name = prefix + "BLASTINGZONE_NAME",
				description = prefix + "BLASTINGZONE_DESCRIPTION",
				type = Magicite.MagiciteType.Limit,
				info = prefix + "BLASTINGZONE_INFO",
				color = Config.LimitMagicite.Value,
				Skillstate = new BlastingZone(),
				EXPperLevel = 25f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconWildMagicSurge"),
				name = prefix + "WILDMAGIC_NAME",
				description = prefix + "WILDMAGIC_DESCRIPTION",
				type = Magicite.MagiciteType.Limit,
				info = prefix + "WILDMAGIC_INFO",
				color = Config.LimitMagicite.Value,
				Skillstate = new WildMagicSurge(),
				EXPperLevel = 25f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "DARKPASSENGER_NAME",
				description = prefix + "DARKPASSENGER_DESCRIPTION",
				type = Magicite.MagiciteType.Finisher,
				info = prefix + "DARKPASSENGER_INFO",
				color = Config.FinisherMagicite.Value,
				Skillstate = new DarkPassenger(),
				EXPperLevel = 25f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "RIPPLEDRIVE_NAME",
				description = prefix + "RIPPLEDRIVE_DESCRIPTION",
				type = Magicite.MagiciteType.Finisher,
				info = prefix + "RIPPLEDRIVE_INFO",
				color = Config.FinisherMagicite.Value,
				Skillstate = new RippleDrive(),
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconPowerWordKill"),
				name = prefix + "POWERWORDKILL_NAME",
				description = prefix + "POWERWORDKILL_DESCRIPTION",
				type = Magicite.MagiciteType.Limit,
				info = prefix + "POWERWORDKILL_INFO",
				color = Config.LimitMagicite.Value,
				Skillstate = new PowerWordKill(),
				EXPperLevel = 25f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconPyroclasm"),
				name = prefix + "PYROCLASM_NAME",
				description = prefix + "PYROCLASM_DESCRIPTION",
				type = Magicite.MagiciteType.Limit,
				info = prefix + "PYROCLASM_INFO",
				color = Config.LimitMagicite.Value,
				Skillstate = new Pyroclasm(),
				EXPperLevel = 50f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconZoom"),
				name = prefix + "ZOOM_NAME",
				description = prefix + "ZOOM_DESCRIPTION",
				type = Magicite.MagiciteType.Limit,
				info = prefix + "ZOOM_INFO",
				color = Config.LimitMagicite.Value,
				Skillstate = new Zoom(),
				EXPperLevel = 15f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconBerserkEnter"),
				name = prefix + "BERSERKFORM_NAME",
				description = prefix + "BERSERKFORM_DESCRIPTION",
				type = Magicite.MagiciteType.Limit,
				info = prefix + "BERSERKFORM_INFO",
				color = Config.LimitMagicite.Value,
				Skillstate = new FormChangeBerserk(),
				EXPperLevel = 25f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "JUDGEMENTCUT_NAME",
				description = prefix + "JUDGEMENTCUT_DESCRIPTION",
				type = Magicite.MagiciteType.Finisher,
				info = prefix + "JUDGEMENTCUT_INFO",
				color = Config.FinisherMagicite.Value,
				Skillstate = new JudgementCut(),
				EXPperLevel = 40f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "CHALLENGINGSHOUT_NAME",
				description = prefix + "CHALLENGINGSHOUT_DESCRIPTION",
				type = Magicite.MagiciteType.Finisher,
				info = prefix + "CHALLENGINGSHOUT_INFO",
				color = Config.FinisherMagicite.Value,
				Skillstate = new ChallengingShout(),
				EXPperLevel = 25f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "BLADEDANCE_NAME",
				description = prefix + "BLADEDANCE_DESCRIPTION",
				type = Magicite.MagiciteType.Finisher,
				info = prefix + "BLADEDANCE_INFO",
				color = Config.FinisherMagicite.Value,
				Skillstate = new BladeDance(),
				EXPperLevel = 25f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "FROSTFANGS_NAME",
				description = prefix + "FROSTFANGS_DESCRIPTION",
				type = Magicite.MagiciteType.Finisher,
				info = prefix + "FROSTFANGS_INFO",
				color = Config.FinisherMagicite.Value,
				Skillstate = new FrostFangs(),
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "HANDOFGOD_NAME",
				description = prefix + "HANDOFGOD_DESCRIPTION",
				type = Magicite.MagiciteType.Finisher,
				info = prefix + "HANDOFGOD_INFO",
				color = Config.FinisherMagicite.Value,
				Skillstate = new HandOfGod(),
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconJCE"),
				name = prefix + "JUDGEMENTCUTEND_NAME",
				description = prefix + "JUDGEMENTCUTEND_DESCRIPTION",
				type = Magicite.MagiciteType.Limit,
				info = prefix + "JUDGEMENTCUTEND_INFO",
				color = Config.LimitMagicite.Value,
				Skillstate = new JudgementCutEnd(),
				EXPperLevel = 40f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconEclipseGate"),
				name = prefix + "ECLIPSEGATE_NAME",
				description = prefix + "ECLIPSEGATE_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "ECLIPSEGATE_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new EclipseGate(),
				EXPperLevel = 20f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "SHILLELAGH_NAME",
				description = prefix + "SHILLELAGH_DESCRIPTION",
				type = Magicite.MagiciteType.Finisher,
				info = prefix + "SHILLELAGH_INFO",
				color = Config.FinisherMagicite.Value,
				Skillstate = new Shillelagh(),
				EXPperLevel = 25f,
				levelMAX = 5
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconFireball"),
				name = prefix + "MASS_NAME",
				description = prefix + "MASS_DESCRIPTION",
				type = Magicite.MagiciteType.Support,
				info = prefix + "MASS_INFO",
				color = Config.SupportMagicite.Value,
				Skillstate = null,
				EXPperLevel = 15f,
				levelMAX = 30
			},
			new Magicite
			{
				icon = Assets.mainAssetBundle.LoadAsset<Sprite>("IconCrashToDesktop"),
				name = prefix + "CRASHTODESKTOP_NAME",
				description = prefix + "CRASHTODESKTOP_DESCRIPTION",
				type = Magicite.MagiciteType.Spell,
				info = prefix + "CRASHTODESKTOP_INFO",
				color = Config.SpellMagicite.Value,
				Skillstate = new CrashToDesktop(),
				EXPperLevel = 20f,
				levelMAX = 5
			}
		};

		public static int[] SpellMagicites = new int[18]
		{
			1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
			11, 12, 13, 14, 15, 16, 42, 45
		};

		public static int[] LimitMagicites = new int[7] { 28, 29, 32, 33, 34, 35, 41 };

		public static int[] FinisherMagicites = new int[9] { 26, 27, 30, 31, 36, 37, 38, 39, 43 };

		public static int[] SupportMagicites = new int[9] { 18, 19, 20, 21, 22, 23, 24, 25, 44 };

		public static void SetSortOrder()
		{
			int num = 0;
			for (int i = 0; i < 4; i++)
			{
				Magicite[] array = magicites;
				foreach (Magicite magicite in array)
				{
					if (magicite.type == (Magicite.MagiciteType)i)
					{
						num = (magicite.ID = num + 1);
					}
				}
			}
		}

		public static int AddMagiciteDef(Magicite magiciteDef, Magicite.MagiciteType catalogOverride = Magicite.MagiciteType.None)
		{
			int num = magicites.Length;
			Array.Resize(ref magicites, num + 1);
			magicites[num] = magiciteDef;
			switch ((catalogOverride == Magicite.MagiciteType.None) ? magiciteDef.type : catalogOverride)
			{
			default:
				Debug.LogError((object)"[MystError] Magicite added through MagiciteDef had an invalid type?");
				break;
			case Magicite.MagiciteType.Spell:
				Array.Resize(ref SpellMagicites, SpellMagicites.Length + 1);
				SpellMagicites[SpellMagicites.Length - 1] = num;
				break;
			case Magicite.MagiciteType.Finisher:
				Array.Resize(ref FinisherMagicites, FinisherMagicites.Length + 1);
				FinisherMagicites[FinisherMagicites.Length - 1] = num;
				break;
			case Magicite.MagiciteType.Limit:
				Array.Resize(ref LimitMagicites, LimitMagicites.Length + 1);
				LimitMagicites[LimitMagicites.Length - 1] = num;
				break;
			case Magicite.MagiciteType.Support:
				Array.Resize(ref SupportMagicites, SupportMagicites.Length + 1);
				SupportMagicites[SupportMagicites.Length - 1] = num;
				break;
			}
			SetSortOrder();
			return num;
		}
	}
	public class Magicite
	{
		public enum MagiciteType
		{
			Spell,
			Finisher,
			Support,
			Limit,
			None
		}

		public Sprite icon = Assets.mainAssetBundle.LoadAsset<Sprite>("texBazookaOutIcon");

		public string name = "";

		public string description = "";

		public string info = "";

		public Color color = Color.clear;

		public MagiciteType type = MagiciteType.None;

		public BaseMagiciteSkill Skillstate = null;

		public float EXPperLevel = 100000000f;

		public int levelMAX = 5;

		public int ID = 99999999;
	}
	public class SpellDef
	{
		public Sprite icon = Assets.mainAssetBundle.LoadAsset<Sprite>("texBazookaOutIcon");

		public string name = "Empty";

		public string description = "Nothing here";

		public Color color = Color.white;

		public BaseMagiciteSkill Skillstate = null;
	}
	public class MagiciteDust
	{
		public static ItemDef itemDef;

		public AssetReference reference2;

		private static string prefix = "JAVANGLE_MYST_MAGICITE_";

		public static void setUp()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Expected O, but got Unknown
			GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("MagiciteDust");
			GameObject gameObject = ((Component)val.GetComponent<ChildLocator>().FindChild("MainModel")).gameObject;
			Shader shader = LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/HGStandard");
			Shader shader2 = Addressables.LoadAssetAsync<Shader>((object)"RoR2/Base/Shaders/HGCloudRemap.shader").WaitForCompletion();
			MeshRenderer[] componentsInChildren = gameObject.GetComponentsInChildren<MeshRenderer>();
			foreach (MeshRenderer val2 in componentsInChildren)
			{
				if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Renderer)val2).material))
				{
					((Renderer)val2).material.shader = shader2;
				}
			}
			MeshRenderer component = gameObject.GetComponent<MeshRenderer>();
			if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)((Renderer)component).material))
			{
				((Renderer)component).material.shader = shader;
			}
			itemDef = ScriptableObject.CreateInstance<ItemDef>();
			((Object)itemDef).name = "JavAngleMagiciteDust";
			itemDef.nameToken = prefix + "DUST_NAME";
			itemDef.descriptionToken = prefix + "DUST_DESCRIPTION";
			itemDef.pickupToken = prefix + "DUST_PICKUP";
			itemDef.loreToken = prefix + "DUST_LORE";
			itemDef.pickupModelPrefab = val;
			itemDef.pickupIconSprite = Assets.mainAssetBundle.LoadAsset<Sprite>("textMagiciteIcon2");
			itemDef.deprecatedTier = (ItemTier)5;
			itemDef.hidden = false;
			ItemDisplayRule[] array = (ItemDisplayRule[])(object)new ItemDisplayRule[0];
			CustomItem val3 = new CustomItem(itemDef, array);
			ItemAPI.Add(val3);
		}
	}
}
namespace MystMod.SkillStates
{
	public class EmptySkill : BaseSkillState
	{
		public static SkillDef Empty;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
		}

		public static void SetUpEmpty()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			SkillDefInfo skillDefInfo = new SkillDefInfo();
			skillDefInfo.skillName = "";
			skillDefInfo.skillNameToken = "";
			skillDefInfo.skillDescriptionToken = "";
			skillDefInfo.skillIcon = Assets.mainAssetBundle.LoadAsset<Sprite>("texBazookaOutIcon");
			skillDefInfo.activationState = new SerializableEntityStateType(typeof(EmptySkill));
			skillDefInfo.activationStateMachineName = "Weapon";
			skillDefInfo.baseMaxStock = 1;
			skillDefInfo.baseRechargeInterval = 0f;
			skillDefInfo.beginSkillCooldownOnSkillEnd = false;
			skillDefInfo.canceledFromSprinting = false;
			skillDefInfo.forceSprintDuringState = false;
			skillDefInfo.fullRestockOnAssign = true;
			skillDefInfo.interruptPriority = (InterruptPriority)0;
			skillDefInfo.resetCooldownTimerOnUse = false;
			skillDefInfo.isCombatSkill = false;
			skillDefInfo.mustKeyPress = false;
			skillDefInfo.cancelSprintingOnActivation = false;
			skillDefInfo.rechargeStock = 1;
			skillDefInfo.requiredStock = 1;
			skillDefInfo.stockToConsume = 1;
			Empty = Skills.CreateSkillDef(skillDefInfo);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge > 1f)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	public class BaseMagicChanneledSkill : BaseMagicSkill
	{
		public GameObject channelVFXx;

		public string channelSFXstring = "Magic_Channel";

		private GameObject _channelVFX;

		private uint _channelSFX;

		private string _castAnimString;

		public override void InitStatsAndVariables()
		{
			_castAnimString = animationNameString;
			animationLayerString = "FullBody, Override";
			animationNameString = "ChannelCastEnter";
		}

		public override void OnEnter()
		{
			//IL_0021: 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)
			base.OnEnter();
			animationNameString = _castAnimString;
			_channelVFX = Object.Instantiate<GameObject>(channelVFXx, ((EntityState)this).characterBody.footPosition, ((EntityState)this).characterBody.transform.rotation, ((EntityState)this).characterBody.transform);
			_channelSFX = Util.PlaySound(channelSFXstring, ((EntityState)this).gameObject);
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.Entangle);
			}
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			if (((EntityState)this).fixedAge < castTime && ((EntityState)this).isAuthority && ((EntityState)this).characterBody.master.playerCharacterMasterController.networkUser.inputPlayer.GetButtonDown(18))
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.RemoveBuff(Buffs.Entangle);
			}
			if (!hasCasted)
			{
				((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty", "SpellCast.playbackRate", 1f, 0f);
				destroyChannelFX();
			}
			base.OnExit();
		}

		private void destroyChannelFX()
		{
			if (Object.op_Implicit((Object)(object)_channelVFX) && !Object.op_Implicit((Object)(object)_channelVFX.GetComponent<CustomParticleEnd>()))
			{
				CustomParticleEnd customParticleEnd = _channelVFX.AddComponent<CustomParticleEnd>();
				customParticleEnd.ParticleDuration = 0f;
				customParticleEnd.ParticleFadeTime = 5f;
				AkSoundEngine.StopPlayingID(_channelSFX, 1, (AkCurveInterpolation)4);
			}
		}

		public override void OnCast()
		{
			destroyChannelFX();
			((EntityState)this).PlayAnimation(animationLayerString, animationNameString, "SpellCast.playbackRate", 1f, 0f);
			base.OnCast();
		}
	}
	public class BaseMagiciteSkill : BaseSkillState
	{
		public int finisherIndex = 0;

		public int spellComboIndex = 0;

		public bool resetAfterCast = true;

		public int Level = 1;

		public int MagAll = 0;

		public int MagMulti = 0;

		public int MagTurbo = 0;

		public int MagThrift = 0;

		public int MagUse = 0;

		public int MagKill = 0;

		public int MagHsyphon = 0;

		public int MagLsyphon = 0;

		public bool WildMagicCast = false;

		public bool buttonHoldM = true;

		protected MystPassiveManager passiveManager;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			buttonHoldM = true;
			((EntityState)this).fixedAge = 0f;
			resetAfterCast = true;
			passiveManager = ((EntityState)this).GetComponent<MystPassiveManager>();
		}

		public override void OnExit()
		{
			if (resetAfterCast && spellComboIndex >= MagMulti)
			{
				passiveManager.EquipMagicite();
			}
			if (buttonHoldM && ((EntityState)this).inputBank.skill1.down && finisherIndex > 0)
			{
				if (finisherIndex < 8 && passiveManager.finisherList[finisherIndex].Skillstate != new SpellDef().Skillstate)
				{
					BaseMagiciteSkill skillstate = passiveManager.finisherList[finisherIndex].Skillstate;
					skillstate.finisherIndex = finisherIndex + 1;
					((EntityState)this).outer.SetNextState((EntityState)(object)skillstate);
				}
				else
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)new MystBasicSwing
					{
						areFinishers = true
					});
				}
			}
			else
			{
				((EntityState)this).OnExit();
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (!((EntityState)this).inputBank.skill1.down)
			{
				buttonHoldM = false;
			}
		}

		public void clearModifiers()
		{
			MagAll = 0;
			MagMulti = 0;
			MagTurbo = 0;
			MagThrift = 0;
			MagUse = 0;
			MagKill = 0;
			MagHsyphon = 0;
			MagLsyphon = 0;
			WildMagicCast = false;
		}

		public void Debugger()
		{
			Chat.AddMessage("All" + MagAll);
			Chat.AddMessage("Multi" + MagMulti);
			Chat.AddMessage("Turbo" + MagTurbo);
			Chat.AddMessage("Thrift" + MagThrift);
			Chat.AddMessage("Use" + MagUse);
			Chat.AddMessage("Kill" + MagKill);
			Chat.AddMessage("HSyphon" + MagHsyphon);
			Chat.AddMessage("LSyphon" + MagLsyphon);
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(Level);
			writer.Write(finisherIndex);
			writer.Write(spellComboIndex);
			writer.Write(MagAll);
			writer.Write(MagMulti);
			writer.Write(MagTurbo);
			writer.Write(MagThrift);
			writer.Write(MagUse);
			writer.Write(MagKill);
			writer.Write(MagHsyphon);
			writer.Write(MagLsyphon);
			writer.Write(WildMagicCast);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			Level = reader.ReadInt32();
			finisherIndex = reader.ReadInt32();
			spellComboIndex = reader.ReadInt32();
			MagAll = reader.ReadInt32();
			MagMulti = reader.ReadInt32();
			MagTurbo = reader.ReadInt32();
			MagThrift = reader.ReadInt32();
			MagUse = reader.ReadInt32();
			MagKill = reader.ReadInt32();
			MagHsyphon = reader.ReadInt32();
			MagLsyphon = reader.ReadInt32();
			WildMagicCast = reader.ReadBoolean();
		}
	}
	public class BaseMagicSkill : BaseMagiciteSkill
	{
		public float baseMagicCost = 0f;

		public float basePotency = 0f;

		public float baseDuration = 0.65f;

		public float baseCastTime = 0.6f;

		public string animationLayerString = "";

		public string animationNameString = "";

		public float currentMagicCost;

		public float currentPotency;

		private float duration;

		public float castTime;

		public bool hasCasted = false;

		private bool spellCastSucceed = false;

		public Animator animator;

		public MystTracker tracker;

		public Transform muzzle;

		public virtual void InitStatsAndVariables()
		{
		}

		public override void OnEnter()
		{
			base.OnEnter();
			((EntityState)this).fixedAge = 0f;
			hasCasted = false;
			InitStatsAndVariables();
			currentMagicCost = baseMagicCost;
			currentPotency = baseMagicCost;
			float num = ((spellComboIndex > 0) ? (1f / ((BaseState)this).attackSpeedStat / 5f) : (1f / ((BaseState)this).attackSpeedStat));
			duration = baseDuration * num;
			castTime = baseCastTime * duration;
			animator = ((EntityState)this).GetModelAnimator();
			animator.SetBool("attacking", true);
			((EntityState)this).PlayAnimation(animationLayerString, animationNameString, "SpellCast.playbackRate", 1f * num, 0f);
			((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
			((EntityState)this).characterBody.SetAimTimer(2f);
			((BaseState)this).StartAimMode(0.5f + duration, false);
			muzzle = ((EntityState)this).GetModelChildLocator().FindChild("SwordTipLeft");
			passiveManager = ((EntityState)this).GetComponent<MystPassiveManager>();
			tracker = ((EntityState)this).GetComponent<MystTracker>();
			MagicSupportMethod();
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			if (((EntityState)this).fixedAge >= castTime)
			{
				CastSpell();
			}
			if (hasCasted && ((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				if (spellCastSucceed && spellComboIndex < MagMulti)
				{
					BaseMagicSkill baseMagicSkill = (BaseMagicSkill)Activator.CreateInstance(((object)this).GetType());
					baseMagicSkill.spellComboIndex = spellComboIndex + 1;
					baseMagicSkill.MagMulti = MagMulti;
					((EntityState)this).outer.SetNextState((EntityState)(object)baseMagicSkill);
				}
				else
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		public override void OnExit()
		{
			base.OnExit();
		}

		private void CastSpell()
		{
			if (hasCasted)
			{
				return;
			}
			hasCasted = true;
			spellCastSucceed = false;
			OnCast();
			if (spellComboIndex <= 0 && !passiveManager.ResourceCost(currentMagicCost, 0))
			{
				return;
			}
			spellCastSucceed = true;
			OnCastSuceed();
			CastEffect();
			HurtBox trackingTarget = tracker.GetTrackingTarget();
			TargetCastEffect(trackingTarget);
			HurtBox[] secondaryTargets;
			if (Object.op_Implicit((Object)(object)trackingTarget) && MagAll > 0)
			{
				secondaryTargets = tracker.GetSecondaryTargets();
				for (int i = 0; i < MagAll && i + 1 < secondaryTargets.Length; i++)
				{
					HurtBox val = secondaryTargets[i + 1];
					if (Object.op_Implicit((Object)(object)val))
					{
						TargetCastEffect(val);
					}
				}
			}
			trackingTarget = null;
			secondaryTargets = null;
			trackingTarget = tracker.GetAllyTarget();
			AllyTargetCastEffect(trackingTarget);
			if (!Object.op_Implicit((Object)(object)trackingTarget) || MagAll <= 0)
			{
				return;
			}
			secondaryTargets = tracker.GetAllyTargets();
			for (int j = 0; j < MagAll && j + 1 < secondaryTargets.Length; j++)
			{
				HurtBox val2 = secondaryTargets[j + 1];
				if (Object.op_Implicit((Object)(object)val2))
				{
					AllyTargetCastEffect(val2);
				}
			}
		}

		public virtual void CastEffect()
		{
		}

		public virtual void TargetCastEffect(HurtBox target)
		{
		}

		public virtual void AllyTargetCastEffect(HurtBox target)
		{
		}

		private void MagicSupportMethod()
		{
			float num = 1f;
			num += 0.2f * (float)MagTurbo;
			currentPotency = basePotency;
			currentPotency *= num;
			if (baseMagicCost == float.PositiveInfinity)
			{
				currentMagicCost = passiveManager.magicMAX;
				return;
			}
			num = 1f;
			num += 0.2f * (float)MagTurbo;
			num += -0.1f * (float)MagThrift;
			num += ((MagMulti > 0) ? (0.5f + 0.5f * (float)MagMulti) : 0f);
			currentMagicCost = baseMagicCost;
			currentMagicCost *= num;
			currentMagicCost += Mathf.Max((MagUse > 0) ? (11 + -1 * MagUse) : 0, 0);
			currentMagicCost += Mathf.Max((MagKill > 0) ? (11f + -1f * (float)MagKill) : 0f, 0f);
		}

		public virtual void OnCast()
		{
		}

		public virtual void OnCastSuceed()
		{
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			if (NetworkServer.active)
			{
				if (MagUse > 0)
				{
					GlobalEventManager.instance.OnInteractionBegin(((EntityState)this).gameObject.GetComponent<Interactor>(), passiveManager.interactable, ((Component)((EntityState)this).characterBody).gameObject);
				}
				if (MagKill > 0)
				{
					DamageInfo val = new DamageInfo
					{
						attacker = ((EntityState)this).gameObject
					};
					GameObject val2 = new GameObject();
					val2.transform.position = ((EntityState)this).transform.position;
					HealthComponent val3 = val2.AddComponent<HealthComponent>();
					DamageReport val4 = new DamageReport(val, val3, 1f, ((EntityState)this).healthComponent.combinedHealth);
					GlobalEventManager.instance.OnCharacterDeath(val4);
					EntityState.Destroy((Object)(object)val2);
				}
			}
			if (NetworkServer.active)
			{
				((EntityState)this).healthComponent.Heal(currentMagicCost / 25f * (float)MagHsyphon * ((EntityState)this).characterBody.damage, default(ProcChainMask), true);
			}
			passiveManager.GrantNetworkedLimit(currentMagicCost / 50f * (float)MagLsyphon);
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	public class EmptySlot : BaseMagiciteSkill
	{
		public override void OnEnter()
		{
			base.OnEnter();
		}

		public override void OnExit()
		{
			base.OnExit();
		}

		public override void FixedUpdate()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			base.FixedUpdate();
			bool flag = false;
			if (((EntityState)this).inputBank.skill1.down)
			{
				flag = true;
			}
			if (((EntityState)this).inputBank.skill2.down)
			{
				flag = true;
			}
			if (((EntityState)this).inputBank.skill3.down)
			{
				flag = true;
			}
			if (((EntityState)this).inputBank.skill4.down)
			{
				flag = true;
			}
			KeyboardShortcut value = Config.ExtraSlot1.Value;
			if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
			{
				flag = true;
			}
			value = Config.ExtraSlot2.Value;
			if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
			{
				flag = true;
			}
			value = Config.ExtraSlot3.Value;
			if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
			{
				flag = true;
			}
			value = Config.ExtraSlot4.Value;
			if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
			{
				flag = true;
			}
			if (!flag)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	public class ObtainedMagicite
	{
		public Magicite magicite = MagiciteDefs.magicites[0];

		public int levelRN = 1;

		public int levelMAX = 5;

		public float EXPtoNextLevel = 100000000f;

		private float EXPperLevel = 100000000f;

		public bool grantEXP(float exp)
		{
			if (levelRN < levelMAX)
			{
				EXPtoNextLevel -= exp;
				if (EXPtoNextLevel <= 0f)
				{
					levelRN++;
					EXPtoNextLevel += EXPperLevel;
					return true;
				}
			}
			return false;
		}

		public void SetUpMagicite()
		{
			EXPperLevel = magicite.EXPperLevel;
			levelMAX = magicite.levelMAX;
			EXPtoNextLevel = EXPperLevel;
		}
	}
	public class MystMain : GenericCharacterMain
	{
		private Animator animator;

		private MystController mystController;

		private MystPassiveManager passiveManager;

		protected EntityStateMachine weaponStateMachine;

		public LocalUser localUser;

		private EntityStateMachine stateMachine;

		public override void OnEnter()
		{
			((GenericCharacterMain)this).OnEnter();
			animator = ((EntityState)this).GetModelAnimator();
			mystController = ((EntityState)this).GetComponent<MystController>();
			passiveManager = ((EntityState)this).GetComponent<MystPassiveManager>();
			localUser = LocalUserManager.readOnlyLocalUsersList[0];
			EntityStateMachine[] components = ((EntityState)this).gameObject.GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val in components)
			{
				if (Object.op_Implicit((Object)(object)val) && val.customName == "Weapon")
				{
					weaponStateMachine = val;
				}
			}
			stateMachine = EntityStateMachine.FindByCustomName(((Component)((EntityState)this).characterBody).gameObject, "Weapon");
		}

		public override void Update()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			((GenericCharacterMain)this).Update();
			if (!((EntityState)this).isAuthority || passiveManager.isInFormchange || !((EntityState)this).characterBody.isPlayerControlled || !stateMachine.IsInMainState() || !((EntityState)this).characterMotor.isGrounded || !(((EntityState)this).characterMotor.velocity == Vector3.zero) || localUser.isUIFocused)
			{
				return;
			}
			KeyboardShortcut value = Config.OpenMenu.Value;
			if (((KeyboardShortcut)(ref value)).IsDown())
			{
				((EntityState)this).characterBody.isSprinting = false;
				((EntityState)this).outer.SetInterruptState((EntityState)(object)new MagiciteMenu(), (InterruptPriority)2);
				return;
			}
			value = Config.Emote.Value;
			if (((KeyboardShortcut)(ref value)).IsDown())
			{
				((EntityState)this).characterBody.isSprinting = false;
				((EntityState)this).outer.SetInterruptState((EntityState)(object)new MystTaunt(), (InterruptPriority)2);
			}
		}

		public override void FixedUpdate()
		{
			((GenericCharacterMain)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)animator))
			{
				float num = 1f;
				if (animator.GetBool("isGrounded"))
				{
					num = 0f;
				}
				animator.SetFloat("inAir", num);
				animator.SetBool("inCombat", !((EntityState)this).characterBody.outOfCombat || !((EntityState)this).characterBody.outOfDanger);
			}
			if (Object.op_Implicit((Object)(object)mystController))
			{
				animator.SetBool("inBazooka", mystController.hasBazookaReady);
				if (mystController.hasBazookaReady)
				{
					((EntityState)this).characterBody.isSprinting = false;
					((BaseState)this).StartAimMode(0.5f, false);
				}
			}
		}
	}
}
namespace MystMod.SkillStates.Myst
{
	public class LimitMenu : BaseSkillState
	{
		private MystPassiveManager MystHuD;

		private bool buttonReleased;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			buttonReleased = false;
			MystHuD = ((EntityState)this).GetComponent<MystPassiveManager>();
			MystHuD.SetIconsLimit();
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			MystHuD.SetIconsDefault();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			SpellSelect();
			SprintCancel();
		}

		private void SpellSelect()
		{
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)this).isAuthority)
			{
				if (!((EntityState)this).inputBank.skill4.down)
				{
					buttonReleased = true;
				}
				if (((EntityState)this).inputBank.skill1.down)
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)MystHuD.limitList[0].Skillstate);
				}
				if (((EntityState)this).inputBank.skill2.down)
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)MystHuD.limitList[1].Skillstate);
				}
				if (((EntityState)this).inputBank.skill3.down)
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)MystHuD.limitList[2].Skillstate);
				}
				if (((EntityState)this).inputBank.skill4.down && buttonReleased)
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)MystHuD.limitList[3].Skillstate);
				}
				KeyboardShortcut value = Config.ExtraSlot1.Value;
				if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)MystHuD.limitList[4].Skillstate);
				}
				value = Config.ExtraSlot2.Value;
				if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)MystHuD.limitList[5].Skillstate);
				}
				value = Config.ExtraSlot3.Value;
				if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)MystHuD.limitList[6].Skillstate);
				}
				value = Config.ExtraSlot4.Value;
				if (Input.GetKey(((KeyboardShortcut)(ref value)).MainKey))
				{
					((EntityState)this).outer.SetNextState((EntityState)(object)MystHuD.limitList[7].Skillstate);
				}
			}
		}

		private void SprintCancel()
		{
			((EntityState)this).characterBody.isSprinting = false;
			if (((EntityState)this).isAuthority && ((EntityState)this).characterBody.isPlayerControlled && ((EntityState)this).characterBody.master.playerCharacterMasterController.networkUser.inputPlayer.GetButtonDown(18))
			{
				((EntityState)this).characterBody.isSprinting = true;
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	public class MagiciteMenu : BaseSkillState
	{
		private MystPassiveManager MystHuD;

		private Animator animator;

		public bool normalizeModel;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			animator = ((EntityState)this).GetModelAnimator();
			MystHuD = ((EntityState)this).GetComponent<MystPassiveManager>();
			MystHuD.OpenMagiciteMenu();
			((EntityState)this).characterBody.hideCrosshair = true;
			if (Object.op_Implicit((Object)(object)((EntityState)this).GetAimAnimator()))
			{
				((Behaviour)((EntityState)this).GetAimAnimator()).enabled = false;
			}
			animator.SetLayerWeight(animator.GetLayerIndex("AimPitch"), 0f);
			animator.SetLayerWeight(animator.GetLayerIndex("AimYaw"), 0f);
			((EntityState)this).PlayAnimation("FullBody, Override", "THONK");
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
			((EntityState)this).characterBody.hideCrosshair = false;
			if (((EntityState)this).isAuthority)
			{
				MPEventSystem combinedEventSystem = MPEventSystemManager.combinedEventSystem;
				combinedEventSystem.cursorOpenerCount -= 1;
			}
			if (Object.op_Implicit((Object)(object)MystHuD))
			{
				MystHuD.CloseMagiciteMenu();
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).GetAimAnimator()))
			{
				((Behaviour)((EntityState)this).GetAimAnimator()).enabled = true;
			}
			if (Object.op_Implicit((Object)(object)animator))
			{
				animator.SetBool("attacking", true);
				animator.SetLayerWeight(animator.GetLayerIndex("AimPitch"), 1f);
				animator.SetLayerWeight(animator.GetLayerIndex("AimYaw"), 1f);
			}
			((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
		}

		public override void FixedUpdate()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			KeyboardShortcut value = Config.OpenMenu.Value;
			if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			SprintCancel();
		}

		private void SprintCancel()
		{
			if (((EntityState)this).isAuthority)
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.master) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.master.playerCharacterMasterController) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.master.playerCharacterMasterController.networkUser) && ((EntityState)this).characterBody.master.playerCharacterMasterController.networkUser.inputPlayer.GetButtonDown(18))
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
				else if (Input.GetKeyDown((KeyCode)27))
				{
					Console.instance.SubmitCmd((NetworkUser)null, "pause", false);
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)2;
		}
	}
	public class MagicMenu : BaseSkillState
	{
		private MystPassiveManager MystHuD;

		private bool buttonReleased;

		public override void OnEnter()
		{
			((EntityState)this).characterBody.isSprinting = false;
			((BaseState)this).OnEnter();
			buttonReleased = false;
			MystHuD = ((EntityState)this).GetComponent<MystPassiveManager>();
			MystHuD.SetIconsMagic();