2010-08-03 11:17:31 +00:00
|
|
|
#ifndef GAME_MWCLASS_NPC_H
|
|
|
|
#define GAME_MWCLASS_NPC_H
|
2010-08-03 11:03:08 +00:00
|
|
|
|
2015-08-25 06:19:16 +00:00
|
|
|
#include "actor.hpp"
|
2010-08-03 11:03:08 +00:00
|
|
|
|
2013-02-15 09:27:57 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
2015-03-06 08:36:42 +00:00
|
|
|
struct GameSetting;
|
2013-02-15 09:27:57 +00:00
|
|
|
}
|
|
|
|
|
2010-08-03 11:17:31 +00:00
|
|
|
namespace MWClass
|
2010-08-03 11:03:08 +00:00
|
|
|
{
|
2015-08-25 06:19:16 +00:00
|
|
|
class Npc : public Actor
|
2010-08-03 11:03:08 +00:00
|
|
|
{
|
2012-01-25 15:56:49 +00:00
|
|
|
void ensureCustomData (const MWWorld::Ptr& ptr) const;
|
|
|
|
|
2015-12-18 15:24:24 +00:00
|
|
|
virtual MWWorld::Ptr copyToCellImpl(const MWWorld::ConstPtr &ptr, MWWorld::CellStore &cell) const;
|
2012-07-25 13:18:17 +00:00
|
|
|
|
2014-06-19 00:09:46 +00:00
|
|
|
struct GMST
|
|
|
|
{
|
|
|
|
const ESM::GameSetting *fMinWalkSpeed;
|
|
|
|
const ESM::GameSetting *fMaxWalkSpeed;
|
|
|
|
const ESM::GameSetting *fEncumberedMoveEffect;
|
|
|
|
const ESM::GameSetting *fSneakSpeedMultiplier;
|
|
|
|
const ESM::GameSetting *fAthleticsRunBonus;
|
|
|
|
const ESM::GameSetting *fBaseRunMultiplier;
|
|
|
|
const ESM::GameSetting *fMinFlySpeed;
|
|
|
|
const ESM::GameSetting *fMaxFlySpeed;
|
|
|
|
const ESM::GameSetting *fSwimRunBase;
|
|
|
|
const ESM::GameSetting *fSwimRunAthleticsMult;
|
|
|
|
const ESM::GameSetting *fJumpEncumbranceBase;
|
|
|
|
const ESM::GameSetting *fJumpEncumbranceMultiplier;
|
|
|
|
const ESM::GameSetting *fJumpAcrobaticsBase;
|
|
|
|
const ESM::GameSetting *fJumpAcroMultiplier;
|
|
|
|
const ESM::GameSetting *fJumpRunMultiplier;
|
|
|
|
const ESM::GameSetting *fWereWolfRunMult;
|
|
|
|
const ESM::GameSetting *fKnockDownMult;
|
|
|
|
const ESM::GameSetting *iKnockDownOddsMult;
|
|
|
|
const ESM::GameSetting *iKnockDownOddsBase;
|
2014-07-20 21:08:22 +00:00
|
|
|
const ESM::GameSetting *fCombatArmorMinMult;
|
2014-06-19 00:09:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const GMST& getGmst();
|
2013-02-15 09:27:57 +00:00
|
|
|
|
2010-08-03 11:03:08 +00:00
|
|
|
public:
|
2011-01-18 09:45:29 +00:00
|
|
|
|
2015-01-12 10:29:56 +00:00
|
|
|
virtual void insertObjectRendering (const MWWorld::Ptr& ptr, const std::string& model, MWRender::RenderingInterface& renderingInterface) const;
|
2010-08-14 08:02:54 +00:00
|
|
|
///< Add reference into a cell for rendering
|
|
|
|
|
2015-12-18 14:27:06 +00:00
|
|
|
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
2019-09-10 21:06:50 +00:00
|
|
|
///< \return name or ID; can return an empty string.
|
2010-08-03 15:11:41 +00:00
|
|
|
|
2010-08-03 11:17:31 +00:00
|
|
|
virtual MWMechanics::CreatureStats& getCreatureStats (const MWWorld::Ptr& ptr) const;
|
2010-08-03 11:03:08 +00:00
|
|
|
///< Return creature stats
|
|
|
|
|
2010-08-19 10:49:13 +00:00
|
|
|
virtual MWMechanics::NpcStats& getNpcStats (const MWWorld::Ptr& ptr) const;
|
|
|
|
///< Return NPC stats
|
|
|
|
|
2012-01-28 10:45:55 +00:00
|
|
|
virtual MWWorld::ContainerStore& getContainerStore (const MWWorld::Ptr& ptr) const;
|
2010-08-04 12:37:23 +00:00
|
|
|
///< Return container store
|
|
|
|
|
2015-12-19 15:13:00 +00:00
|
|
|
virtual bool hasToolTip(const MWWorld::ConstPtr& ptr) const;
|
2019-09-10 18:56:10 +00:00
|
|
|
///< @return true if this object has a tooltip when focused (default implementation: true)
|
2015-12-19 15:13:00 +00:00
|
|
|
|
2015-12-19 15:29:07 +00:00
|
|
|
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
2012-04-16 20:58:16 +00:00
|
|
|
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
|
|
|
|
2012-03-10 11:49:54 +00:00
|
|
|
virtual MWWorld::InventoryStore& getInventoryStore (const MWWorld::Ptr& ptr) const;
|
|
|
|
///< Return inventory store
|
|
|
|
|
2014-01-19 10:42:58 +00:00
|
|
|
virtual bool hasInventoryStore(const MWWorld::Ptr &ptr) const { return true; }
|
|
|
|
|
2018-04-01 06:33:07 +00:00
|
|
|
/*
|
|
|
|
Start of tes3mp addition
|
|
|
|
|
|
|
|
Make it possible to check whether a class has a container store
|
|
|
|
*/
|
|
|
|
virtual bool hasContainerStore(const MWWorld::Ptr &ptr) const { return true; }
|
|
|
|
/*
|
|
|
|
End of tes3mp addition
|
|
|
|
*/
|
|
|
|
|
2015-06-26 03:15:07 +00:00
|
|
|
virtual void hit(const MWWorld::Ptr& ptr, float attackStrength, int type) const;
|
2013-07-24 09:51:42 +00:00
|
|
|
|
2016-09-12 15:49:31 +00:00
|
|
|
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;
|
2013-07-26 10:21:54 +00:00
|
|
|
|
2016-02-08 19:52:32 +00:00
|
|
|
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().
|
|
|
|
|
2017-05-05 19:21:11 +00:00
|
|
|
virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
2012-04-23 13:27:03 +00:00
|
|
|
const MWWorld::Ptr& actor) const;
|
2010-08-06 16:15:46 +00:00
|
|
|
///< Generate action for activation
|
|
|
|
|
2015-12-17 23:12:03 +00:00
|
|
|
virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
|
2010-08-05 13:40:03 +00:00
|
|
|
///< Return name of the script attached to ptr
|
|
|
|
|
2011-01-18 09:45:29 +00:00
|
|
|
virtual float getSpeed (const MWWorld::Ptr& ptr) const;
|
|
|
|
///< Return movement speed.
|
|
|
|
|
2013-02-24 11:30:33 +00:00
|
|
|
virtual float getJump(const MWWorld::Ptr &ptr) const;
|
|
|
|
///< Return jump velocity (not accounting for movement)
|
|
|
|
|
2011-02-03 10:37:17 +00:00
|
|
|
virtual MWMechanics::Movement& getMovementSettings (const MWWorld::Ptr& ptr) const;
|
|
|
|
///< Return desired movement.
|
|
|
|
|
2012-05-15 20:31:52 +00:00
|
|
|
virtual float getCapacity (const MWWorld::Ptr& ptr) const;
|
2012-05-15 19:34:00 +00:00
|
|
|
///< Return total weight that fits into the object. Throws an exception, if the object can't
|
|
|
|
/// hold other objects.
|
|
|
|
|
|
|
|
virtual float getEncumbrance (const MWWorld::Ptr& ptr) const;
|
|
|
|
///< Returns total weight of objects inside this object (including modifications from magic
|
2012-05-15 19:17:00 +00:00
|
|
|
/// effects). Throws an exception, if the object can't hold other objects.
|
|
|
|
|
2013-03-17 21:29:12 +00:00
|
|
|
virtual float getArmorRating (const MWWorld::Ptr& ptr) const;
|
|
|
|
///< @return combined armor rating of this actor
|
|
|
|
|
2012-07-13 07:16:27 +00:00
|
|
|
virtual bool apply (const MWWorld::Ptr& ptr, const std::string& id,
|
|
|
|
const MWWorld::Ptr& actor) const;
|
|
|
|
///< Apply \a id on \a ptr.
|
|
|
|
/// \param actor Actor that is resposible for the ID being applied to \a ptr.
|
|
|
|
/// \return Any effect?
|
|
|
|
|
2015-12-18 15:46:02 +00:00
|
|
|
virtual void adjustScale (const MWWorld::ConstPtr &ptr, osg::Vec3f &scale, bool rendering) const;
|
2015-11-01 20:45:58 +00:00
|
|
|
/// @param rendering Indicates if the scale to adjust is for the rendering mesh, or for the collision mesh
|
2013-03-15 15:44:35 +00:00
|
|
|
|
2014-09-25 10:25:57 +00:00
|
|
|
virtual void skillUsageSucceeded (const MWWorld::Ptr& ptr, int skill, int usageType, float extraFactor=1.f) const;
|
2012-07-13 07:16:27 +00:00
|
|
|
///< Inform actor \a ptr that a skill use has succeeded.
|
|
|
|
|
2015-12-18 15:39:35 +00:00
|
|
|
virtual bool isEssential (const MWWorld::ConstPtr& ptr) const;
|
2012-10-27 11:33:54 +00:00
|
|
|
///< Is \a ptr essential? (i.e. may losing \a ptr make the game unwinnable)
|
2013-05-11 16:38:27 +00:00
|
|
|
|
2015-12-18 15:44:35 +00:00
|
|
|
virtual int getServices (const MWWorld::ConstPtr& actor) const;
|
2014-02-01 16:36:23 +00:00
|
|
|
|
2015-12-18 15:41:37 +00:00
|
|
|
virtual bool isPersistent (const MWWorld::ConstPtr& ptr) const;
|
2013-05-16 16:50:26 +00:00
|
|
|
|
2013-07-18 06:58:21 +00:00
|
|
|
virtual std::string getSoundIdFromSndGen(const MWWorld::Ptr &ptr, const std::string &name) const;
|
|
|
|
|
2010-08-03 11:03:08 +00:00
|
|
|
static void registerSelf();
|
2012-07-24 16:22:11 +00:00
|
|
|
|
2015-12-18 14:51:05 +00:00
|
|
|
virtual std::string getModel(const MWWorld::ConstPtr &ptr) const;
|
2012-07-30 19:28:14 +00:00
|
|
|
|
2018-12-23 11:18:33 +00:00
|
|
|
virtual float getSkill(const MWWorld::Ptr& ptr, int skill) const;
|
2014-01-15 14:50:45 +00:00
|
|
|
|
2014-01-17 09:52:44 +00:00
|
|
|
/// Get a blood texture suitable for \a ptr (see Blood Texture 0-2 in Morrowind.ini)
|
2015-12-18 15:38:14 +00:00
|
|
|
virtual int getBloodTexture (const MWWorld::ConstPtr& ptr) const;
|
2014-01-17 09:52:44 +00:00
|
|
|
|
2013-08-09 05:34:53 +00:00
|
|
|
virtual bool isNpc() const {
|
2012-07-30 19:28:14 +00:00
|
|
|
return true;
|
|
|
|
}
|
2014-02-01 16:36:23 +00:00
|
|
|
|
|
|
|
virtual void readAdditionalState (const MWWorld::Ptr& ptr, const ESM::ObjectState& state)
|
|
|
|
const;
|
|
|
|
///< Read additional state from \a state into \a ptr.
|
|
|
|
|
2015-12-17 23:18:06 +00:00
|
|
|
virtual void writeAdditionalState (const MWWorld::ConstPtr& ptr, ESM::ObjectState& state)
|
2014-02-01 16:36:23 +00:00
|
|
|
const;
|
|
|
|
///< Write additional state from \a ptr into \a state.
|
2014-03-28 18:21:38 +00:00
|
|
|
|
2015-12-18 15:28:20 +00:00
|
|
|
virtual int getBaseGold(const MWWorld::ConstPtr& ptr) const;
|
2014-04-01 18:15:55 +00:00
|
|
|
|
2015-12-18 15:29:30 +00:00
|
|
|
virtual bool isClass(const MWWorld::ConstPtr& ptr, const std::string &className) const;
|
2014-04-27 12:59:21 +00:00
|
|
|
|
2015-12-18 15:15:40 +00:00
|
|
|
virtual bool canSwim (const MWWorld::ConstPtr &ptr) const;
|
2014-04-27 12:59:21 +00:00
|
|
|
|
2015-12-18 15:15:40 +00:00
|
|
|
virtual bool canWalk (const MWWorld::ConstPtr &ptr) const;
|
2014-05-17 07:05:41 +00:00
|
|
|
|
2015-12-18 15:15:40 +00:00
|
|
|
virtual bool isBipedal (const MWWorld::ConstPtr &ptr) const;
|
2014-12-28 14:34:47 +00:00
|
|
|
|
2014-05-17 07:05:41 +00:00
|
|
|
virtual void respawn (const MWWorld::Ptr& ptr) const;
|
2014-05-17 12:30:31 +00:00
|
|
|
|
|
|
|
virtual void restock (const MWWorld::Ptr& ptr) const;
|
2014-12-14 18:35:34 +00:00
|
|
|
|
2015-12-18 15:12:35 +00:00
|
|
|
virtual int getBaseFightRating (const MWWorld::ConstPtr& ptr) const;
|
2015-01-27 16:32:21 +00:00
|
|
|
|
2015-12-18 15:33:54 +00:00
|
|
|
virtual std::string getPrimaryFaction(const MWWorld::ConstPtr &ptr) const;
|
|
|
|
virtual int getPrimaryFactionRank(const MWWorld::ConstPtr &ptr) const;
|
2020-06-02 19:59:37 +00:00
|
|
|
|
|
|
|
virtual void setBaseAISetting(const std::string& id, MWMechanics::CreatureStats::AiSetting setting, int value) const;
|
2010-08-03 11:03:08 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|