Do_Who.txt
snippets · 3.7 KB · 2010-03-30
do_who replacement with colors and immortal/mortal sections, for ROM-style MUDs.
Download « Back to the snippets list
void do_who (CHAR_DATA * ch, char *argument)
{
char buf[MAX_STRING_LENGTH];
BUFFER *output;
DESCRIPTOR_DATA *d;
int wlevel;
int nMatch;
int iMatch;
bool imm = FALSE;
bool mor = FALSE;
sprintf (buf, "\n\r {cThe Land of {CA{ceternitas{x\n\r\n\r");
send_to_char(buf, ch);
nMatch = 0;
iMatch = 0;
buf[0] = '\0';
output = new_buf ();
for ( wlevel=MAX_LEVEL; wlevel>0; wlevel-- )
{
for (d = descriptor_list; d != NULL; d = d->next)
{
CHAR_DATA *wch;
if (d->connected != CON_PLAYING || !can_see (ch, d->character))
continue;
wch = (d->original != NULL) ? d->original : d->character;
if( wch->level != wlevel )
continue;
if (wch->level >= 52)
imm = TRUE;
if (wch->level <= 51)
mor = TRUE;
if (!can_see (ch, wch))
continue;
}
}
if (imm)
{
sprintf (buf, " {c--{G={c-{G={c-{G={c-{G= {YImmortals {G={c-{G={c-{G={c-{G={c--{W{X\n\r\n\r");
send_to_char(buf, ch);
}
for ( wlevel=MAX_LEVEL; wlevel>0; wlevel-- )
{
for (d = descriptor_list; d != NULL; d = d->next)
{
CHAR_DATA *wch;
if (d->connected != CON_PLAYING || !can_see (ch, d->character))
continue;
wch = (d->original != NULL) ? d->original : d->character;
if( wch->level != wlevel )
continue;
if (!can_see (ch, wch))
continue;
if (wch->level < 52)
continue;
iMatch++;
sprintf (buf, "{m[ {x%6s {m]{x %s%s%s%s%s%s%s%s{X\n\r",
wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name
: " ",
wch->incog_level >= LEVEL_HERO ? "(Incog) " : "",
wch->invis_level >= LEVEL_HERO ? "(Wizi) " : "",
clan_table[wch->clan].who_name,
IS_SET (wch->comm, COMM_AFK) ? "[AFK] " : "",
IS_SET (wch->act, PLR_KILLER) ? "(KILLER) " : "",
IS_SET (wch->act, PLR_THIEF) ? "(THIEF) " : "",
wch->name, IS_NPC (wch) ? "" : wch->pcdata->title);
add_buf (output, buf);
}
}
if (mor)
{
sprintf (buf, "\n\r {c--{G={c-{G={c-{G={c-{G= {Y Mortals {G={c-{G={c-{G={c-{G={c--{W{X\n\r\n\r");
add_buf (output, buf);
}
for ( wlevel=MAX_LEVEL; wlevel>0; wlevel-- )
{
for (d = descriptor_list; d != NULL; d = d->next)
{
CHAR_DATA *wch;
if (d->connected != CON_PLAYING || !can_see (ch, d->character))
continue;
wch = (d->original != NULL) ? d->original : d->character;
if( wch->level != wlevel )
continue;
if (!can_see (ch, wch))
continue;
if (wch->level > 52)
continue;
nMatch++;
sprintf (buf, "{m[ {x%6s {m]{x %s%s%s%s%s%s%s%s{X\n\r",
wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name
: " ",
wch->incog_level >= LEVEL_HERO ? "(Incog) " : "",
wch->invis_level >= LEVEL_HERO ? "(Wizi) " : "",
clan_table[wch->clan].who_name,
IS_SET (wch->comm, COMM_AFK) ? "[AFK] " : "",
IS_SET (wch->act, PLR_KILLER) ? "(KILLER) " : "",
IS_SET (wch->act, PLR_THIEF) ? "(THIEF) " : "",
wch->name, IS_NPC (wch) ? "" : wch->pcdata->title);
add_buf (output, buf);
}
}
sprintf (buf, "\n\rPlayers found: %d Immortals found : %d\n\r", nMatch, iMatch);
add_buf (output, buf);
page_to_char (buf_string (output), ch);
free_buf (output);
return;
}