-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy path转职保证书(卵4).js
765 lines (702 loc) · 17.2 KB
/
转职保证书(卵4).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
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
var cga = require(process.env.CGA_DIR_PATH_UTF8+'/cgaapi')(function(){
var playerinfo = cga.GetPlayerInfo();
var teammates = [];
var teamplayers = cga.getTeamPlayers();
for(var i in teamplayers)
teammates[i] = teamplayers[i].name;
cga.isTeamLeader = (teammates[0] == playerinfo.name || teammates.length == 0) ? true : false
var callZLZZ = false;
var callWYW = false;
var doneBOSS = false;
cga.waitTeammateSay((player, msg)=>{
if(msg.indexOf('长老之证x7 GET') >= 0 ){
callZLZZ = true;
}
if(msg.indexOf('觉醒的文言抄本') >= 0 ){
callWYW = true;
}
return true;
});
var walkMazeForward = (cb)=>{
cga.walkRandomMaze(null, (err)=>{
console.log(err);
cb(err);
}, {
layerNameFilter : (layerIndex)=>{
return '海底墓场外苑第'+(layerIndex + 1)+'地带';
},
entryTileFilter : (e)=>{
return e.colraw == 0x462F;
}
});
}
var walkMazeBack = (cb)=>{
var map = cga.GetMapName();
if(map == '???'){
cb(null);
return;
}
cga.walkRandomMaze(null, (err)=>{
console.log(err);
cb(err);
}, {
layerNameFilter : (layerIndex)=>{
return layerIndex > 1 ? '海底墓场外苑第'+(layerIndex - 1)+'地带': '???';
},
entryTileFilter : (e)=>{
return e.colraw == 0x462E || e.colraw == 0;
}
});
}
var goodToGoZLZZ = (cb)=>{
var findObj = (cb3)=>{
var objs = cga.getMapObjects();
var pos = cga.GetMapXY();
if(objs.length){
for(var i in objs){
if(objs[i].mapx != pos.x || objs[i].mapy != pos.y){
cb3(objs[0]);
return;
}
}
}
setTimeout(findObj, 1000, cb3);
}
var battleAgain = ()=>{
if(cga.isInBattle()){
setTimeout(battleAgain, 5000);
return;
}
if(cga.getItemCount('长老之证') >= 7){
cga.SayWords('长老之证x7 GET', 0, 3, 1);
cb(true);
return;
}
if(callZLZZ){
cb(true);
return;
}
cga.cleanInventory(1, ()=>{
if(cga.isTeamLeader)
cga.ClickNPCDialog(1, 1);
setTimeout(battleAgain, 5000);
});
};
var retryNpc = (result)=>{
cga.TurnTo(result.xpos, result.ypos);
cga.AsyncWaitNPCDialog((err, dlg)=>{
if(dlg && dlg.message && (dlg.message.indexOf('已死的主人') >= 0 || dlg.message.indexOf('呼呼呼呼呼') >= 0 || dlg.message.indexOf('嘻嘻嘻嘻嘻嘻') >= 0)){
setTimeout(battleAgain, 1000);
}
else
{
setTimeout(retryNpc, 5000, result);
}
});
}
var search = ()=>{
var blackList = [];
cga.searchMap((units) => {
return units.find(u => u.unit_name == '守墓员' && u.type == 1 && u.model_id != 0) || cga.GetMapName() == '???'
}, (err, result) => {
if(cga.GetMapName() == '???'){
goodToGoZLZZ(cb);
return;
}
if(result && result.unit_name == '守墓员'){
retryNpc(result);
} else {
walkMazeForward(search);
}
});
}
if(cga.isTeamLeader){
findObj((obj)=>{
cga.walkList([
[obj.mapx, obj.mapy, '海底墓场外苑第1地带']
], search);
});
} else {
setTimeout(battleAgain, 5000);
}
}
var zhanglaozhizheng = (cb)=>{
if(cga.isTeamLeader){
cga.WalkTo(131, 62);
cga.waitTeammates(teammates, (r)=>{
if(r){
goodToGoZLZZ(cb);
return;
}
setTimeout(zhanglaozhizheng, 1000, cb);
});
} else {
cga.addTeammate(teammates[0], (r)=>{
if(r){
goodToGoZLZZ(cb);
return;
}
setTimeout(zhanglaozhizheng, 1000, cb);
});
}
}
var goodToGoZDZ = (cb)=>{
var findZDZ_D = ()=>{
cga.walkList([
[193, 184],
], ()=>{
if(cga.findNPCByPosition('障碍物', 192, 184)){
cga.turnTo(192, 184);
return;
}
cga.SayWords('错误:找不到任何活着的障碍物!', 0, 3, 1);
return;
});
}
var findZDZ_C = ()=>{
cga.walkList([
[234, 202],
], ()=>{
if(cga.findNPCByPosition('障碍物', 235, 202)){
cga.turnTo(235, 202);
return;
}
findZDZ_D();
return;
});
}
var findZDZ_B = ()=>{
cga.walkList([
[229, 177],
], ()=>{
if(cga.findNPCByPosition('障碍物', 230, 177)){
cga.turnTo(230, 177);
return;
}
findZDZ_C();
return;
});
}
var findZDZ_A = ()=>{
cga.walkList([
[213, 225],
], ()=>{
if(cga.findNPCByPosition('障碍物', 213, 226)){
cga.turnTo(213, 226);
return;
}
findZDZ_B();
return;
});
}
if(cga.isTeamLeader)
{
setTimeout(findZDZ_A, 1000);
}
var battleAgain = ()=>{
if(cga.isInBattle()){
setTimeout(battleAgain, 1500);
return;
}
var pos = cga.GetMapXY();
if(pos.x == 163 && pos.y == 100){
cb(true);
return;
}
setTimeout(battleAgain, 1500);
};
setTimeout(battleAgain, 1500);
}
var zudangzhe = (cb)=>{
var playerinfo = cga.GetPlayerInfo();
var teamplayers = cga.getTeamPlayers();
if(cga.isTeamLeader){
cga.waitTeammates(teammates, (r)=>{
if(r){
goodToGoZDZ(cb);
return;
}
setTimeout(zudangzhe, 1000, cb);
});
} else {
cga.addTeammate(teammates[0], (r)=>{
if(r){
goodToGoZDZ(cb);
return;
}
setTimeout(zudangzhe, 1000, cb);
});
}
}
var task = cga.task.Task('琥珀之卵4', [
{//0
intro: '◆在艾夏岛冒险者旅馆(102.115)内与时空之人(30.20)对话,输入“朵拉”选“是”,再选“确定”可重置本任务',
workFunc: function(cb2){
cga.travel.newisland.toPUB(()=>{
cga.walkList([
[31, 21],
], ()=>{
cga.TurnTo(30, 20);
cga.AsyncWaitNPCDialog(()=>{
cga.SayWords('朵拉', 0, 3, 1);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, 0);
setTimeout(()=>{
cb2(true);
}, 1500);
});
});
});
});
});
}
},
{//1
intro: '1.黄昏或夜晚前往艾尔莎岛神殿·伽蓝(200.96)三楼神殿·里侧大厅,至(48.60)处进入约尔克神庙。调查(39.21)处,获得【琥珀之卵】。',
workFunc: function(cb2){
if(cga.getItemCount('琥珀之卵') > 0){
cb2(true);
return;
}
var retry = ()=>{
cga.cleanInventory(1, ()=>{
cga.turnTo(39, 21);
cga.AsyncWaitNPCDialog((err, dlg)=>{
if(!(dlg && dlg.message.indexOf('感觉脑海中有什么声响') >= 0)){
setTimeout(retry, 5000);
return;
}
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, 0);
setTimeout(cb2, 1000, true);
});
});
});
});
});
});
});
});
}
cga.travel.newisland.toStone('X', ()=>{
cga.walkList([
[201, 96, '神殿 伽蓝'],
[95, 104, '神殿 前廊'],
[44, 41, '神殿 里侧大厅'],
[34, 34, 59535],
[48, 60, '约尔克神庙'],
[39, 22],
], ()=>{
retry();
});
});
}
},
{//2
intro: '2.前往盖雷布伦森林路路耶博士的家(244.76),进入后再离开路路耶博士的家并传送至???。' + "\n" + '3.通过(142.69)或(122.69)处黄色传送石进入海底墓场外苑,寻找随机出现的守墓者并与之对话进入战斗。',
workFunc: function(cb2){
if(cga.needSupplyInitial({ })){
cga.travel.falan.toCastleHospital(()=>{
setTimeout(()=>{
cb2('restart stage');
}, 3000);
});
return;
}
cga.travel.newisland.toStone('X', ()=>{
cga.walkList([
[130, 50, '盖雷布伦森林'],
[246, 76, '路路耶博士的家'],
], ()=>{
cga.WalkTo(3, 10);
cga.AsyncWaitMovement({map:['???'], delay:1000, timeout:10000}, ()=>{
cga.walkList([
[131, 61],
], ()=>{
cga.TurnTo(131, 59);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog((err, dlg)=>{
if(dlg && dlg.message.indexOf('还不快点') == -1)
{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, 0);
zhanglaozhizheng(cb2);
});
} else {
cga.ClickNPCDialog(1, 0);
zhanglaozhizheng(cb2);
}
});
});
});
});
});
});
}
},
{//3
intro: '5.集齐7个【长老之证】后返回???,由持有7个【长老之证】的队员与荷特普(167.102)对话2次,选“是”交出【长老之证】并传送至盖雷布伦森林。',
workFunc: function(cb2){
var sayshit = ()=>{
if(cga.getItemCount('长老之证') >= 7){
console.log('sayshit1');
cga.TurnTo(131, 60);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, 0);
cga.waitForLocation({map : '盖雷布伦森林'}, ()=>{
cb2(true);
});
});
});
});
} else {
console.log('sayshit2');
cga.waitForLocation({mapname : '盖雷布伦森林'}, ()=>{
cb2(true);
});
}
}
if(cga.isTeamLeader){
var walkShit = ()=>{
if(cga.GetMapName() == '???')
{
cga.walkList([
[131, 61],
[130, 61],
[131, 61],
[130, 61],
[131, 61],
], (r)=>{
sayshit();
});
return;
}
walkMazeBack(walkShit);
}
walkMazeBack(walkShit);
return;
}
else
{
cga.waitForLocation({mapname : '???', pos:[131, 60]}, sayshit);
return;
}
}
},
{//4
intro: '6.黄昏或夜晚时至神殿·伽蓝与荷特普(92.138)对话。',
workFunc: function(cb2){
cga.travel.newisland.toStone('X', ()=>{
cga.walkList([
[201, 96, '神殿 伽蓝'],
[91, 138],
], (r)=>{
cga.task.waitForNPC('荷特普', ()=>{
cga.turnTo(92, 138);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, -1);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, -1);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, -1);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, -1);
setTimeout(()=>{
cb2(true);
}, 1000);
});
});
});
});
});
});
});
}
},
{//5
intro: '前往艾夏岛冒险者旅馆(102.115)与安洁可(55.32)对话,获得【逆十字】。',
workFunc: function(cb2){
if(cga.getItemCount('逆十字') > 0){
cb2(true);
return;
}
cga.travel.newisland.toPUB(()=>{
cga.walkList([
[56, 32],
], (r)=>{
cga.cleanInventory(1, ()=>{
cga.turnTo(56, 31);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, -1);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, -1);
setTimeout(()=>{
cb2(true);
}, 1000);
});
});
});
});
});
}
},
{//6
intro: '7.前往梅布尔隘地,持有【琥珀之卵】、【逆十字】与祭坛守卫(211.116)对话进入???。',
workFunc: function(cb2){
if(cga.needSupplyInitial({ })){
cga.travel.falan.toCastleHospital(()=>{
setTimeout(()=>{
cb2('restart stage');
}, 3000);
});
return;
}
cga.travel.newisland.toStone('X', ()=>{
cga.walkList([
[165, 153],
], (r)=>{
cga.TurnTo(165, 154);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, -1);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(8, -1);
cga.AsyncWaitMovement({map:['梅布尔隘地'], delay:1000, timeout:10000}, ()=>{
cga.walkList([
[211, 117],
], (r)=>{
cga.TurnTo(212, 116);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, -1);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, -1);
cga.AsyncWaitMovement({map:['???'], delay:1000, timeout:10000}, ()=>{
cb2(r);
});
});
});
});
});
});
});
});
});
}
},
{//7
intro: '8.击倒(136.197)一带的阻挡者后,进入(156.197)的传送石。9.击倒(213.226)、(235.202)等位置的任意一个阻挡者,随机被传送。',
workFunc: function(cb2){
cga.walkList([
[135, 197],
], (r)=>{
var step = 7;
var go = ()=>{
cga.ForceMove(0, true);
if(step > 0){
step --;
setTimeout(go, 500);
}else{
cga.walkList((cga.isTeamLeader == true) ?
[
[156, 197, '???', 213, 164],
[213, 165],
] : [
[156, 197, '???', 213, 164],
], ()=>{
zudangzhe(cb2);
});
}
}
setTimeout(go, 1000);
});
}
},
{//8
intro: '10.击倒(161.108)一带的阻挡者,经由(241.118)的传送石进入???。',
workFunc: function(cb2){
var waitBOSS = ()=>{
if(cga.isInBattle())
{
doneBOSS = true;
if(cga.getItemCount('觉醒的文言抄本') > 0){
//cga.LogBack();
setTimeout(cb2, 1000, true);
return;
}
setTimeout(waitBOSS, 1000);
return;
}
if(doneBOSS && !callWYW && (cga.getItemCount('觉醒的文言抄本') > 0)){
cga.SayWords('觉醒的文言抄本 GET', 0, 3, 1);
callWYW = true;
}
if(doneBOSS && callWYW){
//cga.LogBack();
setTimeout(cb2, 1000, true);
return;
}
setTimeout(waitBOSS, 1500);
}
if(!cga.isTeamLeader){
setTimeout(waitBOSS, 1500);
return;
}
cga.walkList([
[163, 107],
], (r)=>{
var step = 4;
var go = ()=>{
cga.ForceMove(2, true);
if(step > 0){
step --;
setTimeout(go, 500);
}else{
cga.walkList([
[218, 117],
[242, 117, 59716],
[221, 187],
], ()=>{
cga.turnTo(222, 188);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, -1);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, -1);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, -1);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, -1);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, -1);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, -1);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(8, -1);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, -1);
setTimeout(waitBOSS, 1500);
});
});
});
});
});
});
});
});
});
}
}
setTimeout(go, 1000);
});
}
},
{//9
intro: '13.返回盖雷布伦森林,持有【觉醒的文言抄本】与纳塞(245.73)对话,获得【转职保证书】。',
workFunc: function(cb2){
cga.travel.newisland.toStone('X', ()=>{
cga.walkList([
[130, 50, '盖雷布伦森林'],
[244, 74],
], ()=>{
cga.TurnTo(245, 73);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, 0);
setTimeout(()=>{
if(cga.getItemCount('转职保证书') > 0){
cb2(true);
return;
}
}, 1000, true);
});
});
});
});
});
});
}
},
],
[//任务阶段是否完成
function(){//消除任务
return false;
},
function(){//琥珀之卵
return (cga.getItemCount('琥珀之卵') >= 1) ? true : false;
},
function(){//长老之证
return (cga.getItemCount('长老之证') >= 7 || callZLZZ) ? true : false;
},
function(){
return false;
},
function(){
return false;
},
function(){//逆十字
return (cga.getItemCount('逆十字') > 0) ? true : false;
},
function(){
return false;
},
function(){
return false;
},
function(){
return false;
},
function(){
return cga.getItemCount('转职保证书') > 0 ? true : false;
},
]
);
task.anyStepDone = false;
cga.SayWords('欢迎使用琥珀之卵4(转职保证书)脚本,输入‘0’从头(朵拉)开始任务,输入‘1’从打长老证之前开始任务,输入‘3’从荷普特开始任务,输入‘4’从祭坛守卫开始任务,输入‘5’从打完BOSS换保证书开始任务(必须有文言抄本)。', 0, 3, 1);
cga.waitForChatInput((msg, index)=>{
if(index !== null)
{
console.log(index);
if(index == 0)
task.jumpToStep = 0;
else if(index == 1)
task.jumpToStep = 2;
//else if(index == 2)
// task.jumpToStep = 3;
else if(index == 3)
task.jumpToStep = 4;
else if(index == 4)
task.jumpToStep = 6;
else if(index == 5)
task.jumpToStep = 9;
if(typeof task.jumpToStep != 'undefined'){
task.doTask(()=>{
console.log('ok');
});
return false;
}
}
return true;
});
});