Planeshift
Public Member Functions | Protected Member Functions | Protected Attributes

SpawnManager Class Reference

This class is periodically called by the engine to ensure that monsters (and other NPCs) are respawned appropriately. More...

#include <spawnmanager.h>

List of all members.

Public Member Functions

LootRandomizerGetLootRandomizer ()
 Returns the loot randomizer.
void KillNPC (gemActor *npc, gemActor *killer)
 Sets the NPC as dead, plays the death animation and triggers the loot generator.
void LoadHuntLocations (psSectorInfo *sectorinfo=0)
 Load hunt location.
void LoadSpawnRanges (SpawnRule *rule)
 Load all ranges for a rule.
void PreloadDatabase ()
 Load all rules into memory for future use.
void PreloadLootRules ()
 Load all loot categories into the manager for use in spawn rules.
void RemoveNPC (gemObject *obj)
 Kills the specified NPC, updates the database that he is "dead" and queues him for respawn according to the spawn rules.
void RepopulateItems (psSectorInfo *sectorinfo=0)
 Adds all items to the world.
void RepopulateLive (psSectorInfo *sectorinfo=0)
 Called at server startup to create all creatures currently marked as "living" in the database.
void Respawn (PID playerID, SpawnRule *spawnRule)
 Respawn a NPC given by playerID and find the position from the spawnRule.
void Respawn (psCharacter *chardata, InstanceID instance, csVector3 &where, float rot, const char *sector)
 Respawn a NPC in the given position.
void SpawnHuntLocations (Result &result, psSectorInfo *sectorinfo)
 Used by LoadHuntLocations() to spawn the hunt locations in game.
 SpawnManager (psDatabase *db, CacheManager *cachemanager, EntityManager *entitymanager, GEMSupervisor *gemsupervisor)
virtual ~SpawnManager ()

Protected Member Functions

void HandleDeathEvent (MsgEntry *me, Client *notused)
void HandleLootItem (MsgEntry *me, Client *client)

Protected Attributes

CacheManagercacheManager
psDatabasedatabase
EntityManagerentityManager
GEMSupervisorgem
csHash< LootEntrySet * > looting
LootRandomizerlootRandomizer
csHash< SpawnRule * > rules

Detailed Description

This class is periodically called by the engine to ensure that monsters (and other NPCs) are respawned appropriately.

Definition at line 283 of file spawnmanager.h.


Constructor & Destructor Documentation

SpawnManager::SpawnManager ( psDatabase db,
CacheManager cachemanager,
EntityManager entitymanager,
GEMSupervisor gemsupervisor 
)
virtual SpawnManager::~SpawnManager ( ) [virtual]

Member Function Documentation

LootRandomizer* SpawnManager::GetLootRandomizer ( ) [inline]

Returns the loot randomizer.

Returns:
Returns a reference to the current loot randomizer.

Definition at line 307 of file spawnmanager.h.

void SpawnManager::HandleDeathEvent ( MsgEntry me,
Client notused 
) [protected]
void SpawnManager::HandleLootItem ( MsgEntry me,
Client client 
) [protected]
void SpawnManager::KillNPC ( gemActor npc,
gemActor killer 
)

Sets the NPC as dead, plays the death animation and triggers the loot generator.

Also queues the removal of the corpse.

void SpawnManager::LoadHuntLocations ( psSectorInfo sectorinfo = 0)

Load hunt location.

Parameters:
sectorinfoThe sector to load in. NULL means all sectors.
void SpawnManager::LoadSpawnRanges ( SpawnRule rule)

Load all ranges for a rule.

void SpawnManager::PreloadDatabase ( )

Load all rules into memory for future use.

void SpawnManager::PreloadLootRules ( )

Load all loot categories into the manager for use in spawn rules.

void SpawnManager::RemoveNPC ( gemObject obj)

Kills the specified NPC, updates the database that he is "dead" and queues him for respawn according to the spawn rules.

void SpawnManager::RepopulateItems ( psSectorInfo sectorinfo = 0)

Adds all items to the world.

Called at the server startup to add all the items to the game.

Parameters:
sectorinfoThe sector to respawn the items into. If NULL it will respawn all items in all sectors.
void SpawnManager::RepopulateLive ( psSectorInfo sectorinfo = 0)

Called at server startup to create all creatures currently marked as "living" in the database.

This will restore the server to its last known NPC population if it crashes.

Parameters:
sectorinfoThe sector we want to repopulate. If NULL then respawn all sectors.
void SpawnManager::Respawn ( PID  playerID,
SpawnRule spawnRule 
)

Respawn a NPC given by playerID and find the position from the spawnRule.

void SpawnManager::Respawn ( psCharacter chardata,
InstanceID  instance,
csVector3 &  where,
float  rot,
const char *  sector 
)

Respawn a NPC in the given position.

void SpawnManager::SpawnHuntLocations ( Result result,
psSectorInfo sectorinfo 
)

Used by LoadHuntLocations() to spawn the hunt locations in game.

Parameters:
resultthe result set to use for the spawm
sectorinfoThe sector to load in. NULL means all sectors.

Member Data Documentation

Definition at line 290 of file spawnmanager.h.

Definition at line 286 of file spawnmanager.h.

Definition at line 291 of file spawnmanager.h.

Definition at line 292 of file spawnmanager.h.

csHash<LootEntrySet*> SpawnManager::looting [protected]

Definition at line 288 of file spawnmanager.h.

Definition at line 289 of file spawnmanager.h.

csHash<SpawnRule*> SpawnManager::rules [protected]

Definition at line 287 of file spawnmanager.h.


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