boss等级

This commit is contained in:
mamengke01
2021-01-27 15:13:38 +08:00
parent 978c73fd95
commit 1b9cc31d73
3 changed files with 14 additions and 10 deletions

View File

@@ -22,6 +22,9 @@ export default class BossInstance extends BaseModel {
@prop({ required: true })
bossHp: number;
@prop({ required: true })
bossLv: number;
@prop({ required: true, type: Rank, default:[]})
ranks:Array<Rank>;
@@ -48,13 +51,14 @@ export default class BossInstance extends BaseModel {
@prop({ required: true, default: false })
winSettled: boolean; //胜利是否结算过
public static async findBossInstance(guildCode: string, lean = true) {
const bossInstance: BossInstanceType = await BossInstanceModel.findOne({ guildCode }).lean(lean);
return bossInstance;
}
public static async openBossInstance(guildCode: string, bossHp: number, warId: number, lean = true) {
const bossInstance: BossInstanceType = await BossInstanceModel.findOneAndUpdate({ guildCode },{ranks:[], time: nowSeconds(), bossHp, warId, $inc: { recordNum: 1 }}, {new: true, upsert: true}).lean(lean);
public static async openBossInstance(guildCode: string, bossHp: number, warId: number, bossLv: number, lean = true) {
const bossInstance: BossInstanceType = await BossInstanceModel.findOneAndUpdate({ guildCode },{ranks:[], time: nowSeconds(), bossHp, bossLv, warId, $inc: { recordNum: 1 }}, {new: true, upsert: true}).lean(lean);
return bossInstance;
}
//记录玩家boss通关后首次查看boss关卡