Planeshift
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes

Client Class Reference

This class collects data of a netclient. More...

#include <client.h>

List of all members.

Public Member Functions

void AddDuelClient (uint32_t clientnum)
void AddPet (gemActor *pet)
bool AllowDisconnect ()
 Permit the player to disconnect? Players cannot quit while in combat (includes spell casting).
void AnnounceToDuelClients (gemActor *attacker, const char *event)
void ClearAllDuelClients ()
 Client ()
 Please call constructor with the connection object produced by handleUnknownClient.
void CountDetectedCheat ()
 Give a warning to the client silently. Capped at 10000.
void DecrementSpamPoints ()
bool Disconnect ()
void FloodControl (uint8_t chatType, const csString &newMessage, const csString &recipient)
 Warn or mute for chat spamming.
AccountID GetAccountID ()
 The account number for this client.
unsigned int GetAccountTotalOnlineTime ()
gemActorGetActor () const
const SOCKADDR_IN & GetAddress () const
bool GetAdvisor ()
int GetAdvisorPoints ()
int GetAllianceID ()
 the alliance id value if the player is member of a guild in an alliance
bool GetBuddyListHide ()
MuteBuffableGetBuffableMute ()
psCharacterGetCharacterData ()
bool GetCheatMask (CheatFlags mask)
uint32_t GetClientNum () const
NetBase::ConnectionGetConnection () const
unsigned int GetDetectedCheatCount ()
int GetDuelClient (int id)
int GetDuelClientCount ()
int GetExchangeID ()
gemActorGetFamiliar ()
int GetGuildID ()
 The guild id value if player is member of guild.
csString GetIPAddress ()
void GetIPAddress (char *addrStr, socklen_t size)
 Return a string representing the ip address of this client.
csString GetIPRange (int octets=3)
bool GetLastInviteResult ()
csTicks GetLastInviteTime ()
csList< iSector * >::Iterator GetLocationDisplaying ()
csString GetMesh () const
const char * GetName ()
 Get Client Name.
size_t GetNumPets ()
OrderedMessageChannelGetOrderedMessageChannel (msgtype mtype)
 Get the channel to use for an ordered message.
csList< iSector * >::Iterator GetPathDisplaying ()
gemActorGetPet (size_t index)
PID GetPID ()
 The player number for this client.
int GetSecurityLevel () const
 The security level of this player.
int GetSelectedLocationID ()
int GetSpamPoints ()
int GetTargetClientID ()
 Get the current selected target player.
gemObjectGetTargetObject () const
csList< iSector * >::Iterator GetWaypointDisplaying ()
bool HasBeenPenalized ()
bool HasBeenWarned ()
void IncrementAdvisorPoints (int n=1)
void IncrementSpamPoints ()
bool Initialize (LPSOCKADDR_IN addr, uint32_t clientnum)
bool IsAdvisorBanned ()
bool IsAlive () const
 Returns whether the client's character is alive.
bool IsDuelClient (uint32_t clientnum)
bool IsGM () const
bool IsMute ()
bool IsMyPet (gemActor *other) const
 Return if other is one of my pets.
bool IsPlayerClient ()
bool IsReady ()
bool IsSuperClient ()
bool IsZombie ()
 A zombie client is a client that is prevented from disconnecting because of combat, spellcasting, or defeted.
void LocationClearDisplaying ()
bool LocationIsDisplaying ()
void LocationSetIsDisplaying (iSector *sector)
 Online edit of location.
void PathClearDisplaying ()
psPathPathGetPath ()
bool PathIsDisplaying ()
void PathSetIsDisplaying (iSector *sector)
void PathSetPath (psPath *path)
void RemoveDuelClient (Client *client)
void RemovePet (size_t index)
void SetAccountID (AccountID id)
void SetActor (gemActor *myactor)
void SetAdvisor (bool advisor)
 Set this client's advisor status.
void SetAdvisorBan (bool ban)
void SetAdvisorPoints (int p)
void SetAllowedToDisconnect (bool allowed)
 Called from server side to set the allowedToDisconnect flag.
void SetBuddyListHide (bool hide)
 Change whether hiding from buddylists.
void SetCheatMask (CheatFlags mask, bool flag)
 Set the next move as not a cheat, or clear it.
void SetExchangeID (int ID)
void SetFamiliar (gemActor *familiar)
void SetLastInviteResult (bool result)
void SetLastInviteTime (csTicks time)
void SetMesh (csString nextMesh)
void SetMute (bool flag)
 SetMute is the function that toggles the muted flag.
void SetName (const char *n)
 Set the clients name.
void SetPenalized (bool value)
void SetPID (PID id)
void SetReady (bool rdy)
void SetSecurityLevel (int level)
void SetSelectedLocationID (int id)
void SetSpamPoints (int points)
void SetSuperClient (bool flag)
 Allow distinguishing superclients from regular player clients.
void SetTargetObject (gemObject *object, bool updateClientGUI=false)
void SetWarned ()
bool ValidateDistanceToTarget (float range)
 Check if distance between client and target is within range.
void WaypointClearDisplaying ()
int WaypointGetNewPathIndex ()
int WaypointGetPathIndex ()
csString & WaypointGetPathName ()
bool WaypointIsDisplaying ()
void WaypointSetIsDisplaying (iSector *sector)
void WaypointSetPath (csString &path, int index)
 Online edit of paths.
bool ZombieAllowDisconnect ()
 Check if a zombie is allowed to disconnect. Called from the network thread so no access to server internal data should be made.
 ~Client ()

Static Public Member Functions

static csString GetIPRange (const char *ipaddr, int octets=3)
static void GetTargetTypeName (int32_t targetType, csString &targetDesc)
 Builds a list of target type names associated with a target type bitmap (formed by OR-ing TARGET_TYPES).

Public Attributes

csTicks accumulatedLag
 For cheat detection.
csTicks lastGlyphSend
csTicks lastInventorySend
csRef< NetPacketQueueRefCountoutqueue

Protected Member Functions

void SaveAccountData ()

Protected Attributes

AccountID accountID
gemActoractor
 Pointer to the gemActor object played by this client once a character is logged in and in-game.
int advisorPoints
bool allowedToDisconnect
 Server set this flag when the player isn't casting spells, fighting or doing anythinge else that should prevent the player from disconnecting.
csArray< uint32_t > duel_clients
int exchangeID
 Currently active id of Exchange object managed by Exchange Manager, or 0 if no exchange is active.
FloodBuffRow floodHistory [floodMax]
bool hasBeenPenalized
bool hasBeenWarned
bool isAdvisor
 Store if this client is acting as an advisor.
bool lastInviteResult
csTicks lastInviteTime
csArray< gemNPC * > listeningNpc
csList< iSector * > locationDisplaySectors
csString mesh
MuteBuffable mute
 mute flag
csString name
int nextFloodHistoryIndex
csHash< OrderedMessageChannel * > orderedMessages
 This collection stores queues of ordered messages while we're waiting for an out of order one to arrive.
csList< iSector * > pathDisplaySectors
psPathpathPath
csArray< PID > pets
PID playerID
bool ready
int securityLevel
int selectedLocationID
int spamPoints
bool superclient
csList< iSector * > waypointDisplaySectors
 Sectors where client is doing online editing.
int waypointPathIndex
csString waypointPathName
bool zombie
 A zombie client is a client where the player has disconnected, but still active due to not finished combat, spellcasting, or defeted.
csTicks zombietimeout

Static Protected Attributes

static const unsigned int floodForgiveTime = 10000
 How long to wait before forgiving a repeated message.
static const int floodMax = 5
 Mute client after 5 repeated messages.
static const int floodWarn = 3
 Warn client after 3 repeated messages.

Detailed Description

This class collects data of a netclient.

While the socket data like ip adress and port is managed inside NetManager and not stored here this is the object that will be saved in the ObjectManager and will get an Object ID

Definition at line 95 of file client.h.


Constructor & Destructor Documentation

Client::Client ( )

Please call constructor with the connection object produced by handleUnknownClient.

Client::~Client ( )

Member Function Documentation

void Client::AddDuelClient ( uint32_t  clientnum)
void Client::AddPet ( gemActor pet)
bool Client::AllowDisconnect ( )

Permit the player to disconnect? Players cannot quit while in combat (includes spell casting).

Also causes the client to be set as a zombie indicating that the server knows the connection has been broken.

void Client::AnnounceToDuelClients ( gemActor attacker,
const char *  event 
)
void Client::ClearAllDuelClients ( )
void Client::CountDetectedCheat ( ) [inline]

Give a warning to the client silently. Capped at 10000.

Definition at line 469 of file client.h.

void Client::DecrementSpamPoints ( ) [inline]

Definition at line 407 of file client.h.

bool Client::Disconnect ( )
void Client::FloodControl ( uint8_t  chatType,
const csString &  newMessage,
const csString &  recipient 
)

Warn or mute for chat spamming.

AccountID Client::GetAccountID ( ) [inline]

The account number for this client.

Definition at line 212 of file client.h.

unsigned int Client::GetAccountTotalOnlineTime ( )
gemActor* Client::GetActor ( ) const [inline]

Definition at line 161 of file client.h.

const SOCKADDR_IN& Client::GetAddress ( ) const [inline]

Definition at line 314 of file client.h.

bool Client::GetAdvisor ( ) [inline]

Definition at line 352 of file client.h.

int Client::GetAdvisorPoints ( ) [inline]

Definition at line 342 of file client.h.

int Client::GetAllianceID ( )

the alliance id value if the player is member of a guild in an alliance

bool Client::GetBuddyListHide ( ) [inline]

Definition at line 498 of file client.h.

MuteBuffable& Client::GetBuffableMute ( ) [inline]

Definition at line 137 of file client.h.

psCharacter* Client::GetCharacterData ( )
bool Client::GetCheatMask ( CheatFlags  mask) [inline]

Definition at line 479 of file client.h.

uint32_t Client::GetClientNum ( ) const [inline]

Definition at line 206 of file client.h.

NetBase::Connection* Client::GetConnection ( ) const [inline]

Definition at line 309 of file client.h.

unsigned int Client::GetDetectedCheatCount ( ) [inline]

Definition at line 473 of file client.h.

int Client::GetDuelClient ( int  id)
int Client::GetDuelClientCount ( )
int Client::GetExchangeID ( ) [inline]

Definition at line 231 of file client.h.

gemActor* Client::GetFamiliar ( )
int Client::GetGuildID ( )

The guild id value if player is member of guild.

void Client::GetIPAddress ( char *  addrStr,
socklen_t  size 
)

Return a string representing the ip address of this client.

csString Client::GetIPAddress ( )
csString Client::GetIPRange ( int  octets = 3)
static csString Client::GetIPRange ( const char *  ipaddr,
int  octets = 3 
) [static]
bool Client::GetLastInviteResult ( ) [inline]

Definition at line 371 of file client.h.

csTicks Client::GetLastInviteTime ( ) [inline]

Definition at line 363 of file client.h.

csList<iSector*>::Iterator Client::GetLocationDisplaying ( )
csString Client::GetMesh ( ) const [inline]

Definition at line 195 of file client.h.

const char* Client::GetName ( )

Get Client Name.

Returning the account name until a Character is connected to the client. When a Character is connected it will returnt the Character first name.

size_t Client::GetNumPets ( )
OrderedMessageChannel* Client::GetOrderedMessageChannel ( msgtype  mtype)

Get the channel to use for an ordered message.

csList<iSector*>::Iterator Client::GetPathDisplaying ( )
gemActor* Client::GetPet ( size_t  index)
PID Client::GetPID ( ) [inline]

The player number for this client.

Definition at line 222 of file client.h.

int Client::GetSecurityLevel ( ) const [inline]

The security level of this player.

Definition at line 241 of file client.h.

int Client::GetSelectedLocationID ( ) [inline]

Definition at line 462 of file client.h.

int Client::GetSpamPoints ( ) [inline]

Definition at line 395 of file client.h.

int Client::GetTargetClientID ( )

Get the current selected target player.

Returns:
-1 if no target selected or target not a player
gemObject* Client::GetTargetObject ( ) const
static void Client::GetTargetTypeName ( int32_t  targetType,
csString &  targetDesc 
) [static]

Builds a list of target type names associated with a target type bitmap (formed by OR-ing TARGET_TYPES).

Parameters:
targetTypeA target type bitmap.
targetDesc[CHANGES] Gets filled in with a comma-separated list of target names.
csList<iSector*>::Iterator Client::GetWaypointDisplaying ( )
bool Client::HasBeenPenalized ( ) [inline]

Definition at line 387 of file client.h.

bool Client::HasBeenWarned ( ) [inline]

Definition at line 379 of file client.h.

void Client::IncrementAdvisorPoints ( int  n = 1) [inline]

Definition at line 338 of file client.h.

void Client::IncrementSpamPoints ( ) [inline]

Definition at line 403 of file client.h.

bool Client::Initialize ( LPSOCKADDR_IN  addr,
uint32_t  clientnum 
)
bool Client::IsAdvisorBanned ( )
bool Client::IsAlive ( ) const

Returns whether the client's character is alive.

bool Client::IsDuelClient ( uint32_t  clientnum)
bool Client::IsGM ( ) const
bool Client::IsMute ( ) [inline]

Definition at line 133 of file client.h.

bool Client::IsMyPet ( gemActor other) const

Return if other is one of my pets.

bool Client::IsPlayerClient ( ) [inline]

Definition at line 294 of file client.h.

bool Client::IsReady ( ) [inline]

Definition at line 261 of file client.h.

bool Client::IsSuperClient ( ) [inline]

Definition at line 290 of file client.h.

bool Client::IsZombie ( ) [inline]

A zombie client is a client that is prevented from disconnecting because of combat, spellcasting, or defeted.

Definition at line 280 of file client.h.

void Client::LocationClearDisplaying ( )
bool Client::LocationIsDisplaying ( )
void Client::LocationSetIsDisplaying ( iSector *  sector)

Online edit of location.

void Client::PathClearDisplaying ( )
psPath* Client::PathGetPath ( ) [inline]

Definition at line 431 of file client.h.

bool Client::PathIsDisplaying ( )
void Client::PathSetIsDisplaying ( iSector *  sector)
void Client::PathSetPath ( psPath path) [inline]

Definition at line 435 of file client.h.

void Client::RemoveDuelClient ( Client client)
void Client::RemovePet ( size_t  index)
void Client::SaveAccountData ( ) [protected]
void Client::SetAccountID ( AccountID  id) [inline]

Definition at line 216 of file client.h.

void Client::SetActor ( gemActor myactor)
void Client::SetAdvisor ( bool  advisor) [inline]

Set this client's advisor status.

Definition at line 348 of file client.h.

void Client::SetAdvisorBan ( bool  ban)
void Client::SetAdvisorPoints ( int  p) [inline]

Definition at line 334 of file client.h.

void Client::SetAllowedToDisconnect ( bool  allowed)

Called from server side to set the allowedToDisconnect flag.

This flagg will be read by the network thread to see if the client could be disconnected.

void Client::SetBuddyListHide ( bool  hide) [inline]

Change whether hiding from buddylists.

Definition at line 494 of file client.h.

void Client::SetCheatMask ( CheatFlags  mask,
bool  flag 
)

Set the next move as not a cheat, or clear it.

void Client::SetExchangeID ( int  ID) [inline]

Definition at line 235 of file client.h.

void Client::SetFamiliar ( gemActor familiar)
void Client::SetLastInviteResult ( bool  result) [inline]

Definition at line 375 of file client.h.

void Client::SetLastInviteTime ( csTicks  time) [inline]

Definition at line 367 of file client.h.

void Client::SetMesh ( csString  nextMesh) [inline]

Definition at line 191 of file client.h.

void Client::SetMute ( bool  flag) [inline]

SetMute is the function that toggles the muted flag.

Definition at line 129 of file client.h.

void Client::SetName ( const char *  n)

Set the clients name.

Use this to set the account name during loading. When a Character is loaded this call will have no effect anymore, since GetName than will use the character to get the name.

void Client::SetPenalized ( bool  value) [inline]

Definition at line 391 of file client.h.

void Client::SetPID ( PID  id) [inline]

Definition at line 226 of file client.h.

void Client::SetReady ( bool  rdy) [inline]

Definition at line 257 of file client.h.

void Client::SetSecurityLevel ( int  level) [inline]

Definition at line 245 of file client.h.

void Client::SetSelectedLocationID ( int  id) [inline]

Definition at line 458 of file client.h.

void Client::SetSpamPoints ( int  points) [inline]

Definition at line 399 of file client.h.

void Client::SetSuperClient ( bool  flag) [inline]

Allow distinguishing superclients from regular player clients.

Definition at line 286 of file client.h.

void Client::SetTargetObject ( gemObject object,
bool  updateClientGUI = false 
)
void Client::SetWarned ( ) [inline]

Definition at line 383 of file client.h.

bool Client::ValidateDistanceToTarget ( float  range)

Check if distance between client and target is within range.

void Client::WaypointClearDisplaying ( )
int Client::WaypointGetNewPathIndex ( ) [inline]

Definition at line 426 of file client.h.

int Client::WaypointGetPathIndex ( ) [inline]

Definition at line 422 of file client.h.

csString& Client::WaypointGetPathName ( ) [inline]

Definition at line 418 of file client.h.

bool Client::WaypointIsDisplaying ( )
void Client::WaypointSetIsDisplaying ( iSector *  sector)
void Client::WaypointSetPath ( csString &  path,
int  index 
) [inline]

Online edit of paths.

Definition at line 413 of file client.h.

bool Client::ZombieAllowDisconnect ( )

Check if a zombie is allowed to disconnect. Called from the network thread so no access to server internal data should be made.


Member Data Documentation

AccountID Client::accountID [protected]

Definition at line 537 of file client.h.

For cheat detection.

Definition at line 360 of file client.h.

gemActor* Client::actor [protected]

Pointer to the gemActor object played by this client once a character is logged in and in-game.

Definition at line 523 of file client.h.

Definition at line 554 of file client.h.

bool Client::allowedToDisconnect [protected]

Server set this flag when the player isn't casting spells, fighting or doing anythinge else that should prevent the player from disconnecting.

Definition at line 517 of file client.h.

csArray<uint32_t> Client::duel_clients [protected]

Definition at line 544 of file client.h.

int Client::exchangeID [protected]

Currently active id of Exchange object managed by Exchange Manager, or 0 if no exchange is active.

Definition at line 520 of file client.h.

const unsigned int Client::floodForgiveTime = 10000 [static, protected]

How long to wait before forgiving a repeated message.

Definition at line 549 of file client.h.

Definition at line 550 of file client.h.

const int Client::floodMax = 5 [static, protected]

Mute client after 5 repeated messages.

Definition at line 548 of file client.h.

const int Client::floodWarn = 3 [static, protected]

Warn client after 3 repeated messages.

Definition at line 547 of file client.h.

bool Client::hasBeenPenalized [protected]

Definition at line 562 of file client.h.

bool Client::hasBeenWarned [protected]

Definition at line 561 of file client.h.

bool Client::isAdvisor [protected]

Store if this client is acting as an advisor.

Definition at line 532 of file client.h.

Definition at line 491 of file client.h.

Definition at line 490 of file client.h.

bool Client::lastInviteResult [protected]

Definition at line 560 of file client.h.

csTicks Client::lastInviteTime [protected]

Definition at line 559 of file client.h.

Definition at line 541 of file client.h.

csList<iSector*> Client::locationDisplaySectors [protected]

Definition at line 575 of file client.h.

csString Client::mesh [protected]

Definition at line 526 of file client.h.

mute flag

Definition at line 535 of file client.h.

csString Client::name [protected]

Definition at line 542 of file client.h.

Definition at line 551 of file client.h.

This collection stores queues of ordered messages while we're waiting for an out of order one to arrive.

Definition at line 530 of file client.h.

Definition at line 319 of file client.h.

csList<iSector*> Client::pathDisplaySectors [protected]

Definition at line 574 of file client.h.

psPath* Client::pathPath [protected]

Definition at line 568 of file client.h.

csArray<PID> Client::pets [protected]

Definition at line 525 of file client.h.

PID Client::playerID [protected]

Definition at line 538 of file client.h.

bool Client::ready [protected]

Definition at line 527 of file client.h.

Definition at line 539 of file client.h.

Definition at line 570 of file client.h.

int Client::spamPoints [protected]

Definition at line 553 of file client.h.

bool Client::superclient [protected]

Definition at line 540 of file client.h.

csList<iSector*> Client::waypointDisplaySectors [protected]

Sectors where client is doing online editing.

Definition at line 573 of file client.h.

Definition at line 566 of file client.h.

csString Client::waypointPathName [protected]

Definition at line 565 of file client.h.

bool Client::zombie [protected]

A zombie client is a client where the player has disconnected, but still active due to not finished combat, spellcasting, or defeted.

Definition at line 509 of file client.h.

csTicks Client::zombietimeout [protected]

Definition at line 510 of file client.h.


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