diff --git a/files/classes/award.py b/files/classes/award.py index 55a7fd584..056a06283 100644 --- a/files/classes/award.py +++ b/files/classes/award.py @@ -12,21 +12,24 @@ if site_name == "Drama": "title": "One-Day Ban", "description": "Ban the author for a day.", "icon": "fas fa-gavel", - "color": "text-danger" + "color": "text-danger", + "price": 5000 }, "shit": { "kind": "shit", "title": "Shit", "description": "Let OP know how much their post sucks ass. Flies will swarm their idiotic post. (flies only work on posts lol!!)", "icon": "fas fa-poop", - "color": "text-black-50" + "color": "text-black-50", + "price": 1000 }, "stars": { "kind": "stars", "title": "Stars", "description": "A positive award because we need a positive award. Puts annoying stars in the post.", "icon": "fas fa-sparkles", - "color": "text-warning" + "color": "text-warning", + "price": 1000 } } else: @@ -36,14 +39,16 @@ else: "title": "shit", "description": "Let OP know how much their post sucks ass. Flies will swarm their idiotic post. (flies only work on posts lol!!)", "icon": "fas fa-poop", - "color": "text-black-50" + "color": "text-black-50", + "price": 1000 }, "stars": { "kind": "stars", "title": "Stars", "description": "A positive award because we need a positive award. Puts annoying stars in the post.", "icon": "fas fa-sparkles", - "color": "text-warning" + "color": "text-warning", + "price": 1000 } } diff --git a/files/routes/awards.py b/files/routes/awards.py index 45ac15639..469450196 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -6,6 +6,72 @@ from files.helpers.const import * from files.classes.award import * from flask import g, request +if site_name == "Drama": + AWARDS = { + "ban": { + "kind": "ban", + "title": "One-Day Ban", + "description": "Ban the author for a day.", + "icon": "fas fa-gavel", + "color": "text-danger", + "price": 5000 + }, + "shit": { + "kind": "shit", + "title": "Shit", + "description": "Let OP know how much their post sucks ass. Flies will swarm their idiotic post. (flies only work on posts lol!!)", + "icon": "fas fa-poop", + "color": "text-black-50", + "price": 1000 + }, + "stars": { + "kind": "stars", + "title": "Stars", + "description": "A positive award because we need a positive award. Puts annoying stars in the post.", + "icon": "fas fa-sparkles", + "color": "text-warning", + "price": 1000 + } + } +else: + AWARDS = { + "shit": { + "kind": "shit", + "title": "shit", + "description": "Let OP know how much their post sucks ass. Flies will swarm their idiotic post. (flies only work on posts lol!!)", + "icon": "fas fa-poop", + "color": "text-black-50", + "price": 1000 + }, + "stars": { + "kind": "stars", + "title": "Stars", + "description": "A positive award because we need a positive award. Puts annoying stars in the post.", + "icon": "fas fa-sparkles", + "color": "text-warning", + "price": 1000 + } + } + +@app.get("/shop") +@auth_required +def shop(v): + return render_template("shop.html", awards=list(AWARDS.values()), v=v) + +@app.post("/buy/") +@auth_required +def buy(v, award): + if award not in AWARDS: abort(400) + price = AWARDS[award]["price"] + if v.coins < price: return render_template("shop.html", v=v, error="You don't have enough coins to buy this item.") + v.coins -= price + g.db.add(v) + + award = AwardRelationship(user_id=v.id, kind=award) + g.db.add(award) + + return render_template("shop.html", awards=list(AWARDS.values()), v=v) + def banaward_trigger(post=None, comment=None): @@ -226,4 +292,4 @@ def admin_userawards_post(v): send_notification(NOTIFICATIONS_ACCOUNT, u, text) - return render_template("admin/user_award.html", awards=list(AWARDS.values()), v=v) + return render_template("admin/user_award.html", awards=list(AWARDS.values()), v=v) \ No newline at end of file diff --git a/files/templates/shop.html b/files/templates/shop.html new file mode 100644 index 000000000..55629cc9a --- /dev/null +++ b/files/templates/shop.html @@ -0,0 +1,59 @@ +{% extends "default.html" %} + +{% block title %} +Shop +{% endblock %} + +{% block pagetype %}message{% endblock %} + +{% block content %} + + {% if error %} + + {% endif %} + {% if msg %} + + {% endif %} + +

+

+
Shop
+ + + + + + + + + + +{% for a in awards %} + + + + + {% set kind = a['kind'] %} + + +{% endfor %} +
IconTitlePrice
{{a['title']}}{{a['price']}}Buy
+ +

+{% endblock %}