2012-09-23 22:11:08 +04:00
# ifndef OPENMW_ESM_NPC_H
# define OPENMW_ESM_NPC_H
2010-02-25 19:01:24 +01:00
2012-09-17 11:37:50 +04:00
# include <string>
# include <vector>
2010-02-25 19:01:24 +01:00
# include "defs.hpp"
# include "loadcont.hpp"
2012-08-29 21:35:06 +04:00
# include "aipackage.hpp"
2012-09-17 11:37:50 +04:00
# include "spelllist.hpp"
2013-12-08 21:47:43 +01:00
# include "loadskil.hpp"
2010-02-25 19:01:24 +01:00
namespace ESM {
2012-10-01 00:51:54 +04:00
class ESMReader ;
class ESMWriter ;
2010-02-25 19:01:24 +01:00
/*
* NPC definition
*/
2012-09-30 23:34:53 +04:00
struct NPC
2010-02-25 19:01:24 +01:00
{
2013-09-24 13:17:28 +02:00
static unsigned int sRecordId ;
2010-02-25 19:01:24 +01:00
// Services
enum Services
{
// This merchant buys:
2011-01-05 22:18:21 +01:00
Weapon = 0x00001 ,
2012-08-29 21:35:06 +04:00
Armor = 0x00002 ,
2011-01-05 22:18:21 +01:00
Clothing = 0x00004 ,
2012-08-29 21:35:06 +04:00
Books = 0x00008 ,
2011-01-05 22:18:21 +01:00
Ingredients = 0x00010 ,
2012-08-29 21:35:06 +04:00
Picks = 0x00020 ,
2011-01-05 22:18:21 +01:00
Probes = 0x00040 ,
Lights = 0x00080 ,
Apparatus = 0x00100 ,
RepairItem = 0x00200 ,
2012-08-29 21:35:06 +04:00
Misc = 0x00400 ,
2013-04-07 21:38:53 +02:00
Potions = 0x02000 ,
2010-02-25 19:01:24 +01:00
// Other services
2011-01-05 22:18:21 +01:00
Spells = 0x00800 ,
MagicItems = 0x01000 ,
Training = 0x04000 , // What skills?
Spellmaking = 0x08000 ,
Enchanting = 0x10000 ,
Repair = 0x20000
2010-02-25 19:01:24 +01:00
} ;
enum Flags
{
2011-01-05 22:18:21 +01:00
Female = 0x0001 ,
2010-02-25 19:01:24 +01:00
Essential = 0x0002 ,
2011-01-05 22:18:21 +01:00
Respawn = 0x0004 ,
Autocalc = 0x0008 ,
Skeleton = 0x0400 , // Skeleton blood effect (white)
2012-08-29 21:35:06 +04:00
Metal = 0x0800 // Metal blood effect (golden?)
2010-02-25 19:01:24 +01:00
} ;
2013-12-08 21:47:43 +01:00
enum NpcType
{
NPC_WITH_AUTOCALCULATED_STATS = 12 ,
NPC_DEFAULT = 52
} ;
2012-09-17 11:37:50 +04:00
# pragma pack(push)
# pragma pack(1)
struct NPDTstruct52
{
short mLevel ;
2013-05-16 21:45:49 +02:00
unsigned char mStrength ,
2012-09-17 11:37:50 +04:00
mIntelligence ,
mWillpower ,
mAgility ,
mSpeed ,
mEndurance ,
mPersonality ,
mLuck ;
2013-12-08 21:47:43 +01:00
char mSkills [ Skill : : Length ] ;
2014-09-03 14:40:32 +02:00
// at opencs/model/tools/referenceablecheck.cpp:679 is assumed that negative reputation values are invalid, can we assume we won't find any negative value?
unsigned char mReputation ;
2014-05-29 17:54:45 +02:00
unsigned short mHealth , mMana , mFatigue ;
2014-09-03 14:40:32 +02:00
signed char mDisposition , mFactionID , mRank ;
2012-09-17 11:37:50 +04:00
char mUnknown ;
int mGold ;
} ; // 52 bytes
struct NPDTstruct12
{
short mLevel ;
2014-09-03 14:40:32 +02:00
unsigned char mReputation ; // see NPTDstruct52.mReputation
signed char mDisposition , mRank ;
2012-09-17 11:37:50 +04:00
char mUnknown1 , mUnknown2 , mUnknown3 ;
int mGold ; // ?? not certain
} ; // 12 bytes
2010-02-25 19:01:24 +01:00
2012-08-29 14:01:10 +04:00
struct Dest
{
2012-08-29 21:35:06 +04:00
Position mPos ;
std : : string mCellName ;
2012-08-29 14:01:10 +04:00
} ;
2012-09-17 11:37:50 +04:00
# pragma pack(pop)
2012-08-29 14:01:10 +04:00
2014-09-03 14:40:32 +02:00
unsigned char mNpdtType ;
2012-09-17 11:37:50 +04:00
NPDTstruct52 mNpdt52 ;
2013-12-27 22:13:55 +01:00
NPDTstruct12 mNpdt12 ; //for autocalculated characters
2010-02-25 19:01:24 +01:00
2012-09-17 11:37:50 +04:00
int mFlags ;
2010-02-25 19:01:24 +01:00
2013-05-16 18:50:26 +02:00
bool mPersistent ;
2012-09-17 11:37:50 +04:00
InventoryList mInventory ;
SpellList mSpells ;
2010-02-25 19:01:24 +01:00
2012-08-29 21:35:06 +04:00
AIData mAiData ;
bool mHasAI ;
2010-02-25 19:01:24 +01:00
2012-08-29 21:35:06 +04:00
std : : vector < Dest > mTransport ;
AIPackageList mAiPackage ;
2012-08-29 14:01:10 +04:00
2012-09-30 23:34:53 +04:00
std : : string mId , mName , mModel , mRace , mClass , mFaction , mScript ;
2012-08-29 21:35:06 +04:00
// body parts
2012-09-17 11:37:50 +04:00
std : : string mHair , mHead ;
2010-08-08 14:09:09 +02:00
2012-09-17 11:37:50 +04:00
void load ( ESMReader & esm ) ;
2013-09-16 12:32:35 +02:00
void save ( ESMWriter & esm ) const ;
2012-11-08 13:46:24 +04:00
2013-05-06 14:10:43 +02:00
bool isMale ( ) const ;
2012-11-10 11:41:12 +04:00
2013-05-06 14:10:43 +02:00
void setIsMale ( bool value ) ;
void blank ( ) ;
///< Set record to default state (does not touch the ID).
2010-02-25 19:01:24 +01:00
} ;
}
# endif