Staff and Wand Recharger.

From: David A. Carver (
Date: 12/26/95

Here's a bit of code some of you might find of use.  I've modified Strom's 
LostLands Engraver special proc, to make a special proc for a machine that 
recharges STAFF's and WANDS.  I've had this running in my MUD for a while 
now and it seems to be working fine.  Remember to assign the object the 
spec_proc in spec_assign.c.  This can easily be modified for use with a
MOB if you prefer.  You will also need to add the RECHARGE command to

================ Spec_Proc Recharge below ====================
  char buf[MAX_STRING_LENGTH];
  struct obj_data *obj;
  int maxcharge = 0, mincharge = 0, chargeval = 0;

  if (CMD_IS("list"))
    send_to_char("You may use the SWEET machine to recharge a staff or 
wand.\r\n", ch);
    send_to_char("It costs 10000 coins to recharge a staff or wand.\r\n", 
    send_to_char("To recharge and item say: Recharge Staff or Recharge 
Wand.\r\n", ch);
    return (TRUE);
  } else
    if (CMD_IS("recharge")) {
    argument = one_argument(argument, buf);

    if (!(obj = get_obj_in_list_vis(ch, buf, ch->carrying)))
      send_to_char("You don't have that!\r\n", ch);
      return (TRUE);
    if (GET_OBJ_TYPE(obj) != ITEM_STAFF &&
        GET_OBJ_TYPE(obj) != ITEM_WAND)
      send_to_char("Are you daff!!! You can't recharge that!!\r\n", ch);
      return (TRUE);
    if (GET_GOLD(ch) < 10000) {
      send_to_char("You don't have enough gold!\r\n", ch);
      return (TRUE);
    maxcharge = GET_OBJ_VAL(obj, 1);
    mincharge = GET_OBJ_VAL(obj, 2);

    if (mincharge < maxcharge)
     chargeval = maxcharge - mincharge;
     GET_OBJ_VAL(obj, 2) += chargeval;
     GET_GOLD(ch) -= 10000;
     sprintf(buf, "The item now has %d charges remaining.\r\n", maxcharge);
     send_to_char(buf, ch);
     act("The machine hums and churns as it recharges the item.",
          FALSE, ch, obj, 0, TO_ROOM);
     send_to_char("Item does not need recharging.\r\n", ch);
     act("The machine hums, churns, and then goes quiet.",
         FALSE, ch, obj, 0, TO_ROOM);
    return 1;
  return 0;
===================== End Recharge ======================
Thought for the day:
    The only thing that hurts more than paying income tax
    is not having to pay income tax.

| David Carver, Programmer Analyst        "Spooooooooonnnnnn!!!"   |      
| Columbus State Community College               -- The Tick       |
| Email:                          | 

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