From a5435cbfe243fffc1a1aed215be891627b3b8ab9 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 1 Sep 2021 01:09:00 +0200 Subject: [PATCH] fddf --- files/classes/user.py | 1 + files/routes/users.py | 38 ++++++++++++++++----------- files/templates/thiefs.html | 21 ++++++++++++++- files/templates/userpage_private.html | 6 ++--- 4 files changed, 47 insertions(+), 19 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 807a61e90..b2d0b976e 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -50,6 +50,7 @@ class User(Base, Stndrd, Age_times): rent_utc = Column(Integer, default=0) steal_utc = Column(Integer, default=0) fail_utc = Column(Integer, default=0) + fail2_utc = Column(Integer, default=0) admin_level = Column(Integer, default=0) agendaposter = Column(Boolean, default=False) agendaposter_expires_utc = Column(Integer, default=0) diff --git a/files/routes/users.py b/files/routes/users.py index 005c3c892..569387d39 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -39,25 +39,32 @@ def pay_rent(v): @is_not_banned def steal(v): if int(time.time()) - v.created_utc < 604800: - return "You must have an account older than 1 week in order to stealing." - if v.coins < 100: + return "You must have an account older than 1 week in order to attempt stealing." + if v.coins < 5000: return "You must have more than 100 coins in order to attempt stealing." - if random.randint(1, 10) < 8: - v.coins += 2000 + u = get_account(253) + if random.randint(1, 10) < 5: + v.coins += 1000 v.steal_utc = int(time.time()) g.db.add(v) - u = get_account(253) - u.coins -= 2000 + u.coins -= 1000 g.db.add(u) - send_notification(NOTIFICATIONS_ACCOUNT, u, f"@{v.username} has stolen 2000 dramacoins from you!") - send_notification(NOTIFICATIONS_ACCOUNT, v, f"You have successfully stolen 2000 dramacoins!") + send_notification(NOTIFICATIONS_ACCOUNT, u, f"Some [grubby little rentoid](/@{v.username}) has absconded with 1000 of your hard-earned dramacoins to fuel his Funko Pop addiction. Stop being so trusting.") + send_notification(NOTIFICATIONS_ACCOUNT, v, f"You have successfully shorted your heroic landlord 1000 dramacoins in rent. You're slightly less materially poor, but somehow even moreso morally. Are you proud of yourself?") else: - v.fail_utc = int(time.time()) - v.ban(days=1, reason="Failed thief") + if random.random() < 0.15: + send_notification(NOTIFICATIONS_ACCOUNT, u, f"You caught [this sniveling little renthog](/@{v.username}) trying to rob you. After beating him within an inch of his life, you sold his Nintendo Switch for 500 dramacoins and called the cops. He was sentenced to one (1) day in renthog prison.") + send_notification(NOTIFICATIONS_ACCOUNT, v, f"The ever-vigilant landchad has caught you trying to steal his hard-earned rent money. The police take you away and laugh as you impotently stutter A-ACAB :sob: You are fined 500 dramacoins and sentenced to one (1) day in renthog prison.") + v.ban(days=1, reason="Jailed thief") + v.fail_utc = int(time.time()) + else: + send_notification(NOTIFICATIONS_ACCOUNT, u, f"You caught [this sniveling little renthog](/@{v.username}) trying to rob you. After beating him within an inch of his life, you showed mercy in exchange for a 500 dramacoin tip. This time.") + send_notification(NOTIFICATIONS_ACCOUNT, v, f"The ever-vigilant landchad has caught you trying to steal his hard-earned rent money. You were able to convince him to spare your life with a 500 dramacoin tip. This time.") + v.fail2_utc = int(time.time()) + v.coins -= 500 g.db.add(v) - u = get_account(253) - send_notification(NOTIFICATIONS_ACCOUNT, u, f"@{v.username} has failed to steal coins from you and has been jailed by the authorities for 1 day") - send_notification(NOTIFICATIONS_ACCOUNT, v, f"The authorities have caught you, you have been banned for 1 day") + u.coins += 500 + g.db.add(u) return "", 204 @@ -73,7 +80,8 @@ def rentoids(v): def thiefs(v): successful = g.db.query(User).filter(User.steal_utc > 0).all() failed = g.db.query(User).filter(User.fail_utc > 0).all() - return render_template("thiefs.html", v=v, successful=successful, failed=failed) + failed2 = g.db.query(User).filter(User.fail2_utc > 0).all() + return render_template("thiefs.html", v=v, successful=successful, failed=failed, failed2=failed2) @app.post("/@/suicide") @@ -97,7 +105,7 @@ def get_coins(v, username): else: return {"error": "invalid_user"}, 404 @app.post("/@/transfer_coins") -@auth_required +@is_not_banned @validate_formkey def transfer_coins(v, username): receiver = get_user(username) diff --git a/files/templates/thiefs.html b/files/templates/thiefs.html index 1128fe7c2..42ea04851 100644 --- a/files/templates/thiefs.html +++ b/files/templates/thiefs.html @@ -20,7 +20,7 @@

-
Failed thiefs
+
Jailed thiefs

 
@@ -37,4 +37,23 @@
 {% endfor %}
 
+ +

+
Evicted thiefs
+

+
+
+	
+		
+		
+	
+
+{% for user in failed2 %}
+	
+		
+		
+	
+{% endfor %}
+
#Name
{{failed2.index(user)+1}}{{user.username}}
+ {% endblock %} \ No newline at end of file diff --git a/files/templates/userpage_private.html b/files/templates/userpage_private.html index 8c07f60c8..dc83c903c 100644 --- a/files/templates/userpage_private.html +++ b/files/templates/userpage_private.html @@ -11,10 +11,10 @@

This account is private

This user has enabled private mode to cloak their posting history.

- + {% endif %}