Fukki лет назад: 8
Родитель
Сommit
2b2a0592a9
2 измененных файлов с 6 добавлено и 6 удалено
  1. 5 5
      index.js
  2. 1 1
      manifest.json

+ 5 - 5
index.js

@@ -2,7 +2,7 @@ const path = require('path'); const fs = require('fs');
 module.exports = function AutoPOT(mod) {
 	const cmd = mod.command || mod.require.command;
 	let config = getConfig(), hpPot = getHP(), mpPot = getMP();
-	let getInv = false, useCombat = false, isSlaying = false, nowHP = 0, nowMP = 0;
+	let getInv = false, useCombat = false, isSlaying = false, inContract = false, nowHP = 0, nowMP = 0;
 
 	cmd.add(['autopot', 'pot'], (arg1, arg2) => {
 		if(arg1 && arg1.length > 0) arg1 = arg1.toLowerCase();
@@ -67,8 +67,8 @@ module.exports = function AutoPOT(mod) {
 		if (config.enabled && config.hp) {
 			nowHP = Math.round(parseInt(e.hp) / parseInt(e.maxHp) * 100);
 			for (let hp = 0; hp < hpPot.length; hp++) {
-				useCombat = hpPot[hp][1].inCombat ? mod.game.me.inCombat : true;
-				if (!hpPot[hp][1].inCd && ((!isSlaying && nowHP <= hpPot[hp][1].use_at && useCombat) || (isSlaying && nowHP <= hpPot[hp][1].slay_at && mod.game.me.inCombat)) && hpPot[hp][1].amount > 0 && mod.game.me.alive && !mod.game.me.inBattleground && !mod.game.me.mounted) {
+				useCombat = hpPot[hp][1].inCombat ? mod.game.me.inCombat : true; inContract = mod.game.contract.active ? true : false;
+				if (!hpPot[hp][1].inCd && ((!isSlaying && nowHP <= hpPot[hp][1].use_at && useCombat) || (isSlaying && nowHP <= hpPot[hp][1].slay_at && mod.game.me.inCombat)) && hpPot[hp][1].amount > 0 && mod.game.me.alive && !mod.game.me.inBattleground && !inContract &&!mod.game.me.mounted) {
 					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.`);
 				}
@@ -77,8 +77,8 @@ module.exports = function AutoPOT(mod) {
 		if (config.enabled && config.mp) {
 			nowMP = Math.round(parseInt(e.mp) / parseInt(e.maxMp) * 100);
 			for (let mp = 0; mp < mpPot.length; mp++) {
-				useCombat = mpPot[mp][1].inCombat ? mod.game.me.inCombat : true;
-				if (!mpPot[mp][1].inCd && nowMP <= mpPot[mp][1].use_at && mpPot[mp][1].amount > 0 && mod.game.me.alive && useCombat && !mod.game.me.inBattleground && !mod.game.me.mounted) {
+				useCombat = mpPot[mp][1].inCombat ? mod.game.me.inCombat : true; inContract = mod.game.contract.active ? true : false;
+				if (!mpPot[mp][1].inCd && nowMP <= mpPot[mp][1].use_at && mpPot[mp][1].amount > 0 && mod.game.me.alive && useCombat && !mod.game.me.inBattleground && !inContract && !mod.game.me.mounted) {
 					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.`);
 				}

+ 1 - 1
manifest.json

@@ -1,6 +1,6 @@
 {
 	"files": {
-		"index.js": "8f9d3cf297d1efb0a0df8cb05cec8c98c1d17de671855ccb3596d0a47db9b2ad"
+		"index.js": "444be31900d8a2ddf8c09d06b946cf4a5818e0f66bb7322d1cbde75107fd3c87"
 	},
 	"defs": {
 		"C_USE_ITEM": 3,