Decompiled source of InfiniteSprayCans v1.0.2

Infinite Spray Cans.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using InfiniteSprayCans.Patches;
using LethalConfig;
using LethalConfig.ConfigItems;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Infinite Spray Cans")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Infinite Spray Cans")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("49903d90-15e8-4e31-9b8b-f7ea74cb0b94")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace InfiniteSprayCans
{
	[BepInPlugin("Jacky.InfiniteSprayCans", "InfiniteSprayCans", "1.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class InfiniteSprayCans : BaseUnityPlugin
	{
		private const string modGUID = "Jacky.InfiniteSprayCans";

		private const string modName = "InfiniteSprayCans";

		private const string modVersion = "1.0.2";

		private readonly Harmony harmony = new Harmony("Jacky.InfiniteSprayCans");

		public static InfiniteSprayCans Instance;

		internal ManualLogSource logger;

		public ConfigEntry<bool> isInfiniteTankEnabledEntry;

		public ConfigEntry<bool> isNoShakeEnabledEntry;

		private void Awake()
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger.LogInfo((object)"InfiniteSprayCas mod has awaken");
			isInfiniteTankEnabledEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Infinite Spray Cans Config", "Enable Infinite Spray Can Tank", true, "This enables the spray can to be used infinitely!");
			isNoShakeEnabledEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Infinite Spray Cans Config", "Enable No Shake Spray Can", true, "This enables the spray can to be used without needing to shake it!");
			BaseConfigItem val = (BaseConfigItem)new BoolCheckBoxConfigItem(isInfiniteTankEnabledEntry, false);
			BaseConfigItem val2 = (BaseConfigItem)new BoolCheckBoxConfigItem(isNoShakeEnabledEntry, false);
			LethalConfigManager.AddConfigItem(val);
			LethalConfigManager.AddConfigItem(val2);
			harmony.PatchAll(typeof(SprayPaintItemPatch));
		}
	}
}
namespace InfiniteSprayCans.Patches
{
	[HarmonyPatch(typeof(SprayPaintItem))]
	internal class SprayPaintItemPatch
	{
		[HarmonyPatch("LateUpdate")]
		[HarmonyPostfix]
		private static void infiniteSprayCansPatch(ref float ___sprayCanTank, ref float ___sprayCanShakeMeter)
		{
			if (InfiniteSprayCans.Instance.isInfiniteTankEnabledEntry.Value)
			{
				___sprayCanTank = 1f;
			}
			if (InfiniteSprayCans.Instance.isNoShakeEnabledEntry.Value)
			{
				___sprayCanShakeMeter = 1f;
			}
		}
	}
}