Fix put-tools-back bug breaking stuff; deselect on unpack
This commit is contained in:
@@ -318,7 +318,14 @@ namespace UIFixes
|
|||||||
var taskSerializer = itemUiContext.gameObject.AddComponent<ItemContextTaskSerializer>();
|
var taskSerializer = itemUiContext.gameObject.AddComponent<ItemContextTaskSerializer>();
|
||||||
taskSerializer.Initialize(
|
taskSerializer.Initialize(
|
||||||
SortedItemContexts().Where(ic => InteractionAvailable(ic, EItemInfoButton.UnloadAmmo, itemUiContext)),
|
SortedItemContexts().Where(ic => InteractionAvailable(ic, EItemInfoButton.UnloadAmmo, itemUiContext)),
|
||||||
itemContext => itemUiContext.UnloadAmmo(itemContext.Item));
|
itemContext =>
|
||||||
|
{
|
||||||
|
if (itemContext.Item is AmmoBox)
|
||||||
|
{
|
||||||
|
Deselect(itemContext);
|
||||||
|
}
|
||||||
|
return itemUiContext.UnloadAmmo(itemContext.Item);
|
||||||
|
});
|
||||||
|
|
||||||
LoadUnloadSerializer = taskSerializer;
|
LoadUnloadSerializer = taskSerializer;
|
||||||
itemUiContext.Tooltip?.Close();
|
itemUiContext.Tooltip?.Close();
|
||||||
@@ -343,7 +350,11 @@ namespace UIFixes
|
|||||||
var taskSerializer = itemUiContext.gameObject.AddComponent<ItemContextTaskSerializer>();
|
var taskSerializer = itemUiContext.gameObject.AddComponent<ItemContextTaskSerializer>();
|
||||||
taskSerializer.Initialize(
|
taskSerializer.Initialize(
|
||||||
SortedItemContexts().Where(ic => InteractionAvailable(ic, EItemInfoButton.Unpack, itemUiContext)),
|
SortedItemContexts().Where(ic => InteractionAvailable(ic, EItemInfoButton.Unpack, itemUiContext)),
|
||||||
itemContext => itemUiContext.UnpackItem(itemContext.Item));
|
itemContext =>
|
||||||
|
{
|
||||||
|
Deselect(itemContext);
|
||||||
|
return itemUiContext.UnpackItem(itemContext.Item);
|
||||||
|
});
|
||||||
|
|
||||||
itemUiContext.Tooltip?.Close();
|
itemUiContext.Tooltip?.Close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace UIFixes
|
|||||||
}
|
}
|
||||||
|
|
||||||
[PatchPrefix]
|
[PatchPrefix]
|
||||||
public static void Prefix(MagazineClass magazine)
|
public static void Prefix()
|
||||||
{
|
{
|
||||||
if (MultiSelect.Active)
|
if (MultiSelect.Active)
|
||||||
{
|
{
|
||||||
@@ -57,7 +57,7 @@ namespace UIFixes
|
|||||||
}
|
}
|
||||||
|
|
||||||
[PatchPrefix]
|
[PatchPrefix]
|
||||||
public static void Prefix(ref ItemFilter[] filters, Item item)
|
public static void Prefix(ref ItemFilter[] filters)
|
||||||
{
|
{
|
||||||
if (CombinedFilters == null)
|
if (CombinedFilters == null)
|
||||||
{
|
{
|
||||||
@@ -96,7 +96,7 @@ namespace UIFixes
|
|||||||
}
|
}
|
||||||
|
|
||||||
[PatchPrefix]
|
[PatchPrefix]
|
||||||
public static void Prefix(MagazineClass magazine)
|
public static void Prefix()
|
||||||
{
|
{
|
||||||
if (MultiSelect.Active)
|
if (MultiSelect.Active)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -718,9 +718,6 @@ namespace UIFixes
|
|||||||
|
|
||||||
public class AdjustQuickFindFlagsPatch : ModulePatch
|
public class AdjustQuickFindFlagsPatch : ModulePatch
|
||||||
{
|
{
|
||||||
// For reasons (???), BSG doesn't even define the second bit of this flags enum
|
|
||||||
private static readonly InteractionsHandlerClass.EMoveItemOrder PartialMerge = (InteractionsHandlerClass.EMoveItemOrder)2;
|
|
||||||
|
|
||||||
protected override MethodBase GetTargetMethod()
|
protected override MethodBase GetTargetMethod()
|
||||||
{
|
{
|
||||||
return AccessTools.Method(typeof(InteractionsHandlerClass), nameof(InteractionsHandlerClass.QuickFindAppropriatePlace));
|
return AccessTools.Method(typeof(InteractionsHandlerClass), nameof(InteractionsHandlerClass.QuickFindAppropriatePlace));
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using EFT;
|
using EFT;
|
||||||
using EFT.InventoryLogic;
|
using EFT.InventoryLogic;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@@ -25,8 +26,9 @@ namespace UIFixes
|
|||||||
StashClass stash = inventory.Stash;
|
StashClass stash = inventory.Stash;
|
||||||
if (inventory != null && stash != null)
|
if (inventory != null && stash != null)
|
||||||
{
|
{
|
||||||
var handledContainers = new ContainerCollection[] { inventory.Stash, inventory.Equipment, inventory.QuestRaidItems, inventory.QuestStashItems, inventory.SortingTable };
|
// Handled items are either in these top level containers or are nested inside each other (mods, attachments, etc)
|
||||||
var unhandledItems = newItems.Where(i => !handledContainers.Select(c => c.Id).Contains(i.parentId)).ToArray();
|
var handledContainerIds = newItems.Select(i => i._id).Concat([inventory.Stash.Id, inventory.Equipment.Id, inventory.QuestRaidItems.Id, inventory.QuestStashItems.Id, inventory.SortingTable.Id]);
|
||||||
|
var unhandledItems = newItems.Where(i => !String.IsNullOrEmpty(i.parentId) && !handledContainerIds.Contains(i.parentId));
|
||||||
|
|
||||||
if (!unhandledItems.Any())
|
if (!unhandledItems.Any())
|
||||||
{
|
{
|
||||||
@@ -38,7 +40,7 @@ namespace UIFixes
|
|||||||
|
|
||||||
List<Item> stashItems = stash.GetNotMergedItems().ToList();
|
List<Item> stashItems = stash.GetNotMergedItems().ToList();
|
||||||
|
|
||||||
ItemFactory.GStruct134 tree = ___gclass1486_0.FlatItemsToTree(unhandledItems, true, null);
|
ItemFactory.GStruct134 tree = ___gclass1486_0.FlatItemsToTree(unhandledItems.ToArray(), true, null);
|
||||||
foreach (Item item in tree.Items.Values.Where(i => i.CurrentAddress == null))
|
foreach (Item item in tree.Items.Values.Where(i => i.CurrentAddress == null))
|
||||||
{
|
{
|
||||||
GClass1189 newItem = unhandledItems.First(i => i._id == item.Id);
|
GClass1189 newItem = unhandledItems.First(i => i._id == item.Id);
|
||||||
|
|||||||
Reference in New Issue
Block a user