聊天:升星和升品的推送及测试
This commit is contained in:
@@ -11,7 +11,7 @@ import { gameData, getHeroExpByLv, getHeroStarByQuality, getHeroWakeByQuality, g
|
||||
import { RewardInter } from '../../../pubUtils/interface';
|
||||
import { getDropItems } from '../../../consts/constModules/itemConst'
|
||||
import { getRoleOnlineInfo, getAllOnlineRoles } from '../../../services/redisService';
|
||||
import { pushComposeOrangeHero, pushHeroQualityUpMsg } from '../../../services/chatService';
|
||||
import { pushComposeOrangeHero, pushHeroQualityUpMsg, pushHeroStarMax } from '../../../services/chatService';
|
||||
import { calculatetopLineup } from '../../../pubUtils/playerCe';
|
||||
import { PvpDefenseModel } from '../../../db/PvpDefense';
|
||||
|
||||
@@ -48,7 +48,7 @@ export class HeroHandler {
|
||||
let dicHero = gameData.hero.get(hid);
|
||||
if (!dicHero) return resResult(STATUS.HERO_NOT_FIND);
|
||||
await addItems(roleId, roleName, sid, [{
|
||||
id: dicHero.pieceId, count: dicHero.pieceCount
|
||||
id: dicHero.pieceId, count: dicHero.pieceCount * HERO_GROW_MAX.STAR * ABI_STAGE.END
|
||||
}] );
|
||||
|
||||
let hero = await HeroModel.findByHidAndRole(hid, roleId);
|
||||
@@ -189,6 +189,8 @@ export class HeroHandler {
|
||||
// 武将升星
|
||||
public async starUp(msg: { hid: number, star: number, starStage: number}, session: BackendSession) {
|
||||
let roleId: string = session.get('roleId');
|
||||
let roleName: string = session.get('roleName');
|
||||
let serverId: string = session.get('serverId');
|
||||
let sid: string = session.get('sid');
|
||||
|
||||
let {hid, star, starStage} = msg;
|
||||
@@ -230,6 +232,9 @@ export class HeroHandler {
|
||||
colorStar: hero.colorStar,
|
||||
colorStarStage: hero.colorStarStage
|
||||
}
|
||||
if (hero.star === HERO_GROW_MAX.STAR) {
|
||||
pushHeroStarMax(roleId, roleName, serverId, hero);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, {isUpStar, curHero});
|
||||
}
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ export function wrapRichText(type: string, jumpTo: string, content: string, parm
|
||||
}
|
||||
|
||||
export async function pushNormalHeroInfoBySource(roleId: string, roleName: string, serverId: number | string, source: number, heroInfo: Partial<HeroType>) {
|
||||
const hero = pick(heroInfo, ['hName', 'hid', 'seqId', 'quality']);
|
||||
const hero = pick(heroInfo, ['hName', 'hid', 'seqId', 'quality', 'star', 'starStage', 'colorStar', 'colorStarStage']);
|
||||
const content = JSON.stringify({ roleId, roleName, hero });
|
||||
const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.SYS, `${serverId}`, MSG_TYPE.RICH_TEXT, source, content, null, null);
|
||||
const roomId = groupRoomId(CHANNEL_PREFIX.SYS, `${serverId}`);
|
||||
@@ -218,3 +218,7 @@ export async function pushHeroQualityUpMsg(roleId: string, roleName: string, ser
|
||||
export async function pushComposeOrangeHero(roleId: string, roleName: string, serverId: number | string, heroInfo: Partial<HeroType>) {
|
||||
await pushNormalHeroInfoBySource(roleId, roleName, serverId, MSG_SOURCE.COMPOSE_ORANGE_HERO, heroInfo);
|
||||
}
|
||||
|
||||
export async function pushHeroStarMax(roleId: string, roleName: string, serverId: number | string, heroInfo: Partial<HeroType>) {
|
||||
await pushNormalHeroInfoBySource(roleId, roleName, serverId, MSG_SOURCE.HERO_STAR_MAX, heroInfo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user