forked from hzqst/CGAssistantJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path刷王冠小猫帽.js
515 lines (480 loc) · 12.8 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
var cga = require(process.env.CGA_DIR_PATH_UTF8+'/cgaapi')(function(){
console.log('重要提示:途经的每一层塔地图档都要下载,否则自动寻路会失败!')
console.log('BUG期间建议移动速度不超过300%否则容易掉线')
var loop_count = 0;
var mineArray = [
{
type : 1,
name : '王冠',
func : (cb)=>{
}
},
{
type : 2,
name : '公主头冠',
func : (cb)=>{
}
},
{
type : 3,
name : '小猫帽',
func : (cb)=>{
}
},
]
var mineObject = null;
const clearDialogs = (cb) => cga.AsyncWaitNPCDialog(error => {
if (error) {
cb();
} else {
clearDialogs(cb);
}
}, 1000);
var task = cga.task.Task('圣域守护者', [
{//0
intro: '1.前往雪拉威森塔95楼与守护者杰斯(28.104)对话,选“是”获得【塞特的护身符】。',
workFunc: function(cb2){
var stage2 = ()=>{
cga.TurnTo(28, 103);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(1, 0);
cga.AsyncWaitMovement({map:'雪拉威森塔96层', delay:1000, timeout:5000}, cb2);
});
});
});
});
}
if(mineObject.type != 3)
{
if(cga.getItemCount('王冠') >= 1)
{
if (typeof global.bridge == 'function') global.bridge();
else cga.travel.falan.toBank(()=>{
cga.walkList([
[11, 8],
], ()=>{
cga.turnDir(0);
cga.AsyncWaitNPCDialog(()=>{
cga.saveToBankAll('王冠', 0, (r)=>{
if (r) throw 'bank full';
cb2('restart stage');
});
}, 1000);
});
});
return;
}
if(cga.getItemCount('公主头冠') >= 1)
{
if (typeof global.bridge == 'function') global.bridge();
else cga.travel.falan.toBank(()=>{
cga.walkList([
[11, 8],
], ()=>{
cga.turnDir(0);
cga.AsyncWaitNPCDialog(()=>{
cga.saveToBankAll('公主头冠', 0, (r)=>{
if (r) throw 'bank full';
cb2('restart stage');
});
}, 1000);
});
});
return;
}
}
else
{
if(cga.getItemCount('小猫帽') >= 1)
{
if (typeof global.bridge == 'function') global.bridge();
else cga.travel.falan.toBank(()=>{
cga.walkList([
[11, 8],
], ()=>{
cga.turnDir(0);
cga.AsyncWaitNPCDialog(()=>{
cga.saveToBankAll('小猫帽', 0, (r)=>{
if (r) throw 'bank full';
cb2('restart stage');
});
}, 1000);
});
});
return;
}
}
if(cga.needSupplyInitial())
{
if(cga.GetMapName() == '国民会馆'){
cga.walkList([
[109, 51]
], ()=>{
cga.TurnTo(107, 53);
setTimeout(cb2, 3000, 'restart stage');
})
return;
}
cga.travel.falan.toCastleHospital(()=>{
setTimeout(cb2, 3000, 'restart stage');
});
return;
}
if(cga.GetMapName() == '国民会馆'){
cga.walkList([
[108, 39, '雪拉威森塔1层'],
[73, 60],
[75, 50, '雪拉威森塔50层'],
[16, 44, '雪拉威森塔95层'],
[28, 105],
], stage2);
}
else
{
cga.travel.newisland.toLiXiaIsland(()=>{
cga.walkList([
[90, 99, '国民会馆'],
[108, 39, '雪拉威森塔1层'],
[73, 60],
[75, 50, '雪拉威森塔50层'],
[16, 44, '雪拉威森塔95层'],
[28, 105],
], stage2);
});
}
}
},
{//1
intro: '2.前往雪拉威森塔96楼与守护者梅亚(88.118)对话,交出【塞特的护身符】获得【梅雅的护身符】。',
workFunc: function(cb2){
if(cga.needSupplyInitial({ })){
cga.travel.falan.toCastleHospital(()=>{
setTimeout(()=>{
cga.travel.newisland.toStone('X', ()=>{
cb2('restart stage');
});
}, 3000);
});
return;
}
if(cga.GetMapName() != '雪拉威森塔96层'){
var useItem = cga.findItem('塞特的护身符');
if(useItem != -1){
clearDialogs(() => {
cga.UseItem(useItem);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitMovement({map:'雪拉威森塔95层', delay:1000, timeout:5000}, ()=>{
cga.TurnTo(29, 104);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(1, 0);
cga.AsyncWaitMovement({map:'雪拉威森塔96层', delay:1000, timeout:5000}, ()=>{
cb2('restart stage');
});
});
});
});
});
}
return;
}
cga.walkList([
[87, 118],
], ()=>{
cga.TurnTo(89, 118);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(1, 0);
cga.AsyncWaitMovement({map:'雪拉威森塔97层', delay:1000, timeout:5000}, cb2);
});
});
});
});
});
}
},
{//2
intro: '3.前往雪拉威森塔97楼与守护者迪斯(117.125)对话,交出【梅雅的护身符】获得【提斯的护身符】。',
workFunc: function(cb2){
if(cga.needSupplyInitial({ })){
cga.travel.falan.toCastleHospital(()=>{
setTimeout(()=>{
cga.travel.newisland.toStone('X', ()=>{
cb2('restart stage');
});
}, 3000);
});
return;
}
if(cga.GetMapName() != '雪拉威森塔97层'){
var useItem = cga.findItem('梅雅的护身符');
if(useItem != -1){
clearDialogs(() => {
cga.UseItem(useItem);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitMovement({map:'雪拉威森塔96层', delay:1000, timeout:5000}, ()=>{
cga.TurnTo(89, 118);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(1, 0);
cga.AsyncWaitMovement({map:'雪拉威森塔97层', delay:1000, timeout:5000}, ()=>{
cb2('restart stage');
});
});
});
});
});
}
return;
}
cga.walkList([
[117, 126],
], ()=>{
cga.TurnTo(117, 124);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(1, 0);
cga.AsyncWaitMovement({map:'雪拉威森塔98层', delay:1000, timeout:5000}, cb2);
});
});
});
});
});
});
}
},
{//3
intro: '4.前往雪拉威森塔98楼与守护者乌斯(120.120)对话,交出【提斯的护身符】获得【伍斯的护身符】。',
workFunc: function(cb2){
if(cga.needSupplyInitial({ })){
cga.travel.falan.toCastleHospital(()=>{
setTimeout(()=>{
cga.travel.newisland.toStone('X', ()=>{
cb2('restart stage');
});
}, 3000);
});
return;
}
if(cga.GetMapName() != '雪拉威森塔98层'){
var useItem = cga.findItem('提斯的护身符');
if(useItem != -1){
clearDialogs(() => {
cga.UseItem(useItem);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitMovement({map:'雪拉威森塔97层', delay:1000, timeout:5000}, ()=>{
cga.TurnTo(118, 125);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(1, 0);
cga.AsyncWaitMovement({map:'雪拉威森塔98层', delay:1000, timeout:5000}, ()=>{
cb2('restart stage');
});
});
});
});
});
}
return;
}
cga.walkList([
[120, 121],
], ()=>{
cga.TurnTo(120, 119);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(1, 0);
cga.AsyncWaitMovement({map:'雪拉威森塔99层', delay:1000, timeout:5000}, cb2);
});
});
});
});
}
},
{//4
intro: '5.前往雪拉威森塔99楼与守护者妮斯(102.54)对话,交出【伍斯的护身符】获得【尼斯的护身符】。',
workFunc: function(cb2){
if(cga.needSupplyInitial({ })){
cga.travel.falan.toCastleHospital(()=>{
setTimeout(()=>{
cga.travel.newisland.toStone('X', ()=>{
cb2('restart stage');
});
}, 3000);
});
return;
}
if(cga.GetMapName() != '雪拉威森塔99层'){
var useItem = cga.findItem('伍斯的护身符');
if(useItem != -1){
clearDialogs(() => {
cga.UseItem(useItem);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitMovement({map:'雪拉威森塔98层', delay:1000, timeout:5000}, ()=>{
cga.TurnTo(120, 119);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(1, 0);
cga.AsyncWaitMovement({map:'雪拉威森塔99层', delay:1000, timeout:5000}, ()=>{
cb2('restart stage');
});
});
});
});
});
}
return;
}
cga.walkList([
[101, 54],
], ()=>{
cga.TurnTo(103, 54);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(1, 0);
cga.AsyncWaitMovement({map:'雪拉威森塔最上层', delay:1000, timeout:5000}, cb2);
});
});
});
}
},
{//5
intro: '6.通过(103.134)处楼梯上楼达到雪拉威森塔塔顶。',
workFunc: function(cb2){
if(cga.needSupplyInitial({ })){
cga.travel.falan.toCastleHospital(()=>{
setTimeout(()=>{
cga.travel.newisland.toStone('X', ()=>{
cb2('restart stage');
});
}, 3000);
});
return;
}
if(cga.GetMapName() != '雪拉威森塔最上层'){
var useItem = cga.findItem('尼斯的护身符');
if(useItem != -1){
clearDialogs(() => {
cga.UseItem(useItem);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitMovement({map:'雪拉威森塔99层', delay:1000, timeout:5000}, ()=>{
cga.TurnTo(103, 54);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(1, 0);
cga.AsyncWaitMovement({map:'雪拉威森塔最上层', delay:1000, timeout:5000}, ()=>{
cb2('restart stage');
});
});
});
});
});
}
return;
}
cga.walkList([
[103, 134, '雪拉威森塔前庭'],
[103, 19],
], ()=>{
cga.TurnTo(105, 17);
cga.AsyncWaitNPCDialog((err, dlg)=>{
if(mineObject.type != 3){
cga.SayWords(mineObject.type == 1 ? '男' : '女', 0, 3, 1);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(1, 0);
setTimeout(cb2, 3000, true);
});
} else {
if(dlg && dlg.message.indexOf('给你这个') >= 0){
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(1, 0);
setTimeout(cb2, 3000, true);
});
}
else if(dlg && dlg.message.indexOf('还给我吗') >= 0){
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(1, 0);
setTimeout(cb2, 3000, true);
});
}
else if(dlg && dlg.message.indexOf('我是管理') >= 0){
cga.SayWords('男', 0, 3, 1);
cga.AsyncWaitNPCDialog((dlg)=>{
cga.ClickNPCDialog(1, 0);
setTimeout(cb2, 3000, true);
});
}
}
});
});
}
},
],
[//任务阶段是否完成
function(){
return (cga.getItemCount('塞特的护身符') >= 1) ? true : false;
},
function(){
return (cga.getItemCount('梅雅的护身符') >= 1) ? true : false;
},
function(){
return (cga.getItemCount('提斯的护身符') >= 1) ? true : false;
},
function(){
return (cga.getItemCount('伍斯的护身符') >= 1) ? true : false;
},
function(){
return (cga.getItemCount('尼斯的护身符') >= 1) ? true : false;
},
function(){
return false;
},
]
);
var loop = ()=>{
loop_count ++;
cga.SayWords('已刷' + loop_count + '遍!', 0, 3, 1);
task.doTask(loop);
}
cga.SayWords('欢迎使用CGA通用王冠/小猫脚本,输入‘1’刷王冠,输入‘2’刷公主头冠,输入‘3’刷小猫帽。', 0, 3, 1);
cga.waitTeammateSay((player, msg)=>{
if(player.is_me == true){
for(var i in mineArray){
if(mineArray[i].type == parseInt(msg)){
mineObject = mineArray[i];
break;
}
}
if(mineObject != null){
cga.SayWords('您选择了刷'+mineObject.name+'。', 0, 3, 1);
task.doTask(loop);
return false;
}
}
return true;
});
});