diff --git a/src/controllers/chest.controller.ts b/src/controllers/chest.controller.ts index 8db4955..74516d9 100644 --- a/src/controllers/chest.controller.ts +++ b/src/controllers/chest.controller.ts @@ -316,13 +316,21 @@ class BoxController extends BaseController { chest.status = ChestStatusEnum.OPENED const score = chest.scoreInit + chest.scoreBonus const dateTag = formatDate(new Date()) - let items = await generateChestBonus(chest) - if (!chest.items) { - chest.items = [] + let items: any[] = [] + if (!user.inWhiteList) { + items = await generateChestBonus(chest) + if (!chest.items) { + chest.items = [] + } + items.forEach(item => { + chest.items.push(item.id) + }) + if (items.find(item => item.type === 1)) { + user.inWhiteList = true + await user.save() + } } - items.forEach(item => { - chest.items.push(item.id) - }) + await updateRankScore({ user: user.id, score: score, diff --git a/src/models/ActivityUser.ts b/src/models/ActivityUser.ts index edd184c..9c17f0d 100644 --- a/src/models/ActivityUser.ts +++ b/src/models/ActivityUser.ts @@ -102,6 +102,9 @@ export class ActivityUserClass extends BaseModule { @prop() public discordName?: string + @prop({ default: false }) + public inWhiteList: boolean + @prop({ default: 1 }) public boost: number /**