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;
|
||||
showToast(success, getMessageFromJsonData(success, data), true);
|
||||
if (success) {
|
||||
document.getElementById('giveaward').disabled=false;
|
||||
let owned = document.getElementById(`${kind}-owned`)
|
||||
let ownednum = Number(owned.textContent) + 1;
|
||||
owned.textContent = ownednum
|
||||
if (kind != "lootbox")
|
||||
{
|
||||
document.getElementById('giveaward').disabled=false;
|
||||
let owned = document.getElementById(`${kind}-owned`)
|
||||
let ownednum = Number(owned.textContent) + 1;
|
||||
owned.textContent = ownednum
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
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 = {
|
||||
"fallback": {
|
||||
|
@ -676,7 +676,12 @@ AWARDS_DISABLED = [
|
|||
]
|
||||
|
||||
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 = {
|
||||
"Furry": {
|
||||
|
|
|
@ -111,6 +111,7 @@ def buy(v:User, award):
|
|||
elif v.lootboxes_bought == 150:
|
||||
badge_grant(badge_id=78, user=v)
|
||||
|
||||
return {"message": lootbox_msg}
|
||||
else:
|
||||
award_object = AwardRelationship(user_id=v.id, kind=award, price_paid=price)
|
||||
g.db.add(award_object)
|
||||
|
@ -128,6 +129,8 @@ def buy(v:User, award):
|
|||
@is_not_permabanned
|
||||
@ratelimit_user()
|
||||
def award_thing(v, thing_type, id):
|
||||
kind = request.values.get("kind", "").strip()
|
||||
|
||||
if thing_type == 'post':
|
||||
thing = get_post(id)
|
||||
else:
|
||||
|
@ -138,8 +141,6 @@ def award_thing(v, thing_type, id):
|
|||
author = thing.author
|
||||
if author.shadowbanned: abort(404)
|
||||
|
||||
kind = request.values.get("kind", "").strip()
|
||||
|
||||
AWARDS = deepcopy(AWARDS_ENABLED)
|
||||
if v.house:
|
||||
AWARDS[v.house] = HOUSE_AWARDS[v.house]
|
||||
|
|
Loading…
Reference in New Issue