From 1da3180aeaee23c9468c926d11676b86cd4211f9 Mon Sep 17 00:00:00 2001
From: Aevann1
Date: Fri, 25 Feb 2022 22:01:03 +0200
Subject: [PATCH] cost
---
files/routes/subs.py | 11 +++++++++--
files/templates/sub/create_sub.html | 4 ++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/files/routes/subs.py b/files/routes/subs.py
index 9f3e0ede6..6e7cc2abe 100644
--- a/files/routes/subs.py
+++ b/files/routes/subs.py
@@ -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
diff --git a/files/templates/sub/create_sub.html b/files/templates/sub/create_sub.html
index e6e1a5750..660bd5627 100644
--- a/files/templates/sub/create_sub.html
+++ b/files/templates/sub/create_sub.html
@@ -44,11 +44,11 @@
{% endif %}
-
+
- Cost: {{(v.subs_created+1) * 100}} coins
+ Cost: {{cost}} coins