Decompiled source of BetterJackhammer v1.0.8

BetterJackhammer.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BetterJackhammer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BetterJackhammer")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d24676a8-4da0-4d43-a77a-48484b461e2c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BetterJackhammer;

public static class F_Utils
{
	[CompilerGenerated]
	private sealed class <DelayCoroutine>d__0 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public float delayInSeconds;

		public Action action;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <DelayCoroutine>d__0(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(delayInSeconds);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				action();
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <NextFrameCoroutine>d__1 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public Action action;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <NextFrameCoroutine>d__1(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForEndOfFrame();
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				action();
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[IteratorStateMachine(typeof(<DelayCoroutine>d__0))]
	public static IEnumerator DelayCoroutine(float delayInSeconds, Action action)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <DelayCoroutine>d__0(0)
		{
			delayInSeconds = delayInSeconds,
			action = action
		};
	}

	[IteratorStateMachine(typeof(<NextFrameCoroutine>d__1))]
	public static IEnumerator NextFrameCoroutine(Action action)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <NextFrameCoroutine>d__1(0)
		{
			action = action
		};
	}

	public static bool Try_GetFrom_Config(BoolField boolField, bool regular = false)
	{
		try
		{
			if (boolField != null)
			{
				return boolField.value;
			}
		}
		catch
		{
		}
		return regular;
	}

	public static int Try_GetFrom_Config(IntField intField, int regular = 1)
	{
		try
		{
			if (intField != null)
			{
				return intField.value;
			}
		}
		catch
		{
		}
		return regular;
	}

	public static float Try_GetFrom_Config(FloatField floatField, float regular = 1f)
	{
		try
		{
			if (floatField != null)
			{
				return floatField.value;
			}
		}
		catch
		{
		}
		return regular;
	}

	public static KeyCode Try_GetFrom_Config(KeyCodeField keyCodeField, KeyCode regular = 0)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: 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)
		try
		{
			if (keyCodeField != null)
			{
				return keyCodeField.value;
			}
		}
		catch
		{
		}
		return regular;
	}

	public static T Try_GetFrom_Config<T>(EnumField<T> enumField, T regular) where T : struct
	{
		try
		{
			if (enumField != null)
			{
				return enumField.value;
			}
		}
		catch
		{
		}
		return regular;
	}

	public static Color Try_GetFrom_Config(ColorField colorField, Color regular)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: 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)
		try
		{
			if (colorField != null)
			{
				return colorField.value;
			}
		}
		catch
		{
		}
		return regular;
	}
}
public static class BetterJackhammer_Settings
{
	public enum Jackhammer_State
	{
		Fraud__Nerf__Current,
		Broccolite__Nerf__Idea,
		Without__A__Nerf
	}

	public static EnumField<Jackhammer_State> V__Varb_Selected_Jackhammer_State;

	public static FloatField V__Varb_Seconds_Until_Full_Passive_Cooling;

	public static FloatField V__Varb_Shotgun_Shot_Cooling;

	public static FloatField V__Varb_OverHeat_Others_Cooling;

	public static BoolField V__Varb_Indicate_Heat_Level;

	public static FloatField V__Varb_Heat_Capacity;

	public static FloatField V__Varb_Pump_Charge_Heat;

	public static FloatField V__Varb_Hitscan_Convertation_Heat;

	public static FloatField V__Varb_Green_Gauge_Heat;

	public static FloatField V__Varb_Yellow_Gauge_Heat;

	public static FloatField V__Varb_Red_Gauge_Heat;

	public static FloatField V__Varb_Green_Gauge_Damage;

	public static FloatField V__Varb_Yellow_Gauge_Damage;

	public static FloatField V__Varb_Red_Gauge_Damage;

	public static FloatField V__Varb_Pump_Charge1_Damage;

	public static FloatField V__Varb_Pump_Charge2_Damage;

	public static FloatField V__Varb_Pump_Charge3_Damage;

	public static FloatField V__Varb_Spin_Sound_Mult;

	public static FloatField V__Varb_Impact_Pitch_Goal;

	public static FloatField V__Varb_Impact_Pitch_Variety;

	public static Jackhammer_State Selected_Jackhammer_State => F_Utils.Try_GetFrom_Config(V__Varb_Selected_Jackhammer_State, Jackhammer_State.Broccolite__Nerf__Idea);

	public static float Seconds_Until_Full_Passive_Cooling => F_Utils.Try_GetFrom_Config(V__Varb_Seconds_Until_Full_Passive_Cooling, 8f);

	public static float Shotgun_Shot_Cooling => F_Utils.Try_GetFrom_Config(V__Varb_Shotgun_Shot_Cooling, 0.125f);

	public static float OverHeat_Others_Cooling => F_Utils.Try_GetFrom_Config(V__Varb_OverHeat_Others_Cooling, 0f);

	public static bool Indicate_Heat_Level => F_Utils.Try_GetFrom_Config(V__Varb_Indicate_Heat_Level, regular: true);

	public static float Heat_Capacity => F_Utils.Try_GetFrom_Config(V__Varb_Heat_Capacity, 8f);

	public static float Pump_Charge_Heat => F_Utils.Try_GetFrom_Config(V__Varb_Pump_Charge_Heat, 0.125f);

	public static float Hitscan_Convertation_Heat => F_Utils.Try_GetFrom_Config(V__Varb_Hitscan_Convertation_Heat, 0.25f);

	public static float Green_Gauge_Heat => F_Utils.Try_GetFrom_Config(V__Varb_Green_Gauge_Heat, 0.25f);

	public static float Yellow_Gauge_Heat => F_Utils.Try_GetFrom_Config(V__Varb_Yellow_Gauge_Heat, 0.5f);

	public static float Red_Gauge_Heat => F_Utils.Try_GetFrom_Config(V__Varb_Red_Gauge_Heat);

	public static float Green_Gauge_Damage => F_Utils.Try_GetFrom_Config(V__Varb_Green_Gauge_Damage, 3f);

	public static float Yellow_Gauge_Damage => F_Utils.Try_GetFrom_Config(V__Varb_Yellow_Gauge_Damage, 6f);

	public static float Red_Gauge_Damage => F_Utils.Try_GetFrom_Config(V__Varb_Red_Gauge_Damage, 12f);

	public static float Pump_Charge_1_Damage => F_Utils.Try_GetFrom_Config(V__Varb_Pump_Charge1_Damage, 1.5f);

	public static float Pump_Charge_2_Damage => F_Utils.Try_GetFrom_Config(V__Varb_Pump_Charge2_Damage, 3.5f);

	public static float Pump_Charge_3_Damage => F_Utils.Try_GetFrom_Config(V__Varb_Pump_Charge3_Damage, 7f);

	public static float Spin_Sound_Mult => F_Utils.Try_GetFrom_Config(V__Varb_Spin_Sound_Mult);

	public static float Impact_Pitch_Goal => F_Utils.Try_GetFrom_Config(V__Varb_Impact_Pitch_Goal, 1.2f);

	public static float Impact_Pitch_Variety => F_Utils.Try_GetFrom_Config(V__Varb_Impact_Pitch_Variety, 0.025f);

	public static float GetHeat(int tier)
	{
		return tier switch
		{
			0 => Heat_Capacity * Green_Gauge_Heat, 
			1 => Heat_Capacity * Yellow_Gauge_Heat, 
			2 => Heat_Capacity * Red_Gauge_Heat, 
			_ => Heat_Capacity * Green_Gauge_Heat, 
		};
	}

	public static float GetDamage(int tier)
	{
		return tier switch
		{
			0 => Green_Gauge_Damage, 
			1 => Yellow_Gauge_Damage, 
			2 => Red_Gauge_Damage, 
			_ => Green_Gauge_Damage, 
		};
	}
}
[BepInPlugin("com.enragedone.BetterJackhammer", "BetterJackhammer", "1.0.8")]
public class BetterJackhammer_Loader : BaseUnityPlugin
{
	public const string GUID = "com.enragedone.BetterJackhammer";

	public const string Name = "BetterJackhammer";

	public const string Version = "1.0.8";

	public const string Set_Guid = "com.enragedone.BetterJackhammer.settings";

	public PluginConfigurator config;

	public bool Confing_Loaded;

	public static ManualLogSource _Logger;

	public static BetterJackhammer_Loader _Instance;

	internal Harmony _Harmony = new Harmony("com.enragedone.betterjackhammer.patches");

	public void Awake()
	{
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Expected O, but got Unknown
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Expected O, but got Unknown
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Expected O, but got Unknown
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Expected O, but got Unknown
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e8: Expected O, but got Unknown
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Expected O, but got Unknown
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Expected O, but got Unknown
		//IL_024a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0254: Expected O, but got Unknown
		//IL_026e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0278: Expected O, but got Unknown
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_029c: Expected O, but got Unknown
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0306: Expected O, but got Unknown
		//IL_0320: Unknown result type (might be due to invalid IL or missing references)
		//IL_032a: Expected O, but got Unknown
		//IL_0344: Unknown result type (might be due to invalid IL or missing references)
		//IL_034e: Expected O, but got Unknown
		//IL_0360: Unknown result type (might be due to invalid IL or missing references)
		//IL_0365: Unknown result type (might be due to invalid IL or missing references)
		//IL_036a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0374: Unknown result type (might be due to invalid IL or missing references)
		//IL_0398: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a2: Expected O, but got Unknown
		//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c6: Expected O, but got Unknown
		//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ea: Expected O, but got Unknown
		//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0401: Unknown result type (might be due to invalid IL or missing references)
		//IL_0406: Unknown result type (might be due to invalid IL or missing references)
		//IL_0410: Unknown result type (might be due to invalid IL or missing references)
		//IL_0434: Unknown result type (might be due to invalid IL or missing references)
		//IL_043e: Expected O, but got Unknown
		//IL_0458: Unknown result type (might be due to invalid IL or missing references)
		//IL_0462: Expected O, but got Unknown
		//IL_047c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0486: Expected O, but got Unknown
		_Instance = this;
		_Logger = ((BaseUnityPlugin)this).Logger;
		_Logger.LogInfo((object)"BetterJackhammer_Loader v1.0.8 has started.");
		try
		{
			config = PluginConfigurator.Create("Better Jackhammer", "com.enragedone.BetterJackhammer.settings");
			string text = Path.Combine(Path.GetDirectoryName(typeof(BetterJackhammer_Loader).Assembly.Location), "icon.png");
			config.SetIconWithURL("file://" + text);
			new ConfigHeader(config.rootPanel, "Main / Global Settings", 24).textColor = Color.yellow;
			BetterJackhammer_Settings.V__Varb_Selected_Jackhammer_State = new EnumField<BetterJackhammer_Settings.Jackhammer_State>(config.rootPanel, "Jackhammer State", "com.enragedone.BetterJackhammer.settings.V__Varb_Default_Gravity", BetterJackhammer_Settings.Jackhammer_State.Broccolite__Nerf__Idea);
			new ConfigHeader(config.rootPanel, "! Settings Only For Broccolite Nerf Idea !", 24).textColor = Color.red;
			new ConfigHeader(config.rootPanel, "Cooling Settings", 24).textColor = Color32.op_Implicit(new Color32((byte)105, (byte)172, byte.MaxValue, byte.MaxValue));
			BetterJackhammer_Settings.V__Varb_Seconds_Until_Full_Passive_Cooling = new FloatField(config.rootPanel, "Seconds Until Full Passive Cooling", "com.enragedone.BetterJackhammer.settings.V__Varb_Seconds_Until_Full_Passive_Cooling", 8f);
			BetterJackhammer_Settings.V__Varb_Shotgun_Shot_Cooling = new FloatField(config.rootPanel, "Shotgun Shot Cooling", "com.enragedone.BetterJackhammer.settings.V__Varb_Shotgun_Shot_Cooling", 0.125f);
			BetterJackhammer_Settings.V__Varb_OverHeat_Others_Cooling = new FloatField(config.rootPanel, "Heat Left After Overheat", "com.enragedone.BetterJackhammer.settings.V__Varb_OverHeat_Others_Cooling", 0f);
			new ConfigHeader(config.rootPanel, "Heat Settings", 24).textColor = Color.Lerp(Color.red, Color.yellow, 0.4f);
			BetterJackhammer_Settings.V__Varb_Indicate_Heat_Level = new BoolField(config.rootPanel, "Indicate Heat Level", "com.enragedone.BetterJackhammer.settings.V__Varb_Indicate_Heat_Level", true);
			BetterJackhammer_Settings.V__Varb_Heat_Capacity = new FloatField(config.rootPanel, "Heat Capacity \n(og: 7)", "com.enragedone.BetterJackhammer.settings.V__Varb_Heat_Capacity", 8f);
			BetterJackhammer_Settings.V__Varb_Pump_Charge_Heat = new FloatField(config.rootPanel, "Pump Charge Heat ", "com.enragedone.BetterJackhammer.settings.V__Varb_Extra_Heat_PerPump", 0.125f);
			BetterJackhammer_Settings.V__Varb_Hitscan_Convertation_Heat = new FloatField(config.rootPanel, "Hitscan Convertation Heat", "com.enragedone.BetterJackhammer.settings.V__Varb_Hitscan_Convertation_Heat", 0.25f);
			BetterJackhammer_Settings.V__Varb_Green_Gauge_Heat = new FloatField(config.rootPanel, "Green Gauge Heat", "com.enragedone.BetterJackhammer.settings.V__Varb_Green_Gauge_Heat", 0.25f);
			BetterJackhammer_Settings.V__Varb_Yellow_Gauge_Heat = new FloatField(config.rootPanel, "Yellow Gauge Heat", "com.enragedone.BetterJackhammer.settings.V__Varb_Yellow_Gauge_Heat", 0.5f);
			BetterJackhammer_Settings.V__Varb_Red_Gauge_Heat = new FloatField(config.rootPanel, "Red Gauge Heat", "com.enragedone.BetterJackhammer.settings.V__Varb_Red_Gauge_Heat", 1f);
			new ConfigHeader(config.rootPanel, "Damage Settings", 24).textColor = Color.Lerp(Color32.op_Implicit(new Color32((byte)105, (byte)172, byte.MaxValue, byte.MaxValue)), Color.magenta, 0.35f);
			BetterJackhammer_Settings.V__Varb_Green_Gauge_Damage = new FloatField(config.rootPanel, "Green Gauge Damage", "com.enragedone.BetterJackhammer.settings.V__Varb_Green_Gauge_Damage", 3f);
			BetterJackhammer_Settings.V__Varb_Yellow_Gauge_Damage = new FloatField(config.rootPanel, "Yellow Gauge Damage", "com.enragedone.BetterJackhammer.settings.V__Varb_Yellow_Gauge_Damage", 6f);
			BetterJackhammer_Settings.V__Varb_Red_Gauge_Damage = new FloatField(config.rootPanel, "Red Gauge Damage (og: 10)", "com.enragedone.BetterJackhammer.settings.V__Varb_Red_Gauge_Damage", 12f);
			new ConfigHeader(config.rootPanel, "Pump Damage Settings", 24).textColor = Color.Lerp(Color.blue, Color.magenta, 0.45f);
			BetterJackhammer_Settings.V__Varb_Pump_Charge1_Damage = new FloatField(config.rootPanel, "Green Gauge Damage (og: 3.5)", "com.enragedone.BetterJackhammer.settings.V__Varb_Pump_Charge1_Damage", 1.5f);
			BetterJackhammer_Settings.V__Varb_Pump_Charge2_Damage = new FloatField(config.rootPanel, "Yellow Gauge Damage", "com.enragedone.BetterJackhammer.settings.V__Varb_Pump_Charge2_Damage", 3.5f);
			BetterJackhammer_Settings.V__Varb_Pump_Charge3_Damage = new FloatField(config.rootPanel, "Red Gauge Damage", "com.enragedone.BetterJackhammer.settings.V__Varb_Pump_Charge3_Damage", 7f);
			new ConfigHeader(config.rootPanel, "Sound Settings", 24).textColor = Color.Lerp(Color.yellow, Color.green, 0.45f);
			BetterJackhammer_Settings.V__Varb_Spin_Sound_Mult = new FloatField(config.rootPanel, "Spin Sound Mult", "com.enragedone.BetterJackhammer.settings.V__Varb_Spin_Sound_Mult", 1f);
			BetterJackhammer_Settings.V__Varb_Impact_Pitch_Goal = new FloatField(config.rootPanel, "Overheat Impact Pitch Goal", "com.enragedone.BetterJackhammer.settings.V__Varb_Impact_Pitch_Target", 1.2f);
			BetterJackhammer_Settings.V__Varb_Impact_Pitch_Variety = new FloatField(config.rootPanel, "Impact Pitch Variety (og: 0.2)", "com.enragedone.BetterJackhammer.settings.V__Varb_Impact_Pitch_Variety", 0.025f);
			_Logger.LogInfo((object)"Config v1.0.8 loaded successfully");
			Confing_Loaded = true;
		}
		catch
		{
			_Logger.LogError((object)"BetterJackhammer_Loader v1.0.8 !!!---!!! ERROR With PluginConfigurator Init");
		}
		BetterJackhammer_Core.Boot_Core();
		_Harmony.PatchAll(typeof(Jackhammer_Patches));
		_Logger.LogInfo((object)"BetterJackhammer_Loader v1.0.8 loaded successfully without error.");
	}
}
public static class BetterJackhammer_Core
{
	public static void Boot_Core()
	{
		SceneManager.sceneLoaded += OnSceneLoaded;
	}

