Planeshift
GEMSupervisor Class Reference

This class holds the refs to the core factories, etc in CEL. More...

#include <gem.h>

Public Member Functions

void ActivateNPCs (AccountID superclientID)
 
void AddActorEntity (gemActor *actor)
 
void AddEntity (gemObject *obj, EID objEid)
 Ugly function, used for gemAL. More...
 
void AddItemEntity (gemItem *item)
 
void AttachObject (iObject *object, gemObject *gobject)
 Attach a server gemObject to a Crystal Space object. More...
 
int CountManagedNPCs (AccountID superclientID)
 
EID CreateEntity (gemObject *obj)
 
void FillNPCList (MsgEntry *msg, AccountID superclientID)
 
gemObjectFindAttachedObject (iObject *object)
 See if there is a gemObject attached to a given Crystal Space object. More...
 
csArray< gemObject * > FindNearbyEntities (iSector *sector, const csVector3 &pos, InstanceID instance, float radius, bool doInvisible=false)
 Create a list of all nearby gem objects. More...
 
csArray< gemObject * > FindSectorEntities (iSector *sector, bool doInvisible=false)
 Create a list of all gem objects in a sector. More...
 
 GEMSupervisor (iObjectRegistry *objreg, psDatabase *db, EntityManager *entitymanager, CacheManager *cachemanager)
 Create a new singleton of the GEM Supervisor object. More...
 
void GetAllEntityPos (csArray< psAllEntityPosMessage > &msgs)
 
csHash< gemObject *, EID > & GetAllGEMS ()
 Get a hash of all the current entities on the server. More...
 
void GetPlayerObjects (PID playerID, csArray< gemObject * > &list)
 Gets a list of all the 'live' entities that this player has ownership of. More...
 
void HandleDamageMessage (MsgEntry *me, Client *client)
 
void HandleStatDRUpdateMessage (MsgEntry *me, Client *client)
 
void HandleStatsMessage (MsgEntry *me, Client *client)
 
void RemoveActorEntity (gemActor *actor)
 
void RemoveEntity (gemObject *which)
 
void RemoveItemEntity (gemItem *item, uint32 uid)
 
void RemovePlayerFromLootables (PID playerID)
 
void SendAllNPCStats (AccountID superclientID)
 
void StopAllNPCs (AccountID superclientID)
 
void Teleport (gemObject *object, float x, float y, float z, float rot, const char *sectorname)
 Teleport a player to a location. More...
 
void UnattachObject (iObject *object, gemObject *gobject)
 Unattach a gemObject from a Crystal Space object. More...
 
void UpdateAllDR ()
 
void UpdateAllStats ()
 Searches all actors in the game, and updates their vitals. More...
 
virtual ~GEMSupervisor ()
 Destroy this singleton. More...
 
Search functions
EID FindItemID (psItem *item)
 Find an entity ID (EID) for an item. More...
 
gemObjectFindObject (EID cel_id)
 
gemObjectFindObject (const csString &name)
 
gemActorFindPlayerEntity (PID player_id)
 
gemNPCFindNPCEntity (PID npc_id)
 
gemNPCFindNPCEntity (EID eid)
 
gemItemFindItemEntity (uint32 item_id)
 
- Public Member Functions inherited from MessageManager< GEMSupervisor >
void HandleMessage (MsgEntry *msg, Client *client)
 Transfers the message to the manager specific function. More...
 
void Subscribe (FunctionPointer fpt, msgtype type, uint32_t flags=0x01)
 Subscribes this manager to a specific message type with a custom callback. More...
 
bool Unsubscribe (msgtype type)
 Unsubscribes this manager from a specific message type. More...
 
bool Unsubscribe (FunctionPointer handler, msgtype type)
 Unsubscribes a specific handler from a specific message type. More...
 
bool UnsubscribeAll ()
 Unsubscribes this manager from all message types. More...
 
virtual ~MessageManager ()
 Unsubscribes all messages then destroys this object. More...
 
- Public Member Functions inherited from MessageManagerBase
csArray< csString > DecodeCommandArea (Client *client, csString target)
 Decodes an area: expression. More...
 
gemObjectFindObjectByString (const csString &str, gemActor *me) const
 Find the object we are referring to in str. More...
 
ClientFindPlayerClient (const char *name)
 Finds Client* of character with given name. More...
 
virtual bool Verify (MsgEntry *pMsg, unsigned int flags, Client *&client)
 

Public Attributes

psDatabasedatabase
 The main PlaneShift database object. More...
 
NPCManagernpcmanager
 NPC controller. More...
 
iObjectRegistry * object_reg
 The Crystal Space Object Registry. More...
 

Protected Member Functions

EID GetNextID ()
 Get the next ID for an object. More...
 

Protected Attributes

csHash< gemActor *, PID > actors_by_pid
 A list of all the actors stored by PID (player/character ID). More...
 
csRef< iEngine > engine
 Stored here to save expensive csQueryRegistry calls. More...
 
csHash< gemObject *, EID > entities_by_eid
 A list of all the entities stored by EID (entity/gem ID). More...
 
csHash< gemItem *, uint32 > items_by_uid
 A list of all the items stored by UID (psItem ID). More...
 
uint32 nextEID
 The next ID available for an object. More...
 

Additional Inherited Members

- Public Types inherited from MessageManager< GEMSupervisor >
typedef void(GEMSupervisor::* FunctionPointer) (MsgEntry *, Client *)
 

Detailed Description

This class holds the refs to the core factories, etc in CEL.

Definition at line 126 of file gem.h.

Constructor & Destructor Documentation

GEMSupervisor::GEMSupervisor ( iObjectRegistry *  objreg,
psDatabase db,
EntityManager entitymanager,
CacheManager cachemanager 
)

Create a new singleton of the GEM Supervisor object.

Parameters
objregThe Crystal Space Object Registry.
dbThe main PlaneShift database.
entitymanagerThe EntityManager.
cachemanagerThe CacheManager.
virtual GEMSupervisor::~GEMSupervisor ( )
virtual

Destroy this singleton.

This will only be ever called on a server shutdown.

Member Function Documentation

void GEMSupervisor::ActivateNPCs ( AccountID  superclientID)
void GEMSupervisor::AddActorEntity ( gemActor actor)
void GEMSupervisor::AddEntity ( gemObject obj,
EID  objEid 
)

Ugly function, used for gemAL.

void GEMSupervisor::AddItemEntity ( gemItem item)
void GEMSupervisor::AttachObject ( iObject *  object,
gemObject gobject 
)

Attach a server gemObject to a Crystal Space object.

In most cases this will be a mesh wrapper.

Parameters
objectThe Crystal Space object we want to attach our gemObject to.
gobjectThe PlaneShift object that we want to attach.
int GEMSupervisor::CountManagedNPCs ( AccountID  superclientID)
EID GEMSupervisor::CreateEntity ( gemObject obj)
void GEMSupervisor::FillNPCList ( MsgEntry msg,
AccountID  superclientID 
)
gemObject* GEMSupervisor::FindAttachedObject ( iObject *  object)

See if there is a gemObject attached to a given Crystal Space object.

Parameters
objectThe Cyrstal Space object we want to see if there is an object attached to.
Returns
A gemObject if it exists that is attached to the Crystal Space object.
gemItem* GEMSupervisor::FindItemEntity ( uint32  item_id)
EID GEMSupervisor::FindItemID ( psItem item)

Find an entity ID (EID) for an item.

Parameters
itemThe psItem that we want to find the entity ID for.
Returns
the EID of that item if it was found. 0 if no id could be found.
csArray<gemObject*> GEMSupervisor::FindNearbyEntities ( iSector *  sector,
const csVector3 &  pos,
InstanceID  instance,
float  radius,
bool  doInvisible = false 
)

Create a list of all nearby gem objects.

