[CORE] Imported PVP stats , special thanks to Mik & Shin

This commit is contained in:
Yehonal
2016-08-08 11:23:30 +02:00
parent 895558c85c
commit e358c0bb74
16 changed files with 138 additions and 1 deletions

View File

@@ -762,6 +762,27 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
else
SetWinner(TEAM_NEUTRAL);
PreparedStatement* stmt = NULL;
uint64 battlegroundId = 1;
if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE))
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PVPSTATS_MAXID);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
{
Field* fields = result->Fetch();
battlegroundId = fields[0].GetUInt64() + 1;
}
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PVPSTATS_BATTLEGROUND);
stmt->setUInt64(0, battlegroundId);
stmt->setUInt8(1, GetWinner());
stmt->setUInt8(2, GetUniqueBracketId());
stmt->setUInt8(3, GetBgTypeID());
CharacterDatabase.Execute(stmt);
}
//we must set it this way, because end time is sent in packet!
m_EndTime = TIME_TO_AUTOREMOVE;