private void UnoPlay(CommandArgs args) { if (UnoGame.state == "active" && UnoGame.isPlaying(args.Player.Index, args.Player.Name) && UnoGame.isCurrentTurn(args.Player.Index, args.Player.Name)) { if (args.Parameters.Count > 0 && args.Parameters.Count < 3) { if (!Deck.IsValid(args.Parameters[0])) { args.Player.SendErrorMessage("[Uno] That is not a valid card."); return; } if (!UnoGame.players[UnoGame.turnindex].hasCard(args.Parameters[0])) { args.Player.SendErrorMessage("[Uno] You do not have that card."); return; } Card card = Deck.Parse(args.Parameters[0]); if (card.color != Deck.color && card.value != Deck.faceup.value && card.value != "wild" && card.value != "wdr4") { args.Player.SendErrorMessage("[Uno] You cannot play that card!"); return; } UnoGame.playCard(args.Parameters[0], (args.Parameters.Count == 2 ? args.Parameters[1] : null)); } else { args.Player.SendErrorMessage("[Uno] Invalid Syntax: {0}play <card> [color]", TShock.Config.CommandSpecifier); args.Player.SendErrorMessage("[Uno] Use {0}uno help <card> for help on how to play each card.", TShock.Config.CommandSpecifier); } } else if (UnoGame.state != "active" || !UnoGame.isPlaying(args.Player.Index, args.Player.Name)) { args.Player.SendErrorMessage("[Uno] You are not in a game!"); } else if (UnoGame.isCurrentTurn(args.Player.Index, args.Player.Name)) { args.Player.SendErrorMessage("[Uno] It is not your turn!"); } else { args.Player.SendErrorMessage("[Uno] An error occured."); TShock.Log.Error("An error with Uno occurred!"); } }
public static void displayHelp(TSPlayer player, List <string> param) { if (param.Count > 1) { if (Deck.IsValid(param[1]) || Deck.IsValid("g" + param[1])) { if (Deck.IsValid(param[1])) { Card card = Deck.Parse(param[1]); if (card.value == "wild") { player.SendInfoMessage("[Uno] 'wild' card syntax: {0}play wild <r/g/b/y>", TShock.Config.CommandSpecifier); player.SendInfoMessage("[Uno] Changes the color of play."); } else if (card.value == "wdr4") { player.SendInfoMessage("[Uno] 'wdr4' card syntax: {0}play wdr4 <r/g/b/y>", TShock.Config.CommandSpecifier); player.SendInfoMessage("[Uno] Changes the color of play and gives four cards to the next player."); } else if (card.value == "s") { player.SendInfoMessage("[Uno] '{0}s' card syntax: {1}play {0}s", card.color, TShock.Config.CommandSpecifier); player.SendInfoMessage("[Uno] Skips the next player's turn."); } else if (card.value == "r") { player.SendInfoMessage("[Uno] '{0}r' card syntax: {1}play {0}r", card.color, TShock.Config.CommandSpecifier); player.SendInfoMessage("[Uno] Reverses the order of play."); } else if (card.value == "dr2") { player.SendInfoMessage("[Uno] '{0}dr2' card syntax: {1}play {0}dr2", card.color, TShock.Config.CommandSpecifier); player.SendInfoMessage("[Uno] Gives two cards to the next player."); } else { player.SendInfoMessage("[Uno] '{0}{1}' card syntax: {2}play {0}{1}", card.color, card.value, TShock.Config.CommandSpecifier); player.SendInfoMessage("[Uno] No special ability."); } } } else { player.SendInfoMessage("Available commands:"); if (player.Group.HasPermission("uno.mod")) { player.SendInfoMessage("{0}uno <start/join/stop>: Starts, joins, or stops a game of Uno.", TShock.Config.CommandSpecifier); } else { player.SendInfoMessage("{0}uno <start/join>: Starts or joins a game of Uno.", TShock.Config.CommandSpecifier); } player.SendInfoMessage("{0}play <card> [color]: Plays the selected card with the optional selected color.", TShock.Config.CommandSpecifier); player.SendInfoMessage("{0}draw: Draws a card. Cannot {0}pass without using this command.", TShock.Config.CommandSpecifier); player.SendInfoMessage("{0}pass: Passes a turn. Must {0}draw before using this command.", TShock.Config.CommandSpecifier); player.SendInfoMessage("{0}uno help [card]: Gives information about how to use the selected card.", TShock.Config.CommandSpecifier); } } else { player.SendInfoMessage("Available commands:"); if (player.Group.HasPermission("uno.mod")) { player.SendInfoMessage("{0}uno <start/join/stop>: Starts, joins, or stops a game of Uno.", TShock.Config.CommandSpecifier); } else { player.SendInfoMessage("{0}uno <start/join>: Starts or joins a game of Uno.", TShock.Config.CommandSpecifier); } player.SendInfoMessage("{0}play <card> [color]: Plays the selected card with the optional selected color.", TShock.Config.CommandSpecifier); player.SendInfoMessage("{0}draw: Draws a card. Cannot {0}pass without using this command.", TShock.Config.CommandSpecifier); player.SendInfoMessage("{0}pass: Passes a turn. Must {0}draw before using this command.", TShock.Config.CommandSpecifier); player.SendInfoMessage("{0}uno help [card]: Gives information about how to use the selected card.", TShock.Config.CommandSpecifier); } }