forked from MarseyWorld/MarseyWorld
master
parent
7c3752bf65
commit
c48e7716a7
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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/<award>")
|
||||
@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)
|
|
@ -0,0 +1,59 @@
|
|||
{% extends "default.html" %}
|
||||
|
||||
{% block title %}
|
||||
<title>Shop</title>
|
||||
{% endblock %}
|
||||
|
||||
{% block pagetype %}message{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if error %}
|
||||
<div class="alert alert-danger alert-dismissible fade show my-3" role="alert">
|
||||
<i class="fas fa-exclamation-circle my-auto"></i>
|
||||
<span>
|
||||
{{error}}
|
||||
</span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="far fa-times"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if msg %}
|
||||
<div class="alert alert-success alert-dismissible fade show my-3" role="alert">
|
||||
<i class="fas fa-check-circle my-auto" aria-hidden="true"></i>
|
||||
<span>
|
||||
{{msg}}
|
||||
</span>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true"><i class="far fa-times"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<pre></pre>
|
||||
<pre></pre>
|
||||
<h5>Shop</h5>
|
||||
|
||||
<table class="table table-striped">
|
||||
<thead class="bg-primary text-white">
|
||||
<tr>
|
||||
<th scope="col">Icon</th>
|
||||
<th scope="col">Title</th>
|
||||
<th scope="col">Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for a in awards %}
|
||||
<tr>
|
||||
<td><i class="{{a['icon']}} {{a['color']}}" style="font-size: 30px"></i></td>
|
||||
<td style="font-weight: bold">{{a['title']}}</td>
|
||||
<td style="font-weight: bold">{{a['price']}}</td>
|
||||
{% set kind = a['kind'] %}
|
||||
<td style="font-weight: bold"><a class="btn btn-success" href="javascript:void(0)" onclick="post_toast('/buy/{{kind}}')">Buy</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
<pre></pre>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue