寻宝:增加设置情谊助战的接口
This commit is contained in:
@@ -306,7 +306,9 @@ export class ComBattleHandler {
|
||||
return resResult(STATUS.COM_BATTLE_CE_LIMIT);
|
||||
}
|
||||
|
||||
isFrd = await getFrd(roleId, quality);
|
||||
if (!isFrd) {
|
||||
isFrd = await getFrd(roleId, quality);
|
||||
}
|
||||
// 加入队伍
|
||||
let roleStatus = new RoleStatus(roleId, roleName, false, isFrd, headHid, sHid, topFiveCe, lv);
|
||||
const team = await ComBattleTeamModel.addRole(teamCode, roleStatus);
|
||||
@@ -329,6 +331,33 @@ export class ComBattleHandler {
|
||||
return resResult(STATUS.SUCCESS, { teamInfo: teamStatus});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 设置是否情谊助战
|
||||
* @param {{teamCode: string, isFrd: boolean}} msg 队伍编号;情谊助战要设置的值,true 为情谊助战
|
||||
* @param {BackendSession} session
|
||||
* @returns
|
||||
* @memberof ComBattleHandler
|
||||
*/
|
||||
async setFrdAssistance(msg: {teamCode: string, isFrd: boolean}, session: BackendSession) {
|
||||
let roleId = session.get('roleId');
|
||||
let { isFrd, teamCode } = msg;
|
||||
const isFrdPre = isFrd;
|
||||
let teamStatus = this.teamMap.get(teamCode);
|
||||
if (!teamStatus || teamStatus.status !== COM_TEAM_STATUS.DEFAULT) return resResult(STATUS.COM_BATTLE_TEAM_INVALID);
|
||||
if (teamStatus.capId === roleId) return resResult(STATUS.COM_BATTLE_SET_FRD_ERR);
|
||||
if (!isFrd) {
|
||||
isFrd = await getFrd(roleId, teamStatus.quality);
|
||||
}
|
||||
if (isFrd !== isFrdPre) {
|
||||
return resResult(STATUS.COM_BATTLE_ASSIST_NOT_ENOUGH);
|
||||
}
|
||||
teamStatus.roleStatus.forEach(async st => {
|
||||
st.isFrd = isFrd;
|
||||
await ComBattleTeamModel.updateRoleStFrd(teamCode, roleId, isFrd);
|
||||
});
|
||||
return resResult(STATUS.SUCCESS, { teamCode, isFrd });
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取队伍列表-deprecated
|
||||
* @param msg
|
||||
|
||||
@@ -106,6 +106,7 @@ export const STATUS = {
|
||||
COM_BATTLE_REWARD_ERR: { code: 20627, simStr: '不能领取奖励' },
|
||||
COM_BATTLE_REWARDED: { code: 20628, simStr: '奖励已领取' },
|
||||
COM_BATTLE_HEROES_ERR: { code: 20629, simStr: '阵容异常' },
|
||||
COM_BATTLE_SET_FRD_ERR: { code: 20630, simStr: '设置情谊助战异常' },
|
||||
|
||||
// 共斗藏宝图合成
|
||||
COM_BLUEPRT_QUALITY_CANNOT_COMPOSE: { code: 20630, simStr: '该品质藏宝图不可合成' },
|
||||
|
||||
@@ -144,6 +144,11 @@ export default class ComBattleTeam extends BaseModel {
|
||||
return team;
|
||||
}
|
||||
|
||||
public static async updateRoleStFrd(teamCode: string, roleId: string, isFrd: boolean, lean = true) {
|
||||
const team: ComBattleTeamType = await ComBattleTeamModel.findOneAndUpdate({ teamCode, 'roleStatus.roleId': roleId }, { $set: {'roleStatus.$.isFrd': isFrd}}, {new: true}).lean(lean);
|
||||
return team;
|
||||
}
|
||||
|
||||
public static async removeTeam(teamCode: string, lean = true) {
|
||||
const team: ComBattleTeamType = await ComBattleTeamModel.findOneAndDelete({ teamCode }).lean(lean);
|
||||
return team;
|
||||
|
||||
Reference in New Issue
Block a user