好友:修改查看武将

This commit is contained in:
luying
2021-02-06 15:17:51 +08:00
parent 406b833fd6
commit 8c6f9066ba
2 changed files with 20 additions and 13 deletions

View File

@@ -627,28 +627,35 @@ export class FriendHandler {
}
// 查看对象武将详细
public async getHeroDetail(msg: { roleId: string, hid: number }, session: BackendSession) {
public async getHeroDetail(msg: { roleId: string, hids: number[] }, session: BackendSession) {
// let roleId: string = session.get('roleId');
// let sid: string = session.get('sid');
let { roleId: hisRoleId, hid } = msg;
let { roleId: hisRoleId, hids } = msg;
let role = await RoleModel.findByRoleId(hisRoleId, ROLE_SELECT.ATTR);
if(!role) return resResult(STATUS.ROLE_NOT_FOUND);
let hero = await HeroModel.findByHidAndRole(hid, hisRoleId, HERO_SELECT.HERO_DETAIL, true);
if(!hero) return resResult(STATUS.HERO_NOT_FIND);
let heroList = await HeroModel.findByHidRange(hids, hisRoleId, HERO_SELECT.HERO_DETAIL, true);
if(heroList.length <= 0) return resResult(STATUS.HERO_NOT_FIND);
let { roleId, roleName, hName, ce, lv, star, colorStar, quality, job, skins } = hero;
let curSkin = skins.find(cur => cur.enable);
let equips = await EquipModel.findListByHidAndRole(hisRoleId, hid, EQUIP_SELECT.HERO_DETAIL);
let list = new Array();
for(let {roleId, roleName, hid, hName, ce, lv, star, colorStar, quality, job, skins, ceAttr} of heroList) {
let attributes = getPlayerMainAttribute(hero.ceAttr, role.globalCeAttr);
let curSkin = skins.find(cur => cur.enable);
let equips = await EquipModel.findListByHidAndRole(hisRoleId, hid, EQUIP_SELECT.HERO_DETAIL);
let attributes = getPlayerMainAttribute(ceAttr, role.globalCeAttr);
list.push({
roleId, roleName, hid, hName, ce, lv, star, colorStar, quality, job,
skin: curSkin?curSkin.id: 0, equips, attributes
});
return {
roleId, roleName, hid, hName, ce, lv, star, colorStar, quality, job,
skin: curSkin?curSkin.id: 0, equips, attributes
}
return resResult(STATUS.SUCCESS, { list });
}
}