using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn.Managers; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("FoodUnlock")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.3.1.0")] [assembly: AssemblyInformationalVersion("0.3.1")] [assembly: AssemblyProduct("FoodUnlock")] [assembly: AssemblyTitle("FoodUnlock")] [assembly: AssemblyVersion("0.3.1.0")] [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 FoodUnlock { [BepInPlugin("local.foodunlock", "Food Unlock", "0.3.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(Player), "EatFood", new Type[] { typeof(ItemData) })] private static class LearnFood { private static void Postfix(Player __instance, ItemData item, bool __result) { if (!__result || (Object)(object)__instance != (Object)(object)Player.m_localPlayer || !IsFood(item)) { return; } HashSet hashSet = ReadUnlocks(__instance); if (hashSet.Add(((Object)item.m_dropPrefab).name)) { __instance.m_customData["local.foodunlock.foods.v1"] = string.Join("\n", hashSet.OrderBy((string x) => x, StringComparer.Ordinal)); ((Character)__instance).Message((MessageType)1, "Food unlocked: " + Localization.instance.Localize(item.m_shared.m_name), 0, (Sprite)null); ((BaseUnityPlugin)instance).Logger.LogInfo((object)("Unlocked food: " + ((Object)item.m_dropPrefab).name)); if (instance.visible) { instance.RefreshFoods(); instance.RebuildRows(); } } } } [HarmonyPatch(typeof(ZInput), "GetButton", new Type[] { typeof(string) })] private static class AvoidAutoRun { private static void Postfix(string __0, ref bool __result) { if (__result && !(__0 != "AutoRun") && !((Object)(object)instance == (Object)null) && !instance.visible) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead() && instance.PressedSlot(localPlayer, held: true) >= 0) { __result = false; } } } } private GameObject panel; private RectTransform listContent; private ScrollRect foodScroll; private Text statusText; private readonly Text[] slotLabels = (Text[])(object)new Text[3]; private readonly Image[] slotIcons = (Image[])(object)new Image[3]; private readonly UITooltip[] slotTips = (UITooltip[])(object)new UITooltip[3]; private readonly List