fix(event): correct logic for various Valentine's items

This commit is contained in:
SabreCat 2023-02-13 11:25:02 -06:00
parent 74da6d8798
commit f9db4b9b5b
6 changed files with 23 additions and 17 deletions

View file

@ -759,6 +759,7 @@
</style>
<script>
import find from 'lodash/find';
import { mapState } from '@/libs/store';
import { goToModForm } from '@/libs/modform';
@ -835,22 +836,23 @@ export default {
computed: {
...mapState({
user: 'user.data',
currentEvent: 'worldState.data.currentEvent',
currentEventList: 'worldState.data.currentEventList',
}),
questData () {
if (!this.group.quest) return {};
return quests.quests[this.group.quest.key];
},
imageURLs () {
if (!this.currentEvent || !this.currentEvent.season) {
const currentEvent = find(this.currentEventList, event => Boolean(event.season));
if (!currentEvent) {
return {
background: 'url(/static/npc/normal/tavern_background.png)',
npc: 'url(/static/npc/normal/tavern_npc.png)',
};
}
return {
background: `url(/static/npc/${this.currentEvent.season}/tavern_background.png)`,
npc: `url(/static/npc/${this.currentEvent.season}/tavern_npc.png)`,
background: `url(/static/npc/${currentEvent.season}/tavern_background.png)`,
npc: `url(/static/npc/${currentEvent.season}/tavern_npc.png)`,
};
},
},

View file

@ -146,6 +146,7 @@
</style>
<script>
import find from 'lodash/find';
import _filter from 'lodash/filter';
import _map from 'lodash/map';
import _throttle from 'lodash/throttle';
@ -225,7 +226,7 @@ export default {
user: 'user.data',
userStats: 'user.data.stats',
userItems: 'user.data.items',
currentEvent: 'worldState.data.currentEvent',
currentEventList: 'worldState.data.currentEventList',
}),
market () {
return shops.getMarketShop(this.user);
@ -292,15 +293,16 @@ export default {
return Object.values(this.viewOptions).some(g => g.selected);
},
imageURLs () {
if (!this.currentEvent || !this.currentEvent.season) {
const currentEvent = find(this.currentEventList, event => Boolean(event.season));
if (!currentEvent) {
return {
background: 'url(/static/npc/normal/market_background.png)',
npc: 'url(/static/npc/normal/market_banner_npc.png)',
};
}
return {
background: `url(/static/npc/${this.currentEvent.season}/market_background.png)`,
npc: `url(/static/npc/${this.currentEvent.season}/market_banner_npc.png)`,
background: `url(/static/npc/${currentEvent.season}/market_background.png)`,
npc: `url(/static/npc/${currentEvent.season}/market_banner_npc.png)`,
};
},
},

View file

@ -397,6 +397,7 @@
</style>
<script>
import find from 'lodash/find';
import _filter from 'lodash/filter';
import _sortBy from 'lodash/sortBy';
import _throttle from 'lodash/throttle';
@ -512,7 +513,7 @@ export default {
user: 'user.data',
userStats: 'user.data.stats',
userItems: 'user.data.items',
currentEvent: 'worldState.data.currentEvent',
currentEventList: 'worldState.data.currentEventList',
}),
shop () {
return shops.getQuestShop(this.user);
@ -536,15 +537,16 @@ export default {
return Object.values(this.viewOptions).some(g => g.selected);
},
imageURLs () {
if (!this.currentEvent || !this.currentEvent.season) {
const currentEvent = find(this.currentEventList, event => Boolean(event.season));
if (!currentEvent) {
return {
background: 'url(/static/npc/normal/quest_shop_background.png)',
npc: 'url(/static/npc/normal/quest_shop_npc.png)',
};
}
return {
background: `url(/static/npc/${this.currentEvent.season}/quest_shop_background.png)`,
npc: `url(/static/npc/${this.currentEvent.season}/quest_shop_npc.png)`,
background: `url(/static/npc/${currentEvent.season}/quest_shop_background.png)`,
npc: `url(/static/npc/${currentEvent.season}/quest_shop_npc.png)`,
};
},
},

View file

@ -16,18 +16,18 @@ export const EVENTS = {
npcImageSuffix: '',
},
bundle202302: {
start: '2023-02-13T08:00-05:00',
start: '2023-02-21T08:00-05:00',
end: '2023-02-28T23:59-05:00',
},
potions202302:{
start: '2023-02-21T08:00-05:00',
start: '2023-02-13T08:00-05:00',
end: '2023-02-28T23:59-05:00',
},
valentines2023: {
start: '2023-02-13T08:00-05:00',
end: '2023-02-17T23:59-05:00',
season: 'valentines',
npcImageSuffix: 'valentines',
npcImageSuffix: '_valentines',
},
birthday10: {
start: '2023-01-30T08:00-05:00',

View file

@ -137,7 +137,7 @@ api.cardTypes = {
valentine: {
key: 'valentine',
messageOptions: 4,
yearRound: moment().isBefore('2022-02-18T20:00-05:00'),
yearRound: moment().isBefore('2023-02-17T23:59-05:00'),
},
birthday: {
key: 'birthday',

View file

@ -475,7 +475,7 @@ spells.special = {
target: 'user',
notes: t('valentineCardNotes'),
canOwn () {
return false;
return moment().isBetween('2023-02-13T08:00-05:00', '2023-02-17T23:59-05:00');
},
cast (user, target) {
if (user === target) {