forked from hzqst/CGAssistantJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path飞碟摆摊治疗.js
90 lines (73 loc) · 1.61 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
var cga = require(process.env.CGA_DIR_PATH_UTF8+'/cgaapi')(function(){
var originalPos = cga.GetMapXY();
var originalDir = cga.GetPlayerInfo().direction;
if(cga.GetMapName() != '里谢里雅堡')
{
console.error('提示:飞碟摆摊只能在里谢里雅堡使用!');
}
var skill = cga.findPlayerSkill('治疗');
if(!skill)
{
console.error('提示:没有治疗技能!');
}
var loop = ()=>{
if(skill)
{
var requiremp = 25 + skill.lv * 5;
//补魔
if (cga.GetPlayerInfo().mp < requiremp){
cga.walkList([
[34, 89],
], ()=>{
cga.turnTo(35, 88);
setTimeout(()=>{
cga.walkList([
[originalPos.x, originalPos.y],
], ()=>{
cga.turnDir(originalDir);
loop();
});
}, 3000);
})
return;
}
}
//寻找队伍里带拐杖的玩家
var teamplayers = cga.getTeamPlayers();
var index = -1;
for(var i in teamplayers){
if(teamplayers[i].injury){
index = i;
break;
}
}
//找到了
if(skill && index != -1)
{
cga.StartWork(skill.index, skill.lv-1);
cga.AsyncWaitPlayerMenu((err, players)=>{
if(players){
for(var i in players){
if(players[i].name == teamplayers[index].name){
cga.AsyncWaitUnitMenu((err, units)=>{
cga.AsyncWaitWorkingResult(()=>{
loop();
});
cga.UnitMenuSelect(0);
});
cga.PlayerMenuSelect(i);
break;
}
}
return;
}
setTimeout(loop, 1000);
});
return;
}
//说话防掉线
cga.SayWords('', 0, 3, 1);
setTimeout(loop, 1000);
}
loop();
});