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

+ 11 - 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 gPot = null, isReady = false, isSlaying = false, isZergling = false, nowHP = 0, nowMP = 0;
+	let gPot = null, isReady = false, isSlaying = false, nowHP = 0, nowMP = 0;
 	mod.game.initialize(['me', 'contract']);
 
 	cmd.add(['autopot', 'pot'], (arg1, arg2) => {
@@ -16,6 +16,14 @@ module.exports = function AutoPOT(mod) {
 				getId = getId ? Number(getId[1]) : 0;
 				msg(`itemId: ${getId}.`);
 				break;
+			case 'load':
+			case 'reload':
+				switch(arg2) {
+					case 'hp': hpPot = getHP(); msg(`HP.json has been reloaded.`); break;
+					case 'mp': mpPot = getMP(); msg(`MP.json has been reloaded.`); break;
+					case 'config': config = getConfig(); msg(`Config.json has been reloaded.`); break;
+				}
+				break;
 			case 'notice':
 				config.notice = !config.notice;
 				msg(`Notice has ${config.notice ? 'Enable' : 'Disable'}.`);
@@ -78,10 +86,6 @@ module.exports = function AutoPOT(mod) {
 			}
 		}
 	});
-	
-	function msg(msg) {
-		cmd.message(msg);
-	}
 
 	function useItem(itemId) {
 		mod.send('C_USE_ITEM', 3, {
@@ -147,5 +151,7 @@ module.exports = function AutoPOT(mod) {
 		return s2a;
 	}
 	
+	function msg(msg) {cmd.message(msg);}
+	
 	function jsonSave(name,data) {fs.writeFile(path.join(__dirname, name), JSON.stringify(data, null, 4), err => {});}
 }

+ 1 - 1
manifest.json

@@ -1,6 +1,6 @@
 {
 	"files": {
-		"index.js": "33511272adf71b3582246fe939b2f6b90dd3f53f954b6acb952f55e5d81c2bec"
+		"index.js": "085c52391d1f04b4e998a1eb9be5d64232116149e3c31414b63b51581ab9c880"
 	},
 	"defs": {
 		"C_USE_ITEM": 3,