/* <1efe16> ../cstrike/dlls/career_tasks.cpp:348 */ void CCareerTask::OnWeaponInjury(int weaponId, int weaponClassId, bool attackerHasShield, CBasePlayer *pAttacker) { if (m_isComplete || m_event != EVENT_PLAYER_TOOK_DAMAGE) { return; } if (m_weaponId == WEAPON_SHIELDGUN) { if (!attackerHasShield) return; } else if (m_weaponId) { if (m_weaponId != weaponId) return; } else if (m_weaponClassId) { if (m_weaponClassId != weaponClassId) return; } ++m_eventsSeen; SendPartialNotification(); }
/* <1efc6c> ../cstrike/dlls/career_tasks.cpp:268 */ void CCareerTask::OnWeaponKill(int weaponId, int weaponClassId, bool headshot, bool killerHasShield, CBasePlayer *pAttacker, CBasePlayer *pVictim) { if (m_isComplete || m_event != EVENT_KILL && (m_event != EVENT_HEADSHOT || !headshot)) { return; } if (!pVictim || (m_defuser && !pVictim->m_bIsDefusing) || (m_vip && !pVictim->m_bIsVIP)) { return; } if (m_rescuer) { int hostages_ = 0; CBaseEntity *hostageEntity = NULL; while ((hostageEntity = UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")) != NULL) { CHostage *hostage = (CHostage *)hostageEntity; if (!hostage || hostage->pev->takedamage != DAMAGE_YES) continue; if (hostage->m_improv) { if (!hostage->IsFollowingSomeone()) continue; } else if (!hostage->m_hTargetEnt || hostage->m_State != CHostage::FOLLOW) continue; if (hostage->IsValid() && hostage->m_target == pAttacker) ++hostages_; } if (!hostages_) return; } if (m_weaponId == WEAPON_SHIELDGUN) { if (!killerHasShield) return; } else if (m_weaponId) { if (m_weaponId != weaponId) return; } else if (m_weaponClassId) { if (m_weaponClassId != weaponClassId) return; } ++m_eventsSeen; SendPartialNotification(); }
/* <1ef79d> ../cstrike/dlls/career_tasks.cpp:385 */ void CCareerTask::__MAKE_VHOOK(OnEvent)(GameEventType event, CBasePlayer *pVictim, CBasePlayer *pAttacker) { if (m_isComplete) return; if (event == m_event) { if ((m_defuser && !pAttacker->m_bIsDefusing) || (m_vip && !pAttacker->m_bIsVIP)) return; if (m_rescuer) { int hostages_ = 0; CBaseEntity *hostageEntity = NULL; while ((hostageEntity = UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")) != NULL) { if (hostageEntity->pev->takedamage != DAMAGE_YES) continue; CHostage *hostage = static_cast<CHostage *>(hostageEntity); if (!hostage->IsFollowingSomeone()) continue; if (hostage->IsValid() && hostage->m_target == pAttacker) ++hostages_; } if (!hostages_) { return; } } if (m_event != EVENT_KILL || (!m_weaponId && !m_weaponClassId) && m_event != EVENT_HEADSHOT || (!m_weaponId && !m_weaponClassId) && m_event != EVENT_PLAYER_TOOK_DAMAGE || (!m_weaponId && !m_weaponClassId)) { if (m_event == EVENT_ROUND_WIN) { if (!Q_strcmp(m_name, "defendhostages")) { int hostages_ = 0; CBaseEntity *hostageEntity = NULL; while ((hostageEntity = UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")) != NULL) { if (hostageEntity->pev->takedamage != 1.0f && hostageEntity->pev->deadflag != DEAD_DEAD) ++hostages_; } if (!hostages_) { ++m_eventsSeen; SendPartialNotification(); } } else if (!Q_strcmp(m_name, "hostagessurvive")) { int hostages_ = 0; CBaseEntity *hostageEntity = NULL; while ((hostageEntity = UTIL_FindEntityByClassname(hostageEntity, "hostage_entity")) != NULL) { CHostage *hostage = (CHostage *)hostageEntity; if (hostage && hostage->IsDead()) ++hostages_; } if (!hostages_) { ++m_eventsSeen; SendPartialNotification(); } } else if (!Q_strcmp(m_name, "winfast")) { if (m_eventsNeeded >= TheCareerTasks->GetRoundElapsedTime()) { m_eventsSeen = m_eventsNeeded; SendPartialNotification(); } } else if (IsTaskCompletableThisRound()) { ++m_eventsSeen; SendPartialNotification(); } } else { ++m_eventsSeen; SendPartialNotification(); } } } if (event == m_event && !m_mustLive && m_eventsSeen >= m_eventsNeeded && IsTaskCompletableThisRound()) { CBasePlayer *player = UTIL_GetLocalPlayer(); EMIT_SOUND(ENT(player->pev), CHAN_VOICE, "events/task_complete.wav", VOL_NORM, ATTN_NORM); m_isComplete = true; MESSAGE_BEGIN(MSG_ALL, gmsgCZCareer); WRITE_STRING("TASKDONE"); WRITE_BYTE(m_id); MESSAGE_END(); if (TheTutor != NULL) { TheTutor->OnEvent(EVENT_CAREER_TASK_DONE); } UTIL_LogPrintf("Career Task Done %d\n", m_id); if (m_event == EVENT_ROUND_WIN && !Q_strcmp(m_name, "winfast")) { TheCareerTasks->SetFinishedTaskTime((int)TheCareerTasks->GetRoundElapsedTime()); UTIL_GetLocalPlayer()->SyncRoundTimer(); } } else if (event >= EVENT_ROUND_DRAW) { if (event > EVENT_ROUND_LOSS) { if (event == EVENT_DIE && (m_mustLive || m_crossRounds)) { m_eventsSeen = 0; SendPartialNotification(); m_diedThisRound = true; } } else if (m_mustLive) { if (m_eventsSeen >= m_eventsNeeded && !m_diedThisRound && IsTaskCompletableThisRound()) { CBasePlayer *player = UTIL_GetLocalPlayer(); EMIT_SOUND(ENT(player->pev), CHAN_VOICE, "events/task_complete.wav", VOL_NORM, ATTN_NORM); m_isComplete = true; MESSAGE_BEGIN(MSG_ALL, gmsgCZCareer); WRITE_STRING("TASKDONE"); WRITE_BYTE(m_id); MESSAGE_END(); UTIL_LogPrintf("Career Task Done %d\n", m_id); if (m_event == EVENT_ROUND_WIN && !Q_strcmp(m_name, "winfast")) { TheCareerTasks->SetFinishedTaskTime((int)TheCareerTasks->GetRoundElapsedTime()); UTIL_GetLocalPlayer()->SyncRoundTimer(); } if (TheTutor != NULL) { TheTutor->OnEvent(EVENT_CAREER_TASK_DONE); } } m_diedThisRound = false; if (m_mustLive) { m_eventsSeen = 0; SendPartialNotification(); } } } }