forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2022-02-25 22:01:03 +02:00
parent df5ae1dd0b
commit 1da3180aea
2 changed files with 11 additions and 4 deletions

View File

@ -256,7 +256,11 @@ def remove_mod(v, sub):
@app.get("/create_sub")
@is_not_permabanned
def create_sub(v):
return render_template("sub/create_sub.html", v=v)
num = v.subs_created + 1
for a in v.alts:
num += a.subs_created
cost = num * 100
return render_template("sub/create_sub.html", v=v, cost=cost)
@app.post("/create_sub")
@ -271,7 +275,10 @@ def create_sub2(v):
sub = g.db.query(Sub).filter_by(name=name).one_or_none()
if not sub:
cost = (v.subs_created+1) * 100
num = v.subs_created + 1
for a in v.alts:
num += a.subs_created
cost = num * 100
if v.coins < cost:
return render_template("sub/create_sub.html", v=v, error="You don't have enough coins!"), 403

View File

@ -44,11 +44,11 @@
</p>
{% endif %}
<button class="btn btn-primary ml-auto" id="create_button" {% if (v.subs_created+1) * 100 > v.coins %}disabled{% endif %}>Create Sub</button>
<button class="btn btn-primary ml-auto" id="create_button" {% if cost > v.coins %}disabled{% endif %}>Create Sub</button>
</div>
<p class="mt-2 mr-1" style="float: right"><b>Cost</b>: {{(v.subs_created+1) * 100}} coins</p>
<p class="mt-2 mr-1" style="float: right"><b>Cost</b>: {{cost}} coins</p>
</div>