From fc05cf4c805ee4bbd7884f3b1715ac16d889d027 Mon Sep 17 00:00:00 2001 From: Aevann Date: Wed, 4 Oct 2023 18:42:03 +0300 Subject: [PATCH] add king award --- files/assets/css/awards.css | 26 +++++++++++++++++-- files/assets/css/main.css | 2 +- files/classes/badges.py | 1 + files/classes/comment.py | 3 +++ files/classes/post.py | 1 + files/classes/user.py | 1 + files/helpers/config/awards.py | 13 ++++++++++ files/helpers/config/const.py | 1 + files/helpers/cron.py | 2 ++ files/routes/awards.py | 7 +++++ files/routes/comments.py | 1 + files/routes/posts.py | 1 + ...ter table posts add column golden bool.sql | 6 +++++ 13 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 migrations/alter table posts add column golden bool.sql diff --git a/files/assets/css/awards.css b/files/assets/css/awards.css index a2995c69b..602f893c5 100644 --- a/files/assets/css/awards.css +++ b/files/assets/css/awards.css @@ -195,6 +195,28 @@ animation: 60s linear 0s infinite move-colors; } +.gold-text:not(a), h1.gold-text.post-title a { + --color3: #FBED21; + --color2: #edcd1a; + --color1: #e3c414; + font-family: open sans,sans-serif !important; + background: repeating-linear-gradient( + 45deg, + var(--color1), + var(--color1) 10px, + var(--color2) 20px, + var(--color2) 20px, + var(--color3) 60px, + var(--color3) 60px + ); + color: transparent !important; + font-weight: 700 !important; + background-clip: text !important; + -webkit-background-clip: text !important; + animation: 60s linear 0s infinite move-colors; +} + + .queen:not(a):not(.ectoplasm), h1.queen.post-title a { color: hotpink !important; font-weight: 700 !important; @@ -238,11 +260,11 @@ background: url("/i/sharpen/9.webp?x=6"); } -.rainbow-text:not(a) > p { +.rainbow-text:not(a) > p, .gold-text:not(a) > p { color: transparent !important; } -.rainbow-text del { +.rainbow-text del, .gold-text del { color: var(--black); font-weight: 400; } diff --git a/files/assets/css/main.css b/files/assets/css/main.css index f1902f705..811b9d5aa 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -5679,7 +5679,7 @@ lite-youtube.lyt-activated > .lty-playbtn { from {filter: sepia(1) saturate(2)} to {filter: sepia(1) saturate(3) drop-shadow(-1px 1px 3px gold)} } -img.golden, img[g]:not([data-src]) { +img.golden, img[g]:not([data-src]), .gold-text img { animation: golden 1s infinite alternate linear; } diff --git a/files/classes/badges.py b/files/classes/badges.py index aafe0a1c0..cb441a428 100644 --- a/files/classes/badges.py +++ b/files/classes/badges.py @@ -69,6 +69,7 @@ class Badge(Base): if self.badge_id == 281: return self.user.namechanged if self.badge_id == 285: return self.user.queen if self.badge_id == 289: return self.user.sharpen + if self.badge_id == 302: return self.user.king return None diff --git a/files/classes/comment.py b/files/classes/comment.py index a9b3ec76a..a68d56471 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -26,6 +26,8 @@ def get_award_classes(obj, v, title=False): classes.append("glow") if obj.rainbowed: classes.append("rainbow-text") + if obj.golden: + classes.append("gold-text") if obj.queened: classes.append("queen") if obj.chudded: @@ -192,6 +194,7 @@ class Comment(Base): casino_game_id = Column(Integer, ForeignKey("casino_games.id")) chudded = Column(Boolean, default=False) rainbowed = Column(Boolean, default=False) + golden = Column(Boolean, default=False) queened = Column(Boolean, default=False) sharpened = Column(Boolean, default=False) diff --git a/files/classes/post.py b/files/classes/post.py index 7f158c55d..009a23ced 100644 --- a/files/classes/post.py +++ b/files/classes/post.py @@ -63,6 +63,7 @@ class Post(Base): notify = Column(Boolean) chudded = Column(Boolean, default=False) rainbowed = Column(Boolean, default=False) + golden = Column(Boolean, default=False) queened = Column(Boolean, default=False) sharpened = Column(Boolean, default=False) ping_cost = Column(Integer, default=0) diff --git a/files/classes/user.py b/files/classes/user.py index bcb725e23..757c494fa 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -89,6 +89,7 @@ class User(Base): lootboxes_bought = Column(Integer, default=0) chud = Column(Integer, default=0) queen = Column(Integer, default=0) + king = Column(Integer, default=0) chud_phrase = Column(String) email_verified = Column(Boolean, default=False) shadowbanned = Column(Integer, ForeignKey("users.id")) diff --git a/files/helpers/config/awards.py b/files/helpers/config/awards.py index b5053ec4c..22d2a420e 100644 --- a/files/helpers/config/awards.py +++ b/files/helpers/config/awards.py @@ -606,6 +606,19 @@ AWARDS = { "enabled": True, "positive": False, }, + "king": { + "kind": "king", + "title": "King", + "description": "Gives the recipient golden text for 24 hours.", + "icon": "fas fa-crown", + "color": "text-gold", + "price": 1000, + "deflectable": True, + "cosmetic": False, + "ghost": False, + "enabled": True, + "positive": True, + }, "queen": { "kind": "queen", "title": "Queen", diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index 6bc3048ca..3b3437200 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -941,6 +941,7 @@ forced_hats = { "earlylife": ("The Merchant", "SHUT IT DOWN, the goys know!"), "marsify": ("Marsified", "I can't pick my own Marseys, help!"), "is_suspended": ("Behind Bars", "This user is banned and needs to do better!"), + "king": ("King Crown II", "Is there any greater satisfaction than being called king by a mentally ill loner on the internet?"), "chud": ( ("Egg_irl", "This user is getting in touch with xir identity!"), ("Trans Flag", "Just in case you forgot, trans lives matter."), diff --git a/files/helpers/cron.py b/files/helpers/cron.py index 811df7e55..6d691dba1 100644 --- a/files/helpers/cron.py +++ b/files/helpers/cron.py @@ -174,6 +174,7 @@ def _create_post(title, body, pin_hours): ghost=False, chudded=False, rainbowed=False, + golden=False, queened=False, sharpened=False, stickied_utc=stickied_utc, @@ -404,6 +405,7 @@ def _award_timers_task(): _process_timer(User.marsify, [170], "The marsify award you received has expired!") _process_timer(User.rainbow, [171], "The rainbow award you received has expired!") _process_timer(User.queen, [285], "The queen award you received has expired!") + _process_timer(User.king, [302], "The king award you received has expired!") _process_timer(User.spider, [179], "The spider award you received has expired!") _process_timer(User.namechanged, [281], "The namelock award you received has expired. You're now back to your old username!", { User.username: User.prelock_username, diff --git a/files/routes/awards.py b/files/routes/awards.py index 2ab848695..92a24d0fc 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -555,6 +555,13 @@ def award_thing(v, thing_type, id): if thing_type == 'comment' and (not thing.author.deflector or v == thing.author): thing.rainbowed = True g.db.add(thing) + elif kind == 'king': + if author.king: author.king += 86400 + else: author.king = int(time.time()) + 86400 + badge_grant(user=author, badge_id=302) + if thing_type == 'comment' and (not thing.author.deflector or v == thing.author): + thing.golden = True + g.db.add(thing) elif kind == "emoji": award.note = award.note.strip(":").lower() emoji = g.db.query(Emoji).filter_by(name=award.note).one_or_none() diff --git a/files/routes/comments.py b/files/routes/comments.py index 477997806..94872ff5b 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -276,6 +276,7 @@ def comment(v): ghost=ghost, chudded=chudded, rainbowed=bool(v.rainbow), + golden=bool(v.king), queened=bool(v.queen), sharpened=bool(v.sharpen), ) diff --git a/files/routes/posts.py b/files/routes/posts.py index c015e2719..3edeb4a26 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -570,6 +570,7 @@ def submit_post(v, sub=None): ghost=flag_ghost, chudded=flag_chudded, rainbowed=bool(v.rainbow), + golden=bool(v.king), queened=bool(v.queen), sharpened=bool(v.sharpen), ) diff --git a/migrations/alter table posts add column golden bool.sql b/migrations/alter table posts add column golden bool.sql new file mode 100644 index 000000000..de5ae8424 --- /dev/null +++ b/migrations/alter table posts add column golden bool.sql @@ -0,0 +1,6 @@ +alter table users add column king integer; + +alter table posts add column golden bool not null default false; +alter table posts alter column golden drop default; +alter table comments add column golden bool not null default false; +alter table comments alter column golden drop default;