add grinch

pull/83/head
Aevann1 2022-12-20 03:13:34 +02:00
parent 69dee20918
commit 373a6cf0db
6 changed files with 22 additions and 12 deletions

View File

@ -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

View File

@ -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)

View File

@ -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
},
}
"""

View File

@ -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",

View File

@ -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

View File

@ -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' %}