Skip to content

Commit

Permalink
Autostocker hotkey now runs start_rares instead of start (see new aut…
Browse files Browse the repository at this point in the history
…ostocker_misc.ini)
  • Loading branch information
nooperation committed Sep 12, 2022
1 parent 4aa85ff commit 102dc11
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
3 changes: 3 additions & 0 deletions D2Hackit/Modules/autoStocker/Resources/autostockerMisc.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[Autostocker]
Hotkey=119
HotkeyIncludesRares=1
HotkeyIncludesSets=1
HotkeyIncludesUniques=0
MaxUnidentifiedSCharmLvl=44
MaxUnidentifiedLCharmLvl=44
MaxUnidentifiedGCharmLvl=44
Expand Down
22 changes: 19 additions & 3 deletions D2Hackit/Modules/autoStocker/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ AutoStocker autoStocker;

bool settingHotkey = false;
int hotkey = 0;
bool hotkeyIncludesRares = false;
bool hotkeyIncludesSets = false;
bool hotkeyIncludesUniques = false;

CLIENTINFO
(
Expand Down Expand Up @@ -179,7 +182,8 @@ BYTE EXPORT OnGameKeyDown(BYTE iKeyCode)
{
if(iKeyCode == hotkey)
{
Start(NULL, 0);
std::unordered_set<std::string> ignoredItemCodes;
autoStocker.StartRares(hotkeyIncludesSets, hotkeyIncludesRares, hotkeyIncludesUniques, false, ignoredItemCodes);
}
}

Expand All @@ -196,14 +200,26 @@ BYTE EXPORT OnGameKeyDown(BYTE iKeyCode)
void ReadConfig()
{
hotkey = GetPrivateProfileInt("Autostocker", "Hotkey", 0, CONFIG_FILE);
hotkeyIncludesRares = GetPrivateProfileInt("Autostocker", "HotkeyIncludesRares", 0, CONFIG_FILE);
hotkeyIncludesSets = GetPrivateProfileInt("Autostocker", "HotkeyIncludesSets", 0, CONFIG_FILE);
hotkeyIncludesUniques = GetPrivateProfileInt("Autostocker", "HotkeyIncludesUniques", 0, CONFIG_FILE);
}

void WriteConfig()
{
char configBuff[64];

sprintf_s(configBuff, sizeof(configBuff)/sizeof(configBuff[0]), "%d", hotkey);
WritePrivateProfileString("Autostocker", "Hotkey", configBuff, CONFIG_FILE);
sprintf_s(&configBuff[0], sizeof(configBuff) / sizeof(configBuff[0]), "%d", hotkey);
WritePrivateProfileString("Autostocker", "Hotkey", &configBuff[0], CONFIG_FILE);

sprintf_s(&configBuff[0], sizeof(configBuff)/sizeof(configBuff[0]), "%d", hotkeyIncludesRares ? 1 : 0);
WritePrivateProfileString("Autostocker", "HotkeyIncludesRares", &configBuff[0], CONFIG_FILE);

sprintf_s(&configBuff[0], sizeof(configBuff)/sizeof(configBuff[0]), "%d", hotkeyIncludesSets ? 1 : 0);
WritePrivateProfileString("Autostocker", "HotkeyIncludesSets", &configBuff[0], CONFIG_FILE);

sprintf_s(&configBuff[0], sizeof(configBuff)/sizeof(configBuff[0]), "%d", hotkeyIncludesUniques ? 1 : 0);
WritePrivateProfileString("Autostocker", "HotkeyIncludesUniques", &configBuff[0], CONFIG_FILE);
}

MODULECOMMANDSTRUCT ModuleCommands[]=
Expand Down

0 comments on commit 102dc11

Please sign in to comment.