Donations - This code allows the player to 'donate' objects to rooms where others may come and take what they need freely. An optional second 'clan' (or 'guild' or 'order') argument may be given to specify that the player wants to donate to his group's donation room. No second argument (or anything other than 'clan, 'guild' or 'order') as second argument causes the object to be sent to the public donation rooms, where they are sorted according to object->item_type - with armor, lights, and weapons going into one room, and any other eligible objects going to another room. The 'clan' argument causes any eligible object to go to the clan storeroom. Open mud.h and find this: #define ROOM_AUTH_START 100 #define ROOM_VNUM_HALLOFFALLEN 21195 Right after that, add this: #define ARMOR_DONATION_VNUM 21193 // Change these to whatever you want, if you aren't #define OTHER_DONATION_VNUM 21192 // using the stock newdark.are Drop this into the bottom of act_obj.c: /* I have changed the storerooms so that any room that is flagged as * CLANSTOREROOM will save it's contents, without needing to be clan * affiliated. The new storeroom code was originally written by Rhys * with a few minor modifications by myself. The storeroom code requires * that the character be in the room, in order to write out it's contents * to file. Therefore I have made this code so that the donating char * is momentarily transported to the donation room, and then brought * back to their original location. I consider this to be inefficient * and will change this around, when I have the time to code it. -Sadiq */ void do_donate(CHAR_DATA *ch, char *argument) { OBJ_DATA *obj; ROOM_INDEX_DATA *tVnum=NULL, *tStoreroom=NULL; char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; argument = one_argument( argument, arg1 ); argument = one_argument( argument, arg2 ); /* Commented this out to see if we can play with some evil tricks ::grin:: * i.e. 'Mob disarms you! Mob gets your sword. Mob donates your sword to public * room!' etc, etc... -Sadiq */ /* if( IS_NPC(ch) ) { send_to_char( "Mob's can't donate!\n\r", ch); return; } */ if ( arg1[0] == '\0' ) { send_to_char( "Syntax: DONATE [clan].\n\r", ch ); return; } if (ch->position <= POS_FIGHTING && ch->level < LEVEL_IMMORTAL) { send_to_char("You are much too busy trying to stay alive to think about donating anything!\n\r",ch); return; } if ( (obj = get_obj_carry (ch, arg1)) == NULL) { if( (obj = get_obj_wear(ch, arg1)) != NULL ) { send_to_char("If you want to donate that, you will have to remove it first!\n\r", ch); return; } else { send_to_char("You do not have that!\n\r",ch); return; } } /* Now that we can reference the object and it's specific properties, let's make some more checks */ if (obj->timer > 0) { send_to_char("You cannot donate a decaying object.\n\r",ch); return; } if (!can_drop_obj(ch, obj) && ch->level < LEVEL_IMMORTAL ) { send_to_char("A mysterious force prevents you from donating that!\n\r",ch); return; } if( (obj->item_type != ITEM_LIGHT ) && (obj->item_type != ITEM_SCROLL ) && (obj->item_type != ITEM_WAND ) && (obj->item_type != ITEM_STAFF ) && (obj->item_type != ITEM_WEAPON ) && (obj->item_type != ITEM_FIREWEAPON ) && (obj->item_type != ITEM_MISSILE ) && (obj->item_type != ITEM_ARMOR ) && (obj->item_type != ITEM_POTION ) && (obj->item_type != ITEM_CONTAINER ) && (obj->item_type != ITEM_DRINK_CON ) && (obj->item_type != ITEM_PEN ) && (obj->item_type != ITEM_BOAT ) && (obj->item_type != ITEM_PILL ) && (obj->item_type != ITEM_PIPE ) && (obj->item_type != ITEM_HERB_CON ) && (obj->item_type != ITEM_HERB ) && (obj->item_type != ITEM_INCENSE ) && (obj->item_type != ITEM_BOOK ) && (obj->item_type != ITEM_MISSILE_WEAPON )&& (obj->item_type != ITEM_PROJECTILE ) && (obj->item_type != ITEM_QUIVER ) && (obj->item_type != ITEM_SHOVEL ) && (obj->item_type != ITEM_SALVE ) && (obj->item_type != ITEM_KEYRING ) ) { send_to_char("That is not an acceptable donation object!\n\r", ch); return; } /* Okay, we have run them through the mill, and grudgingly allowed that they CAN donate... * So where do we send the object in question?? */ /* * First off, let's tag the room the char is in NOW, so we can send him back * without messing with other commands (like RETRAN). */ tVnum = ch->in_room; if(!str_cmp(arg2, "clan") || !str_cmp(arg2, "order") || !str_cmp(arg2, "guild") ) { if(IS_NPC(ch)) { send_to_char("Mobs aren't in clans!\n\r", ch); return; } if(!IS_CLANNED(ch) && !IS_ORDERED(ch) && !IS_GUILDED(ch) ) { send_to_char("Just what group, exactly, would that be??\n\r", ch); return; } tStoreroom = get_room_index(ch->pcdata->clan->storeroom); act( AT_ACTION, "You send $p, off to your group's storeroom...", ch, obj, NULL, TO_CHAR ); separate_obj(obj); obj_from_char(obj); obj_to_room(obj, tStoreroom); /* Now that the object is safely tucked away in the clan storeroom, let's move * the char there, so we can save it. ::grumble::: I NEED to change save_clan_storeroom() ! */ char_from_room( ch ); char_to_room( ch, tStoreroom ); if ( IS_SET(ch->in_room->room_flags, ROOM_CLANSTOREROOM) ) // This is a waste. This check should be in { // save_clan_storeroom(), instead of writing save_clan_storeroom(ch); // it over and over, through-out the mud. } /* ...and then move them back to where they were. */ char_from_room( ch ); char_to_room( ch, tVnum ); return; } /* If they didn't enter 'clan', 'order', or 'guild' as second argument, then they will * end up here...regardless of whatever else they input. We've already checked to make * sure that they have an eligible object and that it is going to a public donation room, * (i.e. not a clan storeroom, which suits our purposes) so here we just need to do the * actual donation rigamarole... */ else { /* Public donation rooms are likely to have MANY times more donations than clan storerooms, * so we'll let the code sort the donations out. Armor, lights, and weapons in one room, * and any other eligible object in another. This should help to keep things managable. */ if( (obj->item_type == ITEM_LIGHT) || (obj->item_type == ITEM_WEAPON) || (obj->item_type == ITEM_FIREWEAPON ) || (obj->item_type == ITEM_MISSILE ) || (obj->item_type == ITEM_ARMOR ) || (obj->item_type == ITEM_MISSILE_WEAPON )|| (obj->item_type == ITEM_PROJECTILE ) || (obj->item_type == ITEM_QUIVER ) ) { tStoreroom = get_room_index(ARMOR_DONATION_VNUM); } else { tStoreroom = get_room_index(OTHER_DONATION_VNUM); } act( AT_ACTION, "You send $p, off to the public donation room...", ch, obj, NULL, TO_CHAR ); separate_obj(obj); obj_from_char(obj); obj_to_room(obj, tStoreroom); char_from_room( ch ); char_to_room( ch, tStoreroom ); if ( IS_SET(ch->in_room->room_flags, ROOM_CLANSTOREROOM) ) // Again, this is stupid...this check should { // be in save_clan_storeroom() save_clan_storeroom(ch); } char_from_room( ch ); char_to_room( ch, tVnum ); /* Th-th-th-th-that's all, folks! */ return; } } Make the appropriate entries for do_donate in tables.c and add the DECLARE_DO_FUN to mud.h Make clean and recompile. Enjoy Sadiq