forked from MaaAssistantArknights/MaaAssistantArknights
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.wo
101 lines (90 loc) · 2.71 KB
/
demo.wo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import maa;
import pkg::filesystem;
let ASST_DEBUG = true;
func main()
{
let cur_path = filesys::normalize(std::exepath());
if (AsstLoadResource(cur_path->tostring) == AsstTrue)
{
if (ASST_DEBUG)
{
let overseas_dir = cur_path / "resource" / "global";
for (let _, client: ["YoStarJP", "YoStarEN", "YoStarKR", "txwy"])
{
let overseas_path = overseas_dir / client;
let loaded = AsstLoadResource(cur_path->tostring);
if (AsstLoadResource(overseas_path->tostring) != AsstTrue || loaded != AsstTrue)
return result::err("Load resource failed.");
}
}
let ptr = AsstCreate();
if (ptr == nullptr: AsstHandle)
return result::err("AsstCreate() failed.");
if (ASST_DEBUG)
do AsstAsyncConnect(ptr, "adb", "127.0.0.1:5555", "DEBUG", AsstTrue);
else
do AsstAsyncConnect(ptr, "adb", "127.0.0.1:5555", "", AsstTrue);
if (AsstConnected(ptr) == AsstFalse)
{
AsstDestroy(ptr);
return result::err("Connect failed.");
}
if (ASST_DEBUG)
{
do AsstAppendTask(ptr, "Debug", "");
}
else
{
do AsstAppendTask(ptr, "StartUp", "");
do AsstAppendTask(ptr, "Fight", @"
{
"stage": "1-7"
}
"@);
do AsstAppendTask(ptr, "Recruit", @"
{
"select":[4],
"confirm":[3,4],
"times":4
}
"@);
do AsstAppendTask(ptr, "Infrast", @"
{
"facility": ["Mfg", "Trade", "Power", "Control", "Reception", "Office", "Dorm"],
"drones": "Money"
}
"@);
do AsstAppendTask(ptr, "Mall", @"
{
"shopping": true,
"buy_first": [
"许可"
],
"black_list": [
"家具",
"碳"
]
}
"@);
do AsstAppendTask(ptr, "Award", "");
do AsstAppendTask(ptr, "Roguelike", @"
{
"squad": "突击战术分队",
"roles": "先手必胜",
"core_char": "棘刺"
}
"@);
}
do AsstStart(ptr);
while (AsstRunning(ptr) == AsstTrue)
{
std::sleep(0.1);
}
do AsstStop(ptr);
do AsstDestroy(ptr);
return result::ok(do nil);
}
else
return result::err("Load resource failed.");
}
main()->unwarp();