Decompiled source of SleepWell v1.0.1

plugins/SleepWell.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
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: AssemblyTitle("SleepWell")]
[assembly: AssemblyDescription("Changes the sleep prompt to ZZZzzz...")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Omnivore")]
[assembly: AssemblyProduct("SleepWell")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyMetadata("dependencies", "denikson-BepInExPack_Valheim-5.4.2332")]
[assembly: ComVisible(false)]
[assembly: Guid("b54fff0c-5dca-4d6d-8899-c3478b85529f")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace SleepWell
{
	public static class PluginInfo
	{
		public const string PluginGUID = "b54fff0c-5dca-4d6d-8899-c3478b85529f";

		public const string PluginName = "SleepWell";

		public const string PluginVersion = "1.0.1";

		public const string PluginDescription = "Changes the sleep prompt to ZZZzzz...";

		public const string PluginDependencies = "denikson-BepInExPack_Valheim-5.4.2332";
	}
	[BepInPlugin("b54fff0c-5dca-4d6d-8899-c3478b85529f", "SleepWell", "1.0.1")]
	public class SleepWell : BaseUnityPlugin
	{
		[HarmonyPatch]
		internal class FixSleepText
		{
			[HarmonyPrefix]
			[HarmonyPatch(typeof(SleepText), "OnEnable")]
			private static void SleepText_OnEnable(SleepText __instance)
			{
				if (__instance.m_textField.text.StartsWith("ZZZZZ"))
				{
					__instance.m_textField.text = "ZZZzzz...";
				}
			}
		}

		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("se.omnivore.valheim.sleepwell").PatchAll();
			Debug.Log((object)"SleepWell v1.0.1 has awakened.");
		}
	}
}