/**************************************************************************** * [S]imulated [M]edieval [A]dventure multi[U]ser [G]ame | * * -----------------------------------------------------------| \\._.// * * SmaugWizard (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. * * ------------------------------------------------------------------------ * * Race Class Interface file * ****************************************************************************/ #ifndef RACES_H #define RACES_H #include "Affect.h" #include "Attack.h" #include "Defense.h" #define CurrentRaceFileVersion 1000 #define RACE_NONE -1 class CRaceData { public: CRaceData () { memset (this, 0, sizeof (CRaceData)); } CRaceData (const CRaceData& in) { *this = in; } ~CRaceData (); int GetCurrentVersion () { return CurrentRaceFileVersion; } BOOL Read (FILE* fp); void Write (); BOOL HasName () { if (! m_pName) return FALSE; return m_pName [0] != 0; } const char *GetName () const { return m_pName; } void SetName (const char* n) { STRFREE (m_pName); m_pName = STRALLOC (n); } int GetRace () { return m_Race; } void SetRace (int r) { m_Race = r; } BOOL IsVampire () { return ! stricmp (m_pName, "_Vampire_"); } BOOL IsClassRestricted (int cl) { return (m_ClassRestrict & (1 << cl)) != 0; } void SetClassRestrict (int cl) { m_ClassRestrict |= (1 << cl); } void ToggleClassRestrict (int cl) { m_ClassRestrict ^= (1 << cl); } void ShowRacialWearNames (CCharacter* ch); short GetAcPlus () { return m_AcPlus; } void SetAcPlus (short a) { m_AcPlus = a; } short GetAlignment () { return m_Alignment; } void SetAlignment (short a) { m_Alignment = a; } short GetMinAlign () { return m_Minalign; } void SetMinAlign (short a) { m_Minalign = a; } short GetMaxAlign () { return m_Maxalign; } void SetMaxAlign (short a) { m_Maxalign = a; } short GetExpMultiplier () { return m_ExpMultiplier; } void SetExpMultiplier (short m) { m_ExpMultiplier = m; } short GetHeight () { return m_Height; } void SetHeight (short h) { m_Height = h; } short GetWeight () { return m_Weight; } void SetWeight (short w) { m_Weight = w; } short GetHungerMod () { return m_HungerMod; } void SetHungerMod (short h) { m_HungerMod = h; } short GetThirstMod () { return m_ThirstMod; } void SetThirstMod (short t) { m_ThirstMod = t; } short GetSavingPoisonDeath () { return m_SavingPoisonDeath; } void SetSavingPoisonDeath (short s) { m_SavingPoisonDeath = s; } short GetSavingWand () { return m_SavingWand; } void SetSavingWand (short s) { m_SavingWand = s; } short GetSavingParaPetri () { return m_SavingParaPetri; } void SetSavingParaPetri (short s) { m_SavingParaPetri = s; } short GetSavingBreath () { return m_SavingBreath; } void SetSavingBreath (short s) { m_SavingBreath = s; } short GetSavingSpellstaff () { return m_SavingSpellstaff; } void SetSavingSpellstaff (short s) { m_SavingSpellstaff = s; } int GetRaceRecall () { return m_RaceRecall; } void SetRaceRecall (int i) { m_RaceRecall = i; } short GetManaRegen () { return m_ManaRegen; } void SetManaRegen (short s) { m_ManaRegen = s; } short GetHpRegen () { return m_HpRegen; } void SetHpRegen (short s) { m_HpRegen = s; } short GetShoveDragModifier () { return m_ShoveDrag; } void SetShoveDragModifier (short s) { m_ShoveDrag = s; } const char *GetWhereName (int w) const { return m_WhereName [w]; } void SetWhereName (int w, const char* n) { ASSERT (w < MAX_WEAR); delete m_WhereName [w]; m_WhereName [w] = str_dup (n); } const CAffectFlags& GetAffectFlags () { return m_Affects; } void SetAffectFlags (const CAffectFlags& f) { m_Affects = f; } const CAttackFlags& GetAttackFlags () { return m_Attacks; } void SetAttackFlags (CAttackFlags& f) { m_Attacks = f; } const CDefenseFlags& GetDefenseFlags () { return m_Defenses; } void SetDefenseFlags (CDefenseFlags& f) { m_Defenses = f; } BOOL CanSpeak (int la) { return m_Languages.IsSet (la); } void SetSpeaks (int la) { m_Languages.SetBit (la); } void ToggleSpeaks (int la) { m_Languages.ToggleBit (la); } const CBitVector& GetLanguages () { return m_Languages; } const CRaceData& operator= (const CRaceData& in); friend class CRaceTable; protected: int m_Race; char *m_pName; // Race name CAffectFlags m_Affects; // Default affect bitvectors CAttackFlags m_Attacks; CDefenseFlags m_Defenses; short m_AcPlus; short m_Alignment; short m_Minalign; short m_Maxalign; short m_ExpMultiplier; short m_Height; short m_Weight; short m_HungerMod; short m_ThirstMod; short m_SavingPoisonDeath; short m_SavingWand; short m_SavingParaPetri; short m_SavingBreath; short m_SavingSpellstaff; char *m_WhereName [MAX_WEAR]; short m_ManaRegen; short m_HpRegen; int m_RaceRecall; short m_ShoveDrag; CBitVector m_Languages; // Default racial languages public: short str_plus; // Str bonus/penalty short dex_plus; // Dex " short wis_plus; // Wis " short int_plus; // Int " short con_plus; // Con " short cha_plus; // Cha " short lck_plus; // Lck " short hit; short mana; int resist; int suscept; int m_ClassRestrict; // Classes not used by this race }; enum NpcRaces { NPR_HUMAN, NPR_ELF, NPR_DWARF, NPR_HALFLING, NPR_PIXIE, NPR_VAMPIRE, NPR_HALFOGRE, NPR_HALFORC, NPR_HALFTROLL, NPR_HALFELF, NPR_GITH, NPR_DROW, NPR_SEAELF, NPR_LIZARDMAN, NPR_GNOME, NPR_R5, NPR_R6, NPR_R7, NPR_R8, NPR_TROLL, NPR_ANT, NPR_APE, NPR_BABOON, NPR_BAT, NPR_BEAR, NPR_BEE, NPR_BEETLE, NPR_BOAR, NPR_BUGBEAR, NPR_CAT, NPR_DOG, NPR_DRAGON, NPR_FERRET, NPR_FLY, NPR_GARGOYLE, NPR_GELATIN, NPR_GHOUL, NPR_GNOLL, NPR_GNOME2, NPR_GOBLIN, NPR_GOLEM, NPR_GORGON, NPR_HARPY, NPR_HOBGOBLIN, NPR_KOBOLD, NPR_LIZARDMAN2, NPR_LOCUST, NPR_LYCANTHROPE, NPR_MINOTAUR, NPR_MOLD, NPR_MULE, NPR_NEANDERTHAL, NPR_OOZE, NPR_ORC, NPR_RAT, NPR_RUSTMONSTER, NPR_SHADOW, NPR_SHAPESHIFTER, NPR_SHREW, NPR_SHRIEKER, NPR_SKELETON, NPR_SLIME, NPR_SNAKE, NPR_SPIDER, NPR_STIRGE, NPR_THOUL, NPR_TROGLODYTE, NPR_UNDEAD, NPR_WIGHT, NPR_WOLF, NPR_WORM, NPR_ZOMBIE, NPR_BOVINE, NPR_CANINE, NPR_FELINE, NPR_PORCINE, NPR_MAMMAL, NPR_RODENT, NPR_AVIS, NPR_REPTILE, NPR_AMPHIBIAN, NPR_FISH, NPR_CRUSTACEAN, NPR_INSECT, NPR_SPIRIT, NPR_MAGICAL, NPR_HORSE, NPR_ANIMAL, NPR_HUMANOID, NPR_MONSTER, NPR_GOD, MAX_NPC_RACE }; #ifdef SMAUGSERVER_CPP const char *NpcRaceNames [MAX_NPC_RACE] = { "human", "elf", "dwarf", "halfling", "pixie", "vampire", "half-ogre", "half-orc", "half-troll", "half-elf", "gith", "drow", "sea-elf", "lizardman", "gnome", "r5", "r6", "r7", "r8", "troll", "ant", "ape", "baboon", "bat", "bear", "bee", "beetle", "boar", "bugbear", "cat", "dog", "dragon", "ferret", "fly", "gargoyle", "gelatin", "ghoul", "gnoll", "gnome", "goblin", "golem", "gorgon", "harpy", "hobgoblin", "kobold", "lizardman", "locust", "lycanthrope", "minotaur", "mold", "mule", "neanderthal", "ooze", "orc", "rat", "rustmonster", "shadow", "shapeshifter", "shrew", "shrieker", "skeleton", "slime", "snake", "spider", "stirge", "thoul", "troglodyte", "undead", "wight", "wolf", "worm", "zombie", "bovine", "canine", "feline", "porcine", "mammal", "rodent", "avis", "reptile", "amphibian", "fish", "crustacean", "insect", "spirit", "magical", "horse", "animal", "humanoid", "monster", "god" }; #endif extern const char *NpcRaceNames [MAX_NPC_RACE]; #define GRD GetRaceData(r) class CRaceTable : public CPtrList { public: void Load (); void Save (); bool WriteList (); BOOL IsValidRace (int r) { return r >= 0 && r < GetCount (); } void Add (CRaceData* pRa) { AddTail (pRa); } BOOL LoadRaceFile (const char *fname); int GetRace (const char* name); CRaceData *GetNext (POSITION& pos) { return (CRaceData*) CPtrList::GetNext (pos); } CRaceData *GetRaceData (int r) { if (r < 0 || r > GetCount ()) return &m_NullRace; return (CRaceData*) GetAt (FindIndex (r)); } BOOL CanSpeak (int r, int la) { return GRD->CanSpeak (la); } char *GetName (int r) { return GRD->m_pName; } void ListRaces (CCharacter* ch); BOOL IsAffected (int r, int bit) { return bit < 0 ? FALSE : GRD->m_Affects.IsSet (bit); } BOOL HasName (int r) { return GRD->HasName (); } BOOL IsClassRestricted (int r, int bit) { return bit < 0 ? FALSE : GRD->IsClassRestricted (bit); } int GetHp (int r) { return GRD->hit; } int GetHpRegen (int r) { return GRD->GetHpRegen (); } int GetMana (int r) { return GRD->mana; } int GetManaRegen (int r) { return GRD->GetManaRegen (); } BOOL IsVampire (int r) { return ! stricmp (GRD->m_pName, "_Vampire_"); } short GetHungerMod (int r) { return GRD->m_HungerMod; } short GetRaceRecall (int r) { return GRD->m_RaceRecall; } short GetShoveDragModifier (int r) { return GRD->m_ShoveDrag; } const char *GetWhereName (int r, int w) { return GRD->GetWhereName (w); } CRaceData *Find (const char* prefix); CRaceData *RemoveTail () { return (CRaceData*) CPtrList::RemoveTail (); } void RemoveAll (); NpcRaces GetNpcRace (const char* name); const char* GetNpcRaceName (int r) { if (r >= 0 || r < MAX_NPC_RACE) return NpcRaceNames [r]; else return "none"; } const CAffectFlags& GetAffects (int r) { return GRD->m_Affects; } const CBitVector& GetLanguages (int r) { return GRD->m_Languages; } CRaceData m_NullRace; }; #ifdef SMAUGSERVER_CPP CRaceTable RaceTable; #endif extern CRaceTable RaceTable; extern void CreateRace (CCharacter* ch, CString Name, CString CopyRace); #endif