Fukki 7 years ago
parent
commit
96ba4b8d71
2 changed files with 15 additions and 4 deletions
  1. 13 2
      index.js
  2. 2 2
      manifest.json

+ 13 - 2
index.js

@@ -1,7 +1,7 @@
 const path = require('path'); const fs = require('fs');
 module.exports = function AutoPOT(mod) {
 	const cmd = mod.command || mod.require.command, map = new WeakMap();
-	let config = getConfig(), hpPot = getHP(), mpPot = getMP(), TmpData = [], aRes = null, aLoc = null, wLoc = 0, invUpdate = false, gPot = null;
+	let config = getConfig(), hpPot = getHP(), mpPot = getMP(), TmpData = [], aRes = null, aLoc = null, wLoc = 0, invUpdate = false, gPot = null, packet_version = 0;
 	mod.game.initialize(['me', 'contract', 'inventory']);
 
 	if (!map.has(mod.dispatch || mod)) {
@@ -231,8 +231,19 @@ module.exports = function AutoPOT(mod) {
 			useMP(Math.round(s2n(e.currentMp) / s2n(e.maxMp) * 100));
 	});
 	
+	switch(mod.majorPatchVersion) {
+		case 85:
+			packet_version = 1;
+			break;
+		case 86:
+			packet_version = 2;
+			break;
+		case 87:
+			packet_version = 3;
+			break;
+	}
 	
-	mod.hook('S_ITEMLIST', mod.majorPatchVersion >= 86 ? 2 : 1, e => {
+	mod.hook('S_ITEMLIST', packet_version, e => {
 		if (!invUpdate && e.gameId === mod.game.me.gameId) {
 			invUpdate = true;
 			for(let hp = 0; hp < hpPot.length; hp++)

+ 2 - 2
manifest.json

@@ -1,6 +1,6 @@
 {
 	"files": {
-		"index.js": "591b33cf4ed9bc3c39f4a332033b24cb6c7144ddf548f172f7c07e5b785c5a20"
+		"index.js": "48e6cb852ba1d1010ae8134c26d65973ef15d16193fca0af992088e5974d1125"
 	},
 	"defs": {
 		"C_ADMIN": 1,
@@ -9,7 +9,7 @@
 		"C_USE_ITEM": 3,
 		"S_ANNOUNCE_UPDATE_NOTIFICATION": 1,
 		"S_CREATURE_CHANGE_HP": 6,
-		"S_ITEMLIST": [1,2],
+		"S_ITEMLIST": 1,
 		"S_PLAYER_CHANGE_MP": 1,
 		"S_RETURN_TO_LOBBY": "raw",
 		"S_SPAWN_ME": 3