皮肤:修复无初始皮肤bug
This commit is contained in:
@@ -314,13 +314,13 @@ function unlockSingleFigure(dbFigures: Figure[], id: number, unlockDirect = fals
|
||||
return figure
|
||||
}
|
||||
|
||||
async function getSkinsOfThisHero(roleId: string, hid: number) {
|
||||
async function getSkinsOfThisHero(roleId: string, hid: number, initialSkin: number) {
|
||||
let allSkins = await SkinModel.findbyRoleAndHid(roleId, hid);
|
||||
let skins = [];
|
||||
for(let skin of allSkins) {
|
||||
let index = skins.findIndex(cur => cur.id == skin.id);
|
||||
if(index == -1) {
|
||||
skins.push({ id: skin.id, skin: skin._id, enable: false });
|
||||
skins.push({ id: skin.id, skin: skin._id, enable: skin.id == initialSkin });
|
||||
}
|
||||
}
|
||||
return skins
|
||||
@@ -353,7 +353,7 @@ export async function createHeroes(roleId: string, roleName: string, serverId: n
|
||||
let info = { roleId, roleName, serverId, quality, star, job, hName };
|
||||
|
||||
await increaseSkin(roleId, roleName, initialSkin);
|
||||
let skins = await getSkinsOfThisHero(roleId, heroInfo.hid);
|
||||
let skins = await getSkinsOfThisHero(roleId, heroInfo.hid, initialSkin);
|
||||
|
||||
let curHero = await HeroModel.createHero(Object.assign(info, heroInfo, skins));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user