// Back & drink mods made 20/12/99. CRTH

#include <stdio.h>
#include	"config.h"
#include "structs.h"
#include "functions.h"
#include "utils.h"

const char sex_bits[]={0,1,2,4,8,16,32};
const char class_bits[]={0,1,2,4,8,16,32};

//////////////////CRTH
// Colour table.
const struct _col_table_ col_table[]={
	"\033[1m\033[30m",	"DGREY",
	"\033[0m\033[31m",	"RED",
	"\033[0m\033[32m",	"GREEN",
	"\033[0m\033[33m",	"YELLOW",
	"\033[0m\033[34m",	"BLUE",
	"\033[0m\033[35m",	"MAGENTA",
	"\033[0m\033[36m",	"CYAN",
	"\033[0m\033[37m",	"WHITE",
	"\033[1m\033[31m",	"BRED",
	"\033[1m\033[32m",	"BGREEN",
	"\033[1m\033[33m",	"BYELLOW",
	"\033[1m\033[34m",	"BBLUE",
	"\033[1m\033[35m",	"BMAGENTA",
	"\033[1m\033[36m",	"BCYAN",
	"\033[1m\033[37m",	"BWHITE",
};
// Date descriptors.
const struct
{
	char	*desc;
}DY[]={
"\033[0m\033[37m1st\033[0m",
"\033[0m\033[37m2nd\033[0m",
"\033[0m\033[37m3rd\033[0m",
"\033[0m\033[37m4th\033[0m",
"\033[0m\033[37m5th\033[0m",
"\033[0m\033[37m6th\033[0m",
"\033[0m\033[37m7th\033[0m",
"\033[0m\033[37m8th\033[0m",
"\033[0m\033[37m9th\033[0m",
"\033[0m\033[37m10th\033[0m",
"\033[0m\033[37m11th\033[0m",
"\033[0m\033[37m12th\033[0m",
"\033[0m\033[37m13th\033[0m",
"\033[0m\033[37m14th\033[0m",
"\033[0m\033[37m15th\033[0m",
"\033[0m\033[37m16th\033[0m",
"\033[0m\033[37m17th\033[0m",
"\033[0m\033[37m18th\033[0m",
"\033[0m\033[37m19th\033[0m",
"\033[0m\033[37m20th\033[0m",
"\033[0m\033[37m21st\033[0m",
"\033[0m\033[37m22nd\033[0m",
"\033[0m\033[37m23rd\033[0m",
"\033[0m\033[37m24th\033[0m",
"\033[0m\033[37m25th\033[0m",
"\033[0m\033[37m26th\033[0m",
"\033[0m\033[37m27th\033[0m",
"\033[0m\033[37m28th\033[0m",
"\033[0m\033[37m29th\033[0m",
};
const	struct
{
	char	*desc;
}MON[]={
"\033[0m\033[37mJanbar\033[0m",
"\033[0m\033[37mFedula\033[0m",
"\033[0m\033[37mMarb\033[0m",
"\033[0m\033[37mApris\033[0m",
"\033[0m\033[37mMav\033[0m",
"\033[0m\033[37mJunla\033[0m",
"\033[0m\033[37mJuppy\033[0m",
"\033[0m\033[37mAugat\033[0m",
"\033[0m\033[37mSeptor\033[0m",
"\033[0m\033[37mOctaz\033[0m",
"\033[0m\033[37mNover\033[0m",
"\033[0m\033[37mDeembar\033[0m",
};
// Time descriptors.
const struct
{
	char	*desc;
	char	*time;
}TODAY[]={
//	MORNING	
"\033[0m\033[31mMORNING\033[0m", "early in the ",
//	MORNING	
"\033[1m\033[31mMORNING\033[0m", "mid ",
//	MORNING
"\033[0m\033[33mMORNING\033[0m", "late ",
//	DAY		
"\033[1m\033[33mAFTERNOON\033[0m", "early in the ",
//	DAY
"\033[1m\033[33mAFTERNOON\033[0m", "mid ",
//	DAY
"\033[1m\033[33mAFTERNOON\033[0m", "late in the ",
//	EVENING
"\033[1m\033[35mEVENING\033[0m", "early ",
//	EVENING
"\033[0m\033[35mEVENING\033[0m", "",
//	EVENING
"\033[1m\033[34mEVENING\033[0m", "late ",
//	NIGHT		
"\033[0m\033[34mNIGHT\033[0m", "",
//	NIGHT		
"\033[1m\033[34mNIGHT\033[0m", "",
//	MID NIGHT
"\033[1m\033[34mNIGHT\033[0m", "",
};
// Weather descriptors.
const	struct
{
	char	*desc;
	char	TempMin;		//  0 - 9
	char	TempMax;		// 0- 9
	char	WindMin;		//  0 - 9
	char	WindMax;		// 0 - 9
	char	CloudMin;		// 0 - 9
	char	CloudMax;	//  0 - 9
	char	Change;		// %
}SEASONS[]={	
	"\033[1m\033[33mSummer\033[0m",		4,	9,	0,	4,	0,	4,	25,
	"\033[0m\033[33mAutumn\033[0m",		2,	6,	1,	6,	2,	6,	50,
	"\033[1m\033[36mWinter\033[0m",		0,	3,	4,	9,	4,	9,	75,
	"\033[0m\033[34mSpring\033[0m",		2,	5,	3,	5,	3,	7,	30,
};

const	struct
{
	char	*desc;
}TEMP[]={
	"\033[1m\033[34mSub Zero\033[0m",
	"\033[1m\033[34mZero\033[0m",
	"\033[1m\033[34mFreezing\033[0m",
	"\033[1m\033[34mCold\033[0m",
	"\033[1m\033[34mCool\033[0m",
	"\033[1m\033[34mWarm\033[0m",
	"\033[1m\033[34mHot\033[0m",
	"\033[1m\033[34mVery Hot\033[0m",
	"\033[1m\033[34mSwealtering Heat\033[0m",
	"\033[1m\033[34mIndian Summer\033[0m",
};
const	struct
{
	char	*desc;
}WIND[]={
	"\033[36mStill Air\033[0m",
	"\033[36mSlight Breez\033[0m",
	"\033[36mBreez\033[0m",
	"\033[36mGentle Wind\033[0m",
	"\033[36mWindy\033[0m",
	"\033[36mVery Windy\033[0m",
	"\033[36mGusty\033[0m",
	"\033[36mGales\033[0m",
	"\033[36mStrong Gales\033[0m",
	"\033[36mHuricane\033[0m",
};
const	struct
{
	char	*desc;
}CLOUD[]={
	"\033[1m\033[37mClear Sky\033[0m",
	"\033[1m\033[37mSome Whisps of Cloud\033[0m",
	"\033[1m\033[37mVery Light Cloud\033[0m",
	"\033[1m\033[37mLight Cloud Cover\033[0m",
	"\033[1m\033[37mCloudy\033[0m",
	"\033[1m\033[37mCloud Coverd Sky\033[0m",
	"\033[1m\033[37mOvercast\033[0m",
	"\033[1m\033[37mDark Clouds\033[0m",
	"\033[1m\033[37mStorm Clouds\033[0m",
	"\033[1m\033[37mBlack Storm Clouds\033[0m",
};
// Weather matrix - Humidity. cloud x wind.
const struct
{
	int	hum[10]; 
	
}HUMID[]={
// Cld \|/   	Wnd ->.
		4,4,3,3,2,2,1,1,0,0,
		5,4,4,3,3,2,2,1,1,0,
		5,5,4,4,3,3,2,2,1,1,
		6,5,5,4,4,3,3,3,2,1,
		6,6,5,5,4,4,3,3,2,2,
		7,6,6,5,5,4,4,3,3,2,
		7,7,6,6,5,5,4,4,3,3,
		8,7,7,6,6,5,5,4,4,3,
		8,8,7,7,6,6,5,5,4,4,
		9,8,8,7,7,6,6,5,5,4,
};
// Weather matrix.
const struct
{
	int	weather[10];
}WTABLE[]={
// Temp  \|/  Humid ->.
	0, 1, 8, 8, 8, 8, 9, 9, 8, 8,
	1, 2, 8, 8, 8, 9, 9,10, 8, 9,
	2, 3, 8, 8, 9, 9, 9,10, 9,10,
	3, 4, 8, 9, 9, 9, 9,11,10,11,
	4, 5, 9, 9, 9, 9, 9,11,11,12,
	5, 6, 9, 9, 9, 9,10,12,12,13,
	6, 7, 9, 9, 9,10,11,12,13,14,
	7, 8, 9, 9,10,11,12,13,14,15,
	8, 9, 9,10,11,12,13,14,15,16,
	9,10,10,11,11,16,17,16,16,17,
};
// Weather effects.
const struct
{
	char	*desc;
	char	effect;
	char	val;
}WEATHER[]={
	"It's so cold, your extrmities will turn black if you are out here to long.",0,0,
	"There is and iced chill in the air, the ground crunches with every step.",0,0,
	"A hevay hail storm rages, the hail hurts your exposed skin.",0,0,
	"There is a hail storm",0,0,
	"There is heavy snow fall, its dificult to see.",0,0,
	"You are in a heavy snow blizard, it's hard to move in the drifts of snow.",0,0,
	"There is heavy snow fall",0,0,
	"It's snowing.",0,0,
	"Sleet falls from the sky.",0,0,
	"",0,0,
	"Water runs down the back of your neck as the light rain percistantly falls.",0,0,
	"You are getting wet from the rain fall.",0,0,
	"You are getting soaked by the heavy rain fall.",0,0,
	"You are in the middle of a thunder storm.",0,0,
	"An electrical storm is all around you, as far as the eye can see.",0,0,
	"The world around you is shaken by the thunder and illuminated by the lightning.",0,0,
	"Your heart jumps as you notice a tornado in the area.",0,0,
	"You can not move, the huricane rages, ripping trees from there roots.",0,0,
};
// Starvation effects.
const struct 
{
	char	*hunger;
	char	*shrt;
}food[] = {
	"",
	"not \033[32mhungry\033[0m",
	"You are \033[32mhungry\033[0m.\n\r",
	"\033[32mhungry\033[0m",
	"Your \033[32mbelly\033[0m is rumbbling.\n\r",
	"very \033[32mhungry\033[0m",
	"You are very \033[32mhungry\033[0m.\n\r",
	"realy very \033[32mhungry\033[0m",
	"You are having \033[32mstomach\033[0m cramps.\n\r",
	"\033[32mstarving\033[0m",
	"You are \033[32mstarving\033[0m.\n\r", 
	"\033[32mSTARVING\033[0m",
	"You will \033[31mdie\033[0m soon if you do not \033[32meat\033[0m !!!\n\r",
	"dying of \033[32mstarvation\033[0m",
};
const struct 
{
	char	*thirst;
	char	*shrt;
}drink[] = {
	"",
	"not \033[36mthirsty\033[0m",	
	"You are \033[36mthirsty\033[0m.\n\r",
	"\033[36mthirsty\033[0m",	
	"You are very \033[36mthirsty\033[0m.\n\r",
	"very \033[36mthirsty\033[0m",
	"Your \033[36mmouth\033[0m is dry.\n\r",
	"realy \033[36mthirsty\033[0m",
	"You realy need a \033[36mdrink\033[0m.\n\r",
	"realy very \033[36mthirsty\033[0m",
	"You are \033[36mdehydrated\033[0m.\n\r",
	"\033[36mdehydrating\033[0m",
	"You will \033[31mdie\033[0m soon if you do not \033[36mdrink\033[0m !!!\n\r",
	"dying of \033[36mthirst\033[0m",
};
// Skills.
struct {

