[CODE] Whois command for C30bpl18 with ASCII

From: NeoStar (neostar@inorbit.com)
Date: 09/09/01


Ok this code is probably -very- newbie-ish, because it's my first. :)
Anyway it's designed for those people with ASCII patches because the one on
the ftp site doesn't work. This isn't entirely my own work, I stole a bit
of the code from do_set in act.wizard.c.

<-----Snip-------[
/* WHOIS command for Circle 3.0 b pl 18 with any ASCII pfiles
 * patch. This code is not guaranteed to work with your MUD, it was
 * tested on stock Circle with an ASCII patch installed. It *should*
 * work for you.
 *    Questions/Comments: neostar@inorbit.com
 *      Flames/Hate mail: bill@microsoft.com ;)
*/

void whois_char(struct char_data * ch, struct char_data * v)
{
  int classnum;
  const char *vclass[5] = {
    "a Warrior",      // 0
    "a Thief",        // 1
    "a Magic User",   // 2
    "a Cleric",       // 3
    "a bug?!"};       // 4

    if(GET_CLASS(v) == CLASS_WARRIOR) classnum = 0;
    else if(GET_CLASS(v) == CLASS_THIEF) classnum = 1;
    else if(GET_CLASS(v) == CLASS_MAGIC_USER) classnum = 2;
    else if(GET_CLASS(v) == CLASS_CLERIC) classnum = 3;
    else classnum = 4
         sprintf(buf, "%s %s is a %s, at level: %d.\r\n", GET_NAME(k),
GET_TITLE(k), vclass[classnum], GET_LEVEL(v))
       send_to_char(buf, ch);
}

ACMD(do_whois)
{
  struct char_data *victim;
  one_argument(argument, buf1);

  if (!*buf1) {
    send_to_char("Who?\r\n", ch);
    return;
   } else {
      if ((victim = get_player_vis(ch, buf1, NULL, FIND_CHAR_WORLD)) !=
NULL)
     whois_char(ch, victim);
      else {
       CREATE(victim, struct char_data, 1);
       clear_char(victim);
       CREATE(victim->player_specials, struct player_special_data, 1);
       if (load_char(buf1, victim) > -1) {
      char_to_room(victim, 0);
        whois_char(ch, victim);
      extract_char_final(victim);
      } else {
      send_to_char("There is no such player.\r\n", ch);
        free_char(victim);
}}}}
]---------Snip------->

If you have any modifications to make this code more efficient please
inform me :)

-Neostar

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST