From 0e68bedf24c271d35a97be5ac6ae5d9311e28d0b Mon Sep 17 00:00:00 2001 From: s1lentq Date: Sat, 23 Dec 2023 02:43:42 +0700 Subject: [PATCH] Fixed rarity of kills suicide, thrusmoke and for some weapons --- regamedll/dlls/multiplay_gamerules.cpp | 42 +++++++++++++++----------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index c403c084..102d7545 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -3088,7 +3088,7 @@ void CHalfLifeMultiplay::CheckLevelInitialized() // This determines the maximum number of players allowed on each m_iSpawnPointCount_Terrorist = UTIL_CountEntities("info_player_deathmatch"); m_iSpawnPointCount_CT = UTIL_CountEntities("info_player_start"); -#ifdef REGAMEDLL_FIXES +#ifdef REGAMEDLL_FIXES m_bMapHasCameras = UTIL_CountEntities("trigger_camera"); #endif m_bLevelInitialized = true; @@ -3582,7 +3582,7 @@ void CHalfLifeMultiplay::ClientDisconnected(edict_t *pClient) { pPlayer->DropPlayerItem("weapon_c4"); } - + if (pPlayer->m_bHasDefuser) { #ifdef REGAMEDLL_FIXES @@ -5250,26 +5250,32 @@ int CHalfLifeMultiplay::GetRarityOfKill(CBaseEntity *pKiller, CBasePlayer *pVict if (pVictim->m_bHeadshotKilled) iRarity |= KILLRARITY_HEADSHOT; - // The killer player kills the victim through the walls - if (pVictim->GetDmgPenetrationLevel() > 0) - iRarity |= KILLRARITY_PENETRATED; - // The killer player was blind - if (pKiller && pKiller->IsPlayer()) + CBasePlayer *pKillerPlayer = static_cast(pKiller); + if (pKillerPlayer && pKillerPlayer->IsPlayer()) { - CBasePlayer *pKillerPlayer = static_cast(pKiller); - if (pKillerPlayer->IsBlind()) - iRarity |= KILLRARITY_KILLER_BLIND; - - // The killer player kills the victim with a sniper rifle with no scope WeaponClassType weaponClass = AliasToWeaponClass(killerWeaponName); - if (weaponClass == WEAPONCLASS_SNIPERRIFLE && pKillerPlayer->m_iClientFOV == DEFAULT_FOV) - iRarity |= KILLRARITY_NOSCOPE; + if (pKillerPlayer != pVictim + && weaponClass != WEAPONCLASS_NONE + && weaponClass != WEAPONCLASS_KNIFE + && weaponClass != WEAPONCLASS_GRENADE) + { + // The killer player kills the victim through the walls + if (pVictim->GetDmgPenetrationLevel() > 0) + iRarity |= KILLRARITY_PENETRATED; - // The killer player kills the victim through smoke - const Vector inEyePos = pKillerPlayer->EyePosition(); - if (TheCSBots()->IsLineBlockedBySmoke(&inEyePos, &pVictim->pev->origin)) - iRarity |= KILLRARITY_THRUSMOKE; + if (pKillerPlayer->IsBlind()) + iRarity |= KILLRARITY_KILLER_BLIND; + + // The killer player kills the victim with a sniper rifle with no scope + if (weaponClass == WEAPONCLASS_SNIPERRIFLE && pKillerPlayer->m_iClientFOV == DEFAULT_FOV) + iRarity |= KILLRARITY_NOSCOPE; + + // The killer player kills the victim through smoke + const Vector inEyePos = pKillerPlayer->EyePosition(); + if (TheCSBots()->IsLineBlockedBySmoke(&inEyePos, &pVictim->pev->origin)) + iRarity |= KILLRARITY_THRUSMOKE; + } // Calculate # of unanswered kills between killer & victim // This is plus 1 as this function gets called before the stat is updated