feat(ui): D.2b item interaction + retail cursors + live character sheet
Lands the codex-worktree D.2b stream plus the extraction the 2026-07-02 UI architecture review mandated before commit: - ItemInteractionController: single owner of double-click use/equip/ container-open, targeted-use mode (health kits), drag-out drop; toolbar shortcut drags don't drop the real item. ItemEquipRules for multi-slot (coat) coverage via equip masks. - Cursor phase: CursorFeedbackController (semantic priority chain: drag > resize > window-move > target-mode > text) + RetailCursorCatalog (enums 0x27/0x28/0x29, hotspot 14,14; ClientUISystem::UpdateCursorState 0x00564630) resolved through the portal EnumIDMap chain by RetailCursorResolver; RetailCursorManager applies dat cursor art to the OS cursor. Register row AP-72 covers the OS standard-cursor fallback. - Character window goes live: CharacterSheetProvider owns sheet assembly, XP-curve/raise-cost math and the raise flow — extracted out of GameWindow per Code Structure Rule 1 instead of committing the ~430-line feature body there. Optimistic XP/credit debits go through eventful store APIs (new ClientObjectTable.UpdateInt64Property + LocalPlayerState.DebitIntProperty/DebitInt64Property) instead of raw property-dictionary writes; register row AP-73 covers the still-missing raise ledger (#163). - RetailWindowFrame: the shared nine-slice window mount recipe; the character window uses it, remaining windows migrate via #164. - Status-bar buttons toggle inventory/character windows; retail row-major backpack ordering; WorldSession.SendUseWithTarget + raise/train sends. GameWindow shrinks 14,214 -> 13,877 lines despite the new features; the sheet/raise logic is unit-tested in CharacterSheetProviderTests instead of trapped in the god object. Build green; full suite 3,286 tests pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
e3fc7ac5ba
commit
b7dc91a053
74 changed files with 6669 additions and 238 deletions
|
|
@ -239,9 +239,12 @@ public static class GameEventWiring
|
|||
{
|
||||
var p = GameEvents.ParseWieldObject(e.Payload.Span);
|
||||
if (p is null) return;
|
||||
uint wielderGuid = p.Value.WielderGuid != 0u
|
||||
? p.Value.WielderGuid
|
||||
: (playerGuid?.Invoke() ?? 0u);
|
||||
items.MoveItem(
|
||||
p.Value.ItemGuid,
|
||||
newContainerId: p.Value.WielderGuid,
|
||||
newContainerId: wielderGuid,
|
||||
newEquipLocation: (AcDream.Core.Items.EquipMask)p.Value.EquipLoc);
|
||||
items.ConfirmMove(p.Value.ItemGuid); // Slice 1: confirm an optimistic wield (mirrors the 0x0022 handler)
|
||||
});
|
||||
|
|
@ -249,7 +252,11 @@ public static class GameEventWiring
|
|||
{
|
||||
var p = GameEvents.ParsePutObjInContainer(e.Payload.Span);
|
||||
if (p is null) return;
|
||||
items.MoveItem(p.Value.ItemGuid, p.Value.ContainerGuid, newSlot: (int)p.Value.Placement);
|
||||
items.MoveItem(
|
||||
p.Value.ItemGuid,
|
||||
p.Value.ContainerGuid,
|
||||
newSlot: (int)p.Value.Placement,
|
||||
containerTypeHint: p.Value.ContainerType);
|
||||
items.ConfirmMove(p.Value.ItemGuid); // B-Drag: the server confirmed our optimistic move
|
||||
});
|
||||
|
||||
|
|
@ -262,9 +269,12 @@ public static class GameEventWiring
|
|||
{
|
||||
var p = GameEvents.ParseViewContents(e.Payload.Span);
|
||||
if (p is null) return;
|
||||
var guids = new uint[p.Value.Items.Count];
|
||||
for (int i = 0; i < guids.Length; i++) guids[i] = p.Value.Items[i].Guid;
|
||||
items.ReplaceContents(p.Value.ContainerGuid, guids);
|
||||
var entries = new ContainerContentEntry[p.Value.Items.Count];
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
entries[i] = new ContainerContentEntry(
|
||||
p.Value.Items[i].Guid,
|
||||
p.Value.Items[i].ContainerType);
|
||||
items.ReplaceContents(p.Value.ContainerGuid, entries);
|
||||
});
|
||||
|
||||
// B-Wire: InventoryPutObjectIn3D (0x019A) — server confirms an item dropped
|
||||
|
|
@ -273,7 +283,11 @@ public static class GameEventWiring
|
|||
dispatcher.Register(GameEventType.InventoryPutObjectIn3D, e =>
|
||||
{
|
||||
var guid = GameEvents.ParsePutObjectIn3D(e.Payload.Span);
|
||||
if (guid is not null) items.MoveItem(guid.Value, newContainerId: 0u);
|
||||
if (guid is not null)
|
||||
{
|
||||
items.MoveItem(guid.Value, newContainerId: 0u);
|
||||
items.ConfirmMove(guid.Value);
|
||||
}
|
||||
});
|
||||
|
||||
// B-Drag: InventoryServerSaveFailed (0x00A0) — server rejected an optimistic move.
|
||||
|
|
@ -284,8 +298,12 @@ public static class GameEventWiring
|
|||
var p = GameEvents.ParseInventoryServerSaveFailed(e.Payload.Span);
|
||||
if (p is null) return;
|
||||
// B-Drag: the server rejected an optimistic move — snap the item back to its pre-move slot.
|
||||
if (!items.RollbackMove(p.Value.ItemGuid))
|
||||
Console.WriteLine($"[B-Drag] InventoryServerSaveFailed guid=0x{p.Value.ItemGuid:X8} err=0x{p.Value.WeenieError:X} (no pending move)");
|
||||
var item = items.Get(p.Value.ItemGuid);
|
||||
string itemInfo = item is null
|
||||
? "unknown"
|
||||
: $"'{item.Name}' valid=0x{(uint)item.ValidLocations:X8} equip=0x{(uint)item.CurrentlyEquippedLocation:X8} priority=0x{item.Priority:X8} container=0x{item.ContainerId:X8} wielder=0x{item.WielderId:X8}";
|
||||
bool rolledBack = items.RollbackMove(p.Value.ItemGuid);
|
||||
Console.WriteLine($"[B-Drag] InventoryServerSaveFailed guid=0x{p.Value.ItemGuid:X8} err=0x{p.Value.WeenieError:X} rolledBack={rolledBack} item={itemInfo}");
|
||||
});
|
||||
|
||||
// B-Wire: CloseGroundContainer (0x0052) — server closed a ground-container
|
||||
|
|
@ -366,6 +384,8 @@ public static class GameEventWiring
|
|||
|
||||
if (localPlayer is not null)
|
||||
{
|
||||
localPlayer.OnProperties(p.Value.Properties);
|
||||
|
||||
foreach (var attr in p.Value.Attributes)
|
||||
{
|
||||
if (attr.Current is uint cur)
|
||||
|
|
@ -408,14 +428,12 @@ public static class GameEventWiring
|
|||
// component; .Ranks is XP-bought additions. Their sum is
|
||||
// the closest we get to ACE's CreatureSkill.Current short
|
||||
// of porting the full Aug/Multiplier/Vitae chain.
|
||||
if (onSkillsUpdated is not null)
|
||||
if (localPlayer is not null || onSkillsUpdated is not null)
|
||||
{
|
||||
int runSkill = -1;
|
||||
int jumpSkill = -1;
|
||||
foreach (var s in p.Value.Skills)
|
||||
{
|
||||
if (s.SkillId != 22u && s.SkillId != 24u) continue;
|
||||
|
||||
// K-fix13: total = AttributeFormula(skill, attrs)
|
||||
// + InitLevel (s.Init from wire)
|
||||
// + Ranks (s.Ranks from wire)
|
||||
|
|
@ -428,6 +446,19 @@ public static class GameEventWiring
|
|||
uint formulaBonus = resolveSkillFormulaBonus is not null
|
||||
? resolveSkillFormulaBonus(s.SkillId, attrCurrents)
|
||||
: 0u;
|
||||
|
||||
localPlayer?.OnSkillUpdate(
|
||||
skillId: s.SkillId,
|
||||
ranks: s.Ranks,
|
||||
status: s.Status,
|
||||
xp: s.Xp,
|
||||
init: s.Init,
|
||||
resistance: s.Resistance,
|
||||
lastUsed: s.LastUsed,
|
||||
formulaBonus: formulaBonus);
|
||||
|
||||
if (s.SkillId != 22u && s.SkillId != 24u) continue;
|
||||
|
||||
int total = (int)(formulaBonus + s.Init + s.Ranks);
|
||||
if (s.SkillId == 24u) runSkill = total;
|
||||
else if (s.SkillId == 22u) jumpSkill = total;
|
||||
|
|
@ -437,7 +468,7 @@ public static class GameEventWiring
|
|||
$"vitals: PD-skill id={s.SkillId} init={s.Init} ranks={s.Ranks} formulaBonus={formulaBonus} total={total}");
|
||||
}
|
||||
if (runSkill >= 0 || jumpSkill >= 0)
|
||||
onSkillsUpdated(runSkill, jumpSkill);
|
||||
onSkillsUpdated?.Invoke(runSkill, jumpSkill);
|
||||
}
|
||||
|
||||
// Issue #7 — enchantment block: feed each entry into the
|
||||
|
|
@ -463,8 +494,21 @@ public static class GameEventWiring
|
|||
// actual weenie data via ObjectTableWiring. (Previously this seeded
|
||||
// stubs with WeenieClassId = ContainerType, a misuse — ContainerType
|
||||
// is a 0/1/2 container-kind discriminator, not a weenie class id.)
|
||||
foreach (var inv in p.Value.Inventory)
|
||||
items.RecordMembership(inv.Guid);
|
||||
uint ownerGuid = playerGuid?.Invoke() ?? 0u;
|
||||
if (ownerGuid != 0u)
|
||||
{
|
||||
var entries = new ContainerContentEntry[p.Value.Inventory.Count];
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
entries[i] = new ContainerContentEntry(
|
||||
p.Value.Inventory[i].Guid,
|
||||
p.Value.Inventory[i].ContainerType);
|
||||
items.ReplaceContents(ownerGuid, entries);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var inv in p.Value.Inventory)
|
||||
items.RecordMembership(inv.Guid, containerTypeHint: inv.ContainerType);
|
||||
}
|
||||
foreach (var eq in p.Value.Equipped)
|
||||
items.RecordMembership(eq.Guid, equip: (EquipMask)eq.EquipLocation);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue