/* command, trial out by Turrican for a commands daemon. */
#include <language.h>
#include <player.h>
#include <drinks.h>
#include <broadcaster.h>
inherit COMMAND_BASE;
inherit SPEECH_BASE;
mixed cmd(string arg) {
string word;
string s1;
string cur_lang;
string lang;
string mess;
int *co_ords;
if (!arg) {
arg = "";
}
if (arg == "" || arg == " ") {
return notify_fail("Syntax: lsay <something>\n");
}
if(TP->query_gagged()) {
return notify_fail("You have been gagged! You will not be able "
"to say things again until the gag is removed. Perhaps you should "
"talk to a creator about this.\n");
}
cur_lang = TP->query_current_language();
if (!LANGUAGE_HAND->query_language_spoken(cur_lang)) {
return notify_fail(capitalize(cur_lang)+" is not a spoken language.\n");
}
if ( !interactive( this_player() ) ) {
arg = (string)this_player()->convert_message( arg );
arg = (string)this_player()->fit_message( arg );
}
word = query_word_type(arg);
if(TP->query_volume(D_ALCOHOL)) {
arg = drunk_speech(arg);
}
// General speech modifications (curses, etc)
s1 = TP->mangle_speech(arg);
if (stringp(s1))
arg = s1;
arg = de_eight(arg);
TP->remove_hide_invis("hiding");
if (cur_lang != "common") {
lang = " in "+cur_lang;
} else {
lang = "";
}
mess = "$one_short:" +
file_name(TP) + "$ "+
"$V$0=" + word + "s," + word + "$V$ loudly: ";
TP->comm_event(environment(TP), "person_say", mess, arg, cur_lang);
// Broadcast it around a little.
co_ords = environment(this_player())->query_co_ord();
BROADCASTER->npc_shout_event(TP,
mess,
arg,
cur_lang,
co_ords,
20 );
my_mess("You " + word + " loudly" + lang + ": ", arg);
TP->adjust_time_left(-5);
return 1;
} /* cmd() */