mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
Core/Arena: fix auto distribute arena points and config option. (#927)
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
/*********************************************************/
|
||||
|
||||
BattlegroundMgr::BattlegroundMgr() : randomBgDifficultyEntry(999, 0, 80, 80, 0), m_ArenaTesting(false), m_Testing(false),
|
||||
m_lastClientVisibleInstanceId(0), m_NextAutoDistributionTime(0), m_NextPeriodicQueueUpdateTime(5*IN_MILLISECONDS)
|
||||
m_lastClientVisibleInstanceId(0), m_NextAutoDistributionTime(0), m_AutoDistributionTimeChecker(0), m_NextPeriodicQueueUpdateTime(5*IN_MILLISECONDS)
|
||||
{
|
||||
for (uint32 qtype = BATTLEGROUND_QUEUE_NONE; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
|
||||
m_BattlegroundQueues[qtype].SetBgTypeIdAndArenaType(BGTemplateId(BattlegroundQueueTypeId(qtype)), BGArenaType(BattlegroundQueueTypeId(qtype)));
|
||||
@@ -126,12 +126,18 @@ void BattlegroundMgr::Update(uint32 diff)
|
||||
// arena points auto-distribution
|
||||
if (sWorld->getBoolConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
|
||||
{
|
||||
if (sWorld->GetGameTime() > m_NextAutoDistributionTime)
|
||||
if (m_AutoDistributionTimeChecker < diff)
|
||||
{
|
||||
if (time(NULL) > m_NextAutoDistributionTime)
|
||||
{
|
||||
sArenaTeamMgr->DistributeArenaPoints();
|
||||
m_NextAutoDistributionTime = sWorld->GetNextTimeWithDayAndHour(5, 18);
|
||||
m_NextAutoDistributionTime = m_NextAutoDistributionTime + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld->getIntConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS);
|
||||
sWorld->setWorldState(WS_ARENA_DISTRIBUTION_TIME, uint64(m_NextAutoDistributionTime));
|
||||
}
|
||||
m_AutoDistributionTimeChecker = 600000; // 10 minutes check
|
||||
}
|
||||
else
|
||||
m_AutoDistributionTimeChecker -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -687,9 +693,16 @@ void BattlegroundMgr::InitAutomaticArenaPointDistribution()
|
||||
return;
|
||||
|
||||
time_t wstime = time_t(sWorld->getWorldState(WS_ARENA_DISTRIBUTION_TIME));
|
||||
m_NextAutoDistributionTime = wstime ? wstime : sWorld->GetNextTimeWithDayAndHour(5, 18);
|
||||
if (!wstime)
|
||||
sWorld->setWorldState(WS_ARENA_DISTRIBUTION_TIME, uint64(m_NextAutoDistributionTime));
|
||||
time_t curtime = time(NULL);
|
||||
sLog->outString("AzerothCore Battleground: Initializing Automatic Arena Point Distribution");
|
||||
if (wstime < curtime)
|
||||
{
|
||||
m_NextAutoDistributionTime = curtime; // reset will be called in the next update
|
||||
sLog->outString("AzerothCore Battleground: Battleground: Next arena point distribution time in the past, reseting it now.");
|
||||
}
|
||||
else
|
||||
m_NextAutoDistributionTime = wstime;
|
||||
sLog->outString("AzerothCore Battleground: Automatic Arena Point Distribution initialized.");
|
||||
}
|
||||
|
||||
void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere)
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
typedef std::map<uint32, Battleground*> BattlegroundContainer;
|
||||
typedef UNORDERED_MAP<uint32, BattlegroundTypeId> BattleMastersMap;
|
||||
|
||||
#define BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY 86400 // how many seconds in day
|
||||
|
||||
struct CreateBattlegroundData
|
||||
{
|
||||
BattlegroundTypeId bgTypeId;
|
||||
@@ -146,6 +148,7 @@ class BattlegroundMgr
|
||||
bool m_Testing;
|
||||
uint32 m_lastClientVisibleInstanceId;
|
||||
time_t m_NextAutoDistributionTime;
|
||||
uint32 m_AutoDistributionTimeChecker;
|
||||
uint32 m_NextPeriodicQueueUpdateTime;
|
||||
BattleMastersMap mBattleMastersMap;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user