brauche hilfe habe sonen travel bot habe ihn selber etwas umgeschrieben, also zb. er läuft die waypoints so ab er steht zb. auf 1550(Y),-525(X) und er muss eigentlich 1551(Y), -525(X) dann überprüft der das so und dann dreht er sich und will auf die richtigen coordinaten laufen und er läuft dann immer drüber und dann dauert das bis er weiter läuft wollte fragen wie man das überprüfen in dem code rausnimmt oder macht das wenn er 2 - 3 oder so höher oder niedriger auf der X und Y achse ist das er dann weiter läuft, also das er das net so ganz genau macht.
Quote:
#AutoIt3Wrapper_icon=lol.ico
;Includes
#include <GUIConstants.au3>
#include <String.au3>
#include <Date.au3>
#include <array.au3>
#include <Math.au3>
#include <File.au3>
#include <_XMLDomWrapper.au3>
#include <NomadMemory.au3>
#include <File.au3>
;Hotkeys
HotkeySet("{ESC}","terminate")
HotkeySet("{F1}","RunTheBot")
;hotkeyset("{F3}","Pause") - Implant soon...
hotkeyset("{F2}","SaveDestination_Ghost")
;;================================================ ================================
;;Variable Definition;
;;================================================ ================================
;;App
$App_name = "Auto-Travel" ;Main Name of the application
$App_version = "" ;Version Number of the Application
$App_Title = ($App_name & " " & $App_version & " ") ;Final Name of Process
;Files
Global $WowProcessName = "World of Warcraft" ;Name of the process (CASE SENSITIVE!!! FIX FOR YOUR VERSION)
Global $logname = "/Progress.log" ;Name of the logfile
;; Usual Config
dim $RatioConvertion = "100"
dim $slowdistance = "1"
dim $TimeBeforeJump = "4000" ;ms before starting to jump over a obstecle
dim $TimeBeforeReverse = "10000" ;ms before going back to previous waypoint
dim $walkkey = "{NUMLOCK}" ;Not used
;others
Global $wait, $running, $MouseDown, $taskset,$rot_perfect = 0 ;MouseDown is 1 when the mouse is down, and 0 when not
dim $cmdtabel = 0 ;When running the bot it will automaticly go to the first CASE in the CMDTable
Global $CurrentCheck = 1 ;Is 1 when its first time a check is being made
Dim $dubblecheckPos
dim $Overllrot, $OverllLocX, $OverllLocY, $OverllZone, $CurrentRot, $CurrentLocX, $CurrentLocY, $continentID, $lastX, $lastY, $debug, $toposX,$toposY,$result = 0
dim $dubblecheckPos, $ycheck, $slow, $move_x_big, $move_y_big, $rot_perfect, $rot_fast, $down, $XCurBigger, $YCurBigger, $jtdif, $jtstart = 0
dim $checkagain = 0
global $arraynumber = "0"
dim $array_x_number = "0"
global $pi = 4 * ATan(1)
dim $Xstart, $Ystart = 0
Global $pasedborder = 0
dim $jumptimerwalk, $deathNY = 0
$alive = 1
;for XML Process
Global $xmlFile ;Name of the XML File open
dim $test_pause = 0
$ATTRIBS = _ArrayCreate ("Continent","Zone","Nr","posX","posY","Comment ")
$CHILDATTRIBS = _ArrayCreate ("Continent","Zone","Nr","posX","posY","Comment ")
Global $xmlFile
Global $count = 0
Global $sNxPath, $fHwnd
Global $ARRAY[1][1]
Global $ARRAYX
Global $ARRAYY
Local $additional = 1
Local $numb = 0001
dim $corpselocX,$releasecorpse, $corpselocY = 0
;for XML Process __ for save waypoint
Local $szXPath1,$szXPath2, $aNodeName1,$aNodeName2, $find, $oXSD,$iNodeCount,$aAttrName1[1],$aAttrVal1[1],$aAttrName2[1],$aAttrVal2[1],$ret_val,$X
Opt("WinTitleMatchMode", 4)
Global $ProcessID = WinGetProcess($WowProcessName,"")
SetPrivilege("SeDebugPrivilege", 1)
If $ProcessID = -1 Then
MsgBox(4096, "Thermo Prime - ERROR", "Failed to detect World of Warcraft running.")
Exit
EndIf
_FileWriteLog(@ScriptDir & $logname,":::Start Of Session:::")
;;================================================ ================================
;;GUI;
;;================================================ ================================
;Window
GUICreate($App_Title, 200, 250)
GUISetState (@SW_SHOW)
;Buttons
$Button_SelectProfile = GUICtrlCreateButton ("Select Profile", 100, 10, 100)
$Button_NewProfile = GUICtrlCreateButton ("New Profile", 100, 40, 100)
GUICtrlCreateLabel("F1 Run Waypoints", 100, 70, 100)
GUICtrlCreateLabel("F2 Save Waypoints", 100, 90, 100)
;Labels
$FinalCharname = GUICtrlCreateLabel("Acc.Name", 10,10,70,20,($SS_SUNKEN ))
$Finallocx = GUICtrlCreateLabel("Position X", 10,40,70,20,($SS_SUNKEN ))
$Finallocy = GUICtrlCreateLabel("Position Y", 10,70,70,20,($SS_SUNKEN ))
$Finalrot = GUICtrlCreateLabel("Rotation", 10,100,70,20,($SS_SUNKEN ))
$Finalrandom = GUICtrlCreateLabel("ZoneID", 10,130,70,20,($SS_SUNKEN ))
;Labels_debug
$DebugID = GUICtrlCreateLabel("StatusID", 5,210,120,20,($SS_SUNKEN ))
$RotationID = GUICtrlCreateLabel("RotationID", 5,190,120,20,($SS_SUNKEN ))
;Checkbox
$debugcheck = GUICtrlCreateCheckbox ("Debug Mode", 5, 230, 160, 20)
$combatmode = GUICtrlCreateCheckbox ("Combat Mode", 100, 230, 160, 20)
;WinSetOnTop($App_Title, "", 1) - Implant soon...
SmartBehavior()
;;================================================ ================================
;;THERMO START!
;;================================================ ================================
Func SmartBehavior()
While $wait = 0
;Check GUI for userinput
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit 0
Case $msg = $Button_SelectProfile
SelectOpenXML()
Case $msg = $Button_NewProfile
NewProfile()
EndSelect
;Check if wow is running
If WinActive("World of Warcraft") Then
If $xmlFile = "" Then
sleep(10)
msgbox(0,"Thermo Prime - ERROR","You have not selected a XML File! Please press the [Select Profile] button and select a profile before running")
WinWaitActive($App_Title)
Else
_FileWriteLog(@ScriptDir & $logname,"World Of Warcraft process opned")
sleep(20)
send("{Enter}")
sleep(11)
Clipput("/script DEFAULT_CHAT_FRAME:AddMessage("""& $app_name & "" & $App_version & " is running!! "",0.0,0.0,1.0); ")
sleep(11)
Send("^v")
sleep(11)
send("{Enter}")
$wait = 1
EndIf
EndIf
WEnd
;Start the bot-----------------
While 1
Cmdtable()
WEnd
EndFunc ;==>SmartBehavior
;;================================================ ================================
;;Command Table;
;;================================================ ================================
func Cmdtable() ;;Command Table for functions, this table can be used for configuring the steps of the bots behaviour
$debug = GUICtrlRead($debugcheck)
Switch $cmdtabel
Case 0
;ControlSetText($App_Title, "", $DebugID, "0-GetCurrentData")
GetCurrentData()
Case 1
ControlSetText($App_Title, "", $DebugID, "1-EventCalculation" & $array_x_number) ;these are for debuggin - Remove soon...
EventCalculation()
Case 2
ControlSetText($App_Title, "", $DebugID, "2-CheckRotation")
_FileWriteLog(@ScriptDir & $logname,"checkRotation" & $taskset)
CheckRotation()
Case 3
ControlSetText($App_Title, "", $DebugID, "3-GoToPos")
_FileWriteLog(@ScriptDir & $logname,"Gotopos")
GoToPos()
Case 4
ControlSetText($App_Title, "", $DebugID, "4-Dubblecheck")
_FileWriteLog(@ScriptDir & $logname,"dualchecl")
Dubblecheck()
Case 5
ControlSetText($App_Title, "", $DebugID, "5-runbot")
_FileWriteLog(@ScriptDir & $logname,"runbot")
runbot()
EndSwitch
Return
Endfunc ;==>Cmdtable
;;================================================ ================================
;;GetCurrentData;
;;================================================ ================================
Func GetCurrentData() ;Read data from memory
if $CurrentCheck = 1 Then
MemoryLoop()
EndIf
if $dubblecheckPos = 1 Then
$cmdtabel = 4;Next step = 4 Dubblecheck()
Return
Else
$cmdtabel = 1 ;Next step = EvenCalculation()
Return
EndIf
EndFunc ;==>GetCurrentData
;;================================================ ================================
;;EvenCalculation;
;;================================================ ================================
Func EventCalculation();With the info from GetCurrentData calculate what to do
if $deathNY = 0 Then
if $alive = 1 Then
$alive = 0
$corpselocX = $CurrentLocX
$corpselocY = $CurrentLocY
EndIf
EndIf
if $running = "1" Then
if $CurrentLocX = $toposX Then
if $CurrentLocY = $toposY Then
$running = "0"
$checkagain = 0
$dubblecheckPos = 0
$cmdtable = 5
$rot_perfect = 0
Return ;Next step = GetCurrentData()
EndIf
EndIf
;$cmdtable = 5
;$rot_perfect = 0
;Return ;Next step = GetCurrentData()
EndIf
if $pasedborder = 1 Then
$running = "0"
$checkagain = 0
$dubblecheckPos = 0
$cmdtable = 5
$rot_perfect = 0
Return ;Next step = GetCurrentData()
EndIf
if $taskset = 1 Then
_FileWriteLog(@ScriptDir & $logname,"Data recived from game; Rotation=" & $CurrentRot & ". PositionX=" & $CurrentLocX & ". PositionY=" & $CurrentLocY & "." )
$cmdtabel = 2 ;Next step = CheckRotation()
Return
EndIf
if $rot_perfect = 1 Then
$cmdtabel = 3 ;Next step = GoToPos()
Return
EndIf
$cmdtabel = 0 ;Next step = GetCurrentData()
return
EndFunc ;==>EventCalculation
;;================================================ ================================
;;CheckRotation
;;================================================ ================================
Func CheckRotation()
if $debug = 1 then
send("{Enter}")
sleep(200)
Clipput("Current = " & $CurrentRot & " result= " & $result)
Send("^v")
sleep(200)
send("{Enter}")
EndIf
$jtstart = "0"
$jumptimerwalk = "0"
$lastX = "0"
$lastY = "0"
$windowsize = WinGetPos($WowProcessName)
MouseMove((($windowsize[2]/2)+$windowsize[0]),(($windowsize[3]/2)+$windowsize[1]), 0)
while $taskset = 1
MemoryLoop()
Rotationfix()
$Rot_Smallest = _Min($CurrentRot, $result)
$Rot_Biggest = _Max($CurrentRot, $result)
if $CurrentRot = $Rot_Biggest Then
If ($CurrentRot - $result) < 190 Then
$down = 1
if ($CurrentRot - $result) < 50 Then
$rot_fast = 0
if ($CurrentRot - $result) < 9 Then
$rot_fast = 2
EndIf
else
$rot_fast = 1
EndIf
Else
$down = 0
if (($result + 360) - $CurrentRot) < 50 Then
$rot_fast = 0
if (($result + 360) - $CurrentRot) < 9 Then
$rot_fast = 2
EndIf
else
$rot_fast = 1
EndIf
EndIf
Else
If ($result - $CurrentRot) < 190 Then
$down = 0
if ($result - $CurrentRot) < 50 Then
$rot_fast = 0
if ($result - $CurrentRot) < 9 Then
$rot_fast = 2
EndIf
else
$rot_fast = 1
EndIf
else
$down = 1
if (($CurrentRot + 360) - $result) < 50 Then
$rot_fast = 0
if (($CurrentRot + 360) - $result) < 9 Then
$rot_fast = 2
EndIf
else
$rot_fast = 1
EndIf
EndIf
EndIf
if $CurrentLocX = $toposX Then
if $CurrentLocY = $toposY Then
$cmdtabel = 5 ;Next step = GetCurrentData()
$rot_perfect = 1
$taskset = 0
Return ;Next step = GetCurrentData()
EndIf
EndIf
MouseDown("right")
if $rot_fast = 1 Then
if $down = 0 Then
;MouseDown("right")
_MouseMovePlus(-20,0)
Sleep(10)
Else
;MouseDown("right")
_MouseMovePlus(20,0)
Sleep(10)
EndIf
EndIf
if $rot_fast = 0 Then
if $down = 0 Then
MouseDown("right")
_MouseMovePlus(-10,0)
Sleep(10)
;sleep(200)
Else
;MouseDown("right")
_MouseMovePlus(10,0)
Sleep(10)
EndIf
EndIf
if $rot_fast = 2 Then
if $down = 0 Then
;MouseDown("right")
_MouseMovePlus(-2,0)
Sleep(10)
;sleep(200)
Else
;MouseDown("right")
_MouseMovePlus(2,0)
Sleep(10)
EndIf
EndIf
;Update Rotation Data
MemoryLoop()
Rotationfix()
if floor($CurrentRot) = floor($result) Then
MouseUp("right")
$taskset = 0
sleep(200)
EndIf
wend
_FileWriteLog(@ScriptDir & $logname,"Rotation Complete; CurrentRotation=" & $CurrentRot & ". FinalRotation=" & $result & "." )
MouseUp("right")
$cmdtabel = 0 ;Next step = GetCurrentData()
$rot_perfect = 1
$taskset = 0
return
EndFunc ;==>CheckRotation
;;================================================ ================================
;;GoToPos
;;================================================ ================================
Func GoToPos()
; [Find The Coordinate Place]
If $toposX <= $Xstart Then
$XCurBigger = 1
Else
$XCurBigger = 0
EndIf
If $toposY <= $Ystart Then
$YCurBigger = 1
Else
$YCurBigger = 0
EndIf
$distance = _max(($CurrentLocX+$CurrentLocy),($toposX+$toposY) ) - _min(($CurrentLocX+$CurrentLocy),($toposX+$toposY) )
; [/Find The Coordinate Place]
send ("{w down}")
while $rot_perfect = 1
;For Jump Timer
$lastX = $CurrentLocX
$lastY = $CurrentLocY
; [Gather Position Data From WoW]
MemoryLoop()
;[Tjek Data]
;Jump Timer (if the player stays too long at the same location it will start jumping, and short after return to previous waypoint.)
If $lastX = $CurrentLocX Then
If $lastY = $CurrentLocY Then
if $jtstart = 0 Then
$jumptimerwalk = TimerInit()
$jtstart = 1
EndIf
$jtdif = TimerDiff($jumptimerwalk)
ControlSetText($App_Title, "", $RotationID, "TimerLoc:" & $lastX &","&$lastY & " t:" & floor($jtdif) )
If $jtdif > $TimeBeforeReverse Then ;For Going Back One Step in the Waypoint Section
if $deathNY = 0 Then
if $alive = 1 Then
$alive = 0
$corpselocX = $CurrentLocX
$corpselocY = $CurrentLocY
EndIf
EndIf
_FileWriteLog(@ScriptDir & $logname,"Could not reach the desired destination; waypoint: " & $array_x_number & ", retrying from last waypoint. RP=" & $jtdif)
$array_x_number = $array_x_number - 1
$cmdtabel = 5 ;Next step = Save_f()
$jtstart = 0
;send ("{w down}")
send ("{w}")
Return
EndIf
if $jtdif > $TimeBeforeJump Then ;For Basic Jump after X Secounds
_FileWriteLog(@ScriptDir & $logname,"Suspected stuck trying to reach; waypoint: " & $array_x_number & ", attempting jump procedure. RP=" & $jtdif)
send ("{w up}")
sleep(20)
send("{space}")
sleep(100)
send ("{w down}")
EndIf
Else
$jumptimerwalk = 0
$jtstart = 0
$jtdif = 0
EndIf
Else
$jumptimerwalk = 0
$jtstart = 0
$jtdif = 0
EndIf
;[Tjek Data]
if _max(($CurrentLocX+$CurrentLocy),($toposX+$toposY) ) - _min(($CurrentLocX+$CurrentLocy),($toposX+$toposY) ) > $distance Then
$cmdtabel = 0 ;Next step = Save_test()
send ("{w}")
$dubblecheckPos = 1
$cmdtable = 0
$rot_perfect = 0
$pasedborder = 1
Return
EndIf
if $XCurBigger = 0 Then
If $CurrentLocX >= $toposX Then
;send ("{w down}")
$dubblecheckPos = 1
$cmdtable = 0
$rot_perfect = 0
$pasedborder = 1
Return ;Next step = GetCurrentData()
EndIf
EndIf
If $XCurBigger = 1 Then
if $CurrentLocX <= $toposX Then
if $YCurBigger = 1 Then
if $CurrentLocY <= $toposY Then
;send ("{w down}")
$dubblecheckPos = 1
$cmdtable = 0
$rot_perfect = 0
$pasedborder = 1
Return ;Next step = GetCurrentData()
EndIf
EndIf
If $YCurBigger = 0 Then
if $CurrentLocY >= $toposY Then
;send ("{w down}")
$dubblecheckPos = 1
$cmdtable = 0
$rot_perfect = 0
$pasedborder = 1
Return ;Next step = GetCurrentData()
EndIf
EndIf
EndIf
EndIf
If $YCurBigger = 0 Then
if $CurrentLocY >= $toposY Then
;send ("{w down}")
$dubblecheckPos = 1
$cmdtable = 0
$rot_perfect = 0
$pasedborder = 1
Return ;Next step = GetCurrentData()
EndIf
EndIf
if $YCurBigger = 1 Then
if $CurrentLocY <= $toposY Then
if $XCurBigger = 0 Then
If $CurrentLocX >= $toposX Then
;send ("{w down}")
$dubblecheckPos = 1
$cmdtable = 0
$rot_perfect = 0
$pasedborder = 1
Return ;Next step = GetCurrentData()
EndIf
EndIf
If $XCurBigger = 1 Then
if $CurrentLocX <= $toposX Then
;send ("{w down}")
$dubblecheckPos = 1
$cmdtable = 0
$rot_perfect = 0
$pasedborder = 1
Return ;Next step = GetCurrentData()
EndIf
EndIf
EndIf
EndIf
ControlSetText($App_Title, "", $DebugID, "3-GoToPos:" & $toposX &","&$toposy)
WEnd
if $debug = 1 then
send("{Enter}")
sleep(200)
Clipput("Error")
Send("^v")
sleep(200)
send("{Enter}")
EndIf
;send ("{w up}")
$cmdtabel = 0 ;Next step = GetCurrentData()
return
EndFunc ;==>GoToPos
;;================================================ ================================
;;Dubblecheck()
;;================================================ ================================
Func Dubblecheck()
if $CurrentLocX <= ($toposX+6) And $CurrentLocX >= ($toposX-6) Then
if $CurrentLocY <= ($toposY+6) And $CurrentLocY >= ($toposY-6) Then
$dubblecheckPos = 0
$taskset = 0
$rot_perfect = 0
$cmdtabel = 0
;send("{´}")
$slow = 0
if ($ARRAY[4][($ARRAYY-$arraynumber)+0]) = $arraynumber Then
$checkagain = 1
msgbox(0,"error","error")
Return
Else
$cmdtabel = 5
$checkagain = 0
_FileWriteLog(@ScriptDir & $logname,"Succes Reaching waypoint: " & $array_x_number & " check" & $CurrentLocX & "=" & $toposX & " . " & $CurrentLocY & "=" & $toposY)
if $deathNY = 0 Then
if $releasecorpse = 1 Then
sleep(1)
$alive = 1
EndIf
EndIf
Return
EndIf
EndIf
EndIf
$checkagain = 1
$dubblecheckPos = 0
$cmdtabel = 5 ;Next step = EvenCalculation()
send ("{w up}")
Return
EndFunc ;==>Dubblecheck
;;================================================ ================================
;;Runbot;
;;================================================ ================================
func RunBot()
;msgbox(0,"LOL",$toposX & " " & $toposY & " <- " & $CurrentLocX & " " & $CurrentLocY)
$running = "1"
if $checkagain = 0 Then
;;For repeat (if the current number goes beyond the last array it will set to 1)
if $deathNY = 1 Then
if ($array_x_number) = ($ARRAYY) Then
$array_x_number = 0
Return
EndIf
EndIf
$array_x_number = $array_x_number + 1
EndIf
if $deathNY = 0 Then
if ($array_x_number) = ($ARRAYY) Then
sleep(1)
if $deathNY = 1 Then
$alive = 1
$array_x_number = 0
Else
$posx2 = $CurrentLocX
$posy2 = (($CurrentLocY/"100")*$RatioConvertion )
$toposX = $corpselocX
$toposY = $corpselocY
$posx1 = $corpselocX
$posy1 = (($corpselocY/"100")*$RatioConvertion )
$releasecorpse = 1
$radToDeg = -180 / $pi
$result = atan(($posy1-$posy2)/($posx2-$posx1)) * $radToDeg
if $posx2 < $posx1 Then
if $result < 0 Then
$result = 270 + $result
Else
$result = 270 + $result
EndIf
EndIf
if $posx2 >= $posx1 Then
if $result < 0 Then
$result = 90 + $result
Else
$result = 90 + $result
EndIf
EndIf
$result = $result-360
$result = floor(($result - $result) - $result)
if $result = "360" Then $result = 0
$cmdtabel = 0
$taskset = 1
$pasedborder = 0
$cmdtable = 1
EndIf
send("{F1}")
Return ;Next step = GetCurrentData()
EndIf
EndIf
;; If the Current number is 0 it will go to the last waypoint to make it backwoards compatible.
if $array_x_number = 0 Then
$array_x_number = $ARRAYY
EndIf
_FileWriteLog(@ScriptDir & $logname,"Processing Destination Waypoint; " & $array_x_number & "." )
if $debug = 1 then
send("{Enter}")
sleep(200)
Clipput("1 = " & $array_x_number)
sleep(20)
Send("^v")
sleep(200)
send("{Enter}")
EndIf
if $deathNY = 1 Then
$szXPath1 = "//DATAPACKET/METADATA/FIELDS"
$szXPath2 = "//DATAPACKET/ROWDATA"
Else
$szXPath1 = "//DATAPACKET/METADATA/FIELDS"
$szXPath2 = "//DATAPACKET/ROWGHOST"
Secureghost()
;$array_x_number = 0
EndIf
;; If the Current number is 0 it will go to the last waypoint to make it backwoards compatible.
;if $array_x_number = 0 Then
; $array_x_number = $ARRAYY
; EndIf
ReDim $ARRAY[$ARRAYX][$ARRAYY+1]
;TrayTip("Position Manager", $ARRAYY & " Nodes Loaded...", 5, 1)
$aNodeName1 = _XMLGetChildNodes ($szXPath1)
$aNodeName2 = _XMLGetChildNodes ($szXPath2)
If $aNodeName1 <> -1 Then
;LOOP THROUGH //DATAPACKET/METADATA/FIELDS
For $find = 1 To $aNodeName1[0]
_XMLGetAllAttrib($szXPath1 & "/*" & '[' & $find & ']',$aAttrName1,$aAttrVal1)
;ADD TO ARRAY
$ARRAY[$find-1][0] = $aAttrVal1[0]
;LOOP THROUGH //DATAPACKET/ROWDATA
For $X=1 To $aNodeName2[0]
_XMLGetAllAttrib($szXPath2 & "/*" & '[' & $X & ']',$aAttrName2,$aAttrVal2)
;ONLY APPEND IF CURRENT FIELD NIMBER IS LESS THAN NUMBER OF ATTRIBS FOUND IN EACH ROW
If $find <= Ubound($aAttrName2) Then
;msgbox(0,"hej",$find & " X= " & $X & " att " &$aNodeName2[0] & " AN= " & $aNodeName1[0] & " " & $aAttrVal2[$find-1])
Secureghost()
$ARRAY[$find-1][$X] = $aAttrVal2[$find-1]
EndIf
Next
Next
Else
MsgBox(0, "Error:", "No nodes found for " & $szXPath1)
EndIf
;if $array_x_number = ($ARRAYY+1) Then
; $array_x_number = $array_x_number - 1
; EndIf
$posx2 = $CurrentLocX
$posy2 = (($CurrentLocY/"100")*$RatioConvertion )
$posx1 = $ARRAY[3][$array_x_number]
$posy1 = ((($ARRAY[4][$array_x_number])/"100")*$RatioConvertion )
$toposX = $ARRAY[3][$array_x_number]
$toposY = $ARRAY[4][$array_x_number]
$checkagain = 1
;if $deathNY = 0 Then
; if ($array_x_number+1) = ($ARRAYY) Then
; $toposX = $corpselocX
; $toposY = $corpselocY
; $posx1 = $corpselocX
; $posy1 = (($corpselocY/"100")*$RatioConvertion )
; $releasecorpse = 1
; msgbox(0,"test",$corpselocX & " " & $corpselocY)
; EndIf
;EndIf
;msgbox(0,"hej","$posx1=" & $posx1 & " " & "$posy1=" & $posy1 & " " & "$posx2=" &$posx2 & " " & "$posy2=" & $posy2 & " " & "$toposX=" &$toposX & " " & "$toposY=" & $toposY)
_FileWriteLog(@ScriptDir & $logname,"Data From XML - " & $array_x_number & ". Destination pos: " & $toposX & "." & $toposY)
if $debug = 1 then
send("{Enter}")
sleep(200)
Clipput("1 = " & $ARRAY[3][1] & " 2 = " & $ARRAY[4][1] & " 3 =" & $array_x_number)
sleep(20)
Send("^v")
sleep(200)
send("{Enter}")
EndIf
$radToDeg = -180 / $pi
$result = atan(($posy1-$posy2)/($posx2-$posx1)) * $radToDeg
if $posx2 < $posx1 Then
if $result < 0 Then
$result = 270 + $result
Else
$result = 270 + $result
EndIf
EndIf
if $posx2 >= $posx1 Then
if $result < 0 Then
$result = 90 + $result
Else
$result = 90 + $result
EndIf
EndIf
$result = $result-360
$result = floor(($result - $result) - $result)
if $result = "360" Then $result = 0
$cmdtabel = 0
$taskset = 1
if $debug = 1 then
send("{Enter}")
sleep(200)
Clipput("Current position = " & $CurrentLocX & "," & $CurrentLocY & " End Position = " & $toposX & "," & $toposY & " rotation calculated = " & $result)
sleep(20)
Send("^v")
sleep(200)
send("{Enter}")
EndIf
$pasedborder = 0
$cmdtable = 1
Return ;Next step = GetCurrentData()
EndFunc ;==>Runbot;
;;================================================ ================================
;;Runbot1;
;;================================================ ================================
func RunTheBot()
if $test_pause = 0 Then
$oXSD = _XMLFileOpen ($xmlFile, "")
;If @error Or $oXSD < 1 Then
; MsgBox(0, "Error", "There was an error opening the file " & $xmlFile)
; $oXSD = 0
; _FileWriteLog(@ScriptDir & $logname,"Error Opning XMLFile - Ending Session")
; _FileWriteLog(@ScriptDir & $logname,":::End Of Session:::")
; Exit
;EndIf
if $deathny = 1 Then
$szXPath1 = "//DATAPACKET/METADATA/FIELDS"
$szXPath2 = "//DATAPACKET/ROWDATA"
Else
$szXPath1 = "//DATAPACKET/METADATA/FIELDS"
$szXPath2 = "//DATAPACKET/ROWGHOST"
$array_x_number = 0
EndIf
$ARRAYX = _XMLGetNodeCount($szXPath1 & "/*")
$ARRAYY = _XMLGetNodeCount($szXPath2 & "/*")
$additional = $ARRAYY
;ReDim $ARRAY[$ARRAYX][$ARRAYY+1]
if $ARRAYY < 0 Then $ARRAYY = 0
TrayTip("Position Manager", $ARRAYY & " Nodes Loaded...", 5, 1)
$aNodeName1 = _XMLGetChildNodes ($szXPath1)
$aNodeName2 = _XMLGetChildNodes ($szXPath2)
If $aNodeName1 <> -1 Then
;LOOP THROUGH //DATAPACKET/METADATA/FIELDS
For $find = 1 To $aNodeName1[0]
_XMLGetAllAttrib($szXPath1 & "/*" & '[' & $find & ']',$aAttrName1,$aAttrVal1)
;ADD TO ARRAY
;$ARRAY[$find-1][0] = $aAttrVal1[0]
;LOOP THROUGH //DATAPACKET/ROWDATA
;For $X=1 To $aNodeName2[0]
; _XMLGetAllAttrib($szXPath2 & "/*" & '[' & $X & ']',$aAttrName2,$aAttrVal2)
; ;ONLY APPEND IF CURRENT FIELD NIMBER IS LESS THAN NUMBER OF ATTRIBS FOUND IN EACH ROW
; If $find <= Ubound($aAttrName2) Then
; $ARRAY[$find-1][$X] = $aAttrVal2[$find-1]
; EndIf
;Next
Next
Else
MsgBox(0, "Error:", "No nodes found for " & $szXPath1)
EndIf
;$arraynumber = ($ARRAY[2][$ARRAYY])
$array_x_number = 0;$arraynumber
$oXSD = 0
EndIf
RunBot()
EndFunc
;;================================================ ================================
;;Secure Ghost
;;================================================ ================================
func Secureghost()
if $test_pause = 0 Then
$oXSD = _XMLFileOpen ($xmlFile, "")
;If @error Or $oXSD < 1 Then
; MsgBox(0, "Error", "There was an error opening the file " & $xmlFile)
; $oXSD = 0
; _FileWriteLog(@ScriptDir & $logname,"Error Opning XMLFile - Ending Session")
; _FileWriteLog(@ScriptDir & $logname,":::End Of Session:::")
; Exit
;EndIf
if $deathny = 1 Then
$szXPath1 = "//DATAPACKET/METADATA/FIELDS"
$szXPath2 = "//DATAPACKET/ROWDATA"
Else
$szXPath1 = "//DATAPACKET/METADATA/FIELDS"
$szXPath2 = "//DATAPACKET/ROWGHOST"
EndIf
$ARRAYX = _XMLGetNodeCount($szXPath1 & "/*")
$ARRAYY = _XMLGetNodeCount($szXPath2 & "/*")
$additional = $ARRAYY
;ReDim $ARRAY[$ARRAYX][$ARRAYY+1]
if $ARRAYY < 0 Then $ARRAYY = 0
TrayTip("Position Manager", $ARRAYY & " Nodes Loaded...", 5, 1)
$aNodeName1 = _XMLGetChildNodes ($szXPath1)
$aNodeName2 = _XMLGetChildNodes ($szXPath2)
If $aNodeName1 <> -1 Then
;LOOP THROUGH //DATAPACKET/METADATA/FIELDS
For $find = 1 To $aNodeName1[0]
_XMLGetAllAttrib($szXPath1 & "/*" & '[' & $find & ']',$aAttrName1,$aAttrVal1)
;ADD TO ARRAY
;$ARRAY[$find-1][0] = $aAttrVal1[0]
;LOOP THROUGH //DATAPACKET/ROWDATA
;For $X=1 To $aNodeName2[0]
; _XMLGetAllAttrib($szXPath2 & "/*" & '[' & $X & ']',$aAttrName2,$aAttrVal2)
; ;ONLY APPEND IF CURRENT FIELD NIMBER IS LESS THAN NUMBER OF ATTRIBS FOUND IN EACH ROW
; If $find <= Ubound($aAttrName2) Then
; $ARRAY[$find-1][$X] = $aAttrVal2[$find-1]
; EndIf
;Next
Next
Else
MsgBox(0, "Error:", "No nodes found for " & $szXPath1)
EndIf
;$arraynumber = ($ARRAY[2][$ARRAYY])
$oXSD = 0
EndIf
Return
EndFunc
;;================================================ ================================
;;MemoryLoop;
;;================================================ ================================
func MemoryLoop()
;Check if memory is accesible
Local $DllInformation = _MemoryOpen($ProcessID)
If @Error Then
MsgBox(4096, "ERROR", "Failed to open memory.")
Exit
EndIf
$CurrentCharname = _MemoryRead(0x00BD97B0, $DllInformation, 'char[11]')
If @Error Then
MsgBox(4096, "ERROR", "Failed to read memory.")
Exit
EndIf
$CurrentLocX = floor(_MemoryRead(0x00BB6E94, $DllInformation, 'float'))
If @Error Then
MsgBox(4096, "ERROR", "Failed to read memory.")
Exit
EndIf
$CurrentLocY = floor(_MemoryRead(0x00BB6E90, $DllInformation, 'float'))
If @Error Then
MsgBox(4096, "ERROR", "Failed to read memory.")
Exit
EndIf
$CurrentRot = _MemoryRead(0x00C435C8, $DllInformation, 'float');0x00CD901C(richtig glaube)
If @Error Then
MsgBox(4096, "ERROR", "Failed to read memory.")
Exit
EndIf
$continentID = _MemoryRead(0x00B77044, $DllInformation, 'dword');007CF3D4w
If @Error Then
MsgBox(4096, "ERROR", "Failed to read memory.")
Exit
EndIf
$deathNY = _MemoryRead(0x00C58FD0, $DllInformation, 'dword')
If @Error Then
MsgBox(4096, "ERROR", "Failed to read memory.")
Exit
EndIf
_MemoryClose($DllInformation)
;Final Calculations
$Xstart = $CurrentLocX
$Ystart = $CurrentLocY
$CurrentRot = floor(($CurrentRot / (3.14159265358979/180)))
;Update GUI
ControlSetText($App_Title, "", $FinalCharname, $CurrentCharname)
ControlSetText($App_Title, "", $Finalrot, $CurrentRot)
ControlSetText($App_Title, "", $FinallocX, $CurrentLocX)
ControlSetText($App_Title, "", $Finallocy, $CurrentLocY)
ControlSetText($App_Title, "", $Finalrandom, $continentID)
EndFunc ;==>MemoryLoop
;;================================================ ================================
;;Rotationfix
;;================================================ ================================
func Rotationfix()
$posx2 = $CurrentLocX
$posy2 = (($CurrentLocY/"100")*$RatioConvertion )
$posx1 = $ARRAY[3][$array_x_number]
$posy1 = ((($ARRAY[4][$array_x_number])/"100")*$RatioConvertion )
$toposX = $ARRAY[3][$array_x_number]
$toposY = $ARRAY[4][$array_x_number]
$radToDeg = -180 / $pi
$result = atan(($posy1-$posy2)/($posx2-$posx1)) * $radToDeg
if $posx2 < $posx1 Then
if $result < 0 Then
$result = 270 + $result
Else
$result = 270 + $result
EndIf
EndIf
if $posx2 >= $posx1 Then
if $result < 0 Then
$result = 90 + $result
Else
$result = 90 + $result
EndIf
EndIf
$result = $result-360
$result = floor(($result - $result) - $result)
if $result = "360" Then $result = 0
EndFunc
;;================================================ ================================
;;Select XML;
;;================================================ ================================
func SelectOpenXML()
$xmlFile = FileOpenDialog("Open XML", @ScriptDir, "XML (*.XML)", 1)
If @error Then
MsgBox(4096, "Thermo Prime - File Open", "No file chosen, you must select a profile to be able to run the bot!")
Else
_FileWriteLog(@ScriptDir & $logname,"XML File Selected; " & $xmlFile)
if $test_pause = 0 Then
$oXSD = _XMLFileOpen ($xmlFile, "")
;If @error Or $oXSD < 1 Then
; MsgBox(0, "Error", "There was an error opening the file " & $xmlFile)
; $oXSD = 0
; _FileWriteLog(@ScriptDir & $logname,"Error Opning XMLFile - Ending Session")
; _FileWriteLog(@ScriptDir & $logname,":::End Of Session:::")
; Exit
;EndIf
$szXPath1 = "//DATAPACKET/METADATA/FIELDS"
$szXPath2 = "//DATAPACKET/ROWDATA"
$ARRAYX = _XMLGetNodeCount($szXPath1 & "/*")
$ARRAYY = _XMLGetNodeCount($szXPath2 & "/*")
$additional = $ARRAYY
;ReDim $ARRAY[$ARRAYX][$ARRAYY+1]
if $ARRAYY < 0 Then $ARRAYY = 0
TrayTip("Position Manager", $ARRAYY & " Nodes Loaded...", 5, 1)
$aNodeName1 = _XMLGetChildNodes ($szXPath1)
$aNodeName2 = _XMLGetChildNodes ($szXPath2)
If $aNodeName1 <> -1 Then
;LOOP THROUGH //DATAPACKET/METADATA/FIELDS
For $find = 1 To $aNodeName1[0]
_XMLGetAllAttrib($szXPath1 & "/*" & '[' & $find & ']',$aAttrName1,$aAttrVal1)
;ADD TO ARRAY
;$ARRAY[$find-1][0] = $aAttrVal1[0]
;LOOP THROUGH //DATAPACKET/ROWDATA
;For $X=1 To $aNodeName2[0]
; _XMLGetAllAttrib($szXPath2 & "/*" & '[' & $X & ']',$aAttrName2,$aAttrVal2)
; ;ONLY APPEND IF CURRENT FIELD NIMBER IS LESS THAN NUMBER OF ATTRIBS FOUND IN EACH ROW
; If $find <= Ubound($aAttrName2) Then
; $ARRAY[$find-1][$X] = $aAttrVal2[$find-1]
; EndIf
;Next
Next
Else
MsgBox(0, "Error:", "No nodes found for " & $szXPath1)
EndIf
;$arraynumber = ($ARRAY[2][$ARRAYY])
$array_x_number = 0;$arraynumber
$oXSD = 0
EndIf
Return
EndIf
Return
Endfunc ;==>SelectOpenXML
;;================================================ ================================
;;Create New XML;
;;================================================ ================================
func NewProfile()
$newprfname = InputBox("Auto-Travel - New Profile", "Enter Profile Name.", "", "", 20,20)
If @error Then
MsgBox(4096, "Auto-Travel - New Profile", "No Profile Created")
Else
$newprfname = ($newprfname & ".xml")
If FileExists ($newprfname) Then
$answer1 = msgbox(4,"Auto-Travel - New Profile","A profile with that name; " & $newprfname & " does allready exists. Do you want to overwrite this file?")
if $answer1 = 6 Then
FileDelete ($newprfname)
Else
Return
EndIf
EndIf
_FileCreate($newprfname)
$file = FileOpen($newprfname, 1)
FileWriteLine($newprfname, "<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>")
FileWriteLine($newprfname, "<DATAPACKET Version=""2.0"">")
FileWriteLine($newprfname, " <METADATA>")
FileWriteLine($newprfname, " <FIELDS>")
FileWriteLine($newprfname, " <FIELD attrname=""Continent"" fieldtype=""i4""/>")
FileWriteLine($newprfname, " <FIELD attrname=""Zone"" fieldtype=""i4""/>")
FileWriteLine($newprfname, " <FIELD attrname=""Nr"" fieldtype=""i4""/>")
FileWriteLine($newprfname, " <FIELD attrname=""posX"" fieldtype=""i4""/>")
FileWriteLine($newprfname, " <FIELD attrname=""posY"" fieldtype=""i4""/>")
FileWriteLine($newprfname, " <FIELD attrname=""Comment"" fieldtype=""string"" WIDTH=""20""/>")
FileWriteLine($newprfname, " </FIELDS>")
FileWriteLine($newprfname, " <PARAMS/>")
FileWriteLine($newprfname, " </METADATA>")
FileWriteLine($newprfname, " <ROWDATA>")
FileWriteLine($newprfname, " </ROWDATA>")
FileWriteLine($newprfname, " <ROWGHOST>")
FileWriteLine($newprfname, " </ROWGHOST>")
FileWriteLine($newprfname, "</DATAPACKET>")
FileClose($newprfname)
Exit
Return
EndIf
EndFunc ;==>NewProfile
;;================================================ ================================
;;SaveDestinationGhost;
;;================================================ ================================
Func SaveDestination_Ghost()
if $test_pause = 0 Then
$toposX = $CurrentLocX
$toposY = $CurrentLocY
$oXSD = _XMLFileOpen ($xmlFile, "")
If @error Or $oXSD < 1 Then
MsgBox(0, "Error", "There was an error opening the file " & $xmlFile)
$oXSD = 0
_FileWriteLog(@ScriptDir & $logname,"Error Opening XMLFile- Ending Session")
_FileWriteLog(@ScriptDir & $logname,":::End Of Session:::")
Exit
EndIf
$szXPath1 = "//DATAPACKET/METADATA/FIELDS"
$szXPath2 = "//DATAPACKET/ROWGHOST"
$ARRAYX = _XMLGetNodeCount($szXPath1 & "/*")
$ARRAYY = _XMLGetNodeCount($szXPath2 & "/*")
if $ARRAYY = -1 then
$ARRAYY = 0
EndIf
$additional = $ARRAYY
ReDim $ARRAY[$ARRAYX][$ARRAYY+1]
TrayTip("Position Manager", $ARRAYY & " Nodes Loaded...", 5, 1)
$aNodeName1 = _XMLGetChildNodes ($szXPath1)
$aNodeName2 = _XMLGetChildNodes ($szXPath2)
If $aNodeName1 <> -2 Then
;LOOP THROUGH //DATAPACKET/METADATA/FIELDS
For $find = 1 To $aNodeName1[0]
_XMLGetAllAttrib($szXPath1 & "/*" & '[' & $find & ']',$aAttrName1,$aAttrVal1)
;ADD TO ARRAY
$ARRAY[$find-1][0] = $aAttrVal1[0]
;LOOP THROUGH //DATAPACKET/ROWDATA
if $ARRAYY > 0 Then
For $X=1 To $aNodeName2[0]
_XMLGetAllAttrib($szXPath2 & "/*" & '[' & $X & ']',$aAttrName2,$aAttrVal2)
;ONLY APPEND IF CURRENT FIELD NIMBER IS LESS THAN NUMBER OF ATTRIBS FOUND IN EACH ROW
If $find <= Ubound($aAttrName2) Then
$ARRAY[$find-1][$X] = $aAttrVal2[$find-1]
EndIf
Next
EndIf
Next
Else
MsgBox(0, "Error:", "No nodes found for " & $szXPath1)
EndIf
$arraynumber = ($ARRAY[2][$ARRAYY])
$array_x_number = 0;$arraynumber
;MsgBox(0, "hej", $ARRAY[2][$ARRAYY]);[$additional])
$oXSD = 0
$currentZone=1
$numb = $ARRAY[2][$additional]
$CHILDVALUES = _ArrayCreate ($continentID,$currentZone,($numb+1),$toposX,$topo sY,"For Testing")
_XMLCreateChildWAttr("//DATAPACKET/ROWGHOST[1]", "ROWGHOST", $CHILDATTRIBS, $CHILDVALUES) ;by node index
if $debug = 1 then
send("{Enter}")
sleep(200)
Clipput("Waypoint - " & ($numb+1) & " pos: " & $toposX & "." & $toposY)
_FileWriteLog(@ScriptDir & $logname,"Waypoint - " & ($numb+1) & ". Saves pos: " & $toposX & "." & $toposY)
sleep(20)
Send("^v")
sleep(200)
send("{Enter}")
EndIf
EndIf
Return
EndFunc
;;================================================ ================================
;;MouseMovePlus (thx to Oxin8 for this code)
;;================================================ ================================
Func _MouseMovePlus($X, $Y,$absolute = 0)
Local $MOUSEEVENTF_MOVE = 1
Local $MOUSEEVENTF_ABSOLUTE = 32768
DllCall("user32.dll", "none", "mouse_event", _
"long", $MOUSEEVENTF_MOVE + ($absolute*$MOUSEEVENTF_ABSOLUTE), _
"long", $X, _
"long", $Y, _
"long", 0, _
"long", 0)
EndFunc
;;================================================ ================================
;;Terminate;
;;================================================ ================================
func terminate()
WinSetOnTop($App_Title, "", 0)
send ("{w}")
If $MouseDown = 1 Then
MouseUp("right")
EndIf
msgbox(1,"Info","Terminate")
_FileWriteLog(@ScriptDir & $logname,"User Termination - Ending Session")
_FileWriteLog(@ScriptDir & $logname,":::End Of Session:::")
exit 0
EndFunc ;==>Terminate