feat(ui): port retail spellbook interactions

Resolve the authored spell shortcut row prototype so the spellbook presents the retail icon, name, separator, selected overlay, and scrollbar geometry. Port exact school and level filters, stable display ordering, selection exposure, and learned-spell drags into the open favorite bar.

Route deletion through the shared retail confirmation dialog and send CM_Magic::Event_RemoveSpell only after an affirmative answer, leaving the inbound server notice authoritative for list state.

Co-Authored-By: Codex <noreply@openai.com>
This commit is contained in:
Erik 2026-07-15 16:26:30 +02:00
parent ad30c37a48
commit ac2ca8f965
17 changed files with 727 additions and 47 deletions

View file

@ -43,4 +43,43 @@ public class UiItemListTests
list.CellEmptySprite = 0u;
Assert.Equal(0x060074CFu, list.GetItem(0)!.EmptySprite); // unchanged default
}
[Fact]
public void CatalogDrop_routes_payload_and_local_coordinates()
{
var list = new UiItemList();
object payload = new();
(object Payload, int X, int Y)? received = null;
list.CatalogDropped = (value, x, y) => received = (value, x, y);
bool handled = list.OnEvent(new UiEvent(
0, list, UiEventType.DropReleased, Data1: 17, Data2: 9, Payload: payload));
Assert.True(handled);
Assert.NotNull(received);
Assert.Same(payload, received.Value.Payload);
Assert.Equal((17, 9), (received.Value.X, received.Value.Y));
}
[Fact]
public void ScrollItemIntoView_moves_only_when_row_is_outside_viewport()
{
var list = new UiItemList
{
Width = 100f,
Height = 64f,
Columns = 1,
CellWidth = 100f,
CellHeight = 32f,
};
list.Flush();
for (int i = 0; i < 5; i++) list.AddItem(new UiItemSlot());
list.ScrollItemIntoView(3);
Assert.Equal(64, list.Scroll.ScrollY);
list.ScrollItemIntoView(2);
Assert.Equal(64, list.Scroll.ScrollY);
list.ScrollItemIntoView(0);
Assert.Equal(0, list.Scroll.ScrollY);
}
}