- Adds Character model with survival needs (hunger, thirst, energy) and state machine - Implements city:tick world ticker for offline progression every minute - Adds city territory expansion and building construction system - Introduces job economy, inventory, and transaction audit trail - Adds social graph (friends, marriage, children) and character chat - Implements admin approval workflow for new registrations - Adds hospital admission system for traffic accidents - Includes comprehensive feature tests and world seeders
53 lines
1.2 KiB
PHP
Executable File
53 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Character;
|
|
use App\Models\City;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<Character>
|
|
*/
|
|
class CharacterFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'user_id' => User::factory(),
|
|
'city_id' => City::factory(),
|
|
'name' => fake()->firstName(),
|
|
'skin' => fake()->numberBetween(1, 4),
|
|
'hair' => fake()->numberBetween(1, 4),
|
|
'shirt' => fake()->numberBetween(1, 5),
|
|
'pos_x' => 0,
|
|
'pos_y' => 0,
|
|
'pos_z' => 25,
|
|
'money' => 100,
|
|
'energy' => 100,
|
|
'hunger' => 100,
|
|
'thirst' => 100,
|
|
'state' => Character::STATE_AWAKE,
|
|
'education' => 0,
|
|
'is_online' => false,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Character without an account (NPC child).
|
|
*/
|
|
public function npc(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'user_id' => null,
|
|
'name' => fake()->firstName(),
|
|
]);
|
|
}
|
|
}
|