feat(net): D.2b-B B-Wire — ObjectTableWiring applies all ints + player int + stack/remove
- Wire signature gains optional 3rd param `Func<uint>? playerGuid` (existing GameWindow caller `Wire(session, Objects)` still compiles — default null). - ObjectIntPropertyUpdated gate loosened: was UiEffects-only, now applies ALL PropertyInt updates on visible objects (server is the authority on object props). - PlayerIntPropertyUpdated → UpdateIntProperty(playerGuid(), ...) so live EncumbranceVal (0x02CD) updates the player's burden bar. - StackSizeUpdated → UpdateStackSize(guid, stackSize, value). - InventoryObjectRemoved → Remove(guid). - Updated class doc-comment to list all 5 wired opcodes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
672df23010
commit
275319461e
1 changed files with 23 additions and 4 deletions
|
|
@ -5,7 +5,9 @@ namespace AcDream.Core.Net;
|
|||
/// <summary>
|
||||
/// Wires WorldSession GameMessage-level object events into the client object
|
||||
/// table: CreateObject (0xF745) = canonical merge-upsert, DeleteObject (0xF747)
|
||||
/// = evict, PublicUpdatePropertyInt (0x02CE) UiEffects = live icon re-composite.
|
||||
/// = evict, PublicUpdatePropertyInt (0x02CE) = live int apply, PrivateUpdatePropertyInt
|
||||
/// (0x02CD) = player int (burden), SetStackSize (0x0197) = stack count, InventoryRemoveObject
|
||||
/// (0x0024) = inventory-view removal.
|
||||
/// Keeps object ingestion in Core.Net (pure data, no GL) and off GameWindow.
|
||||
/// Retail: ACCObjectMaint::CreateObject / DeleteObject (the weenie_object_table side).
|
||||
/// </summary>
|
||||
|
|
@ -16,18 +18,35 @@ public static class ObjectTableWiring
|
|||
/// on <paramref name="session"/>. Call this BEFORE the render handler subscribes
|
||||
/// to EntitySpawned so the table is populated before the render path runs.
|
||||
/// </summary>
|
||||
public static void Wire(WorldSession session, ClientObjectTable table)
|
||||
public static void Wire(WorldSession session, ClientObjectTable table, Func<uint>? playerGuid = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(session);
|
||||
ArgumentNullException.ThrowIfNull(table);
|
||||
|
||||
session.EntitySpawned += s => table.Ingest(ToWeenieData(s));
|
||||
session.EntityDeleted += d => table.Remove(d.Guid);
|
||||
|
||||
// B-Wire: apply EVERY PropertyInt update on a visible object (0x02CE), not just
|
||||
// UiEffects — the server is the authority on object properties. UpdateIntProperty
|
||||
// stores it in the bundle and still mirrors UiEffects → the typed Effects field.
|
||||
session.ObjectIntPropertyUpdated += u =>
|
||||
table.UpdateIntProperty(u.Guid, u.Property, u.Value);
|
||||
|
||||
// B-Wire: PrivateUpdatePropertyInt (0x02CD) carries no guid — it targets the
|
||||
// local player. Route it to the player object so live EncumbranceVal updates the
|
||||
// burden bar. (No-op if the player guid isn't wired yet.)
|
||||
session.PlayerIntPropertyUpdated += u =>
|
||||
{
|
||||
if (u.Property == ClientObjectTable.UiEffectsPropertyId)
|
||||
table.UpdateIntProperty(u.Guid, u.Property, u.Value);
|
||||
if (playerGuid is not null)
|
||||
table.UpdateIntProperty(playerGuid(), u.Property, u.Value);
|
||||
};
|
||||
|
||||
// B-Wire: SetStackSize (0x0197) — update the object's stack count + value.
|
||||
session.StackSizeUpdated += u => table.UpdateStackSize(u.Guid, u.StackSize, u.Value);
|
||||
|
||||
// B-Wire: InventoryRemoveObject (0x0024) — the object left the player's inventory
|
||||
// view; drop it from the table (retail ClientUISystem removes it from maintenance).
|
||||
session.InventoryObjectRemoved += guid => table.Remove(guid);
|
||||
}
|
||||
|
||||
/// <summary>Translate the wire spawn into the table's merge patch.</summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue