feat(远征&巅峰): 选择其他对手获取他的装备和宝物信息

This commit is contained in:
luying
2023-07-06 11:24:31 +08:00
parent 9c8d2fa589
commit 636fb00a6e
5 changed files with 98 additions and 9 deletions

View File

@@ -12,6 +12,7 @@ import * as dicParam from '../pubUtils/dicParam';
import { getHeroesAttributes, getSumCe } from './playerCeService';
import { checkSystemIsOpen } from './roleService';
import { ArtifactModel } from '../db/Artifact';
import { JewelModel } from '../db/Jewel';
/**
* 获取远征关卡列表
@@ -144,6 +145,10 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
enemyObj.enemyId = roleId;
enemyObj.ce = topLineupCe;
let hids = topLineup.map(cur => cur.hid);
let artifacts = await ArtifactModel.findbyHids(roleId, hids);
let jewels = await JewelModel.findbyRoleAndHids(roleId, hids);
let heroIndex = 0;
for(let json of dicWarJson) {
if(json.relation == 2) {
@@ -151,9 +156,10 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
if(hero) {
let h = <HeroType>hero.hero;
if(h) {
let { star, lv, ce, skins, colorStar, quality, job, subHid = 0, subActorId = 0 } = h;
let artifact = h.artifact? await ArtifactModel.findbySeqId(role.roleId, h.artifact): null;
let { star, lv, ce, skins, colorStar, quality, job, subHid = 0, subActorId = 0, ePlace = [] } = h;
let artifact = h.artifact? artifacts.find(cur => cur.seqId == h.artifact): null;
let skin = skins?.find(cur => cur.enable);
let curJewels = jewels.filter(jewel => jewel.hid == h.hid);
let dicHero = gameData.hero.get(hero.hid);
let attr = attrByHid.get(hero.hid);
@@ -175,7 +181,9 @@ export async function matchPlayers(roleId: string, scale: number, range: number,
talent: skin? skin.talent: [],
artifact: artifact? [{ artifactId: artifact.artifactId, lv: artifact.lv }]: [],
subHid,
subActorId
subActorId,
ePlace,
jewels: curJewels
};
enemyObj.enemies.push({...json, ...heroInfo});

View File

@@ -208,7 +208,7 @@ export async function generNewLineup(roleId: string, heroes: HeroType[], lineup:
if(hero) {
let artifact = hero.artifact? await ArtifactModel.findbySeqId(roleId, hero.artifact): null;
let heroInfo = new GVGHeroInfo();
heroInfo.setHeroInfo(hero, artifact);
heroInfo.setHeroInfo(hero, artifact, []);
heroInfo.setDataId(dataId, order);
let attr = attrByHid.get(actorId);

View File

@@ -29,6 +29,7 @@ import { setPvpSettleSeasonNumToRemote } from './timeTaskService';
import { ArtifactModel } from '../db/Artifact';
import { getPVPGroupIdOfServer, getPvpServersByGroupId } from './serverService';
import { findKeys } from './redisService';
import { JewelModel } from '../db/Jewel';
/**
* 返回对手三人信息
@@ -232,8 +233,18 @@ async function generPlayerOppHis(pvpdefense: PvpDefenseType, roleId: string, pos
let otherHeroes = new Array<PvpOtherHeroes>(); // 阵容外的所有武将信息
let defCe = 0;
let attrByHid = await getHeroesAttributes(role.roleId);
let hids = defenseHeroes.map(cur => cur.actorId);
console.log('#### hids', hids);
let artifacts = await ArtifactModel.findbyHids(role.roleId, hids);
let jewels = await JewelModel.findbyRoleAndHids(role.roleId, hids);
console.log('#### jewels', jewels.length);
for (let dbHero of dbHeroes) {
let artifact = dbHero.artifact? await ArtifactModel.findbySeqId(role.roleId, dbHero.artifact): null;
let artifact = dbHero.artifact? artifacts.find(cur => cur.seqId == dbHero.artifact): null;
let curJewels = jewels.filter(jewel => jewel.hid == dbHero.hid);
console.log('#### curJewels', dbHero.hid, curJewels.length)
let h = defenseHeroes.find(cur => cur.actorId == dbHero.hid); // 阵容里是否有这个武将
let hs = heroScores.find(cur => cur.hid == dbHero.hid); // 这个武将是否有这个得分
if (!!h) {
@@ -242,7 +253,7 @@ async function generPlayerOppHis(pvpdefense: PvpDefenseType, roleId: string, pos
let warJson = mapWarJson.find(cur => cur.dataId == h.dataId);
if (warJson && warJson.relation == 2) {
let heroInfo = new PvpHeroInfo();
heroInfo.setHeroInfo(dbHero, artifact);
heroInfo.setHeroInfo(dbHero, artifact, curJewels);
// heroInfo.setOutIndex(h.order);
let attr = attrByHid.get(h.actorId);
if(!attr) continue;
@@ -258,7 +269,7 @@ async function generPlayerOppHis(pvpdefense: PvpDefenseType, roleId: string, pos
}
} else {
let heroInfo = new PvpOtherHeroes(hs ? hs.score : 0);
heroInfo.setHeroInfo(dbHero, artifact);
heroInfo.setHeroInfo(dbHero, artifact, curJewels);
otherHeroes.push(heroInfo);
}
}