forked from hzqst/CGAssistantJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path长期工作证.js
197 lines (185 loc) · 4.3 KB
/
长期工作证.js
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
var cga = require(process.env.CGA_DIR_PATH_UTF8+'/cgaapi')(function(){
var exchange = (cb)=>{
cga.travel.falan.toStone('E2', ()=>{
cga.walkList([
[230, 78, null],
[230, 82, null],
[231, 83, null],
], ()=>{
cga.TurnTo(233, 83);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(4, 0);
cga.walkList([
[230, 82, null],
[230, 78, null],
[233, 78, null],
], ()=>{
cb(true);
});
});
});
});
});
});
}
var retryRoutine = (cb) => {
cga.TurnTo(38, 7);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitNPCDialog((err, dlg)=>{
if(dlg && dlg.message.indexOf('适当休息') >= 0){
cb(false, new Error('已经领完可以领取的所有包裹!'));
return;
}
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog((err, dlg)=>{
if(dlg && dlg.message.indexOf('伊尔村') >= 0 &&
dlg.message.indexOf('圣拉鲁卡村') >= 0 &&
dlg.message.indexOf('维诺亚村') >= 0 &&
dlg.message.indexOf('奇利村') >= 0 &&
dlg.message.indexOf('加纳村') >= 0
){
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, 0);
if(cga.getItemCount('蜗牛的包裹') > 0)
cb(true);
else
cb(false, new Error('领取包裹失败!'));
});
});
}
else{
retryRoutine(cb)
}
});
});
});
});
});
}
var stage1 = (cb)=>{
cga.travel.falan.toTeleRoom('伊尔村', (r)=>{
cga.walkList([
[12, 17, '村长的家'],
[6, 13, '伊尔村'],
[45, 31, '芙蕾雅'],
[684, 343, null],
], function(r){
cga.TurnTo(686, 343);
setTimeout(cb, 1000, true);
});
});
}
var stage2 = (cb)=>{
cga.travel.falan.toTeleRoom('圣拉鲁卡村', (r)=>{
cga.walkList([
[8, 4, null],
[7, 3, '村长的家'],
[2, 9, '圣拉鲁卡村'],
[52, 55, '芙蕾雅'],
[136, 218, null],
], function(r){
cga.TurnTo(136, 216);
setTimeout(cb, 1000, true);
});
});
}
var stage3 = (cb)=>{
cga.travel.falan.toTeleRoom('维诺亚村', (r)=>{
cga.walkList([
[5, 1, '村长家的小房间'],
[0, 5, '村长的家'],
[10, 16, '维诺亚村'],
[67, 46, '芙蕾雅'],
[332, 481, null],
], function(r){
cga.TurnTo(332, 483);
setTimeout(cb, 1000, true);
});
});
}
var stage4 = (cb)=>{
cga.travel.falan.toTeleRoom('奇利村', (r)=>{
cga.walkList([
[7, 6, 3214],
[7, 1, 3212],
[1, 9, '奇利村'],
[59, 45, '索奇亚'],
[276, 292],
], function(r){
cga.TurnTo(278, 292);
setTimeout(cb, 1000, true);
});
});
}
var stage5 = (cb)=>{
cga.travel.falan.toTeleRoom('加纳村', (r)=>{
cga.walkList([
[5, 12, '村长的家'],
[1, 9, '加纳村'],
[47, 77, '索奇亚'],
[704, 148],
], function(r){
cga.TurnTo(706, 148);
cga.AsyncWaitNPCDialog(()=>{
if(cga.GetPlayerInfo().punchclock >= 3600)
cga.ClickNPCDialog(4, 0);
else
cga.ClickNPCDialog(8, 0);
setTimeout(cb, 1000, true);
});
});
});
}
var getjob = (cb)=>{
cga.travel.falan.toStone('E2', ()=>{
cga.walkList([
[238, 64, '冒险者旅馆'],
[33, 27, '冒险者旅馆 2楼'],
[38, 8, null],
], ()=>{
retryRoutine((r, err)=>{
if(!r)
throw err;
cb(true);
});
});
});
}
var loop = ()=>{
if(cga.getItemCount('蜗牛的包裹') > 0){
if(cga.getItemCount('#700298') > 0){
stage1(loop);
}
else if(cga.getItemCount('#700299') > 0){
stage2(loop);
}
else if(cga.getItemCount('#700338') > 0){
stage3(loop);
}
else if(cga.getItemCount('#700339') > 0){
stage4(loop);
}
else if(cga.getItemCount('#700340') > 0){
stage5(loop);
}
}else if(cga.getItemCount('长期工作证领取卷') > 0){
exchange(loop);
}
else if(cga.getItemCount('工作证(长期)') > 0){
getjob(loop);
}
}
loop();
});