From 778a31db7f621cd5849576036c6bac07b11d6eab Mon Sep 17 00:00:00 2001 From: zhangxk Date: Fri, 13 Oct 2023 13:34:08 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix(=E5=85=B1=E9=B8=A3=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F):=20=E4=BF=AE=E6=94=B9=E5=9C=B0=E7=8E=89=E5=85=BB?= =?UTF-8?q?=E6=88=90=E7=BB=B4=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../servers/role/handler/resonanceHandler.ts | 2 +- .../app/services/role/resonanceService.ts | 22 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/game-server/app/servers/role/handler/resonanceHandler.ts b/game-server/app/servers/role/handler/resonanceHandler.ts index 8d8ada9e1..f9331ac68 100644 --- a/game-server/app/servers/role/handler/resonanceHandler.ts +++ b/game-server/app/servers/role/handler/resonanceHandler.ts @@ -47,7 +47,7 @@ export class HeroHandler { if (!dicResonance) return resResult(STATUS.RESONANCE_POSITION_NOT_FOUND); const role = await RoleModel.findByRoleId(roleId); - if (!role || !role.mainWarId || role.mainWarId < (dicResonance?.openLimit || 0)) return resResult(STATUS.RESONANCE_POSITION_LV_NOT_ENOUGH); + if (!role || !role.lv || role.lv < (dicResonance?.openLimit || 0)) return resResult(STATUS.RESONANCE_POSITION_LV_NOT_ENOUGH); let costResult = await handleCost(roleId, sid, dicResonance.openConsume, ITEM_CHANGE_REASON.RESONANCE_LOCK_POSITION); if (!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH); diff --git a/game-server/app/services/role/resonanceService.ts b/game-server/app/services/role/resonanceService.ts index cb01294f9..19248ce75 100644 --- a/game-server/app/services/role/resonanceService.ts +++ b/game-server/app/services/role/resonanceService.ts @@ -174,7 +174,7 @@ export async function refreshResonanceData(roleId: string, serverId: number, sid resonanceStone.push({ id, stones: [] }); for (let index = 1; index <= EQUIP_STONE.THREE; index++) { topLineHero = sortData(dbResonanceMap, topLineHeroes, RESONANCE_SORT_TYPE.STONE, id, null, index); - const topLineHeroEplace = topLineHero.ePlace.find(cur => cur.id == id); + topLineHeroEplace = topLineHero.ePlace.find(cur => cur.id == id); resonanceStone.find(cur => cur.id == id).stones.push({ hid: topLineHero.hid, id: index, stone: 0 }); if (topLineHeroEplace && topLineHeroEplace.stones) { @@ -185,7 +185,7 @@ export async function refreshResonanceData(roleId: string, serverId: number, sid for (let [hid] of dbResonanceMap) { - if (!topLineHeroEplace && !topLineHeroEplace.stones) continue; + if (!topLineHeroEplace || !topLineHeroEplace.stones) continue; const topLineHeroStone = topLineHeroEplace.stones.find(cur => cur.id == index); if (!topLineHeroStone || !topLineHeroStone.stone) continue; @@ -205,7 +205,6 @@ export async function refreshResonanceData(roleId: string, serverId: number, sid let updateHeroes: HeroUpdate[] = [], newHeroes: HeroType[] = [], newHeroIds: number[] = []; for (let [hid] of dbResonanceMap) { let hero = dbHeroes.find(cur => cur.hid == hid); - // console.log('-x-x--x-x-x-x-x-x-x-x-x-55 hero', util.inspect(hero, { depth: null })); updateHeroes.push({ ...pick(hero, ['roleId', 'hid', 'lv', 'exp', 'job', 'jobStage', 'connections', 'skins', 'jobStage', 'ePlace']) }) newHeroes.push(hero); newHeroIds.push(hid); @@ -270,6 +269,7 @@ export function sortData(dbResonanceMap: Map, heroes: Her case RESONANCE_SORT_TYPE.EQUIP_QUALITY: { heroes = sortByEquipQuality(heroes, findType); + break; } case RESONANCE_SORT_TYPE.EQUIP_STAR: @@ -289,13 +289,15 @@ export function sortData(dbResonanceMap: Map, heroes: Her } } - let topLineHeroes: HeroType[] = []; - for (let hero of heroes) { - const { hid } = hero; - if (!dbResonanceMap.has(hid) && topLineHeroes.length < LINEUP_NUM) { - topLineHeroes.push(hero); - } - } + let topLineHeroes: HeroType[] = heroes; + // for (let hero of heroes) { + // const { hid } = hero; + // if (!dbResonanceMap.has(hid) && topLineHeroes.length < LINEUP_NUM) { + // topLineHeroes.push(hero); + // } + // } + // console.log('-x-x--x-x-x-x-x-x-x-x-x- topLineHeroes', util.inspect(heroes, { depth: null })); + return topLineHeroes[LINEUP_NUM - 1]; }