fix(ui): preserve retail item titles and spacing
Carry PublicWeenieDesc material type into the live object model so examination titles use the DAT-authored material prefix. Preserve retail AddItemInfo empty appends and embedded armor separator, restoring the deliberate blank rows between appraisal sections. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
d78d09cfbc
commit
6718ee45a0
19 changed files with 341 additions and 46 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using AcDream.Content;
|
||||
using AcDream.Core.Items;
|
||||
using DatReaderWriter;
|
||||
using DatReaderWriter.DBObjs;
|
||||
using DatReaderWriter.Types;
|
||||
|
|
@ -86,6 +87,33 @@ public sealed class RetailAppraisalNameResolver
|
|||
? name
|
||||
: string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Port of the material-decoration tail in
|
||||
/// <c>ACCWeenieObject::GetObjectName @ 0x0058E6E0</c>. Retail first
|
||||
/// chooses the singular/plural base name, removes an already-authored
|
||||
/// occurrence of the resolved material, trims it, then prefixes the
|
||||
/// material exactly once.
|
||||
/// </summary>
|
||||
public string ResolveAppropriateName(ClientObject obj)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(obj);
|
||||
|
||||
string baseName = obj.GetAppropriateName();
|
||||
if (obj.MaterialType is not { } materialType)
|
||||
return baseName;
|
||||
|
||||
string material = ResolveMaterial(unchecked((int)materialType));
|
||||
if (string.IsNullOrEmpty(material))
|
||||
return baseName;
|
||||
|
||||
string remainder = baseName
|
||||
.Replace(material, string.Empty, StringComparison.Ordinal)
|
||||
.Trim();
|
||||
return string.IsNullOrEmpty(remainder)
|
||||
? material
|
||||
: $"{material} {remainder}";
|
||||
}
|
||||
|
||||
private static string Normalize(string value)
|
||||
=> value.Replace('_', ' ');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue