Planeshift
Classes | Public Member Functions | Protected Attributes

gemNPC Class Reference

#include <gem.h>

List of all members.

Classes

struct  DialogCounter

Public Member Functions

void ActionCommand (bool actionMy, bool actionNarrate, const char *actText, Client *who, bool actionPublic, csTicks &timeDelay)
 Used to allow a NPC to communicate through action to its environment.
void AddBadText (const char *playerSaid, const char *trigger)
virtual void AddLootablePlayer (PID playerID)
virtual void ApplyStaminaCalculations (const csVector3 &velocity, float times)
virtual void Broadcast (int clientnum, bool control)
void CheckSpeakers ()
 Check speakers to see if not spoken to anymore.
virtual void ForcePositionUpdate ()
 gemNPC (GEMSupervisor *gemSupervisor, CacheManager *cachemanager, EntityManager *entityManager, psCharacter *chardata, const char *factname, InstanceID myInstance, iSector *room, const csVector3 &pos, float rotangle, int clientnum)
void GetBadText (size_t first, size_t last, csStringArray &saidArray, csStringArray &trigArray)
virtual unsigned GetDefaultAttackID ()
virtual csString GetDefaultBehavior (const csString &dfltBehaviors)
const csArray< PID > & GetLootablePlayers () const
virtual psNPCDialogGetNPCDialogPtr ()
virtual const char * GetObjectType ()
virtual gemObjectGetOwner ()
virtual ClientGetRandomLootClient (int range)
virtual AccountID GetSuperclientID ()
virtual gemObjectGetTarget ()
virtual bool HasKillStealProtection ()
 Returns if the npc has killsteal protection.
bool IsBusy () const
 True if the NPC client sent the busy command.
bool IsLootablePlayer (PID playerID)
void ReactToPlayerApproach (psNPCCommandsMessage::PerceptionType type, gemActor *player)
void RegisterSpeaker (Client *client)
 Register clients that speak to a npc.
virtual void RemoveLootablePlayer (PID playerID)
void Say (const char *sayText, Client *who, bool sayPublic, csTicks &timeDelay)
 Used to allow a NPC to communicate by saying things to its environment.
virtual bool Send (int clientnum, bool control, bool to_superclients, psPersistAllEntities *allEntities=NULL)
 Send this object to the given client.
virtual void SendBehaviorMessage (const csString &str, gemObject *obj)
virtual void SendGroupStats ()
void SetBusy (bool busy)
 To set the busy state of the NPC.
virtual void SetCombatStance (const Stance &stance)
virtual void SetDefaultAttackID (unsigned id)
virtual void SetOwner (gemObject *owner)
virtual void SetPosition (const csVector3 &pos, float angle, iSector *sector)
virtual void SetSuperclientID (AccountID id)
virtual void SetTarget (gemObject *newTarget)
void SetupDialog (PID npcID, PID masterNpcID, bool force=false)
void ShowPopupMenu (Client *client)
virtual ~gemNPC ()

Protected Attributes

csPDelArray< DialogCounterbadText
bool busy
 Indicator from the NPC client to state the if the NPC is busy.
unsigned default_attackid
 Default attack type ID.
csArray< PID > lootablePlayers
 Array of client id's allowed to loot this char.
csTicks nextLongRangeAvail
 When can npc respond to long range prox trigger again.
csTicks nextShortRangeAvail
 When can npc respond to short range prox trigger again.
csTicks nextVeryShortRangeAvail
 When can npc respond to very short range prox trigger again.
psNPCDialognpcdialog
csWeakRef< gemObjectowner
int speakers
AccountID superClientID
csWeakRef< gemObjecttarget

Detailed Description

Definition at line 1898 of file gem.h.


Constructor & Destructor Documentation

gemNPC::gemNPC ( GEMSupervisor gemSupervisor,
CacheManager cachemanager,
EntityManager entityManager,
psCharacter chardata,
const char *  factname,
InstanceID  myInstance,
iSector *  room,
const csVector3 &  pos,
float  rotangle,
int  clientnum 
)
virtual gemNPC::~gemNPC ( ) [virtual]

Member Function Documentation

void gemNPC::ActionCommand ( bool  actionMy,
bool  actionNarrate,
const char *  actText,
Client who,
bool  actionPublic,
csTicks &  timeDelay 
)

Used to allow a NPC to communicate through action to its environment.

Use this to publish chat messages of type ME,MY,NARRATE for NPCs. They can either be of private to the client who or broadcasted. Use one of the actionMy or actionNarrate to override the default type of ME.

Parameters:
actionMyIf true a /my will be used
actionNarrateIf true a narrate will be used if not actionMy is set.
actTextThe text to send.
whoWho to send to.
actionPublicTrue if it should be a public action, otherwise it will only be sent to the destination client given by who.
timeDelayUsed to lay out a sequence of responses in time depended on the length of the actText.
void gemNPC::AddBadText ( const char *  playerSaid,
const char *  trigger 
)
virtual void gemNPC::AddLootablePlayer ( PID  playerID) [virtual]

Reimplemented from gemObject.

virtual void gemNPC::ApplyStaminaCalculations ( const csVector3 &  velocity,
float  times 
) [inline, virtual]

Reimplemented from gemActor.

Definition at line 1978 of file gem.h.

virtual void gemNPC::Broadcast ( int  clientnum,
bool  control 
) [virtual]
Parameters:
clientnumThe client that initiated this update.
controlSet to true when sent to the controlling client.

Reimplemented from gemActor.

void gemNPC::CheckSpeakers ( )

Check speakers to see if not spoken to anymore.

virtual void gemNPC::ForcePositionUpdate ( ) [virtual]
void gemNPC::GetBadText ( size_t  first,
size_t  last,
csStringArray &  saidArray,
csStringArray &  trigArray 
)
virtual unsigned gemNPC::GetDefaultAttackID ( ) [inline, virtual]

Reimplemented from gemActor.

Definition at line 1952 of file gem.h.

virtual csString gemNPC::GetDefaultBehavior ( const csString &  dfltBehaviors) [virtual]

Reimplemented from gemActor.

const csArray<PID>& gemNPC::GetLootablePlayers ( ) const [inline]

Definition at line 1984 of file gem.h.

virtual psNPCDialog* gemNPC::GetNPCDialogPtr ( ) [inline, virtual]

Reimplemented from gemObject.

Definition at line 1961 of file gem.h.

virtual const char* gemNPC::GetObjectType ( ) [inline, virtual]

Reimplemented from gemActor.

Reimplemented in gemPet.

Definition at line 1957 of file gem.h.

virtual gemObject* gemNPC::GetOwner ( ) [inline, virtual]

Reimplemented from gemObject.

Definition at line 2054 of file gem.h.

virtual Client* gemNPC::GetRandomLootClient ( int  range) [virtual]

Reimplemented from gemObject.

virtual AccountID gemNPC::GetSuperclientID ( ) [inline, virtual]

Reimplemented from gemObject.

Definition at line 1966 of file gem.h.

virtual gemObject* gemNPC::GetTarget ( ) [inline, virtual]

Definition at line 2047 of file gem.h.

virtual bool gemNPC::HasKillStealProtection ( ) [inline, virtual]

Returns if the npc has killsteal protection.

Rules about killsteal protection should be implemented here. Generic NPCs have killsteal protection, pet don't have it.

Returns:
A boolean indicating if this gemNPC must have killsteal protection.

Reimplemented from gemObject.

Definition at line 2070 of file gem.h.

bool gemNPC::IsBusy ( ) const

True if the NPC client sent the busy command.

NPC operation <busy /> and <idle /> set and cleare this flag.

See also:
BusyOperation
bool gemNPC::IsLootablePlayer ( PID  playerID) [virtual]

Reimplemented from gemObject.

