活动:军团练兵场通过层数后推送
This commit is contained in:
@@ -34,6 +34,7 @@ export class GuildRemote {
|
||||
private GUILD_CITY_ACT_HP = 'onGuildCityGateHpUpdate'; // 诸侯入侵城门血条
|
||||
private GUILD_RACE_UPDATE = 'onRaceHorseUpdate'; /// 更新木牛流马
|
||||
private GUILD_RACE_EVENT = 'onRaceEventUpdate'; /// 更新木牛流马
|
||||
private GUILD_POP_UP_ACTIVITY = 'onActivityUpdate'; /// 向军团成员发送弹窗礼包
|
||||
|
||||
/**
|
||||
* 封装,军团相关channel名: 'guild'+guildCode
|
||||
@@ -54,15 +55,15 @@ export class GuildRemote {
|
||||
* @param message 推送信息
|
||||
* @param sid 玩家服
|
||||
*/
|
||||
private pushMessageByUids(guildCode: string, path: string, roleId: string, message: {code: string, roleId?: string}, sid?: string) {
|
||||
private pushMessageByUids(guildCode: string, path: string, roleId: string, message: { code: string, roleId?: string }, sid?: string) {
|
||||
|
||||
let channel = this.getChannel(guildCode);
|
||||
let uids = [];
|
||||
if(!sid) {
|
||||
if (!sid) {
|
||||
sid = channel && channel.getMember(roleId)['sid'];
|
||||
}
|
||||
if(sid) {
|
||||
uids.push({roleId, sid});
|
||||
if (sid) {
|
||||
uids.push({ roleId, sid });
|
||||
this.channelService.pushMessageByUids(path, resResult(STATUS.SUCCESS, message), uids);
|
||||
}
|
||||
return channel
|
||||
@@ -76,12 +77,12 @@ export class GuildRemote {
|
||||
*/
|
||||
private pushMessage(guildCode: string, path: string, message: any) {
|
||||
let channel = this.getChannel(guildCode);
|
||||
if(!!channel) {
|
||||
if (!!channel) {
|
||||
channel.pushMessage(path, resResult(STATUS.SUCCESS, message));
|
||||
}
|
||||
return channel
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 诸侯混战,按城池区分channel
|
||||
* @param cityId 城池id
|
||||
@@ -101,7 +102,7 @@ export class GuildRemote {
|
||||
*/
|
||||
private pushMessageToCity(cityId: number, path: string, message: any) {
|
||||
let channel = this.getCityChannel(cityId);
|
||||
if(!!channel) {
|
||||
if (!!channel) {
|
||||
channel.pushMessage(path, resResult(STATUS.SUCCESS, message));
|
||||
}
|
||||
return channel
|
||||
@@ -114,7 +115,7 @@ export class GuildRemote {
|
||||
* @param guild 军团信息
|
||||
* @param sid 玩家sid
|
||||
*/
|
||||
public memberQuit (guildCode: string, roleId: string, guild: GuildType, sid?: string) {
|
||||
public memberQuit(guildCode: string, roleId: string, guild: GuildType, sid?: string) {
|
||||
// 被踢出公会
|
||||
this.pushMessageByUids(guildCode, this.MEMBER_QUIT, roleId, {
|
||||
code: guildCode,
|
||||
@@ -130,8 +131,8 @@ export class GuildRemote {
|
||||
* @param guildCode 军团code
|
||||
*/
|
||||
public dismiss(guildCode: string) {
|
||||
let channel = this.pushMessage(guildCode, this.DISMISS, {code: guildCode});
|
||||
if(!!channel) {
|
||||
let channel = this.pushMessage(guildCode, this.DISMISS, { code: guildCode });
|
||||
if (!!channel) {
|
||||
channel.destroy();
|
||||
}
|
||||
}
|
||||
@@ -141,7 +142,7 @@ export class GuildRemote {
|
||||
* @param guildCode 军团code
|
||||
* @param info 军团相关信息
|
||||
*/
|
||||
public updateInfo (guildCode: string, info: any) {
|
||||
public updateInfo(guildCode: string, info: any) {
|
||||
this.pushMessage(guildCode, this.GUILD_INFO_UPDATE, info);
|
||||
}
|
||||
|
||||
@@ -152,9 +153,9 @@ export class GuildRemote {
|
||||
* @param newLeader 新的团长
|
||||
* @param oldLeaderId 旧团长
|
||||
*/
|
||||
public changeLeader (guildCode: string, managerCnt: number, newLeader: RoleType, oldLeaderId: string) {
|
||||
public changeLeader(guildCode: string, managerCnt: number, newLeader: RoleType, oldLeaderId: string) {
|
||||
let { roleId, roleName, frame, head, spine, lv, quitTime } = newLeader;
|
||||
this.updateInfo(guildCode, {managerCnt, leader: { roleId, roleName, frame, head, spine, lv, quitTime }});
|
||||
this.updateInfo(guildCode, { managerCnt, leader: { roleId, roleName, frame, head, spine, lv, quitTime } });
|
||||
this.demotion(guildCode, oldLeaderId);
|
||||
this.promotion(guildCode, roleId);
|
||||
}
|
||||
@@ -164,7 +165,7 @@ export class GuildRemote {
|
||||
* @param guildCode 军团code
|
||||
* @param roleId 旧团长id
|
||||
*/
|
||||
public demotion (guildCode: string, roleId: string) {
|
||||
public demotion(guildCode: string, roleId: string) {
|
||||
this.pushMessageByUids(guildCode, this.DEMOTION, roleId, {
|
||||
code: guildCode
|
||||
});
|
||||
@@ -175,7 +176,7 @@ export class GuildRemote {
|
||||
* @param guildCode 军团code
|
||||
* @param roleId 新团长id
|
||||
*/
|
||||
public promotion (guildCode: string, roleId: string) {
|
||||
public promotion(guildCode: string, roleId: string) {
|
||||
this.pushMessageByUids(guildCode, this.PROMOTION, roleId, {
|
||||
code: guildCode
|
||||
});
|
||||
@@ -185,9 +186,9 @@ export class GuildRemote {
|
||||
* 添加动态
|
||||
* @param guildRecType 动态
|
||||
*/
|
||||
public addRec (guildRecType: GuildRecType) {
|
||||
public addRec(guildRecType: GuildRecType) {
|
||||
let { guildCode, type, params, createTime } = guildRecType;
|
||||
this.pushMessage(guildCode, this.GUILD_REC_ADD, {type, params, createTime});
|
||||
this.pushMessage(guildCode, this.GUILD_REC_ADD, { type, params, createTime });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -229,7 +230,7 @@ export class GuildRemote {
|
||||
* @param declareGuildCode 宣战的军团code
|
||||
* @param declareCount 宣战数量
|
||||
*/
|
||||
public async sendGuildCityDeclare(cityId: number, declareGuildCode: string, declareCount: number ) {
|
||||
public async sendGuildCityDeclare(cityId: number, declareGuildCode: string, declareCount: number) {
|
||||
this.pushMessageToCity(cityId, this.GUILD_CITY_DECLARE, {
|
||||
cityId,
|
||||
declareGuildCode,
|
||||
@@ -242,7 +243,7 @@ export class GuildRemote {
|
||||
* @param cityId 城池
|
||||
* @param gateHp 血条
|
||||
*/
|
||||
public async pushCityGateHp(cityId: number, gateHp: number ) {
|
||||
public async pushCityGateHp(cityId: number, gateHp: number) {
|
||||
this.pushMessageToCity(cityId, this.GUILD_CITY_ACT_HP, {
|
||||
cityId,
|
||||
gateHp
|
||||
@@ -255,7 +256,7 @@ export class GuildRemote {
|
||||
* @param woodenHorseList 木马
|
||||
* @param ranks 军团排名和自己所在的排名
|
||||
*/
|
||||
public async pushRaceHorseUpdate(guildCode: string, woodenHorseList: WoodenHorse[], ranks: GuildRankParams, events: Event[] ) {
|
||||
public async pushRaceHorseUpdate(guildCode: string, woodenHorseList: WoodenHorse[], ranks: GuildRankParams, events: Event[]) {
|
||||
this.pushMessage(guildCode, this.GUILD_RACE_UPDATE, {
|
||||
timestamp: Date.now(),
|
||||
woodenHorseList,
|
||||
@@ -282,4 +283,13 @@ export class GuildRemote {
|
||||
public async pushBossOpen(guildCode: string, warId: number, bossHp: number, status: number) {
|
||||
this.pushMessage(guildCode, this.GUILD_BOSS_OPEN, { guildCode, warId, bossHp, status });
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 向军团推送弹窗礼包数据活动
|
||||
* @param guildCode
|
||||
*/
|
||||
public async sendPopUpActivity(guildCode: string, data: any[]) {
|
||||
console.log("sendPopUpActivity")
|
||||
this.pushMessage(guildCode, this.GUILD_POP_UP_ACTIVITY, data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user