public SmsgMessagechat(ChatMessageType type, ChatMessageLanguage language, ulong id, string message, string channelName = null) : base(RealmCMD.SMSG_MESSAGECHAT) { Write((byte)type); Write((uint)language); switch (type) { case ChatMessageType.CHAT_MSG_CHANNEL: Write(Encoding.UTF8.GetBytes(channelName + '\0')); // string => Channel Write((uint)0); //32 Write(id); //64 => SenderId break; case ChatMessageType.CHAT_MSG_YELL: case ChatMessageType.CHAT_MSG_SAY: case ChatMessageType.CHAT_MSG_PARTY: Write(id); // SenderId Write(id); // SenderId break; case ChatMessageType.CHAT_MSG_SYSTEM: case ChatMessageType.CHAT_MSG_EMOTE: case ChatMessageType.CHAT_MSG_IGNORED: case ChatMessageType.CHAT_MSG_SKILL: case ChatMessageType.CHAT_MSG_OFFICER: case ChatMessageType.CHAT_MSG_RAID: case ChatMessageType.CHAT_MSG_WHISPER_INFORM: case ChatMessageType.CHAT_MSG_GUILD: case ChatMessageType.CHAT_MSG_WHISPER: case ChatMessageType.CHAT_MSG_AFK: case ChatMessageType.CHAT_MSG_DND: case ChatMessageType.CHAT_MSG_RAID_LEADER: case ChatMessageType.CHAT_MSG_RAID_WARNING: Write(id); // SenderId break; default: Log.Print(LogType.Debug, $"Unknown chat message type - {type}!"); break; } Write((uint)message.Length + 1); Write(Encoding.UTF8.GetBytes(message + '\0')); // check flag of CHAR [0 = normal] [1 = AFK] [2 = DND] [3 = GM] Write((byte)0); // Flag???? }
public PSMessageChat(ChatMessageType type, ChatMessageLanguage language, ulong GUID, string message, string channelName = null) : base(WorldOpcodes.SMSG_MESSAGECHAT) { this.Write((byte)type); this.Write((uint)language); if (type == ChatMessageType.CHAT_MSG_CHANNEL) { this.Write(Encoding.UTF8.GetBytes(channelName + '\0')); this.Write((uint)0); } this.Write((ulong)GUID); if (type == ChatMessageType.CHAT_MSG_SAY || type == ChatMessageType.CHAT_MSG_YELL || type == ChatMessageType.CHAT_MSG_PARTY) { this.Write(GUID); } this.Write((uint)message.Length + 1); this.Write(Encoding.UTF8.GetBytes(message + '\0')); this.Write((byte)0); }
internal static void OnMessageChat(RealmServerSession session, PacketReader handler) { ChatMessageType msgType = (ChatMessageType)handler.ReadUInt32(); ChatMessageLanguage msgLanguage = (ChatMessageLanguage)handler.ReadUInt32(); string toUser = null; string channel = null; if (msgType == ChatMessageType.CHAT_MSG_CHANNEL) { channel = handler.ReadCString(); } if (msgType == ChatMessageType.CHAT_MSG_WHISPER) { toUser = handler.ReadCString(); } string message = handler.ReadCString(); // Call Commands new CommandsHelper(session, message); switch ((ChatMessageType)msgType) { case ChatMessageType.CHAT_MSG_SAY: case ChatMessageType.CHAT_MSG_YELL: case ChatMessageType.CHAT_MSG_EMOTE: session.SendPacket(new SmsgMessagechat(msgType, ChatMessageLanguage.LANG_UNIVERSAL, (ulong)session.Character.Id, message)); session.Entity.KnownPlayers.ForEach(s => s.Session.SendPacket(new SmsgMessagechat(msgType, ChatMessageLanguage.LANG_UNIVERSAL, (ulong)session.Character.Id, message))); break; case ChatMessageType.CHAT_MSG_WHISPER: try { RealmServerSession remoteSession = RealmServerSession.GetSessionByPlayerName(toUser); // Check if player is the same faction? // Send packet session.SendPacket(new SmsgMessagechat(ChatMessageType.CHAT_MSG_WHISPER_INFORM, ChatMessageLanguage.LANG_UNIVERSAL, (ulong)remoteSession.Character.Id, message)); remoteSession.SendPacket(new SmsgMessagechat(msgType, ChatMessageLanguage.LANG_UNIVERSAL, (ulong)session.Character.Id, message)); } catch (Exception e) { // Envia mensagem que nao achou Console.WriteLine($@"naoa chei nada {e.Message}"); } break; default: Console.WriteLine($@"veio aqui algo [{msgType}]"); session.SendPacket(new SmsgMessagechat(msgType, ChatMessageLanguage.LANG_UNIVERSAL, (ulong)session.Character.Id, message)); break; } /* * 2 - Raid * 3 - Guild * 4 - Officer * 6 - Whisper From * 7 - Whisper To * 8 - Emote * 9 - nao sei * 10 - Server * 17 - nao sei cinza * 20 - AFK * 21 - DND * 22 - Ignore * 23 - nao sei azul * 24 - verde * Write((byte) type); * Write((uint) msgLanguage); * Write(characterId); * Write((uint) message.Length + 1); * Write(Encoding.UTF8.GetBytes(message + '\0')); * Write((byte)0); // Flag???? * * 13 - ti´po emote * 26 - whispers: algo * Write((byte) type); * Write((uint) msgLanguage); * Write((uint) 0); * Write(characterId); * Write((uint) message.Length + 1); * Write(Encoding.UTF8.GetBytes(message + '\0')); * Write((byte) 0); // 0 = normal / 1 = AFK / 2 = DND / 3 = GM * * 11 - npc Says * 12 - npc Yells * Write((byte) type); * Write((uint) msgLanguage); * Write((uint) 0); * Write(characterId); * Write(characterId); * Write((uint) message.Length + 1); * Write(Encoding.UTF8.GetBytes(message + '\0')); * Write((byte) 0); // 0 = normal / 1 = AFK / 2 = DND / 3 = GM * * 0- say * 1 - party * 5 - yell * Write((byte) type); * Write((uint) msgLanguage); * Write(characterId); * Write(characterId); * Write((uint) message.Length + 1); * Write(Encoding.UTF8.GetBytes(message + '\0')); * Write((byte) 0); // 0 = normal / 1 = AFK / 2 = DND / 3 = GM */ }