/* * RAM $Id: act_comm.c 82 2009-01-14 07:17:30Z kaervos $ */ /*************************************************************************** * 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. * **************************************************************************/ /*************************************************************************** * ROM 2.4 is copyright 1993-1998 Russ Taylor * * ROM has been brought to you by the ROM consortium * * Russ Taylor (rtaylor@hypercube.org) * * Gabrielle Taylor (gtaylor@hypercube.org) * * Brian Moore (zump@rom.org) * * By using this code, you have agreed to follow the terms of the * * ROM license, in the file Rom24/doc/rom.license * ***************************************************************************/ #include <sys/types.h> #include <sys/time.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <time.h> #include "merc.h" #include "strings.h" #include "random.h" #include "tables.h" #include "db.h" #include "interp.h" #include "magic.h" #include "act.h" /* RT code to delete yourself */ void do_delet( CHAR_DATA *ch, const char *argument ) { ch_printf( ch, "You must type the full command to delete yourself.\r\n" ); } void do_delete( CHAR_DATA *ch, const char *argument ) { char strsave[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0"; if ( IS_NPC( ch ) ) return; if ( ch->pcdata->confirm_delete ) { if ( argument[0] != '\0' ) { ch_printf( ch, "Delete status removed.\r\n" ); ch->pcdata->confirm_delete = false; return; } else { sprintf( strsave, "%s/%c/%s", PLAYER_DIR, LOWER( ch->name[0] ), capitalize( ch->name ) ); wiznet( "$N turns $Mself into line noise.", ch, NULL, 0, 0, 0 ); stop_fighting( ch, true ); do_function( ch, &do_quit, "" ); unlink( strsave ); return; } } if ( argument[0] != '\0' ) { ch_printf( ch, "Just type delete. No argument.\r\n" ); return; } ch_printf( ch, "Type delete again to confirm this command.\r\n" ); ch_printf( ch, "WARNING: this command is irreversible.\r\n" ); ch_printf( ch, "Typing delete with an argument will undo delete status.\r\n" ); ch->pcdata->confirm_delete = true; wiznet( "$N is contemplating deletion.", ch, NULL, 0, 0, get_trust( ch ) ); } /* RT code to display channel status */ void do_channels( CHAR_DATA *ch, const char *argument ) { /* * lists all channels and their status */ ch_printf( ch, " channel status\r\n" ); ch_printf( ch, "---------------------\r\n" ); ch_printf( ch, "gossip " ); if ( !IS_SET( ch->comm, COMM_NOGOSSIP ) ) ch_printf( ch, "ON\r\n" ); else ch_printf( ch, "OFF\r\n" ); ch_printf( ch, "auction " ); if ( !IS_SET( ch->comm, COMM_NOAUCTION ) ) ch_printf( ch, "ON\r\n" ); else ch_printf( ch, "OFF\r\n" ); ch_printf( ch, "Q/A " ); if ( !IS_SET( ch->comm, COMM_NOQUESTION ) ) ch_printf( ch, "ON\r\n" ); else ch_printf( ch, "OFF\r\n" ); ch_printf( ch, "Quote " ); if ( !IS_SET( ch->comm, COMM_NOQUOTE ) ) ch_printf( ch, "ON\r\n" ); else ch_printf( ch, "OFF\r\n" ); ch_printf( ch, "grats " ); if ( !IS_SET( ch->comm, COMM_NOGRATS ) ) ch_printf( ch, "ON\r\n" ); else ch_printf( ch, "OFF\r\n" ); if ( IS_IMMORTAL( ch ) ) { ch_printf( ch, "god channel " ); if ( !IS_SET( ch->comm, COMM_NOWIZ ) ) ch_printf( ch, "ON\r\n" ); else ch_printf( ch, "OFF\r\n" ); } ch_printf( ch, "shouts " ); if ( !IS_SET( ch->comm, COMM_SHOUTSOFF ) ) ch_printf( ch, "ON\r\n" ); else ch_printf( ch, "OFF\r\n" ); ch_printf( ch, "tells " ); if ( !IS_SET( ch->comm, COMM_DEAF ) ) ch_printf( ch, "ON\r\n" ); else ch_printf( ch, "OFF\r\n" ); ch_printf( ch, "quiet mode " ); if ( IS_SET( ch->comm, COMM_QUIET ) ) ch_printf( ch, "ON\r\n" ); else ch_printf( ch, "OFF\r\n" ); if ( IS_SET( ch->comm, COMM_AFK ) ) ch_printf( ch, "You are AFK.\r\n" ); if ( IS_SET( ch->comm, COMM_SNOOP_PROOF ) ) ch_printf( ch, "You are immune to snooping.\r\n" ); if ( ch->lines != PAGELEN ) { if ( ch->lines ) { ch_printf( ch, "You display %d lines of scroll.\r\n", ch->lines + 2 ); } else ch_printf( ch, "Scroll buffering is off.\r\n" ); } if ( ch->prompt != NULL ) { ch_printf( ch, "Your current prompt is: %s\r\n", ch->prompt ); } if ( IS_SET( ch->comm, COMM_NOSHOUT ) ) ch_printf( ch, "You cannot shout.\r\n" ); if ( IS_SET( ch->comm, COMM_NOTELL ) ) ch_printf( ch, "You cannot use tell.\r\n" ); if ( IS_SET( ch->comm, COMM_NOCHANNELS ) ) ch_printf( ch, "You cannot use channels.\r\n" ); if ( IS_SET( ch->comm, COMM_NOEMOTE ) ) ch_printf( ch, "You cannot show emotions.\r\n" ); } /* RT deaf blocks out all shouts */ void do_deaf( CHAR_DATA *ch, const char *argument ) { if ( IS_SET( ch->comm, COMM_DEAF ) ) { ch_printf( ch, "You can now hear tells again.\r\n" ); REMOVE_BIT( ch->comm, COMM_DEAF ); } else { ch_printf( ch, "From now on, you won't hear tells.\r\n" ); SET_BIT( ch->comm, COMM_DEAF ); } } /* RT quiet blocks out all communication */ void do_quiet( CHAR_DATA *ch, const char *argument ) { if ( IS_SET( ch->comm, COMM_QUIET ) ) { ch_printf( ch, "Quiet mode removed.\r\n" ); REMOVE_BIT( ch->comm, COMM_QUIET ); } else { ch_printf( ch, "From now on, you will only hear says and emotes.\r\n" ); SET_BIT( ch->comm, COMM_QUIET ); } } /* afk command */ void do_afk( CHAR_DATA *ch, const char *argument ) { if ( IS_SET( ch->comm, COMM_AFK ) ) { ch_printf( ch, "AFK mode removed. Type 'replay' to see tells.\r\n" ); REMOVE_BIT( ch->comm, COMM_AFK ); } else { ch_printf( ch, "You are now in AFK mode.\r\n" ); SET_BIT( ch->comm, COMM_AFK ); } } void do_replay( CHAR_DATA *ch, const char *argument ) { if ( IS_NPC( ch ) ) { ch_printf( ch, "You can't replay.\r\n" ); return; } if ( buf_string( ch->pcdata->buffer )[0] == '\0' ) { ch_printf( ch, "You have no tells to replay.\r\n" ); return; } page_to_char( buf_string( ch->pcdata->buffer ), ch ); clear_buf( ch->pcdata->buffer ); } /* RT auction rewritten in ROM style */ void do_auction( CHAR_DATA *ch, const char *argument ) { if ( argument[0] == '\0' ) { if ( IS_SET( ch->comm, COMM_NOAUCTION ) ) { ch_printf( ch, "Auction channel is now ON.\r\n" ); REMOVE_BIT( ch->comm, COMM_NOAUCTION ); } else { ch_printf( ch, "Auction channel is now OFF.\r\n" ); SET_BIT( ch->comm, COMM_NOAUCTION ); } } else { /* * auction message sent, turn auction on if it is off */ if ( IS_SET( ch->comm, COMM_QUIET ) ) { ch_printf( ch, "You must turn off quiet mode first.\r\n" ); return; } if ( IS_SET( ch->comm, COMM_NOCHANNELS ) ) { ch_printf( ch, "The gods have revoked your channel priviliges.\r\n" ); return; } REMOVE_BIT( ch->comm, COMM_NOAUCTION ); channel_speech( CHAN_AUCTION, ch, argument, NULL ); } } /* RT chat replaced with ROM gossip */ void do_gossip( CHAR_DATA *ch, const char *argument ) { if ( argument[0] == '\0' ) { if ( IS_SET( ch->comm, COMM_NOGOSSIP ) ) { ch_printf( ch, "Gossip channel is now ON.\r\n" ); REMOVE_BIT( ch->comm, COMM_NOGOSSIP ); } else { ch_printf( ch, "Gossip channel is now OFF.\r\n" ); SET_BIT( ch->comm, COMM_NOGOSSIP ); } } else { /* * gossip message sent, turn gossip on if it isn't already */ if ( IS_SET( ch->comm, COMM_QUIET ) ) { ch_printf( ch, "You must turn off quiet mode first.\r\n" ); return; } if ( IS_SET( ch->comm, COMM_NOCHANNELS ) ) { ch_printf( ch, "The gods have revoked your channel priviliges.\r\n" ); return; } REMOVE_BIT( ch->comm, COMM_NOGOSSIP ); channel_speech( CHAN_GOSSIP, ch, argument, NULL ); } } void do_grats( CHAR_DATA *ch, const char *argument ) { if ( argument[0] == '\0' ) { if ( IS_SET( ch->comm, COMM_NOGRATS ) ) { ch_printf( ch, "Grats channel is now ON.\r\n" ); REMOVE_BIT( ch->comm, COMM_NOGRATS ); } else { ch_printf( ch, "Grats channel is now OFF.\r\n" ); SET_BIT( ch->comm, COMM_NOGRATS ); } } else { /* * grats message sent, turn grats on if it isn't already */ if ( IS_SET( ch->comm, COMM_QUIET ) ) { ch_printf( ch, "You must turn off quiet mode first.\r\n" ); return; } if ( IS_SET( ch->comm, COMM_NOCHANNELS ) ) { ch_printf( ch, "The gods have revoked your channel priviliges.\r\n" ); return; } REMOVE_BIT( ch->comm, COMM_NOGRATS ); channel_speech( CHAN_GRATS, ch, argument, NULL ); } } void do_quote( CHAR_DATA *ch, const char *argument ) { if ( argument[0] == '\0' ) { if ( IS_SET( ch->comm, COMM_NOQUOTE ) ) { ch_printf( ch, "Quote channel is now ON.\r\n" ); REMOVE_BIT( ch->comm, COMM_NOQUOTE ); } else { ch_printf( ch, "Quote channel is now OFF.\r\n" ); SET_BIT( ch->comm, COMM_NOQUOTE ); } } else { /* * quote message sent, turn quote on if it isn't already */ if ( IS_SET( ch->comm, COMM_QUIET ) ) { ch_printf( ch, "You must turn off quiet mode first.\r\n" ); return; } if ( IS_SET( ch->comm, COMM_NOCHANNELS ) ) { ch_printf( ch, "The gods have revoked your channel priviliges.\r\n" ); return; } REMOVE_BIT( ch->comm, COMM_NOQUOTE ); channel_speech( CHAN_QUOTE, ch, argument, NULL ); } } /* RT question channel */ void do_question( CHAR_DATA *ch, const char *argument ) { if ( argument[0] == '\0' ) { if ( IS_SET( ch->comm, COMM_NOQUESTION ) ) { ch_printf( ch, "Q/A channel is now ON.\r\n" ); REMOVE_BIT( ch->comm, COMM_NOQUESTION ); } else { ch_printf( ch, "Q/A channel is now OFF.\r\n" ); SET_BIT( ch->comm, COMM_NOQUESTION ); } } else { /* * question sent, turn Q/A on if it isn't already */ if ( IS_SET( ch->comm, COMM_QUIET ) ) { ch_printf( ch, "You must turn off quiet mode first.\r\n" ); return; } if ( IS_SET( ch->comm, COMM_NOCHANNELS ) ) { ch_printf( ch, "The gods have revoked your channel priviliges.\r\n" ); return; } REMOVE_BIT( ch->comm, COMM_NOQUESTION ); channel_speech( CHAN_QUESTION, ch, argument, NULL ); } } /* RT answer channel - uses same line as questions */ void do_answer( CHAR_DATA *ch, const char *argument ) { if ( argument[0] == '\0' ) { if ( IS_SET( ch->comm, COMM_NOQUESTION ) ) { ch_printf( ch, "Q/A channel is now ON.\r\n" ); REMOVE_BIT( ch->comm, COMM_NOQUESTION ); } else { ch_printf( ch, "Q/A channel is now OFF.\r\n" ); SET_BIT( ch->comm, COMM_NOQUESTION ); } } else { /* * answer sent, turn Q/A on if it isn't already */ if ( IS_SET( ch->comm, COMM_QUIET ) ) { ch_printf( ch, "You must turn off quiet mode first.\r\n" ); return; } if ( IS_SET( ch->comm, COMM_NOCHANNELS ) ) { ch_printf( ch, "The gods have revoked your channel priviliges.\r\n" ); return; } REMOVE_BIT( ch->comm, COMM_NOQUESTION ); channel_speech( CHAN_ANSWER, ch, argument, NULL ); } } /* clan channels */ void do_clantalk( CHAR_DATA *ch, const char *argument ) { if ( !is_clan( ch ) || clan_table[ch->clan].independent ) { ch_printf( ch, "You aren't in a clan.\r\n" ); return; } if ( argument[0] == '\0' ) { if ( IS_SET( ch->comm, COMM_NOCLAN ) ) { ch_printf( ch, "Clan channel is now ON\r\n" ); REMOVE_BIT( ch->comm, COMM_NOCLAN ); } else { ch_printf( ch, "Clan channel is now OFF\r\n" ); SET_BIT( ch->comm, COMM_NOCLAN ); } return; } if ( IS_SET( ch->comm, COMM_NOCHANNELS ) ) { ch_printf( ch, "The gods have revoked your channel priviliges.\r\n" ); return; } REMOVE_BIT( ch->comm, COMM_NOCLAN ); channel_speech( CHAN_CLAN, ch, argument, NULL ); return; } void do_immtalk( CHAR_DATA *ch, const char *argument ) { if ( argument[0] == '\0' ) { if ( IS_SET( ch->comm, COMM_NOWIZ ) ) { ch_printf( ch, "Immortal channel is now ON\r\n" ); REMOVE_BIT( ch->comm, COMM_NOWIZ ); } else { ch_printf( ch, "Immortal channel is now OFF\r\n" ); SET_BIT( ch->comm, COMM_NOWIZ ); } return; } REMOVE_BIT( ch->comm, COMM_NOWIZ ); channel_speech( CHAN_WIZ, ch, argument, NULL ); return; } void do_say( CHAR_DATA *ch, const char *argument ) { if ( argument[0] == '\0' ) { ch_printf( ch, "Say what?\r\n" ); return; } channel_speech( CHAN_SAY, ch, argument, NULL ); if ( !IS_NPC( ch ) ) { CHAR_DATA *mob = NULL; CHAR_DATA *mob_next = NULL; 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 ) && mob->position == mob->pIndexData->default_pos ) mp_act_trigger( argument, mob, ch, NULL, NULL, TRIG_SPEECH ); } } return; } void do_shout( CHAR_DATA *ch, const char *argument ) { if ( argument[0] == '\0' ) { if ( IS_SET( ch->comm, COMM_SHOUTSOFF ) ) { ch_printf( ch, "You can hear shouts again.\r\n" ); REMOVE_BIT( ch->comm, COMM_SHOUTSOFF ); } else { ch_printf( ch, "You will no longer hear shouts.\r\n" ); SET_BIT( ch->comm, COMM_SHOUTSOFF ); } return; } if ( IS_SET( ch->comm, COMM_NOSHOUT ) ) { ch_printf( ch, "You can't shout.\r\n" ); return; } REMOVE_BIT( ch->comm, COMM_SHOUTSOFF ); WAIT_STATE( ch, 12 ); channel_speech( CHAN_SHOUT, ch, argument, NULL ); return; } void do_tell( CHAR_DATA *ch, const char *argument ) { char arg[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0"; char buf[MAX_STRING_LENGTH] = "\0\0\0\0\0\0\0"; CHAR_DATA *victim = NULL; if ( IS_SET( ch->comm, COMM_NOTELL ) || IS_SET( ch->comm, COMM_DEAF ) ) { ch_printf( ch, "Your message didn't get through.\r\n" ); return; } if ( IS_SET( ch->comm, COMM_QUIET ) ) { ch_printf( ch, "You must turn off quiet mode first.\r\n" ); return; } if ( IS_SET( ch->comm, COMM_DEAF ) ) { ch_printf( ch, "You must turn off deaf mode first.\r\n" ); return; } argument = one_argument( argument, arg ); if ( arg[0] == '\0' || argument[0] == '\0' ) { ch_printf( ch, "Tell whom what?\r\n" ); 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 ) ) { ch_printf( ch, "They aren't here.\r\n" ); return; } if ( victim->desc == NULL && !IS_NPC( victim ) ) { act( "$N seems to have misplaced $S link...try again later.", ch, NULL, victim, TO_CHAR ); sprintf( buf, "%s tells you '%s'\r\n", PERS( ch, victim ), argument ); buf[0] = UPPER( buf[0] ); add_buf( victim->pcdata->buffer, buf ); return; } if ( !( IS_IMMORTAL( ch ) && ch->level > LEVEL_IMMORTAL ) && !IS_AWAKE( victim ) ) { act( "$E can't hear you.", ch, 0, victim, TO_CHAR ); return; } if ( ( IS_SET( victim->comm, COMM_QUIET ) || IS_SET( victim->comm, COMM_DEAF ) ) && !IS_IMMORTAL( ch ) ) { act( "$E is not receiving tells.", ch, 0, victim, TO_CHAR ); return; } if ( IS_SET( victim->comm, COMM_AFK ) ) { if ( IS_NPC( victim ) ) { act( "$E is AFK, and not receiving tells.", ch, NULL, victim, TO_CHAR ); return; } act( "$E is AFK, but your tell will go through when $E returns.", ch, NULL, victim, TO_CHAR ); sprintf( buf, "%s tells you '%s'\r\n", PERS( ch, victim ), argument ); buf[0] = UPPER( buf[0] ); add_buf( victim->pcdata->buffer, buf ); return; } channel_speech( CHAN_TELL, ch, argument, victim ); victim->reply = ch; 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_reply( CHAR_DATA *ch, const char *argument ) { CHAR_DATA *victim = NULL; char buf[MAX_STRING_LENGTH] = "\0\0\0\0\0\0\0"; if ( IS_SET( ch->comm, COMM_NOTELL ) ) { ch_printf( ch, "Your message didn't get through.\r\n" ); return; } if ( ( victim = ch->reply ) == NULL ) { ch_printf( ch, "They aren't here.\r\n" ); return; } if ( argument[0] == '\0' ) { ch_printf( ch, "Reply saying what?\r\n" ); return; } if ( victim->desc == NULL && !IS_NPC( victim ) ) { act( "$N seems to have misplaced $S link...try again later.", ch, NULL, victim, TO_CHAR ); sprintf( buf, "%s tells you '%s'\r\n", PERS( ch, victim ), argument ); buf[0] = UPPER( buf[0] ); add_buf( victim->pcdata->buffer, buf ); return; } if ( !IS_IMMORTAL( ch ) && !IS_AWAKE( victim ) ) { act( "$E can't hear you.", ch, 0, victim, TO_CHAR ); return; } if ( ( IS_SET( victim->comm, COMM_QUIET ) || IS_SET( victim->comm, COMM_DEAF ) ) && !IS_IMMORTAL( ch ) && !IS_IMMORTAL( victim ) ) { act_new( "$E is not receiving tells.", ch, 0, victim, TO_CHAR, POS_DEAD ); return; } if ( !IS_IMMORTAL( victim ) && !IS_AWAKE( ch ) ) { ch_printf( ch, "In your dreams, or what?\r\n" ); return; } if ( IS_SET( victim->comm, COMM_AFK ) ) { if ( IS_NPC( victim ) ) { act_new( "$E is AFK, and not receiving tells.", ch, NULL, victim, TO_CHAR, POS_DEAD ); return; } act_new( "$E is AFK, but your tell will go through when $E returns.", ch, NULL, victim, TO_CHAR, POS_DEAD ); sprintf( buf, "%s tells you '%s'\r\n", PERS( ch, victim ), argument ); buf[0] = UPPER( buf[0] ); add_buf( victim->pcdata->buffer, buf ); return; } channel_speech( CHAN_REPLY, ch, argument, victim ); victim->reply = ch; return; } void do_yell( CHAR_DATA *ch, const char *argument ) { if ( IS_SET( ch->comm, COMM_NOSHOUT ) ) { ch_printf( ch, "You can't yell.\r\n" ); return; } if ( argument[0] == '\0' ) { ch_printf( ch, "Yell what?\r\n" ); return; } channel_speech( CHAN_YELL, ch, argument, NULL ); return; } void do_emote( CHAR_DATA *ch, const char *argument ) { if ( !IS_NPC( ch ) && IS_SET( ch->comm, COMM_NOEMOTE ) ) { ch_printf( ch, "You can't show your emotions.\r\n" ); return; } if ( argument[0] == '\0' ) { ch_printf( ch, "Emote what?\r\n" ); return; } MOBtrigger = false; act( "$n $T", ch, NULL, argument, TO_ROOM ); act( "$n $T", ch, NULL, argument, TO_CHAR ); MOBtrigger = true; return; } void do_pmote( CHAR_DATA *ch, const char *argument ) { CHAR_DATA *vch = NULL; char *letter = NULL; char *name = NULL; char last[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0"; char temp[MAX_STRING_LENGTH] = "\0\0\0\0\0\0\0"; size_t matches = 0; if ( !IS_NPC( ch ) && IS_SET( ch->comm, COMM_NOEMOTE ) ) { ch_printf( ch, "You can't show your emotions.\r\n" ); return; } if ( argument[0] == '\0' ) { ch_printf( ch, "Emote what?\r\n" ); return; } act( "$n $t", ch, argument, NULL, TO_CHAR ); for ( vch = ch->in_room->people; vch != NULL; vch = vch->next_in_room ) { if ( vch->desc == NULL || vch == ch ) continue; if ( ( letter = strstr( argument, vch->name ) ) == NULL ) { MOBtrigger = false; act( "$N $t", vch, argument, ch, TO_CHAR ); MOBtrigger = true; continue; } strcpy( temp, argument ); temp[strlen( argument ) - strlen( letter )] = '\0'; last[0] = '\0'; name = vch->name; for ( ; *letter != '\0'; letter++ ) { if ( *letter == '\'' && matches == strlen( vch->name ) ) { strcat( temp, "r" ); continue; } if ( *letter == 's' && matches == strlen( vch->name ) ) { matches = 0; continue; } if ( matches == strlen( vch->name ) ) { matches = 0; } if ( *letter == *name ) { matches++; name++; if ( matches == strlen( vch->name ) ) { strcat( temp, "you" ); last[0] = '\0'; name = vch->name; continue; } strncat( last, letter, 1 ); continue; } matches = 0; strcat( temp, last ); strncat( temp, letter, 1 ); last[0] = '\0'; name = vch->name; } MOBtrigger = false; act( "$N $t", vch, temp, ch, TO_CHAR ); MOBtrigger = true; } return; } /* * All the posing stuff. */ const struct pose_table_type pose_table[] = { { { "You sizzle with energy.", "$n sizzles with energy.", "You feel very holy.", "$n looks very holy.", "You perform a small card trick.", "$n performs a small card trick.", "You show your bulging muscles.", "$n shows $s bulging muscles."} }, { { "You turn into a butterfly, then return to your normal shape.", "$n turns into a butterfly, then returns to $s normal shape.", "You nonchalantly turn wine into water.", "$n nonchalantly turns wine into water.", "You wiggle your ears alternately.", "$n wiggles $s ears alternately.", "You crack nuts between your fingers.", "$n cracks nuts between $s fingers."} }, { { "Blue sparks fly from your fingers.", "Blue sparks fly from $n's fingers.", "A halo appears over your head.", "A halo appears over $n's head.", "You nimbly tie yourself into a knot.", "$n nimbly ties $mself into a knot.", "You grizzle your teeth and look mean.", "$n grizzles $s teeth and looks mean."} }, { { "Little red lights dance in your eyes.", "Little red lights dance in $n's eyes.", "You recite words of wisdom.", "$n recites words of wisdom.", "You juggle with daggers, apples, and eyeballs.", "$n juggles with daggers, apples, and eyeballs.", "You hit your head, and your eyes roll.", "$n hits $s head, and $s eyes roll."} }, { { "A slimy green monster appears before you and bows.", "A slimy green monster appears before $n and bows.", "Deep in prayer, you levitate.", "Deep in prayer, $n levitates.", "You steal the underwear off every person in the room.", "Your underwear is gone! $n stole it!", "Crunch, crunch -- you munch a bottle.", "Crunch, crunch -- $n munches a bottle."} }, { { "You turn everybody into a little pink elephant.", "You are turned into a little pink elephant by $n.", "An angel consults you.", "An angel consults $n.", "The dice roll ... and you win again.", "The dice roll ... and $n wins again.", "... 98, 99, 100 ... you do pushups.", "... 98, 99, 100 ... $n does pushups."} }, { { "A small ball of light dances on your fingertips.", "A small ball of light dances on $n's fingertips.", "Your body glows with an unearthly light.", "$n's body glows with an unearthly light.", "You count the money in everyone's pockets.", "Check your money, $n is counting it.", "Arnold Schwarzenegger admires your physique.", "Arnold Schwarzenegger admires $n's physique."} }, { { "Smoke and fumes leak from your nostrils.", "Smoke and fumes leak from $n's nostrils.", "A spot light hits you.", "A spot light hits $n.", "You balance a pocket knife on your tongue.", "$n balances a pocket knife on your tongue.", "Watch your feet, you are juggling granite boulders.", "Watch your feet, $n is juggling granite boulders."} }, { { "The light flickers as you rap in magical languages.", "The light flickers as $n raps in magical languages.", "Everyone levitates as you pray.", "You levitate as $n prays.", "You produce a coin from everyone's ear.", "$n produces a coin from your ear.", "Oomph! You squeeze water out of a granite boulder.", "Oomph! $n squeezes water out of a granite boulder."} }, { { "Your head disappears.", "$n's head disappears.", "A cool breeze refreshes you.", "A cool breeze refreshes $n.", "You step behind your shadow.", "$n steps behind $s shadow.", "You pick your teeth with a spear.", "$n picks $s teeth with a spear."} }, { { "A fire elemental singes your hair.", "A fire elemental singes $n's hair.", "The sun pierces through the clouds to illuminate you.", "The sun pierces through the clouds to illuminate $n.", "Your eyes dance with greed.", "$n's eyes dance with greed.", "Everyone is swept off their foot by your hug.", "You are swept off your feet by $n's hug."} }, { { "The sky changes color to match your eyes.", "The sky changes color to match $n's eyes.", "The ocean parts before you.", "The ocean parts before $n.", "You deftly steal everyone's weapon.", "$n deftly steals your weapon.", "Your karate chop splits a tree.", "$n's karate chop splits a tree."} }, { { "The stones dance to your command.", "The stones dance to $n's command.", "A thunder cloud kneels to you.", "A thunder cloud kneels to $n.", "The Grey Mouser buys you a beer.", "The Grey Mouser buys $n a beer.", "A strap of your armor breaks over your mighty thews.", "A strap of $n's armor breaks over $s mighty thews."} }, { { "The heavens and grass change colour as you smile.", "The heavens and grass change colour as $n smiles.", "The Burning Man speaks to you.", "The Burning Man speaks to $n.", "Everyone's pocket explodes with your fireworks.", "Your pocket explodes with $n's fireworks.", "A boulder cracks at your frown.", "A boulder cracks at $n's frown."} }, { { "Everyone's clothes are transparent, and you are laughing.", "Your clothes are transparent, and $n is laughing.", "An eye in a pyramid winks at you.", "An eye in a pyramid winks at $n.", "Everyone discovers your dagger a centimeter from their eye.", "You discover $n's dagger a centimeter from your eye.", "Mercenaries arrive to do your bidding.", "Mercenaries arrive to do $n's bidding."} }, { { "A black hole swallows you.", "A black hole swallows $n.", "Valentine Michael Smith offers you a glass of water.", "Valentine Michael Smith offers $n a glass of water.", "Where did you go?", "Where did $n go?", "Four matched Percherons bring in your chariot.", "Four matched Percherons bring in $n's chariot."} }, { { "The world shimmers in time with your whistling.", "The world shimmers in time with $n's whistling.", "The great god Mota gives you a staff.", "The great god Mota gives $n a staff.", "Click.", "Click.", "Atlas asks you to relieve him.", "Atlas asks $n to relieve him."} } }; void do_pose( CHAR_DATA *ch, const char *argument ) { int level = 0; int pose = 0; if ( IS_NPC( ch ) ) return; level = UMIN( ch->level, ( int ) sizeof( pose_table ) / ( int ) sizeof( pose_table[0] ) - 1 ); pose = number_range( 0, level ); act( pose_table[pose].message[2 * ch->iclass + 0], ch, NULL, NULL, TO_CHAR ); act( pose_table[pose].message[2 * ch->iclass + 1], ch, NULL, NULL, TO_ROOM ); return; } void do_bug( CHAR_DATA *ch, const char *argument ) { append_file( ch, BUG_FILE, argument ); ch_printf( ch, "Bug logged.\r\n" ); return; } void do_typo( CHAR_DATA *ch, const char *argument ) { append_file( ch, TYPO_FILE, argument ); ch_printf( ch, "Typo logged.\r\n" ); return; } void do_rent( CHAR_DATA *ch, const char *argument ) { ch_printf( ch, "There is no rent here. Just save and quit.\r\n" ); return; } void do_qui( CHAR_DATA *ch, const char *argument ) { ch_printf( ch, "If you want to QUIT, you have to spell it out.\r\n" ); return; } void do_quit( CHAR_DATA *ch, const char *argument ) { DESCRIPTOR_DATA *d = NULL; DESCRIPTOR_DATA *d_next = NULL; int id = 0; if ( IS_NPC( ch ) ) return; if ( ch->position == POS_FIGHTING ) { ch_printf( ch, "No way! You are fighting.\r\n" ); return; } if ( ch->position < POS_STUNNED ) { ch_printf( ch, "You're not DEAD yet.\r\n" ); return; } ch_printf( ch, "Alas, all good things must come to an end.\r\n" ); act( "$n has left the game.", ch, NULL, NULL, TO_ROOM ); log_auth( ch, "%s has quit.", NAME( ch ) ); wiznet( "$N rejoins the real world.", ch, NULL, WIZ_LOGINS, 0, get_trust( ch ) ); /* * After extract_char the ch is no longer valid! */ save_char_obj( ch ); id = ch->id; d = ch->desc; update_player_list( ch, false ); extract_char( ch, true ); if ( d != NULL ) close_descriptor( d ); /* * toast evil cheating bastards */ for ( d = descriptor_list; d != NULL; d = d_next ) { CHAR_DATA *tch = NULL; d_next = d->next; tch = d->original ? d->original : d->character; if ( tch && tch->id == id ) { update_player_list( tch, false ); extract_char( tch, true ); close_descriptor( d ); } } return; } void do_save( CHAR_DATA *ch, const char *argument ) { if ( IS_NPC( ch ) ) return; save_char_obj( ch ); ch_printf( ch, "Saving. Remember that ROM has automatic saving now.\r\n" ); WAIT_STATE( ch, 4 * PULSE_VIOLENCE ); return; } void do_follow( CHAR_DATA *ch, const char *argument ) { /* RT changed to allow unlimited following and follow the NOFOLLOW rules */ char arg[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0"; CHAR_DATA *victim = NULL; one_argument( argument, arg ); if ( arg[0] == '\0' ) { ch_printf( ch, "Follow whom?\r\n" ); return; } if ( ( victim = get_char_room( ch, arg ) ) == NULL ) { ch_printf( ch, "They aren't here.\r\n" ); 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 ) { ch_printf( ch, "You already follow yourself.\r\n" ); return; } stop_follower( ch ); return; } if ( !IS_NPC( victim ) && IS_SET( victim->act, PLR_NOFOLLOW ) && !IS_IMMORTAL( ch ) ) { act( "$N doesn't seem to want any followers.\r\n", ch, NULL, victim, TO_CHAR ); return; } REMOVE_BIT( ch->act, PLR_NOFOLLOW ); 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 ) { log_error( "%s attempting to follow %s, but master is NOT NULL.", NAME( ch ), NAME( master ) ); 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 ) { log_error( "%s attempting to stop following, but master is NULL.", NAME( ch ) ); return; } if ( IS_AFFECTED( ch, AFF_CHARM ) ) { REMOVE_BIT( ch->affected_by, AFF_CHARM ); affect_strip( ch, skill_lookup( "charm person" ) ); } if ( can_see( ch->master, ch ) && ch->in_room != NULL ) { act( "$n stops following you.", ch, NULL, ch->master, TO_VICT ); act( "You stop following $N.", ch, NULL, ch->master, TO_CHAR ); } if ( ch->master->pet == ch ) ch->master->pet = NULL; ch->master = NULL; ch->leader = NULL; return; } /* nukes charmed monsters and pets */ void nuke_pets( CHAR_DATA *ch ) { CHAR_DATA *pet = NULL; if ( ( pet = ch->pet ) != NULL ) { stop_follower( pet ); if ( pet->in_room != NULL ) act( "$N slowly fades away.", ch, NULL, pet, TO_NOTVICT ); extract_char( pet, true ); } ch->pet = NULL; return; } void die_follower( CHAR_DATA *ch ) { CHAR_DATA *fch = NULL; if ( ch->master != NULL ) { if ( ch->master->pet == ch ) ch->master->pet = 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; } return; } void do_order( CHAR_DATA *ch, const char *argument ) { char arg[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0"; char arg2[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0"; CHAR_DATA *victim = NULL; CHAR_DATA *och = NULL; CHAR_DATA *och_next = NULL; bool found = false; bool fAll = false; argument = one_argument( argument, arg ); one_argument( argument, arg2 ); if ( !str_cmp( arg2, "afk" ) || !str_cmp( arg2, "mob" ) ) { ch_printf( ch, "That is a stupid thing to do.\r\n" ); return; } if ( !str_cmp( arg2, "delete" ) ) { ch_printf( ch, "That will NOT be done.\r\n" ); return; } if ( arg[0] == '\0' || argument[0] == '\0' ) { ch_printf( ch, "Order whom to do what?\r\n" ); return; } if ( IS_AFFECTED( ch, AFF_CHARM ) ) { ch_printf( ch, "You feel like taking, not giving, orders.\r\n" ); return; } if ( !str_cmp( arg, "all" ) ) { fAll = true; victim = NULL; } else { fAll = false; if ( ( victim = get_char_room( ch, arg ) ) == NULL ) { ch_printf( ch, "They aren't here.\r\n" ); return; } if ( victim == ch ) { ch_printf( ch, "Aye aye, right away!\r\n" ); return; } if ( !IS_AFFECTED( victim, AFF_CHARM ) || victim->master != ch || ( IS_IMMORTAL( victim ) && victim->trust >= ch->trust ) ) { ch_printf( ch, "Do it yourself!\r\n" ); return; } } found = false; for ( och = ch->in_room->people; och != NULL; och = och_next ) { och_next = och->next_in_room; if ( IS_AFFECTED( och, AFF_CHARM ) && och->master == ch && ( fAll || och == victim ) ) { found = true; act_printf( "$n orders you to '%s'.", ch, NULL, och, TO_VICT, POS_RESTING, false, argument ); interpret( och, argument ); } } if ( found ) { WAIT_STATE( ch, PULSE_VIOLENCE ); ch_printf( ch, "Ok.\r\n" ); } else ch_printf( ch, "You have no followers here.\r\n" ); return; } void do_group( CHAR_DATA *ch, const char *argument ) { char arg[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0"; CHAR_DATA *victim = NULL; one_argument( argument, arg ); if ( arg[0] == '\0' ) { CHAR_DATA *gch = NULL; CHAR_DATA *leader = NULL; leader = ( ch->leader != NULL ) ? ch->leader : ch; ch_printf( ch, "%s's group:\r\n", PERS( leader, ch ) ); for ( gch = char_list; gch != NULL; gch = gch->next ) { if ( is_same_group( gch, ch ) ) { ch_printf( ch, "[%2d %s] %-16s %4d/%4d hp %4d/%4d mana %4d/%4d mv %5d xp\r\n", gch->level, IS_NPC( gch ) ? "Mob" : class_table[gch->iclass].who_name, capitalize( PERS( gch, ch ) ), gch->hit, gch->max_hit, gch->mana, gch->max_mana, gch->move, gch->max_move, gch->exp ); } } return; } if ( ( victim = get_char_room( ch, arg ) ) == NULL ) { ch_printf( ch, "They aren't here.\r\n" ); return; } if ( ch->master != NULL || ( ch->leader != NULL && ch->leader != ch ) ) { ch_printf( ch, "But you are following someone else!\r\n" ); return; } if ( victim->master != ch && ch != victim ) { act_new( "$N isn't following you.", ch, NULL, victim, TO_CHAR, POS_SLEEPING ); return; } if ( IS_AFFECTED( victim, AFF_CHARM ) ) { ch_printf( ch, "You can't remove charmed mobs from your group.\r\n" ); return; } if ( IS_AFFECTED( ch, AFF_CHARM ) ) { act_new( "You like your master too much to leave $m!", ch, NULL, victim, TO_VICT, POS_SLEEPING ); return; } if ( is_same_group( victim, ch ) && ch != victim ) { victim->leader = NULL; act_new( "$n removes $N from $s group.", ch, NULL, victim, TO_NOTVICT, POS_RESTING ); act_new( "$n removes you from $s group.", ch, NULL, victim, TO_VICT, POS_SLEEPING ); act_new( "You remove $N from your group.", ch, NULL, victim, TO_CHAR, POS_SLEEPING ); return; } victim->leader = ch; act_new( "$N joins $n's group.", ch, NULL, victim, TO_NOTVICT, POS_RESTING ); act_new( "You join $n's group.", ch, NULL, victim, TO_VICT, POS_SLEEPING ); act_new( "$N joins your group.", ch, NULL, victim, TO_CHAR, POS_SLEEPING ); return; } /* * 'Split' originally by Gnort, God of Chaos. */ void do_split( CHAR_DATA *ch, const char *argument ) { char buf[MAX_STRING_LENGTH] = "\0\0\0\0\0\0\0"; char arg1[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0"; char arg2[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0"; CHAR_DATA *gch = NULL; int members = 0; int amount_gold = 0; int amount_silver = 0; int share_gold = 0; int share_silver = 0; int extra_gold = 0; int extra_silver = 0; argument = one_argument( argument, arg1 ); one_argument( argument, arg2 ); if ( arg1[0] == '\0' ) { ch_printf( ch, "Split how much?\r\n" ); return; } amount_silver = atoi( arg1 ); if ( arg2[0] != '\0' ) amount_gold = atoi( arg2 ); if ( amount_gold < 0 || amount_silver < 0 ) { ch_printf( ch, "Your group wouldn't like that.\r\n" ); return; } if ( amount_gold == 0 && amount_silver == 0 ) { ch_printf( ch, "You hand out zero coins, but no one notices.\r\n" ); return; } if ( ch->gold < amount_gold || ch->silver < amount_silver ) { ch_printf( ch, "You don't have that much to split.\r\n" ); return; } members = 0; for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) { if ( is_same_group( gch, ch ) && !IS_AFFECTED( gch, AFF_CHARM ) ) members++; } if ( members < 2 ) { ch_printf( ch, "Just keep it all.\r\n" ); return; } share_silver = amount_silver / members; extra_silver = amount_silver % members; share_gold = amount_gold / members; extra_gold = amount_gold % members; if ( share_gold == 0 && share_silver == 0 ) { ch_printf( ch, "Don't even bother, cheapskate.\r\n" ); return; } ch->silver -= amount_silver; ch->silver += share_silver + extra_silver; ch->gold -= amount_gold; ch->gold += share_gold + extra_gold; if ( share_silver > 0 ) { ch_printf( ch, "You split %d silver coins. Your share is %d silver.\r\n", amount_silver, share_silver + extra_silver ); } if ( share_gold > 0 ) { ch_printf( ch, "You split %d gold coins. Your share is %d gold.\r\n", amount_gold, share_gold + extra_gold ); } if ( share_gold == 0 ) { sprintf( buf, "$n splits %d silver coins. Your share is %d silver.", amount_silver, share_silver ); } else if ( share_silver == 0 ) { sprintf( buf, "$n splits %d gold coins. Your share is %d gold.", amount_gold, share_gold ); } else { sprintf( buf, "$n splits %d silver and %d gold coins, giving you %d silver and %d gold.\r\n", amount_silver, amount_gold, share_silver, share_gold ); } for ( gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room ) { if ( gch != ch && is_same_group( gch, ch ) && !IS_AFFECTED( gch, AFF_CHARM ) ) { act( buf, ch, NULL, gch, TO_VICT ); gch->gold += share_gold; gch->silver += share_silver; } } return; } void do_gtell( CHAR_DATA *ch, const char *argument ) { if ( argument[0] == '\0' ) { ch_printf( ch, "Tell your group what?\r\n" ); return; } if ( IS_SET( ch->comm, COMM_NOTELL ) ) { ch_printf( ch, "Your message didn't get through!\r\n" ); return; } channel_speech( CHAN_GROUP, ch, argument, NULL ); return; } void do_speak( CHAR_DATA *ch, const char *argument ) { char arg[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0"; int lang; int sn = -1; one_argument( argument, arg ); if ( arg[0] == '\0' ) { ch_printf( ch, "Speak which language?\r\n" ); return; } lang = language_lookup( arg ); if ( lang == -1 ) /* invalid language specified */ { ch_printf( ch, "You don't know how to speak in that language.\r\n" ); return; } if ( ( sn = skill_lookup( language_table[lang].skill_name ) ) == -1 ) { log_error( "Can't find the \"%s\" skill in %s?", language_table[lang].skill_name, __FUNCTION__ ); return; } if ( get_skill( ch, sn ) == 0 ) { ch_printf( ch, "You don't know how to speak in that language.\r\n" ); } else { ch->speaking = language_table[lang].language; ch_printf( ch, "You now speak in %s.\r\n", language_table[lang].name ); } 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( const CHAR_DATA *ach, const CHAR_DATA *bch ) { if ( ach == NULL || bch == NULL ) return false; if ( ach->leader != NULL ) ach = ach->leader; if ( bch->leader != NULL ) bch = bch->leader; return ach == bch; } //const char *slur_words(const char *speech, int cond_drunk) const char *slur_words(const char *speech, const CHAR_DATA *ch) { static char buf[MAX_INPUT_LENGTH]; char temp0, temp1; int inlength = strlen(speech); int outpos = 0; int i, idx, randomnum; int cond_drunk = 0; if ( !IS_NPC( ch ) ) cond_drunk = ch->pcdata->condition[COND_DRUNK]; else cond_drunk = 0; for( i=0; i<inlength; i++ ) { temp0 = UPPER(speech[i]); if(temp0 >= 'A' && temp0 <= 'Z') { temp1 = temp0 - 'A'; idx = temp1; if(cond_drunk > drunken_slur_table[idx].min_drunk) { randomnum = number_range( 0, drunken_slur_table[idx].rep_count); strcpy(&buf[outpos], drunken_slur_table[idx].replacement[randomnum]); outpos += strlen(drunken_slur_table[idx].replacement[randomnum]); } else { buf[outpos] = speech[i]; outpos++; } } else if(temp0 >= '0' && temp0 <= '9') { if(cond_drunk > 4) { temp1 = '0' + number_range(0, 9); buf[outpos] = temp1; outpos++; } else { buf[outpos] = speech[i]; outpos++; } } else { buf[outpos] = speech[i]; outpos++; } } buf[outpos] = '\0'; /* Mark end of the string... */ return ( char * )buf; } const char *language_convert(const char *speech, CHAR_DATA *ch, CHAR_DATA *vch) { static char buf[MAX_INPUT_LENGTH]; char word[MAX_STRING_LENGTH]; int lang; int inlength = strlen(speech); int outpos = 0; int i, j, k, l, m; int chance, comprehension, sn; int len, len_sub; bool word_translated, word_matched; bool full_caps; buf[outpos] = '\0'; word[0] = '\0'; if ( ch == NULL || vch == NULL ) { log_error("NULL character data sent to %s.", __FUNCTION__ ); return ""; } lang = ch->speaking; if ( lang < LANG_COMMON || lang > LANG_UNKNOWN ) { log_error("Invalid language %i passed to language_convert.", lang); return ""; } if ( lang == LANG_COMMON ) { strcpy( buf, speech ); return buf; } i = language_lookup( ch->speaking ); if ( ( sn = skill_lookup( language_table[i].skill_name ) ) == -1 ) { log_error( "Can't find the \"%s\" skill in %s?", language_table[i].skill_name, __FUNCTION__ ); return ""; } comprehension = get_skill( vch, sn ); if ( comprehension > 0 ) chance = comprehension + 7; else chance = 0; for( i = 0, j = 0; i <= inlength; i++ ) { if( LOWER(speech[i]) >= 'a' && LOWER(speech[i]) <= 'z' ) { word[j] = speech[i]; j++; } else { word[j] = '\0'; word_translated = chance < number_percent( ); check_improve( vch, sn, !word_translated, 2 ); if ( strlen( word ) > 0 ) { if ( !word_translated ) { strcat( buf, word ); outpos += strlen( word ); } else { word_matched = false; for ( k = 0; lang_word_table[lang][k].word != NULL; k++ ) { if ( LOWER( word[0] ) == lang_word_table[lang][k].word[0] && !str_cmp( word, lang_word_table[lang][k].word) ) { word_matched = true; if ( word[0] == UPPER( word[0] ) ) { len = strlen( word ); for ( full_caps = true, l = 0; l < len; l++ ) { if ( word[l] != UPPER ( word[l] ) ) full_caps = false; } strcpy( word, lang_word_table[lang][k].foreign_word ); if ( full_caps ) { len = strlen( word ); for ( l = 0; l < len; l++ ) { word[l] = UPPER( word[l] ); } } else { word[0] = UPPER( word[0] ); } strcat( buf, word ); } else { strcat( buf, lang_word_table[lang][k].foreign_word ); } outpos += strlen( lang_word_table[lang][k].foreign_word ); break; } } if ( !word_matched ) { len = strlen( word ); for ( k = 0; k < len; k++ ) { for ( l = 0; lang_letter_table[lang][l].letter != NULL; l++ ) { if ( LOWER( word[k] ) == lang_letter_table[lang][l].letter[0] ) { strcat( buf, lang_letter_table[lang][l].foreign_letter ); if ( word[k] == UPPER( word[k] ) ) { len_sub = strlen ( lang_letter_table[lang][l].foreign_letter ); if ( len_sub > 1 && ( word[k + 1] == UPPER( word[k + 1] ) || word[k + 1] == '\0' ) ) { for( m = 0; m < len_sub; m++ ) { buf[outpos + m] = UPPER( buf[outpos + m] ); } } else { buf[outpos] = UPPER( buf[outpos] ); } } outpos += strlen( lang_letter_table[lang][l].foreign_letter ); break; } } } } } j = 0; } buf[outpos] = speech[i]; outpos++; buf[outpos] = '\0'; /* strcat needs this */ } } buf[outpos] = '\0'; /* Mark end of the string... */ return ( char * )buf; } void channel_speech(int channel, CHAR_DATA *ch, const char *argument, CHAR_DATA *vch) { char buf[MAX_INPUT_LENGTH] = "\0\0\0\0\0\0\0"; DESCRIPTOR_DATA *d = NULL; bool receipt = false; int chanidx = channel_lookup( channel ); if ( channel == CHAN_TELL || channel == CHAN_REPLY ) { if ( vch == NULL ) { log_error( "NULL victim char passed to channel_speech with channel = %i", channel ); return; } strcpy( buf, vch->name ); strcat( buf, " "); buf[0] = UPPER( buf[0] ); } ch_printf( ch, "You %s %s'%s'\r\n", channel_table[chanidx].outgoing_verb, buf, slur_words( argument, ch ) ); for ( d = descriptor_list; d != NULL; d = d->next ) { CHAR_DATA *victim; if ( channel == CHAN_TELL || channel == CHAN_REPLY ) victim = vch; else victim = d->original ? d->original : d->character; receipt = d->connected == CON_PLAYING && victim != ch; /* Immortals speak through all blocking flags */ if ( channel_table[chanidx].blocking_flag != -1 ) receipt = receipt && ( !IS_SET( victim->comm, channel_table[chanidx].blocking_flag) || IS_IMMORTAL(ch) ); if ( channel != CHAN_WIZ && channel != CHAN_SAY && channel != CHAN_GROUP ) receipt = receipt && ( !IS_SET( victim->comm, COMM_QUIET ) || IS_IMMORTAL(ch) ); if ( channel == CHAN_CLAN ) receipt = receipt && is_same_clan( ch, victim ); else if ( channel == CHAN_GROUP ) receipt = receipt && is_same_group( victim, ch ); else if ( channel == CHAN_YELL ) receipt = receipt && victim->in_room != NULL && victim->in_room->area == ch->in_room->area; else if ( channel == CHAN_WIZ ) receipt = receipt && IS_IMMORTAL( victim ); else if ( channel == CHAN_SAY ) receipt = receipt && victim->in_room != NULL && victim->in_room == ch->in_room; else if ( channel == CHAN_TELL || channel == CHAN_REPLY ) receipt = true; /* victim already located */ if ( receipt ) { if ( ch->speaking != LANG_COMMON ) { sprintf( buf, "%s in %s", channel_table[chanidx].incoming_verb, language_table[language_lookup( ch->speaking )].name ); } else { strcpy( buf, channel_table[chanidx].incoming_verb ); } act_printf( "$n %s '$t'", ch, slur_words( language_convert( argument, ch, victim ), ch ), victim, TO_VICT, channel_table[chanidx].min_pos, false, buf ); if ( channel == CHAN_TELL || channel == CHAN_REPLY ) return; } } }