Skip to content

Commit

Permalink
Check sufficient hourglasses when attempting to purchase
Browse files Browse the repository at this point in the history
  • Loading branch information
Hafizzle committed Sep 21, 2023
1 parent 807c00f commit 3d3fd97
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ open class ShopItem : RealmObject(), BaseObject {
fun canAfford(user: User?, quantity: Int): Boolean = when (currency) {
"gold" -> (value * quantity) <= (user?.stats?.gp ?: 0.0)
"gems" -> (value * quantity) <= (user?.gemCount ?: 0)
"hourglasses" -> (value * quantity) <= (user?.hourglassCount ?: 0)
else -> true
}

Expand Down

0 comments on commit 3d3fd97

Please sign in to comment.