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:
parent
19e8863f4e
commit
6b1ae4fb76
27 changed files with 875 additions and 20 deletions
|
|
@ -103,6 +103,18 @@ public class UiItemSlot : UiElement
|
|||
/// <summary>RenderSurface id -> (GL texture, w, h). Set by the factory/controller.</summary>
|
||||
public Func<uint, (uint tex, int w, int h)>? SpriteResolve { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DAT-authored 10%..100% radial cooldown overlays from element ids
|
||||
/// <c>0x1000054F..0x10000558</c>.
|
||||
/// </summary>
|
||||
public IReadOnlyList<uint>? CooldownSprites { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bound by the shared cooldown controller. Returns 0 for hidden or 1..10
|
||||
/// for the exact retail overlay step.
|
||||
/// </summary>
|
||||
public Func<uint, int>? CooldownStepProvider { get; set; }
|
||||
|
||||
public void SetItem(
|
||||
uint itemId,
|
||||
uint iconTexture,
|
||||
|
|
@ -387,6 +399,28 @@ public class UiItemSlot : UiElement
|
|||
ctx.DrawSprite(tex, 0f, 0f, Width, Height, 0f, 0f, 1f, 1f, Vector4.One);
|
||||
}
|
||||
}
|
||||
|
||||
// UIElement_UIItem::UpdateCooldownDisplay @ 0x004E1E20 selects exactly
|
||||
// one of ten authored radial overlays. The shared prototype gives these
|
||||
// children ReadOrder 8, above shortcut, waiting, selection, trade, and
|
||||
// drag-accept layers, so the countdown is the final UIItem draw.
|
||||
uint cooldownSprite = ActiveCooldownSprite();
|
||||
if (cooldownSprite != 0u && SpriteResolve is not null)
|
||||
{
|
||||
var (texture, _, _) = SpriteResolve(cooldownSprite);
|
||||
if (texture != 0u)
|
||||
ctx.DrawSprite(
|
||||
texture,
|
||||
0f,
|
||||
0f,
|
||||
Width,
|
||||
Height,
|
||||
0f,
|
||||
0f,
|
||||
1f,
|
||||
1f,
|
||||
Vector4.One);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Draws the shared retail shortcut-number layer. Catalog spell cells
|
||||
|
|
@ -409,4 +443,17 @@ public class UiItemSlot : UiElement
|
|||
if (texture != 0)
|
||||
ctx.DrawSprite(texture, 0f, 0f, Width, Height, 0f, 0f, 1f, 1f, Vector4.One);
|
||||
}
|
||||
|
||||
internal uint ActiveCooldownSprite()
|
||||
{
|
||||
if (ItemId == 0u
|
||||
|| CooldownSprites is null
|
||||
|| CooldownStepProvider is null)
|
||||
return 0u;
|
||||
|
||||
int step = CooldownStepProvider(ItemId);
|
||||
return step is >= 1 and <= 10 && step <= CooldownSprites.Count
|
||||
? CooldownSprites[step - 1]
|
||||
: 0u;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue