forked from rDrama/rDrama
add lootboxes
parent
2028216c45
commit
29fa5bcf4d
|
@ -135,10 +135,13 @@ function buy(mb) {
|
||||||
success = xhr[0].status >= 200 && xhr[0].status < 300;
|
success = xhr[0].status >= 200 && xhr[0].status < 300;
|
||||||
showToast(success, getMessageFromJsonData(success, data), true);
|
showToast(success, getMessageFromJsonData(success, data), true);
|
||||||
if (success) {
|
if (success) {
|
||||||
document.getElementById('giveaward').disabled=false;
|
if (kind != "lootbox")
|
||||||
let owned = document.getElementById(`${kind}-owned`)
|
{
|
||||||
let ownednum = Number(owned.textContent) + 1;
|
document.getElementById('giveaward').disabled=false;
|
||||||
owned.textContent = ownednum
|
let owned = document.getElementById(`${kind}-owned`)
|
||||||
|
let ownednum = Number(owned.textContent) + 1;
|
||||||
|
owned.textContent = ownednum
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
|
||||||
from files.helpers.config.const import FEATURES, SITE_NAME, patron
|
from files.helpers.config.const import FEATURES, SITE_NAME, patron, HOLIDAY_EVENT
|
||||||
|
|
||||||
AWARDS = {
|
AWARDS = {
|
||||||
"fallback": {
|
"fallback": {
|
||||||
|
@ -676,7 +676,12 @@ AWARDS_DISABLED = [
|
||||||
]
|
]
|
||||||
|
|
||||||
LOOTBOX_ITEM_COUNT = 5
|
LOOTBOX_ITEM_COUNT = 5
|
||||||
LOOTBOX_CONTENTS = ["firework", "confetti", "ricardo", "wholesome", "shit", "fireflies", "scooter", "train"]
|
|
||||||
|
if HOLIDAY_EVENT:
|
||||||
|
LOOTBOX_CONTENTS = ["snow", "gingerbread", "lights", "candycane", "fireplace", "frostbite"]
|
||||||
|
AWARDS_DISABLED.remove('lootbox')
|
||||||
|
else:
|
||||||
|
LOOTBOX_CONTENTS = ["firework", "confetti", "ricardo", "wholesome", "shit", "fireflies", "scooter", "train"]
|
||||||
|
|
||||||
HOUSE_AWARDS = {
|
HOUSE_AWARDS = {
|
||||||
"Furry": {
|
"Furry": {
|
||||||
|
|
|
@ -111,6 +111,7 @@ def buy(v:User, award):
|
||||||
elif v.lootboxes_bought == 150:
|
elif v.lootboxes_bought == 150:
|
||||||
badge_grant(badge_id=78, user=v)
|
badge_grant(badge_id=78, user=v)
|
||||||
|
|
||||||
|
return {"message": lootbox_msg}
|
||||||
else:
|
else:
|
||||||
award_object = AwardRelationship(user_id=v.id, kind=award, price_paid=price)
|
award_object = AwardRelationship(user_id=v.id, kind=award, price_paid=price)
|
||||||
g.db.add(award_object)
|
g.db.add(award_object)
|
||||||
|
@ -128,6 +129,8 @@ def buy(v:User, award):
|
||||||
@is_not_permabanned
|
@is_not_permabanned
|
||||||
@ratelimit_user()
|
@ratelimit_user()
|
||||||
def award_thing(v, thing_type, id):
|
def award_thing(v, thing_type, id):
|
||||||
|
kind = request.values.get("kind", "").strip()
|
||||||
|
|
||||||
if thing_type == 'post':
|
if thing_type == 'post':
|
||||||
thing = get_post(id)
|
thing = get_post(id)
|
||||||
else:
|
else:
|
||||||
|
@ -137,9 +140,7 @@ def award_thing(v, thing_type, id):
|
||||||
if v.shadowbanned: abort(500)
|
if v.shadowbanned: abort(500)
|
||||||
author = thing.author
|
author = thing.author
|
||||||
if author.shadowbanned: abort(404)
|
if author.shadowbanned: abort(404)
|
||||||
|
|
||||||
kind = request.values.get("kind", "").strip()
|
|
||||||
|
|
||||||
AWARDS = deepcopy(AWARDS_ENABLED)
|
AWARDS = deepcopy(AWARDS_ENABLED)
|
||||||
if v.house:
|
if v.house:
|
||||||
AWARDS[v.house] = HOUSE_AWARDS[v.house]
|
AWARDS[v.house] = HOUSE_AWARDS[v.house]
|
||||||
|
|
Loading…
Reference in New Issue