Working on Compatibility for FVTT v10

Added `itemUuid` to Roll/RnK
This commit is contained in:
Vlyan
2022-07-26 21:49:02 +02:00
parent baad5c0d6f
commit 66cb3d08ad
5 changed files with 71 additions and 19 deletions

View File

@@ -594,15 +594,21 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
}
/**
* Get the skillId for this weaponId
* Get the skillId and uuid for this weaponId
* @private
*/
_getWeaponSkillId(weaponId) {
const item = this.actor.items.get(weaponId);
if (!!item && item.type === "weapon") {
return item.system.skill;
_getWeaponInfos(weaponId) {
if (!weaponId) {
return null;
}
return null;
const item = this.actor.items.get(weaponId);
if (!item || item.type !== "weapon") {
return null;
}
return {
uuid: item.uuid,
skill: item.system.skill,
};
}
/**
@@ -614,19 +620,15 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
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);
}
const weapon = this._getWeaponInfos(li.data("weapon-id") || null);
new game.l5r5e.DicePickerDialog({
ringId: li.data("ring") || null,
skillId: skillId,
skillId: weapon?.skill || li.data("skill") || null,
skillCatId: li.data("skillcat") || null,
isInitiativeRoll: li.data("initiative") || false,
actor: this.actor,
itemUuid: weapon?.uuid,
}).render(true);
}
@@ -651,6 +653,7 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
ringId: itemData.ring || null,
difficulty: itemData.difficulty || null,
skillsList: itemData.skill || null,
itemUuid: item.uuid,
}).render(true);
}
}