OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
npc.hpp
Go to the documentation of this file.
1 #ifndef GAME_MWCLASS_NPC_H
2 #define GAME_MWCLASS_NPC_H
3 
4 #include "actor.hpp"
5 
6 namespace ESM
7 {
8  struct GameSetting;
9 }
10 
11 namespace MWClass
12 {
13  class Npc : public Actor
14  {
15  void ensureCustomData (const MWWorld::Ptr& ptr) const;
16 
17  virtual MWWorld::Ptr copyToCellImpl(const MWWorld::ConstPtr &ptr, MWWorld::CellStore &cell) const;
18 
19  struct GMST
20  {
41  };
42 
43  static const GMST& getGmst();
44 
45  public:
46 
47  virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
49 
50  virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
53 
54  virtual MWMechanics::CreatureStats& getCreatureStats (const MWWorld::Ptr& ptr) const;
56 
57  virtual MWMechanics::NpcStats& getNpcStats (const MWWorld::Ptr& ptr) const;
59 
60  virtual MWWorld::ContainerStore& getContainerStore (const MWWorld::Ptr& ptr) const;
62 
63  virtual bool hasToolTip(const MWWorld::ConstPtr& ptr) const;
65 
66  virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
68 
69  virtual MWWorld::InventoryStore& getInventoryStore (const MWWorld::Ptr& ptr) const;
71 
72  virtual bool hasInventoryStore(const MWWorld::Ptr &ptr) const { return true; }
73 
74  virtual void hit(const MWWorld::Ptr& ptr, float attackStrength, int type) const;
75 
76  virtual void onHit(const MWWorld::Ptr &ptr, float damage, bool ishealth, const MWWorld::Ptr &object, const MWWorld::Ptr &attacker, const osg::Vec3f &hitPosition, bool successful) const;
77 
78  virtual void getModelsToPreload(const MWWorld::Ptr& ptr, std::vector<std::string>& models) const;
80 
81  virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
82  const MWWorld::Ptr& actor) const;
84 
85  virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
87 
88  virtual float getSpeed (const MWWorld::Ptr& ptr) const;
90 
91  virtual float getJump(const MWWorld::Ptr &ptr) const;
93 
94  virtual MWMechanics::Movement& getMovementSettings (const MWWorld::Ptr& ptr) const;
96 
97  virtual float getCapacity (const MWWorld::Ptr& ptr) const;
100 
101  virtual float getEncumbrance (const MWWorld::Ptr& ptr) const;
104 
105  virtual float getArmorRating (const MWWorld::Ptr& ptr) const;
107 
108  virtual bool apply (const MWWorld::Ptr& ptr, const std::string& id,
109  const MWWorld::Ptr& actor) const;
113 
114  virtual void adjustScale (const MWWorld::ConstPtr &ptr, osg::Vec3f &scale, bool rendering) const;
116 
117  virtual void skillUsageSucceeded (const MWWorld::Ptr& ptr, int skill, int usageType, float extraFactor=1.f) const;
119 
120  virtual bool isEssential (const MWWorld::ConstPtr& ptr) const;
122 
123  virtual int getServices (const MWWorld::ConstPtr& actor) const;
124 
125  virtual bool isPersistent (const MWWorld::ConstPtr& ptr) const;
126 
127  virtual std::string getSoundIdFromSndGen(const MWWorld::Ptr &ptr, const std::string &name) const;
128 
129  static void registerSelf();
130 
131  virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
132 
133  virtual int getSkill(const MWWorld::Ptr& ptr, int skill) const;
134 
136  virtual int getBloodTexture (const MWWorld::ConstPtr& ptr) const;
137 
138  virtual bool isNpc() const {
139  return true;
140  }
141 
142  virtual void readAdditionalState (const MWWorld::Ptr& ptr, const ESM::ObjectState& state)
143  const;
145 
146  virtual void writeAdditionalState (const MWWorld::ConstPtr& ptr, ESM::ObjectState& state)
147  const;
149 
150  virtual int getBaseGold(const MWWorld::ConstPtr& ptr) const;
151 
152  virtual bool isClass(const MWWorld::ConstPtr& ptr, const std::string &className) const;
153 
154  virtual bool canSwim (const MWWorld::ConstPtr &ptr) const;
155 
156  virtual bool canWalk (const MWWorld::ConstPtr &ptr) const;
157 
158  virtual bool isBipedal (const MWWorld::ConstPtr &ptr) const;
159 
160  virtual void respawn (const MWWorld::Ptr& ptr) const;
161 
162  virtual void restock (const MWWorld::Ptr& ptr) const;
163 
164  virtual int getBaseFightRating (const MWWorld::ConstPtr& ptr) const;
165 
166  virtual std::string getPrimaryFaction(const MWWorld::ConstPtr &ptr) const;
167  virtual int getPrimaryFactionRank(const MWWorld::ConstPtr &ptr) const;
168  };
169 }
170 
171 #endif
Definition: tooltips.hpp:18
virtual std::string getName(const MWWorld::ConstPtr &ptr) const
Definition: npc.cpp:520
const ESM::GameSetting * fBaseRunMultiplier
Definition: npc.hpp:26
virtual bool hasToolTip(const MWWorld::ConstPtr &ptr) const
Definition: npc.cpp:992
Definition: npc.hpp:13
virtual MWWorld::ContainerStore & getContainerStore(const MWWorld::Ptr &ptr) const
Return container store.
Definition: npc.cpp:855
virtual float getEncumbrance(const MWWorld::Ptr &ptr) const
Definition: npc.cpp:1029
const ESM::GameSetting * fMinWalkSpeed
Definition: npc.hpp:21
virtual int getBloodTexture(const MWWorld::ConstPtr &ptr) const
Get a blood texture suitable for ptr (see Blood Texture 0-2 in Morrowind.ini)
Definition: npc.cpp:1214
const ESM::GameSetting * fJumpAcrobaticsBase
Definition: npc.hpp:33
virtual void adjustScale(const MWWorld::ConstPtr &ptr, osg::Vec3f &scale, bool rendering) const
Definition: npc.cpp:1099
virtual bool isPersistent(const MWWorld::ConstPtr &ptr) const
Definition: npc.cpp:417
Common creature stats.
Definition: creaturestats.hpp:25
virtual int getBaseGold(const MWWorld::ConstPtr &ptr) const
Definition: npc.cpp:1270
virtual bool canWalk(const MWWorld::ConstPtr &ptr) const
Definition: npc.cpp:1289
Definition: inventorystore.hpp:40
virtual void respawn(const MWWorld::Ptr &ptr) const
Definition: npc.cpp:1294
Class holding functionality common to Creature and NPC.
Definition: actor.hpp:14
Definition: renderinginterface.hpp:9
const ESM::GameSetting * fMaxWalkSpeed
Definition: npc.hpp:22
const ESM::GameSetting * fCombatArmorMinMult
Definition: npc.hpp:40
Definition: loadgmst.hpp:19
static const GMST & getGmst()
Definition: npc.cpp:267
virtual float getArmorRating(const MWWorld::Ptr &ptr) const
Definition: npc.cpp:1060
const ESM::GameSetting * iKnockDownOddsMult
Definition: npc.hpp:38
static void registerSelf()
Definition: npc.cpp:986
virtual void readAdditionalState(const MWWorld::Ptr &ptr, const ESM::ObjectState &state) const
Read additional state from state into ptr.
Definition: npc.cpp:1225
virtual int getSkill(const MWWorld::Ptr &ptr, int skill) const
Definition: npc.cpp:1209
virtual float getCapacity(const MWWorld::Ptr &ptr) const
Definition: npc.cpp:1022
virtual bool isClass(const MWWorld::ConstPtr &ptr, const std::string &className) const
Definition: npc.cpp:1279
virtual boost::shared_ptr< MWWorld::Action > activate(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor) const
Generate action for activation.
Definition: npc.cpp:823
virtual MWMechanics::Movement & getMovementSettings(const MWWorld::Ptr &ptr) const
Return desired movement.
Definition: npc.cpp:972
virtual MWMechanics::NpcStats & getNpcStats(const MWWorld::Ptr &ptr) const
Return NPC stats.
Definition: npc.cpp:541
const ESM::GameSetting * fJumpAcroMultiplier
Definition: npc.hpp:34
virtual void writeAdditionalState(const MWWorld::ConstPtr &ptr, ESM::ObjectState &state) const
Write additional state from ptr into state.
Definition: npc.cpp:1252
const ESM::GameSetting * fJumpRunMultiplier
Definition: npc.hpp:35
virtual float getJump(const MWWorld::Ptr &ptr) const
Return jump velocity (not accounting for movement)
Definition: npc.cpp:937
virtual void skillUsageSucceeded(const MWWorld::Ptr &ptr, int skill, int usageType, float extraFactor=1.f) const
Inform actor ptr that a skill use has succeeded.
Definition: npc.cpp:1043
virtual std::string getScript(const MWWorld::ConstPtr &ptr) const
Return name of the script attached to ptr.
Definition: npc.cpp:871
virtual bool isEssential(const MWWorld::ConstPtr &ptr) const
Is ptr essential? (i.e. may losing ptr make the game unwinnable)
Definition: npc.cpp:979
<
Definition: objectstate.hpp:19
virtual std::string getModel(const MWWorld::ConstPtr &ptr) const
Definition: npc.cpp:423
const ESM::GameSetting * fJumpEncumbranceMultiplier
Definition: npc.hpp:32
Desired movement for an actor.
Definition: movement.hpp:9
const ESM::GameSetting * fSwimRunBase
Definition: npc.hpp:29
const ESM::GameSetting * fKnockDownMult
Definition: npc.hpp:37
virtual float getSpeed(const MWWorld::Ptr &ptr) const
Return movement speed.
Definition: npc.cpp:878
virtual MWWorld::Ptr copyToCellImpl(const MWWorld::ConstPtr &ptr, MWWorld::CellStore &cell) const
Definition: npc.cpp:1202
Mutable state of a cell.
Definition: cellstore.hpp:53
const ESM::GameSetting * fMinFlySpeed
Definition: npc.hpp:27
Pointer to a const LiveCellRef.
Definition: ptr.hpp:90
virtual void insertObjectRendering(const MWWorld::Ptr &ptr, const std::string &model, MWRender::RenderingInterface &renderingInterface) const
Add reference into a cell for rendering.
Definition: npc.cpp:412
Definition: npc.hpp:19
Definition: containerstore.hpp:41
virtual std::string getSoundIdFromSndGen(const MWWorld::Ptr &ptr, const std::string &name) const
Returns the sound ID for ptr of the given soundgen type.
Definition: npc.cpp:1135
const ESM::GameSetting * fWereWolfRunMult
Definition: npc.hpp:36
const ESM::GameSetting * fSneakSpeedMultiplier
Definition: npc.hpp:24
virtual MWGui::ToolTipInfo getToolTipInfo(const MWWorld::ConstPtr &ptr, int count) const
Definition: npc.cpp:1001
void ensureCustomData(const MWWorld::Ptr &ptr) const
Definition: npc.cpp:302
const ESM::GameSetting * fMaxFlySpeed
Definition: npc.hpp:28
virtual int getPrimaryFactionRank(const MWWorld::ConstPtr &ptr) const
Definition: npc.cpp:1350
Additional stats for NPCs.
Definition: npcstats.hpp:21
virtual MWWorld::InventoryStore & getInventoryStore(const MWWorld::Ptr &ptr) const
Return inventory store.
Definition: npc.cpp:863
virtual bool isBipedal(const MWWorld::ConstPtr &ptr) const
Definition: npc.cpp:1339
virtual void restock(const MWWorld::Ptr &ptr) const
Definition: npc.cpp:1325
const ESM::GameSetting * iKnockDownOddsBase
Definition: npc.hpp:39
virtual bool hasInventoryStore(const MWWorld::Ptr &ptr) const
Does this object have an inventory store, i.e. equipment slots? (default implementation: false) ...
Definition: npc.hpp:72
virtual int getBaseFightRating(const MWWorld::ConstPtr &ptr) const
Definition: npc.cpp:1333
const ESM::GameSetting * fSwimRunAthleticsMult
Definition: npc.hpp:30
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
virtual bool isNpc() const
Definition: npc.hpp:138
virtual bool canSwim(const MWWorld::ConstPtr &ptr) const
Definition: npc.cpp:1284
const ESM::GameSetting * fAthleticsRunBonus
Definition: npc.hpp:25
virtual MWMechanics::CreatureStats & getCreatureStats(const MWWorld::Ptr &ptr) const
Return creature stats.
Definition: npc.cpp:534
const ESM::GameSetting * fEncumberedMoveEffect
Definition: npc.hpp:23
virtual int getServices(const MWWorld::ConstPtr &actor) const
Definition: npc.cpp:1125
virtual void hit(const MWWorld::Ptr &ptr, float attackStrength, int type) const
Definition: npc.cpp:549
virtual bool apply(const MWWorld::Ptr &ptr, const std::string &id, const MWWorld::Ptr &actor) const
Definition: npc.cpp:1036
virtual std::string getPrimaryFaction(const MWWorld::ConstPtr &ptr) const
Definition: npc.cpp:1344
const ESM::GameSetting * fJumpEncumbranceBase
Definition: npc.hpp:31
const char * name
Definition: crashcatcher.cpp:59
virtual void onHit(const MWWorld::Ptr &ptr, float damage, bool ishealth, const MWWorld::Ptr &object, const MWWorld::Ptr &attacker, const osg::Vec3f &hitPosition, bool successful) const
Definition: npc.cpp:654
virtual void getModelsToPreload(const MWWorld::Ptr &ptr, std::vector< std::string > &models) const
Get a list of models to preload that this object may use (directly or indirectly). default implementation: list getModel().
Definition: npc.cpp:435