/*****************************
 * The following was hand    *
 * coded by Mikado Rose      *
 * of the Lost Legends       *
 * project, everything here  *
 * took quite a while to     *
 * code and organize, but it *
 * should go in clean enough *
 ****************************/
   /*
    * If for some reason it
    * doesn't go in cleanly
    * contact Mikado by:
    * E-Mail : mikado999@excite.com
    * AOL IM : Mikado Rose 999
    * or Lost Legends III
    *   messiah.ath.cx:4000
    */

// Now for the code...
// And remember to backup... just in case.

/**********
 * merc.h *
 **********/

// Add these at the end of the con statements
// The numbers may need to be adjusted.

#define CON_GET_HAIR                    16
#define CON_GET_WEIGHT                  17
#define CON_GET_HEIGHT                  18
#define CON_GET_EYE                     19

// Under struct attack_type add these.

struct weight_type
{
    char * name;
    long flag;
    int level;
};

struct hair_type
{
    char * name;
    long flag;
    int level;
};

struct eye_type
{
    char * name;
    long flag;
    int level;
};

struct height_type
{
    char * name;
    long flag;
    int level;
};


// At the bottom of struct pc_data

    int                 weight;
    int                 height;
    int                 hair;
    int                 eye;

// Add these under 
// extern  const   struct  group_type      group_table     [MAX_GROUP];

extern  const   struct  eye_type        eye_table       [];
extern  const   struct  hair_type       hair_table      [];
extern  const   struct  height_type     height_table    [];
extern  const   struct  weight_type     weight_table    [];

// Add these after the PLR_* flags.

/* Weight Flags */
#define WEIGHT_SKINNY           (A)
#define WEIGHT_SLIM             (B)
#define WEIGHT_AVERAGE          (C)
#define WEIGHT_HUSKY            (D)
#define WEIGHT_OBESE            (E)

/* Height Flags */
#define HEIGHT_TINY             (A)
#define HEIGHT_SHORT            (B)
#define HEIGHT_AVERAGE          (C)
#define HEIGHT_TALL             (D)
#define HEIGHT_GIANT            (E)

/* Eye Colors */
#define EYE_BLUE                (A)
#define EYE_GREEN               (B)
#define EYE_HAZEL               (C)
#define EYE_YELLOW              (D)
#define EYE_LAVENDER            (E)
#define EYE_RED                 (F)
#define EYE_BLACK               (G)
#define EYE_WHITE               (H)

/* Hair Colors */
#define HAIR_BLONDE             (A)
#define HAIR_ORANGE             (B)
#define HAIR_BLACK              (C)
#define HAIR_GOLD               (E)
#define HAIR_BROWN              (F)
#define HAIR_RED                (G)
#define HAIR_WHITE              (H)

/************
 * tables.c *
 ***********/
/*************************
 * This is placed in the *
 * tables so the flags   *
 * have set values, By a *
 * very simple look      *
 * over, hope it becomes *
 * easy to add more.     *
 ************************/   

// Add these at the bottom of the file.

const struct weight_type weight_table [] =
{
{ "slender", WEIGHT_SLENDER, 1 },
{ "slim", WEIGHT_SLIM, 1 },
{ "average", WEIGHT_AVERAGE, 1 },
{ "stocky", WEIGHT_STOCKY, 1 },
{ "heavy", WEIGHT_HEAVEY, 1 },
{ NULL, 0, 0 }
};

const struct eye_type eye_table [] =
{
{ "blue", EYE_BLUE, 1 },
{ "green", EYE_GREEN, 1 },
{ "brown", EYE_BROWN, 1 },
{ NULL, 0, 0 }
};

const struct height_type height_table [] =
{
{ "short", HEIGHT_SHORT, 1 },
{ "midget", HEIGHT_MIDGET, 1 },
{ "average",HEIGHT_AVERAGE, 1 },
{ "tall", HEIGHT_TALL, 1 },
{ "giant", HEIGHT_GIANT, 1 },
{ NULL, 0, 0 }
};

const struct hair_type hair_table [] =
{
{ "blond", HAIR_BLOND, 1 },
{ "red", HAIR_RED, 1 },
{ "black",HAIR_BLACK, 1 },
{ NULL, 0, 0 }
};

/**********
 * save.c *
 **********/
/**************************
 * This is what is placed *
 * inside of the actual   *
 * pfile so the info.     *
 * can be saved for the   *
 * MUD to read later.     *
 *************************/
/*
 * Inside of void fwrite_char() 
 */

if (ch->pcdata->height)
fprintf( fp, "Height %s\n", print_flags(ch->pcdata->height));
if (ch->pcdata->weight)
fprintf( fp, "Weight %s\n", print_flags(ch->pcdata->weight));
if (ch->pcdata->eye)
fprintf( fp, "Eye %s \n", print_flags(ch->pcdata->eye));
if (ch->pcdata->hair)
fprintf( fp, "Hair %s\n", print_flags(ch->pcdata->hair));



/*
 * Inside of void fread_char()
 */

/* In case 'H': */
            KEY( "Height",      ch->pcdata->height,     fread_flag( fp ) );
            KEY( "Hair",        ch->pcdata->hair,       fread_flag( fp ) );

/* In case 'E': */
	    KEY( "Eye",		ch->pcdata->eye,	fread_flag( fp ) );

/* In case 'W': */
	    KEY( "Weight",	ch->pcdata->weight,	fread_flag( fp ) );

/**********
 * comm.c *
 **********/
/***************************************
 * Okay, no more fun and games people. *
 * Now we get into the harder part...  *
 * The actual code for getting their   *
 * personal flags.                     *
 ***************************************/

// void nanny()
// Add this at the top...

bool hairChoice, eyeChoice, heightChoice, sizeChoice;

/*
 * Look for...
 */

        group_add(ch,class_table[ch->class].base_group,FALSE);
        ch->pcdata->learned[gsn_recall] = 50;

/*
 * And add.
 */
        write_to_buffer( d, echo_on_str, 0 );
        write_to_buffer(d,"Pick your hair color.\n\rblonde(Y)\n\rorange(O)\n\rblack(L)\n\rgold(G)\n\rbrown(B)\n\rred(R)\n\rwhite(W)\n\rWhich'll it be? (B/O/L/G/B/R/W)",0);
        d->connected = CON_GET_HAIR;
        break;

    case CON_GET_HAIR:
#if defined(unix)
        write_to_buffer( d, "\n\r", 2 );
#endif
        switch ( *argument )
          {
          case 'Y': case 'y':
            SET_BIT( ch->pcdata->hair, HAIR_BLONDE);
            REMOVE_BIT(ch->pcdata->hair, HAIR_ORANGE);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BLACK);
            REMOVE_BIT(ch->pcdata->hair, HAIR_GOLD);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BROWN);
            REMOVE_BIT(ch->pcdata->hair, HAIR_RED);
            REMOVE_BIT(ch->pcdata->hair, HAIR_WHITE);
            hairChoice = TRUE;
            break;
          case 'O': case 'o':
            SET_BIT( ch->pcdata->hair, HAIR_ORANGE);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BLONDE);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BLACK);
            REMOVE_BIT(ch->pcdata->hair, HAIR_GOLD);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BROWN);
            REMOVE_BIT(ch->pcdata->hair, HAIR_RED);
            REMOVE_BIT(ch->pcdata->hair, HAIR_WHITE);
            hairChoice = TRUE;
            break;
          case 'l': case 'L':
            SET_BIT( ch->pcdata->hair, HAIR_BLACK);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BLONDE);
            REMOVE_BIT(ch->pcdata->hair, HAIR_ORANGE);
            REMOVE_BIT(ch->pcdata->hair, HAIR_GOLD);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BROWN);
            REMOVE_BIT(ch->pcdata->hair, HAIR_RED);
            REMOVE_BIT(ch->pcdata->hair, HAIR_WHITE);
            hairChoice = TRUE;
            break;
          case 'G': case 'g':
            SET_BIT( ch->pcdata->hair, HAIR_GOLD);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BLONDE);
            REMOVE_BIT(ch->pcdata->hair, HAIR_ORANGE);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BLACK);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BROWN);
            REMOVE_BIT(ch->pcdata->hair, HAIR_RED);
            REMOVE_BIT(ch->pcdata->hair, HAIR_WHITE);
            hairChoice = TRUE;
            break;
          case 'B': case 'b':
            SET_BIT( ch->pcdata->hair, HAIR_BROWN);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BLONDE);
            REMOVE_BIT(ch->pcdata->hair, HAIR_ORANGE);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BLACK);
            REMOVE_BIT(ch->pcdata->hair, HAIR_GOLD);
            REMOVE_BIT(ch->pcdata->hair, HAIR_RED);
            REMOVE_BIT(ch->pcdata->hair, HAIR_WHITE);
            hairChoice = TRUE;
            break;
          case 'R': case 'r':
            SET_BIT( ch->pcdata->hair, HAIR_RED);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BLONDE);
            REMOVE_BIT(ch->pcdata->hair, HAIR_ORANGE);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BLACK);
            REMOVE_BIT(ch->pcdata->hair, HAIR_GOLD);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BROWN);
            REMOVE_BIT(ch->pcdata->hair, HAIR_WHITE);
            hairChoice = TRUE;
            break;
          case 'W': case 'w':
            SET_BIT( ch->pcdata->hair, HAIR_WHITE);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BLONDE);
            REMOVE_BIT(ch->pcdata->hair, HAIR_ORANGE);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BLACK);
            REMOVE_BIT(ch->pcdata->hair, HAIR_GOLD);
            REMOVE_BIT(ch->pcdata->hair, HAIR_BROWN);
            REMOVE_BIT(ch->pcdata->hair, HAIR_RED);
            hairChoice = TRUE;
            break;
          default:
            write_to_buffer( d, "Not a valid hair color. Choose again (Y/O/L/G/B/R/W). ", 0 );
            hairChoice = FALSE;
            break;
          }
        if(!hairChoice)
          break;

        write_to_buffer(d,echo_on_str, 0);
        write_to_buffer(d,"Please choose an eye color.\n\rblue(B)\n\rgreen(G)\n\rhazel(H)\n\ryellow(Y)\n\rlavender(L)\n\rred(R)\n\rblack(D)\n\rwhite(W)\n\rWhat'll it be? (B/G/H/Y/L/R/D/W)",0);
        d->connected = CON_GET_EYE;
        break;

    case CON_GET_EYE:
#if defined(unix)
        write_to_buffer( d, "\n\r", 2 );
#endif
        switch ( *argument )
          {
          case 'B': case'b':
            SET_BIT(ch->pcdata->eye,EYE_BLUE);
            REMOVE_BIT(ch->pcdata->eye, EYE_GREEN);
            REMOVE_BIT(ch->pcdata->eye, EYE_HAZEL);
            REMOVE_BIT(ch->pcdata->eye, EYE_YELLOW);
            REMOVE_BIT(ch->pcdata->eye, EYE_LAVENDER);
            REMOVE_BIT(ch->pcdata->eye, EYE_RED);
            REMOVE_BIT(ch->pcdata->eye, EYE_BLACK);
            REMOVE_BIT(ch->pcdata->eye, EYE_WHITE);
            eyeChoice = TRUE;
            break;
          case 'G': case'g':
            SET_BIT(ch->pcdata->eye,EYE_GREEN);
            REMOVE_BIT(ch->pcdata->eye, EYE_BLUE);
            REMOVE_BIT(ch->pcdata->eye, EYE_HAZEL);
            REMOVE_BIT(ch->pcdata->eye, EYE_YELLOW);
            REMOVE_BIT(ch->pcdata->eye, EYE_LAVENDER);
            REMOVE_BIT(ch->pcdata->eye, EYE_RED);
            REMOVE_BIT(ch->pcdata->eye, EYE_BLACK);
            REMOVE_BIT(ch->pcdata->eye, EYE_WHITE);
            eyeChoice = TRUE;
            break;
          case 'H': case'h':
            SET_BIT(ch->pcdata->eye,EYE_HAZEL);
            REMOVE_BIT(ch->pcdata->eye, EYE_BLUE);
            REMOVE_BIT(ch->pcdata->eye, EYE_GREEN);
            REMOVE_BIT(ch->pcdata->eye, EYE_YELLOW);
            REMOVE_BIT(ch->pcdata->eye, EYE_LAVENDER);
            REMOVE_BIT(ch->pcdata->eye, EYE_RED);
            REMOVE_BIT(ch->pcdata->eye, EYE_BLACK);
            REMOVE_BIT(ch->pcdata->eye, EYE_WHITE);
            eyeChoice = TRUE;
            break;
          case 'Y': case'y':
            SET_BIT(ch->pcdata->eye,EYE_YELLOW);
            REMOVE_BIT(ch->pcdata->eye, EYE_BLUE);
            REMOVE_BIT(ch->pcdata->eye, EYE_GREEN);
            REMOVE_BIT(ch->pcdata->eye, EYE_HAZEL);
            REMOVE_BIT(ch->pcdata->eye, EYE_LAVENDER);
            REMOVE_BIT(ch->pcdata->eye, EYE_RED);
            REMOVE_BIT(ch->pcdata->eye, EYE_BLACK);
            REMOVE_BIT(ch->pcdata->eye, EYE_WHITE);
            eyeChoice = TRUE;
            break;
          case 'L': case'l':
            SET_BIT(ch->pcdata->eye,EYE_LAVENDER);
            REMOVE_BIT(ch->pcdata->eye, EYE_BLUE);
            REMOVE_BIT(ch->pcdata->eye, EYE_GREEN);
            REMOVE_BIT(ch->pcdata->eye, EYE_HAZEL);
            REMOVE_BIT(ch->pcdata->eye, EYE_YELLOW);
            REMOVE_BIT(ch->pcdata->eye, EYE_RED);
            REMOVE_BIT(ch->pcdata->eye, EYE_BLACK);
            REMOVE_BIT(ch->pcdata->eye, EYE_WHITE);
            eyeChoice = TRUE;
            break;
          case 'R': case'r':
            SET_BIT(ch->pcdata->eye,EYE_RED);
            REMOVE_BIT(ch->pcdata->eye, EYE_BLUE);
            REMOVE_BIT(ch->pcdata->eye, EYE_GREEN);
            REMOVE_BIT(ch->pcdata->eye, EYE_HAZEL);
            REMOVE_BIT(ch->pcdata->eye, EYE_YELLOW);
            REMOVE_BIT(ch->pcdata->eye, EYE_LAVENDER);
            REMOVE_BIT(ch->pcdata->eye, EYE_BLACK);
            REMOVE_BIT(ch->pcdata->eye, EYE_WHITE);
            eyeChoice = TRUE;
            break;
          case 'D': case'd':
            SET_BIT(ch->pcdata->eye,EYE_BLACK);
            REMOVE_BIT(ch->pcdata->eye, EYE_BLUE);
            REMOVE_BIT(ch->pcdata->eye, EYE_GREEN);
            REMOVE_BIT(ch->pcdata->eye, EYE_HAZEL);
            REMOVE_BIT(ch->pcdata->eye, EYE_YELLOW);
            REMOVE_BIT(ch->pcdata->eye, EYE_LAVENDER);
            REMOVE_BIT(ch->pcdata->eye, EYE_RED);
            REMOVE_BIT(ch->pcdata->eye, EYE_WHITE);
            eyeChoice = TRUE;
            break;
          case 'W': case'w':
            SET_BIT(ch->pcdata->eye,EYE_WHITE);
            REMOVE_BIT(ch->pcdata->eye, EYE_BLUE);
            REMOVE_BIT(ch->pcdata->eye, EYE_GREEN);
            REMOVE_BIT(ch->pcdata->eye, EYE_HAZEL);
            REMOVE_BIT(ch->pcdata->eye, EYE_YELLOW);
            REMOVE_BIT(ch->pcdata->eye, EYE_LAVENDER);
            REMOVE_BIT(ch->pcdata->eye, EYE_RED);
            REMOVE_BIT(ch->pcdata->eye, EYE_BLACK);
            eyeChoice = TRUE;
            break;
          default:
            write_to_buffer( d, "Not a valid eye color. Please type (B/G/H/Y/L/R/D/W): ", 0 );
            eyeChoice = FALSE;
            break;
          }
        if(!eyeChoice)
          break;


        write_to_buffer(d,echo_on_str, 0);
        write_to_buffer(d,"How tall do you wish to be?\n\rtiny(Y)\n\rshort(S)\n\raverage(A)\n\rtall(T)\n\rgiant(G)\n\rWhat'll it be? (Y/S/A/T/G)",0);
        d->connected = CON_GET_HEIGHT;
        break;

    case CON_GET_HEIGHT:
#if defined(unix)
        write_to_buffer( d, "\n\r", 2 );
#endif
        switch ( *argument )
          {
          case 's': case 'S':
            SET_BIT( ch->pcdata->height, HEIGHT_SHORT );
            REMOVE_BIT(ch->pcdata->height, HEIGHT_TINY);
            REMOVE_BIT(ch->pcdata->height, HEIGHT_AVERAGE);
            REMOVE_BIT(ch->pcdata->height, HEIGHT_TALL);
            REMOVE_BIT(ch->pcdata->height, HEIGHT_GIANT);
            heightChoice = TRUE;
            break;
          case 'y': case 'Y':
            SET_BIT( ch->pcdata->height, HEIGHT_TINY );
            REMOVE_BIT(ch->pcdata->height, HEIGHT_SHORT );
            REMOVE_BIT(ch->pcdata->height, HEIGHT_AVERAGE);
            REMOVE_BIT(ch->pcdata->height, HEIGHT_TALL);
            REMOVE_BIT(ch->pcdata->height, HEIGHT_GIANT);
            heightChoice = TRUE;
            break;
          case 'a': case 'A':
            SET_BIT(ch->pcdata->height,HEIGHT_AVERAGE);
            REMOVE_BIT(ch->pcdata->height, HEIGHT_SHORT );
            REMOVE_BIT(ch->pcdata->height, HEIGHT_TINY);
            REMOVE_BIT(ch->pcdata->height, HEIGHT_TALL);
            REMOVE_BIT(ch->pcdata->height, HEIGHT_GIANT);
            heightChoice = TRUE;
            break;
          case 't': case 'T':
            SET_BIT(ch->pcdata->height,HEIGHT_TALL);
            REMOVE_BIT(ch->pcdata->height, HEIGHT_SHORT );
            REMOVE_BIT(ch->pcdata->height, HEIGHT_TINY);
            REMOVE_BIT(ch->pcdata->height, HEIGHT_AVERAGE);
            REMOVE_BIT(ch->pcdata->height, HEIGHT_GIANT);
            heightChoice = TRUE;
            break;
          case 'g': case 'G':
            SET_BIT(ch->pcdata->height,HEIGHT_GIANT);
            REMOVE_BIT(ch->pcdata->height, HEIGHT_SHORT );
            REMOVE_BIT(ch->pcdata->height, HEIGHT_TINY);
            REMOVE_BIT(ch->pcdata->height, HEIGHT_TALL);
            REMOVE_BIT(ch->pcdata->height, HEIGHT_AVERAGE);
            heightChoice = TRUE;
            break;
          default:
            write_to_buffer( d, "Not a valid height. Choose again. (Y/S/A/T/G)", 0 );
            heightChoice = FALSE;
            break;
          }
        if(!heightChoice)
          break;

        write_to_buffer(d,echo_on_str, 0);
        write_to_buffer(d,"What do you wish your weight class to be?\n\rskinny(S)\n\rslim(L)\n\raverage(A)\n\rhusky(H)\n\robe$
        d->connected = CON_GET_WEIGHT;
        break;

    case CON_GET_WEIGHT:
#if defined(unix)
        write_to_buffer( d, "\n\r", 2 );
#endif
        switch ( *argument )
          {
          case 'S': case 's':
            SET_BIT(ch->pcdata->weight, WEIGHT_SKINNY);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_SLIM);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_AVERAGE);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_HUSKY);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_OBESE);
            sizeChoice = TRUE;
            break;
          case 'L': case 'l':
            SET_BIT(ch->pcdata->weight, WEIGHT_SLIM);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_SKINNY);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_AVERAGE);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_HUSKY);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_OBESE);
            sizeChoice = TRUE;
            break;
          case 'A': case 'a':
            SET_BIT(ch->pcdata->weight, WEIGHT_AVERAGE);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_SKINNY);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_SLIM);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_HUSKY);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_OBESE);
            sizeChoice = TRUE;
            break;
          case 'H': case 'h':
            SET_BIT(ch->pcdata->weight, WEIGHT_HUSKY);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_SKINNY);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_SLIM);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_AVERAGE);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_OBESE);
            sizeChoice = TRUE;
            break;
          case 'O': case 'o':
            SET_BIT(ch->pcdata->weight, WEIGHT_OBESE);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_SKINNY);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_SLIM);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_AVERAGE);
            REMOVE_BIT(ch->pcdata->weight, WEIGHT_HUSKY);
            sizeChoice = TRUE;
            break;

          default:
            write_to_buffer( d, "Not a valid weight. Choose again. (S/L/A/H/O) ", 0 );
            sizeChoice = FALSE;
            break;
          }
        if(!sizeChoice)
          break;