OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
loadnpc.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_ESM_NPC_H
2 #define OPENMW_ESM_NPC_H
3 
4 #include <string>
5 #include <vector>
6 
7 #include "defs.hpp"
8 #include "loadcont.hpp"
9 #include "aipackage.hpp"
10 #include "spelllist.hpp"
11 #include "loadskil.hpp"
12 #include "transport.hpp"
13 
14 namespace ESM {
15 
16 class ESMReader;
17 class ESMWriter;
18 
19 /*
20  * NPC definition
21  */
22 
23 struct NPC
24 {
25  static unsigned int sRecordId;
27  static std::string getRecordType() { return "NPC"; }
28 
29  // Services
30  enum Services
31  {
32  // This merchant buys:
33  Weapon = 0x00001,
34  Armor = 0x00002,
35  Clothing = 0x00004,
36  Books = 0x00008,
37  Ingredients = 0x00010,
38  Picks = 0x00020,
39  Probes = 0x00040,
40  Lights = 0x00080,
41  Apparatus = 0x00100,
42  RepairItem = 0x00200,
43  Misc = 0x00400,
44  Potions = 0x02000,
45 
46  // Other services
47  Spells = 0x00800,
48  MagicItems = 0x01000,
49  Training = 0x04000, // What skills?
50  Spellmaking = 0x08000,
51  Enchanting = 0x10000,
52  Repair = 0x20000
53  };
54 
55  enum Flags
56  {
57  Female = 0x0001,
58  Essential = 0x0002,
59  Respawn = 0x0004,
60  Autocalc = 0x0010,
61  Skeleton = 0x0400, // Skeleton blood effect (white)
62  Metal = 0x0800 // Metal blood effect (golden?)
63  };
64 
65  enum NpcType
66  {
69  };
70 
71  #pragma pack(push)
72  #pragma pack(1)
73 
74  struct NPDTstruct52
75  {
76  short mLevel;
77  unsigned char mStrength,
79  mWillpower,
80  mAgility,
81  mSpeed,
82  mEndurance,
84  mLuck;
85 
86  // mSkill can grow up to 200, it must be unsigned
87  unsigned char mSkills[Skill::Length];
88 
89  char mFactionID;
90  unsigned short mHealth, mMana, mFatigue;
92  char mUnknown;
93  int mGold;
94  }; // 52 bytes
95 
96  struct NPDTstruct12
97  {
98  short mLevel;
99  // see above
102  int mGold;
103  }; // 12 bytes
104  #pragma pack(pop)
105 
106  unsigned char mNpdtType;
108  NPDTstruct12 mNpdt12; //for autocalculated characters
109 
110  int getFactionRank() const;
111 
112  int mFlags;
113 
115 
118 
120  bool mHasAI;
121 
123 
124  const std::vector<Transport::Dest>& getTransport() const;
125 
127 
129 
130  // body parts
131  std::string mHair, mHead;
132 
133  void load(ESMReader &esm, bool &isDeleted);
134  void save(ESMWriter &esm, bool isDeleted = false) const;
135 
136  bool isMale() const;
137 
138  void setIsMale(bool value);
139 
140  void blank();
142 };
143 }
144 #endif
unsigned short mMana
Definition: loadnpc.hpp:90
unsigned char mStrength
Definition: loadnpc.hpp:77
Definition: loadnpc.hpp:58
Definition: loadnpc.hpp:68
signed char mRank
Definition: loadnpc.hpp:91
Definition: aipackage.hpp:90
Definition: loadnpc.hpp:36
void blank()
Set record to default state (does not touch the ID).
Definition: loadnpc.cpp:171
AIPackageList mAiPackage
Definition: loadnpc.hpp:126
Definition: aipackage.hpp:17
unsigned short mFatigue
Definition: loadnpc.hpp:90
char mUnknown1
Definition: loadnpc.hpp:101
Definition: loadnpc.hpp:96
Definition: esmreader.hpp:21
Definition: loadarmo.hpp:66
Definition: loadnpc.hpp:62
unsigned char mSkills[Skill::Length]
Definition: loadnpc.hpp:87
char mUnknown3
Definition: loadnpc.hpp:101
Definition: loadnpc.hpp:37
signed char mDisposition
Definition: loadnpc.hpp:100
signed char mDisposition
Definition: loadnpc.hpp:91
Transport mTransport
Definition: loadnpc.hpp:122
InventoryList, NPCO subrecord.
Definition: loadcont.hpp:26
Definition: loadskil.hpp:74
const std::vector< Transport::Dest > & getTransport() const
Definition: loadnpc.cpp:220
Definition: loadnpc.hpp:42
unsigned char mWillpower
Definition: loadnpc.hpp:77
Definition: loadnpc.hpp:61
signed char mReputation
Definition: loadnpc.hpp:91
int mFlags
wrapper for mNpdt*, -1 = no rank
Definition: loadnpc.hpp:112
List of travel service destination. Shared by CREA and NPC_ records.
Definition: transport.hpp:16
int getFactionRank() const
Definition: loadnpc.cpp:210
SpellList mSpells
Definition: loadnpc.hpp:117
InventoryList mInventory
Definition: loadnpc.hpp:116
Definition: loadnpc.hpp:60
Definition: loadnpc.hpp:50
NPDTstruct12 mNpdt12
Definition: loadnpc.hpp:108
Services
Definition: loadnpc.hpp:30
Definition: loadnpc.hpp:40
Definition: loadnpc.hpp:57
std::string mClass
Definition: loadnpc.hpp:128
bool isMale() const
Definition: loadnpc.cpp:160
Definition: esmwriter.hpp:17
std::string mScript
Definition: loadnpc.hpp:128
Definition: loadappa.hpp:16
NpcType
Definition: loadnpc.hpp:65
Definition: loadnpc.hpp:67
void setIsMale(bool value)
Definition: loadnpc.cpp:164
Definition: loadnpc.hpp:39
Definition: loadnpc.hpp:48
void load(ESMReader &esm, bool &isDeleted)
Definition: loadnpc.cpp:11
char mUnknown2
Definition: loadnpc.hpp:101
unsigned char mAgility
Definition: loadnpc.hpp:77
Definition: loadnpc.hpp:23
std::string mModel
Definition: loadnpc.hpp:128
std::string mId
Definition: loadnpc.hpp:128
int mGold
Definition: loadnpc.hpp:93
Definition: spelllist.hpp:16
Definition: loadnpc.hpp:43
std::string mHead
Definition: loadnpc.hpp:131
char mUnknown
Definition: loadnpc.hpp:92
std::string mFaction
Definition: loadnpc.hpp:128
signed char mReputation
Definition: loadnpc.hpp:100
AIData mAiData
Definition: loadnpc.hpp:119
unsigned char mPersonality
Definition: loadnpc.hpp:77
int mGold
Definition: loadnpc.hpp:102
unsigned char mLuck
Definition: loadnpc.hpp:77
Definition: loadclot.hpp:18
char mFactionID
Definition: loadnpc.hpp:89
static std::string getRecordType()
Return a string descriptor for this record type. Currently used for debugging / error logs only...
Definition: loadnpc.hpp:27
std::string mRace
Definition: loadnpc.hpp:128
Definition: loadnpc.hpp:49
void save(ESMWriter &esm, bool isDeleted=false) const
Definition: loadnpc.cpp:118
Definition: loadnpc.hpp:59
unsigned char mSpeed
Definition: loadnpc.hpp:77
Definition: loadnpc.hpp:44
unsigned char mNpdtType
Definition: loadnpc.hpp:106
unsigned short mHealth
Definition: loadnpc.hpp:90
Flags
Definition: loadnpc.hpp:55
signed char mRank
Definition: loadnpc.hpp:100
Definition: loadnpc.hpp:47
std::string mName
Definition: loadnpc.hpp:128
unsigned char mIntelligence
Definition: loadnpc.hpp:77
Definition: loadnpc.hpp:51
Definition: loadnpc.hpp:74
bool mPersistent
Definition: loadnpc.hpp:114
std::string mHair
Definition: loadnpc.hpp:131
NPDTstruct52 mNpdt52
Definition: loadnpc.hpp:107
static unsigned int sRecordId
Definition: loadnpc.hpp:25
unsigned char mEndurance
Definition: loadnpc.hpp:77
short mLevel
Definition: loadnpc.hpp:98
bool mHasAI
Definition: loadnpc.hpp:120
Definition: loadnpc.hpp:38
short mLevel
Definition: loadnpc.hpp:76
Definition: loadweap.hpp:16
Definition: loadrepa.hpp:12