public override void Process(CmdTrigger<RealmServerCmdArgs> trigger) { var wcellUser = trigger.Args.User as WCellUser; var chanName = trigger.Text.NextWord(); var targetUsr = trigger.Args.GetCharArgumentOrTarget(trigger, trigger.Text.NextWord()); ChannelMember me = new ChannelMember(wcellUser); ChatChannelGroup ircChannelGroup = new ChatChannelGroup(FactionGroup.Invalid); var chatChan = new ChatChannel(ircChannelGroup, chanName); chatChan.Invite(me, targetUsr); //ChatMgr.OnChat += new ChatNotifyDelegate(ChatMgr_OnChat); }
/// <summary> /// Creates a zone channel, which is a constant, non-moderated channel specific to one or more Zones. /// TODO: Fix: Channels exist per Zone instance /// </summary> internal ChatChannel CreateGeneralChannel(ZoneInfo zone) { var name = string.Format("General - {0}", zone.Name); ChatChannel channel; if (!m_Channels.TryGetValue(name, out channel)) { channel = new ChatChannel(this, name, GeneralFlags, true, null) { Announces = false }; m_Channels.Add(channel.Name, channel); } return channel; }
/// <summary> /// Send a packet to everyone on a channel that does not ignore the given sender. /// </summary> /// <param name="chan">the channel to which the packet is sent</param> /// <param name="packet">the packet to send</param> /// <param name="sender">sender (to check the ignore list)</param> public static void SendPacketToChannel(ChatChannel chan, RealmPacketOut packet, EntityId sender) { foreach (var member in chan.Members.Values) { if (!RelationMgr.Instance.HasRelation(member.User.EntityId.Low, sender.Low, CharacterRelationType.Ignored)) { member.User.Send(packet); } } }
void CreateChatChannels() { var alliance = ChatChannelGroup.Alliance; var horde = ChatChannelGroup.Horde; if (!Template.Flags.HasFlag(ZoneFlags.Arena)) { if (!Template.Flags.HasFlag(ZoneFlags.AlwaysContested)) { AllianceChatChannels.Add(m_allianceLocalDefenseChannel = alliance.CreateLocalDefenseChannel(Template)); HordeChatChannels.Add(m_hordeLocalDefenseChannel = horde.CreateLocalDefenseChannel(Template)); } AllianceChatChannels.Add(m_allianceGeneralChannel = alliance.CreateGeneralChannel(Template)); HordeChatChannels.Add(m_hordeGeneralChannel = horde.CreateGeneralChannel(Template)); } }
public static void SendVoiceData(ChatChannel chatChannel) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_VOICE_SESSION_ROSTER_UPDATE)) { } }
/// <summary> /// Send a packet to everyone on a channel. /// </summary> /// <param name="chan">the channel to which the packet is sent</param> /// <param name="packet">the packet to send</param> public static void SendPacketToChannel(ChatChannel chan, RealmPacketOut packet) { foreach (var member in chan.Members.Values) { member.User.Send(packet); } }
/// <summary> /// Send the moderate status change message to everyone /// </summary> /// <param name="chan">name of channel</param> /// <param name="sender">sender (status changer)</param> public static void SendModerateToEveryone(ChatChannel chan, EntityId sender) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_CHANNEL_NOTIFY)) { if (chan.IsModerated) { packet.WriteByte((byte)ChannelNotification.Moderated); } else { packet.WriteByte((byte)ChannelNotification.NotModerated); } packet.WriteCString(chan.Name); packet.Write(sender); SendPacketToChannel(chan, packet, sender); } }
/// <summary> /// Attempts to retrieve a specific channel. /// </summary> /// <param name="name">the name of the channel</param> /// <param name="create">whether or not to create the channel if it doesn't exist</param> /// <returns>the channel instance</returns> public ChatChannel GetChannel(string name, bool create) { if (Channels.ContainsKey(name)) { return Channels[name]; } if (create) { var chnl = new ChatChannel(this, name); m_Channels.Add(name, chnl); return chnl; } return null; }
/// <summary> /// Send the "name has joined channel" reply to everyone /// </summary> /// <param name="chan">name of channel</param> /// <param name="sender">sender (to check the ignore list)</param> public static void SendJoinedReplyToEveryone(ChatChannel chan, ChannelMember sender) { // the packet has the same size no matter the opcode, so it's really // a retarded way of doing it... but blame blizz. var opcode = chan.IsConstant ? RealmServerOpCode.SMSG_USERLIST_ADD : RealmServerOpCode.SMSG_USERLIST_UPDATE; using (RealmPacketOut packet = new RealmPacketOut(opcode)) { //packet.WriteByte((byte)ChannelNotification.PlayerJoined); packet.Write(sender.User.EntityId); packet.Write((byte)sender.Flags); packet.Write((byte)chan.ClientFlags); packet.WriteUInt(chan.MemberCount); packet.WriteCString(chan.Name); SendPacketToChannel(chan, packet, sender.User.EntityId); } }
/// <summary> /// Send the unbanned message to everyone /// </summary> /// <param name="chan">name of channel</param> /// <param name="sender">sender (aka unbanner)</param> /// <param name="unbanned">unbanned</param> public static void SendUnbannedToEveryone(ChatChannel chan, EntityId sender, EntityId unbanned) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_CHANNEL_NOTIFY)) { packet.WriteByte((byte)ChannelNotification.Unbanned); packet.WriteCString(chan.Name); packet.Write(sender); packet.Write(unbanned); SendPacketToChannel(chan, packet, sender); } }
/// <summary> /// Send the list of channel members /// </summary> /// <param name="client">the client the outdoing packet belongs to</param> /// <param name="chan">channel to be listed</param> public static void SendChannelList(IPacketReceiver client, ChatChannel chan) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_CHANNEL_LIST)) { packet.Write((byte)0x01); // unk - 0x03? packet.WriteCString(chan.Name); packet.Write((byte)chan.Flags); // Note: InsertIntAt might be used here later if we want // to do some sort of "GM shouldn't be included" check. packet.WriteUInt(chan.Members.Count); foreach (var mi in chan.Members.Values) { packet.Write(mi.User.EntityId); packet.Write((byte)mi.Flags); } client.Send(packet); } }
/// <summary> /// Send the name of current of the channel /// </summary> /// <param name="client">the client the outdoing packet belongs to</param> /// <param name="chan">the channel</param> public static void SendCurrentOwner(IPacketReceiver client, ChatChannel chan) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_CHANNEL_NOTIFY)) { packet.WriteByte((byte)ChannelNotification.CurrentOwner); packet.WriteCString(chan.Name); if (chan.IsConstant || chan.Owner == null) { packet.WriteCString("Nobody"); } else { packet.WriteCString(chan.Owner.User.Name); } client.Send(packet); } }
/// <summary> /// Send the "you have joined channel" reply /// </summary> /// <param name="client">the client the outdoing packet belongs to</param> /// <param name="chan">name of channel</param> public static void SendYouJoinedReply(IPacketReceiver client, ChatChannel chan) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_CHANNEL_NOTIFY)) { packet.WriteByte((byte)ChannelNotification.YouJoined); packet.WriteCString(chan.Name); packet.Write((byte)chan.Flags); packet.WriteUInt(chan.ChannelId); packet.WriteUInt(0); client.Send(packet); } }
/// <summary> /// Creates a zone channel, which is a constant, non-moderated channel specific to one or more Zones. /// </summary> internal ChatChannel CreateLocalDefenseChannel(ZoneTemplate zone) { var name = string.Format("LocalDefense - {0}", zone.Name); ChatChannel channel; if (!m_Channels.TryGetValue(name, out channel)) { channel = new ChatChannel(this, name, LocalDefenseFlags, true, null) { Announces = false }; m_Channels.Add(channel.Name, channel); } return channel; }
/// <summary> /// Send the announce status change message to everyone /// </summary> /// <param name="chan">name of channel</param> /// <param name="sender">sender (status changer)</param> /// <param name="newStatus">new announcements status</param> public static void SendAnnouncementToEveryone(ChatChannel chan, EntityId sender, bool newStatus) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_CHANNEL_NOTIFY)) { if (newStatus) { packet.WriteByte((byte)ChannelNotification.Announcing); } else { packet.WriteByte((byte)ChannelNotification.NotAnnouncing); } packet.WriteCString(chan.Name); packet.Write(sender); SendPacketToChannel(chan, packet, sender); } }
/// <summary> /// Deletes a channel. /// </summary> /// <param name="chnl">the channel to delete</param> public void DeleteChannel(ChatChannel chnl) { // TODO: Also delete zone-only channels from their array m_Channels.Remove(chnl.Name); }
/// <summary> /// Send the message about change of muted status of player to everyone /// </summary> /// <param name="chan">name of channel</param> /// <param name="sender">sender (to check the ignore list)</param> /// <param name="target">one who has changed his status</param> /// <param name="newStatus">the new status</param> public static void SendMuteStatusToEveryone(ChatChannel chan, EntityId sender, EntityId target, bool newStatus) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_CHANNEL_NOTIFY)) { packet.WriteByte((byte)ChannelNotification.Mute); packet.WriteCString(chan.Name); packet.Write(target); if (!newStatus) { packet.WriteByte(0x04); packet.WriteByte(0x00); } else { packet.WriteByte(0x00); packet.WriteByte(0x04); } SendPacketToChannel(chan, packet, sender); } }
public ChatChannel GetChannel(string name, uint channelId, bool create) { ChatChannel chn; if (!m_Channels.TryGetValue(name, out chn)) { if (create) { chn = new ChatChannel(this, channelId, name); m_Channels.Add(name, chn); } } return chn; }
public override void Process(CmdTrigger<RealmServerCmdArgs> trigger) { var ticket = trigger.Args.TicketHandler.HandlingTicket; if (ticket != null) { Character user = ticket.Owner; if (ticket.Owner == null) { trigger.Reply("The owner of this Ticket is offline."); } else { var me = new ChannelMember(trigger.Args.User); var ircChannel = new ChatChannelGroup(FactionGroup.Invalid); var chan = new ChatChannel(ircChannel); chan.Invite(me, user); //user.SendMessage(trigger.Args.User, // "A staff member wants to chat with you about your ticket. Please do not leave the channel."); } } else { trigger.Reply("You must have a ticket selected."); } }