aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorFaq <ainarsh@gmail.com>2012-08-21 10:58:15 +0300
committerFaq <ainarsh@gmail.com>2012-08-21 10:58:15 +0300
commit291b0899c503bc7bf7d8463a984fd8b638867eda (patch)
tree7a76f1ec88a89adf5d79bf8e1ba670baa8d56745 /src/server/game
parentc400923a1a96e458ca8b33b6979abc6b344cb41f (diff)
parent542521a026031764ddd98518e7f5bdab91bc0ebb (diff)
Merge remote-tracking branch 'upstream/master' into SpellMasks_0
Diffstat (limited to 'src/server/game')
-rwxr-xr-xsrc/server/game/AI/EventAI/CreatureEventAIMgr.cpp12
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp8
-rwxr-xr-xsrc/server/game/Achievements/AchievementMgr.cpp36
-rwxr-xr-xsrc/server/game/Addons/AddonMgr.cpp4
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp12
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp1110
-rw-r--r--src/server/game/Battlefield/Battlefield.h431
-rw-r--r--src/server/game/Battlefield/BattlefieldHandler.cpp150
-rw-r--r--src/server/game/Battlefield/BattlefieldMgr.cpp140
-rw-r--r--src/server/game/Battlefield/BattlefieldMgr.h79
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.cpp1097
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.h1761
-rwxr-xr-xsrc/server/game/Battlegrounds/ArenaTeam.cpp20
-rw-r--r--src/server/game/Battlegrounds/ArenaTeamMgr.cpp6
-rwxr-xr-xsrc/server/game/Battlegrounds/Battleground.cpp8
-rwxr-xr-xsrc/server/game/Battlegrounds/BattlegroundMgr.cpp12
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundIC.cpp3
-rwxr-xr-xsrc/server/game/Battlegrounds/Zones/BattlegroundWS.cpp54
-rw-r--r--src/server/game/CMakeLists.txt4
-rwxr-xr-xsrc/server/game/Conditions/ConditionMgr.cpp2
-rwxr-xr-xsrc/server/game/Conditions/DisableMgr.cpp8
-rwxr-xr-xsrc/server/game/DataStores/DBCStores.cpp2
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.cpp10
-rwxr-xr-xsrc/server/game/Entities/Creature/CreatureGroups.cpp6
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp21
-rwxr-xr-xsrc/server/game/Entities/Item/ItemEnchantmentMgr.cpp6
-rwxr-xr-xsrc/server/game/Entities/Object/Object.cpp9
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp150
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h9
-rwxr-xr-xsrc/server/game/Entities/Transport/Transport.cpp14
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp7
-rwxr-xr-xsrc/server/game/Events/GameEventMgr.cpp115
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.cpp327
-rwxr-xr-xsrc/server/game/Globals/ObjectMgr.h8
-rwxr-xr-xsrc/server/game/Groups/Group.cpp12
-rwxr-xr-xsrc/server/game/Groups/Group.h5
-rw-r--r--src/server/game/Groups/GroupMgr.cpp22
-rw-r--r--src/server/game/Guilds/GuildMgr.cpp65
-rwxr-xr-xsrc/server/game/Handlers/BattleGroundHandler.cpp9
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp31
-rwxr-xr-xsrc/server/game/Handlers/MiscHandler.cpp8
-rwxr-xr-xsrc/server/game/Handlers/QuestHandler.cpp4
-rwxr-xr-xsrc/server/game/Instances/InstanceSaveMgr.cpp2
-rwxr-xr-xsrc/server/game/Loot/LootMgr.cpp69
-rwxr-xr-xsrc/server/game/Maps/Map.h6
-rwxr-xr-xsrc/server/game/Miscellaneous/Language.h5
-rwxr-xr-xsrc/server/game/Movement/Waypoints/WaypointManager.cpp2
-rwxr-xr-xsrc/server/game/OutdoorPvP/OutdoorPvPMgr.cpp6
-rwxr-xr-xsrc/server/game/Pools/PoolMgr.cpp32
-rwxr-xr-xsrc/server/game/Scripting/ScriptLoader.cpp2
-rwxr-xr-xsrc/server/game/Scripting/ScriptMgr.cpp21
-rwxr-xr-xsrc/server/game/Scripting/ScriptMgr.h2
-rwxr-xr-xsrc/server/game/Scripting/ScriptSystem.cpp28
-rw-r--r--src/server/game/Server/Protocol/PacketLog.cpp62
-rw-r--r--src/server/game/Server/Protocol/PacketLog.h50
-rwxr-xr-xsrc/server/game/Server/WorldSession.cpp2
-rwxr-xr-xsrc/server/game/Server/WorldSession.h22
-rwxr-xr-xsrc/server/game/Server/WorldSocket.cpp54
-rwxr-xr-xsrc/server/game/Skills/SkillDiscovery.cpp2
-rwxr-xr-xsrc/server/game/Skills/SkillExtraItems.cpp2
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp6
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp7
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp23
-rw-r--r--src/server/game/Spells/SpellInfo.cpp7
-rwxr-xr-xsrc/server/game/Spells/SpellMgr.cpp145
-rwxr-xr-xsrc/server/game/Texts/CreatureTextMgr.cpp6
-rwxr-xr-xsrc/server/game/Tickets/TicketMgr.cpp6
-rw-r--r--src/server/game/Tools/CharacterDatabaseCleaner.cpp2
-rwxr-xr-xsrc/server/game/Weather/WeatherMgr.cpp2
-rwxr-xr-xsrc/server/game/World/World.cpp453
-rwxr-xr-xsrc/server/game/World/World.h7
71 files changed, 5793 insertions, 1037 deletions
diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
index 7289a4eed28..728b17b0bbf 100755
--- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
+++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp
@@ -43,7 +43,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional CreatureEventAI Texts data. DB table `creature_ai_texts` is empty.");
return;
}
@@ -98,7 +98,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional CreatureEventAI Texts data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -114,7 +114,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 CreatureEventAI Summon definitions. DB table `creature_ai_summons` is empty.");
return;
}
@@ -146,7 +146,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Summons()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u CreatureEventAI summon definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -167,7 +167,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 CreatureEventAI scripts. DB table `creature_ai_scripts` is empty.");
return;
}
@@ -738,6 +738,6 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u CreatureEventAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index 7a997609b5d..3b69408354e 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -50,7 +50,7 @@ void SmartWaypointMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 SmartAI Waypoint Paths. DB table `waypoints` is empty.");
return;
}
@@ -88,7 +88,7 @@ void SmartWaypointMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SmartAI waypoint paths (total %u waypoints) in %u ms", count, total, GetMSTimeDiffToNow(oldMSTime));
}
@@ -117,7 +117,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 SmartAI scripts. DB table `smartai_scripts` is empty.");
return;
}
@@ -234,7 +234,7 @@ void SmartAIMgr::LoadSmartAIFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SmartAI scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index 191d91b61a7..c607132dfe1 100755
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -2201,8 +2201,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
if (sAchievementCriteriaStore.GetNumRows() == 0)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 achievement criteria.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement criteria.");
return;
}
@@ -2219,8 +2218,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
m_AchievementCriteriasByTimedType[criteria->timedType].push_back(criteria);
}
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement criteria in %u ms", (unsigned long)m_AchievementCriteriasByType->size(), GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadAchievementReferenceList()
@@ -2229,8 +2227,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
if (sAchievementStore.GetNumRows() == 0)
{
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 achievement references.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement references.");
return;
}
@@ -2250,8 +2247,7 @@ void AchievementGlobalMgr::LoadAchievementReferenceList()
if (AchievementEntry const* achievement = sAchievementStore.LookupEntry(4539))
const_cast<AchievementEntry*>(achievement)->mapID = 631; // Correct map requirement (currently has Ulduar)
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement references in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadAchievementCriteriaData()
@@ -2264,8 +2260,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
if (!result)
{
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional achievement criteria data. DB table `achievement_criteria_data` is empty.");
return;
}
@@ -2396,8 +2391,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData()
sLog->outError(LOG_FILTER_SQL, "Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement);
}
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional achievement criteria data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadCompletedAchievements()
@@ -2408,8 +2402,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
if (!result)
{
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 completed achievements. DB table `character_achievement` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 completed achievements. DB table `character_achievement` is empty.");
return;
}
@@ -2436,8 +2429,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements()
m_allCompletedAchievements.insert(achievementId);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu completed achievements in %u ms", (unsigned long)m_allCompletedAchievements.size(), GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadRewards()
@@ -2451,8 +2443,7 @@ void AchievementGlobalMgr::LoadRewards()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement rewards. DB table `achievement_reward` is empty.");
return;
}
@@ -2543,8 +2534,7 @@ void AchievementGlobalMgr::LoadRewards()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u achievement rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void AchievementGlobalMgr::LoadRewardLocales()
@@ -2559,8 +2549,7 @@ void AchievementGlobalMgr::LoadRewardLocales()
if (!result)
{
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty");
return;
}
@@ -2586,6 +2575,5 @@ void AchievementGlobalMgr::LoadRewardLocales()
}
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_ACHIEVEMENTSYS, ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp
index 6af87827917..a0789040e9a 100755
--- a/src/server/game/Addons/AddonMgr.cpp
+++ b/src/server/game/Addons/AddonMgr.cpp
@@ -43,7 +43,7 @@ void LoadFromDB()
QueryResult result = CharacterDatabase.Query("SELECT name, crc FROM addons");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 known addons. DB table `addons` is empty!");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 known addons. DB table `addons` is empty!");
return;
}
@@ -63,7 +63,7 @@ void LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index ab08262a928..84b5513b659 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -263,7 +263,7 @@ void AuctionHouseMgr::LoadAuctionItems()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!");
return;
}
@@ -296,7 +296,7 @@ void AuctionHouseMgr::LoadAuctionItems()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -309,7 +309,7 @@ void AuctionHouseMgr::LoadAuctions()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 auctions. DB table `auctionhouse` is empty.");
return;
}
@@ -335,7 +335,7 @@ void AuctionHouseMgr::LoadAuctions()
CharacterDatabase.CommitTransaction(trans);
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u auctions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -734,7 +734,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup()
if (!expAuctions)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> No expired auctions to delete");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> No expired auctions to delete");
return;
}
@@ -782,7 +782,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup()
} while (expAuctions->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
new file mode 100644
index 00000000000..cdb8e1999fe
--- /dev/null
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -0,0 +1,1110 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "Map.h"
+#include "MapManager.h"
+#include "Group.h"
+#include "WorldPacket.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "GridNotifiers.h"
+#include "GridNotifiersImpl.h"
+#include "CellImpl.h"
+#include "CreatureTextMgr.h"
+#include "GroupMgr.h"
+
+Battlefield::Battlefield()
+{
+ m_Timer = 0;
+ m_IsEnabled = true;
+ m_isActive = false;
+ m_DefenderTeam = TEAM_NEUTRAL;
+
+ m_TypeId = 0;
+ m_BattleId = 0;
+ m_ZoneId = 0;
+ m_MapId = 0;
+ m_MaxPlayer = 0;
+ m_MinPlayer = 0;
+ m_BattleTime = 0;
+ m_NoWarBattleTime = 0;
+ m_TimeForAcceptInvite = 20;
+ m_uiKickDontAcceptTimer = 1000;
+
+ m_uiKickAfkPlayersTimer = 1000;
+
+ m_LastResurectTimer = 30 * IN_MILLISECONDS;
+ m_StartGroupingTimer = 0;
+ m_StartGrouping = false;
+ StalkerGuid = 0;
+}
+
+Battlefield::~Battlefield()
+{
+}
+
+// Called when a player enters the zone
+void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
+{
+ // If battle is started,
+ // If not full of players > invite player to join the war
+ // If full of players > announce to player that BF is full and kick him after a few second if he desn't leave
+ if (IsWarTime())
+ {
+ if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) // Vacant spaces
+ InvitePlayerToWar(player);
+ else // No more vacant places
+ {
+ // TODO: Send a packet to announce it to player
+ m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
+ InvitePlayerToQueue(player);
+ }
+ }
+ else
+ {
+ // If time left is < 15 minutes invite player to join queue
+ if (m_Timer <= m_StartGroupingTimer)
+ InvitePlayerToQueue(player);
+ }
+
+ // Add player in the list of player in zone
+ m_players[player->GetTeamId()].insert(player->GetGUID());
+ OnPlayerEnterZone(player);
+}
+
+// Called when a player leave the zone
+void Battlefield::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
+{
+ if (IsWarTime())
+ {
+ // If the player is participating to the battle
+ if (m_PlayersInWar[player->GetTeamId()].find(player->GetGUID()) != m_PlayersInWar[player->GetTeamId()].end())
+ {
+ m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID());
+ player->GetSession()->SendBfLeaveMessage(m_BattleId);
+ if (Group* group = player->GetGroup()) // Remove the player from the raid group
+ group->RemoveMember(player->GetGUID());
+
+ OnPlayerLeaveWar(player);
+ }
+ }
+
+ for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
+ itr->second->HandlePlayerLeave(player);
+
+ m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());
+ m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID());
+ m_players[player->GetTeamId()].erase(player->GetGUID());
+ SendRemoveWorldStates(player);
+ RemovePlayerFromResurrectQueue(player->GetGUID());
+ OnPlayerLeaveZone(player);
+}
+
+bool Battlefield::Update(uint32 diff)
+{
+ if (m_Timer <= diff)
+ {
+ // Battlefield ends on time
+ if (IsWarTime())
+ EndBattle(true);
+ else // Time to start a new battle!
+ StartBattle();
+ }
+ else
+ m_Timer -= diff;
+
+ // Invite players a few minutes before the battle's beginning
+ if (!m_StartGrouping && m_Timer <= m_StartGroupingTimer)
+ {
+ m_StartGrouping = true;
+ InvitePlayersInZoneToQueue();
+ OnStartGrouping();
+ }
+
+ bool objective_changed = false;
+ if (IsWarTime())
+ {
+ if (m_uiKickAfkPlayersTimer <= diff)
+ {
+ m_uiKickAfkPlayersTimer = 1000;
+ KickAfkPlayers();
+ }
+ else
+ m_uiKickAfkPlayersTimer -= diff;
+
+ // Kick players who chose not to accept invitation to the battle
+ if (m_uiKickDontAcceptTimer <= diff)
+ {
+ for (int team = 0; team < 2; team++)
+ for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); itr++)
+ if ((*itr).second <= time(NULL))
+ KickPlayerFromBattlefield((*itr).first);
+
+ InvitePlayersInZoneToWar();
+ for (int team = 0; team < 2; team++)
+ for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); itr++)
+ if ((*itr).second <= time(NULL))
+ KickPlayerFromBattlefield((*itr).first);
+
+ m_uiKickDontAcceptTimer = 1000;
+ }
+ else
+ m_uiKickDontAcceptTimer -= diff;
+
+ for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr)
+ if (itr->second->Update(diff))
+ objective_changed = true;
+ }
+
+
+ if (m_LastResurectTimer <= diff)
+ {
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ if (GetGraveyardById(i))
+ m_GraveyardList[i]->Resurrect();
+ m_LastResurectTimer = RESURRECTION_INTERVAL;
+ }
+ else
+ m_LastResurectTimer -= diff;
+
+ return objective_changed;
+}
+
+void Battlefield::InvitePlayersInZoneToQueue()
+{
+ for (uint8 team = 0; team < 2; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ InvitePlayerToQueue(player);
+}
+
+void Battlefield::InvitePlayerToQueue(Player* player)
+{
+ if (m_PlayersInQueue[player->GetTeamId()].count(player->GetGUID()))
+ return;
+
+ if (m_PlayersInQueue[player->GetTeamId()].size() <= m_MinPlayer || m_PlayersInQueue[GetOtherTeam(player->GetTeamId())].size() >= m_MinPlayer)
+ player->GetSession()->SendBfInvitePlayerToQueue(m_BattleId);
+}
+
+void Battlefield::InvitePlayersInQueueToWar()
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer)
+ InvitePlayerToWar(player);
+ else
+ {
+ //Full
+ }
+ }
+ }
+ m_PlayersInQueue[team].clear();
+ }
+}
+
+void Battlefield::InvitePlayersInZoneToWar()
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID()))
+ continue;
+ if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer)
+ InvitePlayerToWar(player);
+ else // Battlefield is full of players
+ m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
+ }
+ }
+}
+
+void Battlefield::InvitePlayerToWar(Player* player)
+{
+ if (!player)
+ return;
+
+ // TODO : needed ?
+ if (player->isInFlight())
+ return;
+
+ if (player->InArena() || player->GetBattleground())
+ {
+ m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID());
+ return;
+ }
+
+ // If the player does not match minimal level requirements for the battlefield, kick him
+ if (player->getLevel() < m_MinLevel)
+ {
+ if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0)
+ m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
+ return;
+ }
+
+ // Check if player is not already in war
+ if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID()))
+ return;
+
+ m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID());
+ m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = time(NULL) + m_TimeForAcceptInvite;
+ player->GetSession()->SendBfInvitePlayerToWar(m_BattleId, m_ZoneId, m_TimeForAcceptInvite);
+}
+
+void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o)
+{
+ if (Creature* creature = SpawnCreature(entry, x, y, z, o, TEAM_NEUTRAL))
+ StalkerGuid = creature->GetGUID();
+ else
+ sLog->outError(LOG_FILTER_GENERAL, "Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry);
+}
+
+void Battlefield::KickAfkPlayers()
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ if (player->isAFK())
+ KickPlayerFromBattlefield(*itr);
+}
+
+void Battlefield::KickPlayerFromBattlefield(uint64 guid)
+{
+ if (Player* player = sObjectAccessor->FindPlayer(guid))
+ if (player->GetZoneId() == GetZoneId())
+ player->TeleportTo(KickPosition);
+}
+
+void Battlefield::StartBattle()
+{
+ if (m_isActive)
+ return;
+
+ for (int team = 0; team < BG_TEAMS_COUNT; team++)
+ {
+ m_PlayersInWar[team].clear();
+ m_Groups[team].clear();
+ }
+
+ m_Timer = m_BattleTime;
+ m_isActive = true;
+
+ InvitePlayersInZoneToWar();
+ InvitePlayersInQueueToWar();
+
+ DoPlaySoundToAll(BF_START);
+
+ OnBattleStart();
+}
+
+void Battlefield::EndBattle(bool endByTimer)
+{
+ if (!m_isActive)
+ return;
+
+ m_isActive = false;
+
+ m_StartGrouping = false;
+
+ if (!endByTimer)
+ SetDefenderTeam(GetAttackerTeam());
+
+ if (GetDefenderTeam() == TEAM_ALLIANCE)
+ DoPlaySoundToAll(BF_ALLIANCE_WINS);
+ else
+ DoPlaySoundToAll(BF_HORDE_WINS);
+
+ OnBattleEnd(endByTimer);
+
+ // Reset battlefield timer
+ m_Timer = m_NoWarBattleTime;
+ SendInitWorldStatesToAll();
+}
+
+void Battlefield::DoPlaySoundToAll(uint32 SoundID)
+{
+ WorldPacket data;
+ data.Initialize(SMSG_PLAY_SOUND, 4);
+ data << uint32(SoundID);
+
+ for (int team = 0; team < BG_TEAMS_COUNT; team++)
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+bool Battlefield::HasPlayer(Player* player) const
+{
+ return m_players[player->GetTeamId()].find(player->GetGUID()) != m_players[player->GetTeamId()].end();
+}
+
+// Called in WorldSession::HandleBfQueueInviteResponse
+void Battlefield::PlayerAcceptInviteToQueue(Player* player)
+{
+ // Add player in queue
+ m_PlayersInQueue[player->GetTeamId()].insert(player->GetGUID());
+ // Send notification
+ player->GetSession()->SendBfQueueInviteResponse(m_BattleId, m_ZoneId);
+}
+
+// Called in WorldSession::HandleBfExitRequest
+void Battlefield::AskToLeaveQueue(Player* player)
+{
+ // Remove player from queue
+ m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID());
+}
+
+// Called in WorldSession::HandleBfEntryInviteResponse
+void Battlefield::PlayerAcceptInviteToWar(Player* player)
+{
+ if (!IsWarTime())
+ return;
+
+ if (AddOrSetPlayerToCorrectBfGroup(player))
+ {
+ player->GetSession()->SendBfEntered(m_BattleId);
+ m_PlayersInWar[player->GetTeamId()].insert(player->GetGUID());
+ m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());
+
+ if (player->isAFK())
+ player->ToggleAFK();
+
+ OnPlayerJoinWar(player); //for scripting
+ }
+}
+
+void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
+{
+ if (spellId > 0)
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->CastSpell(player, uint32(spellId), true);
+ else
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->RemoveAuraFromStack(uint32(-spellId));
+}
+
+void Battlefield::BroadcastPacketToZone(WorldPacket& data) const
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+void Battlefield::BroadcastPacketToQueue(WorldPacket& data) const
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+void Battlefield::BroadcastPacketToWar(WorldPacket& data) const
+{
+ for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+WorldPacket Battlefield::BuildWarningAnnPacket(std::string msg)
+{
+ WorldPacket data(SMSG_MESSAGECHAT, 200);
+
+ data << uint8(CHAT_MSG_RAID_BOSS_EMOTE);
+ data << uint32(LANG_UNIVERSAL);
+ data << uint64(0);
+ data << uint32(0); // 2.1.0
+ data << uint32(1);
+ data << uint8(0);
+ data << uint64(0);
+ data << uint32(strlen(msg.c_str()) + 1);
+ data << msg.c_str();
+ data << uint8(0);
+
+ return data;
+}
+
+void Battlefield::SendWarningToAllInZone(uint32 entry)
+{
+ if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid))
+ if (Creature* stalker = unit->ToCreature())
+ // FIXME: replaced CHAT_TYPE_END with CHAT_MSG_BG_SYSTEM_NEUTRAL to fix compile, it's a guessed change :/
+ sCreatureTextMgr->SendChat(stalker, (uint8) entry, NULL, CHAT_MSG_BG_SYSTEM_NEUTRAL, LANG_ADDON, TEXT_RANGE_ZONE);
+}
+
+/*void Battlefield::SendWarningToAllInWar(int32 entry,...)
+{
+ const char *format = sObjectMgr->GetTrinityStringForDBCLocale(entry);
+ va_list ap;
+ char str [1024];
+ va_start(ap, entry);
+ vsnprintf(str,1024,format, ap);
+ va_end(ap);
+ std::string msg = (std::string)str;
+
+ WorldPacket data = BuildWarningAnnPacket(msg);
+ BroadcastPacketWar(data);
+}*/
+
+void Battlefield::SendWarningToPlayer(Player* player, uint32 entry)
+{
+ if (player)
+ if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid))
+ if (Creature* stalker = unit->ToCreature())
+ sCreatureTextMgr->SendChat(stalker, (uint8)entry, player->GetGUID());
+}
+
+void Battlefield::SendUpdateWorldState(uint32 field, uint32 value)
+{
+ for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
+ for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->SendUpdateWorldState(field, value);
+}
+
+void Battlefield::RegisterZone(uint32 zoneId)
+{
+ sBattlefieldMgr->AddZone(zoneId, this);
+}
+
+void Battlefield::HideNpc(Creature* creature)
+{
+ creature->CombatStop();
+ creature->SetReactState(REACT_PASSIVE);
+ creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ creature->SetPhaseMask(2, true);
+ creature->DisappearAndDie();
+ creature->SetVisible(false);
+}
+
+void Battlefield::ShowNpc(Creature* creature, bool aggressive)
+{
+ creature->SetPhaseMask(1, true);
+ creature->SetVisible(true);
+ creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
+ if (!creature->isAlive())
+ creature->Respawn(true);
+ if (aggressive)
+ creature->SetReactState(REACT_AGGRESSIVE);
+ else
+ {
+ creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ creature->SetReactState(REACT_PASSIVE);
+ }
+}
+
+// ****************************************************
+// ******************* Group System *******************
+// ****************************************************
+Group* Battlefield::GetFreeBfRaid(TeamId TeamId)
+{
+ for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
+ if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
+ if (!group->IsFull())
+ return group;
+
+ return NULL;
+}
+
+Group* Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId)
+{
+ for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
+ if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
+ if (group->IsMember(guid))
+ return group;
+
+ return NULL;
+}
+
+bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player)
+{
+ if (!player->IsInWorld())
+ return false;
+
+ if (Group* group = player->GetGroup())
+ group->RemoveMember(player->GetGUID());
+
+ Group* group = GetFreeBfRaid(player->GetTeamId());
+ if (!group)
+ {
+ group = new Group;
+ group->SetBattlefieldGroup(this);
+ group->Create(player);
+ sGroupMgr->AddGroup(group);
+ m_Groups[player->GetTeamId()].insert(group->GetGUID());
+ }
+ else if (group->IsMember(player->GetGUID()))
+ {
+ uint8 subgroup = group->GetMemberGroup(player->GetGUID());
+ player->SetBattlegroundRaid(group, subgroup);
+ }
+ else
+ group->AddMember(player);
+
+ return true;
+}
+
+//***************End of Group System*******************
+
+//*****************************************************
+//***************Spirit Guide System*******************
+//*****************************************************
+
+//--------------------
+//-Battlefield Method-
+//--------------------
+BfGraveyard* Battlefield::GetGraveyardById(uint32 id)
+{
+ if (id < m_GraveyardList.size())
+ {
+ if (m_GraveyardList[id])
+ return m_GraveyardList[id];
+ else
+ sLog->outError(LOG_FILTER_GENERAL, "Battlefield::GetGraveyardById Id:%u not existed", id);
+ }
+ else
+ sLog->outError(LOG_FILTER_GENERAL, "Battlefield::GetGraveyardById Id:%u cant be found", id);
+
+ return NULL;
+}
+
+WorldSafeLocsEntry const * Battlefield::GetClosestGraveYard(Player* player)
+{
+ BfGraveyard* closestGY = NULL;
+ float maxdist = -1;
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ {
+ if (m_GraveyardList[i])
+ {
+ if (m_GraveyardList[i]->GetControlTeamId() != player->GetTeamId())
+ continue;
+
+ float dist = m_GraveyardList[i]->GetDistance(player);
+ if (dist < maxdist || maxdist < 0)
+ {
+ closestGY = m_GraveyardList[i];
+ maxdist = dist;
+ }
+ }
+ }
+
+ if (closestGY)
+ return sWorldSafeLocsStore.LookupEntry(closestGY->GetGraveyardId());
+
+ return NULL;
+}
+
+void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid)
+{
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ {
+ if (!m_GraveyardList[i])
+ continue;
+
+ if (m_GraveyardList[i]->HasNpc(npcGuid))
+ {
+ m_GraveyardList[i]->AddPlayer(playerGuid);
+ break;
+ }
+ }
+}
+
+void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
+{
+ for (uint8 i = 0; i < m_GraveyardList.size(); i++)
+ {
+ if (!m_GraveyardList[i])
+ continue;
+
+ if (m_GraveyardList[i]->HasPlayer(playerGuid))
+ {
+ m_GraveyardList[i]->RemovePlayer(playerGuid);
+ break;
+ }
+ }
+}
+
+void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 &guid)
+{
+ WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
+ uint32 time = m_LastResurectTimer; // resurrect every 30 seconds
+
+ data << guid << time;
+ ASSERT(player && player->GetSession());
+ player->GetSession()->SendPacket(&data);
+}
+
+// ----------------------
+// - BfGraveyard Method -
+// ----------------------
+BfGraveyard::BfGraveyard(Battlefield* battlefield)
+{
+ m_Bf = battlefield;
+ m_GraveyardId = 0;
+ m_ControlTeam = TEAM_NEUTRAL;
+ m_SpiritGuide[0] = NULL;
+ m_SpiritGuide[1] = NULL;
+ m_ResurrectQueue.clear();
+}
+
+void BfGraveyard::Initialize(TeamId startControl, uint32 graveyardId)
+{
+ m_ControlTeam = startControl;
+ m_GraveyardId = graveyardId;
+}
+
+void BfGraveyard::SetSpirit(Creature* spirit, TeamId team)
+{
+ if (!spirit)
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "BfGraveyard::SetSpirit: Invalid Spirit.");
+ return;
+ }
+
+ m_SpiritGuide[team] = spirit->GetGUID();
+ spirit->SetReactState(REACT_PASSIVE);
+}
+
+float BfGraveyard::GetDistance(Player* player)
+{
+ const WorldSafeLocsEntry* safeLoc = sWorldSafeLocsStore.LookupEntry(m_GraveyardId);
+ return player->GetDistance2d(safeLoc->x, safeLoc->y);
+}
+
+void BfGraveyard::AddPlayer(uint64 playerGuid)
+{
+ if (!m_ResurrectQueue.count(playerGuid))
+ {
+ m_ResurrectQueue.insert(playerGuid);
+
+ if (Player* player = sObjectAccessor->FindPlayer(playerGuid))
+ player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true);
+ }
+}
+
+void BfGraveyard::RemovePlayer(uint64 playerGuid)
+{
+ m_ResurrectQueue.erase(m_ResurrectQueue.find(playerGuid));
+
+ if (Player* player = sObjectAccessor->FindPlayer(playerGuid))
+ player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
+}
+
+void BfGraveyard::Resurrect()
+{
+ if (m_ResurrectQueue.empty())
+ return;
+
+ for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
+ {
+ // Get player object from his guid
+ Player* player = sObjectAccessor->FindPlayer(*itr);
+ if (!player)
+ continue;
+
+ // Check if the player is in world and on the good graveyard
+ if (player->IsInWorld())
+ if (Unit* spirit = sObjectAccessor->FindUnit(m_SpiritGuide[m_ControlTeam]))
+ spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true);
+
+ // Resurect player
+ player->CastSpell(player, SPELL_RESURRECTION_VISUAL, true);
+ player->ResurrectPlayer(1.0f);
+ player->CastSpell(player, 6962, true);
+ player->CastSpell(player, SPELL_SPIRIT_HEAL_MANA, true);
+
+ sObjectAccessor->ConvertCorpseForPlayer(player->GetGUID());
+ }
+
+ m_ResurrectQueue.clear();
+}
+
+// For changing graveyard control
+void BfGraveyard::GiveControlTo(TeamId team)
+{
+ // Guide switching
+ // Note: Visiblity changes are made by phasing
+ /*if (m_SpiritGuide[1 - team])
+ m_SpiritGuide[1 - team]->SetVisible(false);
+ if (m_SpiritGuide[team])
+ m_SpiritGuide[team]->SetVisible(true);*/
+
+ m_ControlTeam = team;
+ // Teleport to other graveyard, player witch were on this graveyard
+ RelocateDeadPlayers();
+}
+
+void BfGraveyard::RelocateDeadPlayers()
+{
+ WorldSafeLocsEntry const* closestGrave = NULL;
+ for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
+ {
+ Player* player = sObjectAccessor->FindPlayer(*itr);
+ if (!player)
+ continue;
+
+ if (closestGrave)
+ player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());
+ else
+ {
+ closestGrave = m_Bf->GetClosestGraveYard(player);
+ if (closestGrave)
+ player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());
+ }
+ }
+}
+
+// *******************************************************
+// *************** End Spirit Guide system ***************
+// *******************************************************
+// ********************** Misc ***************************
+// *******************************************************
+
+Creature* Battlefield::SpawnCreature(uint32 entry, Position pos, TeamId team)
+{
+ return SpawnCreature(entry, pos.m_positionX, pos.m_positionY, pos.m_positionZ, pos.m_orientation, team);
+}
+
+Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team)
+{
+ //Get map object
+ Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(m_MapId));
+ if (!map)
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry);
+ return 0;
+ }
+
+ Creature* creature = new Creature;
+ if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o))
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "Battlefield::SpawnCreature: Can't create creature entry: %u", entry);
+ delete creature;
+ return NULL;
+ }
+
+ creature->SetHomePosition(x, y, z, o);
+
+ CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
+ if (!cinfo)
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnCreature: entry %u does not exist.", entry);
+ return NULL;
+ }
+ // force using DB speeds -- do we really need this?
+ creature->SetSpeed(MOVE_WALK, cinfo->speed_walk);
+ creature->SetSpeed(MOVE_RUN, cinfo->speed_run);
+
+ // Set creature in world
+ map->AddToMap(creature);
+ creature->setActive(true);
+
+ return creature;
+}
+
+// Method for spawning gameobject on map
+GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o)
+{
+ // Get map object
+ Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(571)); // *vomits*
+ if (!map)
+ return 0;
+
+ // Create gameobject
+ GameObject* go = new GameObject;
+ if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY))
+ {
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry);
+ sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry);
+ delete go;
+ return NULL;
+ }
+
+ // Add to world
+ map->AddToMap(go);
+ go->setActive(true);
+
+ return go;
+}
+
+// *******************************************************
+// ******************* CapturePoint **********************
+// *******************************************************
+
+BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePoint(NULL)
+{
+ m_team = TEAM_NEUTRAL;
+ m_value = 0;
+ m_maxValue = 0;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL;
+ m_OldState = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL;
+ m_capturePointEntry = 0;
+ m_neutralValuePct = 0;
+ m_maxSpeed = 0;
+}
+
+bool BfCapturePoint::HandlePlayerEnter(Player* player)
+{
+ if (m_capturePoint)
+ {
+ player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
+ player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, uint32(ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)));
+ player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
+ }
+ return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second;
+}
+
+GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player)
+{
+ if (m_capturePoint)
+ player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
+
+ GuidSet::iterator current = m_activePlayers[player->GetTeamId()].find(player->GetGUID());
+
+ if (current == m_activePlayers[player->GetTeamId()].end())
+ return current; // return end()
+
+ m_activePlayers[player->GetTeamId()].erase(current++);
+ return current;
+}
+
+void BfCapturePoint::SendChangePhase()
+{
+ if (!m_capturePoint)
+ return;
+
+ // send this too, sometimes the slider disappears, dunno why :(
+ SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
+ // send these updates to only the ones in this objective
+ SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
+ // send this too, sometimes it resets :S
+ SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
+}
+
+bool BfCapturePoint::SetCapturePointData(GameObject* capturePoint)
+{
+ ASSERT(capturePoint);
+
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Creating capture point %u", capturePoint->GetEntry());
+
+ m_capturePoint = capturePoint;
+
+ // check info existence
+ GameObjectTemplate const* goinfo = capturePoint->GetGOInfo();
+ if (goinfo->type != GAMEOBJECT_TYPE_CAPTURE_POINT)
+ {
+ sLog->outError(LOG_FILTER_GENERAL, "OutdoorPvP: GO %u is not capture point!", capturePoint->GetEntry());
+ return false;
+ }
+
+ // get the needed values from goinfo
+ m_maxValue = goinfo->capturePoint.maxTime;
+ m_maxSpeed = m_maxValue / (goinfo->capturePoint.minTime ? goinfo->capturePoint.minTime : 60);
+ m_neutralValuePct = goinfo->capturePoint.neutralPercent;
+ m_minValue = m_maxValue * goinfo->capturePoint.neutralPercent / 100;
+ m_capturePointEntry = capturePoint->GetEntry();
+ if (m_team == TEAM_ALLIANCE)
+ {
+ m_value = m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE;
+ }
+ else
+ {
+ m_value = -m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE;
+ }
+
+ return true;
+}
+
+bool BfCapturePoint::DelCapturePoint()
+{
+ if (m_capturePoint)
+ {
+ m_capturePoint->SetRespawnTime(0); // not save respawn time
+ m_capturePoint->Delete();
+ m_capturePoint = NULL;
+ }
+
+ return true;
+}
+
+bool BfCapturePoint::Update(uint32 diff)
+{
+ if (!m_capturePoint)
+ return false;
+
+ float radius = m_capturePoint->GetGOInfo()->capturePoint.radius;
+
+ for (uint8 team = 0; team < 2; ++team)
+ {
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
+ itr = HandlePlayerLeave(player);
+ else
+ ++itr;
+ }
+ else
+ ++itr;
+ }
+ }
+
+ std::list<Player*> players;
+ Trinity::AnyPlayerInObjectRangeCheck checker(m_capturePoint, radius);
+ Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(m_capturePoint, players, checker);
+ m_capturePoint->VisitNearbyWorldObject(radius, searcher);
+
+ for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
+ if ((*itr)->IsOutdoorPvPActive())
+ if (m_activePlayers[(*itr)->GetTeamId()].insert((*itr)->GetGUID()).second)
+ HandlePlayerEnter(*itr);
+
+ // get the difference of numbers
+ float fact_diff = ((float) m_activePlayers[0].size() - (float) m_activePlayers[1].size()) * diff / BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL;
+ if (!fact_diff)
+ return false;
+
+ uint32 Challenger = 0;
+ float maxDiff = m_maxSpeed * diff;
+
+ if (fact_diff < 0)
+ {
+ // horde is in majority, but it's already horde-controlled -> no change
+ if (m_State == BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE && m_value <= -m_maxValue)
+ return false;
+
+ if (fact_diff < -maxDiff)
+ fact_diff = -maxDiff;
+
+ Challenger = HORDE;
+ }
+ else
+ {
+ // ally is in majority, but it's already ally-controlled -> no change
+ if (m_State == BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE && m_value >= m_maxValue)
+ return false;
+
+ if (fact_diff > maxDiff)
+ fact_diff = maxDiff;
+
+ Challenger = ALLIANCE;
+ }
+
+ float oldValue = m_value;
+ TeamId oldTeam = m_team;
+
+ m_OldState = m_State;
+
+ m_value += fact_diff;
+
+ if (m_value < -m_minValue) // red
+ {
+ if (m_value < -m_maxValue)
+ m_value = -m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE;
+ m_team = TEAM_HORDE;
+ }
+ else if (m_value > m_minValue) // blue
+ {
+ if (m_value > m_maxValue)
+ m_value = m_maxValue;
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE;
+ m_team = TEAM_ALLIANCE;
+ }
+ else if (oldValue * m_value <= 0) // grey, go through mid point
+ {
+ // if challenger is ally, then n->a challenge
+ if (Challenger == ALLIANCE)
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE;
+ // if challenger is horde, then n->h challenge
+ else if (Challenger == HORDE)
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE;
+ m_team = TEAM_NEUTRAL;
+ }
+ else // grey, did not go through mid point
+ {
+ // old phase and current are on the same side, so one team challenges the other
+ if (Challenger == ALLIANCE && (m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE || m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE))
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE;
+ else if (Challenger == HORDE && (m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE || m_OldState == BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE))
+ m_State = BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE;
+ m_team = TEAM_NEUTRAL;
+ }
+
+ if (m_value != oldValue)
+ SendChangePhase();
+
+ if (m_OldState != m_State)
+ {
+ //sLog->outError(LOG_FILTER_GENERAL, "%u->%u", m_OldState, m_State);
+ if (oldTeam != m_team)
+ ChangeTeam(oldTeam);
+ return true;
+ }
+
+ return false;
+}
+
+void BfCapturePoint::SendUpdateWorldState(uint32 field, uint32 value)
+{
+ for (uint8 team = 0; team < 2; ++team)
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) // send to all players present in the area
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->SendUpdateWorldState(field, value);
+}
+
+void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
+{
+ uint8 team;
+ switch (m_State)
+ {
+ case BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE:
+ team = 0;
+ break;
+ case BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE:
+ team = 1;
+ break;
+ default:
+ return;
+ }
+
+ // send to all players present in the area
+ for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->KilledMonsterCredit(id, guid);
+}
+
+bool BfCapturePoint::IsInsideObjective(Player* player) const
+{
+ return m_activePlayers[player->GetTeamId()].find(player->GetGUID()) != m_activePlayers[player->GetTeamId()].end();
+}
diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h
new file mode 100644
index 00000000000..5fa8d6b1bc8
--- /dev/null
+++ b/src/server/game/Battlefield/Battlefield.h
@@ -0,0 +1,431 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BATTLEFIELD_H_
+#define BATTLEFIELD_H_
+
+#include "Utilities/Util.h"
+#include "SharedDefines.h"
+#include "ZoneScript.h"
+#include "WorldPacket.h"
+#include "GameObject.h"
+#include "Battleground.h"
+#include "ObjectAccessor.h"
+
+enum BattlefieldTypes
+{
+ BATTLEFIELD_WG, // Wintergrasp
+ BATTLEFIELD_TB, // Tol Barad (cataclysm)
+};
+
+enum BattlefieldIDs
+{
+ BATTLEFIELD_BATTLEID_WG = 1, // Wintergrasp battle
+};
+
+enum BattlefieldObjectiveStates
+{
+ BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL = 0,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE,
+ BF_CAPTUREPOINT_OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE,
+};
+
+enum BattlefieldSounds
+{
+ BF_HORDE_WINS = 8454,
+ BF_ALLIANCE_WINS = 8455,
+ BF_START = 3439
+};
+
+enum BattlefieldTimers
+{
+ BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL = 1000
+};
+
+// some class predefs
+class Player;
+class GameObject;
+class WorldPacket;
+class Creature;
+class Unit;
+
+class Battlefield;
+class BfGraveyard;
+
+typedef std::set<uint64> GuidSet;
+typedef std::vector<BfGraveyard*> GraveyardVect;
+typedef std::map<uint64, uint32> PlayerTimerMap;
+
+class BfCapturePoint
+{
+ public:
+ BfCapturePoint(Battlefield* bf);
+
+ virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
+
+ // Send world state update to all players present
+ void SendUpdateWorldState(uint32 field, uint32 value);
+
+ // Send kill notify to players in the controlling faction
+ void SendObjectiveComplete(uint32 id, uint64 guid);
+
+ // Used when player is activated/inactivated in the area
+ virtual bool HandlePlayerEnter(Player* player);
+ virtual GuidSet::iterator HandlePlayerLeave(Player* player);
+ //virtual void HandlePlayerActivityChanged(Player* player);
+
+ // Checks if player is in range of a capture credit marker
+ bool IsInsideObjective(Player* player) const;
+
+ // Returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update.
+ virtual bool Update(uint32 diff);
+ virtual void ChangeTeam(TeamId /*oldTeam*/) {}
+ virtual void SendChangePhase();
+
+ bool SetCapturePointData(GameObject* capturePoint);
+ GameObject* GetCapturePointGo() { return m_capturePoint; }
+
+ TeamId GetTeamId() { return m_team; }
+ protected:
+ bool DelCapturePoint();
+
+ // active Players in the area of the objective, 0 - alliance, 1 - horde
+ GuidSet m_activePlayers[2];
+
+ // Total shift needed to capture the objective
+ float m_maxValue;
+ float m_minValue;
+
+ // Maximum speed of capture
+ float m_maxSpeed;
+
+ // The status of the objective
+ float m_value;
+ TeamId m_team;
+
+ // Objective states
+ BattlefieldObjectiveStates m_OldState;
+ BattlefieldObjectiveStates m_State;
+
+ // Neutral value on capture bar
+ uint32 m_neutralValuePct;
+
+ // Pointer to the Battlefield this objective belongs to
+ Battlefield* m_Bf;
+
+ // Capture point entry
+ uint32 m_capturePointEntry;
+
+ // Gameobject related to that capture point
+ GameObject* m_capturePoint;
+};
+
+class BfGraveyard
+{
+ public:
+ BfGraveyard(Battlefield* Bf);
+
+ // Method to changing who controls the graveyard
+ void GiveControlTo(TeamId team);
+ TeamId GetControlTeamId() { return m_ControlTeam; }
+
+ // Find the nearest graveyard to a player
+ float GetDistance(Player* player);
+
+ // Initialize the graveyard
+ void Initialize(TeamId startcontrol, uint32 gy);
+
+ // Set spirit service for the graveyard
+ void SetSpirit(Creature* spirit, TeamId team);
+
+ // Add a player to the graveyard
+ void AddPlayer(uint64 player_guid);
+
+ // Remove a player from the graveyard
+ void RemovePlayer(uint64 player_guid);
+
+ // Resurrect players
+ void Resurrect();
+
+ // Move players waiting to that graveyard on the nearest one
+ void RelocateDeadPlayers();
+
+ // Check if this graveyard has a spirit guide
+ bool HasNpc(uint64 guid)
+ {
+ if (!m_SpiritGuide[0] || !m_SpiritGuide[1])
+ return false;
+
+ if (!sObjectAccessor->FindUnit(m_SpiritGuide[0]) ||
+ !sObjectAccessor->FindUnit(m_SpiritGuide[1]))
+ return false;
+
+ return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid);
+ }
+
+ // Check if a player is in this graveyard's ressurect queue
+ bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
+
+ // Get the graveyard's ID.
+ uint32 GetGraveyardId() { return m_GraveyardId; }
+
+ protected:
+ TeamId m_ControlTeam;
+ uint32 m_GraveyardId;
+ uint64 m_SpiritGuide[2];
+ GuidSet m_ResurrectQueue;
+ Battlefield* m_Bf;
+};
+
+class Battlefield : public ZoneScript
+{
+ friend class BattlefieldMgr;
+
+ public:
+ /// Constructor
+ Battlefield();
+ /// Destructor
+ virtual ~Battlefield();
+
+ /// typedef of map witch store capturepoint and the associate gameobject entry
+ typedef std::map<uint32 /*lowguid */, BfCapturePoint*> BfCapturePointMap;
+
+ /// Call this to init the Battlefield
+ virtual bool SetupBattlefield() { return true; }
+
+ /// Generate packet which contain all worldstatedata of area
+ virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
+
+ /// Update data of a worldstate to all players present in zone
+ void SendUpdateWorldState(uint32 field, uint32 value);
+
+ /**
+ * \brief Called every time for update bf data and time
+ * - Update timer for start/end battle
+ * - Invite player in zone to queue m_StartGroupingTimer minutes before start
+ * - Kick Afk players
+ * \param diff : time ellapsed since last call (in ms)
+ */
+ virtual bool Update(uint32 diff);
+
+ /// Invite all players in zone to join the queue, called x minutes before battle start in Update()
+ void InvitePlayersInZoneToQueue();
+ /// Invite all players in queue to join battle on battle start
+ void InvitePlayersInQueueToWar();
+ /// Invite all players in zone to join battle on battle start
+ void InvitePlayersInZoneToWar();
+
+ /// Called when a Unit is kill in battlefield zone
+ virtual void HandleKill(Player* /*killer*/, Unit* /*killed*/) {};
+
+ uint32 GetTypeId() { return m_TypeId; }
+ uint32 GetZoneId() { return m_ZoneId; }
+
+ void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
+
+ /// Return true if battle is start, false if battle is not started
+ bool IsWarTime() { return m_isActive; }
+
+ /// Enable or Disable battlefield
+ void ToggleBattlefield(bool enable) { m_IsEnabled = enable; }
+ /// Return if battlefield is enable
+ bool IsEnabled() { return m_IsEnabled; }
+
+ /**
+ * \brief Kick player from battlefield and teleport him to kick-point location
+ * \param guid : guid of player who must be kick
+ */
+ void KickPlayerFromBattlefield(uint64 guid);
+
+ /// Called when player (player) enter in zone
+ void HandlePlayerEnterZone(Player* player, uint32 zone);
+ /// Called when player (player) leave the zone
+ void HandlePlayerLeaveZone(Player* player, uint32 zone);
+
+ // All-purpose data storage 64 bit
+ virtual uint64 GetData64(uint32 dataId) { return m_Data64[dataId]; }
+ virtual void SetData64(uint32 dataId, uint64 value) { m_Data64[dataId] = value; }
+
+ // All-purpose data storage 32 bit
+ virtual uint32 GetData(uint32 dataId) { return m_Data32[dataId]; }
+ virtual void SetData(uint32 dataId, uint32 value) { m_Data32[dataId] = value; }
+ virtual void UpdateData(uint32 index, int32 pad) { m_Data32[index] += pad; }
+
+ // Battlefield - generic methods
+ TeamId GetDefenderTeam() { return m_DefenderTeam; }
+ TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); }
+ TeamId GetOtherTeam(TeamId team) { return (team == TEAM_HORDE ? TEAM_ALLIANCE : TEAM_HORDE); }
+ void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; }
+
+ // Group methods
+ /**
+ * \brief Find a not full battlefield group, if there is no, create one
+ * \param TeamId : Id of player team for who we search a group (player->GetTeamId())
+ */
+ Group* GetFreeBfRaid(TeamId TeamId);
+ /// Return battlefield group where player is.
+ Group* GetGroupPlayer(uint64 guid, TeamId TeamId);
+ /// Force player to join a battlefield group
+ bool AddOrSetPlayerToCorrectBfGroup(Player* player);
+
+ // Graveyard methods
+ // Find which graveyard the player must be teleported to to be resurrected by spiritguide
+ WorldSafeLocsEntry const * GetClosestGraveYard(Player* player);
+
+ virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
+ void RemovePlayerFromResurrectQueue(uint64 player_guid);
+ void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); }
+ BfGraveyard* GetGraveyardById(uint32 id);
+
+ // Misc methods
+ Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team);
+ Creature* SpawnCreature(uint32 entry, Position pos, TeamId team);
+ GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o);
+
+ // Script-methods
+
+ /// Called on start
+ virtual void OnBattleStart() {};
+ /// Called at the end of battle
+ virtual void OnBattleEnd(bool /*endByTimer*/) {};
+ /// Called x minutes before battle start when player in zone are invite to join queue
+ virtual void OnStartGrouping() {};
+ /// Called when a player accept to join the battle
+ virtual void OnPlayerJoinWar(Player* /*player*/) {};
+ /// Called when a player leave the battle
+ virtual void OnPlayerLeaveWar(Player* /*player*/) {};
+ /// Called when a player leave battlefield zone
+ virtual void OnPlayerLeaveZone(Player* /*player*/) {};
+ /// Called when a player enter in battlefield zone
+ virtual void OnPlayerEnterZone(Player* /*player*/) {};
+
+ WorldPacket BuildWarningAnnPacket(std::string msg);
+ void SendWarningToAllInZone(uint32 entry);
+ //void SendWarningToAllInWar(int32 entry, ...); -- UNUSED
+ void SendWarningToPlayer(Player* player, uint32 entry);
+
+ void PlayerAcceptInviteToQueue(Player* player);
+ void PlayerAcceptInviteToWar(Player* player);
+ uint32 GetBattleId() { return m_BattleId; }
+ void AskToLeaveQueue(Player* player);
+
+ virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) {};
+
+ /// Send all worldstate data to all player in zone.
+ virtual void SendInitWorldStatesToAll() {};
+
+ /// Return if we can use mount in battlefield
+ bool CanFlyIn() { return !m_isActive; }
+
+ void SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 & guid);
+
+ void StartBattle();
+ void EndBattle(bool endByTimer);
+
+ void HideNpc(Creature* creature);
+ void ShowNpc(Creature* creature, bool aggressive);
+
+ GraveyardVect GetGraveyardVector() { return m_GraveyardList; }
+
+ uint32 GetTimer() { return m_Timer; }
+ void SetTimer(uint32 timer) { m_Timer = timer; }
+
+ void DoPlaySoundToAll(uint32 SoundID);
+
+ void InvitePlayerToQueue(Player* player);
+ void InvitePlayerToWar(Player* player);
+
+ void InitStalker(uint32 entry, float x, float y, float z, float o);
+
+ protected:
+ uint64 StalkerGuid;
+ uint32 m_Timer; // Global timer for event
+ bool m_IsEnabled;
+ bool m_isActive;
+ TeamId m_DefenderTeam;
+
+ // Map of the objectives belonging to this OutdoorPvP
+ BfCapturePointMap m_capturePoints;
+
+ // Players info maps
+ GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone
+ GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue
+ GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat
+ PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT];
+ PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT];
+
+ // Variables that must exist for each battlefield
+ uint32 m_TypeId; // See enum BattlefieldTypes
+ uint32 m_BattleId; // BattleID (for packet)
+ uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197
+ uint32 m_MapId; // MapId where is Battlefield
+ uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield
+ uint32 m_MinPlayer; // Minimum number of player for Battlefield start
+ uint32 m_MinLevel; // Required level to participate at Battlefield
+ uint32 m_BattleTime; // Length of a battle
+ uint32 m_NoWarBattleTime; // Time between two battles
+ uint32 m_RestartAfterCrash; // Delay to restart Wintergrasp if the server crashed during a running battle.
+ uint32 m_TimeForAcceptInvite;
+ uint32 m_uiKickDontAcceptTimer;
+ WorldLocation KickPosition; // Position where players are teleported if they switch to afk during the battle or if they don't accept invitation
+
+ uint32 m_uiKickAfkPlayersTimer; // Timer for check Afk in war
+
+ // Graveyard variables
+ GraveyardVect m_GraveyardList; // Vector witch contain the different GY of the battle
+ uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec
+
+ uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle
+ bool m_StartGrouping; // bool for know if all players in area has been invited
+
+ GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group
+
+ std::vector<uint64> m_Data64;
+ std::vector<uint32> m_Data32;
+
+ void KickAfkPlayers();
+
+ // use for switch off all worldstate for client
+ virtual void SendRemoveWorldStates(Player* /*player*/) {}
+
+ // use for send a packet for all player list
+ void BroadcastPacketToZone(WorldPacket& data) const;
+ void BroadcastPacketToQueue(WorldPacket& data) const;
+ void BroadcastPacketToWar(WorldPacket& data) const;
+
+ // CapturePoint system
+ void AddCapturePoint(BfCapturePoint* cp) { m_capturePoints[cp->GetCapturePointGo()->GetEntry()] = cp; }
+
+ BfCapturePoint* GetCapturePoint(uint32 lowguid) const
+ {
+ Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid);
+ if (itr != m_capturePoints.end())
+ return itr->second;
+ return NULL;
+ }
+
+ void RegisterZone(uint32 zoneid);
+ bool HasPlayer(Player* player) const;
+ void TeamCastSpell(TeamId team, int32 spellId);
+};
+
+#endif
diff --git a/src/server/game/Battlefield/BattlefieldHandler.cpp b/src/server/game/Battlefield/BattlefieldHandler.cpp
new file mode 100644
index 00000000000..09c6f18f796
--- /dev/null
+++ b/src/server/game/Battlefield/BattlefieldHandler.cpp
@@ -0,0 +1,150 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "Common.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "WorldPacket.h"
+#include "WorldSession.h"
+
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
+#include "Opcodes.h"
+
+//This send to player windows for invite player to join the war
+//Param1:(BattleId) the BattleId of Bf
+//Param2:(ZoneId) the zone where the battle is (4197 for wg)
+//Param3:(time) Time in second that the player have for accept
+void WorldSession::SendBfInvitePlayerToWar(uint32 BattleId, uint32 ZoneId, uint32 p_time)
+{
+ //Send packet
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, 12);
+ data << uint32(BattleId);
+ data << uint32(ZoneId);
+ data << uint32((time(NULL) + p_time));
+
+ //Sending the packet to player
+ SendPacket(&data);
+}
+
+//This send invitation to player to join the queue
+//Param1:(BattleId) the BattleId of Bf
+void WorldSession::SendBfInvitePlayerToQueue(uint32 BattleId)
+{
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_INVITE, 5);
+
+ data << uint32(BattleId);
+ data << uint8(1); //warmup ? used ?
+
+ //Sending packet to player
+ SendPacket(&data);
+}
+
+//This send packet for inform player that he join queue
+//Param1:(BattleId) the BattleId of Bf
+//Param2:(ZoneId) the zone where the battle is (4197 for wg)
+//Param3:(CanQueue) if able to queue
+//Param4:(Full) on log in is full
+void WorldSession::SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue, bool Full)
+{
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 11);
+ data << uint32(BattleId);
+ data << uint32(ZoneId);
+ data << uint8((CanQueue ? 1 : 0)); //Accepted //0 you cannot queue wg //1 you are queued
+ data << uint8((Full ? 0 : 1)); //Logging In //0 wg full //1 queue for upcoming
+ data << uint8(1); //Warmup
+ SendPacket(&data);
+}
+
+//This is call when player accept to join war
+//Param1:(BattleId) the BattleId of Bf
+void WorldSession::SendBfEntered(uint32 BattleId)
+{
+// m_PlayerInWar[player->GetTeamId()].insert(player->GetGUID());
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTERED, 7);
+ data << uint32(BattleId);
+ data << uint8(1); //unk
+ data << uint8(1); //unk
+ data << uint8(_player->isAFK() ? 1 : 0); //Clear AFK
+ SendPacket(&data);
+}
+
+void WorldSession::SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason)
+{
+ WorldPacket data(SMSG_BATTLEFIELD_MGR_EJECTED, 7);
+ data << uint32(BattleId);
+ data << uint8(reason);//byte Reason
+ data << uint8(2);//byte BattleStatus
+ data << uint8(0);//bool Relocated
+ SendPacket(&data);
+}
+
+//Send by client when he click on accept for queue
+void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recv_data)
+{
+ uint32 BattleId;
+ uint8 Accepted;
+
+ recv_data >> BattleId >> Accepted;
+ sLog->outError(LOG_FILTER_GENERAL, "HandleQueueInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
+ if (!Bf)
+ return;
+
+ if (Accepted)
+ {
+ Bf->PlayerAcceptInviteToQueue(_player);
+ }
+}
+
+//Send by client on clicking in accept or refuse of invitation windows for join game
+void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recv_data)
+{
+ uint32 BattleId;
+ uint8 Accepted;
+
+ recv_data >> BattleId >> Accepted;
+ sLog->outError(LOG_FILTER_GENERAL, "HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u", BattleId, Accepted);
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
+ if (!Bf)
+ return;
+
+ //If player accept invitation
+ if (Accepted)
+ {
+ Bf->PlayerAcceptInviteToWar(_player);
+ }
+ else
+ {
+ if (_player->GetZoneId() == Bf->GetZoneId())
+ Bf->KickPlayerFromBattlefield(_player->GetGUID());
+ }
+}
+
+void WorldSession::HandleBfExitRequest(WorldPacket & recv_data)
+{
+ uint32 BattleId;
+
+ recv_data >> BattleId;
+ sLog->outError(LOG_FILTER_GENERAL, "HandleBfExitRequest: BattleID:%u ", BattleId);
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldByBattleId(BattleId);
+ if (!Bf)
+ return;
+
+ Bf->AskToLeaveQueue(_player);
+}
diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp
new file mode 100644
index 00000000000..6122b25e8e8
--- /dev/null
+++ b/src/server/game/Battlefield/BattlefieldMgr.cpp
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "BattlefieldMgr.h"
+#include "Zones/BattlefieldWG.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+
+BattlefieldMgr::BattlefieldMgr()
+{
+ m_UpdateTimer = 0;
+ //sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Instantiating BattlefieldMgr");
+}
+
+BattlefieldMgr::~BattlefieldMgr()
+{
+ //sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Deleting BattlefieldMgr");
+ for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
+ delete *itr;
+}
+
+void BattlefieldMgr::InitBattlefield()
+{
+ Battlefield* pBf = new BattlefieldWG;
+ // respawn, init variables
+ if (!pBf->SetupBattlefield())
+ {
+ sLog->outInfo(LOG_FILTER_GENERAL, "Battlefield : Wintergrasp init failed.");
+ delete pBf;
+ }
+ else
+ {
+ m_BattlefieldSet.push_back(pBf);
+ sLog->outInfo(LOG_FILTER_GENERAL, "Battlefield : Wintergrasp successfully initiated.");
+ }
+
+ /* For Cataclysm: Tol Barad
+ pBf = new BattlefieldTB;
+ // respawn, init variables
+ if(!pBf->SetupBattlefield())
+ {
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad init failed.");
+ delete pBf;
+ }
+ else
+ {
+ m_BattlefieldSet.push_back(pBf);
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad successfully initiated.");
+ } */
+}
+
+void BattlefieldMgr::AddZone(uint32 zoneid, Battlefield *handle)
+{
+ m_BattlefieldMap[zoneid] = handle;
+}
+
+void BattlefieldMgr::HandlePlayerEnterZone(Player * player, uint32 zoneid)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
+ if (itr == m_BattlefieldMap.end())
+ return;
+
+ if (itr->second->HasPlayer(player) || !itr->second->IsEnabled())
+ return;
+
+ itr->second->HandlePlayerEnterZone(player, zoneid);
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
+}
+
+void BattlefieldMgr::HandlePlayerLeaveZone(Player * player, uint32 zoneid)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
+ if (itr == m_BattlefieldMap.end())
+ return;
+
+ // teleport: remove once in removefromworld, once in updatezone
+ if (!itr->second->HasPlayer(player))
+ return;
+ itr->second->HandlePlayerLeaveZone(player, zoneid);
+ sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u left outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
+}
+
+Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
+ if (itr == m_BattlefieldMap.end())
+ {
+ // no handle for this zone, return
+ return NULL;
+ }
+ if (!itr->second->IsEnabled())
+ return NULL;
+ return itr->second;
+}
+
+Battlefield *BattlefieldMgr::GetBattlefieldByBattleId(uint32 battleid)
+{
+ for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
+ {
+ if ((*itr)->GetBattleId() == battleid)
+ return (*itr);
+ }
+ return NULL;
+}
+
+void BattlefieldMgr::Update(uint32 diff)
+{
+ m_UpdateTimer += diff;
+ if (m_UpdateTimer > BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL)
+ {
+ for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
+ if ((*itr)->IsEnabled())
+ (*itr)->Update(m_UpdateTimer);
+ m_UpdateTimer = 0;
+ }
+}
+
+ZoneScript *BattlefieldMgr::GetZoneScript(uint32 zoneId)
+{
+ BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneId);
+ if (itr != m_BattlefieldMap.end())
+ return itr->second;
+ else
+ return NULL;
+}
diff --git a/src/server/game/Battlefield/BattlefieldMgr.h b/src/server/game/Battlefield/BattlefieldMgr.h
new file mode 100644
index 00000000000..4ee37e424fd
--- /dev/null
+++ b/src/server/game/Battlefield/BattlefieldMgr.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BATTLEFIELD_MGR_H_
+#define BATTLEFIELD_MGR_H_
+
+#include "Battlefield.h"
+#include "ace/Singleton.h"
+
+class Player;
+class GameObject;
+class Creature;
+class ZoneScript;
+struct GossipMenuItems;
+
+// class to handle player enter / leave / areatrigger / GO use events
+class BattlefieldMgr
+{
+ public:
+ // ctor
+ BattlefieldMgr();
+ // dtor
+ ~BattlefieldMgr();
+
+ // create battlefield events
+ void InitBattlefield();
+ // called when a player enters an battlefield area
+ void HandlePlayerEnterZone(Player * player, uint32 areaflag);
+ // called when player leaves an battlefield area
+ void HandlePlayerLeaveZone(Player * player, uint32 areaflag);
+ // called when player resurrects
+ void HandlePlayerResurrects(Player * player, uint32 areaflag);
+ // return assigned battlefield
+ Battlefield *GetBattlefieldToZoneId(uint32 zoneid);
+ Battlefield *GetBattlefieldByBattleId(uint32 battleid);
+
+ ZoneScript *GetZoneScript(uint32 zoneId);
+
+ void AddZone(uint32 zoneid, Battlefield * handle);
+
+ void Update(uint32 diff);
+
+ void HandleGossipOption(Player * player, uint64 guid, uint32 gossipid);
+
+ bool CanTalkTo(Player * player, Creature * creature, GossipMenuItems gso);
+
+ void HandleDropFlag(Player * player, uint32 spellId);
+
+ typedef std::vector < Battlefield * >BattlefieldSet;
+ typedef std::map < uint32 /* zoneid */ , Battlefield * >BattlefieldMap;
+ private:
+ // contains all initiated battlefield events
+ // used when initing / cleaning up
+ BattlefieldSet m_BattlefieldSet;
+ // maps the zone ids to an battlefield event
+ // used in player event handling
+ BattlefieldMap m_BattlefieldMap;
+ // update interval
+ uint32 m_UpdateTimer;
+};
+
+#define sBattlefieldMgr ACE_Singleton<BattlefieldMgr, ACE_Null_Mutex>::instance()
+
+#endif
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
new file mode 100644
index 00000000000..48d6b59d007
--- /dev/null
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
@@ -0,0 +1,1097 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+// TODO: Implement proper support for vehicle+player teleportation
+// TODO: Use spell victory/defeat in wg instead of RewardMarkOfHonor() && RewardHonor
+// TODO: Add proper implement of achievement
+
+#include "ObjectMgr.h"
+#include "BattlefieldWG.h"
+#include "SpellAuras.h"
+#include "Vehicle.h"
+
+enum WintergrastData
+{
+ BATTLEFIELD_WG_ZONEID = 4197, // Wintergrasp
+ BATTLEFIELD_WG_MAPID = 571, // Northrend
+};
+
+enum WGVehicles
+{
+ NPC_WG_SEIGE_ENGINE_ALLIANCE = 28312,
+ NPC_WG_SEIGE_ENGINE_HORDE = 32627,
+ NPC_WG_DEMOLISHER = 28094,
+ NPC_WG_CATAPULT = 27881,
+};
+
+bool BattlefieldWG::SetupBattlefield()
+{
+ InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]);
+
+ m_TypeId = BATTLEFIELD_WG; // See enum BattlefieldTypes
+ m_BattleId = BATTLEFIELD_BATTLEID_WG;
+ m_ZoneId = BATTLEFIELD_WG_ZONEID;
+ m_MapId = BATTLEFIELD_WG_MAPID;
+
+ m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MAX);
+ m_IsEnabled = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE);
+ m_MinPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN);
+ m_MinLevel = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN_LVL);
+ m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE * IN_MILLISECONDS;
+ m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_NOBATTLETIME) * MINUTE * IN_MILLISECONDS;
+ m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE * IN_MILLISECONDS;
+
+ m_TimeForAcceptInvite = 20;
+ m_StartGroupingTimer = 15 * MINUTE * IN_MILLISECONDS;
+ m_StartGrouping = false;
+
+ m_tenacityStack = 0;
+
+ KickPosition.Relocate(5728.117f, 2714.346f, 697.733f, 0);
+ KickPosition.m_mapId = m_MapId;
+
+ RegisterZone(m_ZoneId);
+
+ m_Data32.resize(BATTLEFIELD_WG_DATA_MAX);
+
+ m_saveTimer = 60000;
+
+ // Init GraveYards
+ SetGraveyardNumber(BATTLEFIELD_WG_GRAVEYARD_MAX);
+
+ // Load from db
+ if ((sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) == 0) && (sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) == 0)
+ && (sWorld->getWorldState(ClockWorldState[0]) == 0))
+ {
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, uint64(false));
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, uint64(urand(0, 1)));
+ sWorld->setWorldState(ClockWorldState[0], uint64(m_NoWarBattleTime));
+ }
+
+ m_isActive = bool(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE));
+ m_DefenderTeam = TeamId(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER));
+
+ m_Timer = sWorld->getWorldState(ClockWorldState[0]);
+ if (m_isActive)
+ {
+ m_isActive = false;
+ m_Timer = m_RestartAfterCrash;
+ }
+
+ for (uint8 i = 0; i < BATTLEFIELD_WG_GRAVEYARD_MAX; i++)
+ {
+ BfGraveyardWG* graveyard = new BfGraveyardWG(this);
+
+ // When between games, the graveyard is controlled by the defending team
+ if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL)
+ graveyard->Initialize(m_DefenderTeam, WGGraveYard[i].gyid);
+ else
+ graveyard->Initialize(WGGraveYard[i].startcontrol, WGGraveYard[i].gyid);
+
+ graveyard->SetTextId(WGGraveYard[i].textid);
+ m_GraveyardList[i] = graveyard;
+ }
+
+
+ // Spawn workshop creatures and gameobjects
+ for (uint8 i = 0; i < WG_MAX_WORKSHOP; i++)
+ {
+ WGWorkshop* workshop = new WGWorkshop(this, i);
+ if (i < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ workshop->GiveControlTo(GetAttackerTeam(), true);
+ else
+ workshop->GiveControlTo(GetDefenderTeam(), true);
+
+ // Note: Capture point is added once the gameobject is created.
+ WorkshopsList.insert(workshop);
+ }
+
+ // Spawn NPCs in the defender's keep, both Horde and Alliance
+ for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++)
+ {
+ // Horde npc
+ if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryHorde, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE))
+ KeepCreature[TEAM_HORDE].insert(creature->GetGUID());
+ // Alliance npc
+ if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryAlliance, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE))
+ KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+
+ // Hide NPCs from the Attacker's team in the keep
+ for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ HideNpc(creature);
+
+ // Spawn Horde NPCs outside the keep
+ for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++)
+ if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryHorde, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE))
+ OutsideCreature[TEAM_HORDE].insert(creature->GetGUID());
+
+ // Spawn Alliance NPCs outside the keep
+ for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; i++)
+ if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryAlliance, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE))
+ OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
+
+ // Hide units outside the keep that are defenders
+ for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ HideNpc(creature);
+
+ // Spawn turrets and hide them per default
+ for (uint8 i = 0; i < WG_MAX_TURRET; i++)
+ {
+ Position towerCannonPos;
+ WGTurret[i].GetPosition(&towerCannonPos);
+ if (Creature* creature = SpawnCreature(NPC_TOWER_CANNON, towerCannonPos, TEAM_ALLIANCE))
+ {
+ CanonList.insert(creature->GetGUID());
+ HideNpc(creature);
+ }
+ }
+
+ // Spawn all gameobjects
+ for (uint8 i = 0; i < WG_MAX_OBJ; i++)
+ {
+ GameObject* go = SpawnGameObject(WGGameObjectBuilding[i].entry, WGGameObjectBuilding[i].x, WGGameObjectBuilding[i].y, WGGameObjectBuilding[i].z, WGGameObjectBuilding[i].o);
+ BfWGGameObjectBuilding* b = new BfWGGameObjectBuilding(this);
+ b->Init(go, WGGameObjectBuilding[i].type, WGGameObjectBuilding[i].WorldState, WGGameObjectBuilding[i].nameId);
+ BuildingsInZone.insert(b);
+ }
+
+ // Spawning portal defender
+ for (uint8 i = 0; i < WG_MAX_TELEPORTER; i++)
+ {
+ GameObject* go = SpawnGameObject(WGPortalDefenderData[i].entry, WGPortalDefenderData[i].x, WGPortalDefenderData[i].y, WGPortalDefenderData[i].z, WGPortalDefenderData[i].o);
+ DefenderPortalList.insert(go);
+ go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
+ }
+
+ // Spawn banners in the keep
+ for (uint8 i = 0; i < WG_KEEPGAMEOBJECT_MAX; i++)
+ {
+ if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryHorde, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
+ {
+ go->SetRespawnTime(GetDefenderTeam()? RESPAWN_ONE_DAY : RESPAWN_IMMEDIATELY);
+ m_KeepGameObject[1].insert(go);
+ }
+ if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryAlliance, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
+ {
+ go->SetRespawnTime(GetDefenderTeam()? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
+ m_KeepGameObject[0].insert(go);
+ }
+ }
+
+ // Show defender banner in keep
+ for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+
+ // Hide attackant banner in keep
+ for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+
+ UpdateCounterVehicle(true);
+ return true;
+}
+
+bool BattlefieldWG::Update(uint32 diff)
+{
+ bool m_return = Battlefield::Update(diff);
+ if (m_saveTimer <= diff)
+ {
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, m_isActive);
+ sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, m_DefenderTeam);
+ sWorld->setWorldState(ClockWorldState[0], m_Timer);
+ m_saveTimer = 60 * IN_MILLISECONDS;
+ }
+ else
+ m_saveTimer -= diff;
+
+ return m_return;
+}
+
+void BattlefieldWG::OnBattleStart()
+{
+ // Spawn titan relic
+ m_titansRelic = SpawnGameObject(GO_WINTERGRASP_TITAN_S_RELIC, 5440.0f, 2840.8f, 430.43f, 0);
+ if (m_titansRelic)
+ {
+ // Update faction of relic, only attacker can click on
+ m_titansRelic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]);
+ // Set in use (not allow to click on before last door is broken)
+ m_titansRelic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
+ }
+ else
+ sLog->outError(LOG_FILTER_GENERAL, "WG: Failed to spawn titan relic.");
+
+
+ // Update tower visibility and update faction
+ for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
+ {
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ {
+ if (Creature* creature = unit->ToCreature())
+ {
+ ShowNpc(creature, true);
+ creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
+ }
+ }
+ }
+
+ // Rebuild all wall
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ {
+ if (*itr)
+ {
+ (*itr)->Rebuild();
+ (*itr)->UpdateTurretAttack(false);
+ }
+ }
+
+ SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 0);
+ SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 0);
+ SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 0);
+ SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 0);
+
+ // Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base)
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ if (*itr)
+ (*itr)->UpdateGraveyardAndWorkshop();
+
+ for (uint8 team = 0; team < 2; ++team)
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ {
+ // Kick player in orb room, TODO: offline player ?
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ float x, y, z;
+ player->GetPosition(x, y, z);
+ if (5500 > x && x > 5392 && y < 2880 && y > 2800 && z < 480)
+ player->TeleportTo(571, 5349.8686f, 2838.481f, 409.240f, 0.046328f);
+ SendInitWorldStatesTo(player);
+ }
+ }
+ // Initialize vehicle counter
+ UpdateCounterVehicle(true);
+ // Send start warning to all players
+ SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_START);
+}
+
+void BattlefieldWG::UpdateCounterVehicle(bool init)
+{
+ if (init)
+ {
+ SetData(BATTLEFIELD_WG_DATA_VEHICLE_H, 0);
+ SetData(BATTLEFIELD_WG_DATA_VEHICLE_A, 0);
+ }
+ SetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, 0);
+ SetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, 0);
+
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ {
+ if (WGWorkshop* workshop = (*itr))
+ {
+ if (workshop->teamControl == TEAM_ALLIANCE)
+ UpdateData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, 4);
+ else if (workshop->teamControl == TEAM_HORDE)
+ UpdateData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, 4);
+ }
+ }
+
+ UpdateVehicleCountWG();
+}
+
+void BattlefieldWG::OnBattleEnd(bool endByTimer)
+{
+ // Remove relic
+ if (m_titansRelic)
+ m_titansRelic->RemoveFromWorld();
+ m_titansRelic = NULL;
+
+ // Remove turret
+ for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
+ {
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ {
+ if (Creature* creature = unit->ToCreature())
+ {
+ if (!endByTimer)
+ creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
+ HideNpc(creature);
+ }
+ }
+ }
+
+ if (!endByTimer) // One player triggered the relic
+ {
+ // Change all npc in keep
+ for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ ShowNpc(creature, true);
+
+ // Change all npc out of keep
+ for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ ShowNpc(creature, true);
+ }
+
+ // Update all graveyard, control is to defender when no wartime
+ for (uint8 i = 0; i < BATTLEFIELD_WG_GY_HORDE; i++)
+ if (BfGraveyard* graveyard = GetGraveyardById(i))
+ graveyard->GiveControlTo(GetDefenderTeam());
+
+ for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+
+ for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+
+ // Update portal defender faction
+ for (GameObjectSet::const_iterator itr = DefenderPortalList.begin(); itr != DefenderPortalList.end(); ++itr)
+ (*itr)->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
+
+ // Saving data
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ (*itr)->Save();
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ (*itr)->Save();
+
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ player->CastSpell(player, SPELL_ESSENCE_OF_WINTERGRASP, true);
+ player->CastSpell(player, SPELL_VICTORY_REWARD, true);
+ // Send Wintergrasp victory achievement
+ DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player);
+ // Award achievement for succeeding in Wintergrasp in 10 minutes or less
+ if (!endByTimer && GetTimer() <= 10000)
+ DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG_TIMER_10, player);
+ }
+ }
+
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->CastSpell(player, SPELL_DEFEAT_REWARD, true);
+
+ for (uint8 team = 0; team < 2; ++team)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ RemoveAurasFromPlayer(player);
+
+ m_PlayersInWar[team].clear();
+
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ if (creature->IsVehicle())
+ creature->GetVehicleKit()->Dismiss();
+
+ m_vehicles[team].clear();
+ }
+
+ if (!endByTimer)
+ {
+ for (uint8 team = 0; team < 2; ++team)
+ {
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ player->RemoveAurasDueToSpell(m_DefenderTeam == TEAM_ALLIANCE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player->GetGUID());
+ player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player);
+ }
+ }
+ }
+ }
+
+ if (!endByTimer) // win alli/horde
+ SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : BATTLEFIELD_WG_TEXT_WIN_KEEP + 1);
+ else // defend alli/horde
+ SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_DEFEND_KEEP : BATTLEFIELD_WG_TEXT_DEFEND_KEEP + 1);
+}
+
+// *******************************************************
+// ******************* Reward System *********************
+// *******************************************************
+void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 /*incrementNumber*/)
+{
+ AchievementEntry const* achievementEntry = sAchievementStore.LookupEntry(achievement);
+
+ if (!achievementEntry)
+ return;
+
+ switch (achievement)
+ {
+ case ACHIEVEMENTS_WIN_WG_100:
+ {
+ // player->GetAchievementMgr().UpdateAchievementCriteria();
+ }
+ default:
+ {
+ if (player)
+ player->CompletedAchievement(achievementEntry);
+ break;
+ }
+ }
+
+}
+
+void BattlefieldWG::OnStartGrouping()
+{
+ SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START);
+}
+
+uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId)
+{
+ switch (areaId)
+ {
+ case AREA_WINTERGRASP_FORTRESS:
+ return BATTLEFIELD_WG_GY_KEEP;
+ case AREA_THE_SUNKEN_RING:
+ return BATTLEFIELD_WG_GY_WORKSHOP_NE;
+ case AREA_THE_BROKEN_TEMPLATE:
+ return BATTLEFIELD_WG_GY_WORKSHOP_NW;
+ case AREA_WESTPARK_WORKSHOP:
+ return BATTLEFIELD_WG_GY_WORKSHOP_SW;
+ case AREA_EASTPARK_WORKSHOP:
+ return BATTLEFIELD_WG_GY_WORKSHOP_SE;
+ case AREA_WINTERGRASP:
+ return BATTLEFIELD_WG_GY_ALLIANCE;
+ case AREA_THE_CHILLED_QUAGMIRE:
+ return BATTLEFIELD_WG_GY_HORDE;
+ default:
+ sLog->outError(LOG_FILTER_GENERAL, "BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId);
+ break;
+ }
+
+ return 0;
+}
+
+void BattlefieldWG::OnCreatureCreate(Creature* creature)
+{
+ // Accessing to db spawned creatures
+ switch (creature->GetEntry())
+ {
+ case NPC_DWARVEN_SPIRIT_GUIDE:
+ case NPC_TAUNKA_SPIRIT_GUIDE:
+ {
+ TeamId teamId = (creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE);
+ uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId());
+ if (m_GraveyardList[graveyardId])
+ m_GraveyardList[graveyardId]->SetSpirit(creature, teamId);
+ break;
+ }
+ }
+
+ // untested code - not sure if it is valid.
+ if (IsWarTime())
+ {
+ switch (creature->GetEntry())
+ {
+ case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE:
+ case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
+ case NPC_WINTERGRASP_CATAPULT:
+ case NPC_WINTERGRASP_DEMOLISHER:
+ {
+ if (!creature->GetCreatorGUID() || !sObjectAccessor->FindPlayer(creature->GetCreatorGUID()))
+ {
+ creature->setDeathState(DEAD);
+ creature->RemoveFromWorld();
+ return;
+ }
+ Player* creator = sObjectAccessor->FindPlayer(creature->GetCreatorGUID());
+ TeamId team = creator->GetTeamId();
+
+ if (team == TEAM_HORDE)
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H))
+ {
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1);
+ creature->AddAura(SPELL_HORDE_FLAG, creature);
+ creature->setFaction(creator->getFaction());
+ m_vehicles[team].insert(creature->GetGUID());
+ UpdateVehicleCountWG();
+ }
+ else
+ {
+ creature->setDeathState(DEAD);
+ creature->RemoveFromWorld();
+ return;
+ }
+ }
+ else
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A))
+ {
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1);
+ creature->AddAura(SPELL_ALLIANCE_FLAG,creature);
+ creature->setFaction(creator->getFaction());
+ m_vehicles[team].insert(creature->GetGUID());
+ UpdateVehicleCountWG();
+ }
+ else
+ {
+ creature->setDeathState(DEAD);
+ creature->RemoveFromWorld();
+ return;
+ }
+ }
+
+ creature->CastSpell(creator, SPELL_GRAB_PASSENGER, true);
+ break;
+ }
+ }
+ }
+}
+
+void BattlefieldWG::OnCreatureRemove(Creature* /*creature*/)
+{
+/* possibly can be used later
+ if (IsWarTime())
+ {
+ switch (creature->GetEntry())
+ {
+ case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE:
+ case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
+ case NPC_WINTERGRASP_CATAPULT:
+ case NPC_WINTERGRASP_DEMOLISHER:
+ {
+ uint8 team;
+ if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
+ team = TEAM_ALLIANCE;
+ else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE])
+ team = TEAM_HORDE;
+ else
+ return;
+
+ m_vehicles[team].erase(creature->GetGUID());
+ if (team == TEAM_HORDE)
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1);
+ else
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1);
+ UpdateVehicleCountWG();
+
+ break;
+ }
+ }
+ }*/
+}
+
+void BattlefieldWG::OnGameObjectCreate(GameObject* go)
+{
+ bool isWorkshop = false;
+ uint8 workshopId = 0;
+
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FACTORY_BANNER_NE:
+ isWorkshop = true;
+ workshopId = BATTLEFIELD_WG_WORKSHOP_NE;
+ break;
+ case GO_WINTERGRASP_FACTORY_BANNER_NW:
+ isWorkshop = true;
+ workshopId = BATTLEFIELD_WG_WORKSHOP_NW;
+ break;
+ case GO_WINTERGRASP_FACTORY_BANNER_SE:
+ isWorkshop = true;
+ workshopId = BATTLEFIELD_WG_WORKSHOP_SE;
+ break;
+ case GO_WINTERGRASP_FACTORY_BANNER_SW:
+ isWorkshop = true;
+ workshopId = BATTLEFIELD_WG_WORKSHOP_SW;
+ break;
+
+ }
+
+ if (!isWorkshop)
+ return;
+
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ {
+ if (WGWorkshop* workshop = (*itr))
+ {
+ if (workshop->workshopId == workshopId)
+ {
+ WintergraspCapturePoint* capturePoint = new WintergraspCapturePoint(this, GetAttackerTeam());
+
+ capturePoint->SetCapturePointData(go);
+ capturePoint->LinkToWorkshop(workshop);
+ AddCapturePoint(capturePoint);
+ break;
+ }
+ }
+ }
+}
+
+// Called when player kill a unit in wg zone
+void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
+{
+ if (killer == victim)
+ return;
+
+ bool again = false;
+ TeamId killerTeam = killer->GetTeamId();
+
+ if (victim->GetTypeId() == TYPEID_PLAYER)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ if (player->GetDistance2d(killer) < 40)
+ PromotePlayer(player);
+ return;
+ }
+
+ for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killerTeam)].begin();
+ itr != KeepCreature[GetOtherTeam(killerTeam)].end(); ++itr)
+ {
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ {
+ if (Creature* creature = unit->ToCreature())
+ {
+ if (victim->GetEntry() == creature->GetEntry() && !again)
+ {
+ again = true;
+ for (GuidSet::const_iterator iter = m_PlayersInWar[killerTeam].begin(); iter != m_PlayersInWar[killerTeam].end(); ++iter)
+ if (Player* player = sObjectAccessor->FindPlayer(*iter))
+ if (player->GetDistance2d(killer) < 40.0f)
+ PromotePlayer(player);
+ }
+ }
+ }
+ }
+ // TODO:Recent PvP activity worldstate
+}
+
+bool BattlefieldWG::FindAndRemoveVehicleFromList(Unit* vehicle)
+{
+ for (uint32 itr = 0; itr < 2; ++itr)
+ {
+ if (m_vehicles[itr].find(vehicle->GetGUID()) != m_vehicles[itr].end())
+ {
+ m_vehicles[itr].erase(vehicle->GetGUID());
+ if (itr == WintergraspFaction[TEAM_HORDE])
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H,-1);
+ else
+ UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A,-1);
+ return true;
+ }
+ }
+ return false;
+}
+
+void BattlefieldWG::OnUnitDeath(Unit* unit)
+{
+ if (IsWarTime())
+ if (unit->IsVehicle())
+ if (FindAndRemoveVehicleFromList(unit))
+ UpdateVehicleCountWG();
+}
+
+// Update rank for player
+void BattlefieldWG::PromotePlayer(Player* killer)
+{
+ if (!m_isActive)
+ return;
+ // Updating rank of player
+ if (Aura* aur = killer->GetAura(SPELL_RECRUIT))
+ {
+ if (aur->GetStackAmount() >= 5)
+ {
+ killer->RemoveAura(SPELL_RECRUIT);
+ killer->CastSpell(killer, SPELL_CORPORAL, true);
+ SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_FIRSTRANK);
+ }
+ else
+ killer->CastSpell(killer, SPELL_RECRUIT, true);
+ }
+ else if (Aura* aur = killer->GetAura(SPELL_CORPORAL))
+ {
+ if (aur->GetStackAmount() >= 5)
+ {
+ killer->RemoveAura(SPELL_CORPORAL);
+ killer->CastSpell(killer, SPELL_LIEUTENANT, true);
+ SendWarningToPlayer(killer, BATTLEFIELD_WG_TEXT_SECONDRANK);
+ }
+ else
+ killer->CastSpell(killer, SPELL_CORPORAL, true);
+ }
+}
+
+void BattlefieldWG::RemoveAurasFromPlayer(Player* player)
+{
+ player->RemoveAurasDueToSpell(SPELL_RECRUIT);
+ player->RemoveAurasDueToSpell(SPELL_CORPORAL);
+ player->RemoveAurasDueToSpell(SPELL_LIEUTENANT);
+ player->RemoveAurasDueToSpell(SPELL_TOWER_CONTROL);
+ player->RemoveAurasDueToSpell(SPELL_SPIRITUAL_IMMUNITY);
+ player->RemoveAurasDueToSpell(SPELL_TENACITY);
+ player->RemoveAurasDueToSpell(SPELL_ESSENCE_OF_WINTERGRASP);
+ player->RemoveAurasDueToSpell(SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA);
+}
+
+void BattlefieldWG::OnPlayerJoinWar(Player* player)
+{
+ RemoveAurasFromPlayer(player);
+
+ player->CastSpell(player, SPELL_RECRUIT, true);
+
+ if (player->GetZoneId() != m_ZoneId)
+ {
+ if (player->GetTeamId() == GetDefenderTeam())
+ player->TeleportTo(571, 5345, 2842, 410, 3.14f);
+ else
+ {
+ if (player->GetTeamId() == TEAM_HORDE)
+ player->TeleportTo(571, 5025.857422f, 3674.628906f, 362.737122f, 4.135169f);
+ else
+ player->TeleportTo(571, 5101.284f, 2186.564f, 373.549f, 3.812f);
+ }
+ }
+
+ UpdateTenacity();
+
+ if (player->GetTeamId() == GetAttackerTeam())
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) < 3)
+ player->SetAuraStack(SPELL_TOWER_CONTROL, player, 3 - GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT));
+ }
+ else
+ {
+ if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) > 0)
+ player->SetAuraStack(SPELL_TOWER_CONTROL, player, GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT));
+ }
+ SendInitWorldStatesTo(player);
+}
+
+void BattlefieldWG::OnPlayerLeaveWar(Player* player)
+{
+ // Remove all aura from WG // TODO: false we can go out of this zone on retail and keep Rank buff, remove on end of WG
+ if (!player->GetSession()->PlayerLogout())
+ {
+ if (player->GetVehicle()) // Remove vehicle of player if he go out.
+ player->GetVehicle()->Dismiss();
+ RemoveAurasFromPlayer(player);
+ }
+
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT);
+}
+
+void BattlefieldWG::OnPlayerLeaveZone(Player* player)
+{
+ if (!m_isActive)
+ RemoveAurasFromPlayer(player);
+
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT);
+ player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROL_PHASE_SHIFT);
+}
+
+void BattlefieldWG::OnPlayerEnterZone(Player* player)
+{
+ if (!m_isActive)
+ RemoveAurasFromPlayer(player);
+
+ player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player);
+ // Send worldstate to player
+ SendInitWorldStatesTo(player);
+}
+
+uint32 BattlefieldWG::GetData(uint32 data)
+{
+ switch (data)
+ {
+ // Used to determine when the phasing spells must be casted
+ // See: SpellArea::IsFitToRequirements
+ case AREA_THE_SUNKEN_RING:
+ case AREA_THE_BROKEN_TEMPLATE:
+ case AREA_WESTPARK_WORKSHOP:
+ case AREA_EASTPARK_WORKSHOP:
+ // Graveyards and Workshops are controlled by the same team.
+ if (m_GraveyardList[GetSpiritGraveyardId(data)])
+ return m_GraveyardList[GetSpiritGraveyardId(data)]->GetControlTeamId();
+ }
+
+ return Battlefield::GetData(data);
+}
+
+// Method sending worldsate to player
+WorldPacket BattlefieldWG::BuildInitWorldStates()
+{
+ WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (BuildingsInZone.size() * 8) + (WorkshopsList.size() * 8)));
+
+ data << uint32(m_MapId);
+ data << uint32(m_ZoneId);
+ data << uint32(0);
+ data << uint16(4 + 2 + 4 + BuildingsInZone.size() + WorkshopsList.size());
+
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_ATTACKER) << uint32(GetAttackerTeam());
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) << uint32(GetDefenderTeam());
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) << uint32(IsWarTime()? 0 : 1); // Note: cleanup these two, their names look awkward
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE) << uint32(IsWarTime()? 1 : 0);
+
+ for (uint32 i = 0; i < 2; ++i)
+ data << ClockWorldState[i] << uint32(time(NULL) + (m_Timer / 1000));
+
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H);
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_A));
+ data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A);
+
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ data << (*itr)->m_WorldState << (*itr)->m_State;
+
+ for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
+ if (*itr)
+ data << WorkshopsData[(*itr)->workshopId].worldstate << (*itr)->state;
+
+ return data;
+}
+
+void BattlefieldWG::SendInitWorldStatesTo(Player* player)
+{
+ WorldPacket data = BuildInitWorldStates();
+ player->GetSession()->SendPacket(&data);
+}
+
+void BattlefieldWG::SendInitWorldStatesToAll()
+{
+ WorldPacket data = BuildInitWorldStates();
+ for (uint8 team = 0; team < 2; team++)
+ for (GuidSet::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->GetSession()->SendPacket(&data);
+}
+
+void BattlefieldWG::BrokenWallOrTower(TeamId /*team*/)
+{
+// might be some use for this in the future. old code commented out below. KL
+/* if (team == GetDefenderTeam())
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
+ {
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ IncrementQuest(player, WGQuest[player->GetTeamId()][2], true);
+ }
+ }*/
+}
+
+// Called when a tower is broke
+void BattlefieldWG::UpdatedDestroyedTowerCount(TeamId team)
+{
+ // Destroy an attack tower
+ if (team == GetAttackerTeam())
+ {
+ // Update counter
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, -1);
+ UpdateData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 1);
+
+ // Remove buff stack on attackers
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->RemoveAuraFromStack(SPELL_TOWER_CONTROL);
+
+ // Add buff stack to defenders
+ for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ {
+ player->CastSpell(player, SPELL_TOWER_CONTROL, true);
+ DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player);
+ }
+
+ // If all three south towers are destroyed (ie. all attack towers), remove ten minutes from battle time
+ if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) == 3)
+ {
+ if (int32(m_Timer - 600000) < 0)
+ m_Timer = 0;
+ else
+ m_Timer -= 600000;
+ SendInitWorldStatesToAll();
+ }
+ }
+ else
+ {
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, -1);
+ UpdateData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 1);
+ }
+}
+
+void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId)
+{
+ if (!obj || !IsWarTime())
+ return;
+
+ // We handle only gameobjects here
+ GameObject* go = obj->ToGameObject();
+ if (!go)
+ return;
+
+ // On click on titan relic
+ if (go->GetEntry() == GO_WINTERGRASP_TITAN_S_RELIC)
+ {
+ if (CanInteractWithRelic())
+ EndBattle(false);
+ else
+ GetRelic()->SetRespawnTime(RESPAWN_IMMEDIATELY);
+ }
+
+ // if destroy or damage event, search the wall/tower and update worldstate/send warning message
+ for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
+ {
+ if (go->GetEntry() == (*itr)->m_Build->GetEntry())
+ {
+ if ((*itr)->m_Build->GetGOInfo()->building.damagedEvent == eventId)
+ (*itr)->Damaged();
+
+ if ((*itr)->m_Build->GetGOInfo()->building.destroyedEvent == eventId)
+ (*itr)->Destroyed();
+
+ break;
+ }
+ }
+}
+
+// Called when a tower is damaged, used for honor reward calcul
+void BattlefieldWG::UpdateDamagedTowerCount(TeamId team)
+{
+ if (team == GetAttackerTeam())
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 1);
+ else
+ UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 1);
+}
+
+// Update vehicle count WorldState to player
+void BattlefieldWG::UpdateVehicleCountWG()
+{
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H));
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A));
+ SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A));
+}
+
+void BattlefieldWG::UpdateTenacity()
+{
+ TeamId team = TEAM_NEUTRAL;
+ uint32 alliancePlayers = m_PlayersInWar[TEAM_ALLIANCE].size();
+ uint32 hordePlayers = m_PlayersInWar[TEAM_HORDE].size();
+ int32 newStack = 0;
+
+ if (alliancePlayers && hordePlayers)
+ {
+ if (alliancePlayers < hordePlayers)
+ newStack = int32((float(hordePlayers / alliancePlayers) - 1) * 4); // positive, should cast on alliance
+ else if (alliancePlayers > hordePlayers)
+ newStack = int32((1 - float(alliancePlayers / hordePlayers)) * 4); // negative, should cast on horde
+ }
+
+ if (newStack == int32(m_tenacityStack))
+ return;
+
+ if (m_tenacityStack > 0 && newStack <= 0) // old buff was on alliance
+ team = TEAM_ALLIANCE;
+ else if (newStack >= 0) // old buff was on horde
+ team = TEAM_HORDE;
+
+ m_tenacityStack = newStack;
+ // Remove old buff
+ if (team != TEAM_NEUTRAL)
+ {
+ for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ if (player->getLevel() >= m_MinLevel)
+ player->RemoveAurasDueToSpell(SPELL_TENACITY);
+
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ creature->RemoveAurasDueToSpell(SPELL_TENACITY_VEHICLE);
+ }
+
+ // Apply new buff
+ if (newStack)
+ {
+ team = newStack > 0 ? TEAM_ALLIANCE : TEAM_HORDE;
+
+ if (newStack < 0)
+ newStack = -newStack;
+ if (newStack > 20)
+ newStack = 20;
+
+ uint32 buff_honor = SPELL_GREATEST_HONOR;
+ if (newStack < 15)
+ buff_honor = SPELL_GREATER_HONOR;
+ if (newStack < 10)
+ buff_honor = SPELL_GREAT_HONOR;
+ if (newStack < 5)
+ buff_honor = 0;
+
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->SetAuraStack(SPELL_TENACITY, player, newStack);
+
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, newStack);
+
+ if (buff_honor != 0)
+ {
+ for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
+ if (Player* player = sObjectAccessor->FindPlayer(*itr))
+ player->CastSpell(player, buff_honor, true);
+ for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ creature->CastSpell(creature, buff_honor, true);
+ }
+ }
+}
+
+WintergraspCapturePoint::WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl) : BfCapturePoint(battlefield)
+{
+ m_Bf = battlefield;
+ m_team = teamInControl;
+}
+
+void WintergraspCapturePoint::ChangeTeam(TeamId /*oldTeam*/)
+{
+ m_Workshop->GiveControlTo(m_team, false);
+}
+
+BfGraveyardWG::BfGraveyardWG(BattlefieldWG* battlefield) : BfGraveyard(battlefield)
+{
+ m_Bf = battlefield;
+}
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h
new file mode 100644
index 00000000000..97807eb989c
--- /dev/null
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h
@@ -0,0 +1,1761 @@
+/*
+ * Copyright (C) 2008-2010 TrinityCore <http://www.trinitycore.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef BATTLEFIELD_WG_
+#define BATTLEFIELD_WG_
+
+#include "ObjectAccessor.h"
+#include "WorldPacket.h"
+#include "World.h"
+#include "Group.h"
+#include "GroupMgr.h"
+#include "Battlefield.h"
+
+const uint32 VehNumWorldState[2] = { 3680, 3490 };
+const uint32 MaxVehNumWorldState[2] = { 3681, 3491 };
+const uint32 ClockWorldState[2] = { 3781, 4354 };
+const uint32 WintergraspFaction[3] = { 1, 2, 35 };
+const float WintergraspStalkerPos[4] = { 0, 0, 0, 0 };
+
+class BattlefieldWG;
+class WintergraspCapturePoint;
+
+struct BfWGGameObjectBuilding;
+struct WGWorkshop;
+
+typedef std::set<GameObject*> GameObjectSet;
+typedef std::set<BfWGGameObjectBuilding*> GameObjectBuilding;
+typedef std::set<WGWorkshop*> Workshop;
+typedef std::set<Group*> GroupSet;
+//typedef std::set<WintergraspCapturePoint *> CapturePointSet; unused ?
+
+enum WintergraspSpells
+{
+ // Wartime auras
+ SPELL_RECRUIT = 37795,
+ SPELL_CORPORAL = 33280,
+ SPELL_LIEUTENANT = 55629,
+ SPELL_TENACITY = 58549,
+ SPELL_TENACITY_VEHICLE = 59911,
+ SPELL_TOWER_CONTROL = 62064,
+ SPELL_SPIRITUAL_IMMUNITY = 58729,
+ SPELL_GREAT_HONOR = 58555,
+ SPELL_GREATER_HONOR = 58556,
+ SPELL_GREATEST_HONOR = 58557,
+ SPELL_ALLIANCE_FLAG = 14268,
+ SPELL_HORDE_FLAG = 14267,
+ SPELL_GRAB_PASSENGER = 61178,
+
+ // Reward spells
+ SPELL_VICTORY_REWARD = 56902,
+ SPELL_DEFEAT_REWARD = 58494,
+ SPELL_DAMAGED_TOWER = 59135,
+ SPELL_DESTROYED_TOWER = 59136,
+ SPELL_DAMAGED_BUILDING = 59201,
+ SPELL_INTACT_BUILDING = 59203,
+
+ SPELL_TELEPORT_BRIDGE = 59096,
+ SPELL_TELEPORT_FORTRESS = 60035,
+
+ SPELL_TELEPORT_DALARAN = 53360,
+ SPELL_VICTORY_AURA = 60044,
+
+ // Other spells
+ SPELL_WINTERGRASP_WATER = 36444,
+ SPELL_ESSENCE_OF_WINTERGRASP = 58045,
+ SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA = 58730,
+
+ // Phasing spells
+ SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT = 56618,// ADDS PHASE 16
+ SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT = 56617,// ADDS PHASE 32
+
+ SPELL_HORDE_CONTROL_PHASE_SHIFT = 55773,// ADDS PHASE 64
+ SPELL_ALLIANCE_CONTROL_PHASE_SHIFT = 55774,// ADDS PHASE 128
+};
+
+enum WintergraspData
+{
+ BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF,
+ BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF,
+ BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT,
+ BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT,
+ BATTLEFIELD_WG_DATA_MAX_VEHICLE_A,
+ BATTLEFIELD_WG_DATA_MAX_VEHICLE_H,
+ BATTLEFIELD_WG_DATA_VEHICLE_A,
+ BATTLEFIELD_WG_DATA_VEHICLE_H,
+ BATTLEFIELD_WG_DATA_MAX,
+};
+
+enum WintergraspAchievements
+{
+ ACHIEVEMENTS_WIN_WG = 1717,
+ ACHIEVEMENTS_WIN_WG_100 = 1718, // todo
+ ACHIEVEMENTS_WG_GNOMESLAUGHTER = 1723, // todo
+ ACHIEVEMENTS_WG_TOWER_DESTROY = 1727,
+ ACHIEVEMENTS_DESTRUCTION_DERBY_A = 1737, // todo
+ ACHIEVEMENTS_WG_TOWER_CANNON_KILL = 1751, // todo
+ ACHIEVEMENTS_WG_MASTER_A = 1752, // todo
+ ACHIEVEMENTS_WIN_WG_TIMER_10 = 1755,
+ ACHIEVEMENTS_STONE_KEEPER_50 = 2085, // todo
+ ACHIEVEMENTS_STONE_KEEPER_100 = 2086, // todo
+ ACHIEVEMENTS_STONE_KEEPER_250 = 2087, // todo
+ ACHIEVEMENTS_STONE_KEEPER_500 = 2088, // todo
+ ACHIEVEMENTS_STONE_KEEPER_1000 = 2089, // todo
+ ACHIEVEMENTS_WG_RANGER = 2199, // todo
+ ACHIEVEMENTS_DESTRUCTION_DERBY_H = 2476, // todo
+ ACHIEVEMENTS_WG_MASTER_H = 2776, // todo
+};
+
+enum WintergraspWorldStates
+{
+ BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H = 3490,
+ BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H = 3491,
+ BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A = 3680,
+ BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A = 3681,
+ BATTLEFIELD_WG_WORLD_STATE_ACTIVE = 3801,
+ BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802,
+ BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803,
+ BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE = 3710,
+};
+
+enum WintergraspAreaIds
+{
+ AREA_WINTERGRASP_FORTRESS = 4575,
+ AREA_THE_SUNKEN_RING = 4538,
+ AREA_THE_BROKEN_TEMPLATE = 4539,
+ AREA_WESTPARK_WORKSHOP = 4611,
+ AREA_EASTPARK_WORKSHOP = 4612,
+ AREA_WINTERGRASP = 4197,
+ AREA_THE_CHILLED_QUAGMIRE = 4589,
+};
+
+/*#########################
+ *####### Graveyards ######
+ *#########################*/
+
+class BfGraveyardWG : public BfGraveyard
+{
+ public:
+ BfGraveyardWG(BattlefieldWG *Bf);
+
+ void SetTextId(uint32 textid) { m_GossipTextId = textid; }
+ uint32 GetTextId() { return m_GossipTextId; }
+ protected:
+ uint32 m_GossipTextId;
+};
+
+enum WGGraveyardId
+{
+ BATTLEFIELD_WG_GY_WORKSHOP_NE,
+ BATTLEFIELD_WG_GY_WORKSHOP_NW,
+ BATTLEFIELD_WG_GY_WORKSHOP_SE,
+ BATTLEFIELD_WG_GY_WORKSHOP_SW,
+ BATTLEFIELD_WG_GY_KEEP,
+ BATTLEFIELD_WG_GY_HORDE,
+ BATTLEFIELD_WG_GY_ALLIANCE,
+ BATTLEFIELD_WG_GRAVEYARD_MAX,
+};
+
+enum WGGossipText
+{
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = -1850501,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = -1850502,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_SE = -1850504,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_SW = -1850503,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP = -1850500,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE = -1850505,
+ BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE = -1850506,
+};
+
+enum WintergraspNpcs
+{
+ BATTLEFIELD_WG_NPC_GUARD_H = 30739,
+ BATTLEFIELD_WG_NPC_GUARD_A = 30740,
+ BATTLEFIELD_WG_NPC_STALKER = 15214,
+
+ BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER = 31102,
+ BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR = 32296,// <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN = 31101,// <MASTER HEXXER>
+ BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI = 39173,// <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH = 31091,
+ BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH = 31151,
+ BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF = 31106,
+ BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT = 31053,
+ BATTLEFIELD_WG_NPC_LIEUTENANT_MURP = 31107,
+
+ BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH = 31052,
+ BATTLEFIELD_WG_NPC_KNIGHT_DAMERON = 32294,// <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA = 31051,// <ENCHANTRESS>
+ BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER = 39172,// <WINTERGRASP QUARTERMASTER>
+ BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH = 31036,
+ BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS = 31153,
+ BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE = 31108,
+ BATTLEFIELD_WG_NPC_ANCHORITE_TESSA = 31054,
+ BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO = 31109,
+
+ NPC_TAUNKA_SPIRIT_GUIDE = 31841, // Horde spirit guide for Wintergrasp
+ NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp
+ NPC_TOWER_CANNON = 28366,
+
+ NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE = 28312,
+ NPC_WINTERGRASP_SIEGE_ENGINE_HORDE = 32627,
+ NPC_WINTERGRASP_CATAPULT = 27881,
+ NPC_WINTERGRASP_DEMOLISHER = 28094,
+ NPC_WINTERGRASP_TOWER_CANNON = 28366,
+};
+
+struct BfWGCoordGY
+{
+ float x;
+ float y;
+ float z;
+ float o;
+ uint32 gyid;
+ uint8 type;
+ uint32 textid; // for gossip menu
+ TeamId startcontrol;
+};
+
+uint32 const WGQuest[2][6] =
+{
+ { 13186, 13181, 13222, 13538, 13177, 13179 },
+ { 13185, 13183, 13223, 13539, 13178, 13180 },
+};
+// 7 in sql, 7 in header
+BfWGCoordGY const WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] =
+{
+ { 5104.750f, 2300.940f, 368.579f, 0.733038f, 1329, BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GOSSIPTEXT_GY_NE, TEAM_NEUTRAL },
+ { 5099.120f, 3466.036f, 368.484f, 5.317802f, 1330, BATTLEFIELD_WG_GY_WORKSHOP_NW, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW, TEAM_NEUTRAL },
+ { 4314.648f, 2408.522f, 392.642f, 6.268125f, 1333, BATTLEFIELD_WG_GY_WORKSHOP_SE, BATTLEFIELD_WG_GOSSIPTEXT_GY_SE, TEAM_NEUTRAL },
+ { 4331.716f, 3235.695f, 390.251f, 0.008500f, 1334, BATTLEFIELD_WG_GY_WORKSHOP_SW, BATTLEFIELD_WG_GOSSIPTEXT_GY_SW, TEAM_NEUTRAL },
+ { 5537.986f, 2897.493f, 517.057f, 4.819249f, 1285, BATTLEFIELD_WG_GY_KEEP, BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP, TEAM_NEUTRAL },
+ { 5032.454f, 3711.382f, 372.468f, 3.971623f, 1331, BATTLEFIELD_WG_GY_HORDE, BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE, TEAM_HORDE },
+ { 5140.790f, 2179.120f, 390.950f, 1.972220f, 1332, BATTLEFIELD_WG_GY_ALLIANCE, BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE, TEAM_ALLIANCE },
+};
+
+/* ######################### *
+ * WintergraspCapturePoint *
+ * ######################### */
+
+class WintergraspCapturePoint : public BfCapturePoint
+{
+ public:
+ WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl);
+
+ void LinkToWorkshop(WGWorkshop* workshop) { m_Workshop = workshop; }
+
+ void ChangeTeam(TeamId oldteam);
+ TeamId GetTeam() const { return m_team; }
+
+ protected:
+ WGWorkshop* m_Workshop;
+};
+
+/* ######################### *
+ * WinterGrasp Battlefield *
+ * ######################### */
+
+class BattlefieldWG : public Battlefield
+{
+ public:
+ /**
+ * \brief Called when the battle start
+ * - Spawn relic and turret
+ * - Rebuild tower and wall
+ * - Invite player to war
+ */
+ void OnBattleStart();
+
+ /**
+ * \brief Called when battle end
+ * - Remove relic and turret
+ * - Change banner/npc in keep if it needed
+ * - Saving battlestate
+ * - Reward honor/mark to player
+ * - Remove vehicle
+ * \param endByTimer : true if battle ended when timer is at 00:00, false if battle ended by clicking on relic
+ */
+ void OnBattleEnd(bool endByTimer);
+
+ /**
+ * \brief Called when grouping starts (15 minutes before battlestart)
+ * - Invite all player in zone to join queue
+ */
+ void OnStartGrouping();
+
+ /**
+ * \brief Called when player accept invite to join battle
+ * - Update aura
+ * - Teleport if it needed
+ * - Update worldstate
+ * - Update tenacity
+ * \param player: Player who accepted invite
+ */
+ void OnPlayerJoinWar(Player* player);
+
+ /**
+ * \brief Called when player left the battle
+ * - Update player aura
+ * \param player : Player who left the battle
+ */
+ void OnPlayerLeaveWar(Player* player);
+
+ /**
+ * \brief Called when player left the WG zone
+ * \param player : Player who left the zone
+ */
+ void OnPlayerLeaveZone(Player* player);
+
+ /**
+ * \brief Called when player enters in WG zone
+ * - Update aura
+ * - Update worldstate
+ * \param player : Player who enters the zone
+ */
+ void OnPlayerEnterZone(Player* player);
+
+ /**
+ * \brief Called for update battlefield data
+ * - Save battle timer in database every minutes
+ * - Update imunity aura from graveyard
+ * \param diff : time elapsed since the last call (in ms)
+ */
+ bool Update(uint32 diff);
+
+ /**
+ * \brief Called when a creature is created
+ * - Update vehicle count
+ */
+ void OnCreatureCreate(Creature* creature);
+
+ /**
+ * \brief Called when a creature is removed
+ * - Update vehicle count
+ */
+ void OnCreatureRemove(Creature* creature);
+
+ /**
+ * \brief Called when a gameobject is created
+ */
+ void OnGameObjectCreate(GameObject* go);
+
+ /**
+ * \brief Called when a wall/tower is broken
+ * - Update quest
+ */
+ void BrokenWallOrTower(TeamId team);
+
+ /**
+ * \brief Called when a tower is damaged
+ * - Update tower count (for reward calcul)
+ */
+ void UpdateDamagedTowerCount(TeamId team);
+
+ /**
+ * \brief Called when tower is broken
+ * - Update tower buff
+ * - check if three south tower is down for remove 10 minutes to wg
+ */
+ void UpdatedDestroyedTowerCount(TeamId team);
+
+ void DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 incrementNumber = 1);
+
+ void RemoveAurasFromPlayer(Player* player);
+
+ /**
+ * \brief Called when battlefield is setup, at server start
+ */
+ bool SetupBattlefield();
+
+ /// Return pointer to relic object
+ GameObject* GetRelic() { return m_titansRelic; }
+
+ /// Define relic object
+ void SetRelic(GameObject* relic) { m_titansRelic = relic; }
+
+ /// Check if players can interact with the relic (Only if the last door has been broken)
+ bool CanInteractWithRelic() { return m_isRelicInteractible; }
+
+ /// Define if player can interact with the relic
+ void SetRelicInteractible(bool allow) { m_isRelicInteractible = allow; }
+
+ void UpdateVehicleCountWG();
+ void UpdateCounterVehicle(bool init);
+
+ WorldPacket BuildInitWorldStates();
+ void SendInitWorldStatesTo(Player* player);
+ void SendInitWorldStatesToAll();
+
+ void HandleKill(Player* killer, Unit* victim);
+ void OnUnitDeath(Unit* unit);
+ void PromotePlayer(Player* killer);
+
+ void UpdateTenacity();
+ void ProcessEvent(WorldObject *obj, uint32 eventId);
+
+ bool FindAndRemoveVehicleFromList(Unit* vehicle);
+
+ // returns the graveyardId in the specified area.
+ uint8 GetSpiritGraveyardId(uint32 areaId);
+
+ uint32 GetData(uint32 data);
+ protected:
+ bool m_isRelicInteractible;
+
+ Workshop WorkshopsList;
+
+ GameObjectSet DefenderPortalList;
+ GameObjectSet m_KeepGameObject[2];
+ GameObjectBuilding BuildingsInZone;
+
+ GuidSet m_vehicles[2];
+ GuidSet CanonList;
+ GuidSet KeepCreature[2];
+ GuidSet OutsideCreature[2];
+
+ uint32 m_tenacityStack;
+ uint32 m_saveTimer;
+
+ GameObject* m_titansRelic;
+};
+
+const uint32 NORTHREND_WINTERGRASP = 4197;
+const uint8 WG_MAX_OBJ = 32;
+const uint8 WG_KEEPGAMEOBJECT_MAX = 44;
+const uint8 WG_MAX_TURRET = 15;
+const uint8 WG_MAX_KEEP_NPC = 39;
+const uint8 WG_MAX_OUTSIDE_NPC = 14;
+const uint8 WG_OUTSIDE_ALLIANCE_NPC = 7;
+const uint8 WG_MAX_TELEPORTER = 12;
+
+enum WintergraspGameObjectBuildingType
+{
+ BATTLEFIELD_WG_OBJECTTYPE_DOOR,
+ BATTLEFIELD_WG_OBJECTTYPE_TITANRELIC,
+ BATTLEFIELD_WG_OBJECTTYPE_WALL,
+ BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST,
+ BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER,
+ BATTLEFIELD_WG_OBJECTTYPE_TOWER,
+};
+
+enum WintergraspGameObjectState
+{
+ BATTLEFIELD_WG_OBJECTSTATE_NONE,
+ BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_INTACT,
+ BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_DAMAGE,
+ BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_DESTROY,
+ BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT,
+ BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE,
+ BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY,
+ BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT,
+ BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE,
+ BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY,
+};
+
+enum WintergraspWorkshopIds
+{
+ BATTLEFIELD_WG_WORKSHOP_NE,
+ BATTLEFIELD_WG_WORKSHOP_NW,
+ BATTLEFIELD_WG_WORKSHOP_SE,
+ BATTLEFIELD_WG_WORKSHOP_SW,
+ BATTLEFIELD_WG_WORKSHOP_KEEP_WEST,
+ BATTLEFIELD_WG_WORKSHOP_KEEP_EAST,
+};
+
+enum WintergraspWorldstates
+{
+ WORLDSTATE_WORKSHOP_NE = 3701,
+ WORLDSTATE_WORKSHOP_NW = 3700,
+ WORLDSTATE_WORKSHOP_SE = 3703,
+ WORLDSTATE_WORKSHOP_SW = 3702,
+ WORLDSTATE_WORKSHOP_K_W = 3698,
+ WORLDSTATE_WORKSHOP_K_E = 3699
+};
+
+enum eWGTeamControl
+{
+ BATTLEFIELD_WG_TEAM_ALLIANCE,
+ BATTLEFIELD_WG_TEAM_HORDE,
+ BATTLEFIELD_WG_TEAM_NEUTRAL,
+};
+
+// TODO: Handle this with creature_text ?
+enum eWGText
+{
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE = 12055,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW = 12052,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE = 12053,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW = 12054,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_ATTACK = 12051,
+ BATTLEFIELD_WG_TEXT_WORKSHOP_TAKEN = 12050,
+ BATTLEFIELD_WG_TEXT_ALLIANCE = 12057,
+ BATTLEFIELD_WG_TEXT_HORDE = 12056,
+ BATTLEFIELD_WG_TEXT_WILL_START = 12058,
+ BATTLEFIELD_WG_TEXT_START = 12067,
+ BATTLEFIELD_WG_TEXT_FIRSTRANK = 12059,
+ BATTLEFIELD_WG_TEXT_SECONDRANK = 12060,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NE = 12062,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NW = 12064,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SE = 12061,
+ BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SW = 12063,
+ BATTLEFIELD_WG_TEXT_TOWER_DAMAGE = 12065,
+ BATTLEFIELD_WG_TEXT_TOWER_DESTROY = 12066,
+ BATTLEFIELD_WG_TEXT_TOWER_NAME_S = 12069,
+ BATTLEFIELD_WG_TEXT_TOWER_NAME_E = 12070,
+ BATTLEFIELD_WG_TEXT_TOWER_NAME_W = 12071,
+ BATTLEFIELD_WG_TEXT_DEFEND_KEEP = 12068,
+ BATTLEFIELD_WG_TEXT_WIN_KEEP = 12072,
+};
+
+enum WintergraspGameObject
+{
+ GO_WINTERGRASP_FACTORY_BANNER_NE = 190475,
+ GO_WINTERGRASP_FACTORY_BANNER_NW = 190487,
+ GO_WINTERGRASP_FACTORY_BANNER_SE = 194959,
+ GO_WINTERGRASP_FACTORY_BANNER_SW = 194962,
+
+ GO_WINTERGRASP_TITAN_S_RELIC = 192829,
+
+ GO_WINTERGRASP_FORTRESS_TOWER_1 = 190221,
+ GO_WINTERGRASP_FORTRESS_TOWER_2 = 190373,
+ GO_WINTERGRASP_FORTRESS_TOWER_3 = 190377,
+ GO_WINTERGRASP_FORTRESS_TOWER_4 = 190378,
+
+ GO_WINTERGRASP_SHADOWSIGHT_TOWER = 190356,
+ GO_WINTERGRASP_WINTER_S_EDGE_TOWER = 190357,
+ GO_WINTERGRASP_FLAMEWATCH_TOWER = 190358,
+};
+
+struct WintergraspObjectPositionData
+{
+ float x;
+ float y;
+ float z;
+ float o;
+ uint32 entryHorde;
+ uint32 entryAlliance;
+};
+
+// *****************************************************
+// ************ Destructible (Wall,Tower..) ************
+// *****************************************************
+
+struct WintergraspBuildingSpawnData
+{
+ uint32 entry;
+ uint32 WorldState;
+ float x;
+ float y;
+ float z;
+ float o;
+ uint32 type;
+ uint32 nameId;
+};
+
+const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = {
+ // Wall (Not spawned in db)
+ // Entry WS X Y Z O type NameID
+ { 190219, 3749, 5371.46f, 3047.47f, 407.571f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190220, 3750, 5331.26f, 3047.1f, 407.923f, 0.052359f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191795, 3764, 5385.84f, 2909.49f, 409.713f, 0.00872f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191796, 3772, 5384.45f, 2771.84f, 410.27f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191799, 3762, 5371.44f, 2630.61f, 408.816f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191800, 3766, 5301.84f, 2909.09f, 409.866f, 0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191801, 3770, 5301.06f, 2771.41f, 409.901f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191802, 3751, 5280.2f, 2995.58f, 408.825f, 1.61443f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191803, 3752, 5279.14f, 2956.02f, 408.604f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191804, 3767, 5278.69f, 2882.51f, 409.539f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191806, 3769, 5279.5f, 2798.94f, 409.998f, 1.5708f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191807, 3759, 5279.94f, 2724.77f, 409.945f, 1.56207f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191808, 3760, 5279.6f, 2683.79f, 409.849f, 1.55334f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191809, 3761, 5330.96f, 2630.78f, 409.283f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190369, 3753, 5256.08f, 2933.96f, 409.357f, 3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190370, 3758, 5257.46f, 2747.33f, 409.743f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190371, 3754, 5214.96f, 2934.09f, 409.19f, -0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190372, 3757, 5215.82f, 2747.57f, 409.188f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190374, 3755, 5162.27f, 2883.04f, 410.256f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 190376, 3756, 5163.72f, 2799.84f, 409.227f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+
+ // Tower of keep (Not spawned in db)
+ { 190221, 3711, 5281.15f, 3044.59f, 407.843f, 3.11539f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NW },
+ { 190373, 3713, 5163.76f, 2932.23f, 409.19f, 3.12412f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SW },
+ { 190377, 3714, 5166.4f, 2748.37f, 409.188f, -1.5708f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_SE },
+ { 190378, 3712, 5281.19f, 2632.48f, 409.099f, -1.58825f, BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER, BATTLEFIELD_WG_TEXT_KEEPTOWER_NAME_NE },
+
+ // Wall (with passage) (Not spawned in db)
+ { 191797, 3765, 5343.29f, 2908.86f, 409.576f, 0.008724f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191798, 3771, 5342.72f, 2771.39f, 409.625f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+ { 191805, 3768, 5279.13f, 2840.8f, 409.783f, 1.57952f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
+
+ // South tower (Not spawned in db)
+ { 190356, 3704, 4557.17f, 3623.94f, 395.883f, 1.67552f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_W },
+ { 190357, 3705, 4398.17f, 2822.5f, 405.627f, -3.12412f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_S },
+ { 190358, 3706, 4459.1f, 1944.33f, 434.991f, -2.00276f, BATTLEFIELD_WG_OBJECTTYPE_TOWER, BATTLEFIELD_WG_TEXT_TOWER_NAME_E },
+
+ // Door of forteress (Not spawned in db)
+ { 190375, 3763, 5162.99f, 2841.23f, 410.162f, -3.13286f, BATTLEFIELD_WG_OBJECTTYPE_DOOR, 0 },
+
+ // Last door (Not spawned in db)
+ { 191810, 3773, 5397.11f, 2841.54f, 425.899f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST, 0 },
+};
+
+
+// *********************************************************
+// **********Keep Element(GameObject,Creature)**************
+// *********************************************************
+
+// Keep gameobject
+// 192488 : 10 in sql, 19 in header
+// 192501 : 12 in sql, 17 in header
+// 192416 : 1 in sql, 33 in header
+// 192374 : 1 in sql, 1 in header
+// 192375 : 1 in sql, 1 in header
+// 192336 : 1 in sql, 1 in header
+// 192255 : 1 in sql, 1 in header
+// 192269 : 1 in sql, 7 in header
+// 192254 : 1 in sql, 1 in header
+// 192349 : 1 in sql, 1 in header
+// 192366 : 1 in sql, 3 in header
+// 192367 : 1 in sql, 1 in header
+// 192364 : 1 in sql, 1 in header
+// 192370 : 1 in sql, 1 in header
+// 192369 : 1 in sql, 1 in header
+// 192368 : 1 in sql, 1 in header
+// 192362 : 1 in sql, 1 in header
+// 192363 : 1 in sql, 1 in header
+// 192379 : 1 in sql, 1 in header
+// 192378 : 1 in sql, 1 in header
+// 192355 : 1 in sql, 1 in header
+// 192354 : 1 in sql, 1 in header
+// 192358 : 1 in sql, 1 in header
+// 192359 : 1 in sql, 1 in header
+// 192338 : 1 in sql, 1 in header
+// 192339 : 1 in sql, 1 in header
+// 192284 : 1 in sql, 1 in header
+// 192285 : 1 in sql, 1 in header
+// 192371 : 1 in sql, 1 in header
+// 192372 : 1 in sql, 1 in header
+// 192373 : 1 in sql, 1 in header
+// 192360 : 1 in sql, 1 in header
+// 192361 : 1 in sql, 1 in header
+// 192356 : 1 in sql, 1 in header
+// 192352 : 1 in sql, 1 in header
+// 192353 : 1 in sql, 1 in header
+// 192357 : 1 in sql, 1 in header
+// 192350 : 1 in sql, 1 in header
+// 192351 : 1 in sql, 1 in header
+const WintergraspObjectPositionData WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = {
+ { 5262.540039f, 3047.949951f, 432.054993f, 3.106650f, 192488, 192501 }, // Flag on tower
+ { 5272.939941f, 2976.550049f, 444.492004f, 3.124120f, 192374, 192416 }, // Flag on Wall Intersect
+ { 5235.189941f, 2941.899902f, 444.278015f, 1.588250f, 192375, 192416 }, // Flag on Wall Intersect
+ { 5163.129883f, 2952.590088f, 433.502991f, 1.535890f, 192488, 192501 }, // Flag on tower
+ { 5145.109863f, 2935.000000f, 433.385986f, 3.141590f, 192488, 192501 }, // Flag on tower
+ { 5158.810059f, 2883.129883f, 431.618011f, 3.141590f, 192488, 192416 }, // Flag on wall
+ { 5154.490234f, 2862.149902f, 445.011993f, 3.141590f, 192336, 192416 }, // Flag on Wall Intersect
+ { 5154.520020f, 2853.310059f, 409.183014f, 3.141590f, 192255, 192269 }, // Flag on the floor
+ { 5154.459961f, 2828.939941f, 409.188995f, 3.141590f, 192254, 192269 }, // Flag on the floor
+ { 5155.310059f, 2820.739990f, 444.979004f, -3.13286f, 192349, 192416 }, // Flag on wall intersect
+ { 5160.339844f, 2798.610107f, 430.769012f, 3.141590f, 192488, 192416 }, // Flag on wall
+ { 5146.040039f, 2747.209961f, 433.584015f, 3.071770f, 192488, 192501 }, // Flag on tower
+ { 5163.779785f, 2729.679932f, 433.394012f, -1.58825f, 192488, 192501 }, // Flag on tower
+ { 5236.270020f, 2739.459961f, 444.992004f, -1.59698f, 192366, 192416 }, // Flag on wall intersect
+ { 5271.799805f, 2704.870117f, 445.183014f, -3.13286f, 192367, 192416 }, // Flag on wall intersect
+ { 5260.819824f, 2631.800049f, 433.324005f, 3.054330f, 192488, 192501 }, // Flag on tower
+ { 5278.379883f, 2613.830078f, 433.408997f, -1.58825f, 192488, 192501 }, // Flag on tower
+ { 5350.879883f, 2622.719971f, 444.686005f, -1.57080f, 192364, 192416 }, // Flag on wall intersect
+ { 5392.270020f, 2639.739990f, 435.330994f, 1.509710f, 192370, 192416 }, // Flag on wall intersect
+ { 5350.950195f, 2640.360107f, 435.407990f, 1.570800f, 192369, 192416 }, // Flag on wall intersect
+ { 5289.459961f, 2704.679932f, 435.875000f, -0.01745f, 192368, 192416 }, // Flag on wall intersect
+ { 5322.120117f, 2763.610107f, 444.973999f, -1.55334f, 192362, 192416 }, // Flag on wall intersect
+ { 5363.609863f, 2763.389893f, 445.023987f, -1.54462f, 192363, 192416 }, // Flag on wall intersect
+ { 5363.419922f, 2781.030029f, 435.763000f, 1.570800f, 192379, 192416 }, // Flag on wall intersect
+ { 5322.020020f, 2781.129883f, 435.811005f, 1.570800f, 192378, 192416 }, // Flag on wall intersect
+ { 5288.919922f, 2820.219971f, 435.721008f, 0.017452f, 192355, 192416 }, // Flag on wall intersect
+ { 5288.410156f, 2861.790039f, 435.721008f, 0.017452f, 192354, 192416 }, // Flag on wall intersect
+ { 5322.229980f, 2899.429932f, 435.808014f, -1.58825f, 192358, 192416 }, // Flag on wall intersect
+ { 5364.350098f, 2899.399902f, 435.838989f, -1.57080f, 192359, 192416 }, // Flag on wall intersect
+ { 5397.759766f, 2873.080078f, 455.460999f, 3.106650f, 192338, 192416 }, // Flag on keep
+ { 5397.390137f, 2809.330078f, 455.343994f, 3.106650f, 192339, 192416 }, // Flag on keep
+ { 5372.479980f, 2862.500000f, 409.049011f, 3.141590f, 192284, 192269 }, // Flag on floor
+ { 5371.490234f, 2820.800049f, 409.177002f, 3.141590f, 192285, 192269 }, // Flag on floor
+ { 5364.290039f, 2916.939941f, 445.330994f, 1.579520f, 192371, 192416 }, // Flag on wall intersect
+ { 5322.859863f, 2916.949951f, 445.153992f, 1.562070f, 192372, 192416 }, // Flag on wall intersect
+ { 5290.350098f, 2976.560059f, 435.221008f, 0.017452f, 192373, 192416 }, // Flag on wall intersect
+ { 5352.370117f, 3037.090088f, 435.252014f, -1.57080f, 192360, 192416 }, // Flag on wall intersect
+ { 5392.649902f, 3037.110107f, 433.713013f, -1.52716f, 192361, 192416 }, // Flag on wall intersect
+ { 5237.069824f, 2757.030029f, 435.795990f, 1.518440f, 192356, 192416 }, // Flag on wall intersect
+ { 5173.020020f, 2820.929932f, 435.720001f, 0.017452f, 192352, 192416 }, // Flag on wall intersect
+ { 5172.109863f, 2862.570068f, 435.721008f, 0.017452f, 192353, 192416 }, // Flag on wall intersect
+ { 5235.339844f, 2924.340088f, 435.040009f, -1.57080f, 192357, 192416 }, // Flag on wall intersect
+ { 5270.689941f, 2861.780029f, 445.058014f, -3.11539f, 192350, 192416 }, // Flag on wall intersect
+ { 5271.279785f, 2820.159912f, 445.200989f, -3.13286f, 192351, 192416 } // Flag on wall intersect
+};
+
+const Position WGTurret[WG_MAX_TURRET] = {
+ { 5391.19f, 3060.8f, 419.616f, 1.69557f },
+ { 5266.75f, 2976.5f, 421.067f, 3.20354f },
+ { 5234.86f, 2948.8f, 420.88f, 1.61311f },
+ { 5323.05f, 2923.7f, 421.645f, 1.5817f },
+ { 5363.82f, 2923.87f, 421.709f, 1.60527f },
+ { 5264.04f, 2861.34f, 421.587f, 3.21142f },
+ { 5264.68f, 2819.78f, 421.656f, 3.15645f },
+ { 5322.16f, 2756.69f, 421.646f, 4.69978f },
+ { 5363.78f, 2756.77f, 421.629f, 4.78226f },
+ { 5236.2f, 2732.68f, 421.649f, 4.72336f },
+ { 5265.02f, 2704.63f, 421.7f, 3.12507f },
+ { 5350.87f, 2616.03f, 421.243f, 4.72729f },
+ { 5390.95f, 2615.5f, 421.126f, 4.6409f },
+ { 5148.8f, 2820.24f, 421.621f, 3.16043f },
+ { 5147.98f, 2861.93f, 421.63f, 3.18792f },
+};
+
+// Here there is all npc keeper spawn point
+const WintergraspObjectPositionData WGKeepNPC[WG_MAX_KEEP_NPC] =
+{
+ // X Y Z O horde alliance
+ // North East
+ { 5326.203125f, 2660.026367f, 409.100891f, 2.543383f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ { 5298.430176f, 2738.760010f, 409.316010f, 3.971740f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH }, // Vieron Blazefeather
+ { 5335.310059f, 2764.110107f, 409.274994f, 4.834560f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5349.810059f, 2763.629883f, 409.333008f, 4.660030f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ // North
+ { 5373.470215f, 2789.060059f, 409.322998f, 2.600540f, BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR, BATTLEFIELD_WG_NPC_KNIGHT_DAMERON }, // Stone Guard Mukar
+ { 5296.560059f, 2789.870117f, 409.274994f, 0.733038f, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA }, // Voodoo Master Fu'jin
+ { 5372.670000f, 2786.740000f, 409.442000f, 2.809980f, BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI, BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER }, // Wintergrasp Quartermaster
+ { 5368.709961f, 2856.360107f, 409.322998f, 2.949610f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5367.910156f, 2826.520020f, 409.322998f, 3.333580f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5389.270020f, 2847.370117f, 418.759003f, 3.106690f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5388.560059f, 2834.770020f, 418.759003f, 3.071780f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5359.129883f, 2837.989990f, 409.364014f, 4.698930f, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH }, // Commander Dardosh
+ { 5366.129883f, 2833.399902f, 409.322998f, 3.141590f, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS }, // Tactical Officer Kilrath
+ // X Y Z O horde alliance
+ // North West
+ { 5350.680176f, 2917.010010f, 409.274994f, 1.466080f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5335.120117f, 2916.800049f, 409.444000f, 1.500980f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5295.560059f, 2926.669922f, 409.274994f, 0.872665f, BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF, BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE }, // Stronghoof
+ { 5371.399902f, 3026.510010f, 409.205994f, 3.250030f, BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT, BATTLEFIELD_WG_NPC_ANCHORITE_TESSA }, // Primalist Mulfort
+ { 5392.123535f, 3031.110352f, 409.187683f, 3.677212f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ // South
+ { 5270.060059f, 2847.550049f, 409.274994f, 3.071780f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5270.160156f, 2833.479980f, 409.274994f, 3.124140f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5179.109863f, 2837.129883f, 409.274994f, 3.211410f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5179.669922f, 2846.600098f, 409.274994f, 3.089230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5234.970215f, 2883.399902f, 409.274994f, 4.293510f, BATTLEFIELD_WG_NPC_LIEUTENANT_MURP, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO }, // Lieutenant Murp
+ // X Y Z O horde alliance
+ // Portal guards (from around the fortress)
+ { 5319.209473f, 3055.947754f, 409.176636f, 1.020201f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5311.612305f, 3061.207275f, 408.734161f, 0.965223f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5264.713379f, 3017.283447f, 408.479706f, 3.482424f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5269.096191f, 3008.315918f, 408.826294f, 3.843706f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5201.414551f, 2945.096924f, 409.190735f, 0.945592f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5193.386230f, 2949.617188f, 409.190735f, 1.145859f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5148.116211f, 2904.761963f, 409.193756f, 3.368532f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5153.355957f, 2895.501465f, 409.199310f, 3.549174f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5154.353027f, 2787.349365f, 409.250183f, 2.555644f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5150.066406f, 2777.876953f, 409.343903f, 2.708797f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5193.706543f, 2732.882812f, 409.189514f, 4.845073f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5202.126953f, 2737.570557f, 409.189514f, 5.375215f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5269.181152f, 2671.174072f, 409.098999f, 2.457459f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5264.960938f, 2662.332520f, 409.098999f, 2.598828f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5307.111816f, 2616.006836f, 409.095734f, 5.355575f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 5316.770996f, 2619.430176f, 409.027740f, 5.363431f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A } // Standing Guard
+};
+
+const WintergraspObjectPositionData WGOutsideNPC[WG_MAX_OUTSIDE_NPC] =
+{
+ { 5032.04f, 3681.79f, 362.980f, 4.210f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, 0 },
+ { 5020.71f, 3626.19f, 360.150f, 4.640f, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, 0 },
+ { 4994.85f, 3660.51f, 359.150f, 2.260f, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, 0 },
+ { 5015.46f, 3677.11f, 362.970f, 6.009f, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, 0 },
+ { 5031.12f, 3663.77f, 363.500f, 3.110f, BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF, 0 },
+ { 5042.74f, 3675.82f, 363.060f, 3.358f, BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT, 0 },
+ { 5014.45f, 3640.87f, 361.390f, 3.280f, BATTLEFIELD_WG_NPC_LIEUTENANT_MURP, 0 },
+ { 5100.07f, 2168.89f, 365.779f, 1.972f, 0, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH },
+ { 5081.70f, 2173.73f, 365.878f, 0.855f, 0, BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA },
+ { 5078.28f, 2183.70f, 365.029f, 1.466f, 0, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH },
+ { 5088.49f, 2188.18f, 365.647f, 5.253f, 0, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS },
+ { 5095.67f, 2193.28f, 365.924f, 4.939f, 0, BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE },
+ { 5088.61f, 2167.66f, 365.689f, 0.680f, 0, BATTLEFIELD_WG_NPC_ANCHORITE_TESSA },
+ { 5080.40f, 2199.00f, 359.489f, 2.967f, 0, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO },
+};
+
+struct WintergraspTeleporterData
+{
+ uint32 entry;
+ float x;
+ float y;
+ float z;
+ float o;
+};
+
+const WintergraspTeleporterData WGPortalDefenderData[WG_MAX_TELEPORTER] =
+{
+ // Player teleporter
+ { 190763, 5153.41f, 2901.35f, 409.191f, -0.069f },
+ { 190763, 5268.70f, 2666.42f, 409.099f, -0.715f },
+ { 190763, 5197.05f, 2944.81f, 409.191f, 2.3387f },
+ { 190763, 5196.67f, 2737.34f, 409.189f, -2.932f },
+ { 190763, 5314.58f, 3055.85f, 408.862f, 0.5410f },
+ { 190763, 5391.28f, 2828.09f, 418.675f, -2.164f },
+ { 190763, 5153.93f, 2781.67f, 409.246f, 1.6580f },
+ { 190763, 5311.44f, 2618.93f, 409.092f, -2.373f },
+ { 190763, 5269.21f, 3013.84f, 408.828f, -1.762f },
+ { 190763, 5401.62f, 2853.66f, 418.674f, 2.6354f },
+ // Vehicle teleporter
+ { 192951, 5314.51f, 2703.69f, 408.550f, -0.890f },
+ { 192951, 5316.25f, 2977.04f, 408.539f, -0.820f },
+};
+
+// *********************************************************
+// **********Tower Element(GameObject,Creature)*************
+// *********************************************************
+
+struct WintergraspTowerData
+{
+ uint32 towerEntry; // Gameobject id of tower
+ uint8 nbObject; // Number of gameobjects spawned on this point
+ WintergraspObjectPositionData GameObject[6]; // Gameobject position and entry (Horde/Alliance)
+
+ // Creature : Turrets and Guard, TODO: check if killed on tower destruction? tower damage?
+ uint8 nbCreatureBottom;
+ WintergraspObjectPositionData CreatureBottom[9];
+ uint8 nbCreatureTop;
+ WintergraspObjectPositionData CreatureTop[5];
+};
+
+uint8 const WG_MAX_ATTACKTOWERS = 3;
+// 192414 : 0 in sql, 1 in header
+// 192278 : 0 in sql, 3 in header
+const WintergraspTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = {
+ // West tower
+ {
+ 190356,
+ 6,
+ {
+ { 4559.109863f, 3606.219971f, 419.998993f, -1.483530f, 192488, 192501 }, // Flag on tower
+ { 4539.419922f, 3622.489990f, 420.033997f, -3.071770f, 192488, 192501 }, // Flag on tower
+ { 4555.259766f, 3641.649902f, 419.973999f, 1.675510f, 192488, 192501 }, // Flag on tower
+ { 4574.870117f, 3625.909912f, 420.079010f, 0.080117f, 192488, 192501 }, // Flag on tower
+ { 4433.899902f, 3534.139893f, 360.274994f, -1.850050f, 192269, 192278 }, // Flag near workshop
+ { 4572.930176f, 3475.520020f, 363.009003f, 1.42240f, 192269, 192278 } // Flag near bridge
+ },
+ 1,
+ {
+ { 4418.688477f, 3506.251709f, 358.975494f, 4.293305f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 0,
+ {
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ }
+ },
+
+ // South Tower
+ {
+ 190357,
+ 5,
+ {
+ { 4416.000000f, 2822.669922f, 429.851013f, -0.017452f, 192488, 192501 }, // Flag on tower
+ { 4398.819824f, 2804.699951f, 429.791992f, -1.588250f, 192488, 192501 }, // Flag on tower
+ { 4387.620117f, 2719.570068f, 389.934998f, -1.544620f, 192366, 192414 }, // Flag near tower
+ { 4464.120117f, 2855.449951f, 406.110992f, 0.829032f, 192366, 192429 }, // Flag near tower
+ { 4526.459961f, 2810.179932f, 391.200012f, -2.993220f, 192269, 192278 }, // Flag near bridge
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 6,
+ {
+ { 4452.859863f, 2808.870117f, 402.604004f, 6.056290f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4455.899902f, 2835.958008f, 401.122559f, 0.034907f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4412.649414f, 2953.792236f, 374.799957f, 0.980838f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
+ { 4362.089844f, 2811.510010f, 407.337006f, 3.193950f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4412.290039f, 2753.790039f, 401.015015f, 5.829400f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4421.939941f, 2773.189941f, 400.894989f, 5.707230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ { 0, 0, 0, 0, 0, 0},
+ },
+ 0,
+ {
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ },
+
+ // East Tower
+ {
+ 190358,
+ 4,
+ {
+ { 4466.790039f, 1960.420044f, 459.144012f, 1.151920f, 192488, 192501 }, // Flag on tower
+ { 4475.350098f, 1937.030029f, 459.070007f, -0.43633f, 192488, 192501 }, // Flag on tower
+ { 4451.759766f, 1928.099976f, 459.075989f, -2.00713f, 192488, 192501 }, // Flag on tower
+ { 4442.990234f, 1951.900024f, 459.092987f, 2.740160f, 192488, 192501 }, // Flag on tower
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 5,
+ {
+ { 4501.060059f, 1990.280029f, 431.157013f, 1.029740f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4463.830078f, 2015.180054f, 430.299988f, 1.431170f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4494.580078f, 1943.760010f, 435.627014f, 6.195920f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4450.149902f, 1897.579956f, 435.045013f, 4.398230f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 4428.870117f, 1906.869995f, 432.648010f, 3.996800f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ 0,
+ {
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 },
+ },
+ },
+};
+
+struct WintergraspTowerCannonData
+{
+ uint32 towerEntry;
+ uint8 nbTowerCannonBottom;
+ Position TowerCannonBottom[5];
+ uint8 nbTurretTop;
+ Position TurretTop[5];
+};
+
+const uint8 WG_MAX_TOWER_CANNON = 7;
+
+const WintergraspTowerCannonData TowerCannon[WG_MAX_TOWER_CANNON] =
+{
+ {
+ 190221,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5255.88f, 3047.63f, 438.499f, 3.13677f },
+ { 5280.9f, 3071.32f, 438.499f, 1.62879f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190373,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5138.59f, 2935.16f, 439.845f, 3.11723f },
+ { 5163.06f, 2959.52f, 439.846f, 1.47258f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190377,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5163.84f, 2723.74f, 439.844f, 1.3994f },
+ { 5139.69f, 2747.4f, 439.844f, 3.17221f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190378,
+ 0,
+ {
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 5278.21f, 2607.23f, 439.755f, 4.71944f },
+ { 5255.01f, 2631.98f, 439.755f, 3.15257f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190356,
+ 2,
+ {
+ {4537.380371f, 3599.531738f, 402.886993f, 3.998462f},
+ {4581.497559f, 3604.087158f, 402.886963f, 5.651723f},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ },
+ 2,
+ {
+ {4469.448242f, 1966.623779f, 465.647217f, 1.153573f},
+ {4581.895996f, 3626.438477f, 426.539062f, 0.117806f},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ {0, 0, 0, 0},
+ },
+ },
+ {
+ 190357,
+ 2,
+ {
+ { 4421.640137f, 2799.935791f, 412.630920f, 5.459298f },
+ { 4420.263184f, 2845.340332f, 412.630951f, 0.742197f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 3,
+ {
+ { 4423.430664f, 2822.762939f, 436.283142f, 6.223487f },
+ { 4397.825684f, 2847.629639f, 436.283325f, 1.579430f },
+ { 4398.814941f, 2797.266357f, 436.283051f, 4.703747f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+ {
+ 190358,
+ 2,
+ {
+ { 4448.138184f, 1974.998779f, 441.995911f, 1.967238f },
+ { 4448.713379f, 1955.148682f, 441.995178f, 0.380733f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ 2,
+ {
+ { 4469.448242f, 1966.623779f, 465.647217f, 1.153573f },
+ { 4481.996582f, 1933.658325f, 465.647186f, 5.873029f },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ { 0, 0, 0, 0 },
+ },
+ },
+};
+
+// *********************************************************
+// *****************WorkShop Data & Element*****************
+// *********************************************************
+
+uint8 const WG_MAX_WORKSHOP = 6;
+
+struct WGWorkshopData
+{
+ uint8 id;
+ uint32 worldstate;
+ uint32 text;
+};
+
+const WGWorkshopData WorkshopsData[WG_MAX_WORKSHOP] =
+{
+ // NE
+ {BATTLEFIELD_WG_WORKSHOP_NE, WORLDSTATE_WORKSHOP_NE, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE},
+ // NW
+ {BATTLEFIELD_WG_WORKSHOP_NW, WORLDSTATE_WORKSHOP_NW, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW},
+ // SE
+ {BATTLEFIELD_WG_WORKSHOP_SE, WORLDSTATE_WORKSHOP_SE, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE},
+ // SW
+ {BATTLEFIELD_WG_WORKSHOP_SW, WORLDSTATE_WORKSHOP_SW, BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SW},
+ // KEEP WEST - It can't be taken, so it doesn't have a textid
+ {BATTLEFIELD_WG_WORKSHOP_KEEP_WEST, WORLDSTATE_WORKSHOP_K_W, NULL},
+ // KEEP EAST - It can't be taken, so it doesn't have a textid
+ {BATTLEFIELD_WG_WORKSHOP_KEEP_EAST, WORLDSTATE_WORKSHOP_K_E, NULL}
+};
+
+// ********************************************************************
+// * Structs using for Building,Graveyard,Workshop *
+// ********************************************************************
+// Structure for different buildings that can be destroyed during battle
+struct BfWGGameObjectBuilding
+{
+ BfWGGameObjectBuilding(BattlefieldWG *WG)
+ {
+ m_WG = WG;
+ m_Team = 0;
+ m_Build = NULL;
+ m_Type = 0;
+ m_WorldState = 0;
+ m_State = 0;
+ m_NameId = 0;
+ }
+
+ // the team that controls this point
+ uint8 m_Team;
+
+ // WG object
+ BattlefieldWG *m_WG;
+
+ // Linked gameobject
+ GameObject* m_Build;
+
+ // eWGGameObjectBuildingType
+ uint32 m_Type;
+
+ // WorldState
+ uint32 m_WorldState;
+
+ // eWGGameObjectState
+ uint32 m_State;
+
+ // Name id for warning text
+ uint32 m_NameId;
+
+ // GameObject associations
+ GameObjectSet m_GameObjectList[2];
+
+ // Creature associations
+ GuidSet m_CreatureBottomList[2];
+ GuidSet m_CreatureTopList[2];
+ GuidSet m_TowerCannonBottomList;
+ GuidSet m_TurretTopList;
+
+ void Rebuild()
+ {
+ switch (m_Type)
+ {
+ case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR:
+ case BATTLEFIELD_WG_OBJECTTYPE_WALL:
+ m_Team = m_WG->GetDefenderTeam(); // Objects that are part of the keep should be the defender's
+ break;
+ case BATTLEFIELD_WG_OBJECTTYPE_TOWER:
+ m_Team = m_WG->GetAttackerTeam(); // The towers in the south should be the attacker's
+ break;
+ default:
+ m_Team = TEAM_NEUTRAL;
+ break;
+ }
+
+ // Rebuild gameobject
+ m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
+
+ // Update worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3);
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+ UpdateCreatureAndGo();
+ m_Build->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[m_Team]);
+ }
+
+ // Called when associated gameobject is damaged
+ void Damaged()
+ {
+ // Update worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE - (m_Team * 3);
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Send warning message
+ if (m_NameId) // tower damage + name
+ m_WG->SendWarningToAllInZone(m_NameId);
+
+ for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER)
+ m_WG->UpdateDamagedTowerCount(m_WG->GetDefenderTeam());
+ else if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_TOWER)
+ m_WG->UpdateDamagedTowerCount(m_WG->GetAttackerTeam());
+ }
+
+ // Called when associated gameobject is destroyed
+ void Destroyed()
+ {
+ // Update worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY - (m_Team * 3);
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Warn players
+ if (m_NameId)
+ m_WG->SendWarningToAllInZone(m_NameId);
+
+ switch (m_Type)
+ {
+ // Inform the global wintergrasp script of the destruction of this object
+ case BATTLEFIELD_WG_OBJECTTYPE_TOWER:
+ case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
+ m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team));
+ break;
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
+ m_WG->SetRelicInteractible(true);
+ if (m_WG->GetRelic())
+ m_WG->GetRelic()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
+ else
+ sLog->outError(LOG_FILTER_GENERAL, "BattlefieldWG: Relic not found.");
+ break;
+ }
+
+ m_WG->BrokenWallOrTower(TeamId(m_Team));
+ }
+
+ void Init(GameObject *go, uint32 type, uint32 worldstate, uint32 nameid)
+ {
+ // GameObject associated to object
+ m_Build = go;
+
+ // Type of building (WALL/TOWER/DOOR)
+ m_Type = type;
+
+ // WorldState for client (icon on map)
+ m_WorldState = worldstate;
+
+ // NameId for Warning text
+ m_NameId = nameid;
+
+ switch (m_Type)
+ {
+ case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
+ case BATTLEFIELD_WG_OBJECTTYPE_DOOR:
+ case BATTLEFIELD_WG_OBJECTTYPE_WALL:
+ m_Team = m_WG->GetDefenderTeam(); // Objects that are part of the keep should be the defender's
+ break;
+ case BATTLEFIELD_WG_OBJECTTYPE_TOWER:
+ m_Team = m_WG->GetAttackerTeam(); // The towers in the south should be the attacker's
+ break;
+ default:
+ m_Team = TEAM_NEUTRAL;
+ break;
+ }
+
+ m_State = sWorld->getWorldState(m_WorldState);
+ if (m_Build)
+ {
+ switch (m_State)
+ {
+ case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT:
+ case BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT:
+ m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
+ break;
+ case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY:
+ case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY:
+ m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
+ break;
+ case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE:
+ case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE:
+ m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
+ break;
+ }
+ }
+
+ int32 towerid = -1;
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ towerid = 0;
+ break;
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ towerid = 1;
+ break;
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ towerid = 2;
+ break;
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ towerid = 3;
+ break;
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ towerid = 4;
+ break;
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ towerid = 5;
+ break;
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ towerid = 6;
+ break;
+ }
+
+ if (towerid > 3) // Attacker towers
+ {
+ // Spawn associate gameobjects
+ for (uint8 i = 0; i < AttackTowers[towerid - 4].nbObject; i++)
+ {
+ WintergraspObjectPositionData gobData = AttackTowers[towerid - 4].GameObject[i];
+ if (GameObject* go = m_WG->SpawnGameObject(gobData.entryHorde, gobData.x, gobData.y, gobData.z, gobData.o))
+ m_GameObjectList[TEAM_HORDE].insert(go);
+ if (GameObject* go = m_WG->SpawnGameObject(gobData.entryAlliance, gobData.x, gobData.y, gobData.z, gobData.o))
+ m_GameObjectList[TEAM_ALLIANCE].insert(go);
+ }
+
+ // Spawn associate npc bottom
+ for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureBottom; i++)
+ {
+ WintergraspObjectPositionData creatureData = AttackTowers[towerid - 4].CreatureBottom[i];
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryHorde, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_HORDE))
+ m_CreatureBottomList[TEAM_HORDE].insert(creature->GetGUID());
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryAlliance, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_ALLIANCE))
+ m_CreatureBottomList[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+
+ // Spawn associate npc top
+ for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureTop; i++)
+ {
+ WintergraspObjectPositionData creatureData = AttackTowers[towerid - 4].CreatureTop[i];
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryHorde, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_HORDE))
+ m_CreatureTopList[TEAM_HORDE].insert(creature->GetGUID());
+ if (Creature* creature = m_WG->SpawnCreature(creatureData.entryAlliance, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_ALLIANCE))
+ m_CreatureTopList[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+ }
+
+ if (towerid >= 0)
+ {
+ // Spawn Turret bottom
+ for (uint8 i = 0; i < TowerCannon[towerid].nbTowerCannonBottom; i++)
+ {
+ Position turretPos;
+ TowerCannon[towerid].TowerCannonBottom[i].GetPosition(&turretPos);
+ if (Creature* turret = m_WG->SpawnCreature(NPC_WINTERGRASP_TOWER_CANNON, turretPos, TEAM_ALLIANCE))
+ {
+ m_TowerCannonBottomList.insert(turret->GetGUID());
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ m_WG->HideNpc(turret);
+ }
+ }
+
+ // Spawn Turret top
+ for (uint8 i = 0; i < TowerCannon[towerid].nbTurretTop; i++)
+ {
+ Position towerCannonPos;
+ TowerCannon[towerid].TurretTop[i].GetPosition(&towerCannonPos);
+ if (Creature *turret = m_WG->SpawnCreature(28366, towerCannonPos, TeamId(0)))
+ {
+ m_TurretTopList.insert(turret->GetGUID());
+ switch (go->GetEntry())
+ {
+ case GO_WINTERGRASP_FORTRESS_TOWER_1:
+ case GO_WINTERGRASP_FORTRESS_TOWER_2:
+ case GO_WINTERGRASP_FORTRESS_TOWER_3:
+ case GO_WINTERGRASP_FORTRESS_TOWER_4:
+ turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
+ case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
+ case GO_WINTERGRASP_FLAMEWATCH_TOWER:
+ turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ m_WG->HideNpc(turret);
+ }
+ }
+ UpdateCreatureAndGo();
+ }
+ }
+
+ void UpdateCreatureAndGo()
+ {
+ for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureTopList[m_WG->GetDefenderTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->ShowNpc(creature, true);
+
+ for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetDefenderTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetDefenderTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ for (GuidSet::const_iterator itr = m_CreatureBottomList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureBottomList[m_WG->GetAttackerTeam()].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->ShowNpc(creature, true);
+
+ for (GameObjectSet::const_iterator itr = m_GameObjectList[m_WG->GetDefenderTeam()].begin(); itr != m_GameObjectList[m_WG->GetDefenderTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+
+ for (GameObjectSet::const_iterator itr = m_GameObjectList[m_WG->GetAttackerTeam()].begin(); itr != m_GameObjectList[m_WG->GetAttackerTeam()].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+ }
+
+ void UpdateTurretAttack(bool disable)
+ {
+ for (GuidSet::const_iterator itr = m_TowerCannonBottomList.begin(); itr != m_TowerCannonBottomList.end(); ++itr)
+ {
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ {
+ if (Creature* creature = unit->ToCreature())
+ {
+ if (m_Build)
+ {
+ if (disable)
+ m_WG->HideNpc(creature);
+ else
+ m_WG->ShowNpc(creature, true);
+
+ switch (m_Build->GetEntry())
+ {
+ case 190221:
+ case 190373:
+ case 190377:
+ case 190378:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ }
+ case 190356:
+ case 190357:
+ case 190358:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr)
+ {
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ {
+ if (Creature* creature = unit->ToCreature())
+ {
+ if (m_Build)
+ {
+ if (disable)
+ m_WG->HideNpc(creature);
+ else
+ m_WG->ShowNpc(creature, true);
+
+ switch (m_Build->GetEntry())
+ {
+ case 190221:
+ case 190373:
+ case 190377:
+ case 190378:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
+ break;
+ }
+ case 190356:
+ case 190357:
+ case 190358:
+ {
+ creature->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ void Save()
+ {
+ sWorld->setWorldState(m_WorldState, m_State);
+ }
+};
+
+struct WGWorkshop
+{
+ // pointer to the battlefield that the workshop belongs to
+ BattlefieldWG* bf;
+ // id of the workshop, useful to retrieve data of the WorkshopsData array
+ uint8 workshopId;
+ // team that controls the node
+ uint8 teamControl;
+ // for worldstate
+ uint32 state;
+
+ WGWorkshop(BattlefieldWG* _bf, uint8 _workshopId)
+ {
+ ASSERT(_bf || _workshopId < WG_MAX_WORKSHOP);
+
+ bf = _bf;
+ workshopId = _workshopId;
+ }
+
+ void GiveControlTo(uint8 team, bool init /* for first call in setup*/)
+ {
+ switch (team)
+ {
+ case BATTLEFIELD_WG_TEAM_NEUTRAL:
+ {
+ // Send warning message to all player to inform a faction attack to a workshop
+ // alliance / horde attacking a workshop
+ bf->SendWarningToAllInZone(teamControl ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text + 1);
+ break;
+ }
+ case BATTLEFIELD_WG_TEAM_ALLIANCE:
+ case BATTLEFIELD_WG_TEAM_HORDE:
+ {
+ // Updating worldstate
+ state = team == BATTLEFIELD_WG_TEAM_ALLIANCE ? BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT : BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT;
+ bf->SendUpdateWorldState(WorkshopsData[workshopId].worldstate, state);
+
+ // Warning message
+ if (!init) // workshop taken - alliance
+ bf->SendWarningToAllInZone(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? WorkshopsData[workshopId].text : WorkshopsData[workshopId].text+1);
+
+ // Found associate graveyard and update it
+ if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ if (bf->GetGraveyardById(workshopId))
+ bf->GetGraveyardById(workshopId)->GiveControlTo(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE);
+
+ teamControl = team;
+ break;
+ }
+ }
+
+ if (!init)
+ bf->UpdateCounterVehicle(false);
+ }
+
+ void UpdateGraveyardAndWorkshop()
+ {
+ if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ bf->GetGraveyardById(workshopId)->GiveControlTo(TeamId(teamControl));
+ else
+ GiveControlTo(bf->GetDefenderTeam(), true);
+ }
+
+ void Save()
+ {
+ sWorld->setWorldState(WorkshopsData[workshopId].worldstate, state);
+ }
+};
+
+// Structure for the 6 workshop
+struct WintergraspWorkshopData
+{
+ BattlefieldWG* m_WG; // Pointer to wintergrasp
+ GameObject* m_Build;
+ uint32 m_Type;
+ uint32 m_State; // For worldstate
+ uint32 m_WorldState;
+ uint32 m_TeamControl; // Team witch control the workshop
+ GuidSet m_CreatureOnPoint[2]; // Contain all Creature associate to this point
+ GameObjectSet m_GameObjectOnPoint[2]; // Contain all Gameobject associate to this point
+ uint32 m_NameId; // Id of trinity_string witch contain name of this node, using for alert message
+
+ WintergraspWorkshopData(BattlefieldWG * WG)
+ {
+ m_WG = WG;
+ m_Build = NULL;
+ m_Type = 0;
+ m_State = 0;
+ m_WorldState = 0;
+ m_TeamControl = 0;
+ m_NameId = 0;
+ }
+
+ // Spawning associate creature and store them
+ void AddCreature(WintergraspObjectPositionData obj)
+ {
+ if (Creature* creature = m_WG->SpawnCreature(obj.entryHorde, obj.x, obj.y, obj.z, obj.o, TEAM_HORDE))
+ m_CreatureOnPoint[TEAM_HORDE].insert(creature->GetGUID());
+
+ if (Creature* creature = m_WG->SpawnCreature(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o, TEAM_ALLIANCE))
+ m_CreatureOnPoint[TEAM_ALLIANCE].insert(creature->GetGUID());
+ }
+
+ // Spawning Associate gameobject and store them
+ void AddGameObject(WintergraspObjectPositionData obj)
+ {
+ if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryHorde, obj.x, obj.y, obj.z, obj.o))
+ m_GameObjectOnPoint[TEAM_HORDE].insert(gameobject);
+ if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o))
+ m_GameObjectOnPoint[TEAM_ALLIANCE].insert(gameobject);
+ }
+
+ // Init method, setup variable
+ void Init(uint32 worldstate, uint32 type, uint32 nameid)
+ {
+ m_WorldState = worldstate;
+ m_Type = type;
+ m_NameId = nameid;
+ }
+
+ // Called on change faction in CapturePoint class
+ void GiveControlTo(uint8 team, bool init /* for first call in setup*/)
+ {
+ switch (team)
+ {
+ case BATTLEFIELD_WG_TEAM_NEUTRAL:
+ {
+ // Send warning message to all player for inform a faction attack a workshop
+ // alliance / horde attacking workshop
+ m_WG->SendWarningToAllInZone(m_TeamControl ? m_NameId : m_NameId + 1);
+ break;
+ }
+ case BATTLEFIELD_WG_TEAM_ALLIANCE:
+ {
+ // Show Alliance creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->ShowNpc(creature, creature->GetEntry() != 30499);
+
+ // Hide Horde creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ // Show Alliance gameobject
+ for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+
+ // Hide Horde gameobject
+ for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+
+
+ // Updating worldstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT;
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Warning message
+ if (!init) // workshop taken - alliance
+ m_WG->SendWarningToAllInZone(m_NameId);
+
+ // Found associate graveyard and update it
+ if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ if (m_WG && m_WG->GetGraveyardById(m_Type))
+ m_WG->GetGraveyardById(m_Type)->GiveControlTo(TEAM_ALLIANCE);
+
+ m_TeamControl = team;
+ break;
+ }
+ case BATTLEFIELD_WG_TEAM_HORDE:
+ {
+ // Show Horde creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_HORDE].begin(); itr != m_CreatureOnPoint[TEAM_HORDE].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->ShowNpc(creature, creature->GetEntry() != 30400);
+
+ // Hide Alliance creature
+ for (GuidSet::const_iterator itr = m_CreatureOnPoint[TEAM_ALLIANCE].begin(); itr != m_CreatureOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ if (Unit* unit = sObjectAccessor->FindUnit(*itr))
+ if (Creature* creature = unit->ToCreature())
+ m_WG->HideNpc(creature);
+
+ // Hide Alliance gameobject
+ for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_ALLIANCE].begin(); itr != m_GameObjectOnPoint[TEAM_ALLIANCE].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_ONE_DAY);
+
+ // Show Horde gameobject
+ for (GameObjectSet::const_iterator itr = m_GameObjectOnPoint[TEAM_HORDE].begin(); itr != m_GameObjectOnPoint[TEAM_HORDE].end(); ++itr)
+ (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
+
+ // Update worlstate
+ m_State = BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT;
+ m_WG->SendUpdateWorldState(m_WorldState, m_State);
+
+ // Warning message
+ if (!init) // workshop taken - horde
+ m_WG->SendWarningToAllInZone(m_NameId + 1);
+
+ // Update graveyard control
+ if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ if (m_WG && m_WG->GetGraveyardById(m_Type))
+ m_WG->GetGraveyardById(m_Type)->GiveControlTo(TEAM_HORDE);
+
+ m_TeamControl = team;
+ break;
+ }
+ }
+ if (!init)
+ m_WG->UpdateCounterVehicle(false);
+ }
+
+ void UpdateGraveyardAndWorkshop()
+ {
+ if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
+ m_WG->GetGraveyardById(m_Type)->GiveControlTo(TeamId(m_TeamControl));
+ else
+ GiveControlTo(m_WG->GetDefenderTeam(), true);
+ }
+
+ void Save()
+ {
+ sWorld->setWorldState(m_WorldState, m_State);
+ }
+};
+
+#endif
diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp
index 7c6cabe37ba..b9ddabcf254 100755
--- a/src/server/game/Battlegrounds/ArenaTeam.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeam.cpp
@@ -87,7 +87,7 @@ bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string teamName, uin
// Add captain as member
AddMember(CaptainGuid);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid);
+ sLog->outInfo(LOG_FILTER_ARENAS, "New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid);
return true;
}
@@ -125,7 +125,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
// Check if player is already in a similar arena team
if ((player && player->GetArenaTeamId(GetSlot())) || Player::GetArenaTeamIdFromDB(playerGuid, GetType()) != 0)
{
- sLog->outError(LOG_FILTER_BATTLEGROUND, "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType());
+ sLog->outDebug(LOG_FILTER_ARENAS, "Arena: Player %s (guid: %u) already has an arena team of type %u", playerName.c_str(), GUID_LOPART(playerGuid), GetType());
return false;
}
@@ -184,7 +184,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
player->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 1);
}
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId());
+ sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] joined arena team type: %u [Id: %u].", playerName.c_str(), GUID_LOPART(playerGuid), GetType(), GetId());
return true;
}
@@ -251,7 +251,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
if (newMember.Name.empty())
{
sLog->outError(LOG_FILTER_SQL, "ArenaTeam %u has member with empty name - probably player %u doesn't exist, deleting him from memberlist!", arenaTeamId, GUID_LOPART(newMember.Guid));
- this->DelMember(newMember.Guid, true);
+ DelMember(newMember.Guid, true);
continue;
}
@@ -267,7 +267,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
if (Empty() || !captainPresentInTeam)
{
// Arena team is empty or captain is not in team, delete from db
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId);
+ sLog->outDebug(LOG_FILTER_ARENAS, "ArenaTeam %u does not have any members or its captain is not in team, disbanding it...", TeamId);
return false;
}
@@ -297,7 +297,7 @@ void ArenaTeam::SetCaptain(uint64 guid)
newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
char const* oldCaptainName = oldCaptain ? oldCaptain->GetName() : "";
uint32 oldCaptainLowGuid = oldCaptain ? oldCaptain->GetGUIDLow() : 0;
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].",
+ sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].",
oldCaptainName, oldCaptainLowGuid, newCaptain->GetName(), newCaptain->GetGUIDLow(), GetId(), GetType());
}
}
@@ -321,7 +321,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
// delete all info regarding this team
for (uint32 i = 0; i < ARENA_TEAM_END; ++i)
player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
+ sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] left arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
}
// Only used for single member deletion, for arena team disband we use a single query for more efficiency
@@ -346,7 +346,7 @@ void ArenaTeam::Disband(WorldSession* session)
BroadcastEvent(ERR_ARENA_TEAM_DISBANDED_S, 0, 2, session->GetPlayerName(), GetName(), "");
if (Player* player = session->GetPlayer())
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
+ sLog->outInfo(LOG_FILTER_ARENAS, "Player: %s [GUID: %u] disbanded arena team type: %u [Id: %u].", player->GetName(), player->GetGUIDLow(), GetType(), GetId());
}
// Update database
@@ -507,7 +507,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCoun
data << str1 << str2 << str3;
break;
default:
- sLog->outError(LOG_FILTER_BATTLEGROUND, "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount);
+ sLog->outError(LOG_FILTER_ARENAS, "Unhandled strCount %u in ArenaTeam::BroadcastEvent", strCount);
return;
}
@@ -529,7 +529,7 @@ uint8 ArenaTeam::GetSlotByType(uint32 type)
default:
break;
}
- sLog->outError(LOG_FILTER_BATTLEGROUND, "FATAL: Unknown arena team type %u for some arena team", type);
+ sLog->outError(LOG_FILTER_ARENAS, "FATAL: Unknown arena team type %u for some arena team", type);
return 0xFF;
}
diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
index 665742c97b1..55de445345b 100644
--- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
@@ -101,8 +101,7 @@ void ArenaTeamMgr::LoadArenaTeams()
if (!result)
{
- sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded 0 arena teams. DB table `arena_team` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 arena teams. DB table `arena_team` is empty!");
return;
}
@@ -132,8 +131,7 @@ void ArenaTeamMgr::LoadArenaTeams()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u arena teams in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ArenaTeamMgr::DistributeArenaPoints()
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index cfb4aec8525..cf767a2986e 100755
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -771,17 +771,17 @@ void Battleground::EndBattleground(uint32 winner)
winner_matchmaker_rating = GetArenaMatchmakerRating(winner);
winner_matchmaker_change = winner_arena_team->WonAgainst(winner_matchmaker_rating, loser_matchmaker_rating, winner_change);
loser_matchmaker_change = loser_arena_team->LostAgainst(loser_matchmaker_rating, winner_matchmaker_rating, loser_change);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating,
+ sLog->outDebug(LOG_FILTER_ARENAS, "match Type: %u --- Winner: old rating: %u, rating gain: %d, old MMR: %u, MMR gain: %d --- Loser: old rating: %u, rating loss: %d, old MMR: %u, MMR loss: %d ---", m_ArenaType, winner_team_rating, winner_change, winner_matchmaker_rating,
winner_matchmaker_change, loser_team_rating, loser_change, loser_matchmaker_rating, loser_matchmaker_change);
SetArenaMatchmakerRating(winner, winner_matchmaker_rating + winner_matchmaker_change);
SetArenaMatchmakerRating(GetOtherTeam(winner), loser_matchmaker_rating + loser_matchmaker_change);
SetArenaTeamRatingChangeForTeam(winner, winner_change);
SetArenaTeamRatingChangeForTeam(GetOtherTeam(winner), loser_change);
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change);
+ sLog->outDebug(LOG_FILTER_ARENAS, "Arena match Type: %u for Team1Id: %u - Team2Id: %u ended. WinnerTeamId: %u. Winner rating: +%d, Loser rating: %d", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE], winner_arena_team->GetId(), winner_change, loser_change);
if (sWorld->getBoolConfig(CONFIG_ARENA_LOG_EXTENDED_INFO))
for (Battleground::BattlegroundScoreMap::const_iterator itr = GetPlayerScoresBegin(); itr != GetPlayerScoresEnd(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", m_ArenaType, player->GetName(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows);
+ sLog->outDebug(LOG_FILTER_ARENAS, "Statistics match Type: %u for %s (GUID: " UI64FMTD ", Team: %d, IP: %s): %u damage, %u healing, %u killing blows", m_ArenaType, player->GetName(), itr->first, player->GetArenaTeamId(m_ArenaType == 5 ? 2 : m_ArenaType == 3), player->GetSession()->GetRemoteAddress().c_str(), itr->second->DamageDone, itr->second->HealingDone, itr->second->KillingBlows);
}
// Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes
else
@@ -1103,7 +1103,7 @@ void Battleground::StartBattleground()
// and it doesn't matter if we call StartBattleground() more times, because m_Battlegrounds is a map and instance id never changes
sBattlegroundMgr->AddBattleground(GetInstanceID(), GetTypeID(), this);
if (m_IsRated)
- sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]);
+ sLog->outDebug(LOG_FILTER_ARENAS, "Arena match type: %u for Team1Id: %u - Team2Id: %u started.", m_ArenaType, m_ArenaTeamIds[BG_TEAM_ALLIANCE], m_ArenaTeamIds[BG_TEAM_HORDE]);
}
void Battleground::AddPlayer(Player* player)
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index 290da0bb31f..0b107983379 100755
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -683,8 +683,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battlegrounds. DB table `battleground_template` is empty.");
return;
}
@@ -792,8 +791,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battlegrounds in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void BattlegroundMgr::InitAutomaticArenaPointDistribution()
@@ -1077,8 +1075,7 @@ void BattlegroundMgr::LoadBattleMastersEntry()
if (!result)
{
- sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battlemaster entries. DB table `battlemaster_entry` is empty!");
return;
}
@@ -1102,8 +1099,7 @@ void BattlegroundMgr::LoadBattleMastersEntry()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_BATTLEGROUND, ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battlemaster entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
HolidayIds BattlegroundMgr::BGTypeToWeekendHolidayId(BattlegroundTypeId bgTypeId)
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index 202869567d8..90571dfb758 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -57,7 +57,8 @@ BattlegroundIC::BattlegroundIC()
BattlegroundIC::~BattlegroundIC()
{
-
+ delete gunshipHorde;
+ delete gunshipAlliance;
}
void BattlegroundIC::HandlePlayerResurrect(Player* player)
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index 483e8ffdaf6..ededaf15bb5 100755
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -700,28 +700,40 @@ void BattlegroundWS::Reset()
//call parent's class reset
Battleground::Reset();
- m_FlagKeepers[BG_TEAM_ALLIANCE] = 0;
- m_FlagKeepers[BG_TEAM_HORDE] = 0;
+ m_FlagKeepers[BG_TEAM_ALLIANCE] = 0;
+ m_FlagKeepers[BG_TEAM_HORDE] = 0;
+
m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0;
- m_DroppedFlagGUID[BG_TEAM_HORDE] = 0;
- _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
- _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
- m_TeamScores[BG_TEAM_ALLIANCE] = 0;
- m_TeamScores[BG_TEAM_HORDE] = 0;
- bool isBGWeekend = sBattlegroundMgr->IsBGWeekend(GetTypeID());
- m_ReputationCapture = (isBGWeekend) ? 45 : 35;
- m_HonorWinKills = (isBGWeekend) ? 3 : 1;
- m_HonorEndKills = (isBGWeekend) ? 4 : 2;
- // For WorldState
- _minutesElapsed = 0;
- _lastFlagCaptureTeam = 0;
-
- /* Spirit nodes is static at this BG and then not required deleting at BG reset.
- if (BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
- DelCreature(WS_SPIRIT_MAIN_ALLIANCE);
- if (BgCreatures[WS_SPIRIT_MAIN_HORDE])
- DelCreature(WS_SPIRIT_MAIN_HORDE);
- */
+ m_DroppedFlagGUID[BG_TEAM_HORDE] = 0;
+
+ _flagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
+ _flagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
+
+ m_TeamScores[BG_TEAM_ALLIANCE] = 0;
+ m_TeamScores[BG_TEAM_HORDE] = 0;
+
+ if (sBattlegroundMgr->IsBGWeekend(GetTypeID()))
+ {
+ m_ReputationCapture = 45;
+ m_HonorWinKills = 3;
+ m_HonorEndKills = 4;
+ }
+ else
+ {
+ m_ReputationCapture = 35;
+ m_HonorWinKills = 1;
+ m_HonorEndKills = 2;
+ }
+ _minutesElapsed = 0;
+ _lastFlagCaptureTeam = 0;
+ _bothFlagsKept = false;
+ _flagDebuffState = 0;
+ _flagSpellForceTimer = 0;
+ _lastFlagCaptureTeam = 0;
+ _flagsDropTimer[BG_TEAM_ALLIANCE] = 0;
+ _flagsDropTimer[BG_TEAM_HORDE] = 0;
+ _flagsTimer[BG_TEAM_ALLIANCE] = 0;
+ _flagsTimer[BG_TEAM_HORDE] = 0;
}
void BattlegroundWS::EndBattleground(uint32 winner)
diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt
index a83e77e6632..68ae2d8ea38 100644
--- a/src/server/game/CMakeLists.txt
+++ b/src/server/game/CMakeLists.txt
@@ -17,6 +17,7 @@ file(GLOB_RECURSE sources_Achievements Achievements/*.cpp Achievements/*.h)
file(GLOB_RECURSE sources_Addons Addons/*.cpp Addons/*.h)
file(GLOB_RECURSE sources_AI AI/*.cpp AI/*.h)
file(GLOB_RECURSE sources_AuctionHouse AuctionHouse/*.cpp AuctionHouse/*.h)
+file(GLOB_RECURSE sources_Battlefield Battlefield/*.cpp Battlefield/*.h)
file(GLOB_RECURSE sources_Battlegrounds Battlegrounds/*.cpp Battlegrounds/*.h)
file(GLOB_RECURSE sources_Calendar Calendar/*.cpp Calendar/*.h)
file(GLOB_RECURSE sources_Chat Chat/*.cpp Chat/*.h)
@@ -68,6 +69,7 @@ set(game_STAT_SRCS
${sources_Addons}
${sources_AI}
${sources_AuctionHouse}
+ ${sources_Battlefield}
${sources_Battlegrounds}
${sources_Calendar}
${sources_Chat}
@@ -136,6 +138,8 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/AI/ScriptedAI
${CMAKE_CURRENT_SOURCE_DIR}/AI/SmartScripts
${CMAKE_CURRENT_SOURCE_DIR}/AuctionHouse
+ ${CMAKE_CURRENT_SOURCE_DIR}/Battlefield
+ ${CMAKE_CURRENT_SOURCE_DIR}/Battlefield/Zones
${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds
${CMAKE_CURRENT_SOURCE_DIR}/Battlegrounds/Zones
${CMAKE_CURRENT_SOURCE_DIR}/Calendar
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 67ba643dd97..7bb28556514 100755
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -926,7 +926,7 @@ void ConditionMgr::LoadConditions(bool isReload)
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index 6215cf5bb75..27695f3eafa 100755
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -59,7 +59,7 @@ void LoadDisables()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 disables. DB table `disables` is empty!");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 disables. DB table `disables` is empty!");
return;
}
@@ -228,7 +228,7 @@ void LoadDisables()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disables in %u ms", total_count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -239,7 +239,7 @@ void CheckQuestDisables()
uint32 count = m_DisableMap[DISABLE_TYPE_QUEST].size();
if (!count)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Checked 0 quest disables.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Checked 0 quest disables.");
return;
}
@@ -259,7 +259,7 @@ void CheckQuestDisables()
++itr;
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Checked %u quest disables in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 48ceda2a212..850c58bdf93 100755
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -636,7 +636,7 @@ void LoadDBCStores(const std::string& dataPath)
exit(1);
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Initialized %d data stores in %u ms", DBCFileCount, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 3a2a044ca3b..bb6c1dfdcc1 100755
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -135,8 +135,7 @@ void LFGMgr::LoadRewards()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 lfg dungeon rewards. DB table `lfg_dungeon_rewards` is empty!");
return;
}
@@ -183,8 +182,7 @@ void LFGMgr::LoadRewards()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_LFG, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void LFGMgr::Update(uint32 diff)
@@ -1241,11 +1239,11 @@ LfgAnswer LFGMgr::GetCompatibles(std::string key)
void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, const PlayerSet& players, LfgLockPartyMap& lockMap)
{
lockMap.clear();
- for (PlayerSet::const_iterator it = players.begin(); it != players.end() && dungeons.size(); ++it)
+ for (PlayerSet::const_iterator it = players.begin(); it != players.end() && !dungeons.empty(); ++it)
{
uint64 guid = (*it)->GetGUID();
LfgLockMap cachedLockMap = GetLockedDungeons(guid);
- for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && dungeons.size(); ++it2)
+ for (LfgLockMap::const_iterator it2 = cachedLockMap.begin(); it2 != cachedLockMap.end() && !dungeons.empty(); ++it2)
{
uint32 dungeonId = (it2->first & 0x00FFFFFF); // Compare dungeon ids
LfgDungeonSet::iterator itDungeon = dungeons.find(dungeonId);
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index 21ed1a23828..8823a788555 100755
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
@@ -84,8 +84,7 @@ void FormationMgr::LoadCreatureFormations()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in formations. DB table `creature_formations` is empty!");
return;
}
@@ -136,8 +135,7 @@ void FormationMgr::LoadCreatureFormations()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_UNITS, ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in formations in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void CreatureGroup::AddMember(Creature* member)
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 7375ed9f886..bebed9ce0bd 100755
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -137,10 +137,9 @@ void GameObject::AddToWorld()
// The state can be changed after GameObject::Create but before GameObject::AddToWorld
bool toggledState = GetGOData() ? GetGOData()->go_state == GO_STATE_READY : false;
if (m_model)
- GetMap()->Insert(*m_model);
- if (startOpen ^ toggledState)
- EnableCollision(false);
+ GetMap()->InsertGameObjectModel(*m_model);
+ EnableCollision(startOpen ^ toggledState);
WorldObject::AddToWorld();
}
}
@@ -155,8 +154,8 @@ void GameObject::RemoveFromWorld()
RemoveFromOwner();
if (m_model)
- if (GetMap()->Contains(*m_model))
- GetMap()->Remove(*m_model);
+ if (GetMap()->ContainsGameObjectModel(*m_model))
+ GetMap()->RemoveGameObjectModel(*m_model);
WorldObject::RemoveFromWorld();
sObjectAccessor->RemoveObject(this);
}
@@ -1923,7 +1922,7 @@ void GameObject::SetLootState(LootState state, Unit* unit)
bool startOpen = (GetGoType() == GAMEOBJECT_TYPE_DOOR || GetGoType() == GAMEOBJECT_TYPE_BUTTON ? GetGOInfo()->door.startOpen : false);
// Use the current go state
- if (GetGoState() == GO_STATE_ACTIVE)
+ if (GetGoState() != GO_STATE_ACTIVE)
startOpen = !startOpen;
if (state == GO_ACTIVATED || state == GO_JUST_DEACTIVATED)
@@ -1972,8 +1971,8 @@ void GameObject::EnableCollision(bool enable)
if (!m_model)
return;
- /*if (enable && !GetMap()->Contains(*m_model))
- GetMap()->Insert(*m_model);*/
+ /*if (enable && !GetMap()->ContainsGameObjectModel(*m_model))
+ GetMap()->InsertGameObjectModel(*m_model);*/
m_model->enable(enable ? GetPhaseMask() : 0);
}
@@ -1983,12 +1982,12 @@ void GameObject::UpdateModel()
if (!IsInWorld())
return;
if (m_model)
- if (GetMap()->Contains(*m_model))
- GetMap()->Remove(*m_model);
+ if (GetMap()->ContainsGameObjectModel(*m_model))
+ GetMap()->RemoveGameObjectModel(*m_model);
delete m_model;
m_model = GameObjectModel::Create(*this);
if (m_model)
- GetMap()->Insert(*m_model);
+ GetMap()->InsertGameObjectModel(*m_model);
}
Player* GameObject::GetLootRecipient() const
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
index 0478173b96e..f85bf80e145 100755
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
@@ -70,14 +70,10 @@ void LoadRandomEnchantmentsTable()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_PLAYER_ITEMS, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Item Enchantment definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
else
- {
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 Item Enchantment definitions. DB table `item_enchantment_template` is empty.");
-
- }
}
uint32 GetItemEnchantMod(int32 entry)
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index b910fee951b..9138dcedc27 100755
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -48,6 +48,8 @@
#include "MovementPacketBuilder.h"
#include "DynamicTree.h"
#include "Group.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
uint32 GuidHigh2TypeId(uint32 guid_hi)
{
@@ -2329,7 +2331,12 @@ void WorldObject::SetZoneScript()
if (map->IsDungeon())
m_zoneScript = (ZoneScript*)((InstanceMap*)map)->GetInstanceScript();
else if (!map->IsBattlegroundOrArena())
- m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId());
+ {
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
+ m_zoneScript = bf;
+ else
+ m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId());
+ }
}
}
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 2fd80b7b843..1dcdfa9d8b4 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -74,6 +74,8 @@
#include "InstanceScript.h"
#include <cmath>
#include "AccountMgr.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
#define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS)
@@ -726,7 +728,6 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep
m_MirrorTimerFlagsLast = UNDERWATER_NONE;
m_isInWater = false;
m_drunkTimer = 0;
- m_drunk = 0;
m_restTime = 0;
m_deathTimer = 0;
m_deathExpireTime = 0;
@@ -1228,7 +1229,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
}
// item can't be added
- sLog->outError(LOG_FILTER_PLAYER, "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "STORAGE: Can't equip or store initial item %u for race %u class %u, error msg = %u", titem_id, getRace(), getClass(), msg);
return false;
}
@@ -1458,49 +1459,51 @@ void Player::HandleDrowning(uint32 time_diff)
m_MirrorTimerFlagsLast = m_MirrorTimerFlags;
}
-///The player sobers by 256 every 10 seconds
+///The player sobers by 1% every 9 seconds
void Player::HandleSobering()
{
m_drunkTimer = 0;
- uint32 drunk = (m_drunk <= 256) ? 0 : (m_drunk - 256);
+ uint8 currentDrunkValue = GetDrunkValue();
+ uint8 drunk = currentDrunkValue ? --currentDrunkValue : 0;
SetDrunkValue(drunk);
}
-DrunkenState Player::GetDrunkenstateByValue(uint16 value)
+DrunkenState Player::GetDrunkenstateByValue(uint8 value)
{
- if (value >= 23000)
+ if (value >= 90)
return DRUNKEN_SMASHED;
- if (value >= 12800)
+ if (value >= 50)
return DRUNKEN_DRUNK;
- if (value & 0xFFFE)
+ if (value)
return DRUNKEN_TIPSY;
return DRUNKEN_SOBER;
}
-void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId)
+void Player::SetDrunkValue(uint8 newDrunkValue, uint32 itemId /*= 0*/)
{
- uint32 oldDrunkenState = Player::GetDrunkenstateByValue(m_drunk);
+ bool isSobering = newDrunkValue < GetDrunkValue();
+ uint32 oldDrunkenState = Player::GetDrunkenstateByValue(GetDrunkValue());
+ if (newDrunkValue > 100)
+ newDrunkValue = 100;
// select drunk percent or total SPELL_AURA_MOD_FAKE_INEBRIATE amount, whichever is higher for visibility updates
- int32 drunkPercent = newDrunkenValue * 100 / 0xFFFF;
- drunkPercent = std::max(drunkPercent, GetTotalAuraModifier(SPELL_AURA_MOD_FAKE_INEBRIATE));
-
+ int32 drunkPercent = std::max<int32>(newDrunkValue, GetTotalAuraModifier(SPELL_AURA_MOD_FAKE_INEBRIATE));
if (drunkPercent)
{
m_invisibilityDetect.AddFlag(INVISIBILITY_DRUNK);
m_invisibilityDetect.SetValue(INVISIBILITY_DRUNK, drunkPercent);
}
- else if (!HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE) && !newDrunkenValue)
+ else if (!HasAuraType(SPELL_AURA_MOD_FAKE_INEBRIATE) && !newDrunkValue)
m_invisibilityDetect.DelFlag(INVISIBILITY_DRUNK);
- m_drunk = newDrunkenValue;
- SetUInt32Value(PLAYER_BYTES_3, (GetUInt32Value(PLAYER_BYTES_3) & 0xFFFF0001) | (m_drunk & 0xFFFE));
-
- uint32 newDrunkenState = Player::GetDrunkenstateByValue(m_drunk);
-
+ uint32 newDrunkenState = Player::GetDrunkenstateByValue(newDrunkValue);
+ SetByteValue(PLAYER_BYTES_3, 1, newDrunkValue);
UpdateObjectVisibility();
+ if (!isSobering)
+ m_drunkTimer = 0; // reset sobering timer
+
if (newDrunkenState == oldDrunkenState)
return;
@@ -1508,7 +1511,6 @@ void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId)
data << uint64(GetGUID());
data << uint32(newDrunkenState);
data << uint32(itemId);
-
SendMessageToSet(&data, true);
}
@@ -1534,7 +1536,7 @@ void Player::Update(uint32 p_time)
{
//sLog->outFatal(LOG_FILTER_PLAYER, "Player has m_pad %u during update!", m_pad);
//if (m_spellModTakingSpell)
- sLog->outFatal(LOG_FILTER_PLAYER, "Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id);
+ sLog->outFatal(LOG_FILTER_SPELLS_AURAS, "Player has m_spellModTakingSpell %u during update!", m_spellModTakingSpell->m_spellInfo->Id);
m_spellModTakingSpell = NULL;
}
@@ -1731,7 +1733,7 @@ void Player::Update(uint32 p_time)
{
// m_nextSave reseted in SaveToDB call
SaveToDB();
- sLog->outInfo(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow());
+ sLog->outDebug(LOG_FILTER_PLAYER, "Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow());
}
else
m_nextSave -= p_time;
@@ -1749,11 +1751,10 @@ void Player::Update(uint32 p_time)
m_Last_tick = now;
}
- if (m_drunk)
+ if (GetDrunkValue())
{
m_drunkTimer += p_time;
-
- if (m_drunkTimer > 10*IN_MILLISECONDS)
+ if (m_drunkTimer > 9 * IN_MILLISECONDS)
HandleSobering();
}
@@ -1879,12 +1880,12 @@ bool Player::BuildEnumData(PreparedQueryResult result, WorldPacket* data)
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(plrRace, plrClass);
if (!info)
{
- sLog->outError(LOG_FILTER_PLAYER, "Player %u has incorrect race/class pair. Don't build enum.", guid);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player %u has incorrect race/class pair. Don't build enum.", guid);
return false;
}
else if (!IsValidGender(gender))
{
- sLog->outError(LOG_FILTER_PLAYER, "Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player (%u) has incorrect gender (%hu), don't build enum.", guid, gender);
return false;
}
@@ -2066,14 +2067,14 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
{
if (!MapManager::IsValidMapCoord(mapid, x, y, z, orientation))
{
- sLog->outError(LOG_FILTER_PLAYER, "TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).",
+ sLog->outError(LOG_FILTER_MAPS, "TeleportTo: invalid map (%d) or invalid coordinates (X: %f, Y: %f, Z: %f, O: %f) given when teleporting player (GUID: %u, name: %s, map: %d, X: %f, Y: %f, Z: %f, O: %f).",
mapid, x, y, z, orientation, GetGUIDLow(), GetName(), GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
return false;
}
if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this))
{
- sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid);
+ sLog->outError(LOG_FILTER_MAPS, "Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid);
SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED);
return false;
}
@@ -2406,6 +2407,7 @@ void Player::RemoveFromWorld()
StopCastingBindSight();
UnsummonPetTemporaryIfAny();
sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
+ sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
}
///- Do not add/remove the player from the object storage
@@ -2426,7 +2428,7 @@ void Player::RemoveFromWorld()
{
if (WorldObject* viewpoint = GetViewpoint())
{
- sLog->outFatal(LOG_FILTER_PLAYER, "Player %s has viewpoint %u %u when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId());
+ sLog->outError(LOG_FILTER_PLAYER, "Player %s has viewpoint %u %u when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId());
SetViewpoint(viewpoint, false);
}
}
@@ -3355,7 +3357,7 @@ void Player::SendInitialSpells()
GetSession()->SendPacket(&data);
- sLog->outInfo(LOG_FILTER_PLAYER, "CHARACTER: Sent Initial Spells");
+ sLog->outDebug(LOG_FILTER_NETWORKIO, "CHARACTER: Sent Initial Spells");
}
void Player::RemoveMail(uint32 id)
@@ -3436,7 +3438,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3445,7 +3447,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
return false;
}
@@ -3455,7 +3457,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError(LOG_FILTER_PLAYER, "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed, deleting for all characters in `character_talent`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3464,7 +3466,7 @@ bool Player::AddTalent(uint32 spellId, uint8 spec, bool learning)
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError(LOG_FILTER_PLAYER, "Player::addTalent: Broken spell #%u learning not allowed.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addTalent: Broken spell #%u learning not allowed.", spellId);
return false;
}
@@ -3509,7 +3511,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request, deleting for all characters in `character_spell`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3518,7 +3520,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Non-existed in SpellStore spell #%u request.", spellId);
return false;
}
@@ -3528,7 +3530,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
// do character spell book cleanup (all characters)
if (!IsInWorld() && !learning) // spell load case
{
- sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed, deleting for all characters in `character_spell`.", spellId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_SPELL);
@@ -3537,7 +3539,7 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
CharacterDatabase.Execute(stmt);
}
else
- sLog->outError(LOG_FILTER_PLAYER, "Player::addSpell: Broken spell #%u learning not allowed.", spellId);
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::addSpell: Broken spell #%u learning not allowed.", spellId);
return false;
}
@@ -4291,7 +4293,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result)
if (!sSpellMgr->GetSpellInfo(spell_id))
{
- sLog->outError(LOG_FILTER_PLAYER, "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id);
continue;
}
@@ -5003,7 +5005,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
if (result)
{
- sLog->outInfo(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount());
+ sLog->outDebug(LOG_FILTER_PLAYER, "Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", result->GetRowCount());
do
{
Field* fields = result->Fetch();
@@ -5418,7 +5420,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel);
if (!dcost)
{
- sLog->outError(LOG_FILTER_PLAYER, "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel);
return TotalCost;
}
@@ -5426,7 +5428,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId);
if (!dQualitymodEntry)
{
- sLog->outError(LOG_FILTER_PLAYER, "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId);
return TotalCost;
}
@@ -5442,7 +5444,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
{
if (GetGuildId() == 0)
{
- sLog->outDebug(LOG_FILTER_PLAYER, "You are not member of a guild");
+ sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "You are not member of a guild");
return TotalCost;
}
@@ -5457,7 +5459,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
}
else if (!HasEnoughMoney(costs))
{
- sLog->outDebug(LOG_FILTER_PLAYER, "You do not have enough money");
+ sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "You do not have enough money");
return TotalCost;
}
else
@@ -5494,7 +5496,12 @@ void Player::RepopAtGraveyard()
if (Battleground* bg = GetBattleground())
ClosestGrave = bg->GetClosestGraveYard(this);
else
- ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
+ {
+ if (sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
+ ClosestGrave = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId())->GetClosestGraveYard(this);
+ else
+ ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
+ }
// stop countdown until repop
m_deathTimer = 0;
@@ -5665,7 +5672,7 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa
{
if (modGroup >= BASEMOD_END || modType >= MOD_END)
{
- sLog->outError(LOG_FILTER_PLAYER, "ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "ERROR in HandleBaseModValue(): non existed BaseModGroup of wrong BaseModType!");
return;
}
@@ -5696,7 +5703,7 @@ float Player::GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const
{
if (modGroup >= BASEMOD_END || modType > MOD_END)
{
- sLog->outError(LOG_FILTER_PLAYER, "trial to access non existed BaseModGroup or wrong BaseModType!");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "trial to access non existed BaseModGroup or wrong BaseModType!");
return 0.0f;
}
@@ -5710,7 +5717,7 @@ float Player::GetTotalBaseModValue(BaseModGroup modGroup) const
{
if (modGroup >= BASEMOD_END)
{
- sLog->outError(LOG_FILTER_PLAYER, "wrong BaseModGroup in GetTotalBaseModValue()!");
+ sLog->outError(LOG_FILTER_SPELLS_AURAS, "wrong BaseModGroup in GetTotalBaseModValue()!");
return 0.0f;
}
@@ -6432,7 +6439,7 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal)
SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(id);
if (!pSkill)
{
- sLog->outError(LOG_FILTER_PLAYER, "Skill not found in SkillLineStore: skill #%u", id);
+ sLog->outError(LOG_FILTER_PLAYER_SKILLS, "Skill not found in SkillLineStore: skill #%u", id);
return;
}
@@ -6592,8 +6599,6 @@ int16 Player::GetSkillTempBonusValue(uint32 skill) const
void Player::SendActionButtons(uint32 state) const
{
- sLog->outInfo(LOG_FILTER_PLAYER, "Sending Action Buttons for '%u' spec '%u'", GetGUIDLow(), m_activeSpec);
-
WorldPacket data(SMSG_ACTION_BUTTONS, 1+(MAX_ACTION_BUTTONS*4));
data << uint8(state);
/*
@@ -6615,20 +6620,20 @@ void Player::SendActionButtons(uint32 state) const
}
GetSession()->SendPacket(&data);
- sLog->outInfo(LOG_FILTER_PLAYER, "Action Buttons for '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec);
+ sLog->outInfo(LOG_FILTER_NETWORKIO, "SMSG_ACTION_BUTTONS sent '%u' spec '%u' Sent", GetGUIDLow(), m_activeSpec);
}
bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
{
if (button >= MAX_ACTION_BUTTONS)
{
- sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s: button must be < %u", action, button, GetName(), MAX_ACTION_BUTTONS);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Action %u not added into button %u for player %s: button must be < %u", action, button, GetName(), MAX_ACTION_BUTTONS);
return false;
}
if (action >= MAX_ACTION_BUTTON_ACTION_VALUE)
{
- sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE);
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName(), MAX_ACTION_BUTTON_ACTION_VALUE);
return false;
}
@@ -6637,7 +6642,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
case ACTION_BUTTON_SPELL:
if (!sSpellMgr->GetSpellInfo(action))
{
- sLog->outError(LOG_FILTER_PLAYER, "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName());
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName());
return false;
}
@@ -6650,7 +6655,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
case ACTION_BUTTON_ITEM:
if (!sObjectMgr->GetItemTemplate(action))
{
- sLog->outError(LOG_FILTER_PLAYER, "Item action %u not added into button %u for player %s: item not exist", action, button, GetName());
+ sLog->outError(LOG_FILTER_PLAYER_LOADING, "Item action %u not added into button %u for player %s: item not exist", action, button, GetName());
return false;
}
break;
@@ -6672,7 +6677,7 @@ ActionButton* Player::addActionButton(uint8 button, uint32 action, uint8 type)
// set data and update to CHANGED if not NEW
ab.SetActionAndType(action, ActionButtonType(type));
- sLog->outInfo(LOG_FILTER_PLAYER, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button);
+ sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Player '%u' Added Action '%u' (type %u) to Button '%u'", GetGUIDLow(), action, type, button);
return &ab;
}
@@ -6687,7 +6692,7 @@ void Player::removeActionButton(uint8 button)
else
buttonItr->second.uState = ACTIONBUTTON_DELETED; // saved, will deleted at next save
- sLog->outInfo(LOG_FILTER_PLAYER, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_PLAYER_LOADING, "Action Button '%u' Removed from Player '%u'", button, GetGUIDLow());
}
ActionButton const* Player::GetActionButton(uint8 button)
@@ -7416,6 +7421,8 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
{
sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
sOutdoorPvPMgr->HandlePlayerEnterZone(this, newZone);
+ sBattlefieldMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
+ sBattlefieldMgr->HandlePlayerEnterZone(this, newZone);
SendInitWorldStates(newZone, newArea); // only if really enters to new zone, not just area change, works strange...
}
@@ -7698,7 +7705,7 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply)
if (item->IsBroken())
return;
- sLog->outInfo(LOG_FILTER_PLAYER, "applying mods for item %u ", item->GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_PLAYER_ITEMS, "applying mods for item %u ", item->GetGUIDLow());
uint8 attacktype = Player::GetAttackBySlot(slot);
@@ -8290,7 +8297,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
if (!spellInfo)
{
- sLog->outError(LOG_FILTER_PLAYER, "WORLD: unknown Item spellid %i", spellData.SpellId);
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "WORLD: unknown Item spellid %i", spellData.SpellId);
continue;
}
@@ -8359,7 +8366,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]);
if (!spellInfo)
{
- sLog->outError(LOG_FILTER_PLAYER, "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...",
+ sLog->outError(LOG_FILTER_PLAYER_ITEMS, "Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...",
GetGUIDLow(), GetName(), pEnchant->ID, pEnchant->spellid[s]);
continue;
}
@@ -16750,7 +16757,8 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
SetUInt32Value(PLAYER_BYTES, fields[9].GetUInt32());
SetUInt32Value(PLAYER_BYTES_2, fields[10].GetUInt32());
- SetUInt32Value(PLAYER_BYTES_3, (fields[49].GetUInt16() & 0xFFFE) | fields[5].GetUInt8());
+ SetByteValue(PLAYER_BYTES_3, 0, fields[5].GetUInt8());
+ SetByteValue(PLAYER_BYTES_3, 1, fields[49].GetUInt8());
SetUInt32Value(PLAYER_FLAGS, fields[11].GetUInt32());
SetInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fields[48].GetUInt32());
@@ -17060,13 +17068,11 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// set value, including drunk invisibility detection
// calculate sobering. after 15 minutes logged out, the player will be sober again
- float soberFactor;
- if (time_diff > 15*MINUTE)
- soberFactor = 0;
- else
- soberFactor = 1-time_diff/(15.0f*MINUTE);
- uint16 newDrunkenValue = uint16(soberFactor*(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
- SetDrunkValue(newDrunkenValue);
+ uint8 newDrunkValue = 0;
+ if (time_diff < uint32(GetDrunkValue()) * 9)
+ newDrunkValue = GetDrunkValue() - time_diff / 9;
+
+ SetDrunkValue(newDrunkValue);
m_cinematic = fields[18].GetUInt8();
m_Played_time[PLAYED_TIME_TOTAL]= fields[19].GetUInt32();
@@ -18660,7 +18666,7 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setUInt32(index++, GetUInt32Value(PLAYER_CHOSEN_TITLE));
stmt->setUInt64(index++, GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES));
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX));
- stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
+ stmt->setUInt8(index++, GetDrunkValue());
stmt->setUInt32(index++, GetHealth());
for (uint32 i = 0; i < MAX_POWERS; ++i)
@@ -18771,7 +18777,7 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setUInt32(index++, GetUInt32Value(PLAYER_CHOSEN_TITLE));
stmt->setUInt64(index++, GetUInt64Value(PLAYER_FIELD_KNOWN_CURRENCIES));
stmt->setUInt32(index++, GetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX));
- stmt->setUInt16(index++, (uint16)(GetUInt32Value(PLAYER_BYTES_3) & 0xFFFE));
+ stmt->setUInt8(index++, GetDrunkValue());
stmt->setUInt32(index++, GetHealth());
for (uint32 i = 0; i < MAX_POWERS; ++i)
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 774e75104b1..271bf2b22f8 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -981,7 +981,7 @@ class TradeData
public: // constructors
TradeData(Player* player, Player* trader) :
m_player(player), m_trader(trader), m_accepted(false), m_acceptProccess(false),
- m_money(0), m_spell(0) {}
+ m_money(0), m_spell(0), m_spellCastItem(0) { memset(m_items, 0, TRADE_SLOT_COUNT * sizeof(uint64)); }
Player* GetTrader() const { return m_trader; }
TradeData* GetTraderData() const;
@@ -2050,9 +2050,9 @@ class Player : public Unit, public GridObject<Player>
inline SpellCooldowns GetSpellCooldowns() const { return m_spellCooldowns; }
- void SetDrunkValue(uint16 newDrunkValue, uint32 itemid=0);
- uint16 GetDrunkValue() const { return m_drunk; }
- static DrunkenState GetDrunkenstateByValue(uint16 value);
+ void SetDrunkValue(uint8 newDrunkValue, uint32 itemId = 0);
+ uint8 GetDrunkValue() const { return GetByteValue(PLAYER_BYTES_3, 1); }
+ static DrunkenState GetDrunkenstateByValue(uint8 value);
uint32 GetDeathTimer() const { return m_deathTimer; }
uint32 GetCorpseReclaimDelay(bool pvp) const;
@@ -2720,7 +2720,6 @@ class Player : public Unit, public GridObject<Player>
time_t m_lastDailyQuestTime;
uint32 m_drunkTimer;
- uint16 m_drunk;
uint32 m_weaponChangeTimer;
uint32 m_zoneUpdateId;
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 52d5c9114ff..88d3108dbe2 100755
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -35,8 +35,7 @@ void MapManager::LoadTransports()
if (!result)
{
- sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded 0 transports. DB table `transports` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 transports. DB table `transports` is empty!");
return;
}
@@ -66,7 +65,7 @@ void MapManager::LoadTransports()
continue;
}
- // sLog->outInfo(LOG_FILTER_TRANSPORTS, "Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name);
+ // sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading transport %d between %s, %s", entry, name.c_str(), goinfo->name);
std::set<uint32> mapsUsed;
@@ -121,8 +120,7 @@ void MapManager::LoadTransports()
while (result->NextRow());
}
- sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void MapManager::LoadTransportNPCs()
@@ -134,8 +132,7 @@ void MapManager::LoadTransportNPCs()
if (!result)
{
- sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 transport NPCs. DB table `creature_transport` is empty!");
return;
}
@@ -166,8 +163,7 @@ void MapManager::LoadTransportNPCs()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_TRANSPORTS, ">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u transport npcs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
Transport::Transport(uint32 period, uint32 script) : GameObject(), m_pathTime(0), m_timer(0),
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index d65d717c236..3f088c556f6 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -57,6 +57,8 @@
#include "MoveSpline.h"
#include "ConditionMgr.h"
#include "UpdateFieldFlags.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
#include <math.h>
@@ -15675,9 +15677,14 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
// outdoor pvp things, do these after setting the death state, else the player activity notify won't work... doh...
// handle player kill only if not suicide (spirit of redemption for example)
if (player && this != victim)
+ {
if (OutdoorPvP* pvp = player->GetOutdoorPvP())
pvp->HandleKill(player, victim);
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
+ bf->HandleKill(player, victim);
+ }
+
//if (victim->GetTypeId() == TYPEID_PLAYER)
// if (OutdoorPvP* pvp = victim->ToPlayer()->GetOutdoorPvP())
// pvp->HandlePlayerActivityChangedpVictim->ToPlayer();
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index afbae063e5e..bead65bbfdd 100755
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -260,11 +260,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Saves Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Saves Data...");
{
uint32 oldMSTime = getMSTime();
@@ -273,7 +273,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event saves in game events. DB table `game_event_save` is empty.");
}
else
@@ -306,12 +306,12 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game event saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Prerequisite Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Prerequisite Data...");
{
uint32 oldMSTime = getMSTime();
@@ -319,7 +319,7 @@ void GameEventMgr::LoadFromDB()
QueryResult result = WorldDatabase.Query("SELECT eventEntry, prerequisite_event FROM game_event_prerequisite");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 game event prerequisites in game events. DB table `game_event_prerequisite` is empty.");
}
else
@@ -357,12 +357,12 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game event prerequisites in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Creature Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Creature Data...");
{
uint32 oldMSTime = getMSTime();
@@ -372,7 +372,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in game events. DB table `game_event_creature` is empty");
}
else
@@ -400,12 +400,12 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event GO Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event GO Data...");
{
uint32 oldMSTime = getMSTime();
@@ -415,7 +415,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in game events. DB table `game_event_gameobject` is empty.");
}
else
@@ -443,12 +443,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobjects in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Model/Equipment Change Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Model/Equipment Change Data...");
{
uint32 oldMSTime = getMSTime();
@@ -458,8 +457,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 model/equipment changes in game events. DB table `game_event_model_equip` is empty.");
}
else
{
@@ -500,12 +498,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u model/equipment changes in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Quest Data...");
{
uint32 oldMSTime = getMSTime();
@@ -514,8 +511,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests additions in game events. DB table `game_event_creature_quest` is empty.");
}
else
{
@@ -541,12 +537,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event GO Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event GO Quest Data...");
{
uint32 oldMSTime = getMSTime();
@@ -555,8 +550,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 go quests additions in game events. DB table `game_event_gameobject_quest` is empty.");
}
else
{
@@ -582,12 +576,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Quest Condition Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Quest Condition Data...");
{
uint32 oldMSTime = getMSTime();
@@ -596,8 +589,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest event conditions in game events. DB table `game_event_quest_condition` is empty.");
}
else
{
@@ -625,12 +617,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest event conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Condition Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Condition Data...");
{
uint32 oldMSTime = getMSTime();
@@ -639,8 +630,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 conditions in game events. DB table `game_event_condition` is empty.");
}
else
{
@@ -667,12 +657,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u conditions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Condition Save Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Condition Save Data...");
{
uint32 oldMSTime = getMSTime();
@@ -681,8 +670,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 condition saves in game events. DB table `game_event_condition_save` is empty.");
}
else
{
@@ -715,12 +703,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u condition saves in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event NPCflag Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event NPCflag Data...");
{
uint32 oldMSTime = getMSTime();
@@ -729,8 +716,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 npcflags in game events. DB table `game_event_npcflag` is empty.");
}
else
{
@@ -755,12 +741,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npcflags in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Seasonal Quest Relations...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Seasonal Quest Relations...");
{
uint32 oldMSTime = getMSTime();
@@ -769,8 +754,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 seasonal quests additions in game events. DB table `game_event_seasonal_questrelation` is empty.");
}
else
{
@@ -799,12 +783,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Vendor Additions Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Vendor Additions Data...");
{
uint32 oldMSTime = getMSTime();
@@ -813,8 +796,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 vendor additions in game events. DB table `game_event_npc_vendor` is empty.");
}
else
{
@@ -865,12 +847,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u vendor additions in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Battleground Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Battleground Data...");
{
uint32 oldMSTime = getMSTime();
@@ -879,8 +860,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 battleground holidays in game events. DB table `game_event_condition` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 battleground holidays in game events. DB table `game_event_condition` is empty.");
}
else
{
@@ -903,12 +883,11 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u battleground holidays in game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, "Loading Game Event Pool Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Pool Data...");
{
uint32 oldMSTime = getMSTime();
@@ -918,8 +897,7 @@ void GameEventMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pools for game events. DB table `game_event_pool` is empty.");
}
else
{
@@ -952,8 +930,7 @@ void GameEventMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GAMEEVENTS, ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pools for game events in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
}
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index fc4386633ff..08a76008fde 100755
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -296,8 +296,7 @@ void ObjectMgr::LoadCreatureLocales()
}
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGossipMenuItemsLocales()
@@ -333,8 +332,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales()
}
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gossip_menu_option locale strings in %u ms", (unsigned long)_gossipMenuItemsLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPointOfInterestLocales()
@@ -360,8 +358,7 @@ void ObjectMgr::LoadPointOfInterestLocales()
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.IconName);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu points_of_interest locale strings in %u ms", (unsigned long)_pointOfInterestLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadCreatureTemplates()
@@ -388,8 +385,7 @@ void ObjectMgr::LoadCreatureTemplates()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template definitions. DB table `creature_template` is empty.");
return;
}
@@ -491,8 +487,7 @@ void ObjectMgr::LoadCreatureTemplates()
for (CreatureTemplateContainer::const_iterator itr = _creatureTemplateStore.begin(); itr != _creatureTemplateStore.end(); ++itr)
CheckCreatureTemplate(&itr->second);
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadCreatureTemplateAddons()
@@ -504,8 +499,7 @@ void ObjectMgr::LoadCreatureTemplateAddons()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature template addon definitions. DB table `creature_template_addon` is empty.");
return;
}
@@ -563,8 +557,7 @@ void ObjectMgr::LoadCreatureTemplateAddons()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature template addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
@@ -881,8 +874,7 @@ void ObjectMgr::LoadCreatureAddons()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature addon definitions. DB table `creature_addon` is empty.");
return;
}
@@ -947,8 +939,7 @@ void ObjectMgr::LoadCreatureAddons()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
CreatureAddon const* ObjectMgr::GetCreatureAddon(uint32 lowguid)
@@ -986,8 +977,7 @@ void ObjectMgr::LoadEquipmentTemplates()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature equipment templates. DB table `creature_equip_template` is empty!");
return;
}
@@ -1039,8 +1029,7 @@ void ObjectMgr::LoadEquipmentTemplates()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u equipment templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId)
@@ -1117,8 +1106,7 @@ void ObjectMgr::LoadCreatureModelInfo()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature model definitions. DB table `creature_model_info` is empty.");
return;
}
@@ -1162,8 +1150,7 @@ void ObjectMgr::LoadCreatureModelInfo()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature model based info in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadLinkedRespawn()
@@ -1348,8 +1335,7 @@ void ObjectMgr::LoadLinkedRespawn()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " linked respawns in %u ms", uint64(_linkedRespawnStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::SetCreatureLinkedRespawn(uint32 guidLow, uint32 linkedGuidLow)
@@ -1535,8 +1521,7 @@ void ObjectMgr::LoadCreatures()
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddCreatureToGrid(uint32 guid, CreatureData const* data)
@@ -1840,8 +1825,7 @@ void ObjectMgr::LoadGameobjects()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddGameobjectToGrid(uint32 guid, GameObjectData const* data)
@@ -2009,8 +1993,7 @@ void ObjectMgr::LoadItemLocales()
}
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Item locale strings in %u ms", (unsigned long)_itemLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadItemTemplates()
@@ -2052,8 +2035,7 @@ void ObjectMgr::LoadItemTemplates()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 item templates. DB table `item_template` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item templates. DB table `item_template` is empty.");
return;
}
@@ -2614,8 +2596,7 @@ void ObjectMgr::LoadItemTemplates()
for (std::set<uint32>::const_iterator itr = notFoundOutfit.begin(); itr != notFoundOutfit.end(); ++itr)
sLog->outError(LOG_FILTER_SQL, "Item (Entry: %u) does not exist in `item_template` but is referenced in `CharStartOutfit.dbc`", *itr);
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
ItemTemplate const* ObjectMgr::GetItemTemplate(uint32 entry)
@@ -2650,8 +2631,7 @@ void ObjectMgr::LoadItemSetNameLocales()
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded " UI64FMTD " Item set name locale strings in %u ms", uint64(_itemSetNameLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadItemSetNames()
@@ -2679,8 +2659,7 @@ void ObjectMgr::LoadItemSetNames()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 item set names. DB table `item_set_names` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 item set names. DB table `item_set_names` is empty.");
return;
}
@@ -2734,8 +2713,7 @@ void ObjectMgr::LoadItemSetNames()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item set names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadVehicleTemplateAccessories()
@@ -2791,8 +2769,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Template Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadVehicleAccessories()
@@ -2808,8 +2785,7 @@ void ObjectMgr::LoadVehicleAccessories()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Vehicle Accessories in %u ms", GetMSTimeDiffToNow(oldMSTime));
return;
}
@@ -2836,8 +2812,7 @@ void ObjectMgr::LoadVehicleAccessories()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Vehicle Accessories in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPetLevelInfo()
@@ -2929,8 +2904,7 @@ void ObjectMgr::LoadPetLevelInfo()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level pet stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
PetLevelInfo const* ObjectMgr::GetPetLevelInfo(uint32 creature_id, uint8 level) const
@@ -3071,13 +3045,12 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Load playercreate items
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Items Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Items Data...");
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3
@@ -3085,8 +3058,7 @@ void ObjectMgr::LoadPlayerInfo()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 custom player create items. DB table `playercreateinfo_item` is empty.");
}
else
{
@@ -3143,13 +3115,12 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom player create items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Load playercreate spells
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Spell Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Spell Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3200,13 +3171,12 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Load playercreate actions
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Action Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Action Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3247,13 +3217,12 @@ void ObjectMgr::LoadPlayerInfo()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u player create actions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Loading levels data (class only dependent)
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Level HP/Mana Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Level HP/Mana Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3329,12 +3298,11 @@ void ObjectMgr::LoadPlayerInfo()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level health/mana definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Loading levels data (class/race dependent)
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Level Stats Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Level Stats Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3443,12 +3411,11 @@ void ObjectMgr::LoadPlayerInfo()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level stats definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Loading xp per level data
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create XP Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create XP Data...");
{
uint32 oldMSTime = getMSTime();
@@ -3502,8 +3469,7 @@ void ObjectMgr::LoadPlayerInfo()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u xp for level definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
@@ -4289,8 +4255,7 @@ void ObjectMgr::LoadQuests()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu quests definitions in %u ms", (unsigned long)_questTemplates.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadQuestLocales()
@@ -4338,8 +4303,7 @@ void ObjectMgr::LoadQuestLocales()
}
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu Quest locale strings in %u ms", (unsigned long)_questLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadScripts(ScriptsType type)
@@ -4357,7 +4321,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
if (sScriptMgr->IsScriptScheduled()) // function cannot be called when scripts are in use.
return;
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading %s...", tableName.c_str());
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading %s...", tableName.c_str());
scripts->clear(); // need for reload support
@@ -4367,8 +4331,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str());
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 script definitions. DB table `%s` is empty!", tableName.c_str());
return;
}
@@ -4659,8 +4622,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u script definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGameObjectScripts()
@@ -4804,8 +4766,7 @@ void ObjectMgr::LoadSpellScriptNames()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell script names. DB table `spell_script_names` is empty!");
return;
}
@@ -4852,8 +4813,7 @@ void ObjectMgr::LoadSpellScriptNames()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell script names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::ValidateSpellScripts()
@@ -4862,8 +4822,7 @@ void ObjectMgr::ValidateSpellScripts()
if (_spellScriptsStore.empty())
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Validated 0 scripts.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated 0 scripts.");
return;
}
@@ -4910,8 +4869,7 @@ void ObjectMgr::ValidateSpellScripts()
++count;
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated %u scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPageTexts()
@@ -4923,8 +4881,7 @@ void ObjectMgr::LoadPageTexts()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 page texts. DB table `page_text` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 page texts. DB table `page_text` is empty!");
return;
}
@@ -4953,8 +4910,7 @@ void ObjectMgr::LoadPageTexts()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u page texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
PageText const* ObjectMgr::GetPageText(uint32 pageEntry)
@@ -4989,8 +4945,7 @@ void ObjectMgr::LoadPageTextLocales()
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Text);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu PageText locale strings in %u ms", (unsigned long)_pageTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadInstanceTemplate()
@@ -5002,8 +4957,7 @@ void ObjectMgr::LoadInstanceTemplate()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 instance templates. DB table `page_text` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 instance templates. DB table `page_text` is empty!");
return;
}
@@ -5032,8 +4986,7 @@ void ObjectMgr::LoadInstanceTemplate()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
InstanceTemplate const* ObjectMgr::GetInstanceTemplate(uint32 mapID)
@@ -5122,8 +5075,7 @@ void ObjectMgr::LoadInstanceEncounters()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u instance encounters in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const
@@ -5143,8 +5095,7 @@ void ObjectMgr::LoadGossipText()
int count = 0;
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u npc texts", count);
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts", count);
return;
}
_gossipTextStore.rehash(result->GetRowCount());
@@ -5183,8 +5134,7 @@ void ObjectMgr::LoadGossipText()
}
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u npc texts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadNpcTextLocales()
@@ -5226,8 +5176,7 @@ void ObjectMgr::LoadNpcTextLocales()
}
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu NpcText locale strings in %u ms", (unsigned long)_npcTextLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
//not very fast function but it is called only once a day, or on starting-up
@@ -5252,8 +5201,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> No expired mails found.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> No expired mails found.");
return; // any mails need to be returned or deleted
}
@@ -5356,8 +5304,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Processed %u expired mails: %u deleted and %u returned in %u ms", deletedCount + returnedCount, deletedCount, returnedCount, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadQuestAreaTriggers()
@@ -5370,8 +5317,7 @@ void ObjectMgr::LoadQuestAreaTriggers()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quest trigger points. DB table `areatrigger_involvedrelation` is empty.");
return;
}
@@ -5415,8 +5361,7 @@ void ObjectMgr::LoadQuestAreaTriggers()
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest trigger points in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadTavernAreaTriggers()
@@ -5429,8 +5374,7 @@ void ObjectMgr::LoadTavernAreaTriggers()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 tavern triggers. DB table `areatrigger_tavern` is empty.");
return;
}
@@ -5454,8 +5398,7 @@ void ObjectMgr::LoadTavernAreaTriggers()
_tavernAreaTriggerStore.insert(Trigger_ID);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u tavern triggers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadAreaTriggerScripts()
@@ -5467,8 +5410,7 @@ void ObjectMgr::LoadAreaTriggerScripts()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 areatrigger scripts. DB table `areatrigger_scripts` is empty.");
return;
}
@@ -5492,8 +5434,7 @@ void ObjectMgr::LoadAreaTriggerScripts()
_areaTriggerScriptStore[Trigger_ID] = GetScriptId(scriptName);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areatrigger scripts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
uint32 ObjectMgr::GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team)
@@ -5611,8 +5552,7 @@ void ObjectMgr::LoadGraveyardZones()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 graveyard-zone links. DB table `game_graveyard_zone` is empty.");
return;
}
@@ -5658,8 +5598,7 @@ void ObjectMgr::LoadGraveyardZones()
sLog->outError(LOG_FILTER_SQL, "Table `game_graveyard_zone` has a duplicate record for Graveyard (ID: %u) and Zone (ID: %u), skipped.", safeLocId, zoneId);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u graveyard-zone links in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
WorldSafeLocsEntry const* ObjectMgr::GetDefaultGraveYard(uint32 team)
@@ -5904,8 +5843,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM areatrigger_teleport");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 area trigger teleport definitions. DB table `areatrigger_teleport` is empty.");
return;
}
@@ -5951,8 +5889,7 @@ void ObjectMgr::LoadAreaTriggerTeleports()
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u area trigger teleport definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadAccessRequirements()
@@ -5965,8 +5902,7 @@ void ObjectMgr::LoadAccessRequirements()
QueryResult result = WorldDatabase.Query("SELECT mapid, difficulty, level_min, level_max, item, item2, quest_done_A, quest_done_H, completed_achievement, quest_failed_text FROM access_requirement");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 access requirement definitions. DB table `access_requirement` is empty.");
return;
}
@@ -6043,8 +5979,7 @@ void ObjectMgr::LoadAccessRequirements()
_accessRequirementStore[requirement_ID] = ar;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u access requirement definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
/*
@@ -6268,8 +6203,7 @@ void ObjectMgr::LoadGameObjectLocales()
AddLocaleString(fields[i + (TOTAL_LOCALES - 1)].GetString(), LocaleConstant(i), data.CastBarCaption);
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));
}
inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N)
@@ -6345,8 +6279,7 @@ void ObjectMgr::LoadGameObjectTemplate()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobject definitions. DB table `gameobject_template` is empty.");
return;
}
@@ -6515,8 +6448,7 @@ void ObjectMgr::LoadGameObjectTemplate()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u game object templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadExplorationBaseXP()
@@ -6544,8 +6476,7 @@ void ObjectMgr::LoadExplorationBaseXP()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u BaseXP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
uint32 ObjectMgr::GetBaseXP(uint8 level)
@@ -6568,8 +6499,7 @@ void ObjectMgr::LoadPetNames()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pet name parts. DB table `pet_name_generation` is empty!");
return;
}
@@ -6589,8 +6519,7 @@ void ObjectMgr::LoadPetNames()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet name parts in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPetNumber()
@@ -6604,8 +6533,7 @@ void ObjectMgr::LoadPetNumber()
_hiPetNumber = fields[0].GetUInt32()+1;
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded the max pet number: %d in %u ms", _hiPetNumber-1, GetMSTimeDiffToNow(oldMSTime));
}
std::string ObjectMgr::GeneratePetName(uint32 entry)
@@ -6638,8 +6566,7 @@ void ObjectMgr::LoadCorpses()
PreparedQueryResult result = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSES));
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 corpses. DB table `corpse` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 corpses. DB table `corpse` is empty.");
return;
}
@@ -6667,8 +6594,7 @@ void ObjectMgr::LoadCorpses()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u corpses in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadReputationRewardRate()
@@ -6730,8 +6656,7 @@ void ObjectMgr::LoadReputationRewardRate()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_reward_rate in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadReputationOnKill()
@@ -6804,8 +6729,7 @@ void ObjectMgr::LoadReputationOnKill()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature award reputation definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadReputationSpilloverTemplate()
@@ -6819,8 +6743,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded `reputation_spillover_template`, table is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded `reputation_spillover_template`, table is empty.");
return;
}
@@ -6916,8 +6839,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reputation_spillover_template in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadPointsOfInterest()
@@ -6963,8 +6885,7 @@ void ObjectMgr::LoadPointsOfInterest()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Points of Interest definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadQuestPOI()
@@ -7035,8 +6956,7 @@ void ObjectMgr::LoadQuestPOI()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest POI definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadNPCSpellClickSpells()
@@ -7103,8 +7023,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spellclick definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::DeleteCreatureData(uint32 guid)
@@ -7182,8 +7101,7 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table,
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quest relations from %s in %u ms", count, table.c_str(), GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGameobjectQuestRelations()
@@ -7252,8 +7170,7 @@ void ObjectMgr::LoadReservedPlayersNames()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 reserved player names. DB table `reserved_name` is empty!");
return;
}
@@ -7279,8 +7196,7 @@ void ObjectMgr::LoadReservedPlayersNames()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u reserved player names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::IsReservedName(const std::string& name) const
@@ -7433,8 +7349,7 @@ void ObjectMgr::LoadGameObjectForQuests()
if (sObjectMgr->GetGameObjectTemplates()->empty())
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 GameObjects for quests");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GameObjects for quests");
return;
}
@@ -7482,8 +7397,7 @@ void ObjectMgr::LoadGameObjectForQuests()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameObjects for quests in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max_value)
@@ -7531,7 +7445,7 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
if (min_value == MIN_TRINITY_STRING_ID) // error only in case internal strings
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table);
else
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 string templates. DB table `%s` is empty.", table);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 string templates. DB table `%s` is empty.", table);
return false;
}
@@ -7571,10 +7485,9 @@ bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max
} while (result->NextRow());
if (min_value == MIN_TRINITY_STRING_ID)
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Trinity strings from table %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u string templates from %s in %u ms", count, table, GetMSTimeDiffToNow(oldMSTime));
return true;
}
@@ -7631,8 +7544,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u areas for fishing base skill level in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names)
@@ -7757,8 +7669,7 @@ void ObjectMgr::LoadGameTele()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GameTeleports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
@@ -7902,8 +7813,7 @@ void ObjectMgr::LoadMailLevelRewards()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u level dependent mail rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel)
@@ -8023,8 +7933,7 @@ void ObjectMgr::LoadTrainerSpell()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *skip_vendors)
@@ -8114,8 +8023,7 @@ void ObjectMgr::LoadVendors()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Vendors in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGossipMenu()
@@ -8156,8 +8064,7 @@ void ObjectMgr::LoadGossipMenu()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadGossipMenuItems()
@@ -8220,8 +8127,7 @@ void ObjectMgr::LoadGossipMenuItems()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 extendedCost, bool persist /*= true*/)
@@ -8399,8 +8305,7 @@ void ObjectMgr::LoadScriptNames()
while (result->NextRow());
std::sort(_scriptNamesStore.begin(), _scriptNamesStore.end());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %d Script Names in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
uint32 ObjectMgr::GetScriptId(const char *name)
@@ -8503,8 +8408,7 @@ void ObjectMgr::LoadCreatureClassLevelStats()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creature base stats. DB table `creature_classlevelstats` is empty.");
return;
}
@@ -8552,8 +8456,7 @@ void ObjectMgr::LoadCreatureClassLevelStats()
}
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature base stats in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeAchievements()
@@ -8589,8 +8492,7 @@ void ObjectMgr::LoadFactionChangeAchievements()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change achievement pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeItems()
@@ -8601,8 +8503,7 @@ void ObjectMgr::LoadFactionChangeItems()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change item pairs. DB table `player_factionchange_items` is empty.");
return;
}
@@ -8626,8 +8527,7 @@ void ObjectMgr::LoadFactionChangeItems()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change item pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeSpells()
@@ -8663,8 +8563,7 @@ void ObjectMgr::LoadFactionChangeSpells()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change spell pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void ObjectMgr::LoadFactionChangeReputations()
@@ -8675,8 +8574,7 @@ void ObjectMgr::LoadFactionChangeReputations()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 faction change reputation pairs. DB table `player_factionchange_reputations` is empty.");
return;
}
@@ -8700,8 +8598,7 @@ void ObjectMgr::LoadFactionChangeReputations()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u faction change reputation pairs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry)
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 59bb2fb536f..da0d37cf27a 100755
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -787,13 +787,13 @@ class ObjectMgr
void LoadQuests();
void LoadQuestRelations()
{
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading GO Start Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GO Start Quest Data...");
LoadGameobjectQuestRelations();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading GO End Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GO End Quest Data...");
LoadGameobjectInvolvedRelations();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Start Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Start Quest Data...");
LoadCreatureQuestRelations();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature End Quest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature End Quest Data...");
LoadCreatureInvolvedRelations();
}
void LoadGameobjectQuestRelations();
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index 5ace6da2f44..c270597d15b 100755
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -59,7 +59,7 @@ Loot* Roll::getLoot()
Group::Group() : m_leaderGuid(0), m_leaderName(""), m_groupType(GROUPTYPE_NORMAL),
m_dungeonDifficulty(DUNGEON_DIFFICULTY_NORMAL), m_raidDifficulty(RAID_DIFFICULTY_10MAN_NORMAL),
-m_bgGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
+m_bgGroup(NULL), m_bfGroup(NULL), m_lootMethod(FREE_FOR_ALL), m_lootThreshold(ITEM_QUALITY_UNCOMMON), m_looterGuid(0),
m_subGroupsCounts(NULL), m_guid(0), m_counter(0), m_maxEnchantingLevel(0), m_dbStoreId(0)
{
for (uint8 i = 0; i < TARGETICONCOUNT; ++i)
@@ -2149,6 +2149,11 @@ bool Group::isBGGroup() const
return m_bgGroup != NULL;
}
+bool Group::isBFGroup() const
+{
+ return m_bfGroup != NULL;
+}
+
bool Group::IsCreated() const
{
return GetMembersCount() > 0;
@@ -2250,6 +2255,11 @@ void Group::SetBattlegroundGroup(Battleground* bg)
m_bgGroup = bg;
}
+void Group::SetBattlefieldGroup(Battlefield *bg)
+{
+ m_bfGroup = bg;
+}
+
void Group::SetGroupMemberFlag(uint64 guid, bool apply, GroupMemberFlags flag)
{
// Assistants, main assistants and main tanks are only available in raid groups
diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h
index e5f174c4230..41f5cd0de5f 100755
--- a/src/server/game/Groups/Group.h
+++ b/src/server/game/Groups/Group.h
@@ -26,6 +26,8 @@
#include "QueryResult.h"
#include "SharedDefines.h"
#include "Player.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
class Creature;
class GroupReference;
@@ -205,6 +207,7 @@ class Group
bool isLFGGroup() const;
bool isRaidGroup() const;
bool isBGGroup() const;
+ bool isBFGroup() const;
bool IsCreated() const;
uint64 GetLeaderGUID() const;
uint64 GetGUID() const;
@@ -241,6 +244,7 @@ class Group
void ConvertToRaid();
void SetBattlegroundGroup(Battleground* bg);
+ void SetBattlefieldGroup(Battlefield *bf);
GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot);
void ChangeMembersGroup(uint64 guid, uint8 group);
@@ -324,6 +328,7 @@ class Group
Difficulty m_dungeonDifficulty;
Difficulty m_raidDifficulty;
Battleground* m_bgGroup;
+ Battlefield* m_bfGroup;
uint64 m_targetIcons[TARGETICONCOUNT];
LootMethod m_lootMethod;
ItemQualities m_lootThreshold;
diff --git a/src/server/game/Groups/GroupMgr.cpp b/src/server/game/Groups/GroupMgr.cpp
index 3a758f6df30..77b3a304f6b 100644
--- a/src/server/game/Groups/GroupMgr.cpp
+++ b/src/server/game/Groups/GroupMgr.cpp
@@ -125,8 +125,7 @@ void GroupMgr::LoadGroups()
", g.icon7, g.icon8, g.groupType, g.difficulty, g.raiddifficulty, g.guid, lfg.dungeon, lfg.state FROM groups g LEFT JOIN lfg_data lfg ON lfg.guid = g.guid ORDER BY g.guid ASC");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group definitions. DB table `groups` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group definitions. DB table `groups` is empty!");
return;
}
@@ -151,11 +150,10 @@ void GroupMgr::LoadGroups()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Group members...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Group members...");
{
uint32 oldMSTime = getMSTime();
@@ -169,8 +167,7 @@ void GroupMgr::LoadGroups()
QueryResult result = CharacterDatabase.Query("SELECT guid, memberGuid, memberFlags, subgroup, roles FROM group_member ORDER BY guid");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group members. DB table `group_member` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group members. DB table `group_member` is empty!");
return;
}
@@ -190,11 +187,10 @@ void GroupMgr::LoadGroups()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group members in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Group instance saves...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Group instance saves...");
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5 6
@@ -203,8 +199,7 @@ void GroupMgr::LoadGroups()
"LEFT JOIN character_instance ci LEFT JOIN groups g ON g.leaderGuid = ci.guid ON ci.instance = gi.instance AND ci.permanent = 1 GROUP BY gi.instance ORDER BY gi.guid");
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 group-instance saves. DB table `group_instance` is empty!");
return;
}
@@ -235,7 +230,6 @@ void GroupMgr::LoadGroups()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u group-instance saves in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp
index dab67c59d2a..cebcf6040f9 100644
--- a/src/server/game/Guilds/GuildMgr.cpp
+++ b/src/server/game/Guilds/GuildMgr.cpp
@@ -93,7 +93,7 @@ Guild* GuildMgr::GetGuildByLeader(uint64 guid) const
void GuildMgr::LoadGuilds()
{
// 1. Load all guilds
- sLog->outInfo(LOG_FILTER_GUILD, "Loading guilds definitions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guilds definitions...");
{
uint32 oldMSTime = getMSTime();
@@ -105,8 +105,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild definitions. DB table `guild` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild definitions. DB table `guild` is empty.");
return;
}
else
@@ -128,13 +127,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 2. Load all guild ranks
- sLog->outInfo(LOG_FILTER_GUILD, "Loading guild ranks...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild ranks...");
{
uint32 oldMSTime = getMSTime();
@@ -146,8 +144,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild ranks. DB table `guild_rank` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild ranks. DB table `guild_rank` is empty.");
}
else
{
@@ -164,13 +161,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild ranks in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 3. Load all guild members
- sLog->outInfo(LOG_FILTER_GUILD, "Loading guild members...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild members...");
{
uint32 oldMSTime = getMSTime();
@@ -189,8 +185,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild members. DB table `guild_member` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild members. DB table `guild_member` is empty.");
}
else
{
@@ -208,13 +203,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild members int %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 4. Load all guild bank tab rights
- sLog->outInfo(LOG_FILTER_GUILD, "Loading bank tab rights...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading bank tab rights...");
{
uint32 oldMSTime = getMSTime();
@@ -226,8 +220,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tab rights. DB table `guild_bank_right` is empty.");
}
else
{
@@ -244,13 +237,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u bank tab rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 5. Load all event logs
- sLog->outInfo(LOG_FILTER_GUILD, "Loading guild event logs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild event logs...");
{
uint32 oldMSTime = getMSTime();
@@ -261,8 +253,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild event logs. DB table `guild_eventlog` is empty.");
}
else
{
@@ -279,13 +270,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 6. Load all bank event logs
- sLog->outInfo(LOG_FILTER_GUILD, "Loading guild bank event logs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild bank event logs...");
{
uint32 oldMSTime = getMSTime();
@@ -297,8 +287,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank event logs. DB table `guild_bank_eventlog` is empty.");
}
else
{
@@ -315,13 +304,12 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank event logs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// 7. Load all guild bank tabs
- sLog->outInfo(LOG_FILTER_GUILD, "Loading guild bank tabs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading guild bank tabs...");
{
uint32 oldMSTime = getMSTime();
@@ -333,8 +321,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tabs. DB table `guild_bank_tab` is empty.");
}
else
{
@@ -351,8 +338,7 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tabs in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
@@ -371,8 +357,7 @@ void GuildMgr::LoadGuilds()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 guild bank tab items. DB table `guild_bank_item` or `item_instance` is empty.");
}
else
{
@@ -389,8 +374,7 @@ void GuildMgr::LoadGuilds()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GUILD, ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u guild bank tab items in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
@@ -412,7 +396,6 @@ void GuildMgr::LoadGuilds()
}
}
- sLog->outInfo(LOG_FILTER_GUILD, ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Validated data of loaded guilds in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
}
diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp
index 2e0bbf786a9..b47eaf52064 100755
--- a/src/server/game/Handlers/BattleGroundHandler.cpp
+++ b/src/server/game/Handlers/BattleGroundHandler.cpp
@@ -34,6 +34,8 @@
#include "Opcodes.h"
#include "DisableMgr.h"
#include "Group.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket & recv_data)
{
@@ -583,6 +585,9 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data)
if (bg)
sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid);
+
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
+ bf->SendAreaSpiritHealerQueryOpcode(_player,guid);
}
void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data)
@@ -603,8 +608,12 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data)
if (bg)
bg->AddPlayerToResurrectQueue(guid, _player->GetGUID());
+
+ if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
+ bf->AddPlayerToResurrectQueue(guid, _player->GetGUID());
}
+
void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA");
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index df515f879f8..8544266840f 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -658,8 +658,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
SendPacket(&data);
std::string IP_str = GetRemoteAddress();
- sLog->outInfo(LOG_FILTER_NETWORKIO, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
- sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
sScriptMgr->OnPlayerCreate(&newChar);
sWorld->AddCharacterNameData(newChar.GetGUIDLow(), std::string(newChar.GetName()), newChar.getGender(), newChar.getRace(), newChar.getClass());
@@ -687,7 +686,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
if (sGuildMgr->GetGuildByLeader(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
- data << (uint8)CHAR_DELETE_FAILED_GUILD_LEADER;
+ data << uint8(CHAR_DELETE_FAILED_GUILD_LEADER);
SendPacket(&data);
return;
}
@@ -696,18 +695,15 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
if (sArenaTeamMgr->GetArenaTeamByCaptain(guid))
{
WorldPacket data(SMSG_CHAR_DELETE, 1);
- data << (uint8)CHAR_DELETE_FAILED_ARENA_CAPTAIN;
+ data << uint8(CHAR_DELETE_FAILED_ARENA_CAPTAIN);
SendPacket(&data);
return;
}
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ACCOUNT_NAME_BY_GUID);
-
stmt->setUInt32(0, GUID_LOPART(guid));
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
-
- if (result)
+ if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
Field* fields = result->Fetch();
accountId = fields[0].GetUInt32();
@@ -719,22 +715,25 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
return;
std::string IP_str = GetRemoteAddress();
- sLog->outInfo(LOG_FILTER_NETWORKIO, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
- sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
sScriptMgr->OnPlayerDelete(guid);
sWorld->DeleteCharaceterNameData(GUID_LOPART(guid));
- if (sLog->ShouldLog(LOG_FILTER_PLAYER, LOG_LEVEL_TRACE)) // optimize GetPlayerDump call
+ if (sLog->ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO)) // optimize GetPlayerDump call
{
std::string dump;
if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump))
- sLog->outTrace(LOG_FILTER_PLAYER, dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str());
+ {
+ std::ostringstream ss;
+ ss << GetAccountId() << '_' << name.c_str();
+ sLog->outCharDump(ss.str().c_str(), dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str());
+ }
}
Player::DeleteFromDB(guid, GetAccountId());
WorldPacket data(SMSG_CHAR_DELETE, 1);
- data << (uint8)CHAR_DELETE_SUCCESS;
+ data << uint8(CHAR_DELETE_SUCCESS);
SendPacket(&data);
}
@@ -1006,7 +1005,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
SendNotification(LANG_GM_ON);
std::string IP_str = GetRemoteAddress();
- sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d",
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d",
GetAccountId(), IP_str.c_str(), pCurrChar->GetName(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel());
if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED))
@@ -1183,7 +1182,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
CharacterDatabase.Execute(stmt);
- sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Character:[%s] (guid:%u) Changed name to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), guidLow, newName.c_str());
WorldPacket data(SMSG_CHAR_RENAME, 1+8+(newName.size()+1));
data << uint8(RESPONSE_SUCCESS);
@@ -1450,7 +1449,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
if (result)
{
std::string oldname = result->Fetch()[0].GetString();
- sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s), Character[%s] (guid:%u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), oldname.c_str(), GUID_LOPART(guid), newName.c_str());
}
Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair);
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 02b0ef9fc05..bb0ca39fa37 100755
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -52,6 +52,8 @@
#include "Group.h"
#include "AccountMgr.h"
#include "Spell.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data)
{
@@ -1692,6 +1694,12 @@ void WorldSession::HandleHearthAndResurrect(WorldPacket& /*recv_data*/)
if (_player->isInFlight())
return;
+ if(Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(_player->GetZoneId()))
+ {
+ // bf->PlayerAskToLeave(_player); FIXME
+ return;
+ }
+
AreaTableEntry const* atEntry = GetAreaEntryByAreaID(_player->GetAreaId());
if (!atEntry || !(atEntry->flags & AREA_FLAG_WINTERGRASP_2))
return;
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp
index 7492edb35fe..db18f2a01c9 100755
--- a/src/server/game/Handlers/QuestHandler.cpp
+++ b/src/server/game/Handlers/QuestHandler.cpp
@@ -122,7 +122,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
// no or incorrect quest giver
if (!object || (object->GetTypeId() != TYPEID_PLAYER && !object->hasQuest(questId)) ||
- (object->GetTypeId() == TYPEID_PLAYER && !object->ToPlayer()->CanShareQuest(questId)))
+ (object->GetTypeId() == TYPEID_PLAYER && object != _player && !object->ToPlayer()->CanShareQuest(questId)))
{
_player->PlayerTalkClass->SendCloseGossip();
_player->SetDivider(0);
@@ -582,7 +582,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
continue;
}
- player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, _player->GetGUID(), true);
+ player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GetGUID(), true);
player->SetDivider(_player->GetGUID());
}
}
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp
index 4ca7f97c02b..48ed7bdba1f 100755
--- a/src/server/game/Instances/InstanceSaveMgr.cpp
+++ b/src/server/game/Instances/InstanceSaveMgr.cpp
@@ -275,7 +275,7 @@ void InstanceSaveManager::LoadInstances()
// Load reset times and clean expired instances
sInstanceSaveMgr->LoadResetTimes();
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded instances in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index 6f49a555950..72636a5d2aa 100755
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -1450,7 +1450,7 @@ bool LootTemplate::isReference(uint32 id)
void LoadLootTemplates_Creature()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading creature loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading creature loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1477,16 +1477,14 @@ void LoadLootTemplates_Creature()
LootTemplates_Creature.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty");
-
-
}
void LoadLootTemplates_Disenchant()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading disenchanting loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading disenchanting loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1512,15 +1510,14 @@ void LoadLootTemplates_Disenchant()
LootTemplates_Disenchant.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty");
-
}
void LoadLootTemplates_Fishing()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading fishing loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading fishing loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1537,16 +1534,14 @@ void LoadLootTemplates_Fishing()
LootTemplates_Fishing.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty");
-
-
}
void LoadLootTemplates_Gameobject()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading gameobject loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading gameobject loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1573,16 +1568,14 @@ void LoadLootTemplates_Gameobject()
LootTemplates_Gameobject.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty");
-
-
}
void LoadLootTemplates_Item()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading item loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading item loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1599,16 +1592,14 @@ void LoadLootTemplates_Item()
LootTemplates_Item.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty");
-
-
}
void LoadLootTemplates_Milling()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading milling loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading milling loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1630,16 +1621,14 @@ void LoadLootTemplates_Milling()
LootTemplates_Milling.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty");
-
-
}
void LoadLootTemplates_Pickpocketing()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading pickpocketing loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pickpocketing loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1666,16 +1655,14 @@ void LoadLootTemplates_Pickpocketing()
LootTemplates_Pickpocketing.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty");
-
-
}
void LoadLootTemplates_Prospecting()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading prospecting loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading prospecting loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1697,16 +1684,14 @@ void LoadLootTemplates_Prospecting()
LootTemplates_Prospecting.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty");
-
-
}
void LoadLootTemplates_Mail()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading mail loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading mail loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1723,16 +1708,14 @@ void LoadLootTemplates_Mail()
LootTemplates_Mail.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty");
-
-
}
void LoadLootTemplates_Skinning()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading skinning loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading skinning loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1759,16 +1742,14 @@ void LoadLootTemplates_Skinning()
LootTemplates_Skinning.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty");
-
-
}
void LoadLootTemplates_Spell()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading spell loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1803,15 +1784,14 @@ void LoadLootTemplates_Spell()
LootTemplates_Spell.ReportUnusedIds(lootIdSet);
if (count)
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
else
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty");
-
}
void LoadLootTemplates_Reference()
{
- sLog->outInfo(LOG_FILTER_LOOT, "Loading reference loot templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading reference loot templates...");
uint32 oldMSTime = getMSTime();
@@ -1834,6 +1814,5 @@ void LoadLootTemplates_Reference()
// output error for any still listed ids (not referenced from any loot table)
LootTemplates_Reference.ReportUnusedIds(lootIdSet);
- sLog->outInfo(LOG_FILTER_LOOT, ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index 6d526f23a94..0743c4e545f 100755
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -439,9 +439,9 @@ class Map : public GridRefManager<NGridType>
float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const;
bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const;
void Balance() { _dynamicTree.balance(); }
- void Remove(const GameObjectModel& mdl) { _dynamicTree.remove(mdl); }
- void Insert(const GameObjectModel& mdl) { _dynamicTree.insert(mdl); }
- bool Contains(const GameObjectModel& mdl) const { return _dynamicTree.contains(mdl);}
+ void RemoveGameObjectModel(const GameObjectModel& model) { _dynamicTree.remove(model); }
+ void InsertGameObjectModel(const GameObjectModel& model) { _dynamicTree.insert(model); }
+ bool ContainsGameObjectModel(const GameObjectModel& model) const { return _dynamicTree.contains(model);}
bool getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist);
/*
diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h
index aec72835d86..a766108dbb0 100755
--- a/src/server/game/Miscellaneous/Language.h
+++ b/src/server/game/Miscellaneous/Language.h
@@ -957,7 +957,10 @@ enum TrinityStrings
LANG_COMMAND_LOOKUP_MAX_RESULTS = 5029,
LANG_FLEE = 5030,
LANG_NPCINFO_AIINFO = 5031,
- // Room for more Trinity strings 5032-9999
+ LANG_COMMAND_NO_BATTLEGROUND_FOUND = 5032,
+ LANG_COMMAND_NO_ACHIEVEMENT_CRITERIA_FOUND = 5033,
+ LANG_COMMAND_NO_OUTDOOR_PVP_FORUND = 5034,
+ // Room for more Trinity strings 5035-9999
// Level requirement notifications
LANG_SAY_REQ = 6604,
diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp
index 214fd23fc8a..a01e18347f6 100755
--- a/src/server/game/Movement/Waypoints/WaypointManager.cpp
+++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp
@@ -86,7 +86,7 @@ void WaypointMgr::Load()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u waypoints in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
index 5ada88cdf7a..ce987e25eed 100755
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
@@ -46,8 +46,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
if (!result)
{
- sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty.");
-
+ sLog->outError(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 outdoor PvP definitions. DB table `outdoorpvp_template` is empty.");
return;
}
@@ -106,8 +105,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
m_OutdoorPvPSet.push_back(pvp);
}
- sLog->outInfo(LOG_FILTER_OUTDOORPVP, ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u outdoor PvP definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP* handle)
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index 6ee70101af7..79e8d47aa94 100755
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -571,7 +571,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
mPoolTemplate.clear();
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 object pools. DB table `pool_template` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 object pools. DB table `pool_template` is empty.");
return;
}
@@ -589,12 +589,12 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u objects pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Creatures
- sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Creatures Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creatures Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -603,7 +603,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 creatures in pools. DB table `pool_creature` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 creatures in pools. DB table `pool_creature` is empty.");
}
else
{
@@ -644,13 +644,13 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creatures in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Gameobjects
- sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Gameobject Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -659,7 +659,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 gameobjects in pools. DB table `pool_gameobject` is empty.");
}
else
{
@@ -712,13 +712,13 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u gameobject in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// Pool of pools
- sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Mother Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Mother Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -727,7 +727,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 pools in pools");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 pools in pools");
}
else
{
@@ -796,11 +796,11 @@ void PoolMgr::LoadFromDB()
}
}
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pools in mother pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
- sLog->outInfo(LOG_FILTER_POOLSYS, "Loading Quest Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest Pooling Data...");
{
uint32 oldMSTime = getMSTime();
@@ -809,7 +809,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded 0 quests in pools");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 quests in pools");
}
else
{
@@ -884,12 +884,12 @@ void PoolMgr::LoadFromDB()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u quests in pools in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
// The initialize method will spawn all pools not in an event and not in another pool, this is why there is 2 left joins with 2 null checks
- sLog->outInfo(LOG_FILTER_POOLSYS, "Starting objects pooling system...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting objects pooling system...");
{
uint32 oldMSTime = getMSTime();
@@ -899,7 +899,7 @@ void PoolMgr::LoadFromDB()
if (!result)
{
- sLog->outInfo(LOG_FILTER_POOLSYS, ">> Pool handling system initialized, 0 pools spawned.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Pool handling system initialized, 0 pools spawned.");
}
else
{
diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp
index 319fd1eb702..0c6948160eb 100755
--- a/src/server/game/Scripting/ScriptLoader.cpp
+++ b/src/server/game/Scripting/ScriptLoader.cpp
@@ -508,6 +508,7 @@ void AddSC_howling_fjord();
void AddSC_icecrown();
void AddSC_sholazar_basin();
void AddSC_storm_peaks();
+void AddSC_wintergrasp();
void AddSC_zuldrak();
void AddSC_crystalsong_forest();
void AddSC_isle_of_conquest();
@@ -1224,6 +1225,7 @@ void AddNorthrendScripts()
AddSC_icecrown();
AddSC_sholazar_basin();
AddSC_storm_peaks();
+ AddSC_wintergrasp();
AddSC_zuldrak();
AddSC_crystalsong_forest();
AddSC_isle_of_conquest();
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index f5adf67a9ab..61d8711fd71 100755
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -251,13 +251,12 @@ void ScriptMgr::Initialize()
LoadDatabase();
- sLog->outInfo(LOG_FILTER_TSCR, "Loading C++ scripts");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading C++ scripts");
FillSpellSummary();
AddScripts();
- sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u C++ scripts in %u ms", GetScriptCount(), GetMSTimeDiffToNow(oldMSTime));
}
void ScriptMgr::Unload()
@@ -724,6 +723,14 @@ bool ScriptMgr::OnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effInd
return tmpscript->OnDummyEffect(caster, spellId, effIndex, target);
}
+GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go)
+{
+ ASSERT(go);
+
+ GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, NULL);
+ return tmpscript->GetAI(go);
+}
+
bool ScriptMgr::OnQuestAccept(Player* player, Item* item, Quest const* quest)
{
ASSERT(player);
@@ -973,14 +980,6 @@ bool ScriptMgr::OnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effInd
return tmpscript->OnDummyEffect(caster, spellId, effIndex, target);
}
-GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go)
-{
- ASSERT(go);
-
- GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, NULL);
- return tmpscript->GetAI(go);
-}
-
bool ScriptMgr::OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger)
{
ASSERT(player);
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index 3c2ee81afff..270182509f9 100755
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -164,7 +164,7 @@ class ScriptObject
protected:
ScriptObject(const char* name)
- : _name(std::string(name))
+ : _name(name)
{
}
diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp
index f24b01306c5..41b41b91808 100755
--- a/src/server/game/Scripting/ScriptSystem.cpp
+++ b/src/server/game/Scripting/ScriptSystem.cpp
@@ -25,10 +25,10 @@ ScriptPointVector const SystemMgr::_empty;
void SystemMgr::LoadScriptTexts()
{
- sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts...");
LoadTrinityStrings("script_texts", TEXT_SOURCE_RANGE, 1+(TEXT_SOURCE_RANGE*2));
- sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Texts additional data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Texts additional data...");
uint32 oldMSTime = getMSTime();
// 0 1 2 3
@@ -36,8 +36,7 @@ void SystemMgr::LoadScriptTexts()
if (!result)
{
- sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty.");
return;
}
@@ -83,23 +82,21 @@ void SystemMgr::LoadScriptTexts()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Script Texts data in %u ms", uiCount, GetMSTimeDiffToNow(oldMSTime));
}
void SystemMgr::LoadScriptTextsCustom()
{
- sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Custom Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts...");
LoadTrinityStrings("custom_texts", TEXT_SOURCE_RANGE*2, 1+(TEXT_SOURCE_RANGE*3));
- sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Custom Texts additional data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Custom Texts additional data...");
QueryResult result = WorldDatabase.Query("SELECT entry, sound, type, language, emote FROM custom_texts");
if (!result)
{
- sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty.");
return;
}
@@ -145,8 +142,7 @@ void SystemMgr::LoadScriptTextsCustom()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u additional Custom Texts data.", uiCount);
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u additional Custom Texts data.", uiCount);
}
void SystemMgr::LoadScriptWaypoints()
@@ -163,15 +159,14 @@ void SystemMgr::LoadScriptWaypoints()
if (result)
uiCreatureCount = result->GetRowCount();
- sLog->outInfo(LOG_FILTER_TSCR, "TSCR: Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Waypoints for " UI64FMTD " creature(s)...", uiCreatureCount);
// 0 1 2 3 4 5
result = WorldDatabase.Query("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid");
if (!result)
{
- sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty.");
return;
}
@@ -206,6 +201,5 @@ void SystemMgr::LoadScriptWaypoints()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_TSCR, ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Script Waypoint nodes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Server/Protocol/PacketLog.cpp b/src/server/game/Server/Protocol/PacketLog.cpp
new file mode 100644
index 00000000000..cb6dcdbdb9e
--- /dev/null
+++ b/src/server/game/Server/Protocol/PacketLog.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "PacketLog.h"
+#include "Config.h"
+#include "ByteBuffer.h"
+#include "WorldPacket.h"
+
+PacketLog::PacketLog() : _file(NULL)
+{
+ Initialize();
+}
+
+PacketLog::~PacketLog()
+{
+ if (_file)
+ fclose(_file);
+
+ _file = NULL;
+}
+
+void PacketLog::Initialize()
+{
+ std::string logsDir = ConfigMgr::GetStringDefault("LogsDir", "");
+
+ if (!logsDir.empty())
+ if ((logsDir.at(logsDir.length()-1) != '/') && (logsDir.at(logsDir.length()-1) != '\\'))
+ logsDir.push_back('/');
+
+ std::string logname = ConfigMgr::GetStringDefault("PacketLogFile", "");
+ if (!logname.empty())
+ _file = fopen((logsDir + logname).c_str(), "wb");
+}
+
+void PacketLog::LogPacket(WorldPacket const& packet, Direction direction)
+{
+ ByteBuffer data(4+4+4+1+packet.size());
+ data << int32(packet.GetOpcode());
+ data << int32(packet.size());
+ data << uint32(time(NULL));
+ data << uint8(direction);
+
+ for (uint32 i = 0; i < packet.size(); i++)
+ data << const_cast<WorldPacket&>(packet)[i];
+
+ fwrite(data.contents(), 1, data.size(), _file);
+ fflush(_file);
+}
diff --git a/src/server/game/Server/Protocol/PacketLog.h b/src/server/game/Server/Protocol/PacketLog.h
new file mode 100644
index 00000000000..b899daae198
--- /dev/null
+++ b/src/server/game/Server/Protocol/PacketLog.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TRINITY_PACKETLOG_H
+#define TRINITY_PACKETLOG_H
+
+#include "Common.h"
+#include <ace/Singleton.h>
+
+enum Direction
+{
+ CLIENT_TO_SERVER,
+ SERVER_TO_CLIENT
+};
+
+class WorldPacket;
+
+class PacketLog
+{
+ friend class ACE_Singleton<PacketLog, ACE_Thread_Mutex>;
+
+ private:
+ PacketLog();
+ ~PacketLog();
+
+ public:
+ void Initialize();
+ bool CanLogPacket() const { return (_file != NULL); }
+ void LogPacket(WorldPacket const& packet, Direction direction);
+
+ private:
+ FILE* _file;
+};
+
+#define sPacketLog ACE_Singleton<PacketLog, ACE_Thread_Mutex>::instance()
+#endif
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 6e45ebf37c1..118b0d68d5d 100755
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -534,7 +534,7 @@ void WorldSession::LogoutPlayer(bool Save)
// e.g if he got disconnected during a transfer to another map
// calls to GetMap in this case may cause crashes
_player->CleanupsBeforeDelete();
- sLog->outDebug(LOG_FILTER_PLAYER, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel());
+ sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d (IP: %s) Logout Character:[%s] (GUID: %u) Level: %d", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName(), _player->GetGUIDLow(), _player->getLevel());
if (Map* _map = _player->FindMap())
_map->RemovePlayerFromMap(_player, true);
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index b8b09531082..40485e2fa3b 100755
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -125,6 +125,16 @@ enum PartyResult
ERR_PARTY_LFG_TELEPORT_IN_COMBAT = 30
};
+
+enum BFLeaveReason
+{
+ BF_LEAVE_REASON_CLOSE = 0x00000001,
+ //BF_LEAVE_REASON_UNK1 = 0x00000002, (not used)
+ //BF_LEAVE_REASON_UNK2 = 0x00000004, (not used)
+ BF_LEAVE_REASON_EXITED = 0x00000008,
+ BF_LEAVE_REASON_LOW_LEVEL = 0x00000010,
+};
+
enum ChatRestrictionType
{
ERR_CHAT_RESTRICTED = 0,
@@ -786,7 +796,16 @@ class WorldSession
void HandleResetInstancesOpcode(WorldPacket& recv_data);
void HandleHearthAndResurrect(WorldPacket& recv_data);
void HandleInstanceLockResponse(WorldPacket& recvPacket);
- void HandleUpdateMissileTrajectory(WorldPacket& recvPacket);
+
+ // Battlefield
+ void SendBfInvitePlayerToWar(uint32 BattleId,uint32 ZoneId,uint32 time);
+ void SendBfInvitePlayerToQueue(uint32 BattleId);
+ void SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false);
+ void SendBfEntered(uint32 BattleId);
+ void SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason = BF_LEAVE_REASON_EXITED);
+ void HandleBfQueueInviteResponse(WorldPacket &recv_data);
+ void HandleBfEntryInviteResponse(WorldPacket &recv_data);
+ void HandleBfExitRequest(WorldPacket &recv_data);
// Looking for Dungeon/Raid
void HandleLfgSetCommentOpcode(WorldPacket& recv_data);
@@ -914,6 +933,7 @@ class WorldSession
void HandleEjectPassenger(WorldPacket& data);
void HandleEnterPlayerVehicle(WorldPacket& data);
void HandleUpdateProjectilePosition(WorldPacket& recvPacket);
+ void HandleUpdateMissileTrajectory(WorldPacket& recvPacket);
private:
void InitializeQueryCallbackParameters();
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index 5b04c3dc714..ed960fd9693 100755
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
@@ -42,6 +42,7 @@
#include "WorldSession.h"
#include "WorldSocketMgr.h"
#include "Log.h"
+#include "PacketLog.h"
#include "ScriptMgr.h"
#include "AccountMgr.h"
@@ -159,30 +160,8 @@ int WorldSocket::SendPacket(WorldPacket const& pct)
return -1;
// Dump outgoing packet.
- if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE))
- {
- char buff[250];
- snprintf(buff, 250, "SERVER:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
- uint32(get_handle()),
- uint32(pct.size()),
- LookupOpcodeName (pct.GetOpcode()),
- pct.GetOpcode());
-
- std::string data(buff);
- uint32 p = 0;
- while (p < pct.size())
- {
- for (uint32 j = 0; j < 16 && p < pct.size(); j++)
- {
- snprintf(buff, 250, "%.2X ", const_cast<WorldPacket&>(pct)[p++]);
- data.append(buff);
- }
- data.append("\n");
- }
-
- data.append("\n");
- sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", data.c_str());
- }
+ if (sPacketLog->CanLogPacket())
+ sPacketLog->LogPacket(pct, SERVER_TO_CLIENT);
// Create a copy of the original packet; this is to avoid issues if a hook modifies it.
sScriptMgr->OnPacketSend(this, WorldPacket(pct));
@@ -691,30 +670,9 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
if (closing_)
return -1;
- if (sLog->ShouldLog(LOG_FILTER_NETWORKIO, LOG_LEVEL_TRACE))
- {
- char buff[250];
- snprintf(buff, 250, "CLIENT:\nSOCKET: %u\nLENGTH: %u\nOPCODE: %s (0x%.4X)\nDATA:\n",
- uint32(get_handle()),
- uint32(new_pct->size()),
- LookupOpcodeName (new_pct->GetOpcode()),
- new_pct->GetOpcode());
-
- std::string data(buff);
- uint32 p = 0;
- while (p < new_pct->size())
- {
- for (uint32 j = 0; j < 16 && p < new_pct->size(); j++)
- {
- snprintf(buff, 250, "%.2X ", const_cast<WorldPacket&>(*new_pct)[p++]);
- data.append(buff);
- }
- data.append("\n");
- }
-
- data.append("\n");
- sLog->outTrace(LOG_FILTER_NETWORKIO, "%s", data.c_str());
- }
+ // Dump received packet.
+ if (sPacketLog->CanLogPacket())
+ sPacketLog->LogPacket(*new_pct, CLIENT_TO_SERVER);
try
{
diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp
index d9cfbe6b69c..3eac3d34fd2 100755
--- a/src/server/game/Skills/SkillDiscovery.cpp
+++ b/src/server/game/Skills/SkillDiscovery.cpp
@@ -153,7 +153,7 @@ void LoadSkillDiscoveryTable()
sLog->outError(LOG_FILTER_SQL, "Spell (ID: %u) is 100%% chance random discovery ability but not have data in `skill_discovery_template` table", spell_id);
}
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u skill discovery definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp
index 9cb4c145b3d..9e2648dc943 100755
--- a/src/server/game/Skills/SkillExtraItems.cpp
+++ b/src/server/game/Skills/SkillExtraItems.cpp
@@ -110,7 +110,7 @@ void LoadSkillExtraItemTable()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell specialization definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 610cd7d1533..f6cd5008b3c 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -36,6 +36,8 @@
#include "CellImpl.h"
#include "ScriptMgr.h"
#include "Vehicle.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
class Aura;
//
@@ -5016,8 +5018,12 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
case 2584: // Waiting to Resurrect
// Waiting to resurrect spell cancel, we must remove player from resurrect queue
if (target->GetTypeId() == TYPEID_PLAYER)
+ {
if (Battleground* bg = target->ToPlayer()->GetBattleground())
bg->RemovePlayerFromResurrectQueue(target->GetGUID());
+ if(Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(target->GetZoneId()))
+ bf->RemovePlayerFromResurrectQueue(target->GetGUID());
+ }
break;
case 36730: // Flame Strike
{
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 3742ee5fc52..be92a86f958 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -53,6 +53,8 @@
#include "SpellScript.h"
#include "InstanceScript.h"
#include "SpellInfo.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS];
@@ -5442,6 +5444,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// allow always ghost flight spells
if (m_originalCaster && m_originalCaster->GetTypeId() == TYPEID_PLAYER && m_originalCaster->isAlive())
{
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(m_originalCaster->GetZoneId());
if (AreaTableEntry const* pArea = GetAreaEntryByAreaID(m_originalCaster->GetAreaId()))
if (pArea->flags & AREA_FLAG_NO_FLY_ZONE)
return (_triggeredCastFlags & TRIGGERED_DONT_REPORT_CAST_ERROR) ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_NOT_HERE;
@@ -5544,7 +5547,7 @@ SpellCastResult Spell::CheckCasterAuras() const
// We use bitmasks so the loop is done only once and not on every aura check below.
if (m_spellInfo->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY)
{
- for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_SCHOOL_IMMUNITY)
school_immune |= uint32(m_spellInfo->Effects[i].MiscValue);
@@ -5612,7 +5615,7 @@ SpellCastResult Spell::CheckCasterAuras() const
SpellInfo const* auraInfo = aura->GetSpellInfo();
if (auraInfo->GetAllEffectsMechanicMask() & mechanic_immune)
continue;
- if (auraInfo->GetSchoolMask() & school_immune)
+ if (auraInfo->GetSchoolMask() & school_immune && !(auraInfo->AttributesEx & SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE))
continue;
if (auraInfo->GetDispelMask() & dispel_immune)
continue;
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 95f67d05e9a..d30f6e593dd 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -2420,12 +2420,13 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
return;
// The spell that this effect will trigger. It has SPELL_AURA_CONTROL_VEHICLE
- uint32 spell = VEHICLE_SPELL_RIDE_HARDCODED;
- if (SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].CalcValue()))
- spell = spellProto->Id;
+ uint32 spellId = VEHICLE_SPELL_RIDE_HARDCODED;
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].CalcValue());
+ if (spellInfo && spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE))
+ spellId = spellInfo->Id;
// Hard coded enter vehicle spell
- m_originalCaster->CastSpell(summon, spell, true);
+ m_originalCaster->CastSpell(summon, spellId, true);
uint32 faction = properties->Faction;
if (!faction)
@@ -4771,16 +4772,18 @@ void Spell::EffectInebriate(SpellEffIndex /*effIndex*/)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
- Player* player = (Player*)unitTarget;
- uint16 currentDrunk = player->GetDrunkValue();
- uint16 drunkMod = damage * 256;
- if (currentDrunk + drunkMod > 0xFFFF)
+ Player* player = unitTarget->ToPlayer();
+ uint8 currentDrunk = player->GetDrunkValue();
+ uint8 drunkMod = damage;
+ if (currentDrunk + drunkMod > 100)
{
- currentDrunk = 0xFFFF;
- player->CastSpell(player, 67468, false);
+ currentDrunk = 100;
+ if (rand_chance() < 25.0f)
+ player->CastSpell(player, 67468, false); // Drunken Vomit
}
else
currentDrunk += drunkMod;
+
player->SetDrunkValue(currentDrunk, m_CastItem ? m_CastItem->GetEntry() : 0);
}
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index a397bb13709..7b3f9a1bef9 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -2205,14 +2205,15 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const
case SPELLFAMILY_GENERIC:
switch (Id)
{
+ case 29214: // Wrath of the Plaguebringer
case 34700: // Allergic Reaction
+ case 54836: // Wrath of the Plaguebringer
case 61987: // Avenging Wrath Marker
case 61988: // Divine Shield exclude aura
- case 62532: // Conservator's Grip
return false;
+ case 30877: // Tag Murloc
case 61716: // Rabbit Costume
case 61734: // Noblegarden Bunny
- case 30877: // Tag Murloc
case 62344: // Fists of Stone
return true;
default:
@@ -2298,6 +2299,8 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const
case SPELL_EFFECT_HEAL_PCT:
case SPELL_EFFECT_ENERGIZE_PCT:
return true;
+ case SPELL_EFFECT_APPLY_AREA_AURA_ENEMY:
+ return false;
// non-positive aura use
case SPELL_EFFECT_APPLY_AURA:
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index 3cc3a877337..9545a03a9f4 100755
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -30,6 +30,8 @@
#include "CreatureAI.h"
#include "MapManager.h"
#include "BattlegroundIC.h"
+#include "BattlefieldWG.h"
+#include "BattlefieldMgr.h"
bool IsPrimaryProfessionSkill(uint32 skill)
{
@@ -1120,6 +1122,16 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return false;
break;
}
+ case 58730: // No fly Zone - Wintergrasp
+ {
+ if (!player)
+ return false;
+
+ Battlefield* Bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
+ if (!Bf || Bf->CanFlyIn() || (!player->HasAuraType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) && !player->HasAuraType(SPELL_AURA_FLY)))
+ return false;
+ break;
+ }
case 68719: // Oil Refinery - Isle of Conquest.
case 68720: // Quarry - Isle of Conquest.
{
@@ -1135,6 +1147,26 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
return false;
}
+ case 56618: // Horde Controls Factory Phase Shift
+ case 56617: // Alliance Controls Factory Phase Shift
+ {
+ if (!player)
+ return false;
+
+ Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId());
+
+ if (!bf || bf->GetTypeId() != BATTLEFIELD_WG)
+ return false;
+
+ // team that controls the workshop in the specified area
+ uint32 team = bf->GetData(newArea);
+
+ if (team == TEAM_HORDE)
+ return spellId == 56618;
+ else if (team == TEAM_ALLIANCE)
+ return spellId == 56617;
+ }
+ break;
}
return true;
@@ -1155,7 +1187,7 @@ void SpellMgr::LoadSpellRanks()
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty.");
return;
}
@@ -1251,7 +1283,7 @@ void SpellMgr::LoadSpellRanks()
while (true);
} while (!finished);
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -1267,7 +1299,7 @@ void SpellMgr::LoadSpellRequired()
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell required records. DB table `spell_required` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell required records. DB table `spell_required` is empty.");
return;
}
@@ -1312,7 +1344,7 @@ void SpellMgr::LoadSpellRequired()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell required records in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -1350,8 +1382,7 @@ void SpellMgr::LoadSpellLearnSkills()
}
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u Spell Learn Skills from DBC in %u ms", dbc_count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellLearnSpells()
@@ -1364,8 +1395,7 @@ void SpellMgr::LoadSpellLearnSpells()
QueryResult result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell learn spells. DB table `spell_learn_spell` is empty.");
return;
}
@@ -1453,8 +1483,7 @@ void SpellMgr::LoadSpellLearnSpells()
}
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell learn spells + %u found in DBC in %u ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellTargetPositions()
@@ -1467,8 +1496,7 @@ void SpellMgr::LoadSpellTargetPositions()
QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty.");
return;
}
@@ -1573,8 +1601,7 @@ void SpellMgr::LoadSpellTargetPositions()
}
}*/
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell teleport coordinates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellGroups()
@@ -1588,8 +1615,7 @@ void SpellMgr::LoadSpellGroups()
QueryResult result = WorldDatabase.Query("SELECT id, spell_id FROM spell_group");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell group definitions. DB table `spell_group` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell group definitions. DB table `spell_group` is empty.");
return;
}
@@ -1655,8 +1681,7 @@ void SpellMgr::LoadSpellGroups()
}
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell group definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellGroupStackRules()
@@ -1669,8 +1694,7 @@ void SpellMgr::LoadSpellGroupStackRules()
QueryResult result = WorldDatabase.Query("SELECT group_id, stack_rule FROM spell_group_stack_rules");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell group stack rules. DB table `spell_group_stack_rules` is empty.");
return;
}
@@ -1700,8 +1724,7 @@ void SpellMgr::LoadSpellGroupStackRules()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell group stack rules in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellProcEvents()
@@ -1714,8 +1737,7 @@ void SpellMgr::LoadSpellProcEvents()
QueryResult result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell proc event conditions. DB table `spell_proc_event` is empty.");
return;
}
@@ -1762,9 +1784,9 @@ void SpellMgr::LoadSpellProcEvents()
} while (result->NextRow());
if (customProc)
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra and %u custom spell proc event conditions in %u ms", count, customProc, GetMSTimeDiffToNow(oldMSTime));
else
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell proc event conditions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -1778,8 +1800,7 @@ void SpellMgr::LoadSpellProcs()
QueryResult result = WorldDatabase.Query("SELECT spellId, schoolMask, spellFamilyName, spellFamilyMask0, spellFamilyMask1, spellFamilyMask2, typeMask, spellTypeMask, spellPhaseMask, hitMask, attributesMask, ratePerMinute, chance, cooldown, charges FROM spell_proc");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell proc conditions and data. DB table `spell_proc` is empty.");
return;
}
@@ -1905,8 +1926,7 @@ void SpellMgr::LoadSpellProcs()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell proc conditions and data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellBonusess()
@@ -1919,8 +1939,7 @@ void SpellMgr::LoadSpellBonusess()
QueryResult result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell bonus data. DB table `spell_bonus_data` is empty.");
return;
}
@@ -1946,8 +1965,7 @@ void SpellMgr::LoadSpellBonusess()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u extra spell bonus data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellThreats()
@@ -1960,8 +1978,7 @@ void SpellMgr::LoadSpellThreats()
QueryResult result = WorldDatabase.Query("SELECT entry, flatMod, pctMod, apPctMod FROM spell_threat");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 aggro generating spells. DB table `spell_threat` is empty.");
return;
}
@@ -1987,8 +2004,7 @@ void SpellMgr::LoadSpellThreats()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSkillLineAbilityMap()
@@ -2009,8 +2025,7 @@ void SpellMgr::LoadSkillLineAbilityMap()
++count;
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u SkillLineAbility MultiMap Data in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellPetAuras()
@@ -2023,8 +2038,7 @@ void SpellMgr::LoadSpellPetAuras()
QueryResult result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell pet auras. DB table `spell_pet_auras` is empty.");
return;
}
@@ -2071,8 +2085,7 @@ void SpellMgr::LoadSpellPetAuras()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell pet auras in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Fill custom data about enchancments
@@ -2112,8 +2125,7 @@ void SpellMgr::LoadEnchantCustomAttr()
}
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u custom enchant attributes in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellEnchantProcData()
@@ -2126,8 +2138,7 @@ void SpellMgr::LoadSpellEnchantProcData()
QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty.");
return;
}
@@ -2156,8 +2167,7 @@ void SpellMgr::LoadSpellEnchantProcData()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u enchant proc data definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellLinked()
@@ -2170,8 +2180,7 @@ void SpellMgr::LoadSpellLinked()
QueryResult result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell");
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty.");
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 linked spells. DB table `spell_linked_spell` is empty.");
return;
}
@@ -2209,8 +2218,7 @@ void SpellMgr::LoadSpellLinked()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u linked spells in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadPetLevelupSpellMap()
@@ -2266,8 +2274,7 @@ void SpellMgr::LoadPetLevelupSpellMap()
}
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u pet levelup and default spells for %u families in %u ms", count, family_count, GetMSTimeDiffToNow(oldMSTime));
}
bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpellsEntry& petDefSpells)
@@ -2351,10 +2358,9 @@ void SpellMgr::LoadPetDefaultSpells()
}
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded addition spells for %u pet spell data entries in %u ms", countData, GetMSTimeDiffToNow(oldMSTime));
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, "Loading summonable creature templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading summonable creature templates...");
oldMSTime = getMSTime();
// different summon spells
@@ -2395,8 +2401,7 @@ void SpellMgr::LoadPetDefaultSpells()
}
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u summonable creature templates in %u ms", countCreature, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellAreas()
@@ -2414,7 +2419,7 @@ void SpellMgr::LoadSpellAreas()
if (!result)
{
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded 0 spell area requirements. DB table `spell_area` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell area requirements. DB table `spell_area` is empty.");
return;
}
@@ -2595,8 +2600,7 @@ void SpellMgr::LoadSpellAreas()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell area requirements in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadSpellInfoStore()
@@ -2612,8 +2616,7 @@ void SpellMgr::LoadSpellInfoStore()
mSpellInfoMap[i] = new SpellInfo(spellEntry);
}
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::UnloadSpellInfoStore()
@@ -2925,8 +2928,7 @@ void SpellMgr::LoadSpellCustomAttr()
CreatureAI::FillAISpellInfo();
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded spell custom attributes in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
void SpellMgr::LoadDbcDataCorrections()
@@ -3241,10 +3243,6 @@ void SpellMgr::LoadDbcDataCorrections()
// this needs research on modifier applying rules, does not seem to be in Attributes fields
spellInfo->EffectSpellClassMask[0] = flag96(0x00000040, 0x00000000, 0x00000000);
break;
- case 63163: // Apply Enchanted Bridle (Argent Tournament)
- spellInfo->EffectDieSides[0] = 0; // was 1, that should probably mean seat 0, but instead it's treated as spell 1
- spellInfo->EffectBasePoints[0] = 52391; // Ride Vehicle (forces seat 0)
- break;
case 45602: // Ride Carpet
spellInfo->EffectBasePoints[EFFECT_0] = 0; // force seat 0, vehicle doesn't have the required seat flags for "no seat specified (-1)"
break;
@@ -3569,6 +3567,5 @@ void SpellMgr::LoadDbcDataCorrections()
properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(647)); // 52893
properties->Type = SUMMON_TYPE_TOTEM;
- sLog->outInfo(LOG_FILTER_SPELLS_AURAS, ">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime));
-
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loading spell dbc data corrections in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp
index f64043b7038..7818527b34b 100755
--- a/src/server/game/Texts/CreatureTextMgr.cpp
+++ b/src/server/game/Texts/CreatureTextMgr.cpp
@@ -77,7 +77,7 @@ void CreatureTextMgr::LoadCreatureTexts()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 ceature texts. DB table `creature_texts` is empty.");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 ceature texts. DB table `creature_texts` is empty.");
return;
}
@@ -136,7 +136,7 @@ void CreatureTextMgr::LoadCreatureTexts()
++textCount;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature texts for %u creatures in %u ms", textCount, creatureCount, GetMSTimeDiffToNow(oldMSTime));
}
@@ -166,7 +166,7 @@ void CreatureTextMgr::LoadCreatureTextLocales()
++textCount;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u creature localized texts in %u ms", textCount, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp
index d03ffbbb1f6..0a4682db759 100755
--- a/src/server/game/Tickets/TicketMgr.cpp
+++ b/src/server/game/Tickets/TicketMgr.cpp
@@ -263,7 +263,7 @@ void TicketMgr::LoadTickets()
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 GM tickets. DB table `gm_tickets` is empty!");
return;
}
@@ -290,7 +290,7 @@ void TicketMgr::LoadTickets()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u GM tickets in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -303,7 +303,7 @@ void TicketMgr::LoadSurveys()
if (QueryResult result = CharacterDatabase.Query("SELECT MAX(surveyId) FROM gm_surveys"))
_lastSurveyId = (*result)[0].GetUInt32();
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded GM Survey count from database in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
index 2bd9a157e73..f87b81c8be8 100644
--- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp
+++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp
@@ -63,7 +63,7 @@ void CharacterDatabaseCleaner::CleanDatabase()
sWorld->SetCleaningFlags(flags);
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Cleaned character database in %u ms", GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp
index 0e7f1c87b26..da62122d7a3 100755
--- a/src/server/game/Weather/WeatherMgr.cpp
+++ b/src/server/game/Weather/WeatherMgr.cpp
@@ -137,7 +137,7 @@ void LoadWeatherData()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u weather definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 3a13f48d807..d860530d97d 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -77,6 +77,7 @@
#include "WardenCheckMgr.h"
#include "Warden.h"
#include "CalendarMgr.h"
+#include "BattlefieldMgr.h"
ACE_Atomic_Op<ACE_Thread_Mutex, bool> World::m_stopEvent = false;
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
@@ -398,6 +399,7 @@ void World::LoadConfigSettings(bool reload)
sLog->outError(LOG_FILTER_GENERAL, "World settings reload fail: can't read settings from %s.", ConfigMgr::GetFilename().c_str());
return;
}
+ sLog->LoadFromConfig();
}
///- Read the player limit and the Message of the day from the config file
@@ -417,27 +419,27 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_HEALTH] = ConfigMgr::GetFloatDefault("Rate.Health", 1);
if (rate_values[RATE_HEALTH] < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Health (%f) must be > 0. Using 1 instead.", rate_values[RATE_HEALTH]);
rate_values[RATE_HEALTH] = 1;
}
rate_values[RATE_POWER_MANA] = ConfigMgr::GetFloatDefault("Rate.Mana", 1);
if (rate_values[RATE_POWER_MANA] < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Mana (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_MANA]);
rate_values[RATE_POWER_MANA] = 1;
}
rate_values[RATE_POWER_RAGE_INCOME] = ConfigMgr::GetFloatDefault("Rate.Rage.Income", 1);
rate_values[RATE_POWER_RAGE_LOSS] = ConfigMgr::GetFloatDefault("Rate.Rage.Loss", 1);
if (rate_values[RATE_POWER_RAGE_LOSS] < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Rage.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RAGE_LOSS]);
rate_values[RATE_POWER_RAGE_LOSS] = 1;
}
rate_values[RATE_POWER_RUNICPOWER_INCOME] = ConfigMgr::GetFloatDefault("Rate.RunicPower.Income", 1);
rate_values[RATE_POWER_RUNICPOWER_LOSS] = ConfigMgr::GetFloatDefault("Rate.RunicPower.Loss", 1);
if (rate_values[RATE_POWER_RUNICPOWER_LOSS] < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.RunicPower.Loss (%f) must be > 0. Using 1 instead.", rate_values[RATE_POWER_RUNICPOWER_LOSS]);
rate_values[RATE_POWER_RUNICPOWER_LOSS] = 1;
}
rate_values[RATE_POWER_FOCUS] = ConfigMgr::GetFloatDefault("Rate.Focus", 1.0f);
@@ -461,7 +463,7 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_REPAIRCOST] = ConfigMgr::GetFloatDefault("Rate.RepairCost", 1.0f);
if (rate_values[RATE_REPAIRCOST] < 0.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.RepairCost (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_REPAIRCOST]);
rate_values[RATE_REPAIRCOST] = 0.0f;
}
rate_values[RATE_REPUTATION_GAIN] = ConfigMgr::GetFloatDefault("Rate.Reputation.Gain", 1.0f);
@@ -498,13 +500,13 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_TALENT] = ConfigMgr::GetFloatDefault("Rate.Talent", 1.0f);
if (rate_values[RATE_TALENT] < 0.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.Talent (%f) must be > 0. Using 1 instead.", rate_values[RATE_TALENT]);
rate_values[RATE_TALENT] = 1.0f;
}
rate_values[RATE_MOVESPEED] = ConfigMgr::GetFloatDefault("Rate.MoveSpeed", 1.0f);
if (rate_values[RATE_MOVESPEED] < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Rate.MoveSpeed (%f) must be > 0. Using 1 instead.", rate_values[RATE_MOVESPEED]);
rate_values[RATE_MOVESPEED] = 1.0f;
}
for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) playerBaseMoveSpeed[i] = baseMoveSpeed[i] * rate_values[RATE_MOVESPEED];
@@ -513,12 +515,12 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = ConfigMgr::GetFloatDefault("TargetPosRecalculateRange", 1.5f);
if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] < CONTACT_DISTANCE)
{
- sLog->outError(LOG_FILTER_GENERAL, "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "TargetPosRecalculateRange (%f) must be >= %f. Using %f instead.", rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], CONTACT_DISTANCE, CONTACT_DISTANCE);
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = CONTACT_DISTANCE;
}
else if (rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] > NOMINAL_MELEE_RANGE)
{
- sLog->outError(LOG_FILTER_GENERAL, "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "TargetPosRecalculateRange (%f) must be <= %f. Using %f instead.",
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE], NOMINAL_MELEE_RANGE, NOMINAL_MELEE_RANGE);
rate_values[RATE_TARGET_POS_RECALCULATION_RANGE] = NOMINAL_MELEE_RANGE;
}
@@ -526,12 +528,12 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = ConfigMgr::GetFloatDefault("DurabilityLoss.OnDeath", 10.0f);
if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] < 0.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLoss.OnDeath (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f;
}
if (rate_values[RATE_DURABILITY_LOSS_ON_DEATH] > 100.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLoss.OnDeath (%f) must be <= 100. Using 100.0 instead.", rate_values[RATE_DURABILITY_LOSS_ON_DEATH]);
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_ON_DEATH] = rate_values[RATE_DURABILITY_LOSS_ON_DEATH] / 100.0f;
@@ -539,25 +541,25 @@ void World::LoadConfigSettings(bool reload)
rate_values[RATE_DURABILITY_LOSS_DAMAGE] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Damage", 0.5f);
if (rate_values[RATE_DURABILITY_LOSS_DAMAGE] < 0.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Damage (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_DAMAGE]);
rate_values[RATE_DURABILITY_LOSS_DAMAGE] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_ABSORB] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Absorb", 0.5f);
if (rate_values[RATE_DURABILITY_LOSS_ABSORB] < 0.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Absorb (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_ABSORB]);
rate_values[RATE_DURABILITY_LOSS_ABSORB] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_PARRY] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Parry", 0.05f);
if (rate_values[RATE_DURABILITY_LOSS_PARRY] < 0.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Parry (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_PARRY]);
rate_values[RATE_DURABILITY_LOSS_PARRY] = 0.0f;
}
rate_values[RATE_DURABILITY_LOSS_BLOCK] = ConfigMgr::GetFloatDefault("DurabilityLossChance.Block", 0.05f);
if (rate_values[RATE_DURABILITY_LOSS_BLOCK] < 0.0f)
{
- sLog->outError(LOG_FILTER_GENERAL, "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]);
rate_values[RATE_DURABILITY_LOSS_BLOCK] = 0.0f;
}
///- Read other configuration items from the config file
@@ -567,7 +569,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_COMPRESSION] = ConfigMgr::GetIntDefault("Compression", 1);
if (m_int_configs[CONFIG_COMPRESSION] < 1 || m_int_configs[CONFIG_COMPRESSION] > 9)
{
- sLog->outError(LOG_FILTER_GENERAL, "Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Compression level (%i) must be in range 1..9. Using default compression level (1).", m_int_configs[CONFIG_COMPRESSION]);
m_int_configs[CONFIG_COMPRESSION] = 1;
}
m_bool_configs[CONFIG_ADDON_CHANNEL] = ConfigMgr::GetBoolDefault("AddonChannel", true);
@@ -591,14 +593,14 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = ConfigMgr::GetIntDefault("PlayerSave.Stats.MinLevel", 0);
if (m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] > MAX_LEVEL)
{
- sLog->outError(LOG_FILTER_GENERAL, "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "PlayerSave.Stats.MinLevel (%i) must be in range 0..80. Using default, do not save character stats (0).", m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE]);
m_int_configs[CONFIG_MIN_LEVEL_STAT_SAVE] = 0;
}
m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = ConfigMgr::GetIntDefault("GridCleanUpDelay", 5 * MINUTE * IN_MILLISECONDS);
if (m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] < MIN_GRID_DELAY)
{
- sLog->outError(LOG_FILTER_GENERAL, "GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GridCleanUpDelay (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_GRIDCLEAN], MIN_GRID_DELAY);
m_int_configs[CONFIG_INTERVAL_GRIDCLEAN] = MIN_GRID_DELAY;
}
if (reload)
@@ -607,7 +609,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = ConfigMgr::GetIntDefault("MapUpdateInterval", 100);
if (m_int_configs[CONFIG_INTERVAL_MAPUPDATE] < MIN_MAP_UPDATE_DELAY)
{
- sLog->outError(LOG_FILTER_GENERAL, "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MapUpdateInterval (%i) must be greater %u. Use this minimal value.", m_int_configs[CONFIG_INTERVAL_MAPUPDATE], MIN_MAP_UPDATE_DELAY);
m_int_configs[CONFIG_INTERVAL_MAPUPDATE] = MIN_MAP_UPDATE_DELAY;
}
if (reload)
@@ -619,7 +621,7 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("WorldServerPort", 8085);
if (val != m_int_configs[CONFIG_PORT_WORLD])
- sLog->outError(LOG_FILTER_GENERAL, "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "WorldServerPort option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_PORT_WORLD]);
}
else
m_int_configs[CONFIG_PORT_WORLD] = ConfigMgr::GetIntDefault("WorldServerPort", 8085);
@@ -638,7 +640,7 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("GameType", 0);
if (val != m_int_configs[CONFIG_GAME_TYPE])
- sLog->outError(LOG_FILTER_GENERAL, "GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GameType option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_GAME_TYPE]);
}
else
m_int_configs[CONFIG_GAME_TYPE] = ConfigMgr::GetIntDefault("GameType", 0);
@@ -647,7 +649,7 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT);
if (val != m_int_configs[CONFIG_REALM_ZONE])
- sLog->outError(LOG_FILTER_GENERAL, "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "RealmZone option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_REALM_ZONE]);
}
else
m_int_configs[CONFIG_REALM_ZONE] = ConfigMgr::GetIntDefault("RealmZone", REALM_ZONE_DEVELOPMENT);
@@ -669,21 +671,21 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MIN_PLAYER_NAME] = ConfigMgr::GetIntDefault ("MinPlayerName", 2);
if (m_int_configs[CONFIG_MIN_PLAYER_NAME] < 1 || m_int_configs[CONFIG_MIN_PLAYER_NAME] > MAX_PLAYER_NAME)
{
- sLog->outError(LOG_FILTER_GENERAL, "MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPlayerName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PLAYER_NAME], MAX_PLAYER_NAME);
m_int_configs[CONFIG_MIN_PLAYER_NAME] = 2;
}
m_int_configs[CONFIG_MIN_CHARTER_NAME] = ConfigMgr::GetIntDefault ("MinCharterName", 2);
if (m_int_configs[CONFIG_MIN_CHARTER_NAME] < 1 || m_int_configs[CONFIG_MIN_CHARTER_NAME] > MAX_CHARTER_NAME)
{
- sLog->outError(LOG_FILTER_GENERAL, "MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinCharterName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_CHARTER_NAME], MAX_CHARTER_NAME);
m_int_configs[CONFIG_MIN_CHARTER_NAME] = 2;
}
m_int_configs[CONFIG_MIN_PET_NAME] = ConfigMgr::GetIntDefault ("MinPetName", 2);
if (m_int_configs[CONFIG_MIN_PET_NAME] < 1 || m_int_configs[CONFIG_MIN_PET_NAME] > MAX_PET_NAME)
{
- sLog->outError(LOG_FILTER_GENERAL, "MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPetName (%i) must be in range 1..%u. Set to 2.", m_int_configs[CONFIG_MIN_PET_NAME], MAX_PET_NAME);
m_int_configs[CONFIG_MIN_PET_NAME] = 2;
}
@@ -694,7 +696,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_CHARACTERS_PER_REALM] = ConfigMgr::GetIntDefault("CharactersPerRealm", 10);
if (m_int_configs[CONFIG_CHARACTERS_PER_REALM] < 1 || m_int_configs[CONFIG_CHARACTERS_PER_REALM] > 10)
{
- sLog->outError(LOG_FILTER_GENERAL, "CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "CharactersPerRealm (%i) must be in range 1..10. Set to 10.", m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
m_int_configs[CONFIG_CHARACTERS_PER_REALM] = 10;
}
@@ -702,14 +704,14 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = ConfigMgr::GetIntDefault("CharactersPerAccount", 50);
if (m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] < m_int_configs[CONFIG_CHARACTERS_PER_REALM])
{
- sLog->outError(LOG_FILTER_GENERAL, "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "CharactersPerAccount (%i) can't be less than CharactersPerRealm (%i).", m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT], m_int_configs[CONFIG_CHARACTERS_PER_REALM]);
m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = m_int_configs[CONFIG_CHARACTERS_PER_REALM];
}
m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = ConfigMgr::GetIntDefault("HeroicCharactersPerRealm", 1);
if (int32(m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]) < 0 || m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] > 10)
{
- sLog->outError(LOG_FILTER_GENERAL, "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.", m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]);
m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = 1;
}
@@ -718,7 +720,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_SKIP_CINEMATICS] = ConfigMgr::GetIntDefault("SkipCinematics", 0);
if (int32(m_int_configs[CONFIG_SKIP_CINEMATICS]) < 0 || m_int_configs[CONFIG_SKIP_CINEMATICS] > 2)
{
- sLog->outError(LOG_FILTER_GENERAL, "SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "SkipCinematics (%i) must be in range 0..2. Set to 0.", m_int_configs[CONFIG_SKIP_CINEMATICS]);
m_int_configs[CONFIG_SKIP_CINEMATICS] = 0;
}
@@ -726,14 +728,14 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL);
if (val != m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
- sLog->outError(LOG_FILTER_GENERAL, "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxPlayerLevel option can't be changed at config reload, using current value (%u).", m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
}
else
m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("MaxPlayerLevel", DEFAULT_MAX_LEVEL);
if (m_int_configs[CONFIG_MAX_PLAYER_LEVEL] > MAX_LEVEL)
{
- sLog->outError(LOG_FILTER_GENERAL, "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxPlayerLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_MAX_PLAYER_LEVEL], MAX_LEVEL, MAX_LEVEL);
m_int_configs[CONFIG_MAX_PLAYER_LEVEL] = MAX_LEVEL;
}
@@ -742,25 +744,25 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_START_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("StartPlayerLevel", 1);
if (m_int_configs[CONFIG_START_PLAYER_LEVEL] < 1)
{
- sLog->outError(LOG_FILTER_GENERAL, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 1.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_PLAYER_LEVEL] = 1;
}
else if (m_int_configs[CONFIG_START_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
{
- sLog->outError(LOG_FILTER_GENERAL, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.", m_int_configs[CONFIG_START_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL];
}
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("StartHeroicPlayerLevel", 55);
if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] < 1)
{
- sLog->outError(LOG_FILTER_GENERAL, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to 55.",
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = 55;
}
else if (m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
{
- sLog->outError(LOG_FILTER_GENERAL, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHeroicPlayerLevel (%i) must be in range 1..MaxPlayerLevel(%u). Set to %u.",
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_HEROIC_PLAYER_LEVEL] = m_int_configs[CONFIG_MAX_PLAYER_LEVEL];
}
@@ -768,12 +770,12 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_START_PLAYER_MONEY] = ConfigMgr::GetIntDefault("StartPlayerMoney", 0);
if (int32(m_int_configs[CONFIG_START_PLAYER_MONEY]) < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.", m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, 0);
m_int_configs[CONFIG_START_PLAYER_MONEY] = 0;
}
else if (m_int_configs[CONFIG_START_PLAYER_MONEY] > MAX_MONEY_AMOUNT)
{
- sLog->outError(LOG_FILTER_GENERAL, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartPlayerMoney (%i) must be in range 0..%u. Set to %u.",
m_int_configs[CONFIG_START_PLAYER_MONEY], MAX_MONEY_AMOUNT, MAX_MONEY_AMOUNT);
m_int_configs[CONFIG_START_PLAYER_MONEY] = MAX_MONEY_AMOUNT;
}
@@ -781,20 +783,20 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_HONOR_POINTS] = ConfigMgr::GetIntDefault("MaxHonorPoints", 75000);
if (int32(m_int_configs[CONFIG_MAX_HONOR_POINTS]) < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxHonorPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_HONOR_POINTS]);
m_int_configs[CONFIG_MAX_HONOR_POINTS] = 0;
}
m_int_configs[CONFIG_START_HONOR_POINTS] = ConfigMgr::GetIntDefault("StartHonorPoints", 0);
if (int32(m_int_configs[CONFIG_START_HONOR_POINTS]) < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], 0);
m_int_configs[CONFIG_START_HONOR_POINTS] = 0;
}
else if (m_int_configs[CONFIG_START_HONOR_POINTS] > m_int_configs[CONFIG_MAX_HONOR_POINTS])
{
- sLog->outError(LOG_FILTER_GENERAL, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartHonorPoints (%i) must be in range 0..MaxHonorPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS], m_int_configs[CONFIG_MAX_HONOR_POINTS]);
m_int_configs[CONFIG_START_HONOR_POINTS] = m_int_configs[CONFIG_MAX_HONOR_POINTS];
}
@@ -802,20 +804,20 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_ARENA_POINTS] = ConfigMgr::GetIntDefault("MaxArenaPoints", 10000);
if (int32(m_int_configs[CONFIG_MAX_ARENA_POINTS]) < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxArenaPoints (%i) can't be negative. Set to 0.", m_int_configs[CONFIG_MAX_ARENA_POINTS]);
m_int_configs[CONFIG_MAX_ARENA_POINTS] = 0;
}
m_int_configs[CONFIG_START_ARENA_POINTS] = ConfigMgr::GetIntDefault("StartArenaPoints", 0);
if (int32(m_int_configs[CONFIG_START_ARENA_POINTS]) < 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], 0);
m_int_configs[CONFIG_START_ARENA_POINTS] = 0;
}
else if (m_int_configs[CONFIG_START_ARENA_POINTS] > m_int_configs[CONFIG_MAX_ARENA_POINTS])
{
- sLog->outError(LOG_FILTER_GENERAL, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "StartArenaPoints (%i) must be in range 0..MaxArenaPoints(%u). Set to %u.",
m_int_configs[CONFIG_START_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS], m_int_configs[CONFIG_MAX_ARENA_POINTS]);
m_int_configs[CONFIG_START_ARENA_POINTS] = m_int_configs[CONFIG_MAX_ARENA_POINTS];
}
@@ -823,7 +825,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = ConfigMgr::GetIntDefault("RecruitAFriend.MaxLevel", 60);
if (m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] > m_int_configs[CONFIG_MAX_PLAYER_LEVEL])
{
- sLog->outError(LOG_FILTER_GENERAL, "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "RecruitAFriend.MaxLevel (%i) must be in the range 0..MaxLevel(%u). Set to %u.",
m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL], m_int_configs[CONFIG_MAX_PLAYER_LEVEL], 60);
m_int_configs[CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL] = 60;
}
@@ -843,7 +845,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MIN_PETITION_SIGNS] = ConfigMgr::GetIntDefault("MinPetitionSigns", 9);
if (m_int_configs[CONFIG_MIN_PETITION_SIGNS] > 9)
{
- sLog->outError(LOG_FILTER_GENERAL, "MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MinPetitionSigns (%i) must be in range 0..9. Set to 9.", m_int_configs[CONFIG_MIN_PETITION_SIGNS]);
m_int_configs[CONFIG_MIN_PETITION_SIGNS] = 9;
}
@@ -858,13 +860,13 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_START_GM_LEVEL] = ConfigMgr::GetIntDefault("GM.StartLevel", 1);
if (m_int_configs[CONFIG_START_GM_LEVEL] < m_int_configs[CONFIG_START_PLAYER_LEVEL])
{
- sLog->outError(LOG_FILTER_GENERAL, "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.",
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GM.StartLevel (%i) must be in range StartPlayerLevel(%u)..%u. Set to %u.",
m_int_configs[CONFIG_START_GM_LEVEL], m_int_configs[CONFIG_START_PLAYER_LEVEL], MAX_LEVEL, m_int_configs[CONFIG_START_PLAYER_LEVEL]);
m_int_configs[CONFIG_START_GM_LEVEL] = m_int_configs[CONFIG_START_PLAYER_LEVEL];
}
else if (m_int_configs[CONFIG_START_GM_LEVEL] > MAX_LEVEL)
{
- sLog->outError(LOG_FILTER_GENERAL, "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "GM.StartLevel (%i) must be in range 1..%u. Set to %u.", m_int_configs[CONFIG_START_GM_LEVEL], MAX_LEVEL, MAX_LEVEL);
m_int_configs[CONFIG_START_GM_LEVEL] = MAX_LEVEL;
}
m_bool_configs[CONFIG_ALLOW_GM_GROUP] = ConfigMgr::GetBoolDefault("GM.AllowInvite", false);
@@ -879,7 +881,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_UPTIME_UPDATE] = ConfigMgr::GetIntDefault("UpdateUptimeInterval", 10);
if (int32(m_int_configs[CONFIG_UPTIME_UPDATE]) <= 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "UpdateUptimeInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_UPTIME_UPDATE]);
m_int_configs[CONFIG_UPTIME_UPDATE] = 10;
}
if (reload)
@@ -892,7 +894,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = ConfigMgr::GetIntDefault("LogDB.Opt.ClearInterval", 10);
if (int32(m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]) <= 0)
{
- sLog->outError(LOG_FILTER_GENERAL, "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "LogDB.Opt.ClearInterval (%i) must be > 0, set to default 10.", m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
m_int_configs[CONFIG_LOGDB_CLEARINTERVAL] = 10;
}
if (reload)
@@ -901,7 +903,7 @@ void World::LoadConfigSettings(bool reload)
m_timers[WUPDATE_CLEANDB].Reset();
}
m_int_configs[CONFIG_LOGDB_CLEARTIME] = ConfigMgr::GetIntDefault("LogDB.Opt.ClearTime", 1209600); // 14 days default
- sLog->outInfo(LOG_FILTER_GENERAL, "Will clear `logs` table of entries older than %i seconds every %u minutes.",
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Will clear `logs` table of entries older than %i seconds every %u minutes.",
m_int_configs[CONFIG_LOGDB_CLEARTIME], m_int_configs[CONFIG_LOGDB_CLEARINTERVAL]);
m_int_configs[CONFIG_SKILL_CHANCE_ORANGE] = ConfigMgr::GetIntDefault("SkillChance.Orange", 100);
@@ -926,7 +928,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = ConfigMgr::GetIntDefault("MaxOverspeedPings", 2);
if (m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] != 0 && m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] < 2)
{
- sLog->outError(LOG_FILTER_GENERAL, "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.", m_int_configs[CONFIG_MAX_OVERSPEED_PINGS]);
m_int_configs[CONFIG_MAX_OVERSPEED_PINGS] = 2;
}
@@ -941,7 +943,7 @@ void World::LoadConfigSettings(bool reload)
{
uint32 val = ConfigMgr::GetIntDefault("Expansion", 1);
if (val != m_int_configs[CONFIG_EXPANSION])
- sLog->outError(LOG_FILTER_GENERAL, "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Expansion option can't be changed at worldserver.conf reload, using current value (%u).", m_int_configs[CONFIG_EXPANSION]);
}
else
m_int_configs[CONFIG_EXPANSION] = ConfigMgr::GetIntDefault("Expansion", 1);
@@ -973,7 +975,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = ConfigMgr::GetIntDefault("Battleground.Random.ResetHour", 6);
if (m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] > 23)
{
- sLog->outError(LOG_FILTER_GENERAL, "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Battleground.Random.ResetHour (%i) can't be load. Set to 6.", m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR]);
m_int_configs[CONFIG_RANDOM_BG_RESET_HOUR] = 6;
}
@@ -1040,10 +1042,10 @@ void World::LoadConfigSettings(bool reload)
if (clientCacheId > 0)
{
m_int_configs[CONFIG_CLIENTCACHE_VERSION] = clientCacheId;
- sLog->outInfo(LOG_FILTER_GENERAL, "Client cache version set to: %u", clientCacheId);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Client cache version set to: %u", clientCacheId);
}
else
- sLog->outError(LOG_FILTER_GENERAL, "ClientCacheVersion can't be negative %d, ignored.", clientCacheId);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "ClientCacheVersion can't be negative %d, ignored.", clientCacheId);
}
m_int_configs[CONFIG_INSTANT_LOGOUT] = ConfigMgr::GetIntDefault("InstantLogout", SEC_MODERATOR);
@@ -1059,12 +1061,12 @@ void World::LoadConfigSettings(bool reload)
m_MaxVisibleDistanceOnContinents = ConfigMgr::GetFloatDefault("Visibility.Distance.Continents", DEFAULT_VISIBILITY_DISTANCE);
if (m_MaxVisibleDistanceOnContinents < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
{
- sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Continents can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
m_MaxVisibleDistanceOnContinents = 45*sWorld->getRate(RATE_CREATURE_AGGRO);
}
else if (m_MaxVisibleDistanceOnContinents > MAX_VISIBILITY_DISTANCE)
{
- sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Continents can't be greater %f", MAX_VISIBILITY_DISTANCE);
m_MaxVisibleDistanceOnContinents = MAX_VISIBILITY_DISTANCE;
}
@@ -1072,12 +1074,12 @@ void World::LoadConfigSettings(bool reload)
m_MaxVisibleDistanceInInstances = ConfigMgr::GetFloatDefault("Visibility.Distance.Instances", DEFAULT_VISIBILITY_INSTANCE);
if (m_MaxVisibleDistanceInInstances < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
{
- sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Instances can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
m_MaxVisibleDistanceInInstances = 45*sWorld->getRate(RATE_CREATURE_AGGRO);
}
else if (m_MaxVisibleDistanceInInstances > MAX_VISIBILITY_DISTANCE)
{
- sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.Instances can't be greater %f", MAX_VISIBILITY_DISTANCE);
m_MaxVisibleDistanceInInstances = MAX_VISIBILITY_DISTANCE;
}
@@ -1085,12 +1087,12 @@ void World::LoadConfigSettings(bool reload)
m_MaxVisibleDistanceInBGArenas = ConfigMgr::GetFloatDefault("Visibility.Distance.BGArenas", DEFAULT_VISIBILITY_BGARENAS);
if (m_MaxVisibleDistanceInBGArenas < 45*sWorld->getRate(RATE_CREATURE_AGGRO))
{
- sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.BGArenas can't be less max aggro radius %f", 45*sWorld->getRate(RATE_CREATURE_AGGRO));
m_MaxVisibleDistanceInBGArenas = 45*sWorld->getRate(RATE_CREATURE_AGGRO);
}
else if (m_MaxVisibleDistanceInBGArenas > MAX_VISIBILITY_DISTANCE)
{
- sLog->outError(LOG_FILTER_GENERAL, "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Visibility.Distance.BGArenas can't be greater %f", MAX_VISIBILITY_DISTANCE);
m_MaxVisibleDistanceInBGArenas = MAX_VISIBILITY_DISTANCE;
}
@@ -1111,12 +1113,12 @@ void World::LoadConfigSettings(bool reload)
if (reload)
{
if (dataPath != m_dataPath)
- sLog->outError(LOG_FILTER_GENERAL, "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str());
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "DataDir option can't be changed at worldserver.conf reload, using current value (%s).", m_dataPath.c_str());
}
else
{
m_dataPath = dataPath;
- sLog->outInfo(LOG_FILTER_GENERAL, "Using DataDir %s", m_dataPath.c_str());
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Using DataDir %s", m_dataPath.c_str());
}
m_bool_configs[CONFIG_VMAP_INDOOR_CHECK] = ConfigMgr::GetBoolDefault("vmap.enableIndoorCheck", 0);
@@ -1127,19 +1129,19 @@ void World::LoadConfigSettings(bool reload)
std::string ignoreSpellIds = ConfigMgr::GetStringDefault("vmap.ignoreSpellIds", "");
if (!enableHeight)
- sLog->outError(LOG_FILTER_GENERAL, "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support.");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "VMap height checking disabled! Creatures movements and other various things WILL be broken! Expect no support.");
VMAP::VMapFactory::createOrGetVMapManager()->setEnableLineOfSightCalc(enableLOS);
VMAP::VMapFactory::createOrGetVMapManager()->setEnableHeightCalc(enableHeight);
VMAP::VMapFactory::preventSpellsFromBeingTestedForLoS(ignoreSpellIds.c_str());
- sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS);
- sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: VMap data directory is: %svmaps", m_dataPath.c_str());
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i PetLOS:%i", enableLOS, enableHeight, enableIndoor, enablePetLOS);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "VMap data directory is: %svmaps", m_dataPath.c_str());
m_int_configs[CONFIG_MAX_WHO] = ConfigMgr::GetIntDefault("MaxWhoListReturns", 49);
m_bool_configs[CONFIG_PET_LOS] = ConfigMgr::GetBoolDefault("vmap.petLOS", true);
m_bool_configs[CONFIG_START_ALL_SPELLS] = ConfigMgr::GetBoolDefault("PlayerStart.AllSpells", false);
if (m_bool_configs[CONFIG_START_ALL_SPELLS])
- sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: WARNING: PlayerStart.AllSpells enabled - may not function as intended!");
+ sLog->outWarn(LOG_FILTER_SERVER_LOADING, "PlayerStart.AllSpells enabled - may not function as intended!");
m_int_configs[CONFIG_HONOR_AFTER_DUEL] = ConfigMgr::GetIntDefault("HonorPointsAfterDuel", 0);
m_bool_configs[CONFIG_START_ALL_EXPLORED] = ConfigMgr::GetBoolDefault("PlayerStart.MapsExplored", false);
m_bool_configs[CONFIG_START_ALL_REP] = ConfigMgr::GetBoolDefault("PlayerStart.AllReputation", false);
@@ -1200,6 +1202,14 @@ void World::LoadConfigSettings(bool reload)
m_bool_configs[CONFIG_PDUMP_NO_OVERWRITE] = ConfigMgr::GetBoolDefault("PlayerDump.DisallowOverwrite", true);
// call ScriptMgr if we're reloading the configuration
+ m_bool_configs[CONFIG_WINTERGRASP_ENABLE] = ConfigMgr::GetBoolDefault("Wintergrasp.Enable", false);
+ m_int_configs[CONFIG_WINTERGRASP_PLR_MAX] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMax", 100);
+ m_int_configs[CONFIG_WINTERGRASP_PLR_MIN] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMin", 0);
+ m_int_configs[CONFIG_WINTERGRASP_PLR_MIN_LVL] = ConfigMgr::GetIntDefault("Wintergrasp.PlayerMinLvl", 77);
+ m_int_configs[CONFIG_WINTERGRASP_BATTLETIME] = ConfigMgr::GetIntDefault("Wintergrasp.BattleTimer", 30);
+ m_int_configs[CONFIG_WINTERGRASP_NOBATTLETIME] = ConfigMgr::GetIntDefault("Wintergrasp.NoBattleTimer", 150);
+ m_int_configs[CONFIG_WINTERGRASP_RESTART_AFTER_CRASH] = ConfigMgr::GetIntDefault("Wintergrasp.CrashRestartTimer", 10);
+
if (reload)
sScriptMgr->OnConfigLoad(reload);
}
@@ -1235,7 +1245,7 @@ void World::SetInitialWorldSettings()
!MapManager::ExistMapAndVMap(530, 10349.6f, -6357.29f) ||
!MapManager::ExistMapAndVMap(530, -3961.64f, -13931.2f))))
{
- sLog->outError(LOG_FILTER_GENERAL, "Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str());
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Correct *.map files not found in path '%smaps' or *.vmtree/*.vmtile files in '%svmaps'. Please place *.map/*.vmtree/*.vmtile files in appropriate directories or correct the DataDir value in the worldserver.conf file.", m_dataPath.c_str(), m_dataPath.c_str());
exit(1);
}
@@ -1247,7 +1257,7 @@ void World::SetInitialWorldSettings()
///- Loading strings. Getting no records means core load has to be canceled because no error message can be output.
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Trinity strings...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Trinity strings...");
if (!sObjectMgr->LoadTrinityStrings())
exit(1); // Error message displayed in function already
@@ -1271,36 +1281,36 @@ void World::SetInitialWorldSettings()
CharacterDatabase.Execute(stmt);
///- Load the DBC files
- sLog->outInfo(LOG_FILTER_GENERAL, "Initialize data stores...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initialize data stores...");
LoadDBCStores(m_dataPath);
DetectDBCLang();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell dbc data corrections...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell dbc data corrections...");
sSpellMgr->LoadDbcDataCorrections();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading SpellInfo store...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SpellInfo store...");
sSpellMgr->LoadSpellInfoStore();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading SkillLineAbilityMultiMap Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SkillLineAbilityMultiMap Data...");
sSpellMgr->LoadSkillLineAbilityMap();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell custom attributes...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell custom attributes...");
sSpellMgr->LoadSpellCustomAttr();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading GameObject models...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameObject models...");
LoadGameObjectModelList();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Script Names...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Script Names...");
sObjectMgr->LoadScriptNames();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Instance Template...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Instance Template...");
sObjectMgr->LoadInstanceTemplate();
// Must be called before `creature_respawn`/`gameobject_respawn` tables
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading instances...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading instances...");
sInstanceSaveMgr->LoadInstances();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Localization strings...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Localization strings...");
uint32 oldMSTime = getMSTime();
sObjectMgr->LoadCreatureLocales();
sObjectMgr->LoadGameObjectLocales();
@@ -1313,308 +1323,308 @@ void World::SetInitialWorldSettings()
sObjectMgr->LoadPointOfInterestLocales();
sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Localization strings loaded in %u ms", GetMSTimeDiffToNow(oldMSTime));
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Page Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Page Texts...");
sObjectMgr->LoadPageTexts();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Game Object Templates..."); // must be after LoadPageTexts
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Object Templates..."); // must be after LoadPageTexts
sObjectMgr->LoadGameObjectTemplate();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Rank Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Rank Data...");
sSpellMgr->LoadSpellRanks();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Required Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Required Data...");
sSpellMgr->LoadSpellRequired();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Group types...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Group types...");
sSpellMgr->LoadSpellGroups();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Learn Skills...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Learn Skills...");
sSpellMgr->LoadSpellLearnSkills(); // must be after LoadSpellRanks
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Learn Spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Learn Spells...");
sSpellMgr->LoadSpellLearnSpells();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Proc Event conditions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Proc Event conditions...");
sSpellMgr->LoadSpellProcEvents();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Proc conditions and data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Proc conditions and data...");
sSpellMgr->LoadSpellProcs();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Bonus Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Bonus Data...");
sSpellMgr->LoadSpellBonusess();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Aggro Spells Definitions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Aggro Spells Definitions...");
sSpellMgr->LoadSpellThreats();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell Group Stack Rules...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell Group Stack Rules...");
sSpellMgr->LoadSpellGroupStackRules();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading NPC Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading NPC Texts...");
sObjectMgr->LoadGossipText();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Enchant Spells Proc datas...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Enchant Spells Proc datas...");
sSpellMgr->LoadSpellEnchantProcData();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Item Random Enchantments Table...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item Random Enchantments Table...");
LoadRandomEnchantmentsTable();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Disables");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Disables");
DisableMgr::LoadDisables(); // must be before loading quests and items
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts
sObjectMgr->LoadItemTemplates();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Item set names..."); // must be after LoadItemPrototypes
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item set names..."); // must be after LoadItemPrototypes
sObjectMgr->LoadItemSetNames();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Model Based Info Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Model Based Info Data...");
sObjectMgr->LoadCreatureModelInfo();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Equipment templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Equipment templates...");
sObjectMgr->LoadEquipmentTemplates();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature templates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature templates...");
sObjectMgr->LoadCreatureTemplates();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature template addons...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature template addons...");
sObjectMgr->LoadCreatureTemplateAddons();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Reputation Reward Rates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Reputation Reward Rates...");
sObjectMgr->LoadReputationRewardRate();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Reputation OnKill Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Reputation OnKill Data...");
sObjectMgr->LoadReputationOnKill();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Reputation Spillover Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Reputation Spillover Data...");
sObjectMgr->LoadReputationSpilloverTemplate();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Points Of Interest Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Points Of Interest Data...");
sObjectMgr->LoadPointsOfInterest();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Base Stats...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Base Stats...");
sObjectMgr->LoadCreatureClassLevelStats();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Data...");
sObjectMgr->LoadCreatures();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading pet levelup spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet levelup spells...");
sSpellMgr->LoadPetLevelupSpellMap();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading pet default spells additional to levelup spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet default spells additional to levelup spells...");
sSpellMgr->LoadPetDefaultSpells();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Addon Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Addon Data...");
sObjectMgr->LoadCreatureAddons(); // must be after LoadCreatureTemplates() and LoadCreatures()
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Gameobject Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gameobject Data...");
sObjectMgr->LoadGameobjects();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Linked Respawn...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Linked Respawn...");
sObjectMgr->LoadLinkedRespawn(); // must be after LoadCreatures(), LoadGameObjects()
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Weather Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Weather Data...");
WeatherMgr::LoadWeatherData();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quests...");
sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables
- sLog->outInfo(LOG_FILTER_GENERAL, "Checking Quest Disables");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Checking Quest Disables");
DisableMgr::CheckQuestDisables(); // must be after loading quests
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quest POI");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest POI");
sObjectMgr->LoadQuestPOI();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quests Relations...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quests Relations...");
sObjectMgr->LoadQuestRelations(); // must be after quest load
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Objects Pooling Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Objects Pooling Data...");
sPoolMgr->LoadFromDB();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Game Event Data..."); // must be after loading pools fully
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Game Event Data..."); // must be after loading pools fully
sGameEventMgr->LoadFromDB();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading UNIT_NPC_FLAG_SPELLCLICK Data..."); // must be after LoadQuests
sObjectMgr->LoadNPCSpellClickSpells();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Vehicle Template Accessories...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vehicle Template Accessories...");
sObjectMgr->LoadVehicleTemplateAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Vehicle Accessories...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vehicle Accessories...");
sObjectMgr->LoadVehicleAccessories(); // must be after LoadCreatureTemplates() and LoadNPCSpellClickSpells()
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Dungeon boss data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Dungeon boss data...");
sObjectMgr->LoadInstanceEncounters();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading LFG rewards...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading LFG rewards...");
sLFGMgr->LoadRewards();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading SpellArea Data..."); // must be after quest load
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SpellArea Data..."); // must be after quest load
sSpellMgr->LoadSpellAreas();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading AreaTrigger definitions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading AreaTrigger definitions...");
sObjectMgr->LoadAreaTriggerTeleports();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Access Requirements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Access Requirements...");
sObjectMgr->LoadAccessRequirements(); // must be after item template load
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Quest Area Triggers...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Quest Area Triggers...");
sObjectMgr->LoadQuestAreaTriggers(); // must be after LoadQuests
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Tavern Area Triggers...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Tavern Area Triggers...");
sObjectMgr->LoadTavernAreaTriggers();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading AreaTrigger script names...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading AreaTrigger script names...");
sObjectMgr->LoadAreaTriggerScripts();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Graveyard-zone links...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Graveyard-zone links...");
sObjectMgr->LoadGraveyardZones();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell pet auras...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell pet auras...");
sSpellMgr->LoadSpellPetAuras();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Spell target coordinates...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Spell target coordinates...");
sSpellMgr->LoadSpellTargetPositions();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading enchant custom attributes...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading enchant custom attributes...");
sSpellMgr->LoadEnchantCustomAttr();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading linked spells...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading linked spells...");
sSpellMgr->LoadSpellLinked();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Create Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Create Data...");
sObjectMgr->LoadPlayerInfo();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Exploration BaseXP Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Exploration BaseXP Data...");
sObjectMgr->LoadExplorationBaseXP();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Pet Name Parts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Pet Name Parts...");
sObjectMgr->LoadPetNames();
CharacterDatabaseCleaner::CleanDatabase();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading the max pet number...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading the max pet number...");
sObjectMgr->LoadPetNumber();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading pet level stats...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading pet level stats...");
sObjectMgr->LoadPetLevelInfo();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player Corpses...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player Corpses...");
sObjectMgr->LoadCorpses();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Player level dependent mail rewards...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Player level dependent mail rewards...");
sObjectMgr->LoadMailLevelRewards();
// Loot tables
LoadLootTables();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Skill Discovery Table...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Discovery Table...");
LoadSkillDiscoveryTable();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Skill Extra Item Table...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Extra Item Table...");
LoadSkillExtraItemTable();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Skill Fishing base level requirements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Skill Fishing base level requirements...");
sObjectMgr->LoadFishingBaseSkillLevel();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievements...");
sAchievementMgr->LoadAchievementReferenceList();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Criteria Lists...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Criteria Lists...");
sAchievementMgr->LoadAchievementCriteriaList();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Criteria Data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Criteria Data...");
sAchievementMgr->LoadAchievementCriteriaData();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Rewards...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Rewards...");
sAchievementMgr->LoadRewards();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Achievement Reward Locales...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Achievement Reward Locales...");
sAchievementMgr->LoadRewardLocales();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Completed Achievements...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Completed Achievements...");
sAchievementMgr->LoadCompletedAchievements();
// Delete expired auctions before loading
- sLog->outInfo(LOG_FILTER_GENERAL, "Deleting expired auctions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Deleting expired auctions...");
sAuctionMgr->DeleteExpiredAuctionsAtStartup();
///- Load dynamic data tables from the database
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Item Auctions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Item Auctions...");
sAuctionMgr->LoadAuctionItems();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Auctions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Auctions...");
sAuctionMgr->LoadAuctions();
sGuildMgr->LoadGuilds();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading ArenaTeams...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading ArenaTeams...");
sArenaTeamMgr->LoadArenaTeams();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Groups...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Groups...");
sGroupMgr->LoadGroups();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading ReservedNames...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading ReservedNames...");
sObjectMgr->LoadReservedPlayersNames();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading GameObjects for quests...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameObjects for quests...");
sObjectMgr->LoadGameObjectForQuests();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading BattleMasters...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading BattleMasters...");
sBattlegroundMgr->LoadBattleMastersEntry();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading GameTeleports...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GameTeleports...");
sObjectMgr->LoadGameTele();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Gossip menu...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gossip menu...");
sObjectMgr->LoadGossipMenu();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Gossip menu options...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Gossip menu options...");
sObjectMgr->LoadGossipMenuItems();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Vendors...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Vendors...");
sObjectMgr->LoadVendors(); // must be after load CreatureTemplate and ItemTemplate
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Trainers...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Trainers...");
sObjectMgr->LoadTrainerSpell(); // must be after load CreatureTemplate
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Waypoints...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Waypoints...");
sWaypointMgr->Load();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading SmartAI Waypoints...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SmartAI Waypoints...");
sSmartWaypointMgr->LoadFromDB();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Formations...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Formations...");
sFormationMgr->LoadCreatureFormations();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions
LoadWorldStates();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Conditions...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Conditions...");
sConditionMgr->LoadConditions();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change achievement pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change achievement pairs...");
sObjectMgr->LoadFactionChangeAchievements();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change spell pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change spell pairs...");
sObjectMgr->LoadFactionChangeSpells();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change item pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change item pairs...");
sObjectMgr->LoadFactionChangeItems();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading faction change reputation pairs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading faction change reputation pairs...");
sObjectMgr->LoadFactionChangeReputations();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading GM tickets...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GM tickets...");
sTicketMgr->LoadTickets();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading GM surveys...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading GM surveys...");
sTicketMgr->LoadSurveys();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading client addons...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading client addons...");
AddonMgr::LoadFromDB();
///- Handle outdated emails (delete/return)
- sLog->outInfo(LOG_FILTER_GENERAL, "Returning old mails...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Returning old mails...");
sObjectMgr->ReturnOrDeleteOldMails(false);
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Autobroadcasts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Autobroadcasts...");
LoadAutobroadcasts();
///- Load and initialize scripts
@@ -1625,42 +1635,42 @@ void World::SetInitialWorldSettings()
sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
sObjectMgr->LoadWaypointScripts();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Scripts text locales..."); // must be after Load*Scripts calls
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Scripts text locales..."); // must be after Load*Scripts calls
sObjectMgr->LoadDbScriptStrings();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading CreatureEventAI Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Texts...");
sEventAIMgr->LoadCreatureEventAI_Texts();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading CreatureEventAI Summons...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Summons...");
sEventAIMgr->LoadCreatureEventAI_Summons();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading CreatureEventAI Scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading CreatureEventAI Scripts...");
sEventAIMgr->LoadCreatureEventAI_Scripts();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading spell script names...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading spell script names...");
sObjectMgr->LoadSpellScriptNames();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Texts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Texts...");
sCreatureTextMgr->LoadCreatureTexts();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Creature Text Locales...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Creature Text Locales...");
sCreatureTextMgr->LoadCreatureTextLocales();
- sLog->outInfo(LOG_FILTER_GENERAL, "Initializing Scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initializing Scripts...");
sScriptMgr->Initialize();
sScriptMgr->OnConfigLoad(false); // must be done after the ScriptMgr has been properly initialized
- sLog->outInfo(LOG_FILTER_GENERAL, "Validating spell scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Validating spell scripts...");
sObjectMgr->ValidateSpellScripts();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading SmartAI scripts...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading SmartAI scripts...");
sSmartScriptMgr->LoadSmartAIFromDB();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Calendar data...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Calendar data...");
sCalendarMgr->LoadFromDB();
///- Initialize game time and timers
- sLog->outInfo(LOG_FILTER_GENERAL, "Initialize game time and timers");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Initialize game time and timers");
m_gameTime = time(NULL);
m_startTime = m_gameTime;
@@ -1687,16 +1697,16 @@ void World::SetInitialWorldSettings()
mail_timer = ((((localtime(&m_gameTime)->tm_hour + 20) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval());
//1440
mail_timer_expires = ((DAY * IN_MILLISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval()));
- sLog->outInfo(LOG_FILTER_GENERAL, "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires));
///- Initilize static helper structures
AIRegistry::Initialize();
///- Initialize MapManager
- sLog->outInfo(LOG_FILTER_GENERAL, "Starting Map System");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Map System");
sMapMgr->Initialize();
- sLog->outInfo(LOG_FILTER_GENERAL, "Starting Game Event system...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Game Event system...");
uint32 nextGameEvent = sGameEventMgr->StartSystem();
m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event
@@ -1706,50 +1716,54 @@ void World::SetInitialWorldSettings()
// Delete all custom channels which haven't been used for PreserveCustomChannelDuration days.
Channel::CleanOldChannelsInDB();
- sLog->outInfo(LOG_FILTER_GENERAL, "Starting Arena Season...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Arena Season...");
sGameEventMgr->StartArenaSeason();
sTicketMgr->Initialize();
///- Initialize Battlegrounds
- sLog->outInfo(LOG_FILTER_GENERAL, "Starting Battleground System");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Battleground System");
sBattlegroundMgr->CreateInitialBattlegrounds();
sBattlegroundMgr->InitAutomaticArenaPointDistribution();
///- Initialize outdoor pvp
- sLog->outInfo(LOG_FILTER_GENERAL, "Starting Outdoor PvP System");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Starting Outdoor PvP System");
sOutdoorPvPMgr->InitOutdoorPvP();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Transports...");
+ ///- Initialize Battlefield
+ sLog->outInfo(LOG_FILTER_GENERAL, "Starting Battlefield System");
+ sBattlefieldMgr->InitBattlefield();
+
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transports...");
sMapMgr->LoadTransports();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Transport NPCs...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Transport NPCs...");
sMapMgr->LoadTransportNPCs();
///- Initialize Warden
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Warden Checks...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Warden Checks...");
sWardenCheckMgr->LoadWardenChecks();
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading Warden Action Overrides...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading Warden Action Overrides...");
sWardenCheckMgr->LoadWardenOverrides();
- sLog->outInfo(LOG_FILTER_GENERAL, "Deleting expired bans...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Deleting expired bans...");
LoginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate <= UNIX_TIMESTAMP() AND unbandate<>bandate"); // One-time query
- sLog->outInfo(LOG_FILTER_GENERAL, "Calculate next daily quest reset time...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next daily quest reset time...");
InitDailyQuestResetTime();
- sLog->outInfo(LOG_FILTER_GENERAL, "Calculate next weekly quest reset time...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate next weekly quest reset time...");
InitWeeklyQuestResetTime();
- sLog->outInfo(LOG_FILTER_GENERAL, "Calculate random battleground reset time...");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate random battleground reset time...");
InitRandomBGResetTime();
LoadCharacterNameData();
uint32 startupDuration = GetMSTimeDiffToNow(startupBegin);
- sLog->outInfo(LOG_FILTER_GENERAL, "WORLD: World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000));
+ sLog->outInfo(LOG_FILTER_WORLDSERVER, "World initialized in %u minutes %u seconds", (startupDuration / 60000), ((startupDuration % 60000) / 1000));
sLog->EnableDBAppenders();
}
@@ -1759,7 +1773,7 @@ void World::DetectDBCLang()
if (m_lang_confid != 255 && m_lang_confid >= TOTAL_LOCALES)
{
- sLog->outError(LOG_FILTER_GENERAL, "Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES);
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES);
m_lang_confid = LOCALE_enUS;
}
@@ -1787,13 +1801,13 @@ void World::DetectDBCLang()
if (default_locale >= TOTAL_LOCALES)
{
- sLog->outError(LOG_FILTER_GENERAL, "Unable to determine your DBC Locale! (corrupt DBC?)");
+ sLog->outError(LOG_FILTER_SERVER_LOADING, "Unable to determine your DBC Locale! (corrupt DBC?)");
exit(1);
}
m_defaultDbcLocale = LocaleConstant(default_locale);
- sLog->outInfo(LOG_FILTER_GENERAL, "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str());
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Using %s DBC Locale as default. All available DBC locales: %s", localeNames[m_defaultDbcLocale], availableLocalsStr.empty() ? "<none>" : availableLocalsStr.c_str());
}
@@ -1833,7 +1847,7 @@ void World::LoadAutobroadcasts()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!");
return;
}
@@ -1851,7 +1865,7 @@ void World::LoadAutobroadcasts()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u autobroadcasts definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -1984,6 +1998,9 @@ void World::Update(uint32 diff)
sOutdoorPvPMgr->Update(diff);
RecordTimeDiff("UpdateOutdoorPvPMgr");
+ sBattlefieldMgr->Update(diff);
+ RecordTimeDiff("BattlefieldMgr");
+
///- Delete all characters which have been deleted X days before
if (m_timers[WUPDATE_DELETECHARS].Passed())
{
@@ -2018,7 +2035,7 @@ void World::Update(uint32 diff)
if (m_timers[WUPDATE_PINGDB].Passed())
{
m_timers[WUPDATE_PINGDB].Reset();
- sLog->outInfo(LOG_FILTER_GENERAL, "Ping MySQL to keep connection alive");
+ sLog->outDebug(LOG_FILTER_GENERAL, "Ping MySQL to keep connection alive");
CharacterDatabase.KeepAlive();
LoginDatabase.KeepAlive();
WorldDatabase.KeepAlive();
@@ -2607,7 +2624,7 @@ void World::SendAutoBroadcast()
sWorld->SendGlobalMessage(&data);
}
- sLog->outInfo(LOG_FILTER_GENERAL, "AutoBroadcast: '%s'", msg.c_str());
+ sLog->outDebug(LOG_FILTER_GENERAL, "AutoBroadcast: '%s'", msg.c_str());
}
void World::UpdateRealmCharCount(uint32 accountId)
@@ -2834,7 +2851,7 @@ void World::LoadWorldStates()
if (!result)
{
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded 0 world states. DB table `worldstates` is empty!");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 world states. DB table `worldstates` is empty!");
return;
}
@@ -2849,7 +2866,7 @@ void World::LoadWorldStates()
}
while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u world states in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
@@ -2906,12 +2923,12 @@ void World::ProcessQueryCallbacks()
void World::LoadCharacterNameData()
{
- sLog->outInfo(LOG_FILTER_GENERAL, "Loading character name data");
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading character name data");
QueryResult result = CharacterDatabase.Query("SELECT guid, name, race, gender, class FROM characters WHERE deleteDate IS NULL");
if (!result)
{
- sLog->outError(LOG_FILTER_GENERAL, "No character name data loaded, empty query");
+ sLog->outError(LOG_FILTER_SQL, "No character name data loaded, empty query");
return;
}
@@ -2925,7 +2942,7 @@ void World::LoadCharacterNameData()
++count;
} while (result->NextRow());
- sLog->outInfo(LOG_FILTER_GENERAL, "Loaded name data for %u characters", count);
+ sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loaded name data for %u characters", count);
}
void World::AddCharacterNameData(uint32 guid, std::string const& name, uint8 gender, uint8 race, uint8 playerClass)
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index f0dbc3c84ad..a6cdd4742f6 100755
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -164,6 +164,7 @@ enum WorldBoolConfigs
CONFIG_QUEST_IGNORE_AUTO_ACCEPT,
CONFIG_QUEST_IGNORE_AUTO_COMPLETE,
CONFIG_WARDEN_ENABLED,
+ CONFIG_WINTERGRASP_ENABLE,
BOOL_CONFIG_VALUE_COUNT
};
@@ -318,6 +319,12 @@ enum WorldIntConfigs
CONFIG_WARDEN_CLIENT_BAN_DURATION,
CONFIG_WARDEN_NUM_MEM_CHECKS,
CONFIG_WARDEN_NUM_OTHER_CHECKS,
+ CONFIG_WINTERGRASP_PLR_MAX,
+ CONFIG_WINTERGRASP_PLR_MIN,
+ CONFIG_WINTERGRASP_PLR_MIN_LVL,
+ CONFIG_WINTERGRASP_BATTLETIME,
+ CONFIG_WINTERGRASP_NOBATTLETIME,
+ CONFIG_WINTERGRASP_RESTART_AFTER_CRASH,
INT_CONFIG_VALUE_COUNT
};