Decompiled source of ClaimChestOpen v1.0.0

plugins\cjayride-ClaimChestOpen\Cjayride.ClaimChestOpen.dll

Decompiled 4 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("assembly_valheim")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyCompany("Cjayride.ClaimChestOpen")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Cjayride.ClaimChestOpen")]
[assembly: AssemblyTitle("Cjayride.ClaimChestOpen")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 Cjayride.ClaimChestOpen
{
	[BepInPlugin("cjayride.ClaimChestOpen", "Claim Chest Open", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "cjayride.ClaimChestOpen";

		public const string PluginName = "Claim Chest Open";

		public const string PluginVersion = "1.0.0";

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("cjayride.ClaimChestOpen").PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Chests claim ownership on your client before they open, so a distant player in the same zone is not in the round trip.");
		}
	}
	[HarmonyPatch(typeof(Container), "Interact")]
	internal static class ClaimOnInteract
	{
		private static void Prefix(Container __instance, Humanoid character)
		{
			if (!((Object)(object)__instance == (Object)null) && !((Object)(object)character == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null) && !((Object)(object)character != (Object)(object)Player.m_localPlayer) && !((Object)(object)__instance.m_nview == (Object)null) && __instance.m_nview.IsValid() && !__instance.m_nview.IsOwner() && !((Object)(object)((Component)__instance).GetComponentInParent<Ship>() != (Object)null) && !((Object)(object)((Component)__instance).GetComponentInParent<Vagon>() != (Object)null))
			{
				__instance.m_nview.ClaimOwnership();
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}