Planeshift
|
This class is periodically called by the engine to ensure that monsters (and other NPCs) are respawned appropriately. More...
#include <spawnmanager.h>
Public Member Functions | |
LootRandomizer * | GetLootRandomizer () |
Returns the loot randomizer. More... | |
void | KillNPC (gemActor *npc, gemActor *killer) |
Sets the NPC as dead, plays the death animation and triggers the loot generator. More... | |
void | LoadHuntLocations (psSectorInfo *sectorinfo=0) |
Load hunt location. More... | |
void | LoadSpawnRanges (SpawnRule *rule) |
Load all ranges for a rule. More... | |
void | PreloadDatabase () |
Load all rules into memory for future use. More... | |
void | PreloadLootRules () |
Load all loot categories into the manager for use in spawn rules. More... | |
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. More... | |
void | RepopulateItems (psSectorInfo *sectorinfo=0) |
Adds all items to the world. More... | |
void | RepopulateLive (psSectorInfo *sectorinfo=0) |
Called at server startup to create all creatures currently marked as "living" in the database. More... | |
void | Respawn (PID playerID, SpawnRule *spawnRule) |
Respawn a NPC given by playerID and find the position from the spawnRule. More... | |
void | Respawn (psCharacter *chardata, InstanceID instance, csVector3 &where, float rot, const char *sector) |
Respawn a NPC in the given position. More... | |
void | SpawnHuntLocations (Result &result, psSectorInfo *sectorinfo) |
Used by LoadHuntLocations() to spawn the hunt locations in game. More... | |
SpawnManager (psDatabase *db, CacheManager *cachemanager, EntityManager *entitymanager, GEMSupervisor *gemsupervisor) | |
virtual | ~SpawnManager () |
![]() | |
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... | |
![]() | |
csArray< csString > | DecodeCommandArea (Client *client, csString target) |
Decodes an area: expression. More... | |
gemObject * | FindObjectByString (const csString &str, gemActor *me) const |
Find the object we are referring to in str. More... | |
Client * | FindPlayerClient (const char *name) |
Finds Client* of character with given name. More... | |
virtual bool | Verify (MsgEntry *pMsg, unsigned int flags, Client *&client) |
Protected Member Functions | |
void | HandleDeathEvent (MsgEntry *me, Client *notused) |
void | HandleLootItem (MsgEntry *me, Client *client) |
Protected Attributes | |
CacheManager * | cacheManager |
psDatabase * | database |
EntityManager * | entityManager |
GEMSupervisor * | gem |
csHash< LootEntrySet * > | looting |
LootRandomizer * | lootRandomizer |
csHash< SpawnRule * > | rules |
Additional Inherited Members | |
![]() | |
typedef void(SpawnManager::* | FunctionPointer) (MsgEntry *, Client *) |
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.
SpawnManager::SpawnManager | ( | psDatabase * | db, |
CacheManager * | cachemanager, | ||
EntityManager * | entitymanager, | ||
GEMSupervisor * | gemsupervisor | ||
) |
|
virtual |
|
inline |
Returns the loot randomizer.
Definition at line 307 of file spawnmanager.h.
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.
sectorinfo | The 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.
sectorinfo | The 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.
sectorinfo | The 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.
result | the result set to use for the spawm |
sectorinfo | The sector to load in. NULL means all sectors. |
|
protected |
Definition at line 290 of file spawnmanager.h.
|
protected |
Definition at line 286 of file spawnmanager.h.
|
protected |
Definition at line 291 of file spawnmanager.h.
|
protected |
Definition at line 292 of file spawnmanager.h.
|
protected |
Definition at line 288 of file spawnmanager.h.
|
protected |
Definition at line 289 of file spawnmanager.h.
|
protected |
Definition at line 287 of file spawnmanager.h.