OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Types | Public Member Functions | Private Member Functions | List of all members
MWBase::MechanicsManager Class Referenceabstract

Interface for game mechanics manager (implemented in MWMechanics) More...

#include <mechanicsmanager.hpp>

Inheritance diagram for MWBase::MechanicsManager:
Collaboration diagram for MWBase::MechanicsManager:

Public Types

enum  OffenseType {
  OT_Theft, OT_Assault, OT_Murder, OT_Trespassing,
  OT_SleepingInOwnedBed, OT_Pickpocket
}
 
enum  PersuasionType {
  PT_Admire, PT_Intimidate, PT_Taunt, PT_Bribe10,
  PT_Bribe100, PT_Bribe1000
}
 

Public Member Functions

 MechanicsManager ()
 
virtual ~MechanicsManager ()
 
virtual void add (const MWWorld::Ptr &ptr)=0
 Register an object for management. More...
 
virtual void remove (const MWWorld::Ptr &ptr)=0
 Deregister an object for management. More...
 
virtual void updateCell (const MWWorld::Ptr &old, const MWWorld::Ptr &ptr)=0
 Moves an object to a new cell. More...
 
virtual void drop (const MWWorld::CellStore *cellStore)=0
 Deregister all objects in the given cell. More...
 
virtual void watchActor (const MWWorld::Ptr &ptr)=0
 
virtual void update (float duration, bool paused)=0
 
virtual void advanceTime (float duration)=0
 
virtual void setPlayerName (const std::string &name)=0
 Set player name. More...
 
virtual void setPlayerRace (const std::string &id, bool male, const std::string &head, const std::string &hair)=0
 Set player race. More...
 
virtual void setPlayerBirthsign (const std::string &id)=0
 Set player birthsign. More...
 
virtual void setPlayerClass (const std::string &id)=0
 Set player class to stock class. More...
 
virtual void setPlayerClass (const ESM::Class &class_)=0
 Set player class to custom class. More...
 
virtual void rest (bool sleep)=0
 
virtual int getHoursToRest () const =0
 Calculate how many hours the player needs to rest in order to be fully healed. More...
 
virtual int getBarterOffer (const MWWorld::Ptr &ptr, int basePrice, bool buying)=0
 This is used by every service to determine the price of objects given the trading skills of the player and NPC. More...
 
virtual int getDerivedDisposition (const MWWorld::Ptr &ptr, bool addTemporaryDispositionChange=true)=0
 Calculate the diposition of an NPC toward the player. More...
 
virtual int countDeaths (const std::string &id) const =0
 Return the number of deaths for actors with the given ID. More...
 
virtual bool awarenessCheck (const MWWorld::Ptr &ptr, const MWWorld::Ptr &observer)=0
 Check if observer is potentially aware of ptr. Does not do a line of sight check! More...
 
virtual void startCombat (const MWWorld::Ptr &ptr, const MWWorld::Ptr &target)=0
 Makes ptr fight target. Also shouts a combat taunt. More...
 
virtual bool commitCrime (const MWWorld::Ptr &ptr, const MWWorld::Ptr &victim, OffenseType type, int arg=0, bool victimAware=false)=0
 
virtual bool actorAttacked (const MWWorld::Ptr &victim, const MWWorld::Ptr &attacker)=0
 
virtual void actorKilled (const MWWorld::Ptr &victim, const MWWorld::Ptr &attacker)=0
 
virtual void itemTaken (const MWWorld::Ptr &ptr, const MWWorld::Ptr &item, const MWWorld::Ptr &container, int count)=0
 
virtual void objectOpened (const MWWorld::Ptr &ptr, const MWWorld::Ptr &item)=0
 Utility to check if opening (i.e. unlocking) this object is illegal and calling commitCrime if so. More...
 
virtual bool sleepInBed (const MWWorld::Ptr &ptr, const MWWorld::Ptr &bed)=0
 
virtual void getPersuasionDispositionChange (const MWWorld::Ptr &npc, PersuasionType type, bool &success, float &tempChange, float &permChange)=0
 Perform a persuasion action on NPC. More...
 
virtual void forceStateUpdate (const MWWorld::Ptr &ptr)=0
 Forces an object to refresh its animation state. More...
 
virtual bool playAnimationGroup (const MWWorld::Ptr &ptr, const std::string &groupName, int mode, int number=1, bool persist=false)=0
 
virtual void skipAnimation (const MWWorld::Ptr &ptr)=0
 
virtual bool checkAnimationPlaying (const MWWorld::Ptr &ptr, const std::string &groupName)=0
 
virtual void persistAnimationStates ()=0
 Save the current animation state of managed references to their RefData. More...
 
virtual void updateMagicEffects (const MWWorld::Ptr &ptr)=0
 
virtual bool toggleAI ()=0
 
virtual bool isAIActive ()=0
 
virtual void getObjectsInRange (const osg::Vec3f &position, float radius, std::vector< MWWorld::Ptr > &objects)=0
 
virtual void getActorsInRange (const osg::Vec3f &position, float radius, std::vector< MWWorld::Ptr > &objects)=0
 
virtual std::list< MWWorld::PtrgetActorsSidingWith (const MWWorld::Ptr &actor)=0
 Returns the list of actors which are siding with the given actor in fights. More...
 
virtual std::list< MWWorld::PtrgetActorsFollowing (const MWWorld::Ptr &actor)=0
 
virtual std::list< intgetActorsFollowingIndices (const MWWorld::Ptr &actor)=0
 
virtual std::list< MWWorld::PtrgetActorsFighting (const MWWorld::Ptr &actor)=0
 Returns a list of actors who are fighting the given actor within the fAlarmDistance. More...
 
virtual std::list< MWWorld::PtrgetEnemiesNearby (const MWWorld::Ptr &actor)=0
 
virtual void getActorsFollowing (const MWWorld::Ptr &actor, std::set< MWWorld::Ptr > &out)=0
 Recursive versions of above methods. More...
 
virtual void getActorsSidingWith (const MWWorld::Ptr &actor, std::set< MWWorld::Ptr > &out)=0
 
virtual void playerLoaded ()=0
 
virtual int countSavedGameRecords () const =0
 
virtual void write (ESM::ESMWriter &writer, Loading::Listener &listener) const =0
 
virtual void readRecord (ESM::ESMReader &reader, uint32_t type)=0
 
virtual void clear ()=0
 
virtual bool isAggressive (const MWWorld::Ptr &ptr, const MWWorld::Ptr &target)=0
 
virtual void keepPlayerAlive ()=0
 Resurrects the player if necessary. More...
 
virtual bool isReadyToBlock (const MWWorld::Ptr &ptr) const =0
 
virtual void confiscateStolenItems (const MWWorld::Ptr &player, const MWWorld::Ptr &targetContainer)=0
 
virtual std::vector< std::pair
< std::string, int > > 
getStolenItemOwners (const std::string &itemid)=0
 
virtual bool isItemStolenFrom (const std::string &itemid, const std::string &ownerid)=0
 Has the player stolen this item from the given owner? More...
 
virtual bool isAllowedToUse (const MWWorld::Ptr &ptr, const MWWorld::CellRef &cellref, MWWorld::Ptr &victim)=0
 
virtual void setWerewolf (const MWWorld::Ptr &actor, bool werewolf)=0
 Turn actor into werewolf or normal form. More...
 
virtual void applyWerewolfAcrobatics (const MWWorld::Ptr &actor)=0
 
virtual void cleanupSummonedCreature (const MWWorld::Ptr &caster, int creatureActorId)=0
 

Private Member Functions

 MechanicsManager (const MechanicsManager &)
 not implemented More...
 
MechanicsManageroperator= (const MechanicsManager &)
 not implemented More...
 

Detailed Description

Interface for game mechanics manager (implemented in MWMechanics)

Member Enumeration Documentation

Enumerator
OT_Theft 
OT_Assault 
OT_Murder 
OT_Trespassing 
OT_SleepingInOwnedBed 
OT_Pickpocket 
Enumerator
PT_Admire 
PT_Intimidate 
PT_Taunt 
PT_Bribe10 
PT_Bribe100 
PT_Bribe1000 

Constructor & Destructor Documentation

MWBase::MechanicsManager::MechanicsManager ( const MechanicsManager )
private

not implemented

MWBase::MechanicsManager::MechanicsManager ( )
inline
virtual MWBase::MechanicsManager::~MechanicsManager ( )
inlinevirtual

Member Function Documentation

virtual bool MWBase::MechanicsManager::actorAttacked ( const MWWorld::Ptr victim,
const MWWorld::Ptr attacker 
)
pure virtual
Returns
false if the attack was considered a "friendly hit" and forgiven

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::actorKilled ( const MWWorld::Ptr victim,
const MWWorld::Ptr attacker 
)
pure virtual

Notify that actor was killed, add a murder bounty if applicable

Note
No-op for non-player attackers

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::add ( const MWWorld::Ptr ptr)
pure virtual

Register an object for management.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::advanceTime ( float  duration)
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::applyWerewolfAcrobatics ( const MWWorld::Ptr actor)
pure virtual

