Decompiled source of GrandMarketLock v0.2.1

plugins/GrandMarketLock.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("GrandMarketLock")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+03c25e9c7b7e0e700e191cf2076f326a8a71f95f")]
[assembly: AssemblyProduct("GrandMarketLock")]
[assembly: AssemblyTitle("GrandMarketLock")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace GrandMarketLock
{
	[BepInPlugin("streamiapp.grandmarket.marketlock", "Grand Market Lock", "0.2.1")]
	public sealed class MarketLockPlugin : BaseUnityPlugin
	{
		public const string PluginGuid = "streamiapp.grandmarket.marketlock";

		public const string PluginName = "Grand Market Lock";

		public const string PluginVersion = "0.2.1";

		internal static ConfigEntry<bool> Enabled;

		internal static ConfigEntry<float> CenterX;

		internal static ConfigEntry<float> CenterZ;

		internal static ConfigEntry<float> Radius;

		internal static ConfigEntry<string> DeniedMessage;

		internal static ConfigEntry<int> ConfigSchema;

		private Harmony _harmony;

		private static float _lastMessage;

		private void Awake()
		{
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Market", "Enabled", true, "Protect the Grand Market display area.");
			CenterX = ((BaseUnityPlugin)this).Config.Bind<float>("Market", "Center X", -841.32f, "Grand Market center X.");
			CenterZ = ((BaseUnityPlugin)this).Config.Bind<float>("Market", "Center Z", 400.26f, "Grand Market center Z.");
			Radius = ((BaseUnityPlugin)this).Config.Bind<float>("Market", "Radius", 120f, "Horizontal protected radius in meters.");
			DeniedMessage = ((BaseUnityPlugin)this).Config.Bind<string>("Market", "Denied message", "Grand Market: objeto de exhibición", "Message shown for blocked interactions.");
			ConfigSchema = ((BaseUnityPlugin)this).Config.Bind<int>("Internal", "Config schema", 1, "Internal migration marker.");
			if (ConfigSchema.Value < 2)
			{
				Radius.Value = 120f;
				ConfigSchema.Value = 2;
				((BaseUnityPlugin)this).Config.Save();
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Migrated legacy GrandMarketLock config to 120m protected radius.");
			}
			_harmony = new Harmony("streamiapp.grandmarket.marketlock");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)$"Grand Market Lock active at ({CenterX.Value:F1}, {CenterZ.Value:F1}), r={Radius.Value:F1}m");
		}

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

		internal static bool Inside(Component c)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)c != (Object)null)
			{
				return Inside(c.transform.position);
			}
			return false;
		}

		internal static bool Inside(Vector3 p)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (Enabled == null || !Enabled.Value)
			{
				return false;
			}
			float num = p.x - CenterX.Value;
			float num2 = p.z - CenterZ.Value;
			return num * num + num2 * num2 <= Radius.Value * Radius.Value;
		}

		internal static bool IsProtectedPiece(ZDO zdo)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			if (zdo == null || !Inside(zdo.GetPosition()))
			{
				return false;
			}
			if ((Object)(object)ZNet.instance == (Object)null || !ZNet.instance.IsServer())
			{
				return false;
			}
			if ((Object)(object)ZNetScene.instance == (Object)null)
			{
				return false;
			}
			GameObject prefab = ZNetScene.instance.GetPrefab(zdo.GetPrefab());
			if ((Object)(object)prefab != (Object)null)
			{
				return (Object)(object)prefab.GetComponent<Piece>() != (Object)null;
			}
			return false;
		}

		internal static bool BlockInteract(Component c, Humanoid user = null)
		{
			if (!Inside(c))
			{
				return false;
			}
			if ((Object)(object)user != (Object)null && (Object)(object)user == (Object)(object)Player.m_localPlayer && Time.time - _lastMessage > 1f)
			{
				_lastMessage = Time.time;
				((Character)user).Message((MessageType)2, DeniedMessage.Value, 0, (Sprite)null, false);
			}
			return true;
		}

		internal static void RemoveStationFromRegistries(CraftingStation station)
		{
			if (!Inside((Component)(object)station))
			{
				return;
			}
			station.m_discoverRange = 0f;
			station.m_rangeBuild = 0f;
			station.m_extraRangePerLevel = 0f;
			station.m_useDistance = 0f;
			string[] array = new string[2] { "m_allStations", "<Instances>k__BackingField" };
			foreach (string text in array)
			{
				try
				{
					object obj = AccessTools.Field(typeof(CraftingStation), text)?.GetValue(null);
					obj?.GetType().GetMethod("Remove", new Type[1] { typeof(CraftingStation) })?.Invoke(obj, new object[1] { station });
				}
				catch
				{
				}
			}
		}

		internal static void FilterStationList(object[] args)
		{
			if (args == null)
			{
				return;
			}
			for (int i = 0; i < args.Length; i++)
			{
				if (!(args[i] is IList list))
				{
					continue;
				}
				for (int num = list.Count - 1; num >= 0; num--)
				{
					object? obj = list[num];
					CraftingStation val = (CraftingStation)((obj is CraftingStation) ? obj : null);
					if (val != null && Inside((Component)(object)val))
					{
						list.RemoveAt(num);
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(CraftingStation), "Start")]
	internal static class CraftingStationStartPatch
	{
		private static void Postfix(CraftingStation __instance)
		{
			MarketLockPlugin.RemoveStationFromRegistries(__instance);
		}
	}
	[HarmonyPatch(typeof(CraftingStation), "Interact")]
	internal static class CraftingStationInteractPatch
	{
		private static bool Prefix(CraftingStation __instance, Humanoid __0, ref bool __result)
		{
			if (!MarketLockPlugin.BlockInteract((Component)(object)__instance, __0))
			{
				return true;
			}
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(CraftingStation), "UseItem")]
	internal static class CraftingStationUseItemPatch
	{
		private static bool Prefix(CraftingStation __instance, Humanoid __0, ref bool __result)
		{
			if (!MarketLockPlugin.BlockInteract((Component)(object)__instance, __0))
			{
				return true;
			}
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(CraftingStation), "HaveBuildStationInRange")]
	internal static class HaveBuildStationInRangePatch
	{
		private static void Postfix(ref CraftingStation __result)
		{
			if ((Object)(object)__result != (Object)null && MarketLockPlugin.Inside((Component)(object)__result))
			{
				__result = null;
			}
		}
	}
	[HarmonyPatch(typeof(CraftingStation), "FindClosestStationInRange")]
	internal static class FindClosestStationInRangePatch
	{
		private static void Postfix(ref CraftingStation __result)
		{
			if ((Object)(object)__result != (Object)null && MarketLockPlugin.Inside((Component)(object)__result))
			{
				__result = null;
			}
		}
	}
	[HarmonyPatch(typeof(CraftingStation), "FindStationsInRange")]
	internal static class FindStationsInRangePatch
	{
		private static void Postfix(object[] __args)
		{
			MarketLockPlugin.FilterStationList(__args);
		}
	}
	internal static class SimpleBlock
	{
		internal static bool Prefix(Component __instance)
		{
			return !MarketLockPlugin.Inside(__instance);
		}

		internal static bool PrefixUser(Component __instance, Humanoid __0, ref bool __result)
		{
			if (!MarketLockPlugin.BlockInteract(__instance, __0))
			{
				return true;
			}
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(Feast), "Interact")]
	internal static class FeastInteractPatch
	{
		private static bool Prefix(Feast __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(Feast), "UseItem")]
	internal static class FeastUsePatch
	{
		private static bool Prefix(Feast __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(Feast), "RPC_TryEat")]
	internal static class FeastRpcPatch
	{
		private static bool Prefix(Feast __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Beehive), "Interact")]
	internal static class BeehiveInteractPatch
	{
		private static bool Prefix(Beehive __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(Beehive), "UseItem")]
	internal static class BeehiveUsePatch
	{
		private static bool Prefix(Beehive __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(Beehive), "Extract")]
	internal static class BeehiveExtractPatch
	{
		private static bool Prefix(Beehive __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Beehive), "RPC_Extract")]
	internal static class BeehiveRpcPatch
	{
		private static bool Prefix(Beehive __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Fermenter), "Interact")]
	internal static class FermenterInteractPatch
	{
		private static bool Prefix(Fermenter __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(Fermenter), "UseItem")]
	internal static class FermenterUsePatch
	{
		private static bool Prefix(Fermenter __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(Fermenter), "RPC_AddItem")]
	internal static class FermenterAddPatch
	{
		private static bool Prefix(Fermenter __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Fermenter), "RPC_Tap")]
	internal static class FermenterTapPatch
	{
		private static bool Prefix(Fermenter __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(TeleportWorld), "Interact")]
	internal static class PortalInteractPatch
	{
		private static bool Prefix(TeleportWorld __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(TeleportWorld), "UseItem")]
	internal static class PortalUsePatch
	{
		private static bool Prefix(TeleportWorld __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(TeleportWorld), "Teleport")]
	internal static class PortalTeleportPatch
	{
		private static bool Prefix(TeleportWorld __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Bed), "Interact")]
	internal static class BedInteractPatch
	{
		private static bool Prefix(Bed __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(Bed), "UseItem")]
	internal static class BedUsePatch
	{
		private static bool Prefix(Bed __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(Bed), "RPC_SetOwner")]
	internal static class BedRpcSetOwnerPatch
	{
		private static bool Prefix(Bed __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Container), "Interact")]
	internal static class ContainerInteractPatch
	{
		private static bool Prefix(Container __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(Container), "UseItem")]
	internal static class ContainerUsePatch
	{
		private static bool Prefix(Container __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(Container), "RPC_RequestOpen")]
	internal static class ContainerOpenPatch
	{
		private static bool Prefix(Container __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(CookingStation), "Interact")]
	internal static class CookingInteractPatch
	{
		private static bool Prefix(CookingStation __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(CookingStation), "UseItem")]
	internal static class CookingUsePatch
	{
		private static bool Prefix(CookingStation __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(CookingStation), "OnAddFoodSwitch")]
	internal static class CookingFoodPatch
	{
		private static bool Prefix(CookingStation __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(CookingStation), "OnAddFuelSwitch")]
	internal static class CookingFuelPatch
	{
		private static bool Prefix(CookingStation __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(CookingStation), "RPC_AddItem")]
	internal static class CookingRpcItemPatch
	{
		private static bool Prefix(CookingStation __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(CookingStation), "RPC_AddFuel")]
	internal static class CookingRpcFuelPatch
	{
		private static bool Prefix(CookingStation __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Smelter), "OnAddOre")]
	internal static class SmelterOrePatch
	{
		private static bool Prefix(Smelter __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Smelter), "OnAddFuel")]
	internal static class SmelterFuelPatch
	{
		private static bool Prefix(Smelter __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Smelter), "OnEmpty")]
	internal static class SmelterEmptyPatch
	{
		private static bool Prefix(Smelter __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Smelter), "RPC_AddOre")]
	internal static class SmelterRpcOrePatch
	{
		private static bool Prefix(Smelter __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Smelter), "RPC_AddFuel")]
	internal static class SmelterRpcFuelPatch
	{
		private static bool Prefix(Smelter __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Smelter), "RPC_EmptyProcessed")]
	internal static class SmelterRpcEmptyPatch
	{
		private static bool Prefix(Smelter __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(SapCollector), "Interact")]
	internal static class SapInteractPatch
	{
		private static bool Prefix(SapCollector __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(SapCollector), "UseItem")]
	internal static class SapUsePatch
	{
		private static bool Prefix(SapCollector __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(SapCollector), "Extract")]
	internal static class SapExtractPatch
	{
		private static bool Prefix(SapCollector __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(SapCollector), "RPC_Extract")]
	internal static class SapRpcPatch
	{
		private static bool Prefix(SapCollector __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Incinerator), "OnIncinerate")]
	internal static class IncineratorUsePatch
	{
		private static bool Prefix(Incinerator __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Incinerator), "RPC_RequestIncinerate")]
	internal static class IncineratorRpcPatch
	{
		private static bool Prefix(Incinerator __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Barber), "Interact")]
	internal static class BarberInteractPatch
	{
		private static bool Prefix(Barber __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(Barber), "UseItem")]
	internal static class BarberUsePatch
	{
		private static bool Prefix(Barber __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(ItemStand), "Interact")]
	internal static class ItemStandInteractPatch
	{
		private static bool Prefix(ItemStand __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(ItemStand), "UseItem")]
	internal static class ItemStandUsePatch
	{
		private static bool Prefix(ItemStand __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(ItemStand), "RPC_DropItem")]
	internal static class ItemStandDropPatch
	{
		private static bool Prefix(ItemStand __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(ItemStand), "RPC_DestroyAttachment")]
	internal static class ItemStandDestroyAttachmentPatch
	{
		private static bool Prefix(ItemStand __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(ItemStand), "RPC_RequestOwn")]
	internal static class ItemStandRequestOwnPatch
	{
		private static bool Prefix(ItemStand __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(ArmorStand), "UseItem")]
	internal static class ArmorStandUsePatch
	{
		private static bool Prefix(ArmorStand __instance, Humanoid __0, ref bool __result)
		{
			return SimpleBlock.PrefixUser((Component)(object)__instance, __0, ref __result);
		}
	}
	[HarmonyPatch(typeof(ArmorStand), "RPC_DropItem")]
	internal static class ArmorStandDropPatch
	{
		private static bool Prefix(ArmorStand __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(ArmorStand), "RPC_DropItemByName")]
	internal static class ArmorStandDropItemByNamePatch
	{
		private static bool Prefix(ArmorStand __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(ArmorStand), "RPC_DestroyAttachment")]
	internal static class ArmorStandDestroyAttachmentPatch
	{
		private static bool Prefix(ArmorStand __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(ZDO), "SetOwner")]
	internal static class ProtectedPieceOwnershipPatch
	{
		private static void Prefix(ZDO __instance, ref long uid)
		{
			if (MarketLockPlugin.IsProtectedPiece(__instance))
			{
				long sessionID = ZDOMan.GetSessionID();
				if (sessionID != 0L)
				{
					uid = sessionID;
				}
			}
		}
	}
	[HarmonyPatch(typeof(Piece), "CanBeRemoved")]
	internal static class PieceRemovePatch
	{
		private static bool Prefix(Piece __instance, ref bool __result)
		{
			if (!MarketLockPlugin.Inside((Component)(object)__instance))
			{
				return true;
			}
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(WearNTear), "CanBeRemoved")]
	internal static class WearRemoveCheckPatch
	{
		private static bool Prefix(WearNTear __instance, ref bool __result)
		{
			if (!MarketLockPlugin.Inside((Component)(object)__instance))
			{
				return true;
			}
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(WearNTear), "Damage")]
	internal static class WearDamagePatch
	{
		private static bool Prefix(WearNTear __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(WearNTear), "RPC_Damage")]
	internal static class WearRpcDamagePatch
	{
		private static bool Prefix(WearNTear __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(WearNTear), "ApplyDamage")]
	internal static class WearApplyDamagePatch
	{
		private static bool Prefix(WearNTear __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(WearNTear), "Remove")]
	internal static class WearRemovePatch
	{
		private static bool Prefix(WearNTear __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(WearNTear), "RPC_Remove")]
	internal static class WearRpcRemovePatch
	{
		private static bool Prefix(WearNTear __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(WearNTear), "Destroy")]
	internal static class WearDestroyPatch
	{
		private static bool Prefix(WearNTear __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Destructible), "Damage")]
	internal static class DestructibleDamagePatch
	{
		private static bool Prefix(Destructible __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Destructible), "RPC_Damage")]
	internal static class DestructibleRpcDamagePatch
	{
		private static bool Prefix(Destructible __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Destructible), "DestroyNow")]
	internal static class DestructibleDestroyNowPatch
	{
		private static bool Prefix(Destructible __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
	[HarmonyPatch(typeof(Destructible), "Destroy")]
	internal static class DestructibleDestroyPatch
	{
		private static bool Prefix(Destructible __instance)
		{
			return SimpleBlock.Prefix((Component)(object)__instance);
		}
	}
}