Added support for League/Challenge battles in Splatoon 3 (also updated schedule time format which is incompatible with the old one so it will break everything lol).
This commit is contained in:
parent
db5dc0e507
commit
d34bf5a4af
1 changed files with 38 additions and 8 deletions
|
@ -262,14 +262,17 @@ if($typeId === SP_TYPE_SCHED) { // SCHEDULE SHIT
|
|||
$includeRanked = $includeSeries || $includeOpen;
|
||||
|
||||
function splatoon3_schedule_gen($target, $node): void {
|
||||
$target->start = $node->startTime;
|
||||
$target->end = $node->endTime;
|
||||
$target->periods = [[
|
||||
'start' => $node->startTime,
|
||||
'end' => $node->endTime,
|
||||
]];
|
||||
}
|
||||
|
||||
function splatoon3_schedule_vs($target, $settings): void {
|
||||
global $localeInfo;
|
||||
|
||||
$target->variant = 'vs';
|
||||
$target->flags = [];
|
||||
|
||||
$target->ruleset = [
|
||||
'id' => $settings->vsRule->rule,
|
||||
|
@ -286,6 +289,15 @@ if($typeId === SP_TYPE_SCHED) { // SCHEDULE SHIT
|
|||
];
|
||||
}
|
||||
|
||||
function splatoon3_schedule_periods($target, $periods): void {
|
||||
$target->periods = [];
|
||||
foreach($periods as $period)
|
||||
$target->periods[] = [
|
||||
'start' => $period->startTime,
|
||||
'end' => $period->endTime,
|
||||
];
|
||||
}
|
||||
|
||||
if($includeRegular && !empty($data->regularSchedules->nodes)) {
|
||||
$schedule = [];
|
||||
|
||||
|
@ -401,22 +413,38 @@ if($typeId === SP_TYPE_SCHED) { // SCHEDULE SHIT
|
|||
}
|
||||
}
|
||||
|
||||
if($includeLeague && !empty($data->leagueSchedules->nodes)) {
|
||||
if($includeLeague && !empty($data->eventSchedules->nodes)) {
|
||||
$schedule = [];
|
||||
|
||||
foreach($data->leagueSchedules->nodes as $node) {
|
||||
foreach($data->eventSchedules->nodes as $node) {
|
||||
if(empty($node->leagueMatchSetting))
|
||||
continue;
|
||||
|
||||
$schedule[] = $item = new stdClass;
|
||||
splatoon3_schedule_gen($item, $node);
|
||||
splatoon3_schedule_periods($item, $node->timePeriods);
|
||||
splatoon3_schedule_vs($item, $node->leagueMatchSetting);
|
||||
$item->flags[] = 'league';
|
||||
|
||||
if(!empty($node->leagueMatchSetting->leagueMatchEvent)) {
|
||||
$event = $node->leagueMatchSetting->leagueMatchEvent;
|
||||
$eventLocale = $localeInfo->events->{$event->id};
|
||||
|
||||
$item->league = [
|
||||
'id' => $event->leagueMatchEventId,
|
||||
'name' => $eventLocale->name ?? $event->name,
|
||||
'desc' => $eventLocale->desc ?? $event->desc,
|
||||
'rules' => [
|
||||
'lines' => explode('<br />', $eventLocale->regulation ?? $event->regulation),
|
||||
'url' => $event->regulationUrl,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($schedule)) {
|
||||
$gameModes[] = [
|
||||
'id' => 'league',
|
||||
'name' => 'League Battle',
|
||||
'name' => 'Challenge Battle',
|
||||
'colour' => 0xFFF02D7D,
|
||||
];
|
||||
|
||||
|
@ -636,8 +664,10 @@ if($typeId === SP_TYPE_SCHED) { // SCHEDULE SHIT
|
|||
$includeSalmon = $filterAll || in_array('coop', $filters);
|
||||
|
||||
function splatoon2_schedule_gen($target, $node): void {
|
||||
$target->start = splatoon2_format_date($node->start_time);
|
||||
$target->end = splatoon2_format_date($node->end_time);
|
||||
$target->periods = [[
|
||||
'start' => splatoon2_format_date($node->start_time),
|
||||
'end' => splatoon2_format_date($node->end_time),
|
||||
]];
|
||||
}
|
||||
|
||||
function splatoon2_schedule_vs($target, $node): void {
|
||||
|
|
Reference in a new issue