装备:全服公告

This commit is contained in:
luying
2022-02-22 16:12:37 +08:00
parent b2f1ff2cfb
commit 75f13bf923
5 changed files with 37 additions and 16 deletions

View File

@@ -14,6 +14,7 @@ import { isNumber, pick } from 'underscore';
import { JewelModel } from "../../../db/Jewel";
import { getJewelRandSe } from "../../../pubUtils/itemUtils";
import { checkTaskInEquipQualityUp, checkTaskInEquipStarUp, checkTaskInPutJewel, checkTaskInPutStone } from '../../../services/equipService';
import { pushEquipQualityMax, pushEquipStarMax } from "../../../services/sysChatService";
export default function (app: Application) {
new HandlerService(app, {});
@@ -156,7 +157,7 @@ export class EquipHandler {
// 装备升品
public async qualityUp(msg: { hid: number, ePlaceId: number, isOneClick: boolean }, session: BackendSession) {
let roleId: string = session.get('roleId');
// let roleName: string = session.get('roleName');
let roleName: string = session.get('roleName');
const serverId = session.get('serverId');
let sid: string = session.get('sid');
@@ -202,10 +203,11 @@ export class EquipHandler {
let isUpQuality = update.quality != curEquip.quality;
let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, update);
let { newEplace, updatedEplace, newEquip } = updateEplace(oldEplace, ePlaceId, update);
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_QUALITY, sid, roleId, hero, { ePlace: newEplace }, [ePlaceId]);
await checkTaskInEquipQualityUp(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, hid, isUpQuality);
pushEquipQualityMax(roleId, roleName, serverId, hid, newEquip, isUpQuality);
const curHero = {
hid,
isUpQuality,
@@ -218,7 +220,7 @@ export class EquipHandler {
// 装备升星
public async starUp(msg: { hid: number, ePlaceId: number, isOneClick: boolean }, session: BackendSession) {
let roleId: string = session.get('roleId');
// let roleName: string = session.get('roleName');
let roleName: string = session.get('roleName');
const serverId = session.get('serverId');
let sid: string = session.get('sid');
@@ -272,10 +274,11 @@ export class EquipHandler {
let result = await handleCost(roleId, sid, consumes, ITEM_CHANGE_REASON.EQUIP_STARUP);
if (!result) return resResult(STATUS.ROLE_MATERIAL_NOT_ENOUGH);
let { newEplace, updatedEplace } = updateEplace(oldEplace, ePlaceId, update);
let { newEplace, updatedEplace, newEquip } = updateEplace(oldEplace, ePlaceId, update);
hero = await calPlayerCeAndSave(HERO_SYSTEM_TYPE.EQUIP_STAR, sid, roleId, hero, { ePlace: newEplace }, [ePlaceId]);
await checkTaskInEquipStarUp(serverId, roleId, sid, oldEplace, newEplace, ePlaceId, hid, isUpStar);
pushEquipStarMax(roleId, roleName, serverId, hid, newEquip, isUpStar);
const curHero = {
hid,

View File

@@ -55,16 +55,18 @@ export function updateStone(origin: Stone[], id: number, target: number) {
export function updateEplace(eplace: EPlace[], eplaceId: number, update: Partial<EPlace>) {
let newEplace: EPlace[] = [];
let newEquip: EPlace;
let updatedEplace: Partial<EPlace>[] = [];
for(let equip of eplace) {
if(equip.id == eplaceId) {
newEplace.push({ ...equip, ...update });
newEquip = { ...equip, ...update };
updatedEplace.push({ id: equip.id, equipId: equip.equipId, ...update });
} else {
newEplace.push(equip);
}
}
return {newEplace, updatedEplace};
return {newEplace, updatedEplace, newEquip };
}
export function updateEplaces(eplace: EPlace[], update: Map<number, Partial<EPlace>>) {

View File

@@ -9,6 +9,7 @@ import { resResult } from '../pubUtils/util';
import { BossInstanceType } from '../db/BossInstance';
import { getSimpleRoleInfo } from './roleService';
import { GroupMessageType } from '../db/GroupMessage';
import { gameData } from '../pubUtils/data';
async function pushNormalHeroInfoBySource(roleId: string, roleName: string, serverId: number | string, source: number, heroInfo: Partial<HeroType>) {
const hero = pick(heroInfo, ['hName', 'hid', 'seqId', 'quality', 'star', 'starStage', 'colorStar', 'colorStarStage']);
@@ -39,6 +40,27 @@ export async function pushHeroWakeUp(roleId: string, roleName: string, serverId:
await pushNormalHeroInfoBySource(roleId, roleName, serverId, MSG_SOURCE.HERO_WAKE_UP, heroInfo);
}
// 装备升星到12星
export async function pushEquipStarMax(roleId: string, roleName: string, serverId: number, hid: number, equip: EPlace, isUpStar: boolean) {
const { id, equipId, star, } = equip;
if(!isUpStar || star != HERO_GROW_MAX.EQUIP_STAR) return;
const content = JSON.stringify({ roleId, roleName, hid, eplaceId: id, equipId, star });
const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.SYS, `${serverId}`, MSG_TYPE.RICH_TEXT, MSG_SOURCE.EQUIP_STAR_UP, content, null, null);
await pushGroupMsgToRoom(msgData);
return msgData;
}
// 装备升品到金色
export async function pushEquipQualityMax(roleId: string, roleName: string, serverId: number, hid: number, equip: EPlace, isUpQuality: boolean) {
const { id, equipId, quality, } = equip;
if(!isUpQuality || quality != HERO_GROW_MAX.EQUIP_QUALITY) return;
const content = JSON.stringify({ roleId, roleName, hid, eplaceId: id, equipId, quality });
const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.SYS, `${serverId}`, MSG_TYPE.RICH_TEXT, MSG_SOURCE.EQUIP_QUALITY_UP, content, null, null);
await pushGroupMsgToRoom(msgData);
return msgData;
}
export async function pushPresent(roleId: string, roleName: string, serverId: number | string, toRoleName: string, id: number) {
const content = JSON.stringify({ roleId, roleName, toRoleName, id });
@@ -88,16 +110,6 @@ export async function pushGuildBossSucMsg(roleId: string, roleName: string, guil
return msgData;
}
export async function pushEquipRefineSucMsg(roleId: string, roleName: string, serverId: number, eplace: Partial<EPlace>, quality: number) {
// const { id, lv, refineLv, equip } = eplace;
// const { id: equipId } = equip as EquipType;
// const data = { id, lv, refineLv, equipId, quality };
// const content = JSON.stringify({ roleId, roleName, eplace: data, equip: pick(equip, ['id', 'name', 'eplaceId', 'quality', 'holes', 'randMain', 'randSe', 'grade', 'hid']) });
// const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.SYS, `${serverId}`, MSG_TYPE.RICH_TEXT, MSG_SOURCE.EQUIP_REFINE_SUC, content, null, null);
// await pushGroupMsgToRoom(msgData);
// return msgData;
}
export async function pushNormalEquipMsg(roleId: string, roleName: string, serverId: number, source: number, id: number, name: string, quality: number) {
const content = JSON.stringify({ roleId, roleName, equip: { id, name, quality } });
const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.SYS, `${serverId}`, MSG_TYPE.RICH_TEXT, source, content, null, null);

View File

@@ -78,6 +78,8 @@ export const MSG_SOURCE = {
GROUP_SEND_GIFT: 22,
SEND_MARQUEE: 23,
GUILD_RECURIT: 24,
EQUIP_STAR_UP: 25,
EQUIP_QUALITY_UP: 26,
}
export const ON_PRIVATE_MSG_ROUTE = 'onPrivateMessage';

View File

@@ -35,7 +35,9 @@ export enum HERO_SYSTEM_TYPE {
export const HERO_GROW_MAX = {
STAR: 6,
COLORSTAR: 6,
QUALITY: 3
QUALITY: 3,
EQUIP_STAR: 12,
EQUIP_QUALITY: 5,
}
export const JOB_TYPE = {