public void SystemSendWhisper(string userId, string userName, short vipLv, string content) { if (userId.Equals(LanguageManager.GetLang().SystemUserId.ToString())) { throw new Exception("不能给系统发私聊"); } var chat = new ChatData { Version = 0, FromUserID = LanguageManager.GetLang().SystemUserId, FromUserName = LanguageManager.GetLang().KingName, FromUserVip = 0, ToUserID = userId.ToInt(), ToUserName = userName, ToUserVip = vipLv, ChatType = ChatType.Whisper, Content = content, SendDate = DateTime.Now }; SendWhisper(userId.ToInt(), chat); }
public void SystemSend(ChatType chatType, string content) { if (chatType == ChatType.Whisper) return; var chat = new ChatData { Version = NextVersion, FromUserID = LanguageManager.GetLang().SystemUserId, FromUserName = LanguageManager.GetLang().KingName, FromUserVip = 0, ToUserID = 0, ToUserName = string.Empty, ToUserVip = 0, ChatType = chatType, Content = content, SendDate = DateTime.Now }; Send(chat); }
public void SendWhisper(GameUser toUser, string content) { if (_user == null || toUser == null) { throw new Exception("发送人或接收人为空值"); } _user.ChatDate = DateTime.Now; var chat = new ChatData { Version = 0, FromUserID = _user.UserID.ToInt(), FromUserName = _user.NickName, FromUserVip = (short)_user.VipLv, ToUserID = toUser.UserID.ToInt(), ToUserName = toUser.NickName, ToUserVip = (short)toUser.VipLv, ChatType = ChatType.Whisper, Content = FilterMessage(content), SendDate = DateTime.Now }; SendWhisper(toUser.UserID.ToInt(), chat); }
public void SystemGuildSend(ChatType chatType, string content) { string guildID = string.Empty; if (chatType == ChatType.Whisper) return; if (!string.IsNullOrEmpty(_user.MercenariesID)) { guildID = _user.MercenariesID; } var chat = new ChatData { Version = NextVersion, FromUserID = LanguageManager.GetLang().SystemUserId, FromUserName = LanguageManager.GetLang().KingName, FromUserVip = 0, ToUserID = 0, ToUserName = string.Empty, ToUserVip = 0, ChatType = chatType, Content = content, SendDate = DateTime.Now, GuildID = guildID }; Send(chat); }
public void Send(ChatType chatType, string content) { string guildID = string.Empty; if (chatType == ChatType.Guild) { guildID = _user.MercenariesID; } var chat = new ChatData { Version = NextVersion, FromUserID = _user.UserID.ToInt(), FromUserName = _user.NickName, FromUserVip = (short)_user.VipLv, ToUserID = 0, ToUserName = string.Empty, ToUserVip = 0, ChatType = chatType, Content = FilterMessage(content), SendDate = DateTime.Now, GuildID = guildID, }; if (chatType == ChatType.World) { _user.ChatDate = DateTime.Now; } Send(chat); }