	char	*name;				// Skill name.
	char	*desc;				// Description.
	int	useby;				// Who can use it.
	int	type;					// % general or use once.
	int	useon;				// use on self, npc,obj or room.
	int	oftype[5];			// Use on objects of this type.
	int	stat[5];				// up to 5 effects.
	int	statto[5];
	int	opper[5];			// up to 5 types +-=*/%
	int	value[5];			// up to 5 values either % or stat.
	int	special[5];			// up to 5 specials.	
	int	durat[5];		// up to 5 durations.
	char	*attempt[3];			// attempt text to 0 = self 1 = npc 2 = room.
	char	*fail[3];				// fail text as above.
	char	*success[3];			// success as above.

} show_skill[] = {
// General skills.
"agile","\033[36mThis skill will increase your dexterity by 2.\033[0m",
	UALL_SKL,ONES_SKL,SELF_SKL,
	0,0,0,0,0,
	DEX_NUM,0,0,0,0,
	2,0,0,0,0,
	PLUS_SKL,0,0,0,0,
	0,0,0,0,0,
	0,0,0,0,0,
	EVER_SKL,0,0,0,0,
	"","","",
	"","","",
	"You now feel more agile.","","Looks more agile.",
"cook","\033[36mThis skill enables you too turn raw items into food.\033[0m",
	UALL_SKL,PERC_SKL,OBJT_SKL,
	OBJ_RAW,0,0,0,0,
	MANA_NUM,0,0,0,0,
	OBJ_FOOD,0,0,0,0,
	EQUL_SKL,0,0,0,0,
	25,0,0,0,0,
	0,0,0,0,0,
	EVER_SKL,0,0,0,0,
	"You attempt to cook","","is attempting to cook",
	"You have failed to cook","","has failed to cook",
	"You can now eat","","has cooked",
"stamina","\033[36mThis skill will increase your constitution by 2.\033[0m",
	UALL_SKL,ONES_SKL,SELF_SKL,
	0,0,0,0,0,
	CON_NUM,0,0,0,0,
	2,0,0,0,0,
	PLUS_SKL,0,0,0,0,
	0,0,0,0,0,
	0,0,0,0,0,
	EVER_SKL,0,0,0,0,
	"","","",
	"","","",
	"You feel you can take on the world.","","Looks a bit more hardy.",
"strong","\033[36mThis skill will increase your strength by 2.\033[0m",
	UALL_SKL,ONES_SKL,SELF_SKL,
	0,0,0,0,0,
	STR_NUM,0,0,0,0,
	2,0,0,0,0,
	PLUS_SKL,0,0,0,0,
	0,0,0,0,0,
	0,0,0,0,0,
	EVER_SKL,0,0,0,0,
	"","","",
	"","","",
	"You now feel stronger.","","Looks stronger now.",
"swim","\033[36mThis skill will enable you to swim in water.\033[0m",
	UALL_SKL,PERC_SKL,ROOM_SKL,
	WATER_ROOM,0,0,0,0,
	POS_NUM,0,0,0,0,
	POS_SWIMMING,0,0,0,0,
	EQUL_SKL,0,0,0,0,
	25,0,0,0,0,
	0,0,0,0,0,
	20,0,0,0,0,
	"You attempt to swim.","","attempts swimming.",
	"You fail to use the skill.","","",
	"You start swimming.","","starts swimming.",
// ************ Cleric skills.
// ************ Druid skills.
// ************ Mage skills.
// ************ Theif skills.
"slntmv","\033[36mThis skill lets you move around unseen.\033[0m",
	THIEF,ONOF_SKL,SELF_SKL,
	0,0,0,0,0,
	INVIS_NUM,0,0,0,0,
	LEVEL_NUM,0,0,0,0,
	EQUL_SKL,0,0,0,0,
	0,0,0,0,0,
	OWNS_SKL,0,0,0,0,
	ONOF_SKL,0,0,0,0,
	"","","",
	"You slowly come out of the shadows.\n\r","","comes out of the shadows.",
	"You can now sneak around.","","has vanished into the shadows.",
// ************ Warrior skills.
"hand2hand","\033[36mThis skill will increase your damage by 2.\033[0m",
	WARRIOR,ONES_SKL,SELF_SKL,
	0,0,0,0,0,
	TODAM_NUM,0,0,0,0,
	2,0,0,0,0,
	PLUS_SKL,0,0,0,0,
	0,0,0,0,0,
	0,0,0,0,0,
	EVER_SKL,0,0,0,0,
	"","","",
	"","","",
	"You feel you could beat anyone in a fight.","","Looks a little battle wise.",
"LAST_SKILL","LAST_SKILL",
	LAST_SKL,0,0,
	0,0,0,0,0,
	0,0,0,0,0,
	0,0,0,0,0,
	0,0,0,0,0,
	0,0,0,0,0,
	0,0,0,0,0,
	0,0,0,0,0,
	"","","",
	"","","",
	"","","",
	
};
//////////////CRTH

const struct {
   char *name;
	char *brief;
   int  opposite;
	int  xyz[3];
} exit_list[] = {
   "north",       "n",       1,    0, 1, 0,
   "south",       "s",       0,    0,-1, 0,
   "east",        "e",       3,    1, 0, 0,
   "west",        "w",       2,   -1, 0, 0,
   "northeast",   "ne",      5,    1, 1, 0,
   "southwest",   "sw",      4,   -1,-1, 0,
   "southeast",   "se",      7,    1,-1, 0,
   "northwest",   "nw",      6,   -1, 1, 0,
   "up",          "u",       9,    0, 0, 1,
   "down",        "d",       8,    0, 0,-1,
};

const struct {
	char	*name;
	int	min;
	char	bit;
} align[] = {
	"\033[1m\033[34mevil\033[0m",		0,			ANTI_EVIL,
	"\033[36mneutral\033[0m",	660,		ANTI_NEUTRAL,
	"\033[1m\033[37mgood\033[0m",		1340,		ANTI_GOOD,
};

const struct {
   char  *name;			/* The attribute name */
   short number;			/* Where to find it */
   short min;				/* The minimum value allowed */
   short max;				/* The maximum value allowed */
} data_list[] = {
   "ac",          ARMOR_NUM,     -100,    100,
   "age",         AGE_NUM,       17,      100,
	"align",       ALIGN_NUM,     0,       0,
	"class",       CLASS_NUM,     0,       0,
   "con",         CON_NUM,       0,       18,
   "dex",         DEX_NUM,       0,       18,
	"die",			DIE_NUM,			0,			18,
	"height",		HEIGHT_NUM,		140,		240,
	"hit",			MAX_HIT_NUM,	0,			400,
   "int",         INT_NUM,       0,       18,
   "invis",       INVIS_NUM,     0,       IMP,
   "level",       LEVEL_NUM,     0,       IMP,
	"mana",			MAX_MANA_NUM,	0,			400,
	"modifier",		MOD_NUM,			0,			20,
	"move",			MAX_MOVE_NUM,	0,			400,
	"sex",         SEX_NUM,       0,       0,
	"sides",			SIDES_NUM,		0,			20,
   "str",         STR_NUM,       0,       18,
	"thac0",			THAC0_NUM,		0,			100,
   "todam",       TODAM_NUM,     0,       50,
   "tohit",       TOHIT_NUM,     0,       50,
	"weight",		WEIGHT_NUM,		120,		350,
   "wis",         WIS_NUM,       0,       18,
	"genskill",		GENSK_NUM,		0,			8,
	"clskill",		SPSK_NUM,		0,			4,
	"\n",				0,					0,			0,
};

const struct {
   char  *name;         /* The attribute name */
   short number;        /* Where to find it */
} l_data_list[] = {
	"GOLD",			0,	
	"BANK",			1,
	"EXP",			2,
	"\n",				0,
};

const struct {
	char	*verb;
	char	*where;
	int	setbit;
} worn[] = {
	"wield",	"<wielded>",							WORN_HANDS,
	"hold",	"<held>",								WORN_HANDS,
	"wear",	"<worn on right ring finger>",	WORN_FINGER,
	"wear",	"<worn on left ring finger>",		WORN_FINGER,
	"wear",	"<worn as gloves>",					WORN_GLOVES,
	"wear",	"<worn on right wrist>",			WORN_WRISTS,
	"wear",	"<worn on left wrist>",				WORN_WRISTS,
	"wear",	"<worn on arms>",						WORN_ARMS,
	"wear",	"<worn around neck>",				WORN_NECK,
	"wear",	"<worn around neck>",				WORN_NECK,
	"wear",	"<worn on head>",						WORN_HEAD,
	"wear",	"<worn on chest>",					WORN_CHEST,
	"wear",	"<worn around waist>",				WORN_WAIST,
	"wear",	"<worn around legs>",				WORN_LEGS,
	"wear",	"<worn on feet>",						WORN_FEET,
	"wear",	"<worn as shield>",					WORN_SHIELD,
	"wear",	"<worn around body>",				WORN_BODY,
	"use",	"<used as light>",					WORN_LIGHT,
   "wear",  "<worn on back>",                WORN_BACK,
};

const struct {
   char  *full;
   char  *abbr;
   char  level;
} plevel[] = {
   "\033[1m\033[33mWizard\033[0m",      "\033[1m\033[33mWIZ\033[0m",      WIZARD,
   "\033[1m\033[33mImmortal\033[0m",    "\033[1m\033[33mIMM\033[0m",      IMMORT,
   "\033[1m\033[33mGrGod\033[0m",       "\033[1m\033[33mGRGOD\033[0m",    GRGOD,
   "\033[1m\033[33mGod\033[0m",         "\033[1m\033[33mGOD\033[0m",      GOD,
   "\033[1m\033[33mImplementor\033[0m", "\033[1m\033[33mIMP\033[0m",      IMP,
};

const char	*log_state[] = {
   "(Playing)",
   "(Entering name)",
   "(Confirming name)",
   "(Entering Password)",
   "(Choosing Password)",
   "(Confirming Password)",
   "(Choosing sex)",
   "(Choosing class)",
   "(Exiting)",
	"",
};


const char *pos_allowed[] = {
   "You ARE dead, you can't do that!\n\r",
   "You can't do that in your condition!\n\r",
   "Try waking up first!\n\r",
   "You can't do that resting.\n\r",
   "You can't do that sitting.\n\r",
   "",
	"You can't do that riding this thing.\n\r",
	"You can't do that driving this thing.\n\r",
	"You can't do that swimming!\n\r",
   "Perhaps you should start a fight first?\n\r",
};

const char	*stat_allowed[] = {
	"You are in a comma, you can't do that!\n\r",
	"You are so DrUnK, you can't do that !\n\r",
	"",
	"",
	"",
	"",
	"You drunk & poisond, you are no use to anyone...\n\r",
	"You are poisond & have a disease, go see the Doc...\n\r",
	"You have a disease and are too drunk for that\n\r",
	"You have been poisond, have a disease and you are too drunk, you should be dead\n\r",
};

