Exemplo n.º 1
0
        public List <OutboundChatMessage> ParseChatline(ChatMetaData meta)
        {
            if (meta.Arguments == null || meta.Arguments.Trim().Length == 0)
            {
                return(new List <OutboundChatMessage>()
                {
                    new OutboundChatMessage(meta.Player, new ChatlineObject("Invalid shout command.", ChatlineColor.White))
                });
            }

            var actionText = meta.Player.Username + " " + ChatText.Shout.ToString() + ": ";

            var message = new ChatlineObject(new List <ChatlineFragment>()
            {
                new ChatlineFragment(actionText, ChatlineColor.Lime),
                new ChatlineFragment(meta.Arguments, ChatlineColor.White)
            });

            NetworkMessageContainer msg = new NetworkMessageContainer();

            msg.MessageData = new MessageRedisShout(meta.Player.Id, message.ToClientJson());
            msg.MessageType = MessageTypes.Redis_Shout;

            _redisServer.PublishObject(
                MessageTypes.Redis_Shout,
                msg
                );

            return(null);
        }
Exemplo n.º 2
0
 public static List <OutboundChatMessage> ReplyResponse(this ChatMetaData meta, ChatlineObject chatLine)
 {
     return(new List <OutboundChatMessage>()
     {
         new OutboundChatMessage(meta.Player, chatLine)
     });
 }
Exemplo n.º 3
0
        public List <OutboundChatMessage> ParseChatline(ChatMetaData meta)
        {
            var fragments = new List <ChatlineFragment>()
            {
                new ChatlineFragment(meta.Player.Username + " radios: ", ChatlineColor.Pink),
                new ChatlineFragment(meta.Arguments, ChatlineColor.White)
            };

            var chatline = new ChatlineObject(fragments);

            return(meta.BuildReplyAllChatList(chatline, null));
        }
Exemplo n.º 4
0
        public List <OutboundChatMessage> ParseChatline(ChatMetaData meta)
        {
            var split = ChatHelpers.GetSingleCommandArgument(meta.Arguments);

            if (split == null)
            {
                return(meta.ReplyResponse(new ChatlineObject("Invalid tell command.", ChatlineColor.White)));
            }

            var otherPlayer = _playerManager.GetPlayer(split.Item1);

            if (otherPlayer == null)
            {
                return(meta.ReplyResponse(new ChatlineObject("Username " + split.Item1 + " not found.", ChatlineColor.White)));
            }

            if (!otherPlayer.IsOnline)
            {
                return(meta.ReplyResponse(new ChatlineObject("User " + split.Item1 + " is offline.", ChatlineColor.White)));
            }

            var outboundChats = new List <OutboundChatMessage>();
            var commonText    = new ChatlineFragment(split.Item2, ChatlineColor.White);

            var toOtherPlayer = new List <ChatlineFragment>()
            {
                new ChatlineFragment(meta.Player.Username + " tells you: ", ChatlineColor.Teal),
                commonText
            };

            var toSendingPlayer = new List <ChatlineFragment>()
            {
                new ChatlineFragment("You tell " + otherPlayer.Username + ": ", ChatlineColor.Teal),
                commonText
            };

            // Allows the client to keep track of who we should send replies to via /r
            var replyMetadata = new Dictionary <string, string>();

            replyMetadata["ReplyPlayer"] = meta.Player.Username;

            outboundChats.Add(new OutboundChatMessage(otherPlayer, new ChatlineObject(toOtherPlayer), replyMetadata));
            outboundChats.Add(new OutboundChatMessage(meta.Player, new ChatlineObject(toSendingPlayer)));

            return(outboundChats);
        }
Exemplo n.º 5
0
        public async Task <List <OutboundChatMessage> > ParseChatline(ChatMetaData meta)
        {
            if (meta.Arguments?.Trim() == null)
            {
                return(meta.ReplyResponse(new ChatlineObject("Invalid warp command.", ChatlineColor.White)));
            }

            AreaTypes newAreaType;

            try
            {
                newAreaType = (AreaTypes)Enum.Parse(typeof(AreaTypes), meta.Arguments.Trim(), true);
            }
            catch (Exception e)
            {
                return(meta.ReplyResponse(new ChatlineObject("Invalid warp destination type. Type \"system\". Error: " + e.Message, ChatlineColor.White)));
            }

            var allAreasOfType = await _databaseManager.GetAllAreas(newAreaType);

            var allAreasOfTypeList = allAreasOfType.ToList();

            var newArea = allAreasOfTypeList[_random.Next(allAreasOfTypeList.Count)];

            if (newArea == null)
            {
                return(meta.ReplyResponse(new ChatlineObject("Couldn't locate any areas of type.", ChatlineColor.White)));
            }

            var msg = new NetworkMessageContainer();

            msg.MessageType = MessageTypes.Redis_AdminWarpPlayer;
            msg.MessageData = new MessageAdminWarpPlayerRequest(meta.Player.ActiveShipId.Value, meta.Player.CurrentAreaID.Value, newArea.Id);

            _redisServer.PublishObject(MessageTypes.Redis_AdminWarpPlayer, msg);

            return(meta.ReplyResponse(new ChatlineObject("Warping you to " + newArea.AreaName + ".", ChatlineColor.White)));
        }
Exemplo n.º 6
0
 public PlayerChatAction(ChatMetaData metaData, ChatlineObject chatline)
 {
     MetaData = metaData;
     Chatline = chatline;
 }
Exemplo n.º 7
0
 public static List <OutboundChatMessage> BuildReplyAllChatList(this ChatMetaData meta, ChatlineObject chatLine, int?playerIDToIgnore)
 {
     return(BuildReplyAllChatList(meta.Area, meta.Player.Id, chatLine));
 }
Exemplo n.º 8
0
 public List <OutboundChatMessage> ParseChatline(ChatMetaData meta)
 {
     return(meta.ReplyResponse(new ChatlineObject(ChatText.Help, ChatlineColor.White)));
 }
Exemplo n.º 9
0
 public List <OutboundChatMessage> ParseChatline(ChatMetaData meta)
 {
     return(meta.ReplyResponse(new ChatlineObject(ChatText.InvalidChat, ChatlineColor.Red)));
 }