Code:
; Create "Am I AFK'd" script.
; Spell Not Ready Yet triggers Not Facing Target.
; Too Far Away Follow creates /cleartarget loop until message has cleared.
; Combat is continuing even if errors are recieved -> need to create a "check status" pattern between each attack.
#include <GUIConstantsEx.au3>
Global $client = "World of Warcraft"
Global $play = WinExists($client)
Global $mount, $faction, $startbg, $mounted, $ingame, $bg, $follow, $died, $target, $a, $paused
Opt("CaretCoordMode", 0)
Opt("GUICoordMode", 0)
Opt("MouseCoordMode", 0)
Opt("PixelCoordMode", 0)
HotKeySet("{Esc}", "Quit")
HotKeySet("{9}", "Pause")
If $play = 0 Then
MsgBox (16, "Error", "World of Warcraft is not running - please try again.")
Else
$mount = InputBox("Initial Setup", "Enter the mount you wish to use:", "Swift Purple Wind Rider", "")
If @error = 1 Then
MsgBox(16, "Error", "You clicked cancel - the program will now exit.")
Else
WinActivate($client, "")
While 1
GetFaction()
Brain()
WEnd
EndIf
EndIf
Exit 0
Func GetFaction()
$faction = PixelGetColor (566, 612)
If $faction = "14493696" Then
$faction = "H"
Else
$faction = "A"
EndIf
EndFunc
Func Brain()
If $startbg = 1 Then
EndGame()
Death()
If $died = 1 Then
Waypoint()
EndIf
Target()
EndIf
JoinBG()
Sleep (1000)
Setup()
EndFunc
Func JoinBG()
$startbg = 1
$follow = 0
$mounted = 0
Local $deserter = PixelGetColor (629, 121)
If $deserter = "1593831" Then
ToolTip ("Deserter status, please wait.")
Sleep (1000)
JoinBG()
EndIf
$ingame = PixelGetColor (689, 135)
If $ingame = "12638830" Then
Brain()
EndIf
; ----------------------------------------------------------------------->
Send ("{Enter}")
Sleep (100)
Send ("/dismount" & "{Enter}")
; ----------------------------------------------------------------------->
Send ("{h}" & "{Enter}")
Sleep (100)
Send ("/script JoinBattlefield(0)" & "{Enter}")
Sleep (1000)
Local $cooldown = PixelGetColor (215, 131)
If $cooldown = "16776960" Then
ToolTip ("Queuing you in 30 seconds.")
Send ("{h}")
Sleep (30000)
ToolTip ("")
JoinBG()
EndIf
Sleep (1000)
Local $queue = PixelChecksum(30, 175, 40, 180)
While $queue = PixelChecksum(30, 175, 40, 180)
Sleep(500)
WEnd
Send ("{Enter}")
Sleep (100)
Send ("/script AcceptBattlefieldPort(1,1)" & "{Enter}")
Sleep (2500)
Local $load = PixelChecksum(45, 45, 55, 55)
While $load = PixelChecksum(45, 45, 55, 55)
Sleep (500)
WEnd
EndFunc
Func Setup()
Send ("{m}")
Sleep (500)
$bg = PixelGetColor (245, 123)
Send ("{m}")
Sleep (500)
If $bg = "12233617" Then ; Alterac Valley
$bg = "AV"
If $ingame = "12638830" Then
Brain()
EndIf
Send ("{w down}" & "{q down}")
Sleep (1100)
Send ("{q up}")
Sleep (11000)
Send ("{w up}" & "{e down}")
Sleep (500)
Send ("{e up}")
Countdown()
Send ("{w down}")
Sleep (3000)
Send ("{w up}")
Mount()
ElseIf $bg = "8543258" Then ; Twin Peaks
$bg = "TP"
If $ingame = "12638830" Then
Brain()
EndIf
Send ("{w down}" & "{e down}")
Sleep (2000)
Send ("{w up}")
Sleep (3000)
Send ("{e up}")
Countdown()
Send ("{e down}")
Sleep (1000)
Send ("{e up}")
Mount()
ElseIf $bg = "7297333" Then ; Warsong Gulch
$bg = "WSG"
If $ingame = "12638830" Then
Brain()
EndIf
If $faction = "H" Then ; Horde Start
Send ("{w down}" & "{e down}")
Sleep (2000)
Send ("{w up}" & "{e up}")
Countdown()
Send ("{w down}")
Sleep (7000)
Send ("{w up}")
Mount()
EndIf
If $faction = "A" Then ; Alliance Start
Send ("{w}")
EndIf
ElseIf $bg = "1056842" Then ; Arathi Basin
$bg = "AB"
If $ingame = "12638830" Then
Brain()
EndIf
; Horde AB Start
If $faction = "H" Then
Send ("{w down}")
Sleep (6000)
Send ("{w up}")
Mount()
Countdown()
EndIf
; Alliance AB Start
If $faction = "A" Then
Send ("{Enter}")
Sleep (100)
Send ("Oops." & "{Enter}")
EndIf
ElseIf $bg = "11895611" Then ; Battle for Gilnaes
$bg = "BfG"
If $ingame = "12638830" Then
Brain()
EndIf
Send ("{q down}")
Sleep (400)
Send ("{q up}" & "{w down}")
Sleep (7000)
Send ("{w up}" & "{e down}")
Sleep (300)
ElseIf $bg = "7885604" Then ; Isle of Conquest
$bg = "IoC"
If $ingame = "12638830" Then
Brain()
EndIf
Sleep (100)
Mount()
Send ("{w down}")
Countdown()
Send ("{w up}")
ElseIf $bg = "7165751" Then ; Eye of the Storm
$bg = "EotS"
If $ingame = "12638830" Then
Brain()
EndIf
Mount()
Sleep (120000)
Send ("{w down}")
Sleep (12000)
Send ("{q down}")
Sleep (1000)
Send ("{q up}")
Sleep (17000)
Send ("{w up}")
ElseIf $bg = "9466426" Then ; Strand of the Ancients
$bg = "SotA"
If $ingame = "12638830" Then
Brain()
EndIf
Local $team = PixelGetColor (713, 85)
; Attacking Start A
If $team = "269095" Then
Mount()
EndIf
; Defending Start
If $team = "4603710" Then
Send ("{w}")
EndIf
EndIf
Brain()
EndFunc
Func Countdown()
$coord = PixelSearch (335, 150, 345, 180, 0x890000, 10)
Local $counting = PixelChecksum ($coord[1], $coord[2], $coord[1], $coord[2])
While $counting = PixelChecksum ($coord[1], $coord[2], $coord[1], $coord[2])
Sleep (100)
WEnd
; -----------------------------------------> Need "If Error" for non-countdown bgs.
Sleep (10000) ; 10 Seconds Left
EndFunc
Func Waypoint()
$died = 0
Local $grave = PixelGetColor (760, 100)
If $bg = "AV" Then
If $grave = "1512465" Then ; Tunnel
Send ("{w down}" & "{q down}")
Sleep (1100)
Send ("{q up}")
Sleep (11000)
Send ("{w up}" & "{e down}"
Sleep (500)
Send ("{e up}" & "{w down}")
Sleep (3000)
Send ("{w up}")
Mount()
EndIf
ElseIf $bg = "AB" Then
If $grave = "05A5546" Then ; Gold Mine
EndIf
ElseIf $bg = "WSG" Then
; Horde GY
If $grave = "" Then
Mount()
EndIf
ElseIf $bg = "TP" Then
; Horde Graveyard
If $grave = "" Then
Mount()
Send ("{w down}")
Sleep (20000)
Send ("{w up}")
EndIf
ElseIf $bg = "IoC" Then
If $grave = "" Then ; Horde Grave
EndIf
; Hanger
If $grave = "" Then
EndIf
ElseIf $bg = "EotS" Then
If $grave = "" Then ; Blood Elf Tower
Mount()
Send ("{left down}")
Sleep (200)
Send ("{left up}" & "{w down}")
Sleep (6000)
Send ("{w up}")
ElseIf $grave = "" Then ; Mage Tower
EndIf
ElseIf $bg = "BfG" Then
If $grave = "" Then ; Gilnean Coast
Mount()
ElseIf $grave = "" Then ; Horde Landing
Mount()
Send ("{w down}")
Sleep (19000)
Send ("{q down}")
Sleep (3000)
Send ("{q up}")
Sleep (1000)
Send ("{w up}")
EndIf
EndIf
; Unrecognized Grave
EndFunc
Func EndGame()
Local $exit = PixelGetColor(393, 486)
If $exit = "16040704" Then ; Exit Button Found
$startbg = 0
MouseClick ("left", 393, 486, 1)
Sleep (2500)
Local $loading = PixelChecksum(45, 45, 55, 55)
While $loading = PixelChecksum(45, 45, 55, 55)
Sleep (500)
WEnd
Brain()
EndIf
EndFunc
Func Death()
Local $life = PixelGetColor (78, 70)
If $life <> "7424" And $died = 0 Then ; Character is Dead
$died = 1
Sleep (1000) ;---------------------------------------------------------------> Make sure to adjust this time.
Send ("{Enter}")
Sleep (100)
Send ("/run RepopMe()" & "{Enter}")
Sleep (1000) ;--------------------------------------------------------------->
Death()
ElseIf $life <> "7424" And $died = 1 Then ; Character is Ghost
Sleep (1000) ;---------------------------------------------------------------> Convert to PixelChecksum GY Button
Death()
EndIf
EndFunc
Func Target()
$target = PixelGetColor (209, 55)
If $target = "11337728" Then ; Enemy Targeted
If $mounted = 1 Then ; Unmount if Mounted
$mounted = 0
Send ("{Enter}")
Sleep (100)
Send ("/dismount" & "{Enter}")
Sleep (100)
EndIf
If $follow = 1 Then ; Stop Following
$follow = 0
Send ("{s}")
Sleep (100)
EndIf
Send ("{Enter}") ; Target Closest Enemy
Sleep (100)
Send ("/targetenemyplayer" & "{Enter}")
Combat()
ElseIf $target = "43520" Then ; Friendly Targeted
Mount()
Local $toofar = PixelGetColor (336, 127)
If $toofar = "16718362" Then ; Target is Too Far Away
Send ("{Enter}")
Sleep (100)
Send ("/cleartarget" & "{Enter}")
$follow = 0
Brain()
ElseIf $follow = 0 Then ; Not Following
Send ("{Enter}")
Sleep (100)
Send ("/follow" & "{Enter}")
$follow = 1
ElseIf $follow = 1 Then ; Following
Send ("{Enter}")
Sleep (100)
Send ("/targetenemyplayer" & "{Enter}" & "{Space}")
Sleep (100)
$follow = 0
EndIf
Brain()
Else ; Nobody Targeted -------------------------------------> No Patrol, Only Hook
$follow = 0
$mounted = 0
Mount()
Send ("{Enter}")
Sleep (100)
Send ("/targetraid" & "{Enter}" & "{Enter}")
Sleep (100)
Send ("/targetenemyplayer" & "{Enter}")
Brain()
EndIf
EndFunc
Func Combat()
; ------------------------------------------> This section is the loadable profile section.
Local $1 = "Arcane Blast"
Local $2 = "Arcane Barrage"
Local $3 = "Arcane Missiles"
Bang($1)
Sleep (2500)
Bang($1)
Sleep (2500)
Bang($2)
Sleep (1000)
Bang($3)
Sleep (3000)
; ------------------------------------------> End of load profile section.
Brain()
EndFunc
Func Bang(ByRef $attack) ; Check Combat Status
Local $los = PixelGetColor (327, 127) ; Line of Sight
Local $snr = PixelGetColor (337, 128) ; Spell Not Ready
Local $move = PixelGetColor (318, 131) ; Can't Do That While Moving
Local $oor = PixelChecksum (23, 608, 31, 615) ; Out of Range
Local $dead = PixelGetColor (209, 55) ; Target is Dead
Send ("{Enter}") ; Cast Attack
Sleep (100)
Send ("/cast " & $attack & "{Enter}")
Sleep (150)
Local $dir = PixelChecksum (23, 616, 24, 617)
Sleep (150)
If $dead <> "11337728" Then
Brain()
ElseIf $los = "16718362" Then ; If Target is Out of Line of Sight
Send ("{Enter}")
Sleep (100)
Send ("/cleartarget" & "{Enter}")
Brain()
ElseIf $dir <> PixelChecksum (23, 616, 24, 617) And $snr <> "16718362" Then ; Facing Wrong Direction
Local $dir2
Send ("{left down}")
While $dir2 <> $dir
Send ("{Enter}")
Sleep (100)
Send ("/cast " & $attack & "{Enter}")
Sleep (300)
$target = PixelGetColor (209, 55)
If $target <> "11337728" Then
Brain()
EndIf
$dir2 = PixelChecksum (23, 616, 24, 617)
WEnd
Send ("{left up}")
ElseIf $oor = PixelChecksum (23, 608, 31, 615) Then ; Out of Range
Send ("{w down}")
Do
$move = PixelGetColor (318, 130)
Sleep (250)
Send ("{Enter}")
Sleep (100)
Send ("/cast " & $attack & "{Enter}")
$target = PixelGetColor (209, 55)
If $target <> "11337728" Then
Brain()
EndIf
Until $move = "16718362"
Send ("{w up}")
Sleep (100)
Send ("{Enter}")
Sleep (100)
Send ("/cast " & $attack & "{Enter}")
EndIF
EndFunc
Func Mount() ; ---------------> Handle Mount AND Unmount sript NEEDED.
If $mounted = 0 Then
$mounted = 1
Send ("{w}" & "{Enter}")
Sleep (100)
Send ("/cast [nomounted,outdoors] " & $mount & "{Enter}")
Sleep (2000)
EndIf
EndFunc
Func Pause()
$paused = NOT $paused
While $paused
sleep(100)
ToolTip("Paused - Press '9' to Resume")
WEnd
ToolTip("")
EndFunc
Func Quit()
Exit 0
EndFunc