Core/Arena: Players online but not in world will now gain their arena points as intended
This commit is contained in:
@@ -146,18 +146,20 @@ void ArenaTeamMgr::DistributeArenaPoints()
|
|||||||
if (ArenaTeam * at = teamItr->second)
|
if (ArenaTeam * at = teamItr->second)
|
||||||
at->UpdateArenaPointsHelper(PlayerPoints);
|
at->UpdateArenaPointsHelper(PlayerPoints);
|
||||||
|
|
||||||
|
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||||
|
|
||||||
// Cycle that gives points to all players
|
// Cycle that gives points to all players
|
||||||
for (std::map<uint32, uint32>::iterator playerItr = PlayerPoints.begin(); playerItr != PlayerPoints.end(); ++playerItr)
|
for (std::map<uint32, uint32>::iterator playerItr = PlayerPoints.begin(); playerItr != PlayerPoints.end(); ++playerItr)
|
||||||
{
|
{
|
||||||
// Update database
|
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET arenaPoints = arenaPoints + '%u' WHERE guid = '%u'", playerItr->second, playerItr->first);
|
|
||||||
|
|
||||||
// Add points to player if online
|
// Add points to player if online
|
||||||
Player* pl = ObjectAccessor::FindPlayer(playerItr->first);
|
if (Player* player = HashMapHolder<Player>::Find(playerItr->first))
|
||||||
if (pl)
|
player->ModifyArenaPoints(playerItr->second, &trans);
|
||||||
pl->ModifyArenaPoints(playerItr->second);
|
else // Update database
|
||||||
|
trans->PAppend("UPDATE characters SET arenaPoints=arenaPoints+%u WHERE guid=%u", playerItr->second, playerItr->first);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CharacterDatabase.CommitTransaction(trans);
|
||||||
|
|
||||||
PlayerPoints.clear();
|
PlayerPoints.clear();
|
||||||
|
|
||||||
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_END);
|
sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_END);
|
||||||
|
|||||||
Reference in New Issue
Block a user