#include <MsgBoxConstants.au3>
#include <Array.au3>
; Press Esc to terminate script, Pause/Break to "pause".
; Modify to customize how the script runs.
;############################################################################################################################################################################################
Global $dungeonSelection = 1 ;1 = earth shrine stage 1. 2 = dwarves forge stage 5. 3 = any 3rd (ADV) Vortex stage.
Global $enableRefill = 0 ;toggle use of lapis for refills. 0 = off.
Global $sleepDuration = 16500 ;Determines how long to sleep once the out of energy/use lapis dialogue box appears. Currently set to wait for 55 energy to refill before script begins again.
Global $sleep = random(1000,8000) ; Slightly randomize time between stages.
;############################################################################################################################################################################################
; Counters, leave these alone.
;#############################################################
Global $t = 0 ;Counter for the sleep loop.
Global $count = 0 ;count of loops
Global $refill = 1 ;count of refills
Global $fPaused = False ;Default state of the pause function.
;#############################################################
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
MsgBox(0,"Begin?", "Click OK to begin.")
While 1
$count = $count + 1
Sleep ($sleep)
Global $chooseDungeon = random(750,950)
If $dungeonSelection = 1 OR $dungeonSelection = 3 Then
MouseMove($chooseDungeon,711,1) ;Select earth shrine entrance, random x axis click for less obvious botting.
Sleep(500)
MouseDown("left")
Sleep (500)
MouseUp("left")
Sleep(1500)
ElseIf $dungeonSelection = 2 Then
MouseMove($chooseDungeon,550,1) ;Select morphing flames, random x axis click.
Sleep(500)
MouseDown("left")
Sleep (500)
MouseUp("left")
Sleep(1500)
EndIf
Do
Global $refillEnergy = PixelSearch(1100,610,1130,630,6488064,8) ;PixelGetColor(1100,630) ;Check for out of energy/refill energy dialogue.
If Not @error Then ;If statement will choose to use lapis to refill energy.
If $enableRefill = 1 Then
MouseMove(1050,630,1)
SLeep(500)
MouseDown("left")
Sleep (1000)
MouseUp("left")
$refill = $refill + 1
ElseIf $enableRefill = 0 Then ;If enableRefill is set to 0 at the top script will not use lapis for refills.
MouseMove(830,630,1)
SLeep(500)
MouseDown("left")
Sleep (1000)
MouseUp("left")
Do
Local $pos = MouseGetPos()
MouseMove(0,1,1)
MouseMove($pos[0],$pos[1],1)
Sleep(1000)
$t = $t + 1
Until $t = $sleepDuration
MouseMove($chooseDungeon,711,1) ;Select earth shrine entrance, random x axis click.
SLeep(500)
MouseDown("left")
Sleep (500)
MouseUp("left")
Sleep(1500)
$t = 0
EndIf
EndIf
Until PixelGetColor(915,345) = 20858 or PixelGetColor(915,495) = 20858 ;Check for the choose friend screen, uses blue bar on friend 1 or friend 2 for reference.
Global $chooseFriend = random(850,1050)
MouseMove($chooseFriend,400,1) ;Select topmost friend, randomizes x axis click.
Sleep(500)
MouseDown("left")
Sleep (500)
MouseUp("left")
Do
Sleep(1000)
Global $chooseDepart = random(890,990) ;Click the Depart button. Randomizes x axis click.
MouseMove($chooseDepart,925,1)
Sleep(500)
MouseDown("left")
Sleep (500)
MouseUp("left")
Global $connectionError = PixelSearch(740, 630,770,650,3892,2) ;Check for connection error dialogue, click OK if found to load battle.
If NOT @error Then
MouseMove(940,640,1)
SLeep(500)
MouseDown("left")
Sleep (500)
MouseUp("left")
EndIf
Global $health = PixelSearch(961,642,995,646,9362761,20)
Until NOT @error ;Check for 20 shades of green in enemy health bar to signal combat. Green pixels seem to vary between sessions.
Sleep(1000)
Global $chooseAuto = random(685,750)
MouseMove($chooseAuto,1045,1) ;Clicks Auto button, randomizes x axis click.
Sleep(500)
MouseDown("left")
Sleep (500)
MouseUp("left")
Do
Sleep(1000)
Until PixelGetColor(1096,668) = 0 or PixelGetColor(1096,668) = 6340193
Do
If PixelGetColor(1060,630) = 3892 Then ;Checks for connection error mesage.
MouseMove(940,640,1)
Sleep(500)
MouseDown("left")
Sleep (500)
MouseUp("left")
EndIf
Global $chooseNext = random(915,970)
MouseMove($chooseNext,900,1) ;clicks first next button after battle.
Sleep(500)
MouseDown("left")
Sleep (500)
MouseUp("left")
Until PixelGetColor(928,907) = 16777215
Do
Sleep(1000)
Global $chooseNext1 = random(915,970)
MouseMove($chooseNext,900,1) ;Goes through character results screen and clicks 2nd next button after battle.
Sleep(500)
MouseDown("left")
Sleep (500)
MouseUp("left")
Sleep(1000)
Global $questCompleted = PixelSearch(1154,465,1168,483,14703360,40)
If NOT @error Then ;Close quest completed dialogue for 3 dungeons daily.
MouseMove(800,685,1)
Sleep(500)
MouseDown("left")
Sleep (500)
MouseUp("left")
EndIf
Global $friendRequest = PixelSearch(800,665,1050,695,1799,40)
If NOT @error Then ; If black pixels within 40 shades found, select Dont Request for friend request menu.
MouseMove(780,800,1)
Sleep(500)
MouseDown("left")
Sleep (500)
MouseUp("left")
EndIf
Sleep(1000)
If $dungeonSelection = 3 Then
Global $homeScreen = PixelSearch(900,250,960,270,2505779,2)
Else
Global $homeScreen = PixelSearch(900,250,960,270,4980738,2)
EndIf
Until NOT @error ;checks for red/green banner near top of home screen. red banner is for world stage menus green banner is for vortex stage menus.
WEnd
; Function to pause the while loop.
Func TogglePause()
$fPaused = Not $fPaused
While $fPaused
MsgBox(0,"Statistics","Rounds: " & $count & " Refills: " & $refill & " Rounds per Refill: " & $count/$refill)
Sleep(100)
ToolTip('Script is "Paused"', 0, 0)
WEnd
ToolTip("")
EndFunc ;==>TogglePause
; Function to exit the while loop.
Func Terminate()
Exit
EndFunc ;==>Terminate