From 02625de882f89858a10d153389f39dcc45dcc5e0 Mon Sep 17 00:00:00 2001 From: luying Date: Fri, 7 Jul 2023 15:59:34 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(=E8=BF=9C=E5=BE=81&=E5=B7=85?= =?UTF-8?q?=E5=B3=B0):=20=E8=8E=B7=E5=8F=96=E5=AF=B9=E6=89=8B=E8=A3=85?= =?UTF-8?q?=E5=A4=87=E4=B8=8A=E7=9A=84=E5=A4=A9=E6=99=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/services/expeditionService.ts | 4 +--- game-server/app/services/pvpService.ts | 9 ++------- shared/domain/dbGeneral.ts | 17 ++++++++--------- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/game-server/app/services/expeditionService.ts b/game-server/app/services/expeditionService.ts index 5d10b9488..d8132b1a3 100644 --- a/game-server/app/services/expeditionService.ts +++ b/game-server/app/services/expeditionService.ts @@ -159,7 +159,6 @@ export async function matchPlayers(roleId: string, scale: number, range: number, 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); @@ -182,8 +181,7 @@ export async function matchPlayers(roleId: string, scale: number, range: number, artifact: artifact? [{ artifactId: artifact.artifactId, lv: artifact.lv }]: [], subHid, subActorId, - ePlace, - jewels: curJewels + ePlace: ePlace.map(cur => ({ ...cur, jewel: jewels.find(ccur => cur.jewel == ccur.seqId) })), }; enemyObj.enemies.push({...json, ...heroInfo}); diff --git a/game-server/app/services/pvpService.ts b/game-server/app/services/pvpService.ts index c7b19b50c..f6e78ff46 100644 --- a/game-server/app/services/pvpService.ts +++ b/game-server/app/services/pvpService.ts @@ -235,16 +235,11 @@ async function generPlayerOppHis(pvpdefense: PvpDefenseType, roleId: string, pos 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? 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) { @@ -253,7 +248,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, curJewels); + heroInfo.setHeroInfo(dbHero, artifact, dbHero.ePlace.map(cur => ({ ...cur, jewel: jewels.find(ccur => cur.jewel == ccur.seqId) }))); // heroInfo.setOutIndex(h.order); let attr = attrByHid.get(h.actorId); if(!attr) continue; @@ -269,7 +264,7 @@ async function generPlayerOppHis(pvpdefense: PvpDefenseType, roleId: string, pos } } else { let heroInfo = new PvpOtherHeroes(hs ? hs.score : 0); - heroInfo.setHeroInfo(dbHero, artifact, curJewels); + heroInfo.setHeroInfo(dbHero, artifact); otherHeroes.push(heroInfo); } } diff --git a/shared/domain/dbGeneral.ts b/shared/domain/dbGeneral.ts index 3d782d767..35e034e35 100644 --- a/shared/domain/dbGeneral.ts +++ b/shared/domain/dbGeneral.ts @@ -4,7 +4,6 @@ import Hero, { HeroType } from '../db/Hero'; import { nowSeconds } from '../pubUtils/timeUtil'; import { DicHero } from '../pubUtils/dictionary/DicHero'; import { ArtifactModelType } from '../db/Artifact'; -import { JewelType } from '../db/Jewel'; class Talent { @@ -16,6 +15,10 @@ class Talent { class HeroArtifact { + + @prop({ required: true }) + id: number; + @prop({ required: true }) artifactId: number; @@ -75,8 +78,8 @@ class EPlace { starStage: number = 0; @prop({ required: true, type: Stone, _id: false }) stones: Stone[]; - @prop({ required: false }) - jewel: number = 0; + @prop({ required: false, _id: false }) + jewel: Jewel = null; } // 从玩家数据中覆盖warjson的部分字段 @@ -119,10 +122,8 @@ export class PvpHeroInfo { @prop({ required: false, type: EPlace, _id: false }) ePlace: EPlace[]; // 战力 - @prop({ required: false, type: Jewel, _id: false }) - jewels: Jewel[]; // 天晶 - setHeroInfo(hero: HeroType, artifact: ArtifactModelType, jewels: JewelType[]) { + setHeroInfo(hero: HeroType, artifact: ArtifactModelType, ePlace: EPlace[] = []) { this.actorId = hero.hid; this.skinId = hero.skinId; this.actorName = hero.hName; @@ -136,8 +137,7 @@ export class PvpHeroInfo { this.subHid = hero.subHid; this.subActorId = hero.subActorId; if(artifact) this.artifact.push(artifact); - this.ePlace = hero.ePlace; - this.jewels = jewels; + this.ePlace = ePlace; } setRobotInfo(dicHero: DicHero, lv?: number) { @@ -262,7 +262,6 @@ export class PvpEnemies extends Enemies { this.subActorId = heroInfo.subActorId; this.artifact = heroInfo.artifact||[]; this.ePlace = heroInfo.ePlace||[]; - this.jewels = heroInfo.jewels||[]; if(score != undefined) this.score = score; } }