diff --git a/include/AsstCaller.h b/include/AsstCaller.h index 9d86b0b3bc..90c5e884a1 100644 --- a/include/AsstCaller.h +++ b/include/AsstCaller.h @@ -20,7 +20,8 @@ extern "C" { bool ASSTAPI AsstCatchCustom(asst::Assistant* p_asst, const char* address); bool ASSTAPI AsstCatchFake(asst::Assistant* p_asst); - bool ASSTAPI AsstAppendFight(asst::Assistant* p_asst, int max_mecidine, int max_stone, int max_times); + bool ASSTAPI AsstAppendStartUp(asst::Assistant* p_asst); + bool ASSTAPI AsstAppendFight(asst::Assistant* p_asst, const char* stage, int max_mecidine, int max_stone, int max_times); bool ASSTAPI AsstAppendAward(asst::Assistant* p_asst); bool ASSTAPI AsstAppendVisit(asst::Assistant* p_asst); bool ASSTAPI AsstAppendMall(asst::Assistant* p_asst, bool with_shopping); diff --git a/resource/tasks.json b/resource/tasks.json index 2e59ae4134..9f88cbeb10 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -1,10 +1,65 @@ { - "SanityBegin": { + "StartUp": { + "algorithm": "justreturn", + "action": "doNothing", + "next": [ + "GameStart", + "StartToWakeUp", + "ReturnToTerminal", + "Terminal", + "CloseAnno", + "TodaysSupplies", + "OfflineConfirm" + ] + }, + "CE-5": { + "algorithm": "justreturn", + "action": "doNothing", + "next": [ + "StageResourceToCE5", + "StageCE", + "StageCE5" + ] + }, + "StageResourceToCE5": { + "template": "StageResource.png", + "roi": [ + 790, + 640, + 60, + 60 + ], + "action": "clickSelf", + "next": [ + "SwipeToStageCE" + ] + }, + "SwipeToStageCE": { + "algorithm": "justReturn", + "action": "swipeToTheLeft", + "next": [ + "StageCE" + ] + }, + "StageCE": { + "action": "clickSelf", + "next": [ + "StageCE5" + ] + }, + "StageCE5": { + "action": "clickSelf", + "roi": [ + 850, + 140, + 250, + 80 + ] + }, + "StageBegin": { "algorithm": "justreturn", "action": "doNothing", "next": [ - "UsePrts", - "StartButton1", "ReturnToTerminal", "PRTS", "EndOfAction", @@ -16,6 +71,14 @@ "GameStart" ] }, + "FightBegin": { + "algorithm": "justreturn", + "action": "doNothing", + "next": [ + "UsePrts", + "StartButton1" + ] + }, "GameStart": { "action": "clickSelf", "roi": [ @@ -381,7 +444,8 @@ "LastBattle", "Terminal", "CloseAnno", - "TodaysSupplies" + "TodaysSupplies", + "Stop" ] }, "TodaysSupplies": { @@ -410,8 +474,8 @@ "LastBattle": { "algorithm": "OcrDetect", "text": [ - "前往上", - "次作战" + "前往", + "作战" ], "roi": [ 900, diff --git a/resource/template/StageCE.png b/resource/template/StageCE.png new file mode 100644 index 0000000000..18aceb12cb Binary files /dev/null and b/resource/template/StageCE.png differ diff --git a/resource/template/StageCE5.png b/resource/template/StageCE5.png new file mode 100644 index 0000000000..2dcff0817e Binary files /dev/null and b/resource/template/StageCE5.png differ diff --git a/resource/template/StageResource.png b/resource/template/StageResource.png new file mode 100644 index 0000000000..ca0c185b44 Binary files /dev/null and b/resource/template/StageResource.png differ diff --git a/src/MeoAssistant/Assistant.cpp b/src/MeoAssistant/Assistant.cpp index 1869f4ab2a..c96e5e1f3b 100644 --- a/src/MeoAssistant/Assistant.cpp +++ b/src/MeoAssistant/Assistant.cpp @@ -150,7 +150,7 @@ bool asst::Assistant::catch_fake() return true; } -bool asst::Assistant::append_fight(int mecidine, int stone, int times, bool only_append) +bool asst::Assistant::append_start_up(bool only_append) { LogTraceFunction; if (!m_inited) { @@ -160,11 +160,9 @@ bool asst::Assistant::append_fight(int mecidine, int stone, int times, bool only std::unique_lock lock(m_mutex); auto task_ptr = std::make_shared(task_callback, (void*)this); - task_ptr->set_task_chain("Fight"); - task_ptr->set_tasks({ "SanityBegin" }); - task_ptr->set_times_limit("MedicineConfirm", mecidine); - task_ptr->set_times_limit("StoneConfirm", stone); - task_ptr->set_times_limit("StartButton1", times); + task_ptr->set_task_chain("StartUp"); + task_ptr->set_tasks({ "StartUp" }); + task_ptr->set_times_limit("Terminal", 0); m_tasks_queue.emplace(task_ptr); @@ -175,6 +173,47 @@ bool asst::Assistant::append_fight(int mecidine, int stone, int times, bool only return true; } +bool asst::Assistant::append_fight(const std::string& stage, int mecidine, int stone, int times, bool only_append) +{ + LogTraceFunction; + if (!m_inited) { + return false; + } + + constexpr const char* TaskChain = "Fight"; + + // 进入选关界面(主界面的“终端”点进去) + auto terminal_task_ptr = std::make_shared(task_callback, (void*)this); + terminal_task_ptr->set_task_chain(TaskChain); + terminal_task_ptr->set_tasks({ "StageBegin" }); + terminal_task_ptr->set_times_limit("LastBattle", 0); + + // 进入对应的关卡 + auto stage_task_ptr = std::make_shared(task_callback, (void*)this); + stage_task_ptr->set_task_chain(TaskChain); + stage_task_ptr->set_tasks({ stage }); + + // 开始战斗任务 + auto fight_task_ptr = std::make_shared(task_callback, (void*)this); + fight_task_ptr->set_task_chain(TaskChain); + fight_task_ptr->set_tasks({ "FightBegin" }); + fight_task_ptr->set_times_limit("MedicineConfirm", mecidine); + fight_task_ptr->set_times_limit("StoneConfirm", stone); + fight_task_ptr->set_times_limit("StartButton1", times); + + std::unique_lock lock(m_mutex); + + m_tasks_queue.emplace(terminal_task_ptr); + m_tasks_queue.emplace(stage_task_ptr); + m_tasks_queue.emplace(fight_task_ptr); + + if (!only_append) { + return start(false); + } + + return true; +} + bool asst::Assistant::append_award(bool only_append) { return append_process_task("AwardBegin", "Award"); diff --git a/src/MeoAssistant/Assistant.h b/src/MeoAssistant/Assistant.h index b171b3569c..e39592c67e 100644 --- a/src/MeoAssistant/Assistant.h +++ b/src/MeoAssistant/Assistant.h @@ -38,8 +38,10 @@ namespace asst // 不实际进行捕获,调试用接口 bool catch_fake(); + // 添加开始游戏的任务(进入到主界面) + bool append_start_up(bool only_append = true); // 添加刷理智任务 - bool append_fight(int mecidine = 0, int stone = 0, int times = INT_MAX, bool only_append = true); + bool append_fight(const std::string& stage, int mecidine = 0, int stone = 0, int times = INT_MAX, bool only_append = true); // 添加领取日常任务奖励任务 bool append_award(bool only_append = true); // 添加访问好友任务 diff --git a/src/MeoAssistant/AsstCaller.cpp b/src/MeoAssistant/AsstCaller.cpp index 649a5e3c7d..bf10c9b52a 100644 --- a/src/MeoAssistant/AsstCaller.cpp +++ b/src/MeoAssistant/AsstCaller.cpp @@ -112,13 +112,22 @@ bool AsstCatchFake(asst::Assistant* p_asst) #endif // LOG_TRACE } -bool AsstAppendFight(asst::Assistant* p_asst, int max_mecidine, int max_stone, int max_times) +bool ASSTAPI AsstAppendStartUp(asst::Assistant* p_asst) { if (p_asst == nullptr) { return false; } - return p_asst->append_fight(max_mecidine, max_stone, max_times); + return p_asst->append_start_up(); +} + +bool AsstAppendFight(asst::Assistant* p_asst, const char* stage, int max_mecidine, int max_stone, int max_times) +{ + if (p_asst == nullptr) { + return false; + } + + return p_asst->append_fight(stage, max_mecidine, max_stone, max_times); } bool AsstAppendAward(asst::Assistant* p_asst) @@ -176,10 +185,10 @@ bool AsstAppendInfrast(asst::Assistant* p_asst, int work_mode, const char** orde order_vector.assign(order, order + order_size); return p_asst->append_infrast( - static_cast(work_mode), - order_vector, - uses_of_drones, - dorm_threshold); + static_cast(work_mode), + order_vector, + uses_of_drones, + dorm_threshold); } bool AsstAppendRecruit(asst::Assistant* p_asst, int max_times, const int select_level[], int select_len, const int confirm_level[], int confirm_len, bool need_refresh) diff --git a/src/MeoAssistant/Version.h b/src/MeoAssistant/Version.h index f914b077ba..81dc41b38a 100644 --- a/src/MeoAssistant/Version.h +++ b/src/MeoAssistant/Version.h @@ -2,5 +2,5 @@ namespace asst { - constexpr static const char* Version = "v2.4.2"; + constexpr static const char* Version = "v2.4.3"; } diff --git a/src/MeoAsstGui/Helper/AsstProxy.cs b/src/MeoAsstGui/Helper/AsstProxy.cs index 29a3c2bf9b..51f9a8ed57 100644 --- a/src/MeoAsstGui/Helper/AsstProxy.cs +++ b/src/MeoAsstGui/Helper/AsstProxy.cs @@ -35,7 +35,7 @@ namespace MeoAsstGui [DllImport("MeoAssistant.dll")] private static extern bool AsstCatchCustom(IntPtr ptr, string address); - [DllImport("MeoAssistant.dll")] private static extern bool AsstAppendFight(IntPtr ptr, int max_medicine, int max_stone, int max_times); + [DllImport("MeoAssistant.dll")] private static extern bool AsstAppendFight(IntPtr ptr, string stage, int max_medicine, int max_stone, int max_times); [DllImport("MeoAssistant.dll")] private static extern bool AsstAppendAward(IntPtr ptr); @@ -330,9 +330,9 @@ namespace MeoAsstGui } } - public bool AsstAppendFight(int max_medicine, int max_stone, int max_times) + public bool AsstAppendFight(string stage, int max_medicine, int max_stone, int max_times) { - return AsstAppendFight(_ptr, max_medicine, max_stone, max_times); + return AsstAppendFight(_ptr, stage, max_medicine, max_stone, max_times); } public bool AsstAppendAward() diff --git a/src/MeoAsstGui/UserControl/FightSettingsUserControl.xaml b/src/MeoAsstGui/UserControl/FightSettingsUserControl.xaml index f7f3363148..7276962396 100644 --- a/src/MeoAsstGui/UserControl/FightSettingsUserControl.xaml +++ b/src/MeoAsstGui/UserControl/FightSettingsUserControl.xaml @@ -7,15 +7,24 @@ xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding" mc:Ignorable="d" xmlns:local="clr-namespace:MeoAsstGui" - d:DesignHeight="150" d:DesignWidth="300"> + d:DesignHeight="200" d:DesignWidth="300"> + - - + + + + + @@ -23,7 +32,7 @@ - + @@ -31,7 +40,7 @@ - + diff --git a/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs b/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs index d0e36ab65e..47219f725d 100644 --- a/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs +++ b/src/MeoAsstGui/ViewModels/TaskQueueViewModel.cs @@ -56,6 +56,10 @@ namespace MeoAsstGui } } TaskItemViewModels = new ObservableCollection(temp_order_list); + + StageList = new List(); + StageList.Add(new CombData { Display = "上次作战", Value = "LastBattle" }); + StageList.Add(new CombData { Display = "龙门币-5", Value = "CE-5" }); } public void AddLog(string content, string color = "Gray", string weight = "Regular") @@ -187,7 +191,7 @@ namespace MeoAsstGui } var asstProxy = _container.Get(); - return asstProxy.AsstAppendFight(medicine, stone, times); + return asstProxy.AsstAppendFight(Stage, medicine, stone, times); } private bool appendInfrast() @@ -288,6 +292,20 @@ namespace MeoAsstGui } } + public List StageList { get; set; } + + private string _stage = ViewStatusStorage.Get("MainFunction.Stage", "LastBattle"); + + public string Stage + { + get { return _stage; } + set + { + SetAndNotify(ref _stage, value); + ViewStatusStorage.Set("MainFunction.Stage", value); + } + } + private bool _useMedicine = System.Convert.ToBoolean(ViewStatusStorage.Get("MainFunction.UseMedicine", bool.TrueString)); public bool UseMedicine diff --git a/tools/TestCaller/main.cpp b/tools/TestCaller/main.cpp index 8055c53beb..44ec4e1624 100644 --- a/tools/TestCaller/main.cpp +++ b/tools/TestCaller/main.cpp @@ -5,18 +5,18 @@ #include -const char* get_cur_dir() +std::string get_cur_dir() { char exepath_buff[_MAX_PATH] = { 0 }; ::GetModuleFileNameA(NULL, exepath_buff, _MAX_PATH); std::string exepath(exepath_buff); std::string cur_dir = exepath.substr(0, exepath.find_last_of('\\') + 1); - return cur_dir.c_str(); + return cur_dir; } int main(int argc, char** argv) { - auto ptr = AsstCreate(get_cur_dir()); + auto ptr = AsstCreate(get_cur_dir().c_str()); auto ret = AsstCatchEmulator(ptr); if (!ret) { getchar(); @@ -29,12 +29,13 @@ int main(int argc, char** argv) char ch = 0; while (ch != 'q') { - //AsstAppendFight(ptr, 0, 0, 99999); + //AsstAppendStartUp(ptr); + AsstAppendFight(ptr, "CE-5", 0, 0, 99999); //AsstAppendVisit(ptr, true); - { - const int required[] = { 3, 4, 5, 6 }; - AsstStartRecruitCalc(ptr, required, sizeof(required) / sizeof(int), true); - } + //{ + // const int required[] = { 3, 4, 5, 6 }; + // AsstStartRecruitCalc(ptr, required, sizeof(required) / sizeof(int), true); + //} //AsstAppendDebug(ptr); //{ // const char* order[] = { "Trade", "Mfg", "Dorm" };