mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 18:20:39 +08:00
fix: 自动战斗-战斗列表使用错误的作业战斗
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#include "Utils/Logger.hpp"
|
||||
#include "Utils/Platform.hpp"
|
||||
|
||||
#include "Arknights-Tile-Pos/TileCalc2.hpp"
|
||||
|
||||
asst::CopilotTask::CopilotTask(const AsstCallback& callback, Assistant* inst) :
|
||||
InterfaceTask(callback, inst, TaskType),
|
||||
m_multi_copilot_plugin_ptr(std::make_shared<MultiCopilotTaskPlugin>(callback, inst, TaskType)),
|
||||
@@ -22,6 +24,7 @@ asst::CopilotTask::CopilotTask(const AsstCallback& callback, Assistant* inst) :
|
||||
LogTraceFunction;
|
||||
|
||||
m_multi_copilot_plugin_ptr->set_retry_times(0);
|
||||
m_multi_copilot_plugin_ptr->set_battle_task_ptr(m_battle_task_ptr);
|
||||
m_subtasks.emplace_back(m_multi_copilot_plugin_ptr);
|
||||
|
||||
auto start_1_tp = std::make_shared<ProcessTask>(callback, inst, TaskType);
|
||||
@@ -128,8 +131,7 @@ bool asst::CopilotTask::set_params(const json::value& params)
|
||||
return false;
|
||||
}
|
||||
m_stage_name = Copilot.get_stage_name();
|
||||
if (!m_battle_task_ptr->set_stage_name(m_stage_name)) {
|
||||
Log.error("Not support stage");
|
||||
if (auto result = Tile.find(m_stage_name); !result || !json::open(result->second)) {
|
||||
return false;
|
||||
}
|
||||
config_cvt.copilot_file = std::move(copilot_opt);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "Config/Miscellaneous/CopilotConfig.h"
|
||||
#include "Config/TaskData.h"
|
||||
#include "Task/Miscellaneous/BattleProcessTask.h"
|
||||
#include "Task/ProcessTask.h"
|
||||
#include "Utils/Logger.hpp"
|
||||
#include "Utils/Platform.hpp"
|
||||
@@ -14,7 +15,7 @@ bool asst::MultiCopilotTaskPlugin::_run()
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto& config = m_copilot_configs[m_index_current];
|
||||
const auto& config = m_copilot_configs[m_index_current++];
|
||||
|
||||
std::string file_name;
|
||||
if (std::holds_alternative<int>(config.copilot_file)) {
|
||||
@@ -35,6 +36,12 @@ bool asst::MultiCopilotTaskPlugin::_run()
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto& stage_name = Copilot.get_stage_name();
|
||||
if (!m_battle_task_ptr->set_stage_name(stage_name)) {
|
||||
Log.error("Not support stage");
|
||||
return false;
|
||||
}
|
||||
|
||||
json::value info = basic_info_with_what("CopilotListLoadTaskFileSuccess");
|
||||
info["details"]["stage_name"] = Copilot.get_stage_name();
|
||||
info["details"]["file_name"] = std::move(file_name);
|
||||
@@ -54,6 +61,5 @@ bool asst::MultiCopilotTaskPlugin::_run()
|
||||
ret = ret && ProcessTask(*this, { "RaidConfirm", "ChangeToRaidDifficulty" }).run();
|
||||
}
|
||||
|
||||
m_index_current++;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#pragma once
|
||||
#include "Task/AbstractTaskPlugin.h"
|
||||
#include "Task/AbstractTask.h"
|
||||
|
||||
#include <variant>
|
||||
|
||||
namespace asst
|
||||
{
|
||||
class BattleProcessTask;
|
||||
|
||||
class MultiCopilotTaskPlugin : public AbstractTask
|
||||
{
|
||||
public:
|
||||
@@ -21,10 +23,13 @@ public:
|
||||
|
||||
void set_multi_copilot_config(std::vector<MultiCopilotConfig> config) { m_copilot_configs = std::move(config); }
|
||||
|
||||
void set_battle_task_ptr(const std::shared_ptr<BattleProcessTask>& ptr) { m_battle_task_ptr = ptr; }
|
||||
|
||||
private:
|
||||
virtual bool _run() override;
|
||||
|
||||
std::vector<MultiCopilotConfig> m_copilot_configs;
|
||||
int m_index_current = 0; // 当前执行的索引
|
||||
std::shared_ptr<BattleProcessTask> m_battle_task_ptr = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user