From a61f0f81566dba95475c626e1260d69123f06fbf Mon Sep 17 00:00:00 2001 From: Tyfon <29051038+tyfon7@users.noreply.github.com> Date: Sat, 31 Aug 2024 10:18:21 -0700 Subject: [PATCH] More MergeConsumables compat - allow swap/stack --- Patches/FixTraderControllerSimulateFalsePatch.cs | 7 ++++++- Plugin.cs | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Patches/FixTraderControllerSimulateFalsePatch.cs b/Patches/FixTraderControllerSimulateFalsePatch.cs index df3b855..fbb6322 100644 --- a/Patches/FixTraderControllerSimulateFalsePatch.cs +++ b/Patches/FixTraderControllerSimulateFalsePatch.cs @@ -27,7 +27,12 @@ public class FixTraderControllerSimulateFalsePatch : ModulePatch { if (!__runOriginal) { - return __runOriginal; + // This is a little hairy, as *some* prefix didn't want to run. If MergeConsumables is present, assume it's that. + // If MC succeeded, bail out. If it failed, we might still want to swap + if (Plugin.MergeConsumablesPresent() && __result.Succeeded) + { + return __runOriginal; + } } TargetItemOperation opStruct; diff --git a/Plugin.cs b/Plugin.cs index 4d84df8..0806dac 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -103,4 +103,16 @@ public class Plugin : BaseUnityPlugin return IsFikaPresent.Value; } + + private static bool? IsMergeConsumablesPresent; + + public static bool MergeConsumablesPresent() + { + if (!IsMergeConsumablesPresent.HasValue) + { + IsMergeConsumablesPresent = Chainloader.PluginInfos.ContainsKey("com.lacyway.mc"); + } + + return IsMergeConsumablesPresent.Value; + } }