void gemNPC::ReactToPlayerApproach ( psNPCCommandsMessage::PerceptionType  type,
gemActor player 
)
void gemNPC::RegisterSpeaker ( Client client)

Register clients that speak to a npc.

virtual void gemNPC::RemoveLootablePlayer ( PID  playerID) [virtual]

Reimplemented from gemObject.

void gemNPC::Say ( const char *  sayText,
Client who,
bool  sayPublic,
csTicks &  timeDelay 
)

Used to allow a NPC to communicate by saying things to its environment.

Use this to publish chat messages of type SAY for NPCs. They can either be of private to the client who or broadcasted.

Parameters:
sayTextThe text to send.
whoWho to send to.
sayPublicTrue if it should be a public say, otherwise it will only be sent to the destination client given by who.
timeDelayUsed to lay out a sequence of responses in time depended on the length of the sayText.
virtual bool gemNPC::Send ( int  clientnum,
bool  control,
bool  to_superclients,
psPersistAllEntities allEntities = NULL 
) [virtual]

Send this object to the given client.

Parameters:
clientnumThe client that initiated this update.
controlSet to true when sent to the controlling client.
to_superclientsSend to super clients
allEntitiesBuffer the message instead of sending it.

Reimplemented from gemActor.

virtual void gemNPC::SendBehaviorMessage ( const csString &  str,
gemObject obj 
) [virtual]

Reimplemented from gemActor.

virtual void gemNPC::SendGroupStats ( ) [virtual]

Reimplemented from gemActor.

void gemNPC::SetBusy ( bool  busy)

To set the busy state of the NPC.

NPC operation <busy /> and <idle /> set and cleare this flag.

See also:
BusyOperation
virtual void gemNPC::SetCombatStance ( const Stance stance) [virtual]

Reimplemented from gemActor.

virtual void gemNPC::SetDefaultAttackID ( unsigned  id) [inline, virtual]

Reimplemented from gemActor.

Definition at line 1948 of file gem.h.

virtual void gemNPC::SetOwner ( gemObject owner) [virtual]
virtual void gemNPC::SetPosition ( const csVector3 &  pos,
float  angle,
iSector *  sector 
) [virtual]

Reimplemented from gemActor.

virtual void gemNPC::SetSuperclientID ( AccountID  id) [inline, virtual]

Reimplemented from gemObject.

Definition at line 1970 of file gem.h.

virtual void gemNPC::SetTarget ( gemObject newTarget) [inline, virtual]

Definition at line 2043 of file gem.h.

void gemNPC::SetupDialog ( PID  npcID,
PID  masterNpcID,
bool  force = false 
)
void gemNPC::ShowPopupMenu ( Client client)

Member Data Documentation

csPDelArray<DialogCounter> gemNPC::badText [protected]

Definition at line 1930 of file gem.h.

bool gemNPC::busy [protected]

Indicator from the NPC client to state the if the NPC is busy.

Definition at line 1936 of file gem.h.

Default attack type ID.

Definition at line 1932 of file gem.h.

csArray<PID> gemNPC::lootablePlayers [protected]

Array of client id's allowed to loot this char.

Definition at line 1911 of file gem.h.

csTicks gemNPC::nextLongRangeAvail [protected]

When can npc respond to long range prox trigger again.

Definition at line 1908 of file gem.h.

csTicks gemNPC::nextShortRangeAvail [protected]

When can npc respond to short range prox trigger again.

Definition at line 1907 of file gem.h.

csTicks gemNPC::nextVeryShortRangeAvail [protected]

When can npc respond to very short range prox trigger again.

Definition at line 1906 of file gem.h.

Definition at line 1901 of file gem.h.

csWeakRef<gemObject> gemNPC::owner [protected]

Definition at line 1904 of file gem.h.

int gemNPC::speakers [protected]

Definition at line 1934 of file gem.h.

AccountID gemNPC::superClientID [protected]

Definition at line 1902 of file gem.h.

csWeakRef<gemObject> gemNPC::target [protected]

Definition at line 1903 of file gem.h.


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