From eb46f78447735f00bfbb7d436908a2d3e83e10cb Mon Sep 17 00:00:00 2001 From: Bilge Date: Sat, 1 Jun 2024 20:00:04 +0100 Subject: [PATCH] Added free games ranking in lieu of "Free to Play" tag. --- src/Page/HomePage.php | 3 ++- src/Ranking/Impl/FreeRanking.php | 23 +++++++++++++++++++++++ src/Ranking/RankingName.php | 5 ++++- template/adult.twig | 2 +- template/home.twig | 2 +- template/layout/template.twig | 2 +- template/price/free.twig | 8 ++++++++ 7 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 src/Ranking/Impl/FreeRanking.php create mode 100644 template/price/free.twig diff --git a/src/Page/HomePage.php b/src/Page/HomePage.php index 99ffe30b947..3afe041c44b 100644 --- a/src/Page/HomePage.php +++ b/src/Page/HomePage.php @@ -6,6 +6,7 @@ use Doctrine\DBAL\Connection; use ScriptFUSION\Steam250\SiteGenerator\Database\Queries; use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\DiscountRanking; +use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\FreeRanking; use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\HiddenGemsRanking; use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\MostPlayedRanking; use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\RollingWeekRanking; @@ -76,7 +77,7 @@ public static function getRankings(): array MostPlayedRanking::class, UsdUnder5Ranking::class, DiscountRanking::class, - 'free_to_play', + FreeRanking::class, 'sexual_content', 'co-op', 'rpg', diff --git a/src/Ranking/Impl/FreeRanking.php b/src/Ranking/Impl/FreeRanking.php new file mode 100644 index 00000000000..097b51b4594 --- /dev/null +++ b/src/Ranking/Impl/FreeRanking.php @@ -0,0 +1,23 @@ +setTitle('Free Games'); + $this->setDescription('Top 250 best free of charge games on Steam, according to gamer reviews.'); + } + + public function customizeQuery(QueryBuilder $builder): void + { + $builder->andWhere('app.free = 1'); + } +} diff --git a/src/Ranking/RankingName.php b/src/Ranking/RankingName.php index 6553a8c22eb..346143318cb 100644 --- a/src/Ranking/RankingName.php +++ b/src/Ranking/RankingName.php @@ -11,6 +11,7 @@ use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\DeveloperRanking; use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\DiscountRanking; use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\DlcRanking; +use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\FreeRanking; use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\HiddenGemsRanking; use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\HiddenNovelsRanking; use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\Linux250Ranking; @@ -27,7 +28,6 @@ use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\SteamDeckPlayableRanking; use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\SteamDeckVerifiedRanking; use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\Top250Ranking; -use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\TrendRanking; use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\Usd10To15Ranking; use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\Usd5To10Ranking; use ScriptFUSION\Steam250\SiteGenerator\Ranking\Impl\UsdOver15Ranking; @@ -42,6 +42,7 @@ final class RankingName extends AbstractEnumeration public const BOTTOM_100 = 'BOTTOM_100'; public const DLC = 'DLC'; public const DISCOUNT = 'DISCOUNT'; + public const FREE = 'FREE'; public const USD_UNDER_5 = 'USD_UNDER_5'; public const USD5_10 = 'USD5_10'; public const USD10_15 = 'USD10_15'; @@ -73,6 +74,7 @@ final class RankingName extends AbstractEnumeration self::BOTTOM_100 => Bottom100Ranking::class, self::DLC => DlcRanking::class, self::DISCOUNT => DiscountRanking::class, + self::FREE => FreeRanking::class, self::USD_UNDER_5 => UsdUnder5Ranking::class, self::USD5_10 => Usd5To10Ranking::class, self::USD10_15 => Usd10To15Ranking::class, @@ -105,6 +107,7 @@ final class RankingName extends AbstractEnumeration self::BOTTOM_100 => 'b100', self::DLC => 'dlc', self::DISCOUNT => 'discount', + self::FREE => 'free', self::USD_UNDER_5 => 'u5', self::USD5_10 => '5-10', self::USD10_15 => '10-15', diff --git a/template/adult.twig b/template/adult.twig index af91b844c66..2effed2ea1c 100644 --- a/template/adult.twig +++ b/template/adult.twig @@ -1,6 +1,6 @@ {% extends 'layout/ranking.twig' %} -{% block title %}Top 250 best Adult Steam games{% endblock %} +{% block title %}Top 250 best Adult Steam Games{% endblock %} {% block heading %}Adult 250{% endblock %} {% block content %} diff --git a/template/home.twig b/template/home.twig index 48f91ba950a..3434714282e 100644 --- a/template/home.twig +++ b/template/home.twig @@ -11,7 +11,7 @@ {% set url = ranking.ranking.url ?? (id ~ ext) %}
- {% set group = id in ['price/under5', 'discounts', 'tag/free_to_play'] ? 'budget' + {% set group = id in ['price/under5', 'discounts', 'price/free'] ? 'budget' : id[:4] == 'tag/' ? 'tag' : '' %} diff --git a/template/layout/template.twig b/template/layout/template.twig index cef25963077..ffcfd1d8b08 100644 --- a/template/layout/template.twig +++ b/template/layout/template.twig @@ -126,7 +126,7 @@ Price
  1. Top 250 Discounts -
  2. Free Games +
  3. Free Games
  4. Games Under $5
  5. Games $5–10
  6. Games $10–15 diff --git a/template/price/free.twig b/template/price/free.twig new file mode 100644 index 00000000000..79ec7557223 --- /dev/null +++ b/template/price/free.twig @@ -0,0 +1,8 @@ +{% extends 'layout/ranking.twig' %} + +{% block title %}Top 250 best Free Steam Games{% endblock %} +{% block heading %}Free 250{% endblock %} + +{% block content %} +

    {{ ranking.description }}

    +{% endblock %}