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 AmnesiaMead v1.0.0
plugins/AmnesiaMead/AmnesiaMead.dll
Decompiled 8 hours agousing System; using System.Collections; using System.Collections.Generic; 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.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("AmnesiaMead")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.7.0")] [assembly: AssemblyInformationalVersion("1.0.7+3ebee753e8d1d0b4a53c5db079afd3c641075c73")] [assembly: AssemblyProduct("ValheimMod-AmnesiaMead")] [assembly: AssemblyTitle("AmnesiaMead")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.7.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 AmnesiaMead { [BepInPlugin("com.archonite.amnesiamead", "Amnesia Mead", "1.0.0")] public class AmnesiaMeadPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(Terminal), "InitTerminal")] public static class TerminalInitPatch { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__0_0; internal void <Postfix>b__0_0(ConsoleEventArgs args) { Game instance = Game.instance; PlayerProfile val = ((instance != null) ? instance.GetPlayerProfile() : null); if (val == null) { args.Context.AddString("Error: Load into a world first."); return; } int num = 0; FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerProfile), "m_usedCheats"); if (fieldInfo != null) { fieldInfo.SetValue(val, false); } FieldInfo fieldInfo2 = AccessTools.Field(typeof(Terminal), "m_usedCheats"); if (fieldInfo2 != null) { fieldInfo2.SetValue(null, false); } FieldInfo fieldInfo3 = AccessTools.Field(typeof(PlayerProfile), "m_playerStats"); if (fieldInfo3 != null) { object value = fieldInfo3.GetValue(val); if (value != null) { FieldInfo fieldInfo4 = AccessTools.Field(value.GetType(), "m_stats"); if (fieldInfo4 != null && fieldInfo4.GetValue(value) is IDictionary dictionary) { List<object> list = new List<object>(); foreach (object key in dictionary.Keys) { if (key != null && key.ToString().Equals("Cheats", StringComparison.OrdinalIgnoreCase)) { list.Add(key); } } foreach (object item in list) { dictionary[item] = 0f; num++; } } } } FieldInfo fieldInfo5 = AccessTools.Field(typeof(PlayerProfile), "m_knownCommands"); if (fieldInfo5 != null && fieldInfo5.GetValue(val) is IDictionary dictionary2) { dictionary2.Clear(); num++; } FieldInfo fieldInfo6 = AccessTools.Field(typeof(PlayerProfile), "m_itemPickupStats"); if (fieldInfo6 != null && fieldInfo6.GetValue(val) is IDictionary dictionary3) { List<object> list2 = new List<object>(); foreach (object key2 in dictionary3.Keys) { if (key2 != null && key2.ToString().StartsWith("Cheat", StringComparison.OrdinalIgnoreCase)) { list2.Add(key2); } } foreach (object item2 in list2) { dictionary3.Remove(item2); num++; } } Game.instance.SavePlayerProfile(true); if (num > 0) { args.Context.AddString("Success! Reset Cheats stat to 0, cleared command history, and saved character profile."); } else { args.Context.AddString("No cheat entries were found to clear."); } } } public static void Postfix() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown object obj = <>c.<>9__0_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { Game instance = Game.instance; PlayerProfile val2 = ((instance != null) ? instance.GetPlayerProfile() : null); if (val2 == null) { args.Context.AddString("Error: Load into a world first."); } else { int num = 0; FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerProfile), "m_usedCheats"); if (fieldInfo != null) { fieldInfo.SetValue(val2, false); } FieldInfo fieldInfo2 = AccessTools.Field(typeof(Terminal), "m_usedCheats"); if (fieldInfo2 != null) { fieldInfo2.SetValue(null, false); } FieldInfo fieldInfo3 = AccessTools.Field(typeof(PlayerProfile), "m_playerStats"); if (fieldInfo3 != null) { object value = fieldInfo3.GetValue(val2); if (value != null) { FieldInfo fieldInfo4 = AccessTools.Field(value.GetType(), "m_stats"); if (fieldInfo4 != null && fieldInfo4.GetValue(value) is IDictionary dictionary) { List<object> list = new List<object>(); foreach (object key in dictionary.Keys) { if (key != null && key.ToString().Equals("Cheats", StringComparison.OrdinalIgnoreCase)) { list.Add(key); } } foreach (object item in list) { dictionary[item] = 0f; num++; } } } } FieldInfo fieldInfo5 = AccessTools.Field(typeof(PlayerProfile), "m_knownCommands"); if (fieldInfo5 != null && fieldInfo5.GetValue(val2) is IDictionary dictionary2) { dictionary2.Clear(); num++; } FieldInfo fieldInfo6 = AccessTools.Field(typeof(PlayerProfile), "m_itemPickupStats"); if (fieldInfo6 != null && fieldInfo6.GetValue(val2) is IDictionary dictionary3) { List<object> list2 = new List<object>(); foreach (object key2 in dictionary3.Keys) { if (key2 != null && key2.ToString().StartsWith("Cheat", StringComparison.OrdinalIgnoreCase)) { list2.Add(key2); } } foreach (object item2 in list2) { dictionary3.Remove(item2); num++; } } Game.instance.SavePlayerProfile(true); if (num > 0) { args.Context.AddString("Success! Reset Cheats stat to 0, cleared command history, and saved character profile."); } else { args.Context.AddString("No cheat entries were found to clear."); } } }; <>c.<>9__0_0 = val; obj = (object)val; } new ConsoleCommand("amnesia-cheats", "Resets the Cheats stat, command history, and item stats to 0", (ConsoleEvent)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } } public static ManualLogSource Log; private static AmnesiaMeadPlugin Instance; private readonly Harmony harmony = new Harmony("com.archonite.amnesiamead"); private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Instance = this; harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"AmnesiaMead has loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "AmnesiaMead"; public const string PLUGIN_NAME = "ValheimMod-AmnesiaMead"; public const string PLUGIN_VERSION = "1.0.7"; } }