Parameters
sectorThe sector to check in.
posThe starting position
instanceThe instance ID for the starting point
radiusThe distance around the starting point to check.
doInvisibleIf true check invisible meshes otherwise ignore them.
Returns
A csArray<> of all the objects in the given radius.
gemNPC* GEMSupervisor::FindNPCEntity ( PID  npc_id)
gemNPC* GEMSupervisor::FindNPCEntity ( EID  eid)
gemObject* GEMSupervisor::FindObject ( EID  cel_id)
gemObject* GEMSupervisor::FindObject ( const csString &  name)
gemActor* GEMSupervisor::FindPlayerEntity ( PID  player_id)
csArray<gemObject*> GEMSupervisor::FindSectorEntities ( iSector *  sector,
bool  doInvisible = false 
)

Create a list of all gem objects in a sector.

Parameters
sectorThe sector to check in.
doInvisibleIf true check invisible meshes otherwise ignore them.
Returns
A csArray<> of all the objects in the given radius.
void GEMSupervisor::GetAllEntityPos ( csArray< psAllEntityPosMessage > &  msgs)
csHash<gemObject*, EID>& GEMSupervisor::GetAllGEMS ( )
inline

Get a hash of all the current entities on the server.

Returns
a csHash of all the gemObjects.

Definition at line 157 of file gem.h.

EID GEMSupervisor::GetNextID ( )
protected

Get the next ID for an object.

Returns
The next ID available that can be assigned to an object.
void GEMSupervisor::GetPlayerObjects ( PID  playerID,
csArray< gemObject * > &  list 
)

Gets a list of all the 'live' entities that this player has ownership of.

This can be things like items in containers or work items.

Parameters
playerIDThe character owner ID we are looking for.
listThe populated list of items that are active in game.
void GEMSupervisor::HandleDamageMessage ( MsgEntry me,
Client client 
)
void GEMSupervisor::HandleStatDRUpdateMessage ( MsgEntry me,
Client client 
)
void GEMSupervisor::HandleStatsMessage ( MsgEntry me,
Client client 
)
void GEMSupervisor::RemoveActorEntity ( gemActor actor)
void GEMSupervisor::RemoveEntity ( gemObject which)
void GEMSupervisor::RemoveItemEntity ( gemItem item,
uint32  uid 
)
void GEMSupervisor::RemovePlayerFromLootables ( PID  playerID)
void GEMSupervisor::SendAllNPCStats ( AccountID  superclientID)
void GEMSupervisor::StopAllNPCs ( AccountID  superclientID)
void GEMSupervisor::Teleport ( gemObject object,
float  x,
float  y,
float  z,
float  rot,
const char *  sectorname 
)

Teleport a player to a location.

Parameters
objectThe player to move
xX Location to move to
yY Location to move to
zZ Location to move to
rotThe rotation to use.
sectornameThe sector name to move to.
void GEMSupervisor::UnattachObject ( iObject *  object,
gemObject gobject 
)

Unattach a gemObject from a Crystal Space object.

In most cases the Crystal Space object is a meshwrapper.

Parameters
objectThe Crystal Space object we want to unattach our client object from.
gobjectThe gem object we want to unattach.
void GEMSupervisor::UpdateAllDR ( )
void GEMSupervisor::UpdateAllStats ( )

Searches all actors in the game, and updates their vitals.

Member Data Documentation

csHash<gemActor*, PID> GEMSupervisor::actors_by_pid
protected

A list of all the actors stored by PID (player/character ID).

Definition at line 300 of file gem.h.

psDatabase* GEMSupervisor::database

The main PlaneShift database object.

Definition at line 132 of file gem.h.

csRef<iEngine> GEMSupervisor::engine
protected

Stored here to save expensive csQueryRegistry calls.

Definition at line 305 of file gem.h.

csHash<gemObject*, EID> GEMSupervisor::entities_by_eid
protected

A list of all the entities stored by EID (entity/gem ID).

Definition at line 298 of file gem.h.

csHash<gemItem*, uint32> GEMSupervisor::items_by_uid
protected

A list of all the items stored by UID (psItem ID).

Definition at line 299 of file gem.h.

uint32 GEMSupervisor::nextEID
protected

The next ID available for an object.

Definition at line 302 of file gem.h.

NPCManager* GEMSupervisor::npcmanager

NPC controller.

Definition at line 133 of file gem.h.

iObjectRegistry* GEMSupervisor::object_reg

The Crystal Space Object Registry.

Definition at line 131 of file gem.h.


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