Skip to content

Commit

Permalink
Merge pull request #1068 from AlexMacocian/alexmacocian/price-checker…
Browse files Browse the repository at this point in the history
…-enabled-fix

Fix for respecting price checker enabled/disabled
  • Loading branch information
DubbleClick authored May 9, 2024
2 parents cc5f713 + 65991b9 commit 1029bbd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 27 deletions.
8 changes: 2 additions & 6 deletions GWToolboxdll/Modules/PriceCheckerModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -470,6 +469,7 @@ namespace {
{
if (!(description_out && *description_out))
return;

const auto item = GW::Items::GetItemById(item_id);
if (!item)
return;
Expand Down Expand Up @@ -546,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()
Expand All @@ -566,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
);
Expand Down
22 changes: 1 addition & 21 deletions GWToolboxdll/Modules/SalvageInfoModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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
);
}

0 comments on commit 1029bbd

Please sign in to comment.