mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-19 02:23:01 +08:00
chore.项目重命名
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "Assistance.h"
|
||||
#include "Assistant.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <time.h>
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
using namespace asst;
|
||||
|
||||
Assistance::Assistance(std::string dirname, AsstCallback callback, void* callback_arg)
|
||||
Assistant::Assistant(std::string dirname, AsstCallback callback, void* callback_arg)
|
||||
: m_dirname(std::move(dirname) + "\\"),
|
||||
m_callback(callback),
|
||||
m_callback_arg(callback_arg)
|
||||
@@ -51,11 +51,11 @@ Assistance::Assistance(std::string dirname, AsstCallback callback, void* callbac
|
||||
throw error;
|
||||
}
|
||||
|
||||
m_working_thread = std::thread(std::bind(&Assistance::working_proc, this));
|
||||
m_msg_thread = std::thread(std::bind(&Assistance::msg_proc, this));
|
||||
m_working_thread = std::thread(std::bind(&Assistant::working_proc, this));
|
||||
m_msg_thread = std::thread(std::bind(&Assistant::msg_proc, this));
|
||||
}
|
||||
|
||||
Assistance::~Assistance()
|
||||
Assistant::~Assistant()
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
@@ -72,7 +72,7 @@ Assistance::~Assistance()
|
||||
}
|
||||
}
|
||||
|
||||
bool asst::Assistance::catch_default()
|
||||
bool asst::Assistant::catch_default()
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
@@ -87,7 +87,7 @@ bool asst::Assistance::catch_default()
|
||||
}
|
||||
}
|
||||
|
||||
bool Assistance::catch_emulator(const std::string& emulator_name)
|
||||
bool Assistant::catch_emulator(const std::string& emulator_name)
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
@@ -118,7 +118,7 @@ bool Assistance::catch_emulator(const std::string& emulator_name)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool asst::Assistance::catch_custom(const std::string& address)
|
||||
bool asst::Assistant::catch_custom(const std::string& address)
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
@@ -140,7 +140,7 @@ bool asst::Assistance::catch_custom(const std::string& address)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool asst::Assistance::catch_fake()
|
||||
bool asst::Assistant::catch_fake()
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
@@ -150,7 +150,7 @@ bool asst::Assistance::catch_fake()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asst::Assistance::append_fight(int mecidine, int stone, int times, bool only_append)
|
||||
bool asst::Assistant::append_fight(int mecidine, int stone, int times, bool only_append)
|
||||
{
|
||||
LogTraceFunction;
|
||||
if (!m_inited) {
|
||||
@@ -175,17 +175,17 @@ bool asst::Assistance::append_fight(int mecidine, int stone, int times, bool onl
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asst::Assistance::append_award(bool only_append)
|
||||
bool asst::Assistant::append_award(bool only_append)
|
||||
{
|
||||
return append_process_task("AwardBegin", "Award");
|
||||
}
|
||||
|
||||
bool asst::Assistance::append_visit(bool only_append)
|
||||
bool asst::Assistant::append_visit(bool only_append)
|
||||
{
|
||||
return append_process_task("VisitBegin", "Visit");
|
||||
}
|
||||
|
||||
bool asst::Assistance::append_mall(bool with_shopping, bool only_append)
|
||||
bool asst::Assistant::append_mall(bool with_shopping, bool only_append)
|
||||
{
|
||||
LogTraceFunction;
|
||||
if (!m_inited) {
|
||||
@@ -211,7 +211,7 @@ bool asst::Assistance::append_mall(bool with_shopping, bool only_append)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Assistance::append_process_task(const std::string& task, std::string task_chain, int retry_times)
|
||||
bool Assistant::append_process_task(const std::string& task, std::string task_chain, int retry_times)
|
||||
{
|
||||
LogTraceFunction;
|
||||
if (!m_inited) {
|
||||
@@ -238,7 +238,7 @@ bool Assistance::append_process_task(const std::string& task, std::string task_c
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asst::Assistance::append_recruit(unsigned max_times, const std::vector<int>& select_level, const std::vector<int>& confirm_level, bool need_refresh)
|
||||
bool asst::Assistant::append_recruit(unsigned max_times, const std::vector<int>& select_level, const std::vector<int>& confirm_level, bool need_refresh)
|
||||
{
|
||||
LogTraceFunction;
|
||||
if (!m_inited) {
|
||||
@@ -262,7 +262,7 @@ bool asst::Assistance::append_recruit(unsigned max_times, const std::vector<int>
|
||||
}
|
||||
|
||||
#ifdef LOG_TRACE
|
||||
bool Assistance::append_debug()
|
||||
bool Assistant::append_debug()
|
||||
{
|
||||
LogTraceFunction;
|
||||
if (!m_inited) {
|
||||
@@ -285,7 +285,7 @@ bool Assistance::append_debug()
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Assistance::start_recruit_calc(const std::vector<int>& select_level, bool set_time)
|
||||
bool Assistant::start_recruit_calc(const std::vector<int>& select_level, bool set_time)
|
||||
{
|
||||
LogTraceFunction;
|
||||
if (!m_inited) {
|
||||
@@ -303,7 +303,7 @@ bool Assistance::start_recruit_calc(const std::vector<int>& select_level, bool s
|
||||
return start(false);
|
||||
}
|
||||
|
||||
bool asst::Assistance::append_infrast(infrast::WorkMode work_mode, const std::vector<std::string>& order, const std::string& uses_of_drones, double dorm_threshold, bool only_append)
|
||||
bool asst::Assistant::append_infrast(infrast::WorkMode work_mode, const std::vector<std::string>& order, const std::string& uses_of_drones, double dorm_threshold, bool only_append)
|
||||
{
|
||||
LogTraceFunction;
|
||||
if (!m_inited) {
|
||||
@@ -398,7 +398,7 @@ bool asst::Assistance::append_infrast(infrast::WorkMode work_mode, const std::ve
|
||||
return true;
|
||||
}
|
||||
|
||||
void asst::Assistance::set_penguin_id(const std::string& id)
|
||||
void asst::Assistant::set_penguin_id(const std::string& id)
|
||||
{
|
||||
auto& opt = Resrc.cfg().get_options();
|
||||
if (id.empty()) {
|
||||
@@ -409,7 +409,7 @@ void asst::Assistance::set_penguin_id(const std::string& id)
|
||||
}
|
||||
}
|
||||
|
||||
bool asst::Assistance::start(bool block)
|
||||
bool asst::Assistant::start(bool block)
|
||||
{
|
||||
LogTraceFunction;
|
||||
Log.trace("Start |", block ? "block" : "non block");
|
||||
@@ -428,7 +428,7 @@ bool asst::Assistance::start(bool block)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Assistance::stop(bool block)
|
||||
bool Assistant::stop(bool block)
|
||||
{
|
||||
LogTraceFunction;
|
||||
Log.trace("Stop |", block ? "block" : "non block");
|
||||
@@ -447,13 +447,13 @@ bool Assistance::stop(bool block)
|
||||
return true;
|
||||
}
|
||||
|
||||
void Assistance::working_proc()
|
||||
void Assistant::working_proc()
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
std::string pre_taskchain;
|
||||
while (!m_thread_exit) {
|
||||
//LogTraceScope("Assistance::working_proc Loop");
|
||||
//LogTraceScope("Assistant::working_proc Loop");
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
|
||||
if (!m_thread_idle && !m_tasks_queue.empty()) {
|
||||
@@ -500,12 +500,12 @@ void Assistance::working_proc()
|
||||
}
|
||||
}
|
||||
|
||||
void Assistance::msg_proc()
|
||||
void Assistant::msg_proc()
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
while (!m_thread_exit) {
|
||||
//LogTraceScope("Assistance::msg_proc Loop");
|
||||
//LogTraceScope("Assistant::msg_proc Loop");
|
||||
std::unique_lock<std::mutex> lock(m_msg_mutex);
|
||||
if (!m_msg_queue.empty()) {
|
||||
// 结构化绑定只能是引用,后续的pop会使引用失效,所以需要重新构造一份,这里采用了move的方式
|
||||
@@ -525,11 +525,11 @@ void Assistance::msg_proc()
|
||||
}
|
||||
}
|
||||
|
||||
void Assistance::task_callback(AsstMsg msg, const json::value& detail, void* custom_arg)
|
||||
void Assistant::task_callback(AsstMsg msg, const json::value& detail, void* custom_arg)
|
||||
{
|
||||
Log.trace("Assistance::task_callback |", msg, detail.to_string());
|
||||
Log.trace("Assistant::task_callback |", msg, detail.to_string());
|
||||
|
||||
Assistance* p_this = (Assistance*)custom_arg;
|
||||
Assistant* p_this = (Assistant*)custom_arg;
|
||||
json::value more_detail = detail;
|
||||
switch (msg) {
|
||||
case AsstMsg::PtrIsNull:
|
||||
@@ -548,20 +548,20 @@ void Assistance::task_callback(AsstMsg msg, const json::value& detail, void* cus
|
||||
p_this->append_callback(msg, std::move(more_detail));
|
||||
}
|
||||
|
||||
void asst::Assistance::append_callback(AsstMsg msg, json::value detail)
|
||||
void asst::Assistant::append_callback(AsstMsg msg, json::value detail)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(m_msg_mutex);
|
||||
m_msg_queue.emplace(msg, std::move(detail));
|
||||
m_msg_condvar.notify_one();
|
||||
}
|
||||
|
||||
void Assistance::clear_cache()
|
||||
void Assistant::clear_cache()
|
||||
{
|
||||
Resrc.item().clear_drop_count();
|
||||
task.clear_cache();
|
||||
}
|
||||
|
||||
json::value asst::Assistance::organize_stage_drop(const json::value& rec)
|
||||
json::value asst::Assistant::organize_stage_drop(const json::value& rec)
|
||||
{
|
||||
json::value dst = rec;
|
||||
auto& item = Resrc.item();
|
||||
@@ -23,11 +23,11 @@ namespace asst
|
||||
class Controller;
|
||||
class Identify;
|
||||
|
||||
class Assistance
|
||||
class Assistant
|
||||
{
|
||||
public:
|
||||
Assistance(std::string dirname, AsstCallback callback = nullptr, void* callback_arg = nullptr);
|
||||
~Assistance();
|
||||
Assistant(std::string dirname, AsstCallback callback = nullptr, void* callback_arg = nullptr);
|
||||
~Assistant();
|
||||
|
||||
// 根据配置文件,决定捕获模拟器、USB 还是远程设备
|
||||
bool catch_default();
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <meojson/json_value.h>
|
||||
|
||||
#include "Assistance.h"
|
||||
#include "Assistant.h"
|
||||
#include "AsstDef.h"
|
||||
#include "AsstUtils.hpp"
|
||||
#include "Version.h"
|
||||
@@ -43,7 +43,7 @@ void CallbackTrans(asst::AsstMsg msg, const json::value& json, void* custom_arg)
|
||||
void* AsstCreate(const char* dirname)
|
||||
{
|
||||
try {
|
||||
return new asst::Assistance(dirname);
|
||||
return new asst::Assistant(dirname);
|
||||
}
|
||||
catch (...) {
|
||||
return nullptr;
|
||||
@@ -55,7 +55,7 @@ void* AsstCreateEx(const char* dirname, AsstCallback callback, void* custom_arg)
|
||||
try {
|
||||
// 创建多实例回调会有问题,有空再慢慢整
|
||||
_callback = callback;
|
||||
return new asst::Assistance(dirname, CallbackTrans, custom_arg);
|
||||
return new asst::Assistant(dirname, CallbackTrans, custom_arg);
|
||||
}
|
||||
catch (...) {
|
||||
return nullptr;
|
||||
@@ -78,7 +78,7 @@ bool AsstCatchDefault(void* p_asst)
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((asst::Assistance*)p_asst)->catch_default();
|
||||
return ((asst::Assistant*)p_asst)->catch_default();
|
||||
}
|
||||
|
||||
bool AsstCatchEmulator(void* p_asst)
|
||||
@@ -87,7 +87,7 @@ bool AsstCatchEmulator(void* p_asst)
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((asst::Assistance*)p_asst)->catch_emulator();
|
||||
return ((asst::Assistant*)p_asst)->catch_emulator();
|
||||
}
|
||||
|
||||
bool AsstCatchCustom(void* p_asst, const char* address)
|
||||
@@ -96,7 +96,7 @@ bool AsstCatchCustom(void* p_asst, const char* address)
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((asst::Assistance*)p_asst)->catch_custom(address);
|
||||
return ((asst::Assistant*)p_asst)->catch_custom(address);
|
||||
}
|
||||
|
||||
bool AsstCatchFake(void* p_asst)
|
||||
@@ -106,7 +106,7 @@ bool AsstCatchFake(void* p_asst)
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((asst::Assistance*)p_asst)->catch_fake();
|
||||
return ((asst::Assistant*)p_asst)->catch_fake();
|
||||
#else
|
||||
return false;
|
||||
#endif // LOG_TRACE
|
||||
@@ -117,7 +117,7 @@ bool AsstAppendFight(void* p_asst, int max_mecidine, int max_stone, int max_time
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
asst::Assistance* ptr = (asst::Assistance*)p_asst;
|
||||
asst::Assistant* ptr = (asst::Assistant*)p_asst;
|
||||
|
||||
return ptr->append_fight(max_mecidine, max_stone, max_times);
|
||||
}
|
||||
@@ -128,7 +128,7 @@ bool AsstAppendAward(void* p_asst)
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((asst::Assistance*)p_asst)->append_award();
|
||||
return ((asst::Assistant*)p_asst)->append_award();
|
||||
}
|
||||
|
||||
bool AsstAppendVisit(void* p_asst)
|
||||
@@ -137,7 +137,7 @@ bool AsstAppendVisit(void* p_asst)
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((asst::Assistance*)p_asst)->append_visit();
|
||||
return ((asst::Assistant*)p_asst)->append_visit();
|
||||
}
|
||||
|
||||
bool AsstAppendMall(void* p_asst, bool with_shopping)
|
||||
@@ -146,7 +146,7 @@ bool AsstAppendMall(void* p_asst, bool with_shopping)
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((asst::Assistance*)p_asst)->append_mall(with_shopping);
|
||||
return ((asst::Assistant*)p_asst)->append_mall(with_shopping);
|
||||
}
|
||||
|
||||
//bool AsstAppendProcessTask(void* p_asst, const char* task)
|
||||
@@ -155,7 +155,7 @@ bool AsstAppendMall(void* p_asst, bool with_shopping)
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return ((asst::Assistance*)p_asst)->append_process_task(task);
|
||||
// return ((asst::Assistant*)p_asst)->append_process_task(task);
|
||||
//}
|
||||
|
||||
bool AsstStartRecruitCalc(void* p_asst, const int select_level[], int required_len, bool set_time)
|
||||
@@ -165,7 +165,7 @@ bool AsstStartRecruitCalc(void* p_asst, const int select_level[], int required_l
|
||||
}
|
||||
std::vector<int> level_vector;
|
||||
level_vector.assign(select_level, select_level + required_len);
|
||||
return ((asst::Assistance*)p_asst)->start_recruit_calc(level_vector, set_time);
|
||||
return ((asst::Assistant*)p_asst)->start_recruit_calc(level_vector, set_time);
|
||||
}
|
||||
|
||||
bool AsstAppendInfrast(void* p_asst, int work_mode, const char** order, int order_size, const char* uses_of_drones, double dorm_threshold)
|
||||
@@ -176,7 +176,7 @@ bool AsstAppendInfrast(void* p_asst, int work_mode, const char** order, int orde
|
||||
std::vector<std::string> order_vector;
|
||||
order_vector.assign(order, order + order_size);
|
||||
|
||||
return ((asst::Assistance*)p_asst)->
|
||||
return ((asst::Assistant*)p_asst)->
|
||||
append_infrast(
|
||||
static_cast<asst::infrast::WorkMode>(work_mode),
|
||||
order_vector,
|
||||
@@ -194,7 +194,7 @@ bool AsstAppendRecruit(void* p_asst, int max_times, const int select_level[], in
|
||||
std::vector<int> confirm_vector;
|
||||
confirm_vector.assign(confirm_level, confirm_level + confirm_len);
|
||||
|
||||
return ((asst::Assistance*)p_asst)->append_recruit(max_times, required_vector, confirm_vector, need_refresh);
|
||||
return ((asst::Assistant*)p_asst)->append_recruit(max_times, required_vector, confirm_vector, need_refresh);
|
||||
}
|
||||
|
||||
bool AsstStart(void* p_asst)
|
||||
@@ -203,7 +203,7 @@ bool AsstStart(void* p_asst)
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((asst::Assistance*)p_asst)->start();
|
||||
return ((asst::Assistant*)p_asst)->start();
|
||||
}
|
||||
|
||||
bool AsstStop(void* p_asst)
|
||||
@@ -212,7 +212,7 @@ bool AsstStop(void* p_asst)
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((asst::Assistance*)p_asst)->stop();
|
||||
return ((asst::Assistant*)p_asst)->stop();
|
||||
}
|
||||
|
||||
bool AsstSetPenguinId(void* p_asst, const char* id)
|
||||
@@ -220,7 +220,7 @@ bool AsstSetPenguinId(void* p_asst, const char* id)
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
auto ptr = (asst::Assistance*)p_asst;
|
||||
auto ptr = (asst::Assistant*)p_asst;
|
||||
ptr->set_penguin_id(id);
|
||||
return true;
|
||||
}
|
||||
@@ -231,7 +231,7 @@ bool AsstSetPenguinId(void* p_asst, const char* id)
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// return ((asst::Assistance*)p_asst)->set_param(type, param, value);
|
||||
// return ((asst::Assistant*)p_asst)->set_param(type, param, value);
|
||||
//}
|
||||
|
||||
const char* AsstGetVersion()
|
||||
@@ -245,7 +245,7 @@ bool AsstAppendDebug(void* p_asst)
|
||||
return false;
|
||||
}
|
||||
#if LOG_TRACE
|
||||
return ((asst::Assistance*)p_asst)->append_debug();
|
||||
return ((asst::Assistant*)p_asst)->append_debug();
|
||||
#else
|
||||
return false;
|
||||
#endif // LOG_TRACE
|
||||
|
||||
@@ -24,8 +24,8 @@ namespace asst
|
||||
ReachedLimit, // 单个原子任务达到次数上限
|
||||
ReadyToSleep, // 准备开始睡眠
|
||||
EndOfSleep, // 睡眠结束
|
||||
AppendProcessTask, // [已弃用] 新增流程任务,Assistance内部消息,外部不需要处理
|
||||
AppendTask, // [已弃用] 新增任务,Assistance内部消息,外部不需要处理
|
||||
AppendProcessTask, // [已弃用] 新增流程任务,Assistant内部消息,外部不需要处理
|
||||
AppendTask, // [已弃用] 新增任务,Assistant内部消息,外部不需要处理
|
||||
TaskCompleted, // 单个原子任务完成
|
||||
PrintWindow, // 截图消息
|
||||
ProcessTaskStopAction, // 流程任务执行到了Stop的动作
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<ClInclude Include="AbstractImageAnalyzer.h" />
|
||||
<ClInclude Include="AbstractResource.h" />
|
||||
<ClInclude Include="AbstractTask.h" />
|
||||
<ClInclude Include="Assistance.h" />
|
||||
<ClInclude Include="Assistant.h" />
|
||||
<ClInclude Include="AsstInfrastDef.h" />
|
||||
<ClInclude Include="AsstUtils.hpp" />
|
||||
<ClInclude Include="AsstDef.h" />
|
||||
@@ -93,7 +93,7 @@
|
||||
<ClCompile Include="PenguinPack.cpp" />
|
||||
<ClCompile Include="RecruitImageAnalyzer.cpp" />
|
||||
<ClCompile Include="Resource.cpp" />
|
||||
<ClCompile Include="Assistance.cpp" />
|
||||
<ClCompile Include="Assistant.cpp" />
|
||||
<ClCompile Include="AsstCaller.cpp" />
|
||||
<ClCompile Include="GeneralConfiger.cpp" />
|
||||
<ClCompile Include="ItemConfiger.cpp" />
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<ClInclude Include="Controller.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Assistance.h">
|
||||
<ClInclude Include="Assistant.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RecruitConfiger.h">
|
||||
@@ -221,7 +221,7 @@
|
||||
<ClCompile Include="Controller.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Assistance.cpp">
|
||||
<ClCompile Include="Assistant.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RecruitConfiger.cpp">
|
||||
|
||||
@@ -401,8 +401,8 @@ namespace MeoAsstGui
|
||||
ReachedLimit, // 单个原子任务达到次数上限
|
||||
ReadyToSleep, // 准备开始睡眠
|
||||
EndOfSleep, // 睡眠结束
|
||||
AppendProcessTask, // 新增流程任务,Assistance内部消息,外部不需要处理
|
||||
AppendTask, // 新增任务,Assistance内部消息,外部不需要处理
|
||||
AppendProcessTask, // 新增流程任务,Assistant内部消息,外部不需要处理
|
||||
AppendTask, // 新增任务,Assistant内部消息,外部不需要处理
|
||||
TaskCompleted, // 单个原子任务完成
|
||||
PrintWindow, // 截图消息
|
||||
ProcessTaskStopAction, // 流程任务执行到了Stop的动作
|
||||
|
||||
Reference in New Issue
Block a user