Example #1
0
        private void SendDeckUpdate(string userid)
        {
            MMessageCustomHTML msg  = new MMessageCustomHTML();
            List <PlayingCard> hand = hands[userid];

            PlayingCard.SortDeckByValue(ref hand);
            msg.formatted_body = "Your hand:" + PlayingCard.GetDeckHTML(hand);
            msg.body           = "Your hand:" + string.Join <PlayingCard>(" ", hand);
            user_rooms[userid].SendMessage(msg);
        }
Example #2
0
        public static void TestCards(string cmd, string sender, MatrixRoom room)
        {
            List <PlayingCard> deck = PlayingCard.GetStandardDeck();

            PlayingCard.ShuffleDeck(ref deck);
            string             cards   = PlayingCard.GetDeckHTML(deck);
            MMessageCustomHTML htmlmsg = new MMessageCustomHTML();

            htmlmsg.formatted_body = cards;
            htmlmsg.body           = string.Join <PlayingCard>(" ", deck);
            room.SendMessage(htmlmsg);
        }
Example #3
0
        public static void Help(string cmd, string sender, MatrixRoom room)
        {
            string helptext = "";

            foreach (MethodInfo method in typeof(Commands).GetMethods(BindingFlags.Static | BindingFlags.Public))
            {
                BotCmd  c = method.GetCustomAttribute <BotCmd> ();
                BotHelp h = method.GetCustomAttribute <BotHelp> ();
                if (c != null)
                {
                    helptext += String.Format("<p><strong>{0}</strong> {1}</p>", c.CMD, h != null ? h.HelpText : "");
                }
            }
            MMessageCustomHTML htmlmsg = new MMessageCustomHTML();

            htmlmsg.body           = helptext.Replace("<strong>", "").Replace("</strong>", "").Replace("<p>", "").Replace("</p>", "\n");
            htmlmsg.formatted_body = helptext;
            room.SendMessage(htmlmsg);
        }