Advertisement
Guest User

Warframe - Login & Daily reward collector

a guest
Jun 19th, 2017
434
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 4.21 KB | None | 0 0
  1. ;If you are not familiar with AutoIT scripts it is best to
  2. ;run this in the SciTE editor by pressing F5
  3. ; There is some debugging information in the console section
  4.  
  5.  
  6.  
  7. ;This script is very coarse and relies on a lot of timers that may vary depending on the speed of the PC (how fast it loads Warframe)
  8. ;I have no idea what DE's stance on this sort of thing is.
  9.  
  10.  
  11. ;The following variable is the vertical distance from the top of the screen to the username input box
  12. ;I suspect it should be a percentage as this would allow scaling for different resolutions
  13.  
  14. ;On a 1440p monitor the username input is ~350p from the bottom of the screen
  15. ;~ $y = @DeskTopHeight - 350 ;1440p, or approx 76% from the top
  16.  
  17. $y = @DeskTopHeight * 0.76 ;this % based scaling is untested
  18.  
  19. If $CmdLine[0] == 4 Then
  20.    ; This hasn't been tested
  21.    $sUsername = $CmdLine[1]
  22.    $sPassword = $CmdLine[2]
  23.    $sWarframePath = $CmdLine[3]
  24.    $iLoadDelay = $CmdLine[4]
  25. Else
  26.    $sConfigfile = @ScriptDir & "\config.ini"
  27.       ;~ Config file is in the same location as the script and is formated in the following way
  28.  
  29.       ;~ [options]
  30.       ;~ username=username
  31.       ;~ password=password
  32.       ;~ path=C:\path\to\launcher.exe
  33.       ;~ loaddelay=30
  34.  
  35.       ;Path can also be specified with this
  36.       ;~ path =C:\path\to\steam.exe -applaunch 230410
  37.  
  38.       ;Loaddelay is a value in seconds that depends on the PC it is running on.
  39.       ;It is the duration between the launcher closing and Warframe reaching the login prompt
  40.       ;For reliability you should overestimate this value
  41.    $sUsername = IniRead($sConfigfile, "options", "username", "" )
  42.    $sPassword = IniRead($sConfigfile, "options", "password", "" )
  43.    $sWarframePath = IniRead($sConfigfile, "options", "path", "" )
  44.    $iLoadDelay = IniRead($sConfigfile, "options", "loaddelay", "" )
  45. EndIf
  46.  
  47. If $sUsername == "" OR $sPassword == "" OR $sWarframePath == "" OR $iLoadDelay == "" Then
  48.    MsgBox(0,"", "Options not set")
  49.    exit
  50. EndIf
  51.  
  52.  
  53.  
  54.  
  55. Launcher()
  56. Login()
  57.  
  58. Func Launcher()
  59.    ;Start Warframe
  60.    run($sWarframePath)
  61.  
  62.    ;Wait for launcher
  63.    WinWait("Warframe","", 30)
  64.    Sleep(2000)
  65.    $hWarframe = WinGetHandle("Warframe")
  66.    ConsoleWrite("Warframe Launcher found, Window ID: " & $hWarframe & @CRLF)
  67.    ;Give the launcher focus
  68.    WinActivate ($hWarframe)
  69.  
  70.    ;Get Launchers position
  71.    $aLauncher = WinGetPos ($hWarframe)
  72.  
  73.    Opt("WinDetectHiddenText", 1)
  74.  
  75.    ;Check for updates
  76.    ConsoleWrite("Checking for updates" & @CRLF)
  77.    While(StringInStr(WinGetText($hWarframe), "CHECKING FOR UPDATES..."))
  78.       Sleep(1000)
  79.    WEnd
  80.  
  81.    ConsoleWrite("Checking for content" & @CRLF)
  82.    While(StringInStr(WinGetText($hWarframe), "Checking for new content..."))
  83.       Sleep(1000)
  84.    WEnd
  85.  
  86.    If Not StringInStr(WinGetText($hWarframe), "Warframe is up to date!") Then
  87.       ;Download updates
  88.       ConsoleWrite("Downloading Updates" & @CRLF)
  89.       Do
  90.          Sleep(1000)
  91.       Until(StringInStr(WinGetText($hWarframe), "Warframe is up to date!"))
  92.    EndIf
  93.    ConsoleWrite("Warframe is upto date" & @CRLF)
  94.  
  95.    ;Attempt to press 'Play' by offsetting our mouse click based on Launchers position
  96.    MouseClick("primary", $aLauncher[0] + 755, $aLauncher[1] + 590, 1, 0)
  97.    ConsoleWrite("Warframe is starting" & @CRLF)
  98. EndFunc
  99.  
  100.  
  101.  
  102. Func Login()
  103. ;~    Sleep(1000)
  104.  
  105.    ;Wait for it to open
  106.    WinWait("WARFRAME","", 30)
  107.    ConsoleWrite("Waiting to load" & @CRLF)
  108.    ;Wait for it to load
  109.    sleep($iLoadDelay * 1000)
  110.  
  111.    ;Give Warframe focus
  112.    WinActivate ("WARFRAME")
  113.    ConsoleWrite("Attempting login" & @CRLF)
  114.    ;Click in the username field
  115.  
  116.    MouseClick ("primary", @DeskTopWidth/2, $y, 2, 0)
  117.    ;Empty the field
  118.    send("{END}{BS 50}")
  119.    ;Type in the username
  120.    send($sUsername)
  121.  
  122.    ;Move to password field
  123.    send("{TAB}")
  124.    ;Empty the field
  125.    send("{BS 50}")
  126.    ;Type in the password
  127.    send($sPassword)
  128.  
  129.    ;Login
  130.    send("{ENTER}")
  131.  
  132.    ;Collect daily reward
  133.    ;But wait a bit for it to login
  134.    sleep(10000)
  135.    ConsoleWrite("Attempting reward claim" & @CRLF)
  136.    MouseClick ("primary", @DeskTopWidth/2, @DeskTopHeight/2, 2, 0)
  137.  
  138.    ;Let it catch it's breath
  139.    sleep(3000)
  140.    ;exit Warframe
  141.    ConsoleWrite("Exiting" & @CRLF)
  142.    $hWarframe = (WinList("WARFRAME"))[1][1]
  143.    WinClose($hWarframe)
  144. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement