OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | List of all members
MWClass::Npc Class Reference

#include <npc.hpp>

Inheritance diagram for MWClass::Npc:
Collaboration diagram for MWClass::Npc:

Classes

struct  GMST
 

Public Member Functions

virtual void insertObjectRendering (const MWWorld::Ptr &ptr, const std::string &model, MWRender::RenderingInterface &renderingInterface) const
 Add reference into a cell for rendering. More...
 
virtual std::string getName (const MWWorld::ConstPtr &ptr) const
 
virtual
MWMechanics::CreatureStats
getCreatureStats (const MWWorld::Ptr &ptr) const
 Return creature stats. More...
 
virtual MWMechanics::NpcStatsgetNpcStats (const MWWorld::Ptr &ptr) const
 Return NPC stats. More...
 
virtual MWWorld::ContainerStoregetContainerStore (const MWWorld::Ptr &ptr) const
 Return container store. More...
 
virtual bool hasToolTip (const MWWorld::ConstPtr &ptr) const
 
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr &ptr, int count) const
 
virtual MWWorld::InventoryStoregetInventoryStore (const MWWorld::Ptr &ptr) const
 Return inventory store. More...
 
virtual bool hasInventoryStore (const MWWorld::Ptr &ptr) const
 Does this object have an inventory store, i.e. equipment slots? (default implementation: false) More...
 
virtual void hit (const MWWorld::Ptr &ptr, float attackStrength, int type) const
 
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
 
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(). More...
 
virtual boost::shared_ptr
< MWWorld::Action
activate (const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor) const
 Generate action for activation. More...
 
virtual std::string getScript (const MWWorld::ConstPtr &ptr) const
 Return name of the script attached to ptr. More...
 
virtual float getSpeed (const MWWorld::Ptr &ptr) const
 Return movement speed. More...
 
virtual float getJump (const MWWorld::Ptr &ptr) const
 Return jump velocity (not accounting for movement) More...
 
virtual MWMechanics::MovementgetMovementSettings (const MWWorld::Ptr &ptr) const
 Return desired movement. More...
 
virtual float getCapacity (const MWWorld::Ptr &ptr) const
 
virtual float getEncumbrance (const MWWorld::Ptr &ptr) const
 
virtual float getArmorRating (const MWWorld::Ptr &ptr) const
 
virtual bool apply (const MWWorld::Ptr &ptr, const std::string &id, const MWWorld::Ptr &actor) const
 
virtual void adjustScale (const MWWorld::ConstPtr &ptr, osg::Vec3f &scale, bool rendering) const
 
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. More...
 
virtual bool isEssential (const MWWorld::ConstPtr &ptr) const
 Is ptr essential? (i.e. may losing ptr make the game unwinnable) More...
 
virtual int getServices (const MWWorld::ConstPtr &actor) const
 
virtual bool isPersistent (const MWWorld::ConstPtr &ptr) const
 
virtual std::string getSoundIdFromSndGen (const MWWorld::Ptr &ptr, const std::string &name) const
 Returns the sound ID for ptr of the given soundgen type. More...
 
virtual std::string getModel (const MWWorld::ConstPtr &ptr) const
 
virtual int getSkill (const MWWorld::Ptr &ptr, int skill) const
 
virtual int getBloodTexture (const MWWorld::ConstPtr &ptr) const
 Get a blood texture suitable for ptr (see Blood Texture 0-2 in Morrowind.ini) More...
 
virtual bool isNpc () const
 
virtual void readAdditionalState (const MWWorld::Ptr &ptr, const ESM::ObjectState &state) const
 Read additional state from state into ptr. More...
 
virtual void writeAdditionalState (const MWWorld::ConstPtr &ptr, ESM::ObjectState &state) const
 Write additional state from ptr into state. More...
 
virtual int getBaseGold (const MWWorld::ConstPtr &ptr) const
 
virtual bool isClass (const MWWorld::ConstPtr &ptr, const std::string &className) const
 
virtual bool canSwim (const MWWorld::ConstPtr &ptr) const
 
virtual bool canWalk (const MWWorld::ConstPtr &ptr) const
 
virtual bool isBipedal (const MWWorld::ConstPtr &ptr) const
 
virtual void respawn (const MWWorld::Ptr &ptr) const
 
virtual void restock (const MWWorld::Ptr &ptr) const
 
virtual int getBaseFightRating (const MWWorld::ConstPtr &ptr) const
 
virtual std::string getPrimaryFaction (const MWWorld::ConstPtr &ptr) const
 
virtual int getPrimaryFactionRank (const MWWorld::ConstPtr &ptr) const
 
- Public Member Functions inherited from MWClass::Actor
virtual ~Actor ()
 
virtual void adjustPosition (const MWWorld::Ptr &ptr, bool force) const
 
virtual void insertObject (const MWWorld::Ptr &ptr, const std::string &model, MWPhysics::PhysicsSystem &physics) const
 Add reference into a cell for rendering (default implementation: don't render anything). More...
 
virtual void block (const MWWorld::Ptr &ptr) const
 
virtual osg::Vec3f getRotationVector (const MWWorld::Ptr &ptr) const
 Return desired rotations, as euler angles. More...
 
virtual bool allowTelekinesis (const MWWorld::ConstPtr &ptr) const
 Return whether this class of object can be activated with telekinesis. More...
 
virtual bool isActor () const
 
virtual bool canBeActivated (const MWWorld::Ptr &ptr) const
 
 Actor (const Actor &)
 
Actoroperator= (const Actor &)
 
- Public Member Functions inherited from MWWorld::Class
virtual ~Class ()
 
const std::string & getTypeName () const
 
virtual bool showsInInventory (const ConstPtr &ptr) const
 
virtual bool hasItemHealth (const ConstPtr &ptr) const
 
virtual int getItemHealth (const ConstPtr &ptr) const
 Return current item health or throw an exception if class does not have item health. More...
 
virtual int getItemMaxHealth (const ConstPtr &ptr) const
 
virtual boost::shared_ptr< Actionuse (const Ptr &ptr) const
 
virtual void lock (const Ptr &ptr, int lockLevel) const
 Lock object (default implementation: throw an exception) More...
 
virtual void unlock (const Ptr &ptr) const
 Unlock object (default implementation: throw an exception) More...
 
virtual bool canLock (const ConstPtr &ptr) const
 
virtual void setRemainingUsageTime (const Ptr &ptr, float duration) const
 
virtual float getRemainingUsageTime (const ConstPtr &ptr) const
 
virtual std::pair< std::vector
< int >, bool
getEquipmentSlots (const ConstPtr &ptr) const
 
virtual int getEquipmentSkill (const ConstPtr &ptr) const
 
virtual int getValue (const ConstPtr &ptr) const
 
virtual float getNormalizedEncumbrance (const MWWorld::Ptr &ptr) const
 Returns encumbrance re-scaled to capacity. More...
 
virtual std::string getUpSoundId (const ConstPtr &ptr) const
 
virtual std::string getDownSoundId (const ConstPtr &ptr) const
 
virtual std::string getInventoryIcon (const MWWorld::ConstPtr &ptr) const
 Return name of inventory icon. More...
 
virtual std::string getEnchantment (const MWWorld::ConstPtr &ptr) const
 
virtual int getEnchantmentPoints (const MWWorld::ConstPtr &ptr) const
 
virtual bool canSell (const MWWorld::ConstPtr &item, int npcServices) const
 Determine whether or not item can be sold to an npc with the given npcServices. More...
 
virtual std::string applyEnchantment (const MWWorld::ConstPtr &ptr, const std::string &enchId, int enchCharge, const std::string &newName) const
 Creates a new record using ptr as template, with the given name and the given enchantment applied to it. More...
 
virtual std::pair< int,
std::string > 
canBeEquipped (const MWWorld::ConstPtr &ptr, const MWWorld::Ptr &npc) const
 
virtual float getWeight (const MWWorld::ConstPtr &ptr) const
 
virtual bool isKey (const MWWorld::ConstPtr &ptr) const
 
virtual bool isGold (const MWWorld::ConstPtr &ptr) const
 
virtual Ptr copyToCell (const ConstPtr &ptr, CellStore &cell, int count) const
 
virtual Ptr copyToCell (const ConstPtr &ptr, CellStore &cell, const ESM::Position &pos, int count) const
 
virtual bool canFly (const MWWorld::ConstPtr &ptr) const
 
bool isPureWaterCreature (const MWWorld::Ptr &ptr) const
 
bool isPureFlyingCreature (const MWWorld::Ptr &ptr) const
 
bool isPureLandCreature (const MWWorld::Ptr &ptr) const
 
bool isMobile (const MWWorld::Ptr &ptr) const
 
virtual int getDoorState (const MWWorld::ConstPtr &ptr) const
 0 = nothing, 1 = opening, 2 = closing More...
 
virtual void setDoorState (const MWWorld::Ptr &ptr, int state) const
 This does not actually cause the door to move. Use World::activateDoor instead. More...
 
virtual std::string getSound (const MWWorld::ConstPtr &ptr) const
 Returns sound id. More...
 
virtual int getEffectiveArmorRating (const MWWorld::ConstPtr &armor, const MWWorld::Ptr &actor) const
 Get the effective armor rating, factoring in the actor's skills, for the given armor. More...
 

Static Public Member Functions

static void registerSelf ()
 
- Static Public Member Functions inherited from MWWorld::Class
static const Classget (const std::string &key)
 If there is no class for this key, an exception is thrown. More...
 
static void registerClass (const std::string &key, boost::shared_ptr< Class > instance)
 

Private Member Functions

void ensureCustomData (const MWWorld::Ptr &ptr) const
 
virtual MWWorld::Ptr copyToCellImpl (const MWWorld::ConstPtr &ptr, MWWorld::CellStore &cell) const
 

Static Private Member Functions

static const GMSTgetGmst ()
 

Additional Inherited Members

- Protected Member Functions inherited from MWClass::Actor
 Actor ()
 
- Protected Member Functions inherited from MWWorld::Class
 Class ()
 
boost::shared_ptr< ActiondefaultItemActivate (const Ptr &ptr, const Ptr &actor) const
 Generate default action for activating inventory items. More...
 

Member Function Documentation

boost::shared_ptr< MWWorld::Action > MWClass::Npc::activate ( const MWWorld::Ptr ptr,
const MWWorld::Ptr actor 
) const
virtual

Generate action for activation.

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

void MWClass::Npc::adjustScale ( const MWWorld::ConstPtr ptr,
osg::Vec3f &  scale,
bool  rendering 
) const
virtual

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

bool MWClass::Npc::apply ( const MWWorld::Ptr ptr,
const std::string &  id,
const MWWorld::Ptr actor 
) const
virtual

Apply id on ptr.

Parameters
actorActor that is resposible for the ID being applied to ptr.
Returns
Any effect?

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

bool MWClass::Npc::canSwim ( const MWWorld::ConstPtr ptr) const
virtual

Reimplemented from MWWorld::Class.

bool MWClass::Npc::canWalk ( const MWWorld::ConstPtr ptr) const
virtual

Reimplemented from MWWorld::Class.

MWWorld::Ptr MWClass::Npc::copyToCellImpl ( const MWWorld::ConstPtr ptr,
MWWorld::CellStore cell 
) const
privatevirtual

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

void MWClass::Npc::ensureCustomData ( const MWWorld::Ptr ptr) const
private
Todo:
add option to make this a fatal error message pop-up, but default to warning for vanilla compatibility

Here is the call graph for this function:

Here is the caller graph for this function:

float MWClass::Npc::getArmorRating ( const MWWorld::Ptr ptr) const
virtual
Returns
combined armor rating of this actor

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

Here is the caller graph for this function:

int MWClass::Npc::getBaseFightRating ( const MWWorld::ConstPtr ptr) const
virtual

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

int MWClass::Npc::getBaseGold ( const MWWorld::ConstPtr ptr) const
virtual

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

int MWClass::Npc::getBloodTexture ( const MWWorld::ConstPtr ptr) const
virtual

Get a blood texture suitable for ptr (see Blood Texture 0-2 in Morrowind.ini)

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

float MWClass::Npc::getCapacity ( const MWWorld::Ptr ptr) const
virtual

Return total weight that fits into the object. Throws an exception, if the object can't hold other objects.

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

Here is the caller graph for this function:

MWWorld::ContainerStore & MWClass::Npc::getContainerStore ( const MWWorld::Ptr ptr) const
virtual

Return container store.

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

Here is the caller graph for this function:

MWMechanics::CreatureStats & MWClass::Npc::getCreatureStats ( const MWWorld::Ptr ptr) const
virtual

Return creature stats.

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

Here is the caller graph for this function:

float MWClass::Npc::getEncumbrance ( const MWWorld::Ptr ptr) const
virtual

Returns total weight of objects inside this object (including modifications from magic effects). Throws an exception, if the object can't hold other objects.

Reimplemented from MWClass::Actor.

Here is the call graph for this function:

Here is the caller graph for this function:

const Npc::GMST & MWClass::Npc::getGmst ( )
staticprivate

Here is the call graph for this function:

Here is the caller graph for this function:

MWWorld::InventoryStore & MWClass::Npc::getInventoryStore ( const MWWorld::Ptr ptr) const
virtual

Return inventory store.

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

Here is the caller graph for this function:

float MWClass::Npc::getJump ( const MWWorld::Ptr ptr) const
virtual

Return jump velocity (not accounting for movement)

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

std::string MWClass::Npc::getModel ( const MWWorld::ConstPtr ptr) const
virtual

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

void MWClass::Npc::getModelsToPreload ( const MWWorld::Ptr ptr,
std::vector< std::string > &  models 
) const
virtual

Get a list of models to preload that this object may use (directly or indirectly). default implementation: list getModel().

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

MWMechanics::Movement & MWClass::Npc::getMovementSettings ( const MWWorld::Ptr ptr) const
virtual

Return desired movement.

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string MWClass::Npc::getName ( const MWWorld::ConstPtr ptr) const
virtual
Returns
name (the one that is to be presented to the user; not the internal one); can return an empty string.

Implements MWWorld::Class.

Here is the call graph for this function:

Here is the caller graph for this function:

MWMechanics::NpcStats & MWClass::Npc::getNpcStats ( const MWWorld::Ptr ptr) const
virtual

Return NPC stats.

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

Here is the caller graph for this function:

std::string MWClass::Npc::getPrimaryFaction ( const MWWorld::ConstPtr ptr) const
virtual

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

int MWClass::Npc::getPrimaryFactionRank ( const MWWorld::ConstPtr ptr) const
virtual

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

std::string MWClass::Npc::getScript ( const MWWorld::ConstPtr ptr) const
virtual

Return name of the script attached to ptr.

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

int MWClass::Npc::getServices ( const MWWorld::ConstPtr actor) const
virtual

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

int MWClass::Npc::getSkill ( const MWWorld::Ptr ptr,
int  skill 
) const
virtual

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

std::string MWClass::Npc::getSoundIdFromSndGen ( const MWWorld::Ptr ptr,
const std::string &  type 
) const
virtual

Returns the sound ID for ptr of the given soundgen type.

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

float MWClass::Npc::getSpeed ( const MWWorld::Ptr ptr) const
virtual

Return movement speed.

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

MWGui::ToolTipInfo MWClass::Npc::getToolTipInfo ( const MWWorld::ConstPtr ptr,
int  count 
) const
virtual
Returns
the content of the tool tip to be displayed. raises exception if the object has no tooltip.

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

virtual bool MWClass::Npc::hasInventoryStore ( const MWWorld::Ptr ptr) const
inlinevirtual

Does this object have an inventory store, i.e. equipment slots? (default implementation: false)

Reimplemented from MWWorld::Class.

bool MWClass::Npc::hasToolTip ( const MWWorld::ConstPtr ptr) const
virtual
Returns
true if this object has a tooltip when focused (default implementation: false)

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

void MWClass::Npc::hit ( const MWWorld::Ptr ptr,
float  attackStrength,
int  type 
) const
virtual

Execute a melee hit, using the current weapon. This will check the relevant skills of the given attacker, and whoever is hit.

Parameters
attackStrengthhow long the attack was charged for, a value in 0-1 range.
type- type of attack, one of the MWMechanics::CreatureStats::AttackType enums. ignored for creature attacks. (default implementation: throw an exception)

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

void MWClass::Npc::insertObjectRendering ( const MWWorld::Ptr ptr,
const std::string &  model,
MWRender::RenderingInterface renderingInterface 
) const
virtual

Add reference into a cell for rendering.

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

bool MWClass::Npc::isBipedal ( const MWWorld::ConstPtr ptr) const
virtual

Reimplemented from MWWorld::Class.

bool MWClass::Npc::isClass ( const MWWorld::ConstPtr ptr,
const std::string &  className 
) const
virtual

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

bool MWClass::Npc::isEssential ( const MWWorld::ConstPtr ptr) const
virtual

Is ptr essential? (i.e. may losing ptr make the game unwinnable)

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

virtual bool MWClass::Npc::isNpc ( ) const
inlinevirtual

Reimplemented from MWWorld::Class.

bool MWClass::Npc::isPersistent ( const MWWorld::ConstPtr ptr) const
virtual

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

void MWClass::Npc::onHit ( const MWWorld::Ptr ptr,
float  damage,
bool  ishealth,
const MWWorld::Ptr object,
const MWWorld::Ptr attacker,
const osg::Vec3f &  hitPosition,
bool  successful 
) const
virtual

Alerts ptr that it's being hit for damage points to health if ishealth is true (else fatigue) by object (sword, arrow, etc). attacker specifies the actor responsible for the attack, and successful specifies if the hit is successful or not.

Reimplemented from MWWorld::Class.

void MWClass::Npc::readAdditionalState ( const MWWorld::Ptr ptr,
const ESM::ObjectState state 
) const
virtual

Read additional state from state into ptr.

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

void MWClass::Npc::registerSelf ( )
static

Here is the call graph for this function:

Here is the caller graph for this function:

void MWClass::Npc::respawn ( const MWWorld::Ptr ptr) const
virtual

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

void MWClass::Npc::restock ( const MWWorld::Ptr ptr) const
virtual

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

void MWClass::Npc::skillUsageSucceeded ( const MWWorld::Ptr ptr,
int  skill,
int  usageType,
float  extraFactor = 1.f 
) const
virtual

Inform actor ptr that a skill use has succeeded.

Parameters
renderingIndicates if the scale to adjust is for the rendering mesh, or for the collision mesh

Reimplemented from MWWorld::Class.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWClass::Npc::writeAdditionalState ( const MWWorld::ConstPtr ptr,
ESM::ObjectState state 
) const
virtual

Write additional state from ptr into state.

Reimplemented from MWWorld::Class.

Here is the call graph for this function:


The documentation for this class was generated from the following files: