mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-07 18:32:40 +00:00
fix table snippet spacing in editor
This commit is contained in:
@@ -52,14 +52,14 @@ const getFeature = (level)=>{
|
|||||||
|
|
||||||
const maxes = [4, 3, 3, 3, 3, 2, 2, 1, 1];
|
const maxes = [4, 3, 3, 3, 3, 2, 2, 1, 1];
|
||||||
|
|
||||||
const drawSlots = function(Slots, rows){
|
const drawSlots = function(Slots, rows, padding){
|
||||||
let slots = Number(Slots);
|
let slots = Number(Slots);
|
||||||
return _.times(rows, function(i){
|
return _.times(rows, function(i){
|
||||||
const max = maxes[i];
|
const max = maxes[i];
|
||||||
if(slots < 1) return '—';
|
if(slots < 1) return _.pad('—', padding);
|
||||||
const res = _.min([max, slots]);
|
const res = _.min([max, slots]);
|
||||||
slots -= res;
|
slots -= res;
|
||||||
return res;
|
return _.pad(res.toString(), padding);
|
||||||
}).join(' | ');
|
}).join(' | ');
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -72,17 +72,17 @@ module.exports = {
|
|||||||
let spells = 1;
|
let spells = 1;
|
||||||
let slots = 2;
|
let slots = 2;
|
||||||
return `{{${classes}\n##### The ${classname}\n` +
|
return `{{${classes}\n##### The ${classname}\n` +
|
||||||
`| Level | Proficiency | Features | Cantrips | Spells | --- Spell Slots Per Spell Level --- |||||||||\n`+
|
`| Level | Proficiency | Features | Cantrips | Spells | --- Spell Slots Per Spell Level --- |||||||||\n`+
|
||||||
`| ^| Bonus ^| ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th | 5th | 6th | 7th | 8th | 9th |\n`+
|
`| ^| Bonus ^| ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th | 5th | 6th | 7th | 8th | 9th |\n`+
|
||||||
`|:-----:|:-----------:|:---------|:--------:|:------:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n${
|
`|:-----:|:-----------:|:--------------------------------------------------------|:--------:|:------:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n${
|
||||||
_.map(levels, function(levelName, level){
|
_.map(levels, function(levelName, level){
|
||||||
const res = [
|
const res = [
|
||||||
levelName,
|
_.pad(levelName, 5),
|
||||||
`+${profBonus[level]}`,
|
_.pad(`+${profBonus[level]}`, 11),
|
||||||
getFeature(level),
|
_.padEnd(getFeature(level), 55),
|
||||||
cantrips,
|
_.pad(cantrips.toString(), 8),
|
||||||
spells,
|
_.pad(spells.toString(), 6),
|
||||||
drawSlots(slots, 9)
|
drawSlots(slots, 9, 3),
|
||||||
].join(' | ');
|
].join(' | ');
|
||||||
|
|
||||||
cantrips += _.random(0, 1);
|
cantrips += _.random(0, 1);
|
||||||
@@ -98,14 +98,14 @@ module.exports = {
|
|||||||
|
|
||||||
let featureScore = 1;
|
let featureScore = 1;
|
||||||
return `{{${classes}\n##### The ${classname}\n` +
|
return `{{${classes}\n##### The ${classname}\n` +
|
||||||
`| Level | Proficiency Bonus | Features | ${_.sample(features)}|\n` +
|
`| Level | Proficiency Bonus | Features | ${_.pad(_.sample(features), 26)} |\n` +
|
||||||
`|:---:|:---:|:---|:---:|\n${
|
`|:-----:|:-----------------:|:--------------------------------------------------------|:--------------------------:|\n${
|
||||||
_.map(levels, function(levelName, level){
|
_.map(levels, function(levelName, level){
|
||||||
const res = [
|
const res = [
|
||||||
levelName,
|
_.pad(levelName, 5),
|
||||||
`+${profBonus[level]}`,
|
_.pad(`+${profBonus[level]}`, 17),
|
||||||
getFeature(level),
|
_.padEnd(getFeature(level), 55),
|
||||||
`+${featureScore}`
|
_.pad(`+${featureScore}`, 26),
|
||||||
].join(' | ');
|
].join(' | ');
|
||||||
|
|
||||||
featureScore += _.random(0, 1);
|
featureScore += _.random(0, 1);
|
||||||
@@ -121,15 +121,15 @@ module.exports = {
|
|||||||
let spells = 1;
|
let spells = 1;
|
||||||
let slots = 2;
|
let slots = 2;
|
||||||
return `{{${classes}\n##### ${classname} Spellcasting\n` +
|
return `{{${classes}\n##### ${classname} Spellcasting\n` +
|
||||||
`| Class | Cantrips | Spells | --- Spells Slots per Spell Level --- ||||\n` +
|
`| Class | Cantrips | Spells | --- Spells Slots per Spell Level --- ||||\n` +
|
||||||
`| Level ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th |\n` +
|
`| Level ^| Known ^| Known ^| 1st | 2nd | 3rd | 4th |\n` +
|
||||||
`|:---:|:---:|:---:|:---:|:---:|:---:|:---:|\n${
|
`|:------:|:--------:|:-------:|:--------:|:--------:|:--------:|:--------:|\n${
|
||||||
_.map(levels, function(levelName, level){
|
_.map(levels, function(levelName, level){
|
||||||
const res = [
|
const res = [
|
||||||
levelName,
|
_.pad(levelName, 6),
|
||||||
cantrips,
|
_.pad(cantrips.toString(), 8),
|
||||||
spells,
|
_.pad(spells.toString(), 7),
|
||||||
drawSlots(slots, 4)
|
drawSlots(slots, 4, 8),
|
||||||
].join(' | ');
|
].join(' | ');
|
||||||
|
|
||||||
cantrips += _.random(0, 1);
|
cantrips += _.random(0, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user