1
0
forked from metin2/web

Localized ranking and modified controllers to read data from cache tables.

This commit is contained in:
2024-12-31 20:24:15 +02:00
parent 744e55e385
commit 103d21b5ef
17 changed files with 753 additions and 261 deletions

View File

@ -0,0 +1,21 @@
<?php
namespace App\Models\Enums;
enum CharacterClassEnum: int
{
case WARRIOR = 0;
case NINJA = 1;
case SURA = 2;
case SHAMAN = 3;
public function name(): string
{
return match($this) {
self::WARRIOR => __('app/names.classes.warrior'),
self::NINJA => __('app/names.classes.ninja'),
self::SURA => __('app/names.classes.sura'),
self::SHAMAN => __('app/names.classes.shaman'),
};
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Models\Enums;
enum CharacterJobEnum: int
{
case WARRIOR_M = 0;
case NINJA_F = 1;
case SURA_M = 2;
case SHAMAN_F = 3;
case WARRIOR_F = 4;
case NINJA_M = 5;
case SURA_F = 6;
case SHAMAN_M = 7;
public function name(): string
{
return match($this) {
self::WARRIOR_M, self::WARRIOR_F => __('app/names.classes.warrior'),
self::NINJA_M, self::NINJA_F => __('app/names.classes.ninja'),
self::SURA_M, self::SURA_F => __('app/names.classes.sura'),
self::SHAMAN_M, self::SHAMAN_F => __('app/names.classes.shaman'),
};
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Models\Enums;
enum EmpireEnum: int
{
case SHINSOO = 1;
case CHUNJO = 2;
case JINNO = 3;
public function name(): string
{
return match($this) {
self::SHINSOO => __('app/names.empires.shinsoo'),
self::CHUNJO => __('app/names.empires.chunjo'),
self::JINNO => __('app/names.empires.jinno'),
};
}
public function longName(): string
{
return match($this) {
self::SHINSOO => __('app/names.empires.shinsoo.long'),
self::CHUNJO => __('app/names.empires.chunjo.long'),
self::JINNO => __('app/names.empires.jinno.long'),
};
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Models\Game\Highscore;
use App\Models\Enums\EmpireEnum;
use Illuminate\Database\Eloquent\Model;
class GuildHighscoreCache extends Model
{
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'website';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'guild_highscore_cache';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'empire' => EmpireEnum::class,
'date' => 'datetime'
];
}

View File

@ -0,0 +1,67 @@
<?php
namespace App\Models\Game\Highscore;
use App\Models\Enums\CharacterClassEnum;
use App\Models\Enums\EmpireEnum;
use Illuminate\Database\Eloquent\Model;
class HighscoreCache extends Model
{
/**
* Indicates if the model should be timestamped.
*
* @var bool
*/
public $timestamps = false;
/**
* The connection name for the model.
*
* @var string|null
*/
protected $connection = 'website';
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'highscore_cache';
/**
* The primary key for the model.
*
* @var string
*/
protected $primaryKey = 'id';
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'job' => CharacterClassEnum::class,
'empire' => EmpireEnum::class,
'date' => 'datetime'
];
}