Decompiled source of YAPYAPHostOnly v1.0.7

BepInEx/plugins/HostOnlyInteractions.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Mirror;
using UnityEngine;
using YAPYAP;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("HostOnlyInteractions")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HostOnlyInteractions")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("78b55b01-e463-4ee5-a0b9-790510a2f949")]
[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(TeleportDungeonCircle), "CanInteract")]
public static class TeleportDungeonCirclePatch
{
	public static void Postfix(NetworkIdentity identity, ref bool __result)
	{
		if ((Object)(object)identity == (Object)null || NetworkServer.localConnection == null || (object)identity.connectionToClient != NetworkServer.localConnection)
		{
			__result = false;
		}
	}
}
[HarmonyPatch(typeof(TeleportAstralCircle), "CanInteract")]
public static class TeleportAstralCirclePatch
{
	[HarmonyPostfix]
	private static void Postfix(NetworkIdentity identity, ref bool __result)
	{
		if ((Object)(object)identity == (Object)null || NetworkServer.localConnection == null || (object)identity.connectionToClient != NetworkServer.localConnection)
		{
			__result = false;
		}
	}
}
namespace Xemotal;

[BepInPlugin("com.xemotal.hostonlyshop", "Xemotal Host Only Shop", "1.0.0")]
public class HostOnlyShop : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("com.xemotal.hostonlyshop");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Xemotal Host Only Shop chargé !");
	}
}
[HarmonyPatch(typeof(Shop))]
internal static class ShopHostOnlyPatches
{
	[HarmonyPatch("PurchaseItem")]
	[HarmonyPrefix]
	private static bool PurchaseItemPrefix(Interactable item, NetworkIdentity identity)
	{
		return IsHostPlayer(identity);
	}

	[HarmonyPatch("OnTryRestock")]
	[HarmonyPrefix]
	private static bool OnTryRestockPrefix(Interactable interactable, NetworkIdentity identity)
	{
		return IsHostPlayer(identity);
	}

	[HarmonyPatch("OnTrySellItem")]
	[HarmonyPrefix]
	private static bool OnTrySellItemPrefix(Interactable interactable, NetworkIdentity identity)
	{
		return IsHostPlayer(identity);
	}

	private static bool IsHostPlayer(NetworkIdentity identity)
	{
		if ((Object)(object)identity == (Object)null)
		{
			return false;
		}
		return NetworkServer.active && NetworkClient.active && identity.isLocalPlayer;
	}
}