const struct {
   char  position;
   char  *txt;
   char  *shrt;
} show_pos[] = {
   POS_DEAD,       "'s corpse is here",             "DEAD!",
   POS_INCAP,      " is lying here incapacitated",  "incapacitated",
   POS_ASLEEP,     " is sleeping here",             "sleeping",
   POS_RESTING,    " is resting here",              "resting",
   POS_SITTING,    " is sitting here",              "sitting",
   POS_STANDING,   " is standing here",             "standing",
	POS_RIDING,	 	 " is riding some sort of beast", "riding",
	POS_FLYING,     " is hovering here",             "flying",
	POS_DRIVING,	 " is driving a vehicle here",	 "driving",
	POS_SWIMMING,	 " is swimming here",				 "swimming",
   POS_FIGHTING,   " is fighting",                  "fighting",
};

const struct {
	char	state;
	char	*txt;
	char	*shrt;
} show_stat[] = {
	STAT_STONED,	"You are completly intoxicated\n\r",		"\033[31mHAMERED\033[0m",
	STAT_DRUNK,		"You feel drunk\n\r",							"\033[34mdrunk\033[0m",
	STAT_TIPSY,		"You feel tipsy\n\r",							"\033[36mtipsy\033[0m",
	STAT_OK,			"You feel fine\n\r",							"\033[1m\033[37mfine\033[0m",
	STAT_POISEND,	"You feel a bit ill\n\r",					"\033[1m\033[32mpoisond\033[0m",
	STAT_PLAUGE,	"You feel very ill\n\r",						"\033[33mDISEASED\033[0m", 
	STAT_DAP,		"You feel realy, realy \033[31mBAD\033[0m.\n\r", "\033[34mDrunk\033[0m & \033[32mPoisond\033[0m",
	STAT_PAP,		"You are in a bad way...\n\r",		"\033[32mPoisond & Plauged\033[0m",
	STAT_DPL,		"Your drunk and diseased.\n\r",		"\033[34mDrunk\033[0m & \033[33mPlauged\033[0m",
	STAT_DPP,		"Drunk, poisond & have disease!\n\r", "\033[34mDrunk\033[0m, \033[32mPoisend\033[0m & \033[33mPlauged\033[0m",
};

const struct {
   char  *full;
   char  *abbr;
} class[] = {
   "****",     "--",
   "\033[31mMage\033[0m",				"\033[31mMa\033[0m",
   "\033[33mDruid\033[0m",		   	"\033[33mDr\033[0m",
   "\033[1m\033[36mCleric\033[0m",  "\033[1m\033[36mCl\033[0m",
   "\033[32mThief\033[0m",				"\033[32mTh\033[0m",
   "\033[34mWarrior\033[0m",			"\033[34mWa\033[0m",
};

const struct {
   char  *a;
   char  *b;
	char	*c;
} sex[] = {
   "?",     "?",		"?",
   "she",   "her",	"Female",
   "he",    "his",	"Male",
   "it",    "it's",	"Neutral"
};

/* DO NOT CHANGE THE ORDER OF THE CLASS AND SEX */
const struct {
   char  *name;
   char  setbit;
} anti_sex_flag[] = {
   "!FEMALE",		ANTI_FEMALE,
   "!MALE",			ANTI_MALE,
   "!NEUTER",   	ANTI_NEUTER,
	"\n",				0,
};

const struct {
	char	*name;
	char	setbit;
} anti_class_flag[] = {
   "!MAGE",  	  	ANTI_MAGE,
   "!CLERIC", 		ANTI_CLERIC,
   "!WARRIOR",		ANTI_WARRIOR,
   "!THIEF",  		ANTI_THIEF,
   "!DRUID",		ANTI_DRUID,
	"\n",				0,
};

const struct {
	char *name;
	char number;
} class_list[] = {
	"MAGE",		MAGE,
	"DRUID",		DRUID,
	"CLERIC",	CLERIC,
	"THIEF",		THIEF,
	"WARRIOR",	WARRIOR,
	"\n",			0,
};

const struct {
	char *name;
	char number;
} sex_list[] = {
	"FEMALE",	FEMALE,
	"MALE",		MALE,
	"NEUTER",	NEUTER,
	"\n",			0,
};

const struct {
   char  *name;
   char  setbit;
} anti_align_flag[] = {
   "!EVIL",       ANTI_EVIL,
   "!NEUTRAL",		ANTI_NEUTRAL,
   "!GOOD",		   ANTI_GOOD,
	"\n",				0,
};

