act_obj.c

demise/src/act_obj.c · 166.8 KB

From the archive dodbackup-final.tar.gz

Download the archive   « Back to the archive contents

/***************************************************************************
*   Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
*   Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
*                                                                          *
*   Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
*   Chastain, Michael Quan, and Mitchell Tse.                              *
*                                                                          *
*   In order to use any part of this Merc Diku Mud, you must comply with   *
*   both the original Diku license in 'license.doc' as well the Merc       *
*   license in 'license.txt'.  In particular, you may not remove either of *
*   these copyright notices.                                               *
*                                                                          *
*   Much time and thought has gone into this software and you are          *
*   benefitting.  We hope that you share your changes too.  What goes      *
*   around, comes around.                                                  *
***************************************************************************/

/***************************************************************************
*   God Wars Mud improvements copyright (C) 1994, 1995, 1996 by Richard    *
*   Woolcock.  This mud is NOT to be copied in whole or in part, or to be  *
*   run without the permission of Richard Woolcock.  Nobody else has       *
*   permission to authorise the use of this code.                          *
***************************************************************************/

#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"



/*
 * Local functions.
 */
#define CD CHAR_DATA
void get_obj args ((CHAR_DATA * ch, OBJ_DATA * obj, OBJ_DATA * container));
CD *find_keeper args ((CHAR_DATA * ch));
int get_cost args ((CHAR_DATA * keeper, OBJ_DATA * obj, bool fBuy));
void sheath args ((CHAR_DATA * ch, int pos));
void draw args ((CHAR_DATA * ch, int pos));
char *special_item_name args ((OBJ_DATA * obj));
void do_upgradesmith args ((CHAR_DATA * ch, CHAR_DATA *shopkeep, OBJ_DATA *obj));
#undef	CD




void
get_obj (CHAR_DATA * ch, OBJ_DATA * obj, OBJ_DATA * container)
{
  OBJ_DATA *obj2;
  OBJ_DATA *obj_next;
  ROOM_INDEX_DATA *objroom;
  bool move_ch = FALSE;

  /* Objects should only have a shadowplane flag when on the floor */
  if (IS_AFFECTED (ch, AFF_SHADOWPLANE) &&
      obj->in_room != NULL && (!IS_SET (obj->extra_flags, ITEM_SHADOWPLANE)))
    {
      send_to_char ("Your hand passes right through it!\n\r", ch);
      return;
    }
  if (!IS_AFFECTED (ch, AFF_SHADOWPLANE) &&
      obj->in_room != NULL && (IS_SET (obj->extra_flags, ITEM_SHADOWPLANE)))
    {
      send_to_char ("Your hand passes right through it!\n\r", ch);
      return;
    }
  if (IS_NYM (ch, NYM_DEATHPLANE) &&
      obj->in_room != NULL && (!IS_SET (obj->extra_flags, ITEM_DEATHPLANE))
      && ch->pcdata->powers[WRA_EMBO] < 2)
    {
      send_to_char ("Your hand passes right through it!\n\r", ch);
      return;
    }
  if (!IS_NYM (ch, NYM_DEATHPLANE) &&
      obj->in_room != NULL && (IS_SET (obj->extra_flags, ITEM_DEATHPLANE)))
    {
      send_to_char ("Your hand passes right through it!\n\r", ch);
      return;
    }

  if (IS_GHOST (ch))
    {
      stc ("Your ghostly hand passes right through it!\n\r", ch);
      return;
    }

  if (IS_SET (obj->quest, QUEST_ARTIFACT) || obj->item_type == ITEM_PIECE)
    {
      if (has_artifact (ch) && !IS_XXX (ch, XXX_PIECE))
	{
	  stc ("You can't pick that up, you already have an artifact.\n\r",
	       ch);
	  return;
	}
      if (!can_arti (ch))
	{
	  stc ("You dont have the requirements to pick up an artifact.\n\r",
	       ch);
	  return;
	}
      if (ch->nopktimer > 0)
	{
	  stc ("You need to joinpk if you want that.\n\r", ch);
	  return;
	}

      if (IS_NEWBIE (ch))
	{
	  stc ("No artifacts for you Newbie.\n\r", ch);
	  return;
	}
    }


  if (!CAN_WEAR (obj, ITEM_TAKE))
    {
      send_to_char ("You can't take that.\n\r", ch);
      return;
    }

  if (ch->carry_number + 1 > can_carry_n (ch) && !IS_ELF (ch))
    {
      act ("$d: you can't carry that many items.",
	   ch, NULL, obj->name, TO_CHAR);
      return;
    }

  if (ch->carry_weight + get_obj_weight (obj) > can_carry_w (ch)
      && !IS_ELF (ch))
    {
      act ("$d: you can't carry that much weight.",
	   ch, NULL, obj->name, TO_CHAR);
      return;
    }

  if (container != NULL)
    {

      if (IS_AFFECTED (ch, AFF_SHADOWPLANE) &&
	  !IS_SET (container->extra_flags, ITEM_SHADOWPLANE) &&
	  (container->carried_by == NULL || container->carried_by != ch))
	{
	  send_to_char ("Your hand passes right through it!\n\r", ch);
	  return;
	}
      if (!IS_AFFECTED (ch, AFF_SHADOWPLANE) &&
	  IS_SET (container->extra_flags, ITEM_SHADOWPLANE) &&
	  (container->carried_by == NULL || container->carried_by != ch))
	{
	  send_to_char ("Your hand passes right through it!\n\r", ch);
	  return;
	}
      if (IS_NYM (ch, NYM_DEATHPLANE) &&
	  !IS_SET (container->extra_flags, ITEM_DEATHPLANE) &&
	  (container->carried_by == NULL || container->carried_by != ch))
	{
	  send_to_char ("Your hand passes right through it!\n\r", ch);
	  return;
	}
      if (!IS_NYM (ch, NYM_DEATHPLANE) &&
	  IS_SET (container->extra_flags, ITEM_DEATHPLANE) &&
	  (container->carried_by == NULL || container->carried_by != ch))
	{
	  send_to_char ("Your hand passes right through it!\n\r", ch);
	  return;
	}
      if (IS_GHOST (ch))
	{
	  stc ("Your ghostly hand passes right through it!\n\r", ch);
	  return;
	}
      act ("You get $p from $P.", ch, obj, container, TO_CHAR);
      act ("$n gets $p from $P.", ch, obj, container, TO_ROOM);
      for (obj2 = container->contains; obj2 != NULL; obj2 = obj_next)
	{
	  obj_next = obj2->next_content;
	  if (obj2->chobj != NULL)
	    {
	      act ("A hand reaches inside $P and takes $p out.", obj2->chobj,
		   obj, container, TO_CHAR);
	      move_ch = TRUE;
	    }
	}
      obj_from_obj (obj);
    }
  else
    {
      act ("You pick up $p.", ch, obj, container, TO_CHAR);
      act ("$n picks $p up.", ch, obj, container, TO_ROOM);
      if (obj != NULL)
	obj_from_room (obj);
    }

  if (obj->item_type == ITEM_MONEY)
    {
      ch->gold += obj->value[0];
      extract_obj (obj);
    }
  else
    {
      obj_to_char (obj, ch);
      if (move_ch && obj->chobj != NULL)
	{
	  if (obj->carried_by != NULL && obj->carried_by != obj->chobj)
	    objroom = get_room_index (obj->carried_by->in_room->vnum);
	  else
	    objroom = NULL;
	  if (objroom != NULL
	      && get_room_index (obj->chobj->in_room->vnum) != objroom)
	    {
	      char_from_room (obj->chobj);
	      char_to_room (obj->chobj, objroom);
	      do_look (obj->chobj, "auto");
	    }
	}
      if (IS_AFFECTED (ch, AFF_SHADOWPLANE) &&
	  (IS_SET (obj->extra_flags, ITEM_SHADOWPLANE)))
	REMOVE_BIT (obj->extra_flags, ITEM_SHADOWPLANE);
      if (IS_NYM (ch, NYM_DEATHPLANE) &&
	  (IS_SET (obj->extra_flags, ITEM_DEATHPLANE)))
	REMOVE_BIT (obj->extra_flags, ITEM_DEATHPLANE);
    }

  return;
}



void
do_get (CHAR_DATA * ch, char *argument)
{
  char arg1[MIL];
  char arg2[MIL];
  OBJ_DATA *obj;
  OBJ_DATA *obj_next;
  OBJ_DATA *container;
  bool found;

  argument = one_argument (argument, arg1);
  argument = one_argument (argument, arg2);

  if (IS_AFFECTED (ch, AFF_ETHEREAL) || IS_EXTRA (ch, EXTRA_ILLUSION))
    {
      send_to_char ("You cannot pick things up while ethereal.\n\r", ch);
      return;
    }
  if (IS_GHOST (ch))
    {
      stc ("You cannot pick things up as a ghost.\n\r", ch);
      return;
    }

  /* Get type. */
  if (arg1[0] == '\0')
    {
      send_to_char ("Get what?\n\r", ch);
      return;
    }

  if (arg2[0] == '\0')
    {
      if (str_cmp (arg1, "all") && str_prefix ("all.", arg1))
	{
	  /* 'get obj' */
	  obj = get_obj_list (ch, arg1, ch->in_room->contents);
	  if (obj == NULL)
	    {
	      act ("I see no $T here.", ch, NULL, arg1, TO_CHAR);
	      return;
	    }

	  get_obj (ch, obj, NULL);
	}
      else
	{
	  /* 'get all' or 'get all.obj' */
	  found = FALSE;
	  for (obj = ch->in_room->contents; obj != NULL; obj = obj_next)
	    {
	      obj_next = obj->next_content;
	      if ((arg1[3] == '\0' || is_name (&arg1[4], obj->name))
		  && can_see_obj (ch, obj))
		{
		  found = TRUE;
		  get_obj (ch, obj, NULL);
		}
	    }

	  if (!found)
	    {
	      if (arg1[3] == '\0')
		send_to_char ("I see nothing here.\n\r", ch);
	      else
		act ("I see no $T here.", ch, NULL, &arg1[4], TO_CHAR);
	    }
	}
    }
  else
    {
      /* 'get ... container' */
      if (!str_cmp (arg2, "all") || !str_prefix ("all.", arg2))
	{
	  send_to_char ("You can't do that.\n\r", ch);
	  return;
	}

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

      switch (container->item_type)
	{
	default:
	  send_to_char ("That's not a container.\n\r", ch);
	  return;

	case ITEM_CONTAINER:
	case ITEM_CORPSE_NPC:
	  break;

	case ITEM_CORPSE_PC:
	  {
/*
		char name[MIL];
		char *pd;
*/
	    if (IS_NPC (ch))
	      {
		send_to_char ("You can't do that.\n\r", ch);
		return;
	      }
	    if (IS_NEWBIE (ch) && strlen (container->questowner) > 1)
	      {
		if (str_cmp (container->questowner, ch->name))
		  {
		    send_to_char
		      ("You cannot loot the corpses of other players.\n\r",
		       ch);
		    return;
		  }
	      }
/*
		pd = container->short_descr;
		pd = one_argument( pd, name );
		pd = one_argument( pd, name );
		pd = one_argument( pd, name );
		if ( str_cmp( name, ch->name ) && IS_NEWBIE(ch) )
		{
		    send_to_char( "You can't do that.\n\r", ch );
		    return;
		}
*/
	  }
	}

      if (IS_SET (container->value[1], CONT_CLOSED))
	{
	  act ("The $d is closed.", ch, NULL, container->name, TO_CHAR);
	  return;
	}

      if (str_cmp (arg1, "all") && str_prefix ("all.", arg1))
	{
	  /* 'get obj container' */
	  obj = get_obj_list (ch, arg1, container->contains);
	  if (obj == NULL)
	    {
	      act ("I see nothing like that in the $T.",
		   ch, NULL, arg2, TO_CHAR);
	      return;
	    }
	  get_obj (ch, obj, container);
	}
      else
	{
	  /* 'get all container' or 'get all.obj container' */
	  found = FALSE;
	  for (obj = container->contains; obj != NULL; obj = obj_next)
	    {
	      obj_next = obj->next_content;
	      if ((arg1[3] == '\0' || is_name (&arg1[4], obj->name))
		  && can_see_obj (ch, obj))
		{
		  found = TRUE;
		  get_obj (ch, obj, container);
		}
	    }

	  if (!found)
	    {
	      if (arg1[3] == '\0')
		act ("I see nothing in the $T.", ch, NULL, arg2, TO_CHAR);
	      else
		act ("I see nothing like that in the $T.",
		     ch, NULL, arg2, TO_CHAR);
	    }
	}
    }
  do_autosave (ch, "");
  return;
}



void
do_put (CHAR_DATA * ch, char *argument)
{
  char arg1[MIL];
  char arg2[MIL];
  OBJ_DATA *container;
  OBJ_DATA *obj;
  OBJ_DATA *obj2;
  OBJ_DATA *obj_next;
  OBJ_DATA *obj_next2;
  ROOM_INDEX_DATA *objroom = get_room_index (ROOM_VNUM_IN_OBJECT);

  argument = one_argument (argument, arg1);
  argument = one_argument (argument, arg2);

  if (arg1[0] == '\0' || arg2[0] == '\0')
    {
      send_to_char ("Put what in what?\n\r", ch);
      return;
    }

  if (!str_cmp (arg2, "all") || !str_prefix ("all.", arg2))
    {
      send_to_char ("You can't do that.\n\r", ch);
      return;
    }
/* I'll leave this out for now - KaVir
    if ( ( ( container = get_obj_carry( ch, arg2 ) ) == NULL ) &&
         ( ( container = get_obj_wear(  ch, arg2 ) ) == NULL ) &&
	   ( IS_AFFECTED(ch,AFF_ETHEREAL) ) )
    {
	send_to_char( "You can't let go of it!\n\r", ch );
	return;
    }
*/

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

  if (container->item_type == ITEM_QUIVER)
    {
      if (str_cmp (arg1, "all") && str_prefix ("all.", arg1))
	{
	  /* 'put obj container' */
	  if ((obj = get_obj_carry (ch, arg1)) == NULL)
	    {
	      send_to_char ("You do not have that item.\n\r", ch);
	      return;
	    }

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

	  if (obj->item_type != ITEM_ARROW)
	    {
	      act ("$p is not an arrow.\n\r", ch, obj, NULL, TO_CHAR);
	      return;
	    }
	  place_arrow (ch, container, obj);
	  return;
	}
      else
	{
	  for (obj = ch->carrying; obj != NULL; obj = obj_next)
	    {
	      obj_next = obj->next_content;

	      if ((arg1[3] == '\0' || is_name (&arg1[4], obj->name))
		  && can_see_obj (ch, obj)
		  && obj->wear_loc == WEAR_NONE
		  && obj->item_type == ITEM_ARROW && can_drop_obj (ch, obj))
		{
		  place_arrow (ch, container, obj);
		  return;
		}
	    }
	}
      return;
    }

  if (container->item_type != ITEM_CONTAINER)
    {
      send_to_char ("That's not a container.\n\r", ch);
      return;
    }

  if (IS_SET (container->value[1], CONT_CLOSED))
    {
      act ("The $d is closed.", ch, NULL, container->name, TO_CHAR);
      return;
    }

  if (str_cmp (arg1, "all") && str_prefix ("all.", arg1))
    {
      /* 'put obj container' */
      if ((obj = get_obj_carry (ch, arg1)) == NULL)
	{
	  send_to_char ("You do not have that item.\n\r", ch);
	  return;
	}

      if (obj == container)
	{
	  send_to_char ("You can't fold it into itself.\n\r", ch);
	  return;
	}

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

      if (get_obj_weight (obj) + get_obj_weight (container)
	  > container->value[0])
	{
	  send_to_char ("It won't fit.\n\r", ch);
	  return;
	}

      if (IS_SET (obj->quest, QUEST_ARTIFACT))
	{
	  stc ("You can't put artifacts into containers.\n\r", ch);
	  return;
	}

      if (hundred_objects (ch, container))
	return;

      for (obj2 = container->contains; obj2 != NULL; obj2 = obj_next2)
	{
	  obj_next2 = obj2->next_content;
	  if (obj2->chobj != NULL && obj != obj2)
	    act ("A hand reaches inside $P and drops $p.", obj2->chobj, obj,
		 container, TO_CHAR);
	}
      obj_from_char (obj);
      obj_to_obj (obj, container);
      act ("$n puts $p in $P.", ch, obj, container, TO_ROOM);
      act ("You put $p in $P.", ch, obj, container, TO_CHAR);
    }
  else
    {
      /* 'put all container' or 'put all.obj container' */
      if (hundred_objects (ch, container))
	return;
      for (obj = ch->carrying; obj != NULL; obj = obj_next)
	{
	  obj_next = obj->next_content;

	  if ((arg1[3] == '\0' || is_name (&arg1[4], obj->name))
	      && can_see_obj (ch, obj)
	      && obj->wear_loc == WEAR_NONE
	      && obj != container
	      && can_drop_obj (ch, obj)
	      && get_obj_weight (obj) + get_obj_weight (container)
	      <= container->value[0] && !IS_SET (obj->quest, QUEST_ARTIFACT))
	    {
	      for (obj2 = container->contains; obj2 != NULL; obj2 = obj_next2)
		{
		  obj_next2 = obj2->next_content;
		  if (obj2->chobj != NULL && obj2->chobj->in_room != NULL)
		    {
		      if (objroom !=
			  get_room_index (obj2->chobj->in_room->vnum))
			{
			  char_from_room (obj2->chobj);
			  char_to_room (obj2->chobj, objroom);
			  do_look (obj2->chobj, "auto");
			}
		      if (obj != obj2)
			act ("A hand reaches inside $P and drops $p.",
			     obj2->chobj, obj, container, TO_CHAR);
		    }
		}
	      obj_from_char (obj);
	      obj_to_obj (obj, container);
	      act ("$n puts $p in $P.", ch, obj, container, TO_ROOM);
	      act ("You put $p in $P.", ch, obj, container, TO_CHAR);
	    }
	}
    }
  do_autosave (ch, "");
  return;
}



void
do_drop (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  OBJ_DATA *obj;
  OBJ_DATA *obj_next;
  bool found;

  argument = one_argument (argument, arg);

  if (IS_AFFECTED (ch, AFF_ETHEREAL) || IS_EXTRA (ch, EXTRA_ILLUSION))
    {
      send_to_char ("You cannot pick things up while ethereal.\n\r", ch);
      return;
    }
  if (IS_GHOST (ch))
    {
      stc ("You cannot drop things as a ghost.\n\r", ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Drop what?\n\r", ch);
      return;
    }

  if (is_number (arg))
    {
      /* 'drop NNNN coins' */
      int amount;

      amount = atoi (arg);
      argument = one_argument (argument, arg);
      if (amount <= 0 || (str_cmp (arg, "coins") && str_cmp (arg, "coin")))
	{
	  send_to_char ("Sorry, you can't do that.\n\r", ch);
	  return;
	}

      /* Otherwise causes complications if there's a pile on each plane */
      if (IS_AFFECTED (ch, AFF_SHADOWPLANE))
	{
	  send_to_char ("You cannot drop coins in the Umbra.\n\r", ch);
	  return;
	}
      if (IS_NYM (ch, NYM_DEATHPLANE))
	{
	  send_to_char ("You cannot drop coins on the Death plane.\n\r", ch);
	  return;
	}

      if (ch->gold < amount)
	{
	  send_to_char ("You haven't got that many coins.\n\r", ch);
	  return;
	}

      ch->gold -= amount;

      for (obj = ch->in_room->contents; obj != NULL; obj = obj_next)
	{
	  obj_next = obj->next_content;

	  switch (obj->pIndexData->vnum)
	    {
	    case OBJ_VNUM_MONEY_ONE:
	      amount += 1;
	      extract_obj (obj);
	      break;

	    case OBJ_VNUM_MONEY_SOME:
	      amount += obj->value[0];
	      extract_obj (obj);
	      break;
	    }
	}
      obj_to_room (create_money (amount), ch->in_room);
      act ("$n drops some gold.", ch, NULL, NULL, TO_ROOM);
      send_to_char ("OK.\n\r", ch);
      do_autosave (ch, "");
      return;
    }

  if (str_cmp (arg, "all") && str_prefix ("all.", arg))
    {
      /* 'drop obj' */
      if ((obj = get_obj_carry (ch, arg)) == NULL)
	{
	  send_to_char ("You do not have that item.\n\r", ch);
	  return;
	}

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

      if (fifty_objects (ch))
	return;

      obj_from_char (obj);
      obj_to_room (obj, ch->in_room);
      /* Objects should only have a shadowplane flag when on the floor */
      if (IS_AFFECTED (ch, AFF_SHADOWPLANE) &&
	  (!IS_SET (obj->extra_flags, ITEM_SHADOWPLANE)))
	SET_BIT (obj->extra_flags, ITEM_SHADOWPLANE);
      if (IS_NYM (ch, NYM_DEATHPLANE) &&
	  (!IS_SET (obj->extra_flags, ITEM_DEATHPLANE)))
	SET_BIT (obj->extra_flags, ITEM_DEATHPLANE);
      act ("$n drops $p.", ch, obj, NULL, TO_ROOM);
      act ("You drop $p.", ch, obj, NULL, TO_CHAR);
    }
  else
    {
      /* 'drop all' or 'drop all.obj' */
      if (fifty_objects (ch))
	return;
      found = FALSE;
      for (obj = ch->carrying; obj != NULL; obj = obj_next)
	{
	  obj_next = obj->next_content;

	  if ((arg[3] == '\0' || is_name (&arg[4], obj->name))
	      && can_see_obj (ch, obj)
	      && obj->wear_loc == WEAR_NONE && can_drop_obj (ch, obj))
	    {
	      found = TRUE;
	      obj_from_char (obj);
	      obj_to_room (obj, ch->in_room);
	      /* Objects should only have a shadowplane flag when on the floor */
	      if (IS_AFFECTED (ch, AFF_SHADOWPLANE) &&
		  (!IS_SET (obj->extra_flags, ITEM_SHADOWPLANE)))
		SET_BIT (obj->extra_flags, ITEM_SHADOWPLANE);
	      if (IS_NYM (ch, NYM_DEATHPLANE) &&
		  (!IS_SET (obj->extra_flags, ITEM_DEATHPLANE)))
		SET_BIT (obj->extra_flags, ITEM_DEATHPLANE);
	      act ("$n drops $p.", ch, obj, NULL, TO_ROOM);
	      act ("You drop $p.", ch, obj, NULL, TO_CHAR);
	    }
	}

      if (!found)
	{
	  if (arg[3] == '\0')
	    act ("You are not carrying anything.", ch, NULL, arg, TO_CHAR);
	  else
	    act ("You are not carrying any $T.", ch, NULL, &arg[4], TO_CHAR);
	}
    }

  do_autosave (ch, "");
  return;
}



void
do_give (CHAR_DATA * ch, char *argument)
{
  char arg1[MIL];
  char arg2[MIL];
  CHAR_DATA *victim;
  OBJ_DATA *obj;
  char buf[MSL];

  argument = one_argument (argument, arg1);
  argument = one_argument (argument, arg2);

  if (arg1[0] == '\0' || arg2[0] == '\0')
    {
      send_to_char ("Give what to whom?\n\r", ch);
      return;
    }

  if (is_number (arg1))
    {
      /* 'give NNNN coins victim' */
      int amount;

      amount = atoi (arg1);
      if (amount <= 0 || (str_cmp (arg2, "coins") && str_cmp (arg2, "coin")))
	{
	  send_to_char ("Sorry, you can't do that.\n\r", ch);
	  return;
	}

      argument = one_argument (argument, arg2);
      if (arg2[0] == '\0')
	{
	  send_to_char ("Give what to whom?\n\r", ch);
	  return;
	}

      if ((victim = get_char_room (ch, arg2)) == NULL)
	{
	  send_to_char ("They aren't here.\n\r", ch);
	  return;
	}

      if (ch == victim)
	{
	  send_to_char ("You already have it.\n\r", ch);
	  return;
	}

      if (IS_AFFECTED (victim, AFF_ETHEREAL)
	  || IS_EXTRA (victim, EXTRA_ILLUSION))
	{
	  send_to_char ("You cannot give things to ethereal people.\n\r", ch);
	  return;
	}

      if (IS_GHOST (victim))
	{
	  stc ("You cannot give things to ghost.\n\r", ch);
	  return;
	}
      if (IS_GHOST (ch))
	{
	  stc ("You cannot give away things your a ghost.\n\r", ch);
	  return;
	}

      if (ch->gold < amount)
	{
	  send_to_char ("You haven't got that much gold.\n\r", ch);
	  return;
	}

      ch->gold -= amount;
      victim->gold += amount;
      act ("$n gives you some gold.", ch, NULL, victim, TO_VICT);
      act ("$n gives $N some gold.", ch, NULL, victim, TO_NOTVICT);
      act ("You give $N some gold.", ch, NULL, victim, TO_CHAR);
      send_to_char ("OK.\n\r", ch);
      do_autosave (ch, "");
      do_autosave (victim, "");
      return;
    }

  if ((obj = get_obj_carry (ch, arg1)) == NULL)
    {
      send_to_char ("You do not have that item.\n\r", ch);
      return;
    }

  if (obj->wear_loc != WEAR_NONE)
    {
      send_to_char ("You must remove it first.\n\r", ch);
      return;
    }

  if ((victim = get_char_room (ch, arg2)) == NULL)
    {
      send_to_char ("They aren't here.\n\r", ch);
      return;
    }

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

  if (ch == victim)
    {
      send_to_char ("You already have it.\n\r", ch);
      return;
    }
  if (IS_GHOST (ch))
    {
      stc ("You cannot give away things your a ghost.\n\r", ch);
      return;
    }
  if (IS_GHOST (victim))
    {
      stc ("You cannot give things to ghosts.\n\r", ch);
      return;
    }

  if (IS_AFFECTED (victim, AFF_ETHEREAL))
    {
      send_to_char ("You cannot give things to ethereal people.\n\r", ch);
      return;
    }

  if (IS_SET (obj->quest, QUEST_ARTIFACT))
    {
      if (has_artifact (victim))
	return;
      if (!can_arti (victim))
	return;
      if (is_safe (ch, victim))
	return;
      if (!IS_IMMUNE (victim, IMM_VAMPIRE))
	{
	  send_to_char
	    ("You cannot give an artifact to an unwilling person.\n\r", ch);
	  return;
	}
    }


  if (victim->carry_number + 1 > can_carry_n (victim))
    {
      act ("$N has $S hands full.", ch, NULL, victim, TO_CHAR);
      return;
    }

  if (victim->carry_weight + get_obj_weight (obj) > can_carry_w (victim))
    {
      act ("$N can't carry that much weight.", ch, NULL, victim, TO_CHAR);
      return;
    }

  if (!can_see_obj (victim, obj))
    {
      act ("$N can't see it.", ch, NULL, victim, TO_CHAR);
      return;
    }

  obj_from_char (obj);
  obj_to_char (obj, victim);
  act ("$n gives $p to $N.", ch, obj, victim, TO_NOTVICT);
  act ("$n gives you $p.", ch, obj, victim, TO_VICT);
  act ("You give $p to $N.", ch, obj, victim, TO_CHAR);
  do_autosave (ch, "");
  do_autosave (victim, "");
  return;
}




void
do_fill (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  OBJ_DATA *obj;
  OBJ_DATA *fountain;
  bool found;
  int liquid;

  one_argument (argument, arg);

  if (arg[0] == '\0')
    {
      send_to_char ("Fill what?\n\r", ch);
      return;
    }

  if ((obj = get_obj_carry (ch, arg)) == NULL)
    {
      send_to_char ("You do not have that item.\n\r", ch);
      return;
    }

  found = FALSE;
  for (fountain = ch->in_room->contents; fountain != NULL;
       fountain = fountain->next_content)
    {
      if (fountain->item_type == ITEM_FOUNTAIN)
	{
	  found = TRUE;
	  break;
	}
    }

  if (!found)
    {
      send_to_char ("There is no fountain here!\n\r", ch);
      return;
    }

  if (IS_AFFECTED (ch, AFF_SHADOWPLANE) &&
      fountain->in_room != NULL &&
      !IS_SET (fountain->extra_flags, ITEM_SHADOWPLANE))
    {
      send_to_char ("You are too insubstantual.\n\r", ch);
      return;
    }
  else if (!IS_AFFECTED (ch, AFF_SHADOWPLANE) &&
	   fountain->in_room != NULL &&
	   IS_SET (fountain->extra_flags, ITEM_SHADOWPLANE))
    {
      send_to_char ("It is too insubstantual.\n\r", ch);
      return;
    }
  else if (IS_NYM (ch, NYM_DEATHPLANE) &&
	   fountain->in_room != NULL &&
	   !IS_SET (fountain->extra_flags, ITEM_DEATHPLANE))
    {
      send_to_char ("You are too insubstantual.\n\r", ch);
      return;
    }
  else if (!IS_NYM (ch, NYM_DEATHPLANE) &&
	   fountain->in_room != NULL &&
	   IS_SET (fountain->extra_flags, ITEM_DEATHPLANE))
    {
      send_to_char ("It is too insubstantual.\n\r", ch);
      return;
    }
  else if (IS_AFFECTED (ch, AFF_ETHEREAL) || IS_EXTRA (ch, EXTRA_ILLUSION))
    {
      send_to_char ("You cannot fill containers while ethereal.\n\r", ch);
      return;
    }
  if (IS_GHOST (ch))
    {
      stc ("You cannot fill containers while your a ghost.\n\r", ch);
      return;
    }

  if (obj->item_type != ITEM_DRINK_CON)
    {
      send_to_char ("You can't fill that.\n\r", ch);
      return;
    }

  if (obj->value[1] >= obj->value[0])
    {
      send_to_char ("Your container is already full.\n\r", ch);
      return;
    }

  if ((obj->value[2] != fountain->value[2]) && obj->value[1] > 0)
    {
      send_to_char ("You cannot mix two different liquids.\n\r", ch);
      return;
    }

  act ("$n dips $p into $P.", ch, obj, fountain, TO_ROOM);
  act ("You dip $p into $P.", ch, obj, fountain, TO_CHAR);
  obj->value[2] = fountain->value[2];
  obj->value[1] = obj->value[0];
  liquid = obj->value[2];
  act ("$n fills $p with $T.", ch, obj, liq_table[liquid].liq_name, TO_ROOM);
  act ("You fill $p with $T.", ch, obj, liq_table[liquid].liq_name, TO_CHAR);
  return;
}



void
do_drink (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  OBJ_DATA *obj;
  int amount;
  int liquid;

  one_argument (argument, arg);

  if (arg[0] == '\0')
    {
      for (obj = ch->in_room->contents; obj; obj = obj->next_content)
	{
	  if (obj->item_type == ITEM_FOUNTAIN)
	    break;
	}

      if (obj == NULL)
	{
	  send_to_char ("Drink what?\n\r", ch);
	  return;
	}
    }
  else
    {
      if ((obj = get_obj_here (ch, arg)) == NULL)
	{
	  send_to_char ("You can't find it.\n\r", ch);
	  return;
	}
    }

  if (!IS_NPC (ch) && ch->pcdata->condition[COND_DRUNK] > 10)
    {
      send_to_char ("You fail to reach your mouth.  *Hic*\n\r", ch);
      return;
    }

  switch (obj->item_type)
    {
    default:
      send_to_char ("You can't drink from that.\n\r", ch);
      break;

    case ITEM_POTION:
      do_quaff (ch, obj->name);
      return;
    case ITEM_FOUNTAIN:
      if ((liquid = obj->value[2]) >= LIQ_MAX)
	{
	  bug ("Do_drink: bad liquid number %d.", liquid);
	  liquid = obj->value[2] = 0;
	}

      if (IS_AFFECTED (ch, AFF_SHADOWPLANE) &&
	  obj->in_room != NULL &&
	  !IS_SET (obj->extra_flags, ITEM_SHADOWPLANE))
	{
	  send_to_char ("You are too insubstantual.\n\r", ch);
	  break;
	}
      else if (!IS_AFFECTED (ch, AFF_SHADOWPLANE) &&
	       obj->in_room != NULL &&
	       IS_SET (obj->extra_flags, ITEM_SHADOWPLANE))
	{
	  send_to_char ("It is too insubstantual.\n\r", ch);
	  break;
	}
      else if (IS_NYM (ch, NYM_DEATHPLANE) &&
	       obj->in_room != NULL &&
	       !IS_SET (obj->extra_flags, ITEM_DEATHPLANE))
	{
	  send_to_char ("You are too insubstantual.\n\r", ch);
	  break;
	}
      else if (!IS_NYM (ch, NYM_DEATHPLANE) &&
	       obj->in_room != NULL &&
	       IS_SET (obj->extra_flags, ITEM_DEATHPLANE))
	{
	  send_to_char ("It is too insubstantual.\n\r", ch);
	  break;
	}
      else if (IS_AFFECTED (ch, AFF_ETHEREAL) && obj->carried_by == NULL)
	{
	  send_to_char
	    ("You can only drink from things you are carrying while ethereal.\n\r",
	     ch);
	  return;
	}

      if (liquid != 13 && !IS_NPC (ch) && IS_VAMPIRE (ch))
	{
	  send_to_char ("You can only drink blood.\n\r", ch);
	  break;
	}

      act ("$n drinks $T from $p.", ch, obj, liq_table[liquid].liq_name,
	   TO_ROOM);
      act ("You drink $T from $p.", ch, obj, liq_table[liquid].liq_name,
	   TO_CHAR);
      if (!IS_VAMPIRE (ch) && ch->blood[0] < 100)
	ch->blood[0]++;

      amount = number_range (3, 10);
      amount = UMIN (amount, obj->value[1]);

      gain_condition (ch, COND_DRUNK,
		      amount * liq_table[liquid].liq_affect[COND_DRUNK]);
      gain_condition (ch, COND_FULL,
		      amount * liq_table[liquid].liq_affect[COND_FULL]);
      gain_condition (ch, COND_THIRST,
		      amount * liq_table[liquid].liq_affect[COND_THIRST]);

      if (!IS_NPC (ch) && !IS_VAMPIRE (ch) &&
	  ch->pcdata->condition[COND_DRUNK] > 10)
	send_to_char ("You feel drunk.\n\r", ch);
      if (!IS_NPC (ch) && !IS_VAMPIRE (ch) &&
	  ch->pcdata->condition[COND_FULL] > 50)
	send_to_char ("You are full.\n\r", ch);
      if (!IS_NPC (ch) && !IS_VAMPIRE (ch) &&
	  ch->pcdata->condition[COND_THIRST] > 50)
	send_to_char ("You do not feel thirsty.\n\r", ch);
      if (!IS_NPC (ch) && IS_VAMPIRE (ch) &&
	  ch->pcdata->condition[COND_THIRST] >= 100)
	send_to_char ("The cold blood does little to satisfy you.\n\r", ch);

      if (obj->value[3] != 0 && (!IS_NPC (ch) && !IS_VAMPIRE (ch)))
	{
	  /* The shit was poisoned ! */
	  AFFECT_DATA af;

	  act ("$n chokes and gags.", ch, NULL, NULL, TO_ROOM);
	  send_to_char ("You choke and gag.\n\r", ch);
	  af.type = gsn_poison;
	  af.duration = 3 * amount;
	  af.location = APPLY_NONE;
	  af.modifier = 0;
	  af.bitvector = AFF_POISON;
	  affect_join (ch, &af);
	}
      break;

    case ITEM_DRINK_CON:
      if (obj->value[1] <= 0)
	{
	  send_to_char ("It is already empty.\n\r", ch);
	  return;
	}

      if ((liquid = obj->value[2]) >= LIQ_MAX)
	{
	  bug ("Do_drink: bad liquid number %d.", liquid);
	  liquid = obj->value[2] = 0;
	}

      if (liquid != 13 && !IS_NPC (ch) && IS_VAMPIRE (ch))
	{
	  send_to_char ("You can only drink blood.\n\r", ch);
	  break;
	}

      act ("$n drinks $T from $p.", ch, obj, liq_table[liquid].liq_name,
	   TO_ROOM);
      act ("You drink $T from $p.", ch, obj, liq_table[liquid].liq_name,
	   TO_CHAR);

      amount = number_range (3, 10);
      amount = UMIN (amount, obj->value[1]);

      gain_condition (ch, COND_DRUNK,
		      amount * liq_table[liquid].liq_affect[COND_DRUNK]);
      gain_condition (ch, COND_FULL,
		      amount * liq_table[liquid].liq_affect[COND_FULL]);
      gain_condition (ch, COND_THIRST,
		      amount * liq_table[liquid].liq_affect[COND_THIRST]);

      if (!IS_NPC (ch) && !IS_VAMPIRE (ch) &&
	  ch->pcdata->condition[COND_DRUNK] > 10)
	send_to_char ("You feel drunk.\n\r", ch);
      if (!IS_NPC (ch) && !IS_VAMPIRE (ch) &&
	  ch->pcdata->condition[COND_FULL] > 50)
	send_to_char ("You are full.\n\r", ch);
      if (!IS_NPC (ch) && !IS_VAMPIRE (ch) &&
	  ch->pcdata->condition[COND_THIRST] > 50)
	send_to_char ("You do not feel thirsty.\n\r", ch);
      if (!IS_NPC (ch) && IS_VAMPIRE (ch) &&
	  ch->pcdata->condition[COND_THIRST] >= 100)
	send_to_char ("The cold blood does little to satisfy you.\n\r", ch);

      if (obj->value[3] != 0 && (!IS_NPC (ch) && !IS_VAMPIRE (ch)))
	{
	  /* The shit was poisoned ! */
	  AFFECT_DATA af;

	  act ("$n chokes and gags.", ch, NULL, NULL, TO_ROOM);
	  send_to_char ("You choke and gag.\n\r", ch);
	  af.type = gsn_poison;
	  af.duration = 3 * amount;
	  af.location = APPLY_NONE;
	  af.modifier = 0;
	  af.bitvector = AFF_POISON;
	  affect_join (ch, &af);
	}

      obj->value[1] -= amount;
      if (obj->value[1] <= 0)
	{
	  obj->value[1] = 0;
	}
      break;
    }

  return;
}


void
do_empty (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  OBJ_DATA *obj;
  int liquid;

  one_argument (argument, arg);

  if (arg[0] == '\0')
    {
      send_to_char ("Empty what?\n\r", ch);
      return;
    }

  if ((obj = get_obj_here (ch, arg)) == NULL)
    {
      send_to_char ("You can't find it.\n\r", ch);
      return;
    }

  switch (obj->item_type)
    {
    default:
      send_to_char ("You cannot empty that.\n\r", ch);
      break;

    case ITEM_DRINK_CON:
      if (obj->value[1] <= 0)
	{
	  send_to_char ("It is already empty.\n\r", ch);
	  return;
	}

      if ((liquid = obj->value[2]) >= LIQ_MAX)
	{
	  bug ("Do_drink: bad liquid number %d.", liquid);
	  liquid = obj->value[2] = 0;
	}

      act ("$n empties $T from $p.", ch, obj, liq_table[liquid].liq_name,
	   TO_ROOM);
      act ("You empty $T from $p.", ch, obj, liq_table[liquid].liq_name,
	   TO_CHAR);

      obj->value[1] = 0;
      break;
    }

  return;
}



void
do_eat (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  OBJ_DATA *obj;
  int level;
  int cap = 0;

  one_argument (argument, arg);
  if (arg[0] == '\0')
    {
      send_to_char ("Eat what?\n\r", ch);
      return;
    }

  if ((obj = get_obj_carry (ch, arg)) == NULL)
    {
      send_to_char ("You do not have that item.\n\r", ch);
      return;
    }

  if (!IS_IMMORTAL (ch))
    {
      if (!IS_NPC (ch) && IS_VAMPIRE (ch) && obj->item_type == ITEM_FOOD)
	{
	  send_to_char ("You are unable to stomach it.\n\r", ch);
	  return;
	}
/*
	if ( !IS_NPC(ch) && obj->item_type == ITEM_CORPSE_NPC && 
	     get_disc(ch, DISC_THANATOSIS) < 6 )
	{
	    send_to_char( "That's not edible.\n\r", ch );
	    return;
	}
*/
      else if (obj->item_type != ITEM_FOOD && obj->item_type != ITEM_PILL
	       && obj->item_type != ITEM_EXP && obj->item_type != ITEM_CRYSTAL
	       && obj->item_type != ITEM_EGG && obj->item_type != ITEM_QUEST
	       && obj->item_type != ITEM_DRAGONGEM
	       && obj->item_type != ITEM_DPTOKEN
	       && obj->item_type != ITEM_TICKET)
	{
	  if (IS_NPC (ch) || !IS_SET (ch->act, PLR_WOLFMAN) ||
	      obj->item_type != ITEM_TRASH)
	    {
	      send_to_char ("That's not edible.\n\r", ch);
	      return;
	    }
	}

      if (!IS_NPC (ch) && ch->pcdata->condition[COND_FULL] > 50
	  && obj->item_type != ITEM_EXP && obj->item_type != ITEM_TRASH
	  && obj->item_type != ITEM_QUEST && obj->item_type != ITEM_CRYSTAL
	  && obj->item_type != ITEM_PILL && obj->item_type != ITEM_TICKET)
	{
	  send_to_char ("You are too full to eat more.\n\r", ch);
	  return;
	}
    }

  if (obj->item_type == ITEM_EXP && !IS_NPC (ch))
    {
      cap = ch->exp + obj->value[0];
      if (cap > 2100000000 || cap < 0)
	{
	  stc ("You have to much exp at the moment to eat that token.\n\r",
	       ch);
	  return;
	}
    }

  if (obj->item_type == ITEM_QUEST && !IS_NPC (ch))
    {
      cap = ch->pcdata->quest + obj->value[0];
      if (cap > 2100000000 || cap < 0)
	{
	  stc
	    ("You have to much credits at the moment to eat that token.\n\r",
	     ch);
	  return;
	}
    }
  if (obj->item_type == ITEM_TICKET && !IS_NPC (ch))
    {
      cap = ch->pcdata->ticket + obj->value[0];
      if (cap > 1000 || cap < 0)
	{
	  stc
	    ("You have to many ticket uses at the moment to eat that token.\n\r",
	     ch);
	  return;
	}
    }

  if (obj->item_type == ITEM_CRYSTAL && !IS_NPC (ch))
    {
      cap = ch->pcdata->crystal + obj->value[0];
      if (cap > 2100000000 || cap < 0)
	{
	  stc
	    ("You have to many crystals at the moment to eat that token.\n\r",
	     ch);
	  return;
	}
    }

  if (obj->item_type != ITEM_DRAGONGEM)
    {
      act ("$n eats $p.", ch, obj, NULL, TO_ROOM);
      act ("You eat $p.", ch, obj, NULL, TO_CHAR);
    }

  switch (obj->item_type)
    {
    default:
      break;

    case ITEM_CORPSE_NPC:
      {
/*
	    if (get_disc(ch, DISC_THANATOSIS) > 5 && ch->hit < ch->max_hit)
	    {
	    	ch->hit += (ch->max_hit * 0.1);
	    	if (ch->hit > ch->max_hit) ch->hit = ch->max_hit;
	    	if (ch->agg > 10) ch->agg -= 10;
	    	else ch->agg = 0;
	    	send_to_char("You feel better.\n\r",ch);
	    	waiting(ch,12);
	    }
*/
	break;
      }
    case ITEM_DRAGONGEM:
      {
	if (!IS_NPC (ch) && IS_DRAGON (ch))
	  {
	    ch->dps += obj->value[0];
	    act ("$n eats $p.", ch, obj, NULL, TO_ROOM);
	    act ("You eat $p.", ch, obj, NULL, TO_CHAR);
	  }
	break;
      }
    case ITEM_FOOD:
      {
	if (!IS_NPC (ch))
	  {
	    int condition;

	    condition = ch->pcdata->condition[COND_FULL];
	    gain_condition (ch, COND_FULL, obj->value[0]);
	    if (condition == 0 && ch->pcdata->condition[COND_FULL] > 10)
	      send_to_char ("You are no longer hungry.\n\r", ch);
	    else if (ch->pcdata->condition[COND_FULL] > 50)
	      send_to_char ("You are full.\n\r", ch);
	    if (!IS_VAMPIRE (ch) && ch->blood[0] < 100)
	      ch->blood[0]++;
	  }

	if (obj->value[3] != 0)
	  {
	    /* The shit was poisoned! */
	    AFFECT_DATA af;

	    act ("$n chokes and gags.", ch, NULL, NULL, TO_ROOM);
	    send_to_char ("You choke and gag.\n\r", ch);

	    af.type = gsn_poison;
	    af.duration = 2 * obj->value[0];
	    af.location = APPLY_NONE;
	    af.modifier = 0;
	    af.bitvector = AFF_POISON;
	    affect_join (ch, &af);
	  }
	break;
      }
    case ITEM_PILL:
      {
	level = obj->value[0];
	if (level < 1)
	  level = 1;
	if (level > MAX_SPELL)
	  level = MAX_SPELL;

	obj_cast_spell (obj->value[1], level, ch, ch, NULL);
	obj_cast_spell (obj->value[2], level, ch, ch, NULL);
	obj_cast_spell (obj->value[3], level, ch, ch, NULL);
	if (ch->position == POS_FIGHTING && obj->pIndexData->vnum != 3038)
	  waiting (ch, 30);
	else
	  waiting (ch, 8);
	break;
      }
    case ITEM_QUEST:
      {
	if (!IS_NPC (ch))
	  {
	    ch->pcdata->quest += obj->value[0];
	  }
	break;
      }
    case ITEM_EXP:
      {
	if (!IS_NPC (ch))
	  {
	    ch->exp += obj->value[0];
	  }
	break;
      }
    case ITEM_TICKET:
      {
	if (!IS_NPC (ch))
	  {
	    ch->pcdata->ticket += obj->value[0];
	  }
	break;
      }

    case ITEM_CRYSTAL:
      {
	if (!IS_NPC (ch))
	  {
	    ch->pcdata->crystal += obj->value[0];
	  }
	break;
      }
    case ITEM_EGG:
      {
	if (!IS_NPC (ch))
	  {
	    int condition;

	    condition = ch->pcdata->condition[COND_FULL];
	    gain_condition (ch, COND_FULL, obj->value[1]);
	    if (condition == 0 && ch->pcdata->condition[COND_FULL] > 10)
	      send_to_char ("You are no longer hungry.\n\r", ch);
	    else if (ch->pcdata->condition[COND_FULL] > 50)
	      send_to_char ("You are full.\n\r", ch);
	  }

	/* Note to myself...remember to set v2 for mobiles that hatch within
	 * the player (like aliens ;).  KaVir.
	 */

	if (obj->value[3] != 0)
	  {
	    /* The shit was poisoned! */
	    AFFECT_DATA af;

	    act ("$n chokes and gags.", ch, NULL, NULL, TO_ROOM);
	    send_to_char ("You choke and gag.\n\r", ch);

	    af.type = gsn_poison;
	    af.duration = 2 * obj->value[0];
	    af.location = APPLY_NONE;
	    af.modifier = 0;
	    af.bitvector = AFF_POISON;
	    affect_join (ch, &af);
	  }
	break;
      }
    }

  if (obj != NULL)
    {
      if (obj->pIndexData->vnum == 3038)
	{
	  obj->pilluses++;
	  if (obj->pilluses > 999)
	    {
	      act
		("$p winks out of exsistance, as you use it for the 1000th time, leaving a tiny note stating.\n\r#yWarranty Expires after 1000 uses.#n\n\rHmm wasent that Infinit after all....",
		 ch, obj, NULL, TO_CHAR);
	      extract_obj (obj);
	    }
	}
      else
	extract_obj (obj);
    }
  return;
}



/*
 * Remove an object.
 */
bool
remove_obj (CHAR_DATA * ch, int iWear, bool fReplace)
{
  OBJ_DATA *obj;

  if ((obj = get_eq_char (ch, iWear)) == NULL)
    return TRUE;

  if (!fReplace)
    return FALSE;

  if (IS_SET (obj->extra_flags, ITEM_NOREMOVE))
    {
      act ("You can't remove $p.", ch, obj, NULL, TO_CHAR);
      return FALSE;
    }
  if (obj->item_type == ITEM_MASTERY)
    {
      act ("$n's body stops glowing as they remove their $p.", ch, obj, NULL,
	   TO_ROOM);
      act ("Your body stops glowing as remove your $p.", ch, obj, NULL,
	   TO_CHAR);
      unequip_char (ch, obj);
      REMOVE_BIT (ch->itemaffect, ITEMA_MASTERY);
      REMOVE_BIT (ch->evenmore, EM_MASTERY);
      return;
    }
  unequip_char (ch, obj);
  act ("$n stops using $p.", ch, obj, NULL, TO_ROOM);
  act ("You stop using $p.", ch, obj, NULL, TO_CHAR);
  return TRUE;
}



/*
 * Wear one object.
 * Optional replacement of existing objects.
 * Big repetitive code, ick.
 */
void
wear_obj (CHAR_DATA * ch, OBJ_DATA * obj, bool fReplace)
{
  char buf[MSL];
  bool wolf_ok = TRUE;
/*
    bool wolf_ok = FALSE;

    if (!IS_NPC(ch) && IS_WEREWOLF(ch) && ch->polyaff == 0 &&
	IS_SET(obj->spectype, SITEM_WOLFWEAPON)) wolf_ok = TRUE;
*/
  if (IS_OBJ_STAT (obj, ITEM_BROKEN))
    {
      act ("$p is broken and can't be used until repaired.\n\r", ch, obj,
	   NULL, TO_CHAR);
      return;
    }

  if (CAN_WEAR (obj, ITEM_WIELD) || CAN_WEAR (obj, ITEM_HOLD) ||
      CAN_WEAR (obj, ITEM_WEAR_SHIELD) || obj->item_type == ITEM_LIGHT)
    {
/*
	if ( get_eq_char( ch, WEAR_WIELD    ) != NULL
	&&   get_eq_char( ch, WEAR_HOLD     ) != NULL
	&&   get_eq_char( ch, WEAR_LIGHT    ) != NULL
	&&   get_eq_char( ch, WEAR_SHIELD   ) != NULL
	&&   !remove_obj( ch, WEAR_LIGHT , fReplace )
	&&   !remove_obj( ch, WEAR_SHIELD, fReplace )
	&&   !remove_obj( ch, WEAR_WIELD , fReplace )
	&&   !remove_obj( ch, WEAR_HOLD  , fReplace ) )
	    return;
*/
      if (get_eq_char (ch, WEAR_WIELD) != NULL
	  && get_eq_char (ch, WEAR_HOLD) != NULL
	  && get_eq_char (ch, WEAR_THIRD_HAND) != NULL
	  && get_eq_char (ch, WEAR_FOURTH_HAND) != NULL
	  && !remove_obj (ch, WEAR_WIELD, fReplace)
	  && !remove_obj (ch, WEAR_HOLD, fReplace)
	  && !remove_obj (ch, WEAR_THIRD_HAND, fReplace)
	  && !remove_obj (ch, WEAR_FOURTH_HAND, fReplace))
	return;

      if (!IS_NPC (ch) && !IS_FORM (ch, ITEM_WIELD))
	{
	  send_to_char ("You are unable to use it.\n\r", ch);
	  return;
	}
      if (get_eq_char (ch, WEAR_WIELD) == NULL
	  && is_ok_to_wear (ch, wolf_ok, "right_hand", obj))
	{
	  if (obj->item_type == ITEM_LIGHT)
	    {
	      act ("$n lights $p and clutches it in $s right hand.", ch, obj,
		   NULL, TO_ROOM);
	      act ("You light $p and clutch it in your right hand.", ch, obj,
		   NULL, TO_CHAR);
	    }
	  else
	    {
	      act ("$n clutches $p in $s right hand.", ch, obj, NULL,
		   TO_ROOM);
	      act ("You clutch $p in your right hand.", ch, obj, NULL,
		   TO_CHAR);
	    }
	  if (obj->item_type == ITEM_WEAPON)
	    {
	      if (IS_OBJ_STAT (obj, ITEM_LOYAL))
		{
		  if (strlen (obj->questowner) > 1
		      && str_cmp (ch->name, obj->questowner))
		    {
		      act ("$p leaps out of $n's hand.", ch, obj, NULL,
			   TO_ROOM);
		      act ("$p leaps out of your hand.", ch, obj, NULL,
			   TO_CHAR);
		      obj_from_char (obj);
		      obj_to_room (obj, ch->in_room);
		      return;
		    }
		}
	      equip_char (ch, obj, WEAR_WIELD);
	      if (!IS_NPC (ch))
		do_skill (ch, ch->name);
	      return;
	    }
	  equip_char (ch, obj, WEAR_WIELD);
	  return;
	}
      else if (get_eq_char (ch, WEAR_HOLD) == NULL
	       && is_ok_to_wear (ch, wolf_ok, "left_hand", obj))
	{
	  if (obj->item_type == ITEM_LIGHT)
	    {
	      act ("$n lights $p and clutches it in $s left hand.", ch, obj,
		   NULL, TO_ROOM);
	      act ("You light $p and clutch it in your left hand.", ch, obj,
		   NULL, TO_CHAR);
	    }
	  else
	    {
	      act ("$n clutches $p in $s left hand.", ch, obj, NULL, TO_ROOM);
	      act ("You clutch $p in your left hand.", ch, obj, NULL,
		   TO_CHAR);
	    }
	  if (obj->item_type == ITEM_WEAPON)
	    {
	      if (IS_OBJ_STAT (obj, ITEM_LOYAL))
		{
		  if (strlen (obj->questowner) > 1
		      && str_cmp (ch->name, obj->questowner))
		    {
		      act ("$p leaps out of $n's hand.", ch, obj, NULL,
			   TO_ROOM);
		      act ("$p leaps out of your hand.", ch, obj, NULL,
			   TO_CHAR);
		      obj_from_char (obj);
		      obj_to_room (obj, ch->in_room);
		      return;
		    }
		}
	      equip_char (ch, obj, WEAR_HOLD);
	      if (!IS_NPC (ch))
		do_skill (ch, ch->name);
	      return;
	    }
	  equip_char (ch, obj, WEAR_HOLD);
	  return;
	}
      else if (get_eq_char (ch, WEAR_THIRD_HAND) == NULL
	       && is_ok_to_wear (ch, wolf_ok, "third_hand", obj))
	{
	  if (obj->item_type == ITEM_LIGHT)
	    {
	      act ("$n lights $p and clutches it in $s third hand.", ch, obj,
		   NULL, TO_ROOM);
	      act ("You light $p and clutch it in your third hand.", ch, obj,
		   NULL, TO_CHAR);
	    }
	  else
	    {
	      act ("$n clutches $p in $s third hand.", ch, obj, NULL,
		   TO_ROOM);
	      act ("You clutch $p in your third hand.", ch, obj, NULL,
		   TO_CHAR);
	    }
	  if (obj->item_type == ITEM_WEAPON)
	    {
	      if (IS_OBJ_STAT (obj, ITEM_LOYAL))
		{
		  if (strlen (obj->questowner) > 1
		      && str_cmp (ch->name, obj->questowner))
		    {
		      act ("$p leaps out of $n's hand.", ch, obj, NULL,
			   TO_ROOM);
		      act ("$p leaps out of your hand.", ch, obj, NULL,
			   TO_CHAR);
		      obj_from_char (obj);
		      obj_to_room (obj, ch->in_room);
		      return;
		    }
		}
	      equip_char (ch, obj, WEAR_THIRD_HAND);
	      if (!IS_NPC (ch))
		do_skill (ch, ch->name);
	      return;
	    }
	  equip_char (ch, obj, WEAR_THIRD_HAND);
	  return;
	}
      else if (get_eq_char (ch, WEAR_FOURTH_HAND) == NULL
	       && is_ok_to_wear (ch, wolf_ok, "fourth_hand", obj))
	{
	  if (obj->item_type == ITEM_LIGHT)
	    {
	      act ("$n lights $p and clutches it in $s fourth hand.", ch, obj,
		   NULL, TO_ROOM);
	      act ("You light $p and clutch it in your fourth hand.", ch, obj,
		   NULL, TO_CHAR);
	    }
	  else
	    {
	      act ("$n clutches $p in $s fourth hand.", ch, obj, NULL,
		   TO_ROOM);
	      act ("You clutch $p in your fourth hand.", ch, obj, NULL,
		   TO_CHAR);
	    }
	  if (obj->item_type == ITEM_WEAPON)
	    {
	      if (IS_OBJ_STAT (obj, ITEM_LOYAL))
		{
		  if (strlen (obj->questowner) > 1
		      && str_cmp (ch->name, obj->questowner))
		    {
		      act ("$p leaps out of $n's hand.", ch, obj, NULL,
			   TO_ROOM);
		      act ("$p leaps out of your hand.", ch, obj, NULL,
			   TO_CHAR);
		      obj_from_char (obj);
		      obj_to_room (obj, ch->in_room);
		      return;
		    }
		}
	      equip_char (ch, obj, WEAR_FOURTH_HAND);
	      if (!IS_NPC (ch))
		do_skill (ch, ch->name);
	      return;
	    }
	  equip_char (ch, obj, WEAR_FOURTH_HAND);
	  return;
	}
      if (!is_ok_to_wear (ch, wolf_ok, "left_hand", obj)
	  && !is_ok_to_wear (ch, wolf_ok, "right_hand", obj))
	send_to_char ("You cannot use anything in your hands.\n\r", ch);
      else if (IS_MONK (ch) && !IS_SHINOBI (ch) && !IS_TAKARRA (ch)
	       && !IS_SET (obj->quest, QUEST_ARTIFACT))
	send_to_char ("You must keep your hands free for combat!\n\r", ch);
      else
	send_to_char ("You have no free hands.\n\r", ch);
      return;
    }
/*
    if ( obj->item_type == ITEM_LIGHT )
    {
	if ( !remove_obj( ch, WEAR_LIGHT, fReplace ) )
	    return;
	act( "$n lights $p and holds it.", ch, obj, NULL, TO_ROOM );
	act( "You light $p and hold it.",  ch, obj, NULL, TO_CHAR );
	equip_char( ch, obj, WEAR_LIGHT );
	return;
    }
*/

  if (obj->item_type == ITEM_MASTERY)
    {
      sprintf (buf, "%s %s mastery", ch->name, get_class (ch));

      if (str_cmp (buf, obj->creator))
	{
	  act ("$p glows and zaps $n as $e trys to equip it.", ch, obj, NULL,
	       TO_ROOM);
	  act ("$p glows and zaps you as you try to equip it.", ch, obj, NULL,
	       TO_CHAR);
	  obj_from_char (obj);
	  obj_to_room (obj, ch->in_room);
	  do_autosave (ch, "");
	  return;
	}

      if (!remove_obj (ch, WEAR_MASTERY, fReplace))
	return;
      act ("$n's body glows as they equip theirself with their $p.", ch, obj,
	   NULL, TO_ROOM);
      act ("Your body glows as you equip yourself with $p.", ch, obj, NULL,
	   TO_CHAR);
      equip_char (ch, obj, WEAR_MASTERY);
      SET_BIT (ch->itemaffect, ITEMA_MASTERY);
      SET_BIT (ch->evenmore, EM_MASTERY);
      return;
    }

  if (IS_SET (obj->wear_flags, ITEM_WEAR_SPECIAL)
      || (IS_BSD (ch) && IS_SET (obj->quest, QUEST_ARTIFACT)
	  && obj->item_type != ITEM_WEAPON))
    {

      if (!remove_obj (ch, WEAR_SPECIAL, fReplace))
	return;

      act ("$n activates $p and it starts to slowly orbit $s head.", ch, obj,
	   NULL, TO_ROOM);
      act ("You activate $p and it starts to slowly orbit your head.", ch,
	   obj, NULL, TO_CHAR);
      equip_char (ch, obj, WEAR_SPECIAL);
      return;
    }

  if (CAN_WEAR (obj, ITEM_WEAR_FINGER))
    {
      if (get_eq_char (ch, WEAR_FINGER_L) != NULL
	  && get_eq_char (ch, WEAR_FINGER_R) != NULL
	  && !remove_obj (ch, WEAR_FINGER_L, fReplace)
	  && !remove_obj (ch, WEAR_FINGER_R, fReplace))
	return;
      if (!IS_NPC (ch) && !IS_FORM (ch, ITEM_WEAR_FINGER))
	{
	  send_to_char ("You are unable to wear it.\n\r", ch);
	  return;
	}

      if (IS_KENSAI (ch) && !IS_SET (obj->quest, QUEST_ARTIFACT))
	{
	  stc
	    ("You can't wear any armor; it would hinder your movements.\n\r",
	     ch);
	  return;
	}

      if (get_eq_char (ch, WEAR_FINGER_L) == NULL
	  && is_ok_to_wear (ch, wolf_ok, "left_finger", obj))
	{
	  act ("$n wears $p on $s left finger.", ch, obj, NULL, TO_ROOM);
	  act ("You wear $p on your left finger.", ch, obj, NULL, TO_CHAR);
	  equip_char (ch, obj, WEAR_FINGER_L);
	  return;
	}
      else if (get_eq_char (ch, WEAR_FINGER_R) == NULL
	       && is_ok_to_wear (ch, wolf_ok, "right_finger", obj))
	{
	  act ("$n wears $p on $s right finger.", ch, obj, NULL, TO_ROOM);
	  act ("You wear $p on your right finger.", ch, obj, NULL, TO_CHAR);
	  equip_char (ch, obj, WEAR_FINGER_R);
	  return;
	}
      if (!is_ok_to_wear (ch, wolf_ok, "left_finger", obj)
	  && !is_ok_to_wear (ch, wolf_ok, "right_finger", obj))
	send_to_char ("You cannot wear any rings.\n\r", ch);
      else
	send_to_char ("You cannot wear any more rings.\n\r", ch);
      return;
    }

  if (CAN_WEAR (obj, ITEM_WEAR_NECK))
    {
      if (get_eq_char (ch, WEAR_NECK_1) != NULL
	  && get_eq_char (ch, WEAR_NECK_2) != NULL
	  && !remove_obj (ch, WEAR_NECK_1, fReplace)
	  && !remove_obj (ch, WEAR_NECK_2, fReplace))
	return;
      if (!IS_NPC (ch) && !IS_FORM (ch, ITEM_WEAR_NECK))
	{
	  send_to_char ("You are unable to wear it.\n\r", ch);
	  return;
	}

      if (IS_KENSAI (ch) && !IS_SET (obj->quest, QUEST_ARTIFACT))
	{
	  stc
	    ("You can't wear any armor; it would hinder your movements.\n\r",
	     ch);
	  return;
	}

      if (get_eq_char (ch, WEAR_NECK_1) == NULL)
	{
	  act ("$n slips $p around $s neck.", ch, obj, NULL, TO_ROOM);
	  act ("You slip $p around your neck.", ch, obj, NULL, TO_CHAR);
	  equip_char (ch, obj, WEAR_NECK_1);
	  return;
	}

      if (get_eq_char (ch, WEAR_NECK_2) == NULL)
	{
	  act ("$n slips $p around $s neck.", ch, obj, NULL, TO_ROOM);
	  act ("You slip $p around your neck.", ch, obj, NULL, TO_CHAR);
	  equip_char (ch, obj, WEAR_NECK_2);
	  return;
	}
      bug ("Wear_obj: no free neck.", 0);
      send_to_char
	("You are already wearing two things around your neck.\n\r", ch);
      return;
    }

  if (CAN_WEAR (obj, ITEM_WEAR_BODY))
    {
      if (!remove_obj (ch, WEAR_BODY, fReplace))
	return;

      if (!IS_NPC (ch) && !IS_FORM (ch, ITEM_WEAR_BODY))
	{
	  send_to_char ("You are unable to wear it.\n\r", ch);
	  return;
	}
      if (IS_KENSAI (ch) && !IS_SET (obj->quest, QUEST_ARTIFACT))
	{
	  stc
	    ("You can't wear any armor; it would hinder your movements.\n\r",
	     ch);
	  return;
	}
      act ("$n fits $p on $s body.", ch, obj, NULL, TO_ROOM);
      act ("You fit $p on your body.", ch, obj, NULL, TO_CHAR);
      equip_char (ch, obj, WEAR_BODY);
      return;
    }

  if (CAN_WEAR (obj, ITEM_WEAR_QUIVER))
    {
      if (!remove_obj (ch, WEAR_QUIVER, fReplace))
	return;

      if (!IS_NPC (ch) && !IS_FORM (ch, ITEM_WEAR_WAIST))
	{
	  send_to_char ("You are unable to wear it.\n\r", ch);
	  return;
	}
      if (IS_KENSAI (ch) && !IS_SET (obj->quest, QUEST_ARTIFACT))
	{
	  stc
	    ("You can't wear any armor; it would hinder your movements.\n\r",
	     ch);
	  return;
	}
      act ("$n fastens $p on $s hip.", ch, obj, NULL, TO_ROOM);
      act ("You fasten $p on your hip.", ch, obj, NULL, TO_CHAR);
      equip_char (ch, obj, WEAR_QUIVER);
      return;
    }

  if (CAN_WEAR (obj, ITEM_WEAR_HEAD))
    {
      if (!remove_obj (ch, WEAR_HEAD, fReplace))
	return;
      if (!IS_NPC (ch) && !IS_FORM (ch, ITEM_WEAR_HEAD))
	{
	  send_to_char ("You are unable to wear it.\n\r", ch);
	  return;
	}
      if (IS_KENSAI (ch) && !IS_SET (obj->quest, QUEST_ARTIFACT))
	{
	  stc
	    ("You can't wear any armor; it would hinder your movements.\n\r",
	     ch);
	  return;
	}
      if (!is_ok_to_wear (ch, wolf_ok, "head", obj))
	{
	  send_to_char ("You have no head to wear it on.\n\r", ch);
	  return;
	}
      act ("$n places $p on $s head.", ch, obj, NULL, TO_ROOM);
      act ("You place $p on your head.", ch, obj, NULL, TO_CHAR);
      equip_char (ch, obj, WEAR_HEAD);
      return;
    }

  if (CAN_WEAR (obj, ITEM_WEAR_FACE))
    {
      if (!remove_obj (ch, WEAR_FACE, fReplace))
	return;
      if (!IS_NPC (ch) && !IS_FORM (ch, ITEM_WEAR_HEAD))
	{
	  send_to_char ("You are unable to wear it.\n\r", ch);
	  return;
	}
      if (IS_KENSAI (ch) && !IS_SET (obj->quest, QUEST_ARTIFACT))
	{
	  stc
	    ("You can't wear any armor; it would hinder your movements.\n\r",
	     ch);
	  return;
	}
      if (!is_ok_to_wear (ch, wolf_ok, "face", obj))
	{
	  send_to_char ("You have no face to wear it on.\n\r", ch);
	  return;
	}
      act ("$n places $p on $s face.", ch, obj, NULL, TO_ROOM);
      act ("You place $p on your face.", ch, obj, NULL, TO_CHAR);
      equip_char (ch, obj, WEAR_FACE);
      return;
    }

  if (CAN_WEAR (obj, ITEM_WEAR_LEGS))
    {
      if (!remove_obj (ch, WEAR_LEGS, fReplace))
	return;
      if (!IS_NPC (ch) && !IS_FORM (ch, ITEM_WEAR_LEGS))
	{
	  send_to_char ("You are unable to wear it.\n\r", ch);
	  return;
	}
      if (IS_KENSAI (ch) && !IS_SET (obj->quest, QUEST_ARTIFACT))
	{
	  stc
	    ("You can't wear any armor; it would hinder your movements.\n\r",
	     ch);
	  return;
	}
      if (!is_ok_to_wear (ch, wolf_ok, "legs", obj))
	{
	  send_to_char ("You have no legs to wear them on.\n\r", ch);
	  return;
	}
      act ("$n slips $s legs into $p.", ch, obj, NULL, TO_ROOM);
      act ("You slip your legs into $p.", ch, obj, NULL, TO_CHAR);
      equip_char (ch, obj, WEAR_LEGS);
      return;
    }

  if (CAN_WEAR (obj, ITEM_WEAR_FEET))
    {
      if (!remove_obj (ch, WEAR_FEET, fReplace))
	return;
      if (!IS_NPC (ch) && !IS_FORM (ch, ITEM_WEAR_FEET))
	{
	  send_to_char ("You are unable to wear it.\n\r", ch);
	  return;
	}
      if (IS_KENSAI (ch) && !IS_SET (obj->quest, QUEST_ARTIFACT))
	{
	  stc
	    ("You can't wear any armor; it would hinder your movements.\n\r",
	     ch);
	  return;
	}
      if (!is_ok_to_wear (ch, wolf_ok, "feet", obj))
	{
	  send_to_char ("You have no feet to wear them on.\n\r", ch);
	  return;
	}
      act ("$n slips $s feet into $p.", ch, obj, NULL, TO_ROOM);
      act ("You slip your feet into $p.", ch, obj, NULL, TO_CHAR);
      equip_char (ch, obj, WEAR_FEET);
      return;
    }

  if (CAN_WEAR (obj, ITEM_WEAR_HANDS))
    {
      if (!remove_obj (ch, WEAR_HANDS, fReplace))
	return;
      if (!IS_NPC (ch) && !IS_FORM (ch, ITEM_WEAR_HANDS))
	{
	  send_to_char ("You are unable to wear it.\n\r", ch);
	  return;
	}
      if (IS_KENSAI (ch) && !IS_SET (obj->quest, QUEST_ARTIFACT))
	{
	  stc
	    ("You can't wear any armor; it would hinder your movements.\n\r",
	     ch);
	  return;
	}
      if (!is_ok_to_wear (ch, wolf_ok, "hands", obj))
	{
	  send_to_char ("You have no hands to wear them on.\n\r", ch);
	  return;
	}
      act ("$n pulls $p onto $s hands.", ch, obj, NULL, TO_ROOM);
      act ("You pull $p onto your hands.", ch, obj, NULL, TO_CHAR);
      equip_char (ch, obj, WEAR_HANDS);
      return;
    }

  if (CAN_WEAR (obj, ITEM_WEAR_ARMS))
    {
      if (!remove_obj (ch, WEAR_ARMS, fReplace))
	return;
      if (!IS_NPC (ch) && !IS_FORM (ch, ITEM_WEAR_ARMS))
	{
	  send_to_char ("You are unable to wear it.\n\r", ch);
	  return;
	}
      if (IS_KENSAI (ch) && !IS_SET (obj->quest, QUEST_ARTIFACT))
	{
	  stc
	    ("You can't wear any armor; it would hinder your movements.\n\r",
	     ch);
	  return;
	}
      if (!is_ok_to_wear (ch, wolf_ok, "arms", obj))
	{
	  send_to_char ("You have no arms to wear them on.\n\r", ch);
	  return;
	}
      act ("$n slides $s arms into $p.", ch, obj, NULL, TO_ROOM);
      act ("You slide your arms into $p.", ch, obj, NULL, TO_CHAR);
      equip_char (ch, obj, WEAR_ARMS);
      return;
    }

  if (CAN_WEAR (obj, ITEM_WEAR_ABOUT))
    {
      if (!remove_obj (ch, WEAR_ABOUT, fReplace))
	return;
      if (!IS_NPC (ch) && !IS_FORM (ch, ITEM_WEAR_ABOUT))
	{
	  send_to_char ("You are unable to wear it.\n\r", ch);
	  return;
	}
      if (IS_KENSAI (ch) && !IS_SET (obj->quest, QUEST_ARTIFACT))
	{
	  stc
	    ("You can't wear any armor; it would hinder your movements.\n\r",
	     ch);
	  return;
	}
      act ("$n pulls $p about $s body.", ch, obj, NULL, TO_ROOM);
      act ("You pull $p about your body.", ch, obj, NULL, TO_CHAR);
      equip_char (ch, obj, WEAR_ABOUT);
      return;
    }

  if (CAN_WEAR (obj, ITEM_WEAR_WAIST))
    {
      if (!remove_obj (ch, WEAR_WAIST, fReplace))
	return;
      if (!IS_NPC (ch) && !IS_FORM (ch, ITEM_WEAR_WAIST))
	{
	  send_to_char ("You are unable to wear it.\n\r", ch);
	  return;
	}
      if (IS_KENSAI (ch) && !IS_SET (obj->quest, QUEST_ARTIFACT))
	{
	  stc
	    ("You can't wear any armor; it would hinder your movements.\n\r",
	     ch);
	  return;
	}
      act ("$n ties $p around $s waist.", ch, obj, NULL, TO_ROOM);
      act ("You tie $p around your waist.", ch, obj, NULL, TO_CHAR);
      equip_char (ch, obj, WEAR_WAIST);
      return;
    }

  if (CAN_WEAR (obj, ITEM_WEAR_WRIST))
    {
      if (get_eq_char (ch, WEAR_WRIST_L) != NULL
	  && get_eq_char (ch, WEAR_WRIST_R) != NULL
	  && !remove_obj (ch, WEAR_WRIST_L, fReplace)
	  && !remove_obj (ch, WEAR_WRIST_R, fReplace))
	return;
      if (!IS_NPC (ch) && !IS_FORM (ch, ITEM_WEAR_WRIST))
	{
	  send_to_char ("You are unable to wear it.\n\r", ch);
	  return;
	}
      if (IS_KENSAI (ch) && !IS_SET (obj->quest, QUEST_ARTIFACT))
	{
	  stc
	    ("You can't wear any armor; it would hinder your movements.\n\r",
	     ch);
	  return;
	}

      if (get_eq_char (ch, WEAR_WRIST_L) == NULL
	  && is_ok_to_wear (ch, wolf_ok, "right_wrist", obj))
	{
	  act ("$n slides $s left wrist into $p.", ch, obj, NULL, TO_ROOM);
	  act ("You slide your left wrist into $p.", ch, obj, NULL, TO_CHAR);
	  equip_char (ch, obj, WEAR_WRIST_L);
	  return;
	}
      else if (get_eq_char (ch, WEAR_WRIST_R) == NULL
	       && is_ok_to_wear (ch, wolf_ok, "left_wrist", obj))
	{
	  act ("$n slides $s right wrist into $p.", ch, obj, NULL, TO_ROOM);
	  act ("You slide your right wrist into $p.", ch, obj, NULL, TO_CHAR);
	  equip_char (ch, obj, WEAR_WRIST_R);
	  return;
	}
      if (!is_ok_to_wear (ch, wolf_ok, "left_wrist", obj)
	  && !is_ok_to_wear (ch, wolf_ok, "right_wrist", obj))
	send_to_char ("You cannot wear anything on your wrists.\n\r", ch);
      else
	send_to_char ("You cannot wear any more on your wrists.\n\r", ch);
      return;
    }
/*
    if ( CAN_WEAR( obj, ITEM_WEAR_SHIELD ) )
    {
	if ( !remove_obj( ch, WEAR_SHIELD, fReplace ) )
	    return;
	if (!IS_NPC(ch) && !IS_FORM(ch,ITEM_WEAR_SHIELD))
	{
	    send_to_char("You are unable to wear it.\n\r",ch);
	    return;
	}
	act( "$n straps $p onto $s shield arm.", ch, obj, NULL, TO_ROOM );
	act( "You strap $p onto your shield arm.", ch, obj, NULL, TO_CHAR );
	equip_char( ch, obj, WEAR_SHIELD );
	return;
    }

    if ( CAN_WEAR( obj, ITEM_WIELD ) )
    {
	if ( !remove_obj( ch, WEAR_WIELD, fReplace ) )
	    return;
	if (!IS_NPC(ch) && !IS_FORM(ch,ITEM_WIELD))
	{
	    send_to_char("You are unable to wield it.\n\r",ch);
	    return;
	}

	if ( get_obj_weight( obj ) > str_app[get_curr_str(ch)].wield )
	{
	    send_to_char( "It is too heavy for you to wield.\n\r", ch );
	    return;
	}

	act( "$n wields $p.", ch, obj, NULL, TO_ROOM );
	act( "You wield $p.", ch, obj, NULL, TO_CHAR );

	if (IS_OBJ_STAT(obj,ITEM_LOYAL))
	{
	    if ( strlen(obj->questowner) > 1 && str_cmp(ch->name,obj->questowner) )
	    {
		act( "$p leaps out of $n's hand.", ch, obj, NULL, TO_ROOM );
		act( "$p leaps out of your hand.", ch, obj, NULL, TO_CHAR );
		obj_from_char(obj);
		obj_to_room(obj,ch->in_room);
		return;
	    }
	}
	equip_char( ch, obj, WEAR_WIELD );
	if (!IS_NPC(ch)) do_skill(ch, ch->name);
	return;
    }
*/
  if (fReplace)
    send_to_char ("You can't wear, wield or hold that.\n\r", ch);

  return;
}



void
do_wear (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  OBJ_DATA *obj;

  one_argument (argument, arg);
  if (IS_NPC (ch) && IS_SET (ch->act, ACT_WONDER))
    return;

  if (!IS_WRAITH (ch) && IS_AFFECTED (ch, AFF_POLYMORPH) && !IS_NPC (ch)
      && ch->polyaff != 0 && !IS_VAMPAFF (ch, VAM_DISGUISED)
      && !IS_SET (ch->act, PLR_WOLFMAN))
    {
      send_to_char ("You cannot wear anything in this form.\n\r", ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Wear, wield, or hold what?\n\r", ch);
      return;
    }

  if (!str_cmp (arg, "all"))
    {
      OBJ_DATA *obj_next;

      for (obj = ch->carrying; obj != NULL; obj = obj_next)
	{
	  obj_next = obj->next_content;
	  if (obj->wear_loc == WEAR_NONE && can_see_obj (ch, obj))
	    wear_obj (ch, obj, FALSE);
	}
      return;
    }
  else
    {
      if ((obj = get_obj_carry (ch, arg)) == NULL)
	{
	  send_to_char ("You do not have that item.\n\r", ch);
	  return;
	}

      wear_obj (ch, obj, TRUE);
    }

  return;
}



void
do_remove (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  OBJ_DATA *obj;
  if (IS_NPC (ch) && IS_SET (ch->act, ACT_WONDER))
    return;
  one_argument (argument, arg);

  if (IS_EXTRA (ch, EXTRA_ILLUSION))
    {
      send_to_char ("You cannot remove your equipment.\n\r", ch);
      return;
    }

  if (arg[0] == '\0')
    {
      send_to_char ("Remove what?\n\r", ch);
      return;
    }

  if (!str_cmp (arg, "all"))
    {
      OBJ_DATA *obj_next;

      for (obj = ch->carrying; obj != NULL; obj = obj_next)
	{
	  obj_next = obj->next_content;
	  if (obj->wear_loc != WEAR_NONE && can_see_obj (ch, obj))
	    remove_obj (ch, obj->wear_loc, TRUE);
	}
      return;
    }
  if ((obj = get_obj_wear (ch, arg)) == NULL)
    {
      send_to_char ("You do not have that item.\n\r", ch);
      return;
    }
  remove_obj (ch, obj->wear_loc, TRUE);
  return;
}



void
do_sacrifice (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  OBJ_DATA *obj;
  OBJ_DATA *cont_obj;
  OBJ_DATA *cont_obj_next;
  OBJ_DATA *next_obj;
  char buf[MIL];
  int expgain;
  int i = 0;

  one_argument (argument, arg);

  if (arg[0] == '\0')
    {
      send_to_char ("Sacrifice what?\n\r", ch);
      return;
    }
  if (IS_AFFECTED (ch, AFF_CHARM))
    {
      stc ("Not while charmed.\n\r", ch);
      return;
    }
  if (!str_cmp (arg, "all") || !str_prefix ("all.", arg))
    {
      next_obj = ch->in_room->contents;
      for (obj = ch->in_room->contents; next_obj != NULL; obj = next_obj)
	{
	  next_obj = obj->next_content;
	  if (arg[3] != '\0' && !is_name (&arg[4], obj->name))
	    continue;
	  if (++i > 35)
	    break;
	  if (!CAN_WEAR (obj, ITEM_TAKE) || obj->item_type == ITEM_QUEST
	      || obj->item_type == ITEM_QUESTCARD
	      || IS_SET (obj->quest, QUEST_ARTIFACT)
	      || obj->item_type == ITEM_PIECE
	      || obj->item_type == ITEM_EXP || obj->item_type == ITEM_CRYSTAL
	      || (obj->questowner != NULL && strlen (obj->questowner) > 1
		  && str_cmp (ch->name, obj->questowner)
		  && obj->item_type != ITEM_CORPSE_NPC))
	    {
	      act ("You are unable to drain any energy from $p.", ch, obj, 0,
		   TO_CHAR);
	      continue;
	    }
	  else if (obj->chobj != NULL && !IS_NPC (obj->chobj)
		   && obj->chobj->pcdata->obj_vnum != 0)
	    {
	      act ("You are unable to drain any energy from $p.", ch, obj, 0,
		   TO_CHAR);
	      continue;
	    }
	  if (IS_SET (obj->spectype, SITEM_MASTERY)
	      && obj->item_type != ITEM_PAGE)
	    {
	      stc ("You can't sacrifice this item, its a mastery item.\n\r",
		   ch);
	      continue;
	    }
	  if (obj->pIndexData->vnum == 3038)
	    {
	      stc
		("You can't sacrifice this item, its an #7Infinite#n Pill of #PG#pas#PB#preat#Ph#n.\n\r",
		 ch);
	      continue;
	    }
	  if (IS_SET (obj->weapflags, WEAPON_SOULJAR))
	    {
	      stc ("You can't sacrifice this item, its a Soul Jar.\n\r", ch);
	      continue;
	    }

	  if (obj->contains != NULL)
	    {
	      for (cont_obj = obj->contains; cont_obj;
		   cont_obj = cont_obj_next)
		{
		  cont_obj_next = cont_obj->next_content;
		  obj_from_obj (cont_obj);
		  obj_to_room (cont_obj, ch->in_room);
		  if (strlen (cont_obj->questowner) < 2
		      && cont_obj->item_type != ITEM_PIECE
		      && cont_obj->item_type != ITEM_QUEST
		      && cont_obj->item_type != ITEM_EXP
		      && cont_obj->item_type != ITEM_CRYSTAL
		      && !IS_SET (cont_obj->quest, QUEST_ARTIFACT))
		    {
		      cont_obj->timer = number_range (30, 40);
		      SET_BIT (cont_obj->weapflags, WEAPON_CRUMBLE);
		    }
		}
	    }

	  if (IS_SET (obj->spectype, SITEM_DEMONIC)
	      && obj->pIndexData->vnum != 29676 && obj->item_type != ITEM_PAGE
	      && IS_DEMON (ch))
	    {
	      sprintf (buf, "You drain 5000 points of %s power from $p.",
		       get_class (ch));
	      act (buf, ch, obj, NULL, TO_CHAR);
	      ch->pcdata->power[POWER_CURRENT] += 5000;
	      ch->pcdata->power[POWER_TOTAL] += 5000;
	    }
//rev
	  if (IS_SET (obj->spectype, SITEM_LEGEND) && HAS_CREDIT (ch)
	      && !IS_SET (obj->weapflags, WEAPON_WRAITH))
	    {
	      strcpy (buf,
		      "You drain the energy from $p and get a 2000 credit and 20 crystal refund.");
	      act (buf, ch, obj, NULL, TO_CHAR);
	      ch->pcdata->quest += 2000;
	      ch->pcdata->crystal += 20;
	      do_autosave (ch, "");
	    }
	  if (obj->points > 0 && !IS_NPC (ch) && obj->item_type != ITEM_PAGE)
	    {
	      sprintf (buf, "You receive a refund of %d credits from $p.",
		       obj->points);
	      act (buf, ch, obj, NULL, TO_CHAR);
	      ch->pcdata->quest += obj->points;
	    }
	  if (obj->crystal > 0 && !IS_NPC (ch) && HAS_CREDIT (ch))
	    {
	      sprintf (buf, "You receive a refund of %d crystals from $p.",
		       obj->crystal);
	      act (buf, ch, obj, NULL, TO_CHAR);
	      ch->pcdata->crystal += obj->crystal;
	    }
	  act ("$p disintegrates into a fine powder.", ch, obj, NULL,
	       TO_CHAR);
	  act ("$p disintegrates into a fine powder.", ch, obj, NULL,
	       TO_ROOM);
	  extract_obj (obj);
	}
      if (i == 0)
	send_to_char ("Nothing found.\n\r", ch);
      else
	act ("$n destroys most of the items in the room.", ch, NULL, NULL,
	     TO_ROOM);
      return;
    }




  obj = get_obj_list (ch, arg, ch->in_room->contents);
  if (obj == NULL)
    {
      send_to_char ("You can't find it.\n\r", ch);
      return;
    }
  if (!CAN_WEAR (obj, ITEM_TAKE) || obj->item_type == ITEM_QUEST
      || obj->item_type == ITEM_EXP || obj->item_type == ITEM_MONEY
      || obj->item_type == ITEM_TREASURE || obj->item_type == ITEM_CRYSTAL
      || obj->item_type == ITEM_QUESTCARD || obj->item_type == ITEM_PIECE
      || IS_SET (obj->quest, QUEST_ARTIFACT) || (obj->questowner != NULL
						 && strlen (obj->questowner) >
						 1
						 && str_cmp (ch->name,
							     obj->questowner)
						 && obj->item_type !=
						 ITEM_CORPSE_NPC))
    {
      act ("You are unable to drain any energy from $p.", ch, obj, 0,
	   TO_CHAR);
      return;
    }
  else if (obj->chobj != NULL && !IS_NPC (obj->chobj) &&
	   obj->chobj->pcdata->obj_vnum != 0)
    {
      act ("You are unable to drain any energy from $p.", ch, obj, 0,
	   TO_CHAR);
      return;
    }

  if (IS_SET (obj->weapflags, WEAPON_SOULJAR))
    {
      stc ("You can't sacrifice this item, its a Soul Jar.\n\r", ch);
      return;
    }
  if (obj->pIndexData->vnum == 3038)
    {
      stc
	("You can't sacrifice this item, its an #7Infinite#n Pill of #PG#pas#PB#preat#Ph#n.\n\r",
	 ch);
      return;
    }

  if (IS_SET (obj->spectype, SITEM_MASTERY) && obj->item_type != ITEM_PAGE)
    {
      stc ("You can't sacrifice this item, its a mastery item.\n\r", ch);
      return;
    }

  if (obj->item_type == ITEM_CORPSE_NPC || obj->item_type == ITEM_CONTAINER)
    {
      for (cont_obj = obj->contains; cont_obj; cont_obj = cont_obj_next)
	{
	  cont_obj_next = cont_obj->next_content;
	  obj_from_obj (cont_obj);
	  obj_to_room (cont_obj, ch->in_room);
	  if (strlen (cont_obj->questowner) < 2
	      && cont_obj->item_type != ITEM_QUEST
	      && cont_obj->item_type != ITEM_EXP
	      && cont_obj->item_type != ITEM_PIECE
	      && cont_obj->item_type != ITEM_CRYSTAL
	      && !IS_SET (cont_obj->quest, QUEST_ARTIFACT))
	    {
	      cont_obj->timer = number_range (30, 40);
	      SET_BIT (cont_obj->weapflags, WEAPON_CRUMBLE);
	    }
	}
    }
  expgain = obj->cost / 100;
  if (expgain < 1)
    expgain = 1;
  if (expgain > 50)
    expgain = 50;
  if (IS_SET (obj->spectype, SITEM_DEMONIC) && obj->item_type != ITEM_PAGE
      && obj->pIndexData->vnum != 29676 && IS_DEMON (ch))
    {
      sprintf (buf, "You drain 5000 points of %s power from $p.",
	       get_class (ch));
      act (buf, ch, obj, NULL, TO_CHAR);
      ch->pcdata->power[POWER_CURRENT] += 5000;
      ch->pcdata->power[POWER_TOTAL] += 5000;
    }

  if (IS_SET (obj->spectype, SITEM_LEGEND) && HAS_CREDIT (ch)
      && !IS_SET (obj->weapflags, WEAPON_WRAITH))
    {
      strcpy (buf,
	      "You drain the energy from $p and get a 2000 credit and 20 crystal refund.");
      act (buf, ch, obj, NULL, TO_CHAR);
      ch->pcdata->quest += 2000;
      ch->pcdata->crystal += 20;
      do_autosave (ch, "");
    }

/*
    else
    {
	sprintf( buf,"You drain %d exp of energy from $p.", expgain );
	act( buf, ch, obj, NULL, TO_CHAR );
	ch->exp += expgain;
    }
*/
  act ("$p disintegrates into a fine powder.", ch, obj, NULL, TO_CHAR);
  act ("$n drains the energy from $p.", ch, obj, NULL, TO_ROOM);
  act ("$p disintegrates into a fine powder.", ch, obj, NULL, TO_ROOM);
  if (obj->points > 0 && !IS_NPC (ch) && obj->item_type != ITEM_PAGE
      && HAS_CREDIT (ch))
    {
      sprintf (buf, "You receive a refund of %d credits from $p.",
	       obj->points);
      act (buf, ch, obj, NULL, TO_CHAR);
      ch->pcdata->quest += obj->points;
      do_autosave (ch, "");
    }
  if (obj->crystal > 0 && !IS_NPC (ch) && HAS_CREDIT (ch))
    {
      sprintf (buf, "You receive a refund of %d crystals from $p.",
	       obj->crystal);
      act (buf, ch, obj, NULL, TO_CHAR);
      ch->pcdata->crystal += obj->crystal;
      do_autosave (ch, "");
    }

  extract_obj (obj);
  return;
}


void
do_quaff (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  OBJ_DATA *obj;
  int level;

  one_argument (argument, arg);

  if (arg[0] == '\0')
    {
      send_to_char ("Quaff what?\n\r", ch);
      return;
    }

  if ((obj = get_obj_carry (ch, arg)) == NULL)
    {
      send_to_char ("You do not have that potion.\n\r", ch);
      return;
    }

  if (obj->item_type != ITEM_POTION)
    {
      send_to_char ("You can quaff only potions.\n\r", ch);
      return;
    }

  act ("$n quaffs $p.", ch, obj, NULL, TO_ROOM);
  act ("You quaff $p.", ch, obj, NULL, TO_CHAR);

  level = obj->value[0];
  if (level < 1)
    level = 1;
  if (level > MAX_SPELL)
    level = MAX_SPELL;

  obj_cast_spell (obj->value[1], level, ch, ch, NULL);
  obj_cast_spell (obj->value[2], level, ch, ch, NULL);
  obj_cast_spell (obj->value[3], level, ch, ch, NULL);

  extract_obj (obj);
  if (ch->position == POS_FIGHTING)
    waiting (ch, 30);
  else
    waiting (ch, 8);
  return;
}



void
do_recite (CHAR_DATA * ch, char *argument)
{
  char arg1[MIL];
  char arg2[MIL];
  CHAR_DATA *victim;
  OBJ_DATA *scroll = NULL;
  OBJ_DATA *obj = NULL;
  int level;

  argument = one_argument (argument, arg1);
  argument = one_argument (argument, arg2);

  if (IS_NPC (ch))
    return;

  if ((scroll = get_obj_carry (ch, arg1)) == NULL)
    {
      send_to_char ("You do not have that scroll.\n\r", ch);
      return;
    }

  if (scroll->item_type != ITEM_SCROLL)
    {
      send_to_char ("You can recite only scrolls.\n\r", ch);
      return;
    }

  if (arg2[0] == '\0')
    {
      victim = ch;
    }
  else
    {
      if ((victim = get_char_room (ch, arg2)) == NULL
	  && (obj = get_obj_here (ch, arg2)) == NULL)
	{
	  send_to_char ("You can't find it.\n\r", ch);
	  return;
	}
    }

  act ("$n recites $p.", ch, scroll, NULL, TO_ROOM);
  act ("You recite $p.", ch, scroll, NULL, TO_CHAR);

  level = scroll->value[0];
  if (level < 1)
    level = 1;
  if (level > MAX_SPELL)
    level = MAX_SPELL;

  obj_cast_spell (scroll->value[1], level, ch, victim, obj);
  obj_cast_spell (scroll->value[2], level, ch, victim, obj);
  obj_cast_spell (scroll->value[3], level, ch, victim, obj);

  extract_obj (scroll);
  if (ch->position == POS_FIGHTING)
    waiting (ch, 30);
  else
    waiting (ch, 8);
  return;
}



void
do_brandish (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *vch;
  CHAR_DATA *vch_next;
  OBJ_DATA *temp;
  OBJ_DATA *staff;
  int sn;
  int level;

  if (IS_NPC (ch))
    return;

  staff = get_eq_char (ch, WEAR_WIELD);
  temp = get_eq_char (ch, WEAR_HOLD);

  if (staff == NULL && temp == NULL)
    {
      send_to_char ("You hold nothing in your hand.\n\r", ch);
      return;
    }

  if (staff == NULL)
    staff = temp;
  if (temp == NULL)
    temp = staff;

  if (staff->item_type != ITEM_STAFF)
    staff = temp;

  if (staff->item_type != ITEM_STAFF)
    {
      send_to_char ("You can brandish only with a staff.\n\r", ch);
      return;
    }

  if ((sn = staff->value[3]) < 0
      || sn >= MAX_SKILL || skill_table[sn].spell_fun == 0)
    {
      bug ("Do_brandish: bad sn %d.", sn);
      return;
    }


  if (staff->value[2] > 0)
    {
      act ("$n brandishes $p.", ch, staff, NULL, TO_ROOM);
      act ("You brandish $p.", ch, staff, NULL, TO_CHAR);
      for (vch = ch->in_room->people; vch; vch = vch_next)
	{
	  vch_next = vch->next_in_room;

	  switch (skill_table[sn].target)
	    {
	    default:
	      bug ("Do_brandish: bad target for sn %d.", sn);
	      return;

	    case TAR_IGNORE:
	      if (vch != ch)
		continue;
	      break;

	    case TAR_CHAR_OFFENSIVE:
	      if (IS_NPC (ch) ? IS_NPC (vch) : !IS_NPC (vch))
		continue;
	      break;

	    case TAR_CHAR_DEFENSIVE:
	      if (IS_NPC (ch) ? !IS_NPC (vch) : IS_NPC (vch))
		continue;
	      break;

	    case TAR_CHAR_SELF:
	      if (vch != ch)
		continue;
	      break;
	    }

	  level = staff->value[0];
	  if (level < 1)
	    level = 1;
	  if (level > MAX_SPELL)
	    level = MAX_SPELL;

	  obj_cast_spell (staff->value[3], level, ch, vch, NULL);
	}
    }

  if (--staff->value[2] <= 0)
    {
      act ("$n's $p blazes bright and is gone.", ch, staff, NULL, TO_ROOM);
      act ("Your $p blazes bright and is gone.", ch, staff, NULL, TO_CHAR);
      extract_obj (staff);
    }
  if (ch->position == POS_FIGHTING)
    waiting (ch, 30);
  else
    waiting (ch, 8);
  return;
}



void
do_zap (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  CHAR_DATA *victim;
  OBJ_DATA *temp;
  OBJ_DATA *wand = NULL;
  OBJ_DATA *obj = NULL;
  int level;

  one_argument (argument, arg);

  if (IS_NPC (ch))
    return;

  if (arg[0] == '\0' && ch->fighting == NULL)
    {
      send_to_char ("Zap whom or what?\n\r", ch);
      return;
    }

  wand = get_eq_char (ch, WEAR_WIELD);
  temp = get_eq_char (ch, WEAR_HOLD);

  if (wand == NULL && temp == NULL)
    {
      send_to_char ("You hold nothing in your hand.\n\r", ch);
      return;
    }

  if (wand == NULL)
    wand = temp;
  if (temp == NULL)
    temp = wand;

  if (wand->item_type != ITEM_WAND)
    wand = temp;

  if (wand->item_type != ITEM_WAND)
    {
      send_to_char ("You can zap only with a wand.\n\r", ch);
      return;
    }

  if (arg[0] == '\0')
    {
      if (ch->fighting != NULL)
	{
	  victim = ch->fighting;
	}
      else
	{
	  send_to_char ("Zap whom or what?\n\r", ch);
	  return;
	}
    }
  else
    {
      if ((victim = get_char_room (ch, arg)) == NULL
	  && (obj = get_obj_here (ch, arg)) == NULL)
	{
	  send_to_char ("You can't find it.\n\r", ch);
	  return;
	}
    }


  if (wand->value[2] > 0)
    {
      if (victim != NULL)
	{
	  act ("$n zaps $N with $p.", ch, wand, victim, TO_ROOM);
	  act ("You zap $N with $p.", ch, wand, victim, TO_CHAR);
	}
      else
	{
	  act ("$n zaps $P with $p.", ch, wand, obj, TO_ROOM);
	  act ("You zap $P with $p.", ch, wand, obj, TO_CHAR);
	}

      level = wand->value[0];
      if (level < 1)
	level = 1;
      if (level > MAX_SPELL)
	level = MAX_SPELL;

      obj_cast_spell (wand->value[3], level, ch, victim, obj);
    }

  if (--wand->value[2] <= 0)
    {
      act ("$n's $p explodes into fragments.", ch, wand, NULL, TO_ROOM);
      act ("Your $p explodes into fragments.", ch, wand, NULL, TO_CHAR);
      extract_obj (wand);
    }
  if (ch->position == POS_FIGHTING)
    waiting (ch, 30);
  else
    waiting (ch, 8);

  return;
}



void
do_steal (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  char arg1[MIL];
  char arg2[MIL];
  CHAR_DATA *victim;
  OBJ_DATA *obj;
  int percent;

  argument = one_argument (argument, arg1);
  argument = one_argument (argument, arg2);

  if (arg1[0] == '\0' || arg2[0] == '\0')
    {
      send_to_char ("Steal what from whom?\n\r", ch);
      return;
    }

  if ((victim = get_char_room (ch, arg2)) == NULL)
    {
      send_to_char ("They aren't here.\n\r", ch);
      return;
    }

  if (victim == ch)
    {
      send_to_char ("That's pointless.\n\r", ch);
      return;
    }

  if (IS_AFFECTED (victim, AFF_ETHEREAL) || IS_EXTRA (victim, EXTRA_ILLUSION))
    {
      send_to_char ("You cannot steal things from ethereal people.\n\r", ch);
      return;
    }
  if (IS_GHOST (victim))
    {
      stc ("You cannot steal from a ghost.\n\r", ch);
      return;
    }

  waiting (ch, skill_table[gsn_steal].beats);
  percent = number_percent () + (IS_AWAKE (victim) ? 10 : -50);

  if (!IS_NPC (ch) && IS_ITEMAFF (ch, ITEMA_PEACE))
    do_majesty (ch, "");

  if ((ch->level + number_range (1, 20) < victim->level)
      || (!IS_NPC (ch) && !IS_NPC (victim) && ch->level < 3)
      || (!IS_NPC (ch) && !IS_NPC (victim) && victim->level < 3)
      || (victim->position == POS_FIGHTING)
      || (!IS_NPC (victim) && IS_IMMUNE (victim, IMM_STEAL))
      || (!IS_NPC (victim) && IS_IMMORTAL (victim))
      || (!IS_NPC (ch) && percent > ch->pcdata->learned[gsn_steal]))
    {
      /*
       * Failure.
       */
      send_to_char ("Oops.\n\r", ch);
      act ("$n tried to steal from you.\n\r", ch, NULL, victim, TO_VICT);
      act ("$n tried to steal from $N.\n\r", ch, NULL, victim, TO_NOTVICT);
/*
	sprintf( buf, "%s is a bloody thief!", ch->name );
	do_shout( victim, buf );
*/
      if (!IS_NPC (ch))
	{
	  if (IS_NPC (victim))
	    {
	      multi_hit (victim, ch, TYPE_UNDEFINED);
	    }
/*
	    else
	    {
		log_string( buf );
		do_autosave( ch,"" );
	    }
*/
	}

      return;
    }

  if (!str_cmp (arg1, "coin")
      || !str_cmp (arg1, "coins") || !str_cmp (arg1, "gold"))
    {
      int amount;

      amount = victim->gold * number_range (1, 10) / 100;
      if (amount <= 0)
	{
	  send_to_char ("You couldn't get any gold.\n\r", ch);
	  return;
	}

      ch->gold += amount;
      victim->gold -= amount;
      sprintf (buf, "Bingo!  You got %d gold coins.\n\r", amount);
      send_to_char (buf, ch);
      do_autosave (ch, "");
      do_autosave (victim, "");
      return;
    }

  if ((obj = get_obj_carry (victim, arg1)) == NULL)
    {
      send_to_char ("You can't find it.\n\r", ch);
      return;
    }

  if (!can_drop_obj (ch, obj)
      || IS_SET (obj->extra_flags, ITEM_LOYAL)
      || IS_SET (obj->extra_flags, ITEM_INVENTORY))
    {
      send_to_char ("You can't pry it away.\n\r", ch);
      return;
    }

  if (ch->carry_number + 1 > can_carry_n (ch))
    {
      send_to_char ("You have your hands full.\n\r", ch);
      return;
    }

  if (ch->carry_weight + get_obj_weight (obj) > can_carry_w (ch))
    {
      send_to_char ("You can't carry that much weight.\n\r", ch);
      return;
    }

  obj_from_char (obj);
  obj_to_char (obj, ch);
  send_to_char ("You got it!\n\r", ch);
  do_autosave (ch, "");
  do_autosave (victim, "");
  return;
}



/*
 * Shopping commands.
 */
CHAR_DATA *
find_keeper (CHAR_DATA * ch)
{
  CHAR_DATA *keeper;
  SHOP_DATA *pShop;
  char buf[MSL];

  pShop = NULL;
  for (keeper = ch->in_room->people; keeper; keeper = keeper->next_in_room)
    {
      if (!IS_NPC (keeper))
	continue;
      if (IS_NPC (keeper) && (pShop = keeper->pIndexData->pShop) != NULL)
	break;
    }

  if (keeper == NULL)
    {
      send_to_char ("You can't do that here.\n\r", ch);
      return NULL;
    }

  if (pShop == NULL)
    {
      send_to_char ("You can't do that here.\n\r", ch);
      return NULL;
    }

  /*
   * Shop hours.
   */
  if (time_info.hour < pShop->open_hour)
    {
      strcpy (buf, "Sorry, come back later.");
      do_say (keeper, buf);
      return NULL;
    }

  if (time_info.hour > pShop->close_hour)
    {
      strcpy (buf, "Sorry, come back tomorrow.");
      do_say (keeper, buf);
      return NULL;
    }

  /*
   * Invisible or hidden people.
   */
  if (!can_see (keeper, ch))
    {
      strcpy (buf, "I don't trade with folks I can't see.");
      do_say (keeper, buf);
      return NULL;
    }

  return keeper;
}



int
get_cost (CHAR_DATA * keeper, OBJ_DATA * obj, bool fBuy)
{
  SHOP_DATA *pShop;
  int cost;

  if (obj == NULL || (pShop = keeper->pIndexData->pShop) == NULL)
    return 0;

  if (fBuy)
    {
      cost = obj->cost * pShop->profit_buy / 100;
    }
  else
    {
      OBJ_DATA *obj2;
      int itype;

      cost = 0;
      for (itype = 0; itype < MAX_TRADE; itype++)
	{
	  if (obj->item_type == pShop->buy_type[itype])
	    {
	      cost = obj->cost * pShop->profit_sell / 100;
	      break;
	    }
	}

      for (obj2 = keeper->carrying; obj2; obj2 = obj2->next_content)
	{
	  if (obj->pIndexData == obj2->pIndexData)
	    {
	      cost = 0;
	      break;
	    }
	}
    }

  if (obj->item_type == ITEM_STAFF || obj->item_type == ITEM_WAND)
    cost = cost * obj->value[2] / obj->value[1];

  return cost;
}



void
do_buy (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
//  char arg2[MIL];
  char *oarg;
  OBJ_INDEX_DATA *pObjIndex;
  OBJ_DATA *obj;
  CHAR_DATA *escape;
  char buf[MSL];
  char sex[MIL];
  int clip = 0;
  int pill = 0;
  if (IS_NPC (ch))
    return;
  oarg = str_dup (argument);
  argument = one_argument (argument, arg);
//  argument = one_argument (argument, arg2;
  if (ch->sex == 2)
    sprintf (sex, "Mistress");
  else
    sprintf (sex, "Master");

  if (arg[0] == '\0')
    {
      for (escape = ch->in_room->people; escape != NULL;
	   escape = escape->next_in_room)
	{
	  if (!IS_NPC (escape))
	    continue;
	  if (escape->spec_fun == spec_lookup ("spec_escapeshop"))
	    break;
	  if (escape->spec_fun == spec_lookup ("spec_portalnexus"))
	    break;
	  if (escape->spec_fun == spec_lookup ("spec_portalpand"))
	    break;
	  if (escape->spec_fun == spec_lookup ("spec_portaltranq"))
	    break;
	  if (escape->spec_fun == spec_lookup ("spec_blacksmith"))
	    break;
          if (escape->spec_fun == spec_lookup ("spec_assassin"))
            break;
          if (escape->pIndexData->vnum == 3011)
            break;
          if (escape->pIndexData->vnum == 3207)
            break;
	}
      if (escape != NULL
          && escape->pIndexData->vnum == 3011)
        {
          do_say (escape, "Ahh, interested in purchasing a #uPlayers#n#P Club card eh?");
          return;
        }

      if (escape != NULL
          && escape->spec_fun == spec_lookup ("spec_assassin"))
        {
          do_say (escape, "Ahh, interested in purchasing #uProtection#n#P eh?");
          return;
        }

      if (escape != NULL
	  && escape->spec_fun == spec_lookup ("spec_blacksmith"))
	{
	  do_blacksmithdude (ch, escape, oarg);
	  return;
	}
      if (escape != NULL
          && escape->pIndexData->vnum == 3207)
        {
          if (arg[0] == '\0')
            {
              sprintf (buf, "Well hello %s %s, what can I get for you today?",
                       sex, ch->name);
              do_say (escape, buf);
              do_say (escape,
                      "Just take a look at my sign for the products I sell.");
              return;
            }
          return;
        }

      if (escape != NULL
	  && escape->spec_fun == spec_lookup ("spec_escapeshop"))
	{
	  if (arg[0] == '\0')
	    {
	      sprintf (buf, "Well hello %s %s, what can I get for you today?",
		       sex, ch->name);
	      do_say (escape, buf);
	      do_say (escape,
		      "Just take a look at my sign for the products I sell.");
	      return;
	    }
	  return;
	}

      if (escape != NULL
	  && escape->spec_fun == spec_lookup ("spec_portalnexus"))
	{
	  if (arg[0] == '\0')
	    {
	      sprintf (buf,
		       "Well hello %s %s, what plane are you interested in traveling to today?",
		       sex, ch->name);
	      do_say (escape, buf);
	      do_say (escape,
		      "I can currently offer you a portal to the idylic plane of Tranquility.");
	      if (can_arti (ch))
		{
		  do_say (escape,
			  "Or maybe the chaotic and dangerous plane of Pandemonium would be more to your liking?");
		}
	      return;
	    }
	  return;
	}

      if (escape != NULL
	  && escape->spec_fun == spec_lookup ("spec_portalpand"))
	{
	  if (arg[0] == '\0')
	    {
	      char bad[MIL];

	      sprintf (buf,
		       "Hello %s, had enough of the dangers of Pandemonium already?",
		       ch->name);
	      do_say (escape, buf);
	      sprintf (buf, "You want to leave so soon?");
	      do_say (escape, buf);
	      do_say (escape,
		      "The hell spawn of this place to much for you? chicken shit!");
	      check_social (escape, "snicker", "");
	      sprintf (buf,
		       "I can make a portal to Nexus for you as soon as you stop shaking.");
	      do_say (escape, buf);
	      return;
	    }
	  return;
	}
      if (escape != NULL
	  && escape->spec_fun == spec_lookup ("spec_portaltranq"))
	{
	  if (arg[0] == '\0')
	    {
	      sprintf (buf,
		       "Well hello %s %s, wanting to leave this paradise so soon?",
		       sex, ch->name);
	      do_say (escape, buf);
	      do_say (escape,
		      "I can open a portal to Nexus for you if you wish.");
	      return;
	    }
	  return;
	}
      send_to_char ("Buy what?\n\r", ch);
      return;
    }

  for (escape = ch->in_room->people; escape != NULL;
       escape = escape->next_in_room)
    {
      if (!IS_NPC (escape))
	continue;
      if (escape->spec_fun == spec_lookup ("spec_escapeshop"))
	break;
      if (escape->spec_fun == spec_lookup ("spec_portalpand"))
	break;
      if (escape->spec_fun == spec_lookup ("spec_portaltranq"))
	break;
      if (escape->spec_fun == spec_lookup ("spec_portalnexus"))
	break;
      if (escape->spec_fun == spec_lookup ("spec_blacksmith"))
        break;
      if (escape->spec_fun == spec_lookup ("spec_assassin"))
        break;
          if (escape->pIndexData->vnum == 3011)
            break;
          if (escape->pIndexData->vnum == 3207)
            break;

    }
      if (escape != NULL
          && escape->spec_fun == spec_lookup ("spec_blacksmith"))
        {
          do_blacksmithdude (ch, escape, oarg);
          return;
        }
      if (escape != NULL
          && escape->spec_fun == spec_lookup ("spec_assassin"))
        {
      if (!str_cmp (arg, "protection"))
        {
          if (ch->pcdata->jagasafe > 1)
            {
              do_say (escape, "You already have paid your protection for this half hour!");
              return;
            }
          if (ch->pcdata->quest < 20000)
            {
              sprintf (buf, "I am sorry %s, protection costs %d credits.", ch->name, 20000);
              do_say (escape, buf);
              do_say (escape, "You can not afford my protection!");
              do_say (escape,
                      "Now get out of my store you dead beat, before I have you offed!");
              return;
            }
           ch->pcdata->quest -= 20000;
           ch->pcdata->jagasafe += 1800;
            do_say (escape, "You have paid the protection fee.. You will not be the target of my quests for a half hour!");
          return;
         }
        do_say (escape, "I dont sell that!");
        return;
      }
  if (escape != NULL
          && escape->pIndexData->vnum == 3207)
        {
if (!str_cmp (arg, "haste")) {
          if (ch->pcdata->power[POWER_CURRENT] < 200000)
            {
              do_say (escape,
                      "You cannot afford my fee! It costs 200000 Class points for a haste potion!");
              return;
          }
          ch->pcdata->power[POWER_CURRENT] -= 200000;
obj = create_object (get_obj_index (OBJ_VNUM_PROTOPLASM), 1);
obj->item_type = ITEM_POTION;
obj->value[0] = 60;
obj->value[1] = skill_lookup ("haste");
obj->value[2] = skill_lookup ("haste");

obj->value[3] = skill_lookup ("haste");
            free_string (obj->name);

obj->name = str_dup ("haste potion");
            free_string (obj->short_descr);
obj->short_descr = str_dup ("A Potion of haste");
            free_string (obj->description);
obj->description = str_dup ("A potion of haste");
          if (obj->questmaker != NULL)
            free_string (obj->questmaker);
          obj->questmaker = str_dup (escape->short_descr);
          if (obj->questowner != NULL)
            free_string (obj->questowner);
          obj->questowner = str_dup (ch->name);
          if (obj->creator != NULL)
            free_string (obj->creator);
          sprintf (buf, "%s (potion)", escape->short_descr);
          obj->creator = str_dup (buf);
          act ("$N hands you a $p.", ch, obj, escape, TO_CHAR);
          act ("$N hands $n a $p.", ch, obj, escape, TO_ROOM);
 obj_to_char (obj, ch);
return;
}
if (!str_cmp (arg, "spiritkiss")) {
          if (ch->pcdata->power[POWER_CURRENT] < 200000)
            {
              do_say (escape,
                      "You cannot afford my fee! It costs 200000 Class points for a haste potion!");
              return;
          }
          ch->pcdata->power[POWER_CURRENT] -= 200000;
obj = create_object (get_obj_index (OBJ_VNUM_PROTOPLASM), 1);
obj->item_type = ITEM_POTION;
obj->value[0] = 400;
obj->value[1] = skill_lookup ("spirit kiss");
obj->value[2] = skill_lookup ("spirit kiss");

obj->value[3] = skill_lookup ("spirit kiss");
            free_string (obj->name);

obj->name = str_dup ("spiritkiss potion");
            free_string (obj->short_descr);
obj->short_descr = str_dup ("A Potion of spiritkiss");
            free_string (obj->description);
obj->description = str_dup ("A potion of spiritkiss");
          if (obj->questmaker != NULL)
            free_string (obj->questmaker);
          obj->questmaker = str_dup (escape->short_descr);
          if (obj->questowner != NULL)
            free_string (obj->questowner);
          obj->questowner = str_dup (ch->name);
          if (obj->creator != NULL)
            free_string (obj->creator);
          sprintf (buf, "%s (potion)", escape->short_descr);
          obj->creator = str_dup (buf);
          act ("$N hands you a $p.", ch, obj, escape, TO_CHAR);
          act ("$N hands $n a $p.", ch, obj, escape, TO_ROOM);
 obj_to_char (obj, ch);
return;
}
if (!str_cmp (arg, "heavenlybless")) {
          if (ch->pcdata->power[POWER_CURRENT] < 200000)
            {
              do_say (escape,
                      "You cannot afford my fee! It costs 200000 Class points for a haste potion!");
              return;
          }
          ch->pcdata->power[POWER_CURRENT] -= 200000;
obj = create_object (get_obj_index (OBJ_VNUM_PROTOPLASM), 1);
obj->item_type = ITEM_POTION;
obj->value[0] = 60;
obj->value[1] = skill_lookup ("heavenly bless");
obj->value[2] = skill_lookup ("heavenly bless");
obj->value[3] = skill_lookup ("heavenly bless");
            free_string (obj->name);

obj->name = str_dup ("heavenlybless potion");
            free_string (obj->short_descr);
obj->short_descr = str_dup ("A Potion of heavenlybless");
            free_string (obj->description);
obj->description = str_dup ("A potion of heavenlybless");
          if (obj->questmaker != NULL)
            free_string (obj->questmaker);
          obj->questmaker = str_dup (escape->short_descr);
          if (obj->questowner != NULL)
            free_string (obj->questowner);
          obj->questowner = str_dup (ch->name);
          if (obj->creator != NULL)
            free_string (obj->creator);
          sprintf (buf, "%s (potion)", escape->short_descr);
          obj->creator = str_dup (buf);
          act ("$N hands you a $p.", ch, obj, escape, TO_CHAR);
          act ("$N hands $n a $p.", ch, obj, escape, TO_ROOM);
 obj_to_char (obj, ch);
return;
}

          do_say (escape, "I dont sell that!");
          return;
        }

  if (escape != NULL
          && escape->pIndexData->vnum == 3011)
        {
      if (!str_cmp (arg, "players"))
        {
          if (IS_XXX (ch, XXX_PLAYERSCLUB))
            {
              do_say (escape, "You already have purchased a players club card!");
              return;
            }
          if (ch->pcdata->quest < 20000)
            {
              sprintf (buf, "I am sorry %s, a players club card costs %d credits.", ch->name, 20000);
              do_say (escape, buf);
              do_say (escape, "You can not afford one!");
              do_say (escape,
                      "Now get out of my store you dead beat, before I pay jaga to have you offed!");
              return;
            }
           ch->pcdata->quest -= 20000;
           SET_BIT (ch->xxxbits, XXX_PLAYERSCLUB);
            do_say (escape, "You have purchased the players club card, You may now enter the restricted areas of the club!");
          return;
         }
        do_say (escape, "I dont sell that!");
        return;
      }

  if (escape != NULL && escape->spec_fun == spec_lookup ("spec_portalnexus"))
    {

      if (!str_cmp (arg, "Pandemonium"))
	{
	  if (!can_arti (ch))
	    {
	      do_say (escape,
		      "I'm sorry, but guild policies require people going to this dangerous plane to be stronger then you are.");
	      return;
	    }
	  if (ch->pcdata->power[POWER_CURRENT] < 30000)
	    {
	      do_say (escape,
		      "You cannot afford my fee! It costs 30000 Class points for me to open a portal!");
	      return;
	    }
	  createplaneportal (ch, ch->in_room->vnum,
			     number_range (45701, 45800), 2);
	  do_say (escape, "There you go, To Pandemonium with you!");
	  ch->pcdata->power[POWER_CURRENT] -= 30000;
	  return;
	}
      if (!str_cmp (arg, "Tranquility"))
	{
	  if (ch->pcdata->power[POWER_CURRENT] < 30000 && !IS_NEWBIE (ch))
	    {
	      do_say (escape,
		      "You cannot afford my fee! It costs 30000 class points for me to open a portal!");
	      return;
	    }
	  createplaneportal (ch, ch->in_room->vnum, 45841, 1);
	  do_say (escape, "There you go, To Tranquility with you!");
	  if (!IS_NEWBIE (ch))
	    ch->pcdata->power[POWER_CURRENT] -= 30000;
	  return;
	}
      do_say (escape, "I don't sell a portal to there!");
      return;
    }
  if (escape != NULL
      && (escape->spec_fun == spec_lookup ("spec_portaltranq")
	  || escape->spec_fun == spec_lookup ("spec_portalpand")))
    {
      if (!str_cmp (arg, "nexus"))
	{
	  if (ch->pcdata->power[POWER_CURRENT] < 30000 && !IS_NEWBIE (ch))
	    {
	      do_say (escape,
		      "You cannot afford my fee! It costs 30000 class points for me to open a portal!");
	      return;
	    }
	  createplaneportal (ch, ch->in_room->vnum, 3061, 0);
	  do_say (escape, "There you go, back to Nexus with you!");
	  if (!IS_NEWBIE (ch))
	    ch->pcdata->power[POWER_CURRENT] -= 30000;
	  return;
	}
      else
	{
	  do_buy (ch, "");
	  return;
	}
    }

  if (escape != NULL && escape->spec_fun == spec_lookup ("spec_escapeshop"))
    {

      clip = ch->pcdata->tokenclip;

      if (clip > 99)
	{
	  clip -= 100;
	  if (clip > 5)
	    ch->pcdata->tokenclip = 105;

	  if (clip < 1)
	    clip = 1;
	}
      else
	{
	  if (clip > 5)
	    ch->pcdata->tokenclip = 5;

	  if (clip < 1)
	    clip = 1;
	}

      if (!str_cmp (arg, "escape") || !str_cmp (arg, "escapetoken")
	  || !str_cmp (arg, "token"))
	{
	  if (ch->pcdata->escape >= clip)
	    {
	      char t1[MIL];

	      sprintf (buf, "I am sorry %s %s.", sex, ch->name);
	      do_say (escape, buf);
	      if (clip == 1)
		{
		  sprintf (t1, "an ");
		}
	      else
		{
		  sprintf (t1, "");
		}
	      sprintf (buf,
		       "You already have %s%d Escape Token%s, your Token Clip can't hold any more Escape Tokens.",
		       t1, clip, clip > 1 ? "s" : "");
	      do_say (escape, buf);
	      return;
	    }
	  if (ch->pcdata->quest < 5000)
	    {
	      sprintf (buf, "I am sorry %s.", ch->name);
	      do_say (escape, buf);
	      do_say (escape, "You can not afford an Escape Token.");
	      do_say (escape,
		      "Now get out of my store you dead beat, I have paying customers to attend to!");
	      return;
	    }
	  sprintf (buf, "Okay %s %s, an Escape Token it is.", sex, ch->name);
	  do_say (escape, buf);
	  if (!IS_NYM (ch, NYM_TOKENHOLDER))
	    {
	      sprintf (buf, "I notice %s %s that you dont have a Token Clip.",
		       sex, ch->name);
	      do_say (escape, buf);
	      do_say (escape, "I will throw a single slot clip in for free.");
	      do_say (escape,
		      "Let me see your arm, this will hurt a little bit.");
	      act3
		("$N grafts a clip holder into your wrist, making you cry like a little baby.",
		 ch, NULL, escape, TO_CHAR);
	      act3
		("$N grafts a clip holder into $n's wrist, making $n cry like a little baby.",
		 ch, NULL, escape, TO_NOTVICT);
	      act3
		("$N snaps a Token Clip into the holder $E just grafted into your wrist.",
		 ch, NULL, escape, TO_CHAR);
	      act3
		("$N snaps a Token Clip into the holder $E just grafted into $n's wrist.",
		 ch, NULL, escape, TO_NOTVICT);
	      SET_BIT (ch->nymbits, NYM_TOKENHOLDER);
	      ch->pcdata->tokenclip = 1;
	    }
	  act3 ("$N inserts an Escape Token into your Token Clip.", ch, NULL,
		escape, TO_CHAR);
	  act3 ("$N inserts an Escape Token into $n's Token Clip.", ch, NULL,
		escape, TO_NOTVICT);
	  if (ch->pcdata->tokenclip < 1)
	    ch->pcdata->tokenclip = 1;
	  ch->pcdata->escape++;
	  ch->pcdata->quest -= 5000;
	  return;
	}
      else if (!str_cmp (arg, "ticket") || !str_cmp (arg, "plane")
	       || !str_cmp (arg, "planeticket"))
	{
	  if (ch->pcdata->quest < 100000)
	    {
	      sprintf (buf, "I am sorry %s.", ch->name);
	      do_say (escape, buf);
	      do_say (escape, "You can not afford a plane ticket.");
	      do_say (escape,
		      "Now get out of my store you dead beat, I have paying customers to attend to!");
	      return;
	    }

	  if (ch->pcdata->ticket > 0)
	    {
	      obj = create_object (get_obj_index (30041), 0);
	      obj->item_type = ITEM_TICKET;
	      obj->value[0] = 1000;
	      obj->name = str_dup ("ticket");
	      obj->short_descr = str_dup ("A ticket");
	      obj->description = str_dup ("A ticket, why dont you eat it?");
	      obj_to_char (obj, ch);
	    }
	  sprintf (buf, "Okay %s %s, a ticket it is.", sex, ch->name);
	  do_say (escape, buf);
	  if (ch->pcdata->ticket > 0)
	    {
	      act3 ("$N hands you a ticket and some glue.", ch, NULL, escape,
		    TO_CHAR);
	      act3 ("$N hands $n a ticket and some glue.", ch, NULL, escape,
		    TO_NOTVICT);
	    }
	  else
	    {
	      act3 ("$N glues a ticket to your forehead.", ch, NULL, escape,
		    TO_CHAR);
	      act3 ("$N glues a ticket to $n's forehead.", ch, NULL, escape,
		    TO_NOTVICT);
	    }
	  if (ch->pcdata->ticket < 1)
	    ch->pcdata->ticket = 1000;
	  ch->pcdata->quest -= 100000;
	  return;
	}
      else if (!str_cmp (arg, "gasbreath") || !str_cmp (arg, "pill")
	       || !str_cmp (arg, "gas") || !str_cmp (arg, "breath"))
	{
	  pill = 3038;

	  if (pill == 0 || (pObjIndex = get_obj_index (pill)) == NULL)
	    {
	      do_say (escape, "Missing object, please inform Corim.\n\r");
	      return;
	    }

	  if (ch->pcdata->quest < 100000 || ch->pcdata->crystal < 100)
	    {
	      sprintf (buf, "I am sorry %s.", ch->name);
	      do_say (escape, buf);
	      do_say (escape,
		      "You can not afford the #7Infinite#R Pill of #PG#pas#PB#preat#Ph#n.");
	      do_say (escape,
		      "Now get out of my store you dead beat, I have paying customers to attend to!");
	      return;
	    }
	  sprintf (buf,
		   "Okay %s %s, the #7Infinite#n Pill of #PG#pas#PB#preat#Ph#n it is.",
		   sex, ch->name);
	  do_say (escape, buf);
	  obj = create_object (get_obj_index (pill), 0);
	  act ("$N hands you a $p.", ch, obj, escape, TO_CHAR);
	  act ("$N hands $n a $p.", ch, obj, escape, TO_ROOM);
	  obj_to_char (obj, ch);
	  SET_BIT (obj->quest, QUEST_SPELLPROOF);
	  ch->pcdata->quest -= 100000;
	  ch->pcdata->crystal -= 100;
	  if (obj->questmaker != NULL)
	    free_string (obj->questmaker);
	  obj->questmaker = str_dup (escape->short_descr);
	  if (obj->questowner != NULL)
	    free_string (obj->questowner);
	  obj->questowner = str_dup (ch->name);
	  if (obj->creator != NULL)
	    free_string (obj->creator);
	  sprintf (buf, "%s (GasBreath Pill)", escape->short_descr);
	  obj->creator = str_dup (buf);
	  return;
	}
      else if (!str_cmp (arg, "upgrade") || !str_cmp (arg, "clipupgrade")
	       || !str_cmp (arg, "clip"))
	{
	  int clipcost1 = 0;
	  int clipcost2 = 0;

	  clip = ch->pcdata->tokenclip;

	  if (clip > 99)
	    {
	      clip -= 100;
	      if (clip > 5)
		{
		  ch->pcdata->tokenclip = 105;
		  clip = ch->pcdata->tokenclip - 100;
		}
	      if (clip < 1)
		clip = 1;
	    }
	  else
	    {
	      if (clip > 5)
		{
		  ch->pcdata->tokenclip = 5;
		  clip = 5;
		}
	    }

	  if (!IS_NYM (ch, NYM_TOKENHOLDER))
	    {
	      sprintf (buf, "I am sorry %s %s.", sex, ch->name);
	      do_say (escape, buf);
	      do_say (escape,
		      "You do not have a Token Clip, I can not sell you an upgrade unless you have a clip.");
	      return;
	    }
	  if (clip > 4)
	    {
	      sprintf (buf,
		       "I am sorry %s %s, but you already have the best Token C

Showing the first 100 KB of 166.8 KB. Download the archive for the full file.

Site Stats

Snippets: 1791
Codebases: 571