Planeshift
Public Member Functions | Protected Attributes

SpawnRule Class Reference

This class is used to store respawn rules for NPCs. More...

#include <spawnmanager.h>

List of all members.

Public Member Functions

void AddRange (SpawnRange *range)
 Add a spawn range to current rule.
PID CheckSubstitution (PID originalplayer)
 Determine if substitute player should be spawned. Returns either original or substitute.
bool DetermineSpawnLoc (psCharacter *ch, csVector3 &pos, float &angle, csString &sectorname, InstanceID &instance)
 Pick a spot for the entity to respawn.
int GetDeadRemainTime ()
int GetID ()
LootEntrySetGetLootRules ()
 Get the Loot Rule set to generate loot.
int GetMinSpawnSpacingDistance ()
int GetRespawnDelay ()
 Get random value between min and max spawn time, in ticks/msecs.
void Initialize (int idval, int minspawn, int maxspawn, float substodds, int substplayer, float x, float y, float z, float angle, const char *sector, LootEntrySet *loot_id, int dead_time, float minSpacing, InstanceID instance)
 Setup variables.
void SetID (int idval)
 SpawnRule ()
 Ctor clears all to zero.
 ~SpawnRule ()

Protected Attributes

int dead_remain_time
InstanceID fixedinstance
float fixedspawnrot
csString fixedspawnsector
float fixedspawnx
 If ranges are populated, these are ignored.
float fixedspawny
float fixedspawnz
int id
 Unique Id used for ident and tree sorting.
LootEntrySetloot
 Rules for generating loot when this npc is killed.
int maxspawntime
 Maximum respawn delay in ticks.
float minSpawnSpacingDistance
 What should the free space be around before spawn position is accepted.
int minspawntime
 Minimum respawn delay in ticks (msec)
csRandomGen * randomgen
csHash< SpawnRange * > ranges
 Spawn ranges for the current rule.
PID substituteplayer
 Player id to respawn if substitution spawn odds are met.
float substitutespawnodds
 Odds of substitute spawn triggering instead of respawn of same entity.

Detailed Description

This class is used to store respawn rules for NPCs.

They are loaded from the database at startup and used only in RAM thereafter.

Definition at line 118 of file spawnmanager.h.


Constructor & Destructor Documentation

SpawnRule::SpawnRule ( )

Ctor clears all to zero.

SpawnRule::~SpawnRule ( )

Member Function Documentation

void SpawnRule::AddRange ( SpawnRange range)

Add a spawn range to current rule.

PID SpawnRule::CheckSubstitution ( PID  originalplayer)

Determine if substitute player should be spawned. Returns either original or substitute.

bool SpawnRule::DetermineSpawnLoc ( psCharacter ch,
csVector3 &  pos,
float angle,
csString &  sectorname,
InstanceID instance 
)

Pick a spot for the entity to respawn.

Returns:
True if this is a random area rule, or false if it is a fixed position.
int SpawnRule::GetDeadRemainTime ( ) [inline]

Definition at line 206 of file spawnmanager.h.

int SpawnRule::GetID ( ) [inline]

Definition at line 175 of file spawnmanager.h.

LootEntrySet* SpawnRule::GetLootRules ( ) [inline]

Get the Loot Rule set to generate loot.

Definition at line 201 of file spawnmanager.h.

int SpawnRule::GetMinSpawnSpacingDistance ( ) [inline]

Definition at line 211 of file spawnmanager.h.

int SpawnRule::GetRespawnDelay ( )

Get random value between min and max spawn time, in ticks/msecs.

void SpawnRule::Initialize ( int  idval,
int  minspawn,
int  maxspawn,
float  substodds,
int  substplayer,
float  x,
float  y,
float  z,
float  angle,
const char *  sector,
LootEntrySet loot_id,
int  dead_time,
float  minSpacing,
InstanceID  instance 
)

Setup variables.

void SpawnRule::SetID ( int  idval) [inline]

Definition at line 179 of file spawnmanager.h.


Member Data Documentation

Definition at line 154 of file spawnmanager.h.

Definition at line 145 of file spawnmanager.h.

Definition at line 143 of file spawnmanager.h.

csString SpawnRule::fixedspawnsector [protected]

Definition at line 144 of file spawnmanager.h.

If ranges are populated, these are ignored.

Definition at line 140 of file spawnmanager.h.

Definition at line 141 of file spawnmanager.h.

Definition at line 142 of file spawnmanager.h.

int SpawnRule::id [protected]

Unique Id used for ident and tree sorting.

Definition at line 125 of file spawnmanager.h.

Rules for generating loot when this npc is killed.

Definition at line 152 of file spawnmanager.h.

Maximum respawn delay in ticks.

Definition at line 131 of file spawnmanager.h.

What should the free space be around before spawn position is accepted.

Definition at line 146 of file spawnmanager.h.

Minimum respawn delay in ticks (msec)

Definition at line 128 of file spawnmanager.h.

csRandomGen* SpawnRule::randomgen [protected]

Definition at line 122 of file spawnmanager.h.

csHash<SpawnRange*> SpawnRule::ranges [protected]

Spawn ranges for the current rule.

Definition at line 149 of file spawnmanager.h.

PID SpawnRule::substituteplayer [protected]

Player id to respawn if substitution spawn odds are met.

Definition at line 137 of file spawnmanager.h.

Odds of substitute spawn triggering instead of respawn of same entity.

Definition at line 134 of file spawnmanager.h.


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