feat: add NerveService and nerve regen scheduled commands
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
e7940d31f6
commit
6e2ea7bcc7
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Game;
|
||||
|
||||
use App\Services\Game\NerveService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class NerveMidnightRefill extends Command
|
||||
{
|
||||
protected $signature = 'game:nerve-midnight-refill';
|
||||
protected $description = 'Refill nerve to max for all active characters at midnight';
|
||||
|
||||
public function handle(NerveService $nerveService): void
|
||||
{
|
||||
$this->info('Running midnight nerve refill...');
|
||||
|
||||
$count = $nerveService->refillAll();
|
||||
|
||||
$this->info("Nerve refilled for {$count} characters.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands\Game;
|
||||
|
||||
use App\Models\Character;
|
||||
use App\Services\Game\NerveService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class ProcessNerveRegen extends Command
|
||||
{
|
||||
protected $signature = 'game:nerve-regen';
|
||||
protected $description = 'Regenerate nerve for all active characters';
|
||||
|
||||
public function handle(NerveService $nerveService): void
|
||||
{
|
||||
$this->info('Starting nerve regeneration...');
|
||||
|
||||
$characters = Character::where('nerve', '<', \DB::raw('max_nerve'))
|
||||
->where('status', 'active')
|
||||
->get();
|
||||
|
||||
$count = $characters->count();
|
||||
$this->info("Regenerating nerve for {$count} characters...");
|
||||
|
||||
foreach ($characters as $character) {
|
||||
$nerveService->regenerate($character);
|
||||
}
|
||||
|
||||
$this->info('Nerve regeneration completed!');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user