fix: 修改文件名大小写

This commit is contained in:
aixianling
2025-01-23 17:24:18 +08:00
parent dd5dde1ac5
commit 30d8e8b90b
6 changed files with 3440 additions and 7109 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -446,7 +446,7 @@
"name": "新春使者", "name": "新春使者",
"modelid": 1088, "modelid": 1088,
"talk": "|C:0xfc21ed&T:金蛇献瑞,新春送福。|\n愿你在蛇年里智慧如蛇灵动矫健幸福安康万事如意", "talk": "|C:0xfc21ed&T:金蛇献瑞,新春送福。|\n愿你在蛇年里智慧如蛇灵动矫健幸福安康万事如意",
"funcGroup": [138] "funcGroup": [144]
}, },
"90": { "90": {
"talk": "想去比奇城吗?我可以送你一程。", "talk": "想去比奇城吗?我可以送你一程。",

View File

@@ -1 +1,9 @@
{"1":{"actID":1,"actIDArr":[7],"btnName":"送宝"},"2":{"actID":2,"actIDArr":[7],"btnName":"领取夺宝战宝箱"},"3":{"actID":3,"actIDArr":[8],"btnName":"送宝"},"4":{"actID":4,"actIDArr":[8],"btnName":"领取夺宝战宝箱"},"5":{"actID":5,"actIDArr":[12],"btnName":"领取独闯天涯礼包"},"6":{"actID":6,"actIDArr":[12],"btnName":"领取神速礼包"}} {
"1": { "actID": 1, "actIDArr": [7], "btnName": "送宝" },
"2": { "actID": 2, "actIDArr": [7], "btnName": "领取夺宝战宝箱" },
"3": { "actID": 3, "actIDArr": [8], "btnName": "送宝" },
"4": { "actID": 4, "actIDArr": [8], "btnName": "领取夺宝战宝箱" },
"5": { "actID": 5, "actIDArr": [12], "btnName": "领取独闯天涯礼包" },
"6": { "actID": 6, "actIDArr": [12], "btnName": "领取神速礼包" },
"7": { "actID": 7, "actIDArr": [1818], "btnName": "拜年红包" }
}

View File

@@ -1,6 +1,7 @@
{ {
"dependencies": { "dependencies": {
"jszip": "^3.10.1", "jszip": "^3.10.1",
"lua-json": "^1.0.1",
"xlsx": "^0.18.5" "xlsx": "^0.18.5"
}, },
"scripts": { "scripts": {

View File

@@ -9,6 +9,7 @@ const scope = [
"MergeConfig", "MergeConfig",
"SpecialRingConfig", "SpecialRingConfig",
"RecyclingSettingConfig", "RecyclingSettingConfig",
"ActivitiesConf",
// "NpcTransConf" // "NpcTransConf"
// "MergeTotal", "RecyclingSettingConfig", "UpstarConfig", // "MergeTotal", "RecyclingSettingConfig", "UpstarConfig",
].filter(Boolean); ].filter(Boolean);

View File

@@ -1,107 +1,37 @@
const { log } = require('console'); const { log } = require("console");
const fs = require('fs'); const fs = require("fs");
const path = require('path'); const path = require("path");
const folderPath = "../luaConfigs" const { parse } = require("lua-json");
const folderPath = "./luaConfigs";
function parseLuaConfig(luaContent) { const scope = [
const config = {}; // "MergeTotal",
const lines = luaContent.split('\n'); "ActivitiesConf",
let currentPath = config; ].filter(Boolean);
lines.forEach(line => {
line = line.trim();
if (line.startsWith('--')) return; // 跳过注释行
// 匹配键值对
const keyMatch = line.match(/^\s*(\w+)\s*=\s*(.+?),?$/);
if (keyMatch) {
const key = keyMatch[1].trim();
const value = keyMatch[2].trim();
// 尝试解析值
let parsedValue;
if (value === 'true' || value === 'false') {
parsedValue = value === 'true';
} else if (!isNaN(parseFloat(value))) {
parsedValue = parseFloat(value);
} else if (value.startsWith('"') && value.endsWith('"')) {
parsedValue = value.slice(1, -1);
} else if (value.startsWith('{') && value.endsWith('}')) {
parsedValue = parseLuaTable(value);
} else {
parsedValue = value;
}
// 处理嵌套对象
const keys = key.split('.');
keys.reduce((acc, k, i) => {
if (i === keys.length - 1) {
acc[k] = parsedValue;
} else {
acc[k] = acc[k] || {};
return acc[k];
}
}, currentPath);
}
// 匹配表(数组或对象)
const tableMatch = line.match(/^\s*(\w+)\s*=\s*{(.+?)},?$/);
if (tableMatch) {
const key = tableMatch[1].trim();
const tableContent = tableMatch[2].trim();
const parsedTable = parseLuaTable(tableContent);
// 处理嵌套对象
const keys = key.split('.');
keys.reduce((acc, k, i) => {
if (i === keys.length - 1) {
acc[k] = parsedTable;
} else {
acc[k] = acc[k] || {};
return acc[k];
}
}, currentPath);
}
});
return config;
}
// 解析Lua表数组或对象
function parseLuaTable(tableContent) {
const table = [];
const lines = tableContent.split(',').map(line => line.trim());
lines.forEach(line => {
if (line.startsWith('{')) {
const nestedTableContent = line.slice(1, -1).trim();
table.push(parseLuaTable(nestedTableContent));
} else if (line.startsWith('"') && line.endsWith('"')) {
table.push(line.slice(1, -1));
} else if (!isNaN(parseFloat(line))) {
table.push(parseFloat(line));
} else if (line === 'true' || line === 'false') {
table.push(line === 'true');
} else {
table.push(line);
}
});
return table;
}
const scope = ["Monster"]
const start = () => { const start = () => {
const files = fs.readdirSync(folderPath); const files = fs.readdirSync(folderPath);
// 过滤出所有的 JSON 文件 // 过滤出所有的 JSON 文件
const luaFiles = files.filter(file => path.extname(file) === '.config').filter(file => scope.map(e => `${e}.config`).includes(file)); const luaFiles = files.filter((file) => path.extname(file) === ".config").filter((file) => scope.map((e) => `${e}.config`).includes(file));
luaFiles.forEach(file => { luaFiles.forEach((file) => {
const luaContent = fs.readFileSync(path.join(folderPath, file), 'utf8') const luaContent = fs.readFileSync(path.join(folderPath, file), "utf8");
const filename = path.basename(file, path.extname(file)); const filename = path.basename(file, path.extname(file));
const luaConfig = parseLuaConfig(luaContent); const content = luaContent.replace(filename, "").slice(1);
log(luaConfig) const luaConfig = parse(`return ${content}`);
fs.writeFileSync(`../configs/${filename}.json`, luaConfig); for (const key in luaConfig) {
}); const item = luaConfig[key];
} const arr = [];
start() Object.entries(item).forEach(([k, v]) => {
if (!isNaN(k) && typeof v === "object") {
arr.push(v);
}
});
if (arr.length > 0) {
luaConfig[key] = arr;
}
}
fs.writeFileSync(`./configs/${filename}.json`, JSON.stringify(luaConfig, "utf-8"));
});
};
start();