mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
Fix conflict
This commit is contained in:
commit
181f848c4e
216 changed files with 13028 additions and 658 deletions
|
|
@ -31,21 +31,24 @@ export function rollCommandToJSON(text) {
|
|||
return Object.keys(result).length > 0 ? result : null;
|
||||
}
|
||||
|
||||
export const getCommandTarget = () => {
|
||||
export const getCommandTarget = (options = {}) => {
|
||||
const { allowNull = false } = options;
|
||||
let target = game.canvas.tokens.controlled.length > 0 ? game.canvas.tokens.controlled[0].actor : null;
|
||||
if (!game.user.isGM) {
|
||||
target = game.user.character;
|
||||
if (!target) {
|
||||
if (!target && !allowNull) {
|
||||
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.noAssignedPlayerCharacter'));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (!target) {
|
||||
if (!target && !allowNull) {
|
||||
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.noSelectedToken'));
|
||||
return null;
|
||||
}
|
||||
if (target.type !== 'character') {
|
||||
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.onlyUseableByPC'));
|
||||
if (target && target.type !== 'character') {
|
||||
if (!allowNull) {
|
||||
ui.notifications.error(game.i18n.localize('DAGGERHEART.UI.Notifications.onlyUseableByPC'));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -272,14 +275,14 @@ export function addLinkedItemsDiff(changedItems, currentItems, options) {
|
|||
newItems
|
||||
.difference(prevItems)
|
||||
.map(item => item?.item ?? item)
|
||||
.filter(x => (typeof x === 'object' ? x.item : x))
|
||||
.filter(x => (typeof x === 'object' ? x?.item : x))
|
||||
);
|
||||
|
||||
options.toUnlink = Array.from(
|
||||
prevItems
|
||||
.difference(newItems)
|
||||
.map(item => item?.item?.uuid ?? item?.uuid ?? item)
|
||||
.filter(x => (typeof x === 'object' ? x.item : x))
|
||||
.filter(x => (typeof x === 'object' ? x?.item : x))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue