1
0

Statistic Manager

This commit is contained in:
andrew
2014-05-11 14:57:06 +03:00
parent a38d8b6513
commit c7c3724a3e
16 changed files with 448 additions and 43 deletions

View File

@@ -16,6 +16,8 @@
#include "../Items/ItemHandler.h"
#include "../Vector3.h"
#include "../WorldStorage/StatSerializer.h"
#include "inifile/iniFile.h"
#include "json/json.h"
@@ -131,6 +133,15 @@ cPlayer::~cPlayer(void)
SaveToDisk();
#if 0
/* Save statistics. */
cStatSerializer StatSerializer(m_World->GetName(), m_PlayerName, &m_Stats);
if (!StatSerializer.Save())
{
LOGERROR("Could not save stats for player %s", m_PlayerName.c_str());
}
#endif
m_World->RemovePlayer( this );
m_ClientHandle = NULL;
@@ -871,9 +882,13 @@ void cPlayer::KilledBy(cEntity * a_Killer)
}
else if (a_Killer->IsPlayer())
{
GetWorld()->BroadcastChatDeath(Printf("%s was killed by %s", GetName().c_str(), ((cPlayer *)a_Killer)->GetName().c_str()));
cPlayer* Killer = (cPlayer*)a_Killer;
m_World->GetScoreBoard().AddPlayerScore(((cPlayer *)a_Killer)->GetName(), cObjective::otPlayerKillCount, 1);
GetWorld()->BroadcastChatDeath(Printf("%s was killed by %s", GetName().c_str(), Killer->GetName().c_str()));
Killer->GetStatManager().AddValue(statPlayerKills);
m_World->GetScoreBoard().AddPlayerScore(Killer->GetName(), cObjective::otPlayerKillCount, 1);
}
else
{
@@ -883,6 +898,8 @@ void cPlayer::KilledBy(cEntity * a_Killer)
GetWorld()->BroadcastChatDeath(Printf("%s was killed by a %s", GetName().c_str(), KillerClass.c_str()));
}
m_Stats.AddValue(statDeaths);
m_World->GetScoreBoard().AddPlayerScore(GetName(), cObjective::otDeathCount, 1);
}