Last active
January 11, 2025 21:54
-
-
Save abixalmon/57016678c0145bf98c99 to your computer and use it in GitHub Desktop.
AvistaZ bonus point formula
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (count($bonus_users)) { | |
foreach ($bonus_users as $user_id => $bonus_user) { | |
$torrents = count($bonus_user['torrents']); | |
if ($torrents < 10) { | |
$bonus = max(0.1, (0.05 * $torrents)); | |
} else { | |
$bonus = min(2, 1 + (0.01 * $torrents)); | |
} | |
foreach ($bonus_user['torrents'] as $torrent) { | |
if (carbon($torrent['uploaded_date'])->diffInMonths() > 6 && $torrent['seed'] <= 2 && $torrent['leech'] >= 1) { | |
$bonus = $bonus + 1; | |
} | |
if ($torrent['file_size'] > computer_size(10, 'GB')) { | |
$bonus = $bonus + 0.1; | |
} | |
} | |
DB::update("UPDATE USERS AND SET THE BONUS POINT!"); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on your gist, you made a mistake on explaining: (Example section)
Seed 9 torrents => 9 x 0.05 = 0.45 point per hour
Seed 10 torrents => 1 + (10 x 0.01) = 1.1 point per hour