protected ChatModel(string id, string name, ChatType chatType, IProtocolManager networkManager) { _ID = id; _Name = name; _ChatType = chatType; _ProtocolManager = networkManager; }
public void ChatOut(string chat, ChatType type, int channel) { if (!loggedIn) return; client.Self.Chat(chat, channel, type); OnChatSent(new ChatSentEventArgs(chat, type, channel)); }
public SpChatMessage(Player player, string message, ChatType type, bool sysmsg = false) { Player = player; Message = message; Type = type; IsSystemMessage = sysmsg; }
public override void Read() { Type = (ChatType)ReadC(); RecvName = ReadSN(); ReadB(7); Message = ReadS(); }
/// <summary> /// Initializes a new instance of the ChatPacket class. /// This overload should be used by the server because /// the client needs to know who sent the message. /// </summary> /// <param name="chat">The text of the chat message.</param> /// <param name="sender">The player who sent the chat message.</param> /// <param name="chatType">The type of chat.</param> public ChatPacket(string chat, string sender, ChatType chatType) : base() { this.Chat = chat; this.Sender = sender; this.ChatType = chatType; }
public override EventEat OnSay3(Entity player, ChatType type, string name, ref string message) { string[] splitmsg = message.ToLower().Split(' '); foreach (string word in splitmsg) { if (BadWordsList.Contains(word)) { if (!player.HasField("warnsbadwords")) player.SetField("warnsbadwords", new Parameter(0)); if (player.GetField<int>("warnsbadwords") >= 2) { Utilities.RawSayAll("^1BAD^2WORDS^3: " + player.Name + " got kicked for ^1Bad^2words"); Utilities.ExecuteCommand("dropclient " + player.EntRef + " \"" + "^3Bad ^2words ^1DETECTED" + "\""); return EventEat.EatGame; } else { Utilities.RawSayTo(player, "Don't use any ^1offensive ^2language"); player.SetField("warnsbadwords",player.GetField<int>("warnsbadwords") + 1); return EventEat.EatGame; } } } return EventEat.EatNone; }
public BaseChat(ChatType chatType, string message) { packet.Type(1006); packet.WriteShort((short)chatType); packet.WriteString(message); packet.WriteByte(0); }
/// <summary> /// Creates a ConsoleMessage from a native instance's attributes /// </summary> internal ConsoleMessage(IntPtr pointer) : base(pointer) { Color = new Color(pointer); Type = (ChatType) Functions.vp_int(pointer, IntAttributes.ChatType); Effect = (ChatEffect) Functions.vp_int(pointer, IntAttributes.ChatType); }
public SpChat(string message, int sessionId, string characterName, ChatType chatType) { _message = message; _sessionId = sessionId; _characterName = characterName; _chatType = chatType; }
public frmSpelling(METAboltInstance instance, string sentence, string[] swords, ChatType type) { InitializeComponent(); this.instance = instance; afffile = this.instance.AffFile; // "en_GB.aff"; dicfile = this.instance.DictionaryFile; // "en_GB.dic"; string[] idic = dicfile.Split('.'); dic = dir + idic[0]; if (!System.IO.File.Exists(dic + ".csv")) { System.IO.File.Create(dic + ".csv"); } try { hunspell.Load(dir + afffile, dir + dicfile); //("en_us.aff", "en_us.dic"); ReadWords(); } catch { //string exp = ex.Message; } //words = sentence; richTextBox1.Text = sentence; this.swords = swords; this.ctype = type; ischat = true; }
public void SendMessage(ChatType type, string message) { if (type == ChatType.Private) return; SendMessage(type, new Character(), message); }
public ChatMessage(ChatType type, int dest, string message) { this.Sender = null; this.Type = type; this.Destination = dest; this.Message = message; }
public ChatMessage(Character sender, ChatType type, int dest, string message) { this.Sender = sender; this.Type = type; this.Destination = dest; this.Message = message; }
public static ServerMessage Compose(uint ActorId, string MessageText, int EmotionId, ChatType ChatType) { StringBuilder TextBuilder = new StringBuilder(); Dictionary<int, string> LinkRefs = new Dictionary<int, string>(); string[] Bits = MessageText.Split(' '); int i = 0; int j = 0; foreach (string Bit in Bits) { if (j > 0) { TextBuilder.Append(' '); } if (Bit.StartsWith("http://")) { LinkRefs.Add(i, Bit); TextBuilder.Append("{" + i++ + "}"); } else if (Bit.StartsWith("www.")) { LinkRefs.Add(i, Bit); TextBuilder.Append("{" + i++ + "}"); } else { TextBuilder.Append(Bit); } j++; } ServerMessage Message = new ServerMessage(ChatType == ChatType.Say ? OpcodesOut.ROOM_CHAT_SAY : (ChatType == ChatType.Whisper ? OpcodesOut.ROOM_CHAT_WHISPER : OpcodesOut.ROOM_CHAT_SHOUT)); Message.AppendUInt32(ActorId); Message.AppendStringWithBreak(TextBuilder.ToString()); Message.AppendInt32(EmotionId); Message.AppendInt32(LinkRefs.Count); foreach (KeyValuePair<int, string> LinkedRef in LinkRefs) { string Url = LinkedRef.Value; if (!Url.StartsWith("http://")) { Url = "http://" + Url; } Message.AppendStringWithBreak("/link_to.php?url=" + HttpUtility.UrlEncode(Url) + "&hash=xx"); Message.AppendStringWithBreak(LinkedRef.Value); Message.AppendBoolean(false); // Trusted URL (instaopen) } Message.AppendInt32(0); // No idea Message.AppendBoolean(true); return Message; }
static void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, UUID id, UUID ownerid, Vector3 position) { if (fromName != _Client.Self.Name && type == ChatType.Normal && audible == ChatAudibleLevel.Fully) { string str = "<" + fromName + "> " + message; _IRC.SendMessage(_AutoJoinChannel, str); Console.WriteLine("[SL->IRC] " + str); } }
public ChatViewAddedEventArgs(ChatModel chatModel, string chatId, ChatType chatType, int chatPosition, Type protocolManagerType) { ChatModel = chatModel; ChatID = chatId; ChatType = chatType; ChatPosition = chatPosition; ProtocolManagerType = protocolManagerType; }
public ChatEventArgs(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position) { this.message = message; this.audible = audible; this.type = type; this.sourceType = sourceType; this.fromName = fromName; this.id = id; this.ownerid = ownerid; this.position = position; }
protected ChatModel(string id, string name, ChatType chatType, IProtocolManager networkManager) { _ID = id; _Name = name; _ChatType = chatType; _ProtocolManager = networkManager; Position = -1; if (ProtocolManager == null) { InitMessageBuffer(MessageBufferPersistencyType.Volatile); } }
public static void CreateChatMessage(ChatType type, string message, ServerToClientMessage wm) { if (wm.Sender == null) throw (new Exception("wm.Sender can't be NULL on outgoing messages.")); wm.MessageType = MessageType.S2C_ChatMessage; wm.Code = (int)type; wm.DeliveryMethod = NetDeliveryMethod.ReliableOrdered; wm.DeliveryChannel = 0; wm.Data = message; }
public void ChatToDebug(ChatType type, Character sender, string message, GameReader packet, GameData gameData, ExtensionHandler extensions) { if (type == ChatType.Announcement) sender.Name = ""; Debug.Information(type.ToString() + ":" + sender.Name + ": " + message); if (type == ChatType.Private && sender.Name == "Reporter") { gameData.commands.SendMessage(ChatType.Private, sender, "ECHO: " + message); } }
public void SendMessage(ChatType type, Character Destination, string message) { GameWriter gw = new GameWriter(gameData); gw.writeB(PacketList.Client.Say2); gw.writeS(message); gw.writeD((byte)type); if(type == ChatType.Private) gw.writeS(Destination.Name); gw.Encrypt(); outBuffer.Push(gw.Finalize()); }
public List<Message> GetChats(ChatType chatType) { try { return messages.Where(x => x.ChatType == chatType).ToList(); } catch (Exception errormessage) { File.AppendAllText(path, "Message: " + errormessage.Message + "InnerException: " + errormessage.InnerException + "Date and Time: " + DateTime.Now); throw new FaultException("Error while trying to retrieve messages"); } }
/// <summary> /// Found with ChatType Unknown /// </summary> /// <param name="chatType"></param> /// <param name="message"></param> public BaseChat(ChatType chatType, Character Speaker, string message) { packet.Type(1006); packet.WriteShort((short)chatType); packet.WriteByte(0); packet.WriteShort(Speaker.TamerHandle); packet.WriteInt(Speaker.Location.PosX); packet.WriteInt(Speaker.Location.PosY); packet.WriteShort(267); //Another Chattype packet.WriteString(Speaker.Name); packet.WriteString(message); packet.WriteByte(0); }
private void ProcessChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourceType, string fromName, OpenMetaverse.UUID id, OpenMetaverse.UUID ownerid, OpenMetaverse.Vector3 position) { string msg = JsonUtil.SerializeMessage(JsonType.ChatReceived, new JsonChatReceived( message, (int)type, fromName, id.ToString(), ownerid.ToString(), position.X, position.Y, position.Z )); Ox.EventFire(msg, true); }
public void Self_OnChat(string message, ChatAudibleLevel audible, ChatType type, ChatSourceType sourcetype, string fromName, LLUUID id, LLUUID ownerid, LLVector3 position) { Console.WriteLine(fromName+":" + message); if (message.Length > 0 && message.ToLower().Contains(Client.Self.FirstName.ToLower()) && Client.Self.AgentID != id) { WebRequest request = WebRequest.Create("http://www.mr-technicl.com/slfutura.php?nick="+ fromName + "&message="+ message); WebResponse response = request.GetResponse(); StreamReader input = new StreamReader(response.GetResponseStream()); string say = input.ReadToEnd(); input.Close(); libsecondlife.Utilities.Realism.Chat(Client, say, ChatType.Normal, 25); } }
public static bool IsAllow(GameUser user, ChatType chatType) { if (user != null) { if (chatType == ChatType.World && (DateTime.Now - user.Property.ChatDate).TotalSeconds >= IntervalSend) { return true; } else if (chatType != ChatType.World) { return true; } } return false; }
private static Packet ConstructBroadcastPacket(ChatType type, Boolean isGm, String sender, Int64 sendercoid, String msg) { var msglen = (Int16) msg.Length; var p = new Packet(Opcode.Broadcast); p.WriteInteger((UInt32) type); p.WriteLong(sendercoid); p.WriteBoolean(isGm); p.WritePadding(1).WriteShort(msglen); p.WriteUtf8StringOn(sender, 17); p.WriteUtf8StringOn(msg, msglen); p.WriteByte(0); return p; }
private static Packet ConstructChatPacket(ChatType type, Boolean isGm, String recipient, String sender, String msg) { var msglen = (Int16) msg.Length; var p = new Packet(Opcode.Chat); p.WriteInteger((UInt32) type); p.WriteBoolean(isGm); p.WriteUtf8StringOn(recipient, 17); p.WriteUtf8StringOn(sender, 17); p.WritePadding(1).WriteShort(msglen); p.WriteUtf8StringOn(msg, msglen); p.WriteByte(0); return p; }
public void SystemSend(ChatType chatType, string content) { //if (chatType == ChatType.Whisper) return; var chat = new ChatData { Version = NextVersion, FromUserID = Language.Instance.SystemUserId, FromUserName = Language.Instance.KingName, ToUserID = 0, ChatType = chatType, Content = content, SendDate = DateTime.Now, RoomId = _user.Property.RoomId, TableId = _user.Property.TableId }; Send(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, ToUserID = 0, ChatType = chatType, Content = content, SendDate = DateTime.Now, RoomId = _user.Property.RoomId, TableId = _user.Property.TableId }; Send(chat); }
public Entity[] GetChatTypes() { List <Entity> result = new List <Entity>(); String sql = "SELECT * from ChatType;"; DbDataReader reader = querySelect(sql); if (reader.HasRows) { while (reader.Read()) { ChatType ctype = new ChatType(); ctype.id = reader.GetInt16(0); ctype.name = reader.GetString(1); result.Add(ctype); } } return(result.ToArray()); }
public void Send(ChatType chatType, int chatID, string content) { var chat = new ChatData { Version = NextVersion, FromUserID = _user.UserId.ToInt(), FromUserName = _user.NickName, ToUserID = 0, ChatType = chatType, ChatID = chatID, Content = content, SendDate = DateTime.Now, RoomId = _user.Property.RoomId, TableId = _user.Property.TableId }; _user.Property.ChatDate = DateTime.Now; Send(chat); }
internal static bool AddMessage(MessageType type, string messageText, int messageFromIdPerson, int?messageFromIdEntity, long idChatSentInto, DateTime?sentDate, bool hasBeenSent, int messageFromIdBot, int messageIdTgFrom, ChatType type_chat_sent_into, int?photo_id, int?video_id) { const string q = "INSERT INTO Messages " + "(id, from_id_person, from_id_entity, type, " + "id_photo, id_video, message_text, id_chat_sent_into, sent_date," + " has_been_sent, from_id_bot, message_id_tg_from, type_chat_sent_into) " + "VALUES " + "(@id, @fip, @fie, @t, @idp, @idv, @mt, @icsi, @sent_date, @hbs, @fib, @mitf, @tcsi);"; var typeI = GetMessageTypeByName(type); if (typeI == null) { return(false); } var id = Tables.GetMaxId("Messages", "id"); id++; SqLite.Execute(q, new Dictionary <string, object> { { "@id", id }, { "@fip", messageFromIdPerson }, { "@fie", messageFromIdEntity }, { "@t", typeI }, { "@idp", photo_id }, { "@idv", video_id }, { "@mt", messageText }, { "@icsi", idChatSentInto }, { "@sent_date", sentDate }, { "@hbs", hasBeenSent }, { "@fib", messageFromIdBot }, { "@mitf", messageIdTgFrom }, { "@tcsi", type_chat_sent_into.ToString() } }); return(true); }
private void OnEvent_ChatMessage(ChatType chatType, string msg, Player player) { switch (msg) { case "/income": { int ownerId = GetOwnerIdForReward(player); if ((ownerId != 0) && _saveState.FactionIdToRewards.ContainsKey(ownerId)) { lock (_saveState) { if (_incomeScreensOpen.Contains(ownerId)) { player.SendAlarmMessage("Another member of your faction has the income window open."); } else { _incomeScreensOpen.Add(ownerId); var rewards = _saveState.FactionIdToRewards[ownerId]; var task = player.DoItemExchange("Shared faction income", "Income from captured structures", "Process", rewards.ExtractOutForItemExchange()); task.ContinueWith( (Task <Eleon.Modding.ItemExchangeInfo> itemExchangeInfoInTask) => { lock (_saveState) { var itemExchangeInfoInQuote = itemExchangeInfoInTask.Result; rewards.AddStacks(new ItemStacks(itemExchangeInfoInQuote.items)); _incomeScreensOpen.Remove(ownerId); } }); } } } else { player.SendAlarmMessage("No income available."); } } break; } }
public void SendDisplay(String nMessage, ChatType nType) { StringBuilder buffer = new StringBuilder(); switch (nType) { case ChatType.Send: buffer.Append("SendMessage : "); break; case ChatType.Receive: buffer.Append("RecieveMessage : "); break; case ChatType.System: buffer.Append("SystemMessage : "); break; } buffer.Append(nMessage); if (m_Line < 20) { m_Display.Add(buffer); } else { m_Display.RemoveAt(0); m_Display.Add(buffer); } m_Line++; Console.Clear(); for (int i = 0; i < 20; i++) { if (i < m_Display.Count) { Console.WriteLine(m_Display[i].ToString()); } else { Console.WriteLine(); } } Console.Write("Input Msg (exit-종료) : "); }
public override EventEat OnSay3(Entity player, ChatType type, string name, ref string message) { if (type == ChatType.All) // only change global messages, not team chat. { var changed = ""; var rnd = new Random(); if (rainbow_enabled[player.EntRef]) { message = Regex.Replace(message, @"\^\d", ""); // strip color tags for (var i = 0; i < message.Length; i++) { changed += "^" + rainbow[rnd.Next(rainbow.Length)] + message[i]; } message = changed; } } return(EventEat.EatNone); }
public AudioMessage(string sender, string reciverID, ChatType chatType, string extraParam, bool isFromServer) { this.senderID = sender; this.messageType = MessageBodyType.Voice; this.reciverID = reciverID; this.chatType = chatType; this.extraParam = extraParam; // this.isRecorgnizeText = isRecorgnizeText; this.isReceiveFromServer = isFromServer; if (isFromServer) { sendStatus = SendStatus.Sended; } else { sendStatus = SendStatus.NotStartSend; } }
private bool MemberRemove_Loaded(ChatType chatType, ChatMemberStatus status, ChatMember member) { if (member.Status is ChatMemberStatusCreator || member.Status is ChatMemberStatusAdministrator admin && !admin.CanBeEdited) { return(false); } if (member.MemberId.IsUser(ViewModel.CacheService.Options.MyId)) { return(false); } if (chatType is ChatTypeBasicGroup && status is ChatMemberStatusAdministrator) { return(member.InviterUserId == ViewModel.CacheService.Options.MyId); } return(status is ChatMemberStatusCreator || status is ChatMemberStatusAdministrator administrator && administrator.Rights.CanRestrictMembers); }
private bool MemberRestrict_Loaded(ChatType chatType, ChatMemberStatus status, ChatMember member) { if (member.Status is ChatMemberStatusCreator || member.Status is ChatMemberStatusRestricted || member.Status is ChatMemberStatusAdministrator admin && !admin.CanBeEdited) { return(false); } if (member.MemberId.IsUser(ViewModel.CacheService.Options.MyId)) { return(false); } if (chatType is ChatTypeSupergroup supergroup && supergroup.IsChannel) { return(false); } return(status is ChatMemberStatusCreator || status is ChatMemberStatusAdministrator administrator && administrator.Rights.CanRestrictMembers); }
private static void HandleWorldChat(GameSession session, string message, ChatType type) { List <Item> playerInventoryItems = new(session.Player.Inventory.Items.Values); Item voucher = playerInventoryItems.FirstOrDefault(x => x.Tag == "FreeWorldChatCoupon"); if (voucher != null) { session.Send(NoticePacket.Notice(SystemNotice.UsedWorldChatVoucher, NoticeType.ChatAndFastText)); InventoryController.Consume(session, voucher.Uid, 1); } else if (!session.Player.Wallet.RemoveMerets(30)) { session.Send(ChatPacket.Error(session.Player, SystemNotice.InsufficientMerets, ChatType.NoticeAlert)); return; } MapleServer.BroadcastPacketAll(ChatPacket.Send(session.Player, message, type)); }
public static ChatPacket ByteToChatPacket(byte[] data, ChatType type) { ChatPacket chatPack = new ChatPacket(); if (data.Length > BlindChatConst.CHATDATASIZE) { //MessageBox.Show("Data Size Must be smaller than 2048 bytes"); chatPack.Data = null; return(chatPack); } else { byte[] packData = new byte[BlindChatConst.CHATDATASIZE]; Array.Copy(data, packData, data.Length); chatPack.Type = type; chatPack.Data = packData; } return(chatPack); }
private void OnEvent_ChatMessage(ChatType chatType, string msg, Player player) { if (msg == _config.StarterShipCommand) { _traceSource.TraceInformation($"Player '{player}' asked for a ship."); lock (_saveState) { if (_saveState.HasGotStarterShip(player)) { _traceSource.TraceInformation($"Player '{player}' already redeemed a ship."); player.SendAlarmMessage("You already redeemed your starter ship earlier."); } else { OnGetStarterShip(player); } } } }
public override EventEat OnSay3(Entity player, ChatType type, string name, ref string message) { /*if (message.Equals("!pos")) * { * Log.Write(LogLevel.All,"AddItemSpawn(" + player.Origin.X + "F, " + player.Origin.Y + "F, " + player.Origin.Z + "F);"); * return EventEat.EatGame; * } * if (message.Equals("!w")) * { * Utilities.RawSayTo(player, player.CurrentWeapon.ToString()); * return EventEat.EatGame; * } * if (message.Equals("!t")) * { * Utilities.RawSayTo(player, player.GetField<string>("sessionteam")); * return EventEat.EatGame; * }*/ return(EventEat.EatNone); }
public ChatInfo CreateChatInfoByInputString(string s, ChatType type) { canSendMessage = true; if (type == ChatType.World) { StartCoroutine(ChatSendCDCoroutine()); } if (s.Length > 140) { s = s.Substring(0, 140); } ChatInfo info = new ChatInfo(); info.talkerName = GameProxy.instance.AccountName; info.chatType = type; info.isMe = true; info.content = s; return(info); }
private Color GetMessageColor(ChatType chatType) { switch (chatType) { case ChatType.Info: return(Color.green); case ChatType.Player: return(Color.black); case ChatType.KillInfo: return(Color.red); default: break; } return(Color.black); }
/** * <summary> * Helper function for LoadLogs * function checks if given message contains a valid command and will return the correct command or null. * </summary> */ public static Command BuildCommand(string rawString, ChatType chatType, string name, string rawMessage) { string message; ChatType exportChatType; #region command validation if (rawMessage.StartsWith("!all")) { message = rawMessage.Substring(4).Trim(); exportChatType = ChatType.All; } else if (rawMessage.StartsWith("!team")) { message = rawMessage.Substring(5).Trim(); exportChatType = ChatType.Team; } else { return(null); } #endregion #region language param checking /* checking if there is a language param. */ var temp = message.Split(new char[] { ' ' }, 2); var possLang = temp[0].Trim(); if (possLang[0] != '-') { return(message.Length > 0 ? new TransCommand(rawString, exportChatType, chatType, name, message) : null); } var lang = possLang.Substring(1); message = temp[1].Trim(); #endregion return(message.Length > 0 ? new TransCommand(rawString, exportChatType, chatType, name, message, lang) : null); }
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); } }
private async void OnEvent_ChatMessage(ChatType chatType, string msg, Player player) { try { switch (msg) { case "/votereward": { _traceSource.TraceInformation("{0} is trying to claim a voting reward.", player); if (await DoesPlayerHaveReward(player)) { _traceSource.TraceInformation("{0} has a voting reward to claim; show reward to player.", player); var rewardItems = _config.VotingRewards.ToEleonArray(); var itemExchangeInfo = await player.DoItemExchange("Voting Reward", "Remember to vote everyday. Enjoy!", "Close", rewardItems); _traceSource.TraceInformation("{0} has closed the voting reward UI.", player); if (!rewardItems.AreTheSame(itemExchangeInfo.items)) { _traceSource.TraceInformation("{0} took at least some of the voting reward.", player); await MarkRewardClaimed(player); _traceSource.TraceInformation("{0} claimed a voting reward.", player); } else { _traceSource.TraceInformation("{0} didn't claim any reward items.", player); } } else { _traceSource.TraceInformation("No unclaimed voting reward found for {0}.", player); await player.SendAlarmMessage("No unclaimed voting reward found."); } } break; } } catch (Exception ex) { _traceSource.TraceEvent(TraceEventType.Error, 1, ex.ToString()); } }
/// <summary> /// A psuedo-realistic chat function that uses the typing sound and /// animation, types at a given rate, and randomly pauses. This /// function will block until the message has been sent /// </summary> /// <param name="client">A reference to the client that will chat</param> /// <param name="message">The chat message to send</param> /// <param name="type">The chat type (usually Normal, Whisper or Shout)</param> /// <param name="cps">Characters per second rate for chatting</param> public static void Chat(GridClient client, string message, ChatType type, int cps) { Random rand = new Random(); int characters = 0; bool typing = true; // Start typing client.Self.Chat(String.Empty, 0, ChatType.StartTyping); client.Self.AnimationStart(Animations.TYPE, false); while (characters < message.Length) { if (!typing) { // Start typing again client.Self.Chat(String.Empty, 0, ChatType.StartTyping); client.Self.AnimationStart(Animations.TYPE, false); typing = true; } else { // Randomly pause typing if (rand.Next(10) >= 9) { client.Self.Chat(String.Empty, 0, ChatType.StopTyping); client.Self.AnimationStop(Animations.TYPE, false); typing = false; } } // Sleep for a second and increase the amount of characters we've typed System.Threading.Thread.Sleep(1000); characters += cps; } // Send the message client.Self.Chat(message, 0, type); // Stop typing client.Self.Chat(String.Empty, 0, ChatType.StopTyping); client.Self.AnimationStop(Animations.TYPE, false); }
public async Task <Chat> GetChatFromTesterAsync(ChatType chatType) { bool IsMatch(Update u) => ( u.Message.Chat.Type == chatType && u.Message.Text?.StartsWith("/test", StringComparison.OrdinalIgnoreCase) == true ) || ( ChatType.Channel == chatType && ChatType.Channel == u.Message.ForwardFromChat?.Type ); var update = await UpdateReceiver .GetUpdatesAsync(IsMatch, updateTypes : UpdateType.Message) .ContinueWith(t => t.Result.Single()); await UpdateReceiver.DiscardNewUpdatesAsync(); return(chatType == ChatType.Channel ? update.Message.ForwardFromChat : update.Message.Chat); }
public bool IsExistChatWithSamePeaple(List <IClientModel> users, ChatType chatType) { var allChats = AllChats.Where(c => c.ChatType == chatType).ToList(); if (allChats.Count() == 0) { return(false); } foreach (var chat in allChats) { foreach (var client in users) { if (!chat.IsClientExistInChat(client)) { return(false); } } } return(true); }
/// <summary> /// Sends a message by type /// </summary> /// <param name="type"></param> /// <param name="richTextBox"></param> private void SendMessage(ChatType type, RichTextBox richTextBox) { PacketWriter writer = new PacketWriter(Opcodes.CMSG_MESSAGECHAT); switch (type) { case ChatType.CHAT_TYPE_SAY: writer.Write((UInt32)ChatType.CHAT_TYPE_SAY); break; case ChatType.CHAT_TYPE_YELL: writer.Write((UInt32)ChatType.CHAT_TYPE_YELL); break; } writer.Write((UInt32)Language.LANG_UNIVERSAL); writer.Write(richTextBox.Text.ToCString()); WorldMgr.Server.Send(writer); richTextBox.Text = ""; }
public void Initialize(string text, string time, ChatType type) { textMessage.text = text; timeText.text = time; if (type == ChatType.client) { timeText.GetComponent <RectTransform>().anchorMin = new Vector2(0, .5f); timeText.GetComponent <RectTransform>().anchorMax = new Vector2(0, .5f); timeText.GetComponent <RectTransform>().pivot = new Vector2(0, .5f); textBoxBG.color = clientColor; } else { timeText.GetComponent <RectTransform>().anchorMin = new Vector2(1, .5f); timeText.GetComponent <RectTransform>().anchorMax = new Vector2(1, .5f); timeText.GetComponent <RectTransform>().pivot = new Vector2(1, .5f); textBoxBG.color = mainColor; } }
public static string GetString(ChatType ct) { switch (ct) { case ChatType.Channel: return("channel"); case ChatType.Group: return("group"); case ChatType.Private: return("private"); case ChatType.Supergroup: return("supergroup"); default: return("unknown"); } }
public void Call(long callID, ChatType type, int userId, List <UserInfo> peerId) { if (CallID == 0) { isChatting = true; CallID = callID; DataModel model = new DataModel(); model.Type = ChatProtocolType.TYPE_IM; model.Request = IMProtocol.IM_CALL; IMInfo info = new IMInfo(); info.CallID = callID; info.Type = (int)type; info.UserID = userId; info.UserList.AddRange(peerId); model.Message = info.ToByteArray(); ChatNetworkManager.Instance.Send(model); } }
private void RunEffect(IPlayer iplayer, ChatType type) { var player = (BasePlayer)iplayer.Object; if (player == null) { return; } switch (type) { case ChatType.PM: if (config.UseCooldown && cooldown.PM.Contains(player.userID)) { return; } cooldown.PM.Add(player.userID); timer.In(config.Cooldown, () => cooldown.PM.Remove(player.userID)); break; case ChatType.Clan: if (config.UseCooldown && cooldown.Clan.Contains(player.userID)) { return; } cooldown.Clan.Add(player.userID); timer.In(config.Cooldown, () => cooldown.Clan.Remove(player.userID)); break; case ChatType.Global: if (config.UseCooldown && cooldown.Global.Contains(player.userID)) { return; } cooldown.Global.Add(player.userID); timer.In(config.Cooldown, () => cooldown.Global.Remove(player.userID)); break; } Effect.server.Run(config.SoundPrefab, player.transform.position); }
private void ShowOrHideContent(ChatType chatType) { switch (chatType) { case ChatType.PrivateChat: if (panPrivate_content.Height > 0) { panPrivate_content.Height = 0; } else { ShowChatContent(chatType); } break; case ChatType.GroupChat: if (panGroup_content.Height > 0) { panGroup_content.Height = 0; } else { ShowChatContent(chatType); } break; case ChatType.TeamChat: if (panTeam_content.Height > 0) { panTeam_content.Height = 0; } else { ShowChatContent(chatType); } break; default: break; } }
private PacketAction GetActionFromType(ChatType chatType) { switch (chatType) { case ChatType.Local: return(PacketAction.Report); case ChatType.PM: return(PacketAction.Tell); case ChatType.Global: return(PacketAction.Message); case ChatType.Guild: return(PacketAction.Request); case ChatType.Party: return(PacketAction.Open); case ChatType.Admin: return(PacketAction.Admin); case ChatType.Announce: return(PacketAction.Announce); default: throw new ArgumentOutOfRangeException(nameof(chatType)); } }
public void OnReciveMessage(ChatType type, string message) { StringBuilder builder = new StringBuilder(); switch (type) { case ChatType.Global: builder.Append("[Global]"); break; case ChatType.Alliance: builder.Append("[Alliance]"); break; case ChatType.Private: builder.Append("[Private]"); break; } builder.Append(message); _messagesList.Add(builder.ToString()); }