🐞 fix(共鸣系统): 修改地玉养成维度

This commit is contained in:
zhangxk
2023-10-13 13:34:08 +08:00
parent bcd2305076
commit 778a31db7f
2 changed files with 13 additions and 11 deletions

View File

@@ -47,7 +47,7 @@ export class HeroHandler {
if (!dicResonance) return resResult(STATUS.RESONANCE_POSITION_NOT_FOUND); if (!dicResonance) return resResult(STATUS.RESONANCE_POSITION_NOT_FOUND);
const role = await RoleModel.findByRoleId(roleId); 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); let costResult = await handleCost(roleId, sid, dicResonance.openConsume, ITEM_CHANGE_REASON.RESONANCE_LOCK_POSITION);
if (!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH); if (!costResult) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);

View File

@@ -174,7 +174,7 @@ export async function refreshResonanceData(roleId: string, serverId: number, sid
resonanceStone.push({ id, stones: [] }); resonanceStone.push({ id, stones: [] });
for (let index = 1; index <= EQUIP_STONE.THREE; index++) { for (let index = 1; index <= EQUIP_STONE.THREE; index++) {
topLineHero = sortData(dbResonanceMap, topLineHeroes, RESONANCE_SORT_TYPE.STONE, id, null, 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 }); resonanceStone.find(cur => cur.id == id).stones.push({ hid: topLineHero.hid, id: index, stone: 0 });
if (topLineHeroEplace && topLineHeroEplace.stones) { if (topLineHeroEplace && topLineHeroEplace.stones) {
@@ -185,7 +185,7 @@ export async function refreshResonanceData(roleId: string, serverId: number, sid
for (let [hid] of dbResonanceMap) { for (let [hid] of dbResonanceMap) {
if (!topLineHeroEplace && !topLineHeroEplace.stones) continue; if (!topLineHeroEplace || !topLineHeroEplace.stones) continue;
const topLineHeroStone = topLineHeroEplace.stones.find(cur => cur.id == index); const topLineHeroStone = topLineHeroEplace.stones.find(cur => cur.id == index);
if (!topLineHeroStone || !topLineHeroStone.stone) continue; 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[] = []; let updateHeroes: HeroUpdate[] = [], newHeroes: HeroType[] = [], newHeroIds: number[] = [];
for (let [hid] of dbResonanceMap) { for (let [hid] of dbResonanceMap) {
let hero = dbHeroes.find(cur => cur.hid == hid); 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']) }) updateHeroes.push({ ...pick(hero, ['roleId', 'hid', 'lv', 'exp', 'job', 'jobStage', 'connections', 'skins', 'jobStage', 'ePlace']) })
newHeroes.push(hero); newHeroes.push(hero);
newHeroIds.push(hid); newHeroIds.push(hid);
@@ -270,6 +269,7 @@ export function sortData(dbResonanceMap: Map<number, ResonanceType>, heroes: Her
case RESONANCE_SORT_TYPE.EQUIP_QUALITY: case RESONANCE_SORT_TYPE.EQUIP_QUALITY:
{ {
heroes = sortByEquipQuality(heroes, findType); heroes = sortByEquipQuality(heroes, findType);
break; break;
} }
case RESONANCE_SORT_TYPE.EQUIP_STAR: case RESONANCE_SORT_TYPE.EQUIP_STAR:
@@ -289,13 +289,15 @@ export function sortData(dbResonanceMap: Map<number, ResonanceType>, heroes: Her
} }
} }
let topLineHeroes: HeroType[] = []; let topLineHeroes: HeroType[] = heroes;
for (let hero of heroes) { // for (let hero of heroes) {
const { hid } = hero; // const { hid } = hero;
if (!dbResonanceMap.has(hid) && topLineHeroes.length < LINEUP_NUM) { // if (!dbResonanceMap.has(hid) && topLineHeroes.length < LINEUP_NUM) {
topLineHeroes.push(hero); // 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]; return topLineHeroes[LINEUP_NUM - 1];
} }