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

@@ -36,7 +36,7 @@
"clan": "Clan", "clan": "Clan",
"family": "Famille", "family": "Famille",
"school": "Ecole", "school": "Ecole",
"schoolRank": "Rang", "schoolrank": "Rang",
"roles": "Rôles", "roles": "Rôles",
"distinctions": "Aptitudes", "distinctions": "Aptitudes",
"distinctionstip": "Lorsque vous effectuez un test auquel s'applique une aptitude, vous pouvez relancer jusqu'à 2 dés.", "distinctionstip": "Lorsque vous effectuez un test auquel s'applique une aptitude, vous pouvez relancer jusqu'à 2 dés.",
@@ -51,7 +51,7 @@
"successes": "Succès", "successes": "Succès",
"explosives": "Explosifs", "explosives": "Explosifs",
"opportunities": "Opportunités", "opportunities": "Opportunités",
"strives": "Conflicts", "strives": "Conflits",
"difficulty": "Difficulté", "difficulty": "Difficulté",
"dicepicker": "Dice Picker" "dicepicker": "Dice Picker"
}, },

View File

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

View File

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

View File

@@ -75,6 +75,12 @@ Hooks.once("init", async function () {
return game.i18n.localize(key); 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) { Handlebars.registerHelper("localizeRing", function (ringName) {
const key = "l5r5e.rings." + ringName.toLowerCase(); const key = "l5r5e.rings." + ringName.toLowerCase();
return game.i18n.localize(key); return game.i18n.localize(key);

View File

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

View File

@@ -3,9 +3,9 @@
@import "../scss/global"; @import "../scss/global";
@import "../scss/fonts"; @import "../scss/fonts";
@import "../scss/ui"; @import "../scss/ui";
@import "../scss/dices";
.l5r5e { .l5r5e {
@import "../scss/dices";
@import "../scss/sheets"; @import "../scss/sheets";
@import "../scss/nav"; @import "../scss/nav";
@import "../scss/rings"; @import "../scss/rings";

File diff suppressed because one or more lines are too long

View File

@@ -2,7 +2,7 @@
// dices.scss // dices.scss
// Dice in chat // Dice in chat
.l5r5e.chat-dice > img { .chat-dice > img {
border: 1px solid transparent; border: 1px solid transparent;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
@@ -17,3 +17,12 @@
flex: 0 0 20px; flex: 0 0 20px;
display: inline-block; display: inline-block;
} }
.dice-picker-dialog {
.profil {
float: left;
}
.dices {
float: right;
}
}

View File

@@ -1,5 +1,10 @@
<div class="dice-picker-dialog"> <div class="l5r5e dice-picker-dialog">
<form class="noflex" autocomplete="off">
<div class="form-group l5r5e profil">
<img class="profile-img" src="{{#if actor.img}}{{actor.img}}{{/if}}{{^if actor.img}}icons/svg/mystery-man.svg{{/if}}" data-edit="img" height="100" width="100">
</div>
<form class="noflex l5r5e dices" autocomplete="off">
<div class="form-group"> <div class="form-group">
<label>{{localize "l5r5e.approaches"}}:</label> <label>{{localize "l5r5e.approaches"}}:</label>
<div class="form-fields"> <div class="form-fields">

View File

@@ -41,7 +41,7 @@
<input class="centered-input" type="text" name="data.void_points.current" value="{{data.void_points.current}}" data-dtype="Number"/> <input class="centered-input" type="text" name="data.void_points.current" value="{{data.void_points.current}}" data-dtype="Number"/>
</label> </label>
<label class="attribute-label"> <label class="attribute-label">
{{ localize 'L5r5e.max' }} {{ localize 'l5r5e.max' }}
<input class="centered-input" type="text" name="data.void_points.max" value="{{data.void_points.max}}" data-dtype="Number" disabled/> <input class="centered-input" type="text" name="data.void_points.max" value="{{data.void_points.max}}" data-dtype="Number" disabled/>
</label> </label>
</li> </li>