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.                                               *
 *                                                                         *
 *  Much time and thought has gone into this software and you are          *
 *  benefitting.  We hope that you share your changes too.  What goes      *
 *  around, comes around.                                                  *
 ***************************************************************************/
/***************************************************************************
 *  God Wars Mud copyright (C) 1994, 1995, 1996 by Richard Woolcock        *
 *                                                                         *
 *  Legend of Chrystancia copyright (C) 1999, 2000, 2001 by Matthew Little *
 *  This mud is NOT to be copied in whole or in part, or to be run without *
 *  the permission of Matthew Little. Nobody else has permission to        *
 *  authorise the use of this code.                                        *
 ***************************************************************************/


#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif

#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <assert.h>
#include <unistd.h>
#include <stdarg.h>
#include <limits.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include "merc.h"

char *current_date ()
{
   static char buf[128];
   struct tm *t;
   time_t nowtime;
   nowtime = time (&current_time);
//   t = asctime(gmtime( (&nowtime)));
   t = localtime (&nowtime);
   strftime (buf, 100, "%-d-%b-%Y", t);
   return buf;   
}  
char *ncurrent_time ()
{
   static char buf[128];
   struct tm *t;
   time_t nowtime;
   nowtime = time (&current_time);
   t = localtime (&nowtime);
//   t = asctime(gmtime( (&nowtime)));
   strftime (buf, 100, "%-d-%b-%Y %T", t);
   return buf;   
}

char *new_date( time_t time )  
{
    static char buf[20];
    char        *date;   
    
    if ( time < 0 )  
    {
        bugf( "Invalid integer time: (%d)", time );
        time = current_time;
    }
    date = asctime(gmtime( &time ));
    //date = ctime( &time );
    if ( date[8] == ' ' )
        buf[0] = '0';
    else 
        buf[0] = date[8];

    buf[1] = date[9];
    buf[2] = '-';
    buf[3] = date[4];
    buf[4] = date[5];
    buf[5] = date[6];
    buf[6] = '-';
    buf[7] = date[20];
    buf[8] = date[21];
    buf[9] = date[22];
    buf[10] = date[23];
    buf[11] = ' ';
    buf[12] = date[11];
    buf[13] = date[12];
    buf[14] = date[13];
    buf[15] = date[14];
    buf[16] = date[15];
    buf[17] = date[16];
    buf[18] = date[17];
    buf[19] = date[18];
    buf[20] = '\0';

    return buf;
}
char *timestring( char *time )
{
    static char buf[20];
    
    
    buf[0] = time[11]; 
    buf[1] = time[12];
    buf[2] = time[13];
    buf[3] = time[14];
    buf[4] = time[15];
    buf[5] = time[16];
    buf[6] = time[17];
    buf[7] = time[18];
    buf[8] = '\0';
   
    return buf;
}   
char *datestring( char *date)  
{
    static char buf[20];
    
    if ( date[8] == ' ' )
        buf[0] = '0';
    else 
        buf[0] = date[8];

    buf[1] = date[9];
    buf[2] = '-';
    buf[3] = date[4];
    buf[4] = date[5];
    buf[5] = date[6];
    buf[6] = '-';
    buf[7] = date[20];
    buf[8] = date[21];
    buf[9] = date[22];
    buf[10] = date[23];
    buf[11] = ' ';
    buf[12] = date[11];
    buf[13] = date[12];
    buf[14] = date[13];
    buf[15] = date[14];
    buf[16] = date[15];
    buf[17] = date[16];
    buf[18] = date[17];
    buf[19] = date[18];
    buf[20] = '\0';

    return buf;
}
char *compdate( char *date)  
{
/*
 Apr  8 2004 09:13:35
 12345678901234567890
 01234567890123456789
*/
    static char buf[20];

    if ( date[4] == ' ' )
        buf[0] = '0';
    else 
        buf[0] = date[4];

    buf[1] = date[5];
    buf[2] = '-';
    buf[3] = date[0];
    buf[4] = date[1];
    buf[5] = date[2];
    buf[6] = '-';
    buf[7] = date[7];
    buf[8] = date[8];
    buf[9] = date[9];
    buf[10] = date[10];
    buf[11] = date[11];
    buf[12] = date[12];
    buf[13] = date[13];
    buf[14] = date[14];
    buf[15] = date[15];
    buf[16] = date[16];
    buf[17] = date[17];
    buf[18] = date[18];
    buf[19] = date[19];
    //buf[20] = date[19];
    buf[20] = '\0';

    return buf;


}
 

/* New Improved EMAIL/AIM/MSN/ICQ Contact info Command */
void do_contact(CHAR_DATA *ch, char *argument)
{
    char arg[MIL];  
    char buf[MSL];
    argument = one_argument(argument,arg);
        
    if (IS_NPC(ch) ) return;

    if (arg[0] == '\0')
    {
        sprintf(buf,"Your current contact information:\n\r");
        if (strlen(ch->pcdata->email) > 2)
            sprintf(buf + strlen(buf),"Email: %s%s\n\r",ch->pcdata->email,IS_CINVIS(ch,INVIS_EMAIL) ? " (Invis)" : "");
        if (strlen(ch->pcdata->aim) > 2)
            sprintf(buf + strlen(buf),"AIM  : %s%s\n\r",ch->pcdata->aim,IS_CINVIS(ch,INVIS_AIM) ? " (Invis)" : "");
        if (ch->pcdata->icq > 0)
            sprintf(buf + strlen(buf),"ICQ  : %d%s\n\r",ch->pcdata->icq,IS_CINVIS(ch,INVIS_ICQ) ? " (Invis)" : "");
        if (strlen(ch->pcdata->msn) > 2)
            sprintf(buf + strlen(buf),"MSN  : %s%s\n\r",ch->pcdata->msn,IS_CINVIS(ch,INVIS_MSN) ? " (Invis)" : "");
        sprintf(buf + strlen(buf),"\n\rSyntax: contact <EMAIL/ICQ/AIM/MSN> <INFO/INVIS>\n\rYou may clear a contact by leaving it blank\n\r");
        stc(buf,ch);
        return;
    }
         
    if (str_cmp(arg,"email") && str_cmp(arg,"aim") && str_cmp(arg,"icq") && str_cmp(arg, "msn"))
    {
        send_to_char("Email, AIM, MSN and ICQ are the only ones supported at the moment.\n\r",ch);
        return;
    }
        

    if (!str_cmp(argument,"invis"))
    {
        int invis;
    
        if (!str_cmp(arg,"email")) invis = INVIS_EMAIL;
        else if (!str_cmp(arg,"aim")) invis = INVIS_AIM;
        else if (!str_cmp(arg,"icq")) invis = INVIS_ICQ;
        else if (!str_cmp(arg,"msn")) invis = INVIS_MSN;
        else return;
         
        if (IS_CINVIS(ch,invis))
            REMOVE_BIT(ch->pcdata->cinvis,invis);
        else
            SET_BIT(ch->pcdata->cinvis,invis);
        stc("Done.\n\r",ch);
        return;
    }
    else if (!str_cmp(arg,"email"))
    {
        if (ch->registerred > 0)
        {
		send_to_char("You are unable to change your email once you have registered!\n\r", ch);
                return;
        }
        free_string(ch->pcdata->email);
        if (argument[0] == '\0')
        {
            stc("Email information cleared.\n\r",ch);
            ch->pcdata->email = str_dup("");
            return;
        }
        if (!(strstr (argument, "@") && strstr (argument, ".")))
	{
	  stc ("Enter in a proper address!\n\r", ch);
	  return;
	}

        ch->pcdata->email = str_dup(argument);
        stc("Email information set.\n\r",ch);
        return;
    }
    else if (!str_cmp(arg,"aim"))
    {
        free_string(ch->pcdata->aim);
        if (argument[0] == '\0')
        {
            stc("AIM information cleared.\n\r",ch);
            ch->pcdata->aim = str_dup("");
            return;
        }
    
        ch->pcdata->aim = str_dup(argument);
        stc("AIM information set.\n\r",ch);
        return;
    }
    else if (!str_cmp(arg,"msn"))
    {
        free_string(ch->pcdata->msn);
        if (argument[0] == '\0')
        {
            stc("MSN information cleared.\n\r",ch);
            ch->pcdata->msn = str_dup("");
            return;
        }
    if (!(strstr (argument, "@") && strstr (argument, ".")))
	{
	  stc ("Enter in a proper address!\n\r", ch);
	  return;
	}

        ch->pcdata->msn = str_dup(argument);
        stc("MSN information set.\n\r",ch);
        return;
    }
    else if (!str_cmp(arg,"icq"))   
    {
        int num;
        
        if (argument[0] == '\0')
        {
            stc("ICQ information cleared.\n\r",ch);
            ch->pcdata->icq = 0;
            return;
        }
        if (!is_number(argument))
        {
            stc("ICQ contact info must be a number.\n\r",ch);
            return;
        }
        num = atoi(argument);
        ch->pcdata->icq = num;
        stc("ICQ information set.\n\r",ch);
        return;
    }
    do_contact(ch,"");
    return;
}

/* Time Zone Setting code OOooOO */

#define MAX_TZONE   25
    
struct tzone_type
{
    const char *name; /* Name of the time zone */
    const char *zone; /* Cities or Zones in zone crossing */
    int gmt_offset; /* Difference in hours from Greenwich Mean Time */
    int dst_offset; /* Day Light Savings Time offset,
                       Not used but left it in anyway */
};
    
const struct tzone_type tzone_table[MAX_TZONE] =
{
    {"GMT-12", "Eniwetok", -12, 0},
    {"GMT-11", "Samoa", -11, 0},
    {"GMT-10", "Hawaii", -10, 0},
    {"GMT-9", "Alaska", -9, 0},
    {"PST", "Pacific US", -8, -7},
    {"MST", "Mountain US", -7, -6},
    {"CST", "Central US", -6, -5},
    {"EST", "Eastern US", -5, -4},
    {"GMT-4", "Atlantic, Canada", -4, 0},
    {"GMT-3", "Brazilia, Buenos Aries", -3, 0},
    {"GMT-2", "Mid-Atlantic", -2, 0},
    {"GMT-1", "Cape Verdes", -1, 0},
    {"GMT", "Greenwich Mean Time, Greenwich", 0, 0},
    {"GMT+1", "Berlin, Rome", 1, 0},
    {"GMT+2", "Israel, Cairo", 2, 0},
    {"GMT+3", "Moscow, Kuwait", 3, 0},
    {"GMT+4", "Abu Dhabi, Muscat", 4, 0},
    {"GMT+5", "Islamabad, Karachi", 5, 0},
    {"GMT+6", "Almaty, Dhaka", 6, 0},
    {"GMT+7", "Bangkok, Jakarta", 7, 0},
    {"GMT+8", "Hong Kong, Beijing", 8, 0},
    {"GMT+9", "Tokyo, Osaka", 9, 0},
    {"GMT+10", "Sydney, Melbourne, Guam", 10, 0},
    {"GMT+11", "Magadan, Soloman Is.", 11, 0},
    {"GMT+12", "Fiji, Wellington, Auckland", 12, 0},
};
        
int tzone_lookup(const char *arg)
{
    int i;
        
    for(i = 0; i < MAX_TZONE; i++)
    {
        if(!str_cmp(arg, tzone_table[i].name))
            return i;
    }
        
    for(i = 0; i < MAX_TZONE; i++)
    {
        if(!str_cmp(arg, tzone_table[i].zone))
            return i;
    }
    return -1;
}   
/* Some examples:
    str_time(current_time, ch->pcdata->timezone, "%I:%M:%S");
    str_time(-1, -1, NULL);
*/
char *str_time(time_t timet, int tz, const char *format)
{
        static char buf_new[5][100];
        static int i;
    char *result;
    
        // rotate buffers
    i++;
        i %= 5;
        result = buf_new[i];

    if (timet <= 0)
    {
        timet = current_time;
    }
    if(tz > -1 && tz < MAX_TZONE)
    {
        timet += (time_t) timezone; /* timezone external variable in time.h holds the
                            difference in seconds to GMT. */
        timet += (60 * 60 * tzone_table[tz].gmt_offset);  /* Add the offset hours */
    }
    strftime(result, 100, format != NULL ? format : "%d-%b-%Y %T",
        localtime(&timet));
            
        return result;
}
void do_timezone(CHAR_DATA *ch, char *argument)
{
    int i;
    char buf[MAX_STRING_LENGTH];
  
    if(IS_NPC(ch))
        return;
        
    if(argument[0] == '\0')
    {
        sprintf(buf, "#w%-6s %-30s (%s)\n\r", "Name", "City/Zone Crosses", "Time");
        send_to_char(buf, ch);
        send_to_char("#r-------------------------------------------------------------------------\n\r", ch);
        for(i = 0; i < MAX_TZONE; i++)
        {
            sprintf(buf, "#w%-6s #c%-30s (#r%s#w)\n\r", tzone_table[i].name,
                tzone_table[i].zone, str_time(current_time, i, NULL));
            send_to_char(buf, ch);
        }
        send_to_char("#r-------------------------------------------------------------------------\n\r", ch);
        return;
    }
        
    i = tzone_lookup(argument);
        
    if(i == -1)
    {
        send_to_char("That time zone does not exists.\n\r", ch);
        return;
    }
 
    ch->pcdata->timezone = i;
    sprintf(buf, "Your time zone is now %s %s (%s)\n\r", tzone_table[i].name,
                tzone_table[i].zone, str_time(current_time, i, NULL));
    send_to_char(buf, ch);
}
  
/* Justifiaction code.... By Cirin
 */
char *new_format(char *argument, char *arg_first, int width) 
{   
  char cEnd; 
  int end = strlen(argument), start = 0, protect=0; 
  
  if (width< 10 || width> 80){ 
    bug("New_format: bad width %d", width); 
    return ""; 
  } 
  
  cEnd = ' '; 
 
  for (;;) 
  { 
    if (start< width){ 
      if (start == end){ 
        argument[0] = '\0'; 
        break; 
      } 
      *arg_first = *argument; 
      arg_first++; 
      argument++; 
      start++; 
    } 
    else{ 
      if (*argument != cEnd){ 
        argument--; 
        arg_first--; 
      } 
      else break; 
    } 
    
    if (protect++ == 10000) break; 
  } 
   
  *arg_first = '\0'; 
    
  while (isspace(*argument))    
    argument++; 
   
  return argument; 
}

void cent_format(CHAR_DATA *ch, char *text, int width) 
{ 
  char buf[MSL]; 
  
  for (;;) 
  { 
    if (strlen(text)< width){ 
      cent_to_char(text, ch); 
      break; 
    } 
     
    text = new_format(text, buf, width); 
    cent_to_char(buf, ch); 
  } 
}  
void do_popular( CHAR_DATA *ch, char * argument )
{
    CHAR_DATA *most_popular[10];
    CHAR_DATA *stat;
    CHAR_DATA *stat_next;
    char out_buf[ 30000 ];
    int highest[10];
    int vnum[10];
    int temp = 0;
    int killed = 0;
    bool SHOWN_ANY = FALSE;
    
    for ( temp = 0; temp <= 10; temp++ )
    {
        highest[temp] = -1;
        most_popular[temp] = ch;
        vnum[temp] = -1;
    }

    for ( stat = char_list; stat != NULL; stat = stat_next )
    {
        stat_next   = stat->next;
        if ( !IS_NPC( stat ) )      continue;       // Players don't get counted.

        killed = stat->pIndexData->killed;
        if ( killed > 0 )
        {
        	if ( stat->pIndexData->vnum == vnum[0] )		continue;		// Already been polled
        	if ( stat->pIndexData->vnum == vnum[1] )		continue;		// Already been polled
        	if ( stat->pIndexData->vnum == vnum[2] )		continue;		// Already been polled
        	if ( stat->pIndexData->vnum == vnum[3] )		continue;		// Already been polled
        	if ( stat->pIndexData->vnum == vnum[4] )		continue;		// Already been polled
        	if ( stat->pIndexData->vnum == vnum[5] )		continue;		// Already been polled
        	if ( stat->pIndexData->vnum == vnum[6] )		continue;		// Already been polled
        	if ( stat->pIndexData->vnum == vnum[7] )		continue;		// Already been polled
        	if ( stat->pIndexData->vnum == vnum[8] )		continue;		// Already been polled
        	if ( stat->pIndexData->vnum == vnum[9] )		continue;		// Already been polled
        	if ( stat->pIndexData->vnum == vnum[10] )		continue;		// Already been polled

            if ( killed >= highest[0] )
            {   // 10 gets moved to 11 and therefore vanishes....
                highest[10] = highest[9];           most_popular[10] = most_popular[9];	    vnum[10] = vnum[9];     // Move #9 into #10
                highest[9] = highest[8];            most_popular[9] = most_popular[8];	    vnum[9] = vnum[8];      // Move #8 into #9
                highest[8] = highest[7];            most_popular[8] = most_popular[7];	    vnum[8] = vnum[7];      // Move #7 into #8
                highest[7] = highest[6];            most_popular[7] = most_popular[6];	    vnum[7] = vnum[6];      // Move #6 into #7
                highest[6] = highest[5];            most_popular[6] = most_popular[5];	    vnum[6] = vnum[5];      // Move #5 into #6
                highest[5] = highest[4];            most_popular[5] = most_popular[4];	    vnum[5] = vnum[4];      // Move #4 into #5
                highest[4] = highest[3];            most_popular[4] = most_popular[3];	    vnum[4] = vnum[3];      // Move #3 into #4
                highest[3] = highest[2];            most_popular[3] = most_popular[2];	    vnum[3] = vnum[2];      // Move #2 into #3
                highest[2] = highest[1];            most_popular[2] = most_popular[1];	    vnum[2] = vnum[1];      // Move #1 into #2
                highest[1] = highest[0];            most_popular[1] = most_popular[0];	    vnum[1] = vnum[0];      // Move #0 into #1
                highest[0] = killed;                most_popular[0] = stat;   vnum[0] = stat->pIndexData->vnum;     // Move Stat into #0
                continue;
            }
            else if ( killed >= highest[1] )
            {   // 10 gets moved to 11 and therefore vanishes....
                highest[10] = highest[9];           most_popular[10] = most_popular[9];	    vnum[10] = vnum[9];     // Move #9 into #10
                highest[9] = highest[8];            most_popular[9] = most_popular[8];	    vnum[9] = vnum[8];      // Move #8 into #9
                highest[8] = highest[7];            most_popular[8] = most_popular[7];	    vnum[8] = vnum[7];      // Move #7 into #8
                highest[7] = highest[6];            most_popular[7] = most_popular[6];	    vnum[7] = vnum[6];      // Move #6 into #7
                highest[6] = highest[5];            most_popular[6] = most_popular[5];	    vnum[6] = vnum[5];      // Move #5 into #6
                highest[5] = highest[4];            most_popular[5] = most_popular[4];	    vnum[5] = vnum[4];      // Move #4 into #5
                highest[4] = highest[3];            most_popular[4] = most_popular[3];	    vnum[4] = vnum[3];      // Move #3 into #4
                highest[3] = highest[2];            most_popular[3] = most_popular[2];	    vnum[3] = vnum[2];      // Move #2 into #3
                highest[2] = highest[1];            most_popular[2] = most_popular[1];	    vnum[2] = vnum[1];      // Move #1 into #2
                highest[1] = killed;                most_popular[1] = stat;   vnum[1] = stat->pIndexData->vnum;     // Move Stat into #1
                continue;
            }
            else if ( killed >= highest[2] )
            {   // 10 gets moved to 11 and therefore vanishes....
                highest[10] = highest[9];           most_popular[10] = most_popular[9];	    vnum[10] = vnum[9];     // Move #9 into #10
                highest[9] = highest[8];            most_popular[9] = most_popular[8];	    vnum[9] = vnum[8];      // Move #8 into #9
                highest[8] = highest[7];            most_popular[8] = most_popular[7];	    vnum[8] = vnum[7];      // Move #7 into #8
                highest[7] = highest[6];            most_popular[7] = most_popular[6];	    vnum[7] = vnum[6];      // Move #6 into #7
                highest[6] = highest[5];            most_popular[6] = most_popular[5];	    vnum[6] = vnum[5];      // Move #5 into #6
                highest[5] = highest[4];            most_popular[5] = most_popular[4];	    vnum[5] = vnum[4];      // Move #4 into #5
                highest[4] = highest[3];            most_popular[4] = most_popular[3];	    vnum[4] = vnum[3];      // Move #3 into #4
                highest[3] = highest[2];            most_popular[3] = most_popular[2];	    vnum[3] = vnum[2];      // Move #2 into #3
                highest[2] = killed;                most_popular[2] = stat;   vnum[2] = stat->pIndexData->vnum;     // Move Stat into #2
                continue;
            }
            else if ( killed >= highest[3] )
            {   // 10 gets moved to 11 and therefore vanishes....
                highest[10] = highest[9];           most_popular[10] = most_popular[9];	    vnum[10] = vnum[9];     // Move #9 into #10
                highest[9] = highest[8];            most_popular[9] = most_popular[8];	    vnum[9] = vnum[8];      // Move #8 into #9
                highest[8] = highest[7];            most_popular[8] = most_popular[7];	    vnum[8] = vnum[7];      // Move #7 into #8
                highest[7] = highest[6];            most_popular[7] = most_popular[6];	    vnum[7] = vnum[6];      // Move #6 into #7
                highest[6] = highest[5];            most_popular[6] = most_popular[5];	    vnum[6] = vnum[5];      // Move #5 into #6
                highest[5] = highest[4];            most_popular[5] = most_popular[4];	    vnum[5] = vnum[4];      // Move #4 into #5
                highest[4] = highest[3];            most_popular[4] = most_popular[3];	    vnum[4] = vnum[3];      // Move #3 into #4
                highest[3] = killed;                most_popular[3] = stat;   vnum[3] = stat->pIndexData->vnum;     // Move Stat into #3
                continue;
            }
            else if ( killed >= highest[4] )
            {   // 10 gets moved to 11 and therefore vanishes....
                highest[10] = highest[9];           most_popular[10] = most_popular[9];	    vnum[10] = vnum[9];     // Move #9 into #10
                highest[9] = highest[8];            most_popular[9] = most_popular[8];	    vnum[9] = vnum[8];      // Move #8 into #9
                highest[8] = highest[7];            most_popular[8] = most_popular[7];	    vnum[8] = vnum[7];      // Move #7 into #8
                highest[7] = highest[6];            most_popular[7] = most_popular[6];	    vnum[7] = vnum[6];      // Move #6 into #7
                highest[6] = highest[5];            most_popular[6] = most_popular[5];	    vnum[6] = vnum[5];      // Move #5 into #6
                highest[5] = highest[4];            most_popular[5] = most_popular[4];	    vnum[5] = vnum[4];      // Move #4 into #5
                highest[4] = killed;                most_popular[4] = stat;   vnum[4] = stat->pIndexData->vnum;     // Move Stat into #4
                continue;
            }
            else if ( killed >= highest[5] )
            {   // 10 gets moved to 11 and therefore vanishes....
                highest[10] = highest[9];           most_popular[10] = most_popular[9];	    vnum[10] = vnum[9];     // Move #9 into #10
                highest[9] = highest[8];            most_popular[9] = most_popular[8];	    vnum[9] = vnum[8];      // Move #8 into #9
                highest[8] = highest[7];            most_popular[8] = most_popular[7];	    vnum[8] = vnum[7];      // Move #7 into #8
                highest[7] = highest[6];            most_popular[7] = most_popular[6];	    vnum[7] = vnum[6];      // Move #6 into #7
                highest[6] = highest[5];            most_popular[6] = most_popular[5];	    vnum[6] = vnum[5];      // Move #5 into #6
                highest[5] = killed;                most_popular[5] = stat;   vnum[5] = stat->pIndexData->vnum;     // Move Stat into #5
                continue;
            }
            else if ( killed >= highest[6] )
            {   // 10 gets moved to 11 and therefore vanishes....
                highest[10] = highest[9];           most_popular[10] = most_popular[9];	    vnum[10] = vnum[9];     // Move #9 into #10
                highest[9] = highest[8];            most_popular[9] = most_popular[8];	    vnum[9] = vnum[8];      // Move #8 into #9
                highest[8] = highest[7];            most_popular[8] = most_popular[7];	    vnum[8] = vnum[7];      // Move #7 into #8
                highest[7] = highest[6];            most_popular[7] = most_popular[6];	    vnum[7] = vnum[6];      // Move #6 into #7
                highest[6] = killed;                most_popular[6] = stat;   vnum[6] = stat->pIndexData->vnum;     // Move Stat into #6
                continue;
            }
            else if ( killed >= highest[7] )
            {   // 10 gets moved to 11 and therefore vanishes....
                highest[10] = highest[9];           most_popular[10] = most_popular[9];	    vnum[10] = vnum[9];     // Move #9 into #10
                highest[9] = highest[8];            most_popular[9] = most_popular[8];	    vnum[9] = vnum[8];      // Move #8 into #9
                highest[8] = highest[7];            most_popular[8] = most_popular[7];	    vnum[8] = vnum[7];      // Move #7 into #8
                highest[7] = killed;                most_popular[7] = stat;   vnum[7] = stat->pIndexData->vnum;     // Move Stat into #7
                continue;
            }
            else if ( killed >= highest[8] )
            {   // 10 gets moved to 11 and therefore vanishes....
                highest[10] = highest[9];           most_popular[10] = most_popular[9];	    vnum[10] = vnum[9];     // Move #9 into #10
                highest[9] = highest[8];            most_popular[9] = most_popular[8];	    vnum[9] = vnum[8];      // Move #8 into #9
                highest[8] = killed;                most_popular[8] = stat;   vnum[8] = stat->pIndexData->vnum;     // Move Stat into #8
                continue;
            }
            else if ( killed >= highest[9] )
            {   // 10 gets moved to 11 and therefore vanishes....
                highest[10] = highest[9];           most_popular[10] = most_popular[9];	    vnum[10] = vnum[9];     // Move #9 into #10
                highest[9] = killed;                most_popular[9] = stat;   vnum[9] = stat->pIndexData->vnum;     // Move Stat into #9
                continue;
            }
            else if ( killed >= highest[10] )
            { 
                highest[10] = killed;                most_popular[10] = stat;   vnum[10] = stat->pIndexData->vnum;     // Move Stat into #10
                continue;
            }
            else
            {
                continue;
            }
        }   // If Killed > 0
        else
        {
            continue;
        }
    }   // End For
    
    // We Don't Display Highest[10]
    
    sprintf( out_buf, "#wHere are the most popular of the #r%lli #wmobs that have been killed#n\n\r", mobs_killed );
    send_to_char( out_buf, ch );
    
   
    if ( most_popular[0] != ch )
	{
		sprintf( out_buf, "#rMOST POPULAR -> #y%s #whas been killed #r%d #wtimes.\n\r", most_popular[0]->short_descr, highest[0] );
   		send_to_char( out_buf, ch );
        SHOWN_ANY = TRUE;
    }
    if ( most_popular[1] != ch )
	{
		sprintf( out_buf, "           #r2 -> #y%s #whas been killed #r%d #wtimes.\n\r", most_popular[1]->short_descr, highest[1] );
   		send_to_char( out_buf, ch );
        SHOWN_ANY = TRUE;
    }
    if ( most_popular[2] != ch )
	{
		sprintf( out_buf, "           #r3 -> #y%s #whas been killed #r%d #wtimes.\n\r", most_popular[2]->short_descr, highest[2] );
   		send_to_char( out_buf, ch );
        SHOWN_ANY = TRUE;
    }
    if ( most_popular[3] != ch )
	{
		sprintf( out_buf, "           #r4 -> #y%s #whas been killed #r%d #wtimes.\n\r", most_popular[3]->short_descr, highest[3] );
   		send_to_char( out_buf, ch );
        SHOWN_ANY = TRUE;
    }
    if ( most_popular[4] != ch )
	{
		sprintf( out_buf, "           #r5 -> #y%s #whas been killed #r%d #wtimes.\n\r", most_popular[4]->short_descr, highest[4] );
   		send_to_char( out_buf, ch );
        SHOWN_ANY = TRUE;
    }
    if ( most_popular[5] != ch )
	{
		sprintf( out_buf, "           #r6 -> #y%s #whas been killed #r%d #wtimes.\n\r", most_popular[5]->short_descr, highest[5] );
   		send_to_char( out_buf, ch );
        SHOWN_ANY = TRUE;
    }
    if ( most_popular[6] != ch )
	{
		sprintf( out_buf, "           #r7 -> #y%s #whas been killed #r%d #wtimes.\n\r", most_popular[6]->short_descr, highest[6] );
   		send_to_char( out_buf, ch );
        SHOWN_ANY = TRUE;
    }
    if ( most_popular[7] != ch )
	{
		sprintf( out_buf, "           #r8 -> #y%s #whas been killed #r%d #wtimes.\n\r", most_popular[7]->short_descr, highest[7] );
   		send_to_char( out_buf, ch );
        SHOWN_ANY = TRUE;
    }
    if ( most_popular[8] != ch )
	{
		sprintf( out_buf, "           #r9 -> #y%s #whas been killed #r%d #wtimes.\n\r", most_popular[8]->short_descr, highest[8] );
   		send_to_char( out_buf, ch );
        SHOWN_ANY = TRUE;
    }
    if ( most_popular[9] != ch )
	{
		sprintf( out_buf, "          #r10 -> #y%s #whas been killed #r%d #wtimes.\n\r", most_popular[9]->short_descr, highest[9] );
   		send_to_char( out_buf, ch );
        SHOWN_ANY = TRUE;
    }
    if (!SHOWN_ANY)
    {
	stc("No Mobiles have been killed yet!\n\r", ch);
	return;
    }
    
    return;
} // End Function

//mdonate - give qps to decrease the modtimer 60 qps  / min (C) Malstar
void do_mdonate(CHAR_DATA *ch, char *argument)
{
  sh_int value;
  long qps = 0;
  char buf[MSL];

  if(IS_NPC(ch)) return;

  if(argument[0] == '\0')
  {
    stc("How many minutes do you wish to lower the multiplier timer?\n\r",ch);
    stc("Rate: 5000 qps / minute.\n\r",ch);
    return;
  }

  value = atoi(argument);
  qps = value * 5000;

  if( ch->pcdata->quest < qps )
  {
    stc("You do not have that amount of quest points!\n\r",ch);
    return;
  }

  if( ( WizConfig->modtimer - 2 ) < value )
  {
    value = WizConfig->modtimer - 2;
    qps = value * 5000;
  }

  if ( WizConfig->xpbonus > 1 )
  {
    if ( ( WizConfig->xptimer ) < value )
    {
      value -= WizConfig->xptimer - 1;
      qps = value * 5000;
    }
    if ( ( WizConfig->modtimer - ( WizConfig->xptimer + value ) ) < 1 )
    {
      stc("You greedy jerk... No!\n\r",ch);
      return;
    }
  }

  if ( WizConfig->qpbonus > 1 )
  {
    if ( ( WizConfig->qptimer ) < value )
    {
      value -= WizConfig->qptimer - 1;
      qps = value * 5000;
    }
    if ( ( WizConfig->modtimer - ( WizConfig->qptimer + value ) ) < 1 )
    {
      stc("You greedy jerk... No!\n\r",ch);
      return;
    }
  }

  if(value < 1)
  {
    stc("What was that again?\n\r",ch);
    return;
  }

  ch->pcdata->quest -= qps;
  ch->pcdata->login_timer += value * 6;
  WizConfig->modtimer -= value;
  save_wizconfig();
  sprintf(buf, "%s has lowered the time to exp/qp mod by %d minutes!", ch->name, value);
  do_info(ch, buf);
  return;
}