Просмотр исходного кода

2.3.0 Abnormality tracking now handled by tera-game-state

TeraProxy лет назад: 7
Родитель
Сommit
c607aa39a2
4 измененных файлов с 13 добавлено и 33 удалено
  1. 2 0
      README.md
  2. 6 25
      index.js
  3. 3 6
      manifest.json
  4. 2 2
      module.json

+ 2 - 0
README.md

@@ -44,6 +44,8 @@ Based on true-everful-nostrum by Caali https://github.com/caali-hackerman
 ## Changelog
 <details>
 
+### 2.3.0
+* [~] Abnormality tracking now handled by tera-game-state
 ### 2.2.3
 * [~] Minor definition update
 ### 2.2.2

+ 6 - 25
index.js

@@ -7,12 +7,11 @@ const ITEMS_NOSTRUM = [152898, 184659, 201005, 201006, 201007, 201008, 201022, 8
 
 module.exports = function Essentials(mod) {
 
-	mod.game.initialize("contract")
+	mod.game.initialize(['me', 'me.abnormalities', 'contract']);
 
 	let item = null,
 		interval = null,
 		enabled = true,
-		abnormalities = {},
 		counter = 0,
 		resetcount = null,
 		niceName = mod.proxyAuthor !== 'caali' ? '[Essentials] ' : ''
@@ -22,15 +21,9 @@ module.exports = function Essentials(mod) {
 	// ############# //
 
 	mod.game.on('enter_game', () => { setTimeout(start, 6000) })
-	mod.game.on('leave_game', () => {
-		stop()
-		abnormalities = {}
-	})
+	mod.game.on('leave_game', () => { stop() })
 
-	mod.game.me.on('resurrect', () => {
-		abnormalities = {}
-		start()
-	})
+	mod.game.me.on('resurrect', () => { start() })
 
 	mod.hook('S_PREMIUM_SLOT_DATALIST', 2, event => {
 		for(let set of event.sets)
@@ -47,10 +40,6 @@ module.exports = function Essentials(mod) {
 				}
 	})
 
-	mod.hook('S_ABNORMALITY_BEGIN', 4, abnormality.bind(null, 'S_ABNORMALITY_BEGIN'))
-	mod.hook('S_ABNORMALITY_REFRESH', 2, abnormality.bind(null, 'S_ABNORMALITY_REFRESH'))
-	mod.hook('S_ABNORMALITY_END', 1, abnormality.bind(null, 'S_ABNORMALITY_END'))
-
 	if(mod.settings.log) {
 		mod.hook('C_USE_ITEM', 3, event => {
 			mod.command.message(niceName + 'Used item ID: ' + event.id)
@@ -61,18 +50,10 @@ module.exports = function Essentials(mod) {
 	// ### Functions ### //
 	// ################# //
 
-	function abnormality(type, event) {
-		if(mod.game.me.is(event.target)) {
-			if(type === 'S_ABNORMALITY_END')
-				delete abnormalities[event.id]
-			else abnormalities[event.id] = Date.now() + event.duration
-		}
-	}
-
 	function abnormalityDuration(id) {
-		if(!abnormalities[id]) return 0
-		return abnormalities[id] - Date.now()
-	}
+        const abnormality = mod.game.me.abnormalities[id]
+        return abnormality ? abnormality.remaining : 0
+    }
 
 	function checkItems() {
 		for(let buff of BUFF_INVINCIBILITY) // Do not overwrite invincibility buff

+ 3 - 6
manifest.json

@@ -1,21 +1,18 @@
 {
     "files": {
         "LICENSE": "589ed823e9a84c56feb95ac58e7cf384626b9cbf4fda2a907bc36e103de1bad2",
-        "README.md": "fa2f1ae95a38952d29c7d46310c02abbd059c824293e5c21399cd35ae5d9aee6",
+        "README.md": "e8e36965c466fd3923732b9f3217b527e7ed2367d7d7b85052e8340403b6d114",
         "config.json": {
             "overwrite": false,
             "hash": "f37583b51ed6c475cc38f812a13ae52b784f5f319be8560f94cbf0c7f7a80db2"
         },
-        "index.js": "f0b34c037801167d07455fac6143117b477e7e40968cb39e866b2f2880193763",
-        "module.json": "3ce569a061c182fe78e3355019aa577ad389083cc1b3b980889c865ade9fa7ba",
+        "index.js": "57388c6d3dafacc123440b7f451970dca031c57c7fbb022711a885827fd05a01",
+        "module.json": "08d58bb70bfe24c1f306afb57129720b0418215dec143be036e643ed8184340c",
         "settings_migrator.js": "0da6c1e6f7d14d980db286eb577e2e181cfcba44d9bc7dc0601db6c0020a2a03"
     },
     "defs": {
         "C_USE_ITEM": 3,
         "C_USE_PREMIUM_SLOT": 1,
-        "S_ABNORMALITY_BEGIN": 4,
-        "S_ABNORMALITY_END": 1,
-        "S_ABNORMALITY_REFRESH": 2,
         "S_PREMIUM_SLOT_DATALIST": 2
     }
 }

+ 2 - 2
module.json

@@ -1,9 +1,9 @@
 {
     "disableAutoUpdate": false,
     "name": "Essentials",
-    "author": "TeraProxy / Caali / Pinkie Pie",
+    "author": "TeraProxy / Caali",
     "description": "A tera-proxy module that automatically uses Nostrum/Battle Solution and Complete Crystalbind items whenever needed.",
-    "version": "2.2.3",
+    "version": "2.3.0",
     "donationUrl": "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=A3KBZUCSEQ5RJ",
     "options": {
         "niceName": "Essentials",