forked from hzqst/CGAssistantJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path十年戒指.js
214 lines (201 loc) · 5.6 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
var cga = require(process.env.CGA_DIR_PATH_UTF8+'/cgaapi')(function(){
var playerinfo = cga.GetPlayerInfo();
var teammates = [];
var teamplayers = cga.getTeamPlayers();
if(!teamplayers.length){
teammates[0] = playerinfo.name;
} else {
for(var i in teamplayers)
teammates[i] = teamplayers[i].name;
}
cga.isTeamLeader = (teammates[0] == playerinfo.name || teammates.length == 0) ? true : false
var task = cga.task.Task('十周年戒指', [
{//0
intro: '1.前往法兰城里谢里雅堡与追忆之路管理员(30.80)对话,选“是”进入追忆之路。',
workFunc: function(cb2){
//补血
if(cga.needSupplyInitial()){
cga.travel.falan.toCastleHospital(()=>{
setTimeout(()=>{
cga.travel.newisland.toStone('X', ()=>{
cb2('restart stage');
});
}, 3000);
});
return;
}
//进入追忆之路
cga.travel.falan.toStone('C', ()=>{
cga.walkList([
[30, 81]
], ()=>{
cga.turnTo(30, 80);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(4, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, 0);
cga.AsyncWaitMovement({map:'追忆之路', delay:1000, timeout:5000}, ()=>{
cb2(true);
});
});
});
});
});
});
},
},
{//1
intro: '2.依次挑战追忆之路内的5位BOSS,分别是:露比、法尔肯、帕布提斯马&凯法、犹大、海贼头目、帕鲁凯斯的亡灵(第一形态)',
workFunc: function(cb2){
var retry = (err)=>{
if(err){
cb2(err);
return;
}
console.log('拿戒指')
cga.cleanInventory(1, ()=>{
cga.turnTo(15, 4);
cga.AsyncWaitNPCDialog((err)=>{
if(err){
cga.walkList([ [14, 5], [15, 5] ], retry);
return;
}
cga.ClickNPCDialog(32, 0);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, 0);
cga.AsyncWaitMovement({map:'里谢里雅堡', delay:1000, timeout:5000}, ()=>{
cb2(true);
});
});
});
});
}
var wait = ()=>{
cga.waitForLocation({
mapname : '追忆之路',
pos : [15, 4],
leaveteam : true,
walkto : [15, 5],
desired_teamplayers : cga.getTeamPlayers()
}, retry);
}
var go = ()=>{
console.log('露比')
cga.walkList([
[15, 111],
], ()=>{
cga.turnTo(15, 110);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, 0);
cga.waitForBattleEnd(()=>{
if(cga.GetMapXY().y != 103){
cb2(new Error('没有打过露比!请检查战斗配置是否有问题!'));
return;
}
console.log('法尔肯')
cga.walkList([
[15, 100]
], ()=>{
cga.turnTo(15, 99);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, 0);
cga.waitForBattleEnd(()=>{
if(cga.GetMapXY().y != 92){
cb2(new Error('没有打过法尔肯!请检查战斗配置是否有问题!'));
return;
}
console.log('犹大')
cga.walkList([
[15, 89]
], ()=>{
cga.turnTo(15, 88);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, 0);
cga.waitForBattleEnd(()=>{
if(cga.GetMapXY().y != 81){
cb2(new Error('没有打过犹大!请检查战斗配置是否有问题!'));
return;
}
console.log('海贼')
cga.walkList([
[15, 78]
], ()=>{
cga.turnTo(15, 77);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, 0);
cga.waitForBattleEnd(()=>{
if(cga.GetMapXY().y != 70){
cb2(new Error('没有打过海贼!请检查战斗配置是否有问题!'));
return;
}
console.log('双王')
cga.walkList([
[15, 67]
], ()=>{
cga.turnTo(15, 66);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, 0);
cga.waitForBattleEnd(()=>{
if(cga.GetMapXY().y != 59){
cb2(new Error('没有打过双王!请检查战斗配置是否有问题!'));
return;
}
cga.walkList([//帕鲁凯斯的亡灵
[15, 56]
], ()=>{
cga.turnTo(15, 55);
cga.AsyncWaitNPCDialog(()=>{
cga.ClickNPCDialog(1, 0);
cga.waitForBattleEnd(()=>{
if(cga.GetMapXY().y != 48){
cb(new Error('没有打过小帕!请检查战斗配置是否有问题!'));
return;
}
cga.walkList([
[15, 5],
], ()=>{
cga.walkTeammateToPosition([
[15, 5],
[14, 5],
], retry);
});
});
});
});
});
});
});
});
});
});
});
});
});
});
});
});
});
});
});
}
if(cga.isTeamLeader){
go();
} else {
wait();
}
},
},
],
[//任务阶段是否完成
function(){
return false;
},
function(){
return false;
},
]
);
task.doTask();
});