legend/
legend/area/
legend/player/
/***************************************************************************
 *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
 *  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
 *                                                                         *
 *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
 *  Chastain, Michael Quan, and Mitchell Tse.                              *
 *                                                                         *
 *  In order to use any part of this Merc Diku Mud, you must comply with   *
 *  both the original Diku license in 'license.doc' as well the Merc       *
 *  license in 'license.txt'.  In particular, you may not remove either of *
 *  these copyright notices.                                               *
 *                                                                         *
 ***************************************************************************/


/* This is a code snippet from Jobo of Dystopia code base and edited some
 * by Caine from Vampire Wars: The Final sunset.
 */

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"


/* Point to the location on the net where the sound files
 * are located. If no location are given, the players will
 * have to download the sound files before they use the
 * sound protocol.
 */
#define SOUND_URL  "http://legend.wolfpaw.net/sounds/"
//#define SOUND_URL "http://www.soton.ac.uk/~gc5/loc/sounds/"

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

   if (IS_SET (ch->extra2, SOUND))
   {
      REMOVE_BIT (ch->extra2, SOUND);
      send_to_char ("Sound disabled.\n\r", ch);
   }
   else
   {
      SET_BIT (ch->extra2, SOUND);
      send_to_char ("Sound enabled.\n\r", ch);
   }
   return;
}

void send_portal (CHAR_DATA * ch)
{
   char buf[200];
   if (IS_NPC (ch))
      return;
   if (!IS_SET (ch->extra2, SOUND))
      return;
   sprintf (buf, "!!SOUND(portal.wav U=%s)", SOUND_URL);
   send_to_char (buf, ch);
   return;
}

void send_redspell (CHAR_DATA * ch)
{
   char buf[200];

   if (!IS_SET (ch->extra2, SOUND))
      return;
   sprintf (buf, "!!SOUND(red.wav U=%s)", SOUND_URL);
   send_to_char (buf, ch);
   return;
}

void send_purplespell (CHAR_DATA * ch)
{
   char buf[200];
   if (IS_NPC (ch))
      return;

   if (!IS_SET (ch->extra2, SOUND))
      return;
   sprintf (buf, "!!SOUND(purple.wav U=%s)", SOUND_URL);
   send_to_char (buf, ch);
   return;
}

void send_greenspell (CHAR_DATA * ch)
{
   char buf[200];
   if (IS_NPC (ch))
      return;

   if (!IS_SET (ch->extra2, SOUND))
      return;
   sprintf (buf, "!!SOUND(green.wav U=%s)", SOUND_URL);
   send_to_char (buf, ch);
   return;
}

void send_yellowspell (CHAR_DATA * ch)
{
   char buf[200];

   if (!IS_SET (ch->extra2, SOUND))
      return;
   sprintf (buf, "!!SOUND(yellow.wav U=%s)", SOUND_URL);
   send_to_char (buf, ch);
   return;
}

void send_bluespell (CHAR_DATA * ch)
{
   char buf[200];
   if (IS_NPC (ch))
      return;

   if (!IS_SET (ch->extra2, SOUND))
      return;
   sprintf (buf, "!!SOUND(blue.wav U=%s)", SOUND_URL);
   stc (buf, ch);
   return;
}

void send_night (CHAR_DATA * ch)
{
   char buf[200];
   if (IS_NPC (ch))
      return;

   if (!IS_SET (ch->extra2, SOUND))
      return;
   sprintf (buf, "!!SOUND(night.wav U=%s)", SOUND_URL);
   send_to_char (buf, ch);
   return;
}

void send_thunder (CHAR_DATA * ch)
{
   char buf[200];

   if (!IS_SET (ch->extra2, SOUND))
      return;
   sprintf (buf, "!!SOUND(thunder.wav U=%s)", SOUND_URL);
   send_to_char (buf, ch);
   return;
}

void send_howl (CHAR_DATA * ch)
{
   char buf[200];
   if (IS_NPC (ch))
      return;

   if (!IS_SET (ch->extra2, SOUND))
      return;
   sprintf (buf, "!!SOUND(howl.wav U=%s)", SOUND_URL);
   send_to_char (buf, ch);
   return;
}

void send_teleport (CHAR_DATA * ch)
{
   char buf[200];
   if (IS_NPC (ch))
      return;

   if (!IS_SET (ch->extra2, SOUND))
      return;
   sprintf (buf, "!!SOUND(teleport.wav U=%s)", SOUND_URL);
   send_to_char (buf, ch);
   return;
}

void send_decap (CHAR_DATA * ch)
{
   char buf[200];
   if (IS_NPC (ch))
      return;

   if (!IS_SET (ch->pcdata->tempflag, SOUND))
      return;
   sprintf (buf, "!!SOUND(decap.wav U=%s)", SOUND_URL);
   send_to_char (buf, ch);
   return;
}

void send_losthead (CHAR_DATA * ch)
{
   char buf[200];
   if (IS_NPC (ch))
      return;

   if (!IS_SET (ch->extra2, SOUND))
      return;
   sprintf (buf, "!!SOUND(losthead.wav U=%s)", SOUND_URL);
   send_to_char (buf, ch);
   return;
}

void send_silence (CHAR_DATA * ch)
{
   char buf[200];
   if (IS_NPC (ch))
      return;

   if (!IS_SET (ch->extra2, SOUND))
      return;
   sprintf (buf, "!!SOUND(silence.wav U=%s)", SOUND_URL);
   send_to_char (buf, ch);
   return;
}