Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.
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.

83 lines
1.7 KiB

//++ BulliT
#if !defined(__AG_STATS__)
#define __AG_STATS__
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "agglobal.h"
class AgStats
{
protected:
class AgPlayerStats
{
public:
class AgWeaponStats
{
public:
AgWeaponStats()
{
m_iShots = 0;
m_iHits = 0;
}
int m_iShots;
int m_iHits;
};
AgPlayerStats()
{
m_iKills = 0;
m_iDeaths = 0;
m_iTeamKills = 0;
m_iDamageTaken = 0;
m_iDamageGiven = 0;
}
virtual ~AgPlayerStats()
{
for (AgWeaponStatsMap::iterator itrWeaponStats = m_mapWeaponStats.begin() ;itrWeaponStats != m_mapWeaponStats.end(); ++itrWeaponStats)
delete (*itrWeaponStats).second;
m_mapWeaponStats.clear();
}
int m_iKills; //Kills
int m_iDeaths; //Deaths
int m_iTeamKills; //Teamkills
int m_iDamageTaken; //Damage taken
int m_iDamageGiven; //Damage given
AgString m_sName;
typedef map<AgString, AgWeaponStats*, less<AgString> > AgWeaponStatsMap;
AgWeaponStatsMap m_mapWeaponStats;
AgWeaponStats* GetWeaponStats(const char* pszItem);
};
typedef map<AgString, AgPlayerStats*, less<AgString> > AgPlayerStatsMap;
AgPlayerStatsMap m_mapPlayerStats;
AgPlayerStats* GetStats(CBasePlayer* pPlayer);
void PrintStats(CBasePlayer* pPlayer, CBasePlayer* pStatsPlayer);
public:
AgStats();
virtual ~AgStats();
void Reset();
void FireShot(CBasePlayer* pPlayer, const char* pszItem);
void FireHit(CBasePlayer* pPlayer, int iDamage, entvars_t* pAttacker);
void PlayerKilled(CBasePlayer* pInflictor, CBasePlayer* pKilled);
bool HandleCommand(CBasePlayer* pPlayer);
void OnChangeLevel();
};
extern DLL_GLOBAL AgStats Stats;
#endif // !defined(__AG_STATS__)
//-- Martin Webrant