From 83a01dbb4899ff41d201e9917e92954d38d28fb1 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 21 Jun 2016 02:32:02 +0700 Subject: [PATCH] Removed api hooks CanBuyThisItem, CanBuyThis, CWeaponBox::Touch, CArmoury::ArmouryTouch Added api hook CBasePlayer::HasRestrictItem --- regamedll/dlls/client.cpp | 43 +++--- regamedll/dlls/client.h | 12 -- regamedll/dlls/effects.cpp | 9 +- regamedll/dlls/healthkit.cpp | 5 + regamedll/dlls/items.cpp | 161 ++++++++++++++++++++- regamedll/dlls/items.h | 71 +++++++-- regamedll/dlls/maprules.cpp | 6 + regamedll/dlls/player.cpp | 10 ++ regamedll/dlls/player.h | 6 +- regamedll/dlls/weapons.cpp | 24 ++- regamedll/dlls/weapons.h | 6 +- regamedll/extra/cssdk/dlls/client.h | 11 -- regamedll/extra/cssdk/dlls/items.h | 64 ++++++-- regamedll/extra/cssdk/dlls/player.h | 4 +- regamedll/extra/cssdk/dlls/regamedll_api.h | 31 +--- regamedll/extra/cssdk/dlls/weapons.h | 5 +- regamedll/public/regamedll/regamedll_api.h | 31 +--- regamedll/regamedll/regamedll_api_impl.cpp | 6 +- regamedll/regamedll/regamedll_api_impl.h | 36 +---- 19 files changed, 367 insertions(+), 174 deletions(-) diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 62880e4b..62710293 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -848,9 +848,7 @@ void DropPrimary(CBasePlayer *pPlayer) } } -LINK_HOOK_CHAIN(bool, CanBuyThis, (CBasePlayer *pPlayer, int iWeapon), pPlayer, iWeapon); - -bool __API_HOOK(CanBuyThis)(CBasePlayer *pPlayer, int iWeapon) +bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon) { if (pPlayer->HasShield() && iWeapon == WEAPON_ELITE) return false; @@ -1007,12 +1005,6 @@ void BuyMachineGun(CBasePlayer *pPlayer, int iSlot) BuyWeaponByWeaponID(pPlayer, WEAPON_M249); } -#ifdef REGAMEDLL_ADD -bool EXT_FUNC CanBuyThisItem_hook(CBasePlayer *pPlayer, BuyItemID item) { - return true; -} -#endif - void BuyItem(CBasePlayer *pPlayer, int iSlot) { int iItemPrice = 0; @@ -1041,10 +1033,9 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) case MENU_SLOT_ITEM_VEST: { #ifdef REGAMEDLL_ADD - if (!g_ReGameHookchains.m_CanBuyThisItem.callChain(CanBuyThisItem_hook, pPlayer, BUY_ITEM_VEST)) + if (pPlayer->HasRestrictItem(ITEM_KEVLAR, ITEM_TYPE_BUYING)) return; #endif - if (fullArmor) { if (g_bClientPrintEnable) @@ -1071,10 +1062,9 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) case MENU_SLOT_ITEM_VESTHELM: { #ifdef REGAMEDLL_ADD - if (!g_ReGameHookchains.m_CanBuyThisItem.callChain(CanBuyThisItem_hook, pPlayer, BUY_ITEM_VESTHELM)) + if (pPlayer->HasRestrictItem(ITEM_ASSAULT, ITEM_TYPE_BUYING)) return; #endif - if (fullArmor) { if (bHasHelmet) @@ -1131,10 +1121,9 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) case MENU_SLOT_ITEM_FLASHGREN: { #ifdef REGAMEDLL_ADD - if (!g_ReGameHookchains.m_CanBuyThisItem.callChain(CanBuyThisItem_hook, pPlayer, BUY_ITEM_FLASHGREN)) + if (pPlayer->HasRestrictItem(ITEM_FLASHBANG, ITEM_TYPE_BUYING)) return; #endif - if (pPlayer->AmmoInventory(pPlayer->GetAmmoIndex("Flashbang")) >= MaxAmmoCarry("Flashbang")) { if (g_bClientPrintEnable) @@ -1157,10 +1146,9 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) case MENU_SLOT_ITEM_HEGREN: { #ifdef REGAMEDLL_ADD - if (!g_ReGameHookchains.m_CanBuyThisItem.callChain(CanBuyThisItem_hook, pPlayer, BUY_ITEM_HEGREN)) + if (pPlayer->HasRestrictItem(ITEM_HEGRENADE, ITEM_TYPE_BUYING)) return; #endif - if (pPlayer->AmmoInventory(pPlayer->GetAmmoIndex("HEGrenade")) >= MaxAmmoCarry("HEGrenade")) { if (g_bClientPrintEnable) @@ -1182,10 +1170,9 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) case MENU_SLOT_ITEM_SMOKEGREN: { #ifdef REGAMEDLL_ADD - if (!g_ReGameHookchains.m_CanBuyThisItem.callChain(CanBuyThisItem_hook, pPlayer, BUY_ITEM_SMOKEGREN)) + if (pPlayer->HasRestrictItem(ITEM_SMOKEGRENADE, ITEM_TYPE_BUYING)) return; #endif - if (pPlayer->AmmoInventory(pPlayer->GetAmmoIndex("SmokeGrenade")) >= MaxAmmoCarry("SmokeGrenade")) { if (g_bClientPrintEnable) @@ -1207,10 +1194,9 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) case MENU_SLOT_ITEM_NVG: { #ifdef REGAMEDLL_ADD - if (!g_ReGameHookchains.m_CanBuyThisItem.callChain(CanBuyThisItem_hook, pPlayer, BUY_ITEM_NVG)) + if (pPlayer->HasRestrictItem(ITEM_NVG, ITEM_TYPE_BUYING)) return; #endif - if (pPlayer->m_bHasNightVision) { if (g_bClientPrintEnable) @@ -1241,10 +1227,9 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) case MENU_SLOT_ITEM_DEFUSEKIT: { #ifdef REGAMEDLL_ADD - if (!g_ReGameHookchains.m_CanBuyThisItem.callChain(CanBuyThisItem_hook, pPlayer, BUY_ITEM_DEFUSEKIT)) + if (pPlayer->HasRestrictItem(ITEM_DEFUSEKIT, ITEM_TYPE_BUYING)) return; #endif - if (pPlayer->m_iTeam != CT || !CSGameRules()->m_bMapHasBombTarget) return; @@ -1281,6 +1266,11 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) } case MENU_SLOT_ITEM_SHIELD: { +#ifdef REGAMEDLL_ADD + if (pPlayer->HasRestrictItem(ITEM_SHIELDGUN, ITEM_TYPE_BUYING)) + return; +#endif + if (!CanBuyThis(pPlayer, WEAPON_SHIELDGUN)) return; @@ -1326,6 +1316,11 @@ void BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID) if (!pPlayer->CanPlayerBuy(true)) return; +#ifdef REGAMEDLL_ADD + if (pPlayer->HasRestrictItem((ItemID)weaponID, ITEM_TYPE_BUYING)) + return; +#endif + if (!CanBuyThis(pPlayer, weaponID)) return; @@ -4461,7 +4456,7 @@ int EXT_FUNC GetWeaponData(edict_t *player, struct weapon_data_s *info) } // Data sent to current client only engine sets cd to 0 before calling. -void EXT_FUNC UpdateClientData(const struct edict_s *ent, int sendweapons, struct clientdata_s *cd) +void EXT_ALIGN UpdateClientData(const struct edict_s *ent, int sendweapons, struct clientdata_s *cd) { if (!ent || !ent->pvPrivateData) return; diff --git a/regamedll/dlls/client.h b/regamedll/dlls/client.h index ea734be1..46ed3024 100644 --- a/regamedll/dlls/client.h +++ b/regamedll/dlls/client.h @@ -58,17 +58,6 @@ enum BuyItemMenuSlot MENU_SLOT_ITEM_SHIELD, }; -enum BuyItemID -{ - BUY_ITEM_VEST = 1, - BUY_ITEM_VESTHELM, - BUY_ITEM_FLASHGREN, - BUY_ITEM_HEGREN, - BUY_ITEM_SMOKEGREN, - BUY_ITEM_NVG, - BUY_ITEM_DEFUSEKIT -}; - #define CS_NUM_SKIN 4 #define CZ_NUM_SKIN 5 @@ -143,7 +132,6 @@ void Host_Say(edict_t *pEntity, int teamonly); void DropSecondary(CBasePlayer *pPlayer); void DropPrimary(CBasePlayer *pPlayer); bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon); -bool CanBuyThis_(CBasePlayer *pPlayer, int iWeapon); void BuyPistol(CBasePlayer *pPlayer, int iSlot); void BuyShotgun(CBasePlayer *pPlayer, int iSlot); void BuySubMachineGun(CBasePlayer *pPlayer, int iSlot); diff --git a/regamedll/dlls/effects.cpp b/regamedll/dlls/effects.cpp index b8abbae1..fd49f1bf 100644 --- a/regamedll/dlls/effects.cpp +++ b/regamedll/dlls/effects.cpp @@ -1966,8 +1966,15 @@ void CItemSoda::CanTouch(CBaseEntity *pOther) return; } + CBasePlayer *pPlayer = static_cast(pOther); + +#ifdef REGAMEDLL_ADD + if (pPlayer->HasRestrictItem(ITEM_SODACAN, ITEM_TYPE_TOUCHED)) + return; +#endif + // spoit sound here - pOther->TakeHealth(1, DMG_GENERIC);// a bit of health. + pPlayer->TakeHealth(1, DMG_GENERIC);// a bit of health. if (!FNullEnt(pev->owner)) { diff --git a/regamedll/dlls/healthkit.cpp b/regamedll/dlls/healthkit.cpp index 3f587a25..995323d1 100644 --- a/regamedll/dlls/healthkit.cpp +++ b/regamedll/dlls/healthkit.cpp @@ -34,6 +34,11 @@ void CHealthKit::__MAKE_VHOOK(Precache)() BOOL CHealthKit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { +#ifdef REGAMEDLL_ADD + if (pPlayer->HasRestrictItem(ITEM_HEALTHKIT, ITEM_TYPE_TOUCHED)) + return FALSE; +#endif + if (pPlayer->TakeHealth(gSkillData.healthkitCapacity, DMG_GENERIC)) { MESSAGE_BEGIN(MSG_ONE, gmsgItemPickup, NULL, pPlayer->pev); diff --git a/regamedll/dlls/items.cpp b/regamedll/dlls/items.cpp index fe81329b..427e6efc 100644 --- a/regamedll/dlls/items.cpp +++ b/regamedll/dlls/items.cpp @@ -1,12 +1,62 @@ #include "precompiled.h" +ItemInfo itemInfo[] = { + DEFINE_ITEMINFO(ITEM_SHIELDGUN, "weapon_shield"), + DEFINE_ITEMINFO(ITEM_P228, "weapon_p228"), + DEFINE_ITEMINFO(ITEM_GLOCK, "weapon_glock"), + DEFINE_ITEMINFO(ITEM_SCOUT, "weapon_scout"), + DEFINE_ITEMINFO(ITEM_HEGRENADE, "weapon_hegrenade"), + DEFINE_ITEMINFO(ITEM_XM1014, "weapon_xm1014"), + DEFINE_ITEMINFO(ITEM_C4, "weapon_c4"), + DEFINE_ITEMINFO(ITEM_MAC10, "weapon_mac10"), + DEFINE_ITEMINFO(ITEM_AUG, "weapon_aug"), + DEFINE_ITEMINFO(ITEM_SMOKEGRENADE, "weapon_smokegrenade"), + DEFINE_ITEMINFO(ITEM_ELITE, "weapon_elite"), + DEFINE_ITEMINFO(ITEM_FIVESEVEN, "weapon_fiveseven"), + DEFINE_ITEMINFO(ITEM_UMP45, "weapon_ump45"), + DEFINE_ITEMINFO(ITEM_SG550, "weapon_sg550"), + DEFINE_ITEMINFO(ITEM_GALIL, "weapon_galil"), + DEFINE_ITEMINFO(ITEM_FAMAS, "weapon_famas"), + DEFINE_ITEMINFO(ITEM_USP, "weapon_usp"), + DEFINE_ITEMINFO(ITEM_GLOCK18, "weapon_glock18"), + DEFINE_ITEMINFO(ITEM_AWP, "weapon_awp"), + DEFINE_ITEMINFO(ITEM_MP5N, "weapon_mp5navy"), + DEFINE_ITEMINFO(ITEM_M249, "weapon_m249"), + DEFINE_ITEMINFO(ITEM_M3, "weapon_m3"), + DEFINE_ITEMINFO(ITEM_M4A1, "weapon_m4a1"), + DEFINE_ITEMINFO(ITEM_TMP, "weapon_tmp"), + DEFINE_ITEMINFO(ITEM_G3SG1, "weapon_g3sg1"), + DEFINE_ITEMINFO(ITEM_FLASHBANG, "weapon_flashbang"), + DEFINE_ITEMINFO(ITEM_DEAGLE, "weapon_deagle"), + DEFINE_ITEMINFO(ITEM_SG552, "weapon_sg552"), + DEFINE_ITEMINFO(ITEM_AK47, "weapon_ak47"), + DEFINE_ITEMINFO(ITEM_KNIFE, "weapon_knife"), + DEFINE_ITEMINFO(ITEM_P90, "weapon_p90"), + DEFINE_ITEMINFO(ITEM_NVG, ""), + DEFINE_ITEMINFO(ITEM_DEFUSEKIT, "item_thighpack"), + DEFINE_ITEMINFO(ITEM_KEVLAR, "item_kevlar"), + DEFINE_ITEMINFO(ITEM_ASSAULT, "item_assaultsuit"), + DEFINE_ITEMINFO(ITEM_LONGJUMP, "item_longjump"), + DEFINE_ITEMINFO(ITEM_SODACAN, "item_sodacan"), + DEFINE_ITEMINFO(ITEM_HEALTHKIT, "item_healthkit"), + DEFINE_ITEMINFO(ITEM_ANTIDOTE, "item_antidote"), + DEFINE_ITEMINFO(ITEM_SECURITY, "item_security"), + DEFINE_ITEMINFO(ITEM_BATTERY, "item_battery"), + DEFINE_ITEMINFO(ITEM_SUIT, "item_suit"), +}; + LINK_ENTITY_TO_CLASS(world_items, CWorldItem, CCSWorldItem); void CWorldItem::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "type")) { - m_iType = Q_atoi(pkvd->szValue); +#ifdef REGAMEDLL_FIXES + // let's start with ITEM_HEALTHKIT + m_iType = (ItemID)(Q_atoi(pkvd->szValue) - 41 - ITEM_HEALTHKIT); +#else + m_iType = (ItemID)Q_atoi(pkvd->szValue); +#endif pkvd->fHandled = TRUE; } else @@ -17,23 +67,43 @@ void CWorldItem::__MAKE_VHOOK(Spawn)() { CBaseEntity *pEntity = NULL; +#ifdef REGAMEDLL_FIXES switch (m_iType) { - case 41: // ITEM_HEALTHKIT + case ITEM_HEALTHKIT: break; - case 42: // ITEM_ANTIDOTE + case ITEM_ANTIDOTE: pEntity = CBaseEntity::Create("item_antidote", pev->origin, pev->angles); break; - case 43: // ITEM_SECURITY + case ITEM_SECURITY: pEntity = CBaseEntity::Create("item_security", pev->origin, pev->angles); break; - case 44: // ITEM_BATTERY + case ITEM_BATTERY: pEntity = CBaseEntity::Create("item_battery", pev->origin, pev->angles); break; - case 45: // ITEM_SUIT + case ITEM_SUIT: pEntity = CBaseEntity::Create("item_suit", pev->origin, pev->angles); break; } +#else + switch (m_iType) + { + case 41: + break; + case 42: + pEntity = CBaseEntity::Create("item_antidote", pev->origin, pev->angles); + break; + case 43: + pEntity = CBaseEntity::Create("item_security", pev->origin, pev->angles); + break; + case 44: + pEntity = CBaseEntity::Create("item_battery", pev->origin, pev->angles); + break; + case 45: + pEntity = CBaseEntity::Create("item_suit", pev->origin, pev->angles); + break; + } +#endif if (pEntity != NULL) { @@ -67,7 +137,7 @@ void CItem::ItemTouch(CBaseEntity *pOther) if (!pOther->IsPlayer() || pOther->pev->deadflag != DEAD_NO) return; - CBasePlayer *pPlayer = (CBasePlayer *)pOther; + CBasePlayer *pPlayer = static_cast(pOther); if (!g_pGameRules->CanHaveItem(pPlayer, this)) return; @@ -134,6 +204,11 @@ BOOL CItemSuit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) if (pPlayer->pev->weapons & (1 << WEAPON_SUIT)) return FALSE; +#ifdef REGAMEDLL_ADD + if (pPlayer->HasRestrictItem(ITEM_SUIT, ITEM_TYPE_TOUCHED)) + return FALSE; +#endif + EMIT_SOUND(pPlayer->edict(), CHAN_VOICE, "items/tr_kevlar.wav", VOL_NORM, ATTN_NORM); pPlayer->pev->weapons |= (1 << WEAPON_SUIT); @@ -159,6 +234,11 @@ void CItemBattery::__MAKE_VHOOK(Precache)() BOOL CItemBattery::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { +#ifdef REGAMEDLL_ADD + if (pPlayer->HasRestrictItem(ITEM_BATTERY, ITEM_TYPE_TOUCHED)) + return FALSE; +#endif + if (pPlayer->pev->armorvalue < MAX_NORMAL_BATTERY && (pPlayer->pev->weapons & (1 << WEAPON_SUIT))) { int pct; @@ -205,6 +285,11 @@ void CItemAntidote::__MAKE_VHOOK(Precache)() BOOL CItemAntidote::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { +#ifdef REGAMEDLL_ADD + if (pPlayer->HasRestrictItem(ITEM_ANTIDOTE, ITEM_TYPE_TOUCHED)) + return FALSE; +#endif + pPlayer->SetSuitUpdate("!HEV_DET4", FALSE, SUIT_NEXT_IN_1MIN); pPlayer->m_rgItems[ ITEM_ANTIDOTE ] += 1; @@ -227,6 +312,11 @@ void CItemSecurity::__MAKE_VHOOK(Precache)() BOOL CItemSecurity::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { +#ifdef REGAMEDLL_ADD + if (pPlayer->HasRestrictItem(ITEM_SECURITY, ITEM_TYPE_TOUCHED)) + return FALSE; +#endif + pPlayer->m_rgItems[ ITEM_SECURITY ] += 1; return TRUE; } @@ -247,6 +337,11 @@ void CItemLongJump::__MAKE_VHOOK(Precache)() BOOL CItemLongJump::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { +#ifdef REGAMEDLL_ADD + if (pPlayer->HasRestrictItem(ITEM_LONGJUMP, ITEM_TYPE_TOUCHED)) + return FALSE; +#endif + if (pPlayer->m_fLongJump) return FALSE; @@ -284,6 +379,11 @@ void CItemKevlar::__MAKE_VHOOK(Precache)() BOOL CItemKevlar::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { +#ifdef REGAMEDLL_ADD + if (pPlayer->HasRestrictItem(ITEM_KEVLAR, ITEM_TYPE_TOUCHED)) + return FALSE; +#endif + if (pPlayer->m_iKevlar == ARMOR_NONE) pPlayer->m_iKevlar = ARMOR_KEVLAR; @@ -322,6 +422,11 @@ void CItemAssaultSuit::__MAKE_VHOOK(Precache)() BOOL CItemAssaultSuit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) { +#ifdef REGAMEDLL_ADD + if (pPlayer->HasRestrictItem(ITEM_ASSAULT, ITEM_TYPE_TOUCHED)) + return FALSE; +#endif + pPlayer->m_iKevlar = ARMOR_VESTHELM; pPlayer->pev->armorvalue = 100; @@ -362,6 +467,11 @@ BOOL CItemThighPack::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) if (pPlayer->m_iTeam != CT || pPlayer->m_bHasDefuser) return FALSE; +#ifdef REGAMEDLL_ADD + if (pPlayer->HasRestrictItem(ITEM_DEFUSEKIT, ITEM_TYPE_TOUCHED)) + return FALSE; +#endif + pPlayer->m_bHasDefuser = true; pPlayer->pev->body = 1; @@ -387,3 +497,40 @@ BOOL CItemThighPack::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer) } LINK_ENTITY_TO_CLASS(item_thighpack, CItemThighPack, CCSItemThighPack); + +ItemID GetItemIdByName(const char *pszName) +{ + for (auto& item : itemInfo) { + if (item.pszName[0] != '\0' && FStrEq(item.pszName, pszName)) + return (ItemID)item.iId; + } + + return ITEM_NONE; +} + +ItemID GetItemIdByArmoury(ArmouryItemPack armoury) +{ + switch (armoury) + { + case ARMOURY_MP5NAVY: return ITEM_MP5N; + case ARMOURY_TMP: return ITEM_TMP; + case ARMOURY_P90: return ITEM_P90; + case ARMOURY_MAC10: return ITEM_MAC10; + case ARMOURY_AK47: return ITEM_AK47; + case ARMOURY_SG552: return ITEM_SG552; + case ARMOURY_M4A1: return ITEM_M4A1; + case ARMOURY_AUG: return ITEM_AUG; + case ARMOURY_SCOUT: return ITEM_SCOUT; + case ARMOURY_G3SG1: return ITEM_G3SG1; + case ARMOURY_AWP: return ITEM_AWP; + case ARMOURY_M3: return ITEM_M3; + case ARMOURY_XM1014: return ITEM_XM1014; + case ARMOURY_M249: return ITEM_M249; + case ARMOURY_FLASHBANG: return ITEM_FLASHBANG; + case ARMOURY_HEGRENADE: return ITEM_HEGRENADE; + case ARMOURY_KEVLAR: return ITEM_KEVLAR; + case ARMOURY_ASSAULT: return ITEM_ASSAULT; + case ARMOURY_SMOKEGRENADE: return ITEM_SMOKEGRENADE; + default: return ITEM_NONE; + } +} diff --git a/regamedll/dlls/items.h b/regamedll/dlls/items.h index 3ff709f0..ca13d27a 100644 --- a/regamedll/dlls/items.h +++ b/regamedll/dlls/items.h @@ -25,19 +25,65 @@ * version. * */ - -#ifndef ITEMS_H -#define ITEMS_H -#ifdef _WIN32 #pragma once -#endif + +#define DEFINE_ITEMINFO(id, classname)\ + { 0, 0, "", 0, "", 0, classname, 0, id, 0, 0 } + +enum ItemRestType +{ + ITEM_TYPE_BUYING, // when a player buying items + ITEM_TYPE_TOUCHED, // when the player touches with a weaponbox or armoury_entity + ITEM_TYPE_EQUIPPED // when a entity game_player_equip to player gives item +}; // constant items -#define ITEM_HEALTHKIT 1 -#define ITEM_ANTIDOTE 2 -#define ITEM_SECURITY 3 -#define ITEM_BATTERY 4 -#define ITEM_SUIT 5 +enum ItemID +{ + ITEM_NONE = -1, + ITEM_SHIELDGUN, + ITEM_P228, + ITEM_GLOCK, + ITEM_SCOUT, + ITEM_HEGRENADE, + ITEM_XM1014, + ITEM_C4, + ITEM_MAC10, + ITEM_AUG, + ITEM_SMOKEGRENADE, + ITEM_ELITE, + ITEM_FIVESEVEN, + ITEM_UMP45, + ITEM_SG550, + ITEM_GALIL, + ITEM_FAMAS, + ITEM_USP, + ITEM_GLOCK18, + ITEM_AWP, + ITEM_MP5N, + ITEM_M249, + ITEM_M3, + ITEM_M4A1, + ITEM_TMP, + ITEM_G3SG1, + ITEM_FLASHBANG, + ITEM_DEAGLE, + ITEM_SG552, + ITEM_AK47, + ITEM_KNIFE, + ITEM_P90, + ITEM_NVG, + ITEM_DEFUSEKIT, + ITEM_KEVLAR, + ITEM_ASSAULT, + ITEM_LONGJUMP, + ITEM_SODACAN, + ITEM_HEALTHKIT, + ITEM_ANTIDOTE, + ITEM_SECURITY, + ITEM_BATTERY, + ITEM_SUIT +}; class CItem: public CBaseEntity { @@ -72,7 +118,7 @@ public: #endif public: - int m_iType; + ItemID m_iType; }; class CItemSuit: public CItem @@ -211,4 +257,5 @@ public: }; -#endif // ITEMS_H +ItemID GetItemIdByName(const char *pszName); +ItemID GetItemIdByArmoury(ArmouryItemPack armoury); diff --git a/regamedll/dlls/maprules.cpp b/regamedll/dlls/maprules.cpp index 7c356340..ba89a2ae 100644 --- a/regamedll/dlls/maprules.cpp +++ b/regamedll/dlls/maprules.cpp @@ -546,6 +546,12 @@ void CGamePlayerEquip::EquipPlayer(CBaseEntity *pEntity) if (FStringNull(m_weaponNames[i])) break; +#ifdef REGAMEDLL_ADD + auto itemid = GetItemIdByName(STRING(m_weaponNames[i])); + if (itemid != ITEM_NONE && pPlayer->HasRestrictItem(itemid, ITEM_TYPE_EQUIPPED)) + continue; +#endif + for (int j = 0; j < m_weaponCount[i]; ++j) { pPlayer->GiveNamedItem(STRING(m_weaponNames[i])); diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index c38ed735..708532fd 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -3019,6 +3019,10 @@ void CWShield::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) if (!pPlayer->m_bIsVIP) { +#ifdef REGAMEDLL_ADD + if (pPlayer->HasRestrictItem(ITEM_SHIELDGUN, ITEM_TYPE_TOUCHED)) + return; +#endif pPlayer->GiveShield(); EMIT_SOUND(edict(), CHAN_ITEM, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM); @@ -9330,3 +9334,9 @@ void CBasePlayer::TeamChangeUpdate() SetScoreboardAttributes(); } } + +LINK_HOOK_CLASS_CHAIN(bool, CBasePlayer, HasRestrictItem, (ItemID item, ItemRestType type), item, type); + +bool EXT_FUNC CBasePlayer::__API_HOOK(HasRestrictItem)(ItemID item, ItemRestType type) { + return false; +} diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index b578de89..1da14cbe 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -253,7 +253,7 @@ struct RebuyStruct int m_smokeGrenade; int m_defuser; int m_nightVision; - int m_armor; + ArmorType m_armor; }; enum ThrowDirection @@ -596,6 +596,8 @@ public: void SetScoreAttrib(CBasePlayer *dest); void ReloadWeapons(CBasePlayerItem *pWeapon = nullptr, bool bForceReload = false, bool bForceRefill = false); void TeamChangeUpdate(); + bool HasRestrictItem(ItemID item, ItemRestType type); + bool HasRestrictItem_(ItemID item, ItemRestType type); #ifdef REGAMEDLL_ADD CCSPlayer *CSPlayer() const; @@ -619,7 +621,7 @@ public: int m_iLastZoom; bool m_bResumeZoom; float m_flEjectBrass; - int m_iKevlar; + ArmorType m_iKevlar; bool m_bNotKilled; TeamName m_iTeam; int m_iAccount; diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index b7219dfc..75ae2a6c 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -1637,11 +1637,9 @@ void CWeaponBox::Kill() UTIL_Remove(this); } -LINK_HOOK_CLASS_VOID_CHAIN(CWeaponBox, Touch, (CBaseEntity *pOther), pOther); - // CWeaponBox - Touch: try to add my contents to the toucher // if the toucher is a player. -void CWeaponBox::__API_VHOOK(Touch)(CBaseEntity *pOther) +void CWeaponBox::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) { if (!(pev->flags & FL_ONGROUND)) { @@ -1691,10 +1689,19 @@ void CWeaponBox::__API_VHOOK(Touch)(CBaseEntity *pOther) return; } +#ifdef REGAMEDLL_ADD + if (pPlayer->HasRestrictItem((pItem->m_iId == WEAPON_SHIELDGUN) ? ITEM_SHIELDGUN : (ItemID)pItem->m_iId, ITEM_TYPE_TOUCHED)) + return; +#endif if (FClassnameIs(pItem->pev, "weapon_c4")) { +#ifdef REGAMEDLL_FIXES + if (pPlayer->m_iTeam != TERRORIST) + return; +#else if (pPlayer->m_iTeam != TERRORIST || pPlayer->pev->deadflag != DEAD_NO) return; +#endif if (pPlayer->m_bShowHints && !(pPlayer->m_flDisplayHistory & DHF_BOMB_RETRIEVED)) { @@ -2145,9 +2152,7 @@ struct ArmouryItemStruct { "weapon_m249", "556NatoBox", 60, MAX_AMMO_556NATOBOX }, // ARMOURY_M249 }; -LINK_HOOK_CLASS_VOID_CHAIN(CArmoury, ArmouryTouch, (CBaseEntity *pOther), pOther); - -void CArmoury::__API_HOOK(ArmouryTouch)(CBaseEntity *pOther) +void CArmoury::ArmouryTouch(CBaseEntity *pOther) { if (!pOther->IsPlayer()) return; @@ -2157,6 +2162,11 @@ void CArmoury::__API_HOOK(ArmouryTouch)(CBaseEntity *pOther) if (p->m_bIsVIP) return; +#ifdef REGAMEDLL_ADD + if (p->HasRestrictItem(GetItemIdByArmoury(m_iItem), ITEM_TYPE_TOUCHED)) + return; +#endif + // weapons if (m_iCount > 0 && m_iItem <= ARMOURY_M249) { @@ -2232,7 +2242,7 @@ void CArmoury::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) { if (FStrEq(pkvd->szKeyName, "item")) { - m_iItem = Q_atoi(pkvd->szValue); + m_iItem = (ArmouryItemPack)Q_atoi(pkvd->szValue); pkvd->fHandled = TRUE; } else if (FStrEq(pkvd->szKeyName, "count")) diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index bbc2ff98..6cff6e4b 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -97,8 +97,7 @@ enum ArmouryItemPack ARMOURY_HEGRENADE, ARMOURY_KEVLAR, ARMOURY_ASSAULT, - ARMOURY_SMOKEGRENADE, - ARMOURY_END + ARMOURY_SMOKEGRENADE }; struct ItemInfo @@ -148,10 +147,9 @@ public: public: void EXPORT ArmouryTouch(CBaseEntity *pOther); - void ArmouryTouch_(CBaseEntity *pOther); public: - int m_iItem; + ArmouryItemPack m_iItem; int m_iCount; int m_iInitialCount; bool m_bAlreadyCounted; diff --git a/regamedll/extra/cssdk/dlls/client.h b/regamedll/extra/cssdk/dlls/client.h index 540fc4bf..f7f8a55f 100644 --- a/regamedll/extra/cssdk/dlls/client.h +++ b/regamedll/extra/cssdk/dlls/client.h @@ -53,17 +53,6 @@ enum BuyItemMenuSlot MENU_SLOT_ITEM_SHIELD, }; -enum BuyItemID -{ - BUY_ITEM_VEST = 1, - BUY_ITEM_VESTHELM, - BUY_ITEM_FLASHGREN, - BUY_ITEM_HEGREN, - BUY_ITEM_SMOKEGREN, - BUY_ITEM_NVG, - BUY_ITEM_DEFUSEKIT -}; - #define CS_NUM_SKIN 4 #define CZ_NUM_SKIN 5 diff --git a/regamedll/extra/cssdk/dlls/items.h b/regamedll/extra/cssdk/dlls/items.h index 1c4dd141..f6e0fc3e 100644 --- a/regamedll/extra/cssdk/dlls/items.h +++ b/regamedll/extra/cssdk/dlls/items.h @@ -27,22 +27,66 @@ */ #pragma once +enum ItemRestType +{ + ITEM_TYPE_BUYING, // when a player buying items + ITEM_TYPE_TOUCHED, // when the player touches with a weaponbox or armoury_entity + ITEM_TYPE_EQUIPPED // when a entity game_player_equip to player gives item +}; + // constant items -#define ITEM_HEALTHKIT 1 -#define ITEM_ANTIDOTE 2 -#define ITEM_SECURITY 3 -#define ITEM_BATTERY 4 -#define ITEM_SUIT 5 +enum ItemID +{ + ITEM_NONE = -1, + ITEM_SHIELDGUN, + ITEM_P228, + ITEM_GLOCK, + ITEM_SCOUT, + ITEM_HEGRENADE, + ITEM_XM1014, + ITEM_C4, + ITEM_MAC10, + ITEM_AUG, + ITEM_SMOKEGRENADE, + ITEM_ELITE, + ITEM_FIVESEVEN, + ITEM_UMP45, + ITEM_SG550, + ITEM_GALIL, + ITEM_FAMAS, + ITEM_USP, + ITEM_GLOCK18, + ITEM_AWP, + ITEM_MP5N, + ITEM_M249, + ITEM_M3, + ITEM_M4A1, + ITEM_TMP, + ITEM_G3SG1, + ITEM_FLASHBANG, + ITEM_DEAGLE, + ITEM_SG552, + ITEM_AK47, + ITEM_KNIFE, + ITEM_P90, + ITEM_NVG, + ITEM_DEFUSEKIT, + ITEM_KEVLAR, + ITEM_ASSAULT, + ITEM_LONGJUMP, + ITEM_SODACAN, + ITEM_HEALTHKIT, + ITEM_ANTIDOTE, + ITEM_SECURITY, + ITEM_BATTERY, + ITEM_SUIT +}; class CItem: public CBaseEntity { public: virtual void Spawn() = 0; virtual CBaseEntity *Respawn() = 0; virtual BOOL MyTouch(CBasePlayer *pPlayer) = 0; - -public: - void EXPORT ItemTouch(CBaseEntity *pOther) = 0; - void EXPORT Materialize() = 0; }; class CWorldItem: public CBaseEntity { @@ -50,7 +94,7 @@ public: virtual void Spawn() = 0; virtual void KeyValue(KeyValueData *pkvd) = 0; public: - int m_iType; + ItemID m_iType; }; class CItemSuit: public CItem { diff --git a/regamedll/extra/cssdk/dlls/player.h b/regamedll/extra/cssdk/dlls/player.h index 8aaede90..3ed9c928 100644 --- a/regamedll/extra/cssdk/dlls/player.h +++ b/regamedll/extra/cssdk/dlls/player.h @@ -243,7 +243,7 @@ struct RebuyStruct int m_smokeGrenade; int m_defuser; int m_nightVision; - int m_armor; + ArmorType m_armor; }; enum ThrowDirection @@ -375,7 +375,7 @@ public: int m_iLastZoom; bool m_bResumeZoom; float m_flEjectBrass; - int m_iKevlar; + ArmorType m_iKevlar; bool m_bNotKilled; TeamName m_iTeam; int m_iAccount; diff --git a/regamedll/extra/cssdk/dlls/regamedll_api.h b/regamedll/extra/cssdk/dlls/regamedll_api.h index e6610db8..afc362d3 100644 --- a/regamedll/extra/cssdk/dlls/regamedll_api.h +++ b/regamedll/extra/cssdk/dlls/regamedll_api.h @@ -33,8 +33,9 @@ #include "player.h" #include "gamerules.h" #include "client.h" +#include "items.h" -#define REGAMEDLL_API_VERSION_MAJOR 3 +#define REGAMEDLL_API_VERSION_MAJOR 4 #define REGAMEDLL_API_VERSION_MINOR 1 // CBasePlayer::Spawn hook @@ -157,6 +158,10 @@ typedef IVoidHookChainRegistryClass IReGameHo typedef IVoidHookChainClass IReGameHook_CBasePlayer_SetClientUserInfoName; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_SetClientUserInfoName; +// CBasePlayer::HasRestrictItem hook +typedef IHookChainClass IReGameHook_CBasePlayer_HasRestrictItem; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_HasRestrictItem; + // CBasePlayer::DropPlayerItem hook typedef IVoidHookChainClass IReGameHook_CBasePlayer_DropPlayerItem; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_DropPlayerItem; @@ -165,14 +170,6 @@ typedef IVoidHookChainRegistryClass IReGameHook typedef IVoidHookChainClass IReGameHook_CBaseAnimating_ResetSequenceInfo; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo; -// CWeaponBox::Touch hook -typedef IVoidHookChainClass IReGameHook_CWeaponBox_Touch; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CWeaponBox_Touch; - -// CArmoury::Touch hook -typedef IVoidHookChainClass IReGameHook_CArmoury_Touch; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CArmoury_Touch; - // GetForceCamera hook typedef IHookChain IReGameHook_GetForceCamera; typedef IHookChainRegistry IReGameHookRegistry_GetForceCamera; @@ -189,14 +186,6 @@ typedef IVoidHookChainRegistry IReGameHook_RoundEnd; typedef IHookChainRegistry IReGameHookRegistry_RoundEnd; -// CanBuyThis hook -typedef IHookChain IReGameHook_CanBuyThis; -typedef IHookChainRegistry IReGameHookRegistry_CanBuyThis; - -// CanBuyThisItem hook -typedef IHookChain IReGameHook_CanBuyThisItem; -typedef IHookChainRegistry IReGameHookRegistry_CanBuyThisItem; - // InstallGameRules hook typedef IHookChain IReGameHook_InstallGameRules; typedef IHookChainRegistry IReGameHookRegistry_InstallGameRules; @@ -352,13 +341,14 @@ public: virtual IReGameHookRegistry_CBasePlayer_GiveShield* CBasePlayer_GiveShield() = 0; virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CBasePlayer_SetClientUserInfoModel() = 0; virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName() = 0; + virtual IReGameHookRegistry_CBasePlayer_HasRestrictItem* CBasePlayer_HasRestrictItem() = 0; + virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem() = 0; virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo() = 0; virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0; virtual IReGameHookRegistry_PlayerBlind* PlayerBlind() = 0; virtual IReGameHookRegistry_RadiusFlash_TraceLine* RadiusFlash_TraceLine() = 0; virtual IReGameHookRegistry_RoundEnd* RoundEnd() = 0; - virtual IReGameHookRegistry_CanBuyThis* CanBuyThis() = 0; virtual IReGameHookRegistry_InstallGameRules* InstallGameRules() = 0; virtual IReGameHookRegistry_PM_Init* PM_Init() = 0; virtual IReGameHookRegistry_PM_Move* PM_Move() = 0; @@ -390,11 +380,6 @@ public: virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel() = 0; virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0; virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0; - - virtual IReGameHookRegistry_CanBuyThisItem* CanBuyThisItem() = 0; - virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem() = 0; - virtual IReGameHookRegistry_CWeaponBox_Touch* CWeaponBox_Touch() = 0; - virtual IReGameHookRegistry_CArmoury_Touch* CArmoury_Touch() = 0; }; struct ReGameFuncs_t { diff --git a/regamedll/extra/cssdk/dlls/weapons.h b/regamedll/extra/cssdk/dlls/weapons.h index c87446a6..e17cc27a 100644 --- a/regamedll/extra/cssdk/dlls/weapons.h +++ b/regamedll/extra/cssdk/dlls/weapons.h @@ -92,8 +92,7 @@ enum ArmouryItemPack ARMOURY_HEGRENADE, ARMOURY_KEVLAR, ARMOURY_ASSAULT, - ARMOURY_SMOKEGRENADE, - ARMOURY_END + ARMOURY_SMOKEGRENADE }; struct ItemInfo @@ -131,7 +130,7 @@ public: virtual void Restart() = 0; virtual void KeyValue(KeyValueData *pkvd) = 0; public: - int m_iItem; + ArmouryItemPack m_iItem; int m_iCount; int m_iInitialCount; bool m_bAlreadyCounted; diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index e6610db8..afc362d3 100644 --- a/regamedll/public/regamedll/regamedll_api.h +++ b/regamedll/public/regamedll/regamedll_api.h @@ -33,8 +33,9 @@ #include "player.h" #include "gamerules.h" #include "client.h" +#include "items.h" -#define REGAMEDLL_API_VERSION_MAJOR 3 +#define REGAMEDLL_API_VERSION_MAJOR 4 #define REGAMEDLL_API_VERSION_MINOR 1 // CBasePlayer::Spawn hook @@ -157,6 +158,10 @@ typedef IVoidHookChainRegistryClass IReGameHo typedef IVoidHookChainClass IReGameHook_CBasePlayer_SetClientUserInfoName; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_SetClientUserInfoName; +// CBasePlayer::HasRestrictItem hook +typedef IHookChainClass IReGameHook_CBasePlayer_HasRestrictItem; +typedef IHookChainRegistryClass IReGameHookRegistry_CBasePlayer_HasRestrictItem; + // CBasePlayer::DropPlayerItem hook typedef IVoidHookChainClass IReGameHook_CBasePlayer_DropPlayerItem; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBasePlayer_DropPlayerItem; @@ -165,14 +170,6 @@ typedef IVoidHookChainRegistryClass IReGameHook typedef IVoidHookChainClass IReGameHook_CBaseAnimating_ResetSequenceInfo; typedef IVoidHookChainRegistryClass IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo; -// CWeaponBox::Touch hook -typedef IVoidHookChainClass IReGameHook_CWeaponBox_Touch; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CWeaponBox_Touch; - -// CArmoury::Touch hook -typedef IVoidHookChainClass IReGameHook_CArmoury_Touch; -typedef IVoidHookChainRegistryClass IReGameHookRegistry_CArmoury_Touch; - // GetForceCamera hook typedef IHookChain IReGameHook_GetForceCamera; typedef IHookChainRegistry IReGameHookRegistry_GetForceCamera; @@ -189,14 +186,6 @@ typedef IVoidHookChainRegistry IReGameHook_RoundEnd; typedef IHookChainRegistry IReGameHookRegistry_RoundEnd; -// CanBuyThis hook -typedef IHookChain IReGameHook_CanBuyThis; -typedef IHookChainRegistry IReGameHookRegistry_CanBuyThis; - -// CanBuyThisItem hook -typedef IHookChain IReGameHook_CanBuyThisItem; -typedef IHookChainRegistry IReGameHookRegistry_CanBuyThisItem; - // InstallGameRules hook typedef IHookChain IReGameHook_InstallGameRules; typedef IHookChainRegistry IReGameHookRegistry_InstallGameRules; @@ -352,13 +341,14 @@ public: virtual IReGameHookRegistry_CBasePlayer_GiveShield* CBasePlayer_GiveShield() = 0; virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CBasePlayer_SetClientUserInfoModel() = 0; virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName() = 0; + virtual IReGameHookRegistry_CBasePlayer_HasRestrictItem* CBasePlayer_HasRestrictItem() = 0; + virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem() = 0; virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo() = 0; virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0; virtual IReGameHookRegistry_PlayerBlind* PlayerBlind() = 0; virtual IReGameHookRegistry_RadiusFlash_TraceLine* RadiusFlash_TraceLine() = 0; virtual IReGameHookRegistry_RoundEnd* RoundEnd() = 0; - virtual IReGameHookRegistry_CanBuyThis* CanBuyThis() = 0; virtual IReGameHookRegistry_InstallGameRules* InstallGameRules() = 0; virtual IReGameHookRegistry_PM_Init* PM_Init() = 0; virtual IReGameHookRegistry_PM_Move* PM_Move() = 0; @@ -390,11 +380,6 @@ public: virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel() = 0; virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission() = 0; virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams() = 0; - - virtual IReGameHookRegistry_CanBuyThisItem* CanBuyThisItem() = 0; - virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem() = 0; - virtual IReGameHookRegistry_CWeaponBox_Touch* CWeaponBox_Touch() = 0; - virtual IReGameHookRegistry_CArmoury_Touch* CArmoury_Touch() = 0; }; struct ReGameFuncs_t { diff --git a/regamedll/regamedll/regamedll_api_impl.cpp b/regamedll/regamedll/regamedll_api_impl.cpp index 6840f367..6f0456aa 100644 --- a/regamedll/regamedll/regamedll_api_impl.cpp +++ b/regamedll/regamedll/regamedll_api_impl.cpp @@ -75,18 +75,14 @@ IReGameHookRegistry_CBasePlayer_AddAccount* CReGameHookchains::CBasePlayer_AddAc IReGameHookRegistry_CBasePlayer_GiveShield* CReGameHookchains::CBasePlayer_GiveShield() { return &m_CBasePlayer_GiveShield; } IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CReGameHookchains::CBasePlayer_SetClientUserInfoModel() { return &m_CBasePlayer_SetClientUserInfoModel; } IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CReGameHookchains::CBasePlayer_SetClientUserInfoName() { return &m_CBasePlayer_SetClientUserInfoName; } +IReGameHookRegistry_CBasePlayer_HasRestrictItem* CReGameHookchains::CBasePlayer_HasRestrictItem() { return &m_CBasePlayer_HasRestrictItem; } IReGameHookRegistry_CBasePlayer_DropPlayerItem* CReGameHookchains::CBasePlayer_DropPlayerItem() { return &m_CBasePlayer_DropPlayerItem; } IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CReGameHookchains::CBaseAnimating_ResetSequenceInfo() { return &m_CBaseAnimating_ResetSequenceInfo; } -IReGameHookRegistry_CWeaponBox_Touch* CReGameHookchains::CWeaponBox_Touch() { return &m_CWeaponBox_Touch; } -IReGameHookRegistry_CArmoury_Touch* CReGameHookchains::CArmoury_Touch() { return &m_CArmoury_ArmouryTouch; } - IReGameHookRegistry_GetForceCamera* CReGameHookchains::GetForceCamera() { return &m_GetForceCamera; } IReGameHookRegistry_PlayerBlind* CReGameHookchains::PlayerBlind() { return &m_PlayerBlind; } IReGameHookRegistry_RadiusFlash_TraceLine* CReGameHookchains::RadiusFlash_TraceLine() { return &m_RadiusFlash_TraceLine; } IReGameHookRegistry_RoundEnd* CReGameHookchains::RoundEnd() { return &m_RoundEnd; } -IReGameHookRegistry_CanBuyThis* CReGameHookchains::CanBuyThis() { return &m_CanBuyThis; } -IReGameHookRegistry_CanBuyThisItem* CReGameHookchains::CanBuyThisItem() { return &m_CanBuyThisItem; } IReGameHookRegistry_InstallGameRules* CReGameHookchains::InstallGameRules() { return &m_InstallGameRules; } IReGameHookRegistry_PM_Init* CReGameHookchains::PM_Init() { return &m_PM_Init; } IReGameHookRegistry_PM_Move* CReGameHookchains::PM_Move() { return &m_PM_Move; } diff --git a/regamedll/regamedll/regamedll_api_impl.h b/regamedll/regamedll/regamedll_api_impl.h index 727a046c..aa59c9bf 100644 --- a/regamedll/regamedll/regamedll_api_impl.h +++ b/regamedll/regamedll/regamedll_api_impl.h @@ -151,6 +151,10 @@ typedef IVoidHookChainRegistryClassImpl CReGameHook typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_SetClientUserInfoName; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_SetClientUserInfoName; +// CBasePlayer::HasRestrictItem hook +typedef IHookChainClassImpl CReGameHook_CBasePlayer_HasRestrictItem; +typedef IHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_HasRestrictItem; + // CBasePlayer::DropPlayerItem hook typedef IVoidHookChainClassImpl CReGameHook_CBasePlayer_DropPlayerItem; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBasePlayer_DropPlayerItem; @@ -159,14 +163,6 @@ typedef IVoidHookChainRegistryClassImpl CReGameHookRe typedef IVoidHookChainClassImpl CReGameHook_CBaseAnimating_ResetSequenceInfo; typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CBaseAnimating_ResetSequenceInfo; -// CWeaponBox::Touch hook -typedef IVoidHookChainClassImpl CReGameHook_CWeaponBox_Touch; -typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CWeaponBox_Touch; - -// CArmoury::Touch hook -typedef IVoidHookChainClassImpl CReGameHook_CArmoury_Touch; -typedef IVoidHookChainRegistryClassImpl CReGameHookRegistry_CArmoury_Touch; - // GetForceCamera hook typedef IHookChainImpl CReGameHook_GetForceCamera; typedef IHookChainRegistryImpl CReGameHookRegistry_GetForceCamera; @@ -183,14 +179,6 @@ typedef IVoidHookChainRegistryImpl CReGameHook_RoundEnd; typedef IHookChainRegistryClassEmptyImpl CReGameHookRegistry_RoundEnd; -// CanBuyThis hook -typedef IHookChainImpl CReGameHook_CanBuyThis; -typedef IHookChainRegistryImpl CReGameHookRegistry_CanBuyThis; - -// CanBuyThisItem hook -typedef IHookChainImpl CReGameHook_CanBuyThisItem; -typedef IHookChainRegistryImpl CReGameHookRegistry_CanBuyThisItem; - // InstallGameRules hook typedef IHookChainImpl CReGameHook_InstallGameRules; typedef IHookChainRegistryImpl CReGameHookRegistry_InstallGameRules; @@ -345,13 +333,14 @@ public: CReGameHookRegistry_CBasePlayer_GiveShield m_CBasePlayer_GiveShield; CReGameHookRegistry_CBasePlayer_SetClientUserInfoModel m_CBasePlayer_SetClientUserInfoModel; CReGameHookRegistry_CBasePlayer_SetClientUserInfoName m_CBasePlayer_SetClientUserInfoName; + CReGameHookRegistry_CBasePlayer_HasRestrictItem m_CBasePlayer_HasRestrictItem; + CReGameHookRegistry_CBasePlayer_DropPlayerItem m_CBasePlayer_DropPlayerItem; CReGameHookRegistry_CBaseAnimating_ResetSequenceInfo m_CBaseAnimating_ResetSequenceInfo; CReGameHookRegistry_GetForceCamera m_GetForceCamera; CReGameHookRegistry_PlayerBlind m_PlayerBlind; CReGameHookRegistry_RadiusFlash_TraceLine m_RadiusFlash_TraceLine; CReGameHookRegistry_RoundEnd m_RoundEnd; - CReGameHookRegistry_CanBuyThis m_CanBuyThis; CReGameHookRegistry_InstallGameRules m_InstallGameRules; CReGameHookRegistry_PM_Init m_PM_Init; CReGameHookRegistry_PM_Move m_PM_Move; @@ -384,11 +373,6 @@ public: CReGameHookRegistry_CSGameRules_GoToIntermission m_CSGameRules_GoToIntermission; CReGameHookRegistry_CSGameRules_BalanceTeams m_CSGameRules_BalanceTeams; - CReGameHookRegistry_CanBuyThisItem m_CanBuyThisItem; - CReGameHookRegistry_CBasePlayer_DropPlayerItem m_CBasePlayer_DropPlayerItem; - CReGameHookRegistry_CWeaponBox_Touch m_CWeaponBox_Touch; - CReGameHookRegistry_CArmoury_Touch m_CArmoury_ArmouryTouch; - public: virtual IReGameHookRegistry_CBasePlayer_Spawn* CBasePlayer_Spawn(); virtual IReGameHookRegistry_CBasePlayer_Precache* CBasePlayer_Precache(); @@ -421,13 +405,14 @@ public: virtual IReGameHookRegistry_CBasePlayer_GiveShield* CBasePlayer_GiveShield(); virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoModel* CBasePlayer_SetClientUserInfoModel(); virtual IReGameHookRegistry_CBasePlayer_SetClientUserInfoName* CBasePlayer_SetClientUserInfoName(); + virtual IReGameHookRegistry_CBasePlayer_HasRestrictItem* CBasePlayer_HasRestrictItem(); + virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem(); virtual IReGameHookRegistry_CBaseAnimating_ResetSequenceInfo* CBaseAnimating_ResetSequenceInfo(); virtual IReGameHookRegistry_GetForceCamera* GetForceCamera(); virtual IReGameHookRegistry_PlayerBlind* PlayerBlind(); virtual IReGameHookRegistry_RadiusFlash_TraceLine* RadiusFlash_TraceLine(); virtual IReGameHookRegistry_RoundEnd* RoundEnd(); - virtual IReGameHookRegistry_CanBuyThis* CanBuyThis(); virtual IReGameHookRegistry_InstallGameRules* InstallGameRules(); virtual IReGameHookRegistry_PM_Init* PM_Init(); virtual IReGameHookRegistry_PM_Move* PM_Move(); @@ -459,11 +444,6 @@ public: virtual IReGameHookRegistry_CSGameRules_ChangeLevel* CSGameRules_ChangeLevel(); virtual IReGameHookRegistry_CSGameRules_GoToIntermission* CSGameRules_GoToIntermission(); virtual IReGameHookRegistry_CSGameRules_BalanceTeams* CSGameRules_BalanceTeams(); - - virtual IReGameHookRegistry_CanBuyThisItem* CanBuyThisItem(); - virtual IReGameHookRegistry_CBasePlayer_DropPlayerItem* CBasePlayer_DropPlayerItem(); - virtual IReGameHookRegistry_CWeaponBox_Touch* CWeaponBox_Touch(); - virtual IReGameHookRegistry_CArmoury_Touch* CArmoury_Touch(); }; extern CReGameHookchains g_ReGameHookchains;