ENH: Creation summary
parent
2f3c91d72c
commit
642c368f38
|
@ -252,7 +252,6 @@
|
||||||
"OSE.messages.InflictsDamage": "Inflicts damage!",
|
"OSE.messages.InflictsDamage": "Inflicts damage!",
|
||||||
"OSE.messages.applyDamage": "Apply Damage",
|
"OSE.messages.applyDamage": "Apply Damage",
|
||||||
"OSE.messages.applyHealing": "Apply Healing",
|
"OSE.messages.applyHealing": "Apply Healing",
|
||||||
"OSE.messages.creationFinished": "Character {name} creation finished",
|
|
||||||
|
|
||||||
"OSE.colors.green": "Green",
|
"OSE.colors.green": "Green",
|
||||||
"OSE.colors.red": "Red",
|
"OSE.colors.red": "Red",
|
||||||
|
|
|
@ -41,6 +41,11 @@ export class OseCharacterCreator extends FormApplication {
|
||||||
con: 0,
|
con: 0,
|
||||||
gold: 0
|
gold: 0
|
||||||
}
|
}
|
||||||
|
data.stats = {
|
||||||
|
sum: 0,
|
||||||
|
avg: 0,
|
||||||
|
std: 0
|
||||||
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,9 +69,16 @@ export class OseCharacterCreator extends FormApplication {
|
||||||
stats.find('.sum').text(sum);
|
stats.find('.sum').text(sum);
|
||||||
stats.find('.avg').text(Math.round(10 * sum / n) / 10);
|
stats.find('.avg').text(Math.round(10 * sum / n) / 10);
|
||||||
stats.find('.std').text(Math.round(100 * std) / 100);
|
stats.find('.std').text(Math.round(100 * std) / 100);
|
||||||
|
|
||||||
if (n >= 6) {
|
if (n >= 6) {
|
||||||
$(ev.currentTarget).closest('form').find('button[type="submit"]').removeAttr('disabled');
|
$(ev.currentTarget).closest('form').find('button[type="submit"]').removeAttr('disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.object.data.stats = {
|
||||||
|
sum: sum,
|
||||||
|
avg: Math.round(10 * sum / n) / 10,
|
||||||
|
std: Math.round(100 * std) / 100
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rollScore(score, options = {}) {
|
rollScore(score, options = {}) {
|
||||||
|
@ -97,9 +109,25 @@ export class OseCharacterCreator extends FormApplication {
|
||||||
|
|
||||||
async close() {
|
async close() {
|
||||||
super.close();
|
super.close();
|
||||||
|
// Gather scores
|
||||||
|
let scores = {};
|
||||||
|
$(this.form.children).find(".score-roll").each((_, d) => {
|
||||||
|
let gr = $(d).closest('.form-group');
|
||||||
|
let val = gr.find(".score-value").val();
|
||||||
|
scores[gr.data("score")] = val;
|
||||||
|
})
|
||||||
|
const gold = $(this.form.children).find('.gold-value').val();
|
||||||
const speaker = ChatMessage.getSpeaker({ actor: this });
|
const speaker = ChatMessage.getSpeaker({ actor: this });
|
||||||
|
const templateData = {
|
||||||
|
config: CONFIG.OSE,
|
||||||
|
scores: scores,
|
||||||
|
title: game.i18n.localize("OSE.dialog.generator"),
|
||||||
|
stats: this.object.data.stats,
|
||||||
|
gold: gold
|
||||||
|
}
|
||||||
|
const content = await renderTemplate("/systems/ose/templates/chat/roll-creation.html", templateData)
|
||||||
ChatMessage.create({
|
ChatMessage.create({
|
||||||
content: game.i18n.format("OSE.messages.creationFinished", {name: this.object.name}),
|
content: content,
|
||||||
speaker,
|
speaker,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<section class="ose chat-message">
|
||||||
|
<div class="ose chat-block">
|
||||||
|
<div class="flexrow chat-header">
|
||||||
|
<div class="chat-title"><h2>{{title}}</h2></div>
|
||||||
|
<div class="chat-img" style="background-image:url('{{data.img}}')"></div>
|
||||||
|
</div>
|
||||||
|
<div class="flexrow">
|
||||||
|
<ol class="flex2">
|
||||||
|
{{#each scores as |score id|}}
|
||||||
|
<li class="flexrow">
|
||||||
|
<div style="text-align:right;">
|
||||||
|
{{lookup ../config.scores id}}
|
||||||
|
</div>
|
||||||
|
<div style="text-align:center;">
|
||||||
|
{{score}}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{/each}}
|
||||||
|
</ol>
|
||||||
|
<div style="margin: 0.5em 0">
|
||||||
|
<div>Sum: {{stats.sum}}</div>
|
||||||
|
<div>Avg: {{stats.avg}}</div>
|
||||||
|
<div>σ: {{stats.std}}</div>
|
||||||
|
<hr>
|
||||||
|
<div>Gold: {{gold}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
Loading…
Reference in New Issue