Decompiled source of StaffBlocker v1.0.0

StaffBlockerMod v1.0.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using StaffBlockerMod;
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("StaffBlockerMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StaffBlockerMod")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1fc4bfa8-50bc-4552-88e8-8e67fb3f192a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[HarmonyPatch(typeof(ItemStaffVoid), "CastSpell")]
public class VoidPatch
{
	private static bool Prefix()
	{
		if (!StaffBlocker.Enabled.Value)
		{
			return true;
		}
		if (StaffBlocker.BlockVoid.Value)
		{
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(ItemStaffZeroGravity), "CastSpell")]
public class ZeroGravityPatch
{
	private static bool Prefix()
	{
		if (!StaffBlocker.Enabled.Value)
		{
			return true;
		}
		if (StaffBlocker.BlockZeroGravity.Value)
		{
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(ItemStaffTorque), "CastSpell")]
public class TorquePatch
{
	private static bool Prefix()
	{
		if (!StaffBlocker.Enabled.Value)
		{
			return true;
		}
		if (StaffBlocker.BlockTorque.Value)
		{
			return false;
		}
		return true;
	}
}
namespace StaffBlockerMod;

[BepInPlugin("staffblocker.mod", "Staff Blocker", "2.0.0")]
public class StaffBlocker : BaseUnityPlugin
{
	public static StaffBlocker Instance;

	private Harmony harmony;

	private REPOPopupPage page;

	public static ConfigEntry<KeyCode> MenuKey;

	public static ConfigEntry<bool> Enabled;

	public static ConfigEntry<bool> English;

	public static ConfigEntry<bool> BlockLobby;

	public static ConfigEntry<bool> BlockShop;

	public static ConfigEntry<bool> BlockGame;

	public static ConfigEntry<bool> BlockVoid;

	public static ConfigEntry<bool> BlockZeroGravity;

	public static ConfigEntry<bool> BlockTorque;

	private void Awake()
	{
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Expected O, but got Unknown
		Instance = this;
		MenuKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "MenuKey", (KeyCode)288, "Open menu key");
		Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, (ConfigDescription)null);
		English = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "English", false, (ConfigDescription)null);
		BlockLobby = ((BaseUnityPlugin)this).Config.Bind<bool>("Location", "Lobby", false, (ConfigDescription)null);
		BlockShop = ((BaseUnityPlugin)this).Config.Bind<bool>("Location", "Shop", false, (ConfigDescription)null);
		BlockGame = ((BaseUnityPlugin)this).Config.Bind<bool>("Location", "Game", true, (ConfigDescription)null);
		BlockVoid = ((BaseUnityPlugin)this).Config.Bind<bool>("Staffs", "Void", true, (ConfigDescription)null);
		BlockZeroGravity = ((BaseUnityPlugin)this).Config.Bind<bool>("Staffs", "ZeroGravity", true, (ConfigDescription)null);
		BlockTorque = ((BaseUnityPlugin)this).Config.Bind<bool>("Staffs", "Torque", true, (ConfigDescription)null);
		harmony = new Harmony("staffblocker.mod");
		harmony.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Staff Blocker Loaded");
	}

	private void Update()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyDown(MenuKey.Value) && (Object)(object)page != (Object)null)
		{
			page.OpenPage(true);
		}
	}

	private void CreateMenu()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		page = MenuAPI.CreateREPOPopupPage("Staff Blocker", true, false, 5f, (Vector2?)null);
		MenuAPI.AddElementToEscapeMenu((BuilderDelegate)delegate(Transform parent)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			MenuAPI.CreateREPOButton("Staff Blocker", (Action)delegate
			{
				page.OpenPage(true);
			}, parent, default(Vector2));
		});
	}

	private void OnDestroy()
	{
		Harmony obj = harmony;
		if (obj != null)
		{
			obj.UnpatchSelf();
		}
	}
}