Quick weapon link to DP on conflict sheet

This commit is contained in:
Vlyan
2021-01-23 14:52:09 +01:00
parent d0bf736d84
commit 46b5618257
4 changed files with 27 additions and 3 deletions

View File

@@ -172,8 +172,15 @@ export class BaseSheetL5r5e extends ActorSheet {
event.preventDefault();
event.stopPropagation();
const li = $(event.currentTarget);
let skillId = li.data("skill") || null;
const weaponId = li.data("weapon-id") || null;
if (weaponId) {
skillId = this._getWeaponSkillId(weaponId);
}
new game.l5r5e.DicePickerDialog({
skillId: li.data("skill") || null,
skillId: skillId,
skillCatId: li.data("skillcat") || null,
isInitiativeRoll: li.data("initiative") || false,
actor: this.actor,
@@ -374,4 +381,16 @@ export class BaseSheetL5r5e extends ActorSheet {
tmpItem.update({ data });
}
/**
* Get the skillId for this weaponId
* @private
*/
_getWeaponSkillId(weaponId) {
const item = this.actor.getOwnedItem(weaponId);
if (!!item && item.type === "weapon") {
return item.data.data.skill;
}
return null;
}
}