	public static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		string currentScene = SceneHelper.CurrentScene;
		if (currentScene != "Main Menu" && currentScene != "Intro" && currentScene != "Bootstrap")
		{
			_ = MonoSingleton<NerfHandler>.Instance;
		}
	}
}
public class NerfHandler : MonoSingleton<NerfHandler>
{
	public static bool IgnoreVar0;

	public static bool IgnoreVar1;

	public static bool IgnoreVar2;

	public static float Global_Heat;

	public static float Last_Heat_Capacity;

	public WeaponCharges wc;

	public void Start()
	{
		Global_Heat = 0f;
		wc = MonoSingleton<WeaponCharges>.Instance;
	}

	public void Update()
	{
		if (BetterJackhammer_Settings.Selected_Jackhammer_State == BetterJackhammer_Settings.Jackhammer_State.Fraud__Nerf__Current)
		{
			Global_Heat = 0f;
		}
		else if (BetterJackhammer_Settings.Selected_Jackhammer_State == BetterJackhammer_Settings.Jackhammer_State.Broccolite__Nerf__Idea)
		{
			if (Last_Heat_Capacity != BetterJackhammer_Settings.Heat_Capacity)
			{
				wc.shoaltcooldowns[0] = 0f;
				wc.shoaltcooldowns[1] = 0f;
				wc.shoaltcooldowns[2] = 0f;
				Last_Heat_Capacity = BetterJackhammer_Settings.Heat_Capacity;
			}
			Global_Heat = Mathf.MoveTowards(Global_Heat, 0f, Time.deltaTime * (BetterJackhammer_Settings.Heat_Capacity / BetterJackhammer_Settings.Seconds_Until_Full_Passive_Cooling));
			if (!IgnoreVar0)
			{
				wc.shoaltcooldowns[0] = 0f;
			}
			else if (wc.shoaltcooldowns[0] == 0f)
			{
				IgnoreVar0 = false;
			}
			if (!IgnoreVar1)
			{
				wc.shoaltcooldowns[1] = 0f;
			}
			else if (wc.shoaltcooldowns[1] == 0f)
			{
				IgnoreVar1 = false;
			}
			if (!IgnoreVar2)
			{
				wc.shoaltcooldowns[2] = 0f;
			}
			else if (wc.shoaltcooldowns[2] == 0f)
			{
				IgnoreVar2 = false;
			}
			wc.shoAltYellows = 0;
			wc.shoAltYellowsTimer = 0f;
		}
		else if (BetterJackhammer_Settings.Selected_Jackhammer_State == BetterJackhammer_Settings.Jackhammer_State.Without__A__Nerf)
		{
			wc.shoAltYellows = 0;
			wc.shoAltYellowsTimer = 0f;
		}
	}

	public static void HeatTry(int variation)
	{
		if (Global_Heat >= BetterJackhammer_Settings.Heat_Capacity - BetterJackhammer_Settings.Heat_Capacity * 0.0142f)
		{
			Global_Heat = Mathf.Clamp(BetterJackhammer_Settings.Heat_Capacity * BetterJackhammer_Settings.OverHeat_Others_Cooling, 0f, BetterJackhammer_Settings.Heat_Capacity);
			switch (variation)
			{
			case 0:
				IgnoreVar0 = true;
				break;
			case 1:
				IgnoreVar1 = true;
				break;
			case 2:
				IgnoreVar2 = true;
				break;
			}
			MonoSingleton<WeaponCharges>.Instance.shoaltcooldowns[variation] = BetterJackhammer_Settings.Heat_Capacity;
		}
	}
}
public static class Jackhammer_Patches
{
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	[HarmonyPostfix]
	private static void BlockLeaderboardScores(ref bool __result)
	{
		if (BetterJackhammer_Settings.Selected_Jackhammer_State != 0)
		{
			__result = false;
		}
	}

	[HarmonyPatch(typeof(ShotgunHammer), "ImpactEffects")]
	[HarmonyPrefix]
	private static void ShotgunHammer__ImpactEffects(GameObject ___overPumpExplosion, GameObject ___pumpExplosion, ShotgunHammer __instance)
	{
		if (BetterJackhammer_Settings.Selected_Jackhammer_State == BetterJackhammer_Settings.Jackhammer_State.Broccolite__Nerf__Idea)
		{
			if (__instance.variation != 1)
			{
				return;
			}
			NerfHandler instance = MonoSingleton<NerfHandler>.Instance;
			if (__instance.primaryCharge == 1)
			{
				Explosion componentInChildren = ___pumpExplosion.GetComponentInChildren<Explosion>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					componentInChildren.damage = (int)(BetterJackhammer_Settings.Pump_Charge_1_Damage * 10f);
				}
			}
			else if (__instance.primaryCharge == 2)
			{
				Explosion componentInChildren2 = ___pumpExplosion.GetComponentInChildren<Explosion>();
				if (Object.op_Implicit((Object)(object)componentInChildren2))
				{
					componentInChildren2.damage = (int)(BetterJackhammer_Settings.Pump_Charge_2_Damage * 10f);
				}
			}
			else if (__instance.primaryCharge == 3)
			{
				Explosion componentInChildren3 = ___overPumpExplosion.GetComponentInChildren<Explosion>();
				if (Object.op_Implicit((Object)(object)componentInChildren3))
				{
					componentInChildren3.damage = (int)(BetterJackhammer_Settings.Pump_Charge_3_Damage * 10f / 2f);
				}
			}
			NerfHandler.Global_Heat = Mathf.Clamp(NerfHandler.Global_Heat + (float)__instance.primaryCharge * BetterJackhammer_Settings.Heat_Capacity * BetterJackhammer_Settings.Pump_Charge_Heat / (float)(1 + MonoSingleton<GunControl>.Instance.dualWieldCount), 0f, BetterJackhammer_Settings.Heat_Capacity);
			((MonoBehaviour)instance).StartCoroutine(F_Utils.DelayCoroutine(0.05f, delegate
			{
				NerfHandler.HeatTry(__instance.variation);
			}));
		}
		else
		{
			if (__instance.variation != 1)
			{
				return;
			}
			if (__instance.primaryCharge == 3)
			{
				Explosion componentInChildren4 = ___overPumpExplosion.GetComponentInChildren<Explosion>();
				if (Object.op_Implicit((Object)(object)componentInChildren4))
				{
					componentInChildren4.damage = 35;
				}
			}
			else
			{
				Explosion componentInChildren5 = ___pumpExplosion.GetComponentInChildren<Explosion>();
				if (Object.op_Implicit((Object)(object)componentInChildren5))
				{
					componentInChildren5.damage = 35;
				}
			}
		}
	}

	[HarmonyPatch(typeof(ShotgunHammer), "DeliverDamage")]
	[HarmonyPrefix]
	public static void ShotgunHammer__DeliverDamage(EnemyIdentifier ___hitEnemy, int ___tier, ref float ___damage, ShotgunHammer __instance)
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Invalid comparison between Unknown and I4
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Invalid comparison between Unknown and I4
		if (BetterJackhammer_Settings.Selected_Jackhammer_State != BetterJackhammer_Settings.Jackhammer_State.Broccolite__Nerf__Idea)
		{
			return;
		}
		NerfHandler instance = MonoSingleton<NerfHandler>.Instance;
		___damage = BetterJackhammer_Settings.GetDamage(___tier);
		if (Object.op_Implicit((Object)(object)___hitEnemy) && !___hitEnemy.dead && (int)___hitEnemy.enemyType != 21 && (int)___hitEnemy.enemyType != 39)
		{
			NerfHandler.Global_Heat = Mathf.Clamp(NerfHandler.Global_Heat + BetterJackhammer_Settings.GetHeat(___tier) / (float)(1 + MonoSingleton<GunControl>.Instance.dualWieldCount), 0f, BetterJackhammer_Settings.Heat_Capacity);
			((MonoBehaviour)instance).StartCoroutine(F_Utils.DelayCoroutine(0.05f, delegate
			{
				NerfHandler.HeatTry(__instance.variation);
			}));
		}
	}

	[HarmonyPatch(typeof(ShotgunHammer), "DeliverDamage")]
	[HarmonyPostfix]
	public static void ShotgunHammer__DeliverDamage__Post(EnemyIdentifier ___hitEnemy, int ___tier, ref float ___damage, ShotgunHammer __instance)
	{
		if (BetterJackhammer_Settings.Selected_Jackhammer_State == BetterJackhammer_Settings.Jackhammer_State.Broccolite__Nerf__Idea)
		{
			if (__instance.variation == 0 && NerfHandler.IgnoreVar0)
			{
				MonoSingleton<WeaponCharges>.Instance.shoaltcooldowns[__instance.variation] = BetterJackhammer_Settings.Heat_Capacity;
			}
			else if (__instance.variation == 1 && NerfHandler.IgnoreVar1)
			{
				MonoSingleton<WeaponCharges>.Instance.shoaltcooldowns[__instance.variation] = BetterJackhammer_Settings.Heat_Capacity;
			}
			else if (__instance.variation == 2 && NerfHandler.IgnoreVar2)
			{
				MonoSingleton<WeaponCharges>.Instance.shoaltcooldowns[__instance.variation] = BetterJackhammer_Settings.Heat_Capacity;
			}
		}
	}

	[HarmonyPatch(typeof(ShotgunHammer), "LateUpdate")]
	[HarmonyPostfix]
	public static void ShotgunHammer__LateUpdate(ref Quaternion ___motorPreviousRotation, int ___tier, SpriteRenderer ___motorSprite, AudioSource ___motorSound, Coroutine ___impactRoutine, Transform ___rotatingMotor, Transform ___meterHand, ShotgunHammer __instance)
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		if (BetterJackhammer_Settings.Selected_Jackhammer_State != BetterJackhammer_Settings.Jackhammer_State.Broccolite__Nerf__Idea)
		{
			return;
		}
		if (__instance.variation == 0 && NerfHandler.IgnoreVar0)
		{
			___meterHand.localRotation = Quaternion.Euler(0f, 170f - MonoSingleton<WeaponCharges>.Instance.shoaltcooldowns[__instance.variation] / BetterJackhammer_Settings.Heat_Capacity * 200f, -90f);
		}
		else if (__instance.variation == 1 && NerfHandler.IgnoreVar1)
		{
			___meterHand.localRotation = Quaternion.Euler(0f, 170f - MonoSingleton<WeaponCharges>.Instance.shoaltcooldowns[__instance.variation] / BetterJackhammer_Settings.Heat_Capacity * 200f, -90f);
		}
		else if (__instance.variation == 2 && NerfHandler.IgnoreVar2)
		{
			___meterHand.localRotation = Quaternion.Euler(0f, 170f - MonoSingleton<WeaponCharges>.Instance.shoaltcooldowns[__instance.variation] / BetterJackhammer_Settings.Heat_Capacity * 200f, -90f);
		}
		else if (BetterJackhammer_Settings.Indicate_Heat_Level && NerfHandler.Global_Heat > 0.01f)
		{
			___meterHand.localRotation = Quaternion.Euler(0f, 170f - NerfHandler.Global_Heat / BetterJackhammer_Settings.Heat_Capacity * 200f, -90f);
			float num = Time.timeScale;
			if (___impactRoutine != null)
			{
				num = 1f;
			}
			float num2 = NerfHandler.Global_Heat / BetterJackhammer_Settings.Heat_Capacity;
			___rotatingMotor.localRotation = ___motorPreviousRotation;
			___rotatingMotor.Rotate(Vector3.up * num2 * 10f * num * Time.unscaledDeltaTime * 150f, (Space)1);
			___motorPreviousRotation = ___rotatingMotor.localRotation;
			___motorSprite.color = new Color(1f, 1f, 1f, num2 / 3f);
			if (___impactRoutine == null)
			{
				___motorSound.volume = num2 / 1.5f * BetterJackhammer_Settings.Spin_Sound_Mult;
				AudioSourceExtensions.SetPitch(___motorSound, num2 * num);
			}
			else
			{
				___motorSound.volume = num2 / 2f * BetterJackhammer_Settings.Spin_Sound_Mult;
				AudioSourceExtensions.SetPitch(___motorSound, (float)(___tier + 1));
			}
		}
	}

	[HarmonyPatch(typeof(ShotgunHammer), "HitNade")]
	[HarmonyPostfix]
	public static void ShotgunHammer__HitNade(ShotgunHammer __instance)
	{
		if (BetterJackhammer_Settings.Selected_Jackhammer_State == BetterJackhammer_Settings.Jackhammer_State.Broccolite__Nerf__Idea)
		{
			NerfHandler instance = MonoSingleton<NerfHandler>.Instance;
			NerfHandler.Global_Heat = Mathf.Clamp(NerfHandler.Global_Heat + BetterJackhammer_Settings.Heat_Capacity * BetterJackhammer_Settings.Hitscan_Convertation_Heat, 0f, BetterJackhammer_Settings.Heat_Capacity);
			((MonoBehaviour)instance).StartCoroutine(F_Utils.DelayCoroutine(0.05f, delegate
			{
				NerfHandler.HeatTry(__instance.variation);
			}));
		}
	}

	[HarmonyPatch(typeof(ShotgunHammer), "ImpactRoutine")]
	[HarmonyPostfix]
	private static void ShotgunHammer__ImpactRoutine(int ___tier, AudioSource ___hitSound, ShotgunHammer __instance)
	{
		RandomPitch val2 = default(RandomPitch);
		if (BetterJackhammer_Settings.Selected_Jackhammer_State == BetterJackhammer_Settings.Jackhammer_State.Broccolite__Nerf__Idea)
		{
			float defaultPitch = Mathf.Lerp(0.8f, BetterJackhammer_Settings.Impact_Pitch_Goal, (NerfHandler.Global_Heat + BetterJackhammer_Settings.GetHeat(___tier)) / BetterJackhammer_Settings.Heat_Capacity);
			RandomPitch val = default(RandomPitch);
			if (Object.op_Implicit((Object)(object)___hitSound) && ((Component)___hitSound).TryGetComponent<RandomPitch>(ref val))
			{
				val.defaultPitch = defaultPitch;
				val.pitchVariation = BetterJackhammer_Settings.Impact_Pitch_Variety;
			}
		}
		else if (Object.op_Implicit((Object)(object)___hitSound) && ((Component)___hitSound).TryGetComponent<RandomPitch>(ref val2))
		{
			val2.defaultPitch = 1f;
			val2.pitchVariation = 0.2f;
		}
	}

	[HarmonyPatch(typeof(WeaponCharges), "MaxCharges")]
	[HarmonyPostfix]
	public static void WeaponCharges__MaxCharges(ShotgunHammer __instance)
	{
		if (BetterJackhammer_Settings.Selected_Jackhammer_State == BetterJackhammer_Settings.Jackhammer_State.Broccolite__Nerf__Idea)
		{
			NerfHandler.Global_Heat = 0f;
		}
	}

	[HarmonyPatch(typeof(Shotgun), "Shoot")]
	[HarmonyPostfix]
	public static void Shotgun__Shoot(ShotgunHammer __instance)
	{
		if (BetterJackhammer_Settings.Selected_Jackhammer_State == BetterJackhammer_Settings.Jackhammer_State.Broccolite__Nerf__Idea)
		{
			NerfHandler.Global_Heat = Mathf.Clamp(NerfHandler.Global_Heat - BetterJackhammer_Settings.Heat_Capacity * BetterJackhammer_Settings.Shotgun_Shot_Cooling / (float)(1 + MonoSingleton<GunControl>.Instance.dualWieldCount), 0f, BetterJackhammer_Settings.Heat_Capacity);
		}
	}
}