mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-13 20:21:06 +01:00
.
This commit is contained in:
parent
615b7eb4a5
commit
a6931b5b89
6 changed files with 62 additions and 20 deletions
|
|
@ -49,6 +49,14 @@ export default class CountdownEdit extends HandlebarsApplicationMixin(Applicatio
|
|||
context.hideNewCountdowns = this.hideNewCountdowns;
|
||||
context.countdowns = Object.keys(this.data.countdowns).reduce((acc, key) => {
|
||||
const countdown = this.data.countdowns[key];
|
||||
const isLooping = countdown.progress.looping !== CONFIG.DH.GENERAL.countdownLoopingTypes.noLooping;
|
||||
const loopTooltip = isLooping
|
||||
? countdown.progress.looping === CONFIG.DH.GENERAL.countdownLoopingTypes.increasing.id
|
||||
? 'DAGGERHEART.UI.Countdowns.increasingLoop'
|
||||
: countdown.progress.looping === CONFIG.DH.GENERAL.countdownLoopingTypes.decreasing.id
|
||||
? 'DAGGERHEART.UI.Countdowns.decreasingLoop'
|
||||
: 'DAGGERHEART.UI.Countdowns.loop'
|
||||
: null;
|
||||
acc[key] = {
|
||||
...countdown,
|
||||
typeName: game.i18n.localize(CONFIG.DH.GENERAL.countdownBaseTypes[countdown.type].label),
|
||||
|
|
@ -58,7 +66,8 @@ export default class CountdownEdit extends HandlebarsApplicationMixin(Applicatio
|
|||
CONFIG.DH.GENERAL.countdownProgressionTypes[countdown.progress.type].label
|
||||
)
|
||||
},
|
||||
editing: this.editingCountdowns.has(key)
|
||||
editing: this.editingCountdowns.has(key),
|
||||
loopTooltip
|
||||
};
|
||||
|
||||
return acc;
|
||||
|
|
|
|||
|
|
@ -119,10 +119,26 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
|
|||
return acc;
|
||||
}, []);
|
||||
const nonGmPlayers = game.users.filter(x => !x.isGM);
|
||||
|
||||
const countdownEditable = game.user.isGM || ownership === CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER;
|
||||
const isLooping = countdown.progress.looping !== CONFIG.DH.GENERAL.countdownLoopingTypes.noLooping;
|
||||
const loopTooltip = isLooping
|
||||
? countdown.progress.looping === CONFIG.DH.GENERAL.countdownLoopingTypes.increasing.id
|
||||
? 'DAGGERHEART.UI.Countdowns.increasingLoop'
|
||||
: countdown.progress.looping === CONFIG.DH.GENERAL.countdownLoopingTypes.decreasing.id
|
||||
? 'DAGGERHEART.UI.Countdowns.decreasingLoop'
|
||||
: 'DAGGERHEART.UI.Countdowns.loop'
|
||||
: null;
|
||||
const loopDisabled =
|
||||
!countdownEditable || (isLooping && (countdown.progress.current > 0 || countdown.progress.max === '0'));
|
||||
|
||||
acc[key] = {
|
||||
...countdown,
|
||||
editable: game.user.isGM || ownership === CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER,
|
||||
noPlayerAccess: nonGmPlayers.length && playersWithAccess.length === 0
|
||||
editable: countdownEditable,
|
||||
noPlayerAccess: nonGmPlayers.length && playersWithAccess.length === 0,
|
||||
shouldLoop: isLooping && countdown.progress.current === 0 && countdown.progress.max > 0,
|
||||
loopDisabled: isLooping ? loopDisabled : null,
|
||||
loopTooltip: isLooping && game.i18n.localize(loopTooltip)
|
||||
};
|
||||
return acc;
|
||||
}, {});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue