using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; 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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("InstantCook")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+51cfcd7a8008f5e6b4b15f84b5c38f9a649f967f")] [assembly: AssemblyProduct("InstantCook")] [assembly: AssemblyTitle("InstantCook")] [assembly: AssemblyVersion("1.0.0.0")] [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 InstantCook { [BepInPlugin("zopthemop.instantcook", "Instant cook", "1.0.0")] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(CookingStation), "UpdateCooking")] internal static class CookingStation_UpdateCooking_Patch { private static IEnumerable Transpiler(IEnumerable instructions) { List list = new List(instructions); FieldInfo objB = AccessTools.Field(typeof(ItemConversion), "m_cookTime"); int num = 0; for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldfld && object.Equals(list[i].operand, objB)) { num++; if (num == 2) { list[i - 1].opcode = OpCodes.Ldc_R4; list[i - 1].operand = 1f; list[i].opcode = OpCodes.Nop; list[i].operand = null; } } } return list; } } [HarmonyPatch(typeof(CookingStation), "CookItem")] public static class CookingStation_CookItem_Patch { private static void Prefix(CookingStation __instance, ZNetView ___m_nview) { if (!___m_nview.IsOwner()) { ___m_nview.ClaimOwnership(); } } private static void Postfix(CookingStation __instance, ZNetView ___m_nview, Transform[] ___m_slots) { for (int i = 0; i < ___m_slots.Length; i++) { float @float = ___m_nview.GetZDO().GetFloat("slot" + i, 0f); if (@float > 0f && @float < 3f) { ___m_nview.GetZDO().Set("slot" + i, 0f); } } } } public const string ModGUID = "zopthemop.instantcook"; public const string ModName = "Instant cook"; public const string ModVersion = "1.0.0"; public const string ModDescription = "Cooking finishes in about a second but still burns at the regular speed"; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("zopthemop.instantcook"); val.PatchAll(); } } }