Tumble files around a bit
This commit is contained in:
27
WeakAuras/Projects/RaiderSA/buildscript/words2luaArr.js
Normal file
27
WeakAuras/Projects/RaiderSA/buildscript/words2luaArr.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const WORDS_FILE = path.join(__dirname, "..", "words.txt");
|
||||
|
||||
const words = fs.readFileSync(WORDS_FILE).toString().split("\n");
|
||||
|
||||
const luaArr = [];
|
||||
luaArr.push("aura_env.spells = {");
|
||||
|
||||
for (let line = 0; line < words.length; line++) {
|
||||
const lineContent = words[line].trim();
|
||||
if (/^#\d+/.test(lineContent)) {
|
||||
const [_, id, mode] = /^#(\d+)!(\d)/.exec(lineContent);
|
||||
|
||||
const spellname = words[line + 1].trim();
|
||||
luaArr.push(`\t[${id}] = {`);
|
||||
luaArr.push(`\t\t["name"] = "${spellname}",`);
|
||||
luaArr.push(`\t\t["mode"] = ${mode},`);
|
||||
luaArr.push("\t},");
|
||||
} else if (lineContent.includes("##")) {
|
||||
luaArr.push(`\t-- ${lineContent}`);
|
||||
}
|
||||
}
|
||||
|
||||
luaArr.push("}");
|
||||
fs.writeFileSync(path.join(__dirname, "..", "luaarr.lua"), luaArr.join("\n"));
|
||||
Reference in New Issue
Block a user