diff --git a/MeoAssistance/include/Configer.h b/MeoAssistance/include/Configer.h index 068762f77b..2629627e48 100644 --- a/MeoAssistance/include/Configer.h +++ b/MeoAssistance/include/Configer.h @@ -46,6 +46,7 @@ namespace asst { int exec_times = 0; int max_times = INT_MAX; std::vector exceeded_next; + std::vector reduce_other_times; asst::Rect specific_area; int pre_delay = 0; int rear_delay = 0; diff --git a/MeoAssistance/src/Assistance.cpp b/MeoAssistance/src/Assistance.cpp index 59d2878bf4..e40969581e 100644 --- a/MeoAssistance/src/Assistance.cpp +++ b/MeoAssistance/src/Assistance.cpp @@ -190,6 +190,9 @@ void Assistance::workingProc(Assistance* pThis) break; } ++task.exec_times; + for (auto&& reduce : task.reduce_other_times) { + --Configer::m_tasks[reduce].exec_times; + } if (task.rear_delay > 0) { DebugTrace("RearDelay", task.rear_delay); // std::this_thread::sleep_for(std::chrono::milliseconds(task.rear_delay)); diff --git a/MeoAssistance/src/Configer.cpp b/MeoAssistance/src/Configer.cpp index 6e5b07bd34..d3d27fea9d 100644 --- a/MeoAssistance/src/Configer.cpp +++ b/MeoAssistance/src/Configer.cpp @@ -104,6 +104,12 @@ bool Configer::reload() if (task_json.exist("rearDelay")) { task_info.rear_delay = task_json["rearDelay"].as_integer(); } + if (task_json.exist("reduceOtherTimes")) { + auto reduce_arr = task_json["reduceOtherTimes"].as_array(); + for (auto&& reduce : reduce_arr) { + task_info.reduce_other_times.emplace_back(reduce.as_string()); + } + } auto next_arr = task_json["next"].as_array(); diff --git a/MeoAsstGui/MainWindow.xaml.cs b/MeoAsstGui/MainWindow.xaml.cs index e378b615e9..f858970036 100644 --- a/MeoAsstGui/MainWindow.xaml.cs +++ b/MeoAsstGui/MainWindow.xaml.cs @@ -89,7 +89,11 @@ namespace MeoAsstGui private void textBox_useStone_TextChanged(object sender, TextChangedEventArgs e) { - AsstSetParam(p_asst, "task.maxTimes", "StoneConfirm", textBox_useStone.Text); + if (checkBox_useMedicine.IsChecked == true) + { + String text = textBox_useStone.Text != String.Empty ? textBox_useStone.Text : "0"; + AsstSetParam(p_asst, "task.maxTimes", "StoneConfirm", text); + } } private void checkBox_useStone_Checked(object sender, RoutedEventArgs e) @@ -129,7 +133,8 @@ namespace MeoAsstGui { if (checkBox_maxTimes.IsChecked == true) { - AsstSetParam(p_asst, "task.maxTimes", "StartButton1", textBox_maxTimes.Text); + String text = textBox_maxTimes.Text != String.Empty ? textBox_maxTimes.Text : "0"; + AsstSetParam(p_asst, "task.maxTimes", "StartButton1", text); } else { @@ -141,7 +146,8 @@ namespace MeoAsstGui { if (checkBox_maxTimes.IsChecked == true) { - AsstSetParam(p_asst, "task.maxTimes", "StartButton1", textBox_maxTimes.Text); + String text = textBox_maxTimes.Text != String.Empty ? textBox_maxTimes.Text : "0"; + AsstSetParam(p_asst, "task.maxTimes", "StartButton1", text); } } } diff --git a/resource/config.json b/resource/config.json index 7bab7e7fea..35ccffdd1d 100644 --- a/resource/config.json +++ b/resource/config.json @@ -291,6 +291,7 @@ "MedicineConfirm": { "filename": "MedicineConfirm.png", "type": "clickSelf", + "reduceOtherTimes": [ "StartButton1" ], "next": [ "StartButton1" ] @@ -306,6 +307,7 @@ "filename": "MedicineConfirm.png", "type": "clickSelf", "maxTimes": 0, + "reduceOtherTimes": [ "StartButton1" ], "next": [ "StartButton1" ] @@ -320,6 +322,7 @@ "AbandonAction": { "filename": "AbandonAction.png", "type": "clickSelf", + "reduceOtherTimes": [ "StartButton1", "StartButton2", "Loading" ], "next": [ "Random" ]