Aevann 2024-05-22 22:26:09 +03:00
parent 8ab3a41118
commit 30dada97e4
6 changed files with 184 additions and 172 deletions

View File

@ -227,6 +227,7 @@
.fa-file-pen:before{content:"\f31c"}
.fa-pen:before{content:"\f304"}
.fa-newspaper:before{content:"\f1ea"}
.fa-walkie-talkie:before{content:"\f8ef"}
/* do not remove - fixes hand, talking, marsey-love components
from breaking out of the comment box

View File

@ -5,7 +5,7 @@ from sqlalchemy.orm import relationship
from sqlalchemy.sql.sqltypes import *
from files.classes import Base
from files.helpers.config.awards import AWARDS, HOUSE_AWARDS
from files.helpers.config.awards import *
from files.helpers.lazy import lazy
@ -37,7 +37,6 @@ class AwardRelationship(Base):
@lazy
def type(self):
if self.kind in AWARDS: return AWARDS[self.kind]
elif self.kind in HOUSE_AWARDS: return HOUSE_AWARDS[self.kind]
else: return AWARDS["fallback"]
@property

View File

@ -18,7 +18,7 @@ from files.classes.chats import ChatMembership
from files.classes.currency_logs import CurrencyLog
from files.helpers.config.const import *
from files.helpers.config.modaction_types import *
from files.helpers.config.awards import AWARDS_ENABLED, HOUSE_AWARDS
from files.helpers.config.awards import *
from files.helpers.media import *
from files.helpers.security import *
from files.helpers.sorting_and_time import *
@ -600,10 +600,7 @@ class User(Base):
@property
@lazy
def user_awards(self):
return_value = list(AWARDS_ENABLED().values())
if self.house:
return_value.append(HOUSE_AWARDS[self.house])
return_value = list(AWARDS_ENABLED(self).values())
awards_owned = g.db.query(AwardRelationship.kind, func.count()) \
.filter_by(user_id=self.id, post_id=None, comment_id=None) \
@ -775,7 +772,7 @@ class User(Base):
total_awards = post_awards + comment_awards
for a in total_awards:
kind = a.kind.replace(' Founder', '').replace('emoji-hz', 'emoji')
kind = a.kind.replace('emoji-hz', 'emoji')
if kind in awards:
awards[kind]['count'] += 1
else:

View File

@ -14,7 +14,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": False,
"ghost": False,
"enabled": False,
"enabled": lambda v:False,
"negative": False,
"included_in_lootbox": False,
},
@ -30,7 +30,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": False,
"enabled": lambda v:False,
"negative": False,
"included_in_lootbox": False,
},
@ -44,7 +44,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": False,
"ghost": False,
"enabled": False,
"enabled": lambda v:False,
"negative": False,
"included_in_lootbox": False,
},
@ -58,7 +58,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": False,
"enabled": lambda v:False,
"negative": False,
"included_in_lootbox": False,
},
@ -72,7 +72,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": False,
"enabled": lambda v:False,
"negative": False,
"included_in_lootbox": False,
},
@ -89,7 +89,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": IS_MUSICAL_EVENT() and SITE_NAME == "rDrama",
"enabled": lambda v:IS_MUSICAL_EVENT() and SITE_NAME == "rDrama",
"negative": False,
"included_in_lootbox": False,
},
@ -103,7 +103,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": True,
"ghost": False,
"enabled": IS_EVENT(),
"enabled": lambda v:IS_EVENT(),
"negative": False,
"included_in_lootbox": False,
},
@ -119,7 +119,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_FISTMAS(),
"enabled": lambda v:IS_FISTMAS(),
"negative": False,
"included_in_lootbox": True,
},
@ -133,7 +133,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_FISTMAS(),
"enabled": lambda v:IS_FISTMAS(),
"negative": False,
"included_in_lootbox": True,
},
@ -147,7 +147,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_FISTMAS(),
"enabled": lambda v:IS_FISTMAS(),
"negative": False,
"included_in_lootbox": True,
},
@ -161,7 +161,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_FISTMAS(),
"enabled": lambda v:IS_FISTMAS(),
"negative": False,
"included_in_lootbox": True,
},
@ -175,7 +175,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_FISTMAS(),
"enabled": lambda v:IS_FISTMAS(),
"negative": False,
"included_in_lootbox": True,
},
@ -189,7 +189,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_FISTMAS(),
"enabled": lambda v:IS_FISTMAS(),
"negative": False,
"included_in_lootbox": True,
},
@ -205,12 +205,12 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN(),
"enabled": lambda v:IS_HOMOWEEN(),
"negative": False,
"included_in_lootbox": True,
},
"bite": {
"kind": "bite",
"zombiebite": {
"kind": "zombiebite",
"title": "Zombie Bite",
"description": "???",
"icon": "fas fa-biohazard",
@ -219,7 +219,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": IS_HOMOWEEN(),
"enabled": lambda v:IS_HOMOWEEN(),
"negative": False,
"included_in_lootbox": False,
},
@ -233,7 +233,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": IS_HOMOWEEN(),
"enabled": lambda v:IS_HOMOWEEN(),
"negative": False,
"included_in_lootbox": False,
},
@ -247,7 +247,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN(),
"enabled": lambda v:IS_HOMOWEEN(),
"negative": False,
"included_in_lootbox": True,
},
@ -261,7 +261,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN(),
"enabled": lambda v:IS_HOMOWEEN(),
"negative": False,
"included_in_lootbox": True,
},
@ -275,7 +275,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN(),
"enabled": lambda v:IS_HOMOWEEN(),
"negative": False,
"included_in_lootbox": True,
},
@ -289,7 +289,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN(),
"enabled": lambda v:IS_HOMOWEEN(),
"negative": False,
"included_in_lootbox": True,
},
@ -303,7 +303,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN(),
"enabled": lambda v:IS_HOMOWEEN(),
"negative": False,
"included_in_lootbox": True,
},
@ -317,7 +317,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN(),
"enabled": lambda v:IS_HOMOWEEN(),
"negative": False,
"included_in_lootbox": True,
},
@ -331,7 +331,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN(),
"enabled": lambda v:IS_HOMOWEEN(),
"negative": False,
"included_in_lootbox": True,
},
@ -345,7 +345,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN(),
"enabled": lambda v:IS_HOMOWEEN(),
"negative": False,
"included_in_lootbox": True,
},
@ -359,7 +359,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": IS_HOMOWEEN(),
"enabled": lambda v:IS_HOMOWEEN(),
"negative": False,
"included_in_lootbox": True,
},
@ -373,7 +373,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN(),
"enabled": lambda v:IS_HOMOWEEN(),
"negative": False,
"included_in_lootbox": False,
},
@ -387,12 +387,26 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": IS_HOMOWEEN(),
"enabled": lambda v:IS_HOMOWEEN(),
"negative": False,
"included_in_lootbox": False,
},
### Standard
"earlylife": {
"kind": "earlylife",
"title": "Early Life",
"description": "Checks the recipient's Early Life section on Wikipedia. Notices.",
"icon": "fas fa-star-of-david",
"color": "text-yellow",
"price": 100,
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": lambda v:v.house and v.house.startswith('Racist'),
"negative": True,
"included_in_lootbox": False,
},
"beano": {
"kind": "beano",
"title": "Beano",
@ -403,7 +417,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": False,
},
@ -417,7 +431,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": True,
"included_in_lootbox": False,
},
@ -431,7 +445,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": IS_DKD() or IS_BDAY(),
},
@ -445,10 +459,38 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": False,
"enabled": lambda v:False,
"negative": False,
"included_in_lootbox": False,
},
"rainbow": {
"kind": "rainbow",
"title": "Rainbow",
"description": "Makes the recipient's posts and comments in rainbow text for 24 hours.",
"icon": "fas fa-cloud-rainbow",
"color": "text-pink",
"price": 200,
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": lambda v:v.house and v.house.startswith('Femboy'),
"negative": True,
"included_in_lootbox": False,
},
"sharpen": {
"kind": "sharpen",
"title": "Sharpen",
"description": "Adds a badass edge to all the recipient's posts and comments for 24 hours.",
"icon": "fas fa-fire",
"color": "text-danger",
"price": 200,
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": lambda v:v.house and v.house.startswith('Edgy'),
"negative": True,
"included_in_lootbox": False,
},
"confetti": {
"kind": "confetti",
"title": "Confetti",
@ -459,7 +501,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": IS_DKD() or IS_BDAY(),
},
@ -473,7 +515,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": True,
"ghost": True,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": False,
},
@ -487,7 +529,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": IS_DKD() or IS_BDAY(),
},
@ -501,7 +543,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": IS_DKD() or IS_BDAY(),
},
@ -515,7 +557,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": IS_DKD() or IS_BDAY(),
},
@ -529,10 +571,52 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": True,
"enabled": lambda v:True,
"negative": True,
"included_in_lootbox": IS_DKD() or IS_BDAY(),
},
"shutitdown" : {
"kind": "shutitdown",
"title": "Shut It Down",
"description": "The goyim know.",
"icon": "fas fa-walkie-talkie",
"color": "text-blue",
"price": 500,
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": lambda v:v.house and v.house.startswith('Racist'),
"negative": False,
"included_in_lootbox": False,
},
"owoify": {
"kind": "owoify",
"title": "OwOify",
"description": "OwOifies the recipient's posts and comments for 6 hours.",
"icon": "fas fa-paw-simple",
"color": "text-purple",
"price": 500,
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": lambda v:v.house and v.house.startswith('Furry'),
"negative": True,
"included_in_lootbox": False,
},
"bite": {
"kind": "bite",
"title": "Bite",
"description": "Turns the recipient into a vampire for 2 days.",
"icon": "fas fa-bat",
"color": "text-gray",
"price": 500,
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": lambda v:v.house and v.house.startswith('Vampire'),
"negative": True,
"included_in_lootbox": False,
},
"glowie": {
"kind": "glowie",
"title": "Glowie",
@ -543,7 +627,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": True,
"enabled": lambda v:True,
"negative": True,
"included_in_lootbox": IS_DKD() or IS_BDAY(),
},
@ -557,7 +641,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": IS_DKD() or IS_BDAY(),
},
@ -571,7 +655,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": True,
"included_in_lootbox": False,
},
@ -585,7 +669,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": True,
"included_in_lootbox": False,
},
@ -599,7 +683,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": True,
"included_in_lootbox": False,
},
@ -613,7 +697,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": True,
"included_in_lootbox": False,
},
@ -627,7 +711,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": True,
"included_in_lootbox": False,
},
@ -641,7 +725,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": False,
},
@ -655,7 +739,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": True,
"enabled": True,
"enabled": lambda v:True,
"negative": True,
"included_in_lootbox": False,
},
@ -669,7 +753,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": True,
"included_in_lootbox": False,
},
@ -683,7 +767,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": False,
"ghost": True,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": False,
},
@ -697,7 +781,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": False,
},
@ -711,7 +795,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": True,
"included_in_lootbox": False,
},
@ -725,7 +809,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": True,
"included_in_lootbox": False,
},
@ -739,7 +823,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": True,
"included_in_lootbox": False,
},
@ -753,7 +837,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": True,
"included_in_lootbox": False,
},
@ -767,7 +851,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": False,
},
@ -781,7 +865,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": False,
},
@ -795,7 +879,7 @@ AWARDS = {
"deflectable": False,
"cosmetic": False,
"ghost": False,
"enabled": FEATURES['MARSEYBUX'],
"enabled": lambda v:FEATURES['MARSEYBUX'],
"negative": False,
"included_in_lootbox": False,
},
@ -809,7 +893,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": False,
},
@ -823,7 +907,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": True,
"included_in_lootbox": False,
},
@ -837,7 +921,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": False,
},
@ -851,7 +935,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": False,
},
@ -865,7 +949,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": False,
},
@ -879,7 +963,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": False,
},
@ -893,7 +977,7 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": False,
},
@ -907,87 +991,13 @@ AWARDS = {
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"enabled": lambda v:True,
"negative": False,
"included_in_lootbox": False,
},
}
def AWARDS_ENABLED():
return {k: v for k, v in AWARDS.items() if v["enabled"]}
def AWARDS_ENABLED(v):
return {k: val for k, val in AWARDS.items() if val["enabled"](v)}
LOOTBOX_ITEM_COUNT = 5
HOUSE_AWARDS = {
"Furry": {
"kind": "Furry",
"title": "OwOify",
"description": "OwOifies the recipient's posts and comments for 6 hours.",
"icon": "fas fa-paw-simple",
"color": "text-purple",
"price": 500,
"deflectable": True,
"cosmetic": False,
"ghost": False,
"negative": True,
"included_in_lootbox": False,
},
"Femboy": {
"kind": "Femboy",
"title": "Rainbow",
"description": "Makes the recipient's posts and comments in rainbow text for 24 hours.",
"icon": "fas fa-cloud-rainbow",
"color": "text-pink",
"price": 200,
"deflectable": True,
"cosmetic": False,
"ghost": False,
"negative": True,
"included_in_lootbox": False,
},
"Vampire": {
"kind": "Vampire",
"title": "Bite",
"description": "Turns the recipient into a vampire for 2 days.",
"icon": "fas fa-bat",
"color": "text-gray",
"price": 500,
"deflectable": True,
"cosmetic": False,
"ghost": False,
"negative": True,
"included_in_lootbox": False,
},
"Racist": {
"kind": "Racist",
"title": "Early Life",
"description": "Checks the recipient's Early Life section on Wikipedia. Notices.",
"icon": "fas fa-star-of-david",
"color": "text-yellow",
"price": 100,
"deflectable": True,
"cosmetic": False,
"ghost": False,
"negative": True,
"included_in_lootbox": False,
},
"Edgy": {
"kind": "Edgy",
"title": "Sharpen",
"description": "Adds a badass edge to all the recipient's posts and comments for 24 hours.",
"icon": "fas fa-fire",
"color": "text-danger",
"price": 200,
"deflectable": True,
"cosmetic": False,
"ghost": False,
"negative": True,
"included_in_lootbox": False,
},
}
temp = deepcopy(HOUSE_AWARDS).items()
for k, val in temp:
HOUSE_AWARDS[f'{k} Founder'] = val
HOUSE_AWARDS[f'{k} Founder']['kind'] += ' Founder'
HOUSE_AWARDS[f'{k} Founder']['price'] = int(HOUSE_AWARDS[f'{k} Founder']['price'] * 0.75)

View File

@ -33,10 +33,7 @@ def shop_awards(v):
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@auth_required
def shop(v):
AWARDS = deepcopy(AWARDS_ENABLED())
if v.house:
AWARDS[v.house] = deepcopy(HOUSE_AWARDS[v.house])
AWARDS = deepcopy(AWARDS_ENABLED(v))
for val in AWARDS.values(): val["owned"] = 0
@ -45,8 +42,6 @@ def shop(v):
for val in AWARDS.values():
val["baseprice"] = int(val["price"])
if val["kind"].endswith('Founder'):
val["baseprice"] = int(val["baseprice"] / 0.75)
val["price"] = int(val["price"] * v.award_discount)
sales = g.db.query(func.sum(User.currency_spent_on_awards)).scalar()
@ -91,7 +86,7 @@ def buy_awards(v, kind, AWARDS, quantity):
if kind == "lootbox":
lootbox_items = []
for _ in range(LOOTBOX_ITEM_COUNT*quantity): # five items per lootbox
LOOTBOX_CONTENTS = [x["kind"] for x in AWARDS_ENABLED().values() if x["included_in_lootbox"]]
LOOTBOX_CONTENTS = [x["kind"] for x in AWARDS_ENABLED(v).values() if x["included_in_lootbox"]]
lb_award = random.choice(LOOTBOX_CONTENTS)
lootbox_items.append(AWARDS[lb_award]['title'])
lb_award = AwardRelationship(user_id=v.id, kind=lb_award, price_paid=price // LOOTBOX_ITEM_COUNT)
@ -130,10 +125,7 @@ def buy_awards(v, kind, AWARDS, quantity):
@limiter.limit("100/minute;200/hour;1000/day", deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@auth_required
def buy(v, kind):
AWARDS = deepcopy(AWARDS_ENABLED())
if v.house:
AWARDS[v.house] = HOUSE_AWARDS[v.house]
AWARDS = deepcopy(AWARDS_ENABLED(v))
if kind not in AWARDS: abort(400)
@ -170,9 +162,7 @@ def award_thing(v, thing_type, id):
author = obj.author
AWARDS = deepcopy(AWARDS_ENABLED())
if v.house:
AWARDS[v.house] = HOUSE_AWARDS[v.house]
AWARDS = deepcopy(AWARDS_ENABLED(v))
if kind not in AWARDS:
abort(404, "This award doesn't exist.")
@ -200,7 +190,7 @@ def award_thing(v, thing_type, id):
if v.shadowbanned:
return {"message": f"{quantity} {award_title} award{s} given to {thing_type} successfully!"}
if obj.is_longpost and kind in {"ectoplasm", "candycorn", "candycane", "stab", "glowie", "tilt", "queen", "chud", "marsify", "Furry", "Edgy", "Femboy", "Furry Founder", "Edgy Founder", "Femboy Founder"}:
if obj.is_longpost and kind in {"ectoplasm", "candycorn", "candycane", "stab", "glowie", "tilt", "queen", "chud", "marsify", "owoify", "sharpen", "rainbow"}:
abort(403, f'Long posts are protected from the {award_title} award!')
note = request.values.get("note", "").strip()
@ -436,18 +426,26 @@ def award_thing(v, thing_type, id):
author.house = "Vampire"
badge_grant(user=author, badge_id=168)
elif "Racist" in kind and kind == v.house:
elif kind == "earlylife":
if author.earlylife: author.earlylife += 86400 * quantity
else: author.earlylife = int(time.time()) + 86400 * quantity
badge_grant(user=author, badge_id=169)
elif ("Furry" in kind and kind == v.house):
elif kind == "shutitdown":
if not author.earlylife:
abort(400, f"{safe_username} is not under the effect of an Early Life award!")
author.earlylife -= 86400 * quantity
if author.earlylife <= time.time():
author.earlylife = 0
badge = author.has_badge(169)
if badge: g.db.delete(badge)
elif kind == "owoify":
if author.owoify: author.owoify += 21600 * quantity
else: author.owoify = int(time.time()) + 21600 * quantity
badge_grant(user=author, badge_id=167)
if can_alter_body:
alter_body(obj)
elif ("Edgy" in kind and kind == v.house):
elif kind == "sharpen":
if author.sharpen: author.sharpen += 86400 * quantity
else: author.sharpen = int(time.time()) + 86400 * quantity
badge_grant(user=author, badge_id=289)
@ -455,7 +453,7 @@ def award_thing(v, thing_type, id):
if can_alter_body:
obj.sharpened = True
alter_body(obj)
elif ("Femboy" in kind and kind == v.house):
elif kind == "rainbow":
if author.rainbow: author.rainbow += 86400 * quantity
else: author.rainbow = int(time.time()) + 86400 * quantity
badge_grant(user=author, badge_id=171)
@ -634,7 +632,7 @@ def award_thing(v, thing_type, id):
author.zombie = min(author.zombie, 10)
badge_grant(user=author, badge_id=182)
elif kind == "bite":
elif kind == "zombiebite":
for award in awards:
g.db.flush()
if author.zombie < 0:
@ -711,12 +709,12 @@ def trick_or_treat(v):
if result == 0:
message = "Trick!"
else:
choices = [x["kind"] for x in AWARDS_ENABLED().values() if x["included_in_lootbox"]]
choices = [x["kind"] for x in AWARDS_ENABLED(v).values() if x["included_in_lootbox"]]
award = random.choice(choices)
award_object = AwardRelationship(user_id=v.id, kind=award)
g.db.add(award_object)
award_title = AWARDS_ENABLED()[award]['title']
award_title = AWARDS_ENABLED(v)[award]['title']
message = f"Treat! You got a {award_title} award!"
return {"message": f"{message}", "result": f"{result}"}

View File

@ -0,0 +1,7 @@
UPDATE award_relationships SET kind='zombiebite' WHERE kind='bite';
UPDATE award_relationships SET kind='rainbow' WHERE kind like 'Femboy%';
UPDATE award_relationships SET kind='sharpen' WHERE kind like 'Edgy%';
UPDATE award_relationships SET kind='earlylife' WHERE kind like 'Racist%';
UPDATE award_relationships SET kind='owoify' WHERE kind like 'Furry%';
UPDATE award_relationships SET kind='bite' WHERE kind like 'Vampire%';