Decompiled source of ZedDogChecker v1.0.3

ZedDogChecker.dll

Decompiled 6 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using ZedDogChecker;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ZedDogChecker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZedDogChecker")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7a9366ed-8863-4d7d-b0e3-1c0c4d60742d")]
[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")]
[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
internal class RoundManager_SpawnScrapInLevel_Patch
{
	private static void Postfix()
	{
		if ((Object)(object)ZedDogCheckerBase.Instance != (Object)null)
		{
			ZedDogCheckerBase.Instance.CheckForNewZedDogScrap();
		}
	}
}
namespace ZedDogChecker;

[BepInPlugin("Bottle.ZedDogChecker", "ZedDogChecker", "1.0.0")]
public class ZedDogCheckerBase : BaseUnityPlugin
{
	private const string modGUID = "Bottle.ZedDogChecker";

	private const string modName = "ZedDogChecker";

	private const string modVersion = "1.0.0";

	private readonly Harmony harmony = new Harmony("Bottle.ZedDogChecker");

	internal static ZedDogCheckerBase Instance;

	internal ManualLogSource mls;

	private List<GrabbableObject> ScrapBefore;

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		mls = Logger.CreateLogSource("Bottle.ZedDogChecker");
		mls.LogInfo((object)"ZedDogChecker Working i think maybe idk who knows");
		harmony.PatchAll();
	}

	public void SnapshotScrapBefore()
	{
		ScrapBefore = Object.FindObjectsOfType<GrabbableObject>().ToList();
	}

	public void CheckForNewZedDogScrap()
	{
		List<GrabbableObject> first = Object.FindObjectsOfType<GrabbableObject>().ToList();
		IEnumerable<GrabbableObject> source = first.Except(ScrapBefore ?? new List<GrabbableObject>());
		int num = source.Count((GrabbableObject scrap) => IsZedDogScrap(scrap));
		if (num > 0)
		{
			mls.LogInfo((object)$"a [ZedDog x{num}] Has Spawned :D");
			ShowZedDogNotification($"a [ZedDog x{num}] Has Spawned :D");
		}
		else
		{
			mls.LogInfo((object)"No [ZedDog] :(");
			ShowZedDogNotification("No [ZedDog] :(");
		}
	}

	private bool IsZedDogScrap(GrabbableObject scrap)
	{
		if ((Object)(object)scrap == (Object)null)
		{
			return false;
		}
		return ((Object)scrap).name?.Contains("ZeddogPlushie(Clone)") ?? false;
	}

	public void ShowZedDogNotification(string message)
	{
		HUDManager instance = HUDManager.Instance;
		if ((Object)(object)instance == (Object)null)
		{
			mls.LogWarning((object)"HudManager instance not found!");
			return;
		}
		MethodInfo method = typeof(HUDManager).GetMethod("DisplayGlobalNotification", BindingFlags.Instance | BindingFlags.NonPublic);
		if (method == null)
		{
			mls.LogWarning((object)"DisplayGlobalNotification method not found!");
			return;
		}
		method.Invoke(instance, new object[1] { message });
	}
}
[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
internal class RoundManager_SpawnScrapInLevel_Patch
{
	private static void Prefix()
	{
		if ((Object)(object)ZedDogCheckerBase.Instance != (Object)null)
		{
			ZedDogCheckerBase.Instance.SnapshotScrapBefore();
		}
	}

	private static void Postfix()
	{
		if ((Object)(object)ZedDogCheckerBase.Instance != (Object)null)
		{
			ZedDogCheckerBase.Instance.CheckForNewZedDogScrap();
		}
	}
}