mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 09:50:40 +08:00
perf: 肉鸽主题从Status分离
This commit is contained in:
@@ -84,6 +84,7 @@
|
||||
<ClInclude Include="Task\BattleHelper.h" />
|
||||
<ClInclude Include="Task\Interface\SingleStepTask.h" />
|
||||
<ClInclude Include="Task\Interface\SSSCopilotTask.h" />
|
||||
<ClInclude Include="Task\Roguelike\RoguelikeConfig.h" />
|
||||
<ClInclude Include="Task\Roguelike\RoguelikeDifficultySelectionTaskPlugin.h" />
|
||||
<ClInclude Include="Task\Roguelike\RoguelikeLastRewardTaskPlugin.h" />
|
||||
<ClInclude Include="Task\SSS\SSSBattleProcessTask.h" />
|
||||
@@ -247,6 +248,7 @@
|
||||
<ClCompile Include="Task\BattleHelper.cpp" />
|
||||
<ClCompile Include="Task\Interface\SingleStepTask.cpp" />
|
||||
<ClCompile Include="Task\Interface\SSSCopilotTask.cpp" />
|
||||
<ClCompile Include="Task\Roguelike\RoguelikeConfig.cpp" />
|
||||
<ClCompile Include="Task\Roguelike\RoguelikeDifficultySelectionTaskPlugin.cpp" />
|
||||
<ClCompile Include="Task\Roguelike\RoguelikeLastRewardTaskPlugin.cpp" />
|
||||
<ClCompile Include="Task\SSS\SSSBattleProcessTask.cpp" />
|
||||
|
||||
@@ -639,6 +639,9 @@
|
||||
<ClInclude Include="Task\Miscellaneous\TaskFileReloadTask.h">
|
||||
<Filter>Source\Task\Miscellaneous</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Task\Roguelike\RoguelikeConfig.h">
|
||||
<Filter>源文件\Task\Roguelike</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Vision\VisionHelper.cpp">
|
||||
@@ -1061,5 +1064,8 @@
|
||||
<ClCompile Include="Task\Miscellaneous\TaskFileReloadTask.cpp">
|
||||
<Filter>Source\Task\Miscellaneous</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Task\Roguelike\RoguelikeConfig.cpp">
|
||||
<Filter>源文件\Task\Roguelike</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -49,7 +49,6 @@ namespace asst
|
||||
static inline const std::string RoguelikeUseNonfriendSupport = "RoguelikeUseNonfriendSupport";
|
||||
static inline const std::string RoguelikeTraderNoLongerBuy = "RoguelikeNoLongerBuy";
|
||||
static inline const std::string RoguelikeTeamFullWithoutRookie = "RoguelikeTeamFullWithoutRookie";
|
||||
static inline const std::string RoguelikeTheme = "RoguelikeTheme";
|
||||
static inline const std::string RoguelikeRecruitmentStartsComplete = "RoguelikeRecruitmentStartsComplete";
|
||||
static inline const std::string RoguelikeRecruitmentTeamComplete = "RoguelikeRecruitmentTeamComplete";
|
||||
static inline const std::string RoguelikeRecruitmentCount = "RoguelikeRecruitmentCount";
|
||||
|
||||
@@ -25,24 +25,25 @@ asst::RoguelikeTask::RoguelikeTask(const AsstCallback& callback, Assistant* inst
|
||||
LogTraceFunction;
|
||||
|
||||
m_roguelike_task_ptr->set_ignore_error(true);
|
||||
m_roguelike_task_ptr->register_plugin<RoguelikeFormationTaskPlugin>();
|
||||
m_roguelike_task_ptr->register_plugin<RoguelikeControlTaskPlugin>();
|
||||
m_roguelike_task_ptr->register_plugin<RoguelikeResetTaskPlugin>();
|
||||
m_formation_plugin_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeFormationTaskPlugin>();
|
||||
m_control_plugin_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeControlTaskPlugin>();
|
||||
m_reset_plugin_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeResetTaskPlugin>();
|
||||
m_debug_plugin_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeDebugTaskPlugin>();
|
||||
m_shopping_plugin_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeShoppingTaskPlugin>();
|
||||
m_shopping_plugin_ptr->set_retry_times(0);
|
||||
|
||||
m_debug_task_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeDebugTaskPlugin>();
|
||||
m_roguelike_task_ptr->register_plugin<RoguelikeShoppingTaskPlugin>()->set_retry_times(0);
|
||||
m_custom_start_plugin_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeCustomStartTaskPlugin>();
|
||||
m_battle_plugin_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeBattleTaskPlugin>();
|
||||
m_battle_plugin_ptr->set_retry_times(0).set_ignore_error(true);
|
||||
m_recruit_plugin_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeRecruitTaskPlugin>();
|
||||
m_recruit_plugin_ptr->set_retry_times(2).set_ignore_error(true);
|
||||
m_skill_plugin_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeSkillSelectionTaskPlugin>();
|
||||
m_skill_plugin_ptr->set_retry_times(2).set_ignore_error(true);
|
||||
m_stage_encounter_plugin_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeStageEncounterTaskPlugin>();
|
||||
m_stage_encounter_plugin_ptr->set_retry_times(0);
|
||||
|
||||
m_custom_start_task_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeCustomStartTaskPlugin>();
|
||||
m_battle_task_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeBattleTaskPlugin>();
|
||||
m_battle_task_ptr->set_retry_times(0).set_ignore_error(true);
|
||||
m_recruit_task_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeRecruitTaskPlugin>();
|
||||
m_recruit_task_ptr->set_retry_times(2).set_ignore_error(true);
|
||||
m_skill_task_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeSkillSelectionTaskPlugin>();
|
||||
m_skill_task_ptr->set_retry_times(2).set_ignore_error(true);
|
||||
m_roguelike_task_ptr->register_plugin<RoguelikeStageEncounterTaskPlugin>()->set_retry_times(0);
|
||||
|
||||
m_roguelike_task_ptr->register_plugin<RoguelikeLastRewardTaskPlugin>();
|
||||
m_roguelike_task_ptr->register_plugin<RoguelikeDifficultySelectionTaskPlugin>();
|
||||
m_last_reward_plugin_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeLastRewardTaskPlugin>();
|
||||
m_difficulty_selection_plugin_ptr = m_roguelike_task_ptr->register_plugin<RoguelikeDifficultySelectionTaskPlugin>();
|
||||
|
||||
// 这个任务如果卡住会放弃当前的肉鸽并重新开始,所以多添加一点。先这样凑合用
|
||||
for (int i = 0; i != 100; ++i) {
|
||||
@@ -65,7 +66,19 @@ bool asst::RoguelikeTask::set_params(const json::value& params)
|
||||
Log.error(__FUNCTION__, "status() is null");
|
||||
return false;
|
||||
}
|
||||
status()->set_properties(Status::RoguelikeTheme, theme);
|
||||
|
||||
m_battle_plugin_ptr->set_roguelike_theme(theme);
|
||||
m_control_plugin_ptr->set_roguelike_theme(theme);
|
||||
m_custom_start_plugin_ptr->set_roguelike_theme(theme);
|
||||
m_debug_plugin_ptr->set_roguelike_theme(theme);
|
||||
m_difficulty_selection_plugin_ptr->set_roguelike_theme(theme);
|
||||
m_formation_plugin_ptr->set_roguelike_theme(theme);
|
||||
m_last_reward_plugin_ptr->set_roguelike_theme(theme);
|
||||
m_recruit_plugin_ptr->set_roguelike_theme(theme);
|
||||
m_reset_plugin_ptr->set_roguelike_theme(theme);
|
||||
m_shopping_plugin_ptr->set_roguelike_theme(theme);
|
||||
m_skill_plugin_ptr->set_roguelike_theme(theme);
|
||||
m_stage_encounter_plugin_ptr->set_roguelike_theme(theme);
|
||||
m_roguelike_task_ptr->set_tasks({ theme + "@Roguelike@Begin" });
|
||||
|
||||
// 0 - 刷经验,尽可能稳定地打更多层数,不期而遇采用激进策略
|
||||
@@ -80,7 +93,7 @@ bool asst::RoguelikeTask::set_params(const json::value& params)
|
||||
return false;
|
||||
}
|
||||
|
||||
m_debug_task_ptr->set_enable(mode != 1);
|
||||
m_debug_plugin_ptr->set_enable(mode != 1);
|
||||
|
||||
// 是否凹指定干员开局直升
|
||||
bool start_with_elite_two = params.get("start_with_elite_two", false);
|
||||
@@ -158,19 +171,19 @@ bool asst::RoguelikeTask::set_params(const json::value& params)
|
||||
}
|
||||
|
||||
if (auto squad_opt = params.find<std::string>("squad"); squad_opt && !squad_opt->empty()) {
|
||||
m_custom_start_task_ptr->set_custom(RoguelikeCustomType::Squad, *squad_opt);
|
||||
m_custom_start_plugin_ptr->set_custom(RoguelikeCustomType::Squad, *squad_opt);
|
||||
}
|
||||
if (auto roles_opt = params.find<std::string>("roles"); roles_opt && !roles_opt->empty()) {
|
||||
m_custom_start_task_ptr->set_custom(RoguelikeCustomType::Roles, *roles_opt);
|
||||
m_custom_start_plugin_ptr->set_custom(RoguelikeCustomType::Roles, *roles_opt);
|
||||
}
|
||||
if (auto core_char_opt = params.find<std::string>("core_char"); core_char_opt && !core_char_opt->empty()) {
|
||||
m_custom_start_task_ptr->set_custom(RoguelikeCustomType::CoreChar, *core_char_opt);
|
||||
m_custom_start_plugin_ptr->set_custom(RoguelikeCustomType::CoreChar, *core_char_opt);
|
||||
}
|
||||
if (auto use_support_opt = params.find<bool>("use_support"); use_support_opt) {
|
||||
m_custom_start_task_ptr->set_custom(RoguelikeCustomType::UseSupport, *use_support_opt ? "1" : "0");
|
||||
m_custom_start_plugin_ptr->set_custom(RoguelikeCustomType::UseSupport, *use_support_opt ? "1" : "0");
|
||||
}
|
||||
if (auto use_nonfriend_opt = params.find<bool>("use_nonfriend_support"); use_nonfriend_opt) {
|
||||
m_custom_start_task_ptr->set_custom(RoguelikeCustomType::UseNonfriendSupport, *use_nonfriend_opt ? "1" : "0");
|
||||
m_custom_start_plugin_ptr->set_custom(RoguelikeCustomType::UseNonfriendSupport, *use_nonfriend_opt ? "1" : "0");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -4,13 +4,18 @@
|
||||
namespace asst
|
||||
{
|
||||
class ProcessTask;
|
||||
class RoguelikeRecruitTaskPlugin;
|
||||
class RoguelikeSkillSelectionTaskPlugin;
|
||||
class RoguelikeBattleTaskPlugin;
|
||||
class RoguelikeControlTaskPlugin;
|
||||
class RoguelikeCustomStartTaskPlugin;
|
||||
class RoguelikeDebugTaskPlugin;
|
||||
class RoguelikeLastRewardTaskPlugin;
|
||||
class RoguelikeDifficultySelectionTaskPlugin;
|
||||
class RoguelikeFormationTaskPlugin;
|
||||
class RoguelikeLastRewardTaskPlugin;
|
||||
class RoguelikeRecruitTaskPlugin;
|
||||
class RoguelikeResetTaskPlugin;
|
||||
class RoguelikeSkillSelectionTaskPlugin;
|
||||
class RoguelikeShoppingTaskPlugin;
|
||||
class RoguelikeStageEncounterTaskPlugin;
|
||||
|
||||
class RoguelikeTask : public InterfaceTask
|
||||
{
|
||||
@@ -24,10 +29,17 @@ namespace asst
|
||||
|
||||
private:
|
||||
std::shared_ptr<ProcessTask> m_roguelike_task_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeRecruitTaskPlugin> m_recruit_task_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeSkillSelectionTaskPlugin> m_skill_task_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeBattleTaskPlugin> m_battle_task_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeCustomStartTaskPlugin> m_custom_start_task_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeDebugTaskPlugin> m_debug_task_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeControlTaskPlugin> m_control_plugin_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeRecruitTaskPlugin> m_recruit_plugin_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeSkillSelectionTaskPlugin> m_skill_plugin_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeBattleTaskPlugin> m_battle_plugin_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeCustomStartTaskPlugin> m_custom_start_plugin_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeDebugTaskPlugin> m_debug_plugin_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeDifficultySelectionTaskPlugin> m_difficulty_selection_plugin_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeFormationTaskPlugin> m_formation_plugin_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeLastRewardTaskPlugin> m_last_reward_plugin_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeResetTaskPlugin> m_reset_plugin_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeShoppingTaskPlugin> m_shopping_plugin_ptr = nullptr;
|
||||
std::shared_ptr<RoguelikeStageEncounterTaskPlugin> m_stage_encounter_plugin_ptr = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -34,12 +34,11 @@ bool asst::RoguelikeBattleTaskPlugin::verify(AsstMsg msg, const json::value& det
|
||||
return false;
|
||||
}
|
||||
|
||||
auto roguelike_name_opt = status()->get_properties(Status::RoguelikeTheme);
|
||||
if (!roguelike_name_opt) {
|
||||
if (m_roguelike_theme.empty()) {
|
||||
Log.error("Roguelike name doesn't exist!");
|
||||
return false;
|
||||
}
|
||||
const std::string roguelike_name = std::move(roguelike_name_opt.value()) + "@";
|
||||
const std::string roguelike_name = m_roguelike_theme + "@";
|
||||
const std::string& task = details.get("details", "task", "");
|
||||
std::string_view task_view = task;
|
||||
if (task_view.starts_with(roguelike_name)) {
|
||||
@@ -62,6 +61,7 @@ bool asst::RoguelikeBattleTaskPlugin::_run()
|
||||
return false;
|
||||
}
|
||||
update_deployment(true);
|
||||
cache_oper_elite_status();
|
||||
speed_up();
|
||||
|
||||
bool timeout = false;
|
||||
@@ -92,8 +92,10 @@ bool asst::RoguelikeBattleTaskPlugin::_run()
|
||||
|
||||
void asst::RoguelikeBattleTaskPlugin::wait_until_start_button_clicked()
|
||||
{
|
||||
std::string theme = status()->get_properties(Status::RoguelikeTheme).value();
|
||||
ProcessTask(*this, { theme + "@Roguelike@WaitForStartButtonClicked" }).set_task_delay(0).set_retry_times(0).run();
|
||||
ProcessTask(*this, { m_roguelike_theme + "@Roguelike@WaitForStartButtonClicked" })
|
||||
.set_task_delay(0)
|
||||
.set_retry_times(0)
|
||||
.run();
|
||||
}
|
||||
|
||||
std::string asst::RoguelikeBattleTaskPlugin::oper_name_in_config(const battle::DeploymentOper& oper) const
|
||||
@@ -243,6 +245,13 @@ asst::battle::OperPosition asst::RoguelikeBattleTaskPlugin::get_role_position(co
|
||||
}
|
||||
}
|
||||
|
||||
void asst::RoguelikeBattleTaskPlugin::cache_oper_elite_status()
|
||||
{
|
||||
for (const std::string& name : m_cur_deployment_opers | views::keys) {
|
||||
m_oper_elite.emplace(name, status()->get_number(Status::RoguelikeCharElitePrefix + name).value_or(0));
|
||||
}
|
||||
}
|
||||
|
||||
void asst::RoguelikeBattleTaskPlugin::set_position_full(battle::LocationType loc_type, bool full)
|
||||
{
|
||||
switch (loc_type) {
|
||||
@@ -316,12 +325,10 @@ bool asst::RoguelikeBattleTaskPlugin::do_best_deploy()
|
||||
}
|
||||
}
|
||||
Log.info("No operator needs to be retreated.");
|
||||
// 获取肉鸽主题
|
||||
std::string rogue_theme = status()->get_properties(Status::RoguelikeTheme).value();
|
||||
// 构造当前地图的部署指令列表
|
||||
std::vector<DeployPlanInfo> deploy_plan_list;
|
||||
// 获取当前肉鸽的分组信息[干员组1名称,干员组2名称,...]
|
||||
const auto& groups = RoguelikeRecruit.get_group_info(rogue_theme);
|
||||
const auto& groups = RoguelikeRecruit.get_group_info(m_roguelike_theme);
|
||||
// 获取当前肉鸽的分组内排名信息
|
||||
// const auto& group_rank = RoguelikeRecruit.get_group_rank(rogue_theme);
|
||||
for (const auto& [name, oper] : m_cur_deployment_opers) {
|
||||
@@ -333,9 +340,9 @@ bool asst::RoguelikeBattleTaskPlugin::do_best_deploy()
|
||||
|
||||
const std::string& oper_name = oper_name_in_config(oper);
|
||||
// 获取招募信息
|
||||
const auto& recruit_info = RoguelikeRecruit.get_oper_info(rogue_theme, oper_name);
|
||||
const auto& recruit_info = RoguelikeRecruit.get_oper_info(m_roguelike_theme, oper_name);
|
||||
// 获取会用到该干员的干员组[干员组1序号,干员组2序号,...]
|
||||
std::vector<int> group_ids = RoguelikeRecruit.get_group_id(rogue_theme, oper_name);
|
||||
std::vector<int> group_ids = RoguelikeRecruit.get_group_id(m_roguelike_theme, oper_name);
|
||||
|
||||
for (const auto& group_id : group_ids) {
|
||||
// 当前干员组名,string类型
|
||||
@@ -384,7 +391,7 @@ bool asst::RoguelikeBattleTaskPlugin::do_best_deploy()
|
||||
auto deployed_time = std::chrono::steady_clock::now();
|
||||
m_deployed_time.insert_or_assign(deploy_plan.oper_name, deployed_time);
|
||||
// 获取技能用法和使用次数
|
||||
const auto& oper_info = RoguelikeRecruit.get_oper_info(rogue_theme, deploy_plan.oper_name);
|
||||
const auto& oper_info = RoguelikeRecruit.get_oper_info(m_roguelike_theme, deploy_plan.oper_name);
|
||||
m_skill_usage[deploy_plan.oper_name] = oper_info.skill_usage;
|
||||
m_skill_times[deploy_plan.oper_name] = oper_info.skill_times;
|
||||
Log.trace(" best deploy is", deploy_plan.oper_name, "with rank", deploy_plan.rank);
|
||||
@@ -398,13 +405,13 @@ bool asst::RoguelikeBattleTaskPlugin::do_once()
|
||||
{
|
||||
check_drone_tiles();
|
||||
|
||||
cv::Mat image = ctrler()->get_image();
|
||||
cv::Mat image = ctrler()->get_image(false);
|
||||
if (!m_first_deploy && use_all_ready_skill(image)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string rogue_theme = status()->get_properties(Status::RoguelikeTheme).value();
|
||||
|
||||
if (need_exit()) {
|
||||
Log.info("exit");
|
||||
}
|
||||
std::unordered_set<std::string> pre_cooling;
|
||||
for (const auto& [name, oper] : m_cur_deployment_opers) {
|
||||
if (oper.cooling) {
|
||||
@@ -413,7 +420,7 @@ bool asst::RoguelikeBattleTaskPlugin::do_once()
|
||||
}
|
||||
}
|
||||
for (const auto& [name, loc] : m_battlefield_opers) {
|
||||
const auto& oper_info = RoguelikeRecruit.get_oper_info(rogue_theme, name);
|
||||
const auto& oper_info = RoguelikeRecruit.get_oper_info(m_roguelike_theme, name);
|
||||
auto iter = m_deployed_time.find(name);
|
||||
if (iter != m_deployed_time.end() && oper_info.auto_retreat > 0) {
|
||||
if (std::chrono::steady_clock::now() - m_deployed_time.at(name) >=
|
||||
@@ -509,7 +516,7 @@ bool asst::RoguelikeBattleTaskPlugin::do_once()
|
||||
auto deployed_time = std::chrono::steady_clock::now();
|
||||
m_deployed_time.insert_or_assign(best_oper.name, deployed_time);
|
||||
// 获取技能用法和使用次数
|
||||
const auto& oper_info = RoguelikeRecruit.get_oper_info(rogue_theme, best_oper.name);
|
||||
const auto& oper_info = RoguelikeRecruit.get_oper_info(m_roguelike_theme, best_oper.name);
|
||||
m_skill_usage[best_oper.name] = oper_info.skill_usage;
|
||||
m_skill_times[best_oper.name] = oper_info.skill_times;
|
||||
|
||||
@@ -768,6 +775,8 @@ void asst::RoguelikeBattleTaskPlugin::clear()
|
||||
m_deploy_plan.clear();
|
||||
m_retreat_plan.clear();
|
||||
m_deployed_time.clear();
|
||||
|
||||
m_oper_elite.clear();
|
||||
}
|
||||
|
||||
std::vector<asst::Point> asst::RoguelikeBattleTaskPlugin::available_locations(const DeploymentOper& oper) const
|
||||
@@ -798,7 +807,11 @@ std::vector<asst::Point> asst::RoguelikeBattleTaskPlugin::available_locations(ba
|
||||
asst::battle::AttackRange asst::RoguelikeBattleTaskPlugin::get_attack_range(const battle::DeploymentOper& oper,
|
||||
DeployDirection direction) const
|
||||
{
|
||||
int64_t elite = status()->get_number(Status::RoguelikeCharElitePrefix + oper.name).value_or(0);
|
||||
int64_t elite = 0;
|
||||
if (m_oper_elite.contains(oper.name)) {
|
||||
elite = m_oper_elite.at(oper.name);
|
||||
}
|
||||
// int64_t elite = status()->get_number(Status::RoguelikeCharElitePrefix + oper.name).value_or(0);
|
||||
battle::AttackRange right_attack_range = BattleData.get_range(oper_name_in_config(oper), elite);
|
||||
|
||||
if (right_attack_range == BattleDataConfig::EmptyRange) {
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
#include "Config/Miscellaneous/TilePack.h"
|
||||
#include "Task/AbstractTaskPlugin.h"
|
||||
#include "Task/BattleHelper.h"
|
||||
#include "Task/Roguelike/RoguelikeConfig.h"
|
||||
|
||||
namespace asst
|
||||
{
|
||||
class RoguelikeBattleTaskPlugin : public AbstractTaskPlugin, private BattleHelper
|
||||
class RoguelikeBattleTaskPlugin : public AbstractTaskPlugin, private BattleHelper, public RoguelikeConfig
|
||||
{
|
||||
using Time_Point = std::chrono::time_point<std::chrono::system_clock>;
|
||||
|
||||
@@ -141,5 +142,10 @@ namespace asst
|
||||
std::unordered_map<std::string, std::vector<battle::roguelike::DeployInfoWithRank>> m_deploy_plan;
|
||||
std::vector<battle::roguelike::DeployInfoWithRank> m_retreat_plan;
|
||||
std::unordered_map<std::string, std::chrono::steady_clock::time_point> m_deployed_time;
|
||||
|
||||
// 缓存干员精英
|
||||
std::unordered_map<std::string, int64_t> m_oper_elite;
|
||||
// 缓存干员精英情况
|
||||
void cache_oper_elite_status();
|
||||
};
|
||||
} // namespace asst
|
||||
|
||||
6
src/MaaCore/Task/Roguelike/RoguelikeConfig.cpp
Normal file
6
src/MaaCore/Task/Roguelike/RoguelikeConfig.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#include "RoguelikeConfig.h"
|
||||
|
||||
void asst::RoguelikeConfig::set_roguelike_theme(std::string roguelike_theme)
|
||||
{
|
||||
m_roguelike_theme = std::move(roguelike_theme);
|
||||
}
|
||||
15
src/MaaCore/Task/Roguelike/RoguelikeConfig.h
Normal file
15
src/MaaCore/Task/Roguelike/RoguelikeConfig.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
namespace asst
|
||||
{
|
||||
class RoguelikeConfig
|
||||
{
|
||||
public:
|
||||
void set_roguelike_theme(std::string roguelike_theme);
|
||||
|
||||
protected:
|
||||
// 肉鸽主题
|
||||
std::string m_roguelike_theme;
|
||||
};
|
||||
}
|
||||
@@ -10,12 +10,11 @@ bool asst::RoguelikeControlTaskPlugin::verify(AsstMsg msg, const json::value& de
|
||||
return false;
|
||||
}
|
||||
|
||||
auto roguelike_name_opt = status()->get_properties(Status::RoguelikeTheme);
|
||||
if (!roguelike_name_opt) {
|
||||
if (m_roguelike_theme.empty()) {
|
||||
Log.error("Roguelike name doesn't exist!");
|
||||
return false;
|
||||
}
|
||||
const std::string roguelike_name = std::move(roguelike_name_opt.value()) + "@";
|
||||
const std::string roguelike_name = m_roguelike_theme + "@";
|
||||
const std::string& task = details.get("details", "task", "");
|
||||
std::string_view task_view = task;
|
||||
if (task_view.starts_with(roguelike_name)) {
|
||||
@@ -35,8 +34,7 @@ bool asst::RoguelikeControlTaskPlugin::verify(AsstMsg msg, const json::value& de
|
||||
|
||||
void asst::RoguelikeControlTaskPlugin::exit_then_stop()
|
||||
{
|
||||
std::string theme = status()->get_properties(Status::RoguelikeTheme).value();
|
||||
ProcessTask(*this, { theme + "@Roguelike@ExitThenAbandon" })
|
||||
ProcessTask(*this, { m_roguelike_theme + "@Roguelike@ExitThenAbandon" })
|
||||
.set_times_limit("Roguelike@StartExplore", 0)
|
||||
.set_times_limit("Roguelike@Abandon", 0)
|
||||
.run();
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
#include "Task/AbstractTaskPlugin.h"
|
||||
#include "Task/Roguelike/RoguelikeConfig.h"
|
||||
|
||||
namespace asst
|
||||
{
|
||||
class RoguelikeControlTaskPlugin : public AbstractTaskPlugin
|
||||
class RoguelikeControlTaskPlugin : public AbstractTaskPlugin, public RoguelikeConfig
|
||||
{
|
||||
public:
|
||||
using AbstractTaskPlugin::AbstractTaskPlugin;
|
||||
|
||||
@@ -14,12 +14,11 @@ bool asst::RoguelikeCustomStartTaskPlugin::verify(AsstMsg msg, const json::value
|
||||
return false;
|
||||
}
|
||||
|
||||
auto roguelike_name_opt = status()->get_properties(Status::RoguelikeTheme);
|
||||
if (!roguelike_name_opt) {
|
||||
if (m_roguelike_theme.empty()) {
|
||||
Log.error("Roguelike name doesn't exist!");
|
||||
return false;
|
||||
}
|
||||
const std::string roguelike_name = std::move(roguelike_name_opt.value()) + "@";
|
||||
const std::string roguelike_name = m_roguelike_theme + "@";
|
||||
const std::string& task = details.get("details", "task", "");
|
||||
std::string_view task_view = task;
|
||||
if (task_view.starts_with(roguelike_name)) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "Task/AbstractTaskPlugin.h"
|
||||
#include "Task/Roguelike/RoguelikeConfig.h"
|
||||
|
||||
namespace asst
|
||||
{
|
||||
@@ -14,7 +15,7 @@ namespace asst
|
||||
// CoCoreChar, // 次选干员, 干员名
|
||||
};
|
||||
|
||||
class RoguelikeCustomStartTaskPlugin : public AbstractTaskPlugin
|
||||
class RoguelikeCustomStartTaskPlugin : public AbstractTaskPlugin, public RoguelikeConfig
|
||||
{
|
||||
public:
|
||||
using AbstractTaskPlugin::AbstractTaskPlugin;
|
||||
@@ -22,7 +23,6 @@ namespace asst
|
||||
|
||||
public:
|
||||
virtual bool verify(AsstMsg msg, const json::value& details) const override;
|
||||
|
||||
void set_custom(RoguelikeCustomType type, std::string custom);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -14,12 +14,11 @@ bool asst::RoguelikeDebugTaskPlugin::verify(AsstMsg msg, const json::value& deta
|
||||
return true;
|
||||
}
|
||||
|
||||
auto roguelike_name_opt = status()->get_properties(Status::RoguelikeTheme);
|
||||
if (!roguelike_name_opt) {
|
||||
if (m_roguelike_theme.empty()) {
|
||||
Log.error("Roguelike name doesn't exist!");
|
||||
return false;
|
||||
}
|
||||
const std::string roguelike_name = std::move(roguelike_name_opt.value()) + "@";
|
||||
const std::string roguelike_name = m_roguelike_theme + "@";
|
||||
const std::string& task = details.get("details", "task", "");
|
||||
std::string_view task_view = task;
|
||||
if (task_view.starts_with(roguelike_name)) {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
#include "Task/AbstractTaskPlugin.h"
|
||||
#include "Task/Roguelike/RoguelikeConfig.h"
|
||||
|
||||
namespace asst
|
||||
{
|
||||
class RoguelikeDebugTaskPlugin : public AbstractTaskPlugin
|
||||
class RoguelikeDebugTaskPlugin : public AbstractTaskPlugin, public RoguelikeConfig
|
||||
{
|
||||
public:
|
||||
using AbstractTaskPlugin::AbstractTaskPlugin;
|
||||
|
||||
@@ -10,12 +10,11 @@ bool asst::RoguelikeDifficultySelectionTaskPlugin::verify(AsstMsg msg, const jso
|
||||
return false;
|
||||
}
|
||||
|
||||
auto roguelike_name_opt = status()->get_properties(Status::RoguelikeTheme);
|
||||
if (!roguelike_name_opt) {
|
||||
if (m_roguelike_theme.empty()) {
|
||||
Log.error("Roguelike name doesn't exist!");
|
||||
return false;
|
||||
}
|
||||
const std::string roguelike_name = std::move(roguelike_name_opt.value()) + "@";
|
||||
const std::string roguelike_name = m_roguelike_theme + "@";
|
||||
const std::string& task = details.get("details", "task", "");
|
||||
std::string_view task_view = task;
|
||||
if (task_view.starts_with(roguelike_name)) {
|
||||
@@ -33,7 +32,6 @@ bool asst::RoguelikeDifficultySelectionTaskPlugin::_run()
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
std::string theme = status()->get_properties(Status::RoguelikeTheme).value();
|
||||
std::string mode = status()->get_properties(Status::RoguelikeMode).value();
|
||||
// todo:以后可以根据传入的难度值选择难度?
|
||||
|
||||
@@ -41,10 +39,10 @@ bool asst::RoguelikeDifficultySelectionTaskPlugin::_run()
|
||||
std::string recent_difficulty = status()->get_properties(Status::RoguelikeNeedChangeDifficulty).value();
|
||||
// 需要开局凹直升
|
||||
std::string start_with_elite_two = status()->get_properties(Status::RoguelikeStartWithEliteTwo).value();
|
||||
if (theme != "Phantom" && mode == "4") {
|
||||
if (m_roguelike_theme != "Phantom" && mode == "4") {
|
||||
if (recent_difficulty == "max") {
|
||||
// 到第三层退出,选最高难度开水壶
|
||||
ProcessTask(*this, { theme + "@Roguelike@ChooseDifficulty_Hardest" }).run();
|
||||
ProcessTask(*this, { m_roguelike_theme + "@Roguelike@ChooseDifficulty_Hardest" }).run();
|
||||
// 重置为最低难度,需要凹开局直升时,保证在难度max下寻找直升干员,延后到找不到精二重置
|
||||
if (start_with_elite_two == "0") {
|
||||
status()->set_properties(Status::RoguelikeNeedChangeDifficulty, "0");
|
||||
@@ -52,11 +50,11 @@ bool asst::RoguelikeDifficultySelectionTaskPlugin::_run()
|
||||
}
|
||||
// 其他情况下开始,选最低难度
|
||||
else {
|
||||
ProcessTask(*this, { theme + "@Roguelike@ChooseDifficulty_Easiest" }).run();
|
||||
ProcessTask(*this, { m_roguelike_theme + "@Roguelike@ChooseDifficulty_Easiest" }).run();
|
||||
status()->set_properties(Status::RoguelikeNeedChangeDifficulty, "0");
|
||||
}
|
||||
ProcessTask(*this, { theme + "@Roguelike@ChooseDifficultyConfirm" }).run();
|
||||
ProcessTask(*this, { theme + "@Roguelike@StartExploreConfirm" }).run();
|
||||
ProcessTask(*this, { m_roguelike_theme + "@Roguelike@ChooseDifficultyConfirm" }).run();
|
||||
ProcessTask(*this, { m_roguelike_theme + "@Roguelike@StartExploreConfirm" }).run();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
#include "Task/AbstractTaskPlugin.h"
|
||||
#include "Task/Roguelike/RoguelikeConfig.h"
|
||||
|
||||
namespace asst
|
||||
{
|
||||
class RoguelikeDifficultySelectionTaskPlugin : public AbstractTaskPlugin
|
||||
class RoguelikeDifficultySelectionTaskPlugin : public AbstractTaskPlugin, public RoguelikeConfig
|
||||
{
|
||||
public:
|
||||
using AbstractTaskPlugin::AbstractTaskPlugin;
|
||||
|
||||
@@ -15,12 +15,11 @@ bool asst::RoguelikeFormationTaskPlugin::verify(AsstMsg msg, const json::value&
|
||||
return false;
|
||||
}
|
||||
|
||||
auto roguelike_name_opt = status()->get_properties(Status::RoguelikeTheme);
|
||||
if (!roguelike_name_opt) {
|
||||
if (m_roguelike_theme.empty()) {
|
||||
Log.error("Roguelike name doesn't exist!");
|
||||
return false;
|
||||
}
|
||||
const std::string roguelike_name = std::move(roguelike_name_opt.value()) + "@";
|
||||
const std::string roguelike_name = m_roguelike_theme + "@";
|
||||
const std::string& task = details.get("details", "task", "");
|
||||
std::string_view task_view = task;
|
||||
if (task_view.starts_with(roguelike_name)) {
|
||||
@@ -104,15 +103,14 @@ void asst::RoguelikeFormationTaskPlugin::clear_and_reselect()
|
||||
}
|
||||
|
||||
std::vector<asst::RoguelikeFormationImageAnalyzer::FormationOper> sorted_oper_list;
|
||||
const std::string rogue_theme = status()->get_properties(Status::RoguelikeTheme).value();
|
||||
const auto& team_complete_condition = RoguelikeRecruit.get_team_complete_info(rogue_theme);
|
||||
const auto& group_list = RoguelikeRecruit.get_group_info(rogue_theme);
|
||||
const auto& team_complete_condition = RoguelikeRecruit.get_team_complete_info(m_roguelike_theme);
|
||||
const auto& group_list = RoguelikeRecruit.get_group_info(m_roguelike_theme);
|
||||
for (const auto& condition : team_complete_condition) { // 优先选择阵容核心干员
|
||||
int count = 0;
|
||||
int require = condition.threshold;
|
||||
for (const std::string& group_name : condition.groups) {
|
||||
for (const auto& oper : oper_list) {
|
||||
std::vector<int> group_ids = RoguelikeRecruit.get_group_id(rogue_theme, oper.name);
|
||||
std::vector<int> group_ids = RoguelikeRecruit.get_group_id(m_roguelike_theme, oper.name);
|
||||
for (const auto& group_id : group_ids) {
|
||||
std::string oper_group = group_list[group_id];
|
||||
if (oper_group == group_name) {
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#pragma once
|
||||
#include "Task/AbstractTaskPlugin.h"
|
||||
#include "Task/Roguelike/RoguelikeConfig.h"
|
||||
#include "Vision/Roguelike/RoguelikeFormationImageAnalyzer.h"
|
||||
|
||||
namespace asst
|
||||
{
|
||||
// 集成战略模式快捷编队任务
|
||||
class RoguelikeFormationTaskPlugin : public AbstractTaskPlugin
|
||||
class RoguelikeFormationTaskPlugin : public AbstractTaskPlugin, public RoguelikeConfig
|
||||
{
|
||||
public:
|
||||
static constexpr size_t MaxNumOfOperPerPage = 8;
|
||||
|
||||
@@ -10,12 +10,11 @@ bool asst::RoguelikeLastRewardTaskPlugin::verify(AsstMsg msg, const json::value&
|
||||
return false;
|
||||
}
|
||||
|
||||
auto roguelike_name_opt = status()->get_properties(Status::RoguelikeTheme);
|
||||
if (!roguelike_name_opt) {
|
||||
if (m_roguelike_theme.empty()) {
|
||||
Log.error("Roguelike name doesn't exist!");
|
||||
return false;
|
||||
}
|
||||
const std::string roguelike_name = std::move(roguelike_name_opt.value()) + "@";
|
||||
const std::string roguelike_name = m_roguelike_theme + "@";
|
||||
const std::string& task = details.get("details", "task", "");
|
||||
std::string_view task_view = task;
|
||||
if (task_view.starts_with(roguelike_name)) {
|
||||
@@ -38,10 +37,9 @@ bool asst::RoguelikeLastRewardTaskPlugin::_run()
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
std::string theme = status()->get_properties(Status::RoguelikeTheme).value();
|
||||
std::string mode = status()->get_properties(Status::RoguelikeMode).value();
|
||||
|
||||
if (theme != "Phantom" && mode == "4") {
|
||||
if (m_roguelike_theme != "Phantom" && mode == "4") {
|
||||
if (m_need_change_difficulty_higher) {
|
||||
status()->set_properties(Status::RoguelikeNeedChangeDifficulty, "max");
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
#include "Task/AbstractTaskPlugin.h"
|
||||
#include "Task/Roguelike/RoguelikeConfig.h"
|
||||
|
||||
namespace asst
|
||||
{
|
||||
class RoguelikeLastRewardTaskPlugin : public AbstractTaskPlugin
|
||||
class RoguelikeLastRewardTaskPlugin : public AbstractTaskPlugin, public RoguelikeConfig
|
||||
{
|
||||
public:
|
||||
using AbstractTaskPlugin::AbstractTaskPlugin;
|
||||
|
||||
@@ -21,12 +21,11 @@ bool asst::RoguelikeRecruitTaskPlugin::verify(AsstMsg msg, const json::value& de
|
||||
return false;
|
||||
}
|
||||
|
||||
auto roguelike_name_opt = status()->get_properties(Status::RoguelikeTheme);
|
||||
if (!roguelike_name_opt) {
|
||||
if (m_roguelike_theme.empty()) {
|
||||
Log.error("Roguelike name doesn't exist!");
|
||||
return false;
|
||||
}
|
||||
const std::string roguelike_name = std::move(roguelike_name_opt.value()) + "@";
|
||||
const std::string roguelike_name = m_roguelike_theme + "@";
|
||||
const std::string& task = details.get("details", "task", "");
|
||||
std::string_view task_view = task;
|
||||
if (task_view.starts_with(roguelike_name)) {
|
||||
@@ -85,7 +84,6 @@ bool asst::RoguelikeRecruitTaskPlugin::_run()
|
||||
// Log.info("team_full_without_rookie", team_full_without_rookie);
|
||||
|
||||
// 编队信息 (已有角色)
|
||||
std::string rogue_theme = status()->get_properties(Status::RoguelikeTheme).value();
|
||||
std::string str_chars_info = status()->get_str(Status::RoguelikeCharOverview).value_or(json::value().to_string());
|
||||
json::value json_chars_info = json::parse(str_chars_info).value_or(json::value());
|
||||
const auto& chars_map = json_chars_info.as_object();
|
||||
@@ -101,9 +99,9 @@ bool asst::RoguelikeRecruitTaskPlugin::_run()
|
||||
// __________________will-be-removed-end__________________
|
||||
|
||||
std::unordered_map<std::string, int> group_count;
|
||||
const auto& group_list = RoguelikeRecruit.get_group_info(rogue_theme);
|
||||
const auto& group_list = RoguelikeRecruit.get_group_info(m_roguelike_theme);
|
||||
for (const auto& oper : chars_map) {
|
||||
std::vector<int> group_ids = RoguelikeRecruit.get_group_id(rogue_theme, oper.first);
|
||||
std::vector<int> group_ids = RoguelikeRecruit.get_group_id(m_roguelike_theme, oper.first);
|
||||
for (const auto& group_id : group_ids) {
|
||||
const std::string& group_name = group_list[group_id];
|
||||
group_count[group_name]++;
|
||||
@@ -112,7 +110,7 @@ bool asst::RoguelikeRecruitTaskPlugin::_run()
|
||||
|
||||
if (!start_complete) {
|
||||
for (const auto& oper : chars_map) {
|
||||
auto& recruit_info = RoguelikeRecruit.get_oper_info(rogue_theme, oper.first);
|
||||
auto& recruit_info = RoguelikeRecruit.get_oper_info(m_roguelike_theme, oper.first);
|
||||
if (recruit_info.is_start) start_complete = true;
|
||||
}
|
||||
}
|
||||
@@ -121,7 +119,7 @@ bool asst::RoguelikeRecruitTaskPlugin::_run()
|
||||
bool complete = true;
|
||||
int complete_count = 0;
|
||||
int complete_require = 0;
|
||||
const auto& team_complete_condition = RoguelikeRecruit.get_team_complete_info(rogue_theme);
|
||||
const auto& team_complete_condition = RoguelikeRecruit.get_team_complete_info(m_roguelike_theme);
|
||||
for (const auto& condition : team_complete_condition) {
|
||||
int count = 0;
|
||||
complete_require += condition.threshold;
|
||||
@@ -219,7 +217,7 @@ bool asst::RoguelikeRecruitTaskPlugin::_run()
|
||||
}
|
||||
|
||||
// 查询招募配置
|
||||
auto& recruit_info = RoguelikeRecruit.get_oper_info(rogue_theme, oper_info.name);
|
||||
auto& recruit_info = RoguelikeRecruit.get_oper_info(m_roguelike_theme, oper_info.name);
|
||||
int priority = 0;
|
||||
|
||||
// 查询编队是否已持有该干员
|
||||
@@ -468,10 +466,9 @@ bool asst::RoguelikeRecruitTaskPlugin::recruit_appointed_char(const std::string&
|
||||
m_task_ptr->set_enable(false);
|
||||
}
|
||||
else {
|
||||
std::string theme = status()->get_properties(Status::RoguelikeTheme).value();
|
||||
// 重置难度并放弃
|
||||
status()->set_properties(Status::RoguelikeNeedChangeDifficulty, "0");
|
||||
ProcessTask(*this, { theme + "@Roguelike@ExitThenAbandon" })
|
||||
ProcessTask(*this, { m_roguelike_theme + "@Roguelike@ExitThenAbandon" })
|
||||
.set_times_limit("Roguelike@Abandon", 0)
|
||||
.run();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "Task/AbstractTaskPlugin.h"
|
||||
|
||||
#include "Common/AsstBattleDef.h"
|
||||
#include "Task/AbstractTaskPlugin.h"
|
||||
#include "Task/Roguelike/RoguelikeConfig.h"
|
||||
|
||||
namespace asst
|
||||
{
|
||||
@@ -13,7 +13,7 @@ namespace asst
|
||||
int page_index = 0; // 所在页码 (用于判断翻页方向)
|
||||
bool is_alternate = false; // 是否后备干员 (允许重复招募、划到后备干员时不再往右划动)
|
||||
};
|
||||
class RoguelikeRecruitTaskPlugin : public AbstractTaskPlugin
|
||||
class RoguelikeRecruitTaskPlugin : public AbstractTaskPlugin, public RoguelikeConfig
|
||||
{
|
||||
public:
|
||||
using AbstractTaskPlugin::AbstractTaskPlugin;
|
||||
|
||||
@@ -9,12 +9,11 @@ bool asst::RoguelikeResetTaskPlugin::verify(AsstMsg msg, const json::value& deta
|
||||
return false;
|
||||
}
|
||||
|
||||
auto roguelike_name_opt = status()->get_properties(Status::RoguelikeTheme);
|
||||
if (!roguelike_name_opt) {
|
||||
if (m_roguelike_theme.empty()) {
|
||||
Log.error("Roguelike name doesn't exist!");
|
||||
return false;
|
||||
}
|
||||
const std::string roguelike_name = std::move(roguelike_name_opt.value()) + "@";
|
||||
const std::string roguelike_name = m_roguelike_theme + "@";
|
||||
const std::string& task = details.get("details", "task", "");
|
||||
std::string_view task_view = task;
|
||||
if (task_view.starts_with(roguelike_name)) {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
#include "Task/AbstractTaskPlugin.h"
|
||||
#include "Task/Roguelike/RoguelikeConfig.h"
|
||||
|
||||
namespace asst
|
||||
{
|
||||
class RoguelikeResetTaskPlugin : public AbstractTaskPlugin
|
||||
class RoguelikeResetTaskPlugin : public AbstractTaskPlugin, public RoguelikeConfig
|
||||
{
|
||||
public:
|
||||
using AbstractTaskPlugin::AbstractTaskPlugin;
|
||||
|
||||
@@ -15,12 +15,11 @@ bool asst::RoguelikeShoppingTaskPlugin::verify(AsstMsg msg, const json::value& d
|
||||
return false;
|
||||
}
|
||||
|
||||
auto roguelike_name_opt = status()->get_properties(Status::RoguelikeTheme);
|
||||
if (!roguelike_name_opt) {
|
||||
if (m_roguelike_theme.empty()) {
|
||||
Log.error("Roguelike name doesn't exist!");
|
||||
return false;
|
||||
}
|
||||
const std::string roguelike_name = std::move(roguelike_name_opt.value()) + "@";
|
||||
const std::string roguelike_name = m_roguelike_theme + "@";
|
||||
const std::string& task = details.get("details", "task", "");
|
||||
std::string_view task_view = task;
|
||||
if (task_view.starts_with(roguelike_name)) {
|
||||
@@ -104,7 +103,7 @@ bool asst::RoguelikeShoppingTaskPlugin::_run()
|
||||
}
|
||||
|
||||
bool bought = false;
|
||||
auto& all_goods = RoguelikeShopping.get_goods(status()->get_properties(Status::RoguelikeTheme).value());
|
||||
auto& all_goods = RoguelikeShopping.get_goods(m_roguelike_theme);
|
||||
for (const auto& goods : all_goods) {
|
||||
if (need_exit()) {
|
||||
return false;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
#include "Task/AbstractTaskPlugin.h"
|
||||
#include "Task/Roguelike/RoguelikeConfig.h"
|
||||
|
||||
namespace asst
|
||||
{
|
||||
class RoguelikeShoppingTaskPlugin : public AbstractTaskPlugin
|
||||
class RoguelikeShoppingTaskPlugin : public AbstractTaskPlugin, public RoguelikeConfig
|
||||
{
|
||||
public:
|
||||
using AbstractTaskPlugin::AbstractTaskPlugin;
|
||||
@@ -13,7 +14,5 @@ namespace asst
|
||||
|
||||
protected:
|
||||
virtual bool _run() override;
|
||||
|
||||
private:
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
#include "Config/TaskData.h"
|
||||
#include "Controller/Controller.h"
|
||||
#include "Status.h"
|
||||
#include "Vision/Roguelike/RoguelikeSkillSelectionImageAnalyzer.h"
|
||||
|
||||
#include "Utils/Logger.hpp"
|
||||
#include "Vision/Roguelike/RoguelikeSkillSelectionImageAnalyzer.h"
|
||||
|
||||
bool asst::RoguelikeSkillSelectionTaskPlugin::verify(AsstMsg msg, const json::value& details) const
|
||||
{
|
||||
@@ -14,12 +13,11 @@ bool asst::RoguelikeSkillSelectionTaskPlugin::verify(AsstMsg msg, const json::va
|
||||
return false;
|
||||
}
|
||||
|
||||
auto roguelike_name_opt = status()->get_properties(Status::RoguelikeTheme);
|
||||
if (!roguelike_name_opt) {
|
||||
if (m_roguelike_theme.empty()) {
|
||||
Log.error("Roguelike name doesn't exist!");
|
||||
return false;
|
||||
}
|
||||
const std::string roguelike_name = std::move(roguelike_name_opt.value()) + "@";
|
||||
const std::string roguelike_name = m_roguelike_theme + "@";
|
||||
const std::string& task = details.get("details", "task", "");
|
||||
std::string_view task_view = task;
|
||||
if (task_view.starts_with(roguelike_name)) {
|
||||
@@ -47,8 +45,7 @@ bool asst::RoguelikeSkillSelectionTaskPlugin::_run()
|
||||
int delay = Task.get("RoguelikeSkillSelectionMove1")->post_delay;
|
||||
bool has_rookie = false;
|
||||
for (const auto& [name, skill_vec] : analyzer.get_result()) {
|
||||
const auto& oper_info =
|
||||
RoguelikeRecruit.get_oper_info(status()->get_properties(Status::RoguelikeTheme).value(), name);
|
||||
const auto& oper_info = RoguelikeRecruit.get_oper_info(m_roguelike_theme, name);
|
||||
if (oper_info.name.empty()) {
|
||||
Log.warn("Unknown oper", name);
|
||||
continue;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#pragma once
|
||||
#include "Task/AbstractTaskPlugin.h"
|
||||
#include "Task/Roguelike/RoguelikeConfig.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace asst
|
||||
{
|
||||
class RoguelikeSkillSelectionTaskPlugin final : public AbstractTaskPlugin
|
||||
class RoguelikeSkillSelectionTaskPlugin final : public AbstractTaskPlugin, public RoguelikeConfig
|
||||
{
|
||||
public:
|
||||
using AbstractTaskPlugin::AbstractTaskPlugin;
|
||||
|
||||
@@ -15,12 +15,11 @@ bool asst::RoguelikeStageEncounterTaskPlugin::verify(AsstMsg msg, const json::va
|
||||
return false;
|
||||
}
|
||||
|
||||
auto roguelike_name_opt = status()->get_properties(Status::RoguelikeTheme);
|
||||
if (!roguelike_name_opt) {
|
||||
if (m_roguelike_theme.empty()) {
|
||||
Log.error("Roguelike name doesn't exist!");
|
||||
return false;
|
||||
}
|
||||
const std::string roguelike_name = std::move(roguelike_name_opt.value()) + "@";
|
||||
const std::string roguelike_name = m_roguelike_theme + "@";
|
||||
const std::string& task = details.get("details", "task", "");
|
||||
std::string_view task_view = task;
|
||||
if (task_view.starts_with(roguelike_name)) {
|
||||
@@ -38,12 +37,11 @@ bool asst::RoguelikeStageEncounterTaskPlugin::_run()
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
std::string rogue_theme = status()->get_properties(Status::RoguelikeTheme).value();
|
||||
std::string rogue_mode = status()->get_properties(Status::RoguelikeMode).value();
|
||||
std::vector<RoguelikeEvent> events = RoguelikeStageEncounter.get_events(rogue_theme);
|
||||
std::vector<RoguelikeEvent> events = RoguelikeStageEncounter.get_events(m_roguelike_theme);
|
||||
// 刷源石锭模式和烧水模式
|
||||
if (rogue_mode == "1" || rogue_mode == "4") {
|
||||
events = RoguelikeStageEncounter.get_events(rogue_theme + "_deposit");
|
||||
events = RoguelikeStageEncounter.get_events(m_roguelike_theme + "_deposit");
|
||||
}
|
||||
std::vector<std::string> event_names;
|
||||
std::unordered_map<std::string, RoguelikeEvent> event_map;
|
||||
@@ -75,7 +73,7 @@ bool asst::RoguelikeStageEncounterTaskPlugin::_run()
|
||||
RoguelikeEvent event = event_map.at(text);
|
||||
Log.info("Event:", event.name, "choose option", event.default_choose);
|
||||
for (int j = 0; j < 2; ++j) {
|
||||
ProcessTask(*this, { rogue_theme + "@Roguelike@OptionChoose" + std::to_string(event.option_num) + "-" +
|
||||
ProcessTask(*this, { m_roguelike_theme + "@Roguelike@OptionChoose" + std::to_string(event.option_num) + "-" +
|
||||
std::to_string(event.default_choose) })
|
||||
.run();
|
||||
sleep(300);
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
#include "Task/AbstractTaskPlugin.h"
|
||||
#include "Task/Roguelike/RoguelikeConfig.h"
|
||||
|
||||
namespace asst
|
||||
{
|
||||
class RoguelikeStageEncounterTaskPlugin : public AbstractTaskPlugin
|
||||
class RoguelikeStageEncounterTaskPlugin : public AbstractTaskPlugin, public RoguelikeConfig
|
||||
{
|
||||
public:
|
||||
using AbstractTaskPlugin::AbstractTaskPlugin;
|
||||
|
||||
Reference in New Issue
Block a user