fd
This commit is contained in:
parent
c72a9aff59
commit
1e2d42394a
2 changed files with 19 additions and 14 deletions
|
@ -256,10 +256,13 @@ def remove_mod(v, sub):
|
|||
@app.get("/create_sub")
|
||||
@is_not_permabanned
|
||||
def create_sub(v):
|
||||
num = v.subs_created + 1
|
||||
for a in v.alts:
|
||||
num += a.subs_created
|
||||
cost = num * 100
|
||||
if v.id == MENTION_ID: cost = 0
|
||||
else:
|
||||
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)
|
||||
|
||||
|
||||
|
@ -275,15 +278,17 @@ def create_sub2(v):
|
|||
|
||||
sub = g.db.query(Sub).filter_by(name=name).one_or_none()
|
||||
if not sub:
|
||||
num = v.subs_created + 1
|
||||
for a in v.alts:
|
||||
num += a.subs_created
|
||||
cost = num * 100
|
||||
if v.id != MENTION_ID:
|
||||
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
|
||||
if v.coins < cost:
|
||||
return render_template("sub/create_sub.html", v=v, error="You don't have enough coins!"), 403
|
||||
|
||||
v.coins -= cost
|
||||
|
||||
v.coins -= cost
|
||||
v.subs_created += 1
|
||||
g.db.add(v)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue