fix 寻宝:机器人重复问题,被踢人推送
This commit is contained in:
@@ -448,11 +448,12 @@ export class ComBattleHandler {
|
|||||||
// 推送移除消息
|
// 推送移除消息
|
||||||
let channelService = this.app.get('channelService');
|
let channelService = this.app.get('channelService');
|
||||||
let channel = channelService.getChannel(teamCode, false);
|
let channel = channelService.getChannel(teamCode, false);
|
||||||
|
// 先推送离队消息,再将玩家从房间中移除
|
||||||
|
channel.pushMessage('onLeaveTeam', resResult(STATUS.SUCCESS, {teamCode, roleId: roleIdToRm}));
|
||||||
let users = channel.getMembers();
|
let users = channel.getMembers();
|
||||||
if (users.indexOf(roleIdToRm) !== -1) {
|
if (users.indexOf(roleIdToRm) !== -1) {
|
||||||
channel.removeMember(roleIdToRm);
|
channel.removeMember(roleIdToRm);
|
||||||
}
|
}
|
||||||
channel.pushMessage('onLeaveTeam', resResult(STATUS.SUCCESS, {teamCode, roleId: roleIdToRm}));
|
|
||||||
clearComBtlTimer(teamCode, this.teamDisTimer); // 移除队员停止解散计时
|
clearComBtlTimer(teamCode, this.teamDisTimer); // 移除队员停止解散计时
|
||||||
let thiz = this;
|
let thiz = this;
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
|
|||||||
@@ -24,16 +24,19 @@ export function getRandBlueprtId(qualityArr: Array<number>, cnt = 1) {
|
|||||||
|
|
||||||
export function getRandComBtlRobots(topFiveCe: number, lv: number, cnt: number) {
|
export function getRandComBtlRobots(topFiveCe: number, lv: number, cnt: number) {
|
||||||
let robotHeroes = getRandRobot(cnt); // 随机几个阵容
|
let robotHeroes = getRandRobot(cnt); // 随机几个阵容
|
||||||
|
let robotInfos = getRandEelm(COM_BATTLE_ROBOT_ID_NAME, cnt); // 随机几个阵容
|
||||||
// 创建并添加机器人
|
// 创建并添加机器人
|
||||||
let robotStArr = [], robotIdArr = [];
|
let robotStArr = [], robotIdArr = [];
|
||||||
for (let robot of robotHeroes) {
|
if (robotHeroes && robotInfos && robotHeroes.length && robotInfos.length && robotInfos.length === robotHeroes.length) {
|
||||||
const robotCe = getRandValue(topFiveCe || 0, COM_BTL_CONST.ROBOT_CE_RATIO, 0);
|
robotHeroes.forEach((robot, idx) => {
|
||||||
const robotLv = getRandValue(lv, COM_BTL_CONST.ROBOT_CE_RATIO, 0);
|
const robotCe = getRandValue(topFiveCe || 0, COM_BTL_CONST.ROBOT_CE_RATIO, 0);
|
||||||
const imgHid = robot[Math.floor(Math.random() * robot.length)];
|
const robotLv = getRandValue(lv, COM_BTL_CONST.ROBOT_CE_RATIO, 0);
|
||||||
const { robotRoleId, robotRoleName } = COM_BATTLE_ROBOT_ID_NAME[Math.floor(Math.random() * COM_BATTLE_ROBOT_ID_NAME.length)];
|
const imgHid = robot[Math.floor(Math.random() * robot.length)];
|
||||||
let robotStatus = new RoleStatus(robotRoleId, robotRoleName, false, false, imgHid, imgHid, robotCe, robotLv, robot, true);
|
const { robotRoleId, robotRoleName } = robotInfos[idx];
|
||||||
robotStArr.push(robotStatus);
|
let robotStatus = new RoleStatus(robotRoleId, robotRoleName, false, false, imgHid, imgHid, robotCe, robotLv, robot, true);
|
||||||
robotIdArr.push(robotRoleId);
|
robotStArr.push(robotStatus);
|
||||||
|
robotIdArr.push(robotRoleId);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
robotStArr, robotIdArr
|
robotStArr, robotIdArr
|
||||||
|
|||||||
Reference in New Issue
Block a user