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;
}
}

File diff suppressed because one or more lines are too long

View File

@@ -45,6 +45,11 @@
}
}
// If DicePicker add a pointer
.dice-picker {
cursor: url("../assets/cursors/pointer.webp"), pointer;
}
// Dice Picker
.dice-picker-dialog {
// Utility

View File

@@ -1,7 +1,7 @@
<li class="item weapon flexcol toggle-on-click" data-toggle="item-description-{{item._id}}">
<ul class="item-header item-control">
<li class="item-img"><img src="{{item.img}}" title="{{item.name}}" width="32px" height="32px"/></li>
<li class="item-name">{{ item.name }}</li>
<li class="item-name dice-picker" data-weapon-id="{{item._id}}">{{ item.name }}</li>
<li class="icon-stat-container">
<i class="fas fa-arrows-alt-h" title="{{ localize 'l5r5e.weapons.range' }}"> {{item.data.range}}</i>
<i class="fas fa-tint" title="{{ localize 'l5r5e.weapons.damage' }}"> {{item.data.damage}}</i>