feat(ui): Campaign AS AS5 — allegiance rank-title table, exam title bar + character panel name line (G9, narrows AP-109)
Ports the 17-function heritage×gender AllegianceSystem::GetTitle
@0x005B8DD0 dispatch and AllegianceData::GetFullName @0x005B6950 as
AllegianceRankTitleTable (src/AcDream.App/UI/Layout/), then wires both
retail call sites: the examination window's title bar
(AppraisalUiController.BuildCharacterTitleBarName, from ApplyCreature's
character branch) and the character panel's name line
(CharacterSheetProvider.BuildSheet).
Census confirmed directly against the decomp (matches AP-109's
2026-08-25 correction exactly): 11 heritages -> 17 functions. Gearknight
and Tumerok author only a MALE Get*Title function, reused for both
gender dispatch branches; Lugian authors only a FEMALE one, reused for
both. Heritage id 0xA (Penumbraen) aliases to the Shadowbound (5)
functions on both branches. Olthoi/OlthoiAcid (12/13) are excluded by
GetTitle's own unsigned range check (heritage-1) <= 0xa. Every one of
the 17 functions shares an identical unsigned rank bounds test
(rank-1) > 9 -> no title (valid range 1..10; there is no "clamp to
rank-10 title" behavior for an out-of-range rank). All 170 title
strings transcribed verbatim from the decomp, including several
PE-byte-recovered data-literal indirections in the Sho/Gearknight/
Tumerok tables ("Kou", "Ou", "Dux", "Ona", "Rea", "Tah") that match
published AC lore exactly.
GetFullName: title = GetTitle(rank, heritage, gender); when GetTitle
resolves nothing, the output is the plain name; when it resolves, the
output is "title" + a single ASCII space (PE-byte-recovered at
data_794098) + name.
Two call sites independently re-verified against the decomp for the
rank/heritage/gender property ids: CharExamineUI::SetAppraiseInfo's
local AllegianceData struct (proven by its ctor/dtor pair) never shows
an explicit field write for _rank/_hg/_gender in the decompile — a
Binary Ninja struct-flattening artifact, not a missing read — while
gmStatManagementUI::UpdateCharacterInfo shows the same three
CBaseQualities::InqInt(0x71/0xbc/0x1e) calls as plain, unambiguous
locals, confirming Gender=0x71/HeritageGroup=0xBC/AllegianceRank=0x1E
as the three inputs at both sites (ruling R8: read live off the
appraisal/qualities bundle, never RuntimeAllegianceState).
Register: AP-109 is NARROWED, not retired. Its stated risk (a ranked
character's Name line showing plain-name-only) is closed, but the same
CT4 narrowing also flagged FormatXp's non-byte-identical
GetNumberFormatA approximation as "this row's own residual sliver if
one is ever found" — that caveat is untouched by this slice and is now
the row's only surviving open item.
Tests: AllegianceRankTitleTableTests (per-function golden values,
gender-reuse rules, Penumbraen alias, Olthoi exclusion, rank/heritage/
gender bounds, GetFullName composition); AppraisalUiControllerTests
(title-bar prefix, plain-name fallback, monster-path regression pin);
CharacterSheetProviderTests (name-line prefix + plain-name fallback).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
adfce16bf1
commit
8f8c0c3a07
8 changed files with 901 additions and 24 deletions
|
|
@ -459,6 +459,115 @@ public sealed class AppraisalUiControllerTests
|
|||
Assert.Equal("The Empire", HeaderText(layout, 0x1000053Au));
|
||||
}
|
||||
|
||||
// ── Campaign AS slice AS5: title-bar allegiance rank-title prefix ─────
|
||||
// Ground truth: docs/research/2026-08-25-campaign-as-ground-truth.md
|
||||
// §2a's title-bar row, gap G9, ruling R8. Retires register row AP-109.
|
||||
|
||||
[Fact]
|
||||
public void CharacterResponse_TitleBarPrefixesAllegianceRankTitle()
|
||||
{
|
||||
ImportedLayout layout = FixtureLoader.LoadExamination();
|
||||
var objects = new ClientObjectTable();
|
||||
objects.AddOrUpdate(new ClientObject
|
||||
{
|
||||
ObjectId = ObjectId,
|
||||
Name = "Dww",
|
||||
Type = ItemType.Creature,
|
||||
});
|
||||
using var interaction = NewInteraction(objects, []);
|
||||
using AppraisalUiController controller = Bind(
|
||||
layout,
|
||||
objects,
|
||||
interaction,
|
||||
new CombatState(),
|
||||
[],
|
||||
[],
|
||||
() => { },
|
||||
() => { })!;
|
||||
|
||||
interaction.ExamineSelectedOrEnterMode(ObjectId);
|
||||
var properties = new PropertyBundle();
|
||||
properties.Strings[5u] = "Template"; // Character-view marker
|
||||
properties.Ints[0x1Eu] = 3; // AllegianceRank
|
||||
properties.Ints[0xBCu] = 1; // HeritageGroup: Aluvian
|
||||
properties.Ints[0x71u] = 2; // Gender: Female
|
||||
|
||||
Assert.True(controller.Apply(Parsed(properties, MinimalCreatureProfile())));
|
||||
Assert.Equal(AppraisalView.Character, controller.ActiveView);
|
||||
// Aluvian female rank 3 = "Baroness" (AllegianceRankTitleTableTests
|
||||
// pins the table itself); GetFullName's single-space separator.
|
||||
Assert.Equal("Baroness Dww", HeaderText(layout, AppraisalUiController.TitleId));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CharacterResponse_TitleBarPlainNameWhenRankAbsent()
|
||||
{
|
||||
ImportedLayout layout = FixtureLoader.LoadExamination();
|
||||
var objects = new ClientObjectTable();
|
||||
objects.AddOrUpdate(new ClientObject
|
||||
{
|
||||
ObjectId = ObjectId,
|
||||
Name = "Dww",
|
||||
Type = ItemType.Creature,
|
||||
});
|
||||
using var interaction = NewInteraction(objects, []);
|
||||
using AppraisalUiController controller = Bind(
|
||||
layout,
|
||||
objects,
|
||||
interaction,
|
||||
new CombatState(),
|
||||
[],
|
||||
[],
|
||||
() => { },
|
||||
() => { })!;
|
||||
|
||||
interaction.ExamineSelectedOrEnterMode(ObjectId);
|
||||
var properties = new PropertyBundle();
|
||||
properties.Strings[5u] = "Template"; // Character-view marker, no AllegianceRank.
|
||||
|
||||
Assert.True(controller.Apply(Parsed(properties, MinimalCreatureProfile())));
|
||||
Assert.Equal(AppraisalView.Character, controller.ActiveView);
|
||||
Assert.Equal("Dww", HeaderText(layout, AppraisalUiController.TitleId));
|
||||
}
|
||||
|
||||
/// <summary>Regression pin: <c>CreatureExamineUI</c> (monsters) never
|
||||
/// calls <c>AllegianceData::GetFullName</c> — the overwrite is scoped to
|
||||
/// the <c>character</c> branch of <c>ApplyCreature</c> only, even when
|
||||
/// rank/heritage/gender-shaped properties happen to be present.</summary>
|
||||
[Fact]
|
||||
public void CreatureResponse_TitleBarNeverGetsAllegianceRankPrefix()
|
||||
{
|
||||
ImportedLayout layout = FixtureLoader.LoadExamination();
|
||||
var objects = new ClientObjectTable();
|
||||
objects.AddOrUpdate(new ClientObject
|
||||
{
|
||||
ObjectId = ObjectId,
|
||||
Name = "Drudge",
|
||||
Type = ItemType.Creature,
|
||||
});
|
||||
using var interaction = NewInteraction(objects, []);
|
||||
using AppraisalUiController controller = Bind(
|
||||
layout,
|
||||
objects,
|
||||
interaction,
|
||||
new CombatState(),
|
||||
[],
|
||||
[],
|
||||
() => { },
|
||||
() => { })!;
|
||||
|
||||
interaction.ExamineSelectedOrEnterMode(ObjectId);
|
||||
var properties = new PropertyBundle();
|
||||
// No String 5 / Int 0x105 -> monster path, NOT the character view.
|
||||
properties.Ints[0x1Eu] = 3;
|
||||
properties.Ints[0xBCu] = 1;
|
||||
properties.Ints[0x71u] = 2;
|
||||
|
||||
Assert.True(controller.Apply(Parsed(properties, MinimalCreatureProfile())));
|
||||
Assert.Equal(AppraisalView.Creature, controller.ActiveView);
|
||||
Assert.Equal("Drudge", HeaderText(layout, AppraisalUiController.TitleId));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CharacterResponse_HeritageFallsBackToCreatureTypeWhenGroupIsZero()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue