aboutsummaryrefslogtreecommitdiff
path: root/src/game/BattleGroundMgr.cpp
diff options
context:
space:
mode:
authormaximius <none@none>2009-09-30 03:29:08 -0700
committermaximius <none@none>2009-09-30 03:29:08 -0700
commitf0d592489162b8bf7740bbc3db038f81aa3af7e8 (patch)
tree45513c11bc5fb9378f499e14506b555cb9a224f6 /src/game/BattleGroundMgr.cpp
parent693251497a751821711262382442b54b91446231 (diff)
*Cleanup, add two new functions, attempt to fix arena point flushing for offline players.
--HG-- branch : trunk
Diffstat (limited to 'src/game/BattleGroundMgr.cpp')
-rw-r--r--src/game/BattleGroundMgr.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp
index a06b7f45f7b..ec67d2f5d54 100644
--- a/src/game/BattleGroundMgr.cpp
+++ b/src/game/BattleGroundMgr.cpp
@@ -1816,22 +1816,25 @@ void BattleGroundMgr::DistributeArenaPoints()
//at first update all points for all team members
for(ObjectMgr::ArenaTeamMap::iterator team_itr = objmgr.GetArenaTeamMapBegin(); team_itr != objmgr.GetArenaTeamMapEnd(); ++team_itr)
- {
if (ArenaTeam * at = team_itr->second)
- {
at->UpdateArenaPointsHelper(PlayerPoints);
- }
- }
//cycle that gives points to all players
for (std::map<uint32, uint32>::iterator plr_itr = PlayerPoints.begin(); plr_itr != PlayerPoints.end(); ++plr_itr)
{
- //update to database
- CharacterDatabase.PExecute("UPDATE characters SET arena_pending_points = '%u' WHERE guid = '%u'", plr_itr->second, plr_itr->first);
- //add points if player is online
+ //add points to player
Player* pl = objmgr.GetPlayer(plr_itr->first);
if (pl)
+ {
+ CharacterDatabase.PExecute("UPDATE characters SET arena_pending_points = '%u' WHERE guid = '%u'", plr_itr->second, plr_itr->first);
pl->ModifyArenaPoints(plr_itr->second);
+ }
+ else
+ {
+ CharacterDatabase.PExecute("UPDATE characters SET arena_pending_points = 0 WHERE guid = '%u'", plr_itr->first);
+ CharacterDatabase._UpdateDataBlobValue(plr_itr->first, PLAYER_FIELD_ARENA_CURRENCY,
+ std::max(std::min(int32(plr_itr->second),int32(sWorld.getConfig(CONFIG_MAX_ARENA_POINTS))),0));
+ }
}
PlayerPoints.clear();