From 24021b3160bb40ae740fb4d70ef36db47dfd77c0 Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Thu, 9 May 2024 00:00:37 +0200 Subject: [PATCH 1/2] Fix for respecting price checker enabled/disabled --- GWToolboxdll/Modules/PriceCheckerModule.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/GWToolboxdll/Modules/PriceCheckerModule.cpp b/GWToolboxdll/Modules/PriceCheckerModule.cpp index 012c64d73..9607a5de3 100644 --- a/GWToolboxdll/Modules/PriceCheckerModule.cpp +++ b/GWToolboxdll/Modules/PriceCheckerModule.cpp @@ -470,6 +470,10 @@ namespace { { if (!(description_out && *description_out)) return; + + if (!fetch_module_prices) + return; + const auto item = GW::Items::GetItemById(item_id); if (!item) return; From 65991b952f0c79dee85675eed73685bb739ec3be Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Thu, 9 May 2024 09:12:46 +0200 Subject: [PATCH 2/2] Use module enable/disable feature for PriceChecker and SalvageInfo --- GWToolboxdll/Modules/PriceCheckerModule.cpp | 10 +--------- GWToolboxdll/Modules/SalvageInfoModule.cpp | 22 +-------------------- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/GWToolboxdll/Modules/PriceCheckerModule.cpp b/GWToolboxdll/Modules/PriceCheckerModule.cpp index 9607a5de3..3f0b692c5 100644 --- a/GWToolboxdll/Modules/PriceCheckerModule.cpp +++ b/GWToolboxdll/Modules/PriceCheckerModule.cpp @@ -25,7 +25,6 @@ using nlohmann::json; namespace { - bool fetch_module_prices = true; float high_price_threshold = 1000; std::wstring modified_description; bool fetching_prices; @@ -471,9 +470,6 @@ namespace { if (!(description_out && *description_out)) return; - if (!fetch_module_prices) - return; - const auto item = GW::Items::GetItemById(item_id); if (!item) return; @@ -550,14 +546,12 @@ void PriceCheckerModule::SaveSettings(ToolboxIni* ini) { ToolboxModule::SaveSettings(ini); SAVE_FLOAT(high_price_threshold); - SAVE_BOOL(fetch_module_prices); } void PriceCheckerModule::LoadSettings(ToolboxIni* ini) { ToolboxModule::SaveSettings(ini); LOAD_FLOAT(high_price_threshold); - LOAD_BOOL(fetch_module_prices); } void PriceCheckerModule::RegisterSettingsContent() @@ -570,9 +564,7 @@ void PriceCheckerModule::RegisterSettingsContent() return; } - ImGui::Checkbox("Fetch prices for item components", &fetch_module_prices); - ImGui::ShowHelp("When enabled, the item description will contain information about the components of the item and their respective prices"); - ImGui::SliderFloat("High price threshold", &high_price_threshold, 100, 50000); + ImGui::SliderFloat("Price Checker high price threshold", &high_price_threshold, 100, 50000); }, 0.9f ); diff --git a/GWToolboxdll/Modules/SalvageInfoModule.cpp b/GWToolboxdll/Modules/SalvageInfoModule.cpp index 49e24ab76..d49ef576c 100644 --- a/GWToolboxdll/Modules/SalvageInfoModule.cpp +++ b/GWToolboxdll/Modules/SalvageInfoModule.cpp @@ -71,9 +71,6 @@ namespace GW { } namespace { - - bool fetch_salvage_info = true; - struct CraftingMaterial { uint32_t model_id; // Used to map to kamadan trade chat GuiUtils::EncString en_name; // Used to map to Guild Wars Wiki @@ -376,9 +373,7 @@ namespace { { GW::Hook::EnterHook(); GetItemDescription_Ret(item_id, flags, quantity, unk, name_out, description_out); - if (fetch_salvage_info && description_out && *description_out) { - AppendSalvageInfoDescription(item_id, description_out); - } + AppendSalvageInfoDescription(item_id, description_out); GW::Hook::LeaveHook(); } @@ -456,28 +451,13 @@ void SalvageInfoModule::Update(const float) void SalvageInfoModule::SaveSettings(ToolboxIni* ini) { ToolboxModule::SaveSettings(ini); - SAVE_BOOL(fetch_salvage_info); } void SalvageInfoModule::LoadSettings(ToolboxIni* ini) { ToolboxModule::SaveSettings(ini); - LOAD_BOOL(fetch_salvage_info); } void SalvageInfoModule::RegisterSettingsContent() { - //ToolboxModule::RegisterSettingsContent(); - ToolboxModule::RegisterSettingsContent( - "Inventory Settings", ICON_FA_BOXES, - [this](const std::string&, const bool is_showing) { - if (!is_showing) { - return; - } - - ImGui::Checkbox("Fetch salvage information for items", &fetch_salvage_info); - ImGui::ShowHelp("When enabled, the item description will contain information about the crafting materials that can be salvaged from the item"); - }, - 0.9f - ); }