武将:获取所有武将
This commit is contained in:
@@ -26,14 +26,14 @@ import { checkTaskInCreateHero } from "../task/taskService";
|
||||
let hids = heroInfo.map(cur => cur.hid);
|
||||
let userHeroesMap = await HeroModel.findMapByHidRange(hids, roleId);
|
||||
|
||||
let createHids: number[] = [], pieces: ItemInter[] = [];
|
||||
let createHeroeInfos: 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 * heroCount });
|
||||
} else {
|
||||
createHids.push(h.hid);
|
||||
createHeroeInfos.push(h);
|
||||
userHeroesMap.set(h.hid, null);
|
||||
if (heroCount > 1) {
|
||||
let { pieceId, count } = transPiece(h.hid);
|
||||
@@ -46,13 +46,13 @@ import { checkTaskInCreateHero } from "../task/taskService";
|
||||
let figureConditions: { type: FIGURE_UNLOCK_CONDITION, paramHid: number }[] = [];
|
||||
let incHeroNum = 0;
|
||||
let skins: SkinUpdate[] = [];
|
||||
if (createHids.length > 0) {
|
||||
if (createHeroeInfos.length > 0) {
|
||||
let heroInfos = new Map<number, HeroUpdate>();
|
||||
for(let hid of createHids) {
|
||||
for(let {hid, ...info} of createHeroeInfos) {
|
||||
let initSkin = SkinModel.getInitInfo(hid);
|
||||
skins.push(initSkin); // 初始皮肤
|
||||
let seqId = await CounterModel.getNewCounter(COUNTER.HID) || -1;
|
||||
let initHero = HeroModel.getInitInfo(hid, { seqId, roleId, roleName, skins: [new HeroSkin(initSkin)] });
|
||||
let initHero = HeroModel.getInitInfo(hid, { ...info, seqId, roleId, roleName, skins: [new HeroSkin(initSkin)] });
|
||||
heroInfos.set(hid, initHero);
|
||||
figureConditions.push({ type: FIGURE_UNLOCK_CONDITION.GET_HERO, paramHid: hid });
|
||||
incHeroNum ++;
|
||||
|
||||
Reference in New Issue
Block a user