cleanup
This commit is contained in:
@@ -15,7 +15,9 @@ global using Scheme = GClass1939;
|
|||||||
global using ItemFilterExtensions = GClass2524;
|
global using ItemFilterExtensions = GClass2524;
|
||||||
global using QuickBindCommandMap = GClass3032;
|
global using QuickBindCommandMap = GClass3032;
|
||||||
global using DiscardResult = GClass2799;
|
global using DiscardResult = GClass2799;
|
||||||
global using BindOperation = GClass2818;
|
global using ItemSorter = GClass2772;
|
||||||
|
global using ItemWithLocation = GClass2521;
|
||||||
|
global using SearchableGrid = GClass2516;
|
||||||
|
|
||||||
// State machine states
|
// State machine states
|
||||||
global using FirearmReadyState = EFT.Player.FirearmController.GClass1619;
|
global using FirearmReadyState = EFT.Player.FirearmController.GClass1619;
|
||||||
@@ -32,13 +34,17 @@ global using GridSpaceTakenError = StashGridClass.GClass3311;
|
|||||||
global using GridModificationsUnavailableError = StashGridClass.GClass3315;
|
global using GridModificationsUnavailableError = StashGridClass.GClass3315;
|
||||||
global using NoRoomError = GClass3316;
|
global using NoRoomError = GClass3316;
|
||||||
global using NoPossibleActionsError = GClass3317;
|
global using NoPossibleActionsError = GClass3317;
|
||||||
|
global using CannotSortError = GClass3325;
|
||||||
|
global using FailedToSortError = GClass3326;
|
||||||
global using MoveSameSpaceError = InteractionsHandlerClass.GClass3353;
|
global using MoveSameSpaceError = InteractionsHandlerClass.GClass3353;
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
global using ItemOperation = GStruct413;
|
global using ItemOperation = GStruct413;
|
||||||
global using MoveOperation = GClass2802;
|
global using MoveOperation = GClass2802;
|
||||||
global using NoOpMove = GClass2795;
|
global using NoOpMove = GClass2795;
|
||||||
|
global using BindOperation = GClass2818;
|
||||||
|
global using SortOperation = GClass2824;
|
||||||
global using TargetItemOperation = TraderControllerClass.Struct775;
|
global using TargetItemOperation = TraderControllerClass.Struct775;
|
||||||
|
|
||||||
// Interfaces
|
// Interfaces
|
||||||
global using IApplicable = GInterface321;
|
global using IApplicable = GInterface321;
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ public class MultiSelect
|
|||||||
if (draggedItemView != null && Count > 1)
|
if (draggedItemView != null && Count > 1)
|
||||||
{
|
{
|
||||||
GameObject textOverlay = new("MultiSelectText", [typeof(RectTransform), typeof(TextMeshProUGUI)]);
|
GameObject textOverlay = new("MultiSelectText", [typeof(RectTransform), typeof(TextMeshProUGUI)]);
|
||||||
textOverlay.transform.parent = draggedItemView.transform;
|
textOverlay.transform.SetParent(draggedItemView.transform, false);
|
||||||
textOverlay.transform.SetAsLastSibling();
|
textOverlay.transform.SetAsLastSibling();
|
||||||
textOverlay.SetActive(true);
|
textOverlay.SetActive(true);
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ public static class ContextMenuShortcutPatches
|
|||||||
{
|
{
|
||||||
protected override MethodBase GetTargetMethod()
|
protected override MethodBase GetTargetMethod()
|
||||||
{
|
{
|
||||||
return AccessTools.Method(typeof(HideoutItemView), nameof(HideoutItemView.OnPointerEnter));
|
return AccessTools.DeclaredMethod(typeof(HideoutItemView), nameof(HideoutItemView.OnPointerEnter));
|
||||||
}
|
}
|
||||||
|
|
||||||
[PatchPostfix]
|
[PatchPostfix]
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public static class FilterOutOfStockPatches
|
|||||||
public static void Postfix(TraderDealScreen __instance, DefaultUIButton ____updateAssort, TradingGridView ____traderGridView)
|
public static void Postfix(TraderDealScreen __instance, DefaultUIButton ____updateAssort, TradingGridView ____traderGridView)
|
||||||
{
|
{
|
||||||
OutOfStockPanel = new GameObject("OutOfStockPanel", [typeof(RectTransform)]);
|
OutOfStockPanel = new GameObject("OutOfStockPanel", [typeof(RectTransform)]);
|
||||||
OutOfStockPanel.transform.parent = __instance.transform.Find("Left Person/Possessions Grid");
|
OutOfStockPanel.transform.SetParent(__instance.transform.Find("Left Person/Possessions Grid"), false);
|
||||||
OutOfStockPanel.transform.SetAsLastSibling();
|
OutOfStockPanel.transform.SetAsLastSibling();
|
||||||
OutOfStockPanel.SetActive(true);
|
OutOfStockPanel.SetActive(true);
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public static class SortPatches
|
|||||||
}
|
}
|
||||||
|
|
||||||
[PatchPrefix]
|
[PatchPrefix]
|
||||||
public static bool Prefix(LootItemClass sortingItem, InventoryControllerClass controller, bool simulate, ref GStruct414<GClass2824> __result)
|
public static bool Prefix(LootItemClass sortingItem, InventoryControllerClass controller, bool simulate, ref GStruct414<SortOperation> __result)
|
||||||
{
|
{
|
||||||
__result = Sorter.Sort(sortingItem, controller, IncludeContainers, simulate);
|
__result = Sorter.Sort(sortingItem, controller, IncludeContainers, simulate);
|
||||||
return false;
|
return false;
|
||||||
@@ -86,7 +86,7 @@ public static class SortPatches
|
|||||||
|
|
||||||
if (error == null)
|
if (error == null)
|
||||||
{
|
{
|
||||||
GStruct414<GClass2824> sortOperation = InteractionsHandlerClass.Sort(lootItem, inventoryController, false);
|
var sortOperation = InteractionsHandlerClass.Sort(lootItem, inventoryController, false);
|
||||||
if (sortOperation.Succeeded)
|
if (sortOperation.Succeeded)
|
||||||
{
|
{
|
||||||
IResult result = await inventoryController.TryRunNetworkTransaction(sortOperation);
|
IResult result = await inventoryController.TryRunNetworkTransaction(sortOperation);
|
||||||
@@ -109,7 +109,6 @@ public static class SortPatches
|
|||||||
private static async Task<Error> StackAll(LootItemClass lootItem, InventoryControllerClass inventoryController)
|
private static async Task<Error> StackAll(LootItemClass lootItem, InventoryControllerClass inventoryController)
|
||||||
{
|
{
|
||||||
Error error = null;
|
Error error = null;
|
||||||
List<GStruct414<GInterface343>> transferOrMergeOperations = [];
|
|
||||||
var mergeableItems = lootItem.Grids.SelectMany(g => g.Items)
|
var mergeableItems = lootItem.Grids.SelectMany(g => g.Items)
|
||||||
.OfType<Stackable>()
|
.OfType<Stackable>()
|
||||||
.Where(i => i.StackObjectsCount < i.StackMaxSize)
|
.Where(i => i.StackObjectsCount < i.StackMaxSize)
|
||||||
@@ -123,7 +122,7 @@ public static class SortPatches
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InteractionsHandlerClass.smethod_0(lootItem.Grids, item, out GClass2751 targetItem, 1))
|
if (InteractionsHandlerClass.smethod_0(lootItem.Grids, item, out Stackable targetItem, 1))
|
||||||
{
|
{
|
||||||
var operation = InteractionsHandlerClass.TransferOrMerge(item, targetItem, inventoryController, true);
|
var operation = InteractionsHandlerClass.TransferOrMerge(item, targetItem, inventoryController, true);
|
||||||
if (operation.Succeeded)
|
if (operation.Succeeded)
|
||||||
|
|||||||
21
Sorter.cs
21
Sorter.cs
@@ -1,17 +1,18 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using EFT.InventoryLogic;
|
using EFT.InventoryLogic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UIFixes;
|
namespace UIFixes;
|
||||||
|
|
||||||
public static class Sorter
|
public static class Sorter
|
||||||
{
|
{
|
||||||
public static GStruct414<GClass2824> Sort(LootItemClass sortingItem, InventoryControllerClass controller, bool includingContainers, bool simulate)
|
public static GStruct414<SortOperation> Sort(LootItemClass sortingItem, InventoryControllerClass controller, bool includingContainers, bool simulate)
|
||||||
{
|
{
|
||||||
GClass2824 operation = new(sortingItem, controller);
|
SortOperation operation = new(sortingItem, controller);
|
||||||
if (!operation.CanExecute(controller))
|
if (!operation.CanExecute(controller))
|
||||||
{
|
{
|
||||||
return new GClass3325(sortingItem);
|
return new CannotSortError(sortingItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Item> itemsToSort = [];
|
List<Item> itemsToSort = [];
|
||||||
@@ -19,7 +20,7 @@ public static class Sorter
|
|||||||
{
|
{
|
||||||
operation.SetOldPositions(grid, grid.ItemCollection.ToListOfLocations());
|
operation.SetOldPositions(grid, grid.ItemCollection.ToListOfLocations());
|
||||||
itemsToSort.AddRange(includingContainers ? grid.Items : grid.Items.Where(i => i is not LootItemClass compoundItem || !compoundItem.Grids.Any()));
|
itemsToSort.AddRange(includingContainers ? grid.Items : grid.Items.Where(i => i is not LootItemClass compoundItem || !compoundItem.Grids.Any()));
|
||||||
var containers = includingContainers ? [] : grid.ItemCollection.Where(kvp => kvp.Key is LootItemClass compoundItem && compoundItem.Grids.Any()).Select(kvp => new GClass2521(kvp.Key, kvp.Value)).ToArray();
|
var containers = includingContainers ? [] : grid.ItemCollection.Where(kvp => kvp.Key is LootItemClass compoundItem && compoundItem.Grids.Any()).Select(kvp => new ItemWithLocation(kvp.Key, kvp.Value)).ToArray();
|
||||||
grid.RemoveAll();
|
grid.RemoveAll();
|
||||||
controller.RaiseEvent(new GEventArgs23(grid));
|
controller.RaiseEvent(new GEventArgs23(grid));
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ public static class Sorter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Item> sortedItems = GClass2772.Sort(itemsToSort);
|
List<Item> sortedItems = ItemSorter.Sort(itemsToSort);
|
||||||
int fallbackTries = 5;
|
int fallbackTries = 5;
|
||||||
InventoryError inventoryError = null;
|
InventoryError inventoryError = null;
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ public static class Sorter
|
|||||||
if (grid.Add(item).Succeeded)
|
if (grid.Add(item).Succeeded)
|
||||||
{
|
{
|
||||||
sorted = true;
|
sorted = true;
|
||||||
operation.AddItemToGrid(grid, new GClass2521(item, ((GridItemAddress)item.CurrentAddress).LocationInGrid));
|
operation.AddItemToGrid(grid, new ItemWithLocation(item, ((GridItemAddress)item.CurrentAddress).LocationInGrid));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -64,7 +65,7 @@ public static class Sorter
|
|||||||
if (stashGridClass3 != null && !stashGridClass3.Add(item).Failed)
|
if (stashGridClass3 != null && !stashGridClass3.Add(item).Failed)
|
||||||
{
|
{
|
||||||
sorted = true;
|
sorted = true;
|
||||||
operation.AddItemToGrid(stashGridClass3, new GClass2521(item, ((ItemAddressClass)item.CurrentAddress).LocationInGrid));
|
operation.AddItemToGrid(stashGridClass3, new ItemWithLocation(item, ((GridItemAddress)item.CurrentAddress).LocationInGrid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,7 +79,7 @@ public static class Sorter
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
inventoryError = new GClass3326(sortingItem);
|
inventoryError = new FailedToSortError(sortingItem);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,9 +98,9 @@ public static class Sorter
|
|||||||
|
|
||||||
foreach (StashGridClass grid in sortingItem.Grids)
|
foreach (StashGridClass grid in sortingItem.Grids)
|
||||||
{
|
{
|
||||||
if (grid.ItemCollection.Any<KeyValuePair<Item, LocationInGrid>>() && grid is GClass2516 searchable)
|
if (grid.ItemCollection.Any<KeyValuePair<Item, LocationInGrid>>() && grid is SearchableGrid searchableGrid)
|
||||||
{
|
{
|
||||||
searchable.FindAll(controller.Profile.ProfileId);
|
searchableGrid.FindAll(controller.Profile.ProfileId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user