SmaugWizard/Backup/
SmaugWizard/Backup/L/
SmaugWizard/Boards/
SmaugWizard/Building/
SmaugWizard/Corpses/
SmaugWizard/Councils/
SmaugWizard/Deity/
SmaugWizard/Gods/
SmaugWizard/MudProgs/
SmaugWizard/Player/L/
SmaugWizard/Src/
SmaugWizard/Src/res/
/****************************************************************************
 * [S]imulated [M]edieval [A]dventure multi[U]ser [G]ame      |				*
 * -----------------------------------------------------------|   \\._.//	*
 * SmaugWiz (C) 1998 by Russ Pillsbury (Windows NT version)   |   (0...0)	*
 * -----------------------------------------------------------|    ).:.(	*
 * SMAUG (C) 1994, 1995, 1996 by Derek Snider                 |    {o o}	*
 * -----------------------------------------------------------|   / ' ' \	*
 * SMAUG code team: Thoric, Altrag, Blodkai, Narn, Haus,      |~'~.VxvxV.~'~*
 * Scryn, Swordbearer, Rennard, Tricops, and Gorog.           |				*
 * ------------------------------------------------------------------------ *
 * Merc 2.1 Diku Mud improvments copyright (C) 1992, 1993 by Michael        *
 * Chastain, Michael Quan, and Mitchell Tse.                                *
 * Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,          *
 * Michael Seifert, Hans Henrik Staerfeldt, Tom Madsen, and Katja Nyboe.    *
 * ------------------------------------------------------------------------ *
 *			    Skills Interface file										*
 ****************************************************************************/
#ifndef		CLASS_H
#define		CLASS_H

#define		CurrentClassFileVersion		1000

enum NpcClass { NPC_MAGE,  NPC_CLERIC, NPC_THIEF,   NPC_WARRIOR, NPC_VAMPIRE,
				NPC_DRUID, NPC_RANGER, NPC_AUGURER, NPC_PC8,     NPC_PC9,
				NPC_PC10,  NPC_PC11,   NPC_PC12,    NPC_PC13,    NPC_PC14,
				NPC_PC15,  NPC_PC16,   NPC_PC17,    NPC_PC18,    NPC_PC19,
				NPC_BAKER, NPC_BUTCHER,NPC_BLACKSMITH, NPC_MAYOR,NPC_KING,
				NPC_QUEEN, MAX_NPC_CLASS };

#ifdef SMAUGSERVER_CPP
const char* NpcClassNames [MAX_NPC_CLASS] =
{
	"mage", "cleric", "thief", "warrior", "vampire", "druid", "ranger",
	"augurer", "pc8", "pc9", "pc10", "pc11", "pc12", "pc13", "pc14", "pc15",
	"pc16", "pc17", "pc18", "pc19",
	"baker", "butcher", "blacksmith", "mayor", "king", "queen"
};
#endif
extern const char *NpcClassNames [MAX_NPC_CLASS];


// Per-class stuff.
class CClassData {
public:
				CClassData () { memset (this, 0, sizeof (CClassData)); }
				~CClassData ();

	int			GetCurrentVersion () { return CurrentClassFileVersion; }
	BOOL		Read (FILE* fp);
	void		Write ();
	char		*GetName () { return m_pName; }
	void		SetName (const char* n) { m_pName = STRALLOC (n); }
	int			GetClass () { return m_Class; }
	int			GetAttrPrime () { return m_AttrPrime; }
	void		SetAttrPrime (int a) { m_AttrPrime = a; }
	int			GetWeapon () { return m_Weapon; }
	void		SetWeapon (int w) { m_Weapon = w; }
	int			GetGuild () { return m_Guild; }
	void		SetGuild (int g) { m_Guild = g; }
	int			GetSkillAdept () { return m_SkillAdept; }
	int			GetThac0 () { return m_Thac0_00; }
	void		SetThac0 (int t) { m_Thac0_00 = t; }
	int			GetThac32 () { return m_Thac0_32; }
	void		SetThac32 (int t) { m_Thac0_32 = t; }
	int			GetMinHp () { return m_HpMin; }
	void		SetMinHp (int h) { m_HpMin = h; }
	int			GetMaxHp () { return m_HpMax; }
	void		SetMaxHp (int h) { m_HpMax = h; }
	BOOL		HasManaGain () { return m_bManaGain; }
	void		SetManaGain (BOOL b) { m_bManaGain = b; }
	int			GetExpBase () { return m_ExpBase; }
	void		SetExpBase (int e) { m_ExpBase = e; }
	BOOL		CanMorph (const char* morph);
	char		*GetTitle (int lev, int sex) { return m_Titles [lev][sex]; }
	void		SetTitle (int lev, int sex, const char* tit)
				{ delete m_Titles [lev][sex]; m_Titles [lev][sex] = str_dup (tit); }

friend class CClassTable;
protected:
	char	*m_pName;			// Class Name
	int		m_Class;			// Assigned class number
	int		m_AttrPrime;		// Prime attribute
	int		m_Weapon;			// First weapon
	int		m_Guild;			// Vnum of guild room
	int		m_SkillAdept;		// Maximum skill level
	int		m_Thac0_00;			// Thac0 for level  0
	int		m_Thac0_32;			// Thac0 for level 32
	int		m_HpMin;			// Min hp gained on leveling
	int		m_HpMax;			// Max hp gained on leveling
	BOOL	m_bManaGain;		// Class gains mana on level
	int		m_ExpBase;			// Class base exp
	int		m_SDPercent;		// Shove/Drag percentage
	char	*m_Titles [MAX_LEVEL+1][2];	
};


#define			GCD		GetClassData(c)

class CClassTable : public CPtrList {
public:
	void		Load ();
	void		Save ();
	BOOL		IsValidClass (int c) { return c >= 0 && c < GetCount (); }
	BOOL		LoadClassFile (const char *fname);
	void		Add (CClassData* pCl) { AddTail (pCl); }
	CClassData	*GetNext (POSITION& pos)
				{ return (CClassData*) CPtrList::GetNext (pos); }
	CClassData	*RemoveTail () { return (CClassData*) CPtrList::RemoveTail (); }
	CClassData	*GetClassData (int c)		// Get CClassData pointer from class number
				{ if (c < 0 || c > GetCount ()) c = 0;
				  return (CClassData*) GetAt (FindIndex (c)); }
	CClassData	*Find (const char* name);
	char		*GetName (int c) { return GCD->m_pName; }
	void		ListClasses (CCharacter *ch);
	int			GetClass (const char* name);
	int			GetSkillAdept (int c) { return GCD->m_SkillAdept; }
	int			GetAttrPrime (int c) { return GCD->m_AttrPrime; }
	char		*GetTitle (int c, int lev, int sex)
				{ return GCD->m_Titles [lev][sex]; }
	int			GetThac0 (int c) { return GCD->GetThac0 (); }
	int			GetThac32 (int c) { return GCD->GetThac32 (); }
	int			GetExpBase (int c) { return GCD->GetExpBase (); }
	int			GetShoveDragPercent (int c) { return GCD->m_SDPercent; }
	BOOL		HasManaGain (int c) { return GCD->m_bManaGain; }
	BOOL		CanMorph (int c, const char* mor) { return GCD->CanMorph (mor); }
	BOOL		IsVampire (int c)
				{ return ! stricmp (GCD->m_pName, "Vampire"); }
	void		RemoveAll ();

	NpcClass	GetNpcClass (const char* name);
	const char*	GetNpcClassName (int r)
				{ if (r >= 0 || r < MAX_NPC_CLASS) return NpcClassNames [r];
				  else return "none"; }
};


#ifdef	SMAUGSERVER_CPP
	CClassTable		ClassTable;
#endif

extern CClassTable		ClassTable;

#endif