From f857fbb18a1732651ca10c625214c72e17bcb90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=88=87ince?= Date: Sun, 24 Nov 2024 23:07:24 -0800 Subject: [PATCH] linter complaints --- ADnD_1E_Revised/1ESheet.html | 132 +++++++++++++++++------------------ 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/ADnD_1E_Revised/1ESheet.html b/ADnD_1E_Revised/1ESheet.html index 289df58a06e..09889083f59 100644 --- a/ADnD_1E_Revised/1ESheet.html +++ b/ADnD_1E_Revised/1ESheet.html @@ -5449,17 +5449,17 @@

ADVANCED Options:

}; // Character Name Validation -const isAlphaNumericWithSpaces = (attr) => { - // Check for alpha-numeric characters and spaces - if (/^[a-zA-Z0-9\s]+$/.test(attr)) { + const isAlphaNumericWithSpaces = (attr) => { + // Check for alpha-numeric characters and spaces + if (/^[a-zA-Z0-9\s]+$/.test(attr)) { + return true; + } + // Check for specific characters that can break a macro + if (/[),|\}]/.test(attr)) { + return false; + } return true; - } - // Check for specific characters that can break a macro - if (/[),|\}]/.test(attr)) { - return false; - } - return true; -}; + }; // Number Validation const numbersOnly = (attr) => { @@ -5537,9 +5537,9 @@

ADVANCED Options:

output[`${eventInfo.sourceAttribute}_error`] = isNumber; // output[`${eventInfo.sourceAttribute}`] = isNumber === 0 ? 0 : attr; setAttrs(output, {silent: true}); - } + }, ); - } + }, ); // Global Variables @@ -5759,7 +5759,7 @@

ADVANCED Options:

if (v[section_attribute('nonweaponproficiencies', id, 'macro-text')]) { output[section_attribute('nonweaponproficiencies', id, 'macro-text')] = v[section_attribute('nonweaponproficiencies', id, 'macro-text')].replace( replacements.nwp_old, - replacements.nwp_new + replacements.nwp_new, ); } }); @@ -6093,7 +6093,7 @@

ADVANCED Options:

if (v[section_attribute('nonweaponproficiencies', id, 'nwp_macro_text')]) { output[section_attribute('nonweaponproficiencies', id, 'nwp_macro_text')] = v[section_attribute('nonweaponproficiencies', id, 'nwp_macro_text')].replace( replacements.nwp_old, - replacements.nwp_new + replacements.nwp_new, ); clog(`VERSION UPDATE: colorUpdate completed`); } @@ -6102,7 +6102,7 @@

ADVANCED Options:

if (v[section_attribute('weapon', id, 'weapon_macro_text')]) { output[section_attribute('weapon', id, 'weapon_macro_text')] = v[section_attribute('weapon', id, 'weapon_macro_text')].replace( replacements.wpn_old, - replacements.wpn_new + replacements.wpn_new, ); clog(`VERSION UPDATE: colorUpdate completed`); } @@ -6111,7 +6111,7 @@

ADVANCED Options:

if (v[section_attribute('ability', id, 'ability_macro_text')]) { output[section_attribute('ability', id, 'ability_macro_text')] = v[section_attribute('ability', id, 'ability_macro_text')].replace( replacements.abl_old, - replacements.abl_new + replacements.abl_new, ); clog(`VERSION UPDATE: colorUpdate completed`); } @@ -6120,7 +6120,7 @@

ADVANCED Options:

if (v[section_attribute('spells', id, 'spell_macro_text')]) { output[section_attribute('spells', id, 'spell_macro_text')] = v[section_attribute('spells', id, 'spell_macro_text')].replace( replacements.spl_old, - replacements.spl_new + replacements.spl_new, ); clog(`VERSION UPDATE: colorUpdate completed`); } @@ -6299,32 +6299,32 @@

ADVANCED Options:

if (v[section_attribute('weapon', id, 'weapon_macro_text')] === replacements.weapon_old_v6) { output[section_attribute('weapon', id, 'weapon_macro_text')] = v[section_attribute('weapon', id, 'weapon_macro_text')].replace( replacements.weapon_old_v6, - replacements.weapon_current + replacements.weapon_current, ); } else if (v[section_attribute('weapon', id, 'weapon_macro_text')] === replacements.weapon_old_v5) { output[section_attribute('weapon', id, 'weapon_macro_text')] = v[section_attribute('weapon', id, 'weapon_macro_text')].replace( replacements.weapon_old_v5, - replacements.weapon_current + replacements.weapon_current, ); } else if (v[section_attribute('weapon', id, 'weapon_macro_text')] === replacements.weapon_old_v4) { output[section_attribute('weapon', id, 'weapon_macro_text')] = v[section_attribute('weapon', id, 'weapon_macro_text')].replace( replacements.weapon_old_v4, - replacements.weapon_current + replacements.weapon_current, ); } else if (v[section_attribute('weapon', id, 'weapon_macro_text')] === replacements.weapon_old_v3) { output[section_attribute('weapon', id, 'weapon_macro_text')] = v[section_attribute('weapon', id, 'weapon_macro_text')].replace( replacements.weapon_old_v3, - replacements.weapon_current + replacements.weapon_current, ); } else if (v[section_attribute('weapon', id, 'weapon_macro_text')] === replacements.weapon_old_v2) { output[section_attribute('weapon', id, 'weapon_macro_text')] = v[section_attribute('weapon', id, 'weapon_macro_text')].replace( replacements.weapon_old_v2, - replacements.weapon_current + replacements.weapon_current, ); } else if (v[section_attribute('weapon', id, 'weapon_macro_text')] === replacements.weapon_old) { output[section_attribute('weapon', id, 'weapon_macro_text')] = v[section_attribute('weapon', id, 'weapon_macro_text')].replace( replacements.weapon_old, - replacements.weapon_current + replacements.weapon_current, ); } }); @@ -6362,31 +6362,31 @@

ADVANCED Options:

if (v[section_attribute('ability', id, 'ability_macro_text')] === replacements.ability_old_v5) { output[section_attribute('ability', id, 'ability_macro_text')] = v[section_attribute('ability', id, 'ability_macro_text')].replace( replacements.ability_old_v5, - replacements.ability_current + replacements.ability_current, ); } if (v[section_attribute('ability', id, 'ability_macro_text')] === replacements.ability_old_v4) { output[section_attribute('ability', id, 'ability_macro_text')] = v[section_attribute('ability', id, 'ability_macro_text')].replace( replacements.ability_old_v4, - replacements.ability_current + replacements.ability_current, ); } if (v[section_attribute('ability', id, 'ability_macro_text')] === replacements.ability_old_v3) { output[section_attribute('ability', id, 'ability_macro_text')] = v[section_attribute('ability', id, 'ability_macro_text')].replace( replacements.ability_old_v3, - replacements.ability_current + replacements.ability_current, ); } if (v[section_attribute('ability', id, 'ability_macro_text')] === replacements.ability_old_v2) { output[section_attribute('ability', id, 'ability_macro_text')] = v[section_attribute('ability', id, 'ability_macro_text')].replace( replacements.ability_old_v2, - replacements.ability_current + replacements.ability_current, ); } if (v[section_attribute('ability', id, 'ability_macro_text')] === replacements.ability_old) { output[section_attribute('ability', id, 'ability_macro_text')] = v[section_attribute('ability', id, 'ability_macro_text')].replace( replacements.ability_old, - replacements.ability_current + replacements.ability_current, ); } }); @@ -6418,13 +6418,13 @@

ADVANCED Options:

if (v[section_attribute('nonweaponproficiencies', id, 'nwp_macro_text')] === replacements.nwp_old_2) { output[section_attribute('nonweaponproficiencies', id, 'nwp_macro_text')] = v[section_attribute('nonweaponproficiencies', id, 'nwp_macro_text')].replace( replacements.nwp_old_2, - replacements.nwp_current + replacements.nwp_current, ); } if (v[section_attribute('nonweaponproficiencies', id, 'nwp_macro_text')] === replacements.nwp_old) { output[section_attribute('nonweaponproficiencies', id, 'nwp_macro_text')] = v[section_attribute('nonweaponproficiencies', id, 'nwp_macro_text')].replace( replacements.nwp_old, - replacements.nwp_current + replacements.nwp_current, ); } }); @@ -6458,19 +6458,19 @@

ADVANCED Options:

if (v[section_attribute('spells', id, 'spell_macro_text')] === replacements.spell_old_v3) { output[section_attribute('spells', id, 'spell_macro_text')] = v[section_attribute('spells', id, 'spell_macro_text')].replace( replacements.spell_old_v3, - replacements.spell_current + replacements.spell_current, ); } if (v[section_attribute('spells', id, 'spell_macro_text')] === replacements.spell_old_v2) { output[section_attribute('spells', id, 'spell_macro_text')] = v[section_attribute('spells', id, 'spell_macro_text')].replace( replacements.spell_old_v2, - replacements.spell_current + replacements.spell_current, ); } if (v[section_attribute('spells', id, 'spell_macro_text')] === replacements.spell_old) { output[section_attribute('spells', id, 'spell_macro_text')] = v[section_attribute('spells', id, 'spell_macro_text')].replace( replacements.spell_old, - replacements.spell_current + replacements.spell_current, ); } }); @@ -6500,7 +6500,7 @@

ADVANCED Options:

if (v[section_attribute('equipment', id, 'equipment_macro_text')] === replacements.equipment_old) { output[section_attribute('equipment', id, 'equipment_macro_text')] = v[section_attribute('equipment', id, 'equipment_macro_text')].replace( replacements.equipment_old, - replacements.equipment_current + replacements.equipment_current, ); } }); @@ -7717,7 +7717,7 @@

ADVANCED Options:

} else if (equipmentWeightsArray[nameIndex] === '0' && equipmentCostsArray[nameIndex] === '0') { // weight & cost are being tracked on weapons clog( - `MATCH w/weight & cost tracked on weapons. || UPDATE ROW || name:${weaponName} weight:${equipmentWeightsArray[nameIndex]} cost:${equipmentCostsArray[nameIndex]} at index:${nameIndex} id:${equipmentIdsArray[nameIndex]}` + `MATCH w/weight & cost tracked on weapons. || UPDATE ROW || name:${weaponName} weight:${equipmentWeightsArray[nameIndex]} cost:${equipmentCostsArray[nameIndex]} at index:${nameIndex} id:${equipmentIdsArray[nameIndex]}`, ); // update existing row newID = equipmentIdsArray[nameIndex]; @@ -7729,7 +7729,7 @@

ADVANCED Options:

} else if (equipmentWeightsArray[nameIndex] !== '0' && equipmentCostsArray[nameIndex] === '0') { // weight is being tracked on equipment but costs are not clog( - `MATCH w/weight tracked on equipment. || UPDATE ROW || name:${weaponName} weight:${equipmentWeightsArray[nameIndex]} cost:${equipmentCostsArray[nameIndex]} at index:${nameIndex} id:${equipmentIdsArray[nameIndex]}` + `MATCH w/weight tracked on equipment. || UPDATE ROW || name:${weaponName} weight:${equipmentWeightsArray[nameIndex]} cost:${equipmentCostsArray[nameIndex]} at index:${nameIndex} id:${equipmentIdsArray[nameIndex]}`, ); // update existing row newID = equipmentIdsArray[nameIndex]; @@ -7738,7 +7738,7 @@

ADVANCED Options:

} else if (equipmentWeightsArray[nameIndex] === '0' && equipmentCostsArray[nameIndex] !== '0') { // weight is not being tracked on equipment but costs are clog( - `MATCH w/cost tracked on equipment. || UPDATE ROW || name:${weaponName} weight:${equipmentWeightsArray[nameIndex]} cost:${equipmentCostsArray[nameIndex]} at index:${nameIndex} id:${equipmentIdsArray[nameIndex]}` + `MATCH w/cost tracked on equipment. || UPDATE ROW || name:${weaponName} weight:${equipmentWeightsArray[nameIndex]} cost:${equipmentCostsArray[nameIndex]} at index:${nameIndex} id:${equipmentIdsArray[nameIndex]}`, ); // update existing row newID = equipmentIdsArray[nameIndex]; @@ -7746,7 +7746,7 @@

ADVANCED Options:

output[`repeating_equipment_${newID}_equipment_weight`] = weaponWeight; } else if (equipmentWeightsArray[nameIndex] !== '0' && equipmentCostsArray[nameIndex] !== '0') { clog( - `100% MATCH weight & cost tracked on equipment. || IGNORE ROW || name:${weaponName} weight: ${equipmentWeightsArray[nameIndex]} cost:${equipmentCostsArray[nameIndex]} at index:${nameIndex}` + `100% MATCH weight & cost tracked on equipment. || IGNORE ROW || name:${weaponName} weight: ${equipmentWeightsArray[nameIndex]} cost:${equipmentCostsArray[nameIndex]} at index:${nameIndex}`, ); } else { // ignore @@ -8087,7 +8087,7 @@

ADVANCED Options:

(eventInfo) => { // clog(`Change Detected:${eventInfo.sourceAttribute}`); sumEquipmentWeight(); - } + }, ); // Coin Weight @@ -8173,7 +8173,7 @@

ADVANCED Options:

output.max_load = max + 1; setAttrs(output, {silent: true}, setCurrentEncumbranceFlag()); }); - } + }, ); // Movement Calcs @@ -8259,7 +8259,7 @@

ADVANCED Options:

clog(`>> failure in bulk calculation <<`); } setAttrs(output); - } + }, ); } @@ -8268,7 +8268,7 @@

ADVANCED Options:

(eventInfo) => { // clog(`Change Detected:${eventInfo.sourceAttribute}`); setCurrentBulk(); - } + }, ); // type/carry jumps to follow unless Show All or same type/carry tab @@ -8812,7 +8812,7 @@

ADVANCED Options:

// Once done, call the provided callback if (callback) callback(); setAttrs(output, calcAC(recalc)); - } + }, ); } @@ -8852,7 +8852,7 @@

ADVANCED Options:

output[`repeating_weapon_${newID}_weapon_notes`] = v[`repeating_equipment_${id}_equipment_description`]; setAttrs(output, {silent: true}); damageMacro(newID); - } + }, ); } @@ -8930,7 +8930,7 @@

ADVANCED Options:

fillArmorDetails(id); } }); - } + }, ); // sync armor button - fill armor details row with repeating attr values @@ -9129,7 +9129,7 @@

ADVANCED Options:

: '{{ToHitACadj2to10}}'; setAttrs(output, {silent: true}); }); - } + }, ); // Matrix or THAC0 Toggle for repeating_weapon @@ -9590,18 +9590,18 @@

ADVANCED Options:

armorOther3_base + armorOther4_base + armorOther5_base + - armorOther6_base + armorOther6_base, ); const baseAC_best = int( - Math.min(armorType_ac, armorType2_ac, armorOther_ac, unarmored_ac) + (armorShield_ac + armorOther2_ac + armorOther3_ac + armorOther4_ac + armorOther5_ac + armorOther6_ac) + Math.min(armorType_ac, armorType2_ac, armorOther_ac, unarmored_ac) + (armorShield_ac + armorOther2_ac + armorOther3_ac + armorOther4_ac + armorOther5_ac + armorOther6_ac), ); const baseAR = int( Math.min(armorType_baseValue, armorType2_baseValue, armorOther_baseValue, unArmored_baseValue) + - (armorShield_baseValue + armorOther2_baseValue + armorOther3_baseValue + armorOther4_baseValue + armorOther5_baseValue + armorOther6_baseValue) + (armorShield_baseValue + armorOther2_baseValue + armorOther3_baseValue + armorOther4_baseValue + armorOther5_baseValue + armorOther6_baseValue), ); const baseAC = int( Math.min(armorType_acValue, armorType2_acValue, armorOther_acValue, unArmored_acValue) + - (armorOther2_acValue + armorOther3_acValue + armorOther4_acValue + armorOther5_acValue + armorOther6_acValue) + (armorOther2_acValue + armorOther3_acValue + armorOther4_acValue + armorOther5_acValue + armorOther6_acValue), ); const armorMagicAC_total = int( armorType_magic + @@ -9613,7 +9613,7 @@

ADVANCED Options:

armorOther4_magic + armorOther5_magic + armorOther6_magic + - armorShield_magic + armorShield_magic, ); const armorMagicAC = int( armorType_worn * armorType_magic + @@ -9624,7 +9624,7 @@

ADVANCED Options:

armorOther3_worn * armorOther3_magic + armorOther4_worn * armorOther4_magic + armorOther5_worn * armorOther5_magic + - armorOther6_worn * armorOther6_magic + armorOther6_worn * armorOther6_magic, ); const armorModAC_total = int(armorOther_mod + armorOther2_mod + armorOther3_mod + armorOther4_mod + armorOther5_mod + armorOther6_mod + armorShield_mod) || 0; const armorModAC = int( @@ -9633,7 +9633,7 @@

ADVANCED Options:

armorOther3_worn * armorOther3_mod + armorOther4_worn * armorOther4_mod + armorOther5_worn * armorOther5_mod + - armorOther6_worn * armorOther6_mod + armorOther6_worn * armorOther6_mod, ); const combinedModMagic = int(armorModAC + armorMagicAC); const rearAC = int(baseAC + armorModAC + armorMagicAC); @@ -9672,7 +9672,7 @@

ADVANCED Options:

output.armorclass_total = totalAC; output.armorclass = syncAcFlag ? totalAC : armorClass; setAttrs(output, {silent: true}); - } + }, ); }; @@ -9683,7 +9683,7 @@

ADVANCED Options:

const recalc = 0; // clog(`AC change detected by: ${eventInfo.sourceType}`); calcAC(recalc); - } + }, ); on('clicked:calcac', (eventInfo) => { @@ -9712,7 +9712,7 @@

ADVANCED Options:

// clog(`Change Detected:${eventInfo.sourceAttribute}`); const id = eventInfo.sourceAttribute.split('_')[2]; damageMacro(id); - } + }, ); on('change:toggle_critdamage', (eventInfo) => { @@ -10582,7 +10582,7 @@

ADVANCED Options:

const tempSaveparalysispoisondeath = +v.saveparalysispoisondeath_temp_mod || 0; const oldSave = +v.saveparalysispoisondeath || 0; const newSave = int( - baseSaveparalysispoisondeath + racialSaveparalysispoisondeath + abilitySaveparalysispoisondeath + miscSaveparalysispoisondeath + tempSaveparalysispoisondeath + baseSaveparalysispoisondeath + racialSaveparalysispoisondeath + abilitySaveparalysispoisondeath + miscSaveparalysispoisondeath + tempSaveparalysispoisondeath, ); // clog(`oldSave: ${oldSave} newSave: ${newSave}`); if (migrate === 1) { @@ -10596,7 +10596,7 @@

ADVANCED Options:

output.saveparalysispoisondeath = newSave; } setAttrs(output, {silent: true}); - } + }, ); }; @@ -10619,7 +10619,7 @@

ADVANCED Options:

const tempSavepetrificationpolymorph = +v.savepetrificationpolymorph_temp_mod || 0; const oldSave = +v.savepetrificationpolymorph || 0; const newSave = int( - baseSavepetrificationpolymorph + racialSavepetrificationpolymorph + abilitySavepetrificationpolymorph + miscSavepetrificationpolymorph + tempSavepetrificationpolymorph + baseSavepetrificationpolymorph + racialSavepetrificationpolymorph + abilitySavepetrificationpolymorph + miscSavepetrificationpolymorph + tempSavepetrificationpolymorph, ); // clog(`oldSave: ${oldSave} newSave: ${newSave}`); if (migrate === 1) { @@ -10633,7 +10633,7 @@

ADVANCED Options:

output.savepetrificationpolymorph = newSave; } setAttrs(output, {silent: true}); - } + }, ); }; @@ -10668,7 +10668,7 @@

ADVANCED Options:

output.saverodsstaveswands = newSave; } setAttrs(output, {silent: true}); - } + }, ); }; @@ -10696,7 +10696,7 @@

ADVANCED Options:

output.savebreathweapons = newSave; } setAttrs(output, {silent: true}); - } + }, ); }; @@ -10775,28 +10775,28 @@

ADVANCED Options:

(eventInfo) => { // clog(`Change Detected:${eventInfo.sourceAttribute}`); saveparalysispoisondeathCalc(); - } + }, ); on( 'change:savepetrificationpolymorph_base change:savepetrificationpolymorph_racial_mod change:savepetrificationpolymorph_ability_mod change:savepetrificationpolymorph_misc_mod change:savepetrificationpolymorph_temp_mod', (eventInfo) => { // clog(`Change Detected:${eventInfo.sourceAttribute}`); savepetrificationpolymorphCalc(); - } + }, ); on( 'change:saverodsstaveswands_base change:saverodsstaveswands_racial_mod change:saverodsstaveswands_ability_mod change:saverodsstaveswands_misc_mod change:saverodsstaveswands_temp_mod', (eventInfo) => { // clog(`Change Detected:${eventInfo.sourceAttribute}`); saverodsstaveswandsCalc(); - } + }, ); on( 'change:savebreathweapons_base change:savebreathweapons_racial_mod change:savebreathweapons_ability_mod change:savebreathweapons_misc_mod change:savebreathweapons_temp_mod', (eventInfo) => { // clog(`Change Detected:${eventInfo.sourceAttribute}`); savebreathweaponsCalc(); - } + }, ); on('change:savespells_base change:savespells_racial_mod change:savespells_ability_mod change:savespells_misc_mod change:savespells_temp_mod', (eventInfo) => { // clog(`Change Detected:${eventInfo.sourceAttribute}`);