形象:获得武将头像
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import { ITID, CONSUME_TYPE, getCurNameById, ITEM_TABLE, HERO_SYSTEM_TYPE, CURRENCY_BY_TYPE } from './../consts';
|
||||
import { ITID, CONSUME_TYPE, getCurNameById, ITEM_TABLE, HERO_SYSTEM_TYPE, CURRENCY_BY_TYPE, FIGURE_UNLOCK_CONDITION } from './../consts';
|
||||
import { EquipModel } from './../db/Equip';
|
||||
import { resResult, parseGoodStr } from '../pubUtils/util';
|
||||
import { getGoodById } from '../pubUtils/gamedata';
|
||||
import { RoleModel } from '../db/Role';
|
||||
import { RoleModel, RoleType } from '../db/Role';
|
||||
import { setAp } from './actionPointService';
|
||||
import { calAllHeroCe } from './playerCeService';
|
||||
import { ItemModel } from '../db/Item';
|
||||
import { STATUS } from '../consts/statusCode';
|
||||
import { pinus } from 'pinus';
|
||||
import { addEquips, addBags, addSkins, addFigure } from '../pubUtils/itemUtils';
|
||||
import { addEquips, addBags, addSkins, addFigure, unlockFigure as pubUnlockFigure } from '../pubUtils/itemUtils';
|
||||
import { EquipInter, ItemInter, BagInter } from '../pubUtils/interface';
|
||||
import { gameData } from '../pubUtils/data';
|
||||
import { uniq, indexOf, findIndex } from 'underscore';
|
||||
@@ -166,6 +166,8 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
||||
}
|
||||
}
|
||||
if (!!skinInfos.length) {
|
||||
let unlockedType = addSkinIds.map(cur => { return { type: FIGURE_UNLOCK_CONDITION.GET_SKIN, num: cur } });
|
||||
await unlockFigure(sid, roleId, unlockedType);
|
||||
calAllHeroCe(HERO_SYSTEM_TYPE.ADD_SKIN, sid, roleId, {}, addSkinIds);
|
||||
pinus.app.get('channelService').pushMessageByUids('onHeroSkinChange', resResult(STATUS.SUCCESS, {skinInfos}), uids);
|
||||
}
|
||||
@@ -279,4 +281,14 @@ export async function checkGoods(roleId: string, goodIds: Array<number>) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
export async function unlockFigure(sid: string, roleId: string, conditions: {type: number, num: number}[], role?: RoleType) {
|
||||
let figureInfo = await pubUnlockFigure(roleId, conditions, role);
|
||||
|
||||
if (!!figureInfo) {
|
||||
let uids = [{uid: roleId, sid}];
|
||||
pinus.app.get('channelService').pushMessageByUids('onHeadChange', resResult(STATUS.SUCCESS, { ...figureInfo }), uids);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user