Cavestory Mod API
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
CaveNet::DataStructures::NetClient Class Reference

Networking client. More...

#include <CaveNet_ExportedTypes.h>

Classes

struct  CLIENT_CACHE
 
struct  ClientColor
 

Public Types

enum  ClientState { CLIENT_DISCONNECTED = 0 , CLIENT_CONNECTED , CLIENT_GHOST }
 

Public Member Functions

 NetClient ()
 Default constructor.
 
 ~NetClient ()
 Default deconstructor.
 
bool QueueResource (GameResource *pResource)
 Queue a resource to be checked w/ this client. More...
 
bool IsResourceDirty (GameResource *pResource, int iIndex=-1)
 Check if a resource is dirty for this client. More...
 
bool SetResourceDirty (GameResource *pResource, bool bValue, int iIndex=-1)
 Set a resource as dirty. More...
 
void SendDirtyManifest ()
 Send this client all still-dirty manifest items.
 
void ClearManifest ()
 Clear this client's manifest.
 
void SetManifestDirty ()
 Set all items in this client's manifest cache as 'dirty'.
 
bool NextResource (bool deleteFirst=true)
 Download the next resource. More...
 
void TickManifestQueue ()
 Send a chunk of the download manifest to the client.
 
bool QueueDownload (NetDownload *ptr)
 Queue a download. More...
 
void ClearDownloadQueue ()
 Clear the client's download queue.
 
bool NextDownload (bool deleteFirst=true)
 Finish the current download & go to the next one. More...
 
void TickDownloadQueue ()
 Tick downloading.
 
bool IsDownloading ()
 Check to see if this client is downloading. More...
 
void BuildDownloadString (char *out, int out_size)
 Get the progress of the current download in string form. More...
 
SafeClientInterfaceGetInterface ()
 Get an interface for this client. More...
 
float GetTotalGameScore (unsigned long long int iMaskBits, unsigned long long int iNegateMaskBits=0)
 Get this client's total score based on flags. More...
 
CaveNet::DataStructures::NetScoreInstanceGetGameScoreInstanceByHash (unsigned int iNameHash, bool bAdd=false)
 Get a NetScoreInstance by its name hash. More...
 
CaveNet::DataStructures::NetScoreInstanceGetGameScoreInstance (const char *pName, bool bAdd=false)
 Get a NetScoreInstance by its name. More...
 
bool AddGameScore (const char *pName, int iAmount)
 Add score to this client. More...
 
bool SetGameScore (unsigned int iNameHash, unsigned int iAmount, bool bCurrentLife=false)
 Set the points of a specific NetScoreType for this client by the NetScoreType's name hash. More...
 
bool SetGameScore (const char *pName, unsigned int iAmount, bool bCurrentLife=false)
 Set the points of a specific NetScoreType for this client. More...
 
bool RemoveGameScore (const char *pName)
 Remove all NetScoreInstance objects from this client. More...
 
void RemoveAllGameScores (bool bReAddMandatory=true, bool bTransmit=true)
 Remove all NetScoreInstance objects from this client. More...
 
void ZeroCurrentLifeGameScore ()
 Zero-out the 'current-life' field of all NetScoreInstance objects tied to this client.
 
int GetTeamBalanceScore ()
 Calculate a team balance score. More...
 
bool CanBeAutoBalanced ()
 Determine whether this client can be auto balanced or not. More...
 
NetTeamGetTeam ()
 Get this client's team. More...
 
int GetTeamId ()
 Get this client's team id. More...
 
bool IsMaxExp ()
 Has max EXP for the current weapon? More...
 
void GetTrg ()
 Update gamekey and gamekeytrg.
 
void Spawn (int x, int y)
 Spawn this client at a set of coordinates. More...
 
void SpawnAuto ()
 Find a suitable place to spawn & spawn there.
 
void Respawn (int iTime)
 Respawn this client in a fixed amount of time. More...
 
void ClearArmsData ()
 Clear all arms data.
 
void ClearItemData ()
 Clear all item data.
 
bool AddArmsData (long code, long max_num)
 Add arms data. More...
 
bool AddArmsData2 (long code, long num, long max_num, long level)
 Add arms data. More...
 
bool HasArmsData (long code)
 Check to see if this client has a weapon. More...
 
int GetArmsSlot (long code)
 Get the slot index of this arms id. More...
 
int GetArmsCount ()
 Get the amount of valid weapon slots this client has. More...
 
bool SetArmsDataExact (long index, long code, long max_num, long exp, long level)
 Add arms data (exact)
 
bool SetArmsInfo (long code, long exp, long level, long max_num)
 Set arms level & experience.
 
bool SubArmsData (long code)
 Remove arms data. More...
 
bool TradeArms (long code1, long code2, long max_num)
 Trade arms. More...
 
bool AddItemData (long code)
 Add an item to inventory. More...
 
bool SubItemData (long code)
 Remove an item. More...
 
bool CheckItem (long code)
 Check this client's inventory for an item. More...
 
bool CheckArms (long code)
 Check this client's inventory for a weapon. More...
 
void AddExp (int x, BOOL spur=false)
 Add experience to the held weapon. More...
 
void AddExpToNextValidWeapon (int x)
 Add experience to the next valid weapon. More...
 
void AddBullet (int no, int val)
 Add ammo to the held weapon. More...
 
bool IsAmmoFull ()
 Check if the missile launcher is full. More...
 
void FullArmsEnergy ()
 Set all weapons in this client's inventory to be at full ammo.
 
void ZeroArmsEnergy_All ()
 Zero-exp and reset the levels of all weapons in this client's inventory.
 
void EquipItem (int flag, bool val)
 Set / clear equip flags. More...
 
void ZeroEquip ()
 Set / clear equip flags. More...
 
void BackStep (int code_event)
 Backstep the player. More...
 
void SetPlayerPosition (int x, int y)
 Set the player's absolute position. More...
 
void SetDirect (int direction)
 
void ResetSpurCharge ()
 Reset spur charge.
 
void ZeroExpMyChar ()
 Reset experience for the currently selected weapon.
 
int ArmsNext ()
 Switch to the next weapon in our inventory. More...
 
int ArmsPrev ()
 Switch to the previous weapon in our inventory. More...
 
bool AddPermitStage (int index, int event)
 Add a stage permission. More...
 
bool SubPermitStage (int index)
 Remove a stage permission. More...
 
void ClearPermitStage ()
 Clear stage permissions.
 
void SetColor (unsigned char r, unsigned char g, unsigned char b)
 Set client color. More...
 
GUI_COLOR GetColor ()
 Get client color. More...
 
void ChatEmote (int index)
 Play an emote. More...
 
void DrawChatEmote (int fx, int fy)
 Draw the emote. More...
 
void CacheDeath ()
 Cache our death NPC if we can.
 
void ClearDeathCache ()
 Clear death cache.
 
void SendTileChange (int x, int y, int new_tile)
 Transmit a tile change to a client. More...
 
void OnMapLoad ()
 Callback for when the map loads.
 
MYCHARGetDFocus ()
 Get display focus for mAnimNPCs. More...
 
void ChooseCharacter ()
 Choose this client's character.
 
void GetFaceInfo (GUI_RECT *face_src_rect, Surface_Ids *surf_id, Surface_Ids *mask_id)
 Get the face info for this client. More...
 
void AddToPacketQueue (NetPacket *pPacket)
 Queue a packet to be sent when the server is ready. More...
 
bool SendPacketQueue (bool bForce=false)
 Send all queue'd packets, resetting the send time & clearing the queue. More...
 
void CancelPacketQueue ()
 Cancel & free all queue'd packets.
 
int SimulateMovement (int iNumFrames, MYCHAR *pMC, unsigned int iKeyMask=gKeyMaxVal)
 Simulate character movement. More...
 
void PredictMovement (int iNewInput, long long int iInputTime, int iClientX, int iClientY)
 Predict this client's movement. More...
 
bool OpenGUI (CaveNet::DataStructures::GUI_Type gui_type, bool DisableControl=true)
 Open a GUI for this client. More...
 
bool CloseGUI (bool EnableControl=true)
 Close any open GUI for this client. More...
 
void HandleGuiAction (int ActionIndex, int Arg1, int Arg2, int Arg3)
 Handle any GUI interactions. More...
 
bool IsInGUI ()
 Self-explanatory. More...
 
bool CanOpenGUI (CaveNet::DataStructures::GUI_Type gui_type)
 Check to see if this client can open a type of GUI. More...
 
bool CarryPlayer (NetClientId id)
 Carry a player. More...
 
bool Dismount (bool deleteAnim=true)
 Dismount from the player we're mounted on. More...
 
NetClientGetCarryStackUp ()
 Get the next client in the carry stack. More...
 
NetClientGetCarryStackDown ()
 Get the previous carried client. More...
 
bool IsBeingCarried ()
 Check if we're being carried. More...
 
bool IsCarrying ()
 Check if we're carrying anybody. More...
 
bool IsCarryingPlayer (NetClientId id)
 Check to see if we're carrying a specific client. More...
 
bool IsBeingCarriedBy (NetClientId id)
 Check to see if we're being carried by a specific client. More...
 
bool CanBeCarriedBy (NetClient *other)
 Check if we can be carried by a client. More...
 
bool CanCarry (NetClient *other)
 Check if we can carry a client. More...
 
void InitStar ()
 Re-initialize the whimsical stars.
 
void ActStar ()
 Process the whimsical stars.
 
void PutStar (int fx, int fy)
 Draw the whimsical stars. More...
 
void TransmitStars ()
 Transmit the whimsical stars.
 
void SpectatePlayer (NetClientId ghostId)
 Spectate another client. More...
 
void ClearSpectate ()
 Takes this client out of spectator mode.
 
void CacheSpectate ()
 Cache the current spectator target.
 
void RestoreSpectate ()
 Restore the old spectator target.
 
void UpdateSpectator ()
 Update the spectation target, taking into account text script's focusing.
 
NetClientGetNextSpectateTarget (Directions iDirect)
 Get the next spectator target. More...
 
void ProcessSpectator ()
 Process spectation controls.
 
bool IsTargetSpectatable (NetClient *pTarget)
 Determine whether or not the specified client is spectatable. More...
 
void ValidateFrame ()
 Validate this client's frame.
 
void GetScreenRect (int *x_out, int *y_out, int *w_out, int *h_out)
 Get this client's screen rect. More...
 
void AddToZone (int zone_idx)
 Add ourselves to a zone. More...
 
void RemoveFromZone (int zone_idx)
 Remove ourselves from a zone. More...
 
bool IsInZone (int zone_idx)
 Check to see if we're in a zone. More...
 
void ClearZones (bool do_remove=true)
 Clear our occupied zones. More...
 
void CalculateZoneCandidates (int zones[CAVENET_CLIENT_MAX_ZONES], int *count)
 Calculate & build a list of zone candidates. More...
 
void OccupyZones ()
 Re-calculate what zones we're in.
 
bool Assign (NetSocket *sock, IPaddress *addr, int channel=-2)
 Assign this client to a socket & address. More...
 
void Disconnect (NetDisconnectReason eDisconnectReason=NetDisconnectReason::NET_DISCONNECT_REASON_UNKNOWN, const char *pCustomReason=NULL, NetClient *pResponsibleClient=NULL)
 Disconnect this client from the server. More...
 
bool CompareUserIdent (unsigned int *pUserIdent)
 Compare this user's ident hash to the one given. More...
 
bool Send (NetPacket *packet, bool bForceSend=false)
 Send a packet to this client. More...
 
bool Read (NetPacket *packet)
 Read a packet from this client. More...
 
int GetPing ()
 Get this client's ping average. More...
 
void AutoAdminCheck ()
 Check for administrator privileges for this client. More...
 
CSM_ClientRanks GetAdminRank ()
 Get this client's admin rank. More...
 
unsigned int GetMovePacketCRC ()
 Calculate a CRC checksum based on multiple values. More...
 
bool IsGhost ()
 Check to see if this object is a ghost. More...
 
const ClientState GetState ()
 Get the state of the client. More...
 
NetPlayerGetPlayer ()
 Get this client's player object. More...
 
MYCHARGetMyChar (bool bRequired=false)
 Get this client's MYCHAR object. More...
 
CustomPlayer * GetCharacter ()
 Get our custom player. More...
 
bool IsOurLocalClient ()
 Check to see whether this client is our local client or not. More...
 
NetClientId GetGhostId ()
 Get this client's ghost ID. More...
 
int GetChannel ()
 Get the channel this client is communicating on. More...
 
IPaddressGetAddress ()
 Get the channel this client's address. More...
 
const char * GetNetName ()
 Get this client's netname. More...
 
NetSocket * GetSocket ()
 Get this client's NetSocket. More...
 
char * GetStringIP (char *out, int out_size)
 Get this client's IP into a string. More...
 
void SendFlags (bool bSendAll=true)
 Send flags.
 
void RecordFlag (unsigned short iFlagID, bool bFlagValue)
 Record a flag change so it can be transmitted to the client. More...
 
void SetGhostId (NetClientId id)
 Set the ghost ID for this client. More...
 
void SendPlayerList ()
 Send the player list to this client.
 
void SendMap (int event_id=90)
 Send the current map. More...
 
void SendServerInfo ()
 Send server information to this client.
 
void SendBossLife ()
 Send boss life.
 
void SendTextScriptState ()
 Send the current text script state.
 
void SendStartEvent ()
 Transmit the 'start event' packet.
 
void SendTeamData (NetTeam *pTeam=NULL)
 Transmit the 'team update' packet. More...
 
void FreezeIfEventIsRunning ()
 Self-explanatory.
 
void FinalizeClient ()
 Finalize this client.
 
void PasteState ()
 Paste the current game state to this client.
 
void InitClient ()
 Initialization.
 
void SyncConfigVars ()
 Synchronize configuration variables.
 
void TransmitScoreInstances (CaveNet::DataStructures::NetScoreInstance *pInstance=NULL)
 Transmit the score instances for this client. More...
 
void TransmitPlayerPhysics ()
 Transmit the physics for this player.
 
void TransmitUpdate ()
 Transmit an update packet to all clients.
 
void TransmitName ()
 Transmit a name update packet to all clients.
 
void TransmitMapTileUpdate ()
 Transmit an update packet to all clients.
 
void TransmitPlayerUpdate ()
 Transmit a player update packet to all clients.
 
void TransmitInventory (unsigned int iTypeFlags)
 Transmit this player's inventory. More...
 
void ValidateName ()
 Enforce name uniqueness.
 
TEXT_SCRIPT_PTR_DATAGetScriptContext (TEXT_SCRIPT_PTR_DATA *ptr)
 Build the event context for this client. More...
 
void ShowServerMessage (const char *pFormat,...)
 Show this specific client a server message. More...
 
void Say (const char *pMessage)
 Have the client say something in chat. More...
 
bool BuildFullPacket_Join (NetPacket *out)
 Construct a full-on connection packet. More...
 
bool BuildFullPacket_MovePacket (NetPacket *out)
 Construct a full-on move packet. More...
 
bool BuildStemPacket_Join (NetPacket *out)
 Build a 'join' packet. More...
 
bool BuildStemPacket_Ready (NetPacket *out)
 Build a 'ready' packet. More...
 
int BuildStemPacket_WhimsicalStar (NetPacket *out)
 Build a 'whimsical star update' packet. More...
 
int BuildStemPacket_PlayerUpdate (NetPacket *out)
 Build a 'player update' packet. More...
 
int BuildStemPacket_PlayerPhysicsUpdate (NetPacket *out)
 Build a 'player physics' packet. More...
 
int BuildStemPacket_ScoreInstance (NetPacket *out, CaveNet::DataStructures::NetScoreInstance *pInst=NULL)
 Build a 'score instance' packet. More...
 
int BuildStemPacket_Update (NetPacket *out)
 Build an 'update' packet. More...
 
int BuildStemPacket_UpdatePing (NetPacket *out)
 Build an 'update ping' packet. More...
 
void GetSignalStrengthRect (int *x, int *y, int *w, int *h, bool IncrementFrame=true)
 Get the SURFACE_ID_GUI rect for the signal strength of this client. More...
 
void SetGhostedClient (NetClientId id)
 Set this client as a ghosted object. More...
 
void GenerateNamePlate ()
 Generate a name on the name plate surface for this user.
 
void GetNamePlateRect (int *x, int *y, int *w, int *h)
 Get the rect for the name plate of this client. More...
 
void ResetGhosting ()
 Reset ghosting for this client.
 
void InitializeDirtyList ()
 Build the initial dirty list; Don't include NPCs that don't exist.
 
void DirtyNPC (int index)
 Mark an NPC at the given index as 'dirty'. More...
 
void CleanNPC (int index)
 Mark an NPC at the given index as 'clean'. More...
 
int GetNPCDirtyIndex (int index)
 Get the index of a dirty NPC. More...
 
void ProcessGhosting ()
 Process ghosting on this client. More...
 

Public Attributes

struct CaveNet::DataStructures::NetClient::CLIENT_CACHE mCache
 
struct {
   bool   DownloadResources
 Whether this client wants to download resources or not.
 
   unsigned int   UserIdent [5]
 This user's identifier.
 
mClientConfig
 
struct {
   NetDownload **   list
 Download queue.
 
   int   count
 How many files are in the queue.
 
   bool   is_initialized
 Whether the client has already started downloading or not.
 
   bool   is_ready
 Whether the client is ready for the next file chunk.
 
mDownloadQueue
 
struct {
   GameResource **   list
 Resource scope queue.
 
   int   count
 How many resources are left to scope.
 
   bool   is_done
 Whether or not we're done scoping resources.
 
   bool   was_sent
 Whether we sent a resource.
 
   bool   did_start
 Whether we started already.
 
   char *   clean_list
 Clean list.
 
   int   clean_list_size
 Size of clean list.
 
mManifestQueue
 
struct {
   NetPacket **   queue
 The queue.
 
   int   queue_count
 The number of packets in this queue.
 
   int   queue_size
 The number of packets that this client's queue can hold.
 
   unsigned long long int   last_sent
 The last time we sent packets to this client.
 
mPacketQueue
 The NetPacket queue for this client.
 
int mConn_Port
 Our connection port. More...
 
bool mIsLocal
 Whether this client is local (same-application) or not.
 
bool mIsBot
 Whether this client is a bot or a real user.
 
bool mIsDev
 Whether this client is a developer.
 
CSM_ClientRanks mAdminRank
 This client's admin rank.
 
DynamicSortedPointerBinList< NetScoreInstance *, 1, true > m_ScoreTable
 This client's score instances.
 
bool mIsReady
 I'm ready!
 

Protected Member Functions

void SetState (ClientState state)
 Set the state of the client. More...
 
void SetVector (NetClientVector *ptr)
 Set the vector pointer.
 
void SetPlayer (NetPlayer *ptr)
 Set the player pointer.
 
int GetZoneIndex (int zone_id)
 Find the zone in our array. More...
 

Protected Attributes

NetTeammTeam
 The team we're apart of.
 
NetPlayermPlayer
 This client's player object.
 
NetSocket * mSocket
 The socket this client is using to communicate to us.
 
IPaddress mAddress
 This client's IP address.
 
NetClientVectormVector
 A pointer to the clientgroup that this client is stored within.
 
NetClientId mGhostId
 This client's Ghost ID. More...
 
ClientState mState
 The state of this client.
 
int mChannelNum
 The channel number to communicate on.
 
SafeClientInterface mInterface
 The safe client interface that belongs to this client.
 

Friends

class NetClientVector
 
class NetPlayer
 
class NetTeam
 

Detailed Description

Networking client.

Handles a client that is currently connected to us.

Member Enumeration Documentation

◆ ClientState

Enumerator
CLIENT_DISCONNECTED 

This client isn't connected to anything.

CLIENT_CONNECTED 

This client is a client connected to us.

CLIENT_GHOST 

This client is a client-side ghost of another client.

Member Function Documentation

◆ AddArmsData()

bool CaveNet::DataStructures::NetClient::AddArmsData ( long  code,
long  max_num 
)

Add arms data.

Parameters
codeThe weapon ID to add
max_numThe maximum ammo for this weapon.
Returns
Returns true on success, false otherwise.

◆ AddArmsData2()

bool CaveNet::DataStructures::NetClient::AddArmsData2 ( long  code,
long  num,
long  max_num,
long  level 
)

Add arms data.

Parameters
codeThe weapon ID to add
numThe amount of ammo for this weapon.
max_numThe maximum ammo for this weapon.
levelThe level of the weapon.
Returns
Returns true on success, false otherwise.

◆ AddBullet()

void CaveNet::DataStructures::NetClient::AddBullet ( int  no,
int  val 
)

Add ammo to the held weapon.

Parameters
noAmount of ammo to add.
val

◆ AddExp()

void CaveNet::DataStructures::NetClient::AddExp ( int  x,
BOOL  spur = false 
)

Add experience to the held weapon.

Parameters
xAmount of EXP to add

◆ AddExpToNextValidWeapon()

void CaveNet::DataStructures::NetClient::AddExpToNextValidWeapon ( int  x)

Add experience to the next valid weapon.

Parameters
xAmount of EXP to add

◆ AddGameScore()

bool CaveNet::DataStructures::NetClient::AddGameScore ( const char *  pName,
int  iAmount 
)

Add score to this client.

Parameters
pNameThe name of the score type.
iAmountThe amount to add. Can be negative to remove score.
Returns
Returns true if this was successfull, otherwise returns false.
See also
CSM_RegisterNetScoreType

◆ AddItemData()

bool CaveNet::DataStructures::NetClient::AddItemData ( long  code)

Add an item to inventory.

Parameters
codeThe item ID
Returns
Returns true on success.

◆ AddPermitStage()

bool CaveNet::DataStructures::NetClient::AddPermitStage ( int  index,
int  event 
)

Add a stage permission.

Parameters
indexThe UI position of the stage in the teleportation GUI.
eventThe event to execute when selected.
Returns
Returns true when successfully added.

◆ AddToPacketQueue()

void CaveNet::DataStructures::NetClient::AddToPacketQueue ( NetPacket *  pPacket)

Queue a packet to be sent when the server is ready.

Parameters
pPacketThe packet to be queue'd for this client.

◆ AddToZone()

void CaveNet::DataStructures::NetClient::AddToZone ( int  zone_idx)

Add ourselves to a zone.

Parameters
zone_idThe IDX of the zone

◆ ArmsNext()

int CaveNet::DataStructures::NetClient::ArmsNext ( )

Switch to the next weapon in our inventory.

Returns
Returns the new selected weapon index.

◆ ArmsPrev()

int CaveNet::DataStructures::NetClient::ArmsPrev ( )

Switch to the previous weapon in our inventory.

Returns
Returns the new selected weapon index.

◆ Assign()

bool CaveNet::DataStructures::NetClient::Assign ( NetSocket *  sock,
IPaddress addr,
int  channel = -2 
)

Assign this client to a socket & address.

Parameters
sockThe socket to bind the client to.
addrThe address to bind the client to.
Returns
Returns false on error

◆ AutoAdminCheck()

void CaveNet::DataStructures::NetClient::AutoAdminCheck ( )

Check for administrator privileges for this client.

Returns
Returns TRUE if the client is an admin, otherwise returns FALSE.

◆ BackStep()

void CaveNet::DataStructures::NetClient::BackStep ( int  code_event)

Backstep the player.

Parameters
code_eventWhat to backstep from.
Note
If code_event = 0, the player will always backstep to the right.
If code_event = 1, the player will always backstep to the left.
Otherwise, the player will backstep from the NPC tied to the given code_event.

◆ BuildDownloadString()

void CaveNet::DataStructures::NetClient::BuildDownloadString ( char *  out,
int  out_size 
)

Get the progress of the current download in string form.

Parameters
outA pointer to a buffer to store the string.
out_sizeThe size of ' out '.

◆ BuildFullPacket_Join()

bool CaveNet::DataStructures::NetClient::BuildFullPacket_Join ( NetPacket *  out)

Construct a full-on connection packet.

Parameters
outThe packet to build the output in.
Returns
Returns true if it was built successfully.

◆ BuildFullPacket_MovePacket()

bool CaveNet::DataStructures::NetClient::BuildFullPacket_MovePacket ( NetPacket *  out)

Construct a full-on move packet.

Parameters
outThe packet to build the output in.
Returns
Returns true if it was built successfully.

◆ BuildStemPacket_Join()

bool CaveNet::DataStructures::NetClient::BuildStemPacket_Join ( NetPacket *  out)

Build a 'join' packet.

Parameters
outThe packet to hold the output.
Returns
Returns true if built successfully.

◆ BuildStemPacket_PlayerPhysicsUpdate()

int CaveNet::DataStructures::NetClient::BuildStemPacket_PlayerPhysicsUpdate ( NetPacket *  out)

Build a 'player physics' packet.

Parameters
outThe packet to hold the output.
Returns
Returns 0 on success, non-zero on error.

◆ BuildStemPacket_PlayerUpdate()

int CaveNet::DataStructures::NetClient::BuildStemPacket_PlayerUpdate ( NetPacket *  out)

Build a 'player update' packet.

Parameters
outThe packet to hold the output.
Returns
Returns 0 on success, non-zero on error.

◆ BuildStemPacket_Ready()

bool CaveNet::DataStructures::NetClient::BuildStemPacket_Ready ( NetPacket *  out)

Build a 'ready' packet.

Parameters
outThe packet to hold the output.
Returns
Returns true if built successfully.

◆ BuildStemPacket_ScoreInstance()

int CaveNet::DataStructures::NetClient::BuildStemPacket_ScoreInstance ( NetPacket *  out,
CaveNet::DataStructures::NetScoreInstance pInst = NULL 
)

Build a 'score instance' packet.

Parameters
outThe packet to hold the output.
pInstThe instance to use. Can be NULL.
Returns
Returns 0 on success, non-zero on error.

◆ BuildStemPacket_Update()

int CaveNet::DataStructures::NetClient::BuildStemPacket_Update ( NetPacket *  out)

Build an 'update' packet.

Parameters
outThe packet to hold the output.
Returns
Returns 0 on success, non-zero on error.

◆ BuildStemPacket_UpdatePing()

int CaveNet::DataStructures::NetClient::BuildStemPacket_UpdatePing ( NetPacket *  out)

Build an 'update ping' packet.

Parameters
outThe packet to hold the output.
Returns
Returns 0 on success, non-zero on error.

◆ BuildStemPacket_WhimsicalStar()

int CaveNet::DataStructures::NetClient::BuildStemPacket_WhimsicalStar ( NetPacket *  out)

Build a 'whimsical star update' packet.

Parameters
outThe packet to hold the output.
Returns
Returns 0 on success, non-zero on error.

◆ CalculateZoneCandidates()

void CaveNet::DataStructures::NetClient::CalculateZoneCandidates ( int  zones[CAVENET_CLIENT_MAX_ZONES],
int *  count 
)

Calculate & build a list of zone candidates.

Parameters
zonesThe zone list to populate with zone candidates.
countA pointer to an int that will hold the number of valid zones in 'zones'.

◆ CanBeAutoBalanced()

bool CaveNet::DataStructures::NetClient::CanBeAutoBalanced ( )

Determine whether this client can be auto balanced or not.

Returns
Returns true if they can be autobalanced, false otherwise.

◆ CanBeCarriedBy()

bool CaveNet::DataStructures::NetClient::CanBeCarriedBy ( NetClient other)

Check if we can be carried by a client.

Parameters
otherThe client to check.
Returns
Returns true if we can be carried by the given client.

◆ CanCarry()

bool CaveNet::DataStructures::NetClient::CanCarry ( NetClient other)

Check if we can carry a client.

Parameters
otherThe client to check.
Returns
Returns true if we can carry the given client.

◆ CanOpenGUI()

bool CaveNet::DataStructures::NetClient::CanOpenGUI ( CaveNet::DataStructures::GUI_Type  gui_type)

Check to see if this client can open a type of GUI.

Parameters
gui_typeThe type of GUI to check.
Returns
Returns true if this client can open the specified gui_type or not.

◆ CarryPlayer()

bool CaveNet::DataStructures::NetClient::CarryPlayer ( NetClientId  id)

Carry a player.

Parameters
idThe client ID of the person we should carry.
Returns
Returns true if we started carrying them.

◆ ChatEmote()

void CaveNet::DataStructures::NetClient::ChatEmote ( int  index)

Play an emote.

Parameters
indexThe index of the emote.

◆ CheckArms()

bool CaveNet::DataStructures::NetClient::CheckArms ( long  code)

Check this client's inventory for a weapon.

Parameters
codeThe code of the weapon to check for.
Returns
Returns true if they have it, false otherwise.

◆ CheckItem()

bool CaveNet::DataStructures::NetClient::CheckItem ( long  code)

Check this client's inventory for an item.

Parameters
codeThe code of the item to check for.
Returns
Returns true if they have it, false otherwise.

◆ CleanNPC()

void CaveNet::DataStructures::NetClient::CleanNPC ( int  index)

Mark an NPC at the given index as 'clean'.

Removes it from the ghost queue if it's in it.

Parameters
indexThe index of the NPC.

◆ ClearZones()

void CaveNet::DataStructures::NetClient::ClearZones ( bool  do_remove = true)

Clear our occupied zones.

Parameters
do_removeDo the removal process for every zone. Setting this to 'false' will make it just memset the zones array & set zone_count to 0.

◆ CloseGUI()

bool CaveNet::DataStructures::NetClient::CloseGUI ( bool  EnableControl = true)

Close any open GUI for this client.

Parameters
EnableControlEnable control when the GUI closes.
Returns
Returns true if the client was taken out of a GUI.

◆ CompareUserIdent()

bool CaveNet::DataStructures::NetClient::CompareUserIdent ( unsigned int *  pUserIdent)

Compare this user's ident hash to the one given.

Parameters
pUserIdentThe hash to compare against.
Returns
Returns true if its a match.

◆ DirtyNPC()

void CaveNet::DataStructures::NetClient::DirtyNPC ( int  index)

Mark an NPC at the given index as 'dirty'.

It will be queued for re-ghosting.

Parameters
indexThe index of the NPC.

◆ Disconnect()

void CaveNet::DataStructures::NetClient::Disconnect ( NetDisconnectReason  eDisconnectReason = NetDisconnectReason::NET_DISCONNECT_REASON_UNKNOWN,
const char *  pCustomReason = NULL,
NetClient pResponsibleClient = NULL 
)

Disconnect this client from the server.

Parameters
eDisconnectReasonThe reason for the disconnect.
pCustomReasonThe custom reason, if applicable to the disconnect reason.
pResponsibleClientThe client responsible for this disconnect.

◆ Dismount()

bool CaveNet::DataStructures::NetClient::Dismount ( bool  deleteAnim = true)

Dismount from the player we're mounted on.

Parameters
deleteAnimDelete the carry animation.
Returns
Returns true if dismounted successfully.

◆ DrawChatEmote()

void CaveNet::DataStructures::NetClient::DrawChatEmote ( int  fx,
int  fy 
)

Draw the emote.

Parameters
fxCamera X position.
fyCamera Y position.

◆ EquipItem()

void CaveNet::DataStructures::NetClient::EquipItem ( int  flag,
bool  val 
)

Set / clear equip flags.

Parameters
flagThe flag to set / clear.
valWhether the flag should be set (true) or cleared (false).

◆ GetAddress()

IPaddress* CaveNet::DataStructures::NetClient::GetAddress ( )
inline

Get the channel this client's address.

Returns
Returns this client's IPaddress.

◆ GetAdminRank()

CSM_ClientRanks CaveNet::DataStructures::NetClient::GetAdminRank ( )
inline

Get this client's admin rank.

Returns
Returns the client's admin rank.
See also
CSM_ClientRanks

◆ GetArmsCount()

int CaveNet::DataStructures::NetClient::GetArmsCount ( )

Get the amount of valid weapon slots this client has.

Returns
Returns how many weapons this client has.

◆ GetArmsSlot()

int CaveNet::DataStructures::NetClient::GetArmsSlot ( long  code)

Get the slot index of this arms id.

Parameters
codeThe weapon to check for.
Returns
Returns the slot index if this client has the weapon, -1 if not.

◆ GetCarryStackDown()

NetClient* CaveNet::DataStructures::NetClient::GetCarryStackDown ( )

Get the previous carried client.

Returns
Returns the client carrying us.

◆ GetCarryStackUp()

NetClient* CaveNet::DataStructures::NetClient::GetCarryStackUp ( )

Get the next client in the carry stack.

Returns
Returns the client we're carrying.

◆ GetChannel()

int CaveNet::DataStructures::NetClient::GetChannel ( )
inline

Get the channel this client is communicating on.

Returns
Returns this client's channel

◆ GetCharacter()

CustomPlayer* CaveNet::DataStructures::NetClient::GetCharacter ( )

Get our custom player.

Returns
Returns this client's custom player.

◆ GetColor()

GUI_COLOR CaveNet::DataStructures::NetClient::GetColor ( )
inline

Get client color.

Returns
Returns a GUI_COLOR representing the client's character color.

◆ GetDFocus()

MYCHAR* CaveNet::DataStructures::NetClient::GetDFocus ( )

Get display focus for mAnimNPCs.

Returns
Returns DFocus.

◆ GetFaceInfo()

void CaveNet::DataStructures::NetClient::GetFaceInfo ( GUI_RECT face_src_rect,
Surface_Ids surf_id,
Surface_Ids mask_id 
)

Get the face info for this client.

Parameters
face_src_rectA pointer to the GUI_RECT that will hold the face rect.
surf_idA pointer to a Surface_Ids variable that will hold the face's surface ID.
mask_idA pointer to a Surface_Ids variable that will hold the face mask's surface ID.

◆ GetGameScoreInstance()

CaveNet::DataStructures::NetScoreInstance* CaveNet::DataStructures::NetClient::GetGameScoreInstance ( const char *  pName,
bool  bAdd = false 
)

Get a NetScoreInstance by its name.

Parameters
pNameThe name of the score type.
bAddAdd this type if it was not found.
Returns
Returns the instance that has the type attached to it, or NULL if no instance was found.
See also
NetScoreMaskBits
CSM_RegisterNetScoreType

◆ GetGameScoreInstanceByHash()

CaveNet::DataStructures::NetScoreInstance* CaveNet::DataStructures::NetClient::GetGameScoreInstanceByHash ( unsigned int  iNameHash,
bool  bAdd = false 
)

Get a NetScoreInstance by its name hash.

Parameters
iNameHashThe name hash of the score type.
bAddAdd this type if it was not found.
Returns
Returns the instance that has the type attached to it, or NULL if no instance was found.
See also
NetScoreMaskBits
CSM_RegisterNetScoreType

◆ GetGhostId()

NetClientId CaveNet::DataStructures::NetClient::GetGhostId ( )
inline

Get this client's ghost ID.

Returns
Returns this client's ghost ID.

◆ GetInterface()

SafeClientInterface* CaveNet::DataStructures::NetClient::GetInterface ( )

Get an interface for this client.

Returns
Returns an interface for this client.
Warning
Do not keep a reference to this interface! It will point to an unallocated area when the client leaves!

◆ GetMovePacketCRC()

unsigned int CaveNet::DataStructures::NetClient::GetMovePacketCRC ( )

Calculate a CRC checksum based on multiple values.

This is used to determine if a client's move packet should be sent.

Returns
Returns a CRC checksum.

◆ GetMyChar()

MYCHAR * CaveNet::DataStructures::NetClient::GetMyChar ( bool  bRequired = false)
inline

Get this client's MYCHAR object.

Parameters
bRequiredIf this is set to 'true', then if this function returns 'NULL', it will instead return a pointer to a garbage MYCHAR.
Returns
Returns this client's MYCHAR object.

◆ GetNamePlateRect()

void CaveNet::DataStructures::NetClient::GetNamePlateRect ( int *  x,
int *  y,
int *  w,
int *  h 
)

Get the rect for the name plate of this client.

Parameters
xA pointer to the X value.
yA pointer to the Y value.
wA pointer to the width value.
hA pointer to the height value.

◆ GetNetName()

const char* CaveNet::DataStructures::NetClient::GetNetName ( )
inline

Get this client's netname.

Returns
Returns this client's name.

◆ GetNextSpectateTarget()

NetClient* CaveNet::DataStructures::NetClient::GetNextSpectateTarget ( Directions  iDirect)

Get the next spectator target.

Parameters
iDirectThe direction in the clientgroup to get the next target. Should only be Directions::DIRECT_LEFT or Directions::DIRECT_RIGHT .
Returns
Returns the next client to spectate on success, or NULL if we couldn't find anyone to spectate.

◆ GetNPCDirtyIndex()

int CaveNet::DataStructures::NetClient::GetNPCDirtyIndex ( int  index)

Get the index of a dirty NPC.

Parameters
indexThe index of the NPC in gNPC.
Returns
int Returns the index of the NPC in our dirty list. Returns -1 if the given NPC is not queued.

◆ GetPing()

int CaveNet::DataStructures::NetClient::GetPing ( )
inline

Get this client's ping average.

Returns
Returns this client's ping average.

◆ GetPlayer()

NetPlayer* CaveNet::DataStructures::NetClient::GetPlayer ( )
inline

Get this client's player object.

Returns
Returns this client's player object.

◆ GetScreenRect()

void CaveNet::DataStructures::NetClient::GetScreenRect ( int *  x_out,
int *  y_out,
int *  w_out,
int *  h_out 
)

Get this client's screen rect.

Parameters
x_outA pointer to an int that will contain the X value. Can be NULL.
y_outA pointer to an int that will contain the Y value. Can be NULL.
w_outA pointer to an int that will contain the width value. Can be NULL.
h_outA pointer to an int that will contain the height value. Can be NULL.
Note
This only sets rect_out to a non-magnified, non-subpixel rect. (x, y, w, h).

◆ GetScriptContext()

TEXT_SCRIPT_PTR_DATA* CaveNet::DataStructures::NetClient::GetScriptContext ( TEXT_SCRIPT_PTR_DATA ptr)

Build the event context for this client.

Parameters
ptrA pointer to the TEXT_SCRIPT_PTR_DATA that will hold this client's script context.
Returns
Returns ptr.

◆ GetSignalStrengthRect()

void CaveNet::DataStructures::NetClient::GetSignalStrengthRect ( int *  x,
int *  y,
int *  w,
int *  h,
bool  IncrementFrame = true 
)

Get the SURFACE_ID_GUI rect for the signal strength of this client.

Parameters
xA pointer to the X value.
yA pointer to the Y value.
wA pointer to the width value.
hA pointer to the height value.

◆ GetSocket()

NetSocket* CaveNet::DataStructures::NetClient::GetSocket ( )
inline

Get this client's NetSocket.

Returns
Returns this client's current NetSocket.

◆ GetState()

const ClientState CaveNet::DataStructures::NetClient::GetState ( )
inline

Get the state of the client.

Returns
Returns the current state of the client.

◆ GetStringIP()

char* CaveNet::DataStructures::NetClient::GetStringIP ( char *  out,
int  out_size 
)

Get this client's IP into a string.

Parameters
outThe buffer to hold the IP.
out_sizeThe size of the buffer.
Returns
Returns 'out' param if successful.

◆ GetTeam()

NetTeam* CaveNet::DataStructures::NetClient::GetTeam ( )
inline

Get this client's team.

Returns
Returns a NetTeam* pointer if the client is in a team, NULL otherwise.

◆ GetTeamBalanceScore()

int CaveNet::DataStructures::NetClient::GetTeamBalanceScore ( )

Calculate a team balance score.

Returns
Returns a score.

◆ GetTeamId()

int CaveNet::DataStructures::NetClient::GetTeamId ( )
inline

Get this client's team id.

Returns
Returns this client's team id.

◆ GetTotalGameScore()

float CaveNet::DataStructures::NetClient::GetTotalGameScore ( unsigned long long int  iMaskBits,
unsigned long long int  iNegateMaskBits = 0 
)

Get this client's total score based on flags.

Parameters
iMaskBitsThe mask to use in calculating the score.
iNegateMaskBitsIf score types have these bits, then they will be skipped.
Returns
Returns this client's score according to the given flags.
See also
NetScoreMaskBits
CSM_RegisterNetScoreType

◆ GetZoneIndex()

int CaveNet::DataStructures::NetClient::GetZoneIndex ( int  zone_id)
inlineprotected

Find the zone in our array.

Parameters
zone_idThe ID of the zone
Returns
Returns the index of the zone in mCache.zones, or -1 if it couldn't be found.

◆ HandleGuiAction()

void CaveNet::DataStructures::NetClient::HandleGuiAction ( int  ActionIndex,
int  Arg1,
int  Arg2,
int  Arg3 
)

Handle any GUI interactions.

Parameters
ActionIndex...
Arg1...
Arg2...
Arg3...

◆ HasArmsData()

bool CaveNet::DataStructures::NetClient::HasArmsData ( long  code)

Check to see if this client has a weapon.

Parameters
codeThe weapon to check for
Returns
Returns true if the client has the weapon, false otherwise.

◆ IsAmmoFull()

bool CaveNet::DataStructures::NetClient::IsAmmoFull ( )

Check if the missile launcher is full.

Returns
Returns true if it is.

◆ IsBeingCarried()

bool CaveNet::DataStructures::NetClient::IsBeingCarried ( )

Check if we're being carried.

Returns
Returns true if we're being carried.

◆ IsBeingCarriedBy()

bool CaveNet::DataStructures::NetClient::IsBeingCarriedBy ( NetClientId  id)

Check to see if we're being carried by a specific client.

Parameters
idThe ID of the client we're checking for.
Returns
Returns true if we're being carried by the specified client.
Note
This function checks the entire carry stack.

◆ IsCarrying()

bool CaveNet::DataStructures::NetClient::IsCarrying ( )

Check if we're carrying anybody.

Returns
Returns true if we're carrying anybody.

◆ IsCarryingPlayer()

bool CaveNet::DataStructures::NetClient::IsCarryingPlayer ( NetClientId  id)

Check to see if we're carrying a specific client.

Parameters
idThe ID of the client we're checking for.
Returns
Returns true if we're carrying any client that matches this ghost id.
Note
This function checks the entire carry stack.

◆ IsDownloading()

bool CaveNet::DataStructures::NetClient::IsDownloading ( )

Check to see if this client is downloading.

Returns
Returns true if this client is downloading files, false otherwise.

◆ IsGhost()

bool CaveNet::DataStructures::NetClient::IsGhost ( )
inline

Check to see if this object is a ghost.

Returns
Returns true if this client belongs to the client vector.

◆ IsInGUI()

bool CaveNet::DataStructures::NetClient::IsInGUI ( )

Self-explanatory.

Returns
Returns true if the client is currently in a GUI.

◆ IsInZone()

bool CaveNet::DataStructures::NetClient::IsInZone ( int  zone_idx)

Check to see if we're in a zone.

Parameters
zone_idThe IDX of the zone

◆ IsMaxExp()

bool CaveNet::DataStructures::NetClient::IsMaxExp ( )

Has max EXP for the current weapon?

Returns
Returns true if this client is at max EXP & level for their held weapon.

◆ IsOurLocalClient()

bool CaveNet::DataStructures::NetClient::IsOurLocalClient ( )

Check to see whether this client is our local client or not.

Returns
Returns true if this is the local client.

◆ IsResourceDirty()

bool CaveNet::DataStructures::NetClient::IsResourceDirty ( GameResource *  pResource,
int  iIndex = -1 
)

Check if a resource is dirty for this client.

Parameters
pResourceThe resource to check.
iIndexThe index to start searching at.
Returns
Returns true if the specified resource is dirty.
Note
Dirty resources will be sent to the client to be updated.

◆ IsTargetSpectatable()

bool CaveNet::DataStructures::NetClient::IsTargetSpectatable ( NetClient pTarget)

Determine whether or not the specified client is spectatable.

Parameters
pTargetThe client to validate.
Returns
Returns true if the client can be spectated.

◆ NextDownload()

bool CaveNet::DataStructures::NetClient::NextDownload ( bool  deleteFirst = true)

Finish the current download & go to the next one.

Returns
Returns true if another download has been started, false if there are no downloads left.

◆ NextResource()

bool CaveNet::DataStructures::NetClient::NextResource ( bool  deleteFirst = true)

Download the next resource.

Parameters
deleteFirstWhether to delete the next resource in the queue or not.
Returns
Returns true if there is/was a resource in the queue.

◆ OpenGUI()

bool CaveNet::DataStructures::NetClient::OpenGUI ( CaveNet::DataStructures::GUI_Type  gui_type,
bool  DisableControl = true 
)

Open a GUI for this client.

Parameters
gui_typeThe type of GUI to open.
DisableControlDisable control for this client when the GUI opens.
Returns
Returns true if the GUI was opened.

◆ PredictMovement()

void CaveNet::DataStructures::NetClient::PredictMovement ( int  iNewInput,
long long int  iInputTime,
int  iClientX,
int  iClientY 
)

Predict this client's movement.

Parameters
iNewInputThe new input for this client.
iInputTimeThe server time at which the new input was used on the client's side.
iClientXThe client's X position.
iClientYThe client's Y position.

◆ ProcessGhosting()

void CaveNet::DataStructures::NetClient::ProcessGhosting ( )

Process ghosting on this client.

Should only be called server-side.

◆ PutStar()

void CaveNet::DataStructures::NetClient::PutStar ( int  fx,
int  fy 
)

Draw the whimsical stars.

Parameters
fxCamera X.
fyCamera Y.

◆ QueueDownload()

bool CaveNet::DataStructures::NetClient::QueueDownload ( NetDownload *  ptr)

Queue a download.

Parameters
ptrThe download to queue.
Returnstrue if the download was queued successfully.

◆ QueueResource()

bool CaveNet::DataStructures::NetClient::QueueResource ( GameResource *  pResource)

Queue a resource to be checked w/ this client.

Parameters
pResourceThe resource to queue.
Returns
Returns true if the resource was queue'd successfully, false otherwise.

◆ Read()

bool CaveNet::DataStructures::NetClient::Read ( NetPacket *  packet)

Read a packet from this client.

Parameters
NetPacket*packet A packet buffer.
Returns
Returns true if a packet was read.

◆ RecordFlag()

void CaveNet::DataStructures::NetClient::RecordFlag ( unsigned short  iFlagID,
bool  bFlagValue 
)

Record a flag change so it can be transmitted to the client.

Parameters
iFlagIDThe flag ID.
bFlagValueThe value of the flag.

◆ RemoveAllGameScores()

void CaveNet::DataStructures::NetClient::RemoveAllGameScores ( bool  bReAddMandatory = true,
bool  bTransmit = true 
)

Remove all NetScoreInstance objects from this client.

Parameters
bReAddMandatoryWhether to re-add mandatory NetScoreTypes or not.
bTransmitWhether or not to transmit the clearing.

◆ RemoveFromZone()

void CaveNet::DataStructures::NetClient::RemoveFromZone ( int  zone_idx)

Remove ourselves from a zone.

Parameters
zone_idThe IDX of the zone

◆ RemoveGameScore()

bool CaveNet::DataStructures::NetClient::RemoveGameScore ( const char *  pName)

Remove all NetScoreInstance objects from this client.

Parameters
pNameThe name of the score type.
Returns
Returns true if the game score was found and removed, false otherwise.

◆ Respawn()

void CaveNet::DataStructures::NetClient::Respawn ( int  iTime)

Respawn this client in a fixed amount of time.

Parameters
iTimeThe amount of time (in milliseconds) to wait before respawning.

◆ Say()

void CaveNet::DataStructures::NetClient::Say ( const char *  pMessage)

Have the client say something in chat.

Parameters
pMessageThe message to say.

◆ Send()

bool CaveNet::DataStructures::NetClient::Send ( NetPacket *  packet,
bool  bForceSend = false 
)

Send a packet to this client.

Parameters
NetPacket*packet The packet to be sent.
bForceSendBypass the packet queue system and send the packet immediately.
Returns
Returns true on success.

◆ SendMap()

void CaveNet::DataStructures::NetClient::SendMap ( int  event_id = 90)

Send the current map.

Parameters
event_idThe event to execute upon loading the map.

◆ SendPacketQueue()

bool CaveNet::DataStructures::NetClient::SendPacketQueue ( bool  bForce = false)

Send all queue'd packets, resetting the send time & clearing the queue.

Parameters
bForceWhether or not to force the packet queue to be sent. If this is false, then the packets will not be sent if not enough time has passed.
Returns
Returns true if the queue was sent, false otherwise.

◆ SendTeamData()

void CaveNet::DataStructures::NetClient::SendTeamData ( NetTeam pTeam = NULL)

Transmit the 'team update' packet.

Parameters
pTeamThe team to update the client about. If NULL, then it will update every team.

◆ SendTileChange()

void CaveNet::DataStructures::NetClient::SendTileChange ( int  x,
int  y,
int  new_tile 
)

Transmit a tile change to a client.

Parameters
xThe tile's X position.
yThe tile's Y position.
new_tileThe new tile index.

◆ SetColor()

void CaveNet::DataStructures::NetClient::SetColor ( unsigned char  r,
unsigned char  g,
unsigned char  b 
)

Set client color.

Parameters
rRed value.
gGreen value.
bBlue value.
Note
If r, g and b are set to 0, then the character will not display a custom color.

◆ SetDirect()

void CaveNet::DataStructures::NetClient::SetDirect ( int  direction)
Parameters
Setthe direction of the player
directionThe direction the player should face.
See also
Direction

◆ SetGameScore() [1/2]

bool CaveNet::DataStructures::NetClient::SetGameScore ( const char *  pName,
unsigned int  iAmount,
bool  bCurrentLife = false 
)

Set the points of a specific NetScoreType for this client.

Parameters
pNameThe name of the score type.
iAmountThe amount to set.
bCurrentLifeWhether to set iAmount to the current life or not.
Returns
Returns true if this was successfull, otherwise returns false.
See also
CSM_RegisterNetScoreType

◆ SetGameScore() [2/2]

bool CaveNet::DataStructures::NetClient::SetGameScore ( unsigned int  iNameHash,
unsigned int  iAmount,
bool  bCurrentLife = false 
)

Set the points of a specific NetScoreType for this client by the NetScoreType's name hash.

Parameters
iNameHashThe name hash of the score type.
iAmountThe amount to set.
bCurrentLifeWhether to set iAmount to the current life or not.
Returns
Returns true if this was successfull, otherwise returns false.
See also
CSM_RegisterNetScoreType

◆ SetGhostedClient()

void CaveNet::DataStructures::NetClient::SetGhostedClient ( NetClientId  id)
inline

Set this client as a ghosted object.

Parameters
idThe ghost ID.

◆ SetGhostId()

void CaveNet::DataStructures::NetClient::SetGhostId ( NetClientId  id)
inline

Set the ghost ID for this client.

Parameters
idThe ghost ID.

◆ SetPlayerPosition()

void CaveNet::DataStructures::NetClient::SetPlayerPosition ( int  x,
int  y 
)

Set the player's absolute position.

Parameters
xThe X position
yThe Y position

◆ SetResourceDirty()

bool CaveNet::DataStructures::NetClient::SetResourceDirty ( GameResource *  pResource,
bool  bValue,
int  iIndex = -1 
)

Set a resource as dirty.

Parameters
pResourceThe resource to set the dirtiness of.
bValueIf true, dirty pResource. If false, clean pResource.
Returns
Returns true if the operation was performed successfully, false otherwise.

◆ SetState()

void CaveNet::DataStructures::NetClient::SetState ( ClientState  state)
inlineprotected

Set the state of the client.

Parameters
stateThe new state of the client.

◆ ShowServerMessage()

void CaveNet::DataStructures::NetClient::ShowServerMessage ( const char *  pFormat,
  ... 
)

Show this specific client a server message.

Parameters
pFormatThe format to build the string with.
...Additional arguments.

◆ SimulateMovement()

int CaveNet::DataStructures::NetClient::SimulateMovement ( int  iNumFrames,
MYCHAR pMC,
unsigned int  iKeyMask = gKeyMaxVal 
)

Simulate character movement.

Parameters
iNumFramesHow many frames ahead to simulate.
pMCA pointer to a MYCHAR* structure to store the simulated data.
iKeyMaskThe key mask to allow. Use 'gKey' values. For example, 'gKeyShot' will allow the shoot key.
Returns
Returns number of frames simulated.

◆ Spawn()

void CaveNet::DataStructures::NetClient::Spawn ( int  x,
int  y 
)

Spawn this client at a set of coordinates.

Parameters
intx The X coordinate.
inty The Y coordinate.

◆ SpectatePlayer()

void CaveNet::DataStructures::NetClient::SpectatePlayer ( NetClientId  ghostId)

Spectate another client.

Parameters
ghostIdThe ghost ID of the client to observe.

◆ SubArmsData()

bool CaveNet::DataStructures::NetClient::SubArmsData ( long  code)

Remove arms data.

Parameters
codeThe weapon ID to remove.
Returns
Returns true if the weapon was found & removed, false otherwise.

◆ SubItemData()

bool CaveNet::DataStructures::NetClient::SubItemData ( long  code)

Remove an item.

Parameters
codeThe item ID
Returns
Returns true on success

◆ SubPermitStage()

bool CaveNet::DataStructures::NetClient::SubPermitStage ( int  index)

Remove a stage permission.

Parameters
indexThe index of the permitted stage.
Returns
Returns true if successfully removed.

◆ TradeArms()

bool CaveNet::DataStructures::NetClient::TradeArms ( long  code1,
long  code2,
long  max_num 
)

Trade arms.

Parameters
code1The weapon ID to trade in
code2The weapon ID to replace code1 with.
max_numThe maximum ammo for the new weapon.
Returns
Returns true on success.

◆ TransmitInventory()

void CaveNet::DataStructures::NetClient::TransmitInventory ( unsigned int  iTypeFlags)

Transmit this player's inventory.

Parameters
iTypeFlagsWhat to transmit.
See also
CaveNet::UpdateInventoryFlags

◆ TransmitScoreInstances()

void CaveNet::DataStructures::NetClient::TransmitScoreInstances ( CaveNet::DataStructures::NetScoreInstance pInstance = NULL)

Transmit the score instances for this client.

Parameters
pInstanceIf 'NULL', all instances will be sent instead of just one.

◆ ZeroEquip()

void CaveNet::DataStructures::NetClient::ZeroEquip ( )

Set / clear equip flags.

Parameters
flagThe flag to set / clear.
valWhether the flag should be set (true) or cleared (false).

Member Data Documentation

◆ count

int CaveNet::DataStructures::NetClient::count

How many files are in the queue.

How many resources are left to scope.

◆ mConn_Port

int CaveNet::DataStructures::NetClient::mConn_Port

Our connection port.

NEVER change this.

◆ mGhostId

NetClientId CaveNet::DataStructures::NetClient::mGhostId
protected

This client's Ghost ID.

See also
CaveNet::DataStructures::NetClient::GetGhostId()

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