summaryrefslogtreecommitdiff
path: root/game/server/tf2/tf_stats.h
blob: c5e68e56172749b4326287f09a81a0ae66782d5f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: game stat gathering
//
// $NoKeywords: $
//=============================================================================//

#ifndef TF_STATS_H
#define TF_STATS_H

#ifdef _WIN32
#pragma once
#endif

#include "tf_shareddefs.h"

// NOTE: If you change these enums, change the string lists in tf_stats.cpp!
enum TFStatId_t
{
	TF_STAT_FERRY_CONTROL = 0,
	TF_STAT_RESOURCE_CHUNKS_SPAWNED,
	TF_STAT_RESOURCE_PROCESSED_CHUNKS_SPAWNED,
	TF_STAT_RESOURCE_CHUNKS_RETIRED,

	// NOTE: These should go last
	TF_STAT_FIRST_OBJECT_BUILT,
	TF_STAT_LAST_OBJECT_BUILT = TF_STAT_FIRST_OBJECT_BUILT + OBJ_LAST - 1,

	TF_STAT_COUNT,
};

enum TFTeamStatId_t
{
	// First TFCLASS_CLASS_COUNT entries are the # of players of each class.

	TF_TEAM_STAT_PLAYER_COUNT = TFCLASS_CLASS_COUNT,

	TF_TEAM_STAT_RESOURCES_COLLECTED,
	TF_TEAM_STAT_RESOURCES_HARVESTED,
	TF_TEAM_STAT_RESOURCE_CHUNKS_DROPPED,
	TF_TEAM_STAT_RESOURCE_CHUNKS_COLLECTED,

	TF_TEAM_STAT_KILL_COUNT,
	TF_TEAM_STAT_DESTROYED_OBJECT_COUNT,

	TF_TEAM_STAT_FERRY_CONTROL_TIME,

	TF_TEAM_STAT_COUNT,
};

enum TFPlayerStatId_t
{
	// Player count
	TF_PLAYER_STAT_PLAYER_COUNT = 0,
	TF_PLAYER_STAT_PLAYER_SECONDS,
	TF_PLAYER_STAT_EXISTING_SECONDS,
	TF_PLAYER_STAT_FIRST_AVERAGE_STAT,

	// Economy-based stats
	TF_PLAYER_STAT_RESOURCES_ACQUIRED = TF_PLAYER_STAT_FIRST_AVERAGE_STAT,
	TF_PLAYER_STAT_RESOURCES_ACQUIRED_FROM_CHUNKS,
	TF_PLAYER_STAT_RESOURCES_CARRIED,
 	TF_PLAYER_STAT_RESOURCES_SPENT,
	TF_PLAYER_STAT_CURRENT_OBJECT_VALUE,
	TF_PLAYER_STAT_OBJECT_COUNT,

	// Combat based stats
	TF_PLAYER_STAT_KILL_COUNT,
	TF_PLAYER_STAT_DESTROYED_OBJECT_COUNT,
	TF_PLAYER_STAT_HEALTH_GIVEN,

	// Animation-based stats
	TF_PLAYER_STAT_ANIMATION_IDLE,
	TF_PLAYER_STAT_ANIMATION_WALKING,
	TF_PLAYER_STAT_ANIMATION_RUNNING,
	TF_PLAYER_STAT_ANIMATION_CROUCHING,
	TF_PLAYER_STAT_ANIMATION_JUMPING,
	TF_PLAYER_STAT_ANIMATION_OTHER,

	TF_PLAYER_STAT_COUNT,
};


class ITFStats
{
public:
	// Clear out the stats + their history
	virtual void ResetStats() = 0;

	virtual void IncrementStat( TFStatId_t stat, int nIncrement ) = 0;
	virtual void SetStat( TFStatId_t stat, int nAmount ) = 0;

	virtual void IncrementTeamStat( int nTeam, TFTeamStatId_t stat, int nIncrement ) = 0;
	virtual void SetTeamStat( int nTeam, TFTeamStatId_t stat, int nAmount ) = 0;

	virtual void IncrementPlayerStat( CBaseEntity *pPlayer, TFPlayerStatId_t stat, int nIncrement ) = 0;
};


//-----------------------------------------------------------------------------
// Accessor method
//-----------------------------------------------------------------------------
ITFStats *TFStats();


#endif // TF_STATS_H