정수형 UI 숫자 표기 검증

This commit is contained in:
2026-07-16 01:50:10 +09:00
parent 0795563185
commit 1180d23728
3 changed files with 65 additions and 0 deletions

View File

@@ -213,6 +213,21 @@ function writeCodeblocks() {
writeFileSync('RootDesk/MyDesk/SlayDeckController.codeblock', JSON.stringify(combat, null, 2), 'utf8');
}
function normalizeIntegerStrings(value) {
if (Array.isArray(value)) {
for (let index = 0; index < value.length; index++) normalizeIntegerStrings(value[index]);
return;
}
if (value == null || typeof value !== 'object') return;
for (const [key, child] of Object.entries(value)) {
if (typeof child === 'string') {
value[key] = child.replace(/^(-?\d+)\.0+$/, '$1');
} else {
normalizeIntegerStrings(child);
}
}
}
function patchCommon() {
const common = JSON.parse(readFileSync(COMMON_FILE, 'utf8'));
const entity = common.ContentProto.Entities.find((e) => e.path === '/common');
@@ -220,6 +235,7 @@ function patchCommon() {
entity.jsonString['@components'] = [
{ '@type': 'script.SlayDeckController', Enable: true, Energy: 0, MaxEnergy: 3, Turn: 0, TweenEventId: 0 },
];
normalizeIntegerStrings(common);
JSON.parse(JSON.stringify(common));
writeFileSync(COMMON_FILE, JSON.stringify(common, null, 2), 'utf8');
}