Below are the modifications for my equipment command to show empty slots as well
as re-ordering eq locations. I also changed the format eq is shown in to what I feel
looks a bit cleaner. You may have to make minor modifications to fit your MUD.
constants.c
Change wear_where if you feel like, to get away from the staggering <worn blahblah>
Code:
/** Describes the position in the equipment listing.
* @pre Must be in the same order as the defines.
* Not used in sprinttype() so no \n. */
const char *wear_where[] = {
"[Light ] ",
"[Finger ] ",
"[Finger ] ",
"[Neck ] ",
"[Neck ] ",
"[Chest ] ",
"[Head ] ",
"[Legs ] ",
"[Feet ] ",
"[Hands ] ",
"[Arms ] ",
"[Shield ] ",
"[Back ] ",
"[Waist ] ",
"[Wrist ] ",
"[Wrist ] ",
"[Wielded ] ",
"[Held ] ",
"[Shoulders] ",
"[Face ] "
};
Right below this, under equipment_types add the following
Code:
const int wear_order_index[NUM_WEARS] = {
WEAR_HEAD,
WEAR_FACE,
WEAR_NECK_1,
WEAR_NECK_2,
WEAR_SHOULDERS,
WEAR_CHEST,
WEAR_BACK,
WEAR_WAIST,
WEAR_ARMS,
WEAR_WRIST_R,
WEAR_WRIST_L,
WEAR_HANDS,
WEAR_FINGER_R,
WEAR_FINGER_L,
WEAR_WIELD,
WEAR_HOLD,
WEAR_LIGHT,
WEAR_SHIELD,
WEAR_LEGS,
WEAR_FEET
};
In act.informative.c look for & add
Code:
static void look_at_char(struct char_data *i, struct char_data *ch)
{
int j, found;
+ extern int wear_order_index[NUM_WEARS];
if (!ch->desc)
return;
// If you wanted, you could also make it so others see the empty slots on your character when they look at you
// I chose not to do this but I added the "empty" to the equipment command to make it easier for you to see what equipment you are lacking.
Further down below :
Code:
if (found) {
send_to_char(ch, "\r\n"); /* act() does capitalization. */
act("$n is using:", FALSE, i, 0, ch, TO_VICT);
for (j = 0; j < NUM_WEARS; j++)
- if (GET_EQ(i, j) && CAN_SEE_OBJ(ch, GET_EQ(i, j))) {
- send_to_char(ch, "%s", wear_where[j]);
- show_obj_to_char(GET_EQ(i, j), ch, SHOW_OBJ_SHORT);
+ if (GET_EQ(i, wear_order_index[j])
+ && CAN_SEE_OBJ(ch, GET_EQ(i, wear_order_index[j]))) {
+ send_to_char(ch, "%s", wear_where[wear_order_index[j]]);
+ show_obj_to_char(GET_EQ(i, wear_order_index[j]), ch, SHOW_OBJ_SHORT);
And finally in your do_equipment function, replace it with the following :
Code:
ACMD(do_equipment)
{
int i;
extern int wear_order_index[NUM_WEARS];
send_to_char(ch, "You are using:\r\n");
for (i = 0; i < NUM_WEARS; i++) {
if (GET_EQ(ch, wear_order_index[i])) {
if (CAN_SEE_OBJ(ch, GET_EQ(ch, wear_order_index[i]))) {
send_to_char(ch, "%s", wear_where[wear_order_index[i]]);
show_obj_to_char(GET_EQ(ch, wear_order_index[i]), ch, SHOW_OBJ_SHORT);
} else {
send_to_char(ch, "%s", wear_where[wear_order_index[i]]);
send_to_char(ch, "Invisible Item\r\n");
}
} else {
send_to_char(ch, "%s", wear_where[wear_order_index[i]]);
send_to_char(ch, "Empty\r\n");
}
}
}
Hope this helps. If you have any questions let me know.
-Halenbane