1 ////////////////////////////////////////////////////////////////////////////////
2 //    Scorched3D (c) 2000-2011
3 //
4 //    This file is part of Scorched3D.
5 //
6 //    Scorched3D is free software; you can redistribute it and/or modify
7 //    it under the terms of the GNU General Public License as published by
8 //    the Free Software Foundation; either version 2 of the License, or
9 //    (at your option) any later version.
10 //
11 //    Scorched3D is distributed in the hope that it will be useful,
12 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //    GNU General Public License for more details.
15 //
16 //    You should have received a copy of the GNU General Public License along
17 //    with this program; if not, write to the Free Software Foundation, Inc.,
18 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ////////////////////////////////////////////////////////////////////////////////
20 
21 #if !defined(__INCLUDE_StatsLoggerFileh_INCLUDE__)
22 #define __INCLUDE_StatsLoggerFileh_INCLUDE__
23 
24 #include <common/FileLogger.h>
25 #include <common/StatsLogger.h>
26 
27 class StatsLoggerFile : public StatsLogger
28 {
29 public:
30 	StatsLoggerFile();
31 	virtual ~StatsLoggerFile();
32 
33 	virtual void gameStart(std::list<Tank *> &tanks);
34 	virtual void roundStart(std::list<Tank *> &tanks);
35 
36 	virtual int getKillCount(const char *uniqueId);
37 	virtual std::list<std::string> getAliases(const char *unqiueId);
38 	virtual std::list<std::string> getIpAliases(const char *unqiueId);
tankRank(Tank * tank)39 	virtual TankRank tankRank(Tank *tank) { return TankRank(tank->getPlayerId()); }
40 	virtual void updateStats(Tank *tank);
41 	virtual void periodicUpdate();
42 	virtual std::string allocateId();
43 	virtual unsigned int getStatsId(const char *uniqueId);
44 	virtual std::string getTopRanks();
45 	virtual std::string getPlayerInfo(const char *player);
46 	virtual void combinePlayers(unsigned int player1, unsigned int player2);
47 
48 	virtual void tankConnected(Tank *tank);
49 	virtual void tankDisconnected(Tank *tank);
50 	virtual void tankJoined(Tank *tank);
51 
52 	virtual void tankFired(Tank *firedTank, Weapon *weapon);
53 	virtual void tankResigned(Tank *resignedTank);
54 
55 	virtual void tankKilled(Tank *firedTank, Tank *deadTank, Weapon *weapon);
56 	virtual void tankTeamKilled(Tank *firedTank, Tank *deadTank, Weapon *weapon);
57 	virtual void tankSelfKilled(Tank *firedTank, Weapon *weapon);
58 
59 	virtual void tankWon(Tank *tank);
60 	virtual void tankOverallWinner(Tank *tank);
61 
62 	virtual void weaponFired(Weapon *weapon, bool deathAni);
63 	virtual void weaponKilled(Weapon *weapon, bool deathAni);
64 
65 protected:
66 	FileLogger *statsLogger_;
67 
68 	void createLogger();
69 
70 };
71 
72 #endif
73