Credits
This class represents the credits that a user can use to purchase in-game merchandise.
Credits class that contains the credits for a user.
Source code in src/models/credits.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
BASE_CREDITS = 10
class-attribute
instance-attribute
The base credits earned by speedrunning.
BASE_MULTIPLIER = 500
class-attribute
instance-attribute
The base multiplier for calculating credits based on time taken.
add_credits(amount)
Add credits to the user's account.
Source code in src/models/credits.py
21 22 23 24 25 26 |
|
award_credits(seconds_taken, base_credits=10, leaderboard=None)
Calculates and adds the credits earned based on time taken. The faster the completion, the more credits earned. Optionally applies leaderboard bonuses based on rank.
Source code in src/models/credits.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
get_credits()
Get the user's current credit balance.
Source code in src/models/credits.py
44 45 46 |
|
remove_credits(amount)
Remove credits from the user's account.
Source code in src/models/credits.py
28 29 30 31 32 33 34 35 |
|
update_credits(amount)
Update credits by adding (positive) or spending (negative).
Source code in src/models/credits.py
37 38 39 40 41 42 |
|