forked from rDrama/rDrama
more hats
parent
697a722c6e
commit
db9a995032
Binary file not shown.
After Width: | Height: | Size: 108 KiB |
|
@ -171,6 +171,17 @@ class User(Base):
|
|||
def __repr__(self):
|
||||
return f"<User(id={self.id}, username={self.username})>"
|
||||
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def num_of_hats_bought(self):
|
||||
return g.db.query(Hat).filter_by(user_id=self.id).count()
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def num_of_hats_designed(self):
|
||||
return g.db.query(HatDef).filter_by(author_id=self.id).count()
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def name_color(self):
|
||||
|
|
|
@ -52,12 +52,11 @@ def buy_hat(v, hat_id):
|
|||
f":marseycapitalistmanlet: @{v.username} has just bought `{hat.name}`, you have received your %5 cut ({int(hat.price * 0.05)} {currency}) :!marseycapitalistmanlet:"
|
||||
)
|
||||
|
||||
hat_count = g.db.query(Hat).filter_by(user_id=v.id).count()
|
||||
if hat_count >= 249:
|
||||
if v.num_of_hats_bought >= 249:
|
||||
badge_grant(user=v, badge_id=154)
|
||||
elif hat_count >= 99:
|
||||
elif v.num_of_hats_bought >= 99:
|
||||
badge_grant(user=v, badge_id=153)
|
||||
elif hat_count >= 24:
|
||||
elif v.num_of_hats_bought >= 24:
|
||||
badge_grant(user=v, badge_id=152)
|
||||
|
||||
return {"message": "Hat bought!"}
|
||||
|
|
|
@ -6,10 +6,18 @@
|
|||
|
||||
{% block pagetype %}message{% endblock %}
|
||||
|
||||
{% block Banner %}
|
||||
<header class="container pb-1 text-center">
|
||||
<img class="mt-5" alt="hats banner" src="/i/hats.webp" width="50%">
|
||||
<h5 class="mt-4">Number of hats you bought: {{v.num_of_hats_bought}}</h5>
|
||||
<h5 class="mt-4">Number of hats you designed: {{v.num_of_hats_designed}}</h5>
|
||||
<h5 class="mt-4">Coins you spent on hats: {{v.coins_spent_on_hats}}</h5>
|
||||
</header>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<pre>
|
||||
|
||||
|
||||
</pre>
|
||||
|
||||
<div class="overflow-x-auto"><table class="table table-striped shop">
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
{% block content %}
|
||||
<pre>
|
||||
|
||||
|
||||
</pre>
|
||||
|
||||
<div class="overflow-x-auto"><table class="table table-striped shop">
|
||||
|
|
Loading…
Reference in New Issue