✨ feat(comBattle): 寻宝邀请的推送范围由世界改为军团
This commit is contained in:
@@ -689,13 +689,14 @@ export class ComBattleHandler {
|
|||||||
async autoInvite(msg: { teamCode: string }, session: BackendSession) {
|
async autoInvite(msg: { teamCode: string }, session: BackendSession) {
|
||||||
let roleId = session.get('roleId');
|
let roleId = session.get('roleId');
|
||||||
let roleName = session.get('roleName');
|
let roleName = session.get('roleName');
|
||||||
let serverId = session.get('serverId');
|
|
||||||
let guildCode = session.get('guildCode');
|
let guildCode = session.get('guildCode');
|
||||||
|
if (!guildCode) return resResult(STATUS.COM_BATTLE_INVITE_GUILD_ERR);
|
||||||
|
|
||||||
const { teamCode } = msg;
|
const { teamCode } = msg;
|
||||||
let teamStatus = this.teamMap.get(teamCode);
|
let teamStatus = this.teamMap.get(teamCode);
|
||||||
if(!teamStatus) return resResult(STATUS.WRONG_PARMS);
|
if(!teamStatus) return resResult(STATUS.WRONG_PARMS);
|
||||||
await pushTeamInviteMsg(roleId, roleName, serverId, teamCode, teamStatus.blueprtId, teamStatus.lv, teamStatus.ceLimit);
|
await pushTeamInviteMsg(roleId, roleName, guildCode, teamCode, teamStatus.blueprtId, teamStatus.lv, teamStatus.ceLimit);
|
||||||
await ComBattleTeamModel.invite(teamCode, 'world');
|
await ComBattleTeamModel.invite(teamCode, guildCode);
|
||||||
return resResult(STATUS.SUCCESS);
|
return resResult(STATUS.SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -708,6 +709,7 @@ export class ComBattleHandler {
|
|||||||
async inviteTeammate(msg: { teamCode: string, targetRoleId: string }, session: BackendSession) {
|
async inviteTeammate(msg: { teamCode: string, targetRoleId: string }, session: BackendSession) {
|
||||||
let roleId = session.get('roleId');
|
let roleId = session.get('roleId');
|
||||||
let roleName = session.get('roleName');
|
let roleName = session.get('roleName');
|
||||||
|
let guildCode = session.get('guildCode');
|
||||||
const { teamCode, targetRoleId } = msg;
|
const { teamCode, targetRoleId } = msg;
|
||||||
|
|
||||||
let teamStatus = this.teamMap.get(teamCode);
|
let teamStatus = this.teamMap.get(teamCode);
|
||||||
@@ -764,12 +766,13 @@ export class ComBattleHandler {
|
|||||||
|
|
||||||
async getTeamInvitation(msg: { }, session: BackendSession) {
|
async getTeamInvitation(msg: { }, session: BackendSession) {
|
||||||
let roleId = session.get('roleId');
|
let roleId = session.get('roleId');
|
||||||
|
let guildCode = session.get('guildCode');
|
||||||
let role = await RoleModel.findByRoleId(roleId, 'lv topLineupCe');
|
let role = await RoleModel.findByRoleId(roleId, 'lv topLineupCe');
|
||||||
const assistCnt = await getAllAssistCnt(roleId);
|
const assistCnt = await getAllAssistCnt(roleId);
|
||||||
|
|
||||||
let { minLv, maxLv } = getComBtlLvByPlayerLv(role.lv);
|
let { minLv, maxLv } = getComBtlLvByPlayerLv(role.lv);
|
||||||
let refreshTime = nowSeconds() - INFO_WINDOW.TEAM_INFORMATION_TIME;
|
let refreshTime = nowSeconds() - INFO_WINDOW.TEAM_INFORMATION_TIME;
|
||||||
const invitations = await ComBattleTeamModel.findInvitations(roleId, minLv, maxLv, role.topLineupCe, refreshTime, INFO_WINDOW.TEAM_VIEW);
|
const invitations = await ComBattleTeamModel.findInvitations(roleId, guildCode, minLv, maxLv, role.topLineupCe, refreshTime, INFO_WINDOW.TEAM_VIEW);
|
||||||
let roleIds = invitations.map(cur => cur.capId);
|
let roleIds = invitations.map(cur => cur.capId);
|
||||||
let roles = await RoleModel.findByRoleIds(roleIds);
|
let roles = await RoleModel.findByRoleIds(roleIds);
|
||||||
let myFriendRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.NOT);
|
let myFriendRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.NOT);
|
||||||
|
|||||||
@@ -419,12 +419,10 @@ export async function delPrivateMsg(roleId: string, targetRoleId: string) {
|
|||||||
* @description 发送组队一键邀请消息
|
* @description 发送组队一键邀请消息
|
||||||
* @param {string} teamCode 队伍唯一标识
|
* @param {string} teamCode 队伍唯一标识
|
||||||
*/
|
*/
|
||||||
export async function pushTeamInviteMsg(roleId: string, roleName: string, serverId: number, teamCode: string, blueprtId: number, blueprtLv: number, ceLimit: number) {
|
export async function pushTeamInviteMsg(roleId: string, roleName: string, guildCode: string, teamCode: string, blueprtId: number, blueprtLv: number, ceLimit: number) {
|
||||||
let msgDataWorld = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.WORLD, `${serverId}`, MSG_TYPE.RICH_TEXT, MSG_SOURCE.TEAM_INVITE, JSON.stringify({ roleName, teamCode, blueprtId }), null, null);
|
let msgData = await createGroupMsg(roleId, roleName, CHANNEL_PREFIX.GUILD, guildCode, MSG_TYPE.RICH_TEXT, MSG_SOURCE.TEAM_INVITE, JSON.stringify({ roleName, teamCode, blueprtId }), null, null);
|
||||||
await pushGroupMsgToAll(msgDataWorld, (data: {lv: number, topLineupCe: number}) => {
|
await pushGroupMsgToRoom(msgData);
|
||||||
return data.topLineupCe >= ceLimit && !comBtlLvInvalid(data.lv, [blueprtLv]);
|
return { msgData };
|
||||||
});
|
|
||||||
return { msgDataWorld };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ export async function getModuleData(type: string, data: { role: RoleType, sessio
|
|||||||
case 'tower': // 镇念塔
|
case 'tower': // 镇念塔
|
||||||
return await getTowerEntryData(role);
|
return await getTowerEntryData(role);
|
||||||
case 'comBattle': // 寻宝
|
case 'comBattle': // 寻宝
|
||||||
return await getComBattleEntryData(role);
|
return await getComBattleEntryData(role, guildCode);
|
||||||
case 'dungeon': // 秘境
|
case 'dungeon': // 秘境
|
||||||
return await getDungeonData(role);
|
return await getDungeonData(role);
|
||||||
case 'pvp': // pvp
|
case 'pvp': // pvp
|
||||||
@@ -312,13 +312,13 @@ async function getGuildEntryData(role: RoleType, sid: string, session: FrontendO
|
|||||||
return { hasGuild: false }
|
return { hasGuild: false }
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getComBattleEntryData(role: RoleType) {
|
async function getComBattleEntryData(role: RoleType, guildCode: string) {
|
||||||
let { roleId, lv, topLineupCe } = role;
|
let { roleId, lv, topLineupCe } = role;
|
||||||
const assistCnt = await getAllAssistCnt(roleId);
|
const assistCnt = await getAllAssistCnt(roleId);
|
||||||
const blueprts = await Item.findByRoleAndType(roleId, CONSUME_TYPE.BLUEPRT);
|
const blueprts = await Item.findByRoleAndType(roleId, CONSUME_TYPE.BLUEPRT);
|
||||||
let { minLv, maxLv } = getComBtlLvByPlayerLv(lv);
|
let { minLv, maxLv } = getComBtlLvByPlayerLv(lv);
|
||||||
let refreshTime = nowSeconds() - INFO_WINDOW.TEAM_INFORMATION_TIME;
|
let refreshTime = nowSeconds() - INFO_WINDOW.TEAM_INFORMATION_TIME;
|
||||||
const invitations = await ComBattleTeamModel.findInvitations(roleId, minLv, maxLv, topLineupCe, refreshTime, 1);
|
const invitations = await ComBattleTeamModel.findInvitations(roleId, guildCode, minLv, maxLv, topLineupCe, refreshTime, 1);
|
||||||
let capExtraCnt = await getCapExtraCnt(roleId);
|
let capExtraCnt = await getCapExtraCnt(roleId);
|
||||||
return { assistCnt, blueprts, hasInvitation: invitations.length > 0, invitationTime: invitations.length > 0?invitations[0].inviteTime: 0, capExtraCnt }
|
return { assistCnt, blueprts, hasInvitation: invitations.length > 0, invitationTime: invitations.length > 0?invitations[0].inviteTime: 0, capExtraCnt }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ export const STATUS = {
|
|||||||
COM_BATTLE_INVITE_LV_NOT_ENOUGH: { code: 20638, simStr: '对方队伍等级不足,无法邀请' },
|
COM_BATTLE_INVITE_LV_NOT_ENOUGH: { code: 20638, simStr: '对方队伍等级不足,无法邀请' },
|
||||||
COM_BATTLE_INVITE_CE_LIMIT: { code: 20639, simStr: '对方队伍战力不足,无法邀请' },
|
COM_BATTLE_INVITE_CE_LIMIT: { code: 20639, simStr: '对方队伍战力不足,无法邀请' },
|
||||||
COM_BATTLE_RETREAT_ERR: { code: 20640, simStr: '队伍不止单人,不允许撤退' },
|
COM_BATTLE_RETREAT_ERR: { code: 20640, simStr: '队伍不止单人,不允许撤退' },
|
||||||
|
COM_BATTLE_INVITE_GUILD_ERR: { code: 20641, simStr: '需要先加入军团才能一键邀请' },
|
||||||
// 共斗藏宝图合成
|
// 共斗藏宝图合成
|
||||||
COM_BLUEPRT_QUALITY_CANNOT_COMPOSE: { code: 20650, simStr: '该品质藏宝图不可合成' },
|
COM_BLUEPRT_QUALITY_CANNOT_COMPOSE: { code: 20650, simStr: '该品质藏宝图不可合成' },
|
||||||
COM_BLUEPRT_COUNT_ERROR: { code: 20651, simStr: '材料数量不足' },
|
COM_BLUEPRT_COUNT_ERROR: { code: 20651, simStr: '材料数量不足' },
|
||||||
|
|||||||
@@ -399,8 +399,8 @@ export default class ComBattleTeam extends BaseModel {
|
|||||||
return team;
|
return team;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async findInvitations(roleId: string, minLv: number, maxLv: number, ce: number, refreshTime: number, limit: number) {
|
public static async findInvitations(roleId: string, guildCode: string, minLv: number, maxLv: number, ce: number, refreshTime: number, limit: number) {
|
||||||
const invitations: ComBattleTeamType[] = await ComBattleTeamModel.find({ inviteTarget: { $in: ['world', roleId] },status: 0, isInviting: true, lv: { $gte: minLv, $lte: maxLv }, ceLimit: { $lte: ce }, inviteTime: { $gte: refreshTime } }).sort({ inviteTime: -1 }).limit(limit).lean();
|
const invitations: ComBattleTeamType[] = await ComBattleTeamModel.find({ inviteTarget: { $in: [guildCode, roleId] },status: 0, isInviting: true, lv: { $gte: minLv, $lte: maxLv }, ceLimit: { $lte: ce }, inviteTime: { $gte: refreshTime } }).sort({ inviteTime: -1 }).limit(limit).lean();
|
||||||
return invitations;
|
return invitations;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user