From 149a44cc765501e2ed2559f5db73aee544f45903 Mon Sep 17 00:00:00 2001 From: CounterFire2023 <136581895+CounterFire2023@users.noreply.github.com> Date: Sat, 13 Apr 2024 10:38:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=8A=B6=E6=80=81=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=A2=9E=E5=8A=A0=E8=BF=94=E5=9B=9E=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E8=8E=B7=E5=BE=97=E7=99=BD=E5=90=8D=E5=8D=95=E7=9A=84=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/chest.controller.ts | 20 ++++++++++++++------ src/models/ActivityUser.ts | 3 +++ 2 files changed, 17 insertions(+), 6 deletions(-) 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 /**