void CSingleplayRules::NPCKilled(CBaseEntity *pVictim, const CTakeDamageInfo &info) { CBasePlayer *pEntity = UTIL_GetLocalPlayer(); if (pVictim->m_isRareEntity) { switch (GetSkillLevel()) { case SKILL_EASY: if (g_fr_economy.GetBool()) { pEntity->AddMoney(3 * sk_money_multiplier1.GetInt()); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(5 * sk_exp_multiplier1.GetInt()); } break; case SKILL_MEDIUM: if (g_fr_economy.GetBool()) { pEntity->AddMoney(3 * sk_money_multiplier2.GetInt()); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(5 * sk_exp_multiplier2.GetInt()); } break; case SKILL_HARD: if (g_fr_economy.GetBool()) { pEntity->AddMoney(3 * sk_money_multiplier3.GetInt()); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(5 * sk_exp_multiplier3.GetInt()); } break; case SKILL_VERYHARD: if (g_fr_economy.GetBool()) { pEntity->AddMoney(3 * sk_money_multiplier4.GetInt()); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(5 * sk_exp_multiplier4.GetInt()); } break; case SKILL_NIGHTMARE: if (g_fr_economy.GetBool()) { pEntity->AddMoney(3 * sk_money_multiplier5.GetInt()); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(5 * sk_exp_multiplier5.GetInt()); } break; } } else { switch (GetSkillLevel()) { case SKILL_EASY: if (g_fr_economy.GetBool()) { pEntity->AddMoney(2 * sk_money_multiplier1.GetInt()); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(3 * sk_exp_multiplier1.GetInt()); } break; case SKILL_MEDIUM: if (g_fr_economy.GetBool()) { pEntity->AddMoney(2 * sk_money_multiplier2.GetInt()); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(3 * sk_exp_multiplier2.GetInt()); } break; case SKILL_HARD: if (g_fr_economy.GetBool()) { pEntity->AddMoney(2 * sk_money_multiplier3.GetInt()); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(3 * sk_exp_multiplier3.GetInt()); } break; case SKILL_VERYHARD: if (g_fr_economy.GetBool()) { pEntity->AddMoney(2 * sk_money_multiplier4.GetInt()); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(3 * sk_exp_multiplier4.GetInt()); } break; case SKILL_NIGHTMARE: if (g_fr_economy.GetBool()) { pEntity->AddMoney(2 * sk_money_multiplier5.GetInt()); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(3 * sk_exp_multiplier5.GetInt()); } break; } } pEntity->IncrementFragCount(1); #define KILLING_SPREE_AMOUNT 5 #define KILLING_FRENZY_AMOUNT 10 #define OVERKILL_AMOUNT 15 #define RAMPAGE_AMOUNT 20 #define UNSTOPPABLE_AMOUNT 25 #define INCONCEIVABLE_AMOUNT 30 #define INVINCIBLE_AMOUNT 35 #define GODLIKE_AMOUNT 40 if (info.GetInflictor() == pEntity) { if (sv_player_voice.GetBool()) { if (sv_player_voice_kill.GetBool()) { int killvoicerandom = random->RandomInt(0, sv_player_voice_kill_freq.GetInt()); if (killvoicerandom == 0) { pEntity->EmitSound("Player.VoiceKill"); } } } } if (sv_killingspree.GetBool()) { int m_iKillsInSpree = pEntity->FragCount(); if (m_iKillsInSpree == KILLING_SPREE_AMOUNT) { CFmtStr hint; hint.sprintf("#Valve_Hud_KILLINGSPREE"); pEntity->ShowLevelMessage(hint.Access()); if (g_fr_economy.GetBool()) { pEntity->AddMoney(2); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(3); } } if (m_iKillsInSpree == KILLING_FRENZY_AMOUNT) { CFmtStr hint; hint.sprintf("#Valve_Hud_KILLINGFRENZY"); pEntity->ShowLevelMessage(hint.Access()); if (g_fr_economy.GetBool()) { pEntity->AddMoney(4); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(6); } } if (m_iKillsInSpree == OVERKILL_AMOUNT) { CFmtStr hint; hint.sprintf("#Valve_Hud_OVERKILL"); pEntity->ShowLevelMessage(hint.Access()); if (g_fr_economy.GetBool()) { pEntity->AddMoney(6); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(9); } } if (m_iKillsInSpree == RAMPAGE_AMOUNT) { CFmtStr hint; hint.sprintf("#Valve_Hud_RAMPAGE"); pEntity->ShowLevelMessage(hint.Access()); if (g_fr_economy.GetBool()) { pEntity->AddMoney(8); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(12); } } if (m_iKillsInSpree == UNSTOPPABLE_AMOUNT) { CFmtStr hint; hint.sprintf("#Valve_Hud_UNSTOPPABLE"); pEntity->ShowLevelMessage(hint.Access()); if (g_fr_economy.GetBool()) { pEntity->AddMoney(10); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(15); } } if (m_iKillsInSpree == INCONCEIVABLE_AMOUNT) { CFmtStr hint; hint.sprintf("#Valve_Hud_INCONCEIVABLE"); pEntity->ShowLevelMessage(hint.Access()); if (g_fr_economy.GetBool()) { pEntity->AddMoney(12); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(18); } } if (m_iKillsInSpree == INVINCIBLE_AMOUNT) { CFmtStr hint; hint.sprintf("#Valve_Hud_INVINCIBLE"); pEntity->ShowLevelMessage(hint.Access()); if (g_fr_economy.GetBool()) { pEntity->AddMoney(14); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(21); } } if (m_iKillsInSpree == GODLIKE_AMOUNT) { CFmtStr hint; hint.sprintf("#Valve_Hud_GODLIKE"); pEntity->ShowLevelMessage(hint.Access()); if (g_fr_economy.GetBool()) { pEntity->AddMoney(16); } if (!g_fr_classic.GetBool()) { pEntity->AddXP(24); } } } if (pVictim->m_isRareEntity) { if (g_fr_classic.GetBool()) { pEntity->LevelUpClassic(); } } }
//----------------------------------------------------------------------------- // Purpose: Handle grenade detonate in-air (even when no ammo is left) //----------------------------------------------------------------------------- void CWeaponOICW::ItemPostFrame(void) { CBasePlayer *pOwner = ToBasePlayer(GetOwner()); if (!pOwner) return; if ((pOwner->m_nButtons & IN_ATTACK) == false) { m_nShotsFired = 0; } //Zoom in if (pOwner->m_afButtonPressed & IN_ATTACK2) { if (m_iFireMode == 0) { Zoom(); } else if (m_iFireMode == 1) { if (m_flNextSecondaryAttack <= gpGlobals->curtime) { if (pOwner->GetAmmoCount(m_iSecondaryAmmoType) <= 0) { if (m_flNextEmptySoundTime < gpGlobals->curtime) { WeaponSound(EMPTY); m_flNextSecondaryAttack = m_flNextEmptySoundTime = gpGlobals->curtime + 0.5; } } else if (pOwner->GetWaterLevel() == 3 && m_bAltFiresUnderwater == false) { // This weapon doesn't fire underwater WeaponSound(EMPTY); m_flNextPrimaryAttack = gpGlobals->curtime + 0.2; return; } else { GrenadeAttack(); } } } } //Throw a grenade. if (pOwner->m_afButtonPressed & IN_ATTACK3) { if (m_iFireMode == 0) { if (m_bZoomed) { Zoom(); } CFmtStr hint; hint.sprintf("#Valve_OICW_Grenades"); pOwner->ShowLevelMessage(hint.Access()); m_iFireMode = 1; WeaponSound(EMPTY); } else if (m_iFireMode == 1) { CFmtStr hint; hint.sprintf("#Valve_OICW_Scope"); pOwner->ShowLevelMessage(hint.Access()); m_iFireMode = 0; WeaponSound(EMPTY); } } //Allow a refire as fast as the player can click if (m_bZoomed && ((pOwner->m_nButtons & IN_ATTACK) == false) && (m_flSoonestPrimaryAttack < gpGlobals->curtime)) { m_flNextPrimaryAttack = gpGlobals->curtime - 0.1f; } //Don't kick the same when we're zoomed in if (m_bZoomed) { m_fFireDuration = 0.05f; } BaseClass::ItemPostFrame(); }