寻宝:修复队长没有icon
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Application, ChannelService, FrontendSession, RemoterClass, HandlerService, } from 'pinus';
|
import { Application, ChannelService, FrontendSession, RemoterClass, HandlerService, pinus, } from 'pinus';
|
||||||
import { resResult } from '../../../pubUtils/util';
|
import { resResult } from '../../../pubUtils/util';
|
||||||
import { STATUS } from '../../../consts';
|
import { STATUS } from '../../../consts';
|
||||||
|
|
||||||
@@ -127,4 +127,8 @@ export class ComBattleRemote {
|
|||||||
}
|
}
|
||||||
return this.bossHp;
|
return this.bossHp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async leaveFromBattle(roleId: string, teamCode: string ) {
|
||||||
|
// this.app.sysrpc.msgRemote.forwardMessage
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -22,6 +22,7 @@ import { Rank } from '../../../services/rankService';
|
|||||||
import { checkTaskWithRole, } from '../../../services/taskService';
|
import { checkTaskWithRole, } from '../../../services/taskService';
|
||||||
import { pushData, everydayRefresh } from '../../../services/connectorService';
|
import { pushData, everydayRefresh } from '../../../services/connectorService';
|
||||||
import { pick } from 'lodash';
|
import { pick } from 'lodash';
|
||||||
|
import { setComBtlOnUserLeave } from '../../../services/comBattleService';
|
||||||
|
|
||||||
export default function (app: Application) {
|
export default function (app: Application) {
|
||||||
new HandlerService(app, {});
|
new HandlerService(app, {});
|
||||||
@@ -192,6 +193,7 @@ export class EntryHandler {
|
|||||||
let sid = session.get('sid');
|
let sid = session.get('sid');
|
||||||
let serverId = session.get('serverId');
|
let serverId = session.get('serverId');
|
||||||
const guildCode = session.get('guildCode');
|
const guildCode = session.get('guildCode');
|
||||||
|
const teamCode: string = session.get('teamCode');
|
||||||
roleLeave(roleId).then(function (roleInfo) {
|
roleLeave(roleId).then(function (roleInfo) {
|
||||||
if (roleInfo.isOnline) {
|
if (roleInfo.isOnline) {
|
||||||
reportOneOnline(roleId, roleInfo.userCode, sid, roleInfo.pkgName);
|
reportOneOnline(roleId, roleInfo.userCode, sid, roleInfo.pkgName);
|
||||||
@@ -206,6 +208,9 @@ export class EntryHandler {
|
|||||||
await leaveWorldChannel(roleId, sid, serverId);
|
await leaveWorldChannel(roleId, sid, serverId);
|
||||||
await leaveGuildChannel(roleId, sid, guildCode);
|
await leaveGuildChannel(roleId, sid, guildCode);
|
||||||
RoleModel.updateRoleInfo(roleId, { quitTime: nowSeconds() });
|
RoleModel.updateRoleInfo(roleId, { quitTime: nowSeconds() });
|
||||||
|
if(teamCode) { // 如果有寻宝中的队伍,那么等于战败
|
||||||
|
await setComBtlOnUserLeave(roleId, teamCode)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { RoleStatus, ComBattleTeamModel, ComBattleTeamType } from './../db/ComBa
|
|||||||
import { getRandEelm, getRandValue, resResult, ratioReward, getRandValueByMinMax, getRandEelmWithWeight, getRobotInfo } from "../pubUtils/util";
|
import { getRandEelm, getRandValue, resResult, ratioReward, getRandValueByMinMax, getRandEelmWithWeight, getRobotInfo } from "../pubUtils/util";
|
||||||
import { getRandRobot, transBossHpArr } from "./battleService";
|
import { getRandRobot, transBossHpArr } from "./battleService";
|
||||||
import { difference, omit } from 'underscore';
|
import { difference, omit } from 'underscore';
|
||||||
import { Channel, ChannelService } from 'pinus';
|
import { Channel, ChannelService, pinus } from 'pinus';
|
||||||
import { TREASURE, EXTERIOR } from '../pubUtils/dicParam';
|
import { TREASURE, EXTERIOR } from '../pubUtils/dicParam';
|
||||||
import { addItems, decreaseItems, handleCost } from './rewardService';
|
import { addItems, decreaseItems, handleCost } from './rewardService';
|
||||||
import { getFriendLvAdd } from './friendService';
|
import { getFriendLvAdd } from './friendService';
|
||||||
@@ -25,6 +25,7 @@ import { getRewardByBlueprtId, gameData, getBossHpByBlueprtId } from '../pubUtil
|
|||||||
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 } from '../pubUtils/timeUtil';
|
||||||
|
import { dispatch } from '../util/dispatcher';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在给定的品质列表中随机返回一定数量的藏宝图Id
|
* 在给定的品质列表中随机返回一定数量的藏宝图Id
|
||||||
@@ -44,12 +45,12 @@ export function getRandBlueprtId(qualityArr: number[], cnt = 1) {
|
|||||||
|
|
||||||
export function getRandComBtlRobots(topLineupCe: number, ceLimit: number, lv: number, cnt: number) {
|
export function getRandComBtlRobots(topLineupCe: number, ceLimit: number, lv: number, cnt: number) {
|
||||||
let robotHeroes = getRandRobot(cnt); // 随机几个阵容
|
let robotHeroes = getRandRobot(cnt); // 随机几个阵容
|
||||||
let robotInfos = []; // 随机几个机器人信息
|
let robotInfos: { robotRoleName: string, robotRoleId: string }[] = []; // 随机几个机器人信息
|
||||||
for (let i = 0; i < cnt; i++) {
|
for (let i = 0; i < cnt; i++) {
|
||||||
robotInfos.push(getRobotInfo());
|
robotInfos.push(getRobotInfo());
|
||||||
}
|
}
|
||||||
// 创建并添加机器人
|
// 创建并添加机器人
|
||||||
let robotStArr = [], robotIdArr = [];
|
let robotStArr: RoleStatus[] = [], robotIdArr: string[] = [];
|
||||||
if (robotHeroes && robotInfos && robotHeroes.length && robotInfos.length && robotInfos.length === robotHeroes.length) {
|
if (robotHeroes && robotInfos && robotHeroes.length && robotInfos.length && robotInfos.length === robotHeroes.length) {
|
||||||
robotHeroes.forEach((robot, idx) => {
|
robotHeroes.forEach((robot, idx) => {
|
||||||
let robotCe = 0;
|
let robotCe = 0;
|
||||||
@@ -666,9 +667,14 @@ export function teamIsFullToStart(comTeam: MemComBtlTeam) {
|
|||||||
* @param {number} [count=1]
|
* @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) {
|
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);
|
const { robotStArr, robotIdArr } = getRandComBtlRobots(roleCe, comTeam.ceLimit, roleLv, count);
|
||||||
for (let st of robotStArr) {
|
for (let st of robotStArr) {
|
||||||
|
if(!hasCap) {
|
||||||
|
st.isCap = true;
|
||||||
|
hasCap = true;
|
||||||
|
}
|
||||||
addRoleStToTeam(comTeam, st);
|
addRoleStToTeam(comTeam, st);
|
||||||
await ComBattleTeamModel.addRole(teamCode, st);
|
await ComBattleTeamModel.addRole(teamCode, st);
|
||||||
}
|
}
|
||||||
@@ -722,3 +728,8 @@ export async function oneTeamNotInBlack(teams: ComBattleTeamType[], roleId: stri
|
|||||||
}
|
}
|
||||||
return null;
|
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);
|
||||||
|
}
|
||||||
@@ -93,6 +93,7 @@ export class RoleStatus {
|
|||||||
this.heroes = heroes;
|
this.heroes = heroes;
|
||||||
this.killed = [];
|
this.killed = [];
|
||||||
this.isRobot = isRobot;
|
this.isRobot = isRobot;
|
||||||
|
this.fixReward = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
addFrdRatio(frdRatio: number) {
|
addFrdRatio(frdRatio: number) {
|
||||||
|
|||||||
Reference in New Issue
Block a user