Fix for no actor dice picker
This commit is contained in:
@@ -13,7 +13,7 @@ export class DicePickerDialog extends FormApplication {
|
|||||||
*/
|
*/
|
||||||
object = {
|
object = {
|
||||||
ring: {
|
ring: {
|
||||||
id: null,
|
id: "void",
|
||||||
value: 1,
|
value: 1,
|
||||||
},
|
},
|
||||||
skill: {
|
skill: {
|
||||||
@@ -73,17 +73,19 @@ export class DicePickerDialog extends FormApplication {
|
|||||||
/**
|
/**
|
||||||
* Create dialog
|
* Create dialog
|
||||||
*
|
*
|
||||||
* ex: new game.l5r5e.DicePickerDialog({skillId: 'aesthetics', ringId: 'fire', actor: game.user.character}).render();
|
* ex: new game.l5r5e.DicePickerDialog({skillId: 'aesthetics', ringId: 'water', actor: game.user.character}).render(true);
|
||||||
*
|
*
|
||||||
* Options :
|
* Options :
|
||||||
* actor A instance of actor (game.user.character, canvas.tokens.controlled[0].actor, ...)
|
* actor A instance of actor (game.user.character, canvas.tokens.controlled[0].actor, ...)
|
||||||
* actorId string (AbYgKrNwWeAxa9jT)
|
* actorId string (AbYgKrNwWeAxa9jT)
|
||||||
|
* actorName string (Isawa Aki) Careful this is case sensitive
|
||||||
* ringId string (fire)
|
* ringId string (fire)
|
||||||
* skillId string (design)
|
* skillId string (design)
|
||||||
|
* skillCatId string (artisan)
|
||||||
* difficulty number (0-9)
|
* difficulty number (0-9)
|
||||||
* difficultyHidden boolean
|
* difficultyHidden boolean
|
||||||
*
|
*
|
||||||
* @param options actor, actorId, ringId, skillId, skillCatId, difficulty, difficultyHidden
|
* @param options actor, actorId, ringId, actorName, skillId, skillCatId, difficulty, difficultyHidden
|
||||||
*/
|
*/
|
||||||
constructor(options = {}) {
|
constructor(options = {}) {
|
||||||
super({}, options);
|
super({}, options);
|
||||||
@@ -92,6 +94,7 @@ export class DicePickerDialog extends FormApplication {
|
|||||||
[
|
[
|
||||||
options?.actor,
|
options?.actor,
|
||||||
game.actors.get(options?.actorId),
|
game.actors.get(options?.actorId),
|
||||||
|
game.actors.getName(options?.actorName),
|
||||||
canvas.tokens.controlled[0]?.actor,
|
canvas.tokens.controlled[0]?.actor,
|
||||||
game.user.character,
|
game.user.character,
|
||||||
].forEach((actor) => {
|
].forEach((actor) => {
|
||||||
@@ -135,7 +138,7 @@ export class DicePickerDialog extends FormApplication {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._actor = actor;
|
this._actor = actor;
|
||||||
if (this.object.ring.id === null) {
|
if (this.object.ring.id === "void") {
|
||||||
this.ringId = this._actor.data.data.stance;
|
this.ringId = this._actor.data.data.stance;
|
||||||
this.object.ring.value = this._actor.data.data.rings[this.object.ring.id];
|
this.object.ring.value = this._actor.data.data.rings[this.object.ring.id];
|
||||||
}
|
}
|
||||||
@@ -276,7 +279,7 @@ export class DicePickerDialog extends FormApplication {
|
|||||||
html.find('input[name="approach"]').on("click", async (event) => {
|
html.find('input[name="approach"]').on("click", async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
this.object.ring.id = event.target.dataset.ringid;
|
this.ringId = event.target.dataset.ringid;
|
||||||
this.object.ring.value = parseInt(event.target.value) + (this.object.useVoidPoint ? 1 : 0);
|
this.object.ring.value = parseInt(event.target.value) + (this.object.useVoidPoint ? 1 : 0);
|
||||||
this.render(false);
|
this.render(false);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export class HelpersL5r5e {
|
|||||||
return CONFIG.l5r5e.stances.map((e) => ({
|
return CONFIG.l5r5e.stances.map((e) => ({
|
||||||
id: e,
|
id: e,
|
||||||
label: game.i18n.localize(`l5r5e.rings.${e}`),
|
label: game.i18n.localize(`l5r5e.rings.${e}`),
|
||||||
value: actor?.data?.data?.rings?.[e] || 0,
|
value: actor?.data?.data?.rings?.[e] || 1,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user