diff --git a/files/assets/images/badges/170.webp b/files/assets/images/badges/170.webp index c08592e09..a55ab02ee 100644 Binary files a/files/assets/images/badges/170.webp and b/files/assets/images/badges/170.webp differ diff --git a/files/classes/badges.py b/files/classes/badges.py index d90bc96e2..98fe6a3ff 100644 --- a/files/classes/badges.py +++ b/files/classes/badges.py @@ -52,6 +52,12 @@ class Badge(Base): if self.badge_id == 97: return self.user.longpost if self.badge_id == 98: return self.user.marseyawarded if self.badge_id == 109: return self.user.rehab + if self.badge_id == 167: return self.user.owoify + if self.badge_id == 168: return self.user.bite + if self.badge_id == 169: return self.user.earlylife + if self.badge_id == 170: return self.user.marsify + if self.badge_id == 171: return self.user.rainbow + return None @property diff --git a/files/helpers/awards.py b/files/helpers/awards.py index 01917fc25..a48e80b88 100644 --- a/files/helpers/awards.py +++ b/files/helpers/awards.py @@ -8,95 +8,89 @@ from files.classes.user import User def award_timers(v, bot=False): now = time.time() - dirty = False def notify_if_not_bot(msg): if not bot: - send_repeatable_notification(v.id,msg) + send_repeatable_notification(v.id, msg) if v.patron_utc and v.patron_utc < now: v.patron = 0 v.patron_utc = 0 notify_if_not_bot(f"Your {patron} status has expired!") if not bot and v.discord_id: remove_role(v, "1") - dirty = True if v.unban_utc and v.unban_utc < now: v.is_banned = 0 v.unban_utc = 0 v.ban_evade = 0 v.ban_reason = None notify_if_not_bot("You have been unbanned!") - dirty = True if v.agendaposter and v.agendaposter != 1 and v.agendaposter < now: v.agendaposter = 0 notify_if_not_bot("Your chud theme has expired!") badge = v.has_badge(28) if badge: g.db.delete(badge) - dirty = True if v.flairchanged and v.flairchanged < now: v.flairchanged = None notify_if_not_bot("Your flair lock has expired. You can now change your flair!") badge = v.has_badge(96) if badge: g.db.delete(badge) - dirty = True if v.marseyawarded and v.marseyawarded < now: v.marseyawarded = None notify_if_not_bot("Your marsey award has expired!") badge = v.has_badge(98) if badge: g.db.delete(badge) - dirty = True if v.longpost and v.longpost < now: v.longpost = None notify_if_not_bot("Your pizzashill award has expired!") badge = v.has_badge(97) if badge: g.db.delete(badge) - dirty = True if v.bird and v.bird < now: v.bird = None notify_if_not_bot("Your bird site award has expired!") badge = v.has_badge(95) if badge: g.db.delete(badge) - dirty = True if v.progressivestack and v.progressivestack < now: v.progressivestack = None notify_if_not_bot("Your progressive stack has expired!") badge = v.has_badge(94) if badge: g.db.delete(badge) - dirty = True if v.rehab and v.rehab < now: v.rehab = None notify_if_not_bot("Your rehab has finished!") badge = v.has_badge(109) if badge: g.db.delete(badge) - dirty = True if v.deflector and v.deflector < now: v.deflector = None notify_if_not_bot("Your deflector has expired!") - dirty = True - if v.rainbow and v.rainbow < now: - v.rainbow = None - notify_if_not_bot("Your rainbow has expired!") - dirty = True + if v.owoify and v.owoify < now: + v.owoify = None + notify_if_not_bot("Your OwOify status has expired!") + v.house = v.old_house + badge = v.has_badge(167) if v.bite and v.bite < now: v.bite = None notify_if_not_bot("Your vampire status has ended!") v.house = v.old_house - dirty = True + badge = v.has_badge(168) + if badge: g.db.delete(badge) if v.earlylife and v.earlylife < now: v.earlylife = None notify_if_not_bot("Your earlylife status has expired!") - dirty = True - if v.owoify and v.owoify < now: - v.owoify = None - notify_if_not_bot("Your owoify status has expired!") - dirty = True + v.house = v.old_house + badge = v.has_badge(169) if v.marsify and v.marsify != 1 and v.marsify < now: v.marsify = 0 if SITE_NAME != 'rDrama': notify_if_not_bot("Your marsify status has expired!") - dirty = True + badge = v.has_badge(170) + if badge: g.db.delete(badge) + if v.rainbow and v.rainbow < now: + v.rainbow = None + notify_if_not_bot("Your rainbow has expired!") + v.house = v.old_house + badge = v.has_badge(171) + + g.db.add(v) - if dirty: - g.db.add(v) def award_timers_bots_task(): accs = g.db.query(User).filter(User.id.in_(bots)) diff --git a/files/routes/awards.py b/files/routes/awards.py index a414af09c..dbc3a8903 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -347,6 +347,7 @@ def award_thing(v, thing_type, id): elif kind == 'marsify': if author.marsify: author.marsify += 21600 else: author.marsify = int(time.time()) + 21600 + badge_grant(user=author, badge_id=170) if thing_type == 'comment' and (not author.deflector or v.id == AEVANN_ID): body = thing.body @@ -359,12 +360,15 @@ def award_thing(v, thing_type, id): else: author.bite = int(time.time()) + 86400 * 7 author.old_house = author.house author.house = 'Vampire' + badge_grant(user=author, badge_id=168) elif "Racist" in kind and kind == v.house: if author.earlylife: author.earlylife += 86400 else: author.earlylife = int(time.time()) + 86400 + badge_grant(user=author, badge_id=169) elif ("Furry" in kind and kind == v.house) or kind == 'owoify': if author.owoify: author.owoify += 21600 else: author.owoify = int(time.time()) + 21600 + badge_grant(user=author, badge_id=167) if thing_type == 'comment' and not (author.deflector or v.id == AEVANN_ID): body = thing.body @@ -375,6 +379,7 @@ def award_thing(v, thing_type, id): elif ("Femboy" in kind and kind == v.house): if author.rainbow: author.rainbow += 86400 else: author.rainbow = int(time.time()) + 86400 + badge_grant(user=author, badge_id=171) if author.received_award_count: author.received_award_count += 1 else: author.received_award_count = 1 diff --git a/files/templates/admin/badge_grant.html b/files/templates/admin/badge_grant.html index a3cf2e268..a6b2f8e13 100644 --- a/files/templates/admin/badge_grant.html +++ b/files/templates/admin/badge_grant.html @@ -62,7 +62,7 @@ {{badge.name}} diff --git a/files/templates/admin/badge_remove.html b/files/templates/admin/badge_remove.html index 9106afc6b..98556ee4e 100644 --- a/files/templates/admin/badge_remove.html +++ b/files/templates/admin/badge_remove.html @@ -62,7 +62,7 @@ {{badge.name}} diff --git a/files/templates/badges.html b/files/templates/badges.html index ad41a4694..e1a883966 100644 --- a/files/templates/badges.html +++ b/files/templates/badges.html @@ -28,7 +28,7 @@ {{loop.index}} {{badge.name}} - {{badge.name}} + {{badge.name}} {{badge.description}} {%- set ct = counts[badge.id] if badge.id in counts else (0, 0) %} diff --git a/files/templates/userpage.html b/files/templates/userpage.html index e7868cc84..9d6abfcef 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -375,10 +375,10 @@ {% for b in u.badges %} {% if b.url %} - {{b.name}} + {{b.name}} {% else %} - {{b.name}} + {{b.name}} {% endif %} {% endfor %} @@ -529,10 +529,10 @@ {% for b in u.badges %} {% if b.url %} - {{b.name}} + {{b.name}} {% else %} - {{b.name}} + {{b.name}} {% endif %} {% endfor %}