diff --git a/files/classes/user.py b/files/classes/user.py index 4966c2695..9c1387e25 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -1135,3 +1135,11 @@ class User(Base): @lazy def shadowbanner(self): return g.db.query(User.username).filter_by(id=self.shadowbanned).one()[0] + + if HOLIDAY_EVENT: + @property + @lazy + def event_music(self): + if SITE_NAME != 'rDrama': return False + if self.has_badge(91): return False + return True diff --git a/files/events/classes/eventuser.py b/files/events/classes/eventuser.py index c80f52329..6f0efd827 100644 --- a/files/events/classes/eventuser.py +++ b/files/events/classes/eventuser.py @@ -11,7 +11,6 @@ class EventUser(Base): __tablename__ = "event_users" id = Column(Integer, ForeignKey("users.id"), primary_key=True) user = relationship("User", primaryjoin="EventUser.id == User.id") - event_music = Column(Boolean, default=True, nullable=False) # start event specific columns event_darkmode = Column(Boolean, default=default_darkmode, nullable=False) diff --git a/files/events/helpers/const.py b/files/events/helpers/const.py index 32deb1d63..a81d548ea 100644 --- a/files/events/helpers/const.py +++ b/files/events/helpers/const.py @@ -69,6 +69,16 @@ EVENT_AWARDS = { "deflectable": False, "cosmetic": True }, + "grinch": { + "kind": "grinch", + "title": "Grinch", + "description": "", + "icon": "fas fa-angry", + "color": "text-green-500", + "price": 1000, + "deflectable": True, + "cosmetic": False + }, } """ diff --git a/files/helpers/config/awards.py b/files/helpers/config/awards.py index cb0d6ea05..8f99a8454 100644 --- a/files/helpers/config/awards.py +++ b/files/helpers/config/awards.py @@ -85,16 +85,6 @@ AWARDS = { "deflectable": False, "cosmetic": True }, - "grinch": { - "kind": "grinch", - "title": "Grinch", - "description": "", - "icon": "fas fa-angry", - "color": "text-green-500", - "price": 1000, - "deflectable": True, - "cosmetic": False - }, ### Homoween 2021 & 2022 "haunt": { "kind": "haunt", diff --git a/files/routes/awards.py b/files/routes/awards.py index d922c3205..5116fd4d2 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -407,6 +407,9 @@ def award_thing(v, thing_type, id): from files.events import EVENT_AWARDS, award_thing_event if kind in EVENT_AWARDS: award_thing_event(v, kind, author) + if kind == "grinch": + badge_grant(badge_id=91, user=author) + if author.received_award_count: author.received_award_count += 1 else: author.received_award_count = 1 diff --git a/files/templates/event/music.html b/files/templates/event/music.html index ee702e15e..88ddcfdaf 100644 --- a/files/templates/event/music.html +++ b/files/templates/event/music.html @@ -1,4 +1,4 @@ -{% if not (v and v.poor) and (not g.event_v or g.event_v.event_music) and not (sub and sub.name == 'music') %} +{% if not (v and v.poor) and (not v or v.event_music) and not (sub and sub.name == 'music') %} {% if not song %} {% set path = "assets/event/media/music" %} {% set song = "/" ~ path ~ "/" ~ listdir('files/' ~ path)|random() ~ '?v=45' %}