fix(ui): restore retail vitals and window interactions
All checks were successful
CI / linux-portable (push) Successful in 3m16s
CI / windows-gate (push) Successful in 5m41s
CI / release (push) Successful in 2m5s

This commit is contained in:
Erik 2026-08-20 13:26:35 +02:00
parent 4d84456c21
commit 1bd2b30291
36 changed files with 1462 additions and 86 deletions

View file

@ -1483,6 +1483,80 @@ public class InventoryControllerTests
ctrl.OnDragOver(grid, grid.GetItem(0)!, Payload(0xFFFFu))); // grid → green
}
[Fact]
public void GroundPack_rejectsContentsGrid_butEmptyPackSlotAcceptsAndPicksUpAtThatSlot()
{
const uint droppedPack = 0x700000C0u;
var (layout, grid, containers, _, _, _, _, _) = BuildLayout();
var objects = new ClientObjectTable();
objects.AddOrUpdate(new ClientObject
{
ObjectId = Player,
Type = ItemType.Creature,
ItemsCapacity = 102,
ContainersCapacity = 7,
});
SeedBag(objects, 0x500000C1u, slot: 0);
SeedBag(objects, 0x500000C2u, slot: 1);
objects.AddOrUpdate(new ClientObject
{
ObjectId = droppedPack,
Name = "Dropped Pack",
Type = ItemType.Container,
ItemsCapacity = 24,
});
var puts = new List<(uint Item, uint Container, int Placement)>();
using var interaction = new ItemInteractionController(
objects,
new AcDream.Runtime.Gameplay.RuntimeInteractionTransactionState(
new InventoryTransactionState(objects)),
new InteractionState(),
playerGuid: () => Player,
sendUse: null,
sendUseWithTarget: null,
sendWield: null,
sendDrop: null,
groundObjectId: () => droppedPack,
backpackContainerId: () => Player,
placeInBackpack: static (_, _, _) => { });
using var controller = InventoryController.Bind(
layout,
objects,
() => Player,
iconIds: static (_, _, _, _, _) => 0u,
strength: () => 100,
selection: new SelectionState(),
datFont: null,
sendPutItemInContainer: (item, container, placement) =>
puts.Add((item, container, placement)),
itemInteraction: interaction);
var source = new UiItemSlot { SourceKind = ItemDragSource.Ground };
source.SetItem(droppedPack, 0u);
var payload = new ItemDragPayload(
droppedPack,
ItemDragSource.Ground,
SourceSlot: 0,
SourceCell: source);
Assert.Equal(
ItemDragAcceptance.Reject,
controller.OnDragOver(grid, grid.GetItem(0)!, payload));
controller.HandleDropRelease(grid, grid.GetItem(0)!, payload);
Assert.Empty(puts);
UiItemSlot emptyPackSlot = containers.GetItem(2)!;
Assert.Equal(0u, emptyPackSlot.ItemId);
Assert.Equal(
ItemDragAcceptance.Accept,
controller.OnDragOver(containers, emptyPackSlot, payload));
controller.HandleDropRelease(containers, emptyPackSlot, payload);
Assert.Equal(new[] { (droppedPack, Player, 2) }, puts);
Assert.True(interaction.TryGetPendingBackpackPlacement(droppedPack, out var pending));
Assert.Equal(Player, pending.ContainerId);
Assert.Equal(2, pending.Placement);
}
[Fact]
public void OnDragLift_selectsItem_butKeepsItUntilServerConfirms()
{