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": { "ghost": {
"kind": "ghost", "kind": "ghost",
"title": "Ghost", "title": "Ghost",
"description": "???", "description": "",
"icon": "fas fa-ghost", "icon": "fas fa-ghost",
"color": "text-white", "color": "text-white",
"price": 3000 "price": 3000
@ -288,7 +288,7 @@ AWARDS = {
"nword": { "nword": {
"kind": "nword", "kind": "nword",
"title": "Nword Pass", "title": "Nword Pass",
"description": "???", "description": "",
"icon": "fas fa-edit", "icon": "fas fa-edit",
"color": "text-success", "color": "text-success",
"price": 10000 "price": 10000
@ -296,7 +296,7 @@ AWARDS = {
"snow": { "snow": {
"kind": "snow", "kind": "snow",
"title": "Snow", "title": "Snow",
"description": "???", "description": "",
"icon": "fas fa-snowflake", "icon": "fas fa-snowflake",
"color": "text-blue-200", "color": "text-blue-200",
"price": 300 "price": 300
@ -304,7 +304,7 @@ AWARDS = {
"gingerbread": { "gingerbread": {
"kind": "gingerbread", "kind": "gingerbread",
"title": "Gingerbread", "title": "Gingerbread",
"description": "???", "description": "",
"icon": "fas fa-gingerbread-man", "icon": "fas fa-gingerbread-man",
"color": "", "color": "",
"price": 300 "price": 300
@ -312,7 +312,7 @@ AWARDS = {
"lights": { "lights": {
"kind": "lights", "kind": "lights",
"title": "Lights", "title": "Lights",
"description": "???", "description": "",
"icon": "fas fa-lights-holiday", "icon": "fas fa-lights-holiday",
"color": "", "color": "",
"price": 300 "price": 300
@ -320,7 +320,7 @@ AWARDS = {
"candycane": { "candycane": {
"kind": "candycane", "kind": "candycane",
"title": "Candy Cane", "title": "Candy Cane",
"description": "???", "description": "",
"icon": "fas fa-candy-cane", "icon": "fas fa-candy-cane",
"color": "", "color": "",
"price": 400 "price": 400
@ -328,7 +328,7 @@ AWARDS = {
"fireplace": { "fireplace": {
"kind": "fireplace", "kind": "fireplace",
"title": "Fireplace", "title": "Fireplace",
"description": "???", "description": "",
"icon": "fas fa-fireplace", "icon": "fas fa-fireplace",
"color": "", "color": "",
"price": 600 "price": 600
@ -336,7 +336,7 @@ AWARDS = {
"grinch": { "grinch": {
"kind": "grinch", "kind": "grinch",
"title": "Grinch", "title": "Grinch",
"description": "???", "description": "",
"icon": "fas fa-angry", "icon": "fas fa-angry",
"color": "text-green-500", "color": "text-green-500",
"price": 1000 "price": 1000
@ -344,7 +344,7 @@ AWARDS = {
"haunt": { "haunt": {
"kind": "haunt", "kind": "haunt",
"title": "Haunt", "title": "Haunt",
"description": "???", "description": "",
"icon": "fas fa-book-dead", "icon": "fas fa-book-dead",
"color": "text-warning", "color": "text-warning",
"price": 500 "price": 500
@ -352,7 +352,7 @@ AWARDS = {
"upsidedown": { "upsidedown": {
"kind": "upsidedown", "kind": "upsidedown",
"title": "The Upside Down", "title": "The Upside Down",
"description": "???", "description": "",
"icon": "fas fa-lights-holiday", "icon": "fas fa-lights-holiday",
"color": "", "color": "",
"price": 400 "price": 400
@ -360,7 +360,7 @@ AWARDS = {
"stab": { "stab": {
"kind": "stab", "kind": "stab",
"title": "Stab", "title": "Stab",
"description": "???", "description": "",
"icon": "fas fa-knife-kitchen", "icon": "fas fa-knife-kitchen",
"color": "text-danger", "color": "text-danger",
"price": 300 "price": 300
@ -368,7 +368,7 @@ AWARDS = {
"spiders": { "spiders": {
"kind": "spiders", "kind": "spiders",
"title": "Spiders", "title": "Spiders",
"description": "???", "description": "",
"icon": "fas fa-spider", "icon": "fas fa-spider",
"color": "text-black", "color": "text-black",
"price": 200 "price": 200
@ -376,17 +376,17 @@ AWARDS = {
"fog": { "fog": {
"kind": "fog", "kind": "fog",
"title": "Fog", "title": "Fog",
"description": "???", "description": "",
"icon": "fas fa-smoke", "icon": "fas fa-smoke",
"color": "text-gray", "color": "text-gray",
"price": 200 "price": 200
}, },
"lootbox": { "lootbox": {
"kind": "lootbox", "kind": "lootbox",
"title": "Lootstocking", "title": "Lootbox",
"description": "???", "description": "???",
"icon": "fas fa-stocking", "icon": "fas fa-box-open",
"color": "text-danger", "color": "text-blue",
"price": 1000 "price": 1000
}, },
"shit": { "shit": {
@ -670,7 +670,7 @@ if SITE_NAME == 'PCM':
AWARDS2 = deepcopy(AWARDS) AWARDS2 = deepcopy(AWARDS)
for k, val in AWARDS.items(): 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) 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}") 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) g.db.add(v)
if award == "lootbox": 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]: 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) award = AwardRelationship(user_id=v.id, kind=award)
g.db.add(award) g.db.add(award)
g.db.flush() g.db.flush()
v.lootboxes_bought += 1 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): if v.lootboxes_bought == 10 and not v.has_badge(76):
new_badge = Badge(badge_id=76, user_id=v.id) new_badge = Badge(badge_id=76, user_id=v.id)
g.db.add(new_badge) g.db.add(new_badge)