Advertisement
Guest User

Untitled

a guest
Sep 19th, 2010
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 13.96 KB | None | 0 0
  1. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  2. #AutoIt3Wrapper_Icon=P:\pictures\ico\REPORTL.ICO
  3. #AutoIt3Wrapper_UseUpx=n
  4. #AutoIt3Wrapper_Res_Description=LoL Masteries Man.
  5. #AutoIt3Wrapper_Res_Fileversion=1.0.0.107
  6. #AutoIt3Wrapper_Res_FileVersion_AutoIncrement=y
  7. #AutoIt3Wrapper_Res_LegalCopyright=nvn
  8. #AutoIt3Wrapper_Au3Check_Stop_OnWarning=y
  9. #AutoIt3Wrapper_Run_After=del /f /q folderPlay_Obfuscated.au3
  10. #AutoIt3Wrapper_Run_Tidy=y
  11. #Obfuscator_Parameters=/cs=0 /cn=0 /cf=1 /cv=1 /sf=1 /sv=1
  12. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  13. #AutoIt3Wrapper_Run_Debug_Mode=n
  14. #include <Misc.au3>
  15.  
  16. OnAutoItExitRegister('OnAutoItExit')
  17. HotKeySet('{end}', 'OnAutoItExit')
  18. HotKeySet('{ins}', 'getpx')
  19. HotKeySet('{home}', 'getpix')
  20. $log = FileOpen(@ScriptDir & '\log.txt', 1)
  21. Func OnAutoItExit()
  22.     FileClose($log)
  23.     Exit
  24. EndFunc ;==>OnAutoItExit
  25.  
  26. AutoItSetOption("MouseCoordMode", 0)
  27. AutoItSetOption("PixelCoordMode", 0)
  28. AutoItSetOption("MouseClickDelay", 1)
  29. AutoItSetOption("MouseClickDownDelay", 1)
  30.  
  31. If Not focus() Then
  32.     If _Singleton("lolmastersv", 1) == 0 Then
  33.         MsgBox(0, 'LoL Masteries Save', 'Already running', 3)
  34.         Exit
  35.     EndIf
  36.     If FileExists("C:\Riot Games\League of Legends\lol.launcher.exe") Then
  37.         Run("C:\Riot Games\League of Legends\lol.launcher.exe", "C:\Riot Games\League of Legends")
  38.         While ProcessExists('lol.launcher.exe') And Not WinExists("PVP.net Client", "")
  39.             Sleep(1000)
  40.         WEnd
  41.         If Not WinExists("PVP.net Client", "") Then
  42.             MsgBox(0, 'LoLMasterSave', 'Start Leage Of Legends first')
  43.             Exit
  44.         EndIf
  45.         Sleep(500)
  46.         WinActivate("PVP.net Client", "")
  47.     Else
  48.         MsgBox(0, 'LoLMasterSave', 'Start Leage Of Legends first')
  49.         Exit
  50.     EndIf
  51. Else
  52.     If _Singleton("lolmastersv", 1) == 0 Then
  53.         WinActivate("PVP.net Client", "")
  54.         MsgBox(0, 'LoL Masteries Save', 'Already running', 3)
  55.         Exit
  56.     EndIf
  57. EndIf
  58.  
  59.  
  60. #cs
  61. Master reletive poz 115, 274
  62.  
  63. ; masteries detect
  64. Position: 143, 252
  65. Color: 0x672019
  66.  
  67. Position: 206, 248
  68. Color: 0xBEDCF9
  69.  
  70. Position: 284, 240
  71. Color: 0xA2BA9A
  72. #ce
  73.  
  74. $hwnd = WinGetHandle("PVP.net Client", "")
  75. Global $so
  76. Global $s = WinGetPos($hwnd)
  77. $xa = 120
  78. $ya = 290
  79. Global $wndx = $s[0] + $xa
  80. Global $wndy = $s[1] + $ya
  81. Dim $wndw = 210
  82. Dim $wndh = 317
  83. $tp = 0
  84. $show = 1
  85. $zord = 0
  86. Global $db[100]
  87. Global $dbsize = 0
  88. $dbf = @ScriptDir & '\lolMasterSet.dat'
  89. $place = 0
  90. $frz = 1
  91.  
  92. #include <ButtonConstants.au3>
  93. #include <EditConstants.au3>
  94. #include <GUIConstantsEx.au3>
  95. #include <GUIListBox.au3>
  96. #include <StaticConstants.au3>
  97. #include <WindowsConstants.au3>
  98. Opt("GUIOnEventMode", 1)
  99.  
  100. $wnd = GUICreate("LoLMasterSave", 210, 301, 240, 166, $WS_POPUP, $WS_EX_TOOLWINDOW)
  101. GUISetFont(11, 400, 0, "Microsoft Sans Serif")
  102. GUISetBkColor(0xC9B170)
  103. GUISetOnEvent($GUI_EVENT_CLOSE, "wndClose")
  104. GUISetOnEvent($GUI_EVENT_MINIMIZE, "wndMinimize")
  105. GUISetOnEvent($GUI_EVENT_MAXIMIZE, "wndMaximize")
  106. GUISetOnEvent($GUI_EVENT_RESTORE, "wndRestore")
  107. $list1 = GUICtrlCreateList("", 0, 128, 209, 200, -1, 0)
  108. GUICtrlSetColor(-1, 0x404040)
  109. GUICtrlSetOnEvent(-1, "list1Click")
  110. $Button1 = GUICtrlCreateButton("Apply", 128, 96, 83, 25, $WS_GROUP)
  111. GUICtrlSetColor(-1, 0x404040)
  112. GUICtrlSetOnEvent(-1, "setM")
  113. $code = GUICtrlCreateEdit("", 80, 24, 129, 60, $ES_WANTRETURN)
  114. GUICtrlSetData(-1, StringFormat("00000000000000,00000000000000,000000000000000"))
  115. GUICtrlSetColor(-1, 0x404040)
  116. GUICtrlSetTip(-1, "Masteries Code: Fill the numbers from the tree to the right.")
  117. GUICtrlSetOnEvent(-1, "codeChange")
  118. $Label2 = GUICtrlCreateLabel("Offense:", 0, 24, 76, 20)
  119. GUICtrlSetColor(-1, 0x404040)
  120. GUICtrlSetOnEvent(-1, "Label2Click")
  121. $Label3 = GUICtrlCreateLabel("Defense:", 0, 44, 79, 20)
  122. GUICtrlSetColor(-1, 0x404040)
  123. GUICtrlSetOnEvent(-1, "Label3Click")
  124. $Label4 = GUICtrlCreateLabel("Utility:", 0, 64, 75, 20)
  125. GUICtrlSetColor(-1, 0x404040)
  126. GUICtrlSetOnEvent(-1, "Label4Click")
  127. $name = GUICtrlCreateInput("Select below", 0, 0, 209, 19, BitOR($ES_CENTER, $ES_AUTOHSCROLL), 0)
  128. GUICtrlSetColor(-1, 0x404040)
  129. GUICtrlSetTip(-1, "Type the name here")
  130. GUICtrlSetOnEvent(-1, "nameChange")
  131. $Button2 = GUICtrlCreateButton("Save", 56, 96, 67, 25, $WS_GROUP)
  132. GUICtrlSetColor(-1, 0x404040)
  133. GUICtrlSetOnEvent(-1, "save")
  134. $Button3 = GUICtrlCreateButton("Delete", 0, 96, 51, 25, $WS_GROUP)
  135. GUICtrlSetColor(-1, 0x404040)
  136. GUICtrlSetOnEvent(-1, "delete")
  137. GUISetState(@SW_SHOW)
  138. WinSetState($wnd, "", @SW_HIDE)
  139.  
  140.  
  141. Load()
  142. AdlibRegister('position', 10)
  143. AdlibRegister('state', 100)
  144. AdlibRegister('zorder', 50)
  145.  
  146. Sleep(1000)
  147. $frz = 0
  148.  
  149. While 1
  150.     Sleep(10)
  151. WEnd
  152.  
  153. Func save()
  154.     $i = c(dbn2i(GUICtrlRead($name)))
  155.     $j = c(_GUICtrlListBox_FindString($list1, GUICtrlRead($name), 1))
  156.     If $j == -1 Then
  157.         If UBound($db) <= $dbsize Then Return
  158.         $db[$dbsize] = GUICtrlRead($name) & ':' & GUICtrlRead($code)
  159.         $dbsize += 1
  160.         _GUICtrlListBox_AddString($list1, GUICtrlRead($name))
  161.         _GUICtrlListBox_SetCurSel($list1, _GUICtrlListBox_FindString($list1, GUICtrlRead($name), 1))
  162.     Else
  163.         $db[$i] = GUICtrlRead($name) & ':' & GUICtrlRead($code)
  164.         ;_GUICtrlListBox_ReplaceString($list1, $i, GUICtrlRead($name))
  165.         _GUICtrlListBox_SetCurSel($list1, $j)
  166.         list1Click()
  167.     EndIf
  168.     dbsave()
  169. EndFunc ;==>save
  170. Func delete()
  171.     $i = dbn2i(GUICtrlRead($list1))
  172.     $j = _GUICtrlListBox_FindString($list1, GUICtrlRead($list1), 1)
  173.     If $i == -1 Then Return
  174.     $db[$i] = ''
  175.     _GUICtrlListBox_DeleteString($list1, $j)
  176.     If $i > 0 Then
  177.         $i -= 1
  178.     Else
  179.         $i = 0
  180.     EndIf
  181.     _GUICtrlListBox_SetCurSel($list1, $j)
  182.     list1Click()
  183. EndFunc ;==>delete
  184. Func codeChange()
  185.  
  186. EndFunc ;==>codeChange
  187. Func Label2Click()
  188.  
  189. EndFunc ;==>Label2Click
  190. Func Label3Click()
  191.  
  192. EndFunc ;==>Label3Click
  193. Func Label4Click()
  194.  
  195. EndFunc ;==>Label4Click
  196. Func list1Click()
  197.     $i = dbn2i(GUICtrlRead($list1))
  198.     If $i == -1 Then
  199.         c('onclick db fail')
  200.         Return
  201.     EndIf
  202.     ;Agro:30014401313001,00000000000000,031040100000000
  203.     GUICtrlSetData($name, StringMid($db[$i], 1, StringInStr($db[$i], ':') - 1))
  204.     GUICtrlSetData($code, StringMid($db[$i], StringInStr($db[$i], ':') + 1))
  205. EndFunc ;==>list1Click
  206. Func nameChange()
  207.  
  208. EndFunc ;==>nameChange
  209.  
  210. Func wndClose()
  211.  
  212. EndFunc ;==>wndClose
  213. Func wndMaximize()
  214.  
  215. EndFunc ;==>wndMaximize
  216. Func wndMinimize()
  217.  
  218. EndFunc ;==>wndMinimize
  219. Func wndRestore()
  220.  
  221. EndFunc ;==>wndRestore
  222.  
  223.  
  224. Func getpix()
  225.     $gpx1 = PixelGetColor(141, 254, $hwnd)
  226.     FileWriteLine($log, $gpx1)
  227. EndFunc ;==>getpix
  228. Func getpx()
  229.     $tmp = MouseGetPos()
  230.     $gpx2 = PixelGetColor($tmp[0], $tmp[1], $hwnd)
  231.     FileWriteLine($log, $tmp[0] & ',' & $tmp[1] & @TAB & $gpx2)
  232. EndFunc ;==>getpx
  233.  
  234. Func dbload()
  235.     $file = FileOpen($dbf, 0)
  236.  
  237.     ; Check if file opened for reading OK
  238.     If $file = -1 Then
  239.         c('no file to load')
  240.         $db[0] = '21-0-9 AP Offense:10034401313001,00000000000000,013040001000000'
  241.         $db[1] = 'Tank:00000000000000,13033421030001,013040001000000'
  242.         $db[2] = 'just a test:30014401313001,00000000000000,031040100000000'
  243.         $dbsize = 3
  244.         Return
  245.     EndIf
  246.     $dbsize = 0
  247.     ; Read in lines of text until the EOF is reached
  248.     While $dbsize < UBound($db)
  249.         $line = FileReadLine($file)
  250.         If @error = -1 Then ExitLoop
  251.         if (StringLen($line) > 46) and (StringInStr($line, ':') > 0) Then
  252.             $db[$dbsize] = $line
  253.             $dbsize += 1
  254.         EndIf
  255.     WEnd
  256.     FileClose($file)
  257. EndFunc ;==>dbload
  258.  
  259. Func dbsave()
  260.     $file = FileOpen($dbf, 2)
  261.     ; Check if file opened for writing OK
  262.     If $file = -1 Then
  263.         MsgBox(0, "Error", "Unable to open file.")
  264.         Exit
  265.     EndIf
  266.     For $i = 0 To UBound($db) - 1
  267.         if ((StringLen($db[$i]) > 46) and (StringInStr($db[$i], ':') > 0)) Then
  268.             FileWriteLine($file, $db[$i])
  269.         EndIf
  270.     Next
  271.     FileClose($file)
  272. EndFunc ;==>dbsave
  273.  
  274. Func dbn2i($txt)
  275.     $l = StringLen($txt)
  276.     $i = 0
  277.     while (($i < UBound($db)) and ($i < $dbsize) and (StringLeft($db[$i], $l) <> $txt))
  278.         $i += 1
  279.     WEnd
  280.     If StringLeft($db[$i], $l) <> $txt Then
  281.         c("can't find:""" & $txt & """")
  282.         Return -1
  283.     Else
  284.         Return $i
  285.     EndIf
  286. EndFunc ;==>dbn2i
  287.  
  288. Func Load()
  289.     dbload()
  290.     WinSetOnTop($wnd, '', 0)
  291.     WinMove($wnd, '', $wndx, $wndy, $wndw, $wndh)
  292.     db2list()
  293. EndFunc ;==>Load
  294.  
  295. Func db2list()
  296.     _GUICtrlListBox_BeginUpdate($list1)
  297.     $i = 0
  298.     while (($i < UBound($db)) and (StringLen($db[$i]) > 46) and (StringInStr($db[$i], ':') > 0))
  299.         _GUICtrlListBox_AddString($list1, StringMid($db[$i], 1, StringInStr($db[$i], ':') - 1))
  300.         $i += 1
  301.     WEnd
  302.     _GUICtrlListBox_EndUpdate($list1)
  303.     _GUICtrlListBox_SetCurSel($list1, 0)
  304.     list1Click()
  305. EndFunc ;==>db2list
  306.  
  307. Func setM()
  308.     $m = GUICtrlRead($code)
  309.     WinSetOnTop($wnd, '', 1)
  310.     focus()
  311.  
  312.     ;30014401313001,00000000000000,031040100000000
  313.     $m = StringReplace($m, ',', '')
  314.     If StringLen($m) <> 43 Then
  315.         c('not 43')
  316.         Return
  317.     EndIf
  318.  
  319.     If $place == 1 Then
  320.         $frz = 1
  321.         $tmp = MouseGetPos()
  322.         MouseClick("left", 287, 668, 1, 1)
  323.     #cs
  324.     Return Points
  325.     Position: 287, 668
  326.     Cursor ID: 0
  327.     Color: 0x1F4470 (2049136)
  328.     Yes do it dialog
  329.     Position: 610, 540
  330.     Cursor ID: 0
  331.     Color: 0x1D4270 (1917552)
  332.     #ce
  333.         If Not pixwait(610, 540, 1917552, 10000, $hwnd, 10) Then
  334.             $frz = 0
  335.             Return
  336.         EndIf
  337.  
  338.         MouseClick("left", 583, 541, 1, 1)
  339.         If Not pixwait(287, 668, 2049136, 10000, $hwnd, 10) Then
  340.             $frz = 0
  341.             Return
  342.         EndIf
  343.  
  344. ;Sleep(500)
  345.  
  346.         $cord = '385,245;449,245;509,245;577,245;449,323;509,323;389,403;449,401;511,403;579,403;451,481;451,561;509,563;451,639;657,243;719,243;781,241;843,247;723,321;785,319;723,403;785,401;841,401;721,475;785,479;725,561;783,565;727,639;929,241;997,243;1057,239;1115,241;993,317;1055,323;931,401;993,399;1053,401;1117,397;1059,477;1123,479;999,559;1055,557;1001,641'
  347.         $cord = StringSplit($cord, ';')
  348.         For $k = 1 To $cord[0]
  349.             For $i = 1 To StringMid($m, $k, 1)
  350.                 c($k & ': ' & $cord[$k])
  351.                 Execute('MouseClick("left",' & $cord[$k] & ',1,1)')
  352.             Next
  353.         Next
  354.  
  355.         MouseClick("left", 229, 703, 1, 1)
  356.         ;MouseMove(637,519)
  357.         ;Sleep(2000)
  358.         #cs
  359.         Position: 617, 521
  360.         Cursor ID: 0
  361.         Color: 0x1C406F (1851503)
  362.         #ce
  363.         If Not pixwait(617, 521, 1851503, 10000, $hwnd, 10) Then
  364.             $frz = 0
  365.             Return
  366.         EndIf
  367.  
  368.         MouseClick("left", 617, 521, 1, 1)
  369.         MouseMove($tmp[0], $tmp[1], 1)
  370.         Sleep(100)
  371.         $frz = 0
  372.     ElseIf $place == 2 Then
  373.         $frz = 1
  374.         $tmp = MouseGetPos()
  375.         MouseClick("left", 288, 644, 1, 1)
  376.         If Not pixwait(605, 516, 1720171, 10000, $hwnd, 10) Then
  377.             $frz = 0
  378.             Return
  379.         EndIf
  380.         ; are you sure?
  381.         MouseClick("left", 605, 516, 1, 1); yes
  382.         If Not pixwait(278, 644, 1982828, 10000, $hwnd, 10) Then
  383.             $frz = 0
  384.             Return
  385.         EndIf
  386. ; returned
  387.  
  388.         $cord = '387,224;457,224;513,222;577,220;447,300;509,300;387,388;457,378;515,378;587,384;455,458;449,532;515,534;443,614;657,216;717,218;785,218;849,214;735,300;787,300;713,384;791,378;847,382;725,452;803,454;723,536;787,536;725,618;931,218;991,220;1059,222;1115,222;997,296;1061,292;921,392;1003,378;1059,376;1123,384;1063,452;1123,456;997,538;1067,536;993,612'
  389.         $cord = StringSplit($cord, ';')
  390.         For $k = 1 To $cord[0]
  391.             For $i = 1 To StringMid($m, $k, 1)
  392.                 c($k & ': ' & $cord[$k])
  393.                 Execute('MouseClick("left",' & $cord[$k] & ',1,1)')
  394.             Next
  395.         Next
  396.  
  397.         ;MouseClick("left", 279, 679, 1, 1)
  398.         ;MouseMove(637,519)
  399.         ;Sleep(2000)
  400.         ;MouseClick("left", 641, 457, 1, 1)
  401.         ;MouseMove($tmp[0], $tmp[1], 1)
  402.         MouseMove(641, 457, 1)
  403.         Sleep(100)
  404.         $frz = 0
  405.     EndIf
  406. EndFunc ;==>setM
  407.  
  408.  
  409. Func pixwait($x = 0, $y = 0, $c = 0, $t = 5000, $hndl = '', $tmt = 100)
  410.     $tt = TimerInit()
  411.     While TimerDiff($tt) < $t And PixelGetColor($x, $y, $hndl) <> $c
  412.         Sleep($tmt)
  413.     WEnd
  414.     if (TimerDiff($tt) >= $t) Then
  415.         Return 0
  416.     Else
  417.         Return 1
  418.     EndIf
  419. EndFunc ;==>pixwait
  420.  
  421. Func position()
  422.     If $frz Then Return
  423.     ;#############################
  424.     ; position handle
  425.     $so = $s
  426.     $s = WinGetPos($hwnd)
  427.  
  428.     ;handle window positioning
  429.     If @error Then
  430.         Exit
  431.     EndIf
  432.     ;position relative to the folder
  433.     If $s[0] <> $so[0] Or $s[1] <> $so[1] Then
  434.         ;115, 274
  435.         $wndx = $s[0] + $xa
  436.         $wndy = $s[1] + $ya
  437.         WinMove($wnd, '', $wndx, $wndy, $wndw, $wndh)
  438.     EndIf
  439.     ;############################
  440. EndFunc ;==>position
  441.  
  442. Func state()
  443.     If $frz Then Return
  444.     ;##############################
  445.     ; State handle
  446.     ;$po = MouseGetPos()
  447.     ;cb($po[0]&", "&$po[1])
  448.     $px = PixelGetColor(141, 254, $hwnd)
  449.     $place = 0
  450.     If $px == 10576732 Then
  451.         $place = 1
  452.     ElseIf $px == 13284473 Then
  453.         $place = 2
  454.     EndIf
  455.     If $place <> 0 Then
  456.         If $show == 0 Then
  457.             WinSetState($wnd, "", @SW_SHOW)
  458.             $show = 1
  459.             c('tab here show')
  460.         EndIf
  461.     Else
  462.         If $show == 1 Then
  463.             WinSetState($wnd, "", @SW_HIDE)
  464.             $show = 0
  465.             c("no tab: hide")
  466.         EndIf
  467.         Return
  468.     EndIf
  469. EndFunc ;==>state
  470.  
  471. Func zorder()
  472.     If $frz Then Return
  473.     $tpo = $tp
  474.     $tp = WinGetTitle("[active]")
  475.     If $tpo == $tp Then Return
  476.     If $tp == 'PVP.net Client' Then
  477.         If $zord == 0 Then
  478.             WinSetOnTop($wnd, '', 1)
  479.             WinActivate($wnd)
  480.             WinActivate($hwnd)
  481.             $zord = 1
  482.             ;WinSetTrans($wnd, '', 255)
  483.             ;$pausedimlvl = 255
  484.             c('set top')
  485.         EndIf
  486.     ElseIf $tp == 'LoLMasterSave' Then
  487.         Return
  488.     Elseif ($zord == 1) Then
  489.         WinSetOnTop($wnd, '', 0)
  490.         WinActivate($wnd)
  491.         WinActivate($tp)
  492.         $zord = 0
  493.         ;WinSetTrans($wnd, '', 128)
  494.         ;$pausedimlvl = 128
  495.         c('set bot: ' & $tp)
  496.     EndIf
  497.  
  498.  
  499. #cs
  500. ;##################################
  501. ; topmost handle
  502. $tpo = $tp
  503. $tp = WinActive($hwnd)
  504.  
  505. If $tpo <> $tp Then
  506. If $tp Then
  507. WinSetOnTop($wnd, '', 1)
  508. WinActivate($wnd)
  509. WinActivate($hwnd)
  510. ;WinSetTrans($wnd, '', 255)
  511. ;$pausedimlvl = 255
  512. c('LoL set top')
  513. ElseIF WinActive($wnd) Then
  514.  
  515. c('mod is top')
  516. Else
  517. Local $active = WinGetTitle("[active]")
  518. WinSetOnTop($wnd, '', 0)
  519. WinActivate($wnd)
  520. WinActivate($active)
  521. ;WinSetTrans($wnd, '', 128)
  522. ;$pausedimlvl = 128
  523. c('set bot')
  524. EndIf
  525. EndIf
  526. ;############################
  527. #ce
  528. EndFunc ;==>zorder
  529.  
  530. Func focus($t = 1)
  531.     Return _WinWaitActivate("PVP.net Client", "", $t)
  532. EndFunc   ;==>focus
  533.  
  534. Func c($txt)
  535.     ConsoleWrite($txt & @CRLF)
  536.     Return $txt
  537. EndFunc   ;==>c
  538.  
  539. Func cb($txt = '')
  540.     ConsoleWrite($txt)
  541.     Return $txt
  542. EndFunc   ;==>cb
  543.  
  544. Func _WinWaitActivate($title, $text, $timeout = 0)
  545.     WinWait($title, $text, $timeout)
  546.     If Not WinActive($title, $text) Then WinActivate($title, $text)
  547.     If Not WinWaitActive($title, $text, $timeout) Then
  548.         ;msgbox(0,"lolMasterSave","Start Leage Of Legends first")
  549.         Return 0
  550.     Else
  551.         Return 1
  552.     EndIf
  553. EndFunc   ;==>_WinWaitActivate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement