Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

593 lines
20 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #include "cbase.h"
  7. #ifdef CLIENT_DLL
  8. #include "achievementmgr.h"
  9. #include "baseachievement.h"
  10. #include "tf_hud_statpanel.h"
  11. #include "c_tf_team.h"
  12. #include "c_tf_player.h"
  13. #include "c_tf_playerresource.h"
  14. #include "tf_gamerules.h"
  15. #include "econ_wearable.h"
  16. #include "achievements_tf.h"
  17. // NVNT include for tf2 damage
  18. #include "haptics/haptic_utils.h"
  19. //-----------------------------------------------------------------------------
  20. // Halloween Achievements
  21. //-----------------------------------------------------------------------------
  22. class CAchievementTFHalloweenCollectPumpkins : public CBaseTFAchievementSimple
  23. {
  24. void Init()
  25. {
  26. SetFlags( ACH_SAVE_GLOBAL );
  27. SetGoal( 20 );
  28. SetStoreProgressInSteam( true );
  29. }
  30. virtual void ListenForEvents()
  31. {
  32. ListenForGameEvent( "halloween_pumpkin_grab" );
  33. }
  34. void FireGameEvent_Internal( IGameEvent *event )
  35. {
  36. if ( !TFGameRules()->IsHolidayActive( kHoliday_Halloween ) )
  37. return;
  38. if ( Q_strcmp( event->GetName(), "halloween_pumpkin_grab" ) == 0 )
  39. {
  40. int iPlayer = engine->GetPlayerForUserID( event->GetInt( "userid" ) );
  41. CBaseEntity *pPlayer = UTIL_PlayerByIndex( iPlayer );
  42. if ( pPlayer && pPlayer == C_TFPlayer::GetLocalTFPlayer() )
  43. {
  44. IncrementCount();
  45. }
  46. }
  47. }
  48. };
  49. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenCollectPumpkins, ACHIEVEMENT_TF_HALLOWEEN_COLLECT_PUMPKINS, "TF_HALLOWEEN_COLLECT_PUMPKINS", 5 );
  50. //----------------------------------------------------------------------------------------------------------------
  51. class CAchievementTFHalloweenDominateForHat : public CBaseTFAchievementSimple
  52. {
  53. void Init()
  54. {
  55. SetFlags( ACH_LISTEN_PLAYER_KILL_ENEMY_EVENTS | ACH_SAVE_GLOBAL );
  56. SetGoal( 1 );
  57. }
  58. virtual void Event_EntityKilled( CBaseEntity *pVictim, CBaseEntity *pAttacker, CBaseEntity *pInflictor, IGameEvent *event )
  59. {
  60. CTFPlayer *pTFVictim = ToTFPlayer( pVictim );
  61. bool bDomination = event->GetInt( "death_flags" ) & TF_DEATH_DOMINATION;
  62. if ( pTFVictim && pAttacker == C_TFPlayer::GetLocalTFPlayer() && bDomination == true )
  63. {
  64. // Are they wearing the HAT?
  65. for ( int i=0; i<pTFVictim->GetNumWearables(); ++i )
  66. {
  67. C_EconWearable *pWearable = pTFVictim->GetWearable( i );
  68. if ( pWearable && pWearable->GetAttributeContainer() )
  69. {
  70. CEconItemView *pItem = pWearable->GetAttributeContainer()->GetItem();
  71. if ( pItem && pItem->IsValid() )
  72. {
  73. if ( ( pItem->GetItemDefIndex() == 116 ) || // Ghastly Gibus
  74. ( pItem->GetItemDefIndex() == 279 ) || // Ghastly Gibus 2010
  75. ( pItem->GetItemDefIndex() == 584 ) || // Ghastly Gibus 2011
  76. ( pItem->GetItemDefIndex() == 940 ) ) // Ghostly Gibus
  77. {
  78. IncrementCount();
  79. }
  80. }
  81. }
  82. }
  83. }
  84. }
  85. };
  86. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenDominateForHat, ACHIEVEMENT_TF_HALLOWEEN_DOMINATE_FOR_HAT, "TF_HALLOWEEN_DOMINATE_FOR_HAT", 5 );
  87. //----------------------------------------------------------------------------------------------------------------
  88. class CAchievementTFHalloweenKillScaredPlayer : public CBaseTFAchievementSimple
  89. {
  90. void Init()
  91. {
  92. SetFlags( ACH_LISTEN_PLAYER_KILL_ENEMY_EVENTS | ACH_SAVE_GLOBAL );
  93. SetGoal( 1 );
  94. }
  95. virtual void Event_EntityKilled( CBaseEntity *pVictim, CBaseEntity *pAttacker, CBaseEntity *pInflictor, IGameEvent *event )
  96. {
  97. CTFPlayer *pTFVictim = ToTFPlayer( pVictim );
  98. if ( !pTFVictim )
  99. return;
  100. CTFPlayer *pLocalPlayer = ToTFPlayer( C_TFPlayer::GetLocalPlayer() );
  101. if ( !pLocalPlayer )
  102. return;
  103. if ( !TFGameRules()->IsHolidayActive( kHoliday_Halloween ) )
  104. return;
  105. if ( pVictim == pLocalPlayer )
  106. return;
  107. int iStunFlags = event->GetInt( "stun_flags" );
  108. bool bStunByTrigger = iStunFlags & TF_STUN_BY_TRIGGER;
  109. if ( bStunByTrigger )
  110. {
  111. IncrementCount();
  112. }
  113. }
  114. };
  115. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenKillScaredPlayer, ACHIEVEMENT_TF_HALLOWEEN_KILL_SCARED_PLAYER, "TF_HALLOWEEN_KILL_SCARED_PLAYER", 1 );
  116. //----------------------------------------------------------------------------------------------------------------
  117. class CAchievementTFHalloweenPumpkinKill : public CBaseTFAchievementSimple
  118. {
  119. void Init()
  120. {
  121. SetFlags( ACH_LISTEN_PLAYER_KILL_ENEMY_EVENTS | ACH_SAVE_GLOBAL );
  122. SetGoal( 5 );
  123. SetStoreProgressInSteam( true );
  124. }
  125. virtual void Event_EntityKilled( CBaseEntity *pVictim, CBaseEntity *pAttacker, CBaseEntity *pInflictor, IGameEvent *event )
  126. {
  127. CTFPlayer *pTFVictim = ToTFPlayer( pVictim );
  128. if ( !pTFVictim )
  129. return;
  130. CTFPlayer *pLocalPlayer = ToTFPlayer( C_TFPlayer::GetLocalPlayer() );
  131. if ( !pLocalPlayer )
  132. return;
  133. if ( pLocalPlayer != pAttacker )
  134. return;
  135. if ( !TFGameRules()->IsHolidayActive( kHoliday_Halloween ) )
  136. return;
  137. if ( pVictim == pLocalPlayer )
  138. return;
  139. int customdmg = event->GetInt( "customkill" );
  140. if ( customdmg == TF_DMG_CUSTOM_PUMPKIN_BOMB )
  141. {
  142. IncrementCount();
  143. }
  144. }
  145. };
  146. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenPumpkinKill, ACHIEVEMENT_TF_HALLOWEEN_PUMPKIN_KILL, "TF_HALLOWEEN_PUMPKIN_KILL", 5 );
  147. //----------------------------------------------------------------------------------------------------------------
  148. class CAchievementTFHalloweenDisguisedSpyKill : public CBaseTFAchievementSimple
  149. {
  150. void Init()
  151. {
  152. SetFlags( ACH_LISTEN_PLAYER_KILL_ENEMY_EVENTS | ACH_SAVE_GLOBAL );
  153. SetGoal( 1 );
  154. }
  155. virtual void Event_EntityKilled( CBaseEntity *pVictim, CBaseEntity *pAttacker, CBaseEntity *pInflictor, IGameEvent *event )
  156. {
  157. CTFPlayer *pTFVictim = ToTFPlayer( pVictim );
  158. if ( !pTFVictim )
  159. return;
  160. CTFPlayer *pTFAttacker = ToTFPlayer( pAttacker );
  161. if ( !pTFAttacker )
  162. return;
  163. CTFPlayer *pLocalPlayer = ToTFPlayer( C_TFPlayer::GetLocalPlayer() );
  164. if ( !pLocalPlayer )
  165. return;
  166. if ( !TFGameRules()->IsHolidayActive( kHoliday_Halloween ) )
  167. return;
  168. if ( pVictim == pLocalPlayer )
  169. return;
  170. if ( pTFVictim->m_Shared.GetDisguiseClass() == pTFAttacker->GetPlayerClass()->GetClassIndex() )
  171. {
  172. IncrementCount();
  173. }
  174. }
  175. };
  176. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenDisguisedSpyKill, ACHIEVEMENT_TF_HALLOWEEN_DISGUISED_SPY_KILL, "TF_HALLOWEEN_DISGUISED_SPY_KILL", 5 );
  177. //----------------------------------------------------------------------------------------------------------------
  178. class CAchievementTFHalloweenBossKill : public CBaseTFAchievementSimple
  179. {
  180. void Init()
  181. {
  182. SetFlags( ACH_SAVE_GLOBAL );
  183. SetGoal( 1 );
  184. }
  185. // server awards this achievement, no other code within achievement necessary
  186. };
  187. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenBossKill, ACHIEVEMENT_TF_HALLOWEEN_BOSS_KILL, "TF_HALLOWEEN_BOSS_KILL", 5 );
  188. //----------------------------------------------------------------------------------------------------------------
  189. class CAchievementTFHalloweenBossKillMelee : public CBaseTFAchievementSimple
  190. {
  191. void Init()
  192. {
  193. SetFlags( ACH_SAVE_GLOBAL );
  194. SetGoal( 1 );
  195. }
  196. // server awards this achievement, no other code within achievement necessary
  197. };
  198. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenBossKillMelee, ACHIEVEMENT_TF_HALLOWEEN_BOSS_KILL_MELEE, "TF_HALLOWEEN_BOSS_KILL_MELEE", 5 );
  199. //----------------------------------------------------------------------------------------------------------------
  200. class CAchievementTFHalloweenCollectGoodyBag : public CBaseTFAchievementSimple
  201. {
  202. void Init()
  203. {
  204. SetFlags( ACH_SAVE_GLOBAL );
  205. SetGoal( 1 );
  206. }
  207. // client awards this achievement in CGCHalloween_GrantedItemResponse, no other code within achievement necessary
  208. };
  209. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenCollectGoodyBag, ACHIEVEMENT_TF_HALLOWEEN_COLLECT_GOODY_BAG, "TF_HALLOWEEN_COLLECT_GOODY_BAG", 5 );
  210. //----------------------------------------------------------------------------------------------------------------
  211. class CAchievementTFHalloweenCraftSaxtonMask : public CBaseTFAchievementSimple
  212. {
  213. void Init()
  214. {
  215. SetFlags( ACH_SAVE_GLOBAL );
  216. SetGoal( 1 );
  217. }
  218. // client awards this achievement in CTFPlayerInventory::SOCreated(), no other code within achievement necessary
  219. };
  220. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenCraftSaxtonMask, ACHIEVEMENT_TF_HALLOWEEN_CRAFT_SAXTON_MASK, "TF_HALLOWEEN_CRAFT_SAXTON_MASK", 5 );
  221. //----------------------------------------------------------------------------------------------------------------
  222. class CAchievementTFHalloweenEyeBossKill : public CBaseTFAchievementSimple
  223. {
  224. void Init()
  225. {
  226. SetFlags( ACH_SAVE_GLOBAL );
  227. SetGoal( 1 );
  228. }
  229. // server awards this achievement, no other code within achievement necessary
  230. };
  231. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenEyeBossKill, ACHIEVEMENT_TF_HALLOWEEN_EYEBOSS_KILL, "TF_HALLOWEEN_EYEBOSS_KILL", 5 );
  232. //----------------------------------------------------------------------------------------------------------------
  233. class CAchievementTFHalloweenLootIsland : public CBaseTFAchievementSimple
  234. {
  235. void Init()
  236. {
  237. SetFlags( ACH_SAVE_GLOBAL );
  238. SetGoal( 1 );
  239. }
  240. // server awards this achievement, no other code within achievement necessary
  241. };
  242. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenLootIsland, ACHIEVEMENT_TF_HALLOWEEN_LOOT_ISLAND, "TF_HALLOWEEN_LOOT_ISLAND", 5 );
  243. //----------------------------------------------------------------------------------------------------------------
  244. class CAchievementTFHalloweenMerasmusKill : public CBaseTFAchievementSimple
  245. {
  246. void Init()
  247. {
  248. SetFlags( ACH_SAVE_GLOBAL );
  249. SetGoal( 1 );
  250. }
  251. // server awards this achievement, no other code within achievement necessary
  252. };
  253. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenMerasmusKill, ACHIEVEMENT_TF_HALLOWEEN_MERASMUS_KILL, "TF_HALLOWEEN_MERASMUS_KILL", 5 );
  254. //----------------------------------------------------------------------------------------------------------------
  255. class CAchievementTFHalloweenMerasmusCollectLoot : public CBaseTFAchievementSimple
  256. {
  257. void Init()
  258. {
  259. SetFlags( ACH_SAVE_GLOBAL );
  260. SetGoal( 1 );
  261. }
  262. // server awards this achievement, no other code within achievement necessary
  263. };
  264. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenMerasmusCollectLoot, ACHIEVEMENT_TF_HALLOWEEN_MERASMUS_COLLECT_LOOT, "TF_HALLOWEEN_MERASMUS_COLLECT_LOOT", 5 );
  265. //----------------------------------------------------------------------------------------------------------------
  266. class CAchievementTFHalloweenHelltowerRareSpell : public CBaseTFAchievementSimple
  267. {
  268. void Init()
  269. {
  270. SetFlags( ACH_SAVE_GLOBAL );
  271. SetGoal( 1 );
  272. }
  273. // server awards this achievement, no other code within achievement necessary
  274. };
  275. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenHelltowerRareSpell, ACHIEVEMENT_TF_HALLOWEEN_HELLTOWER_RARE_SPELL, "TF_HALLOWEEN_HELLTOWER_RARE_SPELL", 5 );
  276. //----------------------------------------------------------------------------------------------------------------
  277. class CAchievementTFHalloweenHelltowerWinRounds : public CBaseTFAchievementSimple
  278. {
  279. void Init()
  280. {
  281. SetFlags( ACH_SAVE_GLOBAL );
  282. SetGoal( 142 );
  283. SetStoreProgressInSteam( true );
  284. SetMapNameFilter( "plr_hightower_event" );
  285. }
  286. virtual void ListenForEvents()
  287. {
  288. ListenForGameEvent( "teamplay_round_win" );
  289. }
  290. void FireGameEvent_Internal( IGameEvent *event )
  291. {
  292. if ( 0 == Q_strcmp( event->GetName(), "teamplay_round_win" ) )
  293. {
  294. // Were we on the winning team?
  295. int iTeam = event->GetInt( "team" );
  296. if ( ( iTeam >= FIRST_GAME_TEAM ) && ( iTeam == GetLocalPlayerTeam() ) )
  297. {
  298. IncrementCount();
  299. }
  300. }
  301. }
  302. };
  303. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenHelltowerWinRounds, ACHIEVEMENT_TF_HALLOWEEN_HELLTOWER_WIN_ROUNDS, "TF_HALLOWEEN_HELLTOWER_WIN_ROUNDS", 5 );
  304. //----------------------------------------------------------------------------------------------------------------
  305. class CAchievementTFHalloweenHelltowerEnvironmentalKills : public CBaseTFAchievementSimple
  306. {
  307. void Init()
  308. {
  309. SetFlags( ACH_SAVE_GLOBAL );
  310. SetGoal( 17 );
  311. SetStoreProgressInSteam( true );
  312. }
  313. // server awards this achievement, no other code within achievement necessary
  314. };
  315. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenHelltowerEnvironmentalKills, ACHIEVEMENT_TF_HALLOWEEN_HELLTOWER_ENVIRONMENTAL_KILLS, "TF_HALLOWEEN_HELLTOWER_ENVIRONMENTAL_KILLS", 5 );
  316. //----------------------------------------------------------------------------------------------------------------
  317. class CAchievementTFHalloweenHelltowerSkeletonGrind : public CBaseTFAchievementSimple
  318. {
  319. void Init()
  320. {
  321. SetFlags( ACH_SAVE_GLOBAL );
  322. SetGoal( 99 );
  323. SetStoreProgressInSteam( true );
  324. }
  325. // server awards this achievement, no other code within achievement necessary
  326. };
  327. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenHelltowerSkeletonGrind, ACHIEVEMENT_TF_HALLOWEEN_HELLTOWER_SKELETON_GRIND, "TF_HALLOWEEN_HELLTOWER_SKELETON_GRIND", 5 );
  328. //----------------------------------------------------------------------------------------------------------------
  329. class CAchievementTFHalloweenHelltowerKillGrind : public CBaseTFAchievementSimple
  330. {
  331. void Init()
  332. {
  333. SetFlags( ACH_LISTEN_PLAYER_KILL_ENEMY_EVENTS | ACH_SAVE_GLOBAL );
  334. SetGoal( 25 );
  335. SetStoreProgressInSteam( true );
  336. SetMapNameFilter( "plr_hightower_event" );
  337. }
  338. virtual void Event_EntityKilled( CBaseEntity *pVictim, CBaseEntity *pAttacker, CBaseEntity *pInflictor, IGameEvent *event )
  339. {
  340. if ( TFGameRules() && TFGameRules()->IsHalloweenScenario( CTFGameRules::HALLOWEEN_SCENARIO_HIGHTOWER ) )
  341. {
  342. CTFPlayer *pTFVictim = ToTFPlayer( pVictim );
  343. if ( !pTFVictim )
  344. return;
  345. CTFPlayer *pLocalPlayer = ToTFPlayer( C_TFPlayer::GetLocalPlayer() );
  346. if ( !pLocalPlayer )
  347. return;
  348. if ( pLocalPlayer != pAttacker )
  349. return;
  350. if ( pLocalPlayer == pVictim )
  351. return;
  352. switch( event->GetInt( "customkill" ) )
  353. {
  354. case TF_DMG_CUSTOM_SPELL_TELEPORT:
  355. case TF_DMG_CUSTOM_SPELL_SKELETON:
  356. case TF_DMG_CUSTOM_SPELL_MIRV:
  357. case TF_DMG_CUSTOM_SPELL_METEOR:
  358. case TF_DMG_CUSTOM_SPELL_LIGHTNING:
  359. case TF_DMG_CUSTOM_SPELL_FIREBALL:
  360. case TF_DMG_CUSTOM_SPELL_MONOCULUS:
  361. case TF_DMG_CUSTOM_SPELL_BLASTJUMP:
  362. case TF_DMG_CUSTOM_SPELL_BATS:
  363. case TF_DMG_CUSTOM_SPELL_TINY:
  364. IncrementCount();
  365. break;
  366. default:
  367. break;
  368. }
  369. }
  370. }
  371. };
  372. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenHelltowerKillGrind, ACHIEVEMENT_TF_HALLOWEEN_HELLTOWER_KILL_GRIND, "TF_HALLOWEEN_HELLTOWER_KILL_GRIND", 5 );
  373. //----------------------------------------------------------------------------------------------------------------
  374. class CAchievementTFHalloweenHelltowerKillBrothers : public CBaseTFAchievementSimple
  375. {
  376. void Init()
  377. {
  378. SetFlags( ACH_SAVE_GLOBAL );
  379. SetGoal( 10 );
  380. SetStoreProgressInSteam( true );
  381. }
  382. // server awards this achievement, no other code within achievement necessary
  383. };
  384. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenHelltowerKillBrothers, ACHIEVEMENT_TF_HALLOWEEN_HELLTOWER_KILL_BROTHERS, "TF_HALLOWEEN_HELLTOWER_KILL_BROTHERS", 5 );
  385. //----------------------------------------------------------------------------------------------------------------
  386. class CAchievementTFHalloweenHelltowerMilestone : public CAchievement_AchievedCount
  387. {
  388. public:
  389. DECLARE_CLASS( CAchievementTFHalloweenHelltowerMilestone, CAchievement_AchievedCount );
  390. void Init()
  391. {
  392. BaseClass::Init();
  393. SetAchievementsRequired( 4, ACHIEVEMENT_TF_HALLOWEEN_HELLTOWER_RARE_SPELL, ACHIEVEMENT_TF_HALLOWEEN_HELLTOWER_KILL_BROTHERS );
  394. }
  395. };
  396. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenHelltowerMilestone, ACHIEVEMENT_TF_HALLOWEEN_HELLTOWER_MILESTONE, "TF_HALLOWEEN_HELLTOWER_MILESTONE", 5 );
  397. //----------------------------------------------------------------------------------------------------------------
  398. class CAchievementTFHalloweenHelltowerSkullIslandReward : public CBaseTFAchievementSimple
  399. {
  400. void Init()
  401. {
  402. SetFlags( ACH_SAVE_GLOBAL );
  403. SetGoal( 1 );
  404. }
  405. // server awards this achievement, no other code within achievement necessary
  406. };
  407. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenHelltowerSkullIslandReward, ACHIEVEMENT_TF_HALLOWEEN_HELLTOWER_SKULL_ISLAND_REWARD, "TF_HALLOWEEN_HELLTOWER_SKULL_ISLAND_REWARD", 5 );
  408. //----------------------------------------------------------------------------------------------------------------
  409. class CAchievementTFHalloweenDoomsdayKillKarts : public CBaseTFAchievementSimple
  410. {
  411. void Init()
  412. {
  413. SetFlags( ACH_SAVE_GLOBAL );
  414. SetGoal( 30 );
  415. SetStoreProgressInSteam( true );
  416. }
  417. // server awards this achievement, no other code within achievement necessary
  418. };
  419. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenDoomsdayKillKarts, ACHIEVEMENT_TF_HALLOWEEN_DOOMSDAY_KILL_KARTS, "TF_HALLOWEEN_DOOMSDAY_KILL_KARTS", 5 );
  420. //----------------------------------------------------------------------------------------------------------------
  421. class CAchievementTFHalloweenDoomsdayCollectDucks : public CBaseTFAchievementSimple
  422. {
  423. void Init()
  424. {
  425. SetFlags( ACH_SAVE_GLOBAL );
  426. SetGoal( 250 );
  427. SetStoreProgressInSteam( true );
  428. }
  429. // server awards this achievement, no other code within achievement necessary
  430. };
  431. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenDoomsdayCollectDucks, ACHIEVEMENT_TF_HALLOWEEN_DOOMSDAY_COLLECT_DUCKS, "TF_HALLOWEEN_DOOMSDAY_COLLECT_DUCKS", 5 );
  432. //----------------------------------------------------------------------------------------------------------------
  433. class CAchievementTFHalloweenDoomsdayScoreGoals : public CBaseTFAchievementSimple
  434. {
  435. void Init()
  436. {
  437. SetFlags( ACH_SAVE_GLOBAL );
  438. SetGoal( 3 );
  439. SetStoreProgressInSteam( true );
  440. }
  441. // server awards this achievement, no other code within achievement necessary
  442. };
  443. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenDoomsdayScoreGoals, ACHIEVEMENT_TF_HALLOWEEN_DOOMSDAY_SCORE_GOALS, "TF_HALLOWEEN_DOOMSDAY_SCORE_GOALS", 5 );
  444. //----------------------------------------------------------------------------------------------------------------
  445. class CAchievementTFHalloweenDoomsdayRespawnTeammates : public CBaseTFAchievementSimple
  446. {
  447. void Init()
  448. {
  449. SetFlags( ACH_SAVE_GLOBAL );
  450. SetGoal( 30 );
  451. SetStoreProgressInSteam( true );
  452. }
  453. // server awards this achievement, no other code within achievement necessary
  454. };
  455. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenDoomsdayRespawnTeammates, ACHIEVEMENT_TF_HALLOWEEN_DOOMSDAY_RESPAWN_TEAMMATES, "TF_HALLOWEEN_DOOMSDAY_RESPAWN_TEAMMATES", 5 );
  456. //----------------------------------------------------------------------------------------------------------------
  457. class CAchievementTFHalloweenDoomsdayTinySmasher : public CBaseTFAchievementSimple
  458. {
  459. void Init()
  460. {
  461. SetFlags( ACH_SAVE_GLOBAL );
  462. SetGoal( 15 );
  463. SetStoreProgressInSteam( true );
  464. }
  465. // server awards this achievement, no other code within achievement necessary
  466. };
  467. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenDoomsdayTinySmasher, ACHIEVEMENT_TF_HALLOWEEN_DOOMSDAY_TINY_SMASHER, "TF_HALLOWEEN_DOOMSDAY_TINY_SMASHER", 5 );
  468. //----------------------------------------------------------------------------------------------------------------
  469. class CAchievementTFHalloweenDoomsdayWinMinigames : public CBaseTFAchievementSimple
  470. {
  471. void Init()
  472. {
  473. SetFlags( ACH_SAVE_GLOBAL | ACH_HAS_COMPONENTS );
  474. SetGoal( 3 );
  475. SetMapNameFilter( "sd_doomsday_event" );
  476. }
  477. virtual void ListenForEvents()
  478. {
  479. ListenForGameEvent( "minigame_win" );
  480. }
  481. void FireGameEvent_Internal( IGameEvent *event )
  482. {
  483. if ( FStrEq( event->GetName(), "minigame_win" ) )
  484. {
  485. // Are we on the winning team?
  486. int iTeam = event->GetInt( "team" );
  487. if ( ( iTeam >= FIRST_GAME_TEAM ) && ( iTeam == GetLocalPlayerTeam() ) )
  488. {
  489. EnsureComponentBitSetAndEvaluate( event->GetInt( "type" ) );
  490. }
  491. }
  492. }
  493. };
  494. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenDoomsdayWinMinigames, ACHIEVEMENT_TF_HALLOWEEN_DOOMSDAY_WIN_MINIGAMES, "TF_HALLOWEEN_DOOMSDAY_WIN_MINIGAMES", 5 );
  495. //----------------------------------------------------------------------------------------------------------------
  496. class CAchievementTFHalloweenDoomsdayMilestone : public CAchievement_AchievedCount
  497. {
  498. public:
  499. DECLARE_CLASS( CAchievementTFHalloweenDoomsdayMilestone, CAchievement_AchievedCount );
  500. void Init()
  501. {
  502. BaseClass::Init();
  503. SetAchievementsRequired( 4, ACHIEVEMENT_TF_HALLOWEEN_DOOMSDAY_KILL_KARTS, ACHIEVEMENT_TF_HALLOWEEN_DOOMSDAY_WIN_MINIGAMES );
  504. }
  505. };
  506. DECLARE_ACHIEVEMENT( CAchievementTFHalloweenDoomsdayMilestone, ACHIEVEMENT_TF_HALLOWEEN_DOOMSDAY_MILESTONE, "TF_HALLOWEEN_DOOMSDAY_MILESTONE", 5 );
  507. #endif // CLIENT_DLL