fix(ui): resolve retail spell slot background

Keep shared shortcut digit overlays separate from the per-ItemList background. Resolve the magic favorite list through its cross-layout inherited cell prototype and use the pinned brown/gold ItemSlot_Empty surface instead of the blue toolbar slot.

Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-15 19:23:46 +02:00
parent e3605672bb
commit 09612f9981
9 changed files with 128 additions and 53 deletions

View file

@ -45,7 +45,8 @@ public sealed class SpellcastingUiController : IRetainedPanelController
private readonly Action<uint> _useItem;
private readonly Action<int, int, uint>? _addFavorite;
private readonly Action<int, uint>? _removeFavorite;
private readonly UiShortcutSlotGraphics? _shortcutGraphics;
private readonly UiShortcutDigitGraphics? _shortcutDigits;
private readonly uint _emptySlotSprite;
private readonly UiElement[] _tabs;
private readonly UiElement[] _groups;
private readonly UiItemList?[] _lists;
@ -79,7 +80,8 @@ public sealed class SpellcastingUiController : IRetainedPanelController
UiItemList?[] lists,
UiButton cast,
UiElement endowmentHost,
UiShortcutSlotGraphics? shortcutGraphics)
UiShortcutDigitGraphics? shortcutDigits,
uint emptySlotSprite)
{
_spellbook = spellbook;
_casting = casting;
@ -91,7 +93,8 @@ public sealed class SpellcastingUiController : IRetainedPanelController
_useItem = useItem;
_addFavorite = addFavorite;
_removeFavorite = removeFavorite;
_shortcutGraphics = shortcutGraphics;
_shortcutDigits = shortcutDigits;
_emptySlotSprite = emptySlotSprite;
_tabs = tabs;
_groups = groups;
_lists = lists;
@ -143,7 +146,8 @@ public sealed class SpellcastingUiController : IRetainedPanelController
SelectionState selection,
Action<int, int, uint>? addFavorite,
Action<int, uint>? removeFavorite,
UiShortcutSlotGraphics? shortcutGraphics = null)
UiShortcutDigitGraphics? shortcutDigits = null,
uint emptySlotSprite = 0u)
{
if (layout.FindElement(CastButtonId) is not UiButton cast
|| layout.FindElement(EndowmentId) is not { } endowmentHost)
@ -166,7 +170,8 @@ public sealed class SpellcastingUiController : IRetainedPanelController
layout, spellbook, casting, objects, playerGuid, resolveSpellIcon,
resolveItemDragIcon, useItem, selection,
addFavorite, removeFavorite,
tabs, groups, lists, cast, endowmentHost, shortcutGraphics);
tabs, groups, lists, cast, endowmentHost,
shortcutDigits, emptySlotSprite);
}
public void AddFavorite(uint spellId)
@ -291,6 +296,7 @@ public sealed class SpellcastingUiController : IRetainedPanelController
list.SingleRow = true;
list.CellWidth = 32f;
list.CellHeight = 32f;
list.CellEmptySprite = _emptySlotSprite;
list.EmptySlotFactory = () => CreateEmptyFavoriteSlot(list, targetTab);
list.FillVisibleEmptySlots = true;
foreach (uint spellId in favorites)
@ -332,9 +338,6 @@ public sealed class SpellcastingUiController : IRetainedPanelController
slot = new UiCatalogSlot
{
SpriteResolve = list.SpriteResolve,
EmptySprite = _shortcutGraphics is { EmptySprite: > 0u } graphics
? graphics.EmptySprite
: 0x060074CFu,
Dropped = payload =>
{
int position = Math.Max(0, list.IndexOf(slot!));
@ -362,11 +365,9 @@ public sealed class SpellcastingUiController : IRetainedPanelController
private void ConfigureShortcutOverlay(UiItemSlot slot, int index)
{
slot.RegularDigits = _shortcutGraphics?.RegularDigits;
slot.GhostedDigits = _shortcutGraphics?.GhostedDigits;
slot.EmptyDigits = _shortcutGraphics?.EmptyDigits;
if (_shortcutGraphics is { EmptySprite: > 0u } graphics)
slot.EmptySprite = graphics.EmptySprite;
slot.RegularDigits = _shortcutDigits?.RegularDigits;
slot.GhostedDigits = _shortcutDigits?.GhostedDigits;
slot.EmptyDigits = _shortcutDigits?.EmptyDigits;
if (index < 9)
slot.SetShortcutNum(index, ghosted: false);
else