寻宝:加入超时标识
This commit is contained in:
@@ -56,6 +56,8 @@ class ComTeam {
|
||||
roleCnt: number;
|
||||
// 藏宝图等级所处范围,用来匹配
|
||||
lvRange: number;
|
||||
// 队伍是否开放加入
|
||||
timeout: boolean;
|
||||
constructor(teamCode: string, pub: boolean, blueprtId: number, status: number, capId: string, ceLimit: number, bossHp: number, quality: number, bossHpArr:Array<BossHp> ) {
|
||||
this.teamCode = teamCode;
|
||||
this.pub = pub;
|
||||
@@ -69,6 +71,7 @@ class ComTeam {
|
||||
this.bossHpArr = bossHpArr;
|
||||
this.curRnd = 0;
|
||||
this.roleCnt = 1;
|
||||
this.timeout = false;
|
||||
let { lvLimited } = getGoodById(blueprtId);
|
||||
this.lvRange = comBtlRangeByLv(lvLimited);
|
||||
}
|
||||
@@ -542,9 +545,9 @@ export class ComBattleHandler {
|
||||
clearRobotHurtTimer(teamStatus, this.robotHurtTimer);
|
||||
let channelService = thiz.app.get('channelService');
|
||||
let channel = channelService.getChannel(teamCode, false);
|
||||
let team = await ComBattleTeamModel.syncTeamData({teamCode, status: COM_TEAM_STATUS.LOOSE, roleStatus: teamStatus.roleStatus, bossHpArr: teamStatus.bossHpArr});
|
||||
let team = await ComBattleTeamModel.syncTeamData({teamCode, status: COM_TEAM_STATUS.LOOSE, roleStatus: teamStatus.roleStatus, bossHpArr: teamStatus.bossHpArr}, true);
|
||||
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
||||
channel.pushMessage('onTeamComplete', resResult(STATUS.SUCCESS, {teamCode, result: false}));
|
||||
channel.pushMessage('onTeamComplete', resResult(STATUS.SUCCESS, {teamCode, result: false, timeout: true}));
|
||||
thiz.teamMap.delete(teamCode);
|
||||
}
|
||||
}, COM_BTL_CONST.BTL_TIME_LMT);
|
||||
@@ -702,16 +705,16 @@ export class ComBattleHandler {
|
||||
|
||||
async getComBtlStatus(msg: {teamCode: string}, session: BackendSession) {
|
||||
let { teamCode } = msg;
|
||||
let roleStatus, status, bossHpArr;
|
||||
let roleStatus, status, bossHpArr, timeout;
|
||||
let memTeam = this.teamMap.get(teamCode);
|
||||
if (memTeam) {
|
||||
({ roleStatus, status, bossHpArr } = memTeam);
|
||||
({ roleStatus, status, bossHpArr, timeout } = memTeam);
|
||||
} else {
|
||||
let dbTeam = await ComBattleTeamModel.getTeamByCode(teamCode);
|
||||
if (!dbTeam) return resResult(STATUS.COM_BATTLE_TEAM_INVALID);
|
||||
({ roleStatus, status, bossHpArr } = dbTeam);
|
||||
({ roleStatus, status, bossHpArr, timeout } = dbTeam);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, { teamInfo: {status, teamCode, roleStatus, bossHpArr} });
|
||||
return resResult(STATUS.SUCCESS, { teamInfo: {status, teamCode, roleStatus, bossHpArr, timeout} });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -129,6 +129,10 @@ export default class ComBattleTeam extends BaseModel {
|
||||
@prop({ required: false, type: BossHp, default: [] })
|
||||
bossHpArr: Array<BossHp>;
|
||||
|
||||
// 队伍是否开放加入
|
||||
@prop({ required: true, default: false })
|
||||
timeout: boolean;
|
||||
|
||||
public static async createTeam(teamData: {teamCode: string, roleIds: Array<string>, pub: boolean, blueprtId: number, quality: number, status: number, roleStatus: Array<RoleStatus>, capId: string, ceLimit: number}, lean = true) {
|
||||
const team: ComBattleTeamType = await ComBattleTeamModel.findOneAndUpdate({ teamCode: teamData.teamCode }, {$set :{...teamData, roleCnt: teamData.roleIds.length}}, {upsert: true, new: true}).lean(lean);
|
||||
return team;
|
||||
@@ -169,9 +173,9 @@ export default class ComBattleTeam extends BaseModel {
|
||||
return team;
|
||||
}
|
||||
|
||||
public static async syncTeamData(teamData: {teamCode: string, status: number, roleStatus: Array<RoleStatus>, bossHpArr: Array<BossHp>}, lean = true) {
|
||||
public static async syncTeamData(teamData: {teamCode: string, status: number, roleStatus: Array<RoleStatus>, bossHpArr: Array<BossHp>}, timeout = false, lean = true) {
|
||||
console.log('syncTeamData bossHpArr: ', teamData.bossHpArr);
|
||||
const team: ComBattleTeamType = await ComBattleTeamModel.findOneAndUpdate({ teamCode: teamData.teamCode }, {$set :{...teamData, roleCnt: teamData.roleStatus.length}}, {new: true}).lean(lean);
|
||||
const team: ComBattleTeamType = await ComBattleTeamModel.findOneAndUpdate({ teamCode: teamData.teamCode }, {$set :{...teamData, roleCnt: teamData.roleStatus.length, timeout}}, {new: true}).lean(lean);
|
||||
return team;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user