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

+ 11 - 18
index.js

@@ -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.`);
 				}
 				}
 			}
 			}
 		}
 		}

+ 8 - 9
manifest.json

@@ -1,24 +1,23 @@
 {
 {
 	"files": {
 	"files": {
-		"index.js": "07960fe8965bd169365aafe5c6ad0f6cc9754cc9c83bcb7eced87dfa80de5515"
+		"index.js": "97f8394494a800ea5994cd1279a184c571a02213a92654a9213f88178afca6d2"
 	},
 	},
 	"defs": {
 	"defs": {
-		"C_BIND_ITEM_EXECUTE": [1,"raw"],
+		"C_BIND_ITEM_EXECUTE": "raw",
 		"C_USE_ITEM": 3,
 		"C_USE_ITEM": 3,
-		"S_ACCEPT_CONTRACT": [1,"raw"],
+		"S_ACCEPT_CONTRACT": "raw",
 		"S_BATTLE_FIELD_ENTRANCE_INFO": 1,
 		"S_BATTLE_FIELD_ENTRANCE_INFO": 1,
-		"S_CANCEL_CONTRACT": [1,"raw"],
-		"S_CREATURE_CHANGE_HP": 6,
+		"S_CANCEL_CONTRACT": "raw",
 		"S_CREATURE_LIFE": 2,
 		"S_CREATURE_LIFE": 2,
-		"S_GACHA_END": [1,"raw"],
+		"S_GACHA_END": "raw",
 		"S_INVEN": 16,
 		"S_INVEN": 16,
 		"S_LOAD_TOPO": 3,
 		"S_LOAD_TOPO": 3,
 		"S_LOGIN": 10,
 		"S_LOGIN": 10,
 		"S_MOUNT_VEHICLE": 2,
 		"S_MOUNT_VEHICLE": 2,
 		"S_MOUNT_VEHICLE_EX": 1,
 		"S_MOUNT_VEHICLE_EX": 1,
-		"S_PLAYER_CHANGE_MP": 1,
-		"S_REJECT_CONTRACT": [1,"raw"],
-		"S_REQUEST_CONTRACT": [1,"raw"],
+		"S_PLAYER_STAT_UPDATE": 10,
+		"S_REJECT_CONTRACT": "raw",
+		"S_REQUEST_CONTRACT": "raw",
 		"S_SPAWN_ME": 3,
 		"S_SPAWN_ME": 3,
 		"S_UNMOUNT_VEHICLE": 2,
 		"S_UNMOUNT_VEHICLE": 2,
 		"S_UNMOUNT_VEHICLE_EX": 1,
 		"S_UNMOUNT_VEHICLE_EX": 1,