Add Raider option to sheet

This commit is contained in:
timdenee
2026-04-29 09:41:52 +12:00
parent d9597397e7
commit 4e4c97fcf6
2 changed files with 73 additions and 64 deletions
+38 -49
View File
@@ -440,72 +440,61 @@ input[type="checkbox"] {
/* END OF SHEET-CHARACTER */
/* SHEET TOGGLE */
.sheet-toggle-checkbox {
display: none;
}
/* SHEET MODE DROPDOWN */
/* Container for toggle button positioning */
/* Container for dropdown positioning */
.ui-dialog .charsheet {
position: relative;
}
.sheet-toggle-btn {
position: absolute;
display: inline-block !important;
top: -10px;
right: -10px;
.sheet-mode-select {
position: absolute !important;
top: -10px !important;
right: -10px !important;
z-index: 1000;
background-color: #18282e;
width: 75px !important;
max-width: 75px !important;
background-color: #18282e !important;
color: #f9f9f9 !important;
width: 70px !important;
height: 22px;
text-align: center !important;
padding: 0px !important;
border: 1px solid #538da3;
border-radius: 5px;
font-family: "Pirata One";
font-size: 14px;
height: 22px !important;
padding: 0 4px !important;
border: 2px solid #548da3 !important;
border-radius: 5px !important;
font-family: "Pirata One" !important;
font-size: 14px !important;
cursor: pointer;
appearance: auto;
}
.sheet-toggle-btn:hover {
.sheet-mode-select:hover {
background-color: #a7a984;
}
.sheet-mode-select option {
background-color: #18282e;
color: #f9f9f9;
}
/* Sheet visibility based on checkbox */
input[name="attr_sheet_toggle"]:checked ~ .knight-sheet {
display: none;
}
/* Sheet visibility based on selected mode.
Knight and Raider modes both render the .knight-sheet container —
the difference is which .knight-only / .raider-only blocks are shown.
Default (Knight) is the natural state; only npcs/raider need overrides. */
.sheet-mode-select:has(option[value="npcs"]:checked) ~ .knight-sheet { display: none !important; }
.sheet-mode-select:has(option[value="npcs"]:checked) ~ .npc-sheet { display: block !important; }
.npc-sheet { display: none; }
input[name="attr_sheet_toggle"]:checked ~ .npc-sheet {
display: block !important;
}
/* Knight-only / Raider-only sub-sections within the shared character sheet.
The label `display: flex !important` rule near the top of this file forces
us to use !important here, with explicit display values per element type
when restoring visibility. */
.raider-only { display: none !important; }
input[name="attr_sheet_toggle"]:not(:checked) ~ .knight-sheet {
display: block;
}
.sheet-mode-select:has(option[value="raider"]:checked) ~ .knight-sheet .knight-only { display: none !important; }
.sheet-mode-select:has(option[value="raider"]:checked) ~ .knight-sheet label.raider-only { display: flex !important; }
.sheet-mode-select:has(option[value="raider"]:checked) ~ .knight-sheet input.raider-only { display: inline-block !important; }
input[name="attr_sheet_toggle"]:not(:checked) ~ .npc-sheet {
display: none;
}
/* Button text visibility */
input[name="attr_sheet_toggle"]:checked ~ .sheet-toggle-btn .knight-btn-text {
display: none;
}
input[name="attr_sheet_toggle"]:checked ~ .sheet-toggle-btn .npc-btn-text {
display: inline;
}
input[name="attr_sheet_toggle"]:not(:checked) ~ .sheet-toggle-btn .knight-btn-text {
display: inline;
}
input[name="attr_sheet_toggle"]:not(:checked) ~ .sheet-toggle-btn .npc-btn-text {
display: none;
.feat-checkbox {
margin-right: 6px;
}
.npc-content {
+35 -15
View File
@@ -8,12 +8,12 @@
<button type="action" name="act_notes">Notes</button>
</div> -->
<!-- END OF SHEET SELECTOR -->
<!-- TOGGLE BUTTON -->
<input type="checkbox" name="attr_sheet_toggle" id="sheet-toggle" class="sheet-toggle-checkbox" />
<label for="sheet-toggle" class="sheet-toggle-btn">
<span class="knight-btn-text">Knight</span>
<span class="npc-btn-text">NPCs</span>
</label>
<!-- MODE DROPDOWN -->
<select name="attr_sheet_mode" class="sheet-mode-select">
<option value="knight" selected>Knight</option>
<option value="raider">Raider</option>
<option value="npcs">NPCs</option>
</select>
<!-- KNIGHT SHEET -->
<div class="knight-sheet">
@@ -32,12 +32,18 @@
</label>
</div>
<div class="header-line">
<label>Glory:
<label class="knight-only">Glory:
<input type="number" name="attr_glory" />
</label>
<label>Rank:
<label class="raider-only">Gold:
<input type="number" name="attr_glory" />
</label>
<label class="knight-only">Rank:
<input type="text" name="attr_rank" readonly />
</label>
<label class="raider-only">Rank:
<input type="text" name="attr_raider_rank" readonly />
</label>
<label>Age:
<select name="attr_age" class="age_select">
<option value="Young" selected>Young</option>
@@ -236,8 +242,8 @@
<div class="recovery-oath-feats-gambits">
<div class="top-row">
<div class="oath-section">
<h3>OATH</h3>
<div class="oath-content">
<h3 class="knight-only">OATH</h3>
<div class="oath-content knight-only">
<p>Seek the Myths</p>
<p>Honour the Seers</p>
<p>Protect the Realm</p>
@@ -255,11 +261,11 @@
<div class="feats-section">
<h3>FEATS</h3>
<div class="feats-content">
<p><strong>SMITE</strong> - +d12 or Blast to a melee attack.<br>
<p><input type="checkbox" name="attr_raider_feat_smite" value="1" class="raider-only feat-checkbox" /><strong>SMITE</strong> - +d12 or Blast to a melee attack.<br>
<em>VIG Save or become Fatigued.</em></p>
<p><strong>FOCUS</strong> - Perform a Gambit without using a die.<br>
<p><input type="checkbox" name="attr_raider_feat_focus" value="1" class="raider-only feat-checkbox" /><strong>FOCUS</strong> - Perform a Gambit without using a die.<br>
<em>CLA Save or become Fatigued.</em></p>
<p><strong>DENY</strong> - Discard a damage die rolled against you or a nearby Ally.<br>
<p><input type="checkbox" name="attr_raider_feat_deny" value="1" class="raider-only feat-checkbox" /><strong>DENY</strong> - Discard a damage die rolled against you or a nearby Ally.<br>
<em>SPI Save or become Fatigued.</em></p>
</div>
</div>
@@ -426,7 +432,7 @@
<!-- END OF KNIGHT SHEET -->
<!-- NPC SHEET -->
<div class="npc-sheet" style="display: none;">
<div class="npc-sheet">
<div class="companions-section">
<h3>NPCs</h3>
<fieldset class="repeating_npc">
@@ -573,6 +579,15 @@
<!-- END OF ROLLTEMPLATES -->
<!-- SCRIPTS -->
<script type="text/worker">
// Migrate old binary sheet_toggle (0/1) → sheet_mode (knight/npcs)
on("sheet:opened", function() {
getAttrs(["sheet_mode", "sheet_toggle"], function(values) {
if (values.sheet_mode) return;
var newMode = values.sheet_toggle === "1" ? "npcs" : "knight";
setAttrs({ sheet_mode: newMode });
});
});
// Tabs
const buttonlist = ["character", "property", "notes"];
buttonlist.forEach((button) => {
@@ -717,16 +732,21 @@
getAttrs(["glory"], function(values) {
var glory = parseInt(values["glory"]) || 0;
var rank = "Knight-Errant";
var raiderRank = "Sea Worm";
if (glory >= 3 && glory <= 5) {
rank = "Knight-Gallant";
raiderRank = "Sea Crow";
} else if (glory >= 6 && glory <= 8) {
rank = "Knight-Tenant";
raiderRank = "Sea Wolf";
} else if (glory >= 9 && glory <= 11) {
rank = "Knight Dominant";
raiderRank = "Sea Bear";
} else if (glory >= 12) {
rank = "Knight-Radiant";
raiderRank = "Sea Hawk";
}
setAttrs({"rank": rank});
setAttrs({ rank: rank, raider_rank: raiderRank });
});
});
</script>