public string message; // = null; partial void AfterEncode() { Write(false); ChatTypes chatType = (ChatTypes)type; switch (chatType) { case ChatTypes.Chat: case ChatTypes.Whisper: case ChatTypes.Announcement: Write(source); Write(""); //TODO: third party name WriteSignedVarInt(0); //TODO: platform goto case ChatTypes.Raw; case ChatTypes.Raw: case ChatTypes.Tip: case ChatTypes.System: Write(message); break; case ChatTypes.Popup: case ChatTypes.Translation: case ChatTypes.Jukeboxpopup: Write(message); WriteUnsignedVarInt(0); //TODO: translation parameters (list of strings) break; } Write(""); //TODO: XUID Write(""); //TODO: platform chat ID }
public void UnsetUnique(IEnumerable <XivChatType> types) { foreach (var xivChatType in types) { ChatTypes.Remove(xivChatType); } }
partial void AfterEncode() { //Write(islocalized); ChatTypes chatType = (ChatTypes)type; switch (chatType) { case ChatTypes.Chat: case ChatTypes.Whisper: case ChatTypes.Announcement: Write(source); Write(message); break; case ChatTypes.Raw: case ChatTypes.Tip: case ChatTypes.System: Write(message); break; case ChatTypes.Popup: case ChatTypes.Translation: case ChatTypes.JukeboxPopup: Write(message); WriteVarInt(parameters.Length); foreach (var p in parameters) { Write(p); } break; } Write(xuid); }
public static ChatlineColor GetColor(ChatTypes chatType) { switch (chatType) { case ChatTypes.Shout: return(ChatlineColor.Green); case ChatTypes.Alert: return(ChatlineColor.OrangeRed); case ChatTypes.Error: return(ChatlineColor.Red); case ChatTypes.Radio: return(ChatlineColor.Pink); case ChatTypes.Notification: return(ChatlineColor.Magenta); case ChatTypes.None: return(ChatlineColor.White); default: { ConsoleManager.WriteLine("Warning: GetColor not implemented for " + chatType.ToString()); return(ChatlineColor.White); } } }
partial void AfterDecode() { ReadBool(); // localization ChatTypes chatType = (ChatTypes)type; switch (chatType) { case ChatTypes.Chat: case ChatTypes.Whisper: case ChatTypes.Announcement: source = ReadString(); message = ReadString(); break; case ChatTypes.Raw: case ChatTypes.Tip: case ChatTypes.System: message = ReadString(); break; case ChatTypes.Popup: case ChatTypes.Translation: case ChatTypes.Jukeboxpopup: message = ReadString(); // More stuff break; } }
public string message; // = null; partial void AfterEncode() { Write(false); ChatTypes chatType = (ChatTypes)type; switch (chatType) { case ChatTypes.Chat: case ChatTypes.Whisper: case ChatTypes.Announcement: Write(source); Write(message); break; case ChatTypes.Raw: case ChatTypes.Tip: case ChatTypes.System: Write(message); break; case ChatTypes.Popup: case ChatTypes.Translation: case ChatTypes.Jukeboxpopup: Write(message); // More stuff break; } }
partial void AfterDecode() { needsTranslation = ReadBool(); ChatTypes chatType = (ChatTypes)type; switch (chatType) { case ChatTypes.Chat: case ChatTypes.Whisper: case ChatTypes.Announcement: source = ReadString(); goto case ChatTypes.Raw; case ChatTypes.Raw: case ChatTypes.Tip: case ChatTypes.System: message = ReadString(); break; case ChatTypes.Popup: case ChatTypes.Translation: case ChatTypes.Jukeboxpopup: message = ReadString(); parameters = new string[ReadUnsignedVarInt()]; for (var i = 0; i < parameters.Length; ++i) { parameters[i] = ReadString(); } break; } xuid = ReadString(); platformChatId = ReadString(); }
// Sends chat message packet to server public void SendChatMessage(string text, ChatTypes chatType, params string[] customParams) { if (chatType == ChatTypes.AutoSelect) { chatType = Chat.ActiveChat; } Chat.SendChatMessage(text, chatType, customParams); }
// Sets active chat public void SetActiveChat(ChatTypes chatType) { ActiveChat = chatType; clientGame.Invoke(() => { clientGame.MainWindow.ChatActiveLabel.Content = chatType; clientGame.MainWindow.ChatActiveLabel.Foreground = GetChatColor(chatType); }); }
public void SetUnique(IEnumerable <XivChatType> types) { foreach (var xivChatType in types) { if (!ChatTypes.Contains(xivChatType)) { ChatTypes.Add(xivChatType); } } }
public GameMessageIn(GameServerPacket packet) { BinaryReader br = new BinaryReader(new MemoryStream(packet.Data)); ChatType = (ChatTypes)br.ReadByte(); UnknownA = br.ReadByte(); EntityType = br.ReadByte(); EntityID = br.ReadUInt32(); UnknownB = br.ReadByte(); UnknownC = br.ReadByte(); CharacterName = Util.ReadSpecialString(br); Message = Util.ReadSpecialString(br);; }
public static ChatPayloadPrefix CreateChatPayload(ChatTypes chatTypes) { Type classType; if (ChatPayloadFromType.TryGetValue(chatTypes, out classType)) { ChatPayloadPrefix result = (ChatPayloadPrefix)Activator.CreateInstance(classType); result.Magic = ChatPayloadPrefix.PayloadMagic; result.Type = 0; return(result); } return(null); }
/// <summary> /// Returns if message can be split /// </summary> /// <param name="chatType">ChatType to check</param> /// <returns>If Splitable</returns> private bool IsSplitable(ChatTypes chatType) { // If a player wrote the message, our line-split character should be included in the message switch (chatType) { case ChatTypes.Radio: case ChatTypes.Shout: case ChatTypes.tell: case ChatTypes.hug: case ChatTypes.admins: return(false); default: return(true); } }
public IBotServerConfiguration GetServerConfig(ulong id, ChatTypes chatType, string name = "") { var result = GuildConfigs.FirstOrDefault(x => x.Id == id && (x.ChatType ?? ChatTypes.Discord) == chatType); if (result == null) { result = new ServerConfiguration() { Id = id, ChatType = chatType, Name = name }; GuildConfigs.Add(result); } result.ChatType = chatType; return(result); }
// Sends chat message to server public void SendChatMessage(string text, ChatTypes chatType, params string[] customParams) { if (string.IsNullOrWhiteSpace(text)) { return; } var packet = new Packet(CMSGPackets.CMSG_CHAT_MESSAGE); packet.Write((byte)chatType); packet.Write(text.Trim()); foreach (var p in customParams) { packet.Write(p); } clientGame.SendPacket(packet); }
public string[] parameters; // = null partial void AfterEncode() { Write(needsTranslation); ChatTypes chatType = (ChatTypes)type; switch (chatType) { case ChatTypes.Chat: case ChatTypes.Whisper: case ChatTypes.Announcement: Write(source); goto case ChatTypes.Raw; case ChatTypes.Raw: case ChatTypes.Tip: case ChatTypes.System: case ChatTypes.Json: Write(message); break; case ChatTypes.Popup: case ChatTypes.Translation: case ChatTypes.Jukeboxpopup: Write(message); if (parameters == null) { WriteUnsignedVarInt(0); } else { WriteUnsignedVarInt((uint)parameters.Length); foreach (var parameter in parameters) { Write(parameter); } } break; } Write(xuid); Write(platformChatId); }
/// <summary> /// Returns a color for the prefix, based on the chat type. /// </summary> /// <param name="chatType">Chat Type Enum</param> /// <returns>Color to Draw</returns> private Color GetPrefixColor(ChatTypes chatType) { //Console.WriteLine("Value " + chatType); switch (chatType) { case ChatTypes.Radio: return(Color.MediumPurple); case ChatTypes.tell: return(Color.LightBlue); case ChatTypes.hug: return(Color.MediumSpringGreen); case ChatTypes.Shout: return(Color.LimeGreen); case ChatTypes.admin: return(Color.HotPink); case ChatTypes.admins: return(Color.HotPink); case ChatTypes.help: return(Color.Yellow); case ChatTypes.warp: return(Color.Turquoise); case ChatTypes.whosonline: return(Color.SteelBlue); case ChatTypes.login: return(Color.MediumTurquoise); case ChatTypes.Alert: return(Color.OrangeRed); default: return(Color.White); } }
// Returns chat color private Brush GetChatColor(ChatTypes chatType) { switch (chatType) { case ChatTypes.Game: return(Brushes.Blue); case ChatTypes.Global: return(Brushes.Green); case ChatTypes.Whisper: case ChatTypes.WhisperResponse: return(Brushes.Purple); case ChatTypes.Info: return(Brushes.Orange); default: return(Brushes.Black); } }
partial void AfterDecode() { ReadBool(); // localization ChatTypes chatType = (ChatTypes)type; switch (chatType) { case ChatTypes.Chat: case ChatTypes.Whisper: case ChatTypes.Announcement: source = ReadString(); ReadString(); //TODO: third party name ReadSignedVarInt(); //TODO: platform goto case ChatTypes.Raw; case ChatTypes.Raw: case ChatTypes.Tip: case ChatTypes.System: message = ReadString(); break; case ChatTypes.Popup: case ChatTypes.Translation: case ChatTypes.Jukeboxpopup: message = ReadString(); uint parameterCount = ReadUnsignedVarInt(); for (uint i = 0; i < parameterCount; ++i) { ReadString(); //TODO: translation parameters } // More stuff break; } ReadString(); //TODO: XUID ReadString(); //TODO: platform chat ID }
partial void AfterDecode() { //ReadBool(); // localization ChatTypes chatType = (ChatTypes)type; switch (chatType) { case ChatTypes.Chat: case ChatTypes.Whisper: case ChatTypes.Announcement: source = ReadString(); message = ReadString(); break; case ChatTypes.Raw: case ChatTypes.Tip: case ChatTypes.System: message = ReadString(); break; case ChatTypes.Popup: case ChatTypes.Translation: case ChatTypes.JukeboxPopup: message = ReadString(); int count = ReadVarInt(); parameters = new string[count]; for (int i = 0; i < parameters.Length; i++) { parameters[i] = ReadString(); } // More stuff break; } xuid = ReadString(); }
// Writes message as channel message into chat public void WriteChannelMessage(ChatTypes chatType, string message, string sender) { Write($"[{chatType.GetDescription()}] {sender}> {message}", chatType); }
// Writes message into chat public void Write(string message, ChatTypes chatType) { InvokeToChat(message, clientGame.MainWindow.GeneralChatTab, GetChatColor(chatType)); }
public ChatHandler(ClientGame game) { clientGame = game; ActiveChat = ChatTypes.Global; }
public IBotServerConfiguration GetServerConfig(ulong id, ChatTypes chatType, string name = "") { throw new NotImplementedException(); }
//public NetOutgoingMessage SerializeChatMessage(string chatJson) //{ // return SerializeChatMessage(chatJson, null); //} //public NetOutgoingMessage SerializeChatMessage(string chatJson, string metaJson) //{ // var data = CreateChatMessageContainer(chatJson, metaJson); // var msg = _connectionManager.Server.CreateMessage(); // data.WriteToLidgrenMessage_ToClient(MessageTypes.ChatMessage, msg); // return msg; //} /// <summary> /// Builds and a simple chat text and colors the prefix according to chatType /// </summary> /// <param name="prefix"></param> /// <param name="text"></param> /// <param name="chatType"></param> public void SendSimpleChat(Player p, string prefix, string text, ChatTypes chatType, ChatlineColor textColor = ChatlineColor.White) { var chat = new OutboundChatMessage(p, BuildChatLine(prefix, text, ChatHelpers.GetColor(chatType), textColor)); SendChatToPlayer(chat); }
/// <summary> /// Sends a simple chat message to all online players in the area except for the player with the corresponding playerIdToIgnore /// </summary> /// <param name="area"></param> /// <param name="prefix"></param> /// <param name="text"></param> /// <param name="chatType"></param> /// <param name="playerIdToIgnore"></param> public void BroadcastSimpleChat(IArea area, string prefix, string text, ChatTypes chatType, int?playerIdToIgnore = null) { var outboundList = area.BuildReplyAllChatList(playerIdToIgnore, BuildChatLine(prefix, text, ChatHelpers.GetColor(ChatTypes.Alert))); SendChatList(outboundList); }
/// <summary> /// Сканировать входящий Telegram.Update /// </summary> public void UpdateNew() { if (IncUpdate is null) { return; } ScanSpamMatches = new List <SpamMatch>(); ChatAdmins = new List <ChatMemberClass>(); CompositionTypes = new List <TelegramDataTypes>(); #region Определение типа чата ChatType = ChatTypes.Error; foreach (ChatTypes c in Enum.GetValues(typeof(ChatTypes))) { if (c.ToString("g").ToLower() == IncUpdate.message.chat.type.ToLower()) { ChatType = c; break; } } #endregion //////////////////////////////////////////////////////// #region Если сообщение из группы или супергруппы, то определяем администраторов чата if ((ChatType == ChatTypes.Group || ChatType == ChatTypes.Supergroup) && ChatAdmins.Count == 0) { ChatMemberClass[] chat_admins = telegram_client.getChatAdministrators(IncUpdate.message.chat.id.ToString()); if (!(chat_admins is null)) { ChatAdmins.AddRange(chat_admins.Where(x => !x.user.is_bot)); } } #endregion #region Определение состава данных сообщения if (!(IncUpdate.message is null)) { if (!string.IsNullOrEmpty(IncUpdate.message.text)) { CompositionTypes.Add(TelegramDataTypes.Text); if (Regex.IsMatch(IncUpdate.message.text, @"^\s*\d{1,2}\.\d{1,6}\s*,\s*d{1,2}\.\d{1,6}\s*$")) { CompositionTypes.Add(TelegramDataTypes.LocationText); } } if (!string.IsNullOrEmpty(IncUpdate.message.caption)) { CompositionTypes.Add(TelegramDataTypes.Caption); } if (!(IncUpdate.message.new_chat_members is null)) { CompositionTypes.Add(TelegramDataTypes.NewChatMembers); } if (!(IncUpdate.message.location is null)) { CompositionTypes.Add(TelegramDataTypes.Location); } if (!(IncUpdate.message.photo is null)) { CompositionTypes.Add(TelegramDataTypes.Photo); } if (!(IncUpdate.message.document is null)) { CompositionTypes.Add(TelegramDataTypes.Document); } if (!(IncUpdate.message.video is null)) { CompositionTypes.Add(TelegramDataTypes.Video); } } #endregion if (ChatType == ChatTypes.Private && !string.IsNullOrEmpty(IncUpdate.message.text)) { TelegramCommand = new TelegramCommandClass(IncUpdate.message.text); } else if (ChatType == ChatTypes.Group || ChatType == ChatTypes.Supergroup) { #region Если это группа/чат Log.WriteLine("Сканирование сообщения на спам"); SpamScanner scanMessage = new SpamScanner(this); ScanSpamMatches = scanMessage.scan_matches; #endregion } }
public byte UnknownC; //(0x05 chat, 0x01 recv-wisp) #endregion Fields #region Constructors public GameMessageIn(GameServerPacket packet) { BinaryReader br = new BinaryReader(new MemoryStream(packet.Data)); ChatType = (ChatTypes)br.ReadByte(); UnknownA = br.ReadByte(); EntityType = br.ReadByte(); EntityID = br.ReadUInt32(); UnknownB = br.ReadByte(); UnknownC = br.ReadByte(); CharacterName = Util.ReadSpecialString(br); Message = Util.ReadSpecialString(br); ; }