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]; }