void HandleServerChatMessage(PacketReader reader) { ChatType type = (ChatType)reader.ReadByte(); Language language; UInt64 targetGUID; UInt64 targetGUIDOther; UInt32 messageLength; string channelName = null; string message; language = (Language)reader.ReadUInt32(); targetGUID = reader.ReadUInt64(); reader.ReadUInt32(); // Some flags channelName = type == ChatType.CHAT_TYPE_CHANNEL ? reader.ReadCString() : null; targetGUIDOther = reader.ReadUInt64(); messageLength = reader.ReadUInt32(); message = reader.ReadCString(); reader.ReadByte(); // chattag PlayerName result = PlayerNameList.Find((PlayerName name) => { return(name.GUID == targetGUID); }); var args = new ChatArgs { Type = type, Message = message, ChannelName = channelName != null ? channelName : string.Empty, Name = result != null ? result.Name : string.Empty }; OnChatMessage?.Invoke(null, args); if (targetGUID > 0) { PacketWriter writer = new PacketWriter(Opcodes.CMSG_NAME_QUERY); writer.Write(targetGUID); Send(writer); } }
void HandleServerChatMessage(PacketReader reader) { ChatType type = (ChatType)reader.ReadByte(); Language language; UInt64 targetGUID; UInt64 targetGUIDOther; UInt32 messageLength; string channelName = null; string message; if ((type != ChatType.CHAT_TYPE_CHANNEL && type != ChatType.CHAT_TYPE_WHISPER)) { language = (Language)reader.ReadUInt32(); } else { language = (Language)reader.ReadUInt32(); } targetGUID = reader.ReadUInt64(); reader.ReadUInt32(); switch (type) { case ChatType.CHAT_TYPE_CHANNEL: channelName = reader.ReadCString(); break; } targetGUIDOther = reader.ReadUInt64(); messageLength = reader.ReadUInt32(); message = reader.ReadCString(); reader.ReadByte(); PlayerName result = PlayerNameList.Find( delegate(PlayerName playerName) { return(playerName.GUID == targetGUID); }); if (type == ChatType.CHAT_TYPE_SYSTEM) { foreach (string syntax in message.Split('\n')) { if (!CmdList.Contains(syntax)) // Prevent double message { CmdList.Add(syntax); } } } if (result != null) { QueryChatMessage.Type = type; QueryChatMessage.Message = message; QueryChatMessage.Name = result.Name; if (channelName != null) { QueryChatMessage.ChannelName = channelName; } ReceiveMsg = QueryChatMessage; } else { QueryChatMessage.Type = type; QueryChatMessage.Message = message; if (channelName != null) { QueryChatMessage.ChannelName = channelName; } } if (targetGUID > 0) { PacketWriter writer = new PacketWriter(Opcodes.CMSG_NAME_QUERY); writer.Write(targetGUID); Send(writer); } }
void HandleServerChatMessage(PacketReader reader) { ChatType type = (ChatType)reader.ReadByte(); Language language; UInt64 targetGUID; UInt64 targetGUIDOther; UInt32 messageLength; string channelName = null; string message; Debug.WriteLine($"{type}"); /*if ((type != ChatType.CHAT_TYPE_CHANNEL && type != ChatType.CHAT_TYPE_WHISPER)) * language = (Language)reader.ReadUInt32(); * else * language = (Language)reader.ReadUInt32();*/// What is this, its either way going to be read as language language = (Language)reader.ReadUInt32(); targetGUID = reader.ReadUInt64(); reader.ReadUInt32(); // Some flags switch (type) { case ChatType.CHAT_TYPE_CHANNEL: channelName = reader.ReadCString(); break; } targetGUIDOther = reader.ReadUInt64(); messageLength = reader.ReadUInt32(); message = reader.ReadCString(); reader.ReadByte(); // chattag PlayerName result = PlayerNameList.Find((PlayerName name) => { return(name.GUID == targetGUID); }); /*PlayerName result = PlayerNameList.Find( * delegate(PlayerName playerName) * { * return playerName.GUID == targetGUID; * });*/ if (type == ChatType.CHAT_TYPE_SYSTEM) { foreach (string syntax in message.Split('\n')) { if (!CmdList.Contains(syntax)) // Prevent double message { CmdList.Add(syntax); } } } if (result != null) { QueryChatMessage.Type = type; QueryChatMessage.Message = message; QueryChatMessage.Name = result.Name; if (channelName != null) { QueryChatMessage.ChannelName = channelName; } ReceiveMsg = QueryChatMessage; } else { QueryChatMessage.Type = type; QueryChatMessage.Message = message; if (channelName != null) { QueryChatMessage.ChannelName = channelName; } } if (targetGUID > 0) { PacketWriter writer = new PacketWriter(Opcodes.CMSG_NAME_QUERY); writer.Write(targetGUID); Send(writer); } }