pvp:修复保存守阵问题
This commit is contained in:
@@ -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<number>(), orders = new Array<number>();
|
||||
|
||||
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++) {
|
||||
|
||||
@@ -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, // 神兵(武器)
|
||||
|
||||
Reference in New Issue
Block a user