Code:
#Requireadmin
#include-once
read_ini() ; this first, because various variables are used in the include-files
#include "lib/WowMemoryReading.au3"
#include "lib/map.au3"
#include "lib/factions.au3"
#include "lib/movement.au3"
#include <GUIConstantsEx.au3>
#include "lib/constants.au3"
#include "lib/bgqueuing.au3"
#include "lib/profiles.au3"
#include "lib/_XMLDomWrapper.au3"
#include "lib/farm.au3"
HotKeySet("{PAUSE}", "RequestEnd") ;if PAUSE is pressed the function request_end is called (which ends the script)
AutoItSetOption ( "PixelCoordMode",2);relative to client-area of the window
AutoItSetOption ( "MouseCoordMode",2);relative to client-area of the windows
CreateLog() ; Creates Log - if not already created
_WMRGetBaseOffset() ; Gets the Base offset for memory reading
Global $ABORT_SCRIPT = 0
Global $G_ScriptRunTime = 0
Global $G_SameStatus = 0
Global $G_CurrentStatus = 0
Global $G_AfkReports = 0
Global $G_StatusChange = 0
Global $G_WinGetClientSize
Global $G_TooltipXPos
Global $G_TooltipYPos
Global $G_CurrentProfileFile
Global $G_SetFirstProfile = 0
;##################################################################################
;## Description: Reads the Ini files
;## Values: -
;## Return: various global Variables
;## Notes: -
;######
Func read_ini()
;Key_Bindings
Global $Ini_MoveForeward = IniRead("flo.ini", "Key_Bindings", "MoveForeward" , "w")
Global $Ini_MoveBackward = IniRead("flo.ini", "Key_Bindings", "MoveBackward" , "s")
Global $Ini_TurnLeft = IniRead("flo.ini", "Key_Bindings", "TurnLeft" , "a")
Global $Ini_TurnRight = IniRead("flo.ini", "Key_Bindings", "TurnRight" , "d")
Global $Ini_WhisperResponse = IniRead("flo.ini", "Key_Bindings", "WhisperResponse" , "r" )
Global $Ini_Jump = IniRead("flo.ini", "Key_Bindings", "Jump" , "SPACE" )
Global $Ini_Screenshot = IniRead("flo.ini", "Key_Bindings", "Screenshot" , "PRINTSCREEN" )
Global $Ini_AttackFirst = IniRead("flo.ini", "Key_Bindings", "AttackFirst" , "9")
Global $Ini_AttackSpam = IniRead("flo.ini", "Key_Bindings", "AttackSpam" , "9")
Global $Ini_MountUse = IniRead("flo.ini", "Key_Bindings", "MountUse" , "")
Global $Ini_AttackSleepTime = IniRead("flo.ini", "Key_Bindings", "AttackSleepTime" , 3100)
;Settings
Global $Ini_Language = IniRead("flo.ini", "Settings", "Language" , "en")
Global $Ini_GMResponse1 = IniRead("flo.ini", "Settings", "GMResponse1" , "")
Global $Ini_GMResponse2 = IniRead("flo.ini", "Settings", "GMResponse2" , "")
Global $Ini_DebugLvl = IniRead("flo.ini", "Settings","DebugLvl" ,0)
Global $Ini_BG = IniRead("flo.ini", "Settings","BG" ,"Alterac")
Global $Ini_MeleeCombat = IniRead("flo.ini", "Settings","MeleeCombat" ,0)
Global $Ini_Tooltip = IniRead("flo.ini", "Settings","Tooltip" ,0)
Global $Ini_MaxAfkReports = IniRead("flo.ini", "Settings","MaxAfkReports" ,1)
Global $Ini_TownWaitTimeMin = IniRead("flo.ini", "Settings","TownWaitTimeMin" ,5000)
Global $Ini_TownWaitTimeMax = IniRead("flo.ini", "Settings","TownWaitTimeMax" ,20000)
;Advanced
Global $Ini_MouseMoveNpc = IniRead("flo.ini", "Advanced", "MouseMoveNpc" , 50)
Global $Ini_MouseMoveNpcDiscrepancy = IniRead("flo.ini", "Advanced", "MouseMoveNpcDiscrepancy " , 30)
EndFunc ;==>read_ini
;##################################################################################
;## Description: Sleeps the script as long as status hasn't changed
;## Parameter: $send
;## Return:
;## Notes:
;######
Func sleepIt($sleep_seconds) ; sleeps the script for x milliseconds AND checks if color has changed every 1 second)
If ($G_StatusChange == 0) Then ; Only if the color hasn't changed
If ($sleep_seconds > 1000) Then
Sleep(1000)
SleepIt($sleep_seconds - 1000)
Else
Sleep($sleep_seconds)
EndIf
EndIf
Return 1
EndFunc ;==>sleepIt
;##################################################################################
;## Description: Sends as long as Status hasn't changed
;## Parameter: $send
;## Return:
;## Notes:
;######
Func SendIt($send) ;Sends a keystroke(s) to the current opent window IF the color hasn't changed
If ($G_StatusChange == 0) Then
ControlSend("World of Warcraft", "", "", $send)
EndIf
Return 1
EndFunc
;##################################################################################
;## Description: Gets a Color Number (= 7 chars) from the screen
;## Parameter: $x, $y - int - coordinates in pixel
;## Return:
;## Notes:
;######
Func GetNumber($x,$y); Gets a number from the coords $x and $y
Return PixelGetColor($x,$y)
EndFunc
;##################################################################################
;## Description: Simple In-Game-Screenshot
;## Values: $DoAlways = if 1 then makes screenshot even if debug lvl doesn't match
;## Return:
;## Notes:
;######
Func WowScreenshot($DoAlways = 0)
If($Ini_DebugLvl<2 OR $DoAlways==1) Then
ControlSend("World of Warcraft", "", "", "{" & $Ini_Screenshot & "}")
add2log("SCREENSHOT",1)
EndIf
Return 1
EndFunc ;==> wow_screenshot
;##################################################################################
;## Description: Gets the status by color-detection
;## Values: -
;## Return: status
;## Notes: -
;######
Func GetStatus()
Return GetNumber(1,1)
EndFunc
;##################################################################################
;## Description: Executes a Custom File (Waypoints etc..)
;## Values: -
;## Return: no return value
;## Notes: -
;######
Func AdLib_Func()
$G_SameStatus += 1
$G_ScriptRunTime +=1
If($G_SameStatus == 3600) Then
WowScreenshot(1)
add2log("1 hour same Status - quitting",3)
$ABORT_SCRIPT = 1
WinClose("World of Warcraft")
Sleep(10000)
WinKill("World of Warcraft") ;Just to be sure
EndIf
If(Mod($G_ScriptRunTime,900)==0) Then WowScreenshot()
$NewStatus = GetStatus()
If ($NewStatus <> $G_CurrentStatus) Then
Sleep(100) ; waits for 100ms and checks again. trying to elimintate the wrong-color-bug here !
If ( GetStatus() == $NewStatus) Then
$G_SameStatus = 0 ; Status change ergo reset
add2log("AdLib_Func() NS: " & $NewStatus,1)
ResetMovementKeys()
$G_StatusChange = 1; sets the color_change to 1
$G_CurrentStatus = $NewStatus ;set this so the loop doesn't "loop" once to often
EndIf
EndIf
EndFunc ;==>AddLib_Func
;##################################################################################
;## Description: Executes a various number of things if bot has detected a GM whisper
;## Values: -
;## Return: no return value
;## Notes: -
;######
Func GMDetected() ; don't use sleepIt() in this Function, because color_change becomes irrelevant
add2log("GMDetected()")
WinActivate("World of Warcraft")
WinWaitActive("World of Warcraft","",60)
If FileExists("alarm_GM.wav") Then
SoundPlay("alarm_GM.wav", 0)
EndIf
WowScreenshot(1)
add2log("GM WHISPER - SENDING ANSWERS AND CLOSING !!!!!!!!!",3);
Sleep(13000)
Send($Ini_WhisperResponse) ; whisper return
Sleep(300)
Send($Ini_GMResponse1)
Sleep(300)
Send("{ENTER}") ; whisper return
Sleep(9400)
Send($Ini_WhisperResponse) ; whisper return
Sleep(300)
Send($Ini_GMResponse2)
Sleep(300)
Send("{ENTER}") ; whisper return
WowScreenshot(1)
Sleep(10000)
WinClose("World of Warcraft")
Sleep(10000)
WinKill("World of Warcraft") ;Just to be sure
Exit
EndFunc ;==>gm_detected
;##################################################################################
;## Description: Executes a various number of things if bot has detected a idle-debuff
;## Values: -
;## Return: no return value
;## Notes: -
;######
Func AfkReport()
add2log("AfkReport()")
$G_AfkReports += 1
If ($G_AfkReports == $Ini_MaxAfkReports ) Then
WowScreenshot()
add2log("AFK DEBUFF - max - quitting wow and ending bot",2)
WinClose("World of Warcraft")
Sleep(10000)
WinKill("World of Warcraft") ;Just to be sure
Exit
else
;here the logout is send per wow-addon... and after 5 mins is should log back in
WowScreenshot()
AdlibDisable() ;The Function no longer gets called every 1 seconds
add2log("AFK-DEBUFF detected... logging out and waiting 5 mins",2)
Sleep(5*60000+20000+20000); waits 5 mins + amount loggout-time
Send("{ENTER}"); loggs back in
add2log("logging back in",2)
Sleep(60000); waits 1 min for loggin to finish
add2log("loggin finished - starting bot again",2);
Send("{ENTER}")
Sleep(1000)
Send("/console reloadui")
Sleep(1000)
Send("{ENTER}")
Sleep(60000)
Send("{ENTER}")
Sleep(1000)
Send("/flo on")
Sleep(1000)
Send("{ENTER}")
AdlibEnable("AdLib_Func",1000) ; Every x seconds this function gets called !!
Sleep(1000)
WowScreenshot()
EndIf
Return 1
EndFunc
;##################################################################################
;## Description: If Unghost was called in BG.. this function gets at which gy the character resurrected
;## Values: -
;## Return: -
;## Notes: return value have the same names as the folder names in profiles
;######
Func GetWhichGY()
add2log("GetWhichGY()")
$CurrentCoords = _WMRGetCoords("player")
$return = "Undetected";
Switch _mapGetZone()
Case 100 ;Alterac
For $i = 0 To (UBound($G_AlteracGYName)-1)
If _mvCalcDistance($CurrentCoords,_DoubleArray2SingleArray($G_AlteracGY, $i)) < 30 Then
$return = $G_AlteracGYName[$i]
ExitLoop
EndIf
Next
Case 101 ;Arathi
For $i = 0 To (UBound($G_ArathiGYName)-1)
If _mvCalcDistance($CurrentCoords,_DoubleArray2SingleArray($G_ArathiGY, $i)) < 30 Then
$return = $G_ArathiGYName[$i]
ExitLoop
EndIf
Next
Case 102 ;Warsong
For $i = 0 To (UBound($G_WarsongGYName)-1)
If _mvCalcDistance($CurrentCoords,_DoubleArray2SingleArray($G_WarsongGY, $i)) < 30 Then
$return = $G_WarsongGYName[$i]
ExitLoop
EndIf
Next
Case 103 ;eots
For $i = 0 To (UBound($G_eotsGYName)-1)
If _mvCalcDistance($CurrentCoords,_DoubleArray2SingleArray($G_eotsGY, $i)) < 30 Then
$return = $G_eotsGYName[$i]
ExitLoop
EndIf
Next
EndSwitch
Return $return;
EndFunc
Func selectRandomProfile()
Global $G_CurrentProfileFile = _profilesGetRandomFile(_profilesGetBGProfileDir()) ; new Random XML-File is selected
Global $G_SetFirstProfile = 1;
EndFunc
Func BgBeforeStart()
selectRandomProfile()
_XMLExecNode($G_CurrentProfileFile, "/FloProfile/BeforeStart")
EndFunc
Func showTooltip($string)
If $Ini_Tooltip == 1 Then ToolTip($string,$G_TooltipXPos,$G_TooltipYPos,"","",6)
Return true
EndFunc
Func Bot()
WinActivate("World of Warcraft")
WinWaitActive("World of Warcraft","",60)
Global $G_WinGetClientSize = WinGetClientSize("World of Warcraft") ; Windows-window Client size
$TooltipXPos = $G_WinGetClientSize[0]/2
$TooltipYPos = $G_WinGetClientSize[1]/8
$G_CurrentStatus = GetNumber(1,1)
$BeforeBgExecuted = 0
$UnknownColor = 0 ; how many times the next loop has run and no Status was recognized
AdlibEnable("AdLib_Func",1000) ; Every x seconds this function gets called !!
Do
showTooltip("Bot Status:"&@LF&@LF&"Waiting")
If $G_CurrentStatus < 256 Then $UnknownColor = 0 ; resets the unknown_color if color is smaller than 256
$G_StatusChange = 0; resets the StatusChange
Sleep(1000) ; Waits 1 second before each execution
_WMRGetBaseOffset() ; Base Offset has changed since MAP_ID change
Switch $G_CurrentStatus
Case 8 ; town
WinActivate("World of Warcraft")
WinWaitActive("World of Warcraft","",60)
SleepIt(Random($Ini_TownWaitTimeMin,$Ini_TownWaitTimeMax,1))
_WMRGetBaseOffset() ; Offset once again, no harm in that ^^
add2log("STATUS: TOWN",2)
showTooltip("Bot Status:"&@LF&@LF&"In Town")
JoinBg()
Case 1 ; queued for bg
add2log("STATUS: QUEUED",2)
showTooltip("Bot Status:"&@LF&@LF&"Queued")
JustAntiAfk()
Case 2 ; bg before start
SleepIt(2000) ; This is VERY important - new coordinates have to be written to the ram first
add2log("STATUS: IN BG - BEFORE START",2)
showTooltip("Bot Status:"&@LF&@LF&"In BG Before Start")
BgBeforeStart()
If ($G_StatusChange == 0) Then $BeforeBgExecuted = 1 ;when status still unchanged then executed = ok
JustAntiAfk() ; anti-afk
Case 3 ; bg after start
add2log("STATUS: IN BG - AFTER START",2)
showTooltip("Bot Status:"&@LF&@LF&"In BG After Start")
If $BeforeBgExecuted == 0 Then BgBeforeStart()
$BeforeBgExecuted = 0; reset either way
_XMLExecNode($G_CurrentProfileFile, "/FloProfile/AfterStart")
AntiAfkWithAutoAttack()
Case 4 ; dead
add2log("STATUS: DIED",2)
showTooltip("Bot Status:"&@LF&@LF&"Player Dead")
JustAntiAfk()
Case 5 ; unghost = alive again = this is supposed (?) to trigger only in BG
add2log("STATUS: UNGHOST - ALIVE AGAIN",2)
$GraveYard = GetWhichGY()
If $GraveYard <> false Then ; Alterac
_XMLExecNode($G_CurrentProfileFile, "/FloProfile/" & $GraveYard)
EndIf
showTooltip("Bot Status:"&@LF&@LF&"Player Resurected at Graveyard :"&$GraveYard)
If $GraveYard == "Undetected" then
$PlayerCoords = _WMRGetCoords("player")
$Zone = _mapGetZone()
add2log("STATUS: GY unknown - Player Location: ("&$PlayerCoords[0]& ", "&$PlayerCoords[1]&", "&$PlayerCoords[2]&")",2)
EndIf
AntiAfkWithAutoAttack()
Case 6 ; GM whisper
add2log("STATUS: GM WHISPER",2)
showTooltip("Bot Status:"&@LF&@LF&"GM Whisper received")
GMDetected()
Case 7 ; afk-debuff
WowScreenshot(1)
add2log("STATUS: AFK REPORTET !!",3)
showTooltip("Bot Status:"&@LF&@LF&"Player got AFK Reported")
AfkReport()
Case 254
add2log("STATUS: 254",2)
showTooltip("Bot Status:"&@LF&@LF&"Status 254 ERROR")
AntiAfkWithAutoAttack()
Case 255
add2log("STATUS: 255",2)
_XMLExecNode("profiles/test/test.xml", "/FloProfile/")
Case Else
$UnknownColor += 1
add2log("STATUS: Not Recognized",2)
showTooltip("Bot Status:"&@LF&@LF&"Box Color not Recongnized")
If $UnknownColor == 10 Then
Relog()
EndIf
If $UnknownColor == 200 Then
$UnknownColor = 2
EndIf
EndSwitch
Until $ABORT_SCRIPT <> 0
AdlibDisable() ;The Function no longer gets called every 1 seconds
add2log("Quiting Program - No Autorelog implemented yet",2)
EndFunc
Func CheckConfigs()
WinActivate("World of Warcraft")
WinWaitActive("World of Warcraft","",60)
Global $G_WinGetClientSize = WinGetClientSize("World of Warcraft") ; Windows-window Client size
$StatusColor = GetNumber(1,1)
Global $G_TooltipXPos = 100
Global $G_TooltipYPos = 100
Sleep(100); Waits 1 second and checks if color changes
If $StatusColor <> GetNumber(1,1) AND $StatusColor > 256 Then
add2log("CheckConfig(): STATUS NOT FOUND - CHECK IF BLACK SQUARE IS ACTIVE AND CENTERED",3)
showTooltip("Bot Status:"&@LF&@LF&"Status Not Found - Check if Flo addon is Activated")
$ConfigStatus = 0
Else
add2log("CheckConfig(): Square found = Status OK",3)
showTooltip("Bot Status:"&@LF&@LF&"Ready and Waiting")
$ConfigStatus = 1
EndIf
If(_WMRGetPlayerData('GUID') == False) Then
add2log("CheckConfig(): PlayerData not found: Critical Error, contact help or stop using ^^",3)
showTooltip("Bot Status:"&@LF&@LF&"PlayerData not found: Critical Error, contact help or stop using")
$ConfigPlayerData = 0
Else
add2log("CheckConfig(): PlayerData found = OK",3)
showTooltip("Bot Status:"&@LF&@LF&"PlayerData Found")
$ConfigPlayerData = 1
EndIf
If $ConfigStatus == 1 AND $ConfigPlayerData == 1 Then Bot()
EndFunc
Func Relog()
SleepIt(2000)
showTooltip("STATUS: Disconnected - Relog - Entering acc data")
WinActivate("World of Warcraft")
SleepIt(2000)
ControlSend("World of Warcraft", "", "","{ENTER}")
SleepIt(100)
ControlSend("World of Warcraft", "", "","{BS}")
SleepIt(10)
ControlSend("World of Warcraft", "", "","{BS}")
SleepIt(10)
ControlSend("World of Warcraft", "", "","{BS}")
SleepIt(10)
ControlSend("World of Warcraft", "", "","{BS}")
SleepIt(10)
ControlSend("World of Warcraft", "", "","{BS}")
SleepIt(500)
ControlSend("World of Warcraft", "", "","YOURPASSWORDHERE")
WowScreenshot()
SleepIt(Random(250, 350))
ControlSend("World of Warcraft", "", "","{ENTER}")
SleepIt(Random(6000, 8000))
ControlSend("World of Warcraft", "", "","{ENTER}")
SleepIt(Random(15000, 20000))
EndFunc
CheckConfigs()
;add2log(_profilesGetRandomFile(_profilesGetBGProfileDir()))