Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of WorldSaveMuzzler v1.0.0
WorldSaveMuzzler.dll
Decompiled 4 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("WorldSaveMuzzler")] [assembly: AssemblyDescription("Client-side HUD quality-of-life mod for Valheim that relocates or mutes intrusive center-screen world save countdown warnings and notifications. For more information, visit https://github.com/dreamwraith")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("dreamwraith (https://github.com/dreamwraith)")] [assembly: AssemblyProduct("WorldSaveMuzzler")] [assembly: AssemblyCopyright("Copyright © 2026 dreamwraith")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("adc0e7a5-cb24-4672-8e4a-46b79720a4eb")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [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.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] [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; } } [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 WorldSaveMuzzler { [BepInPlugin("dreamwraith.WorldSaveMuzzler", "WorldSaveMuzzler", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public enum SaveNoticeMode { RelocateToTopLeft, Mute, Native } [HarmonyPatch(typeof(MessageHud))] internal static class MessageHudPatch { [HarmonyPrefix] [HarmonyPatch("ShowMessage")] private static bool ShowMessagePrefix(ref MessageType type, ref string text) { if (NoticeMode == null || NoticeMode.Value == SaveNoticeMode.Native) { return true; } if ((int)type != 2 || string.IsNullOrEmpty(text)) { return true; } if (IsWorldSaveMessage(text)) { if (NoticeMode.Value == SaveNoticeMode.Mute) { return false; } type = (MessageType)1; } return true; } private static bool IsWorldSaveMessage(string text) { if (text.Contains("$msg_worldsave")) { return true; } if (Localization.instance != null) { string value = Localization.instance.Localize("$msg_worldsavewarning"); if (!string.IsNullOrEmpty(value) && text.Contains(value)) { return true; } string value2 = Localization.instance.Localize("$msg_worldsaved"); if (!string.IsNullOrEmpty(value2) && text.Contains(value2)) { return true; } } if (text.IndexOf("world save", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("saving world", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } return false; } } public const string ModGUID = "dreamwraith.WorldSaveMuzzler"; public const string ModName = "WorldSaveMuzzler"; public const string ModVersion = "1.0.0"; public const string CommunityPatchExtrasGUID = "MidnightsFX.ValheimCommunityPatchExtras"; private static readonly Version MinSupersededExtrasVersion = new Version(0, 28, 0); internal static ManualLogSource Log = null; private Harmony? _harmony; public static ConfigEntry<SaveNoticeMode> NoticeMode = null; internal static Plugin? Instance { get; private set; } private void Awake() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; if (IsCommunityPatchExtrasSuperseding(out Version detectedVersion)) { Log.LogWarning((object)(string.Format("{0} v{1} is self-disabling: Valheim Community Patch Extras v{2} ", "WorldSaveMuzzler", "1.0.0", detectedVersion) + $"(> {MinSupersededExtrasVersion}) is installed, which natively handles world save notifications.")); ((Behaviour)this).enabled = false; return; } NoticeMode = ((BaseUnityPlugin)this).Config.Bind<SaveNoticeMode>("1 - General", "WorldSaveNoticeMode", SaveNoticeMode.RelocateToTopLeft, new ConfigDescription("Controls how autosave countdown warnings and completion notifications are displayed.\nRelocateToTopLeft moves them to the subtle top-left corner feed (default).\nMute hides them completely.\nNative leaves them centered across the screen.", (AcceptableValueBase)null, new object[1] { new ConfigurationManagerAttributes { IsAdvanced = false } })); _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "dreamwraith.WorldSaveMuzzler"); Log.LogInfo((object)"WorldSaveMuzzler v1.0.0 loaded successfully."); } private static bool IsCommunityPatchExtrasSuperseding(out Version? detectedVersion) { detectedVersion = null; if (Chainloader.PluginInfos == null) { return false; } foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { if (string.Equals(pluginInfo.Key, "MidnightsFX.ValheimCommunityPatchExtras", StringComparison.OrdinalIgnoreCase)) { PluginInfo value = pluginInfo.Value; object obj; if (value == null) { obj = null; } else { BepInPlugin metadata = value.Metadata; obj = ((metadata != null) ? metadata.Version : null); } detectedVersion = (Version?)obj; if (detectedVersion != null && detectedVersion > MinSupersededExtrasVersion) { return true; } } } return false; } private void OnDestroy() { Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } internal class ConfigurationManagerAttributes { public bool? IsAdvanced { get; set; } } internal static class VersionInfo { public const string Version = "1.0.0"; } }