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"
|
2015-03-08 20:44:41 +01:00
|
|
|
#include "transport.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;
|
2015-06-14 02:31:00 +02:00
|
|
|
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
|
|
|
static std::string getRecordType() { return "NPC"; }
|
2013-09-24 13:17:28 +02:00
|
|
|
|
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
|
|
|
|
2017-09-25 19:52:20 +02:00
|
|
|
AllItems = Weapon|Armor|Clothing|Books|Ingredients|Picks|Probes|Lights|Apparatus|RepairItem|Misc|Potions,
|
|
|
|
|
2010-02-25 19:01:24 +01:00
|
|
|
// Other services
|
2011-01-05 22:18:21 +01:00
|
|
|
Spells = 0x00800,
|
|
|
|
MagicItems = 0x01000,
|
2017-09-25 17:47:30 +02:00
|
|
|
Training = 0x04000,
|
2011-01-05 22:18:21 +01:00
|
|
|
Spellmaking = 0x08000,
|
|
|
|
Enchanting = 0x10000,
|
|
|
|
Repair = 0x20000
|
2010-02-25 19:01:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum Flags
|
|
|
|
{
|
2018-12-31 17:55:46 +03:00
|
|
|
Female = 0x01,
|
|
|
|
Essential = 0x02,
|
|
|
|
Respawn = 0x04,
|
|
|
|
Base = 0x08,
|
|
|
|
Autocalc = 0x10
|
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;
|
|
|
|
|
2014-09-06 17:04:50 +02:00
|
|
|
// mSkill can grow up to 200, it must be unsigned
|
2014-09-04 13:23:29 +02:00
|
|
|
unsigned char mSkills[Skill::Length];
|
2014-09-03 14:40:32 +02:00
|
|
|
|
2019-12-18 18:42:54 +01:00
|
|
|
char mUnknown1;
|
2014-05-29 17:54:45 +02:00
|
|
|
unsigned short mHealth, mMana, mFatigue;
|
2018-09-03 16:30:21 +03:00
|
|
|
unsigned char mDisposition, mReputation, mRank;
|
2019-12-18 18:42:54 +01:00
|
|
|
char mUnknown2;
|
2012-09-17 11:37:50 +04:00
|
|
|
int mGold;
|
|
|
|
}; // 52 bytes
|
|
|
|
|
2018-05-09 00:25:07 +02:00
|
|
|
//Structure for autocalculated characters.
|
|
|
|
// This is only used for load and save operations.
|
2012-09-17 11:37:50 +04:00
|
|
|
struct NPDTstruct12
|
|
|
|
{
|
|
|
|
short mLevel;
|
2014-09-06 15:16:04 +02:00
|
|
|
// see above
|
2018-09-03 16:30:21 +03:00
|
|
|
unsigned char mDisposition, mReputation, mRank;
|
2012-09-17 11:37:50 +04:00
|
|
|
char mUnknown1, mUnknown2, mUnknown3;
|
2014-09-06 15:16:04 +02:00
|
|
|
int mGold;
|
2012-09-17 11:37:50 +04:00
|
|
|
}; // 12 bytes
|
|
|
|
#pragma pack(pop)
|
2012-08-29 14:01:10 +04:00
|
|
|
|
2014-09-03 14:40:32 +02:00
|
|
|
unsigned char mNpdtType;
|
2018-05-09 00:25:07 +02:00
|
|
|
//Worth noting when saving the struct:
|
|
|
|
// Although we might read a NPDTstruct12 in, we use NPDTstruct52 internally
|
|
|
|
NPDTstruct52 mNpdt;
|
2010-02-25 19:01:24 +01:00
|
|
|
|
2015-01-27 17:32:21 +01:00
|
|
|
int getFactionRank() const; /// wrapper for mNpdt*, -1 = no rank
|
|
|
|
|
2018-12-31 17:55:46 +03:00
|
|
|
int mBloodType;
|
|
|
|
unsigned char mFlags;
|
2010-02-25 19:01:24 +01:00
|
|
|
|
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;
|
2010-02-25 19:01:24 +01:00
|
|
|
|
2015-03-08 20:44:41 +01:00
|
|
|
Transport mTransport;
|
|
|
|
|
|
|
|
const std::vector<Transport::Dest>& getTransport() const;
|
|
|
|
|
2012-08-29 21:35:06 +04:00
|
|
|
AIPackageList mAiPackage;
|
2012-08-29 14:01:10 +04:00
|
|
|
|
2021-06-29 23:25:26 +10:00
|
|
|
unsigned int mRecordFlags;
|
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
|
|
|
|
2015-07-20 17:23:14 +03:00
|
|
|
void load(ESMReader &esm, bool &isDeleted);
|
|
|
|
void save(ESMWriter &esm, bool isDeleted = false) 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).
|
2018-05-09 00:25:07 +02:00
|
|
|
|
|
|
|
/// Resets the mNpdt object
|
|
|
|
void blankNpdt();
|
2010-02-25 19:01:24 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|