/
area/city/
area/crypts/
area/guilds/
area/psuedowild/
area/religion/
data/documents/MPDocs/
data/html/
data/mobprogs/
data/quest/
data/world/
data/world/_utilities/
data/world/images/
design/html/
notes/
player/
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#include <sys/time.h>
#endif

#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>        /* OLC -- for close read write etc */
#include <stdarg.h>        /* printf_to_char */

#include "merc.h"
#include "interp.h"
#include "recycle.h"
#include "tables.h"
#include "md5.h"
#include "class.h"


/*
 * con_get_race()
 *
 * Selects a race
 */
void con_gen_race (DESCRIPTOR_DATA * d, char *argument)
{
    char arg[MSL];
    CHAR_DATA * ch;
    int race, i;
    
    ch = d->character;
    one_argument (argument, arg);

    if (!strcmp (arg, "help"))
    {
        argument = one_argument (argument, arg);
        if (argument[0] == '\0')
            do_function (ch, &do_help, "race help");
        else
            do_function (ch, &do_help, argument);
        send_to_desc
            ("What is your race (help for more information)? ", d);
        return;
    }

    race = race_lookup (argument);

    if (race == 0 || !race_table[race].pc_race)
    {
        send_to_desc ("That is not a valid race.\n\r", d);
        send_to_desc ("The following races are available:\n\r  ", d);
        for (race = 1; race_table[race].name != NULL; race++)
        {
            if (!race_table[race].pc_race)
                return;
            write_to_buffer (d, race_table[race].name, 0);
            write_to_buffer (d, " ", 1);
        }
        write_to_buffer (d, "\n\r", 0);
        send_to_desc ("What is your race? (help for more information) ", d);
    }
    /* add skills */
    for (i = 0; i < 5; i++)
    {
        if (pc_race_table[race].skills[i] == NULL)
            break;
        group_add (ch, pc_race_table[race].skills[i], FALSE);
    }
    /* add cost */
    ch->pcdata->points = pc_race_table[race].points;
    ch->size = pc_race_table[race].size;
    
        ch->race = race;
        /* initialize stats */
        for (i = 0; i < MAX_STATS; i++)
            ch->perm_stat[i] = pc_race_table[race].stats[i];
        ch->affected_by = ch->affected_by | race_table[race].aff;
        ch->imm_flags = ch->imm_flags | race_table[race].imm;
        ch->res_flags = ch->res_flags | race_table[race].res;
        ch->vuln_flags = ch->vuln_flags | race_table[race].vuln;
        ch->form = race_table[race].form;
        ch->parts = race_table[race].parts;

        /* add skills */
        for (i = 0; i < 5; i++)
        {
        if (pc_race_table[race].skills[i] == NULL)
            break;
        group_add (ch, pc_race_table[race].skills[i], FALSE);
        }
        /* add cost */
        ch->pcdata->points = pc_race_table[race].points;
        ch->size = pc_race_table[race].size;

        send_to_desc ("What is your sex (M/F)? ", d);
        d->connected = CON_GET_NEW_SEX;

    send_to_desc ("What is your sex (M/F)? ", d);
    d->connected = CON_GET_NEW_SEX;
    return;
}

/*
 * con_get_sex()
 *
 * Chooses sex of player
 */

void con_get_sex(DESCRIPTOR_DATA * d, char *argument)
{
    int iClass;
    char buf[MSL];
    CHAR_DATA * ch;
    ch = d->character;
    
    switch (argument[0])
    {
        case 'm':
        case 'M':
            ch->sex = SEX_MALE;
            ch->pcdata->true_sex = SEX_MALE;
            break;
        case 'f':
        case 'F':
            ch->sex = SEX_FEMALE;
            ch->pcdata->true_sex = SEX_FEMALE;
            break;
        default:
            send_to_desc ("That's not a sex.\n\rWhat IS your sex? ",d);
        return;
    }

    strcpy (buf, "Select a class [");
    for (iClass = 0; iClass < MAX_CLASS; iClass++)
    {
        if (iClass > 0)
            strcat (buf, " ");
        strcat (buf, class_table[iClass].name);
    }
    strcat (buf, "]: ");
    write_to_buffer (d, buf, 0);
    d->connected = CON_GET_NEW_CLASS;
    return;
}