mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[12150] Drop arena point distribution, implement currency week count reset.
- Fix missing currency load. - Some cleanup. Signed-off-by: Yaki Khadafi <elsoldollo@gmail.com>
This commit is contained in:
parent
7177f4cc07
commit
8e5d609e1e
21 changed files with 166 additions and 220 deletions
|
|
@ -1125,7 +1125,7 @@ void BGQueueRemoveEvent::Abort(uint64 /*e_time*/)
|
|||
/*** BATTLEGROUND MANAGER ***/
|
||||
/*********************************************************/
|
||||
|
||||
BattleGroundMgr::BattleGroundMgr() : m_AutoDistributionTimeChecker(0), m_ArenaTesting(false)
|
||||
BattleGroundMgr::BattleGroundMgr() : m_ArenaTesting(false)
|
||||
{
|
||||
for (uint8 i = BATTLEGROUND_TYPE_NONE; i < MAX_BATTLEGROUND_TYPE_ID; ++i)
|
||||
m_BattleGrounds[i].clear();
|
||||
|
|
@ -1198,21 +1198,6 @@ void BattleGroundMgr::Update(uint32 diff)
|
|||
else
|
||||
m_NextRatingDiscardUpdate -= diff;
|
||||
}
|
||||
if (sWorld.getConfig(CONFIG_BOOL_ARENA_AUTO_DISTRIBUTE_POINTS))
|
||||
{
|
||||
if (m_AutoDistributionTimeChecker < diff)
|
||||
{
|
||||
if (sWorld.GetGameTime() > m_NextAutoDistributionTime)
|
||||
{
|
||||
DistributeArenaPoints();
|
||||
m_NextAutoDistributionTime = time_t(m_NextAutoDistributionTime + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_UINT32_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS));
|
||||
CharacterDatabase.PExecute("UPDATE saved_variables SET NextArenaPointDistributionTime = '" UI64FMTD "'", uint64(m_NextAutoDistributionTime));
|
||||
}
|
||||
m_AutoDistributionTimeChecker = 600000; // check 10 minutes
|
||||
}
|
||||
else
|
||||
m_AutoDistributionTimeChecker -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundMgr::BuildBattleGroundStatusPacket(WorldPacket* data, BattleGround* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, ArenaType arenatype)
|
||||
|
|
@ -1718,76 +1703,6 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||
sLog.outString(">> Loaded %u battlegrounds", count);
|
||||
}
|
||||
|
||||
void BattleGroundMgr::InitAutomaticArenaPointDistribution()
|
||||
{
|
||||
if (sWorld.getConfig(CONFIG_BOOL_ARENA_AUTO_DISTRIBUTE_POINTS))
|
||||
{
|
||||
DEBUG_LOG("Initializing Automatic Arena Point Distribution");
|
||||
QueryResult* result = CharacterDatabase.Query("SELECT NextArenaPointDistributionTime FROM saved_variables");
|
||||
if (!result)
|
||||
{
|
||||
DEBUG_LOG("Battleground: Next arena point distribution time not found in SavedVariables, reseting it now.");
|
||||
m_NextAutoDistributionTime = time_t(sWorld.GetGameTime() + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld.getConfig(CONFIG_UINT32_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS));
|
||||
CharacterDatabase.PExecute("INSERT INTO saved_variables (NextArenaPointDistributionTime) VALUES ('" UI64FMTD "')", uint64(m_NextAutoDistributionTime));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_NextAutoDistributionTime = time_t((*result)[0].GetUInt64());
|
||||
delete result;
|
||||
}
|
||||
DEBUG_LOG("Automatic Arena Point Distribution initialized.");
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundMgr::DistributeArenaPoints()
|
||||
{
|
||||
// used to distribute arena points based on last week's stats
|
||||
sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_START);
|
||||
|
||||
sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_START);
|
||||
|
||||
// temporary structure for storing maximum points to add values for all players
|
||||
std::map<uint32, uint32> PlayerPoints;
|
||||
|
||||
// at first update all points for all team members
|
||||
for (ObjectMgr::ArenaTeamMap::iterator team_itr = sObjectMgr.GetArenaTeamMapBegin(); team_itr != sObjectMgr.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 arenaPoints = arenaPoints + '%u' WHERE guid = '%u'", plr_itr->second, plr_itr->first);
|
||||
// add points if player is online
|
||||
//if (Player* pl = sObjectMgr.GetPlayer(ObjectGuid(HIGHGUID_PLAYER, plr_itr->first)))
|
||||
// pl->ModifyArenaPoints(plr_itr->second);
|
||||
}
|
||||
|
||||
PlayerPoints.clear();
|
||||
|
||||
sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_ONLINE_END);
|
||||
|
||||
sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_START);
|
||||
for (ObjectMgr::ArenaTeamMap::iterator titr = sObjectMgr.GetArenaTeamMapBegin(); titr != sObjectMgr.GetArenaTeamMapEnd(); ++titr)
|
||||
{
|
||||
if (ArenaTeam* at = titr->second)
|
||||
{
|
||||
at->FinishWeek(); // set played this week etc values to 0 in memory, too
|
||||
at->SaveToDB(); // save changes
|
||||
at->NotifyStatsChanged(); // notify the players of the changes
|
||||
}
|
||||
}
|
||||
|
||||
sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_END);
|
||||
|
||||
sWorld.SendWorldText(LANG_DIST_ARENA_POINTS_END);
|
||||
}
|
||||
|
||||
void BattleGroundMgr::BuildBattleGroundListPacket(WorldPacket* data, ObjectGuid guid, Player* plr, BattleGroundTypeId bgTypeId, uint8 fromWhere)
|
||||
{
|
||||
if (!plr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue