mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-14 07:52:15 +00:00
fix(events): handle overlap of unseasonal events and seasonal
This commit is contained in:
parent
efae9429c0
commit
def9aa16b5
1 changed files with 8 additions and 9 deletions
|
|
@ -7,28 +7,27 @@ import {
|
|||
} from '../content/constants';
|
||||
|
||||
const CURRENT_EVENT = find(
|
||||
EVENTS, event => moment().isBetween(event.start, event.end) && Boolean(event.season),
|
||||
EVENTS, event => moment().isBetween(event.start, event.end)
|
||||
&& ['winter', 'spring', 'summer', 'fall'].includes(event.season),
|
||||
);
|
||||
|
||||
const SHOP_OPEN = CURRENT_EVENT && ['winter', 'spring', 'summer', 'fall'].includes(CURRENT_EVENT.season);
|
||||
|
||||
export default {
|
||||
opened: SHOP_OPEN,
|
||||
opened: CURRENT_EVENT,
|
||||
|
||||
currentSeason: SHOP_OPEN ? upperFirst(CURRENT_EVENT.season) : 'Closed',
|
||||
currentSeason: CURRENT_EVENT ? upperFirst(CURRENT_EVENT.season) : 'Closed',
|
||||
|
||||
dateRange: {
|
||||
start: CURRENT_EVENT ? moment(CURRENT_EVENT.start) : moment().subtract(1, 'days').toDate(),
|
||||
end: CURRENT_EVENT ? moment(CURRENT_EVENT.end) : moment().subtract(1, 'seconds').toDate(),
|
||||
},
|
||||
|
||||
availableSets: SHOP_OPEN
|
||||
availableSets: CURRENT_EVENT
|
||||
? [
|
||||
...SEASONAL_SETS[CURRENT_EVENT.season],
|
||||
]
|
||||
: [],
|
||||
|
||||
pinnedSets: SHOP_OPEN
|
||||
pinnedSets: CURRENT_EVENT
|
||||
? {
|
||||
rogue: 'winter2023RibbonRogueSet',
|
||||
warrior: 'winter2023WalrusWarriorSet',
|
||||
|
|
@ -36,13 +35,13 @@ export default {
|
|||
healer: 'winter2023CardinalHealerSet',
|
||||
}
|
||||
: {},
|
||||
availableSpells: SHOP_OPEN && moment().isBetween('2022-12-27T08:00-05:00', CURRENT_EVENT.end)
|
||||
availableSpells: CURRENT_EVENT && moment().isBetween('2022-12-27T08:00-05:00', CURRENT_EVENT.end)
|
||||
? [
|
||||
'snowball',
|
||||
]
|
||||
: [],
|
||||
|
||||
availableQuests: SHOP_OPEN && CURRENT_EVENT.season === 'winter'
|
||||
availableQuests: CURRENT_EVENT && CURRENT_EVENT.season === 'winter'
|
||||
? [
|
||||
'evilsanta',
|
||||
'evilsanta2',
|
||||
|
|
|
|||
Loading…
Reference in a new issue