wearlocation.txt
snippets · 2.6 KB · 2010-03-30
Wear location: adds a new wear location (ACT_INFO.C where_name list).
Download « Back to the snippets list
/* ACT_INFO.C */
In char *const where_name[][ = { add in:
choose one
"<worn on/in/as/around/about location> ",
/* EXAMPLE USE ABOVE FOR ONLY ONE LOCATION (HEAD) */
"{C<worn on left ear> {x",
"{C<worn on right ear> {x",
/* ACT_OBJ */
if (CAN_WEAR (obj, ITEM_WEAR_<loacation>))
{
if (!remove_obj (ch, WEAR_<LOCATION>, fReplace))
return; choose one
act ("$n wears $p in/on/as/around/about $s <location name>.", ch, obj, NULL, TO_ROOM);
act ("You wear $p in/on/as/around/about your <lacation name>.", ch, obj. NULL, TO_CHAR);
equip_char (ch, obj, WEAR_<LACATION>);
return;
}
/* EXAMPLE FOR EARS/HANDS/EYES IF ONLY ONE (HEAD) USE ABOVE */
if (CAN_WEAR (obj, ITEM_WEAR_EAR))
{
if (get_eq_char (ch, WEAR_EAR_L) != NULL
&& get_eg_char (ch, WEAR_EAR_R) != NULL
&& !remove_obj (ch, WEAR_EAR_L, fReplace)
&& !remove_obj (ch, WEAR_EAR_R, fReplace))
return;
if (get_eq_char (ch, WEAR_EAR_L) == NULL)
{
act ("$n wears $p on $s left eye.", ch, obj, NULL, TO_ROOM);
act ("You wear $p on your left eye.", ch, obj, NULL, TO_CHAR);
equip_char (ch, obj, WEAR_EAR_L);
return;
}
if (get_eq_char (ch, WEAR_EAR_R) == NULL)
{
act ("$n wears $p on $s right ear.", ch, obj, NULL, TO_ROOM);
act ("You wear $p on your right ear.", ch, obj,NULL, TO_CHAR);
equip_char (ch, obj, WEAR_EAR_R);
return;
}
bug ("wear_obj: no free eye.", 0);
sendch ("You already wear two eye items.\n\r", ch);
return;
}
/* HANDLER.C */
in switch (iWear) add:
case WEAR_<LOACATION>:
return obj->value[type];
/* FOR EXAMPLE REMEMBER IF YOU HAVE MORE THEN ONE USE BELOW, ONLY ONE USE ABOVE */
case WEAR_EAR_L:
return 2 * obj->vaule->[type];
case WEAR_EAR_R:
return 2 * obj->vaule->[type];
/* IF THERE ARE NUMBERS PLACE WITH REST OF THE NUMBERS */
/* SEARCH FOR static char buf[512]; */
Add in the following:
if (wear_flags & ITEM_<LOCATION>)
strcat (buf, " <location>");
/* EXAMPLE */
if (wear_flags & ITEM_EARS)
strcat (buf, " ears");
/* TABLES.C */
in cost struct flag_type wear_flags[] = {
add in:
{"location", ITEM_WEAR_<LOCATION>, TRUE},
/* EXAMPLE */
{"ears", ITEM_WEAR_EARS, TRUE},
In const struct flag_type wear_loc_string_strings[] = {
add in:
{"in/on/about/over/around", WEAR_<LOCATION>, TRUE},
/* EXAMPLE */
{"in the left ear", WEAR_EAR_L, TRUE},
{"in the right ear", WEAR_EAR_R, TRUE},
In const struct flag_type wear_loc_flags[] = {
Add:
{"<location>", WEAR_<LOCATION>, TRUE},
/* EXAMPLE */
{"lear", WEAR_EAR_L, TRUE},
{"rear", WEAR_EAR_R, TRUE},