fix(ui): assess retained items on right click
Port UIElement_ItemList's physical-item right-click branch through the shared retained list. Select and appraise backpack, loot, paperdoll, and shortcut items through their canonical owners, while preventing RMB movement from lifting items or issuing appraisal requests. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
5ad32d5753
commit
2dd5cb80d2
17 changed files with 264 additions and 5 deletions
|
|
@ -763,6 +763,42 @@ public class ToolbarControllerTests
|
|||
Assert.Equal(itemId, selected);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RightClickPhysicalShortcut_selectsAndExaminesItem()
|
||||
{
|
||||
const uint player = 0x50000001u;
|
||||
const uint itemId = 0x50001001u;
|
||||
var (layout, slots, _) = FakeToolbar();
|
||||
var repo = new ClientObjectTable();
|
||||
repo.AddOrUpdate(new ClientObject { ObjectId = itemId, Type = ItemType.Misc });
|
||||
var shortcuts = new[] { new ShortcutEntry(0, itemId, 0) };
|
||||
var selection = new SelectionState();
|
||||
var appraisals = new List<uint>();
|
||||
using var interaction = new ItemInteractionController(
|
||||
repo,
|
||||
playerGuid: () => player,
|
||||
sendUse: null,
|
||||
sendUseWithTarget: null,
|
||||
sendWield: null,
|
||||
sendDrop: null,
|
||||
sendExamine: appraisals.Add);
|
||||
using var controller = ToolbarController.Bind(
|
||||
layout,
|
||||
repo,
|
||||
() => shortcuts,
|
||||
iconIds: (_, _, _, _, _) => 1u,
|
||||
useItem: _ => { },
|
||||
itemInteraction: interaction,
|
||||
selectItem: id => selection.Select(id, SelectionChangeSource.Toolbar),
|
||||
selection: selection);
|
||||
|
||||
UiItemSlot cell = slots[Row1[0]].Cell;
|
||||
cell.OnEvent(new UiEvent(0u, cell, UiEventType.RightClick));
|
||||
|
||||
Assert.Equal(itemId, selection.SelectedObjectId);
|
||||
Assert.Equal(new uint[] { itemId }, appraisals);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UseShortcut_targetModePrecedesUseAndClearsOneShotMode()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue