初始:修复初始创建角色bug
This commit is contained in:
@@ -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) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user