Code:
#Persistent
Pids := Object()
global mode = 0
global X = 421
global Y = 328
global iniFile := A_ScriptDir . "/config.ini"
if (FileExist(iniFile)){
IniRead, X, %iniFile%, Global, X
IniRead, Y, %iniFile%, Global, Y
}
Process, Exist, TeamViewer.exe
If (ErrorLevel)
Msgbox, "Teamviewer is currenly running. This is a known program to cause issues with the bot. Please close it or disable quick connect feature. If issues still happen try to uninstall it."
Gui, Add, Text,, mpBattleArena v1.5`n`nKeys :`nNumpad1 to start/pause`nNumpad2 to change moving mode`nNumpad3 to update positions`nNumpad4 to exit`n`nActive accunts count :
Gui, Add, Text, vCount w200
Gui, Add, Text,, Moving mode :
Gui, Add, Text, vMode w200
Gui, Add, Text,, Positions :
Gui, Add, Text, vPos w200
Gui -Resize -MinimizeBox
Gui, Show,,mpBattleArena
SetTimer, SendControls, 750
SetTimer, UpdateGui, 250
SetTimer, Click, 30000
return
numpad1::
WinGet, APID, PID, A
WinGetTitle, winTitle, ahk_pid %APID%
if (winTitle = "Trove"){
found = 0
for i, p in Pids
if (p=APID)
found=1
if (found!=1){
Pids.Insert(APID)
ToolTip, %APID% Now active
SetTimer, RemoveToolTip, 5000
}else{
newPids := Object()
for i, p in Pids
if (p!=APID)
newPids.Insert(p)
Pids := newPids
ToolTip, %APID% Now inactive
SetTimer, RemoveToolTip, 5000
}
}else{
Msgbox, %winTitle% is not a valid Trove window
}
return
numpad2::
mode := Mod(mode+1, 3)
if (mode = 0)
ToolTip, Unmoving mode activated
if (mode = 1)
ToolTip, ZQSD mode activated
if (mode = 2)
ToolTip, WASD mode activated
SetTimer, RemoveToolTip, 5000
return
numpad3::
MouseGetPos, theX, theY
MsgBox, 4,, Update positions to X : %theX%, Y = %theY% ?
IfMsgBox Yes
{
X = %theX%
Y = %theY%
SaveIni()
}
return
numpad4::
SaveIni()
ExitApp
SendControls:
for i, pid in Pids{
Random, r, 99, 999
Sleep, %r%
if (mode>0){
Random, r, 1, 5
if (r=1){
if (mode=1)
ControlSend, , {z down}, ahk_pid %PID%
else
ControlSend, , {w down}, ahk_pid %PID%
}else if (r=2){
if (mode=1)
ControlSend, , {q down}, ahk_pid %PID%
else
ControlSend, , {w down}, ahk_pid %PID%
}else if (r=3){
ControlSend, , {s down}, ahk_pid %PID%
}else if (r=4){
ControlSend, , {d down}, ahk_pid %PID%
}else if (r=5){
ControlSend, , {space}, ahk_pid %PID%
}
Random, r, 1, 6
if (r=1){
if (mode=1)
ControlSend, , {z up}, ahk_pid %PID%
else
ControlSend, , {w up}, ahk_pid %PID%
}else if (r=2){
if (mode=1)
ControlSend, , {q up}, ahk_pid %PID%
else
ControlSend, , {a up}, ahk_pid %PID%
}else if (r=3){
ControlSend, , {s up}, ahk_pid %PID%
}else if (r=4){
ControlSend, , {d up}, ahk_pid %PID%
}
Random, r, 1, 6
if (r=1){
ControlSend, , {F2 down}, ahk_pid %PID%
}else if (r=2){
ControlSend, , {F2 up}, ahk_pid %PID%
}else if (r=3){
ControlSend, , {F3 down}, ahk_pid %PID%
ControlSend, , {F3 up}, ahk_pid %PID%
}else if (r=4){
ControlSend, , {F4 down}, ahk_pid %PID%
ControlSend, , {F4 up}, ahk_pid %PID%
}else if (r=5){
ControlSend, , {F5 down}, ahk_pid %PID%
ControlSend, , {F5 up}, ahk_pid %PID%
}
}
}
return
Click:
MouseGetPos, theX, theY
WinGet, temp, PID, A
for i, pID in Pids{
WinActivate, ahk_pid %pID%
WinMove,ahk_pid %pID%,,0,0,576,432
WinWaitActive, ahk_pid %pID%
MouseMove, X, Y
ControlClick, x%X% y%Y%, ahk_pid %PID%
}
WinActivate, ahk_pid %temp%
MouseMove, theX, theY
return
UpdateGui:
clients := Pids.MaxIndex()
GuiControl,, Count, %clients%
GuiControl,, Pos, X=%X% Y=%Y%
if (mode=0)
GuiControl,, Mode, Unmoving
if (mode=1)
GuiControl,, Mode, ZQSD
if (mode=2)
GuiControl,, Mode, WASD
return
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
GuiClose:
SaveIni()
ExitApp
SaveIni(){
IniWrite, %X%, %iniFile%, Global, X
IniWrite, %Y%, %iniFile%, Global, Y
}