Exemple #1
0
        private void HandlePrivateMessage(ServerCommand command, string character)
        {
            var sender = characterManager.GetCharacter(character);

            sender.TypingStatus = TypingStatusEnum.Clear;
            if (sender.IsIgnored)
            {
                chatManager.Send(Helpers.CreateClientCommand(ClientCommandType.IGN, new ClientIgn {
                    action = ClientIgn.Action.notify, character = sender.Name
                }));
                return;
            }
            var message = command.Value <string>("message");

            switch (command.Type)
            {
            case ServerCommandType.PRI:
                CharacterMessageReceived?.Invoke(sender, CreateMessage(sender, command.Time, WebUtility.HtmlDecode(message)));
                break;

            case ServerCommandType.RLL:
                CharacterMessageReceived?.Invoke(sender, new Message(Message.Type.Roll, sender, command.Time, message.Substring(message.IndexOf("[/user]" + 7))));
                break;
            }
        }
Exemple #2
0
 public void SendMessage(Character character, string message)
 {
     chatManager.Send(Helpers.CreateClientCommand(ClientCommandType.PRI, new { recipient = character.Name, message }));
     CharacterMessageReceived?.Invoke(character, CreateMessage(characterManager.OwnCharacter, DateTime.Now, message));
     SetCanSendMessages();
 }