diff --git a/Pathfinder_EZ/pug/core/abilityScores.pug b/Pathfinder_EZ/pug/core/abilityScores.pug index e8c3f2b553..828764d782 100644 --- a/Pathfinder_EZ/pug/core/abilityScores.pug +++ b/Pathfinder_EZ/pug/core/abilityScores.pug @@ -24,4 +24,3 @@ table.abilityScores +abilityScoreRow('Intelligence', 'int') +abilityScoreRow('Wisdom', 'wis') +abilityScoreRow('Charisma', 'cha') -// +labelledAbove('Ability Score Notes')(style='width: 100%;'): +textarea('appearance')(style='height: 0.6in;') diff --git a/Pathfinder_EZ/pug/core/baseAttack.pug b/Pathfinder_EZ/pug/core/baseAttack.pug index 9b6109b4cb..34a555f195 100644 --- a/Pathfinder_EZ/pug/core/baseAttack.pug +++ b/Pathfinder_EZ/pug/core/baseAttack.pug @@ -14,7 +14,7 @@ td: .mathOperator + td: +readOnlyBox(abilityShortName + '_mod')(style='width: 0.25in;') td: .mathOperator + - td: +readOnlyBox('attack_size')(style='width: 0.25in;') + td: +readOnlyBox('size')(style='width: 0.25in;') td: .mathOperator + td: +fieldBox('number', attackName + '_equipment') td: .mathOperator + diff --git a/Pathfinder_EZ/pug/core/sizeSelect.pug b/Pathfinder_EZ/pug/core/sizeSelect.pug index 24e04411fa..efd2f2e1da 100644 --- a/Pathfinder_EZ/pug/core/sizeSelect.pug +++ b/Pathfinder_EZ/pug/core/sizeSelect.pug @@ -1,10 +1,10 @@ +labelledUnderlined('Size')(style='width: 1.2in;'): +select('size') - option(value=4) Colossal - option(value=3) Gargantuan - option(value=2) Huge - option(value=1) Large + option(value=-8) Colossal + option(value=-4) Gargantuan + option(value=-2) Huge + option(value=-1) Large option(value=0, selected=true) Medium - option(value=-1) Small - option(value=-2) Tiny - option(value=-3) Diminuitive - option(value=-4) Fine + option(value=1) Small + option(value=2) Tiny + option(value=4) Diminuitive + option(value=8) Fine diff --git a/Pathfinder_EZ/pug/fields.pug b/Pathfinder_EZ/pug/fields.pug index 0960e599b5..8b5eb83531 100644 --- a/Pathfinder_EZ/pug/fields.pug +++ b/Pathfinder_EZ/pug/fields.pug @@ -2,7 +2,7 @@ mixin fieldBox(type, name, label) .fieldBox(style=attributes.style) if(label) label= label - .inner: input(type=type, name='attr_' + name) + .inner: input(type=type, name='attr_' + name, value=attributes.value) mixin fraction(name) .fraction @@ -11,7 +11,7 @@ mixin fraction(name) input(type='number', name='attr_' + name + '_max') mixin input(type, name) - input(type=type, name='attr_' + name, placeholder=attributes.placeholder, style=attributes.style) + input(type=type, name='attr_' + name, placeholder=attributes.placeholder, style=attributes.style, value=attributes.value) mixin labelledAbove(label) .labelledAbove(style=attributes.style) @@ -41,7 +41,8 @@ mixin option(view, value) option(value=value)= view mixin readOnlyBox(name) - .readOnlyBox(style=attributes.style): span(name='attr_' + name) 0 + .readOnlyBox(style=attributes.style): span(name='attr_' + name) + +input('number', name)(value='0', style='display:none;') mixin repeating(name) fieldset(class='repeating_' + name) diff --git a/Pathfinder_EZ/pug/index.pug b/Pathfinder_EZ/pug/index.pug index 83a9ec30fb..a1bbd710d3 100644 --- a/Pathfinder_EZ/pug/index.pug +++ b/Pathfinder_EZ/pug/index.pug @@ -1,6 +1,8 @@ include fields.pug include tabs.pug ++input('text', 'debug')(value=' ', style='display: none;') + .top .pfLogo .topStats(style='margin-bottom: 1em;') @@ -27,4 +29,7 @@ include tabs.pug +tab('Magic', 'mainTabs') include magic/index.pug +tab('Notes', 'mainTabs') - .test Notes + include notes/index.pug + +script(type='text/worker') + include ../worker_test.js diff --git a/Pathfinder_EZ/pug/notes/index.pug b/Pathfinder_EZ/pug/notes/index.pug new file mode 100644 index 0000000000..1097e9d696 --- /dev/null +++ b/Pathfinder_EZ/pug/notes/index.pug @@ -0,0 +1,2 @@ +.notesTab + +textarea('notes')(style='height: 6in;') diff --git a/Pathfinder_EZ/sheet.html b/Pathfinder_EZ/sheet.html index b9419dcd75..5583ed4e08 100644 --- a/Pathfinder_EZ/sheet.html +++ b/Pathfinder_EZ/sheet.html @@ -1,4 +1,5 @@ +
@@ -93,7 +94,8 @@
-
0
+
+ @@ -116,7 +118,8 @@
-
0
+
+ @@ -139,7 +142,8 @@ -
0
+
+ @@ -162,7 +166,8 @@ -
0
+
+ @@ -185,7 +190,8 @@ -
0
+
+ @@ -208,12 +214,12 @@ -
0
+
+ -
@@ -245,15 +251,15 @@
@@ -326,14 +332,16 @@
-
0
+
+
= 10 +
-
0
+
+
+
@@ -378,7 +386,8 @@
-
0
+
+
= 10 +
@@ -392,14 +401,16 @@
-
0
+
+
+
-
0
+
+
+
@@ -432,7 +443,8 @@
-
0
+
+
@@ -440,7 +452,8 @@
-
0
+
+
@@ -508,7 +521,8 @@
Constitution
-
0
+
+
=
@@ -524,7 +538,8 @@
+
-
0
+
+
+
@@ -571,7 +586,8 @@
Dexterity
-
0
+
+
=
@@ -587,7 +603,8 @@
+
-
0
+
+
+
@@ -634,7 +651,8 @@
Wisdom
-
0
+
+
=
@@ -650,7 +668,8 @@
+
-
0
+
+
+
@@ -733,25 +752,29 @@
Strength
-
0
+
+
=
-
0
+
+
+
-
0
+
+
+
-
0
+
+
+
@@ -798,25 +821,29 @@
Dexterity
-
0
+
+
=
-
0
+
+
+
-
0
+
+
+
-
0
+
+
+
@@ -870,28 +897,32 @@
-
0
+
+
=
-
0
+
+
+
-
0
+
+
+
-
0
+
+
+
@@ -923,35 +954,40 @@
-
0
+
+
= 10 +
-
0
+
+
+
-
0
+
+
+
-
0
+
+
+
-
0
+
+
+
@@ -1004,7 +1040,8 @@
-
0
+
+
=
@@ -1013,7 +1050,8 @@
-
0
+
+
+
@@ -1053,7 +1091,8 @@
-
0
+
+
=
@@ -1062,7 +1101,8 @@
-
0
+
+
+
@@ -1102,7 +1142,8 @@
-
0
+
+
=
@@ -1111,7 +1152,8 @@
-
0
+
+
+
@@ -1151,7 +1193,8 @@
-
0
+
+
=
@@ -1160,7 +1203,8 @@
-
0
+
+
+
@@ -1206,7 +1250,8 @@
-
0
+
+
=
@@ -1215,7 +1260,8 @@
-
0
+
+
+
@@ -1261,7 +1307,8 @@
-
0
+
+
=
@@ -1270,7 +1317,8 @@
-
0
+
+
+
@@ -1316,7 +1364,8 @@
-
0
+
+
=
@@ -1325,7 +1374,8 @@
-
0
+
+
+
@@ -1371,7 +1421,8 @@
-
0
+
+
=
@@ -1380,7 +1431,8 @@
-
0
+
+
+
@@ -1426,7 +1478,8 @@
-
0
+
+
=
@@ -1435,7 +1488,8 @@
-
0
+
+
+
@@ -1475,7 +1529,8 @@
-
0
+
+
=
@@ -1484,7 +1539,8 @@
-
0
+
+
+
@@ -1524,7 +1580,8 @@
-
0
+
+
=
@@ -1533,7 +1590,8 @@
-
0
+
+
+
@@ -1573,7 +1631,8 @@
-
0
+
+
=
@@ -1582,7 +1641,8 @@
-
0
+
+
+
@@ -1622,7 +1682,8 @@
-
0
+
+
=
@@ -1631,7 +1692,8 @@
-
0
+
+
+
@@ -1671,7 +1733,8 @@
-
0
+
+
=
@@ -1680,7 +1743,8 @@
-
0
+
+
+
@@ -1720,7 +1784,8 @@
-
0
+
+
=
@@ -1729,7 +1794,8 @@
-
0
+
+
+
@@ -1769,7 +1835,8 @@
-
0
+
+
=
@@ -1778,7 +1845,8 @@
-
0
+
+
+
@@ -1818,7 +1886,8 @@
-
0
+
+
=
@@ -1827,7 +1896,8 @@
-
0
+
+
+
@@ -1867,7 +1937,8 @@
-
0
+
+
=
@@ -1876,7 +1947,8 @@
-
0
+
+
+
@@ -1916,7 +1988,8 @@
-
0
+
+
=
@@ -1925,7 +1998,8 @@
-
0
+
+
+
@@ -1965,7 +2039,8 @@
-
0
+
+
=
@@ -1974,7 +2049,8 @@
-
0
+
+
+
@@ -2014,7 +2090,8 @@
-
0
+
+
=
@@ -2023,7 +2100,8 @@
-
0
+
+
+
@@ -2063,7 +2141,8 @@
-
0
+
+
=
@@ -2072,7 +2151,8 @@
-
0
+
+
+
@@ -2112,7 +2192,8 @@
-
0
+
+
=
@@ -2121,7 +2202,8 @@
-
0
+
+
+
@@ -2161,7 +2243,8 @@
-
0
+
+
=
@@ -2170,7 +2253,8 @@
-
0
+
+
+
@@ -2210,7 +2294,8 @@
-
0
+
+
=
@@ -2219,7 +2304,8 @@
-
0
+
+
+
@@ -2259,7 +2345,8 @@
-
0
+
+
=
@@ -2268,7 +2355,8 @@
-
0
+
+
+
@@ -2308,7 +2396,8 @@
-
0
+
+
=
@@ -2317,7 +2406,8 @@
-
0
+
+
+
@@ -2357,7 +2447,8 @@
-
0
+
+
=
@@ -2366,7 +2457,8 @@
-
0
+
+
+
@@ -2406,7 +2498,8 @@
-
0
+
+
=
@@ -2415,7 +2508,8 @@
-
0
+
+
+
@@ -2461,7 +2555,8 @@
-
0
+
+
=
@@ -2470,7 +2565,8 @@
-
0
+
+
+
@@ -2516,7 +2612,8 @@
-
0
+
+
=
@@ -2525,7 +2622,8 @@
-
0
+
+
+
@@ -2571,7 +2669,8 @@
-
0
+
+
=
@@ -2580,7 +2679,8 @@
-
0
+
+
+
@@ -2626,7 +2726,8 @@
-
0
+
+
=
@@ -2635,7 +2736,8 @@
-
0
+
+
+
@@ -2681,7 +2783,8 @@
-
0
+
+
=
@@ -2690,7 +2793,8 @@
-
0
+
+
+
@@ -2736,7 +2840,8 @@
-
0
+
+
=
@@ -2745,7 +2850,8 @@
-
0
+
+
+
@@ -2791,7 +2897,8 @@
-
0
+
+
=
@@ -2800,7 +2907,8 @@
-
0
+
+
+
@@ -2846,7 +2954,8 @@
-
0
+
+
=
@@ -2855,7 +2964,8 @@
-
0
+
+
+
@@ -2901,7 +3011,8 @@
-
0
+
+
=
@@ -2910,7 +3021,8 @@
-
0
+
+
+
@@ -2956,7 +3068,8 @@
-
0
+
+
=
@@ -2965,7 +3078,8 @@
-
0
+
+
+
@@ -3005,7 +3119,8 @@
-
0
+
+
=
@@ -3014,7 +3129,8 @@
-
0
+
+
+
@@ -3054,7 +3170,8 @@
-
0
+
+
=
@@ -3063,7 +3180,8 @@
-
0
+
+
+
@@ -3103,7 +3221,8 @@
-
0
+
+
=
@@ -3112,7 +3231,8 @@
-
0
+
+
+
@@ -3152,7 +3272,8 @@
-
0
+
+
=
@@ -3161,7 +3282,8 @@
-
0
+
+
+
@@ -3201,7 +3323,8 @@
-
0
+
+
=
@@ -3210,7 +3333,8 @@
-
0
+
+
+
@@ -3250,7 +3374,8 @@
-
0
+
+
=
@@ -3259,7 +3384,8 @@
-
0
+
+
+
@@ -3299,7 +3425,8 @@
-
0
+
+
=
@@ -3308,7 +3435,8 @@
-
0
+
+
+
@@ -3348,7 +3476,8 @@
-
0
+
+
=
@@ -3357,7 +3486,8 @@
-
0
+
+
+
@@ -3648,14 +3778,16 @@
-
0
+
+
= 10 +
-
0
+
+
+
@@ -3695,7 +3827,8 @@
-
0
+
+
@@ -3727,7 +3860,8 @@
-
0
+
+
@@ -3759,7 +3893,8 @@
-
0
+
+
@@ -3791,7 +3926,8 @@
-
0
+
+
@@ -3823,7 +3959,8 @@
-
0
+
+
@@ -3857,7 +3994,8 @@
-
0
+
+
@@ -3889,7 +4027,8 @@
-
0
+
+
@@ -3921,7 +4060,8 @@
-
0
+
+
@@ -3953,7 +4093,8 @@
-
0
+
+
@@ -3985,7 +4126,8 @@
-
0
+
+
@@ -4021,7 +4163,50 @@
-
Notes
+
+ +
- \ No newline at end of file + + \ No newline at end of file diff --git a/Pathfinder_EZ/worker.js b/Pathfinder_EZ/worker.js new file mode 100644 index 0000000000..530f0dd702 --- /dev/null +++ b/Pathfinder_EZ/worker.js @@ -0,0 +1,113 @@ +(() => { + 'use strict'; + + function _debug(msg) { + return _setAttrs({ + debug: msg + }); + } + + /** + * Promise-wrapped getAttrs. + */ + function _getAttrs(attrs) { + return new Promise((resolve, reject) => { + getAttrs(attrs, resolve); + }); + } + + /** + * Promise-wrapped getSectionIDs. + */ + function _getSectionIds(sectionName) { + return new Promise((resolve, reject) => { + getSectionIDs(sectionName, resolve); + }); + } + + function _onChange(attrNames, cb) { + let list = _.chain(attrNames) + .map(name => { + return 'change:' + name + }) + .value(); + + on(list.join(' '), cb); + } + + /** + * Promise-wrapped setAttrs. + */ + function _setAttrs(values) { + return new Promise((resolve, reject) => { + log(values); + setAttrs(values, undefined, resolve); + }); + } + + function updateAbilityMod(abilityName) { + return _getAttrs([abilityName, abilityName + '_temp']) + .then(values => { + let base = values[abilityName]; + let temp = values[abilityName + '_temp']; + return _setAttrs({ + [abilityName] + '_mod': Math.floor((base + temp - 10)/2) + }}); + }); + } + + function updateChaMod() { + return updateAbilityMod('cha'); + } + + function updateConMod() { + return updateAbilityMod('con'); + } + + function updateDexMod() { + return updateAbilityMod('dex'); + } + + function updateIntMod() { + return updateAbilityMod('int'); + } + + function updateStrMod() { + return updateAbilityMod('str'); + } + + function updateWisMod() { + return updateAbilityMod('wis'); + } + + + + _onChange(['cha', 'cha_temp'], () => { + return updateChaMod(); + }); + + _onChange(['con', 'con_temp'], () => { + return updateConMod(); + }); + + _onChange(['dex', 'dex_temp'], () => { + return updateDexMod(); + }); + + _onChange(['int', 'int_temp'], () => { + return updateIntMod(); + }); + + _onChange(['str', 'str_temp'], () => { + return updateStrMod(); + }); + + _onChange(['wis', 'wis_temp'], () => { + return updateWisMod(); + }); + + + on('sheet:opened', () => { + updateAll(); + }); +})(); diff --git a/Pathfinder_EZ/worker_test.js b/Pathfinder_EZ/worker_test.js new file mode 100644 index 0000000000..2d40531e94 --- /dev/null +++ b/Pathfinder_EZ/worker_test.js @@ -0,0 +1,39 @@ +(() => { + 'use strict'; + + /** + * Promise-wrapped getAttrs. + */ + function _getAttrs(attrs) { + return new Promise((resolve, reject) => { + getAttrs(attrs, resolve); + }); + } + + /** + * Promise-wrapped setAttrs. + */ + function _setAttrs(values) { + return new Promise(resolve, reject => { + setAttrs(values, undefined, () => { + resolve(); + }); + }); + } + + on('sheet:opened', () => { + (new Promise((resolve, reject) => { + resolve(42); + })) + .then(value => { + return _setAttrs({ + debug: value + }); + }) + .then(() => { + setAttrs({ + debug: 11 + }); + }); + }); +})();