Decompiled source of MandoGaming v1.5.0

plugins/MandoGaming/MandoGaming.dll

Decompiled 18 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.Mage.Weapon;
using HG.Reflection;
using MandoGaming.Achievements;
using MandoGaming.EntityStates;
using MandoGaming.VFX;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.Achievements;
using RoR2.Orbs;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPathsBetter;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MandoGaming")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c988079955e49d627ea90ee7f89be9a0c0585f20")]
[assembly: AssemblyProduct("MandoGaming")]
[assembly: AssemblyTitle("MandoGaming")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MandoGaming
{
	public static class Keywords
	{
		public static void Create()
		{
			LanguageAPI.Add("KEYWORD_ARC", "<style=cKeywordName>Arcing</style><style=cSub>Arc lighting up to 4 enemies for 30% damage per hit.</style>");
			LanguageAPI.Add("KEYWORD_FRICTIONLESS", "<style=cKeywordName>Frictionless</style><style=cSub>Suffers no damage falloff.</style>");
		}
	}
	internal static class Log
	{
		internal static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		private static string getLogPrefix(string callerPath, string callerMemberName, int callerLineNumber)
		{
			int num = callerPath.LastIndexOf("MandoGaming");
			if (num >= 0)
			{
				callerPath = callerPath.Substring(num + "MandoGaming".Length + 1);
			}
			return $"{callerPath}:{callerLineNumber} ({callerMemberName}) ";
		}

		internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogError((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Error_NoCallerPrefix(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogFatal((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Fatal_NoCallerPrefix(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogInfo((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Info_NoCallerPrefix(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogMessage((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Message_NoCallerPrefix(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogWarning((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Warning_NoCallerPrefix(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("HIFU.MandoGaming", "MandoGaming", "1.5.0")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "HIFU.MandoGaming";

		public const string PluginAuthor = "HIFU";

		public const string PluginName = "MandoGaming";

		public const string PluginVersion = "1.5.0";

		public static ConfigFile MandoGamingConfig;

		public static AssetBundle mandogaming;

		internal static Main Instance { get; private set; }

		public static string PluginDirectory { get; private set; }

		public void Awake()
		{
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			MandoGamingConfig = ((BaseUnityPlugin)this).Config;
			mandogaming = AssetBundle.LoadFromFile(Path.Combine(PluginDirectory, "mandogaming"));
			if (!Object.op_Implicit((Object)(object)mandogaming))
			{
				Log.Error("Failed to load the mandogaming asset bundle, skill icons will be missing", "D:\\Games\\LostItems\\mandogaming\\MandoGaming\\Main.cs", "Awake", 45);
			}
			Unlocks.Create();
			Keywords.Create();
			HeavyTapTracer.Create();
			PlasmaTapTracer.Create();
			Log.Info("==+----------------==SKILLS==----------------+==", "D:\\Games\\LostItems\\mandogaming\\MandoGaming\\Main.cs", "Awake", 53);
			foreach (Type item in from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(SkillDefBase))
				select type)
			{
				SkillDefBase skillDefBase = (SkillDefBase)Activator.CreateInstance(item);
				if (ValidateSkillDef(skillDefBase))
				{
					skillDefBase.Init();
				}
			}
			bool flag = default(bool);
			ContentAddition.AddEntityState<HeavyTapState>(ref flag);
			ContentAddition.AddEntityState<PlasmaTapState>(ref flag);
			ContentAddition.AddEntityState<PRFRVWildfireStormState>(ref flag);
		}

		public bool ValidateSkillDef(SkillDefBase sdb)
		{
			if (sdb.isEnabled)
			{
				return ((BaseUnityPlugin)this).Config.Bind<bool>(sdb.NameText, "Enable?", true, "Vanilla is false").Value;
			}
			return false;
		}
	}
	public abstract class SkillDefBase
	{
		public SkillDef skillDef;

		public static SkillLocator commandoSkillLocator = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Commando.CommandoBody_prefab).WaitForCompletion().GetComponent<SkillLocator>();

		public abstract string NameToken { get; }

		public abstract string NameText { get; }

		public abstract string DescriptionText { get; }

		public abstract SerializableEntityStateType ActivationState { get; }

		public abstract string ActivationStateMachineName { get; }

		public abstract int BaseMaxStock { get; }

		public abstract float BaseRechargeInterval { get; }

		public abstract bool BeginSkillCooldownOnSkillEnd { get; }

		public abstract bool CanceledFromSprinting { get; }

		public abstract bool CancelSprintingOnActivation { get; }

		public virtual bool FullRestockOnAssign { get; } = true;

		public abstract InterruptPriority SkillInterruptPriority { get; }

		public abstract bool IsCombatSkill { get; }

		public abstract bool MustKeyPress { get; }

		public abstract int RechargeStock { get; }

		public abstract Sprite Icon { get; }

		public abstract int StockToConsume { get; }

		public abstract string[] KeywordTokens { get; }

		public abstract bool ResetCooldownTimerOnUse { get; }

		public abstract int RequiredStock { get; }

		public abstract SkillSlot SkillSlot { get; }

		public virtual bool isEnabled { get; } = true;

		public abstract UnlockableDef UnlockableDef { get; }

		public T ConfigOption<T>(T value, string name, string description)
		{
			return Main.MandoGamingConfig.Bind<T>(NameText, name, value, description).Value;
		}

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

		public static Sprite LoadSprite(string name)
		{
			if (!Object.op_Implicit((Object)(object)Main.mandogaming))
			{
				return null;
			}
			return Main.mandogaming.LoadAsset<Sprite>(name);
		}

		public virtual SkillDef CreateSkillDef()
		{
			return ScriptableObject.CreateInstance<SkillDef>();
		}

		public virtual void Init()
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Expected O, but got Unknown
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			string text = "COMMANDO_" + NameToken.ToUpper() + "_NAME";
			string text2 = "COMMANDO_" + NameToken.ToUpper() + "_DESCRIPTION";
			LanguageAPI.Add(text, NameText);
			LanguageAPI.Add(text2, DescriptionText);
			skillDef = CreateSkillDef();
			skillDef.skillName = "Commando" + NameToken;
			((Object)skillDef).name = skillDef.skillName;
			skillDef.skillNameToken = text;
			skillDef.skillDescriptionToken = text2;
			skillDef.activationState = ActivationState;
			skillDef.activationStateMachineName = ActivationStateMachineName;
			skillDef.baseMaxStock = BaseMaxStock;
			skillDef.baseRechargeInterval = BaseRechargeInterval;
			skillDef.beginSkillCooldownOnSkillEnd = BeginSkillCooldownOnSkillEnd;
			skillDef.canceledFromSprinting = CanceledFromSprinting;
			skillDef.cancelSprintingOnActivation = CancelSprintingOnActivation;
			skillDef.fullRestockOnAssign = FullRestockOnAssign;
			skillDef.interruptPriority = SkillInterruptPriority;
			skillDef.isCombatSkill = IsCombatSkill;
			skillDef.mustKeyPress = MustKeyPress;
			skillDef.rechargeStock = RechargeStock;
			skillDef.icon = Icon;
			skillDef.stockToConsume = StockToConsume;
			skillDef.keywordTokens = KeywordTokens;
			skillDef.resetCooldownTimerOnUse = ResetCooldownTimerOnUse;
			skillDef.requiredStock = RequiredStock;
			ContentAddition.AddSkillDef(skillDef);
			SkillFamily skillFamily = commandoSkillLocator.GetSkill(SkillSlot).skillFamily;
			Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
			Variant[] variants = skillFamily.variants;
			int num = skillFamily.variants.Length - 1;
			Variant val = new Variant
			{
				skillDef = skillDef,
				unlockableDef = UnlockableDef
			};
			((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null);
			variants[num] = val;
			Log.Info("Added " + NameText, "D:\\Games\\LostItems\\mandogaming\\MandoGaming\\SkillDefBase.cs", "Init", 101);
		}
	}
}
namespace MandoGaming.VFX
{
	public static class HeavyTapTracer
	{
		public static GameObject prefab;

		public static void Create()
		{
			//IL_0005: 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)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			prefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Junk_Bandit.TracerBanditShotgun_prefab).WaitForCompletion(), "HeavyTapTracer", false);
			Tracer component = prefab.GetComponent<Tracer>();
			component.length *= 1.8f;
			component.beamDensity *= 1.5f;
			LineRenderer[] componentsInChildren = prefab.GetComponentsInChildren<LineRenderer>();
			foreach (LineRenderer obj in componentsInChildren)
			{
				obj.endColor = new Color(0.025f, 0.02f, 0.3f);
				obj.startColor = new Color(0.2f, 0.175f, 0.7f);
			}
			VFXAttributes val = default(VFXAttributes);
			if (!prefab.TryGetComponent<VFXAttributes>(ref val))
			{
				val = prefab.AddComponent<VFXAttributes>();
			}
			val.vfxPriority = (VFXPriority)1;
			val.vfxIntensity = (VFXIntensity)1;
			ContentAddition.AddEffect(prefab);
		}
	}
	public static class PlasmaTapTracer
	{
		public static GameObject prefab;

		public static void Create()
		{
			//IL_0005: 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)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			prefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Huntress.TracerHuntressSnipe_prefab).WaitForCompletion(), "PlasmaTapTracer", false);
			Tracer component = prefab.GetComponent<Tracer>();
			component.length = 40f;
			component.beamDensity = 5f;
			VFXAttributes val = default(VFXAttributes);
			if (!prefab.TryGetComponent<VFXAttributes>(ref val))
			{
				val = prefab.AddComponent<VFXAttributes>();
			}
			val.vfxPriority = (VFXPriority)2;
			val.vfxIntensity = (VFXIntensity)2;
			Transform val2 = prefab.transform.Find("TracerHead");
			LineRenderer val3 = (Object.op_Implicit((Object)(object)val2) ? ((Component)val2).GetComponent<LineRenderer>() : null);
			if (Object.op_Implicit((Object)(object)val3))
			{
				val3.startColor = new Color(0.1f, 0.2f, 0.7f);
				Material val4 = Object.Instantiate<Material>(((Renderer)val3).sharedMaterial);
				val4.SetColor("_TintColor", new Color(0.1f, 0.2f, 0.7f));
				((Renderer)val3).sharedMaterial = val4;
				val3.startWidth *= 0.4f;
				val3.endWidth *= 0.4f;
			}
			ContentAddition.AddEffect(prefab);
		}
	}
}
namespace MandoGaming.Skills
{
	public class HeavyTapSD : SkillDefBase
	{
		public override string NameToken => "HEAVYTAP";

		public override string NameText => "Heavy Tap";

		public override string DescriptionText => "<style=cIsDamage>Frictionless</style>. Shoot twice for <style=cIsDamage>2x155% damage</style>.";

		public override SerializableEntityStateType ActivationState => new SerializableEntityStateType(typeof(HeavyTapState));

		public override string ActivationStateMachineName => "Weapon";

		public override int BaseMaxStock => 1;

		public override float BaseRechargeInterval => 1f;

		public override bool BeginSkillCooldownOnSkillEnd => true;

		public override bool CanceledFromSprinting => false;

		public override bool CancelSprintingOnActivation => true;

		public override InterruptPriority SkillInterruptPriority => (InterruptPriority)0;

		public override bool IsCombatSkill => true;

		public override bool MustKeyPress => false;

		public override int RechargeStock => 0;

		public override Sprite Icon => SkillDefBase.LoadSprite("HeavyTap.png");

		public override int StockToConsume => 0;

		public override string[] KeywordTokens => new string[1] { "KEYWORD_FRICTIONLESS" };

		public override bool ResetCooldownTimerOnUse => true;

		public override int RequiredStock => 1;

		public override SkillSlot SkillSlot => (SkillSlot)0;

		public override UnlockableDef UnlockableDef => Unlocks.heavyTap;
	}
	public class PlasmaTapSD : SkillDefBase
	{
		public override string NameToken => "PLASMATAP";

		public override string NameText => "Plasma Tap";

		public override string DescriptionText => "<style=cIsDamage>Arcing</style>. Fire a burst of lightning that deals <style=cIsDamage>100% damage</style> in a cone.";

		public override SerializableEntityStateType ActivationState => new SerializableEntityStateType(typeof(PlasmaTapState));

		public override string ActivationStateMachineName => "Weapon";

		public override int BaseMaxStock => 1;

		public override float BaseRechargeInterval => 1f;

		public override bool BeginSkillCooldownOnSkillEnd => false;

		public override bool CanceledFromSprinting => false;

		public override bool CancelSprintingOnActivation => true;

		public override InterruptPriority SkillInterruptPriority => (InterruptPriority)0;

		public override bool IsCombatSkill => true;

		public override bool MustKeyPress => false;

		public override int RechargeStock => 1;

		public override Sprite Icon => SkillDefBase.LoadSprite("PlasmaTap.png");

		public override int StockToConsume => 0;

		public override string[] KeywordTokens => new string[1] { "KEYWORD_ARC" };

		public override bool ResetCooldownTimerOnUse => true;

		public override int RequiredStock => 1;

		public override SkillSlot SkillSlot => (SkillSlot)0;

		public override UnlockableDef UnlockableDef => Unlocks.plasmaTap;

		public override SkillDef CreateSkillDef()
		{
			SteppedSkillDef obj = ScriptableObject.CreateInstance<SteppedSkillDef>();
			obj.stepCount = 2;
			obj.stepGraceDuration = 0.1f;
			return (SkillDef)(object)obj;
		}
	}
	public class PRFRVWildfireStormSD : SkillDefBase
	{
		public override string NameToken => "PRFRVWILDFIRESTORM";

		public override string NameText => "PRFR-V Wildfire Storm";

		public override string DescriptionText => "Fire a continuous stream of flame that deals <style=cIsDamage>550% damage</style> per second and has a chance to <style=cIsDamage>ignite</style> enemies.";

		public override SerializableEntityStateType ActivationState => new SerializableEntityStateType(typeof(PRFRVWildfireStormState));

		public override string ActivationStateMachineName => "Weapon";

		public override int BaseMaxStock => 1;

		public override float BaseRechargeInterval => 4f;

		public override bool BeginSkillCooldownOnSkillEnd => false;

		public override bool CanceledFromSprinting => false;

		public override bool CancelSprintingOnActivation => true;

		public override InterruptPriority SkillInterruptPriority => (InterruptPriority)0;

		public override bool IsCombatSkill => true;

		public override bool MustKeyPress => true;

		public override int RechargeStock => 1;

		public override Sprite Icon => SkillDefBase.LoadSprite("PRFRVWildfireStorm.png");

		public override int StockToConsume => 1;

		public override string[] KeywordTokens => null;

		public override bool ResetCooldownTimerOnUse => false;

		public override int RequiredStock => 1;

		public override SkillSlot SkillSlot => (SkillSlot)1;

		public override UnlockableDef UnlockableDef => Unlocks.prfrVWildfireStorm;
	}
}
namespace MandoGaming.EntityStates
{
	public class HeavyTapState : BaseSkillState
	{
		public float duration;

		public static float baseDuration = 0.15f;

		public static float secondDuration = 0.35f;

		public int remainingShots = 2;

		public bool finalShot;

		public static string fireHeavyPistolSoundString = "play_bandit_M2_shot";

		public static GameObject hitEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Common_VFX.Hitspark1_prefab).WaitForCompletion();

		public static float recoilAmplitude = 1f;

		public static float maxRange = 250f;

		public static float damageCoefficient = 1.55f;

		public static float force = 40f;

		public static float procCoefficient = 0.9f;

		private Ray aimRay;

		public override void OnEnter()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = (finalShot ? secondDuration : baseDuration) / ((BaseState)this).attackSpeedStat;
			aimRay = ((BaseState)this).GetAimRay();
			((BaseState)this).StartAimMode(aimRay, 3f, false);
			if (remainingShots % 2 == 0)
			{
				((EntityState)this).PlayAnimation("Gesture Additive, Left", "FirePistol, Left");
				FireBullet("MuzzleLeft");
			}
			else
			{
				((EntityState)this).PlayAnimation("Gesture Additive, Right", "FirePistol, Right");
				FireBullet("MuzzleRight");
			}
		}

		public void FireBullet(string targetMuzzle)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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)
			//IL_00a1: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: 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_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			Util.PlaySound(fireHeavyPistolSoundString, ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)FirePistol2.muzzleEffectPrefab))
			{
				EffectManager.SimpleMuzzleFlash(FirePistol2.muzzleEffectPrefab, ((EntityState)this).gameObject, targetMuzzle, false);
			}
			((BaseState)this).AddRecoil(-0.45f * recoilAmplitude, 0.9f * recoilAmplitude, -0.34f * recoilAmplitude, 0.34f * 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 = 0f,
					damage = damageCoefficient * ((BaseState)this).damageStat,
					force = force,
					tracerEffectPrefab = HeavyTapTracer.prefab,
					muzzleName = targetMuzzle,
					hitEffectPrefab = hitEffectPrefab,
					isCrit = ((BaseState)this).RollCrit(),
					radius = 0.4f,
					smartCollision = true,
					falloffModel = (FalloffModel)0,
					maxDistance = maxRange,
					procCoefficient = procCoefficient,
					damageType = DamageTypeCombo.GenericPrimary
				}.Fire();
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (!(((EntityState)this).fixedAge < duration) && ((EntityState)this).isAuthority)
			{
				remainingShots--;
				if (remainingShots <= 0)
				{
					((EntityState)this).outer.SetNextStateToMain();
					return;
				}
				((EntityState)this).outer.SetNextState((EntityState)(object)new HeavyTapState
				{
					remainingShots = remainingShots,
					finalShot = (remainingShots == 1)
				});
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}
	}
	public class PlasmaTapState : BaseSkillState, IStepSetter
	{
		public float duration;

		public static float baseDuration = 0.25f;

		public static float maxRange = 100f;

		public int pistol;

		public static float damageCoefficient = 1f;

		public static float damageArcing = 0.3f;

		public static float arcProcCoefficient = 0.15f;

		public static GameObject hitEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Common_VFX.LightningFlash_prefab).WaitForCompletion();

		public static string attackSoundString = "Play_item_proc_chain_lightning";

		public static float recoilAmplitude = 1f;

		private Ray aimRay;

		private HurtBox initialOrbTarget;

		private readonly BullseyeSearch search = new BullseyeSearch();

		private ChildLocator childLocator;

		private Transform modelTransform;

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

		public override void OnEnter()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			aimRay = ((BaseState)this).GetAimRay();
			((BaseState)this).StartAimMode(aimRay, 3f, false);
			modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				childLocator = ((Component)modelTransform).GetComponent<ChildLocator>();
			}
			if (pistol % 2 == 0)
			{
				((EntityState)this).PlayAnimation("Gesture Additive, Left", "FirePistol, Left");
				FireBullet("MuzzleLeft");
			}
			else
			{
				((EntityState)this).PlayAnimation("Gesture Additive, Right", "FirePistol, Right");
				FireBullet("MuzzleRight");
			}
			SearchForTarget(aimRay);
			FireOrb();
		}

		private void SearchForTarget(Ray aimRay)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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_0034: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			search.teamMaskFilter = TeamMask.GetUnprotectedTeams(((EntityState)this).teamComponent.teamIndex);
			search.filterByLoS = true;
			search.searchOrigin = ((Ray)(ref aimRay)).origin;
			search.searchDirection = ((Ray)(ref aimRay)).direction;
			search.sortMode = (SortMode)1;
			search.maxDistanceFilter = maxRange;
			search.maxAngleFilter = 360f;
			search.RefreshCandidates();
			search.FilterOutGameObject(((EntityState)this).gameObject);
			initialOrbTarget = search.GetResults().FirstOrDefault();
		}

		private void FireOrb()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)initialOrbTarget))
			{
				LightningOrb val = new LightningOrb
				{
					lightningType = (LightningType)0,
					damageValue = damageArcing * ((BaseState)this).damageStat,
					isCrit = ((BaseState)this).RollCrit(),
					teamIndex = TeamComponent.GetObjectTeam(((EntityState)this).gameObject),
					attacker = ((EntityState)this).gameObject,
					procCoefficient = arcProcCoefficient,
					bouncesRemaining = 1,
					speed = 120f,
					bouncedObjects = new List<HealthComponent>(),
					range = 30f,
					targetsToFindPerBounce = 3,
					damageType = DamageTypeCombo.GenericPrimary
				};
				Transform val2 = (Object.op_Implicit((Object)(object)childLocator) ? childLocator.FindChild((pistol % 2 == 0) ? "HandL" : "HandR") : null);
				((Orb)val).origin = (Object.op_Implicit((Object)(object)val2) ? val2.position : ((Ray)(ref aimRay)).origin);
				((Orb)val).target = initialOrbTarget;
				OrbManager.instance.AddOrb((Orb)(object)val);
			}
		}

		public void FireBullet(string targetMuzzle)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_00f6: 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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			Util.PlaySound(attackSoundString, ((EntityState)this).gameObject);
			Util.PlaySound("Play_mage_m1_cast_lightning", ((EntityState)this).gameObject);
			if (Object.op_Implicit((Object)(object)FirePistol2.muzzleEffectPrefab))
			{
				EffectManager.SimpleMuzzleFlash(FirePistol2.muzzleEffectPrefab, ((EntityState)this).gameObject, targetMuzzle, false);
			}
			((BaseState)this).AddRecoil(-0.4f * recoilAmplitude, 0.8f * recoilAmplitude, -0.3f * recoilAmplitude, 0.3f * 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 = 0f,
					damage = damageCoefficient * ((BaseState)this).damageStat,
					tracerEffectPrefab = PlasmaTapTracer.prefab,
					muzzleName = targetMuzzle,
					hitEffectPrefab = hitEffectPrefab,
					isCrit = ((BaseState)this).RollCrit(),
					radius = 1f,
					smartCollision = true,
					falloffModel = (FalloffModel)1,
					maxDistance = maxRange,
					damageType = DamageTypeCombo.GenericPrimary
				}.Fire();
			}
		}

		public override void FixedUpdate()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			((EntityState)this).FixedUpdate();
			if (!(((EntityState)this).fixedAge < duration) && ((EntityState)this).isAuthority)
			{
				if (((BaseSkillState)this).activatorSkillSlot.stock <= 0)
				{
					((EntityState)this).outer.SetNextState((EntityState)new ReloadPistols());
				}
				else
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)1;
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnSerialize(writer);
			NetworkExtensions.Write(writer, HurtBoxReference.FromHurtBox(initialOrbTarget));
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			((BaseSkillState)this).OnDeserialize(reader);
			HurtBoxReference val = NetworkExtensions.ReadHurtBoxReference(reader);
			initialOrbTarget = ((HurtBoxReference)(ref val)).ResolveHurtBox();
		}
	}
	public class PRFRVWildfireStormState : BaseState
	{
		public static float baseFlameTimer = 1f;

		public static float baseTickFrequency = 11f;

		public static float tickDamage = 0.5f;

		public static float tickProc = 1f;

		public static float igniteChance = 30f;

		public static float baseEntryTimer = 0.2f;

		public static float recoilForce = 290f;

		public static GameObject flamethrowerEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Mage.MageFlamethrowerEffect_prefab).WaitForCompletion();

		public float force = 50f;

		private const float flameDistance = 20f;

		private static string startFlameAttackString = "Play_item_proc_fireRingTornado_start";

		private static string endFlameAttackString = "Play_item_proc_fireRingTornado_end";

		private float stopwatch;

		private float entryTimer;

		private bool flameInitiated;

		private float flameStopwatch;

		private float tickFrequency;

		private float flameTimer;

		private ChildLocator childLocator;

		private Transform leftFlame;

		private Transform rightFlame;

		private bool isCrit;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			stopwatch = 0f;
			flameInitiated = false;
			entryTimer = baseEntryTimer / base.attackSpeedStat;
			flameTimer = baseFlameTimer;
			tickFrequency = 3.2f * (base.attackSpeedStat - 1f) + baseTickFrequency;
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.SetAimTimer(entryTimer + flameTimer + 1f);
			}
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				childLocator = ((Component)modelTransform).GetComponent<ChildLocator>();
			}
			if (((EntityState)this).isAuthority)
			{
				isCrit = ((BaseState)this).RollCrit();
			}
		}

		public override void OnExit()
		{
			Util.PlaySound(endFlameAttackString, ((EntityState)this).gameObject);
			((EntityState)this).PlayAnimation("Gesture, Additive", "FireFMJ", "FireFMJ.playbackRate", 0.6f, 0f);
			((EntityState)this).PlayAnimation("Gesture, Override", "FireFMJ", "FireFMJ.playbackRate", 0.6f, 0f);
			if (Object.op_Implicit((Object)(object)leftFlame))
			{
				EntityState.Destroy((Object)(object)((Component)leftFlame).gameObject);
			}
			if (Object.op_Implicit((Object)(object)rightFlame))
			{
				EntityState.Destroy((Object)(object)((Component)rightFlame).gameObject);
			}
			((EntityState)this).OnExit();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.isSprinting = false;
			}
			stopwatch += Time.fixedDeltaTime;
			if (stopwatch >= entryTimer && !flameInitiated)
			{
				flameInitiated = true;
				Util.PlaySound(startFlameAttackString, ((EntityState)this).gameObject);
				leftFlame = SpawnFlameEffect("MuzzleLeft");
				rightFlame = SpawnFlameEffect("MuzzleRight");
				Flame("MuzzleCenter");
			}
			if (flameInitiated)
			{
				flameStopwatch += Time.fixedDeltaTime;
				if (flameStopwatch > 1f / tickFrequency)
				{
					flameStopwatch -= 1f / tickFrequency;
					Flame("MuzzleCenter");
				}
				UpdateFlame();
			}
			if (stopwatch >= flameTimer + entryTimer && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private Transform SpawnFlameEffect(string muzzleName)
		{
			Transform val = (Object.op_Implicit((Object)(object)childLocator) ? childLocator.FindChild(muzzleName) : null);
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)flamethrowerEffectPrefab))
			{
				return null;
			}
			Transform transform = Object.Instantiate<GameObject>(flamethrowerEffectPrefab, val).transform;
			ScaleParticleSystemDuration val2 = default(ScaleParticleSystemDuration);
			if (((Component)transform).TryGetComponent<ScaleParticleSystemDuration>(ref val2))
			{
				val2.newDuration = flameTimer;
			}
			return transform;
		}

		private void UpdateFlame()
		{
			//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_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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)
			Ray aimRay = ((BaseState)this).GetAimRay();
			Vector3 direction = ((Ray)(ref aimRay)).direction;
			if (Object.op_Implicit((Object)(object)leftFlame))
			{
				leftFlame.forward = direction;
			}
			if (Object.op_Implicit((Object)(object)rightFlame))
			{
				rightFlame.forward = direction;
			}
		}

		private void Flame(string muzzleString)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)this).isAuthority)
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				DamageTypeCombo genericSecondary = DamageTypeCombo.GenericSecondary;
				if (Util.CheckRoll(igniteChance, ((EntityState)this).characterBody.master))
				{
					ref DamageType damageType = ref genericSecondary.damageType;
					damageType = (DamageType)((uint)damageType | 0x80u);
				}
				new BulletAttack
				{
					owner = ((EntityState)this).gameObject,
					weapon = ((EntityState)this).gameObject,
					origin = ((Ray)(ref aimRay)).origin,
					aimVector = ((Ray)(ref aimRay)).direction,
					minSpread = 0f,
					damage = tickDamage * base.damageStat,
					force = force,
					muzzleName = muzzleString,
					hitEffectPrefab = Flamethrower.impactEffectPrefab,
					isCrit = isCrit,
					radius = Flamethrower.radius,
					falloffModel = (FalloffModel)0,
					stopperMask = ((LayerIndex)(ref LayerIndex.world)).mask,
					procCoefficient = tickProc,
					maxDistance = 20f,
					smartCollision = true,
					damageType = genericSecondary
				}.Fire();
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
				{
					((EntityState)this).characterMotor.ApplyForce(((Ray)(ref aimRay)).direction * (0f - recoilForce), false, false);
				}
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			return (InterruptPriority)2;
		}
	}
}
namespace MandoGaming.Achievements
{
	[RegisterAchievement("CommandoHeavyTap", "Commando.Skills_HeavyTap", null, 3u, null)]
	public class HeavyTapAchievement : BaseAchievement
	{
		private int primaryUseCount;

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

		public override void OnBodyRequirementMet()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			((BaseAchievement)this).OnBodyRequirementMet();
			CharacterBody.OnSkillActivated += new hook_OnSkillActivated(CharacterBody_OnSkillActivated);
			TeleporterInteraction.onTeleporterChargedGlobal += TeleporterInteraction_onTeleporterChargedGlobal;
			Run.onRunStartGlobal += Run_onRunStartGlobal;
			Stage.onStageStartGlobal += Stage_onStageStartGlobal;
		}

		public override void OnBodyRequirementBroken()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			CharacterBody.OnSkillActivated -= new hook_OnSkillActivated(CharacterBody_OnSkillActivated);
			TeleporterInteraction.onTeleporterChargedGlobal -= TeleporterInteraction_onTeleporterChargedGlobal;
			Run.onRunStartGlobal -= Run_onRunStartGlobal;
			Stage.onStageStartGlobal -= Stage_onStageStartGlobal;
			((BaseAchievement)this).OnBodyRequirementBroken();
		}

		private void Run_onRunStartGlobal(Run run)
		{
			primaryUseCount = 0;
		}

		private void Stage_onStageStartGlobal(Stage stage)
		{
			primaryUseCount = 0;
		}

		private void TeleporterInteraction_onTeleporterChargedGlobal(TeleporterInteraction teleporterInteraction)
		{
			if (primaryUseCount == 0)
			{
				((BaseAchievement)this).Grant();
			}
		}

		private void CharacterBody_OnSkillActivated(orig_OnSkillActivated orig, CharacterBody self, GenericSkill skill)
		{
			LocalUser localUser = ((BaseAchievement)this).localUser;
			CharacterBody val = ((localUser != null) ? localUser.cachedBody : null);
			if (Object.op_Implicit((Object)(object)val) && (Object)(object)self == (Object)(object)val && (Object)(object)skill == (Object)(object)val.skillLocator.primary)
			{
				primaryUseCount++;
			}
			orig.Invoke(self, skill);
		}
	}
	[RegisterAchievement("CommandoPlasmaTap", "Commando.Skills_PlasmaTap", null, 3u, typeof(PlasmaTapServerAchievement))]
	public class PlasmaTapAchievement : BaseAchievement
	{
		public class PlasmaTapServerAchievement : BaseServerAchievement
		{
			private int zapCount;

			public override void OnInstall()
			{
				((BaseServerAchievement)this).OnInstall();
				GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
				Run.onRunStartGlobal += Run_onRunStartGlobal;
			}

			public override void OnUninstall()
			{
				GlobalEventManager.onServerDamageDealt -= GlobalEventManager_onServerDamageDealt;
				Run.onRunStartGlobal -= Run_onRunStartGlobal;
				((BaseServerAchievement)this).OnUninstall();
			}

			private void Run_onRunStartGlobal(Run run)
			{
				zapCount = 0;
			}

			private void GlobalEventManager_onServerDamageDealt(DamageReport damageReport)
			{
				if (Object.op_Implicit((Object)(object)damageReport.attackerMaster) && !((Object)(object)damageReport.attackerMaster != (Object)(object)((BaseServerAchievement)this).networkUser.master))
				{
					if (((ProcChainMask)(ref damageReport.damageInfo.procChainMask)).HasProc((ProcType)3))
					{
						zapCount++;
					}
					if (zapCount >= 70)
					{
						((BaseServerAchievement)this).Grant();
					}
				}
			}
		}

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

		public override void OnBodyRequirementMet()
		{
			((BaseAchievement)this).OnBodyRequirementMet();
			((BaseAchievement)this).SetServerTracked(true);
		}

		public override void OnBodyRequirementBroken()
		{
			((BaseAchievement)this).SetServerTracked(false);
			((BaseAchievement)this).OnBodyRequirementBroken();
		}
	}
	[RegisterAchievement("CommandoPRFRVWildfireStorm", "Commando.Skills_PRFRVWildfireStorm", null, 3u, typeof(PRFRVWildfireStormServerAchievement))]
	public class PRFRVWildfireStormAchievement : BaseAchievement
	{
		public class PRFRVWildfireStormServerAchievement : BaseServerAchievement
		{
			private int igniteCount;

			public override void OnInstall()
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				((BaseServerAchievement)this).OnInstall();
				GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
				GlobalEventManager.ProcIgniteOnKill += new hook_ProcIgniteOnKill(GlobalEventManager_ProcIgniteOnKill);
				Run.onRunStartGlobal += Run_onRunStartGlobal;
				Stage.onServerStageBegin += Stage_onServerStageBegin;
			}

			public override void OnUninstall()
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Expected O, but got Unknown
				GlobalEventManager.onServerDamageDealt -= GlobalEventManager_onServerDamageDealt;
				GlobalEventManager.ProcIgniteOnKill -= new hook_ProcIgniteOnKill(GlobalEventManager_ProcIgniteOnKill);
				Run.onRunStartGlobal -= Run_onRunStartGlobal;
				Stage.onServerStageBegin -= Stage_onServerStageBegin;
				((BaseServerAchievement)this).OnUninstall();
			}

			private void Run_onRunStartGlobal(Run run)
			{
				igniteCount = 0;
			}

			private void Stage_onServerStageBegin(Stage stage)
			{
				igniteCount = 0;
			}

			private bool IsOwnAttack(DamageReport damageReport)
			{
				if (Object.op_Implicit((Object)(object)damageReport.attackerMaster))
				{
					return (Object)(object)damageReport.attackerMaster == (Object)(object)((BaseServerAchievement)this).networkUser.master;
				}
				return false;
			}

			private void AddIgnite()
			{
				igniteCount++;
				if (igniteCount >= 30)
				{
					((BaseServerAchievement)this).Grant();
				}
			}

			private void GlobalEventManager_ProcIgniteOnKill(orig_ProcIgniteOnKill orig, DamageReport damageReport, int igniteOnKillCount, CharacterBody victimBody, TeamIndex attackerTeamIndex)
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				if (igniteOnKillCount > 0 && IsOwnAttack(damageReport))
				{
					AddIgnite();
				}
				orig.Invoke(damageReport, igniteOnKillCount, victimBody, attackerTeamIndex);
			}

			private void GlobalEventManager_onServerDamageDealt(DamageReport damageReport)
			{
				//IL_0014: 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)
				if (IsOwnAttack(damageReport) && (damageReport.damageInfo.damageType.damageType & 0x80) != 0)
				{
					AddIgnite();
				}
			}
		}

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

		public override void OnBodyRequirementMet()
		{
			((BaseAchievement)this).OnBodyRequirementMet();
			((BaseAchievement)this).SetServerTracked(true);
		}

		public override void OnBodyRequirementBroken()
		{
			((BaseAchievement)this).SetServerTracked(false);
			((BaseAchievement)this).OnBodyRequirementBroken();
		}
	}
	public static class Unlocks
	{
		public static UnlockableDef heavyTap;

		public static UnlockableDef plasmaTap;

		public static UnlockableDef prfrVWildfireStorm;

		public static void Create()
		{
			heavyTap = CreateUnlockable("Commando.Skills_HeavyTap", "HeavyTap.png", "COMMANDOHEAVYTAP", "Commando: Have a Blast", "As Commando, complete a stage without using your Primary skill.");
			plasmaTap = CreateUnlockable("Commando.Skills_PlasmaTap", "PlasmaTap.png", "COMMANDOPLASMATAP", "Commando: Arch Essence", "As Commando, chain lightning 70 times in a single run.");
			prfrVWildfireStorm = CreateUnlockable("Commando.Skills_PRFRVWildfireStorm", "PRFRVWildfireStorm.png", "COMMANDOPRFRVWILDFIRESTORM", "Commando: Catch Fire", "As Commando, burn enemies 30 times on a single stage.");
			prfrVWildfireStorm.sortScore = plasmaTap.sortScore + 1;
		}

		private static UnlockableDef CreateUnlockable(string cachedName, string iconName, string achievementToken, string nameText, string descriptionText)
		{
			UnlockableDef obj = ScriptableObject.CreateInstance<UnlockableDef>();
			obj.cachedName = cachedName;
			obj.achievementIcon = SkillDefBase.LoadSprite(iconName);
			obj.nameToken = "ACHIEVEMENT_" + achievementToken + "_NAME";
			LanguageAPI.Add("ACHIEVEMENT_" + achievementToken + "_NAME", nameText);
			LanguageAPI.Add("ACHIEVEMENT_" + achievementToken + "_DESCRIPTION", descriptionText);
			ContentAddition.AddUnlockableDef(obj);
			return obj;
		}
	}
}