寻宝:单排玩家强退
This commit is contained in:
@@ -33,6 +33,9 @@ export default function(app: Application) {
|
|||||||
}
|
}
|
||||||
export class ComBattleHandler {
|
export class ComBattleHandler {
|
||||||
constructor(private app: Application) {
|
constructor(private app: Application) {
|
||||||
|
this.app.set('teamMap', this.teamMap);
|
||||||
|
this.app.set('teamDisTimer', this.teamDisTimer);
|
||||||
|
this.app.set('robotHurtTimer', this.robotHurtTimer);
|
||||||
}
|
}
|
||||||
private teamMap: Map<string, MemComBtlTeam> = new Map();
|
private teamMap: Map<string, MemComBtlTeam> = new Map();
|
||||||
private teamDisTimer: Map<string, NodeJS.Timer> = new Map();
|
private teamDisTimer: Map<string, NodeJS.Timer> = new Map();
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { Application, ChannelService, FrontendSession, RemoterClass, HandlerService, pinus, } 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';
|
||||||
|
import { handleComBtlProgress } from '../../../services/comBattleService';
|
||||||
|
import { MemComBtlTeam } from '../../../domain/battleField/ComBattleTeamField';
|
||||||
|
|
||||||
export default function (app: Application) {
|
export default function (app: Application) {
|
||||||
new HandlerService(app, {});
|
new HandlerService(app, {});
|
||||||
@@ -129,6 +131,18 @@ export class ComBattleRemote {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async leaveFromBattle(roleId: string, teamCode: string ) {
|
public async leaveFromBattle(roleId: string, teamCode: string ) {
|
||||||
// this.app.sysrpc.msgRemote.forwardMessage
|
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); // 结算
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,8 @@ Filter.prototype.before = async function (routeRecord: RouteRecord, msg: any, se
|
|||||||
const roleId: string = session.get('roleId');
|
const roleId: string = session.get('roleId');
|
||||||
const uid: number = session.get('userid');
|
const uid: number = session.get('userid');
|
||||||
|
|
||||||
|
session.push('teamCode', () => {});
|
||||||
|
|
||||||
let connectorServers = pinus.app.getServersByType('connector');
|
let connectorServers = pinus.app.getServersByType('connector');
|
||||||
let { id } = connectorServers[0];
|
let { id } = connectorServers[0];
|
||||||
let maintenServers = await pinus.app.rpc.connector.connectorRemote.getServerMainten.toServer(id);
|
let maintenServers = await pinus.app.rpc.connector.connectorRemote.getServerMainten.toServer(id);
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ export class EntryHandler {
|
|||||||
await leaveGuildChannel(roleId, sid, guildCode);
|
await leaveGuildChannel(roleId, sid, guildCode);
|
||||||
RoleModel.updateRoleInfo(roleId, { quitTime: nowSeconds() });
|
RoleModel.updateRoleInfo(roleId, { quitTime: nowSeconds() });
|
||||||
if(teamCode) { // 如果有寻宝中的队伍,那么等于战败
|
if(teamCode) { // 如果有寻宝中的队伍,那么等于战败
|
||||||
await setComBtlOnUserLeave(roleId, teamCode)
|
setComBtlOnUserLeave(roleId, teamCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export function checkComBattleResult(teamStatus) {
|
|||||||
// 看看是否还有活人
|
// 看看是否还有活人
|
||||||
teamStatus.roleStatus.forEach(st => {
|
teamStatus.roleStatus.forEach(st => {
|
||||||
// 设置了阵容,且阵容人数和阵亡人数一样,说明玩家战败
|
// 设置了阵容,且阵容人数和阵亡人数一样,说明玩家战败
|
||||||
if (!st.isRobot && st.heroes && ((st.heroes.length > 0 && st.killed.length < st.heroes.length) || st.heroes.length === 0)) {
|
if (!st.isRobot && st.battleStatus != 2 && st.heroes && ((st.heroes.length > 0 && st.killed.length < st.heroes.length) || st.heroes.length === 0 )) {
|
||||||
allPlayerKilled = false
|
allPlayerKilled = false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user