using System; 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; using Photon.Pun; using UnityEngine; [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("LavaCookingFix")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LavaCookingFix")] [assembly: AssemblyTitle("LavaCookingFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 LavaCookingFix { [BepInPlugin("jill920.lavacookingfix", "Lava Cooking Fix", "1.0.1")] public class LavaCookingFixPlugin : BaseUnityPlugin { public const string MOD_GUID = "jill920.lavacookingfix"; public const string MOD_NAME = "Lava Cooking Fix"; public const string MOD_VERSION = "1.0.1"; public static LavaCookingFixPlugin Instance; public static ManualLogSource Logger; public static bool debugMode; private void Awake() { Instance = this; Logger = ((BaseUnityPlugin)this).Logger; debugMode = ((BaseUnityPlugin)this).Config.Bind("Debug", "EnableLogs", false, "Enable debug logging").Value; try { Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "jill920.lavacookingfix"); Logger.LogInfo((object)"[Lava Cooking Fix 1.0.1] Loaded successfully!"); Logger.LogInfo((object)" Lava cooking fix: Temporarily removes equipped backpack items during cooking scan"); } catch (Exception ex) { Logger.LogError((object)("Failed to load: " + ex.Message)); } } } } namespace LavaCookingFix.Patches { [HarmonyPatch(typeof(Lava), "TryCookItems")] internal static class Lava_TryCookItems_Patch_Filter { private static List _removedItems = new List(); [HarmonyPrefix] private static void Prefix(Lava __instance) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Invalid comparison between Unknown and I4 //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Invalid comparison between Unknown and I4 if (!PhotonNetwork.IsMasterClient) { return; } _removedItems.Clear(); for (int num = Item.ALL_ACTIVE_ITEMS.Count - 1; num >= 0; num--) { Item val = Item.ALL_ACTIVE_ITEMS[num]; if ((Object)(object)val != (Object)null && (int)val.itemState == 2 && val.backpackReference.IsSome && (int)val.backpackReference.Value.Item2.type == 1) { _removedItems.Add(val); Item.ALL_ACTIVE_ITEMS.RemoveAt(num); if (LavaCookingFixPlugin.debugMode) { LavaCookingFixPlugin.Logger.LogInfo((object)("Temporarily removed " + ((Object)val).name + " from active items for lava cooking")); } } } } [HarmonyPostfix] private static void Postfix(Lava __instance) { if (!PhotonNetwork.IsMasterClient) { return; } foreach (Item removedItem in _removedItems) { if ((Object)(object)removedItem != (Object)null && !Item.ALL_ACTIVE_ITEMS.Contains(removedItem)) { Item.ALL_ACTIVE_ITEMS.Add(removedItem); } } _removedItems.Clear(); if (LavaCookingFixPlugin.debugMode) { LavaCookingFixPlugin.Logger.LogInfo((object)$"Restored {_removedItems.Count} items to active list"); } } } }