act_move.c

exodus_code/act_move.c · 209.8 KB

From the archive exodus_code.zip

Download the archive   « Back to the archive contents

#include <sys/types.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "merc.h"
#include "interp.h"
#include "clans/new_clans.h"
#include "clans/new_clans_comm.h"
#include "clans/new_clans_io.h"
#include "clans/new_clans_util.h"
#include "obj_trig.h"

int check_entangle args ((CHAR_DATA * ch));
bool room_class_check args ((CHAR_DATA * ch, ROOM_INDEX_DATA * location));
bool room_race_check args((CHAR_DATA * ch, ROOM_INDEX_DATA * to_room));
bool br_vnum_check args ((int vnum));
bool can_move_char args ((CHAR_DATA * ch, ROOM_INDEX_DATA * to_room, bool follow, bool show_messages));
bool can_move_char_door args((CHAR_DATA * ch, int door, bool follow, bool show_messages));
bool can_move_char_door_new args((CHAR_DATA * ch, int door, bool follow, bool show_messages, int position));
OBJ_DATA *get_obj_vnum_room args((ROOM_INDEX_DATA* rid, int vnum));
void call_storm args((CHAR_DATA *ch, char *argument));
	

//bool br_vnum_check args((int vnum));
void falcon_alert args ((CHAR_DATA * ch));
void check_skeletal_mutation args((CHAR_DATA* ch, bool on_round));
bool check_clasp args((CHAR_DATA *ch));
extern bool battle_royale;
extern bool no_check_skeletal;

/* command procedures needed */
DECLARE_DO_FUN (do_look);
DECLARE_DO_FUN (do_recall);
DECLARE_DO_FUN (do_stand);
bool move_fast = FALSE;
bool is_sliding = FALSE;
char *const dir_name[] = { "north", "east", "south", "west", "up", "down"
};
const sh_int rev_dir[] = { 2, 3, 0, 1, 5, 4
};
const sh_int movement_loss[SECT_MAX] =
  { 1, 1, 2, 3, 4, 6, 2, 4, 6, 8, 6, 5, 2, 6, 6, 4, 5
};
int find_door args ((CHAR_DATA * ch, char *arg));
long int level_cost args ((int level));
extern MEMORY_DATA *memories;

// Minax 7-13-02 Added a cook command to cook food over a campfire.
void do_cook (CHAR_DATA * ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  OBJ_DATA *obj;
  OBJ_DATA *food;
  one_argument (argument, arg);
  if (arg[0] == '\0')
    {
      send_to_char ("What do you want to cook?\n\r", ch);
      return;
    }
  if ((food = get_obj_carry (ch, arg)) == NULL)
    {
      send_to_char ("You do not have that item.\n\r", ch);
      return;
    }
  if (food->item_type != ITEM_FOOD)
    {
      send_to_char ("You can only cook food.\n\r", ch);
      return;
    }
  if (food->condition == 69)
    {
      send_to_char ("It's already cooked.\n\r", ch);
      return;
    }
  for (obj = ch->in_room->contents; obj; obj = obj->next_content)
    if (obj->pIndexData->vnum == OBJ_VNUM_CAMPFIRE1
	|| obj->pIndexData->vnum == OBJ_VNUM_CAMPFIRE2
	|| obj->pIndexData->vnum == OBJ_VNUM_CAMPFIRE3)
      {
	act ("$n cooks $p over $P.", ch, food, obj, TO_ROOM);
	act ("You cook $p over $P.", ch, food, obj, TO_CHAR);
	food->condition = 69;
	food->value[0] *= 2;	/* doubles fullness benefit */
	food->value[1] *= 2;	/* doubles hunger benefit */
	food->value[2] *= 2;	/* doubles the time till spoilage */
	food->value[3] = 0;	// removes the poison
	return;
      }
  send_to_char ("You can't cook without a campfire.\n\r", ch);
  return;
}


// Minax 7-24-02 New skill - hone
void do_hone (CHAR_DATA * ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  int hone_skill, percent, damage;
  OBJ_DATA *obj;
  AFFECT_DATA af, *paf, *paf_next;
  argument = one_argument (argument, arg);
  hone_skill = get_skill (ch, gsn_hone);
  if (hone_skill < 1)
    {
      send_to_char ("You wouldn't even know where to start.\n\r", ch);
      return;
    }
  if (arg[0] == '\0')
    {
      send_to_char ("What do you want to hone?\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 ((obj->value[0] != WEAPON_SWORD) &&
      (obj->value[0] != WEAPON_AXE) &&
      (obj->value[0] != WEAPON_DAGGER) &&
      (obj->value[0] != WEAPON_POLEARM) && (obj->value[0] != WEAPON_ARROW))
    {
      act ("You cannot sharpen $p.", ch, obj, NULL, TO_CHAR);
      return;
    }
  if (IS_WEAPON_STAT (obj, WEAPON_SHARP))
    {
      act ("$p is as sharp as it can get.", ch, obj, NULL, TO_CHAR);
      return;
    }
  if (obj->condition == 0)
    obj->condition = 100;
  damage = (obj->condition - (125 - hone_skill));
  if (damage < 0)
    {
      act ("$n destroys $p in the process of trying to sharpen it.", ch,
	   obj, NULL, TO_ROOM);
      act ("$p cannot take the stress of sharpening and breaks.", ch,
	   obj, NULL, TO_CHAR);
      extract_obj (obj);
      return;
    }
// For Warriors
  if (IS_CLASS (ch, PC_CLASS_WARRIOR))
    {
      if ((str_cmp (obj->material, "steel") == 0) ||
	  (str_cmp (obj->material, "iron") == 0) ||
	  (str_cmp (obj->material, "metal") == 0) ||
	  (str_cmp (obj->material, "adamantite") == 0) ||
	  (str_cmp (obj->material, "platinum") == 0) ||
	  (str_cmp (obj->material, "silver") == 0) ||
	  (str_cmp (obj->material, "bronze") == 0) ||
	  (str_cmp (obj->material, "brass") == 0) ||
	  (str_cmp (obj->material, "copper") == 0))
	{
	  OBJ_DATA *grinder;
	  for (grinder = ch->in_room->contents; grinder;
	       grinder = grinder->next_content)
	    if (grinder->pIndexData->vnum == OBJ_VNUM_GRINDER)
	      {
		percent = number_percent ();
		if (percent < hone_skill)
		  {
		    af.where = TO_WEAPON;
		    af.type = gsn_hone;
		    af.level = ch->level;
		    af.duration = ch->level;
		    af.location = 0;
		    af.modifier = 0;
		    af.bitvector = WEAPON_SHARP;
		    af.permaff = FALSE;
		    af.composition = FALSE;
		    af.comp_name = str_dup ("");
		    affect_to_obj (obj, &af);
		    act ("$n grinds $p to a razor edge.", ch, obj,
			 NULL, TO_ROOM);
		    act ("You grind $p to a razor edge.", ch, obj,
			 NULL, TO_CHAR);
		    check_improve (ch, gsn_hone, TRUE, 3);
		    WAIT_STATE (ch, skill_table[gsn_hone].beats);
		    obj->condition -= (125 - hone_skill);
		    return;
		  }

		else
		  {
		    act
		      ("$n holds $p to the grinder too long, causing damage.",
		       ch, obj, NULL, TO_ROOM);
		    act
		      ("You hold $p to the grinder too long, causing damage.",
		       ch, obj, NULL, TO_CHAR);
		    obj->condition -= (135 - hone_skill);
		    WAIT_STATE (ch, skill_table[gsn_hone].beats);
		    return;
		  }
	      }
	  send_to_char
	    ("This task requires the use of a grinding stone.\n\r", ch);
	  return;
	}
      send_to_char ("This weapon's material is unfamiliar to you.\n\r", ch);
      return;
    }
//  For Rangers
  if (IS_CLASS (ch, PC_CLASS_RANGER))
    {
      if (str_cmp (obj->material, "wood") == 0)
	{
	  OBJ_DATA *fire;
	  for (fire = ch->in_room->contents; fire; fire = fire->next_content)
	    if (fire->pIndexData->vnum == OBJ_VNUM_CAMPFIRE1
		|| fire->pIndexData->vnum == OBJ_VNUM_CAMPFIRE2
		|| fire->pIndexData->vnum == OBJ_VNUM_CAMPFIRE3)
	      {
		percent = number_percent ();
		if (obj->value[4] & WEAPON_POISON)
		  {
		    obj->value[4] = obj->value[4] & !WEAPON_POISON;
		    for (paf = obj->affected; paf != NULL; paf = paf_next)
		      {
			paf_next = paf->next;
			if (paf->type == gsn_poison)
			  affect_remove_obj (obj, paf);
		      }
		  }
		if (percent < hone_skill)
		  {
		    af.where = TO_WEAPON;
		    af.type = gsn_hone;
		    af.level = ch->level;
		    af.duration = ch->level;
		    af.location = 0;
		    af.modifier = 0;
		    af.bitvector = WEAPON_SHARP;
		    af.permaff = FALSE;
		    af.composition = FALSE;
		    af.comp_name = str_dup ("");
		    affect_to_obj (obj, &af);
		    act ("$n hardens $p over $P.", ch, obj, fire, TO_ROOM);
		    act ("You harden $p over $P.", ch, obj, fire, TO_CHAR);
		    check_improve (ch, gsn_hone, TRUE, 3);
		    WAIT_STATE (ch, skill_table[gsn_hone].beats);
		    obj->condition -= (125 - hone_skill);
		    return;
		  }

		else
		  {
		    act ("$n holds $p over $P too long.", ch, obj,
			 fire, TO_ROOM);
		    act ("You hold $p over $P too long.", ch, obj,
			 fire, TO_CHAR);
		    obj->condition -= (135 - hone_skill);
		    WAIT_STATE (ch, skill_table[gsn_hone].beats);
		    if (number_percent () < 21)
		      {
			af.where = TO_WEAPON;
			af.type = gsn_hone;
			af.level = ch->level;
			af.duration = ch->level;
			af.location = 0;
			af.modifier = 0;
			af.bitvector = WEAPON_FLAMING;
			af.permaff = FALSE;
			af.composition = FALSE;
			af.comp_name = str_dup ("");
			affect_to_obj (obj, &af);
			act ("$p gets hot and catches fire!", ch, obj,
			     NULL, TO_ROOM);
			act ("$p gets hot and catches fire!", ch, obj,
			     NULL, TO_CHAR);
			obj->timer = 3;
			return;
		      }
		    return;
		  }
	      }
	  send_to_char
	    ("You need a campfire to harden the weapon over.\n\r", ch);
	  return;
	}
      send_to_char ("Rangers may only hone wooden weapons.\n\r", ch);
      return;
    }
  send_to_char ("You can't hone sh*t.\n\r", ch);
}

void do_camp (CHAR_DATA * ch, char *argument)
{
  int camp_skill;
  OBJ_DATA *obj;
  camp_skill = get_skill (ch, gsn_camping);
  if (camp_skill < 1)
    {
      send_to_char ("You don't know anything about camping.\n\r", ch);
      return;
    }
  if (ch->move < 50)
    {
      send_to_char ("You are too tired to create a campfire.\n\r", ch);
      return;
    }
  if (ch->in_room->sector_type != SECT_HILLS
      && ch->in_room->sector_type != SECT_MOUNTAIN
      && ch->in_room->sector_type != SECT_DESERT
      && ch->in_room->sector_type != SECT_FIELD
      && ch->in_room->sector_type != SECT_FOREST
      && ch->in_room->sector_type != SECT_GRASSLAND)
    {
      send_to_char ("You cannot create a campfire here.\n\r", ch);
      return;
    }
  if (weather_info.sky > SKY_RAINING)
    {
      send_to_char
	("It's raining too hard to start a campfire right now.\n\r", ch);
      return;
    }
  for (obj = ch->in_room->contents; obj; obj = obj->next_content)
    if (obj->pIndexData->vnum == OBJ_VNUM_CAMPFIRE1
	|| obj->pIndexData->vnum == OBJ_VNUM_CAMPFIRE2
	|| obj->pIndexData->vnum == OBJ_VNUM_CAMPFIRE3)
      {
	send_to_char ("A campfire is already burning here.\n\r", ch);
	return;
      }
  if (camp_skill < number_percent ())
    {
      send_to_char
	("A combination of wind and damp wood hinders you as you fail at your attempt to start a fire.\n\r",
	 ch);
      act
	("A combination of wind and damp wood hinders $n as $e fails at $s attempt to start a fire.",
	 ch, NULL, NULL, TO_ROOM);
      check_improve (ch, gsn_camping, FALSE, 4);
      return;
    }
  ch->move /= 2;
  if (ch->move < 0)
    ch->move = 0;
  obj = create_object (get_obj_index (OBJ_VNUM_CAMPFIRE1), 0);
  obj->level = ch->level;
  obj->timer = ch->level / 8;
  if (obj->timer < 1)
    obj->timer = 1;
  obj_to_room (obj, ch->in_room);
  send_to_char
    ("Covering a few heavy logs with brittle pieces of kindling, you strike up a radiant campfire.\n\r",
     ch);
  act
    ("Covering a few heavy logs with brittle pieces of kindling, $n strikes up a radiant campfire.",
     ch, NULL, NULL, TO_ROOM);
  check_improve (ch, gsn_camping, TRUE, 4);
}


/* Set a single bit in the array */
void setbit (char *explored, int index)
{

  /* 1 << number = two to the power of number */
  explored[index / 8] |= 1 << (index % 8);
  return;
}

void unsetbit (char *explored, int index)
{

  /* 1 << number = two to the power of number */
  explored[index / 8] &= ~(1 << (index % 8));
  return;
}


/* Get a single bit from the array */
int getbit (char *explored, int index)
{

  /* IS_SET doesn't just return zero or one, so the != 0 is needed */
  return (IS_SET (explored[index / 8], 1 << (index % 8)) != 0);
}


/* Count the number of set bits in a byte */
int bitcount (char ch)
{
  int bit, count = 0;

  /* Search bits from highest to lowest */
  for (bit = 1 << 7; bit > 0; bit >>= 1)
    {
      if (ch & bit)
	count++;
    }
  return count;
}


/* Count the total number of rooms visited */
int roomcount (CHAR_DATA * ch)
{
  int index = 0, count = 0;

  /* NPCs don't have this */
  if (IS_NPC (ch))
    return 0;

  /* MAX_EXPLORE is 8192 */
  for (index = 0; index < MAX_EXPLORE; index++)
    {
      count += bitcount (ch->pcdata->explored[index]);
    }
  return count;
}


/* Count rooms visited in current area */
int areacount (CHAR_DATA * ch)
{
  int index = 0, count = 0;
  if (IS_NPC (ch))
    return 0;

  /* If you aren't in an area, you can't use this */
  if ((ch->in_room == NULL) || (ch->in_room->area == NULL))
    return 0;
  for (index = ch->in_room->area->min_vnum;
       index <= ch->in_room->area->max_vnum; index++)
    {
      count += getbit (ch->pcdata->explored, index);
    }
  return count;
}


/* Count used vnums in current areas range */
int arearooms (CHAR_DATA * ch)
{
  int count = 0;
  int index = 0;
  if (IS_NPC (ch))
    return 0;
  if ((ch->in_room == NULL) || (ch->in_room->area == NULL))
    return 0;
  for (index = ch->in_room->area->min_vnum;
       index <= ch->in_room->area->max_vnum; index++)
    {
      if (get_room_index (index) != NULL)
	count++;
    }
  return count;
}

void do_call (CHAR_DATA * ch, char *argument)
{
  char object[MAX_INPUT_LENGTH];
  CHAR_DATA *mob, *mch;
  bool mount_type;		//0 for mount, 1 for behemoth
  int chance;
  int mana_table[] =
    { 40, 40, 40, 40, 40, 40, 40, 40, 50, 50, 50, 50, 50, 50, 50, 50,
    50, 50, 60, 60, 60, 60, 60, 60, 60, 60, 60, 70, 70, 70, 70, 70, 70,
    80, 80,
    80, 80, 80, 80, 80, 80, 80, 100, 100, 100, 100, 100, 100, 100, 100,
    100, 100,
    100, 100, 100, 100, 100, 150, 150, 150, 150, 150, 150, 150, 150,
    150, 150,
    150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150
  };
  int level = 0;
  one_argument (argument, object);
  if (object[0] == '\0')
    {
      send_to_char ("What would you like to call for?\n\r", ch);
      return;
    }
  //Iblis - short circuit for the nidae skill "call storm"
  if (!str_cmp (object, "storm"))
  { 
    call_storm(ch,argument);
    return;
  }
  if (!str_cmp (object, "mount") || !str_cmp (object, "beast"))
    {
      if (!str_cmp (object, "mount"))
	mount_type = 0;

      else
	mount_type = 1;
      if (!mount_type)
	{
	  if ((chance = get_skill (ch, gsn_summon_mount)) == 0)
	    {
	      send_to_char
		("You attempt to call for a mount, but none appear.\n\r", ch);
	      return;
	    }
	}

      else if ((chance = get_skill (ch, gsn_summon_beast)) == 0)
	{
	  send_to_char
	    ("You attempt to call for a behemoth, but none appear.\n\r", ch);
	  return;
	}
      if (!mount_type)
	level = class_level (ch, 6);

      else
	{
	   if (ch->in_room->sector_type == SECT_CITY ||  !IS_OUTSIDE(ch))
	    {
	      send_to_char
		("Beasts do not travel to your current location.\n\r", ch);
	      return;
	    }

	  else
	    level = class_level (ch, 4);
	}
      if (level == 0)
	level = 1;
      if (IS_IMMORTAL (ch))
	level = ch->level;
      if (ch->mana < mana_table[level - 23])
	{
	  send_to_char
	    ("You don't have enough mana to call for a mount.\n\r", ch);
	  return;
	}
      if (number_percent () > chance)
	{
	  if (!mount_type)
	    {
	      send_to_char
		("You attempt to call for a mount, but none appear.\n\r", ch);
	      check_improve (ch, gsn_summon_mount, FALSE, 4);
	    }

	  else
	    {
	      send_to_char
		("You attempt to call for a behemoth, but none appear.\n\r",
		 ch);
	      check_improve (ch, gsn_summon_beast, FALSE, 4);
	    }
	  ch->mana -= (mana_table[level - 23] / 2);
	  return;
	}
      for (mch = char_list; mch; mch = mch->next)
	{
	  if (!IS_NPC (mch))
	    continue;
	  if (mch->riders == ch || mch->mounter == ch)
	    {
	      if (!IS_NPC (ch) && ch->pcdata->boarded == mch)
		{
		  send_to_char
		    ("But you already have a mount boarded at a stable.\n\r",
		     ch);
		  return;
		}
	      if (mch->in_room == ch->in_room)
		{
		  send_to_char ("But your mount is already here.\n\r", ch);

		  return;
		}

	      else
		{
		  char_from_room (mch);
		  char_to_room (mch, ch->in_room);
		  if (ch->race == PC_RACE_NERIX)
		  {
		    add_follower (mch, ch);
		    mch->leader = ch;
		  }
		  
		  if (!mount_type)
		    {
		      act ("You summon forth your trusty steed.", ch,
			   NULL, NULL, TO_CHAR);
		      act ("$n summons forth $s trusty steed.", ch, NULL,
			   NULL, TO_ROOM);
		    }

		  else
		    {
		      act ("You summon forth your behemoth.", ch, NULL,
			   NULL, TO_CHAR);
		      act ("$n summons forth $s behemoth.", ch, NULL,
			   NULL, TO_ROOM);
		    }
		  return;
		}
	    }
	  if (mch->afkmsg != NULL && mch->afkmsg[0] != '\0'
	      && !str_cmp (mch->afkmsg, ch->name))
	    {
	      if (!IS_NPC (ch) && ch->pcdata->boarded == mch)
		{
		  send_to_char
		    ("But you already have a mount boarded at a stable.\n\r",
		     ch);
		  return;
		}
	      if (mch->in_room == ch->in_room)
		{
		  send_to_char ("But your mount is already here.\n\r", ch);

		  return;
		}

	      else
		{
		  char_from_room (mch);
		  char_to_room (mch, ch->in_room);
		  if (ch->race == PC_RACE_NERIX)
		  {
		    add_follower (mch, ch);
		    mch->leader = ch;
		  }
		                           
		  if (!mount_type)
		    {
		      act ("You summon forth your trusty steed.", ch,
			   NULL, NULL, TO_CHAR);
		      act ("$n summons forth $s trusty steed.", ch, NULL,
			   NULL, TO_ROOM);
		    }

		  else
		    {
		      act ("You summon forth your behemoth.", ch, NULL,
			   NULL, TO_CHAR);
		      act ("$n summons forth $s behemoth.", ch, NULL,
			   NULL, TO_ROOM);
		    }
		  return;
		}
	    }
	}
      if (!mount_type)
	{
	  if (level < 31)
	    mob = create_mobile (get_mob_index (MOB_VNUM_SUMMON_1));

	  else if (level < 41)
	    mob = create_mobile (get_mob_index (MOB_VNUM_SUMMON_2));

	  else if (level < 50)
	    mob = create_mobile (get_mob_index (MOB_VNUM_SUMMON_3));

	  else if (level < 56)
	    mob = create_mobile (get_mob_index (MOB_VNUM_SUMMON_4));

	  else if (level < 65)
	    mob = create_mobile (get_mob_index (MOB_VNUM_SUMMON_5));

	  else if (level < 80)
	    mob = create_mobile (get_mob_index (MOB_VNUM_SUMMON_6));

	  else
	    mob = create_mobile (get_mob_index (MOB_VNUM_SUMMON_7));
	}

      else
	{
	  mob = create_mobile (get_mob_index (MOB_VNUM_BEAST));
	  mob->max_hit = ch->max_hit;
	  mob->hit = ch->hit;
	  mob->max_move = ch->max_move;
	  mob->move = ch->move;
	  mob->level = ch->level;
	}
      char_to_room (mob, ch->in_room);
      mob->leader = ch;
      mob->mounter = ch;
      mob->afkmsg = str_dup (ch->name);
      SET_BIT (mob->act, ACT_SENTINEL);
      if (ch->race == PC_RACE_NERIX)
      {
	add_follower (mob, ch);
        mob->leader = ch;
      }
      add_follower (mob, ch);
      act ("You summon forth $N.", ch, NULL, mob, TO_CHAR);
      act ("$n summons forth $N.", ch, NULL, mob, TO_ROOM);
      if (!mount_type)
	check_improve (ch, gsn_summon_mount, TRUE, 4);

      else
	check_improve (ch, gsn_summon_beast, TRUE, 4);
      ch->mana -= mana_table[level - 23];
    }

  else
    {
      send_to_char ("You can't call for that.\n\r", ch);
      return;
    }
}
void do_showmem (CHAR_DATA * ch, char *argument)
{
  MEMORY_DATA *memd;
  char buf[MAX_STRING_LENGTH];
  for (memd = memories; memd; memd = memd->next)
    {
      sprintf (buf, "Mob: %s, Mem: %s\n\r", memd->mob->short_descr,
	       memd->player->name);
      send_to_char (buf, ch);
    }
}
void do_conceal (CHAR_DATA * ch, char *argument)
{
  SCENT_DATA *sc;
  int number, skillper, cnt;
  number = number_percent ();
  skillper = get_skill (ch, gsn_conceal);

  if (number > skillper)
    {
      check_improve (ch, gsn_conceal, FALSE, 1);
      return;
    }
  if (skillper < 33)
    cnt = 1;

  else if (skillper < 66)
    cnt = 2;

  else
    cnt = 3;
  check_improve (ch, gsn_conceal, TRUE, 1);
  for (sc = ch->in_room->scents; sc; sc = sc->next_in_room)
    if (is_name (ch->name, sc->player->name))
      {
	sc->scent_level -= cnt;
	if (sc->scent_level <= 0)
	  {
	    sc->scent_level = SCENT_WEAK;
	    extract_scent (sc);
	  }
	break;
      }
}
void do_track (CHAR_DATA * ch, char *argument)
{
  char to_track[MAX_INPUT_LENGTH];
  char tcbuf[MAX_STRING_LENGTH];
  one_argument (argument, to_track);
  if (get_skill (ch, gsn_track) < 1)
    {
      send_to_char ("You don't know how to track.\n\r", ch);
      return;
    }
  if (to_track[0] == '\0')
    {
      if (ch->tracking[0] != '\0')
	{
	  sprintf (tcbuf, "You are currently tracking: %s.\n\r",
		   ch->tracking);
	  send_to_char (tcbuf, ch);
	}

      else
	send_to_char ("Track who?\n\r", ch);
      return;
    }

  else if (!str_cmp (to_track, "off"))
    {
      free_string (ch->tracking);
      ch->tracking = str_dup ("");
      send_to_char ("Tracking turned off.\n\r", ch);
    }

  else
    {
      sprintf (tcbuf, "Tracking %s.\n\r", to_track);
      send_to_char (tcbuf, ch);
      free_string (ch->tracking);
      ch->tracking = str_dup (to_track);
    }
  return;
}

void display_track (CHAR_DATA * ch)
{
  char tracking[MAX_INPUT_LENGTH];
  char buf[MAX_STRING_LENGTH];
  int door_dir, found;
  SCENT_DATA *sc;
  int dirs[6] = { 0, 0, 0, 0, 0, 0 };
  int slevels[4] = { 0, 0, 0, 0 };
  ROOM_INDEX_DATA *location;
  if (number_percent () < get_skill (ch, gsn_track))
    {

      for (door_dir = 0; door_dir < MAX_DIR; door_dir++)
	{
	  if (ch->in_room->exit[door_dir] == NULL)
	    continue;

	  location = ch->in_room->exit[door_dir]->u1.to_room;
	  if (location == NULL)
	    continue;
	  for (sc = location->scents; sc; sc = sc->next_in_room)
	    {
	      if (is_name (ch->tracking, sc->player->name))
		{
		  switch (sc->scent_level)
		    {
		    case SCENT_STRONG:
		      dirs[door_dir] = SCENT_STRONG;
		      slevels[SCENT_STRONG]++;
		      if (!IS_NPC (sc->player))
			strcpy (tracking, sc->player->name);

		      else
			strcpy (tracking, sc->player->short_descr);
		      break;
		    case SCENT_NOTICEABLE:
		      dirs[door_dir] = SCENT_NOTICEABLE;
		      slevels[SCENT_NOTICEABLE]++;
		      if (!IS_NPC (sc->player))
			strcpy (tracking, sc->player->name);

		      else
			strcpy (tracking, sc->player->short_descr);
		      break;
		    case SCENT_WEAK:
		      dirs[door_dir] = SCENT_WEAK;
		      slevels[SCENT_WEAK]++;
		      if (!IS_NPC (sc->player))
			strcpy (tracking, sc->player->name);

		      else
			strcpy (tracking, sc->player->short_descr);
		      break;
		    }
		  break;
		}
	    }
	}
      found = 0;
      sprintf (buf, "The strong scent of %s can be found", tracking);
      for (door_dir = 0; door_dir < MAX_DIR; door_dir++)
	{
	  if (dirs[door_dir] == SCENT_STRONG)
	    {
	      if (found != slevels[SCENT_STRONG] - 1 && found != 0)
		strcat (buf, ",");
	      strcat (buf, " ");
	      if (door_dir == 4)
		strcat (buf, "upwards");

	      else if (door_dir == 5)
		strcat (buf, "downwards");

	      else
		strcat (buf, dir_name[door_dir]);
	      found++;
	      if (found == slevels[SCENT_STRONG] - 1
		  && slevels[SCENT_STRONG] != 1)
		strcat (buf, " and");
	    }
	}
      if (found > 0)
	{
	  strcat (buf, ".\n\r");
	  send_to_char (buf, ch);
	}
      found = 0;
      sprintf (buf, "You sense the scent of %s", tracking);
      for (door_dir = 0; door_dir < MAX_DIR; door_dir++)
	{
	  if (dirs[door_dir] == SCENT_NOTICEABLE)
	    {
	      if (found != slevels[SCENT_NOTICEABLE] - 1 && found != 0)
		strcat (buf, ",");
	      strcat (buf, " ");
	      if (door_dir == 4)
		strcat (buf, "upwards");

	      else if (door_dir == 5)
		strcat (buf, "downwards");

	      else
		strcat (buf, dir_name[door_dir]);
	      found++;
	      if (found == slevels[SCENT_NOTICEABLE] - 1
		  && slevels[SCENT_NOTICEABLE] != 1)
		strcat (buf, " and");
	    }
	}
      if (found > 0)
	{
	  strcat (buf, ".\n\r");
	  send_to_char (buf, ch);
	}
      found = 0;
      sprintf (buf, "You catch the faint whiff of %s", tracking);
      for (door_dir = 0; door_dir < MAX_DIR; door_dir++)
	{
	  if (dirs[door_dir] == SCENT_WEAK)
	    {
	      if (found != slevels[SCENT_WEAK] - 1 && found != 0)
		strcat (buf, ",");
	      strcat (buf, " ");
	      if (door_dir == 4)
		strcat (buf, "upwards");

	      else if (door_dir == 5)
		strcat (buf, "downwards");

	      else
		strcat (buf, dir_name[door_dir]);
	      found++;
	      if (found == slevels[SCENT_WEAK] - 1
		  && slevels[SCENT_WEAK] != 1)
		strcat (buf, " and");
	    }
	}
      if (found > 0)
	{
	  strcat (buf, ".\n\r");
	  send_to_char (buf, ch);
	}
      check_improve (ch, gsn_track, TRUE, 2);
    }

  else
    check_improve (ch, gsn_track, FALSE, 2);
}

int wall_damage (CHAR_DATA * ch, OBJ_DATA * wall)
{
  short chance, dam;
  dam = wall->level - get_curr_stat (ch, STAT_CON);
  if (ch->hit - dam <= 15 || dam <= 0)
    dam = 1;
  if (!IS_NPC (ch) && ch->pcdata->loner == FALSE)
    return FALSE;
  act
    ("A surge of pain passes through you as your skin is ripped by tiny thorns.",
     ch, NULL, NULL, TO_CHAR);
  act ("$n's skin is ripped by tiny thorns.", ch, NULL, NULL, TO_ROOM);
  ch->hit -= dam;
  if (wall->level < 50)
    chance = 5;

  else if (wall->level < 70)
    chance = 10;

  else if (wall->level < 80)
    chance = 12;

  else if (wall->level < 90)
    chance = 15;

  else
    chance = 20;
  if (number_percent () < chance)
    return (TRUE);
  return (FALSE);
}

bool is_campsite (ROOM_INDEX_DATA * location)
{
  OBJ_DATA *tObj;
  for (tObj = location->contents; tObj; tObj = tObj->next_content)
    if (tObj->pIndexData->vnum == OBJ_VNUM_CAMPFIRE1
	|| tObj->pIndexData->vnum == OBJ_VNUM_CAMPFIRE2)
      return (TRUE);
  return (FALSE);
}

void move_char (CHAR_DATA * ch, int door, bool follow)
{
  CHAR_DATA *fch;
  CHAR_DATA *fch_next;
  ROOM_INDEX_DATA *in_room;
  ROOM_INDEX_DATA *to_room;
  EXIT_DATA *pexit;
  char tcbuf[MAX_STRING_LENGTH];
  OBJ_DATA *tObj;
  short counter;
  int mount_reset;		// Mathew 7/6/99: For dealing with moving mounts.
  CHAR_DATA *blocker;		// Adeon 7/17/03 -- for blocking mobs
  CHAR_DATA *fch_mount_next;
  if (door < 0 || door > 5)
    {
      bug ("Do_move: bad door %d.", door);
      return;
    }
  if (!IS_NPC(ch) && ch->pcdata->cg_state != 0)
  {
    send_to_char("You can't move while playing a card game.\n\r",ch);
    return;
  }
  if (IS_NPC (ch) && ch->riders != NULL)
    return;
  if (IS_SET(ch->in_room->room_flags2,ROOM_MIRROR))
  {
    switch(door)
    {
      case DIR_NORTH: door = DIR_SOUTH;break;
      case DIR_SOUTH: door = DIR_NORTH;break;
      case DIR_EAST: door = DIR_WEST;break;
      case DIR_WEST: door = DIR_EAST;break;
      case DIR_UP: door = DIR_DOWN;break;
      case DIR_DOWN: door = DIR_UP;break;
    }
  }
  if (IS_NPC (ch) && IS_SET(ch->act2,ACT_PUPPET))
  {
    if(ch->pIndexData->vnum <= MOB_VNUM_WARPED_OWL && ch->pIndexData->vnum >= MOB_VNUM_FROG)
    {
      if(ch->desc && ch->desc->original && ch->in_room->exit[door] && ch->in_room->exit[door]->u1.to_room)
      {
        if (!can_move_char(ch->desc->original,ch->in_room->exit[door]->u1.to_room,follow,TRUE))
	{
	  return;
	}
      }
    }
  }
  if (ch->position == POS_TETHERED)
    return;
  if (!check_web (ch))
    return;
  if (!check_entangle (ch))
    return;
  if (!check_clasp (ch))
    return;
  if (ch->position < POS_FIGHTING || ch->position >= POS_FEIGNING_DEATH)
    return;
  in_room = ch->in_room;
  if ((pexit = in_room->exit[door]) == NULL
      || (to_room = pexit->u1.to_room) == NULL
      || !can_see_room (ch, pexit->u1.to_room))
    {
      send_to_char ("Alas, you cannot go that way.\n\r", ch);
      if (!IS_NPC (ch))
	ch->pcdata->speedlen = 0;
      return;
    }

  if (is_affected (ch, gsn_disorientation) && number_percent() < 34)
    {
      for (door = number_range (0, 5), counter = 0; counter < 6;
	   counter++, door++)
	{
	  if (door > 5)
	    door = door % 6;
	  if ((pexit = in_room->exit[door]) == NULL
	      || (to_room = pexit->u1.to_room) == NULL
	      || !can_see_room (ch, pexit->u1.to_room))
	    continue;

	  else
	    break;
	}
      if (counter > 5)
	{
	  send_to_char ("Alas, you cannot go that way.\n\r", ch);
	  return;
	}
    }
  if (IS_SET(to_room->area->area_flags,AREA_SOLO) && (to_room->area->nplayer > 0) &&
      to_room->area != in_room->area)
    {
	send_to_char("That area is occupied!\n\r",ch);
      return;
    }

  if (IS_SET(to_room->room_flags2,ROOM_SOLO) && !IS_NPC(ch))
    {
      CHAR_DATA *mch;
      for (mch = to_room->people;mch != NULL; mch = mch->next_in_room)
        {
          if (!IS_NPC(mch))
	  {
	    send_to_char("That room is occupied!\n\r",ch);
	    return;
	  }
        }
    }
  if (!br_vnum_check (to_room->vnum))
    {
      send_to_char
	("That room is off limits during the `iBattle Royale``.\r\n", ch);
      return;
    }
  for (blocker = ch->in_room->people; blocker != NULL;
       blocker = blocker->next_in_room)
    {
      if (!IS_SET (blocker->act2, ACT_BLOCK_EXIT)
	  || blocker->blocks_exit == -1)
	continue;
      if (door != blocker->blocks_exit)
	continue;
      if (IS_IMMORTAL (ch) || IS_SET(ch->act2,ACT_NO_BLOCK))
      {
        sprintf (tcbuf, "%s would have blocked your way %s, except you're an Immortal.\n\r",
			blocker->short_descr, dir_name[blocker->blocks_exit]);
	send_to_char(tcbuf,ch);
	break;
      }
      sprintf (tcbuf, "%s blocks your way %s...\n\r",
	       blocker->short_descr, dir_name[blocker->blocks_exit]);
      send_to_char (tcbuf, ch);
      return;
    }
  if (ch->pcdata && ch->pcdata->fishing)
    {
      send_to_char ("You can't move while you're fishing!.\n\r", ch);
      return;
    }
  // Mathew 4/16/99: Fixed the logic of the closed door check to make
  // more sense.
  if (IS_SET (pexit->exit_info, EX_CLOSED) &&
      (!IS_AFFECTED (ch, AFF_PASS_DOOR)
       || IS_SET (pexit->exit_info, EX_NOPASS)) && !IS_IMMORTAL(ch)
    )
    {
      act ("The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR);
      return;
    }
  if (IS_AFFECTED (ch, AFF_CHARM)
      && ch->master != NULL && in_room == ch->master->in_room)
    {
      send_to_char ("What?  And leave your beloved master?\n\r", ch);
      return;
    }
  if (ch->mount != NULL)
    if (ch->mount->position != POS_STANDING
	&& ch->mount->position != POS_FIGHTING)
      {
	sprintf (tcbuf,
		 "%s will have to stand before you can ride it any further.\n\r",
		 fcapitalize (ch->mount->short_descr));
	send_to_char (tcbuf, ch);
	return;
      }
  if (IS_SET (to_room->room_flags, ROOM_NOMOUNT) && ch->mount != NULL
      && !IS_AFFECTED (ch->mount, AFF_FLYING)
      && !IS_AFFECTED (ch->mount, AFF_SWIM))
    {
      send_to_char ("You may not ride mounts in there.\n\r", ch);
      return;
    }
  if (IS_SET (to_room->room_flags, ROOM_NOSWIMMOUNT)
      && ch->mount != NULL && IS_AFFECTED (ch->mount, AFF_SWIM))
    {
      send_to_char ("You may not swim with mounts in there.\n\r", ch);
      return;
    }
  if (IS_SET (to_room->room_flags, ROOM_NOFLYMOUNT)
      && ch->mount != NULL && IS_AFFECTED (ch->mount, AFF_FLYING))
    {
      send_to_char ("You may not fly mounts in there.\n\r", ch);
      return;
    }
  if ((ch->riders != NULL || ch->mounter != NULL)
      && IS_SET (to_room->room_flags,
		 ROOM_NOMOUNT) && (!IS_AFFECTED (ch, AFF_FLYING)
				   && !IS_AFFECTED (ch, AFF_SWIM)))
    {
      send_to_char ("You can't go in there, mount.\n", ch);
      return;
    }
  if ((ch->riders != NULL || ch->mounter != NULL)
      && IS_SET (to_room->room_flags, ROOM_NOFLYMOUNT)
      && IS_AFFECTED (ch, AFF_FLYING))
    {
      send_to_char ("You can't fly in there, mount.\n", ch);
      return;
    }
  if ((ch->riders != NULL || ch->mounter != NULL)
      && IS_SET (to_room->room_flags, ROOM_NOSWIMMOUNT)
      && IS_AFFECTED (ch, AFF_SWIM))
    {
      send_to_char ("You can't swim in there, mount.\n", ch);
      return;
    }
  if (to_room->max_level != 0 && ch->level > to_room->max_level
      && !IS_IMMORTAL (ch))
    {
      send_to_char ("You aren't allowed in there.\n\r", ch);
      return;
    }
// Minax 2-13-03 Keep charmies out of no_charmie rooms.
  if (IS_AFFECTED (ch, AFF_CHARM)
      && (IS_SET (to_room->room_flags, ROOM_NO_CHARMIE)))
    {
      send_to_char
	("You aren't allowed in there because you are charmed.\n\r", ch);
      return;
    }
  if (to_room->class_flags != 0 && !IS_IMMORTAL (ch))
    {

      if (!room_class_check (ch, to_room))
	{
	  send_to_char ("You aren't allowed in there.\n\r", ch);
	  return;
	}
    }
  if ((to_room->clan != CLAN_BOGUS) && (ch->clan != to_room->clan)
      && !IS_IMMORTAL (ch) && !IS_SET (ch->act, ACT_PET) && !IS_SET(ch->act2,ACT_PUPPET))
    {
      send_to_char ("You aren't allowed in there.\n\r", ch);
      return;
    }
  if (to_room->race_flags != 0)
  {
    if (!room_race_check(ch,to_room))
    {
      send_to_char ("You aren't allowed in there.\n\r", ch);
      return;
    }
  }
  if (!is_room_owner (ch, to_room) && room_is_private (to_room))
    {
      if (to_room->max_message[0] == '\0')
	send_to_char ("That room is private right now.\n\r", ch);

      else
	{
	  send_to_char (to_room->max_message, ch);
	  send_to_char ("\n\r", ch);
	}
      return;
    }
  //Iblis 6/21/03 - Battle Royale room off limit checking
  if (!br_vnum_check (to_room->vnum))
    {
      send_to_char
	("That room is off limits during `iBattle Royale``\r\n", ch);
      return;
    }
  if (!IS_IMMORTAL (ch) && IS_SET (to_room->room_flags, ROOM_IMP_ONLY))
    {
      send_to_char ("Sorry, you can't go in there.\n\r", ch);
      return;
    }
  if (IS_SET (to_room->room_flags, ROOM_SPECTATOR))
    {
      OBJ_DATA *obj, *obj_next;
      bool found = FALSE;
      if (IS_IMMORTAL (ch))
	found = TRUE;

      else
	for (obj = ch->carrying; obj != NULL; obj = obj_next)
	  {
	    obj_next = obj->next_content;
	    if (obj->pIndexData->vnum == OBJ_VNUM_ATICKET)
	      {
		found = TRUE;
		extract_obj (obj);
		break;
	      }
	  }
      if (!found)
	{
	  send_to_char
	    ("A burly bouncer smirks and says 'Trying to sneak in here without a ticket?  I don't think so.'\n\r",
	     ch);
	  return;
	}
    }
  if (to_room->vnum == 4334)
    {
      OBJ_DATA *obj, *obj_next;
      bool found = FALSE;
      if (IS_IMMORTAL (ch))
	found = TRUE;

      else
	for (obj = ch->carrying; obj != NULL; obj = obj_next)
	  {
	    obj_next = obj->next_content;
	    if (obj->pIndexData->vnum == OBJ_VNUM_ZTICKET)
	      {
		found = TRUE;
		extract_obj (obj);
		break;
	      }
	  }
      if (!found)
	{
	  send_to_char
	    ("A zoo attendant stops you and says 'Sorry, you need a ticket to get in there.'\n\r",
	     ch);
	  return;
	}
    }
  if (!IS_NPC (ch))
    {
      int iClass, iGuild;
      int move;
      for (iClass = 0; iClass < MAX_CLASS; iClass++)
	{
	  for (iGuild = 0; iGuild < MAX_GUILD; iGuild++)
	    {
	      if (!(IS_CLASS (ch, iClass))
		  && to_room->vnum == class_table[iClass].guild[iGuild])
		{
		  send_to_char ("You aren't allowed in there.\n\r", ch);
		  return;
		}
	    }
	}
      if (IS_SET (to_room->room_flags, ROOM_NO_FLY))
	{
	  if (ch->mount == NULL)
	    {
	      if (IS_AFFECTED (ch, AFF_FLYING) && !IS_IMMORTAL (ch))
		{
		  send_to_char ("You can't fly there.\n\r", ch);
		  return;
		}
	    }

	  else
	    {
	      if (IS_AFFECTED (ch->mount, AFF_FLYING))
		{
		  send_to_char ("You can't fly your mount there.\n\r", ch);
		  return;
		}
	    }
	}
      if (in_room->sector_type == SECT_AIR
	  || to_room->sector_type == SECT_AIR)
	{
	  if (ch->mount == NULL)
	    {
	      if (!IS_AFFECTED (ch, AFF_FLYING) && !IS_IMMORTAL (ch))
		{
		  send_to_char ("You can't fly.\n\r", ch);
		  return;
		}
	    }

	  else
	    {
	      if (!IS_AFFECTED (ch->mount, AFF_FLYING))
		{
		  send_to_char ("Your mount cannot fly.\n\r", ch);
		  return;
		}
	    }
	}

      //Iblis 10/30/04 - Ice Room Check
/*      if (!IS_AFFECTED(ch,AFF_FLYING) && IS_SET(to_room->room_flags2,ROOM_ICE))
      {
        char_from_room(ch);
	char_to_room(ch,to_room);
	do_look(ch,"auto");
	if (can_move_char_door(ch,door,follow,FALSE))
        {
          send_to_char("The slickness of the ice on the ground causes you to slide into the next room!\n\r",ch);
	  if (is_sliding) //this means they slid in from the previous room
	    act("$n slides into the room.",ch,NULL,NULL,TO_ROOM);	  
	  else {

	  }
	  act("The slickness of the ice on the ground causes $n to slide $T!",ch,NULL,dir_name[door],TO_ROOM);
	   is_sliding = TRUE;
	   move_char(ch,door,follow);
	   if (is_sliding) //this means this is their final resting place
  	     act("$n slides into the room.",ch,NULL,NULL,TO_ROOM);
	   is_sliding = FALSE;
	   //return;
	 }
	
	// Move a group if ch was the group leader. 4/14/99 Mathew
	mount_reset = 0;
	fch_mount_next = NULL;
	for (fch = in_room->people; fch != NULL; fch = fch_next)
	  {
	    
	    // Mathew 4/14/99: Skip mounts with riders. They are moved with the
	    // rider.
	    // Mathew 7/6/99: Fix mount problem
	    if (mount_reset)
	      {
		mount_reset = 0;      // Reset the flag.
		fch = fch_mount_next;
	      }
	    if (fch != NULL)
	      {
		fch_next = fch->next_in_room;
	      }
	    
	    else
	      {
		fch_next = NULL;      // Mathew 7/6/99: Skip NULL fch's due to mount resets
		continue;
	      }
	    if (fch->master == ch && IS_AFFECTED (fch, AFF_CHARM)
		&& fch->position < POS_STANDING)
	      do_stand (fch, "");
	    if ((fch->master == ch || fch->stalking == ch)
		&& fch->position >= POS_STANDING && fch->position < POS_FEIGNING_DEATH && fch->in_room != ch->
		in_room)
	      {
		if (IS_SET (ch->in_room->room_flags, ROOM_LAW)
		    && (IS_NPC (fch) && is_aggro (fch)))
		  {
		    act ("You can't bring $N into the city.", ch, NULL, fch,
			 TO_CHAR);
		    act ("You aren't allowed in the city.", fch, NULL, NULL,
			 TO_CHAR);
		    
		    continue;
		  }
		//5-10-03 Iblis - Check to remove camoflauge/hide if following someone
		if (IS_AFFECTED (fch, AFF_CAMOUFLAGE))
		  REMOVE_BIT (fch->affected_by, AFF_CAMOUFLAGE);
		if (IS_AFFECTED (fch, AFF_HIDE))
		  REMOVE_BIT (fch->affected_by, AFF_HIDE);
		act ("You follow $N.", fch, NULL, ch, TO_CHAR);
		if (fch_next != NULL && fch->mount != NULL)
		  {
		    mount_reset++;    // Mathew 7/6/99: Reset to top person in
		    // old room if a rider and a mount move.
		    if (fch->next_in_room != NULL
			&& fch->next_in_room == fch->mount)
		      {
			fch_mount_next = fch->mount->next_in_room;    // Skip the mount.
		      }
		    
		    else
		      {
			fch_mount_next = fch->next_in_room;   // Preserve old list.
		      }
		  }
		move_char (fch, door, TRUE);
	      }
	  }
	
*/	
/*	if (can_move_char_door(ch,door,follow,FALSE))
	{
	  send_to_char("The slickness of the ice on the ground causes you to slide into the next room!\n\r",ch);
	  act("The slicksness of the ice on the ground causes $n to slide $T!",ch,NULL,dir_name[door],TO_ROOM);
	  is_sliding = TRUE;
	  move_char(ch,door,follow);
	  is_sliding = FALSE;
	  return;
	}*/
/*	return;
      }*/

      /* BEGIN UNDERWATER */
      if ((in_room->sector_type == SECT_UNDERWATER
	   || to_room->sector_type == SECT_UNDERWATER)
	  && !IS_AFFECTED (ch, AFF_HASTE))
	{
	  if (!IS_IMMORTAL (ch) && ch->race != PC_RACE_NIDAE)
	    WAIT_STATE (ch, 10);
	}
      if ((in_room->sector_type == SECT_WATER_NOSWIM
	   || to_room->sector_type == SECT_WATER_NOSWIM
	   || to_room->sector_type == SECT_WATER_OCEAN
	   || in_room->sector_type == SECT_WATER_OCEAN)
	  && !IS_AFFECTED (ch, AFF_FLYING))
	{
	  bool found = FALSE;
	  OBJ_DATA *mObj;
	  if (ch->mount != NULL && IS_AFFECTED (ch->mount, AFF_FLYING))
	    found = TRUE;

	  else if (IS_IMMORTAL (ch))
	    found = TRUE;

	  else
	    for (mObj = ch->carrying; mObj; mObj = mObj->next_content)
	      {
		if (mObj->item_type == ITEM_RAFT)
		  {
		    found = TRUE;
		    break;
		  }
	      }

	}
      move = movement_loss[UMIN (SECT_MAX - 1, in_room->sector_type)]
	+ movement_loss[UMIN (SECT_MAX - 1, to_room->sector_type)];
      move /= 2;		/* i.e. the average */
      if (to_room->sector_type == SECT_UNDERWATER
	  && IS_AFFECTED (ch, AFF_AQUA_BREATHE))
	move = 4;

      if ((to_room->sector_type == SECT_WATER_OCEAN
          || to_room->sector_type == SECT_WATER_SWIM
          || to_room->sector_type == SECT_WATER_NOSWIM
	   || to_room->sector_type == SECT_UNDERWATER)
          &&
	  (ch->in_room->sector_type == SECT_WATER_OCEAN
            || ch->in_room->sector_type == SECT_WATER_SWIM
            || ch->in_room->sector_type == SECT_WATER_NOSWIM
	   || ch->in_room->sector_type == SECT_UNDERWATER))
	{
	  if (!IS_AFFECTED (ch, AFF_AQUA_BREATHE) && !IS_IMMORTAL (ch) && !(get_skill(ch,gsn_swim) > number_range(1,100)) && ch->move > 0 && !(get_skill(ch,gsn_swim) == 100) && !IS_SET(ch->imm_flags,IMM_DROWNING))
	    {
	      OBJ_DATA *obj;
	      bool found;

	      found = FALSE;

	      for (obj = ch->carrying; obj != NULL; obj = obj->next_content)
		{
		  if (obj->item_type == ITEM_GILLS
		      && obj->wear_loc != WEAR_NONE)
		    {
		      found = TRUE;
		      break;
		    }
		}

	      if (!found)
		{
		  ch->mana -= ch->max_mana/15.0 + (number_range(1,10)-5);
		  ch->move -= ch->max_move/15.0 + (number_range(1,10)-5);

		  send_to_char ("Your lungs fill with water.\n\r", ch);
		  act ("$n turns purple floundering for air.", ch, NULL,
		       NULL, TO_ROOM);
		  //Iblis 10/29/04 - Changed to prevent crashing when mobs drowned on move
		  if (ch->hit <= ch->max_hit/15.0)
		  {
		    ch->hit = 1;
		    if (ch->move > 0)
		      ch->move = -1;
		  }
		  else ch->hit -= ch->max_hit/15.0;
		}
	    }
	
      //12-30-03 Fail this swimming check, and you go off in a random direction
      if (get_skill(ch,gsn_swim) < number_range(1,100) && !(get_skill(ch,gsn_swim) == 100))
      {
        int door=0;
        for (door = number_range (0, 5), counter = 0; counter < 6;
           counter++, door++)
        {
          if (door > 5)
            door = door % 6;
          if ((pexit = in_room->exit[door]) == NULL
              || (to_room = pexit->u1.to_room) == NULL
              || !can_see_room (ch, pexit->u1.to_room)
              || (IS_SET (pexit->exit_info, EX_CLOSED) &&
                 (!IS_AFFECTED (ch, AFF_PASS_DOOR)|| IS_SET (pexit->exit_info, EX_NOPASS))))
            continue;

          else
            break;
        }
      if (counter > 5)
        {
          send_to_char ("Alas, you cannot go that way.\n\r", ch);
          return;
        }      
      }
	}
    

      /* conditional effects */
      if (get_carry_weight (ch) > can_carry_w (ch))
        move *= 2;
      if (IS_AFFECTED (ch, AFF_FLYING) || IS_AFFECTED (ch, AFF_HASTE))
	move /= 2;
      if (IS_AFFECTED (ch, AFF_SLOW))
	move *= 2;
      if (!IS_NPC (ch) && ch->pcdata->speedlen != 0)
	move *= 2;
      if (!IS_NPC (ch) && ch->race == PC_RACE_NIDAE && ch->in_room &&
	    (ch->in_room->sector_type == SECT_UNDERWATER 
	       || ch->in_room->sector_type == SECT_WATER_OCEAN))
	      move = 1;
      if (ch->mount == NULL && ch->move < move && !is_sliding)
	{
	  send_to_char ("You are too exhausted.\n\r", ch);
	  if (!IS_NPC (ch))
	    ch->pcdata->speedlen = 0;
	  return;
	}
      if (!move_fast)
        WAIT_STATE (ch, 1);
      if (ch->mount == NULL)
	ch->move -= move;
    }
  for (tObj = ch->in_room->contents; tObj; tObj = tObj->next_content)
    if (tObj->pIndexData->vnum == OBJ_VNUM_WALL_THORNS
	&& tObj->value[0] == door)
      {
	if (wall_damage (ch, tObj))
	  {
	    send_to_char
	      ("You are unable to break through the wall of thorns.\n\r", ch);
	    return;
	  }
	break;
      }
  if (ch->mount != NULL)
    {
      char tcbuf[MAX_STRING_LENGTH];
      int move;
      move = movement_loss[UMIN (SECT_MAX - 1, in_room->sector_type)]
	+ movement_loss[UMIN (SECT_MAX - 1, to_room->sector_type)];
      move /= 2;		/* i.e. the average */
      if (to_room->sector_type == SECT_UNDERWATER
	  && IS_AFFECTED (ch, AFF_AQUA_BREATHE))
	move = 4;

      if ((to_room->sector_type == SECT_WATER_OCEAN
          || to_room->sector_type == SECT_WATER_SWIM
          || to_room->sector_type == SECT_WATER_NOSWIM
	   || to_room->sector_type == SECT_UNDERWATER)
          &&
	  (ch->in_room->sector_type == SECT_WATER_OCEAN
            || ch->in_room->sector_type == SECT_WATER_SWIM
            || ch->in_room->sector_type == SECT_WATER_NOSWIM
	   || ch->in_room->sector_type == SECT_UNDERWATER))
	{
	  if (!IS_AFFECTED (ch, AFF_AQUA_BREATHE) && !IS_IMMORTAL (ch) && !(get_skill(ch,gsn_swim) > number_range(1,100)) && !IS_SET(ch->imm_flags,IMM_DROWNING) && ch->move > 0)
	  {
	    OBJ_DATA *obj;
	    bool found;

	    found = FALSE;

	    for (obj = ch->carrying; obj != NULL; obj = obj->next_content)
	      {
		if (obj->item_type == ITEM_GILLS
		    && obj->wear_loc != WEAR_NONE)
		  {
		    found = TRUE;
		    break;
		  }
	      }

	    if (!found)
	      {
		ch->mana -= ch->max_mana/15.0 + (number_range(1,10)-5);
		ch->move -= ch->max_move/15.0 + (number_range(1,10)-5);

		send_to_char ("Your lungs fill with water.\n\r", ch);
		act ("$n turns purple floundering for air.", ch, NULL, NULL, TO_ROOM);
		//Iblis 10/29/04 - Changed to prevent crashing when mobs drowned on move
		if (ch->hit <= ch->max_hit/15.0)
		{
			ch->hit = 1;
			if (ch->move > 0)
				ch->move = -1;
		}
		else ch->hit -= ch->max_hit/15.0;
	      }
	  }
	
      //12-30-03 Fail this swimming check, and you go off in a random direction
      if (get_skill(ch,gsn_swim) < number_range(1,100))
      {
        int door=0;
        for (door = number_range (0, 5), counter = 0; counter < 6;
           counter++, door++)
        {
          if (door > 5)
            door = door % 6;
          if ((pexit = in_room->exit[door]) == NULL
              || (to_room = pexit->u1.to_room) == NULL
              || !can_see_room (ch, pexit->u1.to_room)
	      || (IS_SET (pexit->exit_info, EX_CLOSED) &&
		 (!IS_AFFECTED (ch, AFF_PASS_DOOR)|| IS_SET (pexit->exit_info, EX_NOPASS))))		  
            continue;

          else
            break;
        }
      if (counter > 5)
        {
          send_to_char ("Alas, you cannot go that way.\n\r", ch);
          return;
        }
      }
	}

      /* conditional effects */
      if (get_carry_weight (ch) > can_carry_w (ch))
        move *= 2;
      if (IS_AFFECTED (ch, AFF_FLYING) || IS_AFFECTED (ch, AFF_HASTE))
	move /= 2;
      if (IS_AFFECTED (ch, AFF_SLOW))
	move *= 2;
      if (!IS_NPC (ch) && ch->pcdata->speedlen != 0)
	move *= 2;
      if (!ch->mount)
        return;
      if (ch->mount->move < move && !is_sliding)
	{
	  send_to_char ("Your mount is too exhausted.\n\r", ch);
	  if (!IS_NPC (ch))
	    ch->pcdata->speedlen = 0;
	  return;
	}
      if (ch->mount->hit <= 0 && !is_sliding)
	{
	  send_to_char ("Your mount is in no shape to move around.\n\r", ch);
	  if (!IS_NPC (ch))
	    ch->pcdata->speedlen = 0;
	  return;
	}
      ch->mount->move -= move;
      if (!is_sliding)
      {
        sprintf (tcbuf, "You ride $T on %s.", ch->mount->short_descr);
        act (tcbuf, ch, NULL, dir_name[door], TO_CHAR);
      }
    }

  if (!IS_AFFECTED (ch, AFF_SNEAK) && ch->stalking == NULL
      && ch->invis_level < LEVEL_HERO
      && !(ch->mount && ch->mount->pIndexData->vnum == MOB_VNUM_BEAST)
      && !(ch->pIndexData && ch->pIndexData->vnum == MOB_VNUM_BEAST)
      && !(ch->race == PC_RACE_KALIAN && (time_info.hour > 18 || time_info.hour < 5))
      && !is_sliding
       )
    {
      if (ch->in_room->exit_msg[0] != '\0')
      {
        if (IS_SET(ch->act2,ACT_IMAGINARY))
          act (ch->in_room->exit_msg, ch, NULL, dir_name[door], TO_CJIR);
        else act (ch->in_room->exit_msg, ch, NULL, dir_name[door], TO_ROOM);
      }

      else if (ch->in_room->sector_type == SECT_UNDERWATER)
      {
        if (IS_SET(ch->act2,ACT_IMAGINARY))
  	  act ("$n swims $T.", ch, NULL, dir_name[door], TO_CJIR);
	else act ("$n swims $T.", ch, NULL, dir_name[door], TO_ROOM);
      }

      else if (IS_AFFECTED (ch, AFF_FLYING))
      {
	if (IS_SET(ch->act2,ACT_IMAGINARY))
	  act ("$n flies $T.", ch, NULL, dir_name[door], TO_CJIR);
	else act ("$n flies $T.", ch, NULL, dir_name[door], TO_ROOM);
      }

      else if (ch->mount != NULL)
	{
	  char tcbuf[MAX_STRING_LENGTH];
	  sprintf (tcbuf, "$n leaves $T, riding %s.", ch->mount->short_descr);
	  if (IS_SET(ch->act2,ACT_IMAGINARY))
  	    act (tcbuf, ch, NULL, dir_name[door], TO_CJIR);
	  else act (tcbuf, ch, NULL, dir_name[door], TO_ROOM);
	}

      else
      {
        if (IS_SET(ch->act2,ACT_IMAGINARY))
  	  act ("$n leaves $T.", ch, NULL, dir_name[door], TO_CJIR);
	else act ("$n leaves $T.", ch, NULL, dir_name[door], TO_ROOM);

      }
    }
  else 
    {
      if (!is_sliding)
      {
        act ("$n sneaks $T.",ch,NULL,dir_name[door],TO_IIR);
        if (ch->race == PC_RACE_KALIAN && (time_info.hour > 18 || time_info.hour < 5))
          {
            send_to_char("You slide unnoticed through the shadows to the ",ch);
            send_to_char(dir_name[door],ch);
            send_to_char(".\n\r",ch);
          }
      }
    }

  /* Move the Mount */
  if (ch->mount != NULL)
    {
      char_from_room (ch->mount);
      char_to_room (ch->mount, to_room);
    }
  if (!IS_NPC(ch) && ch->race == PC_RACE_LITAN && ch->pcdata->flaming
	  && weather_info.sky != SKY_RAINING && weather_info.sky != SKY_LIGHTNING
	  && ch->in_room->sector_type != SECT_WATER_SWIM
	  && ch->in_room->sector_type != SECT_WATER_NOSWIM
	  && ch->in_room->sector_type != SECT_WATER_OCEAN
	  && ch->in_room->sector_type != SECT_SWAMP
	  && ch->in_room->sector_type != SECT_UNDERWATER)
  {
	  OBJ_DATA* obj;
	  char tcbuf[MAX_STRING_LENGTH];
	  obj = get_obj_vnum_room (ch->in_room, OBJ_VNUM_LITAN_FOOTSTEPS);
	  if (obj)
	  {
	    obj_from_room(obj);
	    extract_obj(obj);
	  }
	  obj = create_object(get_obj_index(OBJ_VNUM_LITAN_FOOTSTEPS),0);
	  obj->timer = 1;
          sprintf (tcbuf, obj->description, dir_name[door]);
          free_string (obj->description);
          obj->description = str_dup (tcbuf);
	  obj_to_room(obj,ch->in_room);
  }
  if (IS_SET(ch->in_room->room_flags2,ROOM_SNOW) && !IS_SET(ch->affected_by,AFF_FLYING))
  {
    OBJ_DATA* obj;
    char tcbuf[MAX_STRING_LENGTH];
    obj = get_obj_vnum_room (ch->in_room, OBJ_VNUM_LITAN_FOOTSTEPS);
    if (obj)
    {
      obj_from_room(obj);
      extract_obj(obj);
    }
    obj = create_object(get_obj_index(OBJ_VNUM_LITAN_FOOTSTEPS),0);
    obj->timer = 1;
    sprintf (tcbuf, "`hFootsteps in the snow lead off to the %s.``",dir_name[door]);
    free_string (obj->description);
    obj->description = str_dup (tcbuf);
    sprintf (tcbuf, "`ha footstep in the snow``");
    free_string (obj->short_descr);
    obj->short_descr = str_dup (tcbuf);
    obj->value[0] = 1;
    obj_to_room(obj,ch->in_room);
  }
  /* Move the Character */
  char_from_room (ch);
  char_to_room (ch, to_room);

  if (!IS_NPC(ch) && ch->race == PC_RACE_NIDAE && ch->in_room)
  {
    if (ch->in_room->sector_type == SECT_UNDERWATER
		    || ch->in_room->sector_type == SECT_WATER_OCEAN)
    {
      if (IS_AFFECTED(ch,AFF_SLOW))
      {
	 if (IS_AFFECTED(ch,AFF_SLOW))
         {
           AFFECT_DATA *paf;
           AFFECT_DATA *paf_next;
           for (paf = ch->affected; paf != NULL; paf = paf_next)
           {
             paf_next = paf->next;
             if (paf->type == gsn_dehydration)
              {
                send_to_char (skill_table[paf->type].msg_off, ch);
                send_to_char ("\n\r", ch);
                affect_remove (ch, paf);
              }
	   }
	 }
      }
      ch->pcdata->oow_ticks = 0;
    }
    else if (!IS_AFFECTED(ch,AFF_SLOW))
    {
      AFFECT_DATA af;
      ch->perm_stat[STAT_CHA] -= 9;
      ch->perm_stat[STAT_DEX] -= 5;
      af.where = TO_AFFECTS;
      af.type = gsn_dehydration;
      af.level = ch->level;
      af.duration = 5;  //Doesn't matter, its perm til they're in water again
      af.location = APPLY_DEX;
      af.modifier = 0;
      af.bitvector = AFF_SLOW;
      af.permaff = FALSE;
      af.composition = FALSE;
      af.comp_name = str_dup ("");
      affect_to_char (ch, &af);
      send_to_char ("Your skin begins to dry out and you feel less agile.\n\r", ch);
    }
  }

  /* BEGIN ARENA */
  if (is_dueling (ch))
    {
      char buf[MAX_STRING_LENGTH];
      CHAR_DATA *vict, *v_next;
      if (IS_AFFECTED (ch, AFF_SNEAK)
	  || (ch->mount && ch->mount->pIndexData->vnum == MOB_VNUM_BEAST) 
	  || (ch->pIndexData && ch->pIndexData->vnum == MOB_VNUM_BEAST)
          || (ch->race == PC_RACE_KALIAN && time_info.hour > 18 && time_info.hour < 5))
	sprintf (buf, "%s moves stealthily into %s.\n\r", ch->name,
		 to_room->name);

      else if (IS_AFFECTED (ch, AFF_FLYING))
	sprintf (buf, "%s flies %s into %s.\n\r", ch->name,
		 dir_name[door], to_room->name);

      else
	sprintf (buf, "%s moves %s into %s.\n\r", ch->name,
		 dir_name[door], to_room->name);
      arena_report (buf);
      for (vict = ch->in_room->people; vict != NULL; vict = v_next)
	{
	  v_next = vict->next_in_room;
	  if (vict != ch)
	    {
	      if (!IS_AFFECTED (ch, AFF_SNEAK)
		  && ch->invis_level < LEVEL_HERO
		  && !(ch->mount && ch->mount->pIndexData->vnum == MOB_VNUM_BEAST) 
		  && !(ch->pIndexData  && ch->pIndexData->vnum == MOB_VNUM_BEAST)
   	          && !(ch->race == PC_RACE_KALIAN && time_info.hour > 18 && time_info.hour < 5))
		{
		  sprintf (buf,
			   "%s prepares, noticing %s's approach.\n\r",
			   vict->name, ch->name);
		  arena_report (buf);
		}

	      else
		{
		  sprintf (buf, "%s escapes %s's notice!\n\r", ch->name,
			   vict->name);
		  arena_report (buf);
		}
	    }
	}
    }

  /* END ARENA */
  for (tObj = ch->in_room->contents; tObj; tObj = tObj->next_content)
    if (tObj->pIndexData->vnum == OBJ_VNUM_WALL_THORNS
	&& tObj->value[0] == rev_dir[door])
      {
	wall_damage (ch, tObj);
	break;
      }
  if (!IS_AFFECTED (ch, AFF_SNEAK) && ch->stalking == NULL
      && ch->invis_level < LEVEL_HERO
      && !(ch->mount && ch->mount->pIndexData->vnum == MOB_VNUM_BEAST)
      && !(ch->pIndexData && ch->pIndexData->vnum == MOB_VNUM_BEAST)
      && !(ch->race == PC_RACE_KALIAN && (time_info.hour > 18 || time_info.hour < 5))
      && !is_sliding
      )
    {
      if (ch->in_room->enter_msg[0] != '\0')
	{
	  char tmp_buf[MAX_STRING_LENGTH];
	  char *cptr;
	  if ((cptr = strstr (ch->in_room->enter_msg, "$w")) != NULL)
	    {
	      *cptr = '\0';
	      strcpy (tmp_buf, ch->in_room->enter_msg);
	      strcat (tmp_buf, dir_name[rev_dir[door]]);
	      strcat (tmp_buf, cptr + 2);
	      *cptr = '$';
	      if (IS_SET(ch->act2,ACT_IMAGINARY))
		      act (tmp_buf, ch, NULL, NULL, TO_CJIR);
	      else act (tmp_buf, ch, NULL, NULL, TO_ROOM);
	    }

	  else 
	  {
	    if (IS_SET(ch->act2,ACT_IMAGINARY))
	      act (ch->in_room->enter_msg, ch, NULL, NULL, TO_CJIR);
	    else  act (ch->in_room->enter_msg, ch, NULL, NULL, TO_ROOM);
	  }
	}

      else if (ch->in_room->sector_type == SECT_UNDERWATER)
      {
        if (IS_SET(ch->act2,ACT_IMAGINARY))
          act (ch->in_room->enter_msg, ch, NULL, NULL, TO_CJIR);
	else act ("$n swims into view.", ch, NULL, NULL, TO_ROOM);
      }

      else if (IS_AFFECTED (ch, AFF_FLYING))
      {
        if (IS_SET(ch->act2,ACT_IMAGINARY))
           act ("$n flies into the room.", ch, NULL, NULL, TO_CJIR);
	else act ("$n flies into the room.", ch, NULL, NULL, TO_ROOM);
      }

      else if (ch->mount != NULL)
	{
	  char tcbuf[MAX_STRING_LENGTH];
	  sprintf (tcbuf, "$n arrives, riding %s.", ch->mount->short_descr);
	  if (IS_SET(ch->act2,ACT_IMAGINARY))
	    act (tcbuf, ch, NULL, NULL, TO_CJIR);
	  else  act (tcbuf, ch, NULL, NULL, TO_ROOM);
	}

      else
        {
	  if (IS_SET(ch->act2,ACT_IMAGINARY))
	    act ("$n has arrived.", ch, NULL, NULL, TO_CJIR);
	  else act ("$n has arrived.", ch, NULL, NULL, TO_ROOM);
	}
	  
    }
  else if (!is_sliding)
	  act ("$n sneaks into the room.",ch,NULL,dir_name[door],TO_IIR);
  do_look (ch, "auto");

  //Iblis 10/30/04 - Ice Room Check
  if (!IS_AFFECTED(ch,AFF_FLYING) && IS_SET(to_room->room_flags2,ROOM_ICE))
    {
      if (can_move_char_door(ch,door,follow,FALSE))
        {
          send_to_char("The slickness of the ice on the ground causes you to slide into the next room!\n\r",ch);
          if (is_sliding) //this means they slid in from the previous room
            act("$n slides into the room.",ch,NULL,NULL,TO_ROOM);
          act("The slickness of the ice on the ground causes $n to slide $T!",ch,NULL,dir_name[door],TO_ROOM);
	  is_sliding = TRUE;
	  move_char(ch,door,FALSE); //do NOT follow this person if they are sliding
	  if (is_sliding) //this means this is their final resting place
	    act("$n slides into the room.",ch,NULL,NULL,TO_ROOM);
	  is_sliding = FALSE;
	  //return;
	}
      // Move a group if ch was the group leader. 4/14/99 Mathew
      mount_reset = 0;
      fch_mount_next = NULL;
      for (fch = in_room->people; fch != NULL; fch = fch_next)
	{

	  // Mathew 4/14/99: Skip mounts with riders. They are moved with the
	  // rider.
	  // Mathew 7/6/99: Fix mount problem
	  if (mount_reset)
	    {
	      mount_reset = 0;      // Reset the flag.
	      fch = fch_mount_next;
	    }
	  if (fch != NULL)
	    {
	      fch_next = fch->next_in_room;
	    }

            else
              {
                fch_next = NULL;      // Mathew 7/6/99: Skip NULL fch's due to mount resets
                continue;
              }
	  if (fch->master == ch && IS_AFFECTED (fch, AFF_CHARM)
	      && fch->position < POS_STANDING)
	    do_stand (fch, "");
	  if ((fch->master == ch || fch->stalking == ch)
                && fch->position >= POS_STANDING && fch->position < POS_FEIGNING_DEATH && fch->in_room != ch->in_room)
	    {
	      if (IS_SET (ch->in_room->room_flags, ROOM_LAW)
		  && (IS_NPC (fch) && is_aggro (fch)))
		{
		  act ("You can't bring $N into the city.", ch, NULL, fch,
		       TO_CHAR);
		  act ("You aren't allowed in the city.", fch, NULL, NULL,
		       TO_CHAR);

		  continue;
		}

	      //5-10-03 Iblis - Check to remove camoflauge/hide if following someone
	      if (IS_AFFECTED (fch, AFF_CAMOUFLAGE))
		REMOVE_BIT (fch->affected_by, AFF_CAMOUFLAGE);
	      if (IS_AFFECTED (fch, AFF_HIDE))
		REMOVE_BIT (fch->affected_by, AFF_HIDE);
	      act ("You follow $N.", fch, NULL, ch, TO_CHAR);
	      if (fch_next != NULL && fch->mount != NULL)
		{
		  mount_reset++;    // Mathew 7/6/99: Reset to top person in
		  // old room if a rider and a mount move.
		  if (fch->next_in_room != NULL
		      && fch->next_in_room == fch->mount)
		    {
		      fch_mount_next = fch->mount->next_in_room;    // Skip the mount.
		    }

                    else
                      {
                        fch_mount_next = fch->next_in_room;   // Preserve old list.
                      }
		}
	      move_char (fch, door, TRUE);
	    }
	}
      return;
    }


  /* Move Aggie Mobs */
  for (fch = in_room->people; fch != NULL; fch = fch->next_in_room)
    {
      if (IS_NPC (fch) && is_hunting (fch, ch) && !IS_IMMORTAL (ch)
          && get_position(fch) > POS_SLEEPING && (IS_SET (fch->act, ACT_HUNT)
						  || IS_SET (fch->act,
							     ACT_SMART_HUNT))
          && can_see (fch, ch)
          && number_percent () < 55 && fch->in_room->exit[door] != NULL
          && !is_campsite (fch->in_room->exit[door]->u1.to_room)
          && !IS_SET (fch->in_room->exit[door]->u1.to_room->room_flags,
                      ROOM_NO_MOB))
        {
          if (fch->position < POS_STANDING)
            do_stand (fch, "");
          WAIT_STATE (fch, 1 * PULSE_VIOLENCE);
          act ("You hunt $N", fch, NULL, ch, TO_CHAR);
          move_char (fch, door, TRUE);
        }
    }


  trap_check(ch,"room",ch->in_room,NULL);  
  trip_triggers(ch, OBJ_TRIG_ENTER_ROOM, NULL, NULL, OT_SPEC_NONE);
  sprintf(tcbuf,"%d",ch->in_room->vnum);
  trip_triggers_arg(ch, OBJ_TRIG_CHAR_TO_ROOM, NULL, NULL, OT_SPEC_NONE,tcbuf);
  
  if (HAS_SCRIPT (ch))
    {
      TRIGGER_DATA *pTrig;
      for (pTrig = ch->triggers; pTrig != NULL; pTrig = pTrig->next)
	{
	  if (pTrig->trigger_type == TRIG_MOVES
	      && pTrig->current == NULL && !IS_SET (ch->act, ACT_HALT))
	    {
	      act_trigger (ch, pTrig->name, NULL, NAME (ch), NULL);
	      pTrig->bits = SCRIPT_ADVANCE;
	      pTrig->current = pTrig->script;
	    }
	}
    }
  for (fch = ch->in_room->people; fch != NULL; fch = fch_next)
    {

      CHAR_DATA *bitch;
      fch_next = fch->next_in_room;
      if (!IS_NPC (ch) && IS_NPC (fch) && fch->level >= 60
	  && number_range (0, 35) == 0
	  && fch->spec_fun == spec_lookup ("spec_cast_cleric"))
	{
	  for (bitch = fch->in_room->people; bitch != NULL;
	       bitch = bitch->next_in_room)
	    {
	      if (is_same_group (bitch, fch) || bitch == fch)
		{
		  int sn;
		  if ((sn = skill_lookup ("sanctuary")) >= 0)
		    (*skill_table[sn].spell_fun)
		      (sn, fch->level, fch, bitch, TARGET_CHAR);
		  break;
		}
	    }
	}
      if (!IS_NPC (ch) && IS_NPC (fch) && number_range (0, 13) == 0
	  && fch->spec_fun == spec_lookup ("spec_cast_mage"))
	{
	  int sn;
	  if ((sn = skill_lookup ("armor")) >= 0)
	    (*skill_table[sn].spell_fun)
	      (sn, fch->level, fch, fch, TARGET_CHAR);
	}
      if (!IS_NPC (ch) && IS_NPC (fch) && number_range (0, 20) == 0
	  && fch->spec_fun == spec_lookup ("spec_cast_mage"))
	{
	  int sn;
	  if ((sn = gsn_fireshield) >= 0)
	    (*skill_table[sn].spell_fun)
	      (sn, fch->level, fch, fch, TARGET_CHAR);
	}
      // Check for Aggie Mob attack. Mathew 4/14/99
      if (IS_NPC (fch) && (IS_SET (fch->act, ACT_HUNT)
			   || IS_SET (fch->act, ACT_REMEMBER)
			   || IS_SET (fch->act, ACT_SMART_HUNT))
	  && is_hunting (fch, ch) && can_see (fch, ch)
	  && !IS_AFFECTED (ch, AFF_CAMOUFLAGE) && !IS_IMMORTAL (ch)
	  && get_position(fch) > POS_SLEEPING)
	{
	  if (fch->position < POS_STANDING)
	    do_stand (fch, "");
	  do_kill (fch, NAME (ch));
	}
      if (IS_NPC (ch)
	  && (IS_SET (ch->act, ACT_HUNT)
	      || IS_SET (ch->act, ACT_REMEMBER)
	      || IS_SET (ch->act, ACT_SMART_HUNT)) && is_hunting (ch, fch)
	  && !IS_AFFECTED (fch, AFF_CAMOUFLAGE) && !IS_IMMORTAL (fch)
	  && can_see (ch, fch) &&  get_position(ch) > POS_SLEEPING)
	{
	  if (ch->position < POS_STANDING)
	    do_stand (ch, "");
	  do_kill (ch, NAME (fch));
	}
    }
  if (ch->mount != NULL)
    {
      int chknum;
      if (!IS_NPC (ch))
	chknum = get_skill (ch, gsn_riding) + 5;

      else
	chknum = 99;
      if (number_percent () < chknum)
	{
	  check_improve (ch, gsn_riding, TRUE, 7);
	}

      else
	{
	  char tcbuf[MAX_STRING_LENGTH];
	  sprintf (tcbuf,
		   "You fall off of %s, landing hard on the ground.\n\r",
		   ch->mount->short_descr);
	  send_to_char (tcbuf, ch);
	  sprintf (tcbuf,
		   "$n falls off of %s, landing hard on the ground.",
		   ch->mount->short_descr);
	  act (tcbuf, ch, NULL, NULL, TO_ROOM);
	  ch->position = POS_SITTING;
	  WAIT_STATE (ch, 1 * PULSE_VIOLENCE);
	  ch->mount->riders = NULL;
	  ch->mount = NULL;
	}
    }
//Minax 7-10-02 Check for a tripwire in the room.
  for (tObj = ch->in_room->contents; tObj; tObj = tObj->next_content)
    {
      if (tObj->pIndexData->vnum == OBJ_VNUM_TRIPWIRE
	  && ch->level < 92 && !IS_NPC (ch))
	{
	  if ((number_percent () / 2) > get_curr_stat (ch, STAT_INT)
	      && ch->position > POS_RESTING)
	    {
	      if (ch->mount != NULL)
		{
		  sprintf (tcbuf,
			   "%s trips over $p and $n falls off, landing flat on $s face.",
			   ch->mount->short_descr);
		  act (tcbuf, ch, tObj, NULL, TO_ROOM);
		  sprintf (tcbuf,
			   "%s trips over $p and you falls off, landing flat on your face.",
			   ch->mount->short_descr);
		  act (tcbuf, ch, tObj, NULL, TO_CHAR);
		  ch->mount->riders = NULL;
		  ch->mount = NULL;
		  ch->position = POS_RESTING;
		}

	      else
		{
		  sprintf (tcbuf,
			   "You trip over $p and fall flat on your face!");
		  act (tcbuf, ch, tObj, NULL, TO_CHAR);
		  sprintf (tcbuf,
			   "$n trips over $p and falls flat on $s face!");
		  act (tcbuf, ch, tObj, NULL, TO_ROOM);
		  ch->position = POS_RESTING;
		}
	      WAIT_STATE (ch, 1 * PULSE_VIOLENCE);
	      if (number_percent () < (ch->level / 3))
		{
		  sprintf (tcbuf,
			   "$p is ripped out of the ground and destroyed.");
		  act (tcbuf, ch, tObj, NULL, TO_CHAR);
		  sprintf (tcbuf,
			   "$p tripwire is ripped out of the ground and destroyed.");
		  act (tcbuf, ch, tObj, NULL, TO_ROOM);
		  extract_obj (tObj);
		}
	    }
	}
    }
  if (IS_SET (to_room->room_flags, ROOM_SPECTATOR))
    {
      if (IS_IMMORTAL (ch))
	send_to_char ("The usher politely welcomes you.\n\r", ch);

      else
	send_to_char
	  ("The usher rudely grabs your ticket, ripping it in half.\n\r", ch);
    }
  if (in_room == to_room)	// no circular follows
  {
    if (!no_check_skeletal)
    {
    	check_aggression(ch);
    	check_skeletal_mutation(ch,FALSE);
    }
    return;
  }

  // Move a group if ch was the group leader. 4/14/99 Mathew
  mount_reset = 0;
  fch_mount_next = NULL;
  for (fch = in_room->people; fch != NULL; fch = fch_next)
    {

      // Mathew 4/14/99: Skip mounts with riders. They are moved with the
      // rider.
      // Mathew 7/6/99: Fix mount problem
      if (mount_reset)
	{
	  mount_reset = 0;	// Reset the flag.
	  fch = fch_mount_next;
	}
      if (fch != NULL)
	{
	  fch_next = fch->next_in_room;
	}

      else
	{
	  fch_next = NULL;	// Mathew 7/6/99: Skip NULL fch's due to mount resets
	  continue;
	}
      if (fch->master == ch && IS_AFFECTED (fch, AFF_CHARM)
	  && fch->position < POS_STANDING)
	do_stand (fch, "");
      if ((fch->master == ch || fch->stalking == ch)
	  && fch->position >= POS_STANDING && fch->position < POS_FEIGNING_DEATH && fch->in_room != ch->in_room)
	{
	  if (IS_SET (ch->in_room->room_flags, ROOM_LAW)
	      && (IS_NPC (fch) && is_aggro (fch)))
	    {
	      act ("You can't bring $N into the city.", ch, NULL, fch,
		   TO_CHAR);
	      act ("You aren't allowed in the city.", fch, NULL, NULL,
		   TO_CHAR);
	      continue;
	    }
	  //5-10-03 Iblis - Check to remove camoflauge/hide if following someone
	  if (IS_AFFECTED (fch, AFF_CAMOUFLAGE))
	    REMOVE_BIT (fch->affected_by, AFF_CAMOUFLAGE);
	  if (IS_AFFECTED (fch, AFF_HIDE))
	    REMOVE_BIT (fch->affected_by, AFF_HIDE);
	  act ("You follow $N.", fch, NULL, ch, TO_CHAR);
	  if (fch_next != NULL && fch->mount != NULL)
	    {
	      mount_reset++;	// Mathew 7/6/99: Reset to top person in
	      // old room if a rider and a mount move.
	      if (fch->next_in_room != NULL
		  && fch->next_in_room == fch->mount)
		{
		  fch_mount_next = fch->mount->next_in_room;	// Skip the mount.
		}

	      else
		{
		  fch_mount_next = fch->next_in_room;	// Preserve old list.
		}
	    }
	  move_char (fch, door, TRUE);
	}
    }
  if (ch->tracking[0] != '\0')
    display_track (ch);
  if (!IS_SET (ch->comm, COMM_NOINFO))
    {
      if (in_room && to_room && in_room->area != to_room->area)
      {
         if (to_room->area->llev > ch->level)
         {
           send_to_char("`iWarning : `bThis area is OOL for you`i!!!``\n\r",ch);
         }
      }
    }
  if (!no_check_skeletal)
  {
  	check_aggression(ch);
        check_skeletal_mutation(ch,FALSE);
  }
}

void do_mount (CHAR_DATA * ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  char tcbuf[MAX_STRING_LENGTH];
  CHAR_DATA *mount;
  int chknum;
  one_argument (argument, arg);
  if (arg[0] == '\0')
    {
      send_to_char ("Mount what?\n\r", ch);
      return;
    }
  if ((mount = get_char_room (ch, arg)) == NULL)
    {
      send_to_char ("They aren't here.\n\r", ch);
      return;
    }
  if (ch->race == PC_RACE_NERIX)
  {
    send_to_char("You cannot ride or mount.\n\r",ch);
    return;
  }
  if (!IS_NPC (mount))
    {
      send_to_char ("You can't mount players.\n\r", ch);
      return;
    }
  if (!IS_SET (mount->act, ACT_MOUNT))
    {
      send_to_char ("Sorry, that mobile isn't mountable.\n\r", ch);
      return;
    }
  if (mount->position == POS_TETHERED)
    {
      send_to_char
	("You must untether that creature before you can mount it.\n\r", ch);
      return;
    }
  if (mount->level - 8 > ch->level)
    {
      send_to_char
	("Sorry, that mount is too powerful for you to handle.\n\r", ch);
      return;
    }
  if (ch->mount != NULL || ch->position == POS_MOUNTED)
    {
      send_to_char ("You are already riding a mount.\n\r", ch);
      return;
    }
  if (mount->riders != NULL)
    {
      send_to_char ("Sorry, someone is already riding that mobile.\n\r", ch);
      return;
    }
  if (mount->mounter != NULL && mount->mounter != ch)
    {
      send_to_char ("Sorry, that mount belongs to someone else.\n\r", ch);
      return;
    }
  if (mount->afkmsg != NULL && mount->afkmsg[0] != '\0'
      && str_cmp (mount->afkmsg, ch->name))
    {
      send_to_char ("Sorry, that mount belongs to someone else.\n\r", ch);
      return;
    }
  if (mount->position != POS_STANDING && mount->position != POS_FIGHTING)
    {
      sprintf (tcbuf,
	       "Sorry, you'll have to get %s to stand before you can mount it.\n\r",
	       mount->short_descr);
      send_to_char (tcbuf, ch);
      return;
    }
  if (get_char_weight (ch) > mount->pIndexData->max_weight)
    {
      sprintf (tcbuf,
	       "You're too damn heavy, you'll break %s's back!\n\r",
	       mount->short_descr);
      send_to_char (tcbuf, ch);
      return;
    }
  if (!IS_NPC (ch))
    chknum = get_skill (ch, gsn_riding);

  else
    chknum = 98;
  if (number_percent () < chknum)
    {
      sprintf (tcbuf, "You skillfully mount %s.\n\r", mount->short_descr);
      send_to_char (tcbuf, ch);
      sprintf (tcbuf, "$n skillfully mounts %s.", mount->short_descr);
      act (tcbuf, ch, NULL, NULL, TO_ROOM);
      check_improve (ch, gsn_riding, TRUE, 1);
      new_master (ch, mount);
      ch->position = POS_MOUNTED;
    }

  else
    {
      sprintf (tcbuf,
	       "You attempt to mount %s, but fall to the ground.\n\r",
	       mount->short_descr);
      send_to_char (tcbuf, ch);
      sprintf (tcbuf,
	       "$n attempts to mount %s, but falls to the ground.",
	       mount->short_descr);
      act (tcbuf, ch, NULL, NULL, TO_ROOM);
      ch->position = POS_SITTING;
      check_improve (ch, gsn_riding, FALSE, 1);
    }
}
void do_tether (CHAR_DATA * ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  char tcbuf[MAX_STRING_LENGTH];
  CHAR_DATA *mount;
  one_argument (argument, arg);
  if (arg[0] == '\0')
    {
      send_to_char ("Tether what?\n\r", ch);
      return;
    }
  if ((mount = get_char_room (ch, arg)) == NULL)
    {
      send_to_char ("They aren't here.\n\r", ch);
      return;
    }
  if (!IS_NPC (mount))
    {
      send_to_char ("You can't tether players.\n\r", ch);
      return;
    }
  if (!IS_SET (mount->act, ACT_MOUNT))
    {
      send_to_char ("Sorry, that mobile cannot be tethered.\n\r", ch);
      return;
    }
  if (mount->riders != NULL)
    {
      send_to_char ("Sorry, someone is riding that mobile.\n\r", ch);
      return;
    }
  if (mount->afkmsg != NULL && mount->afkmsg[0] != '\0'
      && str_cmp (mount->afkmsg, ch->name))
    {
      send_to_char ("Sorry, that mount belongs to someone else.\n\r", ch);
      return;
    }
  if (get_position(mount) == POS_SLEEPING)
    {
      sprintf (tcbuf, "%s must be awake before you can tether it.\n\r",
	       mount->short_descr);
      send_to_char (tcbuf, ch);
      return;
    }
  sprintf (tcbuf, "You tether %s.\n\r", mount->short_descr);
  send_to_char (tcbuf, ch);
  sprintf (tcbuf, "$n tethers %s.", mount->short_descr);
  act (tcbuf, ch, NULL, NULL, TO_ROOM);
  mount->mounter = NULL;
  mount->leader = NULL;
  mount->position = POS_TETHERED;
}

void do_untether (CHAR_DATA * ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  char tcbuf[MAX_STRING_LENGTH];
  CHAR_DATA *mount;
  one_argument (argument, arg);
  if (arg[0] == '\0')
    {
      send_to_char ("Untether what?\n\r", ch);
      return;
    }
  if ((mount = get_char_room (ch, arg)) == NULL)
    {
      send_to_char ("They aren't here.\n\r", ch);
      return;
    }
  if (mount->position != POS_TETHERED)
    {
      send_to_char ("That mobile is not tethered.\n\r", ch);
      return;
    }
  if (mount->afkmsg != NULL && mount->afkmsg[0] != '\0'
      && str_cmp (mount->afkmsg, ch->name))
    {
      send_to_char ("Sorry, that mount belongs to someone else.\n\r", ch);
      return;
    }
  mount->position = POS_STANDING;
  sprintf (tcbuf, "You untether %s.\n\r", mount->short_descr);
  send_to_char (tcbuf, ch);
  sprintf (tcbuf, "$n untethers %s.", mount->short_descr);
  act (tcbuf, ch, NULL, NULL, TO_ROOM);
  mount->leader = ch;
  mount->mounter = ch;
}

void new_master (CHAR_DATA * ch, CHAR_DATA * mount)
{
  ch->mount = mount;
  mount->riders = ch;
  mount->leader = ch;
  mount->mounter = ch;
  mount->master = ch;
}

void do_stable (CHAR_DATA * ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  char tcbuf[MAX_STRING_LENGTH];
  CHAR_DATA *keeper, *mount;
  if (IS_NPC (ch))
    return;
  one_argument (argument, arg);
  if (!IS_SET (ch->in_room->room_flags, ROOM_STABLE))
    {
      send_to_char ("But this isn't a stable!\n\r", ch);
      return;
    }
  if ((keeper = find_keeper (ch)) == NULL)
    {
      send_to_char
	("The stable keeper seems to have stepped out for a bit.\n\r", ch);
      return;
    }
  if ((mount = get_char_room (ch, arg)) == NULL)
    {
      send_to_char ("That mobile is not here.\n\r", ch);
      return;
    }
  if (!IS_SET (mount->act, ACT_MOUNT) || mount->mounter != ch)
    {
      send_to_char ("That mobile is not yours to board.\n\r", ch);
      return;
    }
  if (mount->riders != NULL)
    {
      send_to_char ("You might want to dismount that mobile first.\n\r", ch);
      return;
    }
  mount->wiznet = time (NULL);
  mount->next_in_board = ch->pcdata->boarded;
  mount->lines = ch->in_room->vnum;
  mount->leader = NULL;
  ch->pcdata->boarded = mount;
  ch->mount = NULL;
  char_from_room (mount);
  char_to_room (mount, get_room_index (ROOM_VNUM_SLIMBO));
  sprintf (tcbuf,
	   "The stablekeeper takes %s and leads it back into the stalls.\n\r",
	   mount->short_descr);
  send_to_char (tcbuf, ch);
}

void do_retrieve (CHAR_DATA * ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  char tcbuf[MAX_STRING_LENGTH];
  CHAR_DATA *keeper, *mount, *prev_mount = NULL;
  bool found = FALSE;
  if (IS_NPC (ch))
    return;
  one_argument (argument, arg);
  if (!IS_SET (ch->in_room->room_flags, ROOM_STABLE))
    {
      send_to_char ("But this isn't a stable!\n\r", ch);
      return;
    }
  if ((keeper = find_keeper (ch)) == NULL)
    {
      send_to_char
	("The stable keeper seems to have stepped out for a bit.\n\r", ch);
      return;
    }
  for (mount = ch->pcdata->boarded; mount != NULL;
       mount = mount->next_in_board)
    {
      if (mount->lines == ch->in_room->vnum && is_name (arg, mount->name))
	{
	  int price = UMAX ((time (NULL) - mount->wiznet) / 86400, 1)
	    * mount->level * 40;
	  if ((ch->silver + 100 * ch->gold) < price)
	    {
	      send_to_char
		("The stablekeeper says 'You can't afford to retrieve your mount right now'.\n\r",
		 ch);
	      return;
	    }
	  deduct_cost (ch, price);
	  sprintf (tcbuf,
		   "The stablekeeper goes to the stalls, and leads %s out for you.\n\r",
		   mount->short_descr);
	  send_to_char (tcbuf, ch);
	  found = TRUE;
	  if (prev_mount != NULL)
	    prev_mount->next_in_board = mount->next_in_board;

	  else
	    ch->pcdata->boarded = ch->pcdata->boarded->next_in_board;
	  char_from_room (mount);
	  char_to_room (mount, ch->in_room);
	  break;
	}
      prev_mount = mount;
    }
  if (!found)
    send_to_char ("No such mount has been boarded here.\n\r", ch);
}

void do_tame (CHAR_DATA * ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  char tcbuf[MAX_STRING_LENGTH];
  CHAR_DATA *victim;
  if (IS_NPC (ch))
    return;
  one_argument (argument, arg);
  if (arg[0] == '\0')
    {
      send_to_char ("Tame what?\n\r", ch);
      return;
    }
  if ((victim = get_char_room (ch, arg)) == NULL)
    {
      send_to_char ("They aren't here.\n\r", ch);
      return;
    }
  if (!IS_NPC (victim))
    {
      send_to_char ("You can't tame players.\n\r", ch);
      return;
    }
  if (IS_SET (victim->act, ACT_MOUNT))
    {
      send_to_char ("That mount is already tamed.\n\r", ch);
      return;
    }
  if (!IS_SET (victim->act, ACT_TAME))
    {
      send_to_char ("You may not tame this target.\n\r", ch);
      return;
    }
  if (check_shopkeeper_attack (ch, victim))
    return;
  if (IS_NPC (victim) && (IS_SET (victim->act, ACT_TRAIN)
			  || IS_SET (victim->act, ACT_PRACTICE)
			  || IS_SET (victim->act, ACT_IS_HEALER)))
    {
      send_to_char ("I don't think so.\n\r", ch);
      return;
    }
  if (IS_AFFECTED (victim, AFF_CHARM))
    {
      if (victim->master == ch)
	send_to_char ("That mobile is currently your pet.\n\r", ch);

      else
	send_to_char ("That mobile is someone else's pet.\n\r", ch);
      return;
    }
  sprintf (tcbuf, "You attempt to tame %s.", victim->short_descr);
  act (tcbuf, ch, NULL, victim, TO_CHAR);
  sprintf (tcbuf, "$n attempts to tame %s.", victim->short_descr);
  act (tcbuf, ch, NULL, victim, TO_ROOM);
  if (get_skill (ch, gsn_tame) == 0)
    {
      if (number_percent () < 75)
	{
	  sprintf (tcbuf, "%s eyes you warily and backs away.",
		   fcapitalize (victim->short_descr));
	  act (tcbuf, ch, NULL, victim, TO_CHAR);
	  sprintf (tcbuf, "%s eyes $n warily and backs away.",
		   fcapitalize (victim->short_descr));
	  act (tcbuf, ch, NULL, victim, TO_ROOM);
	  if (number_percent () < 50)
	    {
	      int attempt;
	      for (attempt = 0; attempt < 6; attempt++)
		{
		  EXIT_DATA *pexit;
		  int door;
		  door = number_door ();
		  if ((pexit = victim->in_room->exit[door]) == 0
		      || pexit->u1.to_room == NULL
		      || IS_SET (pexit->exit_info, EX_CLOSED)
		      || number_range (0, victim->daze) != 0
		      || (IS_NPC (ch) &&
			  (IS_SET
			   (pexit->u1.to_room->room_flags,
			    ROOM_NO_MOB) || is_campsite (pexit->u1.
							 to_room))
			  && !IS_SET (ch->act, ACT_SMART_HUNT)))
		    continue;
		  move_char (victim, door, TRUE);
		}
	    }
	  return;
	}

      else
	{
	  sprintf (tcbuf, "%s becomes agitated and attacks.",
		   capitalize (victim->short_descr));
	  act (tcbuf, victim, NULL, NULL, TO_ROOM);

	  /*      set_fighting(victim, ch); */
	  multi_hit (victim, ch, TYPE_UNDEFINED);
	  return;
	}
    }
  if (number_percent () < get_skill (ch, gsn_tame)
      && victim->level <= ch->level)
    {
      if (number_percent () < 20)
	{
	  sprintf (tcbuf, "%s takes a liking to you.\n\r",
		   capitalize (victim->short_descr));
	  send_to_char (tcbuf, ch);
	  sprintf (tcbuf, "%s takes a liking to $n.",
		   capitalize (victim->short_descr));
	  act (tcbuf, ch, NULL, victim, TO_ROOM);
	  check_improve (ch, gsn_tame, TRUE, 1);
	  victim->master = ch;
	  victim->mounter = ch;
	  return;
	}

      else
	{
	  REMOVE_BIT (victim->act, ACT_AGGRESSIVE);
	  SET_BIT (victim->act, ACT_MOUNT);
	  sprintf (tcbuf, "You tame %s.\n\r", victim->short_descr);
	  send_to_char (tcbuf, ch);
	  sprintf (tcbuf, "$n tames %s.", victim->short_descr);
	  act (tcbuf, ch, NULL, NULL, TO_ROOM);
	  victim->master = ch;
	  victim->mounter = ch;
	  return;
	}
    }

  else
    {
      if (number_percent () < 75)
	{
	  sprintf (tcbuf, "%s eyes you warily and backs away.",
		   fcapitalize (victim->short_descr));
	  act (tcbuf, ch, NULL, victim, TO_CHAR);
	  sprintf (tcbuf, "%s eyes $n warily and backs away.",
		   fcapitalize (victim->short_descr));
	  act (tcbuf, ch, NULL, victim, TO_ROOM);
	  if (number_percent () < 50)
	    {
	      int attempt;
	      for (attempt = 0; attempt < 6; attempt++)
		{
		  EXIT_DATA *pexit;
		  int door;
		  door = number_door ();
		  if ((pexit = victim->in_room->exit[door]) == 0
		      || pexit->u1.to_room == NULL
		      || IS_SET (pexit->exit_info, EX_CLOSED)
		      || number_range (0, victim->daze) != 0
		      || (IS_NPC (ch)
			  &&
			  ((IS_SET
			    (pexit->u1.to_room->room_flags,
			     ROOM_NO_MOB) || is_campsite (pexit->u1.
							  to_room))
			   && !IS_SET (ch->act, ACT_SMART_HUNT))))
		    continue;
		  move_char (victim, door, TRUE);
		}
	    }
	}

      else
	{
	  sprintf (tcbuf, "%s becomes agitated and attacks.",
		   capitalize (victim->short_descr));
	  act (tcbuf, victim, NULL, NULL, TO_ROOM);
	  set_fighting (victim, ch);
	}
      check_improve (ch, gsn_tame, FALSE, 1);
    }
}
void do_dismount (CHAR_DATA * ch, char *argument)
{
  char tcbuf[MAX_STRING_LENGTH];
  if (ch->mount == NULL)
    {
      send_to_char ("You don't currently have a mount.\n\r", ch);
      return;
    }
  sprintf (tcbuf, "You dismount from %s.\n\r", ch->mount->short_descr);
  send_to_char (tcbuf, ch);
  sprintf (tcbuf, "$n dismounts %s.", ch->mount->short_descr);
  act (tcbuf, ch, NULL, NULL, TO_ROOM);
  ch->mount->riders = NULL;
  ch->mount = NULL;
  if (ch->fighting != NULL)
    {
      ch->position = POS_FIGHTING;
    }

  else
    {
      ch->position = POS_STANDING;
    }
}
void do_speedwalk (CHAR_DATA * ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  char revarg[MAX_INPUT_LENGTH];
  char dirstr[2];
  int xcnt, ycnt;
  if (IS_NPC (ch))
    {
      send_to_char ("Mobiles can not speedwalk.\n\r", ch);
      return;
    }
  argument = one_argument (argument, arg);
  if (arg[0] == '\0')
    {
      send_to_char ("Which way(s) do you want to go?\n\r", ch);
      return;
    }

  for (xcnt = strlen (arg) - 1, ycnt = 0; xcnt > -1; xcnt--, ycnt++)
    {
      switch (arg[xcnt])
	{
	default:
	  send_to_char ("Directional string not understood.\n\r", ch);
	  return;
	case 'n':
	case 'N':
	case 's':
	case 'S':
	case 'e':
	case 'E':
	case 'w':
	case 'W':
	case 'd':
	case 'D':
	case 'u':
	case 'U':
	  break;
	}
      revarg[ycnt] = arg[xcnt];
    }
  dirstr[1] = '\0';
  dirstr[0] = revarg[ycnt - 1];
  interpret (ch, dirstr);
  revarg[ycnt - 1] = '\0';
  if (revarg[0] != '\0')
    {
      free_string (ch->pcdata->speedwalk);
      ch->pcdata->speedwalk = str_dup (revarg);
      ch->pcdata->speedlen = strlen (revarg);
    }
}
void do_gallop (CHAR_DATA * ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  char revarg[MAX_INPUT_LENGTH];
  char dirstr[2];
  int xcnt, ycnt;
  if (IS_NPC (ch))
    {
      send_to_char ("Mobiles can not gallop.\n\r", ch);
      return;
    }
  argument = one_argument (argument, arg);
  if (arg[0] == '\0')
    {
      send_to_char ("Which way(s) do you want to gallop?\n\r", ch);
      return;
    }
  if (ch->mount == NULL)
    {
      send_to_char ("You must have a mount to gallop.\n\r", ch);
      return;
    }
  for (xcnt = strlen (arg) - 1, ycnt = 0; xcnt > -1; xcnt--, ycnt++)
    {
      switch (arg[xcnt])
	{
	default:
	  send_to_char ("Gallop string not understood.\n\r", ch);
	  return;
	case 'n':
	case 'N':
	case 's':
	case 'S':
	case 'e':
	case 'E':
	case 'w':
	case 'W':
	case 'd':
	case 'D':
	case 'u':
	case 'U':
	  break;
	}
      revarg[ycnt] = arg[xcnt];
    }
  dirstr[1] = '\0';
  dirstr[0] = revarg[ycnt - 1];
  interpret (ch, dirstr);
  revarg[ycnt - 1] = '\0';
  if (revarg[0] != '\0')
    {
      free_string (ch->pcdata->speedwalk);
      ch->pcdata->speedwalk = str_dup (revarg);
      ch->pcdata->speedlen = strlen (revarg);
    }
}
void do_north (CHAR_DATA * ch, char *argument)
{
  if (ch->position > POS_FIGHTING && ch->position < POS_FEIGNING_DEATH && ch->fighting == NULL)
    move_char (ch, DIR_NORTH, FALSE);
  return;
}

void do_east (CHAR_DATA * ch, char *argument)
{

  //IBLIS 6/28/03 - Yes a VERY VERY CHEAP fix to stop people from going back into the safe rooms
  //near the altar during BR..so sue me, its late and this works
  if (!(battle_royale && (ch->level > 19 || (!IS_NPC(ch) && ch->pcdata->loner)))
      || (ch->in_room != NULL && ch->in_room->vnum != 4149
	  && ch->in_room->vnum != 4405 && ch->in_room->vnum != 4406
	  && ch->in_room->vnum != 4404))
    {
      if (ch->position > POS_FIGHTING && ch->fighting == NULL && ch->position < POS_FEIGNING_DEATH)
	move_char (ch, DIR_EAST, FALSE);

      else if (ch->in_room != NULL)
	{
	  send_to_char ("You can't go back there now.\r\n", ch);
	}
    }
  return;
}

void do_south (CHAR_DATA * ch, char *argument)
{
  if (ch->position > POS_FIGHTING && ch->fighting == NULL  && ch->position < POS_FEIGNING_DEATH)
    move_char (ch, DIR_SOUTH, FALSE);
  return;
}

void do_west (CHAR_DATA * ch, char *argument)
{
  if (ch->position > POS_FIGHTING && ch->fighting == NULL  && ch->position < POS_FEIGNING_DEATH)
    move_char (ch, DIR_WEST, FALSE);
  return;
}

void do_up (CHAR_DATA * ch, char *argument)
{
  if (ch->position > POS_FIGHTING && ch->fighting == NULL  && ch->position < POS_FEIGNING_DEATH)
    move_char (ch, DIR_UP, FALSE);
  return;
}

void do_down (CHAR_DATA * ch, char *argument)
{
  if (ch->position > POS_FIGHTING && ch->fighting == NULL  && ch->position < POS_FEIGNING_DEATH)
    move_char (ch, DIR_DOWN, FALSE);
  return;
}

void do_doorbash (CHAR_DATA * ch, char *argument)
{
  char door_name[MAX_INPUT_LENGTH];
  EXIT_DATA *pexit = NULL;
  short x, door = 0, chance;
  CHAR_DATA *vch;
  OBJ_DATA *obj;
  one_argument (argument, door_name);
  if (door_name[0] == '\0')
    {
      send_to_char ("Bash which door?\n\r", ch);
      return;
    }
  if (!str_cmp (door_name, "n") || !str_cmp (door_name, "north"))
    {
      door = 0;
      pexit = ch->in_room->exit[0];
    }

  else if (!str_cmp (door_name, "e") || !str_cmp (door_name, "east"))
    {
      door = 1;
      pexit = ch->in_room->exit[1];
    }

  else if (!str_cmp (door_name, "s") || !str_cmp (door_name, "south"))
    {
      door = 2;
      pexit = ch->in_room->exit[2];
    }

  else if (!str_cmp (door_name, "w") || !str_cmp (door_name, "west"))
    {
      door = 3;
      pexit = ch->in_room->exit[3];
    }

  else if (!str_cmp (door_name, "u") || !str_cmp (door_name, "up"))
    {
      door = 4;
      pexit = ch->in_room->exit[4];
    }

  else if (!str_cmp (door_name, "d") || !str_cmp (door_name, "down"))
    {
      door = 5;
      pexit = ch->in_room->exit[5];
    }
  if (pexit == NULL)
    for (x = 0; x < MAX_DIR; x++)
      if (ch->in_room->exit[x] != NULL
	  && ch->in_room->exit[x]->keyword != NULL
	  && ch->in_room->exit[x]->keyword[0] != '\0')
	if (!str_cmp (ch->in_room->exit[x]->keyword, door_name))
	  {
	    door = x;
	    pexit = ch->in_room->exit[x];
	    break;
	  }
  chance = get_skill (ch, gsn_doorbash) - 24;
  if (pexit != NULL)
    {
      if (!IS_SET (pexit->rs_flags, EX_ISDOOR)
	  && !IS_SET (pexit->exit_info, EX_ISDOOR))
	{
	  send_to_char ("There isn't a door there.\n\r", ch);
	  return;
	}
      if (!IS_SET (pexit->exit_info, EX_CLOSED))
	{
	  if (pexit->keyword[0] == '\0')
	    send_to_char ("That door isn't closed.\n\r", ch);

	  else
	    act ("The $T isn't closed.", ch, NULL, pexit->keyword, TO_CHAR);
	  return;
	}
      if (IS_SET (pexit->rs_flags, EX_NOBASH)
	  || IS_SET (pexit->exit_info, EX_NOBASH)
	  || chance + get_curr_stat (ch, STAT_STR) < number_percent ())
	{
	  if (pexit->keyword[0] != '\0')
	    {
	      act ("You attempt to smash down the $T, but to no avail.",
		   ch, NULL, pexit->keyword, TO_CHAR);
	      act ("$n attempts to smash down the $T, but to no avail.",
		   ch, NULL, pexit->keyword, TO_ROOM);
	      if (pexit->u1.to_room !=
		  NULL && pexit->u1.to_room->exit[rev_dir[door]] !=
		  NULL && pexit->u1.to_room->exit[rev_dir[door]]->u1.
		  to_room == ch->in_room)
		for (vch = pexit->u1.to_room->people; vch;
		     vch = vch->next_in_room)
		  act ("You hear someone banging against the $T.",
		       vch, NULL, pexit->keyword, TO_CHAR);
	    }

	  else
	    {
	      act
		("You attempt to smash down the door $T from here, but to no avail.",
		 ch, NULL, dir_name[door], TO_CHAR);
	      act
		("$n attempts to smash down the door $T from here, but to no avail.",
		 ch, NULL, dir_name[door], TO_ROOM);
	      if (pexit->u1.to_room != NULL
		  && pexit->u1.to_room->exit[rev_dir[door]] != NULL
		  && pexit->u1.to_room->exit[rev_dir[door]]->u1.to_room ==
		  ch->in_room)
		for (vch = pexit->u1.to_room->people; vch;
		     vch = vch->next_in_room)
		  act
		    ("You hear someone banging against the door $T from here.",
		     vch, NULL, dir_name[rev_dir[door]], TO_CHAR);
	    }
	  check_improve (ch, gsn_doorbash, FALSE, 1);
	  return;
	}

      else
	{
	  REMOVE_BIT (pexit->exit_info, EX_ISDOOR);
	  REMOVE_BIT (pexit->exit_info, EX_CLOSED);
	  REMOVE_BIT (pexit->exit_info, EX_LOCKED);
	  SET_BIT (pexit->exit_info, EX_BASHED);
	  if (pexit->u1.to_room->exit[rev_dir[door]] != NULL)
	    {
	      REMOVE_BIT (pexit->u1.to_room->exit[rev_dir[door]]->
			  exit_info, EX_ISDOOR);
	      REMOVE_BIT (pexit->u1.to_room->exit[rev_dir[door]]->
			  exit_info, EX_CLOSED);
	      REMOVE_BIT (pexit->u1.to_room->exit[rev_dir[door]]->
			  exit_info, EX_LOCKED);
	      SET_BIT (pexit->u1.to_room->exit[rev_dir[door]]->exit_info,
		       EX_BASHED);
	    }
	  if (pexit->keyword[0] != '\0')
	    {
	      act ("Using your brute strength, you smash down the $T.",
		   ch, NULL, pexit->keyword, TO_CHAR);
	      act ("Using $s brute strength, $n smashes down the $T.",
		   ch, NULL, pexit->keyword, TO_ROOM);
	      if (pexit->u1.to_room !=
		  NULL && pexit->u1.to_room->exit[rev_dir[door]] !=
		  NULL && pexit->u1.to_room->exit[rev_dir[door]]->u1.
		  to_room == ch->in_room)
		for (vch = pexit->u1.to_room->people; vch;
		     vch = vch->next_in_room)
		  act ("The $T is smashed from the other side.", vch,
		       NULL, pexit->keyword, TO_CHAR);
	      if (get_eq_char (ch, WEAR_HEAD) == NULL)
		{
		  float hurts;
		  act
		    ("Your bare head smashes through the $T, causing a great deal of pain.",
		     ch, NULL, pexit->keyword, TO_CHAR);
		  hurts = ch->hit * 0.10;
		  damage_old (ch, ch, (int) hurts, 0, DAM_OTHER, FALSE);
		}
	    }

	  else
	    {
	      act
		("Using your brute strength, you smash down the door $T from here.",
		 ch, NULL, dir_name[door], TO_CHAR);
	      act
		("Using $s brute strength, $n smashes down the door $T from here.",
		 ch, NULL, dir_name[door], TO_ROOM);
	      if (pexit->u1.to_room != NULL
		  && pexit->u1.to_room->exit[rev_dir[door]] != NULL
		  && pexit->u1.to_room->exit[rev_dir[door]]->u1.to_room ==
		  ch->in_room)
		for (vch = pexit->u1.to_room->people; vch;
		     vch = vch->next_in_room)
		  act
		    ("The door $T from here is smashed from the other side.",
		     vch, NULL, dir_name[rev_dir[door]], TO_CHAR);
	      if (get_eq_char (ch, WEAR_HEAD) == NULL)
		{
		  float hurts;
		  act
		    ("Your bare head smashes through the door $T from here, causing you great pain.",
		     ch, NULL, dir_name[door], TO_CHAR);
		  hurts = ch->hit * 0.10;
		  damage_old (ch, ch, (int) hurts, 0, DAM_OTHER, FALSE);
		}
	    }
	  check_improve (ch, gsn_doorbash, TRUE, 1);
	  return;
	}
    }

  else
    {
      ROOM_INDEX_DATA *location;
      if ((obj = get_obj_here (ch, door_name)) == NULL)
	{
	  send_to_char ("You don't see that here.\n\r", ch);
	  return;
	}
      if (obj->item_type != ITEM_CTRANSPORT)
	{
	  send_to_char ("You can't bash that.\n\r", ch);
	  return;
	}
      if (!IS_SET (obj->value[5], CONT_CLOSED))
	{
	  act ("$p is not closed.", ch, obj, NULL, TO_CHAR);
	  return;
	}
      location = get_room_index (obj->value[2]);
      if (IS_SET (obj->value[5], CONT_NOBASH)
	  || chance + get_curr_stat (ch, STAT_STR) < number_percent ())
	{
	  act
	    ("You attempt to smash open the entrance to $p, but to no avail.",
	     ch, obj, NULL, TO_CHAR);
	  act
	    ("$n attempts to smash open the entrance to $p, but to no avail.",
	     ch, obj, NULL, TO_ROOM);
	  if (location != NULL)
	    for (vch = location->people; vch; vch = vch->next_in_room)
	      act ("You hear someone banging against the entrance to $p.",
		   vch, obj, NULL, TO_CHAR);
	}

      else
	{
	  REMOVE_BIT (obj->value[5], CONT_CLOSEABLE);
	  REMOVE_BIT (obj->value[5], CONT_CLOSED);
	  REMOVE_BIT (obj->value[5], CONT_LOCKED);
	  act ("You smash open the entrance to $p.", ch, obj, NULL, TO_CHAR);
	  act ("$n smashes open the entrance to $p.", ch, obj, NULL, TO_ROOM);
	  if (location != NULL)
	    for (vch = location->people; vch; vch = vch->next_in_room)
	      act ("Someone smashes open the entrance to $p.", vch,
		   obj, NULL, TO_CHAR);
	  if (get_eq_char (ch, WEAR_HEAD) == NULL)
	    {
	      float hurts;
	      act
		("Your bare head smashes through the entrance to $p, causing you great pain.",
		 ch, obj, NULL, TO_CHAR);
	      hurts = ch->hit * 0.10;
	      damage_old (ch, ch, (int) hurts, 0, DAM_OTHER, FALSE);
	    }
	}
      return;
    }
}
int find_door (CHAR_DATA * ch, char *arg)
{
  EXIT_DATA *pexit;
  int door;
  if (!str_cmp (arg, "n") || !str_cmp (arg, "north"))
    door = 0;

  else if (!str_cmp (arg, "e") || !str_cmp (arg, "east"))
    door = 1;

  else if (!str_cmp (arg, "s") || !str_cmp (arg, "south"))
    door = 2;

  else if (!str_cmp (arg, "w") || !str_cmp (arg, "west"))
    door = 3;

  else if (!str_cmp (arg, "u") || !str_cmp (arg, "up"))
    door = 4;

  else if (!str_cmp (arg, "d") || !str_cmp (arg, "down"))
    door = 5;

  else
    {
      for (door = 0; door <= 5; door++)
	{
	  if ((pexit = ch->in_room->exit[door]) != NULL
	      && IS_SET (pexit->exit_info, EX_ISDOOR)
	      && pexit->keyword != NULL && is_name (arg, pexit->keyword))
	    return door;
	}
      act ("You see no $T here.", ch, NULL, arg, TO_CHAR);
      return -1;
    }
  if ((pexit = ch->in_room->exit[door]) == NULL)
    {
      act ("You see no door $T here.", ch, NULL, arg, TO_CHAR);
      return -1;
    }
  if (!IS_SET (pexit->exit_info, EX_ISDOOR))
    {
      send_to_char ("You can't do that.\n\r", ch);
      return -1;
    }
  return door;
}

void do_coax (CHAR_DATA * ch, char *argument)
{
  char cmd[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
  char mount_name[MAX_INPUT_LENGTH];
  CHAR_DATA *mnt;
  argument = one_argument (argument, mount_name);
  argument = one_argument (argument, cmd);
  if (mount_name[0] == '\0' || cmd[0] == '\0')
    {
      send_to_char ("Coax who into what?\n\r", ch);
      return;
    }
  if ((mnt = get_char_room (ch, mount_name)) == NULL)
    {
      sprintf (buf, "I don't see any %s here.\n\r", mount_name);
      send_to_char (buf, ch);
      return;
    }
  if (mnt->riders != ch && mnt->mounter != ch)
    {
      act ("$N seems to be ignoring you.", ch, NULL, mnt, TO_CHAR);
      return;
    }
  if (!str_cmp (cmd, "eat"))
    {
      do_eat (mnt, argument);
      send_to_char ("Ok.\n\r", ch);
    }

  else if (!str_cmp (cmd, "drink"))
    {
      do_drink (mnt, argument);
      send_to_char ("Ok.\n\r", ch);
    }

  else if (!str_cmp (cmd, "sleep"))
    {
      do_sleep (mnt, argument);
      send_to_char ("Ok.\n\r", ch);
    }

  else if (!str_cmp (cmd, "rest"))
    {
      do_rest (mnt, argument);
      send_to_char ("Ok.\n\r", ch);
    }

  else if (!str_cmp (cmd, "sit"))
    {
      do_sit (mnt, argument);
      send_to_char ("Ok.\n\r", ch);
    }

  else if (!str_cmp (cmd, "stand"))
    {
      do_stand (mnt, argument);
      send_to_char ("Ok.\n\r", ch);
    }

  else
    act ("$N doesn't seem to understand.", ch, NULL, mnt, TO_CHAR);
}

void do_open (CHAR_DATA * ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  OBJ_DATA *obj;
  int door;
  one_argument (argument, arg);
  if (arg[0] == '\0')
    {
      send_to_char ("Open what?\n\r", ch);
      return;
    }
  if ((obj = get_obj_here (ch, arg)) != NULL)
    {
//      trip_triggers(ch, OBJ_TRIG_OPEN, obj, NULL, OT_SPEC_NONE);
      /* open portal */
      if (obj->item_type == ITEM_PORTAL)
	{
	  if (!IS_SET (obj->value[1], EX_ISDOOR))
	    {
	      send_to_char ("You can't do that.\n\r", ch);
	      return;
	    }
	  if (!IS_SET (obj->value[1], EX_CLOSED))
	    {
	      send_to_char ("It's already open.\n\r", ch);
	      return;
	    }
	  if (IS_SET (obj->value[1], EX_LOCKED))
	    {
	      send_to_char ("It's locked.\n\r", ch);
	      return;
	    }
	  REMOVE_BIT (obj->value[1], EX_CLOSED);
	  act ("You open $p.", ch, obj, NULL, TO_CHAR);
	  act ("$n opens $p.", ch, obj, NULL, TO_ROOM);
	  trip_triggers(ch, OBJ_TRIG_OPEN, obj, NULL, OT_SPEC_NONE);
	  return;
	}
      if (obj->item_type == ITEM_CTRANSPORT)
	{
	  if (!IS_SET (obj->value[5], CONT_CLOSED))
	    {
	      send_to_char ("It's already open.\n\r", ch);
	      return;
	    }
	  if (!IS_SET (obj->value[5], CONT_CLOSEABLE))
	    {
	      send_to_char ("You can't do that.\n\r", ch);
	      return;
	    }
	  if (IS_SET (obj->value[5], CONT_LOCKED))
	    {
	      send_to_char ("It's locked.\n\r", ch);
	      return;
	    }
	  REMOVE_BIT (obj->value[5], CONT_CLOSED);
	  act ("You open $p.", ch, obj, NULL, TO_CHAR);
	  act ("$n opens $p.", ch, obj, NULL, TO_ROOM);
	  trip_triggers(ch, OBJ_TRIG_OPEN, obj, NULL, OT_SPEC_NONE);
	  return;
	}

      /* 'open object' */
      if (obj->item_type != ITEM_CONTAINER
	  && obj->item_type != ITEM_PACK && obj->item_type != ITEM_QUIVER)
	{
	  send_to_char ("That's not a container.\n\r", ch);
	  return;
	}
      if (!IS_SET (obj->value[1], CONT_CLOSED))
	{
	  send_to_char ("It's already open.\n\r", ch);
	  return;
	}
      if (!IS_SET (obj->value[1], CONT_CLOSEABLE))
	{
	  send_to_char ("You can't do that.\n\r", ch);
	  return;
	}
      if (IS_SET (obj->value[1], CONT_LOCKED))
	{
	  send_to_char ("It's locked.\n\r", ch);
	  return;
	}
      REMOVE_BIT (obj->value[1], CONT_CLOSED);
      act ("You open $p.", ch, obj, NULL, TO_CHAR);
      act ("$n opens $p.", ch, obj, NULL, TO_ROOM);
      trip_triggers(ch, OBJ_TRIG_OPEN, obj, NULL, OT_SPEC_NONE);
      trap_check(ch,"object",NULL,obj);
      return;
    }

  else if (IS_SET (ch->in_room->room_flags, ROOM_TRANSPORT))
    {
      for (obj = object_list; obj; obj = obj->next)
	{
	  if (obj->item_type != ITEM_CTRANSPORT)
	    continue;
	  if (obj->value[2] == ch->in_room->vnum && is_name (arg, obj->name))
	    {
	      if (!IS_SET (obj->value[5], CONT_CLOSED))
		{
		  send_to_char ("It's already open.\n\r", ch);
		  return;
		}
	      if (!IS_SET (obj->value[5], CONT_CLOSEABLE))
		{
		  send_to_char ("You can't do that.\n\r", ch);
		  return;
		}
	      if (IS_SET (obj->value[5], CONT_LOCKED))
		{
		  send_to_char ("It's locked.\n\r", ch);
		  return;
		}
	      REMOVE_BIT (obj->value[5], CONT_CLOSED);
	      act ("You open $p.", ch, obj, NULL, TO_CHAR);
	      act ("$n opens $p.", ch, obj, NULL, TO_ROOM);
	      trip_triggers(ch, OBJ_TRIG_OPEN, obj, NULL, OT_SPEC_NONE);
	      return;
	    }
	}
    }
  if ((door = find_door (ch, arg)) >= 0)
    {

      /* 'open door' */
      ROOM_INDEX_DATA *to_room;
      EXIT_DATA *pexit;
      EXIT_DATA *pexit_rev;
      pexit = ch->in_room->exit[door];
      if (!IS_SET (pexit->exit_info, EX_CLOSED))
	{
	  send_to_char ("It's already open.\n\r", ch);
	  return;
	}
      if (IS_SET (pexit->exit_info, EX_LOCKED))
	{
	  send_to_char ("It's locked.\n\r", ch);
	  return;
	}
      REMOVE_BIT (pexit->exit_info, EX_CLOSED);
      act ("$n opens the $d.", ch, NULL, pexit->keyword, TO_ROOM);
      send_to_char ("Ok.\n\r", ch);
      trap_check(ch,flag_string (dir_flags,door),ch->in_room,NULL);

      /* open the other side */
      if ((to_room = pexit->u1.to_room) != NULL
	  && (pexit_rev = to_room->exit[rev_dir[door]]) != NULL
	  && pexit_rev->u1.to_room == ch->in_room)
	{
	  CHAR_DATA *rch;
	  REMOVE_BIT (pexit_rev->exit_info, EX_CLOSED);
	  for (rch = to_room->people; rch != NULL; rch = rch->next_in_room)
	    act ("The $d opens.", rch, NULL, pexit_rev->keyword, TO_CHAR);
          trap_check(ch,flag_string (dir_flags,rev_dir[door]),to_room,NULL);
	}
      trip_triggers(ch, OBJ_TRIG_OPEN, obj, NULL, OT_SPEC_NONE);
    }
  return;
}

void do_close (CHAR_DATA * ch, char *argument)
{
  char arg[MAX_INPUT_LENGTH];
  OBJ_DATA *obj;
  int door;
  one_argument (argument, arg);
  if (arg[0] == '\0')
    {
      send_to_char ("Close what?\n\r", ch);
      return;
    }
  if ((obj = get_obj_here (ch, arg)) != NULL)
    {
      trip_triggers(ch, OBJ_TRIG_CLOSE, obj, NULL, OT_SPEC_NONE);
      /* portal stuff */
      if (obj->item_type == ITEM_PORTAL)
	{
	  if (!IS_SET (obj->value[1], EX_ISDOOR)
	      || IS_SET (obj->value[1], EX_NOCLOSE))
	    {
	      send_to_char ("You can't do that.\n\r", ch);
	      return;
	    }
	  if (IS_SET (obj->value[1], EX_CLOSED))
	    {
	      send_to_char ("It's already closed.\n\r", ch);
	      return;
	    }
	  SET_BIT (obj->value[1], EX_CLOSED);
	  act ("You close $p.", ch, obj, NULL, TO_CHAR);
	  act ("$n closes $p.", ch, obj, NULL, TO_ROOM);
	  return;
	}
      if (obj->item_type == ITEM_CTRANSPORT)
	{
	  if (IS_SET (obj->value[5], CONT_CLOSED))
	    {
	      send_to_char ("It's already closed.\n\r", ch);
	      return;
	    }
	  if (!IS_SET (obj->value[5], CONT_CLOSEABLE))
	    {
	      send_to_char ("You can't do that.\n\r", ch);
	      return;
	    }
	  SET_BIT (obj->value[5], CONT_CLOSED);
	  act ("You close $p.", ch, obj, NULL, TO_CHAR);
	  act ("$n closes $p.", ch, obj, NULL, TO_ROOM);
	  return;
	}

      /* 'close object' */
      if (obj->item_type != ITEM_CONTAINER
	  && obj->item_type != ITEM_PACK && obj->item_type
	  && obj->item_type != ITEM_QUIVER)
	{
	  send_to_char ("That's not a container.\n\r", ch);
	  return;
	}
      if (IS_SET (obj->value[1], CONT_CLOSED))
	{
	  send_to_char ("It's already closed.\n\r", ch);
	  return;
	}
      if (!IS_SET (obj->value[1], CONT_CLOSEABLE))
	{
	  send_to_char ("You can't do that.\n\r", ch);
	  return;
	}
      SET_BIT (obj->value[1], CONT_CLOSED);
      act ("You close $p.", ch, obj, NULL, TO_CHAR);
      act ("$n closes $p.", ch, obj, NULL, TO_ROOM);
      return;
    }

  else if (IS_SET (ch->in_room->room_flags, ROOM_TRANSPORT))
    {
      for (obj = object_list; obj; obj = obj->next)
	{
	  if (obj->item_type != ITEM_CTRANSPORT)
	    continue;
	  if (obj->value[2] == ch->in_room->vnum && is_name (arg, obj->name))
	    {
	      if (IS_SET (obj->value[5], CONT_CLOSED))
		{
		  send_to_char ("It's already closed.\n\r", ch);
		  return;
		}
	      if (!IS_SET (obj->value[5], CONT_CLOSEABLE))
		{
		  send_to_char ("You can't do that.\n\r", ch);
		  return;
		}
	      SET_BIT (obj->value[5], CONT_CLOSED);
	      act ("You close $p.", ch, obj, NULL, TO_CHAR);
	      act ("$n closes $p.", ch, obj, NULL, TO_ROOM);
	      return;
	    }
	}
    }
  if ((door = find_door (ch, arg)) >= 0)
    {

      /* 'close door' */
      ROOM_INDEX_DATA *to_room;
      EXIT_DATA *pexit;
      EXIT_DATA *pexit_rev;
      pexit = ch->in_room->exit[door];
      if (IS_SET (pexit->exit_info, EX_CLOSED))
	{
	  send_to_char ("It's already closed.\n\r", ch);
	  return;
	}
      SET_BIT (pexit->exit_info, EX_CLOSED);
      act ("$n closes the $d.", ch, NULL, pexit->keyword, TO_ROOM);
      send_to_char ("Ok.\n\r", ch);

      /* close the other side */
      if ((to_room = pexit->u1.to_room) != NULL
	  && (pexit_rev = to_room->exit[rev_dir[door]]) != 0
	  && pexit_rev->u1.to_roo

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

Site Stats

Snippets: 1791
Codebases: 571