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

Add card compose window support

Dmitry S 1 день назад
Родитель
Сommit
ae175bdbee
8 измененных файлов с 121 добавлено и 26 удалено
  1. 36 1
      README.md
  2. 37 0
      client.js
  3. BIN
      client/S1UI_CardComposeWindow.gpk
  4. 24 5
      index.js
  5. 7 5
      manifest.json
  6. 7 5
      module.json
  7. 5 10
      settings_migrator.js
  8. 5 0
      settings_structure.js

+ 36 - 1
README.md

@@ -1,4 +1,39 @@
 # instant-everything
 Removes the annoying animation and skips the progress bar for enchanting, upgrading, soulbinding, dismantling, and merging items.
 
-Each mode can be toggled by using the in-game command `instant [mode]`, with `[mode]` being `enchant`, `upgrade`, `soulbind`, `merge`, or `dismantle`.
+Each mode can be toggled by using the in-game command `instant [mode]`, with `[mode]` being `enchant`, `upgrade`, `soulbind`, `merge`, `dismantle`, or `cards`.
+
+## Card fusion / Слияние фрагментов карт
+
+`cards` skips the starting animation and every result animation: normal result,
+rank upgrade, jackpot, and selective fusion failure. The game still receives and
+records each real server result before continuing the requested number of fusions.
+Results remain in the normal result list. Cancel stops the pending frame callback.
+
+Built for TERA 100.02 x64. Start Toolbox before TERA. Toolbox loads the bundled
+`client/S1UI_CardComposeWindow.gpk` through its native ClientMod installer and
+removes the temporary override when the client closes. No game mapper or original
+archive is replaced. `cards` is enabled by default. After changing `instant cards`
+or its settings checkbox, restart TERA. After installing, fully exit TERA to the
+desktop, restart Toolbox, then launch TERA. Reconnecting Toolbox to an already
+running game does not install client packages.
+
+Пропускаются начальная анимация и все исходы: обычное слияние, повышение ранга,
+джекпот и неудача выборочного слияния. Результаты остаются в штатном списке.
+Количество слияний и переход к следующему определяет исходный контроллер игры.
+Режим включён по умолчанию; команда `instant cards` переключает его со следующего
+запуска TERA. После установки полностью закройте TERA до рабочего стола,
+перезапустите Toolbox, затем заново запустите TERA.
+
+Version 1.2.0 preserves all 20 package exports, all 7 embedded component movies,
+all 8 texture payloads, and their original allocation and reference tables.
+Only the result panel's ActionScript changes. All referenced component movies
+and textures resolve inside the bundle. No startup status message is printed.
+
+В версии 1.2.0 исправлена упаковка: сохранены все 20 объектов, встроенные
+компоненты, текстуры и служебные ссылки исходного окна. В первой сборке часть
+объектов была удалена при сохранённой таблице размещения текстур. Проверка
+сборки теперь выявляет эту ошибку и отклоняет прежний повреждённый пакет.
+
+Upstream auto-update is disabled for this local version so it does not overwrite
+the added card support. Existing item modes and settings are retained.

+ 37 - 0
client.js

