Decompiled source of CaptainExtraEffects v1.3.0

plugins/CaptainExtraEffects/CaptainExtraEffects.dll

Decompiled 2 weeks ago
using System;
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 BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.Captain.Weapon;
using Microsoft.CodeAnalysis;
using On.EntityStates.Captain.Weapon;
using On.RoR2;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Skills;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CaptainExtraEffects")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6686b40000462618185446117d26af7c219c2017")]
[assembly: AssemblyProduct("CaptainExtraEffects")]
[assembly: AssemblyTitle("CaptainExtraEffects")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 CaptainExtraEffects
{
	public sealed class ConfigValue<T>
	{
		public ConfigEntry<T> Entry;

		public readonly T DefaultValue;

		public readonly T MinValue;

		public readonly T MaxValue;

		public T Value => Entry.Value;

		public ConfigValue(T defaultValue)
		{
			DefaultValue = defaultValue;
			MinValue = default(T);
			MaxValue = default(T);
		}

		public ConfigValue(T defaultValue, T minValue, T maxValue)
		{
			DefaultValue = defaultValue;
			MinValue = minValue;
			MaxValue = maxValue;
		}

		public string DefaultAsString()
		{
			return $"Default: {DefaultValue}";
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.fafnir62.CaptainExtraEffects", "Captain Extra Effects", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class CaptainExtraEffectsPlugin : BaseUnityPlugin
	{
		private sealed class CaptainTazerTracker : MonoBehaviour
		{
			private CharacterBody body;

			private float boostStopwatch;

			private bool wasBoostActive;

			public bool IsBoostActive => boostStopwatch > 0f;

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

			public void Activate(float duration)
			{
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: 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_007a: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)body == (Object)null)
				{
					body = ((Component)this).GetComponent<CharacterBody>();
				}
				if ((Object)(object)body != (Object)null && (Object)(object)body.characterMotor != (Object)null)
				{
					Vector3 velocity = body.characterMotor.velocity;
					velocity.y = Mathf.Max(velocity.y, 6f);
					body.characterMotor.velocity = velocity;
				}
				boostStopwatch = Mathf.Max(boostStopwatch, duration);
				UpdateStatsIfNeeded();
			}

			private void FixedUpdate()
			{
				if (boostStopwatch <= 0f)
				{
					if (wasBoostActive)
					{
						UpdateStatsIfNeeded();
					}
				}
				else
				{
					boostStopwatch = Mathf.Max(0f, boostStopwatch - Time.fixedDeltaTime);
					UpdateStatsIfNeeded();
				}
			}

			private void UpdateStatsIfNeeded()
			{
				bool isBoostActive = IsBoostActive;
				if (isBoostActive != wasBoostActive)
				{
					wasBoostActive = isBoostActive;
					if ((Object)(object)body != (Object)null)
					{
						body.MarkAllStatsDirty();
						body.RecalculateStats();
					}
				}
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnEnter <0>__FireTazer_OnEnter;

			public static hook_RecalculateStats <1>__CharacterBody_RecalculateStats;

			public static hook_Start <2>__CharacterBody_Start;
		}

		public const string PluginGuid = "com.fafnir62.CaptainExtraEffects";

		public const string PluginName = "Captain Extra Effects";

		public const string PluginVersion = "1.1.0";

		private const string ConfigSectionPowerTazer = "Power Tazer";

		private const string ConfigSectionBeaconsCooldown = "Beacons Cooldown";

		private static ConfigValue<float> tazerBoostDuration = new ConfigValue<float>(3f, 1f, 6f);

		private static ConfigValue<bool> tazerEnableExtraJumps = new ConfigValue<bool>(defaultValue: true);

		private static ConfigValue<int> tazerExtraJumpCount = new ConfigValue<int>(1, 1, 5);

		private static ConfigValue<bool> tazerEnableSpeedBoost = new ConfigValue<bool>(defaultValue: true);

		private static ConfigValue<float> tazerSpeedBoostPercent = new ConfigValue<float>(40f, 0f, 100f);

		private static ConfigValue<bool> tazerEnableAgile = new ConfigValue<bool>(defaultValue: true);

		private static BodyIndex captainBodyIndex = (BodyIndex)(-1);

		private static BuffDef tazerBuff;

		private static ConfigValue<bool> EnableBeaconCD = new ConfigValue<bool>(defaultValue: true);

		private static ConfigValue<int> HealingBeaconCD = new ConfigValue<int>(60, 30, 720);

		private static ConfigValue<int> ShockingBeaconCD = new ConfigValue<int>(60, 30, 720);

		private static ConfigValue<int> EquipmentBeaconCD = new ConfigValue<int>(90, 45, 720);

		private static ConfigValue<int> HackingBeaconCD = new ConfigValue<int>(240, 120, 720);

		public float[] beaconCooldowns;

		public string[] beaconNameTokens = new string[4] { "CAPTAIN_SUPPLY_HEAL_NAME", "CAPTAIN_SUPPLY_SHOCKING_NAME", "CAPTAIN_SUPPLY_EQUIPMENT_RESTOCK_NAME", "CAPTAIN_SUPPLY_HACKING_NAME" };

		public float leftBeaconStopwatch = 0f;

		public float rightBeaconStopwatch = 0f;

		public float leftBeaconCooldown;

		public float rightBeaconCooldown;

		private void Awake()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//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_0051: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_0072: Expected O, but got Unknown
			BindConfig();
			RegisterRiskOfOptions();
			CreateBuff();
			object obj = <>O.<0>__FireTazer_OnEnter;
			if (obj == null)
			{
				hook_OnEnter val = FireTazer_OnEnter;
				<>O.<0>__FireTazer_OnEnter = val;
				obj = (object)val;
			}
			FireTazer.OnEnter += (hook_OnEnter)obj;
			object obj2 = <>O.<1>__CharacterBody_RecalculateStats;
			if (obj2 == null)
			{
				hook_RecalculateStats val2 = CharacterBody_RecalculateStats;
				<>O.<1>__CharacterBody_RecalculateStats = val2;
				obj2 = (object)val2;
			}
			CharacterBody.RecalculateStats += (hook_RecalculateStats)obj2;
			object obj3 = <>O.<2>__CharacterBody_Start;
			if (obj3 == null)
			{
				hook_Start val3 = CharacterBody_Start;
				<>O.<2>__CharacterBody_Start = val3;
				obj3 = (object)val3;
			}
			CharacterBody.Start += (hook_Start)obj3;
			CaptainSupplyDropController.FixedUpdate += new hook_FixedUpdate(OnRoR2SkillsCaptainSupplyDropSkillDefIsReady);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Captain Extra Effects loaded.");
		}

		private void OnDestroy()
		{
			//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_001c: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			object obj = <>O.<0>__FireTazer_OnEnter;
			if (obj == null)
			{
				hook_OnEnter val = FireTazer_OnEnter;
				<>O.<0>__FireTazer_OnEnter = val;
				obj = (object)val;
			}
			FireTazer.OnEnter -= (hook_OnEnter)obj;
			object obj2 = <>O.<1>__CharacterBody_RecalculateStats;
			if (obj2 == null)
			{
				hook_RecalculateStats val2 = CharacterBody_RecalculateStats;
				<>O.<1>__CharacterBody_RecalculateStats = val2;
				obj2 = (object)val2;
			}
			CharacterBody.RecalculateStats -= (hook_RecalculateStats)obj2;
			object obj3 = <>O.<2>__CharacterBody_Start;
			if (obj3 == null)
			{
				hook_Start val3 = CharacterBody_Start;
				<>O.<2>__CharacterBody_Start = val3;
				obj3 = (object)val3;
			}
			CharacterBody.Start -= (hook_Start)obj3;
			CaptainSupplyDropController.FixedUpdate -= new hook_FixedUpdate(OnRoR2SkillsCaptainSupplyDropSkillDefIsReady);
		}

		private static Sprite LoadEmbeddedSprite(string resourceName)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			Assembly assembly = typeof(CaptainExtraEffectsPlugin).Assembly;
			using Stream stream = assembly.GetManifestResourceStream(resourceName);
			if (stream == null)
			{
				Debug.LogError((object)("Failed to load resource: " + resourceName));
				return null;
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			Texture2D val = new Texture2D(2, 2);
			ImageConversion.LoadImage(val, array);
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		}

		private void CreateBuff()
		{
			tazerBuff = ScriptableObject.CreateInstance<BuffDef>();
			((Object)tazerBuff).name = "CaptainTazerBuff";
			tazerBuff.isDebuff = false;
			tazerBuff.canStack = false;
			tazerBuff.isCooldown = false;
			tazerBuff.iconSprite = LoadEmbeddedSprite("ExamplePlugin.Assets.tazer_buff_icon.png");
			ContentAddition.AddBuffDef(tazerBuff);
		}

		private void BindConfig()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Expected O, but got Unknown
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Expected O, but got Unknown
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Expected O, but got Unknown
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Expected O, but got Unknown
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Expected O, but got Unknown
			tazerBoostDuration.Entry = ((BaseUnityPlugin)this).Config.Bind<float>("Power Tazer", "Secondary Effects Duration", tazerBoostDuration.DefaultValue, new ConfigDescription("How long Power Tazer grants Captain an extra jump and the configured move speed bonus (in seconds). " + tazerBoostDuration.DefaultAsString(), (AcceptableValueBase)(object)new AcceptableValueRange<float>(tazerBoostDuration.MinValue, tazerBoostDuration.MaxValue), Array.Empty<object>()));
			tazerEnableExtraJumps.Entry = ((BaseUnityPlugin)this).Config.Bind<bool>("Power Tazer", "Enable Extra Jumps", tazerEnableExtraJumps.DefaultValue, "If enabled, Power Tazer grants extra jumps during the boost duration" + tazerEnableExtraJumps.DefaultAsString());
			tazerExtraJumpCount.Entry = ((BaseUnityPlugin)this).Config.Bind<int>("Power Tazer", "Extra Jump Count", tazerExtraJumpCount.DefaultValue, new ConfigDescription("How many extra jumps Power Tazer grants during the boost duration. " + tazerExtraJumpCount.DefaultAsString(), (AcceptableValueBase)(object)new AcceptableValueRange<int>(tazerExtraJumpCount.MinValue, tazerExtraJumpCount.MaxValue), Array.Empty<object>()));
			tazerEnableSpeedBoost.Entry = ((BaseUnityPlugin)this).Config.Bind<bool>("Power Tazer", "Enable Speed Boost", tazerEnableSpeedBoost.DefaultValue, "If enabled, Power Tazer grants the configured move speed bonus during the boost duration. " + tazerEnableSpeedBoost.DefaultAsString());
			tazerSpeedBoostPercent.Entry = ((BaseUnityPlugin)this).Config.Bind<float>("Power Tazer", "Speed Boost Percent", tazerSpeedBoostPercent.DefaultValue, new ConfigDescription("Percent move speed bonus while the Power Tazer boost is active. For example 30 will grant +30% speed boost. " + tazerSpeedBoostPercent.DefaultAsString(), (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 300f), Array.Empty<object>()));
			tazerEnableAgile.Entry = ((BaseUnityPlugin)this).Config.Bind<bool>("Power Tazer", "Enable Agile Tazer Boost", tazerEnableAgile.DefaultValue, "If enabled, Tazer can be used while sprinting. " + tazerEnableAgile.DefaultAsString());
			EnableBeaconCD.Entry = ((BaseUnityPlugin)this).Config.Bind<bool>("Beacons Cooldown", "Enable Beacons Cooldown", tazerEnableAgile.DefaultValue, "If enabled, Beacons will recharge after certain amount of time. " + tazerEnableAgile.DefaultAsString());
			HealingBeaconCD.Entry = ((BaseUnityPlugin)this).Config.Bind<int>("Beacons Cooldown", "Healing Beacon Cooldown", HealingBeaconCD.DefaultValue, new ConfigDescription("Captain's Healing Beacon Cooldown in seconds. " + HealingBeaconCD.DefaultAsString(), (AcceptableValueBase)(object)new AcceptableValueRange<int>(HealingBeaconCD.MinValue, HealingBeaconCD.MaxValue), Array.Empty<object>()));
			ShockingBeaconCD.Entry = ((BaseUnityPlugin)this).Config.Bind<int>("Beacons Cooldown", "Shocking Beacon Cooldown", ShockingBeaconCD.DefaultValue, new ConfigDescription("Captain's Shocking Beacon Cooldown in seconds. " + ShockingBeaconCD.DefaultAsString(), (AcceptableValueBase)(object)new AcceptableValueRange<int>(ShockingBeaconCD.MinValue, ShockingBeaconCD.MaxValue), Array.Empty<object>()));
			EquipmentBeaconCD.Entry = ((BaseUnityPlugin)this).Config.Bind<int>("Beacons Cooldown", "Equipment Beacon Cooldown", EquipmentBeaconCD.DefaultValue, new ConfigDescription("Captain's Equipment Beacon Cooldown in seconds. Default: " + EquipmentBeaconCD.DefaultAsString(), (AcceptableValueBase)(object)new AcceptableValueRange<int>(EquipmentBeaconCD.MinValue, EquipmentBeaconCD.MaxValue), Array.Empty<object>()));
			HackingBeaconCD.Entry = ((BaseUnityPlugin)this).Config.Bind<int>("Beacons Cooldown", "Hacking Beacon Cooldown", HackingBeaconCD.DefaultValue, new ConfigDescription("Captain's Hacking Beacon Cooldown in seconds. " + HackingBeaconCD.DefaultAsString(), (AcceptableValueBase)(object)new AcceptableValueRange<int>(HackingBeaconCD.MinValue, HackingBeaconCD.MaxValue), Array.Empty<object>()));
			beaconCooldowns = new float[4] { HealingBeaconCD.Value, ShockingBeaconCD.Value, EquipmentBeaconCD.Value, HackingBeaconCD.Value };
		}

		private static void RegisterRiskOfOptions()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_00e2: 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_00f7: 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_0117: Expected O, but got Unknown
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Expected O, but got Unknown
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Expected O, but got Unknown
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Expected O, but got Unknown
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Expected O, but got Unknown
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Expected O, but got Unknown
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Expected O, but got Unknown
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Expected O, but got Unknown
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Expected O, but got Unknown
			//IL_01ff: 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_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Expected O, but got Unknown
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Expected O, but got Unknown
			if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
			{
				ModSettingsManager.SetModDescription("Adds configurable Power Tazer extra effects for Captain, and beacons restock cooldown.");
				Sprite modIcon = LoadEmbeddedSprite("ExamplePlugin.Assets.captain-extra-effects-icon-256.png");
				ModSettingsManager.SetModIcon(modIcon);
				ModSettingsManager.AddOption((BaseOption)new StepSliderOption(tazerBoostDuration.Entry, new StepSliderConfig
				{
					min = tazerBoostDuration.MinValue,
					max = tazerBoostDuration.MaxValue
				}));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(tazerEnableExtraJumps.Entry));
				ModSettingsManager.AddOption((BaseOption)new IntSliderOption(tazerExtraJumpCount.Entry, new IntSliderConfig
				{
					min = tazerExtraJumpCount.MinValue,
					max = tazerExtraJumpCount.MaxValue
				}));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(tazerEnableSpeedBoost.Entry));
				ModSettingsManager.AddOption((BaseOption)new StepSliderOption(tazerSpeedBoostPercent.Entry, new StepSliderConfig
				{
					min = tazerSpeedBoostPercent.MinValue,
					max = tazerSpeedBoostPercent.MaxValue,
					increment = 1f
				}));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(tazerEnableAgile.Entry));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(EnableBeaconCD.Entry));
				ModSettingsManager.AddOption((BaseOption)new IntSliderOption(HealingBeaconCD.Entry, new IntSliderConfig
				{
					min = HealingBeaconCD.MinValue,
					max = HealingBeaconCD.MaxValue
				}));
				ModSettingsManager.AddOption((BaseOption)new IntSliderOption(ShockingBeaconCD.Entry, new IntSliderConfig
				{
					min = ShockingBeaconCD.MinValue,
					max = ShockingBeaconCD.MaxValue
				}));
				ModSettingsManager.AddOption((BaseOption)new IntSliderOption(EquipmentBeaconCD.Entry, new IntSliderConfig
				{
					min = EquipmentBeaconCD.MinValue,
					max = EquipmentBeaconCD.MaxValue
				}));
				ModSettingsManager.AddOption((BaseOption)new IntSliderOption(HackingBeaconCD.Entry, new IntSliderConfig
				{
					min = HackingBeaconCD.MinValue,
					max = HackingBeaconCD.MaxValue
				}));
			}
		}

		private static void FireTazer_OnEnter(orig_OnEnter orig, FireTazer self)
		{
			orig.Invoke(self);
			CharacterBody val = ((self != null) ? ((EntityState)self).characterBody : null);
			if (IsCaptain(val))
			{
				CaptainTazerTracker captainTazerTracker = ((Component)val).GetComponent<CaptainTazerTracker>();
				if ((Object)(object)captainTazerTracker == (Object)null)
				{
					captainTazerTracker = ((Component)val).gameObject.AddComponent<CaptainTazerTracker>();
				}
				captainTazerTracker.Activate(Mathf.Max(0f, tazerBoostDuration.Value));
				if (tazerEnableExtraJumps.Value || tazerEnableSpeedBoost.Value)
				{
					val.AddTimedBuff(tazerBuff, Mathf.Max(0f, tazerBoostDuration.Value));
				}
			}
		}

		private static void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
		{
			CaptainTazerTracker captainTazerTracker = (Object.op_Implicit((Object)(object)self) ? ((Component)self).GetComponent<CaptainTazerTracker>() : null);
			bool flag = (Object)(object)captainTazerTracker != (Object)null && captainTazerTracker.IsBoostActive;
			int num = (tazerEnableExtraJumps.Value ? Math.Max(0, tazerExtraJumpCount.Value) : 0);
			if (flag && num > 0)
			{
				self.baseJumpCount += num;
			}
			orig.Invoke(self);
			if (flag)
			{
				if (num > 0)
				{
					self.baseJumpCount -= num;
				}
				if (tazerEnableSpeedBoost.Value)
				{
					float num2 = 1f + Mathf.Max(0f, tazerSpeedBoostPercent.Value) / 100f;
					self.moveSpeed *= num2;
					self.acceleration = ((self.baseMoveSpeed <= 0f) ? 0f : (self.moveSpeed / self.baseMoveSpeed * self.baseAcceleration));
				}
			}
		}

		private static void CharacterBody_Start(orig_Start orig, CharacterBody self)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!IsCaptain(self))
			{
				return;
			}
			SkillLocator skillLocator = self.skillLocator;
			if (!Object.op_Implicit((Object)(object)skillLocator) || (Object)(object)skillLocator.secondary == (Object)null)
			{
				return;
			}
			SkillFamily skillFamily = skillLocator.secondary.skillFamily;
			if ((Object)(object)skillFamily == (Object)null)
			{
				return;
			}
			Variant[] variants = skillFamily.variants;
			foreach (Variant val in variants)
			{
				SkillDef skillDef = val.skillDef;
				if (!((Object)(object)skillDef == (Object)null))
				{
					skillDef.cancelSprintingOnActivation = !tazerEnableAgile.Value;
				}
			}
		}

		private static bool IsCaptain(CharacterBody body)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Invalid comparison between Unknown and I4
			//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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)body == (Object)null)
			{
				return false;
			}
			if ((int)captainBodyIndex == -1)
			{
				captainBodyIndex = BodyCatalog.FindBodyIndex("CaptainBody");
			}
			return (int)captainBodyIndex != -1 && body.bodyIndex == captainBodyIndex;
		}

		private void OnRoR2SkillsCaptainSupplyDropSkillDefIsReady(orig_FixedUpdate orig, CaptainSupplyDropController self)
		{
			if (EnableBeaconCD.Value)
			{
				self.supplyDrop1Skill.maxStock = 1 + self.supplyDrop1Skill.bonusStockFromBody;
				self.supplyDrop2Skill.maxStock = 1 + self.supplyDrop2Skill.bonusStockFromBody;
				for (int i = 0; i < beaconNameTokens.Length; i++)
				{
					if (self.supplyDrop1Skill.skillNameToken == beaconNameTokens[i])
					{
						leftBeaconCooldown = beaconCooldowns[i];
					}
					if (self.supplyDrop2Skill.skillNameToken == beaconNameTokens[i])
					{
						rightBeaconCooldown = beaconCooldowns[i];
					}
				}
				if (self.supplyDrop1Skill.stock < self.supplyDrop1Skill.maxStock)
				{
					leftBeaconStopwatch += Time.fixedDeltaTime;
				}
				if (self.supplyDrop2Skill.stock < 1)
				{
					rightBeaconStopwatch += Time.fixedDeltaTime;
				}
				if (self.supplyDrop2Skill.stock > 1)
				{
					self.supplyDrop2Skill.stock = 1;
				}
				if (leftBeaconStopwatch >= leftBeaconCooldown)
				{
					leftBeaconStopwatch = 0f;
					GenericSkill supplyDrop1Skill = self.supplyDrop1Skill;
					supplyDrop1Skill.stock += 1;
				}
				if (rightBeaconStopwatch >= rightBeaconCooldown)
				{
					rightBeaconStopwatch = 0f;
					GenericSkill supplyDrop2Skill = self.supplyDrop2Skill;
					supplyDrop2Skill.stock += 1;
				}
			}
			orig.Invoke(self);
		}
	}
}