Advertisement
0816tony

POE_AutoReStart

Dec 15th, 2014
542
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QBasic 6.57 KB | None | 0 0
  1. Dimenv Counts
  2. DimEnv counts_min
  3. DimEnv StartTime
  4. DimEnv Custom
  5. Counts = ""
  6.  
  7. Event Form1.Load
  8.     Form1.Timer1.Enabled = 0
  9.     Counts = ""
  10.     Form1.Timer1.Interval = 1000
  11.      
  12. END Event
  13. Event Form1.Button1.Click
  14.     Form1.Timer1.Enabled = 0
  15.     Form1.Timer1.Enabled = 1
  16.     Form1.Logo.Picture = "Attachment:\Logo.bmp"
  17.    
  18. END Event
  19. Event Form1.Timer1.TIMER
  20.  
  21.     Counts = Counts + 1000
  22.     IF INT(counts) <= 60000 THEN
  23.         Form1.Label5.Caption = "秒鐘"
  24.         Form1.counts.Caption = counts / 1000
  25.     ELSE
  26.         Form1.Label5.Caption = "分鐘"
  27.         Form1.counts.Caption = INT(counts / 60000)
  28.     END IF
  29.     Custom = Form1.InputBox1.Text
  30.     Custom = INT(Custom)
  31.     counts_min = INT(counts / 60000)
  32. END Event
  33. ///////////////////////事件區/////////////////////////////
  34. time_restart = Form1.OptionBox1.Value
  35. auto_restart = Form1.OptionBox2.Value
  36.  
  37.  
  38. hwnd = Plugin.WINDOW.Find(0, "Path of Exile")
  39. CALL Plugin.WINDOW.Move(hwnd, 0, 0)
  40.  
  41.  
  42. IF time_restart = 1 THEN
  43.     CALL 重啟POE
  44.    
  45.     DO
  46.         WHILE custom = counts_min
  47.             //-----------------------------------------------------------------------------關閉EB
  48.             EB_windows = Plugin.WINDOW.Search("Exiled Bot")
  49.             EB = split(EB_windows, "|")
  50.             EBEX = Plugin.WINDOW.FindEx(EB(0), 0, "DirectUIHWND", 0)
  51.             CALL Plugin.Memory.TerminateProc(EBEX)
  52.             CALL Plugin.Memory.TerminateProc(EB(0))
  53.             //-----------------------------------------------------------------------------
  54.             Delay 500
  55.             //-----------------------------------------------------------------------------關閉POE
  56.             POE = Plugin.WINDOW.Find(0, "Path of Exile")
  57.             CALL Plugin.Memory.TerminateProc(POE)
  58.             //-----------------------------------------------------------------------------
  59.             Delay 15000
  60.             CALL 重啟POE
  61.             Counts = ""
  62.         WEND
  63.         Delay 30000
  64.     LOOP
  65. ELSEIF auto_restart = 1 THEN
  66.     DO
  67.         CALL 判斷POE
  68.         Delay 15000
  69.         CALL 重啟POE
  70.     LOOP
  71. END IF
  72.  
  73.  
  74. ///////////////////////副程式/////////////////////////////
  75.  
  76. CALL Plugin.WINDOW.Top(Hwnd, 0)
  77. CALL Plugin.WINDOW.Top(Hwnd, 1)
  78.  
  79.  
  80.  
  81. SUB 重啟POE
  82.     Rem A
  83.     TracePrint "重啟遊戲中..."
  84.     //-----------------------------------------------------------------------------重啟POE
  85.     hwnd = Plugin.WINDOW.Find(0, "Path of Exile")
  86.     sWindow = Plugin.WINDOW.IsWindow(Hwnd)
  87.     IF sWindow = 0 THEN
  88.         hwnd2 = Plugin.WINDOW.Find("UIHOST", 0)
  89.         CALL Plugin.WINDOW.Show(Hwnd2)
  90.         CALL Plugin.Bkgnd.LeftClick(hwnd2, 308, 578)
  91.         Delay 10000
  92.         hwnd = Plugin.WINDOW.Find(0, "Path of Exile")
  93.         CALL Plugin.WINDOW.Move(hwnd, 0, 0)
  94.     END IF
  95.     //-----------------------------------------------------------------------------
  96.     //-----------------------------------------------------------------------------判斷進入POE
  97.     FindPic 623, 592, 803, 627, "Attachment:\open2.bmp", 0.8, int2X, int2Y
  98.     FindPic 512, 560, 569, 603, "Attachment:\shop.bmp", 0.8, gameX, gameY
  99.     DO UNTIL int2X > 0 AND int2Y > 0
  100.         TracePrint "Loading...中"
  101.         hwnd = Plugin.WINDOW.Find(0, "Path of Exile")
  102.         CALL Plugin.WINDOW.Top(hwnd, 0)
  103.         sWindow = Plugin.WINDOW.IsWindow(Hwnd)
  104.         IF sWindow = 0
  105.             GOTO A
  106.         END IF
  107.         Delay 3000
  108.         IF gameX > 0 THEN
  109.             EXIT DO
  110.         END IF
  111.         FindPic 623, 592, 803, 627, "Attachment:\open2.bmp", 0.8, int2X, int2Y
  112.         FindPic 512,560,569,603,"Attachment:\shop.bmp",0.8,gameX,gameY
  113.     LOOP
  114.     //-----------------------------------------------------------------------------
  115.     CALL restart_EB
  116.     hwnd = Plugin.WINDOW.Find(0, "Path of Exile")
  117.     CALL Plugin.WINDOW.Top(hwnd, 1)
  118.     Delay 3000
  119.     CALL Plugin.WINDOW.Move(hwnd, 0, 0)
  120. END SUB
  121. SUB 判斷POE
  122.     DO
  123.         TracePrint "POE進行中..."
  124.         //-----------------------------------------------------------------------------判斷POE崩潰OR不存在
  125.         POEprogram_crash = Plugin.WINDOW.Find(0, "Path of Exile")
  126.         POEprogram_crashEX = Plugin.WINDOW.FindEx(POEprogram_crash, 0, "DirectUIHWND", 0)
  127.         POE_Window = Plugin.WINDOW.IsWindow(POEprogram_crashEX)
  128.         POE_Window2 = Plugin.WINDOW.IsWindow(POEprogram_crash)
  129.         IF POE_Window = 1 OR POE_Window2 = 0 THEN
  130.             CALL 重啟POE
  131.         END IF
  132.         //-----------------------------------------------------------------------------
  133.         //-----------------------------------------------------------------------------判斷EB崩潰OR不存在
  134.         EB_Window2 = 1
  135.         EB_Window = 0
  136.         pre_EBprogram_crash = Plugin.WINDOW.Search("ExiledBot")
  137.         EBprogram_crash = split(pre_EBprogram_crash, "|")
  138.         EBprogram_crashEX = Plugin.WINDOW.FindEx(EBprogram_crash(0), 0, "DirectUIHWND", 0)
  139.         EB_Window = Plugin.WINDOW.IsWindow(EBprogram_crashEX)
  140.         EB_Window2 = Plugin.WINDOW.IsWindow(EBprogram_crash(0))
  141.         TracePrint EB_Window2
  142.         IF EB_Window  = 1 OR EB_Window2 = 0 THEN
  143.             CALL Plugin.Memory.TerminateProc(EBprogram_crashEX)
  144.             Delay 3000
  145.             CALL restart_EB
  146.         END IF
  147.         //-----------------------------------------------------------------------------
  148.         //-----------------------------------------------------------------------------判斷斷線
  149.         FindPic 623,592,803,627,"Attachment:\open.bmp",0.8,intX,intY
  150.         IF intX > 0 AND intY > 0 THEN
  151.             CALL Plugin.Memory.TerminateProc(POEprogram_crash)
  152.             TracePrint "POE斷線..."
  153.             EXIT DO
  154.         END IF
  155.         //-----------------------------------------------------------------------------
  156.         Delay 30000
  157.     LOOP
  158. END SUB
  159. SUB restart_EB
  160.     TracePrint "重啟EB中..."
  161.     sWindow3 = 0
  162.     Delay 3000
  163.     //-----------------------------------------------------------------------------啟動EB
  164.     EB_windows = Plugin.WINDOW.Search("Exiled Bot")
  165.     EB = split(EB_windows, "|")
  166.     sWindow3 = Plugin.WINDOW.IsWindow(EB(0))
  167.     TracePrint EB(0)
  168.     TracePrint sWindow3
  169.     IF sWindow3 = 0 THEN
  170.         RunApp Form1.BrowseBox1.Path
  171.     END IF
  172.     //-----------------------------------------------------------------------------
  173.     Delay 5000
  174.     EB_windows = Plugin.WINDOW.Search("Exiled Bot")
  175.     EB = split(EB_windows,"|")
  176.     HwndEx = Plugin.WINDOW.FindEx(EB(0), 0, "Button", "Start bot")
  177.     CALL Plugin.Bkgnd.Leftclick(HwndEx, 10, 10)
  178.     Delay 3000
  179.     hwnd = Plugin.WINDOW.Find(0, "Path of Exile")
  180.     CALL Plugin.WINDOW.Move(hwnd, 0, 0)
  181. END SUB
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement