TeraProxy лет назад: 8
Родитель
Сommit
0e2d607cbd
6 измененных файлов с 31 добавлено и 20 удалено
  1. 6 3
      README.md
  2. 1 2
      config.json
  3. 15 5
      index.js
  4. 5 5
      manifest.json
  5. 1 1
      module.json
  6. 3 4
      settings_migrator.js

+ 6 - 3
README.md

@@ -1,5 +1,5 @@
 ##### :heavy_exclamation_mark: Status :heavy_exclamation_mark:
-Should work on all regions as long as the opcodes are mapped. Thanks to EME's unjustified DMCA actions against developers, opcodes for NA are no longer mapped.
+Should work on all regions as long as the opcodes are mapped. Works on Caali's tera-proxy.  
 
 ##### :heavy_exclamation_mark: Installation for Caali's tera-proxy :heavy_exclamation_mark:
 1) Download Essentials: https://github.com/TeraProxy/Essentials/archive/master.zip
@@ -14,11 +14,10 @@ A tera-proxy module that automatically uses "Nostrum"/"Battle Solution" and "Com
 ## Usage
 There are several options you can change in the "config.json" file:  
   
-* "elite" - If you don't have Elite/Club status, change this to "false" in order to use Prime Battle Solution instead of Everful Nostrum
 * "useNostrum" - Change this to "false" if you do not want the module to use any Nostrums
 * "useCCB" - Change this to "false" if you do not want the module to use any CCBs
 * "log" - If you need to find a specific item ID, change this to "true" and it will log the ID of any item you use in the proxy chat
-* "nostrum" - This is the ID of the Nostrum item the module will use. Only matters when "elite" is set to "false"
+* "nostrum" - This is the ID of the Nostrum item the module will use.
 * "ccb" - This is the ID of the Nostrum item the module will use
   
 While in game, open a proxy chat session by typing "/proxy" or "/8" in chat and hitting the space bar.  
@@ -38,8 +37,12 @@ Based on true-everful-nostrum by Caali https://github.com/caali-hackerman
 ## Changelog
 <details>
 
+### 2.0.2
+* [~] Tracking of whether you are Elite/Tera-Club or not is now automated (no more configuration needed)
+* [+] Running out of an Essentials item will now send you a notification and disable the module
 ### 2.0.1
 * [*] Fixed CCB always being used on login
+* [+] Added a branch for Pinkie Pie's tera-proxy
 ### 2.0.0
 * [*] Fixed Nostrum items being used after every loading screen
 * [*] Fixed missing abnormalities for some Crystalbind and Nostrum items

+ 1 - 2
config.json

@@ -1,7 +1,6 @@
 {
-    "version": 2,
+    "version": 3,
     "data": {
-        "elite": true,
         "useNostrum": true,
         "useCCB": true,
         "log": false,

+ 15 - 5
index.js

@@ -1,4 +1,4 @@
-// Version 2.0.1
+// Version 2.0.2
 // Based on true-everful-nostrum by Pinkie Pie https://github.com/pinkipi
 // Based on true-everful-nostrum by Caali https://github.com/caali-hackerman
 
@@ -16,7 +16,8 @@ module.exports = function Essentials(mod) {
 	let slot = null,
 		interval = null,
 		enabled = true,
-		abnormalities = {}
+		abnormalities = {},
+		counter = 0
 
 	// ############# //
 	// ### Hooks ### //
@@ -81,7 +82,7 @@ module.exports = function Essentials(mod) {
 		for(let buff of BUFF_NOSTRUM) // Use Nostrum only when less than 5 minutes remaining
 			if(abnormalityDuration(buff) > 300000 || !mod.settings.useNostrum) return
 
-		if(!mod.game.isIngame || mod.game.isInLoadingScreen || !mod.game.me.alive || mod.game.me.mounted || mod.game.me.inBattleground || mod.game.contract.active || (mod.settings.elite && !slot)) return
+		if(!mod.game.isIngame || mod.game.isInLoadingScreen || !mod.game.me.alive || mod.game.me.mounted || mod.game.me.inBattleground || mod.game.contract.active) return
 
 		if(enabled) {
 			if(slot) mod.toServer('C_PCBANGINVENTORY_USE_SLOT', 1, {slot})
@@ -99,6 +100,15 @@ module.exports = function Essentials(mod) {
 	}
 
 	function useItem(item) {
+		counter++
+		if(counter > 2) {
+			let missing = (item == mod.settings.nostrum) ? 'Nostrums' : 'Crystalbinds'
+			enabled = false
+			mod.command.message('You ran out of ' + missing + ' (ID: ' + item + '). Essentials has been disabled. Please restock and enable the module again by typing "essentials" in this chat.')
+			console.log('You ran out of ' + missing + ' (ID: ' + item + '). Essentials has been disabled. Please restock and enable the module again by typing "essentials" in proxy chat.')
+			setTimeout(() => { counter = 0 }, 4000)
+			return
+		}
 		mod.toServer('C_USE_ITEM', 3, {
 			gameId: mod.game.me.gameId,
 			id: item,
@@ -133,7 +143,7 @@ module.exports = function Essentials(mod) {
 
 	mod.command.add('essentials', () => {
 		enabled = !enabled
-		mod.command.message((enabled ? '<font color="#56B4E9">enabled</font>' : '<font color="#E69F00">disabled</font>'))
-		console.log('[Essentials] ' + (enabled ? 'enabled' : 'disabled'))
+		mod.command.message('Essentials ' + (enabled ? '<font color="#56B4E9">enabled</font>' : '<font color="#E69F00">disabled</font>'))
+		console.log('Essentials ' + (enabled ? 'enabled' : 'disabled'))
 	})
 }

+ 5 - 5
manifest.json

@@ -1,14 +1,14 @@
 {
 	"files": {
 		"LICENSE": "589ed823e9a84c56feb95ac58e7cf384626b9cbf4fda2a907bc36e103de1bad2",
-		"README.md": "5d12f5cfa9ee2cace492937f60df59531cf83910886d4de751127c172713057a",
+		"README.md": "a2c6bd3c02c206b1e6e795f55f79b0f83d6d4c173b4ccce0dd8452becb35b07d",
 		"config.json": {
 			"overwrite": false,
-			"hash": "a4b1339b7b5438cedc3f91a24e6b845c181c4990f7453f5d6b1822d32ee19f78"
+			"hash": "a74387d37fd9a2823c4d0bad54ede9279a51595eb59db4e5abfb3b0c0f695628"
 		},
-		"index.js": "f0babfb3df25ff4d4eee032190401e11a91fa64767734180a24c8a616d665e40",
-		"module.json": "395c3a7be155e332cbfeb2788946f42dc47b195659128bac685813025a192299",
-		"settings_migrator.js": "380eedc5a1e831f62363e4b089a897b0cf606c50b9c5032f9ce2bf5073136a37"
+		"index.js": "cfccd62dc0479838d064f9dbb5be50d0f3eaedd9e29a2c60e591afdae3329d67",
+		"module.json": "ff65da8b58525c2468a904b0c5cda7490b98d395dd352dcc12bf58ca67faf3cb",
+		"settings_migrator.js": "1e910f071a6542ea586144b5b8b57e2be8cc5cd196244b0ef294eca578c8eca5"
 	},
 	"defs": {
 		"C_PCBANGINVENTORY_USE_SLOT": 1,

+ 1 - 1
module.json

@@ -2,7 +2,7 @@
     "disableAutoUpdate": false,
     "options": {
         "niceName": "Essentials",
-        "settingsVersion": 2,
+        "settingsVersion": 3,
         "settingsFile": "config.json",
         "settingsMigrator": "settings_migrator.js"
     },

+ 3 - 4
settings_migrator.js

@@ -1,7 +1,6 @@
 "use strict"
 
 const DefaultSettings = {
-	"elite": true,
 	"useNostrum": true,
 	"useCCB": true,
 	"log": false,
@@ -23,7 +22,7 @@ module.exports = function MigrateSettings(from_ver, to_ver, settings) {
             settings = MigrateSettings(from_ver, from_ver + 1, settings);
             return MigrateSettings(from_ver + 1, to_ver, settings);
         }
-        
+
         // If we reach this point it's guaranteed that from_ver === to_ver - 1, so we can implement
         // a switch for each version step that upgrades to the next version. This enables us to
         // upgrade from any version to the latest version without additional effort!
@@ -33,7 +32,7 @@ module.exports = function MigrateSettings(from_ver, to_ver, settings) {
 			default:
 				let oldsettings = settings
 				
-				settings = Object.assign(DefaultSettings, settings);
+				settings = Object.assign(DefaultSettings, {});
 				
 				for(let option in oldsettings) {
 					if(settings[option]) {
@@ -44,7 +43,7 @@ module.exports = function MigrateSettings(from_ver, to_ver, settings) {
 				console.log('[Essentials] Your settings have been updated to version ' + to_ver + '. You can edit the new config file after the next relog.')
 				break;
         }
-        
+
         return settings;
     }
 }