mirror of
https://github.com/rehlds/reapi.git
synced 2024-12-29 08:05:36 +03:00
Added hook CanBuyThisItem, CBasePlayer::DropPlayerItem
Added new members CArmoury
This commit is contained in:
parent
85384bcb11
commit
af1a542b45
@ -658,6 +658,41 @@ enum ArmorType
|
||||
ARMOR_VESTHELM, // vest and helmet
|
||||
};
|
||||
|
||||
// for CArmoury::m_Armoury_iItem
|
||||
enum ArmouryItemPack
|
||||
{
|
||||
ARMOURY_MP5NAVY,
|
||||
ARMOURY_TMP,
|
||||
ARMOURY_P90,
|
||||
ARMOURY_MAC10,
|
||||
ARMOURY_AK47,
|
||||
ARMOURY_SG552,
|
||||
ARMOURY_M4A1,
|
||||
ARMOURY_AUG,
|
||||
ARMOURY_SCOUT,
|
||||
ARMOURY_G3SG1,
|
||||
ARMOURY_AWP,
|
||||
ARMOURY_M3,
|
||||
ARMOURY_XM1014,
|
||||
ARMOURY_M249,
|
||||
ARMOURY_FLASHBANG,
|
||||
ARMOURY_HEGRENADE,
|
||||
ARMOURY_KEVLAR,
|
||||
ARMOURY_ASSAULT,
|
||||
ARMOURY_SMOKEGRENADE
|
||||
};
|
||||
|
||||
enum BuyItemID
|
||||
{
|
||||
BUY_ITEM_VEST = 1,
|
||||
BUY_ITEM_VESTHELM,
|
||||
BUY_ITEM_FLASHGREN,
|
||||
BUY_ITEM_HEGREN,
|
||||
BUY_ITEM_SMOKEGREN,
|
||||
BUY_ITEM_NVG,
|
||||
BUY_ITEM_DEFUSEKIT
|
||||
};
|
||||
|
||||
enum RewardType
|
||||
{
|
||||
RT_NONE,
|
||||
|
@ -37,7 +37,8 @@ enum members_tables_e
|
||||
mt_csplayer,
|
||||
mt_baseitem,
|
||||
mt_baseweapon,
|
||||
mt_weaponbox
|
||||
mt_weaponbox,
|
||||
mt_armoury
|
||||
};
|
||||
|
||||
#define MAX_REGION_RANGE 1024
|
||||
|
@ -73,6 +73,7 @@ native rh_reset_mapname();
|
||||
* @param flags Emit flags
|
||||
* @param pitch Sound pitch
|
||||
* @param emitFlags Additional Emit2 flags, look at the defines like SND_EMIT2_*
|
||||
* @param origin Specify origin and only on "param" entity worldspawn that is 0
|
||||
*
|
||||
* @return 1 if successfully sounds are emitted, 0 otherwise
|
||||
*
|
||||
|
@ -173,7 +173,7 @@ native rg_dmg_radius(Float:vecSrc[3], const inflictor, const attacker, const Flo
|
||||
native rg_multidmg_clear();
|
||||
|
||||
/*
|
||||
* inflicts contents of global multi damage register on victim
|
||||
* Inflicts contents of global multi damage register on victim
|
||||
*
|
||||
* @param inflictor Inflictor is the entity that caused the damage (such as a gun)
|
||||
* @param attacker Attacker is the entity that tirggered the damage (such as the gun's owner).
|
||||
|
@ -160,7 +160,7 @@ enum GamedllFunc
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Params: (const index, const iWeapon)
|
||||
* Params: (const index, const WeaponIdType:iWeapon)
|
||||
*/
|
||||
RG_CanBuyThis,
|
||||
|
||||
@ -198,7 +198,13 @@ enum GamedllFunc
|
||||
* Description: -
|
||||
* Params: (const index, VGUIMenu:menuType, const bitsSlots, szOldMenu[], bool:bForceOldMenu)
|
||||
*/
|
||||
RG_ShowVGUIMenu
|
||||
RG_ShowVGUIMenu,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Params: (const index, BuyItemID:item)
|
||||
*/
|
||||
RG_CanBuyThisItem
|
||||
};
|
||||
|
||||
enum GamedllFunc_CBaseAnimating
|
||||
@ -396,7 +402,13 @@ enum GamedllFunc_CBasePlayer
|
||||
* Description: -
|
||||
* Params: (const this, bool:bDeploy)
|
||||
*/
|
||||
RG_CBasePlayer_GiveShield
|
||||
RG_CBasePlayer_GiveShield,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Params: (const this, const pszItemName[])
|
||||
*/
|
||||
RG_CBasePlayer_DropPlayerItem
|
||||
};
|
||||
|
||||
enum GamedllFunc_CSGameRules
|
||||
@ -4221,3 +4233,39 @@ enum CWeaponBox_Members
|
||||
*/
|
||||
m_WeaponBox_bIsBomb,
|
||||
};
|
||||
|
||||
// CArmoury
|
||||
enum CArmoury_Members
|
||||
{
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int (or enum's ArmouryItemPack)
|
||||
* Get params: ArmouryItemPack:get_member(index, member);
|
||||
* Set params: set_member(index, member, ArmouryItemPack:value);
|
||||
*/
|
||||
m_Armoury_iItem = BEGIN_MEMBER_REGION(armoury),
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
m_Armoury_iCount,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: int
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
m_Armoury_iInitialCount,
|
||||
|
||||
/*
|
||||
* Description: -
|
||||
* Member type: bool
|
||||
* Get params: get_member(index, member);
|
||||
* Set params: set_member(index, member, value);
|
||||
*/
|
||||
m_Armoury_bAlreadyCounted,
|
||||
};
|
||||
|
@ -125,7 +125,6 @@ typedef IVoidHookChainRegistryClass<class CBasePlayer> IReGameHookRegistry_CBase
|
||||
typedef IVoidHookChainClass<class CBasePlayer, float, float, float, int> IReGameHook_CBasePlayer_Blind;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, float, float, float, int> IReGameHookRegistry_CBasePlayer_Blind;
|
||||
|
||||
|
||||
// CBasePlayer::Observer_IsValidTarget hook
|
||||
typedef IHookChainClass<class CBasePlayer *, class CBasePlayer, int, bool> IReGameHook_CBasePlayer_Observer_IsValidTarget;
|
||||
typedef IHookChainRegistryClass<class CBasePlayer *, class CBasePlayer, int, bool> IReGameHookRegistry_CBasePlayer_Observer_IsValidTarget;
|
||||
@ -306,6 +305,10 @@ typedef IVoidHookChainRegistry<> IReGameHookRegistry_CSGameRules_BalanceTeams;
|
||||
typedef IHookChain<bool, class CBasePlayer *, BuyItemID> IReGameHook_CanBuyThisItem;
|
||||
typedef IHookChainRegistry<bool, class CBasePlayer *, BuyItemID> IReGameHookRegistry_CanBuyThisItem;
|
||||
|
||||
// CBasePlayer::DropPlayerItem hook
|
||||
typedef IVoidHookChainClass<class CBasePlayer, const char *> IReGameHook_CBasePlayer_DropPlayerItem;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_DropPlayerItem;
|
||||
|
||||
class IReGameHookchains {
|
||||
public:
|
||||
virtual ~IReGameHookchains() {}
|
||||
@ -381,6 +384,7 @@ public:
|
||||
virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0;
|
||||
|
||||
virtual IReGameHookRegistry_CanBuyThisItem* CanBuyThisItem() = 0;
|
||||
virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem() = 0;
|
||||
};
|
||||
|
||||
struct ReGameFuncs_t {
|
||||
|
@ -330,6 +330,16 @@ void CBasePlayer_GiveShield(IReGameHook_CBasePlayer_GiveShield *chain, CBasePlay
|
||||
callVoidForward(RG_CBasePlayer_GiveShield, original, indexOfEdict(pthis->pev), bDeploy);
|
||||
}
|
||||
|
||||
void CBasePlayer_DropPlayerItem(IReGameHook_CBasePlayer_DropPlayerItem *chain, CBasePlayer *pthis, const char *pszItemName)
|
||||
{
|
||||
auto original = [chain](int _pthis, const char *_pszItemName)
|
||||
{
|
||||
chain->callNext(getPrivate<CBasePlayer>(_pthis), _pszItemName);
|
||||
};
|
||||
|
||||
callVoidForward(RG_CBasePlayer_DropPlayerItem, original, indexOfEdict(pthis->pev), pszItemName);
|
||||
}
|
||||
|
||||
void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis)
|
||||
{
|
||||
auto original = [chain](int _pthis)
|
||||
@ -394,6 +404,16 @@ bool CanBuyThis(IReGameHook_CanBuyThis *chain, CBasePlayer *pPlayer, int iWeapon
|
||||
return callForward<bool>(RG_CanBuyThis, original, indexOfEdict(pPlayer->pev), iWeapon);
|
||||
}
|
||||
|
||||
bool CanBuyThisItem(IReGameHook_CanBuyThisItem *chain, CBasePlayer *pPlayer, BuyItemID item)
|
||||
{
|
||||
auto original = [chain](int _pPlayer, BuyItemID _item)
|
||||
{
|
||||
return chain->callNext(getPrivate<CBasePlayer>(_pPlayer), _item);
|
||||
};
|
||||
|
||||
return callForward<bool>(RG_CanBuyThisItem, original, indexOfEdict(pPlayer->pev), item);
|
||||
}
|
||||
|
||||
void PM_Move(IReGameHook_PM_Move *chain, playermove_t *ppmove, int server)
|
||||
{
|
||||
auto original = [chain](playermove_t *_ppmove, int _server)
|
||||
|
@ -240,6 +240,13 @@ void PlayerBlind(IReGameHook_PlayerBlind *chain, CBasePlayer *pPlayer, entvars_t
|
||||
void RadiusFlash_TraceLine(IReGameHook_RadiusFlash_TraceLine *chain, CBasePlayer *pPlayer, entvars_t *pevInflictor, entvars_t *pevAttacker, Vector& vecSrc, Vector& vecSpot, TraceResult *ptr);
|
||||
bool RoundEnd(IReGameHook_RoundEnd *chain, int winStatus, ScenarioEventEndRound event, float tmDelay);
|
||||
bool CanBuyThis(IReGameHook_CanBuyThis *chain, CBasePlayer *pPlayer, int iWeapon);
|
||||
bool CanBuyThisItem(IReGameHook_CanBuyThisItem *chain, CBasePlayer *pPlayer, BuyItemID item);
|
||||
void PM_Move(IReGameHook_PM_Move *chain, playermove_t *ppmove, int server);
|
||||
void PM_AirMove(IReGameHook_PM_AirMove *chain, int playerIndex);
|
||||
void HandleMenu_ChooseAppearance(IReGameHook_HandleMenu_ChooseAppearance *chain, CBasePlayer *pPlayer, int slot);
|
||||
BOOL HandleMenu_ChooseTeam(IReGameHook_HandleMenu_ChooseTeam *chain, CBasePlayer *pPlayer, int slot);
|
||||
void ShowMenu(IReGameHook_ShowMenu *chain, CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText);
|
||||
void ShowVGUIMenu(IReGameHook_ShowVGUIMenu *chain, CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu);
|
||||
|
||||
// regamedll functions - player
|
||||
void CBasePlayer_Spawn(IReGameHook_CBasePlayer_Spawn *chain, CBasePlayer *pthis);
|
||||
@ -271,12 +278,10 @@ void CBasePlayer_GiveDefaultItems(IReGameHook_CBasePlayer_GiveDefaultItems *chai
|
||||
void CBasePlayer_GiveNamedItem(IReGameHook_CBasePlayer_GiveNamedItem *chain, CBasePlayer *pthis, const char *pszName);
|
||||
void CBasePlayer_AddAccount(IReGameHook_CBasePlayer_AddAccount *chain, CBasePlayer *pthis, int amount, RewardType type, bool bTrackChange);
|
||||
void CBasePlayer_GiveShield(IReGameHook_CBasePlayer_GiveShield *chain, CBasePlayer *pthis, bool bDeploy);
|
||||
void CBasePlayer_DropPlayerItem(IReGameHook_CBasePlayer_DropPlayerItem *chain, CBasePlayer *pthis, const char *pszItemName);
|
||||
|
||||
void CBaseAnimating_ResetSequenceInfo(IReGameHook_CBaseAnimating_ResetSequenceInfo *chain, CBaseAnimating *pthis);
|
||||
|
||||
void PM_Move(IReGameHook_PM_Move *chain, playermove_t *ppmove, int server);
|
||||
void PM_AirMove(IReGameHook_PM_AirMove *chain, int playerIndex);
|
||||
|
||||
BOOL CSGameRules_FShouldSwitchWeapon(IReGameHook_CSGameRules_FShouldSwitchWeapon *chain, CBasePlayer *pPlayer, CBasePlayerItem *pWeapon);
|
||||
BOOL CSGameRules_GetNextBestWeapon(IReGameHook_CSGameRules_GetNextBestWeapon *chain, CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon);
|
||||
float CSGameRules_FlPlayerFallDamage(IReGameHook_CSGameRules_FlPlayerFallDamage *chain, CBasePlayer *pPlayer);
|
||||
@ -303,11 +308,6 @@ void CSGameRules_BalanceTeams(IReGameHook_CSGameRules_BalanceTeams *chain);
|
||||
void CBasePlayer_SetClientUserInfoModel(IReGameHook_CBasePlayer_SetClientUserInfoModel *chain, CBasePlayer *pthis, char *infobuffer, char *szNewModel);
|
||||
void CBasePlayer_SetClientUserInfoName(IReGameHook_CBasePlayer_SetClientUserInfoName *chain, CBasePlayer *pthis, char *infobuffer, char *szNewName);
|
||||
|
||||
void HandleMenu_ChooseAppearance(IReGameHook_HandleMenu_ChooseAppearance *chain, CBasePlayer *pPlayer, int slot);
|
||||
BOOL HandleMenu_ChooseTeam(IReGameHook_HandleMenu_ChooseTeam *chain, CBasePlayer *pPlayer, int slot);
|
||||
void ShowMenu(IReGameHook_ShowMenu *chain, CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText);
|
||||
void ShowVGUIMenu(IReGameHook_ShowVGUIMenu *chain, CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu);
|
||||
|
||||
extern int g_iClientStartSpeak;
|
||||
extern int g_iClientStopSpeak;
|
||||
|
||||
|
@ -6,6 +6,7 @@ inline size_t getFwdParamType(void(*)(Vector&)) { return FP_ARRAY; }
|
||||
inline size_t getFwdParamType(void(*)(PLAYER_ANIM)) { return FP_CELL; }
|
||||
inline size_t getFwdParamType(void(*)(RewardType)) { return FP_CELL; }
|
||||
inline size_t getFwdParamType(void(*)(ScenarioEventEndRound)) { return FP_CELL; }
|
||||
inline size_t getFwdParamType(void(*)(BuyItemID)) { return FP_CELL; }
|
||||
inline size_t getFwdParamType(void(*)(float)) { return FP_FLOAT; }
|
||||
inline size_t getFwdParamType(void(*)(float&)) { return FP_FLOAT; }
|
||||
inline size_t getFwdParamType(void(*)(const char *)) { return FP_STRING; }
|
||||
@ -83,6 +84,7 @@ hook_t hooklist_gamedll[] = {
|
||||
DLL(HandleMenu_ChooseTeam),
|
||||
DLL(ShowMenu),
|
||||
DLL(ShowVGUIMenu),
|
||||
DLL(CanBuyThisItem),
|
||||
};
|
||||
|
||||
hook_t hooklist_animating[] = {
|
||||
@ -121,6 +123,7 @@ hook_t hooklist_player[] = {
|
||||
DLL(CBasePlayer_GiveNamedItem),
|
||||
DLL(CBasePlayer_AddAccount),
|
||||
DLL(CBasePlayer_GiveShield),
|
||||
DLL(CBasePlayer_DropPlayerItem),
|
||||
};
|
||||
|
||||
hook_t hooklist_gamerules[] = {
|
||||
|
@ -91,6 +91,7 @@ enum GamedllFunc
|
||||
RG_HandleMenu_ChooseTeam,
|
||||
RG_ShowMenu,
|
||||
RG_ShowVGUIMenu,
|
||||
RG_CanBuyThisItem,
|
||||
|
||||
// [...]
|
||||
RG_End
|
||||
@ -138,6 +139,7 @@ enum GamedllFunc_CBasePlayer
|
||||
RG_CBasePlayer_GiveNamedItem,
|
||||
RG_CBasePlayer_AddAccount,
|
||||
RG_CBasePlayer_GiveShield,
|
||||
RG_CBasePlayer_DropPlayerItem,
|
||||
|
||||
// [...]
|
||||
RG_CBasePlayer_End
|
||||
|
@ -17,6 +17,7 @@
|
||||
#define BASEITEM_MEMBERS(mx) CLASS_MEMBERS(CBasePlayerItem, mx, mx,)
|
||||
#define BASEWPN_MEMBERS(mx) CLASS_MEMBERS(CBasePlayerWeapon, mx, m_Weapon_##mx, m_)
|
||||
#define WPNBOX_MEMBERS(mx) CLASS_MEMBERS(CWeaponBox_COM, mx, m_WeaponBox_##mx, m_)
|
||||
#define ARMOURY_MEMBERS(mx) CLASS_MEMBERS(CArmoury, mx, m_Armoury_##mx, m_)
|
||||
|
||||
inline MType getMemberType(float*) { return MEMBER_FLOAT; }
|
||||
inline MType getMemberType(float) { return MEMBER_FLOAT; }
|
||||
@ -724,6 +725,13 @@ member_t memberlist_weaponbox[] = {
|
||||
WPNBOX_MEMBERS(bIsBomb),
|
||||
};
|
||||
|
||||
member_t memberlist_armoury[] = {
|
||||
ARMOURY_MEMBERS(iItem),
|
||||
ARMOURY_MEMBERS(iCount),
|
||||
ARMOURY_MEMBERS(iInitialCount),
|
||||
ARMOURY_MEMBERS(bAlreadyCounted),
|
||||
};
|
||||
|
||||
memberlist_t memberlist;
|
||||
|
||||
member_t *memberlist_t::operator[](size_t members) const
|
||||
@ -748,6 +756,7 @@ member_t *memberlist_t::operator[](size_t members) const
|
||||
CASE(baseitem)
|
||||
CASE(baseweapon)
|
||||
CASE(weaponbox)
|
||||
CASE(armoury)
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -53,7 +53,8 @@ struct memberlist_t
|
||||
mt_csplayer,
|
||||
mt_baseitem,
|
||||
mt_baseweapon,
|
||||
mt_weaponbox
|
||||
mt_weaponbox,
|
||||
mt_armoury
|
||||
};
|
||||
};
|
||||
|
||||
@ -727,3 +728,11 @@ enum CWeaponBox_Members
|
||||
m_WeaponBox_cAmmoTypes,
|
||||
m_WeaponBox_bIsBomb,
|
||||
};
|
||||
|
||||
enum CArmoury_Members
|
||||
{
|
||||
m_Armoury_iItem = BEGIN_MEMBER_REGION(armoury),
|
||||
m_Armoury_iCount,
|
||||
m_Armoury_iInitialCount,
|
||||
m_Armoury_bAlreadyCounted,
|
||||
};
|
||||
|
@ -1612,7 +1612,8 @@ cell AMX_NATIVE_CALL rh_reset_mapname(AMX *amx, cell *params)
|
||||
* @param flags Emit flags
|
||||
* @param pitch Sound pitch
|
||||
* @param emitFlags Additional Emit2 flags, look at the defines like SND_EMIT2_*
|
||||
|
||||
* @param origin Specify origin and only on "param" entity worldspawn that is 0
|
||||
*
|
||||
* @return 1 if successfully sounds are emitted, 0 otherwise
|
||||
*
|
||||
* native rh_emit_sound2(const entity, const recipient, const channel, const sample[], Float:vol = VOL_NORM, Float:attn = ATTN_NORM, const flags = 0, const pitch = PITCH_NORM, emitFlags = 0, const Float:origin[3] = {0.0,0.0,0.0});
|
||||
|
@ -5,4 +5,4 @@
|
||||
|
||||
// reapi version
|
||||
#define REAPI_VERSION_MAJOR 3
|
||||
#define REAPI_VERSION_MINOR 1
|
||||
#define REAPI_VERSION_MINOR 2
|
||||
|
Loading…
Reference in New Issue
Block a user