Ver código fonte

!2 fix auto cure by cureNum

pcacc 4 meses atrás
pai
commit
78ea0021dd

+ 5 - 1
app_dongri.py

@@ -228,10 +228,12 @@ def auto_palace():
     global g_times, g_cureNum
     timeout = 180 * 60
     start_time = time.time()  # 记录开始时间
+    read_cfg()
     while not event.is_set():
         if len(task_queue) < 4:
-            task_queue.appendleft(task_fight_enemy())
             task_queue.appendleft(task_cure(True, g_cureNum))
+            task_queue.appendleft(task_cure(True, g_cureNum))
+            task_queue.appendleft(task_fight_enemy())
 
         myTimeSleep_big()
         current_time = time.time()
@@ -416,9 +418,11 @@ def write_cfg(config):
     with open('config.json', 'w') as config_file:
         json.dump(config, config_file, indent=4)
 def read_cfg():
+    global g_cureNum
     try:
         with open('config.json', 'r') as config_file:
             config = json.load(config_file)
+            g_cureNum = config['cureNumber']
             return config
     except FileNotFoundError:
         print("配置文件不存在,请检查文件路径。")

BIN
dongri_img/special_activity/choose_zero.png


BIN
dongri_img/special_activity/done_immediately.png


BIN
dongri_img/special_activity/quick_choose.png


+ 3 - 0
dongri_pic.py

@@ -202,6 +202,9 @@ class special_activity_img:
     enemy = R'dongri_img\special_activity\enemy.png'
     mid_enemy_region = (289,416,311,433)
     first_enemy_region = (182,206,261,229)
+    done_immediately = R'dongri_img\special_activity\done_immediately.png'
+    quick_choose = R'dongri_img\special_activity\quick_choose.png'
+    choose_zero = R'dongri_img\special_activity\choose_zero.png'
 
 
 

+ 26 - 8
dongri_task.py

@@ -932,10 +932,23 @@ class task_cure(dongri_task):
         self.continueCure = continueCure
         self.cureNum = cureNum
     def run(self):
+        basic_operate.go_town()
         basic_operate.go_outside()
         if waitClickImg_noWait_withBool(check_img.soilder_cure, 2, 1) == False:
             return False
         
+        while waitFindImg_withBool(special_activity_img.done_immediately, 1, 0.5) == False:
+            if waitClickImg_noWait_withBool(special_activity_img.quick_choose, 1, 0.5) == False:
+                return False
+        
+        while waitFindImg_withBool(special_activity_img.done_immediately, 1, 0.5):
+            if waitClickImg_noWait_withBool(special_activity_img.choose_zero, 1, 0.5) == False:
+                return False
+            else:
+                myTimeSleep_big()
+                pcacc_mouse.input_string(str(self.cureNum))
+
+        
         if self.continueCure == False:
             if waitClickImg_noWait_withBool(check_img.cure, 2, 1) == False:
                 return False
@@ -944,10 +957,11 @@ class task_cure(dongri_task):
                 return False
         else:
             maxTryTimes = 50
-            while waitClickImg_noWait_withBool((check_img.cure, check_img.help4), 30, 1) and maxTryTimes >= 0:
+            while waitClickImg_noWait_withBool((check_img.cure, check_img.help4), 30, 0.2) and maxTryTimes >= 0:
                 maxTryTimes -= 1
                 continue
         
+        waitClickImg_noWait_withBool(check_img.help4, 1, 1)
 
         return True
 
@@ -1097,15 +1111,18 @@ class task_fight_enemy(dongri_task):
         if waitClickImg_noWait_withBool(special_activity_img.enemy, 2, 1) == False:
             return False
         
+        attackArr = [monster_img.attack, monster_img.attack2, monster_img.ranshuang_attack]
+        
         myTimeSleep_big()
         firstPos = get_yys_random_point(special_activity_img.first_enemy_region)
         pcacc_mouse.click(firstPos[0], firstPos[1])
-        myTimeSleep_big()
-        mid_enemy_pos = get_yys_random_point(special_activity_img.mid_enemy_region)
-        pcacc_mouse.click(mid_enemy_pos[0], mid_enemy_pos[1])
-        myTimeSleep_big()
+        while waitFindImg_withBool(attackArr, 2, 1) == False:
+            myTimeSleep_big()
+            mid_enemy_pos = get_yys_random_point(special_activity_img.mid_enemy_region)
+            pcacc_mouse.click(mid_enemy_pos[0], mid_enemy_pos[1])
+            myTimeSleep_big()
 
-        if waitClickImg_noWait_withBool([monster_img.attack, monster_img.attack2, monster_img.ranshuang_attack], 2, 1) == False:
+        if waitClickImg_noWait_withBool(attackArr, 2, 1) == False:
             return False
         if waitClickImg_noWait_withBool(monster_img.line1, 2, 1) == False:
             return False
@@ -1126,7 +1143,8 @@ class task_fight_enemy(dongri_task):
 
 
 if __name__ == '__main__':
-    #task_fight_enemy().run()
+    #task_cure(True, 85).run()
+    task_fight_enemy().run()
     #task_fight_ranshuang().run()
     #task_gotoTree().run()
     #task_fight_jina_only().run()
@@ -1143,7 +1161,7 @@ if __name__ == '__main__':
     #task_activity_lianmeng().run()
     #task_fight_yongbing(True).run()
     #task_collect([4,3,2,1]).run()
-    task_train("upgrade").run()
+    #task_train("upgrade").run()
     #task_information().run()
     #check_buildOrResearch().run()
     #task_checkDonata().run()

+ 15 - 0
scriptBase/mouseClick.py

@@ -70,6 +70,21 @@ class pcacc_mouse:
     def __init__(specifically):
         random.seed()
 
+    @staticmethod
+    def input_string(text):
+        print("input string : " + str(text))
+        for char in text:
+            # 获取字符的虚拟键码(大写字母或数字)
+            vk_code = win32api.VkKeyScan(char)
+            
+            # 按下键
+            win32api.keybd_event(vk_code & 0xff, 0, 0, 0)
+            time.sleep(0.05)  # 短暂延迟,确保系统处理
+            
+            # 释放键
+            win32api.keybd_event(vk_code & 0xff, 0, win32con.KEYEVENTF_KEYUP, 0)
+            time.sleep(0.05)
+
     @staticmethod
     def move_mouse(dst_x, dst_y, isQuick = False):
         random_range = 4