Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Server/Arena: Drop ArenaTeam Loading.
Browse files Browse the repository at this point in the history
Signed-off-by: AriDEV <aridev666@gmail.com>
  • Loading branch information
AriDEV committed May 4, 2019
1 parent 62fe4ec commit d1e7b8f
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 68 deletions.
16 changes: 0 additions & 16 deletions src/server/game/Battlegrounds/ArenaTeam.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,6 @@ class ArenaTeam
ArenaTeam();
~ArenaTeam();

bool Create(uint64 captainGuid, uint8 type, std::string const& teamName,
uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor,
uint8 borderStyle, uint32 borderColor);
void Disband(WorldSession* session);
void Disband();

typedef std::list<ArenaTeamMember> MemberList;

uint32 GetId() const { return TeamId; }
Expand All @@ -135,11 +129,6 @@ class ArenaTeam
uint32 GetRating() const { return Stats.Rating; }
uint32 GetAverageMMR(Group* group) const;

void SetCaptain(uint64 guid);
bool SetName(std::string const& name);
bool AddMember(uint64 PlayerGuid);
void DelMember(uint64 guid, bool cleanDb);

size_t GetMembersSize() const { return Members.size(); }
bool Empty() const { return Members.empty(); }
MemberList::iterator m_membersBegin() { return Members.begin(); }
Expand All @@ -151,11 +140,6 @@ class ArenaTeam

bool IsFighting() const;

bool LoadArenaTeamFromDB(QueryResult arenaTeamDataResult);
bool LoadMembersFromDB(QueryResult arenaTeamMembersResult);
void LoadStatsFromDB(uint32 ArenaTeamId);
void SaveToDB();

void BroadcastPacket(WorldPacket* packet);
void BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3);
void NotifyStatsChanged();
Expand Down
46 changes: 0 additions & 46 deletions src/server/game/Battlegrounds/ArenaTeamMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,49 +90,3 @@ uint32 ArenaTeamMgr::GenerateArenaTeamId()
return NextArenaTeamId++;
}

void ArenaTeamMgr::LoadArenaTeams()
{
uint32 oldMSTime = getMSTime();

// Clean out the trash before loading anything
CharacterDatabase.Execute("DELETE FROM arena_team_member WHERE arenaTeamId NOT IN (SELECT arenaTeamId FROM arena_team)"); // One-time query

// 0 1 2 3 4 5 6 7 8
QueryResult result = CharacterDatabase.Query("SELECT arenaTeamId, name, captainGuid, type, backgroundColor, emblemStyle, emblemColor, borderStyle, borderColor, "
// 9 10 11 12 13 14
"rating, weekGames, weekWins, seasonGames, seasonWins, arena_rank FROM arena_team ORDER BY arenaTeamId ASC");

if (!result)
{
SF_LOG_INFO("server.loading", ">> Loaded 0 arena teams. DB table `arena_team` is empty!");
return;
}

QueryResult result2 = CharacterDatabase.Query(
// 0 1 2 3 4 5 6 7 8 9
"SELECT arenaTeamId, atm.guid, atm.weekGames, atm.weekWins, atm.seasonGames, atm.seasonWins, c.name, class, personalRating, matchMakerRating FROM arena_team_member atm"
" INNER JOIN arena_team ate USING (arenaTeamId)"
" LEFT JOIN characters AS c ON atm.guid = c.guid"
" 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)"
" ORDER BY atm.arenateamid ASC");

uint32 count = 0;
do
{
ArenaTeam* newArenaTeam = new ArenaTeam;

if (!newArenaTeam->LoadArenaTeamFromDB(result) || !newArenaTeam->LoadMembersFromDB(result2))
{
newArenaTeam->Disband(NULL);
delete newArenaTeam;
continue;
}

AddArenaTeam(newArenaTeam);

++count;
}
while (result->NextRow());

SF_LOG_INFO("server.loading", ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
1 change: 0 additions & 1 deletion src/server/game/Battlegrounds/ArenaTeamMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class ArenaTeamMgr
ArenaTeam* GetArenaTeamByName(std::string const& arenaTeamName) const;
ArenaTeam* GetArenaTeamByCaptain(uint64 guid) const;

void LoadArenaTeams();
void AddArenaTeam(ArenaTeam* arenaTeam);
void RemoveArenaTeam(uint32 Id);

Expand Down
2 changes: 2 additions & 0 deletions src/server/game/Battlegrounds/Battleground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -968,9 +968,11 @@ void Battleground::EndBattleground(uint32 winner)

if (isArena() && isRated() && winnerArenaTeam && loserArenaTeam && winnerArenaTeam != loserArenaTeam)
{
/*
// save the stat changes
winnerArenaTeam->SaveToDB();
loserArenaTeam->SaveToDB();
*/
// send updated arena team stats to players
// this way all arena team members will get notified, not only the ones who participated in this match
winnerArenaTeam->NotifyStatsChanged();
Expand Down
2 changes: 2 additions & 0 deletions src/server/game/Battlegrounds/BattlegroundQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
// if player leaves queue and he is invited to rated arena match, then he have to lose
if (group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount)
{
/*
if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(group->ArenaTeamId))
{
SF_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating);
Expand All @@ -371,6 +372,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount)
at->OfflineMemberLost(guid, group->OpponentsMatchmakerRating);
at->SaveToDB();
}
*/
}

// remove group queue info if needed
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7847,7 +7847,7 @@ void Player::ResetCurrencyWeekCap()
{
ArenaTeam* arenaTeam = sArenaTeamMgr->GetArenaTeamById(arenaTeamId);
arenaTeam->FinishWeek(); // set played this week etc values to 0 in memory, too
arenaTeam->SaveToDB(); // save changes
//arenaTeam->SaveToDB(); // save changes
arenaTeam->NotifyStatsChanged(); // notify the players of the changes
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/server/game/Handlers/BattleGroundHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,13 +567,14 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recvData)
// if player leaves rated arena match before match start, it is counted as he played but he lost
if (ginfo.IsRated && ginfo.IsInvitedToBGInstanceGUID)
{
/*
ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(ginfo.Team);
if (at)
{
SF_LOG_DEBUG("bg.battleground", "UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), ginfo.OpponentsTeamRating);
at->MemberLost(_player, ginfo.OpponentsMatchmakerRating);
at->SaveToDB();
}
}*/
}
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, _player, queueSlot, STATUS_NONE, _player->GetBattlegroundQueueJoinTime(bgTypeId), 0, 0);
SendPacket(&data);
Expand Down
3 changes: 0 additions & 3 deletions src/server/game/World/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1725,9 +1725,6 @@ void World::SetInitialWorldSettings()

sGuildFinderMgr->LoadFromDB();

SF_LOG_INFO("server.loading", "Loading ArenaTeams...");
sArenaTeamMgr->LoadArenaTeams();

SF_LOG_INFO("server.loading", "Loading Groups...");
sGroupMgr->LoadGroups();

Expand Down

0 comments on commit d1e7b8f

Please sign in to comment.