X-Git-Url: https://git.cworth.org/git?p=loudgame;a=blobdiff_plain;f=lg-set.c;h=a6594b27a3de4bc9ad9a621f68755f97e9a985ec;hp=fa0e5dd86e1de752ec28fc44f2feeeee4e763564;hb=84366ba467d765ba7a14084b8b8c49fb1c61ab07;hpb=2d34d2899a2a20e08675a17158daf73db188c54a diff --git a/lg-set.c b/lg-set.c index fa0e5dd..a6594b2 100644 --- a/lg-set.c +++ b/lg-set.c @@ -430,6 +430,10 @@ set_game_handle_set (set_game_t *game, loudgame_sendf (&game->lg, peer, "Yes, that's a set!"); + loudgame_broadcastf (&game->lg, + "%s found the set: %d %d %d. Please send a new 'show' command.", + peer, + slots[0], slots[1], slots[2]); for (i = 0; i < 3; i++) game->board.slots[slots[i]].has_card = 0; @@ -439,6 +443,25 @@ set_game_handle_set (set_game_t *game, deal (&game->deck, &game->board); } +static void +set_game_handle_help (set_game_t *game, + const char *peer) +{ + loudgame_sendf (&game->lg, peer, + "I'm a bot that allows you to play the game of SET.\n" + "Here are some commands I understand:\n" + "\tshow \tShow the current cards on the board\n" + "\thint \tIndicate how many sets are currently possible\n" + "\tshuffle \tReturn the cards to the deck, shuffle and deal\n" + "\t \t(this is only allowed if no sets are possible)\n" + "\tset X Y Z\tClaim three cards as a set. The cards are numbered\n" + "\t \tleft-to-right, and top-to-bottom from 0 to 11.\n" + "\n" + "For more information about SET, or to purchase your own deck, visit\n" + "http://setgame.com . Please note that this server is unaffiliated\n" + "with Set Enterprises, Inc., who publish the SET card game."); +} + static void set_game_handle_message (loudgame_t *lg, const char *peer, @@ -448,6 +471,8 @@ set_game_handle_message (loudgame_t *lg, if (strcmp (message, "show") == 0) set_game_handle_show (game, peer); + else if (strcmp (message, "help") == 0) + set_game_handle_help (game, peer); else if (strcmp (message, "hint") == 0) set_game_handle_hint (game, peer); else if (strcmp (message, "shuffle") == 0) @@ -455,7 +480,7 @@ set_game_handle_message (loudgame_t *lg, else if (strncmp (message, "set", 3) == 0) set_game_handle_set (game, peer, message + 3); else - loudgame_sendf (lg, peer, "Unknown command: '%s'", message); + loudgame_sendf (lg, peer, "Unknown command: '%s'. Use 'help' to get a list of valid commands.", message); } /* Begin a new game */