寻宝:修改匹配次数逻辑
This commit is contained in:
@@ -15,7 +15,7 @@ import { RoleStatus, ComBattleTeamModel, ComBattleTeamType, BossHp, ComRoleStatu
|
||||
import { ItemModel, ItemType } from '../../../db/Item';
|
||||
import { addItems, handleCost } from '../../../services/rewardService';
|
||||
import { checkRoleInQueue, rmRoleFromQueue, setTeamSearchReq } from '../../../services/redisService';
|
||||
import { getRandBlueprtId, clearComBtlTimer, getFrd, updateRobotHurtByTime, comBtlLvInvalid, clearRobotHurtTimer, setDismissTimer, dismissTeam, handleComBtlProgress, getComBattleFriendAdd, teammateInBlackList, blueprtIdValid, createComTeamData, hasEnoughBlueprt, addRoleToTeam, addRoleStToTeam, addValidSearchingRoles, validToJoin, addRobotsToTeam, addRobotsLater, teamIsFullToStart, oneTeamNotInBlack, getAllAssistCnt } from '../../../services/comBattleService';
|
||||
import { getRandBlueprtId, clearComBtlTimer, getFrd, updateRobotHurtByTime, comBtlLvInvalid, clearRobotHurtTimer, setDismissTimer, dismissTeam, handleComBtlProgress, getComBattleFriendAdd, teammateInBlackList, blueprtIdValid, createComTeamData, hasEnoughBlueprt, addRoleToTeam, addRoleStToTeam, addValidSearchingRoles, validToJoin, addRobotsToTeam, addRobotsLater, teamIsFullToStart, oneTeamNotInBlack, getAllAssistCnt, checkHasMyTeam } from '../../../services/comBattleService';
|
||||
import { setAp } from '../../../services/actionPointService';
|
||||
import { roleLevelup } from '../../../services/normalBattleService';
|
||||
import { addUserToChannel, getSimpleRoleInfo } from '../../../services/roleService';
|
||||
@@ -109,6 +109,10 @@ export class ComBattleHandler {
|
||||
const { lv } = roleInfo;
|
||||
let { topLineupCe = 1000 } = roleInfo;
|
||||
|
||||
if(await checkHasMyTeam(roleId)) {
|
||||
return resResult(STATUS.COM_BATTLE_IS_RUNNING);
|
||||
}
|
||||
|
||||
if (comBtlLvInvalid(lv, lvRange)) {
|
||||
return resResult(STATUS.COM_BATTLE_ASSIST_LV_NOT_ENOUGH);
|
||||
}
|
||||
|
||||
@@ -135,21 +135,36 @@ export class ComBattleRemote {
|
||||
}
|
||||
}
|
||||
|
||||
public async leaveFromBattle(roleId: string, teamCode: string ) {
|
||||
// public async leaveFromBattle(roleId: string, teamCode: string ) {
|
||||
// try {
|
||||
// let teamMap: Map<string, MemComBtlTeam> = this.app.get('teamMap');
|
||||
// if(teamMap && teamMap.has(teamCode)) {
|
||||
// let myTeam = teamMap.get(teamCode);
|
||||
// for(let roleStatus of myTeam.roleStatus) {
|
||||
// if(roleStatus.roleId == roleId) {
|
||||
// roleStatus.battleStatus = 2; // 自己失败了
|
||||
// }
|
||||
// }
|
||||
// let channelService = this.app.get('channelService');
|
||||
// let channel = channelService.getChannel(teamCode, false);
|
||||
|
||||
// await handleComBtlProgress(myTeam, this.app.get('robotHurtTimer'), teamMap, channel); // 结算
|
||||
// }
|
||||
// } catch(e) {
|
||||
// errlogger.error(`remote ${__filename} \n ${e.stack}`);
|
||||
// }
|
||||
// }
|
||||
|
||||
public async checkMyTeam(roleId: string ) {
|
||||
try {
|
||||
let teamMap: Map<string, MemComBtlTeam> = this.app.get('teamMap');
|
||||
if(teamMap && teamMap.has(teamCode)) {
|
||||
let myTeam = teamMap.get(teamCode);
|
||||
for(let roleStatus of myTeam.roleStatus) {
|
||||
if(roleStatus.roleId == roleId) {
|
||||
roleStatus.battleStatus = 2; // 自己失败了
|
||||
}
|
||||
let hasMyTeam = false;
|
||||
for(let [,team] of teamMap) {
|
||||
if(team.roleIds.indexOf(roleId) > -1) {
|
||||
hasMyTeam = true; break;
|
||||
}
|
||||
let channelService = this.app.get('channelService');
|
||||
let channel = channelService.getChannel(teamCode, false);
|
||||
|
||||
await handleComBtlProgress(myTeam, this.app.get('robotHurtTimer'), teamMap, channel); // 结算
|
||||
}
|
||||
return hasMyTeam
|
||||
} catch(e) {
|
||||
errlogger.error(`remote ${__filename} \n ${e.stack}`);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import { Rank } from '../../../services/rankService';
|
||||
import { checkTaskWithRole, } from '../../../services/taskService';
|
||||
import { pushData, everydayRefresh, kickUser } from '../../../services/connectorService';
|
||||
import { pick } from 'lodash';
|
||||
import { setComBtlOnUserLeave } from '../../../services/comBattleService';
|
||||
// import { setComBtlOnUserLeave } from '../../../services/comBattleService';
|
||||
import Counter from '../../../db/Counter';
|
||||
import { getExpByLv } from '../../../pubUtils/data';
|
||||
import { reportTAUserSet } from '../../../services/sdkService';
|
||||
@@ -223,9 +223,9 @@ export class EntryHandler {
|
||||
await leaveGuildAuctionChannel(roleId, sid, guildCode);
|
||||
await leaveWorldAuctionChannel(roleId, sid, serverId);
|
||||
RoleModel.updateRoleInfo(roleId, { quitTime: nowSeconds() });
|
||||
if(teamCode) { // 如果有寻宝中的队伍,那么等于战败
|
||||
setComBtlOnUserLeave(roleId, teamCode)
|
||||
}
|
||||
// if(teamCode) { // 如果有寻宝中的队伍,那么等于战败
|
||||
// setComBtlOnUserLeave(roleId, teamCode)
|
||||
// }
|
||||
saveLoginAndOutLog(LOG_TYPE.LOGINOUT, session);
|
||||
}
|
||||
|
||||
|
||||
@@ -732,7 +732,19 @@ export async function oneTeamNotInBlack(teams: ComBattleTeamType[], roleId: stri
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function setComBtlOnUserLeave(roleId: string, teamCode: string) {
|
||||
let res = dispatch(teamCode, pinus.app.getServersByType('battle'), 'battle');
|
||||
await pinus.app.rpc.battle.comBattleRemote.leaveFromBattle.toServer(res.id, roleId, teamCode);
|
||||
// export async function setComBtlOnUserLeave(roleId: string, teamCode: string) {
|
||||
// let res = dispatch(teamCode, pinus.app.getServersByType('battle'), 'battle');
|
||||
// await pinus.app.rpc.battle.comBattleRemote.leaveFromBattle.toServer(res.id, roleId, teamCode);
|
||||
// }
|
||||
|
||||
export async function checkHasMyTeam(roleId: string) {
|
||||
let battles = pinus.app.getServersByType('battle');
|
||||
let hasMyTeam = false;
|
||||
for(let server of battles) {
|
||||
let checkResult = await pinus.app.rpc.battle.comBattleRemote.checkMyTeam.toServer(server.id, roleId);
|
||||
if(checkResult) {
|
||||
hasMyTeam = true; break;
|
||||
}
|
||||
}
|
||||
return hasMyTeam;
|
||||
}
|
||||
@@ -137,6 +137,7 @@ export const STATUS = {
|
||||
COM_BATTLE_BE_KICKED: { code: 20634, simStr: '您已被队伍踢出,无法加入'},
|
||||
COM_BATTLE_CREATE_CE_LIMIT: { code: 20635, simStr: '你的战力不足,不可设置该级别限制' },
|
||||
COM_BATTLE_TEAM_NOT_DEFAULT: { code: 20636, simStr: '队伍已过期' },
|
||||
COM_BATTLE_IS_RUNNING: { code: 20637, simStr: '您有队伍正在进行中' },
|
||||
// 共斗藏宝图合成
|
||||
COM_BLUEPRT_QUALITY_CANNOT_COMPOSE: { code: 20650, simStr: '该品质藏宝图不可合成' },
|
||||
COM_BLUEPRT_COUNT_ERROR: { code: 20651, simStr: '材料数量不足' },
|
||||
|
||||
Reference in New Issue
Block a user