Compare commits
No commits in common. 'cleo' and 'main' have entirely different histories.
@ -1 +0,0 @@
|
|||||||
8.3
|
|
@ -0,0 +1,29 @@
|
|||||||
|
framework:
|
||||||
|
messenger:
|
||||||
|
failure_transport: failed
|
||||||
|
|
||||||
|
transports:
|
||||||
|
# https://symfony.com/doc/current/messenger.html#transport-configuration
|
||||||
|
async:
|
||||||
|
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
|
||||||
|
options:
|
||||||
|
use_notify: true
|
||||||
|
check_delayed_interval: 60000
|
||||||
|
retry_strategy:
|
||||||
|
max_retries: 3
|
||||||
|
multiplier: 2
|
||||||
|
failed: 'doctrine://default?queue_name=failed'
|
||||||
|
# sync: 'sync://'
|
||||||
|
|
||||||
|
default_bus: messenger.bus.default
|
||||||
|
|
||||||
|
buses:
|
||||||
|
messenger.bus.default: []
|
||||||
|
|
||||||
|
routing:
|
||||||
|
Symfony\Component\Mailer\Messenger\SendEmailMessage: async
|
||||||
|
Symfony\Component\Notifier\Message\ChatMessage: async
|
||||||
|
Symfony\Component\Notifier\Message\SmsMessage: async
|
||||||
|
|
||||||
|
# Route your messages to the transports
|
||||||
|
# 'App\Message\YourMessage': async
|
@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace DoctrineMigrations;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-generated Migration: Please modify to your needs!
|
|
||||||
*/
|
|
||||||
final class Version20250529204111 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function getDescription(): string
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema): void
|
|
||||||
{
|
|
||||||
// this up() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
CREATE TEMPORARY TABLE __temp__emoji AS SELECT id, nom, code, intelligence FROM emoji
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
DROP TABLE emoji
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
CREATE TABLE emoji (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, rarity_id INTEGER NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, intelligence DOUBLE PRECISION NOT NULL, strength DOUBLE PRECISION NOT NULL, toughness DOUBLE PRECISION NOT NULL, speed DOUBLE PRECISION NOT NULL, fights_won INTEGER NOT NULL, CONSTRAINT FK_B64BF632F3747573 FOREIGN KEY (rarity_id) REFERENCES rarity (id) NOT DEFERRABLE INITIALLY IMMEDIATE)
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
INSERT INTO emoji (id, name, code, intelligence) SELECT id, nom, code, intelligence FROM __temp__emoji
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
DROP TABLE __temp__emoji
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
CREATE INDEX IDX_B64BF632F3747573 ON emoji (rarity_id)
|
|
||||||
SQL);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
// this down() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
CREATE TEMPORARY TABLE __temp__emoji AS SELECT id, name, code, intelligence FROM emoji
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
DROP TABLE emoji
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
CREATE TABLE emoji (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, nom VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, intelligence DOUBLE PRECISION NOT NULL, force DOUBLE PRECISION NOT NULL, robustesse DOUBLE PRECISION NOT NULL, vitesse DOUBLE PRECISION NOT NULL, nb_combat_gagne INTEGER NOT NULL, rarete INTEGER NOT NULL)
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
INSERT INTO emoji (id, nom, code, intelligence) SELECT id, name, code, intelligence FROM __temp__emoji
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
DROP TABLE __temp__emoji
|
|
||||||
SQL);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace DoctrineMigrations;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-generated Migration: Please modify to your needs!
|
|
||||||
*/
|
|
||||||
final class Version20250530163653 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function getDescription(): string
|
|
||||||
{
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema): void
|
|
||||||
{
|
|
||||||
// this up() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
CREATE TEMPORARY TABLE __temp__emoji AS SELECT id, rarity_id, name, code, intelligence, strength, toughness, speed, fights_won FROM emoji
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
DROP TABLE emoji
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
CREATE TABLE emoji (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, rarity_id INTEGER NOT NULL, parent1_id INTEGER DEFAULT NULL, parent2_id INTEGER DEFAULT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, intelligence DOUBLE PRECISION NOT NULL, strength DOUBLE PRECISION NOT NULL, toughness DOUBLE PRECISION NOT NULL, speed DOUBLE PRECISION NOT NULL, fights_won INTEGER NOT NULL, CONSTRAINT FK_B64BF632F3747573 FOREIGN KEY (rarity_id) REFERENCES rarity (id) ON UPDATE NO ACTION ON DELETE NO ACTION NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_B64BF632861B2665 FOREIGN KEY (parent1_id) REFERENCES emoji (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_B64BF63294AE898B FOREIGN KEY (parent2_id) REFERENCES emoji (id) NOT DEFERRABLE INITIALLY IMMEDIATE)
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
INSERT INTO emoji (id, rarity_id, name, code, intelligence, strength, toughness, speed, fights_won) SELECT id, rarity_id, name, code, intelligence, strength, toughness, speed, fights_won FROM __temp__emoji
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
DROP TABLE __temp__emoji
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
CREATE INDEX IDX_B64BF632F3747573 ON emoji (rarity_id)
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
CREATE INDEX IDX_B64BF632861B2665 ON emoji (parent1_id)
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
CREATE INDEX IDX_B64BF63294AE898B ON emoji (parent2_id)
|
|
||||||
SQL);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(Schema $schema): void
|
|
||||||
{
|
|
||||||
// this down() migration is auto-generated, please modify it to your needs
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
CREATE TEMPORARY TABLE __temp__emoji AS SELECT id, rarity_id, name, code, strength, toughness, intelligence, speed, fights_won FROM emoji
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
DROP TABLE emoji
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
CREATE TABLE emoji (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, rarity_id INTEGER NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, strength DOUBLE PRECISION NOT NULL, toughness DOUBLE PRECISION NOT NULL, intelligence DOUBLE PRECISION NOT NULL, speed DOUBLE PRECISION NOT NULL, fights_won INTEGER NOT NULL, CONSTRAINT FK_B64BF632F3747573 FOREIGN KEY (rarity_id) REFERENCES rarity (id) NOT DEFERRABLE INITIALLY IMMEDIATE)
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
INSERT INTO emoji (id, rarity_id, name, code, strength, toughness, intelligence, speed, fights_won) SELECT id, rarity_id, name, code, strength, toughness, intelligence, speed, fights_won FROM __temp__emoji
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
DROP TABLE __temp__emoji
|
|
||||||
SQL);
|
|
||||||
$this->addSql(<<<'SQL'
|
|
||||||
CREATE INDEX IDX_B64BF632F3747573 ON emoji (rarity_id)
|
|
||||||
SQL);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,248 +0,0 @@
|
|||||||
body {
|
|
||||||
background-color: #314e57;
|
|
||||||
font-family: 'Georgia', serif;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
text-shadow: 2px 2px 4px #000;
|
|
||||||
color: #f8b435;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emoji-container {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 30px;
|
|
||||||
margin-bottom: 10rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emoji-card {
|
|
||||||
background: #f2e6c9;
|
|
||||||
width: 180px;
|
|
||||||
height: 220px;
|
|
||||||
border: 4px solid #000;
|
|
||||||
border-radius: 12px;
|
|
||||||
box-shadow: 0 0 20px rgba(0,0,0,0.5);
|
|
||||||
padding: 20px;
|
|
||||||
text-align: center;
|
|
||||||
font-family: 'Georgia', serif;
|
|
||||||
position: relative;
|
|
||||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emoji-card:hover {
|
|
||||||
transform: translateY(-8px) scale(1.03);
|
|
||||||
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Animation brillance pour rareté légendaire */
|
|
||||||
@keyframes shine {
|
|
||||||
0% { background-position: 0px; }
|
|
||||||
100% { background-position: 177px; }
|
|
||||||
}
|
|
||||||
|
|
||||||
.emoji-card.gold {
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emoji-card.gold::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 1%;
|
|
||||||
width: 98%;
|
|
||||||
height: 100%;
|
|
||||||
background: linear-gradient(
|
|
||||||
120deg,
|
|
||||||
rgba(255, 255, 255, 0) 0%,
|
|
||||||
rgba(255, 255, 255, 0.5) 50%,
|
|
||||||
rgba(255, 255, 255, 0) 100%
|
|
||||||
);
|
|
||||||
animation: shine 5s infinite;
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emoji-card > * {
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*---------------------------*/
|
|
||||||
|
|
||||||
.emoji-card.gray { border-color: gray; }
|
|
||||||
|
|
||||||
@keyframes auraGlow {
|
|
||||||
0% { box-shadow: 0 0 10px 0 rgba(0,0,0,0.3); }
|
|
||||||
50% { box-shadow: 0 0 25px 8px currentColor; }
|
|
||||||
100% { box-shadow: 0 0 10px 0 rgba(0,0,0,0.3); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Applique une animation d'aura par rareté */
|
|
||||||
.emoji-card.green {
|
|
||||||
color: darkgreen;
|
|
||||||
animation: auraGlow 3s infinite ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emoji-card.purple {
|
|
||||||
color: purple;
|
|
||||||
animation: auraGlow 3s infinite ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emoji-card.red {
|
|
||||||
color: darkred;
|
|
||||||
animation: auraGlow 3s infinite ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emoji-card.gold {
|
|
||||||
color: goldenrod;
|
|
||||||
animation: auraGlow 3s infinite ease-in-out;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Couleurs des noms selon rareté */
|
|
||||||
.emoji-name.green { color: darkgreen; }
|
|
||||||
.emoji-name.purple { color: purple; }
|
|
||||||
.emoji-name.red { color: darkred; }
|
|
||||||
.emoji-name.gold { color: goldenrod; }
|
|
||||||
.emoji-name.gray { color: gray; }
|
|
||||||
|
|
||||||
.emoji-card .emoji {
|
|
||||||
font-size: 50px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emoji-name {
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 1.2rem;
|
|
||||||
margin-top: 5px;
|
|
||||||
color: purple;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emoji-level {
|
|
||||||
font-size: 1rem;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #3c2f2f;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.action-buttons {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 60px;
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
background: #f2e6c9;
|
|
||||||
border: 3px solid #000;
|
|
||||||
padding: 10px 25px;
|
|
||||||
font-size: 1.2rem;
|
|
||||||
font-weight: bold;
|
|
||||||
border-radius: 8px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: transform 0.2s ease;
|
|
||||||
box-shadow: 3px 3px 0 #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn:hover {
|
|
||||||
transform: scale(1.05);
|
|
||||||
background-color: #e5d6b8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-icon {
|
|
||||||
position: absolute;
|
|
||||||
top: 8px;
|
|
||||||
right: 10px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 18px;
|
|
||||||
color: #555;
|
|
||||||
}
|
|
||||||
|
|
||||||
.popup {
|
|
||||||
position: absolute;
|
|
||||||
top: 110%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
background: #fff8e1;
|
|
||||||
color: #000;
|
|
||||||
padding: 10px;
|
|
||||||
border: 2px solid #000;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 0 10px rgba(0,0,0,0.3);
|
|
||||||
display: none;
|
|
||||||
z-index: 10;
|
|
||||||
width: 180px;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Filtre et Tri*/
|
|
||||||
.filter-bar {
|
|
||||||
margin-bottom: 30px;
|
|
||||||
color: #f8f5e0;
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-bar select {
|
|
||||||
margin: 0 10px;
|
|
||||||
padding: 5px 10px;
|
|
||||||
border-radius: 6px;
|
|
||||||
border: 2px solid #000;
|
|
||||||
background: #f2e6c9;
|
|
||||||
font-family: 'Georgia', serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Champs de Recherche */
|
|
||||||
.filter-bar input[type="text"] {
|
|
||||||
padding: 5px 10px;
|
|
||||||
border-radius: 6px;
|
|
||||||
border: 2px solid #000;
|
|
||||||
background: #f2e6c9;
|
|
||||||
font-family: 'Georgia', serif;
|
|
||||||
margin-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Style séléction créature pour combat / accouplement */
|
|
||||||
|
|
||||||
/* Etat séléctionné */
|
|
||||||
.emoji-card.selected {
|
|
||||||
outline: 4px solid #f8b435;
|
|
||||||
outline-offset: -4px;
|
|
||||||
box-shadow: 0 0 30px 10px rgba(248, 180, 53, 0.6);
|
|
||||||
}
|
|
||||||
|
|
||||||
#selection-status {
|
|
||||||
font-size: 1.1rem;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #f9e8c0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.selection-visual {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
gap: 15px;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.creature-tag {
|
|
||||||
padding: 8px 15px;
|
|
||||||
background: #f2e6c9;
|
|
||||||
border: 2px solid #000;
|
|
||||||
border-radius: 8px;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
box-shadow: 2px 2px 0 #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vs-text {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Command;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Connection;
|
|
||||||
use Symfony\Component\Console\Command\Command;
|
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
|
||||||
|
|
||||||
class PopulateDBCommand extends Command
|
|
||||||
{
|
|
||||||
protected static $defaultName = 'app:populateDB';
|
|
||||||
|
|
||||||
private Connection $connection;
|
|
||||||
|
|
||||||
public function __construct(Connection $connection)
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
$this->connection = $connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function configure()
|
|
||||||
{
|
|
||||||
$this
|
|
||||||
->setDescription('Populate the database.');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
|
|
||||||
// On supprime la table si elle existe déjà
|
|
||||||
$this->connection->executeStatement('DROP TABLE IF EXISTS rarity');
|
|
||||||
|
|
||||||
// On crée la table
|
|
||||||
$this->connection->executeStatement('
|
|
||||||
CREATE TABLE rarity (
|
|
||||||
id INT PRIMARY KEY,
|
|
||||||
name VARCHAR(255) NOT NULL,
|
|
||||||
drop_rate FLOAT NOT NULL
|
|
||||||
)
|
|
||||||
');
|
|
||||||
|
|
||||||
// On peuple la table
|
|
||||||
$this->connection->executeStatement("INSERT INTO rarity (id, name, drop_rate) VALUES
|
|
||||||
(1, 'Common', 0.6),
|
|
||||||
(2, 'Rare', 0.2),
|
|
||||||
(3, 'Epic', 0.1),
|
|
||||||
(4, 'Mythical', 0.085),
|
|
||||||
(5, 'Legendary', 0.015)
|
|
||||||
");
|
|
||||||
|
|
||||||
$output->writeln('Base de données peuplée.');
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$output->writeln('<error>Erreur : ' . $e->getMessage() . '</error>');
|
|
||||||
return Command::FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Command::SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,66 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controller;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
|
||||||
|
|
||||||
class HomeController extends AbstractController
|
|
||||||
{
|
|
||||||
#[Route('/', name: 'home')]
|
|
||||||
public function index(): Response
|
|
||||||
{
|
|
||||||
$emojis = [
|
|
||||||
[
|
|
||||||
'id' => 1,
|
|
||||||
'nom' => 'Bob',
|
|
||||||
'code' => '😊',
|
|
||||||
'force' => 12.5,
|
|
||||||
'robustesse' => 9.3,
|
|
||||||
'intelligence' => 7.8,
|
|
||||||
'vitesse' => 10.0,
|
|
||||||
'nbCombatGagne' => 3,
|
|
||||||
'rarete' => 2, // épique
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 2,
|
|
||||||
'nom' => 'John',
|
|
||||||
'code' => '😭',
|
|
||||||
'force' => 5.1,
|
|
||||||
'robustesse' => 4.2,
|
|
||||||
'intelligence' => 3.3,
|
|
||||||
'vitesse' => 6.0,
|
|
||||||
'nbCombatGagne' => 1,
|
|
||||||
'rarete' => 1, // commun
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'id' => 3,
|
|
||||||
'nom' => 'Rodolph',
|
|
||||||
'code' => '😁',
|
|
||||||
'force' => 20.0,
|
|
||||||
'robustesse' => 15.0,
|
|
||||||
'intelligence' => 18.0,
|
|
||||||
'vitesse' => 17.0,
|
|
||||||
'nbCombatGagne' => 10,
|
|
||||||
'rarete' => 4, // légendaire
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
// Ajout de la couleur selon la rareté
|
|
||||||
foreach ($emojis as &$emoji) {
|
|
||||||
|
|
||||||
$emoji['color'] = match ($emoji['rarete']) {
|
|
||||||
1 => 'green', // commun
|
|
||||||
2 => 'purple', // épique
|
|
||||||
3 => 'red', // mythique
|
|
||||||
4 => 'gold', // légendaire
|
|
||||||
default => 'gray'
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('home/index.html.twig', [
|
|
||||||
'emojis' => $emojis,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Entity;
|
|
||||||
|
|
||||||
use App\Repository\RarityRepository;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: RarityRepository::class)]
|
|
||||||
class Rarity
|
|
||||||
{
|
|
||||||
#[ORM\Id]
|
|
||||||
#[ORM\GeneratedValue]
|
|
||||||
#[ORM\Column]
|
|
||||||
private ?int $id = null;
|
|
||||||
|
|
||||||
#[ORM\Column(length: 50, unique: true)]
|
|
||||||
private string $name;
|
|
||||||
|
|
||||||
#[ORM\Column(type: 'float')]
|
|
||||||
private float $dropRate;
|
|
||||||
|
|
||||||
public function getId(): ?int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getName(): string
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setName(string $name): self
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getDropRate(): float
|
|
||||||
{
|
|
||||||
return $this->dropRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setDropRate(float $dropRate): self
|
|
||||||
{
|
|
||||||
$this->dropRate = $dropRate;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Repository;
|
|
||||||
|
|
||||||
use App\Entity\Rarity;
|
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @extends ServiceEntityRepository<Rarity>
|
|
||||||
*
|
|
||||||
* @method Rarity|null find($id, $lockMode = null, $lockVersion = null)
|
|
||||||
* @method Rarity|null findOneBy(array $criteria, array $orderBy = null)
|
|
||||||
* @method Rarity[] findAll()
|
|
||||||
* @method Rarity[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
|
||||||
*/
|
|
||||||
class RarityRepository extends ServiceEntityRepository
|
|
||||||
{
|
|
||||||
public function __construct(ManagerRegistry $registry)
|
|
||||||
{
|
|
||||||
parent::__construct($registry, Rarity::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * @return Rarity[] Returns an array of Rarity objects
|
|
||||||
// */
|
|
||||||
// public function findByExampleField($value): array
|
|
||||||
// {
|
|
||||||
// return $this->createQueryBuilder('r')
|
|
||||||
// ->andWhere('r.exampleField = :val')
|
|
||||||
// ->setParameter('val', $value)
|
|
||||||
// ->orderBy('r.id', 'ASC')
|
|
||||||
// ->setMaxResults(10)
|
|
||||||
// ->getQuery()
|
|
||||||
// ->getResult()
|
|
||||||
// ;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public function findOneBySomeField($value): ?Rarity
|
|
||||||
// {
|
|
||||||
// return $this->createQueryBuilder('r')
|
|
||||||
// ->andWhere('r.exampleField = :val')
|
|
||||||
// ->setParameter('val', $value)
|
|
||||||
// ->getQuery()
|
|
||||||
// ->getOneOrNullResult()
|
|
||||||
// ;
|
|
||||||
// }
|
|
||||||
}
|
|
@ -1,90 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Tests\Controller;
|
|
||||||
|
|
||||||
use App\Entity\Emoji;
|
|
||||||
use App\Entity\Rarity;
|
|
||||||
use App\Repository\EmojiRepository;
|
|
||||||
use App\Repository\RarityRepository;
|
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
|
|
||||||
class EmojiControllerTest extends WebTestCase
|
|
||||||
{
|
|
||||||
private $client;
|
|
||||||
private EntityManagerInterface $em;
|
|
||||||
|
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
$this->client = static::createClient();
|
|
||||||
$this->em = static::getContainer()->get(EntityManagerInterface::class);
|
|
||||||
|
|
||||||
// Démarre une transaction pour pouvoir annuler les modifications des tests
|
|
||||||
$this->em->getConnection()->beginTransaction();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function tearDown(): void
|
|
||||||
{
|
|
||||||
// Rollback la transaction pour annuler les changements des tests
|
|
||||||
$this->em->getConnection()->rollBack();
|
|
||||||
parent::tearDown();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testReproduceEmoji(): void
|
|
||||||
{
|
|
||||||
$emoji1 = (new Emoji())
|
|
||||||
->setCode('😀')
|
|
||||||
->setName('Parent1')
|
|
||||||
->setStrength(1.0)
|
|
||||||
->setToughness(1.0)
|
|
||||||
->setIntelligence(1.0)
|
|
||||||
->setSpeed(1.0)
|
|
||||||
->setFightsWon(5);
|
|
||||||
|
|
||||||
$emoji2 = (new Emoji())
|
|
||||||
->setCode('😎')
|
|
||||||
->setName('Parent2')
|
|
||||||
->setStrength(2.0)
|
|
||||||
->setToughness(2.0)
|
|
||||||
->setIntelligence(2.0)
|
|
||||||
->setSpeed(2.0)
|
|
||||||
->setFightsWon(3);
|
|
||||||
|
|
||||||
$rr = $this->em->getRepository(Rarity::class);
|
|
||||||
$rarity = $rr->findOneBy([], ['id' => 'ASC']);
|
|
||||||
|
|
||||||
$emoji1->setRarity($rarity);
|
|
||||||
$emoji2->setRarity($rarity);
|
|
||||||
|
|
||||||
$this->em->persist($emoji1);
|
|
||||||
$this->em->persist($emoji2);
|
|
||||||
$this->em->flush();
|
|
||||||
|
|
||||||
$id1 = $emoji1->getId();
|
|
||||||
$id2 = $emoji2->getId();
|
|
||||||
|
|
||||||
$this->client->request('GET', "/emoji/fusion/$id1/$id2");
|
|
||||||
|
|
||||||
$response = $this->client->getResponse();
|
|
||||||
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
|
|
||||||
|
|
||||||
$data = json_decode($response->getContent(), true);
|
|
||||||
$this->assertArrayHasKey('baby', $data);
|
|
||||||
$this->assertEquals('Child created', $data['message']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testFusionEmojiNotFound(): void
|
|
||||||
{
|
|
||||||
$emojiRepo = $this->createMock(EmojiRepository::class);
|
|
||||||
$emojiRepo->method('find')->willReturn(null);
|
|
||||||
|
|
||||||
$this->client->request('GET', '/emoji/fusion/999/998');
|
|
||||||
|
|
||||||
$response = $this->client->getResponse();
|
|
||||||
$this->assertEquals(Response::HTTP_NOT_FOUND, $response->getStatusCode());
|
|
||||||
|
|
||||||
$data = json_decode($response->getContent(), true);
|
|
||||||
$this->assertEquals('One or both emojis not found', $data['error']);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue