演武台:结构修改
This commit is contained in:
@@ -218,11 +218,10 @@ export enum GUILD_REC_TYPE {
|
||||
IMPEACH = 11, // 弹劾 roleName roleName
|
||||
}
|
||||
|
||||
//1:等待团长开启,2:boss已通关,3:开启中
|
||||
export enum GUILD_BOSS_STATUS {
|
||||
WAIT_OPEN = 1,
|
||||
CLEAR = 2,
|
||||
OPEN = 3,//开启中
|
||||
WAIT_OPEN = 0, // 等待开启
|
||||
OPEN = 1, // 开启中
|
||||
CLEAR = 2 // 已挑战完成
|
||||
}
|
||||
|
||||
export const GUILD_REPORT_NUM = 40;
|
||||
|
||||
@@ -44,9 +44,6 @@ export default class BossInstance extends BaseModel {
|
||||
@prop({ required: true, default: 0 })
|
||||
encourageCnt: number; // 鼓舞次数
|
||||
|
||||
@prop({ required: true, default:[], type: String, _id: false})
|
||||
roleIdRecords: Array<string>; //记录提示过胜利boss关的玩家
|
||||
|
||||
@prop({ required: true, default: GUILD_BOSS_STATUS.OPEN })
|
||||
status: GUILD_BOSS_STATUS; // 状态 1:等待团长开启,2:今日已开启,且boss通关,3:开启中
|
||||
|
||||
@@ -74,12 +71,6 @@ export default class BossInstance extends BaseModel {
|
||||
return bossInstance;
|
||||
}
|
||||
|
||||
//记录玩家boss通关后首次查看boss关卡
|
||||
public static async recordRoleIdWhenCheck(code: string, roleId: string, lean = true) {
|
||||
const bossInstance: BossInstanceType = await BossInstanceModel.findOneAndUpdate({ code }, { $push:{ roleIdRecords: roleId } }, { new: true }).lean(lean);
|
||||
return bossInstance;
|
||||
}
|
||||
|
||||
public static async pushRecordRanks(code: string, recordRank: Rank, lean = true) {
|
||||
const bossInstance: BossInstanceType = await BossInstanceModel.findOneAndUpdate({ code }, { $push:{ recordRanks: recordRank } }, { new: true }).lean(lean);
|
||||
return bossInstance;
|
||||
@@ -95,11 +86,15 @@ export default class BossInstance extends BaseModel {
|
||||
return bossInstance;
|
||||
}
|
||||
|
||||
public static async updateBossHp(code: string, hp: number, roleId: string, lean = true) {
|
||||
const bossInstance: BossInstanceType = await BossInstanceModel.findOneAndUpdate({ code, 'ranks.roleId': roleId, bossHp: { $gte: hp } }, { $inc: { bossHp: - hp ,'ranks.$.score': hp}, }, { new: true }).lean(lean);
|
||||
public static async updateBossHp(code: string, hp: number, roleId: string) {
|
||||
let bossInstance: BossInstanceType = await BossInstanceModel.findOneAndUpdate({ code, 'ranks.roleId': roleId, bossHp: { $gt: 0 } }, { $inc: { bossHp: - hp ,'ranks.$.score': hp}, }, { new: true }).lean();
|
||||
return bossInstance;
|
||||
}
|
||||
|
||||
public static async clearBoss(code: string, bossHp: number, roleId: string) {
|
||||
let bossInstance: BossInstanceType = await BossInstanceModel.findOneAndUpdate({ code, 'ranks.roleId': roleId }, { $set: { bossHp: 0, killTime: nowSeconds(), status: GUILD_BOSS_STATUS.CLEAR }, $inc: { 'ranks.$.score': bossHp}, }, { new: true }).lean();
|
||||
return bossInstance;
|
||||
}
|
||||
public static async updateRank(code: string, roleId: string, lean = true) {
|
||||
const bossInstance: BossInstanceType = await BossInstanceModel.findOneAndUpdate({ code, 'ranks.roleId': roleId }, { $set:{ 'ranks.$.time': nowSeconds() } }, { new: true }).lean(lean);
|
||||
return bossInstance;
|
||||
|
||||
Reference in New Issue
Block a user