////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Markshire's Nomenclature                                                  //
//                                                                            //
//  By Thrym of Markshire  5/21/06                                            //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
/*
//  FUNCTION:
//  The Nomenclature is an include file placed in the spawn script
//  nw_c2_default9 designed to assign a name to a generic NPC who may
//  wander towns, roads, shops, etc.
//
//  Utilizing both SetName and RandomName the system will name the NPC in
//  one of two ways ...
//
//  "SET_NAME":  By setting the variable "SET_NAME" on the NPC and
//  assigning it a string the creature will rename itself upon spawning.
//  This is handy for DM's and builders to create more precisely named
//  creatures for the palette and then generize them upon spawn.
//
//  eg. Ancient White Dragon in the Creator becomes White Dragon on Spawn.
//
//  "SET_NAME" = "RANDOM":  By setting the same variable to the name "RANDOM"
//  the NPC then is given a random name generated by RACE and GENDER using
//  the RandomName function.
//
//  eg.  Male Dwarven Villager in the creator becomes Gloigan on spawn
//  this time and perhaps Rufus on the next spawned Villager.
//
//  "NAME_TYPE":  Setting this int variable to "1" will cause a Full Name
//  to be generated if the "SET_NAME" is set to "RANDOM".
//
//  eg.  Male Dwarven Villager becomes Gloigan Stonecutter or Rufus Mason.
//
//  "TITLE": Prepends the defined string to the NPCs name.
//
//      eg. "Lord" Brown
//
//  "POSTFIX": Appends the defind string after the NPC's name.
//
//      eg. Ralph "the Guard"
//


    "RND_ROGUE"
    "RND_BARBARIAN"
    "RND_FIGHTER"
    "RND_CLERIC"    : Setting these to "1" will give the NPC a randomized class
    "RND_MAGE"      : appropriate postfix
    "RND_DRUID"
    "RND_RANGER"


//
//
//////////////////////////////////////////////////////////////////////////////*/
//#include "prc_inc_racial"

//void main (){}


///// FUNCTION DECLARATIONS ////////////////////////////////////////////////////

// Generates a Random First Name
// based on Race and Gender
// For all Standard PC Races and Animals
string ms_RandomFirstName(object oNPC = OBJECT_SELF);

// Generates a Random Last Name
// based on Race For all
// Standard PC Races and Animals
string ms_RandomLastName(object oNPC = OBJECT_SELF);

// Function designed to read the variable
// "SET_NAME" and assign a new name to the NPC
// If the variable is set to "RANDOM" a
// random name is assigned.
// A second variable can be assigned to
// have the random name be a random Full Name.
void ms_Nomenclature(object oNPC = OBJECT_SELF);


///// FUNCTIONS ////////////////////////////////////////////////////////////////

void ms_Nomenclature(object oNPC = OBJECT_SELF)
{
    string sRandomName = GetLocalString(oNPC, "SET_NAME");
    string sTitle = GetLocalString(oNPC, "TITLE");
    string sPostfix = GetLocalString(oNPC, "POSTFIX");

    int nRndRogue = GetLocalInt(OBJECT_SELF,"RND_ROGUE");
        if (nRndRogue == 1)
            {
                int nResult = d6(1);
                if (nResult == 1)
                    {
                        sPostfix = "the Quick";
                    }
                else if(nResult == 2)
                    {
                        sPostfix = "the Quiet";
                    }
                else if(nResult == 3)
                    {
                        sPostfix = "the Sharp";
                    }
                else if(nResult ==4)
                    {
                        sPostfix = "the Sneak";
                    }
                else if(nResult == 5)
                    {
                        sPostfix = "the Rogue";
                    }
                else
                        sPostfix = "the Footpad";

            }

    int nRndBarb = GetLocalInt(OBJECT_SELF,"RND_BARBARIAN");
        if (nRndBarb == 1)
            {
                int nResult = d6(1);
                if (nResult == 1)
                    {
                        sPostfix = "the Barbarian";
                    }
                else if(nResult == 2)
                    {
                        sPostfix = "the Destroyer";
                    }
                else if(nResult == 3)
                    {
                        sPostfix = "of the Plains";
                    }
                else if(nResult ==4)
                    {
                        sPostfix = "of Tiger Clan";
                    }
                else if(nResult == 5)
                    {
                        sPostfix = "of Bear Clan";
                    }
                else
                        sPostfix = "the Avenger";

            }

    int nRndFight = GetLocalInt(OBJECT_SELF,"RND_FIGHTER");
        if (nRndFight == 1)
            {
                int nResult = d6(1);
                if (nResult == 1)
                    {
                        sPostfix = "the Strong";
                    }
                else if(nResult == 2)
                    {
                        sPostfix = "the Stout";
                    }
                else if(nResult == 3)
                    {
                        sPostfix = "of the Blade";
                    }
                else if(nResult ==4)
                    {
                        sPostfix = "of Neverwinter";
                    }
                else if(nResult == 5)
                    {
                        sPostfix = "of Amn";
                    }
                else
                        sPostfix = "the Swordhand";

            }

    int nRndCleric = GetLocalInt(OBJECT_SELF,"RND_CLERIC");
        if (nRndCleric == 1)
            {
                int nResult = d6(1);
                if (nResult == 1)
                    {
                        sPostfix = "the Pious";
                    }
                else if(nResult == 2)
                    {
                        sPostfix = "the Holy";
                    }
                else if(nResult == 3)
                    {
                        sPostfix = "the Priest";
                    }
                else if(nResult ==4)
                    {
                        sPostfix = "the Zealous";
                    }
                else if(nResult == 5)
                    {
                        sPostfix = "of Phlan";
                    }
                else
                        sPostfix = "the Wise";

            }

    int nRndMage = GetLocalInt(OBJECT_SELF,"RND_MAGE");
        if (nRndMage == 1)
            {
                int nResult = d6(1);
                if (nResult == 1)
                    {
                        sPostfix = "the Mad";
                    }
                else if(nResult == 2)
                    {
                        sPostfix = "the Arcane";
                    }
                else if(nResult == 3)
                    {
                        sPostfix = "the Black";
                    }
                else if(nResult ==4)
                    {
                        sPostfix = "the Wizard";
                    }
                else if(nResult == 5)
                    {
                        sPostfix = "of Waterdeep";
                    }
                else
                        sPostfix = "the Mage";

            }

    int nRndBard = GetLocalInt(OBJECT_SELF,"RND_BARD");
        if (nRndMage == 1)
            {
                int nResult = d6(1);
                if (nResult == 1)
                    {
                        sPostfix = "the Dancer";
                    }
                else if(nResult == 2)
                    {
                        sPostfix = "the Troubador";
                    }
                else if(nResult == 3)
                    {
                        sPostfix = "of the Song";
                    }
                else if(nResult ==4)
                    {
                        sPostfix = "the Bard";
                    }
                else if(nResult == 5)
                    {
                        sPostfix = "the Raconteur";
                    }
                else
                        sPostfix = "the Minstrel";

            }

    int nRndDruid = GetLocalInt(OBJECT_SELF,"RND_DRUID");
        if (nRndDruid == 1)
            {
                int nResult = d6(1);
                if (nResult == 1)
                    {
                        sPostfix = "the Druid";
                    }
                else if(nResult == 2)
                    {
                        sPostfix = "of the Forest";
                    }
                else if(nResult == 3)
                    {
                        sPostfix = "of the Wild";
                    }
                else if(nResult ==4)
                    {
                        sPostfix = "the Wolflord";
                    }
                else if(nResult == 5)
                    {
                        sPostfix = "the Treelord";
                    }
                else
                        sPostfix = "the Warden";

            }

    int nRndRanger = GetLocalInt(OBJECT_SELF,"RND_RANGER");
        if (nRndRanger == 1)
            {
                int nResult = d6(1);
                if (nResult == 1)
                    {
                        sPostfix = "the Ranger";
                    }
                else if(nResult == 2)
                    {
                        sPostfix = "of the Forest";
                    }
                else if(nResult == 3)
                    {
                        sPostfix = "of the Wild";
                    }
                else if(nResult ==4)
                    {
                        sPostfix = "the Strider";
                    }
                else if(nResult == 5)
                    {
                        sPostfix = "the Venger";
                    }
                else
                        sPostfix = "the Warden";

            }

    if (sRandomName != "")
    {
        if (sRandomName == "RANDOM")
        {
            switch (GetLocalInt(oNPC, "NAME_TYPE"))
            {
                case 1:   sRandomName = sTitle + " " + ms_RandomFirstName(oNPC) + " " + ms_RandomLastName(oNPC)+ " " + sPostfix; break;
                default:  sRandomName = sTitle + " " + ms_RandomFirstName(oNPC) + " " + sPostfix; break;
            }
        }

        SetName(oNPC, (sRandomName));
        return;
    }
}

string ms_RandomFirstName(object oNPC = OBJECT_SELF)
{
    int Gender   = GetGender(oNPC);
    int Race     = GetRacialType(oNPC);

    string Name;

    switch (Race)
    {
        case RACIAL_TYPE_ANIMAL:    Name = RandomName(0); break;
        case RACIAL_TYPE_DWARF:
            switch (Gender)
            {   default:            Name = RandomName(2); break;
                case GENDER_FEMALE: Name = RandomName(3); break; } break;
        case RACIAL_TYPE_ELF:
            switch (Gender)
            {   default:            Name = RandomName(5); break;
                case GENDER_FEMALE: Name = RandomName(6); break; } break;
        case RACIAL_TYPE_GNOME:
            switch (Gender)
            {   default:            Name = RandomName(8); break;
                case GENDER_FEMALE: Name = RandomName(9); break; } break;
        case RACIAL_TYPE_HALFELF:
            switch (Gender)
            {   default:            Name = RandomName(11); break;
                case GENDER_FEMALE: Name = RandomName(12); break; } break;
        case RACIAL_TYPE_HALFLING:
            switch (Gender)
            {   default:            Name = RandomName(14); break;
                case GENDER_FEMALE: Name = RandomName(15); break; } break;
        case RACIAL_TYPE_HALFORC:
            switch (Gender)
            {   default:            Name = RandomName(17); break;
                case GENDER_FEMALE: Name = RandomName(18); break; } break;
        case RACIAL_TYPE_HUMAN:
            switch (Gender)
            {   default:            Name = RandomName(20); break;
                case GENDER_FEMALE: Name = RandomName(21); break; } break;
        default:
            switch (Gender)
            {   default:            Name = RandomName(-1); break;
                case GENDER_FEMALE: Name = RandomName(0); break; } break;
    }

    return Name;
}

string ms_RandomLastName(object oNPC = OBJECT_SELF)
{
    int Race     = GetRacialType(oNPC);

    string Name;

    switch (Race)
    {
        case RACIAL_TYPE_DWARF:     Name = RandomName(4); break;
        case RACIAL_TYPE_ELF:       Name = RandomName(7); break;
        case RACIAL_TYPE_GNOME:     Name = RandomName(10); break;
        case RACIAL_TYPE_HALFELF:   Name = RandomName(13); break;
        case RACIAL_TYPE_HALFLING:  Name = RandomName(16); break;
        case RACIAL_TYPE_HALFORC:   Name = RandomName(19); break;
        case RACIAL_TYPE_HUMAN:     Name = RandomName(22); break;
        default:                    Name = RandomName(1); break;
    }

    return Name;
}