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

This commit is contained in:
Vlyan
2020-12-10 18:05:54 +01:00
parent 21a75c5c09
commit 534a02a323
2 changed files with 10 additions and 9 deletions

View File

@@ -142,11 +142,13 @@ export class DicePickerDialog extends Application {
// Check if a stance is selected
let selectedStance = "air";
["air", "earth", "fire", "water", "void"].forEach((e) => {
if (this.actor.data.data?.stances?.[e]?.isSelected?.value) {
selectedStance = e;
}
});
if (this.actor) {
["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");
}
@@ -167,13 +169,12 @@ export class DicePickerDialog extends Application {
};
const cat = RollL5r5e.getCategoryForSkillId(skillId);
if (!this.actor || !cat) {
if (!cat) {
return;
}
this.skillData.cat = cat;
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.value = this.actor?.data?.data?.skills[cat]?.[this.skillData.id].value || 0;
}
/**