-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
140 lines (122 loc) · 5.25 KB
/
index.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
const fs = require('fs'),
path = require('path');
module.exports = function FastPriest(mod){
const { command } = mod;
const { player } = mod.require.library;
let skill_ids = {};
let isEnabled = true;
let lastTimeout = null;
let config_file = require('./config.json');
if (config_file['ARISE_CANCEL_DELAY'] &&
typeof config_file['ARISE_CANCEL_DELAY'] === "number") {
skill_ids['6'] = {
'delay': config_file['ARISE_CANCEL_DELAY']
};
}
if (config_file['SHOCKING_IMPLOSION_CANCEL_DELAY'] &&
typeof config_file['SHOCKING_IMPLOSION_CANCEL_DELAY'] === "number") {
skill_ids['16'] = {
'delay': config_file['SHOCKING_IMPLOSION_CANCEL_DELAY']
};
}
if (config_file['FINAL_REPRISAL_CANCEL_DELAY'] &&
typeof config_file['FINAL_REPRISAL_CANCEL_DELAY'] === "number") {
skill_ids['27'] = {
'delay': config_file['FINAL_REPRISAL_CANCEL_DELAY']
};
}
if (config_file['HEALING_CIRCLE_CANCEL_DELAY'] &&
typeof config_file['HEALING_CIRCLE_CANCEL_DELAY'] === "number") {
skill_ids['3'] = {
'delay': config_file['HEALING_CIRCLE_CANCEL_DELAY']
};
}
if (config_file['PURIFYING_CIRCLE_CANCEL_DELAY'] &&
typeof config_file['PURIFYING_CIRCLE_CANCEL_DELAY'] === "number") {
skill_ids['10'] = {
'delay': config_file['PURIFYING_CIRCLE_CANCEL_DELAY']
};
}
if (config_file['KAIAS_CANCEL_DELAY'] &&
typeof config_file['KAIAS_CANCEL_DELAY'] === "number") {
skill_ids['22'] = {
'delay': config_file['KAIAS_CANCEL_DELAY']
};
}
if (config_file['HOLY_BURST_CANCEL_DELAY'] &&
typeof config_file['HOLY_BURST_CANCEL_DELAY'] === "number") {
skill_ids['42'] = {
'delay': config_file['HOLY_BURST_CANCEL_DELAY']
};
}
if (config_file['EDICT_OF_JUDGMENT_CANCEL_DELAY'] &&
typeof config_file['EDICT_OF_JUDGMENT_CANCEL_DELAY'] === "number") {
skill_ids['43'] = {
'delay': config_file['EDICT_OF_JUDGMENT_CANCEL_DELAY']
};
}
if (config_file['BLESSING_CANCEL_DELAY'] &&
typeof config_file['BLESSING_CANCEL_DELAY'] === "number") {
skill_ids['5'] = {
'delay': config_file['BLESSING_CANCEL_DELAY']
};
}
command.add('fastpriest', {
'$default'() {
isEnabled = !isEnabled;
command.message('Priest is now ' + (isEnabled ? 'enabled' : 'disabled') );
}
});
mod.hook('S_ACTION_STAGE', 9, { order: -1000000, filter: {fake: true} }, event => {
if (!isEnabled) return;
const skill_id = Math.floor(event.skill.id / 10000);
const altSkill_id = event.skill.id % 100;
// command.message('skill id'+parseInt(skill_id));
if (skill_id in skill_ids || skill_id + '-' + altSkill_id in skill_ids) {
const skillInfo = skill_id in skill_ids ? skill_ids[skill_id] : skill_ids[skill_id + '-' + altSkill_id];
lastTimeout = mod.setTimeout(() => {
mod.toClient('S_ACTION_END', 5, {
gameId: event.gameId,
loc: {
x: event.loc.x,
y: event.loc.y,
z: event.loc.z
},
w: event.w,
templateId: event.templateId,
skill: event.skill.id,
type: 12394123,
id: event.id
});
}, skillInfo['fixedDelay'] ? skillInfo['delay'] : skillInfo['delay'] / player['aspd']);
}
});
mod.hook('S_ACTION_END', 5, {'order': -1000000,'filter': {'fake': true }}, event => {
if (!isEnabled || event.gameId !== mod.game.me.gameId || mod.game.me.class !== 'priest') return;
if (!isEnabled) return;
const skill_id = Math.floor(event.skill.id / 10000);
const altSkill_id = event.skill.id % 100;
if (lastTimeout && (skill_id in skill_ids || skill_id + '-' + altSkill_id in skill_ids)) {
lastTimeout = null;
if (event.type == 12394123) {
event.type = 4;
return true;
} else {
return false;
}
}
});
mod.hook('C_CANCEL_SKILL', 3, event => {
if (!isEnabled || mod.game.me.class !== 'priest') return;
if (!isEnabled) return;
if (lastTimeout) {
mod.clearTimeout(lastTimeout);
lastTimeout = null;
}
});
mod.hook('S_EACH_SKILL_RESULT', 15, { 'order': -10000000 }, event => {
if (!isEnabled || !lastTimeout || event.target !== mod.game.me.gameId || !event.reaction.enable) return;
mod.clearTimeout(lastTimeout);
lastTimeout = null;
});
}