mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-14 15:48:01 +03:00
Added argument about type awards to CBasePlayer::AddAccount
Some adjustments in RadiusDamage
This commit is contained in:
parent
b6e0420365
commit
9203344b98
@ -1248,7 +1248,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
|
||||
|
||||
bEnoughMoney = true;
|
||||
pPlayer->m_bHasNightVision = true;
|
||||
pPlayer->AddAccount(-NVG_PRICE);
|
||||
pPlayer->AddAccount(-NVG_PRICE, RT_PLAYER_BOUGHT_SOMETHING);
|
||||
|
||||
SendItemStatus(pPlayer);
|
||||
}
|
||||
@ -1283,7 +1283,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
|
||||
MESSAGE_END();
|
||||
|
||||
pPlayer->pev->body = 1;
|
||||
pPlayer->AddAccount(-DEFUSEKIT_PRICE);
|
||||
pPlayer->AddAccount(-DEFUSEKIT_PRICE, RT_PLAYER_BOUGHT_SOMETHING);
|
||||
|
||||
EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/kevlar.wav", VOL_NORM, ATTN_NORM);
|
||||
SendItemStatus(pPlayer);
|
||||
@ -1301,7 +1301,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
|
||||
DropPrimary(pPlayer);
|
||||
|
||||
pPlayer->GiveShield(true);
|
||||
pPlayer->AddAccount(-SHIELDGUN_PRICE);
|
||||
pPlayer->AddAccount(-SHIELDGUN_PRICE, RT_PLAYER_BOUGHT_SOMETHING);
|
||||
|
||||
EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM);
|
||||
}
|
||||
@ -1323,7 +1323,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
|
||||
if (pszItem != NULL)
|
||||
{
|
||||
pPlayer->GiveNamedItem(pszItem);
|
||||
pPlayer->AddAccount(-iItemPrice);
|
||||
pPlayer->AddAccount(-iItemPrice, RT_PLAYER_BOUGHT_SOMETHING);
|
||||
}
|
||||
|
||||
if (TheTutor != NULL)
|
||||
@ -1365,7 +1365,7 @@ void BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID)
|
||||
}
|
||||
|
||||
pPlayer->GiveNamedItem(info->entityName);
|
||||
pPlayer->AddAccount(-info->cost);
|
||||
pPlayer->AddAccount(-info->cost, RT_PLAYER_BOUGHT_SOMETHING);
|
||||
|
||||
if (TheTutor != NULL)
|
||||
{
|
||||
@ -2013,7 +2013,7 @@ bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney)
|
||||
if (player->m_iAccount >= info->clipCost)
|
||||
{
|
||||
player->GiveNamedItem(info->ammoName);
|
||||
player->AddAccount(-info->clipCost);
|
||||
player->AddAccount(-info->clipCost, RT_PLAYER_BOUGHT_SOMETHING);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1176,14 +1176,15 @@ void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
// not allow inflict to the player damage is less than 1.0f and to entities not less than 0.0f
|
||||
if ((pEntity->Classify() == CLASS_PLAYER && flAdjustedDamage < 1.0f) || flAdjustedDamage <= 0.0f)
|
||||
continue;
|
||||
#else
|
||||
if (flAdjustedDamage < 0)
|
||||
flAdjustedDamage = 0;
|
||||
|
||||
#ifdef REGAMEDLL_FIXES
|
||||
if (flAdjustedDamage > 0)
|
||||
#endif
|
||||
pEntity->TakeDamage(pevInflictor, pevAttacker, flAdjustedDamage, bitsDamageType);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1198,23 +1199,27 @@ void RadiusDamage2(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacke
|
||||
if (flRadius)
|
||||
falloff = flDamage / flRadius;
|
||||
else
|
||||
falloff = 1;
|
||||
falloff = 1.0;
|
||||
|
||||
int bInWater = (UTIL_PointContents(vecSrc) == CONTENTS_WATER);
|
||||
|
||||
// in case grenade is lying on the ground
|
||||
vecSrc.z += 1;
|
||||
|
||||
if (!pevAttacker)
|
||||
pevAttacker = pevInflictor;
|
||||
|
||||
// iterate on all entities in the vicinity.
|
||||
while ((pEntity = UTIL_FindEntityInSphere(pEntity, vecSrc, flRadius)) != NULL)
|
||||
{
|
||||
if (pEntity->pev->takedamage != DAMAGE_NO)
|
||||
{
|
||||
// UNDONE: this should check a damage mask, not an ignore
|
||||
if (iClassIgnore != CLASS_NONE && pEntity->Classify() == iClassIgnore)
|
||||
continue;
|
||||
|
||||
if (bInWater && !pEntity->pev->waterlevel)
|
||||
// blast's don't tavel into or out of water
|
||||
if (bInWater && pEntity->pev->waterlevel == 0)
|
||||
continue;
|
||||
|
||||
if (!bInWater && pEntity->pev->waterlevel == 3)
|
||||
|
@ -128,7 +128,8 @@ enum RewardAccount
|
||||
REWARD_KILLED_VIP = 2500,
|
||||
REWARD_VIP_HAVE_SELF_RESCUED = 2500,
|
||||
|
||||
REWARD_TAKEN_HOSTAGE = 1000
|
||||
REWARD_TAKEN_HOSTAGE = 1000,
|
||||
REWARD_TOOK_HOSTAGE = 150
|
||||
|
||||
};
|
||||
|
||||
|
@ -281,7 +281,7 @@ void CHostage::IdleThink()
|
||||
|
||||
if (player != NULL)
|
||||
{
|
||||
player->AddAccount(REWARD_TAKEN_HOSTAGE);
|
||||
player->AddAccount(REWARD_TAKEN_HOSTAGE, RT_HOSTAGE_RESCUED);
|
||||
UTIL_LogPrintf("\"%s<%i><%s><CT>\" triggered \"Rescued_A_Hostage\"\n", STRING(player->pev->netname),
|
||||
GETPLAYERUSERID(player->edict()), GETPLAYERAUTHID(player->edict()));
|
||||
}
|
||||
@ -453,7 +453,7 @@ int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAt
|
||||
|
||||
if (pAttacker != NULL)
|
||||
{
|
||||
pAttacker->AddAccount(-20 * int(flActualDamage));
|
||||
pAttacker->AddAccount(-20 * int(flActualDamage), RT_HOSTAGE_DAMAGED);
|
||||
|
||||
if (TheBots != NULL)
|
||||
{
|
||||
@ -479,7 +479,7 @@ int CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAt
|
||||
|
||||
if (pAttacker != NULL)
|
||||
{
|
||||
pAttacker->AddAccount(20 * (-25 - int(flActualDamage)));
|
||||
pAttacker->AddAccount(20 * (-25 - int(flActualDamage)), RT_HOSTAGE_KILLED);
|
||||
AnnounceDeath(pAttacker);
|
||||
ApplyHostagePenalty(pAttacker);
|
||||
}
|
||||
@ -756,7 +756,7 @@ void CHostage::GiveCTTouchBonus(CBasePlayer *pPlayer)
|
||||
m_bTouched = TRUE;
|
||||
CSGameRules()->m_iAccountCT += 100;
|
||||
|
||||
pPlayer->AddAccount(150);
|
||||
pPlayer->AddAccount(REWARD_TOOK_HOSTAGE, RT_HOSTAGE_TOOK);
|
||||
UTIL_LogPrintf("\"%s<%i><%s><CT>\" triggered \"Touched_A_Hostage\"\n", STRING(pPlayer->pev->netname), GETPLAYERUSERID(pPlayer->edict()), GETPLAYERAUTHID(pPlayer->edict()));
|
||||
}
|
||||
|
||||
|
@ -1927,7 +1927,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
|
||||
|
||||
if (hostage->pev->solid != SOLID_NOT)
|
||||
{
|
||||
acct_tmp += 150;
|
||||
acct_tmp += REWARD_TOOK_HOSTAGE;
|
||||
|
||||
if (hostage->pev->deadflag == DEAD_DEAD)
|
||||
{
|
||||
@ -2039,7 +2039,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
|
||||
{
|
||||
if (!player->m_bReceivesNoMoneyNextRound)
|
||||
{
|
||||
player->AddAccount(m_iAccountCT);
|
||||
player->AddAccount(m_iAccountCT, RT_ROUND_BONUS);
|
||||
}
|
||||
}
|
||||
else if (player->m_iTeam == TERRORIST)
|
||||
@ -2049,7 +2049,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
|
||||
|
||||
if (!player->m_bReceivesNoMoneyNextRound)
|
||||
{
|
||||
player->AddAccount(m_iAccountTerrorist);
|
||||
player->AddAccount(m_iAccountTerrorist, RT_ROUND_BONUS);
|
||||
}
|
||||
|
||||
// If it's a prison scenario then remove the Ts guns
|
||||
@ -3668,7 +3668,7 @@ void CHalfLifeMultiplay::__API_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars
|
||||
// if a player dies by from teammate
|
||||
pKiller->frags -= IPointsForKill(peKiller, pVictim);
|
||||
|
||||
killer->AddAccount(PAYBACK_FOR_KILLED_TEAMMATES);
|
||||
killer->AddAccount(PAYBACK_FOR_KILLED_TEAMMATES, RT_TEAMMATES_KILLED);
|
||||
killer->m_iTeamKills++;
|
||||
killer->m_bJustKilledTeammate = true;
|
||||
|
||||
@ -3701,7 +3701,7 @@ void CHalfLifeMultiplay::__API_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars
|
||||
if (pVictim->m_bIsVIP)
|
||||
{
|
||||
killer->HintMessage("#Hint_reward_for_killing_vip", TRUE);
|
||||
killer->AddAccount(REWARD_KILLED_VIP);
|
||||
killer->AddAccount(REWARD_KILLED_VIP, RT_VIP_KILLED);
|
||||
|
||||
MESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR);
|
||||
WRITE_BYTE(9);
|
||||
@ -3714,7 +3714,7 @@ void CHalfLifeMultiplay::__API_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars
|
||||
UTIL_LogPrintf("\"%s<%i><%s><TERRORIST>\" triggered \"Assassinated_The_VIP\"\n", STRING(killer->pev->netname), GETPLAYERUSERID(killer->edict()), GETPLAYERAUTHID(killer->edict()));
|
||||
}
|
||||
else
|
||||
killer->AddAccount(REWARD_KILLED_ENEMY);
|
||||
killer->AddAccount(REWARD_KILLED_ENEMY, RT_ENEMY_KILLED);
|
||||
|
||||
if (!(killer->m_flDisplayHistory & DHF_ENEMY_KILLED))
|
||||
{
|
||||
|
@ -3070,9 +3070,9 @@ NOXREF void CBasePlayer::ThrowPrimary()
|
||||
DropShield();
|
||||
}
|
||||
|
||||
LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, AddAccount, (int amount, bool bTrackChange), amount, bTrackChange);
|
||||
LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, AddAccount, (int amount, RewardType type, bool bTrackChange), amount, type, bTrackChange);
|
||||
|
||||
void CBasePlayer::__API_HOOK(AddAccount)(int amount, bool bTrackChange)
|
||||
void CBasePlayer::__API_HOOK(AddAccount)(int amount, RewardType type, bool bTrackChange)
|
||||
{
|
||||
m_iAccount += amount;
|
||||
|
||||
@ -3300,7 +3300,7 @@ void CBasePlayer::JoiningThink()
|
||||
{
|
||||
m_iAccount = 0;
|
||||
CheckStartMoney();
|
||||
AddAccount(startmoney.value);
|
||||
AddAccount(startmoney.value, RT_INTO_GAME);
|
||||
}
|
||||
|
||||
if (g_pGameRules->FPlayerCanRespawn(this))
|
||||
@ -5499,7 +5499,7 @@ void CBasePlayer::Reset()
|
||||
|
||||
RemoveShield();
|
||||
CheckStartMoney();
|
||||
AddAccount(startmoney.value);
|
||||
AddAccount(startmoney.value, RT_PLAYER_RESET);
|
||||
|
||||
MESSAGE_BEGIN(MSG_ALL, gmsgScoreInfo);
|
||||
WRITE_BYTE(ENTINDEX(edict()));
|
||||
|
@ -140,6 +140,24 @@
|
||||
#define SOUND_FLASHLIGHT_ON "items/flashlight1.wav"
|
||||
#define SOUND_FLASHLIGHT_OFF "items/flashlight1.wav"
|
||||
|
||||
// custom enum
|
||||
enum RewardType
|
||||
{
|
||||
RT_NONE,
|
||||
RT_ROUND_BONUS,
|
||||
RT_PLAYER_RESET,
|
||||
RT_PLAYER_BOUGHT_SOMETHING,
|
||||
RT_HOSTAGE_TOOK,
|
||||
RT_HOSTAGE_RESCUED,
|
||||
RT_HOSTAGE_DAMAGED,
|
||||
RT_HOSTAGE_KILLED,
|
||||
RT_TEAMMATES_KILLED,
|
||||
RT_ENEMY_KILLED,
|
||||
RT_INTO_GAME,
|
||||
RT_VIP_KILLED,
|
||||
RT_VIP_RESCUED_MYSELF
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PLAYER_IDLE,
|
||||
@ -424,8 +442,8 @@ public:
|
||||
void SmartRadio();
|
||||
void ThrowWeapon(char *pszItemName);
|
||||
void ThrowPrimary();
|
||||
void AddAccount(int amount, bool bTrackChange = true);
|
||||
void AddAccount_(int amount, bool bTrackChange = true);
|
||||
void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true);
|
||||
void AddAccount_(int amount, RewardType type = RT_NONE, bool bTrackChange = true);
|
||||
void Disappear();
|
||||
void MakeVIP();
|
||||
bool CanPlayerBuy(bool display = false);
|
||||
|
@ -1770,7 +1770,7 @@ void CVIP_SafetyZone::VIP_SafetyTouch(CBaseEntity *pOther)
|
||||
p->m_bEscaped = true;
|
||||
|
||||
p->Disappear();
|
||||
p->AddAccount(REWARD_VIP_HAVE_SELF_RESCUED);
|
||||
p->AddAccount(REWARD_VIP_HAVE_SELF_RESCUED, RT_VIP_RESCUED_MYSELF);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,6 +132,24 @@
|
||||
#define SOUND_FLASHLIGHT_ON "items/flashlight1.wav"
|
||||
#define SOUND_FLASHLIGHT_OFF "items/flashlight1.wav"
|
||||
|
||||
// custom enum
|
||||
enum RewardType
|
||||
{
|
||||
RT_NONE,
|
||||
RT_ROUND_BONUS,
|
||||
RT_PLAYER_RESET,
|
||||
RT_PLAYER_BOUGHT_SOMETHING,
|
||||
RT_HOSTAGE_TOOK,
|
||||
RT_HOSTAGE_RESCUED,
|
||||
RT_HOSTAGE_DAMAGED,
|
||||
RT_HOSTAGE_KILLED,
|
||||
RT_TEAMMATES_KILLED,
|
||||
RT_ENEMY_KILLED,
|
||||
RT_INTO_GAME,
|
||||
RT_VIP_KILLED,
|
||||
RT_VIP_RESCUED_MYSELF
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PLAYER_IDLE,
|
||||
|
@ -140,8 +140,8 @@ typedef IVoidHookChain<const char *> IReGameHook_CBasePlayer_GiveNamedItem;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_GiveNamedItem;
|
||||
|
||||
// CBasePlayer::AddAccount hook
|
||||
typedef IVoidHookChain<int, bool> IReGameHook_CBasePlayer_AddAccount;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, int, bool> IReGameHookRegistry_CBasePlayer_AddAccount;
|
||||
typedef IVoidHookChain<int, enum RewardType, bool> IReGameHook_CBasePlayer_AddAccount;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, int, enum RewardType, bool> IReGameHookRegistry_CBasePlayer_AddAccount;
|
||||
|
||||
// CBasePlayer::GiveShield hook
|
||||
typedef IVoidHookChain<bool> IReGameHook_CBasePlayer_GiveShield;
|
||||
|
@ -297,7 +297,7 @@ public:
|
||||
virtual bool IsConnected() const = 0;
|
||||
|
||||
virtual void SetAnimation(PLAYER_ANIM playerAnim) = 0;
|
||||
virtual void AddAccount(int amount, bool bTrackChange = true) = 0;
|
||||
virtual void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true) = 0;
|
||||
virtual void GiveNamedItem(const char *pszName) = 0;
|
||||
virtual void GiveNamedItemEx(const char *pszName) = 0;
|
||||
virtual void GiveDefaultItems() = 0;
|
||||
|
@ -140,8 +140,8 @@ typedef IVoidHookChain<const char *> IReGameHook_CBasePlayer_GiveNamedItem;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, const char *> IReGameHookRegistry_CBasePlayer_GiveNamedItem;
|
||||
|
||||
// CBasePlayer::AddAccount hook
|
||||
typedef IVoidHookChain<int, bool> IReGameHook_CBasePlayer_AddAccount;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, int, bool> IReGameHookRegistry_CBasePlayer_AddAccount;
|
||||
typedef IVoidHookChain<int, enum RewardType, bool> IReGameHook_CBasePlayer_AddAccount;
|
||||
typedef IVoidHookChainRegistryClass<class CBasePlayer, int, enum RewardType, bool> IReGameHookRegistry_CBasePlayer_AddAccount;
|
||||
|
||||
// CBasePlayer::GiveShield hook
|
||||
typedef IVoidHookChain<bool> IReGameHook_CBasePlayer_GiveShield;
|
||||
|
@ -297,7 +297,7 @@ public:
|
||||
virtual bool IsConnected() const = 0;
|
||||
|
||||
virtual void SetAnimation(PLAYER_ANIM playerAnim) = 0;
|
||||
virtual void AddAccount(int amount, bool bTrackChange = true) = 0;
|
||||
virtual void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true) = 0;
|
||||
virtual void GiveNamedItem(const char *pszName) = 0;
|
||||
virtual void GiveNamedItemEx(const char *pszName) = 0;
|
||||
virtual void GiveDefaultItems() = 0;
|
||||
|
@ -137,10 +137,10 @@ typedef IVoidHookChainClassImpl<CBasePlayer, const char *> CRegameHook_CBasePlay
|
||||
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, const char *> CReGameHookRegistry_CBasePlayer_GiveNamedItem;
|
||||
|
||||
// CBasePlayer::AddAccount hook
|
||||
typedef IVoidHookChainClassImpl<CBasePlayer, int, bool> CRegameHook_CBasePlayer_AddAccount;
|
||||
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, int, bool> CReGameHookRegistry_CBasePlayer_AddAccount;
|
||||
typedef IVoidHookChainClassImpl<CBasePlayer, int, RewardType, bool> CRegameHook_CBasePlayer_AddAccount;
|
||||
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, int, RewardType, bool> CReGameHookRegistry_CBasePlayer_AddAccount;
|
||||
|
||||
// CBasePlayer::AddAccount hook
|
||||
// CBasePlayer::GiveShield hook
|
||||
typedef IVoidHookChainClassImpl<CBasePlayer, bool> CRegameHook_CBasePlayer_GiveShield;
|
||||
typedef IVoidHookChainRegistryClassImpl<CBasePlayer, bool> CReGameHookRegistry_CBasePlayer_GiveShield;
|
||||
|
||||
|
@ -341,7 +341,7 @@ public:
|
||||
virtual bool IsConnected() const { return m_pEntity->has_disconnected == false; }
|
||||
|
||||
virtual void SetAnimation(PLAYER_ANIM playerAnim) { ((CBasePlayer *)m_pEntity)->SetAnimation(playerAnim); }
|
||||
virtual void AddAccount(int amount, bool bTrackChange = true) { ((CBasePlayer *)m_pEntity)->AddAccount(amount, bTrackChange); }
|
||||
virtual void AddAccount(int amount, RewardType type = RT_NONE, bool bTrackChange = true) { ((CBasePlayer *)m_pEntity)->AddAccount(amount, type, bTrackChange); }
|
||||
virtual void GiveNamedItem(const char *pszName) { ((CBasePlayer *)m_pEntity)->GiveNamedItem(pszName); }
|
||||
virtual void GiveNamedItemEx(const char *pszName) { ((CBasePlayer *)m_pEntity)->GiveNamedItemEx(pszName); }
|
||||
virtual void GiveDefaultItems() { ((CBasePlayer *)m_pEntity)->GiveDefaultItems(); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user