#include <drinks.h>
#include <player.h>
#include <language.h>
inherit COMMAND_BASE;
string query_whisper_word_type(string str);
int check_living( object thing ) { return living( thing ); }
mixed cmd( object *others, string last ) {
   int i;
   string lang;
   string type;
   object *fail;
   lang = (string)this_player()->query_current_language();
   if ( !LANGUAGE_HAND->query_language_spoken( lang ) ) {
      add_failed_mess( lang +" is not a spoken language.\n" );
      return 0;
   }
   fail = this_player()->query_ignoring(others);
   if (sizeof(fail)) {
      add_failed_mess("You cannot whisper to $I since you are ignoreing "
                      "them.\n", fail);
      others -= fail;
   }
   fail = this_player()->query_ignored_by(others);
   if (sizeof(fail)) {
      add_failed_mess("You cannot whisper to $I they are ignoreing "
                      "you.\n", fail);
      others -= fail;
   }
   if ( ( sizeof( others ) == 1 ) && ( others[ 0 ] == this_player() ) ) {
      add_failed_mess( "You have difficulty getting your lips near "+
                        "your ear.\n" );
      return 0;
   }
   this_player()->adjust_time_left( -5 );
   others -= ({ this_player() });
   if ( !interactive( this_player() ) ) {
      last = (string)this_player()->convert_message( last );
      last = (string)this_player()->fit_message( last );
   }
   if ( this_player()->query_volume( D_ALCOHOL ) ) {
      last = (string)this_player()->drunk_speech( last );
   }
   i = strlen( last ) - 1;
   while ( i >= 0 && last[ i ] == ' ' ) {
      i--;
   }
   switch ( last[ i ] ) {
      case '!' :
         type = "urgently ";
         break;
      case '?' :
         type = "questioningly ";
         break;
      default :
         type = "";
   }
   last += "%^RESET%^";
#ifdef 0
   event( environment( this_player() ), "whisper",
          (string)this_player()->one_short() +" whispers "+
          type, last, others, lang, this_player());
#endif
   this_player()->do_whisper(environment( this_player() ), "whisper",
                             (string)this_player()->one_short() +" whispers "+
                             type, last, others, lang, this_player());
   
   write( "You whisper "+ type +"to "+ query_multiple_short( others, "the" ) +
         ": "+ last +"\n" );
   return 1;
} /* cmd() */
mixed *query_patterns() {
   return ({ "<string'message'> to <indirect:living>", (: cmd($1, $4[0]) :),
             "<indirect:living> <string'message'>", (: cmd($1, $4[1]) :) });
} /* query_patterns() */