Decompiled source of NoUseCooldowns v1.0.1

Despardo6.NoUseCooldowns.dll

Decompiled 10 hours ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace NoUseCooldowns.NoCooldowns;

[BepInPlugin("Despardo6.NoUseCooldowns", "No use Cooldowns", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private const string PLUGIN_GUID = "Despardo6.NoUseCooldowns";

	private const string PLUGIN_NAME = "No use Cooldowns";

	private const string PLUGIN_VERSION = "1.0.0";

	internal static ManualLogSource Log;

	private void Awake()
	{
		Log = ((BaseUnityPlugin)this).Logger;
		Harmony.CreateAndPatchAll(typeof(CooldownPatches), (string)null);
		Log.LogInfo((object)"No use Cooldowns v1.0.0 loaded!");
	}
}
internal static class CooldownPatches
{
	private static readonly List<string> NoisemakerItems = new List<string>
	{
		"Hairdryer", "Clown horn", "Airhorn", "Cash register", "Remote", "Pro-flashlight", "Flashlight", "Laser pointer", "Boombox", "Weed killer",
		"Radar-booster"
	};

	[HarmonyPatch(typeof(NoisemakerProp))]
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	private static void NoisemakerPropStartPatch(NoisemakerProp __instance)
	{
		if (NoisemakerItems.Contains(((GrabbableObject)__instance).itemProperties.itemName))
		{
			((GrabbableObject)__instance).useCooldown = 0f;
			Plugin.Log.LogDebug((object)("Removed cooldown from: " + ((GrabbableObject)__instance).itemProperties.itemName));
		}
	}

	[HarmonyPatch(typeof(InteractTrigger))]
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	private static void InteractTriggerStartPatch(InteractTrigger __instance)
	{
		__instance.cooldownTime = 0f;
		Plugin.Log.LogDebug((object)("Removed cooldown from: " + ((Object)__instance).name));
	}
}