foundationI_fluffos_v1/
foundationI_fluffos_v1/bin/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/ChangeLog.old/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/Win32/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/compat/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/compat/simuls/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/include/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/clone/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/command/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/data/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/etc/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/include/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/inherit/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/inherit/master/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/log/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/single/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/single/tests/compiler/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/single/tests/efuns/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/single/tests/operators/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/testsuite/u/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/tmp/
foundationI_fluffos_v1/fluffos-2.9-ds2.12/windows/
foundationI_fluffos_v1/lib/
foundationI_fluffos_v1/lib/cmds/ambassador/
foundationI_fluffos_v1/lib/cmds/database/
foundationI_fluffos_v1/lib/cmds/soul/
foundationI_fluffos_v1/lib/daemon/include/
foundationI_fluffos_v1/lib/daemon/save/
foundationI_fluffos_v1/lib/daemon/services/
foundationI_fluffos_v1/lib/daemon/soul/
foundationI_fluffos_v1/lib/doc/build/
foundationI_fluffos_v1/lib/doc/build/room/
foundationI_fluffos_v1/lib/doc/build/virtual/
foundationI_fluffos_v1/lib/doc/driver/
foundationI_fluffos_v1/lib/doc/efun/
foundationI_fluffos_v1/lib/doc/etc/
foundationI_fluffos_v1/lib/doc/help/creator/
foundationI_fluffos_v1/lib/doc/help/hm/
foundationI_fluffos_v1/lib/doc/help/user/
foundationI_fluffos_v1/lib/doc/lpc/basic/
foundationI_fluffos_v1/lib/doc/lpc/data_types/
foundationI_fluffos_v1/lib/doc/lpc/etc/
foundationI_fluffos_v1/lib/doc/lpc/intermediate/
foundationI_fluffos_v1/lib/doc/lpc/types/
foundationI_fluffos_v1/lib/doc/mudlib/
foundationI_fluffos_v1/lib/doc/mudlib/features/
foundationI_fluffos_v1/lib/domains/Examples/etc/
foundationI_fluffos_v1/lib/domains/Examples/room/
foundationI_fluffos_v1/lib/domains/Examples/virtual/
foundationI_fluffos_v1/lib/domains/Examples/virtual/exaA/
foundationI_fluffos_v1/lib/domains/Examples/virtual/exaB/
foundationI_fluffos_v1/lib/domains/Examples/weapon/
foundationI_fluffos_v1/lib/domains/Standard/
foundationI_fluffos_v1/lib/domains/Standard/pools/
foundationI_fluffos_v1/lib/domains/Standard/std/
foundationI_fluffos_v1/lib/domains/Standard/xtra/
foundationI_fluffos_v1/lib/include/
foundationI_fluffos_v1/lib/news/
foundationI_fluffos_v1/lib/secure/cfg/
foundationI_fluffos_v1/lib/secure/cmds/adm/
foundationI_fluffos_v1/lib/secure/cmds/ambassador/
foundationI_fluffos_v1/lib/secure/cmds/mortal/
foundationI_fluffos_v1/lib/secure/etc/
foundationI_fluffos_v1/lib/secure/etc/approval/
foundationI_fluffos_v1/lib/secure/etc/elections/
foundationI_fluffos_v1/lib/secure/etc/mudlib/
foundationI_fluffos_v1/lib/secure/etc/quests/
foundationI_fluffos_v1/lib/secure/save/daemon/
foundationI_fluffos_v1/lib/secure/save/postal/d/descartes/
foundationI_fluffos_v1/lib/secure/save/users/d/
foundationI_fluffos_v1/lib/secure/std/
foundationI_fluffos_v1/lib/std/obj/
foundationI_fluffos_v1/lib/std/room/
foundationI_fluffos_v1/lib/std/user/
foundationI_fluffos_v1/lib/std/virtual/
foundationI_fluffos_v1/old/
foundationI_fluffos_v1/win32/
//      /bin/user/_shout.c
//      from the Nightmare Mudlib
//      the shout command
//      created by Descartes of Borg september 1992
//      rewritten by Descartes 930823
//      rewritten by Valodin using Valodin's languages 930823

#include <std.h>

inherit DAEMON;

void tell_em(string prefix, string str, object *ob);
mapping make_speakers(object *ob, string lang);
mapping make_speech(mapping speakers, string str, int prof);
void shout_out(string lang, string str, int prof);

int cmd_shout(string str) {
    string lang, tmp;
    int prof;

    if(this_player()->query_ghost()) {
        message("my_action", "You moan mournfully.", this_player());
        return 1;
    }
    if(!str) {
        message("my_action", "Sore throat?", this_player());
        return 1;
    }
    if(environment(this_player())->query_property("no shout")) {
        message("my_action", "Your voice does not travel very far.", 
          this_player());
        return 1;
    }
    if((string)this_player()->query_name() == "guest") {
	notify_fail("No shouting priviledges for Guest.\n");
	return 0;
    }
    if(!creatorp(this_player()) && !high_mortalp(this_player()) &&
      (int)this_player()->query_sp() < 60) {
	notify_fail("You are too tired.\n");
	return 0;
    }
    if(strlen(str) > 250)
    {
         notify_fail("That is too much for other players to handle.\n");
         return 0;
    }
    if(!creatorp(this_player()) && !high_mortalp(this_player()))
      this_player()->add_sp(-60);
    if(sscanf(str, "in %s %s", lang, tmp) == 2)
      if((prof = (int)this_player()->query_lang_prof(lang)) == 0)
	{
	  write("You don't know how to speak " + lang + ".");
	  return 1;
	}
      else
	shout_out(lang, tmp, prof);
    else
      if(!(lang = this_player()->query_primary_lang()))
	{
	  write("You need to visit the sage to get your languages fixed.");
	  return 1;
	}
      else
	shout_out(lang, str, (int)this_player()->query_lang_prof(lang));
    return 1;
}
     
void shout_out(string lang, string str, int prof)
{
   object *speakers;
   mapping speech;
   string cap_name, cap_lang;
   int i;

    
    
   speakers = users();
   speakers -= ({ this_player() });
   speakers = filter_array(speakers, "is_online", this_object());
   if(prof != 10)
     str = translate(str, prof);
   cap_lang = capitalize(lang);
   tell_em("You shout in " + cap_lang + ": ", str, ({ this_player() }));
   speech = make_speakers(speakers, lang);
   speech = make_speech(speech, str, prof);
   cap_name = this_player()->query_cap_name();
   if(speech[10])
     tell_em(cap_name + " shouts in " + cap_lang + ": ", str, speech[10]);
   if(speech[0])
     tell_em(cap_name + " shouts something in " + cap_lang + ".", "", 
	     speech[0]);
   for(i = 1; i < 10; i++)
     if(speech[i])
       tell_em(cap_name + " shouts in " + cap_lang + ": ", 
	       speech["messages"][i], speech[i]);
}

int is_online(object ob)
{
   if(!ob || ob->query_blocked("shout"))
     return 0;
   return 1;
}

void tell_em(string prefix, string str, object *ob)
{
   int i, obsz;

   for(i = 0, obsz = sizeof(ob); i < obsz; i++)
    message("shout", prefix+str, ob[i]);
}

mapping make_speakers(object *ob, string lang)
{
  mapping speakers;
  int i, obsz, z;

  speakers = ([]);
  for(i = 0, obsz = sizeof(ob); i < obsz; i++)
  {
    z = ob[i]->query_lang_prof(lang);
    if(!speakers[z])
      speakers[z] = ({ ob[i] });
    else
      speakers[z] += ({ ob[i] });
  }
  return speakers;

}

mapping make_speech(mapping speakers, string str, int prof)
{
  int i;

  speakers["messages"] = ([]);
  for(i = 1; i < 10; i++)
    if(speakers[i])
      speakers["messages"][i] = translate(str, i);
  return speakers;
}


void help() {
    message("help",
      "Syntax: <shout (in [language]) [message]>\n\n"
      "Sends a shout in whatever language to the entire mud."
      "Misuse of this power may result in action from law.",
      this_player()
    );
}