Leaderboard
This class represents the credits that a user can use to purchase in-game merchandise.
Class to manage leaderboard bonuses and rankings.
Source code in src/models/leaderboard.py
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
BONUS_PERCENTAGES = {1: 50, 2: 25, 3: 10}
class-attribute
instance-attribute
Leaderboard rank bonuses as percentages.
calculate_bonus(leaderboard, seconds_taken, credits)
classmethod
Calculate the bonus credits earned based on leaderboard rank.
Source code in src/models/leaderboard.py
22 23 24 25 26 27 28 29 |
|
get_bonus_percentage(leaderboard, seconds_taken)
classmethod
Get the player's bonus percentage based on their rank determined by the time taken.
Source code in src/models/leaderboard.py
12 13 14 15 16 17 18 19 20 |
|