nodonate.txt
snippets · 1.5 KB · 2010-03-30
Nodonate flag: stops items being donated (tables.c extra_flags).
Download « Back to the snippets list
The first thing you want to do is declare it in tables.c
under extra_flags right before:
{ NULL, 0, 0 }
add:
{ "nodonate", ITEM_NODONATE, TRUE },
what this does is tells the mud that nodonate is the string attached to ITEM_NODONATE
Now open merc.h and search for #ITEM_GLOW. You will want to look for the next highest letter.
For example A-Z, X is missing. So you can put a ITEM_ there. You can use letters up to (ee).
After that no more ITEM_ can be used for that flag.
add:
#define ITEM_NODONATE (X)
Open handler.c and search for the char *extra_bit_name( int extra_flags )
This is what assigns the name to each ITEM_
Add anywhere in this function:
if ( extra_flags & ITEM_NODONATE ) strcat( buf, " nodonate" );
This should be all that is required to make the flag work.
Now for the hard(er) part
As this is right now it is nothing more than a flag. The next step is to make it so when
someone tries to donate the object it tells them that the object can't be.
Open act_info.c and search for do_donate
add somewhere before
if (ch->in_room != get_room_index(OBJ_VNUM_PIT))
{
act("$n donates {R$p{x.",ch,obj,NULL,TO_ROOM);
act("You donate {R$p{x.",ch,obj,NULL,TO_CHAR);
}
this:
if (IS_SET(obj->extra_flags, ITEM_NODONATE)
{
send_to_char("This item has a nodonate flag on it.\n\r",ch);
return;
}
------------------------END--------------------------