Advertisement
Guest User

Untitled

a guest
Nov 24th, 2012
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 19.25 KB | None | 0 0
  1. ;Made by Suna and Erz
  2. ;
  3. ;Macros:
  4. ;#Action bar 1
  5. ;/click PVPHonorFrame
  6. ;/click PVPFrameTab2
  7. ;/click PVPFrameLeftButton
  8. ;
  9. ;#Action bar 2
  10. ;#/script AcceptBattlefieldPort(1, 1)
  11. ;
  12. ;#Action bar 3
  13. ;#/afk
  14. ;
  15. ;#Action bar 4
  16. ;#/script LeaveBattlefield()
  17. ;
  18. ;Action bar 5(Leader only)
  19. ;/script AcceptBattlefieldPort(1, 0)
  20.  
  21.  
  22. #include <ImageSearch.au3>
  23. #include <GuiEdit.au3>
  24. #include <Date.au3>
  25. #include <Array.au3>
  26. #include <ButtonConstants.au3>
  27. #include <GUIConstantsEx.au3>
  28. #include <WindowsConstants.au3>
  29. #include <StaticConstants.au3>
  30.  
  31. HotKeySet("{F10}", "_stop")
  32.  
  33. #Region ### START Koda GUI section ###
  34.  
  35.  
  36.  
  37.  
  38. Global $wlog
  39. Global $var
  40. Global $var2 = WinList("World of Warcraft", "")
  41. Global $i
  42. Global $run = false
  43. Global $inverse
  44. Global $running = false
  45. Global $quit
  46. Global $win = 1
  47. Global $log = 2
  48. Global $team = 3
  49. Global $ct1w = 0 ;number of win for team 1
  50. Global $ct1l = 0 ;number of loss for team 1
  51. Global $ct2w = 0 ;number of win for team 2
  52. Global $ct2l = 0 ;number of loss for team 2
  53. ;Global $button = "button.bmp"
  54. ;Global $buttonQ = "buttonQ.bmp"
  55. Global $teamproc = 0
  56. ;FOR TESTING
  57. Global $button = "button1.bmp"
  58. Global $buttonQ = "button1.bmp"
  59.  
  60. Func _log($slog)
  61.         _GUICtrlEdit_AppendText($wlog,$slog & @CRLF)
  62. endfunc
  63.  
  64. Func _MSec()
  65. ; timer to "thousandths" of a second
  66. ; Author - Holger
  67.     Local $stSystemTime = DllStructCreate('ushort;ushort;ushort;ushort;ushort;ushort;ushort;ushort')
  68.     DllCall('kernel32.dll', 'none', 'GetSystemTime', 'ptr', DllStructGetPtr($stSystemTime))
  69.  
  70.     $sMilliSeconds = StringFormat('%03d', DllStructGetData($stSystemTime, 8))
  71.    
  72.     $stSystemTime = 0
  73.    
  74.     Return $sMilliSeconds
  75. EndFunc
  76.  
  77. func _timeInMs()
  78.  
  79.         return (@HOUR*360000)+(@MIN*60000)+(@SEC*1000)+_MSec()
  80.  
  81. endfunc
  82.  
  83.  
  84.  
  85. $MainWin = GUICreate("FAKE U GLHADIOTARD", 261, 501, 198, 131)
  86. $FuncMenu = GUICtrlCreateMenu("&Functions")
  87. $RenWoW = GUICtrlCreateMenuItem("Rename", $FuncMenu)
  88. $Login = GUICtrlCreateMenuItem("Login", $FuncMenu)
  89. $HelpWin = GUICtrlCreateMenu("&Help")
  90. $ReadMe = GUICtrlCreateMenuItem("Readme", $HelpWin)
  91. $ZmbGrp = GUICtrlCreateGroup("T1", 144, 336, 97, 73, $BS_CENTER)
  92. $tagt1 = GUICtrlCreateButton("Tag T1", 152, 352, 75, 25, $BS_VCENTER)
  93. $entert1 = GUICtrlCreateButton("Enter T1", 152, 376, 75, 25, $BS_VCENTER)
  94. GUICtrlCreateGroup("", -99, -99, 1, 1)
  95. $PrtyLdrs = GUICtrlCreateGroup("T2", 24, 336, 105, 73, $BS_CENTER)
  96. $tagt2 = GUICtrlCreateButton("Tag T2", 40, 352, 75, 25, $BS_VCENTER)
  97. $entert2 = GUICtrlCreateButton("Enter T2", 40, 376, 75, 25, $BS_VCENTER)
  98. GUICtrlCreateGroup("", -99, -99, 1, 1)
  99. $Group1 = GUICtrlCreateGroup("Que Functions", 48, 144, 169, 73, $BS_CENTER)
  100. $wlog = _GUICtrlEdit_Create($MainWin, "", 0, 5,260,140,$ES_MULTILINE + $ES_READONLY+$ES_AUTOVSCROLL)
  101. $RunBot = GUICtrlCreateButton("Run bot", 56, 184, 155, 25, $BS_VCENTER)
  102. $combo1 = GUICtrlCreateCombo("2v2", 56, 160, 153, 25)
  103. GUICtrlSetData(-1, "3v3|5v5", "3v3")
  104. ;$gg = GUICtrlCreateButton("Good Game", 56, 184, 155, 25, $BS_VCENTER)
  105. GUICtrlCreateGroup("", -99, -99, 1, 1)
  106. $Label1 = GUICtrlCreateLabel("Debug Button :", 40, 296, 176, 33)
  107. GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
  108. $Group2 = GUICtrlCreateGroup("Ratio W/L", 48, 216, 169, 65, $BS_CENTER)
  109. $Label2 = GUICtrlCreateLabel("Team1", 56, 232, 37, 17)
  110. $Label3 = GUICtrlCreateLabel("Team2", 168, 232, 37, 17, $SS_RIGHT)
  111. $Counter_t1 = GUICtrlCreateLabel("000/000", 56, 248, 77, 20)
  112. GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
  113. $Counter_t2 = GUICtrlCreateLabel("000/000", 144, 248, 61, 20, $SS_RIGHT)
  114. GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
  115. GUICtrlCreateGroup("", -99, -99, 1, 1)
  116. $Lo_t1 = GUICtrlCreateButton("Quit T1", 48, 416, 163, 25, $WS_GROUP)
  117. $Lo_t2 = GUICtrlCreateButton("Quit T2", 48, 440, 163, 25, $WS_GROUP)
  118. GUISetState(@SW_SHOW)
  119. #EndRegion ### END Koda GUI section ###
  120.  
  121. _log("Started !")
  122.  
  123. func _stop();STOP THE BOT
  124.         $running = false
  125.         _log("Bot going to stop...")
  126.         GUICtrlSetData ( $RunBot, "Wait for the end...")
  127. endfunc
  128.  
  129.  Func updatecounter() ;U NO SAY (FACE)
  130.    GUICtrlSetData ($Counter_t1, $ct1w&" / "&$ct1l)
  131.    GUICtrlSetData ($Counter_t2, $ct2w&" / "&$ct2l)
  132. EndFunc
  133.  
  134. Func ct1() ;add a win for team 1 and a loss for team 2
  135.    $ct1w = $ct1w + 1
  136.    $ct2l = $ct2l + 1
  137. EndFunc
  138.  
  139. Func ct2() ;add a win for team 2 and a loss for team 1
  140.    $ct2w = $ct2w + 1
  141.    $ct1l = $ct1l + 1
  142. EndFunc
  143.  
  144. Func ImgS($locx,$locy,$img)
  145.         $X=0
  146.         $Y=0
  147.         $image_path = @ScriptDir & "\" & $img
  148.         ;_log($image_path)
  149.         $Restart = _ImageSearchArea($image_path,1,$locx,$locy,500+$locx,500+$locy,$X,$Y,100)
  150.         If $Restart = 1 Then
  151.                 ;_log($X & " " & $Y)
  152.                 ;MouseMove($X, $Y,0)
  153.                 return 0
  154.         else
  155.                 return 1
  156.         EndIf
  157. EndFunc
  158.  
  159. func PopArena($pos)
  160.        
  161.         $ret = ImgS($pos,0,$button)
  162.         ;_log("Found: "&$ret)
  163.         $time = _timeInMs()
  164.         ;_log($time1)
  165.                
  166.        
  167.  
  168.         if($ret == 0) then
  169.                         if($pos==0)then
  170.                                 $teamproc = 1
  171.                         else
  172.                                 $teamproc = 2
  173.                         endif
  174.                 _log("Found POP")
  175.                 return $time
  176.         endif
  177.        
  178.         return 1
  179. endfunc
  180.  
  181. Func Main();the core of the script
  182.         $inqueue = false
  183.         $inverse = true
  184.         $running = true
  185.         GUICtrlSetData ( $RunBot, "F10 to stop")
  186.         do
  187.                         if($inqueue=false) then
  188.                                         Inscription()
  189.                                         $inqueue = true
  190.                                         _log("Inscriptions")
  191.                         endif
  192.                         if(Runin() = 0) then ;if arena proc is good < 1sec then all team go in arena
  193.                                 Join()
  194.                                 _log("Join Leader")
  195.                                 JoinA()
  196.                                 _log("Join Zombies")
  197.                                 $inqueue = false
  198.                                 sleep(10000)
  199.                                 ;WinActivate($var[$log][1], "")
  200.                                 ControlSend($var[$log][1], "", "", "{3}")
  201.                                 for $i = $log to $var2[0][0] step 2
  202.                                                 ;WinActivate($var2[$i][1], "")
  203.                                                 ControlSend($var2[$i][1], "", "", "{3}")
  204.                                 next
  205.                                 _log("Team "&$log&" Quit")
  206.                                 leaveBG()
  207.                                 if($inverse) then
  208.                                                 $win = 2
  209.                                                 $log = 1
  210.                                                 ct1()
  211.                                 else
  212.                                                 $win = 1
  213.                                                 $log = 2
  214.                                                 ct2()
  215.                                 endif
  216.                                 updatecounter()
  217.                                 $inverse = NOT $inverse
  218.                                 sleep(10000)
  219.                         else
  220.                         _log("Bad proc")
  221.                                 if($teamproc==2)then
  222.                                         _log("T1 and T2 quit queue.")
  223.                                         Joint1()
  224.                                         ControlSend($var[2][1], "", "", "{5}")
  225.                                         for $i = 2 to $var2[0][0] step 2
  226.                                                 ;WinActivate($var2[$i][1], "")
  227.                                                 ControlSend($var2[$i][1], "", "", "{5}")
  228.                                         next
  229.                                         sleep(10000)
  230.                                         ControlSend($var[1][1], "", "", "{3}")
  231.                                         for $i = 1 to $var2[0][0] step 2
  232.                                                         ;WinActivate($var2[$i][1], "")
  233.                                                         ControlSend($var2[$i][1], "", "", "{3}")
  234.                                         next
  235.                                         sleep(10000)
  236.                                         ;ControlSend($var[1][1], "", "", "{ENTER}")
  237.                                         ;for $i = 1 to $var2[0][0] step 2
  238.                                                         ;WinActivate($var2[$i][1], "")
  239.                                                         ;ControlSend($var2[$i][1], "", "", "{ENTER}")
  240.                                         ;next
  241.                                         ;sleep(10000)
  242.                                        
  243.                                 else
  244.                                         _log("Joining T2 and T1 quit queue.")
  245.                                         Joint2()
  246.                                         ControlSend($var[1][1], "", "", "{5}")
  247.                                         for $i = 1 to $var2[0][0] step 2
  248.                                                 ;WinActivate($var2[$i][1], "")
  249.                                                 ControlSend($var2[$i][1], "", "", "{5}")
  250.                                         next
  251.                                         sleep(10000)
  252.                                         ControlSend($var[2][1], "", "", "{3}")
  253.                                         for $i = 2 to $var2[0][0] step 2
  254.                                                         ;WinActivate($var2[$i][1], "")
  255.                                                         ControlSend($var2[$i][1], "", "", "{3}")
  256.                                         next
  257.                                         ;sleep(10000)
  258.                                         ;ControlSend($var[2][1], "", "", "{ENTER}")
  259.                                         ;for $i = 2 to $var2[0][0] step 2
  260.                                                         ;WinActivate($var2[$i][1], "")
  261.                                                         ;ControlSend($var2[$i][1], "", "", "{ENTER}")
  262.                                         ;next
  263.                                         ;sleep(10000)
  264.                                 endif
  265.                                 _log("Done bad proc")
  266.                                 $inqueue = false
  267.                                 ;_log("Leaving Arena queue !")
  268.                         endif
  269.         Until ($running = false )
  270.         GUICtrlSetData ( $RunBot, "Run Bot")
  271.         _log("Bot stopped.")
  272. endfunc
  273.  
  274.  
  275.  
  276. func leaveBG()
  277.                 $pos=500
  278.                 if($teamproc==1)then
  279.                         $pos = 0
  280.                 endif
  281.         while(ImgS($pos,0,$buttonQ)==1)
  282.             sleep(1000)
  283.         wend
  284.         ;WinActivate($var[$win][1], "")
  285.         ControlSend($var[$win][1], "", "", "{4}")
  286.         for $i = $win to $var2[0][0] step 2
  287.                 ;WinActivate($var2[$i][1], "")
  288.                 ControlSend($var2[$i][1], "", "", "{4}")
  289.         next
  290.         _log("Team "&$win&" Win")
  291.         ;WinActivate($var[$log][1], "")
  292.         ;ControlSend($var[$log][1], "", "", "{ENTER}")
  293.         ;for $i = $log to $var2[0][0] step 2
  294.                 ;WinActivate($var2[$i][1], "")
  295.                 ;ControlSend($var2[$i][1], "", "", "{ENTER}")
  296.         ;next
  297.         ;_log("Team "&$log&" logon")
  298. endfunc
  299.  
  300. Func Runin()
  301.         $t1=1
  302.         $t2=1
  303.         while 1
  304.                 if($t1==1) then
  305.                         $t1 = PopArena(500)
  306.                 endif
  307.                 if($t2==1) then
  308.                         $t2 = PopArena(0)
  309.                 endif
  310.                 $t = abs($t1-$t2)
  311.                 _log("T1: "&$t1&" T2: "&$t2&" DiffTime: "&$t)
  312.                 if($t1<>1 and $t2<>1 and $t<1000) then
  313.                         ;_log("Diff Time: " & $t)
  314.                         return 0
  315.                 else
  316.                         if(($t1<>1 or $t2<>1) and $t>=1000) then
  317.                                 return 1
  318.                         endif
  319.                 endif
  320.                 sleep(50)
  321.         wend
  322. EndFunc
  323.  
  324. Func Inscription()
  325.         For $i = 1 To $var[0][0]
  326.                 ;MsgBox(0, "HWNDs", "Title=" & $var[$i][0] & " HWND=" & $var[$i][1]) ;Extra crap
  327.                 ;WinActivate($var[$i][1], "")
  328.                 ControlSend($var[$i][1], "", "", "{h}")
  329.                 ControlSend($var[$i][1], "", "", "{1}")
  330.         Next
  331.         sleep(1000)
  332. EndFunc
  333.  
  334. Func Join()
  335.         For $i = 1 To $var[0][0]
  336.                 ;WinActivate($var[$i][1], "")
  337.                 ControlSend($var[$i][1], "", "", "{2}")
  338.         Next
  339. EndFunc
  340.  
  341. Func RenameWoW()
  342.         $pos = 0
  343.         $taille = 500
  344.                
  345.                 $tmp = Winlist("WoWHost1","")
  346.                 if($tmp[0][0]==1)then
  347.                         $var[1] = $tmp[1]
  348.                         $tmp = Winlist("WoWHost2","")
  349.                         $var[2] = $tmp[1]
  350.                         $var[0][0] = 2
  351.                         for $i = 1 to (($team-1)*2)
  352.                                 $tmp = Winlist("WoWZombie"&$i,"")
  353.                                 $var2[$i] = $tmp[1]
  354.                         next
  355.                         $var2[0][0] = (($team-1)*2)
  356.                         $run = true
  357.             else
  358.                
  359.                         if($var2[0][0]<>($team*2)) then
  360.                                         msgbox(0,"Error","Incorrect number of wows launched.")
  361.                         else
  362.                                         for $i = 1 to 2
  363.                                                         WinSetTitle($var2[$i][1], "", "WoWHost"&$i)
  364.                                                         WinMove($var2[$i][1], "", $pos, 0, $taille,$taille)
  365.                                                         $pos = $pos + $taille
  366.                                         Next
  367.                                         $pos = 0
  368.                                         $var2 = WinList("World of Warcraft", "")
  369.                                         for $i = 1 to $var2[0][0]
  370.                                                         WinSetTitle($var2[$i][1], "", "WoWZombie"&$i)
  371.                                                         WinMove($var2[$i][1], "", $pos, 500, $taille,$taille)
  372.                                                         $pos = $pos + 100
  373.                                         Next
  374.                                         $var = WinList("WoWHost", "")
  375.                                         $var2 = WinList("WoWZombie", "")
  376.                                         $run = true
  377.                         endif
  378.                 endif
  379. EndFunc
  380.  
  381. func login()
  382.         Dim $tab[10][2]
  383.        
  384.         ; File Ini order
  385.         ; 0 = Lead T1
  386.         ; 1 = Lead T2
  387.         ; 2 = Zombie T1
  388.         ; 3 = Zombie T2
  389.         ; 4 = Zombie T1
  390.         ; 5 = Zombie T2
  391.         ; 6 = Zombie T1
  392.         ; 7 = Zombie T2
  393.         ; 8 = Zombie T1
  394.         ; 9 = Zombie T2
  395.        
  396.         for $i = 0 to ($team*2)-1
  397.                 $tab[$i][0] = iniread("login.ini",$i,"log","")
  398.                 ;_log($tab[$i][0])
  399.                 $tab[$i][1] = iniread("login.ini",$i,"mdp","")
  400.                 ;_log($tab[$i][1])
  401.         next
  402.        
  403.         for $i = 0 to 1
  404.         ;lead t1 / t2
  405.                 controlsend($var[$i+1][1],"","",$tab[$i][0])
  406.                 controlsend($var[$i+1][1],"","","{TAB}")
  407.                 controlsend($var[$i+1][1],"","",$tab[$i][1])
  408.                 controlsend($var[$i+1][1],"","","{ENTER}")
  409.         next
  410.        
  411.         For $i = 2 to ($team*2)-3
  412.         ;zombies t1 / t2
  413.                 controlsend($var2[$i-1][1],"","",$tab[$i][0])
  414.                 controlsend($var2[$i-1][1],"","","{TAB}")
  415.                 controlsend($var2[$i-1][1],"","",$tab[$i][1])
  416.                 controlsend($var2[$i-1][1],"","","{ENTER}")
  417.         next
  418.  
  419.        
  420. endfunc
  421.  
  422.  
  423. Func JoinA()
  424.         For $i = 1 to $var2[0][0]
  425.                 ;WinActivate($var2[$i][1], "")
  426.                 ControlSend($var2[$i][1], "", "", "{2}")
  427.         Next
  428. EndFunc
  429.  
  430. Func Joint1()
  431.         ControlSend($var[1][1], "", "", "{2}")
  432.         For $i = 1 to $var2[0][0] step 2
  433.                 ;WinActivate($var2[$i][1], "")
  434.                 ControlSend($var2[$i][1], "", "", "{2}")
  435.         Next
  436. EndFunc
  437.  
  438. Func Joint2()
  439.         ControlSend($var[2][1], "", "", "{2}")
  440.         for $i = 2 to $var2[0][0] step 2
  441.                 ;WinActivate($var2[$i][1], "")
  442.                 ControlSend($var2[$i][1], "", "", "{2}")
  443.         Next
  444. EndFunc
  445.  
  446. Func Tagt1()
  447.         ControlSend($var[1][1], "", "", "{h}")
  448.                 ControlSend($var[1][1], "", "", "{1}")
  449. EndFunc
  450.  
  451. Func Tagt2()
  452.         ControlSend($var[2][1], "", "", "{h}")
  453.                 ControlSend($var[2][1], "", "", "{1}")
  454. EndFunc
  455.  
  456. Func Leavet1()
  457.         ControlSend($var[1][1], "", "", "{4}")
  458.         for $i = 1 to $var2[0][0] step 2
  459.                 ;WinActivate($var2[$i][1], "")
  460.                 ControlSend($var2[$i][1], "", "", "{4}")
  461.         Next
  462. EndFunc
  463.  
  464. Func Leavet2()
  465.         ControlSend($var[2][1], "", "", "{4}")
  466.         for $i = 2 to $var2[0][0] step 2
  467.                 ;WinActivate($var2[$i][1], "")
  468.                 ControlSend($var2[$i][1], "", "", "{4}")
  469.         Next
  470. EndFunc
  471.  
  472.  Func HelpDoc()
  473.     MsgBox(0, "README", "CHECK THE TUTORIAL ON OWNEDCORE MOTHAFUKA!")
  474. EndFunc
  475.  
  476. ;$var = WinList("WoWHost", "")
  477. ;$var2 = WinList("WoWZombie", "")
  478. ;$team = 3
  479. While 1
  480.         $nMsg = GUIGetMsg()
  481.         Switch $nMsg
  482.                 Case $GUI_EVENT_CLOSE
  483.                         Exit
  484.                 Case $entert2
  485.                         Joint2()
  486.                 Case $entert1
  487.                         Joint1()
  488.                 Case $tagt1
  489.                         Tagt1()
  490.                 Case $tagt2
  491.                         Tagt2()
  492.                 Case $Lo_t1
  493.                         Leavet1()
  494.                 Case $Lo_t2
  495.                         Leavet2()
  496.                 Case $ReadMe
  497.                         HelpDoc()
  498.                 Case $RunBot
  499.                         if($run) then
  500.                                 if($running)then
  501.                                         $running= not $running
  502.                                 else
  503.                                         Main()
  504.                                 endif
  505.                         else
  506.                                 msgbox(0,"Alert !","Open your "&($team*2)&" wows and use Functions->Rename first.")
  507.                         endif
  508.                 Case $RenWoW
  509.                         RenameWoW()
  510.                        
  511.                                 Case $Login
  512.                                         if($run)then
  513.                                                 login()
  514.                                         else
  515.                                                 msgbox(0,"Alert !","Rename wow first !")
  516.                                         endif
  517.                 case $combo1
  518.                         Switch GUICtrlRead($combo1)
  519.                                 case "2v2"
  520.                                         $team = 2
  521.                                 case "3v3"
  522.                                         $team = 3
  523.                                 case "5v5"
  524.                                         $team = 5
  525.                         EndSwitch
  526.                         _log($team&"v"&$team&" selected.")
  527.         EndSwitch
  528. WEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement