Skip to content

Commit

Permalink
feat: add new base gametypes (#1349)
Browse files Browse the repository at this point in the history
  • Loading branch information
iBotPeaches authored Jun 5, 2024
1 parent b7efe4d commit a744262
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/Enums/BaseGametype.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
use BenSampo\Enum\Enum;

/**
* @method static static ASSAULT()
* @method static static ATTRITION()
* @method static static CTF()
* @method static static ELIMINATION()
* @method static static ESCALATION()
* @method static static EXTRACTION()
* @method static static FIREFIGHT()
* @method static static GRIFBALL()
* @method static static INFECTION()
* @method static static JUGGERNAUT()
* @method static static KOTH()
* @method static static LAND_GRAB()
* @method static static LSS()
Expand All @@ -24,9 +27,12 @@
* @method static static STOCKPILE()
* @method static static STRONGHOLDS()
* @method static static TOTAL_CONTROL()
* @method static static VIP()
*/
final class BaseGametype extends Enum implements LocalizedEnum
{
const ASSAULT = 19;

const ATTRITION = 1;

const CTF = 2;
Expand All @@ -35,10 +41,16 @@ final class BaseGametype extends Enum implements LocalizedEnum

const ESCALATION = 4;

const EXTRACTION = 14;

const FIREFIGHT = 15;

const GRIFBALL = 20;

const INFECTION = 5;

const JUGGERNAUT = 17;

const KOTH = 6;

const LAND_GRAB = 7;
Expand All @@ -57,5 +69,5 @@ final class BaseGametype extends Enum implements LocalizedEnum

const TOTAL_CONTROL = 13;

const EXTRACTION = 14;
const VIP = 18;
}
8 changes: 8 additions & 0 deletions app/Support/Gametype/GametypeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ public static function findBaseGametype(string $name): BaseGametype
return BaseGametype::STRONGHOLDS();
}

$oddballModes = [
'Ninja Ball',
];

if (Str::contains($name, $oddballModes, true)) {
return BaseGametype::ODDBALL();
}

$miniGameModes = [
'Survive The Undead',
];
Expand Down
4 changes: 4 additions & 0 deletions resources/lang/en/enums.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,16 @@
FaceItStatus::ADJUSTMENT => 'Adjusted',
],
BaseGametype::class => [
BaseGametype::ASSAULT => 'Assault',
BaseGametype::ATTRITION => 'Attrition',
BaseGametype::CTF => 'CTF',
BaseGametype::ELIMINATION => 'Elimination',
BaseGametype::ESCALATION => 'Escalation',
BaseGametype::EXTRACTION => 'Extraction',
BaseGametype::FIREFIGHT => 'Firefight',
BaseGametype::GRIFBALL => 'Grifball',
BaseGametype::INFECTION => 'Infection',
BaseGametype::JUGGERNAUT => 'Juggernaut',
BaseGametype::KOTH => 'KoTH',
BaseGametype::LAND_GRAB => 'Land Grab',
BaseGametype::LSS => 'LSS',
Expand All @@ -90,5 +93,6 @@
BaseGametype::STOCKPILE => 'Stockpile',
BaseGametype::STRONGHOLDS => 'Strongholds',
BaseGametype::TOTAL_CONTROL => 'Total Control',
BaseGametype::VIP => 'VIP',
],
];
8 changes: 8 additions & 0 deletions tests/Feature/Console/RefreshOverviewsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public function testValidGenerationOfOverviews(): void
$miniGame = Gamevariant::factory()->createOne([
'name' => 'Survive The Undead',
]);
$ninjaBall = Gamevariant::factory()->createOne([
'name' => 'Ninja Ball',
]);

$map1 = Map::factory()->createOne([
'name' => 'Absolute',
Expand Down Expand Up @@ -91,6 +94,11 @@ public function testValidGenerationOfOverviews(): void
'gamevariant_id' => $miniGame->id,
]);

Game::factory()->createOne([
'map_id' => $map1->id,
'gamevariant_id' => $ninjaBall->id,
]);

// Act
$this->artisan('analytics:overviews:refresh')
->expectsOutputToContain('Processed '.$game->map->name)
Expand Down

0 comments on commit a744262

Please sign in to comment.