madden-franchise 2.3.14 → 2.4.2
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/FranchiseFile.js +35 -0
- package/FranchiseFileTable.js +5 -1
- package/package.json +1 -1
- package/scripts/deflate.js +2 -2
- package/services/utilService.js +6 -0
package/FranchiseFile.js
CHANGED
|
@@ -286,6 +286,41 @@ class FranchiseFile extends EventEmitter {
|
|
|
286
286
|
return null;
|
|
287
287
|
}
|
|
288
288
|
};
|
|
289
|
+
|
|
290
|
+
getReferencesToRecord(tableId, recordIndex) {
|
|
291
|
+
const referencedTable = this.getTableById(tableId);
|
|
292
|
+
|
|
293
|
+
if (referencedTable) {
|
|
294
|
+
const fullBinary = utilService.getBinaryReferenceData(tableId, recordIndex);
|
|
295
|
+
const hex = utilService.bin2hex(fullBinary).padStart(8, '0');
|
|
296
|
+
|
|
297
|
+
return this.tables.filter((table) => {
|
|
298
|
+
if (table.schema) {
|
|
299
|
+
return table.schema && table.schema.attributes.find((attribute) => {
|
|
300
|
+
return attribute.type === referencedTable.name;
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
else if (table.isArray && referencedTable.schema) {
|
|
304
|
+
// If the referenced table has a schema, we can check its base name.
|
|
305
|
+
// Some array table names are by the base name like EnumTable[] can contain AwardTypeEnumTableEntry
|
|
306
|
+
|
|
307
|
+
return table.name.slice(0, table.name.length - 2) === referencedTable.name
|
|
308
|
+
|| table.name.slice(0, table.name.length - 2) === referencedTable.schema.base;
|
|
309
|
+
}
|
|
310
|
+
else if (table.isArray) {
|
|
311
|
+
return table.name.slice(0, table.name.length - 2) === referencedTable.name;
|
|
312
|
+
}
|
|
313
|
+
}).filter((table) => {
|
|
314
|
+
return table.data.indexOf(hex, 0, 'hex') !== -1;
|
|
315
|
+
}).map((table) => {
|
|
316
|
+
return {
|
|
317
|
+
tableId: table.header.tableId,
|
|
318
|
+
name: table.name,
|
|
319
|
+
table: table
|
|
320
|
+
}
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
};
|
|
289
324
|
};
|
|
290
325
|
|
|
291
326
|
module.exports = FranchiseFile;
|
package/FranchiseFileTable.js
CHANGED
|
@@ -44,6 +44,10 @@ class FranchiseFileTable extends EventEmitter {
|
|
|
44
44
|
get schema () {
|
|
45
45
|
return this._schema;
|
|
46
46
|
};
|
|
47
|
+
|
|
48
|
+
getBinaryReferenceToRecord(index) {
|
|
49
|
+
return utilService.getBinaryReferenceData(this.header.tableId, index);
|
|
50
|
+
};
|
|
47
51
|
|
|
48
52
|
updateBuffer() {
|
|
49
53
|
// need to check table2 data first because it may change offsets of the legit records.
|
|
@@ -592,7 +596,7 @@ function readOffsetTable(data, schema, header) {
|
|
|
592
596
|
'originalIndex': parseInt(attribute.index),
|
|
593
597
|
'name': attribute.name,
|
|
594
598
|
'type': (minValue < 0 || maxValue < 0) ? 's_' + attribute.type : attribute.type,
|
|
595
|
-
'isReference': !attribute.enum && (attribute.type[0] == attribute.type[0].toUpperCase() || attribute.type.includes('[]')) ? true : false,
|
|
599
|
+
'isReference': !attribute.enum && (attribute.type[0] == attribute.type[0].toUpperCase() || attribute.type.includes('[]') || attribute.type === 'record') ? true : false,
|
|
596
600
|
'valueInSecondTable': header.hasSecondTable && attribute.type === 'string',
|
|
597
601
|
'isSigned': minValue < 0 || maxValue < 0,
|
|
598
602
|
'minValue': minValue,
|
package/package.json
CHANGED
package/scripts/deflate.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const zlib = require('zlib');
|
|
3
3
|
|
|
4
|
-
const filePath = 'D:\\Projects\\Madden 22\\
|
|
5
|
-
const outputPath = 'D:\\Projects\\Madden 22\\
|
|
4
|
+
const filePath = 'D:\\Projects\\Madden 22\\Misc\\FTC\\tuning.frt';
|
|
5
|
+
const outputPath = 'D:\\Projects\\Madden 22\\Misc\\FTC\\modified-Tuning.FTC'
|
|
6
6
|
|
|
7
7
|
const stream = fs.createReadStream(filePath)
|
|
8
8
|
|
package/services/utilService.js
CHANGED
|
@@ -223,4 +223,10 @@ utilService.getReferenceData = function (value) {
|
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
225
|
|
|
226
|
+
utilService.getBinaryReferenceData = function (tableId, rowNumber) {
|
|
227
|
+
const referenceBinary = utilService.dec2bin(tableId, 15);
|
|
228
|
+
const recordIndexBinary = utilService.dec2bin(rowNumber, 17);
|
|
229
|
+
return referenceBinary + recordIndexBinary;
|
|
230
|
+
};
|
|
231
|
+
|
|
226
232
|
module.exports = utilService;
|