Esempio n. 1
0
        public static PostHandlerOutput[] PCNarration(
            IDocumentSession documentSession,
            IMember sender,
            IRoom room,
            string source)
        {
            documentSession.Ensure("documentSession");
            sender.Ensure("sender");
            room.Ensure("room");
            source.Ensure("source");

            source = source.Trim();
            if (source.StartsWith("/", StringComparison.OrdinalIgnoreCase))
                return null;

            if (!sender.IsRoomPlayer(room))
                return null;

            var player = room.Players.SingleOrDefault(x => x.MemberId == sender.Id);
            if (player == null)
                return null;

            var text = string.Concat(
                player.CharacterName,
                ": ",
                source);

            documentSession.CreatePost(room.Id, sender.Id, null, source, "pc-narration", text);

            return PostHandlerOutput.Empty;
        }