Files
roll20-character-sheets-tester/Stars_Without_Number_Revised/Source/pug/mixins.pug
T

138 lines
6.3 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 if no label is specified)
.section-toggle-header
input(type="checkbox", name=`attr_${name}`, value="1", data-i18n-title="SHOW_HIDE", checked)
h1
if (label)
span(data-i18n=label)
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
Parameters
name: underlying attribute name (without "attr_")
label: i18n code for the label (block is inserted if no label is specified)
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)&attributes(attributes)
if (label)
.label(data-i18n=label)
else
.label
block
mixin text-input-duo(name1, name2, label, attributes2)
//- Creates a pair of underlined inputs with a slash inbetween
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 if no label is specified)
attributes2: will be passed on as the attributes of the second input
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)
input(type="number", name=`attr_${name1}`)&attributes(attributes)
span /
input(type="number", name=`attr_${name2}`)&attributes(attributes2)
if (label)
.label(data-i18n=label)
else
block
mixin fake-text-input(label)
//- 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
Attributes
class is passed on to the containing label
label(class=["text-input", attributes.class])
block
.label(data-i18n=label)
mixin makeSave(name)
//- Creates a saving throw button
Parameters
name: underlying attribute name (without "attr_"). Also used as
button name, and for translation keys.
.blue-button
input(type="hidden", name=`attr_save_${name}`, value="15")
button(name=`roll_save_${name}`, type="roll", value!=`&{template:swn-save} {{charname=@{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} {{title=${custom ? `@{${skillPrefix}_name}` : `^{${skillName.toUpperCase()}}`}}} {{charname=@{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
else
span(data-i18n=skillName.toUpperCase()).name
select(name=`attr_${skillPrefix}_query`).query.skills-query-hover
option(value="@{attribute_query_str}", data-i18n="STRENGTH_SHORT")
option(value="@{attribute_query_dex}", data-i18n="DEXTERITY_SHORT")
option(value="@{attribute_query_con}", data-i18n="CONSTITUTION_SHORT")
option(value="@{attribute_query_int}", data-i18n="INTELLIGENCE_SHORT")
option(value="@{attribute_query_wis}", data-i18n="WISDOM_SHORT")
option(value="@{attribute_query_cha}", data-i18n="CHARISMA_SHORT")
option(value="@{attribute_query}", data-i18n="ASK", selected)
.skills-query-display
input(type="hidden", name=`attr_${skillPrefix}_query`, value="@{attribute_query}")
span.str + #[span(data-i18n="STRENGTH_SHORT")]
span.dex + #[span(data-i18n="DEXTERITY_SHORT")]
span.con + #[span(data-i18n="CONSTITUTION_SHORT")]
span.int + #[span(data-i18n="INTELLIGENCE_SHORT")]
span.wis + #[span(data-i18n="WISDOM_SHORT")]
span.cha + #[span(data-i18n="CHARISMA_SHORT")]
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
else
div(data-i18n=skillName.toUpperCase()).name
select(name=`attr_${skillPrefix}_query`).query
option(value="@{attribute_query_str}", data-i18n="STRENGTH_SHORT")
option(value="@{attribute_query_dex}", data-i18n="DEXTERITY_SHORT")
option(value="@{attribute_query_con}", data-i18n="CONSTITUTION_SHORT")
option(value="@{attribute_query_int}", data-i18n="INTELLIGENCE_SHORT")
option(value="@{attribute_query_wis}", data-i18n="WISDOM_SHORT")
option(value="@{attribute_query_cha}", data-i18n="CHARISMA_SHORT")
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
option(value="3d6d1") 3d6
option(value="4d6d2") 4d6
option(value="?{@{translation_numdice}|2d6,2d6|3d6,3d6d1|4d6,4d6d2}", data-i18n="ASK")