feat(items): port retail shared cooldown overlays

Preserve public shared-cooldown metadata, resolve the authoritative cooldown enchantment with retail expiry semantics, and project the exact ten DAT-authored radial steps through the shared retained item-slot architecture.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-23 10:41:16 +02:00
parent 19e8863f4e
commit 6b1ae4fb76
27 changed files with 875 additions and 20 deletions

View file

@ -39,6 +39,30 @@ public sealed class UiItemList : UiElement
public Func<uint, (uint tex, int w, int h)>? SpriteResolve { get; set; }
private IReadOnlyList<uint>? _cooldownSprites;
public IReadOnlyList<uint>? CooldownSprites
{
get => _cooldownSprites;
set
{
_cooldownSprites = value;
foreach (UiItemSlot cell in _cells)
cell.CooldownSprites = value;
}
}
private Func<uint, int>? _cooldownStepProvider;
public Func<uint, int>? CooldownStepProvider
{
get => _cooldownStepProvider;
set
{
_cooldownStepProvider = value;
foreach (UiItemSlot cell in _cells)
cell.CooldownStepProvider = value;
}
}
/// <summary>
/// Optional non-weenie catalog drop target. Used by retail spell shortcuts;
/// physical-item drops continue through <see cref="DragHandler"/>.
@ -92,6 +116,8 @@ public sealed class UiItemList : UiElement
public void AddItem(UiItemSlot cell)
{
cell.SpriteResolve ??= SpriteResolve;
cell.CooldownSprites ??= _cooldownSprites;
cell.CooldownStepProvider ??= _cooldownStepProvider;
if (_cellEmptySprite != 0) cell.EmptySprite = _cellEmptySprite;
// The list lays cells out procedurally (grid offset + scroll clip), so cells must be
// EXEMPT from the parent anchor pass — UiElement.DrawSelfAndChildren runs ApplyAnchor
@ -271,6 +297,8 @@ public sealed class UiItemList : UiElement
{
UiItemSlot cell = EmptySlotFactory?.Invoke() ?? new UiItemSlot();
cell.SpriteResolve ??= SpriteResolve;
cell.CooldownSprites ??= _cooldownSprites;
cell.CooldownStepProvider ??= _cooldownStepProvider;
if (_cellEmptySprite != 0) cell.EmptySprite = _cellEmptySprite;
cell.Anchors = AnchorEdges.None;
_cells.Add(cell);