diff --git a/game-server/app/services/rewardService.ts b/game-server/app/services/rewardService.ts index 1c535e16e..2147d7410 100644 --- a/game-server/app/services/rewardService.ts +++ b/game-server/app/services/rewardService.ts @@ -304,22 +304,22 @@ export async function pushFigureUpdate(roleId: string, sid: string, figureInfo: * @param heroInfo */ export async function createHeroes(roleId: string, roleName: string, sid: string, serverId: number, funcs: number[], heroInfo: CreateHeroParam[]) { - let hids = heroInfo.map(cur => cur.hid); let userHeroesMap = await HeroModel.findMapByHidRange(hids, roleId); let newHeroInfo: CreateHeroParam[] = [], pieces: ItemInter[] = []; for (let h of heroInfo) { + let heroCount = h.count||1; if (userHeroesMap.has(h.hid)) { let { pieceId, count } = transPiece(h.hid); - pieces.push({ id: pieceId, count: count * h.count }); + pieces.push({ id: pieceId, count: count * heroCount }); } else { newHeroInfo.push(h) userHeroesMap.set(h.hid, null); - if (h.count > 1) { + if (heroCount > 1) { let { pieceId, count } = transPiece(h.hid); - pieces.push({ id: pieceId, count: count * (h.count - 1) }); + pieces.push({ id: pieceId, count: count * (heroCount - 1) }); } } }