feat: implement item durability tracking and vendor repair

- Add ITEM_FIELD_DURABILITY (60) and ITEM_FIELD_MAXDURABILITY (61) to
  update_field_table.hpp enum and wotlk/update_fields.json
- Add curDurability/maxDurability to OnlineItemInfo and ItemDef structs
- Parse durability fields in OBJECT_CREATE and OBJECT_VALUES handlers;
  preserve existing values on partial updates (fixes stale durability
  being reset to 0 on stack-count-only updates)
- Propagate durability to ItemDef in all 5 rebuildOnlineInventory() paths
- Implement GameHandler::repairItem() and repairAll() via CMSG_REPAIR_ITEM
  (itemGuid=0 repairs all equipped items per WotLK protocol)
- Add canRepair flag to ListInventoryData; set it when player selects
  GOSSIP_OPTION_ARMORER in gossip window
- Show "Repair All" button in vendor window header when canRepair=true
- Display color-coded durability in item tooltip (green >50%, yellow
  >25%, red <=25%)
This commit is contained in:
Kelsi 2026-03-10 16:21:09 -07:00
parent 094ef88e57
commit 0afa41e908
9 changed files with 96 additions and 10 deletions

View file

@ -1426,17 +1426,20 @@ void Application::update(float deltaTime) {
}
}
// Use getLatestX/Y/Z (server-authoritative destination) for position sync
// rather than getX/Y/Z (interpolated), which may be stale for entities
// outside the 150-unit updateMovement() culling radius in GameHandler.
glm::vec3 canonical(entity->getLatestX(), entity->getLatestY(), entity->getLatestZ());
// Distance check uses getLatestX/Y/Z (server-authoritative destination) to
// avoid false-culling entities that moved while getX/Y/Z was stale.
// Position sync still uses getX/Y/Z to preserve smooth interpolation for
// nearby entities; distant entities (> 150u) have planarDist≈0 anyway
// so the renderer remains driven correctly by creatureMoveCallback_.
glm::vec3 latestCanonical(entity->getLatestX(), entity->getLatestY(), entity->getLatestZ());
float canonDistSq = 0.0f;
if (havePlayerPos) {
glm::vec3 d = canonical - playerPos;
glm::vec3 d = latestCanonical - playerPos;
canonDistSq = glm::dot(d, d);
if (canonDistSq > syncRadiusSq) continue;
}
glm::vec3 canonical(entity->getX(), entity->getY(), entity->getZ());
glm::vec3 renderPos = core::coords::canonicalToRender(canonical);
// Visual collision guard: keep hostile melee units from rendering inside the