Code:
;This Script is made by Hack0r
;Visit Projecthax.com!
;
;
;Dont remove this Text!
;Feel free to edit it to make your own resolution work!
#include <GUIConstants.au3>
#include <Misc.au3>
Opt("PixelCoordMode", 0)
Opt("MouseCoordMode", 0)
Opt("WinTitleMatchMode",4)
if(not FileExists(@ScriptDir & "\ServerList.exe")) Then FileInstall("ServerList.exe",@ScriptDir & "\ServerList.exe")
Dim $login=False
Dim $username,$pw,$use_serverlist,$select,$select2,$server
Dim $gui_up=0
Const $ini_file = @ScriptDir & "\Co-Pilot.ini"
Const $ini_file2 = @ScriptDir & "\Coords.ini"
Func ReadIni()
$username = IniRead($ini_file, "Settings", "username", "")
$pw = IniRead($ini_file, "Settings", "pw", "")
$use_serverlist=IniRead($ini_file, "Settings", "useserverlist", 0)
$server=IniRead($ini_file, "Settings", "server", "")
EndFunc
Func WriteIni()
IniWrite($ini_file, "Settings", "useserverlist", $use_serverlist)
IniWrite($ini_file, "Settings", "server", $server)
IniWrite($ini_file, "Settings", "username", $username)
IniWrite($ini_file, "Settings", "pw", $pw)
EndFunc
Func ShowGUI()
If ($gui_up) Then
Return
EndIf
$gui_up = 1
Local $row_y=10
Local $gui_handle = GUICreate("Hack0rs Silkroad Autologin", 250, 250)
Local $cancel_button = GUICtrlCreateButton(" Cancel and run ", 130, 200, -1, -1, $BS_FLAT)
Local $save_button = GUICtrlCreateButton(" Save and run ", 30, 200, -1, -1, $BS_DEFPUSHBUTTON + $BS_FLAT)
Local $tmp=GUICtrlCreateLabel("Hack0rs Autologin", 10, $row_y,230,40,$SS_CENTER)
GUICtrlSetFont($tmp,18,600)
$row_y += 30
Local $tmp=GUICtrlCreateLabel("Please type in your Login-data", 10, $row_y,230,40,$SS_CENTER)
$row_y += 30
GUICtrlCreateLabel("Username:", 20, $row_y)
Local $username_tb = GUICtrlCreateInput($username, 120, $row_y - 5, 100, -1)
$row_y += 30
GUICtrlCreateLabel("Password:", 20, $row_y)
Local $pw_tb = GUICtrlCreateInput($pw, 120, $row_y - 5, 100, -1)
$row_y += 30
GUICtrlCreateLabel("Server:", 20, $row_y)
Local $server_tb = GUICtrlCreateInput($server, 120, $row_y - 5, 100, -1)
$row_y += 25
Local $server_list_cb = GUICtrlCreateCheckbox("Use Server list 4 Login", 20, $row_y)
Local $state = _Iif(1 = $use_serverlist, $GUI_CHECKED, $GUI_UNCHECKED)
GUICtrlSetState($server_list_cb, $state)
GUISetState(@SW_SHOW)
While (1)
$msg = GUIGetMsg()
Select
Case $msg = $save_button
$use_serverlist = _Iif($GUI_CHECKED = GUICtrlRead($server_list_cb), 1, 0)
$server = GUICtrlRead($server_tb)
$username = GUICtrlRead($username_tb)
$pw = GUICtrlRead($pw_tb)
WriteIni()
ExitLoop
Case $msg = $cancel_button
ExitLoop
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd
GUIDelete()
$gui_up = 0
EndFunc
Func login()
Local $code,$free,$item
If ($username <> "" And $pw <> "") Then
If (PixelgetColor(300, 50) = 0 And PixelgetColor(400, 10) = 0 AND (PixelgetColor(477,433) = 0 Or PixelgetColor(586,420) = 0)) Then
ToolTip("Login...", 0, 0)
if((PixelgetColor(664, 474) <> 0 Or PixelgetColor(300, 100)=0) And PixelgetColor(344, 483) <> 13480565) Then
Do
MouseClick("left", 544, 432, 1, 0)
Sleep(300)
Until (PixelgetColor(300, 100) <> 0)
MouseClick("left", 544, 432, 1, 0)
Sleep(100)
Send("{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
Send($username)
Sleep(200)
Send("{TAB}")
Sleep(100)
Send("{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}{BS}")
Send($pw)
Sleep(200)
Local $ct = 0
HotKeySet("{ENTER}")
While ($ct < 1000 And PixelgetColor(664, 474) <> 0 And PixelgetColor(344, 483) <> 13480565)
If (Mod($ct, 5) = 0) Then Send("{ENTER}")
Sleep(100)
If (Not WinExists("SRO_Client")) Then Exit
$ct += 1
WEnd
EndIf
WinActivate("SRO_Client")
MouseMove(596, 507, 0)
HotKeySet("{ENTER}", "ClickLogin")
if($use_serverlist=1) Then
ToolTip('Put in the Image Code and press CTRL+N!',300,0)
$select=False
$select2=False
While(not $select And not $select2)
Sleep(100)
WEnd
if($select) Then
if(WinExists('Sro Server List')) then WinClose('Sro Server List')
ToolTip('Opening Serverlist...',300,0)
Run(@ScriptDir & "\ServerList.exe","",@SW_HIDE)
Do
Sleep(100)
Until(WinExists('Sro Server List','Poll'))
ControlCommand('Sro Server List','','Poll','Check')
WinActivate("SRO_Client")
$select=False
while(not $select2 And WinExists("SRO_Client"))
$item=ControlListView("Sro Server List", "", "SysListView321", "FindItem", $server, 0)
$free=ControlListView("Sro Server List", "", "SysListView321", "GetText", $item,1)
if($free>1) Then
if(WinGetHandle("") <>WinGetHandle("SRO_Client")) Then WinActivate("SRO_Client")
Send("{ENTER}")
EndIf
ToolTip('Waiting for 2 Free Slots on Server... Free slots: '&$free&' Used:'&ControlListView("Sro Server List", "", "SysListView321", "GetText", $item,2)&'/'&ControlListView("Sro Server List", "", "SysListView321", "GetText", $item,3),0,0)
Sleep(100)
WEnd
EndIf
EndIf
$login = True
EndIf
EndIf
EndFunc;==>login
Func ClickLogin()
If (WinGetHandle("") = WinGetHandle("SRO_Client")) Then
MouseClick("left", 596, 507, 1, 0)
$select2=True
Else
HotKeySet("{ENTER}")
Send("{ENTER}")
HotKeySet("{ENTER}", "ClickLogin")
EndIf
EndFunc;==>ClickLogin
Func ExitBot()
Exit
EndFunc;==>ExitBot
HotKeySet("{F8}", "ShowGUI")
HotKeySet("{F10}", "ExitBot")
HotKeySet("!l", "login")
HotKeySet("^n", "myselect")
ReadIni()
Func mySelect()
$select = True
EndFunc;==>mySelect
while(true)
If (WinWaitActive("SRO_Client", "", 1) <> 1) Then
if(WinExists("SRO_Client")) Then
ToolTip("Silkroad window not active!",0,0)
else
ToolTip("Silkroad is not running!",0,0)
EndIf
ContinueLoop
EndIf
ToolTip("Silkroad window active!",0,0)
$client_resolution = WinGetClientSize("SRO_Client")
If (1 = @error) Then
ContinueLoop
EndIf
; Ignore the little popup window that comes up after you click the 'Start' button
; in the launcher.
If (400 = $client_resolution[0] And 148 = $client_resolution[1]) Then
Sleep(300)
ContinueLoop
EndIf
; Check SRO_client resolution
If ($client_resolution[0] <> 1024 Or $client_resolution[1] <> 768) Then
MsgBox(0, "Error: Unsupported resolution: " _
& $client_resolution[0] & "x" & $client_resolution[1], _
"Sorry, this bot only works with clients running at 1024x768 resolution.")
ExitBot()
EndIf
If (Not $login) Then
login()
EndIf
WEnd