Cavestory Mod API
Public Member Functions | Public Attributes | List of all members
SafeClientInterface Struct Reference

SafeClientInterface. More...

#include <CSMAPI_types.h>

Public Member Functions

 SafeClientInterface ()
 constructor
 
 SafeClientInterface (CaveNet::DataStructures::NetClient *pClient, unsigned int iSetType=SCI_SetType::SCI_ST_AUTO)
 Constructor 2.
 
bool Set (CaveNet::DataStructures::NetClient *pClient, unsigned int iSetType=SCI_SetType::SCI_ST_AUTO)
 Interface with a client. More...
 
void DamagePlayer (int iDamage)
 Damage this client's player. More...
 
void AddExp (int iAmount, bool bSpur=false)
 Add experience to the currently selected weapon. More...
 
bool IsMaxExp ()
 Check to see if we're at max EXP for the held weapon. More...
 
void ZeroExp ()
 Set the held weapon's exp to 0 and level to 1.
 
int CountArmsBullet (int iArmsCode)
 Get the number of active bullets w/ the given Weapon ID that this client has shot. More...
 
int CountBulletNum (int iBulletCode)
 Get the number of active bullets w/ the given Bullet ID that this client has shot. More...
 
bool ChangeArmsEnergy (int iAmmoAmt)
 Add ammo to the held weapon. More...
 
bool UseArmsEnergy (int iAmount)
 Use ammo from the held weapon. More...
 
bool HasArmsEnergy (int iWeaponId, int iAmount)
 Test ammo amount for the given weapon. More...
 
int GetArmsEnergy (int iWeaponId)
 Get the amount of ammo a wepaon has. More...
 
int GetArmsMaxEnergy (int iWeaponId)
 Get the maximum amount of ammo a wepaon can have. More...
 
int GetArmsExp (int iWeaponId, int *iMaxExp=NULL)
 Get the amount of EXP a weapon has. More...
 
void ChangeToFirstArms ()
 Change to this client's first weapon.
 
void NextWeapon ()
 Rotate arms to next weapon.
 
void PreviousWeapon ()
 Rotate arms to previous weapon.
 
unsigned long long int TestInput (unsigned long long int iFlags, CSM_KEY_DESC iInputType=CSM_KEY_DESC::CSM_KEY_DESC_KEY)
 Test input flags against this client's Key. More...
 

Public Attributes

CaveNet::DataStructures::NetClientmClient
 The client we're interfacing with. More...
 
bool mClientSide
 Whether this interface is client-sided or not.
 
int mGhostId
 The ghost ID of this user.
 
bool mIsOurUser
 Whether this is our user.
 
int * mSelectedArms
 A pointer to this client's selected arms.
 
ARMSmArms
 This client's arms table.
 
ITEMmItems
 This client's items table.
 
MYCHARmMC
 This client's player. More...
 
int * mKey
 This client's gameKey variable.
 
int * mKeyTrg
 This client's gameKeyTrg variable.
 
int * mKeyOld
 This client's gameKeyOld variable.
 
int * mSpurCharge
 This client's spur charge.
 
bool * mSpurMax
 Whether this client's spur charge is at maximum.
 
int * mGameFlags
 This client's game flags.
 
PERMIT_STAGEmPermitStages
 Permitted stages list.
 

Detailed Description

SafeClientInterface.

Member Function Documentation

◆ AddExp()

void SafeClientInterface::AddExp ( int  iAmount,
bool  bSpur = false 
)

Add experience to the currently selected weapon.

Parameters
iAmountThe amount of experience
bSpurShould be set to 'true' if a weapon similar to Spur is using this.

◆ ChangeArmsEnergy()

bool SafeClientInterface::ChangeArmsEnergy ( int  iAmmoAmt)

Add ammo to the held weapon.

Parameters
iAmmoAmtThe amount of ammo to add.
Returns
Returns true on success.

◆ CountArmsBullet()

int SafeClientInterface::CountArmsBullet ( int  iArmsCode)

Get the number of active bullets w/ the given Weapon ID that this client has shot.

Parameters
iArmsCodeThe weapon ID the bullets should be tied to.
Returns
Returns the number of bullets matching the parameters.

◆ CountBulletNum()

int SafeClientInterface::CountBulletNum ( int  iBulletCode)

Get the number of active bullets w/ the given Bullet ID that this client has shot.

Parameters
iBulletCodeThe bullet ID the bullets should have.
Returns
Returns the number of bullets matching the parameters.
Examples
WeaponShoot.cpp.

◆ DamagePlayer()

void SafeClientInterface::DamagePlayer ( int  iDamage)

Damage this client's player.

Parameters
iDamageThe amount of damage to do.
Note
This function handles death.

◆ GetArmsEnergy()

int SafeClientInterface::GetArmsEnergy ( int  iWeaponId)

Get the amount of ammo a wepaon has.

Parameters
iWeaponIdThe weapon ID.
Returns
Returns the amount of ammo the weapon has, if we have it. If we don't have the specified weapon, then this returns -1.

◆ GetArmsExp()

int SafeClientInterface::GetArmsExp ( int  iWeaponId,
int *  iMaxExp = NULL 
)

Get the amount of EXP a weapon has.

Parameters
iWeaponIdThe weapon ID.
iMaxExpA pointer to an int, to hold the amount of EXP needed to get to the next level. This can be NULL.
Returns
Returns the amount of EXP the specified weapon has, unless we don't have it, in which this returns -1.

◆ GetArmsMaxEnergy()

int SafeClientInterface::GetArmsMaxEnergy ( int  iWeaponId)

Get the maximum amount of ammo a wepaon can have.

Parameters
iWeaponIdThe weapon ID.
Returns
Returns the maximum amount of ammo the weapon can have, if we have it. If we don't have the specified weapon, then this returns -1.

◆ HasArmsEnergy()

bool SafeClientInterface::HasArmsEnergy ( int  iWeaponId,
int  iAmount 
)

Test ammo amount for the given weapon.

Parameters
iWeaponIdThe weapon ID.
iAmountThe amount to check for.
Returns
Returns true if the weapon has exactly (or more than) iAmount.

◆ IsMaxExp()

bool SafeClientInterface::IsMaxExp ( )

Check to see if we're at max EXP for the held weapon.

Returns
Returns true if the client is at max EXP for the selected weapon.

◆ Set()

bool SafeClientInterface::Set ( CaveNet::DataStructures::NetClient pClient,
unsigned int  iSetType = SCI_SetType::SCI_ST_AUTO 
)

Interface with a client.

Parameters
pClientThe client to interface with. Can be NULL to interface with the local player.
iSetTypeThe flags used to determine the best candidate for this interface.
Returns
Returns true on success, otherwise returns false if it couldn't find a suitable client.
See also
SCI_SetType

◆ TestInput()

unsigned long long int SafeClientInterface::TestInput ( unsigned long long int  iFlags,
CSM_KEY_DESC  iInputType = CSM_KEY_DESC::CSM_KEY_DESC_KEY 
)

Test input flags against this client's Key.

Parameters
iFlagsThe flags to test.
iInputTypeThe input type to test.
Returns
Returns the result of testing the given flags against the input.
See also
KEYBIND
KEYBIND2
KEYBIND_JOY

◆ UseArmsEnergy()

bool SafeClientInterface::UseArmsEnergy ( int  iAmount)

Use ammo from the held weapon.

Parameters
iAmountThe amount of ammo to check for & decrement if available.
Returns
Returns true if there was enough ammo, false if not.
Examples
WeaponShoot.cpp.

Member Data Documentation

◆ mClient

CaveNet::DataStructures::NetClient* SafeClientInterface::mClient

The client we're interfacing with.

This will always be the server-sided client, UNLESS we aren't hosting the server.

◆ mMC

MYCHAR* SafeClientInterface::mMC

This client's player.

Can be NULL.


The documentation for this struct was generated from the following files: