forked from MarseyWorld/MarseyWorld
deflector award
parent
a01376e687
commit
6fc9de8278
|
@ -98,6 +98,7 @@ class User(Base):
|
|||
sigs_disabled = Column(Boolean)
|
||||
fish = Column(Boolean)
|
||||
progressivestack = Column(Integer)
|
||||
deflector = Column(Integer)
|
||||
friends = deferred(Column(String))
|
||||
friends_html = deferred(Column(String))
|
||||
enemies = deferred(Column(String))
|
||||
|
|
|
@ -470,6 +470,14 @@ AWARDS = {
|
|||
"color": "text-blue",
|
||||
"price": 4000
|
||||
},
|
||||
"deflector": {
|
||||
"kind": "deflector",
|
||||
"title": "deflector",
|
||||
"description": "Causes all awards received for the next 10 hours to be deflected back at their giver.",
|
||||
"icon": "fas fa-shield",
|
||||
"color": "text-pink",
|
||||
"price": 7000
|
||||
},
|
||||
"grass": {
|
||||
"kind": "grass",
|
||||
"title": "Grass",
|
||||
|
|
|
@ -229,14 +229,20 @@ def award_post(pid, v):
|
|||
if author.id == PIZZASHILL_ID:
|
||||
return {"error": "Pizzashill is immune to awards."}, 403
|
||||
|
||||
if v.id != author.id:
|
||||
if kind == "benefactor" and author.id == v.id:
|
||||
return {"error": "You can't use this award on yourself."}, 400
|
||||
|
||||
if author.deflector:
|
||||
msg = f"@{v.username} has tried to give your [post]({post.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected and applied to them :marseytroll:"
|
||||
send_repeatable_notification(author.id, msg)
|
||||
msg = f"@{author.username} is under the effect of a deflector award; your {AWARDS[kind]['title']} Award has been deflected back to you :marseytroll:"
|
||||
send_repeatable_notification(v.id, msg)
|
||||
author = v
|
||||
elif v.id != author.id:
|
||||
msg = f"@{v.username} has given your [post]({post.shortlink}) the {AWARDS[kind]['title']} Award!"
|
||||
if note: msg += f"\n\n> {note}"
|
||||
send_repeatable_notification(author.id, msg)
|
||||
|
||||
if kind == "benefactor" and author.id == v.id:
|
||||
return {"error": "You can't use this award on yourself."}, 400
|
||||
|
||||
if kind == "ban":
|
||||
link = f"[this post]({post.shortlink})"
|
||||
|
||||
|
@ -402,6 +408,9 @@ def award_post(pid, v):
|
|||
g.db.add(badge)
|
||||
g.db.flush()
|
||||
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
|
||||
elif kind == "deflector":
|
||||
if author.deflector: author.deflector += 36000
|
||||
else: author.deflector = int(time.time()) + 36000
|
||||
|
||||
if author.received_award_count: author.received_award_count += 1
|
||||
else: author.received_award_count = 1
|
||||
|
@ -450,7 +459,13 @@ def award_comment(cid, v):
|
|||
if author.id == PIZZASHILL_ID:
|
||||
return {"error": "Pizzashill is immune to awards."}, 403
|
||||
|
||||
if v.id != author.id:
|
||||
if author.deflector:
|
||||
msg = f"@{v.username} has tried to give your [comment]({c.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected and applied to them :marseytroll:"
|
||||
send_repeatable_notification(author.id, msg)
|
||||
msg = f"@{author.username} is under the effect of a deflector award; your {AWARDS[kind]['title']} Award has been deflected back to you :marseytroll:"
|
||||
send_repeatable_notification(v.id, msg)
|
||||
author = v
|
||||
elif v.id != author.id:
|
||||
msg = f"@{v.username} has given your [comment]({c.shortlink}) the {AWARDS[kind]['title']} Award!"
|
||||
if note: msg += f"\n\n> {note}"
|
||||
send_repeatable_notification(author.id, msg)
|
||||
|
@ -458,6 +473,8 @@ def award_comment(cid, v):
|
|||
if kind == "benefactor" and author.id == v.id:
|
||||
return {"error": "You can't use this award on yourself."}, 400
|
||||
|
||||
if author.deflector: author = v
|
||||
|
||||
if kind == "ban":
|
||||
link = f"[this comment]({c.shortlink})"
|
||||
|
||||
|
@ -620,6 +637,9 @@ def award_comment(cid, v):
|
|||
g.db.add(badge)
|
||||
g.db.flush()
|
||||
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
|
||||
elif kind == "deflector":
|
||||
if author.deflector: author.deflector += 36000
|
||||
else: author.deflector = int(time.time()) + 36000
|
||||
|
||||
if author.received_award_count: author.received_award_count += 1
|
||||
else: author.received_award_count = 1
|
||||
|
|
|
@ -271,6 +271,12 @@ def front_all(v, sub=None, subdomain=None):
|
|||
if badge: g.db.delete(badge)
|
||||
g.db.commit()
|
||||
|
||||
if v.deflector and v.deflector < time.time():
|
||||
v.deflector = None
|
||||
send_repeatable_notification(v.id, "Your deflector has expired!")
|
||||
g.db.add(v)
|
||||
g.db.commit()
|
||||
|
||||
if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists}
|
||||
return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page, ccmode=ccmode, sub=sub, home=True)
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=186"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=187"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -39,7 +39,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=186"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=187"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
{% endif %}
|
||||
|
||||
</head>
|
||||
|
|
|
@ -19,11 +19,6 @@
|
|||
<div class="text-muted"><span id="{{award.kind}}-owned">{{award.owned}}</span> owned</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
<a class="card disabled d-md-none" style="border:none">
|
||||
<i class="fas fa-volume-mute" style="opacity:0"></i>
|
||||
<div class="pt-2" style="font-weight: bold; font-size: 14px; color:#E1E1E1"> </div>
|
||||
<div class="text-muted"> </div>
|
||||
</a>
|
||||
</div>
|
||||
<label id="notelabel" for="note" class="pt-4">Note (optional):</label>
|
||||
<input autocomplete="off" id="kind" name="kind" value="" hidden>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
--primary55:#{{v.themecolor}}55;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=186">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=187">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
|
@ -37,7 +37,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=186">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=187">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{% block content %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=186"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=187"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -30,7 +30,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=186"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=187"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
{% endif %}
|
||||
|
||||
<div class="row justify-content-around">
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
{% endblock %}
|
||||
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=186">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=187">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
|
||||
</head>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<title>2-Step Login - {{SITE_NAME}}</title>
|
||||
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=186"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=187"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=186"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=187"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=186"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=187"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=186"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=187"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
{% endif %}
|
||||
</head>
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %}</title>
|
||||
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=186"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=187"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %}</title>
|
||||
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=186"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=187"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
{% block stylesheets %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=186"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=187"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
html {
|
||||
|
@ -50,7 +50,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=186">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?v=187">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue