Browse Source

Update for zerk HP negative when unleash?

Fukki 8 years ago
parent
commit
4ea45fa00a
2 changed files with 28 additions and 3 deletions
  1. 24 2
      index.js
  2. 4 1
      manifest.json

+ 24 - 2
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 gPot = null, isReady = false, isSlaying = false, nowHP = 0, nowMP = 0;
+	let gPot = null, gLoc = null,isReady = false, isSlaying = false, isZergling = false, nowHP = 0, nowMP = 0;
 	mod.game.initialize(['me', 'contract']);
 
 	cmd.add(['autopot', 'pot'], (arg1, arg2) => {
@@ -65,7 +65,7 @@ module.exports = function AutoPOT(mod) {
 	
 	mod.hook('S_PLAYER_STAT_UPDATE', 10, e => {
 		if (config.enabled) {
-			isReady = mod.game.isIngame && !mod.game.isInLoadingScreen && mod.game.me.alive && !mod.game.me.inBattleground && !mod.game.me.mounted && !mod.game.contract.active;
+			isReady = mod.game.isIngame && !mod.game.isInLoadingScreen && (!isZergling ? mod.game.me.alive : true) && !mod.game.me.inBattleground && !mod.game.me.mounted && !mod.game.contract.active;
 			if (config.hp && isReady) {
 				nowHP = Math.round(parseInt(e.hp) / parseInt(e.maxHp) * 100);
 				for (let hp = 0; hp < hpPot.length; hp++) {
@@ -86,12 +86,34 @@ module.exports = function AutoPOT(mod) {
 			}
 		}
 	});
+	
+	mod.hook('S_ABNORMALITY_BEGIN', 3, e => {
+		if (mod.game.me.is(e.target) && e.id === 401730)
+			isZergling = true;
+	});
+	
+	mod.hook('S_ABNORMALITY_END', 1, e => {
+		if (mod.game.me.is(e.target) && e.id === 401730)
+			setTimeout(() => {isZergling = false;}, 3000);
+	});
+	
+	mod.hook('C_PLAYER_LOCATION', 5, e => {
+		gLoc = e;
+	});
 
 	function useItem(itemId) {
 		mod.send('C_USE_ITEM', 3, {
 			gameId: mod.game.me.gameId,
 			id: Number(itemId[0]),
+			dbid: 0,
+			target: 0,
 			amount: 1,
+			dest: 0,
+			loc: gLoc.loc,
+			w: gLoc.w,
+			unk1: 0,
+			unk2: 0,
+			unk3: 0,
 			unk4: true
 		});
 	}

+ 4 - 1
manifest.json

@@ -1,9 +1,12 @@
 {
 	"files": {
-		"index.js": "085c52391d1f04b4e998a1eb9be5d64232116149e3c31414b63b51581ab9c880"
+		"index.js": "618b157a9afd416d9bdab4d33da459dcbe4840abc06e38e775ca92ff4dd63b92"
 	},
 	"defs": {
+		"C_PLAYER_LOCATION": 5,
 		"C_USE_ITEM": 3,
+		"S_ABNORMALITY_BEGIN": 3,
+		"S_ABNORMALITY_END": 1,
 		"S_INVEN": 16,
 		"S_PLAYER_STAT_UPDATE": 10
 	}