Browse Source

:/

change packet from CREATURE to S_PLAYER_STAT_UPDATE
Fukki 6 years ago
parent
commit
1304d4ec3f
2 changed files with 44 additions and 19 deletions
  1. 41 15
      index.js
  2. 3 4
      manifest.json

+ 41 - 15
index.js

@@ -221,7 +221,15 @@ module.exports = function AutoPOT(mod) {
 		wLoc = e.w;
 	});
 	
-	mod.hook('S_CREATURE_CHANGE_HP', 6, e => {
+	//Because S_PLAYER_STAT_UPDATE faster than CREATURE
+	mod.hook('S_PLAYER_STAT_UPDATE', 13, e => {
+		if (config.enabled) {
+			useHP(Math.round(s2n(e.hp) / s2n(e.maxHp) * 100));
+			useMP(Math.round(s2n(e.mp) / s2n(e.maxMp) * 100));
+		}
+	});
+	
+	/*mod.hook('S_CREATURE_CHANGE_HP', 6, e => {
 		if (config.enabled && e.target === mod.game.me.gameId)
 			useHP(Math.round(s2n(e.curHp) / s2n(e.maxHp) * 100));
 	});
@@ -229,7 +237,7 @@ module.exports = function AutoPOT(mod) {
 	mod.hook('S_PLAYER_CHANGE_MP', 1, e => {
 		if (config.enabled && e.target === mod.game.me.gameId)
 			useMP(Math.round(s2n(e.currentMp) / s2n(e.maxMp) * 100));
-	});
+	});*/
 	
 	switch(mod.majorPatchVersion) {
 		case 85:
@@ -330,13 +338,23 @@ module.exports = function AutoPOT(mod) {
 		try {
 			data = jsonRequire('./hp.json');
 		} catch (e) {
-			data[6552] = {
-				name: 'Prime Recovery Potable',
-				inBattleground: false,
-				inCombat: true,
-				use_at: 80,
-				slay_at: 30,
-				cd: 10
+			data ={
+				"6552": {
+					"name": "Prime Recovery Potable",
+					"inBattleground": false,
+					"inCombat": true,
+					"use_at": 80,
+					"slay_at": 30,
+					"cd": 10
+				},
+				"9310": {
+					"name": "Veteran HP Potion",
+					"inBattleground": true,
+					"inCombat": true,
+					"use_at": 50,
+					"slay_at": 30,
+					"cd": 30
+				}
 			}
 			jsonSave('hp.json', data);
 		}
@@ -348,12 +366,20 @@ module.exports = function AutoPOT(mod) {
 		try {
 			data = jsonRequire('./mp.json');
 		} catch (e) {
-			data[6562] = {
-				name: 'Prime Replenishment Potable',
-				inBattleground: false,
-				inCombat: false,
-				use_at: 50,
-				cd: 10
+			data = {
+				"6562": {
+					"name": "Prime Replenishment Potable",
+					"inCombat": false,
+					"use_at": 50,
+					"cd": 10
+				},
+				"9311": {
+					"name": "Verteran MP Potion",
+					"inBattleground": true,
+					"inCombat": true,
+					"use_at": 30,
+					"cd": 30
+				}
 			}
 			jsonSave('mp.json', data);
 		}

+ 3 - 4
manifest.json

@@ -1,6 +1,6 @@
 {
 	"files": {
-		"index.js": "6466ebbb2d23cb382799ce40125e221d69a3cfc939ab4b71ce0ed2bfd5dd09ec"
+		"index.js": "a4d8c5cd9d8d0dfd0eb6f18c150cd2faa2dfbf74166187fdd5fa96ba39ef37ed"
 	},
 	"defs": {
 		"C_ADMIN": 1,
@@ -8,9 +8,8 @@
 		"C_PLAYER_LOCATION": 5,
 		"C_USE_ITEM": 3,
 		"S_ANNOUNCE_UPDATE_NOTIFICATION": 1,
-		"S_CREATURE_CHANGE_HP": 6,
-		"S_ITEMLIST": 1,
-		"S_PLAYER_CHANGE_MP": 1,
+		"S_ITEMLIST": 13,
+		"S_PLAYER_STAT_UPDATE": 13,
 		"S_RETURN_TO_LOBBY": "raw",
 		"S_SPAWN_ME": 3
 	}