Decompiled source of Atlyss Anti Crasher v1.0.0

atlyss-anti-crasher.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("atlyss-anti-crasher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("atlyss-anti-crasher")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d2fd8785-e57d-4450-a535-50a2bf82f10d")]
[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 AtlyssAntiCrasher;

public static class Globals
{
	public const string pluginGuild = "fleshslushie.atlyss.atlyssanticrasher";

	public const string pluginName = "atlyssanticrasher";

	public const string pluginVersion = "1.0.0";

	public static List<PlayerInventory> dropCooldowns = new List<PlayerInventory>();
}
public static class Hooks
{
	public static bool PlayerInventory_UserCode_Cmd_DropItem_Patched(PlayerInventory __instance)
	{
		bool flag = false;
		for (int i = 0; i < Globals.dropCooldowns.Count; i++)
		{
			if ((Object)(object)Globals.dropCooldowns[i] == (Object)(object)__instance)
			{
				flag = true;
			}
		}
		if (flag)
		{
			return false;
		}
		Globals.dropCooldowns.Add(__instance);
		new Thread((ThreadStart)delegate
		{
			Thread.Sleep(200);
			for (int j = 0; j < Globals.dropCooldowns.Count; j++)
			{
				if ((Object)(object)Globals.dropCooldowns[j] == (Object)(object)__instance)
				{
					Globals.dropCooldowns.RemoveAt(j);
				}
			}
		}).Start();
		return true;
	}

	public static bool initHooks()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Expected O, but got Unknown
		Harmony val = new Harmony("fleshslushie.atlyss.atlyssanticrasher");
		MethodInfo methodInfo = AccessTools.Method(typeof(PlayerInventory), "UserCode_Cmd_DropItem__ItemData__Int32", (Type[])null, (Type[])null);
		MethodInfo methodInfo2 = AccessTools.Method(typeof(Hooks), "PlayerInventory_UserCode_Cmd_DropItem_Patched", (Type[])null, (Type[])null);
		val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		return true;
	}
}
[BepInPlugin("fleshslushie.atlyss.atlyssanticrasher", "atlyssanticrasher", "1.0.0")]
public class ModMenu : BaseUnityPlugin
{
	public void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"starting setup");
		Hooks.initHooks();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"hook patching completed");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"anti-crasher loaded");
	}
}