Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forbidden Lands #13551

Merged
merged 5 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 55 additions & 38 deletions Forbidden_Lands/Forbidden_Lands.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@

/* announcements */
.charsheet input.announcements-show.toggle-monster-only {
height: 1.85em;
height: 1.5em;
position: absolute;
right: 0;
width: 5.25em;
top: 3.5em;
width: 3.5em;
top: 3.25em;
z-index: 2;
}

Expand Down Expand Up @@ -142,7 +142,7 @@
border-radius: 5px;
float: right;
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-size: 0.85em;
font-size: 0.75em;
margin: -3.25em 0 0 -5em;
padding: 0 4px 0 4px;
position: relative;
Expand Down Expand Up @@ -404,14 +404,15 @@
}

.charsheet .wrapper div.tab-contents.character div.announcements.toggle-monster-only {
display: block;
height: 380px;
margin-top: 1.15em;
margin: auto;
max-height: 460px;
min-height: 180px;
overflow-x: hidden;
overflow-y: scroll;
padding-inline: 15px;
padding: 5px 10px 5px 10px;
position: absolute;
right: 5%;
right: 2.75em;
top: 1.25em;
width: 70%;
z-index: 2;
}
Expand Down Expand Up @@ -514,18 +515,17 @@
}

.charsheet div.header-top {
align-items: baseline;
background-color: #000;
color: #fff;
display: grid;
font-weight: bold;
grid-column: 1/-1;
grid-template: inherit;
margin: 0 0 0 -10px;
max-height: 4em;
min-height: 2.5em;
text-align: center;
width: calc(106% + 2px);
align-items: baseline;
background-color: #000;
color: #fff;
display: grid;
font-weight: bold;
grid-column: 1/-1;
grid-template: inherit;
margin: 0 0 0 -10px;
min-height: 3.25em;
text-align: center;
width: calc(106% + 2px);
}

.charsheet .attributes-box1 .header-top h1,
Expand Down 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
76 changes: 56 additions & 20 deletions Forbidden_Lands/Forbidden_Lands.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
<input type="checkbox" class="announcements-show" name="attr_show_announcements" value="1" data-i18n-title="close-announcements" title="Close Announcements" />
<span class="announcements-exit" data-i18n-title="close">*</span><br>
<h3 data-i18n="latest-announcements">Latest Announcements</h3>
<span class="footer">11/24/24</span>
<span class="footer">11/27/24</span>
<ol>
<strong>v1.9</strong>
<li>Fixed a bug where PC Strength could get switched to '7' when moving between the PC and Monster tab.</li>
<li>Push your rolls without the API! The sheet's rolls have been updated with CRP(custom roll parsing). You can now roll your dice pool and push them directly from the chat window without having to manually adjust the pool and re-rolling. (thank you Richard for letting me mangle your MYZ CRP code for this.)</li>
<li>Consumable rolls will now auto-decrement the resource's die size on failed rolls.</li>
<li>The roll template now displays the dice pool results horizontally.</li>
Expand Down Expand Up @@ -646,7 +647,7 @@ <h1 data-i18n="critical-u">CRITICAL INJURIES</h1>
<span data-i18n="effects">Effects</span>
</div>
<div class="injuries-box6 column-header-bottom">
<span data-i18n="healing-time" style="white-space:nowrap; margin-left:-2.75em;">Healing Time</span>
<span data-i18n="healing-time" style="margin-left:-4.4em;">Healing Time</span>
</div>
<div class="injuries-box7">
<fieldset class="repeating_injuries">
Expand Down Expand Up @@ -699,7 +700,7 @@ <h1 data-i18n="weapon-u">WEAPONS</h1>
<span data-i18n="total-abbr">Tot</span>
</div>
<div class="weapons-box10 column-header-bottom">
<span data-i18n="bonus">Bonus</span>
<span data-i18n="bonus-abbr">Bonus</span>
</div>
<div class="weapons-box11 column-header-bottom">
<span data-i18n="max-abbr">Max</span>
Expand Down Expand Up @@ -3037,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 @@ -3050,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 @@ -4902,32 +4918,32 @@ <h1 data-i18n="stronghold-notes-u">STRONGHOLD NOTES</h1>
on('change:tab change:strength_pc change:strength_monster sheet:opened', (eventInfo) => {
getAttrs(['tab', 'strength', 'strength_pc', 'strength_monster'], (v) => {
// clog(`Change Detected: ${eventInfo.sourceAttribute}`);
const settings = {};
const output = {};
const tab = int(v.tab, 1); // sets tab to 1 if not recognized - so goes to pc tab;
const str = int(v.strength);
let pc = int(v.strength_pc);
let monster = int(v.strength_monster);
const hiddenStrength = int(v.strength);
let strengthPC = int(v.strength_pc);
let strengthMonster = int(v.strength_monster);
let forceupdate = 0;

// check if character existed before strength_pc or _monster stats were introduced.
if (str > 0) {
if (pc === 0 || monster === 0) forceupdate = 1;
if (pc === 0) {
pc = str;
settings.strength_pc = str;
if (hiddenStrength > 0) {
if (strengthPC === 0 || strengthMonster === 0) forceupdate = 1;
if (strengthPC === 0) {
strengthPC = hiddenStrength;
output.strength_pc = hiddenStrength;
}
if (monster === 0) {
monster = str;
settings.strength_monster = str;
if (strengthMonster === 0) {
strengthMonster = hiddenStrength;
output.strength_monster = hiddenStrength;
}
}
// if tab is not pc or monster, end the function and leave strength unchanged
if (tab !== 1 && tab !== 3 && !forceupdate) return;

// if tab = 1 or 3, set strength to the appropriate value
settings.strength = tab === 3 ? monster : pc;
output.strength = tab === 3 ? strengthMonster : strengthPC;

setAttrs(settings);
setAttrs(output);
});
});

Expand Down Expand Up @@ -6403,11 +6419,15 @@ <h1 data-i18n="stronghold-notes-u">STRONGHOLD NOTES</h1>

stats.forEach((stat) => {
on(`change:${stat} change:tab`, function (eventInfo) {
getAttrs([stat, 'tab'], function (values) {
getAttrs([stat, 'tab', 'strength_pc', 'strength_monster'], function (values) {
const total = int(values[stat]);
const tab = int(values.tab);
let max = 7;
// monsters(tab 3) can have a 48 max
const max = tab === 3 && stat === 'strength' ? 48 : 7;
const pc = int(values.strength_pc);
const monster = int(values.strength_monster);
max = tab !== 2 && stat === 'strength' ? Math.min(monster, 48) : Math.min(pc, 7);

const settings = checkMax(stat, total, max);
if (settings) setAttrs(settings);
});
Expand Down Expand Up @@ -6539,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