feat: add auto-repair at vendor open

When 'Auto Repair' is enabled in Settings > Gameplay, all damaged
equipment is automatically repaired when opening any armorer vendor
(canRepair=true). The repair is skipped when no items are actually
damaged to avoid a pointless server round-trip. A system chat message
confirms the repair. Setting persists to ~/.wowee/settings.cfg as
auto_repair.
This commit is contained in:
Kelsi 2026-03-17 20:27:45 -07:00
parent 072f256af6
commit d44d462686
4 changed files with 30 additions and 0 deletions

View file

@ -21259,6 +21259,24 @@ void GameHandler::handleListInventory(network::Packet& packet) {
}
}
// Auto-repair all items if enabled and vendor can repair
if (autoRepair_ && currentVendorItems.canRepair && currentVendorItems.vendorGuid != 0) {
// Check that at least one equipped item is actually damaged to avoid no-op
bool anyDamaged = false;
for (int i = 0; i < Inventory::NUM_EQUIP_SLOTS; ++i) {
const auto& slot = inventory.getEquipSlot(static_cast<EquipSlot>(i));
if (!slot.empty() && slot.item.maxDurability > 0
&& slot.item.curDurability < slot.item.maxDurability) {
anyDamaged = true;
break;
}
}
if (anyDamaged) {
repairAll(currentVendorItems.vendorGuid, false);
addSystemChatMessage("|cffaaaaaaAuto-repair triggered.|r");
}
}
// Play vendor sound
if (npcVendorCallback_ && currentVendorItems.vendorGuid != 0) {
auto entity = entityManager.getEntity(currentVendorItems.vendorGuid);