Advertisement
Guest User

Path of Exile stacked deck opener

a guest
Nov 1st, 2023
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SingleInstance Force
  2. #Requires AutoHotKey >=v2.0  ; https://www.autohotkey.com/v2/
  3.  
  4. ; Save this script as stacked_deck_opener.ahk on your desktop
  5. ; run the script, open path of exile
  6.  
  7. ; config so hotkey only works on path of exile
  8. SetTitleMatchMode 2
  9. #HotIf Winactive("ahk_class POEWindowClass")
  10.  
  11.  
  12. ; VVVVVVVVV IMPORTANT PART
  13.  
  14. ; hotkeys - https://www.autohotkey.com/docs/v2/Hotkeys.htm#Symbols
  15.  
  16. >^.:: deck_opener()
  17. ; hover over a stacked deck, press 'Right Ctrl' and '.' (period) at the same time
  18. ; if you have 1,2,5,7,9 or 10 decks in a stack it doesn't matter.
  19.  
  20.  
  21. ; ^^^^^^^^^^ IMPORTANT PART
  22.  
  23.  
  24. ; functions required
  25.  
  26. deck_opener()
  27. {
  28.     WinGetPos , , &OutWidth, &OutHeight, "Path of Exile" ; get size of window
  29.     MouseGetPos &xpos, &ypos ; get original cursor position of hovered stacked deck
  30.  
  31.     ; count_stack uses clipboard_get() function to get the stack size from the hovered item
  32.     count_stack := StrReplace(StrReplace(clipboard_get()[5], "/", " "), "Stack Size:", "")
  33.     count := StrSplit(count_stack, " ")[2]
  34.     stack := StrSplit(count_stack, " ")[3]
  35.  
  36.     ; draw cards
  37.     loop count {
  38.  
  39.         ; drop card around center of screen
  40.         randclick := random(1.75, 2.25)
  41.  
  42.         Click "Right" ; This opens the deck
  43.         sleep 25
  44.  
  45.         ; move to around center of screen
  46.         MouseMove OutWidth / randclick, OutHeight / randclick, 2
  47.  
  48.         sleep 25
  49.  
  50.         Click
  51.  
  52.         sleep 25
  53.         MouseMove xpos, ypos
  54.     }
  55. }
  56.  
  57. clipboard_get() { ; copy item info and index it
  58.  
  59.     A_Clipboard := "" ; Empty the clipboard
  60.     this_array := [] ; initialize clipboard array
  61.  
  62.     MouseGetPos &inventItemXpos, &inventItemYpos, &WindowPID  ; capture mouse cursor position
  63.  
  64.     Send "!^c" ; copy item text
  65.  
  66.     if !ClipWait(1) ; allow clipboard to load, may be slow
  67.     {
  68.         MsgBox "Nothing found! You must hover over an item"
  69.         return ; bail if nothing copied
  70.     }
  71.  
  72.     loop parse, A_Clipboard, "`n", "`r"
  73.     {
  74.         if (A_LoopField != "") ; if line is not blank
  75.         {
  76.             ; remove carriage returns, dash separators, empty lines
  77.             LineStr := RegExReplace(RegExReplace(A_LoopField, "-{8}|`r|`n|`v|", ""), "^\h\R|^\R", "")
  78.             this_array.Push LineStr ; push each line to array
  79.         }
  80.     }
  81.  
  82.     return this_array
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement