summaryrefslogtreecommitdiff
path: root/game/client/dod/dod_playerstats.h
blob: 2fd70f618069e500ee0f77dc3cceef612393588d (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#ifndef DOD_PLAYERSTATS_H
#define DOD_PLAYERSTATS_H
#ifdef _WIN32
#pragma once
#endif

#include "steam/steam_api.h"
#include "GameEventListener.h"
#include "dod_shareddefs.h"
#include "weapon_dodbase.h"

typedef struct
{
	dod_stat_accumulator_t stats;
	int iWeaponID;
} weapon_stat_t;

class CDODPlayerStats : public CAutoGameSystem, public CGameEventListener
{
public:
	CDODPlayerStats();
	virtual void PostInit();
	virtual void LevelShutdownPreEntity();

	void UploadStats();

	void UpdateStats( int iPlayerClass, int iTeam, dod_stat_accumulator_t *playerStats, CUtlVector<weapon_stat_t> *vecWeaponStats );

	void MsgFunc_DODPlayerStatsUpdate( bf_read &msg );

private:
	void FireGameEvent( IGameEvent *event );

	void SetNextForceUploadTime();
	float m_flTimeNextForceUpload;

	// 6 x dod_stat_accumulator_t
	dod_stat_accumulator_t m_PlayerStats[2][NUM_DOD_PLAYERCLASSES];

	// num_weapons x dod_stat_accumulator_t
	dod_stat_accumulator_t m_WeaponStats[WEAPON_MAX];
};

extern CDODPlayerStats g_DODPlayerStats;

#endif //DOD_PLAYERSTATS_H