mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-16 13:41:07 +01:00
.
This commit is contained in:
parent
615b7eb4a5
commit
a6931b5b89
6 changed files with 62 additions and 20 deletions
|
|
@ -2566,7 +2566,10 @@
|
||||||
"Countdowns": {
|
"Countdowns": {
|
||||||
"title": "Countdowns",
|
"title": "Countdowns",
|
||||||
"toggleIconMode": "Toggle Icon Only",
|
"toggleIconMode": "Toggle Icon Only",
|
||||||
"noPlayerAccess": "This countdown isn't visible to any players"
|
"noPlayerAccess": "This countdown isn't visible to any players",
|
||||||
|
"loop": "Looping",
|
||||||
|
"decreasingLoop": "Decreasing Looping",
|
||||||
|
"increasingLoop": "Increasing Looping"
|
||||||
},
|
},
|
||||||
"ItemBrowser": {
|
"ItemBrowser": {
|
||||||
"title": "Daggerheart Compendium Browser",
|
"title": "Daggerheart Compendium Browser",
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,14 @@ export default class CountdownEdit extends HandlebarsApplicationMixin(Applicatio
|
||||||
context.hideNewCountdowns = this.hideNewCountdowns;
|
context.hideNewCountdowns = this.hideNewCountdowns;
|
||||||
context.countdowns = Object.keys(this.data.countdowns).reduce((acc, key) => {
|
context.countdowns = Object.keys(this.data.countdowns).reduce((acc, key) => {
|
||||||
const countdown = this.data.countdowns[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] = {
|
acc[key] = {
|
||||||
...countdown,
|
...countdown,
|
||||||
typeName: game.i18n.localize(CONFIG.DH.GENERAL.countdownBaseTypes[countdown.type].label),
|
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
|
CONFIG.DH.GENERAL.countdownProgressionTypes[countdown.progress.type].label
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
editing: this.editingCountdowns.has(key)
|
editing: this.editingCountdowns.has(key),
|
||||||
|
loopTooltip
|
||||||
};
|
};
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
|
|
|
||||||
|
|
@ -119,10 +119,26 @@ export default class DhCountdowns extends HandlebarsApplicationMixin(Application
|
||||||
return acc;
|
return acc;
|
||||||
}, []);
|
}, []);
|
||||||
const nonGmPlayers = game.users.filter(x => !x.isGM);
|
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] = {
|
acc[key] = {
|
||||||
...countdown,
|
...countdown,
|
||||||
editable: game.user.isGM || ownership === CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER,
|
editable: countdownEditable,
|
||||||
noPlayerAccess: nonGmPlayers.length && playersWithAccess.length === 0
|
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;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,16 @@
|
||||||
border: 1px solid light-dark(@dark, @beige);
|
border: 1px solid light-dark(@dark, @beige);
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.countdown-edit-loop {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.loop-marker {
|
||||||
|
position: absolute;
|
||||||
|
top: -4px;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,14 @@
|
||||||
<div class="countdown-edit-sub-tag">{{countdown.progress.typeName}}</div>
|
<div class="countdown-edit-sub-tag">{{countdown.progress.typeName}}</div>
|
||||||
|
|
||||||
{{#unless (eq countdown.progress.looping "noLooping")}}
|
{{#unless (eq countdown.progress.looping "noLooping")}}
|
||||||
<i class="fa-solid fa-repeat"></i>
|
<div class="countdown-edit-loop" data-tooltip="{{countdown.loopTooltip}}">
|
||||||
{{#if (eq countdown.progress.looping "increasing")}}
|
<i class="fa-solid fa-repeat"></i>
|
||||||
<i class="fa-solid fa-angles-up"></i>
|
{{#if (eq countdown.progress.looping "increasing")}}
|
||||||
{{else if (eq countdown.progress.looping "decreasing")}}
|
<i class="loop-marker fa-solid fa-angles-up"></i>
|
||||||
<i class="fa-solid fa-angles-down"></i>
|
{{else if (eq countdown.progress.looping "decreasing")}}
|
||||||
{{/if}}
|
<i class="loop-marker fa-solid fa-angles-down"></i>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -15,19 +15,21 @@
|
||||||
{{#if countdown.editable}}<a data-action="increaseCountdown" id="{{id}}"><i class="fa-solid fa-plus"></i></a>{{/if}}
|
{{#if countdown.editable}}<a data-action="increaseCountdown" id="{{id}}"><i class="fa-solid fa-plus"></i></a>{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<div class="countdown-tool-icons">
|
<div class="countdown-tool-icons">
|
||||||
{{#if (and @root.isGM (not ../iconOnly))}}
|
{{#if (not ../iconOnly)}}
|
||||||
{{#if countdown.noPlayerAccess}}
|
{{#if (and countdown.noPlayerAccess @root.isGM)}}
|
||||||
<i class="fa-solid fa-eye-slash" data-tooltip="{{localize "DAGGERHEART.UI.Countdowns.noPlayerAccess"}}"></i>
|
<i class="fa-solid fa-eye-slash" data-tooltip="{{localize "DAGGERHEART.UI.Countdowns.noPlayerAccess"}}"></i>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#unless (eq countdown.progress.looping "noLooping")}}
|
{{#unless (eq countdown.progress.looping "noLooping")}}
|
||||||
<a class="looping-container {{#if (eq countdown.progress.current 0)}}should-loop{{/if}}" {{#if (gt countdown.progress.current 0)}}disabled{{/if}} data-action="loopCountdown" id="{{id}}">
|
<span data-tooltip="{{countdown.loopTooltip}}">
|
||||||
<i class="loop-marker fa-solid fa-repeat"></i>
|
<a class="looping-container {{#if countdown.shouldLoop}}should-loop{{/if}}" {{#if countdown.loopDisabled}}disabled{{/if}} data-action="loopCountdown" id="{{id}}">
|
||||||
{{#if (eq countdown.progress.looping "increasing")}}
|
<i class="loop-marker fa-solid fa-repeat"></i>
|
||||||
<i class="direction-marker fa-solid fa-angles-up"></i>
|
{{#if (eq countdown.progress.looping "increasing")}}
|
||||||
{{else if (eq countdown.progress.looping "decreasing")}}
|
<i class="direction-marker fa-solid fa-angles-up" data-tooltip="{{localize "DAGGERHEART.UI.Countdowns.increasingLoop"}}"></i>
|
||||||
<i class="direction-marker fa-solid fa-angles-down"></i>
|
{{else if (eq countdown.progress.looping "decreasing")}}
|
||||||
{{/if}}
|
<i class="direction-marker fa-solid fa-angles-down" data-tooltip="{{localize "DAGGERHEART.UI.Countdowns.decreasingLoop"}}"></i>
|
||||||
</a>
|
{{/if}}
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue