test picker with img

actor perm and selected character
fix for some key case in french lang
This commit is contained in:
Vlyan
2020-12-10 23:34:41 +01:00
parent 88162a11c4
commit 8f59902130
10 changed files with 43 additions and 14 deletions

View File

@@ -29,7 +29,7 @@ export class DicePickerDialog extends Application {
id: "l5r5e-dice-picker-dialog",
classes: ["l5r5e", "dice-picker-dialog"],
template: "systems/l5r5e/templates/dice/dice-picker-dialog.html",
width: 400,
width: 480,
// height: 400,
// title: "L5R Dice Roller",
actor: null,
@@ -44,9 +44,9 @@ export class DicePickerDialog extends Application {
constructor(options = null) {
super(options);
// Get Actor from: sheet, selected token, nothing
const actor = options?.actor || canvas.tokens.controlled[0]?.actor || null;
if (actor instanceof Actor) {
// Get Actor from: options, 1st selected token, selected character
const actor = options?.actor || canvas.tokens.controlled[0]?.actor || game.user.character || null;
if (actor instanceof Actor && actor.owner) {
this.actor = actor;
}
@@ -133,7 +133,7 @@ export class DicePickerDialog extends Application {
roll.l5r5e.stance = approach;
roll.l5r5e.skillId = this.skillData.id;
roll.l5r5e.actor = this.actor;
roll.actor = this.actor;
await roll.roll();
await roll.toMessage();

View File

@@ -44,6 +44,10 @@ export class RollL5r5e extends Roll {
// TODO parse difficulty stance skillId from cmd line ?
}
set actor(actor) {
this.l5r5e.actor = (actor instanceof Actor && actor.owner) || null;
}
/**
* Execute the Roll, replacing dice and evaluating the total result
* @override
@@ -259,6 +263,11 @@ export class RollL5r5e extends Roll {
type: template,
content: this._total,
sound: CONFIG.sounds.dice,
speaker: {
actor: this.l5r5e.actor?._id || null,
token: this.l5r5e.actor?.token || null,
alias: this.l5r5e.actor?.name || null,
},
},
messageData
);

View File

@@ -75,6 +75,12 @@ Hooks.once("init", async function () {
return game.i18n.localize(key);
});
Handlebars.registerHelper("localizeSkillId", function (skillName) {
const key =
"l5r5e.skills." + RollL5r5e.getCategoryForSkillId(skillName.toLowerCase()) + "." + skillName.toLowerCase();
return game.i18n.localize(key);
});
Handlebars.registerHelper("localizeRing", function (ringName) {
const key = "l5r5e.rings." + ringName.toLowerCase();
return game.i18n.localize(key);

View File

@@ -111,7 +111,7 @@ export class ActorSheetL5r5e extends ActorSheet {
*/
async _createFeat() {
const data = {
name: game.i18n.localize("L5r5e.FeatPlaceholderName"),
name: game.i18n.localize("l5r5e.featplaceholdername"),
type: "feat",
};
const created = await this.actor.createEmbeddedEntity("OwnedItem", data);