瀏覽代碼

!2 add ranshuang function

pcacc 4 月之前
父節點
當前提交
fabfa58af0
共有 3 個文件被更改,包括 54 次插入7 次删除
  1. 22 0
      app_dongri.py
  2. 27 7
      dongri_task.py
  3. 5 0
      templates/index_dongri.html

+ 22 - 0
app_dongri.py

@@ -209,6 +209,23 @@ def auto_participate():
             handle_restart_game()
             break
 
+def auto_ranshuang():
+    timeout = 40 * 60
+    start_time = time.time()  # 记录开始时间
+    while not event.is_set():
+        if len(task_queue) < 4:
+            task_queue.appendleft(task_fight_ranshuang())
+
+        myTimeSleep_big()
+        current_time = time.time()
+        elapsed_time = current_time - start_time
+        
+        if elapsed_time >= timeout:
+            handle_restart_game()
+            break
+
+    
+
 def add_auto_task(isMaxCollect, isJina, isSimple = False, isAddStrengh = False, activity = 'None', isAutoParticipate = True, isDailyConfig = False, train_type = 'None', always = False):  
     global g_times, g_cureNum
     collectArr = [int(x) for x in isMaxCollect.split(",")]
@@ -459,6 +476,11 @@ def handle_auto_participate():
     send_status(f'开始自动集结模式')
     executor.submit(auto_participate)
 
+@socketio.on('begin_auto_ranshuang')
+def handle_auto_ranshuang():
+    global autoTask
+    send_status(f'开始自动燃霜')
+    executor.submit(auto_ranshuang)
 
 if __name__ == '__main__':
     init()

+ 27 - 7
dongri_task.py

@@ -84,7 +84,7 @@ class basic_operate:
         if ret:
             pcacc_mouse.click(pos[0] + 20, pos[1] + 80)
 
-
+    @staticmethod
     def backToGame(preTime = 0):
         tryMaxTimes = 5
         while tryMaxTimes > 0:
@@ -100,7 +100,7 @@ class basic_operate:
         if basic_operate.backToGame(preTime) == False:
             return False
 
-        waitClickImg_noWait_withBool(place_img.outside, 0.6, 0)
+        waitClickImg_noWait_withBool(place_img.outside, 0.6, 0.5)
         return True
     
     @staticmethod
@@ -108,7 +108,7 @@ class basic_operate:
         if basic_operate.backToGame(preTime) == False:
             return False
 
-        waitClickImg_noWait_withBool(place_img.town, 0.6, 0)
+        waitClickImg_noWait_withBool(place_img.town, 0.6, 0.5)
         return True
     
     @staticmethod
@@ -443,12 +443,14 @@ class task_fightMonster(dongri_task):
             else:
                 print("没有足够的体力了")
                 return False
+            
+        if self.add_strengh and basic_operate.get_line_num() >= 6:
+            return False
 
         if False == basic_operate.click_outside_search():
             return False
 
-        if self.add_strengh and basic_operate.get_line_num() >= 6:
-            return False
+        
         
         
         if waitFindImg_withBool(monster_img.search, 2, 1):
@@ -1038,6 +1040,24 @@ class task_visit_island(dongri_task):
         if waitClickImg_noWait_withBool(check_img.visit_island_big, 2, 1) == False:
             return False
         return True
+    
+class task_fight_ranshuang(dongri_task):
+    def __init__(self):
+        super().__init__(f"打燃霜")
+    def run(self):
+        basic_operate.backToGame()
+
+        if False == basic_operate.click_outside_search():#change to click ranshuang
+            return False
+
+        if waitClickImg_noWait_withBool(monster_img.attack, 2, 1) == False:
+            return False
+        
+        if waitClickImg_withBool([monster_img.fight, monster_img.fight2], 1, 1) == False:
+            return False
+        return True
+        
+
 
     
 
@@ -1053,11 +1073,11 @@ if __name__ == '__main__':
     #yys_ocrAuto(check_img.line_orc)
     #basic_operate.go_town()
     #basic_operate.add_strength()
-    #task_fightMonster(False, False,False).run()
+    task_fightMonster(False, False,False).run()
     #task_checkHelp().run()
     #task_checkStoreRoom().run()
     #task_activity_lianmeng().run()
-    task_fight_yongbing(True).run()
+    #task_fight_yongbing(True).run()
     #task_collect([4,3,2,1]).run()
     #task_train("lv9").run()
     #task_information().run()

+ 5 - 0
templates/index_dongri.html

@@ -94,6 +94,7 @@
             <label><input type="checkbox" id="always_checkbox"> 无尽运行</label>
         </div>
         <div class="operate-container">
+            <button class="custom-button" id="atuoRanshuang_btn" onclick="begin_ranshuang()">自动燃霜</button>
             <button class="custom-button" id="atuo_btn" onclick="begin_paticipate()">自动打熊</button>
             <button class="custom-button" id="resetScript_btn" onclick="reset_script()">重置脚本</button>
             <button class="custom-button" id="closegame_btn" onclick="close_game()">关闭游戏</button>
@@ -239,6 +240,10 @@
         function begin_paticipate(){
             socket.emit('begin_auto_participate');
         }
+
+        function begin_ranshuang(){
+            socket.emit('begin_auto_ranshuang')
+        }
         
         function restart_game()
         {