Cavestory Mod API
Functions
CaveNet

Cavestory Networking. More...

Functions

CAVESTORY_MOD_API void CaveNet_CreateTeam (int iTeamId, bool bClientSide, void *pOut)
 Create a team object. More...
 
CAVESTORY_MOD_API unsigned int CaveNet_Client_GetGlobalTimerOffset ()
 Get the global timer. More...
 
CAVESTORY_MOD_API bool CaveNet_Client_IsInGui ()
 Check if we're in a GUI. More...
 
CAVESTORY_MOD_API bool CaveNet_Client_IsConnected ()
 Check if we're connected to a server. More...
 
CAVESTORY_MOD_API int CaveNet_Client_GetGhostId ()
 Get our ghost ID. More...
 
CAVESTORY_MOD_API CaveNet::DataStructures::NetClientCaveNet_Client_ClientGroup_GetClient (int index)
 Get a client object. More...
 
CAVESTORY_MOD_API CaveNet::DataStructures::NetClientCaveNet_Client_ClientGroup_GetClientByGhostId (int ghost_id)
 Get a client object by their ghost id. More...
 
CAVESTORY_MOD_API int CaveNet_Client_ClientGroup_GetClientCount ()
 Get the amount of clients currently cached. More...
 
CAVESTORY_MOD_API unsigned int CaveNet_Server_GetGlobalTimerOffset ()
 Get the server-side global timer. More...
 
CAVESTORY_MOD_API bool CaveNet_Server_IsHosting ()
 Check if we're hosting a server. More...
 
CAVESTORY_MOD_API bool CaveNet_Server_InLobby ()
 Check if we're in the lobby. More...
 
CAVESTORY_MOD_API void CaveNet_Server_EnterLobby ()
 Enter the lobby.
 
CAVESTORY_MOD_API CaveNet::DataStructures::NetClientCaveNet_Server_ClientGroup_AddBot (const char *pBotName=NULL, const char *pCharName=NULL, unsigned char iColorR=0, unsigned char iColorG=0, unsigned char iColorB=0, bool bRandomColor=false)
 Create a bot. More...
 
CAVESTORY_MOD_API CaveNet::DataStructures::NetClientCaveNet_Server_ClientGroup_GetClient (int index)
 Get a client object. More...
 
CAVESTORY_MOD_API CaveNet::DataStructures::NetClientCaveNet_Server_ClientGroup_GetClientByGhostId (int ghost_id)
 Get a client object by their ghost id. More...
 
CAVESTORY_MOD_API int CaveNet_Server_ClientGroup_GetClientCount ()
 Get the amount of clients currently cached. More...
 
CAVESTORY_MOD_API void CaveNet_Server_ClientGroup_TransmitSystemMessage (const char *pFormat,...)
 Transmit a system message. More...
 
CAVESTORY_MOD_API void CaveNet_Server_ClientGroup_ReviveAllDeadPlayers ()
 Revive all dead players.
 
CAVESTORY_MOD_API unsigned int CaveNet_GetGlobalTimerOffset ()
 Get the best global timer. More...
 
CAVESTORY_MOD_API void CaveNet_ProcessNet (int type=-1)
 Process networking. More...
 
CAVESTORY_MOD_API char * CaveNet_BuildDisconnectReasonString (char *pBuffer=NULL, unsigned int iBufferSize=0, CaveNet::NetDisconnectReason eDisconnectReason=CaveNet::NetDisconnectReason::NET_DISCONNECT_REASON_UNKNOWN, const char *pCustomReason=NULL, CaveNet::DataStructures::NetClient *pResponsibleClient=NULL)
 Build a disconnect reason string. More...
 
CAVESTORY_MOD_API bool CSM_CaveNet_ConnectedAsClient ()
 Check to see whether we're connected to a server or not. More...
 
CAVESTORY_MOD_API bool CSM_CaveNet_IsHosting ()
 Check to see whether we're hosting a server. More...
 
CAVESTORY_MOD_API int CSM_CaveNet_GetClientCount ()
 Get how many clients are currently connected to the server. More...
 
CAVESTORY_MOD_API int CSM_CaveNet_GetRealClientCount ()
 Get how many clients are currently connected to the server, excluding AI players. More...
 
CAVESTORY_MOD_API BOOL CSM_CaveNet_SendUserCmdToClient (CaveNet::DataStructures::NetClient *pClient, int iArg1=0, int iArg2=0, int iArg3=0, int iArg4=0, int iArg5=0, int iArg6=0, const char *pString1=NULL)
 Send a user command to a connected client. More...
 
CAVESTORY_MOD_API BOOL CSM_CaveNet_SendUserCmdToServer (int iArg1=0, int iArg2=0, int iArg3=0, int iArg4=0, int iArg5=0, int iArg6=0, const char *pString1=NULL)
 Send a user command to the server we're connected to. More...
 

Detailed Description

Cavestory Networking.

Cavestory Multiplayer Backend

Function Documentation

◆ CaveNet_BuildDisconnectReasonString()

CAVESTORY_MOD_API char* CaveNet_BuildDisconnectReasonString ( char *  pBuffer = NULL,
unsigned int  iBufferSize = 0,
CaveNet::NetDisconnectReason  eDisconnectReason = CaveNet::NetDisconnectReason::NET_DISCONNECT_REASON_UNKNOWN,
const char *  pCustomReason = NULL,
CaveNet::DataStructures::NetClient pResponsibleClient = NULL 
)

Build a disconnect reason string.

Parameters
pBufferThe buffer that will hold the built string. Can be NULL to use a global buffer. Do not use this in any non-main thread.
iBufferSizeThe size of the buffer.
eDisconnectReasonThe reason for the disconnect.
pCustomReasonThe custom reason, if applicable to the disconnect reason. Can be NULL.
pResponsibleClientThe client responsible for this disconnect. Can be NULL.
Returns
Returns pBuffer.

◆ CaveNet_Client_ClientGroup_GetClient()

CAVESTORY_MOD_API CaveNet::DataStructures::NetClient* CaveNet_Client_ClientGroup_GetClient ( int  index)

Get a client object.

Parameters
intindex The index of the client.
Returns
NetClient* The client object at the index.

◆ CaveNet_Client_ClientGroup_GetClientByGhostId()

CAVESTORY_MOD_API CaveNet::DataStructures::NetClient* CaveNet_Client_ClientGroup_GetClientByGhostId ( int  ghost_id)

Get a client object by their ghost id.

Parameters
intghost_id The ghost ID.
Returns
NetClient* The client object.

◆ CaveNet_Client_ClientGroup_GetClientCount()

CAVESTORY_MOD_API int CaveNet_Client_ClientGroup_GetClientCount ( )

Get the amount of clients currently cached.

Returns
int The amount of clients cached

◆ CaveNet_Client_GetGhostId()

CAVESTORY_MOD_API int CaveNet_Client_GetGhostId ( )

Get our ghost ID.

Returns
bool Returns the local client's ghost ID.

◆ CaveNet_Client_GetGlobalTimerOffset()

CAVESTORY_MOD_API unsigned int CaveNet_Client_GetGlobalTimerOffset ( )

Get the global timer.

Returns
Returns the global timer.

◆ CaveNet_Client_IsConnected()

CAVESTORY_MOD_API bool CaveNet_Client_IsConnected ( )

Check if we're connected to a server.

Returns
bool Returns true if we're connected to a server.

◆ CaveNet_Client_IsInGui()

CAVESTORY_MOD_API bool CaveNet_Client_IsInGui ( )

Check if we're in a GUI.

Returns
bool Returns true if we're in a server-controlled menu.

◆ CaveNet_CreateTeam()

CAVESTORY_MOD_API void CaveNet_CreateTeam ( int  iTeamId,
bool  bClientSide,
void *  pOut 
)

Create a team object.

Returns
Returns the newly created team object.

◆ CaveNet_GetGlobalTimerOffset()

CAVESTORY_MOD_API unsigned int CaveNet_GetGlobalTimerOffset ( )

Get the best global timer.

If a server is being hosted in this game instance, it will return the server's global timer. Otherwise, it will return the client-side global timer.

Returns
Returns the best global timer.

◆ CaveNet_ProcessNet()

CAVESTORY_MOD_API void CaveNet_ProcessNet ( int  type = -1)

Process networking.

Parameters
typeThe type of networking to process. Just use -1.

◆ CaveNet_Server_ClientGroup_AddBot()

CAVESTORY_MOD_API CaveNet::DataStructures::NetClient* CaveNet_Server_ClientGroup_AddBot ( const char *  pBotName = NULL,
const char *  pCharName = NULL,
unsigned char  iColorR = 0,
unsigned char  iColorG = 0,
unsigned char  iColorB = 0,
bool  bRandomColor = false 
)

Create a bot.

Parameters
pBotNameThe name for this bot.
pCharNameThe character name for this bot. Leave as 'NULL' to pick a random character.
iColorRThe bot's custom red value.
iColorGThe bot's custom green value.
iColorBThe bot's custom blue value.
bRandomColorWhether to use a random color.
Returns
Returns the newly created client on success, otherwise returns NULL.

◆ CaveNet_Server_ClientGroup_GetClient()

CAVESTORY_MOD_API CaveNet::DataStructures::NetClient* CaveNet_Server_ClientGroup_GetClient ( int  index)

Get a client object.

Parameters
intindex The index of the client.
Returns
NetClient* The client object at the index.

◆ CaveNet_Server_ClientGroup_GetClientByGhostId()

CAVESTORY_MOD_API CaveNet::DataStructures::NetClient* CaveNet_Server_ClientGroup_GetClientByGhostId ( int  ghost_id)

Get a client object by their ghost id.

Parameters
intghost_id The ghost ID.
Returns
NetClient* The client object.

◆ CaveNet_Server_ClientGroup_GetClientCount()

CAVESTORY_MOD_API int CaveNet_Server_ClientGroup_GetClientCount ( )

Get the amount of clients currently cached.

Returns
int The amount of clients cached

◆ CaveNet_Server_ClientGroup_TransmitSystemMessage()

CAVESTORY_MOD_API void CaveNet_Server_ClientGroup_TransmitSystemMessage ( const char *  pFormat,
  ... 
)

Transmit a system message.

Parameters
pFormatThe format of the message.
...Additional arguments.

◆ CaveNet_Server_GetGlobalTimerOffset()

CAVESTORY_MOD_API unsigned int CaveNet_Server_GetGlobalTimerOffset ( )

Get the server-side global timer.

Returns
Returns the global timer.

◆ CaveNet_Server_InLobby()

CAVESTORY_MOD_API bool CaveNet_Server_InLobby ( )

Check if we're in the lobby.

Returns
bool Returns true if we're in the lobby.

◆ CaveNet_Server_IsHosting()

CAVESTORY_MOD_API bool CaveNet_Server_IsHosting ( )

Check if we're hosting a server.

Returns
bool Returns true if we're hosting a server.

◆ CSM_CaveNet_ConnectedAsClient()

CAVESTORY_MOD_API bool CSM_CaveNet_ConnectedAsClient ( )

Check to see whether we're connected to a server or not.

Returns
Returns true if we're connected to a server, false otherwise.

◆ CSM_CaveNet_GetClientCount()

CAVESTORY_MOD_API int CSM_CaveNet_GetClientCount ( )

Get how many clients are currently connected to the server.

Returns
Returns how many clients are connected.

◆ CSM_CaveNet_GetRealClientCount()

CAVESTORY_MOD_API int CSM_CaveNet_GetRealClientCount ( )

Get how many clients are currently connected to the server, excluding AI players.

Returns
Returns how many clients are connected.

◆ CSM_CaveNet_IsHosting()

CAVESTORY_MOD_API bool CSM_CaveNet_IsHosting ( )

Check to see whether we're hosting a server.

Returns
Returns true if we're hosting a server.

◆ CSM_CaveNet_SendUserCmdToClient()

CAVESTORY_MOD_API BOOL CSM_CaveNet_SendUserCmdToClient ( CaveNet::DataStructures::NetClient pClient,
int  iArg1 = 0,
int  iArg2 = 0,
int  iArg3 = 0,
int  iArg4 = 0,
int  iArg5 = 0,
int  iArg6 = 0,
const char *  pString1 = NULL 
)

Send a user command to a connected client.

Parameters
pClientThe recipient.
iArg1Optional data to be sent.
iArg2Optional data to be sent.
iArg3Optional data to be sent.
iArg4Optional data to be sent.
iArg5Optional data to be sent.
iArg6Optional data to be sent.
pString1Optional data to be sent.
Returns
Returns TRUE if the user cmd was sent successfully.

◆ CSM_CaveNet_SendUserCmdToServer()

CAVESTORY_MOD_API BOOL CSM_CaveNet_SendUserCmdToServer ( int  iArg1 = 0,
int  iArg2 = 0,
int  iArg3 = 0,
int  iArg4 = 0,
int  iArg5 = 0,
int  iArg6 = 0,
const char *  pString1 = NULL 
)

Send a user command to the server we're connected to.

Parameters
iArg1Optional data to be sent.
iArg2Optional data to be sent.
iArg3Optional data to be sent.
iArg4Optional data to be sent.
iArg5Optional data to be sent.
iArg6Optional data to be sent.
pString1Optional data to be sent.
Returns
Returns TRUE if the user cmd was sent successfully.