atd/area/
atd/build/
atd/clans/
atd/log/
atd/player/store/
atd/site/
atd/src/bin/
/* New Legend Commands by Tracker */
#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"
#include "player.h"
#include "commands.h"

void do_lgoto(CHAR_DATA *ch, char *argument)
{
    char arg[MAX_INPUT_LENGTH];
    ROOM_INDEX_DATA *location;  
    CHAR_DATA *mount;
            
    one_argument(argument, arg);

    if (ch->lstatus < 15)
    {
          send_to_char("You need 15 legend status to do that!\n\r",ch);
          return;
    }

    if (arg[0] == '\0')
    {
        send_to_char("Goto where?\n\r", ch); 
        return;
    }
    
    if ((location = find_location(ch, arg)) == NULL)
    {
        send_to_char("No such location.\n\r", ch);
        return;
    }
    
    if (room_is_private(location) && get_trust(ch) < LEVEL_IMPLEMENTOR)
    {
        send_to_char("That room is private right now.\n\r", ch);
        return;
    }
     
    if (ch->fighting != NULL)
        stop_fighting(ch, TRUE);
    if (!IS_SET(ch->act, PLR_WIZINVIS))
    {
        act("$n $T.", ch, NULL,
            (ch->pcdata != NULL && ch->pcdata->bamfout[0] != '\0')
            ? ch->pcdata->bamfout : "chants some legend words, and vanishes!", TO_ROOM);
    }
    
    char_from_room(ch);
    char_to_room(ch, location);
        
    if (!IS_SET(ch->act, PLR_WIZINVIS))
    {
        act("$n $T.", ch, NULL,
            (ch->pcdata != NULL && ch->pcdata->bamfin[0] != '\0')
            ? ch->pcdata->bamfin : "chants some legend words, and appears!", TO_ROOM);
    }
     
    do_look(ch, "auto");
    if ((mount = ch->mount) == NULL) return;
    char_from_room(mount);
    char_to_room(mount, ch->in_room);
    do_look(mount, "auto");
    return;
}

void do_lhide( CHAR_DATA *ch, char *argument )
{
    if (IS_NPC(ch)) return;
 
    if (ch->lstatus < 14)
    {
          send_to_char("Huh?\n\r",ch);
          return;
    }

    if (ch->fight_timer >0) 
    {
        send_to_char("Not until your fight timer expires.\n\r", ch );
        return;
    }
        
/*    if ( IS_SET(ch->flag2, AFF2_LHIDE) )
    {
        REMOVE_BIT(ch->flag2, AFF2_LHIDE);
        act( "$n appears out of nowhere.", ch, NULL, NULL, TO_ROOM );
        send_to_char( "You appear out of nowhere.\n\r", ch );
    }
    else
    {   
        act( "$n disappears into thin air.", ch, NULL, NULL, TO_ROOM );
        send_to_char( "You disappear into thin air.\n\r", ch );
        SET_BIT(ch->flag2, AFF2_LHIDE);
    }*/
    return;
}

void do_lgain( CHAR_DATA *ch, char *argument )
{
    char      arg1 [MAX_INPUT_LENGTH];
    char      buf[MAX_STRING_LENGTH];
    int legendexp;
    int legendquest;
                
    smash_tilde(argument);
    argument = one_argument(argument,arg1);

    if (IS_NPC(ch)) return;
                                
    if (ch->lstatus < 15)
    {
      send_to_char("You need to have 15 legend to do this.\n\r",ch);
      return;
    }

    legendexp = ( 2000000 + ( 3000000 * ch->lstatus ) );
    legendquest = ( 5000 * ch->lstatus );

    if ( arg1[0] == '\0' )
    {
                send_to_char( "Syntax: Lgain <RM/RL/CL/LM/GL>\n\r", ch );
send_to_char("{c ____________________________________________________________________________________{x\n\r", ch );
send_to_char("{c|{w Name     {c|{w Long Name     {c|{w  HP  {c|{w MANA {c|{w MOVE {c|{w  QP  {c|{w EXP   {c|{w OTHER               {c|{x\n\r", ch );
send_to_char("{c|----------|---------------|------|------|------|------|-------|---------------------|{x\n\r", ch );
if (ch->lstatus < 16){
send_to_char("{c|{w {D-{w={c({WRM{c){w={D-{x {c|{w Realm Master  {c|{w 100k {c|{w n/a  {c|{w n/a  {c|{w 75k  {c|{w 470m  {c|{w                     {c|{x\n\r", ch );
}
if (ch->lstatus < 17){
send_to_char("{c|{w {r+{R={D-{wRL{D-{R={r+{x {c|{w Realm Lord    {c|{w 120k {c|{w 30k  {c|{w 30k  {c|{w 80k  {c|{w 500m  {c|{w                     {c|{x\n\r", ch );
}
if (ch->lstatus < 18){
send_to_char("{c|{w {y*{w-{D({WCL{D){w-{y*{x {c|{w Chaos Lord    {c|{w 140k {c|{w 30k  {c|{w 30k  {c|{w 85k  {c|{w 530m  {c|{w                     {c|{x\n\r", ch );
}
if (ch->lstatus < 19){
send_to_char("{c|{w {m@{M={w>{WLM{w<{M={m@{x {c|{w Legend Master {c|{w 160k {c|{w 30k  {c|{w 30k  {c|{w 90k  {c|{w 560m  {c|{w All spls/wpn/stnc's {c|{x\n\r", ch );
}
if (ch->lstatus < 20){
send_to_char("{c|{w {B-{b={D{{{WGL{D}{b={B-{x {c|{w GodLike       {c|{w 200k {c|{w 30k  {c|{w 30k  {c|{w 95k  {c|{w 590m  {c|{w All spls/wpn/stnc's {c|{x\n\r", ch );
}
send_to_char("{c|__________|_______________|______|______|______|______|_______|_____________________|{x\n\r", ch );
                return;   
    }

    if (!str_cmp(arg1,"rm"))
                {

    if (ch->lstatus > 15)
    {
       send_to_char("You don't need to gain that legend.\n\r",ch);
       return;
    }

    if (ch->exp < legendexp)
    {
      send_to_char("You don't have enough exp!\n\r",ch);
      return;
    }

    if (ch->pcdata->quest < legendquest)
    {
      send_to_char("You don't have enough quest points!\n\r",ch);
      return;
    }

    if (ch->max_hit < 100000)
    {
       send_to_char("You need 100k hps!\n\r",ch);
       return;
    }

    ch->lstatus += 1;
    ch->exp -= legendexp;
    ch->pcdata->quest -= legendquest;
    sprintf(buf, "%s has gained an Advanced Legend!\n\r",ch->name);
    do_info(ch,buf);
   save_char_obj(ch);
    return;
    }
    else if (!str_cmp(arg1,"rl"))
    {

    if (ch->lstatus < 16)
    {
      send_to_char("You need 16 legend to do this.\n\r",ch);
      return;
    }

    if (ch->lstatus > 16)
    {
       send_to_char("You don't need to gain that legend.\n\r",ch);
       return;
    }

    if (ch->exp < legendexp)
    {
      send_to_char("You don't have enough exp!\n\r",ch);
      return;
    }

    if (ch->pcdata->quest < legendquest)
    {
      send_to_char("You don't have enough quest points!\n\r",ch);
      return;
    }

    if (ch->max_hit < 120000)
    {
       send_to_char("You need 120k hps!\n\r",ch);
       return;
    }

    if (ch->max_mana < 30000)
    {
       send_to_char("You need 30k mana!\n\r",ch);
       return;
    }

    if (ch->max_move < 30000)
    {
       send_to_char("You need 30k move!\n\r",ch);
       return;
    }

    ch->lstatus += 1;
    ch->exp -= legendexp;
    ch->pcdata->quest -= legendquest;
    sprintf(buf, "%s has gained an Advanced Legend!\n\r",ch->name);
    do_info(ch,buf);
   save_char_obj(ch);
    return;
    }

    else if (!str_cmp(arg1,"cl"))
    {

    if (ch->lstatus < 17)
    {
      send_to_char("You need 17 legend to do this.\n\r",ch);
      return;
    }

    if (ch->lstatus > 17)
    {
       send_to_char("You don't need to gain that legend.\n\r",ch);
       return;
    }


    if (ch->exp < legendexp)
    {
      send_to_char("You don't have enough exp!\n\r",ch);
      return;
    }

    if (ch->pcdata->quest < legendquest)
    {
      send_to_char("You don't have enough quest points!\n\r",ch);
      return;
    }

    if (ch->max_hit < 120000)
    {
       send_to_char("You need 120k hps!\n\r",ch);
       return;
    }

    if (ch->max_mana < 30000)
    {
       send_to_char("You need 30k mana!\n\r",ch);
       return;
    }

    if (ch->max_move < 30000)
    {
       send_to_char("You need 30k move!\n\r",ch);
       return;
    }

    ch->lstatus += 1;
    ch->exp -= legendexp;
    ch->pcdata->quest -= legendquest;
    sprintf(buf, "%s has gained an Advanced Legend!\n\r",ch->name);
    do_info(ch,buf);
   save_char_obj(ch);
    return;
    }

    else if (!str_cmp(arg1,"lm"))
    {

    if (ch->lstatus < 18)
    {
      send_to_char("You need 18 legend to do this.\n\r",ch);
      return;
    }

    if (ch->lstatus > 18)
    {
       send_to_char("You don't need to gain that legend.\n\r",ch);
       return;
    }

    if (ch->exp < legendexp)
    {
      send_to_char("You don't have enough exp!\n\r",ch);
      return;
    }

    if (ch->pcdata->quest < legendquest)
    {
      send_to_char("You don't have enough quest points!\n\r",ch);
      return;
    }

    if (ch->max_hit < 120000)
    {
       send_to_char("You need 120k hps!\n\r",ch);
       return;
    }

    if (ch->max_mana < 30000)
    {
       send_to_char("You need 30k mana!\n\r",ch);
       return;
    }

    if (ch->max_move < 30000)
    {
       send_to_char("You need 30k move!\n\r",ch);
       return;
    }

    ch->lstatus += 1;
    ch->exp -= legendexp;
    ch->pcdata->quest -= legendquest;
    sprintf(buf, "%s has gained an Advanced Legend!\n\r",ch->name);
    do_info(ch,buf);
   save_char_obj(ch);
    return;
    }

    else if (!str_cmp(arg1,"gl"))
    {

    if (ch->lstatus < 19)
    {
      send_to_char("You need 19 legend to do this.\n\r",ch);
      return;
    }

    if (ch->lstatus >= 19)
    {
       send_to_char("You don't need to gain that legend.\n\r",ch);
       return;
    }

    if (ch->exp < legendexp)
    {
      send_to_char("You don't have enough exp!\n\r",ch);
      return;
    }

    if (ch->pcdata->quest < legendquest)
    {
      send_to_char("You don't have enough quest points!\n\r",ch);
      return;
    }

    if (ch->max_hit < 120000)
    {
       send_to_char("You need 120k hps!\n\r",ch);
       return;
    }

    if (ch->max_mana < 30000)
    {
       send_to_char("You need 30k mana!\n\r",ch);
       return;
    }

    if (ch->max_move < 30000)
    {
       send_to_char("You need 30k move!\n\r",ch);
       return;
    }

    ch->lstatus += 1;
    ch->exp -= legendexp;
    ch->pcdata->quest -= legendquest;
    sprintf(buf, "%s has gained an Advanced Legend!\n\r",ch->name);
    do_info(ch,buf);
   save_char_obj(ch);
    return;
    }          
    else
    {
                send_to_char( "Syntax: Lgain <RM/RL/CL/LM/GL>\n\r", ch );
send_to_char("{c ____________________________________________________________________________________{x\n\r", ch );
send_to_char("{c|{w Name     {c|{w Long Name     {c|{w  HP  {c|{w MANA {c|{w MOVE {c|{w  QP  {c|{w EXP   {c|{w OTHER               {c|{x\n\r", ch );
send_to_char("{c|----------|---------------|------|------|------|------|-------|---------------------|{x\n\r", ch );
if (ch->lstatus < 16){
send_to_char("{c|{w {D-{w={c({WRM{c){w={D-{x {c|{w Realm Master  {c|{w 100k {c|{w n/a  {c|{w n/a  {c|{w 75k  {c|{w 470m  {c|{w                     {c|{x\n\r", ch );
}
if (ch->lstatus < 17){
send_to_char("{c|{w {r+{R={D-{wRL{D-{R={r+{x {c|{w Realm Lord    {c|{w 120k {c|{w 30k  {c|{w 30k  {c|{w 80k  {c|{w 500m  {c|{w                     {c|{x\n\r", ch );
}
if (ch->lstatus < 18){
send_to_char("{c|{w {y*{w-{D({WCL{D){w-{y*{x {c|{w Chaos Lord    {c|{w 140k {c|{w 30k  {c|{w 30k  {c|{w 85k  {c|{w 530m  {c|{w                     {c|{x\n\r", ch );
}
if (ch->lstatus < 19){
send_to_char("{c|{w {m@{M={w>{WLM{w<{M={m@{x {c|{w Legend Master {c|{w 160k {c|{w 30k  {c|{w 30k  {c|{w 90k  {c|{w 560m  {c|{w All spls/wpn/stnc's {c|{x\n\r", ch );
}
if (ch->lstatus < 20){
send_to_char("{c|{w {B-{b={D{{{WGL{D}{b={B-{x {c|{w GodLike       {c|{w 200k {c|{w 30k  {c|{w 30k  {c|{w 95k  {c|{w 590m  {c|{w All spls/wpn/stnc's {c|{x\n\r", ch );
}
send_to_char("{c|__________|_______________|______|______|______|______|_______|_____________________|{x\n\r", ch );
                return;   
    }
               
    send_to_char( "Ok.\n\r", ch);
    save_char_obj(ch);
    return;
}