diff --git a/dist/app/Console/Commands/ProcessMatchmaking.php b/dist/app/Console/Commands/ProcessMatchmaking.php index 0cbff8c..e212c97 100644 --- a/dist/app/Console/Commands/ProcessMatchmaking.php +++ b/dist/app/Console/Commands/ProcessMatchmaking.php @@ -18,7 +18,7 @@ class ProcessMatchmaking extends Command { - public static int $repeatTimeSeconds = 20; + public static int $repeatTimeSeconds = 10; const ONE_VS_FOUR_AND_VS_FIVE_FIRST_ATTEMPT_CACHE_KEY = 'matchmaking_attempt_1v4_1v5'; diff --git a/dist/app/Console/Commands/SetCurrencyModifiers.php b/dist/app/Console/Commands/SetCurrencyModifiers.php new file mode 100644 index 0000000..1dac97c --- /dev/null +++ b/dist/app/Console/Commands/SetCurrencyModifiers.php @@ -0,0 +1,73 @@ +setTimeFromTimeString(static::DAILY_START_TIME); + $endTime = Carbon::today()->setTimeFromTimeString(static::DAILY_END_TIME); + + if(Carbon::now()->between($startTime, $endTime)) { + $this->setModifiers(static::MODIFIER_AMOUNT); + $this->setGamenewsVisibility(true); + } + else { + $this->setModifiers(1); + $this->setGamenewsVisibility(false); + } + } + + private function setGamenewsVisibility(bool $enabled): void + { + $news = News::find(static::GAME_NEWS_ID); + + if($news === null) + return; + + $news->enabled = $enabled; + $news->save(); + } + + private function setModifiers(float $modifier): void { + $config = CurrencyMultipliers::get(); + + $config->currencyA = $modifier; + $config->currencyB = $modifier; + $config->currencyC = $modifier; + + $config->save(); + } +} diff --git a/dist/app/Console/Kernel.php b/dist/app/Console/Kernel.php index ca87e9d..586aa94 100644 --- a/dist/app/Console/Kernel.php +++ b/dist/app/Console/Kernel.php @@ -13,10 +13,11 @@ class Kernel extends ConsoleKernel protected function schedule(Schedule $schedule): void { $schedule->command('model:prune')->daily(); - $schedule->command('matchmaking:process')->everyTwentySeconds(); + $schedule->command('matchmaking:process')->everyTenSeconds(); $schedule->command('matchmaking:cleanup')->everyThirtySeconds(); $schedule->command('app:generate-timed-challenges')->daily(); $schedule->command('app:cleanup-logs')->daily(); + $schedule->command('app:set-currency-modifiers')->hourlyAt(1); } /**