|
@@ -97,29 +97,22 @@ module.exports = function AutoPOT(mod) {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- mod.hook('S_CREATURE_CHANGE_HP', 6, e => {
|
|
|
|
|
|
|
+ mod.hook('S_PLAYER_STAT_UPDATE', 10, e => {
|
|
|
if (config.enabled && config.hp) {
|
|
if (config.enabled && config.hp) {
|
|
|
- if (e.target.equals(gameId)) {
|
|
|
|
|
- nowHP = Math.round(e.curHp / e.maxHp * 100);
|
|
|
|
|
- for (let hp = 0; hp < hpPot.length; hp++) {
|
|
|
|
|
- if (!hpPot[hp][1].inCd && ((!isSlaying && nowHP <= hpPot[hp][1].use_at) || (isSlaying && nowHP <= hpPot[hp][1].slaying)) && hpPot[hp][1].amount > 0 && isCombat && isAlive && !isBG && !isCon && !isMount) {
|
|
|
|
|
- useItem(hpPot[hp]); hpPot[hp][1].inCd = true; hpPot[hp][1].amount--; setTimeout(function () {hpPot[hp][1].inCd = false;}, hpPot[hp][1].cd * 1000);
|
|
|
|
|
- if (config.notice) msg(`Used ${hpPot[hp][1].name}, still have ${(hpPot[hp][1].amount)} left.`);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ nowHP = Math.round(e.hp / e.maxHp * 100);
|
|
|
|
|
+ for (let hp = 0; hp < hpPot.length; hp++) {
|
|
|
|
|
+ if (!hpPot[hp][1].inCd && ((!isSlaying && nowHP <= hpPot[hp][1].use_at) || (isSlaying && nowHP <= hpPot[hp][1].slaying)) && hpPot[hp][1].amount > 0 && isCombat && isAlive && !isBG) {
|
|
|
|
|
+ useItem(hpPot[hp]); hpPot[hp][1].inCd = true; hpPot[hp][1].amount--; setTimeout(function () {hpPot[hp][1].inCd = false;}, hpPot[hp][1].cd * 1000);
|
|
|
|
|
+ if (config.notice) msg(`Used ${hpPot[hp][1].name}, still have ${(hpPot[hp][1].amount)} left.`);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- mod.hook('S_PLAYER_CHANGE_MP', 1, e => {
|
|
|
|
|
if (config.enabled && config.mp) {
|
|
if (config.enabled && config.mp) {
|
|
|
- if (e.target.equals(gameId)) {
|
|
|
|
|
- nowMP = Math.round(e.currentMp / e.maxMp * 100);
|
|
|
|
|
- for (let mp = 0; mp < mpPot.length; mp++) {
|
|
|
|
|
- if (!mpPot[mp][1].inCd && nowMP <= mpPot[mp][1].use_at && mpPot[mp][1].amount > 0 && isAlive && !isBG && !isCon && !isMount) {
|
|
|
|
|
- useItem(mpPot[mp]); mpPot[mp][1].inCd = true; mpPot[mp][1].amount--; setTimeout(function () {mpPot[mp][1].inCd = false;}, mpPot[mp][1].cd * 1000);
|
|
|
|
|
- if (config.notice) msg(`Used ${mpPot[mp][1].name}, still have ${(mpPot[mp][1].amount)} left.`);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ nowMP = Math.round(e.mp / e.maxMp * 100);
|
|
|
|
|
+ for (let mp = 0; mp < mpPot.length; mp++) {
|
|
|
|
|
+ if (!mpPot[mp][1].inCd && nowMP <= mpPot[mp][1].use_at && mpPot[mp][1].amount > 0 && isAlive && !isBG && !isCon && !isMount) {
|
|
|
|
|
+ useItem(mpPot[mp]); mpPot[mp][1].inCd = true; mpPot[mp][1].amount--; setTimeout(function () {mpPot[mp][1].inCd = false;}, mpPot[mp][1].cd * 1000);
|
|
|
|
|
+ if (config.notice) msg(`Used ${mpPot[mp][1].name}, still have ${(mpPot[mp][1].amount)} left.`);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|