race-talk.c
snippets · 3.4 KB · 2010-03-30
Race talk: a race-only channel (COMM_NORACE) by Baxter.
Download « Back to the snippets list
/* in merc.h */
....
#define COMM_SHOUTSOFF (J)
#define COMM_NORACE (K) /* New channel -Baxter */
...
/* in handler.c */
....
if (comm_flags & COMM_NOCHANNELS ) strcat(buf, " no_channels");
if (comm_flags & COMM_NORACE ) strcat(buf, " no_race" );
....
/* in tables.c */
....
{ "shoutsoff", COMM_SHOUTSOFF, TRUE },
{ "norace", COMM_NORACE, TRUE },
....
/* in interp.h */
....
DECLARE_DO_FUN( do_quote );
DECLARE_DO_FUN( do_racetalk ); /* New channel -Baxter */
....
DECLARE_DO_FUN( do_rstat );
DECLARE_DO_FUN( do_rt );
....
/* in interp.c */
....
{ "quiet", do_quiet, POS_SLEEPING, 0, LOG_NORMAL, 1 },
{ "racetalk", do_racetalk, POS_SLEEPING, 0, LOG_NORMAL, 1 },
....
{ "replay", do_replay, POS_SLEEPING, 0, LOG_NORMAL, 1 },
{ "rt", do_racetalk, POS_SLEEPING, 0, LOG_NORMAL, 0 },
....
/* in act_comm.c (in do_channels) */
....
send_to_char("Race talk ",ch);
if (!IS_SET(ch->comm, COMM_NORACE))
send_to_char("ON\n\r",ch);
else
send_to_char("OFF\n\r",ch);
send_to_char("Q/A ",ch);
....
void do_racetalk( CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];
DESCRIPTOR_DATA *d;
if (IS_NPC(ch))
return;
if (argument[0] == '\0')
{
if (IS_SET(ch->comm, COMM_NORACE))
{
send_to_char("Race channel is now ON.\n\r", ch);
REMOVE_BIT(ch->comm, COMM_NORACE);
}
else
{
send_to_char("Race channel is now OFF.\n\r", ch);
SET_BIT(ch->comm, COMM_NORACE);
}
}
else
{
if (IS_SET(ch->comm, COMM_QUIET))
{
send_to_char("You must turn off quiet mode first.\n\r", ch);
return;
}
if (IS_SET(ch->comm, COMM_NOCHANNELS))
{
send_to_char("The gods have revoked your channels priviliges.\n\r",
ch);
return;
}
REMOVE_BIT(ch->comm, COMM_NORACE);
sprintf(buf, "[ %s ] $n '$t'", pc_race_table[ch->race].who_name);
act_new(buf, ch, argument, NULL, TO_CHAR, POS_DEAD);
for (d = descriptor_list; d != NULL; d = d->next)
{
CHAR_DATA *victim;
victim = d->original ? d->original : d->character;
if (d->connected == CON_PLAYING
&& victim != ch
&& victim->race == ch->race
&& !IS_NPC(victim) && !IS_SET(victim->comm, COMM_NORACE)
&& !IS_SET(victim->comm, COMM_QUIET))
{
act_new(buf, ch, argument, d->character, TO_VICT,
POS_SLEEPING);
}
}
}
}
/*
=============================================================================
/ ______ _______ ____ _____ ___ __ _ ______ ____ ____ _____ /
\ | ____|__ __| _ \ / ____\ / _ \| \ / | ____| / __ \| _ \ / ____\ \
/ | |__ | | | |_| | | | |_| | |\/| | |___ | | | | |_| | | /
/ | ___| | | | ___/| | __| _ | | | | ____| | | | | __/| | ___ \
\ | | | | | | | |___| | | | | | | | |____ | |__| | |\ \| |___| | /
/ |_| |_| |_| o \_____/|_| |_|_| |_|______|o \____/|_| \_|\_____/ \
\ /
============================================================================
------------------------------------------------------------------------------
ftp://ftp.game.org/pub/mud FTP.GAME.ORG http://www.game.org/ftpsite/
------------------------------------------------------------------------------
This file came from FTP.GAME.ORG, the ultimate source for MUD resources.
------------------------------------------------------------------------------
*/