Decompiled source of ChirrAltSkills v0.0.2

ChirrAltSkills.dll

Decompiled 10 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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 BepInEx.Logging;
using ChirrAltSkills;
using ChirrAltSkills.Chirr;
using ChirrAltSkills.Chirr.SkillDefs;
using ChirrAltSkills.Chirr.SkillDefs.Passive;
using ChirrAltSkills.Chirr.SkillDefs.Special;
using ChirrAltSkills.Chirr.SkillDefs.TargetableSkillDef;
using ChirrAltSkills.Chirr.States;
using ChirrAltSkills.Chirr.States.CharacterMains;
using ChirrAltSkills.Chirr.States.Primary;
using ChirrAltSkills.Chirr.States.Special;
using DiggerPlugin;
using EntityStates;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.GummyClone;
using EntityStates.Mage;
using EntityStates.SS2UStates.Chirr;
using HG;
using HG.Reflection;
using JetBrains.Annotations;
using On.RoR2;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using RoR2;
using RoR2.Skills;
using Starstorm2Unofficial.Survivors.Chirr;
using Starstorm2Unofficial.Survivors.Chirr.Components;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("ChirrAltSkills")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+459ca2f2a3065e0b85241076a402e1d93d2f9aa0")]
[assembly: AssemblyProduct("ChirrAltSkills")]
[assembly: AssemblyTitle("ChirrAltSkills")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
internal static class ChirrSetupHelpers
{
	public static void AddToSkillFamily(SkillDef skillDef, SkillFamily skillFamily, UnlockableDef unlockableDef = null)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		ref Variant[] variants = ref skillFamily.variants;
		Variant val = new Variant
		{
			skillDef = skillDef
		};
		((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null);
		val.unlockableDef = unlockableDef;
		ArrayUtils.ArrayAppend<Variant>(ref variants, ref val);
	}

	public static void CopySkillDefFields(SkillDef parent, SkillDef child, bool copyIdentifiers)
	{
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)parent) && Object.op_Implicit((Object)(object)child))
		{
			Debug.LogError((object)("Attempted to call CopySkillDefFields with no parent! Child: " + child.skillName));
		}
		if (!Object.op_Implicit((Object)(object)child) && Object.op_Implicit((Object)(object)parent))
		{
			Debug.LogError((object)("Attempted to call CopySkillDefFields with no child! Parent: " + parent.skillName));
		}
		if (!Object.op_Implicit((Object)(object)child) && !Object.op_Implicit((Object)(object)parent))
		{
			Debug.LogError((object)"Attempted to call CopySkillDefFields with no child or parent!!!");
		}
		child.activationState = parent.activationState;
		child.activationStateMachineName = parent.activationStateMachineName;
		child.baseMaxStock = parent.baseMaxStock;
		child.baseRechargeInterval = parent.baseRechargeInterval;
		child.beginSkillCooldownOnSkillEnd = parent.beginSkillCooldownOnSkillEnd;
		child.canceledFromSprinting = parent.canceledFromSprinting;
		child.cancelSprintingOnActivation = parent.cancelSprintingOnActivation;
		child.dontAllowPastMaxStocks = parent.dontAllowPastMaxStocks;
		child.forceSprintDuringState = parent.forceSprintDuringState;
		child.fullRestockOnAssign = parent.fullRestockOnAssign;
		child.icon = parent.icon;
		child.interruptPriority = parent.interruptPriority;
		child.isCombatSkill = parent.isCombatSkill;
		child.keywordTokens = parent.keywordTokens;
		child.mustKeyPress = parent.mustKeyPress;
		child.rechargeStock = parent.rechargeStock;
		child.requiredStock = parent.requiredStock;
		child.resetCooldownTimerOnUse = parent.resetCooldownTimerOnUse;
		if (copyIdentifiers)
		{
			child.skillDescriptionToken = parent.skillDescriptionToken;
			child.skillName = parent.skillName;
			child.skillNameToken = parent.skillNameToken;
		}
		child.stockToConsume = parent.stockToConsume;
	}

	public static T CreateSkillDef<T>(string token, bool setDefaultStateToIdle = true) where T : AssignableSkillDef
	{
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)token);
		T val = ScriptableObject.CreateInstance<T>();
		((SkillDef)val).skillName = token;
		((Object)val).name = token;
		((SkillDef)val).skillNameToken = token + "_NAME";
		((SkillDef)val).skillDescriptionToken = token + "_DESC";
		if (setDefaultStateToIdle)
		{
			((SkillDef)val).activationState = new SerializableEntityStateType(typeof(Idle));
		}
		return val;
	}

	public static ChirrTargetableSkillDef CreateTargetableSkillDef(string token)
	{
		return CreateSkillDef(token) as ChirrTargetableSkillDef;
	}

	public static SkillDef CreateSkillDef(string token)
	{
		SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
		val.skillName = token;
		((Object)val).name = token;
		val.skillNameToken = token + "_NAME";
		val.skillDescriptionToken = token + "_DESC";
		return val;
	}

	public static SkillDef CreateSkillDef(string token, SkillFamily family, UnlockableDef unlockableDef = null)
	{
		SkillDef val = CreateSkillDef(token);
		AddToSkillFamily(val, family, unlockableDef);
		return val;
	}
}
namespace ChirrAltSkills
{
	public static class Assets
	{
		public static class ChirrAssets
		{
			public static Sprite passiveStageBuffIcon;

			public static Sprite passiveSnackiesPerStageIcon;

			public static Sprite passiveBunnyIcon;

			public static Sprite passiveSoulmateIcon;

			public static Sprite passiveDiggerIcon;

			public static Sprite primaryLeafBladeIcon;

			public static Sprite secondaryHeadbuttWeakenIcon;

			public static Sprite specialTFIcon;

			public static Sprite specialTransformScepterIcon;

			public static Sprite specialEatIcon;

			public static Sprite specialEatScepterIcon;

			public static Sprite buffIndulgenceIcon;

			public static Sprite buffSnackiesIcon;

			public static Sprite buffSoulmateIcon;

			public static Sprite buffAdrenalineIcon;

			public static Sprite buffHoverDurationIcon;

			public static Sprite buffBunnyJumpIcon;

			public static Sprite LoadSprite(string path)
			{
				return mainAssetBundle.LoadAsset<Sprite>(path);
			}

			public static void Init()
			{
				passiveStageBuffIcon = LoadSprite("PassiveStageBuffIcon");
				passiveSnackiesPerStageIcon = LoadSprite("PassiveSnackiesPerStageIcon");
				passiveBunnyIcon = LoadSprite("PassiveBunnyIcon");
				passiveSoulmateIcon = LoadSprite("PassiveSoulmateIcon");
				passiveDiggerIcon = LoadSprite("PassiveDiggerIcon");
				specialTFIcon = LoadSprite("SpecialTransformEnemyIcon");
				specialTransformScepterIcon = LoadSprite("SpecialTransformEnemyScepterIcon");
				specialEatIcon = LoadSprite("SpecialEatEnemyIcon");
				specialEatScepterIcon = LoadSprite("SpecialEatEnemyScepterIcon");
				buffSnackiesIcon = LoadSprite("BuffSnackiesIcon");
				buffIndulgenceIcon = buffSnackiesIcon;
				buffSoulmateIcon = LoadSprite("BuffSoulmateIcon");
				buffAdrenalineIcon = LoadSprite("BuffAdrenalineIcon");
				buffHoverDurationIcon = LoadSprite("BuffHoverDurationIcon");
				buffBunnyJumpIcon = LoadSprite("BuffBunnyJumpIcon");
			}
		}

		public static AssetBundle mainAssetBundle;

		public const string bundleName = "chirraltskillsassetbundle";

		public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(CASPlugin.PInfo.Location), "chirraltskillsassetbundle");

		public static T LoadAddressable<T>(string path)
		{
			//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)
			return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
		}

		public static void Init()
		{
			PopulateAssets();
			ChirrAssets.Init();
		}

		public static void PopulateAssets()
		{
			mainAssetBundle = AssetBundle.LoadFromFile(AssetBundlePath);
		}
	}
	public class AssignableSkillDef : SkillDef
	{
		public Func<GenericSkill, BaseSkillInstanceData> onAssign;

		public Action<GenericSkill> onUnassign;

		public override BaseSkillInstanceData OnAssigned(GenericSkill skillSlot)
		{
			return onAssign?.Invoke(skillSlot);
		}

		public override void OnUnassigned(GenericSkill skillSlot)
		{
			((SkillDef)this).OnUnassigned(skillSlot);
			onUnassign?.Invoke(skillSlot);
		}
	}
	internal class Buffs
	{
		public static BuffDef indulgenceBuff;

		public static BuffDef snackiesBuff;

		public static BuffDef soulmateBuff;

		public static BuffDef adrenalineBuff;

		public static BuffDef hoverDurationIndicatorBuff;

		public static BuffDef bunnyJumpBuff;

		public static void Init()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			CreateBuffs();
			RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
		}

		private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			int buffCount = sender.GetBuffCount(snackiesBuff);
			int buffCount2 = sender.GetBuffCount(indulgenceBuff);
			int num = buffCount + buffCount2;
			if (num > 0)
			{
				args.armorAdd += 0.005f * (float)num;
				args.attackSpeedMultAdd -= 0.003f * (float)num;
				args.baseHealthAdd += (float)(15 * num);
				args.jumpPowerMultAdd -= 0.001f * (float)num;
				args.moveSpeedReductionMultAdd += 0.005f * (float)num;
				sender.characterMotor.mass = ChirrSetup.cachedMass + ChirrSetup.cachedMass / 10f * (float)num;
			}
			int buffCount3 = sender.GetBuffCount(soulmateBuff);
			if (buffCount3 > 0)
			{
				args.armorAdd += 5f * (float)buffCount3;
				args.baseRegenAdd += 0.5f * (float)buffCount3;
				args.healthMultAdd += 0.1f * (float)buffCount3;
			}
			int buffCount4 = sender.GetBuffCount(bunnyJumpBuff);
			if (buffCount4 > 0)
			{
				args.jumpPowerMultAdd += 0.1f * (float)buffCount4;
			}
		}

		public static void CreateBuffs()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Expected O, but got Unknown
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			snackiesBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)snackiesBuff).name = "DCSS2UChirrSnackies";
			snackiesBuff.buffColor = new Color(0.98f, 0.376f, 0f);
			snackiesBuff.canStack = true;
			snackiesBuff.iconSprite = Assets.ChirrAssets.buffSnackiesIcon;
			snackiesBuff.isCooldown = false;
			snackiesBuff.isDebuff = false;
			snackiesBuff.isHidden = false;
			ContentAddition.AddBuffDef(snackiesBuff);
			indulgenceBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)indulgenceBuff).name = "DCSS2UChirrIndulgence";
			indulgenceBuff.buffColor = new Color(0.69f, 0.104f, 0.104f);
			indulgenceBuff.iconSprite = Assets.ChirrAssets.buffIndulgenceIcon;
			indulgenceBuff.canStack = true;
			indulgenceBuff.isCooldown = false;
			indulgenceBuff.isDebuff = false;
			indulgenceBuff.isHidden = false;
			ContentAddition.AddBuffDef(indulgenceBuff);
			soulmateBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)soulmateBuff).name = "DCSS2UChirrComfortingPresence";
			soulmateBuff.buffColor = new Color(0.351f, 0.77f, 0.246f);
			soulmateBuff.iconSprite = Assets.ChirrAssets.buffSoulmateIcon;
			soulmateBuff.canStack = true;
			soulmateBuff.isCooldown = false;
			soulmateBuff.isDebuff = false;
			soulmateBuff.isHidden = false;
			ContentAddition.AddBuffDef(soulmateBuff);
			if (CASPlugin.modloaded_Digger)
			{
				BuffCatalog.Init += new hook_Init(GetDiggerGoldRush);
			}
			else
			{
				adrenalineBuff = ScriptableObject.CreateInstance<BuffDef>();
				((Object)adrenalineBuff).name = "DCSS2UChirrAdrenaline";
				adrenalineBuff.buffColor = new Color(0.753f, 0.77f, 0.246f);
				adrenalineBuff.iconSprite = Assets.ChirrAssets.buffAdrenalineIcon;
				adrenalineBuff.canStack = true;
				adrenalineBuff.isCooldown = false;
				adrenalineBuff.isDebuff = false;
				adrenalineBuff.isHidden = false;
				RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(ChirrGoldRushRecalcStats);
			}
			hoverDurationIndicatorBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)hoverDurationIndicatorBuff).name = "DCSS2UChirrHoverDurationRemaining";
			hoverDurationIndicatorBuff.buffColor = new Color(0.351f, 0.77f, 0.246f);
			hoverDurationIndicatorBuff.iconSprite = Assets.ChirrAssets.buffHoverDurationIcon;
			hoverDurationIndicatorBuff.canStack = true;
			hoverDurationIndicatorBuff.isCooldown = false;
			hoverDurationIndicatorBuff.isDebuff = false;
			hoverDurationIndicatorBuff.isHidden = false;
			ContentAddition.AddBuffDef(hoverDurationIndicatorBuff);
			bunnyJumpBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)bunnyJumpBuff).name = "DCSS2UChirrBunnyJumpBoost";
			bunnyJumpBuff.buffColor = new Color(0.351f, 0.77f, 0.246f);
			bunnyJumpBuff.iconSprite = Assets.ChirrAssets.buffBunnyJumpIcon;
			bunnyJumpBuff.canStack = true;
			bunnyJumpBuff.isCooldown = false;
			bunnyJumpBuff.isDebuff = false;
			bunnyJumpBuff.isHidden = false;
			ContentAddition.AddBuffDef(bunnyJumpBuff);
		}

		private static void ChirrGoldRushRecalcStats(CharacterBody sender, StatHookEventArgs args)
		{
			int buffCount = sender.GetBuffCount(adrenalineBuff);
			if (buffCount > 0)
			{
				args.attackSpeedMultAdd += 0.1f * (float)buffCount;
				args.baseMoveSpeedAdd += 0.15f * (float)buffCount;
				args.baseRegenAdd += 0.25f * (float)buffCount;
			}
		}

		private static void GetDiggerGoldRush(orig_Init orig)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke();
			adrenalineBuff = BuffCatalog.GetBuffDef(BuffCatalog.FindBuffIndex("GoldRush"));
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.DestroyedClone.ChirrAltSkills", "ChirrSS2U Alt Skills", "0.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class CASPlugin : BaseUnityPlugin
	{
		internal static ManualLogSource _logger;

		internal static ConfigFile _config;

		internal const string LastDllVersion = "0.16.4";

		public static bool modloaded_Digger;

		public static bool modloaded_ClassicItems;

		public static bool modloaded_Scepter;

		public static PluginInfo PInfo { get; set; }

		public void Awake()
		{
			PInfo = ((BaseUnityPlugin)this).Info;
			_logger = ((BaseUnityPlugin)this).Logger;
			_config = ((BaseUnityPlugin)this).Config;
			modloaded_Digger = Chainloader.PluginInfos.ContainsKey("com.rob.DiggerUnearthed");
			modloaded_ClassicItems = Chainloader.PluginInfos.ContainsKey("com.ThinkInvisible.ClassicItems");
			modloaded_Scepter = Chainloader.PluginInfos.ContainsKey("com.DestroyedClone.AncientScepter");
			ConfigSetup.Init();
			Assets.Init();
			Buffs.Init();
			DamageTypes.Init();
			ChirrSetup.Init();
			ChirrCommands.AddChatCommands();
			Networking.Init();
		}
	}
	internal class ConfigSetup
	{
		public static ConfigEntry<bool> cfgEnablePassiveStageBuff;

		public static ConfigEntry<bool> cfgEnablePassiveSnackies;

		public static ConfigEntry<bool> cfgEnablePassiveBunny;

		public static ConfigEntry<bool> cfgEnablePassiveSoulmate;

		public static ConfigEntry<bool> cfgEnablePassiveDigger;

		public static ConfigEntry<bool> cfgEnablePrimaryDoubleTap;

		public static ConfigEntry<bool> cfgEnableSpecialTransform;

		public static ConfigEntry<bool> cfgEnableSpecialEat;

		private const string desc = "Enable this skill for usage.";

		public static void Init()
		{
			cfgEnablePassiveStageBuff = CASPlugin._config.Bind<bool>("Passive", "Stage Buff", true, "Enable this skill for usage.");
			cfgEnablePassiveSnackies = CASPlugin._config.Bind<bool>("Passive", "Snackies", true, "Enable this skill for usage.");
			cfgEnablePassiveBunny = CASPlugin._config.Bind<bool>("Passive", "Bunny", true, "Enable this skill for usage.");
			cfgEnablePassiveSoulmate = CASPlugin._config.Bind<bool>("Passive", "Soulmate", true, "Enable this skill for usage.");
			cfgEnablePassiveDigger = CASPlugin._config.Bind<bool>("Passive", "Digger", true, "Enable this skill for usage.");
			cfgEnablePrimaryDoubleTap = CASPlugin._config.Bind<bool>("Primary", "Double Tap", true, "Enable this skill for usage.");
			cfgEnableSpecialTransform = CASPlugin._config.Bind<bool>("Special", "Transform", true, "Enable this skill for usage.");
			cfgEnableSpecialEat = CASPlugin._config.Bind<bool>("Special", "Eat", true, "Enable this skill for usage.");
		}
	}
	internal class DamageTypes
	{
		public static ModdedDamageType chirrChompDT;

		public static void Init()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			chirrChompDT = DamageAPI.ReserveDamageType();
			GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal;
		}

		private static void GlobalEventManager_onCharacterDeathGlobal(DamageReport dr)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)dr.attacker) && dr.attackerBodyIndex == ChirrCore.bodyIndex && DamageAPI.HasModdedDamageType(dr.damageInfo, chirrChompDT))
			{
				EatEnemy(dr);
			}
		}

		private static void EatEnemy(DamageReport damageReport)
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			float num = damageReport.combinedHealthBeforeDamage / damageReport.victimBody.healthComponent.fullCombinedHealth;
			float num2 = num * 100f;
			float num3 = 10f + 1f * num2 * 0.5f;
			int num4 = Mathf.CeilToInt(num2 * 0.5f);
			for (int i = 0; i < num4; i++)
			{
				damageReport.attackerBody.AddTimedBuff(Buffs.snackiesBuff, num3);
			}
			int buffCount = damageReport.victimBody.GetBuffCount(Buffs.snackiesBuff);
			buffCount += damageReport.victimBody.GetBuffCount(Buffs.indulgenceBuff);
			float num5 = 10f;
			for (int j = 0; j < buffCount; j++)
			{
				damageReport.attackerBody.AddTimedBuff(Buffs.snackiesBuff, num5);
			}
			EffectData val = new EffectData
			{
				origin = damageReport.attackerBody.corePosition
			};
			val.SetNetworkedObjectReference(damageReport.attacker);
			EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/FruitHealEffect"), val, true);
			damageReport.attackerBody.healthComponent.HealFraction(num, default(ProcChainMask));
		}
	}
	public class Networking
	{
		public class SendToClient_ChirrStatInfo : INetMessage, ISerializableObject
		{
			public NetworkInstanceId targetNetId;

			private const string formatToken = "DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_1";

			private const string armorToken = "DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_ARMOR";

			public float armor;

			private const string attackspeedToken = "DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_ATTACKSPEED";

			public float attackspeed;

			private const string movespeedToken = "DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_MOVESPEED";

			public float movespeed;

			private const string regenToken = "DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_REGEN";

			public float regen;

			private const string hoverToken = "DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_HOVER";

			public float hover;

			public SendToClient_ChirrStatInfo()
			{
			}

			public SendToClient_ChirrStatInfo(NetworkInstanceId targetNetId, float armor, float movespeed, float attackspeed, float regen, float hover)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				this.targetNetId = targetNetId;
				this.armor = armor;
				this.movespeed = movespeed;
				this.attackspeed = attackspeed;
				this.regen = regen;
				this.hover = hover;
			}

			public void Deserialize(NetworkReader reader)
			{
				//IL_0003: 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)
				targetNetId = reader.ReadNetworkId();
				armor = reader.ReadSingle();
				movespeed = reader.ReadSingle();
				attackspeed = reader.ReadSingle();
				regen = reader.ReadSingle();
				hover = reader.ReadSingle();
			}

			public void OnReceived()
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				if (!(((NetworkBehaviour)LocalUserManager.GetFirstLocalUser().currentNetworkUser).netId != targetNetId))
				{
					string stringFormatted = Language.GetStringFormatted("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_1", new object[10]
					{
						Language.GetString("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_ARMOR"),
						armor.ToString(),
						Language.GetString("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_ATTACKSPEED"),
						$"{attackspeed:P}",
						Language.GetString("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_MOVESPEED"),
						$"{movespeed:P}",
						Language.GetString("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_REGEN"),
						regen.ToString(),
						Language.GetString("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_HOVER"),
						$"{hover:P}"
					});
					Chat.AddMessage(stringFormatted);
				}
			}

			public void Serialize(NetworkWriter writer)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				writer.Write(targetNetId);
				writer.Write(armor);
				writer.Write(attackspeed);
				writer.Write(movespeed);
				writer.Write(regen);
				writer.Write(hover);
			}
		}

		public class SendToAllSimpleChatMessage : INetMessage, ISerializableObject
		{
			public string formatToken;

			public string paramTokens;

			public SendToAllSimpleChatMessage()
			{
			}

			public SendToAllSimpleChatMessage(string formatToken, string paramTokens)
			{
				this.formatToken = formatToken;
				this.paramTokens = paramTokens;
			}

			public void Deserialize(NetworkReader reader)
			{
				formatToken = reader.ReadString();
				paramTokens = reader.ReadString();
			}

			public void OnReceived()
			{
				List<string> list = new List<string>();
				string[] array = paramTokens.Split(new char[1] { ',' });
				foreach (string text in array)
				{
					list.Add(Language.GetString(text));
				}
				Chat.AddMessage(Language.GetStringFormatted(formatToken, new object[1] { list }));
			}

			public void Serialize(NetworkWriter writer)
			{
				writer.Write(formatToken);
				writer.Write(paramTokens);
			}
		}

		public static void Init()
		{
			NetworkingAPI.RegisterMessageType<SendToClient_ChirrStatInfo>();
		}
	}
}
namespace ChirrAltSkills.Chirr
{
	internal class ChirrCommands
	{
		public static void AddChatCommands()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			Chat.SendBroadcastChat_ChatMessageBase += new hook_SendBroadcastChat_ChatMessageBase(ActivateChatCommand);
		}

		private static void ActivateChatCommand(orig_SendBroadcastChat_ChatMessageBase orig, ChatMessageBase message)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			UserChatMessage val = (UserChatMessage)(object)((message is UserChatMessage) ? message : null);
			if (val != null && !(val.text.ToLower() != "/chirrstage"))
			{
				ChirrStageBuffInfo.GetCurrentStageBuffInfo().SendChatChangeMessage(((NetworkBehaviour)val.sender.GetComponent<NetworkUser>()).netId);
				val.text += " [!]";
				orig.Invoke(message);
			}
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CCPrintStageBuffInfo(ConCommandArgs _)
		{
			if (!Object.op_Implicit((Object)(object)Run.instance))
			{
				Debug.LogWarning((object)"Can't run cas_printstagebuff without being in a run!");
			}
			else
			{
				ChirrStageBuffInfo.GetCurrentStageBuffInfo().LogChangeMessage();
			}
		}
	}
	public class ChirrSetup
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Init <>9__20_0;

			internal void <Init>b__20_0(orig_Init orig)
			{
				//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)
				orig.Invoke();
				commandoBodyIndex = BodyCatalog.FindBodyIndex("CommandoBody");
			}
		}

		public static float cachedMass;

		public static GameObject bodyPrefab;

		public static SkillLocator skillLocator;

		public static EntityStateMachine passiveESM;

		public static GenericSkill passiveSkill;

		public static SkillFamily passiveSkillFamily;

		public static PassiveStageBuffSD passiveStageBuffSD;

		public static PassiveSnackiesPerStageSD passiveSnackiesSD;

		public static PassiveBunnySD passiveBunnySD;

		public static PassiveSoulmateSD passiveSoulmateSD;

		public static PassiveDiggerSD passiveDiggerSD;

		public static PassiveTakeFlightSD passiveDefaultSD;

		public static SteppedSkillDef primaryDoubleTapSD;

		public static TransformEnemySD specialTransformSD;

		public static TransformEnemyScepterSD specialTransformScepterSD;

		public static EatEnemySD specialEatSD;

		public static EatEnemyScepterSD specialEatScepterSD;

		public static List<CharacterBody> chirrSoulmates = new List<CharacterBody>();

		public static List<CharacterBody> commandoSoulmates = new List<CharacterBody>();

		public static BodyIndex commandoBodyIndex;

		public static void Init()
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			bodyPrefab = ChirrCore.chirrPrefab;
			cachedMass = bodyPrefab.GetComponent<CharacterMotor>().mass;
			skillLocator = bodyPrefab.GetComponent<SkillLocator>();
			ChirrTracker chirrTracker = bodyPrefab.AddComponent<ChirrTracker>();
			((Behaviour)chirrTracker).enabled = false;
			RevertBaseChanges();
			SetupPassive();
			SetupPrimary();
			SetupSpecial();
			CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal;
			GlobalEventManager.onCharacterDeathGlobal += Server_onCharacterDeath;
			Run.onServerGameOver += Run_ResetSoulmates;
			Stage.onServerStageComplete += Stage_ResetSoulmates;
			object obj = <>c.<>9__20_0;
			if (obj == null)
			{
				hook_Init val = delegate(orig_Init orig)
				{
					//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)
					orig.Invoke();
					commandoBodyIndex = BodyCatalog.FindBodyIndex("CommandoBody");
				};
				<>c.<>9__20_0 = val;
				obj = (object)val;
			}
			BodyCatalog.Init += (hook_Init)obj;
			ChirrStageBuffInfo.Init();
			if (CASPlugin.modloaded_Scepter)
			{
				ScepterSetup();
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void ScepterSetup()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//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)
			bool flag = default(bool);
			ContentAddition.AddEntityState<TransformEnemyScepterES>(ref flag);
			specialTransformScepterSD = ChirrSetupHelpers.CreateSkillDef<TransformEnemyScepterSD>("DESCLONE_SS2UCHIRR_TRANSFORM_SCEPTER");
			ChirrSetupHelpers.CopySkillDefFields((SkillDef)(object)specialTransformSD, (SkillDef)(object)specialTransformScepterSD, copyIdentifiers: false);
			((SkillDef)specialTransformScepterSD).activationState = new SerializableEntityStateType(typeof(TransformEnemyScepterES));
			((SkillDef)specialTransformScepterSD).icon = Assets.ChirrAssets.specialTransformScepterIcon;
			ContentAddition.AddSkillDef((SkillDef)(object)specialTransformScepterSD);
			ContentAddition.AddEntityState<EatEnemyScepterES>(ref flag);
			specialEatScepterSD = ChirrSetupHelpers.CreateSkillDef<EatEnemyScepterSD>("DESCLONE_SS2UCHIRR_EAT_SCEPTER");
			ChirrSetupHelpers.CopySkillDefFields((SkillDef)(object)specialEatSD, (SkillDef)(object)specialEatScepterSD, copyIdentifiers: false);
			((SkillDef)specialEatScepterSD).activationState = new SerializableEntityStateType(typeof(EatEnemyScepterES));
			((SkillDef)specialEatScepterSD).icon = Assets.ChirrAssets.specialEatScepterIcon;
			((SkillDef)specialEatScepterSD).keywordTokens = new string[1] { "DESCLONE_SS2UCHIRR_SNACKIES_KEYWORD" };
			ContentAddition.AddSkillDef((SkillDef)(object)specialEatScepterSD);
			ItemBase<AncientScepterItem>.instance.RegisterScepterSkill((SkillDef)(object)specialTransformScepterSD, "SS2UChirrBody", (SkillDef)(object)specialTransformSD);
			ItemBase<AncientScepterItem>.instance.RegisterScepterSkill((SkillDef)(object)specialEatScepterSD, "SS2UChirrBody", (SkillDef)(object)specialEatSD);
		}

		private static void RevertBaseChanges()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			bodyPrefab.GetComponent<CharacterBody>().baseJumpPower = 15f;
			EntityStateMachine[] components = bodyPrefab.GetComponents<EntityStateMachine>();
			EntityStateMachine[] array = components;
			foreach (EntityStateMachine val in array)
			{
				if (val.customName == "Body")
				{
					val.mainStateType = new SerializableEntityStateType(typeof(ChirrCharMainVariableFly));
					break;
				}
			}
		}

		private static void ResetSoulmates()
		{
			chirrSoulmates.Clear();
			commandoSoulmates.Clear();
		}

		private static void Stage_ResetSoulmates(Stage obj)
		{
			ResetSoulmates();
		}

		private static void Run_ResetSoulmates(Run arg1, GameEndingDef arg2)
		{
			ResetSoulmates();
		}

		private static void Server_onCharacterDeath(DamageReport obj)
		{
			//IL_0037: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || obj == null || !Object.op_Implicit((Object)(object)obj.victim))
			{
				return;
			}
			if (obj.victimBodyIndex == BodyCatalog.FindBodyIndex("CommandoBody"))
			{
				foreach (CharacterBody chirrSoulmate in chirrSoulmates)
				{
					if (Object.op_Implicit((Object)(object)chirrSoulmate))
					{
						float num = 15f;
						for (int i = 0; i < 5; i++)
						{
							chirrSoulmate.AddTimedBuff(Buffs.BeetleJuice, num);
						}
					}
				}
				commandoSoulmates.Remove(obj.victimBody);
			}
			else if (obj.victimBodyIndex == ChirrCore.bodyIndex)
			{
				chirrSoulmates.Remove(obj.victimBody);
			}
		}

		private static void CharacterBody_onBodyStartGlobal(CharacterBody body)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.master) && body.bodyIndex == commandoBodyIndex && !commandoSoulmates.Contains(body))
			{
				commandoSoulmates.Add(body);
			}
		}

		private static void SetupPassive()
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			bool flag = default(bool);
			ContentAddition.AddEntityState<ChirrCharMainVariableFly>(ref flag);
			ContentAddition.AddEntityState<VariableHoverOn>(ref flag);
			passiveSkill = bodyPrefab.AddComponent<GenericSkill>();
			passiveSkillFamily = ScriptableObject.CreateInstance<SkillFamily>();
			((Object)passiveSkillFamily).name = "DCSS2UChirrPassive";
			passiveSkill._skillFamily = passiveSkillFamily;
			ContentAddition.AddSkillFamily(passiveSkillFamily);
			NetworkStateMachine component = bodyPrefab.GetComponent<NetworkStateMachine>();
			passiveESM = bodyPrefab.AddComponent<EntityStateMachine>();
			passiveESM.customName = "Passive";
			passiveESM.initialStateType = new SerializableEntityStateType(typeof(Idle));
			passiveESM.mainStateType = new SerializableEntityStateType(typeof(Idle));
			ArrayUtils.ArrayAppend<EntityStateMachine>(ref component.stateMachines, ref passiveESM);
			passiveDefaultSD = ChirrSetupHelpers.CreateSkillDef<PassiveTakeFlightSD>("DESCLONE_SS2UCHIRR_PASSIVE_TAKEFLIGHT");
			((SkillDef)passiveDefaultSD).skillNameToken = skillLocator.passiveSkill.skillNameToken;
			((SkillDef)passiveDefaultSD).skillName = ((SkillDef)passiveDefaultSD).skillNameToken;
			((SkillDef)passiveDefaultSD).skillDescriptionToken = skillLocator.passiveSkill.skillDescriptionToken;
			((SkillDef)passiveDefaultSD).icon = skillLocator.passiveSkill.icon;
			skillLocator.passiveSkill.enabled = false;
			AddPassive((SkillDef)(object)passiveDefaultSD);
			if (ConfigSetup.cfgEnablePassiveStageBuff.Value)
			{
				passiveStageBuffSD = ChirrSetupHelpers.CreateSkillDef<PassiveStageBuffSD>("DESCLONE_SS2UCHIRR_PASSIVE_STAGEBUFF");
				((SkillDef)passiveStageBuffSD).icon = Assets.ChirrAssets.passiveStageBuffIcon;
				AddPassive((SkillDef)(object)passiveStageBuffSD);
			}
			if (ConfigSetup.cfgEnablePassiveSnackies.Value)
			{
				passiveSnackiesSD = ChirrSetupHelpers.CreateSkillDef<PassiveSnackiesPerStageSD>("DESCLONE_SS2UCHIRR_PASSIVE_SNACKIESPERSTAGE");
				((SkillDef)passiveSnackiesSD).icon = Assets.ChirrAssets.passiveSnackiesPerStageIcon;
				((SkillDef)passiveSnackiesSD).keywordTokens = new string[1] { "DESCLONE_SS2UCHIRR_SNACKIES_KEYWORD" };
				AddPassive((SkillDef)(object)passiveSnackiesSD);
			}
			if (ConfigSetup.cfgEnablePassiveBunny.Value)
			{
				passiveBunnySD = ChirrSetupHelpers.CreateSkillDef<PassiveBunnySD>("DESCLONE_SS2UCHIRR_PASSIVE_BUNNY");
				((SkillDef)passiveBunnySD).icon = Assets.ChirrAssets.passiveBunnyIcon;
				AddPassive((SkillDef)(object)passiveBunnySD);
			}
			if (ConfigSetup.cfgEnablePassiveSoulmate.Value)
			{
				passiveSoulmateSD = ChirrSetupHelpers.CreateSkillDef<PassiveSoulmateSD>("DESCLONE_SS2UCHIRR_PASSIVE_SOULMATE");
				((SkillDef)passiveSoulmateSD).icon = Assets.ChirrAssets.passiveSoulmateIcon;
				AddPassive((SkillDef)(object)passiveSoulmateSD);
			}
			if (ConfigSetup.cfgEnablePassiveDigger.Value)
			{
				passiveDiggerSD = ChirrSetupHelpers.CreateSkillDef<PassiveDiggerSD>("DESCLONE_SS2UCHIRR_PASSIVE_DIGGER");
				((SkillDef)passiveDiggerSD).icon = Assets.ChirrAssets.passiveDiggerIcon;
				AddPassive((SkillDef)(object)passiveDiggerSD);
			}
			static void AddPassive(SkillDef skillDef)
			{
				//IL_0018: 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_003a: Expected O, but got Unknown
				skillDef.activationStateMachineName = "Passive";
				ref Variant[] variants = ref passiveSkillFamily.variants;
				Variant val = new Variant
				{
					skillDef = skillDef
				};
				((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null);
				val.unlockableDef = null;
				ArrayUtils.ArrayAppend<Variant>(ref variants, ref val);
				ContentAddition.AddSkillDef(skillDef);
			}
		}

		private static void SetupPrimary()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			SkillFamily skillFamily = skillLocator.primary.skillFamily;
			if (ConfigSetup.cfgEnablePrimaryDoubleTap.Value)
			{
				bool flag = default(bool);
				ContentAddition.AddEntityState<FireDoubleTapES>(ref flag);
				primaryDoubleTapSD = ScriptableObject.CreateInstance<SteppedSkillDef>();
				((SkillDef)primaryDoubleTapSD).skillName = "DESCLONE_SS2UCHIRR_PRIMARY_DOUBLETAP";
				((Object)primaryDoubleTapSD).name = "DESCLONE_SS2UCHIRR_PRIMARY_DOUBLETAP";
				((SkillDef)primaryDoubleTapSD).skillNameToken = "DESCLONE_SS2UCHIRR_PRIMARY_DOUBLETAP_NAME";
				((SkillDef)primaryDoubleTapSD).skillDescriptionToken = "DESCLONE_SS2UCHIRR_PRIMARY_DOUBLETAP_DESC";
				ChirrSetupHelpers.CopySkillDefFields(skillFamily.variants[0].skillDef, (SkillDef)(object)primaryDoubleTapSD, copyIdentifiers: false);
				((SkillDef)primaryDoubleTapSD).icon = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Commando/CommandoBodyFirePistol.asset").WaitForCompletion().icon;
				((SkillDef)primaryDoubleTapSD).activationState = new SerializableEntityStateType(typeof(FireDoubleTapES));
				((SkillDef)primaryDoubleTapSD).skillDescriptionToken = "COMMANDO_PRIMARY_DESCRIPTION";
				primaryDoubleTapSD.stepCount = 2;
				primaryDoubleTapSD.stepGraceDuration = 0.1f;
				ContentAddition.AddSkillDef((SkillDef)(object)primaryDoubleTapSD);
				ChirrSetupHelpers.AddToSkillFamily((SkillDef)(object)primaryDoubleTapSD, skillFamily);
			}
		}

		private static void SetupSpecial()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			SkillDef skillDef = skillLocator.special.skillFamily.variants[0].skillDef;
			bool flag = default(bool);
			if (ConfigSetup.cfgEnableSpecialTransform.Value)
			{
				ContentAddition.AddEntityState<TransformEnemyES>(ref flag);
				specialTransformSD = ChirrSetupHelpers.CreateSkillDef<TransformEnemySD>("DESCLONE_SS2UCHIRR_TRANSFORM");
				ChirrSetupHelpers.CopySkillDefFields(skillDef, (SkillDef)(object)specialTransformSD, copyIdentifiers: false);
				((SkillDef)specialTransformSD).activationState = new SerializableEntityStateType(typeof(TransformEnemyES));
				((SkillDef)specialTransformSD).icon = Assets.ChirrAssets.specialTFIcon;
				ContentAddition.AddSkillDef((SkillDef)(object)specialTransformSD);
				ChirrSetupHelpers.AddToSkillFamily((SkillDef)(object)specialTransformSD, skillLocator.special.skillFamily);
			}
			if (ConfigSetup.cfgEnableSpecialEat.Value)
			{
				ContentAddition.AddEntityState<EatEnemyES>(ref flag);
				specialEatSD = ChirrSetupHelpers.CreateSkillDef<EatEnemySD>("DESCLONE_SS2UCHIRR_EAT");
				ChirrSetupHelpers.CopySkillDefFields(skillDef, (SkillDef)(object)specialEatSD, copyIdentifiers: false);
				((SkillDef)specialEatSD).activationState = new SerializableEntityStateType(typeof(EatEnemyES));
				((SkillDef)specialEatSD).icon = Assets.ChirrAssets.specialEatIcon;
				((SkillDef)specialEatSD).keywordTokens = new string[1] { "DESCLONE_SS2UCHIRR_SNACKIES_KEYWORD" };
				ContentAddition.AddSkillDef((SkillDef)(object)specialEatSD);
				ChirrSetupHelpers.AddToSkillFamily((SkillDef)(object)specialEatSD, skillLocator.special.skillFamily);
			}
		}
	}
	internal class ChirrStageBuffInfo
	{
		internal struct StageBuffInfo
		{
			public string[] stageIds;

			public float armor;

			public const float minArmor = 2f;

			public const float medArmor = 4f;

			public const float maxArmor = 6f;

			public float movespeed;

			public const float minMS = 0.1f;

			public const float medMS = 0.3f;

			public const float maxMS = 0.5f;

			public float attackspeed;

			public const float minAS = 0.1f;

			public const float medAS = 0.3f;

			public const float maxAS = 0.5f;

			public float regen;

			public const float minRegen = 0.2f;

			public const float medRegen = 0.4f;

			public const float maxRegen = 0.6f;

			public float hover;

			public const float minHover = 0.25f;

			public const float medHover = 0.5f;

			public const float maxHover = 1f;

			public const int moveSpeedMaxStagesCleared = 10;

			public const float stageMultiplierStagesCleared = 0.2f;

			public void GetResultingStatChanges(out float armorMult, out float asMult, out float msMult, out float regenMult, out string currentStageToken)
			{
				int num = Mathf.Max(0, Run.instance.stageClearCount);
				float num2 = 1f + (float)num * 0.2f;
				float num3 = 1f + (float)Mathf.Min(20, num) * 0.2f;
				armorMult = armor * num2;
				asMult = attackspeed * num2;
				msMult = movespeed * num3;
				regenMult = regen * num2;
				currentStageToken = SceneCatalog.GetSceneDefForCurrentScene().nameToken;
			}

			public void Apply(CharacterBody characterBody)
			{
				GetResultingStatChanges(out var armorMult, out var asMult, out var msMult, out var regenMult, out var _);
				characterBody.baseArmor += armorMult;
				characterBody.baseAttackSpeed += asMult;
				characterBody.baseMoveSpeed += msMult;
				characterBody.baseRegen += regenMult;
				characterBody.MarkAllStatsDirty();
			}

			public void SendChatAnnouncementMessage(CharacterBody characterBody)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Expected O, but got Unknown
				if (NetworkServer.active)
				{
					SubjectFormatChatMessage val = new SubjectFormatChatMessage();
					((SubjectChatMessage)val).baseToken = "DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_0";
					((SubjectChatMessage)val).subjectCharacterBodyGameObject = ((Component)characterBody).gameObject;
					val.paramTokens = new string[1] { SceneCatalog.GetSceneDefForCurrentScene().nameToken };
					Chat.SendBroadcastChat((ChatMessageBase)(object)val);
				}
			}

			public string GetChangeMessage()
			{
				GetResultingStatChanges(out var armorMult, out var asMult, out var msMult, out var regenMult, out var _);
				return Language.GetStringFormatted("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_1", new object[10]
				{
					g("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_ARMOR"),
					armorMult,
					g("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_MOVESPEED"),
					$"{asMult:P}",
					g("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_ATTACKSPEED"),
					$"{msMult:P}",
					g("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_REGEN"),
					regenMult,
					g("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_HOVER"),
					$"{hover:P}"
				});
				static string g(string token)
				{
					return Language.GetString(token);
				}
			}

			public void SendChatChangeMessage(NetworkInstanceId targetNetId)
			{
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				if (NetworkServer.active)
				{
					GetResultingStatChanges(out var armorMult, out var asMult, out var msMult, out var regenMult, out var _);
					NetMessageExtensions.Send((INetMessage)(object)new Networking.SendToClient_ChirrStatInfo(targetNetId, armorMult, asMult, msMult, regenMult, hover), (NetworkDestination)1);
				}
			}

			public void LogChangeMessage()
			{
				GetResultingStatChanges(out var armorMult, out var asMult, out var msMult, out var regenMult, out var _);
				string[] array = new string[10]
				{
					Language.GetString("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_ARMOR"),
					armorMult.ToString(),
					Language.GetString("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_MOVESPEED"),
					$"{asMult:P}",
					Language.GetString("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_ATTACKSPEED"),
					$"{msMult:P}",
					Language.GetString("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_REGEN"),
					regenMult.ToString(),
					Language.GetString("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_HOVER"),
					$"{hover:P}"
				};
				object[] array2 = array;
				Debug.Log((object)Language.GetStringFormatted("DESCLONE_SS2UCHIRR_STAGEBUFF_MESSAGE_1", array2));
			}
		}

		public static StageBuffInfo defaultInfo = new StageBuffInfo
		{
			stageIds = new string[0],
			armor = 2f,
			movespeed = 0.1f,
			attackspeed = 0.1f,
			regen = 0.2f,
			hover = 0.5f
		};

		public static StageBuffInfo blackbeachInfo = new StageBuffInfo
		{
			stageIds = new string[3] { "blackbeach", "blackbeach2", "itblackbeach" },
			armor = 2f,
			movespeed = 0.1f,
			attackspeed = 0.1f,
			regen = 0.4f,
			hover = 1f
		};

		public static StageBuffInfo golemplainsInfo = new StageBuffInfo
		{
			stageIds = new string[3] { "golemplains", "golemplains2", "itgolemplains" },
			armor = 4f,
			movespeed = 0.3f,
			attackspeed = 0.1f,
			regen = 0.4f,
			hover = 1f
		};

		public static StageBuffInfo snowyforestInfo = new StageBuffInfo
		{
			stageIds = new string[1] { "snowyforest" },
			armor = 4f,
			movespeed = 0.1f,
			attackspeed = 0.1f,
			regen = 0.2f,
			hover = 1f
		};

		public static StageBuffInfo goolakeInfo = new StageBuffInfo
		{
			stageIds = new string[2] { "goolake", "itgoolake" },
			armor = 6f,
			movespeed = 0.1f,
			attackspeed = 0.1f,
			regen = 0.2f,
			hover = 0.25f
		};

		public static StageBuffInfo foggyswampInfo = new StageBuffInfo
		{
			stageIds = new string[1] { "foggyswamp" },
			armor = 4f,
			movespeed = 0.1f,
			attackspeed = 0.1f,
			regen = 0.6f,
			hover = 0.5f
		};

		public static StageBuffInfo ancientloftInfo = new StageBuffInfo
		{
			stageIds = new string[2] { "ancientloft", "itancientloft" },
			armor = 6f,
			movespeed = 0.1f,
			attackspeed = 0.1f,
			regen = 0.2f,
			hover = 0.25f
		};

		public static StageBuffInfo frozenwallInfo = new StageBuffInfo
		{
			stageIds = new string[2] { "frozenwall", "itfrozenwall" },
			armor = 4f,
			movespeed = 0.1f,
			attackspeed = 0.1f,
			regen = 0.2f,
			hover = 0.5f
		};

		public static StageBuffInfo wispgraveyardInfo = new StageBuffInfo
		{
			stageIds = new string[1] { "wispgraveyard" },
			armor = 4f,
			movespeed = 0.5f,
			attackspeed = 0.3f,
			regen = 0.4f,
			hover = 1f
		};

		public static StageBuffInfo sulfurpoolsInfo = new StageBuffInfo
		{
			stageIds = new string[1] { "sulfurpools" },
			armor = 6f,
			movespeed = 0.1f,
			attackspeed = 0.1f,
			regen = 0.2f,
			hover = 0.25f
		};

		public static StageBuffInfo dampcaveInfo = new StageBuffInfo
		{
			stageIds = new string[2] { "dampcavesimple", "itdampcave" },
			armor = 2f,
			movespeed = 0.3f,
			attackspeed = 0.1f,
			regen = 0.2f,
			hover = 0.5f
		};

		public static StageBuffInfo shipgraveyardInfo = new StageBuffInfo
		{
			stageIds = new string[1] { "shipgraveyard" },
			armor = 2f,
			movespeed = 0.5f,
			attackspeed = 0.1f,
			regen = 0.6f,
			hover = 1f
		};

		public static StageBuffInfo rootjungleInfo = new StageBuffInfo
		{
			stageIds = new string[1] { "rootjungle" },
			armor = 2f,
			movespeed = 0.5f,
			attackspeed = 0.1f,
			regen = 0.6f,
			hover = 1f
		};

		public static StageBuffInfo skymeadowInfo = new StageBuffInfo
		{
			stageIds = new string[2] { "skymeadow", "itskymeadow" },
			armor = 2f,
			movespeed = 0.5f,
			attackspeed = 0.1f,
			regen = 0.6f,
			hover = 1f
		};

		public static StageBuffInfo bossInfo = new StageBuffInfo
		{
			stageIds = new string[8] { "moon", "moon2", "itmoon", "limbo", "artifactworld", "goldshores", "voidraid", "arena" },
			armor = 6f,
			movespeed = 0.5f,
			attackspeed = 0.5f,
			regen = 0.6f,
			hover = 1f
		};

		public static StageBuffInfo bazaarInfo = new StageBuffInfo
		{
			stageIds = new string[1] { "bazaar" }
		};

		public static StageBuffInfo voidstageInfo = new StageBuffInfo
		{
			stageIds = new string[1] { "voidstage" },
			armor = 4f,
			movespeed = 0.3f,
			attackspeed = 0.3f,
			regen = 0.4f,
			hover = 0.5f
		};

		public static StageBuffInfo[] stageBuffInfos = new StageBuffInfo[16]
		{
			blackbeachInfo, golemplainsInfo, snowyforestInfo, goolakeInfo, foggyswampInfo, ancientloftInfo, frozenwallInfo, wispgraveyardInfo, sulfurpoolsInfo, dampcaveInfo,
			shipgraveyardInfo, rootjungleInfo, skymeadowInfo, bazaarInfo, voidstageInfo, bossInfo
		};

		public static Dictionary<string, StageBuffInfo> stageBuffInfoDict = new Dictionary<string, StageBuffInfo>();

		public static float GetStageHoverMultiplier()
		{
			return GetCurrentStageBuffInfo().hover;
		}

		public static StageBuffInfo GetCurrentStageBuffInfo()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			return GetStageBuffInfo(((Scene)(ref activeScene)).name);
		}

		public static void Init()
		{
			GenerateDictionary();
		}

		public static void GenerateDictionary()
		{
			StageBuffInfo[] array = stageBuffInfos;
			for (int i = 0; i < array.Length; i++)
			{
				StageBuffInfo value = array[i];
				string[] stageIds = value.stageIds;
				foreach (string key in stageIds)
				{
					stageBuffInfoDict.Add(key, value);
				}
			}
		}

		public static StageBuffInfo GetStageBuffInfo(string stageName)
		{
			StageBuffInfo value;
			return stageBuffInfoDict.TryGetValue(stageName, out value) ? value : defaultInfo;
		}
	}
	public class SoulmateChirrBuffer : MonoBehaviour
	{
		public CharacterBody body;

		public float stopwatch = 0f;

		public float timer = 4f;

		public void FixedUpdate()
		{
			stopwatch -= Time.fixedDeltaTime;
			if (!(stopwatch <= 0f))
			{
				return;
			}
			stopwatch = timer;
			int buffCount = body.GetBuffCount(Buffs.soulmateBuff);
			int num = ChirrSetup.commandoSoulmates.Count - buffCount;
			if (num > 0)
			{
				for (int i = 0; i < num; i++)
				{
					body.AddBuff(Buffs.soulmateBuff);
				}
			}
			else if (num < 0)
			{
				for (int j = 0; j < -num; j++)
				{
					body.RemoveBuff(Buffs.soulmateBuff);
				}
			}
		}

		public void OnDestroy()
		{
			while (body.HasBuff(Buffs.soulmateBuff))
			{
				body.RemoveBuff(Buffs.soulmateBuff);
			}
		}
	}
}
namespace ChirrAltSkills.Chirr.States
{
	internal class VariableHoverOn : JetpackOn
	{
		public float hoverVelocityMultiplier = 1f;

		public float hoverAccelerationMultiplier = 1f;

		public override void OnEnter()
		{
			((JetpackOn)this).OnEnter();
			JetpackOn.hoverAcceleration *= hoverAccelerationMultiplier;
		}

		public override void FixedUpdate()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			((JetpackOn)this).FixedUpdate();
			if (((EntityState)this).isAuthority)
			{
				float y = ((EntityState)this).characterMotor.velocity.y;
				y = Mathf.MoveTowards(y, JetpackOn.hoverVelocity, JetpackOn.hoverAcceleration * Time.fixedDeltaTime);
				((EntityState)this).characterMotor.velocity = new Vector3(((EntityState)this).characterMotor.velocity.x, y, ((EntityState)this).characterMotor.velocity.z);
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && !((EntityState)this).characterBody.isSprinting && Object.op_Implicit((Object)(object)((EntityState)this).inputBank))
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				Vector2 val = default(Vector2);
				((Vector2)(ref val))..ctor(((EntityState)this).inputBank.moveVector.x, ((EntityState)this).inputBank.moveVector.z);
				Vector2 val2 = default(Vector2);
				((Vector2)(ref val2))..ctor(((Ray)(ref aimRay)).direction.x, ((Ray)(ref aimRay)).direction.z);
				float num = Vector2.Angle(val, val2);
				if (num <= 90f)
				{
					((EntityState)this).characterBody.isSprinting = true;
				}
			}
		}
	}
}
namespace ChirrAltSkills.Chirr.States.Special
{
	internal class EatEnemyES : BaseState
	{
		public const float baseBuffDuration = 10f;

		public const float stackBuffDuration = 1f;

		public const float damageCoefficient = 5f;

		public const float stacksPerHealthPercentage = 0.5f;

		public const float secondsPerHealthPercentage = 0.5f;

		private ChirrTracker chirrTracker;

		private readonly float duration = 0.25f;

		public virtual bool AllowBoss => false;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			chirrTracker = ((EntityState)this).GetComponent<ChirrTracker>();
			Util.PlaySound("SS2UChirrSpecial", ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.SetAimTimer(duration + 1f);
			}
			if (NetworkServer.active)
			{
				ChompEnemy(chirrTracker.GetTrackingTarget().healthComponent);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge > duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public void ChompEnemy(HealthComponent enemyHC)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0071: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			DamageInfo val = new DamageInfo
			{
				attacker = ((EntityState)this).gameObject,
				inflictor = ((EntityState)this).gameObject,
				crit = ((EntityState)this).characterBody.RollCrit(),
				damage = ((EntityState)this).characterBody.damage * 5f,
				damageType = (DamageType)0,
				damageColorIndex = (DamageColorIndex)5,
				position = enemyHC.body.corePosition,
				procCoefficient = 0.1f
			};
			DamageAPI.AddModdedDamageType(val, DamageTypes.chirrChompDT);
			enemyHC.TakeDamage(val);
		}

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

		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;
		}
	}
	internal class EatEnemyScepterES : EatEnemyES
	{
		public override bool AllowBoss => true;
	}
	internal class TransformEnemyES : BaseState
	{
		private ChirrTracker chirrTracker;

		private readonly float duration = 0.25f;

		public virtual bool AllowBoss => false;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			chirrTracker = ((EntityState)this).GetComponent<ChirrTracker>();
			Util.PlaySound("SS2UChirrSpecial", ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.SetAimTimer(duration + 1f);
			}
			if (NetworkServer.active)
			{
				TransformEnemy(chirrTracker.GetTrackingTarget().healthComponent);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge > duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public void TransformEnemy(HealthComponent enemyHC)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_00a1: Expected O, but got Unknown
			Vector3 footPosition = enemyHC.body.footPosition;
			MasterCopySpawnCard val = MasterCopySpawnCard.FromMaster(((EntityState)this).characterBody.master, false, false, (Action<CharacterMaster>)null);
			MonsterSpawnDistance val2 = (MonsterSpawnDistance)1;
			DirectorPlacementRule val3 = new DirectorPlacementRule
			{
				placementMode = (PlacementMode)0,
				position = footPosition
			};
			DirectorCore.GetMonsterSpawnDistance(val2, ref val3.minDistance, ref val3.maxDistance);
			DirectorSpawnRequest val4 = new DirectorSpawnRequest((SpawnCard)(object)val, val3, new Xoroshiro128Plus(Run.instance.seed + (ulong)Run.instance.fixedTime))
			{
				teamIndexOverride = ((EntityState)this).characterBody.master.teamIndex,
				ignoreTeamMemberLimit = true,
				summonerBodyObject = ((Component)((EntityState)this).characterBody).gameObject
			};
			DirectorSpawnRequest val5 = val4;
			val5.onSpawnedServer = (Action<SpawnResult>)Delegate.Combine(val5.onSpawnedServer, (Action<SpawnResult>)delegate(SpawnResult result)
			{
				//IL_0001: 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_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Expected O, but got Unknown
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: Invalid comparison between Unknown and I4
				//IL_00ab: 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_0141: Unknown result type (might be due to invalid IL or missing references)
				//IL_014b: Expected O, but got Unknown
				CharacterMaster component = result.spawnedInstance.GetComponent<CharacterMaster>();
				Deployable val7 = result.spawnedInstance.AddComponent<Deployable>();
				val7.onUndeploy = (UnityEvent)(((object)val7.onUndeploy) ?? ((object)new UnityEvent()));
				val7.onUndeploy.AddListener(new UnityAction(component.TrueKill));
				component.inventory.CopyItemsFrom(((EntityState)this).characterBody.inventory);
				component.inventory.CopyEquipmentFrom(((EntityState)this).characterBody.inventory);
				foreach (string item in ChirrFriendController.itemCopyBlacklist)
				{
					ItemIndex val8 = ItemCatalog.FindItemIndex(item);
					if ((int)val8 != -1)
					{
						component.inventory.RemoveItem(val8, component.inventory.GetItemCount(val8));
					}
				}
				float lifeTimer = (AllowBoss ? 20f : 10f);
				ComponentHelpers.AddComponent<MasterSuicideOnTimer>((MonoBehaviour)(object)component).lifeTimer = lifeTimer;
				GameObject bodyObject = component.GetBodyObject();
				if (Object.op_Implicit((Object)(object)bodyObject))
				{
					EntityStateMachine[] components = bodyObject.GetComponents<EntityStateMachine>();
					foreach (EntityStateMachine val9 in components)
					{
						if (val9.customName == "Body")
						{
							val9.SetState((EntityState)new GummyCloneSpawnState());
							break;
						}
					}
				}
			});
			GameObject val6 = DirectorCore.instance.TrySpawnObject(val4);
			Object.Destroy((Object)(object)val);
			enemyHC.Suicide(((Component)((EntityState)this).characterBody).gameObject, (GameObject)null, (DamageType)0);
		}
	}
	internal class TransformEnemyScepterES : TransformEnemyES
	{
		public override bool AllowBoss => true;
	}
}
namespace ChirrAltSkills.Chirr.States.Primary
{
	public class FireDoubleTapES : BaseSkillState, IStepSetter
	{
		private int pistol;

		private Ray aimRay;

		private float duration;

		void IStepSetter.SetStep(int i)
		{
			pistol = i;
		}

		private void FireBullet(string targetMuzzle)
		{
			//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_0087: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			Util.PlaySound(FirePistol2.firePistolSoundString, ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)ChirrPrimary.muzzleflashEffectPrefab))
			{
				EffectManager.SimpleMuzzleFlash(ChirrPrimary.muzzleflashEffectPrefab, ((EntityState)this).gameObject, targetMuzzle, false);
			}
			((BaseState)this).AddRecoil(-0.4f * FirePistol2.recoilAmplitude, -0.8f * FirePistol2.recoilAmplitude, -0.3f * FirePistol2.recoilAmplitude, 0.3f * FirePistol2.recoilAmplitude);
			if (((EntityState)this).isAuthority)
			{
				new BulletAttack
				{
					owner = ((EntityState)this).gameObject,
					weapon = ((EntityState)this).gameObject,
					origin = ((Ray)(ref aimRay)).origin,
					aimVector = ((Ray)(ref aimRay)).direction,
					minSpread = 0f,
					maxSpread = ((EntityState)this).characterBody.spreadBloomAngle,
					damage = FirePistol2.damageCoefficient * ((BaseState)this).damageStat,
					force = FirePistol2.force,
					tracerEffectPrefab = FirePistol2.tracerEffectPrefab,
					muzzleName = targetMuzzle,
					hitEffectPrefab = FirePistol2.hitEffectPrefab,
					isCrit = Util.CheckRoll(((BaseState)this).critStat, ((EntityState)this).characterBody.master),
					radius = 0.1f,
					smartCollision = true
				}.Fire();
			}
			((EntityState)this).characterBody.AddSpreadBloom(FirePistol2.spreadBloomValue);
		}

		public override void OnEnter()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = FirePistol2.baseDuration / ((BaseState)this).attackSpeedStat;
			aimRay = ((BaseState)this).GetAimRay();
			((BaseState)this).StartAimMode(aimRay, 3f, false);
			((EntityState)this).PlayCrossfade("Gesture, Override", "Primary", "Primary.playbackRate", duration, 0.1f);
			((EntityState)this).PlayCrossfade("Gesture, Additive", "Primary", "Primary.playbackRate", duration, 0.1f);
			if (pistol % 2 == 0)
			{
				FireBullet("MuzzleWingL");
			}
			else
			{
				FireBullet("MuzzleWingR");
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (!(((EntityState)this).fixedAge < duration) && ((EntityState)this).isAuthority)
			{
				((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)1;
		}
	}
}
namespace ChirrAltSkills.Chirr.States.CharacterMains
{
	internal class ChirrCharMainVariableFly : ChirrMain
	{
		private float hoverVelocityMultiplier = 1f;

		private float hoverAccelerationMultiplier = 1f;

		private bool canHover = true;

		private bool hoverHasDuration = false;

		private float hoverDuration = -1f;

		private float hoverStopwatch = 0f;

		private bool hoverOnCooldown = false;

		public bool isBunny = false;

		private static BuffDef IndicatorBuff => Buffs.hoverDurationIndicatorBuff;

		public void ChangeHoverMultiplier(float hoverVelocityMultiplier, float hoverAccelerationMultiplier)
		{
			this.hoverVelocityMultiplier = hoverVelocityMultiplier;
			this.hoverAccelerationMultiplier = hoverAccelerationMultiplier;
			if (hoverAccelerationMultiplier < 0f)
			{
				canHover = false;
			}
		}

		public void ChangeMainBasedOnSkillDef()
		{
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Expected O, but got Unknown
			GenericSkill[] components = ((EntityState)this).gameObject.GetComponents<GenericSkill>();
			foreach (GenericSkill val in components)
			{
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.skillFamily) && !(((Object)val.skillFamily).name != "DCSS2UChirrPassive"))
				{
					if ((Object)(object)val.skillDef == (Object)(object)ChirrSetup.passiveStageBuffSD)
					{
						float stageHoverMultiplier = ChirrStageBuffInfo.GetStageHoverMultiplier();
						float num = Mathf.Max(1f, 1f / stageHoverMultiplier);
						ChangeHoverMultiplier(1f, num);
					}
					else if ((Object)(object)val.skillDef == (Object)(object)ChirrSetup.passiveBunnySD)
					{
						isBunny = true;
						hoverHasDuration = true;
						hoverDuration = 2f;
					}
					else if ((Object)(object)val.skillDef == (Object)(object)ChirrSetup.passiveDiggerSD)
					{
						hoverHasDuration = true;
						hoverDuration = 5f;
					}
					break;
				}
			}
			if (hoverHasDuration)
			{
				((EntityState)this).characterMotor.onHitGroundServer += new HitGroundDelegate(ClearIndicatorBuffOnLandingServer);
			}
		}

		private void ClearIndicatorBuffOnLandingServer(ref HitGroundInfo hitGroundInfo)
		{
			((EntityState)this).characterBody.ClearTimedBuffs(IndicatorBuff);
		}

		public override void OnEnter()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			((ChirrMain)this).OnEnter();
			ChangeMainBasedOnSkillDef();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && hoverHasDuration)
			{
				((EntityState)this).characterMotor.onHitGroundAuthority += new HitGroundDelegate(ResetHoverCooldown);
			}
			SkillDef skillDef = ((EntityState)this).skillLocator.special.skillDef;
			if ((Object)(object)skillDef == (Object)(object)ChirrSetup.specialEatSD)
			{
				base.friendController.maxTrackingDistance = 0f;
			}
			else if ((Object)(object)skillDef == (Object)(object)ChirrSetup.specialTransformSD)
			{
				base.friendController.maxTrackingDistance = 0f;
			}
		}

		private void ResetHoverCooldown(ref HitGroundInfo hitGroundInfo)
		{
			hoverStopwatch = hoverDuration;
			hoverOnCooldown = false;
			if (NetworkServer.active)
			{
				while (((EntityState)this).characterBody.HasBuff(IndicatorBuff))
				{
					((EntityState)this).characterBody.RemoveBuff(IndicatorBuff);
				}
			}
		}

		public void GenericCharacterMain_ProcessJump()
		{
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: 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_0215: Expected O, but got Unknown
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Expected O, but got Unknown
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: 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_02ad: Expected O, but got Unknown
			if (!((BaseCharacterMain)this).hasCharacterMotor)
			{
				return;
			}
			bool flag = false;
			bool flag2 = false;
			if (!((GenericCharacterMain)this).jumpInputReceived || !Object.op_Implicit((Object)(object)((EntityState)this).characterBody) || ((EntityState)this).characterMotor.jumpCount >= ((EntityState)this).characterBody.maxJumpCount)
			{
				return;
			}
			int itemCount = ((EntityState)this).characterBody.inventory.GetItemCount(Items.JumpBoost);
			float num = 1f;
			float num2 = 1f;
			if (((EntityState)this).characterMotor.jumpCount >= ((EntityState)this).characterBody.baseJumpCount)
			{
				flag = true;
				num = 1.5f;
				num2 = 1.5f;
			}
			else if ((float)itemCount > 0f && ((EntityState)this).characterBody.isSprinting)
			{
				float num3 = ((EntityState)this).characterBody.acceleration * ((EntityState)this).characterMotor.airControl;
				if (((EntityState)this).characterBody.moveSpeed > 0f && num3 > 0f)
				{
					flag2 = true;
					float num4 = Mathf.Sqrt(10f * (float)itemCount / num3);
					float num5 = ((EntityState)this).characterBody.moveSpeed / num3;
					num = (num4 + num5) / num5;
				}
			}
			GenericCharacterMain.ApplyJumpVelocity(((EntityState)this).characterMotor, ((EntityState)this).characterBody, num, num2, false);
			if (((BaseCharacterMain)this).hasModelAnimator)
			{
				int layerIndex = ((BaseCharacterMain)this).modelAnimator.GetLayerIndex("Body");
				if (layerIndex >= 0)
				{
					if (((EntityState)this).characterMotor.jumpCount == 0 || ((EntityState)this).characterBody.baseJumpCount == 1)
					{
						((BaseCharacterMain)this).modelAnimator.CrossFadeInFixedTime("Jump", ((BaseCharacterMain)this).smoothingParameters.intoJumpTransitionTime, layerIndex);
					}
					else
					{
						((BaseCharacterMain)this).modelAnimator.CrossFadeInFixedTime("BonusJump", ((BaseCharacterMain)this).smoothingParameters.intoJumpTransitionTime, layerIndex);
					}
				}
			}
			if (flag)
			{
				EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/FeatherEffect"), new EffectData
				{
					origin = ((EntityState)this).characterBody.footPosition
				}, true);
			}
			else if (((EntityState)this).characterMotor.jumpCount > 0)
			{
				EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/CharacterLandImpact"), new EffectData
				{
					origin = ((EntityState)this).characterBody.footPosition,
					scale = ((EntityState)this).characterBody.radius
				}, true);
			}
			if (flag2)
			{
				EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/BoostJumpEffect"), new EffectData
				{
					origin = ((EntityState)this).characterBody.footPosition,
					rotation = Util.QuaternionSafeLookRotation(((EntityState)this).characterMotor.velocity)
				}, true);
			}
			CharacterMotor characterMotor = ((EntityState)this).characterMotor;
			characterMotor.jumpCount++;
		}

		public override void ProcessJump()
		{
			//IL_00f0: 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)
			//IL_0156: Expected O, but got Unknown
			GenericCharacterMain_ProcessJump();
			base.inJetpackState = ((object)base.jetpackStateMachine.state).GetType() == typeof(VariableHoverOn);
			if (!((BaseCharacterMain)this).hasCharacterMotor || !((BaseCharacterMain)this).hasInputBank || !((EntityState)this).isAuthority)
			{
				return;
			}
			bool flag = ((EntityState)this).inputBank.jump.down && ((EntityState)this).characterMotor.velocity.y < 0f && !((EntityState)this).characterMotor.isGrounded;
			if (canHover && flag && !base.inJetpackState && (!hoverHasDuration || !hoverOnCooldown))
			{
				base.jetpackStateMachine.SetNextState((EntityState)(object)new VariableHoverOn
				{
					hoverVelocityMultiplier = hoverVelocityMultiplier,
					hoverAccelerationMultiplier = hoverAccelerationMultiplier
				});
				for (int i = 0; (float)i < hoverDuration + 1f; i++)
				{
					((EntityState)this).characterBody.AddTimedBuffAuthority(IndicatorBuff.buffIndex, hoverDuration - (float)i);
				}
			}
			if (base.inJetpackState && (!flag || !canHover || hoverOnCooldown))
			{
				base.jetpackStateMachine.SetNextState((EntityState)new Idle());
			}
		}

		public override void FixedUpdate()
		{
			((ChirrMain)this).FixedUpdate();
			base.inJetpackState = Object.op_Implicit((Object)(object)base.jetpackStateMachine) && ((object)base.jetpackStateMachine.state).GetType() == typeof(VariableHoverOn);
			if (hoverHasDuration && base.inJetpackState && !hoverOnCooldown)
			{
				hoverStopwatch -= Time.fixedDeltaTime;
				hoverOnCooldown = hoverStopwatch <= 0f;
			}
		}

		public override void OnExit()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			if (NetworkServer.active)
			{
				while (((EntityState)this).characterBody.HasBuff(IndicatorBuff))
				{
					((EntityState)this).characterBody.RemoveBuff(IndicatorBuff);
				}
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && hoverHasDuration)
			{
				((EntityState)this).characterMotor.onHitGroundAuthority -= new HitGroundDelegate(ResetHoverCooldown);
			}
			((ChirrMain)this).OnExit();
		}
	}
}
namespace ChirrAltSkills.Chirr.SkillDefs
{
	public class DiggerCloneComponent : MonoBehaviour
	{
		private float adrenalineGainBuffer;

		private float adrenalineCap;

		private int moneyTracker;

		private float residue;

		private int buffCounter;

		public CharacterBody characterBody;

		public void Awake()
		{
			characterBody = ((Component)this).GetComponent<CharacterBody>();
		}

		public void Start()
		{
			adrenalineGainBuffer = 0.3f;
			moneyTracker = (int)characterBody.master.money;
			adrenalineCap = (CASPlugin.modloaded_Digger ? GetModdedAdrenalineCap() : 49f);
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public float GetModdedAdrenalineCap()
		{
			return DiggerPlugin.adrenalineCap;
		}

		public void FixedUpdate()
		{
			adrenalineGainBuffer -= Time.fixedDeltaTime;
			if (adrenalineGainBuffer <= 0f && NetworkServer.active)
			{
				UpdatePassiveBuff();
			}
			else
			{
				buffCounter = characterBody.GetBuffCount(Buffs.adrenalineBuff);
			}
		}

		private void UpdatePassiveBuff()
		{
			int buffCount = characterBody.GetBuffCount(Buffs.adrenalineBuff);
			int money = (int)characterBody.master.money;
			if (moneyTracker < money)
			{
				RefreshExistingStacks(buffCount);
				GiveNewStacks(money);
			}
			moneyTracker = money;
			HandleStackDecay(buffCount);
		}

		private void RefreshExistingStacks(int currentCount)
		{
			characterBody.ClearTimedBuffs(Buffs.adrenalineBuff);
			for (int i = 0; i < currentCount; i++)
			{
				if ((float)characterBody.GetBuffCount(Buffs.adrenalineBuff) <= adrenalineCap)
				{
					characterBody.AddTimedBuff(Buffs.adrenalineBuff, 5f);
				}
			}
		}

		private void GiveNewStacks(int newMoney)
		{
			float num = (float)(newMoney - moneyTracker) / Mathf.Pow(Run.instance.difficultyCoefficient, 1.25f);
			residue = (num + residue) % 5f;
			float num2 = (num + residue) / 5f;
			for (int i = 1; (float)i <= num2; i++)
			{
				if ((float)characterBody.GetBuffCount(Buffs.adrenalineBuff) <= adrenalineCap)
				{
					characterBody.AddTimedBuff(Buffs.adrenalineBuff, 5f);
				}
			}
		}

		private void HandleStackDecay(int currentCount)
		{
			if (buffCounter != 0 && currentCount == 0)
			{
				for (int i = 1; (double)i < (double)buffCounter * 0.5; i++)
				{
					if ((float)characterBody.GetBuffCount(Buffs.adrenalineBuff) <= adrenalineCap)
					{
						characterBody.AddTimedBuff(Buffs.adrenalineBuff, 1f);
					}
				}
			}
			buffCounter = characterBody.GetBuffCount(Buffs.adrenalineBuff);
		}

		private void OnDestroy()
		{
			characterBody.ClearTimedBuffs(Buffs.adrenalineBuff);
		}
	}
	public class PassiveDiggerSD : AssignableSkillDef
	{
		protected class InstanceData : BaseSkillInstanceData
		{
			public DiggerCloneComponent diggerComponent;
		}

		public override BaseSkillInstanceData OnAssigned(GenericSkill skillSlot)
		{
			if (!NetworkServer.active)
			{
				return base.OnAssigned(skillSlot);
			}
			DiggerCloneComponent diggerCloneComponent = ((Component)skillSlot.characterBody).GetComponent<DiggerCloneComponent>();
			if (!Object.op_Implicit((Object)(object)diggerCloneComponent))
			{
				diggerCloneComponent = ComponentHelpers.AddComponent<DiggerCloneComponent>((MonoBehaviour)(object)skillSlot.characterBody);
			}
			return (BaseSkillInstanceData)(object)new InstanceData
			{
				diggerComponent = diggerCloneComponent
			};
		}

		public override void OnUnassigned(GenericSkill skillSlot)
		{
			if (NetworkServer.active)
			{
				Object.Destroy((Object)(object)((InstanceData)(object)skillSlot.skillInstanceData).diggerComponent);
			}
			base.OnUnassigned(skillSlot);
		}
	}
	public class PassiveSnackiesPerStageSD : AssignableSkillDef
	{
		public override BaseSkillInstanceData OnAssigned(GenericSkill skillSlot)
		{
			if (NetworkServer.active)
			{
				int num = Mathf.Abs(Run.instance.stageClearCount);
				int num2 = 2 + num * 2;
				for (int i = 0; i < num2; i++)
				{
					skillSlot.characterBody.AddBuff(Buffs.indulgenceBuff);
				}
			}
			return base.OnAssigned(skillSlot);
		}

		public override void OnUnassigned(GenericSkill skillSlot)
		{
			if (NetworkServer.active)
			{
				while (skillSlot.characterBody.HasBuff(Buffs.indulgenceBuff))
				{
					skillSlot.characterBody.RemoveBuff(Buffs.indulgenceBuff);
				}
			}
			base.OnUnassigned(skillSlot);
		}
	}
	public class PassiveSoulmateSD : AssignableSkillDef
	{
		public override BaseSkillInstanceData OnAssigned(GenericSkill skillSlot)
		{
			if (NetworkServer.active && !ChirrSetup.chirrSoulmates.Contains(skillSlot.characterBody))
			{
				ChirrSetup.chirrSoulmates.Add(skillSlot.characterBody);
				ComponentHelpers.AddComponent<SoulmateChirrBuffer>((MonoBehaviour)(object)skillSlot.characterBody).body = skillSlot.characterBody;
			}
			return base.OnAssigned(skillSlot);
		}

		public override void OnUnassigned(GenericSkill skillSlot)
		{
			if (NetworkServer.active && ChirrSetup.chirrSoulmates.Contains(skillSlot.characterBody))
			{
				ChirrSetup.chirrSoulmates.Remove(skillSlot.characterBody);
				SoulmateChirrBuffer component = ((Component)skillSlot.characterBody).GetComponent<SoulmateChirrBuffer>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Object.Destroy((Object)(object)component);
				}
			}
			base.OnUnassigned(skillSlot);
		}
	}
	public class PassiveStageBuffSD : AssignableSkillDef
	{
		public override BaseSkillInstanceData OnAssigned(GenericSkill skillSlot)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			ChirrStageBuffInfo.StageBuffInfo stageBuffInfo = ChirrStageBuffInfo.GetStageBuffInfo(((Scene)(ref activeScene)).name);
			stageBuffInfo.Apply(skillSlot.characterBody);
			stageBuffInfo.SendChatAnnouncementMessage(skillSlot.characterBody);
			return base.OnAssigned(skillSlot);
		}
	}
}
namespace ChirrAltSkills.Chirr.SkillDefs.TargetableSkillDef
{
	public class ChirrTargetableSkillDef : AssignableSkillDef
	{
		protected class InstanceData : BaseSkillInstanceData
		{
			public ChirrTracker chirrTracker;

			public bool healthThreshold = false;

			public float healthThresholdPercentage;
		}

		public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
		{
			ChirrTracker component = ((Component)skillSlot).GetComponent<ChirrTracker>();
			((Behaviour)component).enabled = true;
			return (BaseSkillInstanceData)(object)new InstanceData
			{
				chirrTracker = component
			};
		}

		public override void OnUnassigned(GenericSkill skillSlot)
		{
			((Behaviour)((InstanceData)(object)skillSlot.skillInstanceData).chirrTracker).enabled = false;
			base.OnUnassigned(skillSlot);
		}

		private static bool HasTarget([NotNull] GenericSkill skillSlot)
		{
			ChirrTracker chirrTracker = ((InstanceData)(object)skillSlot.skillInstanceData).chirrTracker;
			return Object.op_Implicit((Object)(object)(((Object)(object)chirrTracker != (Object)null) ? chirrTracker.GetTrackingTarget() : null));
		}

		public override bool CanExecute([NotNull] GenericSkill skillSlot)
		{
			return HasTarget(skillSlot) && ((SkillDef)this).CanExecute(skillSlot);
		}

		public override bool IsReady([NotNull] GenericSkill skillSlot)
		{
			return ((SkillDef)this).IsReady(skillSlot) && HasTarget(skillSlot);
		}
	}
	[RequireComponent(typeof(InputBankTest))]
	[RequireComponent(typeof(CharacterBody))]
	[RequireComponent(typeof(TeamComponent))]
	public class ChirrTracker : MonoBehaviour
	{
		public float maxTrackingDistanceCalculated = 5f;

		public float maxTrackingDistance = 5f;

		public const float maxTrackingDistancePerStack = 1f;

		public const float maxTrackingAngle = 20f;

		public float trackerUpdateFrequency = 10f;

		private HurtBox trackingTarget;

		private CharacterBody characterBody;

		private TeamComponent teamComponent;

		private InputBankTest inputBank;

		private float trackerUpdateStopwatch;

		private Indicator indicator;

		private readonly BullseyeSearch search = new BullseyeSearch();

		public bool targetNeedsHealthThreshold = false;

		public float targetHealthThresholdPercentage = 1f;

		public bool targetCanBeBoss = false;

		public bool targetCanBeNonMaster = false;

		private void Awake()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			indicator = new Indicator(((Component)this).gameObject, LegacyResourcesAPI.Load<GameObject>("Prefabs/HuntressTrackingIndicator"));
		}

		private void Start()
		{
			characterBody = ((Component)this).GetComponent<CharacterBody>();
			inputBank = ((Component)this).GetComponent<InputBankTest>();
			teamComponent = ((Component)this).GetComponent<TeamComponent>();
		}

		public HurtBox GetTrackingTarget()
		{
			return trackingTarget;
		}

		private void OnEnable()
		{
			indicator.active = true;
		}

		private void OnDisable()
		{
			indicator.active = false;
		}

		private void FixedUpdate()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			trackerUpdateStopwatch += Time.fixedDeltaTime;
			if (trackerUpdateStopwatch >= 1f / trackerUpdateFrequency)
			{
				ModifyRange();
				trackerUpdateStopwatch -= 1f / trackerUpdateFrequency;
				Ray aimRay = default(Ray);
				((Ray)(ref aimRay))..ctor(inputBank.aimOrigin, inputBank.aimDirection);
				SearchForTarget(aimRay);
				indicator.targetTransform = (Object.op_Implicit((Object)(object)trackingTarget) ? ((Component)trackingTarget).transform : null);
			}
		}

		private void ModifyRange()
		{
			int buffCount = characterBody.GetBuffCount(Buffs.snackiesBuff);
			maxTrackingDistanceCalculated = maxTrackingDistance + 1f * (float)buffCount;
		}

		private bool CanTargetBoss(HurtBox hurtBox)
		{
			return targetCanBeBoss || !hurtBox.healthComponent.body.isBoss;
		}

		private bool CanTargetMaster(HurtBox hurtBox)
		{
			return targetCanBeNonMaster || !Object.op_Implicit((Object)(object)hurtBox.healthComponent.body.master);
		}

		private bool CanTargetHealthPercentage(HurtBox hurtBox)
		{
			return !targetNeedsHealthThreshold || hurtBox.healthComponent.combinedHealthFraction <= targetHealthThresholdPercentage;
		}

		private void SearchForTarget(Ray aimRay)
		{
			//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_0017: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			search.teamMaskFilter = TeamMask.GetUnprotectedTeams(teamComponent.teamIndex);
			search.filterByLoS = true;
			search.searchOrigin = ((Ray)(ref aimRay)).origin;
			search.searchDirection = ((Ray)(ref aimRay)).direction;
			search.sortMode = (SortMode)1;
			search.maxDistanceFilter = maxTrackingDistanceCalculated;
			search.maxAngleFilter = 20f;
			search.RefreshCandidates();
			search.FilterOutGameObject(((Component)this).gameObject);
			IEnumerable<HurtBox> results = search.GetResults();
			bool flag = false;
			foreach (HurtBox item in results)
			{
				if (!Object.op_Implicit((Object)(object)item.healthComponent) || !item.healthComponent.alive || !Object.op_Implicit((Object)(object)item.healthComponent.body) || !CanTargetHealthPercentage(item) || !CanTargetMaster(item) || !CanTargetBoss(item))
				{
					continue;
				}
				trackingTarget = item;
				flag = true;
				break;
			}
			if (!flag)
			{
				trackingTarget = null;
			}
		}
	}
}
namespace ChirrAltSkills.Chirr.SkillDefs.Special
{
	public class EatEnemyScepterSD : ChirrTargetableSkillDef
	{
		public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
		{
			BaseSkillInstanceData val = base.OnAssigned(skillSlot);
			ChirrTracker chirrTracker = ((InstanceData)(object)val).chirrTracker;
			chirrTracker.maxTrackingDistance = 10f;
			chirrTracker.targetNeedsHealthThreshold = false;
			chirrTracker.targetCanBeNonMaster = true;
			chirrTracker.targetCanBeBoss = true;
			return val;
		}
	}
	public class EatEnemySD : ChirrTargetableSkillDef
	{
		public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
		{
			BaseSkillInstanceData val = base.OnAssigned(skillSlot);
			ChirrTracker chirrTracker = ((InstanceData)(object)val).chirrTracker;
			chirrTracker.maxTrackingDistance = 5f;
			chirrTracker.targetNeedsHealthThreshold = false;
			chirrTracker.targetCanBeNonMaster = true;
			chirrTracker.targetCanBeBoss = false;
			return val;
		}
	}
	internal class EatRadiusBehavior : MonoBehaviour
	{
		private CharacterBody characterBody;

		private readonly float updateFrequency = 0.5f;

		private float stopwatch = 0f;

		private GameObject indicator;

		private bool indicatorEnabled
		{
			get
			{
				return Object.op_Implicit((Object)(object)indicator);
			}
			set
			{
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				if (indicatorEnabled != value)
				{
					if (value)
					{
						GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/NearbyDamageBonusIndicator");
						indicator = Object.Instantiate<GameObject>(val, characterBody.corePosition, Quaternion.identity);
						indicator.GetComponent<NetworkedBodyAttachment>().AttachToGameObjectAndSpawn(((Component)this).gameObject, (string)null);
					}
					else
					{
						Object.Destroy((Object)(object)indicator);
						indicator = null;
					}
				}
			}
		}

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

		private void OnEnable()
		{
			indicatorEnabled = true;
		}

		private void OnDisable()
		{
			indicatorEnabled = false;
		}

		private void FixedUpdate()
		{
		}
	}
	public class TransformEnemyScepterSD : ChirrTargetableSkillDef
	{
		public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
		{
			BaseSkillInstanceData val = base.OnAssigned(skillSlot);
			ChirrTracker chirrTracker = ((InstanceData)(object)val).chirrTracker;
			chirrTracker.maxTrackingDistance = 10f;
			chirrTracker.targetCanBeBoss = false;
			chirrTracker.targetCanBeNonMaster = true;
			chirrTracker.targetNeedsHealthThreshold = true;
			chirrTracker.targetHealthThresholdPercentage = 0.5f;
			return val;
		}
	}
	public class TransformEnemySD : ChirrTargetableSkillDef
	{
		public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
		{
			BaseSkillInstanceData val = base.OnAssigned(skillSlot);
			ChirrTracker chirrTracker = ((InstanceData)(object)val).chirrTracker;
			chirrTracker.maxTrackingDistance = 5f;
			chirrTracker.targetCanBeBoss = true;
			chirrTracker.targetCanBeNonMaster = true;
			chirrTracker.targetNeedsHealthThreshold = true;
			chirrTracker.targetHealthThresholdPercentage = 0.5f;
			return val;
		}
	}
}
namespace ChirrAltSkills.Chirr.SkillDefs.Passive
{
	public class PassiveBunnySD : AssignableSkillDef
	{
		public class InstanceData : BaseSkillInstanceData
		{
			public GenericSkill skillSlot;

			public void BunnyBoostOnLand_Server(ref HitGroundInfo _)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				skillSlot.characterBody.AddTimedBuffAuthority(Buffs.bunnyJumpBuff.buffIndex, 10f);
			}
		}

		public override BaseSkillInstanceData OnAssigned(GenericSkill skillSlot)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			InstanceData instanceData = new InstanceData
			{
				skillSlot = skillSlot
			};
			CharacterBody characterBody = skillSlot.characterBody;
			characterBody.baseJumpCount += 2;
			CharacterBody characterBody2 = skillSlot.characterBody;
			characterBody2.baseJumpPower -= 3.75f;
			CharacterBody characterBody3 = skillSlot.characterBody;
			characterBody3.bodyFlags = (BodyFlags)(characterBody3.bodyFlags | 1);
			skillSlot.characterBody.MarkAllStatsDirty();
			skillSlot.characterBody.characterMotor.onHitGroundAuthority += new HitGroundDelegate(instanceData.BunnyBoostOnLand_Server);
			return (BaseSkillInstanceData)(object)instanceData;
		}

		public override void OnUnassigned(GenericSkill skillSlot)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			CharacterBody characterBody = skillSlot.characterBody;
			characterBody.baseJumpCount -= 2;
			CharacterBody characterBody2 = skillSlot.characterBody;
			characterBody2.baseJumpPower += 3.75f;
			if (NetworkServer.active)
			{
				while (skillSlot.characterBody.HasBuff(Buffs.bunnyJumpBuff))
				{
					skillSlot.characterBody.RemoveBuff(Buffs.bunnyJumpBuff);
				}
			}
			CharacterBody characterBody3 = skillSlot.characterBody;
			characterBody3.bodyFlags = (BodyFlags)(characterBody3.bodyFlags & -2);
			skillSlot.characterBody.MarkAllStatsDirty();
			skillSlot.characterBody.characterMotor.onHitGroundAuthority -= new HitGroundDelegate(((InstanceData)(object)skillSlot.skillInstanceData).BunnyBoostOnLand_Server);
			base.OnUnassigned(skillSlot);
		}
	}
	public class PassiveTakeFlightSD : AssignableSkillDef
	{
		public override BaseSkillInstanceData OnAssigned(GenericSkill skillSlot)
		{
			skillSlot.characterBody.baseJumpPower = 22.5f;
			return base.OnAssigned(skillSlot);
		}

		public override void OnUnassigned(GenericSkill skillSlot)
		{
			skillSlot.characterBody.baseJumpPower = 15f;
			base.OnUnassigned(skillSlot);
		}
	}
}