Skip to content

Commit

Permalink
Fixed repeating fieldset buttons not working in the macro bar and fix…
Browse files Browse the repository at this point in the history
…ed an issue with the roll button values not being set hen weapons were imported
  • Loading branch information
DigitalPagan committed Nov 26, 2023
1 parent f337319 commit 819ae9f
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Mythras/Mythras.min.css

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Mythras/Mythras.min.html

Large diffs are not rendered by default.

37 changes: 33 additions & 4 deletions Mythras/pre-minified/Mythras.css
Original file line number Diff line number Diff line change
Expand Up @@ -852,15 +852,11 @@ button[type=action].sheet-penalty {
display: none;
}
/* Styling to collapse repeating items and compactable divs in compact mode */
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset.sheet-compactable ~ .repcontainer,
.sheet-compact-control[value="1"] + div.sheet-wrapper div.sheet-compactable {
display: flex;
flex-wrap: wrap;
gap: 3px;
}
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset.sheet-compactable ~ .repcontainer > .repitem {
display: inline-block;
}
div.sheet-compactable-fieldset-control {
display: none;
}
Expand Down Expand Up @@ -986,6 +982,28 @@ input.sheet-location-name {
}

/* SKills */
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_combatstyle"],
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_professionalskill"],
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_affiliation"],
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_passion"],
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_dependency"],
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_peculiarity"],
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_standardskill"]
{
display: flex;
flex-wrap: wrap;
gap: 3px;
}
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_combatstyle"] > .repitem,
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_professionalskill"] > .repitem,
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_affiliation"] > .repitem,
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_passion"] > .repitem,
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_dependency"] > .repitem,
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_peculiarity"] > .repitem,
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_standardskill"] > .repitem {
display: inline-block;
}

input.sheet-opaque-toggle:not([value="1"]) ~ div.sheet-opaque {
opacity: 50% !important;
}
Expand All @@ -1003,6 +1021,17 @@ button[type=roll].sheet-improve {
}

/* Abilities */
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_ability"],
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_skilledability"] {
display: flex;
flex-wrap: wrap;
gap: 3px;
}
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_ability"] > .repitem,
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_skilledability"] > .repitem {
display: inline-block;
}

.sheet-ability-option {
display: none !important;
}
Expand Down
22 changes: 12 additions & 10 deletions Mythras/pre-minified/Mythras.html
Original file line number Diff line number Diff line change
Expand Up @@ -2578,7 +2578,7 @@ <h2><span data-i18n="conditions">Conditions</span> <button type="roll" class="sh
<button type="roll" title="%{unarmed}" name="roll_unarmed" value="@{roll_display}&{template:skill} {{character=@{character_name}}} {{name=^{unarmed}}} {{combatstyle=1}} {{character_id=@{character_id}}} {{roll=[[1d100]]}} {{fatigue_skills=[[@{fatigue_skills}]]}} {{encumbered=[[1]]}} {{encumbrance_skills=[[@{encumbrance_skills}]]}} {{original=@{unarmed}}} {{difficulty=[[@{difficulty}]]}} {{augmentation=[[@{augmentation}]]}} {{penalty=[[@{penalty}]]}} {{very_easy=[[((@{unarmed}+@{augmentation})*2)+@{penalty}]]}} {{very_easy_crit=[[ceil(((@{unarmed}*2)+@{penalty})/10)]]}} {{very_easy_fumble=[[((@{unarmed}*2)+@{penalty})]]}} {{easy=[[ceil((@{unarmed}+@{augmentation})*1.5)+@{penalty}]]}} {{easy_crit=[[ceil(((@{unarmed}*1.5)+@{penalty})/10)]]}} {{easy_fumble=[[ceil((@{unarmed}*1.5)+@{penalty})]]}} {{standard=[[@{unarmed}+@{augmentation}+@{penalty}]]}} {{standard_crit=[[ceil((@{unarmed}+@{penalty})/10)]]}} {{standard_fumble=[[(@{unarmed}+@{penalty})]]}} {{hard=[[ceil((@{unarmed}+@{augmentation})*.67)+@{penalty}]]}} {{hard_crit=[[ceil(((@{unarmed}*.67)+@{penalty})/10)]]}} {{hard_fumble=[[ceil((@{unarmed}*.67)+@{penalty})]]}} {{formidable=[[ceil((@{unarmed}+@{augmentation})*.5)+@{penalty}]]}} {{formidable_crit=[[ceil(((@{unarmed}*.5)+@{penalty})/10)]]}} {{formidable_fumble=[[ceil((@{unarmed}*.5)+@{penalty})]]}} {{herculean=[[ceil((@{unarmed}+@{augmentation})*@{herculean_mod})+@{penalty}]]}} {{herculean_crit=[[ceil(((@{unarmed}*@{herculean_mod})+@{penalty})/10)]]}} {{herculean_fumble=[[ceil((@{unarmed}*@{herculean_mod})+@{penalty})]]}} {{notes=@{unarmed_notes}}}"><span class="sheet-bold" data-i18n="unarmed"></span> <span name="attr_unarmed"></span>%</button>
</div>
</div>
<fieldset class="repeating_standardskill sheet-compactable">
<fieldset class="repeating_standardskill">
<div class="sheet-flex sheet-detailed">
<div class="sheet-td sheet-grow">
<div class="sheet-full-width sheet-hover-btn">
Expand Down Expand Up @@ -2661,7 +2661,7 @@ <h2><span data-i18n="conditions">Conditions</span> <button type="roll" class="sh
<div class="sheet-flex sheet-compact">
<div class="sheet-th sheet-grow"><div class="sheet-full-width" data-i18n="combat_styles">Combat Styles</div></div>
</div>
<fieldset class="repeating_combatstyle sheet-compactable">
<fieldset class="repeating_combatstyle">
<div class="sheet-flex sheet-detailed">
<div class="sheet-td sheet-grow">
<div class="sheet-full-width sheet-hover-btn">
Expand Down Expand Up @@ -2799,7 +2799,7 @@ <h2><span data-i18n="conditions">Conditions</span> <button type="roll" class="sh
<div class="sheet-flex sheet-compact">
<div class="sheet-th sheet-grow"><div class="sheet-full-width" data-i18n="professional_skills">Professional Skills</div></div>
</div>
<fieldset class="repeating_professionalskill sheet-compactable">
<fieldset class="repeating_professionalskill">
<div class="sheet-flex sheet-detailed">
<div class="sheet-td sheet-grow">
<div class="sheet-full-width sheet-hover-btn">
Expand Down Expand Up @@ -2875,7 +2875,7 @@ <h2><span data-i18n="conditions">Conditions</span> <button type="roll" class="sh
<div class="sheet-flex sheet-compact">
<div class="sheet-th sheet-grow"><div class="sheet-full-width" data-i18n="affiliations">Affiliations</div></div>
</div>
<fieldset class="repeating_affiliation sheet-compactable">
<fieldset class="repeating_affiliation">
<div class="sheet-flex sheet-detailed">
<div class="sheet-td sheet-grow">
<div class="sheet-full-width sheet-hover-btn">
Expand Down Expand Up @@ -2919,7 +2919,7 @@ <h2><span data-i18n="conditions">Conditions</span> <button type="roll" class="sh
<div class="sheet-flex sheet-compact">
<div class="sheet-th sheet-grow"><div class="sheet-full-width" data-i18n="passions">Passions</div></div>
</div>
<fieldset class="repeating_passion sheet-compactable">
<fieldset class="repeating_passion">
<div class="sheet-flex sheet-detailed">
<div class="sheet-td sheet-grow">
<div class="sheet-full-width sheet-hover-btn">
Expand Down Expand Up @@ -2969,7 +2969,7 @@ <h2><span data-i18n="conditions">Conditions</span> <button type="roll" class="sh
<div class="sheet-flex sheet-compact">
<div class="sheet-th sheet-grow"><div class="sheet-full-width" data-i18n="dependencies">Dependencies</div></div>
</div>
<fieldset class="repeating_dependency sheet-compactable">
<fieldset class="repeating_dependency">
<div class="sheet-flex sheet-detailed">
<div class="sheet-td sheet-grow">
<div class="sheet-full-width sheet-hover-btn">
Expand Down Expand Up @@ -3015,7 +3015,7 @@ <h2><span data-i18n="conditions">Conditions</span> <button type="roll" class="sh
<div class="sheet-flex sheet-compact">
<div class="sheet-th sheet-grow"><div class="sheet-full-width" data-i18n="peculiarities">Peculiarities</div></div>
</div>
<fieldset class="repeating_peculiarity sheet-compactable">
<fieldset class="repeating_peculiarity">
<div class="sheet-flex sheet-detailed">
<div class="sheet-td sheet-grow">
<div class="sheet-full-width sheet-hover-btn">
Expand Down Expand Up @@ -3466,7 +3466,7 @@ <h2><span data-i18n="abilities">Abilities</span> <button type="roll" class="shee
<div class="sheet-flex sheet-compact">
<div class="sheet-th sheet-grow"><div class="sheet-full-width" data-i18n="abilities">Abilities</div></div>
</div>
<fieldset class="repeating_ability sheet-compactable">
<fieldset class="repeating_ability">
<input type="hidden" class="sheet-toggle" name="attr_show" value="1">
<div class="sheet-toggle">
<input type="hidden" class="sheet-opaque-toggle" name="attr_favored" value="1">
Expand Down Expand Up @@ -3698,7 +3698,7 @@ <h2><span data-i18n="abilities">Abilities</span> <button type="roll" class="shee
<div class="sheet-th sheet-grow sheet-ability-option sheet-ms"><div class="sheet-full-width" data-i18n="psionic_powers">Psionic Powers</div></div>
</div>
<div class="sheet-bmargin">
<fieldset class="repeating_skilledability sheet-compactable">
<fieldset class="repeating_skilledability">
<div class="sheet-flex sheet-detailed">
<div class="sheet-td">
<div class="sheet-ability-name sheet-hover-btn">
Expand Down Expand Up @@ -9173,7 +9173,7 @@ <h3 data-i18n="weapons">Weapons</h3>
* Imports JSON data from the Mythras Encounter Generator or other sources which use the same data format
*/
on("clicked:import", function() {
getAttrs(['import_json_data', 'import_character', 'setting_option', 'simplified_combat_enabled', 'action_points_calc', 'shaping_traits'], function(v) {
getAttrs(['import_json_data', 'import_character', 'character_id', 'setting_option', 'simplified_combat_enabled', 'action_points_calc', 'shaping_traits'], function(v) {
try {
const jsonData = JSON.parse(v['import_json_data']);
const import_character = parseInt(v['import_character']);
Expand Down Expand Up @@ -9359,6 +9359,7 @@ <h3 data-i18n="weapons">Weapons</h3>

if (weapon["type"] === "ranged") {
newAttrs["repeating_rangedweapon_" + weaponid + "_id"] = `repeating_rangedweapon_${weaponid}`;
newAttrs["repeating_rangedweapon_" + weaponid + "_rollval"] = `%{${v['character_id']}|repeating_rangedweapon_${weaponid}_roll}`;
newAttrs["repeating_rangedweapon_" + weaponid + "_name"] = weapon["name"];
newAttrs["repeating_rangedweapon_" + weaponid + "_force"] = weapon["size"];
newAttrs["repeating_rangedweapon_" + weaponid + "_impale_size"] = weapon["size"];
Expand All @@ -9381,6 +9382,7 @@ <h3 data-i18n="weapons">Weapons</h3>
weaponButtons = weaponButtons + ` [${weapon["name"]}](~@{character_id}|repeating_rangedweapon_${weaponid}_damage)`;
} else {
newAttrs["repeating_meleeweapon_" + weaponid + "_id"] = `repeating_meleeweapon_${weaponid}`;
newAttrs["repeating_meleeweapon_" + weaponid + "_rollval"] = `%{${v['character_id']}|repeating_meleeweapon_${weaponid}_roll}`;
newAttrs["repeating_meleeweapon_" + weaponid + "_name"] = weapon["name"];
newAttrs["repeating_meleeweapon_" + weaponid + "_size"] = weapon["size"];
newAttrs["repeating_meleeweapon_" + weaponid + "_reach"] = weapon["reach"];
Expand Down
4 changes: 0 additions & 4 deletions Mythras/templates/sheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -852,15 +852,11 @@ button[type=action].sheet-penalty {
display: none;
}
/* Styling to collapse repeating items and compactable divs in compact mode */
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset.sheet-compactable ~ .repcontainer,
.sheet-compact-control[value="1"] + div.sheet-wrapper div.sheet-compactable {
display: flex;
flex-wrap: wrap;
gap: 3px;
}
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset.sheet-compactable ~ .repcontainer > .repitem {
display: inline-block;
}
div.sheet-compactable-fieldset-control {
display: none;
}
Expand Down
33 changes: 33 additions & 0 deletions Mythras/templates/sheet_types/character/character.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,28 @@ input.sheet-location-name {
}

/* SKills */
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_combatstyle"],
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_professionalskill"],
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_affiliation"],
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_passion"],
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_dependency"],
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_peculiarity"],
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_standardskill"]
{
display: flex;
flex-wrap: wrap;
gap: 3px;
}
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_combatstyle"] > .repitem,
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_professionalskill"] > .repitem,
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_affiliation"] > .repitem,
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_passion"] > .repitem,
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_dependency"] > .repitem,
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_peculiarity"] > .repitem,
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_standardskill"] > .repitem {
display: inline-block;
}

input.sheet-opaque-toggle:not([value="1"]) ~ div.sheet-opaque {
opacity: 50% !important;
}
Expand All @@ -88,6 +110,17 @@ button[type=roll].sheet-improve {
}

/* Abilities */
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_ability"],
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_skilledability"] {
display: flex;
flex-wrap: wrap;
gap: 3px;
}
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_ability"] > .repitem,
.sheet-compact-control[value="1"] + div.sheet-wrapper fieldset ~ .repcontainer[data-groupname="repeating_skilledability"] > .repitem {
display: inline-block;
}

.sheet-ability-option {
display: none !important;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ <h2><span data-i18n="abilities">Abilities</span> <button type="roll" class="shee
<div class="sheet-flex sheet-compact">
<div class="sheet-th sheet-grow"><div class="sheet-full-width" data-i18n="abilities">Abilities</div></div>
</div>
<fieldset class="repeating_ability sheet-compactable">
<fieldset class="repeating_ability">
<input type="hidden" class="sheet-toggle" name="attr_show" value="1">
<div class="sheet-toggle">
<input type="hidden" class="sheet-opaque-toggle" name="attr_favored" value="1">
Expand Down Expand Up @@ -649,7 +649,7 @@ <h2><span data-i18n="abilities">Abilities</span> <button type="roll" class="shee
<div class="sheet-th sheet-grow sheet-ability-option sheet-ms"><div class="sheet-full-width" data-i18n="psionic_powers">Psionic Powers</div></div>
</div>
<div class="sheet-bmargin">
<fieldset class="repeating_skilledability sheet-compactable">
<fieldset class="repeating_skilledability">
<div class="sheet-flex sheet-detailed">
<div class="sheet-td">
<div class="sheet-ability-name sheet-hover-btn">
Expand Down
4 changes: 3 additions & 1 deletion Mythras/templates/sheet_types/character/character_import.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const megMagicSkillIds = ['binding', 'devotion', 'exhort', 'folk_magic', 'invoca
* Imports JSON data from the Mythras Encounter Generator or other sources which use the same data format
*/
on("clicked:import", function() {
getAttrs(['import_json_data', 'import_character', 'setting_option', 'simplified_combat_enabled', 'action_points_calc', 'shaping_traits'], function(v) {
getAttrs(['import_json_data', 'import_character', 'character_id', 'setting_option', 'simplified_combat_enabled', 'action_points_calc', 'shaping_traits'], function(v) {
try {
const jsonData = JSON.parse(v['import_json_data']);
const import_character = parseInt(v['import_character']);
Expand Down Expand Up @@ -207,6 +207,7 @@ on("clicked:import", function() {

if (weapon["type"] === "ranged") {
newAttrs["repeating_rangedweapon_" + weaponid + "_id"] = `repeating_rangedweapon_${weaponid}`;
newAttrs["repeating_rangedweapon_" + weaponid + "_rollval"] = `%{${v['character_id']}|repeating_rangedweapon_${weaponid}_roll}`;
newAttrs["repeating_rangedweapon_" + weaponid + "_name"] = weapon["name"];
newAttrs["repeating_rangedweapon_" + weaponid + "_force"] = weapon["size"];
newAttrs["repeating_rangedweapon_" + weaponid + "_impale_size"] = weapon["size"];
Expand All @@ -229,6 +230,7 @@ on("clicked:import", function() {
weaponButtons = weaponButtons + ` [${weapon["name"]}](~@{character_id}|repeating_rangedweapon_${weaponid}_damage)`;
} else {
newAttrs["repeating_meleeweapon_" + weaponid + "_id"] = `repeating_meleeweapon_${weaponid}`;
newAttrs["repeating_meleeweapon_" + weaponid + "_rollval"] = `%{${v['character_id']}|repeating_meleeweapon_${weaponid}_roll}`;
newAttrs["repeating_meleeweapon_" + weaponid + "_name"] = weapon["name"];
newAttrs["repeating_meleeweapon_" + weaponid + "_size"] = weapon["size"];
newAttrs["repeating_meleeweapon_" + weaponid + "_reach"] = weapon["reach"];
Expand Down
Loading

0 comments on commit 819ae9f

Please sign in to comment.