寻宝:调整黑名单检查代码
This commit is contained in:
@@ -17,10 +17,9 @@ import { ItemModel } from '../../../db/Item';
|
|||||||
import { handleFixedReward, addItems, handleCost } from '../../../services/rewardService';
|
import { handleFixedReward, addItems, handleCost } from '../../../services/rewardService';
|
||||||
import { checkRoleInQueue, getTeamSearchByQuality, rmRoleFromQueue, setTeamSearchReq } from '../../../services/redisService';
|
import { checkRoleInQueue, getTeamSearchByQuality, rmRoleFromQueue, setTeamSearchReq } from '../../../services/redisService';
|
||||||
import { transBossHpArr } from '../../../services/battleService';
|
import { transBossHpArr } from '../../../services/battleService';
|
||||||
import { getRandBlueprtId, getRandComBtlRobots, clearComBtlTimer, getRealReward, getAssistTimesByQuality, getFrd, updateRobotHurtByTime, comBtlLvInvalid, clearRobotHurtTimer, setDismissTimer, dismissTeam, incEquipPrintDrop, randEquipPrintId, handleComBtlProgress, getComBattleFriendAdd, getValidTeammateRoleSt } from '../../../services/comBattleService';
|
import { getRandBlueprtId, getRandComBtlRobots, clearComBtlTimer, getAssistTimesByQuality, getFrd, updateRobotHurtByTime, comBtlLvInvalid, clearRobotHurtTimer, setDismissTimer, dismissTeam, incEquipPrintDrop, randEquipPrintId, handleComBtlProgress, getComBattleFriendAdd, getValidTeammateRoleSt, teammateInBlackList } from '../../../services/comBattleService';
|
||||||
import { setAp } from '../../../services/actionPointService';
|
import { setAp } from '../../../services/actionPointService';
|
||||||
import { roleLevelup } from '../../../services/normalBattleService';
|
import { roleLevelup } from '../../../services/normalBattleService';
|
||||||
import { FriendRelationModel } from '../../../db/FriendRelation';
|
|
||||||
|
|
||||||
export default function(app: Application) {
|
export default function(app: Application) {
|
||||||
return new ComBattleHandler(app);
|
return new ComBattleHandler(app);
|
||||||
@@ -217,15 +216,10 @@ export class ComBattleHandler {
|
|||||||
let team: ComBattleTeamType;
|
let team: ComBattleTeamType;
|
||||||
for(let curTeam of teams) {
|
for(let curTeam of teams) {
|
||||||
let { roleIds } = curTeam;
|
let { roleIds } = curTeam;
|
||||||
|
const inBlackList = await teammateInBlackList(roleId, roleIds);
|
||||||
// 黑名单屏蔽
|
if(!inBlackList) {
|
||||||
let hasBlackList = false;
|
team = curTeam;
|
||||||
for(let hisRoleId of roleIds) {
|
break;
|
||||||
let isInBlackList = await FriendRelationModel.isInBlackList(roleId, hisRoleId);
|
|
||||||
if(isInBlackList) { hasBlackList = true; break; }
|
|
||||||
}
|
|
||||||
if(!hasBlackList) {
|
|
||||||
team = curTeam; break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,12 +320,6 @@ export class ComBattleHandler {
|
|||||||
isFrd = await getFrd(roleId, quality);
|
isFrd = await getFrd(roleId, quality);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 一般不会匹配到,手动邀请的可以加入
|
|
||||||
// for(let hisRoleId of teamStatus.roleIds) {
|
|
||||||
// let isInBlackList = await FriendRelationModel.isInBlackList(roleId, hisRoleId);
|
|
||||||
// if(isInBlackList) return resResult(STATUS.COM_BATTLE_BLACKLIST);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// 加入队伍
|
// 加入队伍
|
||||||
let roleStatus = new RoleStatus(roleId, roleName, false, isFrd, headHid, sHid, topFiveCe, lv);
|
let roleStatus = new RoleStatus(roleId, roleName, false, isFrd, headHid, sHid, topFiveCe, lv);
|
||||||
const team = await ComBattleTeamModel.addRole(teamCode, roleStatus);
|
const team = await ComBattleTeamModel.addRole(teamCode, roleStatus);
|
||||||
|
|||||||
@@ -463,16 +463,10 @@ export async function getComBattleFriendAdd(roleStatus: RoleStatus[]) {
|
|||||||
async function teammateValid(roleInfo: Partial<RoleType>, roleId: string, roleIds: Array<string>, ceLimit: number) {
|
async function teammateValid(roleInfo: Partial<RoleType>, roleId: string, roleIds: Array<string>, ceLimit: number) {
|
||||||
if (!roleInfo || roleIds.indexOf(roleId) !== -1) return false;
|
if (!roleInfo || roleIds.indexOf(roleId) !== -1) return false;
|
||||||
|
|
||||||
|
const isBlack = await teammateInBlackList(roleId, roleIds);
|
||||||
|
if(isBlack) return false;
|
||||||
|
|
||||||
let { topFiveCe } = roleInfo;
|
let { topFiveCe } = roleInfo;
|
||||||
|
|
||||||
// 黑名单屏蔽
|
|
||||||
let hasBlackList = false;
|
|
||||||
for(let hisRoleId of roleIds) {
|
|
||||||
let isInBlackList = await FriendRelationModel.isInBlackList(roleId, hisRoleId);
|
|
||||||
if(isInBlackList) { hasBlackList = true; break; }
|
|
||||||
}
|
|
||||||
if(hasBlackList) return false;
|
|
||||||
|
|
||||||
topFiveCe = reduceCe(topFiveCe);
|
topFiveCe = reduceCe(topFiveCe);
|
||||||
if (topFiveCe < ceLimit) return false;
|
if (topFiveCe < ceLimit) return false;
|
||||||
|
|
||||||
@@ -498,3 +492,18 @@ export async function getValidTeammateRoleSt(roleId: string, roleIds: Array<stri
|
|||||||
const result = new RoleStatus(roleId, roleName, false, isFrd, headHid, sHid, topFiveCe, lv);
|
const result = new RoleStatus(roleId, roleName, false, isFrd, headHid, sHid, topFiveCe, lv);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 检查队伍中是否有人互为黑名单
|
||||||
|
* @export
|
||||||
|
* @param {string} roleId 要加入队伍的玩家 id
|
||||||
|
* @param {Array<string>} roleIds 队伍中已有的玩家 id
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export async function teammateInBlackList(roleId: string, roleIds: Array<string>) {
|
||||||
|
for(let teammateRoleId of roleIds) {
|
||||||
|
const isBlack = await FriendRelationModel.isInBlackList(roleId, teammateRoleId);
|
||||||
|
if (isBlack === true) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user