mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
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:
parent
072f256af6
commit
d44d462686
4 changed files with 30 additions and 0 deletions
|
|
@ -1396,6 +1396,8 @@ public:
|
|||
bool isAutoLoot() const { return autoLoot_; }
|
||||
void setAutoSellGrey(bool enabled) { autoSellGrey_ = enabled; }
|
||||
bool isAutoSellGrey() const { return autoSellGrey_; }
|
||||
void setAutoRepair(bool enabled) { autoRepair_ = enabled; }
|
||||
bool isAutoRepair() const { return autoRepair_; }
|
||||
|
||||
// Master loot candidates (from SMSG_LOOT_MASTER_LIST)
|
||||
const std::vector<uint64_t>& getMasterLootCandidates() const { return masterLootCandidates_; }
|
||||
|
|
@ -2882,6 +2884,7 @@ private:
|
|||
bool lootWindowOpen = false;
|
||||
bool autoLoot_ = false;
|
||||
bool autoSellGrey_ = false;
|
||||
bool autoRepair_ = false;
|
||||
LootResponseData currentLoot;
|
||||
std::vector<uint64_t> masterLootCandidates_; // from SMSG_LOOT_MASTER_LIST
|
||||
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ private:
|
|||
bool pendingShowKeyring = true;
|
||||
bool pendingAutoLoot = false;
|
||||
bool pendingAutoSellGrey = false;
|
||||
bool pendingAutoRepair = false;
|
||||
|
||||
// Keybinding customization
|
||||
int pendingRebindAction = -1; // -1 = not rebinding, otherwise action index
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -595,6 +595,7 @@ void GameScreen::render(game::GameHandler& gameHandler) {
|
|||
// Apply auto-loot / auto-sell settings to GameHandler every frame (cheap bool sync)
|
||||
gameHandler.setAutoLoot(pendingAutoLoot);
|
||||
gameHandler.setAutoSellGrey(pendingAutoSellGrey);
|
||||
gameHandler.setAutoRepair(pendingAutoRepair);
|
||||
|
||||
// Zone entry detection — fire a toast when the renderer's zone name changes
|
||||
if (auto* rend = core::Application::getInstance().getRenderer()) {
|
||||
|
|
@ -16334,6 +16335,11 @@ void GameScreen::renderSettingsWindow() {
|
|||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("Automatically sell all grey (poor quality) items when opening a vendor");
|
||||
if (ImGui::Checkbox("Auto Repair", &pendingAutoRepair)) {
|
||||
saveSettings();
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("Automatically repair all damaged equipment when opening an armorer vendor");
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Text("Bags");
|
||||
|
|
@ -18335,6 +18341,7 @@ void GameScreen::saveSettings() {
|
|||
// Gameplay
|
||||
out << "auto_loot=" << (pendingAutoLoot ? 1 : 0) << "\n";
|
||||
out << "auto_sell_grey=" << (pendingAutoSellGrey ? 1 : 0) << "\n";
|
||||
out << "auto_repair=" << (pendingAutoRepair ? 1 : 0) << "\n";
|
||||
out << "graphics_preset=" << static_cast<int>(currentGraphicsPreset) << "\n";
|
||||
out << "ground_clutter_density=" << pendingGroundClutterDensity << "\n";
|
||||
out << "shadows=" << (pendingShadows ? 1 : 0) << "\n";
|
||||
|
|
@ -18477,6 +18484,7 @@ void GameScreen::loadSettings() {
|
|||
// Gameplay
|
||||
else if (key == "auto_loot") pendingAutoLoot = (std::stoi(val) != 0);
|
||||
else if (key == "auto_sell_grey") pendingAutoSellGrey = (std::stoi(val) != 0);
|
||||
else if (key == "auto_repair") pendingAutoRepair = (std::stoi(val) != 0);
|
||||
else if (key == "graphics_preset") {
|
||||
int presetVal = std::clamp(std::stoi(val), 0, 4);
|
||||
currentGraphicsPreset = static_cast<GraphicsPreset>(presetVal);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue