예제 #1
0
        /// <summary>
        /// Creates a packet
        /// </summary>
        public static RealmPacketOut CreateChatPacket(ChatMsgType type, ChatLanguage language, string msg, ChatTag tag)
        {
            var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT, 23 + msg.Length);
            packet.WriteByte((byte)type);			// 1
            packet.WriteUInt((uint)language);		// 5
            packet.WriteUIntPascalString(msg);			// 22 + msg.Length
            packet.WriteByte((byte)tag);			// 23 + msg.Length

            return packet;
        }
예제 #2
0
        /// <summary>
        /// Creates a packet
        /// </summary>
        public static RealmPacketOut CreateChatPacket(ChatMsgType type, ChatLanguage language, string msg, ChatTag tag)
        {
            var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT, 23 + msg.Length);

            packet.WriteByte((byte)type);                               // 1
            packet.WriteUInt((uint)language);                           // 5
            packet.WriteUIntPascalString(msg);                          // 22 + msg.Length
            packet.WriteByte((byte)tag);                                // 23 + msg.Length

            return(packet);
        }
예제 #3
0
        /// <summary>
        /// Creates a chat message packet for a non-player object.
        /// </summary>
        /// <param name="type">the type of chat message</param>
        /// <param name="language">the language the message is in</param>
        /// <param name="obj">the object "saying" the message</param>
        /// <param name="msg">the message itself</param>
        /// <param name="tag">any chat tags for the object</param>
        /// <returns>the generated chat packet</returns>
        private static RealmPacketOut CreateObjectChatMessage(ChatMsgType type,
                                                              ChatLanguage language, INamedEntity obj, string msg, ChatTag tag)
        {
            var packet = CreateObjectChatMessage(type, language, obj);

            //packet.Write(obj.EntityId);
            packet.WriteUIntPascalString(msg);                                                                                                                          // 30 + nameLength + msg.Length
            packet.Write((byte)tag);                                                                                                                                    // 31 + ...

            return(packet);
        }
예제 #4
0
        /// <summary>
        /// Parses any incoming party or raid messages.
        /// </summary>
        /// <param name="sender">The character sending the message</param>
        /// <param name="type">the type of chat message indicated by the client</param>
        /// <param name="language">the chat language indicated by the client</param>
        /// <param name="packet">the actual chat message packet</param>
        private static void GroupParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
        {
            var msg = ReadMessage(packet);

            if (msg.Length == 0)
            {
                return;
            }

            SayGroup(sender, language, msg);
        }
예제 #5
0
        /// <summary>
        /// Parses any incoming say, yell, or emote messages.
        /// </summary>
        /// <param name="type">the type of chat message indicated by the client</param>
        /// <param name="language">the chat language indicated by the client</param>
        /// <param name="packet">the actual chat message packet</param>
        private static void SayYellEmoteParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
        {
            var msg = ReadMessage(packet);

            if (msg.Length == 0)
            {
                return;
            }

            SayYellEmote(sender, type, language, msg, type == ChatMsgType.Yell ? YellRadius : ListeningRadius);
        }
예제 #6
0
        /// <summary>
        /// Sends a monster message.
        /// </summary>
        /// <param name="obj">the monster the message is being sent from</param>
        /// <param name="chatType">the type of message</param>
        /// <param name="language">the language to send the message in</param>
        /// <param name="message">the message to send</param>
        /// <param name="radius">The radius or -1 to be heard by everyone in the Map</param>
        public static void SendMonsterMessage(WorldObject obj, ChatMsgType chatType, ChatLanguage language, string message, float radius)
        {
            if (obj == null || !obj.IsAreaActive)
            {
                return;
            }

            using (var packetOut = CreateObjectChatMessage(chatType, language, obj, message, obj is Unit ? ((Unit)obj).ChatTag : ChatTag.None))
            {
                obj.SendPacketToArea(packetOut, radius, true);
            }
        }
예제 #7
0
        /// <summary>
        /// Check if a Character forgave an Ambusher
        /// </summary>
        static void CheckAmbusherRelease(IChatter chatter, string message,
                                         ChatLanguage lang, ChatMsgType chatType, IGenericChatTarget target)
        {
            if (chatter is Character)                   // make sures its a Character (could also be a broadcast or an IRC bot etc)
            {
                var chr      = (Character)chatter;
                var selected = chr.Target as NPC;
                if (selected != null &&
                    selected.FactionId == FactionId.Friendly &&                                                 // Ambusher is frienddly
                    selected.FirstAttacker == chr &&                                                            // Ambusher was tagged by Chr
                    selected.Entry.NPCId == NPCId.WitchwingAmbusher &&                                          // Chr selected the ambusher
                    (chatType == ChatMsgType.Say || chatType == ChatMsgType.Yell) &&                            // Chr speaks out loud
                    message == "I forgive thee!")                                                               // Chr says the right words
                {
                    if (!selected.IsInFrontOf(chr))
                    {
                        // the char was not talking towards the ambusher
                        selected.Say("What? I couldn't hear you!");
                    }
                    else
                    {
                        // The Killer has forgiven the Ambusher

                        // Standup
                        selected.StandState = StandState.Stand;

                        // delay (because standing up takes time)
                        selected.CallDelayed(800, obj => {
                            if (selected.IsInWorld)                             // ensure that Chr and selected didn't disappear in the meantime
                            {
                                if (chr.IsInWorld)
                                {
                                    selected.Yell("Thank you so much! - Now I can leave this place.");
                                }

                                selected.Emote(EmoteType.SimpleApplaud);

                                selected.CallDelayed(1000, obj2 => {
                                    if (selected.IsInWorld)
                                    {
                                        // Finally die
                                        selected.Kill();
                                    }
                                });
                            }
                        });
                    }
                }
            }
        }
예제 #8
0
        private static RealmPacketOut CreateObjectChatMessage(ChatMsgType type, ChatLanguage language, INamedEntity obj)
        {
            var name = obj.Name;

            var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT, 31 + name.Length + 50);

            packet.Write((byte)type);                                                                                                                           // 1
            packet.Write((uint)language);                                                                                                                       // 5
            packet.Write(obj.EntityId);                                                                                                                         // 13
            packet.Write(0);                                                                                                                                    // 17
            packet.WriteUIntPascalString(name);                                                                                                                 // 21 + nameLength
            packet.Write((long)0);                                                                                                                              // 29 + nameLength
            //packet.Write(obj.EntityId);

            return(packet);
        }
예제 #9
0
        public MsgSendResult SendChatMessage <T>(ChatMsgType msgtype, string receivers, T msgbody, string extinfo = null) where T : ChatMessageBody
        {
            if (String.IsNullOrEmpty(receivers))
            {
                throw new BusinessException("消息接收人不能为空");
            }

            var param = new Dictionary <string, string>();

            param.Add("accesstoken", _accessToken);
            param.Add("msgtype", ((int)msgtype).ToString());
            param.Add("msgbody", Newtonsoft.Json.JsonConvert.SerializeObject(msgbody));
            param.Add("receivers", receivers.Trim());
            param.Add("extinfo", extinfo);

            return(Common.WebApiHelper.Post <MsgSendResult>(_imApiServer + "/message/send", param.AsHttpParams()));
        }
예제 #10
0
        /// <summary>
        /// Parses any incoming channel messages.
        /// </summary>
        /// <param name="type">the type of chat message indicated by the client</param>
        /// <param name="language">the chat language indicated by the client</param>
        /// <param name="packet">the actual chat message packet</param>
        private static void ChannelParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
        {
            var channel = packet.ReadCString();
            var message = packet.ReadCString();

            if (RealmCommandHandler.HandleCommand(sender, message, sender.Target as Character))
            {
                return;
            }

            var chan = ChatChannelGroup.RetrieveChannel(sender, channel);

            if (chan == null)
            {
                return;
            }

            chan.SendMessage(sender, message);
        }
예제 #11
0
        /// <summary>
        /// Creates a chat message packet for a player.
        /// </summary>
        /// <param name="type">the type of chat message</param>
        /// <param name="language">the language the message is in</param>
        /// <param name="id1">the ID of the chatter</param>
        /// <param name="id2">the ID of the receiver</param>
        /// <param name="target">the target or null (if its an area message)</param>
        /// <param name="msg">the message itself</param>
        /// <param name="tag">the chat tag of the chatter</param>
        /// <returns>Might return null</returns>
        private static RealmPacketOut CreateCharChatMessage(ChatMsgType type, ChatLanguage language, EntityId id1, EntityId id2,
                                                            string target, string msg, ChatTag tag)
        {
            var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT);

            packet.Write((byte)type);
            packet.Write((uint)language);
            packet.Write(id1);
            packet.Write(0);
            if (target != null)
            {
                packet.WriteUIntPascalString(target);
            }
            packet.Write(id2);
            packet.WriteUIntPascalString(msg);
            packet.Write((byte)tag);

            return(packet);
        }
예제 #12
0
        private static void AFKParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
        {
            var reason = packet.ReadCString();

            if (type == ChatMsgType.AFK)
            {
                // flip their AFK flag
                sender.IsAFK = !sender.IsAFK;

                sender.AFKReason = (sender.IsAFK ? reason : "");
            }

            if (type == ChatMsgType.DND)
            {
                // flip their DND flag
                sender.IsDND = !sender.IsDND;

                sender.DNDReason = (sender.IsDND ? reason : "");
            }
        }
예제 #13
0
        /// <summary>
        /// Parses any incoming officer message.
        /// </summary>
        /// <param name="sender">The character sending the message</param>
        /// <param name="type">the type of chat message indicated by the client</param>
        /// <param name="language">the chat language indicated by the client</param>
        /// <param name="packet">the actual chat message packet</param>
        private static void OfficerParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
        {
            string msg = ReadMessage(packet);

            if (msg.Length == 0)
            {
                return;
            }

            if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character))
            {
                return;
            }

            /*var guild = Guild.CheckPrivs(sender, GuildCommandId.MEMBER, GuildPrivileges.GCHATSPEAK);
             * if (guild != null)
             * {
             *      SendGuildOfficerMessage(sender, guild, msg);
             * }*/
        }
예제 #14
0
        public static void SendMonsterMessage(WorldObject chatter, ChatMsgType chatType, ChatLanguage language, string[] localizedMsgs, float radius)
        {
            if (chatter == null || !chatter.IsAreaActive)
            {
                return;
            }

            using (var packet = CreateObjectChatMessage(chatType, language, chatter))
            {
                chatter.IterateEnvironment(radius, obj =>
                {
                    if (obj is Character)
                    {
                        packet.WriteUIntPascalString(localizedMsgs.Localize(((Character)obj).Client.Info.Locale));
                        packet.Write((byte)(chatter is Unit ? ((Unit)chatter).ChatTag : ChatTag.None));

                        ((Character)obj).Send(packet.GetFinalizedPacket());
                    }
                    return(true);
                });
            }
        }
예제 #15
0
        /// <summary>
        /// Parses any incoming party or raid messages.
        /// </summary>
        /// <param name="sender">The character sending the message</param>
        /// <param name="type">the type of chat message indicated by the client</param>
        /// <param name="language">the chat language indicated by the client</param>
        /// <param name="packet">the actual chat message packet</param>
        private static void SubGroupParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
        {
            string msg = ReadMessage(packet);

            if (msg.Length == 0)
            {
                return;
            }

            if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character))
            {
                return;
            }

            var group = sender.SubGroup;

            if (group != null)
            {
                using (var packetOut = CreateCharChatMessage(type, ChatLanguage.Universal, sender, sender, null, msg))
                {
                    group.Send(packetOut, null);
                }
            }
        }
예제 #16
0
		public static void SayYellEmote(this Character sender, ChatMsgType type, ChatLanguage language, string msg, float radius)
		{
			if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character))
				return;

			if (type != ChatMsgType.WhisperInform && msg.Length == 0)
			{
				return;
			}

			if (GlobalChat)
			{
				using (var packetOut = CreateCharChatMessage(type, language, sender.EntityId, sender.EntityId, null, msg, sender.ChatTag))
				{
					foreach (var chr in World.GetAllCharacters())
					{
						chr.Send(packetOut);
					}
				}
			}
			else
			{
				var faction = sender.FactionGroup;
				RealmPacketOut pckt = null, scrambledPckt = null;

				var scrambleDefault = ScrambleChat && sender.Role.ScrambleChat;
				Func<WorldObject, bool> iterator = obj =>
				{
					if ((obj is Character))
					{
						var chr = (Character)obj;
						if (!scrambleDefault || chr.FactionGroup == faction || !chr.Role.ScrambleChat)
						{
							if (pckt == null)
							{
								pckt = CreateCharChatMessage(type, language, sender.EntityId, sender.EntityId, null, msg, sender.ChatTag);
							}
							chr.Send(pckt);
						}
						else
						{
							if (scrambledPckt == null)
							{
								scrambledPckt = CreateCharChatMessage(type, language, sender.EntityId, sender.EntityId, null,
																	  ScrambleMessage(msg), sender.ChatTag);
							}
							chr.Send(scrambledPckt);
						}
					}
					return true;
				};

				if (radius == WorldObject.BroadcastRange)
				{
					sender.NearbyObjects.Iterate(iterator);
				}
				else
				{
					sender.IterateEnvironment(radius, iterator);
				}

				if (pckt != null)
				{
					pckt.Close();
				}
				if (scrambledPckt != null)
				{
					scrambledPckt.Close();
				}
			}
		}
예제 #17
0
		/// <summary>
		/// Parses any incoming say, yell, or emote messages.
		/// </summary>
		/// <param name="type">the type of chat message indicated by the client</param>
		/// <param name="language">the chat language indicated by the client</param>
		/// <param name="packet">the actual chat message packet</param>
		private static void SayYellEmoteParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
		{
			var msg = ReadMessage(packet);
			if (msg.Length == 0)
				return;

			SayYellEmote(sender, type, language, msg, type == ChatMsgType.Yell ? YellRadius : ListeningRadius);
		}
예제 #18
0
 /// <summary>
 /// Sends a monster message.
 /// </summary>
 /// <param name="obj">the monster the message is being sent from</param>
 /// <param name="chatType">the type of message</param>
 /// <param name="language">the language to send the message in</param>
 /// <param name="message">the message to send</param>
 public static void SendMonsterMessage(WorldObject obj, ChatMsgType chatType, ChatLanguage language, string[] localizedMsgs)
 {
     SendMonsterMessage(obj, chatType, language, localizedMsgs, chatType == ChatMsgType.MonsterYell ? YellRadius : ListeningRadius);
 }
예제 #19
0
		/// <summary>
		/// Creates a chat message packet for a player.
		/// </summary>
		/// <param name="type">the type of chat message</param>
		/// <param name="language">the language the message is in</param>
		/// <param name="id1">the ID of the chatter</param>
		/// <param name="id2">the ID of the receiver</param>
		/// <param name="target">the target or null (if its an area message)</param>
		/// <param name="msg">the message itself</param>
		private static RealmPacketOut CreateCharChatMessage(ChatMsgType type, ChatLanguage language, IChatter id1, IChatter id2,
			string target, string msg)
		{
			return CreateCharChatMessage(type, language, id1.EntityId, id2.EntityId, target, msg, id1.ChatTag);
		}
예제 #20
0
		private static RealmPacketOut CreateObjectChatMessage(ChatMsgType type, ChatLanguage language, INamedEntity obj)
		{
			var name = obj.Name;

			var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT, 31 + name.Length + 50);
			packet.Write((byte)type);															// 1
			packet.Write((uint)language);														// 5
			packet.Write(obj.EntityId);																// 13
			packet.Write(0);																	// 17
			packet.WriteUIntPascalString(name);														// 21 + nameLength
			packet.Write((long)0);																// 29 + nameLength
			//packet.Write(obj.EntityId);

			return packet;
		}
예제 #21
0
		/// <summary>
		/// Parses any incoming channel messages.
		/// </summary>
		/// <param name="type">the type of chat message indicated by the client</param>
		/// <param name="language">the chat language indicated by the client</param>
		/// <param name="packet">the actual chat message packet</param>
		private static void ChannelParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
		{
			var channel = packet.ReadCString();
			var message = packet.ReadCString();

			if (RealmCommandHandler.HandleCommand(sender, message, sender.Target as Character))
				return;

			var chan = ChatChannelGroup.RetrieveChannel(sender, channel);
			if (chan == null)
				return;

			chan.SendMessage(sender, message);
		}
예제 #22
0
		/// <summary>
		/// Parses any incoming officer message.
		/// </summary>
		/// <param name="sender">The character sending the message</param>
		/// <param name="type">the type of chat message indicated by the client</param>
		/// <param name="language">the chat language indicated by the client</param>
		/// <param name="packet">the actual chat message packet</param>
		private static void OfficerParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
		{
			string msg = ReadMessage(packet);

			if (msg.Length == 0)
				return;

			if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character))
				return;

			var guild = Guild.CheckPrivs(sender, GuildCommandId.MEMBER, GuildPrivileges.GCHATSPEAK);
			if (guild != null)
			{
				SendGuildOfficerMessage(sender, guild, msg);
			}
		}
예제 #23
0
		public static void SendMonsterMessage(WorldObject chatter, ChatMsgType chatType, ChatLanguage language, string[] localizedMsgs, float radius)
		{
			if (chatter == null || !chatter.IsAreaActive)
				return;

			using (var packet = CreateObjectChatMessage(chatType, language, chatter))
			{
				chatter.IterateEnvironment(radius, obj =>
				{
					if (obj is Character)
					{
						packet.WriteUIntPascalString(localizedMsgs.Localize(((Character)obj).Client.Info.Locale));
						packet.Write((byte)(chatter is Unit ? ((Unit)chatter).ChatTag : ChatTag.None));

						((Character)obj).Send(packet.GetFinalizedPacket());
					}
					return true;
				});
			}
		}
예제 #24
0
		/// <summary>
		/// Sends a monster message.
		/// </summary>
		/// <param name="obj">the monster the message is being sent from</param>
		/// <param name="chatType">the type of message</param>
		/// <param name="language">the language to send the message in</param>
		/// <param name="message">the message to send</param>
		public static void SendMonsterMessage(WorldObject obj, ChatMsgType chatType, ChatLanguage language, string[] localizedMsgs)
		{
			SendMonsterMessage(obj, chatType, language, localizedMsgs, chatType == ChatMsgType.MonsterYell ? YellRadius : ListeningRadius);
		}
예제 #25
0
 public static bool IsYell(this ChatMsgType type)
 {
     return(type == ChatMsgType.Yell || type == ChatMsgType.MonsterYell);
 }
예제 #26
0
        /// <summary>
        /// Triggers a chat notification event.
        /// </summary>
        /// <param name="chatter">the person chatting</param>
        /// <param name="message">the chat message</param>
        /// <param name="language">the chat language</param>
        /// <param name="chatType">the type of chat</param>
        /// <param name="target">the target of the message (channel, whisper, etc)</param>
        public static void ChatNotify(IChatter chatter, string message, ChatLanguage language, ChatMsgType chatType, IGenericChatTarget target)
        {
            var chatNotify = MessageSent;

            if (chatNotify != null)
            {
                chatNotify(chatter, message, language, chatType, target);
            }
        }
예제 #27
0
        /// <summary>
        /// Parses any incoming whispers.
        /// </summary>
        /// <param name="type">the type of chat message indicated by the client</param>
        /// <param name="language">the chat language indicated by the client</param>
        /// <param name="packet">the actual chat message packet</param>
        private static void WhisperParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
        {
            var recipient = packet.ReadCString();
            var msg       = ReadMessage(packet);

            if (msg.Length == 0)
            {
                return;
            }

            if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character))
            {
                return;
            }

            var targetChr = World.GetCharacter(recipient, false);

            if (targetChr == null)
            {
                SendChatPlayerNotFoundReply(sender.Client, recipient);
                return;
            }

            if (targetChr.Faction.Group != sender.Faction.Group)
            {
                SendChatPlayerWrongTeamReply(sender.Client);
                return;
            }

            if (targetChr.IsIgnoring(sender))
            {
                using (var packetOut = CreateCharChatMessage(ChatMsgType.Ignored, ChatLanguage.Universal, targetChr, sender, null, msg))
                {
                    sender.Send(packetOut);
                }
            }
            else
            {
                using (var packetOut = CreateCharChatMessage(ChatMsgType.Whisper, ChatLanguage.Universal, sender, targetChr, null, msg))
                {
                    targetChr.Send(packetOut);
                }
            }

            using (var packetOut = CreateCharChatMessage(ChatMsgType.MsgReply, ChatLanguage.Universal, targetChr, targetChr, null, msg, sender.ChatTag))
            {
                sender.Send(packetOut);
            }

            // handle afk/dnd situations
            if (targetChr.IsAFK)
            {
                using (var packetOut = CreateCharChatMessage(ChatMsgType.AFK, ChatLanguage.Universal, targetChr, sender, null, targetChr.AFKReason, targetChr.ChatTag))
                {
                    sender.Send(packetOut);
                }
            }

            if (targetChr.IsDND)
            {
                using (var packetOut = CreateCharChatMessage(ChatMsgType.DND, ChatLanguage.Universal, targetChr, sender, null, string.Empty, targetChr.ChatTag))
                {
                    sender.Send(packetOut);
                }
            }
        }
예제 #28
0
		/// <summary>
		/// Parses any incoming party or raid messages.
		/// </summary>
		/// <param name="sender">The character sending the message</param>
		/// <param name="type">the type of chat message indicated by the client</param>
		/// <param name="language">the chat language indicated by the client</param>
		/// <param name="packet">the actual chat message packet</param>
		private static void GroupParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
		{
			var msg = ReadMessage(packet);

			if (msg.Length == 0)
				return;

			SayGroup(sender, language, msg);
		}
예제 #29
0
        public async Task <ActionResult> ChattingEventAsync(List <IFormFile> attachedFile, string queryTo, string queryDate, string queryText)
        {
            ChatMsgType chatMsgType = ChatMsgType.Text;
            string      filename    = "";

            if (attachedFile.Count > 0)
            {
                chatMsgType = ChatMsgType.File;
                long size = attachedFile.Sum(f => f.Length);
                //tring filePath = "/attach/";// "D:/BotAppAttachedFiles/";
                string filePath = Path.Combine(_environment.WebRootPath, "attach");// + $@"\{newFileName}";
                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }
                filename  = attachedFile[0].FileName;
                filePath += $@"\{filename}";
                if (filename.ToLower().EndsWith("ogg") || filename.ToLower().EndsWith("wma") || filename.ToLower().EndsWith("mp3"))
                {
                    chatMsgType = ChatMsgType.Voice;
                }
                if (filename.ToLower().EndsWith("png") || filename.ToLower().EndsWith("jpg") || filename.ToLower().EndsWith("bmp") || filename.ToLower().EndsWith("gif"))
                {
                    chatMsgType = ChatMsgType.Image;
                }
                using (var stream = new FileStream(filePath, FileMode.Create))
                {
                    await attachedFile[0].CopyToAsync(stream);
                }
            }

            try
            {
                var queryDateTime = DateTime.ParseExact(queryDate, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture);
                var chatlog       = new ChattingLog
                {
                    //Id = ,
                    AgentId    = _userManager.GetUserId(User),
                    Time       = queryDateTime,
                    Text       = queryText,
                    Filename   = filename,
                    CustomerId = queryTo,
                    Read       = false,
                    Type       = chatMsgType,
                    Source     = MessageSource.Agent
                };
                await _context.ChattingLog.AddAsync(chatlog);

                await _context.SaveChangesAsync();

                HttpContext.Session.SetString("last_user", queryTo);
                HttpContext.Session.SetString("last_logid", chatlog.Id.ToString());
            }
            catch (Exception e) { Console.WriteLine(e.ToString()); }
            return(Json(new
            {
                //answerText = answerText,
                //answerAth = answerFile,
                //answerDate = answerDate,
                QueryAth = filename
            }));
        }
예제 #30
0
		/// <summary>
		/// Parses any incoming party or raid messages.
		/// </summary>
		/// <param name="sender">The character sending the message</param>
		/// <param name="type">the type of chat message indicated by the client</param>
		/// <param name="language">the chat language indicated by the client</param>
		/// <param name="packet">the actual chat message packet</param>
		private static void SubGroupParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
		{
			string msg = ReadMessage(packet);

			if (msg.Length == 0)
				return;

			if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character))
				return;

			var group = sender.SubGroup;
			if (group != null)
			{
				using (var packetOut = CreateCharChatMessage(type, ChatLanguage.Universal, sender, sender, null, msg))
				{
					group.Send(packetOut, null);
				}
			}
		}
예제 #31
0
파일: Character.cs 프로젝트: karliky/wowwow
		void SendMessageTo( Character c, ChatMsgType chat, string txt, int langue )
		{
			int offset = 4;
			bool understand = false;
			switch( langue )
			{
				case 7://	Common
					if ( c.HaveSkill( 98 ) )
						understand = true;
					break;
				case 1://	Orcish
					if ( c.HaveSkill( 109 ) )
						understand = true;
					break;
				case 13://	Gnomish
					if ( c.HaveSkill( 313 ) )
						understand = true;
					break;
				case 33://	Gutter
					if ( c.HaveSkill( 673 ) )
						understand = true;
					break;
				case 3://	Tauren
					if ( c.HaveSkill( 115 ) )
						understand = true;
					break;
				case 14://	Troll
					if ( c.HaveSkill( 315 ) )
						understand = true;
					break;
				case 2://	Elf
					if ( c.HaveSkill( 113 ) )
						understand = true;
					break;
				case 6://	Dwarf
					if ( c.HaveSkill( 111 ) )
						understand = true;
					break;
			}
			if ( understand )
			{
				tempBuff[ offset++ ] = (byte)chat;//type, CHAT_MSG_SAY, CHAT_MSG_CHANNEL, CHAT_MSG_WHISPER, CHAT_MSG_YELL, CHAT_MSG_PARTY
				Converter.ToBytes( langue, tempBuff, ref offset );
			}
			else
			{
				tempBuff[ offset++ ] = (byte)chat;//type
				Converter.ToBytes( langue, tempBuff, ref offset );
			}
			Converter.ToBytes( Guid, tempBuff, ref offset );
			Converter.ToBytes( Guid, tempBuff, ref offset );
			
			//		string tx = txt + " ( " + r.ToString() + " )";
			//		r = (ushort)( r << 1 );
			Converter.ToBytes( txt.Length + 1, tempBuff, ref offset );
			Converter.ToBytes( txt, tempBuff, ref offset );
			Converter.ToBytes( (short)1, tempBuff, ref offset );// Togle afk
			int len = offset;

			c.Send( OpCodes.SMSG_MESSAGECHAT, tempBuff, len );
	
		}
예제 #32
0
		/// <summary>
		/// Parses any incoming whispers.
		/// </summary>
		/// <param name="type">the type of chat message indicated by the client</param>
		/// <param name="language">the chat language indicated by the client</param>
		/// <param name="packet">the actual chat message packet</param>
		private static void WhisperParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
		{
			var recipient = packet.ReadCString();
			var msg = ReadMessage(packet);

			if (msg.Length == 0)
				return;

			if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character))
				return;

			var targetChr = World.GetCharacter(recipient, false);
			if (targetChr == null)
			{
				SendChatPlayerNotFoundReply(sender.Client, recipient);
				return;
			}

			if (targetChr.Faction.Group != sender.Faction.Group)
			{
				SendChatPlayerWrongTeamReply(sender.Client);
				return;
			}

			if (targetChr.IsIgnoring(sender))
			{
				using (var packetOut = CreateCharChatMessage(ChatMsgType.Ignored, ChatLanguage.Universal, targetChr, sender, null, msg))
				{
					sender.Send(packetOut);
				}
			}
			else
			{
				using (var packetOut = CreateCharChatMessage(ChatMsgType.Whisper, ChatLanguage.Universal, sender, targetChr, null, msg))
				{
					targetChr.Send(packetOut);
				}
			}

			using (var packetOut = CreateCharChatMessage(ChatMsgType.MsgReply, ChatLanguage.Universal, targetChr, targetChr, null, msg, sender.ChatTag))
			{
				sender.Send(packetOut);
			}

			// handle afk/dnd situations
			if (targetChr.IsAFK)
			{
				using (var packetOut = CreateCharChatMessage(ChatMsgType.AFK, ChatLanguage.Universal, targetChr, sender, null, targetChr.AFKReason, targetChr.ChatTag))
				{
					sender.Send(packetOut);
				}
			}

			if (targetChr.IsDND)
			{
				using (var packetOut = CreateCharChatMessage(ChatMsgType.DND, ChatLanguage.Universal, targetChr, sender, null, string.Empty, targetChr.ChatTag))
				{
					sender.Send(packetOut);
				}
			}
		}
예제 #33
0
        public static void SayYellEmote(this Character sender, ChatMsgType type, ChatLanguage language, string msg, float radius)
        {
            if (RealmCommandHandler.HandleCommand(sender, msg, sender.Target as Character))
            {
                return;
            }

            if (type != ChatMsgType.WhisperInform && msg.Length == 0)
            {
                return;
            }

            if (GlobalChat)
            {
                using (var packetOut = CreateCharChatMessage(type, language, sender.EntityId, sender.EntityId, null, msg, sender.ChatTag))
                {
                    foreach (var chr in World.GetAllCharacters())
                    {
                        chr.Send(packetOut);
                    }
                }
            }
            else
            {
                var            faction = sender.FactionGroup;
                RealmPacketOut pckt = null, scrambledPckt = null;

                var scrambleDefault               = ScrambleChat && sender.Role.ScrambleChat;
                Func <WorldObject, bool> iterator = obj =>
                {
                    if ((obj is Character))
                    {
                        var chr = (Character)obj;
                        if (!scrambleDefault || chr.FactionGroup == faction || !chr.Role.ScrambleChat)
                        {
                            if (pckt == null)
                            {
                                pckt = CreateCharChatMessage(type, language, sender.EntityId, sender.EntityId, null, msg, sender.ChatTag);
                            }
                            chr.Send(pckt);
                        }
                        else
                        {
                            if (scrambledPckt == null)
                            {
                                scrambledPckt = CreateCharChatMessage(type, language, sender.EntityId, sender.EntityId, null,
                                                                      ScrambleMessage(msg), sender.ChatTag);
                            }
                            chr.Send(scrambledPckt);
                        }
                    }
                    return(true);
                };

                if (radius == WorldObject.BroadcastRange)
                {
                    sender.NearbyObjects.Iterate(iterator);
                }
                else
                {
                    sender.IterateEnvironment(radius, iterator);
                }

                if (pckt != null)
                {
                    pckt.Close();
                }
                if (scrambledPckt != null)
                {
                    scrambledPckt.Close();
                }
            }
        }
예제 #34
0
		private static void AFKParser(Character sender, ChatMsgType type, ChatLanguage language, RealmPacketIn packet)
		{
			var reason = packet.ReadCString();

			if (type == ChatMsgType.AFK)
			{
				// flip their AFK flag
				sender.IsAFK = !sender.IsAFK;

				sender.AFKReason = (sender.IsAFK ? reason : "");
			}

			if (type == ChatMsgType.DND)
			{
				// flip their DND flag
				sender.IsDND = !sender.IsDND;

				sender.DNDReason = (sender.IsDND ? reason : "");
			}
		}
예제 #35
0
        /// <summary>
        /// 【异步方法】发消息
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="sender">发送人的userId</param>
        /// <param name="type">接收人类型:single|group,分别表示:群聊|单聊</param>
        /// <param name="msgType">消息类型,text|image|file</param>
        /// <param name="chatIdOrUserId">会话值,为userid|chatid,分别表示:成员id|会话id,单聊是userid,群聊是chatid</param>
        /// <param name="contentOrMediaId">文本消息是content,图片或文件是mediaId</param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static async Task <QyJsonResult> SendChatMessageAsync(string accessToken, string sender, Chat_Type type, ChatMsgType msgType, string chatIdOrUserId, string contentOrMediaId, int timeOut = Config.TIME_OUT)
        {
            var url = string.Format("https://qyapi.weixin.qq.com/cgi-bin/chat/send?access_token={0}", accessToken.AsUrlData());

            BaseSendChatMessageData data;

            switch (msgType)
            {
            case ChatMsgType.text:
                data = new SendTextMessageData
                {
                    receiver = new Receiver
                    {
                        type = type.ToString(),
                        id   = chatIdOrUserId
                    },
                    sender  = sender,
                    msgtype = msgType.ToString(),
                    text    = new Chat_Content
                    {
                        content = contentOrMediaId
                    }
                };
                break;

            case ChatMsgType.image:
                data = new SendImageMessageData
                {
                    receiver = new Receiver
                    {
                        type = type.ToString(),
                        id   = chatIdOrUserId
                    },
                    sender  = sender,
                    msgtype = msgType.ToString(),
                    image   = new Chat_Image
                    {
                        media_id = contentOrMediaId
                    }
                };
                break;

            case ChatMsgType.file:
                data = new SendFileMessageData
                {
                    receiver = new Receiver
                    {
                        type = type.ToString(),
                        id   = chatIdOrUserId
                    },
                    sender  = sender,
                    msgtype = msgType.ToString(),
                    file    = new Chat_File
                    {
                        media_id = contentOrMediaId
                    }
                };
                break;

            default:
                throw new ArgumentOutOfRangeException("msgType");
            }

            return(await Core.CommonAPIs.CommonJsonSend.SendAsync <QyJsonResult>(null, url, data, CommonJsonSendType.POST, timeOut));
        }
예제 #36
0
		/// <summary>
		/// Creates a chat message packet for a non-player object.
		/// </summary>
		/// <param name="type">the type of chat message</param>
		/// <param name="language">the language the message is in</param>
		/// <param name="obj">the object "saying" the message</param>
		/// <param name="msg">the message itself</param>
		/// <param name="tag">any chat tags for the object</param>
		/// <returns>the generated chat packet</returns>
		private static RealmPacketOut CreateObjectChatMessage(ChatMsgType type,
			ChatLanguage language, INamedEntity obj, string msg, ChatTag tag)
		{
			var packet = CreateObjectChatMessage(type, language, obj);
			//packet.Write(obj.EntityId);	
			packet.WriteUIntPascalString(msg);														// 30 + nameLength + msg.Length
			packet.Write((byte)tag);															// 31 + ...

			return packet;
		}
예제 #37
0
        /// <summary>
        /// 【异步方法】发送简单消息(文本、图片、文件或语音)
        /// </summary>
        /// <param name="accessTokenOrAppKey">调用接口凭证(AccessToken)或AppKey(根据AccessTokenContainer.BuildingKey(corpId, corpSecret)方法获得)</param>
        /// <param name="chatId">会话id</param>
        /// <param name="msgType">消息类型,text|image|file|voice</param>
        /// <param name="contentOrMediaId">文本消息是content,图片或文件是mediaId</param>
        /// <param name="safe">表示是否是保密消息,0表示否,1表示是,默认0</param>
        /// <param name="timeOut">代理请求超时时间(毫秒)</param>
        /// <returns></returns>
        public static async Task <WorkJsonResult> SendChatSimpleMessageAsync(string accessTokenOrAppKey, string chatId, ChatMsgType msgType, string contentOrMediaId, int safe = 0, int timeOut = Config.TIME_OUT)
        {
            return(await ApiHandlerWapper.TryCommonApiAsync(async accessToken =>
            {
                BaseSendChatMessageData data;

                switch (msgType)
                {
                case ChatMsgType.text:
                    data = new SendTextMessageData(chatId, contentOrMediaId, safe);
                    break;

                case ChatMsgType.image:
                    data = new SendImageMessageData(chatId, contentOrMediaId, safe);
                    break;

                case ChatMsgType.voice:
                    data = new SendVoiceMessageData(chatId, contentOrMediaId, safe);
                    break;

                case ChatMsgType.file:
                    data = new SendFileMessageData(chatId, contentOrMediaId, safe);
                    break;

                default:
                    throw new ArgumentOutOfRangeException("msgType");
                }
                return await CommonJsonSend.SendAsync <WorkJsonResult>(accessToken, _urlFormatSend, data, CommonJsonSendType.POST, timeOut);
            }, accessTokenOrAppKey));
        }
예제 #38
0
		/// <summary>
		/// Creates a chat message packet for a player.
		/// </summary>
		/// <param name="type">the type of chat message</param>
		/// <param name="language">the language the message is in</param>
		/// <param name="id1">the ID of the chatter</param>
		/// <param name="id2">the ID of the receiver</param>
		/// <param name="target">the target or null (if its an area message)</param>
		/// <param name="msg">the message itself</param>
		/// <param name="tag">the chat tag of the chatter</param>
		/// <returns>Might return null</returns>
		private static RealmPacketOut CreateCharChatMessage(ChatMsgType type, ChatLanguage language, EntityId id1, EntityId id2,
			string target, string msg, ChatTag tag)
		{
			var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT);
			packet.Write((byte)type);
			packet.Write((uint)language);
			packet.Write(id1);
			packet.Write(0);
			if (target != null)
				packet.WriteUIntPascalString(target);
			packet.Write(id2);
			packet.WriteUIntPascalString(msg);
			packet.Write((byte)tag);

			return packet;
		}
예제 #39
0
 /// <summary>
 /// Creates a chat message packet for a player.
 /// </summary>
 /// <param name="type">the type of chat message</param>
 /// <param name="language">the language the message is in</param>
 /// <param name="id1">the ID of the chatter</param>
 /// <param name="id2">the ID of the receiver</param>
 /// <param name="target">the target or null (if its an area message)</param>
 /// <param name="msg">the message itself</param>
 private static RealmPacketOut CreateCharChatMessage(ChatMsgType type, ChatLanguage language, IChatter id1, IChatter id2,
                                                     string target, string msg)
 {
     return(CreateCharChatMessage(type, language, id1.EntityId, id2.EntityId, target, msg, id1.ChatTag));
 }
예제 #40
0
		/// <summary>
		/// Sends a monster message.
		/// </summary>
		/// <param name="obj">the monster the message is being sent from</param>
		/// <param name="chatType">the type of message</param>
		/// <param name="language">the language to send the message in</param>
		/// <param name="message">the message to send</param>
		/// <param name="radius">The radius or -1 to be heard by everyone in the Map</param>
		public static void SendMonsterMessage(WorldObject obj, ChatMsgType chatType, ChatLanguage language, string message, float radius)
		{
			if (obj == null || !obj.IsAreaActive)
				return;

			using (var packetOut = CreateObjectChatMessage(chatType, language, obj, message, obj is Unit ? ((Unit)obj).ChatTag : ChatTag.None))
			{
				obj.SendPacketToArea(packetOut, radius, true);
			}
		}
예제 #41
0
 public void SendMessage(ClientConnection Client, ChatMsgType type, Language lang, string msg)
 {
 }
예제 #42
0
		/// <summary>
		/// Triggers a chat notification event.
		/// </summary>
		/// <param name="chatter">the person chatting</param>
		/// <param name="message">the chat message</param>
		/// <param name="language">the chat language</param>
		/// <param name="chatType">the type of chat</param>
		/// <param name="target">the target of the message (channel, whisper, etc)</param>
		public static void ChatNotify(IChatter chatter, string message, ChatLanguage language, ChatMsgType chatType, IGenericChatTarget target)
		{
			var chatNotify = MessageSent;

			if (chatNotify != null)
			{
				chatNotify(chatter, message, language, chatType, target);
			}
		}
예제 #43
0
        /// <summary>
        /// 发消息
        /// </summary>
        /// <param name="accessTokenOrAppKey"></param>
        /// <param name="sender">发送人的userId</param>
        /// <param name="type">接收人类型:single|group,分别表示:群聊|单聊</param>
        /// <param name="msgType">消息类型,text|image|file</param>
        /// <param name="chatIdOrUserId">会话值,为userid|chatid,分别表示:成员id|会话id,单聊是userid,群聊是chatid</param>
        /// <param name="contentOrMediaId">文本消息是content,图片或文件是mediaId</param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static WorkJsonResult SendChatMessage(string accessTokenOrAppKey, string sender, Chat_Type type, ChatMsgType msgType, string chatIdOrUserId, string contentOrMediaId, int timeOut = Config.TIME_OUT)
        {
            return(ApiHandlerWapper.TryCommonApi(accessToken =>
            {
                var url = string.Format("https://qyapi.weixin.qq.com/cgi-bin/chat/send?access_token={0}", accessToken.AsUrlData());

                BaseSendChatMessageData data;

                switch (msgType)
                {
                case ChatMsgType.text:
                    data = new SendTextMessageData()
                    {
                        receiver = new Receiver()
                        {
                            type = type.ToString(),
                            id = chatIdOrUserId
                        },
                        sender = sender,
                        msgtype = msgType.ToString(),
                        text = new Chat_Content()
                        {
                            content = contentOrMediaId
                        }
                    };
                    break;

                case ChatMsgType.image:
                    data = new SendImageMessageData()
                    {
                        receiver = new Receiver()
                        {
                            type = type.ToString(),
                            id = chatIdOrUserId
                        },
                        sender = sender,
                        msgtype = msgType.ToString(),
                        image = new Chat_Image()
                        {
                            media_id = contentOrMediaId
                        }
                    };
                    break;

                case ChatMsgType.file:
                    data = new SendFileMessageData()
                    {
                        receiver = new Receiver()
                        {
                            type = type.ToString(),
                            id = chatIdOrUserId
                        },
                        sender = sender,
                        msgtype = msgType.ToString(),
                        file = new Chat_File()
                        {
                            media_id = contentOrMediaId
                        }
                    };
                    break;

                default:
                    throw new ArgumentOutOfRangeException("msgType");
                }

                return CommonJsonSend.Send <WorkJsonResult>(null, url, data, CommonJsonSendType.POST, timeOut);
            }, accessTokenOrAppKey));
        }
예제 #44
0
		/// <summary>
		/// Check if a Character forgave an Ambusher
		/// </summary>
		static void CheckAmbusherRelease(IChatter chatter, string message,
			ChatLanguage lang, ChatMsgType chatType, IGenericChatTarget target)
		{
			if (chatter is Character)	// make sures its a Character (could also be a broadcast or an IRC bot etc)
			{
				var chr = (Character)chatter;
				var selected = chr.Target as NPC;
				if (selected != null &&
					selected.FactionId == FactionId.Friendly &&							// Ambusher is frienddly
					selected.FirstAttacker == chr &&									// Ambusher was tagged by Chr
					selected.Entry.NPCId == NPCId.WitchwingAmbusher &&					// Chr selected the ambusher
					(chatType == ChatMsgType.Say || chatType == ChatMsgType.Yell) &&	// Chr speaks out loud
					message == "I forgive thee!")										// Chr says the right words
				{
					if (!selected.IsInFrontOf(chr))
					{
						// the char was not talking towards the ambusher
						selected.Say("What? I couldn't hear you!");
					}
					else
					{
						// The Killer has forgiven the Ambusher

						// Standup
						selected.StandState = StandState.Stand;

						// delay (because standing up takes time)
						selected.CallDelayed(800, obj => {
							if (selected.IsInWorld) // ensure that Chr and selected didn't disappear in the meantime
							{
								if (chr.IsInWorld)
								{
									selected.Yell("Thank you so much! - Now I can leave this place.");
								}

								selected.Emote(EmoteType.SimpleApplaud);

								selected.CallDelayed(1000, obj2 => {
									if (selected.IsInWorld)
									{
										// Finally die
										selected.Kill();
									}
								});
							}
						});
					}
				}
			}
		}
예제 #45
0
        /// <summary>
        /// 【异步方法】发消息
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="sender">发送人的userId</param>
        /// <param name="type">接收人类型:single|group,分别表示:群聊|单聊</param>
        /// <param name="msgType">消息类型,text|image|file</param>
        /// <param name="chatIdOrUserId">会话值,为userid|chatid,分别表示:成员id|会话id,单聊是userid,群聊是chatid</param>
        /// <param name="contentOrMediaId">文本消息是content,图片或文件是mediaId</param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static async Task<QyJsonResult> SendChatMessageAsync(string accessToken, string sender, Chat_Type type, ChatMsgType msgType, string chatIdOrUserId, string contentOrMediaId, int timeOut = Config.TIME_OUT)
        {
            var url = string.Format("https://qyapi.weixin.qq.com/cgi-bin/chat/send?access_token={0}", accessToken.AsUrlData());

            BaseSendChatMessageData data;

            switch (msgType)
            {
                case ChatMsgType.text:
                    data = new SendTextMessageData()
                    {
                        receiver = new Receiver()
                        {
                            type = type.ToString(),
                            id = chatIdOrUserId
                        },
                        sender = sender,
                        msgtype = msgType.ToString(),
                        text = new Chat_Content()
                        {
                            content = contentOrMediaId
                        }
                    };
                    break;
                case ChatMsgType.image:
                    data = new SendImageMessageData()
                    {
                        receiver = new Receiver()
                        {
                            type = type.ToString(),
                            id = chatIdOrUserId
                        },
                        sender = sender,
                        msgtype = msgType.ToString(),
                        image = new Chat_Image()
                        {
                            media_id = contentOrMediaId
                        }
                    };
                    break;
                case ChatMsgType.file:
                    data = new SendFileMessageData()
                    {
                        receiver = new Receiver()
                        {
                            type = type.ToString(),
                            id = chatIdOrUserId
                        },
                        sender = sender,
                        msgtype = msgType.ToString(),
                        file = new Chat_File()
                        {
                            media_id = contentOrMediaId
                        }
                    };
                    break;
                default:
                    throw new ArgumentOutOfRangeException("msgType");
            }

            return await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync<QyJsonResult>(null, url, data, CommonJsonSendType.POST, timeOut);
        }
예제 #46
0
파일: Character.cs 프로젝트: karliky/wowwow
		void MessageHandler( string txt, ChatMsgType chat, int langue )
		{////00 07 00 00 00 0A 00 00 00 00 00 00 00 0A 00 00 00 00 00 00 00 04 00 00 00 7A 6F 62 00 03 
			if ( txt.StartsWith( "." ) )
				OnCommand( txt );
			else
			{				
				switch( chat )
				{
					case ChatMsgType.CHAT_MSG_SAY:
					{
						SendMessageTo( this, chat, txt, langue );
						if ( account.PlayersNear.Count == 0 )
							return;
						foreach( Character c in account.PlayersNear )
						{
							if ( c.Player.PlayersNear.Contains( this ) )
								SendMessageTo( c, txt, langue );
						}
						
					}
						break;
					case ChatMsgType.CHAT_MSG_PARTY:
					{
						foreach( Member member in GroupMembers.Members )
						{
							SendMessageTo( member.Char, chat, txt, langue );
						}
					}
						break;
				}
			}

			//account.ToAllPlayerNear( OpCodes.SMSG_MESSAGECHAT, tempBuff, offset );
		}
예제 #47
0
 /// <summary>
 /// Creates a chat message packet for a player.
 /// </summary>
 /// <param name="type">the type of chat message</param>
 /// <param name="language">the language the message is in</param>
 /// <param name="id1">the ID of the chatter</param>
 /// <param name="id2">the ID of the receiver</param>
 /// <param name="target">the target or null (if its an area message)</param>
 /// <param name="msg">the message itself</param>
 /// <param name="tag">the chat tag of the chatter</param>
 /// <returns>Might return null</returns>
 private static RealmPacketOut CreateCharChatMessage(ChatMsgType type, ChatLanguage language, EntityId id1, EntityId id2,
                                                     string target, string msg, ChatTag tag)
 {
     return(CreateGlobalChatMessage("??", msg, Color.Red, Locale.En));
 }