diff --git a/Mongoose_Traveller2e/MongooseTraveller.css b/Mongoose_Traveller2e/MongooseTraveller.css
index 5a2e275535d..73cbba5bc38 100644
--- a/Mongoose_Traveller2e/MongooseTraveller.css
+++ b/Mongoose_Traveller2e/MongooseTraveller.css
@@ -759,7 +759,7 @@ input.sheet-power:checked ~ div.sheet-laf-gridbody {
}
.sheet-hidden {
- display: none;
+ display: none !important;
}
/* ----- Hide actual sheet reset ----- */
@@ -2249,4 +2249,125 @@ input.sheet-laf-ship-component-hider {
.sheet-trade-parsecs {
display: grid;
grid-template-columns: 0.97fr 0.1fr 0.35fr 0.1fr 0.35fr 0.1fr 0.35fr 0.1fr 0.35fr 0.1fr 0.35fr 0.1fr 0.35fr 2fr;
-}
\ No newline at end of file
+}
+
+
+/*
+ * Charmancer stuff
+ */
+button.sheet-tight_button {
+ border: 0;
+ color: red;
+ font-size: 2em;
+ font-weight: bold;
+ height: unset;
+ padding: 0;
+ width: unset;
+}
+
+button.sheet-proceed_button[type="action"] {
+ background-color: blue;
+ color: white;
+ font-weight: bold;
+ width: 80px;
+}
+
+button.sheet-cancel_button[type="action"] {
+ background-color: red;
+ color: white;
+ font-weight: bold;
+ width: 80px;
+}
+
+div.sheet-charmancer_stats-wrapper{
+ display: flex;
+ flex-flow: column wrap;
+}
+
+div.sheet-charmancer_stats-header {
+ align-items: center;
+ display: flex;
+ flex-flow: row wrap;
+ justify-content: flex-start;
+}
+
+span.sheet-charmancer_roll-panel {
+ align-items: center;
+ display: flex;
+ column-gap: 0.5em;
+ flex-flow: row wrap;
+ justify-content: flex-start;
+
+ >select {
+ width: 10em;
+ margin-bottom: 0;
+ }
+}
+
+div.sheet-charmancer_stats-footer {
+ align-items: center;
+ display: flex;
+ flex-flow: row wrap;
+ justify-content: flex-end;
+}
+
+div.sheet-charmancer_stats-content {
+ border: 2px solid blue;
+ display: flex;
+ column-gap: 0.5em;
+ flex-flow: row wrap;
+ justify-content: center;
+ margin: 0.5em;
+ padding: 2px 0 2px 0;
+ row-gap: 0.5em;
+}
+
+div.sheet-charmancer_stat-panel {
+ align-items: center;
+ display: flex;
+ column-gap: 0.5em;
+ flex-flow: row;
+ justify-content: flex-start;
+
+ > input[type="text"] {
+ padding: 0;
+ text-align: center;
+ width: 1.5em;
+ };
+
+ > span {
+ align-items: center;
+ display: flex;
+ column-gap: 0.5em;
+ flex-flow: row;
+ justify-content: flex-start;
+
+ > input[type="radio"] {
+ display: none;
+ };
+
+ > label {
+ border: 1px solid black;
+ border-radius: 5px;
+ font-weight: normal;
+ margin: 0;
+ padding: 0;
+ };
+
+ > input[type="radio"]:checked + label {
+ color: white;
+ background-color: black;
+ font-weight: bold;
+ };
+
+ };
+}
+
+span.sheet-charmancer_actions-panel {
+ align-items: center;
+ display: flex;
+ column-gap: 1em;
+ flex-flow: row wrap;
+ justify-content: flex-end;
+}
+
diff --git a/Mongoose_Traveller2e/MongooseTraveller.html b/Mongoose_Traveller2e/MongooseTraveller.html
index 32e1c1e8497..55bb6848d16 100644
--- a/Mongoose_Traveller2e/MongooseTraveller.html
+++ b/Mongoose_Traveller2e/MongooseTraveller.html
@@ -58,72 +58,203 @@
-
-
- Rating
- Temp
- Mod
-
- Rating
- Temp
- Mod
-
- Rating
- Temp
- Mod
-
-
+
+
+
Prime
@@ -8677,18 +8808,164 @@
Trade Log
});
+ /*
+ * Charactermancer stuff
+ */
+
+ const charmancerRollValues = ['charmancer_roll1', 'charmancer_roll2', 'charmancer_roll3',
+ 'charmancer_roll4', 'charmancer_roll5', 'charmancer_roll6'];
+
+
+ const charmancerRollAssignments = ['charmancer_roll1_assignment', 'charmancer_roll2_assignment',
+ 'charmancer_roll3_assignment', 'charmancer_roll4_assignment',
+ 'charmancer_roll5_assignment', 'charmancer_roll6_assignment'];
+
+ on('sheet:opened', function(eventInfo) {
+ showOrHideRollStats();
+ });
+
+ stats.forEach(stat => {
+ on(`change:base-${stat.toLowerCase()}`, showOrHideRollStats);
+ });
+
+ function showOrHideRollStats() {
+ const baseStats = stats.map(stat => `base-${stat}`);
+ getAttrs(baseStats, hash => {
+ const sum = Object.values(hash).reduce((a,b) => parseInt(a)+parseInt(b));
+ const element = $20("button.sheet-roll_stats");
+ if(sum == 0) {
+ element.removeClass('sheet-hidden');
+ } else {
+ element.addClass('sheet-hidden');
+ }
+
+ });
+ }
+
+ function toggleRollStatsPanel() {
+ $20('div.sheet-characteristics-wrapper,div.sheet-charmancer_stats-wrapper').toggleClass('sheet-hidden');
+ }
+
+ function ensureAge18() {
+ // set age to 18 if it's unset
+ getAttrs(["character_age"], (stats) => {
+ if(stats.character_age == "") {
+ setAttrs({"character_age": 18});
+ }
+ });
+ }
+
+ function resetRollAssignments() {
+ var newAttrs = {};
+ for(let ii=0; ii<6 ;ii++) {
+ newAttrs[charmancerRollAssignments[ii]] = `base-${stats[ii]}`;
+ }
+ setAttrs(newAttrs);
+ }
+
+ on('clicked:roll-stats', function(eventInfo) {
+ ensureAge18();
+ resetRollAssignments();
+ toggleRollStatsPanel();
+ });
+
+ on('clicked:generate-stats', function(eventInfo) {
+ getAttrs(['charmancer_roll_method'], (generator) => {
+ const method = generator['charmancer_roll_method'];
+
+ var template = ['&{template:default}'];
+
+ if(method == 'yolo') {
+ template.push('{{name=Generate Characteristics (YOLO)}}');
+ template.push('{{STR=[[2d6]]}}');
+ template.push('{{DEX=[[2d6]]}}');
+ template.push('{{END=[[2d6]]}}');
+ template.push('{{INT=[[2d6]]}}');
+ template.push('{{EDU=[[2d6]]}}');
+ template.push('{{SOC=[[2d6]]}}');
+ } else {
+ template.push(`{{name=Generate Characteristics (${method.substring(2, method.length-2)})}}`);
+ for(let ii=1; ii < 7; ii++) {
+ template.push(`{{roll ${ii}=${method}}}`);
+ }
+ }
+
+ startRoll(template.join(' '), (results) => {
+ const rolls = results.results;
+
+ finishRoll(results.rollId, rolls);
+
+ if(method == 'yolo') {
+ setAttrs({
+ 'base-Strength': rolls.STR.result,
+ 'base-Dexterity': rolls.DEX.result,
+ 'base-Endurance': rolls.END.result,
+ 'base-Intellect': rolls.INT.result,
+ 'base-Education': rolls.EDU.result,
+ 'base-Social': rolls.SOC.result,
+ }, toggleRollStatsPanel);
+
+ } else {
+ setAttrs({
+ 'charmancer_roll1': rolls['roll 1'].result,
+ 'charmancer_roll2': rolls['roll 2'].result,
+ 'charmancer_roll3': rolls['roll 3'].result,
+ 'charmancer_roll4': rolls['roll 4'].result,
+ 'charmancer_roll5': rolls['roll 5'].result,
+ 'charmancer_roll6': rolls['roll 6'].result
+ });
+ }
+
+ });
+ });
+ });
+ on(['change:charmancer_roll1_assignment', 'change:charmancer_roll2_assignment',
+ 'change:charmancer_roll3_assignment', 'change:charmancer_roll4_assignment',
+ 'change:charmancer_roll5_assignment', 'change:charmancer_roll6_assignment',
+ ].join(' '),
+ function(eventInfo) {
+ // swap stat with old assignment
+ getAttrs(charmancerRollAssignments, (assignments) => {
+ const oldValue = eventInfo.previousValue;
+ if(!oldValue) return;
+ const newAttr = eventInfo.sourceAttribute;
+ const newValue = eventInfo.newValue;
+ const oldAttr = Object.keys(assignments).find(key => {return key != newAttr && assignments[key] === newValue});
+ if(!oldAttr || newAttr == oldAttr) return;
+ // I don't now of another way to do this
+ var ii = {};
+ ii[oldAttr] = oldValue;
+ setAttrs(ii);
+ });
+ }
+ );
+ on('clicked:assign-stats', function(eventInfo) {
+ getAttrs(charmancerRollAssignments.concat(charmancerRollValues), (attrs) => {
+ const newAttrs = {};
+ for(let ii=1; ii<7 ;ii++) {
+ const attr = attrs[`charmancer_roll${ii}_assignment`];
+ const value = attrs[`charmancer_roll${ii}`];
+ newAttrs[attr] = value;
+ }
+ setAttrs(newAttrs);
+ });
+ toggleRollStatsPanel();
+ });
+ on('clicked:cancel-roll-stats', function(eventInfo) {
+ toggleRollStatsPanel();
+ });
-
\ No newline at end of file
+
diff --git a/Mongoose_Traveller2e/sheet.json b/Mongoose_Traveller2e/sheet.json
index a49e73e9b8c..b70c53bd113 100644
--- a/Mongoose_Traveller2e/sheet.json
+++ b/Mongoose_Traveller2e/sheet.json
@@ -1,8 +1,8 @@
{
"html": "MongooseTraveller.html",
"css": "MongooseTraveller.css",
- "authors": "Fabian D., Martin P., Simon B.",
- "roll20userid": "869232, 2450577, 2447813",
+ "authors": "Fabian D., Martin P., Simon B., Scott S.",
+ "roll20userid": "869232, 2450577, 2447813, 2779855",
"preview": "MongooseTraveller.png",
"instructions": "You can roll skills directly from the sheet, by clicking on the corresponding name or the roll button at the beginning of the row.",
"useroptions": [
diff --git a/Mongoose_Traveller2e/translation.json b/Mongoose_Traveller2e/translation.json
index 75b48a22c47..b50f68a5076 100644
--- a/Mongoose_Traveller2e/translation.json
+++ b/Mongoose_Traveller2e/translation.json
@@ -222,5 +222,12 @@
"clairvoyance-u": "Clairvoyance",
"telekinesis-u": "Telekinesis",
"awareness-u": "Awareness",
- "teleportation-u": "Teleportation"
-}
\ No newline at end of file
+ "teleportation-u": "Teleportation",
+ "method-u": "Method: ",
+ "generate-u": "Generate",
+ "2d6-u": "2d6",
+ "2d6reroll1s-u": "2d6 reroll 1's",
+ "yolo-u": "YOLO",
+ "assign-u": "Assign",
+ "cancel-u": "Cancel"
+}