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.2.0
WorldSaveMuzzler.dll
Decompiled 2 weeks agousing 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.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using WorldSaveMuzzler.Configuration; using WorldSaveMuzzler.Notices; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("DreamWraith (https://github.com/dreamwraith)")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright (c) 2026 DreamWraith")] [assembly: AssemblyDescription("Client-side HUD quality-of-life mod for Valheim that relocates or mutes intrusive center-screen world save countdown warnings and notifications.")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0+b7e191779f36bfb1f605dfa96cb6015dc4c4b3f7")] [assembly: AssemblyProduct("WorldSaveMuzzler")] [assembly: AssemblyTitle("WorldSaveMuzzler")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/dreamwraith/Valheim-WorldSaveMuzzler")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.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.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string ModGUID = "dreamwraith.WorldSaveMuzzler"; public const string ModName = "WorldSaveMuzzler"; public const string ModVersion = "1.2.0"; public const string CommunityPatchExtrasGUID = "MidnightsFX.ValheimCommunityPatchExtras"; internal static ManualLogSource Log; private Harmony? _harmony; internal static Plugin? Instance { get; private set; } private void Awake() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 Instance = this; Log = ((BaseUnityPlugin)this).Logger; if (Chainloader.PluginInfos.ContainsKey("MidnightsFX.ValheimCommunityPatchExtras")) { Log.LogWarning((object)"WorldSaveMuzzler v1.2.0 is self-disabling: Valheim Community Patch Extras is installed, which natively handles world save notifications."); ((Behaviour)this).enabled = false; return; } ModConfig.Initialize(((BaseUnityPlugin)this).Config); if ((int)SystemInfo.graphicsDeviceType != 4) { _harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "dreamwraith.WorldSaveMuzzler"); Log.LogInfo((object)"WorldSaveMuzzler v1.2.0 loaded successfully."); } } private void OnDestroy() { Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } internal static class VersionInfo { public const string Version = "1.2.0"; } } namespace WorldSaveMuzzler.Patches { [HarmonyPatch(typeof(MessageHud))] internal static class MessageHudPatches { [HarmonyPrefix] [HarmonyPatch("ShowMessage")] private static bool ShowMessagePrefix(ref MessageType type, ref string text) { return SaveNoticeManager.HandleShowMessage(ref type, ref text); } } } namespace WorldSaveMuzzler.Notices { internal static class SaveNoticeManager { private const string WorldSavedKey = "$msg_worldsaved"; private const string WorldSaveWarningKey = "$msg_worldsavewarning"; public static bool HandleShowMessage(ref MessageType type, ref string text) { if (ModConfig.NoticeMode.Value == SaveNoticeMode.Native) { return true; } if (ModConfig.NoticeMode.Value == SaveNoticeMode.Mute && !string.IsNullOrEmpty(text) && HasMessageKey(text, "$msg_worldsaved")) { return false; } if ((int)type != 2 || string.IsNullOrEmpty(text)) { return true; } if (IsWorldSaveMessage(text)) { if (ModConfig.NoticeMode.Value == SaveNoticeMode.Mute) { return false; } type = (MessageType)1; } return true; } private static bool IsWorldSaveMessage(string text) { if (HasMessageKey(text, "$msg_worldsavewarning") || HasMessageKey(text, "$msg_worldsaved")) { 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; } private static bool HasMessageKey(string text, string key) { if (text.StartsWith(key, StringComparison.Ordinal)) { if (text.Length != key.Length) { return text[key.Length] == ' '; } return true; } return false; } } } namespace WorldSaveMuzzler.Configuration { public enum SaveNoticeMode { RelocateToTopLeft, Mute, Native } internal static class ModConfig { public static ConfigEntry<SaveNoticeMode> NoticeMode; public static void Initialize(ConfigFile config) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown NoticeMode = 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, Array.Empty<object>())); } } }