act_comm.c

demise/src/act_comm.c · 130.5 KB

From the archive dodbackup-final.tar.gz

Download the archive   « Back to the archive contents

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

/*
 * Local functions.
 */
//bool  is_note_to      args( ( CHAR_DATA *ch, NOTE_DATA *pnote ) );
//void  note_attach     args( ( CHAR_DATA *ch ) );
//void  note_remove     args( ( CHAR_DATA *ch, NOTE_DATA *pnote ) );
void talk_channel args ((CHAR_DATA * ch, char *argument,
			 int channel, const char *verb));
char *oldelang args ((CHAR_DATA * ch, char *argument));
char *badlang args ((CHAR_DATA * ch, char *argument));
char *darktongue args ((CHAR_DATA * ch, char *argument));
char *drunktalk args ((CHAR_DATA * ch, char *argument));
char *beasttalk args ((CHAR_DATA * ch, char *argument));
char *beastchat args ((CHAR_DATA * ch, char *argument));
char *socialc args ((CHAR_DATA * ch, char *argument, char *you, char *them));
char *socialv args ((CHAR_DATA * ch, char *argument, char *you, char *them));
char *socialn args ((CHAR_DATA * ch, char *argument, char *you, char *them));


/*
 * Generic channel function.
 */
void
talk_channel (CHAR_DATA * ch, char *argument, int channel, const char *verb)
{
  CHAR_DATA *victim;
  char buf[MSL];
  char buf2[MSL];
  char name[MSL];
  DESCRIPTOR_DATA *d;
  int position;

  if (argument[0] == '\0')
    {
      sprintf (buf, "%s what?\n\r", verb);
      buf[0] = UPPER (buf[0]);
      return;
    }
  if (IS_NPC (ch) && ch->desc != NULL)
    {
      //revhere
      if (IS_SET (ch->desc->original->class, CLASS_WRAITH))
	{
	  if (ch->desc->original->pcdata->powers[WRA_PUPP] < 3)
	    {
	      stc
		("You dont have the power to get your skinrides to talk yet.\n\r",
		 ch);
	      return;
	    }
	}
    }

  if (!IS_IMMORTAL (ch))
    {
      if (IS_HEAD (ch, LOST_TONGUE))
	{
	  sprintf (buf, "You can't %s without a tongue!\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}

      if (IS_EXTRA (ch, GAGGED))
	{
	  sprintf (buf, "You can't %s with a gag on!\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (!IS_NPC (ch) && IS_SET (ch->act, PLR_SILENCE))
	{
	  sprintf (buf, "You can't %s.\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}

      if (ch->in_room != NULL
	  && IS_SET (ch->in_room->added_flags, ROOM2_SILENCE))
	{
	  sprintf (buf, "You can't %s.\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (ch->in_room != NULL
	  && IS_SET (ch->in_room->room_flags, ROOM_SILENCE))
	{
	  sprintf (buf, "You can't %s.\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (IS_GHOST (ch))
	{
	  do_huh (ch, "");
	  return;
	}

    }

  REMOVE_BIT (ch->deaf, channel);


  switch (channel)
    {
    default:

      sprintf (buf, "You %s '#y$T#n'.", verb);
      if (!IS_NPC (ch) && ch->pcdata->condition[COND_DRUNK] > 10)
	act3 (buf, ch, NULL, drunktalk (ch, argument), TO_CHAR);
      else if (!IS_NPC (ch) && ch->pcdata->vamprage > 0 && IS_VAMPIRE (ch) &&
	       !IS_SET (mudconfig->world_affects, WORLD_NICE)
	       && !IS_ABOMINATION (ch))
	act3 (buf, ch, NULL, beastchat (ch, argument), TO_CHAR);
      else
	act3 (buf, ch, NULL, argument, TO_CHAR);
/*
	sprintf( buf, "You %s '#y%s#n'.\n\r", verb, argument );
	send_to_char( buf, ch );
*/

      sprintf (buf, "$n %ss '#y$t#n'.", verb);
      sprintf (buf2, "$n %ss '#y$t#n'.", verb);
      break;

    case CHANNEL_IMMTALK:
      sprintf (buf, "#0(#F)#y$n#0(#F): #C$t#n");
      sprintf (buf2, "#0(#F)#y$n#0(#F): #C$t#n");
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;

    case CHANNEL_FOUNDERTALK:
      sprintf (buf, "#0<#C#Y#0>#c$n#0<#C#Y#0>: #P$t#n");
      sprintf (buf2, "#0<#C#Y#0>#c$n#0<#C#Y#0>: #P$t#n");
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;

    case CHANNEL_ROAR:
      sprintf (buf, "#0:#c:#0$n#c:#0:#C $t#n");
      sprintf (buf2, "#0:#c:#0$n#c:#0:#C $t#n");
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;
/*
    case CHANNEL_QUEST:
      sprintf (buf, "#G(#yQuest#G)#L you say '$t'#n.\n\r");
      sprintf (buf2, "#G(#yQuest#G)#L $n says '$t'#n.");
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;
*/
    case CHANNEL_CHAT:		/*Nymph */
      sprintf (buf, "#o(#Y)#cYou Chat#o(#Y): #7'#0$t#7'.");
      sprintf (buf2, "#o(#Y)#c$n Chats#o(#Y): #7'#0$t#7'.");
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;

    case CHANNEL_MONK:
      sprintf (buf, "#c++ #o$n hums #c++#n '#g$t#n'.");
      sprintf (buf2, "#c++ #o$n hums #c++#n '#g$t#n'.");
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;

    case CHANNEL_IMPLEMENTOR:
      sprintf (buf, "#L@#7<#p$n#7>#L@#n '#7$t#n'.");
      sprintf (buf2, "#L@#7<#p$n#7>#L@#n '#7$t#n'.");
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;

    case CHANNEL_GHOST:
      sprintf (buf, "#0You Haunt:#7 '#C$t#7'#n.");
      sprintf (buf2, "#0$n Haunts:#7 '#C$t#7'#n.");
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;

    case CHANNEL_HARDCORE:	/*Nymph */
      sprintf (buf, "#R#(#RYou #RH#0ardcore#R#)#7 '#g$t#7'#n.");
      sprintf (buf2, "#R#(#R$n #RH#0ardcores#R#)#7 '#g$t#7'#n.");
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;

    case CHANNEL_MUSIC:	/*Nymph */
      sprintf (buf, "#r((#0You Music#r)) #7 '#R$t#7'#n.");
      sprintf (buf2, "#r((#0$n Musics#r))#7 '#R$t#7'#n.");
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;

    case CHANNEL_WAIL:		/*reverett */
      sprintf (buf, "#R>#y|#R<#0You#R>#y|#R< #7'#r$t#7'#n.");
      sprintf (buf2, "#R>#y|#R<#0$n#R>#y|#R< #7'#r$t#7'#n.");
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;

    case CHANNEL_BUILD:
      sprintf (buf, "#L<#RBuildtalk#L> #y$n: #7$t#n");
      sprintf (buf2, "#L<#RBuildtalk#L> #y$n: #7$t#n");
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;

    case CHANNEL_GAIATALK:
      sprintf (buf, "#p#(#R#(#g $n #R#)#p#)#n #G$t#n");
      sprintf (buf2, "#p#(#R#(#g $n #R#)#p#)#n #G$t#n");
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;

    case CHANNEL_DREAMTALK:
      sprintf (buf, "#o#Y#0#Y#n$n#0#Y#o#Y#n #G$t#n");
      sprintf (buf2, "#o#Y#0#Y#n$n#0#Y#o#Y#n #G$t#n");
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;

    case CHANNEL_MIKTALK:
      if (!IS_NPC (ch) && IS_XBITS (ch, X_DARKPATH))
	{
	  sprintf (buf, "#c***#0 $n#c ***#R $t#n");
	  sprintf (buf2, "#c***#0 $n#c ***#R $t#n");
	}
      else if (!IS_NPC (ch) && IS_XBITS (ch, X_LIGHTPATH))
	{
	  sprintf (buf, "#C***#7 $n#C ***#R $t#n");
	  sprintf (buf2, "#C***#7 $n#C ***#R $t#n");
	}
      else
	{
	  sprintf (buf, "#g***#P $n#g ***#R $t#n");
	  sprintf (buf2, "#g***#P $n#g ***#R $t#n");
	}
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;

    case CHANNEL_HIGHTALK:
      sprintf (buf, "#L-=#G $n#L =-#n #P$t#n");
      sprintf (buf2, "#L-=#G $n#L =-#n #P$t#n");
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;

    case CHANNEL_HOWL:
      if (!IS_NPC (ch) && IS_ABOMINATION (ch))
	{
	  sprintf (buf, "#R<#G(#7$n#G)#R>#G $t#7.#n");
	  sprintf (buf2, "#R<#G(#7$n#G)#R>#G $t#7.#n");
	}
      else if (!IS_NPC (ch) && IS_SKINDANCER (ch))
	{
	  sprintf (buf, "#C{#G(#7$n#G)#C}#G $t#7.#n");
	  sprintf (buf2, "#C{#G(#7$n#G)#C}#G $t#7.#n");
	}
      else if (!IS_NPC (ch) && IS_GAIAINQ (ch))
	{
	  sprintf (buf, "#7^#G(#7$n#G)#7^#G $t#7.#n");
	  sprintf (buf2, "#7^#G(#7$n#G)#7^#G $t#7.#n");
	}
      else if (!IS_NPC (ch) && IS_BLACK_SPIRAL_DANCER (ch))
	{
	  sprintf (buf, "#y[#G(#7$n#G)#y]#G $t#7.#n");
	  sprintf (buf2, "#y[#G(#7$n#G)#y]#G $t#7.#n");
	}
      else
	{
	  sprintf (buf, "#G((#7$n#G))#G $t#7.#n");
	  sprintf (buf2, "#G((#7$n#G))#G $t#7.#n");
	}
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;
    case CHANNEL_VAMPTALK:
      if (!IS_NPC (ch) && IS_ABOMINATION (ch))
	{
	  sprintf (buf, "#R<#G(#7$n#G)#R>#P $t#7.#n");
	  sprintf (buf2, "#R<#G(#7$n#G)#R>#P $t#7.#n");
	}
      else if (!IS_NPC (ch) && IS_LICH (ch))
	{
	  sprintf (buf, "#R<#C{#7$n#C}#R>#P $t#7.#n");
	  sprintf (buf2, "#R<#C{#7$n#C}#R>#P $t#7.#n");
	}
      else if (!IS_NPC (ch) && IS_GHOUL (ch))
	{
	  sprintf (buf, "#R<#7$n#R>#P $t#7.#n");
	  sprintf (buf2, "#R<#7$n#R>#P $t#7.#n");
	}
      else if (!IS_NPC (ch) && IS_NECRONOM (ch))
	{
	  sprintf (buf, "#R<#0#Y#7$n#0#Y#R>#P $t#7.#n");
	  sprintf (buf2, "#R<#0#Y#7$n#0#Y#R>#P $t#7.#n");
	}
      else if (!IS_NPC (ch) && IS_CEVOYIA (ch))
	{
	  sprintf (buf, "#R<#G+#7$n#G+#R>#P $t#7.#n");
	  sprintf (buf2, "#R<#G+#7$n#G+#R>#P $t#7.#n");
	}
      else if (!IS_NPC (ch) && IS_KRENSHAR (ch))
	{
	  sprintf (buf, "#R<#P#(#7$n#P#)#R>#P $t#7.#n");
	  sprintf (buf2, "#R<#P#(#7$n#P#)#R>#P $t#7.#n");
	}
      else
	{
	  sprintf (buf, "#R<<#c$n#R>>#0 $t#7.#n");
	  sprintf (buf2, "#R<<#c$n#R>>#0 $t#7.#n");
	}
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;


    case CHANNEL_MAGE:
      if (!IS_NPC (ch) && IS_NEPHANDI (ch) && !IS_MAGE (ch))
	{
	  sprintf (buf, "#r{#y[#7$n#y]#r}#7 $t#7.#n");
	  sprintf (buf2, "#r{#y[#7$n#y]#r}#7 $t#7.#n");
	}
      else if (!IS_NPC (ch) && IS_LICH (ch) && !IS_MAGE (ch))
	{
	  sprintf (buf, "#R<#r{#7$n#r}#R>#7 $t#7.#n");
	  sprintf (buf2, "#R<#r{#7$n#r}#R>#7 $t#7.#n");
	}
      else if (!IS_NPC (ch) && IS_GYPSY (ch) && !IS_MAGE (ch))
	{
	  sprintf (buf, "#C**#r{#7$n#r}#C**#7 $t#7.#n");
	  sprintf (buf2, "#C**#r{#7$n#r}#C**#7 $t#7.#n");
	}
      else if (!IS_NPC (ch) && IS_SKINDANCER (ch) && !IS_MAGE (ch))
	{
	  sprintf (buf, "#g{#G(#c$n#G)#g}#7 $t#7.#n");
	  sprintf (buf2, "#g{#G(#c$n#G)#g}#7 $t#7.#n");
	}
      else
	{
	  if (ch->level <= LEVEL_APPRENTICE)
	    {
	      switch (ch->pcdata->runes[0])
		{
		default:
		  sprintf (buf, "#0{{#c$n#0}}#n");
		  sprintf (buf2, "#0{{#c$n#0}}#n");
		  break;
		case BLUE_MAGIC:
		  sprintf (buf, "#l{{#c$n#l}}#n");
		  sprintf (buf2, "#l{{#c$n#l}}#n");
		  break;
		case RED_MAGIC:
		  sprintf (buf, "#r{{#c$n#r}}#n");
		  sprintf (buf2, "#r{{#c$n#r}}#n");
		  break;
		case YELLOW_MAGIC:
		  sprintf (buf, "#o{{#c$n#o}}#n");
		  sprintf (buf2, "#o{{#c$n#o}}#n");
		  break;
		case GREEN_MAGIC:
		  sprintf (buf, "#g{{#c$n#g}}#n");
		  sprintf (buf2, "#g{{#c$n#g}}#n");
		  break;
		case PURPLE_MAGIC:
		  sprintf (buf, "#p{{#c$n#p}}#n");
		  sprintf (buf2, "#p{{#c$n#p}}#n");
		  break;
		}
	    }
	  if (ch->level == LEVEL_MAGE)
	    {
	      switch (ch->pcdata->runes[0])
		{
		default:
		  sprintf (buf, "#0{#7{#c$n#7}#0}#n");
		  sprintf (buf2, "#0{#7{#c$n#7}#0}#n");
		  break;
		case BLUE_MAGIC:
		  sprintf (buf, "#l{#L{#c$n#L}#l}#n");
		  sprintf (buf2, "#l{#L{#c$n#L}#l}#n");
		  break;
		case RED_MAGIC:
		  sprintf (buf, "#r{#R{#c$n#R}#r}#n");
		  sprintf (buf2, "#r{#R{#c$n#R}#r}#n");
		  break;
		case YELLOW_MAGIC:
		  sprintf (buf, "#o{#y{#c$n#y}#o}#n");
		  sprintf (buf2, "#o{#y{#c$n#y}#o}#n");
		  break;
		case GREEN_MAGIC:
		  sprintf (buf, "#g{#G{#c$n#G}#g}#n");
		  sprintf (buf2, "#g{#G{#c$n#G}#g}#n");
		  break;
		case PURPLE_MAGIC:
		  sprintf (buf, "#p{#P{#c$n#P}#p}#n");
		  sprintf (buf2, "#p{#P{#c$n#P}#p}#n");
		  break;
		}
	    }
	  if (ch->level >= LEVEL_ARCHMAGE)
	    {
	      switch (ch->pcdata->runes[0])
		{
		default:
		  sprintf (buf, "#7{{#c$n#7}}#n");
		  sprintf (buf2, "#7{{#c$n#7}}#n");
		  break;
		case BLUE_MAGIC:
		  sprintf (buf, "#L{{#c$n#L}}#n");
		  sprintf (buf2, "#L{{#c$n#L}}#n");
		  break;
		case RED_MAGIC:
		  sprintf (buf, "#R{{#c$n#R}}#n");
		  sprintf (buf2, "#R{{#c$n#R}}#n");
		  break;
		case YELLOW_MAGIC:
		  sprintf (buf, "#y{{#c$n#y}}#n");
		  sprintf (buf2, "#y{{#c$n#y}}#n");
		  break;
		case GREEN_MAGIC:
		  sprintf (buf, "#G{{#c$n#G}}#n");
		  sprintf (buf2, "#G{{#c$n#G}}#n");
		  break;
		case PURPLE_MAGIC:
		  sprintf (buf, "#P{{#c$n#P}}#n");
		  sprintf (buf2, "#P{{#c$n#P}}#n");
		  break;
		}
	    }

	  switch (ch->pcdata->runes[0])
	    {
	    default:
	      sprintf (buf, "%s#7 $t.#n", buf);
	      sprintf (buf2, "%s#7 $t.#n", buf2);
	      break;
	    case BLUE_MAGIC:
	      sprintf (buf, "%s#L $t.#n", buf);
	      sprintf (buf2, "%s#L $t.#n", buf2);
	      break;
	    case RED_MAGIC:
	      sprintf (buf, "%s#R $t.#n", buf);
	      sprintf (buf2, "%s#R $t.#n", buf2);
	      break;
	    case YELLOW_MAGIC:
	      sprintf (buf, "%s#y $t.#n", buf);
	      sprintf (buf2, "%s#y $t.#n", buf2);
	      break;
	    case GREEN_MAGIC:
	      sprintf (buf, "%s#g $t.#n", buf);
	      sprintf (buf2, "%s#g $t.#n", buf2);
	      break;
	    case PURPLE_MAGIC:
	      sprintf (buf, "%s#P $t.#n", buf);
	      sprintf (buf2, "%s#P $t.#n", buf2);
	      break;
	    }
	}
      position = ch->position;
      ch->position = POS_STANDING;
      act3 (buf, ch, argument, NULL, TO_CHAR);
      ch->position = position;
      break;
    }

  for (d = descriptor_list; d != NULL; d = d->next)
    {
      CHAR_DATA *och;
      CHAR_DATA *vch;

      och = d->original ? d->original : d->character;
      vch = d->character;

      if (d->connected == CON_PLAYING
	  && vch != ch && !IS_SET (och->deaf, channel))
	{
	  if (channel == CHANNEL_BUILD && !IS_IMMORTAL (och))
	    continue;
	  if (channel == CHANNEL_IMMTALK && get_trust (och) <= LEVEL_BUILDER)
	    continue;
	  if (channel == CHANNEL_FOUNDERTALK
	      && (!IS_NPC (och) && !IS_COR (och, COR_FOUNDER)
		  && get_trust (och) <= LEVEL_BUILDER))
	    continue;
	  if (channel == CHANNEL_VAMPTALK
	      && (!IS_NPC (och) && !IS_VAMPIRE (och)
		  && !IS_XX (och, XX_RAKVAMP)
		  && get_trust (och) <= LEVEL_BUILDER))
	    continue;
	  if (channel == CHANNEL_IMPLEMENTOR
	      && (!IS_CREATOR (och) && !IS_LINKSYS (och)))
	    continue;
	  if (channel == CHANNEL_ROAR
	      && (!IS_NPC (och) && !IS_DRACONIAN (och)
		  && get_trust (och) <= LEVEL_BUILDER))
	    continue;
	  if (channel == CHANNEL_GAIATALK
	      && (!IS_NPC (och) && !IS_KAHN (och)
		  && get_trust (och) <= LEVEL_BUILDER))
	    continue;
	  if (channel == CHANNEL_MIKTALK
	      && (!IS_NPC (och) && !IS_NINJA (och)
		  && get_trust (och) <= LEVEL_BUILDER))
	    continue;
	  if (channel == CHANNEL_DREAMTALK
	      && (!IS_NPC (och) && !IS_DJINN (och)
		  && !IS_XX (och, XX_RAKDJINN)
		  && get_trust (och) <= LEVEL_BUILDER))
	    continue;
	  if (channel == CHANNEL_WAIL
	      && (!IS_NPC (och) && !IS_WRAITH (och)
		  && get_trust (och) <= LEVEL_BUILDER))
	    continue;
	  if (channel == CHANNEL_HIGHTALK
	      && (!IS_NPC (och) && !IS_HIGHLANDER (och)
		  && get_trust (och) <= LEVEL_BUILDER))
	    continue;
	  if (channel == CHANNEL_GHOST
	      && (!IS_NPC (och) && !IS_GHOST (och) && !IS_SOUL (och)
		  && get_trust (och) <= LEVEL_BUILDER))
	    continue;
/*
	    if ( channel == CHANNEL_HOWL && (!IS_NPC(och) && !IS_WEREWOLF(och)))
		continue;
*/
	  if (channel == CHANNEL_HOWL && (!IS_NPC (och) &&
					  !IS_WEREWOLF (och)
					  && !IS_XX (och, XX_RAKWEREWOLF)
					  && !IS_POLYAFF (och, POLY_WOLF)
					  && get_trust (och) <=
					  LEVEL_BUILDER))
	    {
	      if ((och->in_room) && (ch->in_room))
		{
		  if ((och->in_room == ch->in_room))
		    {
		      act ("$n throws back $s head and howls loudly.", ch,
			   argument, och, TO_VICT);
		      continue;
		    }
		  else if ((och->in_room->area == ch->in_room->area))
		    {
		      act ("You hear a loud howl nearby.", ch, NULL, och,
			   TO_VICT);
		      continue;
		    }
		  else
		    {
		      if (!IS_SET (och->act, PLR_BRIEF))
			{
			  act ("You hear a loud howl in the distance.", ch,
			       NULL, och, TO_VICT);
			}
		      continue;
		    }
		}
	    }
	  if (channel == CHANNEL_MAGETALK
	      && (!IS_NPC (och) && !IS_MAGE (och) && !IS_XX (och, XX_RAKMAGE)
		  && get_trust (och) <= LEVEL_BUILDER))
	    continue;
	  if (channel == CHANNEL_MONK
	      && (!IS_NPC (och) && !IS_MONK (och) && !IS_XX (och, XX_RAKMONK)
		  && get_trust (och) <= LEVEL_BUILDER))
	    continue;
	  if (channel == CHANNEL_PRAY
	      && (!IS_NPC (och) && !IS_DEMON (och)
		  && get_trust (och) <= LEVEL_BUILDER))
	    continue;
	  if (channel == CHANNEL_YELL
	      && vch->in_room->area != ch->in_room->area)
	    continue;
	  if (IS_GHOST (och))
	    continue;

	  position = vch->position;
	  if (channel != CHANNEL_SHOUT && channel != CHANNEL_YELL)
	    vch->position = POS_STANDING;
	  if (!IS_NPC (vch) && IS_VAMPIRE (vch) &&
	      strlen (ch->side) > 1 && strlen (vch->side) > 1 &&
	      str_cmp (ch->side, vch->side))
	    {
	      act3 (buf2, ch, argument, vch, TO_VICT);
	      vch->position = position;
	      continue;
	    }
	  if (!IS_NPC (vch)
	      && (IS_WEREWOLF (vch) || get_trust (vch) <= LEVEL_BUILDER))
	    {
	      act3 (buf2, ch, argument, vch, TO_VICT);
	      vch->position = position;
	      continue;
	    }

	  act3 (buf2, ch, argument, vch, TO_VICT);
	  vch->position = position;
	}
    }

  return;
}

void
do_wail (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;

  if (!IS_WRAITH (ch) && !IS_IMMORTAL (ch))
    {
      do_huh (ch, "");
      return;
    }
  if (IS_IMMORTAL (ch) && IS_EXTRA (ch, EXTRA_PSAY))
    {
      send_to_char ("Please switch Ptalk OFF first.\n\r", ch);
      return;
    }
  talk_channel (ch, argument, CHANNEL_WAIL, "wail");
  return;
}

void
do_chat (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  if (IS_NPC (ch))
    return;

  if (IS_IMMORTAL (ch) && IS_EXTRA (ch, EXTRA_PSAY))
    {
      send_to_char ("Please switch Ptalk OFF first.\n\r", ch);
      return;
    }
  if (IS_XXX (ch, XXX_SE))
    {
      sprintf (buf,
	       "#0#((Secret Enforcer)#)#n#y %s #0#((Secret Enforcer)#)#n",
	       argument);
      do_echo (ch, buf);
      return;
    }
  talk_channel (ch, argument, CHANNEL_CHAT, "chat");
  return;
}

void
do_gaiatalk (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch) || (get_trust (ch) <= LEVEL_BUILDER && !IS_KAHN (ch)))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  talk_channel (ch, argument, CHANNEL_GAIATALK, "gaiatalk");
  return;
}

void
do_dreamtalk (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch)
      || (get_trust (ch) <= LEVEL_BUILDER && !IS_DJINN (ch)
	  && !IS_XX (ch, XX_RAKDJINN)))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  talk_channel (ch, argument, CHANNEL_DREAMTALK, "dreamtalk");
  return;
}

void
do_hightalk (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch) || (get_trust (ch) <= LEVEL_BUILDER && !IS_HIGHLANDER (ch)))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  talk_channel (ch, argument, CHANNEL_HIGHTALK, "hightalk");
  return;
}

void
do_miktalk (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch) || (get_trust (ch) <= LEVEL_BUILDER && !IS_NINJA (ch)))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  talk_channel (ch, argument, CHANNEL_MIKTALK, "miktalk");
  return;
}

void
do_newbie (CHAR_DATA * ch, char *argument)
{
  talk_channel (ch, argument, CHANNEL_NEWBIE, "newbie");
  return;
}

/*
 * Alander's new channels.
 */
void
do_music (CHAR_DATA * ch, char *argument)
{
  talk_channel (ch, argument, CHANNEL_MUSIC, "music");
  return;
}

void
do_question (CHAR_DATA * ch, char *argument)
{
  talk_channel (ch, argument, CHANNEL_QUESTION, "question");
  return;
}

void
do_answer (CHAR_DATA * ch, char *argument)
{
  talk_channel (ch, argument, CHANNEL_QUESTION, "answer");
  return;
}

void
do_shout (CHAR_DATA * ch, char *argument)
{
  talk_channel (ch, argument, CHANNEL_SHOUT, "shout");
  return;
}

void
do_yell (CHAR_DATA * ch, char *argument)
{
  talk_channel (ch, argument, CHANNEL_YELL, "yell");
  return;
}

/*
void
do_qtalk (CHAR_DATA * ch, char *argument)
{
  talk_channel (ch, argument, CHANNEL_QUEST, "qtalk");
  return;
}
*/
void
do_ghosttalk (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;

  if (!IS_SOUL (ch) && !IS_GHOST (ch) && !IS_IMMORTAL (ch))
    {
      do_huh (ch, "");
      return;
    }

  talk_channel (ch, argument, CHANNEL_GHOST, "ghosttalk");
  return;
}

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

  if (IS_NPC (ch))
    return;

  talk_channel (ch, argument, CHANNEL_HARDCORE, "hardcore");
  return;
}

void
do_buildtalk (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;

  talk_channel (ch, argument, CHANNEL_BUILD, "buildtalk");
  return;
}

void
do_immtalk (CHAR_DATA * ch, char *argument)
{
  talk_channel (ch, argument, CHANNEL_IMMTALK, "immtalk");
  return;
}

void
do_imptalk (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch) && !IS_CREATOR (ch) && !IS_LINKSYS (ch))
    return stc ("Huh?\n\r", ch);

  talk_channel (ch, argument, CHANNEL_IMPLEMENTOR, "imptalk");
  return;
}

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

  if (IS_NPC (ch)
      || (get_trust (ch) <= LEVEL_BUILDER && !IS_COR (ch, COR_FOUNDER)))
    return stc ("Huh?\n\r", ch);

  talk_channel (ch, argument, CHANNEL_FOUNDERTALK, "foundertalk");
  return;
}

void
do_vamptalk (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch)
      || (get_trust (ch) <= LEVEL_BUILDER && !IS_VAMPIRE (ch)
	  && !IS_XX (ch, XX_RAKVAMP)))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  talk_channel (ch, argument, CHANNEL_VAMPTALK, "vamptalk");
  return;
}

void
do_howl (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch) || (get_trust (ch) <= LEVEL_BUILDER && !IS_WEREWOLF (ch)
		      && !IS_POLYAFF (ch, POLY_WOLF)
		      && !IS_XX (ch, XX_RAKWEREWOLF)))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  talk_channel (ch, argument, CHANNEL_HOWL, "howls");
  return;
}

void
do_monktalk (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch)
      || (get_trust (ch) <= LEVEL_BUILDER && !IS_MONK (ch)
	  && !IS_XX (ch, XX_RAKMONK)))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  talk_channel (ch, argument, CHANNEL_MONK, "monk");
  return;
}

void
do_magetalk (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch) || (get_trust (ch) <= LEVEL_BUILDER && !IS_MAGE (ch))
      && !IS_XX (ch, XX_RAKMAGE))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  talk_channel (ch, argument, CHANNEL_MAGETALK, "magetalk");
  return;
}

void
do_roar (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch) || (get_trust (ch) <= LEVEL_BUILDER && !IS_DRACONIAN (ch)))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  talk_channel (ch, argument, CHANNEL_ROAR, "roar");
  return;
}

void
do_say (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  char name[80];
  char poly[MSL];
  char arg1[MIL];
  char speak[15];
  char speaks[15];
  char endbit[5];
  char secbit[5];
  char buf2[MSL];
  CHAR_DATA *to;
  CHAR_DATA *vch;
  bool is_ok;
  bool trans = FALSE;
  bool restore = FALSE;

  if (IS_IMMORTAL (ch) && IS_EXTRA (ch, EXTRA_PSAY))
    {
      send_to_char ("Please switch Ptalk OFF first.\n\r", ch);
      return;
    }

/*    if ( IS_NPC(ch) && IS_SET(ch->act, ACT_NOPARTS) )
    {
	send_to_char( "You are unable to speak.\n\r", ch );
	return;
    }
*/ if (IS_HEAD (ch, LOST_TONGUE))
    {
      send_to_char ("You can't speak without a tongue!\n\r", ch);
      return;
    }
  if (IS_EXTRA (ch, GAGGED))
    {
      send_to_char ("You can't speak with a gag on!\n\r", ch);
      return;
    }

  if (ch->in_room != NULL && IS_SET (ch->in_room->added_flags, ROOM2_SILENCE))
    {
      send_to_char ("Your words make no sound!\n\r", ch);
      return;
    }

  if (strlen (argument) > MIL)
    {
      send_to_char ("Line too long.\n\r", ch);
      return;
    }

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

  /* Allow the manipulation of a const argument */
  strcpy (buf, argument);
  argument = &buf[0];

  endbit[0] = argument[strlen (argument) - 1];
  endbit[1] = '\0';

  if (strlen (argument) > 1)
    secbit[0] = argument[strlen (argument) - 2];
  else
    secbit[0] = '\0';
  secbit[1] = '\0';
  if (IS_XXX (ch, XXX_SE))
    {
      sprintf (buf2,
	       "#0#((Secret Enforcer)#)#n#y %s #0#((Secret Enforcer)#)#n",
	       argument);
      do_recho (ch, buf2);
      return;
    }

  if (IS_BODY (ch, CUT_THROAT))
    {
      sprintf (speak, "rasp");
      sprintf (speaks, "rasps");
    }
  else if (!IS_NPC (ch) &&
	   (IS_SET (ch->act, PLR_WOLFMAN) || IS_POLYAFF (ch, POLY_WOLF)
	    || (IS_VAMPIRE (ch) && !IS_ABOMINATION (ch)
		&& ch->pcdata->vamprage > 0)))
    {
      if (number_percent () > 50)
	{
	  sprintf (speak, "growl");
	  sprintf (speaks, "growls");
	}
      else
	{
	  sprintf (speak, "snarl");
	  sprintf (speaks, "snarls");
	}
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_BAT))
    {
      sprintf (speak, "squeak");
      sprintf (speaks, "squeaks");
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_SERPENT))
    {
      sprintf (speak, "hiss");
      sprintf (speaks, "hisses");
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_FROG))
    {
      sprintf (speak, "croak");
      sprintf (speaks, "croaks");
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_RAVEN))
    {
      sprintf (speak, "squark");
      sprintf (speaks, "squarks");
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_ZULO))
    {
      sprintf (speak, "roar");
      sprintf (speaks, "roars");
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_DEMONFORM))
    {
      sprintf (speak, "boom");
      sprintf (speaks, "booms");
    }
  else if (IS_NPC (ch) && ch->pIndexData->vnum == MOB_VNUM_FROG)
    {
      sprintf (speak, "croak");
      sprintf (speaks, "croaks");
    }
  else if (IS_NPC (ch) && ch->pIndexData->vnum == MOB_VNUM_RAVEN)
    {
      sprintf (speak, "squark");
      sprintf (speaks, "squarks");
    }
  else if (IS_NPC (ch) && ch->pIndexData->vnum == MOB_VNUM_CAT)
    {
      sprintf (speak, "purr");
      sprintf (speaks, "purrs");
    }
  else if (IS_NPC (ch) && ch->pIndexData->vnum == MOB_VNUM_DOG)
    {
      sprintf (speak, "bark");
      sprintf (speaks, "barks");
    }
  else if (!IS_NPC (ch) && ch->pcdata->condition[COND_DRUNK] > 10)
    {
      sprintf (speak, "slur");
      sprintf (speaks, "slurs");
    }
  else if (IS_MORE (ch, MORE_SINGING))
    {
      sprintf (speak, "sing");
      sprintf (speaks, "sings");
      REMOVE_BIT (ch->more, MORE_SINGING);
    }
  else if (!IS_NPC (ch) && (ch->pcdata->exercise[EXE_COUNT] > 10 ||
			    ch->pcdata->exercise[EXE_RECOVER] > 10))
    {
      sprintf (speak, "pant");
      sprintf (speaks, "pants");
    }
/*
    else if (IS_MORE(ch, MORE_INFORM))
    {
	sprintf(speak,"announce");
	sprintf(speaks,"announces");
    }
*/
  else if (!str_cmp (endbit, "!"))
    {
      sprintf (speak, "exclaim");
      sprintf (speaks, "exclaims");
    }
  else if (!str_cmp (endbit, "?"))
    {
      sprintf (speak, "ask");
      sprintf (speaks, "asks");
    }
  else if (secbit[0] != '\0' && str_cmp (secbit, ".")
	   && !str_cmp (endbit, "."))
    {
      sprintf (speak, "state");
      sprintf (speaks, "states");
    }
  else if (secbit[0] != '\0' && !str_cmp (secbit, ".")
	   && !str_cmp (endbit, "."))
    {
      sprintf (speak, "mutter");
      sprintf (speaks, "mutters");
    }
  else if (secbit[0] != '\0' && (!str_cmp (secbit, ":") ||
				 !str_cmp (secbit, "=")
				 || !str_cmp (secbit, ";"))
	   && !str_cmp (endbit, ")"))
    {
      sprintf (speak, "grin");
      sprintf (speaks, "grins");
    }
  else if (secbit[0] != '\0' && !str_cmp (secbit, ":")
	   && !str_cmp (endbit, "("))
    {
      sprintf (speak, "frown");
      sprintf (speaks, "frowns");
    }
  else
    {
      sprintf (speak, "say");
      sprintf (speaks, "says");
    }

  sprintf (poly, "#7You %s '#P$T#7'.#n", speak);
  if (!IS_NPC (ch))
    {
/*      if (IS_POLYAFF (ch, POLY_ZULO) && !IS_LICH (ch))
	act (poly, ch, NULL, darktongue (ch, argument), TO_CHAR);
  */ if (ch->pcdata->condition[COND_DRUNK] > 10)
	act (poly, ch, NULL, drunktalk (ch, argument), TO_CHAR);
      else if (ch->pcdata->vamprage > 0 && IS_VAMPIRE (ch) && !IS_LICH (ch) &&
	       !IS_SET (mudconfig->world_affects, WORLD_NICE)
	       && !IS_ABOMINATION (ch))
	act (poly, ch, NULL, beasttalk (ch, argument), TO_CHAR);
      else if (IS_SPEAKING (ch, DIA_OLDE))
	act (poly, ch, NULL, oldelang (ch, argument), TO_CHAR);
      else if (IS_SPEAKING (ch, DIA_BAD))
	act (poly, ch, NULL, badlang (ch, argument), TO_CHAR);
      else
	act (poly, ch, NULL, argument, TO_CHAR);
    }
  else
    {
      if (IS_NPC (ch) && ch->spec_fun == spec_lookup ("spec_portalpand"))
	act (poly, ch, NULL, badlang (ch, argument), TO_CHAR);
      else
	act (poly, ch, NULL, argument, TO_CHAR);
    }
  sprintf (poly, "#7$n %s '#P$T#7'.#n", speaks);

  if (ch->in_room->vnum != ROOM_VNUM_IN_OBJECT)
    {
      act (poly, ch, NULL, argument, TO_ROOM);
      if (ch->desc != NULL && ch->desc->snoop_by != NULL)
	{
	  if ((vch = ch->desc->snoop_by->character) == NULL)
	    ch->desc->snoop_by = NULL;
	  else if (ch->in_room == NULL || vch->in_room == NULL)
	    bug ("In_room bug - Corim.", 0);
	  else if (!IS_NPC (vch) && IS_MORE (ch, MORE_INFORM))
	    {
	      if (ch->pcdata->lie == LIE_TRUE)
		act ("$n is lying.", ch, NULL, vch, TO_VICT);
	      else
		act ("$n is telling the truth.", ch, NULL, vch, TO_VICT);
	    }
	}
      room_text (ch, strlower (argument));
      return;
    }

  to = ch->in_room->people;
  for (; to != NULL; to = to->next_in_room)
    {
      is_ok = FALSE;

      if (to->desc == NULL || !IS_AWAKE (to))
	continue;

      if (ch == to)
	continue;

      if (!IS_NPC (ch) && ch->pcdata->chobj != NULL &&
	  ch->pcdata->chobj->in_room != NULL &&
	  !IS_NPC (to) && to->pcdata->chobj != NULL &&
	  to->pcdata->chobj->in_room != NULL && ch->in_room == to->in_room)
	is_ok = TRUE;
      else
	is_ok = FALSE;

      if (!IS_NPC (ch) && ch->pcdata->chobj != NULL &&
	  ch->pcdata->chobj->in_obj != NULL &&
	  !IS_NPC (to) && to->pcdata->chobj != NULL &&
	  to->pcdata->chobj->in_obj != NULL &&
	  ch->pcdata->chobj->in_obj == to->pcdata->chobj->in_obj)
	is_ok = TRUE;
      else
	is_ok = FALSE;

      if (!is_ok)
	continue;

      if (IS_NPC (ch))
	sprintf (name, ch->short_descr);
      else if (!IS_NPC (ch) && IS_AFFECTED (ch, AFF_POLYMORPH))
	sprintf (name, ch->morph);
      else
	sprintf (name, ch->name);
      name[0] = UPPER (name[0]);
      sprintf (poly, "%s %s '#P%s#n'.\n\r", name, speaks, argument);
      send_to_char (poly, to);
    }

  room_text (ch, strlower (argument));
  return;
}

/* For the Valhalla code */

void
do_valhalla (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *odin;

  if (IS_SOUL (ch))
    {
      for (odin = ch->in_room->people; odin != NULL;
	   odin = odin->next_in_room)
	{
	  if (!IS_NPC (odin))
	    continue;
	  if (odin->spec_fun == spec_lookup ("spec_deathdealer"))
	    break;
	}

      if (odin == NULL || odin->spec_fun != spec_lookup ("spec_deathdealer"))
	{
	  do_huh (ch, "");
	  return;
	}
      else
	{
	  do_say (ch, "I chose Valhalla my Liege!");
	  do_say (odin, "Valhalla it is!");
	  char_from_room (ch);
	  char_to_room (ch, get_room_index (number_range (25, 49)));
	}
      return;
    }
  else
    {
      do_huh (ch, "");
      return;
    }
  return;
}

void
do_wraithquest (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *odin;

  if (IS_SOUL (ch))
    {
      for (odin = ch->in_room->people; odin != NULL;
	   odin = odin->next_in_room)
	{
	  if (!IS_NPC (odin))
	    continue;
	  if (odin->spec_fun == spec_lookup ("spec_deathdealer"))
	    break;
	}

      if (odin == NULL || odin->spec_fun != spec_lookup ("spec_deathdealer"))
	{
	  do_huh (ch, "");
	  return;
	}
      else
	{
	  do_say (ch, "I chose to go on the wraith quest my Liege!");
	  do_say (odin, "Back to Valhalla with you, seek out the Sphinx!");
	  do_say (odin, "The Sphinx will give you the quest you need.");
	  SET_BIT (ch->xxxbits, XXX_WRAITHQUEST);
	  char_from_room (ch);
	  char_to_room (ch, get_room_index (number_range (25, 49)));
	}
      return;
    }
  else
    {
      do_huh (ch, "");
      return;
    }
  return;
}

/* For the Valhalla code */

void
do_demise (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *odin;
  int vnum;

  if (IS_SOUL (ch))
    {
      for (odin = ch->in_room->people; odin != NULL;
	   odin = odin->next_in_room)
	{
	  if (!IS_NPC (odin))
	    continue;
	  if (odin->spec_fun == spec_lookup ("spec_deathdealer"))
	    break;
	}

      if (odin == NULL || odin->spec_fun != spec_lookup ("spec_deathdealer"))
	{
	  do_huh (ch, "");
	  return;
	}
      else
	{
	  do_say (ch, "I chose Demise my Liege!");
	  do_say (odin,
		  "Back to Demise with you, all of your powers restored.");
	  ch->level = ch->pre_level;
	  if (ch->pre_trust > 0)
	    ch->trust = ch->pre_trust;
	  REMOVE_BIT (ch->nymbits, NYM_DEAD);
	  do_restore (ch, "self");

	  if (ch->deadplane == PLANE_NEXUS)
	    {
	      vnum = ROOM_VNUM_ALTAR;
	    }
	  else if (ch->deadplane == PLANE_PAND)
	    {
	      vnum = number_range (45701, 45800);
	    }
	  else if (ch->deadplane == PLANE_TRANQ)
	    {
	      vnum = 45842;
	    }
	  else if (ch->deadplane == PLANE_OMNI)
	    {
	      vnum = ROOM_VNUM_ALTAR;
	    }
	  else if (ch->deadplane == PLANE_HEAVEN)
	    {
	      vnum = ROOM_VNUM_HEAVEN;
	    }
	  else if (ch->deadplane == PLANE_HELL)
	    {
	      vnum = ROOM_VNUM_HELL;
	    }
	  else if (ch->deadplane == PLANE_LIMBO)
	    {
	      vnum = number_range (45901, 45911);
	    }
	  else if (ch->deadplane == PLANE_VALHALLA)
	    {
	      vnum = number_range (25, 49);
	    }
	  else
	    {
	      vnum = ROOM_VNUM_ALTAR;
	    }
	  char_from_room (ch);
	  char_to_room (ch, get_room_index (vnum));
	  ch->deadplane = 0;
	}
      return;
    }
  else
    {
      do_huh (ch, "");
      return;
    }
  return;
}

void
do_psay (CHAR_DATA * ch, char *argument)
{
  char arg1[MIL];
  char arg2[MSL];
  char arg3[MSL];

  char poly1[MSL];
  char poly2[MSL];
  char speak1[15];
  char speaks1[15];
  char endbit1[5];
  char secbit1[5];
  char speak2[15];
  char speaks2[15];
  char endbit2[5];
  char secbit2[5];

  CHAR_DATA *victim;

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

  if (!IS_EXTRA (ch, EXTRA_PSAY))
    {
      send_to_char ("Please switch Ptalk ON first.\n\r", ch);
      return;
    }

  if (IS_NPC (ch) && IS_SET (ch->act, ACT_NOPARTS))
    {
      send_to_char ("You are unable to speak.\n\r", ch);
      return;
    }
  if (IS_HEAD (ch, LOST_TONGUE))
    {
      send_to_char ("You can't speak without a tongue!\n\r", ch);
      return;
    }
  if (IS_EXTRA (ch, GAGGED))
    {
      send_to_char ("You can't speak with a gag on!\n\r", ch);
      return;
    }

  if (ch->in_room != NULL && IS_SET (ch->in_room->added_flags, ROOM2_SILENCE))
    {
      send_to_char ("Your words make no sound!\n\r", ch);
      return;
    }

  if (strlen (arg2) > MIL || strlen (arg3) > MIL)
    {
      send_to_char ("Line too long.\n\r", ch);
      return;
    }

  if (arg1[0] == '\0' || arg2[0] == '\0' || arg3[0] == '\0')
    {
      send_to_char
	("Syntax: Psay <person> <their message> <everyone elses message>\n\r",
	 ch);
      return;
    }

  if (strlen (arg2) < 3 || strlen (arg3) < 3)
    {
      send_to_char
	("Syntax: Psay <person> <their message> <everyone elses message>\n\r",
	 ch);
      return;
    }

  if (argument[0] != '\0')
    {
      send_to_char ("Please use quotes around what you wish to say.\n\r", ch);
      return;
    }

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

  endbit1[0] = arg2[strlen (arg2) - 1];
  endbit1[1] = '\0';

  endbit2[0] = arg3[strlen (arg3) - 1];
  endbit2[1] = '\0';

  if (strlen (arg2) > 3)
    secbit1[0] = arg2[strlen (arg2) - 2];
  else
    secbit1[0] = '\0';
  secbit1[1] = '\0';
  if (strlen (arg3) > 3)
    secbit2[0] = arg3[strlen (arg3) - 2];
  else
    secbit2[0] = '\0';
  secbit2[1] = '\0';

  if (IS_BODY (ch, CUT_THROAT))
    {
      sprintf (speak1, "rasp");
      sprintf (speaks1, "rasps");
    }
  else if (!IS_NPC (ch) &&
	   (IS_SET (ch->act, PLR_WOLFMAN) || IS_POLYAFF (ch, POLY_WOLF)
	    || (IS_VAMPIRE (ch) && !IS_ABOMINATION (ch)
		&& ch->pcdata->vamprage > 0)))
    {
      if (number_percent () > 50)
	{
	  sprintf (speak1, "growl");
	  sprintf (speaks1, "growls");
	}
      else
	{
	  sprintf (speak1, "snarl");
	  sprintf (speaks1, "snarls");
	}
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_BAT))
    {
      sprintf (speak1, "squeak");
      sprintf (speaks1, "squeaks");
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_SERPENT))
    {
      sprintf (speak1, "hiss");
      sprintf (speaks1, "hisses");
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_FROG))
    {
      sprintf (speak1, "croak");
      sprintf (speaks1, "croaks");
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_RAVEN))
    {
      sprintf (speak1, "squark");
      sprintf (speaks1, "squarks");
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_ZULO))
    {
      if (IS_DEMON (ch))
	{
	  sprintf (speak1, "boom");
	  sprintf (speaks1, "booms");
	}
      else
	{
	  sprintf (speak1, "roar");
	  sprintf (speaks1, "roars");
	}
    }
  else if (IS_NPC (ch) && ch->pIndexData->vnum == MOB_VNUM_FROG)
    {
      sprintf (speak1, "croak");
      sprintf (speaks1, "croaks");
    }
  else if (IS_NPC (ch) && ch->pIndexData->vnum == MOB_VNUM_RAVEN)
    {
      sprintf (speak1, "squark");
      sprintf (speaks1, "squarks");
    }
  else if (IS_NPC (ch) && ch->pIndexData->vnum == MOB_VNUM_CAT)
    {
      sprintf (speak1, "purr");
      sprintf (speaks1, "purrs");
    }
  else if (IS_NPC (ch) && ch->pIndexData->vnum == MOB_VNUM_DOG)
    {
      sprintf (speak1, "bark");
      sprintf (speaks1, "barks");
    }
  else if (!IS_NPC (ch) && ch->pcdata->condition[COND_DRUNK] > 10)
    {
      sprintf (speak1, "slur");
      sprintf (speaks1, "slurs");
    }
  else if (IS_MORE (ch, MORE_SINGING))
    {
      sprintf (speak1, "sing");
      sprintf (speaks1, "sings");
    }
  else if (!IS_NPC (ch) && (ch->pcdata->exercise[EXE_COUNT] > 10 ||
			    ch->pcdata->exercise[EXE_RECOVER] > 10))
    {
      sprintf (speak1, "pant");
      sprintf (speaks1, "pants");
    }
  else if (!str_cmp (endbit1, "!"))
    {
      sprintf (speak1, "exclaim");
      sprintf (speaks1, "exclaims");
    }
  else if (!str_cmp (endbit1, "?"))
    {
      sprintf (speak1, "ask");
      sprintf (speaks1, "asks");
    }
  else if (secbit1[0] != '\0' && str_cmp (secbit1, ".")
	   && !str_cmp (endbit1, "."))
    {
      sprintf (speak1, "state");
      sprintf (speaks1, "states");
    }
  else if (secbit1[0] != '\0' && !str_cmp (secbit1, ".")
	   && !str_cmp (endbit1, "."))
    {
      sprintf (speak1, "mutter");
      sprintf (speaks1, "mutters");
    }
  else if (secbit1[0] != '\0' && (!str_cmp (secbit1, ":") ||
				  !str_cmp (secbit1, "=")
				  || !str_cmp (secbit1, ";"))
	   && !str_cmp (endbit1, ")"))
    {
      sprintf (speak1, "grin");
      sprintf (speaks1, "grins");
    }
  else if (secbit1[0] != '\0' && !str_cmp (secbit1, ":")
	   && !str_cmp (endbit1, "("))
    {
      sprintf (speak1, "frown");
      sprintf (speaks1, "frowns");
    }
  else
    {
      sprintf (speak1, "say");
      sprintf (speaks1, "says");
    }

  if (IS_BODY (ch, CUT_THROAT))
    {
      sprintf (speak2, "rasp");
      sprintf (speaks2, "rasps");
    }
  else if (!IS_NPC (ch) &&
	   (IS_SET (ch->act, PLR_WOLFMAN) || IS_POLYAFF (ch, POLY_WOLF)
	    || (IS_VAMPIRE (ch) && !IS_ABOMINATION (ch)
		&& ch->pcdata->vamprage > 0)))
    {
      if (number_percent () > 50)
	{
	  sprintf (speak2, "growl");
	  sprintf (speaks2, "growls");
	}
      else
	{
	  sprintf (speak2, "snarl");
	  sprintf (speaks2, "snarls");
	}
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_BAT))
    {
      sprintf (speak2, "squeak");
      sprintf (speaks2, "squeaks");
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_SERPENT))
    {
      sprintf (speak2, "hiss");
      sprintf (speaks2, "hisses");
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_FROG))
    {
      sprintf (speak2, "croak");
      sprintf (speaks2, "croaks");
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_RAVEN))
    {
      sprintf (speak2, "squark");
      sprintf (speaks2, "squarks");
    }
  else if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_ZULO))
    {
      if (IS_DEMON (ch))
	{
	  sprintf (speak2, "boom");
	  sprintf (speaks2, "booms");
	}
      else
	{
	  sprintf (speak2, "roar");
	  sprintf (speaks2, "roars");
	}
    }
  else if (IS_NPC (ch) && ch->pIndexData->vnum == MOB_VNUM_FROG)
    {
      sprintf (speak2, "croak");
      sprintf (speaks2, "croaks");
    }
  else if (IS_NPC (ch) && ch->pIndexData->vnum == MOB_VNUM_RAVEN)
    {
      sprintf (speak2, "squark");
      sprintf (speaks2, "squarks");
    }
  else if (IS_NPC (ch) && ch->pIndexData->vnum == MOB_VNUM_CAT)
    {
      sprintf (speak2, "purr");
      sprintf (speaks2, "purrs");
    }
  else if (IS_NPC (ch) && ch->pIndexData->vnum == MOB_VNUM_DOG)
    {
      sprintf (speak2, "bark");
      sprintf (speaks2, "barks");
    }
  else if (!IS_NPC (ch) && ch->pcdata->condition[COND_DRUNK] > 10)
    {
      sprintf (speak2, "slur");
      sprintf (speaks2, "slurs");
    }
  else if (IS_MORE (ch, MORE_SINGING))
    {
      sprintf (speak2, "sing");
      sprintf (speaks2, "sings");
      REMOVE_BIT (ch->more, MORE_SINGING);
    }
  else if (!IS_NPC (ch) && (ch->pcdata->exercise[EXE_COUNT] > 10 ||
			    ch->pcdata->exercise[EXE_RECOVER] > 10))
    {
      sprintf (speak2, "pant");
      sprintf (speaks2, "pants");
    }
  else if (!str_cmp (endbit2, "!"))
    {
      sprintf (speak2, "exclaim");
      sprintf (speaks2, "exclaims");
    }
  else if (!str_cmp (endbit2, "?"))
    {
      sprintf (speak2, "ask");
      sprintf (speaks2, "asks");
    }
  else if (secbit2[0] != '\0' && str_cmp (secbit2, ".")
	   && !str_cmp (endbit2, "."))
    {
      sprintf (speak2, "state");
      sprintf (speaks2, "states");
    }
  else if (secbit2[0] != '\0' && !str_cmp (secbit2, ".")
	   && !str_cmp (endbit2, "."))
    {
      sprintf (speak2, "mutter");
      sprintf (speaks2, "mutters");
    }
  else if (secbit2[0] != '\0' && (!str_cmp (secbit2, ":") ||
				  !str_cmp (secbit2, "=")
				  || !str_cmp (secbit2, ";"))
	   && !str_cmp (endbit2, ")"))
    {
      sprintf (speak2, "grin");
      sprintf (speaks2, "grins");
    }
  else if (secbit2[0] != '\0' && !str_cmp (secbit2, ":")
	   && !str_cmp (endbit2, "("))
    {
      sprintf (speak2, "frown");
      sprintf (speaks2, "frowns");
    }
  else
    {
      sprintf (speak2, "say");
      sprintf (speaks2, "says");
    }

  sprintf (poly1, "To %s: You %s '$T'.", victim->name, speak1);
  sprintf (poly2, "To others: You %s '$T'.", speak2);

  act (poly1, ch, NULL, arg2, TO_CHAR);
  act (poly2, ch, NULL, arg3, TO_CHAR);

  sprintf (poly1, "$n %s '$t'.", speaks1);
  sprintf (poly2, "$n %s '$t'.", speaks2);

  if (ch->in_room->vnum != ROOM_VNUM_IN_OBJECT)
    {
      act (poly1, ch, arg2, victim, TO_VICT);
      act (poly2, ch, arg3, victim, TO_NOTVICT);
      room_text (ch, strlower (arg2));
      return;
    }
  room_text (ch, strlower (arg2));
  return;
}

void
room_text (CHAR_DATA * ch, char *argument)
{
  CHAR_DATA *vch;
  CHAR_DATA *vch_next;
  CHAR_DATA *mob;
  CHAR_DATA *assassin;
  CHAR_DATA *vict;
  OBJ_DATA *obj;
  ROOMTEXT_DATA *rt;
  bool mobfound;
  bool hop;

  char arg[MIL];
  char arg1[MIL];
  char arg2[MIL];
  char buf[MSL];
  for (rt = ch->in_room->roomtext; rt != NULL; rt = rt->next)
    {
      if (!strcmp (argument, rt->input)
	  || is_in (argument, rt->input) || all_in (argument, rt->input))
	{
	  if (rt->name != NULL && rt->name != '\0'
	      && str_cmp (rt->name, "all") && str_cmp (rt->name, "|all*"))
	    if (!is_in (ch->name, rt->name))
	      continue;
	  mobfound = TRUE;
	  if (rt->mob != 0)
	    {
	      mobfound = FALSE;
	      for (vch = char_list; vch != NULL; vch = vch_next)
		{
		  vch_next = vch->next;
		  if (vch->in_room == NULL)
		    continue;
		  if (!IS_NPC (vch))
		    continue;
		  if (vch->in_room == ch->in_room
		      && vch->pIndexData->vnum == rt->mob)
		    {
		      mobfound = TRUE;
		      break;
		    }
		}
	    }
	  if (!mobfound)
	    continue;
	  hop = FALSE;
	  switch (rt->type % RT_RETURN)
	    {
	    case RT_SAY:
	      break;
	    case RT_LIGHTS:
	      do_changelight (ch, "");
	      break;
	    case RT_LIGHT:
	      REMOVE_BIT (ch->in_room->room_flags, ROOM_DARK);
	      break;
	    case RT_DARK:
	      SET_BIT (ch->in_room->room_flags, ROOM_DARK);
	      break;
	    case RT_OBJECT:
	      if (get_obj_index (rt->power) == NULL)
		return;
	      obj = create_object (get_obj_index (rt->power), ch->level);
	      if (IS_SET (rt->type, RT_TIMER))
		obj->timer = 60;
	      if (ch->carry_weight + get_obj_weight (obj) >
		  can_carry_w (ch) || ch->carry_number + 1 > can_carry_n (ch))
		extract_obj (obj);
	      else
		{
		  if (CAN_WEAR (obj, ITEM_TAKE))
		    obj_to_char (obj, ch);
		  else
		    obj_to_room (obj, ch->in_room);
		  if (!str_cmp (rt->choutput, "copy"))
		    act (rt->output, ch, obj, NULL, TO_CHAR);
		  else
		    act (rt->choutput, ch, obj, NULL, TO_CHAR);
		  if (!IS_SET (rt->type, RT_PERSONAL))
		    act (rt->output, ch, obj, NULL, TO_ROOM);
		}
	      hop = TRUE;
	      break;
	    case RT_MOBILE:
	      if (get_mob_index (rt->power) == NULL)
		return;
	      mob = create_mobile (get_mob_index (rt->power));
	      char_to_room (mob, ch->in_room);
	      if (!str_cmp (rt->choutput, "copy"))
		act (rt->output, ch, NULL, mob, TO_CHAR);
	      else
		act (rt->choutput, ch, NULL, mob, TO_CHAR);
	      if (!IS_SET (rt->type, RT_PERSONAL))
		act (rt->output, ch, NULL, mob, TO_ROOM);
	      hop = TRUE;
	      break;
	    case RT_SPELL:
	      (*skill_table[rt->power].spell_fun) (rt->power,
						   number_range (20, 30), ch,
						   ch);
	      break;
	    case RT_PORTAL:
	      if (get_obj_index (OBJ_VNUM_PORTAL) == NULL)
		return;
	      obj = create_object (get_obj_index (OBJ_VNUM_PORTAL), 0);
	      obj->timer = 5;
	      obj->value[0] = rt->power;
	      obj->value[1] = 1;
	      obj_to_room (obj, ch->in_room);
	      break;
	    case RT_TELEPORT:
	      if (get_room_index (rt->power) == NULL)
		return;
	      if (!str_cmp (rt->choutput, "copy"))
		act (rt->output, ch, NULL, NULL, TO_CHAR);
	      else
		act (rt->choutput, ch, NULL, NULL, TO_CHAR);
	      if (!IS_SET (rt->type, RT_PERSONAL))
		act (rt->output, ch, NULL, NULL, TO_ROOM);
	      char_from_room (ch);
	      char_to_room (ch, get_room_index (rt->power));
	      act ("$n appears in the room.", ch, NULL, NULL, TO_ROOM);
	      do_look (ch, "auto");
	      hop = TRUE;
	      break;
	    case RT_ACTION:
	      sprintf (arg, argument);
	      argument = one_argument (arg, arg1);
	      argument = one_argument (arg, arg2);
	      if ((mob = get_char_room (ch, arg2)) == NULL)
		continue;
	      if (IS_NPC (mob))
		SET_BIT (mob->act, ACT_COMMANDED);
	      interpret (mob, rt->output);
	      if (IS_NPC (mob))
		REMOVE_BIT (mob->act, ACT_COMMANDED);
	      break;
	    case RT_OPEN_LIFT:
	      open_lift (ch);
	      break;
	    case RT_CLOSE_LIFT:
	      close_lift (ch);
	      break;
	    case RT_MOVE_LIFT:
	      move_lift (ch, rt->power);
	      break;
            case RT_ASSASSIN:
              //revaddasssassinhere
           if (IS_ASSASSIN (ch))
                 return;
               //   return;
              vict = pick_victim (ch);
    // sprintf (buf, "check 1");
     //          do_say (ch, buf);
       //     if (vict == NULL)
         //    return;            
  for (assassin = ch->in_room->people; assassin != NULL;
       assassin = assassin->next_in_room)
    {
      if (!IS_NPC (assassin))
        continue;
      if (assassin->pIndexData->vnum == 3002)
        break;
    }

  if (assassin == NULL || assassin->pIndexData->vnum != 3002)
      return;
            if (vict == NULL) {
             vict = create_mobile (get_mob_index (46010));
             char_to_room (vict, get_room_index (ROOM_VNUM_ALTAR));
//             return; 
 }
     sprintf (buf, "kill %s", vict->name);

          do_say (assassin, buf);
           ch->assassin = vict;
              break;
	    default:
	      break;
	    }
	  if (hop && IS_SET (rt->type, RT_RETURN))
	    return;
	  else if (hop)
	    continue;
	  if (!str_cmp (rt->choutput, "copy")
	      && !IS_SET (rt->type, RT_ACTION))
	    act (rt->output, ch, NULL, NULL, TO_CHAR);
	  else if (!IS_SET (rt->type, RT_ACTION))
	    act (rt->choutput, ch, NULL, NULL, TO_CHAR);
	  if (!IS_SET (rt->type, RT_PERSONAL)
	      && !IS_SET (rt->type, RT_ACTION))
	    act (rt->output, ch, NULL, NULL, TO_ROOM);
	  if (IS_SET (rt->type, RT_RETURN))
	    return;
	}
    }
  return;
}

char *
strlower (char *ip)
{
  static char buffer[MSL];
  int pos;

  for (pos = 0; pos < (MSL - 1) && ip[pos] != '\0'; pos++)
    {
      buffer[pos] = tolower (ip[pos]);
    }
  buffer[pos] = '\0';
  return buffer;
}

bool
is_in (char *arg, char *ip)
{
  char *lo_arg;
  char cmp[MSL];
  int fitted;

  if (ip[0] != '|')
    return FALSE;
  cmp[0] = '\0';
  lo_arg = strlower (arg);
  do
    {
      ip += strlen (cmp) + 1;
      fitted = sscanf (ip, "%[^*]", cmp);
      if (strstr (lo_arg, cmp) != NULL)
	{
	  return TRUE;
	}
    }
  while (fitted > 0);
  return FALSE;
}

bool
check_in (char *arg, char *ip)
{
  char *lo_arg;
  char cmp[MSL];
  int fitted;

  if (ip[0] != '|')
    return FALSE;
  cmp[0] = '\0';
  lo_arg = str_dup (arg);
  do
    {
      ip += strlen (cmp) + 1;
      fitted = sscanf (ip, "%[^*]", cmp);
      if (strstr (lo_arg, cmp) != NULL)
	{
	  return TRUE;
	}
    }
  while (fitted > 0);
  return FALSE;
}

bool
all_in (char *arg, char *ip)
{
  char *lo_arg;
  char cmp[MSL];
  int fitted;

  if (ip[0] != '&')
    return FALSE;
  cmp[0] = '\0';
  lo_arg = strlower (arg);
  do
    {
      ip += strlen (cmp) + 1;
      fitted = sscanf (ip, "%[^*]", cmp);
      if (strstr (lo_arg, cmp) == NULL)
	{
	  return FALSE;
	}
    }
  while (fitted > 0);
  return TRUE;
}

void
do_tell (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  char poly[MSL];
  CHAR_DATA *victim;
  int position;
  char buf[MSL];

  if (IS_NPC (ch))
    return;

  if (!IS_IMMORTAL (ch))
    {
      char verb[MIL];

      sprintf (verb, "send tells");

      if (IS_HEAD (ch, LOST_TONGUE))
	{
	  sprintf (buf, "You can't %s without a tongue!\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (IS_EXTRA (ch, GAGGED))
	{
	  sprintf (buf, "You can't %s with a gag on!\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (!IS_NPC (ch) && IS_SET (ch->act, PLR_SILENCE))
	{
	  sprintf (buf, "You can't %s.\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (ch->in_room != NULL
	  && IS_SET (ch->in_room->added_flags, ROOM2_SILENCE))
	{
	  sprintf (buf, "You can't %s.\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (ch->in_room != NULL
	  && IS_SET (ch->in_room->room_flags, ROOM_SILENCE))
	{
	  sprintf (buf, "You can't %s.\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
    }


  argument = one_argument (argument, arg);

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

  /*
   * Can tell to PC's anywhere, but NPC's only in same room.
   * -- Furey
   */
  if ((victim = find_char_mud (ch, arg)) == NULL
      || (IS_NPC (victim) && victim->in_room != ch->in_room))
    {
      send_to_char ("They aren't here.\n\r", ch);
      return;
    }

  if (IS_IMMORTAL (victim) && !IS_IMMORTAL (ch))
    {
      send_to_char ("You can't send a tell to an Immortal.\n\r", ch);
      return;
    }
  if (!IS_IMMORTAL (ch) && !IS_AWAKE (victim))
    {
      act ("$E can't hear you.", ch, 0, victim, TO_CHAR);
      return;
    }

  if (!IS_NPC (victim) && victim->desc == NULL)
    {
      act ("$E is currently link dead.", ch, 0, victim, TO_CHAR);
      return;
    }

  if (IS_SET (victim->deaf, CHANNEL_TELL))
    {
      if (!IS_IMMORTAL (ch))
	{
	  if (IS_NPC (victim) || IS_NPC (ch)
	      || strlen (victim->pcdata->marriage) < 2
	      || str_cmp (ch->name, victim->pcdata->marriage))
	    {
	      act ("$E can't hear you.", ch, 0, victim, TO_CHAR);
	      return;
	    }
	}
    }

  sprintf (poly, "#gYou tell %s '#R$t#n'.",
	   IS_NPC (victim) ? victim->short_descr : victim->name);
  act (poly, ch, argument, victim, TO_CHAR);

  position = victim->position;
  victim->position = POS_STANDING;

  sprintf (poly, "#g%s tells you '#G$t#n'.",
	   IS_NPC (ch) ? ch->short_descr : ch->name);
  ADD_COLOUR (victim, poly, WHITE);
  act (poly, ch, argument, victim, TO_VICT);

  victim->position = position;
  victim->reply = ch;

  return;
}



void
do_whisper (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  CHAR_DATA *victim;

  if (IS_EXTRA (ch, GAGGED))
    {
      send_to_char ("Not with a gag on!\n\r", ch);
      return;
    }

  argument = one_argument (argument, arg);

  if (arg[0] == '\0' || argument[0] == '\0')
    {
      send_to_char ("Syntax: whisper <person> <message>\n\r", ch);
      return;
    }

  if ((victim = get_char_world (ch, arg)) == NULL
      || (victim->in_room != ch->in_room))
    {
      send_to_char ("They aren't here.\n\r", ch);
      return;
    }

  if (!IS_AWAKE (victim))
    {
      act ("$E cannot hear you.", ch, 0, victim, TO_CHAR);
      return;
    }

  if (!IS_NPC (victim) && victim->desc == NULL)
    {
      act ("$E is currently link dead.", ch, 0, victim, TO_CHAR);
      return;
    }

  act ("You whisper to $N '#y$t#n'.", ch, argument, victim, TO_CHAR);
  act ("$n whispers to you '#y$t#n'.", ch, argument, victim, TO_VICT);
  act ("$n whispers something to $N.", ch, NULL, victim, TO_NOTVICT);

  return;
}



void
do_reply (CHAR_DATA * ch, char *argument)
{
  char poly[MSL];
  CHAR_DATA *victim;
  int position;
  char buf[MSL];

  if (IS_NPC (ch))
    return;

  if (!IS_IMMORTAL (ch))
    {
      char verb[MIL];

      sprintf (verb, "reply");

      if (IS_HEAD (ch, LOST_TONGUE))
	{
	  sprintf (buf, "You can't %s without a tongue!\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (IS_EXTRA (ch, GAGGED))
	{
	  sprintf (buf, "You can't %s with a gag on!\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (!IS_NPC (ch) && IS_SET (ch->act, PLR_SILENCE))
	{
	  sprintf (buf, "You can't %s.\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (ch->in_room != NULL
	  && IS_SET (ch->in_room->added_flags, ROOM2_SILENCE))
	{
	  sprintf (buf, "You can't %s.\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (ch->in_room != NULL
	  && IS_SET (ch->in_room->room_flags, ROOM_SILENCE))
	{
	  sprintf (buf, "You can't %s.\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
    }


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

  if (!IS_IMMORTAL (ch) && !IS_AWAKE (victim))
    {
      act ("$E can't hear you.", ch, 0, victim, TO_CHAR);
      return;
    }

  if (!IS_NPC (victim) && victim->desc == NULL)
    {
      act ("$E is currently link dead.", ch, 0, victim, TO_CHAR);
      return;
    }

  sprintf (poly, "#gYou reply to %s '#R$t#n'.",
	   IS_NPC (victim) ? victim->short_descr : victim->name);
  act (poly, ch, argument, victim, TO_CHAR);

  position = victim->position;
  victim->position = POS_STANDING;

  sprintf (poly, "#g%s replies '#R$t#n'.",
	   IS_NPC (ch) ? ch->short_descr : ch->name);
  ADD_COLOUR (victim, poly, WHITE);
  act (poly, ch, argument, victim, TO_VICT);

  victim->position = position;
  victim->reply = ch;

  return;
}



void
do_emote (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  char *plast;

  char name[80];
  char poly[MIL];
  CHAR_DATA *to;
  bool is_ok;

  if (IS_NPC (ch) && IS_SET (ch->act, ACT_NOPARTS))
    {
      send_to_char ("You can't show your emotions.\n\r", ch);
      return;
    }
  if (!IS_NPC (ch) && IS_SET (ch->act, PLR_NO_EMOTE))
    {
      send_to_char ("You can't show your emotions.\n\r", ch);
      return;
    }

  if (IS_HEAD (ch, LOST_TONGUE) || IS_HEAD (ch, LOST_HEAD)
      || IS_EXTRA (ch, GAGGED))
    {
      send_to_char ("You can't show your emotions.\n\r", ch);
      return;
    }

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

  for (plast = argument; *plast != '\0'; plast++)
    ;

  strcpy (buf, argument);
  if (isalpha (plast[-1]))
    strcat (buf, ".");

  act ("$n $T", ch, NULL, buf, TO_CHAR);

  if (ch->in_room->vnum != ROOM_VNUM_IN_OBJECT)
    {
      act ("$n $T", ch, NULL, buf, TO_ROOM);
      return;
    }

  to = ch->in_room->people;
  for (; to != NULL; to = to->next_in_room)
    {
      is_ok = FALSE;

      if (to->desc == NULL || !IS_AWAKE (to))
	continue;

      if (ch == to)
	continue;

      if (!IS_NPC (ch) && ch->pcdata->chobj != NULL &&
	  ch->pcdata->chobj->in_room != NULL &&
	  !IS_NPC (to) && to->pcdata->chobj != NULL &&
	  to->pcdata->chobj->in_room != NULL && ch->in_room == to->in_room)
	is_ok = TRUE;
      else
	is_ok = FALSE;

      if (!IS_NPC (ch) && ch->pcdata->chobj != NULL &&
	  ch->pcdata->chobj->in_obj != NULL &&
	  !IS_NPC (to) && to->pcdata->chobj != NULL &&
	  to->pcdata->chobj->in_obj != NULL &&
	  ch->pcdata->chobj->in_obj == to->pcdata->chobj->in_obj)
	is_ok = TRUE;
      else
	is_ok = FALSE;

      if (!is_ok)
	continue;

      if (IS_NPC (ch))
	sprintf (name, ch->short_descr);
      else if (!IS_NPC (ch) && IS_AFFECTED (ch, AFF_POLYMORPH))
	sprintf (name, ch->morph);
      else
	sprintf (name, ch->name);
      name[0] = UPPER (name[0]);
      sprintf (poly, "%s %s\n\r", name, buf);
      send_to_char (poly, to);
    }
  return;
}



void
do_xemote (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  char buf2[MSL];
  char oldarg[MSL];
  char *plast;

  char name[80];
  char you[80];
  char them[80];
  char poly[MIL];
  char arg[MIL];
  CHAR_DATA *to;
  CHAR_DATA *victim;
  bool is_ok;

  argument = one_argument (argument, arg);

  if (!IS_NPC (ch) && IS_POLYAFF (ch, POLY_ZULO))
    {
      if (IS_DEMON (ch))
	send_to_char ("Not in Demon Form.\n\r", ch);
      else
	send_to_char ("Not in Zulo Form.\n\r", ch);
      return;
    }

  if (IS_NPC (ch) && IS_SET (ch->act, ACT_NOPARTS))
    {
      send_to_char ("You can't show your emotions.\n\r", ch);
      return;
    }
  if (!IS_NPC (ch) && IS_SET (ch->act, PLR_NO_EMOTE))
    {
      send_to_char ("You can't show your emotions.\n\r", ch);
      return;
    }

  if (IS_HEAD (ch, LOST_TONGUE) || IS_HEAD (ch, LOST_HEAD)
      || IS_EXTRA (ch, GAGGED))
    {
      send_to_char ("You can't show your emotions.\n\r", ch);
      return;
    }

  if (strlen (argument) > MIL)
    {
      send_to_char ("Line too long.\n\r", ch);
      return;
    }

  if (argument[0] == '\0' || arg[0] == '\0')
    {
      send_to_char ("Syntax: emote <person> <sentence>\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 (ch))
    strcpy (you, ch->short_descr);
  else
    strcpy (you, ch->name);
  if (IS_NPC (victim))
    strcpy (you, victim->short_descr);
  else
    strcpy (you, victim->name);
/*
oldarg = argument;
*/
  strcpy (oldarg, argument);
  strcpy (buf, argument);
  for (plast = argument; *plast != '\0'; plast++)
    ;

  if (isalpha (plast[-1]))
    strcat (buf, ".");
  argument = socialc (ch, buf, you, them);

  strcpy (buf, argument);
  strcpy (buf2, "You ");
  buf[0] = LOWER (buf[0]);
  strcat (buf2, buf);
  capitalize (buf2);
  act (buf2, ch, NULL, victim, TO_CHAR);

  if (ch->in_room->vnum != ROOM_VNUM_IN_OBJECT)
    {
      strcpy (buf, oldarg);
      for (plast = argument; *plast != '\0'; plast++)
	;
      if (isalpha (plast[-1]))
	strcat (buf, ".");

      argument = socialn (ch, buf, you, them);

      strcpy (buf, argument);
      strcpy (buf2, "$n ");
      buf[0] = LOWER (buf[0]);
      strcat (buf2, buf);
      capitalize (buf2);
      act (buf2, ch, NULL, victim, TO_NOTVICT);

      strcpy (buf, oldarg);
      for (plast = argument; *plast != '\0'; plast++)
	;
      if (isalpha (plast[-1]))
	strcat (buf, ".");

      argument = socialv (ch, buf, you, them);

      strcpy (buf, argument);
      strcpy (buf2, "$n ");
      buf[0] = LOWER (buf[0]);
      strcat (buf2, buf);
      capitalize (buf2);
      act (buf2, ch, NULL, victim, TO_VICT);
      return;
    }

  to = ch->in_room->people;
  for (; to != NULL; to = to->next_in_room)
    {
      is_ok = FALSE;

      if (to->desc == NULL || !IS_AWAKE (to))
	continue;

      if (ch == to)
	continue;

      if (!IS_NPC (ch) && ch->pcdata->chobj != NULL &&
	  ch->pcdata->chobj->in_room != NULL &&
	  !IS_NPC (to) && to->pcdata->chobj != NULL &&
	  to->pcdata->chobj->in_room != NULL && ch->in_room == to->in_room)
	is_ok = TRUE;
      else
	is_ok = FALSE;

      if (!IS_NPC (ch) && ch->pcdata->chobj != NULL &&
	  ch->pcdata->chobj->in_obj != NULL &&
	  !IS_NPC (to) && to->pcdata->chobj != NULL &&
	  to->pcdata->chobj->in_obj != NULL &&
	  ch->pcdata->chobj->in_obj == to->pcdata->chobj->in_obj)
	is_ok = TRUE;
      else
	is_ok = FALSE;

      if (!is_ok)
	continue;

      if (IS_NPC (ch))
	sprintf (name, ch->short_descr);
      else if (!IS_NPC (ch) && IS_AFFECTED (ch, AFF_POLYMORPH))
	sprintf (name, ch->morph);
      else
	sprintf (name, ch->name);
      name[0] = UPPER (name[0]);
      sprintf (poly, "%s %s\n\r", name, buf);
      send_to_char (poly, to);
    }
  return;
}



void
do_bug (CHAR_DATA * ch, char *argument)
{
  append_file (ch, BUG_FILE, argument);
  send_to_char ("Ok.  Thanks.\n\r", ch);
  return;
}



void
do_idea (CHAR_DATA * ch, char *argument)
{
  append_file (ch, IDEA_FILE, argument);
  send_to_char ("Ok.  Thanks.\n\r", ch);
  return;
}



void
do_typo (CHAR_DATA * ch, char *argument)
{
  append_file (ch, TYPO_FILE, argument);
  send_to_char ("Ok.  Thanks.\n\r", ch);
  return;
}



void
do_rent (CHAR_DATA * ch, char *argument)
{
  send_to_char ("There is no rent here.  Just save and quit.\n\r", ch);
  return;
}



void
do_qui (CHAR_DATA * ch, char *argument)
{
  send_to_char ("If you want to QUIT, you have to spell it out.\n\r", ch);
  return;
}



void
do_quit (CHAR_DATA * ch, char *argument)
{
  DESCRIPTOR_DATA *d;
  char buf[MSL];
  char stat[MSL];
  OBJ_DATA *obj;
  OBJ_DATA *obj_next;
  CHAR_DATA *mount;
  int temp_num;

  smash_tilde (argument);

  if (IS_NPC (ch))
    {
      if (ch->wizard != NULL)
	{
	  if (IS_AFFECTED (ch, AFF_ETHEREAL))
	    return;
	}
      send_to_char
	("\n\r                         Speak not: whisper not:\n\r", ch);
      send_to_char
	("                      I know all that ye would tell,\n\r", ch);
      send_to_char
	("                    But to speak might break the spell\n\r", ch);
      send_to_char
	("                      Which must bend the invincible,\n\r", ch);
      send_to_char ("                          The stern of thought;\n\r",
		    ch);
      send_to_char
	("                 He yet defies the deepest power of Hell.\n\r\n\r",
	 ch);
      act ("$n has left the game.", ch, NULL, NULL, TO_ROOM);
      sprintf (buf, "#R%s#7 has left #cDreams#7 of#0 Demise#7.#n",
	       ch->short_descr);
      buf[0] = UPPER (buf[0]);
/*
	do_info(ch,buf);
*/
      extract_char (ch, TRUE);
      return;
    }
  if (quit_timer (ch))
    {
      return;
    }
  if (ch->safetimer > 0 && IS_NYM (ch, NYM_DEAD))
    {
      stc ("Not untill you reach valhalla!\n\r", ch);
      return;
    }
  if (ch->assassin != NULL) {
       ch->countdown = number_range (240, 360);
      stc ("Giving up on your quest? wuss.\n\r", ch);
  }
  if (IS_XXX (ch, XXX_SKINRODE))
    REMOVE_BIT (ch->xxxbits, XXX_SKINRODE);
  if (ch->pcdata->obj_vnum != 0)
    {
      stc ("You cant quit while in an itemform!\n\r", ch);
      return;
    }
  if (ch->position == POS_FIGHTING)
    {
      send_to_char ("No way! You are fighting.\n\r", ch);
      return;
    }

  if (ch->position < POS_SLEEPING)
    {
      send_to_char ("You're not DEAD yet.\n\r", ch);
      return;
    }
  if (IS_XBITS (ch, X_SLEEP))
    {
      stc ("You can't quit while cradled.\n\r", ch);
      return;
    }
  if (IS_SET (ch->corbits, COR_INARENA) || is_inarena (ch))
    {
      stc ("You cannot quit while you're in the arena.\n\r", ch);
      return;
    }

  if (has_fighttimer (ch))
    {
      send_to_char ("Not with a fight timer.\n\r", ch);
      return;
    }

  do_call (ch, "all");
  do_save (ch, "");
  do_autosave (ch, "");

  if (!IS_NPC (ch) && IS_MORE (ch, MORE_DARKNESS))
    {
      if (ch->in_room != NULL)
	{
	  REMOVE_BIT (ch->in_room->room_flags, ROOM_TOTAL_DARKNESS);
	  REMOVE_BIT (ch->more, MORE_DARKNESS);
	  ch->pcdata->darkness = 60;
	  send_to_char
	    ("The darkness in the room gradually fades away to nothing.\n\r",
	     ch);
	  act ("The darkness in the room gradually fades away to nothing.",
	       ch, NULL, NULL, TO_ROOM);
	}
    }
  if (!IS_NPC (ch)
      && (IS_COR (ch, COR_CHALLENGED) || IS_COR (ch, COR_CHALLENGER)))
    undo_arena (ch);

  if (!IS_NPC (ch) && IS_COR (ch, COR_DARKNESS))
    {
      if (ch->in_room != NULL)
	{
	  REMOVE_BIT (ch->in_room->room_flags, ROOM_DJINN_DARKNESS);
	  REMOVE_BIT (ch->more, COR_DARKNESS);
	  ch->darkdjinn = 60;
	  send_to_char
	    ("The darkness in the room gradually fades away to nothing.\n\r",
	     ch);
	  act ("The darkness in the room gradually fades away to nothing.",
	       ch, NULL, NULL, TO_ROOM);
	}
    }
  if (!IS_NPC (ch) && IS_MORE (ch, MORE_SILENCE))
    {
      if (ch->in_room != NULL)
	{
	  REMOVE_BIT (ch->in_room->added_flags, ROOM2_SILENCE);
	  REMOVE_BIT (ch->more, MORE_SILENCE);
	  ch->pcdata->silence = 60;
	  send_to_char ("The room is no longer silent.\n\r", ch);
	  act ("The room is no longer silent.", ch, NULL, NULL, TO_ROOM);
	}
    }
  if (!IS_NPC (ch) && IS_MORE (ch, MORE_REINA))
    {
      if (ch->in_room != NULL)
	{
	  REMOVE_BIT (ch->in_room->room_flags, ROOM_SAFE);
	  REMOVE_BIT (ch->more, MORE_REINA);
	  ch->pcdata->reina = 60;
	  send_to_char
	    ("The peaceful harmony in the air gradually fades away to nothing.\n\r",
	     ch);
	  act
	    ("The peaceful harmony in the air gradually fades away to nothing.",
	     ch, NULL, NULL, TO_ROOM);
	}
    }
  if (!IS_NPC (ch) && IS_MORE (ch, MORE_NEUTRAL))
    {
      if (ch->in_room != NULL)
	{
	  REMOVE_BIT (ch->in_room->room_flags, ROOM_SAFE);
	  REMOVE_BIT (ch->more, MORE_NEUTRAL);
	  ch->pcdata->obeah = 30;
	  if (IS_DRACONIAN (ch))
	    {
	      send_to_char
		("The truce granted by your Dragon forefathers is slowly disbanded.\n\r",
		 ch);
	      act
		("The truce granted by the Dragon forefathers is slowly disbanded.",
		 ch, NULL, NULL, TO_ROOM);
	    }
	  else
	    {
	      send_to_char
		("The peaceful harmony in the air gradually fades away to nothing.\n\r",
		 ch);
	      act
		("The peaceful harmony in the air gradually fades away to nothing.",
		 ch, NULL, NULL, TO_ROOM);
	    }
	}
    }

  temp_num = get_totalscore (ch);

  if ((mount = ch->mount) != NULL)
    do_dismount (ch, "");

  quitmessage (ch, "");

  /* Free note that might be there somehow */
  if (ch->pcdata->in_progress)
    free_note (ch->pcdata->in_progress);

  /*
   * After extract_char the ch is no longer valid!
   */
  d = ch->desc;
  for (obj = ch->carrying; obj != NULL; obj = obj_next)
    {
      obj_next = obj->next_content;
      if (obj->item_type == ITEM_PIECE)
	{
	  act ("$p fades from $n's hands and scatters to the wind.\n\r", ch,
	       obj, NULL, TO_ROOM);
	  do_hideaway (ch, obj->name);
	  continue;
	}

      if (obj->wear_loc == WEAR_NONE)
	continue;
      if (!IS_NPC (ch) && ((obj->chobj != NULL && !IS_NPC (obj->chobj) &&
			    obj->chobj->pcdata->obj_vnum != 0)
			   || obj->item_type == ITEM_KEY))
	{
	  unequip_char (ch, obj);
	  extract_obj (obj);
	}
    }
  do_autosave (ch, "");
/*        if (!IS_IMMORTAL(ch) && !IS_NPC(ch))
        {
	  if (ch->level > 2 ) 
	  {
            sprintf(stat,"Quit. Name: %s, life: %d, mp: %d, vital: %d, Exp: %ld",ch->name,ch->max_hit,ch->max_mana,ch->max_move,ch->exp);
            stats_string(stat,0);
	  }
        }
*/
  if (ch->pcdata->obj_vnum != 0)
    act ("$n slowly fades out of existence.", ch, NULL, NULL, TO_ROOM);
  else
    {
      if (ch->stance[0] != -1)
	{
	  ch->stance[0] = -1;
	  send_to_char ("You relax from your fighting stance.\n\r", ch);
	  act ("$n relaxes from $s fighting stance.", ch, NULL, NULL,
	       TO_ROOM);
	}
      act ("$n has left the game.", ch, NULL, NULL, TO_ROOM);
    }

  if (ch->in_room != NULL)
    char_from_room (ch);
  char_to_room (ch, get_room_index (ROOM_VNUM_DISCONNECTION));

  sprintf (log_buf, "%s has quit.", ch->name);
  if ((obj = ch->pcdata->chobj) != NULL)
    {
      obj->chobj = NULL;
      ch->pcdata->chobj = NULL;

      if (strlen (ch->logoutmsg) > 2)
	{
	  sprintf (buf, "#R%s#n %s#n", ch->name, ch->logoutmsg);
	}
      else
	{
	  sprintf (buf, "#R%s#7 has left #cDreams#7 of#0 Demise#7.#n",
		   ch->name);
	}
      if (!IS_NPC (ch) && IS_IMMORTAL (ch) && !IS_SET (ch->act, PLR_WIZINVIS))
	{
	  do_info (ch, buf);
	}
      else if (!IS_NPC (ch) && !IS_IMMORTAL (ch))
	{
	  do_info (ch, buf);
	}
      if (d != NULL)
	close_socket2 (d);
      extract_obj (obj);
    }
  else if (ch->pcdata->obj_vnum == 0)
    {
      if (strlen (ch->logoutmsg) > 2)
	{
	  sprintf (buf, "#R%s#n %s#n", ch->name, ch->logoutmsg);
	}
      else
	{
	  sprintf (buf, "#R%s#7 has left #cDreams#7 of#0 Demise#7.#n",
		   ch->name);
	}
      if (!IS_NPC (ch) && IS_IMMORTAL (ch) && !IS_SET (ch->act, PLR_WIZINVIS))
	{
	  do_info (ch, buf);
	}
      else if (!IS_NPC (ch) && !IS_IMMORTAL (ch))
	{
	  do_info (ch, buf);
	}
      if (d != NULL)
	close_socket2 (d);
    }
  log_string (log_buf);
  extract_char (ch, TRUE);
  return;
}

void
nukesave (CHAR_DATA * ch)
{
  if (IS_NPC (ch))
    return;

  if (!IS_IMMORTAL (ch) && ch->mkill < 5000 && !IS_XXX (ch, XXX_META))
    {
      return;
    }

  save_char_nuked (ch);
  return;
}

void
deletesave (CHAR_DATA * ch)
{
  if (IS_NPC (ch))
    return;

  if (!IS_IMMORTAL (ch) && ch->mkill < 5000)
    {
      return;
    }

  save_char_deleted (ch);
  return;
}

void
do_save (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;
  if (ch->pcdata->savetime > 0)
    {
      stc ("You cant save that often!\n\r", ch);
      return;
    }
  if (!IS_IMMORTAL (ch) && ch->mkill < 5)
    {
      send_to_char ("You must kill at least 5 mobs before you can save.\n\r",
		    ch);
      return;
    }
  ch->pcdata->savetime = 5;
  get_totalscore (ch);
  save_char_obj (ch);
  send_to_char ("Saved.\n\r", ch);
  return;
}

void
do_backup (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;

  if (!IS_IMMORTAL (ch) && ch->mkill < 100)
    {
      send_to_char
	("You must kill at least 100 mobs before you can backup.\n\r", ch);
      return;
    }

  save_char_backup (ch);
  send_to_char ("Backup done.\n\r", ch);
  return;
}



void
do_autosave (CHAR_DATA * ch, char *argument)
{
  if (IS_NPC (ch))
    return;
  if (ch->level < 2)
    return;
  if (IS_SET (ch->act, ACT_IS_NPC))
    return;
  if (ch->mkill < 5 && !IS_IMMORTAL (ch))
    return;
  save_char_obj (ch);
  return;
}



void
do_follow (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  CHAR_DATA *victim;

  one_argument (argument, arg);

  if (arg[0] == '\0')
    {
      send_to_char ("Follow whom?\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_AFFECTED (ch, AFF_CHARM) && ch->master != NULL)
    {
      act ("But you'd rather follow $N!", ch, NULL, ch->master, TO_CHAR);
      return;
    }

  if (victim == ch)
    {
      if (ch->master == NULL)
	{
	  send_to_char ("You already follow yourself.\n\r", ch);
	  return;
	}
      stop_follower (ch);
      return;
    }

  if (ch->master != NULL)
    stop_follower (ch);

  add_follower (ch, victim);
  return;
}



void
add_follower (CHAR_DATA * ch, CHAR_DATA * master)
{
  if (ch->master != NULL)
    {
      bug ("Add_follower: non-null master.", 0);
      return;
    }

  ch->master = master;
  ch->leader = NULL;
  if (!IS_NPC (master) && !IS_NPC (ch))
    master->pcdata->follow++;

  if (can_see (master, ch) && !IS_WRAITH (ch))
    act ("$n now follows you.", ch, NULL, master, TO_VICT);

  act ("You now follow $N.", ch, NULL, master, TO_CHAR);

  return;
}



void
stop_follower (CHAR_DATA * ch)
{
  CHAR_DATA *victim;

  if (ch->master == NULL)
    {
      bug ("Stop_follower: null master.", 0);
      return;
    }

  victim = ch->master;

  if (IS_AFFECTED (ch, AFF_CHARM))
    {
      REMOVE_BIT (ch->affected_by, AFF_CHARM);
      affect_strip (ch, gsn_charm_person);
    }

  if (can_see (ch->master, ch))
    act ("$n stops following you.", ch, NULL, ch->master, TO_VICT);
  act ("You stop following $N.", ch, NULL, ch->master, TO_CHAR);

  ch->master = NULL;
  ch->leader = NULL;
  if (!IS_NPC (victim) && !IS_NPC (ch))
    {
      victim->pcdata->follow--;
      if (victim->pcdata->follow < 0)
	victim->pcdata->follow = 0;
    }
  return;
}



void
die_follower (CHAR_DATA * ch)
{
  CHAR_DATA *fch;
  CHAR_DATA *fch_next;

  if (ch->master != NULL)
    stop_follower (ch);

  ch->leader = NULL;

  for (fch = char_list; fch != NULL; fch = fch_next)
    {
      fch_next = fch->next;
      if (fch->leader == ch)
	fch->leader = fch;
      if (fch->master == ch)
	stop_follower (fch);
      if (!IS_NPC (ch) && IS_NPC (fch) && fch->lord != NULL)
	{
	  if (strlen (fch->lord) > 1 && !str_cmp (fch->lord, ch->name))
	    {
	      act ("$n slowly fades out of existence.", fch, NULL, NULL,
		   TO_ROOM);
	      extract_char (fch, TRUE);
	    }
	}
    }

  return;
}



void
do_order (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  CHAR_DATA *victim;
  CHAR_DATA *och;
  CHAR_DATA *och_next;
  bool found;
  bool fAll;
  bool is_animal = FALSE;
  bool is_spirit = FALSE;

  argument = one_argument (argument, arg);

  if (arg[0] == '\0' || argument[0] == '\0')
    {
      send_to_char ("Order whom to do what?\n\r", ch);
      return;
    }

  if (IS_AFFECTED (ch, AFF_CHARM))
    {
      send_to_char ("You feel like taking, not giving, orders.\n\r", ch);
      return;
    }

  if (!str_cmp (arg, "all"))
    {
      if (is_in
	  (argument,
	   "|quit*rem*drop*gift*claim*autoclass*consent*propose*accept*vampi*ma *maj*sid *side *reca*/*ha *hav*cc *credit*untrain*cot*train*arenaagree*challenge*"))
	{
	  send_to_char ("You cannot make that sort of order.\n\r", ch);
	  return;
	}

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

      if (victim == ch)
	{
	  send_to_char ("Aye aye, right away!\n\r", ch);
	  return;
	}

      if (is_in
	  (argument,
	   "|quit*rem*drop*gift*claim*autoclass*consent*propose*accept*vampi*ma *maj*sid *side *reca*/*ha *hav*cc *credit*untrain*cot*train*arenaagree*challenge*"))
	{
	  send_to_char ("You cannot make that sort of order.\n\r", ch);
	  return;
	}

      if (IS_NPC (victim))
	switch (victim->pIndexData->vnum)
	  {
	  default:
	    is_animal = FALSE;
	    break;
	  case 3062:
	  case 3066:
	  case 5333:
	  case 30006:
	  case 30007:
	  case 30008:
	  case 30009:
	  case 30010:
	  case 30013:
	  case 30014:
	    is_animal = TRUE;
	    break;
	  }
      else
	is_animal = FALSE;
      if (IS_SPIRIT (victim))
	is_spirit = TRUE;
      else
	is_spirit = FALSE;
      if (!IS_AFFECTED (victim, AFF_CHARM) || victim->master != ch)
	{
	  if (IS_NPC (ch) || IS_NPC (victim) ||
	      strlen (victim->pcdata->love) < 2 ||
	      str_cmp (victim->pcdata->love, ch->name))
	    {
	      if (!is_animal || !IS_MORE (ch, MORE_ANIMAL_MASTER))
		{
		  if (!is_spirit || !IS_WEREWOLF (ch)
		      || get_disc (ch, AUSPICE_THEURGE) < 3)
		    {
		      send_to_char ("Do it yourself!\n\r", ch);
		      return;
		    }
		}
	    }
	}
    }

  found = FALSE;
  is_animal = FALSE;
  is_spirit = FALSE;
  for (och = ch->in_room->people; och != NULL; och = och_next)
    {
      och_next = och->next_in_room;
      if (och == ch)
	continue;
      if (IS_NPC (och))
	switch (och->pIndexData->vnum)
	  {
	  default:
	    is_animal = FALSE;
	    break;
	  case 3062:
	  case 3066:
	  case 5333:
	  case 30006:
	  case 30007:
	  case 30008:
	  case 30009:
	  case 30010:
	  case 30013:
	  case 30014:
	    is_animal = TRUE;
	    break;
	  }
      else
	is_animal = FALSE;
      if (IS_SPIRIT (och))
	is_spirit = TRUE;
      else
	is_spirit = FALSE;
      if ((IS_AFFECTED (och, AFF_CHARM)
	   && och->master == ch && (fAll || och == victim)))
	{
	  found = TRUE;
	  act ("$n orders you to '$t'.", ch, argument, och, TO_VICT);
	  if (IS_NPC (och))
	    SET_BIT (och->act, ACT_COMMANDED);
	  interpret (och, argument);
	  if (IS_NPC (och))
	    REMOVE_BIT (och->act, ACT_COMMANDED);
	  waiting (ch, 12);
	}
      else if (!IS_NPC (ch) && !IS_NPC (och) && strlen (och->pcdata->love) > 1
	       && !str_cmp (och->pcdata->love, ch->name) && (fAll
							     || och ==
							     victim))
	{
	  found = TRUE;
	  act ("$n orders you to '$t'.", ch, argument, och, TO_VICT);
	  if (IS_NPC (och))
	    SET_BIT (och->act, ACT_COMMANDED);
	  interpret (och, argument);
	  if (IS_NPC (och))
	    REMOVE_BIT (och->act, ACT_COMMANDED);
	  waiting (ch, 12);
	}
      else if (is_animal && IS_MORE (ch, MORE_ANIMAL_MASTER)
	       && (fAll || och == victim))
	{
	  found = TRUE;
	  act ("$n asks you to '$t'.", ch, argument, och, TO_VICT);
	  if (IS_NPC (och))
	    SET_BIT (och->act, ACT_COMMANDED);
	  interpret (och, argument);
	  if (IS_NPC (och))
	    REMOVE_BIT (och->act, ACT_COMMANDED);
	  waiting (ch, 12);
	}
      else if (is_spirit && IS_WEREWOLF (ch)
	       && get_auspice (ch, AUSPICE_THEURGE) > 2 && (fAll
							    || och == victim))
	{
	  found = TRUE;
	  act ("$n asks you to '$t'.", ch, argument, och, TO_VICT);
	  if (IS_NPC (och))
	    SET_BIT (och->act, ACT_COMMANDED);
	  interpret (och, argument);
	  if (IS_NPC (och))
	    REMOVE_BIT (och->act, ACT_COMMANDED);
	  waiting (ch, 12);
	}
    }

  if (found)
    send_to_char ("Ok.\n\r", ch);
  else
    send_to_char ("You have no followers here.\n\r", ch);
  return;
}



void
do_command (CHAR_DATA * ch, char *argument)
{
  char arg[MIL];
  char action[MIL];
  char buf[MSL];
  CHAR_DATA *victim;
  CHAR_DATA *vch_next;
  int level;

  argument = one_argument (argument, arg);

  if (IS_NPC (ch))
    return;
  if (!IS_MAGE (ch) && !IS_VAMPIRE (ch) && !IS_GHOUL (ch))
    {
      send_to_char ("Huh?\n\r", ch);
      return;
    }
  if (IS_MAGE (ch) && !IS_LICH (ch))
    {
      if (ch->spheres[MMIN] < 2)
	{
	  send_to_char
	    ("You must obtain level 2 Mind to use control impulses.\n\r", ch);
	  return;
	}
    }
  if (IS_VAMPIRE (ch) && get_disc (ch, DISC_DOMINATE) < 1)
    {
      send_to_char ("You require level 1 Dominate to Command people.\n\r",
		    ch);
      return;
    }

  if (arg[0] == '\0' || argument[0] == '\0')
    {
      send_to_char ("Command whom to do what?\n\r", ch);
      return;
    }

  strcpy (action, argument);

  if (is_in
      (action,
       "|quit*rem*drop*gift*claim*autoclass*consent*propose*vampi*ma *maj*sid *side *reca*/*ha *hav* *cc* *credit*untrain*cot*train*arenaagree*challenge*"))
    {
      send_to_char ("I think not.\n\r", ch);
      return;
    }

  if (IS_MAGE (ch))
    level = ch->spheres[MMIN] * 20;
  else
    level = get_disc (ch, DISC_DOMINATE) * 10;

  if (!str_cmp (arg, "all") && get_disc (ch, DISC_DOMINATE) >= 5)
    {
      sprintf (buf, "I think everyone wants to %s", action);
      do_say (ch, buf);
      waiting (ch, 24);
      for (victim = ch->in_room->people; victim != NULL; victim = vch_next)
	{
	  vch_next = victim->next_in_room;
	  if (victim == ch)
	    continue;
	  if (IS_IMMORTAL (victim))
	    continue;
	  if (is_safe (ch, victim))
	    continue;

	  if (!IS_NPC (victim) && strlen (victim->pcdata->conding) > 2 &&
	      !str_cmp (victim->pcdata->conding, ch->name))
	    {
	      act ("You blink in confusion.", victim, NULL, NULL, TO_CHAR);
	      act ("$n blinks in confusion.", victim, NULL, NULL, TO_ROOM);
	      strcpy (buf, "Yes, you're right, I do...");
	      do_say (victim, buf);
	      if (IS_NPC (victim))
		SET_BIT (victim->act, ACT_COMMANDED);
	      interpret (victim, action);
	      if (IS_NPC (victim))
		REMOVE_BIT (victim->act, ACT_COMMANDED);
	      if (!IS_NPC (victim) && ch != victim
		  && IS_MORE (victim, MORE_GUARDIAN))
		{
		  guardian_message (victim);
		  act ("$n just used Command on you.", ch, NULL, victim,
		       TO_VICT);
		}
	      continue;
	    }

	  if (!IS_NPC (victim) && IS_VAMPIRE (victim)
	      && victim->vampgen < ch->vampgen)
	    {
	      act ("You shake off $N's suggestion.", victim, NULL, ch,
		   TO_CHAR);
	      act ("$n shakes off $N's suggestion.", victim, NULL, ch,
		   TO_NOTVICT);
	      act ("$n shakes off your suggestion.", victim, NULL, ch,
		   TO_VICT);
	      act ("$s mind is too strong to overcome.", victim, NULL, ch,
		   TO_VICT);
	      if (!IS_NPC (victim) && ch != victim
		  && IS_MORE (victim, MORE_GUARDIAN))
		{
		  guardian_message (victim);
		  act ("$n just failed to use Command on you.", ch, NULL,
		       victim, TO_VICT);
		}
	      continue;
	    }

	  if (IS_NPC (victim) && victim->level >= level)
	    {
	      act ("You shake off $N's suggestion.", victim, NULL, ch,
		   TO_CHAR);
	      act ("$n shakes off $N's suggestion.", victim, NULL, ch,
		   TO_NOTVICT);
	      act ("$n shakes off your suggestion.", victim, NULL, ch,
		   TO_VICT);
	      act ("$s mind is too strong to overcome.", victim, NULL, ch,
		   TO_VICT);
	      continue;
	    }
	  else if (IS_NPC (victim) && victim->spl[BLUE_MAGIC] >= level)
	    {
	      act ("You shake off $N's suggestion.", victim, NULL, ch,
		   TO_CHAR);
	      act ("$n shakes off $N's suggestion.", victim, NULL, ch,
		   TO_NOTVICT);
	      act ("$n shakes off your suggestion.", victim, NULL, ch,
		   TO_VICT);
	      act ("$s mind is too strong to overcome.", victim, NULL, ch,
		   TO_VICT);
	      continue;
	    }

	  if (!IS_NPC (victim) && victim->pcdata->resist[WILL_DOMINATE] > 0)
	    {
	      act ("You shake off $N's suggestion.", victim, NULL, ch,
		   TO_CHAR);
	      act ("$n shakes off $N's suggestion.", victim, NULL, ch,
		   TO_NOTVICT);
	      act ("$n shakes off your suggestion.", victim, NULL, ch,
		   TO_VICT);
	      if (!IS_NPC (victim) && ch != victim
		  && IS_MORE (victim, MORE_GUARDIAN))
		{
		  guardian_message (victim);
		  act ("$n just failed to use Command on you.", ch, NULL,
		       victim, TO_VICT);
		}
	      continue;
	    }

	  if (!IS_NPC (victim) && ((victim->pcdata->willpower[0] >= 2 &&
				    IS_MORE (victim, MORE_LOYAL))
				   || victim->pcdata->willpower[0] >= 5)
	      && strlen (victim->pcdata->conding) > 1)
	    {
	      if (IS_MORE (victim, MORE_LOYAL))
		victim->pcdata->willpower[0] -= 2;
	      else
		victim->pcdata->willpower[0] -= 5;
	      victim->pcdata->resist[WILL_DOMINATE] = 60;
	      send_to_char ("You burn some willpower to resist Command.\n\r",
			    victim);
	      act ("You shake off $N's suggestion.", victim, NULL, ch,
		   TO_CHAR);
	      act ("$n shakes off $N's suggestion.", victim, NULL, ch,
		   TO_NOTVICT);
	      act ("$n shakes off your suggestion.", victim, NULL, ch,
		   TO_VICT);
	      if (!IS_NPC (victim) && ch != victim
		  && IS_MORE (victim, MORE_GUARDIAN))
		{
		  guardian_message (victim);
		  act ("$n just failed to use Command on you.", ch, NULL,
		       victim, TO_VICT);
		}
	      continue;
	    }
	  if (!IS_NPC (victim) && IS_WILLPOWER (victim, RES_DOMINATE) &&
	      victim->pcdata->willpower[0] >= 10)
	    {
	      victim->pcdata->willpower[0] -= 10;
	      victim->pcdata->resist[WILL_DOMINATE] = 60;
	      if (!IS_WILLPOWER (victim, RES_TOGGLE))
		REMOVE_BIT (victim->pcdata->resist[0], RES_DOMINATE);
	      send_to_char ("You burn some willpower to resist Command.\n\r",
			    victim);
	      act ("You shake off $N's suggestion.", victim, NULL, ch,
		   TO_CHAR);
	      act ("$n shakes off $N's suggestion.", victim, NULL, ch,
		   TO_NOTVICT);
	      act ("$n shakes off your suggestion.", victim, NULL, ch,
		   TO_VICT);
	      if (!IS_NPC (victim) && ch != victim
		  && IS_MORE (victim, MORE_GUARDIAN))
		{
		  guardian_message (victim);
		  act ("$n just failed to use Command on you.", ch, NULL,
		       victim, TO_VICT);
		}
	      continue;
	    }

	  act ("You blink in confusion.", victim, NULL, NULL, TO_CHAR);
	  act ("$n blinks in confusion.", victim, NULL, NULL, TO_ROOM);
	  strcpy (buf, "Yes, you're right, I do...");
	  do_say (victim, buf);
	  if (IS_NPC (victim))
	    SET_BIT (victim->act, ACT_COMMANDED);
	  interpret (victim, action);
	  if (IS_NPC (victim))
	    REMOVE_BIT (victim->act, ACT_COMMANDED);
	  if (!IS_NPC (victim) && ch != victim
	      && IS_MORE (victim, MORE_GUARDIAN))
	    {
	      guardian_message (victim);
	      act ("$n just used Command on you.", ch, NULL, victim, TO_VICT);
	    }
	}
      return;
    }

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

  if (victim == ch)
    {
      send_to_char ("How can you Command yourself??\n\r", ch);
      return;
    }

  if (IS_IMMORTAL (victim))
    {
      send_to_char ("I think not...\n\r", ch);
      return;
    }

  if (IS_ITEMAFF (victim, ITEMA_SHADES) || IS_ITEMAFF (ch, ITEMA_SHADES) ||
      !can_see (victim, ch))
    {
      if (!IS_SET (ch->act, PLR_HOLYLIGHT))
	{
	  send_to_char ("You are unable to make eye contact with them.\n\r",
			ch);
	  return;
	}
    }

  if (is_safe (ch, victim))
    return;

  if (IS_NPC (victim))
    sprintf (buf, "I think %s wants to %s", victim->short_descr, action);
  else if (!IS_NPC (victim) && IS_AFFECTED (victim, AFF_POLYMORPH))
    sprintf (buf, "I think %s wants to %s", victim->morph, action);
  else
    sprintf (buf, "I think %s wants to %s", victim->name, action);
  do_say (ch, buf);
  waiting (ch, 24);

  if (!IS_NPC (victim) && strlen (victim->pcdata->conding) > 2 &&
      !str_cmp (victim->pcdata->conding, ch->name))
    {
      act ("You blink in confusion.", victim, NULL, NULL, TO_CHAR);
      act ("$n blinks in confusion.", victim, NULL, NULL, TO_ROOM);
      strcpy (buf, "Yes, you're right, I do...");
      do_say (victim, buf);
      if (IS_NPC (victim))
	SET_BIT (victim->act, ACT_COMMANDED);
      interpret (victim, action);
      if (IS_NPC (victim))
	REMOVE_BIT (victim->act, ACT_COMMANDED);
      if (!IS_NPC (victim) && ch != victim && IS_MORE (victim, MORE_GUARDIAN))
	{
	  guardian_message (victim);
	  act ("$n just used Command on you.", ch, NULL, victim, TO_VICT);
	}
      return;
    }

  if (!IS_NPC (victim) && IS_VAMPIRE (victim)
      && victim->vampgen < ch->vampgen)
    {
      act ("You shake off $N's suggestion.", victim, NULL, ch, TO_CHAR);
      act ("$n shakes off $N's suggestion.", victim, NULL, ch, TO_NOTVICT);
      act ("$n shakes off your suggestion.", victim, NULL, ch, TO_VICT);
      act ("$s mind is too strong to overcome.", victim, NULL, ch, TO_VICT);
      if (!IS_NPC (victim) && ch != victim && IS_MORE (victim, MORE_GUARDIAN))
	{
	  guardian_message (victim);
	  act ("$n just failed to use Command on you.", ch, NULL, victim,
	       TO_VICT);
	}
      return;
    }

  if (IS_NPC (victim) &&
      (victim->level >= level || victim->spl[BLUE_MAGIC] >= level))
    {
      act ("You shake off $N's suggestion.", victim, NULL, ch, TO_CHAR);
      act ("$n shakes off $N's suggestion.", victim, NULL, ch, TO_NOTVICT);
      act ("$n shakes off your suggestion.", victim, NULL, ch, TO_VICT);
      act ("$s mind is too strong to overcome.", victim, NULL, ch, TO_VICT);
      return;
    }

  if (!IS_NPC (victim) && victim->pcdata->resist[WILL_DOMINATE] > 0)
    {
      act ("You shake off $N's suggestion.", victim, NULL, ch, TO_CHAR);
      act ("$n shakes off $N's suggestion.", victim, NULL, ch, TO_NOTVICT);
      act ("$n shakes off your suggestion.", victim, NULL, ch, TO_VICT);
      if (!IS_NPC (victim) && ch != victim && IS_MORE (victim, MORE_GUARDIAN))
	{
	  guardian_message (victim);
	  act ("$n just failed to use Command on you.", ch, NULL, victim,
	       TO_VICT);
	}
      return;
    }

  if (!IS_NPC (victim) && ((victim->pcdata->willpower[0] >= 2 &&
			    IS_MORE (victim, MORE_LOYAL))
			   || victim->pcdata->willpower[0] >= 5)
      && strlen (victim->pcdata->conding) > 1)
    {
      if (IS_MORE (victim, MORE_LOYAL))
	victim->pcdata->willpower[0] -= 2;
      else
	victim->pcdata->willpower[0] -= 5;
      victim->pcdata->resist[WILL_DOMINATE] = 60;
      send_to_char ("You burn some willpower to resist Command.\n\r", victim);
      act ("You shake off $N's suggestion.", victim, NULL, ch, TO_CHAR);
      act ("$n shakes off $N's suggestion.", victim, NULL, ch, TO_NOTVICT);
      act ("$n shakes off your suggestion.", victim, NULL, ch, TO_VICT);
      if (!IS_NPC (victim) && ch != victim && IS_MORE (victim, MORE_GUARDIAN))
	{
	  guardian_message (victim);
	  act ("$n just failed to use Command on you.", ch, NULL, victim,
	       TO_VICT);
	}
      return;
    }
  if (!IS_NPC (victim) && IS_WILLPOWER (victim, RES_DOMINATE) &&
      victim->pcdata->willpower[0] >= 10)
    {
      victim->pcdata->willpower[0] -= 10;
      victim->pcdata->resist[WILL_DOMINATE] = 60;
      if (!IS_WILLPOWER (victim, RES_TOGGLE))
	REMOVE_BIT (victim->pcdata->resist[0], RES_DOMINATE);
      send_to_char ("You burn some willpower to resist Command.\n\r", victim);
      act ("You shake off $N's suggestion.", victim, NULL, ch, TO_CHAR);
      act ("$n shakes off $N's suggestion.", victim, NULL, ch, TO_NOTVICT);
      act ("$n shakes off your suggestion.", victim, NULL, ch, TO_VICT);
      if (!IS_NPC (victim) && ch != victim && IS_MORE (victim, MORE_GUARDIAN))
	{
	  guardian_message (victim);
	  act ("$n just failed to use Command on you.", ch, NULL, victim,
	       TO_VICT);
	}
      return;
    }

  act ("You blink in confusion.", victim, NULL, NULL, TO_CHAR);
  act ("$n blinks in confusion.", victim, NULL, NULL, TO_ROOM);
  strcpy (buf, "Yes, you're right, I do...");
  do_say (victim, buf);
  if (IS_NPC (victim))
    SET_BIT (victim->act, ACT_COMMANDED);
  interpret (victim, action);
  if (IS_NPC (victim))
    REMOVE_BIT (victim->act, ACT_COMMANDED);
  if (!IS_NPC (victim) && ch != victim && IS_MORE (victim, MORE_GUARDIAN))
    {
      guardian_message (victim);
      act ("$n just used Command on you.", ch, NULL, victim, TO_VICT);
    }
  return;
}



void
do_group (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  char arg[MIL];
  CHAR_DATA *victim;
  CHAR_DATA *vch;
  CHAR_DATA *vch_next;
  bool grouped = FALSE;

  one_argument (argument, arg);

  if (!IS_NPC (ch) && get_trust (ch) == LEVEL_BUILDER)
    {
      send_to_char ("Perhaps you should just stick to building?\n\r", ch);
      return;
    }

  if (arg[0] == '\0')
    {
      CHAR_DATA *gch;
      CHAR_DATA *leader;

      leader = (ch->leader != NULL) ? ch->leader : ch;
      sprintf (buf, "%s's group:\n\r", PERS (leader, ch));
      send_to_char (buf, ch);

      for (gch = char_list; gch != NULL; gch = gch->next)
	{
	  if (is_same_group (gch, ch))
	    {
	      sprintf (buf,
		       "[%-16s] %4d/%4d life %4d/%4d mp %4d/%4d vital %5ld xp\n\r",
		       capitalize (PERS (gch, ch)),
		       gch->hit, gch->max_hit,
		       gch->mana, gch->max_mana,
		       gch->move, gch->max_move, gch->exp);
	      send_to_char (buf, ch);
	    }
	}
      return;
    }

  if (ch->master != NULL || (ch->leader != NULL && ch->leader != ch))
    {
      send_to_char ("But you are following someone else!\n\r", ch);
      return;
    }

  if (!str_cmp (arg, "all"))
    {
      for (vch = ch->in_room->people; vch != NULL; vch = vch_next)
	{
	  vch_next = vch->next_in_room;
	  if (vch == ch)
	    continue;
	  if (vch->master != ch)
	    continue;
	  if (is_same_group (vch, ch))
	    continue;
	  if (!IS_NPC (vch) && get_trust (vch) == LEVEL_BUILDER)
	    continue;
	  vch->leader = ch;
	  act ("$N joins $n's group.", ch, NULL, vch, TO_NOTVICT);
	  act ("You join $n's group.", ch, NULL, vch, TO_VICT);
	  act ("$N joins your group.", ch, NULL, vch, TO_CHAR);
	  grouped = TRUE;
	}
      if (!grouped)
	send_to_char
	  ("There is nobody here following you who isn't grouped already.\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 (ch) && get_trust (ch) == LEVEL_BUILDER)
    {
      send_to_char ("Perhaps you should just let them build?\n\r", ch);
      return;
    }

  if (victim->master != ch && ch != victim)
    {
      act ("$N isn't following you.", ch, NULL, victim, TO_CHAR);
      return;
    }

  if (is_same_group (victim, ch) && ch != victim)
    {
      victim->leader = NULL;
      act ("$n removes $N from $s group.", ch, NULL, victim, TO_NOTVICT);
      act ("$n removes you from $s group.", ch, NULL, victim, TO_VICT);
      act ("You remove $N from your group.", ch, NULL, victim, TO_CHAR);
      return;
    }

  victim->leader = ch;
  act ("$N joins $n's group.", ch, NULL, victim, TO_NOTVICT);
  act ("You join $n's group.", ch, NULL, victim, TO_VICT);
  act ("$N joins your group.", ch, NULL, victim, TO_CHAR);
  return;
}



/*
 * 'Split' originally by Gnort, God of Chaos.
 */
void
do_split (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  char arg[MIL];
  CHAR_DATA *gch;
  int members;
  int amount;
  int share;
  int extra;

  one_argument (argument, arg);

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

  amount = atoi (arg);

  if (amount < 0)
    {
      send_to_char ("Your group wouldn't like that.\n\r", ch);
      return;
    }

  if (amount == 0)
    {
      send_to_char ("You hand out zero coins, but no one notices.\n\r", ch);
      return;
    }

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

  members = 0;
  for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room)
    {
      if (is_same_group (gch, ch))
	members++;
    }

  if (members < 2)
    {
      send_to_char ("Just keep it all.\n\r", ch);
      return;
    }

  share = amount / members;
  extra = amount % members;

  if (share == 0)
    {
      send_to_char ("Don't even bother, cheapskate.\n\r", ch);
      return;
    }

  ch->gold -= amount;
  ch->gold += share + extra;

  sprintf (buf,
	   "You split %d gold coins.  Your share is %d gold coins.\n\r",
	   amount, share + extra);
  send_to_char (buf, ch);

  sprintf (buf, "$n splits %d gold coins.  Your share is %d gold coins.",
	   amount, share);

  for (gch = ch->in_room->people; gch != NULL; gch = gch->next_in_room)
    {
      if (gch != ch && is_same_group (gch, ch))
	{
	  act (buf, ch, NULL, gch, TO_VICT);
	  gch->gold += share;
	}
    }

  return;
}



void
do_gtell (CHAR_DATA * ch, char *argument)
{
  char buf[MSL];
  CHAR_DATA *gch;

  if (argument[0] == '\0')
    {
      send_to_char ("Tell your group what?\n\r", ch);
      return;
    }

  if (IS_SET (ch->act, PLR_NO_TELL))
    {
      send_to_char ("Your message didn't get through!\n\r", ch);
      return;
    }

  if (!IS_IMMORTAL (ch))
    {
      char verb[MIL];

      sprintf (verb, "group talk");

      if (IS_HEAD (ch, LOST_TONGUE))
	{
	  sprintf (buf, "You can't %s without a tongue!\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (IS_EXTRA (ch, GAGGED))
	{
	  sprintf (buf, "You can't %s with a gag on!\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (!IS_NPC (ch) && IS_SET (ch->act, PLR_SILENCE))
	{
	  sprintf (buf, "You can't %s.\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (ch->in_room != NULL
	  && IS_SET (ch->in_room->added_flags, ROOM2_SILENCE))
	{
	  sprintf (buf, "You can't %s.\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
      if (ch->in_room != NULL
	  && IS_SET (ch->in_room->room_flags, ROOM_SILENCE))
	{
	  sprintf (buf, "You can't %s.\n\r", verb);
	  send_to_char (buf, ch);
	  return;
	}
    }

  /*
   * Note use of send_to_char, so gtell works on sleepers.
   */
  sprintf (buf, "%s tells the group '#g%s#n'.\n\r", ch->name, argument);
  for (gch = char_list; gch != NULL; gch = gch->next)
    {
      if (is_same_group (gch, ch))
	send_to_char (buf, gch);
    }

  return;
}



/*
 * It is very important that this be an equivalence relation:
 * (1) A ~ A
 * (2) if A ~ B then B ~ A
 * (3) if A ~ B  and B ~ C, then A ~ C
 */
bool
is_same_group (CHAR_DATA * ach, CHAR_DATA * bch)
{
  if (ach->leader != NULL)
    ach = ach->leader;
  if (bch->leader != NULL)
    bch = bch->leader;
  return ach == bch;
}

void
do_changelight (CHAR_DATA * ch, char *argument)
{
  if (IS_SET (ch->in_room->room_flags, ROOM_DARK))
    {
      REMOVE_BIT (ch->in_room->room_flags, ROOM_DARK);
      act ("The room is suddenly filled with light!", ch, NULL, NULL,
	   TO_CHAR);
      act ("The room is suddenly filled with light!", ch, NULL, NULL,
	   TO_ROOM);
      return;
    }
  SET_BIT (ch->in_room->room_flags, ROOM_DARK);
  act ("The lights in the room suddenly go out!", ch, NULL, NULL, TO_CHAR);
  act ("The lights in the room suddenly go out!", ch, NULL, NULL, TO_ROOM);
  return;
}

void
open_lift (CHAR_DATA * ch)
{
  ROOM_INDEX_DATA *location;
  int in_room;

  in_room = ch->in_room->vnum;
  location = get_room_index (in_room);

  if (is_open (ch))
    return;

  act ("The doors open.", ch, NULL, NULL, TO_CHAR);
  act ("The doors open.", ch, NULL, NULL, TO_ROOM);
  move_door (ch);
  if (is_open (ch))
    act ("The doors close.", ch, NULL, NULL, TO_ROOM);
  if (!same_floor (ch, in_room))
    act ("The lift judders suddenly.", ch, NULL, NULL, TO_ROOM);
  if (is_open (ch))
    act ("The doors open.", ch, NULL, NULL, TO_ROOM);
  move_door (ch);
  open_door (ch, FALSE);
  char_from_room (ch);
  char_to_room (ch, location);
  open_door (ch, TRUE);
  move_door (ch);
  open_door (ch, TRUE);
  thru_door (ch, in_room);
  char_from_room (ch);
  char_to_room (ch, location);
  return;
}

void
close_lift (CHAR_DATA * ch)
{
  ROOM_INDEX_DATA *location;
  int in_room;

  in_room = ch->in_room->vnum;
  location = get_room_index (in_room);

  if (!is_open (ch))
    return;
  act ("The doors close.", ch, NULL, NULL, TO_CHAR);
  act ("The doors close.", ch, NULL, NULL, TO_ROOM);
  open_door (ch, FALSE);
  move_door (ch);
  open_door (ch, FALSE);
  char_from_room (ch);
  char_to_room (ch, location);
  return;
}

void
move_lift (CHAR_DATA * ch, int to_room)
{
  ROOM_INDEX_DATA *location;
  int in_room;

  in_room = ch->in_room->vnum;
  location = get_room_index (in_room);

  if (is_open (ch))
    act ("The doors close.", ch, NULL, NULL, TO_CHAR);
  if (is_open (ch))
    act ("The doors close.", ch, NULL, NULL, TO_ROOM);
  if (!same_floor (ch, to_room))
    act ("The lift judders suddenly.", ch, NULL, NULL, TO_CHAR);
  if (!same_floor (ch, to_room))
    act ("The lift judders suddenly.", ch, NULL, NULL, TO_ROOM);
  move_door (ch);
  open_door (ch, FALSE);
  char_from_room (ch);
  char_to_room (ch, location);
  open_door (ch, FALSE);
  thru_door (ch, to_room);
  return;
}

bool
same_floor (CHAR_DATA * ch, int cmp_room)
{
  OBJ_DATA *obj;
  OBJ_DATA *obj_next;

  for (obj = ch->in_room->contents; obj != NULL; obj = obj_next)
    {
      obj_next = obj->next_content;
      if (obj->item_type != ITEM_PORTAL)
	continue;
      if (obj->pIndexData->vnum == 30001)
	continue;
      if (obj->value[0] == cmp_room)
	return TRUE;
      else
	return FALSE;
    }
  return FALSE;
}

bool
is_open (CHAR_DATA * ch)
{
  OBJ_DATA *obj;
  OBJ_DATA *obj_next;

  for (obj = ch->in_room->contents; obj != NULL; obj = obj_next)
    {
      obj_next = obj->next_content;
      if (obj->item_type != ITEM_PORTAL)
	continue;
      if (obj->pIndexData->vnum == 30001)
	continue;
      if (obj->value[2] == 0)
	return TRUE;
      else
	return FALSE;
    }
  return FALSE;
}

void
move_door (CHAR_DATA * ch)
{
  OBJ_DATA *obj;
  OBJ_DATA *obj_next;
  ROOM_INDEX_DATA *pRoomIndex;

  for (obj = ch->in_room->contents; obj != NULL; obj = obj_next)
    {
      obj_next = obj->next_content;
      if (obj->item_type != ITEM_PORTAL)
	continue;
      if (obj->pIndexData->vnum == 30001)
	continue;
      pRoomIndex = get_room_index (obj->value[0]);
      char_from_room (ch);
      char_to_room (ch, pRoomIndex);
      return;
    }
  return;
}

void
thru_door (CHAR_DATA * ch, int doorexit)
{
  OBJ_DATA *obj;
  OBJ_DATA *obj_next;

  for (obj = ch->in_room->contents; obj != NULL; obj = obj_next)
    {
      obj_next = obj->next_content;
      if (obj->item_type != ITEM_PORTAL)
	continue;
      if (obj->pIndexData->vnum == 30001)
	

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

Site Stats

Snippets: 1791
Codebases: 571