Decompiled source of AutoShovel v1.0.0

plugins/AutoShovel.dll

Decompiled a day ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AutoShovel.Patches;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Unity.Netcode;
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("AutoShovel")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AutoShovel")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("537a58a3-321f-4251-b564-dc072302dea3")]
[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 AutoShovel
{
	[BepInPlugin("Yellowguy08.AutoShovel", "AutoShovel", "1.0.0")]
	public class AutoShovelBase : BaseUnityPlugin
	{
		private const string modGUID = "Yellowguy08.AutoShovel";

		private const string modName = "AutoShovel";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Yellowguy08.AutoShovel");

		private static AutoShovelBase Instance;

		public static ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Yellowguy08.AutoShovel");
			mls.LogInfo((object)"AutoShovel has awakened!");
			harmony.PatchAll(typeof(AutoShovelBase));
			harmony.PatchAll(typeof(TerminalPatch));
		}
	}
}
namespace AutoShovel.Patches
{
	[HarmonyPatch(typeof(Terminal), "Start")]
	internal class TerminalPatch
	{
		private enum Buyables
		{
			WalkieTalkie,
			Flashlight,
			Shovel,
			Lockpicker,
			ProFlashlight,
			StunGrendade,
			TZP,
			ZapGun,
			Jetpack,
			Boombox,
			ExtensionLadder,
			RadarBooster
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void AddShovel(Terminal __instance)
		{
			AutoShovelBase.mls.LogInfo((object)"Checking day and host.");
			StartOfRound val = Object.FindObjectOfType<StartOfRound>();
			if (((NetworkBehaviour)val).IsHost && val.gameStats.daysSpent == 0)
			{
				if (__instance.groupCredits == 0)
				{
					AutoShovelBase.mls.LogInfo((object)"Patch Already Loaded. Canceling Patch");
					return;
				}
				GameObject val2 = Object.Instantiate<GameObject>(__instance.buyableItemsList[2].spawnPrefab);
				val2.GetComponent<NetworkObject>().Spawn(false);
				GameObject val3 = Object.Instantiate<GameObject>(__instance.buyableItemsList[2].spawnPrefab);
				val3.GetComponent<NetworkObject>().Spawn(false);
				AutoShovelBase.mls.LogInfo((object)"Shovels Created");
				__instance.groupCredits = 0;
				AutoShovelBase.mls.LogInfo((object)"Credits set to 0");
			}
		}
	}
}