OpenMW
components/esm/loadcrea.hpp
Go to the documentation of this file.
00001 #ifndef OPENMW_ESM_CREA_H
00002 #define OPENMW_ESM_CREA_H
00003 
00004 #include <string>
00005 
00006 #include "loadcont.hpp"
00007 #include "spelllist.hpp"
00008 #include "aipackage.hpp"
00009 
00010 namespace ESM
00011 {
00012 
00013 class ESMReader;
00014 class ESMWriter;
00015 
00016 /*
00017  * Creature definition
00018  *
00019  */
00020 
00021 struct Creature
00022 {
00023     static unsigned int sRecordId;
00024 
00025     // Default is 0x48?
00026     enum Flags
00027     {
00028         Biped       = 0x001,
00029         Respawn     = 0x002,
00030         Weapon      = 0x004, // Has weapon and shield
00031         None        = 0x008, // ??
00032         Swims       = 0x010,
00033         Flies       = 0x020, // Don't know what happens if several
00034         Walks       = 0x040, // of these are set
00035         Essential   = 0x080,
00036         Skeleton    = 0x400, // Does not have normal blood
00037         Metal       = 0x800  // Has 'golden' blood
00038     };
00039 
00040     enum Type
00041     {
00042         Creatures = 0,
00043         Deadra  = 1,
00044         Undead = 2,
00045         Humanoid = 3
00046     };
00047 
00048     struct NPDTstruct
00049     {
00050         int mType;
00051         // For creatures we obviously have to use ints, not shorts and
00052         // bytes like we use for NPCs.... this file format just makes so
00053         // much sense! (Still, _much_ easier to decode than the NIFs.)
00054         int mLevel;
00055         int mStrength,
00056             mIntelligence,
00057             mWillpower,
00058             mAgility,
00059             mSpeed,
00060             mEndurance,
00061             mPersonality,
00062             mLuck;
00063 
00064         int mHealth, mMana, mFatigue; // Stats
00065         int mSoul; // The creatures soul value (used with soul gems.)
00066         int mCombat, mMagic, mStealth; // Don't know yet.
00067         int mAttack[6]; // AttackMin1, AttackMax1, ditto2, ditto3
00068         int mGold;
00069     }; // 96 bytes
00070 
00071     NPDTstruct mData;
00072 
00073     int mFlags;
00074 
00075     bool mPersistent;
00076 
00077     float mScale;
00078 
00079     std::string mId, mModel, mName, mScript;
00080     std::string mOriginal; // Base creature that this is a modification of
00081 
00082     InventoryList mInventory;
00083     SpellList mSpells;
00084 
00085 
00086     bool mHasAI;
00087     AIData mAiData;
00088     AIPackageList mAiPackage;
00089 
00090     void load(ESMReader &esm);
00091     void save(ESMWriter &esm) const;
00092 
00093     void blank();
00095 };
00096 
00097 }
00098 #endif