Added simple notes field to rolls. Allows users to add a note to each roll that will display in the results. "Attacking the Devourer of Souls" or whatever.
This commit is contained in:
parent
029f8dfc81
commit
1a830d3823
4 changed files with 21 additions and 11 deletions
|
@ -91,12 +91,16 @@ export class BladesActor extends Actor {
|
|||
<option value="great">${game.i18n.localize('BITD.EffectGreat')}</option>
|
||||
</select>
|
||||
</div>`;
|
||||
} else {
|
||||
} else {
|
||||
content += `
|
||||
<input id="pos" name="pos" type="hidden" value="">
|
||||
<input id="fx" name="fx" type="hidden" value="">`;
|
||||
}
|
||||
}
|
||||
content += `
|
||||
<div className="form-group">
|
||||
<label>${game.i18n.localize('BITD.Notes')}:</label>
|
||||
<input id="note" name="note" type="text" value="">
|
||||
</div><br/>
|
||||
</form>
|
||||
`;
|
||||
|
||||
|
@ -111,7 +115,8 @@ export class BladesActor extends Actor {
|
|||
let modifier = parseInt(html.find('[name="mod"]')[0].value);
|
||||
let position = html.find('[name="pos"]')[0].value;
|
||||
let effect = html.find('[name="fx"]')[0].value;
|
||||
await this.rollAttribute(attribute_name, modifier, position, effect);
|
||||
let note = html.find('[name="note"]')[0].value;
|
||||
await this.rollAttribute(attribute_name, modifier, position, effect, note);
|
||||
}
|
||||
},
|
||||
no: {
|
||||
|
@ -126,7 +131,7 @@ export class BladesActor extends Actor {
|
|||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
async rollAttribute(attribute_name = "", additional_dice_amount = 0, position, effect) {
|
||||
async rollAttribute(attribute_name = "", additional_dice_amount = 0, position, effect, note) {
|
||||
|
||||
let dice_amount = 0;
|
||||
if (attribute_name !== "") {
|
||||
|
@ -138,7 +143,7 @@ export class BladesActor extends Actor {
|
|||
}
|
||||
dice_amount += additional_dice_amount;
|
||||
|
||||
await bladesRoll(dice_amount, attribute_name, position, effect);
|
||||
await bladesRoll(dice_amount, attribute_name, position, effect, note);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* @param {string} position
|
||||
* @param {string} effect
|
||||
*/
|
||||
export async function bladesRoll(dice_amount, attribute_name = "", position = "risky", effect = "standard") {
|
||||
export async function bladesRoll(dice_amount, attribute_name = "", position = "risky", effect = "standard", note = "") {
|
||||
|
||||
// ChatMessage.getSpeaker(controlledToken)
|
||||
let zeromode = false;
|
||||
|
@ -17,7 +17,7 @@ export async function bladesRoll(dice_amount, attribute_name = "", position = "r
|
|||
|
||||
// show 3d Dice so Nice if enabled
|
||||
r.evaluate({async:true});
|
||||
await showChatRollMessage(r, zeromode, attribute_name, position, effect);
|
||||
await showChatRollMessage(r, zeromode, attribute_name, position, effect, note);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,7 +29,7 @@ export async function bladesRoll(dice_amount, attribute_name = "", position = "r
|
|||
* @param {string} position
|
||||
* @param {string} effect
|
||||
*/
|
||||
async function showChatRollMessage(r, zeromode, attribute_name = "", position = "", effect = "") {
|
||||
async function showChatRollMessage(r, zeromode, attribute_name = "", position = "", effect = "", note = "") {
|
||||
|
||||
let speaker = ChatMessage.getSpeaker();
|
||||
let rolls = (r.terms)[0].results;
|
||||
|
@ -66,11 +66,11 @@ async function showChatRollMessage(r, zeromode, attribute_name = "", position =
|
|||
effect_localize = 'BITD.EffectStandard'
|
||||
}
|
||||
|
||||
result = await renderTemplate("systems/blades-in-the-dark/templates/chat/action-roll.html", {rolls: rolls, roll_status: roll_status, attribute_label: attribute_label, position: position, position_localize: position_localize, effect: effect, effect_localize: effect_localize});
|
||||
result = await renderTemplate("systems/blades-in-the-dark/templates/chat/action-roll.html", {rolls: rolls, roll_status: roll_status, attribute_label: attribute_label, position: position, position_localize: position_localize, effect: effect, effect_localize: effect_localize, note: note});
|
||||
} else {
|
||||
let stress = getBladesRollStress(rolls, zeromode);
|
||||
|
||||
result = await renderTemplate("systems/blades-in-the-dark/templates/chat/resistance-roll.html", {rolls: rolls, roll_status: roll_status, attribute_label: attribute_label, stress: stress});
|
||||
result = await renderTemplate("systems/blades-in-the-dark/templates/chat/resistance-roll.html", {rolls: rolls, roll_status: roll_status, attribute_label: attribute_label, stress: stress, note: note});
|
||||
}
|
||||
|
||||
let messageData = {
|
||||
|
|
|
@ -47,7 +47,9 @@
|
|||
</p>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if note}}
|
||||
<em>{{note}}</em>
|
||||
{{/if}}
|
||||
<ol class="dice-rolls">
|
||||
{{#each this.rolls}}
|
||||
{{#if this.result}}
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
<div class="die success">{{localize "BITD.RollSuccess"}}</div>
|
||||
<div class="description"><p>{{{localize "BITD.RollResistance" stress=stress}}}</p></div>
|
||||
{{/if}}
|
||||
{{#if note}}
|
||||
<em>{{note}}</em>
|
||||
{{/if}}
|
||||
|
||||
<ol class="dice-rolls">
|
||||
{{#each this.rolls}}
|
||||
|
|
Reference in a new issue