diff --git a/FFD20/ffd20.html b/FFD20/ffd20.html index c0d9dd003f..87aa614464 100644 --- a/FFD20/ffd20.html +++ b/FFD20/ffd20.html @@ -13,7 +13,7 @@ setAttrs(attrs); }); }); - + on("change:str", function() { getAttrs(["str", "sheet-type"], function(values) { if (values["sheet-type"] == "monster") { @@ -25,7 +25,7 @@ } }); }); - + on("change:dex", function() { getAttrs(["dex", "sheet-type"], function(values) { if (values["sheet-type"] == "monster") { @@ -37,7 +37,7 @@ } }); }); - + on("change:con", function() { getAttrs(["con", "sheet-type"], function(values) { if (values["sheet-type"] == "monster") { @@ -49,7 +49,7 @@ } }); }); - + on("change:int", function() { getAttrs(["int", "sheet-type"], function(values) { if (values["sheet-type"] == "monster") { @@ -61,7 +61,7 @@ } }); }); - + on("change:wis", function() { getAttrs(["wis", "sheet-type"], function(values) { if (values["sheet-type"] == "monster") { @@ -73,7 +73,7 @@ } }); }); - + on("change:cha", function() { getAttrs(["cha", "sheet-type"], function(values) { if (values["sheet-type"] == "monster") { @@ -85,7 +85,7 @@ } }); }); - + on("change:str-base change:str-inherent change:str-enhance change:str-misc change:str-temp", function() { getAttrs(["str-base","str-inherent","str-enhance","str-misc","str-temp"], function(values) { var base = parseInt(values["str-base"]) || 0; @@ -105,7 +105,7 @@ }); }); }); - + on("change:dex-base change:dex-inherent change:dex-enhance change:dex-misc change:dex-temp", function() { getAttrs(["dex-base","dex-inherent","dex-enhance","dex-misc","dex-temp"], function(values) { var base = parseInt(values["dex-base"]) || 0; @@ -125,7 +125,7 @@ }); }); }); - + on("change:con-base change:con-inherent change:con-enhance change:con-misc change:con-temp", function() { getAttrs(["con-base","con-inherent","con-enhance","con-misc","con-temp"], function(values) { var base = parseInt(values["con-base"]) || 0; @@ -145,7 +145,7 @@ }); }); }); - + on("change:wis-base change:wis-inherent change:wis-enhance change:wis-misc change:wis-temp", function() { getAttrs(["wis-base","wis-inherent","wis-enhance","wis-misc","wis-temp"], function(values) { var base = parseInt(values["wis-base"]) || 0; @@ -165,7 +165,7 @@ }); }); }); - + on("change:int-base change:int-inherent change:int-enhance change:int-misc change:int-temp", function() { getAttrs(["int-base","int-inherent","int-enhance","int-misc","int-temp"], function(values) { var base = parseInt(values["int-base"]) || 0; @@ -185,7 +185,7 @@ }); }); }); - + on("change:cha-base change:cha-inherent change:cha-enhance change:cha-misc change:cha-temp", function() { getAttrs(["cha-base","cha-inherent","cha-enhance","cha-misc","cha-temp"], function(values) { var base = parseInt(values["cha-base"]) || 0; @@ -205,7 +205,7 @@ }); }); }); - + on("change:is-undead change:con-mod change:cha-mod change:level change:class-0-hp change:class-1-hp change:class-2-hp change:class-3-hp change:class-fc-hp change:options-toughness", function() { getAttrs(["is-undead", "con-mod", "cha-mod", "level", "class-0-hp", "class-1-hp", "class-2-hp", "class-3-hp", "hp-temp", "class-fc-hp", "options-toughness"], function(values) { var class0 = parseInt(values["class-0-hp"]) || 0; @@ -216,14 +216,14 @@ var level = parseInt(values["level"]) || 0; var toughnessHP; var toughnessDisplay = " "; - + if (values["options-toughness"] == "true") { toughnessHP = (level <= 3) ? 3 : level; toughnessDisplay = "(+" + toughnessHP + " HP)"; } else toughnessHP = 0; - + var total = (parseInt(values["is-undead"] == "undead" ? values["cha-mod"] : values["con-mod"]) * level) + class0 + class1 + class2 + class3 + classFC + toughnessHP; - + setAttrs({ "class-0-hp": class0, "class-1-hp": class1, @@ -236,7 +236,7 @@ }); }); }); - + on("change:class-0-mp change:class-1-mp change:class-2-mp change:class-3-mp change:options-extra-mp change:options-extra-mp-1 change:options-extra-mp-2 change:options-extra-mp-3 change:options-extra-mp-4 change:level", function() { getAttrs(["class-0-mp", "class-1-mp", "class-2-mp", "class-3-mp", "options-extra-mp", "options-extra-mp-1", "options-extra-mp-2", "options-extra-mp-3", "options-extra-mp-4", "class-0-level", "class-1-level", "class-2-level", "class-3-level"], function(values) { var class0 = parseInt(values["class-0-mp"]) || 0; @@ -249,9 +249,9 @@ var class3Level = parseInt(values["class-3-level"]) || 0; var extraMP = 0; var extraMPDisplay = " "; - + if (values["options-extra-mp"] == "true") { - var extraMP = 1; + var extraMP = 1; if (values["options-extra-mp-1"] == "true") { extraMP += Math.floor(class0Level / 2); } @@ -266,9 +266,9 @@ } extraMPDisplay = "(+" + extraMP + " MP)"; } - + var total = class0 + class1 + class2 + class3 + extraMP; - + setAttrs({ "class-0-mp": class0, "class-1-mp": class1, @@ -279,7 +279,7 @@ }); }); }); - + on("change:class-0-bab change:class-1-bab change:class-2-bab change:class-3-bab", function() { getAttrs(["class-0-bab", "class-1-bab", "class-2-bab", "class-3-bab"], function(values) { var class0 = parseInt(values["class-0-bab"]) || 0; @@ -287,7 +287,7 @@ var class2 = parseInt(values["class-2-bab"]) || 0; var class3 = parseInt(values["class-3-bab"]) || 0; var total = class0 + class1 + class2 + class3; - + setAttrs({ "class-0-bab": class0, "class-1-bab": class1, @@ -297,7 +297,7 @@ }); }); }); - + on("change:int-mod change:level change:class-0-level change:class-1-level change:class-2-level change:class-3-level change:class-0-skill change:class-1-skill change:class-2-skill change:class-3-skill change:class-fc-skill change:options-skilled", function() { getAttrs(["int-mod", "level", "class-0-level", "class-1-level", "class-2-level", "class-3-level", "class-0-skill", "class-1-skill", "class-2-skill", "class-3-skill", "class-fc-skill", "options-skilled"], function(values) { var class0 = parseInt(values["class-0-skill"]) || 0; @@ -311,14 +311,14 @@ var classFC = parseInt(values["class-fc-skill"]) || 0; var skilledBonus; var skilledDisplay = " "; - + if (values["options-skilled"] == "true") { skilledBonus = parseInt(values["level"]) || 0; skilledDisplay = "(+" + skilledBonus + " skill rank(s))" } else skilledBonus = 0; - + var total = class0total + class1total + class2total + class3total + classFC + skilledBonus; - + setAttrs({ "class-0-skill": class0, "class-1-skill": class1, @@ -330,7 +330,7 @@ }); }); }); - + on("change:class-0-fort change:class-1-fort change:class-2-fort change:class-3-fort", function() { getAttrs(["class-0-fort", "class-1-fort", "class-2-fort", "class-3-fort"], function(values) { var class0 = parseInt(values["class-0-fort"]) || 0; @@ -338,7 +338,7 @@ var class2 = parseInt(values["class-2-fort"]) || 0; var class3 = parseInt(values["class-3-fort"]) || 0; var total = class0 + class1 + class2 + class3; - + setAttrs({ "class-0-fort": class0, "class-1-fort": class1, @@ -348,7 +348,7 @@ }); }); }); - + on("change:class-0-ref change:class-1-ref change:class-2-ref change:class-3-ref", function() { getAttrs(["class-0-ref", "class-1-ref", "class-2-ref", "class-3-ref"], function(values) { var class0 = parseInt(values["class-0-ref"]) || 0; @@ -356,7 +356,7 @@ var class2 = parseInt(values["class-2-ref"]) || 0; var class3 = parseInt(values["class-3-ref"]) || 0; var total = class0 + class1 + class2 + class3; - + setAttrs({ "class-0-ref": class0, "class-1-ref": class1, @@ -366,7 +366,7 @@ }); }); }); - + on("change:class-0-will change:class-1-will change:class-2-will change:class-3-will", function() { getAttrs(["class-0-will", "class-1-will", "class-2-will", "class-3-will"], function(values) { var class0 = parseInt(values["class-0-will"]) || 0; @@ -374,7 +374,7 @@ var class2 = parseInt(values["class-2-will"]) || 0; var class3 = parseInt(values["class-3-will"]) || 0; var total = class0 + class1 + class2 + class3; - + setAttrs({ "class-0-will": class0, "class-1-will": class1, @@ -384,7 +384,7 @@ }); }); }); - + on("change:class-0-level change:class-1-level change:class-2-level change:class-3-level", function() { getAttrs(["class-0-level", "class-1-level", "class-2-level", "class-3-level"], function(values) { var class0 = parseInt(values["class-0-level"]) || 0; @@ -392,7 +392,7 @@ var class2 = parseInt(values["class-2-level"]) || 0; var class3 = parseInt(values["class-3-level"]) || 0; var total = class0 + class1 + class2 + class3; - + setAttrs({ "class-0-level": class0, "class-1-level": class1, @@ -402,7 +402,7 @@ }); }); }); - + on("change:hp-temp", function() { getAttrs(["hp-temp", "total-hp", "level", "con-mod"], function(values) { var tempHP = parseInt(values["hp-temp"]) || 0; @@ -411,7 +411,7 @@ }); }); }); - + on("change:mp-temp", function() { getAttrs(["mp-temp", "total-mp", "total-bonusmp"], function(values) { var tempMP = parseInt(values["hp-temp"]) || 0; @@ -420,7 +420,7 @@ }); }); }); - + on("change:total-hp change:con-mod change:hp change:hp_max change:lb-uses change:lb-uses_max change:lb-threshold", function() { getAttrs(["hp", "hp_max", "hp-temp", "lb-uses", "lb-uses_max", "lb-threshold"], function(values) { var hp = parseInt(values["hp"]) || 0; @@ -428,7 +428,7 @@ var lb = parseInt(values["lb-uses"]) || 0; var lb_max = parseInt(values["lb-uses_max"]) || 0; var lb_threshold = (parseInt(values["lb-threshold"]) || 0) / 100; - + if ((hp <= Math.floor(hp_max * lb_threshold)) && (lb < lb_max)) { setAttrs({ "lb-style": "active", @@ -449,7 +449,7 @@ } }); }); - + var bonusMP = [ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1, 1], @@ -470,8 +470,8 @@ [0, 4, 12, 24, 40, 55, 73, 94, 118, 136], [0, 5, 13, 25, 41, 61, 79, 100, 124, 151] ]; - - + + on("change:is-undead change:con-mod change:cha-mod change:total-fort change:fort-enhance change:fort-misc change:fort-temp", function() { getAttrs(["is-undead", "cha-mod", "con-mod", "total-fort", "fort-enhance", "fort-misc", "fort-temp", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -490,7 +490,7 @@ } }); }); - + on("change:dex-mod change:total-ref change:ref-enhance change:ref-misc change:ref-temp", function() { getAttrs(["dex-mod", "total-ref", "ref-enhance", "ref-misc", "ref-temp", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -507,7 +507,7 @@ } }); }); - + on("change:wis-mod change:total-will change:will-enhance change:will-misc change:will-temp", function() { getAttrs(["wis-mod", "total-will", "will-enhance", "will-misc", "will-temp", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -524,7 +524,7 @@ } }); }); - + on("change:size", function() { getAttrs(["size"], function(values) { if (values["size"] == "Fine") { @@ -584,7 +584,7 @@ } }); }); - + on("change:melee-other change:str-mod change:dex-mod change:con-mod change:wis-mod change:int-mod change:cha-mod", function() { getAttrs(["melee-other", "str-mod", "dex-mod", "con-mod", "wis-mod", "int-mod", "cha-mod"], function(values) { if (values["melee-other"] == "STR") { @@ -602,7 +602,7 @@ } }); }); - + on("change:ranged-other change:str-mod change:dex-mod change:con-mod change:wis-mod change:int-mod change:cha-mod", function() { getAttrs(["ranged-other", "str-mod", "dex-mod", "con-mod", "wis-mod", "int-mod", "cha-mod"], function(values) { if (values["ranged-other"] == "STR") { @@ -620,7 +620,7 @@ } }); }); - + on("change:cmb-other change:str-mod change:dex-mod change:con-mod change:wis-mod change:int-mod change:cha-mod", function() { getAttrs(["cmb-other", "str-mod", "dex-mod", "con-mod", "wis-mod", "int-mod", "cha-mod"], function(values) { if (values["cmb-other"] == "STR") { @@ -638,7 +638,7 @@ } }); }); - + on("change:total-bab change:melee-ability change:size-mod-atk change:melee-misc change:melee-temp", function() { getAttrs(["total-bab", "melee-ability", "size-mod-atk", "melee-misc", "melee-temp"], function(values) { var misc = parseInt(values["melee-misc"]) || 0; @@ -651,7 +651,7 @@ }); }); }); - + on("change:total-bab change:ranged-ability change:size-mod-atk change:ranged-misc change:ranged-temp", function() { getAttrs(["total-bab", "ranged-ability", "size-mod-atk", "ranged-misc", "ranged-temp"], function(values) { var misc = parseInt(values["ranged-misc"]) || 0; @@ -664,7 +664,7 @@ }); }); }); - + on("change:total-bab change:cmb-ability change:size-mod change:cmb-misc change:cmb-temp", function() { getAttrs(["total-bab", "cmb-ability", "size-mod", "cmb-misc", "cmb-temp", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -679,25 +679,25 @@ } }); }); - + on("change:total-bab change:cmd-ability change:size-mod change:cmd-misc change:cmd-temp change:ac-deflection-worn change:ac-deflection-bonus change:ac-dodge-bonus", function() { getAttrs(["total-bab", "cmd-ability", "cmd-other", "size-mod", "cmd-misc", "cmd-temp", "ac-deflection-worn", "ac-deflection-bonus", "ac-dodge-bonus", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { var misc = parseInt(values["cmd-misc"]) || 0; var temp = parseInt(values["cmd-temp"]) || 0; var deflect; - + if (values["ac-deflection-worn"] == "worn") { - deflect = parseInt(values["ac-deflection-bonus"]) || 0; + deflect = parseInt(values["ac-deflection-bonus"]) || 0; } else { - deflect = 0; + deflect = 0; } var dodge = parseInt(values["ac-dodge-bonus"]) || 0; var other = 10 + deflect + dodge; var total = parseInt(values["total-bab"]) + parseInt(values["cmd-ability"]) + parseInt(values["size-mod"]) + other + misc + temp; setAttrs({ - "cmd-other": other, + "cmd-other": other, "cmd-misc": misc, "cmd-temp": temp, "cmd-total": total @@ -705,7 +705,7 @@ } }); }); - + on("change:dex-mod change:init-misc", function() { getAttrs(["dex-mod", "init-misc", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -717,13 +717,13 @@ } }); }); - + on("change:str-mod change:dex-mod change:total-bab change:size-mod change:cmd-misc change:cmd-temp", function() { getAttrs(["str-mod", "dex-mod", "total-bab", "size-mod", "wis-mod", "cmd-misc", "cmd-temp"], function(values) { setAttrs({"cmd-ability": parseInt(values["str-mod"]) + parseInt(values["dex-mod"])}); }); }); - + var xpReq = [ [0, 0, 0], [3000, 2000, 1300], @@ -746,14 +746,14 @@ [3850000, 2550000, 1700000], [5350000, 3600000, 2400000], ]; - + on("change:xp-rate change:level change:options-extra-lb change:options-extra-lb-amount", function() { getAttrs(["xp-rate", "level", "options-extra-lb", "options-extra-lb-amount"], function(values) { var level = parseInt(values["level"]) || 0; var xp; var lbUsesMax; var extraLbAmount; - + if (values["xp-rate"] == "Slow") { xp = xpReq[level][0]; } else if (values["xp-rate"] == "Medium") { @@ -763,7 +763,7 @@ } else { return; } - + switch (true) { case (level < 5): lbUsesMax = 1; @@ -781,12 +781,12 @@ lbUsesMax = 0; break; } - + if (values["options-extra-lb"] == "true") { extraLbAmount = parseInt(values["options-extra-lb-amount"]) || 0; lbUsesMax += extraLbAmount; } else extraLbAmount = 0; - + setAttrs({ "xp_max": xp, "lb-uses_max": lbUsesMax, @@ -794,14 +794,14 @@ }); }); }); - + on("change:repeating_weapons:weapon-weight remove:repeating_weapons", function (e) { getSectionIDs("repeating_weapons", function (idarr) { if (idarr.length == 0) { setAttrs({"weapon-weight-total": 0 }); return; } - + var totalWeight = 0; var weightTally = _.after(idarr.length, function () { totalWeight = parseFloat(totalWeight.toFixed(2)); @@ -815,7 +815,7 @@ } }); }); - + function computeAttackBonus(id) { getAttrs(["repeating_weapons_" + id + "_weapon-attack-modifier", "total-bab", "size-mod-atk", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod"], function (values) { var attackModifier = values[Object.keys(values)[0]]; @@ -835,8 +835,8 @@ setAttrs(attrs); }); } - - + + on("change:repeating_weapons:weapon-attack-modifier", function() { getAttrs(["repeating_weapons_weapon-attack-modifier", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "size-mod-atk", "total-bab"], function(values) { var attackModifier = values[Object.keys(values)[0]]; @@ -854,8 +854,8 @@ setAttrs({"repeating_weapons_weapon-attack-bonus": attackBonus}); }); }); - - + + on("change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod change:total-bab change:size-mod-atk", function() { getSectionIDs("repeating_weapons", function (idarr) { idarr.forEach(function(id) { @@ -863,11 +863,11 @@ }); }); }); - + on("change:total-mp change:int-mod change:wis-mod change:cha-mod change:class-0-clevel change:class-1-clevel change:class-2-clevel change:class-3-clevel change:class-0-bonusmp change:class-1-bonusmp change:class-2-bonusmp change:class-3-bonusmp", function() { getAttrs(["int-mod", "wis-mod", "cha-mod", "total-mp", "class-0-clevel", "class-1-clevel", "class-2-clevel", "class-3-clevel", "class-0-bonusmp", "class-1-bonusmp", "class-2-bonusmp", "class-3-bonusmp", "mp-temp", "mp-lost"], function(values) { var bonusMP0, bonusMP1, bonusMP2, bonusMP3, bonusMP4; - + if (values["class-0-bonusmp"] == 0) { bonusMP0 = 0; } else if (values["class-0-bonusmp"] == "INT") { @@ -877,7 +877,7 @@ } else { bonusMP0 = values["cha-mod"]; } - + if (values["class-1-bonusmp"] == 0) { bonusMP1 = 0; } else if (values["class-1-bonusmp"] == "INT") { @@ -887,7 +887,7 @@ } else { bonusMP1 = values["cha-mod"]; } - + if (values["class-2-bonusmp"] == 0) { bonusMP2 = 0; } else if (values["class-2-bonusmp"] == "INT") { @@ -897,7 +897,7 @@ } else { bonusMP2 = values["cha-mod"]; } - + if (values["class-3-bonusmp"] == 0) { bonusMP3 = 0; } else if (values["class-3-bonusmp"] == "INT") { @@ -907,13 +907,13 @@ } else { bonusMP3 = values["cha-mod"]; } - + var class0 = parseInt(values["class-0-clevel"]) || 0; var class1 = parseInt(values["class-1-clevel"]) || 0; var class2 = parseInt(values["class-2-clevel"]) || 0; var class3 = parseInt(values["class-3-clevel"]) || 0; var tableMP = bonusMP[bonusMP0][class0] + bonusMP[bonusMP1][class1] + bonusMP[bonusMP2][class2] + bonusMP[bonusMP3][class3]; - + setAttrs({ "class-0-clevel": class0, "class-1-clevel": class1, @@ -925,7 +925,7 @@ }); }); }); - + on("change:ac-armor-worn change:ac-shield-worn change:ac-natural-worn change:ac-deflection-worn change:ac-armor-bonus change:ac-shield-bonus change:ac-natural-bonus \ change:ac-deflection-bonus change:ac-dodge-bonus change:ac-misc-bonus change:ac-armor-penalty change:ac-shield-penalty change:ac-armor-sf change:ac-shield-sf change:ac-armor-weight \ change:ac-shield-weight change:ac-natural-weight change:ac-deflection-weight change:ac-armor-maxdex change:ac-shield-maxdex change:dex-mod", function() { @@ -938,7 +938,7 @@ var acDeflectionBonus = 0, acDeflectionWeight = 0; var acDodgeBonus = parseInt(values["ac-dodge-bonus"]) || 0; var acMiscBonus = parseInt(values["ac-misc-bonus"]) || 0; - + if (values["ac-armor-worn"] == "worn") { acArmorBonus = parseInt(values["ac-armor-bonus"]) || 0; acArmorACP = parseInt(values["ac-armor-penalty"]) || 0; @@ -946,7 +946,7 @@ acArmorWeight = parseFloat(values["ac-armor-weight"]) || 0; acArmorMaxDEX = parseInt(values["ac-armor-maxdex"]) || 0; } - + if (values["ac-shield-worn"] == "worn") { acShieldBonus = parseInt(values["ac-shield-bonus"]) || 0; acShieldACP = parseInt(values["ac-shield-penalty"]) || 0; @@ -954,19 +954,19 @@ acShieldWeight = parseFloat(values["ac-shield-weight"]) || 0; acShieldMaxDEX = parseInt(values["ac-shield-maxdex"]) || 0; } - + if (values["ac-natural-worn"] == "worn") { acNaturalBonus = parseInt(values["ac-natural-bonus"]) || 0; acNaturalWeight = parseFloat(values["ac-natural-weight"]) || 0; } - + if (values["ac-deflection-worn"] == "worn") { acDeflectionBonus = parseInt(values["ac-deflection-bonus"]) || 0; acDeflectionWeight = parseFloat(values["ac-deflection-weight"]) || 0; } - + var totalWeight = parseFloat((acArmorWeight + acShieldWeight + acNaturalWeight + acDeflectionWeight).toFixed(2)); - + setAttrs({ "ac-armor": acArmorBonus, "ac-shield": acShieldBonus, @@ -993,7 +993,7 @@ "ac-total-sf": (acArmorSF + acShieldSF), "ac-weight-total": totalWeight }); - + if ((values["ac-armor-worn"] == "worn") && (values["ac-shield-worn"] == "worn")) { var maxdex = Math.min(parseInt(values["ac-armor-maxdex"]), parseInt(values["ac-shield-maxdex"])); setAttrs({ @@ -1020,7 +1020,7 @@ } }); }); - + on("change:equip-head-weight change:equip-headband-weight change:equip-eyes-weight change:equip-shoulders-weight change:equip-neck-weight change:equip-chest-weight \ change:equip-body-weight change:equip-belt-weight change:equip-wrists-weight change:equip-hands-weight change:equip-ring1-weight change:equip-ring2-weight change:equip-feet-weight", function(eventInfo) { getAttrs(["equip-head-weight", "equip-headband-weight", "equip-eyes-weight", "equip-shoulders-weight", "equip-neck-weight", "equip-chest-weight", "equip-body-weight", @@ -1039,7 +1039,7 @@ var ring2Weight = parseFloat(values["equip-ring2-weight"]) || 0; var feetWeight = parseFloat(values["equip-feet-weight"]) || 0; var total = parseFloat((headWeight + headbandWeight + eyesWeight + shouldersWeight + neckWeight + chestWeight + bodyWeight + beltWeight + wristsWeight + handsWeight + ring1Weight + ring2Weight + feetWeight).toFixed(2)); - + setAttrs({ "equip-weight-total": total, "equip-head-weight": headWeight, @@ -1058,7 +1058,7 @@ }); }); }); - + on("change:ac-dex change:size-mod-atk change:ac-armor change:ac-shield change:ac-natural change:ac-deflection change:ac-dodge-bonus change:ac-misc-bonus change:ac-temp change:ac-touch-temp change:ac-flatfooted-temp change:uncanny-dodge", function(eventInfo) { getAttrs(["ac-dex", "size-mod-atk", "ac-armor", "ac-shield", "ac-natural", "ac-deflection", "ac-dodge-bonus", "ac-misc-bonus", "ac-temp", "ac-touch-temp", "ac-flatfooted-temp", "uncanny-dodge", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1067,7 +1067,7 @@ var acFlatFootedTemp = parseInt(values["ac-flatfooted-temp"]) || 0; var acDodgeBonus = parseInt(values["ac-dodge-bonus"]) || 0; var acMiscBonus = parseInt(values["ac-misc-bonus"]) || 0; - + if (values["uncanny-dodge"] == "checked") { setAttrs({ "ac-temp": acTemp, @@ -1107,10 +1107,10 @@ } }); }); - + on("change:weapon-weight-total change:ac-weight-total change:load-bonus change:equip-weight-total change:inventory-weight-total change:misc-weight change:str change:size", function(e) { getAttrs(["weapon-weight-total", "ac-weight-total", "load-bonus", "equip-weight-total", "inventory-weight-total", "misc-weight", "str", "size"], function(values) { - + var loadBonus = parseFloat(values["load-bonus"]) || 0; var weaponWeight = parseFloat(values["weapon-weight-total"]) || 0; var acWeight = parseFloat(values["ac-weight-total"]) || 0; @@ -1124,7 +1124,7 @@ var maxHeavyLoad = 0; var sizeMultiplier = 1; console.log(str,loadBonus); - + switch(values["size"]) { case "Fine": sizeMultiplier = 1 / 8; @@ -1153,21 +1153,21 @@ default: sizeMultiplier = 1; } - + if (str <= 10) { maxHeavyLoad = sizeMultiplier * (str * 10); } else { maxHeavyLoad = Math.floor(sizeMultiplier * (baseLookup[base] * Math.pow(4, Math.floor(str / 10)))); } - + var maxMediumLoad = Math.floor(maxHeavyLoad * (2/3)); var maxLightLoad = Math.floor(maxHeavyLoad * (1/3)); var maxLift = maxHeavyLoad * 2; var maxPushDrag = maxHeavyLoad * 5; var currentLoad = ""; - + if (totalWeight <= maxLightLoad) { currentLoad = "Light"; } else if (totalWeight <= maxMediumLoad && totalWeight > maxLightLoad) { currentLoad = "Medium"; } else if (totalWeight <= maxHeavyLoad && totalWeight > maxMediumLoad) { currentLoad = "Heavy"; } else { currentLoad = "Overburdened"; } - + setAttrs({ "weight-total": totalWeight, "misc-weight": miscWeight, @@ -1182,14 +1182,14 @@ }); }); }); - + on("change:repeating_inventory:inventory-item-weight remove:repeating_inventory", function (e) { getSectionIDs("repeating_inventory", function (idarr) { if (idarr.length == 0) { setAttrs({ "inventory-weight-total": 0 }); return; } - + var totalWeight = 0; var weightTally = _.after(idarr.length, function () { totalWeight = parseFloat(totalWeight.toFixed(2)); @@ -1203,7 +1203,7 @@ } }); }); - + on("change:repeating_materia:materia-type", function(eventInfo) { getAttrs([eventInfo.sourceAttribute], function(values) { if (values[eventInfo.sourceAttribute] == "Type") { @@ -1221,12 +1221,12 @@ } }); }); - + on("change:repeating_materia:materia-rarity change:repeating_materia:materia-mxp", function() { getAttrs(["repeating_materia_materia-rarity", "repeating_materia_materia-mxp"], function(values) { var level = "????"; var mxp = parseInt(values["repeating_materia_materia-mxp"]) || 0, mxpmax = 0; - + if (values["repeating_materia_materia-rarity"] == "Common") { if ((mxp >= 0) && (mxp < 500)) { level = "★✰✰✰"; @@ -1299,7 +1299,7 @@ level = "✰✰✰✰"; mxpmax = "---"; } - + setAttrs({ "repeating_materia_materia-level": level, "repeating_materia_materia-mxp_max": mxpmax, @@ -1307,12 +1307,12 @@ }); }); }); - + on("change:repeating_materia:materia-attuned", function(eventInfo) { getAttrs(["options-materia-attunement"], function(values) { if (values["options-materia-attunement"] != "true") { var id = eventInfo.sourceAttribute; - + getAttrs([eventInfo.sourceAttribute], function(values) { if (values[eventInfo.sourceAttribute] == "attuned") { getSectionIDs("repeating_materia", function (idarr) { @@ -1327,7 +1327,7 @@ } }); }); - + on("change:acrobatics-ranks change:appraise-ranks change:bluff-ranks change:climb-ranks change:craft1-ranks change:craft2-ranks change:craft3-ranks \ change:diplomacy-ranks change:disabledevice-ranks change:disguise-ranks change:drive-ranks change:escapeartist-ranks change:fly-ranks change:handleanimal-ranks \ change:heal-ranks change:intimidate-ranks change:knowarcana-ranks change:knowdungeon-ranks change:knowengineer-ranks change:knowgeography-ranks \ @@ -1355,11 +1355,11 @@ (parseInt(values["repair-ranks"]) || 0) + (parseInt(values["ride-ranks"]) || 0) + (parseInt(values["sensemotive-ranks"]) || 0) + (parseInt(values["sleightofhand-ranks"]) || 0) + (parseInt(values["spellcraft-ranks"]) || 0) + (parseInt(values["stealth-ranks"]) || 0) + (parseInt(values["survival-ranks"]) || 0) + (parseInt(values["swim-ranks"]) || 0) + (parseInt(values["usemagicdevice-ranks"]) || 0); - + setAttrs({"total-ranks": totalRanks}); }); }); - + on("change:acrobatics-ability change:acrobatics-cs change:acrobatics-ranks change:acrobatics-misc change:acrobatics-acp change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod change:ac-total-penalty", function() { getAttrs(["acrobatics-cs", "acrobatics-ability", "acrobatics-ranks", "acrobatics-misc", "acrobatics-acp", "ac-total-penalty", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1367,26 +1367,26 @@ var misc = parseInt(values["acrobatics-misc"]) || 0; var mod = parseInt(values[values["acrobatics-ability"]]) || 0; var total = 0, totalBonus = 0; - + if (values["acrobatics-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + if (values["acrobatics-acp"] == "acp") { total = total + parseInt(values["ac-total-penalty"]); totalBonus = totalBonus + parseInt(values["ac-total-penalty"]); } - + setAttrs({ "acrobatics-mod": mod, "acrobatics-total": total, "acrobatics-ranks": ranks, "acrobatics-misc": misc }); - + if (totalBonus > 0) { setAttrs({"acrobatics-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1397,7 +1397,7 @@ } }); }); - + on("change:appraise-ability change:appraise-cs change:appraise-ranks change:appraise-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["appraise-cs", "appraise-ranks", "appraise-ability", "appraise-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1405,21 +1405,21 @@ var misc = parseInt(values["appraise-misc"]) || 0; var mod = parseInt(values[values["appraise-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["appraise-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "appraise-mod":mod, "appraise-total": total, "appraise-ranks": ranks, "appraise-misc": misc }); - + if (totalBonus > 0) { setAttrs({"appraise-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1430,7 +1430,7 @@ } }); }); - + on("change:bluff-ability change:bluff-cs change:bluff-ranks change:bluff-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["bluff-cs", "bluff-ranks", "bluff-ability", "bluff-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1438,21 +1438,21 @@ var misc = parseInt(values["bluff-misc"]) || 0; var mod = parseInt(values[values["bluff-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["bluff-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "bluff-mod":mod, "bluff-total": total, "bluff-ranks": ranks, "bluff-misc": misc }); - + if (totalBonus > 0) { setAttrs({"bluff-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1463,7 +1463,7 @@ } }); }); - + on("change:climb-ability change:climb-cs change:climb-ranks change:climb-misc change:climb-acp change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod change:ac-total-penalty", function() { getAttrs(["climb-cs", "climb-ranks", "climb-ability", "climb-misc", "climb-acp", "ac-total-penalty", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1471,26 +1471,26 @@ var misc = parseInt(values["climb-misc"]) || 0; var mod = parseInt(values[values["climb-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["climb-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + if (values["climb-acp"] == "acp") { total = total + parseInt(values["ac-total-penalty"]); totalBonus = totalBonus + parseInt(values["ac-total-penalty"]); } - + setAttrs({ "climb-mod":mod, "climb-total": total, "climb-ranks": ranks, "climb-misc": misc }); - + if (totalBonus > 0) { setAttrs({"climb-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1501,7 +1501,7 @@ } }); }); - + on("change:craft1-ability change:craft1-cs change:craft1-ranks change:craft1-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["craft1-cs", "craft1-ranks", "craft1-ability", "craft1-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1509,21 +1509,21 @@ var misc = parseInt(values["craft1-misc"]) || 0; var mod = parseInt(values[values["craft1-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["craft1-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "craft1-mod":mod, "craft1-total": total, "craft1-ranks": ranks, "craft1-misc": misc }); - + if (totalBonus > 0) { setAttrs({"craft1-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1534,7 +1534,7 @@ } }); }); - + on("change:craft2-ability change:craft2-cs change:craft2-ranks change:craft2-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["craft2-cs", "craft2-ranks", "craft2-ability", "craft2-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1542,22 +1542,22 @@ var misc = parseInt(values["craft2-misc"]) || 0; var mod = parseInt(values[values["craft2-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["craft2-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - - + + setAttrs({ "craft2-mod":mod, "craft2-total": total, "craft2-ranks": ranks, "craft2-misc": misc }); - + if (totalBonus > 0) { setAttrs({"craft2-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1568,7 +1568,7 @@ } }); }); - + on("change:craft3-ability change:craft3-cs change:craft3-ranks change:craft3-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["craft3-cs", "craft3-ranks", "craft3-ability", "craft3-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1576,21 +1576,21 @@ var misc = parseInt(values["craft3-misc"]) || 0; var mod = parseInt(values[values["craft3-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["craft3-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "craft3-mod":mod, "craft3-total": total, "craft3-ranks": ranks, "craft3-misc": misc }); - + if (totalBonus > 0) { setAttrs({"craft3-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1601,7 +1601,7 @@ } }); }); - + on("change:diplomacy-ability change:diplomacy-cs change:diplomacy-ranks change:diplomacy-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["diplomacy-cs", "diplomacy-ranks", "diplomacy-ability", "diplomacy-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1609,21 +1609,21 @@ var misc = parseInt(values["diplomacy-misc"]) || 0; var mod = parseInt(values[values["diplomacy-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["diplomacy-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "diplomacy-mod":mod, "diplomacy-total": total, "diplomacy-ranks": ranks, "diplomacy-misc": misc }); - + if (totalBonus > 0) { setAttrs({"diplomacy-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1634,7 +1634,7 @@ } }); }); - + on("change:disabledevice-ability change:disabledevice-cs change:disabledevice-ranks change:disabledevice-misc change:disabledevice-acp change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod change:ac-total-penalty", function() { getAttrs(["disabledevice-cs", "disabledevice-ranks", "disabledevice-ability", "disabledevice-misc", "disabledevice-acp", "ac-total-penalty", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1642,26 +1642,26 @@ var misc = parseInt(values["disabledevice-misc"]) || 0; var mod = parseInt(values[values["disabledevice-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["disabledevice-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + if (values["disabledevice-acp"] == "acp") { total = total + parseInt(values["ac-total-penalty"]); totalBonus = totalBonus + parseInt(values["ac-total-penalty"]); } - + setAttrs({ "disabledevice-mod":mod, "disabledevice-total": total, "disabledevice-ranks": ranks, "disabledevice-misc": misc }); - + if (totalBonus > 0) { setAttrs({"disabledevice-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1672,7 +1672,7 @@ } }); }); - + on("change:disguise-ability change:disguise-cs change:disguise-ranks change:disguise-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["disguise-cs", "disguise-ranks", "disguise-ability", "disguise-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1680,21 +1680,21 @@ var misc = parseInt(values["disguise-misc"]) || 0; var mod = parseInt(values[values["disguise-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["disguise-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "disguise-mod":mod, "disguise-total": total, "disguise-ranks": ranks, "disguise-misc": misc }); - + if (totalBonus > 0) { setAttrs({"disguise-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1705,7 +1705,7 @@ } }); }); - + on("change:drive-ability change:drive-cs change:drive-ranks change:drive-misc change:drive-acp change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod change:ac-total-penalty", function() { getAttrs(["drive-cs", "drive-ranks", "drive-ability", "drive-misc", "drive-acp", "ac-total-penalty", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1713,26 +1713,26 @@ var misc = parseInt(values["drive-misc"]) || 0; var mod = parseInt(values[values["drive-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["drive-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + if (values["drive-acp"] == "acp") { total = total + parseInt(values["ac-total-penalty"]); totalBonus = totalBonus + parseInt(values["ac-total-penalty"]); } - + setAttrs({ "drive-mod":mod, "drive-total": total, "drive-ranks": ranks, "drive-misc": misc }); - + if (totalBonus > 0) { setAttrs({"drive-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1743,7 +1743,7 @@ } }); }); - + on("change:escapeartist-ability change:escapeartist-cs change:escapeartist-ranks change:escapeartist-misc change:escapeartist-acp change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod change:ac-total-penalty", function() { getAttrs(["escapeartist-cs", "escapeartist-ranks", "escapeartist-ability", "escapeartist-misc", "escapeartist-acp", "ac-total-penalty", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1751,26 +1751,26 @@ var misc = parseInt(values["escapeartist-misc"]) || 0; var mod = parseInt(values[values["escapeartist-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["escapeartist-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + if (values["escapeartist-acp"] == "acp") { total = total + parseInt(values["ac-total-penalty"]); totalBonus = totalBonus + parseInt(values["ac-total-penalty"]); } - + setAttrs({ "escapeartist-mod":mod, "escapeartist-total": total, "escapeartist-ranks": ranks, "escapeartist-misc": misc }); - + if (totalBonus > 0) { setAttrs({"escapeartist-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1781,7 +1781,7 @@ } }); }); - + on("change:fly-ability change:fly-cs change:fly-ranks change:fly-misc change:fly-acp change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod change:ac-total-penalty change:size-mod-skill", function() { getAttrs(["fly-cs", "fly-ranks", "fly-ability", "fly-misc", "fly-acp", "ac-total-penalty", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type","size-mod-skill"], function(values) { if (values["sheet-type"] == "character") { @@ -1790,25 +1790,25 @@ var mod = parseInt(values[values["fly-ability"]]) || 0; var size = parseInt(values["size-mod-skill"]) || 0; var total = 0, totalBonus = size * 2; - + if (values["fly-cs"] == "trained" && ranks >= 1) { - totalBonus += 3 - } - + totalBonus += 3 + } + total = totalBonus + ranks + misc + mod; - + if (values["fly-acp"] == "acp") { total = total + parseInt(values["ac-total-penalty"]); totalBonus = totalBonus + parseInt(values["ac-total-penalty"]); } - + setAttrs({ "fly-mod": mod, "fly-total": total, "fly-ranks": ranks, "fly-misc": misc }); - + if (totalBonus > 0) { setAttrs({"fly-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1819,7 +1819,7 @@ } }); }); - + on("change:handleanimal-ability change:handleanimal-cs change:handleanimal-ranks change:handleanimal-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["handleanimal-cs", "handleanimal-ranks", "handleanimal-ability", "handleanimal-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1827,21 +1827,21 @@ var misc = parseInt(values["handleanimal-misc"]) || 0; var mod = parseInt(values[values["handleanimal-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["handleanimal-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "handleanimal-mod":mod, "handleanimal-total": total, "handleanimal-ranks": ranks, "handleanimal-misc": misc }); - + if (totalBonus > 0) { setAttrs({"handleanimal-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1852,7 +1852,7 @@ } }); }); - + on("change:heal-ability change:heal-cs change:heal-ranks change:heal-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["heal-cs", "heal-ranks", "heal-ability", "heal-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1860,21 +1860,21 @@ var misc = parseInt(values["heal-misc"]) || 0; var mod = parseInt(values[values["heal-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["heal-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "heal-mod":mod, "heal-total": total, "heal-ranks": ranks, "heal-misc": misc }); - + if (totalBonus > 0) { setAttrs({"heal-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1885,7 +1885,7 @@ } }); }); - + on("change:intimidate-ability change:intimidate-cs change:intimidate-ranks change:intimidate-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["intimidate-cs", "intimidate-ranks", "intimidate-ability", "intimidate-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1893,21 +1893,21 @@ var misc = parseInt(values["intimidate-misc"]) || 0; var mod = parseInt(values[values["intimidate-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["intimidate-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "intimidate-mod":mod, "intimidate-total": total, "intimidate-ranks": ranks, "intimidate-misc": misc }); - + if (totalBonus > 0) { setAttrs({"intimidate-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1918,7 +1918,7 @@ } }); }); - + on("change:knowarcana-ability change:knowarcana-cs change:knowarcana-ranks change:knowarcana-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["knowarcana-cs", "knowarcana-ranks", "knowarcana-ability", "knowarcana-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1926,21 +1926,21 @@ var misc = parseInt(values["knowarcana-misc"]) || 0; var mod = parseInt(values[values["knowarcana-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["knowarcana-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "knowarcana-mod":mod, "knowarcana-total": total, "knowarcana-ranks": ranks, "knowarcana-misc": misc }); - + if (totalBonus > 0) { setAttrs({"knowarcana-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1951,7 +1951,7 @@ } }); }); - + on("change:knowdungeon-ability change:knowdungeon-cs change:knowdungeon-ranks change:knowdungeon-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["knowdungeon-cs", "knowdungeon-ranks", "knowdungeon-ability", "knowdungeon-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1959,21 +1959,21 @@ var misc = parseInt(values["knowdungeon-misc"]) || 0; var mod = parseInt(values[values["knowdungeon-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["knowdungeon-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "knowdungeon-mod":mod, "knowdungeon-total": total, "knowdungeon-ranks": ranks, "knowdungeon-misc": misc }); - + if (totalBonus > 0) { setAttrs({"knowdungeon-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -1984,7 +1984,7 @@ } }); }); - + on("change:knowengineer-ability change:knowengineer-cs change:knowengineer-ranks change:knowengineer-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["knowengineer-cs", "knowengineer-ranks", "knowengineer-ability", "knowengineer-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -1992,21 +1992,21 @@ var misc = parseInt(values["knowengineer-misc"]) || 0; var mod = parseInt(values[values["knowengineer-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["knowengineer-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "knowengineer-mod":mod, "knowengineer-total": total, "knowengineer-ranks": ranks, "knowengineer-misc": misc }); - + if (totalBonus > 0) { setAttrs({"knowengineer-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2017,7 +2017,7 @@ } }); }); - + on("change:knowgeography-ability change:knowgeography-cs change:knowgeography-ranks change:knowgeography-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["knowgeography-cs", "knowgeography-ranks", "knowgeography-ability", "knowgeography-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2025,21 +2025,21 @@ var misc = parseInt(values["knowgeography-misc"]) || 0; var mod = parseInt(values[values["knowgeography-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["knowgeography-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "knowgeography-mod":mod, "knowgeography-total": total, "knowgeography-ranks": ranks, "knowgeography-misc": misc }); - + if (totalBonus > 0) { setAttrs({"knowgeography-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2050,7 +2050,7 @@ } }); }); - + on("change:knowhistory-ability change:knowhistory-cs change:knowhistory-ranks change:knowhistory-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["knowhistory-cs", "knowhistory-ranks", "knowhistory-ability", "knowhistory-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2058,21 +2058,21 @@ var misc = parseInt(values["knowhistory-misc"]) || 0; var mod = parseInt(values[values["knowhistory-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["knowhistory-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "knowhistory-mod":mod, "knowhistory-total": total, "knowhistory-ranks": ranks, "knowhistory-misc": misc }); - + if (totalBonus > 0) { setAttrs({"knowhistory-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2083,7 +2083,7 @@ } }); }); - + on("change:knowlocal-ability change:knowlocal-cs change:knowlocal-ranks change:knowlocal-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["knowlocal-cs", "knowlocal-ranks", "knowlocal-ability", "knowlocal-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2091,21 +2091,21 @@ var misc = parseInt(values["knowlocal-misc"]) || 0; var mod = parseInt(values[values["knowlocal-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["knowlocal-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "knowlocal-mod":mod, "knowlocal-total": total, "knowlocal-ranks": ranks, "knowlocal-misc": misc }); - + if (totalBonus > 0) { setAttrs({"knowlocal-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2116,7 +2116,7 @@ } }); }); - + on("change:knownature-ability change:knownature-cs change:knownature-ranks change:knownature-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["knownature-cs", "knownature-ranks", "knownature-ability", "knownature-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2124,21 +2124,21 @@ var misc = parseInt(values["knownature-misc"]) || 0; var mod = parseInt(values[values["knownature-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["knownature-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "knownature-mod":mod, "knownature-total": total, "knownature-ranks": ranks, "knownature-misc": misc }); - + if (totalBonus > 0) { setAttrs({"knownature-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2149,7 +2149,7 @@ } }); }); - + on("change:knownobility-ability change:knownobility-cs change:knownobility-ranks change:knownobility-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["knownobility-cs", "knownobility-ranks", "knownobility-ability", "knownobility-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2157,21 +2157,21 @@ var misc = parseInt(values["knownobility-misc"]) || 0; var mod = parseInt(values[values["knownobility-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["knownobility-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "knownobility-mod":mod, "knownobility-total": total, "knownobility-ranks": ranks, "knownobility-misc": misc }); - + if (totalBonus > 0) { setAttrs({"knownobility-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2182,7 +2182,7 @@ } }); }); - + on("change:knowplanes-ability change:knowplanes-cs change:knowplanes-ranks change:knowplanes-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["knowplanes-cs", "knowplanes-ranks", "knowplanes-ability", "knowplanes-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2190,21 +2190,21 @@ var misc = parseInt(values["knowplanes-misc"]) || 0; var mod = parseInt(values[values["knowplanes-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["knowplanes-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "knowplanes-mod":mod, "knowplanes-total": total, "knowplanes-ranks": ranks, "knowplanes-misc": misc }); - + if (totalBonus > 0) { setAttrs({"knowplanes-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2215,7 +2215,7 @@ } }); }); - + on("change:knowreligion-ability change:knowreligion-cs change:knowreligion-ranks change:knowreligion-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["knowreligion-cs", "knowreligion-ranks", "knowreligion-ability", "knowreligion-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2223,21 +2223,21 @@ var misc = parseInt(values["knowreligion-misc"]) || 0; var mod = parseInt(values[values["knowreligion-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["knowreligion-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "knowreligion-mod":mod, "knowreligion-total": total, "knowreligion-ranks": ranks, "knowreligion-misc": misc }); - + if (totalBonus > 0) { setAttrs({"knowreligion-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2248,7 +2248,7 @@ } }); }); - + on("change:knowtechnology-ability change:knowtechnology-cs change:knowtechnology-ranks change:knowtechnology-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["knowtechnology-cs", "knowtechnology-ranks", "knowtechnology-ability", "knowtechnology-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2256,21 +2256,21 @@ var misc = parseInt(values["knowtechnology-misc"]) || 0; var mod = parseInt(values[values["knowtechnology-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["knowtechnology-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "knowtechnology-mod":mod, "knowtechnology-total": total, "knowtechnology-ranks": ranks, "knowtechnology-misc": misc }); - + if (totalBonus > 0) { setAttrs({"knowtechnology-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2281,7 +2281,7 @@ } }); }); - + on("change:linguistics-ability change:linguistics-cs change:linguistics-ranks change:linguistics-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["linguistics-cs", "linguistics-ranks", "linguistics-ability", "linguistics-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2289,21 +2289,21 @@ var misc = parseInt(values["linguistics-misc"]) || 0; var mod = parseInt(values[values["linguistics-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["linguistics-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "linguistics-mod":mod, "linguistics-total": total, "linguistics-ranks": ranks, "linguistics-misc": misc }); - + if (totalBonus > 0) { setAttrs({"linguistics-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2314,7 +2314,7 @@ } }); }); - + on("change:navigate-ability change:navigate-cs change:navigate-ranks change:navigate-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["navigate-cs", "navigate-ranks", "navigate-ability", "navigate-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2322,21 +2322,21 @@ var misc = parseInt(values["navigate-misc"]) || 0; var mod = parseInt(values[values["navigate-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["navigate-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "navigate-mod":mod, "navigate-total": total, "navigate-ranks": ranks, "navigate-misc": misc }); - + if (totalBonus > 0) { setAttrs({"navigate-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2347,7 +2347,7 @@ } }); }); - + on("change:perception-ability change:perception-cs change:perception-ranks change:perception-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["perception-cs", "perception-ranks", "perception-ability", "perception-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2355,21 +2355,21 @@ var misc = parseInt(values["perception-misc"]) || 0; var mod = parseInt(values[values["perception-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["perception-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "perception-mod":mod, "perception-total": total, "perception-ranks": ranks, "perception-misc": misc }); - + if (totalBonus > 0) { setAttrs({"perception-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2380,7 +2380,7 @@ } }); }); - + on("change:perform1-ability change:perform1-cs change:perform1-ranks change:perform1-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["perform1-cs", "perform1-ranks", "perform1-ability", "perform1-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2388,21 +2388,21 @@ var misc = parseInt(values["perform1-misc"]) || 0; var mod = parseInt(values[values["perform1-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["perform1-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "perform1-mod":mod, "perform1-total": total, "perform1-ranks": ranks, "perform1-misc": misc }); - + if (totalBonus > 0) { setAttrs({"perform1-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2413,7 +2413,7 @@ } }); }); - + on("change:perform2-ability change:perform2-cs change:perform2-ranks change:perform2-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["perform2-cs", "perform2-ranks", "perform2-ability", "perform2-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2421,21 +2421,21 @@ var misc = parseInt(values["perform2-misc"]) || 0; var mod = parseInt(values[values["perform2-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["perform2-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "perform2-mod":mod, "perform2-total": total, "perform2-ranks": ranks, "perform2-misc": misc }); - + if (totalBonus > 0) { setAttrs({"perform2-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2446,7 +2446,7 @@ } }); }); - + on("change:perform3-ability change:perform3-cs change:perform3-ranks change:perform3-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["perform3-cs", "perform3-ranks", "perform3-ability", "perform3-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2454,21 +2454,21 @@ var misc = parseInt(values["perform3-misc"]) || 0; var mod = parseInt(values[values["perform3-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["perform3-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "perform3-mod":mod, "perform3-total": total, "perform3-ranks": ranks, "perform3-misc": misc }); - + if (totalBonus > 0) { setAttrs({"perform3-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2479,7 +2479,7 @@ } }); }); - + on("change:pilot-ability change:pilot-cs change:pilot-ranks change:pilot-misc change:pilot-acp change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod change:ac-total-penalty", function() { getAttrs(["pilot-cs", "pilot-ranks", "pilot-ability", "pilot-misc", "pilot-acp", "ac-total-penalty", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2487,26 +2487,26 @@ var misc = parseInt(values["pilot-misc"]) || 0; var mod = parseInt(values[values["pilot-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["pilot-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + if (values["pilot-acp"] == "acp") { total = total + parseInt(values["ac-total-penalty"]); totalBonus = totalBonus + parseInt(values["ac-total-penalty"]); } - + setAttrs({ "pilot-mod":mod, "pilot-total": total, "pilot-ranks": ranks, "pilot-misc": misc }); - + if (totalBonus > 0) { setAttrs({"pilot-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2517,7 +2517,7 @@ } }); }); - + on("change:prof1-ability change:prof1-cs change:prof1-ranks change:prof1-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["prof1-cs", "prof1-ranks", "prof1-ability", "prof1-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2525,21 +2525,21 @@ var misc = parseInt(values["prof1-misc"]) || 0; var mod = parseInt(values[values["prof1-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["prof1-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "prof1-mod":mod, "prof1-total": total, "prof1-ranks": ranks, "prof1-misc": misc }); - + if (totalBonus > 0) { setAttrs({"prof1-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2550,7 +2550,7 @@ } }); }); - + on("change:prof2-ability change:prof2-cs change:prof2-ranks change:prof2-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["prof2-cs", "prof2-ranks", "prof2-ability", "prof2-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2558,21 +2558,21 @@ var misc = parseInt(values["prof2-misc"]) || 0; var mod = parseInt(values[values["prof2-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["prof2-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "prof2-mod":mod, "prof2-total": total, "prof2-ranks": ranks, "prof2-misc": misc }); - + if (totalBonus > 0) { setAttrs({"prof2-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2583,7 +2583,7 @@ } }); }); - + on("change:prof3-ability change:prof3-cs change:prof3-ranks change:prof3-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["prof3-cs", "prof3-ranks", "prof3-ability", "prof3-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2591,21 +2591,21 @@ var misc = parseInt(values["prof3-misc"]) || 0; var mod = parseInt(values[values["prof3-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["prof3-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "prof3-mod":mod, "prof3-total": total, "prof3-ranks": ranks, "prof3-misc": misc }); - + if (totalBonus > 0) { setAttrs({"prof3-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2616,7 +2616,7 @@ } }); }); - + on("change:repair-ability change:repair-cs change:repair-ranks change:repair-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["repair-cs", "repair-ranks", "repair-ability", "repair-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2624,21 +2624,21 @@ var misc = parseInt(values["repair-misc"]) || 0; var mod = parseInt(values[values["repair-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["repair-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "repair-mod":mod, "repair-total": total, "repair-ranks": ranks, "repair-misc": misc }); - + if (totalBonus > 0) { setAttrs({"repair-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2649,7 +2649,7 @@ } }); }); - + on("change:ride-ability change:ride-cs change:ride-ranks change:ride-misc change:ride-acp change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod change:ac-total-penalty", function() { getAttrs(["ride-cs", "ride-ranks", "ride-ability", "ride-misc", "ride-acp", "ac-total-penalty", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2657,26 +2657,26 @@ var misc = parseInt(values["ride-misc"]) || 0; var mod = parseInt(values[values["ride-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["ride-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + if (values["ride-acp"] == "acp") { total = total + parseInt(values["ac-total-penalty"]); totalBonus = totalBonus + parseInt(values["ac-total-penalty"]); } - + setAttrs({ "ride-mod":mod, "ride-total": total, "ride-ranks": ranks, "ride-misc": misc }); - + if (totalBonus > 0) { setAttrs({"ride-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2687,7 +2687,7 @@ } }); }); - + on("change:sensemotive-ability change:sensemotive-cs change:sensemotive-ranks change:sensemotive-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["sensemotive-cs", "sensemotive-ranks", "sensemotive-ability", "sensemotive-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2695,21 +2695,21 @@ var misc = parseInt(values["sensemotive-misc"]) || 0; var mod = parseInt(values[values["sensemotive-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["sensemotive-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "sensemotive-mod":mod, "sensemotive-total": total, "sensemotive-ranks": ranks, "sensemotive-misc": misc }); - + if (totalBonus > 0) { setAttrs({"sensemotive-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2720,7 +2720,7 @@ } }); }); - + on("change:sleightofhand-ability change:sleightofhand-cs change:sleightofhand-ranks change:sleightofhand-misc change:sleightofhand-acp change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod change:ac-total-penalty", function() { getAttrs(["sleightofhand-cs", "sleightofhand-ranks", "sleightofhand-ability", "sleightofhand-misc", "sleightofhand-acp", "ac-total-penalty", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2728,26 +2728,26 @@ var misc = parseInt(values["sleightofhand-misc"]) || 0; var mod = parseInt(values[values["sleightofhand-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["sleightofhand-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + if (values["sleightofhand-acp"] == "acp") { total = total + parseInt(values["ac-total-penalty"]); totalBonus = totalBonus + parseInt(values["ac-total-penalty"]); } - + setAttrs({ "sleightofhand-mod":mod, "sleightofhand-total": total, "sleightofhand-ranks": ranks, "sleightofhand-misc": misc }); - + if (totalBonus > 0) { setAttrs({"sleightofhand-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2758,7 +2758,7 @@ } }); }); - + on("change:spellcraft-ability change:spellcraft-cs change:spellcraft-ranks change:spellcraft-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["spellcraft-cs", "spellcraft-ranks", "spellcraft-ability", "spellcraft-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2766,21 +2766,21 @@ var misc = parseInt(values["spellcraft-misc"]) || 0; var mod = parseInt(values[values["spellcraft-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["spellcraft-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "spellcraft-mod":mod, "spellcraft-total": total, "spellcraft-ranks": ranks, "spellcraft-misc": misc }); - + if (totalBonus > 0) { setAttrs({"spellcraft-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2791,7 +2791,7 @@ } }); }); - + on("change:stealth-ability change:stealth-cs change:stealth-ranks change:stealth-misc change:stealth-acp change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod change:ac-total-penalty change:size-mod-skill", function() { getAttrs(["stealth-cs", "stealth-ranks", "stealth-ability", "stealth-misc", "stealth-acp", "ac-total-penalty", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type", "size-mod-skill"], function(values) { if (values["sheet-type"] == "character") { @@ -2800,25 +2800,25 @@ var mod = parseInt(values[values["stealth-ability"]]) || 0; var size = parseInt(values["size-mod-skill"]) || 0; var total = 0, totalBonus = size * 4; - + if (values["stealth-cs"] == "trained" && ranks >= 1) { totalBonus += 3; } - + total = totalBonus + ranks + misc + mod; - + if (values["stealth-acp"] == "acp") { total = total + parseInt(values["ac-total-penalty"]); totalBonus = totalBonus + parseInt(values["ac-total-penalty"]); } - + setAttrs({ "stealth-mod": mod, "stealth-total": total, "stealth-ranks": ranks, "stealth-misc": misc }); - + if (totalBonus > 0) { setAttrs({"stealth-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2829,7 +2829,7 @@ } }); }); - + on("change:survival-ability change:survival-cs change:survival-ranks change:survival-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["survival-cs", "survival-ranks", "survival-ability", "survival-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2837,21 +2837,21 @@ var misc = parseInt(values["survival-misc"]) || 0; var mod = parseInt(values[values["survival-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["survival-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "survival-mod":mod, "survival-total": total, "survival-ranks": ranks, "survival-misc": misc }); - + if (totalBonus > 0) { setAttrs({"survival-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2862,7 +2862,7 @@ } }); }); - + on("change:swim-ability change:swim-cs change:swim-ranks change:swim-misc change:swim-acp change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod change:ac-total-penalty", function() { getAttrs(["swim-cs", "swim-ranks", "swim-ability", "swim-misc", "swim-acp", "ac-total-penalty", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2870,26 +2870,26 @@ var misc = parseInt(values["swim-misc"]) || 0; var mod = parseInt(values[values["swim-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["swim-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + if (values["swim-acp"] == "acp") { total = total + parseInt(values["ac-total-penalty"]); totalBonus = totalBonus + parseInt(values["ac-total-penalty"]); } - + setAttrs({ "swim-mod":mod, "swim-total": total, "swim-ranks": ranks, "swim-misc": misc }); - + if (totalBonus > 0) { setAttrs({"swim-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2900,7 +2900,7 @@ } }); }); - + on("change:usemagicdevice-ability change:usemagicdevice-cs change:usemagicdevice-ranks change:usemagicdevice-misc change:str-mod change:dex-mod change:con-mod change:int-mod change:wis-mod change:cha-mod", function() { getAttrs(["usemagicdevice-cs", "usemagicdevice-ranks", "usemagicdevice-ability", "usemagicdevice-misc", "str-mod", "dex-mod", "con-mod", "int-mod", "wis-mod", "cha-mod", "sheet-type"], function(values) { if (values["sheet-type"] == "character") { @@ -2908,21 +2908,21 @@ var misc = parseInt(values["usemagicdevice-misc"]) || 0; var mod = parseInt(values[values["usemagicdevice-ability"]])||0; var total = 0, totalBonus = 0; - + if (values["usemagicdevice-cs"] == "trained" && ranks >= 1) { total = 3 + ranks + misc + mod; totalBonus = 3; } else { total = ranks + misc + mod; } - + setAttrs({ "usemagicdevice-mod":mod, "usemagicdevice-total": total, "usemagicdevice-ranks": ranks, "usemagicdevice-misc": misc }); - + if (totalBonus > 0) { setAttrs({"usemagicdevice-bonus": "+" + totalBonus}); } else if (totalBonus < 0) { @@ -2933,7 +2933,7 @@ } }); }); - + on("change:repeating_spells-0 remove:repeating_spells-0", function() { getSectionIDs("repeating_spells-0", function(idArray) { setAttrs({ @@ -2942,7 +2942,7 @@ }); }); }); - + on("change:repeating_spells-1 remove:repeating_spells-1", function() { getSectionIDs("repeating_spells-1", function(idArray) { setAttrs({ @@ -2951,7 +2951,7 @@ }); }); }); - + on("change:repeating_spells-2 remove:repeating_spells-2", function() { getSectionIDs("repeating_spells-2", function(idArray) { setAttrs({ @@ -2960,7 +2960,7 @@ }); }); }); - + on("change:repeating_spells-3 remove:repeating_spells-3", function() { getSectionIDs("repeating_spells-3", function(idArray) { setAttrs({ @@ -2969,7 +2969,7 @@ }); }); }); - + on("change:repeating_spells-4 remove:repeating_spells-4", function() { getSectionIDs("repeating_spells-4", function(idArray) { setAttrs({ @@ -2978,7 +2978,7 @@ }); }); }); - + on("change:repeating_spells-5 remove:repeating_spells-5", function() { getSectionIDs("repeating_spells-5", function(idArray) { setAttrs({ @@ -2987,7 +2987,7 @@ }); }); }); - + on("change:repeating_spells-6 remove:repeating_spells-6", function() { getSectionIDs("repeating_spells-6", function(idArray) { setAttrs({ @@ -2996,7 +2996,7 @@ }); }); }); - + on("change:repeating_spells-7 remove:repeating_spells-7", function() { getSectionIDs("repeating_spells-7", function(idArray) { setAttrs({ @@ -3005,7 +3005,7 @@ }); }); }); - + on("change:repeating_spells-8 remove:repeating_spells-8", function() { getSectionIDs("repeating_spells-8", function(idArray) { setAttrs({ @@ -3014,7 +3014,7 @@ }); }); }); - + on("change:repeating_spells-9 remove:repeating_spells-9", function() { getSectionIDs("repeating_spells-9", function(idArray) { setAttrs({ @@ -3023,18 +3023,18 @@ }); }); }); - + on("change:cr", function() { getAttrs(["cr", "xp-rewarded"], function(values) { var cr = values["cr"]; var xpTable = ["0", "400", "600", "800", "1,200", "1,600", "2,400", "3,200", "4,800", "6,400", "9,600", "12,800", "19,200", "25,600", "38,400", "51,200", "76,800", "102,400", "153,600", "204,800", "307,200", "409,600", "614,400", "819,200", "1,228,800", "1,638,400", "2,457,600", "3,276,800", "4,915,200", "6,553,600", "9,830,400"]; var xpRewarded = xpTable[cr] || xpTableFraction(cr); - + setAttrs({ "cr": cr, "xp-rewarded": xpRewarded }); - + function xpTableFraction(cr) { switch (cr) { case "1/8": return 50; @@ -3049,7 +3049,7 @@ } }); }); - + on("change:repeating_special:special-attack-type", function() { getAttrs(["repeating_special_special-attack-type", "str-mod", "dex-mod", "size-mod-atk", "total-bab"], function(values) { var attackType = values[Object.keys(values)[0]]; @@ -3058,23 +3058,23 @@ var sizeMod = parseInt(values["size-mod-atk"]) || 0; var bab = parseInt(values["total-bab"]) || 0; var attackMod; - + switch (attackType) { case "ranged": attackBonus = dexMod + sizeMod + bab; break; case "touch": attackBonus = strMod + sizeMod + bab; break; default: attackBonus = 0; } - + setAttrs({"repeating_special_special-attack-mod": attackBonus}); }); }); - + on("change:core-tab", function() { getAttrs(["core-tab"], function(values) { setAttrs({"ctrl-core-tab": values["core-tab"] }); }); }); - + on("clicked:resetColors", x=>{ setAttrs({ redOne:32, @@ -3091,7 +3091,7 @@ blueFour:0, }) }) - + on("change:gmtoggle", x=>{ var set={gmroll:""} if(x.newValue=="on"){ @@ -3099,64 +3099,64 @@ } setAttrs(set); }) - - - - - - - - - - - - - - - - - - - - - - -