Cavestory Mod API
|
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... | |
SafeClientInterface * | GetInterface () |
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::NetScoreInstance * | GetGameScoreInstanceByHash (unsigned int iNameHash, bool bAdd=false) |
Get a NetScoreInstance by its name hash. More... | |
CaveNet::DataStructures::NetScoreInstance * | GetGameScoreInstance (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... | |
NetTeam * | GetTeam () |
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. | |
MYCHAR * | GetDFocus () |
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... | |
NetClient * | GetCarryStackUp () |
Get the next client in the carry stack. More... | |
NetClient * | GetCarryStackDown () |
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. | |
NetClient * | GetNextSpectateTarget (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... | |
NetPlayer * | GetPlayer () |
Get this client's player object. More... | |
MYCHAR * | GetMyChar (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... | |
IPaddress * | GetAddress () |
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_DATA * | GetScriptContext (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 | |
NetTeam * | mTeam |
The team we're apart of. | |
NetPlayer * | mPlayer |
This client's player object. | |
NetSocket * | mSocket |
The socket this client is using to communicate to us. | |
IPaddress | mAddress |
This client's IP address. | |
NetClientVector * | mVector |
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 |
Networking client.
Handles a client that is currently connected to us.
bool CaveNet::DataStructures::NetClient::AddArmsData | ( | long | code, |
long | max_num | ||
) |
Add arms data.
code | The weapon ID to add |
max_num | The maximum ammo for this weapon. |
bool CaveNet::DataStructures::NetClient::AddArmsData2 | ( | long | code, |
long | num, | ||
long | max_num, | ||
long | level | ||
) |
Add arms data.
code | The weapon ID to add |
num | The amount of ammo for this weapon. |
max_num | The maximum ammo for this weapon. |
level | The level of the weapon. |
void CaveNet::DataStructures::NetClient::AddBullet | ( | int | no, |
int | val | ||
) |
Add ammo to the held weapon.
no | Amount of ammo to add. |
val |
void CaveNet::DataStructures::NetClient::AddExp | ( | int | x, |
BOOL | spur = false |
||
) |
Add experience to the held weapon.
x | Amount of EXP to add |
void CaveNet::DataStructures::NetClient::AddExpToNextValidWeapon | ( | int | x | ) |
Add experience to the next valid weapon.
x | Amount of EXP to add |
bool CaveNet::DataStructures::NetClient::AddGameScore | ( | const char * | pName, |
int | iAmount | ||
) |
Add score to this client.
pName | The name of the score type. |
iAmount | The amount to add. Can be negative to remove score. |
bool CaveNet::DataStructures::NetClient::AddItemData | ( | long | code | ) |
Add an item to inventory.
code | The item ID |
bool CaveNet::DataStructures::NetClient::AddPermitStage | ( | int | index, |
int | event | ||
) |
Add a stage permission.
index | The UI position of the stage in the teleportation GUI. |
event | The event to execute when selected. |
void CaveNet::DataStructures::NetClient::AddToPacketQueue | ( | NetPacket * | pPacket | ) |
Queue a packet to be sent when the server is ready.
pPacket | The packet to be queue'd for this client. |
void CaveNet::DataStructures::NetClient::AddToZone | ( | int | zone_idx | ) |
Add ourselves to a zone.
zone_id | The IDX of the zone |
int CaveNet::DataStructures::NetClient::ArmsNext | ( | ) |
Switch to the next weapon in our inventory.
int CaveNet::DataStructures::NetClient::ArmsPrev | ( | ) |
Switch to the previous weapon in our inventory.
bool CaveNet::DataStructures::NetClient::Assign | ( | NetSocket * | sock, |
IPaddress * | addr, | ||
int | channel = -2 |
||
) |
Assign this client to a socket & address.
sock | The socket to bind the client to. |
addr | The address to bind the client to. |
void CaveNet::DataStructures::NetClient::AutoAdminCheck | ( | ) |
Check for administrator privileges for this client.
void CaveNet::DataStructures::NetClient::BackStep | ( | int | code_event | ) |
Backstep the player.
code_event | What to backstep from. |
void CaveNet::DataStructures::NetClient::BuildDownloadString | ( | char * | out, |
int | out_size | ||
) |
Get the progress of the current download in string form.
out | A pointer to a buffer to store the string. |
out_size | The size of ' out '. |
bool CaveNet::DataStructures::NetClient::BuildFullPacket_Join | ( | NetPacket * | out | ) |
Construct a full-on connection packet.
out | The packet to build the output in. |
bool CaveNet::DataStructures::NetClient::BuildFullPacket_MovePacket | ( | NetPacket * | out | ) |
Construct a full-on move packet.
out | The packet to build the output in. |
bool CaveNet::DataStructures::NetClient::BuildStemPacket_Join | ( | NetPacket * | out | ) |
Build a 'join' packet.
out | The packet to hold the output. |
int CaveNet::DataStructures::NetClient::BuildStemPacket_PlayerPhysicsUpdate | ( | NetPacket * | out | ) |
Build a 'player physics' packet.
out | The packet to hold the output. |
int CaveNet::DataStructures::NetClient::BuildStemPacket_PlayerUpdate | ( | NetPacket * | out | ) |
Build a 'player update' packet.
out | The packet to hold the output. |
bool CaveNet::DataStructures::NetClient::BuildStemPacket_Ready | ( | NetPacket * | out | ) |
Build a 'ready' packet.
out | The packet to hold the output. |
int CaveNet::DataStructures::NetClient::BuildStemPacket_ScoreInstance | ( | NetPacket * | out, |
CaveNet::DataStructures::NetScoreInstance * | pInst = NULL |
||
) |
Build a 'score instance' packet.
out | The packet to hold the output. |
pInst | The instance to use. Can be NULL. |
int CaveNet::DataStructures::NetClient::BuildStemPacket_Update | ( | NetPacket * | out | ) |
Build an 'update' packet.
out | The packet to hold the output. |
int CaveNet::DataStructures::NetClient::BuildStemPacket_UpdatePing | ( | NetPacket * | out | ) |
Build an 'update ping' packet.
out | The packet to hold the output. |
int CaveNet::DataStructures::NetClient::BuildStemPacket_WhimsicalStar | ( | NetPacket * | out | ) |
Build a 'whimsical star update' packet.
out | The packet to hold the output. |
void CaveNet::DataStructures::NetClient::CalculateZoneCandidates | ( | int | zones[CAVENET_CLIENT_MAX_ZONES], |
int * | count | ||
) |
Calculate & build a list of zone candidates.
zones | The zone list to populate with zone candidates. |
count | A pointer to an int that will hold the number of valid zones in 'zones'. |
bool CaveNet::DataStructures::NetClient::CanBeAutoBalanced | ( | ) |
Determine whether this client can be auto balanced or not.
bool CaveNet::DataStructures::NetClient::CanBeCarriedBy | ( | NetClient * | other | ) |
Check if we can be carried by a client.
other | The client to check. |
bool CaveNet::DataStructures::NetClient::CanCarry | ( | NetClient * | other | ) |
Check if we can carry a client.
other | The client to check. |
bool CaveNet::DataStructures::NetClient::CanOpenGUI | ( | CaveNet::DataStructures::GUI_Type | gui_type | ) |
Check to see if this client can open a type of GUI.
gui_type | The type of GUI to check. |
bool CaveNet::DataStructures::NetClient::CarryPlayer | ( | NetClientId | id | ) |
Carry a player.
id | The client ID of the person we should carry. |
void CaveNet::DataStructures::NetClient::ChatEmote | ( | int | index | ) |
Play an emote.
index | The index of the emote. |
bool CaveNet::DataStructures::NetClient::CheckArms | ( | long | code | ) |
Check this client's inventory for a weapon.
code | The code of the weapon to check for. |
bool CaveNet::DataStructures::NetClient::CheckItem | ( | long | code | ) |
Check this client's inventory for an item.
code | The code of the item to check for. |
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.
index | The index of the NPC. |
void CaveNet::DataStructures::NetClient::ClearZones | ( | bool | do_remove = true | ) |
Clear our occupied zones.
do_remove | Do the removal process for every zone. Setting this to 'false' will make it just memset the zones array & set zone_count to 0. |
bool CaveNet::DataStructures::NetClient::CloseGUI | ( | bool | EnableControl = true | ) |
Close any open GUI for this client.
EnableControl | Enable control when the GUI closes. |
bool CaveNet::DataStructures::NetClient::CompareUserIdent | ( | unsigned int * | pUserIdent | ) |
Compare this user's ident hash to the one given.
pUserIdent | The hash to compare against. |
void CaveNet::DataStructures::NetClient::DirtyNPC | ( | int | index | ) |
Mark an NPC at the given index as 'dirty'.
It will be queued for re-ghosting.
index | The index of the NPC. |
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.
eDisconnectReason | The reason for the disconnect. |
pCustomReason | The custom reason, if applicable to the disconnect reason. |
pResponsibleClient | The client responsible for this disconnect. |
bool CaveNet::DataStructures::NetClient::Dismount | ( | bool | deleteAnim = true | ) |
Dismount from the player we're mounted on.
deleteAnim | Delete the carry animation. |
void CaveNet::DataStructures::NetClient::DrawChatEmote | ( | int | fx, |
int | fy | ||
) |
Draw the emote.
fx | Camera X position. |
fy | Camera Y position. |
void CaveNet::DataStructures::NetClient::EquipItem | ( | int | flag, |
bool | val | ||
) |
Set / clear equip flags.
flag | The flag to set / clear. |
val | Whether the flag should be set (true) or cleared (false). |
|
inline |
Get the channel this client's address.
|
inline |
int CaveNet::DataStructures::NetClient::GetArmsCount | ( | ) |
Get the amount of valid weapon slots this client has.
int CaveNet::DataStructures::NetClient::GetArmsSlot | ( | long | code | ) |
Get the slot index of this arms id.
code | The weapon to check for. |
NetClient* CaveNet::DataStructures::NetClient::GetCarryStackDown | ( | ) |
Get the previous carried client.
NetClient* CaveNet::DataStructures::NetClient::GetCarryStackUp | ( | ) |
Get the next client in the carry stack.
|
inline |
Get the channel this client is communicating on.
CustomPlayer* CaveNet::DataStructures::NetClient::GetCharacter | ( | ) |
Get our custom player.
|
inline |
Get client color.
MYCHAR* CaveNet::DataStructures::NetClient::GetDFocus | ( | ) |
Get display focus for mAnimNPCs.
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.
face_src_rect | A pointer to the GUI_RECT that will hold the face rect. |
surf_id | A pointer to a Surface_Ids variable that will hold the face's surface ID. |
mask_id | A pointer to a Surface_Ids variable that will hold the face mask's surface ID. |
CaveNet::DataStructures::NetScoreInstance* CaveNet::DataStructures::NetClient::GetGameScoreInstance | ( | const char * | pName, |
bool | bAdd = false |
||
) |
Get a NetScoreInstance by its name.
pName | The name of the score type. |
bAdd | Add this type if it was not found. |
CaveNet::DataStructures::NetScoreInstance* CaveNet::DataStructures::NetClient::GetGameScoreInstanceByHash | ( | unsigned int | iNameHash, |
bool | bAdd = false |
||
) |
Get a NetScoreInstance by its name hash.
iNameHash | The name hash of the score type. |
bAdd | Add this type if it was not found. |
|
inline |
Get this client's ghost ID.
SafeClientInterface* CaveNet::DataStructures::NetClient::GetInterface | ( | ) |
Get an interface for this client.
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.
|
inline |
void CaveNet::DataStructures::NetClient::GetNamePlateRect | ( | int * | x, |
int * | y, | ||
int * | w, | ||
int * | h | ||
) |
Get the rect for the name plate of this client.
x | A pointer to the X value. |
y | A pointer to the Y value. |
w | A pointer to the width value. |
h | A pointer to the height value. |
|
inline |
Get this client's netname.
NetClient* CaveNet::DataStructures::NetClient::GetNextSpectateTarget | ( | Directions | iDirect | ) |
Get the next spectator target.
iDirect | The direction in the clientgroup to get the next target. Should only be Directions::DIRECT_LEFT or Directions::DIRECT_RIGHT . |
int CaveNet::DataStructures::NetClient::GetNPCDirtyIndex | ( | int | index | ) |
Get the index of a dirty NPC.
index | The index of the NPC in gNPC. |
|
inline |
Get this client's ping average.
|
inline |
Get this client's player object.
void CaveNet::DataStructures::NetClient::GetScreenRect | ( | int * | x_out, |
int * | y_out, | ||
int * | w_out, | ||
int * | h_out | ||
) |
Get this client's screen rect.
x_out | A pointer to an int that will contain the X value. Can be NULL. |
y_out | A pointer to an int that will contain the Y value. Can be NULL. |
w_out | A pointer to an int that will contain the width value. Can be NULL. |
h_out | A pointer to an int that will contain the height value. Can be NULL. |
TEXT_SCRIPT_PTR_DATA* CaveNet::DataStructures::NetClient::GetScriptContext | ( | TEXT_SCRIPT_PTR_DATA * | ptr | ) |
Build the event context for this client.
ptr | A pointer to the TEXT_SCRIPT_PTR_DATA that will hold this client's script context. |
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.
x | A pointer to the X value. |
y | A pointer to the Y value. |
w | A pointer to the width value. |
h | A pointer to the height value. |
|
inline |
Get this client's NetSocket.
|
inline |
Get the state of the client.
char* CaveNet::DataStructures::NetClient::GetStringIP | ( | char * | out, |
int | out_size | ||
) |
Get this client's IP into a string.
out | The buffer to hold the IP. |
out_size | The size of the buffer. |
|
inline |
Get this client's team.
int CaveNet::DataStructures::NetClient::GetTeamBalanceScore | ( | ) |
Calculate a team balance score.
|
inline |
Get this client's team id.
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.
iMaskBits | The mask to use in calculating the score. |
iNegateMaskBits | If score types have these bits, then they will be skipped. |
|
inlineprotected |
Find the zone in our array.
zone_id | The ID of the zone |
void CaveNet::DataStructures::NetClient::HandleGuiAction | ( | int | ActionIndex, |
int | Arg1, | ||
int | Arg2, | ||
int | Arg3 | ||
) |
Handle any GUI interactions.
ActionIndex | ... |
Arg1 | ... |
Arg2 | ... |
Arg3 | ... |
bool CaveNet::DataStructures::NetClient::HasArmsData | ( | long | code | ) |
Check to see if this client has a weapon.
code | The weapon to check for |
bool CaveNet::DataStructures::NetClient::IsAmmoFull | ( | ) |
Check if the missile launcher is full.
bool CaveNet::DataStructures::NetClient::IsBeingCarried | ( | ) |
Check if we're being carried.
bool CaveNet::DataStructures::NetClient::IsBeingCarriedBy | ( | NetClientId | id | ) |
Check to see if we're being carried by a specific client.
id | The ID of the client we're checking for. |
bool CaveNet::DataStructures::NetClient::IsCarrying | ( | ) |
Check if we're carrying anybody.
bool CaveNet::DataStructures::NetClient::IsCarryingPlayer | ( | NetClientId | id | ) |
Check to see if we're carrying a specific client.
id | The ID of the client we're checking for. |
bool CaveNet::DataStructures::NetClient::IsDownloading | ( | ) |
Check to see if this client is downloading.
|
inline |
Check to see if this object is a ghost.
bool CaveNet::DataStructures::NetClient::IsInGUI | ( | ) |
Self-explanatory.
bool CaveNet::DataStructures::NetClient::IsInZone | ( | int | zone_idx | ) |
Check to see if we're in a zone.
zone_id | The IDX of the zone |
bool CaveNet::DataStructures::NetClient::IsMaxExp | ( | ) |
Has max EXP for the current weapon?
bool CaveNet::DataStructures::NetClient::IsOurLocalClient | ( | ) |
Check to see whether this client is our local client or not.
bool CaveNet::DataStructures::NetClient::IsResourceDirty | ( | GameResource * | pResource, |
int | iIndex = -1 |
||
) |
Check if a resource is dirty for this client.
pResource | The resource to check. |
iIndex | The index to start searching at. |
bool CaveNet::DataStructures::NetClient::IsTargetSpectatable | ( | NetClient * | pTarget | ) |
Determine whether or not the specified client is spectatable.
pTarget | The client to validate. |
bool CaveNet::DataStructures::NetClient::NextDownload | ( | bool | deleteFirst = true | ) |
Finish the current download & go to the next one.
bool CaveNet::DataStructures::NetClient::NextResource | ( | bool | deleteFirst = true | ) |
Download the next resource.
deleteFirst | Whether to delete the next resource in the queue or not. |
bool CaveNet::DataStructures::NetClient::OpenGUI | ( | CaveNet::DataStructures::GUI_Type | gui_type, |
bool | DisableControl = true |
||
) |
Open a GUI for this client.
gui_type | The type of GUI to open. |
DisableControl | Disable control for this client when the GUI opens. |
void CaveNet::DataStructures::NetClient::PredictMovement | ( | int | iNewInput, |
long long int | iInputTime, | ||
int | iClientX, | ||
int | iClientY | ||
) |
Predict this client's movement.
iNewInput | The new input for this client. |
iInputTime | The server time at which the new input was used on the client's side. |
iClientX | The client's X position. |
iClientY | The client's Y position. |
void CaveNet::DataStructures::NetClient::ProcessGhosting | ( | ) |
Process ghosting on this client.
Should only be called server-side.
void CaveNet::DataStructures::NetClient::PutStar | ( | int | fx, |
int | fy | ||
) |
Draw the whimsical stars.
fx | Camera X. |
fy | Camera Y. |
bool CaveNet::DataStructures::NetClient::QueueDownload | ( | NetDownload * | ptr | ) |
Queue a download.
ptr | The download to queue. |
Returns | true if the download was queued successfully. |
bool CaveNet::DataStructures::NetClient::QueueResource | ( | GameResource * | pResource | ) |
Queue a resource to be checked w/ this client.
pResource | The resource to queue. |
bool CaveNet::DataStructures::NetClient::Read | ( | NetPacket * | packet | ) |
Read a packet from this client.
NetPacket* | packet A packet buffer. |
void CaveNet::DataStructures::NetClient::RecordFlag | ( | unsigned short | iFlagID, |
bool | bFlagValue | ||
) |
Record a flag change so it can be transmitted to the client.
iFlagID | The flag ID. |
bFlagValue | The value of the flag. |
void CaveNet::DataStructures::NetClient::RemoveAllGameScores | ( | bool | bReAddMandatory = true , |
bool | bTransmit = true |
||
) |
Remove all NetScoreInstance objects from this client.
bReAddMandatory | Whether to re-add mandatory NetScoreTypes or not. |
bTransmit | Whether or not to transmit the clearing. |
void CaveNet::DataStructures::NetClient::RemoveFromZone | ( | int | zone_idx | ) |
Remove ourselves from a zone.
zone_id | The IDX of the zone |
bool CaveNet::DataStructures::NetClient::RemoveGameScore | ( | const char * | pName | ) |
Remove all NetScoreInstance objects from this client.
pName | The name of the score type. |
void CaveNet::DataStructures::NetClient::Respawn | ( | int | iTime | ) |
Respawn this client in a fixed amount of time.
iTime | The amount of time (in milliseconds) to wait before respawning. |
void CaveNet::DataStructures::NetClient::Say | ( | const char * | pMessage | ) |
Have the client say something in chat.
pMessage | The message to say. |
bool CaveNet::DataStructures::NetClient::Send | ( | NetPacket * | packet, |
bool | bForceSend = false |
||
) |
Send a packet to this client.
NetPacket* | packet The packet to be sent. |
bForceSend | Bypass the packet queue system and send the packet immediately. |
void CaveNet::DataStructures::NetClient::SendMap | ( | int | event_id = 90 | ) |
Send the current map.
event_id | The event to execute upon loading the map. |
bool CaveNet::DataStructures::NetClient::SendPacketQueue | ( | bool | bForce = false | ) |
Send all queue'd packets, resetting the send time & clearing the queue.
bForce | Whether 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. |
void CaveNet::DataStructures::NetClient::SendTeamData | ( | NetTeam * | pTeam = NULL | ) |
Transmit the 'team update' packet.
pTeam | The team to update the client about. If NULL, then it will update every team. |
void CaveNet::DataStructures::NetClient::SendTileChange | ( | int | x, |
int | y, | ||
int | new_tile | ||
) |
Transmit a tile change to a client.
x | The tile's X position. |
y | The tile's Y position. |
new_tile | The new tile index. |
void CaveNet::DataStructures::NetClient::SetColor | ( | unsigned char | r, |
unsigned char | g, | ||
unsigned char | b | ||
) |
Set client color.
r | Red value. |
g | Green value. |
b | Blue value. |
void CaveNet::DataStructures::NetClient::SetDirect | ( | int | direction | ) |
Set | the direction of the player |
direction | The direction the player should face. |
bool CaveNet::DataStructures::NetClient::SetGameScore | ( | const char * | pName, |
unsigned int | iAmount, | ||
bool | bCurrentLife = false |
||
) |
Set the points of a specific NetScoreType for this client.
pName | The name of the score type. |
iAmount | The amount to set. |
bCurrentLife | Whether to set iAmount to the current life or not. |
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.
iNameHash | The name hash of the score type. |
iAmount | The amount to set. |
bCurrentLife | Whether to set iAmount to the current life or not. |
|
inline |
Set this client as a ghosted object.
id | The ghost ID. |
|
inline |
Set the ghost ID for this client.
id | The ghost ID. |
void CaveNet::DataStructures::NetClient::SetPlayerPosition | ( | int | x, |
int | y | ||
) |
Set the player's absolute position.
x | The X position |
y | The Y position |
bool CaveNet::DataStructures::NetClient::SetResourceDirty | ( | GameResource * | pResource, |
bool | bValue, | ||
int | iIndex = -1 |
||
) |
Set a resource as dirty.
pResource | The resource to set the dirtiness of. |
bValue | If true, dirty pResource. If false, clean pResource. |
|
inlineprotected |
Set the state of the client.
state | The new state of the client. |
void CaveNet::DataStructures::NetClient::ShowServerMessage | ( | const char * | pFormat, |
... | |||
) |
Show this specific client a server message.
pFormat | The format to build the string with. |
... | Additional arguments. |
int CaveNet::DataStructures::NetClient::SimulateMovement | ( | int | iNumFrames, |
MYCHAR * | pMC, | ||
unsigned int | iKeyMask = gKeyMaxVal |
||
) |
Simulate character movement.
iNumFrames | How many frames ahead to simulate. |
pMC | A pointer to a MYCHAR* structure to store the simulated data. |
iKeyMask | The key mask to allow. Use 'gKey' values. For example, 'gKeyShot' will allow the shoot key. |
void CaveNet::DataStructures::NetClient::Spawn | ( | int | x, |
int | y | ||
) |
Spawn this client at a set of coordinates.
int | x The X coordinate. |
int | y The Y coordinate. |
void CaveNet::DataStructures::NetClient::SpectatePlayer | ( | NetClientId | ghostId | ) |
Spectate another client.
ghostId | The ghost ID of the client to observe. |
bool CaveNet::DataStructures::NetClient::SubArmsData | ( | long | code | ) |
Remove arms data.
code | The weapon ID to remove. |
bool CaveNet::DataStructures::NetClient::SubItemData | ( | long | code | ) |
Remove an item.
code | The item ID |
bool CaveNet::DataStructures::NetClient::SubPermitStage | ( | int | index | ) |
Remove a stage permission.
index | The index of the permitted stage. |
bool CaveNet::DataStructures::NetClient::TradeArms | ( | long | code1, |
long | code2, | ||
long | max_num | ||
) |
Trade arms.
code1 | The weapon ID to trade in |
code2 | The weapon ID to replace code1 with. |
max_num | The maximum ammo for the new weapon. |
void CaveNet::DataStructures::NetClient::TransmitInventory | ( | unsigned int | iTypeFlags | ) |
Transmit this player's inventory.
iTypeFlags | What to transmit. |
void CaveNet::DataStructures::NetClient::TransmitScoreInstances | ( | CaveNet::DataStructures::NetScoreInstance * | pInstance = NULL | ) |
Transmit the score instances for this client.
pInstance | If 'NULL', all instances will be sent instead of just one. |
void CaveNet::DataStructures::NetClient::ZeroEquip | ( | ) |
Set / clear equip flags.
flag | The flag to set / clear. |
val | Whether the flag should be set (true) or cleared (false). |
int CaveNet::DataStructures::NetClient::count |
How many files are in the queue.
How many resources are left to scope.
int CaveNet::DataStructures::NetClient::mConn_Port |
Our connection port.
NEVER change this.
|
protected |
This client's Ghost ID.