aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Battlegrounds/BattlegroundMgr.cpp
diff options
context:
space:
mode:
authorjoschiwald <joschiwald.trinity@gmail.com>2014-02-10 00:14:29 +0100
committerjoschiwald <joschiwald.trinity@gmail.com>2014-02-10 00:14:29 +0100
commitb72273014f2f290f9524a3f9b1596528773da9fb (patch)
tree8d83446e20f95378fa21788bedfc0062dc1c95b3 /src/server/game/Battlegrounds/BattlegroundMgr.cpp
parenta5a6799b4e46456decbac09622f0bef0ac1976bb (diff)
Core/DB/Achievements:
- fixed arena season title achievements and rewards - added mailtemplate support for `achievement_reward` table - fixed typo in GetBattleMasterBG which causes achievement reward mail expire in 1 day Ref #8777
Diffstat (limited to 'src/server/game/Battlegrounds/BattlegroundMgr.cpp')
-rw-r--r--src/server/game/Battlegrounds/BattlegroundMgr.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index 9d7a67ee0dc..ab69c950ff4 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -1082,6 +1082,17 @@ void BattlegroundMgr::LoadBattleMastersEntry()
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
+ if (CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(entry))
+ {
+ if ((cInfo->npcflag & UNIT_NPC_FLAG_BATTLEMASTER) == 0)
+ TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) listed in `battlemaster_entry` is not a battlemaster.", entry);
+ }
+ else
+ {
+ TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) listed in `battlemaster_entry` does not exist.", entry);
+ continue;
+ }
+
uint32 bgTypeId = fields[1].GetUInt32();
if (!sBattlemasterListStore.LookupEntry(bgTypeId))
{
@@ -1093,9 +1104,24 @@ void BattlegroundMgr::LoadBattleMastersEntry()
}
while (result->NextRow());
+ CheckBattleMasters();
+
TC_LOG_INFO("server.loading", ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
+void BattlegroundMgr::CheckBattleMasters()
+{
+ CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
+ for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
+ {
+ if ((itr->second.npcflag & UNIT_NPC_FLAG_BATTLEMASTER) && mBattleMastersMap.find(itr->second.Entry) == mBattleMastersMap.end())
+ {
+ TC_LOG_ERROR("sql.sql", "CreatureTemplate (Entry: %u) has UNIT_NPC_FLAG_BATTLEMASTER but no data in `battlemaster_entry` table. Removing flag!", itr->second.Entry);
+ const_cast<CreatureTemplate*>(&itr->second)->npcflag &= ~UNIT_NPC_FLAG_BATTLEMASTER;
+ }
+ }
+}
+
HolidayIds BattlegroundMgr::BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId)
{
switch (bgTypeId)