fix actor for dice picker dialog, and add pack for macros

This commit is contained in:
Vlyan
2020-12-10 18:01:00 +01:00
parent ca69a8f182
commit 21a75c5c09
5 changed files with 22 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
node_modules node_modules
system/lib/ system/lib/
system/packs/
.editorconfig .editorconfig
.idea .idea
.vscode .vscode

View File

@@ -1,5 +1,6 @@
node_modules/ node_modules/
system/lib/ system/lib/
system/packs/
*.hbs *.hbs
*.css *.css
.idea .idea

1
system/packs/macros.db Normal file
View File

@@ -0,0 +1 @@
{"_id":"rWFmQHPlIpLB3qou","name":"L5R5e Dice Picker","permission":{"default":1,"5kJBcDAAfAognDuD":3},"type":"script","flags":{"furnace":{"runAsGM":false}},"scope":"global","command":"new game.l5r5e.DicePickerDialog().render();","author":"ZjNlNTgyMmI0ZjBj","img":"systems/l5r5e/assets/dices/default/skill_et.png","actorIds":[]}

View File

@@ -8,7 +8,7 @@ export class DicePickerDialog extends Application {
/** /**
* Current Actor * Current Actor
*/ */
actor = {}; actor = null;
/** /**
* Selected Skill data from actor * Selected Skill data from actor
@@ -50,8 +50,6 @@ export class DicePickerDialog extends Application {
this.actor = actor; this.actor = actor;
} }
console.log(this.actor); // TODO TMP
// Skill ? // Skill ?
if (options?.skillId) { if (options?.skillId) {
this.setSkillData(options.skillId); this.setSkillData(options.skillId);
@@ -142,8 +140,14 @@ export class DicePickerDialog extends Application {
await this.close(); await this.close();
}); });
// Default Selected // Check if a stance is selected
html.find("#approach_air").trigger("click"); let selectedStance = "air";
["air", "earth", "fire", "water", "void"].forEach((e) => {
if (this.actor.data.data?.stances?.[e]?.isSelected?.value) {
selectedStance = e;
}
});
html.find(`#approach_${selectedStance}`).trigger("click");
html.find("#skill_" + this.skillData.value).trigger("click"); html.find("#skill_" + this.skillData.value).trigger("click");
} }
@@ -168,10 +172,8 @@ export class DicePickerDialog extends Application {
} }
this.skillData.cat = cat; this.skillData.cat = cat;
this.skillData.value = this.actor.data.data.skills[cat]?.[this.skillData.id].value || 0; this.skillData.value = this.actor.data?.data?.skills[cat]?.[this.skillData.id].value || 0;
this.skillData.name = game.i18n.localize("l5r5e.skills." + cat + "." + this.skillData.id); this.skillData.name = game.i18n.localize("l5r5e.skills." + cat + "." + this.skillData.id);
console.log("****** skillData", this.skillData, this.actor.data.data.skills);
} }
/** /**
@@ -183,7 +185,7 @@ export class DicePickerDialog extends Application {
return { return {
id: e, id: e,
label: game.i18n.localize(`l5r5e.rings.${e}`), label: game.i18n.localize(`l5r5e.rings.${e}`),
value: this.actor ? this.actor.data.data.rings[e] : 0, value: this.actor?.data?.data?.rings?.[e] || 0,
}; };
}); });
} }

View File

@@ -7,11 +7,8 @@
"compatibleCoreVersion": "1.0.0", "compatibleCoreVersion": "1.0.0",
"author": "Team L5R", "author": "Team L5R",
"scripts": ["./l5r-ui/scripts/l5rui-chat-color.js"], "scripts": ["./l5r-ui/scripts/l5rui-chat-color.js"],
"esmodules": ["./l5r-ui/scripts/help/l5rui-help.js", "./scripts/dice-l5r5e.js", "./scripts/main-l5r5e.js"], "esmodules": ["./l5r-ui/scripts/help/l5rui-help.js", "./scripts/dice-l5r5e.js", "./scripts/main-l5r5e.js"],
"styles": ["./l5r-ui/css/l5rui.css", "./l5r-ui/css/cursor.css", "./styles/l5r5e.css"], "styles": ["./l5r-ui/css/l5rui.css", "./l5r-ui/css/cursor.css", "./styles/l5r5e.css"],
"languages": [ "languages": [
{ {
"lang": "en", "lang": "en",
@@ -34,9 +31,15 @@
"path": "lang/pt-br.json" "path": "lang/pt-br.json"
} }
], ],
"background": "L5R-Header.webp", "background": "L5R-Header.webp",
"packs": [], "packs": [
{
"name": "macros",
"label": "L5R5e Macros",
"path": "packs/macros.db",
"entity": "Macro"
}
],
"url": "https://gitlab.com/teaml5r/l5r5e", "url": "https://gitlab.com/teaml5r/l5r5e",
"manifest": "https://gitlab.com/teaml5r/l5r5e/-/raw/master/system/system.json", "manifest": "https://gitlab.com/teaml5r/l5r5e/-/raw/master/system/system.json",
"download": "https://gitlab.com/teaml5r/l5r5e/-/jobs/artifacts/v0.0.2/raw/l5r5e.zip?job=build" "download": "https://gitlab.com/teaml5r/l5r5e/-/jobs/artifacts/v0.0.2/raw/l5r5e.zip?job=build"