|
Recharger For Wand And Staff [by David Carver] |
|
|
|
Posted Wednesday, August 12th @ 11:35:16 PM, by George Greer in the Specials dept.
. Click the link below to read it or download it.
From: David A. Carver <DCARVER@cougar.colstate.cc.oh.us>
Subject: Staff And Wand Recharger
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 'interpreter.c' as a 'do_not_here' command.
Add this special below in 'spec_proc.c'
SPECIAL(recharger)
{
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", ch);
send_to_char("To recharge and item type: 'recharge <staff or 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 daft! 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;
send_to_char("Grrrr... Hmmmmm... Belch... BING!\r\n",ch);
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);
}
else
{
send_to_char("The 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;
}
<< Recharge Spell [by Franco] | Reply | View as text | Threaded | Regen Objects [by Robert Sinland] >> |
|
Related Links |
|
|
|
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.
|
|
|
|
|
|
|