feat(city): add player marketplace, mission journal, character customization and presence
- Player-to-player marketplace with listings, buying and selling - Mission system with progress tracking and money rewards - Character appearance customization (skin, hair, face, beard, accessory) - Multiplayer presence feed showing nearby citizens in near-real-time - Admin world dashboard with live platform metrics - Bus and train transportation with temporary ride state - Mobile joystick controls and minimap HUD - Education bonus applied to work salary
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Player-to-player marketplace listings.
|
||||
*
|
||||
* A character lists inventory items for a fixed price; buyers purchase
|
||||
* through the city market endpoint with an atomic money transfer.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('market_listings', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('seller_character_id')->constrained('characters')->cascadeOnDelete();
|
||||
$table->foreignId('city_id')->constrained('cities')->cascadeOnDelete();
|
||||
$table->string('item', 40);
|
||||
$table->unsignedInteger('qty')->default(1);
|
||||
$table->decimal('unit_price', 10, 2);
|
||||
$table->boolean('is_active')->default(true)->index();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['city_id', 'is_active']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('market_listings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Lightweight citizen missions (daily journal goals).
|
||||
*
|
||||
* Tracks progress per character and pays a money reward on completion.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('missions', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('city_id')->constrained('cities')->cascadeOnDelete();
|
||||
$table->string('code', 60)->unique();
|
||||
$table->string('title', 160);
|
||||
$table->string('description', 400);
|
||||
$table->string('metric', 40); // exercise_count|buildings|transactions|education
|
||||
$table->unsignedInteger('target')->default(1);
|
||||
$table->decimal('reward', 10, 2)->default(20);
|
||||
$table->boolean('is_active')->default(true)->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('character_missions', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('character_id')->constrained('characters')->cascadeOnDelete();
|
||||
$table->foreignId('mission_id')->constrained('missions')->cascadeOnDelete();
|
||||
$table->unsignedInteger('progress')->default(0);
|
||||
$table->boolean('is_completed')->default(false)->index();
|
||||
$table->timestamp('completed_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['character_id', 'mission_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('character_missions');
|
||||
Schema::dropIfExists('missions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Adds cosmetic slots and ride state to characters.
|
||||
*
|
||||
* face/beard/accessory drive the 3D look; ride_kind/ride_until power
|
||||
* temporary bus/train boarding.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('characters', function (Blueprint $table): void {
|
||||
$table->unsignedTinyInteger('face')->default(1)->after('shirt');
|
||||
$table->unsignedTinyInteger('beard')->default(0)->after('face');
|
||||
$table->unsignedTinyInteger('accessory')->default(0)->after('beard');
|
||||
$table->string('ride_kind', 20)->nullable()->after('state');
|
||||
$table->timestamp('ride_until')->nullable()->after('ride_kind');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('characters', function (Blueprint $table): void {
|
||||
$table->dropColumn(['face', 'beard', 'accessory', 'ride_kind', 'ride_until']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -6,6 +6,7 @@ use App\Models\Building;
|
||||
use App\Models\Character;
|
||||
use App\Models\City;
|
||||
use App\Models\Job;
|
||||
use App\Models\Mission;
|
||||
use App\Models\Store;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
@@ -75,6 +76,73 @@ class CityWorldSeeder extends Seeder
|
||||
],
|
||||
);
|
||||
|
||||
// Civic buildings: school and city hall.
|
||||
Building::updateOrCreate(
|
||||
['city_id' => $city->id, 'type' => 'school'],
|
||||
[
|
||||
'owner_character_id' => null,
|
||||
'name' => 'Escola Municipal',
|
||||
'pos_x' => -20,
|
||||
'pos_z' => 60,
|
||||
'width' => 16,
|
||||
'depth' => 12,
|
||||
'height' => 7,
|
||||
'is_complete' => true,
|
||||
'build_progress' => 100,
|
||||
],
|
||||
);
|
||||
Building::updateOrCreate(
|
||||
['city_id' => $city->id, 'type' => 'city_hall'],
|
||||
[
|
||||
'owner_character_id' => null,
|
||||
'name' => 'Prefeitura',
|
||||
'pos_x' => 20,
|
||||
'pos_z' => 60,
|
||||
'width' => 18,
|
||||
'depth' => 14,
|
||||
'height' => 10,
|
||||
'is_complete' => true,
|
||||
'build_progress' => 100,
|
||||
],
|
||||
);
|
||||
|
||||
Mission::updateOrCreate(
|
||||
['code' => 'exercise-5'],
|
||||
[
|
||||
'city_id' => $city->id,
|
||||
'title' => 'Shape em dia',
|
||||
'description' => 'Complete 5 séries de ginástica nas praças.',
|
||||
'metric' => 'exercise_count',
|
||||
'target' => 5,
|
||||
'reward' => 25,
|
||||
'is_active' => true,
|
||||
],
|
||||
);
|
||||
Mission::updateOrCreate(
|
||||
['code' => 'build-home'],
|
||||
[
|
||||
'city_id' => $city->id,
|
||||
'title' => 'Lar doce lar',
|
||||
'description' => 'Construa a sua primeira casa.',
|
||||
'metric' => 'buildings',
|
||||
'target' => 1,
|
||||
'reward' => 50,
|
||||
'is_active' => true,
|
||||
],
|
||||
);
|
||||
Mission::updateOrCreate(
|
||||
['code' => 'learn-20'],
|
||||
[
|
||||
'city_id' => $city->id,
|
||||
'title' => 'Estudioso',
|
||||
'description' => 'Alcance 20% de educação.',
|
||||
'metric' => 'education',
|
||||
'target' => 20,
|
||||
'reward' => 30,
|
||||
'is_active' => true,
|
||||
],
|
||||
);
|
||||
|
||||
User::query()->where('is_active', true)->where('status', '!=', User::STATUS_ACTIVE)
|
||||
->update(['status' => User::STATUS_ACTIVE]);
|
||||
User::query()->where('is_active', false)->where('status', User::STATUS_PENDING)
|
||||
|
||||
Reference in New Issue
Block a user