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",
"family": "Famille",
"school": "Ecole",
"schoolRank": "Rang",
"schoolrank": "Rang",
"roles": "Rôles",
"distinctions": "Aptitudes",
"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",
"explosives": "Explosifs",
"opportunities": "Opportunités",
"strives": "Conflicts",
"strives": "Conflits",
"difficulty": "Difficulté",
"dicepicker": "Dice Picker"
},

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);

View File

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

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -1,5 +1,10 @@
<div class="dice-picker-dialog">
<form class="noflex" autocomplete="off">
<div class="l5r5e dice-picker-dialog">
<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">
<label>{{localize "l5r5e.approaches"}}:</label>
<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"/>
</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/>
</label>
</li>