src/Controller/FishersQuest/LeaderboardController.php line 137
<?php
namespace App\Controller\FishersQuest;
use App\Entity\NftMetadata;
use App\Entity\User;
use App\Entity\UserGear;
use Doctrine\Persistence\ManagerRegistry;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class LeaderboardController extends AbstractController
{
public function __construct(private ManagerRegistry $doctrine) {}
// #[Route('/leaderboard', name: 'leaderboard')]
// public function index(): Response
// {
// return $this->render('leaderboard/index.html.twig', [
// 'controller_name' => 'LeaderboardController',
// ]);
// }
#[Route('/leaderboard/catchable/season-one', name: 'leaderboard_catchable_season_one', requirements: ['domain' => 'tinyknightgames.com|tinyknightgames.wip|tkgstage.com'], host: '{domain}')]
public function leaderboardCatchableSeasonOne(): Response
{
$em = $this->doctrine->getManager();
$nftMetadatas = $em->getRepository(NftMetadata::class)->findAllForLeaderboardByCollection(1);
$expLeaders = $em->getRepository(User::class)->findBy([],['experience' => 'desc'], 10);
$gearScoreLeaders = $em->getRepository(User::class)->getUserGearScores();
$nftMetadatasByTier = array('Extreme' => [], 'Legendary' => [], 'Epic' => [], 'Rare' => [], 'Uncommon' => [], 'Common' => [], 'Fodder' => []);
foreach($nftMetadatas as $nftMetadata) {
$tier = $nftMetadata->getTemplate()->getTier();
if($tier === 1 && count($nftMetadatasByTier['Fodder']) < 3) {
array_push($nftMetadatasByTier['Fodder'], $nftMetadata);
} elseif($tier === 2 && count($nftMetadatasByTier['Common']) < 3) {
array_push($nftMetadatasByTier['Common'], $nftMetadata);
}elseif($tier === 3 && count($nftMetadatasByTier['Uncommon']) < 3) {
array_push($nftMetadatasByTier['Uncommon'], $nftMetadata);
}elseif($tier === 4 && count($nftMetadatasByTier['Rare']) < 3) {
array_push($nftMetadatasByTier['Rare'], $nftMetadata);
}elseif($tier === 5 && count($nftMetadatasByTier['Epic']) < 3) {
array_push($nftMetadatasByTier['Epic'], $nftMetadata);
}elseif($tier === 6 && count($nftMetadatasByTier['Legendary']) < 3) {
array_push($nftMetadatasByTier['Legendary'], $nftMetadata);
}elseif($tier === 7 && count($nftMetadatasByTier['Extreme']) < 3) {
array_push($nftMetadatasByTier['Extreme'], $nftMetadata);
}
}
return $this->render('leaderboard/catchable/season-one.html.twig', [
'controller_name' => 'LeaderboardController',
'nftMetadatasByTier' => $nftMetadatasByTier,
'expLeaders' => $expLeaders,
'gearScoreLeaders' => $gearScoreLeaders,
]);
}
#[Route('/leaderboard/catchable/season-two', name: 'leaderboard_catchable_season_two', requirements: ['domain' => 'tinyknightgames.com|tinyknightgames.wip|tkgstage.com'], host: '{domain}')]
public function leaderboardCatchableSeasonTwo(): Response
{
$em = $this->doctrine->getManager();
$nftMetadatas = $em->getRepository(NftMetadata::class)->findAllForLeaderboardByCollection(2);
$expLeaders = $em->getRepository(User::class)->findBy([],['experience' => 'desc'], 10);
$gearScoreLeaders = $em->getRepository(User::class)->getUserGearScores();
$nftMetadatasByTier = array('Extreme' => [], 'Legendary' => [], 'Epic' => [], 'Rare' => [], 'Uncommon' => [], 'Common' => [], 'Fodder' => []);
foreach($nftMetadatas as $nftMetadata) {
$tier = $nftMetadata->getTemplate()->getTier();
if($tier === 1 && count($nftMetadatasByTier['Fodder']) < 3) {
array_push($nftMetadatasByTier['Fodder'], $nftMetadata);
} elseif($tier === 2 && count($nftMetadatasByTier['Common']) < 3) {
array_push($nftMetadatasByTier['Common'], $nftMetadata);
}elseif($tier === 3 && count($nftMetadatasByTier['Uncommon']) < 3) {
array_push($nftMetadatasByTier['Uncommon'], $nftMetadata);
}elseif($tier === 4 && count($nftMetadatasByTier['Rare']) < 3) {
array_push($nftMetadatasByTier['Rare'], $nftMetadata);
}elseif($tier === 5 && count($nftMetadatasByTier['Epic']) < 3) {
array_push($nftMetadatasByTier['Epic'], $nftMetadata);
}elseif($tier === 6 && count($nftMetadatasByTier['Legendary']) < 3) {
array_push($nftMetadatasByTier['Legendary'], $nftMetadata);
}elseif($tier === 7 && count($nftMetadatasByTier['Extreme']) < 3) {
array_push($nftMetadatasByTier['Extreme'], $nftMetadata);
}
}
return $this->render('leaderboard/catchable/season-two.html.twig', [
'controller_name' => 'LeaderboardController',
'nftMetadatasByTier' => $nftMetadatasByTier,
'expLeaders' => $expLeaders,
'gearScoreLeaders' => $gearScoreLeaders,
]);
}
#[Route('/leaderboard/catchable/season-three', name: 'leaderboard_catchable_season_three', requirements: ['domain' => 'tinyknightgames.com|tinyknightgames.wip|tkgstage.com'], host: '{domain}')]
public function leaderboardCatchableSeasonThree(): Response
{
$em = $this->doctrine->getManager();
$nftMetadatas = $em->getRepository(NftMetadata::class)->findAllForLeaderboardByCollection(3);
$expLeaders = $em->getRepository(User::class)->findBy([],['experience' => 'desc'], 25);
$gearScoreLeaders = $em->getRepository(User::class)->getUserGearScores();
$nftMetadatasByTier = array('Extreme' => [], 'Legendary' => [], 'Epic' => [], 'Rare' => [], 'Uncommon' => [], 'Common' => [], 'Fodder' => []);
foreach($nftMetadatas as $nftMetadata) {
$tier = $nftMetadata->getTemplate()->getTier();
if($tier === 1 && count($nftMetadatasByTier['Fodder']) < 3) {
array_push($nftMetadatasByTier['Fodder'], $nftMetadata);
} elseif($tier === 2 && count($nftMetadatasByTier['Common']) < 3) {
array_push($nftMetadatasByTier['Common'], $nftMetadata);
}elseif($tier === 3 && count($nftMetadatasByTier['Uncommon']) < 3) {
array_push($nftMetadatasByTier['Uncommon'], $nftMetadata);
}elseif($tier === 4 && count($nftMetadatasByTier['Rare']) < 3) {
array_push($nftMetadatasByTier['Rare'], $nftMetadata);
}elseif($tier === 5 && count($nftMetadatasByTier['Epic']) < 3) {
array_push($nftMetadatasByTier['Epic'], $nftMetadata);
}elseif($tier === 6 && count($nftMetadatasByTier['Legendary']) < 3) {
array_push($nftMetadatasByTier['Legendary'], $nftMetadata);
}elseif($tier === 7 && count($nftMetadatasByTier['Extreme']) < 3) {
array_push($nftMetadatasByTier['Extreme'], $nftMetadata);
}
}
return $this->render('leaderboard/catchable/season-three.html.twig', [
'controller_name' => 'LeaderboardController',
'nftMetadatasByTier' => $nftMetadatasByTier,
'expLeaders' => $expLeaders,
'gearScoreLeaders' => $gearScoreLeaders,
]);
}
#[Route('/leaderboard/catchable/season-four', name: 'leaderboard_catchable_season_four', requirements: ['domain' => 'tinyknightgames.com|tinyknightgames.wip|tkgstage.com'], host: '{domain}')]
public function leaderboardCatchableSeasonFour(): Response
{
$em = $this->doctrine->getManager();
$nftMetadatas = $em->getRepository(NftMetadata::class)->findAllForLeaderboardByCollection(4);
$expLeaders = $em->getRepository(User::class)->findBy([],['experience' => 'desc'], 25);
$gearScoreLeaders = $em->getRepository(User::class)->getUserGearScores();
$nftMetadatasByTier = array('Extreme' => [], 'Legendary' => [], 'Epic' => [], 'Rare' => [], 'Uncommon' => [], 'Common' => [], 'Fodder' => []);
foreach($nftMetadatas as $nftMetadata) {
$tier = $nftMetadata->getTemplate()->getTier();
if($tier === 1 && count($nftMetadatasByTier['Fodder']) < 3) {
array_push($nftMetadatasByTier['Fodder'], $nftMetadata);
} elseif($tier === 2 && count($nftMetadatasByTier['Common']) < 3) {
array_push($nftMetadatasByTier['Common'], $nftMetadata);
}elseif($tier === 3 && count($nftMetadatasByTier['Uncommon']) < 3) {
array_push($nftMetadatasByTier['Uncommon'], $nftMetadata);
}elseif($tier === 4 && count($nftMetadatasByTier['Rare']) < 3) {
array_push($nftMetadatasByTier['Rare'], $nftMetadata);
}elseif($tier === 5 && count($nftMetadatasByTier['Epic']) < 3) {
array_push($nftMetadatasByTier['Epic'], $nftMetadata);
}elseif($tier === 6 && count($nftMetadatasByTier['Legendary']) < 3) {
array_push($nftMetadatasByTier['Legendary'], $nftMetadata);
}elseif($tier === 7 && count($nftMetadatasByTier['Extreme']) < 3) {
array_push($nftMetadatasByTier['Extreme'], $nftMetadata);
}
}
return $this->render('leaderboard/catchable/season-four.html.twig', [
'controller_name' => 'LeaderboardController',
'nftMetadatasByTier' => $nftMetadatasByTier,
'expLeaders' => $expLeaders,
'gearScoreLeaders' => $gearScoreLeaders,
]);
}
}