mirror of
https://github.com/Deathgarden-Rebirth/Deathgarden_Rebirth-Rewrite.git
synced 2026-09-11 20:55:23 -05:00
Added currency cap with Migration.
This commit is contained in:
21
dist/app/Models/User/PlayerData.php
vendored
21
dist/app/Models/User/PlayerData.php
vendored
@@ -12,6 +12,7 @@
|
||||
use App\Models\Game\Challenge;
|
||||
use App\Models\Game\CharacterData;
|
||||
use App\Models\Game\QuitterState;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use App\Models\Game\TimedChallenge;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -54,6 +55,8 @@ class PlayerData extends Model
|
||||
'has_played_dg_1' => 'boolean',
|
||||
];
|
||||
|
||||
const CURRENCY_CAP = 50000;
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::created(function (PlayerData $playerData) {
|
||||
@@ -197,4 +200,22 @@ public static function getRemainingFactionExperience(int $level): int
|
||||
return 4;
|
||||
return 5;
|
||||
}
|
||||
|
||||
public function currencyA(): Attribute {
|
||||
return Attribute::make(
|
||||
set: fn (int $value) => min($value, static::CURRENCY_CAP),
|
||||
);
|
||||
}
|
||||
|
||||
public function currencyB(): Attribute {
|
||||
return Attribute::make(
|
||||
set: fn (int $value) => min($value, static::CURRENCY_CAP),
|
||||
);
|
||||
}
|
||||
|
||||
public function currencyC(): Attribute {
|
||||
return Attribute::make(
|
||||
set: fn (int $value) => min($value, static::CURRENCY_CAP),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user