From db5dc0e5078e3347954de96e74ec2ca827d38685 Mon Sep 17 00:00:00 2001 From: flashwave Date: Fri, 14 Apr 2023 20:40:53 +0000 Subject: [PATCH] Added support for Eggstra Work schedules in Splatoon 3. --- public/splatoon.php | 48 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/public/splatoon.php b/public/splatoon.php index 1b708bd..b2ddaac 100644 --- a/public/splatoon.php +++ b/public/splatoon.php @@ -15,7 +15,7 @@ define('SP3_FESTS', SP3_DOMAIN . '/data/festivals.json'); define('SP3_TYPES', [SP_TYPE_SCHED, SP_TYPE_FESTS]); define('SP3_SCHED_FILTER', [ 'regular', 'bankara', 'series', 'open', 'x', - 'league', 'coop', 'bigrun', 'fest', + 'league', 'coop', 'bigrun', 'fest', 'eggstra', ]); define('SP2_DEFAULT_LOCALE', 'en'); @@ -179,6 +179,8 @@ function splatoon3_ruleset_short(string $id): string { return 'RM'; if($id === 'TURF_WAR') return 'TW'; + if($id === 'TEAM_CONTEST') + return 'EW'; if($id === 'coop') return 'SR'; if($id === 'bigrun') @@ -252,6 +254,7 @@ if($typeId === SP_TYPE_SCHED) { // SCHEDULE SHIT $includeX = $filterAll || in_array('x', $filters); $includeLeague = $filterAll || in_array('league', $filters); $includeSalmon = $filterAll || in_array('coop', $filters); + $includeEggstra = $filterAll || in_array('eggstra', $filters); $includeBigRun = $filterAll || in_array('bigrun', $filters); $includeFest = $filterAll || in_array('fest', $filters); $includeSeries = $includeSeries || $includeRanked; @@ -491,6 +494,47 @@ if($typeId === SP_TYPE_SCHED) { // SCHEDULE SHIT } } + if($includeEggstra && !empty($data->coopGroupingSchedule->teamContestSchedules->nodes)) { + $schedule = []; + + $nodes = $data->coopGroupingSchedule->teamContestSchedules->nodes; + foreach($nodes as $node) { + if(empty($node->setting)) + continue; + + $schedule[] = $item = new stdClass; + splatoon3_schedule_gen($item, $node); + $item->variant = 'coop'; + + $item->stages = [ + [ + 'name' => $node->setting->coopStage->name, + 'image' => $node->setting->coopStage->image->url, + ], + ]; + + $item->weapons = []; + foreach($node->setting->weapons as $weapon) + $item->weapons[] = [ + 'name' => $localeInfo->weapons->{$weapon->__splatoon3ink_id}?->name ?? $weapon->name, + 'image' => $weapon->image->url, + ]; + } + + if(!empty($schedule)) { + $gameModes[] = [ + 'id' => 'eggstra', + 'name' => 'Eggstra Work', + 'colour' => 0xFFBE8800, + ]; + + $schedules[] = [ + 'mode' => 'eggstra', + 'schedule' => $schedule, + ]; + } + } + if($includeBigRun && !empty($data->coopGroupingSchedule->bigRunSchedules->nodes)) { $schedule = []; @@ -522,7 +566,7 @@ if($typeId === SP_TYPE_SCHED) { // SCHEDULE SHIT $gameModes[] = [ 'id' => 'bigrun', 'name' => 'Big Run', - 'colour' => 0xFFFF5600, // reinvestigate this + 'colour' => 0xFFB322FF, ]; $schedules[] = [