军团活动:粮草先行还缺event记录和权限限制
This commit is contained in:
@@ -31,6 +31,7 @@ export class ChatRemote {
|
||||
|
||||
private channelService: ChannelService;
|
||||
private GUILD_ACTIVITY_END = 'onGuildActivityEnd';
|
||||
private RACE_ACTIVITY_START = 'onRaceStart';
|
||||
|
||||
/**
|
||||
* 加入世界频道(分服).
|
||||
@@ -166,7 +167,6 @@ export class ChatRemote {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @description 全服推送活动结束通知
|
||||
* @param serverId
|
||||
@@ -177,4 +177,15 @@ export class ChatRemote {
|
||||
if (!channel) return;
|
||||
channel.pushMessage(this.GUILD_ACTIVITY_END, resResult(STATUS.SUCCESS, { }));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 全服推送竞赛活动开始通知
|
||||
* @param serverId
|
||||
*/
|
||||
public async sendRaceActivityStart(serverId: number) {
|
||||
let roomId = groupRoomId(CHANNEL_PREFIX.WORLD, serverId);
|
||||
let channel = this.channelService.getChannel(roomId, false);
|
||||
if (!channel) return;
|
||||
channel.pushMessage(this.RACE_ACTIVITY_START, resResult(STATUS.SUCCESS, { }));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { GuildType } from '../../../db/Guild';
|
||||
import { RoleType } from '../../../db/Role';
|
||||
import { GuildRecType } from '../../../db/GuildRec';
|
||||
import { leaveGuildChannel, groupRoomId } from '../../../services/chatService';
|
||||
import { GuildGateRankParam } from '../../../domain/battleField/guildActivity';
|
||||
import { GuildRankParams, WoodenHorse, Event } from '../../../domain/battleField/guildActivity';
|
||||
|
||||
export default function (app: Application) {
|
||||
return new GuildRemote(app);
|
||||
@@ -31,6 +31,8 @@ export class GuildRemote {
|
||||
private GUILD_ACTIVITY_END = 'onGuildActivityEnd'; // 军团活动结束
|
||||
private GUILD_CITY_DECLARE = 'onGuildCityDeclare'; // 有军团对这个城池进行宣战了
|
||||
private GUILD_CITY_ACT_HP = 'onGuildCityGateHpUpdate'; // 诸侯入侵城门血条
|
||||
private GUILD_RACE_UPDATE = 'onRaceHorseUpdate'; /// 更新木牛流马
|
||||
private GUILD_RACE_EVENT = 'onRaceEventUpdate'; /// 更新木牛流马
|
||||
|
||||
/**
|
||||
* 封装,军团相关channel名: 'guild'+guildCode
|
||||
@@ -199,7 +201,7 @@ export class GuildRemote {
|
||||
* 向军团推送排行榜名次
|
||||
* @param guildCode
|
||||
*/
|
||||
public pushRank(guildCode: string, msg: GuildGateRankParam) {
|
||||
public pushRank(guildCode: string, msg: GuildRankParams) {
|
||||
this.pushMessage(guildCode, this.GATE_ACT_RANK, msg);
|
||||
}
|
||||
|
||||
@@ -207,7 +209,7 @@ export class GuildRemote {
|
||||
* 向军团推送排行榜名次
|
||||
* @param guildCode
|
||||
*/
|
||||
public pushCityActRank(guildCode: string, msg: GuildGateRankParam) {
|
||||
public pushCityActRank(guildCode: string, msg: GuildRankParams) {
|
||||
this.pushMessage(guildCode, this.CITY_ACT_RANK, msg);
|
||||
}
|
||||
|
||||
@@ -236,7 +238,8 @@ export class GuildRemote {
|
||||
|
||||
/**
|
||||
* @description 推送城池城门血条
|
||||
* @param guildCode
|
||||
* @param cityId 城池
|
||||
* @param gateHp 血条
|
||||
*/
|
||||
public async pushCityGateHp(cityId: number, gateHp: number ) {
|
||||
this.pushMessageToCity(cityId, this.GUILD_CITY_ACT_HP, {
|
||||
@@ -244,4 +247,28 @@ export class GuildRemote {
|
||||
gateHp
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 推送木牛流马状态
|
||||
* @param guildCode 军团
|
||||
* @param woodenHorseList 木马
|
||||
* @param ranks 军团排名和自己所在的排名
|
||||
*/
|
||||
public async pushRaceHorseUpdate(guildCode: string, woodenHorseList: WoodenHorse[], ranks: GuildRankParams, events: Event[] ) {
|
||||
this.pushMessage(guildCode, this.GUILD_RACE_UPDATE, {
|
||||
timestamp: Date.now(),
|
||||
woodenHorseList,
|
||||
...ranks,
|
||||
events
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 向军团推送事件
|
||||
* @param guildCode
|
||||
*/
|
||||
public async sendRaceEvent(guildCode: string, events: Event[]) {
|
||||
this.pushMessage(guildCode, this.GUILD_RACE_EVENT, { timestamp: Date.now(), events });
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user