1+ /* global ngapp, xelib, fh */
2+ const signaturesToProcess = [
3+ "ALCH" , "AMMO" , "BOOK" , "INGR" , "MISC" , "SCRL" , "SLGM" ,
4+ "SPEL" , "WEAP"
5+ ] ;
6+
7+ let buildProcessBlock = function ( signature ) {
8+ return {
9+ load : ( ) => { return { signature : signature } ; } ,
10+ patch : function ( record , helpers , settings , locals ) {
11+ let editorId = xelib . GetValue ( record , "EDID" ) ;
12+ let recordRules = locals . rules [ signature ] ;
13+ if ( recordRules . hasOwnProperty ( editorId ) ) {
14+ if ( ! xelib . HasElement ( record , "FULL" ) ) return ;
15+ xelib . SetValue ( record , "FULL" , recordRules [ editorId ] ) ;
16+ helpers . logMessage ( `Adding ${ xelib . LongName ( record ) } ` ) ;
17+ }
18+ }
19+ }
20+ } ;
21+
22+ registerPatcher ( {
23+ info : info ,
24+ gameModes : [ xelib . gmTES5 , xelib . gmSSE ] ,
25+ settings : {
26+ label : "SORT Settings" ,
27+ templateUrl : `${ patcherUrl } /partials/settings.html` ,
28+ defaultSettings : {
29+ patchFileName : "SORT.esp"
30+ }
31+ } ,
32+ execute : {
33+ initialize : function ( patch , helpers , settings , locals ) {
34+ locals . rules = fh . loadJsonFile ( `${ patcherPath } /rules.json` ) ;
35+ } ,
36+ process : signaturesToProcess . map ( buildProcessBlock )
37+ }
38+ } ) ;
0 commit comments