Skip to content

Commit

Permalink
Bug fix to tool form ability quick actions
Browse files Browse the repository at this point in the history
  • Loading branch information
aaclayton committed Feb 10, 2020
1 parent de2627d commit ebed88c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 38 deletions.
36 changes: 0 additions & 36 deletions module/actor/sheets/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,40 +588,4 @@ export class ActorSheet5e extends ActorSheet {
};
new ActorTraitSelector(this.actor, options).render(true)
}


/* -------------------------------------------- */

/**
* TODO REMOVE THIS ASAP
* @override
*/
_onSortItem(event, itemData) {

// TODO - for now, don't allow sorting for Token Actor ovrrides
if (this.actor.isToken) return;

// Get the drag source and its siblings
const source = this.actor.getOwnedItem(itemData._id);
const siblings = this._getSortSiblings(source);

// Get the drop target
const dropTarget = event.target.closest(".item");
const targetId = dropTarget ? dropTarget.dataset.itemId : null;
const target = siblings.find(s => s.data._id === targetId);

// Ensure we are only sorting like-types
if (target && (source.data.type !== target.data.type)) return;

// Perform the sort
const sortUpdates = SortingHelpers.performIntegerSort(source, {target: target, siblings});
const updateData = sortUpdates.map(u => {
const update = u.update;
update._id = u.target.data._id;
return update;
});

// Perform the update
return this.actor.updateManyEmbeddedEntities("OwnedItem", updateData);
}
}
4 changes: 2 additions & 2 deletions module/dice.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export class Dice5e {
if (!data.bonus && parts.indexOf("@bonus") !== -1) parts.pop();

// Optionally include an ability score selection (used for tool checks)
const ability = form.find('[name="ability"]');
if ( ability.length && ability.val() ) {
const ability = form ? form.find('[name="ability"]') : null;
if ( ability && ability.length && ability.val() ) {
data.ability = ability.val();
const abl = data.abilities[data.ability];
if ( abl ) data.mod = abl.mod;
Expand Down

0 comments on commit ebed88c

Please sign in to comment.