Jelajahi Sumber

!2 add btn restart

pcacc 2 bulan lalu
induk
melakukan
f0bea69d9b
2 mengubah file dengan 13 tambahan dan 5 penghapusan
  1. 8 5
      app_dongri.py
  2. 5 0
      templates/index_dongri.html

+ 8 - 5
app_dongri.py

@@ -30,6 +30,7 @@ isReset = False
 g_times = 0
 g_cureNum = 500
 g_switch = False
+g_isRestart = True
 
 @app.after_request
 def add_no_cache_header(response):
@@ -255,7 +256,7 @@ def auto_palace():
     
 
 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, g_switch
+    global g_times, g_cureNum, g_switch, g_isRestart
     collectArr = [int(x) for x in isMaxCollect.split(",")]
     print("collectArr", collectArr)
     while not event.is_set():
@@ -390,11 +391,13 @@ def add_auto_task(isMaxCollect, isJina, isSimple = False, isAddStrengh = False,
         if g_switch:
             restart_times = 4
         if g_times == restart_times:
+            if g_isRestart:
+                handle_end_game()
             if always:
                 myTimeSleep(random.randint(350, 400), send_status)
             else:
-                handle_end_game()
                 myTimeSleep(random.randint(1000, 2000), send_status)
+            if g_isRestart:
                 handle_restart_game()
         else:
             if isAddStrengh:
@@ -539,7 +542,7 @@ def handle_auto(data):
     auto_task(config)
 
 def auto_task(data):
-    global autoTask, g_cureNum
+    global autoTask, g_cureNum,g_isRestart
     if data == None:
         isMaxCollect = '4,3,2,1'
         isSimple = False
@@ -553,8 +556,7 @@ def auto_task(data):
         cureNumber = 500
         lineCheck = False
         switch = False
-        
-        
+        g_isRestart = True
     else:
         isMaxCollect = data['maxCollect']
         isSimple = data['simple']
@@ -568,6 +570,7 @@ def auto_task(data):
         cureNumber = data['cureNumber']
         lineCheck = data['lineCheck']
         switch = data['switch']
+        g_isRestart = data['is_restart']
 
     g_cureNum = cureNumber
     g_switch = switch

+ 5 - 0
templates/index_dongri.html

@@ -94,6 +94,7 @@
             <label><input type="checkbox" id="AddStrenghCheckbox"> 是否添加体力</label>
             <label><input type="checkbox" id="participateJijieCheckbox"> 是否参与集结</label>
             <label><input type="checkbox" id="autoDaily_checkbox"> 自动每日</label>
+            <label><input type="checkbox" id="isRestart_checkbox"> 是否重启</label>
             <label><input type="checkbox" id="always_checkbox"> 无尽运行</label>
         </div>
         <div class="operate-container">
@@ -154,6 +155,7 @@
             const participateJijieCheckbox = document.getElementById('participateJijieCheckbox'); // 复选框
             const AcitivitySelect = document.getElementById('AcitivityCheckbox'); // 下拉列表 
             const autoDaily_checkbox = document.getElementById('autoDaily_checkbox'); // 复选框
+            const isRestart_checkbox = document.getElementById('isRestart_checkbox'); // 复选框
             const trainSelect = document.getElementById('trainCheckbox'); // 下拉列表
             const always_checkbox = document.getElementById('always_checkbox'); // 复选框
 
@@ -172,6 +174,7 @@
             AcitivitySelect.value = msg['activity']; // 设置下拉列表的值
             participateJijieCheckbox.checked = msg['participate_jijie']; // 设置复选框的状态
             autoDaily_checkbox.checked = msg['auto_daily']; // 设置复选框的状态
+            isRestart_checkbox.checked = msg['is_restart']; // 设置复选框的状态
             trainSelect.value = msg['train']; // 设置下拉列表的值
             always_checkbox.checked = msg['always']; // 设置复选框的状态
 
@@ -225,6 +228,7 @@
             const activityValue = document.getElementById('AcitivityCheckbox').value; // 获取下拉列表的值
             const participateJijie = document.getElementById('participateJijieCheckbox').checked; // 获取复选框的状态
             const autoDaily = document.getElementById('autoDaily_checkbox').checked; // 获取复选框的状态
+            const isRestart = document.getElementById('isRestart_checkbox').checked; // 获取复选框的状态
             const trainValue = document.getElementById('trainCheckbox').value; // 获取下拉列表的值
             const always = document.getElementById('always_checkbox').checked; // 获取复选框的状态
 
@@ -244,6 +248,7 @@
                 ,activity:activityValue
                 ,participate_jijie:participateJijie
                 ,auto_daily:autoDaily
+                ,is_restart:isRestart
                 ,train:trainValue
                 ,always:always
             });