Vwear command [by WarRat]
Snippet Posted Wednesday, August 12th @ 11:38:35 PM, by George Greer in the Wizard dept.
Updated May 23, 1997. Click the link below to read it or download it.

From: WarRat <warrat@erinet.com>
Additions From: Chris Jacobson <fear@athenet.net>
Subject: vwear command

At the request of my builder, I made a command called vwear (see below).
What this does is goes through the objects and prints a list of all the
objects in a wear position.

Usage is:  vwear <position>

It's just a quick hack of vnum but could be useful for those people trying
to decide what type of equipment needs to be created.

Feel free to use it...the code is not all that tight, if you make it better,
please send me (and the list) a copy.

In act.wizard.c:

ACMD(do_vwear)
{
  one_argument(argument, buf);

  if (!*buf) {
    send_to_char("Usage: vwear <wear position>\r\n"
          "Possible positions are:\r\n"
          "finger    neck    body    head    legs    feet    hands\r\n"
          "shield    arms    about   waist   wrist   wield   hold\r\n", ch);
    return;
  }
  if (is_abbrev(buf, "finger"))
    vwear_object(ITEM_WEAR_FINGER, ch);
  else if (is_abbrev(buf, "neck"))
    vwear_object(ITEM_WEAR_NECK, ch);
  else if (is_abbrev(buf, "body"))
    vwear_object(ITEM_WEAR_BODY, ch);
  else if (is_abbrev(buf, "head"))
    vwear_object(ITEM_WEAR_HEAD, ch);
  else if (is_abbrev(buf, "legs"))
    vwear_object(ITEM_WEAR_LEGS, ch);
  else if (is_abbrev(buf, "feet"))
    vwear_object(ITEM_WEAR_FEET, ch);
  else if (is_abbrev(buf, "hands"))
    vwear_object(ITEM_WEAR_HANDS, ch);
  else if (is_abbrev(buf, "arms"))
    vwear_object(ITEM_WEAR_ARMS, ch);
  else if (is_abbrev(buf, "shield"))
    vwear_object(ITEM_WEAR_SHIELD, ch);
  else if (is_abbrev(buf, "about body"))
    vwear_object(ITEM_WEAR_ABOUT, ch);
  else if (is_abbrev(buf, "waist"))
    vwear_object(ITEM_WEAR_WAIST, ch);
  else if (is_abbrev(buf, "wrist"))
    vwear_object(ITEM_WEAR_WRIST, ch);
  else if (is_abbrev(buf, "wield"))
    vwear_object(ITEM_WEAR_WIELD, ch);
  else if (is_abbrev(buf, "hold"))
    vwear_object(ITEM_WEAR_HOLD, ch);
  else
          send_to_char("Possible positions are:\r\n"
          "finger    neck    body    head    legs    feet    hands\r\n"
          "shield    arms    about   waist   wrist   wield   hold\r\n", ch);
}


In db.c:
void vwear_object(int wearpos, struct char_data * ch)
{
  int nr, found = 0;
  for (nr = 0; nr <= top_of_objt; nr++) {
    if (CAN_WEAR(&obj_proto[nr], wearpos)) {
     sprintf(buf, "%3d. [%5d] %s\r\n", ++found,
     obj_index[nr].virtual, obj_proto[nr].short_description);
     send_to_char(buf, ch);
    }
  }
}

In db.h:
void vwear_object(int wearpos, struct char_data * ch);

In util.h:
In the CAN_WEAR macro replace 'obj' with '&obj_proto[nr]'

In interpreter.c
ACMD(do_vwear);

and

  { "vwear"    , POS_DEAD    , do_vwear    , LVL_AVATAR, 0 },



<< Verify Command [by James Turner] | Reply | View as text | Flattened | Vwear command, cont. [by Christian Duvall] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.