From a93fcd0e6bc593d26512175ceda079464dfd081c Mon Sep 17 00:00:00 2001 From: Tyfon <29051038+tyfon7@users.noreply.github.com> Date: Wed, 15 May 2024 02:26:00 -0700 Subject: [PATCH] Try to block swapping to traders even if other mods allow it --- Patches/SwapPatch.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Patches/SwapPatch.cs b/Patches/SwapPatch.cs index d890caf..de28a0a 100644 --- a/Patches/SwapPatch.cs +++ b/Patches/SwapPatch.cs @@ -46,6 +46,8 @@ namespace UIFixes // The most recent GridItemView that was hovered - needed to forcibly update hover state after swap private static GridItemView LastHoveredGridItemView; + private static EOwnerType[] BannedOwnerTypes = [EOwnerType.Mail, EOwnerType.Trader]; + public static void Enable() { GridItemAddressType = PatchConstants.EftTypes.First(t => typeof(ItemAddress).IsAssignableFrom(t) && t.GetProperty("Grid") != null); // GClass2769 @@ -92,6 +94,11 @@ namespace UIFixes return false; } + if (BannedOwnerTypes.Contains(itemContext.Item.Owner.OwnerType) || BannedOwnerTypes.Contains(targetItemContext.Item.Owner.OwnerType)) + { + return false; + } + if (itemContext.Item == targetItemContext.Item || targetItemContext.Item.GetAllParentItems().Contains(itemContext.Item)) { return false;