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
|
|
@ -112,7 +112,7 @@ public sealed class ItemAppraisalTextFormatterTests
|
|||
_ => null);
|
||||
|
||||
Assert.Equal(
|
||||
"Value: ???\nBurden: Unknown\n\n"
|
||||
"Value: ???\nBurden: Unknown\n\n\n\n"
|
||||
+ "A hollowed out tree trunk that has a Phyntos Wasp Hive in it.",
|
||||
report.ToString());
|
||||
Assert.DoesNotContain("Can hold", report.ToString());
|
||||
|
|
@ -128,6 +128,16 @@ public sealed class ItemAppraisalTextFormatterTests
|
|||
Assert.Equal(ItemAppraisalSeparator.Line, burden.Separator);
|
||||
Assert.Equal("Burden: Unknown", burden.Text);
|
||||
},
|
||||
tinkeringBoundary =>
|
||||
{
|
||||
Assert.Equal(ItemAppraisalSeparator.Line, tinkeringBoundary.Separator);
|
||||
Assert.Equal(string.Empty, tinkeringBoundary.Text);
|
||||
},
|
||||
specialPropertiesBoundary =>
|
||||
{
|
||||
Assert.Equal(ItemAppraisalSeparator.Line, specialPropertiesBoundary.Separator);
|
||||
Assert.Equal(string.Empty, specialPropertiesBoundary.Text);
|
||||
},
|
||||
description =>
|
||||
{
|
||||
Assert.Equal(ItemAppraisalSeparator.Paragraph, description.Separator);
|
||||
|
|
@ -180,11 +190,59 @@ public sealed class ItemAppraisalTextFormatterTests
|
|||
_ => null);
|
||||
|
||||
Assert.Equal(
|
||||
"Value: ???\nBurden: Unknown\n\n"
|
||||
"Value: ???\nBurden: Unknown\n\n\n\n"
|
||||
+ "Can hold up to 24 items and 1 containers.",
|
||||
report);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Boots_PreserveRetailBlankSectionBoundaries()
|
||||
{
|
||||
var obj = new ClientObject
|
||||
{
|
||||
ObjectId = 0x50000016u,
|
||||
Name = "Steel Toed Boots",
|
||||
Type = ItemType.Clothing,
|
||||
ValidLocations = EquipMask.FootWear,
|
||||
Priority = 0x0001_0000u,
|
||||
};
|
||||
var properties = new PropertyBundle();
|
||||
properties.Ints[19u] = 1_250;
|
||||
properties.Ints[5u] = 180;
|
||||
properties.Ints[105u] = 7;
|
||||
properties.Ints[28u] = 80;
|
||||
AppraiseInfoParser.Parsed appraisal = Parsed(
|
||||
properties,
|
||||
armor: new AppraiseInfoParser.ArmorProfile(
|
||||
SlashingProtection: 1f,
|
||||
PiercingProtection: 1f,
|
||||
BludgeoningProtection: 1f,
|
||||
ColdProtection: 1f,
|
||||
FireProtection: 1f,
|
||||
AcidProtection: 1f,
|
||||
NetherProtection: 1f,
|
||||
LightningProtection: 1f));
|
||||
|
||||
ItemAppraisalReport report = ItemAppraisalTextFormatter.BuildReport(
|
||||
obj,
|
||||
appraisal,
|
||||
_ => null);
|
||||
|
||||
Assert.Contains(
|
||||
"Workmanship: Flawless (7)\n\nCovers Feet\n\nArmor Level: 80",
|
||||
report.ToString());
|
||||
var text = new UiText { Width = 1_000f };
|
||||
string[] lines = ItemAppraisalTextLayout.Shape(text, report)
|
||||
.Select(line => line.Text)
|
||||
.ToArray();
|
||||
int workmanship = Array.IndexOf(lines, "Workmanship: Flawless (7)");
|
||||
Assert.True(workmanship >= 0);
|
||||
Assert.Equal(string.Empty, lines[workmanship + 1]);
|
||||
Assert.Equal("Covers Feet", lines[workmanship + 2]);
|
||||
Assert.Equal(string.Empty, lines[workmanship + 3]);
|
||||
Assert.Equal("Armor Level: 80", lines[workmanship + 4]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BookCapacity_UsesRetailUsedThenTotalPropertyOrder()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue