Cleanse command

From: Josh Anderson (joshua18@home.com)
Date: 05/27/00


I posted this command to the Ceramic Mouse website, but as I'm not sure how
often those bins get emptied I'm going to post what I wrote here as well.
It's a stodgy bit o' code that could most likely be torn to shreds,
optimized, used to filter coffee, and then turned inside out and
resubmitted, so if any of you feel froggy go ahead : )

This command was written because I used to work for a mud that had big
problems with random objects appearing throughout the realm, mostly in
storage rooms or replacing people's equipment.  Obviously this causes rather
huge problems, say, if a person had a massive statue or pool of water appear
in their backpack or a guild board appearing in a save room.  We then as
staff members had to rush around the world and try to gather up and get rid
of these items.  This command basically is a 'purge all' kind of command
that works off of a supplied vnum.  It gets rid of every object/mob in the
entire world with the vnum you specify.  This does have limited use if you
don't have such problems, but as I always say, better to be safe than sorry
and also, I just like snazzy, showy immortal commands ; )

It should be implemented as any other command; I put my code in
act.wizard.c.

ACMD(do_cleanse)
{
  struct char_data *i;
  struct obj_data *k;
  mob_vnum number;
  mob_rnum r_num;
  char type[10];
  int num = 0, found = 0;

  two_arguments(argument, buf, buf2);

  if (!*buf || !*buf2 || !isdigit(*buf2)) {
    send_to_char("Usage: cleanse { obj | mob } <number>\r\n", ch);
    return;
  }
  if ((number = atoi(buf2)) < 0) {
    send_to_char("A negative number?\r\n", ch);
    return;
  }
  if (is_abbrev(buf, "mob"))
  {
    if ((r_num = real_mobile(number)) < 0)
    {
      send_to_char("There is no monster with that number.\r\n", ch);
      return;
    }
    for (i = character_list; i; i = i->next)
      if (CAN_SEE(ch, i) && i->in_room != NOWHERE && (GET_MOB_VNUM(i) ==
number))
      {
        found = 1;
        strcpy(type, "mobs");
        extract_char(i);
      }
  }
  else if (is_abbrev(buf, "obj"))
  {
    if ((r_num = real_object(number)) < 0)
    {
      send_to_char("There is no object with that number.\r\n", ch);
      return;
    }
    for (num = 0, k = object_list; k; k = k->next)
      if (CAN_SEE_OBJ(ch, k) && (GET_OBJ_VNUM(k) == number))
      {
        found = 1;
        strcpy(type, "objs");
        extract_obj(k);
      }
  }
  if (!found)
  {
    send_to_char("Couldn't find any such thing.\r\n", ch);
    return;
  }
  act("$n gathers massive destructive energies around $s body...", FALSE,
ch, 0, 0, TO_ROOM);
  act("$e releases them in a wild blast to all the corners of the world!",
FALSE, ch, 0, 0, TO_ROOM);
  send_to_char("You release massive amounts of cleansing energies into the
world!\r\n", ch);
  sprintf(buf1, "(GC) %s has cleansed the world of all %s with vnum #%d.",
GET_NAME(ch), type, number);
  mudlog(buf1, BRF, MAX(LVL_SEN_ADMIN, GET_INVIS_LEV(ch)), TRUE);
}

Forgive the ugliness of the mailer output as I just cut and pasted : )
Enjoy.

Josh Anderson
joshua18@home.com


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 04/10/01 PDT