eod/
eod/changes/
eod/log/
eod/player/
eod/player/backup/
eod/player/store/
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"

void do_pkready ( CHAR_DATA *ch, char *argument)
{
char buf[MAX_INPUT_LENGTH];
if (IS_SET(ch->extra,EXTRA_PKREADY))
{
send_to_char("You are already pkable.\n\r",ch);
return;
}
//ch->played = 14401;
SET_BIT(ch->extra,EXTRA_PKREADY);
do_save(ch,"");
sprintf(buf,"#G%s#n has gone #Rpkready#n\n\r",ch->name);
do_info(NULL,buf);

}

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

char buf[MAX_INPUT_LENGTH];
int cost = 3000;

if (ch->pcdata->quest < 3000)
{
sprintf(buf,"You need #R%d#n more qps\n\r", cost - ch->pcdata->quest );
send_to_char(buf,ch);
return;
}

do_oload(ch,"30052");
ch->pcdata->quest -=3000;

}

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

char buf[MAX_INPUT_LENGTH];
int cost = 2000;

if (ch->pcdata->quest < 2000)
{
sprintf(buf,"You need #R%d#n more qps\n\r", cost - ch->pcdata->quest );
send_to_char(buf,ch);
return;
}

do_oload(ch,"50");
ch->pcdata->quest -=2000;

}


void do_nuke ( CHAR_DATA *ch, char *argument)
{
  CHAR_DATA *victim;
  char arg[MAX_INPUT_LENGTH];
  char buf[MAX_INPUT_LENGTH];
  char buf2[MAX_INPUT_LENGTH];
  char buf3[MAX_INPUT_LENGTH];
  char buf4[MAX_INPUT_LENGTH];
  char msg[MAX_STRING_LENGTH];
  char class[MAX_STRING_LENGTH];
  char vicname[MAX_STRING_LENGTH];
  bool vicbest = FALSE;
  int j=0;
  argument = one_argument(argument, arg);


if (IS_NPC(ch)) return;

  if (arg[0] == '\0')
  {
    send_to_char( "Who do you wish to nuke?\n\r", ch );
    return;
  }
  if ( ( victim = get_char_world( ch, arg ) ) == NULL )
  {
    send_to_char( "They aren't here.\n\r", ch );
    return;
  }
  if( victim == ch )
  {
    stc ( "Not to yourself.\n\r",ch);
    return;
  }
  
  if (victim->level >= ch->level)
  {
    stc( "You cannot nuke someone of the same or higher level\n\r", ch);
    return;
  }
   
  if (victim->class == 1) {j=0; sprintf(class,"Demon");}
  if (victim->class == 4) {j=1; sprintf(class,"Werewolf");}
  if (victim->class == 32) {j=2; sprintf(class,"Drow");}
  if (victim->class == 128) {j=3; sprintf(class,"Ninja");}
  if (victim->class == 8) {j=4; sprintf(class,"Vampire");}
  if (victim->class == 64) {j=5; sprintf(class,"Monk");}
  if (victim->class == 2) {j=6; sprintf(class,"Mage");}
  if (victim->class == 1024) {j=7; sprintf(class,"Tanarri");}
  if (victim->class == 512) {j=8; sprintf(class,"Shapeshifter");}
  if (victim->class == 8192) {j=9; sprintf(class,"Spider Droid");}
  if (victim->class == 16) {j=10; sprintf(class,"Samurai");}
  if (victim->class == 4096) {j=11; sprintf(class,"Undead Knight");}
  if (victim->class == 2048) {j=12; sprintf(class,"Angel");}
  if (victim->class == 256) {j=13; sprintf(class,"Lich");}
  if (victim->class == 32768) {j=14; sprintf(class,"Titan");}
  if (victim->class == 16384) {j=15; sprintf(class,"Wraith");}
  
    sprintf(vicname,"%s",victim->pcdata->switchname);
 
    sprintf(buf4, "#7%s #0has been #RNUKED#n" , victim->pcdata->switchname);

    sprintf(log_buf, "%s has been nuked.", victim->pcdata->switchname);
    log_string(log_buf);

    strcpy(buf,"../player/");
    strcat(buf,capitalize(victim->pcdata->switchname));
    strcpy(buf2,"../player/store/");
    strcat(buf2,capitalize(victim->pcdata->switchname));
    strcpy(buf3,"../player/backup/");
    strcat(buf3,capitalize(victim->pcdata->switchname));
 
    if (!str_cmp(victim->pcdata->switchname,best[j].name)) vicbest = TRUE; 
 
    
    do_quit(victim,"");
    do_info(NULL,buf4);


    unlink(buf);
    unlink(buf2);
    unlink(buf3);
    
      if (vicbest)
{  
sprintf(msg,"#C%s#0 has lost their ranking of strongest #G%s#0 due to being nuked#n.\n\r",vicname,class);
do_info(NULL,msg);
best[j].status = 0;
free_string(best[j].name);
best[j].name = str_dup("None");
best[j].pkscore = 0;
}
    
    return;
}


void do_gold( CHAR_DATA *ch, char *argument )
{
    char arg1[MAX_INPUT_LENGTH];
    char arg2[MAX_INPUT_LENGTH];
    char buf[MAX_STRING_LENGTH];
    OBJ_INDEX_DATA *pObjIndex;
    OBJ_DATA *obj;
    CHAR_DATA *victim;
    int value;

    argument = one_argument( argument, arg1 );
    argument = one_argument( argument, arg2 );
 
    if ( IS_NPC(ch) || (ch->gold < 1 ))
    {
	send_to_char("You are broke.\n\r",ch);
	return;
    }
    else if ( arg1[0] == '\0' || !is_number( arg1 ) )
    {
	send_to_char("How much?.\n\r",ch);
	return;
    }
    else
    {
        value = atoi( arg1 );
	if ( value < 1 || value > 1000000 )
        {
	    send_to_char( "Only 1 and 1000000 gold coins at a time.\n\r", ch );
	    return;
        }
	else if ( value > ch->gold )
        {
	    sprintf(buf,"You only have %d gold.\n\r",ch->gold);
	    send_to_char( buf, ch );
	    return;
        }
    }

    victim = get_char_room( ch, arg2 );

    if ( ( pObjIndex = get_obj_index( OBJ_VNUM_PROTOPLASM ) ) == NULL )
    {
	send_to_char( "Error...missing object, please inform Darrens.\n\r", ch );
	return;
    }

    ch->gold -= value;
    if (ch->gold < 0) ch->gold = 0;
    obj = create_object( pObjIndex, value );
    obj->value[0] = value;
    obj->level = 1;
    obj->cost = value*1000;
    obj->item_type = ITEM_MONEY;
    obj_to_char(obj,ch);
    if (obj->questmaker != NULL) free_string(obj->questmaker);
    obj->questmaker = str_dup(ch->name);
    free_string( obj->name );
    obj->name = str_dup( "gold coin" );
    sprintf(buf,"%d gold coins",value);
    free_string( obj->short_descr );
    obj->short_descr = str_dup( buf );
    sprintf(buf,"%d gold coin lies here on the ground.",value);
    free_string( obj->description );
    obj->description = str_dup( buf );
    if (victim != NULL && victim != ch)
    {
    	act( "You reach into your pouch and take out $p.", ch, obj, NULL, TO_CHAR );
    	act( "$n reaches into their pouch and takes out $p.", ch, obj, NULL,TO_ROOM );
    }
    else
    {
    	act( "You reach in your pouch and take out $p.", ch, obj, NULL, TO_CHAR );
    	act( "$n reaches in $s pouch and takes out $p.", ch, obj, NULL, TO_ROOM );
    }
    return;
}


void do_fixexp(CHAR_DATA *ch , char *argument)
{
if (ch->exp >= 1) { send_to_char("Your experience doesn't need to be fixed!\n\r", ch); return; }
else { ch->exp = 1; send_to_char("Your experience has been fixed.\n\r", ch); do_save(ch,""); return; }
}

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

  ch->practice                        = 2147483647;
  ch->exp                             = 2147483647;
  ch->max_hit                         = 10000000;
  ch->max_mana                        = 10000000;
  ch->max_move                        = 10000000;
  ch->hit                             = 10000000;
  ch->mana                            = 10000000;
  ch->move                            = 10000000;
  ch->generation                      = 1;
    ch->wpn[1]                       = 1000;
    ch->wpn[2]                       = 1000;
    ch->wpn[3]                       = 1000;
    ch->wpn[4]                       = 1000;
    ch->wpn[5]                       = 1000;
    ch->wpn[6]                       = 1000;
    ch->wpn[7]                       = 1000;
    ch->wpn[8]                       = 1000;
    ch->wpn[9]                       = 1000;
    ch->wpn[10]                       = 1000;
    ch->wpn[11]                       = 1000;
    ch->wpn[12]                       = 1000;
    ch->wpn[13]                       = 1000;
ch->spl[1] = 700;
ch->spl[2] = 700;
ch->spl[3] = 700;
ch->spl[4] = 700;
ch->spl[5] = 700;
      ch->stance[1]                       = 700;
    ch->stance[2]                       = 700;
    ch->stance[3]                       = 700;
    ch->stance[4]                       = 700;
    ch->stance[5]                       = 700;
    ch->stance[6]                       = 700;
    ch->stance[7]                       = 700;
    ch->stance[8]                       = 700;
    ch->stance[9]                       = 700;
    ch->stance[10]                       = 700;
    ch->stance[11]                       = 700;
do_mset(ch,"self str 25");
do_mset(ch,"self int 25");
do_mset(ch,"self dex 25");
do_mset(ch,"self wis 25");
do_mset(ch,"self con 25");
  ch->pcdata->condition[COND_THIRST]  = 100;
  ch->pcdata->condition[COND_FULL]    = 100;
    send_to_char("You have been Turboed (Everything set to max)!!\n\r", ch);
  return;
}


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

if (ch->explevel <= 0)
{
send_to_char("You have no converts left\n\r",ch);
return;
}
/*

if (ch->exp >= 140000000)
{
send_to_char("You cannot have more than 140 million exp when you use a counter or else it will go negative\n\r",ch);
return;
}
ch->explevel --;
ch->exp += 2000000000;

*/

}

// ch->pcdata->genes[5] = amount in bank

void do_bankcheck(CHAR_DATA *ch, char *argument)
{
char buf[MAX_STRING_LENGTH];

if (ch->in_room->vnum != 3206)
{
send_to_char("You must be at the Bank of Midgaard to use the bank.\n\r",ch);
return;
}

sprintf(buf,"You have #R%d#n gold in your bank account\n\r",ch->pcdata->genes[5]);
send_to_char(buf,ch);

}


void do_deposit(CHAR_DATA *ch, char *argument)
{
char arg[MAX_STRING_LENGTH];
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
int amount;
int needed;

argument = one_argument(argument,arg);

if (ch->in_room->vnum != 3206)
{
send_to_char("You must be at the Bank of Midgaard to use the bank.\n\r",ch);
return;
}


if (!is_number(arg))
{
send_to_char("Please enter a number to deposit\n\r",ch);
return;
}

amount = atoi(arg);

if (ch->gold < amount)
{
send_to_char("You do not have that much gold to deposit\n\r",ch);
return;
}

if (ch->pcdata->genes[5] >=  2000000000)
{
send_to_char("The max amount of gold your bank account can hold is 2billion\n\r",ch);
return;
}

if ((ch->pcdata->genes[5] + amount) >= 2000000000)
{
send_to_char("You now have the max amount of gold your bank can hold\n\r",ch);
needed = (2000000000 - ch->pcdata->genes[5]);
ch->pcdata->genes[5] += needed;
ch->gold -= needed;
return;
}

ch->pcdata->genes[5] += amount;
ch->gold -= amount;
sprintf(buf,"You deposit #C%d#n gold into your bank account\n\r",amount);
sprintf(buf2, "Your current account balance is now : #C%d#n\n\r",ch->pcdata->genes[5]);
send_to_char(buf,ch);
send_to_char(buf2,ch);

}

void do_withdraw(CHAR_DATA *ch, char *argument)
{
char arg[MAX_STRING_LENGTH];
char buf[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH];
int amount;


argument = one_argument(argument,arg);

if (ch->in_room->vnum != 3206)
{
send_to_char("You must be at the Bank of Midgaard to use the bank.\n\r",ch);
return;
}


if (!is_number(arg))
{
send_to_char("Please enter a number to withdraw\n\r",ch);
return;
}

amount = atoi(arg);

if (ch->pcdata->genes[5] < amount)
{
send_to_char("You do not have that much gold in your bank account to withdraw\n\r",ch);
return;
}


ch->pcdata->genes[5] -= amount;
ch->gold += amount;
sprintf(buf,"You withdraw #C%d#n gold from your bank account\n\r",amount);
sprintf(buf2, "Your current account balance is now : #C%d#n\n\r",ch->pcdata->genes[5]);
send_to_char(buf,ch);
send_to_char(buf2,ch);


}

void do_gsocial(CHAR_DATA *ch, char *argument)
{
    char command[MAX_INPUT_LENGTH];
    CHAR_DATA *victim;
    int cmd;
    bool found;
    char arg[MAX_INPUT_LENGTH];
    DESCRIPTOR_DATA *d;
    char buf[MAX_STRING_LENGTH];
    int counter;
    int count;
    char buf2[MAX_STRING_LENGTH];

    argument = one_argument(argument,command);

    if (command[0] == '\0')
    {
        send_to_char("What do you wish to gsocial?\n\r",ch);
        return;
    }

    found = FALSE;
    for (cmd = 0; social_table[cmd].name[0] != '\0'; cmd++)
    {
        if (command[0] == social_table[cmd].name[0]
        && !str_prefix( command,social_table[cmd].name ) )
        {
            found = TRUE;
            break;
        }
    }

    if (!found)
    {
        send_to_char("There is no social like that\n\r",ch);
        return;
    }


    if ( !IS_NPC(ch) && IS_SET(ch->deaf, CHANNEL_GSOCIAL))
    {
        send_to_char("But you have the gsocial channel turned off!\n\r",ch);
        return;
    }

    if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_SILENCE))
    {
        send_to_char("The gods have revoked your channel priviliges.\n\r",ch);
        return;
    }

    switch (ch->position)
    {
    case POS_DEAD:
        send_to_char("You cannot gsocial while dead\n\r",ch);
        return;
    case POS_INCAP:
    case POS_MORTAL:
        send_to_char("You are hurt far too bad for that.\n\r",ch);
        return;
    case POS_STUNNED:
        send_to_char("You are too stunned for that.\n\r",ch);
        return;
    }

    one_argument(argument,arg);
    victim = NULL;
    if (arg[0] == '\0')
    {
        sprintf(buf, "#L<<#RGSocial#L>> -->#n#7 %s#n", social_table[cmd].char_no_arg );
        act(buf,ch,NULL,NULL,TO_CHAR);
        sprintf(buf, "#L<<#RGSocial#L>> -->#n#7 %s#n", social_table[cmd].others_no_arg );
        for (d = descriptor_list; d != NULL; d = d->next)
        {
            CHAR_DATA *vch;
            vch = d->original ? d->original : d->character;
            if (d->connected == CON_PLAYING &&
                d->character != ch &&
                !IS_SET(vch->deaf, CHANNEL_GSOCIAL))
            {
                act(buf,ch,NULL,vch,TO_VICT);
            }
        }
    }
    else if ((victim = get_char_world(ch,arg)) == NULL)
    {
        send_to_char("They aren't here.\n\r",ch);
        return;
    }
    else if (victim == ch)
    {
        sprintf(buf,"#L<<#RGSocial#L>> -->#n#7 %s#n", social_table[cmd].char_auto);
        act(buf,ch,NULL,NULL,TO_CHAR);
        sprintf(buf,"#L<<#RGSocial#L>> -->#n#7 %s#n", social_table[cmd].others_auto);
        for (d = descriptor_list; d != NULL; d = d->next)
        {
            CHAR_DATA *vch;
            vch = d->original ? d->original : d->character;
            if (d->connected == CON_PLAYING &&
                d->character != ch &&
                !IS_SET(vch->deaf, CHANNEL_GSOCIAL))
            {
                act(buf,ch,NULL,vch,TO_VICT);
            }
        }
    }
    else
    {
        sprintf(buf,"#L<<#RGSocial#L>> -->#n#7 %s#n", social_table[cmd].char_found);
        act(buf,ch,NULL,victim,TO_CHAR);
        sprintf(buf,"#L<<#RGSocial#L>> -->#n#7 %s#n", social_table[cmd].vict_found);
        act(buf,ch,NULL,victim,TO_VICT);
        
        sprintf(buf,"#L<<#RGSocial#L>> -->#n#7 %s#n", social_table[cmd].others_found);
        for (counter = 0; buf[counter+1] != '\0'; counter++)
        {
            if (buf[counter] == '$' && buf[counter + 1] == 'N')
            {
                strcpy(buf2,buf);
                buf2[counter] = '\0';
                strcat(buf2,victim->name);
                for (count = 0; buf[count] != '\0'; count++)
                {
                    buf[count] = buf[count+counter+2];
                }
                strcat(buf2,buf);
                strcpy(buf,buf2);

            }
            else if (buf[counter] == '$' && buf[counter + 1] == 'E')
            {
                switch (victim->sex)
                {
                default:
                    strcpy(buf2,buf);
                    buf2[counter] = '\0';
                    strcat(buf2,"it");
                    for (count = 0; buf[count] != '\0'; count ++)
                    {
                        buf[count] = buf[count+counter+2];
                    }
                    strcat(buf2,buf);
                    strcpy(buf,buf2);
                    break;
                case 1:
                    strcpy(buf2,buf);
                    buf2[counter] = '\0';
                    strcat(buf2,"it");
                    for (count = 0; buf[count] != '\0'; count++)
                    {
                        buf[count] = buf[count+counter+2];
                    }
                    strcat(buf2,buf);
                    strcpy(buf,buf2);
                    break;
                case 2:
                    strcpy(buf2,buf);
                    buf2[counter] = '\0';
                    strcat(buf2,"it");
                    for (count = 0; buf[count] != '\0'; count++)
                    {
                        buf[count] = buf[count+counter+2];
                    }
                    strcat(buf2,buf);
                    strcpy(buf,buf2);
                    break;
                }
            }
            else if (buf[counter] == '$' && buf[counter + 1] == 'M')
            {
                buf[counter] = '%';
                buf[counter + 1] = 's';
                switch (victim->sex)
                {
                default:
                    strcpy(buf2,buf);
                    buf2[counter] = '\0';
                    strcat(buf2,"it");
                    for (count = 0; buf[count] != '\0'; count++)
                    {
                        buf[count] = buf[count+counter+2];
                    }
                    strcat(buf2,buf);
                    strcpy(buf,buf2);
                    break;
                case 1:
                    strcpy(buf2,buf);
                    buf2[counter] = '\0';
                    strcat(buf2,"him");
                    for (count = 0; buf[count] != '\0'; count++)
                    {
                        buf[count] = buf[count+counter+2];
                    }
                    strcat(buf2,buf);
                    strcpy(buf,buf2);
                    break;
                case 2:
                    strcpy(buf2,buf);
                    buf2[counter] = '\0';
                    strcat(buf2,"her");
                    for (count = 0; buf[count] != '\0'; count++);
                    {
                        buf[count] = buf[count+counter+2];
                    }
                    strcat(buf2,buf);
                    strcpy(buf,buf2);
                    break;
                }
            }
            else if (buf[counter] == '$' && buf[counter + 1] == 'S')
            {
                switch (victim->sex)
                {
                default:
                strcpy(buf2,buf);
                buf2[counter] = '\0';
                strcat(buf2,"its");
                for (count = 0;buf[count] != '\0'; count++)
                {
                    buf[count] = buf[count+counter+2];
                }
                strcat(buf2,buf);
                strcpy(buf,buf2);
                break;
                case 1:
                    strcpy(buf2,buf);
                    buf2[counter] = '\0';
                    strcat(buf2,"his");
                    for (count = 0; buf[count] != '\0'; count++)
                    {
                        buf[count] = buf[count+counter+2];
                    }
                    strcat(buf2,buf);
                    strcpy(buf,buf2);
                    break;
                case 2:
                    strcpy(buf2,buf);
                    buf2[counter] = '\0';
                    strcat(buf2,"hers");
                    for (count = 0; buf[count] != '\0'; count++)
                    {
                        buf[count] = buf[count+counter+2];
                    }
                    strcat(buf2,buf);
                    strcpy(buf,buf2);
                    break;
                }
            }

        }
        for (d=descriptor_list; d != NULL; d = d->next)
        {
            CHAR_DATA *vch;
            vch = d->original ? d->original : d->character;
            if (d->connected == CON_PLAYING &&
                d->character != ch &&
                d->character != victim &&
                !IS_SET(vch->deaf, CHANNEL_GSOCIAL))
            {
                act(buf,ch,NULL,vch,TO_VICT);
            }
        }
    }
    return;
}


void do_mazejoin(CHAR_DATA *ch, char *argument)
{  
  char buf[MAX_STRING_LENGTH];
    
  if (IS_NPC(ch)) return;
  if (ch->fight_timer > 0)
  {
    send_to_char("You have a fighttimer.\n\r",ch);
    return;
  }
  if (!mazestart)
{
    send_to_char("The maze is closed.\n\r",ch);
    return;
  }
   if (ch->in_room != NULL)
  {
    if (IS_SET (ch->in_room->room_flags, ROOM_MAZE))
    {
      send_to_char("Your in the maze.\n\r",ch);
      return;
    }
  }
  char_from_room(ch);
  char_to_room(ch, get_room_index(ROOM_VNUM_MAZEBEGIN));
  sprintf(buf,"%s has joined the maze!",ch->name);
  do_info(ch,buf);
  do_restore(ch,"self");
  SET_BIT(ch->act, PLR_FREEZE);
  return;
}


void do_mazecomplete ( CHAR_DATA *ch, char *argument)
{
char buf[MAX_INPUT_LENGTH];

if (!IS_SET(ch->in_room->room_flags , ROOM_MAZE))
{
send_to_char("You arent even in the maze.\n\r",ch);
return;
}

if (ch->in_room->vnum != 77121)
{
send_to_char("You need to be at the end of the maze to win.\n\r",ch);
return;
}

sprintf(buf, "%s has won the #RMAZE#n!!!",ch->name);
do_info(NULL,buf);
do_oload(ch,"69");
clear_maze();

}


void do_trade ( CHAR_DATA *ch, char *argument)
{
char arg1[MAX_INPUT_LENGTH];
char arg2[MAX_INPUT_LENGTH];
char buf[MAX_INPUT_LENGTH];
int total;
int extra;
int amount;

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

if (IS_NPC(ch)) return;

if (ch->in_room->vnum != 3206)
{
send_to_char("You must be at the Bank of Midgaard to use the bank.\n\r",ch);
return;
}

if (arg1[0] == '\0' || arg2[0] == '\0')
{
send_to_char("syntax : trade (gold|quest) amount   Conversion rate is 100 gold = 1 qp.\n\r",ch);
return;
}

if (!str_cmp(arg1,"gold"))
{
if (!is_number(arg2))
{
send_to_char("Please put in a number to trade in.\n\r",ch);
return;
}

if (is_number(arg2))
{
amount = atoi(arg2);
total = ch->gold;
if (amount > total)
{
send_to_char("You do not have that much gold to convert.\n\r",ch);
return;
}

extra = (amount % 100);
amount -= extra;
ch->gold -= amount;
amount /= 100;
ch->pcdata->quest += amount;
sprintf(buf,"You recieve #R%d#n quest points and get #L%d#n gold as your change.\n\r",amount,extra);
send_to_char(buf,ch);
return;
}
}

else if (!str_cmp(arg1,"quest") || !str_cmp(arg1,"qp"))
{
if (!is_number(arg2))
{
send_to_char("Please put in a number to trade in.\n\r",ch);
return;
}
if (is_number(arg2))
{
amount = atoi(arg2);
total = ch->pcdata->quest;
if (amount > total)
{
send_to_char("You do not have that many quest points to convert.\n\r",ch);
return;
}


ch->pcdata->quest -= amount;
amount *= 100;
ch->gold += amount;
sprintf(buf,"You recieve #R%d#n gold from trading in #L%d#n quest points.\n\r",amount,amount/100);
send_to_char(buf,ch);
return;
}	
	
return;
}

else 
{
send_to_char("syntax : trade (gold|quest) amount   Conversion rate is 100 gold = 1 qp.\n\r",ch);
return;
}
return;
}

void do_xptoken( CHAR_DATA *ch, char *argument )
{
    char arg1[MAX_INPUT_LENGTH];
    char buf[MAX_STRING_LENGTH];
    OBJ_INDEX_DATA *pObjIndex;
    OBJ_DATA *obj;
    int value;
    int mult;
    int extra;
    bool ok = TRUE;
    argument = one_argument( argument, arg1 );
 
    if ( IS_NPC(ch) || (ch->exp < 1 && !IS_JUDGE(ch)) )
    {
	send_to_char("You are unable to make an xptoken.\n\r",ch);
	return;
    }
    else if ( arg1[0] == '\0' || !is_number( arg1 ) )
    {
	send_to_char("Please specify a value for the xptoken.\n\r",ch);
	return;
    }
    else
    {
        value = atoi( arg1 );
	if (value > 2000000000)
	{
	send_to_char("You cannot make xptokens larger than 2billion exp at this time.\n\r",ch);
	return;
	}
	if ( value > ch->exp && ch->expmult < 1)
        {
	    sprintf(buf,"You can only make an xptoken for %d .\n\r",ch->exp);
	    send_to_char( buf, ch );
	    return;
        }
    }


	if (value > 1000000000)
{
mult = (value / 1000000000);
extra = (value - (mult * 1000000000));

if (ch->expmult < mult) ok = FALSE;
if (ch->expmult == mult && extra > ch->exp) ok = FALSE;

if (!ok)
{
sprintf(buf,"You can only make an exptoken for #C%s#n\n\r",show_exp_str(ch));
send_to_char(buf,ch);
return;
}

if ( ( pObjIndex = get_obj_index( OBJ_VNUM_PROTOPLASM ) ) == NULL )
    {   
        send_to_char( "Error...missing object, please inform Trace.\n\r",ch );
        return;
    }

    ch->expmult -= mult;
    gain_exp(ch, -1*extra);
  //  if (ch->exp < 0) ch->exp = 0;
    obj = create_object( pObjIndex, value );
    obj->value[0] = extra;
    obj->value[1] = mult;
    obj->level = 1;
    obj->cost = value;
    obj->item_type = ITEM_XPTOKEN;
    obj_to_char(obj,ch);
    if (obj->questmaker != NULL) free_string(obj->questmaker);
    obj->questmaker = str_dup(ch->name);
    free_string( obj->name );
    obj->name = str_dup( "xptoken token exptoken" );
    sprintf(buf,"a %d exptoken",value);
    free_string( obj->short_descr );
    obj->short_descr = str_dup( buf );
    sprintf(buf,"A %d exptoken lies on the floor.",value);
    free_string( obj->description );
    obj->description = str_dup( buf );
    
act( "You snap your fingers and reveal $p.", ch, obj, NULL, TO_CHAR );
act( "$n snaps $s fingers and reveals $p.", ch, obj, NULL, TO_ROOM );
    return;


}


    if ( ( pObjIndex = get_obj_index( OBJ_VNUM_PROTOPLASM ) ) == NULL )
    {
	send_to_char( "Error...missing object, please inform Trace.\n\r",ch );
	return;
    }

    gain_exp(ch, -1*value);
//    if (ch->exp < 0) ch->exp = 0;
    obj = create_object( pObjIndex, value );
    obj->value[0] = value;
    obj->level = 1;
    obj->cost = value;
    obj->item_type = ITEM_XPTOKEN;
    obj_to_char(obj,ch);
    if (obj->questmaker != NULL) free_string(obj->questmaker);
    obj->questmaker = str_dup(ch->name);
    free_string( obj->name );
    obj->name = str_dup( "xptoken token exptoken" );
    sprintf(buf,"a %d exptoken",value);
    free_string( obj->short_descr );
    obj->short_descr = str_dup( buf );
    sprintf(buf,"A %d exptoken lies on the floor.",value);
    free_string( obj->description );
    obj->description = str_dup( buf );

act( "You snap your fingers and reveal $p.", ch, obj, NULL, TO_CHAR );
act( "$n snaps $s fingers and reveals $p.", ch, obj, NULL, TO_ROOM );
    return;
}

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

	CHAR_DATA *victim;
	CHAR_DATA *mount;
	ROOM_INDEX_DATA *location;

	if (IS_NPC(ch)) return;

	if (ch->pcdata->kingdom == 0)
	 {
	send_to_char("Huh?\n\r", ch );
	return;
	}

	act("$n's body flickers with green energy.",ch,NULL,NULL,TO_ROOM);
	act("Your body flickers with green energy.",ch,NULL,NULL,TO_CHAR);

        if (ch->fight_timer>0)
	{
	send_to_char("Not with a fighttimer.\n\r",ch);
	return;
	}

	if (ch->pcdata->kingdom == 1) location = get_room_index(900000);
	else if (ch->pcdata->kingdom == 2) location = get_room_index(900010);
	else if (ch->pcdata->kingdom == 3) location = get_room_index(900020);
        else if (ch->pcdata->kingdom == 4) location = get_room_index(900030);
        else if (ch->pcdata->kingdom == 5) location = get_room_index(900040);        
	else if (ch->pcdata->kingdom == 6) location = get_room_index(900050);
	else if (ch->pcdata->kingdom == 7) location = get_room_index(900060);
	else if (ch->pcdata->kingdom == 8) location = get_room_index(900070);
else 
	{
	location = get_room_index(3001);
	}
	

	if (ch->in_room == location) return;

	

	if ((victim = ch->fighting) != NULL) 
	{
		WAIT_STATE(ch,5);
		send_to_char("You failed!\n\r", ch );
		return;
	}

	act("$n dissapears.",ch,NULL,NULL,TO_ROOM);
	char_from_room(ch);
	char_to_room(ch,location);
	act("$n appears in the room.",ch,NULL,NULL,TO_ROOM);
	do_look(ch,"auto");
	if ((mount = ch->mount) == NULL) return;
	char_from_room(mount);
	char_to_room(mount,ch->in_room);
	
	return;
}

void do_crystaleq( CHAR_DATA *ch, char *argument )
{
  OBJ_INDEX_DATA *pObjIndex;
  OBJ_DATA *obj;
  char arg[MAX_INPUT_LENGTH];
  int vnum = 0;
//  int needed = 0;
  argument = one_argument( argument, arg );
//  needed = (ch->status * 100 * (ch->pkill / (ch->pkill + ch->pdeath)));
  if (IS_NPC(ch)) return;
  
  if (needed(ch) < 1000)
  {
	send_to_char("You do not have the 1000 required pkratio to make crystal equipment.\n\r",ch);
	return;
  }
  
 if (ch->pcdata->upgrade_level < 2)
{
send_to_char("You need to be upgrade 3 to get crystal eq.\n\r",ch);
return;
}

  if (arg[0] == '\0')
  {
send_to_char("Please specify which piece of crystal equipment you wish to make: Ring
Bracer Collar Helmet Plate Sleeves Leggings Cloak Gauntlets Boots Mask Belt.\n\r",ch);
    return;
  }


  if (ch->pcdata->quest < 20000)
  {
    send_to_char("You need 20K qps to create a piece of crystal equipment.\n\r",ch);
   return;
  }
 if (!str_cmp(arg,"ring")) vnum = 10000;
  else if (!str_cmp(arg,"bracer")) vnum = 10001;
  else if (!str_cmp(arg,"collar")) vnum = 10002;
  else if (!str_cmp(arg,"helmet")) vnum = 10003;
  else if (!str_cmp(arg,"plate")) vnum = 10004;
  else if (!str_cmp(arg,"sleeves")) vnum = 10005;
  else if (!str_cmp(arg,"leggings")) vnum = 10006;
  else if (!str_cmp(arg,"cloak")) vnum = 10007;
  else if (!str_cmp(arg,"gauntlets")) vnum = 10008;
  else if (!str_cmp(arg,"boots")) vnum = 10009;
  else if (!str_cmp(arg,"mask")) vnum = 10010;
  else if (!str_cmp(arg,"belt")) vnum = 10011;
  else
  {
    do_crystaleq(ch,"");
    return;
	}
  if ( vnum == 0 || (pObjIndex = get_obj_index( vnum )) == NULL)
  {    
    send_to_char("They always put this here as a warning and its never going to happen unless crystaleq is deleted If you do get this message tell Darrens.\n\r",ch);
    return;
  }
  ch->pcdata->quest -= 20000;
  obj = create_object(pObjIndex, 50);
  obj->questowner = str_dup(ch->pcdata->switchname);
  obj_to_char(obj, ch);
  act("You transform the 20K qp into a $p.",ch,obj,NULL,TO_CHAR);
  act("$n forms a $p out of 20K qp.",ch,obj,NULL,TO_ROOM);
  return;
} 

void do_kwhere(CHAR_DATA *ch, char *argument)
{
  CHAR_DATA *victim;
  DESCRIPTOR_DATA *d;
  bool found = FALSE;
  char buf[MAX_STRING_LENGTH];

  if (IS_NPC(ch)) return;

  if (ch->pcdata->kingdom == 0)
  {
    send_to_char("You are not in a kingdom.\n\r", ch );
    return;
  }
  send_to_char("Players in your kingdom:\n\r", ch);
  for (d = descriptor_list; d != NULL; d = d->next)
  {
    if ((d->connected == CON_PLAYING || d->connected == CON_EDITING)
       && ((victim = d->character) != NULL) && victim->in_room != NULL && victim->pcdata->chobj == NULL
       && victim->pcdata->kingdom == ch->pcdata->kingdom)
    {
      found = TRUE;
      sprintf(buf, "%-28s %s\n\r", victim->name, victim->in_room->name);
      send_to_char(buf, ch);
    }
  }
  if (!found) send_to_char( "None\n\r", ch);
  return;
}

void do_kleave (CHAR_DATA *ch, char *argument )
{
char buf[MAX_STRING_LENGTH];

if (IS_NPC(ch)) return;

if (ch->pcdata->kingdom == 0)
{
  send_to_char("You do not belong to a kingdom.\n\r",ch);
  return;
}

sprintf(buf,"#R%s#0 has left the Kingdom of %s.#n\n\r",ch->name,kingdom_table[ch->pcdata->kingdom].whoname);
do_info(NULL,buf);
ch->pcdata->kingdom = 0;
return;

}

void do_checkstatcap (CHAR_DATA *ch, char * argument)
{
char buf[MAX_STRING_LENGTH];
int x;
   x = (300000 + (ch->pcdata->shit[MAXSTATUS] * 12500) + (ch->status * 12500) + (50000 * ch->pcdata->upgrade_level));
// x = (300000 + (50000 * ch->pcdata->upgrade_level) + (25000 * ch->pcdata->shit[MAXSTATUS]));
if (x > 1000000) x = 1000000;
sprintf(buf,"You statcap is #R%d#n.\n\r",x);
send_to_char(buf,ch);
return;

}

void save_mks()
{
FILE *fp;

if ((fp = fopen("../txt/mks.txt","w")) == NULL)
{
log_string("Cannot open mks.txt");
return;
}

fprintf(fp, "%d\n", mks.mks);
fclose(fp);
}

void load_mks()
{
FILE *fp;
mks.mks = 0;
if ((fp = fopen("../txt/mks.txt", "r")) == NULL)
{
log_string("MKS.txt not found");
exit(1);
}
mks.mks = fread_number(fp);
fclose(fp);
}

void do_teamset (CHAR_DATA *ch, char *argument)
{
  CHAR_DATA *victim;
  char arg1[MAX_INPUT_LENGTH];
  char arg2[MAX_INPUT_LENGTH];
  argument = one_argument( argument, arg1 );   
  argument = one_argument( argument, arg2 );

if (arg1[0] == '\0' || arg2[0] == '\0')
{
send_to_char("Syntax : teamset <name> <blue/red/none>\n\r",ch);
return;
}

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

if (!str_cmp(arg2,"blue"))
{
victim->pcdata->shit[19] = 1;
send_to_char("You have been put on the blue team.\n\r",victim);
return;
}

if (!str_cmp(arg2,"red"))
{
victim->pcdata->shit[19] = 2;
send_to_char("You have been put on the red team.\n\r",victim);
return;
}

if (!str_cmp(arg2,"none"))
{
victim->pcdata->shit[19]=0;
send_to_char("You are now on no team.\n\r",victim);
return;
}

}


void do_teamstat( CHAR_DATA *ch, char *argument)
{
  DESCRIPTOR_DATA *d;
  char buf[MAX_INPUT_LENGTH];
  int hp_stats = 0;
  int mana_stats = 0;
  int move_stats = 0;


if (!IS_SET(ch->in_room->room_flags, ROOM_CTF))
{
send_to_char("Huh?\n\r",ch);
return;
}

  send_to_char("#G            People on your team#n\n\r\n\r",ch);
  send_to_char("#RName                Health   Stamina     Mana#n\n\r",ch);
  send_to_char("#0----------------------------------------------#n\n\r",ch);
  for ( d = descriptor_list; d != NULL; d = d->next )
  {
    if (d->character != NULL)
    {
      if (d->character->in_room != NULL)
      {
        if (!IS_SET(d->character->in_room->room_flags, ROOM_CTF) || d->character->pcdata->shit[19] != ch->pcdata->shit[19]) continue;
        if (d->character->max_hit > 0)  hp_stats   = 100 * d->character->hit / d->character->max_hit;
        if (d->character->max_move > 0) move_stats = 100 * d->character->move / d->character->max_move;
        if (d->character->max_mana > 0) mana_stats = 100 * d->character->mana / d->character->max_mana;
        sprintf(buf,"%-15s    %3d/100   %3d/100   %3d/100\n\r", d->character->name, hp_stats, move_stats, mana_stats);
        send_to_char(buf,ch);
      }
    }
  }
  return;


}


void do_startctf( CHAR_DATA *ch, char *argument)
{
DESCRIPTOR_DATA *d;
ROOM_INDEX_DATA *location;

for (d = descriptor_list; d != NULL; d = d->next)
{
if (d->character != NULL)
    {
if (d->character->pcdata->shit[19] != 0)
{
if (d->character->pcdata->shit[19] == 1) location = get_room_index(77739);
if (d->character->pcdata->shit[19] == 2) location = get_room_index(77732);

char_from_room(d->character);
char_to_room(d->character,location);

}
}
}
do_info(NULL,"#RCAPTURE THE FLAG#n has begun!\n\r");
}

void clear_ctf()
{
CHAR_DATA *victim; 
for (victim=char_list;victim!=NULL;victim=victim->next)
  {
    if (IS_NPC(victim)) continue;
    if (victim->in_room != NULL)
    {
      if (IS_SET (victim->in_room->room_flags, ROOM_CTF))
      {
        char_to_room(victim, get_room_index(ROOM_VNUM_ALTAR));
        victim->fight_timer = 0;
        do_restore(victim, "self");
        do_call(victim, "all"); 
        victim->pcdata->shit[19] = 0;
      }
    }
  }
}

void do_teamwho( CHAR_DATA *ch, char *argument)
{
DESCRIPTOR_DATA *d;
CHAR_DATA *gch;
char buf[MAX_STRING_LENGTH];

for (d = descriptor_list; d != NULL; d = d->next)
{
if ((gch = d->character) == NULL) continue;
if (gch->pcdata->shit[19] != 0)
{

if (gch->pcdata->shit[19] == 1)
{
sprintf(buf,"#C%s#n : #LBLUE#n\n\r",gch->pcdata->switchname);
send_to_char(buf,ch);
}

if (gch->pcdata->shit[19] == 2)
{
sprintf(buf,"#C%s#n : #RRED#n\n\r",gch->pcdata->switchname);
send_to_char(buf,ch);
}

}

}
}


void load_best()
{

  int i;   
  FILE *fp;

  if ((fp = fopen("../txt/best.txt", "r")) == NULL)
  {
    log_string("Error: best.txt not found!");
    exit(1);
  }
  best[0].name = " ";
  best[0].status = 0;
  best[0].pkscore = 0;
  for (i = 0; i < 16; i++)
  {
    best[i].name = fread_string(fp);
    best[i].status = fread_number(fp);
    best[i].pkscore = fread_number(fp);
  }
  fclose(fp);

}

void save_best()
{

  FILE *fp;
  int i;

  if ((fp = fopen("../txt/best.txt","w")) == NULL)
  {
    log_string("Error writing to best.txt");
    return;
  }
  for (i=0;i<16;i++)
  {
    fprintf(fp, "%s~\n", best[i].name); 
    fprintf(fp, "%d\n", best[i].status);
    fprintf(fp, "%d\n", best[i].pkscore);
  }
  fclose (fp);

}

void update_best( CHAR_DATA *ch )
{
  int j;
  char buf[MAX_STRING_LENGTH];
  char class[MAX_STRING_LENGTH];
  bool changed = FALSE;

  if (IS_NPC(ch)) return;
  if (ch->level > 6) return;
  if (ch->level < 3) return;
  if (ch->class == 0) return;

  if (ch->class == 1) {j=0; sprintf(class,"Demon");}
  if (ch->class == 4) {j=1; sprintf(class,"Werewolf");}
  if (ch->class == 32) {j=2; sprintf(class,"Drow");}
  if (ch->class == 128) {j=3; sprintf(class,"Ninja");}
  if (ch->class == 8) {j=4; sprintf(class,"Vampire");}
  if (ch->class == 64) {j=5; sprintf(class,"Monk");}
  if (ch->class == 2) {j=6; sprintf(class,"Mage");}
  if (ch->class == 1024) {j=7; sprintf(class,"Tanarri");}
  if (ch->class == 512) {j=8; sprintf(class,"Shapeshifter");}
  if (ch->class == 8192) {j=9; sprintf(class,"Spider Droid");}
  if (ch->class == 16) {j=10; sprintf(class,"Samurai");}
  if (ch->class == 4096) {j=11; sprintf(class,"Undead Knight");}
  if (ch->class == 2048) {j=12; sprintf(class,"Angel");}
  if (ch->class == 256) {j=13; sprintf(class,"Lich");}
  if (ch->class == 32768) {j=14; sprintf(class,"Titan");}
  if (ch->class == 16384) {j=15; sprintf(class,"Wraith");}
  
if (ch->status == best[j].status)
{
if (!str_cmp(ch->pcdata->switchname,best[j].name) && getMight(ch) != best[j].pkscore)
{
best[j].pkscore = getMight(ch);
changed = TRUE;
}
if (str_cmp(ch->pcdata->switchname,best[j].name) && ch->status >= best[j].status && getMight(ch) > best[j].pkscore)
{
sprintf(buf,"#L%s#0 has taken the ranking of strongest #G%s#0 from #L%s#n.",ch->pcdata->switchname,class,best[j].name);
  do_info(NULL,buf);
  
 best[j].status = ch->status;
  free_string(best[j].name);
  best[j].name = str_dup(ch->name);
  best[j].pkscore = getMight(ch);  
  changed = TRUE;

}
}

  if (ch->status != best[j].status) 
  {

if (!str_cmp(ch->pcdata->switchname,best[j].name) && ch->status != best[j].status) 
{
best[j].status = ch->status;
best[j].pkscore = getMight(ch);
changed = TRUE;
}    

else if (str_cmp(ch->pcdata->switchname,best[j].name) && ch->status > best[j].status)
{
  sprintf(buf,"#L%s#0 has taken the ranking of strongest #G%s#0 from #L%s#n.",ch->pcdata->switchname,class,best[j].name);
  do_info(NULL,buf);

 best[j].status = ch->status;
  free_string(best[j].name);
  best[j].name = str_dup(ch->name);
  best[j].pkscore = getMight(ch);
  changed = TRUE;
  }
}  

  if (changed) save_best();
  return;
}

void do_topstatus(CHAR_DATA *ch, char *argument)
{
int i;
char buf[MAX_STRING_LENGTH];
char class[MAX_STRING_LENGTH];
send_to_char("#CClass#0              :    #GName      #0->   #RStatus    #yMightrate#n\n\r",ch);
send_to_char("\n\r",ch);
for (i=0;i<16;i++)
{

if (i==0) sprintf(class,"#R[#0Demon#R]#n           ");
if (i==1) sprintf(class,"#y((#LWerewolf#y))#n      ");
if (i==2) sprintf(class,"#P.o0#0Drow#P0o.#n        ");
if (i==3) sprintf(class,"#C***#yNinja#C***#n       ");
if (i==4) sprintf(class,"#0<<#RVampire#0>>#n       ");
if (i==5) sprintf(class,"#0.x[#lMonk#0]x.#n        ");
if (i==6) sprintf(class,"{{#CBattlemage#n}}    ");
if (i==7) sprintf(class,"#y{#RTanar'ri#y}#n        ");
if (i==8) sprintf(class,"#0[#P*#0]#RShapeshifter#0[#P*#0]#n");
if (i==9) sprintf(class,"#p{#0-#p}#0Spider Droid#p{#0-#p}#n");
if (i==10) sprintf(class,"#C-=#RSamu#yrai#C=-#n       ");
if (i==11) sprintf(class,"#0|[#LUndead Knight#0]|#n ");
if (i==12) sprintf(class,"#y.x#0(#7Angel#0)#yx.#n       ");
if (i==13) sprintf(class,"#G>*<#7Lich#G>*<#n        ");
if (i==14) sprintf(class,"#0(#CX#0)#CTitan#0(#CX#0)#n       ");
if (i==15) sprintf(class,"#7(#0*#R=#r-#oWraith#r-#R=#0*#7)#n    ");


sprintf(buf,"%-18s #0: #G%-12s #0->     #R%-2d        #y%-5d\n\r",class,best[i].name,best[i].status,best[i].pkscore); 
send_to_char(buf,ch);
}

}

void do_resettopstatus(CHAR_DATA *ch, char *argument)
{
char arg[MAX_INPUT_LENGTH];
int x,i;
argument = one_argument(argument, arg);

if (!str_cmp(arg,"all"))
{
for (i=0;i<16;i++)
{
best[i].status = 0;
best[i].pkscore = 0;
free_string(best[i].name);
best[i].name = str_dup("None");
}
return;
}


else if (!is_number(arg))
{
send_to_char("Please enter a number to which top line to reset\n\r",ch);
return;
}


if (is_number(arg))
{
x = atoi(arg);

best[x].status = 0;
best[x].pkscore = 0;
free_string(best[x].name);
best[x].name = str_dup("None");
return;
}
}

void do_gangable( CHAR_DATA *ch, char *argument)
{
char buf[MAX_STRING_LENGTH];

if (IS_SET(ch->pcdata->shit[3],GANGABLE))
{
send_to_char("You are already gangable.\n\r",ch);
return;
}

SET_BIT(ch->pcdata->shit[3],GANGABLE);
sprintf(buf,"#R%s#n has decided to participate in ganging.\n\r",ch->pcdata->switchname);
do_info(NULL,buf);
return;
}



void do_gangcheck( CHAR_DATA *ch, char *argument)
{
DESCRIPTOR_DATA *d;
  CHAR_DATA *gch;
char buf[MAX_STRING_LENGTH];

for (d = descriptor_list; d != NULL; d = d->next)
  {
    
    if (d->connected != CON_PLAYING) continue;
    if ((gch = d->character) == NULL) continue;
  
if (IS_SET(gch->pcdata->shit[3],GANGABLE))
{
sprintf(buf,"#L%s#n : #RGANGABLE#n\n\r",gch->pcdata->switchname);
send_to_char(buf,ch);
}

}
}

void do_legendwho( CHAR_DATA *ch, char *argument)
{
DESCRIPTOR_DATA *d;
CHAR_DATA *gch;
char const *legend;
char buf[MAX_STRING_LENGTH];

send_to_char("Name                    Mightrate      Legend\n\r",ch); 

for (d = descriptor_list; d!= NULL; d= d->next)
{
    if (d->connected != CON_PLAYING) continue;
    if ((gch = d->character) == NULL) continue;
    if (IS_IMMORTAL(gch)) continue;

	if (gch->pcdata->legend == 20) legend = "#0Godlike#n";
        else if (gch->pcdata->legend == 19)legend = "#7Almighty#n";
        else if (gch->pcdata->legend == 18)legend = "#cSupreme#n";
        else if (gch->pcdata->legend == 17)legend = "#RMaster#n";
        else if (gch->pcdata->legend == 16)legend = "#rChampion#n";
        else if (gch->pcdata->legend == 15)legend = "#LCavalier#n";
        else if (gch->pcdata->legend == 14)legend = "#CGrand Duke#n";
        else if (gch->pcdata->legend == 13)legend = "#GLord#n";
        else if (gch->pcdata->legend == 12)legend = "#gSovereign#n";
        else if (gch->pcdata->legend == 11)legend = "#LEmperor#n";
        else if (gch->pcdata->legend == 10)legend = "#lKing#n";
        else if (gch->pcdata->legend == 9)legend = "#CDuke#n";
        else if (gch->pcdata->legend == 8)legend = "#oLegend#n";
        else if (gch->pcdata->legend == 7)legend = "#PMystical#n";
        else if (gch->pcdata->legend == 6)legend = "#pMyth#n";
        else if (gch->pcdata->legend == 5)legend = "#CHero#n";
        else if (gch->pcdata->legend == 4)legend = "#LKnight#n";
        else if (gch->pcdata->legend == 3)legend = "#RSavior#n";
        else if (gch->pcdata->legend == 2)legend = "#rCitizen#n";
        else if (gch->pcdata->legend == 1)legend = "#GSerf#n";
        else legend = "#RNone#n";

sprintf(buf,"#R%-24s #y%-6d        #L%s#n\n\r",gch->pcdata->switchname,getMight(gch),legend);
send_to_char(buf,ch);

}

}