mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 09:50:40 +08:00
feat.新增无人机 for 巫恋任务插件,优化部分函数调用方式
This commit is contained in:
44
src/MeoAssistant/DronesForShamareTaskPlugin.cpp
Normal file
44
src/MeoAssistant/DronesForShamareTaskPlugin.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "DronesForShamareTaskPlugin.h"
|
||||
|
||||
#include "InfrastProductionTask.h"
|
||||
#include "ProcessTask.h"
|
||||
|
||||
bool asst::DronesForShamareTaskPlugin::verify(AsstMsg msg, const json::value& details) const
|
||||
{
|
||||
if (msg != AsstMsg::SubTaskExtraInfo
|
||||
|| details.get("subtask", std::string()) != "InfrastTradeTask") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (details.at("what").as_string() == "ProductOfFacility"
|
||||
&& details.at("details").at("product").as_string() == "Money") {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void asst::DronesForShamareTaskPlugin::set_task_ptr(AbstractTask* ptr)
|
||||
{
|
||||
AbstractTaskPlugin::set_task_ptr(ptr);
|
||||
|
||||
m_cast_ptr = dynamic_cast<InfrastProductionTask*>(ptr);
|
||||
}
|
||||
|
||||
bool asst::DronesForShamareTaskPlugin::_run()
|
||||
{
|
||||
ProcessTask shamare_task(*this, { "ShamareThumbnail" });
|
||||
shamare_task.set_retry_times(1);
|
||||
bool has_shamare = shamare_task.run();
|
||||
if (!has_shamare) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ProcessTask drone_task(*this, { "DroneAssistTrade" });
|
||||
bool drone_ret = drone_task.run();
|
||||
if (drone_ret) {
|
||||
m_cast_ptr->set_uses_of_drone("_Used");
|
||||
}
|
||||
return drone_ret;
|
||||
}
|
||||
Reference in New Issue
Block a user