diff --git a/AD&D 2E Revised/2ESheet.html b/AD&D 2E Revised/2ESheet.html index bf28f4c706..b0d7652e43 100644 --- a/AD&D 2E Revised/2ESheet.html +++ b/AD&D 2E Revised/2ESheet.html @@ -3487,28 +3487,18 @@ GM CW - - - - - - - - - -
- - - - - - + + + + + +
@@ -3578,13 +3568,6 @@
- - - - - - - @@ -3602,10 +3585,6 @@ - - - -
ProficiencySlotsAbility ScoreModifier
Language Reading/Writing
@@ -19749,37 +19728,14 @@ on('change:repeating_customrogue:crl remove:repeating_customrogue', function(){ // --- End setup Rogue skills total --- // //Weapon proficiency slots -on('change:repeating_weaponprofs:weapprofnum remove:repeating_weaponprofs change:weapprofnum', function(){ - - TAS.repeating('weaponprofs') - .attrs('weapprofslotssum','weapprofnum') - .fields('weapprofnum') - .reduce(function(m,r){ - m.weapprofnum+=(r.I.weapprofnum); - return m; - - },{weapprofnum:0, desc: []},function(m,r,a){ - m.weapprofnum+=(a.I.weapprofnum); - a.I.weapprofslotssum=(m.weapprofnum); - }) - .execute(); +on('change:repeating_weaponprofs:weapprofnum remove:repeating_weaponprofs', function(){ + TAS.repeatingSimpleSum('weaponprofs', 'weapprofnum', 'weapprofslotssum'); }); //Nonweapon proficiency slots -on('change:repeating_profs:profslots remove:repeating_profs change:profslots', function(){ +on('change:repeating_profs:profslots remove:repeating_profs', function(){ - TAS.repeating('profs') - .attrs('profslotssum','profslots') - .fields('profslots') - .reduce(function(m,r){ - m.profslots+=(r.I.profslots); - return m; - - },{profslots:0, desc: []},function(m,r,a){ - m.profslots+=(a.I.profslots); - a.I.profslotssum=(m.profslots); - }) - .execute(); + TAS.repeatingSimpleSum('profs', 'profslots', 'profslotssum'); }); //Equipment Carried Section @@ -19846,8 +19802,26 @@ gemSections.forEach(i => { // --- ALL SHEET WORKERS END --- // +// --- Version change start --- // + var sheetName = 'AD&D 2E Revised'; -var sheetVersion = '3.3.1'; +var sheetVersion = '3.3.2'; + +function moveStaticToRepeating(fieldsToMove) { + getAttrs(fieldsToMove, function (values) { + if (values[fieldsToMove[0]]) { + let newrowid = generateRowID(); + let newValue = {}; + + for (const [key, value] of Object.entries(values)) { + newValue[`repeating_weaponprofs_${newrowid}_${key}`] = value + newValue[key] = ''; + } + + setAttrs(newValue); + } + }); +} on('sheet:opened', function(){ getAttrs(['character_sheet'],function(attrs){ @@ -19894,8 +19868,15 @@ on('sheet:opened', function(){ r['arc1'] = ''; }) .execute(); + + moveStaticToRepeating(['weaponprofname', 'weapprofnum', 'expert', 'specialist', 'mastery', 'high-mastery', 'grand-mastery', 'chosen-weapon']); + moveStaticToRepeating(['profname', 'profslots', 'profstatnum', 'profmod']); + moveStaticToRepeating(['langname', 'lang-rw']); + } }); }); +// --- Version change end --- // +