Fukki 7 years ago
parent
commit
dd322cc94a
2 changed files with 5 additions and 3 deletions
  1. 4 2
      index.js
  2. 1 1
      manifest.json

+ 4 - 2
index.js

@@ -64,14 +64,14 @@ module.exports = function AutoPOT(mod) {
 				hpPot[hp][1].inCd = true;
 				setTimeout(function (h) {
 					hpPot[h][1].inCd = false;
-				}, e.cooldown, hp);
+				}, e.cooldown * 1000, hp);
 			}
 			mp = mpPot.findIndex(item => s2n(item[0]) === e.item);
 			if (mp >= 0 && !mpPot[mp][1].inCd) {
 				mpPot[mp][1].inCd = true;
 				setTimeout(function (m) {
 					mpPot[m][1].inCd = false;
-				}, e.cooldown, mp);
+				}, e.cooldown * 1000, mp);
 			}
 		}
  	});
@@ -84,6 +84,7 @@ module.exports = function AutoPOT(mod) {
 				for (let hp = 0; hp < hpPot.length; hp++) {
 					if (!hpPot[hp][1].inCd && ((!isSlaying && nowHP <= hpPot[hp][1].use_at && (hpPot[hp][1].inCombat ? mod.game.me.inCombat : true)) || (isSlaying && nowHP <= hpPot[hp][1].slay_at && mod.game.me.inCombat)) && hpPot[hp][1].amount > 0) {
 						useItem(hpPot[hp]);
+						hpPot[hp][1].inCd = true;
 						hpPot[hp][1].amount--;
 						if (config.notice)
 							msg(`Used ${hpPot[hp][1].name}, ${(hpPot[hp][1].amount)} left.`);
@@ -95,6 +96,7 @@ module.exports = function AutoPOT(mod) {
 				for (let mp = 0; mp < mpPot.length; mp++) {
 					if (!mpPot[mp][1].inCd && nowMP <= mpPot[mp][1].use_at && mpPot[mp][1].amount > 0 && (mpPot[mp][1].inCombat ? mod.game.me.inCombat : true)) {
 						useItem(mpPot[mp]);
+						mpPot[mp][1].inCd = true;
 						mpPot[mp][1].amount--;
 						if (config.notice)
 							msg(`Used ${mpPot[mp][1].name}, ${(mpPot[mp][1].amount)} left.`);

+ 1 - 1
manifest.json

@@ -1,6 +1,6 @@
 {
 	"files": {
-		"index.js": "b09b4faf2e4b63e5bb8c2439d91565d619df903922a41a07ce4a5a3efa3baca8"
+		"index.js": "b516b4f697ace211a63e5fd5a8dbd2421ba5764c05b6a93c16b52ba29487d394"
 	},
 	"defs": {
 		"C_USE_ITEM": 3,