武将:添加皮肤bug

This commit is contained in:
luying
2022-05-05 09:54:39 +08:00
parent 39aecf8754
commit cc0cde6987
2 changed files with 7 additions and 7 deletions

View File

@@ -848,19 +848,19 @@ export class Rank {
// 有序排行综合时间和得分排序
private encodeScore(scores: number[]) {
let encodeResult = 0;
console.log('#### decoencodeResultdeScore', this.key, scores, this.valueConfig);
// console.log('#### decoencodeResultdeScore', this.key, scores, this.valueConfig);
this.valueConfig.forEach(({ name, reverse, isTimestamp, len, weight }, index) => {
let score = scores[index];
console.log('*** 1', name, len, weight, score, encodeResult)
// console.log('*** 1', name, len, weight, score, encodeResult)
if(isTimestamp) score = this.handleTimestamp(score, len);
console.log('*** 2', name, len, weight, score, encodeResult)
// console.log('*** 2', name, len, weight, score, encodeResult)
if(!reverse) {
encodeResult += score * Math.pow(10, weight);
} else {
let pow = Math.pow(10, len);
encodeResult += (pow - 1 - score) * Math.pow(10, weight);
}
console.log('*** 3', name, len, weight, score, encodeResult)
// console.log('*** 3', name, len, weight, score, encodeResult)
})
return encodeResult
}

View File

@@ -199,7 +199,7 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
let calAllHeroResult = undefined; // 全局战力变化推送
for (let skinId of skins) {//皮肤推送
let hero = await addSkin(roleId, roleName, sid, skinId, false);
let hero = await addSkin(roleId, roleName, role.serverId, sid, skinId, false);
if (!!hero) {
showItems.push({ id: skinId, count: 1 });
skinInfos.push({ id: skinId, hid: hero?.hid||0, count: 1, inc: 1, reason })
@@ -345,14 +345,14 @@ function pushHeroSkinMsg(heroskins: {skins: HeroSkin[], hid: number}[], skinInf
* @param hero 武将如果已经查询过这个武将就不用再查询一次主意要select skins字段
* @returns {{ hero, figureInfo, calAllHeroResult }} hero添加皮肤后的武将 figureInfo: 触发头像添加信息 calAllHeroResult全局战力加成后结果
*/
export async function addSkin(roleId: string, roleName: string, sid: string, skinId: number, enable: boolean, hero?: HeroType) {
export async function addSkin(roleId: string, roleName: string, serverId: number, sid: string, skinId: number, enable: boolean, hero?: HeroType) {
let skin = await increaseSkin(roleId, roleName, skinId);
if(!skin) return false;
if(skin.hid && !hero) hero = await HeroModel.findByHidAndRole(skin.hid, roleId);
let condition = { type: FIGURE_UNLOCK_CONDITION.GET_SKIN, paramSkinId: skinId };
await unlockFigure(sid, roleId, [condition]); // 解锁头像
await calculateCeWithRole(HERO_SYSTEM_TYPE.ADD_SKIN, roleId, hero.serverId, sid, {}, { skinId }); // 全局加成
await calculateCeWithRole(HERO_SYSTEM_TYPE.ADD_SKIN, roleId, serverId, sid, {}, { skinId }); // 全局加成
if (hero) { // 有武将的,将皮肤链接到武将上
let curSkin = hero.skins.find(cur => cur.id == skinId);