/
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/
#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <zlib.h>
#include "merc.h"
#include "world.h"
#include "recycle.h"
#include "gdl.h"
#include "faction.h"
#include "interp.h"
#define ptc printf_to_char

/*
 * Faction_table[]
 *
 * Various information about the faction
 */
const struct faction_type faction_table[] =
{
    /* Guild of Wizards */
    {"wizard_guild",
    "The Guild of Wizards",
    "The Guild of {CW{ci{Cz{ca{Cr{cd{Cs{x",
    2506,
    {"Associate",   "Apprentice",   "Journyman",    "Evoker",           "Conjurer",
    "Magician",     "Warlock",      "Wizard",       "Master Wizard",    "Arch-mage"},
    {0,             2,              4,              6,                  8,
    16,             20,             25,             30,                 50}},
    
    /* Guild of Fighters */
    {"fighter_guild",
    "The Guild of Fighters",
    "The Guild of {RF{righter{Rs{x",
    2506,
    {"Associate",   "Apprentice",   "Journyman",    "Swordsman",        "Protecter",
    "Defender",     "Ward",         "Guardian",     "Champion",         "Master"},
    {0,             2,              4,              6,                  8,
    16,             20,             25,             30,                 50}},
    
    /* Guild of Thieves */
    {"thief_guild",
    "The Guild of Thieves",
    "The Guild of {GT{ghieve{Gs{x",
    2506,
    {"Toad",        "Wet Ear",      "Footpad",      "Blackcap",         "Operative", 
    "Bandit",       "Captian",      "Ringleader",   "Mastermind",       "Master Thief"},
    {0,             2,              4,              6,                  8,
    16,             20,             25,             30,                 50}},
    
    
    /* Faith of Gwendion */
    {"gwendion_guild",
    "The Faith of Gwendion",
    "The Faith of Gwendion",
    2506,
    {"Layman",      "Novice",       "Inniate",      "Acolyte",          "Adept",     
    "Disiple",      "Priest",       "Bishop",       "Oracle",           "Master Oracle"},
    {0,             2,              4,              6,                  8,
    16,             20,             25,             30,                 50}},
    
    
    {NULL, NULL, NULL, 1, {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
    {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}}
};


void cmd_factions(CHAR_DATA * ch, char *argument)
{
    char arg1[MSL];
    int x, faction;
    
    one_argument(argument, arg1);
    
    if (arg1[0] == '\0')
    {
        ptc(ch, "Which Faction do you wish to see?\n\r");
        for (x = 0; faction_table[x].name != NULL; x++)
            ptc(ch, "Faction: {w%s{x\n\r", faction_table[x].plr_name);
        return;
    }

    faction = faction_lookup2(arg1);
    
    if (faction == -1)
    {
        ptc(ch, "The faction '%s' does not exist in the realm.\n\r", arg1);
        return;
    }
    
    ptc(ch, "Internal Faction Name:     {w%s{x\n\r", faction_table[faction].name);
    ptc(ch, "Real Faction Name:         {w%s{x\n\r", faction_table[faction].plr_name);
    ptc(ch, "Primary Guild Hall:        {w%d{x\n\r", faction_table[faction].prime_guildhall);
    ptc(ch, "\n\rRank Name       Points Needed\n\r");
    for (x = 0; x < MAX_RANKS; x++)
    {
        ptc(ch, "%-15s {w%d{x\n\r",
            faction_table[faction].ranks[x],
            faction_table[faction].advancement[x]);
    }
    ptc(ch, "\n\r");
    return;
}


/*
 * Returns Faction table ref via internal name
 */
int faction_lookup(const char *name)
{
    int i;
    for (i = 0; faction_table[i].name != NULL; i++)
    {
        if (faction_table[i].name == NULL)
            break;
        if (LOWER (name[0]) == LOWER (faction_table[i].name[0]) && !str_prefix (name, faction_table[i].name))
            return i;
    }
    return -1;
}

/*
 * Returns Faction table ref via internal plr_name
 */
int faction_lookup2(const char *plr_name)
{
    int i;
    for (i = 0; faction_table[i].plr_name != NULL; i++)
    {
        if (faction_table[i].plr_name == NULL)
            break;
        if (LOWER (plr_name[0]) == LOWER (faction_table[i].plr_name[0]) && !str_prefix (plr_name, faction_table[i].plr_name))
            return i;
    }
    return -1;
}