Decompiled source of SpurRework v1.1.1

SpurRework.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using ItemQualities;
using ItemQualities.Utilities.Extensions;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Items;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SpurRework")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1")]
[assembly: AssemblyProduct("SpurRework")]
[assembly: AssemblyTitle("SpurRework")]
[assembly: AssemblyVersion("1.1.1.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 SpurRework
{
	internal static class QualityCompat
	{
		[MethodImpl(MethodImplOptions.NoInlining)]
		private static ItemQualityCounts Counts(CharacterBody body)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			return InventoryExtensions.GetItemCountsEffective(body.inventory, ItemQualityGroups.JumpDamageStrike);
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		private static QualityTier HighestTier(CharacterBody body)
		{
			//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_0018: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)body.inventory))
			{
				return (QualityTier)(-1);
			}
			ItemQualityCounts val = Counts(body);
			return ((ItemQualityCounts)(ref val)).HighestQuality;
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		public static int AirUses(CharacterBody body)
		{
			//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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected I4, but got Unknown
			QualityTier val = HighestTier(body);
			return (int)val switch
			{
				0 => SpurReworkPlugin.UncommonAirUses.Value, 
				1 => SpurReworkPlugin.RareAirUses.Value, 
				2 => SpurReworkPlugin.EpicAirUses.Value, 
				3 => SpurReworkPlugin.LegendaryAirUses.Value, 
				_ => 0, 
			};
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		public static bool HasQualitySpur(CharacterBody body)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			return (int)HighestTier(body) != -1;
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		public static void ApplyChargeCost(CharacterBody body, int chargeBefore)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if (SpurReworkPlugin.OverrideRareChargeCost.Value && chargeBefore >= 25 && (int)HighestTier(body) == 1)
			{
				int num = Math.Max(0, chargeBefore - SpurReworkPlugin.RareChargeCost.Value);
				body.SetBuffCount(Buffs.JumpDamageStrikeCharge.buffIndex, num);
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		public static float ChargePerBlastHit(CharacterBody body)
		{
			//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_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected I4, but got Unknown
			QualityTier val = HighestTier(body);
			return (int)val switch
			{
				0 => SpurReworkPlugin.UncommonChargePerHit.Value, 
				1 => SpurReworkPlugin.RareChargePerHit.Value, 
				2 => SpurReworkPlugin.EpicChargePerHit.Value, 
				3 => SpurReworkPlugin.LegendaryChargePerHit.Value, 
				_ => 0f, 
			};
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		public static float ChargePerKill(CharacterBody body)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected I4, but got Unknown
			if (!Object.op_Implicit((Object)(object)body.inventory))
			{
				return 0f;
			}
			ItemQualityCounts val = Counts(body);
			float num = SpurReworkPlugin.UncommonChargePerKillPerStack.Value * (float)val.UncommonCount + SpurReworkPlugin.RareChargePerKillPerStack.Value * (float)val.RareCount + SpurReworkPlugin.EpicChargePerKillPerStack.Value * (float)val.EpicCount + SpurReworkPlugin.LegendaryChargePerKillPerStack.Value * (float)val.LegendaryCount;
			QualityTier highestQuality = ((ItemQualityCounts)(ref val)).HighestQuality;
			return (int)highestQuality switch
			{
				0 => num + SpurReworkPlugin.UncommonChargePerKill.Value - SpurReworkPlugin.UncommonChargePerKillPerStack.Value, 
				1 => num + SpurReworkPlugin.RareChargePerKill.Value - SpurReworkPlugin.RareChargePerKillPerStack.Value, 
				2 => num + SpurReworkPlugin.EpicChargePerKill.Value - SpurReworkPlugin.EpicChargePerKillPerStack.Value, 
				3 => num + SpurReworkPlugin.LegendaryChargePerKill.Value - SpurReworkPlugin.LegendaryChargePerKillPerStack.Value, 
				_ => 0f, 
			};
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		public static void AddItemText(Dictionary<string, string> tokens)
		{
			AddTier(tokens, "UNCOMMON", 75, 150, SpurReworkPlugin.UncommonAirUses.Value, SpurReworkPlugin.UncommonChargePerHit, SpurReworkPlugin.UncommonChargePerKill, SpurReworkPlugin.UncommonChargePerKillPerStack);
			int chargeCost = (SpurReworkPlugin.OverrideRareChargeCost.Value ? SpurReworkPlugin.RareChargeCost.Value : 50);
			AddTier(tokens, "RARE", chargeCost, 250, SpurReworkPlugin.RareAirUses.Value, SpurReworkPlugin.RareChargePerHit, SpurReworkPlugin.RareChargePerKill, SpurReworkPlugin.RareChargePerKillPerStack);
			AddTier(tokens, "EPIC", 25, 350, SpurReworkPlugin.EpicAirUses.Value, SpurReworkPlugin.EpicChargePerHit, SpurReworkPlugin.EpicChargePerKill, SpurReworkPlugin.EpicChargePerKillPerStack);
			AddTier(tokens, "LEGENDARY", 10, 500, SpurReworkPlugin.LegendaryAirUses.Value, SpurReworkPlugin.LegendaryChargePerHit, SpurReworkPlugin.LegendaryChargePerKill, SpurReworkPlugin.LegendaryChargePerKillPerStack);
		}

		private static void AddTier(Dictionary<string, string> tokens, string tier, int chargeCost, int damagePerSpeed, int airUses, ConfigEntry<float> perHit, ConfigEntry<float> perKill, ConfigEntry<float> perKillPerStack)
		{
			bool flag = !SpurReworkPlugin.UsableInAir.Value;
			bool value = SpurReworkPlugin.EnableQualityRework.Value;
			bool flag2 = value && perHit.Value > 0f;
			bool flag3 = value && SpurReworkPlugin.ChargedActive && (perKill.Value > 0f || perKillPerStack.Value > 0f);
			string text = (value ? ("Reduce charge used per blast" + ((flag2 || flag3) ? ", and regain charge from blast hits and kills." : ".")) : "Increase damage based on movement speed and reduce charge used per blast.");
			tokens["ITEM_JUMPDAMAGESTRIKE_" + tier + "_PICKUP"] = "Moving around builds up movement speed and jump height. At 25% charge or higher, press Interact while holding Jump to discharge into an electric blast that launches you upward.\n<sprite name=\"Quality\"> " + text + (flag ? $" Use it {airUses} times in the air." : "");
			string text2 = SpurReworkPlugin.BonusesText + "At 25% charge or higher, pressing <style=cIsUtility>Interact</style> while holding <style=cIsUtility>Jump</style> launches you upward, " + string.Format("consumes {0} <style=cIsUtility>{1}%</style> charge and triggers an <style=cIsDamage>explosive discharge</style> for ", "<sprite name=\"Quality\">", chargeCost) + "<style=cIsDamage>400% <style=cStack>(+280% per stack)</style> damage</style>, " + (value ? "" : string.Format("plus an additional {0} <style=cIsDamage>{1}% <style=cStack>(+{2}% per stack)</style> damage</style> for every <style=cIsUtility>100% movement speed</style>, ", "<sprite name=\"Quality\">", damagePerSpeed, damagePerSpeed)) + "in a 17m-32m <style=cStack>(+7.5m per stack)</style> area.";
			if (flag2)
			{
				text2 += string.Format(" Gain {0} <style=cIsUtility>{1:0.##}% charge</style> for every enemy hit by the blast.", "<sprite name=\"Quality\">", perHit.Value);
			}
			if (flag3)
			{
				text2 += string.Format(" While you have <style=cIsUtility>Static Charge</style>, gain {0} <style=cIsUtility>{1:0.##}% <style=cStack>(+{2:0.##}% per stack)</style> charge</style> for every enemy killed, including kills by the blast.", "<sprite name=\"Quality\">", perKill.Value, perKillPerStack.Value);
			}
			tokens["ITEM_JUMPDAMAGESTRIKE_" + tier + "_DESC"] = text2 + SpurReworkPlugin.ExtraEffectsText + (flag ? string.Format(" Usable on the ground, or {0} <style=cIsUtility>{1} times</style> before landing.", "<sprite name=\"Quality\">", airUses) : "");
		}
	}
	internal static class RiskOfOptionsCompat
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static IsDisabledDelegate <>9__0_3;

			public static Func<bool> <>9__0_0;

			public static Func<bool> <>9__0_1;

			public static Func<bool> <>9__0_2;

			public static Func<bool> <>9__1_0;

			public static Func<bool> <>9__1_1;

			public static IsDisabledDelegate <>9__4_0;

			internal bool <Register>b__0_3()
			{
				return !SpurReworkPlugin.OverrideRareChargeCost.Value;
			}

			internal bool <Register>b__0_0()
			{
				return !SpurReworkPlugin.EnableCharged.Value;
			}

			internal bool <Register>b__0_1()
			{
				return !SpurReworkPlugin.EnableChargeBlock.Value;
			}

			internal bool <Register>b__0_2()
			{
				return !SpurReworkPlugin.EnableChargeDrain.Value;
			}

			internal bool <AddChargeSliders>b__1_0()
			{
				return !SpurReworkPlugin.EnableQualityRework.Value;
			}

			internal bool <AddChargeSliders>b__1_1()
			{
				if (SpurReworkPlugin.EnableQualityRework.Value)
				{
					return !SpurReworkPlugin.EnableCharged.Value;
				}
				return true;
			}

			internal bool <AddKeyBind>b__4_0()
			{
				return !SpurReworkPlugin.UseCustomKeys.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		public static void Register(string pluginLocation)
		{
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Expected O, but got Unknown
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Expected O, but got Unknown
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Expected O, but got Unknown
			//IL_01e8: Expected O, but got Unknown
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Expected O, but got Unknown
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Expected O, but got Unknown
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Expected O, but got Unknown
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Expected O, but got Unknown
			ModSettingsManager.SetModDescription("Reworks Faraday Spur: lower speed and jump bonuses that stack, and the blast fires from pressing Interact while holding Jump.");
			Sprite val = LoadIcon(pluginLocation);
			if (Object.op_Implicit((Object)(object)val))
			{
				ModSettingsManager.SetModIcon(val);
			}
			AddSlider(SpurReworkPlugin.MoveSpeedBase, 0f, 200f, 5f, "{0:0}%");
			AddSlider(SpurReworkPlugin.MoveSpeedPerStack, 0f, 100f, 5f, "{0:0}%");
			AddSlider(SpurReworkPlugin.JumpBase, 0f, 200f, 5f, "{0:0}%");
			AddSlider(SpurReworkPlugin.JumpPerStack, 0f, 100f, 5f, "{0:0}%");
			AddSlider(SpurReworkPlugin.ChargeSpeed, 0.25f, 3f, 0.05f, "{0:0.00}x");
			AddSlider(SpurReworkPlugin.LaunchMultiplier, 0f, 3f, 0.05f, "{0:0.00}x");
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SpurReworkPlugin.UsableInAir));
			AddSlider(SpurReworkPlugin.GroundBuffer, 0f, 1f, 0.05f, "{0:0.00}s");
			AddSlider(SpurReworkPlugin.FallDamageReduction, 0f, 100f, 5f, "{0:0}%");
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SpurReworkPlugin.BlockWhenInteractableInView));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SpurReworkPlugin.UseCustomKeys));
			AddKeyBind(SpurReworkPlugin.BlastKey);
			AddKeyBind(SpurReworkPlugin.JumpKey);
			if (SpurReworkPlugin.QualityLoaded)
			{
				AddIntSlider(SpurReworkPlugin.UncommonAirUses, 1, 10);
				AddIntSlider(SpurReworkPlugin.RareAirUses, 1, 10);
				AddIntSlider(SpurReworkPlugin.EpicAirUses, 1, 10);
				AddIntSlider(SpurReworkPlugin.LegendaryAirUses, 1, 10);
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SpurReworkPlugin.OverrideRareChargeCost));
				ConfigEntry<int> rareChargeCost = SpurReworkPlugin.RareChargeCost;
				IntSliderConfig val2 = new IntSliderConfig
				{
					min = 5,
					max = 75
				};
				object obj = <>c.<>9__0_3;
				if (obj == null)
				{
					IsDisabledDelegate val3 = () => !SpurReworkPlugin.OverrideRareChargeCost.Value;
					<>c.<>9__0_3 = val3;
					obj = (object)val3;
				}
				((BaseOptionConfig)val2).checkIfDisabled = (IsDisabledDelegate)obj;
				ModSettingsManager.AddOption((BaseOption)new IntSliderOption(rareChargeCost, val2));
			}
			Func<bool> disabled = () => !SpurReworkPlugin.EnableCharged.Value;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SpurReworkPlugin.EnableCharged));
			AddSlider(SpurReworkPlugin.ChargedDuration, 0f, 15f, 0.5f, "{0:0.0}s", disabled);
			AddSlider(SpurReworkPlugin.ChargedDurationPerStack, 0f, 5f, 0.25f, "{0:0.00}s", disabled);
			AddSlider(SpurReworkPlugin.ChargedAttackSpeed, 0f, 200f, 5f, "{0:0}%", disabled);
			AddSlider(SpurReworkPlugin.ChargedChargeSpeed, 0f, 200f, 5f, "{0:0}%", disabled);
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SpurReworkPlugin.EnableChargeBlock));
			AddSlider(SpurReworkPlugin.CombatDuration, 0f, 20f, 0.5f, "{0:0.0}s", () => !SpurReworkPlugin.EnableChargeBlock.Value);
			Func<bool> disabled2 = () => !SpurReworkPlugin.EnableChargeDrain.Value;
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SpurReworkPlugin.EnableChargeDrain));
			AddSlider(SpurReworkPlugin.DangerDrainPerSecond, 0f, 10f, 0.5f, "{0:0.0}%/s", disabled2);
			AddSlider(SpurReworkPlugin.DangerDuration, 0f, 20f, 0.5f, "{0:0.0}s", disabled2);
			if (SpurReworkPlugin.QualityLoaded)
			{
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SpurReworkPlugin.EnableQualityRework));
				AddChargeSliders(SpurReworkPlugin.UncommonChargePerHit, SpurReworkPlugin.UncommonChargePerKill, SpurReworkPlugin.UncommonChargePerKillPerStack);
				AddChargeSliders(SpurReworkPlugin.RareChargePerHit, SpurReworkPlugin.RareChargePerKill, SpurReworkPlugin.RareChargePerKillPerStack);
				AddChargeSliders(SpurReworkPlugin.EpicChargePerHit, SpurReworkPlugin.EpicChargePerKill, SpurReworkPlugin.EpicChargePerKillPerStack);
				AddChargeSliders(SpurReworkPlugin.LegendaryChargePerHit, SpurReworkPlugin.LegendaryChargePerKill, SpurReworkPlugin.LegendaryChargePerKillPerStack);
			}
		}

		private static void AddChargeSliders(ConfigEntry<float> perHit, ConfigEntry<float> perKill, ConfigEntry<float> perKillPerStack)
		{
			Func<bool> disabled = () => !SpurReworkPlugin.EnableQualityRework.Value;
			Func<bool> disabled2 = () => !SpurReworkPlugin.EnableQualityRework.Value || !SpurReworkPlugin.EnableCharged.Value;
			AddSlider(perHit, 0f, 10f, 0.5f, "{0:0.0}%", disabled);
			AddSlider(perKill, 0f, 20f, 0.5f, "{0:0.0}%", disabled2);
			AddSlider(perKillPerStack, 0f, 20f, 0.5f, "{0:0.0}%", disabled2);
		}

		private static void AddSlider(ConfigEntry<float> entry, float min, float max, float increment, string format, Func<bool> disabled = null)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_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)
			//IL_0031: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			StepSliderConfig val = new StepSliderConfig
			{
				min = min,
				max = max,
				increment = increment,
				FormatString = format
			};
			if (disabled != null)
			{
				((BaseOptionConfig)val).checkIfDisabled = (IsDisabledDelegate)(() => disabled());
			}
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(entry, val));
		}

		private static void AddIntSlider(ConfigEntry<int> entry, int min, int max)
		{
			//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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry, new IntSliderConfig
			{
				min = min,
				max = max
			}));
		}

		private static void AddKeyBind(ConfigEntry<KeyboardShortcut> entry)
		{
			//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_0030: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			KeyBindConfig val = new KeyBindConfig();
			object obj = <>c.<>9__4_0;
			if (obj == null)
			{
				IsDisabledDelegate val2 = () => !SpurReworkPlugin.UseCustomKeys.Value;
				<>c.<>9__4_0 = val2;
				obj = (object)val2;
			}
			((BaseOptionConfig)val).checkIfDisabled = (IsDisabledDelegate)obj;
			ModSettingsManager.AddOption((BaseOption)new KeyBindOption(entry, val));
		}

		private static Sprite LoadIcon(string pluginLocation)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_004c: 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)
			string path = Path.Combine(Path.GetDirectoryName(pluginLocation), "icon.png");
			if (!File.Exists(path))
			{
				return null;
			}
			Texture2D val = new Texture2D(2, 2);
			if (!ImageConversion.LoadImage(val, File.ReadAllBytes(path)))
			{
				return null;
			}
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		}
	}
	internal static class SpurBuffs
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static StatHookEventHandler <>9__4_0;

			public static Action <>9__4_1;

			internal void <Register>b__4_0(CharacterBody body, StatHookEventArgs args)
			{
				if (body.HasBuff(Charged))
				{
					args.attackSpeedMultAdd += SpurReworkPlugin.ChargedAttackSpeed.Value / 100f;
				}
			}

			internal void <Register>b__4_1()
			{
				Charged.iconSprite = Buffs.AttackSpeedOnCrit.iconSprite;
				InCombat.iconSprite = Buffs.JumpDamageStrikeCharge.iconSprite;
				if (!Object.op_Implicit((Object)(object)ChargeDrain.iconSprite))
				{
					ChargeDrain.iconSprite = Buffs.JumpDamageStrikeCharge.iconSprite;
				}
			}
		}

		public static BuffDef Charged;

		public static BuffDef InCombat;

		public static BuffDef ChargeDrain;

		private const string ChargeDrainIconResource = "SpurRework.ChargeDrain.png";

		public static void Register()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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)
			//IL_007f: 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_00bd: 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_012c: Expected O, but got Unknown
			Charged = ScriptableObject.CreateInstance<BuffDef>();
			((Object)Charged).name = "bdSpurReworkStaticCharge";
			Charged.buffColor = new Color(0.25f, 0.8f, 1f);
			Charged.canStack = false;
			Charged.isDebuff = false;
			InCombat = ScriptableObject.CreateInstance<BuffDef>();
			((Object)InCombat).name = "bdSpurReworkInCombat";
			InCombat.buffColor = new Color(0.95f, 0.25f, 0.25f);
			InCombat.canStack = false;
			InCombat.isDebuff = false;
			ChargeDrain = ScriptableObject.CreateInstance<BuffDef>();
			((Object)ChargeDrain).name = "bdSpurReworkChargeDrain";
			ChargeDrain.buffColor = Color.white;
			ChargeDrain.canStack = false;
			ChargeDrain.isDebuff = false;
			ChargeDrain.iconSprite = LoadEmbeddedSprite("SpurRework.ChargeDrain.png");
			ContentAddition.AddBuffDef(Charged);
			ContentAddition.AddBuffDef(InCombat);
			ContentAddition.AddBuffDef(ChargeDrain);
			object obj = <>c.<>9__4_0;
			if (obj == null)
			{
				StatHookEventHandler val = delegate(CharacterBody body, StatHookEventArgs args)
				{
					if (body.HasBuff(Charged))
					{
						args.attackSpeedMultAdd += SpurReworkPlugin.ChargedAttackSpeed.Value / 100f;
					}
				};
				<>c.<>9__4_0 = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
			{
				Charged.iconSprite = Buffs.AttackSpeedOnCrit.iconSprite;
				InCombat.iconSprite = Buffs.JumpDamageStrikeCharge.iconSprite;
				if (!Object.op_Implicit((Object)(object)ChargeDrain.iconSprite))
				{
					ChargeDrain.iconSprite = Buffs.JumpDamageStrikeCharge.iconSprite;
				}
			});
		}

		private static Sprite LoadEmbeddedSprite(string resourceName)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_00bd: 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)
			using Stream stream = typeof(SpurBuffs).Assembly.GetManifestResourceStream(resourceName);
			if (stream == null)
			{
				SpurReworkPlugin.Log.LogError((object)("Icon resource " + resourceName + " is missing from the DLL."));
				return null;
			}
			byte[] array = new byte[stream.Length];
			int num;
			for (int i = 0; i < array.Length; i += num)
			{
				num = stream.Read(array, i, array.Length - i);
				if (num <= 0)
				{
					break;
				}
			}
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			if (!ImageConversion.LoadImage(val, array))
			{
				SpurReworkPlugin.Log.LogError((object)("Icon resource " + resourceName + " could not be read as an image."));
				return null;
			}
			((Texture)val).wrapMode = (TextureWrapMode)1;
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		}
	}
	public static class SpurPatches
	{
		private class InputState
		{
			public float drainTimer;

			public float lastHurtTime = float.NegativeInfinity;

			public float lastCombatTime = float.NegativeInfinity;

			public float chargeRemainder;

			public bool fallProtected;

			public bool blastKeyWasDown;

			public InteractionDriver interactionDriver;

			public float airTime;

			public int usesSinceGrounded;

			public float lastUseTime = float.NegativeInfinity;
		}

		private const float LandingGraceTime = 0.1f;

		private static readonly ConditionalWeakTable<JumpDamageStrikeBodyBehavior, InputState> inputStates = new ConditionalWeakTable<JumpDamageStrikeBodyBehavior, InputState>();

		private static bool dischargeAllowed;

		private static JumpDamageStrikeBodyBehavior firingBehavior;

		private static int lastBlastHits;

		private static int blastKills;

		private static CharacterBody fallReductionTarget;

		private static float FullChargeBonus(CharacterBody body, float baseValue, float perStack)
		{
			int num = (Object.op_Implicit((Object)(object)body.inventory) ? body.inventory.GetItemCountEffective(Items.JumpDamageStrike) : 0);
			if (num <= 0)
			{
				return 0f;
			}
			return (baseValue + perStack * (float)(num - 1)) / 100f;
		}

		public static float MoveSpeedPerCharge(CharacterBody body)
		{
			return FullChargeBonus(body, SpurReworkPlugin.MoveSpeedBase.Value, SpurReworkPlugin.MoveSpeedPerStack.Value) / 100f;
		}

		public static float JumpPowerPerCharge(CharacterBody body)
		{
			return FullChargeBonus(body, SpurReworkPlugin.JumpBase.Value, SpurReworkPlugin.JumpPerStack.Value) / 100f;
		}

		[HarmonyPatch(typeof(CharacterBody), "RecalculateStats")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> RecalculateStatsTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			FieldInfo moveField = AccessTools.Field(typeof(JumpDamageStrikeBodyBehavior), "MoveSpeedVelocityPerCharge");
			FieldInfo jumpField = AccessTools.Field(typeof(JumpDamageStrikeBodyBehavior), "JumpVelocityPerCharge");
			MethodInfo moveMethod = AccessTools.Method(typeof(SpurPatches), "MoveSpeedPerCharge", (Type[])null, (Type[])null);
			MethodInfo jumpMethod = AccessTools.Method(typeof(SpurPatches), "JumpPowerPerCharge", (Type[])null, (Type[])null);
			bool movePatched = false;
			bool jumpPatched = false;
			foreach (CodeInstruction instruction in instructions)
			{
				MethodInfo replacement = null;
				if (CodeInstructionExtensions.LoadsField(instruction, moveField, false))
				{
					replacement = moveMethod;
					movePatched = true;
				}
				else if (CodeInstructionExtensions.LoadsField(instruction, jumpField, false))
				{
					replacement = jumpMethod;
					jumpPatched = true;
				}
				if (replacement == null)
				{
					yield return instruction;
					continue;
				}
				yield return CodeInstructionExtensions.MoveBlocksFrom(CodeInstructionExtensions.MoveLabelsFrom(new CodeInstruction(OpCodes.Ldarg_0, (object)null), instruction), instruction);
				yield return new CodeInstruction(OpCodes.Call, (object)replacement);
			}
			if (!movePatched || !jumpPatched)
			{
				SpurReworkPlugin.Log.LogError((object)$"RecalculateStats patch incomplete (move speed: {movePatched}, jump: {jumpPatched}). A game update probably changed the Spur code.");
			}
		}

		[HarmonyPatch(typeof(JumpDamageStrikeBodyBehavior), "FixedUpdate")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> FixedUpdateTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			MethodInfo positionGetter = AccessTools.PropertyGetter(typeof(Transform), "position");
			MethodInfo replacement = AccessTools.Method(typeof(SpurPatches), "SimulatedPosition", (Type[])null, (Type[])null);
			FieldInfo isChargingField = AccessTools.Field(typeof(JumpDamageStrikeBodyBehavior), "isCharging");
			MethodInfo chargingFilter = AccessTools.Method(typeof(SpurPatches), "FilterCharging", (Type[])null, (Type[])null);
			bool patched = false;
			bool filterPatched = false;
			foreach (CodeInstruction instruction in instructions)
			{
				if (!patched && CodeInstructionExtensions.Calls(instruction, positionGetter))
				{
					instruction.opcode = OpCodes.Call;
					instruction.operand = replacement;
					patched = true;
				}
				else if (!filterPatched && CodeInstructionExtensions.StoresField(instruction, isChargingField))
				{
					yield return CodeInstructionExtensions.MoveLabelsFrom(new CodeInstruction(OpCodes.Ldarg_0, (object)null), instruction);
					yield return new CodeInstruction(OpCodes.Call, (object)chargingFilter);
					filterPatched = true;
				}
				yield return instruction;
			}
			if (!patched)
			{
				SpurReworkPlugin.Log.LogError((object)"Charge rate fix not applied. A game update probably changed the Spur code.");
			}
			if (!filterPatched)
			{
				SpurReworkPlugin.Log.LogError((object)"Sprint-only charging in combat not applied. A game update probably changed the Spur code.");
			}
		}

		public static bool FilterCharging(bool charging, JumpDamageStrikeBodyBehavior behavior)
		{
			if (!charging)
			{
				return false;
			}
			CharacterBody body = ((BaseItemBodyBehavior)behavior).body;
			if (body.HasBuff(SpurBuffs.InCombat))
			{
				return body.isSprinting;
			}
			return true;
		}

		public static Vector3 SimulatedPosition(Transform transform)
		{
			//IL_0017: 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)
			KinematicCharacterMotor component = ((Component)transform).GetComponent<KinematicCharacterMotor>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return transform.position;
			}
			return component.TransientPosition;
		}

		[HarmonyPatch(typeof(JumpDamageStrikeBodyBehavior), "UpdateCharge")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> UpdateChargeTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			MethodInfo moveSpeedGetter = AccessTools.PropertyGetter(typeof(CharacterBody), "moveSpeed");
			MethodInfo scale = AccessTools.Method(typeof(SpurPatches), "ScaleChargeGain", (Type[])null, (Type[])null);
			bool patched = false;
			foreach (CodeInstruction instruction in instructions)
			{
				yield return instruction;
				if (!patched && CodeInstructionExtensions.Calls(instruction, moveSpeedGetter))
				{
					yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
					yield return new CodeInstruction(OpCodes.Call, (object)scale);
					patched = true;
				}
			}
			if (!patched)
			{
				SpurReworkPlugin.Log.LogError((object)"Charge speed patch not applied. A game update probably changed the Spur code.");
			}
		}

		public static float ScaleChargeGain(float moveSpeed, JumpDamageStrikeBodyBehavior behavior)
		{
			float num = SpurReworkPlugin.ChargeSpeed.Value;
			CharacterBody body = ((BaseItemBodyBehavior)behavior).body;
			if (Object.op_Implicit((Object)(object)body) && body.HasBuff(SpurBuffs.Charged))
			{
				num *= 1f + SpurReworkPlugin.ChargedChargeSpeed.Value / 100f;
			}
			return moveSpeed * num;
		}

		private static void AddCharge(JumpDamageStrikeBodyBehavior behavior, float amount)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody body = ((BaseItemBodyBehavior)behavior).body;
			if (!Object.op_Implicit((Object)(object)body) || amount <= 0f)
			{
				return;
			}
			InputState orCreateValue = inputStates.GetOrCreateValue(behavior);
			int buffCount = body.GetBuffCount(Buffs.JumpDamageStrikeCharge);
			if (buffCount >= 100)
			{
				orCreateValue.chargeRemainder = 0f;
				return;
			}
			orCreateValue.chargeRemainder += amount;
			int num = Mathf.FloorToInt(orCreateValue.chargeRemainder);
			if (num > 0)
			{
				orCreateValue.chargeRemainder -= num;
				body.SetBuffCount(Buffs.JumpDamageStrikeCharge.buffIndex, Mathf.Min(100, buffCount + num));
			}
		}

		public static void Init()
		{
			GlobalEventManager.onServerDamageDealt += OnServerDamageDealt;
			GlobalEventManager.onCharacterDeathServer += OnCharacterDeath;
		}

		[HarmonyPatch(typeof(CharacterBody), "OnSkillActivated")]
		[HarmonyPostfix]
		private static void OnSkillActivatedPostfix(CharacterBody __instance, GenericSkill skill)
		{
			if (NetworkServer.active && Object.op_Implicit((Object)(object)skill) && skill.isCombatSkill && !__instance.HasBuff(SpurBuffs.Charged))
			{
				JumpDamageStrikeBodyBehavior component = ((Component)__instance).GetComponent<JumpDamageStrikeBodyBehavior>();
				if (Object.op_Implicit((Object)(object)component) && ((Behaviour)component).enabled)
				{
					inputStates.GetOrCreateValue(component).lastCombatTime = Time.fixedTime;
				}
			}
		}

		private static void OnCharacterDeath(DamageReport report)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody attackerBody = report.attackerBody;
			if (!SpurReworkPlugin.QualityReworkActive || !Object.op_Implicit((Object)(object)attackerBody) || report.victimTeamIndex == report.attackerTeamIndex)
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)firingBehavior) && (Object)(object)attackerBody == (Object)(object)((BaseItemBodyBehavior)firingBehavior).body)
			{
				blastKills++;
			}
			else if (attackerBody.HasBuff(SpurBuffs.Charged))
			{
				JumpDamageStrikeBodyBehavior component = ((Component)attackerBody).GetComponent<JumpDamageStrikeBodyBehavior>();
				if (Object.op_Implicit((Object)(object)component) && ((Behaviour)component).enabled && QualityCompat.HasQualitySpur(attackerBody))
				{
					AddCharge(component, QualityCompat.ChargePerKill(attackerBody));
				}
			}
		}

		private static void OnServerDamageDealt(DamageReport report)
		{
			//IL_005d: 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)
			CharacterBody victimBody = report.victimBody;
			DamageInfo damageInfo = report.damageInfo;
			if (Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.inventory) && victimBody.inventory.GetItemCountEffective(Items.JumpDamageStrike) > 0 && ((report.damageDealt > 0f && !damageInfo.delayedDamageSecondHalf) || damageInfo.firstHitOfDelayedDamageSecondHalf) && (damageInfo.damageType.damageType & 0x200000) == 0 && !victimBody.HasBuff(SpurBuffs.Charged))
			{
				JumpDamageStrikeBodyBehavior component = ((Component)victimBody).GetComponent<JumpDamageStrikeBodyBehavior>();
				if (Object.op_Implicit((Object)(object)component))
				{
					inputStates.GetOrCreateValue(component).lastHurtTime = Time.fixedTime;
				}
			}
		}

		private static void SetMarker(CharacterBody body, BuffDef buff, bool active)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if (body.HasBuff(buff) != active)
			{
				body.SetBuffCount(buff.buffIndex, active ? 1 : 0);
			}
		}

		private static void UpdateCombatServer(CharacterBody body, InputState state)
		{
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			if (body.HasBuff(SpurBuffs.Charged))
			{
				SetMarker(body, SpurBuffs.InCombat, active: false);
				SetMarker(body, SpurBuffs.ChargeDrain, active: false);
				state.drainTimer = 0f;
				return;
			}
			bool active = SpurReworkPlugin.EnableChargeBlock.Value && Time.fixedTime - state.lastCombatTime < SpurReworkPlugin.CombatDuration.Value;
			SetMarker(body, SpurBuffs.InCombat, active);
			float value = SpurReworkPlugin.DangerDrainPerSecond.Value;
			bool flag = SpurReworkPlugin.ChargeDrainActive && Time.fixedTime - state.lastHurtTime < SpurReworkPlugin.DangerDuration.Value;
			SetMarker(body, SpurBuffs.ChargeDrain, flag);
			if (!flag)
			{
				state.drainTimer = 0f;
				return;
			}
			state.drainTimer += Time.fixedDeltaTime * value;
			if (!(state.drainTimer < 1f))
			{
				int num = (int)state.drainTimer;
				state.drainTimer -= num;
				int buffCount = body.GetBuffCount(Buffs.JumpDamageStrikeCharge);
				if (buffCount > 0)
				{
					body.SetBuffCount(Buffs.JumpDamageStrikeCharge.buffIndex, Mathf.Max(0, buffCount - num));
				}
			}
		}

		[HarmonyPatch(typeof(JumpDamageStrikeBodyBehavior), "OnDisable")]
		[HarmonyPostfix]
		private static void OnDisablePostfix(JumpDamageStrikeBodyBehavior __instance)
		{
			//IL_001c: 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)
			CharacterBody body = ((BaseItemBodyBehavior)__instance).body;
			if (NetworkServer.active && Object.op_Implicit((Object)(object)body))
			{
				body.SetBuffCount(SpurBuffs.InCombat.buffIndex, 0);
				body.SetBuffCount(SpurBuffs.ChargeDrain.buffIndex, 0);
			}
			if (inputStates.TryGetValue(__instance, out var value))
			{
				value.fallProtected = false;
			}
		}

		[HarmonyPatch(typeof(BlastAttack), "Fire")]
		[HarmonyPrefix]
		private static void BlastFirePrefix(BlastAttack __instance)
		{
			if (Object.op_Implicit((Object)(object)firingBehavior) && SpurReworkPlugin.QualityReworkActive && !((Object)(object)__instance.attacker != (Object)(object)((Component)firingBehavior).gameObject))
			{
				CharacterBody body = ((BaseItemBodyBehavior)firingBehavior).body;
				int stack = ((BaseItemBodyBehavior)firingBehavior).stack;
				__instance.baseDamage = body.damage * (4f + 2.8f * (float)(stack - 1));
			}
		}

		[HarmonyPatch(typeof(BlastAttack), "Fire")]
		[HarmonyPostfix]
		private static void BlastFirePostfix(BlastAttack __instance, Result __result)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)firingBehavior) && (Object)(object)__instance.attacker == (Object)(object)((Component)firingBehavior).gameObject)
			{
				lastBlastHits = __result.hitCount;
			}
		}

		[HarmonyPatch(typeof(GlobalEventManager), "OnCharacterHitGroundServer")]
		[HarmonyPrefix]
		private static void HitGroundPrefix(CharacterBody characterBody, out InputState __state)
		{
			__state = null;
			JumpDamageStrikeBodyBehavior val = (Object.op_Implicit((Object)(object)characterBody) ? ((Component)characterBody).GetComponent<JumpDamageStrikeBodyBehavior>() : null);
			if (Object.op_Implicit((Object)(object)val) && inputStates.TryGetValue(val, out var value) && value.fallProtected)
			{
				__state = value;
				fallReductionTarget = characterBody;
			}
		}

		[HarmonyPatch(typeof(GlobalEventManager), "OnCharacterHitGroundServer")]
		[HarmonyFinalizer]
		private static void HitGroundFinalizer(InputState __state)
		{
			if (__state != null)
			{
				__state.fallProtected = false;
			}
			fallReductionTarget = null;
		}

		[HarmonyPatch(typeof(HealthComponent), "TakeDamage")]
		[HarmonyPrefix]
		private static void TakeDamagePrefix(HealthComponent __instance, DamageInfo damageInfo)
		{
			//IL_0027: 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)
			if (Object.op_Implicit((Object)(object)fallReductionTarget) && (Object)(object)__instance.body == (Object)(object)fallReductionTarget && damageInfo != null && (damageInfo.damageType.damageType & 0x200000) != 0)
			{
				damageInfo.damage *= 1f - Mathf.Clamp01(SpurReworkPlugin.FallDamageReduction.Value / 100f);
			}
		}

		[HarmonyPatch(typeof(JumpDamageStrikeBodyBehavior), "DischargeEffects")]
		[HarmonyPrefix]
		private static bool DischargeEffectsPrefix()
		{
			return dischargeAllowed;
		}

		[HarmonyPatch(typeof(JumpDamageStrikeBodyBehavior), "FixedUpdate")]
		[HarmonyPostfix]
		private static void FixedUpdatePostfix(JumpDamageStrikeBodyBehavior __instance)
		{
			//IL_0074: 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_007d: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody component = ((Component)__instance).GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			InputState orCreateValue = inputStates.GetOrCreateValue(__instance);
			if (NetworkServer.active)
			{
				UpdateCombatServer(component, orCreateValue);
			}
			if (!component.hasEffectiveAuthority || !Object.op_Implicit((Object)(object)component.inputBank))
			{
				return;
			}
			bool value = SpurReworkPlugin.UseCustomKeys.Value;
			int num;
			int num2;
			if (value)
			{
				num = (LocalPlayerHasControl(component) ? 1 : 0);
				if (num == 0)
				{
					num2 = 0;
					goto IL_008a;
				}
			}
			else
			{
				num = 1;
			}
			KeyboardShortcut value2;
			if (!value)
			{
				num2 = (component.inputBank.interact.down ? 1 : 0);
			}
			else
			{
				value2 = SpurReworkPlugin.BlastKey.Value;
				num2 = (Input.GetKey(((KeyboardShortcut)(ref value2)).MainKey) ? 1 : 0);
			}
			goto IL_008a;
			IL_008a:
			bool flag = (byte)num2 != 0;
			int num3;
			if (num != 0)
			{
				if (!value)
				{
					num3 = (component.inputBank.jump.down ? 1 : 0);
				}
				else
				{
					value2 = SpurReworkPlugin.JumpKey.Value;
					num3 = (Input.GetKey(((KeyboardShortcut)(ref value2)).MainKey) ? 1 : 0);
				}
			}
			else
			{
				num3 = 0;
			}
			bool flag2 = (byte)num3 != 0;
			bool flag3 = !Object.op_Implicit((Object)(object)component.characterMotor) || component.characterMotor.isGrounded;
			if (flag3)
			{
				orCreateValue.airTime = 0f;
				if (Time.fixedTime - orCreateValue.lastUseTime > 0.1f)
				{
					orCreateValue.usesSinceGrounded = 0;
				}
			}
			else
			{
				orCreateValue.airTime += Time.fixedDeltaTime;
			}
			bool num4 = flag && !orCreateValue.blastKeyWasDown;
			orCreateValue.blastKeyWasDown = flag;
			if (!num4 || !flag2 || component.GetBuffCount(Buffs.JumpDamageStrikeCharge) < 25 || (!flag3 && !CanUseInAir(component, orCreateValue)))
			{
				return;
			}
			if (!value && SpurReworkPlugin.BlockWhenInteractableInView.Value)
			{
				if (!Object.op_Implicit((Object)(object)orCreateValue.interactionDriver))
				{
					orCreateValue.interactionDriver = ((Component)component).GetComponent<InteractionDriver>();
				}
				if (Object.op_Implicit((Object)(object)orCreateValue.interactionDriver) && Object.op_Implicit((Object)(object)orCreateValue.interactionDriver.currentInteractable))
				{
					return;
				}
			}
			orCreateValue.usesSinceGrounded++;
			orCreateValue.lastUseTime = Time.fixedTime;
			LaunchUpward(component);
			if (NetworkServer.active)
			{
				Discharge(__instance);
			}
			else
			{
				NetMessageExtensions.Send((INetMessage)(object)new RequestDischargeMessage(((NetworkBehaviour)component).netId), (NetworkDestination)2);
			}
		}

		private static bool CanUseInAir(CharacterBody body, InputState state)
		{
			if (SpurReworkPlugin.UsableInAir.Value)
			{
				return true;
			}
			int num = (SpurReworkPlugin.QualityLoaded ? QualityCompat.AirUses(body) : 0);
			if (num <= 0)
			{
				if (state.usesSinceGrounded == 0)
				{
					return state.airTime <= SpurReworkPlugin.GroundBuffer.Value;
				}
				return false;
			}
			return state.usesSinceGrounded < num;
		}

		private static bool LocalPlayerHasControl(CharacterBody body)
		{
			CharacterMaster master = body.master;
			PlayerCharacterMasterController val = (Object.op_Implicit((Object)(object)master) ? master.playerCharacterMasterController : null);
			NetworkUser val2 = (Object.op_Implicit((Object)(object)val) ? val.networkUser : null);
			LocalUser val3 = (Object.op_Implicit((Object)(object)val2) ? val2.localUser : null);
			if (val3 != null && !val3.isUIFocused && Object.op_Implicit((Object)(object)val2.cameraRigController))
			{
				return val2.cameraRigController.isControlAllowed;
			}
			return false;
		}

		private static void LaunchUpward(CharacterBody body)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			CharacterMotor characterMotor = body.characterMotor;
			float value = SpurReworkPlugin.LaunchMultiplier.Value;
			if (Object.op_Implicit((Object)(object)characterMotor) && !(value <= 0f))
			{
				Vector3 velocity = characterMotor.velocity;
				velocity.y = Mathf.Max(velocity.y, body.jumpPower * value * characterMotor.jumpPowerPenaltyCoefficient);
				characterMotor.velocity = velocity;
				((BaseCharacterController)characterMotor).Motor.ForceUnground(0.1f);
			}
		}

		private static bool GrantCharged(JumpDamageStrikeBodyBehavior behavior, CharacterBody body)
		{
			float num = SpurReworkPlugin.ChargedDuration.Value + SpurReworkPlugin.ChargedDurationPerStack.Value * (float)(((BaseItemBodyBehavior)behavior).stack - 1);
			if (!SpurReworkPlugin.EnableCharged.Value || num <= 0f)
			{
				return false;
			}
			body.AddTimedBuff(SpurBuffs.Charged, num);
			InputState orCreateValue = inputStates.GetOrCreateValue(behavior);
			orCreateValue.lastHurtTime = float.NegativeInfinity;
			orCreateValue.lastCombatTime = float.NegativeInfinity;
			orCreateValue.drainTimer = 0f;
			SetMarker(body, SpurBuffs.InCombat, active: false);
			SetMarker(body, SpurBuffs.ChargeDrain, active: false);
			return true;
		}

		public static void Discharge(JumpDamageStrikeBodyBehavior behavior)
		{
			CharacterBody component = ((Component)behavior).GetComponent<CharacterBody>();
			int buffCount = component.GetBuffCount(Buffs.JumpDamageStrikeCharge);
			dischargeAllowed = true;
			firingBehavior = behavior;
			lastBlastHits = 0;
			blastKills = 0;
			try
			{
				behavior.DischargeEffects();
				firingBehavior = null;
				if (SpurReworkPlugin.QualityLoaded)
				{
					QualityCompat.ApplyChargeCost(component, buffCount);
				}
				if (buffCount < 25)
				{
					return;
				}
				bool flag = GrantCharged(behavior, component);
				if (SpurReworkPlugin.QualityReworkActive && QualityCompat.HasQualitySpur(component))
				{
					float num = QualityCompat.ChargePerBlastHit(component) * (float)lastBlastHits;
					if (flag)
					{
						num += QualityCompat.ChargePerKill(component) * (float)blastKills;
					}
					AddCharge(behavior, num);
				}
				if (SpurReworkPlugin.FallDamageReduction.Value > 0f && SpurReworkPlugin.LaunchMultiplier.Value > 0f)
				{
					inputStates.GetOrCreateValue(behavior).fallProtected = true;
				}
			}
			finally
			{
				dischargeAllowed = false;
				firingBehavior = null;
			}
		}
	}
	public class RequestDischargeMessage : INetMessage, ISerializableObject
	{
		private NetworkInstanceId bodyId;

		public RequestDischargeMessage()
		{
		}

		public RequestDischargeMessage(NetworkInstanceId bodyId)
		{
			//IL_0007: 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)
			this.bodyId = bodyId;
		}

		public void Serialize(NetworkWriter writer)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			writer.Write(bodyId);
		}

		public void Deserialize(NetworkReader reader)
		{
			//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)
			bodyId = reader.ReadNetworkId();
		}

		public void OnReceived()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = (NetworkServer.active ? NetworkServer.FindLocalObject(bodyId) : null);
			JumpDamageStrikeBodyBehavior val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<JumpDamageStrikeBodyBehavior>() : null);
			if (Object.op_Implicit((Object)(object)val2))
			{
				SpurPatches.Discharge(val2);
			}
		}
	}
	[BepInPlugin("com.spurrework.faradayspur", "Spur Rework", "1.1.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class SpurReworkPlugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.spurrework.faradayspur";

		public const string PluginName = "Spur Rework";

		private const string RiskOfOptionsGuid = "com.rune580.riskofoptions";

		private const string QualityGuid = "com.Gorakh.ItemQualities";

		public const string BasePickupText = "Moving around builds up movement speed and jump height. At 25% charge or higher, press Interact while holding Jump to discharge into an electric blast that launches you upward.";

		public static ManualLogSource Log;

		public static ConfigEntry<float> MoveSpeedBase;

		public static ConfigEntry<float> MoveSpeedPerStack;

		public static ConfigEntry<float> JumpBase;

		public static ConfigEntry<float> JumpPerStack;

		public static ConfigEntry<float> LaunchMultiplier;

		public static ConfigEntry<float> ChargeSpeed;

		public static ConfigEntry<bool> UsableInAir;

		public static ConfigEntry<float> ChargedAttackSpeed;

		public static ConfigEntry<float> ChargedChargeSpeed;

		public static ConfigEntry<float> ChargedDuration;

		public static ConfigEntry<float> ChargedDurationPerStack;

		public static ConfigEntry<float> CombatDuration;

		public static ConfigEntry<float> UncommonChargePerHit;

		public static ConfigEntry<float> UncommonChargePerKill;

		public static ConfigEntry<float> UncommonChargePerKillPerStack;

		public static ConfigEntry<float> RareChargePerHit;

		public static ConfigEntry<float> RareChargePerKill;

		public static ConfigEntry<float> RareChargePerKillPerStack;

		public static ConfigEntry<float> EpicChargePerHit;

		public static ConfigEntry<float> EpicChargePerKill;

		public static ConfigEntry<float> EpicChargePerKillPerStack;

		public static ConfigEntry<float> LegendaryChargePerHit;

		public static ConfigEntry<float> LegendaryChargePerKill;

		public static ConfigEntry<float> LegendaryChargePerKillPerStack;

		public static ConfigEntry<float> FallDamageReduction;

		public static ConfigEntry<float> DangerDrainPerSecond;

		public static ConfigEntry<float> DangerDuration;

		public static ConfigEntry<bool> EnableChargeBlock;

		public static ConfigEntry<bool> EnableCharged;

		public static ConfigEntry<bool> EnableChargeDrain;

		public static ConfigEntry<bool> EnableQualityRework;

		public static ConfigEntry<float> GroundBuffer;

		public static ConfigEntry<int> UncommonAirUses;

		public static ConfigEntry<int> RareAirUses;

		public static ConfigEntry<int> EpicAirUses;

		public static ConfigEntry<int> LegendaryAirUses;

		public static ConfigEntry<bool> OverrideRareChargeCost;

		public static ConfigEntry<int> RareChargeCost;

		public static ConfigEntry<bool> BlockWhenInteractableInView;

		public static ConfigEntry<bool> UseCustomKeys;

		public static ConfigEntry<KeyboardShortcut> BlastKey;

		public static ConfigEntry<KeyboardShortcut> JumpKey;

		private LanguageOverlay descriptionOverlay;

		public static bool QualityLoaded { get; private set; }

		public static string ExtraEffectsText
		{
			get
			{
				string text = "";
				float value = ChargedDuration.Value;
				if (ChargedActive)
				{
					text = text + $" After a blast, gain <style=cIsUtility>Static Charge</style> for <style=cIsUtility>{value:0.##}s</style>" + ((ChargedDurationPerStack.Value != 0f) ? $" <style=cStack>(+{ChargedDurationPerStack.Value:0.##}s per stack)</style>" : "") + $": <style=cIsDamage>+{ChargedAttackSpeed.Value:0.##}% attack speed</style>, <style=cIsUtility>+{ChargedChargeSpeed.Value:0.##}% charge speed</style>, and no charge block or drain.";
				}
				if (FallDamageReduction.Value > 0f && LaunchMultiplier.Value > 0f)
				{
					text += ((FallDamageReduction.Value >= 100f) ? " The landing after a blast deals <style=cIsUtility>no fall damage</style>." : $" The landing after a blast deals <style=cIsUtility>{FallDamageReduction.Value:0.##}% less fall damage</style>.");
				}
				if (EnableChargeBlock.Value && CombatDuration.Value > 0f)
				{
					text += $" For <style=cIsHealth>{CombatDuration.Value:0.##}s</style> after using an attack skill, charge only builds while <style=cIsUtility>sprinting</style>.";
				}
				if (ChargeDrainActive)
				{
					text += $" Taking damage drains <style=cIsHealth>{DangerDrainPerSecond.Value:0.##}% charge per second</style> for <style=cIsHealth>{DangerDuration.Value:0.##}s</style>.";
				}
				return text;
			}
		}

		public static bool ChargedActive
		{
			get
			{
				if (EnableCharged.Value)
				{
					return ChargedDuration.Value > 0f;
				}
				return false;
			}
		}

		public static bool ChargeDrainActive
		{
			get
			{
				if (EnableChargeDrain.Value && DangerDrainPerSecond.Value > 0f)
				{
					return DangerDuration.Value > 0f;
				}
				return false;
			}
		}

		public static bool QualityReworkActive
		{
			get
			{
				if (QualityLoaded)
				{
					return EnableQualityRework.Value;
				}
				return false;
			}
		}

		public static string BonusesText => "Moving around builds up <style=cIsUtility>charge</style>, granting up to " + $"<style=cIsUtility>+{MoveSpeedBase.Value:0.##}% <style=cStack>(+{MoveSpeedPerStack.Value:0.##}% per stack)</style> movement speed</style> and " + $"<style=cIsUtility>+{JumpBase.Value:0.##}% <style=cStack>(+{JumpPerStack.Value:0.##}% per stack)</style> jump height</style> at 100%. ";

		private void Awake()
		{
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0601: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			QualityLoaded = Chainloader.PluginInfos.ContainsKey("com.Gorakh.ItemQualities");
			MoveSpeedBase = ((BaseUnityPlugin)this).Config.Bind<float>("Stats", "Move Speed", 40f, "Percent move speed at 100% charge with one stack.");
			MoveSpeedPerStack = ((BaseUnityPlugin)this).Config.Bind<float>("Stats", "Move Speed Per Stack", 25f, "Extra percent move speed at 100% charge per additional stack.");
			JumpBase = ((BaseUnityPlugin)this).Config.Bind<float>("Stats", "Jump Height", 30f, "Percent jump power at 100% charge with one stack, the same stat as vanilla's +200%. Height grows with the square of power, so +30% is about +69% height.");
			JumpPerStack = ((BaseUnityPlugin)this).Config.Bind<float>("Stats", "Jump Height Per Stack", 15f, "Extra percent jump power at 100% charge per additional stack.");
			ChargeSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Stats", "Charge Speed", 1.5f, "How fast charge builds, as a multiple of vanilla. 1.5 is 50% faster.");
			LaunchMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Blast", "Launch Multiplier", 1.75f, "Upward launch from the blast, as a multiple of your normal jump speed at that charge. 0 turns the launch off.");
			UsableInAir = ((BaseUnityPlugin)this).Config.Bind<bool>("Blast", "Usable On Ground And In Air", false, "On: the blast works any time, with no limit on uses in the air. Off: it only works on the ground or just after leaving it, plus any Quality air uses.");
			GroundBuffer = ((BaseUnityPlugin)this).Config.Bind<float>("Blast", "Ground Buffer", 0.45f, "Seconds after leaving the ground that the blast still counts as used from the ground, so it works right after a jump.");
			BlockWhenInteractableInView = ((BaseUnityPlugin)this).Config.Bind<bool>("Blast", "Block When Interactable In View", true, "Pressing Interact while looking at a chest, shrine, etc. uses that object and does not fire the blast.");
			FallDamageReduction = ((BaseUnityPlugin)this).Config.Bind<float>("Blast", "Fall Damage Reduction", 50f, "Percent less fall damage on the landing after a blast. 100 removes it. 0 turns it off.");
			EnableCharged = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Static Charge", false, "After a blast, gain the Static Charge buff: attack speed, faster charging, and no charge block or drain while it lasts.");
			ChargedDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Static Charge Duration", 4f, "Seconds Static Charge lasts with one stack.");
			ChargedDurationPerStack = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Static Charge Duration Per Stack", 1f, "Extra seconds of Static Charge per additional stack.");
			ChargedAttackSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Static Charge Attack Speed", 50f, "Percent attack speed while you have Static Charge.");
			ChargedChargeSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Static Charge Charging Speed", 50f, "Percent faster charging while you have Static Charge, on top of the Charge Speed setting.");
			EnableChargeBlock = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Charge Block", false, "While in combat (an attack skill used within Charge Block Duration, the game's own rule), only sprinting builds charge, not walking.");
			CombatDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Charge Block Duration", 5f, "Seconds after using an attack skill that count as in combat. The game's own combat state uses 5.");
			EnableChargeDrain = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Charge Drain", false, "After taking damage, charge drains for a while. Fall damage doesn't count.");
			DangerDrainPerSecond = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Charge Drain Per Second", 2f, "Percent charge lost per second while draining.");
			DangerDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Charge Drain Duration", 8f, "Seconds the drain lasts after taking damage. Each hit restarts it.");
			UseCustomKeys = ((BaseUnityPlugin)this).Config.Bind<bool>("Keys", "Use Custom Keys", false, "Off: the blast uses the game's own Interact and Jump controls, including controllers. On: it uses the two keys below.");
			BlastKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keys", "Blast Key", new KeyboardShortcut((KeyCode)101, Array.Empty<KeyCode>()), "Press this while holding the Hold Key to fire the blast. Only used with Use Custom Keys on.");
			JumpKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keys", "Hold Key", new KeyboardShortcut((KeyCode)32, Array.Empty<KeyCode>()), "Hold this while pressing the Blast Key. Only used with Use Custom Keys on.");
			if (QualityLoaded)
			{
				UncommonAirUses = ((BaseUnityPlugin)this).Config.Bind<int>("Quality", "Uncommon Air Uses", 2, "Blasts per trip through the air with an Uncommon Spur. Each one still needs 25% charge.");
				RareAirUses = ((BaseUnityPlugin)this).Config.Bind<int>("Quality", "Rare Air Uses", 3, "Blasts per trip through the air with a Rare Spur. Each one still needs 25% charge, so 3 needs Override Rare Charge Cost on.");
				EpicAirUses = ((BaseUnityPlugin)this).Config.Bind<int>("Quality", "Epic Air Uses", 4, "Blasts per trip through the air with an Epic Spur. Each one still needs 25% charge.");
				LegendaryAirUses = ((BaseUnityPlugin)this).Config.Bind<int>("Quality", "Legendary Air Uses", 8, "Blasts per trip through the air with a Legendary Spur. Each one still needs 25% charge.");
				OverrideRareChargeCost = ((BaseUnityPlugin)this).Config.Bind<bool>("Quality", "Override Rare Charge Cost", true, "On: a Rare Spur spends Rare Charge Cost per blast. Off: it spends Quality's own 50%, which only allows 2 blasts from a full bar.");
				RareChargeCost = ((BaseUnityPlugin)this).Config.Bind<int>("Quality", "Rare Charge Cost", 35, "Percent charge a Rare Spur spends per blast. Only used with Override Rare Charge Cost on.");
				EnableQualityRework = ((BaseUnityPlugin)this).Config.Bind<bool>("Misc", "Quality Charge Rework", false, "Replaces Quality's bonus blast damage from move speed with charge gained from enemies hit by the blast, and from kills while you have Static Charge (needs Static Charge on). Quality's smaller charge cost per blast stays.");
				UncommonChargePerHit = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Uncommon Charge Per Hit", 0.5f, "Percent charge gained for every enemy the blast hits, by the highest tier held. Needs Quality Charge Rework on.");
				UncommonChargePerKill = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Uncommon Charge Per Kill", 1f, "Percent charge gained for every enemy killed by the blast or while you have Static Charge, from the first stack of the highest tier held. Needs Quality Charge Rework and Static Charge on.");
				UncommonChargePerKillPerStack = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Uncommon Charge Per Kill Per Stack", 0.5f, "Extra percent charge per kill for every other stack of this tier.");
				RareChargePerHit = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Rare Charge Per Hit", 1f, "Percent charge gained for every enemy the blast hits, by the highest tier held. Needs Quality Charge Rework on.");
				RareChargePerKill = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Rare Charge Per Kill", 2f, "Percent charge gained for every enemy killed by the blast or while you have Static Charge, from the first stack of the highest tier held. Needs Quality Charge Rework and Static Charge on.");
				RareChargePerKillPerStack = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Rare Charge Per Kill Per Stack", 1f, "Extra percent charge per kill for every other stack of this tier.");
				EpicChargePerHit = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Epic Charge Per Hit", 1.5f, "Percent charge gained for every enemy the blast hits, by the highest tier held. Needs Quality Charge Rework on.");
				EpicChargePerKill = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Epic Charge Per Kill", 3f, "Percent charge gained for every enemy killed by the blast or while you have Static Charge, from the first stack of the highest tier held. Needs Quality Charge Rework and Static Charge on.");
				EpicChargePerKillPerStack = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Epic Charge Per Kill Per Stack", 1.5f, "Extra percent charge per kill for every other stack of this tier.");
				LegendaryChargePerHit = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Legendary Charge Per Hit", 2f, "Percent charge gained for every enemy the blast hits, by the highest tier held. Needs Quality Charge Rework on.");
				LegendaryChargePerKill = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Legendary Charge Per Kill", 5f, "Percent charge gained for every enemy killed by the blast or while you have Static Charge, from the first stack of the highest tier held. Needs Quality Charge Rework and Static Charge on.");
				LegendaryChargePerKillPerStack = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "Legendary Charge Per Kill Per Stack", 3f, "Extra percent charge per kill for every other stack of this tier.");
			}
			SpurBuffs.Register();
			SpurPatches.Init();
			NetworkingAPI.RegisterMessageType<RequestDischargeMessage>();
			new Harmony("com.spurrework.faradayspur").PatchAll(typeof(SpurPatches));
			OverrideItemText();
			((BaseUnityPlugin)this).Config.SettingChanged += delegate
			{
				ApplySettingChange();
			};
			if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
			{
				RiskOfOptionsCompat.Register(((BaseUnityPlugin)this).Info.Location);
			}
		}

		private void ApplySettingChange()
		{
			OverrideItemText();
			foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList)
			{
				if (readOnlyInstances.HasBuff(Buffs.JumpDamageStrikeCharge) || readOnlyInstances.HasBuff(SpurBuffs.Charged))
				{
					readOnlyInstances.MarkAllStatsDirty();
				}
			}
		}

		private void OverrideItemText()
		{
			LanguageOverlay obj = descriptionOverlay;
			if (obj != null)
			{
				obj.Remove();
			}
			Dictionary<string, string> dictionary = new Dictionary<string, string>
			{
				["ITEM_JUMPDAMAGESTRIKE_PICKUP"] = "Moving around builds up movement speed and jump height. At 25% charge or higher, press Interact while holding Jump to discharge into an electric blast that launches you upward.",
				["ITEM_JUMPDAMAGESTRIKE_DESC"] = BonusesText + "At 25% charge or higher, pressing <style=cIsUtility>Interact</style> while holding <style=cIsUtility>Jump</style> launches you upward and triggers an <style=cIsDamage>explosive discharge</style> for <style=cIsDamage>400% <style=cStack>(+280% per stack)</style> damage</style> in a 17m-32m <style=cStack>(+7.5m per stack)</style> area." + ExtraEffectsText + (UsableInAir.Value ? "" : " Usable on the ground or right after leaving it.")
			};
			if (QualityLoaded)
			{
				QualityCompat.AddItemText(dictionary);
			}
			descriptionOverlay = LanguageAPI.AddOverlay(dictionary);
		}
	}
}