寻宝:修复队长没有icon

This commit is contained in:
luying
2021-08-17 16:28:25 +08:00
parent 5afbda8a12
commit e81a9b67db
4 changed files with 26 additions and 5 deletions
+15 -4
View File
@@ -12,7 +12,7 @@ import { RoleStatus, ComBattleTeamModel, ComBattleTeamType } from './../db/ComBa
import { getRandEelm, getRandValue, resResult, ratioReward, getRandValueByMinMax, getRandEelmWithWeight, getRobotInfo } from "../pubUtils/util";
import { getRandRobot, transBossHpArr } from "./battleService";
import { difference, omit } from 'underscore';
import { Channel, ChannelService } from 'pinus';
import { Channel, ChannelService, pinus } from 'pinus';
import { TREASURE, EXTERIOR } from '../pubUtils/dicParam';
import { addItems, decreaseItems, handleCost } from './rewardService';
import { getFriendLvAdd } from './friendService';
@@ -25,6 +25,7 @@ import { getRewardByBlueprtId, gameData, getBossHpByBlueprtId } from '../pubUtil
import { getFriendPointObject } from '../pubUtils/itemUtils';
import { DicWar } from '../pubUtils/dictionary/DicWar';
import { getZeroPointD } from '../pubUtils/timeUtil';
import { dispatch } from '../util/dispatcher';
/**
* 在给定的品质列表中随机返回一定数量的藏宝图Id
@@ -44,12 +45,12 @@ export function getRandBlueprtId(qualityArr: number[], cnt = 1) {
export function getRandComBtlRobots(topLineupCe: number, ceLimit: number, lv: number, cnt: number) {
let robotHeroes = getRandRobot(cnt); // 随机几个阵容
let robotInfos = []; // 随机几个机器人信息
let robotInfos: { robotRoleName: string, robotRoleId: string }[] = []; // 随机几个机器人信息
for (let i = 0; i < cnt; i++) {
robotInfos.push(getRobotInfo());
}
// 创建并添加机器人
let robotStArr = [], robotIdArr = [];
let robotStArr: RoleStatus[] = [], robotIdArr: string[] = [];
if (robotHeroes && robotInfos && robotHeroes.length && robotInfos.length && robotInfos.length === robotHeroes.length) {
robotHeroes.forEach((robot, idx) => {
let robotCe = 0;
@@ -666,9 +667,14 @@ export function teamIsFullToStart(comTeam: MemComBtlTeam) {
* @param {number} [count=1]
*/
export async function addRobotsToTeam(comTeam: MemComBtlTeam, roleId: string, roleCe: number, roleLv: number, teamMap: Map<string, MemComBtlTeam>, teamDisTimer: Map<string, NodeJS.Timer>, channel: Channel, count = 1) {
const { teamCode } = comTeam;
const { teamCode, roleStatus } = comTeam;
let hasCap = roleStatus.findIndex(cur => cur.isCap) != -1;
const { robotStArr, robotIdArr } = getRandComBtlRobots(roleCe, comTeam.ceLimit, roleLv, count);
for (let st of robotStArr) {
if(!hasCap) {
st.isCap = true;
hasCap = true;
}
addRoleStToTeam(comTeam, st);
await ComBattleTeamModel.addRole(teamCode, st);
}
@@ -722,3 +728,8 @@ 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);
}