Added support for Tricolor battle in schedule command.

This commit is contained in:
flash 2023-02-12 02:18:30 +00:00
parent 7e131b5d66
commit 1321a09a93

View file

@ -240,6 +240,7 @@ if($typeId === SP_TYPE_SCHED) { // SCHEDULE SHIT
$gameModes = [];
$schedules = [];
$currentFest = null;
if($gameInfo['variant'] === SP_GAME_SP3) {
$data = $schedRaw->all->data;
@ -504,12 +505,63 @@ if($typeId === SP_TYPE_SCHED) { // SCHEDULE SHIT
'colour' => 0xFFFF5600, // reinvestigate this
];
$schedule[] = [
$schedules[] = [
'mode' => 'bigrun',
'schedule' => $schedule,
];
}
}
if(!empty($data->currentFest->id)) {
$currentFest = new stdClass;
$currentFest->id = $data->currentFest->id;
$currentFest->title = $data->currentFest->title;
$currentFest->start = $data->currentFest->startTime;
$currentFest->end = $data->currentFest->endTime;
$currentFest->midterm = $data->currentFest->midtermTime;
$currentFest->state = $data->currentFest->state;
$currentFest->teams = [];
if($includeFest && !empty($data->currentFest->tricolorStage)) {
$gameModes[] = [
'id' => 'tricolor',
'name' => 'Tricolor Battle',
'colour' => 0xFF71717A,
];
$schedules[] = [
'mode' => 'tricolor',
'schedule' => [
[
'start' => splatoon2_format_date(strtotime('today')),
'end' => splatoon2_format_date(strtotime('tomorrow')),
'variant' => 'vs',
'ruleset' => [
'id' => 'TRICOLOR',
'name' => 'Tricolor Battle',
'short' => 'TB',
],
'stages' => [
[
'id' => $data->currentFest->tricolorStage->id,
'name' => $data->currentFest->tricolorStage->name,
'image' => $data->currentFest->tricolorStage->image->url,
],
],
],
],
];
}
foreach($data->currentFest->teams as $rawTeam) {
$currentFest->teams[] = $teamInfo = new stdClass;
$teamInfo->id = $rawTeam->id;
$teamInfo->colour = (round($rawTeam->color->a * 0xFF) << 24)
| (round($rawTeam->color->r * 0xFF) << 16)
| (round($rawTeam->color->g * 0xFF) << 8)
| round($rawTeam->color->b * 0xFF);
}
}
} elseif($gameInfo['variant'] === SP_GAME_SP2) {
$vs = $schedRaw->vs;
$coop = $schedRaw->co;
@ -672,6 +724,7 @@ if($typeId === SP_TYPE_SCHED) { // SCHEDULE SHIT
'colour' => $gameInfo['colour'],
'variant' => $gameInfo['variant'],
],
'fest' => $currentFest,
'modes' => array_values($gameModes),
'schedules' => $schedules,
]);