@@ -0,0 +1,37 @@
+'use strict';
+
+const fs = require('fs');
+const path = require('path');
+const crypto = require('crypto');
+const RESOURCE = 'client/S1UI_CardComposeWindow.gpk';
+const EXPECTED_HASH = '812ce57e62351d84159bab36c44376bc3b78714f37f0dff8d03dfe2df5f21839';
+
+module.exports = class InstantCardsClient {
+    constructor(mod) { this.mod = mod; }
+
+    install(installer) {
+        const mod = this.mod;
+        if (mod.settings.cards === false) return;
+        const info = mod.clientInterface.info;
+        if (info.arch !== 'x64' || Number(info.majorPatchVersion) !== 100 || Number(info.minorPatchVersion) !== 2) {
+            mod.warn('Instant cards requires the TERA 100.02 x64 client; card animation override was not loaded.');
+            return;
+        }
+
+        const source = path.join(__dirname, RESOURCE);
+        const hash = crypto.createHash('sha256').update(fs.readFileSync(source)).digest('hex');
+        if (hash !== EXPECTED_HASH) throw Error('Instant cards GPK checksum mismatch. Reinstall the module.');
+        const destination = mod.clientInterface.GPKManager.getFullPath(path.resolve(mod.clientFolder, '..'), path.basename(RESOURCE));
+        const symlink = fs.symlinkSync;
+        // Preserve Toolbox tracking/cleanup on Windows without symlink privileges.
+        fs.symlinkSync = function (from, to, type) {
+            try { return symlink(from, to, type); }
+            catch (error) {
+                if (!['EPERM', 'EACCES'].includes(error.code) || path.resolve(from) !== path.resolve(source) || path.resolve(to) !== path.resolve(destination)) throw error;
+                fs.copyFileSync(from, to, fs.constants.COPYFILE_EXCL);
+            }
+        };
+        try { installer.gpk(RESOURCE); }
+        finally { fs.symlinkSync = symlink; }
+    }
+};

BIN
client/S1UI_CardComposeWindow.gpk


+ 24 - 5
index.js

@@ -1,7 +1,9 @@
 const SettingsUI = require('tera-mod-ui').Settings;
