Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <WindowsConstants.au3>
- #include <Misc.au3>
- #include <WinAPI.au3>
- #include <StaticConstants.au3>
- #include <GuiListBox.au3>
- #include <ScrollBarConstants.au3>
- #include <Array.au3>
- #include <GUIConstantsEx.au3>
- Initialize()
- #cs
- [Gold/Itemfarming] [AutoIt] Sarkoth Act I Dank Cellar [WD] [Stash, Sell, Repair, +++]
- by zEEneXx
- Version: 1.3
- www.ownedcore.com
- #ce
- ;///////////////////////////////////////--CONFIG--////////////////////////////////////////////////////////////////////////////////////////////
- ; //
- ; Important //
- $ComputerLag = 0 ;Increase this in steps of 100 if you have a slow computer //
- $MoveDelay = 0 ;Increase this in steps of 50 if you have movement issues //
- $LootDelay = 0 ;Increase this in steps of 50 if you have looting issues //
- $SalvageDelay = 0 ;Increase this in steps of 50 if you have salvaging issues //
- $SellDelay = 0 ;Increase this in steps of 50 if you have selling issues //
- $StashDelay = 0 ;Increase this in steps of 50 if you have stashing issues //
- $ImgDir = "C:\Program Files (x86)\AutoIt3\pics\" ;Location of the image folder //
- ; //
- ; Functions //
- $Repair = True ;Orders the bot to repair when items are damaged //
- $Salvage = True ;Orders the bot to salvage items with item level 60 and above //
- $Sell = True ;Orders the bot to sell magic items when bag is full //
- $KeepHighLevel = True ;Set this to true if you want to keep items with $KeepLevel and above //
- $KeepLevel = 62 ;60, 61, 62, 63 //
- $UseStash = True ;Orders the bot to use the stash //
- $HighGoldRadius = False ;Set this to true if you have more than +18 gold radius //
- ; //
- ; Miscellaneous //
- $Sounds = True ;Enable pickup sounds //
- $SoundsDir = "C:\Program Files (x86)\AutoIt3\sounds\" ;Location of the sounds folder //
- $ShowLootArea = True ;Shows lootarea //
- $ShowLog = True ;Shows log overlay //
- $SaveStats = True ;Saves current statistics to a *.txt file //
- $SaveLogsPath = "C:\Program Files (x86)\AutoIt3\logs\" ;Folder to save the logs and statistics in //
- ; //
- ; Relogging //
- $UseRelogging = False ;Enable Relogging //
- $Password = "XXXXXXXXXXX" ;Your password //
- ; //
- ; Looting //
- $LootLegendaries = True ;Loot legendary items //
- $LootSets = True ;Loot set items //
- $LootRares = True ;Loot rare items //
- $LootMagics = True ;Loot magic items (includes tomes) //
- $LootTomes = True ;Loot tomes //
- $LootGems = True ;Loot gems //
- ; //
- ; <<<Changes below have an significant impact on the needed for looting>>> //
- ; //
- $LegendaryLootAmount = 1 ;Amount of legendary items to loot //
- $SetLootAmount = 1 ;Amount of set items to loot //
- $RareLootAmount = 1 ;Amount of rare items to loot //
- $MagicLootAmount = 3 ;Amount of magic items to loot (including tomes) //
- $TomeLootAmount = 1 ;Amount of tomes to loot //
- $GemLootAmount = 2 ;Amount of gems to loot //
- ; //
- $LootingArea[0] = 570 ;Left (lower -> bigger) //
- $LootingArea[1] = 185 ;Top (lower -> bigger) //
- $LootingArea[2] = 1375 ;Right (higher -> bigger) //
- $LootingArea[3] = 720 ;Bot (higher -> bigger) //
- ; //
- ;/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ScriptStarted()
- While 1
- While WinActive('Diablo III')
- Randomize()
- Switch ResumeGame()
- Case "LeftGame"
- ExitLoop
- Case "Network connection lost"
- ExitLoop
- Case "Relogged"
- ExitLoop
- EndSwitch
- MoveToCellar()
- Switch EnterCellar()
- Case "LeftGame"
- ExitLoop
- Case "Network connection lost"
- ExitLoop
- Case "Relogged"
- ExitLoop
- EndSwitch
- MoveInCellar()
- UseSkills()
- KillSarkoth()
- LootGold()
- Switch LootItems()
- Case "LeftGame"
- ExitLoop
- Case "Network connection lost"
- ExitLoop
- Case "Relogged"
- ExitLoop
- EndSwitch
- Switch TeleportToTown()
- Case "LeftGame"
- ExitLoop
- Case "Network connection lost"
- ExitLoop
- Case "Relogged"
- ExitLoop
- EndSwitch
- LeaveGame()
- WEnd
- WEnd
- ;Routine
- Func ResumeGame()
- If $UseRelogging = True Then
- $Array = StringSplit($ImageFiles[7][4],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $LoginButtonSearchArea[0], $LoginButtonSearchArea[1], $LoginButtonSearchArea[2], $LoginButtonSearchArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- Relog()
- Return "Relogged"
- EndIf
- EndIf
- Switch InGameLobby()
- Case "InGameLobby"
- ToLog("Resuming game...")
- MouseClick('LEFT', $ResumeButton[0], $ResumeButton[1], 1, 5)
- Case "LeftGame"
- Return "LeftGame"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- Switch InGameplayScreen()
- Case "LeftGame"
- Return "LeftGame"
- Case "InGamePlayScreen"
- Return "InGamePlayScreen"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- EndFunc
- Func MoveToCellar()
- $Sek = Floor(TimerDiff($RunTimer) / 1000)
- If $Runs > 0 Then
- ToLog("Last run took: " & $Sek & "s")
- EndIf
- $RunTimer = TimerInit()
- ToLog("Starting run...")
- $Runs+=1
- RefreshStats()
- Sleep(375 + $Computerlag)
- Send("{4}")
- Sleep(30 + ($Computerlag/2))
- ToLog("Moving to cellar - 1")
- Move($MoveToCellar1[0], $MoveToCellar1[1])
- Sleep(1175 + $MoveDelay)
- ToLog("Moving to cellar - 2")
- Move($MoveToCellar2[0], $MoveToCellar2[1])
- Sleep(2075 + $MoveDelay)
- ToLog("Moving to cellar - 3")
- Move($MoveToCellar3[0], $MoveToCellar3[1])
- Sleep(1550 + $MoveDelay)
- Send("{2}")
- Sleep(200 + $Computerlag)
- EndFunc
- Func EnterCellar()
- MouseMove($CellarLocation[0], $CellarLocation[1], 2)
- Sleep(100 + ($Computerlag/2))
- for $i = 0 to 2
- $CellarPixel = PixelSearch($CellarSearchArea[0], $CellarSearchArea[1], $CellarSearchArea[2], $CellarSearchArea[3], 0x334FB7, 8)
- If @error Then
- ToLog("Cellar is closed")
- $Closed+=1
- RefreshStats()
- Switch TeleportToTown()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- LeaveGame()
- Return "LeftGame"
- Else
- ToLog("Entering cellar...")
- MouseClick('LEFT', $CellarLocation[0], $CellarLocation[1], 1, 5)
- Switch InCellar()
- Case "InCellar"
- Return "InCellar"
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- EndIf
- Sleep(Random(20, 30, 1))
- Next
- EndFunc
- Func MoveInCellar()
- ToLog("Moving in cellar - 1")
- Move($MoveInCellar1[0], $MoveInCellar1[1])
- Sleep(2050 + $MoveDelay)
- ToLog("Moving in cellar - 2")
- Move($MoveInCellar2[0], $MoveInCellar2[1])
- Sleep(1050 + $MoveDelay)
- MouseMove($MonsterLocation[0],$MonsterLocation[1], 5)
- Sleep(50 + ($Computerlag/2))
- EndFunc
- Func UseSkills()
- ToLog("Using skills...")
- Send("{1}")
- Sleep(400 + $Computerlag)
- Send("{3}")
- Sleep(400 + $Computerlag)
- MouseClick('RIGHT')
- Sleep(250 + $Computerlag)
- EndFunc
- Func KillSarkoth()
- ToLog("Killing Sarkoth...")
- While 1
- $MonsterBar = PixelSearch($MonsterSearchArea[0], $MonsterSearchArea[1], $MonsterSearchArea[2], $MonsterSearchArea[3], 0xEE0000, 10)
- If @error Then
- Attack($MonsterLocation[0],$MonsterLocation[1])
- Sleep(600)
- $MonsterBar = PixelSearch($MonsterSearchArea[0], $MonsterSearchArea[1], $MonsterSearchArea[2], $MonsterSearchArea[3], 0xEE0000, 10)
- If @error Then
- ExitLoop
- EndIf
- EndIf
- Attack($MonsterBar[0], $MonsterBar[1])
- Sleep(100)
- WEnd
- ToLog("All monsters are dead")
- Send("{4}")
- Sleep(30 + ($Computerlag/2))
- EndFunc
- Func LootGold()
- If $ShowLootArea = True Then
- DrawLootArea()
- EndIf
- ToLog("Looting gold...")
- If $HighGoldRadius = False Then
- Move($MoveToGoldLoot1a[0], $MoveToGoldLoot1a[1])
- Sleep(850 + $MoveDelay)
- AttackNearbyMonsters()
- Move($MoveToGoldLoot2[0], $MoveToGoldLoot2[1])
- Sleep(550 + $MoveDelay)
- AttackNearbyMonsters()
- Move($MoveToGoldLoot3[0], $MoveToGoldLoot3[1])
- Sleep(400 + $MoveDelay)
- AttackNearbyMonsters()
- Else
- Move($MoveToGoldLoot1b[0], $MoveToGoldLoot1b[1])
- Sleep(800 + $MoveDelay)
- AttackNearbyMonsters()
- EndIf
- MouseMove(Random(100, 140, 1), Random(100, 140, 1), 3)
- Sleep(50)
- EndFunc
- Func LootItems()
- If $LootSets Then
- Send("{ALT}")
- Switch LootSets()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- EndIf
- If $LootLegendaries Then
- Send("{ALT}")
- Switch LootLegendaries()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- EndIf
- If $LootRares Then
- Send("{ALT}")
- Switch LootRares()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- $RareLootAttempts = 0
- EndIf
- If $LootMagics Then
- Send("{ALT}")
- Switch LootMagics()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- $MagicLootAttempts = 0
- Else
- If $LootTomes Then
- Send("{ALT}")
- Switch LootTomes()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- $TomeLootAttempts = 0
- EndIf
- EndIf
- If $LootGems Then
- Send("{ALT}")
- Switch LootGems()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- $GemLootAttempts = 0
- EndIf
- If $ShowLootArea = True Then
- GUIDelete($LootAreaGUI)
- EndIf
- Return "Looted"
- EndFunc
- Func TeleportToTown()
- ToLog("Teleporting to town...")
- Sleep(50 + ($Computerlag/2))
- Send("{t}")
- Switch InTown()
- Case "InTown"
- Return "InTown"
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- EndFunc
- ;Loot
- Func LootLegendaries()
- While $LegendaryLootAttempts < $LegendaryLootAmount
- ToLog("Searching for legendaries... " & $LegendaryLootAttempts + 1)
- For $gI = 0 to 4
- $Array = StringSplit($ImageFiles[0][$gI],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $LootingArea[0], $LootingArea[1], $LootingArea[2], $LootingArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- ToLog("Legendary found")
- If $Sounds = True Then
- SoundPlay($SoundsDir & $SoundFiles[0], 0)
- EndIf
- MouseClick("LEFT", $ISx, $ISy, 1, 4)
- Sleep(550 + $LootDelay)
- MouseMove(Random(100, 140, 1), Random(100, 140, 1), 3)
- Sleep(50)
- If $Salvage = True Or $Sell = True Or $UseStash = True Then
- Switch CheckBagFull()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- If $FullBag = True Then
- $FullBag = False
- Else
- $LegendaryLootAttempts+=1
- $Legendaries+=1
- RefreshStats()
- EndIf
- EndIf
- ExitLoop
- EndIf
- Next
- If $Target = 0 Then ExitLoop
- WEnd
- Return "Looted"
- EndFunc
- Func LootSets()
- While $SetLootAttempts < $SetLootAmount
- ToLog("Searching for sets... " & $SetLootAttempts + 1)
- For $gI = 0 to 4
- $Array = StringSplit($ImageFiles[1][$gI],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $LootingArea[0], $LootingArea[1], $LootingArea[2], $LootingArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- ToLog("Set found")
- If $Sounds = True Then
- SoundPlay($SoundsDir & $SoundFiles[1], 0)
- EndIf
- MouseClick("LEFT", $ISx, $ISy, 1, 4)
- Sleep(550 + $LootDelay)
- MouseMove(Random(100, 140, 1), Random(100, 140, 1), 3)
- Sleep(50)
- If $Salvage = True Or $Sell = True Or $UseStash = True Then
- CheckBagFull()
- If $FullBag = True Then
- $FullBag = False
- Else
- $SetLootAttempts+=1
- $Sets+=1
- RefreshStats()
- EndIf
- EndIf
- ExitLoop
- EndIf
- Next
- If $Target = 0 Then ExitLoop
- WEnd
- Return "Looted"
- EndFunc
- Func LootRares()
- While $RareLootAttempts < $RareLootAmount
- ToLog("Searching for rares... " & $RareLootAttempts + 1)
- For $gI = 0 to 4
- $Array = StringSplit($ImageFiles[2][$gI],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $LootingArea[0], $LootingArea[1], $LootingArea[2], $LootingArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- ToLog("Rare found")
- If $Sounds = True Then
- SoundPlay($SoundsDir & $SoundFiles[2], 0)
- EndIf
- MouseClick("LEFT", $ISx, $ISy, 1, 4)
- Sleep(550 + $LootDelay)
- MouseMove(Random(100, 140, 1), Random(100, 140, 1), 3)
- Sleep(50)
- If $Salvage = True Or $Sell = True Or $UseStash = True Then
- Switch CheckBagFull()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- If $FullBag = True Then
- $FullBag = False
- $RareLootAttempts-=1
- Else
- $Rares+=1
- RefreshStats()
- EndIf
- EndIf
- ExitLoop
- EndIf
- Next
- $RareLootAttempts+=1
- WEnd
- Return "Looted"
- EndFunc
- Func LootMagics()
- While $MagicLootAttempts < $MagicLootAmount
- ToLog("Searching for magics... " & $MagicLootAttempts + 1)
- For $gI = 0 to 4
- $Array = StringSplit($ImageFiles[3][$gI],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $LootingArea[0], $LootingArea[1], $LootingArea[2], $LootingArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- ToLog("Magic found")
- If $Sounds = True Then
- SoundPlay($SoundsDir & $SoundFiles[3], 0)
- EndIf
- MouseClick("LEFT", $ISx, $ISy, 1, 4)
- Sleep(550 + $LootDelay)
- MouseMove(Random(100, 140, 1), Random(100, 140, 1), 3)
- Sleep(50)
- If $Salvage = True Or $Sell = True Or $UseStash = True Then
- Switch CheckBagFull()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- If $FullBag = True Then
- $FullBag = False
- Else
- $MagicLootAttempts+=1
- $Magics+=1
- RefreshStats()
- EndIf
- EndIf
- ExitLoop
- EndIf
- Next
- If $Target = 0 Then ExitLoop
- WEnd
- Return "Looted"
- EndFunc
- Func LootTomes()
- While $TomeLootAttempts < $TomeLootAmount
- ToLog("Searching for Tomes of Secrets... " & $TomeLootAttempts + 1)
- $Array = StringSplit($ImageFiles[4][0],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $LootingArea[0], $LootingArea[1], $LootingArea[2], $LootingArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- ToLog("Tome of Secrets found")
- If $Sounds = True Then
- SoundPlay($SoundsDir & $SoundFiles[4], 0)
- EndIf
- MouseClick("LEFT", $ISx, $ISy, 1, 4)
- Sleep(550 + $LootDelay)
- MouseMove(Random(100, 140, 1), Random(100, 140, 1), 3)
- Sleep(50)
- If $Salvage = True Or $Sell = True Or $UseStash = True Then
- Switch CheckBagFull()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- If $FullBag = True Then
- $FullBag = False
- Else
- $TomeLootAttempts+=1
- $Tomes+=1
- RefreshStats()
- EndIf
- EndIf
- EndIf
- If $Target = 0 Then ExitLoop
- WEnd
- Return "Looted"
- EndFunc
- Func LootGems()
- While $GemLootAttempts < $GemLootAmount
- ToLog("Searching for Gems... " & $GemLootAttempts + 1)
- $Array = StringSplit($ImageFiles[4][1],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $LootingArea[0], $LootingArea[1], $LootingArea[2], $LootingArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- ToLog("Gem found")
- If $Sounds = True Then
- SoundPlay($SoundsDir & $SoundFiles[5], 0)
- EndIf
- MouseClick("LEFT", $ISx, $ISy, 1, 4)
- Sleep(550 + $LootDelay)
- MouseMove(Random(100, 140, 1), Random(100, 140, 1), 3)
- Sleep(50)
- If $Salvage = True Or $Sell = True Or $UseStash = True Then
- Switch CheckBagFull()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- If $FullBag = True Then
- $FullBag = False
- Else
- $GemLootAttempts+=1
- $Gems+=1
- RefreshStats()
- EndIf
- EndIf
- EndIf
- If $Target = 0 Then ExitLoop
- WEnd
- Return "Looted"
- EndFunc
- ;Salvage, Sell, store and repair
- Func CheckBagFull()
- $Array = StringSplit($ImageFiles[6][4],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $FullBagSearchArea[0], $FullBagSearchArea[1], $FullBagSearchArea[2], $FullBagSearchArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- ToLog("Our bag is full")
- $FullBag = True
- Switch SellItems()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- EndIf
- Return "BagNotFull"
- EndFunc
- Func SalvageItems()
- ToLog("Salvaging...")
- $Count = 0
- RandomizeInventory()
- MouseClick("LEFT", $SalvageButton[0], $SalvageButton[1], 1, 5)
- While UBOUND($Stash) > 0
- $r = Random(0, UBOUND($Stash)-1, 1)
- $Array = StringSplit($ImageFiles[5][0],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $Stash[$r][0]-25, $Stash[$r][1]-25, $Stash[$r][0]+25, $Stash[$r][1]+25, 0, 0, $Accuracy)
- If Not $Target = 1 Then
- MouseMove($Stash[$r][0], $Stash[$r][1], 0)
- Sleep(200 + $SalvageDelay)
- $Array = StringSplit($ImageFiles[5][1],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 0, $SellItemsArea[0], $SellItemsArea[1], $SellItemsArea[2], $SellItemsArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- For $gI = 2 to 6
- $Array = StringSplit($ImageFiles[5][$gI],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $ISx, $ISy, $ISx+420, $ISy+75, 0, 0, $Accuracy)
- If $Target = 1 Then
- If $Sell = True Then
- If $KeepHighLevel = True Then
- Switch $KeepLevel
- Case 60
- ExitLoop
- Case 61
- $Array = StringSplit($ImageFiles[4][2],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $ISx, $ISy+210, $ISx+140, $ISy+420, 0, 0, $Accuracy)
- If $Target = 1 Then
- MouseClick("LEFT")
- MouseClick("LEFT", $SalvageButton[0], $SalvageButton[1], 1, 5)
- $Count+=1
- Sleep(100)
- ExitLoop
- EndIf
- Case 62
- For $gI = 2 to 3
- $Array = StringSplit($ImageFiles[4][$gI],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $ISx, $ISy+210, $ISx+140, $ISy+420, 0, 0, $Accuracy)
- If $Target = 1 Then
- MouseClick("LEFT")
- MouseClick("LEFT", $SalvageButton[0], $SalvageButton[1], 1, 5)
- $Count+=1
- Sleep(100)
- ExitLoop 2
- EndIf
- Next
- Case 63
- For $gI = 2 to 4
- $Array = StringSplit($ImageFiles[4][$gI],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $ISx, $ISy+210, $ISx+140, $ISy+420, 0, 0, $Accuracy)
- If $Target = 1 Then
- MouseClick("LEFT")
- MouseClick("LEFT", $SalvageButton[0], $SalvageButton[1], 1, 5)
- $Count+=1
- Sleep(100)
- ExitLoop 2
- EndIf
- Next
- EndSwitch
- ExitLoop
- Else
- For $gI = 2 to 5
- $Array = StringSplit($ImageFiles[4][$gI],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $ISx, $ISy+210, $ISx+140, $ISy+420, 0, 0, $Accuracy)
- If $Target = 1 Then
- MouseClick("LEFT")
- MouseClick("LEFT", $SalvageButton[0], $SalvageButton[1], 1, 5)
- $Count+=1
- Sleep(100)
- ExitLoop 2
- EndIf
- Next
- EndIf
- Else
- MouseClick("LEFT")
- MouseClick("LEFT", $SalvageButton[0], $SalvageButton[1], 1, 5)
- $Count+=1
- Sleep(100)
- ExitLoop
- EndIf
- EndIf
- Next
- EndIf
- EndIf
- _ArrayDelete($Stash, $r)
- Sleep(20 + $SellDelay)
- WEnd
- ToLog("Salvaging... done - Salvaged " & $Count & " items")
- EndFunc
- Func SellItems()
- If $Salvage = True Then
- $SellCheck = 60
- Else
- $SellCheck = $KeepLevel
- EndIf
- If $ShowLootArea = True Then
- GUIDelete($LootAreaGUI)
- EndIf
- Switch TeleportToTown()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- If $Sell = True Then
- Switch MoveToMerchant()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- ToLog("Selling...")
- $Count = 0
- RandomizeInventory()
- While UBOUND($Stash) > 0
- $r = Random(0, UBOUND($Stash)-1, 1)
- $Array = StringSplit($ImageFiles[5][0],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $Stash[$r][0]-25, $Stash[$r][1]-25, $Stash[$r][0]+25, $Stash[$r][1]+25, 0, 0, $Accuracy)
- If Not $Target = 1 Then
- MouseMove($Stash[$r][0], $Stash[$r][1], 0)
- Sleep(200 + $SellDelay)
- $Array = StringSplit($ImageFiles[5][1],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 0, $SellItemsArea[0], $SellItemsArea[1], $SellItemsArea[2], $SellItemsArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- For $gI = 2 to 6
- $Array = StringSplit($ImageFiles[5][$gI],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $ISx, $ISy, $ISx+420, $ISy+75, 0, 0, $Accuracy)
- If $Target = 1 Then
- If $KeepHighLevel = True Then
- Switch $SellCheck
- Case 60
- For $gI = 2 to 5
- $Array = StringSplit($ImageFiles[4][$gI],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $ISx, $ISy+210, $ISx+140, $ISy+420, 0, 0, $Accuracy)
- If $Target = 1 Then
- ExitLoop 2
- EndIf
- Next
- Case 61
- For $gI = 3 to 5
- $Array = StringSplit($ImageFiles[4][$gI],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $ISx, $ISy+210, $ISx+140, $ISy+420, 0, 0, $Accuracy)
- If $Target = 1 Then
- ExitLoop 2
- EndIf
- Next
- Case 62
- For $gI = 4 to 5
- $Array = StringSplit($ImageFiles[4][$gI],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $ISx, $ISy+210, $ISx+140, $ISy+420, 0, 0, $Accuracy)
- If $Target = 1 Then
- ExitLoop 2
- EndIf
- Next
- Case 63
- $Array = StringSplit($ImageFiles[4][5],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $ISx, $ISy+210, $ISx+140, $ISy+420, 0, 0, $Accuracy)
- If $Target = 1 Then
- ExitLoop
- EndIf
- EndSwitch
- MouseClick("RIGHT")
- $Count+=1
- ExitLoop
- Else
- If $Salvage = True Then
- For $gI = 2 to 5
- $Array = StringSplit($ImageFiles[4][$gI],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $ISx, $ISy+210, $ISx+140, $ISy+420, 0, 0, $Accuracy)
- If $Target = 1 Then
- ExitLoop 2
- EndIf
- Next
- EndIf
- MouseClick("RIGHT")
- $Count+=1
- ExitLoop
- EndIf
- EndIf
- Next
- EndIf
- EndIf
- _ArrayDelete($Stash, $r)
- WEnd
- ToLog("Selling... done - Sold " & $Count & " items")
- EndIf
- $RareLootAttempts = 0
- $MagicLootAttempts = 0
- $TomeLootAttempts = 0
- $GemLootAttempts = 0
- If $Salvage = True Then
- Switch MoveToSalvage()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- EndIf
- Switch MoveToStash()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- Sleep(150 + $ComputerLag)
- MouseClick("LEFT", $PortalLocation[0], $PortalLocation[1], 1, 10)
- Switch InCellar()
- Case "InCellar"
- If $ShowLootArea = True Then
- DrawLootArea()
- EndIf
- Sleep(250 + ($ComputerLag/2))
- Return "InCellar"
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- EndFunc
- Func PutInStash()
- ToLog("Storing items in the stash...")
- RandomizeInventory()
- While UBOUND($Stash) > 0
- $r = Random(0, UBOUND($Stash)-1, 1)
- $Array = StringSplit($ImageFiles[5][0],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $Stash[$r][0]-25, $Stash[$r][1]-25, $Stash[$r][0]+25, $Stash[$r][1]+25, $ISx, $ISy, $Accuracy)
- If Not $Target = 1 Then
- MouseClick("RIGHT", $Stash[$r][0], $Stash[$r][1], 1, 0)
- EndIf
- If Not CheckStashFull() = 1 Then
- _ArrayDelete($Stash, $r)
- EndIf
- Sleep(50 + $StashDelay)
- If $UseStash = False Then
- ExitLoop
- EndIf
- WEnd
- ToLog("Storing items in the stash... done")
- EndFunc
- Func CheckStashFull()
- $Array = StringSplit($ImageFiles[6][3],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $FullStashSearchArea[0], $FullStashSearchArea[1], $FullStashSearchArea[2], $FullStashSearchArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- Switch $StashBag
- Case 1
- ToLog("First stashbag is full - changing...")
- Sleep(100 + ($Computerlag/2))
- MouseClick("LEFT", $StashBag2[0], $StashBag2[1], 1, 5)
- $StashBag = 2
- Sleep(5000)
- Case 2
- ToLog("Second stashbag is full - changing...")
- Sleep(100 + ($Computerlag/2))
- MouseClick("LEFT", $StashBag3[0], $StashBag3[1], 1, 5)
- $StashBag = 3
- Sleep(5000)
- Case 3
- ToLog("Third stashbag is full - aborting...")
- $UseStash = False
- EndSwitch
- Return 1
- EndIf
- Return 0
- EndFunc
- Func RepairItems()
- If Not CheckForRepair() Then
- Return "NotDamaged"
- EndIf
- Switch MoveToMerchant()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- ToLog("Repairing...")
- MouseClick('LEFT', $RepairButton[0], $RepairButton[1], 1, 5)
- Sleep(100 + ($Computerlag/2))
- MouseClick('LEFT', $AllItemsButton[0], $AllItemsButton[1], 1, 5)
- Sleep(100 + ($Computerlag/2))
- Send("{ESC}")
- ToLog("Repairing... done")
- Return "Repaired"
- EndFunc
- Func CheckForRepair()
- $RepairNeeded = PixelSearch($RepairSearchArea[0], $RepairSearchArea[1], $RepairSearchArea[2], $RepairSearchArea[3], 0xFFE801, 10)
- If Not @error Then
- ToLog("We need to repair")
- Return True
- Else
- $RepairNeeded = PixelSearch($RepairSearchArea[0], $RepairSearchArea[1], $RepairSearchArea[2], $RepairSearchArea[3], 0xDE0000, 10)
- If Not @error Then
- ToLog("We need to repair")
- Return True
- Else
- Return False
- EndIf
- EndIf
- EndFunc
- Func MoveToSalvage()
- Sleep(350 + $Computerlag)
- ToLog("Waiting to get to the salvage... (TimeOut 8s)")
- ToLog("Moving to salvage - 1")
- Move($MoveToSalvage1[0], $MoveToSalvage1[1])
- Sleep($SleepToSalvage + $MoveDelay)
- ToLog("Moving to salvage - 2")
- Move($MoveToSalvage2[0], $MoveToSalvage2[1])
- Sleep($SleepToSalvage + $MoveDelay)
- ToLog("Moving to salvage - 3")
- MouseClick('LEFT', $SalvageLocation[0], $SalvageLocation[1], 1, 10)
- Switch AtSalvage()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- SalvageItems()
- Sleep(100 + ($Computerlag/2))
- Send("{ESC}")
- Return "Salvaged"
- EndFunc
- Func MoveToMerchant()
- Sleep(350 + $Computerlag)
- ToLog("Waiting to get to the merchant... (TimeOut 8s)")
- ToLog("Moving to merchant - 1")
- Move($MoveToMerchant[0] , $MoveToMerchant[1])
- Sleep(3500 + $MoveDelay)
- ToLog("Moving to merchant - 2")
- MouseClick('LEFT', $MerchantLocation[0], $MerchantLocation[1], 1, 10)
- Switch AtMerchant()
- Case "AtMerchant"
- Return "AtMerchant"
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- EndFunc
- Func MoveToStash()
- ToLog("Waiting to get to the stash... (TimeOut 8s)")
- If $Salvage = True Or $Sell = True Then
- ToLog("Moving to stash - 1")
- Move($MoveToStash1[0] , $MoveToStash1[1])
- Sleep($SleepToStash + $MoveDelay)
- ToLog("Moving to stash - 2")
- Move($MoveToStash2[0] , $MoveToStash2[1])
- Sleep($SleepToStash + $MoveDelay)
- EndIf
- If $UseStash = True Then
- $StashBag = 1
- MouseClick("LEFT", $StashLocation[0], $StashLocation[1], 1, 10)
- Switch AtStash()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- PutInStash()
- Sleep(100 + ($Computerlag/2))
- Send("{ESC}")
- EndIf
- Return "AtStash"
- EndFunc
- ;Check gamestate, disconnect and death
- Func InLoginScreen()
- ToLog("Waiting to get into the login screen...")
- While 1
- $Array = StringSplit($ImageFiles[7][4],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $LoginButtonSearchArea[0], $LoginButtonSearchArea[1], $LoginButtonSearchArea[2], $LoginButtonSearchArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- Return True
- Else
- Sleep(200)
- EndIf
- WEnd
- EndFunc
- Func InGameLobby()
- ToLog("Waiting to get into the game lobby... (TimeOut 25s)")
- $TimeOutTimer = TimerInit()
- While 1
- $Array = StringSplit($ImageFiles[7][2],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $ResumeButtonSearchArea[0], $ResumeButtonSearchArea[1], $ResumeButtonSearchArea[2], $ResumeButtonSearchArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- $DisconnectState = 0
- Return "InGameLobby"
- Else
- If Floor(TimerDiff($TimeOutTimer) / 1000) >= 25 Then
- ToLog("GameLobby TimeOut - Trying again")
- If $Relogged = True Then
- Send("{ESC}")
- MouseClick("LEFT", $PasswordField[0]+250, $PasswordField[1], 1, 5)
- For $i = 0 to StringLen($Password)-1
- Send("{BACKSPACE}")
- Next
- $Relogged = False
- Else
- MouseMove($ResumeButton[0], $ResumeButton[1]-100, 0)
- LeaveGame()
- EndIf
- Return "LeftGame"
- EndIf
- Switch CheckForDisconnect()
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- Sleep(200)
- EndIf
- WEnd
- EndFunc
- Func InGameplayScreen()
- ToLog("Waiting to get into the game... (TimeOut 14s)")
- $TimeOutTimer = TimerInit()
- While 1
- $Array = StringSplit($ImageFiles[7][3],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $PortalIconSearchArea[0], $PortalIconSearchArea[1], $PortalIconSearchArea[2], $PortalIconSearchArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- $Alive = True
- $DisconnectState = 0
- Return "InGamePlayScreen"
- Else
- If Floor(TimerDiff($TimeOutTimer) / 1000) >= 14 Then
- $TimeOutTimer = TimerInit()
- ToLog("GameplayScreen TimeOut - Leaving")
- Return "LeftGame"
- EndIf
- If CheckForDeath() = "LeftGame" Then
- Return "LeftGame"
- EndIf
- Sleep(100)
- Switch CheckForDisconnect()
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- Sleep(100)
- EndIf
- WEnd
- EndFunc
- Func InCellar()
- ToLog("Waiting to get into the cellar... (TimeOut 8s)")
- $TimeOutTimer = TimerInit()
- While 1
- $Array = StringSplit($ImageFiles[7][0],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $CellarNameSearchArea[0], $CellarNameSearchArea[1], $CellarNameSearchArea[2], $CellarNameSearchArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- Return "InCellar"
- Else
- If Floor(TimerDiff($TimeOutTimer) / 1000) >= 8 Then
- ToLog("Cellar TimeOut - Leaving")
- LeaveGame()
- Return "LeftGame"
- EndIf
- If CheckForDeath() = "LeftGame" Then
- Return "LeftGame"
- EndIf
- Sleep(100)
- Switch CheckForDisconnect()
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- Sleep(100)
- EndIf
- WEnd
- EndFunc
- Func InTown()
- ToLog("Waiting to get into the town... (TimeOut 8s)")
- $TimeOutTimer = TimerInit()
- While 1
- $Array = StringSplit($ImageFiles[7][1],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $TownNameSearchArea[0], $TownNameSearchArea[1], $TownNameSearchArea[2], $TownNameSearchArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- If $Repair And Not $FullBag Then
- Switch RepairItems()
- Case "LeftGame"
- Return "LeftGame"
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- EndIf
- Return "InTown"
- Else
- If Floor(TimerDiff($TimeOutTimer) / 1000) >= 8 Then
- $TimeOutCount+=1
- If $TimeOutCount = 3 Then
- ToLog("Teleport TimeOut - Leaving")
- $TimeOutCount = 0
- LeaveGame()
- Return "LeftGame"
- EndIf
- $TimeOutTimer = TimerInit()
- ToLog("Teleport TimeOut - Trying to teleport again")
- ToLog("Teleporting to town...")
- Sleep(50 + ($Computerlag/2))
- Send("{t}")
- EndIf
- If CheckForDeath() = "LeftGame" Then
- Return "LeftGame"
- EndIf
- Sleep(100)
- Switch CheckForDisconnect()
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- Sleep(100)
- EndIf
- WEnd
- EndFunc
- Func AtSalvage()
- $TimeOutTimer = TimerInit()
- While 1
- $Array = StringSplit($ImageFiles[7][5],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $MerchStashSearchArea[0], $MerchStashSearchArea[1], $MerchStashSearchArea[2], $MerchStashSearchArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- Return "AtSalvage"
- Else
- If Floor(TimerDiff($TimeOutTimer) / 1000) >= 8 Then
- ToLog("Salvage TimeOut - Leaving")
- LeaveGame()
- Return "LeftGame"
- EndIf
- If CheckForDeath() = "LeftGame" Then
- Return "LeftGame"
- EndIf
- Sleep(100)
- Switch CheckForDisconnect()
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- Sleep(100)
- EndIf
- WEnd
- EndFunc
- Func AtMerchant()
- $TimeOutTimer = TimerInit()
- While 1
- $Array = StringSplit($ImageFiles[7][5],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $MerchStashSearchArea[0], $MerchStashSearchArea[1], $MerchStashSearchArea[2], $MerchStashSearchArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- Return "AtMerchant"
- Else
- If Floor(TimerDiff($TimeOutTimer) / 1000) >= 8 Then
- ToLog("Merchant TimeOut - Leaving")
- LeaveGame()
- Return "LeftGame"
- EndIf
- If CheckForDeath() = "LeftGame" Then
- Return "LeftGame"
- EndIf
- Sleep(100)
- Switch CheckForDisconnect()
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- Sleep(100)
- EndIf
- WEnd
- EndFunc
- Func AtStash()
- $TimeOutTimer = TimerInit()
- While 1
- $Array = StringSplit($ImageFiles[7][6],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $MerchStashSearchArea[0], $MerchStashSearchArea[1], $MerchStashSearchArea[2], $MerchStashSearchArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 Then
- Return "AtStash"
- Else
- If Floor(TimerDiff($TimeOutTimer) / 1000) >= 8 Then
- ToLog("Stash TimeOut - Leaving")
- LeaveGame()
- Return "LeftGame"
- EndIf
- If CheckForDeath() = "LeftGame" Then
- Return "LeftGame"
- EndIf
- Sleep(100)
- Switch CheckForDisconnect()
- Case "Network connection lost"
- Return "Network connection lost"
- Case "Relogged"
- Return "Relogged"
- EndSwitch
- Sleep(100)
- EndIf
- WEnd
- EndFunc
- Func CheckForDisconnect()
- $Array = StringSplit($ImageFiles[6][0],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $DisconnectSearchArea[0], $DisconnectSearchArea[1], $DisconnectSearchArea[2], $DisconnectSearchArea[3], $ISx, $ISy, $Accuracy)
- If $Target = 1 And $DisconnectState = 0 Then
- ToLog("We got disconnected")
- $Disconnects+=1
- RefreshStats()
- $DisconnectState = 1
- MouseClick("LEFT", $DisconnectButton[0], $DisconnectButton[1], 1, 5)
- Return "Network connection lost"
- EndIf
- $Array = StringSplit($ImageFiles[6][1],"|")
- $File = $Array[1]
- $Accuracy = $Array[2]
- $Target = _ImageSearchArea($ImgDir & $File, 1, $DisconnectSearchArea[0], $DisconnectSearchArea[1], $DisconnectSearchArea[2], $DisconnectSearchArea[3], $ISx, $ISy, 10)
- If $Target = 1 Then
- ToLog("We got totally disconnected")
- If $DisconnectState = 0 Then
- $Disconnects+=1
- RefreshStats()
- EndIf
- $DisconnectState = 2
- MouseClick("LEFT", $DisconnectButton[0], $DisconnectButton[1], 1, 5)
- InLoginScreen()
- If $UseRelogging = True Then
- Relog()
- Return "Relogged"
- Else
- Terminate()
- EndIf
- EndIf
- Return "Connected"
- EndFunc
- Func CheckForDeath()
- If $Alive = True Then
- $Death = PixelSearch($DeathSearchArea[0], $DeathSearchArea[1], $DeathSearchArea[2], $DeathSearchArea[3], 0xFFFFFF)
- If Not @error Then
- $Alive = False
- ToLog("We are dead... :(")
- $Deaths+=1
- RefreshStats()
- LeaveGame()
- Return "LeftGame"
- EndIf
- EndIf
- Return "Alive"
- EndFunc
- ;Miscellaneous
- Func ScriptStarted()
- CheckRequiredFiles()
- If $LootLegendaries Then
- Global $Legendaries = 0
- Else
- Global $Legendaries = "-"
- EndIf
- If $LootSets Then
- Global $Sets = 0
- Else
- Global $Sets = "-"
- EndIf
- If $LootRares Then
- Global $Rares = 0
- Else
- Global $Rares = "-"
- EndIf
- If $LootMagics Then
- Global $Magics = 0
- Global $Tomes = "-"
- Else
- Global $Magics = "-"
- If $LootTomes Then
- Global $Tomes = "0"
- Else
- Global $Tomes = "-"
- EndIf
- EndIf
- If $LootGems Then
- Global $Gems = 0
- Else
- Global $Gems = "-"
- EndIf
- If $Sell Then
- Global $Sold = 0
- Else
- Global $Sold = "-"
- EndIf
- Pause()
- $RuntimeTimer = TimerInit()
- If $ShowLog = True Then
- DrawLog()
- EndIf
- If $ShowLog = True Or $SaveStats = True Then
- DirGetSize($SaveLogsPath)
- If @error= 1 Then
- DirCreate($SaveLogsPath)
- EndIf
- EndIf
- ToLog("Bot started")
- WinActivate('Diablo III')
- EndFunc
- Func CheckRequiredFiles()
- If (@OSArch = "X64" or @OSArch = "IA64") And Not @AutoItX64 Then
- MsgBox(4096, "Error", "You are running a 64bit system. You need to start the script" & @LF & "with 'Run Script (x64)' or 'Compile Script (x64)'" & @LF & "Exiting...")
- Exit 0
- EndIf
- Local $Files[3]
- $Files[0] = "msvcr110.dll"
- $Files[1] = "msvcr110d.dll"
- If @AutoItX64 Then
- $Files[2] = "ImageSearchDLL_x64.dll"
- Else
- $Files[2] = "ImageSearchDLL.dll"
- EndIf
- For $i = 0 to 2
- If Not FileExists(@WindowsDir & "\System32\" & $Files[$i]) Then
- If Not FileExists($Files[$i]) Then
- MsgBox(4096, "Error", "Couldn't find '" & $Files[$i] & "'." & @LF & "Make sure you have put that file into '" & @WindowsDir & "\System32\' or into the script folder." & @LF & "Exiting...")
- Exit 0
- EndIf
- EndIf
- Next
- For $i = 0 to UBound($ImageFiles, 1)-1
- For $x = 0 to UBound($ImageFiles, 2)-1
- If Not $ImageFiles[$i][$x] = "" Then
- $Array = StringSplit($ImageFiles[$i][$x], "|")
- $File = $Array[1]
- If Not FileExists($ImgDir & $File) Then
- MsgBox(4096, "Error", "Couldn't find '" & $File & "'." & @LF & "Either you have set the path to the image folder wrong or you haven't downloaded the latest required files." & @LF & "Exiting...")
- Exit 0
- EndIf
- EndIf
- Next
- Next
- EndFunc
- Func Pause()
- $Paused = Not $Paused
- If $Paused Then ToLog("Paused...")
- While $Paused
- Sleep(250)
- ToolTip('Paused... Press {PAUSE} to continue...', 850, 0)
- WEnd
- ToolTip("")
- EndFunc
- Func Initialize()
- OnAutoItExitRegister ('OnAutoItExit')
- Opt('MouseCoordMode', 2)
- Opt('PixelCoordMode', 2)
- HotKeySet('{PAUSE}', 'Pause')
- HotKeySet('{END}', 'Terminate')
- Global $LootAreaGUI
- Global $ImageFiles[8][7]
- Global $SoundFiles[6]
- Global $PasswordField[2]
- Global $ResumeButton[2]
- Global $LeaveButton[2]
- Global $DisconnectButton[2]
- Global $SalvageButton[2]
- Global $MoveToCellar1[2]
- Global $MoveToCellar2[2]
- Global $MoveToCellar3[2]
- Global $MoveInCellar1[2]
- Global $MoveInCellar2[2]
- Global $MoveToGoldLoot1a[2]
- Global $MoveToGoldLoot1b[2]
- Global $MoveToGoldLoot2[2]
- Global $MoveToGoldLoot3[2]
- Global $MoveToSalvage1[2]
- Global $MoveToSalvage2[2]
- Global $MoveToMerchant[2]
- Global $MoveToStash1[2]
- Global $MoveToStash2[2]
- Global $CellarLocation[2]
- Global $MonsterLocation[2]
- Global $SalvageLocation[2]
- Global $MerchantLocation[2]
- Global $StashLocation[2]
- Global $PortalLocation[2]
- Global $CharHitBox[4]
- Global $LoginButtonSearchArea[4]
- Global $ResumeButtonSearchArea[4]
- Global $PortalIconSearchArea[4]
- Global $CellarSearchArea[4]
- Global $CellarNameSearchArea[4]
- Global $TownNameSearchArea[4]
- Global $MerchStashSearchArea[4]
- Global $MonsterSearchArea[4]
- Global $LootingArea[4]
- Global $FullBagSearchArea[4]
- Global $SellItemsArea[4]
- Global $FullStashSearchArea[4]
- Global $RepairSearchArea[4]
- Global $DeathSearchArea[4]
- Global $DisconnectSearchArea[4]
- Global $StashBag2[2]
- Global $StashBag3[2]
- Global $RepairButton[2]
- Global $AllItemsButton[2]
- Global $CellarOffset
- Global $CellarPixel
- Global $Log
- Global $Label
- Global $LogList
- Global $RuntimeTimer
- Global $TimeOutTimer
- Global $RunTimer
- Global $Paused
- Global $LegendaryLootAttempts = 0
- Global $SetLootAttempts = 0
- Global $RareLootAttempts = 0
- Global $MagicLootAttempts = 0
- Global $TomeLootAttempts = 0
- Global $GemLootAttempts = 0
- Global $StartTime = @HOUR & ":" & @MIN
- Global $Runs = 0
- Global $Closed = 0
- Global $Runtime = "0h 0m 0s"
- Global $Disconnects = 0
- Global $Deaths = 0
- Global $ISx = 0
- Global $ISy = 0
- Global $StashBag = 1
- Global $Alive = True
- Global $DisconnectState = 0
- Global $FullBag = False
- Global $TimeOutCount = 0
- Global $Relogged = False
- Global $SellCheck
- Global $SleepToSalvage
- Global $SleepToStash
- $ImageFiles[0][0] = "legendaryA.png|65"
- $ImageFiles[0][1] = "legendaryE.png|65"
- $ImageFiles[0][2] = "legendaryI.png|65"
- $ImageFiles[0][3] = "legendaryO.png|65"
- $ImageFiles[0][4] = "legendaryU.png|65"
- $ImageFiles[1][0] = "setA.png|90"
- $ImageFiles[1][1] = "setE.png|90"
- $ImageFiles[1][2] = "setU.png|90"
- $ImageFiles[1][3] = "setO.png|90"
- $ImageFiles[1][4] = "setI.png|90"
- $ImageFiles[2][0] = "rareA.png|102"
- $ImageFiles[2][1] = "rareE.png|102"
- $ImageFiles[2][2] = "rareI.png|102"
- $ImageFiles[2][3] = "rareO.png|102"
- $ImageFiles[2][4] = "rareU.png|102"
- $ImageFiles[3][0] = "blueA.png|70"
- $ImageFiles[3][1] = "blueE.png|70"
- $ImageFiles[3][2] = "blueI.png|70"
- $ImageFiles[3][3] = "blueO.png|70"
- $ImageFiles[3][4] = "blueU.png|70"
- $ImageFiles[4][0] = "tome.png|140"
- $ImageFiles[4][1] = "uare.png|110"
- $ImageFiles[4][2] = "iLVL60.png|30"
- $ImageFiles[4][3] = "iLVL61.png|30"
- $ImageFiles[4][4] = "iLVL62.png|30"
- $ImageFiles[4][5] = "iLVL63.png|30"
- $ImageFiles[5][0] = "empty.png|75"
- $ImageFiles[5][1] = "corner.png|10"
- $ImageFiles[5][2] = "sellblueA.png|30"
- $ImageFiles[5][3] = "sellblueE.png|30"
- $ImageFiles[5][4] = "sellblueI.png|30"
- $ImageFiles[5][5] = "sellblueO.png|30"
- $ImageFiles[5][6] = "sellblueU.png|30"
- $ImageFiles[6][0] = "network.png|10"
- $ImageFiles[6][1] = "lost.png|10"
- $ImageFiles[6][2] = "bg.jpg|5"
- $ImageFiles[6][3] = "not.png|120"
- $ImageFiles[6][4] = "you.png|100"
- $ImageFiles[7][0] = "dank.png|120"
- $ImageFiles[7][1] = "new.png|120"
- $ImageFiles[7][2] = "game.png|20"
- $ImageFiles[7][3] = "portal.png|120"
- $ImageFiles[7][4] = "login.png|10"
- $ImageFiles[7][5] = "merchant.png|20"
- $ImageFiles[7][6] = "stash.png|20"
- $SoundFiles[0] = "legendary.wav"
- $SoundFiles[1] = "set.wav"
- $SoundFiles[2] = "rare.wav"
- $SoundFiles[3] = "magic.wav"
- $SoundFiles[4] = "tome.wav"
- $SoundFiles[5] = "gem.wav"
- $CharHitBox[0] = 790
- $CharHitBox[1] = 315
- $CharHitBox[2] = 1200
- $CharHitBox[3] = 730
- $LoginButtonSearchArea[0] = 930
- $LoginButtonSearchArea[1] = 845
- $LoginButtonSearchArea[2] = 985
- $LoginButtonSearchArea[3] = 860
- $ResumeButtonSearchArea[0] = 250
- $ResumeButtonSearchArea[1] = 410
- $ResumeButtonSearchArea[2] = 310
- $ResumeButtonSearchArea[3] = 425
- $PortalIconSearchArea[0] = 1095
- $PortalIconSearchArea[1] = 1000
- $PortalIconSearchArea[2] = 1140
- $PortalIconSearchArea[3] = 1060
- $CellarSearchArea[0] = 164
- $CellarSearchArea[1] = 0
- $CellarSearchArea[2] = 375
- $CellarSearchArea[3] = 110
- $CellarNameSearchArea[0] = 1760
- $CellarNameSearchArea[1] = 10
- $CellarNameSearchArea[2] = 1820
- $CellarNameSearchArea[3] = 30
- $TownNameSearchArea[0] = 1745
- $TownNameSearchArea[1] = 10
- $TownNameSearchArea[2] = 1795
- $TownNameSearchArea[3] = 30
- $MerchStashSearchArea[0] = 225
- $MerchStashSearchArea[1] = 30
- $MerchStashSearchArea[2] = 300
- $MerchStashSearchArea[3] = 115
- $MonsterSearchArea[0] = 170
- $MonsterSearchArea[1] = 75
- $MonsterSearchArea[2] = 1270
- $MonsterSearchArea[3] = 470
- $FullBagSearchArea[0] = 795
- $FullBagSearchArea[1] = 125
- $FullBagSearchArea[2] = 830
- $FullBagSearchArea[3] = 160
- $SellItemsArea[0] = 960
- $SellItemsArea[1] = 510
- $SellItemsArea[2] = 1680
- $SellItemsArea[3] = 910
- $FullStashSearchArea[0] = 700
- $FullStashSearchArea[1] = 135
- $FullStashSearchArea[2] = 730
- $FullStashSearchArea[3] = 155
- $RepairSearchArea[0] = 1507
- $RepairSearchArea[1] = 36
- $RepairSearchArea[2] = 1512
- $RepairSearchArea[3] = 41
- $DeathSearchArea[0] = 538
- $DeathSearchArea[1] = 335
- $DeathSearchArea[2] = 542
- $DeathSearchArea[3] = 339
- $DisconnectSearchArea[0] = 840
- $DisconnectSearchArea[1] = 410
- $DisconnectSearchArea[2] = 950
- $DisconnectSearchArea[3] = 440
- $CellarOffset = 33
- EndFunc
- Func Randomize()
- $MoveToCellar1[0] = Random(498, 503, 1)
- $MoveToCellar1[1] = Random(248, 253, 1)
- $MoveToCellar2[0] = Random(1, 4, 1)
- $MoveToCellar2[1] = Random(368, 373, 1)
- $MoveToCellar3[0] = Random(398, 403, 1)
- $MoveToCellar3[1] = Random(598, 603, 1)
- $MoveInCellar1[0] = Random(114, 119, 1)
- $MoveInCellar1[1] = Random(984, 989, 1)
- $MoveInCellar2[0] = Random(774, 779, 1)
- $MoveInCellar2[1] = Random(326, 331, 1)
- $MoveToGoldLoot1a[0] = Random(400, 405, 1)
- $MoveToGoldLoot1a[1] = Random(304, 309, 1)
- $MoveToGoldLoot1b[0] = Random(560, 575, 1)
- $MoveToGoldLoot1b[1] = Random(300, 305, 1)
- $MoveToGoldLoot2[0] = Random(1258, 1263, 1)
- $MoveToGoldLoot2[1] = Random(349, 354, 1)
- $MoveToGoldLoot3[0] = Random(909, 914, 1)
- $MoveToGoldLoot3[1] = Random(692, 697, 1)
- $MoveToMerchant[0] = Random(1688, 1693, 1)
- $MoveToMerchant[1] = Random(100, 105, 1)
- $MerchantLocation[0] = Random(928, 933, 1)
- $MerchantLocation[1] = Random(134, 139, 1)
- If $Salvage = False Then
- If $Sell = True Then
- $MoveToStash1[0] = Random(778, 783, 1)
- $MoveToStash1[1] = Random(948, 953, 1)
- $MoveToStash2[0] = Random(268, 273, 1)
- $MoveToStash2[1] = Random(928, 933, 1)
- $StashLocation[0] = Random(803, 808, 1)
- $StashLocation[1] = Random(428, 433, 1)
- $PortalLocation[0] = Random(648, 653, 1)
- $PortalLocation[1] = Random(498, 503, 1)
- Else
- $StashLocation[0] = Random(1047, 1052, 1)
- $StashLocation[1] = Random(257, 262, 1)
- $PortalLocation[0] = Random(877, 882, 1)
- $PortalLocation[1] = Random(427, 432, 1)
- EndIf
- Else
- If $Sell = False Then
- $MoveToSalvage1[0] = Random(1397, 1402, 1)
- $MoveToSalvage1[1] = Random(497, 502, 1)
- $MoveToSalvage2[0] = Random(1497, 1502, 1)
- $MoveToSalvage2[1] = Random(497, 502, 1)
- $SalvageLocation[0] = Random(1280, 1285, 1)
- $SalvageLocation[1] = Random(397, 402, 1)
- $MoveToStash1[0] = Random(397, 402, 1)
- $MoveToStash1[1] = Random(482, 487, 1)
- $MoveToStash2[0] = Random(597, 602, 1)
- $MoveToStash2[1] = Random(447, 452, 1)
- $StashLocation[0] = Random(852, 857, 1)
- $StashLocation[1] = Random(347, 352, 1)
- $PortalLocation[0] = Random(782, 787, 1)
- $PortalLocation[1] = Random(427, 432, 1)
- $SleepToSalvage = 1250
- $SleepToStash = 1325
- Else
- $MoveToSalvage1[0] = Random(812, 817, 1)
- $MoveToSalvage1[1] = Random(957, 962, 1)
- $MoveToSalvage2[0] = Random(937, 942, 1)
- $MoveToSalvage2[1] = Random(942, 947, 1)
- $SalvageLocation[0] = Random(1577, 1582, 1)
- $SalvageLocation[1] = Random(587, 592, 1)
- $MoveToStash1[0] = Random(397, 402, 1)
- $MoveToStash1[1] = Random(482, 487, 1)
- $MoveToStash2[0] = Random(597, 602, 1)
- $MoveToStash2[1] = Random(447, 452, 1)
- $StashLocation[0] = Random(870, 875, 1)
- $StashLocation[1] = Random(382, 387, 1)
- $PortalLocation[0] = Random(747, 752, 1)
- $PortalLocation[1] = Random(447, 452, 1)
- $SleepToSalvage = 1550
- $SleepToStash = 1550
- EndIf
- EndIf
- $CellarLocation[0] = Random(305, 309, 1)
- $CellarLocation[1] = Random(72, 76, 1)
- $MonsterLocation[0] = Random(575, 580, 1)
- $MonsterLocation[1] = Random(181, 186, 1)
- $StashBag2[0] = Random(508, 513, 1)
- $StashBag2[1] = Random(358, 363, 1)
- $StashBag3[0] = Random(508, 513, 1)
- $StashBag3[1] = Random(488, 493, 1)
- $RepairButton[0] = Random(515, 520, 1)
- $RepairButton[1] = Random(481, 486, 1)
- $AllItemsButton[0] = Random(221, 226, 1)
- $AllItemsButton[1] = Random(590, 595, 1)
- $PasswordField[0] = Random(818, 823, 1)
- $PasswordField[1] = Random(703, 708, 1)
- $ResumeButton[0] = Random(317, 322, 1)
- $ResumeButton[1] = Random(414, 419, 1)
- $LeaveButton[0] = Random(967, 972, 1)
- $LeaveButton[1] = Random(580, 584, 1)
- $DisconnectButton[0] = Random(958, 963, 1)
- $DisconnectButton[1] = Random(628, 633, 1)
- $SalvageButton[0] = Random(262, 267, 1)
- $SalvageButton[1] = Random(292, 297, 1)
- EndFunc
- Func RandomizeInventory()
- Global $Stash[60][2]
- $c = 0
- $d = -2
- For $a = 0 to 59
- $d+=1
- If $a = 10 or $a = 20 or $a = 30 or $a = 40 or $a = 50 Then
- $c+=1
- $d=-1
- EndIf
- For $b = 0 to 1
- If $b = 0 Then
- $Stash[$a][$b] = Random(1473, 1483, 1) + (49 * $d)
- Else
- $Stash[$a][$b] = Random(606, 614, 1) + (49 * $c)
- EndIf
- Next
- Next
- EndFunc
- Func DrawLootArea()
- $LootingAreaWidth = $LootingArea[2] - $LootingArea[0]
- $LootingAreaHeight = $LootingArea[3] - $LootingArea[1]
- $LootAreaGUI = GUICreate("", $LootingAreaWidth + 2, $LootingAreaHeight + 2, $LootingArea[0], $LootingArea[1], $WS_POPUP, BitOR($WS_EX_LAYERED, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TRANSPARENT)))
- GuiSetBkColor(0xABCDEF)
- _WinAPI_SetLayeredWindowAttributes($LootAreaGUI, 0xABCDEF, 0xA0)
- WinSetOnTop($LootAreaGUI, "", 1)
- GUISetState(@SW_SHOWNOACTIVATE, $LootAreaGUI)
- $hDC = _WinAPI_GetWindowDC($LootAreaGUI)
- $hPen = _WinAPI_CreatePen($PS_SOLID, 2, 0x0000FF)
- $obj_orig = _WinAPI_SelectObject($hDC, $hPen)
- $user32_dll = DllOpen("user32.dll")
- _WinAPI_DrawLine($hDC, 0, 1, $LootingAreaWidth, 0)
- _WinAPI_DrawLine($hDC, 1, 0, 0, $LootingAreaHeight)
- _WinAPI_DrawLine($hDC, $LootingAreaWidth, $LootingAreaHeight, $LootingAreaWidth, 0)
- _WinAPI_DrawLine($hDC, $LootingAreaWidth, $LootingAreaHeight, 0, $LootingAreaHeight)
- _WinAPI_SetTextColor($hDC, 0x0000FF)
- _WinAPI_SetBkMode($hDC, $TRANSPARENT)
- $tRECT = DllStructCreate($tagRect)
- DllStructSetData($tRECT, "Left", 5)
- DllStructSetData($tRECT, "Top", 5)
- DllStructSetData($tRECT, "Right", 250)
- DllStructSetData($tRECT, "Bottom", 50)
- _WinAPI_DrawText($hDC, "Loot Area", $tRect, 0)
- EndFunc
- Func DrawLog()
- $Width = 475
- $Height = 200
- $LogGUI = GUICreate("", $Width, $Height, 900 - $Width, 1080 - $Height - 2, $WS_POPUPWINDOW, BitOR($WS_EX_LAYERED, BitOr($WS_EX_TOOLWINDOW, $WS_EX_TRANSPARENT)))
- GuiSetBkColor(0x000000)
- GUICtrlCreatePic($ImgDir & StringTrimRight($ImageFiles[6][2],2), 0, 0, 0, 0)
- _WinAPI_SetLayeredWindowAttributes($LogGUI, 0xEEEEEF, 0xEE) ;0xA0
- WinSetOnTop($LogGUI, "", 1)
- GUISetState(@SW_SHOWNOACTIVATE, $LogGUI)
- $Label = GUICtrlCreateLabel("", 0, 10, $Width, 100, $SS_CENTER)
- GUICtrlSetFont($Label, 8, 500, 0, "")
- GuiCtrlSetColor($Label, 0xFFFFFF)
- GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
- $Version = GUICtrlCreateLabel("", 2, 2, 20, 20, $SS_CENTER)
- GUICtrlSetFont($Version, 7, 500, 0, "")
- GuiCtrlSetColor($Version, 0x000000)
- GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
- GUICtrlSetData($Version, "v1.3")
- $Copyright = GUICtrlCreateLabel("", $Width-52, 2, 50, 20, $SS_CENTER)
- GUICtrlSetFont($Copyright, 7, 500, 0, "")
- GuiCtrlSetColor($Copyright, 0x000000)
- GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
- GUICtrlSetData($Copyright, "©zEEneXx")
- $LogList = GUICtrlCreateList("", 5, 60, $Width - 10, $Height - 60, $LBS_NOSEL)
- GUICtrlSetColor($LogList, 0x000000)
- GUICtrlSetFont($LogList, 8)
- RefreshStats()
- EndFunc
- Func RefreshStats()
- If $ShowLog = True Then
- GUICtrlSetData($Label, "Start: " & $StartTime & " | Runs: " & $Runs & " | Closed: " & $Closed & " | Deaths: " & $Deaths & " | Disconnects: " & $Disconnects & @LF & @LF & "Legendaries: " & $Legendaries & " | Sets: " & $Sets & " | Rares: " & $Rares & " | Magics: " & $Magics & " | Tomes: " & $Tomes & " | Gems: " & $Gems & " | Sold: " & $Sold)
- EndIf
- EndFunc
- Func ToLog($Text)
- If $ShowLog = True Then
- GUICtrlSetData($LogList, "<" & @Hour & ":" & @MIN & ":" & @SEC & "> " & $Text)
- GUICtrlSendMsg($LogList, $WM_VSCROLL, $SB_LINEDOWN, 0)
- $Log = FileOpen($SaveLogsPath & "log.txt", 1)
- FileWriteLine($Log, "<" & @Hour & ":" & @MIN & ":" & @SEC & "> " & $Text)
- If $Text = "Bot closed" Then
- FileWriteLine($Log, @LF)
- EndIf
- FileClose($Log)
- EndIf
- EndFunc
- Func Relog()
- ToLog("Relogging...")
- MouseClick("LEFT", $PasswordField[0], $PasswordField[1], 1, 5)
- Send($Password)
- Sleep(1000 + $Computerlag)
- Send("{ENTER}")
- $Relogged = True
- $DisconnectState = 0
- EndFunc
- Func SaveStats()
- $File = FileOpen($SaveLogsPath & "statistics.txt", 1)
- FileWriteLine($File, "=========" & @HOUR & ":" & @MIN & ":" & @SEC & "=========")
- FileWriteLine($File, "Startime: " & @TAB & @TAB & $StartTime & @LF & "Runs: " & @TAB & @TAB & $Runs & @LF & "Closed: " & @TAB & @TAB & $Closed & @LF & "Deaths: " & @TAB & @TAB & $Deaths & @LF & "Disconnects: " & @TAB & $Disconnects & @LF & "Runtime: " & @TAB & @TAB & $Runtime & @LF & @LF & "Legendaries: " & @TAB & $Legendaries & @LF & "Sets: " & @TAB & @TAB & $Sets & @LF & "Rares: " & @TAB & @TAB & $Rares & @LF & "Magics: " & @TAB & @TAB & $Magics & @LF & "Tomes: " & @TAB & @TAB & $Tomes & @LF & "Gems: " & @TAB & @TAB & $Gems & @LF & "Sold: " & @TAB & @TAB & $Sold)
- FileWriteLine($File, @LF)
- FileClose($File)
- EndFunc
- Func Move($x, $y)
- MouseClick('MIDDLE', $x, $y, 1, 5)
- EndFunc
- Func Attack($x, $y)
- Send("{SHIFTDOWN}")
- MouseClick('LEFT', $x, $y, 1, 2)
- Send("{SHIFTUP}")
- EndFunc
- Func AttackNearbyMonsters()
- $Logged = False
- While 1
- $MonsterData = PixelSearch($CharHitBox[0], $CharHitBox[1], $CharHitBox[2], $CharHitBox[3], 0xEE0000, 10)
- If @error Then
- ExitLoop
- EndIf
- If $Logged = False Then
- ToLog("Monster found...")
- EndIf
- Attack($MonsterData[0], $MonsterData[1])
- Sleep(100)
- $Logged = True
- WEnd
- EndFunc
- Func LeaveGame()
- $Sek = Floor(TimerDiff($RuntimeTimer) / 1000)
- $Min = Floor($Sek / 60)
- $Hour = Floor($Min / 60)
- $Runtime = $Hour & "h " & ($Min - $Hour * 60) & "m " & ($Sek - $Min * 60) & "s"
- If $SaveStats = True Then
- SaveStats()
- EndIf
- ToLog("Leaving the game")
- Sleep(200 + ($Computerlag/2))
- Send("{ESC}")
- Sleep(100 + ($Computerlag/2))
- MouseClick('LEFT', $LeaveButton[0], $LeaveButton[1], 1, 5)
- Return "LeftGame"
- EndFunc
- Func Terminate()
- ToLog("Terminating... Good bye :)")
- Exit 0
- EndFunc
- Func _ImageSearchArea($FindImage,$ResultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $Tolerance)
- If $Tolerance > 0 Then $FindImage = "*" & $Tolerance & " " & $FindImage
- If @AutoItX64 Then
- $Result = DllCall("ImageSearchDLL_x64.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$FindImage)
- Else
- $Result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$FindImage)
- EndIf
- If $Result = "0" Then Return 0
- $Array = StringSplit($Result[0],"|")
- If(UBound($Array) >= 4) Then
- $x=Int(Number($Array[2]))
- $y=Int(Number($Array[3]))
- If $ResultPosition=1 Then
- $x=$x + Int(Number($Array[4])/2)
- $y=$y + Int(Number($Array[5])/2)
- Endif
- Return 1
- EndIf
- EndFunc
- Func OnAutoItExit()
- $Sek = Floor(TimerDiff($RuntimeTimer) / 1000)
- $Min = Floor($Sek / 60)
- $Hour = Floor($Min / 60)
- $Runtime = $Hour & "h " & ($Min - $Hour * 60) & "m " & ($Sek - $Min * 60) & "s"
- If $SaveStats = True Then
- SaveStats()
- EndIf
- ToLog("Bot closed")
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement