diff --git a/Pathfinder-Neceros/pathfinder-neceros.html b/Pathfinder-Neceros/pathfinder-neceros.html index fd9deeb15c..445246badf 100644 --- a/Pathfinder-Neceros/pathfinder-neceros.html +++ b/Pathfinder-Neceros/pathfinder-neceros.html @@ -15033,16373 +15033,7 @@ var PFSheet = PFSheet || (function () { var newId= generateRowID(); migrateSpell(section, id, newId, function(){ //add mapping since we're done and increase count - idmap[id]=newId; - spellsHandled++; - //if we've reached the last spell then update the map on the page - if (spellsHandled === countofSpells) { - TAS.notice(idmap); - TAS.notice(JSON.stringify(idmap)); - setAttrs({"spellmap":JSON.stringify(idmap)}); - } - }); - }); - }); - }); - }, - - - /*********************************** ROW ********************************************/ - - /*checkIsNewRow - updates new_flag and id for a row. if a spell row calls updateSpell - * Within row context of a repeating section item, - * if _new_flag is blank or 0 then call handleRepeatingRowOrdering - * @section {string} = the name of the repeating section that appears after "repeating_" - * @eventinfo = from the event that launched this - */ - checkIsNewRow = function (section, eventInfo) { - if (!section || !eventInfo) { return; } - //TAS.debug("checkIsNewRow: event:"+eventInfo.sourceAttribute); - getAttrs(["repeating_" + section + "_new_flag"], function (v) { - var startIdx, endIdx, newid, setter = {}; - if (v["repeating_" + section + "_new_flag"] != "1") { - startIdx = ("repeating_" + section + "_").length; - endIdx = eventInfo.sourceAttribute.indexOf("_", startIdx); - if (endIdx <= 0) { return; } - newid = eventInfo.sourceAttribute.substring(startIdx, endIdx); - setter["repeating_" + section + "_row_id"] = newid; - setter["repeating_" + section + "_new_flag"] = "1"; - setAttrs(setter); - if ((/lvl-.-spell/.test(section))) { updateSpell(section, eventInfo); } - } - }); - }, - - /***************************************** Lists of Events to Methods ***************************************************/ - abilityEvents = "change:REPLACE-base change:REPLACE-enhance change:REPLACE-misc change:REPLACE-temp change:REPLACE-damage change:REPLACE-penalty change:REPLACE-drain change:REPLACE-cond", - saveEvents = "change:saves-cond change:total-REPLACE change:REPLACE-ability-mod change:REPLACE-trait change:REPLACE-enhance change:REPLACE-resist change:REPLACE-misc", - skillEvents = "change:acp change:checks-cond change:phys-skills-cond change:REPLACE-mod change:REPLACE-cs change:REPLACE-ranks change:REPLACE-class change:REPLACE-ability change:REPLACE-racial change:REPLACE-feat change:REPLACE-item change:REPLACE-misc change:REPLACE-ReqTrain", - spellLevelEvents = { - "change:repeating_lvl-REPLACE-spells:range change:repeating_lvl-REPLACE-spells:targets": [updateSpellRange] - , "change:repeating_lvl-REPLACE-spells:name change:repeating_lvl-REPLACE-spells:spellclass change:repeating_lvl-REPLACE-spells:spell_level change:repeating_lvl-REPLACE-spells:DC_misc change:repeating_lvl-REPLACE-spells:CL_misc change:repeating_lvl-REPLACE-spells:SP_misc change:repeating_lvl-REPLACE-spells:Concentration_misc": [updateSpell] - }, - //events for updateBonusSpells CLASSIDX is the 0-2 classes, SPELLLEVEL is 0-9 - spellClassLevelsEvents = "change:spellclass-CLASSIDX-level-SPELLLEVEL-class change:spellclass-CLASSIDX-level-SPELLLEVEL-bonus change:spellclass-CLASSIDX-level-SPELLLEVEL-misc", - conditionEvents = { - "change:condition-Sickened": [updateDamage, updateConditionCheckPenalty, updateConditionsSavePenalty, updateConditionAttackPenalty] - , "change:condition-stunned": [updateDefenses, updateConditionDefensePenalty] - , "change:condition-flat-footed": [updateDefenses, updateConditionDefensePenalty] - , "change:condition-deafened": [updateInit, updateCastingPenaltyNote] - , "change:condition-fatigued": [updateConditionAbilityPenalty] - , "change:condition-entangled": [updateConditionAbilityPenalty, updateConditionAttackPenalty] - , "change:condition-grappled": [updateGrapple, updateConditionAttackPenalty, updateConditionAttackNote] - , "change:condition-pinned": [updatePin, updateConditionDefensePenalty] - , "change:condition-drained": [updateHP, updateConditionCheckPenalty, updateConditionsSavePenalty, updateConditionAttackPenalty, updateConditionDefensePenalty] - , "change:condition-wounds": [updateConditionCheckPenalty, updateConditionsSavePenalty, updateConditionAttackPenalty, updateConditionDefensePenalty] - , "change:condition-fear": [updateConditionCheckPenalty, updateConditionsSavePenalty, updateConditionAttackPenalty] - , "change:condition-blinded": [updateConditionCheckPenalty, updateConditionDefensePenalty] - , "change:condition-cowering": [updateConditionDefensePenalty] - , "change:condition-invisible": [updateConditionAttackNote, updateDefenses, updateConditionDefensePenalty, updateConditionAttackPenalty] - , "change:condition-dazzled": [updateConditionAttackPenalty] - , "change:condition-prone": [updateConditionAttackPenalty] - }, - buffEvents={ - "Ranged":[updateAttack],"Melee":[updateAttack],"DMG":[updateDamage] - ,"Fort":[updateSave],"Will":[updateSave],"Ref":[updateSave] - ,"STR":[updateAbility], "DEX":[updateAbility], "CON":[updateAbility], "INT":[updateAbility], "WIS":[updateAbility], "CHA":[updateAbility] - }, - buffEventsNoParam={ - "AC":[updateDefenses],"Touch":[updateDefenses],"CMD":[updateDefenses] - ,"HP-temp":[updateTempHP],"Check":[updateConditionCheckPenalty] - }, - spellClassEvents = { - "change:spellclass-REPLACE": [handleSpellClassDropdown] - , "change:spellclass-REPLACE-level change:spellclass-REPLACE-level-misc change:buff_CasterLevel-total change:condition-Drained change:CasterLevel-Penalty": [updateCasterLevel] - , "change:concentration-REPLACE-ability": [handleConcentrationAbilityDropdown, updateBonusSpells] - , "change:concentration-REPLACE-mod": [updateSaveDCs, updateConcentration] - , "change:concentration-REPLACE-misc": [updateConcentration] - , "change:spellclass-REPLACE-SP_misc": [updateSpellPenetration] - , "change:spellclass-REPLACE-level-total": [updateConcentration, updateSpellPenetration, updateSpellClassRange] - , "change:concentration-REPLACE change:spellclass-REPLACE-SP-mod change:concentration-REPLACE-def": [updateSpellsAll] - //change:spellclass-0-level-total don't need since this MUST update concentration-0 - }, - - - /************************************************ RECALCULATE PAGES to account for updates *****************/ - - /*recalculateSpell sets spell level because it is now modifiable - * ensures that spell_level is set on each spell repeating row, since it was changed to an editable field - * @section the spell level "lvl-0-spells", "lvl-1-spells", .... , "lvl-9-spells" - */ - recalculateSpellLevel = function (section, id) { - var spellLevelField = "repeating_" + section + "_" + id + "_spell_level", - classLevelField = "repeating_" + section + "_" + id + "_spellclass", - dcModField = "repeating_" + section + "_" + id + "_DC-mod", - dcMiscField = "repeating_" + section + "_" + id + "_DC_misc" - ; - getAttrs([spellLevelField, classLevelField, dcModField, dcMiscField], function (v) { - var setter = {}, currLevel = parseInt(v[spellLevelField], 10), - currDCMod = parseInt(v[dcModField], 10), - currDCMisc = parseInt(v[dcMiscField], 10), - spellLevel = parseInt(section.substring(4), 10); - - if (isNaN(currLevel) && !isNaN(spellLevel)) { - setter[spellLevelField] = spellLevel; - setAttrs(setter); - } - }); - }, - - /*recalculateSpellLevels - for all spell repeating sections of a level 0,..,9 calls recalculateSpell and updateSpell - * @spellLevel {int} = the DEFAULT spell level of the repeating section, from 0 to 9 - */ - recalculateSpellLevels = function (section, force) { - var spelllvl = parseInt(section, 10); - if (!isNaN(spelllvl)) { - section = "lvl-" + spelllvl + "-spells"; - } - getSectionIDs("repeating_" + section, function (ids) { - ids.forEach(function (id, index) { - recalculateSpellLevel(section, id); - }); - }); - }, - - /*recalculateSpellLevelsAll calls recalculateSpellLevels for each spell levels 0-9 */ - recalculateSpellLevelsAll = function (force) { - var i = 0; - for (i = 0; i < 10; i++) { - recalculateSpellLevels(i, force); - } - }, - - recalculateSpell_RangeClass = function (section, id, eventInfo) { - var idStr = getRepeatingIDStr(id) - , prefix = "repeating_" + section + "_" + idStr - , spellclassField = prefix + "spellclass" - , hiddenclassNumField = prefix + "spellclass_number"; - getAttrs([spellclassField, hiddenclassNumField, "spellclass-0-name", "spellclass-1-name", "spellclass-2-name" - , prefix + "range", prefix + "range_numeric", prefix + "casterlevel", prefix + "targets"], function (v) { - var currClassNum = parseInt(v[hiddenclassNumField], 10) - , classNum = findSpellClass(v[spellclassField], v["spellclass-0-name"], v["spellclass-1-name"], v["spellclass-2-name"]) || 0 - , currRange = parseInt(v[prefix + "range_numeric"], 10) - , casterlevel = (parseInt(v[prefix + "casterlevel"], 10) || 0) - , newRange = findSpellRange(prefix + "range", calculateSpellRanges(casterlevel), prefix + "targets", casterlevel) - , setter = {}, setAny = 0; - - if (newRange !== currRange || isNaN(currRange)) { - setter[prefix + "range_numeric"] = newRange; - setAny = 1; - } - if (classNum !== currClassNum || isNaN(currClassNum)) { - setter[hiddenclassNumField] = classNum; - setAny = 1; - } - if (setAny) { setAttrs(setter, { silent: true }); } - - }); - }, - - /* recalc the whole spell except level - calls updateSpell */ - recalculateSpells_RangeClass = function (section, force) { - var spelllvl = parseInt(section, 10); - if (!isNaN(spelllvl)) { - section = "lvl-" + spelllvl + "-spells"; - } - getSectionIDs("repeating_" + section, function (ids) { - ids.forEach(function (id, index) { - recalculateSpell_RangeClass(section, id, null, force); - }); - }); - }, - - /* recalc the whole spell except level */ - recalculateSpells_RangeClassAll = function (force) { - var i = 0; - for (i = 0; i < 10; i++) { - recalculateSpells_RangeClass(i, force); - } - }, - - /* recalculateRepeatingWeapons- recalculates all repeating weapons rows. */ - recalculateRepeatingWeapons = function () { - getAttrs(["attk-effect-total", "dmg-effect-total", "DMG-mod"], function (v) { - getSectionIDs("repeating_weapon", function (ids) { - ids.forEach(function (id, index) { - var prefix = "repeating_weapon_" + id + "_"; - if (isBadRowId("weapon", id, false)) { - TAS.error("recalculateRepeatingWeapons, invalid id:" + id + ", index:" + index); - return; - } - //TAS.debug("TRACE: recalculateRepeatingWeapons id=" + id); - SWUtils.setAttributeNumber(prefix + "attk-effect-total-copy", (parseInt(v["attk-effect-total"], 10) || 0)); - SWUtils.setAttributeNumber(prefix + "dmg-effect-total-copy", (parseInt(v["dmg-effect-total"], 10) || 0)); - SWUtils.setAttributeNumber(prefix + "DMG-mod-copy", (parseInt(v["DMG-mod"], 10) || 0)); - SWUtils.evaluateAndSetNumber(prefix + "damage", prefix + "damage-mod"); - SWUtils.evaluateAndSetNumber(prefix + "attack", prefix + "attack-mod"); - handleDropdown(prefix + "attack-type", prefix + "attack-type-mod"); - handleRepeatingDamageDropdown(id); - updateRepeatingWeaponAttack(id); - updateRepeatingWeaponDamage(id); - }); - }); - }); - }, - - /* recalculateRepeatingMaxUsed - Parses the macro text "...max-calculation" in the repeating items - * (such as class-abilities, feats, traits, racial-traits) - * and sets the used|max value. - * Loops through all rows in the given repeating section. - * @section {string}= the name of the section after the word "repeating_" - */ - recalculateRepeatingMaxUsed = function (section) { - getSectionIDs("repeating_" + section, function (ids) { - ids.forEach(function (id, index) { - var prefix = "repeating_" + section + "_" + id; - if (isBadRowId(section, id, false)) { - TAS.error("recalculateRepeatingMaxUsed, invalid id:" + id + ", index:" + index); - return; - } - SWUtils.evaluateAndSetNumber(prefix + "_max-calculation", prefix + "_used_max"); - }); - }); - }, - - recalculateSkillArray = function (skills) { - skills.forEach(function (skill, index) { - var ability = skill + "-ability", abilitymod = ability + "-mod"; - handleDropdown(ability, abilitymod, function (abilityModValue) { updateSkill(skill); }, true); - }); - }, - /* recalculateSkills - updates ALL skills - calls handleDropdown for ability then updateSkill - * */ - recalculateSkills = function () { - getAttrs(["attr_unchained_skills-show", "BG-Skill-Use"], function (uv) { - if (uv["attr_unchained_skills-show"] == "1") { - if (uv["BG-Skill-Use"] == "1") { - recalculateSkillArray(allCoreSkills); - recalculateSkillArray(backgroundSkills); - } else { - recalculateSkillArray(consolidatedSkills); - } - } else { - recalculateSkillArray(allCoreSkills); - } - }); - }, - - /* fixClassSkill - updates the class skill checkbox from that long string to a number 0 or 3 - from the original sheet */ - fixClassSkill = function (skill) { - var csNm = skill + "-cs"; - getAttrs([csNm], function (v) { - var cs = 0, setter = {}; - cs = parseInt(v[csNm], 10); - if (isNaN(cs)) { - if (v[csNm] == "0") { cs = 0; } - else if (v[csNm]) { cs = 3; } - else if (!v[csNm]) { cs = 0; } - if (cs === 3) { - //TAS.debug({"function":"fixClassSkill","raw":v[csNm],"cs":cs}); - setter[csNm] = cs; - setAttrs(setter); - } - } - }); - }, - fixClassSkillArray = function (skills) { - skills.forEach(function (skill) { - fixClassSkill(skill); - }); - }, - /* fixClassSkills calls fixClassSkill for all skills */ - fixClassSkills = function () { - getAttrs(["attr_unchained_skills-show", "BG-Skill-Use"], function (uv) { - if (uv["attr_unchained_skills-show"] == "1") { - if (uv["BG-Skill-Use"] == "1") { - fixClassSkillArray(allCoreSkills); - fixClassSkillArray(backgroundSkills); - } else { - fixClassSkillArray(consolidatedSkills); - } - } else { - fixClassSkillArray(allCoreSkills); - } - }); - }, - - /* recalculateSheet - all pages in sheet! */ - recalculateSheet = function (oldversion) { - if (oldversion < 0.15) { - - abilities.forEach(function (attr) { - updateAbility(attr, null); - }); - - _.each(dropdowns, function (value, key) { - handleDropdown(key, value); - }); - classColumns.forEach(function (col) { - updateClassInformation(col); - }); - - - updateInit(); - - SWUtils.evaluateAndSetNumber("NPC-HD-misc", "NPC-HD-misc-mod"); - updateNPCHP(); - - - updateSave("Fort"); - updateSave("Ref"); - updateSave("Will"); - updateConditionDefensePenalty(); - updateArmor(); - updateConditionAttackPenalty(); - updateAttack("Melee"); - updateAttack("Ranged"); - updateAttack("CMB"); - recalculateRepeatingWeapons(); - } - if (oldversion < 0.16) { - SWUtils.evaluateAndSetNumber("Max-Skill-Ranks-Misc", "Max-Skill-Ranks-mod"); - updateMaxSkills(); - - updateConditionCheckPenalty(); - recalculateSkills(); - updateConditionAbilityPenalty(); - } - if (oldversion < 0.17) { - //skills fixed in 0.17 - if (oldversion > 0) { - //redo - updateSkill("CS-Perception"); - } - updateConditionAbilityPenalty(); - recalculateRepeatingMaxUsed("class-ability"); - recalculateRepeatingMaxUsed("feat"); - recalculateRepeatingMaxUsed("racial-trait"); - recalculateRepeatingMaxUsed("trait"); - } - if (oldversion < 0.18) { - fixClassSkills(); - } - if (oldversion < 0.19) { - updateDamage(); - updateDamageNote(); - } - if (oldversion < 0.20) { - recalculateRepeatingWeapons(); - handleRepeatingRowOrdering("class-ability", true); - handleRepeatingRowOrdering("feat", true); - handleRepeatingRowOrdering("racial-trait", true); - handleRepeatingRowOrdering("trait", true); - handleRepeatingRowOrdering("item", true); - } - if (oldversion < 0.21) { - _.each(defenseDropdowns, function (value, key) { - handleDefenseDropdown(key); - }); - updateDefenses(); - } - if (oldversion < 0.30) { - handleRepeatingRowOrdering("lvl-0-spells", true); - handleRepeatingRowOrdering("lvl-1-spells", true); - handleRepeatingRowOrdering("lvl-2-spells", true); - handleRepeatingRowOrdering("lvl-3-spells", true); - handleRepeatingRowOrdering("lvl-4-spells", true); - handleRepeatingRowOrdering("lvl-5-spells", true); - handleRepeatingRowOrdering("lvl-6-spells", true); - handleRepeatingRowOrdering("lvl-7-spells", true); - handleRepeatingRowOrdering("lvl-8-spells", true); - handleRepeatingRowOrdering("lvl-9-spells", true); - handleRepeatingRowOrdering("npc-spell-like-abilities", true); - handleRepeatingRowOrdering("npc-spells1", true); - handleRepeatingRowOrdering("npc-spells2", true); - } - if (oldversion < 0.31) { - updateConditionCheckPenalty(); - updateConditionDefensePenalty(); - } - if (oldversion < 0.32) { - ifSpellClassExists(0, function () { - handleSpellClassDropdown(0); - handleConcentrationAbilityDropdown(0); - updateCasterLevel(0); - updateConcentration(0); - updateSaveDCs(0); - }); - ifSpellClassExists(1, function () { - handleSpellClassDropdown(1); - handleConcentrationAbilityDropdown(1); - updateCasterLevel(1); - updateConcentration(1); - updateSaveDCs(1); - }); - ifSpellClassExists(2, function () { - handleSpellClassDropdown(2); - handleConcentrationAbilityDropdown(2); - updateCasterLevel(2); - updateConcentration(2); - updateSaveDCs(2); - }); - recalculateSpellLevelsAll(); - } - if (oldversion < 0.33) { - handleRepeatingRowOrdering("mythic-ability", true); - handleRepeatingRowOrdering("mythic-feat", true); - recalculateRepeatingMaxUsed("mythic-ability"); - recalculateRepeatingMaxUsed("mythic-feat"); - } -// if (oldversion < 0.34) { -// ifSpellClassExists(0, function () { updateBonusSpells(0); }); -// ifSpellClassExists(1, function () { updateBonusSpells(1); }); -// ifSpellClassExists(2, function () { updateBonusSpells(2); }); -// } - if (oldversion < 0.35) { - recalculateSpells_RangeClassAll(true); - ifSpellClassExists(0, function () { updateSpellClassRange(0); }); - ifSpellClassExists(1, function () { updateSpellClassRange(1); }); - ifSpellClassExists(2, function () { updateSpellClassRange(2); }); - } - if (oldversion < 0.36) { - updateSpellsAll(null, null, true); - } - if (oldversion < 0.37) { - updateCarriedCurrency(); - updateLoadsAndLift(); - } - if (oldversion < 0.4) { - // Find old buff data then create repeating_buff entries for them then clear out old attributes - if (oldversion > 0) { - migrateBuffs(); - recalculateAllBuffs(); - } - updateSize(); - } - if (oldversion < 0.41 ) { - buffColumns.forEach(function (col) { - PFSheet.updateBuffTotals(col); - }); - updateArmor(); - } - if (oldversion < 0.42 ) { - - updateArmor(); - //update for float - wornEquipmentColumns.forEach(function (column) { - updateWornEquipment(column); - }); - updateRepeatingItems(); - updateCarriedTotal(); - updateCurrentLoad(); - } - if (oldversion < 0.43 ) { - updateModifiedSpeed(); - ifSpellClassExists(0, function () { updateBonusSpells(0); }); - ifSpellClassExists(1, function () { updateBonusSpells(1); }); - ifSpellClassExists(2, function () { updateBonusSpells(2); }); - } - if (oldversion < 0.44 ){ - SWUtils.evaluateAndSetNumber("HP-formula-macro-text", "HP-formula-mod"); - updateTempHP(); - updateHP(); - updateCurrHP(); - } - if (oldversion < 0.45) { - TAS.notice("Migrating Spells!"); - migrateSpells(); - } - }, - - - /* checkForUpdate looks at current version of page in PFSheet_Version and compares to code PFSheet.version - * calls recalulateSheet if versions don't match or if recalculate button was pressed. - */ - checkForUpdate = function () { - getAttrs(["PFSheet_Version", "PFSheet_forcesync", "recalc1"], function (v) { - var setter = {}, currVer = 0, setAny = 0, recalc = false; - currVer = parseFloat(v["PFSheet_Version"], 10) || 0; - TAS.notice("Current Pathfinder sheet data version:" + currVer + ", Sheet code version:" + version); - - if (currVer !== version) { - recalc = true; - setter["PFSheet_Version"] = version; - setAny = 1; - } - if (v["recalc1"] && v["recalc1"] == "1") { - currVer = -1; - recalc = true; - setter["recalc1"] = 0; - setAny = 1; - } - if (v["PFSheet_forcesync"] && v["PFSheet_forcesync"] != "0") { - currVer = -1; - recalc = true; - setter["PFSheet_forcesync"] = 0; - setAny = 1; - } - if (setAny) { - setAttrs(setter); - } - if (recalc) { - recalculateSheet(currVer); - } - }); - } - - ; - - - return { - lists: { - repeatingSections: repeatingSections, - repeatingMaxUseSections: repeatingMaxUseSections, - abilities: abilities, - abilityEvents: abilityEvents, - abilityMods: abilityMods, - conditionEvents: conditionEvents, - buffColumns: buffColumns, - dropdowns: dropdowns, - defenseDropdowns: defenseDropdowns, - buffEvents:buffEvents, - buffEventsNoParam:buffEventsNoParam, - saveTypes: saveTypes, - saveEvents: saveEvents, - classColumns: classColumns, - classRows: classRows, - allCoreSkills: allCoreSkills, - backgroundSkills: backgroundSkills, - consolidatedSkills: consolidatedSkills, - sizeSkills: sizeSkills, - skillEvents: skillEvents, - spellClassIndexes: spellClassIndexes, - spellClassEvents: spellClassEvents, - spellLevels: spellLevels, - spellLevelEvents: spellLevelEvents, - spellClassLevelsEvents: spellClassLevelsEvents, - wornEquipmentRows: wornEquipmentRows, - wornEquipmentColumns: wornEquipmentColumns, - defenseArmorShieldRows: defenseArmorShieldRows, - defenseArmorShieldColumns: defenseArmorShieldColumns - }, - util: { - findAbilityInString: findAbilityInString, - findMultiplier: findMultiplier, - updateRowTotal: updateRowTotal, - handleDropdown: handleDropdown, - isBadRowId: isBadRowId - }, - recalc: { - recalculateSkills: recalculateSkills - }, - version: version, - updateSize: updateSize, - updateSizeFromText: updateSizeFromText, - updateAbility: updateAbility, - updateModifiedSpeed: updateModifiedSpeed, - updateGrapple: updateGrapple, - updatePin: updatePin, - updateBuffTotals: updateBuffTotals, - updateInit: updateInit, - updateHP: updateHP, - updateTempHP: updateTempHP, - updateCurrHP: updateCurrHP, - updateCurrHPLookup:updateCurrHPLookup, - setWoundThreshholdsLookup: setWoundThreshholdsLookup, - updateClassInformation: updateClassInformation, - updateMythicPathInformation: updateMythicPathInformation, - updateTierMythicPower: updateTierMythicPower, - updatePsionicBonusPower: updatePsionicBonusPower, - updateDefenses: updateDefenses, - updateArmor: updateArmor, - updateAttackEffectTotals: updateAttackEffectTotals, - updateDMGEffectTotals: updateDMGEffectTotals, - updateConditionsSavePenalty: updateConditionsSavePenalty, - updateSave: updateSave, - updateConditionDefensePenalty: updateConditionDefensePenalty, - handleDefenseDropdown: handleDefenseDropdown, - updateAttack: updateAttack, - updateDamage: updateDamage, - updateDamageNote: updateDamageNote, - updateConditionAttackPenalty: updateConditionAttackPenalty, - updateConditionAttackNote: updateConditionAttackNote, - handleRepeatingDamageDropdown: handleRepeatingDamageDropdown, - handleRepeatingAttackDropdown: handleRepeatingAttackDropdown, - updateRepeatingWeaponAttack: updateRepeatingWeaponAttack, - updateRepeatingWeaponDamage: updateRepeatingWeaponDamage, - updateRepeatingWeaponAttacks: updateRepeatingWeaponAttacks, - updateRepeatingWeaponDamages: updateRepeatingWeaponDamages, - updateConditionCheckPenalty: updateConditionCheckPenalty, - updateConditionAbilityPenalty: updateConditionAbilityPenalty, - updateMaxSkills: updateMaxSkills, - updateSkill: updateSkill, - verifyHasSkill: verifyHasSkill, - updateNPCHP: updateNPCHP, - updateWornEquipment: updateWornEquipment, - updateRepeatingItems:updateRepeatingItems, - updateCarriedCurrency: updateCarriedCurrency, - updateCarriedTotal: updateCarriedTotal, - updateCurrentLoad: updateCurrentLoad, - updateLoadsAndLift: updateLoadsAndLift, - handleSpellClassDropdown: handleSpellClassDropdown, - updateSpellClassRange: updateSpellClassRange, - updateConcentration: updateConcentration, - updateCasterLevel: updateCasterLevel, - ifSpellClassExists: ifSpellClassExists, - updateSpellPenetration: updateSpellPenetration, - updateMaxSpellsPerDay: updateMaxSpellsPerDay, - updateSpellClassLevel: updateSpellClassLevel, - updateSaveDCs: updateSaveDCs, - updateBonusSpells: updateBonusSpells, - handleConcentrationAbilityDropdown: handleConcentrationAbilityDropdown, - updateCastingPenaltyNote: updateCastingPenaltyNote, - updateSpell: updateSpell, - updateSpellRange: updateSpellRange, - updateSpells: updateSpells, - updateSpellsAll: updateSpellsAll, - checkIsNewRow: checkIsNewRow, - checkForUpdate: checkForUpdate - }; -}()); - -var PFEventHandler = PFEventHandler || (function () { - 'use strict'; - - //ABILITY SCORES - _.each(PFSheet.lists.abilities, function (ability) { - on((PFSheet.lists.abilityEvents.replace(/REPLACE/g, ability)), - TAS.callback(function eventUpdateAbility(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateAbility(ability, eventInfo); - }) - ); - }); - - - //CONDITIONS - _.each(PFSheet.lists.conditionEvents, function (functions, eventToWatch) { - _.each(functions, function (methodToCall) { - on(eventToWatch, - TAS.callback(function eventConditionEvents(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - methodToCall(eventInfo); - }) - ); - }); - }); - on("change:Perception-cond", - TAS.callback(function eventUpdateSkillPerceptionCond(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateSkill("Perception", eventInfo); - PFSheet.updateSkill("CS-Perception", eventInfo); - }) - ); - on("change:acp-attack-mod", - TAS.callback(function eventUpdateConditionAttackPenalty(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateConditionAttackPenalty(); - }) - ); - - //BUFFS - _.each(PFSheet.lists.buffColumns, function (col) { - //Evaluate macro text upon change - var eventToWatch = "change:repeating_buff:buff-" + col + "_macro-text"; - on(eventToWatch, - TAS.callback(function eventBuffMacroText(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - SWUtils.evaluateAndSetNumber("repeating_buff_buff-" + col + "_macro-text", "repeating_buf_buff-" + col); - }) - ); - - //Update total for a buff upon Mod change - eventToWatch = "change:repeating_buff:buff-" + col + " change:repeating_buff:buff-" + col + "-show"; - on(eventToWatch, - TAS.callback(function eventBuffMod(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateBuffTotals(col); - }) - ); - }); - - on("change:repeating_buff:buff-enable_toggle remove:repeating_buff", - TAS.callback(function eventUpdateBuffToggle(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - _.each(PFSheet.lists.buffColumns, function (col) { - PFSheet.updateBuffTotals(col); - }); - }) - ); - - //generic easy buff total updates - _.each(PFSheet.lists.buffEvents,function(functions,col){ - var eventToWatch="change:buff_"+col+"-total"; - _.each(functions,function(methodToCall){ - on(eventToWatch, - TAS.callback(function eventBuffTotal(eventInfo){ - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - methodToCall(col,eventInfo); - }) - ); - }); - }); - _.each(PFSheet.lists.buffEventsNoParam,function(functions,col){ - var eventToWatch="change:buff_"+col+"-total"; - _.each(functions,function(methodToCall){ - on(eventToWatch, - TAS.callback(function eventBuffTotal(eventInfo){ - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - methodToCall(eventInfo); - }) - ); - }); - }); - - - //SKILLS - on("change:total-skill change:total-fcskill change:int-mod change:level change:max-skill-ranks-mod change:Max-Skill-Ranks-Misc2 change:unchained_skills-show change:BG-Skill-Use", - TAS.callback(function eventUpdateMaxSkills(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateMaxSkills(eventInfo); - }) - ); - on("change:max-skill-ranks-misc", - TAS.callback(function eventMaxSkillRanksMisc(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - SWUtils.evaluateAndSetNumber("Max-Skill-Ranks-Misc", "Max-Skill-Ranks-mod"); - }) - ); - //each skill has a dropdown handler and a skill update handler - //normal skills - _.each(PFSheet.lists.allCoreSkills, function (skill) { - on((PFSheet.lists.skillEvents.replace(/REPLACE/g, skill)), - TAS.callback(function eventUpdateAllCoreSkills(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event for " + skill); - PFSheet.updateSkill(skill, eventInfo); - }) - ); - on("change:" + skill + "-ability", - TAS.callback(function eventNormalSkillAbility(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.verifyHasSkill(skill, function (hasSkill) { - if (hasSkill) { - PFSheet.util.handleDropdown(skill + "-ability", skill + "-ability-mod"); - } - }); - }) - ); - }); - //consolidated skills - _.each(PFSheet.lists.consolidatedSkills, function (skill) { - on((PFSheet.lists.skillEvents.replace(/REPLACE/g, skill)), - TAS.callback(function eventUpdateConsolidatedSkills(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event for " + skill); - PFSheet.updateSkill(skill, eventInfo); - }) - ); - on("change:" + skill + "-ability", - TAS.callback(function eventConsolidatedSkillAbility(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.verifyHasSkill(skill, function (hasSkill) { - if (hasSkill) { - PFSheet.util.handleDropdown(skill + "-ability", skill + "-ability-mod"); - } - }); - }) - ); - }); - //background only skills - _.each(PFSheet.lists.backgroundSkills, function (skill) { - on((PFSheet.lists.skillEvents.replace(/REPLACE/g, skill)), - TAS.callback(function eventUpdateBackgroundSkills(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event for " + skill); - PFSheet.updateSkill(skill, eventInfo); - }) - ); - on("change:" + skill + "-ability", - TAS.callback(function eventBackgroundSkillAbility(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.verifyHasSkill(skill, function (hasSkill) { - if (hasSkill) { - PFSheet.util.handleDropdown(skill + "-ability", skill + "-ability-mod"); - } - }); - }) - ); - }); - //skills affected by size - _.each(PFSheet.lists.sizeSkills, function (mult, skill) { - if (mult === 1) { - on("change:size_skill", - TAS.callback(function eventUpdateSizeSkill(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateSkill(skill, eventInfo); - }) - ); - } else if (mult === 2) { - on("change:size_skill_double", - TAS.callback(function eventUpdateSizeSkillDouble(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateSkill(skill, eventInfo); - }) - ); - } - }); - - - //init - on("change:init-ability-mod change:init-trait change:init-misc", - TAS.callback(function eventUpdateInit(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateInit(); - }) - ); - - //speed - on("change:current-load change:speed-base change:load-heavy change:carried-total change:race change:armor-equipped change:armor2-equipped change:armor3-equipped change:armor-type change:armor2-type change:armor3-type change:speed-source change:run-mult", - TAS.callback(function eventUpdateModifiedSpeed(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateModifiedSpeed(); - }) - ); - - //hp - on("change:hp-ability-mod change:level change:total-hp change:total-mythic-hp change:hp-formula-mod change:HP-misc change:mythic-adventures-show", - TAS.callback(function eventUpdateHP(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateHP(); - }) - ); - on("change:hp-temp-misc", - TAS.callback(function eventUpdateTempHP(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateTempHP(); - }) - ); - on("change:HP_reset", - TAS.callback(function eventResetHP(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateHP(true); - PFSheet.updateTempHP(true); - setAttrs({"HP_reset":"0"}); - }) - ); - on("change:HP change:non-lethal-damage", - TAS.callback(function eventUpdateHP(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateCurrHPLookup(eventInfo); - }) - ); - on("change:hp-formula-macro-text", - TAS.callback(function eventHPFormulaMacroText(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - SWUtils.evaluateAndSetNumber("HP-formula-macro-text", "HP-formula-mod"); - }) - ); - on("change:wound_threshold-show", - TAS.callback(function eventResetConditionWounds(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.setWoundThreshholdsLookup(); - }) - ); - - //CLASSES - _.each(PFSheet.lists.classColumns, function (col) { - var eventsToWatch = _.map(PFSheet.lists.classRows, function (row) { - return "change:class-" + row + "-" + col; - }).join(" "); - on(eventsToWatch, - TAS.callback(function eventUpdateClassInformation(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateClassInformation(col, eventInfo); - }) - ); - if (col === "level") { - on(eventsToWatch, - TAS.callback(function eventUpdateClassInformationLevel(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateClassInformation("skill", eventInfo); - }) - ); - } - }); - //rows class level updates spell class level - _.each(PFSheet.lists.classRows, function (row) { - on("change:class-" + row + "-level", - TAS.callback(function eventUpdateSpellClassLevel(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateSpellClassLevel(parseInt(row, 10), eventInfo); - }) - ); - }); - - //GENERIC DROPDOWNS - _.each(PFSheet.lists.dropdowns, function (write, read) { - on("change:" + read, - TAS.callback(function eventGenericDropdowns(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.util.handleDropdown(read, write); - }) - ); - }); - //DEFENSE DROPDOWNS - _.each(PFSheet.lists.defenseDropdowns, function (write, read) { - on("change:" + read, - TAS.callback(function eventHandleDefenseDropdown(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.handleDefenseDropdown(read); - }) - ); - }); - //Spell Resistance - on("change:SR-macro-text", - TAS.callback(function eventSRMacroText(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - SWUtils.evaluateAndSetNumber("SR-macro-text", "SR"); - }) - ); - - //mythic paths - on("change:mythic-tier change:mythic-hp", - TAS.callback(function eventUpdateMythicPathInformation(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateMythicPathInformation(); - }) - ); - - //mythic power - on("change:mythic-tier", - TAS.callback(function eventUpdateTierMythicPower(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateTierMythicPower(); - }) - ); - on("change:misc-mythic-power change:tier-mythic-power", - TAS.callback(function eventUpdateMythicPower(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.util.updateRowTotal(["mythic-power_max", "tier-mythic-power", "misc-mythic-power"]); - }) - ); - - //psionics - on("change:psionic-level change:psionic-level-misc", - TAS.callback(function eventUpdatePsionicLevel(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.util.updateRowTotal(["psionic-level-total", "psionic-level", "psionic-level-misc"]); - }) - ); - on("change:class-psionic-power change:ability-psionic-power change:misc-psionic-power", - TAS.callback(function eventUpdatePsionicPower(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.util.updateRowTotal(["psionic-power_max", "class-psionic-power", "ability-psionic-power", "misc-psionic-power"]); - }) - ); - on("change:selected-ability-psionic-power change:psionic-level-total", - TAS.callback(function eventUpdatePsionicBonusPower(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updatePsionicBonusPower(); - }) - ); - - //defenses - on("change:ac-ability-mod change:ff-dex change:ac-penalty change:cmd-penalty change:size change:ac-dodge change:ac-natural change:ac-deflect change:ac-misc change:ac-shield change:ac-armor change:cmd-dex change:ff-cmd-dex change:cmd-str change:cmd-misc change:bab change:max-dex", - TAS.callback(function eventUpdateDefenses(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateDefenses(eventInfo); - }) - ); - - on("change:max-dex-source change:acp-source change:current-load", - TAS.callback(function eventUpdateArmor(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateArmor(eventInfo.sourceAttribute); - }) - ); - _.each(PFSheet.lists.defenseArmorShieldRows, function (row) { - _.each(PFSheet.lists.defenseArmorShieldColumns, function (column) { - var eventToWatch = "change:" + row + "-" + column; - on(eventToWatch, - TAS.callback(function eventUpdateDefenseArmorShield(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateArmor(eventInfo.sourceAttribute); - }) - ); - }); - }); - - //saves - _.each(PFSheet.lists.saveTypes, function (save) { - var eventToWatch = PFSheet.lists.saveEvents.replace(/REPLACE/g, save); - on(eventToWatch, - TAS.callback(function eventUpdateSave(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event for " + save); - PFSheet.updateSave(save, eventInfo); - }) - ); - }); - - //attacks - on("change:bab change:size change:melee-ability-mod change:attk-melee-misc change:attk-penalty", - TAS.callback(function eventUpdateMeleeAttack(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateAttack("Melee"); - }) - ); - on("change:bab change:size change:ranged-ability-mod change:attk-ranged-misc change:attk-penalty", - TAS.callback(function eventUpdateRangedAttack(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateAttack("Ranged"); - }) - ); - on("change:bab change:CMD-size change:cmb-ability-mod change:attk-cmb-misc change:attk-penalty", - TAS.callback(function eventUpdateCmbAttack(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateAttack("CMB"); - }) - ); - - //attack effects - on("change:attk-effect_mod_1 change:attk-effect_mod_1_Toggle change:attk-effect_mod_2 change:attk-effect_mod_2_Toggle change:attk-effect_mod_3 change:attk-effect_mod_3_Toggle change:attk-effect_mod_4 change:attk-effect_mod_4_Toggle", - TAS.callback(function eventUpdateAttackEffectTotals(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateAttackEffectTotals(); - }) - ); - on("change:dmg-effect_mod_1 change:dmg-effect_mod_1_Toggle change:dmg-effect_mod_2 change:dmg-effect_mod_2_Toggle change:dmg-effect_mod_3 change:dmg-effect_mod_3_Toggle change:dmg-effect_mod_4 change:dmg-effect_mod_4_Toggle", - TAS.callback(function eventUpdateDmgEffectTotals(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateDMGEffectTotals(); - }) - ); - - //repeating weapons - on("change:attk-effect-total", - TAS.callback(function eventUpdateRepeatingWeaponAttackTotal(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateRepeatingWeaponAttacks(eventInfo); - }) - ); - on("change:dmg-effect-total change:dmg-mod", - TAS.callback(function eventUpdateRepeatingWeaponDamageTotal(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateRepeatingWeaponDamages(); - }) - ); - - on("change:repeating_weapon:attack-type-mod change:repeating_weapon:masterwork change:repeating_weapon:proficiency change:repeating_weapon:attack-mod", - TAS.callback(function eventUpdateRepeatingWeaponAttack(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateRepeatingWeaponAttack(null, eventInfo); - }) - ); - on("change:repeating_weapon:damage-ability-mod change:repeating_weapon:damage-mod change:repeating_weapon:damage-ability-max", - TAS.callback(function eventUpdateRepeatingWeaponDamage(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateRepeatingWeaponDamage(); - }) - ); - - on("change:repeating_weapon:attack-type", - TAS.callback(function eventHandleRepeatingAttackDropdown(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.handleRepeatingAttackDropdown(null, eventInfo); - }) - ); - on("change:repeating_weapon:damage-ability", - TAS.callback(function eventHandleRepeatingDamageDropdown(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.handleRepeatingDamageDropdown(); - }) - ); - on("change:repeating_weapon:damage", - TAS.callback(function eventRepeatingWeaponDamage(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - SWUtils.evaluateAndSetNumber("repeating_weapon_damage", "repeating_weapon_damage-mod"); - }) - ); - on("change:repeating_weapon:attack", - TAS.callback(function eventRepeatingWeaponAttack(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - SWUtils.evaluateAndSetNumber("repeating_weapon_attack", "repeating_weapon_attack-mod"); - }) - ); - - on("change:repeating_weapon:enhance", - TAS.callback(function eventUpdateRepeatingWeaponAttackAndDamage(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateRepeatingWeaponAttack(null, eventInfo); - PFSheet.updateRepeatingWeaponDamage(); - }) - ); - - //size - on("change:size", - TAS.callback(function eventUpdateSize(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateSize(); - }) - ); - //compendium copy will fire this one - on("change:size_display", - TAS.callback(function eventUpdateSizeText(eventInfo) { - TAS.debug("caught size_display event"); - PFSheet.updateSizeFromText(); - }) - ); - - //GENERIC REPEATING LISTS USED MAX - _.each(PFSheet.lists.repeatingMaxUseSections, function (section) { - var eventToWatch = "change:repeating_" + section + ":max-calculation"; - on(eventToWatch, - TAS.callback(function eventRepeatingMaxUseSections(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - SWUtils.evaluateAndSetNumber("repeating_" + section + "_max-calculation", "repeating_" + section + "_used_max"); - }) - ); - }); - - //sheet - on("sheet:opened", - TAS.callback(function eventSheetOpened(eventInfo) { - //TAS.debug("caught " + eventInfo.sourceAttribute + " event"); // sourceAttribute is undefined in this event - PFSheet.checkForUpdate(); - }) - ); - on("change:recalc1", - TAS.callback(function eventRecaluateSheet(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.checkForUpdate(); - }) - ); - - //npc sheet - on("change:npc-hd change:npc-hd-num change:npc-hd2 change:npc-hd-num2 change:npc-hd-misc-mod", - TAS.callback(function eventUpdateNpcHp(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateNPCHP(); - }) - ); - on("change:npc-hd-misc", - TAS.callback(function eventNpcHdMisc(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - SWUtils.evaluateAndSetNumber("NPC-HD-misc", "NPC-HD-misc-mod"); - }) - ); - - //items - _.each(PFSheet.lists.wornEquipmentRows, function (row) { - _.each(PFSheet.lists.wornEquipmentColumns, function (column) { - var eventToWatch = "change:worn-" + row + "-" + column; - on(eventToWatch, - TAS.callback(function eventUpdateWornEquipmentTotal(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateWornEquipment(column); - }) - ); - }); - }); - on('change:repeating_item:weight change:repeating_item:qty change:repeating_item:qty_max change:repeating_item:location', - TAS.callback(function eventUpdateItemTotalWeight(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - TAS.repeating('item') - .attrs('item_total_weight') - .fields('weight', 'qty', 'qty_max', 'location') - .reduce(function (m, r) { - if (r.I.qty > 0 && r.I.location == 0) { - if (r.I.qty_max == 0) { - m.weight += r.F.weight * r.I.qty; - } else { - m.weight += r.F.weight; - } - } - return m; - }, { - weight: 0 - }, function (m, r, a) { - a.S['item_total_weight'] = m.weight; - }) - .execute(); - }) - ); - on('change:repeating_item:hp change:repeating_item:hp_max', - TAS.callback(function eventUpdateItemTotalHp(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - TAS.repeating('item') - .attrs('item-total-hp', 'item-total-hp_max') - .fields('hp', 'hp_max') - .reduce(function (m, r) { - m.hp += r.I.hp; - m.hp_max += r.I.hp_max; - return m; - }, { - hp: 0, - hp_max: 0 - }, function (m, r, a) { - a.S['item-total-hp'] = m.hp; - a.S['item-total-hp_max'] = m.hp_max; - }) - .execute(); - }) - ); - on('change:repeating_item:value', - TAS.callback(function eventUpdateItemTotalValue(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - - TAS.repeating('item') - .attrs('item-total-value') - .fields('value') - .reduce(function (m, r) { - m.value += r.I.value; - return m; - }, { - value: 0 - }, function (m, r, a) { - a.S['item-total-value'] = m.value; - }) - .execute(); - }) - ); - on('remove:repeating_item', - TAS.callback(function eventRemoveItem(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateRepeatingItems(); - }) - ); - on('change:CP change:SP change:GP change:PP', - TAS.callback(function eventUpdateCarriedCurrency(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateCarriedCurrency(); - }) - ); - on('change:carried-currency change:item_total_weight change:worn-total-weight change:carried-misc', - TAS.callback(function eventUpdateCarriedTotal(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateCarriedTotal(); - }) - ); - on('change:load-light change:carried-total', - TAS.callback(function eventUpdateCurrentLoad(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateCurrentLoad(); - }) - ); - on("change:STR change:size change:legs change:load-str-bonus change:load-multiplier change:load-misc", - TAS.callback(function eventUpdateLoadsAndLift(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.updateLoadsAndLift(); - }) - ); - - //SPELLS - //spellclass section (3 tabs at top of spell page) - _.each(PFSheet.lists.spellClassIndexes, function (spellClassIdx) { - var numberIdx = parseInt(spellClassIdx, 10); - _.each(PFSheet.lists.spellClassEvents, function (functions, event) { - var eventToWatch = event.replace(/REPLACE/g, spellClassIdx); - _.each(functions, function (methodToCall) { - on(eventToWatch, - TAS.callback(function eventIfSpellClassExists(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.ifSpellClassExists(spellClassIdx, _.bind(methodToCall, {}, numberIdx, eventInfo)); - }) - ); - }); - }); - }); - - //all repeating spell updates - _.each(PFSheet.lists.spellLevels, function (spellLevel) { - var section = "lvl-" + spellLevel + "spells"; - _.each(PFSheet.lists.spellLevelEvents, function (functions, event) { - var eventToWatch = event.replace(/REPLACE/g, spellLevel); - _.each(functions, function (methodToCall) { - on(eventToWatch, - TAS.callback(function eventSpellLevelEvents(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - methodToCall(section, null, eventInfo); - }) - ); - }); - }); - }); - - //spells per day - _.each(PFSheet.lists.spellClassIndexes, function (spellClassIdx) { - var classNumber = parseInt(spellClassIdx, 10); - _.each(PFSheet.lists.spellLevels, function (spellLevel) { - var spellNumber = parseInt(spellLevel, 10) - , eventToWatch = PFSheet.lists.spellClassLevelsEvents.replace(/CLASSIDX/g, spellClassIdx).replace(/SPELLLEVEL/g, spellLevel); - on(eventToWatch, - TAS.callback(function eventSpellsPerDay(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.ifSpellClassExists(classNumber, _.bind(PFSheet.updateMaxSpellsPerDay, {}, classNumber, spellNumber)); - }) - ); - }); - }); - - //REPEATING SECTIONS set IDs - _.each(PFSheet.lists.repeatingSections, function (section) { - var eventToWatch = "change:repeating_" + section + ":ids-show"; - on(eventToWatch, - TAS.callback(function eventCheckIsNewRow(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.checkIsNewRow(section, eventInfo); - }) - ); - }); - - //reset based on config changes - - on("change:unchained_skills-show change:BG-Skill-Use", - TAS.callback(function eventResetUnchainedSkills(eventInfo) { - TAS.debug("caught " + eventInfo.sourceAttribute + " event"); - PFSheet.recalc.recalculateSkills(); - }) - ); - - _.each(PFSheet.lists.repeatingSections, function (section) { - var eventToWatch="change:_reporder_repeating_"+section; - on(eventToWatch, - TAS.callback(function eventReorderSection(eventInfo) { - var field = "_reporder_repeating_"+section; - TAS.debug(eventInfo); - getAttrs([field],function(v){

|
-
-
- {{#character_name}}
- {{#character_id}}[{{character_name}}](http://journal.roll20.net/character/{{character_id}}){{/character_id}}
- {{^character_id}}{{character_name}}{{/character_id}}
- {{#name}}:{{/name}}
- {{/character_name}}
- {{#name}}
- {{#name_link}}[{{name}}]({{name_link}}){{/name_link}}
- {{^name_link}}{{name}}{{/name_link}}
- {{/name}}
-
- {{#header_image}}{{header_image}}{{/header_image}}
-
- |
- |
{{subtitle}} | |
| School {{school}} | |
| Spell Level {{level}} | |
| Caster Level {{casterlevel}} | |
| Casting Time {{casting_time}} | |
| Components {{components}} | |
| Range {{range}} | |
| Effects/Target {{targets}} | |
| Duration {{duration}} | |
| {{#saving_throw}}Saving Throw {{saving_throw}}{{/saving_throw}} | -{{#dc}}DC{{dc}}{{/dc}} |
| Spell Resistance {{sr}} | |
| Caster Level Check | {{casterlevel_chk}} |
| Concentration mod: + {{Concentration}} | |
| Concentration Check | {{Concentration_chk}} |
| Spell Penetration mod: + {{spellPen}} | |
| Spell Penetration Check | {{spellPen_chk}} |
| Cast Defensively | DC {{cast_def}} |
| Cast Defensively Check | {{cast_def_chk}} |
| **Attack** | {{attack}} |
| Crit Confirm | {{crit_confirm}} |
| Damage | {{damage}} |
| Crit Damage | +{{crit_damage}} |
| Damage | {{damage}} |
| **Attack 2** | {{attack2}} |
| Crit Confirm | {{crit_confirm2}} |
| Damage | {{damage2}} |
| Crit Damage | +{{crit_damage2}} |
| **{{key}}** | {{value}} |
| Description: {{description}} | |
|
-
-
- {{#character_name}}
- {{#character_id}}[{{character_name}}](http://journal.roll20.net/character/{{character_id}}){{/character_id}}
- {{^character_id}}{{character_name}}{{/character_id}}
- {{#name}}:{{/name}}
- {{/character_name}}
- {{#name}}
- {{#name_link}}[{{name}}]({{name_link}}){{/name_link}}
- {{^name_link}}{{name}}{{/name_link}}
- {{/name}}
-
- {{#header_image}}{{header_image}}{{/header_image}}
-
- |
- |
{{subtitle}} | |
| **Attack** | {{attack}} |
| Crit Confirm | {{crit_confirm}} |
| Damage | {{damage}} |
| Crit Damage | +{{crit_damage}} |
| Damage | {{damage}} |
| **Attack 2** | {{attack2}} |
| Crit Confirm | {{crit_confirm2}} |
| Damage | {{damage2}} |
| Crit Damage | +{{crit_damage2}} |
| Damage | {{damage2}} |
| **Attack 3** | {{attack3}} |
| Crit Confirm | {{crit_confirm3}} |
| Damage | {{damage3}} |
| Crit Damage | +{{crit_damage3}} |
| Damage | {{damage3}} |
| **Attack 4** | {{attack4}} |
| Crit Confirm | {{crit_confirm4}} |
| Damage | {{damage4}} |
| Crit Damage | +{{crit_damage4}} |
| Damage | {{damage4}} |
| **Attack 5** | {{attack5}} |
| Crit Confirm | {{crit_confirm5}} |
| Damage | {{damage5}} |
| Crit Damage | +{{crit_damage5}} |
| Damage | {{damage5}} |
| **Attack 6** | {{attack6}} |
| Crit Confirm | {{crit_confirm6}} |
| Damage | {{damage6}} |
| Crit Damage | +{{crit_damage6}} |
| Damage | {{damage6}} |
| **Attack 7** | {{attack7}} |
| Crit Confirm | {{crit_confirm7}} |
| Damage | {{damage7}} |
| Crit Damage | +{{crit_damage7}} |
| Damage | {{damage7}} |
| **Attack 8** | {{attack8}} |
| Crit Confirm | {{crit_confirm8}} |
| Damage | {{damage8}} |
| Crit Damage | +{{crit_damage8}} |
| Damage | {{damage8}} |
| **Melee Notes:** {{melee_notes}} | |
| **Ranged Notes:** {{ranged_notes}} | |
| **CMB Notes:** {{CMB_notes}} | |
| **Attack Notes:** {{attack_notes}} | |
| **Type** | {{type}} |
| **Weapon Notes:** {{weapon_notes}} | |
| {{key}} | {{value}} |
| {{description}} | |
|
-
-
- {{#character_name}}
- {{#character_id}}[{{character_name}}](http://journal.roll20.net/character/{{character_id}}){{/character_id}}
- {{^character_id}}{{character_name}}{{/character_id}}
- {{#name}}:{{/name}}
- {{/character_name}}
- {{#name}}
- {{#name_link}}[{{name}}]({{name_link}}){{/name_link}}
- {{^name_link}}{{name}}{{/name_link}}
- {{/name}}
-
- {{#header_image}}{{header_image}}{{/header_image}}
-
- |
- |
{{subtitle}} | |
| {{key}} | {{value}} |
| **DR:** {{dr_notes}} | |
| **Resistances:** {{resistances_notes}} | |
| **Immunities:** {{immunities_notes}} | |
| **Weaknesses:** {{weaknesses_notes}} | |
| **SR:** {{sr0_notes}} | |
| **Armor Notes:** {{armor_notes}} | |
| **Save Notes:** {{save_notes}} | |
| **CMD Notes:** {{cmd_notes}} | |
| **Defense Notes:** {{defense_notes}} | |
| {{description}} | |
|
-
-
- {{#character_name}}
- {{#character_id}}[{{character_name}}](http://journal.roll20.net/character/{{character_id}}){{/character_id}}
- {{^character_id}}{{character_name}}{{/character_id}}
- {{#name}}:{{/name}}
- {{/character_name}}
- {{#name}}
- {{#name_link}}[{{name}}]({{name_link}}){{/name_link}}
- {{^name_link}}{{name}}{{/name_link}}
- {{/name}}
-
- {{#header_image}}{{header_image}}{{/header_image}}
-
- |
- |
{{subtitle}} | |
| {{righttext_1}} | |
| {{lefttext_1}} | |
| {{righttext_2}} | |
| {{lefttext_2}} | |
| {{righttext_3}} | |
| {{lefttext_3}} | |
| {{righttext_4}} | |
| {{lefttext_4}} | |
| {{righttext_5}} | |
| {{lefttext_5}} | |
| {{key}} | {{value}} |
| {{righttext_6}} | |
| {{lefttext_6}} | |
| {{righttext_7}} | |
| {{lefttext_7}} | |
| {{righttext_8}} | |
| {{lefttext_8}} | |
| {{righttext_9}} | |
| {{lefttext_9}} | |
| {{righttext_10}} | |
| {{lefttext_10}} | |
| **Initiative Notes:** {{init_notes}} | |
| {{description}} | |
|
-
-
- {{#character_name}}
- {{#character_id}}[{{character_name}}](http://journal.roll20.net/character/{{character_id}}){{/character_id}}
- {{^character_id}}{{character_name}}{{/character_id}}
- {{#name}}:{{/name}}
- {{/character_name}}
- {{#name}}
- {{#name_link}}[{{name}}]({{name_link}}){{/name_link}}
- {{^name_link}}{{name}}{{/name_link}}
- {{/name}}
-
- {{#header_image}}{{header_image}}{{/header_image}}
-
- |
- |
{{subtitle}} | |
| {{value}} | |
| {{description}} |