Files
roll20-character-sheets/Without Numbers/Source/pug/mixins.pug
T

276 lines
11 KiB
Plaintext

mixin sectionheader(name, label)
//- Creates one of the toggleable headers
Parameters
name: underlying attribute name (without "attr_")
label: i18n code for the text appearing on the header. Block is inserted as placeholder.
.section-toggle-header
input(type="checkbox", name=`attr_${name}`, value="1", data-i18n-title="SHOW_HIDE", checked)
h1
if (label)
span(data-i18n=label)
block
else
block
input.hider(type="hidden", name=`attr_${name}`, value="1")
mixin abilityHeader(name, label)
.section-toggle-header
input(type="checkbox", name=`attr_${name}`, value="1", data-i18n-title="SHOW_HIDE", checked)
h1
if (label)
span(data-i18n=label)
block
else
block
input.hider(type="hidden", name=`attr_${name}`, value="1")
mixin text-input(name, label, extraclass)
//- Creates one of the standard underlined text inputs
Defaults to a input of type text
Always passes block to the label, since new keys take days/weeks to propagate through Roll20
Parameters
name: underlying attribute name (without "attr_")
label: i18n code for the label
extraclass: if present, will be the class of the input
Attributes
All attributes except class are passed on to the input. class is passed on
to the containing label.
- classes = attributes.class;
- delete attributes.class;
label(class=["text-input", classes])
input(type="text", name=`attr_${name}`, class=extraclass data-lpignore="true", title=`@{attr_${name}}`)&attributes(attributes)
if (label)
.label(data-i18n=label.toUpperCase()).ellipsis
block
else
.label.ellipsis
block
mixin text-input-duo(name1, name2, label, attributes2, prefix, infix, suffix)
//- Creates a pair of underlined inputs
Defaults to number inputs
Parameters
name1: underlying attribute name of first input (without "attr_")
name2: underlying attribute name of second input (without "attr_")
label: i18n code for the label. Block is inserted as placeholder.
attributes2: will be passed on as the attributes of the second input
infix: will be placed between the inputs, defaults to /
prefix: placed before inputs, if present
suffix: placed after inputs if present
Attributes
All attributes except class are passed on to the first input.
class is passed on to the containing label.
- classes = attributes.class;
- delete attributes.class;
.text-input.duo(class=classes)
if (prefix)
span= prefix
else
span
input(type="number", name=`attr_${name1}`)&attributes(attributes)
if (infix)
span= infix
else
span /
input(type="number", name=`attr_${name2}`)&attributes(attributes2)
if (suffix)
span= suffix
else
span
if (label)
.label(data-i18n=label.toUpperCase()).ellipsis
block
else
block
mixin text-input-trio(name1, name2, name3, label, attributes2, attributes3, prefix, infix1, infix2, suffix)
//- Creates a pair of underlined inputs
Defaults to number inputs
Parameters
name1: underlying attribute name of first input (without "attr_")
name2: underlying attribute name of second input (without "attr_")
name3: underlying attribute name of third input (without "attr_")
label: i18n code for the label. Block is inserted as placeholder.
attributes2: will be passed on as the attributes of the second input
attributes3: will be passed on as the attributes of the third input
infix1, infix2: will be placed between the inputs, defaults to /
prefix: placed before inputs, if present
suffix: placed after inputs if present
Attributes
All attributes except class are passed on to the first input.
class is passed on to the containing label.
- classes = attributes.class;
- delete attributes.class;
.text-input.trio(class=classes)
if (prefix)
span= prefix
else
span
input(type="number", name=`attr_${name1}`)&attributes(attributes)
if (infix1)
span= infix1
else
span /
input(type="number", name=`attr_${name2}`)&attributes(attributes2)
if (infix2)
span= infix2
else
span /
input(type="number", name=`attr_${name3}`)&attributes(attributes3)
if (suffix)
span= suffix
else
span
if (label)
.label(data-i18n=label)
block
else
block
mixin fake-text-input(label, labeltext)
//- Creates a label container that looks like one of the underlined text inputs.
block is inserted where the input would normally be
Parameters
label: i18n code for the text appearing underneath
labeltext: Placeholder for the label, due to translation propagation delay.
Attributes
class is passed on to the containing label
label(class=["text-input", attributes.class])
block
if(label)
.label(data-i18n=label).ellipsis
=labeltext
mixin makeSave(name)
//- Creates a saving throw button
Parameters
name: underlying attribute name (without "attr_"). Also used as
button name, and for translation keys.
.center
input(type="hidden", name=`attr_save_${name}`, value="15")
button(name=`roll_save_${name}`, type="roll", value!=`&{template:swn-save} {{system=@{system}}} {{charname=@{character_name}}} {{title=^{${name.toUpperCase()}_SAVE}}} {{dice=[[1d20]]}} {{save=[[@{save_${name}}]]}}`)
| v#[span(name=`attr_save_${name}`)]
div(data-i18n=name.toUpperCase())
mixin makeSkill(skillName, custom, label)
//- Creates a skill container
Parameters
skillName: Name of the skill. Used for attribute name, button name, and
translation keys. Leave empty for a generic version (for repeating sections).
If skillName === "dummy", an empty div is created instead.
custom: set to true if the skill name should be editable.
label: if custom is true, this will be the default value for the skill name.
Has no effect otherwise.
if (skillName === "dummy")
.dummy(data-i18n-list-item="dummy")
else
- skillPrefix = skillName ? `skill_${skillName}` : "skill";
.skill(data-i18n-list-item=skillName)
button(type="roll", name=`roll_${skillPrefix}`, value!=`&{template:swn-skill} {{system=@{system}}} {{title=${custom ? `@{${skillPrefix}_name}` : `^{${skillName.toUpperCase()}}`}}} {{charname=@{character_name}}} {{mod=[[0 @{modifier_query}]]}} {{dice=[[@{${skillPrefix}_specialist} + @{${skillPrefix}}[Skill] @{modifier_query} @{${skillPrefix}_query}`).invisible-button.display
.display.flex-center
input(type="hidden", name=`attr_${skillPrefix}_specialist`, value="2d6").dice
if (custom)
span(name=`attr_${skillPrefix}_name`).name.ellipsis
else
span(data-i18n=skillName.toUpperCase()).name.ellipsis
select(name=`attr_${skillPrefix}_query`).query.skills-query-hover
each attribute in attributesAbbr
option(value=`@{attribute_query_${attribute}}` data-i18n=`${attribute.toUpperCase()}`)
option(value="@{attribute_query}", data-i18n="ASK", selected)
.skills-query-display
input(type="hidden", name=`attr_${skillPrefix}_query`, value="@{attribute_query}")
each attribute in attributesAbbr
span(class=attribute) + #[span(data-i18n=`${attribute.toUpperCase()}`)]
input(type="hidden", name=`attr_${skillPrefix}`, value="-1").add-plus
span(name=`attr_${skillPrefix}`).level
div(class=["edit", custom ? "flex-wrap" : "flex-center"])
if (custom)
input(type="text", name=`attr_${skillPrefix}_name`, value=label, data-i18n-placeholder="SKILL_NAME").name.ellipsis
else
div(data-i18n=skillName.toUpperCase()).name.ellipsis
select(name=`attr_${skillPrefix}_query`).query
each attribute in attributesAbbr
option(value=`@{attribute_query_${attribute}}` data-i18n=`${attribute.toUpperCase()}`)
option(value="@{attribute_query}", data-i18n="ASK", selected).skills-query-ask
input(type="number", min="-1", value="-1", name=`attr_${skillPrefix}`).level
select(name=`attr_${skillPrefix}_specialist`).dice
option(value="2d6" selected) 2d6
each diceOption in ['3d6', '4d6']
option(value=`${diceOption}d1`) #{diceOption}
option(value="?{@{translation_numdice}|2d6,2d6|3d6,3d6d1|4d6,4d6d2}", data-i18n="ASK")
mixin combatSkillList(skillName, select)
- const selected = skillName === select;
option(class=attributes.class value=`@{skill_${skillName}}` data-i18n=`${skillName.toUpperCase()}` selected=selected)
mixin collapseChevron(attr)
- const attribute = attr ? attrr : "collapse"
input(type="checkbox", name=`attr_${attribute}`, value="1").input-collapse
span.chevron
mixin foci
+sectionheader("show_foci", "FOCI")
.foci.grey-box.simple-repsection
.class-ability.show-chevron.swn.wwn
+collapseChevron("show_focus_details")
button.display.invisible-button(type="roll", name="roll_Class_ability", value!="&{template:swn-default} {{system=@{system}}} {{charname=@{character_name}}} {{title=^{CLASS_ABILITY}}} {{desc=@{class_ability}}}")
.display
.name.ellipsis.flex.border-bottom
div #[span(data-i18n="CLASS_ABILITY")]: #[span(name="attr_class")]
.details
span(name="attr_class_ability")
.edit
.name.ellipsis.flex
div #[span(data-i18n="CLASS_ABILITY")]: #[span(name="attr_class")]
.details
textarea.details(name="attr_class_ability", data-i18n-placeholder="DESCRIPTION")
fieldset.repeating_foci
.show-chevron
input(type="checkbox", name="attr_collapse", value="1").input-collapse
span.chevron
button.display.invisible-button(type="roll", name="roll_Focus", value!="&{template:swn-default} {{system=@{system}}} {{charname=@{character_name}}} {{info=^{FOCUS}}} {{title=@{focus_name}}} {{desc=@{focus_description}}}")
.display
.name.ellipsis.flex
span(name="attr_focus_name")
span.level #[span(data-i18n="LEVEL")]-#[span(name="attr_focus_level")]
.details
span(name="attr_focus_description")
.edit.flex-wrap
+text-input("focus_name", "FOCUS").name.ellipsis
+text-input("focus_level", "LEVEL")(type="number", min="0", value="1").center
textarea.details(name="attr_focus_description", data-i18n-placeholder="DESCRIPTION")
mixin unspentSkillPoints
.skill.skill-points
.display.flex-center
span(data-i18n="UNSPENT_SKILL_POINTS").name.ellipsis
span(name="attr_unspent_skill_points").level
.edit.flex-center
span(data-i18n="UNSPENT_SKILL_POINTS").name.ellipsis
input(type="number", min="0", value="0", name="attr_unspent_skill_points").level
mixin gearStatus(name)
+fake-text-input("STATUS")
select.status(name=`attr_${name}_status`)
option(value="", data-i18n="OTHER", selected)
each status in ["READIED", "STOWED"]
option(value=status, data-i18n=status)
mixin simpleRepeating(name)
fieldset(class=`repeating_${name}`)
.show-chevron.simple-repsection
+collapseChevron()
.display
.grid.grid-flow-col.mb.name.ellipsis
span(name="attr_name")
.details
span(name="attr_description")
.edit
.grid.grid-flow-col.mb
+text-input("name", "NAME").name.ellipsis
.grid
textarea(name="attr_description", data-i18n-placeholder="DESCRIPTION")