first commit
This commit is contained in:
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Crime;
|
||||
use App\Models\Location;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class CrimeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$downtown = Location::where('slug', 'downtown')->first();
|
||||
$industrial = Location::where('slug', 'industrial-district')->first();
|
||||
$waterfront = Location::where('slug', 'waterfront')->first();
|
||||
|
||||
$crimes = [
|
||||
// Downtown Crimes
|
||||
[
|
||||
'name' => 'Pickpocket',
|
||||
'slug' => 'pickpocket',
|
||||
'description' => 'Steal money from an unsuspecting pedestrian.',
|
||||
'difficulty' => 'easy',
|
||||
'success_rate' => 0.80,
|
||||
'reward_min' => 100,
|
||||
'reward_max' => 500,
|
||||
'experience' => 50,
|
||||
'energy_cost' => 10,
|
||||
'cooldown' => 60,
|
||||
'requires_level' => 1,
|
||||
'location_id' => $downtown?->id ?? null,
|
||||
],
|
||||
[
|
||||
'name' => 'Mugging',
|
||||
'slug' => 'mugging',
|
||||
'description' => 'Rob someone at knife-point.',
|
||||
'difficulty' => 'medium',
|
||||
'success_rate' => 0.70,
|
||||
'reward_min' => 500,
|
||||
'reward_max' => 1500,
|
||||
'experience' => 100,
|
||||
'energy_cost' => 15,
|
||||
'cooldown' => 120,
|
||||
'requires_level' => 3,
|
||||
'location_id' => $downtown?->id ?? null,
|
||||
],
|
||||
[
|
||||
'name' => 'Shoplifting',
|
||||
'slug' => 'shoplifting',
|
||||
'description' => 'Steal items from a store.',
|
||||
'difficulty' => 'medium',
|
||||
'success_rate' => 0.65,
|
||||
'reward_min' => 200,
|
||||
'reward_max' => 1000,
|
||||
'experience' => 75,
|
||||
'energy_cost' => 12,
|
||||
'cooldown' => 120,
|
||||
'requires_level' => 1,
|
||||
'location_id' => $downtown?->id ?? null,
|
||||
],
|
||||
|
||||
// Industrial District Crimes
|
||||
[
|
||||
'name' => 'Factory Theft',
|
||||
'slug' => 'factory-theft',
|
||||
'description' => 'Steal goods from a factory warehouse.',
|
||||
'difficulty' => 'medium',
|
||||
'success_rate' => 0.60,
|
||||
'reward_min' => 1000,
|
||||
'reward_max' => 3000,
|
||||
'experience' => 150,
|
||||
'energy_cost' => 20,
|
||||
'cooldown' => 180,
|
||||
'requires_level' => 5,
|
||||
'location_id' => $industrial?->id ?? null,
|
||||
],
|
||||
[
|
||||
'name' => 'Equipment Sabotage',
|
||||
'slug' => 'equipment-sabotage',
|
||||
'description' => 'Sabotage factory equipment for a fee.',
|
||||
'difficulty' => 'hard',
|
||||
'success_rate' => 0.50,
|
||||
'reward_min' => 2000,
|
||||
'reward_max' => 5000,
|
||||
'experience' => 200,
|
||||
'energy_cost' => 25,
|
||||
'cooldown' => 300,
|
||||
'requires_level' => 8,
|
||||
'location_id' => $industrial?->id ?? null,
|
||||
],
|
||||
|
||||
// Waterfront Crimes
|
||||
[
|
||||
'name' => 'Smuggling',
|
||||
'slug' => 'smuggling',
|
||||
'description' => 'Smuggle illegal goods past customs.',
|
||||
'difficulty' => 'hard',
|
||||
'success_rate' => 0.55,
|
||||
'reward_min' => 3000,
|
||||
'reward_max' => 8000,
|
||||
'experience' => 250,
|
||||
'energy_cost' => 30,
|
||||
'cooldown' => 300,
|
||||
'requires_level' => 10,
|
||||
'location_id' => $waterfront?->id ?? null,
|
||||
],
|
||||
[
|
||||
'name' => 'Piracy',
|
||||
'slug' => 'piracy',
|
||||
'description' => 'Hijack a shipment at sea.',
|
||||
'difficulty' => 'very_hard',
|
||||
'success_rate' => 0.40,
|
||||
'reward_min' => 5000,
|
||||
'reward_max' => 15000,
|
||||
'experience' => 400,
|
||||
'energy_cost' => 40,
|
||||
'cooldown' => 600,
|
||||
'requires_level' => 15,
|
||||
'location_id' => $waterfront?->id ?? null,
|
||||
],
|
||||
|
||||
// Generic Crimes (available everywhere)
|
||||
[
|
||||
'name' => 'Car Theft',
|
||||
'slug' => 'car-theft',
|
||||
'description' => 'Steal a car and sell it for parts.',
|
||||
'difficulty' => 'medium',
|
||||
'success_rate' => 0.75,
|
||||
'reward_min' => 2000,
|
||||
'reward_max' => 4000,
|
||||
'experience' => 120,
|
||||
'energy_cost' => 20,
|
||||
'cooldown' => 180,
|
||||
'requires_level' => 5,
|
||||
'location_id' => null,
|
||||
],
|
||||
[
|
||||
'name' => 'Burglary',
|
||||
'slug' => 'burglary',
|
||||
'description' => 'Break into a house and steal valuables.',
|
||||
'difficulty' => 'hard',
|
||||
'success_rate' => 0.60,
|
||||
'reward_min' => 3000,
|
||||
'reward_max' => 6000,
|
||||
'experience' => 200,
|
||||
'energy_cost' => 25,
|
||||
'cooldown' => 300,
|
||||
'requires_level' => 7,
|
||||
'location_id' => null,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($crimes as $crime) {
|
||||
Crime::updateOrCreate(
|
||||
['slug' => $crime['slug']],
|
||||
$crime
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// Seed locations first (required by other seeders)
|
||||
$this->call([
|
||||
LocationSeeder::class,
|
||||
]);
|
||||
|
||||
// Then seed items and crimes
|
||||
$this->call([
|
||||
ItemSeeder::class,
|
||||
CrimeSeeder::class,
|
||||
]);
|
||||
|
||||
// Create test user
|
||||
$user = User::factory()->create([
|
||||
'name' => 'Test User',
|
||||
'email' => 'test@example.com',
|
||||
'password' => bcrypt('password'),
|
||||
]);
|
||||
|
||||
// Optionally create a test character for the user
|
||||
// This can be done manually through the UI or via a separate seeder
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Item;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ItemSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$items = [
|
||||
// Weapons
|
||||
[
|
||||
'name' => 'Knife',
|
||||
'slug' => 'knife',
|
||||
'description' => 'A basic knife for self-defense.',
|
||||
'type' => 'weapon',
|
||||
'value' => 100,
|
||||
'buy_price' => 500,
|
||||
'sell_price' => 250,
|
||||
'requires_level' => 1,
|
||||
'attack_bonus' => 5,
|
||||
'defense_bonus' => 0,
|
||||
'health_bonus' => 0,
|
||||
'energy_bonus' => 0,
|
||||
'is_tradeable' => true,
|
||||
'is_usable' => false,
|
||||
],
|
||||
[
|
||||
'name' => 'Baseball Bat',
|
||||
'slug' => 'baseball-bat',
|
||||
'description' => 'A sturdy bat that can deal serious damage.',
|
||||
'type' => 'weapon',
|
||||
'value' => 500,
|
||||
'buy_price' => 2500,
|
||||
'sell_price' => 1250,
|
||||
'requires_level' => 3,
|
||||
'attack_bonus' => 15,
|
||||
'defense_bonus' => 0,
|
||||
'health_bonus' => 0,
|
||||
'energy_bonus' => 0,
|
||||
'is_tradeable' => true,
|
||||
'is_usable' => false,
|
||||
],
|
||||
[
|
||||
'name' => 'Pistol',
|
||||
'slug' => 'pistol',
|
||||
'description' => 'A handgun for more serious encounters.',
|
||||
'type' => 'weapon',
|
||||
'value' => 2000,
|
||||
'buy_price' => 10000,
|
||||
'sell_price' => 5000,
|
||||
'requires_level' => 10,
|
||||
'attack_bonus' => 30,
|
||||
'defense_bonus' => 0,
|
||||
'health_bonus' => 0,
|
||||
'energy_bonus' => 0,
|
||||
'is_tradeable' => true,
|
||||
'is_usable' => false,
|
||||
],
|
||||
|
||||
// Armor
|
||||
[
|
||||
'name' => 'Leather Jacket',
|
||||
'slug' => 'leather-jacket',
|
||||
'description' => 'Basic protection from attacks.',
|
||||
'type' => 'armor',
|
||||
'value' => 200,
|
||||
'buy_price' => 1000,
|
||||
'sell_price' => 500,
|
||||
'requires_level' => 1,
|
||||
'attack_bonus' => 0,
|
||||
'defense_bonus' => 5,
|
||||
'health_bonus' => 0,
|
||||
'energy_bonus' => 0,
|
||||
'is_tradeable' => true,
|
||||
'is_usable' => false,
|
||||
],
|
||||
[
|
||||
'name' => 'Kevlar Vest',
|
||||
'slug' => 'kevlar-vest',
|
||||
'description' => 'Heavy body armor for serious protection.',
|
||||
'type' => 'armor',
|
||||
'value' => 1000,
|
||||
'buy_price' => 5000,
|
||||
'sell_price' => 2500,
|
||||
'requires_level' => 8,
|
||||
'attack_bonus' => 0,
|
||||
'defense_bonus' => 25,
|
||||
'health_bonus' => 0,
|
||||
'energy_bonus' => 0,
|
||||
'is_tradeable' => true,
|
||||
'is_usable' => false,
|
||||
],
|
||||
|
||||
// Consumables
|
||||
[
|
||||
'name' => 'First Aid Kit',
|
||||
'slug' => 'first-aid-kit',
|
||||
'description' => 'Restores 50 health when used.',
|
||||
'type' => 'consumable',
|
||||
'value' => 500,
|
||||
'buy_price' => 2500,
|
||||
'sell_price' => 1000,
|
||||
'requires_level' => 1,
|
||||
'attack_bonus' => 0,
|
||||
'defense_bonus' => 0,
|
||||
'health_bonus' => 50,
|
||||
'energy_bonus' => 0,
|
||||
'is_tradeable' => true,
|
||||
'is_usable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'Energy Drink',
|
||||
'slug' => 'energy-drink',
|
||||
'description' => 'Restores 30 energy when used.',
|
||||
'type' => 'consumable',
|
||||
'value' => 300,
|
||||
'buy_price' => 1500,
|
||||
'sell_price' => 750,
|
||||
'requires_level' => 1,
|
||||
'attack_bonus' => 0,
|
||||
'defense_bonus' => 0,
|
||||
'health_bonus' => 0,
|
||||
'energy_bonus' => 30,
|
||||
'is_tradeable' => true,
|
||||
'is_usable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'Mega Health Pack',
|
||||
'slug' => 'mega-health-pack',
|
||||
'description' => 'Restores all health when used.',
|
||||
'type' => 'consumable',
|
||||
'value' => 1500,
|
||||
'buy_price' => 7500,
|
||||
'sell_price' => 3000,
|
||||
'requires_level' => 15,
|
||||
'attack_bonus' => 0,
|
||||
'defense_bonus' => 0,
|
||||
'health_bonus' => 100,
|
||||
'energy_bonus' => 0,
|
||||
'is_tradeable' => true,
|
||||
'is_usable' => true,
|
||||
],
|
||||
|
||||
// Misc
|
||||
[
|
||||
'name' => 'Lockpick Set',
|
||||
'slug' => 'lockpick-set',
|
||||
'description' => 'Useful for picking locks.',
|
||||
'type' => 'misc',
|
||||
'value' => 200,
|
||||
'buy_price' => 1000,
|
||||
'sell_price' => 500,
|
||||
'requires_level' => 5,
|
||||
'attack_bonus' => 0,
|
||||
'defense_bonus' => 0,
|
||||
'health_bonus' => 0,
|
||||
'energy_bonus' => 0,
|
||||
'is_tradeable' => true,
|
||||
'is_usable' => false,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($items as $item) {
|
||||
Item::updateOrCreate(
|
||||
['slug' => $item['slug']],
|
||||
$item
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Location;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class LocationSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$locations = [
|
||||
[
|
||||
'name' => 'Downtown',
|
||||
'slug' => 'downtown',
|
||||
'description' => 'The bustling city center with plenty of opportunities for crime.',
|
||||
'travel_cost' => 0,
|
||||
'requires_level' => null,
|
||||
'faction_control' => null,
|
||||
],
|
||||
[
|
||||
'name' => 'Industrial District',
|
||||
'slug' => 'industrial-district',
|
||||
'description' => 'Factories and warehouses provide cover for illegal activities.',
|
||||
'travel_cost' => 500,
|
||||
'requires_level' => 5,
|
||||
'faction_control' => null,
|
||||
],
|
||||
[
|
||||
'name' => 'Waterfront',
|
||||
'slug' => 'waterfront',
|
||||
'description' => 'The docks are perfect for smuggling operations.',
|
||||
'travel_cost' => 1000,
|
||||
'requires_level' => 10,
|
||||
'faction_control' => null,
|
||||
],
|
||||
[
|
||||
'name' => 'Uptown',
|
||||
'slug' => 'uptown',
|
||||
'description' => 'The wealthy district. High rewards but high risks.',
|
||||
'travel_cost' => 1500,
|
||||
'requires_level' => 15,
|
||||
'faction_control' => null,
|
||||
],
|
||||
[
|
||||
'name' => 'Suburbs',
|
||||
'slug' => 'suburbs',
|
||||
'description' => 'Quiet residential area. Less police presence but fewer opportunities.',
|
||||
'travel_cost' => 300,
|
||||
'requires_level' => 3,
|
||||
'faction_control' => null,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($locations as $location) {
|
||||
Location::updateOrCreate(
|
||||
['slug' => $location['slug']],
|
||||
$location
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user