added custom dice roller

This commit is contained in:
Bodo Hüsemann
2022-03-20 20:10:39 +01:00
parent f9ad37fd67
commit e0d709720b
4 changed files with 67 additions and 15 deletions
+10
View File
@@ -4,6 +4,16 @@ This is a rewrite based on the early 2e (basic) and 1e edition that also include
# Release History
## 02.09.00 (Build 12)
### Features
- added custom dice roller
### CSS
- added "msg-alt" label for the MSG-custom roll template that will remove the yellow background from inlined rolls. This is usefull when using custom roll tables for events (e.g. hazards)
## 02.08.00 (Build 11)
### Features
-1
View File
@@ -546,7 +546,6 @@
grid-template-columns: 60px 40px 20px 40px 60px;
align-items: center;
}
.charsheet div.attribute label.left {
white-space: break-spaces;
margin-left: 12px;
+51 -13
View File
@@ -234,6 +234,30 @@
</div>
<label><span data-i18n="injury">Injury</span><input name="attr_injury" type="text"></label>
<br />
<h3>Custom Dice Roller</h3>
<div class="sheet-row">
<input class="center" type="text" data-i18n-placeholder="custom-rollname-placeholder"
name="attr_customrollname">
</div>
<div class="sheet-row">
<label><span data-i18n="custom-featdie"></span>
<select name="attr_customfeatdie" class="center">
<option value="-1">None</option>
<option value="1" selected="selected">Normal</option>
<option value="2">Favoured</option>
<option value="0">Ill-favoured</option>
</select>
</label>
</div>
<div class="sheet-row">
<label><span data-i18n="custom-successdice"></span>
<input class="center" type="number" value="0" name="attr_customsuccessdice">
</label>
<label><span data-i18n="custom-tn"></span>
<input class="center" type="number" value="14" name="attr_customtn">
</label>
<button type="action" class="parsed-rolls" name="act_customroll" id="roll_custom"></button>
</div>
<br />
<div class="center">
<label data-i18n="parsed-rolls">Parsed rolls</label>
@@ -2128,6 +2152,19 @@
clog(`Completed first roll: weapon_${index}`);
});
// Custom roll
on('clicked:customroll', async (ev) => {
clog(`Starting first roll`);
let data = await asw.getAttrs(['character_name', 'customfeatdie', 'customtn', 'customsuccessdice', 'customrollname', 'favourill_id']),
action = `Custom: ${data.customrollname}`,
actfeat = int(data.customfeatdie),
actdice = int(data.customsuccessdice),
acttn = int(data.customtn);
clog(`First roll: ${JSON.stringify(data)}, Action : ${action}`);
await rollFirst(data.character_name, action, actdice, acttn, actfeat, "custom");
clog(`Completed first roll`);
});
/*==================
Migration scripts.
@@ -2244,24 +2281,25 @@
</div>
<div class="sheet-half-col sheet-die-title sheet-feat-label">Feat<br/>Die</div>
<div class="sheet-half-col sheet-die-title sheet-success-label">Success<br /> Dice</div>
{{#rollTotal() computed::feat 12}}
<div class="sheet-half-col sheet-die-result sheet-feat-die">
<span class="sheet-rotated-box"><span class="sheet-fullcrit">{{computed::feat}}</span><span class="sheet-gandalf"></span></span>
</div>
{{/rollTotal() computed::feat 12}}
{{#rollTotal() computed::feat 11}}
<div class="sheet-half-col sheet-die-result sheet-feat-die">
<span class="sheet-rotated-box"><span class="sheet-fullfail">{{computed::feat}}</span><span class="sheet-eye"></span></span>
</div>
{{/rollTotal() computed::feat 11}}
{{#rollTotal() computed::feat 0}}
<div class="sheet-half-col sheet-die-result sheet-feat-die"><span class="sheet-rotated-box"><span>-</span></span></div>
{{/rollTotal() computed::feat 0}}
{{#rollBetween() computed::feat 1 10}}
<div class="sheet-half-col sheet-die-result sheet-feat-die">
<span class="sheet-rotated-box">{{computed::feat}}</span>
</div>
{{/rollBetween() computed::feat 1 10}}
{{^feat}}
<div class="sheet-half-col sheet-die-result sheet-feat-die"><span class="sheet-rotated-box"><span>-</span></span></div>
{{/feat}}
{{#rollTotal() computed::feat 11}}
<div class="sheet-half-col sheet-die-result sheet-feat-die">
<span class="sheet-rotated-box"><span class="sheet-fullfail">{{computed::feat}}</span><span
class="sheet-eye"></span></span>
</div>
{{/rollTotal() computed::feat 11}}
{{#rollTotal() computed::feat 12}}
<div class="sheet-half-col sheet-die-result sheet-feat-die">
<span class="sheet-rotated-box"><span class="sheet-fullcrit">{{computed::feat}}</span><span class="sheet-gandalf"></span></span>
</div>
{{/rollTotal() computed::feat 12}}
<div class="sheet-half-col sheet-die-result sheet-success-die"><span class="sheet-rotated-box">{{r1}}</span></div>
<div class="sheet-half-col sheet-die-comment sheet-favoured">
{{#favoured}}{{favoured}}{{/favoured}}
+6 -1
View File
@@ -219,5 +219,10 @@
"stance-open": "Open",
"stance-defensive": "Def.",
"stance-rearward": "Rear",
"stance-damage": "Stance Damage:"
"stance-damage": "Stance Damage:",
"custom-roll": "Custom Roll:",
"custom-tn": "TN:",
"custom-successdice": "Success:",
"custom-featdie": "Feat:",
"custom-rollname-placeholder": "Roll Text"
}