refactor(Core): code cleanup (part 1) (#6361)

This commit is contained in:
Francesco Borzì
2021-06-16 12:58:14 +02:00
committed by GitHub
parent 7dd97ae679
commit 7d9fe22e28
13 changed files with 98 additions and 97 deletions

View File

@@ -27,7 +27,6 @@
#include "Player.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
#include "SpellAuraEffects.h"
#include "SpellAuras.h"
#include "Transport.h"
#include "Util.h"
@@ -823,36 +822,36 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
uint32 currOnline = (uint32)(sWorld->GetActiveSessionCount());
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT);
stmt->setUInt32(0, fightId);
stmt->setUInt8(1, m_ArenaType);
stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime() - startDelay) / 1000));
stmt->setUInt32(3, winnerArenaTeam->GetId());
stmt->setUInt32(4, loserArenaTeam->GetId());
stmt->setUInt16(5, (uint16)winnerTeamRating);
stmt->setUInt16(6, (uint16)winnerMatchmakerRating);
stmt->setInt16(7, (int16)winnerChange);
stmt->setUInt16(8, (uint16)loserTeamRating);
stmt->setUInt16(9, (uint16)loserMatchmakerRating);
stmt->setInt16(10, (int16)loserChange);
stmt->setUInt32(11, currOnline);
trans->Append(stmt);
PreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT);
stmt2->setUInt32(0, fightId);
stmt2->setUInt8(1, m_ArenaType);
stmt2->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime() - startDelay) / 1000));
stmt2->setUInt32(3, winnerArenaTeam->GetId());
stmt2->setUInt32(4, loserArenaTeam->GetId());
stmt2->setUInt16(5, (uint16)winnerTeamRating);
stmt2->setUInt16(6, (uint16)winnerMatchmakerRating);
stmt2->setInt16(7, (int16)winnerChange);
stmt2->setUInt16(8, (uint16)loserTeamRating);
stmt2->setUInt16(9, (uint16)loserMatchmakerRating);
stmt2->setInt16(10, (int16)loserChange);
stmt2->setUInt32(11, currOnline);
trans->Append(stmt2);
uint8 memberId = 0;
for (Battleground::ArenaLogEntryDataMap::const_iterator itr = ArenaLogEntries.begin(); itr != ArenaLogEntries.end(); ++itr)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS);
stmt->setUInt32(0, fightId);
stmt->setUInt8(1, ++memberId);
stmt->setString(2, itr->second.Name);
stmt->setUInt32(3, itr->second.Guid);
stmt->setUInt32(4, itr->second.ArenaTeamId);
stmt->setUInt32(5, itr->second.Acc);
stmt->setString(6, itr->second.IP);
stmt->setUInt32(7, itr->second.DamageDone);
stmt->setUInt32(8, itr->second.HealingDone);
stmt->setUInt32(9, itr->second.KillingBlows);
trans->Append(stmt);
stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS);
stmt2->setUInt32(0, fightId);
stmt2->setUInt8(1, ++memberId);
stmt2->setString(2, itr->second.Name);
stmt2->setUInt32(3, itr->second.Guid);
stmt2->setUInt32(4, itr->second.ArenaTeamId);
stmt2->setUInt32(5, itr->second.Acc);
stmt2->setString(6, itr->second.IP);
stmt2->setUInt32(7, itr->second.DamageDone);
stmt2->setUInt32(8, itr->second.HealingDone);
stmt2->setUInt32(9, itr->second.KillingBlows);
trans->Append(stmt2);
}
CharacterDatabase.CommitTransaction(trans);
@@ -882,36 +881,36 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
uint32 currOnline = (uint32)(sWorld->GetActiveSessionCount());
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT);
stmt->setUInt32(0, fightId);
stmt->setUInt8(1, m_ArenaType);
stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime() - startDelay) / 1000));
stmt->setUInt32(3, winnerArenaTeam->GetId());
stmt->setUInt32(4, loserArenaTeam->GetId());
stmt->setUInt16(5, (uint16)winnerTeamRating);
stmt->setUInt16(6, (uint16)winnerMatchmakerRating);
stmt->setInt16(7, (int16)winnerChange);
stmt->setUInt16(8, (uint16)loserTeamRating);
stmt->setUInt16(9, (uint16)loserMatchmakerRating);
stmt->setInt16(10, (int16)loserChange);
stmt->setUInt32(11, currOnline);
trans->Append(stmt);
PreparedStatement* stmt3 = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT);
stmt3->setUInt32(0, fightId);
stmt3->setUInt8(1, m_ArenaType);
stmt3->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime() - startDelay) / 1000));
stmt3->setUInt32(3, winnerArenaTeam->GetId());
stmt3->setUInt32(4, loserArenaTeam->GetId());
stmt3->setUInt16(5, (uint16)winnerTeamRating);
stmt3->setUInt16(6, (uint16)winnerMatchmakerRating);
stmt3->setInt16(7, (int16)winnerChange);
stmt3->setUInt16(8, (uint16)loserTeamRating);
stmt3->setUInt16(9, (uint16)loserMatchmakerRating);
stmt3->setInt16(10, (int16)loserChange);
stmt3->setUInt32(11, currOnline);
trans->Append(stmt3);
uint8 memberId = 0;
for (Battleground::ArenaLogEntryDataMap::const_iterator itr = ArenaLogEntries.begin(); itr != ArenaLogEntries.end(); ++itr)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS);
stmt->setUInt32(0, fightId);
stmt->setUInt8(1, ++memberId);
stmt->setString(2, itr->second.Name);
stmt->setUInt32(3, itr->second.Guid);
stmt->setUInt32(4, itr->second.ArenaTeamId);
stmt->setUInt32(5, itr->second.Acc);
stmt->setString(6, itr->second.IP);
stmt->setUInt32(7, itr->second.DamageDone);
stmt->setUInt32(8, itr->second.HealingDone);
stmt->setUInt32(9, itr->second.KillingBlows);
trans->Append(stmt);
stmt3 = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS);
stmt3->setUInt32(0, fightId);
stmt3->setUInt8(1, ++memberId);
stmt3->setString(2, itr->second.Name);
stmt3->setUInt32(3, itr->second.Guid);
stmt3->setUInt32(4, itr->second.ArenaTeamId);
stmt3->setUInt32(5, itr->second.Acc);
stmt3->setString(6, itr->second.IP);
stmt3->setUInt32(7, itr->second.DamageDone);
stmt3->setUInt32(8, itr->second.HealingDone);
stmt3->setUInt32(9, itr->second.KillingBlows);
trans->Append(stmt3);
}
CharacterDatabase.CommitTransaction(trans);