mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-24 08:00:14 +00:00
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:
parent
094ef88e57
commit
0afa41e908
9 changed files with 96 additions and 10 deletions
|
|
@ -1805,6 +1805,15 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I
|
|||
if (!bonusLine.empty()) {
|
||||
ImGui::TextColored(green, "%s", bonusLine.c_str());
|
||||
}
|
||||
if (item.maxDurability > 0) {
|
||||
float durPct = static_cast<float>(item.curDurability) / static_cast<float>(item.maxDurability);
|
||||
ImVec4 durColor;
|
||||
if (durPct > 0.5f) durColor = ImVec4(0.1f, 1.0f, 0.1f, 1.0f); // green
|
||||
else if (durPct > 0.25f) durColor = ImVec4(1.0f, 1.0f, 0.0f, 1.0f); // yellow
|
||||
else durColor = ImVec4(1.0f, 0.2f, 0.2f, 1.0f); // red
|
||||
ImGui::TextColored(durColor, "Durability %u / %u",
|
||||
item.curDurability, item.maxDurability);
|
||||
}
|
||||
if (item.sellPrice > 0) {
|
||||
uint32_t g = item.sellPrice / 10000;
|
||||
uint32_t s = (item.sellPrice / 100) % 100;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue