Code:
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.0.0
Author: Unkn0wn0x
Website: http://unkn0wn0x.wordpress.com/
Script Function:
Gathermate Bot
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#RequireAdmin
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WoWConstants.au3>
#include <BlackMagicAU3.au3>
#include <DifferentWoWMemoryThings.au3>
#include <string.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Gathermate", 348, 445, 387, 206, -1, $WS_EX_TOOLWINDOW)
$m_lDeaths = GUICtrlCreateLabel("Deaths :", 16, 402, 44, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
$m_lDeathsCount = GUICtrlCreateLabel("0", 64, 352 + 50, 10, 17)
$m_lHerbs = GUICtrlCreateLabel("Herbs:", 280, 352 + 50, 35, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
$m_lHerbsCount = GUICtrlCreateLabel("0", 328, 352 + 50, 10, 17)
$m_lMines = GUICtrlCreateLabel("Mines:", 216, 352 + 50, 35, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
$m_lMinesCount = GUICtrlCreateLabel("0", 264, 352 + 50, 10, 17)
$m_checkPostItems = GUICtrlCreateCheckbox("Post Items to other Character", 16, 8, 161, 17)
$m_checkRepair = GUICtrlCreateCheckbox("Repair broken armor", 16, 24, 121, 17)
$m_lAd = GUICtrlCreateLabel("http://unkn0wn0x.wordpress.com", 8, 376 + 50, 194, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$m_lRunningFor = GUICtrlCreateLabel("Running for:", 80, 352 + 50, 62, 17)
GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
$m_lRunningForcount = GUICtrlCreateLabel("0 minutes", 152, 352 + 50, 49, 17)
$List1 = GUICtrlCreateList("", 216, 8, 121, 45)
GUICtrlSetData(-1, "Just Herb|Just Mine|Mine and Herb")
$m_checkPlaySounds = GUICtrlCreateCheckbox("Play Sounds on Error or Whisper", 16, 40, 177, 17)
$Console = GUICtrlCreateEdit("", 8, 64, 329, 281, $ES_READONLY)
$StartBot = GUICtrlCreateButton("Start Bot", 8, 350, 329, 20)
$StopBot = GUICtrlCreateButton("Stop Bot", 8, 370, 329, 20)
_Log("Gathermate loaded...")
_BMInitialize()
$PID = WinGetProcess("World of Warcraft")
$handle = _BMOpenProcess($PID)
$ptr1 = _BMReadMemory($handle, $PlayerBase, "ptr")
$ptr2 = _BMReadMemory($handle, $ptr1 + $PlayerBaseOffset1, "ptr")
$pBase = _BMReadMemory($handle, $ptr2 + $PlayerBaseOffset2, "ptr")
$ObjectManager = _BMReadUInt($handle, (_BMReadUInt($handle, $aClientConnection) + $ObjManagerOffset))
$FirstObject = _BMReadUInt($handle, ($ObjectManager + $ObjManagerFirstObject))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $m_lDeaths
Case $m_lDeathsCount
Case $Console
Case $StartBot
_StartBot()
EndSwitch
WEnd
Func _StartBot()
_Log("Starting Bot now...")
If GUICtrlRead($m_checkPostItems) == 4 Then
_Log("Post Items to bank character disabled...")
ElseIf GUICtrlRead($m_checkPostItems) == 1 Then
_Log("Post Items to bank character enabled...")
EndIf
If GUICtrlRead($m_checkRepair) == 4 Then
_Log("Repairing disabled...")
ElseIf GUICtrlRead($m_checkRepair) == 1 Then
_Log("Reparing enabled...")
EndIf
If GUICtrlRead($m_checkPlaySounds) == 4 Then
_Log("Playing Sounds disabled...");
ElseIf GUICtrlRead($m_checkPlaySounds) == 1 Then
_Log("Playing Sounds enabled...")
EndIf
_Log("Looking for World of Warcraft now...")
If $PID = -1 Then
_Log("Could not find World of Warcraft")
Else
_Log("World of Warcraft PID : " & $PID)
EndIf
$X = _GetX($handle, $pBase)
$Y = _GetY($handle, $pBase)
$Z = _GetZ($handle, $pBase)
;_Log($X & " + " & $Y & " + " & $Z)
$lineNumber = 1
_Log("Movement started.")
$Movement = True
$curobject = $FirstObject
$pName = FileOpenDialog("Please select a profile", @ScriptDir, "Profiles (*.ini)")
While ($Movement == True)
;$pName = "storm.gm"
$profileFile = FileReadLine($pName, $lineNumber)
$content = _StringBetween($profileFile, "<Waypoint>", "</Waypoint>")
If Not @error Then
$split = StringSplit($content[0], " ")
If IsArray($split) Then
If $split[0] = 3 Then
$XCoord = $split[1]
$YCoord = $split[2]
$ZCoord = $split[3]
$X = _GetX($handle, $pBase)
$Y = _GetY($handle, $pBase)
$Z = _GetZ($handle, $pBase)
$dist = Sqrt(($X - $XCoord) ^ 2 + ($Y - $YCoord) ^ 2)
If $dist > 350 Then
;_Move($handle, $XCoord, $YCoord, $ZCoord)
Sleep(750)
ControlSend("World of Warcraft", "", "", "{W}")
_Log("Information : Walk " & $dist & "yard on that way!")
$Movement = False
Else
$ObjectManager = _BMReadUInt($handle, (_BMReadUInt($handle, $aClientConnection) + $ObjManagerOffset))
$FirstObject = _BMReadUInt($handle, ($ObjectManager + $ObjManagerFirstObject))
$curobject = _BMReadUInt($handle, ($curobject + $ObjectNextOffset))
$name = _BMReadASCIIString($handle, _BMReadUint($handle, (_BMReadUInt($handle, ($curobject + $GAMEOBJECT_NAMEOFFSET_1)) + $GAMEOBJECT_NAMEOFFSET_2)), 30)
$curGUID = _BMReadMemory($handle, ($curobject + 0x30), 'uint64')
If $name = "Saronite Deposit" Or $name = "Lichblüte" Then
_Log("Found : " & $name)
_Move($handle, _getObjectX($handle, $curobject), _getObjectY($handle, $curobject), _getObjectZ($handle, $curobject))
_interact($handle, $curGUID)
EndIf
;_Move($handle, $XCoord, $YCoord, $ZCoord)
$lineNumber = $lineNumber + 1
; GoForwards($pName, $newline)
;Endif
EndIf
EndIf
EndIf
EndIf
WEnd
EndFunc ;==>_StartBot
Func _interact($handle, $curGUID)
_BMWriteMemory($handle, 0x01281844, $curGUID, 'uint64')
Opt("SendKeyDownDelay", 50)
ControlSend("World of Warcraft", "", "", "{h}")
EndFunc ;==>_interact
Func _getObjectX($handle, $curobject)
Return Floor(_BMReadMemory($handle, $curobject + 0xE8, "float"))
EndFunc ;==>_getObjectX
Func _getObjectY($handle, $curobject)
Return Floor(_BMReadMemory($handle, $curobject + 0xEC, "float"))
EndFunc ;==>_getObjectY
Func _getObjectZ($handle, $curobject)
Return Floor(_BMReadMemory($handle, $curobject + 0xF0, "float"))
EndFunc ;==>_getObjectZ
Func _Log($data)
;GUICtrlSetData($Console, @CRLF &"[L] : " & $data & @CRLF)
GUICtrlSetData($Console, "[Log] : " & $data & @CRLF, 1)
EndFunc ;==>_Log
Func _Move($handle, $XCoord, $YCoord, $ZCoord)
_BMWriteFloat($handle, 0x012818C4, $XCoord)
_BMWriteFloat($handle, 0x012818C8, $YCoord)
_BMWriteFloat($handle, 0x012818CC, $ZCoord)
_BMWriteInt($handle, 0x01281854, "4")
$X = Round(_GetX($handle, $pBase))
$Y = Round(_GetY($handle, $pBase))
$lastDist = 10000000
$dist = Sqrt(($X - $XCoord) ^ 2 + ($Y - $YCoord) ^ 2)
;MsgBox(0, "Wrote that Shit", "")
$distance = False
While ($distance == False)
$distancewp = Round(Sqrt(($XCoord - _GetX($handle, $pBase)) ^ 2 + ($YCoord - _GetY($handle, $pBase)) ^ 2))
If $distancewp < 5 Then
$distance = True
EndIf
If $distancewp > 6 Then
Sleep(100)
EndIf
WEnd
EndFunc ;==>_Move
It moves to the corrent Waypoints, but it refuses to seach for nodes and then harvest them...