/// <summary>Handles an incoming request of current owner</summary> /// <param name="client">the client the incoming packet belongs to</param> /// <param name="packet">the full packet</param> public static void HandleCurrentOwnerRequest(IRealmClient client, RealmPacketIn packet) { string channelName = packet.ReadCString(); ChatChannel chan = ChatChannel.EnsureModerator((IUser)client.ActiveCharacter, channelName); if (chan == null) { return; } ChannelHandler.SendCurrentOwner((IPacketReceiver)client, chan); }
/// <summary> /// Handles a request of toggling the announce mode of the channel /// </summary> /// <param name="client">the client the incoming packet belongs to</param> /// <param name="packet">the full packet</param> public static void HandleAnnouncementsRequest(IRealmClient client, RealmPacketIn packet) { string channelName = packet.ReadCString(); ChatChannel chan = ChatChannel.EnsureModerator((IUser)client.ActiveCharacter, channelName); if (chan == null) { return; } chan.Announces = !chan.Announces; ChannelHandler.SendAnnouncementToEveryone(chan, client.ActiveCharacter.EntityId, chan.Announces); }
/// <summary>Handles an incoming channel list request</summary> /// <param name="client">the client the incoming packet belongs to</param> /// <param name="packet">the full packet</param> public static void HandleListChannel(IRealmClient client, RealmPacketIn packet) { string str = packet.ReadCString(); ChatChannel chan = ChatChannelGroup.RetrieveChannel((IUser)client.ActiveCharacter, str); if (chan != null) { ChannelHandler.SendChannelList((IPacketReceiver)client, chan); } else { ChannelHandler.SendNotOnChannelReply((IPacketReceiver)client, str); } }
/// <summary> /// Handles a request of getting the number of members in a channel /// </summary> /// <param name="client">the client the incoming packet belongs to</param> /// <param name="packet">the full packet</param> public static void HandleMemberCountRequest(IRealmClient client, RealmPacketIn packet) { string channelName = packet.ReadCString(); Character activeCharacter = client.ActiveCharacter; if (activeCharacter == null) { ChannelHandler.SendMemberCountReply((IPacketReceiver)client, channelName, (byte)0, 0U); } else { ChatChannel chatChannel = ChatChannelGroup.RetrieveChannel((IUser)client.ActiveCharacter, channelName); if (chatChannel == null) { return; } ChannelHandler.SendMemberCountReply((IPacketReceiver)activeCharacter, chatChannel.Name, (byte)chatChannel.Flags, (uint)chatChannel.MemberCount); } }
/// <summary>Handles an incoming channel password change request</summary> /// <param name="client">the client the incoming packet belongs to</param> /// <param name="packet">the full packet</param> public static void HandlePasswordChange(IRealmClient client, RealmPacketIn packet) { string str1 = packet.ReadCString(); string str2 = packet.ReadCString(); ChannelMember member; ChatChannel chan = ChatChannel.EnsurePresence((IUser)client.ActiveCharacter, str1, out member); if (chan != null) { if (!member.IsModerator) { ChannelHandler.SendNotModeratorReply((IPacketReceiver)client, str1); } else { chan.Password = str2; ChannelHandler.SendPasswordChangedToEveryone(chan, client.ActiveCharacter.EntityId); } } else { ChannelHandler.SendNotOnChannelReply((IPacketReceiver)client, str1); } }