mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-19 18:47:55 +08:00
feat.完成选关功能
This commit is contained in:
@@ -20,7 +20,8 @@ extern "C" {
|
||||
bool ASSTAPI AsstCatchCustom(asst::Assistant* p_asst, const char* address);
|
||||
bool ASSTAPI AsstCatchFake(asst::Assistant* p_asst);
|
||||
|
||||
bool ASSTAPI AsstAppendFight(asst::Assistant* p_asst, int max_mecidine, int max_stone, int max_times);
|
||||
bool ASSTAPI AsstAppendStartUp(asst::Assistant* p_asst);
|
||||
bool ASSTAPI AsstAppendFight(asst::Assistant* p_asst, const char* stage, int max_mecidine, int max_stone, int max_times);
|
||||
bool ASSTAPI AsstAppendAward(asst::Assistant* p_asst);
|
||||
bool ASSTAPI AsstAppendVisit(asst::Assistant* p_asst);
|
||||
bool ASSTAPI AsstAppendMall(asst::Assistant* p_asst, bool with_shopping);
|
||||
|
||||
@@ -1,10 +1,65 @@
|
||||
{
|
||||
"SanityBegin": {
|
||||
"StartUp": {
|
||||
"algorithm": "justreturn",
|
||||
"action": "doNothing",
|
||||
"next": [
|
||||
"GameStart",
|
||||
"StartToWakeUp",
|
||||
"ReturnToTerminal",
|
||||
"Terminal",
|
||||
"CloseAnno",
|
||||
"TodaysSupplies",
|
||||
"OfflineConfirm"
|
||||
]
|
||||
},
|
||||
"CE-5": {
|
||||
"algorithm": "justreturn",
|
||||
"action": "doNothing",
|
||||
"next": [
|
||||
"StageResourceToCE5",
|
||||
"StageCE",
|
||||
"StageCE5"
|
||||
]
|
||||
},
|
||||
"StageResourceToCE5": {
|
||||
"template": "StageResource.png",
|
||||
"roi": [
|
||||
790,
|
||||
640,
|
||||
60,
|
||||
60
|
||||
],
|
||||
"action": "clickSelf",
|
||||
"next": [
|
||||
"SwipeToStageCE"
|
||||
]
|
||||
},
|
||||
"SwipeToStageCE": {
|
||||
"algorithm": "justReturn",
|
||||
"action": "swipeToTheLeft",
|
||||
"next": [
|
||||
"StageCE"
|
||||
]
|
||||
},
|
||||
"StageCE": {
|
||||
"action": "clickSelf",
|
||||
"next": [
|
||||
"StageCE5"
|
||||
]
|
||||
},
|
||||
"StageCE5": {
|
||||
"action": "clickSelf",
|
||||
"roi": [
|
||||
850,
|
||||
140,
|
||||
250,
|
||||
80
|
||||
]
|
||||
},
|
||||
"StageBegin": {
|
||||
"algorithm": "justreturn",
|
||||
"action": "doNothing",
|
||||
"next": [
|
||||
"UsePrts",
|
||||
"StartButton1",
|
||||
"ReturnToTerminal",
|
||||
"PRTS",
|
||||
"EndOfAction",
|
||||
@@ -16,6 +71,14 @@
|
||||
"GameStart"
|
||||
]
|
||||
},
|
||||
"FightBegin": {
|
||||
"algorithm": "justreturn",
|
||||
"action": "doNothing",
|
||||
"next": [
|
||||
"UsePrts",
|
||||
"StartButton1"
|
||||
]
|
||||
},
|
||||
"GameStart": {
|
||||
"action": "clickSelf",
|
||||
"roi": [
|
||||
@@ -381,7 +444,8 @@
|
||||
"LastBattle",
|
||||
"Terminal",
|
||||
"CloseAnno",
|
||||
"TodaysSupplies"
|
||||
"TodaysSupplies",
|
||||
"Stop"
|
||||
]
|
||||
},
|
||||
"TodaysSupplies": {
|
||||
@@ -410,8 +474,8 @@
|
||||
"LastBattle": {
|
||||
"algorithm": "OcrDetect",
|
||||
"text": [
|
||||
"前往上",
|
||||
"次作战"
|
||||
"前往",
|
||||
"作战"
|
||||
],
|
||||
"roi": [
|
||||
900,
|
||||
|
||||
BIN
resource/template/StageCE.png
Normal file
BIN
resource/template/StageCE.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 156 KiB |
BIN
resource/template/StageCE5.png
Normal file
BIN
resource/template/StageCE5.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
BIN
resource/template/StageResource.png
Normal file
BIN
resource/template/StageResource.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
@@ -150,7 +150,7 @@ bool asst::Assistant::catch_fake()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asst::Assistant::append_fight(int mecidine, int stone, int times, bool only_append)
|
||||
bool asst::Assistant::append_start_up(bool only_append)
|
||||
{
|
||||
LogTraceFunction;
|
||||
if (!m_inited) {
|
||||
@@ -160,11 +160,9 @@ bool asst::Assistant::append_fight(int mecidine, int stone, int times, bool only
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
|
||||
auto task_ptr = std::make_shared<ProcessTask>(task_callback, (void*)this);
|
||||
task_ptr->set_task_chain("Fight");
|
||||
task_ptr->set_tasks({ "SanityBegin" });
|
||||
task_ptr->set_times_limit("MedicineConfirm", mecidine);
|
||||
task_ptr->set_times_limit("StoneConfirm", stone);
|
||||
task_ptr->set_times_limit("StartButton1", times);
|
||||
task_ptr->set_task_chain("StartUp");
|
||||
task_ptr->set_tasks({ "StartUp" });
|
||||
task_ptr->set_times_limit("Terminal", 0);
|
||||
|
||||
m_tasks_queue.emplace(task_ptr);
|
||||
|
||||
@@ -175,6 +173,47 @@ bool asst::Assistant::append_fight(int mecidine, int stone, int times, bool only
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asst::Assistant::append_fight(const std::string& stage, int mecidine, int stone, int times, bool only_append)
|
||||
{
|
||||
LogTraceFunction;
|
||||
if (!m_inited) {
|
||||
return false;
|
||||
}
|
||||
|
||||
constexpr const char* TaskChain = "Fight";
|
||||
|
||||
// 进入选关界面(主界面的“终端”点进去)
|
||||
auto terminal_task_ptr = std::make_shared<ProcessTask>(task_callback, (void*)this);
|
||||
terminal_task_ptr->set_task_chain(TaskChain);
|
||||
terminal_task_ptr->set_tasks({ "StageBegin" });
|
||||
terminal_task_ptr->set_times_limit("LastBattle", 0);
|
||||
|
||||
// 进入对应的关卡
|
||||
auto stage_task_ptr = std::make_shared<ProcessTask>(task_callback, (void*)this);
|
||||
stage_task_ptr->set_task_chain(TaskChain);
|
||||
stage_task_ptr->set_tasks({ stage });
|
||||
|
||||
// 开始战斗任务
|
||||
auto fight_task_ptr = std::make_shared<ProcessTask>(task_callback, (void*)this);
|
||||
fight_task_ptr->set_task_chain(TaskChain);
|
||||
fight_task_ptr->set_tasks({ "FightBegin" });
|
||||
fight_task_ptr->set_times_limit("MedicineConfirm", mecidine);
|
||||
fight_task_ptr->set_times_limit("StoneConfirm", stone);
|
||||
fight_task_ptr->set_times_limit("StartButton1", times);
|
||||
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
|
||||
m_tasks_queue.emplace(terminal_task_ptr);
|
||||
m_tasks_queue.emplace(stage_task_ptr);
|
||||
m_tasks_queue.emplace(fight_task_ptr);
|
||||
|
||||
if (!only_append) {
|
||||
return start(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asst::Assistant::append_award(bool only_append)
|
||||
{
|
||||
return append_process_task("AwardBegin", "Award");
|
||||
|
||||
@@ -38,8 +38,10 @@ namespace asst
|
||||
// 不实际进行捕获,调试用接口
|
||||
bool catch_fake();
|
||||
|
||||
// 添加开始游戏的任务(进入到主界面)
|
||||
bool append_start_up(bool only_append = true);
|
||||
// 添加刷理智任务
|
||||
bool append_fight(int mecidine = 0, int stone = 0, int times = INT_MAX, bool only_append = true);
|
||||
bool append_fight(const std::string& stage, int mecidine = 0, int stone = 0, int times = INT_MAX, bool only_append = true);
|
||||
// 添加领取日常任务奖励任务
|
||||
bool append_award(bool only_append = true);
|
||||
// 添加访问好友任务
|
||||
|
||||
@@ -112,13 +112,22 @@ bool AsstCatchFake(asst::Assistant* p_asst)
|
||||
#endif // LOG_TRACE
|
||||
}
|
||||
|
||||
bool AsstAppendFight(asst::Assistant* p_asst, int max_mecidine, int max_stone, int max_times)
|
||||
bool ASSTAPI AsstAppendStartUp(asst::Assistant* p_asst)
|
||||
{
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return p_asst->append_fight(max_mecidine, max_stone, max_times);
|
||||
return p_asst->append_start_up();
|
||||
}
|
||||
|
||||
bool AsstAppendFight(asst::Assistant* p_asst, const char* stage, int max_mecidine, int max_stone, int max_times)
|
||||
{
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return p_asst->append_fight(stage, max_mecidine, max_stone, max_times);
|
||||
}
|
||||
|
||||
bool AsstAppendAward(asst::Assistant* p_asst)
|
||||
@@ -176,10 +185,10 @@ bool AsstAppendInfrast(asst::Assistant* p_asst, int work_mode, const char** orde
|
||||
order_vector.assign(order, order + order_size);
|
||||
|
||||
return p_asst->append_infrast(
|
||||
static_cast<asst::infrast::WorkMode>(work_mode),
|
||||
order_vector,
|
||||
uses_of_drones,
|
||||
dorm_threshold);
|
||||
static_cast<asst::infrast::WorkMode>(work_mode),
|
||||
order_vector,
|
||||
uses_of_drones,
|
||||
dorm_threshold);
|
||||
}
|
||||
|
||||
bool AsstAppendRecruit(asst::Assistant* p_asst, int max_times, const int select_level[], int select_len, const int confirm_level[], int confirm_len, bool need_refresh)
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
namespace asst
|
||||
{
|
||||
constexpr static const char* Version = "v2.4.2";
|
||||
constexpr static const char* Version = "v2.4.3";
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace MeoAsstGui
|
||||
|
||||
[DllImport("MeoAssistant.dll")] private static extern bool AsstCatchCustom(IntPtr ptr, string address);
|
||||
|
||||
[DllImport("MeoAssistant.dll")] private static extern bool AsstAppendFight(IntPtr ptr, int max_medicine, int max_stone, int max_times);
|
||||
[DllImport("MeoAssistant.dll")] private static extern bool AsstAppendFight(IntPtr ptr, string stage, int max_medicine, int max_stone, int max_times);
|
||||
|
||||
[DllImport("MeoAssistant.dll")] private static extern bool AsstAppendAward(IntPtr ptr);
|
||||
|
||||
@@ -330,9 +330,9 @@ namespace MeoAsstGui
|
||||
}
|
||||
}
|
||||
|
||||
public bool AsstAppendFight(int max_medicine, int max_stone, int max_times)
|
||||
public bool AsstAppendFight(string stage, int max_medicine, int max_stone, int max_times)
|
||||
{
|
||||
return AsstAppendFight(_ptr, max_medicine, max_stone, max_times);
|
||||
return AsstAppendFight(_ptr, stage, max_medicine, max_stone, max_times);
|
||||
}
|
||||
|
||||
public bool AsstAppendAward()
|
||||
|
||||
@@ -7,15 +7,24 @@
|
||||
xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
|
||||
mc:Ignorable="d"
|
||||
xmlns:local="clr-namespace:MeoAsstGui"
|
||||
d:DesignHeight="150" d:DesignWidth="300">
|
||||
d:DesignHeight="200" d:DesignWidth="300">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="0" VerticalAlignment="Center">
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Margin="10" VerticalAlignment="Center"
|
||||
Text="关卡选择" />
|
||||
<ComboBox Width="100" Margin="10"
|
||||
ItemsSource="{Binding StageList}"
|
||||
DisplayMemberPath="Display"
|
||||
SelectedValuePath="Value"
|
||||
SelectedValue="{Binding Stage}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Center">
|
||||
<CheckBox IsChecked="{Binding UseMedicine}" IsHitTestVisible="{Binding Idle}" Content="吃理智药" Margin="10" />
|
||||
<TextBox Text="{Binding MedicineNumber}" IsReadOnly="{c:Binding Path=!Idle}" TextWrapping="Wrap" Margin="10"
|
||||
Width="50" InputMethod.IsInputMethodEnabled="False" />
|
||||
@@ -23,7 +32,7 @@
|
||||
<!--<TextBlock Style="{StaticResource TextBlockDefaultBold}" Text="{Binding MedicineInfo}" Margin="30, 0, 0, 0" VerticalAlignment="Center" />-->
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="2" VerticalAlignment="Center">
|
||||
<CheckBox IsChecked="{Binding UseStone}" IsHitTestVisible="{Binding Idle}" Content="吃石头 " Margin="10" />
|
||||
<TextBox Text="{Binding StoneNumber}" IsReadOnly="{c:Binding Path=!Idle}" TextWrapping="Wrap" Margin="10"
|
||||
Width="50" InputMethod.IsInputMethodEnabled="False" />
|
||||
@@ -31,7 +40,7 @@
|
||||
<!--<TextBlock Style="{StaticResource TextBlockDefaultBold}" Text="{Binding StoneInfo}" Margin="30, 0, 0, 0" VerticalAlignment="Center" />-->
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="2" VerticalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="3" VerticalAlignment="Center">
|
||||
<CheckBox IsChecked="{Binding HasTimesLimited}" IsHitTestVisible="{Binding Idle}" Content="指定次数" Margin="10" />
|
||||
<TextBox Text="{Binding MaxTimes}" IsReadOnly="{c:Binding Path=!Idle}" TextWrapping="Wrap" Margin="10"
|
||||
Width="50" InputMethod.IsInputMethodEnabled="False" />
|
||||
|
||||
@@ -56,6 +56,10 @@ namespace MeoAsstGui
|
||||
}
|
||||
}
|
||||
TaskItemViewModels = new ObservableCollection<DragItemViewModel>(temp_order_list);
|
||||
|
||||
StageList = new List<CombData>();
|
||||
StageList.Add(new CombData { Display = "上次作战", Value = "LastBattle" });
|
||||
StageList.Add(new CombData { Display = "龙门币-5", Value = "CE-5" });
|
||||
}
|
||||
|
||||
public void AddLog(string content, string color = "Gray", string weight = "Regular")
|
||||
@@ -187,7 +191,7 @@ namespace MeoAsstGui
|
||||
}
|
||||
|
||||
var asstProxy = _container.Get<AsstProxy>();
|
||||
return asstProxy.AsstAppendFight(medicine, stone, times);
|
||||
return asstProxy.AsstAppendFight(Stage, medicine, stone, times);
|
||||
}
|
||||
|
||||
private bool appendInfrast()
|
||||
@@ -288,6 +292,20 @@ namespace MeoAsstGui
|
||||
}
|
||||
}
|
||||
|
||||
public List<CombData> StageList { get; set; }
|
||||
|
||||
private string _stage = ViewStatusStorage.Get("MainFunction.Stage", "LastBattle");
|
||||
|
||||
public string Stage
|
||||
{
|
||||
get { return _stage; }
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _stage, value);
|
||||
ViewStatusStorage.Set("MainFunction.Stage", value);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _useMedicine = System.Convert.ToBoolean(ViewStatusStorage.Get("MainFunction.UseMedicine", bool.TrueString));
|
||||
|
||||
public bool UseMedicine
|
||||
|
||||
@@ -5,18 +5,18 @@
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
const char* get_cur_dir()
|
||||
std::string get_cur_dir()
|
||||
{
|
||||
char exepath_buff[_MAX_PATH] = { 0 };
|
||||
::GetModuleFileNameA(NULL, exepath_buff, _MAX_PATH);
|
||||
std::string exepath(exepath_buff);
|
||||
std::string cur_dir = exepath.substr(0, exepath.find_last_of('\\') + 1);
|
||||
return cur_dir.c_str();
|
||||
return cur_dir;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
auto ptr = AsstCreate(get_cur_dir());
|
||||
auto ptr = AsstCreate(get_cur_dir().c_str());
|
||||
auto ret = AsstCatchEmulator(ptr);
|
||||
if (!ret) {
|
||||
getchar();
|
||||
@@ -29,12 +29,13 @@ int main(int argc, char** argv)
|
||||
|
||||
char ch = 0;
|
||||
while (ch != 'q') {
|
||||
//AsstAppendFight(ptr, 0, 0, 99999);
|
||||
//AsstAppendStartUp(ptr);
|
||||
AsstAppendFight(ptr, "CE-5", 0, 0, 99999);
|
||||
//AsstAppendVisit(ptr, true);
|
||||
{
|
||||
const int required[] = { 3, 4, 5, 6 };
|
||||
AsstStartRecruitCalc(ptr, required, sizeof(required) / sizeof(int), true);
|
||||
}
|
||||
//{
|
||||
// const int required[] = { 3, 4, 5, 6 };
|
||||
// AsstStartRecruitCalc(ptr, required, sizeof(required) / sizeof(int), true);
|
||||
//}
|
||||
//AsstAppendDebug(ptr);
|
||||
//{
|
||||
// const char* order[] = { "Trade", "Mfg", "Dorm" };
|
||||
|
||||
Reference in New Issue
Block a user