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); }
public override void GameStart() { playerLied = false; currentPlayer = 0; lastPlayer = -1; expectedValue = 2; base.GameStart(); //Dish out cards to players deck = PlayingCard.GetStandardDeck(); PlayingCard.ShuffleDeck(ref deck); hands = new Dictionary <string, List <PlayingCard> >(); user_rooms = new Dictionary <string, MatrixRoom>(); foreach (MatrixUser user in users) { hands.Add(user.UserID, new List <PlayingCard>()); } int i = 0; while (deck.Count > 0) { hands[users[i].UserID].Add(deck[0]); deck.RemoveAt(0); i = (i + 1) % users.Count; } foreach (KeyValuePair <string, List <PlayingCard> > deck in hands) { //Create a room and send the player their cards. Console.WriteLine(deck.Key + "'s hand:" + string.Join <PlayingCard>(" ", deck.Value)); MatrixRoom uroom = client.CreateRoom(new MatrixCreateRoom() { invite = new string[1] { deck.Key }, name = "[Card:Hand] Hand for Cheat Lobby", topic = "This room will pass you information", visibility = EMatrixCreateRoomVisibility.Private }); user_rooms.Add(deck.Key, uroom); SendDeckUpdate(deck.Key); uroom.SendNotice("To play a card, type [H,D,S,C] [2-10,J,Q,K,A] in your **private room**. You may type multiple cards seperated by a space."); uroom.SendNotice("To to check your hand, type 'hand'."); uroom.OnMessage += HandMessage; string name = (users.First(x => x.UserID == deck.Key)).DisplayName; } }