Skip to content

Commit

Permalink
willpower changed to checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
vince-roll20 committed Nov 28, 2024
1 parent 8d85a09 commit 2e8f36a
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 18 deletions.
51 changes: 34 additions & 17 deletions Forbidden_Lands/Forbidden_Lands.css
Original file line number Diff line number Diff line change
Expand Up @@ -941,10 +941,10 @@
box-sizing: border-box;
}

/* Fake radio using xbox for Experience/Willpower */
.charsheet input[type="radio"].xbox + span::before {
/* Fake radio using xbox for Willpower */
.charsheet .willpower-grid .xbox + span::before {
background-image: url('https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/Forbidden_Lands/images/xbox_empty.png');
content: url('https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/Forbidden_Lands/images/xbox_checked.png');
content: "";
display: inline-block;
font-size: 24px;
height: 15px;
Expand All @@ -955,21 +955,21 @@
width: 15px;
}

.charsheet input.xbox {
margin-top: 3px;
opacity: 0;
width: 16px;
z-index: 1;
.charsheet .willpower-grid input.xbox {
opacity: 0;
position: relative;
right: -4px;
width: 1.25em;
z-index: 1;
}

/* Removes xbox from all radios _after_ selected one */
.charsheet input[type="radio"]:checked ~ input[type="radio"].xbox + span::before,
.charsheet input[type="radio"].xbox:checked ~ input[type="radio"].xbox + span::before {
content: "";
.charsheet .willpower-grid .xbox:checked + span::before,
.charsheet .willpower-grid .xbox:has(~ .xbox:checked) + span::before {
content: url('https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/Forbidden_Lands/images/xbox_checked.png');
}

/* Fake radio using xbox for Conditions */
.charsheet input[type="checkbox"].xbox + span::before {
.charsheet .conditions-grid input.xbox + span::before {
background-image: url('https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/Forbidden_Lands/images/xbox_empty.png');
content: url('https://raw.githubusercontent.com/Roll20/roll20-character-sheets/master/Forbidden_Lands/images/xbox_checked.png');
display: inline-block;
Expand All @@ -982,18 +982,18 @@
width: 15px;
}

.charsheet .conditions-grid > div input.xbox {
height: 20px;
.charsheet .conditions-grid input.xbox {
margin: 1px 0 0 0;
opacity: 0;
transform-origin: left;
transform: scaleX(4.5);
width: 20px;
z-index: 1;
min-width: 1.5em;
min-height: 28px;
}

/* Removes xbox from all radios _after_ selected one */
.charsheet input[type="checkbox"].xbox:not(:checked) + span::before {
.charsheet .conditions-grid input.xbox:not(:checked) + span::before {
content: "";
}

Expand Down Expand Up @@ -1579,6 +1579,22 @@
display: none;
}

.charsheet button.reset {
height: 1em;
opacity: 0;
position: relative;
right: -18px;
width: .5em;
}

.charsheet button.reset + span::after {
content: "1";
font-family: pictos;
font-size: 1.35em;
left: -6px;
position: relative;
}

.charsheet input[type="radio"]:checked::after,
.charsheet input[type="radio"]:not(:checked)::after {
content: "1";
Expand All @@ -1588,6 +1604,7 @@
top: -5px;
}

.charsheet button.reset:hover + span::after,
.charsheet input[type="radio"]:hover:checked::after,
.charsheet input[type="radio"]:hover:not(:checked)::after {
color: #a60002;
Expand Down
33 changes: 32 additions & 1 deletion Forbidden_Lands/Forbidden_Lands.html
Original file line number Diff line number Diff line change
Expand Up @@ -3038,7 +3038,7 @@ <h1 data-i18n="coins-u">COINS</h1>
<div class="willpower-box1 header-top">
<h1 data-i18n="willpower-u" style="margin-left: 3em;">WILLPOWER</h1>
</div>
<div class="willpower-box2">
<!-- <div class="willpower-box2">
<input type="radio" name="attr_willpower" value="0" data-i18n-title="no-willpower" title="No Willpower" style="margin: 3px 6px 3px 3px;" checked />
<input class="xbox" type="radio" name="attr_willpower" value="1" title="1 @{willpower}" /><span></span> <input
class="xbox" type="radio" name="attr_willpower" value="2" title="2 @{willpower}" /><span></span>
Expand All @@ -3051,6 +3051,21 @@ <h1 data-i18n="willpower-u" style="margin-left: 3em;">WILLPOWER</h1>
<input class="xbox" type="radio" name="attr_willpower" value="9" title="9 @{willpower}" /><span></span> <input
class="xbox" type="radio" name="attr_willpower" value="10" title="10 @{willpower}" /><span></span>
<input type="hidden" name="attr_willpower_max" value="10" />
</div> -->
<div class="willpower-box2">
<button class="reset" type="action" name="act_reset" data-i18n-title="no-willpower" title="No Willpower"></button><span></span>
<input class="hidden" type="checkbox" name="attr_willpower" value="0" checked />
<input class="xbox" type="checkbox" name="attr_willpower" value="1" title="1 @{willpower}" /><span></span>
<input class="xbox" type="checkbox" name="attr_willpower" value="2" title="2 @{willpower}" /><span></span>
<input class="xbox" type="checkbox" name="attr_willpower" value="3" title="3 @{willpower}" /><span></span>
<input class="xbox" type="checkbox" name="attr_willpower" value="4" title="4 @{willpower}" /><span></span>
<input class="xbox" type="checkbox" name="attr_willpower" value="5" title="5 @{willpower}" /><span></span>
<input class="xbox" type="checkbox" name="attr_willpower" value="6" title="6 @{willpower}" /><span></span>
<input class="xbox" type="checkbox" name="attr_willpower" value="7" title="7 @{willpower}" /><span></span>
<input class="xbox" type="checkbox" name="attr_willpower" value="8" title="8 @{willpower}" /><span></span>
<input class="xbox" type="checkbox" name="attr_willpower" value="9" title="9 @{willpower}" /><span></span>
<input class="xbox" type="checkbox" name="attr_willpower" value="10" title="10 @{willpower}" /><span></span>
<input type="hidden" name="attr_willpower_max" value="10" />
</div>
<span class="willpower-box3">=</span>
<div class="willpower-box4">
Expand Down Expand Up @@ -6544,6 +6559,22 @@ <h1 data-i18n="stronghold-notes-u">STRONGHOLD NOTES</h1>
});
});

/* willpower */
on('clicked:reset change:willpower', (eventInfo) => {
getAttrs(['willpower'], (v) => {
const zero = eventInfo.triggerName.replace('clicked:', '');
const output = {};
const newValue = +v.willpower;
const previousValue = eventInfo.previousValue;
if (eventInfo.triggerName === 'clicked:reset') {
output.willpower = 0;
} else if (newValue === 0) {
output.willpower = previousValue - 1;
}
setAttrs(output, {silent: true});
});
});

/* delete empty repeating rows w/out having to close/reopen sheet */
on(
'remove:repeating_injuries remove:repeating_talents remove:repeating_gear remove:repeating_mount_gear remove:repeating_cart_gear remove:repeating_relationships remove:repeating_spells remove:repeating_beasts remove:repeating_notes remove:repeating_functions remove:repeating_stronghold-stockpile remove:repeating_stronghold-notes remove:repeating_hirelings remove:repeating_monster',
Expand Down

0 comments on commit 2e8f36a

Please sign in to comment.