+exports.ClientMod = require('./client');
 
 exports.NetworkMod = function(mod) {
-    const PURPOSES = ['enchant', 'upgrade', 'soulbind', 'merge', 'dismantle'];
+    const PURPOSES = ['enchant', 'upgrade', 'soulbind', 'merge', 'dismantle', 'cards'];
+    let appliedSettings = Object.assign({}, mod.settings);
 
     let hooks = {};
     function hook(purpose, ...args) {
@@ -132,21 +134,38 @@ exports.NetworkMod = function(mod) {
 
             if (mod.settings[purpose]) {
                 disable(purpose);
-                mod.command.message(`Instant ${purpose} disabled!`);
+                mod.command.message(`Instant ${purpose} disabled!${purpose === 'cards' ? ' Restart TERA to apply.' : ''}`);
             } else {
                 enable(purpose);
-                mod.command.message(`Instant ${purpose} enabled!`);
+                mod.command.message(`Instant ${purpose} enabled!${purpose === 'cards' ? ' Restart TERA to apply.' : ''}`);
             }
 
             mod.settings[purpose] = !mod.settings[purpose];
+            appliedSettings = Object.assign({}, mod.settings);
+            mod.saveSettings();
+            if (ui) ui.update(mod.settings);
         }
     });
 
     // Settings UI
     let ui = null;
     if (global.TeraProxy.GUIMode) {
-        ui = new SettingsUI(mod, require('./settings_structure'), mod.settings, { height: 232 });
-        ui.on('update', settings => { mod.settings = settings; });
+        ui = new SettingsUI(mod, require('./settings_structure'), mod.settings, { height: 264 });
+        ui.on('update', settings => {
+            PURPOSES.forEach(purpose => {
+                if (settings[purpose] === appliedSettings[purpose]) return;
+                if (purpose === 'cards') {
+                    mod.command.message('Instant cards setting saved. Restart TERA to apply.');
+                } else if (settings[purpose]) {
+                    enable(purpose);
+                } else {
+                    disable(purpose);
+                }
+            });
+            mod.settings = settings;
+            appliedSettings = Object.assign({}, settings);
+            mod.saveSettings();
+        });
 
         this.destructor = () => {
             if (ui) {

+ 7 - 5
manifest.json

@@ -1,9 +1,11 @@
 {
     "files": {
-        "README.md": "832ff75e5d01aed23c836805f5523c26393c0697de5c7d1ffc26a3017a6d769e",
-        "index.js": "3dbf5d171e205e132f6254fcaacbdc4eec8af54e2a1505b6be0a8ab8cc7b10ed",
-        "module.json": "683bef7d64be89782950ddfb0d4c75c7024545df223dab3709aedd68cde0ab15",
-        "settings_migrator.js": "823fc1c204003a4a782e23b1a0781b9ee48d2865004a8acb73359777c0c067bc",
-        "settings_structure.js": "76520793fad024750498529f19c830819b5d9e3b0ab6aa408caaf32c0c7b2000"
+        "README.md": "0fd179c4889b15e7be0103fd3908f890c580d86d2dcdc48aee0a607aa90d4df8",
+        "client.js": "7e73414cd52aed6bf8c13c0b354bb9b4451fa12af67f708bda64ca3096a4c8cf",
+        "client/S1UI_CardComposeWindow.gpk": "812ce57e62351d84159bab36c44376bc3b78714f37f0dff8d03dfe2df5f21839",
+        "index.js": "4c4cd6de8f20fd9139f84d406e86daac672c33c8f0b7d4c4abc04622959fe03a",
+        "module.json": "001912fd73adb008d7ff45fae584637e7ac91b0baa06ce747f1bfa232c0ebf98",
+        "settings_migrator.js": "69ba1ef7e211d9cad3e061c7124075b2cc61a9b04e8c8f58eaf991b7c55a1c56",
+        "settings_structure.js": "d6517a48333bf7b42d21ec48d14e66392bb486134c87c116c3707f5ffc9b8c5e"
     }
 }

+ 7 - 5
module.json

@@ -1,16 +1,18 @@
 {
     "name": "instant-everything",
-    "author": "Caali / Pinkie Pie / m0py / Snug / beng",
-    "description": "Removes the annoying animation and skips the progress bar for enchanting, upgrading, soulbinding, dismantling, and merging items.",
-    "version": "1.0",
+    "author": "Caali / Pinkie Pie / m0py / Snug / beng / Vampic",
+    "description": "Skips item progress animations and card fusion animations (TERA 100.02 x64).",
+    "version": "1.2.0-cards",
+    "keywords": ["client","network"],
     "servers": ["https://raw.githubusercontent.com/tera-private-mods/instant-everything/master/"],
     "options": {
         "cliName": "InstantEverything",
         "guiName": "InstantEverything",
-        "settingsVersion": 1,
+        "settingsVersion": 2,
+        "reloadable": false,
         "settingsFile": "config.json",
         "settingsMigrator": "settings_migrator.js"
     },
-    "conflicts": ["instant-enchant","instant-upgrade","instant-soulbind","instant-dismantle","instant-merge"],
+    "conflicts": ["instant-enchant","instant-upgrade","instant-soulbind","instant-dismantle","instant-merge","instant-cards"],
     "disableAutoUpdate": false
 }

+ 5 - 10
settings_migrator.js

@@ -4,17 +4,12 @@ const DefaultSettings = {
     "soulbind": true,
     "merge": true,
     "dismantle": true,
+    "cards": true,
 }
 
 module.exports = function MigrateSettings(from_ver, to_ver, settings) {
-    if (from_ver === undefined) {
-        // Migrate legacy config file
-        return Object.assign(Object.assign({}, DefaultSettings), settings);
-    } else if (from_ver === null) {
-        // No config file exists, use default 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!');
-    }
+    // v2 adds cards while preserving all existing mode choices.
+    if (from_ver === undefined || from_ver === null || from_ver === 1)
+        return Object.assign({}, DefaultSettings, settings);
+    throw new Error(`Unsupported settings migration: ${from_ver} -> ${to_ver}`);
 }

+ 5 - 0
settings_structure.js

@@ -23,5 +23,10 @@ module.exports = [
         "key": "dismantle",
         "name": "Instant Dismantling",
         "type": "bool"
+    },
+    {
+        "key": "cards",
+        "name": "Instant Card Fusion (restart TERA)",
+        "type": "bool"
     }
 ];