Advertisement
recca062

RO Auto Potion.ahk

Dec 26th, 2016
6,587
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Ragnarok Online Auto Potion 2016 - Recca - http://ragindex.blogspot.com/
  2. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  3. ; #Warn  ; Enable warnings to assist with detecting common errors.
  4. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  5. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  6. #SingleInstance Force
  7. if not A_IsAdmin
  8. {
  9.    Run *RunAs "%A_ScriptFullPath%"  ; Requires v1.0.92.01+
  10.    ExitApp
  11. }
  12. IfNotExist, ROAPscreenCapture.exe
  13. {
  14. batScript =
  15. (
  16. // 2>nul||@goto :batch
  17. /*
  18. :batch
  19. @echo off
  20. setlocal
  21.  
  22. :: find csc.exe
  23. set "csc="
  24. for /r "`%SystemRoot`%\Microsoft.NET\Framework\" `%`%# in ("*csc.exe") do  set "csc=`%`%#"
  25.  
  26. if not exist "`%csc`%" (
  27.    echo no .net framework installed
  28.    exit /b 10
  29. `)
  30.  
  31. if not exist "`%~n0.exe" (
  32.    call `%csc`% /nologo /r:"Microsoft.VisualBasic.dll" /out:"`%~n0.exe" "`%~dpsfnx0" || (
  33.       exit /b `%errorlevel`%
  34.    `)
  35. `)
  36. `%~n0.exe `%*
  37. endlocal & exit /b `%errorlevel`%
  38.  
  39. */
  40.  
  41. // reference  
  42. // https://gallery.technet.microsoft.com/scriptcenter/eeff544a-f690-4f6b-a586-11eea6fc5eb8
  43.  
  44. using System;
  45. using System.Runtime.InteropServices;
  46. using System.Drawing;
  47. using System.Drawing.Imaging;
  48. using System.Collections.Generic;
  49. using Microsoft.VisualBasic;
  50.  
  51.  
  52. /// Provides functions to capture the entire screen, or a particular window, and save it to a file.
  53.  
  54. public class ScreenCapture
  55. {
  56.  
  57.     /// Creates an Image object containing a screen shot the active window
  58.  
  59.     public Image CaptureActiveWindow()
  60.     {
  61.         return CaptureWindow(User32.GetForegroundWindow());
  62.     }
  63.  
  64.     /// Creates an Image object containing a screen shot of the entire desktop
  65.  
  66.     public Image CaptureScreen()
  67.     {
  68.         return CaptureWindow(User32.GetDesktopWindow());
  69.     }
  70.  
  71.     /// Creates an Image object containing a screen shot of a specific window
  72.  
  73.     private Image CaptureWindow(IntPtr handle)
  74.     {
  75.         // get te hDC of the target window
  76.         IntPtr hdcSrc = User32.GetWindowDC(handle);
  77.         // get the size
  78.         User32.RECT windowRect = new User32.RECT();
  79.         User32.GetWindowRect(handle, ref windowRect);
  80.         int width = windowRect.right - windowRect.left;
  81.         int height = windowRect.bottom - windowRect.top;
  82.         // create a device context we can copy to
  83.         IntPtr hdcDest = GDI32.CreateCompatibleDC(hdcSrc);
  84.         // create a bitmap we can copy it to,
  85.         // using GetDeviceCaps to get the width/height
  86.         IntPtr hBitmap = GDI32.CreateCompatibleBitmap(hdcSrc, width, height);
  87.         // select the bitmap object
  88.         IntPtr hOld = GDI32.SelectObject(hdcDest, hBitmap);
  89.         // bitblt over
  90.         GDI32.BitBlt(hdcDest, 0, 0, width, height, hdcSrc, 0, 0, GDI32.SRCCOPY);
  91.         // restore selection
  92.         GDI32.SelectObject(hdcDest, hOld);
  93.         // clean up
  94.         GDI32.DeleteDC(hdcDest);
  95.         User32.ReleaseDC(handle, hdcSrc);
  96.         // get a .NET image object for it
  97.         Image img = Image.FromHbitmap(hBitmap);
  98.         // free up the Bitmap object
  99.         GDI32.DeleteObject(hBitmap);
  100.         return img;
  101.     }
  102.  
  103.     public void CaptureActiveWindowToFile(string filename, ImageFormat format)
  104.     {
  105.         Image img = CaptureActiveWindow();
  106.         img.Save(filename, format);
  107.     }
  108.  
  109.     public void CaptureScreenToFile(string filename, ImageFormat format)
  110.     {
  111.         Image img = CaptureScreen();
  112.         img.Save(filename, format);
  113.     }
  114.  
  115.     static bool fullscreen = true;
  116.     static String file = "screenshot.bmp";
  117.     static System.Drawing.Imaging.ImageFormat format = System.Drawing.Imaging.ImageFormat.Bmp;
  118.     static String windowTitle = "";
  119.  
  120.     static void parseArguments()
  121.     {
  122.         String[] arguments = Environment.GetCommandLineArgs();
  123.         if (arguments.Length == 1)
  124.         {
  125.             printHelp();
  126.             Environment.Exit(0);
  127.         }
  128.         if (arguments[1].ToLower().Equals("/h") || arguments[1].ToLower().Equals("/help"))
  129.         {
  130.             printHelp();
  131.             Environment.Exit(0);
  132.         }
  133.  
  134.         file = arguments[1];
  135.         Dictionary<String, System.Drawing.Imaging.ImageFormat> formats =
  136.         new Dictionary<String, System.Drawing.Imaging.ImageFormat>();
  137.  
  138.         formats.Add("bmp", System.Drawing.Imaging.ImageFormat.Bmp);
  139.         formats.Add("emf", System.Drawing.Imaging.ImageFormat.Emf);
  140.         formats.Add("exif", System.Drawing.Imaging.ImageFormat.Exif);
  141.         formats.Add("jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
  142.         formats.Add("jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
  143.         formats.Add("gif", System.Drawing.Imaging.ImageFormat.Gif);
  144.         formats.Add("png", System.Drawing.Imaging.ImageFormat.Png);
  145.         formats.Add("tiff", System.Drawing.Imaging.ImageFormat.Tiff);
  146.         formats.Add("wmf", System.Drawing.Imaging.ImageFormat.Wmf);
  147.  
  148.  
  149.         String ext = "";
  150.         if (file.LastIndexOf('.') > -1)
  151.         {
  152.             ext = file.ToLower().Substring(file.LastIndexOf('.') + 1, file.Length - file.LastIndexOf('.') - 1);
  153.         }
  154.         else
  155.         {
  156.             Console.WriteLine("Invalid file name - no extension");
  157.             Environment.Exit(7);
  158.         }
  159.  
  160.         try
  161.         {
  162.             format = formats[ext];
  163.         }
  164.         catch (Exception e)
  165.         {
  166.             Console.WriteLine("Probably wrong file format:" + ext);
  167.             Console.WriteLine(e.ToString());
  168.             Environment.Exit(8);
  169.         }
  170.  
  171.  
  172.         if (arguments.Length > 2)
  173.         {
  174.             windowTitle = arguments[2];
  175.             fullscreen = false;
  176.         }
  177.  
  178.     }
  179.  
  180.     static void printHelp()
  181.     {
  182.         //clears the extension from the script name
  183.         String scriptName = Environment.GetCommandLineArgs()[0];
  184.         scriptName = scriptName.Substring(0, scriptName.Length);
  185.         Console.WriteLine(scriptName + " captures the screen or the active window and saves it to a file.");
  186.         Console.WriteLine("");
  187.         Console.WriteLine("Usage:");
  188.         Console.WriteLine(" " + scriptName + " filename  [WindowTitle]");
  189.         Console.WriteLine("");
  190.         Console.WriteLine("finename - the file where the screen capture will be saved");
  191.         Console.WriteLine("     allowed file extensions are - Bmp,Emf,Exif,Gif,Icon,Jpeg,Png,Tiff,Wmf.");
  192.         Console.WriteLine("WindowTitle - instead of capture whole screen you can point to a window ");
  193.         Console.WriteLine("     with a title which will put on focus and captuted.");
  194.         Console.WriteLine("     For WindowTitle you can pass only the first few characters.");
  195.         Console.WriteLine("     If don't want to change the current active window pass only \"\"");
  196.     }
  197.  
  198.     public static void Main()
  199.     {
  200.         parseArguments();
  201.         ScreenCapture sc = new ScreenCapture();
  202.         if (!fullscreen && !windowTitle.Equals(""))
  203.         {
  204.             try
  205.             {
  206.  
  207.                 Interaction.AppActivate(windowTitle);
  208.                 Console.WriteLine("setting " + windowTitle + " on focus");
  209.             }
  210.             catch (Exception e)
  211.             {
  212.                 Console.WriteLine("Probably there's no window like " + windowTitle);
  213.                 Console.WriteLine(e.ToString());
  214.                 Environment.Exit(9);
  215.             }
  216.  
  217.  
  218.         }
  219.         try
  220.         {
  221.             if (fullscreen)
  222.             {
  223.                 Console.WriteLine("Taking a capture of the whole screen to " + file);
  224.                 sc.CaptureScreenToFile(file, format);
  225.             }
  226.             else
  227.             {
  228.                 Console.WriteLine("Taking a capture of the active window to " + file);
  229.                 sc.CaptureActiveWindowToFile(file, format);
  230.             }
  231.         }
  232.         catch (Exception e)
  233.         {
  234.             Console.WriteLine("Check if file path is valid " + file);
  235.             Console.WriteLine(e.ToString());
  236.         }
  237.     }
  238.  
  239.     /// Helper class containing Gdi32 API functions
  240.  
  241.     private class GDI32
  242.     {
  243.  
  244.         public const int SRCCOPY = 0x00CC0020; // BitBlt dwRop parameter
  245.         [DllImport("gdi32.dll")]
  246.         public static extern bool BitBlt(IntPtr hObject, int nXDest, int nYDest,
  247.           int nWidth, int nHeight, IntPtr hObjectSource,
  248.           int nXSrc, int nYSrc, int dwRop);
  249.         [DllImport("gdi32.dll")]
  250.         public static extern IntPtr CreateCompatibleBitmap(IntPtr hDC, int nWidth,
  251.           int nHeight);
  252.         [DllImport("gdi32.dll")]
  253.         public static extern IntPtr CreateCompatibleDC(IntPtr hDC);
  254.         [DllImport("gdi32.dll")]
  255.         public static extern bool DeleteDC(IntPtr hDC);
  256.         [DllImport("gdi32.dll")]
  257.         public static extern bool DeleteObject(IntPtr hObject);
  258.         [DllImport("gdi32.dll")]
  259.         public static extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject);
  260.     }
  261.  
  262.  
  263.     /// Helper class containing User32 API functions
  264.  
  265.     private class User32
  266.     {
  267.         [StructLayout(LayoutKind.Sequential)]
  268.         public struct RECT
  269.         {
  270.             public int left;
  271.             public int top;
  272.             public int right;
  273.             public int bottom;
  274.         }
  275.         [DllImport("user32.dll")]
  276.         public static extern IntPtr GetDesktopWindow();
  277.         [DllImport("user32.dll")]
  278.         public static extern IntPtr GetWindowDC(IntPtr hWnd);
  279.         [DllImport("user32.dll")]
  280.         public static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDC);
  281.         [DllImport("user32.dll")]
  282.         public static extern IntPtr GetWindowRect(IntPtr hWnd, ref RECT rect);
  283.         [DllImport("user32.dll")]
  284.         public static extern IntPtr GetForegroundWindow();
  285.     }
  286. }
  287. )
  288. FileAppend, %batScript%, ROAPscreenCapture.bat
  289. Run, %comspec% /c ROAPscreenCapture.bat ,,Hide,cmdPID
  290. while !FileExist("ROAPscreenCapture.exe")
  291.     Sleep 10
  292. FileDelete, ROAPscreenCapture.bat
  293. screenCapture_check := 1
  294. }
  295. else
  296.     screenCapture_check := 1
  297. ;~ SetBatchLines -1
  298. ListLines Off
  299. ; LOAD INI
  300. IniRead, HP_Button, ROAP.ini, Hotkey, HP
  301. IniRead, SP_Button, ROAP.ini, Hotkey, SP
  302. IniRead, sendMode, ROAP.ini, Hotkey, SendMode
  303. IfInString, sendMode, control
  304.     sendMode = 1
  305. else
  306.     sendMode = 2
  307. IniRead, HP, ROAP.ini, Trigger, HP
  308. IniRead, SP, ROAP.ini, Trigger, SP
  309. IniRead, HP_Delay, ROAP.ini, Delay, HP
  310. IniRead, SP_Delay, ROAP.ini, Delay, SP
  311. IniRead, auto_HP, ROAP.ini, Checkbox, HP
  312. IniRead, auto_SP, ROAP.ini, Checkbox, SP
  313.  
  314. Gui, Color, 2b2b2b
  315. Gui, Font, cWhite
  316. Gui, Add, Text, x10 y15 vProcess w500, No process selected
  317. Gui, Add, ActiveX, xp y40 w350 h150 vWB +ReadOnly, Shell.Explorer
  318. WB.Navigate("about:blank")
  319. WB.silent := true
  320. Gui, Add, Groupbox, cBlue xp yp+160 w350 h80 vGroupbox
  321.  
  322. Gui, font, w1000
  323. if auto_HP
  324.     Gui, Add, Checkbox, xp+45 yp+25 +Checked c00FF00 vauto_HP, Auto HP
  325. else
  326.     Gui, Add, Checkbox, xp+45 yp+25 c00FF00 vauto_HP, Auto HP
  327. Gui, font, w8
  328. Gui, Add, Text, xp+80 yp, Press:
  329. StringRight, temp, HP_Button, 1
  330. Gui, Add, DropdownList, xp+38 yp-3 w50 +Choose%temp% vHP_Button,F1|F2|F3|F4|F5|F6|F7|F8|F9
  331. Gui, Add, Text, xp+58 yp+3, if HP <
  332. Gui, Add, Edit, xp+40 yp-3 vHP w40 cBlack +Number Limit2,
  333. Gui, Add, Updown, Range20-99, %HP%
  334. Gui, Add, Text, xp+45 yp+3, `%
  335.  
  336. Gui, font, w1000
  337. if auto_SP
  338.     Gui, Add, Checkbox, x55 yp+27 +Checked c00FFFF vauto_SP, Auto SP
  339. else
  340.     Gui, Add, Checkbox, x55 yp+27 c00FFFF vauto_SP, Auto SP
  341. Gui, font, w8
  342. Gui, Add, Text, xp+80 yp, Press:
  343. StringRight, temp, SP_Button, 1
  344. Gui, Add, DropdownList, xp+38 yp-3 w50 +Choose%temp% vSP_Button,F1|F2|F3|F4|F5|F6|F7|F8|F9
  345. Gui, Add, Text, xp+58 yp+3, if SP <
  346. Gui, Add, Edit, xp+40 yp-3 vSP w40 cBlack +Number Limit2,
  347. Gui, Add, Updown, Range20-99, %SP%
  348. Gui, Add, Text, xp+45 yp+3, `%
  349.  
  350. Gui, Add, Text,x246 y288 c00FF00 , HP-Delay:
  351. Gui, Add, Edit, xp+55 yp-4 +number w60 cBlack vHP_Delay, %HP_Delay%
  352. Gui, Add, Text,x246 y310 c00FFFF , SP-Delay:
  353. Gui, Add, Edit, xp+55 yp-4 +number w60 cBlack vSP_Delay, %SP_Delay%
  354.  
  355. Gui, Add, Text, x10 y310 +BackgroundTrans, CTRL + F1 - to select client`nCTRL + F5 - to start/stop auto potion
  356. Gui, Add, Link, xp yp+40 cBlack +BackgroundTrans, Credit / About:`nThis was made based on "Ragnarok Auto Potion" from `n<a href="http://www.garenathai.com">http://www.garenathai.com</a>
  357.  
  358. Gui, Add, Button, x280 y330 w80 h60 vstart gstart, Start`n(Ctrl+F5)
  359. Gui, Add, ActiveX, vAD x10 y395 w350 h100, Shell.Explorer
  360. AD.Navigate("http://textuploader.com/dd0f6/raw")
  361. AD.silent := true
  362.  
  363. Gui, +Resize
  364. guiW = 370
  365. guiH = 500
  366.  
  367. Gui, Show, w%guiW% h%guiH%, RO Auto Pot ( AHK Re-made) - http://ragindex.blogspot.com
  368. return
  369.  
  370. ~LButton::placeArrow("HP")
  371. ~RButton::placeArrow("SP")
  372. ^F1::
  373. if !screenCapture_check
  374. {
  375.     ToolTip, Making screenCapture.exe`, please wait.
  376.     SetTimer, removeTT, 500
  377.     return
  378. }
  379. FileDelete, ROAP.bmp
  380. WinGetActiveTitle, ActiveTitle
  381. GuiControl,, Process, %ActiveTitle%
  382. Run, %comspec% /c ROAPscreenCapture ROAP.bmp "%ActiveTitle%" ,,Hide,cmdPID
  383. html =
  384. (Ltrim Join
  385. <!doctype html>
  386. <html>
  387. <head>
  388.     <style>
  389.         body {
  390.             background-color: #2b2b2b;
  391.             margin: 0;
  392.             padding: 0;
  393.         }
  394.         img {
  395.           -moz-user-select: none;
  396.           -webkit-user-select: none;
  397.           -ms-user-select: none;
  398.           user-select: none;
  399.           -webkit-user-drag: none;
  400.           user-drag: none;
  401.           -webkit-touch-callout: none;
  402.         }
  403.         /* ========== Health Point -> Arrow  ==========*/
  404.         #arrow-HP1 {
  405.             position: absolute;
  406.             top: -100px;
  407.             left: -100px;
  408.             z-index: 999;
  409.             width: 0;
  410.             height: 0;
  411.             border-top: 5px solid transparent;
  412.             border-bottom: 5px solid transparent;
  413.             border-right: 5px solid red;
  414.         }
  415.         #arrow-HP2 {
  416.             position: absolute;
  417.             top: -100px;
  418.             left: -100px;
  419.             z-index: 999;
  420.             width: 20px;
  421.             height: 0px;
  422.             border: 1px solid red;
  423.         }
  424.         #arrow-HP3 {
  425.             position: absolute;
  426.             top: -100px;
  427.             left: -100px;
  428.             z-index: 999;
  429.             width: 0;
  430.             height: 0;
  431.             border-top: 5px solid transparent;
  432.             border-bottom: 5px solid transparent;
  433.             border-left: 5px solid red;
  434.         }
  435.        
  436.         /* ========== Mana Point -> Arrow  ==========*/
  437.         #arrow-SP1 {
  438.             position: absolute;
  439.             top: -100px;
  440.             left: -100px;
  441.             z-index: 999;
  442.             width: 0;
  443.             height: 0;
  444.             border-top: 5px solid transparent;
  445.             border-bottom: 5px solid transparent;
  446.             border-right: 5px solid blue;
  447.         }
  448.         #arrow-SP2 {
  449.             position: absolute;
  450.             top: -100px;
  451.             left: -100px;
  452.             z-index: 999;
  453.             width: 20px;
  454.             height: 0px;
  455.             border: 1px solid blue;
  456.         }
  457.         #arrow-SP3 {
  458.             position: absolute;
  459.             top: -100px;
  460.             left: -100px;
  461.             z-index: 999;
  462.             width: 0;
  463.             height: 0;
  464.             border-top: 5px solid transparent;
  465.             border-bottom: 5px solid transparent;
  466.             border-left: 5px solid blue;
  467.         }
  468.     </style>
  469.    
  470.     <script type="text/javascript">
  471.       function nocontext(e) {
  472.         var clickedTag = (e==null) ? event.srcElement.tagName : e.target.tagName;
  473.         if (clickedTag == "IMG")
  474.           return false;
  475.       }
  476.       document.oncontextmenu = nocontext;
  477.     </script>
  478. </head>
  479.  
  480. <body onmousemove ="showCoor(event)"onmouseout="clearCoor()">
  481.  
  482. <!-- HP / SP-->
  483. <div id="arrow-HP1"></div>
  484. <div id="arrow-HP2"></div>
  485. <div id="arrow-HP3"></div>
  486.  
  487. <div id="arrow-SP1"></div>
  488. <div id="arrow-SP2"></div>
  489. <div id="arrow-SP3"></div>
  490.  
  491. <!-- Info -->
  492. <p id="Coordinate" style="display: none;"></p>
  493.  
  494. <script>
  495.     function showCoor(event) {
  496.         var x, y;
  497.         if (event.pageX || event.pageY) {
  498.             x = event.pageX;
  499.             y = event.pageY;
  500.         }
  501.         else {
  502.             x = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
  503.             y = event.clientY + document.body.scrollTop + document.documentElement.scrollTop;
  504.         }
  505.         var coor = x + "," + y;
  506.         document.getElementById("Coordinate").innerHTML = coor;
  507.     }
  508.     function clearCoor() {
  509.         document.getElementById("Coordinate").innerHTML = "";
  510.     }
  511. </script>
  512.  
  513. <img src="%A_ScriptDir%\ROAP.bmp" draggable="false">
  514. </body>
  515. </html>
  516. )
  517. while !FileExist("ROAP.bmp")
  518.     Sleep 20
  519. WB.Navigate("about:blank")
  520. Sleep 50
  521. WB.Document.Write(html)
  522. html=
  523. return
  524. ^F5::
  525. start:
  526. if !ActiveTitle
  527. {
  528.     MsgBox, 262160, ERROR, No process selected
  529.     return
  530. }
  531. start := !start
  532. Gui, submit, nohide
  533. if start
  534. {
  535.     GuiControl,, start, Stop`n(Ctrl+F5)
  536.     ToolTip, STARTED
  537.     SetTimer, removeTT, On
  538.     WinGetPos, winX, winY,,, %ActiveTitle%
  539.     setMark("HP",HP)
  540.     setMark("SP",SP)
  541.     ; Identify white cell to  determine if @jump @refresh
  542.     whiteY := HP_Y
  543.     Loop
  544.     {
  545.         whiteY--
  546.         CoordMode, pixel, screen
  547.         PixelGetColor, whiteColor, HP_EndX, whiteY, RGB
  548.         if (whiteColor = "0xFFFFFF")
  549.             break
  550.     }
  551.     if auto_HP
  552.         SetTimer, HP_Watch, %HP_Delay%
  553.     if auto_SP
  554.         SetTimer, SP_Watch, %SP_Delay%
  555. }
  556. else
  557. {
  558.     GuiControl,, start, Start`n(Ctrl+F5)
  559.     ToolTip, STOPPED
  560.     SetTimer, removeTT, On
  561.     SetTimer, HP_Watch, Off
  562.     SetTimer, SP_Watch, Off
  563. }
  564. return
  565.  
  566. HP_Watch:
  567. IfWinNotActive, %ActiveTitle%
  568.     return
  569. CoordMode, pixel, screen
  570. PixelGetColor, HP_new_color, HP_WatchX, HP_WatchY, RGB
  571. PixelGetColor, whiteColor, HP_EndX, whiteY, RGB
  572. if (whiteColor != "0xFFFFFF")
  573. {
  574.     Sleep 1100
  575.     return
  576. }
  577. if (HP_new_color = "0x000000")
  578. {
  579.     Sleep 1100
  580.     return
  581. }
  582. else if (HP_new_color != HP_base_color)
  583.     if sendMode = 1
  584.         ControlSend,, {%HP_Button%}, %ActiveTitle%
  585.     else
  586.         Send, {%HP_Button%}
  587. return
  588.  
  589. SP_Watch:
  590. IfWinNotActive, %ActiveTitle%
  591.     return
  592. CoordMode, pixel, screen
  593. PixelGetColor, SP_new_color, SP_WatchX, SP_WatchY, RGB
  594. PixelGetColor, whiteColor, HP_EndX, whiteY, RGB
  595. if (whiteColor != "0xFFFFFF")
  596. {
  597.     Sleep 1100
  598.     return
  599. }
  600. if (SP_new_color = "0x000000")
  601. {
  602.     Sleep 1100
  603.     return
  604. }
  605. else if (SP_new_color != SP_base_color)
  606.     if sendMode = 1
  607.         ControlSend,, {%SP_Button%}, %ActiveTitle%
  608.     else
  609.         Send, {%SP_Button%}
  610. return
  611.  
  612. removeTT:
  613. Sleep 500
  614. ToolTip
  615. SetTimer, removeTT, Off
  616. return
  617.  
  618. GuiSize:
  619. WB_w := A_GuiWidth - 20
  620. GuiControl, Move, WB, x10 y40 w%WB_w%
  621. GuiControl, Move, Groupbox, x10 y200 w%WB_w%
  622. return
  623.  
  624. GuiClose:
  625. FileDelete, ROAP.bmp
  626. Gui, submit, nohide
  627. IniWrite, %HP_Button%, ROAP.ini, Hotkey, HP
  628. IniWrite, %SP_Button%, ROAP.ini, Hotkey, SP
  629. IniWrite, %HP%, ROAP.ini, Trigger, HP
  630. IniWrite, %SP%, ROAP.ini, Trigger, SP
  631. IniWrite, %HP_Delay%, ROAP.ini, Delay, HP
  632. IniWrite, %SP_Delay%, ROAP.ini, Delay, SP
  633. IniWrite, %auto_HP%, ROAP.ini, Checkbox, HP
  634. IniWrite, %auto_SP%, ROAP.ini, Checkbox, SP
  635. ExitApp
  636. ;============= FUNCTION
  637. setMark(HP_SP,mark) {
  638.     global
  639.     %HP_SP%_mark := Round(((%HP_SP%_EndX - %HP_SP%_StartX) / 100)*mark,0)
  640.     %HP_SP%_WatchX := winX + %HP_SP%_StartX + %HP_SP%_mark
  641.     %HP_SP%_WatchY := winY + %HP_SP%_Y
  642.     ; Check if mark is 0x000000 if so move over to right
  643.     PixelGetColor, check_mark, %HP_SP%_WatchX, %HP_SP%_WatchY, RGB
  644.     Loop
  645.         if (check_mark = "0x000000")
  646.             %HP_SP%_WatchX++
  647.         else
  648.             break
  649. }
  650. placeArrow(HP_SP) {
  651.     global wb, HP_StartX, HP_EndX, SP_StartX, SP_EndX, HP_base_color, SP_base_color, HP_Y, SP_Y
  652.     if wb.document.getElementById("Coordinate").innerHTML
  653.     {
  654.         ; store Coordinate
  655.         pageCoor := wb.document.getElementById("Coordinate").innerHTML
  656.         StringSplit, coor_, pageCoor, `,
  657.        
  658.         MouseGetPos, MouseX, MouseY
  659.         ; Move the arrow out of the way
  660.         WB.document.getElementById("arrow-" HP_SP "1").style.left := -100
  661.         WB.document.getElementById("arrow-" HP_SP "1").style.top := -100
  662.         WB.document.getElementById("arrow-" HP_SP "2").style.left := -100
  663.         WB.document.getElementById("arrow-" HP_SP "2").style.top := -100
  664.         WB.document.getElementById("arrow-" HP_SP "3").style.left := -100
  665.         WB.document.getElementById("arrow-" HP_SP "3").style.top := -100
  666.        
  667.         Sleep 50
  668.         PixelGetColor, %HP_SP%_base_color, %MouseX%, %MouseY%, RGB
  669.         ToolTip identifying %HP_SP% bar ...
  670.         if !ErrorLevel
  671.         {
  672.             ; Loop to the LEFT
  673.             tempX := MouseX
  674.             Loop
  675.             {
  676.                 tempX--
  677.                 PixelGetColor, color, %tempX%, %MouseY%, RGB
  678.                 if (color = "0x000000")
  679.                     continue
  680.                 if (%HP_SP%_base_color != color)
  681.                     break
  682.             }
  683.             ; Loop to the RIGHT
  684.             tempX1 := MouseX
  685.             Loop
  686.             {
  687.                 tempX1++
  688.                 PixelGetColor, color, %tempX1%, %MouseY%, RGB
  689.                 if (color = "0x000000")
  690.                     continue
  691.                 if (%HP_SP%_base_color != color)
  692.                     break
  693.             }
  694.             %HP_SP%_StartX := coor_1 - (MouseX - tempX)
  695.             %HP_SP%_EndX := %HP_SP%_StartX + (tempX1 - tempX)
  696.             %HP_SP%_Y :=  coor_2
  697.             ; Move arrow to coor
  698.             WB.document.getElementById("arrow-" HP_SP "1").style.left := coor_1 - (MouseX - tempX)
  699.             WB.document.getElementById("arrow-" HP_SP "1").style.top := coor_2 - 5
  700.            
  701.             WB.document.getElementById("arrow-" HP_SP "2").style.left := coor_1 - (MouseX - tempX)
  702.             WB.document.getElementById("arrow-" HP_SP "2").style.top := coor_2 - 1
  703.             WB.document.getElementById("arrow-" HP_SP "2").style.width := tempX1 - tempX
  704.            
  705.             WB.document.getElementById("arrow-" HP_SP "3").style.left := coor_1 + (tempX1 - MouseX)-4
  706.             WB.document.getElementById("arrow-" HP_SP "3").style.top := coor_2 - 5
  707.             ToolTip
  708.         }
  709.     }
  710. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement