聊天:部分系统推送(宝石和藏宝图合成,秘境遗迹首通,天梯指定关)
This commit is contained in:
@@ -10,7 +10,7 @@ import { PrivateMessageModel, PrivateMessageParam, PrivateMessageType } from './
|
||||
import { GroupMessageParam, GroupMessageType } from '../db/GroupMessage';
|
||||
import { genCode, resResult } from '../pubUtils/util';
|
||||
import { pinus } from 'pinus';
|
||||
import { CHANNEL_PREFIX, MSG_CODE_LEN, MSG_SOURCE, MSG_STATUS, MSG_TYPE, ON_GROUP_MSG_ROUTE, ON_MSG_ROUTE, RICH_TEXT_TABLE, RECENT_PRIVATE_CHATS_CNT, MAX_PRIVATE_MSGS, RECENT_GROUP_MSGS_CNT } from '../consts';
|
||||
import { CHANNEL_PREFIX, MSG_CODE_LEN, MSG_SOURCE, MSG_STATUS, MSG_TYPE, ON_GROUP_MSG_ROUTE, ON_MSG_ROUTE, RICH_TEXT_TABLE, RECENT_PRIVATE_CHATS_CNT, MAX_PRIVATE_MSGS, RECENT_GROUP_MSGS_CNT, WAR_TYPE } from '../consts';
|
||||
import { addRedisChannel, getRoleOnlineInfo, redisChannelServer } from './redisService';
|
||||
import { crc32 } from 'crc';
|
||||
import { EPlace, HeroType } from '../db/Hero';
|
||||
@@ -325,6 +325,35 @@ export async function pushEquipComposeOrangeMsg(roleId: string, roleName: string
|
||||
return msgData;
|
||||
}
|
||||
|
||||
export async function pushTowerMsg(roleId: string, roleName: string, serverId: number, source: number, lv: number) {
|
||||
if (!shouldPushTowerMsg(lv)) return null;
|
||||
const content = JSON.stringify({ lv });
|
||||
const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.SYS, `${serverId}`, MSG_TYPE.RICH_TEXT, source, content, null, null);
|
||||
if (!msgData) return null;
|
||||
await pushGroupMsgToRoom(groupRoomId(CHANNEL_PREFIX.SYS, serverId), msgData);
|
||||
return msgData;
|
||||
}
|
||||
|
||||
async function pushGKFirstMsg(roleId: string, roleName: string, serverId: number, source: number, warType: number, warId: number) {
|
||||
const content = JSON.stringify({ warType, warId });
|
||||
const msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.SYS, `${serverId}`, MSG_TYPE.RICH_TEXT, source, content, null, null);
|
||||
if (!msgData) return null;
|
||||
await pushGroupMsgToRoom(groupRoomId(CHANNEL_PREFIX.SYS, serverId), msgData);
|
||||
return msgData;
|
||||
}
|
||||
|
||||
export async function pushMysteryFirstMsg(roleId: string, roleName: string, serverId: number, warType: number, warId: number) {
|
||||
if (warType !== WAR_TYPE.MYSTERY) return null;
|
||||
const result = await pushGKFirstMsg(roleId, roleName, serverId, MSG_SOURCE.MYSTERY_FIRST_SUC, warType, warId);
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function pushVestigeFirstMsg(roleId: string, roleName: string, serverId: number, warType: number, warId: number) {
|
||||
if (warType !== WAR_TYPE.VESTIGE) return null;
|
||||
const result = await pushGKFirstMsg(roleId, roleName, serverId, MSG_SOURCE.VESTIGE_FIRST_SUC, warType, warId);
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function roleChatInfos(roleId: string, roleName: string) {
|
||||
let result = await ChatInfoModel.findInfo(roleId);
|
||||
if (!result) {
|
||||
@@ -378,3 +407,8 @@ export async function recentGuildMsgs(guildCode: string, count?: number) {
|
||||
const result = await recentGroupMsgs(groupRoomId(CHANNEL_PREFIX.GUILD, guildCode), count);
|
||||
return result;
|
||||
}
|
||||
|
||||
export function shouldPushTowerMsg(lv: number) {
|
||||
// 100 层之后每 50 层触发
|
||||
return lv >= 100 && lv % 50 === 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user