diff --git a/src/app/screenshots/screenshots.js b/src/app/screenshots/screenshots.js index daba6dc..71d49c2 100644 --- a/src/app/screenshots/screenshots.js +++ b/src/app/screenshots/screenshots.js @@ -53,10 +53,12 @@ async function captureScreenshot(options) { return result; } -function captureScheduleScreenshot(now) { +function captureScheduleScreenshot(now, splatfestBattle = false) { let hash = `/schedules/${now}`; - return captureScreenshot({ hash }); + let viewport = (splatfestBattle) ? { height: 780 } : undefined; + + return captureScreenshot({ hash, viewport }); } function captureGearScreenshot(now) { diff --git a/src/app/twitter/tweets/ScheduleTweet.js b/src/app/twitter/tweets/ScheduleTweet.js index ba54903..e261c8d 100644 --- a/src/app/twitter/tweets/ScheduleTweet.js +++ b/src/app/twitter/tweets/ScheduleTweet.js @@ -36,7 +36,31 @@ class ScheduleTweet extends TwitterPostBase { } getImage(data) { - return captureScheduleScreenshot(data.regular.start_time); + return captureScheduleScreenshot(data.regular.start_time, this.globalSplatfestOpenInAllRegions()); + } + + globalSplatfestOpenInAllRegions() { + let festivals = readData('festivals.json'); + let time = this.getDataTime(); + + let festival; + let ids = []; + + // Is there an open Splatfest in each region? + // (Checking NA last so we can return that one more easily) + for (let region of ['eu', 'jp', 'na']) { + festival = festivals[region].festivals.find(f => f.times.start <= time && f.times.end > time); + if (!festival) + return false; + ids.push(festival.festival_id); + } + + console.log(ids); + + // Only return the Splatfest if the festival IDs match across all regions + if (ids[0] === ids[1] && ids[0] === ids[2]) + return festival; + return false; } getText(data) { @@ -51,6 +75,11 @@ class ScheduleTweet extends TwitterPostBase { return `NEW STAGE: ${stage.name} is now open! #maprotation #splatoon2`; } + let festival = this.globalSplatfestOpenInAllRegions(); + + if (festival) + return `The global Splatfest is open in all regions! Join the Splatfest Battle on ${data.regular.stage_a.name}, ${data.regular.stage_b.name}, and ${festival.special_stage.name}. #splatfest #maprotation`; + return `Splatoon 2 map rotation: Ranked game mode: ${data.gachi.rule.name}, League game mode: ${data.league.rule.name} #maprotation`; } } diff --git a/src/web/components/screenshots/schedules/ScheduleBox.vue b/src/web/components/screenshots/schedules/ScheduleBox.vue index 1b0dbc0..18233f2 100644 --- a/src/web/components/screenshots/schedules/ScheduleBox.vue +++ b/src/web/components/screenshots/schedules/ScheduleBox.vue @@ -1,10 +1,11 @@ diff --git a/src/web/components/splatoon/SplatfestBox.vue b/src/web/components/splatoon/SplatfestBox.vue index 78f3ec2..a1acfeb 100644 --- a/src/web/components/splatoon/SplatfestBox.vue +++ b/src/web/components/splatoon/SplatfestBox.vue @@ -38,7 +38,7 @@ -
+
+ + +
 
@@ -100,6 +103,7 @@ export default { festival: null, screenshotMode: Boolean, historyMode: Boolean, + globalSplatfestMode: Boolean, }, filters: { resultsIn(time) { @@ -120,6 +124,8 @@ export default { return { weekday: 'short' }; }, title() { + if (this.globalSplatfestMode) + return this.$t('splatfest.global'); if (this.festival.state == 'upcoming') return this.$t('splatfest.upcoming'); if (this.festival.state == 'past' && !this.screenshotMode) diff --git a/src/web/locale/en.json b/src/web/locale/en.json index cd17d50..c870546 100644 --- a/src/web/locale/en.json +++ b/src/web/locale/en.json @@ -25,6 +25,7 @@ "recent": "Recent Splatfest", "title": "Splatfest", "upcoming": "Upcoming Splatfest", + "global": "Global Splatfest", "results_in": "results in {time}", "results": { "title": "Results!",