形象:获得武将头像
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import {Application, BackendSession, ChannelService} from 'pinus';
|
import {Application, BackendSession, ChannelService} from 'pinus';
|
||||||
import { handleCost, addItems } from '../../../services/rewardService';
|
import { handleCost, addItems, unlockFigure } from '../../../services/rewardService';
|
||||||
import { calPlayerCeAndSave, calAllHeroCe } from '../../../services/playerCeService';
|
import { calPlayerCeAndSave, calAllHeroCe } from '../../../services/playerCeService';
|
||||||
import { resResult, returnHeroCeRatio, deepCopy } from '../../../pubUtils/util';
|
import { resResult, returnHeroCeRatio, deepCopy } from '../../../pubUtils/util';
|
||||||
import { STATUS } from '../../../consts/statusCode';
|
import { STATUS } from '../../../consts/statusCode';
|
||||||
@@ -9,7 +9,7 @@ import { RoleModel } from '../../../db/Role';
|
|||||||
import { ItemModel } from '../../../db/Item';
|
import { ItemModel } from '../../../db/Item';
|
||||||
import { gameData, getHeroExpByLv, getHeroStarByQuality, getHeroWakeByQuality, getHeroLvByExp, getMaxGradeByjobClass, getJobByGradeAndClass, getFriendShipById, getFavourLvByExp } from '../../../pubUtils/data';
|
import { gameData, getHeroExpByLv, getHeroStarByQuality, getHeroWakeByQuality, getHeroLvByExp, getMaxGradeByjobClass, getJobByGradeAndClass, getFriendShipById, getFavourLvByExp } from '../../../pubUtils/data';
|
||||||
import { RewardInter } from '../../../pubUtils/interface';
|
import { RewardInter } from '../../../pubUtils/interface';
|
||||||
import { getDropItems } from '../../../consts/constModules/itemConst'
|
import { getDropItems, FIGURE_UNLOCK_CONDITION } from '../../../consts/constModules/itemConst'
|
||||||
import { pushComposeOrangeHero, pushHeroQualityUpMsg, pushHeroStarMax } from '../../../services/chatService';
|
import { pushComposeOrangeHero, pushHeroQualityUpMsg, pushHeroStarMax } from '../../../services/chatService';
|
||||||
import { calculatetopLineup } from '../../../pubUtils/playerCe';
|
import { calculatetopLineup } from '../../../pubUtils/playerCe';
|
||||||
import { PvpDefenseModel } from '../../../db/PvpDefense';
|
import { PvpDefenseModel } from '../../../db/PvpDefense';
|
||||||
@@ -139,6 +139,7 @@ export class HeroHandler {
|
|||||||
let curHero = await HeroModel.createHero({
|
let curHero = await HeroModel.createHero({
|
||||||
roleId, serverId, roleName, hid, hName, star, quality, job, skins:[{id: initialSkin, enable: true}]
|
roleId, serverId, roleName, hid, hName, star, quality, job, skins:[{id: initialSkin, enable: true}]
|
||||||
});
|
});
|
||||||
|
await unlockFigure(sid, roleId, [{ type: FIGURE_UNLOCK_CONDITION.GET_HERO, num: hid }]); // 解锁头像
|
||||||
let hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.INIT, sid, roleId, curHero, {});
|
let hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.INIT, sid, roleId, curHero, {});
|
||||||
await calAllHeroCe(HERO_SYSTEM_TYPE.ADD_SKIN, sid, roleId, {}, [initialSkin])
|
await calAllHeroCe(HERO_SYSTEM_TYPE.ADD_SKIN, sid, roleId, {}, [initialSkin])
|
||||||
pushComposeOrangeHero(roleId, roleName, serverId, hero);
|
pushComposeOrangeHero(roleId, roleName, serverId, hero);
|
||||||
@@ -537,6 +538,7 @@ export class HeroHandler {
|
|||||||
|
|
||||||
//重算战力并下发
|
//重算战力并下发
|
||||||
if (oldLv != hero.favourLv) {
|
if (oldLv != hero.favourLv) {
|
||||||
|
await unlockFigure(sid, roleId, [{type: FIGURE_UNLOCK_CONDITION.HERO_FAVOR, num: hero.favourLv }]);
|
||||||
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.FAVOUR, sid, roleId, hero, {
|
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.FAVOUR, sid, roleId, hero, {
|
||||||
favour: newExp, favourLv: newLv
|
favour: newExp, favourLv: newLv
|
||||||
}, [oldLv]);
|
}, [oldLv]);
|
||||||
|
|||||||
@@ -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 { EquipModel } from './../db/Equip';
|
||||||
import { resResult, parseGoodStr } from '../pubUtils/util';
|
import { resResult, parseGoodStr } from '../pubUtils/util';
|
||||||
import { getGoodById } from '../pubUtils/gamedata';
|
import { getGoodById } from '../pubUtils/gamedata';
|
||||||
import { RoleModel } from '../db/Role';
|
import { RoleModel, RoleType } from '../db/Role';
|
||||||
import { setAp } from './actionPointService';
|
import { setAp } from './actionPointService';
|
||||||
import { calAllHeroCe } from './playerCeService';
|
import { calAllHeroCe } from './playerCeService';
|
||||||
import { ItemModel } from '../db/Item';
|
import { ItemModel } from '../db/Item';
|
||||||
import { STATUS } from '../consts/statusCode';
|
import { STATUS } from '../consts/statusCode';
|
||||||
import { pinus } from 'pinus';
|
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 { EquipInter, ItemInter, BagInter } from '../pubUtils/interface';
|
||||||
import { gameData } from '../pubUtils/data';
|
import { gameData } from '../pubUtils/data';
|
||||||
import { uniq, indexOf, findIndex } from 'underscore';
|
import { uniq, indexOf, findIndex } from 'underscore';
|
||||||
@@ -166,6 +166,8 @@ export async function addItems(roleId: string, roleName: string, sid: string, go
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!!skinInfos.length) {
|
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);
|
calAllHeroCe(HERO_SYSTEM_TYPE.ADD_SKIN, sid, roleId, {}, addSkinIds);
|
||||||
pinus.app.get('channelService').pushMessageByUids('onHeroSkinChange', resResult(STATUS.SUCCESS, {skinInfos}), uids);
|
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 false;
|
||||||
}
|
}
|
||||||
return true;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ import { PvpDefenseModel } from '@db/PvpDefense';
|
|||||||
|
|
||||||
import { Service } from 'egg';
|
import { Service } from 'egg';
|
||||||
import Counter from '@db/Counter';
|
import Counter from '@db/Counter';
|
||||||
import { STATUS, HERO_SYSTEM_TYPE } from '@consts';
|
import { STATUS, HERO_SYSTEM_TYPE, FIGURE_UNLOCK_CONDITION } from '@consts';
|
||||||
import { ITID, COUNTER } from '@consts';
|
import { ITID, COUNTER } from '@consts';
|
||||||
import { ItemModel } from '@db/Item';
|
import { ItemModel } from '@db/Item';
|
||||||
import { gameData, getHeroExpByLv } from '@pubUtils/data';
|
import { gameData, getHeroExpByLv } from '@pubUtils/data';
|
||||||
@@ -32,6 +32,7 @@ import { isString } from 'underscore';
|
|||||||
import { FriendShipModel } from '@db/FriendShip';
|
import { FriendShipModel } from '@db/FriendShip';
|
||||||
import { FriendApplyModel } from '@db/FriendApply';
|
import { FriendApplyModel } from '@db/FriendApply';
|
||||||
import { FriendRelationModel } from '@db/FriendRelation';
|
import { FriendRelationModel } from '@db/FriendRelation';
|
||||||
|
import { unlockFigure } from '@pubUtils/itemUtils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Service
|
* Test Service
|
||||||
@@ -267,6 +268,7 @@ export default class GMUsers extends Service {
|
|||||||
try {
|
try {
|
||||||
for(let heroInfo of heroInfos) {
|
for(let heroInfo of heroInfos) {
|
||||||
let hero = await HeroModel.createHero(heroInfo);
|
let hero = await HeroModel.createHero(heroInfo);
|
||||||
|
await unlockFigure(heroInfo.roleId, [{ type: FIGURE_UNLOCK_CONDITION.GET_HERO, num: heroInfo.hid }]); // 解锁头像
|
||||||
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.INIT, heroInfo.roleId, hero, {});
|
await calPlayerCeAndSave(HERO_SYSTEM_TYPE.INIT, heroInfo.roleId, hero, {});
|
||||||
}
|
}
|
||||||
return ctx.service.utils.resResult(STATUS.SUCCESS, { uids });
|
return ctx.service.utils.resResult(STATUS.SUCCESS, { uids });
|
||||||
|
|||||||
@@ -112,10 +112,10 @@ export async function unlockFigure(roleId: string, conditions: {type: number, nu
|
|||||||
if(figure && figure.unlocked) figureInfo.heads.push(figure);
|
if(figure && figure.unlocked) figureInfo.heads.push(figure);
|
||||||
} else if (dicItid.type == CONSUME_TYPE.FRAME) {
|
} else if (dicItid.type == CONSUME_TYPE.FRAME) {
|
||||||
let figure = unlockSingleFigure(frames, id, false, type);
|
let figure = unlockSingleFigure(frames, id, false, type);
|
||||||
if(figure && figure.unlocked) figureInfo.heads.push(figure);
|
if(figure && figure.unlocked) figureInfo.frames.push(figure);
|
||||||
} else if (dicItid.type == CONSUME_TYPE.SPINE) {
|
} else if (dicItid.type == CONSUME_TYPE.SPINE) {
|
||||||
let figure = unlockSingleFigure(spines, id, false, type);
|
let figure = unlockSingleFigure(spines, id, false, type);
|
||||||
if(figure && figure.unlocked) figureInfo.heads.push(figure);
|
if(figure && figure.unlocked) figureInfo.spines.push(figure);
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user