Advertisement
Guest User

Don DooBee Monk v1.4

a guest
Jul 6th, 2012
3,077
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 83.89 KB | None | 0 0
  1. ; Don DooBee's v1.4
  2. ; + rep @ ownedcore if you enjoy the script
  3.  
  4.  
  5.  
  6.  
  7. ;notAres' Gold Script for Monk - 7/6/2012
  8. ;YOU MUST START THE BOT AT THE RESUME GAME SCREEN!
  9. ;;;;;
  10. ;WONT WORK UNLESS MOVE IS BOUND TO MIDDLE MOUSE (Mouse 3) -- NOT MOVE/INTERACT
  11. ;Required display mode for cellar detection: "FULLSCREEN WINDOWED"
  12. ;Official supported resolution: 1920x1080
  13. ;;;;;
  14. ;Original by mackus101 @ ownedcore
  15. ;ImageSearch contributions by rvbfreak, goofinator, and asuRob
  16. ;Refactoring and additional functions by Shimizoki
  17.  
  18.  
  19. ;=========== DO NOT TOUCH ===========;
  20. #RequireAdmin
  21. #include <GUIConstantsEx.au3>
  22. #include <StaticConstants.au3>
  23. #include <WindowsConstants.au3>
  24.  
  25.  
  26. ; YOU MUST ALSO UNCOMMENT THE #include LINE TO ENABLE ENHANCED CELLAR FIND
  27. $UseEnhancedCellarFind = True ; DO NOT CHANGE
  28. #include <FastFind.au3>
  29.  
  30. ;===================================;
  31. #include <Tesseract.au3>
  32.  
  33. If $UseEnhancedCellarFind Then
  34.         FFSetDebugMode(0)
  35.         AutoItSetOption("WinTitleMatchMode", 4)
  36.         Global $FFhWnd = WinGetHandle("Diablo III")
  37. EndIf
  38.  
  39. Global $numitem, $numgem, $numtomb, $numgold, $numpot, $lblGold, $numsold, $numstashed, $monold = 0, $mon = 0, $monstart = 0, $SprintStart, $lootany
  40.  
  41. Opt('MouseCoordMode', 2)
  42. Opt('PixelCoordMode', 2)
  43. Global $size = WinGetClientSize("[CLASS:D3 Main Window Class]"), $ver = "Don DooBee's v1.4 ", $hFont = 0, $title, $Paused, $Go = False, $i = 0, $gX = 0, $gY = 0, $LegendaryCount = 0, $SetCount = 0, $RareCount = 0, $MagicCount = 0, $GemCount = 0, $TomeCount = 0, $deathCount = 0, $cellarCount = 0, $t = TimerInit(), $rt = 0, $run = 0, $yellow = 0xFFF000, $red = 0xD90000, $lblRun, $lblLocation, $lblStatus, $lblLast, $lblRuntime, $lblGear, $lblItems
  44. Global $str_Stash, $str_StashGems, $str_StashMisc, $str_Vendor, $str_Salvage, $int_TownPosition
  45. For $i = 0 To Random(0, 3, 1)
  46.         $title &= Chr(Random(97, 122, 1))
  47. Next
  48. For $i = 0 To Random(2, 5, 1)
  49.         $title &= Chr(Random(65, 90, 1))
  50. Next
  51. $title &= " "
  52. Global $gems[8] = ["Ru1.png", "Ru2.png", "Em1.png", "Em2.png", "To1.png", "To2.png", "Am1.png", "Am2.png"]
  53. If @OSArch = "X64" Then DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)
  54. If @OSArch = "X64" And Not @AutoItX64 Then MsgBox(16, "ERROR", "Why aren't you running the 64-bit AutoIt??? Expect bugs!")
  55. If $size = 0 Then
  56.         MsgBox(16, "Error", "Diablo III is not running, cannot grab resolution!" & @CRLF & "Exiting...")
  57.         Exit
  58. EndIf
  59. ;====================================;
  60.  
  61.  
  62. ;============= SETTINGS =============;
  63. HotKeySet("=", "Begin") ;script toggled on/off by pressing =
  64. HotKeySet("{PAUSE}", "TogglePause") ;script toggle pause by pressing Pause/Break key
  65. HotKeySet("x", "Stop") ;script stopped by pressing x
  66. HotKeySet("0", "GoTown") ;script stopped by pressing x
  67.  
  68. $movementSpeed = 0;This is the % increase movement speed you have. 25 = 25%, 0 = 0%, 50 = 50%
  69.  
  70. ;Custom Loot
  71. $pngLoc = "C:\pics\" ;Location of the .PNGs (NO SUBFOLDERS - ALL PNGS GO HERE)
  72.  
  73. ;Array of items to loot (GEMS AND TOMES ALREADY INCLUDED)
  74. Global $pick[1] = ["gold.png|50"]
  75. ;$pick[0] = "gold.png|50"
  76. ;$pick[1] = "mythic.png|50" ;png|Tolerance
  77. ;$pick[2] = "item3.png"
  78.  
  79. ;General
  80. $RunsUntilMenuWait = 0 ;wait for 1 hour at menu after x successful runs, set to 0 to disable
  81. $TakeMissShots = False ;take screenshots into \shots folder on every cellar miss for finding positions
  82. $SarkothKillTime = 2500 ;additional time delay to wait for sarkoth to die use 2800 for 10K dps 800 for 15kdps etc
  83. $DetectTPFail = False ;set true to immediatly exit game if TP is inturrupted (requires TP.png)
  84. $TPProtectTime = 2.2 ;number of seconds to check for TP inturrupt if TPfail detection is enabled if your pc is slow reduce this number
  85. $ReduceLegendSearch = True ; limit legendary searching to lower part of screen to reduce false finds
  86. $CheckLootWhilePorting = False; continue scanning for loot while you port back incase sakroth dies late
  87.  
  88.  
  89. ;define your own cellar co-ords here, list the most likely ones first for efficiency
  90. ;change the [4] to how many co-ords you listed
  91. Dim $celx[5] = [300, 210, 190, 250, 230]
  92. Dim $cely[5] = [179, 179, 224, 160, 210]
  93.  
  94. ;Buttons
  95. $skillCaltrops = "1"
  96. $skillSmokeScreen = "2"
  97. $skillPreparation = "3"
  98. $skillCompanion = "4"
  99. $TownPortalButton = "t"
  100. $Inventory = "i"
  101.  
  102. ;Looting
  103. $LootSets = True ;True if you want to pick up Sets
  104. $LootLegendaries = True;True if you want to pick up Legendaries
  105. $LootRares = True ;True if you want to pick up Rares
  106. $LootMagic = True ;True if you want to pick up Magic
  107. $LootGems = True ;True if you want to pick up Gems
  108. $LootTomes = True ;True if you want to pick up Tome of Secrets
  109. $LootCustom = True ;True if you want to pick up Custom Items (The items in the $pick array above)
  110.  
  111. ;Manage Loot
  112. $PickUpHelp = True ;True if you want it to pick up all items that are set to true under ;Looting^
  113. $Identify = True ;True to enable identifying items before stashing/vendoring
  114. $mLoot = 8 ;Nuber of successful runs until Stash and Vendor
  115. $mLootOff = 2 ;Stash and Vendor after mLoot +- X number of runs (Variability)
  116.  
  117. ;Variability ==NEW SETTINGS==
  118. $Timer = False ;True and the bot will add random sleep intervals
  119. $walktime = 2400 ;Time (in ms) the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times
  120. $loadtime = 3400 ;Time (in ms) the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
  121. $tptime = 6000 ;Time (in ms) the script waits for teleport before exiting the game
  122.  
  123. ;Stashing/vendoring COMMON
  124. $StashRare = True ;True if you want to store Rare items in the stash
  125. $StashMagic = False ;True if you want to store Magic items in the stash
  126.  
  127. $VendorRare = False ;True if you want to vendor Rares
  128. $VendorMagic = True ;True if you want to vendor Magic
  129.  
  130. $GemTab = 1 ;Tab to put gems and tombs in
  131. $ItemTab = 2 ;Tab to put any items in
  132. $NextItemTab = 3 ;Next Tab to put any items in when first one is full
  133.  
  134. ;--------------------------------------------TRADITIONAL----------------------------------------------------
  135. ;Stashing/vendoring TRADITIONAL METHOD to enable set line 155 to FALSE
  136. $StashLoot = True ;True if you want to store Items in the stash
  137. $StashLegendary = True;True if you want to store Legendary items in the stash
  138. $StashTomes = True ;True if you want to store Tomes items in the stash
  139. $StashGems = True ;True if you want to store Gems items in the stash
  140.  
  141. ;SALVAGE - setting this will OVERRIDE traditional vendoring options - it will be skipped
  142. ; make sure you have a stack of each material in your bottom row( which is not scanned )for it to add To
  143. ; otherwise it will start tying to salvage your craft items and do nothing!
  144. $SalvageLoot = False
  145.  
  146. ;Vendoring ==NEW SETTINGS==
  147. $VendorLoot = True ;True if you want to vendor anything
  148. $vendorAll = False ;True if you want to right click all items when talking to vendor
  149. $vendorRows = 6 ;# of rows to vendor, starting from the top (default = 5: bottom row is safe)
  150. $vendorCols = 10 ;# of columns to vendor, starting from left
  151. ;--------------------------------------------TRADITIONAL----------------------------------------------------
  152.  
  153.  
  154. ;--------------------------------------------iLVL----------------------------------------------------
  155. $UseiLVL = False ;set true or false to enable the iLVL system THIS OVERRIDES ALL "TRADITIONAL" SETTINGS
  156. ;====================================;
  157. ;New Analyze Loot Settings Options are "salvage", "stash", and "vend"
  158. $i59Rare = "stash"
  159. $i60Rare = "stash"
  160. $i61Rare = "stash"
  161. $i62Rare = "stash"
  162. $i63Rare = "stash"
  163.  
  164. $i59Magic = "vend"
  165. $i60Magic = "vend"
  166. $i61Magic = "vend"
  167. $i62Magic = "vend"
  168. $i63Magic = "stash"
  169. ;====================================;
  170. ;--------------------------------------------iLVL----------------------------------------------------
  171. $x_ratio = $size[0] / 1920
  172. $y_ratio = $size[1] / 1080
  173.  
  174. $mLootIn = $mLoot ;DO NOT CHANGE, how many more runs till next manage
  175. $RunsUntilMenuWaitCnt = $RunsUntilMenuWait
  176. $totalItems = UBound($pick) ;Number of items in the pick array
  177. If $totalItems < 1 Then $LootCustom = False
  178. $movementSpeed = 1 + ($movementSpeed / 100)
  179.  
  180. If $TakeMissShots Then
  181.         DirCreate("shots")
  182. EndIf
  183.  
  184. If Not FileExists($pngLoc & "MainMenu.png") Then
  185.         $pngLoc = @ScriptDir & "\pics\"
  186.         If Not FileExists($pngLoc & "MainMenu.png") Then
  187.                 MsgBox(16, "Fatal Error", "FATAL ERROR: Cannot find: " & $pngLoc & "MainMenu.png" & @CRLF & "Make sure your directory is set properly in the script")
  188.                 Exit
  189.         EndIf
  190. EndIf
  191.  
  192. Call("SetupGUI")
  193. While 1
  194.         Call("RestartRun")
  195. WEnd
  196.  
  197. Func RestartRun()
  198.         If ($Go) Then
  199.                 $i = 0
  200.                 Send("{SPACE}")
  201.                 WinSetTitle($title, "", $title & $ver & " - Running")
  202.                 MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 1) ;Moves mouse out of the way
  203.                 ;Checks if the player is Dead/Logout/Window, then if in Main Menu, etc.
  204.                 If CheckDead() Then
  205.                         Return
  206.                 ElseIf CheckFor("ExitGame", "", Round(860 * $x_ratio), Round(400 * $y_ratio), Round(1040 * $x_ratio), Round(450 * $y_ratio), 0.2, 140) Then
  207.                         GUICtrlSetData($lblStatus, "Status: Exit window up")
  208.                         MouseClick("left", Round(1064 * $x_ratio), Round(632 * $y_ratio))
  209.                         Sleep(100)
  210.                         Send("{SPACE}")
  211.                         Return
  212.                 ElseIf CheckFor("MainMenu", "", Round(40 * $x_ratio), Round(300 * $y_ratio), Round(400 * $x_ratio), Round(450 * $y_ratio)) Then
  213.                         GUICtrlSetData($lblRun, "Runs till vendor: " & $mLootIn & ", Run Number: " & $run)
  214.                         GUICtrlSetData($lblLocation, "Location: Main Menu")
  215.                         GUICtrlSetData($lblStatus, "Status: Starting Game")
  216.                         RandClick("left", Round(230 * $x_ratio), Round(416 * $y_ratio), 120, 20, 1, 2) ;Random Click on the resume button
  217.                         CheckFor("OldRuins", "Area", 0, 0, 0, 0, $loadtime / 1000)
  218.                         ;Sleep($loadtime)
  219.                         $rt = TimerInit()
  220.                         $run += 1
  221.                 ElseIf CheckFor("OldRuins", "Area") Or CheckFor("NewTristram", "Area") Or CheckFor("DankCellar", "Area") Then
  222.                         Call("TownPortal")
  223.                         Call("LeaveGame")
  224.                         Return
  225.                 ElseIf CheckFor("LimitError", "", Round(700 * $x_ratio), Round(340 * $y_ratio), Round(1200 * $x_ratio), Round(600 * $y_ratio), 1, 140) Then
  226.                         MouseClick("left", Round(960 * $y_ratio), Round(635 * $x_ratio))
  227.                         $rand = Random(40000, 80000)
  228.                         GUICtrlSetData($lblStatus, "Status: Input Limit - Waiting " & Round($rand / 1000) & " seconds.")
  229.                         Sleep($rand)
  230.                         Send("{SPACE}")
  231.                         Return
  232.                 ElseIf CheckFor("Disconnect", "", Round(700 * $x_ratio), Round(340 * $y_ratio), Round(1200 * $x_ratio), Round(600 * $y_ratio), 1, 140) Then
  233.                         GUICtrlSetData($lblStatus, "Status: Network Disconnect window up")
  234.                         MouseClick("left", Round(960 * $x_ratio), Round(632 * $y_ratio))
  235.                         Sleep(100)
  236.                         Send("{SPACE}")
  237.                         Return
  238.                 Else
  239.                         GUICtrlSetData($lblStatus, "ERROR: Cannot find Resume button")
  240.                         Return
  241.                 EndIf
  242.                
  243.                 $CellarWasFound = 0
  244.                
  245.                 ;Make sure we are in the right area before beginning run
  246.                 ;If CheckFor("OldRuins", "Area") Then
  247.                    ;     Sleep(200)
  248.                   ;      Send($Skill3)
  249.                  ;       Sleep(100)
  250.                 ;        GUICtrlSetData($lblLocation, "Location: Old Ruins")
  251.                ;         Call("CheckRepair")
  252.                
  253.                If CheckFor("OldRuins", "Area", 1500*$x_ratio, 0*$y_ratio, 1920*$x_ratio, 80*$y_ratio, 6, 180) Then
  254.                         GUICtrlSetData($lblLocation, "Location: Old Ruins")
  255.                         ;Check if player needs to repair
  256.                         Call("CheckRepair")
  257.                        
  258.                         $cellfoundat = -1
  259.                        
  260.                         If $UseEnhancedCellarFind Then
  261.                                
  262.                                
  263.                                 MouseClick("left", Round(0 * $x_ratio),Round(250 * $y_ratio)) ;starts the main run
  264.                                  Send("{4 DOWN}")
  265.                                  Sleep(3500)
  266.                                  Send("{4 UP}")
  267.                                  Sleep(100)
  268.                                  MouseMove(Round(356*$x_ratio),Round(200*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  269.                                  Sleep(790)
  270.                                  If Call("CheckDead") Then
  271.                                     Return
  272.                                  EndIf
  273.                                  
  274.                                ; RandClick("middle", Round(587 * $x_ratio), Round(350 * $y_ratio), 2, 2) ;starts the main run
  275.                                ; Sleep(Random(700, 710))
  276.                                ; RandMove(Round(16 * $x_ratio), Round(350 * $y_ratio), 2, 2)
  277.                                ; Sleep(Random(5, 10))
  278.                                ; Send($Skill1) ;leap
  279.                                ; Sleep(700)
  280.                                ; DoSprint()
  281.                                ; Sleep(50)
  282.                                ; RandClick("middle", Round(2 * $x_ratio), Round(350 * $y_ratio), 1, 1, 1, 1)
  283.                                ; Sleep(800)
  284.                                ; RandClick("middle", Round(2 * $x_ratio), Round(400 * $y_ratio), 1, 1)
  285.                                ; walktime(Round(2 * $x_ratio), Round(400 * $y_ratio))
  286.                                
  287.                                 ; cellar check on minimap
  288.                                 FFSnapShot(1593 * $x_ratio, 62 * $y_ratio, 1880 * $x_ratio, 350 * $y_ratio, 0)
  289.                                 Local $bColorArray[3] = [0x692A09, 0x5A2408, 0x6A2A0A]
  290.  
  291.                                 FFAddColor($bColorArray)
  292.                                 FFAddExcludedArea(1824 * $x_ratio, 80 * $y_ratio, 1912 * $x_ratio, 353 * $y_ratio)
  293.                                 ;FFSaveBMP("CellarMinimap_" & @HOUR & @MIN & @SEC, false) ;->uncomment if you wanna see  the cellar minimap detection bmp ( gets saved where the script runs )
  294.                                 Local $aCoords = FFBestSpot(2, 1, 4, 367 * $x_ratio, 135 * $y_ratio, -1, 25, False)
  295.                                
  296.                                 If Not @error And IsArray($aCoords) Then
  297.                                         $cellfoundat = 1 ;found the cellar
  298.                                         FFResetColors()
  299.                                 Else
  300.                                         AddLog("enhanced fail")
  301.                                 EndIf
  302.                                
  303.                         Else
  304.                                 ;Start Run
  305.                               MouseClick("left", Round(0 * $x_ratio),Round(250 * $y_ratio)) ;starts the main run
  306.                               Send("{4 DOWN}")
  307.                               Sleep(3000)
  308.                               Send("{4 UP}")
  309.                               Sleep(100)
  310.                               MouseMove(Round(356*$x_ratio),Round(200*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  311.                               Sleep(790)
  312.                               If Call("CheckDead") Then
  313.                                     Return
  314.                               EndIf
  315.                                
  316.                                 For $i = 0 To UBound($celx) - 1
  317.                                         ;MouseMove(Round($celx[$i] * $x_ratio), Round($cely[$i] * $y_ratio), 1) ;moves cursor over to the cellar
  318.                                         Sleep(120)
  319.                                         ;$Pixel2 = PixelSearch(600, 0, Round(1000 * $x_ratio), Round(300 * $y_ratio), 0xffffff, 5)
  320.                                         $Pixel2 = PixelSearch(0, 0, Round(600 * $x_ratio), Round(600 * $y_ratio), 0x334FB7, 3) ;checks for open cellar (in a 600x400 box from the top left - where it should always be)
  321.                                         If Not @error Then
  322.                                                 $cellfoundat = $i
  323.                                                 ExitLoop
  324.                                         EndIf
  325.                                 Next
  326.                                
  327.                                 Sleep(100)
  328.                                
  329.                         EndIf
  330.                        
  331.                         If CheckDead() Then
  332.                                 Return
  333.                         EndIf
  334.  
  335.                         ;Checks if Dank Cellar is Open
  336.                         If $cellfoundat > -1 Then
  337.                                 GUICtrlSetData($lblStatus, "Status: Cellar - Found at " & $cellfoundat + 1)
  338.                                 Call("AddLog", "Cellar Found at: " & $cellfoundat + 1)
  339.                                 $cellarCount += 1
  340.                                
  341.                                 $cellaratx = 1000 * $x_ratio
  342.                                 $cellaraty = 500 * $y_ratio
  343.                                
  344.                                
  345.                                 If $UseEnhancedCellarFind Then
  346.                                        
  347.                                         ;RandClick("left", Round(400 * $x_ratio), Round(400 * $y_ratio), 1, 1)
  348.                                         ;walktime(Round(400 * $x_ratio), Round(400 * $y_ratio))
  349.                                        
  350.                                        Local $cellpos = EnhancedFind(300, 100, 500, 300, 600, 280)
  351.                                         $cellaratx = $cellpos[0]
  352.                                         $cellaraty = $cellpos[1]
  353.                                         RandClick("left", Round($cellaratx), Round($cellaraty), 1, 1, 2, 2) ;Entrance to cellar
  354.                                         sleep(375)
  355.                                         Send("2")
  356.                                         walktime(Round($cellaratx), Round($cellaraty))
  357.                                        
  358.                                         ;;Send($skillSmokeScreen)
  359.                                         ;;Moving($walktime)
  360.                                         ;Call("AddLog",walktime(Round($cellaratx), Round($cellaraty),0,True))
  361.                                         ;RandClick("left", Round(993 * $x_ratio), Round(469 * $y_ratio), 1, 1, 2, 2) ;Entrance to cellar
  362.                                        
  363.                                 Else
  364.                                         ;standard method co-ords
  365.                                         $cellaratx = $celx[$cellfoundat] * $x_ratio
  366.                                         $cellaraty = $cely[$cellfoundat] * $y_ratio
  367.                                         ;MouseClick("left", Round(450*$x_ratio), Round(215*$y_ratio), 1) ;Entrance to cellar
  368.                                         ;Moving(550)
  369.                                         ;Send($skillSmokeScreen)
  370.                                         ;Moving($walktime)
  371.                                 EndIf
  372.  
  373.                                
  374.                                 CheckFor("DankCellar", "Area", 0, 0, 0, 0, 1)
  375.                                 $CellarWasFound = 1
  376.                                
  377.                         Else ;ABORT RUN
  378.                         GUICtrlSetData($lblStatus, "Status: Cellar - Not Found" & @CRLF)
  379.                         Sleep(10)
  380.                         Send($skillPreparation)
  381.                         sleep(40)
  382.                         RandClick("middle", Round(1100*$x_ratio), Round(600*$y_ratio)) ;moves between caltrops for safety before teleporting back to town
  383.                         Moving(250)
  384.                         Send($skillCaltrops)
  385.                         Sleep(620)
  386.                         Send($skillSmokeScreen)
  387.                         Sleep(40)
  388.                         Call("TownPortal")
  389.                         sleep(600)
  390.                         If Not Call("CheckDead") Then
  391.                                 Call("LeaveGame")
  392.                         EndIf
  393.                         Return
  394.                
  395.         EndIf
  396.     Else
  397.         Call("TownPortal")
  398.         If Not Call("CheckDead") Then
  399.             Call("LeaveGame")
  400.         EndIf
  401.         Return
  402.      EndIf
  403.                
  404.                 $TryRecover = 0
  405.                 If Not CheckFor("DankCellar", "Area", 0, 0, 0, 0, .5) Then
  406.                         ;600 450 3s
  407.                         ;RandClick("left", Round(993 * $x_ratio), Round(469 * $y_ratio), 1) ;Entrance to cellar
  408.                         ;$TryRecover = 1
  409.                        
  410.                         MouseClick("left",780, 355)
  411.                        ; If Not CheckFor("DankCellar", "Area", 0, 0, 0, 0, 1.5) Then
  412.                                
  413.                                 ;If $UseEnhancedCellarFind Then
  414.                                         ;$TryRecover = 3
  415.                                         ;$cellpos = EnhancedFind(0, 0, 1300, 450, 1000, 350, True)
  416.                                         ;RandClick("left", Round($cellpos[0]), Round($cellpos[1]), 1) ;Entrance to cellar
  417.                                ;Else
  418.                                         ;$TryRecover = 2
  419.                                         ;RandClick("left", Round(600 * $x_ratio), Round(450 * $y_ratio), 1)
  420.                                        
  421.                                 ;EndIf
  422.                                
  423.                                 If Not CheckFor("DankCellar", "Area", 0, 0, 0, 0, 4) Then
  424.                                    Call("TownPortal")
  425.                                     If Not Call("CheckDead") Then
  426.                                     Call("LeaveGame")
  427.                                  EndIf
  428.                                 EndIF
  429.                                
  430.                        ; EndIf
  431.                        
  432.                 EndIf
  433.  
  434.                 ;Checks that the player is in the Dank Cellar
  435.                 If CheckFor("DankCellar", "Area") Then
  436.                         MouseClick("middle",Round(110*$x_ratio),Round(1000*$y_ratio)) ;moves to doorway leading to rare inside cellar
  437.                 Sleep(Random(2200, 2800))
  438.                 Send(3)
  439.                 Sleep(30)
  440.                 MouseClick("middle",Round(440*$x_ratio),Round(80*$y_ratio), 1) ;attacks the rare Sarkoth
  441.                 Sleep(2100)
  442.                 Send("{SHIFTDOWN}")
  443.                 Sleep(10)
  444.                 GUICtrlSetData($lblStatus, "Status: Attacking Sarkoth")
  445.                 MouseClick("left")
  446.                 Sleep(10)
  447.                 Send(2)
  448.                 Sleep(10)
  449.                 MouseDown("right") ;attack middle
  450.                 Sleep($SarkothKillTime)
  451.                 MouseClick("right",Round(960*$x_ratio),Round(502*$y_ratio),2)
  452.                 Sleep(100)
  453.                 Send("{SHIFTUP}")
  454.                 Sleep(10)
  455.                 Send(3)
  456.                 Sleep(10)
  457.                 GUICtrlSetData($lblStatus, "Status: Looting")
  458.                 MouseClick("middle",Round(637*$x_ratio),Round(540*$y_ratio)) ;move to left top corner for gold
  459.                 Sleep(1100)
  460.                 MouseClick("middle",Round(1320*$x_ratio),Round(310*$y_ratio)) ;move to right top corner for gold
  461.                 Sleep(1100)
  462.                 MouseClick("middle",Round(975*$x_ratio),Round(827*$y_ratio)) ;move to middle before looting
  463.                 Sleep(1500)
  464.                        
  465.                         GUICtrlSetData($lblStatus, "Status: Looting")
  466.                        
  467.                         $numgem = 0
  468.                         $numtomb = 0
  469.                         $numgold = 0
  470.                         $numpot = 0
  471.                         $numitem = 0
  472.                        
  473.                        
  474.                         Call("Loot")
  475.                         RandSleep(0, 6, 30)
  476.                         If $CheckLootWhilePorting Then
  477.                                 Send($TownPortalButton)
  478.                         EndIf
  479.                        
  480.                         Sleep(200)
  481.                         Send($Inventory)
  482.                         Sleep(200)
  483.                        
  484.                         $mon = _TesseractScreenCapture(0, "", 1, 2, 1454 * $x_ratio, 508 * $y_ratio, (1920 - 1571) * $x_ratio, (1080 - 525) * $y_ratio, 0)
  485.                        
  486.                         $mon = CleanOCR($mon)
  487.                         $mondelt = Number($mon) - Number($monold)
  488.                         If $mondelt > 15000 Then $mondelt = 5000
  489.                         If $monstart = 0 Then $monstart = Number($mon) - $mondelt
  490.                        
  491.                         Send($Inventory)
  492.                         Sleep(50)
  493.                         GUICtrlSetData($lblGold, "Gold: " & $mon & ", Run: " & $mondelt & ", Gain: " & Number($mon) - $monstart)
  494.                         $monold = $mon
  495.                        
  496.                         If $CheckLootWhilePorting Then
  497.                                
  498.                                 $lootany = 0
  499.                                
  500.                                 For $retryloot = 1 To 4
  501.  
  502.                                         Sleep(450)
  503.                                         Loot(True)
  504.                                         If $lootany > 0 Then
  505.                                                 Call("AddLog", 'Got extra loot on attempt ' & $retryloot)
  506.                                                 Call("TownPortal")
  507.                                                 ExitLoop
  508.                                         EndIf
  509.                                 Next
  510.                         Else
  511.                                 Call("TownPortal")
  512.                                
  513.                         EndIf
  514.                        
  515.                         Call("AddLog", 'Gold: ' & $mon & ', Gold Delt: ' & $mondelt & ', Items: ' & $numitem & ', Gems: ' & $numgem & ', Books: ' & $numtomb & ', Potions: ' & $numpot & ', GoldPick: ' & $numgold)
  516.                        
  517.                 Else
  518.                         If $TryRecover = 1 Then
  519.                                 Call("AddLog", 'OnCellar Recovery Failure')
  520.                         EndIf
  521.                         If $CellarWasFound = 1 Then
  522.                                 Call("AddLog", 'Cellar was found but didnt end up there')
  523.                         EndIf
  524.                         If $TakeMissShots Then
  525.                                 CaptureToTIFF("", "", "", "shots\MissCell_" & String($run) & ".tif", 1, 0, 0, 0, 0)
  526.                         EndIf
  527.                         Sleep(10)
  528.                         Send("{SHIFTDOWN}")
  529.                         RandClick("left", Round(900 * $x_ratio), Round(600 * $y_ratio), 100, 100) ;earthquake
  530.                         Send("{SHIFTUP}")
  531.                         Sleep(620)
  532.                         Call("TownPortal")
  533.                         If Not CheckDead() Then
  534.                                 Call("LeaveGame")
  535.                         EndIf
  536.                         Return
  537.                 EndIf
  538.                 ;After successful run
  539.                 If Not CheckDead() Then
  540.                         Sleep(600)
  541.                         If $mLootIn = 1 And CheckFor("NewTristram", "Area") Then ;If its time to manage loot and we are in town
  542.                                 $mLootIn = Round(Random($mLoot - $mLootOff, $mLoot + $mLootOff)) ;Reset Counter
  543.                                
  544.                                 If $UseiLVL Then
  545.                                         Call("AnalyseLoots")
  546.                                 Else
  547.                                         If $Identify Then Call("Identify")
  548.                                         If $StashLoot Then Call("StashLoot")
  549.                                        
  550.                                         If $SalvageLoot Then
  551.                                                 Call("SalvageLoot")
  552.                                         Else
  553.                                                 If $VendorLoot Then Call("VendorLoot")
  554.                                         EndIf
  555.                                 EndIf
  556.                                
  557.                         ElseIf Not CheckFor("NewTristram", "Area") Then
  558.                                 GUICtrlSetData($lblStatus, "Status: Skipping vendor, not in New Tristram")
  559.                                 Sleep(3000)
  560.                         ElseIf $mLootIn <= 0 Then
  561.                                 $mLootIn = 1
  562.                         Else
  563.                                 $mLootIn -= 1
  564.                         EndIf
  565.                         If Not CheckDead() Then
  566.                                 Call("LeaveGame")
  567.                         EndIf
  568.                        
  569.                         If ($RunsUntilMenuWaitCnt = 1) And ($RunsUntilMenuWait > 0) Then
  570.                                
  571.                                 $RunsUntilMenuWaitCnt = $RunsUntilMenuWait
  572.                                 Sleep(Random(3550000, 3650000)) ;wait 1 hour
  573.                         Else
  574.                                 $RunsUntilMenuWaitCnt -= 1
  575.                         EndIf
  576.                        
  577.                        
  578.                         Return
  579.                 Else
  580.                         Return
  581.                 EndIf
  582.         EndIf
  583. EndFunc   ;==>RestartRun
  584.  
  585. ;Helper Functions
  586. Func EnhancedFind($x1 = 0, $y1 = 0, $x2 = 577, $y2 = 220, $xpos = 367, $ypos = 135, $recov = False)
  587.  
  588.         For $retry = 1 To 3
  589.                 ; take 2 snapshots and black out everything that did not change
  590.                 FFSnapShot($x1 * $x_ratio, $y1 * $y_ratio, $x2 * $x_ratio, $y2 * $y_ratio, 2)
  591.                 Sleep(50)
  592.                 FFSnapShot($x1 * $x_ratio, $y1 * $y_ratio, $x2 * $x_ratio, $y2 * $y_ratio, 3)
  593.                 FFKeepChanges(3, 2, 25)
  594.                 ;FFSaveBMP("CellarOpen_" & @HOUR & @MIN & @SEC, false) ->uncomment if you wanna see  the cellar minimap motion map
  595.  
  596.                 ; do special search for the color in our motionmap
  597.                 Local $aColorArray[3] = [0x7897EB, 0x404E9E, 0x536CB6]
  598.                 FFAddColor($aColorArray) ; add color to find array
  599.                 ;Func FFBestSpot($SizeSearch, $MinNbPixel, $OptNbPixel, $PosX, $PosY, $Color, $ShadeVariation = 0, $ForceNewSnap = True, $Left = 0, $Top = 0, $Right = 0, $Bottom = 0, $NoSnapShot = $FFLastSnap, $WindowHandle = -1)
  600.                 Local $cellarCoords = FFBestSpot(10, 1, 4, $xpos * $x_ratio, $ypos * $y_ratio, -1, 25, False) ; search for the opening
  601.                
  602.                 If @error Or Not IsArray($cellarCoords) Then
  603.                         Call("AddLog", "The motionmap failed on try " & $retry & " with code " & @error)
  604.                         FFResetColors()
  605.                 Else
  606.                         ExitLoop
  607.                 EndIf
  608.  
  609.         Next
  610.  
  611.         If (Not @error) And IsArray($cellarCoords) Then
  612.                 FFResetColors()
  613.                 If Not $recov Then GUICtrlSetData($lblStatus, "Status: Cellar - Found position " & $cellarCoords[0] * $x_ratio & ", " & $cellarCoords[1] * $y_ratio)
  614.                 If Not $recov Then Call("AddLog", "Cellar - Found position " & $cellarCoords[0] * $x_ratio & ", " & $cellarCoords[1] * $y_ratio)
  615.         Else
  616.                 If $TakeMissShots Then
  617.                         CaptureToTIFF("", "", "", "shots\NoCell_" & String($run) & ".tif", 1, 0, 0, 0, 0)
  618.                 EndIf
  619.                 Dim $cellarCoords[2]
  620.                 $cellarCoords[0] = 1000 * $x_ratio
  621.                 $cellarCoords[1] = 500 * $y_ratio
  622.         EndIf
  623.        
  624.         Return $cellarCoords
  625.        
  626. EndFunc   ;==>EnhancedFind
  627.  
  628. Func SetupGUI()
  629.         $frmBot = GUICreate($title & $ver & " - Updating", 290, 140, Round(1580 * $x_ratio), Round(900 * $y_ratio), -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), 0)
  630.         GUISetBkColor(0xC0C0C0)
  631.         $lblRun = GUICtrlCreateLabel("Run Number: 0 - Runs till vendor: 0", 4, 0, 280, 24)
  632.         GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
  633.         GUICtrlSetColor(-1, 0xFF0000)
  634.         $lblLocation = GUICtrlCreateLabel("Location: Main Menu", 12, 20, 240, 17)
  635.         $lblStatus = GUICtrlCreateLabel("Status: ", 12, 35, 240, 17)
  636.         $lblLast = GUICtrlCreateLabel("Last Runtime: 0 seconds", 12, 50, 240, 17)
  637.         $lblRuntime = GUICtrlCreateLabel("Total Runtime: 0 hours, 0 minutes", 12, 65, 240, 17)
  638.         $lblGear = GUICtrlCreateLabel("Legendary: 0 - Set: 0 - Rare: 0", 12, 80, 240, 17)
  639.         $lblItems = GUICtrlCreateLabel("Magic: 0 - Gems: 0 - Tomes: 0", 12, 95, 240, 17)
  640.         $lblGold = GUICtrlCreateLabel("Gold: 0", 12, 110, 240, 17)
  641.         GUISetState(@SW_SHOW)
  642. EndFunc   ;==>SetupGUI
  643.  
  644.  
  645. Func CheckDead()
  646.         $LogoutTimerCancel = PixelSearch(Round(900 * $x_ratio), Round(240 * $y_ratio), Round(1010 * $x_ratio), Round(290 * $y_ratio), 0x993827) ; checks for cancel button on logout timer
  647.         If Not @error Then
  648.                
  649.                 Call("AddLog", "Logged out")
  650.                 GUICtrlSetData($lblStatus, "Status: Logging out")
  651.                 CheckFor("MainMenu", "", Round(40 * $x_ratio), Round(300 * $y_ratio), Round(400 * $x_ratio), Round(450 * $y_ratio), $loadtime / 1000)
  652.  
  653.                 Return 1
  654.         EndIf
  655.  
  656.         $CloseButton = PixelSearch(Round(1570 * $x_ratio), Round(110 * $y_ratio), Round(1590 * $x_ratio), Round(120 * $y_ratio), 0x8C2300) ; checks for the red color of the "X" on an open window
  657.         If Not @error Then
  658.                 GUICtrlSetData($lblStatus, "Status: Open Window")
  659.                 Call("AddLog", "Open Window")
  660.                 Sleep(200)
  661.                 Send("{SPACE}") ;close any open windows
  662.                 Return 1
  663.         EndIf
  664.         $YouHaveDied = PixelSearch(Round(620 * $x_ratio), Round(325 * $y_ratio), Round(625 * $x_ratio), Round(330 * $y_ratio), 0xFFFFFF) ; checks for white text "YOU HAVE DIED"
  665.         If Not @error Then
  666.                 GUICtrlSetData($lblStatus, "Status: Dead")
  667.                 Call("AddLog", "You have died")
  668.                 $deathCount += 1
  669.                 Call("LeaveGame")
  670.                 For $c = 1 To 110 + $loadtime / 100
  671.                         Sleep(100)
  672.                         If CheckFor("MainMenu", "", Round(40 * $x_ratio), Round(300 * $y_ratio), Round(400 * $x_ratio), Round(450 * $y_ratio), 0.1) Then ExitLoop
  673.                 Next
  674.                 Return 1
  675.         Else
  676.                 Return 0
  677.         EndIf
  678. EndFunc   ;==>CheckDead
  679.  
  680. Func CheckRepair()
  681.         $RepairArea = PixelSearch(Round(1480 * $x_ratio), 0, Round(1570 * $x_ratio), Round(100 * $y_ratio), $yellow)
  682.         If Not @error Then
  683.                 Call("DoRepair")
  684.         EndIf
  685.         $RepairAreaRed = PixelSearch(Round(1480 * $x_ratio), 0, Round(1570 * $x_ratio), Round(100 * $y_ratio), $red)
  686.         If Not @error Then
  687.                 Call("DoRepair")
  688.         EndIf
  689. EndFunc   ;==>CheckRepair
  690.  
  691. Func DoRepair()
  692.         Sleep(Random(75, 150))
  693.         Call("TownPortal")
  694.         If CheckDead() Then
  695.                 Return
  696.         EndIf
  697.         If CheckFor("NewTristram", "Area") Then
  698.                 RandClick("left", Round(1480 * $x_ratio), Round(281 * $y_ratio), 1, 1) ;begin movement towards merchant
  699.                 Moving(1875)
  700.                 RandClick("left", Round(1316 * $x_ratio), Round(206 * $y_ratio), 1, 1) ;moves to get merchant in screen
  701.                 Moving(1875)
  702.                 RandClick("left", Round(845 * $x_ratio), Round(225 * $y_ratio), 1, 1) ;NPC Merchant to the right of cain's home
  703.                 Sleep(1200)
  704.                 RandClick("left", Round(521 * $x_ratio), Round(506 * $y_ratio), 1, 1) ;button to open up repair menu
  705.                 Sleep(400)
  706.                 RandClick("left", Round(260 * $x_ratio), Round(595 * $y_ratio), 1, 1) ;button to pay for repairs
  707.                 Sleep(200)
  708.                 Send("{Escape}")
  709.                 Call("AddLog", "Repair")
  710.                 If Not CheckDead() Then
  711.                         Call("LeaveGame")
  712.                 EndIf
  713.         EndIf
  714. EndFunc   ;==>DoRepair
  715.  
  716. Func CalcTime()
  717.         $srt = TimerDiff($rt)
  718.         GUICtrlSetData($lblLast, "Last Runtime: " & Round($srt / 1000, 2) & " seconds.")
  719.         $trt = TimerDiff($t)
  720.         $total = Round((($trt / 1000) / 60) / 60, 4)
  721.  
  722.         Call("AddLog", "Last Runtime: " & Round($srt / 1000, 2) & " seconds.")
  723.  
  724.         ;Total runtime calculation.
  725.         $hours = Floor((($trt / 1000) / 60) / 60)
  726.         $minutes = (($trt / 1000) / 60)
  727.         ;trim minutes if runtime is more then 1 hour.
  728.         If $minutes > 60 Then
  729.                 While $minutes > 60
  730.                         $minutes -= 60
  731.                 WEnd
  732.         EndIf
  733.         GUICtrlSetData($lblRuntime, "Runtime: " & $hours & ":" & Ceiling($minutes) & ", GPH: " & Ceiling((Number($mon) - $monstart) / ($trt / 3600000)))
  734. EndFunc   ;==>CalcTime
  735.  
  736. Func CheckFor($img, $type = "", $startX = 0, $startY = 0, $endX = @DesktopWidth, $endY = @DesktopHeight, $seconds = 6, $tolerance = 140)
  737.         If $type = "Area" Then
  738.                 $startX = 1500 * $x_ratio
  739.                 $startY = 0 * $y_ratio
  740.                 $endX = 1920 * $x_ratio
  741.                 $endY = 90 * $y_ratio
  742.                 If $seconds = 6 Then $seconds = 2.5
  743.         EndIf
  744.  
  745.         $c = 0
  746.         $string = $pngLoc & $img & ".png"
  747.         Do
  748.                 $c += 1
  749.                 Sleep(200)
  750.                 If $c > ($seconds * 5) Then ;Make sure we never get stuck here for infinity.
  751.                         If $type = "Area" Then
  752.                                 GUICtrlSetData($lblStatus, "Status: Area not found - " & $img)
  753.                         EndIf
  754.                         Return False
  755.                 EndIf
  756.         Until _ImageSearchArea($string, 1, $startX, $startY, $endX, $endY, $gX, $gY, $tolerance)
  757.         GUICtrlSetData($lblStatus, "Status: Area found! " & $img)
  758.         Return True
  759. EndFunc   ;==>CheckFor
  760.  
  761.  
  762. Func WalkTime($lootx, $looty, $extra = 0, $returnv = False)
  763.  
  764.         $PPmSsprint = (960 / 2100) * $movementSpeed
  765.         $PPmSwalk = (960 / 3000) * $movementSpeed
  766.         Dim $BarbFeet[2] = [960 * $x_ratio, 505 * $y_ratio]
  767.        
  768.         $dist = Sqrt(($BarbFeet[0] - $lootx) ^ 2 + ($BarbFeet[1] - $looty) ^ 2)
  769.         $sprintremain = 3000 - TimerDiff($SprintStart)
  770.  
  771.         ;determine if sprint is still active to choose run speed
  772.         If $sprintremain > 0 Then ;duration of sprint - 100 for safty
  773.                 ;calculate milliseconds per pixel for this run, return delay
  774.                 ;calculate composite sleep time
  775.                 If $dist < $PPmSsprint * $sprintremain Then
  776.                         $stime = ($dist / $PPmSsprint + $extra)
  777.                 Else
  778.                         $stime = (($sprintremain + ($dist - $sprintremain * $PPmSsprint) / $PPmSwalk) + $extra)
  779.                 EndIf
  780.         Else
  781.                 $stime = ($dist / $PPmSwalk + $extra)
  782.         EndIf
  783.  
  784.         If $stime < 0 Then $stime = 0
  785.  
  786.         If Not $returnv Then
  787.  
  788.                 Sleep($stime)
  789.  
  790.         EndIf
  791.  
  792.         Return $stime
  793.  
  794. EndFunc   ;==>WalkTime
  795.  
  796. Func Loot($extra = False)
  797.  
  798.         If $PickUpHelp Then
  799.                send("{altdown}")
  800.         EndIf
  801.                
  802.  
  803.         MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  804.        
  805.         If Not $extra Then
  806.                
  807.                 If $LootGems Then
  808.                         LootImage("square.png", 90, 10)
  809.                 EndIf
  810.                 If $LootTomes Then
  811.                         LootImage("tome.png", 90, 10)
  812.                 EndIf
  813.                 If $LootMagic Then
  814.                         $mac = LootGear(0x6969FF, 0)
  815.                         $MagicCount += $mac
  816.                         $numitem -= $mac
  817.                 EndIf
  818.                
  819.         EndIf
  820.        
  821.         If $LootRares Then
  822.                 $RareCount += LootGear(0xBBBB00, 1)
  823.         EndIf
  824.        
  825.         If Not $extra Then
  826.                
  827.                 If $LootLegendaries Then
  828.  
  829.                         If $ReduceLegendSearch Then
  830.                                 $LegendaryCount += LootGear(0xBF642F, 1, 365, 442, 380)
  831.                                 $LegendaryCount += LootGear(0xBF642F, 1, 442, 1690, 115)
  832.                         Else
  833.                                 $LegendaryCount += LootGear(0xBF642F, 1)
  834.                         EndIf
  835.                        
  836.                 EndIf
  837.                
  838.         EndIf
  839.        
  840.         If $LootSets Then
  841.                 $SetCount += LootGear(0x02CE01, 2)
  842.         EndIf
  843.        
  844.         If $LootCustom Then
  845.                 Call("LootCustom")
  846.         EndIf
  847.          
  848.         If $PickUpHelp Then
  849.                send("{altup}")
  850.             EndIf
  851.            
  852.         Call("ShowLoot")
  853. EndFunc   ;==>Loot
  854.  
  855. Func LootGear($color, $tolerance = 2, $x1 = 400, $x2 = 1690, $y1 = 20, $y2 = 900)
  856.         $count = 0
  857.         $Loot = PixelSearch(Round($x1 * $x_ratio), Round($y1 * $y_ratio), Round($x2 * $x_ratio), Round($y2 * $y_ratio), $color, $tolerance)
  858.         If Not @error Then
  859.                 While Not @error
  860.                         $count += 1
  861.                         MouseClick('left', $Loot[0], $Loot[1], 1, 1)
  862.                         Sleep(20)
  863.                         MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  864.                         WalkTime($Loot[0], $Loot[1])
  865.                         ;Sleep(Random(700, 800))
  866.                         ;Run at max 10 times per quality
  867.                         $lootany += 1
  868.                         If $count >= 10 Then
  869.                                 ExitLoop
  870.                         EndIf
  871.                         $Loot = PixelSearch(Round(400 * $x_ratio), 0, Round(1690 * $x_ratio), Round(900 * $y_ratio), $color, $tolerance)
  872.                 WEnd
  873.         EndIf
  874.         $numitem += $count;
  875.         Return $count
  876. EndFunc   ;==>LootGear
  877.  
  878. Func LootImage($img, $tol, $max = 10, $x1 = 0, $y1 = 0, $x2 = @DesktopWidth, $y2 = @DesktopHeight)
  879.         $count = 0
  880.         $gX = 0
  881.         $gY = 0
  882.         GUICtrlSetData($lblStatus, "Status: Looting - " & $img)
  883.         While _ImageSearchArea($pngLoc & $img, 1, $x1, $y1, $x2, $y2, $gX, $gY, $tol)
  884.                 $count += 1
  885.                 MouseClick("left", $gX, $gY - 3, 1, 1)
  886.                 Sleep(50)
  887.                 MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  888.                 $lootany += 1
  889.                 If $img == "square.png" Then
  890.                         $GemCount += 1
  891.                         $numgem += 1
  892.                 ElseIf $img == "tome.png" Then
  893.                         $TomeCount += 1
  894.                         $numtomb += 1
  895.                 ElseIf $img == "gold.png" Then
  896.                         $numgold += 1
  897.                 ElseIf $img == "mythic.png" Then
  898.                         $numpot += 1
  899.                 EndIf
  900.                 If $img == "gold.png" Then
  901.                         WalkTime($gX, $gY, -500)
  902.                 Else
  903.                         WalkTime($gX, $gY)
  904.                 EndIf
  905.                 If $count >= $max Then
  906.                         ExitLoop
  907.                 EndIf
  908.         WEnd
  909.         Return $count
  910. EndFunc   ;==>LootImage
  911.  
  912. Func LootCustom()
  913.         For $i = 0 To ($totalItems - 1)
  914.                 $array = StringSplit($pick[$i], "|")
  915.                 LootImage($array[1], $array[2], 5)
  916.         Next
  917. EndFunc   ;==>LootCustom
  918.  
  919. Func Identify()
  920.         Send($Inventory)
  921.         Sleep(1300)
  922.         $count = 0
  923.         While _ImageSearchArea($pngLoc & "unidentified.png", 1, 1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $gX, $gY, 120)
  924.                 $count += 1
  925.                 GUICtrlSetData($lblStatus, "Status: Identifying")
  926.                 MouseClick("right", $gX, $gY, 1, 4)
  927.                 MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  928.                 Sleep(Random(3000, 3500))
  929.                 If $count >= 30 Then
  930.                         ExitLoop
  931.                 EndIf
  932.         WEnd
  933.         Send($Inventory)
  934.         Sleep(200)
  935. EndFunc   ;==>Identify
  936.  
  937. Func CleanOCR($text)
  938.         $out = ""
  939.         For $i = 1 To StringLen($text)
  940.                 $chr = Asc(StringMid($text, $i, 1))
  941.                 If $chr >= 48 And $chr <= 57 Then $out = $out & Chr($chr)
  942.                 If $chr = 79 Then $out = $out & '0'
  943.         Next
  944.         Return $out
  945. EndFunc   ;==>CleanOCR
  946.  
  947. Func ClickTab($Tabno)
  948.         If $Tabno = 1 Then RandClick("left", Round(517 * $x_ratio), Round(229 * $y_ratio), 3, 4)
  949.         If $Tabno = 2 Then RandClick("left", Round(517 * $x_ratio), Round(361 * $y_ratio), 3, 4)
  950.         If $Tabno = 3 Then RandClick("left", Round(517 * $x_ratio), Round(486 * $y_ratio), 3, 4)
  951.         Sleep(Random(100, 200))
  952.  
  953. EndFunc   ;==>ClickTab
  954.  
  955. Func UseNextTab()
  956.         If $ItemTab = $NextItemTab Then
  957.                 Call("AddLog", "Stash full Both tabs full, disabling stashing")
  958.                 $StashLegendary = False
  959.                 $StashRare = False
  960.                 $StashMagic = False
  961.         Else
  962.                 Call("AddLog", "Stash full Using next tab")
  963.                 $ItemTab = $NextItemTab
  964.         EndIf
  965. EndFunc   ;==>UseNextTab
  966.  
  967. Func AddLog($logtxt)
  968.         Local $file = FileOpen("log.txt", 1)
  969.         $msg = @MDAY & '/' & @MON & '/' & @YEAR & ' ' & @HOUR & ':' & @MIN & ':' & @SEC & ': ' & $logtxt & @CRLF
  970.         FileWrite($file, $msg)
  971.         FileClose($file)
  972.         ConsoleWrite($msg)
  973. EndFunc   ;==>AddLog
  974.  
  975. Func StashLoot()
  976.         GUICtrlSetData($lblStatus, "Status: Putting Items in Stash")
  977.         MouseClick("left", 1064 * $x_ratio, 256 * $y_ratio)
  978.         Sleep(Random(800, 1000))
  979.  
  980.         ClickTab($GemTab)
  981.         ;Tomes
  982.         If $StashTomes Then
  983.                 GUICtrlSetData($lblStatus, "Status: Stashing Tomes")
  984.                 ClickImage("TomeIcon.png", 140, 1)
  985.         EndIf
  986.        
  987.         ;Gems (DOESN'T STASH BOTTOM ROW!)
  988.         If $StashGems Then
  989.                 GUICtrlSetData($lblStatus, "Status: Stashing Gems")
  990.                 For $i = 0 To 7
  991.                         ClickImage($gems[$i], 150, 1)
  992.                 Next
  993.         EndIf
  994.        
  995.         $numstashed = 0;
  996.         ClickTab($ItemTab)
  997.  
  998.         If $StashLegendary Then
  999.                 ClickItems(0xFF7F00, 2, True, 5)
  1000.                 ClickItems(0x8F5C25, 2, True, 5)
  1001.         EndIf
  1002.  
  1003.         If $StashRare Then
  1004.                 ClickItems(0x4A3C0B, 1, True, 20)
  1005.         EndIf
  1006.        
  1007.         If $StashMagic Then
  1008.                 ClickItems(0x182037, 1, True, 30)
  1009.         EndIf
  1010.  
  1011.         Call("AddLog", "Stashed Items: " & $numstashed)
  1012.        
  1013.         Sleep(Random(300, 400))
  1014.        
  1015.        
  1016.         Send("{SPACE}")
  1017. EndFunc   ;==>StashLoot
  1018.  
  1019. Func VendorLoot()
  1020.         GUICtrlSetData($lblStatus, "Status: Vendoring Items")
  1021.              
  1022.        
  1023.         If Not $StashLoot Then ;Move from TP towards vendor
  1024.                 Sleep(Random(100, 300))
  1025.                 MouseClick("middle", 1565 * $x_ratio, 50 * $y_ratio)
  1026.                 walktime(1565 * $x_ratio, 50 * $y_ratio, 100)
  1027.         Else ;Move from Stash towards vendor
  1028.                 Sleep(Random(100, 300))
  1029.                 MouseClick("middle", 1560 * $x_ratio, 120 * $y_ratio)
  1030.                 walktime(1560 * $x_ratio, 120 * $y_ratio, 100)
  1031.         EndIf
  1032.  
  1033.         MouseClick("left", 1030 * $x_ratio, 210 * $y_ratio) ;Talk to vendor
  1034.         walktime(1030 * $x_ratio, 210 * $y_ratio, 250)
  1035.        
  1036.         $numsold = 0;
  1037.  
  1038.         ;All
  1039.         If $vendorAll Then
  1040.                 For $c = 1 To $vendorCols
  1041.                         For $r = 1 To $vendorRows
  1042.                                 RandClick("right", (((($c - 1) * 50) + 32 + 1400) * $x_ratio), (((($r - 1) * 51) + 32 + 580) * $y_ratio), 2, 2, 1, 2.5)
  1043.                         Next
  1044.                 Next
  1045.         EndIf
  1046.        
  1047.         ;Rares
  1048.         If $VendorRare Then
  1049.                 ClickItems(0x4A3C0B, 2)
  1050.         EndIf
  1051.         ;Magic
  1052.         If $VendorMagic Then
  1053.                 ClickItems(0x182037, 2)
  1054.         EndIf
  1055.        
  1056.         $montmp = $mon
  1057.         $mon = _TesseractScreenCapture(0, "", 1, 2, 1454 * $x_ratio, 508 * $y_ratio, (1920 - 1571) * $x_ratio, (1080 - 525) * $y_ratio, 0)
  1058.         $mon = CleanOCR($mon)
  1059.        
  1060.         If $mon > 0 Then
  1061.                 $mondelt = Number($mon) - Number($monold)
  1062.                 GUICtrlSetData($lblGold, "Gold: " & $mon & ", Sold value: " & $mondelt)
  1063.                 $monold = $mon
  1064.                 Call("AddLog", "Sold Items: " & $numsold & ", Sold value: " & $mondelt)
  1065.         Else
  1066.                 $mLootIn = 1
  1067.                 $mon = $montmp
  1068.                 Call("AddLog", "Somthing went wrong in town, retrying next time")
  1069.                 GUICtrlSetData($lblGold, "Vend fail, retry next run")
  1070.                 Return
  1071.         EndIf
  1072.        
  1073.         Sleep(200)
  1074.         RandClick("left", Round(521 * $x_ratio), Round(506 * $y_ratio), 1, 1) ;button to open up repair menu
  1075.         Sleep(300)
  1076.         RandClick("left", Round(260 * $x_ratio), Round(595 * $y_ratio), 1, 1) ;button to pay for repairs
  1077.         Sleep(400)
  1078.  
  1079.         $mon = _TesseractScreenCapture(0, "", 1, 2, 1454 * $x_ratio, 508 * $y_ratio, (1920 - 1571) * $x_ratio, (1080 - 525) * $y_ratio, 0)
  1080.         $mon = CleanOCR($mon)
  1081.         $mondelt = Number($mon) - Number($monold)
  1082.         GUICtrlSetData($lblGold, "Gold: " & $mon & ", Repair cost: " & $mondelt)
  1083.         $monold = $mon
  1084.         Call("AddLog", "Repair Cost: " & - $mondelt)
  1085.  
  1086.         GUICtrlSetData($lblStatus, "Status: Done With Vendor")
  1087.         Send("{ESCAPE}")
  1088. EndFunc   ;==>VendorLoot
  1089.  
  1090. Func ClickItems($color, $tolerance, $checkfull = False, $max = 30)
  1091.         $c = 0
  1092.         While $c < $max
  1093.                 RandMove(1200 * $x_ratio, 600 * $y_ratio, 5, 5, 2)
  1094.                 Sleep(Random(60, 120))
  1095.                 $StashPixel = PixelSearch(1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $color, $tolerance)
  1096.                 If Not @error Then
  1097.                         MouseClick("right", $StashPixel[0], $StashPixel[1], 1, 4)
  1098.                         $c += 1
  1099.                         If $checkfull Then
  1100.                                 $numstashed += 1
  1101.                         Else
  1102.                                 $numsold += 1
  1103.                         EndIf
  1104.                 Else
  1105.                         ExitLoop
  1106.                 EndIf
  1107.         WEnd
  1108.         Sleep(Random(60, 120))
  1109.         If $checkfull Then
  1110.                 If $c = $max Then Call("UseNextTab")
  1111.                 ClickTab($ItemTab)
  1112.         EndIf
  1113. EndFunc   ;==>ClickItems
  1114.  
  1115. Func ClickImage($image, $tolerance, $max = 20)
  1116.         For $c = 1 To $max
  1117.                 RandMove(1200 * $x_ratio, 600 * $y_ratio, 5, 5, 2)
  1118.                 Sleep(Random(100, 300))
  1119.                 If _ImageSearchArea($pngLoc & $image, 1, 1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $gX, $gY, $tolerance) Then
  1120.                         MouseClick("right", $gX, $gY, 1, 4)
  1121.                         Sleep(120)
  1122.                 Else
  1123.                         ExitLoop
  1124.                 EndIf
  1125.         Next
  1126. EndFunc   ;==>ClickImage
  1127.  
  1128. Func SalvageLoot()
  1129.  
  1130.         GUICtrlSetData($lblStatus, "Status: Salvaging Items")
  1131.         Sleep(Random(300, 500))
  1132.         MouseClick("middle", 1786 * $x_ratio, 535 * $y_ratio)
  1133.         walktime(1786 * $x_ratio, 535 * $y_ratio, 100)
  1134.         ;Sleep(2000)
  1135.         MouseClick("left", 1430 * $x_ratio, 390 * $y_ratio) ;Talk to anvil
  1136.         ;Sleep(3000)
  1137.         walktime(1430 * $x_ratio, 390 * $y_ratio, 100)
  1138.  
  1139.         $c = 0
  1140.         While $c <= 20
  1141.                 Sleep(Random(200, 300))
  1142.                 $MagicPixel = PixelSearch(1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 830 * $y_ratio, 0x182037, 1)
  1143.                 If Not @error Then
  1144.                         MouseClick("left", 265 * $x_ratio, 291 * $y_ratio, 1, 4)
  1145.                         Sleep(Random(200, 300))
  1146.                         MouseClick("left", $MagicPixel[0], $MagicPixel[1], 1, 4)
  1147.                         Sleep(Random(200, 300))
  1148.                         MouseClick("left", 1072 * $x_ratio, 375 * $y_ratio, 1, 4)
  1149.                         RandMove(1200 * $x_ratio, 600 * $y_ratio, 5, 5, 2)
  1150.                         Sleep(40)
  1151.                         $c += 1
  1152.                 Else
  1153.                         ExitLoop
  1154.                 EndIf
  1155.         WEnd
  1156.         Call("AddLog", "Salvaged Items: " & $c)
  1157.  
  1158.         Send("{ESCAPE}")
  1159.         Sleep(Random(300, 500))
  1160. EndFunc   ;==>SalvageLoot
  1161.  
  1162. Func _ImageSearchArea($findImage, $resultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $tolerance)
  1163.         If $tolerance > 0 Then $findImage = "*" & $tolerance & " " & $findImage
  1164.         $findImage = "*TRANSBLACK " & $findImage
  1165.         If @AutoItX64 Then
  1166.                 $result = DllCall("ImageSearchDLL_x64.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage)
  1167.         Else
  1168.                 $result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage)
  1169.         EndIf
  1170.         If $result = "0" Then
  1171.                 Return 0
  1172.         EndIf
  1173.  
  1174.         ; Otherwise get the x,y location of the match and the size of the image to
  1175.         ; compute the centre of search
  1176.         $array = StringSplit($result[0], "|")
  1177.         If (UBound($array) >= 4) Then
  1178.                 $x = Int(Number($array[2]))
  1179.                 $y = Int(Number($array[3]))
  1180.                 If $resultPosition = 1 Then
  1181.                         $x = $x + Int(Number($array[4]) / 2)
  1182.                         $y = $y + Int(Number($array[5]) / 2)
  1183.                 EndIf
  1184.                 Return 1
  1185.         EndIf
  1186. EndFunc   ;==>_ImageSearchArea
  1187.  
  1188. Func LeaveGame()
  1189.  
  1190.         Call("RandSleep")
  1191.         GUICtrlSetData($lblStatus, "Status: Leaving Game")
  1192.         Send("{Escape}")
  1193.         Sleep(200)
  1194.         RandClick("left", Round(956 * $x_ratio), Round(579 * $y_ratio), 120, 20) ;Random Click on the leave button
  1195.         Call("CalcTime")
  1196.         CheckFor("MainMenu", "", Round(40 * $x_ratio), Round(300 * $y_ratio), Round(400 * $x_ratio), Round(450 * $y_ratio), $loadtime / 1000)
  1197. EndFunc   ;==>LeaveGame
  1198.  
  1199. Func TownPortalShort()
  1200.  
  1201.         $gX = 0
  1202.         $gY = 0
  1203.         $c = 0
  1204.         GUICtrlSetData($lblStatus, "Status: Waiting for TP bar")
  1205.         Do
  1206.                 $c += 1
  1207.                 Sleep(200)
  1208.                 If $c > 4 Then Return
  1209.         Until _ImageSearchArea($pngLoc & "TP.png", 1, 600, 200, 1000, 500, $gX, $gY, 50)
  1210.  
  1211.         $seconds = $TPProtectTime
  1212.         $c = 0
  1213.  
  1214.         Do
  1215.                 $c += 1
  1216.                 GUICtrlSetData($lblStatus, "Status: Prepared for inturrupt, " & $seconds * 5 - $c)
  1217.                 Sleep(200)
  1218.                 If $c > ($seconds * 5) Then ;Make sure we never get stuck here for infinity.
  1219.                         GUICtrlSetData($lblStatus, "Status: safe, doing long wait for town")
  1220.                         Sleep($tptime - $seconds * 1000 - 1200)
  1221.                         GUICtrlSetData($lblStatus, "Status: detecting town")
  1222.                         CheckFor("NewTristram", "Area")
  1223.                         Sleep(300)
  1224.                         Return
  1225.                 EndIf
  1226.         Until Not _ImageSearchArea($pngLoc & "TP.png", 1, 600, 200, 1000, 500, $gX, $gY, 50)
  1227.  
  1228. EndFunc   ;==>TownPortalShort
  1229.  
  1230. Func TownPortal()
  1231.  
  1232.         GUICtrlSetData($lblStatus, "Status: Returning to Town")
  1233.         Send($TownPortalButton)
  1234.        
  1235.         If $DetectTPFail Then
  1236.                 Call("TownPortalShort")
  1237.         Else
  1238.                 Sleep(Random($tptime, $tptime + 500))
  1239.         EndIf
  1240.        
  1241. EndFunc   ;==>TownPortal
  1242.  
  1243. #region OtherStuff
  1244.  
  1245. Func Moving($time)
  1246.         Sleep($time / $movementSpeed)
  1247. EndFunc   ;==>Moving
  1248.  
  1249. Func RandClick($clickType, $xpos, $ypos, $xOff = 10, $yOff = 10, $clicks = 1, $speed = 4)
  1250.         If $xOff < 1 Then $xOff = 1
  1251.         If $yOff < 1 Then $yOff = 1
  1252.         $randX = Round(Random($xpos - ($xOff * $x_ratio), $xpos + ($xOff * $x_ratio)))
  1253.         $randY = Round(Random($ypos - ($yOff * $y_ratio), $ypos + ($yOff * $y_ratio)))
  1254.         MouseClick($clickType, $randX, $randY, $clicks, $speed)
  1255. EndFunc   ;==>RandClick
  1256.  
  1257. Func RandMove($xpos, $ypos, $xOff = 10, $yOff = 10, $speed = 1)
  1258.         $randX = Round(Random($xpos - ($xOff * $x_ratio), $xpos + ($xOff * $x_ratio)))
  1259.         $randY = Round(Random($ypos - ($yOff * $y_ratio), $ypos + ($yOff * $y_ratio)))
  1260.         MouseMove($randX, $randY, $speed)
  1261. EndFunc   ;==>RandMove
  1262.  
  1263. Func RandSleep($min = 5, $max = 45, $chance = 3)
  1264.         $randNum = Round(Random(1, 100))
  1265.         If $Timer And $randNum <= $chance Then
  1266.                 $sleepTime = Random($min * 1000, $max * 1000)
  1267.                 GUICtrlSetData($lblStatus, "Status: Random Sleep - " & Round($sleepTime / 1000) & " secs")
  1268.                 For $c = 0 To 10
  1269.                         Sleep($sleepTime / 10)
  1270.                 Next
  1271.         EndIf
  1272. EndFunc   ;==>RandSleep
  1273. ;Hotkey Functions
  1274.  
  1275. Func Begin()
  1276.         $Go = Not $Go
  1277.         If Not $Go Then WinSetTitle($title, "", $title & $ver & " - Halted")
  1278. EndFunc   ;==>Begin
  1279.  
  1280. Func TogglePause()
  1281.         $Paused = Not $Paused
  1282.         While $Paused
  1283.                 Sleep(100)
  1284.                 WinSetTitle($title, "", $title & $ver & " - Paused")
  1285.                 ToolTip('[PAUSED] - Deaths: ' & $deathCount & ' | Cellars: ' & $cellarCount, 0, 0)
  1286.         WEnd
  1287.         WinSetTitle($title, "", $title & $ver & " - Running")
  1288.         ToolTip("")
  1289. EndFunc   ;==>TogglePause
  1290.  
  1291. Func ShowLoot()
  1292.         GUICtrlSetData($lblGear, "Legendary: " & $LegendaryCount & " - Set: " & $SetCount & " - Rare: " & $RareCount)
  1293.         GUICtrlSetData($lblItems, "Magic: " & $MagicCount & " - Gems: " & $GemCount & " - Tomes: " & $TomeCount)
  1294. EndFunc   ;==>ShowLoot
  1295.  
  1296. Func Stop() ;to allow the script to stop
  1297.         Exit
  1298. EndFunc   ;==>Stop
  1299. Func GoTown()
  1300.         $mLootIn = 1
  1301. EndFunc   ;==>GoTown
  1302.  
  1303. Func AnalyseLoots() ; Grid search + ilvl detection, a little bit slower than old method but computes db for fast stashing/vendoring/new salvaging
  1304.         ;ConsoleWrite("---- NEW ANALYSIS ----" & @crlf)
  1305.         $str_Stash = ""
  1306.         $str_StashGems = ""
  1307.         $str_StashMisc = ""
  1308.         $str_Vendor = ""
  1309.         $str_Salvage = ""
  1310.         $int_TownPosition = 0
  1311.         $int_emptygrid = 0
  1312.         $str_Ignore = ""
  1313.         $nX = 0
  1314.         $nY = 0
  1315.         GUICtrlSetData($lblStatus, "Status: Analysing loots")
  1316.         Send("c")
  1317.         Sleep(500)
  1318.         For $y = 0 To 5
  1319.                 $int_emptygrid = 0
  1320.                 MouseMove(1435, Round(609 + (45 * $y)), 1)
  1321.                 Sleep(500)
  1322.                 For $x = 0 To 9
  1323.                         If StringInStr($str_Ignore, 1435 + (48 * $x) & "," & 609 + (45 * $y)) Then ContinueLoop
  1324.                         MouseMove(1435 + (48 * $x), 609 + (45 * $y), 1)
  1325.                         Sleep(300)
  1326.                         If _ImageSearchArea($pngLoc & "tt_check.png", 0, Round((1435 + (48 * $x) - 455) * $x_ratio), Round((609 + (45 * $y) - 500) * $y_ratio), Round((1435 + (48 * $x) - 35) * $x_ratio), Round(1080 * $y_ratio), $gX, $gY, 10) Then ; If tooltip exists
  1327.                                 $int_emptygrid = 0
  1328.                                 If _ImageSearchArea($pngLoc & "tt_unidentified.png", 0, $gX, $gY, $gX + 425, $gY + 70, $gX, $gY, 40) And $Identify Then ; Identify items.
  1329.                                         MouseClick("secondary")
  1330.                                         Sleep(Random(3000, 3500, 1))
  1331.                                 EndIf
  1332.                                 If _ImageSearchArea($pngLoc & "tt_square.png", 0, $gX, $gY, $gX + 425, $gY + 70, $gX, $gY, 40) Then ; Gem, automatic stashing.
  1333.                                         $str_StashGems = $str_StashGems & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1334.                                         ContinueLoop
  1335.                                 EndIf
  1336.                                 If _ImageSearchArea($pngLoc & "tt_tome.png", 0, $gX, $gY, $gX + 425, $gY + 70, $gX, $gY, 40) Then ; Tome, automatic stashing.
  1337.                                         $str_StashMisc = $str_StashMisc & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1338.                                         ContinueLoop
  1339.                                 EndIf
  1340.                                 If _ImageSearchArea($pngLoc & "tt_exquisite.png", 0, $gX, $gY, $gX + 425, $gY + 70, $gX, $gY, 40) Then ; Crafting, automatic stashing.
  1341.                                         $str_StashMisc = $str_StashMisc & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1342.                                         ContinueLoop
  1343.                                 EndIf
  1344.                                 If _ImageSearchArea($pngLoc & "tt_iridescent.png", 0, $gX, $gY, $gX + 425, $gY + 70, $gX, $gY, 40) Then ; Crafting, automatic stashing.
  1345.                                         $str_StashMisc = $str_StashMisc & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1346.                                         ContinueLoop
  1347.                                 EndIf
  1348.                                 If _ImageSearchArea($pngLoc & "tt_fiery.png", 0, $gX, $gY, $gX + 425, $gY + 70, $gX, $gY, 40) Then ; Crafting, automatic stashing (faster than the pixel detection below).
  1349.                                         $str_StashMisc = $str_StashMisc & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1350.                                         ContinueLoop
  1351.                                 EndIf
  1352.                                 If _ImageSearchArea($pngLoc & "tt_plan.png", 0, $gX, $gY, $gX + 425, $gY + 70, $gX, $gY, 60) Then ; Plans, automatic stashing.
  1353.                                         $str_StashMisc = $str_StashMisc & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1354.                                         ContinueLoop
  1355.                                 EndIf
  1356.                                 If _ImageSearchArea($pngLoc & "tt_neck.png", 0, $gX + 320, $gY + 60, $gX + 425, $gY + 150, $nX, $nY, 60) == 0 And _ImageSearchArea($pngLoc & "tt_waist.png", 0, $gX + 320, $gY + 60, $gX + 425, $gY + 150, $nX, $nY, 60) == 0 And _ImageSearchArea($pngLoc & "tt_finger.png", 0, $gX + 320, $gY + 60, $gX + 425, $gY + 150, $nX, $nY, 60) == 0 And _ImageSearchArea($pngLoc & "tt_follower.png", 0, $gX + 320, $gY + 60, $gX + 425, $gY + 150, $nX, $nY, 60) == 0 Then
  1357.                                         $str_Ignore = $str_Ignore & "|" & 1435 + (48 * $x) & "," & 609 + (45 * ($y + 1))
  1358.                                 EndIf
  1359.                                 $tt_title = PixelSearch($gX, $gY, $gX + 425, $gY + 70, 0x00FF00, 1) ; Set, no ilvl check since they drop rarely. Goes to stash.
  1360.                                 If Not @error Then
  1361.                                         $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1362.                                         ContinueLoop
  1363.                                 EndIf
  1364.                                 $tt_title = PixelSearch($gX, $gY, $gX + 425, $gY + 70, 0xBF642F, 1) ; Legendary, no ilvl check since they drop rarely. Goes to stash.
  1365.                                 If Not @error Then
  1366.                                         $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1367.                                         ContinueLoop
  1368.                                 EndIf
  1369.                                 $tt_title = PixelSearch($gX, $gY, $gX + 425, $gY + 70, 0xFFFF00, 1) ; Rare
  1370.                                 If Not @error Then
  1371.                                         If _ImageSearchArea($pngLoc & "ilvl59.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Rare ilvl 59
  1372.                                                 If (getOption("i59r") == 1) Then
  1373.                                                         $str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
  1374.                                                 ElseIf (getOption("i59r") == 2) Then
  1375.                                                         $str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
  1376.                                                 Else
  1377.                                                         $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
  1378.                                                 EndIf
  1379.                                                 ContinueLoop
  1380.                                         EndIf
  1381.                                         If _ImageSearchArea($pngLoc & "ilvl60.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Rare ilvl 60,  goes to salvage
  1382.                                                 If (getOption("i60r") == 1) Then
  1383.                                                         $str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
  1384.                                                 ElseIf (getOption("i60r") == 2) Then
  1385.                                                         $str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
  1386.                                                 Else
  1387.                                                         $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
  1388.                                                 EndIf
  1389.                                                 ContinueLoop
  1390.                                         EndIf
  1391.                                         If _ImageSearchArea($pngLoc & "ilvl61.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Rare ilvl 61,  goes to salvage
  1392.                                                 If (getOption("i61r") == 1) Then
  1393.                                                         $str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
  1394.                                                 ElseIf (getOption("i61r") == 2) Then
  1395.                                                         $str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
  1396.                                                 Else
  1397.                                                         $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
  1398.                                                 EndIf
  1399.                                                 ContinueLoop
  1400.                                         EndIf
  1401.                                         If _ImageSearchArea($pngLoc & "ilvl62.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Rare ilvl 62,  goes to salvage
  1402.                                                 If (getOption("i62r") == 1) Then
  1403.                                                         $str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
  1404.                                                 ElseIf (getOption("i62r") == 2) Then
  1405.                                                         $str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
  1406.                                                 Else
  1407.                                                         $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y) & ",r"
  1408.                                                 EndIf
  1409.                                                 ContinueLoop
  1410.                                         EndIf
  1411.                                         If _ImageSearchArea($pngLoc & "ilvl63.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Rare ilvl 63,  goes to stash
  1412.                                                 If (getOption("i63r") == 1) Then
  1413.                                                         $str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1414.                                                 ElseIf (getOption("i63r") == 2) Then
  1415.                                                         $str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1416.                                                 Else
  1417.                                                         $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1418.                                                 EndIf
  1419.                                                 ContinueLoop
  1420.                                         EndIf
  1421.                                         ; Below ilvl 59
  1422.                                         If $StashRare Then
  1423.                                                 $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1424.                                         ElseIf $VendorRare Then
  1425.                                                 $str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1426.                                         Else
  1427.                                                 $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1428.                                         EndIf
  1429.                                         ContinueLoop
  1430.                                 EndIf
  1431.                                
  1432.                                 $tt_title = PixelSearch($gX, $gY, $gX + 425, $gY + 40, 0xFF0000, 1) ; unusable rares, legendaries & sets. Goes to stash.
  1433.                                 If Not @error Then
  1434.                                         $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1435.                                         ContinueLoop
  1436.                                 EndIf
  1437.                                
  1438.                                 $tt_title = PixelSearch($gX, $gY, $gX + 425, $gY + 70, 0x6969FF, 1) ; Magic
  1439.                                 If Not @error Then
  1440.                                         If _ImageSearchArea($pngLoc & "ilvl59.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Magic ilvl 59
  1441.                                                 If (getOption("i59m") == 1) Then
  1442.                                                         $str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1443.                                                 ElseIf (getOption("i59m") == 2) Then
  1444.                                                         $str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1445.                                                 Else
  1446.                                                         $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1447.                                                 EndIf
  1448.                                                 ContinueLoop
  1449.                                         EndIf
  1450.                                         If _ImageSearchArea($pngLoc & "ilvl60.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Magic ilvl 60, goes to salvage
  1451.                                                 If (getOption("i60m") == 1) Then
  1452.                                                         $str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1453.                                                 ElseIf (getOption("i60m") == 2) Then
  1454.                                                         $str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1455.                                                 Else
  1456.                                                         $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1457.                                                 EndIf
  1458.                                                 ContinueLoop
  1459.                                         EndIf
  1460.                                         If _ImageSearchArea($pngLoc & "ilvl61.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Magic ilvl 61, goes to salvage
  1461.                                                 If (getOption("i61m") == 1) Then
  1462.                                                         $str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1463.                                                 ElseIf (getOption("i61m") == 2) Then
  1464.                                                         $str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1465.                                                 Else
  1466.                                                         $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1467.                                                 EndIf
  1468.                                                 ContinueLoop
  1469.                                         EndIf
  1470.                                         If _ImageSearchArea($pngLoc & "ilvl62.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Magic ilvl 62, goes to salvage
  1471.                                                 If (getOption("i62m") == 1) Then
  1472.                                                         $str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1473.                                                 ElseIf (getOption("i62m") == 2) Then
  1474.                                                         $str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1475.                                                 Else
  1476.                                                         $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1477.                                                 EndIf
  1478.                                                 ContinueLoop
  1479.                                         EndIf
  1480.                                         If _ImageSearchArea($pngLoc & "ilvl63.png", 0, $gX, $gY, $gX + 125, Round(1080 * $y_ratio), $gX, $gY, 20) Then ; Magic ilvl 63, goes to stash
  1481.                                                 If (getOption("i63m") == 1) Then
  1482.                                                         $str_Salvage = $str_Salvage & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1483.                                                 ElseIf (getOption("i63m") == 2) Then
  1484.                                                         $str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1485.                                                 Else
  1486.                                                         $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1487.                                                 EndIf
  1488.                                                 ContinueLoop
  1489.                                         EndIf
  1490.                                         ; Below ilvl 59
  1491.                                         If $StashMagic Then
  1492.                                                 $str_Stash = $str_Stash & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1493.                                         ElseIf $VendorMagic Then
  1494.                                                 $str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1495.                                         Else
  1496.                                                 $str_Ignore = $str_Ignore & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1497.                                         EndIf
  1498.                                         ContinueLoop
  1499.                                 EndIf
  1500.                                 ; Probably white/gray trash bugged pick, add to vendor string
  1501.                                 $str_Vendor = $str_Vendor & "|" & 1435 + (48 * $x) & "," & 609 + (45 * $y)
  1502.                         Else
  1503.                                 $int_emptygrid += 1
  1504.                                 If $int_emptygrid == 2 Then ; If there's nothing 2 times in a row in a row (see wut i did thar?), it probably ends here, skip to the next row.
  1505.                                         $int_emptygrid = 0
  1506.                                         ExitLoop
  1507.                                 Else
  1508.                                         ContinueLoop
  1509.                                 EndIf
  1510.                         EndIf
  1511.                 Next
  1512.         Next
  1513.         Send("c")
  1514.         Sleep(500)
  1515.         ;Call("AddLog", "Stash gear : "  & $str_Stash )
  1516.         ;Call("AddLog", "Stash misc : "  & $str_StashMisc )
  1517.         ;Call("AddLog", "Stash gems : "  & $str_StashGems )
  1518.         ;Call("AddLog", "Salvage : "  & $str_Salvage )
  1519.         ;Call("AddLog", "Vendor : "  & $str_Vendor )
  1520.         ;Call("AddLog", "Ignored Square : "  & $str_Ignore )
  1521.  
  1522.  
  1523.         Call("AddLog", "Stashed Items: " & UBound(StringSplit($str_Stash, "|")))
  1524.  
  1525.         If $str_Stash <> "" Or $str_StashGems <> "" Or $str_StashMisc <> "" Then Call("StashLoot_new")
  1526.         If $str_Salvage <> "" Then Call("SalvageLoot_new")
  1527.         If $str_Vendor <> "" Then Call("VendorLoot_new")
  1528. EndFunc   ;==>AnalyseLoots
  1529.  
  1530. Func StashLoot_new()
  1531.         $arr_split = ""
  1532.         $pos_split = ""
  1533.         GUICtrlSetData($lblStatus, "Status: Putting Items in Stash")
  1534.         MouseClick("left", 1064 * $x_ratio, 256 * $y_ratio)
  1535.         Moving(1600)
  1536.         $int_TownPosition = 1
  1537.  
  1538.         ;Gems Page 1
  1539.         If $str_StashGems <> "" Then
  1540.                 ClickTab($GemTab)
  1541.                 $str_StashGems = StringMid($str_StashGems, 2)
  1542.                 $arr_split = StringSplit($str_StashGems, "|")
  1543.                 For $i = 1 To $arr_split[0]
  1544.                         Sleep(Random(300, 350))
  1545.                         $pos_split = StringSplit($arr_split[$i], ",", 2)
  1546.                         MouseClick("right", $pos_split[0], $pos_split[1], 1, 3)
  1547.                 Next
  1548.         EndIf
  1549.  
  1550.         ;Tomes/Crafting Materials/Plans/Etc Page 2
  1551.         If $str_StashMisc <> "" Then
  1552.                 ClickTab($GemTab)
  1553.                 $str_StashMisc = StringMid($str_StashMisc, 2)
  1554.                 $arr_split = StringSplit($str_StashMisc, "|")
  1555.                 For $i = 1 To $arr_split[0]
  1556.                         Sleep(Random(300, 350))
  1557.                         $pos_split = StringSplit($arr_split[$i], ",", 2)
  1558.                         MouseClick("right", $pos_split[0], $pos_split[1], 1, 3)
  1559.                 Next
  1560.         EndIf
  1561.  
  1562.         ;Gears Page 2
  1563.         If $str_Stash <> "" Then
  1564.                 $str_Stash = StringMid($str_Stash, 2)
  1565.                 $arr_split = StringSplit($str_Stash, "|")
  1566.                 For $i = 1 To $arr_split[0]
  1567.                         Sleep(Random(80, 100))
  1568.                         If Random() < 0.5 Then
  1569.                                 ClickTab($ItemTab)
  1570.                         Else
  1571.                                 ClickTab($NextItemTab)
  1572.                         EndIf
  1573.                        
  1574.                         Sleep(Random(300, 350))
  1575.                         $pos_split = StringSplit($arr_split[$i], ",", 2)
  1576.                         MouseClick("right", $pos_split[0], $pos_split[1], 1, 3)
  1577.                 Next
  1578.         EndIf
  1579.  
  1580.         Sleep(Random(100, 150))
  1581.         Send("{SPACE}")
  1582. EndFunc   ;==>StashLoot_new
  1583.  
  1584. Func SalvageLoot_new()
  1585.         $arr_split = ""
  1586.         $pos_split = ""
  1587.         GUICtrlSetData($lblStatus, "Status: Salvaging loots")
  1588.         If $int_TownPosition = 0 Then ; Starting from TP
  1589.                 MouseClick("middle", 1582 * $x_ratio, 527 * $y_ratio)
  1590.                 Moving(2000)
  1591.                 MouseClick("left", 1661 * $x_ratio, 409 * $y_ratio)
  1592.                 Moving(2500)
  1593.         Else ; Starting from Stash
  1594.                 MouseClick("middle", 1484 * $x_ratio, 583 * $y_ratio)
  1595.                 Moving(2000)
  1596.                 MouseClick("left", 1773 * $x_ratio, 484 * $y_ratio)
  1597.                 Moving(2500)
  1598.         EndIf
  1599.         $int_TownPosition = 2
  1600.         MouseClick("left", 263 * $x_ratio, 287 * $y_ratio)
  1601.         $str_Salvage = StringMid($str_Salvage, 2)
  1602.         $arr_split = StringSplit($str_Salvage, "|")
  1603.         For $i = 1 To $arr_split[0]
  1604.                 Sleep(Random(300, 400))
  1605.                 $pos_split = StringSplit($arr_split[$i], ",")
  1606.                 MouseClick("left", $pos_split[1], $pos_split[2], 1, 3)
  1607.                 If $pos_split[0] == 3 Then
  1608.                         Send("{ENTER}")
  1609.                         Sleep(1000)
  1610.                 EndIf
  1611.         Next
  1612.         Sleep(Random(300, 400))
  1613.         Send("{SPACE}")
  1614. EndFunc   ;==>SalvageLoot_new
  1615.  
  1616. Func VendorLoot_new()
  1617.         $arr_split = ""
  1618.         $pos_split = ""
  1619.         GUICtrlSetData($lblStatus, "Status: Vendoring Items")
  1620.         If $int_TownPosition = 0 Then ; Starting from TP
  1621.                 MouseClick("middle", 1565 * $x_ratio, 50 * $y_ratio)
  1622.         ElseIf $int_TownPosition = 1 Then ; Starting from Stash
  1623.                 MouseClick("middle", 1560 * $x_ratio, 120 * $y_ratio)
  1624.         Else ; Starting from Blacksmith
  1625.                 MouseClick("middle", 738 * $x_ratio, 64 * $y_ratio)
  1626.         EndIf
  1627.         Moving(3000)
  1628.         MouseClick("left", 1030 * $x_ratio, 210 * $y_ratio) ;Talk to vendor
  1629.         Moving(3000)
  1630.         $str_Vendor = StringMid($str_Vendor, 2)
  1631.         $arr_split = StringSplit($str_Vendor, "|")
  1632.         For $i = 1 To $arr_split[0]
  1633.                 Sleep(Random(100, 300))
  1634.                 $pos_split = StringSplit($arr_split[$i], ",", 2)
  1635.                 MouseClick("right", $pos_split[0], $pos_split[1], 1, 3)
  1636.                 If PixelGetColor(819 * $x_ratio, 375 * $y_ratio) == 0x370C00 Then Send("{ENTER}")
  1637.         Next
  1638.         Sleep(Random(100, 200))
  1639.        
  1640.         $mon = _TesseractScreenCapture(0, "", 1, 2, 1454 * $x_ratio, 508 * $y_ratio, (1920 - 1571) * $x_ratio, (1080 - 525) * $y_ratio, 0)
  1641.         $mon = CleanOCR($mon)
  1642.         $mondelt = Number($mon) - Number($monold)
  1643.         GUICtrlSetData($lblGold, "Gold: " & $mon & ", Sold value: " & $mondelt)
  1644.         $monold = $mon
  1645.         Call("AddLog", "Sold Items: " & $arr_split[0] & ", Sold value: " & $mondelt)
  1646.        
  1647.         Sleep(Random(200, 300))
  1648.        
  1649.  
  1650.         RandClick("left", Round(521 * $x_ratio), Round(506 * $y_ratio), 1, 1) ;button to open up repair menu
  1651.         Sleep(200)
  1652.         RandClick("left", Round(260 * $x_ratio), Round(595 * $y_ratio), 1, 1) ;button to pay for repairs
  1653.         Sleep(400)
  1654.        
  1655.         $mon = _TesseractScreenCapture(0, "", 1, 2, 1454 * $x_ratio, 508 * $y_ratio, (1920 - 1571) * $x_ratio, (1080 - 525) * $y_ratio, 0)
  1656.         $mon = CleanOCR($mon)
  1657.         $mondelt = Number($mon) - Number($monold)
  1658.         GUICtrlSetData($lblGold, "Gold: " & $mon & ", Repair cost: " & $mondelt)
  1659.         $monold = $mon
  1660.         Call("AddLog", "Repair Cost: " & - $mondelt)
  1661.        
  1662.  
  1663.         GUICtrlSetData($lblStatus, "Status: Done With Vendor")
  1664.        
  1665.         Send("{SPACE}")
  1666.        
  1667. EndFunc   ;==>VendorLoot_new
  1668.  
  1669. Func getOption($option) ;Gets the correct INI settings corrisponding to the vend/stash/salvage of items.
  1670.  
  1671.         If ($option == "i59r") Then
  1672.                 If ($i59Rare = "salvage") Then
  1673.                         Return 1
  1674.                 ElseIf ($i59Rare = "vend") Then
  1675.                         Return 2
  1676.                 Else
  1677.                         Return 0
  1678.                 EndIf
  1679.         ElseIf ($option == "i60r") Then
  1680.                 If ($i60Rare = "salvage") Then
  1681.                         Return 1
  1682.                 ElseIf ($i60Rare = "vend") Then
  1683.                         Return 2
  1684.                 Else
  1685.                         Return 0
  1686.                 EndIf
  1687.         ElseIf ($option == "i61r") Then
  1688.                 If ($i61Rare = "salvage") Then
  1689.                         Return 1
  1690.                 ElseIf ($i61Rare = "vend") Then
  1691.                         Return 2
  1692.                 Else
  1693.                         Return 0
  1694.                 EndIf
  1695.         ElseIf ($option == "i62r") Then
  1696.                 If ($i62Rare = "salvage") Then
  1697.                         Return 1
  1698.                 ElseIf ($i62Rare = "vend") Then
  1699.                         Return 2
  1700.                 Else
  1701.                         Return 0
  1702.                 EndIf
  1703.         ElseIf ($option == "i63r") Then
  1704.                 If ($i63Rare = "salvage") Then
  1705.                         Return 1
  1706.                 ElseIf ($i63Rare = "vend") Then
  1707.                         Return 2
  1708.                 Else
  1709.                         Return 0
  1710.                 EndIf
  1711.         ElseIf ($option == "i59m") Then
  1712.                 If ($i59Magic = "salvage") Then
  1713.                         Return 1
  1714.                 ElseIf ($i59Magic = "vend") Then
  1715.                         Return 2
  1716.                 Else
  1717.                         Return 0
  1718.                 EndIf
  1719.         ElseIf ($option == "i60m") Then
  1720.                 If ($i60Magic = "salvage") Then
  1721.                         Return 1
  1722.                 ElseIf ($i60Magic = "vend") Then
  1723.                         Return 2
  1724.                 Else
  1725.                         Return 0
  1726.                 EndIf
  1727.         ElseIf ($option == "i61m") Then
  1728.                 If ($i61Magic = "salvage") Then
  1729.                         Return 1
  1730.                 ElseIf ($i61Magic = "vend") Then
  1731.                         Return 2
  1732.                 Else
  1733.                         Return 0
  1734.                 EndIf
  1735.         ElseIf ($option == "i62m") Then
  1736.                 If ($i62Magic = "salvage") Then
  1737.                         Return 1
  1738.                 ElseIf ($i62Magic = "vend") Then
  1739.                         Return 2
  1740.                 Else
  1741.                         Return 0
  1742.                 EndIf
  1743.         ElseIf ($option == "i63m") Then
  1744.                 If ($i63Magic = "salvage") Then
  1745.                         Return 1
  1746.                 ElseIf ($i63Magic = "vend") Then
  1747.                         Return 2
  1748.                 Else
  1749.                         Return 0
  1750.                 EndIf
  1751.         Else
  1752.                 Return 0
  1753.         EndIf
  1754.  
  1755. EndFunc   ;==>getOption
  1756. #endregion OtherStuff
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement