Skip to content

Commit

Permalink
Filter should read minGoldAmount correctly now
Browse files Browse the repository at this point in the history
  • Loading branch information
nooperation committed Mar 2, 2024
1 parent de4507a commit cbd8122
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion D2Hackit/Modules/filter/ItemFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@

#define FILTER_SETTINGS_PATH ".\\plugin\\filter.ini"

int32_t MyGetPrivateProfileInt(
_In_ LPCSTR lpAppName,
_In_ LPCSTR lpKeyName,
_In_ INT nDefault,
_In_opt_ LPCSTR lpFileName)
{
auto defaultStr = std::to_string(nDefault);

char buff[1024];
GetPrivateProfileStringA(lpAppName, lpKeyName, defaultStr.c_str(), buff, sizeof(buff), lpFileName);

std::string strBuff(buff);
try
{
const auto number = std::stoi(strBuff);
return number;
}
catch (...)
{
return 0;
}
}

bool ItemFilter::OnItemAction(ITEM &item)
{
switch(item.iAction)
Expand Down Expand Up @@ -60,7 +83,7 @@ bool ItemFilter::LoadItems()
showMagicJewels = GetPrivateProfileInt("Jewels", "MagicJewels", 1, FILTER_SETTINGS_PATH) == TRUE;
showRareJewels = GetPrivateProfileInt("Jewels", "RareJewels", 1, FILTER_SETTINGS_PATH) == TRUE;

minGoldAmount = GetPrivateProfileInt("Misc", "MinGoldAmount", 0, FILTER_SETTINGS_PATH);
minGoldAmount = MyGetPrivateProfileInt("Misc", "MinGoldAmount", 0, FILTER_SETTINGS_PATH);
hideRejuvsWhenBeltFull = GetPrivateProfileInt("Misc", "HideRejuvsWenBeltFull", 1, FILTER_SETTINGS_PATH) == TRUE;

return true;
Expand Down

0 comments on commit cbd8122

Please sign in to comment.