do_channels.txt
snippets · 10.8 KB · 2010-03-30
Channels command v2.0 for SWR: replaces the plain channels list.
Download « Back to the snippets list
Channels Command v2.0
What this does:
In stock SWR when you type channels you see a very plain and boring list of the channels
you are or are not listening to. I decided to give it a more informative look. This isn't a
hard thing to do, and your players and immortals should like the way it looks. ;)
What you will need to change:
act_info.c
*Always remember to backup the files you will change incase of an error with installation, or
an error with the code.
cp <filename> <newfilename>.bak
What you will need to add:
Nothing.
-------------------------------------------------------------------------------------------------
act_info.c
Find,
void do_channels( CHAR_DATA *ch, char *argument )
Comment out the entire function(even the toggling part) or you can delete it and then add this,
void do_channels( CHAR_DATA *ch, char *argument )
{
char arg[MAX_INPUT_LENGTH];
int count = 0;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_SILENCE) )
{
send_to_char( "You are silenced.\n\r", ch );
return;
}
send_to_char( "&CChannels&B: &G+ &C= &COn &R- &C= &COff &Y* &C= &CNot Available\n\r", ch ); /* Next Line */
send_to_char( "&B---------------------------------------------------------------------&z&W\n\r", ch );
send_to_char( !IS_SET(ch->deaf, CHANNEL_CHAT)
? " &B[&G+&B] &CNEWBIE "
: " &B[&R-&B] &CNEWBIE ", ch );
count++;
if ( count == 5 )
{
count = 0;
send_to_char( "&G&W\n\r", ch ); /* Next Line */
}
send_to_char( !IS_SET(ch->deaf, CHANNEL_OOC)
? " &B[&G+&B] &COOC "
: " &B[&R-&B] &COOC ", ch );
count++;
if ( count == 5 )
{
count = 0;
send_to_char( "&G&W\n\r", ch ); /* Next Line */
}
send_to_char( !IS_SET(ch->deaf, CHANNEL_QUEST)
? " &B[&G+&B] &CQUEST "
: " &B[&R-&B] &CQUEST ",
ch );
count++;
if ( count == 5 )
{
count = 0;
send_to_char( "&G&W\n\r", ch ); /* Next Line */
}
send_to_char( !IS_SET( ch->deaf, CHANNEL_TELLS )
? " &B[&G+&B] &CTELLS "
: " &B[&R-&B] &CTELLS ",
ch );
count++;
if ( count == 5 )
{
count = 0;
send_to_char( "&G&W\n\r", ch ); /* Next Line */
}
if ( !IS_NPC( ch ) && !ch->pcdata->clan )
send_to_char( " &B[&Y*&B] &CWARTALK ", ch );
else
send_to_char( !IS_SET( ch->deaf, CHANNEL_WARTALK )
? " &B[&G+&B] &CWARTALK "
: " &B[&R-&B] &CWARTALK ",
ch );
count++;
if ( count == 5 )
{
count = 0;
send_to_char( "&G&W\n\r", ch ); /* Next Line */
}
if ( !IS_HERO(ch) )
send_to_char( " &B[&Y*&B] &CAVATAR ", ch );
else
send_to_char( !IS_SET(ch->deaf, CHANNEL_AVTALK)
? " &B[&G+&B] &CAVATAR "
: " &B[&R-&B] &CAVATAR ",
ch );
count++;
if ( count == 5 )
{
count = 0;
send_to_char( "&G&W\n\r", ch ); /* Next Line */
}
send_to_char( !IS_SET(ch->deaf, CHANNEL_MUSIC)
? " &B[&G+&B] &CMUSIC "
: " &B[&R-&B] &CMUSIC ",
ch );
count++;
if ( count == 5 )
{
count = 0;
send_to_char( "&G&W\n\r", ch ); /* Next Line */
}
send_to_char( !IS_SET(ch->deaf, CHANNEL_ASK)
? " &B[&G+&B] &CASK "
: " &B[&R-&B] &CASK ",
ch );
count++;
if ( count == 5 )
{
count = 0;
send_to_char( "&G&W\n\r", ch ); /* Next Line */
}
send_to_char( !IS_SET(ch->deaf, CHANNEL_SHOUT)
? " &B[&G+&B] &CSHOUT "
: " &B[&R-&B] &CSHOUT ",
ch );
count++;
if ( count == 5 )
{
count = 0;
send_to_char( "&G&W\n\r", ch ); /* Next Line */
}
send_to_char( !IS_SET(ch->deaf, CHANNEL_YELL)
? " &B[&G+&B] &CYELL "
: " &B[&R-&B] &CYELL ",
ch );
count++;
if ( count == 5 )
{
count = 0;
send_to_char( "&G&W\n\r", ch ); /* Next Line */
}
send_to_char( !IS_SET(ch->deaf, CHANNEL_NEWBIE)
? " &B[&G+&B] &CNEWBIE "
: " &B[&R-&B] &CNEWBIE ",
ch );
count++;
if ( count == 5 )
{
count = 0;
send_to_char( "&G&W\n\r", ch ); /* Next Line */
}
if ( !IS_NPC( ch ) && !ch->pcdata->clan )
send_to_char( " &B[&Y*&B] &CCLAN ", ch );
else
send_to_char( !IS_SET(ch->deaf, CHANNEL_CLAN)
? " &B[&G+&B] &CCLAN "
: " &B[&R-&B] &CCLAN ",
ch );
count++;
if ( count == 5 )
{
count = 0;
send_to_char( "&G&W\n\r", ch ); /* Next Line */
}
if ( NOT_AUTHED( ch ) )
send_to_char( " &B[&Y*&B] &CAUCTION ", ch );
else
send_to_char( !IS_SET(ch->deaf, CHANNEL_AUCTION)
? " &B[&G+&B] &CAUCTION "
: " &B[&R-&B] &CAUCTION ",
ch );
count++;
if ( count == 5 )
{
count = 0;
send_to_char( "&G&W\n\r", ch ); /* Next Line */
}
if ( IS_IMMORTAL(ch) )
{
send_to_char( "\n\r&B---------------------------------------------------------------------&z&W\n\r", ch );
count = 0;
ch_printf( ch, "\n\r&CIMM Channels&B:\n\r" ); /* Next Line */
send_to_char( !IS_SET(ch->deaf, CHANNEL_IMMTALK)
? " &B[&G+&B] &CIMMTALK "
: " &B[&R-&B] &CIMMTALK ",
ch );
send_to_char( !IS_SET(ch->deaf, CHANNEL_LOG)
? " &B[&G+&B] &CLOG "
: " &B[&R-&B] &CLOG ",
ch );
send_to_char( !IS_SET(ch->deaf, CHANNEL_BUILD)
? " &B[&G+&B] &CBUILD "
: " &B[&R-&B] &CBUILD ",
ch );
send_to_char( !IS_SET(ch->deaf, CHANNEL_COMM)
? " &B[&G+&B] &CCOMM "
: " &B[&R-&B] &CCOMM ",
ch );
}
send_to_char( "\n\r", ch );
send_to_char( "&B---------------------------------------------------------------------&z&W\n\r", ch );
}
else
{
bool fClear;
bool ClearAll;
int bit;
bit=0;
ClearAll = FALSE;
if ( arg[0] == '+' ) fClear = TRUE;
else if ( arg[0] == '-' ) fClear = FALSE;
else
{
send_to_char( "Channels -channel or +channel?\n\r", ch );
return;
}
if ( !str_cmp( arg+1, "auction" ) ) bit = CHANNEL_AUCTION;
else if ( !str_cmp( arg+1, "chat" ) ) bit = CHANNEL_CHAT;
else if ( !str_cmp( arg+1, "ooc" ) ) bit = CHANNEL_OOC;
else if ( !str_cmp( arg+1, "clan" ) ) bit = CHANNEL_CLAN;
else if ( !str_cmp( arg+1, "guild" ) ) bit = CHANNEL_GUILD;
else if ( !str_cmp( arg+1, "quest" ) ) bit = CHANNEL_QUEST;
else if ( !str_cmp( arg+1, "tells" ) ) bit = CHANNEL_TELLS;
else if ( !str_cmp( arg+1, "immtalk" ) ) bit = CHANNEL_IMMTALK;
else if ( !str_cmp( arg+1, "log" ) ) bit = CHANNEL_LOG;
else if ( !str_cmp( arg+1, "build" ) ) bit = CHANNEL_BUILD;
else if ( !str_cmp( arg+1, "pray" ) ) bit = CHANNEL_PRAY;
else if ( !str_cmp( arg+1, "avatar" ) ) bit = CHANNEL_AVTALK;
else if ( !str_cmp( arg+1, "monitor" ) ) bit = CHANNEL_MONITOR;
else if ( !str_cmp( arg+1, "newbie" ) ) bit = CHANNEL_NEWBIE;
else if ( !str_cmp( arg+1, "music" ) ) bit = CHANNEL_MUSIC;
else if ( !str_cmp( arg+1, "ask" ) ) bit = CHANNEL_ASK;
else if ( !str_cmp( arg+1, "shout" ) ) bit = CHANNEL_SHOUT;
else if ( !str_cmp( arg+1, "yell" ) ) bit = CHANNEL_YELL;
else if ( !str_cmp( arg+1, "comm" ) ) bit = CHANNEL_COMM;
else if ( !str_cmp( arg+1, "order" ) ) bit = CHANNEL_ORDER;
else if ( !str_cmp( arg+1, "wartalk" ) ) bit = CHANNEL_WARTALK;
else if ( !str_cmp( arg+1, "all" ) ) ClearAll = TRUE;
else
{
send_to_char( "Set or clear which channel?\n\r", ch );
return;
}
if (( fClear ) && ( ClearAll ))
{
REMOVE_BIT (ch->deaf, CHANNEL_AUCTION);
REMOVE_BIT (ch->deaf, CHANNEL_CHAT);
REMOVE_BIT (ch->deaf, CHANNEL_QUEST);
REMOVE_BIT (ch->deaf, CHANNEL_PRAY);
REMOVE_BIT (ch->deaf, CHANNEL_MUSIC);
REMOVE_BIT (ch->deaf, CHANNEL_ASK);
REMOVE_BIT (ch->deaf, CHANNEL_SHOUT);
REMOVE_BIT (ch->deaf, CHANNEL_YELL);
if (ch->top_level >= LEVEL_IMMORTAL)
REMOVE_BIT (ch->deaf, CHANNEL_AVTALK);
if (ch->top_level >= sysdata.log_level )
REMOVE_BIT (ch->deaf, CHANNEL_COMM);
} else if ((!fClear) && (ClearAll))
{
SET_BIT (ch->deaf, CHANNEL_AUCTION);
SET_BIT (ch->deaf, CHANNEL_CHAT);
SET_BIT (ch->deaf, CHANNEL_QUEST);
SET_BIT (ch->deaf, CHANNEL_PRAY);
SET_BIT (ch->deaf, CHANNEL_MUSIC);
SET_BIT (ch->deaf, CHANNEL_ASK);
SET_BIT (ch->deaf, CHANNEL_SHOUT);
SET_BIT (ch->deaf, CHANNEL_YELL);
if (ch->top_level >= LEVEL_IMMORTAL)
SET_BIT (ch->deaf, CHANNEL_AVTALK);
if (ch->top_level >= sysdata.log_level)
SET_BIT (ch->deaf, CHANNEL_COMM);
} else if (fClear)
{
REMOVE_BIT (ch->deaf, bit);
} else
{
SET_BIT (ch->deaf, bit);
}
send_to_char( "Ok.\n\r", ch );
}
return;
}
-------------------------------------------------------------------------------------------------
make clean
make
copyover/reboot mud
Any problems please contact me at the provided email address,
-,,,.,,,,-
_'Diablo'_ Star Wars Development
''''''
[*]------------------------------------------------[*]
||| If you have any problems please contact me at: |||
||| crazy_mike_316@hotmail.com |||
[*]------------------------------------------------[*]