Skip to content

Commit

Permalink
Minor fix to AutoBuy
Browse files Browse the repository at this point in the history
Added AutoBuy to d2hackit autoload
  • Loading branch information
nooperation committed Jul 23, 2023
1 parent 52e37b1 commit d3d0c28
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion D2Hackit/Core/Resources/D2HackIt.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
;
; -------------------------------------------------------------------
[Misc]
Autoload=pick, filter, as, buff, flee, t, asae, gamble, ae, autoaccept, statefix, sell, scroll, ore, qol, at, chit, goto, emptycube
Autoload=pick, filter, as, buff, flee, t, asae, gamble, ae, autoaccept, statefix, sell, scroll, ore, qol, at, chit, goto, emptycube, buy
CommandCharacter=.
InfoPrompt=ÿc3::
ErrorPrompt=ÿc1::
Expand Down
5 changes: 2 additions & 3 deletions D2Hackit/Modules/autoBuy/AutoBuy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,11 @@ void AutoBuy::RestockScrolls()
auto tpScrollIdIter = merchantItems.find("tsc");
if (tpScrollIdIter != merchantItems.end())
{
for (auto i = 0; i < this->numTPTomesToRefill; i++)
if(this->numTPTomesToRefill > 0)
{
BuyItemInQuantity(tpScrollIdIter->second);
}
}

hasAlreadyRestockedTps = true;
}
}

Expand All @@ -145,6 +143,7 @@ void AutoBuy::OnNpcItemList(const ITEM& merchantItem)
merchantItems[itemCode] = merchantItem.dwItemID;
if (itemCode == "tsc" && !hasAlreadyRestockedTps)
{
hasAlreadyRestockedTps = true;
RestockScrolls();
}
}
Expand Down
1 change: 0 additions & 1 deletion D2Hackit/Modules/autoBuy/AutoBuy.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ class AutoBuy
std::string itemCodeToBuy = "";

State currentState = State::Uninitialized;
std::unordered_map<std::string, std::string> targetItems;
std::unordered_map<std::string, DWORD> merchantItems;
};

0 comments on commit d3d0c28

Please sign in to comment.