Planeshift
psNPCClient Class Reference

The main NPC Client class holding references to important superclient objects. More...

#include <npcclient.h>

Classes

struct  DeferredNPC
 Keep information about deferred NPCs during loading. More...
 

Public Member Functions

void Add (gemNPCObject *object)
 
bool AddNPCType (csString newType)
 Add an NPCType. More...
 
void AddRaceInfo (const psNPCRaceListMessage::NPCRaceInfo_t &raceInfo)
 Add a race info to the race info list. More...
 
void AttachNPC (gemNPCActor *actor, uint8_t DRcounter, EID ownerEID, PID masterID)
 
void AttachObject (iObject *object, gemNPCObject *gobject)
 Attach a server gemObject to a Crystal Space object. More...
 
virtual void CatchCommand (const char *cmd)
 Catch a command from the console. More...
 
bool CheckAttachTribes (NPC *npc)
 Loop through every tribe and check if this npc is a member. More...
 
void Disconnect ()
 Disconnect from server nicely, before quitting. More...
 
bool DumpNPC (const char *pattern)
 Find one npc and print its current state info. More...
 
bool DumpRace (const char *pattern)
 Dump all race infos. More...
 
void EnableDisableNPCs (const char *pattern, bool enable)
 Enable or disable NPCs. More...
 
gemNPCObjectFindAttachedObject (iObject *object)
 See if there is a gemObject attached to a given Crystal Space object. More...
 
gemNPCObjectFindCharacterID (PID pid)
 
csList< Edge * > FindEdgeRoute (Waypoint *start, Waypoint *end, const psPathNetwork::RouteFilter *filter)
 Find the shortest route between waypoint start and stop. More...
 
gemNPCObjectFindEntityByName (const char *name)
 Find named entity. More...
 
gemNPCObjectFindEntityID (EID eid)
 
LocationTypeFindLocation (const char *locname)
 Find a location with a given name. More...
 
LocationFindLocation (const char *loctype, const char *name)
 This function handles the searching for the specified object type and basically does the work for the <locate> script command. More...
 
csArray< gemNPCActor * > FindNearbyActors (iSector *sector, const csVector3 &pos, float radius, bool doInvisible=false)
 Create a list of all nearby gem actors. More...
 
csArray< gemNPCObject * > FindNearbyEntities (iSector *sector, const csVector3 &pos, float radius, bool doInvisible=false)
 Create a list of all nearby gem objects. More...
 
LocationFindNearestLocation (const char *loctype, csVector3 &pos, iSector *sector, float range=-1, float *found_range=NULL)
 This function handles the searching for the specified object type and basically does the work for the <locate> script command. More...
 
WaypointFindNearestWaypoint (const csVector3 &v, iSector *sector, float range=-1, float *found_range=NULL)
 This iterates over all waypoints and finds the nearest one. More...
 
WaypointFindNearestWaypoint (const char *group, csVector3 &v, iSector *sector, float range=-1, float *found_range=NULL)
 This iterates over all waypoints and finds the nearest one with the given group. More...
 
WaypointFindNearestWaypoint (gemNPCObject *entity, float range, float *found_range)
 Return the nearest waypoint to the entity. More...
 
NPCFindNPC (EID entid)
 Find the NPC* attached to the entity with the specified EID. More...
 
NPCFindNPCByPID (PID character_id)
 Find the NPC* attached to the entity with the specified character ID. More...
 
NPCTypeFindNPCType (const char *npctype_name)
 This function handles the searching for the specified NPCType name so that other NPCTypes can subclass an existing one. More...
 
psPathFindPath (const char *name)
 Find a given path. More...
 
LocationFindRandomLocation (const char *loctype, csVector3 &pos, iSector *sector, float range=-1, float *found_range=NULL)
 This function handles the searching for the specified object type and basically does the work for the <locate> script command. More...
 
WaypointFindRandomWaypoint (const csVector3 &v, iSector *sector, float range=-1, float *found_range=NULL)
 This iterates over all waypoints and finds the nearest one. More...
 
WaypointFindRandomWaypoint (const char *group, csVector3 &v, iSector *sector, float range=-1, float *found_range=NULL)
 This iterates over all waypoints and finds the nearest one with the given group. More...
 
LocationTypeFindRegion (const char *regname)
 Find a region with a given name. More...
 
WaypointFindWaypoint (gemNPCObject *entity)
 This iterates over all waypoints and finds the one the entity is at. More...
 
WaypointFindWaypoint (int id)
 This iterates over all waypoints and finds the one with the given id. More...
 
WaypointFindWaypoint (const char *name, WaypointAlias **alias)
 This iterates over all waypoints and finds the one with the given name. More...
 
csList< Waypoint * > FindWaypointRoute (Waypoint *start, Waypoint *end, const psPathNetwork::RouteFilter *filter)
 Find the shortest route between waypoint start and stop. More...
 
bool FirePerception (int NPCId, const char *perception)
 Fire perception. More...
 
iCollideSystem * GetCollDetSys ()
 
iEngine * GetEngine ()
 
EventManagerGetEventManager ()
 Returns the Event Manger. More...
 
LocationManagerGetLocationManager ()
 Return the location manager of the npcclient. More...
 
MathScriptEngineGetMathScriptEngine ()
 Returns the Math Scripting Engine. More...
 
iCelHNavStruct * GetNavStruct ()
 
psNetConnectionGetNetConnection ()
 Returns the network handler so script ops can invoke the network. More...
 
NetworkManagerGetNetworkMgr ()
 Returns the network handler so script ops can invoke the network. More...
 
size_t GetNpcListAmount ()
 List the amount of npc currently loaded. More...
 
iObjectRegistry * GetObjectReg ()
 Just make iObjectRegistry available to other classes. More...
 
psPathNetworkGetPathNetwork ()
 Return the path network of the npcclient. More...
 
psNPCRaceListMessage::NPCRaceInfo_tGetRaceInfo (const char *name)
 Get pointer to a race info to the given race name. More...
 
csPtr< iDocumentNode > GetRootNode (const char *xmlfile)
 Load and return the root node of an xml file. More...
 
float GetRunVelocity (csString &race)
 Find the run velocity for a given race. More...
 
unsigned int GetTickCounter () const
 Retrive the current tick counter. More...
 
TribeGetTribe (int id)
 Make a tribe pointer available - for the network manager. More...
 
iVFS * GetVFS ()
 
float GetWalkVelocity (csString &race)
 Find the walk velocity for a given race. More...
 
psWorldGetWorld ()
 
void HandleDeath (NPC *who)
 Special handling for death notifications from the server is required, to stop behavior scripting, delete hate lists, etc. More...
 
bool InfoNPC (const char *pattern)
 Find one npc and print its current info. More...
 
bool Initialize (iObjectRegistry *object_reg, const char *host, const char *user, const char *pass, int port)
 Initialize the superclient. More...
 
bool IsReady ()
 If a world is ready and loaded this returns true. More...
 
void ListAllEntities (const char *pattern, bool onlyCharacters=false)
 List all known entities on superclient. More...
 
void ListAllNPCs (const char *pattern)
 List all NPCs matching pattern to console. More...
 
void ListLocations (const char *pattern)
 List all locations matching pattern to console. More...
 
void ListPaths (const char *pattern)
 List all paths matching pattern to console. More...
 
void ListReactions (const char *pattern)
 List all the registered reactions. More...
 
void ListTribeRecipes (const char *tribeID)
 List all the active recipes in a tribe. More...
 
void ListTribes (const char *pattern)
 List all tribes matching pattern to console. More...
 
void ListWaypoints (const char *pattern)
 List all waypoints matching pattern to console. More...
 
void LoadCompleted ()
 To be called when the the load process is completed. More...
 
void LoadLogSettings ()
 Used to load the log settings. More...
 
bool LoadMap (const char *mapfile)
 Load a map into a region. More...
 
bool LoadNPCTypes (iDocumentNode *root)
 Decode a npc type from the XML definition. More...
 
bool LoadNPCTypes ()
 Load NPC Types from DB. More...
 
bool LoadPathNetwork ()
 made public for the networkmanager to call it More...
 
void MainLoop ()
 Load and fork off a new thread for the Server Console. More...
 
 psNPCClient ()
 Constructor. More...
 
NPCReadMasteredNPC (PID char_id, PID master_id)
 Clones a master npc to a new npc whith the passed PID. More...
 
NPCReadSingleNPC (PID char_id, PID master_id=0)
 
void RegisterReaction (NPC *npc, Reaction *reaction)
 Register a reaction for an NPC with the client. More...
 
void Remove (gemNPCObject *object)
 
void Remove (NPC *npc)
 Remove NPC from NPC Client. More...
 
void RemoveAll ()
 
void SaveLogSettings ()
 Used to save the log settings. More...
 
void SetEntityPos (EID id, csVector3 &pos, iSector *sector, InstanceID instance, bool force=false)
 SetEntityPos finds the given ID entity, and updates its position in mesh and linmove. More...
 
iCelHPath * ShortestPath (NPC *npc, const csVector3 &from, iSector *fromSector, const csVector3 &goal, iSector *goalSector)
 
void Tick ()
 This does 1 AI calc per Tribe then returns. More...
 
void TriggerEvent (Perception *pcpt, float maxRange=-1.0, csVector3 *basePos=NULL, iSector *baseSector=NULL, bool sameSector=false)
 Sends a perception to all npcs. More...
 
void UnattachObject (iObject *object, gemNPCObject *gobject)
 Unattach a gemObject from a Crystal Space object. More...
 
void UpdateTime (int minute, int hour, int day, int month, int year)
 Update with time from server in order to start timed events. More...
 
 ~psNPCClient ()
 Cleans up all allocated memory and removes all the players from the world. More...
 
Game time

Functions to retrive the game time.

int GetGameTODMinute ()
 Get the minute of the game time of day. More...
 
int GetGameTODHour ()
 Get the hour of the game time of day. More...
 
int GetGameTODDay ()
 Get the day of the game time of day. More...
 
int GetGameTODMonth ()
 Get the month of the game time of day. More...
 
int GetGameTODYear ()
 Get the year of the game time of day. More...
 
iScriptableVar implementation

Functions that implement the iScriptableVar interface.

virtual double GetProperty (MathEnvironment *env, const char *ptr)
 
virtual double CalcFunction (MathEnvironment *env, const char *functionName, const double *params)
 
virtual const char * ToString ()
 
- Public Member Functions inherited from iCommandCatcher
virtual ~iCommandCatcher ()
 
- Public Member Functions inherited from iScriptableVar
virtual ~iScriptableVar ()
 

Static Public Attributes

static psNPCClientnpcclient
 

Protected Member Functions

bool LoadLocations ()
 Load locations from the DB. More...
 
bool LoadTribes ()
 Load Tribes from the DB. More...
 
void PerceptProximityItems ()
 Find all items that are close to NPC's and percept the NPC. More...
 
void PerceptProximityLocations ()
 Find all locations that are close to NPC's and percept the NPC. More...
 
void PerceptProximityTribeHome ()
 Find all actors that are in a tribe home and percept tribe and actor if it is an NPC. More...
 
bool ReadNPCsFromDatabase ()
 Read NPCs from the DB. More...
 

Protected Attributes

csArray< gemNPCActor * > all_gem_actors
 
csArray< gemNPCItem * > all_gem_items
 
csPDelArray< gemNPCObjectall_gem_objects
 
csHash< gemNPCObject *, EID > all_gem_objects_by_eid
 
csHash< gemNPCObject *, PID > all_gem_objects_by_pid
 
csHash< NPC *, csString > allReactions
 Hash of all registered reactions. More...
 
csRef< iCollideSystem > cdsys
 
csRef< iConfigManager > configmanager
 
psNetConnectionconnection
 
int current_long_range_perception_index
 Counters used to distribute load regarding perception generation. More...
 
int current_long_range_perception_loc_index
 
int current_tribe_home_perception_index
 
psDatabasedatabase
 
csRef< iEngine > engine
 
EventManagereventmanager
 
int gameDay
 
int gameHour
 
int gameMinute
 
int gameMonth
 
csTicks gameTimeUpdated
 
int gameYear
 
LocationManagerlocationManager
 The manager for location. More...
 
MathScriptEnginemathScriptEngine
 
csRef< MsgHandlermsghandler
 
csRef< iCelHNavStruct > navStruct
 
NetworkManagernetwork
 
csArray< csString > notUsedReactions
 List of not matched reactions. More...
 
csPDelArray< NPCnpcs
 
csArray< DeferredNPCnpcsDeferred
 
csHash< NPCType *, const char * > npctypes
 
iObjectRegistry * objreg
 
psPathNetworkpathNetwork
 
csHash< psNPCRaceListMessage::NPCRaceInfo_t, csString > raceInfos
 Information about all the races. More...
 
RecipeManagerrecipemanager
 
ServerConsoleserverconsole
 
unsigned int tick_counter
 Counter used to start events at every nth client tick. More...
 
csPDelArray< Tribetribes
 
csRef< iVFS > vfs
 
psWorldworld
 

Detailed Description

The main NPC Client class holding references to important superclient objects.

Definition at line 81 of file npcclient.h.

Constructor & Destructor Documentation

psNPCClient::psNPCClient ( )

Constructor.

Create the NPC Client application class.

psNPCClient::~psNPCClient ( )

Cleans up all allocated memory and removes all the players from the world.

Member Function Documentation

void psNPCClient::Add ( gemNPCObject object)
bool psNPCClient::AddNPCType ( csString  newType)

Add an NPCType.

Upon loading a tribe, the Recipe Manager creates a NPCType and uses this method to Put the assembled npctype into the npctypes map.

Parameters
newTypeString containing the npctype in xml format.
Returns
False if any error is encountered, true otherwise.
void psNPCClient::AddRaceInfo ( const psNPCRaceListMessage::NPCRaceInfo_t raceInfo)

Add a race info to the race info list.

void psNPCClient::AttachNPC ( gemNPCActor actor,
uint8_t  DRcounter,
EID  ownerEID,
PID  masterID 
)
void psNPCClient::AttachObject ( iObject *  object,
gemNPCObject 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.
virtual double psNPCClient::CalcFunction ( MathEnvironment env,
const char *  functionName,
const double *  params 
)
virtual

Implements iScriptableVar.

virtual void psNPCClient::CatchCommand ( const char *  cmd)
virtual

Catch a command from the console.

Parameters
cmdThe command.

Implements iCommandCatcher.

bool psNPCClient::CheckAttachTribes ( NPC npc)

Loop through every tribe and check if this npc is a member.

Returns
false if tribe member and failed to attach, otherwise true
void psNPCClient::Disconnect ( )

Disconnect from server nicely, before quitting.

bool psNPCClient::DumpNPC ( const char *  pattern)

Find one npc and print its current state info.

bool psNPCClient::DumpRace ( const char *  pattern)

Dump all race infos.

void psNPCClient::EnableDisableNPCs ( const char *  pattern,
bool  enable 
)

Enable or disable NPCs.

Alter the Disabled state of NPCs.

Parameters
patternUsed to mach NPC(s) to enable or disable.
enableSet to true if the NPC should be enabled.
gemNPCObject* psNPCClient::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 gemNPCObject if it exists that is attached to the Crystal Space object.
gemNPCObject* psNPCClient::FindCharacterID ( PID  pid)
csList<Edge*> psNPCClient::FindEdgeRoute ( Waypoint start,
Waypoint end,
const psPathNetwork::RouteFilter filter 
)

Find the shortest route between waypoint start and stop.

gemNPCObject* psNPCClient::FindEntityByName ( const char *  name)

Find named entity.

Return first entity that macht the given name.

gemNPCObject* psNPCClient::FindEntityID ( EID  eid)
LocationType* psNPCClient::FindLocation ( const char *  locname)

Find a location with a given name.

This function handles the searching for the specified location type so that other functions can refer to the location type directly.

Location* psNPCClient::FindLocation ( const char *  loctype,
const char *  name 
)

This function handles the searching for the specified object type and basically does the work for the <locate> script command.

csArray<gemNPCActor*> psNPCClient::FindNearbyActors ( iSector *  sector,
const csVector3 &  pos,
float  radius,
bool  doInvisible = false 
)

Create a list of all nearby gem actors.

Parameters
sectorThe sector to check in.
posThe starting position
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.
csArray<gemNPCObject*> psNPCClient::FindNearbyEntities ( iSector *  sector,
const csVector3 &  pos,
float  radius,
bool  doInvisible = false 
)

Create a list of all nearby gem objects.

Parameters
sectorThe sector to check in.
posThe starting position
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.
Location* psNPCClient::FindNearestLocation ( const char *  loctype,
csVector3 &  pos,
iSector *  sector,
float  range = -1,
float found_range = NULL 
)

This function handles the searching for the specified object type and basically does the work for the <locate> script command.

Waypoint* psNPCClient::FindNearestWaypoint ( const csVector3 &  v,
iSector *  sector,
float  range = -1,
float found_range = NULL 
)

This iterates over all waypoints and finds the nearest one.

There is probably a more efficient structure to accomplish this.

Waypoint* psNPCClient::FindNearestWaypoint ( const char *  group,
csVector3 &  v,
iSector *  sector,
float  range = -1,
float found_range = NULL 
)

This iterates over all waypoints and finds the nearest one with the given group.

There is probably a more efficient structure to accomplish this.

Waypoint* psNPCClient::FindNearestWaypoint ( gemNPCObject entity,
float  range,
float found_range 
)

Return the nearest waypoint to the entity.

NPC* psNPCClient::FindNPC ( EID  entid)

Find the NPC* attached to the entity with the specified EID.

Parameters
entidThe EID of the NPC to find.
Returns
The NPC or NULL if no NPC with this EID was found.
NPC* psNPCClient::FindNPCByPID ( PID  character_id)

Find the NPC* attached to the entity with the specified character ID.

Parameters
character_idThe PID of the NPC to find.
Returns
The NPC or NULL if no NPC with this PID was found.
NPCType* psNPCClient::FindNPCType ( const char *  npctype_name)

This function handles the searching for the specified NPCType name so that other NPCTypes can subclass an existing one.

psPath* psNPCClient::FindPath ( const char *  name)

Find a given path.

Parameters
nameThe name of the path.
Returns
The path or NULL if no path was found.
Location* psNPCClient::FindRandomLocation ( const char *  loctype,
csVector3 &  pos,
iSector *  sector,
float  range = -1,
float found_range = NULL 
)

This function handles the searching for the specified object type and basically does the work for the <locate> script command.

Waypoint* psNPCClient::FindRandomWaypoint ( const csVector3 &  v,
iSector *  sector,
float  range = -1,
float found_range = NULL 
)

This iterates over all waypoints and finds the nearest one.

There is probably a more efficient structure to accomplish this.

Waypoint* psNPCClient::FindRandomWaypoint ( const char *  group,
csVector3 &  v,
iSector *  sector,
float  range = -1,
float found_range = NULL 
)

This iterates over all waypoints and finds the nearest one with the given group.

There is probably a more efficient structure to accomplish this.

LocationType* psNPCClient::FindRegion ( const char *  regname)

Find a region with a given name.

This function handles the searching for the specified region name so that other functions can refer to the region directly.

Waypoint* psNPCClient::FindWaypoint ( gemNPCObject entity)

This iterates over all waypoints and finds the one the entity is at.

There is probably a more efficient structure to accomplish this.

Waypoint* psNPCClient::FindWaypoint ( int  id)

This iterates over all waypoints and finds the one with the given id.

There is probably a more efficient structure to accomplish this.

Waypoint* psNPCClient::FindWaypoint ( const char *  name,
WaypointAlias **  alias 
)

This iterates over all waypoints and finds the one with the given name.

There is probably a more efficient structure to accomplish this.

csList<Waypoint*> psNPCClient::FindWaypointRoute ( Waypoint start,
Waypoint end,
const psPathNetwork::RouteFilter filter 
)

Find the shortest route between waypoint start and stop.

bool psNPCClient::FirePerception ( int  NPCId,
const char *  perception 
)

Fire perception.

Method used by the console command 'fireperc'. It fires a perception on the given npc.

Parameters
NPCIdNPC on which to fire perc
perceptionThe perception to fire
Returns
True if npc is found and perception is sent. False otherwise (doh!)
iCollideSystem* psNPCClient::GetCollDetSys ( )
inline

Definition at line 508 of file npcclient.h.

iEngine* psNPCClient::GetEngine ( )
inline

Definition at line 550 of file npcclient.h.

EventManager* psNPCClient::GetEventManager ( )
inline

Returns the Event Manger.

Returns
Returns a ptr to the event manager.

Definition at line 342 of file npcclient.h.

int psNPCClient::GetGameTODDay ( )
inline

Get the day of the game time of day.

Definition at line 584 of file npcclient.h.

int psNPCClient::GetGameTODHour ( )
inline

Get the hour of the game time of day.

Definition at line 576 of file npcclient.h.

int psNPCClient::GetGameTODMinute ( )
inline

Get the minute of the game time of day.

Definition at line 568 of file npcclient.h.

int psNPCClient::GetGameTODMonth ( )
inline

Get the month of the game time of day.

Definition at line 592 of file npcclient.h.

int psNPCClient::GetGameTODYear ( )
inline

Get the year of the game time of day.

Definition at line 600 of file npcclient.h.

LocationManager* psNPCClient::GetLocationManager ( )
inline

Return the location manager of the npcclient.

Definition at line 718 of file npcclient.h.

MathScriptEngine* psNPCClient::GetMathScriptEngine ( )
inline

Returns the Math Scripting Engine.

Returns
Returns a ptr to the math script engine.

Definition at line 352 of file npcclient.h.

iCelHNavStruct* psNPCClient::GetNavStruct ( )
inline

Definition at line 538 of file npcclient.h.

psNetConnection* psNPCClient::GetNetConnection ( )
inline

Returns the network handler so script ops can invoke the network.

Definition at line 309 of file npcclient.h.

NetworkManager* psNPCClient::GetNetworkMgr ( )
inline

Returns the network handler so script ops can invoke the network.

Definition at line 301 of file npcclient.h.

size_t psNPCClient::GetNpcListAmount ( )
inline

List the amount of npc currently loaded.

Definition at line 416 of file npcclient.h.

iObjectRegistry* psNPCClient::GetObjectReg ( )
inline

Just make iObjectRegistry available to other classes.

Definition at line 123 of file npcclient.h.

psPathNetwork* psNPCClient::GetPathNetwork ( )
inline

Return the path network of the npcclient.

Definition at line 710 of file npcclient.h.

virtual double psNPCClient::GetProperty ( MathEnvironment env,
const char *  ptr 
)
virtual

Implements iScriptableVar.

psNPCRaceListMessage::NPCRaceInfo_t* psNPCClient::GetRaceInfo ( const char *  name)

Get pointer to a race info to the given race name.

csPtr<iDocumentNode> psNPCClient::GetRootNode ( const char *  xmlfile)

Load and return the root node of an xml file.

Parameters
xmlfileName of the xml file to find the root node of.
float psNPCClient::GetRunVelocity ( csString &  race)

Find the run velocity for a given race.

unsigned int psNPCClient::GetTickCounter ( ) const
inline

Retrive the current tick counter.

Definition at line 424 of file npcclient.h.

Tribe* psNPCClient::GetTribe ( int  id)

Make a tribe pointer available - for the network manager.

iVFS* psNPCClient::GetVFS ( )
inline

Definition at line 555 of file npcclient.h.

float psNPCClient::GetWalkVelocity ( csString &  race)

Find the walk velocity for a given race.

psWorld* psNPCClient::GetWorld ( )
inline

Definition at line 545 of file npcclient.h.

void psNPCClient::HandleDeath ( NPC who)

Special handling for death notifications from the server is required, to stop behavior scripting, delete hate lists, etc.

bool psNPCClient::InfoNPC ( const char *  pattern)

Find one npc and print its current info.

bool psNPCClient::Initialize ( iObjectRegistry *  object_reg,
const char *  host,
const char *  user,
const char *  pass,
int  port 
)

Initialize the superclient.

Starts a thread for the Network, Message Handler. Also binds the status socket for the network.

Parameters
object_regThe object registry
hostThe host that keeps the DB.
userThe user for the DB.
passThe password for the DB.
portThe port for the DB.
Returns
True if the initialization went ok.
bool psNPCClient::IsReady ( )

If a world is ready and loaded this returns true.

void psNPCClient::ListAllEntities ( const char *  pattern,
bool  onlyCharacters = false 
)

List all known entities on superclient.

void psNPCClient::ListAllNPCs ( const char *  pattern)

List all NPCs matching pattern to console.

void psNPCClient::ListLocations ( const char *  pattern)

List all locations matching pattern to console.

void psNPCClient::ListPaths ( const char *  pattern)

List all paths matching pattern to console.

void psNPCClient::ListReactions ( const char *  pattern)

List all the registered reactions.

void psNPCClient::ListTribeRecipes ( const char *  tribeID)

List all the active recipes in a tribe.

void psNPCClient::ListTribes ( const char *  pattern)

List all tribes matching pattern to console.

void psNPCClient::ListWaypoints ( const char *  pattern)

List all waypoints matching pattern to console.

void psNPCClient::LoadCompleted ( )

To be called when the the load process is completed.

bool psNPCClient::LoadLocations ( )
protected

Load locations from the DB.

void psNPCClient::LoadLogSettings ( )

Used to load the log settings.

bool psNPCClient::LoadMap ( const char *  mapfile)

Load a map into a region.

This is a copy of code from entitymanager->CreateRoom().

Parameters
mapfileA file with maps to load.
bool psNPCClient::LoadNPCTypes ( iDocumentNode *  root)

Decode a npc type from the XML definition.

Parameters
rootThe document node that containts a NPC type.
bool psNPCClient::LoadNPCTypes ( )

Load NPC Types from DB.

bool psNPCClient::LoadPathNetwork ( )

made public for the networkmanager to call it

bool psNPCClient::LoadTribes ( )
protected

Load Tribes from the DB.

void psNPCClient::MainLoop ( )

Load and fork off a new thread for the Server Console.

Then start EventManager's main loop, processing all network and server events.

void psNPCClient::PerceptProximityItems ( )
protected

Find all items that are close to NPC's and percept the NPC.

void psNPCClient::PerceptProximityLocations ( )
protected

Find all locations that are close to NPC's and percept the NPC.

void psNPCClient::PerceptProximityTribeHome ( )
protected

Find all actors that are in a tribe home and percept tribe and actor if it is an NPC.

NPC* psNPCClient::ReadMasteredNPC ( PID  char_id,
PID  master_id 
)

Clones a master npc to a new npc whith the passed PID.

Used to inheredit behaviours from other npc.

Note
this is used as last shore scenario. This way the npc even if mastered can override the entry of it's master. The master PID comes from psserver.
Parameters
char_idA valid PID of the character which is taking it's attributes from the master npc.
master_idA valid PID of the master npc from which we will copy the attributes.
Returns
A pointer to the newly created NPC. NULL if the arguments where invalid or the master wasn't found.
bool psNPCClient::ReadNPCsFromDatabase ( )
protected

Read NPCs from the DB.

NPC* psNPCClient::ReadSingleNPC ( PID  char_id,
PID  master_id = 0 
)
void psNPCClient::RegisterReaction ( NPC npc,
Reaction reaction 
)

Register a reaction for an NPC with the client.

Used to speed up FirePerception.

void psNPCClient::Remove ( gemNPCObject object)
void psNPCClient::Remove ( NPC npc)

Remove NPC from NPC Client.

void psNPCClient::RemoveAll ( )
void psNPCClient::SaveLogSettings ( )

Used to save the log settings.

void psNPCClient::SetEntityPos ( EID  id,
csVector3 &  pos,
iSector *  sector,
InstanceID  instance,
bool  force = false 
)

SetEntityPos finds the given ID entity, and updates its position in mesh and linmove.

Parameters
idThe EID of the entity.
posThe new position.
sectorThe new sector.
instanceThe new instance.
forceApplies the entity reposition also on npc. Useful with teleport slide and other operations.
iCelHPath* psNPCClient::ShortestPath ( NPC npc,
const csVector3 &  from,
iSector *  fromSector,
const csVector3 &  goal,
iSector *  goalSector 
)
void psNPCClient::Tick ( )

This does 1 AI calc per Tribe then returns.

virtual const char* psNPCClient::ToString ( )
virtual

Implements iScriptableVar.

void psNPCClient::TriggerEvent ( Perception pcpt,
float  maxRange = -1.0,
csVector3 *  basePos = NULL,
iSector *  baseSector = NULL,
bool  sameSector = false 
)

Sends a perception to all npcs.

If macRange is greather than 0.0 only npcs within that range of the base position will be triggered.

See also
NPC::TriggerEvent Tribe::TriggerEvent
Parameters
pcptThe perception
maxRangeIf greater than 0.0 then max range apply
basePosThe base position for range checks.
baseSectorThe base sector for range checks.
sameSectorOnly trigger if in same sector
void psNPCClient::UnattachObject ( iObject *  object,
gemNPCObject 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 object from.
gobjectThe gem object we want to unattach.
void psNPCClient::UpdateTime ( int  minute,
int  hour,
int  day,
int  month,
int  year 
)

Update with time from server in order to start timed events.

Member Data Documentation

csArray<gemNPCActor*> psNPCClient::all_gem_actors
protected

Definition at line 792 of file npcclient.h.

csArray<gemNPCItem*> psNPCClient::all_gem_items
protected

Definition at line 791 of file npcclient.h.

csPDelArray<gemNPCObject> psNPCClient::all_gem_objects
protected

Definition at line 790 of file npcclient.h.

csHash<gemNPCObject*, EID> psNPCClient::all_gem_objects_by_eid
protected

Definition at line 788 of file npcclient.h.

csHash<gemNPCObject*, PID> psNPCClient::all_gem_objects_by_pid
protected

Definition at line 789 of file npcclient.h.

csHash<NPC*,csString> psNPCClient::allReactions
protected

Hash of all registered reactions.

Definition at line 796 of file npcclient.h.

csRef<iCollideSystem> psNPCClient::cdsys
protected

Definition at line 799 of file npcclient.h.

csRef<iConfigManager > psNPCClient::configmanager
protected

Definition at line 771 of file npcclient.h.

psNetConnection* psNPCClient::connection
protected

Definition at line 768 of file npcclient.h.

int psNPCClient::current_long_range_perception_index
protected

Counters used to distribute load regarding perception generation.

Definition at line 809 of file npcclient.h.

int psNPCClient::current_long_range_perception_loc_index
protected

Definition at line 810 of file npcclient.h.

int psNPCClient::current_tribe_home_perception_index
protected

Definition at line 811 of file npcclient.h.

psDatabase* psNPCClient::database
protected

Definition at line 777 of file npcclient.h.

csRef<iEngine> psNPCClient::engine
protected

Definition at line 770 of file npcclient.h.

EventManager* psNPCClient::eventmanager
protected

Definition at line 774 of file npcclient.h.

int psNPCClient::gameDay
protected

Definition at line 816 of file npcclient.h.

int psNPCClient::gameHour
protected

Definition at line 815 of file npcclient.h.

int psNPCClient::gameMinute
protected

Definition at line 814 of file npcclient.h.

int psNPCClient::gameMonth
protected

Definition at line 817 of file npcclient.h.

csTicks psNPCClient::gameTimeUpdated
protected

Definition at line 819 of file npcclient.h.

int psNPCClient::gameYear
protected

Definition at line 818 of file npcclient.h.

LocationManager* psNPCClient::locationManager
protected

The manager for location.

Definition at line 781 of file npcclient.h.

MathScriptEngine* psNPCClient::mathScriptEngine
protected

Definition at line 782 of file npcclient.h.

csRef<MsgHandler> psNPCClient::msghandler
protected

Definition at line 772 of file npcclient.h.

csRef<iCelHNavStruct> psNPCClient::navStruct
protected

Definition at line 784 of file npcclient.h.

NetworkManager* psNPCClient::network
protected

Definition at line 776 of file npcclient.h.

csArray<csString> psNPCClient::notUsedReactions
protected

List of not matched reactions.

Definition at line 797 of file npcclient.h.

psNPCClient* psNPCClient::npcclient
static

Definition at line 766 of file npcclient.h.

csPDelArray<NPC> psNPCClient::npcs
protected

Definition at line 785 of file npcclient.h.

csArray<DeferredNPC> psNPCClient::npcsDeferred
protected

Definition at line 786 of file npcclient.h.

csHash<NPCType*, const char*> psNPCClient::npctypes
protected

Definition at line 780 of file npcclient.h.

iObjectRegistry* psNPCClient::objreg
protected

Definition at line 769 of file npcclient.h.

psPathNetwork* psNPCClient::pathNetwork
protected

Definition at line 783 of file npcclient.h.

csHash<psNPCRaceListMessage::NPCRaceInfo_t,csString> psNPCClient::raceInfos
protected

Information about all the races.

Definition at line 794 of file npcclient.h.

RecipeManager* psNPCClient::recipemanager
protected

Definition at line 775 of file npcclient.h.

ServerConsole* psNPCClient::serverconsole
protected

Definition at line 773 of file npcclient.h.

unsigned int psNPCClient::tick_counter
protected

Counter used to start events at every nth client tick.

Definition at line 806 of file npcclient.h.

csPDelArray<Tribe> psNPCClient::tribes
protected

Definition at line 787 of file npcclient.h.

csRef<iVFS> psNPCClient::vfs
protected

Definition at line 778 of file npcclient.h.

psWorld* psNPCClient::world
protected

Definition at line 801 of file npcclient.h.


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