roh/conf/area/
roh/game/talk/
roh/help/
roh/monsters/ocean/
roh/objects/ocean/
roh/player/
roh/rooms/area/1/
roh/rooms/misc/
roh/rooms/ocean/
roh/src-2.44b/
/*
 * data.h
 *	 Header file for data storage
 *   ____            _
 *  |  _ \ ___  __ _| |_ __ ___  ___
 *  | |_) / _ \/ _` | | '_ ` _ \/ __|
 *  |  _ <  __/ (_| | | | | | | \__ \
 *  |_| \_\___|\__,_|_|_| |_| |_|___/
 *
 * Permission to use, modify and distribute is granted via the
 *  Creative Commons - Attribution - Non Commercial - Share Alike 3.0 License
 *    http://creativecommons.org/licenses/by-nc-sa/3.0/
 *
 * 	Copyright (C) 2007-2009 Jason Mitchell, Randi Mitchell
 * 	   Contributions by Tim Callahan, Jonathan Hseu
 *  Based on Mordor (C) Brooke Paul, Brett J. Vickers, John P. Freeman
 *
 */

#ifndef DATA_H_
#define DATA_H_

class cWeather;
class cSeason;

class CatRefInfo {
public:
	CatRefInfo();
	~CatRefInfo();
	void	clear();
	void	load(xmlNodePtr rootNode);
	void	loadSeasons(xmlNodePtr curNode);
	void	save(xmlNodePtr curNode) const;
	bstring str() const;
	void	copyVars(const CatRefInfo* cri);
	bool	moveRoom(CatRef origin, CatRef target);
	const cWeather* getWeather() const;
	bstring getFishing() const;

	int		id;			// 0 for unique rooms, a number for areas
	bstring	area;		// "area" is a special area for the overland
	bstring name;		// display purposes only
	bstring worldName;	// for cmdTime
	bstring yearsSince;	// for printtime
	bstring parent;		// which catrefinfo to inherit limbo/recall from, misc by default
	int		yearOffset;
	int		limbo;
	int		recall;
	int		teleportWeight;
	int		teleportZone;
	int		trackZone;
	std::map<Season,cSeason*> seasons;	// the seaons hold the weather

protected:
	bstring fishing;
};


class StartLoc {
public:
	StartLoc();
	void	load(xmlNodePtr curNode);
	void	save(xmlNodePtr curNode) const;

	bstring	getName() const;
	bstring	getBindName() const;
	bstring	getRequiredName() const;
	Location getBind() const;
	Location getRequired() const;
	CatRef getStartingGuide() const;
	bool	moveRoom(CatRef origin, CatRef target);
	bool	isDefault() const;
	void	setDefault();

protected:
	bstring	name;
	bstring	bindName;
	bstring	requiredName;
	Location bind;
	Location required;
	CatRef startingGuide;
	bool	primary;
};


class PlayerTitle {
public:
	PlayerTitle();
	void	load(xmlNodePtr rootNode);
	bstring getTitle(bool sexMale) const;
protected:
	bstring		male;
	bstring		female;
};



// Describes the skill gained and who gets it
class SkillGain {
public:
	SkillGain(xmlNodePtr rootNode);
	~SkillGain();
	int getGained();
	bstring getName() const;
	bool deityIsAllowed(int deity);
	bool hasDeities();
protected:
	void load(xmlNodePtr rootNode);
	bstring skillName; // Name of the skill being gained
	int gainLevel; // Gained level they start with

	std::map<int, bool> deities;
};


// Class to describe what is gained at each level
class LevelGain {
public:
	LevelGain(xmlNodePtr rootNode);
	~LevelGain();
	std::list<SkillGain*>::const_iterator getSkillBegin();
	std::list<SkillGain*>::const_iterator getSkillEnd();
	bstring getStatStr();
	bstring getSaveStr();
	int getStat();
	int getSave();
	int getHp();
	int getMp();
	bool hasSkills();
protected:
	void load(xmlNodePtr rootNode); // Read in a level gain from the given node;

	int stat; // The stat they get this level
	int hp; // HP & MP gain
	int mp;
	int save; // Saving throw to go up
	std::list<SkillGain*> skills; // Skills they gain at this level
public:


};

// Information about a player class
class PlayerClass {
public:
	PlayerClass(xmlNodePtr rootNode);
	~PlayerClass();
	int getId() const;
	bstring getName() const;
	short getBaseHp();
	short getBaseMp();
	bool needsDeity();
	short numProfs();
	std::list<SkillGain*>::const_iterator getSkillBegin();
	std::list<SkillGain*>::const_iterator getSkillEnd();
	std::map<int, LevelGain*>::const_iterator getLevelBegin();
	std::map<int, LevelGain*>::const_iterator getLevelEnd();
	LevelGain* getLevelGain(int lvl);
	bstring getTitle(int lvl, bool male, bool ignoreCustom=true) const;
	bstring getUnarmedWeaponSkill() const;

	std::map<int, PlayerTitle*> titles;
	Dice damage;
protected:
	void load(xmlNodePtr rootNode);

	// Base Stats for the class
	bstring name;
	int id;
	short baseHp;
	short baseMp;
	bool needDeity;
	short numProf;
	// Skills they start with
	std::list<SkillGain*> baseSkills;
	// Stuff gained on each additional level
	std::map<int, LevelGain*> levels;
	bstring unarmedWeaponSkill;
};



class RaceData {
protected:
	int id;
	bstring name;
	bstring adjective;
	bstring abbr;

	bool infra;
	bool bonus;
	Size size;
	int startAge;

	bool playable;
	bool isParentRace;
	bool gendered;
	int parentRace;

	int	stats[MAX_STAT];
	int saves[MAX_SAVE];
	short porphyriaResistance;

	bool classes[CLASS_COUNT_MULT];
	bool multiClerDeities[DEITY_COUNT];
	bool clerDeities[DEITY_COUNT];
	bool palDeities[DEITY_COUNT];
	bool dkDeities[DEITY_COUNT];

	// Skills they start with
	std::list<SkillGain*> baseSkills;
public:
	RaceData(xmlNodePtr rootNode);

	int getId() const;
	bstring getName(int tryToShorten=0) const;
	bstring getAdjective() const;
	bstring getAbbr() const;

	int getParentRace() const;
	void makeParent();
	bool isParent() const;
	bool isPlayable() const;
	bool isGendered() const;

	bool hasInfravision() const;
	bool bonusStat() const;
	Size getSize() const;
	int getStartAge() const;
	int getStatAdj(int stat) const;
	int getSave(int save) const;
	short getPorphyriaResistance() const;

	bool allowedClass(int cls) const;
	bool allowedDeity(int cls, int cls2, int dty) const;
	bool allowedMultiClericDeity(int dty) const;
	bool allowedClericDeity(int dty) const;
	bool allowedPaladinDeity(int dty) const;
	bool allowedDeathknightDeity(int dty) const;

	std::list<SkillGain*>::const_iterator getSkillBegin() const;
	std::list<SkillGain*>::const_iterator getSkillEnd() const;

	std::map<Sex, short> baseHeight;
	std::map<Sex, short> baseWeight;
	std::map<Sex, Dice> varHeight;
	std::map<Sex, Dice> varWeight;

	std::list<bstring> effects;
};

class DeityData {
protected:
	int id;
	bstring name;

public:
	DeityData(xmlNodePtr rootNode);

	std::map<int, PlayerTitle*> titles;

	int getId() const;
	bstring getName() const;
	bstring getTitle(int lvl, bool male, bool ignoreCustom=true) const;
};




class FishingItem {
public:
	FishingItem();
	void	load(xmlNodePtr rootNode);

	CatRef getFish() const;
	bool isDayOnly() const;
	bool isNightOnly() const;
	short getWeight() const;	// as in: probability
	short getMinQuality() const;
	short getMinSkill() const;
	long getExp() const;

	bool isMonster() const;
	bool willAggro() const;
protected:
	CatRef fish;
	bool dayOnly;
	bool nightOnly;
	short weight;	// as in: probability
	short minQuality;
	short minSkill;
	long exp;

	bool monster;
	bool aggro;
};

class Fishing {
public:
	Fishing();
	void	load(xmlNodePtr rootNode);
	const FishingItem* getItem(short skill, short quality) const;
	bool empty() const;
	bstring id;
	std::list<FishingItem> items;
};



#endif /*DATA_H_*/