寻宝:增加倒计时
This commit is contained in:
@@ -22,7 +22,7 @@ import { addUserToChannel, getSimpleRoleInfo } from '../../../services/roleServi
|
|||||||
import { ChannelUser } from '../../../domain/ChannelUser';
|
import { ChannelUser } from '../../../domain/ChannelUser';
|
||||||
import { pushComBtlTeamMsg, pushFriendTeamInviteMsg, pushNormalItemMsg, pushTeamInviteMsg } from '../../../services/chatService';
|
import { pushComBtlTeamMsg, pushFriendTeamInviteMsg, pushNormalItemMsg, pushTeamInviteMsg } from '../../../services/chatService';
|
||||||
import { EXTERIOR } from '../../../pubUtils/dicParam';
|
import { EXTERIOR } from '../../../pubUtils/dicParam';
|
||||||
import { getZeroPointD, getTimeFunD } from '../../../pubUtils/timeUtil';
|
import { getZeroPointD, getTimeFunD, getSeconds, nowSeconds } from '../../../pubUtils/timeUtil';
|
||||||
import { FriendParams } from '../../../domain/roleField/friend';
|
import { FriendParams } from '../../../domain/roleField/friend';
|
||||||
import { checkTask, checkTaskWithGoods } from '../../../services/taskService';
|
import { checkTask, checkTaskWithGoods } from '../../../services/taskService';
|
||||||
import { gameData, getWarByBlueprtId } from '../../../pubUtils/data';
|
import { gameData, getWarByBlueprtId } from '../../../pubUtils/data';
|
||||||
@@ -427,6 +427,7 @@ export class ComBattleHandler {
|
|||||||
if (teamStatus.status !== COM_TEAM_STATUS.DEFAULT) return resResult(STATUS.COM_BATTLE_ALREADY_START);
|
if (teamStatus.status !== COM_TEAM_STATUS.DEFAULT) return resResult(STATUS.COM_BATTLE_ALREADY_START);
|
||||||
|
|
||||||
teamStatus.status = COM_TEAM_STATUS.FIGHTING;
|
teamStatus.status = COM_TEAM_STATUS.FIGHTING;
|
||||||
|
teamStatus.endTime = nowSeconds() + COM_BTL_CONST.BTL_TIME_LMT/1000;
|
||||||
|
|
||||||
let team = await ComBattleTeamModel.updateStatusByCode(teamCode, COM_TEAM_STATUS.FIGHTING);
|
let team = await ComBattleTeamModel.updateStatusByCode(teamCode, COM_TEAM_STATUS.FIGHTING);
|
||||||
if (!team) return resResult(STATUS.COM_BATTLE_START_ERR);
|
if (!team) return resResult(STATUS.COM_BATTLE_START_ERR);
|
||||||
@@ -603,16 +604,16 @@ export class ComBattleHandler {
|
|||||||
|
|
||||||
async getComBtlStatus(msg: {teamCode: string}, session: BackendSession) {
|
async getComBtlStatus(msg: {teamCode: string}, session: BackendSession) {
|
||||||
let { teamCode } = msg;
|
let { teamCode } = msg;
|
||||||
let roleStatus: RoleStatus[], status: number, bossHpArr: BossHp[], timeout: boolean;
|
let roleStatus: RoleStatus[], status: number, bossHpArr: BossHp[], timeout: boolean, endTime = 0;
|
||||||
let memTeam = this.teamMap.get(teamCode);
|
let memTeam = this.teamMap.get(teamCode);
|
||||||
if (memTeam) {
|
if (memTeam) {
|
||||||
({ roleStatus, status, bossHpArr, timeout } = memTeam);
|
({ roleStatus, status, bossHpArr, timeout, endTime } = memTeam);
|
||||||
} else {
|
} else {
|
||||||
let dbTeam = await ComBattleTeamModel.getTeamByCode(teamCode);
|
let dbTeam = await ComBattleTeamModel.getTeamByCode(teamCode);
|
||||||
if (!dbTeam) return resResult(STATUS.COM_BATTLE_TEAM_INVALID);
|
if (!dbTeam) return resResult(STATUS.COM_BATTLE_TEAM_INVALID);
|
||||||
({ roleStatus, status, bossHpArr, timeout } = dbTeam);
|
({ roleStatus, status, bossHpArr, timeout, endTime } = dbTeam);
|
||||||
}
|
}
|
||||||
return resResult(STATUS.SUCCESS, { teamInfo: {status, teamCode, roleStatus, bossHpArr, timeout} });
|
return resResult(STATUS.SUCCESS, { teamInfo: {status, teamCode, roleStatus, bossHpArr, timeout, endTime} });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import { checkActivityTask, checkTaskInComBattleEnd } from './taskService';
|
|||||||
import { getRewardByBlueprtId, gameData, getBossHpByBlueprtId } from '../pubUtils/data';
|
import { getRewardByBlueprtId, gameData, getBossHpByBlueprtId } from '../pubUtils/data';
|
||||||
import { getFriendPointObject } from '../pubUtils/itemUtils';
|
import { getFriendPointObject } from '../pubUtils/itemUtils';
|
||||||
import { DicWar } from '../pubUtils/dictionary/DicWar';
|
import { DicWar } from '../pubUtils/dictionary/DicWar';
|
||||||
import { getZeroPointD } from '../pubUtils/timeUtil';
|
import { getZeroPointD, nowSeconds } from '../pubUtils/timeUtil';
|
||||||
import { dispatch } from '../pubUtils/dispatcher';
|
import { dispatch } from '../pubUtils/dispatcher';
|
||||||
import { handleCost } from './rewardService';
|
import { handleCost } from './rewardService';
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ export async function handleComBtlProgress(teamStatus: MemComBtlTeam, robotHurtT
|
|||||||
st.fixReward = await getRealReward(teamStatus.blueprtId, st);
|
st.fixReward = await getRealReward(teamStatus.blueprtId, st);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
let team = await ComBattleTeamModel.syncTeamData({ teamCode, status: battleSt, roleStatus: teamStatus.roleStatus, bossHpArr: teamStatus.bossHpArr });
|
let team = await ComBattleTeamModel.syncTeamData({ teamCode, status: battleSt, roleStatus: teamStatus.roleStatus, bossHpArr: teamStatus.bossHpArr, endTime: teamStatus.endTime });
|
||||||
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
if (!team) return resResult(STATUS.COM_BATTLE_RESULT_ERR);
|
||||||
|
|
||||||
// 战斗胜利队长扣减藏宝图
|
// 战斗胜利队长扣减藏宝图
|
||||||
|
|||||||
@@ -181,6 +181,10 @@ export default class ComBattleTeam extends BaseModel {
|
|||||||
// 黑名单
|
// 黑名单
|
||||||
blacklist: string[] = [];
|
blacklist: string[] = [];
|
||||||
|
|
||||||
|
// 黑名单
|
||||||
|
@prop({ required: true, default: 0 })
|
||||||
|
endTime: number = 0;
|
||||||
|
|
||||||
public static async createTeam(teamData: ComBattleTeamParam, lean = true) {
|
public static async createTeam(teamData: ComBattleTeamParam, lean = true) {
|
||||||
const team: ComBattleTeamType = await ComBattleTeamModel.findOneAndUpdate({ teamCode: teamData.teamCode }, {$set :{...teamData, roleCnt: teamData.roleIds.length}}, {upsert: true, new: true}).lean(lean);
|
const team: ComBattleTeamType = await ComBattleTeamModel.findOneAndUpdate({ teamCode: teamData.teamCode }, {$set :{...teamData, roleCnt: teamData.roleIds.length}}, {upsert: true, new: true}).lean(lean);
|
||||||
return team;
|
return team;
|
||||||
@@ -226,7 +230,7 @@ export default class ComBattleTeam extends BaseModel {
|
|||||||
return team;
|
return team;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async syncTeamData(teamData: {teamCode: string, status: number, roleStatus: RoleStatus[], bossHpArr: BossHp[]}, timeout = false, lean = true) {
|
public static async syncTeamData(teamData: {teamCode: string, status: number, roleStatus: RoleStatus[], bossHpArr: BossHp[], endTime?: number}, timeout = false, lean = true) {
|
||||||
console.log('syncTeamData bossHpArr: ', teamData.bossHpArr);
|
console.log('syncTeamData bossHpArr: ', teamData.bossHpArr);
|
||||||
const team: ComBattleTeamType = await ComBattleTeamModel.findOneAndUpdate({ teamCode: teamData.teamCode }, {$set :{...teamData, roleCnt: teamData.roleStatus.length, timeout}}, {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;
|
return team;
|
||||||
|
|||||||
Reference in New Issue
Block a user