/***************************************************************************
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. *
* *
* Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* *
* In order to use any part of this Merc Diku Mud, you must comply with *
* both the original Diku license in 'license.doc' as well the Merc *
* license in 'license.txt'. In particular, you may not remove either of *
* these copyright notices. *
* *
* Much time and thought has gone into this software and you are *
* benefitting. We hope that you share your changes too. What goes *
* around, comes around. *
**************************************************************************/
#include <glib.h>
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <merc.h>
#include <tables.h>
#include <interp.h>
#include <unistd.h>
/*
* Local functions.
*/
void talk_channel args( ( CHAR_DATA *ch, char *argument,
int channel, const char *verb ) );
void do_quote args( ( CHAR_DATA *ch ) );
bool is_in args( (char *, char *) );
bool all_in args( (char *, char *) );
void check_deadbeat args( (CHAR_DATA *ch ) );
char * oldelang args( ( CHAR_DATA *ch, char *argument ) );
char * badlang args( ( CHAR_DATA *ch, char *argument ) );
char * darktongue args( ( CHAR_DATA *ch, char *argument ) );
char * drunktalk args( ( CHAR_DATA *ch, char *argument ) );
char * socialc args( ( CHAR_DATA *ch, char *argument, char *you, char *them ) );
char * socialv args( ( CHAR_DATA *ch, char *argument, char *you, char *them ) );
char * socialn args( ( CHAR_DATA *ch, char *argument, char *you, char *them ) );
extern bool is_ignoring(CHAR_DATA *ch, CHAR_DATA *victim);
bool check_dumbshit args( (char *command) );
typedef struct talk_channel TALK_CHANNEL;
struct talk_channel{
CHAR_DATA *ch;
int channel;
char *argument;
GString *buf;
GString *buf2;
};
void process_talk_channel_dlist(DESCRIPTOR_DATA *d,TALK_CHANNEL *userdata)
{
CHAR_DATA *och;
CHAR_DATA *vch;
int position;
GString *buf3;
int channel = userdata->channel;
CHAR_DATA *ch = userdata->ch;
buf3 = g_string_new("");
och = d->original ? d->original : d->character;
vch = d->character;
if ( d->connected == CON_PLAYING
&& vch != ch
&& !IS_SET(och->deaf, channel) )
{
if ( channel == CHANNEL_IMMTALK && !IS_IMMORTAL(och) )
return;
if ( channel == CHANNEL_VAMPTALK && (!IS_NPC(och) &&
!IS_CLASS(och, CLASS_VAMPIRE) && !IS_IMMORTAL(och)))
return;
if ( channel == CHANNEL_MAGETALK && (!IS_NPC(och) &&
!IS_CLASS(och, CLASS_MAGE) && !IS_IMMORTAL(och)))
return;
if ( channel == CHANNEL_CGOSSIP && och->level < 3)
return;
if ( channel == CHANNEL_PRAY && (!IS_NPC(och) && !IS_IMMORTAL(och)))
return;
if ( channel == CHANNEL_HOWL && (!IS_NPC(och) && !IS_SWWF(och) &
!IS_CLASS(och, CLASS_WEREWOLF) && !IS_POLYAFF(och,POLY_WOLF)
&& !IS_IMMORTAL(och)))
{
if ((och->in_room) && (ch->in_room))
{
if ((och->in_room == ch->in_room))
{
act("$n throws back $s head and howls loudly.", ch , userdata->argument , och, TO_VICT);
return;
}
else if ((och->in_room->area == ch->in_room->area ))
{
act("You hear a loud howl nearby.", ch , NULL , och, TO_VICT);
return;
}
else
{
act("You hear a loud howl in the distance.", ch , NULL , och, TO_VICT);
return;
}
}
}
if ( channel == CHANNEL_YELL
&& vch->in_room->area != ch->in_room->area )
return;
position = vch->position;
if ( channel != CHANNEL_SHOUT && channel != CHANNEL_YELL )
vch->position = POS_STANDING;
if (!IS_NPC(vch) && ( channel == CHANNEL_OOC))
{
if (can_see(vch,ch))
g_string_sprintf(buf3,"{B%s %s\n", ch->name->str,userdata->buf2->str);
else
{
if (IS_IMMORTAL(ch))
g_string_sprintf(buf3,"{BAn Immortal %s\n",userdata->buf2->str);
else
g_string_sprintf(buf3,"{BSomeone %s\n",userdata->buf2->str);
}
send_to_char(buf3->str,vch);
vch->position = position;
g_string_free(buf3,TRUE);
return;
}
if (!IS_NPC(vch) && IS_CLASS(vch, CLASS_VAMPIRE) && (ch->clan != vch->clan) )
{
act( userdata->buf2->str, ch, userdata->argument, vch, TO_VICT );
vch->position = position;
return;
}
if (!IS_NPC(vch) && (IS_CLASS(vch, CLASS_WEREWOLF)) && vch->level > 2)
{
act( userdata->buf2->str, ch, userdata->argument, vch, TO_VICT );
vch->position = position;
return;
}
if (!IS_NPC(vch) && IS_SWWF(vch))
{
act( userdata->buf2->str, ch, userdata->argument, vch, TO_VICT );
vch->position = position;
return;
}
if (!IS_NPC(vch) && (IS_CLASS(vch, CLASS_DEMON)||IS_IMMORTAL(vch)))
{
act( userdata->buf2->str, ch, userdata->argument, vch, TO_VICT );
vch->position = position;
return;
}
if (!IS_NPC(vch) && (IS_CLASS(vch,CLASS_MAGE)||IS_IMMORTAL(vch)))
{
act( userdata->buf2->str, ch, userdata->argument, vch, TO_VICT );
vch->position = position;
return;
}
if (vch->level == LEVEL_MORTAL && channel == CHANNEL_HOWL &&
(IS_CLASS(ch,CLASS_WEREWOLF) || IS_SWWF(ch)))
return;
if (IS_NPC(vch) && channel == CHANNEL_HOWL)
return;
act( userdata->buf->str, ch, userdata->argument, vch, TO_VICT );
vch->position = position;
}
return;
}
/*
* Generic channel function.
*/
void talk_channel( CHAR_DATA *ch, char *argument, int channel, const char *verb )
{
GString *buf;
GString *buf2;
int position;
TALK_CHANNEL *talkchannel;
buf = g_string_new("");
buf2 = g_string_new("");
if ( ch->move < -200 )
{
g_string_sprintf( buf, "You are WAY too tired to %s.\n\r", verb );
send_to_char( buf->str, ch );
return;
}
if ( ch->level < 2 )
{
g_string_sprintf( buf, "You can't %s until your character can be saved.\n\r", verb );
send_to_char( buf->str, ch );
return;
}
if ( IS_NPC(ch) && IS_SET(ch->act,ACT_ANIMAL))
{
return;
}
if ( argument[0] == '\0' )
{
g_string_sprintf( buf, "%s what?\n\r", verb );
buf->str[0] = UPPER(buf->str[0]);
return;
}
if ( IS_RAFFECTED(ch->in_room,ROOM_AFF_SILENT))
{
send_to_char("You can't make a sound.\n\r", ch);
return;
}
if (!IS_NPC(ch) && IS_SET(ch->pcdata->powers[WOLF_POLYAFF], POLY_ZULO))
{
send_to_char("Not in your form\n\r",ch);
return;
}
if ( IS_HEAD(ch, LOST_TONGUE) )
{
g_string_sprintf( buf, "You can't %s without a tongue!\n\r", verb );
send_to_char( buf->str, ch );
return;
}
if (IS_BODY(ch, CUT_THROAT))
{
g_string_sprintf( buf, "Blood spits out your throat as you try to %s\n\r", verb );
send_to_char( buf->str, ch );
return;
}
if ( IS_EXTRA(ch, GAGGED) )
{
g_string_sprintf( buf, "You can't %s with a gag on!\n\r", verb );
send_to_char( buf->str, ch );
return;
}
if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_SILENCE) )
{
g_string_sprintf( buf, "You can't %s.\n\r", verb );
send_to_char( buf->str, ch );
return;
}
REMOVE_BIT(ch->deaf, channel);
switch ( channel )
{
default:
g_string_sprintf( buf, "{RYou %s '%s'{x\n\r", verb, argument );
send_to_char( buf->str, ch );
g_string_sprintf( buf, "{R$n %ss '$t'{x", verb );
g_string_sprintf( buf2, "{R$n %ss '$t'{x", verb );
break;
case CHANNEL_IMMTALK:
g_string_sprintf( buf, "{C$n: {W$t{x" );
g_string_sprintf( buf2, "{C$n: {W$t{x" );
position = ch->position;
ch->position = POS_STANDING;
act( buf->str, ch, argument, NULL, TO_CHAR );
ch->position = position;
break;
case CHANNEL_OOC:
g_string_sprintf( buf, "{B$n %ss: $t{x", verb );
g_string_sprintf( buf2,"%ss: %s{x", verb, argument );
position = ch->position;
ch->position = POS_STANDING;
act( buf->str, ch, argument, ch->name, TO_CHAR );
ch->position = position;
break;
case CHANNEL_CGOSSIP:
g_string_sprintf( buf, "{c$n %ss '$t'{x", verb );
g_string_sprintf( buf2, "{c$n %ss '$t'{x", verb );
position = ch->position;
ch->position = POS_STANDING;
act( buf->str, ch, argument, NULL, TO_CHAR );
ch->position = position;
break;
case CHANNEL_QUESTION:
g_string_sprintf( buf, "{y$n %ss '$t'{x", verb );
g_string_sprintf( buf2, "{y$n %ss '$t'{x", verb );
position = ch->position;
ch->position = POS_STANDING;
act( buf->str, ch, argument, NULL, TO_CHAR );
ch->position = position;
break;
case CHANNEL_MUSIC:
g_string_sprintf( buf, "{Y$n %ss '$t'{x", verb );
g_string_sprintf( buf2, "{Y$n %ss '$t'{x", verb );
position = ch->position;
ch->position = POS_STANDING;
act( buf->str, ch, argument, NULL, TO_CHAR );
ch->position = position;
break;
case CHANNEL_PRAY:
g_string_sprintf( buf, "You pray '$t'{x" );
g_string_sprintf( buf2, "$n prays '$t'{x" );
position = ch->position;
ch->position = POS_STANDING;
act( buf->str, ch, argument, NULL, TO_CHAR );
ch->position = position;
break;
case CHANNEL_MAGETALK:
g_string_sprintf( buf, "{C-$n- '$t'{x" );
g_string_sprintf( buf2, "{C-$n- '$t'{x" );
position = ch->position;
ch->position = POS_STANDING;
act( buf->str, ch, argument, NULL, TO_CHAR );
ch->position = position;
break;
case CHANNEL_HOWL:
g_string_sprintf( buf, "{wYou howl '$t'{x" );
g_string_sprintf( buf2, "{w$n howls '$t'{x" );
position = ch->position;
ch->position = POS_STANDING;
act( buf->str, ch, argument, NULL, TO_CHAR );
ch->position = position;
break;
case CHANNEL_VAMPTALK:
if (!IS_NPC(ch) && (ch->pcdata->stats[UNI_GEN] == 1 || IS_SET(ch->special, SPC_ANARCH)))
{
g_string_sprintf( buf, "{W<[$n]> $t{x" );
g_string_sprintf( buf2, "{W<[$n]> $t{x" );
}
else if (!IS_NPC(ch) && ch->pcdata->stats[UNI_GEN] == 2)
{
g_string_sprintf( buf, "{W<<$n>> $t{x" );
g_string_sprintf( buf2, "{W[[$n]] $t{x" );
}
else
{
g_string_sprintf( buf, "{W<$n> $t{x" );
g_string_sprintf( buf2, "{W[$n] $t{x" );
}
position = ch->position;
ch->position = POS_STANDING;
act( buf->str, ch, argument, NULL, TO_CHAR );
ch->position = position;
break;
}
talkchannel = g_new0(TALK_CHANNEL,1);
talkchannel->ch = ch;
talkchannel->argument = g_strdup(argument);
talkchannel->channel = channel;
talkchannel->buf = g_string_new(buf->str);
talkchannel->buf2 = g_string_new(buf2->str);
g_slist_foreach(descriptor_list,(GFunc)process_talk_channel_dlist,talkchannel);
g_string_free(buf,TRUE);
g_string_free(buf2,TRUE);
g_free(talkchannel);
return;
}
void do_cgossip( CHAR_DATA *ch, char *argument )
{
if ( ch->level >= 3 )
talk_channel( ch, argument, CHANNEL_CGOSSIP, "cgossip" );
else
send_to_char("Your not a avatar, you can't use this!\n\r",ch);
return;
}
void do_chat( CHAR_DATA *ch, char *argument )
{
talk_channel( ch, argument, CHANNEL_CHAT, "chat" );
return;
}
void do_ooc( CHAR_DATA *ch, char *argument )
{
talk_channel( ch, argument, CHANNEL_OOC, "OOC" );
return;
}
void do_music( CHAR_DATA *ch, char *argument )
{
talk_channel( ch, argument, CHANNEL_MUSIC, "sing" );
return;
}
void do_question( CHAR_DATA *ch, char *argument )
{
talk_channel( ch, argument, CHANNEL_QUESTION, "question" );
return;
}
void do_answer( CHAR_DATA *ch, char *argument )
{
talk_channel( ch, argument, CHANNEL_QUESTION, "answer" );
return;
}
void do_shout( CHAR_DATA *ch, char *argument )
{
talk_channel( ch, argument, CHANNEL_SHOUT, "shout" );
WAIT_STATE( ch, 12 );
return;
}
void do_yell( CHAR_DATA *ch, char *argument )
{
talk_channel( ch, argument, CHANNEL_YELL, "yell" );
return;
}
void do_immtalk( CHAR_DATA *ch, char *argument )
{
talk_channel( ch, argument, CHANNEL_IMMTALK, "immtalk" );
return;
}
void do_vamptalk( CHAR_DATA *ch, char *argument )
{
if (IS_NPC(ch) || (!IS_IMMORTAL(ch) && !IS_CLASS(ch,CLASS_VAMPIRE)))
{
send_to_char("Huh?\n\r",ch);
return;
}
talk_channel( ch, argument, CHANNEL_VAMPTALK, "vamptalk" );
return;
}
void do_magetalk( CHAR_DATA *ch, char *argument )
{
if (IS_NPC( ch ) || (!IS_IMMORTAL(ch) && !IS_CLASS(ch,CLASS_MAGE)))
{
send_to_char("Huh?\n\r",ch);
return;
}
talk_channel( ch, argument, CHANNEL_MAGETALK, "magetalk" );
return;
}
/*Quote Stuff By Spiral */
/*
* Structure for a Quote
*/
struct quote_type
{
int quote_num; /*Have to keep track some how :P */
char * text;
char * by;
};
/*
* The Quotes - insert yours in, and increase MAX_QUOTES in merc.h */
const struct quote_type quote_table [MAX_QUOTES] =
{
{ 0,"When Are Mages Going to be in?", "Everyone" }, /* 1 */
{ 1,"Wandering between two worlds, one dead, the other powerless to be born.", "Matthew Arnold" },
{ 2,"This is the forest primevil.","Henry LongFellow"},
{ 3,"You fools! There are greater things in existence, and they are within your reach!","Brujah"},
{ 4,"They are different from the rest, as are we, but they are even more lonely.","Gangrel talking about a Malkavian"},
{ 5,"Thier virtue is pure, but thier vision is cloudy.","Brujah about Gangrel" },
{ 6,"Stop killing me!", "Cid the werewolf" },
{ 7,"Your a dead man Shadowwing!", "Halbarad" },
{ 8,"Sorry I berserked, I didn't see you there.", "Jasmine to Junsheer" },
{ 9,"Is there a Imm on?","Anonymous Newbie" },
{ 10,"By the blood of my forebears, no one will harm this land.", "Tribe: Silver Fangs" },
{ 11,"You are a worthy foe!", "Tribe: Get of Fenris" },
{ 12,"Noone wants to be alone.. not even on a mud.........maybe urshulgi ;)", "Colgrim" }, /* 13 */
{ 13,"You let WHO be a Prince?!?", "Anon" },
{ 14,"Everybody has their code. The difference is, the Assamites live by theirs", "Godefroy" },
{ 15,"*Piff* shut up salieri.. i kicked your ass.", "PhantomFox" },
{ 16,"Donate to lurkingfear! Help us pay for a better server!", "Spiral" },
{ 17,"DAMN BUGS!", "Spiral" },
{ 18,"It's not my fault!", "Anon" },
{ 19,"Dumb QM!","Poco" },
{ 20,"Waaah, werewolves arent balanced, waaah!", "Anonymous Vampire" },
{ 21,"Its not my city, if it was mine, there wouldn't be a city and all of you would gone...", "Talon, Get of Fenris Alpha" },
{ 22,"Jovie? Who are you?", "Almost Everybody"},
{ 23,"{RRule: Spellbotting is Illegal{x","Lurf Staff"},
{ 24,"{RRule: Multiplaying is Illegal{x","Lurf Staff"},
{ 25,"((welcomes BACK his bugs))","Petyr"},
{ 26,"MAGES ARE WEAK!!!!","Appius"},
{ 27,"Don't sing it, JUST BRING IT!","Baccus"},
{ 28,"I need a word with an imm please..","Colgrim"},
{ 29,"WHY AM I BANNED?","Aol User"},
{ 30,"Who just got capped?","Scared Avatar"}
};
/*
* The Routine
* Quote Code is by elfren@aros.net
*/
void do_quote( CHAR_DATA *ch )
{
char buf[MAX_STRING_LENGTH];
int number;
number = number_range( 0, MAX_QUOTES - 1);
sprintf ( buf, "\n\r%s\n\r - %s\n\r",
quote_table[number].text,
quote_table[number].by);
send_to_char ( buf, ch );
return;
}
void do_pray( CHAR_DATA *ch, char *argument )
{
act("You mutter a few prayers.",ch,NULL,NULL,TO_CHAR);
act("$n mutters a quick prayer.",ch,NULL,NULL,TO_ROOM);
if (IS_NPC(ch))
return;
if ( argument[0] == '\0' )
{
send_to_char("What do you wish to pray?\n\r",ch);
return;
}
if (IS_SET(ch->deaf, CHANNEL_PRAY))
{
send_to_char("But you're not even on the channel!\n\r",ch);
return;
}
talk_channel( ch, argument, CHANNEL_PRAY, "pray" );
return;
}
void do_secttalk( CHAR_DATA *ch, char *argument )
{
DESCRIPTOR_DATA *d;
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
GSList *desc_list = descriptor_list;
if (IS_NPC( ch ))
{
send_to_char("Huh?\n\r",ch);
return;
}
if (IS_CLASS(ch,CLASS_UNCLASS))
{
send_to_char("huh?",ch);
return;
}
if (ch->sect == SECT_INDEPENDENT)
{
send_to_char("huh?",ch);
return;
}
if (IS_BODY(ch, CUT_THROAT))
{
sprintf( buf, "Blood spits out your throat as you try to sectalk.\n\r");
send_to_char( buf, ch );
return;
}
if ( IS_RAFFECTED(ch->in_room,ROOM_AFF_SILENT))
{
send_to_char("You can't make a sound.\n\r", ch);
return;
}
if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_SILENCE) )
{
send_to_char( "You can't secttalk.\n\r", ch );
return;
}
while ( desc_list != NULL )
{
CHAR_DATA *vch;
d = (DESCRIPTOR_DATA*)desc_list->data;
vch = d->character;
if ( d->connected == CON_PLAYING
&& vch != ch
&& !IS_SET(vch->deaf, CHANNEL_SECTTALK)
&& IS_IMMORTAL(vch))
{
sprintf( buf2, "{W(%s%s{W) {G%s tells the sect '%s'.{x\n\r",sect_table[ch->sect].color, sect_table[ch->sect].pretty_name,ch->name->str, argument );
send_to_char( buf2, vch );
}
if ( d->connected == CON_PLAYING
&& vch != ch
&& vch->sect != SECT_INDEPENDENT
&& ch->sect != SECT_INDEPENDENT
&& vch->sect == ch->sect
&& !IS_IMMORTAL(vch)
&& IS_HERO(vch)
&& !IS_SET(vch->deaf, CHANNEL_SECTTALK))
{
if (IS_IMMORTAL(ch))
sprintf( buf2, "{G%s tells the sect '%s'.{x\n\r", PERS(ch,vch), argument );
else
sprintf( buf2, "{G%s tells the sect '%s'.{x\n\r", ch->name->str, argument );
send_to_char(buf2,vch);
}
desc_list = g_slist_next(desc_list);
}
g_slist_free(desc_list);
sprintf( buf, "{GYou tell the sect '%s'.{x\n\r", argument );
send_to_char( buf, ch );
return;
}
void do_howl( CHAR_DATA *ch, char *argument )
{
if (IS_NPC( ch ))
return;
if ((!IS_IMMORTAL(ch) & !IS_SWWF(ch) & !IS_CLASS(ch,CLASS_WEREWOLF)
&& !IS_POLYAFF(ch, POLY_WOLF)))
{
send_to_char("Huh?\n\r",ch);
return;
}
talk_channel( ch, argument, CHANNEL_HOWL, "howls" );
return;
}
void do_say( CHAR_DATA *ch, char *argument )
{
char name [80];
char poly [MAX_STRING_LENGTH];
char speak [10];
char speaks [10];
char endbit [2];
char secbit [2];
char buf[MAX_STRING_LENGTH];
CHAR_DATA *to;
bool is_ok;
if ( IS_HEAD(ch, LOST_TONGUE) )
{
send_to_char( "You can't speak without a tongue!\n\r", ch );
return;
}
if (IS_BODY(ch, CUT_THROAT))
{
sprintf( buf, "Blood spits out your throat as you try to speak.\n\r" );
send_to_char( buf, ch );
return;
}
if ( IS_RAFFECTED(ch->in_room,ROOM_AFF_SILENT))
{
send_to_char("You can't make a sound.\n\r", ch);
return;
}
if ( IS_NPC(ch) && IS_SET(ch->act,ACT_ANIMAL))
{
return;
}
if ( IS_EXTRA(ch, GAGGED) )
{
send_to_char( "You can't speak with a gag on!\n\r", ch );
return;
}
if (strlen(argument) > MAX_INPUT_LENGTH)
{
send_to_char( "Line too long.\n\r", ch );
return;
}
if ( argument[0] == '\0' )
{
send_to_char( "Say what?\n\r", ch );
return;
}
endbit[0] = argument[strlen(argument)-1];
endbit[1] = '\0';
if (strlen(argument) > 1) secbit[0] = argument[strlen(argument)-2];
else secbit[0] = '\0';
secbit[1] = '\0';
if (IS_BODY(ch,CUT_THROAT))
{
sprintf(speak,"rasp");
sprintf(speaks,"rasps");
}
else if (!IS_NPC(ch) &&
(IS_SET(ch->special,SPC_WOLFMAN) || IS_POLYAFF(ch, POLY_WOLF)
|| (IS_CLASS(ch, CLASS_VAMPIRE) && ch->pcdata->stats[UNI_RAGE] > 0)))
{
if (number_percent() > 50)
{
sprintf(speak,"growl");
sprintf(speaks,"growls");
}
else
{
sprintf(speak,"snarl");
sprintf(speaks,"snarls");
}
}
else if (!IS_NPC(ch) && IS_POLYAFF(ch, POLY_BAT))
{
sprintf(speak,"squeak");
sprintf(speaks,"squeaks");
}
else if (!IS_NPC(ch) && IS_POLYAFF(ch, POLY_SERPENT))
{
sprintf(speak,"hiss");
sprintf(speaks,"hisses");
}
else if (!IS_NPC(ch) && IS_POLYAFF(ch, POLY_FROG))
{
sprintf(speak,"croak");
sprintf(speaks,"croaks");
}
else if (!IS_NPC(ch) && IS_POLYAFF(ch, POLY_RAVEN))
{
sprintf(speak,"squark");
sprintf(speaks,"squarks");
}
else if (IS_NPC(ch) && ch->pIndexData->vnum == MOB_VNUM_FROG)
{
sprintf(speak,"croak");
sprintf(speaks,"croaks");
}
else if (IS_NPC(ch) && ch->pIndexData->vnum == MOB_VNUM_RAVEN)
{
sprintf(speak,"squark");
sprintf(speaks,"squarks");
}
else if (IS_NPC(ch) && ch->pIndexData->vnum == MOB_VNUM_CAT)
{
sprintf(speak,"purr");
sprintf(speaks,"purrs");
}
else if (IS_NPC(ch) && ch->pIndexData->vnum == MOB_VNUM_DOG)
{
sprintf(speak,"bark");
sprintf(speaks,"barks");
}
else if (!str_cmp(endbit,"!"))
{
sprintf(speak,"exclaim");
sprintf(speaks,"exclaims");
}
else if (!str_cmp(endbit,"?"))
{
sprintf(speak,"ask");
sprintf(speaks,"asks");
}
else if (secbit[0] != '\0' && str_cmp(secbit,".") && !str_cmp(endbit,"."))
{
sprintf(speak,"state");
sprintf(speaks,"states");
}
else if (secbit[0] != '\0' && !str_cmp(secbit,".") && !str_cmp(endbit,"."))
{
sprintf(speak,"mutter");
sprintf(speaks,"mutters");
}
else if (!IS_NPC(ch) && ch->pcdata->condition[COND_DRUNK] > 10)
{
sprintf(speak,"slur");
sprintf(speaks,"slurs");
}
else
{
sprintf(speak,"say");
sprintf(speaks,"says");
}
sprintf(poly,"{CYou %s '$T'{x", speak);
if (!IS_NPC(ch))
{
if (ch->pcdata->condition[COND_DRUNK] > 10)
act( poly, ch, NULL, drunktalk(ch, argument), TO_CHAR );
else if (IS_SPEAKING(ch,DIA_OLDE))
act( poly, ch, NULL, oldelang(ch, argument), TO_CHAR );
else if (IS_SPEAKING(ch,DIA_BAD))
act( poly, ch, NULL, badlang(ch, argument), TO_CHAR );
else if (IS_SPEAKING(ch,LANG_DARK))
act( poly, ch, NULL, darktongue(ch, argument), TO_CHAR );
else
act( poly, ch, NULL, argument, TO_CHAR );
}
else
act( poly, ch, NULL, argument, TO_CHAR );
sprintf(poly,"{C$n %s '$T'{x", speaks);
if (ch->in_room->vnum != ROOM_VNUM_IN_OBJECT)
{
if (!IS_NPC(ch))
{
/*
if (ch->pcdata->condition[COND_DRUNK] > 10)
act( poly, ch, NULL, drunktalk(ch, argument), TO_ROOM );
else if (IS_SPEAKING(ch,DIA_OLDE))
act( poly, ch, NULL, oldelang(ch, argument), TO_ROOM );
else if (IS_SPEAKING(ch,DIA_BAD))
act( poly, ch, NULL, badlang(ch, argument), TO_ROOM );
else if (IS_SPEAKING(ch,LANG_DARK))
act( poly, ch, NULL, darktongue(ch, argument), TO_ROOM );
else
*/
act( poly, ch, NULL, argument, TO_ROOM );
}
else
act( poly, ch, NULL, argument, TO_ROOM );
if ( ch->fighting == NULL )
room_text( ch, strlower(argument) );
/* Mprog Shit */
if ( !IS_NPC(ch) )
{
CHAR_DATA *mob, *mob_next;
for ( mob = ch->in_room->people; mob != NULL; mob = mob_next )
{
mob_next = mob->next_in_room;
if ( IS_NPC(mob) && HAS_TRIGGER( mob, TRIG_SPEECH ))
mp_act_trigger( argument, mob, ch, NULL, NULL, TRIG_SPEECH );
if ( IS_NPC(mob) && HAS_TRIGGER( mob, TRIG_RIDD ))
mp_riddle_trigger( argument, mob, ch, NULL, NULL, TRIG_RIDD );
}
}
return;
}
to = ch->in_room->people;
for ( ; to != NULL; to = to->next_in_room )
{
is_ok = FALSE;
if ( to->desc == NULL || !IS_AWAKE(to) )
continue;
if ( ch == to )
continue;
if (!IS_NPC(ch) && ch->pcdata->chobj != NULL &&
ch->pcdata->chobj->in_room != NULL &&
!IS_NPC(to) && to->pcdata->chobj != NULL &&
to->pcdata->chobj->in_room != NULL &&
ch->in_room == to->in_room)
is_ok = TRUE; else is_ok = FALSE;
if (!IS_NPC(ch) && ch->pcdata->chobj != NULL &&
ch->pcdata->chobj->in_obj != NULL &&
!IS_NPC(to) && to->pcdata->chobj != NULL &&
to->pcdata->chobj->in_obj != NULL &&
ch->pcdata->chobj->in_obj == to->pcdata->chobj->in_obj)
is_ok = TRUE; else is_ok = FALSE;
if (!is_ok) continue;
if (IS_NPC(ch))
sprintf(name, ch->short_descr->str);
else if (!IS_NPC(ch) && IS_AFFECTED(ch,AFF_POLYMORPH))
sprintf(name, ch->morph->str);
else
sprintf(name, ch->name->str);
name[0]=UPPER(name[0]);
sprintf(poly,"{C%s %s '%s'{x\n\r", name,speaks,argument);
send_to_char(poly,to);
}
/* Mprog Shit */
if ( !IS_NPC(ch) )
{
CHAR_DATA *mob, *mob_next;
for ( mob = ch->in_room->people; mob != NULL; mob = mob_next )
{
mob_next = mob->next_in_room;
if ( IS_NPC(mob) && HAS_TRIGGER( mob, TRIG_SPEECH ))
mp_act_trigger( argument, mob, ch, NULL, NULL, TRIG_SPEECH );
if ( IS_NPC(mob) && HAS_TRIGGER( mob, TRIG_RIDD ))
mp_riddle_trigger( argument, mob, ch, NULL, NULL, TRIG_RIDD );
}
}
if (ch->fighting ==NULL )
room_text( ch, strlower(argument) );
return;
}
/* last called when last crash (by the copyover) -Spiral*/
void room_text( CHAR_DATA *ch, char *argument)
{
CHAR_DATA *vch;
CHAR_DATA *vch_next;
CHAR_DATA *mob;
OBJ_DATA *obj;
ROOMTEXT_DATA *rt;
bool mobfound;
bool hop;
char arg [MAX_INPUT_LENGTH];
char arg1 [MAX_INPUT_LENGTH];
char arg2 [MAX_INPUT_LENGTH];
for ( rt = ch->in_room->roomtext; rt != NULL; rt = rt->next )
{
if (!strcmp(argument,rt->input)
|| is_in(argument, rt->input)
|| all_in(argument, rt->input))
{
if ( rt->name != NULL && rt->name != '\0'
&& str_cmp(rt->name,"all") && str_cmp(rt->name,"|all*") )
if (!is_in(ch->name->str, rt->name) ) continue;
mobfound = TRUE;
if (rt->mob != 0)
{
mobfound = FALSE;
for ( vch = char_list; vch != NULL; vch = vch_next )
{
vch_next = vch->next;
if ( vch->in_room == NULL ) continue;
if ( !IS_NPC(vch) ) continue;
if ( vch->in_room == ch->in_room
&& vch->pIndexData->vnum == rt->mob )
{
mobfound = TRUE;
break;
}
}
}
if (!mobfound) continue;
hop = FALSE;
switch(rt->type % RT_RETURN)
{
case RT_SAY:
break;
case RT_LIGHTS:
do_changelight(ch,"");
break;
case RT_LIGHT:
REMOVE_BIT(ch->in_room->room_flags, ROOM_DARK);
break;
case RT_DARK:
SET_BIT(ch->in_room->room_flags, ROOM_DARK);
break;
case RT_OBJECT:
if ( get_obj_index(rt->power) == NULL ) return;
obj = create_object(get_obj_index(rt->power), ch->level);
if (IS_SET(rt->type, RT_TIMER) ) obj->timer = 1;
if (CAN_WEAR(obj,ITEM_TAKE)) obj_to_char(obj,ch);
else obj_to_room(obj,ch->in_room);
if (!str_cmp(rt->choutput,"copy"))
act( rt->output, ch, obj, NULL, TO_CHAR );
else
act( rt->choutput, ch, obj, NULL, TO_CHAR );
if (!IS_SET(rt->type, RT_PERSONAL) )
act( rt->output, ch, obj, NULL, TO_ROOM );
hop = TRUE;
break;
case RT_MOBILE:
if ( get_mob_index(rt->power) == NULL ) return;
mob = create_mobile(get_mob_index(rt->power));
char_to_room(mob,ch->in_room);
if (!str_cmp(rt->choutput,"copy"))
act( rt->output, ch, NULL, mob, TO_CHAR );
else
act( rt->choutput, ch, NULL, mob, TO_CHAR );
if (!IS_SET(rt->type, RT_PERSONAL) )
act( rt->output, ch, NULL, mob, TO_ROOM );
hop = TRUE;
break;
case RT_SPELL:
(*skill_table[rt->power].spell_fun) ( rt->power, number_range(20,30), ch, ch );
break;
case RT_PORTAL:
if ( get_obj_index(OBJ_VNUM_PORTAL) == NULL ) return;
obj = create_object(get_obj_index(OBJ_VNUM_PORTAL), 0);
obj->timer = 1;
obj->value[0] = rt->power;
obj->value[1] = 1;
obj_to_room(obj,ch->in_room);
break;
case RT_TELEPORT:
if ( get_room_index(rt->power) == NULL ) return;
if (!str_cmp(rt->choutput,"copy"))
act( rt->output, ch, NULL, NULL, TO_CHAR );
else
act( rt->choutput, ch, NULL, NULL, TO_CHAR );
if (!IS_SET(rt->type, RT_PERSONAL) )
act( rt->output, ch, NULL, NULL, TO_ROOM );
char_from_room(ch);
char_to_room(ch,get_room_index(rt->power));
act("$n appears in the room.",ch,NULL,NULL,TO_ROOM);
do_look(ch,"auto");
hop = TRUE;
break;
case RT_ACTION:
sprintf(arg,argument);
argument = one_argument( arg, arg1 );
argument = one_argument( arg, arg2 );
if ( (mob = get_char_room(ch, arg2) ) == NULL ) continue;
interpret( mob, rt->output );
break;
case RT_OPEN_LIFT:
open_lift(ch);
break;
case RT_CLOSE_LIFT:
close_lift(ch);
break;
case RT_MOVE_LIFT:
move_lift(ch,rt->power);
break;
default:
break;
}
if (hop && IS_SET(rt->type, RT_RETURN) ) return;
else if (hop) continue;
if (!str_cmp(rt->choutput,"copy") && !IS_SET(rt->type, RT_ACTION))
act( rt->output, ch, NULL, NULL, TO_CHAR );
else if (!IS_SET(rt->type, RT_ACTION))
act( rt->choutput, ch, NULL, NULL, TO_CHAR );
if (!IS_SET(rt->type, RT_PERSONAL) && !IS_SET(rt->type, RT_ACTION) )
act( rt->output, ch, NULL, NULL, TO_ROOM );
if (IS_SET(rt->type, RT_RETURN) ) return;
}
}
mudsetting->last_proc_logged = 1;
return;
}
char *strlower(char *ip)
{
static char buffer[MAX_INPUT_LENGTH];
int pos;
for (pos = 0; pos < (MAX_INPUT_LENGTH - 1) && ip[pos] != '\0'; pos++) {
buffer[pos] = tolower(ip[pos]);
}
buffer[pos] = '\0';
return buffer;
}
bool is_in(char *arg, char *ip)
{
char *lo_arg;
char cmp[MAX_INPUT_LENGTH];
int fitted;
if (ip[0] != '|')
return FALSE;
cmp[0] = '\0';
lo_arg = strlower(arg);
do {
ip += strlen(cmp) + 1;
fitted = sscanf(ip, "%[^*]", cmp);
if (strstr(lo_arg, cmp) != NULL) {
return TRUE;
}
} while (fitted > 0);
return FALSE;
}
bool is_inpref(char *arg, char *ip)
{
char *lo_arg;
char cmp[MAX_INPUT_LENGTH];
int fitted;
if (ip[0] != '|')
return FALSE;
cmp[0] = '\0';
lo_arg = strlower(arg);
do {
ip += strlen(cmp) + 1;
fitted = sscanf(ip, "%[^*]", cmp);
if (!str_prefix(lo_arg, cmp)) {
return TRUE;
}
} while (fitted > 0);
return FALSE;
}
bool all_in(char *arg, char *ip)
{
char *lo_arg;
char cmp[MAX_INPUT_LENGTH];
int fitted;
if (ip[0] != '&')
return FALSE;
cmp[0] = '\0';
lo_arg = strlower(arg);
do {
ip += strlen(cmp) + 1;
fitted = sscanf(ip, "%[^*]", cmp);
if (strstr(lo_arg, cmp) == NULL) {
return FALSE;
}
} while (fitted > 0);
return TRUE;
}
void do_tell( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
char poly [MAX_STRING_LENGTH];
CHAR_DATA *victim;
int position;
DESCRIPTOR_DATA *d;
GSList *desc_list = descriptor_list;
if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_SILENCE) )
{
send_to_char( "Your message didn't get through.\n\r", ch );
return;
}
if (IS_EXTRA(ch, GAGGED))
{
send_to_char( "Your message didn't get through.\n\r", ch );
return;
}
if ( IS_RAFFECTED(ch->in_room,ROOM_AFF_SILENT))
{
send_to_char("You can't make a sound.\n\r", ch);
return;
}
argument = one_argument( argument, arg );
if ( arg[0] == '\0' || argument[0] == '\0' )
{
send_to_char( "Tell whom what?\n\r", ch );
return;
}
/*
* Can tell to PC's anywhere, but NPC's only in same room.
* -- Furey
*/
if ( ( victim = get_char_world( ch, arg ) ) == NULL
|| ( IS_NPC(victim) && victim->in_room != ch->in_room ) )
{
send_to_char( "Tell failed.\n\r", ch );
return;
}
if ( !IS_IMMORTAL(ch) && !IS_AWAKE(victim) )
{
send_to_char( "Tell failed.\n\r", ch );
return;
}
if ( !IS_NPC(victim) && victim->desc == NULL )
{
send_to_char( "Tell failed.\n\r", ch );
return;
}
if (!IS_IMMORTAL(ch) && IS_SET(victim->deaf, CHANNEL_TELL) )
{
if (IS_NPC(victim) || IS_NPC(ch) || victim->pcdata->marriage->len < 2
|| str_cmp(ch->name->str, victim->pcdata->marriage->str))
{
send_to_char( "Tell failed.\n\r", ch );
return;
}
}
if (is_ignoring(victim, ch))
{
sprintf(buf, "{MTell failed: %s is ignoring you.{x\n\r", victim->name->str);
send_to_char(buf, ch);
return;
}
act( "{MYou tell $N '$t'{x", ch, argument, victim, TO_CHAR );
position = victim->position;
victim->position = POS_STANDING;
sprintf(poly,"{M$n tells you '$t'{x");
act( poly, ch, argument, victim, TO_VICT );
victim->position = position;
victim->reply = ch;
while ( desc_list != NULL )
{
CHAR_DATA *vch;
d = (DESCRIPTOR_DATA*)desc_list->data;
vch = d->character;
if ( d->connected == CON_PLAYING
&& vch != ch
&& !IS_NPC(vch)
&& vch != victim
&& IS_SET(vch->pcdata->comm, COMM_LOG_TELLS)
&& vch->level >= LEVEL_HIGHJUDGE)
{
sprintf(poly,"{MTELL: %s tells %s %s{x\n\r",ch->name->str,victim->name->str,argument);
send_to_char(poly,vch);
}
desc_list = g_slist_next(desc_list);
}
g_slist_free(desc_list);
if ( !IS_NPC(ch) && IS_NPC(victim) && HAS_TRIGGER(victim,TRIG_SPEECH) )
mp_act_trigger( argument, victim, ch, NULL, NULL, TRIG_SPEECH );
return;
}
void do_whisper( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
if (IS_EXTRA(ch, GAGGED))
{
send_to_char( "Not with a gag on!\n\r", ch );
return;
}
argument = one_argument( argument, arg );
if ( arg[0] == '\0' || argument[0] == '\0' )
{
send_to_char( "Syntax: whisper <person> <message>\n\r", ch );
return;
}
if ( ( victim = get_char_world( ch, arg ) ) == NULL
|| ( victim->in_room != ch->in_room ) )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( !IS_AWAKE(victim) )
{
act( "$E cannot hear you.", ch, 0, victim, TO_CHAR );
return;
}
if ( !IS_NPC(victim) && victim->desc == NULL )
{
act( "$E is currently link dead.", ch, 0, victim, TO_CHAR );
return;
}
act( "{CYou whisper to $N '$t'{x", ch, argument, victim, TO_CHAR );
act( "{C$n whispers to you '$t'{x", ch, argument, victim, TO_VICT );
act( "{C$n whispers something to $N.{x", ch, NULL, victim, TO_NOTVICT );
return;
}
void do_reply( CHAR_DATA *ch, char *argument )
{
char poly [MAX_STRING_LENGTH];
CHAR_DATA *victim;
int position;
DESCRIPTOR_DATA *d;
GSList *desc_list = descriptor_list;
if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_SILENCE) )
{
send_to_char( "Your message didn't get through.\n\r", ch );
return;
}
if ( IS_RAFFECTED(ch->in_room,ROOM_AFF_SILENT))
{
send_to_char("You can't make a sound.\n\r", ch);
return;
}
if (IS_EXTRA(ch, GAGGED))
{
send_to_char( "Your message didn't get through.\n\r", ch );
return;
}
if ( ( victim = ch->reply ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( !IS_IMMORTAL(ch) && !IS_AWAKE(victim) )
{
act( "$E can't hear you.", ch, 0, victim, TO_CHAR );
return;
}
if ( !IS_NPC(victim) && victim->desc == NULL )
{
act( "$E is currently link dead.", ch, 0, victim, TO_CHAR );
return;
}
act( "{MYou tell $N '$t'.{x", ch, argument, victim, TO_CHAR );
position = victim->position;
victim->position = POS_STANDING;
while ( desc_list != NULL )
{
CHAR_DATA *vch;
d = (DESCRIPTOR_DATA*)desc_list->data;
vch = d->character;
if ( d->connected == CON_PLAYING
&& vch != ch
&& !IS_NPC(vch)
&& vch != victim
&& IS_SET(vch->pcdata->comm, COMM_LOG_TELLS)
&& vch->level >= LEVEL_HIGHJUDGE)
{
sprintf(poly,"{MTELL: %s tells %s %s{x\n\r",ch->name->str,victim->name->str,argument);
send_to_char(poly,vch);
}
desc_list = g_slist_next(desc_list);
}
g_slist_free(desc_list);
sprintf(poly,"{M$n tells you '$t'.{x");
act( poly, ch, argument, victim, TO_VICT );
victim->position = position;
victim->reply = ch;
return;
}
void do_emote( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
char *plast;
char name [80];
char poly [MAX_INPUT_LENGTH];
CHAR_DATA *to;
bool is_ok;
if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_NO_EMOTE) )
{
send_to_char( "You can't show your emotions.\n\r", ch );
return;
}
if ( IS_HEAD(ch, LOST_TONGUE) || IS_HEAD(ch, LOST_HEAD) || IS_EXTRA(ch, GAGGED))
{
send_to_char( "You can't show your emotions.\n\r", ch );
return;
}
if ( argument[0] == '\0' )
{
send_to_char( "Pose what?\n\r", ch );
return;
}
for ( plast = argument; *plast != '\0'; plast++ )
;
str_cpy( buf, argument );
if ( isalpha(plast[-1]) )
strcat( buf, ".{x" );
MOBtrigger = FALSE;
act( "$n $T", ch, NULL, buf, TO_CHAR );
if (ch->in_room->vnum != ROOM_VNUM_IN_OBJECT)
{
act( "$n $T", ch, NULL, buf, TO_ROOM );
return;
}
to = ch->in_room->people;
for ( ; to != NULL; to = to->next_in_room )
{
is_ok = FALSE;
if ( to->desc == NULL || !IS_AWAKE(to) )
continue;
if ( ch == to )
continue;
if (!IS_NPC(ch) && ch->pcdata->chobj != NULL &&
ch->pcdata->chobj->in_room != NULL &&
!IS_NPC(to) && to->pcdata->chobj != NULL &&
to->pcdata->chobj->in_room != NULL &&
ch->in_room == to->in_room)
is_ok = TRUE; else is_ok = FALSE;
if (!IS_NPC(ch) && ch->pcdata->chobj != NULL &&
ch->pcdata->chobj->in_obj != NULL &&
!IS_NPC(to) && to->pcdata->chobj != NULL &&
to->pcdata->chobj->in_obj != NULL &&
ch->pcdata->chobj->in_obj == to->pcdata->chobj->in_obj)
is_ok = TRUE; else is_ok = FALSE;
if (!is_ok) continue;
if (IS_NPC(ch))
sprintf(name, ch->short_descr->str);
else if (!IS_NPC(ch) && IS_AFFECTED(ch,AFF_POLYMORPH))
sprintf(name, ch->morph->str);
else
sprintf(name, PERS(ch,to));
name[0]=UPPER(name[0]);
sprintf(poly,"%s %s{x\n\r", name,buf);
send_to_char(poly,to);
}
MOBtrigger = TRUE;
return;
}
void do_xemote( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
char oldarg[MAX_STRING_LENGTH];
char *plast;
char name [80];
char you [80];
char them [80];
char poly [MAX_INPUT_LENGTH];
char arg [MAX_INPUT_LENGTH];
CHAR_DATA *to;
CHAR_DATA *victim;
bool is_ok;
argument = one_argument( argument, arg );
if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_NO_EMOTE) )
{
send_to_char( "You can't show your emotions.\n\r", ch );
return;
}
if ( IS_HEAD(ch, LOST_TONGUE) || IS_HEAD(ch, LOST_HEAD) || IS_EXTRA(ch, GAGGED))
{
send_to_char( "You can't show your emotions.\n\r", ch );
return;
}
if (strlen(argument) > MAX_INPUT_LENGTH)
{
send_to_char( "Line too long.\n\r", ch );
return;
}
if ( argument[0] == '\0' || arg[0] == '\0' )
{
send_to_char( "Syntax: emote <person> <sentence>\n\r", ch );
return;
}
if ( ( victim = get_char_room( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if (IS_NPC(ch)) str_cpy(you, ch->short_descr->str);
else str_cpy(you, ch->name->str);
if (IS_NPC(victim)) str_cpy(you, victim->short_descr->str);
else str_cpy(you, victim->name->str);
/*
oldarg = argument;
*/
str_cpy( oldarg,argument );
str_cpy( buf, argument );
for ( plast = argument; *plast != '\0'; plast++ )
;
if ( isalpha(plast[-1]) )
strcat( buf, "." );
argument = socialc(ch, buf, you, them);
str_cpy( buf, argument );
str_cpy( buf2, "{WYou ");
buf[0] = LOWER(buf[0]);
strcat( buf2, buf );
capitalize( buf2 );
act( buf2, ch, NULL, victim, TO_CHAR );
if (ch->in_room->vnum != ROOM_VNUM_IN_OBJECT)
{
str_cpy( buf, oldarg );
for ( plast = argument; *plast != '\0'; plast++ )
;
if ( isalpha(plast[-1]) )
strcat( buf, ".{x" );
argument = socialn(ch, buf, you, them);
str_cpy( buf, argument );
str_cpy( buf2, "$n ");
buf[0] = LOWER(buf[0]);
strcat( buf2, buf );
capitalize( buf2 );
act( buf2, ch, NULL, victim, TO_NOTVICT );
str_cpy( buf, oldarg );
for ( plast = argument; *plast != '\0'; plast++ )
;
if ( isalpha(plast[-1]) )
strcat( buf, ".{x" );
argument = socialv(ch, buf, you, them);
str_cpy( buf, argument );
str_cpy( buf2, "$n ");
buf[0] = LOWER(buf[0]);
strcat( buf2, buf );
capitalize( buf2 );
act( buf2, ch, NULL, victim, TO_VICT );
return;
}
MOBtrigger = FALSE;
to = ch->in_room->people;
for ( ; to != NULL; to = to->next_in_room )
{
is_ok = FALSE;
if ( to->desc == NULL || !IS_AWAKE(to) )
continue;
if ( ch == to )
continue;
if (!IS_NPC(ch) && ch->pcdata->chobj != NULL &&
ch->pcdata->chobj->in_room != NULL &&
!IS_NPC(to) && to->pcdata->chobj != NULL &&
to->pcdata->chobj->in_room != NULL &&
ch->in_room == to->in_room)
is_ok = TRUE; else is_ok = FALSE;
if (!IS_NPC(ch) && ch->pcdata->chobj != NULL &&
ch->pcdata->chobj->in_obj != NULL &&
!IS_NPC(to) && to->pcdata->chobj != NULL &&
to->pcdata->chobj->in_obj != NULL &&
ch->pcdata->chobj->in_obj == to->pcdata->chobj->in_obj)
is_ok = TRUE; else is_ok = FALSE;
if (!is_ok) continue;
if (IS_NPC(ch))
sprintf(name, ch->short_descr->str);
else if (!IS_NPC(ch) && IS_AFFECTED(ch,AFF_POLYMORPH))
sprintf(name, ch->morph->str);
else
sprintf(name, ch->name->str);
name[0]=UPPER(name[0]);
sprintf(poly,"%s %s\n\r", name,buf);
send_to_char(poly,to);
}
MOBtrigger = TRUE;
return;
}
void do_bug( CHAR_DATA *ch, char *argument )
{
append_file( ch, PLAYER_BUG_FILE, argument );
send_to_char( "{ROk. Thanks for the bug information the Immortals will look at it as soon as they can.{x\n\r", ch );
return;
}
void do_typo( CHAR_DATA *ch, char *argument )
{
append_file( ch, TYPO_FILE, argument );
send_to_char( "Ok. Thanks.\n\r", ch );
return;
}
void do_qui( CHAR_DATA *ch, char *argument )
{
send_to_char( "If you want to QUIT, you have to spell it out.\n\r", ch );
return;
}
void do_quit( CHAR_DATA *ch, char *argument )
{
DESCRIPTOR_DATA *d;
char buf[MSL];
// char buf[MAX_STRING_LENGTH];
OBJ_DATA *obj;
int id;
OBJ_DATA *obj_next;
CHAR_DATA *mount;
GSList *desc_list = descriptor_list;
if ( IS_NPC(ch) )
return;
if ( ch->position == POS_FIGHTING )
{
send_to_char( "No way! You are fighting.\n\r", ch );
return;
}
if ( ch->pk_timer > 0 )
{
send_to_char("You can't quit due to a recent pk fight. Wait a bit.\n\r",ch);
return;
}
if (IS_SET(ch->added, ADDED_CALM))
REMOVE_BIT(ch->added, ADDED_CALM);
if ( ch->hit - ch->pcdata->absorb[ABS_MOB_HP] >= 1 ||
ch->max_hit - ch->pcdata->absorb[ABS_MOB_MAX_HP] >= 1 )
{
ch->hit -= ch->pcdata->absorb[ABS_MOB_HP];
ch->max_hit -= ch->pcdata->absorb[ABS_MOB_MAX_HP];
ch->pcdata->absorb[ABS_MOB_VNUM] = 0;
ch->pcdata->absorb[ABS_MOB_HP] = 0;
ch->pcdata->absorb[ABS_MOB_MAX_HP] = 0;
}
if( IS_SET(ch->act, PLR_TAG) )
{
sprintf(buf, "TAG Game update: %s has just Ended it\n\r", ch->name->str);
do_info(ch,buf); /* Voltecs info channel */
REMOVE_BIT(ch->act, PLR_TAG);
return;
}
if (!IS_IMMORTAL(ch))
check_deadbeat(ch);
if ( ch->position < POS_SLEEPING )
{
send_to_char( "You're not DEAD yet.\n\r", ch );
return;
}
if ( (mount = ch->mount) != NULL )
do_dismount(ch,"");
shift_obj_plane(ch);
/* Run Quote Code - Spiral*/
do_quote(ch);
/*
* After extract_char the ch is no longer valid!
*/
d = ch->desc;
for ( obj = ch->carrying; obj != NULL; obj = obj_next )
{
obj_next = obj->next_content;
if (obj->wear_loc == WEAR_NONE) continue;
if ( !IS_NPC(ch) && ((obj->chobj != NULL && !IS_NPC(obj->chobj) &&
obj->chobj->pcdata->obj_vnum != 0) || obj->item_type == ITEM_KEY))
unequip_char(ch,obj);
}
save_char_obj( ch );
if ( ch->pcdata->in_progress)
free_note (ch->pcdata->in_progress);
if (ch->pcdata->obj_vnum != 0)
act( "$n slowly fades out of existance.", ch, NULL, NULL, TO_ROOM );
else
act( "$n has left the realm.", ch, NULL, NULL, TO_ROOM );
if (IS_SET(ch->act,PLR_ATTACK))
{
ch->pk_sect = 0;
REMOVE_BIT(ch->act, PLR_ATTACK);
}
if (ch->last_attacked != NULL)
ch->last_attacked = NULL;
if (ch->in_room != NULL) char_from_room(ch);
char_to_room(ch,get_room_index(30002));
sprintf( log_buf, "%s has quit Lurking Fear II.", ch->name->str );
logchan(log_buf, NULL, NULL,WIZ_LOGINS,0, LEVEL_QUESTMAKER);
log_string2( log_buf );
//if (ch->pcdata->obj_vnum == 0)
//{
// str_cpy( buf, "Someone has left Lurking Fear II." );
// do_info(ch,buf);
//}
if (ch->pcdata->chobj != NULL)
extract_obj(ch->pcdata->chobj);
id = ch->id;
extract_char( ch, TRUE );
if ( d != NULL )
close_socket(d);
while ( desc_list != NULL )
{
CHAR_DATA *tch;
d = (DESCRIPTOR_DATA*)desc_list->data;
tch = d->original ? d->original : d->character;
if (tch && tch->id == id)
{
extract_char(tch,TRUE);
close_socket(d);
}
desc_list = g_slist_next(desc_list);
}
g_slist_free(desc_list);
return;
}
void do_save( CHAR_DATA *ch, char *argument )
{
if ( IS_NPC(ch) )
return;
if ( ch->level < 2 )
{
send_to_char( "You must show an interest in maintaining a character.\n\r", ch );
send_to_char( "You need to kill at least 15 mobs before you can save.\n\r", ch );
return;
}
//Moved to allow player controlled backups
//save_char_obj_backup( ch );
save_char_obj( ch );
send_to_char( "Saved.\n\r", ch );
send_to_char("You might wanna backup your character, type {Rpbackup{x.\n\r",ch);
return;
}
void do_pbackup( CHAR_DATA *ch, char *argument )
{
if ( IS_NPC(ch) )
return;
if ( ch->level < 2 )
{
send_to_char( "You must show an interest in maintaining a character.\n\r", ch );
send_to_char( "You need to kill at least 15 mobs before you can backup.\n\r", ch );
return;
}
save_char_obj_backup( ch );
send_to_char( "Player Backed up.\n\r", ch );
return;
}
void do_autosave( CHAR_DATA *ch, char *argument )
{
if ( IS_NPC(ch) )
return;
if ( ch->level < 2 )
{
send_to_char( "You must show an interest in maintaining a character.\n\r", ch );
send_to_char( "You need to kill at least 15 mobs before you can save.\n\r", ch );
return;
}
save_char_obj( ch );
return;
}
void do_follow( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Follow whom?\n\r", ch );
return;
}
if ( ( victim = get_char_room( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( IS_AFFECTED(ch, AFF_CHARM) && ch->master != NULL )
{
act( "But you'd rather follow $N!", ch, NULL, ch->master, TO_CHAR );
return;
}
if ( victim == ch )
{
if ( ch->master == NULL )
{
send_to_char( "You already follow yourself.\n\r", ch );
return;
}
stop_follower( ch );
return;
}
if ( ch->master != NULL )
stop_follower( ch );
add_follower( ch, victim );
return;
}
void add_follower( CHAR_DATA *ch, CHAR_DATA *master )
{
if ( ch->master != NULL )
{
bug( "Add_follower: non-null master.", 0 );
return;
}
ch->master = master;
ch->leader = NULL;
if ( can_see( master, ch ) )
act( "$n now follows you.", ch, NULL, master, TO_VICT );
act( "You now follow $N.", ch, NULL, master, TO_CHAR );
return;
}
void stop_follower( CHAR_DATA *ch )
{
if ( ch->master == NULL )
{
bug( "Stop_follower: null master.", 0 );
return;
}
if ( IS_AFFECTED(ch, AFF_CHARM) )
{
REMOVE_BIT( ch->affected_by, AFF_CHARM );
affect_strip( ch, gsn_charm_person );
}
if ( can_see( ch->master, ch ) )
act( "$n stops following you.", ch, NULL, ch->master, TO_VICT );
act( "You stop following $N.", ch, NULL, ch->master, TO_CHAR );
ch->master = NULL;
ch->leader = NULL;
return;
}
void die_follower( CHAR_DATA *ch )
{
CHAR_DATA *fch;
if ( ch->master != NULL )
stop_follower( ch );
ch->leader = NULL;
for ( fch = char_list; fch != NULL; fch = fch->next )
{
if ( fch->master == ch )
stop_follower( fch );
if ( fch->leader == ch )
fch->leader = fch;
}
mudsetting->last_proc_logged = 2;
return;
}
bool check_illegal_kill(CHAR_DATA *ch, char *argument)
{
CHAR_DATA *victim;
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char buf[MAX_INPUT_LENGTH];
char *arg_cpy;
arg_cpy = buf;
str_cpy(buf,argument);
arg_cpy = one_argument(arg_cpy,arg1);
arg_cpy = one_argument(arg_cpy,arg2);
if (arg2 == '\0')
return FALSE;
if (str_cmp(arg1,"kill") && str_cmp(arg1,"k") && str_cmp(arg1,"ki") && str_cmp(arg1,"kil"))
return FALSE;
if ((victim = get_char_room(ch,arg2)) == NULL)
return FALSE;
if (victim->level < 3)
return TRUE;
return FALSE;
}
void do_order( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
CHAR_DATA *victim = NULL;
CHAR_DATA *och;
CHAR_DATA *och_next;
bool found;
bool fAll;
argument = one_argument( argument, arg );
one_argument(argument,arg2);
if (!str_cmp(arg2,"delete") || !str_cmp(arg2,"consent") || !str_cmp(arg2,"train")
|| !str_cmp(arg2,"gift") || !str_cmp(arg2,"nosum") || !str_cmp(arg2,"alias")
|| !str_cmp(arg2,"mob") || !str_cmp(arg2,"mount")
|| !str_cmp(arg2,"quit") || !str_cmp(arg2,"call"))
{
send_to_char("That will NOT be done.\n\r",ch);
return;
}
if ( arg[0] == '\0' || argument[0] == '\0' )
{
send_to_char( "Order whom to do what?\n\r", ch );
return;
}
if (!check_dumbshit(arg2))
{
send_to_char( "I think not.\n\r", ch );
return;
}
if (is_inpref(arg2,"|quit*escape*dissolve*greet*meet*garou*vampire*mage*trait*throw*token*zuluform*serpentis*change*mist*essence*train*rem*del*cons*drop*gift*claim*consent*meet*greet*propose*vampi*ma*maj*sid*side*reca*/*ha*hav*"))
{
send_to_char( "I think not.\n\r", ch );
return;
}
if ( IS_AFFECTED( ch, AFF_CHARM ) )
{
send_to_char( "You feel like taking, not giving, orders.\n\r", ch );
return;
}
if (check_illegal_kill(ch,argument))
{
send_to_char("Your ordering someone to kill a mortal? I think not!\n\r",ch);
return;
}
if ( !str_cmp( arg, "all" ) )
{
fAll = TRUE;
}
else
{
fAll = FALSE;
if ( ( victim = get_char_room( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if (IS_IMMORTAL(victim))
return;
if ( victim == ch )
{
send_to_char( "Aye aye, right away!\n\r", ch );
return;
}
if ( (!IS_AFFECTED(victim, AFF_CHARM) || victim->master != ch)
&& !(IS_CLASS(ch, CLASS_VAMPIRE) && IS_CLASS(victim, CLASS_VAMPIRE) )
&& !(IS_PET(victim) && ch == victim->pet_master))
{
if (IS_SET(ch->act,ACT_ANIMAL) || !IS_ADDED(ch, ADDED_ANIMAL_MASTER))
{
send_to_char( "Do it yourself!\n\r", ch );
return;
}
}
/*
if ( IS_CLASS(ch, CLASS_VAMPIRE) && IS_CLASS(victim, CLASS_VAMPIRE)
&& ((ch->pcdata->stats[UNI_GEN] > victim->pcdata->stats[UNI_GEN]) || str_cmp(ch->clan,victim->clan)))
{
act( "$N ignores your order.", ch, NULL, victim, TO_CHAR );
act( "You ignore $n's order.", ch, NULL, victim, TO_VICT );
return;
}
*/
if ( IS_CLASS(ch, CLASS_VAMPIRE) && IS_CLASS(victim, CLASS_VAMPIRE)
&& ((ch->pcdata->stats[UNI_GEN] != 2) || (ch->clan != victim->clan)))
{
act( "$N ignores your order.", ch, NULL, victim, TO_CHAR );
act( "You ignore $n's order.", ch, NULL, victim, TO_VICT );
return;
}
}
found = FALSE;
for ( och = ch->in_room->people; och != NULL; och = och_next )
{
och_next = och->next_in_room;
if ( och == ch ) continue;
if (IS_IMMORTAL(och))
continue;
/*
if ((IS_AFFECTED(och, AFF_CHARM)
&& och->master == ch
&& ( fAll || och == victim ) )
|| (ch->pcdata->stats[UNI_GEN] < och->pcdata->stats[UNI_GEN] && (fAll || och == victim) &&
!str_cmp(ch->clan,och->clan)))
{
found = TRUE;
act( "$n orders you to '$t'.", ch, argument, och, TO_VICT );
interpret( och, argument );
}
*/
if (IS_NPC(och)
&& IS_SET(och->act,ACT_ANIMAL)
&& IS_ADDED(ch, ADDED_ANIMAL_MASTER)
&& och->level < 50
&& och == victim )
{
found = TRUE;
act( "$n asks you to '$t'.", ch, argument, och, TO_VICT );
if (IS_NPC(och)) SET_BIT(och->act, ACT_COMMANDED);
interpret( och, argument );
if (IS_NPC(och)) REMOVE_BIT(och->act, ACT_COMMANDED);
WAIT_STATE(ch,12);
WAIT_STATE(och,12);
}
if (IS_NPC(och)
&& IS_PET(och)
&& och == victim
&& och->pet_master == ch )
{
found = TRUE;
if (IS_NPC(och)) SET_BIT(och->act, ACT_COMMANDED);
interpret( och, argument );
if (IS_NPC(och)) REMOVE_BIT(och->act, ACT_COMMANDED);
}
if ((IS_AFFECTED(och, AFF_CHARM)
&& och->master == ch
&& ( fAll || och == victim )))
{
found = TRUE;
act( "$n orders you to '$t'.", ch, argument, och, TO_VICT );
interpret( och, argument );
WAIT_STATE(och,12);
WAIT_STATE(ch,12);
}
if ( !IS_NPC(ch) && !IS_NPC(och) && (fAll || och == victim)
&& IS_CLASS(ch, CLASS_VAMPIRE) && IS_CLASS(och, CLASS_VAMPIRE)
&& ch->pcdata->stats[UNI_GEN] < och->pcdata->stats[UNI_GEN] && (ch->clan != och->clan) )
{
found = TRUE;
act( "$n orders you to '$t'.", ch, argument, och, TO_VICT );
interpret( och, argument );
WAIT_STATE(och,12);
WAIT_STATE(ch,12);
}
}
if ( found )
send_to_char( "Ok.\n\r", ch );
else
send_to_char( "You have no followers here.\n\r", ch );
return;
}
void do_group( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *victim;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
CHAR_DATA *gch;
CHAR_DATA *leader;
leader = (ch->leader != NULL) ? ch->leader : ch;
sprintf( buf, "%s's group:\n\r", PERS(leader, ch) );
send_to_char( buf, ch );
for ( gch = char_list; gch != NULL; gch = gch->next )
{
if ( is_same_group( gch, ch ) )
{
sprintf( buf,
"[%-16s] %6d/%6d hp %6d/%6d mana %6d/%6d mv %5d xp\n\r",
capitalize( PERS(gch, ch) ),
gch->hit, gch->max_hit,
gch->mana, gch->max_mana,
gch->move, gch->max_move,
gch->exp );
send_to_char( buf, ch );
}
}
return;
}
if ( ( victim = get_char_room( ch, arg ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
if ( ch->master != NULL || ( ch->leader != NULL && ch->leader != ch ) )
{
send_to_char( "But you are following someone else!\n\r", ch );
return;
}
if ( victim->master != ch && ch != victim )
{
act( "$N isn't following you.", ch, NULL, victim, TO_CHAR );
return;
}
/* Disallow inter-racial */
// if (((IS_CLASS(ch, CLASS_VAMPIRE)) && (IS_CLASS(victim, CLASS_WEREWOLF))) ||
// ((IS_CLASS(ch, CLASS_WEREWOLF)) && (IS_CLASS(victim, CLASS_VAMPIRE))))
if ( ch->creature != victim->creature )
{
send_to_char("Try grouping with your own class.\n\r",ch);
return;
}
if ( IS_AVATAR(ch) && !IS_AVATAR(victim))
{
send_to_char("Read policy #6 jack.\n\r",ch);
return;
}
if ( !IS_AVATAR(ch) && IS_AVATAR(victim))
{
send_to_char("Read policy #6 jack.\n\r",ch);
return;
}
if ( is_same_group( victim, ch ) && ch != victim )
{
victim->leader = NULL;
act( "$n removes $N from $s group.", ch, NULL, victim, TO_NOTVICT );
act( "$n removes you from $s group.", ch, NULL, victim, TO_VICT );
act( "You remove $N from your group.", ch, NULL, victim, TO_CHAR );
return;
}
victim->leader = ch;
act( "$N joins $n's group.", ch, NULL, victim, TO_NOTVICT );
act( "You join $n's group.", ch, NULL, victim, TO_VICT );
act( "$N joins your group.", ch, NULL, victim, TO_CHAR );
return;
}
/*
* 'Split' originally by Gnort, God of Chaos.
*/
void do_split( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
char arg[MAX_INPUT_LENGTH];
CHAR_DATA *gch;
int members;
int amount;
int share;
int extra;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Split how much?\n\r", ch );
return;
}
amount = atoi( arg );
if ( amount < 0 )
{
send_to_char( "Your group wouldn't like that.\n\r", ch );
return;
}
if ( amount == 0 )
{
send_to_char( "You hand out zero coins, but no one notices.\n\r", ch );
return;
}
if ( ch->gold < amount )
{
send_to_char( "You don't have that much gold.\n\r", ch );
return;
}
members = 0;
for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room )
{
if ( is_same_group( gch, ch ) )
members++;
}
if ( members < 2 )
{
send_to_char( "Just keep it all.\n\r", ch );
return;
}
share = amount / members;
extra = amount % members;
if ( share == 0 )
{
send_to_char( "Don't even bother, cheapskate.\n\r", ch );
return;
}
ch->gold -= amount;
ch->gold += share + extra;
sprintf( buf,
"You split %d gold coins. Your share is %d gold coins.\n\r",
amount, share + extra );
send_to_char( buf, ch );
sprintf( buf, "$n splits %d gold coins. Your share is %d gold coins.",
amount, share );
for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room )
{
if ( gch != ch && is_same_group( gch, ch ) )
{
act( buf, ch, NULL, gch, TO_VICT );
gch->gold += share;
}
}
return;
}
void do_gtell( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
char poly[MAX_STRING_LENGTH];
CHAR_DATA *gch;
GSList *desc_list = descriptor_list;
DESCRIPTOR_DATA *d;
if ( argument[0] == '\0' )
{
send_to_char( "Tell your group what?\n\r", ch );
return;
}
if ( IS_RAFFECTED(ch->in_room,ROOM_AFF_SILENT))
{
send_to_char("You can't make a sound.\n\r", ch);
return;
}
if ( IS_SET( ch->act, PLR_NO_TELL ) )
{
send_to_char( "Your message didn't get through!\n\r", ch );
return;
}
/*
* Note use of send_to_char, so gtell works on sleepers.
*/
while ( desc_list != NULL )
{
CHAR_DATA *vch;
d = (DESCRIPTOR_DATA*)desc_list->data;
vch = d->character;
if ( d->connected == CON_PLAYING
&& vch != ch
&& !IS_NPC(vch)
&& IS_SET(vch->pcdata->comm, COMM_LOG_TELLS)
&& vch->level >= LEVEL_HIGHJUDGE)
{
sprintf(poly,"{MGTELL: %s tells the group %s{x\n\r",ch->name->str,argument);
send_to_char(poly,vch);
}
desc_list = g_slist_next(desc_list);
}
g_slist_free(desc_list);
sprintf( buf, "{M%s tells the group '%s'.{x\n\r", ch->name->str, argument );
for ( gch = char_list; gch != NULL; gch = gch->next )
{
if ( is_same_group( gch, ch ) )
send_to_char( buf, gch );
}
return;
}
/*
* It is very important that this be an equivalence relation:
* (1) A ~ A
* (2) if A ~ B then B ~ A
* (3) if A ~ B and B ~ C, then A ~ C
*/
bool is_same_group( CHAR_DATA *ach, CHAR_DATA *bch )
{
if ( ach->leader != NULL ) ach = ach->leader;
if ( bch->leader != NULL ) bch = bch->leader;
if (!IS_AVATAR(ach) && IS_AVATAR(bch))
return FALSE;
if (IS_AVATAR(ach) && !IS_AVATAR(bch))
return FALSE;
return ach == bch;
}
void do_changelight(CHAR_DATA *ch, char *argument )
{
if (IS_SET(ch->in_room->room_flags, ROOM_DARK))
{
REMOVE_BIT(ch->in_room->room_flags, ROOM_DARK);
act("The room is suddenly filled with light!",ch,NULL,NULL,TO_CHAR);
act("The room is suddenly filled with light!",ch,NULL,NULL,TO_ROOM);
return;
}
SET_BIT(ch->in_room->room_flags, ROOM_DARK);
act("The lights in the room suddenly go out!",ch,NULL,NULL,TO_CHAR);
act("The lights in the room suddenly go out!",ch,NULL,NULL,TO_ROOM);
return;
}
void open_lift( CHAR_DATA *ch )
{
ROOM_INDEX_DATA *location;
int in_room;
in_room = ch->in_room->vnum;
location = get_room_index(in_room);
if (is_open(ch)) return;
act("The doors open.",ch,NULL,NULL,TO_CHAR);
act("The doors open.",ch,NULL,NULL,TO_ROOM);
move_door(ch);
if (is_open(ch)) act("The doors close.",ch,NULL,NULL,TO_ROOM);
if (!same_floor(ch,in_room)) act("The lift judders suddenly.",ch,NULL,NULL,TO_ROOM);
if (is_open(ch)) act("The doors open.",ch,NULL,NULL,TO_ROOM);
move_door(ch);
open_door(ch,FALSE);
char_from_room(ch);
char_to_room(ch,location);
open_door(ch,TRUE);
move_door(ch);
open_door(ch,TRUE);
thru_door(ch,in_room);
char_from_room(ch);
char_to_room(ch,location);
return;
}
void close_lift( CHAR_DATA *ch )
{
ROOM_INDEX_DATA *location;
int in_room;
in_room = ch->in_room->vnum;
location = get_room_index(in_room);
if (!is_open(ch)) return;
act("The doors close.",ch,NULL,NULL,TO_CHAR);
act("The doors close.",ch,NULL,NULL,TO_ROOM);
open_door(ch,FALSE);
move_door(ch);
open_door(ch,FALSE);
char_from_room(ch);
char_to_room(ch,location);
return;
}
void move_lift( CHAR_DATA *ch, int to_room )
{
ROOM_INDEX_DATA *location;
int in_room;
in_room = ch->in_room->vnum;
location = get_room_index(in_room);
if (is_open(ch)) act("The doors close.",ch,NULL,NULL,TO_CHAR);
if (is_open(ch)) act("The doors close.",ch,NULL,NULL,TO_ROOM);
if (!same_floor(ch,to_room)) act("The lift judders suddenly.",ch,NULL,NULL,TO_CHAR);
if (!same_floor(ch,to_room)) act("The lift judders suddenly.",ch,NULL,NULL,TO_ROOM);
move_door(ch);
open_door(ch,FALSE);
char_from_room(ch);
char_to_room(ch,location);
open_door(ch,FALSE);
thru_door(ch,to_room);
return;
}
bool same_floor( CHAR_DATA *ch, int cmp_room )
{
OBJ_DATA *obj;
OBJ_DATA *obj_next;
for ( obj = ch->in_room->contents; obj != NULL; obj = obj_next )
{
obj_next = obj->next_content;
if ( obj->item_type != ITEM_PORTAL ) continue;
if ( obj->pIndexData->vnum == 30001 ) continue;
if ( obj->value[0] == cmp_room ) return TRUE;
else return FALSE;
}
return FALSE;
}
bool is_open( CHAR_DATA *ch )
{
OBJ_DATA *obj;
OBJ_DATA *obj_next;
for ( obj = ch->in_room->contents; obj != NULL; obj = obj_next )
{
obj_next = obj->next_content;
if ( obj->item_type != ITEM_PORTAL ) continue;
if ( obj->pIndexData->vnum == 30001 ) continue;
if ( obj->value[2] == 0 ) return TRUE;
else return FALSE;
}
return FALSE;
}
void move_door( CHAR_DATA *ch )
{
OBJ_DATA *obj;
OBJ_DATA *obj_next;
ROOM_INDEX_DATA *pRoomIndex;
for ( obj = ch->in_room->contents; obj != NULL; obj = obj_next )
{
obj_next = obj->next_content;
if ( obj->item_type != ITEM_PORTAL ) continue;
if ( obj->pIndexData->vnum == 30001 ) continue;
pRoomIndex = get_room_index(obj->value[0]);
char_from_room(ch);
char_to_room(ch,pRoomIndex);
return;
}
return;
}
void thru_door( CHAR_DATA *ch, int doorexit )
{
OBJ_DATA *obj;
OBJ_DATA *obj_next;
for ( obj = ch->in_room->contents; obj != NULL; obj = obj_next )
{
obj_next = obj->next_content;
if ( obj->item_type != ITEM_PORTAL ) continue;
if ( obj->pIndexData->vnum == 30001 ) continue;
obj->value[0] = doorexit;
return;
}
return;
}
void open_door( CHAR_DATA *ch, bool be_open )
{
OBJ_DATA *obj;
OBJ_DATA *obj_next;
for ( obj = ch->in_room->contents; obj != NULL; obj = obj_next )
{
obj_next = obj->next_content;
if ( obj->item_type != ITEM_PORTAL ) continue;
if ( obj->pIndexData->vnum == 30001 ) continue;
if ( obj->value[2] == 0 && !be_open ) obj->value[2] = 3;
else if ( obj->value[2] == 3 && be_open ) obj->value[2] = 0;
return;
}
return;
}
void do_speak( CHAR_DATA *ch, char *argument )
{
char arg [MAX_INPUT_LENGTH];
char buf [MAX_INPUT_LENGTH];
argument = one_argument( argument, arg );
if (IS_NPC(ch)) return;
if (arg[0] == '\0')
{
if (IS_SPEAKING(ch,LANG_DARK))
send_to_char("You are speaking the Dark tongue.\n\r",ch);
else if (IS_SPEAKING(ch,DIA_OLDE))
send_to_char("You are speaking Olde Worlde.\n\r",ch);
else if (IS_SPEAKING(ch,DIA_BAD))
send_to_char("You are speaking very badly.\n\r",ch);
else
send_to_char("You are speaking the common language.\n\r",ch);
str_cpy(buf,"You can speak the following languages:");
strcat(buf," Common Olde Bad");
if (CAN_SPEAK(ch, LANG_DARK)) strcat(buf," Dark");
strcat(buf,".\n\r");
send_to_char(buf,ch);
return;
}
if (!str_cmp(arg,"dark"))
{
if (!CAN_SPEAK(ch,LANG_DARK))
{
send_to_char("You cannot speak the Dark tongue.\n\r",ch);
return;
}
if (IS_SPEAKING(ch,LANG_DARK))
{
send_to_char("But you are already speaking the Dark tongue!\n\r",ch);
return;
}
ch->pcdata->language[0] = LANG_DARK;
send_to_char("Ok.\n\r",ch);
return;
}
else if (!str_cmp(arg,"common"))
{
if (ch->pcdata->language[0] == LANG_COMMON)
{
send_to_char("But you are already speaking the common tongue!\n\r",ch);
return;
}
ch->pcdata->language[0] = LANG_COMMON;
send_to_char("Ok.\n\r",ch);
return;
}
else if (!str_cmp(arg,"olde"))
{
if (ch->pcdata->language[0] == DIA_OLDE)
{
send_to_char("But you are already speaking Olde Worlde!\n\r",ch);
return;
}
ch->pcdata->language[0] = DIA_OLDE;
send_to_char("Ok.\n\r",ch);
return;
}
else if (!str_cmp(arg,"bad"))
{
if (ch->pcdata->language[0] == DIA_BAD)
{
send_to_char("But you are already speaking badly!\n\r",ch);
return;
}
ch->pcdata->language[0] = DIA_BAD;
send_to_char("Ok.\n\r",ch);
return;
}
else
{
str_cpy(buf,"You can speak the following languages:");
strcat(buf," Common Olde Bad");
if (CAN_SPEAK(ch, LANG_DARK)) strcat(buf," Dark");
strcat(buf,".\n\r");
send_to_char(buf,ch);
return;
}
return;
}
char *badlang( CHAR_DATA *ch, char *argument )
{
char buf [MAX_STRING_LENGTH];
char *pName;
int iSyl;
int length;
struct spk_type
{
char * old;
char * new_thing;
};
static const struct spk_type spk_table[] =
{
{ " ", " " },
{ "my name is", "i calls meself"},
{ "are not", "aint" },
{ "have", "'av" },
{ "my", "me" },
{ "hello", "oy" },
{ "hi ", "oy " },
{ "i am", "im" },
{ "it is", "tis" },
{ "the ", "da " },
{ " the", " da" },
{ "thank", "fank" },
{ "that", "dat" },
{ "with", "wiv" },
{ "they", "day" },
{ "this", "dis" },
{ "then", "den" },
{ "there", "ver" },
{ "their", "ver" },
{ "thing", "fing" },
{ "think", "fink" },
{ "was", "woz" },
{ "would", "wud" },
{ "what", "wot" },
{ "where", "weer" },
{ "when", "wen" },
{ "are", "is" },
{ "you", "ya" },
{ "your", "yer" },
{ "dead", "ded" },
{ "kill", "stomp" },
{ "food", "nosh" },
{ "blood", "blud" },
{ "vampire", "sucker" },
{ "kindred", "suckers" },
{ "fire", "hot" },
{ "dwarf", "stunty" },
{ "dwarves", "stunties" },
{ "goblin", "gobbo" },
{ "death", "def" },
{ "immune", "mune" },
{ "immunit", "munit" },
{ "childer", "nippers" },
{ "childe", "nipper" },
{ "child", "nipper" },
{ "tradition", "wassname" },
{ "generation", "batch" },
{ "founded", "made" },
{ "sired", "nipped" },
{ "sire", "dad" },
{ "lineage", "istory" },
{ "recognize", "dats" },
{ "recognize", "dats" },
{ "decapitate", "headchop" },
{ "decap", "chop" },
{ "recites", "sez" },
{ "recite", "sez" },
{ "a", "a" }, { "b", "b" }, { "c", "c" }, { "d", "d" },
{ "e", "e" }, { "f", "f" }, { "g", "g" }, { "h", "h" },
{ "i", "i" }, { "j", "j" }, { "k", "k" }, { "l", "l" },
{ "m", "m" }, { "n", "n" }, { "o", "o" }, { "p", "p" },
{ "q", "q" }, { "r", "r" }, { "s", "s" }, { "t", "t" },
{ "u", "u" }, { "v", "v" }, { "w", "w" }, { "x", "x" },
{ "y", "y" }, { "z", "z" }, { ",", "," }, { ".", "." },
{ ";", ";" }, { ":", ":" }, { "(", "(" }, { ")", ")" },
{ ")", ")" }, { "-", "-" }, { "!", "!" }, { "?", "?" },
{ "1", "1" }, { "2", "2" }, { "3", "3" }, { "4", "4" },
{ "5", "5" }, { "6", "6" }, { "7", "7" }, { "8", "8" },
{ "9", "9" }, { "0", "0" }, { "%", "%" }, { "", "" }
};
buf[0] = '\0';
if ( argument[0] == '\0' ) return argument;
for ( pName = argument; *pName != '\0'; pName += length )
{
for ( iSyl = 0; (length = strlen(spk_table[iSyl].old)) != 0; iSyl++ )
{
if ( !str_prefix( spk_table[iSyl].old, pName ) )
{
strcat( buf, spk_table[iSyl].new_thing);
break;
}
}
if ( length == 0 )
length = 1;
}
argument[0] = '\0';
str_cpy(argument,buf);
argument[0] = UPPER(argument[0]);
return argument;
}
char *oldelang( CHAR_DATA *ch, char *argument )
{
char buf [MAX_STRING_LENGTH];
char *pName;
int iSyl;
int length;
struct spk_type
{
char * old;
char * new_thing;
};
static const struct spk_type spk_table[] =
{
{ " ", " " },
{ "have", "hath" },
{ "hello", "hail" },
{ "hi ", "hail " },
{ " hi", " hail" },
{ "are", "art" },
{ "your", "thy" },
{ "you", "thou" },
{ "i think", "methinks" },
{ "do ", "doth " },
{ " do", " doth" },
{ "it was", "twas" },
{ "before", "ere" },
{ "his", "$s" },
{ "a", "a" }, { "b", "b" }, { "c", "c" }, { "d", "d" },
{ "e", "e" }, { "f", "f" }, { "g", "g" }, { "h", "h" },
{ "i", "i" }, { "j", "j" }, { "k", "k" }, { "l", "l" },
{ "m", "m" }, { "n", "n" }, { "o", "o" }, { "p", "p" },
{ "q", "q" }, { "r", "r" }, { "s", "s" }, { "t", "t" },
{ "u", "u" }, { "v", "v" }, { "w", "w" }, { "x", "x" },
{ "y", "y" }, { "z", "z" }, { ",", "," }, { ".", "." },
{ ";", ";" }, { ":", ":" }, { "(", "(" }, { ")", ")" },
{ ")", ")" }, { "-", "-" }, { "!", "!" }, { "?", "?" },
{ "1", "1" }, { "2", "2" }, { "3", "3" }, { "4", "4" },
{ "5", "5" }, { "6", "6" }, { "7", "7" }, { "8", "8" },
{ "9", "9" }, { "0", "0" }, { "%", "%" }, { "", "" }
};
buf[0] = '\0';
if ( argument[0] == '\0' ) return argument;
for ( pName = argument; *pName != '\0'; pName += length )
{
for ( iSyl = 0; (length = strlen(spk_table[iSyl].old)) != 0; iSyl++ )
{
if ( !str_prefix( spk_table[iSyl].old, pName ) )
{
strcat( buf, spk_table[iSyl].new_thing );
break;
}
}
if ( length == 0 )
length = 1;
}
argument[0] = '\0';
str_cpy(argument,buf);
argument[0] = UPPER(argument[0]);
return argument;
}
char *darktongue( CHAR_DATA *ch, char *argument )
{
char buf [MAX_STRING_LENGTH];
char *pName;
int iSyl;
int length;
struct spk_type
{
char * old;
char * new_thing;
};
static const struct spk_type spk_table[] =
{
{ " ", " " },
{ "a", "i" }, { "b", "t" }, { "c", "x" }, { "d", "j" },
{ "e", "u" }, { "f", "d" }, { "g", "k" }, { "h", "z" },
{ "i", "o" }, { "j", "s" }, { "k", "f" }, { "l", "h" },
{ "m", "b" }, { "n", "c" }, { "o", "e" }, { "p", "r" },
{ "q", "l" }, { "r", "v" }, { "s", "w" }, { "t", "q" },
{ "u", "a" }, { "v", "n" }, { "w", "y" }, { "x", "g" },
{ "y", "m" }, { "z", "p" }, { ",", "," }, { ".", "." },
{ ";", ";" }, { ":", ":" }, { "(", "(" }, { ")", ")" },
{ ")", ")" }, { "-", "-" }, { "!", "!" }, { "?", "?" },
{ "", "" }
};
buf[0] = '\0';
if ( argument[0] == '\0' ) return argument;
for ( pName = argument; *pName != '\0'; pName += length )
{
for ( iSyl = 0; (length = strlen(spk_table[iSyl].old)) != 0; iSyl++ )
{
if ( !str_prefix( spk_table[iSyl].old, pName ) )
{
strcat( buf, spk_table[iSyl].new_thing );
break;
}
}
if ( length == 0 )
length = 1;
}
argument[0] = '\0';
str_cpy(argument,buf);
argument[0] = UPPER(argument[0]);
return argument;
}
char *drunktalk( CHAR_DATA *ch, char *argument )
{
char buf [MAX_STRING_LENGTH];
char *pName;
int iSyl;
int length;
int loop;
struct spk_type
{
char * old;
char * new_thing;
};
static const struct spk_type spk_table[] =
{
{ " ", " " },
{ "is", "ish" },
{ "a", "a" }, { "b", "b" }, { "c", "c" }, { "d", "d" },
{ "e", "e" }, { "f", "f" }, { "g", "g" }, { "h", "h" },
{ "i", "i" }, { "j", "j" }, { "k", "k" }, { "l", "l" },
{ "m", "m" }, { "n", "n" }, { "o", "o" }, { "p", "p" },
{ "q", "q" }, { "r", "r" }, { "s", "s" }, { "t", "t" },
{ "u", "u" }, { "v", "v" }, { "w", "w" }, { "x", "x" },
{ "y", "y" }, { "z", "z" }, { ",", "," }, { ".", "." },
{ ";", ";" }, { ":", ":" }, { "(", "(" }, { ")", ")" },
{ ")", ")" }, { "-", "-" }, { "!", "!" }, { "?", "?" },
{ "1", "1" }, { "2", "2" }, { "3", "3" }, { "4", "4" },
{ "5", "5" }, { "6", "6" }, { "7", "7" }, { "8", "8" },
{ "9", "9" }, { "0", "0" }, { "%", "%" }, { "", "" }
};
buf[0] = '\0';
if ( argument[0] == '\0' ) return argument;
for ( pName = argument; *pName != '\0'; pName += length )
{
for ( iSyl = 0; (length = strlen(spk_table[iSyl].old)) != 0; iSyl++ )
{
if ( !str_prefix( spk_table[iSyl].old, pName ) )
{
strcat( buf, spk_table[iSyl].new_thing );
if (number_range(1,5) == 1 && str_cmp(spk_table[iSyl].new_thing," "))
strcat( buf, spk_table[iSyl].new_thing );
else if (!str_cmp(spk_table[iSyl].new_thing," "))
{
if (number_range(1,5) == 1 && strlen(buf) < MAX_INPUT_LENGTH)
strcat( buf, "*hic* " );
}
break;
}
}
if ( length == 0 )
length = 1;
}
argument[0] = '\0';
str_cpy(argument,buf);
argument[0] = UPPER(argument[0]);
for (loop = 1; loop < (int)strlen(argument); loop++ )
{
if (number_range(1,2) == 1)
argument[loop] = UPPER(argument[loop]);
}
return argument;
}
char *socialc( CHAR_DATA *ch, char *argument, char *you, char *them )
{
char buf [MAX_STRING_LENGTH];
char *pName;
int iSyl;
int length;
struct spk_type
{
char * old;
char * new_thing;
};
static const struct spk_type spk_table[] =
{
{ " ", " " },
{ "you are", "$E is" },
{ "you.", "$M." },
{ "you,", "$M," },
{ "you ", "$M " },
{ " you", " $M" },
{ "your ", "$S " },
{ " your", " $S" },
{ "yours.", "theirs." },
{ "yours,", "theirs," },
{ "yours ", "theirs " },
{ " yours", " theirs" },
{ "begins", "begin" },
{ "caresses", "caress" },
{ "gives", "give" },
{ "glares", "glare" },
{ "grins", "grin" },
{ "licks", "lick" },
{ "looks", "look" },
{ "loves", "love" },
{ "plunges", "plunge" },
{ "presses", "press" },
{ "pulls", "pull" },
{ "runs", "run" },
{ "slaps", "slap" },
{ "slides", "slide" },
{ "smashes", "smash" },
{ "squeezes", "squeeze" },
{ "stares", "stare" },
{ "sticks", "stick" },
{ "strokes", "stroke" },
{ "tugs", "tug" },
{ "thinks", "think" },
{ "thrusts", "thrust" },
{ "whistles", "whistle" },
{ "wraps", "wrap" },
{ "winks", "wink" },
{ "wishes", "wish" },
{ " winks", " wink" },
{ " his", " your" },
{ "his ", "your " },
{ " her", " your" },
{ "her ", "your " },
{ " him", " your" },
{ "him ", "your " },
{ "the", "the" },
{ " he", " you" },
{ "he ", "you " },
{ " she", " you" },
{ "she ", "you " },
{ "a", "a" }, { "b", "b" }, { "c", "c" }, { "d", "d" },
{ "e", "e" }, { "f", "f" }, { "g", "g" }, { "h", "h" },
{ "i", "i" }, { "j", "j" }, { "k", "k" }, { "l", "l" },
{ "m", "m" }, { "n", "n" }, { "o", "o" }, { "p", "p" },
{ "q", "q" }, { "r", "r" }, { "s", "s" }, { "t", "t" },
{ "u", "u" }, { "v", "v" }, { "w", "w" }, { "x", "x" },
{ "y", "y" }, { "z", "z" }, { ",", "," }, { ".", "." },
{ ";", ";" }, { ":", ":" }, { "(", "(" }, { ")", ")" },
{ ")", ")" }, { "-", "-" }, { "!", "!" }, { "?", "?" },
{ "1", "1" }, { "2", "2" }, { "3", "3" }, { "4", "4" },
{ "5", "5" }, { "6", "6" }, { "7", "7" }, { "8", "8" },
{ "9", "9" }, { "0", "0" }, { "%", "%" }, { "", "" }
};
buf[0] = '\0';
if ( argument[0] == '\0' ) return argument;
for ( pName = argument; *pName != '\0'; pName += length )
{
for ( iSyl = 0; (length = strlen(spk_table[iSyl].old)) != 0; iSyl++ )
{
if ( !str_prefix( spk_table[iSyl].old, pName ) )
{
strcat( buf, spk_table[iSyl].new_thing );
break;
}
}
if ( length == 0 )
length = 1;
}
argument[0] = '\0';
str_cpy(argument,buf);
argument[0] = UPPER(argument[0]);
return argument;
}
char *socialv( CHAR_DATA *ch, char *argument, char *you, char *them )
{
char buf [MAX_STRING_LENGTH];
char *pName;
int iSyl;
int length;
struct spk_type
{
char * old;
char * new_thing;
};
static const struct spk_type spk_table[] =
{
{ " ", " " },
{ " his", " $s" },
{ "his ", "$s " },
{ " her", " $s" },
{ "her ", "$s " },
{ " him", " $m" },
{ "him ", "$m " },
{ " he", " $e" },
{ "he ", "$e " },
{ " she", " $e" },
{ "she ", "$e " },
{ "a", "a" }, { "b", "b" }, { "c", "c" }, { "d", "d" },
{ "e", "e" }, { "f", "f" }, { "g", "g" }, { "h", "h" },
{ "i", "i" }, { "j", "j" }, { "k", "k" }, { "l", "l" },
{ "m", "m" }, { "n", "n" }, { "o", "o" }, { "p", "p" },
{ "q", "q" }, { "r", "r" }, { "s", "s" }, { "t", "t" },
{ "u", "u" }, { "v", "v" }, { "w", "w" }, { "x", "x" },
{ "y", "y" }, { "z", "z" }, { ",", "," }, { ".", "." },
{ ";", ";" }, { ":", ":" }, { "(", "(" }, { ")", ")" },
{ ")", ")" }, { "-", "-" }, { "!", "!" }, { "?", "?" },
{ "1", "1" }, { "2", "2" }, { "3", "3" }, { "4", "4" },
{ "5", "5" }, { "6", "6" }, { "7", "7" }, { "8", "8" },
{ "9", "9" }, { "0", "0" }, { "%", "%" }, { "", "" }
};
buf[0] = '\0';
if ( argument[0] == '\0' ) return argument;
for ( pName = argument; *pName != '\0'; pName += length )
{
for ( iSyl = 0; (length = strlen(spk_table[iSyl].old)) != 0; iSyl++ )
{
if ( !str_prefix( spk_table[iSyl].old, pName ) )
{
strcat( buf, spk_table[iSyl].new_thing);
break;
}
}
if ( length == 0 )
length = 1;
}
argument[0] = '\0';
str_cpy(argument,buf);
argument[0] = UPPER(argument[0]);
return argument;
}
char *socialn( CHAR_DATA *ch, char *argument, char *you, char *them )
{
char buf [MAX_STRING_LENGTH];
char *pName;
int iSyl;
int length;
struct spk_type
{
char * old;
char * new_thing;
};
static const struct spk_type spk_table[] =
{
{ " ", " " },
{ "you are", "$N is" },
{ "you.", "$N." },
{ "you,", "$N," },
{ "you ", "$N " },
{ " you", " $N" },
{ "your.", "$N's." },
{ "your,", "$N's," },
{ "your ", "$N's " },
{ " your", " $N's" },
{ "yourself", "$Mself" },
{ " his", " $s" },
{ "his ", "$s " },
{ " her", " $s" },
{ "her ", "$s " },
{ " him", " $m" },
{ "him ", "$m " },
{ " he", " $e" },
{ "he ", "$e " },
{ " she", " $e" },
{ "she ", "$e " },
{ "a", "a" }, { "b", "b" }, { "c", "c" }, { "d", "d" },
{ "e", "e" }, { "f", "f" }, { "g", "g" }, { "h", "h" },
{ "i", "i" }, { "j", "j" }, { "k", "k" }, { "l", "l" },
{ "m", "m" }, { "n", "n" }, { "o", "o" }, { "p", "p" },
{ "q", "q" }, { "r", "r" }, { "s", "s" }, { "t", "t" },
{ "u", "u" }, { "v", "v" }, { "w", "w" }, { "x", "x" },
{ "y", "y" }, { "z", "z" }, { ",", "," }, { ".", "." },
{ ";", ";" }, { ":", ":" }, { "(", "(" }, { ")", ")" },
{ ")", ")" }, { "-", "-" }, { "!", "!" }, { "?", "?" },
{ "1", "1" }, { "2", "2" }, { "3", "3" }, { "4", "4" },
{ "5", "5" }, { "6", "6" }, { "7", "7" }, { "8", "8" },
{ "9", "9" }, { "0", "0" }, { "%", "%" }, { "", "" }
};
buf[0] = '\0';
if ( argument[0] == '\0' ) return argument;
for ( pName = argument; *pName != '\0'; pName += length )
{
for ( iSyl = 0; (length = strlen(spk_table[iSyl].old)) != 0; iSyl++ )
{
if ( !str_prefix( spk_table[iSyl].old, pName ) )
{
strcat( buf, spk_table[iSyl].new_thing );
break;
}
}
if ( length == 0 )
length = 1;
}
argument[0] = '\0';
str_cpy(argument,buf);
argument[0] = UPPER(argument[0]);
return argument;
}
/* RT code to delete yourself
*/
void do_delet( CHAR_DATA *ch, char *argument)
{
send_to_char("You must type the full command to delete yourself.\n\r",ch);
}
void do_delete( CHAR_DATA *ch, char *argument)
{
char strsave[MAX_INPUT_LENGTH];
if (IS_NPC(ch))
return;
if (ch->pcdata->confirm_delete)
{
if (argument[0] != '\0')
{
send_to_char("Delete status removed.\n\r",ch);
ch->pcdata->confirm_delete = FALSE;
return;
}
else
{
sprintf( strsave, "%s%s", PLAYER_DIR, capitalize( ch->name->str ) );
sprintf( log_buf, "%s has deleted.", ch->name->str );
log_string2( log_buf );
logchan(log_buf, NULL, NULL,WIZ_SITES,0, LEVEL_QUESTMAKER);
stop_fighting(ch,TRUE);
do_quit(ch,"");
unlink(strsave);
return;
}
}
if (argument[0] != '\0')
{
send_to_char("Just type delete. No argument.\n\r",ch);
return;
}
send_to_char("Type delete again to confirm this command.\n\r",ch);
send_to_char("{rWARNING{x: this command is irreversible.\n\r",ch);
send_to_char("Typing delete with an argument will undo delete status.\n\r",
ch);
ch->pcdata->confirm_delete = TRUE;
sprintf( log_buf, "%s s contemplating deletion.", ch->name->str );
log_string2( log_buf );
logchan(log_buf, NULL, NULL,WIZ_SITES,0, LEVEL_QUESTMAKER);
}
void playwave_toroom( CHAR_DATA *ch, int wavnum )
{
CHAR_DATA *wch;
char buf[MAX_STRING_LENGTH];
if ( ch == NULL )
return;
for ( wch = ch->in_room->people; wch != NULL; wch = wch->next_in_room )
{
if ( IS_SET( wch->deaf, CHANNEL_MSP) )
{
sprintf(buf,"\n\r!!SOUND(%s T=sound L=1 V=100 U=http://%s%s )\n\r",msp_general_table[wavnum].msp_string, msp_general_table[wavnum].msp_server, msp_general_table[wavnum].msp_dirinfo);
send_to_char( buf, wch );
}
}
return;
}
void playwave_toch( CHAR_DATA *ch, int wavnum )
{
char buf[MAX_STRING_LENGTH];
if ( ch == NULL )
return;
if ( IS_SET( ch->deaf, CHANNEL_MSP) )
{
sprintf(buf,"\n\r!!SOUND(%s T=sound L=1 V=100 U=http://%s%s )\n\r",msp_general_table[wavnum].msp_string, msp_general_table[wavnum].msp_server, msp_general_table[wavnum].msp_dirinfo);
send_to_char( buf, ch );
}
return;
}
void do_playwave( CHAR_DATA *ch, char *argument)
{
int wavnum;
DESCRIPTOR_DATA *d;
char buf[MAX_STRING_LENGTH];
GSList *desc_list = descriptor_list;
if ( argument[0] == '\0' && !is_number(argument) )
{
send_to_char( "Syntax: Playwave (number of wave in the general table)\n\r", ch );
return;
}
wavnum = atoi( argument );
if ( wavnum >= MAX_GENERALWAV )
return;
while ( desc_list != NULL )
{
d = (DESCRIPTOR_DATA*)desc_list->data;
if ( d->connected == CON_PLAYING &&
IS_SET(d->character->deaf, CHANNEL_MSP) )
{
sprintf(buf,"\n\r!!SOUND(%s T=sound L=1 V=100 U=http://%s%s )\n\r",msp_general_table[wavnum].msp_string, msp_general_table[wavnum].msp_server, msp_general_table[wavnum].msp_dirinfo);
send_to_char( buf, d->character );
}
desc_list = g_slist_next(desc_list);
}
g_slist_free(desc_list);
return;
}
void do_vote_tally( CHAR_DATA *ch, char *argument )
{
DESCRIPTOR_DATA *d;
int yes_count = 0;
int no_count = 0;
int undecided_count = 0;
char buf[MAX_STRING_LENGTH];
GSList *desc_list = descriptor_list;
while ( desc_list != NULL )
{
d = (DESCRIPTOR_DATA*)desc_list->data;
if ( d->connected == CON_PLAYING )
{
switch (d->character->pcdata->vote)
{
default:
undecided_count++;
break;
case 0:
undecided_count++;
break;
case 1:
no_count++;
break;
case 2:
yes_count++;
break;
}
}
desc_list = g_slist_next(desc_list);
}
g_slist_free(desc_list);
sprintf(buf,"Undecided: %d No:%d Yes: %d\n\r",undecided_count,no_count,yes_count);
send_to_char( buf, ch );
return;
}
void do_vote_clear( CHAR_DATA *ch, char *argument )
{
DESCRIPTOR_DATA *d;
GSList *desc_list = descriptor_list;
while ( desc_list != NULL )
{
d = (DESCRIPTOR_DATA*)desc_list->data;
d->character->pcdata->vote = 0;
desc_list = g_slist_next(desc_list);
}
g_slist_free(desc_list);
send_to_char("Votes cleared.\n\r",ch);
return;
}
void do_vote( CHAR_DATA *ch, char *argument )
{
char arg [MAX_INPUT_LENGTH];
argument = one_argument( argument, arg );
if (IS_NPC(ch))
{
send_to_char("NPC's can't vote on issues.. SHOO.\n\r",ch);
return;
}
if (!str_cmp(arg,"no"))
{
if (ch->pcdata->vote != 0)
{
send_to_char("You have already voted, you can't change your mind.\n\r",ch);
return;
}
ch->pcdata->vote = 1;
send_to_char("Your vote has been noted.\n\r",ch);
return;
}
if (!str_cmp(arg,"yes"))
{
if (ch->pcdata->vote != 0)
{
send_to_char("You have already voted, you can't change your mind.\n\r",ch);
return;
}
send_to_char("Your vote has been noted.\n\r",ch);
ch->pcdata->vote = 2;
return;
}
if (!str_cmp(arg,"tally"))
{
if (IS_IMMORTAL(ch))
{
do_vote_tally(ch,"something");
return;
}
}
if (!str_cmp(arg,"clear"))
{
if (IS_IMMORTAL(ch))
{
do_vote_clear(ch,"something");
return;
}
}
send_to_char("Syntax: Vote (yes/no) \n\r",ch);
return;
}
void check_deadbeat( CHAR_DATA *ch )
{
OBJ_DATA *obj;
int icount,total_exp = 0,total_qps = 0;
char buf[MAX_STRING_LENGTH];
for (obj = ch->carrying; obj != NULL;obj = obj->next_content)
{
for (icount = 0; icount < MAX_ART; icount++)
{
if ( obj->pIndexData->vnum == rent_table[icount].obj_vnum )
{
sprintf(buf,"To store %s, it will cost %d exp and %d qpts per day.\n\r",obj->short_descr->str,rent_table[icount].exp_cost,rent_table[icount].qp_cost);
send_to_char(buf,ch);
total_exp = total_exp + rent_table[icount].exp_cost;
total_qps = total_qps + rent_table[icount].qp_cost;
}
}
}
if ( total_exp == 0 )
{
send_to_char("You don't have any artifacts.\n\r",ch);
return;
}
if ( ch->exp < total_exp)
{
send_to_char("You cannot afford the experience rental for the artifacts you have.\n\r",ch);
return;
}
if ( ch->pcdata->quest < total_qps)
{
send_to_char("You cannot afford the Quest point rental for the artifacts you have.\n\r",ch);
return;
}
return;
}
void do_rent( CHAR_DATA *ch, char *arument)
{
check_deadbeat(ch);
}
void do_pet(CHAR_DATA *ch, char *argument)
{
check_social(ch,"pat",argument);
return;
}
void do_anon_desc(CHAR_DATA *ch, char *argument){
char buf[MSL];
if (IS_NPC(ch)){
send_to_char("Not on NPC's shoo!\n\r",ch);
return;
}
if (strlen(argument) > 80) {
send_to_char("The description cannot be longer then 80 characters.\n\r",ch);
return;
}
if (strlen(argument) < 5){
send_to_char("Your description must be at least more then 5 charactters.\n\r",ch);
return;
}
if (argument[0] == '\0') {
send_to_char("Syntax: anondesc (desciprtion you want people to see)\n\r",ch);
send_to_char("If you want to reset your anondesc use {Ranondesc default{x\n\r",ch);
send_to_char("Current Description\n\r",ch);
sprintf(buf,"%s",ch->pcdata->anon_desc->str);
send_to_char(buf,ch);
return;
}
if (strcmp(argument,"default")){
ch->pcdata->anon_desc = g_string_assign(ch->pcdata->anon_desc,"");
}
ch->pcdata->anon_desc = g_string_assign(ch->pcdata->anon_desc,argument);
return;
}