It needs midnight because i was too lazy to pointer scan myself.
Oh and the chest looted detection doesnt really work but i didn't care so you have to debug it yourself, nevertheless the script is working.
Requirements:
- AutoIt
- Midnight
HowTo:
- Install AutoIt + Scite
- Paste the code below in a new file with the extension ".au3"
- Open the File with the AutoIt Scite Script Editor
- Adjust the variables at the top (midnight username / password)
- Compile as x86 exe
- Put the .exe into your midnight folder
- When you are in the Winter JP map, run the .exe
- Stay AFK
Script:
Code:
#RequireAdmin
#include <MsgBoxConstants.au3>
HotKeySet("{ESC}", "Terminate")
Global $hwndGw2 = 0
Global $hwndMidnight = 0
Global $checkpoints[12][3]
;Change to your liking
Global $midnightUsername = "MIDNIGHTUSERNAME"
Global $midnightPassword = "MIDNIGHTPASSWORD"
Global $waitMsBetweenRuns = 50000
Global $waitLoading = 5000
Global $waitBetweenPorts = 500
Initialize()
BotLoop()
Func Initialize()
ToolTip("WinterJP Bot: Initializing. Press ESC to quit...",0,0)
$hwndGw2 = WinWait("[CLASS:ArenaNet_Dx_Window_Class]", "", 10)
If $hwndGw2 = 0 Then
MsgBox(0x0, "Error", "Guild Wars 2 is not started, start Guild Wars 2 first and then restart the bot!")
Exit 1
EndIf
ConsoleWrite("Closing all Midnight instances..." & @CRLF)
$procList = ProcessList("Midnight.exe")
For $i = 1 To $procList[0][0]
ProcessClose($procList[$i][1])
Next
$procListHb = ProcessList("hb.exe")
For $i = 1 To $procListHb[0][0]
ProcessClose($procListHb[$i][1])
Next
ConsoleWrite("Starting Midnight")
Local $midnightPid = Run("Midnight.exe", "", @SW_SHOWMINIMIZED)
If NOT $midnightPid = 0 Then
Sleep(3000)
$theWinlist = Winlist()
Local $try = 0
Do
For $i = 1 To $theWinlist[0][0]
If $theWinlist[$i][0] <> "" Then
$iPID2 = WinGetProcess($theWinlist[$i][1])
If $iPID2 = $midnightPid Then
$hwndMidnight = $theWinlist[$i][1]
ExitLoop
EndIf
EndIf
Next
Sleep(1000)
$try = $try + 1
Until $hwndMidnight <> 0 OR $try = 4
Else
MsgBox($MB_OK, "Error", "Midnight not found, please make sure this bot is in the same folder as Midnight!")
Exit(1)
EndIf
If NOT $hwndMidnight = 0 Then
ConsoleWrite("Midnight is running, loging in...")
ControlSetText($hwndMidnight, "", 6, $midnightUsername)
ControlSetText($hwndMidnight, "", 9, $midnightPassword)
ControlFocus($hwndMidnight, "", 11)
ControlClick($hwndMidnight, "", 11)
ControlFocus($hwndMidnight, "", 12)
ControlClick($hwndMidnight, "", 12)
; Refreshing handle...
Local $lastHwndMidnight = $hwndMidnight
$hwndMidnight = 0
Sleep(1000)
$theWinlist = Winlist()
$try = 0
Do
For $i = 1 To $theWinlist[0][0]
If $theWinlist[$i][0] <> "" Then
$iPID2 = WinGetProcess($theWinlist[$i][1])
If $iPID2 = $midnightPid Then
$hwndMidnight = $theWinlist[$i][1]
ExitLoop
EndIf
EndIf
Next
Sleep(1000)
$try = $try + 1
Until $hwndMidnight <> 0 AND NOT $hwndMidnight = $lastHwndMidnight OR $try = 4
Local $found = 0
For $i = 0 To 4
Sleep(1000)
If NOT StringInStr(WinGetTitle($hwndMidnight), "Midnight 1.7") = 0 Then
$found = 1
EndIf
Next
If $found = 0 Then
MsgBox($MB_OK, "Error", "Midnight couldn't be correctly started, maybe an update? Make sure your entered the correct midnight login credentials and your toon is logged in and standing in the world!")
Exit(1)
EndIf
Else
MsgBox($MB_OK, "Error", "Midnight couldn't be started. Please debug me.")
Exit(1)
EndIf
$checkpoints[0][0] ="-36.71"
$checkpoints[0][1] = "67.21"
$checkpoints[0][2] = "39.96"
$checkpoints[1][0] = "-99.09"
$checkpoints[1][1] = "55.22"
$checkpoints[1][2] = "63.85"
$checkpoints[2][0] = "-100.41"
$checkpoints[2][1] = "49.63"
$checkpoints[2][2] = "77.04"
$checkpoints[3][0] = "-112.49"
$checkpoints[3][1] = "3.72"
$checkpoints[3][2] = "63.03"
$checkpoints[4][0] = "-127.41"
$checkpoints[4][1] = "-34.23"
$checkpoints[4][2] = "58.57"
$checkpoints[5][0] = "-148.08"
$checkpoints[5][1] = "-93.72"
$checkpoints[5][2] = "65.24"
$checkpoints[6][0] = "-158.48"
$checkpoints[6][1] = "-128.1"
$checkpoints[6][2] = "50.19"
$checkpoints[7][0] = "-190.65"
$checkpoints[7][1] = "-119.23"
$checkpoints[7][2] = "49.81"
$checkpoints[8][0] = "-202.22"
$checkpoints[8][1] = "-123.66"
$checkpoints[8][2] = "54.32"
$checkpoints[9][0] = "-215.82"
$checkpoints[9][1] = "-142.38"
$checkpoints[9][2] = "58.13"
$checkpoints[10][0] = "-214.56"
$checkpoints[10][1] = "-186.26"
$checkpoints[10][2] = "85"
$checkpoints[11][0] = "98.27"
$checkpoints[11][1] = "122.41"
$checkpoints[11][2] = "88.86"
If $waitMsBetweenRuns < 50000 Then
$waitMsBetweenRuns = 50000
EndIf
EndFunc
Func BotLoop()
While 1
ToolTip("WinterJP Bot: Running. Press ESC to quit...",0,0)
If $hwndGw2 = 0 OR $hwndMidnight = 0 Then
MsgBox($MB_OK, "Error", "Midnight or GW2 not running anymore. Please restart the bot.")
Exit(1)
EndIf
WinActivate($hwndGw2)
Send("1")
Sleep(500)
For $i = 0 To 10
TeleportTo($checkpoints[$i][0],$checkpoints[$i][1],$checkpoints[$i][2])
Sleep($waitBetweenPorts);
Next
Sleep($waitLoading - $waitBetweenPorts)
TeleportTo($checkpoints[11][0],$checkpoints[11][1],$checkpoints[11][2])
Sleep($waitBetweenPorts)
If NOT GetPosition() = "98.27 | 122.41 | 88.86" Then
Sleep(10000)
TeleportTo($checkpoints[11][0],$checkpoints[11][1],$checkpoints[11][2] - 50)
Else
WinActivate($hwndGw2)
Send("f")
Sleep(1000)
WinActivate($hwndGw2)
Send("f")
Sleep(1000)
WinActivate($hwndGw2)
Send("f")
Sleep(1000)
TeleportTo($checkpoints[11][0],$checkpoints[11][1],$checkpoints[11][2] - 50)
Sleep(3000)
For $i = 0 To 3
TeleportTo($checkpoints[$i][0],$checkpoints[$i][1],$checkpoints[$i][2])
Sleep($waitBetweenPorts)
Next
WaitForNext()
EndIf
WEnd
EndFunc
Func TeleportTo($x, $y, $z)
ControlSetText($hwndMidnight, "", 17, $x)
ControlSetText($hwndMidnight, "", 18, $y)
ControlSetText($hwndMidnight, "", 19, $z)
ControlFocus($hwndMidnight, "", 20)
ControlClick($hwndMidnight, "", 20)
EndFunc
Func GetPosition()
Local $ret = 0
If NOT $hwndMidnight = 0 Then
$txTitle = WinGetTitle($hwndMidnight)
$posStart = StringInStr($txTitle, "(")
$posEnd = StringInStr($txTitle, ")")
$posLength = $posEnd - $posStart
$ret = StringMid($txTitle, $posStart + 1, $posLength - 1)
EndIf
Return $ret
EndFunc
Func WaitForNext()
$cycles = Int($waitMsBetweenRuns / 1000)
For $i = 0 To $cycles - 1
ToolTip("WinterJP Bot: Performing AntiAFK - " & $cycles - $i & ". cycle. Press ESC to quit...",0,0)
WinActivate($hwndGw2)
Send("1");
Sleep(1000)
Next
EndFunc
Func Terminate()
Exit(0)
EndFunc
Enjoy...
Greetings,
Pathin






