-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
38 lines (36 loc) · 1.09 KB
/
index.js
File metadata and controls
38 lines (36 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* global ngapp, xelib, fh */
const signaturesToProcess = [
"ALCH", "AMMO", "BOOK", "INGR", "MISC", "SCRL", "SLGM",
"SPEL", "WEAP"
];
let buildProcessBlock = function(signature) {
return {
load: () => { return { signature: signature }; },
patch: function(record, helpers, settings, locals) {
let editorId = xelib.GetValue(record, "EDID");
let recordRules = locals.rules[signature];
if (recordRules.hasOwnProperty(editorId)) {
if (!xelib.HasElement(record, "FULL")) return;
xelib.SetValue(record, "FULL", recordRules[editorId]);
helpers.logMessage(`Adding ${xelib.LongName(record)}`);
}
}
}
};
registerPatcher({
info: info,
gameModes: [xelib.gmTES5, xelib.gmSSE],
settings: {
label: "SORT Settings",
templateUrl: `${patcherUrl}/partials/settings.html`,
defaultSettings: {
patchFileName: "SORT.esp"
}
},
execute: {
initialize: function(patch, helpers, settings, locals) {
locals.rules = fh.loadJsonFile(`${patcherPath}/rules.json`);
},
process: signaturesToProcess.map(buildProcessBlock)
}
});