From 8d52aa21c94e2b31867b0b028bb0ed320970b920 Mon Sep 17 00:00:00 2001 From: ShinCFN Date: Sun, 22 Dec 2024 20:31:40 +0800 Subject: [PATCH] Updated for 3.10.x --- .../QuickTransferPatch.cs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/CactusPie.ContainerQuickLoot/QuickTransferPatch.cs b/src/CactusPie.ContainerQuickLoot/QuickTransferPatch.cs index 0c28603..b3b5b15 100644 --- a/src/CactusPie.ContainerQuickLoot/QuickTransferPatch.cs +++ b/src/CactusPie.ContainerQuickLoot/QuickTransferPatch.cs @@ -23,11 +23,11 @@ namespace CactusPie.ContainerQuickLoot [PatchPrefix] public static bool PatchPrefix( - ref GStruct414 __result, + ref GStruct446 __result, object __instance, Item item, TraderControllerClass controller, - IEnumerable targets, + IEnumerable targets, InteractionsHandlerClass.EMoveItemOrder order, bool simulate) { @@ -80,7 +80,7 @@ namespace CactusPie.ContainerQuickLoot } // ReSharper disable once PossibleMultipleEnumeration - if (!(targets.SingleOrDefaultWithoutException() is EquipmentClass)) + if (!(targets.SingleOrDefaultWithoutException() is InventoryEquipment)) { continue; } @@ -99,19 +99,19 @@ namespace CactusPie.ContainerQuickLoot continue; } - GStruct414 mergeResult = InteractionsHandlerClass.Merge(item, containedItem.Key, controller, simulate); - __result = new GStruct414(mergeResult.Value); + GStruct446 mergeResult = InteractionsHandlerClass.Merge(item, containedItem.Key, controller, simulate); + __result = new GStruct446(mergeResult.Value); return false; } } - ItemAddressClass location = container.FindLocationForItem(item); + ItemAddress location = container.FindLocationForItem(item); if (location == null) { continue; } - GStruct414 moveResult = InteractionsHandlerClass.Move(item, location, controller, simulate); + GStruct446 moveResult = InteractionsHandlerClass.Move(item, location, controller, simulate); if (moveResult.Failed) { return true; @@ -119,7 +119,7 @@ namespace CactusPie.ContainerQuickLoot if (!moveResult.Value.ItemsDestroyRequired) { - __result = moveResult.Cast(); + __result = moveResult.Cast(); } return false; @@ -140,7 +140,7 @@ namespace CactusPie.ContainerQuickLoot // Logger.LogError("在这里代表gameworld==null"); return false; } - + Player player = GetLocalPlayerFromWorld(gameWorld); // inventory = (Inventory)typeof(Player) // .GetProperty("Inventory", BindingFlags.NonPublic | BindingFlags.Instance) @@ -158,7 +158,7 @@ namespace CactusPie.ContainerQuickLoot private static IEnumerable FindTargetContainers(Item item, Inventory inventory) { - var matchingContainerCollections = new List<(ContainerCollection containerCollection, int priority)>(); + var matchingContainerCollections = new List<(GClass2981 containerCollection, int priority)>(); string tag = ContainerQuickLootPlugin.CustomizeTagForLootContainers.Value.ToString(); Regex lootTagRegex = new Regex @@ -191,7 +191,7 @@ namespace CactusPie.ContainerQuickLoot } // We check if any of the containers in the collection can hold our item - var containerCollection = inventoryItem as ContainerCollection; + var containerCollection = inventoryItem as GClass2981; if (containerCollection == null || !containerCollection.Containers.Any(container => container.CanAccept(item))) { @@ -221,7 +221,7 @@ namespace CactusPie.ContainerQuickLoot Inventory inventory, TraderControllerClass controller, bool simulate, - ref GStruct414 result) + ref GStruct446 result) { if (!ContainerQuickLootPlugin.AutoMergeStacksForNonLootContainers.Value) { @@ -236,7 +236,7 @@ namespace CactusPie.ContainerQuickLoot foreach (Item targetItem in inventory.Equipment.GetNotMergedItems().Reverse()) { if (targetItem.Template._id != item.Template._id) - { + { continue; } @@ -245,14 +245,14 @@ namespace CactusPie.ContainerQuickLoot continue; } - GStruct414 mergeResult = InteractionsHandlerClass.Merge(item, targetItem, controller, simulate); + GStruct446 mergeResult = InteractionsHandlerClass.Merge(item, targetItem, controller, simulate); if (!mergeResult.Succeeded) { return false; } - result = new GStruct414(mergeResult.Value); + result = new GStruct446(mergeResult.Value); return true; }