feat(D.5.1): persist PlayerDescription shortcuts (were parsed then discarded)
Add optional `onShortcuts` callback to `GameEventWiring.WireAll`; invoke it with `parsed.Shortcuts` after the inventory/equipped loops in the PlayerDescription handler. `GameWindow` holds the list in a new `Shortcuts` property (initialized to empty) so the toolbar (D.5.1 Task 5) can read hotbar slots without keeping a parser reference. Existing callers compile unchanged — the parameter defaults to null. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5382d0a9d2
commit
6c485c2f06
3 changed files with 83 additions and 2 deletions
|
|
@ -596,6 +596,9 @@ public sealed class GameWindow : IDisposable
|
|||
public readonly AcDream.Core.Spells.SpellTable SpellTable = LoadSpellTable();
|
||||
public readonly AcDream.Core.Spells.Spellbook SpellBook = null!;
|
||||
public readonly AcDream.Core.Items.ItemRepository Items = new();
|
||||
/// <summary>Persisted hotbar shortcuts from the last PlayerDescription (D.5.1 toolbar source).</summary>
|
||||
public IReadOnlyList<AcDream.Core.Net.Messages.PlayerDescriptionParser.ShortcutEntry> Shortcuts { get; private set; }
|
||||
= System.Array.Empty<AcDream.Core.Net.Messages.PlayerDescriptionParser.ShortcutEntry>();
|
||||
// Issue #5 — caches CreatureProfile.{Stamina, Mana, *Max} from
|
||||
// PlayerDescription so the Vitals HUD can render those bars.
|
||||
// Issue #6 — wired to SpellBook so GetMaxApprox folds enchantment
|
||||
|
|
@ -2309,7 +2312,8 @@ public sealed class GameWindow : IDisposable
|
|||
_lastSeenRunSkill, _lastSeenJumpSkill);
|
||||
Console.WriteLine($"player: applied server skills run={_lastSeenRunSkill} jump={_lastSeenJumpSkill}");
|
||||
}
|
||||
});
|
||||
},
|
||||
onShortcuts: list => Shortcuts = list);
|
||||
|
||||
// Phase I.7: subscribe to CombatState events and emit
|
||||
// retail-faithful "You hit X for Y damage" chat lines into
|
||||
|
|
|
|||
|
|
@ -61,7 +61,11 @@ public static class GameEventWiring
|
|||
// (matching ACE's CreatureSkill.Current minus
|
||||
// augs/multipliers/vitae which we still don't model).
|
||||
Action<int /*runSkill*/, int /*jumpSkill*/>? onSkillsUpdated = null,
|
||||
Func<uint /*skillId*/, IReadOnlyDictionary<uint, uint> /*attrCurrents*/, uint /*formulaBonus*/>? resolveSkillFormulaBonus = null)
|
||||
Func<uint /*skillId*/, IReadOnlyDictionary<uint, uint> /*attrCurrents*/, uint /*formulaBonus*/>? resolveSkillFormulaBonus = null,
|
||||
// D.5.1 Task 4: persists Shortcuts from each PlayerDescription so the
|
||||
// toolbar can populate itself at login without keeping a parser reference.
|
||||
// Optional so all existing callers and tests compile unchanged.
|
||||
Action<IReadOnlyList<PlayerDescriptionParser.ShortcutEntry>>? onShortcuts = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(dispatcher);
|
||||
ArgumentNullException.ThrowIfNull(items);
|
||||
|
|
@ -430,6 +434,10 @@ public static class GameEventWiring
|
|||
newSlot: -1,
|
||||
newEquipLocation: (EquipMask)eq.EquipLocation);
|
||||
}
|
||||
|
||||
// D.5.1 Task 4: forward shortcut bar entries to the caller so the
|
||||
// toolbar can read them without holding a parser reference.
|
||||
onShortcuts?.Invoke(p.Value.Shortcuts);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue