Skip to content

Instantly share code, notes, and snippets.

@CrookedJ
Last active February 8, 2024 14:48
Show Gist options
  • Save CrookedJ/72f5253a553e855a49c6295ebac703a2 to your computer and use it in GitHub Desktop.
Save CrookedJ/72f5253a553e855a49c6295ebac703a2 to your computer and use it in GitHub Desktop.
Functions for trading in Dark and Darker
; For AutoHotkey2
; Right now just has cell coords for 1440p and 1080p
CoordMode "Mouse", "Client"
WinGetClientPos ,, &Width, &Height, "ahk_exe DungeonCrawler.exe"
if (Width/Height != 16/9) {
throw("Detected res is not 16:9 or game window size could not be determined. Make sure the game is open")
}
if (Width = 1920 and Height = 1080) {
colStart := 1080
rowStart := 220
cellSize := 40
chatBox := "244 1024"
stash1 := "1012 260"
stash2 := "1012 306"
stash3 := "1012 352"
}
else if (Width = 2560 and Height = 1440) {
colStart := 1445
rowStart := 295
cellSize := 54
chatBox := "344 1366"
stash1 := "1350 340"
stash2 := "1350 405"
stash3 := "1350 470"
}
else {
throw("Currently only 1080p and 1440p are supported")
}
cellCoord(cell)
{
c2 := Format("{:U}", cell)
col := Ord(c2)-65
row := SubStr(c2, 2) - 1
colC := colStart + (col * cellSize)
rowC := rowStart + (row * cellSize)
return colC " " rowC
}
Sell(cell, price)
{
Send("+{Click " cellCoord(cell) "}")
Sleep(250)
SendText(price " ")
}
OpenStash(stash := 1, chat := true)
{
switch stash
{
case 1: Send("+{Click " stash1 "}")
case 2: Send("+{Click " stash2 "}")
case 3: Send("+{Click " stash3 "}")
}
if (chat) {
Send("+{Click " chat "}")
}
Sleep(50)
}
#HotIf WinActive("ahk_exe DungeonCrawler.exe")
!3::
{
OpenStash(1, true)
Sell("H11", "200g,") ; hood
Sell("J10", "500g,") ; pants
Sell("K9", "200g,") ; kris
Sell("K11", "100g,") ; castillon
Sell("L9", "300g") ; crystal
Send("{Enter}")
}
#HotIf WinActive("ahk_exe DungeonCrawler.exe")
!4::
{
OpenStash()
;Sell("K9", "500g,") ; ring
;Send("{Enter}")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment