Decompiled source of ExampleValheimMod v1.0.1

plugins/ExampleValheimMod.dll

Decompiled 2 months 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 BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("assembly_guiutils")]
[assembly: IgnoresAccessChecksTo("assembly_utils")]
[assembly: IgnoresAccessChecksTo("assembly_valheim")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ExampleValheimMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+bde6f7d354730cabf53e8c38a4cee9f37d50fa71")]
[assembly: AssemblyProduct("ExampleValheimMod")]
[assembly: AssemblyTitle("ExampleValheimMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 ExampleValheimMod
{
	[BepInPlugin("ExampleValheimMod", "ExampleValheimMod", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Player), "OnSpawned")]
		private static class Player_OnSpawned_Patch
		{
			private static void Postfix(Player __instance)
			{
				if (_greetOnSpawn != null && _greetOnSpawn.Value)
				{
					Log.LogInfo((object)("Welcome back, " + __instance.GetPlayerName() + "! (from ExampleValheimMod)"));
				}
			}
		}

		internal static ManualLogSource Log;

		private static ConfigEntry<bool> _greetOnSpawn;

		private readonly Harmony _harmony = new Harmony("ExampleValheimMod");

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			_greetOnSpawn = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "GreetOnSpawn", true, "Log a friendly message every time the local player spawns.");
			_harmony.PatchAll();
			Log.LogInfo((object)"ExampleValheimMod v1.0.1 loaded.");
		}

		private void OnDestroy()
		{
			_harmony.UnpatchSelf();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ExampleValheimMod";

		public const string PLUGIN_NAME = "ExampleValheimMod";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}