@massif/lancer-data 4.0.0-beta.2 → 4.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -6
- package/index.js +0 -1
- package/lib/core_bonuses.json +221 -141
- package/lib/frames.json +950 -195
- package/lib/info.json +2 -3
- package/lib/lists.json +28 -0
- package/lib/mods.json +47 -35
- package/lib/pilot_gear.json +38 -74
- package/lib/reserves.json +80 -11
- package/lib/systems.json +905 -327
- package/lib/tables.json +68 -28
- package/lib/tags.json +22 -6
- package/lib/talents.json +609 -86
- package/lib/weapons.json +152 -144
- package/package.json +1 -1
- package/scripts/util.js +110 -5
- package/lib/factions.json +0 -1
package/package.json
CHANGED
package/scripts/util.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const readline = require('readline');
|
|
2
3
|
|
|
3
4
|
const fs = require('fs');
|
|
4
5
|
|
|
@@ -75,7 +76,7 @@ function decapitalize() {
|
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
function
|
|
79
|
+
function collapseEffect() {
|
|
79
80
|
fs.readdir(folderPath, (err, files) => {
|
|
80
81
|
if (err) {
|
|
81
82
|
console.error('Error reading directory:', err);
|
|
@@ -97,8 +98,8 @@ function expandEffect() {
|
|
|
97
98
|
let modified = false;
|
|
98
99
|
|
|
99
100
|
jsonData = jsonData.map((obj) => {
|
|
100
|
-
if (obj.hasOwnProperty('effect') && typeof obj.effect === '
|
|
101
|
-
obj.effect =
|
|
101
|
+
if (obj.hasOwnProperty('effect') && typeof obj.effect === 'object') {
|
|
102
|
+
obj.effect = obj.effect.description;
|
|
102
103
|
modified = true;
|
|
103
104
|
}
|
|
104
105
|
return obj;
|
|
@@ -122,6 +123,110 @@ function expandEffect() {
|
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
125
|
|
|
126
|
+
async function collectEffects() {
|
|
127
|
+
const collection = {
|
|
128
|
+
active_effects: [],
|
|
129
|
+
add_status: [],
|
|
130
|
+
add_special: [],
|
|
131
|
+
remove_special: [],
|
|
132
|
+
add_resist: [],
|
|
133
|
+
damage: [],
|
|
134
|
+
range: [],
|
|
135
|
+
save: [],
|
|
136
|
+
bonus_damage: [],
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
fs.readdir(folderPath, (err, files) => {
|
|
140
|
+
if (err) {
|
|
141
|
+
console.error('Error reading directory:', err);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const promises = [];
|
|
146
|
+
|
|
147
|
+
files.forEach((file) => {
|
|
148
|
+
if (path.extname(file) === '.json') {
|
|
149
|
+
const filePath = path.join(folderPath, file);
|
|
150
|
+
promises.push(
|
|
151
|
+
fs.readFile(filePath, 'utf8', (err, data) => {
|
|
152
|
+
if (err) {
|
|
153
|
+
console.error(`Error reading file ${file}:`, err);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
try {
|
|
157
|
+
const jsonData = JSON.parse(data);
|
|
158
|
+
if (!Array.isArray(jsonData)) return;
|
|
159
|
+
console.log(`Processing ${file} with ${jsonData.length} entries`);
|
|
160
|
+
jsonData.forEach((obj) => {
|
|
161
|
+
const elemArr = [obj];
|
|
162
|
+
if (obj.actions) elemArr.push(...obj.actions);
|
|
163
|
+
if (obj.deployables) elemArr.push(...obj.deployables);
|
|
164
|
+
elemArr.forEach((e) => {
|
|
165
|
+
if (e.active_effects) {
|
|
166
|
+
for (const effect of e.active_effects) {
|
|
167
|
+
if (Object.keys(effect).length > 2) {
|
|
168
|
+
collection.active_effects.push(effect);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (e.add_status) collection.add_status.push(e.add_status);
|
|
173
|
+
if (e.add_special) collection.add_special.push(e.add_special);
|
|
174
|
+
if (e.remove_special) collection.remove_special.push(e.remove_special);
|
|
175
|
+
if (e.add_resist) collection.add_resist.push(e.add_resist);
|
|
176
|
+
if (e.damage) collection.damage.push(e.damage);
|
|
177
|
+
if (e.range) collection.range.push(e.range);
|
|
178
|
+
if (e.save) collection.save.push(e.save);
|
|
179
|
+
if (e.bonus_damage) collection.bonus_damage.push(e.save);
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
} catch (parseError) {
|
|
183
|
+
console.error(`Error parsing JSON in file ${file}:`, parseError);
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
await new Promise((resolve) => setTimeout(resolve, 2000)); // wait for all files to be processed
|
|
192
|
+
|
|
193
|
+
await fs.writeFile(
|
|
194
|
+
'output/activeEffects.json',
|
|
195
|
+
JSON.stringify(collection, null, 2),
|
|
196
|
+
'utf8',
|
|
197
|
+
(err) => {
|
|
198
|
+
if (err) {
|
|
199
|
+
console.error('Error writing activeEffects.json:', err);
|
|
200
|
+
} else {
|
|
201
|
+
console.log('activeEffects.json updated');
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
125
207
|
// run
|
|
126
208
|
|
|
127
|
-
|
|
209
|
+
const functions = {
|
|
210
|
+
1: { name: 'Decapitalize Item names', fn: decapitalize },
|
|
211
|
+
2: { name: 'Collapse Effect Props', fn: collapseEffect },
|
|
212
|
+
3: { name: 'Collect Active Effects', fn: collectEffects },
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
console.log('Choose a function:');
|
|
216
|
+
for (const key in functions) {
|
|
217
|
+
console.log(`${key}. ${functions[key].name}`);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const rl = readline.createInterface({
|
|
221
|
+
input: process.stdin,
|
|
222
|
+
output: process.stdout,
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
rl.question('> ', (answer) => {
|
|
226
|
+
if (functions[answer]) {
|
|
227
|
+
functions[answer].fn();
|
|
228
|
+
} else {
|
|
229
|
+
console.log('Invalid choice.');
|
|
230
|
+
}
|
|
231
|
+
rl.close();
|
|
232
|
+
});
|
package/lib/factions.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
[]
|