mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-01-16 18:04:34 -05:00
give a bonus reward for the first uploads of a user
This commit is contained in:
@@ -5,6 +5,23 @@ declare(strict_types=1);
|
||||
namespace Gazelle;
|
||||
|
||||
class BonusUploadReward extends Base {
|
||||
public function boost(User $user): int {
|
||||
if (
|
||||
!BONUS_UPLOAD_BOOST_ACTIVE
|
||||
||
|
||||
$user->classLevel() > BONUS_UPLOAD_BOOST_MAX_LEVEL
|
||||
) {
|
||||
return 0;
|
||||
}
|
||||
$index = $user->ordinal()->value('bonus-upload-boost');
|
||||
if (!isset(BONUS_UPLOAD_BOOST[$index])) {
|
||||
return 0;
|
||||
}
|
||||
$boost = BONUS_UPLOAD_BOOST[$index];
|
||||
$user->ordinal()->set('bonus-upload-boost', $index + 1);
|
||||
return $boost;
|
||||
}
|
||||
|
||||
public function reward(Torrent $torrent): int {
|
||||
$categoryId = $torrent->group()->categoryId();
|
||||
if ($torrent->isPerfectFlac()) {
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Gazelle\User;
|
||||
*/
|
||||
|
||||
class Ordinal extends \Gazelle\BaseUser {
|
||||
final protected const CACHE_KEY = 'u_ord_%s';
|
||||
final protected const CACHE_KEY = 'u_ord2_%s';
|
||||
|
||||
protected array $info;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user