148{
150
151
152 CharacterDatabase.Execute(
"DELETE FROM arena_team_member WHERE arenaTeamId NOT IN (SELECT arenaTeamId FROM arena_team)");
153
154
155 QueryResult result =
CharacterDatabase.Query(
"SELECT arenaTeamId, name, captainGuid, type, backgroundColor, emblemStyle, emblemColor, borderStyle, borderColor, "
156
157 "rating, weekGames, weekWins, seasonGames, seasonWins, `rank` FROM arena_team ORDER BY arenaTeamId ASC");
158
159 if (!result)
160 {
161 LOG_WARN(
"server.loading",
">> Loaded 0 arena teams. DB table `arena_team` is empty!");
163 return;
164 }
165
167
168 "SELECT arenaTeamId, atm.guid, atm.weekGames, atm.weekWins, atm.seasonGames, atm.seasonWins, c.name, class, personalRating, matchMakerRating, maxMMR FROM arena_team_member atm"
169 " INNER JOIN arena_team ate USING (arenaTeamId)"
170 " LEFT JOIN characters AS c ON atm.guid = c.guid"
171 " LEFT JOIN character_arena_stats AS cas ON c.guid = cas.guid AND (cas.slot = 0 AND ate.type = 2 OR cas.slot = 1 AND ate.type = 3 OR cas.slot = 2 AND ate.type = 5)"
172 " ORDER BY atm.arenateamid ASC");
173
175 do
176 {
178
180 {
181 newArenaTeam->
Disband(
nullptr);
182 delete newArenaTeam;
183 continue;
184 }
185
187
188 ++count;
189 } while (result->NextRow());
190
193}
#define LOG_INFO(filterType__,...)
Definition: Log.h:165
#define LOG_WARN(filterType__,...)
Definition: Log.h:161
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:131
uint32 getMSTime()
Definition: Timer.h:103
std::uint32_t uint32
Definition: Define.h:107
std::shared_ptr< ResultSet > QueryResult
Definition: DatabaseEnvFwd.h:27
void Disband(WorldSession *session)
Definition: ArenaTeam.cpp:383
bool LoadArenaTeamFromDB(QueryResult arenaTeamDataResult)
Definition: ArenaTeam.cpp:196
bool LoadMembersFromDB(QueryResult arenaTeamMembersResult)
Definition: ArenaTeam.cpp:222
void AddArenaTeam(ArenaTeam *arenaTeam)
Definition: ArenaTeamMgr.cpp:118