const struct {
   char  *name;
   int   setbit;
} room_flag[] = {
   "NO_MAGIC",    NO_MAGIC,
   "NO_OFFEN",    NO_OFFEN,
   "NO_DEFEN",    NO_DEFEN,
   "NO_FIGHT",    NO_FIGHT,
   "NO_MOB",      NO_MOB,
   "NO_SUMMON",   NO_SUMMON,
   "PRIVATE",     PRIVATE,
   "HEAL_ROOM",   HEAL_ROOM,
   "DEATH_TRAP",  DEATH_TRAP,
   "WATER_ROOM",  WATER_ROOM,
   "NO_SWIM",     NO_SWIM,
   "MID_AIR",     MID_AIR,
   "FIRE_ROOM",   FIRE_ROOM,
   "IS_DARK",     IS_DARK,
	"OUTSIDE",     OUTSIDE,
	"HAS_LIGHT",   HAS_LIGHT,
   "MIN_LEVEL",   0x0003,
   "MAX_LEVEL",   0x0007,
	"SPECIAL",		0x000b,
	"MOVE_COST",   0x000f,
	"SOME_WATER",	SOME_WATER,
   "\n",          0,
};

const struct {
	char	*name;
	int	setbit;
	char	args;
} obj_type_flag[] = {
	"GOLD",			OBJ_GOLD,		0,
	"BOAT",			OBJ_BOAT,		0,
	"CONTAINER",	OBJ_CONT,		2,		/* 1=typeof, 2=holds how much */
	"POTION",		OBJ_POTION,		2,		/* 1=typeof, 2=duration, */
	"SCROLL",		OBJ_SCROLL,		2,
	"BOW",			OBJ_BOW,			0,
	"ARROW",			OBJ_ARROW,		3,		/* 1=die, 2=die size, 3=modifier */
	"WAND",			OBJ_WAND,		3,
	"STAFF",			OBJ_STAFF,		3,
	"FOOD",			OBJ_FOOD,		2,		/* 1=typeof, 2=fill-ability */
	"KEY",			OBJ_KEY,			1,		/* 1=Key number */
	"EXPLOSIVE",	OBJ_EXPL,		4,		/* 1=typeof, 2=die, 3=die size, 4=modifier */
	"LIGHT",			OBJ_LIGHT,		1,		/* 1=duration (-1 = eternal) */
	"DRINK",        OBJ_DRINK,      2,    //  1=type (0=normal, 1=Alcahol, 2=Poison) 2=streangth.
	"RAW",			OBJ_RAW,			0,
	"RIDE",			OBJ_RIDE,		2,
	"\n",				0,					0,
};

const struct {
	char	*name;
	int	setbit;
	char	args;
}	obj_worn_flag[] = {
	"HANDS",			WORN_HANDS,		-1,
	"FEET",			WORN_FEET,		-1,
	"ARMS",			WORN_ARMS,		-1,
	"LEGS",			WORN_LEGS,		-1,
	"HEAD",			WORN_HEAD,		-1,
	"NECK",			WORN_NECK,		-1,
	"FINGER",		WORN_FINGER,	-1,
	"BODY",			WORN_BODY,		-1,
	"WRISTS",		WORN_WRISTS,	-1,
	"CHEST",			WORN_CHEST,		-1,
	"WAIST",			WORN_WAIST,		-1,
	"SHIELD",		WORN_SHIELD,	-1,
	"LIGHT",			WORN_LIGHT,		-1,
	"SPECIAL",		0,					-2,
   "BACK",        WORN_BACK,     -1,
	"\n",				0,					0,
};


/* DO NOT CHANGE THE ORDER BELOW */
const struct {
   char  *flag;
   char  setbit;
} exit_flag[] = {
	"OPEN",        OPEN,
   "CLOSED",      CLOSED,
   "LOCKED",      LOCKED,
	"HIDDEN",		HIDDEN,
   "PICK_PROOF",  PICK_PROOF,
   "SPECIAL",     -1,
   "\n",          0,
};

const int stat_order[][5] = {
	{ WIS_NUM,	INT_NUM,	CON_NUM,	DEX_NUM,	STR_NUM, },
	{ INT_NUM,	WIS_NUM,	STR_NUM,	CON_NUM,	DEX_NUM, },
	{ WIS_NUM,	CON_NUM,	INT_NUM,	DEX_NUM,	STR_NUM, },
	{ WIS_NUM,	DEX_NUM,	STR_NUM,	INT_NUM,	CON_NUM, },
	{ STR_NUM,	DEX_NUM,	WIS_NUM,	INT_NUM,	CON_NUM, },
};

/* 0 = Mage    */
/* 1 = Druid   */
/* 2 = Cleric  */
/* 3 = Thief   */
/* 4 = Warrior */

const long levels[51] = {
	  200,     500,     800,     1200,    1600,    2100,
	  2700,    3500,    6000,    9000,    12000,   16000,
	  23000,   30000,   40000,   51000,   64000,   82000,
	  100000,  120000,  140000,  160000,  180000,  200000,
	  230000,  260000,  290000,  330000,  370000,  410000,
	  470000,  500000,  550000,  600000,  650000,  700000,
	  750000,  800000,  850000,  900000,  950000,  1000000,
     1500000, 2000000, 4000000, 4200000, 4400000, 4600000,
	  4800000, 5000000
};

const char thac0_list[5][51] = {
	{ 0,30,30,30,29,29,29,28,28,27,27,27,26,26,25,25,25,24,24,24,23,23,22,22,22,21,
	  20,20,20,19,19,19,18,18,18,17,17,16,16,16,15,15,15,14,14,13,13,13,12,12,12 },
	{ 0,30,30,29,29,29,28,27,27,26,26,26,25,24,24,23,23,23,22,21,21,20,20,20,19,18,
	  18,17,17,17,16,15,15,14,14,14,13,12,12,11,11,11,10, 9, 9, 8, 8, 8, 7, 6, 6 },
	{ 0,30,30,29,29,28,28,27,27,26,26,25,25,24,24,23,23,22,22,21,21,20,20,19,19,18,
	  18,17,17,16,16,15,15,14,14,13,13,12,12,11,11,10,10, 9, 9, 8, 8, 7, 7, 6, 6 },
	{ 0,30,30,29,28,27,27,26,25,24,24,23,22,21,21,20,19,18,18,17,16,15,15,14,13,12,
	  12,11,10, 9, 9, 8, 7, 6, 6, 5, 4, 3, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
	{ 0,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10, 9, 8, 7, 6,
	   5, 4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
};

const struct {
	char	*att_msg;
	char	*def_msg;
} dam_force[] = {
	"\033[0m\033[37mmiss\033[0m",
	"\033[0m\033[37mmisses\033[0m",
	"\033[31mtickle\033[0m",
	"\033[31mtickles\033[0m",
	"\033[32mtaunt\033[0m",
	"\033[32mtaunts\033[0m",
	"\033[33mbarely hit\033[0m",
	"\033[33mbarely hits\033[0m",
	"\033[34mhit\033[0m",
	"\033[34mhits\033[0m",
	"\033[1m\033[34mhit\033[0m",
	"\033[1m\033[34mhits\033[0m",
	"\033[35mhit\033[0m",
	"\033[35mhits\033[0m",
	"\033[36msmash\033[0m",
	"\033[1m\033[37msmashes\033[0m",
	"\033[1m\033[37msmash\033[0m",
	"\033[1m\033[31msmashes\033[0m",
	"\033[1m\033[31mmassacre\033[0m",
	"\033[1m\033[32mmassacres\033[0m",
	"\033[1m\033[32mMASSACRE\033[0m",
	"\033[1m\033[33mMASSACRES\033[0m",
	"\033[1m\033[33mMASSACRE\033[0m",
	"\033[1m\033[35mMASSACRES\033[0m",
	"\033[1m\033[35mOBLITERATE\033[0m",
	"\033[1m\033[36mOBLITERATES\033[0m",
};

const char *health[] = {
	"is close to death",
	"is in an awful condition",
	"is in a pretty bad way",
	"has some very serious wounds",
	"has some minor wounds",
	"has a few cuts and bruises",
	"has a few scratches",
	"is in excellent condition",
};

const struct {
	char	*name;
	long	setbit;
} mob_flag[] = {
	"STAY_ZONE",		STAY_ZONE,
	"AGGRESSIVE",		AGGRESSIVE,
	"WIMPY",				WIMPY,
	"SCAVENGER",		SCAVENGER,
	"ACT_THIEF",		ACT_THIEF,
	"!PKILLER",			ANTI_PKILLER,
	"SENTINEL",			SENTINEL,
	"\n",					0,
};

const char *invite[] = {"Used","One Invite","Always"};
	
struct {
	char	number;
	void	(*mode_pointer)();
} mode[] = {
	CON_CLOSE,		close_socket,
	CON_NME,			con_name,
	CON_NMECNF,		con_nmecnf,
	CON_PWDNRM,		con_pwdnrm,
	CON_PWDGET,		con_pwdget,
	CON_PWDCNF,		con_pwdcnf,
	CON_QSEX,		con_qsex,
	CON_QCLASS,		con_qclass,
	CON_REROLL,		con_reroll,
	CON_LINKLESS,  close_socket,
	CON_PLYNG,		command_parser,
	CON_BUILD,     build_parser,
	CON_PRIVATE,	command_parser,
};


