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 LogbookUnlock v1.0.0
plugins/LogbookUnlock/LogbookUnlock.dll
Decompiled 16 hours agousing System; using System.Collections.Generic; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using R2API.Utils; using RoR2; using RoR2.UI.LogBook; using UnityEngine; [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyVersion("0.0.0.0")] namespace LocalLogbookUnlock; [BepInPlugin("local.logbook.unlock", "Logbook Unlock", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "local.logbook.unlock"; private static Plugin instance; private ConfigEntry<bool> enabledSetting; private Harmony harmony; private void Awake() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown instance = this; enabledSetting = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "允许查看现有物品、怪物、场景、幸存者和无人机日志,不修改存档解锁。修改后请重新打开图鉴页面。"); harmony = new Harmony("local.logbook.unlock"); try { MethodInfo methodInfo = AccessTools.Method(typeof(Entry), "GetStatus", new Type[1] { typeof(UserProfile) }, (Type[])null); if (methodInfo == null) { throw new MissingMethodException("RoR2.UI.LogBook.Entry.GetStatus(UserProfile)"); } Harmony obj = harmony; HarmonyMethod val = new HarmonyMethod(typeof(Plugin), "StatusPostfix", (Type[])null); val.priority = 0; obj.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Logbook Unlock ready. View existing log entries only; achievements, gameplay unlocks and DLC ownership unchanged."); } catch (Exception ex) { harmony.UnpatchSelf(); ((BaseUnityPlugin)this).Logger.LogError((object)("Logbook Unlock disabled: " + ex)); } } private static void StatusPostfix(Entry __instance, ref EntryStatus __result) { if (!((Object)(object)instance == (Object)null) && __instance != null) { string category = ((__instance.category == null) ? null : __instance.category.nameToken); bool lockedOrUnencountered = (int)__result == 2 || (int)__result == 3; if (UnlockPolicy.ShouldReveal(instance.enabledSetting.Value, category, lockedOrUnencountered, __instance.pageBuilderMethod != null)) { __result = (EntryStatus)4; } } } private void OnDestroy() { if (harmony != null) { harmony.UnpatchSelf(); } if ((Object)(object)instance == (Object)(object)this) { instance = null; } } } public static class UnlockPolicy { private static readonly HashSet<string> Categories = new HashSet<string>(StringComparer.Ordinal) { "LOGBOOK_CATEGORY_ITEMANDEQUIPMENT", "LOGBOOK_CATEGORY_MONSTER", "LOGBOOK_CATEGORY_STAGE", "LOGBOOK_CATEGORY_SURVIVOR", "LOGBOOK_CATEGORY_DRONE" }; public static bool ShouldReveal(bool enabled, string category, bool lockedOrUnencountered, bool hasPage) { if (enabled && hasPage && lockedOrUnencountered && category != null) { return Categories.Contains(category); } return false; } }