diff --git a/package.json b/package.json index 50ffe10..28dcb19 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,13 @@ "build": "node scripts/build.js", "populate": "node scripts/populate.js", - "snippet" : "nodemon scripts/snippet.test.js", - "prod": "set NODE_ENV=production&& npm run build", "postinstall": "npm run build", "start": "node server.js", + + "snippet" : "nodemon scripts/snippet.test.js", + "todo" : "node_modules/.bin/notes -h true -x node_modules/ -x build/", + "test": "mocha tests", "test:dev": "nodemon -x mocha tests || exit 0", "test:markdown": "nodemon -x mocha tests/markdown.test.js || exit 0" diff --git a/scripts/snippet.test.js b/scripts/snippet.test.js index 7cb4bf3..35aa669 100644 --- a/scripts/snippet.test.js +++ b/scripts/snippet.test.js @@ -2,6 +2,7 @@ const snippets = require('../shared/homebrewery/snippets'); console.log(snippets); -console.log(snippets.style.print.a4PageSize()); -console.log(snippets.brew.phb.spell()); -console.log(snippets.brew.phb.table()); \ No newline at end of file +//console.log(snippets.brew.spell()); +//console.log(snippets.brew.table()); + +console.log(snippets.brew.noncasterTable()); \ No newline at end of file diff --git a/shared/homebrewery/brewEditor/menubar/menubar.jsx b/shared/homebrewery/brewEditor/menubar/menubar.jsx index 44d1a43..3191197 100644 --- a/shared/homebrewery/brewEditor/menubar/menubar.jsx +++ b/shared/homebrewery/brewEditor/menubar/menubar.jsx @@ -5,7 +5,6 @@ const cx = require('classnames'); const SnippetMap = require('./snippet.map.js'); const SnippetGroup = require('./snippetGroup/snippetGroup.jsx'); -console.log(SnippetMap); const Menubar = React.createClass({ getDefaultProps: function() { return { diff --git a/shared/homebrewery/phb_style/phb.blocks.less b/shared/homebrewery/phb_style/phb.blocks.less index 58bf366..30ff368 100644 --- a/shared/homebrewery/phb_style/phb.blocks.less +++ b/shared/homebrewery/phb_style/phb.blocks.less @@ -11,15 +11,37 @@ } } } - .monster{ - } - - - - +.note{ + .useSansSerif(); + margin-bottom : 1em; + padding : 5px 10px; + background-color : @green; + border-style : solid; + border-width : 11px; + border-image : @noteBorder 11; + border-image-outset : 9px 0px; + box-shadow : 1px 4px 14px #888; + h2,h3,h4{ + .useSansSerif(); + color : black; + } + p, ul{ + font-size : 0.352cm; + line-height : 1.1em; + } + &.alt{ + border-style : solid; + border-width : 7px; + border-image : @descriptiveBorder 12 round; + border-image-outset : 4px; + } +} .frame{ + box-sizing : border-box; + margin-top : 30px; + margin-bottom : 37px; background-color : white; border : initial; border-style : solid; @@ -28,17 +50,18 @@ border-image-slice : 150 200 150 200; border-image-source : @frameBorder; border-image-width : 47px; - margin-top : 30px; - margin-bottom : 37px; - box-sizing: border-box; } - .wide{ column-span : all; -webkit-column-span : all; -moz-column-span : all; } -.2column, .2col{ +.twoCol{ + background-color: red; + column-count : 2; +} +.columnSplit{ + //TODO: make \column trigger this } \ No newline at end of file diff --git a/shared/homebrewery/phb_style/phb.colors.less b/shared/homebrewery/phb_style/phb.colors.less index 6a28432..e499049 100644 --- a/shared/homebrewery/phb_style/phb.colors.less +++ b/shared/homebrewery/phb_style/phb.colors.less @@ -8,8 +8,6 @@ @monsterStatBackground : #FDF1DC; -@teal : blue; - .colorElements(@color){ table tbody{ @@ -17,8 +15,23 @@ background-color : @color; } } + &.note{ + background-color: @color; + } } +@red : #9c2b1b; +@gold : #c9ad6a; //brown? +@green : #e0e5c1; +@yellow : #faf7ea; //same as background? +@teal : blue; +@blue : blue; + //TODO make a color mixin generator .teal{ .colorElements(@teal); } +.blue{ .colorElements(@blue); } +.green{ .colorElements(@green); } +.yellow{ .colorElements(@yellow); } +.gold{ .colorElements(@gold); } +.red{ .colorElements(@red); } diff --git a/shared/homebrewery/phb_style/phb.less b/shared/homebrewery/phb_style/phb.less index 1ab216b..42fc0ec 100644 --- a/shared/homebrewery/phb_style/phb.less +++ b/shared/homebrewery/phb_style/phb.less @@ -15,7 +15,7 @@ @import './phb.blocks.less'; - @page { margin: 0; } + @page { margin: 0; } //???? .useColumns(@multiplier : 1){ @@ -171,6 +171,7 @@ //***************************** // * NOTE // *****************************/ + /* blockquote{ .useSansSerif(); box-sizing : border-box; @@ -187,6 +188,7 @@ line-height : 1.1em; } } + */ //If a note starts a column, give it space at the top to render border pre+blockquote, h2+blockquote, h3+blockquote, h4+blockquote, h5+blockquote { margin-top : 13px; @@ -416,6 +418,7 @@ //***************************** // * CLASS TABLE // *****************************/ + /* .descriptive{ display : block-inline; margin-bottom : 1em; @@ -447,6 +450,7 @@ pre+.descriptive{ margin-top : 8px; } + */ //***************************** // * TABLE OF CONTENTS // *****************************/ diff --git a/shared/homebrewery/snippets/brew/classTable.snippet.js b/shared/homebrewery/snippets/brew/classTable.snippet.js index e1f9c63..9e84757 100644 --- a/shared/homebrewery/snippets/brew/classTable.snippet.js +++ b/shared/homebrewery/snippets/brew/classTable.snippet.js @@ -1,2 +1,82 @@ const _ = require('lodash'); -const Data = require('./random.data.js'); \ No newline at end of file +const Data = require('./random.data.js'); + +const getFeature = (level)=>{ + let res = [] + if(_.includes([4,6,8,12,14,16,19], level+1)){ + res = ['Ability Score Improvement'] + } + res = _.union(res, _.sampleSize(Data.abilities, _.sample([0,1,1,1,1,1]))); + if(!res.length) return '─'; + return res.join(', '); +}; + + +module.exports = { + + casterTable : ()=>{ + + let featureScore = 1 + const rows = _.map(Data.levels, (lvlText, level)=>{ + featureScore += _.random(0,1); + return '| ' + [ + lvlText, + '+'+Math.floor(level/4 + 2), + getFeature(level), + '+'+featureScore + ].join(' | ') + ' |'; + }).join('\n'); + + return `{{frame,wide +##### ${Data.rand('classes')} +| Level | Proficiency Bonus | Features | Cantrips Known | Spells Known | 1st | 2nd | 3rd | 4th | 5th | 6th | 7th | 8th | 9th | +|:---:|:---:|:---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:| +${rows} +}}`; + }, + + + halfcasterTable : ()=>{ + let featureScore = 1 + const rows = _.map(Data.levels, (lvlText, level)=>{ + featureScore += _.random(0,1); + return '| ' + [ + lvlText, + '+'+Math.floor(level/4 + 2), + getFeature(level), + '+'+featureScore + ].join(' | ') + ' |'; + }).join('\n'); + + + return `{{frame,wide +##### ${Data.rand('classes')} +| Level | Proficiency Bonus | Features | 1st | 2nd | 3rd | 4th | 5th | +|:---:|:---:|:---|:---:|:---:|:---:|:---:|:---:| +${rows} +}}`; + + }, + + noncasterTable : ()=>{ + let featureScore = 1 + const rows = _.map(Data.levels, (lvlText, level)=>{ + featureScore += _.random(0,1); + return '| ' + [ + lvlText, + '+'+Math.floor(level/4 + 2), + getFeature(level), + '+'+featureScore + ].join(' | ') + ' |'; + }).join('\n'); + + return `{{frame +##### ${Data.rand('classes')} +| Level | Proficiency Bonus | Features | ${Data.rand('abilities')} | +|:---:|:---:|:---|:---:| +${rows} +}}`; + } + + +} \ No newline at end of file diff --git a/shared/homebrewery/snippets/brew/index.js b/shared/homebrewery/snippets/brew/index.js index dab63e4..e8dd3de 100644 --- a/shared/homebrewery/snippets/brew/index.js +++ b/shared/homebrewery/snippets/brew/index.js @@ -2,7 +2,9 @@ const _ = require('lodash'); module.exports = _.merge( require('./spell.snippet.js'), - require('./table.snippet.js') + require('./table.snippet.js'), + require('./classTable.snippet.js'), + require('./note.snippet.js') //wide diff --git a/shared/homebrewery/snippets/brew/note.snippet.js b/shared/homebrewery/snippets/brew/note.snippet.js new file mode 100644 index 0000000..18c9233 --- /dev/null +++ b/shared/homebrewery/snippets/brew/note.snippet.js @@ -0,0 +1,22 @@ +const _ = require('lodash'); +const Data = require('./random.data.js'); + + +module.exports = { + note : ()=>{ + return `{{note +##### ${Data.rand('abilities')} +${Data.rand('sentences', 6, 4).join(' ')} +}}` + + }, + + altnote : ()=>{ + return `{{note,alt +##### ${Data.rand('abilities')} +${Data.rand('sentences', 6, 4).join(' ')} +}}` + } + + +} \ No newline at end of file diff --git a/shared/homebrewery/snippets/brew/random.data.js b/shared/homebrewery/snippets/brew/random.data.js index c194bd2..5c3284a 100644 --- a/shared/homebrewery/snippets/brew/random.data.js +++ b/shared/homebrewery/snippets/brew/random.data.js @@ -284,6 +284,39 @@ const Data = { `Yielding Throw of the Mills`, ], + abilities : [ + "Astrological Botany", + "Astrological Chemistry", + "Biochemical Sorcery", + "Civil Alchemy", + "Consecrated Biochemistry", + "Demonic Anthropology", + "Divinatory Mineralogy", + "Genetic Banishing", + "Hermetic Geography", + "Immunological Incantations", + "Nuclear Illusionism", + "Ritual Astronomy", + "Seismological Divination", + "Spiritual Biochemistry", + "Statistical Occultism", + "Police Necromancer", + "Sixgun Poisoner", + "Pharmaceutical Gunslinger", + "Infernal Banker", + "Spell Analyst", + "Gunslinger Corruptor", + "Torque Interfacer", + "Exo Interfacer", + "Gunpowder Torturer", + "Orbital Gravedigger", + "Phased Linguist", + "Mathematical Pharmacist", + "Plasma Outlaw", + "Malefic Chemist", + "Police Cultist" + ], + alignments : [ "Annoying Evil", "Chaotic Gossipy", @@ -309,10 +342,21 @@ const Data = { ], sizes : ['Microscopic', 'Tiny', 'Small', 'Medium', 'Large', 'Gargantuan', 'Stupidly vast'], + levels : ["1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "10th", "11th", "12th", "13th", "14th", "15th", "16th", "17th", "18th", "19th", "20th"], - - + sentences : [ + `The suspicion arises the narrator of the tale is actually a demon.`, + `There is a predicted hurricane - but it's not what was expected, and this complicates the plans of the protagonist.`, + `The antagonist's believes their life has changed for the strange - this turns out to be this is due to being lied to by others`, + `An accidental cuddle leads to complications.`, + `It's revealed that everything that is happening is all a dream.`, + `There is a sudden hurricane.`, + `The alternate protagonist is revealed to be a different race/species than thought, which suddenly makes what's going on much clearer.`, + `Thanks to alien forces, the characters end up in the earth's past.`, + `Thanks to alien forces, the secondary protagonist ends up in a world after an apocalypse.`, + `Due to a panic attack a character has to get psychological therapy.`, + ] }; diff --git a/shared/homebrewery/snippets/brew/table.snippet.js b/shared/homebrewery/snippets/brew/table.snippet.js index 673d075..00ad1ff 100644 --- a/shared/homebrewery/snippets/brew/table.snippet.js +++ b/shared/homebrewery/snippets/brew/table.snippet.js @@ -20,7 +20,7 @@ const columns = { return _.concat([`d${rows}`, ':---:'], _.times(rows, (i)=>i+1)); }, level : (rows)=>{ - return _.concat([`${_.sample(Data.classes)} Level`, ':---:'], _.times(rows, (i)=>`${i*2+3}th`)); + return _.concat([`${_.sample(Data.classes)} Level`, ':---:'], _.times(rows, (i)=>Data.levels[i*2])); }, spell : (rows)=>{