mirror of
https://github.com/notforever-ship-it/ClassToolkit
synced 2026-11-16 08:00:40 +00:00
Swing timer for every class (melee, Auto Shot, wand), buff reminder, spell ready icons, reagent and ammo warnings, and the hunter range icon and feed reminder moved over from PokeHuntLog.
40 lines
1.6 KiB
JavaScript
40 lines
1.6 KiB
JavaScript
// Copies the addon from this project into the game's AddOns folder, replacing only its own folder.
|
|
// The addon files live at the repo root (launchers expect the .toc there), so only the game's files
|
|
// are copied: the .toc, the Lua files and Data. Development files stay behind.
|
|
// Usage: node tools/install.js [path to Interface\AddOns]
|
|
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const ROOT = path.resolve(__dirname, "..");
|
|
const ADDON = "ClassToolkit";
|
|
const target = path.resolve(process.argv[2] || "E:\\Ravencraft\\twmoa_1181\\Interface\\AddOns");
|
|
|
|
if (!fs.existsSync(target)) {
|
|
console.error(`AddOns folder not found: ${target}`);
|
|
process.exit(1);
|
|
}
|
|
if (!fs.existsSync(path.join(ROOT, `${ADDON}.toc`))) {
|
|
console.error(`${ADDON}.toc is missing from the project. Restore it with: git checkout -- .`);
|
|
process.exit(1);
|
|
}
|
|
|
|
const entries = fs.readdirSync(ROOT, { withFileTypes: true }).filter((e) => {
|
|
if (e.isDirectory()) return e.name === "Data";
|
|
return e.name.endsWith(".lua") || e.name === `${ADDON}.toc`;
|
|
});
|
|
|
|
const dest = path.join(target, ADDON);
|
|
fs.rmSync(dest, { recursive: true, force: true });
|
|
fs.mkdirSync(dest, { recursive: true });
|
|
let count = 0;
|
|
for (const entry of entries) {
|
|
const from = path.join(ROOT, entry.name);
|
|
const to = path.join(dest, entry.name);
|
|
fs.cpSync(from, to, { recursive: true });
|
|
count += entry.isDirectory() ? fs.readdirSync(from).length : 1;
|
|
}
|
|
|
|
const version = (fs.readFileSync(path.join(dest, `${ADDON}.toc`), "utf8").match(/## Version:\s*(\S+)/) || [])[1];
|
|
console.log(`Installed ${ADDON} ${version} (${count} files) -> ${dest}`);
|