✨ feat(gvg): 添加队伍快照
This commit is contained in:
@@ -20,6 +20,9 @@ import { pick } from 'underscore';
|
||||
import { SaveTeamParam, SaveTeamUpdateParam } from '../../../domain/gvgField/gvgDb';
|
||||
import { GVG_PERIOD, PUSH_ROUTE, STATUS } from '../../../consts';
|
||||
import { sendMessageToUserWithSuc } from '../../../services/pushService';
|
||||
import { GVGHeroInfo } from '../../../domain/dbGeneral';
|
||||
import { ArtifactModel } from '../../../db/Artifact';
|
||||
import { getHeroesAttributes } from '../../../services/playerCeService';
|
||||
|
||||
export default function (app: Application) {
|
||||
new HandlerService(app, {});
|
||||
@@ -68,10 +71,29 @@ export class GVGBattleHandler {
|
||||
|
||||
let updateParam: SaveTeamUpdateParam = { index, head, spine, frame, configId, groupId, serverType }
|
||||
if(lineup) {
|
||||
let attrByHid = await getHeroesAttributes(roleId);
|
||||
let { isOK, heroes } = await checkBattleHeroesByHid(roleId, lineup.map(cur => cur.actorId));
|
||||
if(!isOK) return resResult(STATUS.BATTLE_HERO_NOT_FOUND);
|
||||
let newLineup: GVGHeroInfo[] = [];
|
||||
for(let { actorId, dataId, order } of lineup) {
|
||||
let hero = heroes.find(cur => cur.hid == actorId);
|
||||
if(hero) {
|
||||
let artifact = hero.artifact? await ArtifactModel.findbySeqId(roleId, hero.artifact): null;
|
||||
let heroInfo = new GVGHeroInfo();
|
||||
heroInfo.setHeroInfo(hero, artifact);
|
||||
heroInfo.setDataId(dataId, order);
|
||||
|
||||
let attr = attrByHid.get(actorId);
|
||||
if(!attr) continue;
|
||||
let attribute = attr.getAttributesToString();
|
||||
heroInfo.setAttribute(attribute);
|
||||
|
||||
newLineup.push(heroInfo);
|
||||
}
|
||||
}
|
||||
|
||||
let lineupCe = heroes.reduce((pre, cur) => pre + cur.ce, 0);
|
||||
updateParam.lineup = lineup;
|
||||
updateParam.lineup = newLineup;
|
||||
updateParam.lineupCe = lineupCe;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user