forked from MarseyWorld/MarseyWorld
biggest money
parent
501d0938b9
commit
b0cd33dcf7
|
@ -41,12 +41,13 @@ class Badge(Base):
|
|||
ti = self.user.agendaposter_expires_utc
|
||||
if ti: text = self.badge.description + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
|
||||
else: text = self.badge.description + " permanently"
|
||||
elif self.badge_id in (94,95,96,97,98):
|
||||
elif self.badge_id in (94,95,96,97,98,109):
|
||||
if self.badge_id == 94: ti = self.user.progressivestack
|
||||
elif self.badge_id == 95: ti = self.user.bird
|
||||
elif self.badge_id == 96: ti = self.user.flairchanged
|
||||
elif self.badge_id == 97: ti = self.user.longpost
|
||||
else: ti = self.user.marseyawarded
|
||||
elif self.badge_id == 98: ti = self.user.marseyawarded
|
||||
elif self.badge_id == 109: ti = self.user.rehab
|
||||
text = self.badge.description + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
|
||||
elif self.description: text = self.description
|
||||
elif self.badge.description: text = self.badge.description
|
||||
|
|
|
@ -54,6 +54,7 @@ def format_all(player_hand, dealer_hand, deck, status, wager):
|
|||
|
||||
class Blackjack:
|
||||
command_word = "!blackjack"
|
||||
casino_word = "!blackjackmb"
|
||||
minimum_bet = 100
|
||||
maximum_bet = INFINITY
|
||||
|
||||
|
@ -94,9 +95,6 @@ class Blackjack:
|
|||
from_comment.blackjack_result = format_all(
|
||||
player_hand, dealer_hand, rest_of_deck, status, wager)
|
||||
|
||||
self.db.add(from_comment)
|
||||
self.db.commit()
|
||||
|
||||
def player_hit(self, from_comment):
|
||||
player_hand, dealer_hand, deck, status, wager = from_comment.blackjack_result.split(
|
||||
"_")
|
||||
|
@ -113,9 +111,6 @@ class Blackjack:
|
|||
from_comment.blackjack_result = format_all(
|
||||
player_hand, dealer_hand, deck, status, wager)
|
||||
|
||||
self.db.add(from_comment)
|
||||
self.db.commit()
|
||||
|
||||
if (player_value == 21):
|
||||
self.player_stayed(from_comment)
|
||||
|
||||
|
@ -143,9 +138,6 @@ class Blackjack:
|
|||
from_comment.blackjack_result = format_all(
|
||||
player_hand, dealer_hand, deck, status, wager)
|
||||
|
||||
self.db.add(from_comment)
|
||||
self.db.commit()
|
||||
|
||||
self.apply_game_result(from_comment, wager, status)
|
||||
|
||||
def apply_game_result(self, from_comment, wager, result):
|
||||
|
@ -161,7 +153,4 @@ class Blackjack:
|
|||
if (reward > 0):
|
||||
user = from_comment.author
|
||||
user.coins += reward
|
||||
user.winnings += reward
|
||||
|
||||
self.db.add(user)
|
||||
self.db.commit()
|
||||
user.winnings += reward
|
|
@ -11,7 +11,7 @@ class Treasure:
|
|||
self.db = g.db
|
||||
|
||||
def check_for_treasure(self, in_text, from_comment):
|
||||
has_gamble_command = '!slots' in in_text or '!blackjack' in in_text
|
||||
has_gamble_command = '!slots' in in_text or '!casino' in in_text or '!blackjack' in in_text
|
||||
|
||||
if not has_gamble_command:
|
||||
seed = random.randint(1, 1000)
|
||||
|
|
|
@ -50,6 +50,7 @@ class User(Base):
|
|||
verified = Column(String)
|
||||
verifiedcolor = Column(String)
|
||||
marseyawarded = Column(Integer)
|
||||
rehab = Column(Integer)
|
||||
longpost = Column(Integer)
|
||||
winnings = Column(Integer, default=0)
|
||||
unblockable = Column(Boolean)
|
||||
|
|
|
@ -356,6 +356,14 @@ AWARDS = {
|
|||
"color": "text-white",
|
||||
"price": 500
|
||||
},
|
||||
"rehab": {
|
||||
"kind": "rehab",
|
||||
"title": "Rehab",
|
||||
"description": "Prevents the user from gambling for 24 hours in a last ditch effort to save them from themself.",
|
||||
"icon": "fas fa-dice-six",
|
||||
"color": "text-black",
|
||||
"price": 777
|
||||
},
|
||||
"progressivestack": {
|
||||
"kind": "progressivestack",
|
||||
"title": "Progressive Stack",
|
||||
|
|
|
@ -403,6 +403,14 @@ def award_post(pid, v):
|
|||
for c in post.comments:
|
||||
c.ghost = True
|
||||
g.db.add(c)
|
||||
elif kind == "rehab":
|
||||
if author.rehab: author.rehab += 86400
|
||||
else: author.rehab = int(time.time()) + 86400
|
||||
if not v.has_badge(109):
|
||||
badge = Badge(user_id=v.id, badge_id=109)
|
||||
g.db.add(badge)
|
||||
g.db.flush()
|
||||
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
|
||||
|
||||
if post.author.received_award_count: post.author.received_award_count += 1
|
||||
else: post.author.received_award_count = 1
|
||||
|
@ -622,6 +630,14 @@ def award_comment(cid, v):
|
|||
elif kind == "ghosts":
|
||||
c.ghost = True
|
||||
g.db.add(c)
|
||||
elif kind == "rehab":
|
||||
if author.rehab: author.rehab += 86400
|
||||
else: author.rehab = int(time.time()) + 86400
|
||||
if not v.has_badge(109):
|
||||
badge = Badge(user_id=v.id, badge_id=109)
|
||||
g.db.add(badge)
|
||||
g.db.flush()
|
||||
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
|
||||
|
||||
if c.author.received_award_count: c.author.received_award_count += 1
|
||||
else: c.author.received_award_count = 1
|
||||
|
|
|
@ -202,7 +202,7 @@ def api_comment(v):
|
|||
process_image(filename)
|
||||
elif parent_post.id == 37833:
|
||||
try:
|
||||
badge_def = loads(body.lower())
|
||||
badge_def = loads(body)
|
||||
name = badge_def["name"]
|
||||
badge = g.db.query(BadgeDef).filter_by(name=name).first()
|
||||
if not badge:
|
||||
|
@ -589,11 +589,12 @@ def api_comment(v):
|
|||
c.upvotes += 1
|
||||
g.db.add(c)
|
||||
|
||||
slots = Slots(g)
|
||||
slots.check_for_slots_command(body, v, c)
|
||||
if not v.rehab:
|
||||
slots = Slots(g)
|
||||
slots.check_for_slots_command(body, v, c)
|
||||
|
||||
blackjack = Blackjack(g)
|
||||
blackjack.check_for_blackjack_command(body, v, c)
|
||||
blackjack = Blackjack(g)
|
||||
blackjack.check_for_blackjack_command(body, v, c)
|
||||
|
||||
treasure = Treasure(g)
|
||||
treasure.check_for_treasure(body, c)
|
||||
|
|
|
@ -244,6 +244,14 @@ def front_all(v):
|
|||
if badge: g.db.delete(badge)
|
||||
g.db.commit()
|
||||
|
||||
if v.rehab and v.rehab < time.time():
|
||||
v.rehab = None
|
||||
send_repeatable_notification(v.id, "Your rehab has finished!")
|
||||
g.db.add(v)
|
||||
badge = v.has_badge(109)
|
||||
if badge: g.db.delete(badge)
|
||||
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)
|
||||
|
||||
|
|
|
@ -667,7 +667,7 @@ def thumbnail_thread(pid):
|
|||
db.add(post)
|
||||
db.commit()
|
||||
|
||||
if SITE == 'rdrama.net' and random.random() < 0.05:
|
||||
if SITE == 'rdrama.net' and random.random() < 0.02:
|
||||
for t in ("submission","comment"):
|
||||
for term in ('rdrama','freeghettohoes.biz','marsey'):
|
||||
for i in requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q={term}&size=10').json()["data"]:
|
||||
|
|
|
@ -71,9 +71,14 @@ def upvoters(v, username):
|
|||
users2 = []
|
||||
for user in users: users2.append((user, votes[user.id]))
|
||||
|
||||
users = sorted(users2, key=lambda x: x[1], reverse=True)[:25]
|
||||
users = sorted(users2, key=lambda x: x[1], reverse=True)
|
||||
|
||||
try:
|
||||
pos = [x[0].id for x in users].index(v.id)
|
||||
pos = (pos+1, users[pos][1])
|
||||
except: pos = (len(users)+1, 0)
|
||||
|
||||
return render_template("voters.html", v=v, users=users, name='Up', name2=f'@{username} biggest simps')
|
||||
return render_template("voters.html", v=v, users=users[:25], pos=pos, name='Up', name2=f'@{username} biggest simps')
|
||||
|
||||
@app.get("/@<username>/downvoters")
|
||||
@auth_required
|
||||
|
@ -90,9 +95,14 @@ def downvoters(v, username):
|
|||
users2 = []
|
||||
for user in users: users2.append((user, votes[user.id]))
|
||||
|
||||
users = sorted(users2, key=lambda x: x[1], reverse=True)[:25]
|
||||
users = sorted(users2, key=lambda x: x[1], reverse=True)
|
||||
|
||||
try:
|
||||
pos = [x[0].id for x in users].index(v.id)
|
||||
pos = (pos+1, users[pos][1])
|
||||
except: pos = (len(users)+1, 0)
|
||||
|
||||
return render_template("voters.html", v=v, users=users, name='Down', name2=f'@{username} biggest haters')
|
||||
return render_template("voters.html", v=v, users=users[:25], pos=pos, name='Down', name2=f'@{username} biggest haters')
|
||||
|
||||
@app.get("/@<username>/upvoting")
|
||||
@auth_required
|
||||
|
@ -109,9 +119,14 @@ def upvoting(v, username):
|
|||
users2 = []
|
||||
for user in users: users2.append((user, votes[user.id]))
|
||||
|
||||
users = sorted(users2, key=lambda x: x[1], reverse=True)[:25]
|
||||
users = sorted(users2, key=lambda x: x[1], reverse=True)
|
||||
|
||||
try:
|
||||
pos = [x[0].id for x in users].index(v.id)
|
||||
pos = (pos+1, users[pos][1])
|
||||
except: pos = (len(users)+1, 0)
|
||||
|
||||
return render_template("voters.html", v=v, users=users, name='Up', name2=f'Who @{username} simps for')
|
||||
return render_template("voters.html", v=v, users=users[:25], pos=pos, name='Up', name2=f'Who @{username} simps for')
|
||||
|
||||
@app.get("/@<username>/downvoting")
|
||||
@auth_required
|
||||
|
@ -128,9 +143,14 @@ def downvoting(v, username):
|
|||
users2 = []
|
||||
for user in users: users2.append((user, votes[user.id]))
|
||||
|
||||
users = sorted(users2, key=lambda x: x[1], reverse=True)[:25]
|
||||
users = sorted(users2, key=lambda x: x[1], reverse=True)
|
||||
|
||||
try:
|
||||
pos = [x[0].id for x in users].index(v.id)
|
||||
pos = (pos+1, users[pos][1])
|
||||
except: pos = (len(users)+1, 0)
|
||||
|
||||
return render_template("voters.html", v=v, users=users, name='Down', name2=f'Who @{username} hates')
|
||||
return render_template("voters.html", v=v, users=users[:25], pos=pos, name='Down', name2=f'Who @{username} hates')
|
||||
|
||||
@app.post("/pay_rent")
|
||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=101"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=14">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=102"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=14">
|
||||
{% 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?a=101"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=102"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
{% endif %}
|
||||
|
||||
</head>
|
||||
|
|
|
@ -878,10 +878,6 @@
|
|||
object-fit: cover;
|
||||
}
|
||||
|
||||
.text-black {
|
||||
color: var(--black);
|
||||
}
|
||||
|
||||
.smolbtn {
|
||||
font-weight: 600;
|
||||
font-size: .9rem;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<script src="/static/assets/js/bootstrap.js?a=220"></script>
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=101">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=102">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=14">
|
||||
{% if v.agendaposter %}
|
||||
<style>
|
||||
|
@ -32,7 +32,7 @@
|
|||
{% endif %}
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=101"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=102"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
{% endif %}
|
||||
|
||||
<meta charset="utf-8">
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{% block content %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=101"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=14">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=102"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=14">
|
||||
{% 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?a=101"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=102"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
{% 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?a=101">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=102">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
|
||||
</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?a=101"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=102"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=101"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=14">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=102"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=14">
|
||||
{% 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?a=101"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=14">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=102"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=14">
|
||||
{% else %}
|
||||
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=101"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=102"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
{% 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?a=101"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=102"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
|
||||
</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?a=101"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=102"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
|
||||
</head>
|
||||
|
||||
|
|
|
@ -659,10 +659,6 @@
|
|||
object-fit: cover;
|
||||
}
|
||||
|
||||
.text-black {
|
||||
color: var(--black);
|
||||
}
|
||||
|
||||
.smolbtn {
|
||||
font-weight: 600;
|
||||
font-size: .9rem;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
{% block stylesheets %}
|
||||
{% if v %}
|
||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=101"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=14">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=102"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?a=14">
|
||||
{% 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?a=101">
|
||||
<link rel="stylesheet" href="/static/assets/css/main.css?a=102">
|
||||
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?a=14">
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -16,13 +16,26 @@
|
|||
</thead>
|
||||
<tbody id="followers-table">
|
||||
{% for user in users %}
|
||||
<tr>
|
||||
<tr {% if v.id == user[0].id %}class="self"{% endif %}>
|
||||
<td style="font-weight: bold">{{loop.index}}</td>
|
||||
<td><a style="color:#{{user[0].namecolor}}; font-weight:bold;" href="/@{{user[0].username}}"><img alt="@{{user[0].username}}'s profile picture" loading="lazy" src="{{user[0].profile_url}}" class="pp20"><span {% if user[0].patron %}class="patron" style="background-color:#{{user[0].namecolor}}"{% endif %}>{{user[0].username}}</span></a></td>
|
||||
<td style="font-weight: bold">{{user[1]}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% if pos and (pos[0] > 25 or not pos[1]) %}
|
||||
<tr style="border-top:2px solid var(--primary)">
|
||||
<td style="font-weight:bold">{{pos[0]}}</td>
|
||||
<td><a style="color:#{{v.namecolor}};font-weight:bold" href="/@{{v.username}}"><img alt="@{{v.username}}'s profile picture" loading="lazy" src="{{v.profile_url}}" class="pp20"><span {% if v.patron %}class="patron" style="background-color:#{{v.namecolor}}"{% endif %}>{{v.username}}</span></a></td>
|
||||
<td style="font-weight:bold">{{pos[1]}}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<style>
|
||||
.self {
|
||||
border-top:2px solid var(--primary);
|
||||
border-bottom:2px solid var(--primary);
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue