From d1ffab54878b3343088d4a3546084e80315d6d4e Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Tue, 14 Sep 2021 12:17:28 -0400 Subject: [PATCH 1/2] Update Monster styles and snippets. --- .../snippetbar/snippets/monsterblock.gen.js | 28 ++++++++++----- .../snippets/tableOfContents.gen.js | 10 +++--- themes/5ePhb.style.less | 36 +++++++++---------- 3 files changed, 41 insertions(+), 33 deletions(-) diff --git a/client/homebrew/editor/snippetbar/snippets/monsterblock.gen.js b/client/homebrew/editor/snippetbar/snippets/monsterblock.gen.js index 4db3019ea..e51249ab1 100644 --- a/client/homebrew/editor/snippetbar/snippets/monsterblock.gen.js +++ b/client/homebrew/editor/snippetbar/snippets/monsterblock.gen.js @@ -105,6 +105,20 @@ const genAbilities = function(){ ]); }; +const genLongAbilities = function(){ + return _.sample([ + dedent`***Pack Tactics.*** These guys work together like peanut butter and jelly. Jelly and peanut butter. + + When one of these guys attacks, the target is covered with, well, peanut butter and jelly.`, + dedent`***Hangriness.*** This creature is angry, and hungry. It will refuse to do anything with you until its hunger is satisfied. + + When in visual contact with this creature, you must purchase an extra order of fries, even if they say they aren't hungry.`, + dedent`***Full of Detergent.*** This creature has swallowed an entire bottle of dish detergent and is actually having a pretty good time. + + While walking near this creature, you must make a dexterity check or become "a soapy mess" for three hours, after which your skin will get all dry and itchy.` + ]); +}; + const genAction = function(){ const name = _.sample([ 'Abdominal Drop', @@ -146,24 +160,22 @@ module.exports = { ## ${getMonsterName()} *${getType()}, ${getAlignment()}* ___ - **Armor Class** :: ${_.random(10, 20)} (chain mail, shield) - **Hit Points** :: ${_.random(1, 150)}(1d4 + 5) - **Speed** :: ${_.random(0, 50)}ft. + ___ | STR | DEX | CON | INT | WIS | CHA | |:-----:|:-----:|:-----:|:-----:|:-----:|:-----:| ${getStats()} ___ **Condition Immunities** :: ${genList(['groggy', 'swagged', 'weak-kneed', 'buzzed', 'groovy', 'melancholy', 'drunk'], 3)} - **Senses** :: darkvision 60 ft., passive Perception ${_.random(3, 20)} + **Languages** :: ${genList(['Common', 'Pottymouth', 'Gibberish', 'Latin', 'Jive'], 2)} - **Challenge** :: ${_.random(0, 15)} (${_.random(10, 10000)} XP) + ___ + ${_.times(_.random(genLines, genLines + 2), function(){return genAbilities();}).join('\n:\n')} : - ${_.times(_.random(genLines, genLines + 2), function(){return genAbilities();}).join('\n\t\t\t\n\t\t\t')} - : + ${genLongAbilities()} ### Actions - ${_.times(_.random(genLines, genLines + 2), function(){return genAction();}).join('\n\t\t\t\n\t\t\t')} + ${_.times(_.random(genLines, genLines + 2), function(){return genAction();}).join('\n:\n')} }} \n`; } diff --git a/client/homebrew/editor/snippetbar/snippets/tableOfContents.gen.js b/client/homebrew/editor/snippetbar/snippets/tableOfContents.gen.js index f0964e582..1c52d5cf7 100644 --- a/client/homebrew/editor/snippetbar/snippets/tableOfContents.gen.js +++ b/client/homebrew/editor/snippetbar/snippets/tableOfContents.gen.js @@ -53,19 +53,19 @@ module.exports = function(brew){ const TOC = getTOC(pages); const markdown = _.reduce(TOC, (r, g1, idx1)=>{ if(g1.title !== null) { - r.push(`\t\t- ### [{{ ${g1.title}}}{{ ${g1.page}}}](#p${g1.page})`); + r.push(`- ### [{{ ${g1.title}}}{{ ${g1.page}}}](#p${g1.page})`); } if(g1.children.length){ _.each(g1.children, (g2, idx2)=>{ if(g2.title !== null) { - r.push(`\t\t - #### [{{ ${g2.title}}}{{ ${g2.page}}}](#p${g2.page})`); + r.push(` - #### [{{ ${g2.title}}}{{ ${g2.page}}}](#p${g2.page})`); } if(g2.children.length){ _.each(g2.children, (g3, idx3)=>{ if(g2.title !== null) { - r.push(`\t\t - [{{ ${g3.title}}}{{ ${g3.page}}}](#p${g3.page})`); + r.push(` - [{{ ${g3.title}}}{{ ${g3.page}}}](#p${g3.page})`); } else { // Don't over-indent if no level-2 parent entry - r.push(`\t\t - [{{ ${g3.title}}}{{ ${g3.page}}}](#p${g3.page})`); + r.push(` - [{{ ${g3.title}}}{{ ${g3.page}}}](#p${g3.page})`); } }); } @@ -78,7 +78,7 @@ module.exports = function(brew){ {{toc,wide # Table Of Contents -${markdown} + ${markdown} }} \n`; }; diff --git a/themes/5ePhb.style.less b/themes/5ePhb.style.less index 049fdb6e8..19492ebef 100644 --- a/themes/5ePhb.style.less +++ b/themes/5ePhb.style.less @@ -385,17 +385,6 @@ body { padding : 0px; margin-bottom : 0.325cm; - p{ - margin-bottom : 0.3cm; - } - p+p { - margin-top : 0; //May not be needed - text-indent : 0; - } - p:last-of-type { - margin-bottom: 0; - } - //Headers h2{ font-size : 0.62cm; @@ -411,7 +400,7 @@ body { font-weight : 800; font-variant : small-caps; border-bottom : 2px solid @headerText; - margin-top : 0.05cm; + // margin-top : 0.05cm; //Font is misaligned. Shift up slightly padding-bottom : 0.05cm; } @@ -425,12 +414,17 @@ body { border : none; } - //Attribute Lists - dl { + //Attribute Lists - All text between HRs is red + hr ~ :is(dl,p) { color : @headerText; } - hr:last-of-type~dl{ - color : inherit; // After the HRs, hanging indents remain black. + hr:last-of-type { + & ~ :is(dl,p) { + color : inherit; // After the HRs, reset text to black + } + & + * { + margin-top : 0.325cm; // Space after last HR + } } // Monster Ability table @@ -449,6 +443,10 @@ body { padding: 0px; } } + + :last-child { + margin-bottom : 0; + } } //Full Width @@ -773,10 +771,8 @@ body { // *****************************/ .page { .blank { - height: 0.75em; - } - p + .blank { - margin-top: -1em; + height : 1em; + margin-top : 0; } } From 22e54636d421812b0a0095eeeee79dd52886fccc Mon Sep 17 00:00:00 2001 From: Trevor Buckner Date: Wed, 15 Sep 2021 14:02:19 -0400 Subject: [PATCH 2/2] Fix partial page rendering on v3 "dummy pages" on v3 were unstyled, giving them very small height which led to a cycle of pages changing size, which shifted other pages into view, which changed their sizes, etc. --- client/homebrew/brewRenderer/brewRenderer.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/homebrew/brewRenderer/brewRenderer.jsx b/client/homebrew/brewRenderer/brewRenderer.jsx index 9ea4632c4..260dbdf13 100644 --- a/client/homebrew/brewRenderer/brewRenderer.jsx +++ b/client/homebrew/brewRenderer/brewRenderer.jsx @@ -117,7 +117,7 @@ const BrewRenderer = createClass({ }, renderDummyPage : function(index){ - return
+ return
; },