nightmare3_fluffos_v2/
nightmare3_fluffos_v2/bin/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/ChangeLog.old/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/Win32/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/compat/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/compat/simuls/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/include/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/clone/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/command/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/data/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/etc/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/include/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/inherit/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/inherit/master/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/log/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/compiler/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/efuns/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/single/tests/operators/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/testsuite/u/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/tmp/
nightmare3_fluffos_v2/fluffos-2.9-ds2.08/windows/
nightmare3_fluffos_v2/lib/cmds/ambassador/
nightmare3_fluffos_v2/lib/cmds/database/
nightmare3_fluffos_v2/lib/cmds/hm/
nightmare3_fluffos_v2/lib/cmds/soul/
nightmare3_fluffos_v2/lib/daemon/cfg/
nightmare3_fluffos_v2/lib/daemon/cfg/mon_races/
nightmare3_fluffos_v2/lib/daemon/cfg/races/
nightmare3_fluffos_v2/lib/daemon/include/
nightmare3_fluffos_v2/lib/daemon/save/
nightmare3_fluffos_v2/lib/daemon/services/
nightmare3_fluffos_v2/lib/daemon/soul/
nightmare3_fluffos_v2/lib/doc/
nightmare3_fluffos_v2/lib/doc/TestPlans/
nightmare3_fluffos_v2/lib/doc/approval/
nightmare3_fluffos_v2/lib/doc/approval/QC/
nightmare3_fluffos_v2/lib/doc/approval/balance/
nightmare3_fluffos_v2/lib/doc/build/
nightmare3_fluffos_v2/lib/doc/build/armours/
nightmare3_fluffos_v2/lib/doc/build/economy/
nightmare3_fluffos_v2/lib/doc/build/etc/
nightmare3_fluffos_v2/lib/doc/build/monster/
nightmare3_fluffos_v2/lib/doc/build/room/
nightmare3_fluffos_v2/lib/doc/build/virtual/
nightmare3_fluffos_v2/lib/doc/build/weapon/
nightmare3_fluffos_v2/lib/doc/classes/
nightmare3_fluffos_v2/lib/doc/efun/
nightmare3_fluffos_v2/lib/doc/etc/
nightmare3_fluffos_v2/lib/doc/help/creator/
nightmare3_fluffos_v2/lib/doc/help/hm/
nightmare3_fluffos_v2/lib/doc/law/
nightmare3_fluffos_v2/lib/doc/lpc/basic/
nightmare3_fluffos_v2/lib/doc/lpc/data_types/
nightmare3_fluffos_v2/lib/doc/lpc/etc/
nightmare3_fluffos_v2/lib/doc/lpc/intermediate/
nightmare3_fluffos_v2/lib/doc/lpc/types/
nightmare3_fluffos_v2/lib/doc/mudlib/
nightmare3_fluffos_v2/lib/doc/mudlib/features/
nightmare3_fluffos_v2/lib/domains/Examples/etc/
nightmare3_fluffos_v2/lib/domains/Examples/room/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/exaA/
nightmare3_fluffos_v2/lib/domains/Examples/virtual/exaB/
nightmare3_fluffos_v2/lib/domains/Examples/weapon/
nightmare3_fluffos_v2/lib/domains/Praxis/
nightmare3_fluffos_v2/lib/domains/Praxis/adm/
nightmare3_fluffos_v2/lib/domains/Praxis/attic/
nightmare3_fluffos_v2/lib/domains/Praxis/cemetary/
nightmare3_fluffos_v2/lib/domains/Praxis/cemetary/mon/
nightmare3_fluffos_v2/lib/domains/Praxis/data/
nightmare3_fluffos_v2/lib/domains/Praxis/death/
nightmare3_fluffos_v2/lib/domains/Praxis/mountains/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/armour/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/magic/
nightmare3_fluffos_v2/lib/domains/Praxis/obj/weapon/
nightmare3_fluffos_v2/lib/domains/Praxis/orc_valley/
nightmare3_fluffos_v2/lib/domains/Praxis/quests/
nightmare3_fluffos_v2/lib/domains/Praxis/standardOld/
nightmare3_fluffos_v2/lib/include/
nightmare3_fluffos_v2/lib/log/
nightmare3_fluffos_v2/lib/log/errors/
nightmare3_fluffos_v2/lib/log/reports/
nightmare3_fluffos_v2/lib/log/watch/
nightmare3_fluffos_v2/lib/news/
nightmare3_fluffos_v2/lib/secure/cfg/
nightmare3_fluffos_v2/lib/secure/cmds/ambassador/
nightmare3_fluffos_v2/lib/secure/cmds/mortal/
nightmare3_fluffos_v2/lib/secure/save/users/d/
nightmare3_fluffos_v2/lib/secure/std/
nightmare3_fluffos_v2/lib/std/hm/
nightmare3_fluffos_v2/lib/std/living/
nightmare3_fluffos_v2/lib/std/room/
nightmare3_fluffos_v2/lib/std/user/
nightmare3_fluffos_v2/lib/std/virtual/
nightmare3_fluffos_v2/lib/www/
nightmare3_fluffos_v2/lib/www/errors/
nightmare3_fluffos_v2/lib/www/gateways/
nightmare3_fluffos_v2/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>
#include <security.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;

    
   log_file("shouts", (string)previous_object()->query_CapName()+" (shout)(" + lang + "): " +
	    str + "\n");
    
   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()
    );
}