Lootboxes: re-enable for birthgay, improve.

Re-enable lootboxes in const.py, and update their contents in
awards.py. Additionally, improve appearance in shop.

Upon purchasing a lootbox, users now receive a message informing
them of the contents thereof.

Lootbox backend now properly uses CARP_ID (and checks for the
existence thereof correctly).

Also, minor changes to how const.py whitelists awards.
master
Snakes 2022-05-17 22:10:04 -04:00
parent 8d6e542eaf
commit b51ab09b27
2 changed files with 26 additions and 20 deletions

View File

@ -280,7 +280,7 @@ AWARDS = {
"ghost": {
"kind": "ghost",
"title": "Ghost",
"description": "???",
"description": "",
"icon": "fas fa-ghost",
"color": "text-white",
"price": 3000
@ -288,7 +288,7 @@ AWARDS = {
"nword": {
"kind": "nword",
"title": "Nword Pass",
"description": "???",
"description": "",
"icon": "fas fa-edit",
"color": "text-success",
"price": 10000
@ -296,7 +296,7 @@ AWARDS = {
"snow": {
"kind": "snow",
"title": "Snow",
"description": "???",
"description": "",
"icon": "fas fa-snowflake",
"color": "text-blue-200",
"price": 300
@ -304,7 +304,7 @@ AWARDS = {
"gingerbread": {
"kind": "gingerbread",
"title": "Gingerbread",
"description": "???",
"description": "",
"icon": "fas fa-gingerbread-man",
"color": "",
"price": 300
@ -312,7 +312,7 @@ AWARDS = {
"lights": {
"kind": "lights",
"title": "Lights",
"description": "???",
"description": "",
"icon": "fas fa-lights-holiday",
"color": "",
"price": 300
@ -320,7 +320,7 @@ AWARDS = {
"candycane": {
"kind": "candycane",
"title": "Candy Cane",
"description": "???",
"description": "",
"icon": "fas fa-candy-cane",
"color": "",
"price": 400
@ -328,7 +328,7 @@ AWARDS = {
"fireplace": {
"kind": "fireplace",
"title": "Fireplace",
"description": "???",
"description": "",
"icon": "fas fa-fireplace",
"color": "",
"price": 600
@ -336,7 +336,7 @@ AWARDS = {
"grinch": {
"kind": "grinch",
"title": "Grinch",
"description": "???",
"description": "",
"icon": "fas fa-angry",
"color": "text-green-500",
"price": 1000
@ -344,7 +344,7 @@ AWARDS = {
"haunt": {
"kind": "haunt",
"title": "Haunt",
"description": "???",
"description": "",
"icon": "fas fa-book-dead",
"color": "text-warning",
"price": 500
@ -352,7 +352,7 @@ AWARDS = {
"upsidedown": {
"kind": "upsidedown",
"title": "The Upside Down",
"description": "???",
"description": "",
"icon": "fas fa-lights-holiday",
"color": "",
"price": 400
@ -360,7 +360,7 @@ AWARDS = {
"stab": {
"kind": "stab",
"title": "Stab",
"description": "???",
"description": "",
"icon": "fas fa-knife-kitchen",
"color": "text-danger",
"price": 300
@ -368,7 +368,7 @@ AWARDS = {
"spiders": {
"kind": "spiders",
"title": "Spiders",
"description": "???",
"description": "",
"icon": "fas fa-spider",
"color": "text-black",
"price": 200
@ -376,17 +376,17 @@ AWARDS = {
"fog": {
"kind": "fog",
"title": "Fog",
"description": "???",
"description": "",
"icon": "fas fa-smoke",
"color": "text-gray",
"price": 200
},
"lootbox": {
"kind": "lootbox",
"title": "Lootstocking",
"title": "Lootbox",
"description": "???",
"icon": "fas fa-stocking",
"color": "text-danger",
"icon": "fas fa-box-open",
"color": "text-blue",
"price": 1000
},
"shit": {
@ -670,7 +670,7 @@ if SITE_NAME == 'PCM':
AWARDS2 = deepcopy(AWARDS)
for k, val in AWARDS.items():
if val['description'] == '???' and not (k == 'ghost' and SITE_NAME == 'PCM'): AWARDS2.pop(k)
if val['description'] == '' and not (k == 'ghost' and SITE_NAME == 'PCM'): AWARDS2.pop(k)
if SITE == 'pcmemes.net' and k in ('ban','pizzashill','marsey','bird','grass','chud'): AWARDS2.pop(k)

View File

@ -81,15 +81,21 @@ def buy(v, award):
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
g.db.add(v)
if award == "lootbox":
send_repeatable_notification(995, f"@{v.username} bought a lootbox!")
if CARP_ID and v.id != CARP_ID:
send_repeatable_notification(CARP_ID, f"@{v.username} bought a lootbox!")
lootbox_items = []
for i in [1,2,3,4,5]:
award = random.choice(["snow", "gingerbread", "lights", "candycane", "fireplace"])
award = random.choice(["firework", "confetti", "ricardo", "wholesome", "shit", "fireflies", "scooter", "train"])
lootbox_items.append(AWARDS[award]['title'])
award = AwardRelationship(user_id=v.id, kind=award)
g.db.add(award)
g.db.flush()
v.lootboxes_bought += 1
lootbox_msg = "You open your lootbox and receive: " + ', '.join(lootbox_items)
send_repeatable_notification(v.id, lootbox_msg)
if v.lootboxes_bought == 10 and not v.has_badge(76):
new_badge = Badge(badge_id=76, user_id=v.id)
g.db.add(new_badge)