fix(ui): match retail item appraisal semantics

Preserve PublicWeenieDesc hook identity from CreateObject through the item model so hook appraisals suppress sentinel capacities exactly. Use appraisal-only Value and Burden presence, retain AddItemInfo paragraph and authored font-color selection, and port retail lock, page, enchantment, and spell-block formatting.

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-23 18:04:19 +02:00
parent bc47bc4917
commit d3c5e06fdd
21 changed files with 982 additions and 145 deletions

View file

@ -385,4 +385,38 @@ public static class ElementReader
}
}
}
/// <summary>
/// Resolves an authored color or color-array property after the retail
/// DirectState/default-state inheritance rules have been applied.
/// </summary>
internal static Vector4[] ReadEffectiveColorPalette(
ElementInfo info,
uint propertyId)
{
ArgumentNullException.ThrowIfNull(info);
if (!info.TryGetEffectiveProperty(propertyId, out UiPropertyValue value))
return [];
IEnumerable<UiPropertyValue> entries = value.Kind switch
{
UiPropertyKind.Color => [value],
UiPropertyKind.Array => value.ArrayValue,
_ => [],
};
return entries
.Where(entry => entry.Kind == UiPropertyKind.Color)
.Select(entry =>
{
UiColorValue color = entry.ColorValue;
float alpha = color.Alpha == 0 ? 1f : color.Alpha / 255f;
return new Vector4(
color.Red / 255f,
color.Green / 255f,
color.Blue / 255f,
alpha);
})
.ToArray();
}
}