From f05eec89cd0c772f5c12b1beef8a1d387d65f4dd Mon Sep 17 00:00:00 2001 From: Mkalo Date: Sun, 8 Mar 2020 13:52:14 -0300 Subject: [PATCH 1/7] Add instant repair --- index.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index e04d17e..ce2be81 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ const SettingsUI = require('tera-mod-ui').Settings; module.exports = function InstantEverything(mod) { - const PURPOSES = ['enchant', 'upgrade', 'soulbind', 'merge', 'dismantle']; + const PURPOSES = ['enchant', 'upgrade', 'soulbind', 'merge', 'dismantle', 'repair']; let hooks = {}; function hook(purpose, ...args) { @@ -13,6 +13,8 @@ module.exports = function InstantEverything(mod) { let enchanting = null; let upgrading = null; + let repairing = null; + function enable(purpose) { switch (purpose) { case 'enchant': { @@ -49,6 +51,22 @@ module.exports = function InstantEverything(mod) { break; } + case 'repair': { + if(mod.majorPatchVersion >= 79) { + hook('upgrade', 'C_REGISTER_REPAIR_ITEM', 1, event => { repairing = event }); + + hook('upgrade', 'C_START_REPAIR_ITEM', 1, event => { + if (repairing && event.contract === repairing.contract) { + mod.send('C_REQUEST_REPAIR_ITEM', 1, repairing); + return false; + } + }); + + hook('upgrade', 'C_REQUEST_REPAIR_ITEM', 'event', () => false); + } + break; + } + case 'soulbind': { hook('soulbind', 'C_BIND_ITEM_BEGIN_PROGRESS', 1, event => { mod.send('C_BIND_ITEM_EXECUTE', 1, { From 21ff6daf26e4b01e8c5cd2c9b94d75bd07413962 Mon Sep 17 00:00:00 2001 From: Mkalo Date: Sun, 8 Mar 2020 13:55:12 -0300 Subject: [PATCH 2/7] Update index.js --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index ce2be81..cda45d3 100644 --- a/index.js +++ b/index.js @@ -37,16 +37,16 @@ module.exports = function InstantEverything(mod) { case 'upgrade': { if(mod.majorPatchVersion >= 79) { - hook('upgrade', 'C_REGISTER_EVOLUTION_ITEM', 1, event => { upgrading = event }); + hook('repair', 'C_REGISTER_EVOLUTION_ITEM', 1, event => { upgrading = event }); - hook('upgrade', 'C_START_EVOLUTION', 1, event => { + hook('repair', 'C_START_EVOLUTION', 1, event => { if (upgrading && event.contract === upgrading.contract) { mod.send('C_REQUEST_EVOLUTION', 1, upgrading); return false; } }); - hook('upgrade', 'C_REQUEST_EVOLUTION', 'event', () => false); + hook('repair', 'C_REQUEST_EVOLUTION', 'event', () => false); } break; } From 4f96ee127135fabdb49f1d79eb0d5e2de98fb7d8 Mon Sep 17 00:00:00 2001 From: Mkalo Date: Sun, 8 Mar 2020 13:56:03 -0300 Subject: [PATCH 3/7] I'm retarded --- index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index cda45d3..2f3d1f8 100644 --- a/index.js +++ b/index.js @@ -37,32 +37,32 @@ module.exports = function InstantEverything(mod) { case 'upgrade': { if(mod.majorPatchVersion >= 79) { - hook('repair', 'C_REGISTER_EVOLUTION_ITEM', 1, event => { upgrading = event }); + hook('upgrade', 'C_REGISTER_EVOLUTION_ITEM', 1, event => { upgrading = event }); - hook('repair', 'C_START_EVOLUTION', 1, event => { + hook('upgrade', 'C_START_EVOLUTION', 1, event => { if (upgrading && event.contract === upgrading.contract) { mod.send('C_REQUEST_EVOLUTION', 1, upgrading); return false; } }); - hook('repair', 'C_REQUEST_EVOLUTION', 'event', () => false); + hook('upgrade', 'C_REQUEST_EVOLUTION', 'event', () => false); } break; } case 'repair': { if(mod.majorPatchVersion >= 79) { - hook('upgrade', 'C_REGISTER_REPAIR_ITEM', 1, event => { repairing = event }); + hook('repair', 'C_REGISTER_REPAIR_ITEM', 1, event => { repairing = event }); - hook('upgrade', 'C_START_REPAIR_ITEM', 1, event => { + hook('repair', 'C_START_REPAIR_ITEM', 1, event => { if (repairing && event.contract === repairing.contract) { mod.send('C_REQUEST_REPAIR_ITEM', 1, repairing); return false; } }); - hook('upgrade', 'C_REQUEST_REPAIR_ITEM', 'event', () => false); + hook('repair', 'C_REQUEST_REPAIR_ITEM', 'event', () => false); } break; } From 61be6b19dbb7b7d59990475b043dece48d11ea1d Mon Sep 17 00:00:00 2001 From: Mkalo Date: Sun, 8 Mar 2020 13:59:45 -0300 Subject: [PATCH 4/7] Update settings_structure.js --- settings_structure.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/settings_structure.js b/settings_structure.js index 43ca4fa..069c0df 100644 --- a/settings_structure.js +++ b/settings_structure.js @@ -23,5 +23,10 @@ module.exports = [ "key": "dismantle", "name": "Instant Dismantling", "type": "bool" + }, + { + "key": "repair", + "name": "Instant Repairing", + "type": "bool" } ]; From 56decc783790029abecad388bf7a47b746e80192 Mon Sep 17 00:00:00 2001 From: Mkalo Date: Sun, 8 Mar 2020 14:01:06 -0300 Subject: [PATCH 5/7] Update settings_migrator.js --- settings_migrator.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/settings_migrator.js b/settings_migrator.js index caad634..4cae770 100644 --- a/settings_migrator.js +++ b/settings_migrator.js @@ -4,6 +4,7 @@ const DefaultSettings = { "soulbind": true, "merge": true, "dismantle": true, + "repair": true, } module.exports = function MigrateSettings(from_ver, to_ver, settings) { @@ -15,6 +16,6 @@ module.exports = function MigrateSettings(from_ver, to_ver, settings) { return DefaultSettings; } else { // Migrate from older version (using the new system) to latest one - throw new Error('So far there is only one settings version and this should never be reached!'); + return Object.assign(Object.assign({}, DefaultSettings), settings); } } From 28d9573cdef98314394037a92d3ba9f90ecc34f8 Mon Sep 17 00:00:00 2001 From: Mkalo Date: Sun, 8 Mar 2020 14:01:24 -0300 Subject: [PATCH 6/7] Update module.json --- module.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module.json b/module.json index 6fdb8bc..b4907ca 100644 --- a/module.json +++ b/module.json @@ -6,9 +6,9 @@ "servers": ["https://raw.githubusercontent.com/tera-toolbox-mods/instant-everything/master/"], "options": { "niceName": "InstantEverything", - "settingsVersion": 1, + "settingsVersion": 2, "settingsFile": "config.json", "settingsMigrator": "settings_migrator.js" }, "conflicts": ["instant-enchant", "instant-upgrade", "instant-soulbind", "instant-dismantle", "instant-merge"] -} \ No newline at end of file +} From 93abab7b203aa9ae463f989e468a89ce9fc1e35c Mon Sep 17 00:00:00 2001 From: Mkalo Date: Sun, 8 Mar 2020 14:06:56 -0300 Subject: [PATCH 7/7] Update manifest.json --- manifest.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 50145d6..5b631bb 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "files": { - "index.js": "7dd1ebd434d6557995aa3a2cbfe970012dd934320065dd3f4af2efba59b0c1b4", + "index.js": "d8747e0dda8c6a02e6ac0522b8810e84c01b23739a87b59aecc7e73c73d248fc", "settings_migrator.js": "823fc1c204003a4a782e23b1a0781b9ee48d2865004a8acb73359777c0c067bc", "settings_structure.js": "76520793fad024750498529f19c830819b5d9e3b0ab6aa408caaf32c0c7b2000", "module.json": "874965336c161ab99edd2196c34fd3b5a03f63724a390a9f34712e0df487fbcb" @@ -13,6 +13,10 @@ "C_REGISTER_EVOLUTION_ITEM": 1, "C_REQUEST_EVOLUTION": ["raw", 1], "C_START_EVOLUTION": 1, + + "C_REGISTER_REPAIR_ITEM": 1, + "C_REQUEST_REPAIR_ITEM": ["raw", 1], + "C_START_REPAIR_ITEM": 1, "C_BIND_ITEM_BEGIN_PROGRESS": 1, "C_BIND_ITEM_EXECUTE": ["raw", 1],