diff --git a/app/Http/Controllers/User/CharactersController.php b/app/Http/Controllers/User/CharactersController.php new file mode 100644 index 0000000..6f64dbf --- /dev/null +++ b/app/Http/Controllers/User/CharactersController.php @@ -0,0 +1,19 @@ +id)->get(); + return view('user/characters', [ + 'characters' => $characters + ]); + } +} diff --git a/app/Models/Game/Player/Player.php b/app/Models/Game/Player/Player.php index b1a3296..8733f1e 100644 --- a/app/Models/Game/Player/Player.php +++ b/app/Models/Game/Player/Player.php @@ -3,8 +3,11 @@ namespace App\Models\Game\Player; use App\Models\Account; +use App\Models\Enums\CharacterJobEnum; +use App\Models\Game\Highscore\HighscoreCache; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasOne; class Player extends Model { @@ -60,7 +63,7 @@ class Player extends Model * @var array */ protected $casts = [ - + 'job' => CharacterJobEnum::class, ]; /** @@ -70,4 +73,20 @@ public function account(): BelongsTo { return $this->belongsTo(Account::class, 'account_id', 'id'); } + + /** + * Get the index of this player's account + */ + public function index(): BelongsTo + { + return $this->belongsTo(PlayerIndex::class, 'account_id', 'id'); + } + + /** + * Get this player's ranking + */ + public function highscore(): HasOne + { + return $this->hasOne(HighscoreCache::class, 'name', 'name'); + } } diff --git a/app/Models/Game/Player/PlayerIndex.php b/app/Models/Game/Player/PlayerIndex.php new file mode 100644 index 0000000..d0bc845 --- /dev/null +++ b/app/Models/Game/Player/PlayerIndex.php @@ -0,0 +1,75 @@ + + */ + protected $fillable = [ + + ]; + + /** + * The attributes that should be hidden for serialization. + * + * @var array + */ + protected $hidden = [ + + ]; + + /** + * The attributes that should be cast. + * + * @var array + */ + protected $casts = [ + 'empire' => EmpireEnum::class, + ]; + + /** + * Get the account that owns the player index. + */ + public function account(): BelongsTo + { + return $this->belongsTo(Account::class, 'id', 'id'); + } +} diff --git a/lang/en/app/user/characters.php b/lang/en/app/user/characters.php new file mode 100644 index 0000000..f0a0067 --- /dev/null +++ b/lang/en/app/user/characters.php @@ -0,0 +1,12 @@ + 'Character list', + + 'rank' => 'Rank', + 'class' => 'Class', + 'time' => 'Playtime', + 'level' => 'Level', + 'exp' => 'Experience', + 'empire' => 'Empire', +]; diff --git a/lang/ro/app/user/characters.php b/lang/ro/app/user/characters.php new file mode 100644 index 0000000..f9443d9 --- /dev/null +++ b/lang/ro/app/user/characters.php @@ -0,0 +1,12 @@ + 'Lista personajelor', + + 'rank' => 'Rang', + 'class' => 'Clasă', + 'time' => 'Timp de joc', + 'level' => 'Nivel', + 'exp' => 'Experiență', + 'empire' => 'Regat', +]; diff --git a/resources/views/user/characters.blade.php b/resources/views/user/characters.blade.php index 136e07a..7a31041 100644 --- a/resources/views/user/characters.blade.php +++ b/resources/views/user/characters.blade.php @@ -8,7 +8,7 @@
-

Lista caracterelor

+

{{ __('app/user/characters.title') }}

{{-- Pagination reverse-engineering (incomplete) @@ -30,51 +30,50 @@
--}} - -
-
- -
-
-
gigelfronescu
-
- Rang #123 + @foreach ($characters as $character) +
+
+ job->value}.png") }}" width="44" height="40" /> +
+
+
{{ $character->name }}
+
+ {{ __('app/user/characters.rank') }} + @if ($character->highscore) + #{{ $character->highscore->id }} + @else + N/A + @endif +
+
+
+
+ {{ __('app/user/characters.class') }} + {{ $character->job->name() }} +
+
+ {{ __('app/user/characters.time') }} + {{ (int) ($character->playtime / 60) }}h {{ $character->playtime % 60 }}m +
+
+
+
+ {{ __('app/user/characters.level') }} + {{ $character->level }} +
+
+ {{ __('app/user/characters.exp') }} + {{ number_format($character->exp, 0, ',', '.') }} +
+
+
+
+ {{ __('app/user/characters.empire') }} + {{ $character->index->empire->name() }} +
-
-
Clasă Sura
-
Timp de joc 3h 20m
-
-
-
Nivel69
-
Experiență 1.351.561
-
-
-
Regat Shinsoo
-
-
-
-
- -
-
-
gigelfronescu
-
- Rang #123 -
-
-
-
Clasă Sura
-
Timp de joc 3h 20m
-
-
-
Nivel69
-
Experiență 1.351.561
-
-
-
Regat Shinsoo
-
-
+ @endforeach
diff --git a/resources/views/user/password-change/password-change-request.blade.php b/resources/views/user/password-change/password-change-request.blade.php new file mode 100644 index 0000000..83fcabe --- /dev/null +++ b/resources/views/user/password-change/password-change-request.blade.php @@ -0,0 +1,42 @@ +@extends('layouts.app') + +@section('content') + + +
+
+
+
+

Your Account

+
+
+
+ +

Change Password

+

Change your password here.

+
+
+
+ +
+ +
+ +
+ +
+ +
+
+
+
+ +
+ Back +
+
+
+
+
 
+
+@endsection diff --git a/resources/views/user/lostpasswordcode.blade.php b/resources/views/user/password-lost/password-lost-code.blade.php similarity index 100% rename from resources/views/user/lostpasswordcode.blade.php rename to resources/views/user/password-lost/password-lost-code.blade.php diff --git a/resources/views/user/passwordlost-expired.blade.php b/resources/views/user/password-lost/password-lost-expired.blade.php similarity index 100% rename from resources/views/user/passwordlost-expired.blade.php rename to resources/views/user/password-lost/password-lost-expired.blade.php diff --git a/resources/views/user/passwordlostrequest.blade.php b/resources/views/user/password-lost/password-lost-request.blade.php similarity index 100% rename from resources/views/user/passwordlostrequest.blade.php rename to resources/views/user/password-lost/password-lost-request.blade.php diff --git a/routes/web.php b/routes/web.php index 648f4ec..c8e4479 100644 --- a/routes/web.php +++ b/routes/web.php @@ -3,12 +3,15 @@ use App\Http\Controllers\Auth\LoginController; use App\Http\Controllers\Auth\RegisterController; use App\Http\Controllers\Auth\VerificationController; +use App\Http\Controllers\Highscore\GuildHighscoreController; +use App\Http\Controllers\Highscore\HighscoreController; use App\Http\Controllers\Mall\AuthController; use App\Http\Controllers\Mall\CategoryController; use App\Http\Controllers\Mall\HomeController; use App\Http\Controllers\Mall\ItemController; use App\Http\Controllers\Patch\PatchConfigController; use App\Http\Controllers\Patch\PatchLandingController; +use App\Http\Controllers\User\CharactersController; use Illuminate\Support\Facades\Redirect; use Illuminate\Support\Facades\Route; @@ -68,6 +71,7 @@ # Registration Route::get('/register', [RegisterController::class, 'showRegistrationForm'])->middleware('guest'); Route::post('/register', [RegisterController::class, 'register'])->middleware('guest'); + Route::post('/register-from-header', [RegisterController::class, 'registerFromHeader'])->middleware('guest'); Route::get('/verification/notice', [VerificationController::class, 'show'])->name('verification.notice'); Route::get('/verification/verify/{id}/{hash}', [VerificationController::class, 'verify'])->name('verification.verify'); Route::get('/verification/resend', [VerificationController::class, 'resend'])->name('verification.resend'); @@ -79,14 +83,16 @@ }); Route::get('/logout', [LoginController::class, 'logout']); - Route::get('/passwordlostrequest', fn () => view('user/passwordlostrequest')); - Route::get('/passwordlost/{username}/{hash}', fn ($username, $hash) => view('user/passwordlost-expired')); + Route::get('/passwordlostrequest', fn () => view('user/password-lost/password-lost-request')); + Route::get('/passwordlost/{username}/{hash}', fn ($username, $hash) => view('user/password-lost/password-lost-expired')); # User administration Route::middleware(['auth', 'verified'])->group(function() { Route::get('/administration', fn () => view('user/administration')); - Route::get('/characters', fn () => view('user/characters')); + Route::get('/characters', [CharactersController::class, 'show']); + + Route::get('/passwordchangerequest', fn () => view('user/password-change/password-change-request')); Route::get('/emailchangeaccept/{username}/{hash}', fn ($username, $hash) => view('user/emailchangeaccept')); Route::get('/emailchangecancel/{username}/{hash}', fn ($username, $hash) => view('user/emailchangecancel')); @@ -95,7 +101,7 @@ Route::get('/generatecode/{userId}/{hash}', fn ($userId, $hash) => view('user/generatecode')); - Route::get('/lostpasswordcode/{userId}/{hash}', fn ($userId, $hash) => view('user/lostpasswordcode')); + Route::get('/lostpasswordcode/{userId}/{hash}', fn ($userId, $hash) => view('user/password-lost/password-lost-code')); }); });