🐞 fix(共鸣系统): 修改羁绊、天晶维度

This commit is contained in:
zhangxk
2023-10-13 22:28:46 +08:00
parent b82d525f7f
commit 121f5de8fd

View File

@@ -67,10 +67,9 @@ export async function refreshResonanceData(roleId: string, serverId: number, sid
for (let index = 1; index <= FRIENDSHIP_INDEX.THREE; index++) {
topLineHero = sortData(dbResonanceMap, topLineHeroes, RESONANCE_SORT_TYPE.CONNECT, index);
resonanceCon.push({ hid: topLineHero.hid, index, level: topLineHero.connections[index]?.level || 0 });
const topDicShipId = gameData.friendShipByIndex.get(`${topLineHero.hid}_${index}`);
const topShipData = topLineHero.connections.find(cur => cur.shipId == topDicShipId);
const topShipData = (topLineHero.connections || []).find(cur => cur.shipId == topDicShipId);
resonanceCon.push({ hid: topLineHero.hid, index, level: topShipData?.level || 0 });
if (!topShipData) continue;
for (let [hid] of dbResonanceMap) {
@@ -78,11 +77,27 @@ export async function refreshResonanceData(roleId: string, serverId: number, sid
const dicShipId = gameData.friendShipByIndex.get(`${hero.hid}_${index}`)
let shipData = hero.connections.find(cur => cur.shipId == dicShipId);
if (!shipData) continue; //hero.connections.push({ shipId: dicShipId, level: topShipData.level, exp: topShipData.exp });
shipData.exp = topShipData.exp;
shipData.level = topShipData.level;
let tempCon = resonanceCon.find(cur => cur.index == index);
tempCon.level = topShipData.level;
console.log('x-x-x-x-x- hid', hid)
console.log('x-x-x-x-x- dicShipId', dicShipId)
console.log('x-x-x-x-x- shipData?.shipId', shipData?.shipId)
console.log('x-x-x-x-x- shipData?.level', shipData?.level)
const dicShipData = gameData.friendShipsByLv.get(`${hid}_${dicShipId}_${topShipData?.level || 0}`);
let sign = true;
for (let hi of dicShipData?.hids || []) {
if (!dbHeroes.find(cur => cur.hid == hi)) {
sign = false;
break;
}
}
if (!sign) continue;
if (!shipData) hero.connections.push({ shipId: dicShipId, level: topShipData?.level || 0, exp: topShipData?.exp || 0 });
else {
shipData.shipId = dicShipId
shipData.exp = topShipData?.exp || 0;
shipData.level = topShipData?.level || 0;
}
}
}
@@ -118,13 +133,15 @@ export async function refreshResonanceData(roleId: string, serverId: number, sid
resonanceEpQuality.push({ hid: topLineHero.hid, id, quality: topLineHeroEplace?.quality || 0, qualityStage: topLineHeroEplace?.qualityStage || 0 })
for (let [hid] of dbResonanceMap) {
if (!topLineHeroEplace || !topLineHeroEplace.quality || !topLineHeroEplace.qualityStage) continue;
if (!topLineHeroEplace || (!topLineHeroEplace.quality && !topLineHeroEplace.qualityStage)) continue;
let hero = dbHeroes.find(cur => cur.hid == hid);
let ePlaceData = hero.ePlace.find(cur => cur.id == id);
if (!ePlaceData) {
hero.ePlace.push({ ...await getInitEplace(id, hero.skinId) });
ePlaceData = hero.ePlace.find(cur => cur.id == id);
};
ePlaceData.quality = topLineHeroEplace.quality;
ePlaceData.qualityStage = topLineHeroEplace.qualityStage;
}
//装备精练
@@ -137,13 +154,15 @@ export async function refreshResonanceData(roleId: string, serverId: number, sid
resonanceEpStar.push({ hid: topLineHero.hid, id, star: topLineHeroEplace?.star || 0, starStage: topLineHeroEplace?.starStage || 0 })
for (let [hid] of dbResonanceMap) {
if (!topLineHeroEplace || !topLineHeroEplace.star || !topLineHeroEplace.starStage) continue;
if (!topLineHeroEplace || (!topLineHeroEplace.star && !topLineHeroEplace.starStage)) continue;
let hero = dbHeroes.find(cur => cur.hid == hid);
let ePlaceData = hero.ePlace.find(cur => cur.id == id);
if (!ePlaceData) {
hero.ePlace.push({ ...await getInitEplace(id, hero.skinId) });
ePlaceData = hero.ePlace.find(cur => cur.id == id);
};
ePlaceData.star = topLineHeroEplace.star;
ePlaceData.starStage = topLineHeroEplace.starStage;
}
//天晶
@@ -165,6 +184,7 @@ export async function refreshResonanceData(roleId: string, serverId: number, sid
hero.ePlace.push({ ...await getInitEplace(id, hero.skinId) });
ePlaceData = hero.ePlace.find(cur => cur.id == id);
};
ePlaceData.jewel = topLineHeroEplace.jewel;
}
}
@@ -244,8 +264,11 @@ export function sortData(dbResonanceMap: Map<number, ResonanceType>, heroes: Her
case RESONANCE_SORT_TYPE.JOBSTAGE:
{
heroes.sort((a, b) => {
if (a.job != b.job) {
return b.job - a.job;
let gradeA = gameData.job.get(a.job)?.grade || 0;
let gradeB = gameData.job.get(b.job)?.grade || 0;
if (gradeA != gradeB) {
return gradeB - gradeA;
}
else if (a.jobStage !== b.jobStage) {
return b.jobStage - a.jobStage;
@@ -280,6 +303,9 @@ export function sortData(dbResonanceMap: Map<number, ResonanceType>, heroes: Her
case RESONANCE_SORT_TYPE.JEWEL:
{
heroes = sortByEquipJewel(heroes, findType, jewelMap);
// if (findType == 3) {
// console.log('-x-x--x-x-x-x-x-x-x-x-x- topLineHeroes', util.inspect(heroes, { depth: null }));
// }
break;
}
case RESONANCE_SORT_TYPE.STONE:
@@ -383,7 +409,7 @@ export function sortByEquipJewel(heroes: HeroType[], eplaceId: number, jewelMap:
let dicRandomEffectPool = gameData.randomEffectPool.get(seid);
if (!dicRandomEffectPool) continue;
if (!dicRandomEffectPool.Max) dicRandomEffectPool = gameData.randomEffectPool.get(1);
if (!dicRandomEffectPool || (dicRandomEffectPool?.Max || 0 == 0)) continue;
if (!dicRandomEffectPool || ((dicRandomEffectPool?.Max || 0) == 0)) continue;
valA += rand / (dicRandomEffectPool.Max);
}
}
@@ -392,7 +418,7 @@ export function sortByEquipJewel(heroes: HeroType[], eplaceId: number, jewelMap:
let dicRandomEffectPool = gameData.randomEffectPool.get(seid);
if (!dicRandomEffectPool) continue;
if (!dicRandomEffectPool.Max) dicRandomEffectPool = gameData.randomEffectPool.get(1);
if (!dicRandomEffectPool || (dicRandomEffectPool?.Max || 0 == 0)) continue;
if (!dicRandomEffectPool || ((dicRandomEffectPool?.Max || 0) == 0)) continue;
valA += rand / (dicRandomEffectPool.Max);
}
}
@@ -406,9 +432,10 @@ export function sortByEquipJewel(heroes: HeroType[], eplaceId: number, jewelMap:
if (jewelBData.randSe && jewelBData.randSe.length > 0) {
for (let { seid, rand } of jewelBData.randSe) {
let dicRandomEffectPool = gameData.randomEffectPool.get(seid);
if (!dicRandomEffectPool) continue;
if (!dicRandomEffectPool.Max) dicRandomEffectPool = gameData.randomEffectPool.get(1);
if (!dicRandomEffectPool || (dicRandomEffectPool?.Max || 0 == 0)) continue;
if (!dicRandomEffectPool || (dicRandomEffectPool?.Max || 0) == 0) continue;
valB += rand / (dicRandomEffectPool.Max);
}
}
@@ -417,11 +444,26 @@ export function sortByEquipJewel(heroes: HeroType[], eplaceId: number, jewelMap:
let dicRandomEffectPool = gameData.randomEffectPool.get(seid);
if (!dicRandomEffectPool) continue;
if (!dicRandomEffectPool.Max) dicRandomEffectPool = gameData.randomEffectPool.get(1);
if (!dicRandomEffectPool || (dicRandomEffectPool?.Max || 0 == 0)) continue;
if (!dicRandomEffectPool || (dicRandomEffectPool?.Max || 0) == 0) continue;
valB += rand / (dicRandomEffectPool.Max);
}
}
}
// if (eplaceId == 3) {
// console.log('-------------------------------------------------------------------');
// console.log('--------------------------------hid', a.hid);
// console.log('--------------------------------dicJewelALv', dicJewelALv);
// console.log('--------------------------------valA', valA);
// console.log('--------------------------------ceA', a.ce);
// console.log('-------------------------------------------------------------------');
// console.log('--------------------------------hid', b.hid);
// console.log('--------------------------------dicJewelBLv', dicJewelBLv);
// console.log('--------------------------------valB', valB);
// console.log('--------------------------------ceB', b.ce);
// }
if (dicJewelALv != dicJewelBLv) {
return dicJewelBLv - dicJewelALv;