perform_immort_where

From: Matt Read (mjr@doc.ic.ac.uk)
Date: 07/07/94


Ok, here it is, rather clumsy code I'm afraid, if anyone neatens it up a bit
then send me a copy...
It works with circle2.2 code and probably with anything else similar.
Obviously searching every person on the game takes time so I recommend you
make it an immort skill only, not a spell, but up to you...
Also, if anyone wants to add paging to it then that'd be appreciated.
		Free @ UnknownMud
_______________________________________________________________________
	
void perform_immort_where(struct char_data *ch, char *arg)
{
   register struct char_data *i;
   register struct obj_data *k;
   struct descriptor_data *d;
   int  num = 0, found = 0;
   int j;
   
   if (!*arg) {
      send_to_char("Players\n\r-------\n\r", ch);
      for (d = descriptor_list; d; d = d->next)
         if (!d->connected) {
           i = (d->original ? d->original : d->character);
           if (i && CAN_SEE(ch, i) && (i->in_room != NOWHERE)) {
             if (d->original)
               sprintf(buf, "%-20s - [%5d] %s (in %s)\n\r",
                       GET_NAME(i), world[d->character->in_room].number,
                       world[d->character->in_room].name,
                       GET_NAME(d->character));
             else
               sprintf(buf, "%-20s - [%5d] %s\n\r", GET_NAME(i),
                       world[i->in_room].number, world[i->in_room].name);
             send_to_char(buf, ch);
           }
         }
    } else {
      for (i = character_list; i; i = i->next)
        if (CAN_SEE(ch, i) && i->in_room != NOWHERE && isname(arg, i->player.name)) {
            found = 1;
            sprintf(buf, "%3d. %-25s - [%5d] %s\n\r", ++num, GET_NAME(i),
               world[i->in_room].number, world[i->in_room].name);
            send_to_char(buf, ch);
          }
      
      for ( i = character_list; i; i = i->next)
        for (j = 0; j < MAX_WEAR; ++j)
          if (i->equipment[j])
            if (isname(arg, i->equipment[j]->name))
              {
                sprintf(buf, "%3d: %s used by %s\n\r",
                        ++num, i->equipment[j]->short_description, GET_NAME(i));                send_to_char(buf, ch);
              }
   
      for (k = object_list; k; k = k->next)
        {
          if (CAN_SEE_OBJ(ch, k) && isname(arg, k->name))
            {
              if (k->carried_by)
                {
                  sprintf(buf, "%3d. %s carried by %s.\n\r",
                          ++num, k->short_description,
                          GET_NAME(k->carried_by));
                  send_to_char(buf, ch);
                }
              else if (k->in_obj)
                {
                  sprintf(buf, "%3d. %s in %s", ++num,
                          k->short_description, k->in_obj->short_description);
                  if (k->in_obj->carried_by)
                    {
                      sprintf(buf, "%s carried by %s\n\r", buf,
                              GET_NAME(k->in_obj->carried_by));
                    }
                  else
                    sprintf(buf, "%s\n\r", buf);
                  send_to_char(buf, ch);
                }
              else if (k->in_room != NOWHERE)
                {
                  sprintf(buf, "%3d. %-25s - [%5d] %s\n\r", ++num,
                          k->short_description, world[k->in_room].number,
                          world[k->in_room].name);
                  send_to_char(buf, ch);
                }
              found = 1;
            }
        }
      if (!found)
        send_to_char("Couldn't find any such thing.\n\r", ch);
    }
   
 }



This archive was generated by hypermail 2b30 : 12/07/00 PST