Sets the NPC's Acrobatics skill to match the fWerewolfAcrobatics GMST. It only applies to the current form the NPC is in.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual bool MWBase::MechanicsManager::awarenessCheck ( const MWWorld::Ptr ptr,
const MWWorld::Ptr observer 
)
pure virtual

Check if observer is potentially aware of ptr. Does not do a line of sight check!

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual bool MWBase::MechanicsManager::checkAnimationPlaying ( const MWWorld::Ptr ptr,
const std::string &  groupName 
)
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::cleanupSummonedCreature ( const MWWorld::Ptr caster,
int  creatureActorId 
)
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::clear ( )
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual bool MWBase::MechanicsManager::commitCrime ( const MWWorld::Ptr ptr,
const MWWorld::Ptr victim,
OffenseType  type,
int  arg = 0,
bool  victimAware = false 
)
pure virtual
Note
victim may be empty
Parameters
argDepends on type, e.g. for Theft, the value of the item that was stolen.
victimAwareIs the victim already aware of the crime? If this parameter is false, it will be determined by a line-of-sight and awareness check.
Returns
was the crime seen?

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::confiscateStolenItems ( const MWWorld::Ptr player,
const MWWorld::Ptr targetContainer 
)
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual int MWBase::MechanicsManager::countDeaths ( const std::string &  id) const
pure virtual

Return the number of deaths for actors with the given ID.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual int MWBase::MechanicsManager::countSavedGameRecords ( ) const
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::drop ( const MWWorld::CellStore cellStore)
pure virtual

Deregister all objects in the given cell.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::forceStateUpdate ( const MWWorld::Ptr ptr)
pure virtual

Forces an object to refresh its animation state.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual std::list<MWWorld::Ptr> MWBase::MechanicsManager::getActorsFighting ( const MWWorld::Ptr actor)
pure virtual

Returns a list of actors who are fighting the given actor within the fAlarmDistance.

ie AiCombat is active and the target is the actor

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual std::list<MWWorld::Ptr> MWBase::MechanicsManager::getActorsFollowing ( const MWWorld::Ptr actor)
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::getActorsFollowing ( const MWWorld::Ptr actor,
std::set< MWWorld::Ptr > &  out 
)
pure virtual

Recursive versions of above methods.

Implemented in MWMechanics::MechanicsManager.

virtual std::list<int> MWBase::MechanicsManager::getActorsFollowingIndices ( const MWWorld::Ptr actor)
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::getActorsInRange ( const osg::Vec3f &  position,
float  radius,
std::vector< MWWorld::Ptr > &  objects 
)
pure virtual
virtual std::list<MWWorld::Ptr> MWBase::MechanicsManager::getActorsSidingWith ( const MWWorld::Ptr actor)
pure virtual

Returns the list of actors which are siding with the given actor in fights.

ie AiFollow or AiEscort is active and the target is the actor

Implemented in MWMechanics::MechanicsManager.

virtual void MWBase::MechanicsManager::getActorsSidingWith ( const MWWorld::Ptr actor,
std::set< MWWorld::Ptr > &  out 
)
pure virtual
virtual int MWBase::MechanicsManager::getBarterOffer ( const MWWorld::Ptr ptr,
int  basePrice,
bool  buying 
)
pure virtual

This is used by every service to determine the price of objects given the trading skills of the player and NPC.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual int MWBase::MechanicsManager::getDerivedDisposition ( const MWWorld::Ptr ptr,
bool  addTemporaryDispositionChange = true 
)
pure virtual

Calculate the diposition of an NPC toward the player.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual std::list<MWWorld::Ptr> MWBase::MechanicsManager::getEnemiesNearby ( const MWWorld::Ptr actor)
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual int MWBase::MechanicsManager::getHoursToRest ( ) const
pure virtual

Calculate how many hours the player needs to rest in order to be fully healed.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::getObjectsInRange ( const osg::Vec3f &  position,
float  radius,
std::vector< MWWorld::Ptr > &  objects 
)
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::getPersuasionDispositionChange ( const MWWorld::Ptr npc,
PersuasionType  type,
bool success,
float &  tempChange,
float &  permChange 
)
pure virtual

Perform a persuasion action on NPC.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual std::vector<std::pair<std::string, int> > MWBase::MechanicsManager::getStolenItemOwners ( const std::string &  itemid)
pure virtual

List the owners that the player has stolen this item from (the owner can be an NPC or a faction). <Owner, item count>

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual bool MWBase::MechanicsManager::isAggressive ( const MWWorld::Ptr ptr,
const MWWorld::Ptr target 
)
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual bool MWBase::MechanicsManager::isAIActive ( )
pure virtual
virtual bool MWBase::MechanicsManager::isAllowedToUse ( const MWWorld::Ptr ptr,
const MWWorld::CellRef cellref,
MWWorld::Ptr victim 
)
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual bool MWBase::MechanicsManager::isItemStolenFrom ( const std::string &  itemid,
const std::string &  ownerid 
)
pure virtual

Has the player stolen this item from the given owner?

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual bool MWBase::MechanicsManager::isReadyToBlock ( const MWWorld::Ptr ptr) const
pure virtual
virtual void MWBase::MechanicsManager::itemTaken ( const MWWorld::Ptr ptr,
const MWWorld::Ptr item,
const MWWorld::Ptr container,
int  count 
)
pure virtual

Utility to check if taking this item is illegal and calling commitCrime if so

Parameters
containerThe container the item is in; may be empty for an item in the world

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::keepPlayerAlive ( )
pure virtual

Resurrects the player if necessary.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::objectOpened ( const MWWorld::Ptr ptr,
const MWWorld::Ptr item 
)
pure virtual

Utility to check if opening (i.e. unlocking) this object is illegal and calling commitCrime if so.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

MechanicsManager& MWBase::MechanicsManager::operator= ( const MechanicsManager )
private

not implemented

virtual void MWBase::MechanicsManager::persistAnimationStates ( )
pure virtual

Save the current animation state of managed references to their RefData.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual bool MWBase::MechanicsManager::playAnimationGroup ( const MWWorld::Ptr ptr,
const std::string &  groupName,
int  mode,
int  number = 1,
bool  persist = false 
)
pure virtual

Run animation for a MW-reference. Calls to this function for references that are currently not in the scene should be ignored.

Parameters
mode0 normal, 1 immediate start, 2 immediate loop
countHow many times the animation should be run
persistWhether the animation state should be stored in saved games and persist after cell unload.
Returns
Success or error

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::playerLoaded ( )
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::readRecord ( ESM::ESMReader reader,
uint32_t  type 
)
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::remove ( const MWWorld::Ptr ptr)
pure virtual

Deregister an object for management.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::rest ( bool  sleep)
pure virtual

If the player is sleeping or waiting, this should be called every hour.

Parameters
sleepis the player sleeping or waiting?

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::setPlayerBirthsign ( const std::string &  id)
pure virtual

Set player birthsign.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::setPlayerClass ( const std::string &  id)
pure virtual

Set player class to stock class.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::setPlayerClass ( const ESM::Class class_)
pure virtual

Set player class to custom class.

Implemented in MWMechanics::MechanicsManager.

virtual void MWBase::MechanicsManager::setPlayerName ( const std::string &  name)
pure virtual

Set player name.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::setPlayerRace ( const std::string &  id,
bool  male,
const std::string &  head,
const std::string &  hair 
)
pure virtual

Set player race.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::setWerewolf ( const MWWorld::Ptr actor,
bool  werewolf 
)
pure virtual

Turn actor into werewolf or normal form.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::skipAnimation ( const MWWorld::Ptr ptr)
pure virtual

Skip the animation for the given MW-reference for one frame. Calls to this function for references that are currently not in the scene should be ignored.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual bool MWBase::MechanicsManager::sleepInBed ( const MWWorld::Ptr ptr,
const MWWorld::Ptr bed 
)
pure virtual

Attempt sleeping in a bed. If this is illegal, call commitCrime.

Returns
was it illegal, and someone saw you doing it?

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::startCombat ( const MWWorld::Ptr ptr,
const MWWorld::Ptr target 
)
pure virtual

Makes ptr fight target. Also shouts a combat taunt.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual bool MWBase::MechanicsManager::toggleAI ( )
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::update ( float  duration,
bool  paused 
)
pure virtual

Update objects

Parameters
pausedIn game type does not currently advance (this usually means some GUI component is up).

Implemented in MWMechanics::MechanicsManager.

virtual void MWBase::MechanicsManager::updateCell ( const MWWorld::Ptr old,
const MWWorld::Ptr ptr 
)
pure virtual

Moves an object to a new cell.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::updateMagicEffects ( const MWWorld::Ptr ptr)
pure virtual

Update magic effects for an actor. Usually done automatically once per frame, but if we're currently paused we may want to do it manually (after equipping permanent enchantment)

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::watchActor ( const MWWorld::Ptr ptr)
pure virtual

On each update look for changes in a previously registered actor and update the GUI accordingly.

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:

virtual void MWBase::MechanicsManager::write ( ESM::ESMWriter writer,
Loading::Listener listener 
) const
pure virtual

Implemented in MWMechanics::MechanicsManager.

Here is the caller graph for this function:


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