Compare commits
24 Commits
main
...
raph_comba
Author | SHA1 | Date |
---|---|---|
|
245f301602 | 1 day ago |
|
e3fe5fb5f4 | 1 day ago |
|
ebeeac349b | 2 days ago |
|
f727fc819d | 2 days ago |
|
318734b2f2 | 2 days ago |
|
4713eab595 | 2 days ago |
|
c4fbcb8709 | 3 days ago |
|
732861cd6f | 3 days ago |
|
c01f3525ff | 3 days ago |
|
9c931cc616 | 3 days ago |
|
f5fde68b14 | 3 days ago |
|
c040ee4a6f | 4 days ago |
|
13186d6dc0 | 4 days ago |
|
3406dc14f4 | 4 days ago |
|
891f37de5f | 4 days ago |
|
edc8730198 | 4 days ago |
|
e29f03a55f | 4 days ago |
|
41916fc9b0 | 4 days ago |
|
0eda4940bc | 1 week ago |
|
7b488dc14c | 1 week ago |
|
a12876480e | 1 week ago |
|
ecf9673e5d | 1 week ago |
|
60b3a1a445 | 1 week ago |
|
4baddf303b | 1 week ago |
@ -0,0 +1 @@
|
||||
8.3
|
@ -1,29 +0,0 @@
|
||||
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,50 +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 Version20250528130332 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 TABLE emoji (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, nom VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, force DOUBLE PRECISION NOT NULL, robustesse DOUBLE PRECISION NOT NULL, intelligence DOUBLE PRECISION NOT NULL, vitesse DOUBLE PRECISION NOT NULL, nb_combat_gagne INTEGER NOT NULL, rarete INTEGER NOT NULL)
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE TABLE messenger_messages (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, body CLOB NOT NULL, headers CLOB NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL, available_at DATETIME NOT NULL, delivered_at DATETIME DEFAULT NULL)
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)
|
||||
SQL);
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// this down() migration is auto-generated, please modify it to your needs
|
||||
$this->addSql(<<<'SQL'
|
||||
DROP TABLE emoji
|
||||
SQL);
|
||||
$this->addSql(<<<'SQL'
|
||||
DROP TABLE messenger_messages
|
||||
SQL);
|
||||
}
|
||||
}
|
@ -0,0 +1,314 @@
|
||||
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;
|
||||
}
|
||||
|
||||
.section-divider {
|
||||
border: none;
|
||||
border-top: 3px solid #f8b435;
|
||||
margin: 50px auto 20px;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.section-break-icon {
|
||||
text-align: center;
|
||||
font-size: 2rem;
|
||||
margin: -20px 0;
|
||||
color: #f8b435;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
margin: 40px 10px;
|
||||
font-size: 1.8rem;
|
||||
color: #f8f5e0;
|
||||
}
|
||||
|
||||
.emoji-container:not(.base) {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
gap: 30px;
|
||||
width: fit-content;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.emoji-container.base {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 30px;
|
||||
|
||||
border: 3px dashed #f8b435;
|
||||
padding: 20px;
|
||||
margin: 0 auto 30px auto;
|
||||
border-radius: 15px;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.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: 168px; }
|
||||
}
|
||||
|
||||
.emoji-card.gold {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.emoji-card.gold::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 1%;
|
||||
left: 1%;
|
||||
width: 97%;
|
||||
height: 99%;
|
||||
background: linear-gradient(
|
||||
120deg,
|
||||
rgba(255, 255, 255, 0) 0%,
|
||||
rgba(255, 255, 255, 0.8) 50%,
|
||||
rgba(255, 255, 255, 0) 100%
|
||||
);
|
||||
animation: shine 3.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-top: 4rem;
|
||||
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;
|
||||
}
|
||||
|
||||
/* Pagination */
|
||||
|
||||
.pagination-bar {
|
||||
margin: 4rem 4rem;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
color: #f8f5e0;
|
||||
font-family: 'Georgia', serif;
|
||||
}
|
||||
|
||||
.pagination-bar button {
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 1.1rem;
|
||||
color: #f8f5e0;
|
||||
cursor: pointer;
|
||||
padding: 5px 10px;
|
||||
border-radius: 50%;
|
||||
transition: background 0.2s ease;
|
||||
}
|
||||
|
||||
.pagination-bar button.active {
|
||||
background: #333;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.pagination-bar button:hover:not(.active) {
|
||||
color: #f8b435;
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
<?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 PopulateDBEmojiAvailableCommand extends Command
|
||||
{
|
||||
|
||||
protected static $defaultName = 'app:popDBEmojiAvai';
|
||||
|
||||
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 stock_emoji');
|
||||
|
||||
// On crée la table
|
||||
$this->connection->executeStatement('
|
||||
CREATE TABLE stock_emoji (
|
||||
id INT PRIMARY KEY,
|
||||
code VARCHAR(255) NOT NULL
|
||||
)
|
||||
');
|
||||
|
||||
// On peuple la table
|
||||
$this->connection->executeStatement("INSERT INTO stock_emoji (id, code) VALUES
|
||||
(1,'🤖'),
|
||||
(2,'😺'),
|
||||
(3,'🧠'),
|
||||
(4,'👻'),
|
||||
(5,'🧟'),
|
||||
(6,'🐶'),
|
||||
(7,'👽'),
|
||||
(8,'🧛'),
|
||||
(9,'🎃'),
|
||||
(10,'🐸'),
|
||||
(11,'⚡'),
|
||||
(12,'💀'),
|
||||
(13,'🔥'),
|
||||
(14,'🧙'),
|
||||
(15,'🌪️'),
|
||||
(16,'😎'),
|
||||
(17,'😁'),
|
||||
(18,'🌟'),
|
||||
(19,'😈')
|
||||
");
|
||||
|
||||
$output->writeln('Base de données peuplée.');
|
||||
} catch (\Exception $e) {
|
||||
$output->writeln('<error>Erreur : ' . $e->getMessage() . '</error>');
|
||||
return Command::FAILURE;
|
||||
}
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
@ -0,0 +1,211 @@
|
||||
<?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
|
||||
{
|
||||
$emojisDeBase = [
|
||||
[
|
||||
'id' => 1,
|
||||
'nom' => 'Bob',
|
||||
'code' => '😊',
|
||||
'force' => 12.5,
|
||||
'robustesse' => 9.3,
|
||||
'intelligence' => 7.8,
|
||||
'vitesse' => 10.0,
|
||||
'nbCombatGagne' => 3,
|
||||
'rarete' => 3, // é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' => 5, // légendaire
|
||||
],
|
||||
[
|
||||
'id' => 4,
|
||||
'nom' => 'Sophie',
|
||||
'code' => '😎',
|
||||
'force' => 8.0,
|
||||
'robustesse' => 7.5,
|
||||
'intelligence' => 9.0,
|
||||
'vitesse' => 8.5,
|
||||
'nbCombatGagne' => 2,
|
||||
'rarete' => 4, // mythique
|
||||
]
|
||||
];
|
||||
|
||||
$emojisCrees = [
|
||||
[
|
||||
'id' => 6,
|
||||
'nom' => 'Benoit',
|
||||
'code' => '🤖',
|
||||
'force' => 15.0,
|
||||
'robustesse' => 12.0,
|
||||
'intelligence' => 14.0,
|
||||
'vitesse' => 13.0,
|
||||
'nbCombatGagne' => 5,
|
||||
'rarete' => 3, // épique
|
||||
],
|
||||
[
|
||||
'id' => 7,
|
||||
'nom' => 'Eric',
|
||||
'code' => '🌟',
|
||||
'force' => 18.0,
|
||||
'robustesse' => 16.0,
|
||||
'intelligence' => 17.0,
|
||||
'vitesse' => 19.0,
|
||||
'nbCombatGagne' => 8,
|
||||
'rarete' => 5, // légendaire
|
||||
],
|
||||
[
|
||||
'id' => 5,
|
||||
'nom' => 'Alice',
|
||||
'code' => '🥳',
|
||||
'force' => 6.0,
|
||||
'robustesse' => 5.0,
|
||||
'intelligence' => 4.5,
|
||||
'vitesse' => 6.5,
|
||||
'nbCombatGagne' => 0,
|
||||
'rarete' => 2, // rare
|
||||
],
|
||||
[
|
||||
'id' => 8,
|
||||
'nom' => 'Bobette',
|
||||
'code' => '🤩',
|
||||
'force' => 10.0,
|
||||
'robustesse' => 9.0,
|
||||
'intelligence' => 11.0,
|
||||
'vitesse' => 12.0,
|
||||
'nbCombatGagne' => 4,
|
||||
'rarete' => 4, // mythique
|
||||
],
|
||||
[
|
||||
'id' => 9,
|
||||
'nom' => 'Charlie',
|
||||
'code' => '😇',
|
||||
'force' => 7.0,
|
||||
'robustesse' => 6.0,
|
||||
'intelligence' => 8.0,
|
||||
'vitesse' => 7.5,
|
||||
'nbCombatGagne' => 2,
|
||||
'rarete' => 1, // commun
|
||||
],
|
||||
[
|
||||
'id' => 10,
|
||||
'nom' => 'Diana',
|
||||
'code' => '😈',
|
||||
'force' => 14.0,
|
||||
'robustesse' => 13.0,
|
||||
'intelligence' => 15.0,
|
||||
'vitesse' => 16.0,
|
||||
'nbCombatGagne' => 6,
|
||||
'rarete' => 4, // mythique
|
||||
],
|
||||
[
|
||||
'id' => 11,
|
||||
'nom' => 'Ethan',
|
||||
'code' => '🤯',
|
||||
'force' => 9.0,
|
||||
'robustesse' => 8.0,
|
||||
'intelligence' => 10.0,
|
||||
'vitesse' => 11.0,
|
||||
'nbCombatGagne' => 3,
|
||||
'rarete' => 3, // épique
|
||||
],
|
||||
[
|
||||
'id' => 12,
|
||||
'nom' => 'Fiona',
|
||||
'code' => '🥺',
|
||||
'force' => 4.0,
|
||||
'robustesse' => 3.5,
|
||||
'intelligence' => 5.0,
|
||||
'vitesse' => 4.5,
|
||||
'nbCombatGagne' => 1,
|
||||
'rarete' => 1, // commun
|
||||
],
|
||||
[
|
||||
'id' => 13,
|
||||
'nom' => 'George',
|
||||
'code' => '😜',
|
||||
'force' => 11.0,
|
||||
'robustesse' => 10.0,
|
||||
'intelligence' => 12.0,
|
||||
'vitesse' => 13.5,
|
||||
'nbCombatGagne' => 2,
|
||||
'rarete' => 3, // épique
|
||||
],
|
||||
[
|
||||
'id' => 14,
|
||||
'nom' => 'Hannah',
|
||||
'code' => '😏',
|
||||
'force' => 3.0,
|
||||
'robustesse' => 2.5,
|
||||
'intelligence' => 4.0,
|
||||
'vitesse' => 3.5,
|
||||
'nbCombatGagne' => 0,
|
||||
'rarete' => 2, // rare
|
||||
],
|
||||
[
|
||||
'id' => 15,
|
||||
'nom' => 'Ian',
|
||||
'code' => '😬',
|
||||
'force' => 17.0,
|
||||
'robustesse' => 14.0,
|
||||
'intelligence' => 16.0,
|
||||
'vitesse' => 18.0,
|
||||
'nbCombatGagne' => 7,
|
||||
'rarete' => 5, // légendaire
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($emojisDeBase as &$emoji) {
|
||||
$emoji['color'] = match ($emoji['rarete']) {
|
||||
2 => 'green',
|
||||
3 => 'purple',
|
||||
4 => 'red',
|
||||
5 => 'gold',
|
||||
default => 'gray',
|
||||
};
|
||||
}
|
||||
|
||||
foreach ($emojisCrees as &$emoji) {
|
||||
$emoji['color'] = match ($emoji['rarete']) {
|
||||
2 => 'green',
|
||||
3 => 'purple',
|
||||
4 => 'red',
|
||||
5 => 'gold',
|
||||
default => 'gray',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
return $this->render('home/index.html.twig', [
|
||||
'emojisDeBase' => $emojisDeBase,
|
||||
'emojisCrees' => $emojisCrees,
|
||||
]);
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\StockEmojiRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: StockEmojiRepository::class)]
|
||||
class StockEmoji
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $code = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getCode(): ?string
|
||||
{
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
public function setCode(string $code): self
|
||||
{
|
||||
$this->code = $code;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
<?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()
|
||||
// ;
|
||||
// }
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\StockEmoji;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<StockEmoji>
|
||||
*
|
||||
* @method StockEmoji|null find($id, $lockMode = null, $lockVersion = null)
|
||||
* @method StockEmoji|null findOneBy(array $criteria, array $orderBy = null)
|
||||
* @method StockEmoji[] findAll()
|
||||
* @method StockEmoji[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
*/
|
||||
class StockEmojiRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, StockEmoji::class);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return StockEmoji[] Returns an array of StockEmoji objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('s.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?StockEmoji
|
||||
// {
|
||||
// return $this->createQueryBuilder('s')
|
||||
// ->andWhere('s.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
<?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);
|
||||
|
||||
$rarity = (new Rarity())
|
||||
->setName('Rare')
|
||||
->setDropRate(1.0);
|
||||
|
||||
$this->em->persist($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('childId', $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