/// <summary> /// Create a default message. /// </summary> /// <param name="text"></param> public ChatMessage(string text) { this.Text = text; this.Recipient = ""; this.Channel = ChatChannel.None; this.Type = SpeechType.Say; }
public static bool Send(Objects.Client client, ChatChannel channel, string name) { ChannelOpenPacket p = new ChannelOpenPacket(client); p.ChannelId = channel; p.ChannelName = name; return p.Send(); }
public ChatSendPacket(string _World, ChatChannel _Channel, string PlayerName, string Chat) : base() { World = _World; Channel = _Channel; Name = PlayerName; Text = Chat; }
/// <summary> /// Create a channel message. /// </summary> /// <param name="text"></param> /// <param name="channel"></param> public static ChatMessage CreateChannelMessage(string text, ChatChannel channel) { ChatMessage cm = new ChatMessage(text); cm.Recipient = ""; cm.Channel = channel; cm.Type = SpeechType.ChannelYellow; return cm; }
private ChatData ParseChat( JsonObject jsonObject, ChatChannel chatChannel) { var data = SimpleJson.DeserializeObject<ChatData>(jsonObject.ToString()); data.ChatChannel = chatChannel; return data; }
public static bool Send(Objects.Client client, SpeechType type, string receiver, string message, ChatChannel channel) { PlayerSpeechPacket p = new PlayerSpeechPacket(client); p.SpeechType = type; p.Receiver = receiver; p.Message = message; p.ChannelId = channel; return p.Send(); }
public override bool ParseMessage(NetworkMessage msg, PacketDestination destination) { if (msg.GetByte() != (byte)OutgoingPacketType.ChannelClose) return false; Destination = destination; Type = OutgoingPacketType.ChannelClose; ChannelId = (ChatChannel)msg.GetUInt16(); return true; }
public Form1() { InitializeComponent(); _inputChannel = ChatChannel.Global; _chatEntries = new List<ChatEntry>(); _ffcm = new FFCManager("127.0.0.1", 1255); _ffcm.OnChatChannels += _ffcm_OnChatChannels; _ffcm.OnChatMessage += _ffcm_OnChatMessage; tbEmail.Text = "*****@*****.**"; tbPassword.Text = "test"; }
public void On(JoinCompleteEvent e) { var bp = new ByteProtocol<Player>(this._byteChannel); var cc = new ChatChannel(new CompressionChannel<Player>(bp.RegisterProtocol("EE Chat"))); ThreadPool.QueueUserWorkItem(o => { while (true) { cc.Send(Console.ReadLine()); } }); cc.Receive += this.Cc_Receive; }
public static void Add( NetworkMessage message, string senderName, ushort senderLevel, SpeechType speechType, string text, Location location, ChatChannel channelId, uint time ) { message.AddByte((byte)ServerPacketType.CreatureSpeech); message.AddUInt32(0x00000000); message.AddString(senderName); message.AddUInt16(senderLevel); message.AddByte((byte)speechType); switch (speechType) { case SpeechType.Say: case SpeechType.Whisper: case SpeechType.Yell: case SpeechType.MonsterSay: case SpeechType.MonsterYell: case SpeechType.PrivateNPCToPlayer: message.AddLocation(location); break; case SpeechType.ChannelRed: case SpeechType.ChannelRedAnonymous: case SpeechType.ChannelOrange: case SpeechType.ChannelYellow: case SpeechType.ChannelWhite: message.AddUInt16((ushort)channelId); break; case SpeechType.RuleViolationReport: message.AddUInt32(time); break; default: break; } message.AddString(text); }
public static bool Send(Objects.Client client, ChatChannel channel, string name, string[] participants, string[] invitees) { ChannelOpenPacket p = new ChannelOpenPacket(client); p.ChannelId = channel; p.ChannelName = name; if (client.VersionNumber >= 872) { p.NumberOfParticipants = (ushort)(participants.Length); for (ushort n = 0; n < p.NumberOfParticipants; n++) { p.Participants[n] = participants[n]; } p.NumberOfInvitees = (ushort)(invitees.Length); for (ushort i = 0; i < p.NumberOfInvitees; i++) { p.Invitees[i] = invitees[i]; } } return p.Send(); }
public void SendChatMessage(ChatChannel channel, string text, string name, int? entityId) { string fullmsg = text; if (!string.IsNullOrEmpty(name) && channel == ChatChannel.Emote) fullmsg = text; //Emote already has name in it probably... else if (channel == ChatChannel.Ingame || channel == ChatChannel.OOC || channel == ChatChannel.Radio || channel == ChatChannel.Lobby) fullmsg = name + ": " + text; NetOutgoingMessage message = IoCManager.Resolve<ISS13NetServer>().CreateMessage(); message.Write((byte) NetMessage.ChatMessage); message.Write((byte) channel); message.Write(fullmsg); if(entityId == null) message.Write(-1); else message.Write((int)entityId); switch (channel) { case ChatChannel.Server: case ChatChannel.OOC: case ChatChannel.Radio: case ChatChannel.Player: case ChatChannel.Default: IoCManager.Resolve<ISS13NetServer>().SendToAll(message); break; case ChatChannel.Damage: case ChatChannel.Ingame: case ChatChannel.Visual: case ChatChannel.Emote: SendToPlayersInRange(message, entityId); break; case ChatChannel.Lobby: SendToLobby(message); break; } }
public static void AtStartup(RuleEngine GlobalRules) { GlobalRules.DeclareCheckRuleBook<MudObject, MudObject>("can access channel?", "[Client, Channel] : Can the client access the chat channel?", "actor", "channel"); GlobalRules.Check<MudObject, MudObject>("can access channel?") .Do((client, channel) => CheckResult.Allow) .Name("Default allow channel access rule."); GlobalRules.Perform<Actor>("player joined") .Do(player => { foreach (var c in ChatChannel.ChatChannels.Where(c => c.Short == "OOC")) c.Subscribers.Add(player); return PerformResult.Continue; }) .Name("Subscribe new players to OOC rule."); GlobalRules.Perform<Actor>("player left") .Do(player => { ChatChannel.RemoveFromAllChannels(player); return PerformResult.Continue; }) .Name("Unsubscribe players from all channels when they leave rule."); ChatChannel.ChatChannels.Clear(); ChatChannel.ChatChannels.Add(new ChatChannel("OOC")); var senate = new ChatChannel("SENATE"); senate.Check<MudObject, MudObject>("can access channel?") .When((actor, channel) => !(actor is Actor) || (actor as Actor).Rank < 100) .Do((actor, channel) => { MudObject.SendMessage(actor, "You must have a rank of 100 or greater to access this channel."); return CheckResult.Disallow; }); ChatChannel.ChatChannels.Add(senate); }
public override bool ParseMessage(NetworkMessage msg, PacketDestination destination) { if (msg.GetByte() != (byte)OutgoingPacketType.PlayerSpeech) return false; Destination = destination; Type = OutgoingPacketType.PlayerSpeech; SpeechTypeInfo info = Enums.GetSpeechTypeInfo(Client.GetVersionNumber(), msg.GetByte()); SpeechType = info.SpeechType; if (SpeechType == SpeechType.Private) { Receiver = msg.GetString(); } else if (info.AdditionalSpeechData == AdditionalSpeechData.ChannelId) { ChannelId = (ChatChannel)msg.GetUInt16(); } Message = msg.GetString(); return true; }
/// <summary>Send owner changed message to everyone</summary> /// <param name="chan">name of channel</param> /// <param name="sender">sender (to check the ignore list)</param> /// <param name="newOwner">new owner</param> public static void SendOwnerChangedToEveryone(ChatChannel chan, EntityId sender, EntityId newOwner) { }
/// <summary>Send the name of current of the channel</summary> /// <param name="client">the client the outdoing packet belongs to</param> /// <param name="chan">the channel</param> public static void SendCurrentOwner(IPacketReceiver client, ChatChannel chan) { }
public void AddLine(string message, ChatChannel channel) { if (_disposing) return; IEnumerable<string> messageSplit = CheckInboundMessage(message); foreach (Label label in messageSplit.Select(part => new Label(part, "CALIBRI", _resourceManager) { Text = { Size = new Size(ClientArea.Width - 10, 12), Color = _chatColors[channel] } })) { _entries.Add(label); } DrawLines(); }
public void Start() { namelessChannels = ChatChannel.Examine | ChatChannel.Local | ChatChannel.None | ChatChannel.System | ChatChannel.Combat; }
/// <summary> /// Send a generic message. /// </summary> /// <param name="client"></param> /// <param name="senderName"></param> /// <param name="senderLevel"></param> /// <param name="speechType"></param> /// <param name="channelId"></param> /// <param name="position"></param> /// <param name="time"></param> /// <returns></returns> public static bool Send(Objects.Client client, string senderName, ushort senderLevel, string message, SpeechType speechType, ChatChannel channelId, Objects.Location position, uint time) { CreatureSpeechPacket p = new CreatureSpeechPacket(client); p.SenderName = senderName; p.SenderLevel = senderLevel; p.Message = message; p.SpeechType = speechType; p.ChannelId = channelId; p.Position = position; p.Time = time; return p.Send(); }
/// <summary>Send the password changed message to everyone</summary> /// <param name="chan">name of channel</param> /// <param name="sender">sender (to check the ignore list)</param> public static void SendPasswordChangedToEveryone(ChatChannel chan, EntityId sender) { }
/// <summary>Send the "name has joined channel" reply to everyone</summary> /// <param name="chan">name of channel</param> /// <param name="sender">sender (to check the ignore list)</param> public static void SendJoinedReplyToEveryone(ChatChannel chan, ChannelMember sender) { }
public void SendChannelSpeech(string sender, SpeechType type, ChatChannel channelId, string message) { NetworkMessage outMessage = new NetworkMessage(); CreatureSpeechPacket.Add( outMessage, sender, 1, type, message, null, channelId, 0 ); Send(outMessage); }
/// <summary> /// Send the message about change of muted status of player to everyone /// </summary> /// <param name="chan">name of channel</param> /// <param name="sender">sender (to check the ignore list)</param> /// <param name="target">one who has changed his status</param> /// <param name="newStatus">the new status</param> public static void SendMuteStatusToEveryone(ChatChannel chan, EntityId sender, EntityId target, bool newStatus) { }
void HandleMessageChat(InPacket packet) { var type = (ChatMessageType)packet.ReadByte(); var lang = (Language)packet.ReadInt32(); var guid = packet.ReadUInt64(); var unkInt = packet.ReadInt32(); switch (type) { case ChatMessageType.Say: case ChatMessageType.Yell: case ChatMessageType.Party: case ChatMessageType.PartyLeader: case ChatMessageType.Raid: case ChatMessageType.RaidLeader: case ChatMessageType.RaidWarning: case ChatMessageType.Guild: case ChatMessageType.Officer: case ChatMessageType.Emote: case ChatMessageType.TextEmote: case ChatMessageType.Whisper: case ChatMessageType.WhisperInform: case ChatMessageType.System: case ChatMessageType.Channel: case ChatMessageType.Battleground: case ChatMessageType.BattlegroundNeutral: case ChatMessageType.BattlegroundAlliance: case ChatMessageType.BattlegroundHorde: case ChatMessageType.BattlegroundLeader: case ChatMessageType.Achievement: case ChatMessageType.GuildAchievement: { ChatChannel channel = new ChatChannel(); channel.Type = type; if (type == ChatMessageType.Channel) { channel.ChannelName = packet.ReadCString(); } var sender = packet.ReadUInt64(); ChatMessage message = new ChatMessage(); var textLen = packet.ReadInt32(); message.Message = packet.ReadCString(); message.Language = lang; message.ChatTag = (ChatTag)packet.ReadByte(); message.Sender = channel; //! If we know the name of the sender GUID, use it //! For system messages sender GUID is 0, don't need to do anything fancy string senderName = null; if (type == ChatMessageType.System || Game.World.PlayerNameLookup.TryGetValue(sender, out senderName)) { message.Sender.Sender = senderName; Game.UI.PresentChatMessage(message); return; } //! If not we place the message in the queue, //! .. either existent Queue <ChatMessage> messageQueue = null; if (Game.World.QueuedChatMessages.TryGetValue(sender, out messageQueue)) { messageQueue.Enqueue(message); } //! or non existent else { messageQueue = new Queue <ChatMessage>(); messageQueue.Enqueue(message); Game.World.QueuedChatMessages.Add(sender, messageQueue); } //! Furthermore we send CMSG_NAME_QUERY to the server to retrieve the name of the sender OutPacket response = new OutPacket(WorldCommand.CMSG_NAME_QUERY); response.Write(sender); Game.SendPacket(response); //! Enqueued chat will be printed when we receive SMSG_NAME_QUERY_RESPONSE break; } default: return; } }
public static void SendVoiceData(ChatChannel chatChannel) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_VOICE_SESSION_ROSTER_UPDATE)) { } }
public void AddToChatLogClient(string message, ChatChannel channels) { UpdateClientChat(message, channels); RefreshLog(); }
private void UpdateClientChat(string message, ChatChannel channels) { ChatEvent chatEvent = new ChatEvent(message, channels, true); ChatLog.Add(chatEvent); }
/// Visualize that channel mask mess public static string ListChannels(ChatChannel channels, string separator = ", ") { string listChannels = string.Join(separator, EncryptionKey.getChannelsByMask(channels)); return(listChannels == "" ? "None" : listChannels); }
private void AddToChatLogClient(string message, ChatChannel channels) { UpdateClientChat(message, channels); }
/// <summary>Send the announce status change message to everyone</summary> /// <param name="chan">name of channel</param> /// <param name="sender">sender (status changer)</param> /// <param name="newStatus">new announcements status</param> public static void SendAnnouncementToEveryone(ChatChannel chan, EntityId sender, bool newStatus) { }
/// <summary>Send the kick message to everyone</summary> /// <param name="chan">name of channel</param> /// <param name="sender">sender (aka kicker)</param> /// <param name="kicked">kicked</param> public static void SendKickedToEveryone(ChatChannel chan, EntityId sender, EntityId kicked) { }
/// <summary>Send the moderate status change message to everyone</summary> /// <param name="chan">name of channel</param> /// <param name="sender">sender (status changer)</param> public static void SendModerateToEveryone(ChatChannel chan, EntityId sender) { }
public Channel(ChatChannel id, string name) { Id = id; Name = name; }
/// <summary>Send the unbanned message to everyone</summary> /// <param name="chan">name of channel</param> /// <param name="sender">sender (aka unbanner)</param> /// <param name="unbanned">unbanned</param> public static void SendUnbannedToEveryone(ChatChannel chan, EntityId sender, EntityId unbanned) { }
public static GameClient[] GetRecipiants(User user, ChatChannel channel, string to = null) { if (channel == ChatChannel.All) { List <GameClient> recipiants = new List <GameClient>(); foreach (GameClient client in GameServer.ConnectedClients) { if (client.LoggedIn) { if (!client.LoggedinUser.MuteGlobal && !client.LoggedinUser.MuteAll) { if (client.LoggedinUser.Id != user.Id) { if (!client.LoggedinUser.MutePlayer.IsUserMuted(user)) { recipiants.Add(client); } } } } } return(recipiants.ToArray()); } if (channel == ChatChannel.Ads) { List <GameClient> recipiants = new List <GameClient>(); foreach (GameClient client in GameServer.ConnectedClients) { if (client.LoggedIn) { if (!client.LoggedinUser.MuteAds && !client.LoggedinUser.MuteAll) { if (client.LoggedinUser.Id != user.Id) { if (!client.LoggedinUser.MutePlayer.IsUserMuted(user)) { recipiants.Add(client); } } } } } return(recipiants.ToArray()); } if (channel == ChatChannel.Buddies) { List <GameClient> recipiants = new List <GameClient>(); foreach (GameClient client in GameServer.ConnectedClients) { if (client.LoggedIn) { if (!client.LoggedinUser.MuteBuddy && !client.LoggedinUser.MuteAll) { if (client.LoggedinUser.Id != user.Id) { if (client.LoggedinUser.Friends.List.Contains(user.Id)) { if (!client.LoggedinUser.MutePlayer.IsUserMuted(user)) { recipiants.Add(client); } } } } } } return(recipiants.ToArray()); } if (channel == ChatChannel.Isle) { List <GameClient> recipiants = new List <GameClient>(); if (World.InIsle(user.X, user.Y)) { User[] usersInSile = GameServer.GetUsersInIsle(World.GetIsle(user.X, user.Y), true, false); foreach (User userInIsle in usersInSile) { if (user.Id != userInIsle.Id) { if (!userInIsle.MuteAll && !userInIsle.MuteIsland) { if (!userInIsle.MutePlayer.IsUserMuted(user)) { recipiants.Add(userInIsle.LoggedinClient); } } } } return(recipiants.ToArray()); } else { return(new GameClient[0]); } } if (channel == ChatChannel.Here) { List <GameClient> recipiants = new List <GameClient>(); User[] usersHere = GameServer.GetUsersAt(user.X, user.Y, true, false); foreach (User userHere in usersHere) { if (user.Id != userHere.Id) { if (!userHere.MuteAll && !userHere.MuteHere) { if (!userHere.MutePlayer.IsUserMuted(user)) { recipiants.Add(userHere.LoggedinClient); } } } } return(recipiants.ToArray()); } if (channel == ChatChannel.Near) { List <GameClient> recipiants = new List <GameClient>(); User[] nearbyUsers = GameServer.GetNearbyUsers(user.X, user.Y, true, false); foreach (User nearbyUser in nearbyUsers) { if (user.Id != nearbyUser.Id) { if (!nearbyUser.MuteAll && !nearbyUser.MuteNear) { if (!nearbyUser.MutePlayer.IsUserMuted(user)) { recipiants.Add(nearbyUser.LoggedinClient); } } } } return(recipiants.ToArray()); } if (channel == ChatChannel.Mod) { if (!user.Moderator || !user.Administrator) // No mod chat for non-mods! { Logger.WarnPrint(user.Username + " attempted to send in MOD chat, without being a MOD."); return(new GameClient[0]); } List <GameClient> recipiants = new List <GameClient>(); foreach (GameClient client in GameServer.ConnectedClients) { if (client.LoggedIn) { if (client.LoggedinUser.Moderator) { if (client.LoggedinUser.Id != user.Id) { recipiants.Add(client); } } } } return(recipiants.ToArray()); } if (channel == ChatChannel.Admin) { if (!user.Administrator) // No admin chat for non-admins! { Logger.WarnPrint(user.Username + " attempted to send in ADMIN chat, without being an ADMIN."); return(new GameClient[0]); } List <GameClient> recipiants = new List <GameClient>(); foreach (GameClient client in GameServer.ConnectedClients) { if (client.LoggedIn) { if (client.LoggedinUser.Administrator) { if (client.LoggedinUser.Id != user.Id) { recipiants.Add(client); } } } } return(recipiants.ToArray()); } if (channel == ChatChannel.Dm) { if (to != null) { List <GameClient> recipiants = new List <GameClient>(); foreach (GameClient client in GameServer.ConnectedClients) { if (client.LoggedIn) { if (!client.LoggedinUser.MutePrivateMessage && !client.LoggedinUser.MuteAll) { if (client.LoggedinUser.Username.ToLower() == to.ToLower()) { recipiants.Add(client); } } } } return(recipiants.ToArray()); } else { Logger.ErrorPrint("Channel is " + channel + " (DM) BUT no 'to' Paramater was specfied"); return(new GameClient[0]); } } Logger.ErrorPrint(user.Username + " Sent message in unknown channel: " + (byte)channel); return(new GameClient[0]); // No recipiants }
public ChatPacket(string message, ChatChannel chatChannel) { Message = message; ChatChannel = chatChannel; }
/// <summary>Send the list of channel members</summary> /// <param name="client">the client the outdoing packet belongs to</param> /// <param name="chan">channel to be listed</param> public static void SendChannelList(IPacketReceiver client, ChatChannel chan) { }
public static string FormatChatForOthers(User user, ChatChannel channel, string message) { switch (channel) { case ChatChannel.All: if (user.Moderator || user.Administrator) { return(Messages.FormatGlobalChatMessageForMod(user.Username, message)); } else { return(Messages.FormatGlobalChatMessage(user.Username, message)); } case ChatChannel.Ads: return(Messages.FormatAdsChatMessage(user.Username, message)); case ChatChannel.Buddies: return(Messages.FormatBuddyChatMessage(user.Username, message)); case ChatChannel.Dm: if (user.Moderator || user.Administrator) { return(Messages.FormatDirectMessageForMod(user.Username, message)); } else { return(Messages.FormatDirectMessage(user.Username, message)); } case ChatChannel.Near: return(Messages.FormatNearbyChatMessage(user.Username, message)); case ChatChannel.Isle: return(Messages.FormatIsleChatMessage(user.Username, message)); case ChatChannel.Here: return(Messages.FormatHereChatMessage(user.Username, message)); case ChatChannel.Mod: if (user.Moderator || user.Administrator) { return(Messages.FormatModChatMessage(user.Username, message)); } else { Logger.HackerPrint(user.Username + " Tried to send in mod chat without being a moderator. (Hack/Code Attempt)"); return(user.Username + " is a hacker! (Sent in mod channel without being a mod) Maybe ban?"); } case ChatChannel.Admin: if (user.Administrator) { return(Messages.FormatAdminChatMessage(user.Username, message)); } else { Logger.HackerPrint(user.Username + " Tried to send in mod chat without being a moderator. (Hack/Code Attempt)"); return(user.Username + " is a hacker! (Sent in admin channel without being a admin) Maybe ban?"); } default: Logger.ErrorPrint(user.Username + " is trying to end a message in unknown channel " + channel.ToString("X")); return("not implemented yet :("); } }
public static bool Send(Objects.Client client, ChatChannel channel) { ChannelClosePacket p = new ChannelClosePacket(client); p.ChannelId = channel; return p.Send(); }
public static string ToName(this ChatChannel chatChannel) { switch (chatChannel) { case ChatChannel.Say: return("Say"); case ChatChannel.Yell: return("Yell"); case ChatChannel.Shout: return("Shout"); case ChatChannel.Party: return("Party"); case ChatChannel.Alliance: return("Alliance"); case ChatChannel.FreeCompany: return("Free Company"); case ChatChannel.Linkshell1: return("Linkshell 1"); case ChatChannel.Linkshell2: return("Linkshell 2"); case ChatChannel.Linkshell3: return("Linkshell 3"); case ChatChannel.Linkshell4: return("Linkshell 4"); case ChatChannel.Linkshell5: return("Linkshell 5"); case ChatChannel.Linkshell6: return("Linkshell 6"); case ChatChannel.Linkshell7: return("Linkshell 7"); case ChatChannel.Linkshell8: return("Linkshell 8"); case ChatChannel.CrossworldLinkshell1: return("Crossworld Linkshell 1"); case ChatChannel.CrossworldLinkshell2: return("Crossworld Linkshell 2"); case ChatChannel.CrossworldLinkshell3: return("Crossworld Linkshell 3"); case ChatChannel.CrossworldLinkshell4: return("Crossworld Linkshell 4"); case ChatChannel.CrossworldLinkshell5: return("Crossworld Linkshell 5"); case ChatChannel.CrossworldLinkshell6: return("Crossworld Linkshell 6"); case ChatChannel.CrossworldLinkshell7: return("Crossworld Linkshell 7"); case ChatChannel.CrossworldLinkshell8: return("Crossworld Linkshell 8"); case ChatChannel.NoviceNetwork: return("Novice Network"); case ChatChannel.PvPTeam: return("PvP Team"); } return("None"); }
private void ProcessEmote(string text, string name, ChatChannel channel, int? entityId, NetConnection client) { if (entityId == null) return; //No emotes from non-entities! var args = new List<string>(); CommandParsing.ParseArguments(text, args); if(_emotes.ContainsKey(args[0])) { var userText = String.Format(_emotes[args[0]].SelfText, name);//todo user-only channel var otherText = String.Format(_emotes[args[0]].OtherText, name, "his"); //todo pronouns, gender SendChatMessage(ChatChannel.Emote, otherText, name, entityId); } else { //todo Bitch at the user } }
public static string ToCommand(this ChatChannel chatChannel) { switch (chatChannel) { case ChatChannel.Say: return("/say"); case ChatChannel.Yell: return("/yell"); case ChatChannel.Shout: return("/shout"); case ChatChannel.Party: return("/party"); case ChatChannel.Alliance: return("/alliance"); case ChatChannel.FreeCompany: return("/freecompany"); case ChatChannel.Linkshell1: return("/linkshell1"); case ChatChannel.Linkshell2: return("/linkshell2"); case ChatChannel.Linkshell3: return("/linkshell3"); case ChatChannel.Linkshell4: return("/linkshell4"); case ChatChannel.Linkshell5: return("/linkshell5"); case ChatChannel.Linkshell6: return("/linkshell6"); case ChatChannel.Linkshell7: return("/linkshell7"); case ChatChannel.Linkshell8: return("/linkshell8"); case ChatChannel.CrossworldLinkshell1: return("/cwlinkshell1"); case ChatChannel.CrossworldLinkshell2: return("/cwlinkshell2"); case ChatChannel.CrossworldLinkshell3: return("/cwlinkshell3"); case ChatChannel.CrossworldLinkshell4: return("/cwlinkshell4"); case ChatChannel.CrossworldLinkshell5: return("/cwlinkshell5"); case ChatChannel.CrossworldLinkshell6: return("/cwlinkshell6"); case ChatChannel.CrossworldLinkshell7: return("/cwlinkshell7"); case ChatChannel.CrossworldLinkshell8: return("/cwlinkshell8"); case ChatChannel.NoviceNetwork: return("/novice"); case ChatChannel.PvPTeam: return("/pvpteam"); } return(string.Empty); }
void IncommingChatMessage(ChatChannel channel, string message, string sender) { if( InvokeRequired ) { Invoke(new MethodInvoker(delegate() { IncommingChatMessage(channel, message, sender); })); } else { string formattedMessage = message; if( sender != null ) { formattedMessage = string.Format("[{0}] {1}: {2}", channel.ToString(), sender, message); } ChatEntry ce = new ChatEntry(channel, formattedMessage); _chatEntries.Add(ce); FilterChat(); } }
public ChatChannel GetAvailableChannelsMask(bool transmitOnly = true) { if (IsDeadOrGhost && !IsPlayerSemiGhost) { ChatChannel ghostTransmitChannels = ChatChannel.Ghost | ChatChannel.OOC; ChatChannel ghostReceiveChannels = ChatChannel.Examine | ChatChannel.System | ChatChannel.Combat | ChatChannel.Binary | ChatChannel.Command | ChatChannel.Common | ChatChannel.Engineering | ChatChannel.Medical | ChatChannel.Science | ChatChannel.Security | ChatChannel.Service | ChatChannel.Supply | ChatChannel.Syndicate; if (transmitOnly) { return(ghostTransmitChannels); } return(ghostTransmitChannels | ghostReceiveChannels); } if (IsPlayerSemiGhost) { ChatChannel blobTransmitChannels = ChatChannel.Blob | ChatChannel.OOC; ChatChannel blobReceiveChannels = ChatChannel.Examine | ChatChannel.System | ChatChannel.Combat; if (transmitOnly) { return(blobTransmitChannels); } return(blobTransmitChannels | blobReceiveChannels); } //TODO: Checks if player can speak (is not gagged, unconcious, has no mouth) ChatChannel transmitChannels = ChatChannel.OOC | ChatChannel.Local; if (CustomNetworkManager.Instance._isServer) { var playerStorage = gameObject.GetComponent <ItemStorage>(); if (playerStorage && !playerStorage.GetNamedItemSlot(NamedSlot.ear).IsEmpty) { Headset headset = playerStorage.GetNamedItemSlot(NamedSlot.ear)?.Item?.GetComponent <Headset>(); if (headset) { EncryptionKeyType key = headset.EncryptionKey; transmitChannels = transmitChannels | EncryptionKey.Permissions[key]; } } } else { GameObject earSlotItem = gameObject.GetComponent <ItemStorage>().GetNamedItemSlot(NamedSlot.ear).ItemObject; if (earSlotItem) { Headset headset = earSlotItem.GetComponent <Headset>(); if (headset) { EncryptionKeyType key = headset.EncryptionKey; transmitChannels = transmitChannels | EncryptionKey.Permissions[key]; } } } ChatChannel receiveChannels = ChatChannel.Examine | ChatChannel.System | ChatChannel.Combat; if (transmitOnly) { return(transmitChannels); } return(transmitChannels | receiveChannels); }
public ChatEntry(ChatChannel channel, string msg) { Channel = channel; Message = msg; }
/// For dumb people like me who can't do bitwise. Better cache these private static List <ChatChannel> getChannelList(EncryptionKeyType keyType) { ChatChannel channelMask = Permissions[keyType]; return(getChannelsByMask(channelMask)); }
/// <summary> /// Send a channel message. /// </summary> /// <param name="client"></param> /// <param name="senderName"></param> /// <param name="senderLevel"></param> /// <param name="speechType"></param> /// <param name="channelId"></param> /// <returns></returns> public static bool Send(Objects.Client client, string senderName, ushort senderLevel, string message, SpeechType speechType, ChatChannel channelId) { return Send(client, senderName, senderLevel, message, speechType, channelId, Objects.Location.Invalid, 0); }
private bool IsFiltered(ChatChannel channel) { // _allState works as inverter. return(_allState ^ _filteredChannels.HasFlag(channel)); }
/// <summary>Send the "you have joined channel" reply</summary> /// <param name="client">the client the outdoing packet belongs to</param> /// <param name="chan">name of channel</param> public static void SendYouJoinedReply(IPacketReceiver client, ChatChannel chan) { }
/// <summary> /// Send a Chat Msg from a player to the selected Chat Channels /// Server only /// </summary> public static void AddChatMsgToChat(ConnectedPlayer sentByPlayer, string message, ChatChannel channels) { message = AutoMod.ProcessChatServer(sentByPlayer, message); if (string.IsNullOrWhiteSpace(message)) { return; } var player = sentByPlayer.Script; // The exact words that leave the player's mouth (or that are narrated). Already includes HONKs, stutters, etc. // This step is skipped when speaking in the OOC channel. (string message, ChatModifier chatModifiers)processedMessage = (string.Empty, ChatModifier.None); // Placeholder values bool isOOC = channels.HasFlag(ChatChannel.OOC); if (!isOOC) { processedMessage = ProcessMessage(sentByPlayer, message); } var chatEvent = new ChatEvent { message = isOOC ? message : processedMessage.message, modifiers = (player == null) ? ChatModifier.None : processedMessage.chatModifiers, speaker = (player == null) ? sentByPlayer.Username : player.name, position = (player == null) ? TransformState.HiddenPos : player.gameObject.AssumedWorldPosServer(), channels = channels, originator = sentByPlayer.GameObject }; if (channels.HasFlag(ChatChannel.OOC)) { chatEvent.speaker = sentByPlayer.Username; var isAdmin = PlayerList.Instance.IsAdmin(sentByPlayer.UserId); if (isAdmin) { chatEvent.speaker = "<color=red>[Admin]</color> " + chatEvent.speaker; } else if (PlayerList.Instance.IsMentor(sentByPlayer.UserId)) { chatEvent.speaker = "<color=#6400ff>[Mentor]</color> " + chatEvent.speaker; } if (Instance.OOCMute && !isAdmin) { return; } //http/https links in OOC chat if (isAdmin || !GameManager.Instance.AdminOnlyHtml) { if (htmlRegex.IsMatch(chatEvent.message)) { var messageParts = chatEvent.message.Split(' '); var builder = new StringBuilder(); foreach (var part in messageParts) { if (!htmlRegex.IsMatch(part)) { builder.Append(part); builder.Append(" "); continue; } builder.Append($"<link={part}><color=blue>{part}</color></link> "); } chatEvent.message = builder.ToString(); //TODO have a config file available to whitelist/blacklist links if all players are allowed to post links //disables client side tag protection to allow <link=></link> tag chatEvent.stripTags = false; } } Instance.addChatLogServer.Invoke(chatEvent); //Sends OOC message to a discord webhook DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookOOCURL, message, chatEvent.speaker, ServerData.ServerConfig.DiscordWebhookOOCMentionsID); if (!ServerData.ServerConfig.DiscordWebhookSendOOCToAllChat) { return; } //Send it to All chat DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookAllChatURL, $"[{ChatChannel.OOC}] {message}\n", chatEvent.speaker); return; } // TODO the following code uses player.playerHealth, but ConciousState would be more appropriate. // Check if the player is allowed to talk: if (player != null && player.playerHealth != null) { if (!player.IsDeadOrGhost && player.mind.IsMiming && !processedMessage.chatModifiers.HasFlag(ChatModifier.Emote)) { AddWarningMsgFromServer(sentByPlayer.GameObject, "You can't talk because you made a vow of silence."); return; } if (player.playerHealth.IsCrit || player.playerHealth.IsCardiacArrest) { if (!player.playerHealth.IsDead) { return; } else { chatEvent.channels = ChatChannel.Ghost; } } else if (!player.playerHealth.IsDead && !player.IsGhost) { //Control the chat bubble player.playerNetworkActions.CmdToggleChatIcon(true, processedMessage.message, channels, processedMessage.chatModifiers); } } InvokeChatEvent(chatEvent); }
public void PropagateChatToClients(ChatEvent chatEvent) { List <ConnectedPlayer> players = PlayerList.Instance.AllPlayers; //Local chat range checks: if (chatEvent.channels.HasFlag(ChatChannel.Local) || chatEvent.channels.HasFlag(ChatChannel.Combat) || chatEvent.channels.HasFlag(ChatChannel.Action)) { for (int i = players.Count - 1; i >= 0; i--) { if (players[i].Script == null) { //joined viewer, don't message them players.RemoveAt(i); continue; } if (players[i].Script.IsGhost && players[i].Script.IsPlayerSemiGhost == false) { //send all to ghosts continue; } if (chatEvent.position == TransformState.HiddenPos) { //show messages with no provided position to everyone continue; } //Send chat to PlayerChatLocation pos, usually just the player object but for AI is its vessel var playerPosition = players[i].Script.PlayerChatLocation.OrNull()?.AssumedWorldPosServer() ?? players[i].Script.gameObject.AssumedWorldPosServer(); if (Vector2.Distance(chatEvent.position, playerPosition) > 14f) { //Player in the list is too far away for local chat, remove them: players.RemoveAt(i); } else { //within range, but check if they are in another room or hiding behind a wall if (MatrixManager.Linecast(chatEvent.position, LayerTypeSelection.Walls , layerMask, playerPosition).ItHit) { //if it hit a wall remove that player players.RemoveAt(i); } } } //Get NPCs in vicinity var npcs = Physics2D.OverlapCircleAll(chatEvent.position, 14f, npcMask); foreach (Collider2D coll in npcs) { var npcPosition = coll.gameObject.AssumedWorldPosServer(); if (MatrixManager.Linecast(chatEvent.position, LayerTypeSelection.Walls, layerMask, npcPosition).ItHit == false) { //NPC is in hearing range, pass the message on: var mobAi = coll.GetComponent <MobAI>(); if (mobAi != null) { mobAi.LocalChatReceived(chatEvent); } } } } for (var i = 0; i < players.Count; i++) { ChatChannel channels = chatEvent.channels; if (channels.HasFlag(ChatChannel.Combat) || channels.HasFlag(ChatChannel.Local) || channels.HasFlag(ChatChannel.System) || channels.HasFlag(ChatChannel.Examine) || channels.HasFlag(ChatChannel.Action)) { //Binary check here to avoid speaking in local when speaking on binary if (!channels.HasFlag(ChatChannel.Binary) || (players[i].Script.IsGhost && players[i].Script.IsPlayerSemiGhost == false)) { UpdateChatMessage.Send(players[i].GameObject, channels, chatEvent.modifiers, chatEvent.message, chatEvent.messageOthers, chatEvent.originator, chatEvent.speaker, chatEvent.stripTags); continue; } } if (players[i].Script == null) { channels &= ChatChannel.OOC; } else { channels &= players[i].Script.GetAvailableChannelsMask(false); } //if the mask ends up being a big fat 0 then don't do anything if (channels != ChatChannel.None) { UpdateChatMessage.Send(players[i].GameObject, channels, chatEvent.modifiers, chatEvent.message, chatEvent.messageOthers, chatEvent.originator, chatEvent.speaker, chatEvent.stripTags); } } if (rconManager != null) { string name = ""; if ((namelessChannels & chatEvent.channels) != chatEvent.channels) { name = "<b>[" + chatEvent.channels + "]</b> "; } RconManager.AddChatLog(name + chatEvent.message); } }
/// <summary>Send the "name has left channel" reply to everyone</summary> /// <param name="chan">name of channel</param> /// <param name="sender">sender (to check the ignore list)</param> public static void SendLeftReplyToEveryone(ChatChannel chan, EntityId sender) { }
/// <summary> /// Send a Chat Msg from a player to the selected Chat Channels /// Server only /// </summary> public static void AddChatMsgToChat(ConnectedPlayer sentByPlayer, string message, ChatChannel channels) { var player = sentByPlayer.Script; var chatEvent = new ChatEvent { message = message, modifiers = (player == null) ? ChatModifier.None : player.GetCurrentChatModifiers(), speaker = (player == null) ? sentByPlayer.Username : player.name, position = ((player == null) ? Vector2.zero : (Vector2)player.gameObject.transform.position), channels = channels, originator = sentByPlayer.GameObject }; if (channels.HasFlag(ChatChannel.OOC)) { chatEvent.speaker = sentByPlayer.Username; Instance.addChatLogServer.Invoke(chatEvent); return; } //Check if the player is allowed to talk: if (player.playerHealth != null) { if (player.playerHealth.IsCrit || player.playerHealth.IsCardiacArrest) { if (!player.playerHealth.IsDead) { return; } else { channels = ChatChannel.Ghost; } } else { if (!player.playerHealth.IsDead && !player.IsGhost) { { //Control the chat bubble player.playerNetworkActions.CmdToggleChatIcon(true, message, channels); } } } } // There could be multiple channels we need to send a message for each. // We do this on the server side that local chans can be determined correctly foreach (Enum value in Enum.GetValues(channels.GetType())) { if (channels.HasFlag((ChatChannel)value)) { //Using HasFlag will always return true for flag at value 0 so skip it if ((ChatChannel)value == ChatChannel.None) { continue; } if (IsNamelessChan((ChatChannel)value)) { continue; } chatEvent.channels = (ChatChannel)value; Instance.addChatLogServer.Invoke(chatEvent); } } }
public override void SendChatMessage(ChatChannel chatChannel, ChatMessage chatMessage) => Logger.LogChatMessage(chatMessage.Sender.Name, chatChannel.Name, chatMessage.Message);