public void OnMessageChatPacket(WorldSession session, PCMessageChat packet) { if (ChatHandlers.ContainsKey(packet.Type)) { ChatHandlers[packet.Type](session, packet); } }
public void OnSayYell(WorldSession session, PCMessageChat packet) { if (packet.Message[0].ToString() == Config.GetValue(ConfigSections.WORLD, ConfigValues.COMMAND_KEY)) { Core.ChatCommands.ExecuteCommand(session, packet.Message); } else { Server.TransmitToAll(new PSMessageChat(packet.Type, ChatMessageLanguage.LANG_UNIVERSAL, session.Player.ObjectGUID.RawGUID, packet.Message)); } }
public void OnWhisper(WorldSession session, PCMessageChat packet) { WorldSession remoteSession = Server.GetSessionByPlayerName(packet.To); if (remoteSession != null) { session.SendPacket(new PSMessageChat(ChatMessageType.CHAT_MSG_WHISPER_INFORM, ChatMessageLanguage.LANG_UNIVERSAL, remoteSession.Player.ObjectGUID.RawGUID, packet.Message)); remoteSession.SendPacket(new PSMessageChat(ChatMessageType.CHAT_MSG_WHISPER, ChatMessageLanguage.LANG_UNIVERSAL, session.Player.ObjectGUID.RawGUID, packet.Message)); } else { session.SendMessage("Player not found."); } }
private void OnChannelMessage(WorldSession session, PCMessageChat packet) { var channel = ChatChannels.SingleOrDefault(c => c.Name == packet.ChannelName); channel.Sessions.ForEach(s => s.SendPacket(new PSMessageChat(ChatMessageType.CHAT_MSG_CHANNEL, ChatMessageLanguage.LANG_UNIVERSAL, session.Player.ObjectGUID.RawGUID, packet.Message, packet.ChannelName))); }