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:
@@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
/**
|
||||
@@ -19,7 +20,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
'user_id', 'city_id', 'name', 'skin', 'hair', 'shirt',
|
||||
'pos_x', 'pos_y', 'pos_z', 'money', 'energy', 'hunger', 'thirst', 'health',
|
||||
'state', 'job_id', 'house_id', 'education', 'exercise_count', 'is_online', 'last_tick_at',
|
||||
'hospitalized_until',
|
||||
'hospitalized_until', 'face', 'beard', 'accessory', 'ride_kind', 'ride_until',
|
||||
])]
|
||||
class Character extends Model
|
||||
{
|
||||
@@ -116,6 +117,28 @@ class Character extends Model
|
||||
return $this->hasMany(Building::class, 'owner_character_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Marketplace listings published by this character.
|
||||
*
|
||||
* @return HasMany<MarketListing, $this>
|
||||
*/
|
||||
public function listings(): HasMany
|
||||
{
|
||||
return $this->hasMany(MarketListing::class, 'seller_character_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Missions this character is tracking.
|
||||
*
|
||||
* @return BelongsToMany<Mission, $this>
|
||||
*/
|
||||
public function missions(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Mission::class, 'character_missions')
|
||||
->withPivot(['progress', 'is_completed', 'completed_at'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inventory stacks owned by this character.
|
||||
*
|
||||
@@ -168,6 +191,9 @@ class Character extends Model
|
||||
'education' => 0,
|
||||
'exercise_count' => 0,
|
||||
'is_online' => false,
|
||||
'face' => random_int(1, 3),
|
||||
'beard' => random_int(0, 2),
|
||||
'accessory' => random_int(0, 2),
|
||||
]);
|
||||
|
||||
// Starter kit so new citizens can eat, drink and build immediately.
|
||||
@@ -207,6 +233,10 @@ class Character extends Model
|
||||
'is_online' => 'boolean',
|
||||
'last_tick_at' => 'datetime',
|
||||
'hospitalized_until' => 'datetime',
|
||||
'face' => 'integer',
|
||||
'beard' => 'integer',
|
||||
'accessory' => 'integer',
|
||||
'ride_until' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user