Advertisement
untoha

pereklikator

Jul 22nd, 2021
2,947
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 8.26 KB | None | 0 0
  1. #cs
  2. Global Const $COLOR_GREEN = 0x008000
  3. Global Const $COLOR_RED = 0xFF0000
  4. Global Const $COLOR_YELLOW = 0xFFFF00
  5. #ce
  6.  
  7. $title = "RАGЕ Мultiрlaуer  "
  8.  
  9. #include <ButtonConstants.au3>
  10. #include <EditConstants.au3>
  11. #include <GUIConstantsEx.au3>
  12. #include <StaticConstants.au3>
  13. #include <WindowsConstants.au3>
  14. #include <WinAPI.au3>
  15. #include <WindowsConstants.au3>
  16. #include "c:\bod\gta\perekli4ka\Mytesseract.au3"
  17. ;#include <tesseract.au3>
  18.  
  19. Opt("GUICloseOnESC", 0)
  20. _TesseractTempPathSet("c:\bod\gta\perekli4ka\screens")
  21.  
  22. Global $tRect
  23. global $game_hWnd
  24.  
  25. HotKeySet("{ESC}","")
  26. HotKeySet("{`}","calncetrade")
  27. HotKeySet("{1}","online_check")
  28. HotKeySet("{2}","trade_check")
  29. HotKeySet("{3}","savetrade")
  30.  
  31. #Region ### START Koda GUI section ### Form=
  32. $Form1 = GUICreate("nepekJlukatop.", 307, 657, 200, 250, -1, BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
  33. $Button1 = GUICtrlCreateButton("save data1", 16, 616, 75, 25, $WS_GROUP)
  34. $Button2 = GUICtrlCreateButton("compare", 112, 616, 75, 25, $WS_GROUP)
  35. $Button3 = GUICtrlCreateButton("save compare", 208, 616, 75, 25, $WS_GROUP)
  36. $Edit1 = GUICtrlCreateEdit("", 16, 48, 273, 561)
  37. GUICtrlSetData(-1, "")
  38. $Label1 = GUICtrlCreateLabel("set hWnd before use this tool", 24, 16, 235, 25)
  39. $Button4 = GUICtrlCreateButton("hW", 260, 1, 45, 45, $WS_GROUP)         ; save hWnd
  40. GUICtrlSetFont($Label1, 13)
  41. GUISetState(@SW_SHOW)
  42. #EndRegion ### END Koda GUI section ###
  43.  
  44. ;GUICtrlSetBkColor($Label1, "0x008000")
  45.  
  46. While 1  ; ////////////////////////////////////////////// MAIN
  47.    $nMsg = GUIGetMsg()
  48.    Switch $nMsg
  49.    Case $GUI_EVENT_CLOSE
  50.       Exit
  51.    case $Button1
  52.          saveto("data1.txt")
  53.    case $Button2
  54.          compare()
  55.    case $Button3
  56.          savecompare()
  57.    case $Button4
  58.         saveHW()
  59.    EndSwitch
  60.  
  61.          ;_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), $tRect, 0, BitOR($RDW_INVALIDATE, $RDW_ALLCHILDREN))
  62.    ;_WinAPI_DrawRect(910, 490, 160, 50, 0x008000)
  63.  
  64.    Sleep(10)
  65. WEnd
  66.  
  67. Func dev()
  68.    ;personal_check()
  69.    ;GUICtrlSetData($Edit1, "", 0)
  70.    ControlFocus ( $Form1, "", "Edit1" )
  71.    ControlSend($Form1, "", "Edit1", "^{END}")
  72. EndFunc
  73.  
  74. Func online_check()         ; проверка онлайна
  75.    ;$game_hWnd = "test.bmp"         ; test.bmp   "RAGЕ Multiрlаyer  "
  76.    WinActivate ( $Form1 )
  77.    ControlFocus ( $Form1, "", "Edit1" )
  78.    ControlSend($Form1, "", "Edit1", "^{END}")
  79.    $cleanup = 0
  80.    $scale = 1
  81.    $dbg = 0
  82.  
  83.    $2height = 450               ; 700 чем больше значение тем меньше по высоте. piztec kakoi-to    990
  84.    $2width = 1645               ; 1710                                                              1720
  85.  
  86.    ;_TesseractWinCapture("test.bmp", $win_text = "", $get_last_capture = 0, $delimiter = "", $cleanup = 1, $scale = 2, $left_indent = 0, $top_indent = 0, $right_indent = 0, $bottom_indent = 0, $show_capture = 0)
  87.    $users = _TesseractWinCapture($game_hWnd, "", 0, "", $cleanup, $scale, 900, 580, $2width, $2height, $dbg)
  88.  
  89.    $users = StringRegExpReplace($users, "(?m)^\s*$\R?", "")
  90.    ;$users = StringReplace($users, Asc(0), "")
  91.    $users = StringSplit($users, @CRLF)
  92.    $users_counter = 0
  93.  
  94.    For $i=1 to UBound($users)-1
  95.       ;;if Mod($i,2) = 0 Then           ; какой то символ ебаный добавляется, убрать не смог, тупо скипаю его
  96.          ;;;;ContinueLoop   ненадо, добавляются пустые строки и тогда это все ломает
  97.       ;;EndIf
  98.       if $users[$i] = Chr(0) then
  99.          ContinueLoop
  100.       EndIf
  101.       $users_counter = $users_counter + 1
  102.       ;ConsoleWrite($users[$i]&" "&Asc ( $users[$i] )&@CRLF)
  103.       ;$users[$i] = StringRegExpReplace($users[$i], @CR, "")
  104.       ;$users[$i] = StringRegExpReplace($users[$i], @LF, "")
  105.       ;$users[$i] = StringRegExpReplace($users[$i], @CRLF, "")
  106.       ;$users[$i] = StringRegExpReplace($users[$i], Asc(0), "")
  107.       GUICtrlSetData($Edit1, $users[$i]&@CRLF, 1)
  108.       Sleep(5)
  109.    Next
  110.    ;_ArrayDisplay($users)
  111.    ;ConsoleWrite(Asc ( $users[20] ))
  112.    ;msg($users)
  113.  
  114.    GUICtrlSetData($Edit1, "-------------------"&@CRLF, 1)
  115.    GUICtrlSetData($Label1, "readed lined: "&$users_counter, "")
  116.    if $users_counter < 8 then
  117.       GUICtrlSetBkColor($Label1, "0xFF0000")
  118.       Beep(100, 100)
  119.       Sleep(1000)
  120.       GUICtrlSetBkColor($Label1, $GUI_BKCOLOR_TRANSPARENT)
  121.    EndIf
  122.  
  123.    ;MsgBox(0,0,$users);
  124.    ;GUICtrlSetData($Edit1, $users  & @CRLF, 1)
  125.    ;$users = StringStripWS($users, 8)
  126. EndFunc
  127.  
  128. Func trade_check()
  129.    ;$game_hWnd = "test.bmp"         ; test.bmp   "RAGЕ Multiрlаyer  "
  130.    $cleanup = 0
  131.    $scale = 2
  132.    $dbg = 0
  133.  
  134.    $2height = 1000              ; 700 чем больше значение тем меньше по высоте. piztec kakoi-to    990
  135.    $2width = 1690               ; 1710                                                              1720
  136.  
  137.    $users = _TesseractWinCapture($game_hWnd, "", 0, "", $cleanup, $scale, 1650, 650, $2width, $2height, $dbg)       ; трейд со скрина 1000 1690
  138.    ;$users = _TesseractWinCapture($title, "", 0, "", $cleanup, $scale, 1610, 410, $2width, $2height, $dbg)      ; для чтения трейда  1050 1690
  139.    $users = StringReplace($users, "_", " ")
  140.  
  141.    GUICtrlSetData($Edit1, '')       ; cls editbox
  142.    GUICtrlSetData($Edit1, $users, 1)
  143.    GUICtrlSetData($Label1, "trade readed", "")
  144. EndFunc
  145.  
  146. func compare()
  147.    Local $data1[] = []
  148.    Local $data2[] = []
  149.    GUICtrlSetData($Edit1, '')       ; cls editbox
  150.    _FileReadToArray("data1.txt", $data1)
  151.    _FileReadToArray("data2.txt", $data2)
  152.  
  153.    local $chk = false
  154.  
  155.    For $i = 1 To UBound($data1)-1
  156.       For $i2 = 1 To UBound($data2)-1
  157.          if StringCompare ( StringLower($data1[$i]), StringLower($data2[$i2]) ) = 0 Then
  158.             $chk = true
  159.             ExitLoop
  160.          EndIf
  161.       Next
  162.       if $chk = false then
  163.          ;ConsoleWrite($data1[$i]&@CRLF)            ; <<< тот кто есть в data1 и нету в data2
  164.          msg($data1[$i])
  165.       EndIf
  166.       $chk = false
  167.    Next
  168.    GUICtrlSetData($Label1, "compare finished", "")
  169. EndFunc
  170.  
  171. func savetrade()
  172.    Local $hFileOpen = FileOpen("c:\bod\gta\perekli4ka\data2.txt", $FO_APPEND)
  173.    $name = ControlGetText ( $Form1, "", $Edit1 )
  174.    ;$name = StringRegExpReplace($name, "(?m)^\s*$\R?", "")
  175.    FileWriteLine($hFileOpen, $name)
  176.    FileClose($hFileOpen)
  177.    GUICtrlSetData($Label1, "trade saved for: "&$name, "")
  178. EndFunc
  179.  
  180. Func show($str)
  181.    ToolTip($str, 500, 500)
  182. EndFunc
  183.  
  184. Func stop()
  185.    exit
  186. EndFunc
  187.  
  188. func saveto($filename)
  189.    Local $hFileOpen = FileOpen("c:\bod\gta\perekli4ka\"&$filename, $FO_APPEND)
  190.    FileWriteLine($hFileOpen, ControlGetText ( $Form1, "", $Edit1 ))
  191.    FileClose($hFileOpen)
  192.    GUICtrlSetData($Label1, $filename&" saved", "")
  193. EndFunc
  194.  
  195. func savecompare()
  196.    Local $hFileOpen = FileOpen("c:\bod\gta\perekli4ka\compare_result.txt", $FO_APPEND)
  197.    FileWriteLine($hFileOpen, ControlGetText ( $Form1, "", $Edit1 ))
  198.    FileClose($hFileOpen)
  199.    GUICtrlSetData($Label1, "compare saved", "")
  200. EndFunc
  201.  
  202. Func msg($str)
  203.    GUICtrlSetData($Edit1, $str  & @CRLF, 1)
  204. EndFunc
  205.  
  206. func saveHW()
  207.    GUICtrlSetData($Label1, "activate window", "")
  208.    $tmp_title = WinGetHandle("[ACTIVE]")
  209.    for $i=0 to 6
  210.       if WinGetHandle("[ACTIVE]") <> $tmp_title then
  211.          ExitLoop
  212.       EndIf
  213.       Sleep(500)
  214.    Next
  215.    $game_hWnd = WinGetHandle("[ACTIVE]")
  216.    ConsoleWrite(WinGetTitle($game_hWnd))
  217.    GUICtrlSetData($Label1, "hWnd title: "&WinGetTitle($game_hWnd), "")
  218. EndFunc
  219.  
  220. Func calncetrade()
  221.    if PixelGetColor ( 998, 744 , $game_hWnd ) = 0x1D2634 then           ; we in trade?
  222.       ;MouseClick("left", 0, 500, 0)
  223.       Send("{ESC}")
  224.    Else
  225.       Send("{y}")
  226.    EndIf
  227. EndFunc
  228.  
  229. ; ///////////////////////////////// UNUSED ///////////////////////////////////////
  230.  
  231. Func zaplatka($name)
  232.    $names = ObjCreate("Scripting.Dictionary")
  233.    $names.Add ("test11", "test2")
  234.    ConsoleWrite($names.Item($name));
  235. EndFunc
  236.  
  237. Func _WinAPI_DrawRect($start_x, $start_y, $iWidth, $iHeight, $iColor)
  238.     Local $hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop)
  239.     $tRect = DllStructCreate($tagRECT)
  240.     DllStructSetData($tRect, 1, $start_x)
  241.     DllStructSetData($tRect, 2, $start_y)
  242.     DllStructSetData($tRect, 3, $iWidth + $start_x) ;  x-coordinate of the lower-right corner of the rectangle
  243.     DllStructSetData($tRect, 4, $iHeight + $start_y) ;  y-coordinate of the lower-right corner of the rectangle
  244.     Local $hBrush = _WinAPI_CreateSolidBrush($iColor)
  245.  
  246.     _WinAPI_FrameRect($hDC, DllStructGetPtr($tRect), $hBrush)
  247.  
  248.     ; clear resources
  249.     _WinAPI_DeleteObject($hBrush)
  250.     _WinAPI_ReleaseDC(0, $hDC)
  251.  EndFunc   ;==>_WinAPI_DrawRect
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement