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 AchievementsWithCheats v1.1.1
plugins/AchievementsWithCheats/AchievementsWithCheats.dll
Decompiled 6 days agousing System; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: AssemblyCompany("Sfantul")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyVersion("1.1.1.0")] namespace AchievementsWithCheats; [BepInDependency("com.normalachievements.valheim", "1.0.2")] [BepInPlugin("sfantul.achievementswithcheats", "Achievements With Cheats", "1.1.1")] public sealed class Plugin : BaseUnityPlugin { private Harmony harmony; private static bool bypassActive; private void Awake() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Expected O, but got Unknown try { BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; MethodInfo method = typeof(Achievements).GetMethod("IsCheatedAtAll", bindingAttr, null, Type.EmptyTypes, null); MethodInfo method2 = typeof(PlayerProfile).GetMethod("get_s_bypassCheatChecks", bindingAttr, null, Type.EmptyTypes, null); MethodInfo[] array = new MethodInfo[2] { method, method2 }; foreach (MethodInfo methodInfo in array) { if (methodInfo == null || methodInfo.ReturnType != typeof(bool) || methodInfo.GetMethodBody() == null) { throw new InvalidOperationException("Expected cheat gate or native bypass getter is unavailable."); } } harmony = new Harmony("sfantul.achievementswithcheats"); harmony.Patch((MethodBase)method, new HarmonyMethod(typeof(Plugin), "AllowCheatedProgress", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)method2, new HarmonyMethod(typeof(Plugin), "NativeBypass", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo method3 = typeof(MessageHud).GetMethod("ShowMessage", new Type[6] { typeof(MessageType), typeof(string), typeof(int), typeof(Sprite), typeof(bool), typeof(bool) }); if (method3 == null) { throw new InvalidOperationException("Expected notification method is unavailable."); } harmony.Patch((MethodBase)method3, new HarmonyMethod(typeof(Plugin), "FilterCheatedItemMessage", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); bypassActive = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Achievements With Cheats active: modded and cheat/devcommand achievement restrictions bypassed. No unlock-all or saved-key edits performed."); } catch (Exception ex) { bypassActive = false; if (harmony != null) { harmony.UnpatchSelf(); } ((BaseUnityPlugin)this).Logger.LogError((object)("Refused to enable cheat bypass: " + ex)); } } private static bool AllowCheatedProgress(ref bool __result) { __result = false; return false; } private static bool NativeBypass(ref bool __result) { __result = true; return false; } private static bool FilterCheatedItemMessage(string __1) { return !bypassActive || (__1 != "$achievements_picked_up_cheated_item" && __1 != "$achievements_dropped_cheated_item"); } private void OnDestroy() { bypassActive = false; if (harmony != null) { harmony.UnpatchSelf(); } } }