mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 02:10:21 +08:00
chore.重命名抄作业类
This commit is contained in:
@@ -12,12 +12,12 @@ void asst::BattleFormationTask::set_stage_name(std::string name)
|
||||
|
||||
bool asst::BattleFormationTask::_run()
|
||||
{
|
||||
const auto& battle = Resrc.battle();
|
||||
if (!battle.contains_actions(m_stage_name)) {
|
||||
const auto& copilot = Resrc.copilot();
|
||||
if (!copilot.contains_actions(m_stage_name)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_groups = battle.get_actions(m_stage_name).groups;
|
||||
m_groups = copilot.get_actions(m_stage_name).groups;
|
||||
if (m_groups.empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -49,13 +49,13 @@ bool asst::BattleProcessTask::get_stage_info()
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto& battle = Resrc.battle();
|
||||
bool contains = battle.contains_actions(m_stage_name);
|
||||
const auto& copilot = Resrc.copilot();
|
||||
bool contains = copilot.contains_actions(m_stage_name);
|
||||
if (!contains) {
|
||||
return false;
|
||||
}
|
||||
|
||||
m_actions_group = battle.get_actions(m_stage_name);
|
||||
m_actions_group = copilot.get_actions(m_stage_name);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#include "BattleConfiger.h"
|
||||
#include "CopilotConfiger.h"
|
||||
|
||||
#include <meojson/json.hpp>
|
||||
|
||||
#include "Logger.hpp"
|
||||
|
||||
bool asst::BattleConfiger::parse(const json::value& json)
|
||||
bool asst::CopilotConfiger::parse(const json::value& json)
|
||||
{
|
||||
std::string stage_name = json.at("stage_name").as_string();
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
|
||||
namespace asst
|
||||
{
|
||||
class BattleConfiger : public AbstractConfiger
|
||||
class CopilotConfiger : public AbstractConfiger
|
||||
{
|
||||
public:
|
||||
virtual ~BattleConfiger() = default;
|
||||
virtual ~CopilotConfiger() = default;
|
||||
|
||||
bool contains_actions(const std::string& stage_name) const noexcept
|
||||
{
|
||||
@@ -6,37 +6,37 @@
|
||||
#include "BattleFormationTask.h"
|
||||
|
||||
asst::CopilotTask::CopilotTask(AsstCallback callback, void* callback_arg)
|
||||
: PackageTask(callback, callback_arg, TaskType),
|
||||
m_battle_task_ptr(std::make_shared<BattleProcessTask>(callback, callback_arg, TaskType)),
|
||||
m_formation_task_ptr(std::make_shared<BattleFormationTask>(callback, callback_arg, TaskType))
|
||||
: PackageTask(callback, callback_arg, TaskType),
|
||||
m_battle_task_ptr(std::make_shared<BattleProcessTask>(callback, callback_arg, TaskType)),
|
||||
m_formation_task_ptr(std::make_shared<BattleFormationTask>(callback, callback_arg, TaskType))
|
||||
{
|
||||
m_subtasks.emplace_back(m_formation_task_ptr);
|
||||
m_subtasks.emplace_back(m_formation_task_ptr);
|
||||
|
||||
auto start_task_ptr = std::make_shared<ProcessTask>(callback, callback_arg, TaskType);
|
||||
start_task_ptr->set_tasks({ "BattleStartNormal", "BattleStartRaid", "BattleStartExercise" });
|
||||
m_subtasks.emplace_back(start_task_ptr);
|
||||
auto start_task_ptr = std::make_shared<ProcessTask>(callback, callback_arg, TaskType);
|
||||
start_task_ptr->set_tasks({ "BattleStartNormal", "BattleStartRaid", "BattleStartExercise" });
|
||||
m_subtasks.emplace_back(start_task_ptr);
|
||||
|
||||
m_subtasks.emplace_back(m_battle_task_ptr);
|
||||
m_subtasks.emplace_back(m_battle_task_ptr);
|
||||
}
|
||||
|
||||
bool asst::CopilotTask::set_params(const json::value& params)
|
||||
{
|
||||
if (m_runned) {
|
||||
return false;
|
||||
}
|
||||
if (m_runned) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!params.contains("stage_name") || !params.at("stage_name").is_string()) {
|
||||
return false;
|
||||
}
|
||||
std::string stage_name = params.at("stage_name").as_string();
|
||||
if (!params.contains("stage_name") || !params.at("stage_name").is_string()) {
|
||||
return false;
|
||||
}
|
||||
std::string stage_name = params.at("stage_name").as_string();
|
||||
|
||||
m_battle_task_ptr->set_stage_name(stage_name);
|
||||
m_formation_task_ptr->set_stage_name(stage_name);
|
||||
m_battle_task_ptr->set_stage_name(stage_name);
|
||||
m_formation_task_ptr->set_stage_name(stage_name);
|
||||
|
||||
bool with_formation = params.get("formation", false);
|
||||
m_formation_task_ptr->set_enable(with_formation);
|
||||
bool with_formation = params.get("formation", false);
|
||||
m_formation_task_ptr->set_enable(with_formation);
|
||||
|
||||
std::string filename = params.get("filename", std::string());
|
||||
// 文件名为空时,不加载资源,直接返回 true
|
||||
return filename.empty() || Resrc.battle().load(filename);
|
||||
}
|
||||
std::string filename = params.get("filename", std::string());
|
||||
// 文件名为空时,不加载资源,直接返回 true
|
||||
return filename.empty() || Resrc.copilot().load(filename);
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
<ClInclude Include="AsstMsg.h" />
|
||||
<ClInclude Include="AutoRecruitTask.h" />
|
||||
<ClInclude Include="AwardTask.h" />
|
||||
<ClInclude Include="BattleConfiger.h" />
|
||||
<ClInclude Include="CopilotConfiger.h" />
|
||||
<ClInclude Include="BattleFormationTask.h" />
|
||||
<ClInclude Include="BattleImageAnalyzer.h" />
|
||||
<ClInclude Include="BattleProcessTask.h" />
|
||||
@@ -98,7 +98,7 @@
|
||||
<ClCompile Include="AbstractTaskPlugin.cpp" />
|
||||
<ClCompile Include="AutoRecruitTask.cpp" />
|
||||
<ClCompile Include="AwardTask.cpp" />
|
||||
<ClCompile Include="BattleConfiger.cpp" />
|
||||
<ClCompile Include="CopilotConfiger.cpp" />
|
||||
<ClCompile Include="BattleFormationTask.cpp" />
|
||||
<ClCompile Include="BattleImageAnalyzer.cpp" />
|
||||
<ClCompile Include="BattleProcessTask.cpp" />
|
||||
|
||||
@@ -303,7 +303,7 @@
|
||||
<ClInclude Include="ReplenishOriginiumShardTaskPlugin.h">
|
||||
<Filter>头文件\Task\Plugin</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BattleConfiger.h">
|
||||
<ClInclude Include="CopilotConfiger.h">
|
||||
<Filter>头文件\Resource</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BattleProcessTask.h">
|
||||
@@ -518,7 +518,7 @@
|
||||
<ClCompile Include="ReplenishOriginiumShardTaskPlugin.cpp">
|
||||
<Filter>源文件\Task\Plugin</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BattleConfiger.cpp">
|
||||
<ClCompile Include="CopilotConfiger.cpp">
|
||||
<Filter>源文件\Resource</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BattleProcessTask.cpp">
|
||||
|
||||
@@ -20,7 +20,7 @@ bool asst::Resource::load(const std::string& dir)
|
||||
constexpr static const char* RecruitCfgFilename = "recruit.json";
|
||||
constexpr static const char* ItemCfgFilename = "item_index.json";
|
||||
constexpr static const char* InfrastCfgFilename = "infrast.json";
|
||||
constexpr static const char* BattleCfgDirname = "copilot";
|
||||
constexpr static const char* CopilotCfgDirname = "copilot";
|
||||
constexpr static const char* OcrResourceFilename = "PaddleOCR";
|
||||
constexpr static const char* PenguinResourceFilename = "penguin-stats-recognize";
|
||||
constexpr static const char* TilesCalcResourceFilename = "Arknights-Tile-Pos";
|
||||
@@ -78,11 +78,11 @@ bool asst::Resource::load(const std::string& dir)
|
||||
overload = true;
|
||||
}
|
||||
|
||||
for (const auto& entry : std::filesystem::directory_iterator(dir + BattleCfgDirname)) {
|
||||
for (const auto& entry : std::filesystem::directory_iterator(dir + CopilotCfgDirname)) {
|
||||
if (entry.path().extension() != ".json") {
|
||||
continue;
|
||||
}
|
||||
if (!m_battle_cfg_unique_ins.load(entry.path().u8string())) {
|
||||
if (!m_copilot_cfg_unique_ins.load(entry.path().u8string())) {
|
||||
m_last_error = entry.path().u8string() + " Load failed";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "TaskData.h"
|
||||
#include "TemplResource.h"
|
||||
#include "TilePack.h"
|
||||
#include "BattleConfiger.h"
|
||||
#include "CopilotConfiger.h"
|
||||
|
||||
namespace asst
|
||||
{
|
||||
@@ -56,9 +56,9 @@ namespace asst
|
||||
{
|
||||
return m_infrast_cfg_unique_ins;
|
||||
}
|
||||
BattleConfiger& battle() noexcept
|
||||
CopilotConfiger& copilot() noexcept
|
||||
{
|
||||
return m_battle_cfg_unique_ins;
|
||||
return m_copilot_cfg_unique_ins;
|
||||
}
|
||||
OcrPack& ocr() noexcept
|
||||
{
|
||||
@@ -97,9 +97,9 @@ namespace asst
|
||||
{
|
||||
return m_infrast_cfg_unique_ins;
|
||||
}
|
||||
const BattleConfiger& battle() const noexcept
|
||||
const CopilotConfiger& copilot() const noexcept
|
||||
{
|
||||
return m_battle_cfg_unique_ins;
|
||||
return m_copilot_cfg_unique_ins;
|
||||
}
|
||||
const OcrPack& ocr() const noexcept
|
||||
{
|
||||
@@ -124,7 +124,7 @@ namespace asst
|
||||
GeneralConfiger m_general_cfg_unique_ins;
|
||||
RecruitConfiger m_recruit_cfg_unique_ins;
|
||||
CombatRecruitConfiger m_combatrecruit_cfg_unique_ins;
|
||||
BattleConfiger m_battle_cfg_unique_ins;
|
||||
CopilotConfiger m_copilot_cfg_unique_ins;
|
||||
ItemConfiger m_item_cfg_unique_ins;
|
||||
InfrastConfiger m_infrast_cfg_unique_ins;
|
||||
OcrPack m_ocr_pack_unique_ins;
|
||||
|
||||
Reference in New Issue
Block a user