fix(ui): port exact selected health policy

Replace the toolbar's PWD-bit approximation with retail ObjectIsAttackable composed with the exact player and pet short-circuits. Carry second-header PetOwner through CreateObject, session, and ClientObject state so self, pet, and Free-PK cases match retail while friendly NPCs and attackable non-creatures remain name-only.

Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-11 11:42:04 +02:00
parent 52a80dc531
commit 2644d1d527
18 changed files with 416 additions and 50 deletions

View file

@ -204,6 +204,25 @@ public sealed class ClientObjectTableTests
Assert.Equal(0x99u, d.ContainerId);
}
[Fact]
public void Ingest_PetOwnerFromSecondHeader_IsPreserved()
{
var table = new ClientObjectTable();
var data = new WeenieData(
Guid: 0x50000010u, Name: "Combat Pet", Type: ItemType.Creature,
WeenieClassId: 2, IconId: 0, IconOverlayId: 0, IconUnderlayId: 0, Effects: 0,
Value: null, StackSize: null, StackSizeMax: null, Burden: null,
ContainerId: null, WielderId: null, ValidLocations: null,
CurrentWieldedLocation: null, Priority: null,
ItemsCapacity: null, ContainersCapacity: null,
Structure: null, MaxStructure: null, Workmanship: null,
PetOwnerId: 0x50000001u);
ClientObject result = table.Ingest(data);
Assert.Equal(0x50000001u, result.PetOwnerId);
}
private static WeenieData FullWeenie(uint guid, uint icon = 0x06001234u,
string name = "Sword", ItemType type = ItemType.MeleeWeapon, uint effects = 0,
int? value = 100, int? stack = 1, uint? container = null, uint wcid = 0xABCDu) =>