Description: The timing of the distribution of the arena points does not work
Current behaviour: That's just the point, nothing happens!
Expected behaviour: Automatic charging at a specified time.
Steps to reproduce the problem:
Branch(es): Master
Operating system: Debian 8
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Test plz.
```diff
From d32c407c1c4d0fbb843935a5c59898829c173bee Mon Sep 17 00:00:00 2001
From: HeartWell heartwell@list.ru
Date: Sun, 30 Apr 2017 09:55:53 +0300
Subject: [PATCH] Core/Arena: Fix auto distribute points.
src/server/game/Battlegrounds/BattlegroundMgr.cpp | 29 ++++++++++++++++-------
src/server/game/Battlegrounds/BattlegroundMgr.h | 3 +++
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index b90a7fa..727bc26 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -52,7 +52,7 @@
/*******************/
BattlegroundMgr::BattlegroundMgr() : m_ArenaTesting(false), m_Testing(false),
- m_lastClientVisibleInstanceId(0), m_NextAutoDistributionTime(0), m_NextPeriodicQueueUpdateTime(5IN_MILLISECONDS), randomBgDifficultyEntry(999, 0, 80, 80, 0)
+ m_lastClientVisibleInstanceId(0), m_NextAutoDistributionTime(0), m_AutoDistributionTimeChecker(0), m_NextPeriodicQueueUpdateTime(5IN_MILLISECONDS), randomBgDifficultyEntry(999, 0, 80, 80, 0)
{
for (uint32 qtype = BATTLEGROUND_QUEUE_NONE; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
m_BattlegroundQueues[qtype].SetBgTypeIdAndArenaType(BGTemplateId(BattlegroundQueueTypeId(qtype)), BGArenaType(BattlegroundQueueTypeId(qtype)));
@@ -135,12 +135,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)
{
- sArenaTeamMgr->DistributeArenaPoints();
- m_NextAutoDistributionTime = sWorld->GetNextTimeWithDayAndHour(5, 18);
- sWorld->setWorldState(WS_ARENA_DISTRIBUTION_TIME, uint64(m_NextAutoDistributionTime));
+ if (time(NULL) > m_NextAutoDistributionTime)
+ {
+ sArenaTeamMgr->DistributeArenaPoints();
+ 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; // check 10 minutes
}
+ else
+ m_AutoDistributionTimeChecker -= diff;
}
}
@@ -696,9 +702,16 @@ void BattlegroundMgr::InitAutomaticArenaPointDistribution()
return;
time_t wstime = time_t(sWorld->getWorldState(WS_ARENA_DISTRIBUTION_TIME));
void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* player, BattlegroundTypeId bgTypeId, uint8 fromWhere)
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h
index 9338ac4..2934e06 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.h
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.h
@@ -29,6 +29,8 @@
typedef std::map
typedef std::unordered_map
+#define BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY 86400 // seconds in a day
+
struct CreateBattlegroundData
{
BattlegroundTypeId bgTypeId;
@@ -157,6 +159,7 @@ class BattlegroundMgr
uint32 m_lastClientVisibleInstanceId;
uint32 m_NextPeriodicQueueUpdateTime;
time_t m_NextAutoDistributionTime;
2.11.0.windows.1
Now need wait @ShinDarth and he will say " @HeartWell open PR plz" :D
I was really tempted when I first saw it, but then I thought just let it be
Who test my patch?
This can be closed. The fix is included, working and merged #927
@poszer thank you friend!
Most helpful comment
Now need wait @ShinDarth and he will say " @HeartWell open PR plz" :D