diff --git a/game-server/app/servers/battle/handler/pvpHandler.ts b/game-server/app/servers/battle/handler/pvpHandler.ts index 1098857eb..e75ae659c 100644 --- a/game-server/app/servers/battle/handler/pvpHandler.ts +++ b/game-server/app/servers/battle/handler/pvpHandler.ts @@ -10,7 +10,7 @@ import { PvpDefenseModel, OppPlayers } from '../../../db/PvpDefense'; import { pvpEndParamInter } from '../../../pubUtils/interface'; import { RankParam } from '../../../domain/rank'; import { PlayerDetail, PlayerDetailHero } from '../../../domain/battleField/guild'; -import { PVP_HERO_POS, REDIS_KEY, LINEUP_NUM } from '../../../consts'; +import { PVP_HERO_POS, PVP_HERO_ORDER, REDIS_KEY, LINEUP_NUM } from '../../../consts'; import { PVP } from '../../../pubUtils/dicParam'; import { addItems } from '../../../services/rewardService'; import { HeroModel } from '../../../db/Hero'; @@ -320,14 +320,35 @@ export class PvpHandler { let hids = topLineup.filter(cur => { return !heroes.find(ccur => ccur.actorId == cur.hid); }).map(cur => cur.hid); + let dataIds = new Array(), orders = new Array(); + for(let hero of heroes) { if(hero.actorId) { let isInTop = topLineup.find(cur => cur.hid == hero.actorId); if(!isInTop) { hero.actorId = hids.shift(); + dataIds.push(hero.dataId); + orders.push(hero.order); } } } + for(let hid of hids) { + let dataId = 0; + for (let i = PVP_HERO_POS.START; i <= PVP_HERO_POS.END; i++) { + if(dataIds.includes(i)) continue; + dataIds.push(i); + dataId = i; break; + } + let order = 0; + for (let i = PVP_HERO_ORDER.START; i <= PVP_HERO_ORDER.END; i++) { + if(orders.includes(i)) continue; + orders.push(i); + order = i; break; + } + heroes.push({ + actorId: hid, dataId, order + }) + } } for (let dataId = PVP_HERO_POS.START; dataId <= PVP_HERO_POS.END; dataId++) { diff --git a/shared/consts/constModules/itemConst.ts b/shared/consts/constModules/itemConst.ts index 4ba63c380..d6fc9bbc2 100644 --- a/shared/consts/constModules/itemConst.ts +++ b/shared/consts/constModules/itemConst.ts @@ -48,6 +48,11 @@ export enum PVP_HERO_POS { END = 2009 } +export enum PVP_HERO_ORDER { + START = 1, + END = 9 +} + export enum EQUIP_TYPE { START = 1, WEAPON = 1, // 神兵(武器)