HOLSTER AND DRAW COMMANDS FOR SWR BY KOUMINTANG KOWTOW 
                                      of STAR WARS REBELLION UPRISNG
----------------------------------------------------------------------------

Feel free to use this snippet as you see fit, and distribute it as you wish.
All I ask is you keep the credits and the comments in where they belong.  I
am not responsible for any damage done to your mud from this code, but I am 
willing to help you figure out any problems.  Questions for this code can be
sent to, littlejay_43019@yahoo.com

----------------------------------------------------------------------------
****************************************************************************
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
BE ADVISED!!!!  THIS CODE USES THE HOLSTER WEAR LOCATIONS  I MODIFIED THEM 
TO BE LEFT AND RIGHT HOLSTERS!!  IF YOU HAVE NOT ADDED HOLSTERS TO YOUR GAME
YET DO SO FIRST, OR BE READY TO ADD THEM WHILE YOU ARE ADDING THIS CODE!

THIS CODE CAN BE EASILY MODIFIED IN ORDER TO WORK WITH A SINGLE HOLSTER
WEAR LOCATION.

THIS CODE ALSO MAKE IT SO THAT THE HOLSTERS WILL ONLY HOLD ONE OBJECT NO
MORE.  ALSO EASILY MODIFIED TO HOLD MULTIPLE ITEMS.  
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
****************************************************************************
----------------------------------------------------------------------------
FILES TO BE MODIFIED:

FIGHT.C
MUD.H
ACT_OBJ.C
TABLES.C

----------------------------------------------------------------------------
Without further ado, lets get to the code.

============================================================================
IN FIGHT.C
----------------------------------------------------------------------------
AT THE BOTTOM OF THE FILE ADD THE FOLLOWING:

/*
 * Use HOLSTER to conceal the weapons.
 * Holster command by Koumintang Kowtow
 * send questions and comments to littlejay_43019@yahoo.com
 */
void do_holster (CHAR_DATA *ch, char *argument)
{
   OBJ_DATA *wield, *dual, *holster1, *holster2;

   wield = get_eq_char(ch, WEAR_WIELD );
   dual = get_eq_char( ch, WEAR_DUAL_WIELD );
   holster1 = get_eq_char( ch, WEAR_HOLSTER_L );
   holster2 = get_eq_char( ch, WEAR_HOLSTER_R );
   if (!wield)
   {
	send_to_char("You are not wielding a weapon to holster\n\r", ch);
	return;
   }
   else if (wield)
   {
	if (dual)
	{
	   if( (!holster1) && (!holster2) )
	   {
	   	send_to_char("You do not have a holster free to put a weapon.\n\r", ch);
	   	return;
	   }
	   if ( (holster1 ) && (!holster1->first_content) )
	   {
	   	obj_from_char( dual );
	   	dual = obj_to_obj( dual, holster1 );
	   	holster1->value[4] = 1;
		act( AT_ACTION, "$n holsters $p in $P.", ch, dual, holster1, TO_ROOM );
		act( AT_ACTION, "You holster $p in $P.", ch, dual, holster1, TO_CHAR );
		return;
	   }
	   if ( (!holster1 ) && ( (holster2) && ( !holster2->first_content) ) )
	   {
	   	obj_from_char( dual );
	   	dual = obj_to_obj( dual, holster2 );
	   	holster2->value[4] = 1;
		act( AT_ACTION, "$n holsters $p in $P.", ch, dual, holster2, TO_ROOM );
		act( AT_ACTION, "You holster $p in $P.", ch, dual, holster2, TO_CHAR );
		return;

	   }
	   else if ( ( (holster2 &&  !holster2->first_content )) && ( holster1 ) )
	   {
	   	obj_from_char( dual );
	   	dual = obj_to_obj( dual, holster2 );
	   	holster2->value[4] = 1;
		act( AT_ACTION, "$n holsters $p in $P.", ch, dual, holster2, TO_ROOM );
		act( AT_ACTION, "You holster $p in $P.", ch, dual, holster2, TO_CHAR );
	   	return;
	   }
	   else
	   {
		send_to_char("You have no empty holsters1.\n\r", ch);
		return;
	   }
	}
	else
	{
	   if( ( !holster1 ) && ( !holster2 ) )
	   {
	   	send_to_char("You do not have a holster free to put a weapon.\n\r", ch);
	   	return;
	   }
	   else if ( ( holster1 ) && (!holster1->first_content) )
	   {
	   	obj_from_char( wield );
	   	wield = obj_to_obj( wield, holster1 );
	   	holster1->value[4] = 1;
		act( AT_ACTION, "$n holsters $p in $P.", ch, wield, holster1, TO_ROOM );
		act( AT_ACTION, "You holster $p in $P.", ch, wield, holster1, TO_CHAR );
	   	return;
	   }
	   else if ( ( !holster1 ) && ( ( holster2 ) && ( !holster2->first_content ) ) )
	   {
	   	obj_from_char( wield );
	   	wield = obj_to_obj( wield, holster2 );
	   	holster2->value[4] = 1;
		act( AT_ACTION, "$n holsters $p in $P.", ch, wield, holster2, TO_ROOM );
		act( AT_ACTION, "You holster $p in $P.", ch, wield, holster2, TO_CHAR );
	   	return;
	   }
	   else if ( ( ( holster2 &&  !holster2->first_content )) && ( holster1 ) )
	   {
	   	obj_from_char( wield );
	   	wield = obj_to_obj( wield, holster2 );
	   	holster2->value[4] = 1;
		act( AT_ACTION, "$n holsters $p in $P.", ch, wield, holster2, TO_ROOM );
		act( AT_ACTION, "You holster $p in $P.", ch, wield, holster2, TO_CHAR );
	   	return;
	   }
	   else
	   {
	   	send_to_char("You have no empty holsters2.\n\r", ch );
	   	return;
	   }
	}
   }
}
/*
 * Allows you to DRAW weapons. Use HOLSTER to conceal the weapons.
 */
void do_draw( CHAR_DATA *ch, char *argument )
{
   OBJ_DATA *holster1, *holster2;
   OBJ_DATA *draw1 = NULL, *draw2 = NULL, *held = NULL;

   holster1 = get_eq_char( ch, WEAR_HOLSTER_L );
   holster2 = get_eq_char( ch, WEAR_HOLSTER_R );
   draw1 = get_eq_char( ch, WEAR_WIELD );
   draw2 = get_eq_char( ch, WEAR_DUAL_WIELD );

   if (!holster1 && !holster2)
   {
	send_to_char("Your not wearing any holsters!\n\r", ch );
	return;
   }

   if (draw2)
   {
	send_to_char("You already have two weapons drawn!\n\r", ch);
	return;
   }
   else if(!draw1)
   {
	if ( (holster1 ) && ( !holster2 ) )
	{
	   if( holster1->last_content == NULL )
	   {
		send_to_char("You have no weapons in your holsters.\n\r", ch);
		return;
	   }
	   else if( holster1->last_content->item_type == ITEM_WEAPON )
	   {
	   	draw1 = holster1->last_content;
	   	if ( draw1 != NULL )
	   	{
         	   obj_from_obj( draw1 );
         	   draw1 = obj_to_char( draw1, ch );
         	   equip_char( ch, draw1, WEAR_WIELD );
         	   act( AT_ACTION, "$n draws $p from $P.", ch, draw1, holster1, TO_ROOM );
         	   act( AT_ACTION, "You draw $p from $P.", ch, draw1, holster1, TO_CHAR );
		   return;
    	   	}
	   }
	   else
	   {
		send_to_char("You have no weapons in your holsters.\n\r", ch);
		return;
	   }
	}
	else if ( (!holster1 ) && ( holster2 ) )
	{
	   if( holster2->last_content == NULL )
	   {
		send_to_char("You have no weapons in your holsters.\n\r", ch);
		return;
	   }
	   else if( holster2->last_content->item_type == ITEM_WEAPON )
	   {
	   	draw1 = holster2->last_content;
	   	if ( draw1 != NULL )
	   	{
         	   obj_from_obj( draw1 );
         	   draw1 = obj_to_char( draw1, ch );
         	   equip_char( ch, draw1, WEAR_WIELD );
         	   act( AT_ACTION, "$n draws $p from $P.", ch, draw1, holster2, TO_ROOM );
         	   act( AT_ACTION, "You draw $p from $P.", ch, draw1, holster2, TO_CHAR );
		   return;
    	   	}
	   }
	   else
	   {
		send_to_char("You have no weapons in your holsters.\n\r", ch);
		return;
	   }
	}
	else if ( (holster1 ) && ( holster2 ) )
	{
	   if( holster1->last_content == NULL && holster2->last_content == NULL)
	   {
		send_to_char("You have no weapons in your holsters.\n\r", ch);
		return;
	   }
	   else if( ( (holster1->last_content != NULL && holster1->last_content->item_type == ITEM_WEAPON) && holster2->last_content == NULL) 
		|| ( (holster1->last_content != NULL && holster1->last_content->item_type == ITEM_WEAPON) && holster2->last_content != NULL) ) 
	   {
	   	draw1 = holster1->last_content;
	   	if ( draw1 != NULL )
	   	{
         	   obj_from_obj( draw1 );
         	   draw1 = obj_to_char( draw1, ch );
         	   equip_char( ch, draw1, WEAR_WIELD );
         	   act( AT_ACTION, "$n draws $p from $P.", ch, draw1, holster1, TO_ROOM );
         	   act( AT_ACTION, "You draw $p from $P.", ch, draw1, holster1, TO_CHAR );
		   return;
    	   	}
	   }
	   else if( ( (holster2->last_content != NULL && holster2->last_content->item_type == ITEM_WEAPON) && holster1->last_content == NULL) 
		|| ( (holster2->last_content != NULL && holster2->last_content->item_type == ITEM_WEAPON) && holster1->last_content != NULL) ) 	   {
	   	draw1 = holster2->last_content;
	   	if ( draw1 != NULL )
	   	{
         	   obj_from_obj( draw1 );
         	   draw1 = obj_to_char( draw1, ch );
         	   equip_char( ch, draw1, WEAR_WIELD );
         	   act( AT_ACTION, "$n draws $p from $P.", ch, draw1, holster2, TO_ROOM );
         	   act( AT_ACTION, "You draw $p from $P.", ch, draw1, holster2, TO_CHAR );
		   return;
    	   	}
	   }
	   else
	   {
		send_to_char("You have no weapons in your holsters.\n\r", ch);
		return;
	   }
	}
   }
   else if( draw1 && !draw2 )
   {
	if ( (holster1 ) && ( !holster2 ) )
	{
	   if( holster1->last_content == NULL )
	   {
		send_to_char("You have no weapons in your holsters.\n\r", ch);
		return;
	   }
	   else if( holster1->last_content->item_type == ITEM_WEAPON )
	   {
	   	draw2 = holster1->last_content;
	   	separate_obj( draw2 );
	   	if ( draw2 != NULL )
	   	{
		   if ( ch->pcdata->learned[gsn_dual_wield] )
		   {
       	   	held = get_eq_char( ch, WEAR_HOLD );
	          	if ( held != NULL )
		   	{
			   unequip_char( ch, held );
         	   	   act( AT_ACTION, "$n stops holding $p.", ch, held, holster1, TO_ROOM );
         	   	   act( AT_ACTION, "You stops holding $p.", ch, held, holster1, TO_CHAR );
		   	}
         	   	obj_from_obj( draw2 );
         	   	draw2 = obj_to_char( draw2, ch );
         	   	equip_char( ch, draw2, WEAR_DUAL_WIELD );
		   }
		   else
		   {
			send_to_char("You are already wielding a weapon.\n\r", ch);
			return;
		   }
         	   act( AT_ACTION, "$n draws $p from $P.", ch, draw2, holster2, TO_ROOM );
         	   act( AT_ACTION, "You draw $p from $P.", ch, draw2, holster2, TO_CHAR );
		   return;
    	   	}
	   }
	   else
	   {
		send_to_char("You have no weapons in your holsters.\n\r", ch);
		return;
	   }
	}
	else if ( (!holster1 ) && ( holster2 ) )
	{
	   if( holster2->last_content == NULL )
	   {
		send_to_char("You have no weapons in your holsters.\n\r", ch);
		return;
	   }
	   else if( holster2->last_content->item_type == ITEM_WEAPON )
	   {
	   	draw2 = holster2->last_content;
	   	separate_obj( draw2 );
	   	if ( draw2 != NULL )
	   	{
		   if ( ch->pcdata->learned[gsn_dual_wield] )
		   {
       	   	held = get_eq_char( ch, WEAR_HOLD );
	          	if ( held != NULL )
		   	{
			   unequip_char( ch, held );
         	   	   act( AT_ACTION, "$n stops holding $p.", ch, held, holster1, TO_ROOM );
         	   	   act( AT_ACTION, "You stops holding $p.", ch, held, holster1, TO_CHAR );
		   	}
         	   	obj_from_obj( draw2 );
         	   	draw2 = obj_to_char( draw2, ch );
         	   	equip_char( ch, draw2, WEAR_DUAL_WIELD );
		   }
		   else
		   {
			send_to_char("You are already wielding a weapon.\n\r", ch);
			return;
		   }
         	   act( AT_ACTION, "$n draws $p from $P.", ch, draw2, holster2, TO_ROOM );
         	   act( AT_ACTION, "You draw $p from $P.", ch, draw2, holster2, TO_CHAR );
		   return;
    	   	}
	   }
	   else
	   {
		send_to_char("You have no weapons in your holsters.\n\r", ch);
		return;
	   }
	}
	else if ( (holster1 ) && ( holster2 ) )
	{
	   if( holster1->last_content == NULL && holster2->last_content == NULL)
	   {
		send_to_char("You have no weapons in your holsters.\n\r", ch);
		return;
	   }
	   else if( holster1->last_content !=NULL && holster1->last_content->item_type == ITEM_WEAPON )
	   {
	   	draw2 = holster1->last_content;
	   	separate_obj( draw2 );
	   	if ( draw2 != NULL )
	   	{
		   if ( ch->pcdata->learned[gsn_dual_wield] )
		   {
       	   	held = get_eq_char( ch, WEAR_HOLD );
	          	if ( held != NULL )
		   	{
			   unequip_char( ch, held );
         	   	   act( AT_ACTION, "$n stops holding $p.", ch, held, holster1, TO_ROOM );
         	   	   act( AT_ACTION, "You stops holding $p.", ch, held, holster1, TO_CHAR );
		   	}
         	   	obj_from_obj( draw2 );
         	   	draw2 = obj_to_char( draw2, ch );
         	   	equip_char( ch, draw2, WEAR_DUAL_WIELD );
		   }
		   else
		   {
			send_to_char("You are already wielding a weapon.\n\r", ch);
			return;
		   }
         	   act( AT_ACTION, "$n draws $p from $P.", ch, draw2, holster2, TO_ROOM );
         	   act( AT_ACTION, "You draw $p from $P.", ch, draw2, holster2, TO_CHAR );
		   return;
    	   	}
	   }
	   else if(holster2->last_content != NULL && holster2->last_content->item_type == ITEM_WEAPON )
	   {
	   	draw2 = holster2->last_content;
	   	separate_obj( draw2 );
	   	if ( draw2 != NULL )
	   	{
		   if ( ch->pcdata->learned[gsn_dual_wield] )
		   {
       	   	held = get_eq_char( ch, WEAR_HOLD );
	          	if ( held != NULL )
		   	{
			   unequip_char( ch, held );
         	   	   act( AT_ACTION, "$n stops holding $p.", ch, held, holster1, TO_ROOM );
         	   	   act( AT_ACTION, "You stops holding $p.", ch, held, holster1, TO_CHAR );
		   	}
         	   	obj_from_obj( draw2 );
         	   	draw2 = obj_to_char( draw2, ch );
         	   	equip_char( ch, draw2, WEAR_DUAL_WIELD );
		   }
		   else
		   {
			send_to_char("You are already wielding a weapon.\n\r", ch);
			return;
		   }
         	   act( AT_ACTION, "$n draws $p from $P.", ch, draw2, holster2, TO_ROOM );
         	   act( AT_ACTION, "You draw $p from $P.", ch, draw2, holster2, TO_CHAR );
		   return;
    	   	}
	   }
	   else
	   {
		send_to_char("You have no weapons in your holsters.\n\r", ch);
		return;
	   }
	}
   }
}
============================================================================
IN MUD.H
----------------------------------------------------------------------------
FIND:

/*
 * Command functions.
 * Defined in act_*.c (mostly).
 */


AND ADD:

DECLARE_DO_FUN( do_holster );
DECLARE_DO_FUN( do_draw );

============================================================================
IN ACT_OBJ.c
----------------------------------------------------------------------------
IN THE DO_PUT COMMAND
----------------------------------------------------------------------------
FIND:

    if ( ( container = get_obj_here( ch, arg2 ) ) == NULL )
    {
	act( AT_PLAIN, "I see no $T here.", ch, NULL, arg2, TO_CHAR );
	return;
    }


BELOW IT ADD:

    /*
     * HOLSTER ITEM LIMITATIONS
     * BY KOUMINTANG KOWTOW
     */
    if ((IS_SET(container->wear_flags, WEAR_HOLSTER_L) || IS_SET(container->wear_flags, WEAR_HOLSTER_R) ))
    {
	if(container->last_content != NULL)
	{
	   send_to_char("There is no room in that holster for anymore.\n\r", ch);
	   return;
	}
    }

THEN FIND:


	if ( !can_drop_obj( ch, obj ) )
	{
	    send_to_char( "You can't let go of it.\n\r", ch );
	    return;
	}


BELOW IT ADD:
        /*
         * HOLSTER ITEM LIMITATIONS
         * BY KOUMINTANG KOWTOW
         */
    	if ((IS_SET(container->wear_flags, WEAR_HOLSTER_L) || IS_SET(container->wear_flags, WEAR_HOLSTER_R) ))
    	{
	   if(container->last_content != NULL)
	   {
	   	send_to_char("There is no room in that holster for anymore.\n\r", ch);
	   	return;
	   }
    	}

THEN FIND:


		if ( number && (cnt + obj->count) > number )
		    split_obj( obj, number - cnt );
		cnt += obj->count;


AND *ABOVE* IT ADD:

    		/*
     		 * HOLSTER ITEM LIMITATIONS
     		 * BY KOUMINTANG KOWTOW
     		 */
    		if ((IS_SET(container->wear_flags, WEAR_HOLSTER_L) || IS_SET(container->wear_flags, WEAR_HOLSTER_R) ))
    		{
		   if(container->last_content != NULL)
		   {
	   		send_to_char("There is no room in that holster for anymore.\n\r", ch);
	   		return;
		   }
    		}

============================================================================
IN TABLES.C
----------------------------------------------------------------------------
FIND:

	if ( !str_cmp( name, "do_drag" ))		return do_drag;

BELOW IT ADD:

	if ( !str_cmp( name, "do_draw" ))		return do_draw;

FIND:

	if ( !str_cmp( name, "do_hlist" ))			return do_hlist;

BELOW IT ADD:

	if ( !str_cmp( name, "do_holster" ))		return do_holster;

FIND:

    if ( skill == do_assignpilot )			return "do_assignpilot";

AND ADD IN THERE SOMEWHERE:

    if ( skill == do_draw )				return "do_draw";
    if ( skill == do_holster )			return "do_holster";

============================================================================
IN THE SHELL
----------------------------------------------------------------------------
MAKE CLEAN
MAKE

============================================================================
IN YOUR GAME DO THE FOLLOWING:

copyover/reboot/hotboot (which ever one you have)
cedit draw create do_draw
cedit draw level 1
cedit holster create do_holster
cedit holster level 1
cedit save

----------------------------------------------------------------------------
HERE IS THE HELP FILE I HAVE USED!

hedit holster draw

Holster and Draw commands have now been implemented into the game.
 
Syntax: holster (puts a single weapon that you are wielding into a holster)
 
Syntax: draw (takes a single weapon from a holster and makes you wield it)
 
HOLSTERS CAN NOW ONLY HOLD ONE ITEM!!!!!!
 
These commands will only work with items in the holster wear locations so
do not expect a backpack named holster to work with the commands!!!
 
ALSO: Holster and draw works for all weapons... so if you want a sheath for
your vibroblade, or a clip for your lightsaber simple make the container
with the appropriate name and wear location of for the
holsters.

/s

hset level 1 holster
hset save
=============================================================================