cost
This commit is contained in:
parent
b65a89f705
commit
daab5b1dc9
2 changed files with 11 additions and 4 deletions
|
@ -256,7 +256,11 @@ def remove_mod(v, sub):
|
||||||
@app.get("/create_sub")
|
@app.get("/create_sub")
|
||||||
@is_not_permabanned
|
@is_not_permabanned
|
||||||
def create_sub(v):
|
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")
|
@app.post("/create_sub")
|
||||||
|
@ -271,7 +275,10 @@ def create_sub2(v):
|
||||||
|
|
||||||
sub = g.db.query(Sub).filter_by(name=name).one_or_none()
|
sub = g.db.query(Sub).filter_by(name=name).one_or_none()
|
||||||
if not sub:
|
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:
|
if v.coins < cost:
|
||||||
return render_template("sub/create_sub.html", v=v, error="You don't have enough coins!"), 403
|
return render_template("sub/create_sub.html", v=v, error="You don't have enough coins!"), 403
|
||||||
|
|
|
@ -44,11 +44,11 @@
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% 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>
|
</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>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue