Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of ProduceMoreMono v1.0.8
Mods\ProduceMoreMono.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using FishNet; using FishNet.Connection; using FishNet.Object; using HarmonyLib; using MelonLoader; using Microsoft.CodeAnalysis; using ProduceMore; using ScheduleOne; using ScheduleOne.AvatarFramework.Equipping; using ScheduleOne.DevUtilities; using ScheduleOne.Employees; using ScheduleOne.EntityFramework; using ScheduleOne.GameTime; using ScheduleOne.ItemFramework; using ScheduleOne.Management; using ScheduleOne.NPCs; using ScheduleOne.NPCs.Behaviour; using ScheduleOne.ObjectScripts; using ScheduleOne.Product; using ScheduleOne.Product.Packaging; using ScheduleOne.StationFramework; using ScheduleOne.UI.Items; using ScheduleOne.UI.Management; using ScheduleOne.UI.Phone.Delivery; using ScheduleOne.UI.Shop; using ScheduleOne.UI.Stations; using ScheduleOne.UI.Stations.Drying_rack; using ScheduleOne.Variables; using TMPro; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(ProduceMoreMod), "ProduceMore", "1.0.8", "lasersquid", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ProduceMoreMono")] [assembly: AssemblyConfiguration("Mono")] [assembly: AssemblyFileVersion("1.0.8.0")] [assembly: AssemblyInformationalVersion("1.0.8+9697bef26b4decaf811d358ff8f1a154fa08fc3d")] [assembly: AssemblyProduct("ProduceMoreMono")] [assembly: AssemblyTitle("ProduceMoreMono")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.8.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 ProduceMore { public class ProduceMoreMod : MelonMod { public MelonPreferences_Category stationSpeeds; public MelonPreferences_Category stationCapacities; public MelonPreferences_Category employeeAnimation; public MelonPreferences_Category stackSizes; public MelonPreferences_Category stackOverrides; public IEqualityComparer<Object> unityComparer; public HashSet<GridItem> processedStationCapacities; public HashSet<GridItem> processedStationSpeeds; public HashSet<GridItem> processedStationTimes; public HashSet<ItemDefinition> processedItemDefs; public HashSet<StationRecipe> processedRecipes; public Dictionary<string, int> originalStackLimits; public Dictionary<string, int> originalStationCapacities; public Dictionary<string, int> originalStationTimes; public Dictionary<StationRecipe, int> originalRecipeTimes; public HashSet<NPC> registeredEmployees; public List<object> runningCoroutines; public Harmony harmony = new Harmony("com.lasersquid.producemore"); public ProduceMoreMod() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown unityComparer = new UnityObjectComparer(); processedStationCapacities = new HashSet<GridItem>((IEqualityComparer<GridItem>?)unityComparer); processedStationSpeeds = new HashSet<GridItem>((IEqualityComparer<GridItem>?)unityComparer); processedStationTimes = new HashSet<GridItem>((IEqualityComparer<GridItem>?)unityComparer); processedItemDefs = new HashSet<ItemDefinition>((IEqualityComparer<ItemDefinition>?)unityComparer); processedRecipes = new HashSet<StationRecipe>((IEqualityComparer<StationRecipe>?)unityComparer); originalStackLimits = new Dictionary<string, int>(); originalStationCapacities = new Dictionary<string, int>(); originalStationTimes = new Dictionary<string, int>(); originalRecipeTimes = new Dictionary<StationRecipe, int>((IEqualityComparer<StationRecipe>?)unityComparer); registeredEmployees = new HashSet<NPC>((IEqualityComparer<NPC>?)unityComparer); runningCoroutines = new List<object>(); } public override void OnInitializeMelon() { InitializeMelonPreferences(); SetMod(); ((MelonBase)this).LoggerInstance.Msg("Initialized."); } public override void OnSceneWasUnloaded(int buildIndex, string sceneName) { ((MelonMod)this).OnSceneWasUnloaded(buildIndex, sceneName); if (sceneName.ToLower().Contains("main") || sceneName.ToLower().Contains("tutorial")) { ((MelonBase)this).LoggerInstance.Msg("Scene unloaded, resetting state."); StopCoroutines(); ResetState(); } } public void StopCoroutines() { foreach (object runningCoroutine in runningCoroutines) { MelonCoroutines.Stop(runningCoroutine); } runningCoroutines.Clear(); } public override void OnPreferencesSaved() { ((MelonBase)this).OnPreferencesSaved(); ResetState(); } private void ResetState() { processedStationCapacities = new HashSet<GridItem>((IEqualityComparer<GridItem>?)unityComparer); processedStationSpeeds = new HashSet<GridItem>((IEqualityComparer<GridItem>?)unityComparer); processedStationTimes = new HashSet<GridItem>((IEqualityComparer<GridItem>?)unityComparer); processedItemDefs = new HashSet<ItemDefinition>((IEqualityComparer<ItemDefinition>?)unityComparer); processedRecipes = new HashSet<StationRecipe>((IEqualityComparer<StationRecipe>?)unityComparer); } private void InitializeMelonPreferences() { stationSpeeds = MelonPreferences.CreateCategory("ProduceMore_01_station_speeds", "Station Speeds (1=normal, 2=double, 0.5=half)"); employeeAnimation = MelonPreferences.CreateCategory("ProduceMore_02_employee_animation", "Employee Work Speeds (1=normal, 2=double, 0.5=half)"); stationCapacities = MelonPreferences.CreateCategory("ProduceMore_03_station_capacities", "Station Capacities"); stackSizes = MelonPreferences.CreateCategory("ProduceMore_04_stack_sizes", "Stack Limits (by category)"); stackOverrides = MelonPreferences.CreateCategory("ProduceMore_05_stack_overrides", "Stack Limit Overrides"); stationSpeeds.SetFilePath("UserData/ProduceMore.cfg"); stationCapacities.SetFilePath("UserData/ProduceMore.cfg"); employeeAnimation.SetFilePath("UserData/ProduceMore.cfg"); stackSizes.SetFilePath("UserData/ProduceMore.cfg"); stackOverrides.SetFilePath("UserData/ProduceMore.cfg"); stationSpeeds.CreateEntry<float>("LabOven", 1f, "Lab Oven", false); stationSpeeds.CreateEntry<float>("Cauldron", 1f, "Cauldron", false); stationSpeeds.CreateEntry<float>("BrickPress", 1f, "Brick Press", false); stationSpeeds.CreateEntry<float>("ChemistryStation", 1f, "Chemistry Station", false); stationSpeeds.CreateEntry<float>("DryingRack", 1f, "Drying Rack", false); stationSpeeds.CreateEntry<float>("MixingStation", 1f, "Mixing Station", false); stationSpeeds.CreateEntry<float>("MixingStationMk2", 1f, "Mixing Station Mk2", false); stationSpeeds.CreateEntry<float>("PackagingStation", 1f, "Packaging Station", false); stationSpeeds.CreateEntry<float>("PackagingStationMk2", 1f, "Packaging Station Mk2", false); stationSpeeds.CreateEntry<float>("Pot", 1f, "Pot", false); stationCapacities.CreateEntry<int>("DryingRack", 20, "Drying Rack", false); stationCapacities.CreateEntry<int>("MixingStation", 10, "Mixing Station", false); stationCapacities.CreateEntry<int>("MixingStationMk2", 20, "Mixing Station Mk2", false); stationCapacities.CreateEntry<int>("PackagingStation", 20, "Packaging Station", false); stationCapacities.CreateEntry<int>("PackagingStationMk2", 20, "Packaging Station Mk2", false); employeeAnimation.CreateEntry<float>("employeeWalkAcceleration", 1f, "Employee walk speed modifier", false); employeeAnimation.CreateEntry<float>("LabOvenAcceleration", 1f, "Lab Oven animation speed modifier", false); employeeAnimation.CreateEntry<float>("CauldronAcceleration", 1f, "Cauldron animation speed modifier", false); employeeAnimation.CreateEntry<float>("BrickPressAcceleration", 1f, "Brick Press animation speed modifier", false); employeeAnimation.CreateEntry<float>("ChemistryStationAcceleration", 1f, "Chemistry Station animation speed modifier", false); employeeAnimation.CreateEntry<float>("DryingRackAcceleration", 1f, "Drying Rack animation speed modifier", false); employeeAnimation.CreateEntry<float>("MixingStationAcceleration", 1f, "Mixing Station animation speed modifier", false); employeeAnimation.CreateEntry<float>("MixingStationMk2Acceleration", 1f, "Mixing Station Mk2 animation speed modifier", false); employeeAnimation.CreateEntry<float>("PackagingStationAcceleration", 1f, "Packaging Station animation speed modifier", false); employeeAnimation.CreateEntry<float>("PackagingStationMk2Acceleration", 1f, "Packaging Station Mk2 animation speed modifier", false); employeeAnimation.CreateEntry<float>("PotAcceleration", 1f, "Pot animation speed modifier", false); stackSizes.CreateEntry<int>("Agriculture", 10, "Agriculture", false); stackSizes.CreateEntry<int>("Cash", 1000, "Cash", false); stackSizes.CreateEntry<int>("Clothing", 1, "Clothing", false); stackSizes.CreateEntry<int>("Consumable", 20, "Consumable", false); stackSizes.CreateEntry<int>("Decoration", 1, "Decoration", false); stackSizes.CreateEntry<int>("Equipment", 10, "Equipment", false); stackSizes.CreateEntry<int>("Furniture", 10, "Furniture", false); stackSizes.CreateEntry<int>("Ingredient", 20, "Ingredient", false); stackSizes.CreateEntry<int>("Lighting", 10, "Lighting", false); stackSizes.CreateEntry<int>("Packaging", 20, "Packaging", false); stackSizes.CreateEntry<int>("Product", 20, "Product", false); stackSizes.CreateEntry<int>("Storage", 10, "Storage", false); stackSizes.CreateEntry<int>("Tools", 1, "Tools", false); stackOverrides.CreateEntry<int>("Acid", 10, "Acid", false); stackOverrides.CreateEntry<int>("Phosphorus", 10, "Phosphorus", false); stackOverrides.CreateEntry<int>("Low-Quality Pseudo", 10, "Low-Quality Pseudo", false); stackOverrides.CreateEntry<int>("Pseudo", 10, "Pseudo", false); stackOverrides.CreateEntry<int>("High-Quality Pseudo", 10, "High-Quality Pseudo", false); stackOverrides.CreateEntry<int>("Shotgun Shell", 10, "Shotgun Shell", false); stackOverrides.CreateEntry<int>("M1911 Magazine", 10, "M1911 Magazine", false); stackOverrides.CreateEntry<int>("Revolver Cylinder", 10, "Revolver Cylinder", false); stackOverrides.CreateEntry<int>("Spray Paint", 10, "Spray Paint", false); stackOverrides.CreateEntry<int>("Graffiti Cleaner", 10, "Graffiti Cleaner", false); MelonPreferences.Save(); } private List<Type> GetPatchTypes() { return (from t in Assembly.GetExecutingAssembly().GetTypes() where t.Name.EndsWith("Patches") select t).ToList(); } private void SetMod() { foreach (Type patchType in GetPatchTypes()) { MethodInfo method = patchType.GetMethod("SetMod", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy); method.Invoke(null, new object[1] { this }); } } public void RestoreDefaults() { foreach (Type patchType in GetPatchTypes()) { try { MethodInfo method = patchType.GetMethod("RestoreDefaults", BindingFlags.Static | BindingFlags.Public); method.Invoke(null, null); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("Couldn't restore defaults for class " + patchType.Name + ": " + ex.GetType().Name + " - " + ex.Message); ((MelonBase)this).LoggerInstance.Warning("Source: " + ex.Source); ((MelonBase)this).LoggerInstance.Warning(ex.StackTrace ?? ""); } } } public int GetStackLimit(ItemInstance item) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) int result = 10; if (item == null) { return 0; } if (stackOverrides.GetEntry<int>(item.Name) != null) { result = stackOverrides.GetEntry<int>(item.Name).Value; } else { EItemCategory val = ((!(item.Definition.Name == "Speed Grow")) ? item.Category : ((EItemCategory)2)); if (stackSizes.GetEntry<int>(((object)(EItemCategory)(ref val)).ToString()) != null) { result = stackSizes.GetEntry<int>(((object)(EItemCategory)(ref val)).ToString()).Value; } else { MelonLogger.Msg($"Couldn't find stack size for item {item.Name} with category {val}, assuming 10"); } } return result; } public int GetStackLimit(ItemDefinition itemDef) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) int result = 10; if (stackOverrides.GetEntry<int>(itemDef.Name) != null) { result = stackOverrides.GetEntry<int>(itemDef.Name).Value; } else { EItemCategory val = ((!(itemDef.Name == "Speed Grow")) ? itemDef.Category : ((EItemCategory)2)); if (stackSizes.GetEntry<int>(((object)(EItemCategory)(ref val)).ToString()) != null) { result = stackSizes.GetEntry<int>(((object)(EItemCategory)(ref val)).ToString()).Value; } else { MelonLogger.Msg($"Couldn't find stack size for item {itemDef.Name} with category {val}"); } } return result; } public int GetStackLimit(string itemName, EItemCategory category) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) int result = 10; if (stackOverrides.GetEntry<int>(itemName) != null) { result = stackOverrides.GetEntry<int>(itemName).Value; } else { EItemCategory val = ((!(itemName == "Speed Grow")) ? category : ((EItemCategory)2)); if (stackSizes.GetEntry<int>(((object)(EItemCategory)(ref val)).ToString()) != null) { result = stackSizes.GetEntry<int>(((object)(EItemCategory)(ref val)).ToString()).Value; } else { MelonLogger.Msg($"Couldn't find stack size for item {itemName} with category {val}"); } } return result; } public int GetStackLimit(EItemCategory category) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) int result = 10; if (stackSizes.GetEntry<int>(((object)(EItemCategory)(ref category)).ToString()) != null) { result = stackSizes.GetEntry<int>(((object)(EItemCategory)(ref category)).ToString()).Value; } else { MelonLogger.Msg($"Couldn't find stack size for category {category}"); } return result; } public int GetStationCapacity(string station) { int result = 10; if (stationCapacities.GetEntry<int>(station) != null) { result = stationCapacities.GetEntry<int>(station).Value; } else { MelonLogger.Msg("Couldn't find station capacity for " + station); } return result; } public float GetStationSpeed(string station) { float result = 1f; if (stationSpeeds.GetEntry<float>(station) != null) { result = stationSpeeds.GetEntry<float>(station).Value; } else { MelonLogger.Msg("Couldn't find station speed modifier for " + station); } return result; } public float GetStationWorkSpeed(string station) { float result = 1f; if (employeeAnimation.GetEntry<float>(station + "Acceleration") != null) { result = employeeAnimation.GetEntry<float>(station + "Acceleration").Value; } else { MelonLogger.Msg("Couldn't find employee work speed modifier for " + station); } return result; } } public class UnityObjectComparer : IEqualityComparer<Object> { public bool Equals(Object a, Object b) { return a.GetInstanceID() == b.GetInstanceID(); } public int GetHashCode(Object item) { return item.GetInstanceID(); } } public class Sched1PatchesBase { protected static ProduceMoreMod Mod; public static object GetField(Type type, string fieldName, object target) { return AccessTools.Field(type, fieldName).GetValue(target); } public static void SetField(Type type, string fieldName, object target, object value) { AccessTools.Field(type, fieldName).SetValue(target, value); } public static object GetProperty(Type type, string fieldName, object target) { return AccessTools.Property(type, fieldName).GetValue(target); } public static void SetProperty(Type type, string fieldName, object target, object value) { AccessTools.Property(type, fieldName).SetValue(target, value); } public static object CallMethod(Type type, string methodName, object target, object[] args) { return AccessTools.Method(type, methodName, (Type[])null, (Type[])null).Invoke(target, args); } public static void SetMod(ProduceMoreMod mod) { Mod = mod; } public static T CastTo<T>(object o) where T : class { if (!(o is T result)) { return null; } return result; } public static bool Is<T>(object o) { return o is T; } public static UnityAction ToUnityAction(Action action) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown return new UnityAction(action.Invoke); } public static UnityAction<T> ToUnityAction<T>(Action<T> action) { return action.Invoke; } public static void Log(string message) { ((MelonBase)Mod).LoggerInstance.Msg(message); } public static void Warn(string message) { ((MelonBase)Mod).LoggerInstance.Warning(message); } public static void RestoreDefaults() { throw new NotImplementedException(); } } [HarmonyPatch] public class ItemCapacityPatches : Sched1PatchesBase { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] public static void StackLimitPrefix(ItemInstance __instance) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!Sched1PatchesBase.Mod.processedItemDefs.Contains(__instance.Definition) && __instance.Definition.Name.ToLower() != "cash") { EItemCategory val = ((!(__instance.Definition.Name == "Speed Grow")) ? __instance.Definition.Category : ((EItemCategory)2)); if (!Sched1PatchesBase.Mod.originalStackLimits.ContainsKey(((object)(EItemCategory)(ref val)).ToString())) { Sched1PatchesBase.Mod.originalStackLimits[((object)(EItemCategory)(ref val)).ToString()] = __instance.Definition.StackLimit; } __instance.Definition.StackLimit = Sched1PatchesBase.Mod.GetStackLimit(__instance); Sched1PatchesBase.Mod.processedItemDefs.Add(__instance.Definition); } } [HarmonyPatch(typeof(ListingEntry), "Initialize")] [HarmonyPrefix] public static void InitializePrefix(ShopListing match) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (match != null && !Sched1PatchesBase.Mod.processedItemDefs.Contains((ItemDefinition)(object)match.Item) && ((ItemDefinition)match.Item).Name.ToLower() != "cash") { EItemCategory val = ((!(((ItemDefinition)match.Item).Name == "Speed Grow")) ? ((ItemDefinition)match.Item).Category : ((EItemCategory)2)); if (!Sched1PatchesBase.Mod.originalStackLimits.ContainsKey(((object)(EItemCategory)(ref val)).ToString())) { Sched1PatchesBase.Mod.originalStackLimits[((object)(EItemCategory)(ref val)).ToString()] = ((ItemDefinition)match.Item).StackLimit; } int stackLimit = Sched1PatchesBase.Mod.GetStackLimit((ItemDefinition)(object)match.Item); ((ItemDefinition)match.Item).StackLimit = stackLimit; Sched1PatchesBase.Mod.processedItemDefs.Add((ItemDefinition)(object)match.Item); } } [HarmonyPatch(typeof(ItemSlot), "GetCapacityForItem")] [HarmonyPostfix] public static void GetCapacityForItemPostfix(ItemSlot __instance, ref int __result, ItemInstance item, bool checkPlayerFilters) { if (!__instance.DoesItemMatchHardFilters(item)) { __result = 0; } else if (checkPlayerFilters && !__instance.DoesItemMatchPlayerFilters(item)) { __result = 0; } else if (__instance.ItemInstance == null || __instance.ItemInstance.CanStackWith(item, false)) { __result = Sched1PatchesBase.Mod.GetStackLimit(item) - __instance.Quantity; } else { __result = 0; } } [HarmonyPatch(typeof(NPCInventory), "GetCapacityForItem")] [HarmonyPostfix] public static void NPCGetCapacityForItemPostfix(NPCInventory __instance, ItemInstance item, ref int __result) { if (item == null) { __result = 0; return; } int num = 0; for (int i = 0; i < __instance.ItemSlots.Count; i++) { if (__instance.ItemSlots[i] != null && !__instance.ItemSlots[i].IsLocked && !__instance.ItemSlots[i].IsAddLocked) { if (__instance.ItemSlots[i].ItemInstance == null) { num += Sched1PatchesBase.Mod.GetStackLimit(item); } else if (__instance.ItemSlots[i].ItemInstance.CanStackWith(item, true)) { num += Sched1PatchesBase.Mod.GetStackLimit(item) - __instance.ItemSlots[i].ItemInstance.Quantity; } } } __result = num; } public new static void RestoreDefaults() { try { foreach (ItemDefinition processedItemDef in Sched1PatchesBase.Mod.processedItemDefs) { if (processedItemDef.Name.ToLower() != "cash") { if (!Sched1PatchesBase.Mod.originalStackLimits.ContainsKey(((object)(EItemCategory)(ref processedItemDef.Category)).ToString())) { processedItemDef.StackLimit = 10; } else { processedItemDef.StackLimit = Sched1PatchesBase.Mod.originalStackLimits[((object)(EItemCategory)(ref processedItemDef.Category)).ToString()]; } } } } catch (Exception ex) { Sched1PatchesBase.Warn("Couldn't restore defaults for " + MethodBase.GetCurrentMethod().DeclaringType.Name + ": " + ex.GetType().Name + " - " + ex.Message); Sched1PatchesBase.Warn("Source: " + ex.Source); Sched1PatchesBase.Warn(ex.StackTrace ?? ""); if (ex.InnerException != null) { Sched1PatchesBase.Warn("Inner exception: " + ex.InnerException.GetType().Name + " - " + ex.InnerException.Message); Sched1PatchesBase.Warn("Source: " + ex.InnerException.Source); Sched1PatchesBase.Warn(ex.InnerException.StackTrace ?? ""); if (ex.InnerException.InnerException != null) { Sched1PatchesBase.Warn("Inner inner exception: " + ex.InnerException.InnerException.GetType().Name + " - " + ex.InnerException.InnerException.Message); Sched1PatchesBase.Warn("Source: " + ex.InnerException.InnerException.Source); Sched1PatchesBase.Warn(ex.InnerException.InnerException.StackTrace ?? ""); } } } } } [HarmonyPatch] public class RegistryPatches : Sched1PatchesBase { [HarmonyTargetMethod] public static MethodBase TargetMethod() { List<MethodInfo> declaredMethods = AccessTools.GetDeclaredMethods(typeof(Registry)); foreach (MethodInfo item in declaredMethods) { if (item.Name == "GetItem" && item.ReturnType == typeof(ItemDefinition)) { return item; } } return null; } [HarmonyPatch] [HarmonyPostfix] public static void GetItemPostfix(ref ItemDefinition __result) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__result == (Object)null) && !Sched1PatchesBase.Mod.processedItemDefs.Contains(__result) && __result.Name.ToLower() != "cash") { EItemCategory val = ((!(__result.Name == "Speed Grow")) ? __result.Category : ((EItemCategory)2)); if (!Sched1PatchesBase.Mod.originalStackLimits.ContainsKey(((object)(EItemCategory)(ref val)).ToString())) { Sched1PatchesBase.Mod.originalStackLimits[((object)(EItemCategory)(ref val)).ToString()] = __result.StackLimit; } __result.StackLimit = Sched1PatchesBase.Mod.GetStackLimit(__result); Sched1PatchesBase.Mod.processedItemDefs.Add(__result); } } public new static void RestoreDefaults() { } } [HarmonyPatch] public class DryingRackPatches : Sched1PatchesBase { [CompilerGenerated] private sealed class <BeginActionCoroutine>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public StartDryingRackBehaviour behaviour; private float <stationSpeed>5__1; private int <itemCount>5__2; private int <num>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BeginActionCoroutine>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <stationSpeed>5__1 = Sched1PatchesBase.Mod.GetStationWorkSpeed("DryingRack"); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; behaviour.Rack.InputSlot.ItemInstance.GetCopy(1); <itemCount>5__2 = 0; break; case 2: <>1__state = -1; <num>5__3 = <itemCount>5__2; <itemCount>5__2 = <num>5__3 + 1; break; } if ((Object)(object)behaviour.Rack != (Object)null && behaviour.Rack.InputSlot.Quantity > <itemCount>5__2 && behaviour.Rack.GetTotalDryingItems() + <itemCount>5__2 < behaviour.Rack.ItemCapacity) { ((Behaviour)behaviour).Npc.Avatar.Animation.SetTrigger("GrabItem"); <>2__current = (object)new WaitForSeconds(Mathf.Max(0.1f, 1f / <stationSpeed>5__1)); <>1__state = 2; return true; } if (InstanceFinder.IsServer) { behaviour.Rack.StartOperation(); } Sched1PatchesBase.SetProperty(typeof(StartDryingRackBehaviour), "WorkInProgress", behaviour, false); Sched1PatchesBase.SetField(typeof(StartDryingRackBehaviour), "workRoutine", behaviour, null); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPatch(typeof(StartDryingRackBehaviour), "IsRackReady")] [HarmonyPrefix] public static void IsRackReadyPrefix(DryingRack rack, ref bool __result) { if (!Sched1PatchesBase.Mod.processedStationCapacities.Contains((GridItem)(object)rack)) { if (!Sched1PatchesBase.Mod.originalStationCapacities.ContainsKey("DryingRack")) { Sched1PatchesBase.Mod.originalStationCapacities["DryingRack"] = rack.ItemCapacity; } rack.ItemCapacity = Sched1PatchesBase.Mod.GetStationCapacity("DryingRack"); Sched1PatchesBase.Mod.processedStationCapacities.Add((GridItem)(object)rack); } } [HarmonyPatch(typeof(DryingRack), "CanStartOperation")] [HarmonyPrefix] public static bool CanStartOperationPrefix(DryingRack __instance, ref bool __result) { if (!Sched1PatchesBase.Mod.processedStationCapacities.Contains((GridItem)(object)__instance)) { if (!Sched1PatchesBase.Mod.originalStationCapacities.ContainsKey("DryingRack")) { Sched1PatchesBase.Mod.originalStationCapacities["DryingRack"] = __instance.ItemCapacity; } __instance.ItemCapacity = Sched1PatchesBase.Mod.GetStationCapacity("DryingRack"); Sched1PatchesBase.Mod.processedStationCapacities.Add((GridItem)(object)__instance); } __result = __instance.GetTotalDryingItems() < __instance.ItemCapacity && __instance.InputSlot.Quantity != 0 && !__instance.InputSlot.IsLocked && !__instance.InputSlot.IsRemovalLocked; return false; } [HarmonyPatch(typeof(DryingOperationUI), "UpdatePosition")] [HarmonyPrefix] public static bool UpdatePositionPrefix(DryingOperationUI __instance) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) if (!Sched1PatchesBase.Mod.originalStationTimes.ContainsKey("DryingRack")) { Sched1PatchesBase.Mod.originalStationTimes["DryingRack"] = 720; } float num = (float)Sched1PatchesBase.Mod.originalStationTimes["DryingRack"] / Sched1PatchesBase.Mod.GetStationSpeed("DryingRack"); float num2 = Mathf.Clamp01((float)__instance.AssignedOperation.Time / num); int num3 = Mathf.Clamp((int)num - __instance.AssignedOperation.Time, 0, (int)num); int num4 = num3 / 60; int num5 = num3 % 60; __instance.Tooltip.text = num4 + "h " + num5 + "m until next tier"; float num6 = -62.5f; float num7 = 0f - num6; __instance.Rect.anchoredPosition = new Vector2(Mathf.Lerp(num6, num7, num2), 0f); return false; } [HarmonyPatch(typeof(DryingOperation), "GetQuality")] [HarmonyPostfix] public static void GetQualityPostfix(DryingOperation __instance, ref EQuality __result) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected I4, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected I4, but got Unknown if (!Sched1PatchesBase.Mod.originalStationTimes.ContainsKey("DryingRack")) { Sched1PatchesBase.Mod.originalStationTimes["DryingRack"] = 720; } int num = (int)((float)Sched1PatchesBase.Mod.originalStationTimes["DryingRack"] / Sched1PatchesBase.Mod.GetStationSpeed("DryingRack")); if (__instance.Time >= num) { __result = (EQuality)(__instance.StartQuality + 1); } __result = (EQuality)(int)__instance.StartQuality; } [HarmonyPatch(typeof(DryingRack), "MinPass")] [HarmonyPrefix] public static bool MinPassPrefix(DryingRack __instance) { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Invalid comparison between Unknown and I4 if (!Sched1PatchesBase.Mod.originalStationTimes.ContainsKey("DryingRack")) { Sched1PatchesBase.Mod.originalStationTimes["DryingRack"] = 720; } if ((Object)(object)__instance == (Object)null) { return false; } DryingOperation[] array = __instance.DryingOperations.ToArray(); foreach (DryingOperation val in array) { val.Time++; if (!((float)val.Time >= (float)Sched1PatchesBase.Mod.originalStationTimes["DryingRack"] / Sched1PatchesBase.Mod.GetStationSpeed("DryingRack"))) { continue; } if ((int)val.StartQuality >= 3) { if (InstanceFinder.IsServer && __instance.GetOutputCapacityForOperation(val, (EQuality)4) >= val.Quantity) { __instance.TryEndOperation(__instance.DryingOperations.IndexOf(val), false, (EQuality)4, Random.Range(int.MinValue, int.MaxValue)); } } else { val.IncreaseQuality(); } } return false; } [HarmonyPatch(typeof(StartDryingRackBehaviour), "RpcLogic___BeginAction_2166136261")] [HarmonyPrefix] public static bool Rpc_BeginActionPrefix(StartDryingRackBehaviour __instance) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown if (__instance.WorkInProgress) { return false; } if ((Object)(object)__instance.Rack == (Object)null) { return false; } Sched1PatchesBase.SetProperty(typeof(StartDryingRackBehaviour), "WorkInProgress", __instance, true); ((Behaviour)__instance).Npc.Movement.FacePoint(__instance.Rack.uiPoint.position, 0.5f); object obj = MelonCoroutines.Start(BeginActionCoroutine(__instance)); Sched1PatchesBase.SetField(typeof(StartDryingRackBehaviour), "workRoutine", __instance, (object)(Coroutine)obj); Sched1PatchesBase.Mod.runningCoroutines.Add(obj); return false; } [IteratorStateMachine(typeof(<BeginActionCoroutine>d__6))] private static IEnumerator BeginActionCoroutine(StartDryingRackBehaviour behaviour) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <BeginActionCoroutine>d__6(0) { behaviour = behaviour }; } [HarmonyPatch(typeof(StartDryingRackBehaviour), "StopCauldron")] [HarmonyPrefix] public static bool StopCauldronPrefix(StartDryingRackBehaviour __instance) { object field = Sched1PatchesBase.GetField(typeof(StartDryingRackBehaviour), "workRoutine", __instance); if (field != null) { MelonCoroutines.Stop(field); Sched1PatchesBase.Mod.runningCoroutines.Remove(field); Sched1PatchesBase.SetField(typeof(StartDryingRackBehaviour), "workRoutine", __instance, null); } Sched1PatchesBase.SetProperty(typeof(StartDryingRackBehaviour), "WorkInProgress", __instance, false); return false; } public new static void RestoreDefaults() { try { foreach (GridItem processedStationCapacity in Sched1PatchesBase.Mod.processedStationCapacities) { DryingRack val = Sched1PatchesBase.CastTo<DryingRack>(processedStationCapacity); if ((Object)(object)val != (Object)null) { if (!Sched1PatchesBase.Mod.originalStationCapacities.ContainsKey("DryingRack")) { val.ItemCapacity = 20; } else { val.ItemCapacity = Sched1PatchesBase.Mod.originalStationCapacities["DryingRack"]; } } } } catch (Exception ex) { Sched1PatchesBase.Warn("Couldn't restore defaults for " + MethodBase.GetCurrentMethod().DeclaringType.Name + ": " + ex.GetType().Name + " - " + ex.Message); Sched1PatchesBase.Warn("Source: " + ex.Source); Sched1PatchesBase.Warn(ex.StackTrace ?? ""); if (ex.InnerException != null) { Sched1PatchesBase.Warn("Inner exception: " + ex.InnerException.GetType().Name + " - " + ex.InnerException.Message); Sched1PatchesBase.Warn("Source: " + ex.InnerException.Source); Sched1PatchesBase.Warn(ex.InnerException.StackTrace ?? ""); if (ex.InnerException.InnerException != null) { Sched1PatchesBase.Warn("Inner inner exception: " + ex.InnerException.InnerException.GetType().Name + " - " + ex.InnerException.InnerException.Message); Sched1PatchesBase.Warn("Source: " + ex.InnerException.InnerException.Source); Sched1PatchesBase.Warn(ex.InnerException.InnerException.StackTrace ?? ""); } } } } } [HarmonyPatch] public class LabOvenPatches : Sched1PatchesBase { [CompilerGenerated] private sealed class <FinishCookCoroutine>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public FinishLabOvenBehaviour behaviour; private float <stationSpeed>5__1; private ItemInstance <productItem>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FinishCookCoroutine>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <productItem>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Expected O, but got Unknown //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Expected O, but got Unknown //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Expected O, but got Unknown //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Expected O, but got Unknown //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <stationSpeed>5__1 = Sched1PatchesBase.Mod.GetStationWorkSpeed("LabOven"); behaviour.targetOven.SetNPCUser(((NetworkBehaviour)((Behaviour)behaviour).Npc).NetworkObject); ((Behaviour)behaviour).Npc.Movement.FacePoint(((Component)behaviour.targetOven).transform.position, Mathf.Max(0.1f, 0.5f / <stationSpeed>5__1)); <>2__current = (object)new WaitForSeconds(Mathf.Max(0.1f, 0.5f / <stationSpeed>5__1)); <>1__state = 1; return true; case 1: <>1__state = -1; if (!(bool)Sched1PatchesBase.CallMethod(typeof(FinishLabOvenBehaviour), "CanActionStart", behaviour, Array.Empty<object>())) { Sched1PatchesBase.CallMethod(typeof(FinishLabOvenBehaviour), "StopAction", behaviour, Array.Empty<object>()); ((Behaviour)behaviour).End_Networked((NetworkConnection)null); return false; } ((Behaviour)behaviour).Npc.SetEquippable_Networked((NetworkConnection)null, "Avatar/Equippables/Hammer"); behaviour.targetOven.Door.SetPosition(1f); behaviour.targetOven.WireTray.SetPosition(1f); <>2__current = (object)new WaitForSeconds(Mathf.Max(0.1f, 0.5f / <stationSpeed>5__1)); <>1__state = 2; return true; case 2: <>1__state = -1; behaviour.targetOven.SquareTray.SetParent(((Component)behaviour.targetOven).transform); behaviour.targetOven.RemoveTrayAnimation.Play(); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 3; return true; case 3: <>1__state = -1; behaviour.targetOven.Door.SetPosition(0f); <>2__current = (object)new WaitForSeconds(Mathf.Max(0.1f, 1f / <stationSpeed>5__1)); <>1__state = 4; return true; case 4: <>1__state = -1; ((Behaviour)behaviour).Npc.SetAnimationBool_Networked((NetworkConnection)null, "UseHammer", true); <>2__current = (object)new WaitForSeconds(Mathf.Max(0.1f, 10f / <stationSpeed>5__1)); <>1__state = 5; return true; case 5: <>1__state = -1; ((Behaviour)behaviour).Npc.SetAnimationBool_Networked((NetworkConnection)null, "UseHammer", false); behaviour.targetOven.Shatter(behaviour.targetOven.CurrentOperation.Cookable.ProductQuantity, ((Component)behaviour.targetOven.CurrentOperation.Cookable.ProductShardPrefab).gameObject); <>2__current = (object)new WaitForSeconds(Mathf.Max(0.1f, 1f / <stationSpeed>5__1)); <>1__state = 6; return true; case 6: <>1__state = -1; <productItem>5__2 = behaviour.targetOven.CurrentOperation.GetProductItem(behaviour.targetOven.CurrentOperation.Cookable.ProductQuantity * behaviour.targetOven.CurrentOperation.IngredientQuantity); behaviour.targetOven.OutputSlot.AddItem(<productItem>5__2, false); behaviour.targetOven.SendCookOperation((OvenCookOperation)null); Sched1PatchesBase.CallMethod(typeof(FinishLabOvenBehaviour), "StopAction", behaviour, Array.Empty<object>()); ((Behaviour)behaviour).End_Networked((NetworkConnection)null); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <StartCookCoroutine>d__4 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public StartLabOvenBehaviour behaviour; private float <stationSpeed>5__1; private ItemInstance <itemInstance>5__2; private int <num>5__3; private string <id>5__4; private EQuality <ingredientQuality>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StartCookCoroutine>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <itemInstance>5__2 = null; <id>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Invalid comparison between Unknown and I4 //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Expected O, but got Unknown //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <stationSpeed>5__1 = Sched1PatchesBase.Mod.GetStationWorkSpeed("LabOven"); behaviour.targetOven.SetNPCUser(((NetworkBehaviour)((Behaviour)behaviour).Npc).NetworkObject); ((Behaviour)behaviour).Npc.Movement.FacePoint(((Component)behaviour.targetOven).transform.position, Mathf.Max(0.1f, 0.5f / <stationSpeed>5__1)); <>2__current = (object)new WaitForSeconds(Mathf.Max(0.1f, 0.5f / <stationSpeed>5__1)); <>1__state = 1; return true; case 1: <>1__state = -1; if (!(bool)Sched1PatchesBase.CallMethod(typeof(StartLabOvenBehaviour), "CanCookStart", behaviour, Array.Empty<object>())) { Sched1PatchesBase.CallMethod(typeof(StartLabOvenBehaviour), "StopCook", behaviour, Array.Empty<object>()); ((Behaviour)behaviour).End_Networked((NetworkConnection)null); return false; } behaviour.targetOven.Door.SetPosition(1f); <>2__current = (object)new WaitForSeconds(Mathf.Max(0.1f, 0.5f / <stationSpeed>5__1)); <>1__state = 2; return true; case 2: <>1__state = -1; behaviour.targetOven.WireTray.SetPosition(1f); <>2__current = (object)new WaitForSeconds(Mathf.Max(0.1f, 5f / <stationSpeed>5__1)); <>1__state = 3; return true; case 3: <>1__state = -1; behaviour.targetOven.Door.SetPosition(0f); <>2__current = (object)new WaitForSeconds(Mathf.Max(0.1f, 1f / <stationSpeed>5__1)); <>1__state = 4; return true; case 4: <>1__state = -1; <itemInstance>5__2 = behaviour.targetOven.IngredientSlot.ItemInstance; if (<itemInstance>5__2 == null) { Sched1PatchesBase.CallMethod(typeof(StartLabOvenBehaviour), "StopCook", behaviour, Array.Empty<object>()); ((Behaviour)behaviour).End_Networked((NetworkConnection)null); return false; } <num>5__3 = 1; if ((int)Sched1PatchesBase.CastTo<StorableItemDefinition>(<itemInstance>5__2.Definition).StationItem.GetModule<CookableModule>().CookType == 1) { <num>5__3 = Mathf.Min(behaviour.targetOven.IngredientSlot.Quantity, 10); } <itemInstance>5__2.ChangeQuantity(-<num>5__3); <id>5__4 = ((ItemDefinition)Sched1PatchesBase.CastTo<StorableItemDefinition>(<itemInstance>5__2.Definition).StationItem.GetModule<CookableModule>().Product).ID; <ingredientQuality>5__5 = (EQuality)2; if (Sched1PatchesBase.Is<QualityItemInstance>(<itemInstance>5__2)) { <ingredientQuality>5__5 = Sched1PatchesBase.CastTo<QualityItemInstance>(<itemInstance>5__2).Quality; } behaviour.targetOven.SendCookOperation(new OvenCookOperation(<itemInstance>5__2.ID, <ingredientQuality>5__5, <num>5__3, <id>5__4)); Sched1PatchesBase.CallMethod(typeof(StartLabOvenBehaviour), "StopCook", behaviour, Array.Empty<object>()); ((Behaviour)behaviour).End_Networked((NetworkConnection)null); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPatch(typeof(OvenCookOperation), "GetCookDuration")] [HarmonyPostfix] public static void GetCookDurationPostfix(OvenCookOperation __instance, ref int __result) { if (!Sched1PatchesBase.Mod.originalStationTimes.ContainsKey("LabOven")) { Sched1PatchesBase.Mod.originalStationTimes["LabOven"] = __instance.Ingredient.StationItem.GetModule<CookableModule>().CookTime; } __result = (int)((float)Sched1PatchesBase.Mod.originalStationTimes["LabOven"] / Sched1PatchesBase.Mod.GetStationSpeed("LabOven")); } [HarmonyPatch(typeof(OvenCookOperation), "IsReady")] [HarmonyPostfix] public static void IsReadyPostfix(OvenCookOperation __instance, ref bool __result) { __result = __instance.CookProgress >= __instance.GetCookDuration(); } [HarmonyPatch(typeof(LabOvenCanvas), "DoesOvenOutputHaveSpace")] [HarmonyPostfix] public static void DoesOvenOutputHaveSpacePostfix(LabOvenCanvas __instance, ref bool __result) { ItemInstance defaultInstance = ((ItemDefinition)__instance.Oven.CurrentOperation.Product).GetDefaultInstance(1); ItemInstance itemInstance = __instance.Oven.OutputSlot.ItemInstance; int num = 0; if (!__instance.Oven.OutputSlot.DoesItemMatchHardFilters(defaultInstance)) { num = 0; } else if (itemInstance == null) { num = Sched1PatchesBase.Mod.GetStackLimit(defaultInstance); } else if (defaultInstance.CanStackWith(itemInstance.Definition.GetDefaultInstance(1), false)) { num = Sched1PatchesBase.Mod.GetStackLimit(defaultInstance) - itemInstance.Quantity; } int productQuantity = __instance.Oven.CurrentOperation.Cookable.ProductQuantity; __result = num >= productQuantity; } [HarmonyPatch(typeof(StartLabOvenBehaviour), "RpcLogic___StartCook_2166136261")] [HarmonyPrefix] public static bool Rpc_StartCookPrefix(StartLabOvenBehaviour __instance) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown try { if (Sched1PatchesBase.GetField(typeof(StartLabOvenBehaviour), "cookRoutine", __instance) != null || (Object)(object)__instance.targetOven == (Object)null) { return false; } object obj = MelonCoroutines.Start(StartCookCoroutine(__instance)); Sched1PatchesBase.SetField(typeof(StartLabOvenBehaviour), "cookRoutine", __instance, (object)(Coroutine)obj); Sched1PatchesBase.Mod.runningCoroutines.Add(obj); } catch (Exception ex) { Sched1PatchesBase.Warn("Failed to set cookroutine: " + ex.GetType().Name + " - " + ex.Message); Sched1PatchesBase.Warn("Source: " + ex.Source); Sched1PatchesBase.Warn(ex.StackTrace ?? ""); } return false; } [IteratorStateMachine(typeof(<StartCookCoroutine>d__4))] private static IEnumerator StartCookCoroutine(StartLabOvenBehaviour behaviour) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StartCookCoroutine>d__4(0) { behaviour = behaviour }; } [HarmonyPatch(typeof(StartLabOvenBehaviour), "StopCook")] [HarmonyPrefix] public static bool StopCookPrefix(StartLabOvenBehaviour __instance) { if ((Object)(object)__instance.targetOven != (Object)null) { __instance.targetOven.SetNPCUser((NetworkObject)null); } object field = Sched1PatchesBase.GetField(typeof(StartLabOvenBehaviour), "cookRoutine", __instance); if (field != null) { MelonCoroutines.Stop(field); Sched1PatchesBase.SetField(typeof(StartLabOvenBehaviour), "cookRoutine", __instance, null); Sched1PatchesBase.Mod.runningCoroutines.Remove(field); } return false; } [HarmonyPatch(typeof(FinishLabOvenBehaviour), "RpcLogic___StartAction_2166136261")] [HarmonyPrefix] public static bool Rpc_StartFinishCookPrefix(FinishLabOvenBehaviour __instance) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown if (Sched1PatchesBase.GetField(typeof(FinishLabOvenBehaviour), "actionRoutine", __instance) != null) { return false; } if ((Object)(object)__instance.targetOven == (Object)null) { return false; } object obj = MelonCoroutines.Start(FinishCookCoroutine(__instance)); Sched1PatchesBase.SetField(typeof(FinishLabOvenBehaviour), "actionRoutine", __instance, (object)(Coroutine)obj); Sched1PatchesBase.Mod.runningCoroutines.Add(obj); return false; } [IteratorStateMachine(typeof(<FinishCookCoroutine>d__7))] private static IEnumerator FinishCookCoroutine(FinishLabOvenBehaviour behaviour) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FinishCookCoroutine>d__7(0) { behaviour = behaviour }; } [HarmonyPatch(typeof(FinishLabOvenBehaviour), "StopAction")] [HarmonyPrefix] public static bool StopActionPrefix(FinishLabOvenBehaviour __instance) { __instance.targetOven.SetNPCUser((NetworkObject)null); ((Behaviour)__instance).Npc.SetEquippable_Networked((NetworkConnection)null, string.Empty); ((Behaviour)__instance).Npc.SetAnimationBool_Networked((NetworkConnection)null, "UseHammer", false); object field = Sched1PatchesBase.GetField(typeof(FinishLabOvenBehaviour), "actionRoutine", __instance); if (field != null) { MelonCoroutines.Stop(field); Sched1PatchesBase.SetField(typeof(FinishLabOvenBehaviour), "actionRoutine", __instance, null); Sched1PatchesBase.Mod.runningCoroutines.Remove(field); } return false; } public new static void RestoreDefaults() { } } [HarmonyPatch] public class MixingStationPatches : Sched1PatchesBase { [CompilerGenerated] private sealed class <StartMixCoroutine>d__8 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public StartMixingStationBehaviour behaviour; private float <stationSpeed>5__1; private QualityItemInstance <product>5__2; private ItemInstance <mixer>5__3; private int <mixQuantity>5__4; private float <mixTime>5__5; private int <i>5__6; private MixOperation <operation>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <StartMixCoroutine>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <product>5__2 = null; <mixer>5__3 = null; <operation>5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Expected O, but got Unknown //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (Sched1PatchesBase.Is<MixingStationMk2>(behaviour.targetStation)) { <stationSpeed>5__1 = Sched1PatchesBase.Mod.GetStationWorkSpeed("MixingStationMk2"); } else { <stationSpeed>5__1 = Sched1PatchesBase.Mod.GetStationWorkSpeed("MixingStation"); } ((Behaviour)behaviour).Npc.Movement.FacePoint(((Component)behaviour.targetStation).transform.position, Mathf.Max(0.1f, 0.5f / <stationSpeed>5__1)); <>2__current = (object)new WaitForSeconds(Mathf.Max(0.1f, 0.5f / <stationSpeed>5__1)); <>1__state = 1; return true; case 1: <>1__state = -1; if (!(bool)Sched1PatchesBase.CallMethod(typeof(StartMixingStationBehaviour), "CanCookStart", behaviour, Array.Empty<object>())) { Sched1PatchesBase.CallMethod(typeof(StartMixingStationBehaviour), "StopCook", behaviour, Array.Empty<object>()); ((Behaviour)behaviour).End_Networked((NetworkConnection)null); return false; } behaviour.targetStation.SetNPCUser(((NetworkBehaviour)((Behaviour)behaviour).Npc).NetworkObject); ((Behaviour)behaviour).Npc.SetAnimationBool_Networked((NetworkConnection)null, "UseChemistryStation", true); <product>5__2 = Sched1PatchesBase.CastTo<QualityItemInstance>(behaviour.targetStation.ProductSlot.ItemInstance); <mixer>5__3 = behaviour.targetStation.MixerSlot.ItemInstance; <mixQuantity>5__4 = behaviour.targetStation.GetMixQuantity(); <mixTime>5__5 = Mathf.Max(0.1f, (float)<mixQuantity>5__4 / <stationSpeed>5__1); <i>5__6 = 0; break; case 2: { <>1__state = -1; int num = <i>5__6 + 1; <i>5__6 = num; break; } } if ((float)<i>5__6 < <mixTime>5__5) { <>2__current = (object)new WaitForSeconds(1f); <>1__state = 2; return true; } if (InstanceFinder.IsServer) { behaviour.targetStation.ProductSlot.ChangeQuantity(-<mixQuantity>5__4, false); behaviour.targetStation.MixerSlot.ChangeQuantity(-<mixQuantity>5__4, false); <operation>5__7 = new MixOperation(((ItemInstance)<product>5__2).ID, <product>5__2.Quality, <mixer>5__3.ID, <mixQuantity>5__4); behaviour.targetStation.SendMixingOperation(<operation>5__7, 0); <operation>5__7 = null; } Sched1PatchesBase.CallMethod(typeof(StartMixingStationBehaviour), "StopCook", behaviour, Array.Empty<object>()); ((Behaviour)behaviour).End_Networked((NetworkConnection)null); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPatch(typeof(MixingStation), "GetMixQuantity")] [HarmonyPrefix] public static bool GetMixQuantityPrefix(MixingStation __instance, ref int __result) { if (!Sched1PatchesBase.Mod.processedStationCapacities.Contains((GridItem)(object)__instance)) { if (Sched1PatchesBase.Is<MixingStationMk2>(__instance)) { if (!Sched1PatchesBase.Mod.originalStationCapacities.ContainsKey("MixingStationMk2")) { Sched1PatchesBase.Mod.originalStationCapacities["MixingStationMk2"] = __instance.MaxMixQuantity; } __instance.MaxMixQuantity = Sched1PatchesBase.Mod.GetStationCapacity("MixingStationMk2"); } else { if (!Sched1PatchesBase.Mod.originalStationCapacities.ContainsKey("MixingStation")) { Sched1PatchesBase.Mod.originalStationCapacities["MixingStation"] = __instance.MaxMixQuantity; } __instance.MaxMixQuantity = Sched1PatchesBase.Mod.GetStationCapacity("MixingStation"); } Sched1PatchesBase.Mod.processedStationCapacities.Add((GridItem)(object)__instance); } if ((Object)(object)__instance.GetProduct() == (Object)null || (Object)(object)__instance.GetMixer() == (Object)null) { __result = 0; return false; } __result = Mathf.Min(Mathf.Min(__instance.ProductSlot.Quantity, __instance.MixerSlot.Quantity), __instance.MaxMixQuantity); return false; } [HarmonyPatch(typeof(MixingStation), "CanStartMix")] [HarmonyPostfix] public static void CanStartMixPostfix(MixingStation __instance, ref bool __result) { __result = __instance.GetMixQuantity() > 0 && __instance.OutputSlot.Quantity == 0; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] public static void IsMixingDonePostfix(MixingStation __instance, ref bool __result) { __result = __instance.CurrentMixOperation != null && __instance.CurrentMixTime >= __instance.GetMixTimeForCurrentOperation(); } [HarmonyPatch(typeof(MixingStation), "GetMixTimeForCurrentOperation")] [HarmonyPrefix] public static bool GetMixTimePrefix(MixingStation __instance, ref int __result) { if (!Sched1PatchesBase.Mod.processedStationSpeeds.Contains((GridItem)(object)__instance)) { if (Sched1PatchesBase.Is<MixingStationMk2>(__instance)) { if (!Sched1PatchesBase.Mod.originalStationTimes.ContainsKey("MixingStationMk2")) { Sched1PatchesBase.Mod.originalStationTimes["MixingStationMk2"] = 3; } __instance.MixTimePerItem = (int)Mathf.Max((float)Sched1PatchesBase.Mod.originalStationTimes["MixingStationMk2"] / Sched1PatchesBase.Mod.GetStationSpeed("MixingStationMk2"), 1f); } else { if (!Sched1PatchesBase.Mod.originalStationTimes.ContainsKey("MixingStation")) { Sched1PatchesBase.Mod.originalStationTimes["MixingStation"] = 15; } __instance.MixTimePerItem = (int)Mathf.Max((float)Sched1PatchesBase.Mod.originalStationTimes["MixingStation"] / Sched1PatchesBase.Mod.GetStationSpeed("MixingStation"), 1f); } Sched1PatchesBase.Mod.processedStationSpeeds.Add((GridItem)(object)__instance); } float stationSpeed; int num; if (Sched1PatchesBase.Is<MixingStationMk2>(__instance)) { stationSpeed = Sched1PatchesBase.Mod.GetStationSpeed("MixingStationMk2"); num = Sched1PatchesBase.Mod.originalStationTimes["MixingStationMk2"]; } else { stationSpeed = Sched1PatchesBase.Mod.GetStationSpeed("MixingStation"); num = Sched1PatchesBase.Mod.originalStationTimes["MixingStation"]; } float num2 = (float)num / stationSpeed; if (__instance.CurrentMixOperation == null) { __result = 0; return false; } __result = (int)Mathf.Max(num2 * (float)__instance.CurrentMixOperation.Quantity, 1f); return false; } [HarmonyPatch(typeof(Chemist), "GetMixStationsReadyToMove")] [HarmonyPrefix] public static bool GetMixStationsReadyToMovePrefix(Chemist __instance, ref List<MixingStation> __result) { List<MixingStation> list = new List<MixingStation>(); foreach (MixingStation mixStation in Sched1PatchesBase.CastTo<ChemistConfiguration>(Sched1PatchesBase.GetProperty(typeof(Chemist), "configuration", __instance)).MixStations) { ItemSlot outputSlot = mixStation.OutputSlot; BuildableItem selectedObject = Sched1PatchesBase.CastTo<MixingStationConfiguration>(mixStation.Configuration).Destination.SelectedObject; if (outputSlot.Quantity == 0 || !((Employee)__instance).MoveItemBehaviour.IsTransitRouteValid(Sched1PatchesBase.CastTo<MixingStationConfiguration>(mixStation.Configuration).DestinationRoute, outputSlot.ItemInstance.ID)) { continue; } if (Sched1PatchesBase.Is<PackagingStation>(selectedObject)) { PackagingStation val = Sched1PatchesBase.CastTo<PackagingStation>(selectedObject); if (val.ProductSlot.ItemInstance == null) { list.Add(mixStation); } else if (val.ProductSlot.ItemInstance.CanStackWith(outputSlot.ItemInstance, true)) { int stackLimit = Sched1PatchesBase.Mod.GetStackLimit(val.ProductSlot.ItemInstance); if (stackLimit - val.ProductSlot.Quantity > stackLimit / 2) { list.Add(mixStation); } } } else { list.Add(mixStation); } } __result = list; return false; } [HarmonyPatch(typeof(StartMixingStationBehaviour), "StartCook")] [HarmonyPrefix] public static void StartCookPrefix(StartMixingStationBehaviour __instance) { if (Sched1PatchesBase.Mod.processedStationCapacities.Contains((GridItem)(object)__instance.targetStation)) { return; } if (Sched1PatchesBase.Is<MixingStationMk2>(__instance)) { if (!Sched1PatchesBase.Mod.originalStationCapacities.ContainsKey("MixingStationMk2")) { Sched1PatchesBase.Mod.originalStationCapacities["MixingStationMk2"] = __instance.targetStation.MaxMixQuantity; } __instance.targetStation.MaxMixQuantity = Sched1PatchesBase.Mod.GetStationCapacity("MixingStationMk2"); } else { if (!Sched1PatchesBase.Mod.originalStationCapacities.ContainsKey("MixingStation")) { Sched1PatchesBase.Mod.originalStationCapacities["MixingStation"] = __instance.targetStation.MaxMixQuantity; } __instance.targetStation.MaxMixQuantity = Sched1PatchesBase.Mod.GetStationCapacity("MixingStation"); } Sched1PatchesBase.Mod.processedStationCapacities.Add((GridItem)(object)__instance.targetStation); } [HarmonyPatch(typeof(MixingStation), "MinPass")] [HarmonyPrefix] public static bool MinPassPrefix(MixingStation __instance) { if (__instance.CurrentMixOperation != null || __instance.OutputSlot.Quantity > 0) { int num = 0; if (__instance.CurrentMixOperation != null) { int currentMixTime = __instance.CurrentMixTime; int currentMixTime2 = __instance.CurrentMixTime; Sched1PatchesBase.SetProperty(typeof(MixingStation), "CurrentMixTime", __instance, currentMixTime2 + 1); num = __instance.GetMixTimeForCurrentOperation(); if (__instance.CurrentMixTime >= num && currentMixTime < num && InstanceFinder.IsServer) { NetworkSingleton<VariableDatabase>.Instance.SetVariableValue("Mixing_Operations_Completed", (NetworkSingleton<VariableDatabase>.Instance.GetValue<float>("Mixing_Operations_Completed") + 1f).ToString(), true); __instance.MixingDone_Networked(); } } if ((Object)(object)__instance.Clock != (Object)null) { __instance.Clock.SetScreenLit(true); __instance.Clock.DisplayMinutes(Mathf.Max(num - __instance.CurrentMixTime, 0)); } if ((Object)(object)__instance.Light != (Object)null) { if (__instance.IsMixingDone) { __instance.Light.isOn = NetworkSingleton<TimeManager>.Instance.DailyMinTotal % 2 == 0; return false; } __instance.Light.isOn = true; return false; } } else { if ((Object)(object)__instance.Clock != (Object)null) { __instance.Clock.SetScreenLit(false); __instance.Clock.DisplayText(string.Empty); } if ((Object)(object)__instance.Light != (Object)null && __instance.IsMixingDone) { __instance.Light.isOn = false; } } return false; } [HarmonyPatch(typeof(StartMixingStationBehaviour), "RpcLogic___StartCook_2166136261")] [HarmonyPrefix] public static bool Rpc_StartCookPrefix(StartMixingStationBehaviour __instance) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown if (Sched1PatchesBase.GetField(typeof(StartMixingStationBehaviour), "startRoutine", __instance) != null) { return false; } if ((Object)(object)__instance.targetStation == (Object)null) { return false; } object obj = MelonCoroutines.Start(StartMixCoroutine(__instance)); Sched1PatchesBase.SetField(typeof(StartMixingStationBehaviour), "startRoutine", __instance, (object)(Coroutine)obj); Sched1PatchesBase.Mod.runningCoroutines.Add(obj); return false; } [IteratorStateMachine(typeof(<StartMixCoroutine>d__8))] private static IEnumerator StartMixCoroutine(StartMixingStationBehaviour behaviour) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <StartMixCoroutine>d__8(0) { behaviour = behaviour }; } [HarmonyPatch(typeof(StartMixingStationBehaviour), "StopCook")] [HarmonyPrefix] public static bool StopCookPrefix(StartMixingStationBehaviour __instance) { if ((Object)(object)__instance.targetStation != (Object)null) { __instance.targetStation.SetNPCUser((NetworkObject)null); } ((Behaviour)__instance).Npc.SetAnimationBool_Networked((NetworkConnection)null, "UseChemistryStation", false); object field = Sched1PatchesBase.GetField(typeof(StartMixingStationBehaviour), "startRoutine", __instance); if (field != null) { MelonCoroutines.Stop(field); Sched1PatchesBase.SetField(typeof(StartMixingStationBehaviour), "startRoutine", __instance, null); Sched1PatchesBase.Mod.runningCoroutines.Remove(field); } return false; } public new static void RestoreDefaults() { try { foreach (GridItem processedStationCapacity in Sched1PatchesBase.Mod.processedStationCapacities) { MixingStation val = Sched1PatchesBase.CastTo<MixingStation>(processedStationCapacity); if (!((Object)(object)val != (Object)null)) { continue; } if (Sched1PatchesBase.Is<MixingStationMk2>(val)) { if (!Sched1PatchesBase.Mod.originalStationCapacities.ContainsKey("MixingStationMk2")) { val.MaxMixQuantity = 20; } else { val.MaxMixQuantity = Sched1PatchesBase.Mod.originalStationCapacities["MixingStationMk2"]; } } else if (!Sched1PatchesBase.Mod.originalStationCapacities.ContainsKey("MixingStation")) { val.MaxMixQuantity = 10; } else { val.MaxMixQuantity = Sched1PatchesBase.Mod.originalStationCapacities["MixingStation"]; } } foreach (GridItem processedStationTime in Sched1PatchesBase.Mod.processedStationTimes) { MixingStation val2 = Sched1PatchesBase.CastTo<MixingStation>(processedStationTime); if (!Sched1PatchesBase.Mod.processedStationTimes.Contains(processedStationTime)) { continue; } if (Sched1PatchesBase.Is<MixingStationMk2>(val2)) { if (!Sched1PatchesBase.Mod.originalStationTimes.ContainsKey("MixingStationMk2")) { val2.MixTimePerItem = 3; } else { val2.MixTimePerItem = Sched1PatchesBase.Mod.originalStationTimes["MixingStationMk2"]; } } else if (!Sched1PatchesBase.Mod.originalStationTimes.ContainsKey("MixingStation")) { val2.MixTimePerItem = 15; } else { val2.MixTimePerItem = Sched1PatchesBase.Mod.originalStationTimes["MixingStation"]; } } } catch (Exception ex) { Sched1PatchesBase.Warn("Couldn't restore defaults for " + MethodBase.GetCurrentMethod().DeclaringType.Name + ": " + ex.GetType().Name + " - " + ex.Message); Sched1PatchesBase.Warn("Source: " + ex.Source); Sched1PatchesBase.Warn(ex.StackTrace ?? ""); if (ex.InnerException != null) { Sched1PatchesBase.Warn("Inner exception: " + ex.InnerException.GetType().Name + " - " + ex.InnerException.Message); Sched1PatchesBase.Warn("Source: " + ex.InnerException.Source); Sched1PatchesBase.Warn(ex.InnerException.StackTrace ?? ""); if (ex.InnerException.InnerException != null) { Sched1PatchesBase.Warn("Inner inner exception: " + ex.InnerException.InnerException.GetType().Name + " - " + ex.InnerException.InnerException.Message); Sched1PatchesBase.Warn("Source: " + ex.InnerException.InnerException.Source); Sched1PatchesBase.Warn(ex.InnerException.InnerException.StackTrace ?? ""); } } } } [HarmonyPatch(typeof(MixingStationUIElement), "Initialize")] [HarmonyPrefix] public static void InitializeUIPrefix(MixingStation station) { int num = (Sched1PatchesBase.Is<MixingStationMk2>(station) ? Sched1PatchesBase.Mod.GetStationCapacity("MixingStationMk2") : Sched1PatchesBase.Mod.GetStationCapacity("MixingStation")); Sched1PatchesBase.CastTo<MixingStationConfiguration>(station.Configuration).StartThrehold.Configure(1f, (float)num, true); } } [HarmonyPatch] public class BrickPressPatches : Sched1PatchesBase { [CompilerGenerated] private sealed class <PackagingCoroutine>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BrickPressBehaviour behaviour; private float <stationSpeed>5__1; private float <packageTime>5__2; private ProductItemInstance <product>5__3; private float <i>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PackagingCoroutine>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <product>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <stationSpeed>5__1 = Sched1PatchesBase.Mod.GetStationWorkSpeed("BrickPress"); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; ((Behaviour)behaviour).Npc.Avatar.Animation.SetBool("UsePackagingStation", true); <packageTime>5__2 = 15f / (Sched1PatchesBase.CastTo<Packager>(((Behaviour)behaviour).Npc).PackagingSpeedMultiplier * <stationSpeed>5__1); <i>5__4 = 0f; goto IL_0127; case 2: <>1__state = -1; <i>5__4 += Time.deltaTime; goto IL_0127; case 3: <>1__state = -1; ((Behaviour)behaviour).Npc.Avatar.Animation.SetTrigger("GrabItem"); behaviour.Press.PlayPressAnim(); <>2__current = (object)new WaitForSeconds(Mathf.Max(0.1f, 1f / <stationSpeed>5__1)); <>1__state = 4; return true; case 4: { <>1__state = -1; if (InstanceFinder.IsServer && behaviour.Press.HasSufficientProduct(ref <product>5__3)) { behaviour.Press.CompletePress(<product>5__3); } Sched1PatchesBase.SetProperty(typeof(BrickPressBehaviour), "PackagingInProgress", behaviour, false); Sched1PatchesBase.SetField(typeof(BrickPressBehaviour), "packagingRoutine", behaviour, null); return false; } IL_0127: if (<i>5__4 < <packageTime>5__2) { ((Behaviour)behaviour).Npc.Avatar.LookController.OverrideLookTarget(behaviour.Press.uiPoint.position, 0, false); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; } ((Behaviour)behaviour).Npc.Avatar.Animation.SetBool("UsePackagingStation", false); <>2__current = (object)new WaitForSeconds(Mathf.Max(0.1f, 0.2f / <stationSpeed>5__1)); <>1__state = 3; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPatch(typeof(BrickPressBehaviour), "RpcLogic___BeginPackaging_2166136261")] [HarmonyPrefix] public static bool Rpc_BeginPackagingPrefix(BrickPressBehaviour __instance) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown if (__instance.PackagingInProgress) { return false; } if ((Object)(object)__instance.Press == (Object)null) { return false; } Sched1PatchesBase.SetProperty(typeof(BrickPressBehaviour), "PackagingInProgress", __instance, true); ((Behaviour)__instance).Npc.Movement.FaceDirection(__instance.Press.StandPoint.forward, 0.5f); object obj = MelonCoroutines.Start(PackagingCoroutine(__instance)); Sched1PatchesBase.SetField(typeof(BrickPressBehaviour), "packagingRoutine", __instance, (object)(Coroutine)obj); Sched1PatchesBase.Mod.runningCoroutines.Add(obj); return false; } [IteratorStateMachine(typeof(<PackagingCoroutine>d__1))] private static IEnumerator PackagingCoroutine(BrickPressBehaviour behaviour) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PackagingCoroutine>d__1(0) { behaviour = behaviour }; } [HarmonyPatch(typeof(BrickPressBehaviour), "StopPackaging")] [HarmonyPrefix] public static bool StopPackagingPrefix(BrickPressBehaviour __instance) { object field = Sched1PatchesBase.GetField(typeof(StartMixingStationBehaviour), "packagingRoutine", __instance); if (field != null) { MelonCoroutines.Stop(field); Sched1PatchesBase.SetField(typeof(BrickPressBehaviour), "packagingRoutine", __instance, null); Sched1PatchesBase.Mod.runningCoroutines.Remove(field); } Sched1PatchesBase.SetField(typeof(BrickPressBehaviour), "PackagingInProgress", __instance, false); return false; } public new static void RestoreDefaults() { } } [HarmonyPatch] public class CauldronPatches : Sched1PatchesBase { [CompilerGenerated] private sealed class <BeginCauldronCoroutine>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public StartCauldronBehaviour behaviour; private float <packageTime>5__1; private float <i>5__2; private EQuality <quality>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BeginCauldronCoroutine>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; ((Behaviour)behaviour).Npc.Avatar.Animation.SetBool("UseChemistryStation", true); <packageTime>5__1 = Mathf.Max(0.1f, 15f / Sched1PatchesBase.Mod.GetStationWorkSpeed("Cauldron")); <i>5__2 = 0f; break; case 2: <>1__state = -1; <i>5__2 += Time.deltaTime; break; } if (<i>5__2 < <packageTime>5__1) { ((Behaviour)behaviour).Npc.Avatar.LookController.OverrideLookTarget(behaviour.Station.LinkOrigin.position, 0, false); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; } ((Behaviour)behaviour).Npc.Avatar.Animation.SetBool("UseChemistryStation", false); if (InstanceFinder.IsServer) { <quality>5__3 = behaviour.Station.RemoveIngredients(); behaviour.Station.StartCookOperation((NetworkConnection)null, behaviour.Station.CookTime, <quality>5__3); } Sched1PatchesBase.SetProperty(typeof(StartCauldronBehaviour), "WorkInProgress", behaviour, false); Sched1PatchesBase.SetField(typeof(StartCauldronBehaviour), "workRoutine", behaviour, null); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPatch(typeof(Cauldron), "UpdateIngredientVisuals")] [HarmonyPrefix] public static bool UpdateIngredientVisualsPatch(Cauldron __instance) { int stackLimit = Sched1PatchesBase.Mod.GetStackLimit("Coca Leaf", (EItemCategory)2); ItemInstance val = default(ItemInstance); int num = default(int); ItemInstance val2 = default(ItemInstance); int num2 = default(int); __instance.GetMainInputs(ref val, ref num, ref val2, ref num2); if (val != null) { __instance.PrimaryTub.Configure((EContents)1, (float)num / (float)stackLimit); } else { __instance.PrimaryTub.Configure((EContents)0, 0f); } if (val2 != null) { __instance.SecondaryTub.Configure((EContents)1, (float)num2 / (float)stackLimit); return false; } __instance.SecondaryTub.Configure((EContents)0, 0f); return false; } [HarmonyPatch(typeof(Cauldron), "StartCookOperation")] [HarmonyPrefix] public static void StartCookOperationPrefix(Cauldron __instance, ref int remainingCookTime) { if (!Sched1PatchesBase.Mod.processedStationTimes.Contains((GridItem)(object)__instance)) { if (!Sched1PatchesBase.Mod.originalStationTimes.ContainsKey("Cauldron")) { Sched1PatchesBase.Mod.originalStationTimes["Cauldron"] = __instance.CookTime; } int cookTime = (int)((float)Sched1PatchesBase.Mod.originalStationTimes["Cauldron"] / Sched1PatchesBase.Mod.GetStationSpeed("Cauldron")); __instance.CookTime = cookTime; Sched1PatchesBase.Mod.processedStationTimes.Add((GridItem)(object)__instance); } remainingCookTime = (int)((float)Sched1PatchesBase.Mod.originalStationTimes["Cauldron"] / Sched1PatchesBase.Mod.GetStationSpeed("Cauldron")); } [HarmonyPatch(typeof(Cauldron), "HasOutputSpace")] [HarmonyPostfix] public static void HasOutputSpacePostfix(Cauldron __instance, ref bool __result) { __result = Sched1PatchesBase.Mod.GetStackLimit((ItemDefinition)(object)__instance.CocaineBaseDefinition) >= 10; } [HarmonyPatch(typeof(Cauldron), "GetState")] [HarmonyPostfix] public static void GetStatePostfix(Cauldron __instance, ref EState __result) { if ((bool)Sched1PatchesBase.GetProperty(typeof(Cauldron), "isCooking", __instance)) { __result = (EState)2; } else if (!__instance.HasIngredients()) { __result = (EState)0; } else if (!__instance.HasOutputSpace()) { __result = (EState)3; } else { __result = (EState)1; } } [HarmonyPatch(typeof(StartCauldronBehaviour), "RpcLogic___BeginCauldron_2166136261")] [HarmonyPrefix] public static bool Rpc_BeginCauldronPrefix(StartCauldronBehaviour __instance) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown if (__instance.WorkInProgress) { return false; } if ((Object)(object)__instance.Station == (Object)null) { return false; } Sched1PatchesBase.SetProperty(typeof(StartCauldronBehaviour), "WorkInProgress", __instance, true); ((Behaviour)__instance).Npc.Movement.FaceDirection(__instance.Station.StandPoint.forward, 0.5f); object obj = MelonCoroutines.Start(BeginCauldronCoroutine(__instance)); Sched1PatchesBase.SetField(typeof(StartCauldronBehaviour), "workRoutine", __instance, (object)(Coroutine)obj); Sched1PatchesBase.Mod.runningCoroutines.Add(obj); return false; } [IteratorStateMachine(typeof(<BeginCauldronCoroutine>d__5))] private static IEnumerator BeginCauldronCoroutine(StartCauldronBehaviour behaviour) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <BeginCauldronCoroutine>d__5(0) { behaviour = behaviour }; } [HarmonyPatch(typeof(StartCauldronBehaviour), "StopCauldron")] [HarmonyPrefix] public static bool StopCauldronPrefix(StartCauldronBehaviour __instance) { object field = Sched1PatchesBase.GetField(typeof(StartCauldronBehaviour), "workRoutine", __instance); if (field != null) { MelonCoroutines.Stop(field); Sched1PatchesBase.SetField(typeof(StartCauldronBehaviour), "workRoutine", __instance, null); Sched1PatchesBase.Mod.runningCoroutines.Remove(field); } if (InstanceFinder.IsServer && (Object)(object)__instance.Station != (Object)null && (Object)(object)__instance.Station.NPCUserObject == (Object)(object)((NetworkBehaviour)((Behaviour)__instance).Npc).NetworkObject) { __instance.Station.SetNPCUser((NetworkObject)null); } Sched1PatchesBase.SetProperty(typeof(StartCauldronBehaviour), "WorkInProgress", __instance, false); return false; } public new static void RestoreDefaults() { try { foreach (GridItem processedStationTime in Sched1PatchesBase.Mod.processedStationTimes) { Cauldron val = Sched1PatchesBase.CastTo<Cauldron>(processedStationTime); if ((Object)(object)val != (Object)null) { if (!Sched1PatchesBase.Mod.originalStationTimes.ContainsKey("Cauldron")) { val.CookTime = 360; val.RemainingCookTime = Mathf.Min(360, val.RemainingCookTime); } else { val.CookTime = Mathf.Min(Sched1PatchesBase.Mod.originalStationTimes["Cauldron"], val.CookTime); val.RemainingCookTime = Mathf.Min(Sched1PatchesBase.Mod.originalStationTimes["Cauldron"], val.RemainingCookTime); } } } } catch (Exception ex) { Sched1PatchesBase.Warn("Couldn't restore defaults for " + MethodBase.GetCurrentMethod().DeclaringType.Name + ": " + ex.GetType().Name + " - " + ex.Message); Sched1PatchesBase.Warn("Source: " + ex.Source); Sched1PatchesBase.Warn(ex.StackTrace ?? ""); if (ex.InnerException != null) { Sched1PatchesBase.Warn("Inner exception: " + ex.InnerException.GetType().Name + " - " + ex.InnerException.Message); Sched1PatchesBase.Warn("Source: " + ex.InnerException.Source); Sched1PatchesBase.Warn(ex.InnerException.StackTrace ?? ""); if (ex.InnerException.InnerException != null) { Sched1PatchesBase.Warn("Inner inner exception: " + ex.InnerException.InnerException.GetType().Name + " - " + ex.InnerException.InnerException.Message); Sched1PatchesBase.Warn("Source: " + ex.InnerException.InnerException.Source); Sched1PatchesBase.Warn(ex.InnerException.InnerException.StackTrace ?? ""); } } } } } [HarmonyPatch] public class PackagingStationPatches : Sched1PatchesBase { [CompilerGenerated] private sealed class <BeginPackagingCoroutine>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PackagingStationBehaviour behaviour; private float <stationWorkSpeed>5__1; private ProductItemInstance <packagedInstance>5__2; private int <outputSpace>5__3; private int <productPerPackage>5__4; private int <availableToPackage>5__5; private int <numPackages>5__6; private float <packageTime>5__7; private float <i>5__8; private float <value>5__9; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BeginPackagingCoroutine>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <packagedInstance>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; case 1: <>1__state = -1; ((Behaviour)behaviour).Npc.Avatar.Animation.SetBool("UsePackagingStation", true); if (Sched1PatchesBase.Is<MixingStationMk2>(behaviour.Station)) { <stationWorkSpeed>5__1 = Sched1PatchesBase.Mod.GetStationWorkSpeed("PackagingStationMk2"); } else { <stationWorkSpeed>5__1 = Sched1PatchesBase.Mod.GetStationWorkSpeed("PackagingStation"); } <packagedInstance>5__2 = Sched1PatchesBase.CastTo<ProductItemInstance>(behaviour.Station.ProductSlot.ItemInstance.GetCopy(1)); <packagedInstance>5__2.SetPackaging(Sched1PatchesBase.CastTo<PackagingDefinition>(behaviour.Station.PackagingSlot.ItemInstance.Definition)); <outputSpace>5__3 = behaviour.Station.OutputSlot.GetCapacityForItem((ItemInstance)(object)<packagedInstance>5__2, false); <productPerPackage>5__4 = Sched1PatchesBase.CastTo<PackagingDefinition>(behaviour.Station.PackagingSlot.ItemInstance.Definition).Quantity; <availableToPackage>5__5 = Mathf.Min(behaviour.Station.ProductSlot.Quantity, behaviour.Station.PackagingSlot.Quantity); <numPackages>5__6 = Mathf.Min(<availableToPackage>5__5 / <productPerPackage>5__4, <outputSpace>5__3); <packageTime>5__7 = Mathf.Max(0.1f, (float)<numPackages>5__6 * 5f / (Sched1PatchesBase.CastTo<Packager>(((Behaviour)behaviour).Npc).PackagingSpeedMultiplier * behaviour.Station.PackagerEmployeeSpeedMultiplier * <stationWorkSpeed>5__1)); <i>5__8 = 0f; break; case 2: <>1__state = -1; <i>5__8 += Time.deltaTime; break; } if (<i>5__8 < <packageTime>5__7) { ((Behaviour)behaviour).Npc.Avatar.LookController.OverrideLookTarget(behaviour.Station.Container.position, 0, false); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 2; return true; } if (InstanceFinder.IsServer) { <value>5__9 = NetworkSingleton<VariableDatabase>.Instance.GetValue<float>("PackagedProductCount"); NetworkSingleton<VariableDatabase>.Instance.SetVariableValue("PackagedProductCount", (<value>5__9 + (float)(<numPackages>5__6 * <productPerPackage>5__4)).ToString(), true); if (behaviour.Station.OutputSlot.ItemInstance == null) { behaviour.Station.OutputSlot.SetStoredItem((ItemInstance)(object)<packagedInstance>5__2, false); behaviour.Station.OutputSlot.SetQuantity(<numPackages>5__6, false); } else { behaviour.Station.OutputSlot.ChangeQuantity(<numPackages>5__6, false); ((ItemInstance)<packagedInstance>5__2).SetQuantity(0); } behaviour.Station.PackagingSlot.ChangeQuantity(-<numPackages>5__6, false); behaviour.Station.ProductSlot.ChangeQuantity(-<numPackages>5__6 * <productPerPackage>5__4, false); } ((Behaviour)behaviour).Npc.Avatar.Animation.SetBool("UsePackagingStation", false); Sched1PatchesBase.SetProperty(typeof(PackagingStationBehaviour), "PackagingInProgress", behaviour, false); Sched1PatchesBase.SetField(typeof(PackagingStationBehaviour), "packagingRoutine", behaviour, null); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPatch(typeof(PackagingStationBehaviour), "RpcLogic___BeginPackaging_2166136261")] [HarmonyPrefix] public static bool RpcLogic_BeginPackagingPrefix(PackagingStationBehaviour __instance) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown if (__instance.PackagingInProgress || (Object)(object)__instance.Station == (Object)null) { return false; } Sched1PatchesBase.SetProperty(typeof(PackagingStationBehaviour), "PackagingInProgress", __instance, true); ((Behaviour)__instance).Npc.Movement.FaceDirection(__instance.Station.StandPoint.forward, 0.5f); object obj = MelonCoroutines.Start(BeginPackagingCoroutine(__instance)); Sched1PatchesBase.SetField(typeof(PackagingStationBehaviour), "packagingRoutine", __instance, (object)(Coroutine)obj); Sched1PatchesBase.Mod.runningCoroutines.Add(obj); return false; } [IteratorStateMachine(typeof(<BeginPackagingCoroutine>d__1))] private static IEnumerator BeginPackagingCoroutine(PackagingStationBehaviour behaviour) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <BeginPackagingCoroutine>d__1(0) { behaviour = behaviour }; } [HarmonyPatch(typeof(PackagingStationBehaviour), "StopPackaging")] [HarmonyPrefix] public static bool StopPackagingPrefix(PackagingStationBehaviour __instance) { object field = Sched1PatchesBase.GetField(typeof(PackagingStationBehaviour), "packagingRoutine", __instance); if (field != null) { MelonCoroutines.Stop(field); Sched1PatchesBase.SetField(typeof(PackagingStationBehaviour), "packagingRoutine", __instance, null); Sched1PatchesBase.Mod.runningCoroutines.Remove(field); } ((Behaviour)__instance).Npc.Avatar.Animation.SetBool("UsePackagingStation", false); if (InstanceFinder.IsServer && (Object)(object)__instance.Station != (Object)null && (Object)(object)__instance.Station.NPCUserObject == (Object)(object)((NetworkBehaviour)((Behaviour)__instance).Npc).NetworkObject) { __instance.Station.SetNPCUser((NetworkObject)null); } Sched1PatchesBase.SetProperty(typeof(PackagingStationBehaviour), "PackagingInProgress", __instance, false); return false; } public new static void RestoreDefaults() { } } [HarmonyPatch] public class PotPatches : Sched1PatchesBase { [CompilerGenerated] private sealed class <PerformActionCoroutine>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public PotActionBehaviour behaviour; private float <stationSpeed>5__1; private string <actionAnimation>5__2; private AvatarEquippable <actionEquippable>5__3; private float <waitTime>5__4; private float <i>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PerformActionCoroutine>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <actionAnimation>5__2 = null; <actionEquippable>5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Invalid comparison between Unknown and I4 //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <stationSpeed>5__1 = Sched1PatchesBase.Mod.GetStationWorkSpeed("Pot"); behaviour.AssignedPot.SetNPCUser(((NetworkBehaviour)Sched1PatchesBase.CastTo<Botanist>(Sched1PatchesBase.GetField(typeof(PotActionBehaviour), "botanist", behaviour))).NetworkObject); ((Behaviour)behaviour).Npc.Movement.FacePoint(((Component)behaviour.AssignedPot).transform.position, Mathf.Max(0.1f, 0.5f / <stationSpeed>5__1)); <actionAnimation>5__2 = (string)Sched1PatchesBase.CallMethod(typeof(PotActionBehaviour), "GetActionAnimation", behaviour, new object[1] { behaviour.CurrentActionType }); if (<actionAnimation>5__2 != string.Empty) { Sched1PatchesBase.SetField(typeof(PotActionBehaviour), "currentActionAnimation", behaviour, <actionAnimation>5__2); ((Behaviour)behaviour).Npc.SetAnimationBool_Networked((NetworkConnection)null, <actionAnimation>5__2, true); } if ((int)behaviour.CurrentActionType == 2 && !((Behaviour)behaviour).Npc.Avatar.Animation.IsCrouched) { ((Behaviour)behaviour).Npc.SetCrouched_Networked(true); } <actionEquippable>5__3 = Sched1PatchesBase.CastTo<AvatarEquippable>(Sched1PatchesBase.CallMethod(typeof(PotActionBehaviour), "GetActionEquippable", behaviour, new object[1] { behaviour.CurrentActionType })); if ((Object)(object)<actionEquippable>5__3 != (Object)null) { Sched1PatchesBase.SetField(typeof(PotActionBehaviour), "currentActionEquippable", behaviour, ((Behaviour)behaviour).Npc.SetEquippable_Networked_Return((NetworkConnection)null, <actionEquippable>5__3.AssetPath)); } <waitTime>5__4 = Mathf.Max(0.1f, behaviour.GetWaitTime(behaviour.CurrentActionType) / <stationSpeed>5__1); <i>5__5 = 0f; break; case 1: <>1__state = -1; <i>5__5 += Time.deltaTime; break; } if (<i>5__5 < <waitTime>5__4) { ((Behaviour)behaviour).Npc.Avatar.LookController.OverrideLookTarget(((Component)behaviour.AssignedPot).transform.position, 0, false); <>2__current = (object)new WaitForEndOfFrame(); <>1__state = 1; return true; } Sched1PatchesBase.CallMethod(typeof(PotActionBehaviour), "StopPerformAction", behaviour, Array.Empty<object>()); Sched1PatchesBase.CallMethod(typeof(PotActionBehaviour), "CompleteAction", behaviour, Array.Empty<object>()); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPatch(typeof(Pot), "GetAdditiveGrowthMultiplier")] [HarmonyPostfix] public static void GetAdditiveGrowthMultiplierPostfix(ref float __result) { __result *= Sched1PatchesBase.Mod.GetStationSpeed("Pot"); } [HarmonyPatch(typeof(PotActionBehaviour), "PerformAction")] [HarmonyPrefix] public static bool PerformActionPrefix(PotActionBehaviour __instance) { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (((Employee)Sched1PatchesBase.CastTo<Botanist>(Sched1PatchesBase.GetField(typeof(PotActionBehaviour), "botanist", __instance))).DEBUG) { string text = "PotActionBehaviour.PerformAction: Performing action "; EActionType currentActionType = __instance.CurrentActionType; string text2 = ((object)(EActionType)(ref currentActionType)).ToString(); string text3 = " on pot "; Pot assignedPot = __instance.AssignedPot; Debug.Log((object)(text + text2 + text3 + (((Object)(object)assignedPot != (Object)null) ? ((object)assignedPot).ToString() : null))); } Sched1PatchesBase.SetProperty(typeof(PotActionBehaviour), "CurrentState", __instance, (object)(EState)4); object obj = MelonCoroutines.Start(PerformActionCoroutine(__instance)); Sched1PatchesBase.SetField(typeof(PotActionBehaviour), "performActionRoutine", __instance, (object)(Coroutine)obj); Sched1PatchesBase.Mod.runningCoroutines.Add(obj); return false; } [IteratorStateMachine(typeof(<PerformActionCoroutine>d__2))] private static IEnumerator PerformActionCoroutine(PotActionBehaviour behaviour) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PerformActionCoroutine>d__2(0) { behaviour = behaviour }; } [HarmonyPatch(typeof(PotActionBehaviour), "StopPerformAction")] [HarmonyPrefix] public static bool StopPerformActionPrefix(PotActionBehaviour __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)__instance.CurrentActionType == 2 && ((Behaviour)__instance).Npc.Avatar.Animation.IsCrouched) { ((Behaviour)__instance).Npc.SetCrouched_Networked(false); } Sched1PatchesBase.SetProperty(typeof(PotActionBehaviour), "CurrentState", __instance, (object)(EState)0); object field = Sched1PatchesBase.GetField(typeof(PotActionBehaviour), "performActionRoutine", __instance); if (field != null) { MelonCoroutines.Stop(field); Sched1PatchesBase.SetField(typeof(PotActionBehaviour), "performActionRoutine", __instance, null); Sched1PatchesBase.Mod.runningCoroutines.Remove(field); } AvatarEquippable val = Sched1PatchesBase.CastTo<AvatarEquippable>(Sched1PatchesBase.GetField(typeof(PotActionBehaviour), "currentActionEquippable", __instance)); if ((Object)(object)val != (Object)null) { ((Behaviour)__instance).Npc.SetEquippable_Networked((NetworkConnection)null, string.Empty); Sched1PatchesBase.SetField(typeof(PotActionBehaviour), "currentActionEquippable", __instance, null); } string text = Sched1PatchesBase.CastTo<string>(Sched1PatchesBase.GetField(typeof(PotActionBehaviour), "currentActionAnimation", __instance)); if (text != string.Empty) { ((Behaviour)__instance).Npc.SetAnimationBool_Networked((NetworkConnection)null, text, false); Sched1PatchesBase.SetField(typeof(PotActionBehaviour), "currentActionAnimation", __instance, string.Empty); } Botanist val2 = Sched1PatchesBase.CastTo<Botanist>(Sched1PatchesBase.GetField(typeof(PotActionBehaviour), "botanist", __instance)); if ((Object)(object)__instance.AssignedPot != (Object)null && (Object)(object)__instance.AssignedPot.NPCUserObject == (Object)(object)((NetworkBehaviour)val2).NetworkObject) { __instance.AssignedPot.SetNPCUser((NetworkObject)null); } return false; } [HarmonyPatch(typeof(PotActionBehaviour), "StopAllActions")] [HarmonyPrefix] public static bool StopAllActionsPrefix(PotActionBehaviour __instance) { if (Sched1PatchesBase.GetField(typeof(PotActionBehaviour), "walkToSuppliesRoutine", __instance) != null) { ((MonoBehaviour)__instance).StopCoroutine(Sched1PatchesBase.CastTo<IEnumerator>(Sched1PatchesBase.GetField(typeof(PotActionBehaviour), "walkToSuppliesRoutine", __instance))); Sched1PatchesBase.SetField(typeof(PotActionBehaviour), "walkToSuppliesRoutine", __instance, null); } if (Sched1PatchesBase.GetField(typeof(PotActionBehaviour), "grabRoutine",