aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/bnetserver/Packets/ConnectionPackets.h2
-rw-r--r--src/server/collision/Management/MMapManager.cpp63
-rw-r--r--src/server/collision/Management/MMapManager.h5
-rw-r--r--src/server/collision/Management/VMapFactory.cpp2
-rw-r--r--src/server/collision/Management/VMapManager2.cpp51
-rw-r--r--src/server/collision/Management/VMapManager2.h5
-rw-r--r--src/server/collision/Models/GameObjectModel.cpp51
-rw-r--r--src/server/collision/Models/GameObjectModel.h41
-rw-r--r--src/server/game/AI/CoreAI/GuardAI.cpp3
-rw-r--r--src/server/game/AI/CoreAI/PassiveAI.cpp1
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp2
-rw-r--r--src/server/game/AI/CoreAI/ReactorAI.cpp4
-rw-r--r--src/server/game/AI/CoreAI/TotemAI.cpp2
-rw-r--r--src/server/game/AI/CoreAI/UnitAI.h1
-rw-r--r--src/server/game/AI/CreatureAI.cpp24
-rw-r--r--src/server/game/AI/CreatureAI.h5
-rw-r--r--src/server/game/AI/CreatureAISelector.cpp1
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp2
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp8
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.h8
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp8
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp12
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h2
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp20
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp12
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.h2
-rw-r--r--src/server/game/Accounts/RBAC.h2
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp2
-rw-r--r--src/server/game/Battlefield/Battlefield.h24
-rw-r--r--src/server/game/Battlefield/BattlefieldMgr.cpp1
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.h2
-rw-r--r--src/server/game/Battlegrounds/ArenaTeamMgr.cpp2
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp3
-rw-r--r--src/server/game/Battlegrounds/Battleground.h3
-rw-r--r--src/server/game/Battlegrounds/BattlegroundMgr.cpp5
-rw-r--r--src/server/game/Battlegrounds/BattlegroundQueue.cpp1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp2
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp8
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundBFG.cpp10
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp2
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp119
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundIC.h8
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundTP.cpp10
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp3
-rw-r--r--src/server/game/Calendar/CalendarMgr.cpp18
-rw-r--r--src/server/game/Chat/Channels/ChannelMgr.cpp1
-rw-r--r--src/server/game/Chat/Chat.cpp5
-rw-r--r--src/server/game/Chat/Chat.h12
-rw-r--r--src/server/game/Chat/ChatLink.cpp54
-rw-r--r--src/server/game/Chat/ChatLink.h3
-rw-r--r--src/server/game/Combat/HostileRefManager.cpp1
-rw-r--r--src/server/game/Combat/ThreatManager.cpp1
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp1
-rw-r--r--src/server/game/DataStores/DB2Stores.cpp7
-rw-r--r--src/server/game/DataStores/DB2Stores.h2
-rw-r--r--src/server/game/DataStores/DBCStores.cpp8
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp1
-rw-r--r--src/server/game/DungeonFinding/LFGQueue.cpp3
-rw-r--r--src/server/game/Entities/Corpse/Corpse.cpp3
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp6
-rw-r--r--src/server/game/Entities/Creature/Creature.h10
-rw-r--r--src/server/game/Entities/Creature/GossipDef.cpp3
-rw-r--r--src/server/game/Entities/Creature/TemporarySummon.h2
-rw-r--r--src/server/game/Entities/DynamicObject/DynamicObject.cpp1
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp34
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h6
-rw-r--r--src/server/game/Entities/Item/Item.cpp10
-rw-r--r--src/server/game/Entities/Item/ItemEnchantmentMgr.cpp8
-rw-r--r--src/server/game/Entities/Object/Object.cpp34
-rw-r--r--src/server/game/Entities/Object/Object.h10
-rw-r--r--src/server/game/Entities/Object/ObjectGuid.cpp45
-rw-r--r--src/server/game/Entities/Object/ObjectGuid.h17
-rw-r--r--src/server/game/Entities/Object/Position.cpp3
-rw-r--r--src/server/game/Entities/Object/Updates/UpdateData.cpp4
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp16
-rw-r--r--src/server/game/Entities/Pet/Pet.h4
-rw-r--r--src/server/game/Entities/Player/Player.cpp83
-rw-r--r--src/server/game/Entities/Player/Player.h24
-rw-r--r--src/server/game/Entities/Totem/Totem.cpp1
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp5
-rw-r--r--src/server/game/Entities/Unit/StatSystem.cpp1
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp45
-rw-r--r--src/server/game/Entities/Unit/Unit.h22
-rw-r--r--src/server/game/Entities/Vehicle/Vehicle.cpp4
-rw-r--r--src/server/game/Events/GameEventMgr.cpp1
-rw-r--r--src/server/game/Garrison/Garrison.cpp4
-rw-r--r--src/server/game/Garrison/GarrisonMgr.cpp14
-rw-r--r--src/server/game/Globals/ObjectAccessor.cpp13
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp93
-rw-r--r--src/server/game/Globals/ObjectMgr.h4
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiers.cpp8
-rw-r--r--src/server/game/Grids/ObjectGridLoader.cpp1
-rw-r--r--src/server/game/Groups/Group.cpp23
-rw-r--r--src/server/game/Guilds/Guild.cpp2
-rw-r--r--src/server/game/Guilds/Guild.h4
-rw-r--r--src/server/game/Guilds/GuildMgr.cpp2
-rw-r--r--src/server/game/Handlers/ArenaTeamHandler.cpp8
-rw-r--r--src/server/game/Handlers/AuctionHouseHandler.cpp1
-rw-r--r--src/server/game/Handlers/BankHandler.cpp1
-rw-r--r--src/server/game/Handlers/CalendarHandler.cpp15
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp39
-rw-r--r--src/server/game/Handlers/ChatHandler.cpp2
-rw-r--r--src/server/game/Handlers/CombatHandler.cpp3
-rw-r--r--src/server/game/Handlers/DuelHandler.cpp2
-rw-r--r--src/server/game/Handlers/GroupHandler.cpp5
-rw-r--r--src/server/game/Handlers/GuildHandler.cpp2
-rw-r--r--src/server/game/Handlers/ItemHandler.cpp7
-rw-r--r--src/server/game/Handlers/LootHandler.cpp2
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp12
-rw-r--r--src/server/game/Handlers/MovementHandler.cpp10
-rw-r--r--src/server/game/Handlers/PetHandler.cpp3
-rw-r--r--src/server/game/Handlers/PetitionsHandler.cpp3
-rw-r--r--src/server/game/Handlers/QueryHandler.cpp40
-rw-r--r--src/server/game/Handlers/QuestHandler.cpp4
-rw-r--r--src/server/game/Handlers/ReferAFriendHandler.cpp1
-rw-r--r--src/server/game/Handlers/SkillHandler.cpp3
-rw-r--r--src/server/game/Handlers/SpellHandler.cpp54
-rw-r--r--src/server/game/Handlers/TaxiHandler.cpp1
-rw-r--r--src/server/game/Handlers/TicketHandler.cpp3
-rw-r--r--src/server/game/Handlers/TokenHandler.cpp1
-rw-r--r--src/server/game/Handlers/TradeHandler.cpp1
-rw-r--r--src/server/game/Handlers/VehicleHandler.cpp1
-rw-r--r--src/server/game/Handlers/VoiceChatHandler.cpp2
-rw-r--r--src/server/game/Instances/InstanceSaveMgr.cpp11
-rw-r--r--src/server/game/Instances/InstanceSaveMgr.h6
-rw-r--r--src/server/game/Mails/Mail.cpp2
-rw-r--r--src/server/game/Maps/Map.cpp21
-rw-r--r--src/server/game/Maps/Map.h2
-rw-r--r--src/server/game/Maps/MapManager.cpp2
-rw-r--r--src/server/game/Maps/MapUpdater.cpp5
-rw-r--r--src/server/game/Maps/TransportMgr.cpp1
-rw-r--r--src/server/game/Miscellaneous/SharedDefines.h5
-rw-r--r--src/server/game/Movement/MotionMaster.cpp1
-rwxr-xr-xsrc/server/game/Movement/MovementGenerator.h2
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp2
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h2
-rw-r--r--src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp1
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h4
-rw-r--r--src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp1
-rw-r--r--src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h2
-rw-r--r--src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp11
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/IdleMovementGenerator.h8
-rw-r--r--src/server/game/Movement/MovementGenerators/PointMovementGenerator.h6
-rw-r--r--src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp2
-rw-r--r--src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h2
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h4
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp1
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h4
-rw-r--r--src/server/game/Movement/PathGenerator.cpp8
-rw-r--r--src/server/game/Movement/Spline/MoveSpline.cpp3
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.cpp3
-rw-r--r--src/server/game/Movement/Spline/Spline.cpp10
-rw-r--r--src/server/game/Movement/Spline/Spline.h8
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvP.cpp2
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvP.h2
-rw-r--r--src/server/game/Quests/QuestDef.cpp1
-rw-r--r--src/server/game/Scripting/MapScripts.cpp4
-rw-r--r--src/server/game/Server/Packet.cpp2
-rw-r--r--src/server/game/Server/Packets/ChannelPackets.h4
-rw-r--r--src/server/game/Server/Packets/MovementPackets.cpp15
-rw-r--r--src/server/game/Server/Packets/MovementPackets.h22
-rw-r--r--src/server/game/Server/Packets/PartyPackets.cpp12
-rw-r--r--src/server/game/Server/Packets/QuestPackets.cpp8
-rw-r--r--src/server/game/Server/Packets/QuestPackets.h11
-rw-r--r--src/server/game/Server/Packets/SpellPackets.cpp54
-rw-r--r--src/server/game/Server/Packets/SpellPackets.h56
-rw-r--r--src/server/game/Server/Packets/TicketPackets.h2
-rw-r--r--src/server/game/Server/Protocol/Opcodes.cpp102
-rw-r--r--src/server/game/Server/Protocol/Opcodes.h10
-rw-r--r--src/server/game/Server/WorldSession.cpp7
-rw-r--r--src/server/game/Server/WorldSession.h18
-rw-r--r--src/server/game/Server/WorldSocket.cpp5
-rw-r--r--src/server/game/Server/WorldSocketMgr.cpp1
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp4
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp1
-rw-r--r--src/server/game/Spells/Spell.cpp141
-rw-r--r--src/server/game/Spells/Spell.h26
-rw-r--r--src/server/game/Spells/SpellEffects.cpp22
-rw-r--r--src/server/game/Spells/SpellHistory.cpp18
-rw-r--r--src/server/game/Spells/SpellInfo.cpp39
-rw-r--r--src/server/game/Spells/SpellMgr.cpp9
-rw-r--r--src/server/game/Spells/SpellScript.cpp24
-rw-r--r--src/server/game/Support/SupportMgr.h12
-rw-r--r--src/server/game/Warden/Warden.cpp5
-rw-r--r--src/server/game/Warden/WardenCheckMgr.cpp1
-rw-r--r--src/server/game/Warden/WardenMac.cpp3
-rw-r--r--src/server/game/Warden/WardenWin.cpp4
-rw-r--r--src/server/game/Weather/Weather.cpp2
-rw-r--r--src/server/game/Weather/WeatherMgr.cpp2
-rw-r--r--src/server/game/World/World.cpp15
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp18
-rw-r--r--src/server/scripts/Commands/cs_list.cpp2
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp6
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp18
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp4
-rw-r--r--src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp1
-rw-r--r--src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp4
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp12
-rw-r--r--src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp1
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp15
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp6
-rw-r--r--src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp4
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_erekem.cpp4
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp6
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp2
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_moragg.cpp4
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp15
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp2
-rw-r--r--src/server/scripts/Northrend/VioletHold/violet_hold.h2
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp12
-rw-r--r--src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp10
-rw-r--r--src/server/scripts/Outland/zone_hellfire_peninsula.cpp13
-rw-r--r--src/server/shared/Cryptography/WardenKeyGeneration.h6
-rw-r--r--src/server/shared/Database/AdhocStatement.h2
-rw-r--r--src/server/shared/Database/DatabaseWorkerPool.h46
-rw-r--r--src/server/shared/Database/QueryHolder.h7
-rw-r--r--src/server/shared/Database/Transaction.h7
-rw-r--r--src/server/shared/Debugging/WheatyExceptionReport.cpp22
-rw-r--r--src/server/shared/Debugging/WheatyExceptionReport.h1
-rw-r--r--src/server/shared/Logging/AppenderFile.cpp41
-rw-r--r--src/server/shared/Logging/AppenderFile.h17
-rw-r--r--src/server/shared/Logging/Log.cpp7
-rw-r--r--src/server/shared/Logging/Log.h18
-rw-r--r--src/server/shared/Packets/ByteBuffer.h2
-rw-r--r--src/server/shared/PrecompiledHeaders/sharedPCH.h1
-rw-r--r--src/server/shared/Threading/ProducerConsumerQueue.h3
-rw-r--r--src/server/shared/Utilities/Duration.h39
-rw-r--r--src/server/shared/Utilities/EventMap.cpp136
-rw-r--r--src/server/shared/Utilities/EventMap.h342
-rw-r--r--src/server/shared/Utilities/StringFormat.h22
-rw-r--r--src/server/shared/Utilities/TaskScheduler.h13
-rw-r--r--src/server/shared/Utilities/Timer.h4
-rw-r--r--src/server/shared/Utilities/Util.cpp9
-rw-r--r--src/server/shared/Utilities/Util.h342
237 files changed, 1929 insertions, 1586 deletions
diff --git a/src/server/bnetserver/Packets/ConnectionPackets.h b/src/server/bnetserver/Packets/ConnectionPackets.h
index c02221fa39b..9d49b7c26fb 100644
--- a/src/server/bnetserver/Packets/ConnectionPackets.h
+++ b/src/server/bnetserver/Packets/ConnectionPackets.h
@@ -64,7 +64,7 @@ namespace Battlenet
std::string ToString() const override;
void CallHandler(Session* session) override;
uint8* GetRemainingData() { return _stream.GetBuffer() + (((_stream.GetReadPos() + 7) & ~7) / 8); }
- size_t GetRemainingSize() { return _stream.GetSize() - (((_stream.GetReadPos() + 7) & ~7) / 8); }
+ size_t GetRemainingSize() const { return _stream.GetSize() - (((_stream.GetReadPos() + 7) & ~7) / 8); }
};
class LogoutRequest final : public ClientPacket
diff --git a/src/server/collision/Management/MMapManager.cpp b/src/server/collision/Management/MMapManager.cpp
index e0b1ed3b161..0b9c1b325b7 100644
--- a/src/server/collision/Management/MMapManager.cpp
+++ b/src/server/collision/Management/MMapManager.cpp
@@ -37,11 +37,41 @@ namespace MMAP
// if we had, tiles in MMapData->mmapLoadedTiles, their actual data is lost!
}
+ void MMapManager::InitializeThreadUnsafe(const std::vector<uint32>& mapIds)
+ {
+ // the caller must pass the list of all mapIds that will be used in the VMapManager2 lifetime
+ for (const uint32& mapId : mapIds)
+ loadedMMaps.insert(MMapDataSet::value_type(mapId, nullptr));
+
+ thread_safe_environment = false;
+ }
+
+ MMapDataSet::const_iterator MMapManager::GetMMapData(uint32 mapId) const
+ {
+ // return the iterator if found or end() if not found/NULL
+ MMapDataSet::const_iterator itr = loadedMMaps.find(mapId);
+ if (itr != loadedMMaps.cend() && !itr->second)
+ itr = loadedMMaps.cend();
+
+ return itr;
+ }
+
bool MMapManager::loadMapData(uint32 mapId)
{
// we already have this map loaded?
- if (loadedMMaps.find(mapId) != loadedMMaps.end())
- return true;
+ MMapDataSet::iterator itr = loadedMMaps.find(mapId);
+ if (itr != loadedMMaps.end())
+ {
+ if (itr->second)
+ return true;
+ }
+ else
+ {
+ if (thread_safe_environment)
+ itr = loadedMMaps.insert(MMapDataSet::value_type(mapId, nullptr)).first;
+ else
+ ASSERT(false, "Invalid mapId %u passed to MMapManager after startup in thread unsafe environment", mapId);
+ }
// load and init dtNavMesh - read parameters from file
std::string fileName = Trinity::StringFormat(MAP_FILE_NAME_FORMAT, sWorld->GetDataPath().c_str(), mapId);
@@ -75,7 +105,7 @@ namespace MMAP
// store inside our map list
MMapData* mmap_data = new MMapData(mesh, mapId);
- loadedMMaps.insert(std::pair<uint32, MMapData*>(mapId, mmap_data));
+ itr->second = mmap_data;
return true;
}
@@ -252,14 +282,15 @@ namespace MMAP
bool MMapManager::unloadMap(uint32 mapId, int32 x, int32 y)
{
// check if we have this map loaded
- if (loadedMMaps.find(mapId) == loadedMMaps.end())
+ MMapDataSet::const_iterator itr = GetMMapData(mapId);
+ if (itr == loadedMMaps.end())
{
// file may not exist, therefore not loaded
TC_LOG_DEBUG("maps", "MMAP:unloadMap: Asked to unload not loaded navmesh map. %04u%02i%02i.mmtile", mapId, x, y);
return false;
}
- MMapData* mmap = loadedMMaps[mapId];
+ MMapData* mmap = itr->second;
// check if we have this tile loaded
uint32 packedGridPos = packTileID(x, y);
@@ -296,7 +327,8 @@ namespace MMAP
bool MMapManager::unloadMap(uint32 mapId)
{
- if (loadedMMaps.find(mapId) == loadedMMaps.end())
+ MMapDataSet::iterator itr = loadedMMaps.find(mapId);
+ if (itr == loadedMMaps.end() || !itr->second)
{
// file may not exist, therefore not loaded
TC_LOG_DEBUG("maps", "MMAP:unloadMap: Asked to unload not loaded navmesh map %04u", mapId);
@@ -304,7 +336,7 @@ namespace MMAP
}
// unload all tiles from given map
- MMapData* mmap = loadedMMaps[mapId];
+ MMapData* mmap = itr->second;
for (MMapTileSet::iterator i = mmap->loadedTileRefs.begin(); i != mmap->loadedTileRefs.end(); ++i)
{
uint32 x = (i->first >> 16);
@@ -320,7 +352,7 @@ namespace MMAP
}
delete mmap;
- loadedMMaps.erase(mapId);
+ itr->second = nullptr;
TC_LOG_DEBUG("maps", "MMAP:unloadMap: Unloaded %04i.mmap", mapId);
return true;
@@ -329,14 +361,15 @@ namespace MMAP
bool MMapManager::unloadMapInstance(uint32 mapId, uint32 instanceId)
{
// check if we have this map loaded
- if (loadedMMaps.find(mapId) == loadedMMaps.end())
+ MMapDataSet::const_iterator itr = GetMMapData(mapId);
+ if (itr == loadedMMaps.end())
{
// file may not exist, therefore not loaded
TC_LOG_DEBUG("maps", "MMAP:unloadMapInstance: Asked to unload not loaded navmesh map %04u", mapId);
return false;
}
- MMapData* mmap = loadedMMaps[mapId];
+ MMapData* mmap = itr->second;
if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end())
{
TC_LOG_DEBUG("maps", "MMAP:unloadMapInstance: Asked to unload not loaded dtNavMeshQuery mapId %04u instanceId %u", mapId, instanceId);
@@ -354,18 +387,20 @@ namespace MMAP
dtNavMesh const* MMapManager::GetNavMesh(uint32 mapId, TerrainSet swaps)
{
- if (loadedMMaps.find(mapId) == loadedMMaps.end())
+ MMapDataSet::const_iterator itr = GetMMapData(mapId);
+ if (itr == loadedMMaps.end())
return NULL;
- return loadedMMaps[mapId]->GetNavMesh(swaps);
+ return itr->second->GetNavMesh(swaps);
}
dtNavMeshQuery const* MMapManager::GetNavMeshQuery(uint32 mapId, uint32 instanceId, TerrainSet swaps)
{
- if (loadedMMaps.find(mapId) == loadedMMaps.end())
+ MMapDataSet::const_iterator itr = GetMMapData(mapId);
+ if (itr == loadedMMaps.end())
return NULL;
- MMapData* mmap = loadedMMaps[mapId];
+ MMapData* mmap = itr->second;
if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end())
{
// allocate mesh query
diff --git a/src/server/collision/Management/MMapManager.h b/src/server/collision/Management/MMapManager.h
index b7356716a9d..2b3818601af 100644
--- a/src/server/collision/Management/MMapManager.h
+++ b/src/server/collision/Management/MMapManager.h
@@ -92,9 +92,10 @@ namespace MMAP
class MMapManager
{
public:
- MMapManager() : loadedTiles(0) { }
+ MMapManager() : loadedTiles(0), thread_safe_environment(true) {}
~MMapManager();
+ void InitializeThreadUnsafe(const std::vector<uint32>& mapIds);
bool loadMap(const std::string& basePath, uint32 mapId, int32 x, int32 y);
bool unloadMap(uint32 mapId, int32 x, int32 y);
bool unloadMap(uint32 mapId);
@@ -115,8 +116,10 @@ namespace MMAP
bool loadMapData(uint32 mapId);
uint32 packTileID(int32 x, int32 y);
+ MMapDataSet::const_iterator GetMMapData(uint32 mapId) const;
MMapDataSet loadedMMaps;
uint32 loadedTiles;
+ bool thread_safe_environment;
PhasedTile* LoadTile(uint32 mapId, int32 x, int32 y);
PhaseTileMap _phaseTiles;
diff --git a/src/server/collision/Management/VMapFactory.cpp b/src/server/collision/Management/VMapFactory.cpp
index e3e211268e0..4c2750a9e5c 100644
--- a/src/server/collision/Management/VMapFactory.cpp
+++ b/src/server/collision/Management/VMapFactory.cpp
@@ -27,7 +27,7 @@ namespace VMAP
// just return the instance
IVMapManager* VMapFactory::createOrGetVMapManager()
{
- if (gVMapManager == 0)
+ if (gVMapManager == nullptr)
gVMapManager= new VMapManager2(); // should be taken from config ... Please change if you like :-)
return gVMapManager;
}
diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp
index 0c3ff1a9bfa..b2085382725 100644
--- a/src/server/collision/Management/VMapManager2.cpp
+++ b/src/server/collision/Management/VMapManager2.cpp
@@ -37,6 +37,7 @@ namespace VMAP
{
GetLiquidFlagsPtr = &GetLiquidFlagsDummy;
IsVMAPDisabledForPtr = &IsVMAPDisabledForDummy;
+ thread_safe_environment = true;
}
VMapManager2::~VMapManager2(void)
@@ -51,6 +52,15 @@ namespace VMAP
}
}
+ void VMapManager2::InitializeThreadUnsafe(const std::vector<uint32>& mapIds)
+ {
+ // the caller must pass the list of all mapIds that will be used in the VMapManager2 lifetime
+ for (const uint32& mapId : mapIds)
+ iInstanceMapTrees.insert(InstanceTreeMap::value_type(mapId, nullptr));
+
+ thread_safe_environment = false;
+ }
+
Vector3 VMapManager2::convertPositionToInternalRep(float x, float y, float z) const
{
Vector3 pos;
@@ -86,12 +96,31 @@ namespace VMAP
return result;
}
+ InstanceTreeMap::const_iterator VMapManager2::GetMapTree(uint32 mapId) const
+ {
+ // return the iterator if found or end() if not found/NULL
+ InstanceTreeMap::const_iterator itr = iInstanceMapTrees.find(mapId);
+ if (itr != iInstanceMapTrees.cend() && !itr->second)
+ itr = iInstanceMapTrees.cend();
+
+ return itr;
+ }
+
// load one tile (internal use only)
- bool VMapManager2::_loadMap(unsigned int mapId, const std::string& basePath, uint32 tileX, uint32 tileY)
+ bool VMapManager2::_loadMap(uint32 mapId, const std::string& basePath, uint32 tileX, uint32 tileY)
{
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
if (instanceTree == iInstanceMapTrees.end())
{
+ if (thread_safe_environment)
+ instanceTree = iInstanceMapTrees.insert(InstanceTreeMap::value_type(mapId, nullptr)).first;
+ else
+ ASSERT(false, "Invalid mapId %u tile [%u, %u] passed to VMapManager2 after startup in thread unsafe environment",
+ mapId, tileX, tileY);
+ }
+
+ if (!instanceTree->second)
+ {
std::string mapFileName = getMapFileName(mapId);
StaticMapTree* newTree = new StaticMapTree(mapId, basePath);
if (!newTree->InitMap(mapFileName, this))
@@ -99,7 +128,7 @@ namespace VMAP
delete newTree;
return false;
}
- instanceTree = iInstanceMapTrees.insert(InstanceTreeMap::value_type(mapId, newTree)).first;
+ instanceTree->second = newTree;
}
return instanceTree->second->LoadMapTile(tileX, tileY, this);
@@ -108,13 +137,13 @@ namespace VMAP
void VMapManager2::unloadMap(unsigned int mapId)
{
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
- if (instanceTree != iInstanceMapTrees.end())
+ if (instanceTree != iInstanceMapTrees.end() && instanceTree->second)
{
instanceTree->second->UnloadMap(this);
if (instanceTree->second->numLoadedTiles() == 0)
{
delete instanceTree->second;
- iInstanceMapTrees.erase(mapId);
+ instanceTree->second = nullptr;
}
}
}
@@ -122,13 +151,13 @@ namespace VMAP
void VMapManager2::unloadMap(unsigned int mapId, int x, int y)
{
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
- if (instanceTree != iInstanceMapTrees.end())
+ if (instanceTree != iInstanceMapTrees.end() && instanceTree->second)
{
instanceTree->second->UnloadMapTile(x, y, this);
if (instanceTree->second->numLoadedTiles() == 0)
{
delete instanceTree->second;
- iInstanceMapTrees.erase(mapId);
+ instanceTree->second = nullptr;
}
}
}
@@ -138,7 +167,7 @@ namespace VMAP
if (!isLineOfSightCalcEnabled() || IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LOS))
return true;
- InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
+ InstanceTreeMap::const_iterator instanceTree = GetMapTree(mapId);
if (instanceTree != iInstanceMapTrees.end())
{
Vector3 pos1 = convertPositionToInternalRep(x1, y1, z1);
@@ -160,7 +189,7 @@ namespace VMAP
{
if (isLineOfSightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LOS))
{
- InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
+ InstanceTreeMap::const_iterator instanceTree = GetMapTree(mapId);
if (instanceTree != iInstanceMapTrees.end())
{
Vector3 pos1 = convertPositionToInternalRep(x1, y1, z1);
@@ -190,7 +219,7 @@ namespace VMAP
{
if (isHeightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_HEIGHT))
{
- InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
+ InstanceTreeMap::const_iterator instanceTree = GetMapTree(mapId);
if (instanceTree != iInstanceMapTrees.end())
{
Vector3 pos = convertPositionToInternalRep(x, y, z);
@@ -209,7 +238,7 @@ namespace VMAP
{
if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_AREAFLAG))
{
- InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId);
+ InstanceTreeMap::const_iterator instanceTree = GetMapTree(mapId);
if (instanceTree != iInstanceMapTrees.end())
{
Vector3 pos = convertPositionToInternalRep(x, y, z);
@@ -227,7 +256,7 @@ namespace VMAP
{
if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LIQUIDSTATUS))
{
- InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId);
+ InstanceTreeMap::const_iterator instanceTree = GetMapTree(mapId);
if (instanceTree != iInstanceMapTrees.end())
{
LocationInfo info;
diff --git a/src/server/collision/Management/VMapManager2.h b/src/server/collision/Management/VMapManager2.h
index e13d5ab952b..a5891e9642b 100644
--- a/src/server/collision/Management/VMapManager2.h
+++ b/src/server/collision/Management/VMapManager2.h
@@ -21,6 +21,7 @@
#include <mutex>
#include <unordered_map>
+#include <vector>
#include "Define.h"
#include "IVMapManager.h"
@@ -80,6 +81,7 @@ namespace VMAP
// Tree to check collision
ModelFileMap iLoadedModelFiles;
InstanceTreeMap iInstanceMapTrees;
+ bool thread_safe_environment;
// Mutex for iLoadedModelFiles
std::mutex LoadedModelFilesLock;
@@ -89,6 +91,8 @@ namespace VMAP
static uint32 GetLiquidFlagsDummy(uint32) { return 0; }
static bool IsVMAPDisabledForDummy(uint32 /*entry*/, uint8 /*flags*/) { return false; }
+ InstanceTreeMap::const_iterator GetMapTree(uint32 mapId) const;
+
public:
// public for debug
G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const;
@@ -97,6 +101,7 @@ namespace VMAP
VMapManager2();
~VMapManager2(void);
+ void InitializeThreadUnsafe(const std::vector<uint32>& mapIds);
int loadMap(const char* pBasePath, unsigned int mapId, int x, int y) override;
void unloadMap(unsigned int mapId, int x, int y) override;
diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp
index 607460a2784..c40cb22a18c 100644
--- a/src/server/collision/Models/GameObjectModel.cpp
+++ b/src/server/collision/Models/GameObjectModel.cpp
@@ -20,15 +20,9 @@
#include "VMapManager2.h"
#include "VMapDefinitions.h"
#include "WorldModel.h"
-
#include "GameObjectModel.h"
#include "Log.h"
-#include "GameObject.h"
-#include "Creature.h"
-#include "TemporarySummon.h"
-#include "Object.h"
-#include "DBCStores.h"
-#include "World.h"
+#include "Timer.h"
using G3D::Vector3;
using G3D::Ray;
@@ -46,13 +40,11 @@ struct GameobjectModelData
typedef std::unordered_map<uint32, GameobjectModelData> ModelList;
ModelList model_list;
-void LoadGameObjectModelList()
+void LoadGameObjectModelList(std::string const& dataPath)
{
-#ifndef NO_CORE_FUNCS
uint32 oldMSTime = getMSTime();
-#endif
- FILE* model_list_file = fopen((sWorld->GetDataPath() + "vmaps/" + VMAP::GAMEOBJECT_MODELS).c_str(), "rb");
+ FILE* model_list_file = fopen((dataPath + "vmaps/" + VMAP::GAMEOBJECT_MODELS).c_str(), "rb");
if (!model_list_file)
{
VMAP_ERROR_LOG("misc", "Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS);
@@ -86,7 +78,7 @@ void LoadGameObjectModelList()
model_list.insert
(
- ModelList::value_type( displayId, GameobjectModelData(std::string(buff, name_length), AABox(v1, v2)) )
+ ModelList::value_type(displayId, GameobjectModelData(std::string(buff, name_length), AABox(v1, v2)))
);
}
@@ -100,9 +92,9 @@ GameObjectModel::~GameObjectModel()
((VMAP::VMapManager2*)VMAP::VMapFactory::createOrGetVMapManager())->releaseModelInstance(name);
}
-bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayInfoEntry& info)
+bool GameObjectModel::initialize(std::unique_ptr<GameObjectModelOwnerBase> modelOwner, std::string const& dataPath)
{
- ModelList::const_iterator it = model_list.find(info.ID);
+ ModelList::const_iterator it = model_list.find(modelOwner->GetDisplayId());
if (it == model_list.end())
return false;
@@ -114,21 +106,18 @@ bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayIn
return false;
}
- iModel = ((VMAP::VMapManager2*)VMAP::VMapFactory::createOrGetVMapManager())->acquireModelInstance(sWorld->GetDataPath() + "vmaps/", it->second.name);
+ iModel = ((VMAP::VMapManager2*)VMAP::VMapFactory::createOrGetVMapManager())->acquireModelInstance(dataPath + "vmaps/", it->second.name);
if (!iModel)
return false;
name = it->second.name;
- //flags = VMAP::MOD_M2;
- //adtId = 0;
- //ID = 0;
- iPos = Vector3(go.GetPositionX(), go.GetPositionY(), go.GetPositionZ());
- phasemask = go.GetPhaseMask();
- iScale = go.GetObjectScale();
+ iPos = modelOwner->GetPosition();
+ phasemask = modelOwner->GetPhaseMask();
+ iScale = modelOwner->GetScale();
iInvScale = 1.f / iScale;
- G3D::Matrix3 iRotation = G3D::Matrix3::fromEulerAnglesZYX(go.GetOrientation(), 0, 0);
+ G3D::Matrix3 iRotation = G3D::Matrix3::fromEulerAnglesZYX(modelOwner->GetOrientation(), 0, 0);
iInvRot = iRotation.inverse();
// transform bounding box:
mdl_box = AABox(mdl_box.low() * iScale, mdl_box.high() * iScale);
@@ -142,22 +131,18 @@ bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayIn
for (int i = 0; i < 8; ++i)
{
Vector3 pos(iBound.corner(i));
- go.SummonCreature(1, pos.x, pos.y, pos.z, 0, TEMPSUMMON_MANUAL_DESPAWN);
+ modelOwner->DebugVisualizeCorner(pos);
}
#endif
- owner = &go;
+ owner = std::move(modelOwner);
return true;
}
-GameObjectModel* GameObjectModel::Create(const GameObject& go)
+GameObjectModel* GameObjectModel::Create(std::unique_ptr<GameObjectModelOwnerBase> modelOwner, std::string const& dataPath)
{
- const GameObjectDisplayInfoEntry* info = sGameObjectDisplayInfoStore.LookupEntry(go.GetDisplayId());
- if (!info)
- return NULL;
-
GameObjectModel* mdl = new GameObjectModel();
- if (!mdl->initialize(go, *info))
+ if (!mdl->initialize(std::move(modelOwner), dataPath))
{
delete mdl;
return NULL;
@@ -168,7 +153,7 @@ GameObjectModel* GameObjectModel::Create(const GameObject& go)
bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const
{
- if (!(phasemask & ph_mask) || !owner->isSpawned())
+ if (!(phasemask & ph_mask) || !owner->IsSpawned())
return false;
float time = ray.intersectionTime(iBound);
@@ -205,7 +190,7 @@ bool GameObjectModel::UpdatePosition()
return false;
}
- iPos = Vector3(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ());
+ iPos = owner->GetPosition();
G3D::Matrix3 iRotation = G3D::Matrix3::fromEulerAnglesZYX(owner->GetOrientation(), 0, 0);
iInvRot = iRotation.inverse();
@@ -221,7 +206,7 @@ bool GameObjectModel::UpdatePosition()
for (int i = 0; i < 8; ++i)
{
Vector3 pos(iBound.corner(i));
- owner->SummonCreature(1, pos.x, pos.y, pos.z, 0, TEMPSUMMON_MANUAL_DESPAWN);
+ owner->DebugVisualizeCorner(pos);
}
#endif
diff --git a/src/server/collision/Models/GameObjectModel.h b/src/server/collision/Models/GameObjectModel.h
index 43d299d6d8f..17669189af5 100644
--- a/src/server/collision/Models/GameObjectModel.h
+++ b/src/server/collision/Models/GameObjectModel.h
@@ -25,6 +25,7 @@
#include <G3D/Ray.h>
#include "Define.h"
+#include <memory>
namespace VMAP
{
@@ -34,21 +35,21 @@ namespace VMAP
class GameObject;
struct GameObjectDisplayInfoEntry;
-class GameObjectModel /*, public Intersectable*/
+class GameObjectModelOwnerBase
{
- uint32 phasemask;
- G3D::AABox iBound;
- G3D::Matrix3 iInvRot;
- G3D::Vector3 iPos;
- //G3D::Vector3 iRot;
- float iInvScale;
- float iScale;
- VMAP::WorldModel* iModel;
- GameObject const* owner;
-
- GameObjectModel() : phasemask(0), iInvScale(0), iScale(0), iModel(NULL), owner(NULL) { }
- bool initialize(const GameObject& go, const GameObjectDisplayInfoEntry& info);
+public:
+ virtual bool IsSpawned() const { return false; }
+ virtual uint32 GetDisplayId() const { return 0; }
+ virtual uint32 GetPhaseMask() const { return 0; }
+ virtual G3D::Vector3 GetPosition() const { return G3D::Vector3::zero(); }
+ virtual float GetOrientation() const { return 0.0f; }
+ virtual float GetScale() const { return 1.0f; }
+ virtual void DebugVisualizeCorner(G3D::Vector3 const& /*corner*/) const { }
+};
+class GameObjectModel /*, public Intersectable*/
+{
+ GameObjectModel() : phasemask(0), iInvScale(0), iScale(0), iModel(NULL) { }
public:
std::string name;
@@ -66,9 +67,21 @@ public:
bool intersectRay(const G3D::Ray& Ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const;
- static GameObjectModel* Create(const GameObject& go);
+ static GameObjectModel* Create(std::unique_ptr<GameObjectModelOwnerBase> modelOwner, std::string const& dataPath);
bool UpdatePosition();
+
+private:
+ bool initialize(std::unique_ptr<GameObjectModelOwnerBase> modelOwner, std::string const& dataPath);
+
+ uint32 phasemask;
+ G3D::AABox iBound;
+ G3D::Matrix3 iInvRot;
+ G3D::Vector3 iPos;
+ float iInvScale;
+ float iScale;
+ VMAP::WorldModel* iModel;
+ std::unique_ptr<GameObjectModelOwnerBase> owner;
};
#endif // _GAMEOBJECT_MODEL_H
diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp
index 14e5faaf723..7fd1493cbde 100644
--- a/src/server/game/AI/CoreAI/GuardAI.cpp
+++ b/src/server/game/AI/CoreAI/GuardAI.cpp
@@ -19,9 +19,6 @@
#include "GuardAI.h"
#include "Errors.h"
#include "Player.h"
-#include "ObjectAccessor.h"
-#include "World.h"
-#include "CreatureAIImpl.h"
int GuardAI::Permissible(Creature const* creature)
{
diff --git a/src/server/game/AI/CoreAI/PassiveAI.cpp b/src/server/game/AI/CoreAI/PassiveAI.cpp
index afd198aea02..f88e13bb31d 100644
--- a/src/server/game/AI/CoreAI/PassiveAI.cpp
+++ b/src/server/game/AI/CoreAI/PassiveAI.cpp
@@ -18,7 +18,6 @@
#include "PassiveAI.h"
#include "Creature.h"
-#include "TemporarySummon.h"
PassiveAI::PassiveAI(Creature* c) : CreatureAI(c) { me->SetReactState(REACT_PASSIVE); }
PossessedAI::PossessedAI(Creature* c) : CreatureAI(c) { me->SetReactState(REACT_PASSIVE); }
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index 7d36fd9de67..152ecd6c86c 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -20,12 +20,10 @@
#include "Errors.h"
#include "Pet.h"
#include "Player.h"
-#include "DBCStores.h"
#include "Spell.h"
#include "ObjectAccessor.h"
#include "SpellMgr.h"
#include "Creature.h"
-#include "World.h"
#include "Util.h"
#include "Group.h"
#include "SpellInfo.h"
diff --git a/src/server/game/AI/CoreAI/ReactorAI.cpp b/src/server/game/AI/CoreAI/ReactorAI.cpp
index ebb57038737..9ab86047dc8 100644
--- a/src/server/game/AI/CoreAI/ReactorAI.cpp
+++ b/src/server/game/AI/CoreAI/ReactorAI.cpp
@@ -18,10 +18,6 @@
#include "ByteBuffer.h"
#include "ReactorAI.h"
-#include "Errors.h"
-#include "Log.h"
-#include "ObjectAccessor.h"
-#include "CreatureAIImpl.h"
int ReactorAI::Permissible(const Creature* creature)
{
diff --git a/src/server/game/AI/CoreAI/TotemAI.cpp b/src/server/game/AI/CoreAI/TotemAI.cpp
index 2fbd6406b2f..d9afc61056d 100644
--- a/src/server/game/AI/CoreAI/TotemAI.cpp
+++ b/src/server/game/AI/CoreAI/TotemAI.cpp
@@ -19,10 +19,8 @@
#include "TotemAI.h"
#include "Totem.h"
#include "Creature.h"
-#include "DBCStores.h"
#include "ObjectAccessor.h"
#include "SpellMgr.h"
-
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h
index 3ea18f272ae..d98f791421b 100644
--- a/src/server/game/AI/CoreAI/UnitAI.h
+++ b/src/server/game/AI/CoreAI/UnitAI.h
@@ -22,6 +22,7 @@
#include "Define.h"
#include "Unit.h"
#include "Containers.h"
+#include "EventMap.h"
#include <list>
class Player;
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index 96a25588120..d76d106e81a 100644
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
@@ -140,6 +140,30 @@ void CreatureAI::MoveInLineOfSight(Unit* who)
// me->GetMotionMaster()->MoveChase(who->GetVictim());
}
+// Distract creature, if player gets too close while stealthed/prowling
+void CreatureAI::TriggerAlert(Unit const* who) const
+{
+ // If there's no target, or target isn't a player do nothing
+ if (!who || who->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ // If this unit isn't an NPC, is already distracted, is in combat, is confused, stunned or fleeing, do nothing
+ if (me->GetTypeId() != TYPEID_UNIT || me->IsInCombat() || me->HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_STUNNED | UNIT_STATE_FLEEING | UNIT_STATE_DISTRACTED))
+ return;
+
+ // Only alert for hostiles!
+ if (me->IsCivilian() || me->HasReactState(REACT_PASSIVE) || !me->IsHostileTo(who) || !me->_IsTargetAcceptable(who))
+ return;
+
+ // Send alert sound (if any) for this creature
+ me->SendAIReaction(AI_REACTION_ALERT);
+
+ // Face the unit (stealthed player) and set distracted state for 5 seconds
+ me->SetFacingTo(me->GetAngle(who->GetPositionX(), who->GetPositionY()));
+ me->StopMoving();
+ me->GetMotionMaster()->MoveDistract(5 * IN_MILLISECONDS);
+}
+
void CreatureAI::EnterEvadeMode()
{
if (!_EnterEvadeMode())
diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h
index 2e862c37c0e..a205ef16833 100644
--- a/src/server/game/AI/CreatureAI.h
+++ b/src/server/game/AI/CreatureAI.h
@@ -89,6 +89,9 @@ class CreatureAI : public UnitAI
// Called if IsVisible(Unit* who) is true at each who move, reaction at visibility zone enter
void MoveInLineOfSight_Safe(Unit* who);
+ // Trigger Creature "Alert" state (creature can see stealthed unit)
+ void TriggerAlert(Unit const* who) const;
+
// Called in Creature::Update when deathstate = DEAD. Inherited classes may maniuplate the ability to respawn based on scripted events.
virtual bool CanRespawn() { return true; }
@@ -119,7 +122,7 @@ class CreatureAI : public UnitAI
// Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc)
virtual void AttackedBy(Unit* /*attacker*/) { }
- virtual bool IsEscorted() { return false; }
+ virtual bool IsEscorted() const { return false; }
// Called when creature is spawned or respawned (for reseting variables)
virtual void JustRespawned() { Reset(); }
diff --git a/src/server/game/AI/CreatureAISelector.cpp b/src/server/game/AI/CreatureAISelector.cpp
index 8a37186d0af..ddb5ba3508b 100644
--- a/src/server/game/AI/CreatureAISelector.cpp
+++ b/src/server/game/AI/CreatureAISelector.cpp
@@ -21,7 +21,6 @@
#include "PassiveAI.h"
#include "MovementGenerator.h"
-#include "Pet.h"
#include "TemporarySummon.h"
#include "CreatureAIFactory.h"
#include "ScriptMgr.h"
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index f1a3afcb8fe..b38ddcf11bc 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -17,14 +17,12 @@
*/
#include "ScriptedCreature.h"
-#include "Item.h"
#include "Spell.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Cell.h"
#include "CellImpl.h"
#include "ObjectMgr.h"
-#include "TemporarySummon.h"
// Spell summary for ScriptedAI::SelectSpell
struct TSpellSummary
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index 66164730219..7ea77341567 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -120,7 +120,13 @@ void npc_escortAI::MoveInLineOfSight(Unit* who)
{
if (!me->GetVictim())
{
- who->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
+ // Clear distracted state on combat
+ if (me->HasUnitState(UNIT_STATE_DISTRACTED))
+ {
+ me->ClearUnitState(UNIT_STATE_DISTRACTED);
+ me->GetMotionMaster()->Clear();
+ }
+
AttackStart(who);
}
else if (me->GetMap()->IsDungeon())
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
index 75ff1b8dfc9..1d71652c948 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
@@ -94,16 +94,16 @@ struct npc_escortAI : public ScriptedAI
void SetEscortPaused(bool on);
bool HasEscortState(uint32 escortState) { return (m_uiEscortState & escortState) != 0; }
- virtual bool IsEscorted() override { return (m_uiEscortState & STATE_ESCORT_ESCORTING); }
+ virtual bool IsEscorted() const override { return (m_uiEscortState & STATE_ESCORT_ESCORTING); }
void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; }
- float GetMaxPlayerDistance() { return MaxPlayerDistance; }
+ float GetMaxPlayerDistance() const { return MaxPlayerDistance; }
void SetDespawnAtEnd(bool despawn) { DespawnAtEnd = despawn; }
void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; }
- bool GetAttack() { return m_bIsActiveAttacker; }//used in EnterEvadeMode override
+ bool GetAttack() const { return m_bIsActiveAttacker; }//used in EnterEvadeMode override
void SetCanAttack(bool attack) { m_bIsActiveAttacker = attack; }
- ObjectGuid GetEventStarterGUID() { return m_uiPlayerGUID; }
+ ObjectGuid GetEventStarterGUID() const { return m_uiPlayerGUID; }
protected:
Player* GetPlayerForEscort() { return ObjectAccessor::GetPlayer(*me, m_uiPlayerGUID); }
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
index ab91b0b5b27..856ca1d9e16 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
@@ -117,7 +117,13 @@ void FollowerAI::MoveInLineOfSight(Unit* who)
{
if (!me->GetVictim())
{
- who->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
+ // Clear distracted state on combat
+ if (me->HasUnitState(UNIT_STATE_DISTRACTED))
+ {
+ me->ClearUnitState(UNIT_STATE_DISTRACTED);
+ me->GetMotionMaster()->Clear();
+ }
+
AttackStart(who);
}
else if (me->GetMap()->IsDungeon())
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 4203e796aa5..c6a16e1b2fd 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -21,11 +21,7 @@
#include "GridDefines.h"
#include "GridNotifiers.h"
#include "SpellMgr.h"
-#include "GridNotifiersImpl.h"
#include "Cell.h"
-#include "CellImpl.h"
-#include "InstanceScript.h"
-#include "ScriptedCreature.h"
#include "Group.h"
#include "SmartAI.h"
#include "ScriptMgr.h"
@@ -473,7 +469,13 @@ void SmartAI::MoveInLineOfSight(Unit* who)
{
if (!me->GetVictim())
{
- who->RemoveAurasByType(SPELL_AURA_MOD_STEALTH);
+ // Clear distracted state on combat
+ if (me->HasUnitState(UNIT_STATE_DISTRACTED))
+ {
+ me->ClearUnitState(UNIT_STATE_DISTRACTED);
+ me->GetMotionMaster()->Clear();
+ }
+
AttackStart(who);
}
else/* if (me->GetMap()->IsDungeon())*/
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index 145c74faf9f..1e287cd5b9e 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -214,7 +214,7 @@ class SmartAI : public CreatureAI
uint32 mWPPauseTimer;
WayPoint* mLastWP;
Position mLastOOCPos;//set on enter combat
- uint32 GetWPCount() { return mWayPoints ? uint32(mWayPoints->size()) : 0; }
+ uint32 GetWPCount() const { return mWayPoints ? uint32(mWayPoints->size()) : 0; }
bool mCanRepeatPath;
bool mRun;
bool mCanAutoAttack;
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index be0781240d9..5a60291ab4c 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -35,7 +35,6 @@
#include "SmartScript.h"
#include "SpellMgr.h"
#include "Vehicle.h"
-#include "MoveSplineInit.h"
#include "GameEventMgr.h"
SmartScript::SmartScript()
@@ -788,6 +787,15 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
player->GroupEventHappens(e.action.quest.quest, GetBaseObject());
break;
}
+ case SMART_ACTION_COMBAT_STOP:
+ {
+ if (!me)
+ break;
+
+ me->CombatStop(true);
+ TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_COMBAT_STOP: %s CombatStop", me->GetGUID().ToString().c_str());
+ break;
+ }
case SMART_ACTION_REMOVEAURASFROMSPELL:
{
ObjectList* targets = GetTargets(e, unit);
@@ -918,8 +926,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
}
else if (IsUnit(*itr)) // Special handling for vehicles
if (Vehicle* vehicle = (*itr)->ToUnit()->GetVehicleKit())
- for (SeatMap::iterator itr = vehicle->Seats.begin(); itr != vehicle->Seats.end(); ++itr)
- if (Player* player = ObjectAccessor::FindPlayer(itr->second.Passenger.Guid))
+ for (SeatMap::iterator seatItr = vehicle->Seats.begin(); seatItr != vehicle->Seats.end(); ++seatItr)
+ if (Player* player = ObjectAccessor::FindPlayer(seatItr->second.Passenger.Guid))
player->KilledMonsterCredit(e.action.killedMonster.creature);
}
@@ -1754,7 +1762,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!IsUnit(*itr))
continue;
- Unit* unit = (*itr)->ToUnit();
+ Unit* targetUnit = (*itr)->ToUnit();
bool interruptedSpell = false;
@@ -1767,11 +1775,11 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
{
if (!interruptedSpell && e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS)
{
- unit->InterruptNonMeleeSpells(false);
+ targetUnit->InterruptNonMeleeSpells(false);
interruptedSpell = true;
}
- unit->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0);
+ targetUnit->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0);
}
else
TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (%s) already has the aura", e.action.cast.spell, (*it)->GetGUID().ToString().c_str());
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index a665b9e09ae..c86255f6d4a 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -21,14 +21,9 @@
#include "GridDefines.h"
#include "GridNotifiers.h"
#include "SpellMgr.h"
-#include "GridNotifiersImpl.h"
#include "Cell.h"
-#include "CellImpl.h"
-#include "InstanceScript.h"
-#include "ScriptedCreature.h"
#include "GameEventMgr.h"
#include "CreatureTextMgr.h"
-#include "SpellMgr.h"
#include "SpellInfo.h"
#include "SmartScriptMgr.h"
@@ -1178,6 +1173,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_STORE_TARGET_LIST:
case SMART_ACTION_EVADE:
case SMART_ACTION_FLEE_FOR_ASSIST:
+ case SMART_ACTION_COMBAT_STOP:
case SMART_ACTION_DIE:
case SMART_ACTION_SET_IN_COMBAT_WITH_ZONE:
case SMART_ACTION_SET_ACTIVE:
@@ -1270,11 +1266,11 @@ bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id)
default:
if (e.entryOrGuid < 0)
{
- uint64 entry = uint64(-e.entryOrGuid);
- CreatureData const* data = sObjectMgr->GetCreatureData(entry);
+ ObjectGuid::LowType guid = ObjectGuid::LowType(-e.entryOrGuid);
+ CreatureData const* data = sObjectMgr->GetCreatureData(guid);
if (!data)
{
- TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u using non-existent Creature guid " UI64FMTD ", skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
+ TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry " SI64FMTD " SourceType %u Event %u Action %u using non-existent Creature guid " UI64FMTD ", skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), guid);
return false;
}
else
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
index 0c16b02c33a..66829db812f 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h
@@ -453,7 +453,7 @@ enum SMART_ACTION
SMART_ACTION_EVADE = 24, // No Params
SMART_ACTION_FLEE_FOR_ASSIST = 25, // With Emote
SMART_ACTION_CALL_GROUPEVENTHAPPENS = 26, // QuestID
- // none = 27,
+ SMART_ACTION_COMBAT_STOP = 27, //
SMART_ACTION_REMOVEAURASFROMSPELL = 28, // Spellid (0 removes all auras), charges (0 removes aura)
SMART_ACTION_FOLLOW = 29, // Distance (0 = default), Angle (0 = default), EndCreatureEntry, credit, creditType (0monsterkill, 1event)
SMART_ACTION_RANDOM_PHASE = 30, // PhaseId1, PhaseId2, PhaseId3...
diff --git a/src/server/game/Accounts/RBAC.h b/src/server/game/Accounts/RBAC.h
index fb5927e9e91..9baa4caeea7 100644
--- a/src/server/game/Accounts/RBAC.h
+++ b/src/server/game/Accounts/RBAC.h
@@ -923,7 +923,7 @@ class RBACData
*/
void CalculateNewPermissions();
- int32 GetRealmId() { return _realmId; }
+ int32 GetRealmId() const { return _realmId; }
// Auxiliar private functions - defined to allow to maintain same code even
// if internal structure changes.
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 1a614ab8df5..dfff09f0694 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -298,7 +298,7 @@ void AuctionHouseMgr::LoadAuctionItems()
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry);
if (!proto)
{
- TC_LOG_ERROR("misc", "AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: " UI64FMTD " id: #%u) in auction, skipped.", itemGuid, itemEntry);
+ TC_LOG_ERROR("misc", "AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: " UI64FMTD " item entry: #%u) in auction, skipped.", itemGuid, itemEntry);
continue;
}
diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h
index 0eebeee6939..42d27ed35cf 100644
--- a/src/server/game/Battlefield/Battlefield.h
+++ b/src/server/game/Battlefield/Battlefield.h
@@ -101,7 +101,7 @@ class BfCapturePoint
GameObject* GetCapturePointGo();
uint32 GetCapturePointEntry() const { return m_capturePointEntry; }
- TeamId GetTeamId() { return m_team; }
+ TeamId GetTeamId() const { return m_team; }
protected:
bool DelCapturePoint();
@@ -222,19 +222,19 @@ class Battlefield : public ZoneScript
/// 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; }
- ObjectGuid GetGUID() { return m_Guid; }
+ uint32 GetTypeId() const { return m_TypeId; }
+ uint32 GetZoneId() const { return m_ZoneId; }
+ ObjectGuid GetGUID() const { return m_Guid; }
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; }
+ bool IsWarTime() const { return m_isActive; }
/// Enable or Disable battlefield
void ToggleBattlefield(bool enable) { m_IsEnabled = enable; }
/// Return if battlefield is enable
- bool IsEnabled() { return m_IsEnabled; }
+ bool IsEnabled() const { return m_IsEnabled; }
/**
* \brief Kick player from battlefield and teleport him to kick-point location
@@ -257,9 +257,9 @@ class Battlefield : public ZoneScript
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); }
+ TeamId GetDefenderTeam() const { return m_DefenderTeam; }
+ TeamId GetAttackerTeam() const { return TeamId(1 - m_DefenderTeam); }
+ TeamId GetOtherTeam(TeamId team) const { return (team == TEAM_HORDE ? TEAM_ALLIANCE : TEAM_HORDE); }
void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; }
// Group methods
@@ -311,7 +311,7 @@ class Battlefield : public ZoneScript
void PlayerAcceptInviteToQueue(Player* player);
void PlayerAcceptInviteToWar(Player* player);
- uint32 GetBattleId() { return m_BattleId; }
+ uint32 GetBattleId() const { return m_BattleId; }
void AskToLeaveQueue(Player* player);
virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) { }
@@ -331,9 +331,9 @@ class Battlefield : public ZoneScript
void HideNpc(Creature* creature);
void ShowNpc(Creature* creature, bool aggressive);
- GraveyardVect GetGraveyardVector() { return m_GraveyardList; }
+ GraveyardVect GetGraveyardVector() const { return m_GraveyardList; }
- uint32 GetTimer() { return m_Timer; }
+ uint32 GetTimer() const { return m_Timer; }
void SetTimer(uint32 timer) { m_Timer = timer; }
void DoPlaySoundToAll(uint32 SoundID);
diff --git a/src/server/game/Battlefield/BattlefieldMgr.cpp b/src/server/game/Battlefield/BattlefieldMgr.cpp
index 93fdb75c8bb..0ce7d3a685c 100644
--- a/src/server/game/Battlefield/BattlefieldMgr.cpp
+++ b/src/server/game/Battlefield/BattlefieldMgr.cpp
@@ -17,7 +17,6 @@
#include "BattlefieldMgr.h"
#include "BattlefieldWG.h"
-#include "ObjectMgr.h"
#include "Player.h"
BattlefieldMgr::BattlefieldMgr()
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h
index 6c39e30059d..40c8d00143a 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.h
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h
@@ -149,7 +149,7 @@ class BfGraveyardWG : public BfGraveyard
BfGraveyardWG(BattlefieldWG* Bf);
void SetTextId(uint32 textId) { m_GossipTextId = textId; }
- uint32 GetTextId() { return m_GossipTextId; }
+ uint32 GetTextId() const { return m_GossipTextId; }
protected:
uint32 m_GossipTextId;
diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
index c97eb5383bd..fce32a928c5 100644
--- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp
@@ -20,8 +20,6 @@
#include "World.h"
#include "Log.h"
#include "DatabaseEnv.h"
-#include "Language.h"
-#include "ObjectAccessor.h"
#include "Player.h"
ArenaTeamMgr::ArenaTeamMgr()
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 2b5c335bce0..3bec1fd89b3 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -22,18 +22,15 @@
#include "BattlegroundScore.h"
#include "Creature.h"
#include "CreatureTextMgr.h"
-#include "Chat.h"
#include "Formulas.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "GuildMgr.h"
#include "Guild.h"
-#include "MapManager.h"
#include "Object.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ReputationMgr.h"
-#include "SpellAuraEffects.h"
#include "SpellAuras.h"
#include "Util.h"
#include "WorldPacket.h"
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index 43ef7d9511b..7fef94ba752 100644
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -28,6 +28,7 @@
#include "GameObject.h"
#include "Packets/WorldStatePackets.h"
#include "Packets/BattlegroundPackets.h"
+#include "EventMap.h"
class Creature;
class GameObject;
@@ -258,7 +259,7 @@ class Battleground
/* Battleground */
// Get methods:
std::string const& GetName() const { return m_Name; }
- uint64 GetQueueId() { return m_queueId; }
+ uint64 GetQueueId() const { return m_queueId; }
BattlegroundTypeId GetTypeID(bool GetRandom = false) const { return GetRandom ? m_RandomTypeID : m_TypeID; }
BattlegroundBracketId GetBracketId() const { return m_BracketId; }
uint32 GetInstanceID() const { return m_InstanceID; }
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index a227dc1a07b..bbd7acacf12 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -18,11 +18,9 @@
#include "Common.h"
#include "ObjectMgr.h"
-#include "ArenaTeamMgr.h"
#include "World.h"
#include "WorldPacket.h"
-#include "ArenaTeam.h"
#include "BattlegroundMgr.h"
#include "BattlegroundAV.h"
#include "BattlegroundAB.h"
@@ -37,17 +35,14 @@
#include "BattlegroundIC.h"
#include "BattlegroundTP.h"
#include "BattlegroundBFG.h"
-#include "Chat.h"
#include "Map.h"
#include "MapInstanced.h"
#include "MapManager.h"
#include "Player.h"
#include "GameEventMgr.h"
#include "SharedDefines.h"
-#include "Formulas.h"
#include "DisableMgr.h"
#include "Opcodes.h"
-#include "MiscPackets.h"
/*********************************************************/
/*** BATTLEGROUND MANAGER ***/
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
index d888485887e..c0938eacd37 100644
--- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
@@ -24,7 +24,6 @@
#include "Group.h"
#include "Log.h"
#include "Language.h"
-#include "ObjectMgr.h"
#include "Player.h"
/*********************************************************/
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index 3e9e7e5e5cb..11729b014a4 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -17,9 +17,7 @@
*/
#include "BattlegroundAB.h"
-#include "World.h"
#include "WorldPacket.h"
-#include "ObjectMgr.h"
#include "BattlegroundMgr.h"
#include "Creature.h"
#include "Language.h"
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index 8376c3e4584..768a19ae963 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -21,12 +21,10 @@
#include "ObjectMgr.h"
#include "WorldPacket.h"
-#include "Formulas.h"
#include "GameObject.h"
#include "Language.h"
#include "Player.h"
#include "ScriptedCreature.h"
-#include "SpellAuras.h"
#include "WorldSession.h"
BattlegroundAV::BattlegroundAV()
@@ -1380,10 +1378,10 @@ bool BattlegroundAV::SetupBattleground()
//creatures
TC_LOG_DEBUG("bg.battleground", "BG_AV start poputlating nodes");
- for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
+ for (BG_AV_Nodes n = BG_AV_NODES_FIRSTAID_STATION; n < BG_AV_NODES_MAX; ++n)
{
- if (m_Nodes[i].Owner)
- PopulateNode(i);
+ if (m_Nodes[n].Owner)
+ PopulateNode(n);
}
//all creatures which don't get despawned through the script are static
TC_LOG_DEBUG("bg.battleground", "BG_AV: start spawning static creatures");
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBFG.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBFG.cpp
index 0d143966190..1e77eac3c82 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundBFG.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundBFG.cpp
@@ -15,17 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Battleground.h"
#include "BattlegroundBFG.h"
-#include "Creature.h"
-#include "GameObject.h"
-#include "Language.h"
-#include "Object.h"
-#include "ObjectMgr.h"
-#include "BattlegroundMgr.h"
-#include "Player.h"
-#include "World.h"
-#include "WorldPacket.h"
BattlegroundBFG::BattlegroundBFG()
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
index 0acfd287372..f9caeb9ca08 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp
@@ -18,7 +18,6 @@
#include "BattlegroundDS.h"
#include "Creature.h"
-#include "GameObject.h"
#include "Player.h"
#include "WorldPacket.h"
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
index 4a96c6a99c0..75ecd1226e1 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
@@ -17,8 +17,6 @@
*/
#include "BattlegroundEY.h"
-#include "ObjectMgr.h"
-#include "World.h"
#include "WorldPacket.h"
#include "BattlegroundMgr.h"
#include "Creature.h"
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index 1d55b213293..846a4bf0540 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -25,7 +25,6 @@
#include "ObjectMgr.h"
#include "Vehicle.h"
#include "Transport.h"
-#include "WorldSession.h"
#include "ScriptedCreature.h"
BattlegroundIC::BattlegroundIC()
@@ -496,62 +495,62 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* target
}
}
-void BattlegroundIC::UpdateNodeWorldState(ICNodePoint* nodePoint)
+void BattlegroundIC::UpdateNodeWorldState(ICNodePoint* node)
{
//updating worldstate
- if (nodePoint->gameobject_entry == nodePoint->banners[BANNER_A_CONTROLLED])
- nodePoint->nodeState = NODE_STATE_CONTROLLED_A;
- else if (nodePoint->gameobject_entry == nodePoint->banners[BANNER_A_CONTESTED])
- nodePoint->nodeState = NODE_STATE_CONFLICT_A;
- else if (nodePoint->gameobject_entry == nodePoint->banners[BANNER_H_CONTROLLED])
- nodePoint->nodeState = NODE_STATE_CONTROLLED_H;
- else if (nodePoint->gameobject_entry == nodePoint->banners[BANNER_H_CONTESTED])
- nodePoint->nodeState = NODE_STATE_CONFLICT_H;
+ if (node->gameobject_entry == node->banners[BANNER_A_CONTROLLED])
+ node->nodeState = NODE_STATE_CONTROLLED_A;
+ else if (node->gameobject_entry == node->banners[BANNER_A_CONTESTED])
+ node->nodeState = NODE_STATE_CONFLICT_A;
+ else if (node->gameobject_entry == node->banners[BANNER_H_CONTROLLED])
+ node->nodeState = NODE_STATE_CONTROLLED_H;
+ else if (node->gameobject_entry == node->banners[BANNER_H_CONTESTED])
+ node->nodeState = NODE_STATE_CONFLICT_H;
- uint32 worldstate = nodePoint->worldStates[nodePoint->nodeState];
+ uint32 worldstate = node->worldStates[node->nodeState];
// with this we are sure we dont bug the client
for (uint8 i = 0; i < 5; ++i)
{
- if (nodePoint->worldStates[i] == worldstate)
+ if (node->worldStates[i] == worldstate)
continue;
- UpdateWorldState(nodePoint->worldStates[i], 0);
+ UpdateWorldState(node->worldStates[i], 0);
}
UpdateWorldState(worldstate, 1);
}
-uint32 BattlegroundIC::GetNextBanner(ICNodePoint* nodePoint, uint32 team, bool returnDefinitve)
+uint32 BattlegroundIC::GetNextBanner(ICNodePoint* node, uint32 team, bool returnDefinitve)
{
// this is only used in the update map function
if (returnDefinitve)
// here is a special case, here we must return the definitve faction banner after the grey banner was spawned 1 minute
- return nodePoint->banners[(team == TEAM_ALLIANCE ? BANNER_A_CONTROLLED : BANNER_H_CONTROLLED)];
+ return node->banners[(team == TEAM_ALLIANCE ? BANNER_A_CONTROLLED : BANNER_H_CONTROLLED)];
// there were no changes, this point has never been captured by any faction or at least clicked
- if (nodePoint->last_entry == 0)
+ if (node->last_entry == 0)
// 1 returns the CONTESTED ALLIANCE BANNER, 3 returns the HORDE one
- return nodePoint->banners[(team == TEAM_ALLIANCE ? BANNER_A_CONTESTED : BANNER_H_CONTESTED)];
+ return node->banners[(team == TEAM_ALLIANCE ? BANNER_A_CONTESTED : BANNER_H_CONTESTED)];
// If the actual banner is the definitive faction banner, we must return the grey banner of the player's faction
- if (nodePoint->gameobject_entry == nodePoint->banners[BANNER_A_CONTROLLED] || nodePoint->gameobject_entry == nodePoint->banners[BANNER_H_CONTROLLED])
- return nodePoint->banners[(team == TEAM_ALLIANCE ? BANNER_A_CONTESTED : BANNER_H_CONTESTED)];
+ if (node->gameobject_entry == node->banners[BANNER_A_CONTROLLED] || node->gameobject_entry == node->banners[BANNER_H_CONTROLLED])
+ return node->banners[(team == TEAM_ALLIANCE ? BANNER_A_CONTESTED : BANNER_H_CONTESTED)];
// If the actual banner is the grey faction banner, we must return the previous banner
- if (nodePoint->gameobject_entry == nodePoint->banners[BANNER_A_CONTESTED] || nodePoint->banners[BANNER_H_CONTESTED])
- return nodePoint->last_entry;
+ if (node->gameobject_entry == node->banners[BANNER_A_CONTESTED] || node->banners[BANNER_H_CONTESTED])
+ return node->last_entry;
// we should never be here...
TC_LOG_ERROR("bg.battleground", "Isle Of Conquest: Unexpected return in GetNextBanner function");
return 0;
}
-void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint)
+void BattlegroundIC::HandleContestedNodes(ICNodePoint* node)
{
- if (nodePoint->nodeType == NODE_TYPE_HANGAR)
+ if (node->nodeType == NODE_TYPE_HANGAR)
{
if (gunshipAlliance && gunshipHorde)
- (nodePoint->faction == TEAM_ALLIANCE ? gunshipHorde : gunshipAlliance)->EnableMovement(false);
+ (node->faction == TEAM_ALLIANCE ? gunshipHorde : gunshipAlliance)->EnableMovement(false);
for (uint8 u = BG_IC_GO_HANGAR_TELEPORTER_1; u <= BG_IC_GO_HANGAR_TELEPORTER_3; ++u)
DelObject(u);
@@ -568,7 +567,7 @@ void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint)
}
std::list<Creature*> cannons;
- if (nodePoint->faction == TEAM_HORDE)
+ if (node->faction == TEAM_HORDE)
gunshipAlliance->GetCreatureListWithEntryInGrid(cannons, NPC_ALLIANCE_GUNSHIP_CANNON, 150.0f);
else
gunshipHorde->GetCreatureListWithEntryInGrid(cannons, NPC_HORDE_GUNSHIP_CANNON, 150.0f);
@@ -579,22 +578,22 @@ void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint)
cannon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
}
- else if (nodePoint->nodeType == NODE_TYPE_WORKSHOP)
+ else if (node->nodeType == NODE_TYPE_WORKSHOP)
{
DelObject(BG_IC_GO_SEAFORIUM_BOMBS_1);
DelObject(BG_IC_GO_SEAFORIUM_BOMBS_2);
}
}
-void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
+void BattlegroundIC::HandleCapturedNodes(ICNodePoint* node, bool recapture)
{
- if (nodePoint->nodeType != NODE_TYPE_REFINERY && nodePoint->nodeType != NODE_TYPE_QUARRY)
+ if (node->nodeType != NODE_TYPE_REFINERY && node->nodeType != NODE_TYPE_QUARRY)
{
- if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+nodePoint->nodeType-2, BG_IC_SpiritGuidePos[nodePoint->nodeType], nodePoint->faction))
- TC_LOG_ERROR("bg.battleground", "Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", nodePoint->nodeType, nodePoint->faction);
+ if (!AddSpiritGuide(BG_IC_NPC_SPIRIT_GUIDE_1+node->nodeType-2, BG_IC_SpiritGuidePos[node->nodeType], node->faction))
+ TC_LOG_ERROR("bg.battleground", "Isle of Conquest: Failed to spawn spirit guide! point: %u, team: %u, ", node->nodeType, node->faction);
}
- switch (nodePoint->gameobject_type)
+ switch (node->gameobject_type)
{
case BG_IC_GO_HANGAR_BANNER:
{
@@ -602,7 +601,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
break;
std::list<Creature*> cannons;
- if (nodePoint->faction == TEAM_ALLIANCE)
+ if (node->faction == TEAM_ALLIANCE)
gunshipAlliance->GetCreatureListWithEntryInGrid(cannons, NPC_ALLIANCE_GUNSHIP_CANNON, 150.0f);
else
gunshipHorde->GetCreatureListWithEntryInGrid(cannons, NPC_HORDE_GUNSHIP_CANNON, 150.0f);
@@ -613,20 +612,20 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; ++u)
{
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1 + u;
- if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), BG_IC_HangarTeleporters[u], 0, 0, 0, 0, RESPAWN_ONE_DAY))
+ if (!AddObject(type, (node->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), BG_IC_HangarTeleporters[u], 0, 0, 0, 0, RESPAWN_ONE_DAY))
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a gunship portal. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
}
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTER_EFFECTS_SPAWNS; ++u)
{
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_EFFECT_1 + u;
- if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL_EFFECTS : GO_HORDE_GUNSHIP_PORTAL_EFFECTS), BG_IC_HangarTeleporterEffects[u], 0, 0, 0, 0, RESPAWN_ONE_DAY, GO_STATE_ACTIVE))
+ if (!AddObject(type, (node->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL_EFFECTS : GO_HORDE_GUNSHIP_PORTAL_EFFECTS), BG_IC_HangarTeleporterEffects[u], 0, 0, 0, 0, RESPAWN_ONE_DAY, GO_STATE_ACTIVE))
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a gunship portal effects. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
}
for (uint8 u = 0; u < MAX_TRIGGER_SPAWNS_PER_FACTION; ++u)
{
- if (!AddCreature(NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_HangarTrigger[nodePoint->faction], nodePoint->faction, RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
+ if (!AddCreature(NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_HangarTrigger[node->faction], node->faction, RESPAWN_ONE_DAY, node->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING);
}
@@ -635,24 +634,24 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
uint8 type = BG_IC_NPC_GUNSHIP_CAPTAIN_1 + u;
if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_1)
- if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0], nodePoint->faction, RESPAWN_ONE_DAY))
+ if (AddCreature(node->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[node->faction == TEAM_ALLIANCE ? 2 : 0], node->faction, RESPAWN_ONE_DAY))
GetBGCreature(BG_IC_NPC_GUNSHIP_CAPTAIN_1)->GetAI()->DoAction(ACTION_GUNSHIP_READY);
if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_2)
- if (!AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1], nodePoint->faction, RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
+ if (!AddCreature(node->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[node->faction == TEAM_ALLIANCE ? 3 : 1], node->faction, RESPAWN_ONE_DAY, node->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
TC_LOG_ERROR("bg.battleground", "Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_GUNSHIP_CAPTAIN_2);
}
- (nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->EnableMovement(true);
+ (node->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->EnableMovement(true);
break;
}
case BG_IC_GO_QUARRY_BANNER:
- RemoveAuraOnTeam(SPELL_QUARRY, (nodePoint->faction == TEAM_ALLIANCE ? HORDE : ALLIANCE));
- CastSpellOnTeam(SPELL_QUARRY, (nodePoint->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE));
+ RemoveAuraOnTeam(SPELL_QUARRY, (node->faction == TEAM_ALLIANCE ? HORDE : ALLIANCE));
+ CastSpellOnTeam(SPELL_QUARRY, (node->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE));
break;
case BG_IC_GO_REFINERY_BANNER:
- RemoveAuraOnTeam(SPELL_OIL_REFINERY, (nodePoint->faction == TEAM_ALLIANCE ? HORDE : ALLIANCE));
- CastSpellOnTeam(SPELL_OIL_REFINERY, (nodePoint->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE));
+ RemoveAuraOnTeam(SPELL_OIL_REFINERY, (node->faction == TEAM_ALLIANCE ? HORDE : ALLIANCE));
+ CastSpellOnTeam(SPELL_OIL_REFINERY, (node->faction == TEAM_ALLIANCE ? ALLIANCE : HORDE));
break;
case BG_IC_GO_DOCKS_BANNER:
if (recapture)
@@ -662,7 +661,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
docksTimer = DOCKS_UPDATE_TIME;
// we must del opposing faction vehicles when the node is captured (unused ones)
- for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_H : BG_IC_NPC_GLAIVE_THROWER_2_A); ++i)
+ for (uint8 i = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); i < (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_H : BG_IC_NPC_GLAIVE_THROWER_2_A); ++i)
{
if (Creature* glaiveThrower = GetBGCreature(i, false))
{
@@ -674,7 +673,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
}
}
- for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_H : BG_IC_NPC_CATAPULT_4_A); ++i)
+ for (uint8 i = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); i < (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_H : BG_IC_NPC_CATAPULT_4_A); ++i)
{
if (Creature* catapult = GetBGCreature(i, false))
{
@@ -689,25 +688,25 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
// spawning glaive throwers
for (uint8 i = 0; i < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; ++i)
{
- uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+i;
+ uint8 type = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+i;
if (GetBGCreature(type, false) && GetBGCreature(type)->IsAlive())
continue;
- if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_GLAIVE_THROWER_A : NPC_GLAIVE_THROWER_H, type, BG_IC_DocksVehiclesGlaives[i], nodePoint->faction, RESPAWN_ONE_DAY))
- GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
+ if (AddCreature(node->faction == TEAM_ALLIANCE ? NPC_GLAIVE_THROWER_A : NPC_GLAIVE_THROWER_H, type, BG_IC_DocksVehiclesGlaives[i], node->faction, RESPAWN_ONE_DAY))
+ GetBGCreature(type)->setFaction(BG_IC_Factions[(node->faction == TEAM_ALLIANCE ? 0 : 1)]);
}
// spawning catapults
for (uint8 i = 0; i < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++i)
{
- uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+i;
+ uint8 type = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+i;
if (GetBGCreature(type, false) && GetBGCreature(type)->IsAlive())
continue;
- if (AddCreature(NPC_CATAPULT, type, BG_IC_DocksVehiclesCatapults[i], nodePoint->faction, RESPAWN_ONE_DAY))
- GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
+ if (AddCreature(NPC_CATAPULT, type, BG_IC_DocksVehiclesCatapults[i], node->faction, RESPAWN_ONE_DAY))
+ GetBGCreature(type)->setFaction(BG_IC_Factions[(node->faction == TEAM_ALLIANCE ? 0 : 1)]);
}
break;
case BG_IC_GO_WORKSHOP_BANNER:
@@ -718,7 +717,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
if (!recapture)
{
// we must del opposing faction vehicles when the node is captured (unused ones)
- for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_H : BG_IC_NPC_DEMOLISHER_4_A); ++i)
+ for (uint8 i = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A); i < (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_H : BG_IC_NPC_DEMOLISHER_4_A); ++i)
{
if (Creature* demolisher = GetBGCreature(i, false))
{
@@ -733,17 +732,17 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
for (uint8 i = 0; i < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++i)
{
- uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+i;
+ uint8 type = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+i;
if (GetBGCreature(type, false) && GetBGCreature(type)->IsAlive())
continue;
- if (AddCreature(NPC_DEMOLISHER, type, BG_IC_WorkshopVehicles[i], nodePoint->faction, RESPAWN_ONE_DAY))
- GetBGCreature(type)->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
+ if (AddCreature(NPC_DEMOLISHER, type, BG_IC_WorkshopVehicles[i], node->faction, RESPAWN_ONE_DAY))
+ GetBGCreature(type)->setFaction(BG_IC_Factions[(node->faction == TEAM_ALLIANCE ? 0 : 1)]);
}
// we check if the opossing siege engine is in use
- int8 enemySiege = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_H : BG_IC_NPC_SIEGE_ENGINE_A);
+ int8 enemySiege = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_H : BG_IC_NPC_SIEGE_ENGINE_A);
if (Creature* siegeEngine = GetBGCreature(enemySiege, false))
{
@@ -755,16 +754,16 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
}
}
- uint8 siegeType = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
+ uint8 siegeType = (node->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
if (!GetBGCreature(siegeType, false) || !GetBGCreature(siegeType)->IsAlive())
{
- AddCreature((nodePoint->faction == TEAM_ALLIANCE ? NPC_SIEGE_ENGINE_A : NPC_SIEGE_ENGINE_H), siegeType,
- BG_IC_WorkshopVehicles[4], nodePoint->faction, RESPAWN_ONE_DAY);
+ AddCreature((node->faction == TEAM_ALLIANCE ? NPC_SIEGE_ENGINE_A : NPC_SIEGE_ENGINE_H), siegeType,
+ BG_IC_WorkshopVehicles[4], node->faction, RESPAWN_ONE_DAY);
if (Creature* siegeEngine = GetBGCreature(siegeType))
{
siegeEngine->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_UNK_14|UNIT_FLAG_IMMUNE_TO_PC);
- siegeEngine->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
+ siegeEngine->setFaction(BG_IC_Factions[(node->faction == TEAM_ALLIANCE ? 0 : 1)]);
}
}
}
@@ -779,7 +778,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
if (GameObject* seaforiumBombs = GetBGObject(BG_IC_GO_SEAFORIUM_BOMBS_1+i))
{
seaforiumBombs->SetRespawnTime(10);
- seaforiumBombs->SetFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
+ seaforiumBombs->SetFaction(BG_IC_Factions[(node->faction == TEAM_ALLIANCE ? 0 : 1)]);
}
}
break;
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
index fd47e72ed05..2578b6a459d 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h
@@ -967,7 +967,7 @@ class BattlegroundIC : public Battleground
Transport* gunshipAlliance;
Transport* gunshipHorde;
- uint32 GetNextBanner(ICNodePoint* nodePoint, uint32 team, bool returnDefinitve);
+ uint32 GetNextBanner(ICNodePoint* node, uint32 team, bool returnDefinitve);
uint32 GetGateIDFromEntry(uint32 id)
{
@@ -1012,9 +1012,9 @@ class BattlegroundIC : public Battleground
return uws;
}
- void UpdateNodeWorldState(ICNodePoint* nodePoint);
- void HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture);
- void HandleContestedNodes(ICNodePoint* nodePoint);
+ void UpdateNodeWorldState(ICNodePoint* node);
+ void HandleCapturedNodes(ICNodePoint* node, bool recapture);
+ void HandleContestedNodes(ICNodePoint* node);
};
#endif
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index ca52807afee..fc7ace9d3ac 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -23,7 +23,6 @@
#include "Player.h"
#include "ScriptedCreature.h"
#include "WorldPacket.h"
-#include "WorldSession.h"
BattlegroundSA::BattlegroundSA()
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundTP.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundTP.cpp
index e8f65c75aac..514f5189fb2 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundTP.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundTP.cpp
@@ -15,17 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Battleground.h"
#include "BattlegroundTP.h"
-#include "Creature.h"
-#include "GameObject.h"
-#include "Language.h"
-#include "Object.h"
-#include "ObjectMgr.h"
-#include "BattlegroundMgr.h"
-#include "Player.h"
-#include "World.h"
-#include "WorldPacket.h"
BattlegroundTP::BattlegroundTP()
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index be9ca9352de..b250e55bf01 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -17,14 +17,11 @@
*/
#include "BattlegroundWS.h"
-#include "Creature.h"
#include "GameObject.h"
#include "Language.h"
#include "Object.h"
-#include "ObjectMgr.h"
#include "BattlegroundMgr.h"
#include "Player.h"
-#include "World.h"
#include "WorldPacket.h"
// these variables aren't used outside of this file, so declare them only here
diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp
index d79ed707d72..82c8ced3801 100644
--- a/src/server/game/Calendar/CalendarMgr.cpp
+++ b/src/server/game/Calendar/CalendarMgr.cpp
@@ -429,7 +429,7 @@ void CalendarMgr::SendCalendarEventInvite(CalendarInvite const& invite)
uint8 level = player ? player->getLevel() : Player::GetLevelFromDB(invitee);
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE, 8 + 8 + 8 + 1 + 1 + 1 + (statusTime ? 4 : 0) + 1);
- data << invitee.WriteAsPacked();
+ data << invitee;
data << uint64(invite.GetEventId());
data << uint64(invite.GetInviteId());
data << uint8(level);
@@ -474,7 +474,7 @@ void CalendarMgr::SendCalendarEventUpdateAlert(CalendarEvent const& calendarEven
void CalendarMgr::SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
{
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_STATUS, 8 + 8 + 4 + 4 + 1 + 1 + 4);
- data << invite.GetInviteeGUID().WriteAsPacked();
+ data << invite.GetInviteeGUID();
data << uint64(calendarEvent.GetEventId());
data.AppendPackedTime(calendarEvent.GetEventTime());
data << uint32(calendarEvent.GetFlags());
@@ -498,7 +498,7 @@ void CalendarMgr::SendCalendarEventRemovedAlert(CalendarEvent const& calendarEve
void CalendarMgr::SendCalendarEventInviteRemove(CalendarEvent const& calendarEvent, CalendarInvite const& invite, uint32 flags)
{
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_REMOVED, 8 + 4 + 4 + 1);
- data << invite.GetInviteeGUID().WriteAsPacked();
+ data << invite.GetInviteeGUID();
data << uint64(invite.GetEventId());
data << uint32(flags);
data << uint8(1); // FIXME
@@ -509,7 +509,7 @@ void CalendarMgr::SendCalendarEventInviteRemove(CalendarEvent const& calendarEve
void CalendarMgr::SendCalendarEventModeratorStatusAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
{
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_MODERATOR_STATUS, 8 + 8 + 1 + 1);
- data << invite.GetInviteeGUID().WriteAsPacked();
+ data << invite.GetInviteeGUID();
data << uint64(invite.GetEventId());
data << uint8(invite.GetRank());
data << uint8(1); // Unk boolean - Display to client?
@@ -533,12 +533,12 @@ void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEven
data << uint8(invite.GetStatus());
data << uint8(invite.GetRank());
- data << calendarEvent.GetCreatorGUID().WriteAsPacked();
- data << invite.GetSenderGUID().WriteAsPacked();
+ data << calendarEvent.GetCreatorGUID();
+ data << invite.GetSenderGUID();
if (calendarEvent.IsGuildEvent() || calendarEvent.IsGuildAnnouncement())
{
- if (Guild* guild = sGuildMgr->GetGuildById(calendarEvent.GetGuildId()))
+ if (guild)
guild->BroadcastPacket(&data);
}
else
@@ -556,7 +556,7 @@ void CalendarMgr::SendCalendarEvent(ObjectGuid guid, CalendarEvent const& calend
WorldPacket data(SMSG_CALENDAR_SEND_EVENT, 60 + eventInviteeList.size() * 32);
data << uint8(sendType);
- data << calendarEvent.GetCreatorGUID().WriteAsPacked();
+ data << calendarEvent.GetCreatorGUID();
data << uint64(calendarEvent.GetEventId());
data << calendarEvent.GetTitle();
data << calendarEvent.GetDescription();
@@ -581,7 +581,7 @@ void CalendarMgr::SendCalendarEvent(ObjectGuid guid, CalendarEvent const& calend
uint8 inviteeLevel = invitee ? invitee->getLevel() : Player::GetLevelFromDB(inviteeGuid);
ObjectGuid::LowType inviteeGuildId = invitee ? invitee->GetGuildId() : Player::GetGuildIdFromDB(inviteeGuid);
- data << inviteeGuid.WriteAsPacked();
+ data << inviteeGuid;
data << uint8(inviteeLevel);
data << uint8(calendarInvite->GetStatus());
data << uint8(calendarInvite->GetRank());
diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp
index fdf0285dee6..bb6fb069055 100644
--- a/src/server/game/Chat/Channels/ChannelMgr.cpp
+++ b/src/server/game/Chat/Channels/ChannelMgr.cpp
@@ -20,7 +20,6 @@
#include "ChannelPackets.h"
#include "Player.h"
#include "World.h"
-#include "WorldSession.h"
ChannelMgr::~ChannelMgr()
{
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index 0c4c621bff2..a262ab42870 100644
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -19,7 +19,6 @@
#include "Common.h"
#include "ObjectMgr.h"
#include "World.h"
-#include "WorldPacket.h"
#include "WorldSession.h"
#include "DatabaseEnv.h"
@@ -29,13 +28,9 @@
#include "GridNotifiersImpl.h"
#include "Language.h"
#include "Log.h"
-#include "Opcodes.h"
#include "Player.h"
-#include "UpdateMask.h"
-#include "SpellMgr.h"
#include "ScriptMgr.h"
#include "ChatLink.h"
-#include "Guild.h"
#include "Group.h"
bool ChatHandler::load_command_table = true;
diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h
index 000d93683c5..d2b688b42a6 100644
--- a/src/server/game/Chat/Chat.h
+++ b/src/server/game/Chat/Chat.h
@@ -64,21 +64,21 @@ class ChatHandler
void SendSysMessage(uint32 entry);
template<typename... Args>
- void PSendSysMessage(const char* fmt, Args const&... args)
+ void PSendSysMessage(const char* fmt, Args&&... args)
{
- SendSysMessage(Trinity::StringFormat(fmt, args...).c_str());
+ SendSysMessage(Trinity::StringFormat(fmt, std::forward<Args>(args)...).c_str());
}
template<typename... Args>
- void PSendSysMessage(uint32 entry, Args const&... args)
+ void PSendSysMessage(uint32 entry, Args&&... args)
{
- SendSysMessage(PGetParseString(entry, args...).c_str());
+ SendSysMessage(PGetParseString(entry, std::forward<Args>(args)...).c_str());
}
template<typename... Args>
- std::string PGetParseString(uint32 entry, Args const&... args) const
+ std::string PGetParseString(uint32 entry, Args&&... args) const
{
- return Trinity::StringFormat(GetTrinityString(entry), args...);
+ return Trinity::StringFormat(GetTrinityString(entry), std::forward<Args>(args)...);
}
bool ParseCommands(const char* text);
diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp
index 9d5d518234a..301b0076dd3 100644
--- a/src/server/game/Chat/ChatLink.cpp
+++ b/src/server/game/Chat/ChatLink.cpp
@@ -102,8 +102,8 @@ bool ChatLink::ValidateName(char* buffer, const char* /*context*/)
return true;
}
-// |color|Hitem:item_id:perm_ench_id:gem1:gem2:gem3:0:random_property:0:reporter_level|h[name]|h|r
-// |cffa335ee|Hitem:812:0:0:0:0:0:0:0:70|h[Glowing Brightwood Staff]|h|r
+// |color|Hitem:item_id:perm_ench_id:gem1:gem2:gem3:0:random_property:property_seed:reporter_level:upgrade_id:context:numBonusListIDs|h[name]|h|r
+// |cffa335ee|Hitem:124382:0:0:0:0:0:0:0:0:0:0:0:4:42:562:565:567|h[Edict of Argus]|h|r");
bool ItemChatLink::Initialize(std::istringstream& iss)
{
// Read item entry
@@ -113,6 +113,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item entry", iss.str().c_str());
return false;
}
+
// Validate item
_item = sObjectMgr->GetItemTemplate(itemEntry);
if (!_item)
@@ -120,15 +121,23 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid itemEntry %u in |item command", iss.str().c_str(), itemEntry);
return false;
}
+
// Validate item's color
- if (_color != ItemQualityColors[_item->GetQuality()])
+ uint32 colorQuality = _item->GetQuality();
+ if (_item->GetFlags3() & ITEM_FLAG3_HEIRLOOM_QUALITY)
+ colorQuality = ITEM_QUALITY_HEIRLOOM;
+
+ if (_color != ItemQualityColors[colorQuality])
{
- TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[_item->GetQuality()], _color);
+ TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): linked item has color %u, but user claims %u", iss.str().c_str(), ItemQualityColors[colorQuality], _color);
return false;
}
+
// Number of various item properties after item entry
- const uint8 propsCount = 8;
- const uint8 randomPropertyPosition = 5;
+ uint8 const propsCount = 11;
+ uint8 const randomPropertyPosition = 5;
+ uint8 const numBonusListIDsPosition = 10;
+ uint8 const maxBonusListIDs = 100;
for (uint8 index = 0; index < propsCount; ++index)
{
if (!CheckDelimiter(iss, DELIMITER, "item"))
@@ -162,8 +171,41 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
}
}
}
+ if (index == numBonusListIDsPosition)
+ {
+ if (id > maxBonusListIDs)
+ {
+ TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): too many item bonus list IDs %u in |item command", iss.str().c_str(), id);
+ return false;
+ }
+
+ _bonusListIDs.resize(id);
+ }
+
_data[index] = id;
}
+
+ for (uint32 index = 0; index < _bonusListIDs.size(); ++index)
+ {
+ if (!CheckDelimiter(iss, DELIMITER, "item"))
+ return false;
+
+ int32 id = 0;
+ if (!ReadInt32(iss, id))
+ {
+ TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): sequence finished unexpectedly while reading item bonus list id (%u)", iss.str().c_str(), index);
+ return false;
+ }
+
+ if (!sDB2Manager.GetItemBonusList(id))
+ {
+ TC_LOG_TRACE("chat.system", "ChatHandler::isValidChatMessage('%s'): got invalid item bonus list id %d in |item command", iss.str().c_str(), id);
+ return false;
+ }
+
+ _bonusListIDs[index] = id;
+ }
+
return true;
}
diff --git a/src/server/game/Chat/ChatLink.h b/src/server/game/Chat/ChatLink.h
index 83a8d2425bb..2a463e36e39 100644
--- a/src/server/game/Chat/ChatLink.h
+++ b/src/server/game/Chat/ChatLink.h
@@ -69,7 +69,8 @@ protected:
std::string FormatName(uint8 index, LocalizedString* suffixStrings) const;
ItemTemplate const* _item;
- int32 _data[8];
+ int32 _data[11];
+ std::vector<int32> _bonusListIDs;
ItemRandomSuffixEntry const* _suffix;
ItemRandomPropertiesEntry const* _property;
};
diff --git a/src/server/game/Combat/HostileRefManager.cpp b/src/server/game/Combat/HostileRefManager.cpp
index 40aa6ccfad1..6dfb95d7979 100644
--- a/src/server/game/Combat/HostileRefManager.cpp
+++ b/src/server/game/Combat/HostileRefManager.cpp
@@ -20,7 +20,6 @@
#include "ThreatManager.h"
#include "Unit.h"
#include "DBCStructure.h"
-#include "SpellMgr.h"
#include "SpellInfo.h"
HostileRefManager::~HostileRefManager()
diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp
index 18ead47c490..18cb93fcf69 100644
--- a/src/server/game/Combat/ThreatManager.cpp
+++ b/src/server/game/Combat/ThreatManager.cpp
@@ -19,7 +19,6 @@
#include "ThreatManager.h"
#include "Unit.h"
#include "Creature.h"
-#include "CreatureAI.h"
#include "Map.h"
#include "Player.h"
#include "ObjectAccessor.h"
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index c8ccc15019d..7cae9ee2221 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -27,7 +27,6 @@
#include "ScriptMgr.h"
#include "SpellAuras.h"
#include "SpellMgr.h"
-#include "Spell.h"
char const* ConditionMgr::StaticSourceTypeData[CONDITION_SOURCE_TYPE_MAX] =
{
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp
index 5e9344f10b0..5233af5abc9 100644
--- a/src/server/game/DataStores/DB2Stores.cpp
+++ b/src/server/game/DataStores/DB2Stores.cpp
@@ -23,7 +23,6 @@
#include "Log.h"
#include "TransportMgr.h"
#include "World.h"
-#include <functional>
DB2Storage<AreaGroupEntry> sAreaGroupStore("AreaGroup.db2", AreaGroupFormat, HOTFIX_SEL_AREA_GROUP);
DB2Storage<AreaGroupMemberEntry> sAreaGroupMemberStore("AreaGroupMember.db2", AreaGroupMemberFormat, HOTFIX_SEL_AREA_GROUP_MEMBER);
@@ -611,13 +610,13 @@ uint32 DB2Manager::GetHeirloomItemLevel(uint32 curveId, uint32 level) const
return uint32(previousItr->second->Y); // Lowest scaling point
}
-DB2Manager::ItemBonusList DB2Manager::GetItemBonusList(uint32 bonusListId) const
+DB2Manager::ItemBonusList const* DB2Manager::GetItemBonusList(uint32 bonusListId) const
{
auto itr = _itemBonusLists.find(bonusListId);
if (itr != _itemBonusLists.end())
- return itr->second;
+ return &itr->second;
- return ItemBonusList();
+ return nullptr;
}
std::set<uint32> DB2Manager::GetItemBonusTree(uint32 itemId, uint32 itemBonusTreeMod) const
diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h
index b99a5f75309..59931769c4a 100644
--- a/src/server/game/DataStores/DB2Stores.h
+++ b/src/server/game/DataStores/DB2Stores.h
@@ -166,7 +166,7 @@ public:
uint32 GetPowerIndexByClass(uint32 powerType, uint32 classId) const;
GlyphSlotContainer const& GetGlyphSlots() const { return _glyphSlots; }
uint32 GetHeirloomItemLevel(uint32 curveId, uint32 level) const;
- ItemBonusList GetItemBonusList(uint32 bonusListId) const;
+ ItemBonusList const* GetItemBonusList(uint32 bonusListId) const;
std::set<uint32> GetItemBonusTree(uint32 itemId, uint32 itemBonusTreeMod) const;
uint32 GetItemDisplayId(uint32 itemId, uint32 appearanceModId) const;
std::vector<ItemSpecOverrideEntry const*> const* GetItemSpecOverrides(uint32 itemId) const;
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 64cd5ed3c0e..f819341a04a 100644
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -17,15 +17,11 @@
*/
#include "DBCStores.h"
-#include "Containers.h"
#include "Log.h"
#include "SharedDefines.h"
#include "SpellInfo.h"
-#include "SpellMgr.h"
#include "DBCfmt.h"
-#include "ItemTemplate.h"
#include "Timer.h"
-#include "ObjectDefines.h"
#include "DB2Stores.h"
#include <map>
@@ -270,9 +266,9 @@ inline void LoadGameTable(StoreProblemList& errors, std::string const& tableName
if (!gt)
continue;
- for (uint32 i = 0; i < TOTAL_LOCALES; ++i)
+ for (uint32 l = 0; l < TOTAL_LOCALES; ++l)
{
- if (tableName == gt->Name->Str[i])
+ if (tableName == gt->Name->Str[l])
{
found = true;
storage.SetGameTableEntry(gt);
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index ba21168086e..0c89465fc60 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -21,7 +21,6 @@
#include "DisableMgr.h"
#include "ObjectMgr.h"
#include "SocialMgr.h"
-#include "Language.h"
#include "LFGMgr.h"
#include "LFGScripts.h"
#include "LFGGroupData.h"
diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp
index 30e9a587353..20aeaa4ea6e 100644
--- a/src/server/game/DungeonFinding/LFGQueue.cpp
+++ b/src/server/game/DungeonFinding/LFGQueue.cpp
@@ -23,9 +23,6 @@
#include "LFGQueue.h"
#include "LFGMgr.h"
#include "Log.h"
-#include "ObjectMgr.h"
-#include "World.h"
-#include "GroupMgr.h"
namespace lfg
{
diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp
index 15e560a8e7e..1265a82f89d 100644
--- a/src/server/game/Entities/Corpse/Corpse.cpp
+++ b/src/server/game/Entities/Corpse/Corpse.cpp
@@ -22,9 +22,6 @@
#include "UpdateMask.h"
#include "ObjectAccessor.h"
#include "DatabaseEnv.h"
-#include "Opcodes.h"
-#include "GossipDef.h"
-#include "World.h"
Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES), m_type(type)
{
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 81b29cdd400..c1e7ec2fa6c 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -34,12 +34,7 @@
#include "InstanceScript.h"
#include "Log.h"
#include "LootMgr.h"
-#include "MapManager.h"
-#include "MoveSpline.h"
-#include "MoveSplineInit.h"
#include "ObjectMgr.h"
-#include "Opcodes.h"
-#include "OutdoorPvPMgr.h"
#include "Player.h"
#include "PoolMgr.h"
#include "QuestDef.h"
@@ -48,7 +43,6 @@
#include "TemporarySummon.h"
#include "Util.h"
#include "Vehicle.h"
-#include "WaypointMovementGenerator.h"
#include "World.h"
#include "WorldPacket.h"
#include "CombatPackets.h"
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 17cef733e6c..0683725cab8 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -494,7 +494,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
bool CanFly() const override { return (GetCreatureTemplate()->InhabitType & INHABIT_AIR) != 0; }
void SetReactState(ReactStates st) { m_reactState = st; }
- ReactStates GetReactState() { return m_reactState; }
+ ReactStates GetReactState() const { return m_reactState; }
bool HasReactState(ReactStates state) const { return (m_reactState == state); }
void InitializeReactState();
@@ -538,7 +538,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
void SetCanDualWield(bool value) override;
int8 GetOriginalEquipmentId() const { return m_originalEquipmentId; }
- uint8 GetCurrentEquipmentId() { return m_equipmentId; }
+ uint8 GetCurrentEquipmentId() const { return m_equipmentId; }
void SetCurrentEquipmentId(uint8 id) { m_equipmentId = id; }
float GetSpellDamageMod(int32 Rank) const;
@@ -583,7 +583,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
void SetLootRecipient (Unit* unit);
void AllLootRemovedFromCorpse();
- uint16 GetLootMode() { return m_LootMode; }
+ uint16 GetLootMode() const { return m_LootMode; }
bool HasLootMode(uint16 lootMode) { return (m_LootMode & lootMode) != 0; }
void SetLootMode(uint16 lootMode) { m_LootMode = lootMode; }
void AddLootMode(uint16 lootMode) { m_LootMode |= lootMode; }
@@ -611,7 +611,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
void CallAssistance();
void SetNoCallAssistance(bool val) { m_AlreadyCallAssistance = val; }
void SetNoSearchAssistance(bool val) { m_AlreadySearchedAssistance = val; }
- bool HasSearchedAssistance() { return m_AlreadySearchedAssistance; }
+ bool HasSearchedAssistance() const { return m_AlreadySearchedAssistance; }
bool CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction = true) const;
bool _IsTargetAcceptable(const Unit* target) const;
@@ -675,7 +675,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapObject
Unit* SelectVictim();
void SetDisableReputationGain(bool disable) { DisableReputationGain = disable; }
- bool IsReputationGainDisabled() { return DisableReputationGain; }
+ bool IsReputationGainDisabled() const { return DisableReputationGain; }
bool IsDamageEnoughForLootingAndReward() const { return m_PlayerDamageReq == 0; }
void LowerPlayerDamageReq(uint32 unDamage);
void ResetPlayerDamageReq() { m_PlayerDamageReq = GetHealth() / 2; }
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index 0fd001de69f..ec1e7050732 100644
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
@@ -19,13 +19,10 @@
#include "QuestDef.h"
#include "GossipDef.h"
#include "ObjectMgr.h"
-#include "Opcodes.h"
-#include "WorldPacket.h"
#include "WorldSession.h"
#include "Formulas.h"
#include "QuestPackets.h"
#include "NPCPackets.h"
-#include "WorldPacket.h"
GossipMenu::GossipMenu()
{
diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h
index 378061d2905..83778b66191 100644
--- a/src/server/game/Entities/Creature/TemporarySummon.h
+++ b/src/server/game/Entities/Creature/TemporarySummon.h
@@ -53,7 +53,7 @@ class TempSummon : public Creature
Creature* GetSummonerCreatureBase() const;
ObjectGuid GetSummonerGUID() const { return m_summonerGUID; }
TempSummonType const& GetSummonType() { return m_type; }
- uint32 GetTimer() { return m_timer; }
+ uint32 GetTimer() const { return m_timer; }
const SummonPropertiesEntry* const m_Properties;
private:
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
index a90d2832de9..b22eb8739eb 100644
--- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
@@ -23,7 +23,6 @@
#include "ObjectAccessor.h"
#include "DatabaseEnv.h"
#include "GridNotifiers.h"
-#include "CellImpl.h"
#include "GridNotifiersImpl.h"
#include "ScriptMgr.h"
#include "Transport.h"
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index dc00a7ead69..ac2ab48c242 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -20,7 +20,6 @@
#include "Battleground.h"
#include "CellImpl.h"
#include "CreatureAISelector.h"
-#include "DynamicTree.h"
#include "GameObjectModel.h"
#include "GameObjectPackets.h"
#include "GridNotifiersImpl.h"
@@ -35,7 +34,6 @@
#include "UpdateFieldFlags.h"
#include "World.h"
#include "Transport.h"
-#include <G3D/Quat.h>
GameObject::GameObject() : WorldObject(false), MapObject(),
m_model(NULL), m_goValue(), m_AI(NULL)
@@ -235,7 +233,7 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u
SetDisplayId(goinfo->displayId);
- m_model = GameObjectModel::Create(*this);
+ m_model = CreateModel();
// GAMEOBJECT_BYTES_1, index at 0, 1, 2 and 3
SetGoType(GameobjectTypes(goinfo->type));
SetGoState(go_state);
@@ -2212,7 +2210,7 @@ void GameObject::UpdateModel()
if (GetMap()->ContainsGameObjectModel(*m_model))
GetMap()->RemoveGameObjectModel(*m_model);
delete m_model;
- m_model = GameObjectModel::Create(*this);
+ m_model = CreateModel();
if (m_model)
GetMap()->InsertGameObjectModel(*m_model);
}
@@ -2338,12 +2336,12 @@ void GameObject::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* t
}
else if (index == GAMEOBJECT_FLAGS)
{
- uint32 flags = m_uint32Values[GAMEOBJECT_FLAGS];
+ uint32 goFlags = m_uint32Values[GAMEOBJECT_FLAGS];
if (GetGoType() == GAMEOBJECT_TYPE_CHEST)
if (GetGOInfo()->chest.usegrouplootrules && !IsLootAllowedFor(target))
- flags |= GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE;
+ goFlags |= GO_FLAG_LOCKED | GO_FLAG_NOT_SELECTABLE;
- fieldBuffer << flags;
+ fieldBuffer << goFlags;
}
else if (index == GAMEOBJECT_LEVEL)
{
@@ -2427,3 +2425,25 @@ void GameObject::UpdateModelPosition()
GetMap()->InsertGameObjectModel(*m_model);
}
}
+
+class GameObjectModelOwnerImpl : public GameObjectModelOwnerBase
+{
+public:
+ explicit GameObjectModelOwnerImpl(GameObject const* owner) : _owner(owner) { }
+
+ virtual bool IsSpawned() const override { return _owner->isSpawned(); }
+ virtual uint32 GetDisplayId() const override { return _owner->GetDisplayId(); }
+ virtual uint32 GetPhaseMask() const override { return _owner->GetPhaseMask(); }
+ virtual G3D::Vector3 GetPosition() const override { return G3D::Vector3(_owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ()); }
+ virtual float GetOrientation() const override { return _owner->GetOrientation(); }
+ virtual float GetScale() const override { return _owner->GetObjectScale(); }
+ virtual void DebugVisualizeCorner(G3D::Vector3 const& corner) const override { _owner->SummonCreature(1, corner.x, corner.y, corner.z, 0, TEMPSUMMON_MANUAL_DESPAWN); }
+
+private:
+ GameObject const* _owner;
+};
+
+GameObjectModel* GameObject::CreateModel()
+{
+ return GameObjectModel::Create(Trinity::make_unique<GameObjectModelOwnerImpl>(this), sWorld->GetDataPath());
+}
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index c00cbe1d350..53c52f9ec5b 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -804,6 +804,7 @@ struct GameObjectLocale
{
StringVector Name;
StringVector CastBarCaption;
+ StringVector Unk1;
};
// `gameobject_addon` table
@@ -981,8 +982,8 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
// Note: unit is only used when s = GO_ACTIVATED
void SetLootState(LootState s, Unit* unit = NULL);
- uint16 GetLootMode() { return m_LootMode; }
- bool HasLootMode(uint16 lootMode) { return (m_LootMode & lootMode) != 0; }
+ uint16 GetLootMode() const { return m_LootMode; }
+ bool HasLootMode(uint16 lootMode) const { return (m_LootMode & lootMode) != 0; }
void SetLootMode(uint16 lootMode) { m_LootMode = lootMode; }
void AddLootMode(uint16 lootMode) { m_LootMode |= lootMode; }
void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
@@ -1084,6 +1085,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
protected:
bool AIM_Initialize();
+ GameObjectModel* CreateModel();
void UpdateModel(); // updates model in case displayId were changed
uint32 m_spellId;
time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()),
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 7250c0cff23..70d63a853e7 100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -1792,10 +1792,12 @@ uint32 Item::GetVisibleAppearanceModId() const
void Item::AddBonuses(uint32 bonusListID)
{
- DB2Manager::ItemBonusList bonuses = sDB2Manager.GetItemBonusList(bonusListID);
- AddDynamicValue(ITEM_DYNAMIC_FIELD_BONUSLIST_IDS, bonusListID);
- for (ItemBonusEntry const* bonus : bonuses)
- _bonusData.AddBonus(bonus->Type, bonus->Value);
+ if (DB2Manager::ItemBonusList const* bonuses = sDB2Manager.GetItemBonusList(bonusListID))
+ {
+ AddDynamicValue(ITEM_DYNAMIC_FIELD_BONUSLIST_IDS, bonusListID);
+ for (ItemBonusEntry const* bonus : *bonuses)
+ _bonusData.AddBonus(bonus->Type, bonus->Value);
+ }
}
void BonusData::Initialize(ItemTemplate const* proto)
diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
index 1c0a64c17da..531dd136c1f 100644
--- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
+++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp
@@ -16,17 +16,17 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <stdlib.h>
-#include <functional>
#include "ItemEnchantmentMgr.h"
#include "DatabaseEnv.h"
#include "Log.h"
#include "ObjectMgr.h"
-#include <list>
-#include <vector>
#include "Util.h"
#include "DBCStores.h"
+#include <list>
+#include <vector>
+#include <stdlib.h>
+
struct EnchStoreItem
{
uint32 ench;
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index efe4303c961..95a2485bc7a 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -30,12 +30,8 @@
#include "UpdateData.h"
#include "UpdateMask.h"
#include "Util.h"
-#include "MapManager.h"
#include "ObjectAccessor.h"
-#include "Log.h"
#include "Transport.h"
-#include "TargetedMovementGenerator.h"
-#include "WaypointMovementGenerator.h"
#include "VMapFactory.h"
#include "CellImpl.h"
#include "GridNotifiers.h"
@@ -46,12 +42,8 @@
#include "Totem.h"
#include "MovementPackets.h"
#include "OutdoorPvPMgr.h"
-#include "DynamicTree.h"
#include "Unit.h"
-#include "Group.h"
#include "BattlefieldMgr.h"
-#include "Battleground.h"
-#include "Chat.h"
#include "GameObjectPackets.h"
#include "MiscPackets.h"
@@ -1944,7 +1936,7 @@ float WorldObject::GetSightRange(const WorldObject* target) const
return 0.0f;
}
-bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, bool distanceCheck) const
+bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, bool distanceCheck, bool checkAlert) const
{
if (this == obj)
return true;
@@ -2016,7 +2008,7 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
if (obj->IsInvisibleDueToDespawn())
return false;
- if (!CanDetect(obj, ignoreStealth))
+ if (!CanDetect(obj, ignoreStealth, checkAlert))
return false;
return true;
@@ -2027,7 +2019,7 @@ bool WorldObject::CanNeverSee(WorldObject const* obj) const
return GetMap() != obj->GetMap() || !IsInPhase(obj);
}
-bool WorldObject::CanDetect(WorldObject const* obj, bool ignoreStealth) const
+bool WorldObject::CanDetect(WorldObject const* obj, bool ignoreStealth, bool checkAlert) const
{
const WorldObject* seer = this;
@@ -2042,7 +2034,7 @@ bool WorldObject::CanDetect(WorldObject const* obj, bool ignoreStealth) const
if (!ignoreStealth && !seer->CanDetectInvisibilityOf(obj))
return false;
- if (!ignoreStealth && !seer->CanDetectStealthOf(obj))
+ if (!ignoreStealth && !seer->CanDetectStealthOf(obj, checkAlert))
return false;
return true;
@@ -2072,7 +2064,7 @@ bool WorldObject::CanDetectInvisibilityOf(WorldObject const* obj) const
return true;
}
-bool WorldObject::CanDetectStealthOf(WorldObject const* obj) const
+bool WorldObject::CanDetectStealthOf(WorldObject const* obj, bool checkAlert) const
{
// Combat reach is the minimal distance (both in front and behind),
// and it is also used in the range calculation.
@@ -2122,9 +2114,19 @@ bool WorldObject::CanDetectStealthOf(WorldObject const* obj) const
// Calculate max distance
float visibilityRange = float(detectionValue) * 0.3f + combatReach;
- if (visibilityRange > MAX_PLAYER_STEALTH_DETECT_RANGE)
+ // If this unit is an NPC then player detect range doesn't apply
+ if (unit && unit->GetTypeId() == TYPEID_PLAYER && visibilityRange > MAX_PLAYER_STEALTH_DETECT_RANGE)
visibilityRange = MAX_PLAYER_STEALTH_DETECT_RANGE;
+ // When checking for alert state, look 8% further, and then 1.5 yards more than that.
+ if (checkAlert)
+ visibilityRange += (visibilityRange * 0.08f) + 1.5f;
+
+ // If checking for alert, and creature's visibility range is greater than aggro distance, No alert
+ Unit const* tunit = obj->ToUnit();
+ if (checkAlert && unit && unit->ToCreature() && visibilityRange >= unit->ToCreature()->GetAttackDistance(tunit) + unit->ToCreature()->m_CombatDistance)
+ return false;
+
if (distance > visibilityRange)
return false;
}
@@ -2857,8 +2859,8 @@ void WorldObject::UpdateAreaPhase()
{
bool up = false;
uint32 phaseGroup = uint32((*itr)->GetMiscValueB());
- std::set<uint32> const& phases = sDB2Manager.GetPhasesForGroup(phaseGroup);
- for (uint32 phase : phases)
+ std::set<uint32> const& phaseIDs = sDB2Manager.GetPhasesForGroup(phaseGroup);
+ for (uint32 phase : phaseIDs)
up = SetInPhase(phase, false, true);
if (!updateNeeded && up)
updateNeeded = true;
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index b9a6320a835..9be3dddf456 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -336,7 +336,7 @@ struct MovementInfo
bool HasExtraMovementFlag(uint16 flag) const { return (flags2 & flag) != 0; }
uint32 GetFallTime() const { return jump.fallTime; }
- void SetFallTime(uint32 time) { jump.fallTime = time; }
+ void SetFallTime(uint32 fallTime) { jump.fallTime = fallTime; }
void ResetTransport()
{
@@ -498,7 +498,7 @@ class WorldObject : public Object, public WorldLocation
std::set<uint32> const& GetPhases() const { return _phases; }
std::set<uint32> const& GetTerrainSwaps() const { return _terrainSwaps; }
std::set<uint32> const& GetWorldMapAreaSwaps() const { return _worldMapAreaSwaps; }
- int32 GetDBPhase() { return _dbPhase; }
+ int32 GetDBPhase() const { return _dbPhase; }
// if negative it is used as PhaseGroupId
void SetDBPhase(int32 p) { _dbPhase = p; }
@@ -560,7 +560,7 @@ class WorldObject : public Object, public WorldLocation
float GetGridActivationRange() const;
float GetVisibilityRange() const;
float GetSightRange(WorldObject const* target = NULL) const;
- bool CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth = false, bool distanceCheck = false) const;
+ bool CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth = false, bool distanceCheck = false, bool checkAlert = false) const;
FlaggedValuesArray32<int32, uint32, StealthType, TOTAL_STEALTH_TYPES> m_stealth;
FlaggedValuesArray32<int32, uint32, StealthType, TOTAL_STEALTH_TYPES> m_stealthDetect;
@@ -693,9 +693,9 @@ class WorldObject : public Object, public WorldLocation
bool CanNeverSee(WorldObject const* obj) const;
virtual bool CanAlwaysSee(WorldObject const* /*obj*/) const { return false; }
- bool CanDetect(WorldObject const* obj, bool ignoreStealth) const;
+ bool CanDetect(WorldObject const* obj, bool ignoreStealth, bool checkAlert = false) const;
bool CanDetectInvisibilityOf(WorldObject const* obj) const;
- bool CanDetectStealthOf(WorldObject const* obj) const;
+ bool CanDetectStealthOf(WorldObject const* obj, bool checkAlert = false) const;
uint16 m_aiAnimKitId;
uint16 m_movementAnimKitId;
diff --git a/src/server/game/Entities/Object/ObjectGuid.cpp b/src/server/game/Entities/Object/ObjectGuid.cpp
index 4d607e59d1b..05ef5d7dc32 100644
--- a/src/server/game/Entities/Object/ObjectGuid.cpp
+++ b/src/server/game/Entities/Object/ObjectGuid.cpp
@@ -18,7 +18,7 @@
#include "ObjectGuid.h"
#include "World.h"
-#include "ObjectMgr.h"
+
#include <sstream>
#include <iomanip>
@@ -121,31 +121,37 @@ void ObjectGuid::SetRawValue(std::vector<uint8> const& guid)
void PackedGuid::Set(ObjectGuid const& guid)
{
+ _packedGuid.clear();
+ _packedGuid << guid;
+}
+
+ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid)
+{
uint8 lowMask = 0;
uint8 highMask = 0;
- _packedGuid.clear();
- _packedGuid << uint8(lowMask);
- _packedGuid << uint8(highMask);
+ buf.FlushBits(); // flush any unwritten bits to make wpos return a meaningful value
+ std::size_t pos = buf.wpos();
+ buf << uint8(lowMask);
+ buf << uint8(highMask);
uint8 packed[8];
- if (size_t packedSize = _packedGuid.PackUInt64(guid._low, &lowMask, packed))
- _packedGuid.append(packed, packedSize);
- if (size_t packedSize = _packedGuid.PackUInt64(guid._high, &highMask, packed))
- _packedGuid.append(packed, packedSize);
+ if (size_t packedSize = ByteBuffer::PackUInt64(guid._low, &lowMask, packed))
+ buf.append(packed, packedSize);
+ if (size_t packedSize = ByteBuffer::PackUInt64(guid._high, &highMask, packed))
+ buf.append(packed, packedSize);
- _packedGuid.put(0, lowMask);
- _packedGuid.put(1, highMask);
-}
+ buf.put(pos, lowMask);
+ buf.put(pos + 1, highMask);
-ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid)
-{
- buf << guid.WriteAsPacked();
return buf;
}
ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid)
{
- buf >> guid.ReadAsPacked();
+ uint8 lowMask, highMask;
+ buf >> lowMask >> highMask;
+ buf.ReadPackedUInt64(lowMask, guid._low);
+ buf.ReadPackedUInt64(highMask, guid._high);
return buf;
}
@@ -155,15 +161,6 @@ ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid)
return buf;
}
-ByteBuffer& operator>>(ByteBuffer& buf, PackedGuidReader const& guid)
-{
- uint8 lowMask, highMask;
- buf >> lowMask >> highMask;
- buf.ReadPackedUInt64(lowMask, guid.GuidPtr->_low);
- buf.ReadPackedUInt64(highMask, guid.GuidPtr->_high);
- return buf;
-}
-
std::ostream& operator<<(std::ostream& stream, ObjectGuid const& guid)
{
std::ostringstream tmp;
diff --git a/src/server/game/Entities/Object/ObjectGuid.h b/src/server/game/Entities/Object/ObjectGuid.h
index 281bc170c3a..23d6b4f4dde 100644
--- a/src/server/game/Entities/Object/ObjectGuid.h
+++ b/src/server/game/Entities/Object/ObjectGuid.h
@@ -180,19 +180,13 @@ GUID_TRAIT_MAP_SPECIFIC(HighGuid::AILockTicket)
class ObjectGuid;
class PackedGuid;
-struct PackedGuidReader
-{
- explicit PackedGuidReader(ObjectGuid& guid) : GuidPtr(&guid) { }
- ObjectGuid* GuidPtr;
-};
-
#pragma pack(push, 1)
class ObjectGuid
{
friend std::ostream& operator<<(std::ostream& stream, ObjectGuid const& guid);
- friend ByteBuffer& operator>>(ByteBuffer& buf, PackedGuidReader const& guid);
- friend class PackedGuid;
+ friend ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid);
+ friend ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid);
public:
static ObjectGuid const Empty;
@@ -212,15 +206,11 @@ class ObjectGuid
ObjectGuid() : _low(0), _high(0) { }
ObjectGuid(ObjectGuid const&) = default;
- PackedGuidReader ReadAsPacked() { return PackedGuidReader(*this); }
-
std::vector<uint8> GetRawValue() const;
void SetRawValue(std::vector<uint8> const& guid);
void SetRawValue(uint64 high, uint64 low) { _high = high; _low = low; }
void Clear() { _high = 0; _low = 0; }
- PackedGuid WriteAsPacked() const;
-
HighGuid GetHigh() const { return HighGuid((_high >> 58) & 0x3F); }
uint32 GetRealmId() const { return uint32((_high >> 42) & 0x1FFF); }
uint32 GetMapId() const { return uint32((_high >> 29) & 0x1FFF); }
@@ -393,12 +383,9 @@ ByteBuffer& operator<<(ByteBuffer& buf, ObjectGuid const& guid);
ByteBuffer& operator>>(ByteBuffer& buf, ObjectGuid& guid);
ByteBuffer& operator<<(ByteBuffer& buf, PackedGuid const& guid);
-ByteBuffer& operator>>(ByteBuffer& buf, PackedGuidReader const& guid);
std::ostream& operator<<(std::ostream& stream, ObjectGuid const& guid);
-inline PackedGuid ObjectGuid::WriteAsPacked() const { return PackedGuid(*this); }
-
namespace std
{
template<>
diff --git a/src/server/game/Entities/Object/Position.cpp b/src/server/game/Entities/Object/Position.cpp
index 530e51cd8f5..8f8e5743f8c 100644
--- a/src/server/game/Entities/Object/Position.cpp
+++ b/src/server/game/Entities/Object/Position.cpp
@@ -17,9 +17,10 @@
#include "Position.h"
#include "ByteBuffer.h"
-#include "G3D/g3dmath.h"
#include "GridDefines.h"
+#include <G3D/g3dmath.h>
+
bool Position::operator==(Position const &a)
{
return (G3D::fuzzyEq(a.m_positionX, m_positionX) &&
diff --git a/src/server/game/Entities/Object/Updates/UpdateData.cpp b/src/server/game/Entities/Object/Updates/UpdateData.cpp
index 98c3c428b6e..54c915a640b 100644
--- a/src/server/game/Entities/Object/Updates/UpdateData.cpp
+++ b/src/server/game/Entities/Object/Updates/UpdateData.cpp
@@ -20,9 +20,7 @@
#include "ByteBuffer.h"
#include "WorldPacket.h"
#include "UpdateData.h"
-#include "Log.h"
#include "Opcodes.h"
-#include "World.h"
UpdateData::UpdateData(uint32 map) : m_map(map), m_blockCount(0) { }
@@ -56,7 +54,7 @@ bool UpdateData::BuildPacket(WorldPacket* packet)
*packet << uint32(m_outOfRangeGUIDs.size());
for (GuidSet::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i)
- *packet << i->WriteAsPacked();
+ *packet << *i;
}
*packet << uint32(m_data.size());
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 3f83915c141..7e7e41703c7 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -24,11 +24,9 @@
#include "ObjectMgr.h"
#include "SpellMgr.h"
#include "Pet.h"
-#include "Formulas.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
-#include "CreatureAI.h"
#include "Unit.h"
#include "Util.h"
#include "Group.h"
@@ -344,10 +342,10 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
if (getPetType() == HUNTER_PET)
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_DECLINED_NAME);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_DECLINED_NAME);
stmt->setUInt64(0, owner->GetGUID().GetCounter());
stmt->setUInt32(1, GetCharmInfo()->GetPetNumber());
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
+ result = CharacterDatabase.Query(stmt);
if (result)
{
@@ -1718,7 +1716,7 @@ void Pet::InitTalentForLevel()
*/
}
-uint8 Pet::GetMaxTalentPointsForLevel(uint8 level)
+uint8 Pet::GetMaxTalentPointsForLevel(uint8 level) const
{
uint8 points = (level >= 20) ? ((level - 16) / 4) : 0;
// Mod points from owner SPELL_AURA_MOD_PET_TALENT_POINTS
@@ -1909,14 +1907,8 @@ void Pet::SynchronizeLevelWithOwner()
{
// always same level
case SUMMON_PET:
- GivePetLevel(owner->getLevel());
- break;
- // can't be greater owner level
case HUNTER_PET:
- if (getLevel() > owner->getLevel())
- GivePetLevel(owner->getLevel());
- else if (getLevel() + 5 < owner->getLevel())
- GivePetLevel(owner->getLevel() - 5);
+ GivePetLevel(owner->getLevel());
break;
default:
break;
diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h
index 70f14fbd7ca..23931338c4f 100644
--- a/src/server/game/Entities/Pet/Pet.h
+++ b/src/server/game/Entities/Pet/Pet.h
@@ -128,8 +128,8 @@ class Pet : public Guardian
static void resetTalentsForAllPetsOf(Player* owner, Pet* online_pet = nullptr);
void InitTalentForLevel();
- uint8 GetMaxTalentPointsForLevel(uint8 level);
- uint8 GetFreeTalentPoints() { return GetByteValue(UNIT_FIELD_BYTES_1, 1); }
+ uint8 GetMaxTalentPointsForLevel(uint8 level) const;
+ uint8 GetFreeTalentPoints() const { return GetByteValue(UNIT_FIELD_BYTES_1, 1); }
void SetFreeTalentPoints(uint8 points) { SetByteValue(UNIT_FIELD_BYTES_1, 1, points); }
uint32 m_usedTalentCount;
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 6bdac08d7c3..3905ae7ae67 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -92,7 +92,6 @@
#include "UpdateFieldFlags.h"
#include "UpdateMask.h"
#include "Util.h"
-#include "Vehicle.h"
#include "VehiclePackets.h"
#include "Weather.h"
#include "WeatherMgr.h"
@@ -100,7 +99,6 @@
#include "WorldPacket.h"
#include "WorldSession.h"
#include "WorldStatePackets.h"
-#include "InstancePackets.h"
#define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS)
@@ -890,6 +888,9 @@ Player::Player(WorldSession* session): Unit(true)
m_achievementMgr = new AchievementMgr<Player>(this);
m_reputationMgr = new ReputationMgr(this);
+
+ for (uint8 i = 0; i < MAX_CUF_PROFILES; ++i)
+ _CUFProfiles[i] = nullptr;
}
Player::~Player()
@@ -3093,6 +3094,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, 0);
SetFloatValue(PLAYER_FIELD_MOD_HEALING_PCT, 1.0f);
SetFloatValue(PLAYER_FIELD_MOD_HEALING_DONE_PCT, 1.0f);
+ SetFloatValue(PLAYER_FIELD_MOD_PERIODIC_HEALING_DONE_PERCENT, 1.0f);
for (uint8 i = 0; i < 7; ++i)
{
SetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+i, 0);
@@ -3113,7 +3115,11 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE, 0.0f);
SetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE, 0.0f);
SetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE, 0.0f);
- SetFloatValue(PLAYER_FIELD_WEAPON_DMG_MULTIPLIERS, 1.0f);
+ for (uint16 i = 0; i < 3; ++i)
+ {
+ SetFloatValue(PLAYER_FIELD_WEAPON_DMG_MULTIPLIERS + i, 1.0f);
+ SetFloatValue(PLAYER_FIELD_WEAPON_ATK_SPEED_MULTIPLIERS + i, 1.0f);
+ }
SetInt32Value(UNIT_FIELD_ATTACK_POWER, 0);
SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, 0.0f);
@@ -4718,7 +4724,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
setDeathState(ALIVE);
- SetWaterWalking(false);
+ SetWaterWalking(false, true);
if (!HasUnitState(UNIT_STATE_STUNNED))
SetRooted(false);
@@ -5504,7 +5510,7 @@ void Player::UpdateRating(CombatRating cr)
switch (cr)
{
- case CR_WEAPON_SKILL:
+ case CR_UNUSED_1:
case CR_DEFENSE_SKILL:
break;
case CR_DODGE:
@@ -5540,19 +5546,19 @@ void Player::UpdateRating(CombatRating cr)
if (affectStats)
UpdateAllSpellCritChances();
break;
- case CR_HIT_TAKEN_MELEE: // Deprecated since Cataclysm
- case CR_HIT_TAKEN_RANGED: // Deprecated since Cataclysm
- case CR_HIT_TAKEN_SPELL: // Deprecated since Cataclysm
+ case CR_MULTISTRIKE:
+ case CR_READINESS:
+ case CR_SPEED:
case CR_RESILIENCE_PLAYER_DAMAGE_TAKEN:
case CR_RESILIENCE_CRIT_TAKEN:
- case CR_CRIT_TAKEN_SPELL: // Deprecated since Cataclysm
+ case CR_LIFESTEAL:
break;
case CR_HASTE_MELEE: // Implemented in Player::ApplyRatingMod
case CR_HASTE_RANGED:
case CR_HASTE_SPELL:
break;
- case CR_WEAPON_SKILL_MAINHAND: // Implemented in Unit::RollMeleeOutcomeAgainst
- case CR_WEAPON_SKILL_OFFHAND:
+ case CR_AVOIDANCE:
+ case CR_UNUSED_2:
case CR_WEAPON_SKILL_RANGED:
break;
case CR_EXPERTISE:
@@ -5569,6 +5575,11 @@ void Player::UpdateRating(CombatRating cr)
case CR_MASTERY:
UpdateMastery();
break;
+ case CR_UNUSED_3:
+ case CR_UNUSED_4:
+ case CR_VERSATILITY_DAMAGE_DONE:
+ case CR_VERSATILITY_DAMAGE_TAKEN:
+ break;
}
}
@@ -7269,7 +7280,7 @@ uint32 Player::GetZoneIdFromDB(ObjectGuid guid)
// stored zone is zero, use generic and slow zone detection
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_POSITION_XYZ);
stmt->setUInt64(0, guidLow);
- PreparedQueryResult result = CharacterDatabase.Query(stmt);
+ result = CharacterDatabase.Query(stmt);
if (!result)
return 0;
@@ -8270,7 +8281,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
}
}
-void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 castCount, uint32 misc)
+void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 castCount, int32* misc)
{
ItemTemplate const* proto = item->GetTemplate();
// special learning case
@@ -8320,7 +8331,8 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
Spell* spell = new Spell(this, spellInfo, (count > 0) ? TRIGGERED_FULL_MASK : TRIGGERED_NONE);
spell->m_CastItem = item;
spell->m_cast_count = castCount; // set count of casts
- spell->m_misc.Data = misc;
+ spell->m_misc.Raw.Data[0] = misc[0];
+ spell->m_misc.Raw.Data[1] = misc[1];
spell->prepare(&targets);
++count;
@@ -8348,7 +8360,8 @@ void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8
Spell* spell = new Spell(this, spellInfo, (count > 0) ? TRIGGERED_FULL_MASK : TRIGGERED_NONE);
spell->m_CastItem = item;
spell->m_cast_count = castCount; // set count of casts
- spell->m_misc.Data = misc; // glyph index
+ spell->m_misc.Raw.Data[0] = misc[0];
+ spell->m_misc.Raw.Data[1] = misc[1];
spell->prepare(&targets);
++count;
@@ -16420,10 +16433,10 @@ void Player::SendPushToPartyResponse(Player* player, uint8 msg)
{
if (player)
{
- WorldPacket data(SMSG_QUEST_PUSH_RESULT, 8 + 1);
- data << player->GetGUID();
- data << uint8(msg); // valid values: 0-8
- SendDirectMessage(&data);
+ WorldPackets::Quest::QuestPushResult data;
+ data.SenderGUID = player->GetGUID();
+ data.Result = msg; // valid values: 0-8
+ SendDirectMessage(data.Write());
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_QUEST_PUSH_RESULT");
}
}
@@ -17701,8 +17714,8 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff)
}
else if (invalidBagMap.find(bagGuid) != invalidBagMap.end())
{
- std::map<ObjectGuid, Item*>::iterator itr = invalidBagMap.find(bagGuid);
- if (std::find(problematicItems.begin(), problematicItems.end(), itr->second) != problematicItems.end())
+ std::map<ObjectGuid, Item*>::iterator invalidBagItr = invalidBagMap.find(bagGuid);
+ if (std::find(problematicItems.begin(), problematicItems.end(), invalidBagItr->second) != problematicItems.end())
err = EQUIP_ERR_INTERNAL_BAG_ERROR;
}
else
@@ -23799,10 +23812,10 @@ void Player::ResurrectUsingRequestData()
void Player::SetClientControl(Unit* target, bool allowMove)
{
- WorldPacket data(SMSG_CONTROL_UPDATE, target->GetPackGUID().size()+1);
- data << target->GetPackGUID();
- data << uint8(allowMove ? 1 : 0);
- GetSession()->SendPacket(&data);
+ WorldPackets::Movement::ControlUpdate data;
+ data.Guid = target->GetGUID();
+ data.On = allowMove;
+ GetSession()->SendPacket(data.Write());
if (this != target)
SetViewpoint(target, allowMove);
@@ -24508,22 +24521,24 @@ void Player::ConvertRune(uint8 index, RuneType newType)
{
SetCurrentRune(index, newType);
- WorldPacket data(SMSG_CONVERT_RUNE, 2);
- data << uint8(index);
- data << uint8(newType);
- GetSession()->SendPacket(&data);
+ WorldPackets::Spells::ConvertRune data;
+ data.Index = index;
+ data.Rune = newType;
+ GetSession()->SendPacket(data.Write());
}
void Player::ResyncRunes(uint8 count)
{
- WorldPacket data(SMSG_RESYNC_RUNES, 4 + count * 2);
- data << uint32(count);
+ WorldPackets::Spells::ResyncRunes data(count);
+
for (uint32 i = 0; i < count; ++i)
{
- data << uint8(GetCurrentRune(i)); // rune type
- data << uint8(255 - (GetRuneCooldown(i) * 51)); // passed cooldown time (0-255)
+ WorldPackets::Spells::ResyncRunes::ResyncRune rune;
+ rune.RuneType = GetCurrentRune(i); // rune type
+ rune.Cooldown = uint8(255 - (GetRuneCooldown(i) * 51)); // passed cooldown time (0-255)
+ data.Runes.push_back(rune);
}
- GetSession()->SendPacket(&data);
+ GetSession()->SendPacket(data.Write());
}
void Player::AddRunePower(uint8 index)
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 940456ba3b2..6147090a0ff 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1417,8 +1417,8 @@ class Player : public Unit, public GridObject<Player>
time_t m_logintime;
time_t m_Last_tick;
uint32 m_Played_time[MAX_PLAYED_TIME_INDEX];
- uint32 GetTotalPlayedTime() { return m_Played_time[PLAYED_TIME_TOTAL]; }
- uint32 GetLevelPlayedTime() { return m_Played_time[PLAYED_TIME_LEVEL]; }
+ uint32 GetTotalPlayedTime() const { return m_Played_time[PLAYED_TIME_TOTAL]; }
+ uint32 GetLevelPlayedTime() const { return m_Played_time[PLAYED_TIME_LEVEL]; }
void setDeathState(DeathState s) override; // overwrite Unit::setDeathState
@@ -1834,7 +1834,7 @@ class Player : public Unit, public GridObject<Player>
void RemoveMail(uint32 id);
void AddMail(Mail* mail) { m_mail.push_front(mail);}// for call from WorldSession::SendMailTo
- uint32 GetMailSize() { return uint32(m_mail.size()); }
+ uint32 GetMailSize() const { return uint32(m_mail.size()); }
Mail* GetMail(uint32 id);
PlayerMails const& GetMails() const { return m_mail; }
@@ -1951,7 +1951,7 @@ class Player : public Unit, public GridObject<Player>
void SetSpellModTakingSpell(Spell* spell, bool apply);
void RemoveArenaSpellCooldowns(bool removeActivePetCooldowns = false);
- uint32 GetLastPotionId() { return m_lastPotionId; }
+ uint32 GetLastPotionId() const { return m_lastPotionId; }
void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; }
void UpdatePotionCooldown(Spell* spell = NULL);
@@ -2016,14 +2016,14 @@ class Player : public Unit, public GridObject<Player>
void SetRank(uint8 rankId) { SetUInt32Value(PLAYER_GUILDRANK, rankId); }
uint8 GetRank() const { return uint8(GetUInt32Value(PLAYER_GUILDRANK)); }
void SetGuildLevel(uint32 level) { SetUInt32Value(PLAYER_GUILDLEVEL, level); }
- uint32 GetGuildLevel() { return GetUInt32Value(PLAYER_GUILDLEVEL); }
+ uint32 GetGuildLevel() const { return GetUInt32Value(PLAYER_GUILDLEVEL); }
void SetGuildIdInvited(ObjectGuid::LowType GuildId) { m_GuildIdInvited = GuildId; }
ObjectGuid::LowType GetGuildId() const { return GetUInt64Value(OBJECT_FIELD_DATA); /* return only lower part */ }
Guild* GetGuild();
Guild const* GetGuild() const;
static ObjectGuid::LowType GetGuildIdFromDB(ObjectGuid guid);
static uint8 GetRankFromDB(ObjectGuid guid);
- ObjectGuid::LowType GetGuildIdInvited() { return m_GuildIdInvited; }
+ ObjectGuid::LowType GetGuildIdInvited() const { return m_GuildIdInvited; }
static void RemovePetitionsAndSigns(ObjectGuid guid);
// Arena Team
@@ -2034,7 +2034,7 @@ class Player : public Unit, public GridObject<Player>
uint32 GetArenaTeamId(uint8 slot) const { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_ID); }
uint32 GetArenaPersonalRating(uint8 slot) const { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * ARENA_TEAM_END) + ARENA_TEAM_PERSONAL_RATING); }
void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; }
- uint32 GetArenaTeamIdInvited() { return m_ArenaTeamIdInvited; }
+ uint32 GetArenaTeamIdInvited() const { return m_ArenaTeamIdInvited; }
uint32 GetRBGPersonalRating() const { return 0; }
Difficulty GetDifficultyID(MapEntry const* mapEntry) const;
@@ -2216,7 +2216,7 @@ class Player : public Unit, public GridObject<Player>
bool isHonorOrXPTarget(Unit const* victim) const;
bool GetsRecruitAFriendBonus(bool forXP);
- uint8 GetGrantableLevels() { return m_grantableLevels; }
+ uint8 GetGrantableLevels() const { return m_grantableLevels; }
void SetGrantableLevels(uint8 val) { m_grantableLevels = val; }
ReputationMgr& GetReputationMgr() { return *m_reputationMgr; }
@@ -2292,7 +2292,7 @@ class Player : public Unit, public GridObject<Player>
void UpdateItemSetAuras(bool formChange = false);
void CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx);
- void CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 castCount, uint32 misc);
+ void CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 castCount, int32* misc);
void CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item* item, ItemTemplate const* proto);
void SendEquipmentSetList();
@@ -2357,7 +2357,7 @@ class Player : public Unit, public GridObject<Player>
bool isTotalImmune();
bool CanCaptureTowerPoint();
- bool GetRandomWinner() { return m_IsBGRandomWinner; }
+ bool GetRandomWinner() const { return m_IsBGRandomWinner; }
void SetRandomWinner(bool isWinner);
/*********************************************************/
@@ -2554,7 +2554,7 @@ class Player : public Unit, public GridObject<Player>
uint32 GetRuneBaseCooldown(uint8 index) const { return GetRuneTypeBaseCooldown(GetBaseRune(index)); }
uint32 GetRuneTypeBaseCooldown(RuneType runeType) const;
bool IsBaseRuneSlotsOnCooldown(RuneType runeType) const;
- RuneType GetLastUsedRune() { return m_runes->lastUsedRune; }
+ RuneType GetLastUsedRune() const { return m_runes->lastUsedRune; }
void SetLastUsedRune(RuneType type) { m_runes->lastUsedRune = type; }
void SetBaseRune(uint8 index, RuneType baseRune) { m_runes->runes[index].BaseRune = baseRune; }
void SetCurrentRune(uint8 index, RuneType currentRune) { m_runes->runes[index].CurrentRune = currentRune; }
@@ -2912,7 +2912,7 @@ class Player : public Unit, public GridObject<Player>
uint8 m_grantableLevels;
- std::array<std::unique_ptr<CUFProfile>, MAX_CUF_PROFILES> _CUFProfiles = {};
+ std::array<std::unique_ptr<CUFProfile>, MAX_CUF_PROFILES> _CUFProfiles;
private:
// internal common parts for CanStore/StoreItem functions
diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp
index 724c1a3c3d9..81232bf23d8 100644
--- a/src/server/game/Entities/Totem/Totem.cpp
+++ b/src/server/game/Entities/Totem/Totem.cpp
@@ -17,7 +17,6 @@
*/
#include "Totem.h"
-#include "Log.h"
#include "Group.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 1e6ee06e661..0be9a205e5b 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -22,12 +22,9 @@
#include "ObjectMgr.h"
#include "Path.h"
#include "ScriptMgr.h"
-#include "WorldPacket.h"
#include "DBCStores.h"
-#include "World.h"
#include "GameObjectAI.h"
#include "Vehicle.h"
-#include "MapReference.h"
#include "Player.h"
#include "Cell.h"
#include "CellImpl.h"
@@ -98,7 +95,7 @@ bool Transport::Create(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid,
SetName(goinfo->name);
UpdateRotationFields(0.0f, 1.0f);
- m_model = GameObjectModel::Create(*this);
+ m_model = CreateModel();
return true;
}
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 7cc25c5a5a1..59053abe46d 100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -23,7 +23,6 @@
#include "SharedDefines.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
-#include "SpellMgr.h"
#include "World.h"
inline bool _ModifyUInt32(bool apply, uint32& baseValue, int32& amount)
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 0538e429224..9a69f3b35ff 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -35,7 +35,6 @@
#include "InstanceSaveMgr.h"
#include "InstanceScript.h"
#include "Log.h"
-#include "MapManager.h"
#include "MoveSpline.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
@@ -54,8 +53,8 @@
#include "SpellHistory.h"
#include "SpellMgr.h"
#include "TemporarySummon.h"
-#include "Totem.h"
#include "Transport.h"
+#include "Totem.h"
#include "UpdateFieldFlags.h"
#include "Util.h"
#include "Vehicle.h"
@@ -318,6 +317,28 @@ Unit::~Unit()
ASSERT(m_dynObj.empty());
}
+// Check if unit in combat with specific unit
+bool Unit::IsInCombatWith(Unit const* who) const
+{
+ // Check target exists
+ if (!who)
+ return false;
+
+ // Search in threat list
+ ObjectGuid guid = who->GetGUID();
+ for (ThreatContainer::StorageType::const_iterator i = m_ThreatManager.getThreatList().begin(); i != m_ThreatManager.getThreatList().end(); ++i)
+ {
+ HostileReference* ref = (*i);
+
+ // Return true if the unit matches
+ if (ref && ref->getUnitGuid() == guid)
+ return true;
+ }
+
+ // Nothing found, false.
+ return false;
+}
+
void Unit::Update(uint32 p_time)
{
// WARNING! Order of execution here is important, do not change.
@@ -6806,7 +6827,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
// Item - Shaman T10 Enhancement 4P Bonus
if (AuraEffect const* aurEff = GetAuraEffect(70832, 0))
if (Aura const* maelstrom = GetAura(53817))
- if ((maelstrom->GetStackAmount() == maelstrom->GetSpellInfo()->StackAmount - 1) && roll_chance_i(aurEff->GetAmount()))
+ if ((maelstrom->GetStackAmount() == maelstrom->GetSpellInfo()->StackAmount) && roll_chance_i(aurEff->GetAmount()))
CastSpell(this, 70831, true, castItem, triggeredByAura);
break;
}
@@ -8831,12 +8852,12 @@ uint32 Unit::SpellCriticalHealingBonus(SpellInfo const* /*spellProto*/, uint32 d
return damage;
}
-uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const* effect, uint32 stack) const
+uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const* spellEffect, uint32 stack) const
{
// For totems get healing bonus from owner (statue isn't totem in fact)
if (GetTypeId() == TYPEID_UNIT && IsTotem())
if (Unit* owner = GetOwner())
- return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, effect, stack);
+ return owner->SpellHealingBonusDone(victim, spellProto, healamount, damagetype, spellEffect, stack);
// No bonus healing for potion spells
if (spellProto->SpellFamilyName == SPELLFAMILY_POTION)
@@ -8892,11 +8913,11 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
int32 DoneAdvertisedBenefit = SpellBaseHealingBonusDone(spellProto->GetSchoolMask());
// Check for table values
- float coeff = effect->BonusCoefficient;
+ float coeff = spellEffect->BonusCoefficient;
float factorMod = 1.0f;
- if (effect->BonusCoefficientFromAP > 0.0f)
+ if (spellEffect->BonusCoefficientFromAP > 0.0f)
{
- DoneTotal += int32(effect->BonusCoefficientFromAP * stack * GetTotalAttackPowerValue(
+ DoneTotal += int32(spellEffect->BonusCoefficientFromAP * stack * GetTotalAttackPowerValue(
(spellProto->IsRangedWeaponSpell() && spellProto->DmgClass != SPELL_DAMAGE_CLASS_MELEE) ? RANGED_ATTACK : BASE_ATTACK));
}
else if (coeff <= 0.0f)
@@ -9018,7 +9039,7 @@ float Unit::SpellHealingPctDone(Unit* victim, SpellInfo const* spellProto) const
return DoneTotalMod;
}
-uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType /*damagetype*/, SpellEffectInfo const* effect, uint32 stack) const
+uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType /*damagetype*/, SpellEffectInfo const* spellEffect, uint32 stack) const
{
float TakenTotalMod = 1.0f;
@@ -9051,7 +9072,7 @@ uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, u
}
// Check for table values
- float coeff = effect->BonusCoefficient;
+ float coeff = spellEffect->BonusCoefficient;
float factorMod = 1.0f;
if (coeff <= 0.0f)
{
@@ -9971,8 +9992,8 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell, Wo
if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target))
return false;
- // can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit.
- if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && (obj ? !obj->CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea(GetMap()->GetDifficultyID())) : !CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea(GetMap()->GetDifficultyID()))))
+ // can't attack invisible (ignore stealth for aoe spells) also if the area being looked at is from a spell use the dynamic object created instead of the casting unit. Ignore stealth if target is player and unit in combat with same player
+ if ((!bySpell || !bySpell->HasAttribute(SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && (obj ? !obj->CanSeeOrDetect(target, bySpell && bySpell->IsAffectingArea(GetMap()->GetDifficultyID())) : !CanSeeOrDetect(target, (bySpell && bySpell->IsAffectingArea(GetMap()->GetDifficultyID())) || (target->GetTypeId() == TYPEID_PLAYER && target->HasStealthAura() && target->IsInCombat() && IsInCombatWith(target)))))
return false;
// can't attack dead
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index aead560caa8..fe7fd3c306a 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -615,7 +615,7 @@ enum WeaponAttackType : uint16
enum CombatRating
{
- CR_WEAPON_SKILL = 0,
+ CR_UNUSED_1 = 0,
CR_DEFENSE_SKILL = 1, // Removed in 4.0.1
CR_DODGE = 2,
CR_PARRY = 3,
@@ -626,24 +626,29 @@ enum CombatRating
CR_CRIT_MELEE = 8,
CR_CRIT_RANGED = 9,
CR_CRIT_SPELL = 10,
- CR_HIT_TAKEN_MELEE = 11, // Deprecated since Cataclysm
- CR_HIT_TAKEN_RANGED = 12, // Deprecated since Cataclysm
- CR_HIT_TAKEN_SPELL = 13, // Deprecated since Cataclysm
+ CR_MULTISTRIKE = 11,
+ CR_READINESS = 12,
+ CR_SPEED = 13,
CR_RESILIENCE_CRIT_TAKEN = 14,
CR_RESILIENCE_PLAYER_DAMAGE_TAKEN = 15,
- CR_CRIT_TAKEN_SPELL = 16, // Deprecated since Cataclysm
+ CR_LIFESTEAL = 16,
CR_HASTE_MELEE = 17,
CR_HASTE_RANGED = 18,
CR_HASTE_SPELL = 19,
- CR_WEAPON_SKILL_MAINHAND = 20,
- CR_WEAPON_SKILL_OFFHAND = 21,
+ CR_AVOIDANCE = 20,
+ CR_UNUSED_2 = 21,
CR_WEAPON_SKILL_RANGED = 22,
CR_EXPERTISE = 23,
CR_ARMOR_PENETRATION = 24,
CR_MASTERY = 25,
+ CR_UNUSED_3 = 26,
+ CR_UNUSED_4 = 27,
+ CR_VERSATILITY_DAMAGE_DONE = 28,
+ // placeholder = 29,
+ CR_VERSATILITY_DAMAGE_TAKEN = 30
};
-#define MAX_COMBAT_RATING 26
+#define MAX_COMBAT_RATING 31
enum DamageEffectType
{
@@ -1557,6 +1562,7 @@ class Unit : public WorldObject
bool IsInFlight() const { return HasUnitState(UNIT_STATE_IN_FLIGHT); }
bool IsInCombat() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); }
+ bool IsInCombatWith(Unit const* who) const;
void CombatStart(Unit* target, bool initialAggro = true);
void SetInCombatState(bool PvP, Unit* enemy = NULL);
void SetInCombatWith(Unit* enemy);
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index 08efa9b9cae..e8311a0befd 100644
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -22,12 +22,8 @@
#include "Vehicle.h"
#include "Unit.h"
#include "Util.h"
-#include "WorldPacket.h"
#include "ScriptMgr.h"
#include "CreatureAI.h"
-#include "ZoneScript.h"
-#include "SpellMgr.h"
-#include "SpellInfo.h"
#include "MoveSplineInit.h"
#include "TemporarySummon.h"
#include "EventProcessor.h"
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index 0d6b971ec15..39e0e1b1bb3 100644
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -23,7 +23,6 @@
#include "Language.h"
#include "Log.h"
#include "MapManager.h"
-#include "GossipDef.h"
#include "Player.h"
#include "BattlegroundMgr.h"
#include "UnitAI.h"
diff --git a/src/server/game/Garrison/Garrison.cpp b/src/server/game/Garrison/Garrison.cpp
index 7040ae65b19..d86252cdfb8 100644
--- a/src/server/game/Garrison/Garrison.cpp
+++ b/src/server/game/Garrison/Garrison.cpp
@@ -85,7 +85,7 @@ bool Garrison::LoadFromDB(PreparedQueryResult garrison, PreparedQueryResult blue
{
do
{
- Field* fields = followers->Fetch();
+ fields = followers->Fetch();
uint64 dbId = fields[0].GetUInt64();
uint32 followerId = fields[1].GetUInt32();
@@ -116,7 +116,7 @@ bool Garrison::LoadFromDB(PreparedQueryResult garrison, PreparedQueryResult blue
{
do
{
- Field* fields = abilities->Fetch();
+ fields = abilities->Fetch();
uint64 dbId = fields[0].GetUInt64();
GarrAbilityEntry const* ability = sGarrAbilityStore.LookupEntry(fields[1].GetUInt32());
diff --git a/src/server/game/Garrison/GarrisonMgr.cpp b/src/server/game/Garrison/GarrisonMgr.cpp
index 86392a26d36..ba686cf1caf 100644
--- a/src/server/game/Garrison/GarrisonMgr.cpp
+++ b/src/server/game/Garrison/GarrisonMgr.cpp
@@ -269,21 +269,21 @@ std::list<GarrAbilityEntry const*> GarrisonMgr::RollFollowerAbilities(GarrFollow
genericTraits.unique();
std::size_t firstExclusive = 0, total = genericTraits.size();
- for (auto itr = genericTraits.begin(); itr != genericTraits.end(); ++itr, ++firstExclusive)
- if ((*itr)->Flags & GARRISON_ABILITY_FLAG_EXCLUSIVE)
+ for (auto genericTraitItr = genericTraits.begin(); genericTraitItr != genericTraits.end(); ++genericTraitItr, ++firstExclusive)
+ if ((*genericTraitItr)->Flags & GARRISON_ABILITY_FLAG_EXCLUSIVE)
break;
while (traitList.size() < size_t(std::max<int32>(0, slots[1] - forcedTraits.size())) && total)
{
- auto itr = genericTraits.begin();
- std::advance(itr, urand(0, total-- - 1));
- if ((*itr)->Flags & GARRISON_ABILITY_FLAG_EXCLUSIVE)
+ auto genericTraitItr = genericTraits.begin();
+ std::advance(genericTraitItr, urand(0, total-- - 1));
+ if ((*genericTraitItr)->Flags & GARRISON_ABILITY_FLAG_EXCLUSIVE)
total = firstExclusive; // selected exclusive trait - no other can be selected now
else
--firstExclusive;
- traitList.push_back(*itr);
- genericTraits.erase(itr);
+ traitList.push_back(*genericTraitItr);
+ genericTraits.erase(genericTraitItr);
}
}
diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp
index 474b608a846..733e61876ad 100644
--- a/src/server/game/Globals/ObjectAccessor.cpp
+++ b/src/server/game/Globals/ObjectAccessor.cpp
@@ -16,32 +16,23 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <boost/thread/shared_mutex.hpp>
-#include <boost/thread/locks.hpp>
-
#include "ObjectAccessor.h"
-#include "CellImpl.h"
#include "Corpse.h"
#include "Creature.h"
#include "DynamicObject.h"
#include "GameObject.h"
#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
#include "Item.h"
#include "Map.h"
-#include "MapInstanced.h"
-#include "MapManager.h"
#include "ObjectDefines.h"
#include "ObjectMgr.h"
-#include "Opcodes.h"
#include "Pet.h"
#include "Player.h"
#include "Transport.h"
-#include "Vehicle.h"
#include "World.h"
-#include "WorldPacket.h"
-#include <cmath>
+#include <boost/thread/shared_mutex.hpp>
+#include <boost/thread/locks.hpp>
ObjectAccessor::ObjectAccessor() { }
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 1e412e5796f..89b874697e5 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -27,7 +27,6 @@
#include "DB2Structure.h"
#include "DB2Stores.h"
#include "DisableMgr.h"
-#include "GameEventMgr.h"
#include "GossipDef.h"
#include "GroupMgr.h"
#include "GuildMgr.h"
@@ -38,19 +37,15 @@
#include "MapManager.h"
#include "Object.h"
#include "ObjectMgr.h"
-#include "Pet.h"
#include "PoolMgr.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
#include "SpellAuras.h"
-#include "Spell.h"
#include "SpellMgr.h"
#include "SpellScript.h"
-#include "Transport.h"
#include "UpdateMask.h"
#include "Util.h"
#include "Vehicle.h"
-#include "WaypointManager.h"
#include "World.h"
ScriptMapMap sSpellScripts;
@@ -1942,7 +1937,7 @@ ObjectGuid::LowType ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, fl
return guid;
}
-ObjectGuid::LowType ObjectMgr::AddCreData(uint32 entry, uint32 mapId, float x, float y, float z, float o, uint32 spawntimedelay /*= 0*/)
+ObjectGuid::LowType ObjectMgr::AddCreatureData(uint32 entry, uint32 mapId, float x, float y, float z, float o, uint32 spawntimedelay /*= 0*/)
{
CreatureTemplate const* cInfo = GetCreatureTemplate(entry);
if (!cInfo)
@@ -6388,13 +6383,10 @@ void ObjectMgr::LoadGameObjectLocales()
{
uint32 oldMSTime = getMSTime();
- _gameObjectLocaleStore.clear(); // need for reload case
-
- QueryResult result = WorldDatabase.Query("SELECT entry, "
- "name_loc1, name_loc2, name_loc3, name_loc4, name_loc5, name_loc6, name_loc7, name_loc8, "
- "castbarcaption_loc1, castbarcaption_loc2, castbarcaption_loc3, castbarcaption_loc4, "
- "castbarcaption_loc5, castbarcaption_loc6, castbarcaption_loc7, castbarcaption_loc8 FROM locales_gameobject");
+ _gameObjectLocaleStore.clear(); // need for reload case
+ // 0 1 2 3 4
+ QueryResult result = WorldDatabase.Query("SELECT entry, locale, name, castBarCaption, unk1 FROM gameobject_template_locale");
if (!result)
return;
@@ -6402,18 +6394,23 @@ void ObjectMgr::LoadGameObjectLocales()
{
Field* fields = result->Fetch();
- uint32 entry = fields[0].GetUInt32();
+ uint32 id = fields[0].GetUInt32();
+ std::string localeName = fields[1].GetString();
- GameObjectLocale& data = _gameObjectLocaleStore[entry];
+ std::string name = fields[2].GetString();
+ std::string castBarCaption = fields[3].GetString();
+ std::string unk1 = fields[4].GetString();
+
+ GameObjectLocale& data = _gameObjectLocaleStore[id];
+ LocaleConstant locale = GetLocaleByName(localeName);
+
+ AddLocaleString(name, locale, data.Name);
+ AddLocaleString(castBarCaption, locale, data.CastBarCaption);
+ AddLocaleString(unk1, locale, data.Unk1);
- for (uint8 i = OLD_TOTAL_LOCALES - 1; i > 0; --i)
- {
- AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name);
- AddLocaleString(fields[i + (OLD_TOTAL_LOCALES - 1)].GetString(), LocaleConstant(i), data.CastBarCaption);
- }
} while (result->NextRow());
- TC_LOG_INFO("server.loading", ">> Loaded %u gameobject locale strings in %u ms", uint32(_gameObjectLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
+ TC_LOG_INFO("server.loading", ">> Loaded %u gameobject_template_locale strings in %u ms", uint32(_gameObjectLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
}
inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N)
@@ -8148,12 +8145,12 @@ void ObjectMgr::LoadTrainerSpell()
TC_LOG_INFO("server.loading", ">> Loaded %d Trainers in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
-int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, uint8 type, std::set<uint32> *skip_vendors)
+int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, uint8 referenceType, std::set<uint32> *skip_vendors)
{
// find all items from the reference vendor
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_NPC_VENDOR_REF);
stmt->setUInt32(0, uint32(item));
- stmt->setUInt8(1, type);
+ stmt->setUInt8(1, referenceType);
PreparedQueryResult result = WorldDatabase.Query(stmt);
if (!result)
@@ -8168,7 +8165,7 @@ int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, uint8 type, std::se
// if item is a negative, its a reference
if (item_id < 0)
- count += LoadReferenceVendor(vendor, -item_id, type, skip_vendors);
+ count += LoadReferenceVendor(vendor, -item_id, referenceType, skip_vendors);
else
{
int32 maxcount = fields[1].GetUInt32();
@@ -9246,10 +9243,10 @@ void ObjectMgr::LoadRealmNames()
{
Field* fields = result->Fetch();
- uint32 realm = fields[0].GetUInt32();
+ uint32 realmId = fields[0].GetUInt32();
std::string realmName = fields[1].GetString();
- _realmNameStore[realm] = realmName;
+ _realmNameStore[realmId] = realmName;
++count;
}
@@ -9257,9 +9254,9 @@ void ObjectMgr::LoadRealmNames()
TC_LOG_INFO("server.loading", ">> Loaded %u realm names in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
}
-std::string ObjectMgr::GetRealmName(uint32 realm) const
+std::string ObjectMgr::GetRealmName(uint32 realmId) const
{
- RealmNameContainer::const_iterator iter = _realmNameStore.find(realm);
+ RealmNameContainer::const_iterator iter = _realmNameStore.find(realmId);
return iter != _realmNameStore.end() ? iter->second : "";
}
@@ -9267,8 +9264,8 @@ void ObjectMgr::LoadGameObjectQuestItems()
{
uint32 oldMSTime = getMSTime();
- // 0 1
- QueryResult result = WorldDatabase.Query("SELECT GameObjectEntry, ItemId FROM gameobject_questitem ORDER BY Idx ASC");
+ // 0 1 2
+ QueryResult result = WorldDatabase.Query("SELECT GameObjectEntry, ItemId, Idx FROM gameobject_questitem ORDER BY Idx ASC");
if (!result)
{
@@ -9282,7 +9279,22 @@ void ObjectMgr::LoadGameObjectQuestItems()
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
- uint32 item = fields[1].GetUInt32();
+ uint32 item = fields[1].GetUInt32();
+ uint32 idx = fields[2].GetUInt32();
+
+ GameObjectTemplate const* goInfo = GetGameObjectTemplate(entry);
+ if (!goInfo)
+ {
+ TC_LOG_ERROR("sql.sql", "Table `gameobject_questitem` has data for nonexistent gameobject (entry: %u, idx: %u), skipped", entry, idx);
+ continue;
+ };
+
+ ItemEntry const* db2Data = sItemStore.LookupEntry(item);
+ if (!db2Data)
+ {
+ TC_LOG_ERROR("sql.sql", "Table `gameobject_questitem` has nonexistent item (ID: %u) in gameobject (entry: %u, idx: %u), skipped", item, entry, idx);
+ continue;
+ };
_gameObjectQuestItemStore[entry].push_back(item);
@@ -9297,8 +9309,8 @@ void ObjectMgr::LoadCreatureQuestItems()
{
uint32 oldMSTime = getMSTime();
- // 0 1
- QueryResult result = WorldDatabase.Query("SELECT CreatureEntry, ItemId FROM creature_questitem ORDER BY Idx ASC");
+ // 0 1 2
+ QueryResult result = WorldDatabase.Query("SELECT CreatureEntry, ItemId, Idx FROM creature_questitem ORDER BY Idx ASC");
if (!result)
{
@@ -9312,7 +9324,22 @@ void ObjectMgr::LoadCreatureQuestItems()
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
- uint32 item = fields[1].GetUInt32();
+ uint32 item = fields[1].GetUInt32();
+ uint32 idx = fields[2].GetUInt32();
+
+ CreatureTemplate const* creatureInfo = GetCreatureTemplate(entry);
+ if (!creatureInfo)
+ {
+ TC_LOG_ERROR("sql.sql", "Table `creature_questitem` has data for nonexistent creature (entry: %u, idx: %u), skipped", entry, idx);
+ continue;
+ };
+
+ ItemEntry const* db2Data = sItemStore.LookupEntry(item);
+ if (!db2Data)
+ {
+ TC_LOG_ERROR("sql.sql", "Table `creature_questitem` has nonexistent item (ID: %u) in creature (entry: %u, idx: %u), skipped", item, entry, idx);
+ continue;
+ };
_creatureQuestItemStore[entry].push_back(item);
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 901aa56b431..1ae3e113331 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -646,7 +646,7 @@ bool normalizePlayerName(std::string& name);
struct ExtendedPlayerName
{
- ExtendedPlayerName(std::string const& name, std::string const& realm) : Name(name), Realm(realm) { }
+ ExtendedPlayerName(std::string const& name, std::string const& realmName) : Name(name), Realm(realmName) { }
std::string Name;
std::string Realm;
};
@@ -1222,7 +1222,7 @@ class ObjectMgr
void AddGameobjectToGrid(ObjectGuid::LowType guid, GameObjectData const* data);
void RemoveGameobjectFromGrid(ObjectGuid::LowType guid, GameObjectData const* data);
ObjectGuid::LowType AddGOData(uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0, float rotation0 = 0, float rotation1 = 0, float rotation2 = 0, float rotation3 = 0);
- ObjectGuid::LowType AddCreData(uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0);
+ ObjectGuid::LowType AddCreatureData(uint32 entry, uint32 map, float x, float y, float z, float o, uint32 spawntimedelay = 0);
// reserved names
void LoadReservedPlayersNames();
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
index d5562a9a3c7..8b01f67127a 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
@@ -21,12 +21,9 @@
#include "WorldPacket.h"
#include "WorldSession.h"
#include "UpdateData.h"
-#include "Item.h"
-#include "Map.h"
#include "Transport.h"
#include "ObjectAccessor.h"
#include "CellImpl.h"
-#include "SpellInfo.h"
using namespace Trinity;
@@ -135,8 +132,13 @@ inline void CreatureUnitRelocationWorker(Creature* c, Unit* u)
return;
if (c->HasReactState(REACT_AGGRESSIVE) && !c->HasUnitState(UNIT_STATE_SIGHTLESS))
+ {
if (c->IsAIEnabled && c->CanSeeOrDetect(u, false, true))
c->AI()->MoveInLineOfSight_Safe(u);
+ else
+ if (u->GetTypeId() == TYPEID_PLAYER && u->HasStealthAura() && c->IsAIEnabled && c->CanSeeOrDetect(u, false, true, true))
+ c->AI()->TriggerAlert(u);
+ }
}
void PlayerRelocationNotifier::Visit(PlayerMapType &m)
diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp
index 398077e3a22..365cfb63e08 100644
--- a/src/server/game/Grids/ObjectGridLoader.cpp
+++ b/src/server/game/Grids/ObjectGridLoader.cpp
@@ -20,7 +20,6 @@
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Creature.h"
-#include "Vehicle.h"
#include "GameObject.h"
#include "DynamicObject.h"
#include "Corpse.h"
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index 1f19811e291..2391f152ab3 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -32,7 +32,6 @@
#include "BattlegroundMgr.h"
#include "MapManager.h"
#include "InstanceSaveMgr.h"
-#include "MapInstanced.h"
#include "Util.h"
#include "LFGMgr.h"
#include "UpdateFieldFlags.h"
@@ -488,24 +487,24 @@ bool Group::AddMember(Player* player)
if (itr->GetSource() == player)
continue;
- if (Player* member = itr->GetSource())
+ if (Player* existingMember = itr->GetSource())
{
- if (player->HaveAtClient(member))
+ if (player->HaveAtClient(existingMember))
{
- member->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
- member->BuildValuesUpdateBlockForPlayer(&groupData, player);
- member->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
+ existingMember->SetFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
+ existingMember->BuildValuesUpdateBlockForPlayer(&groupData, player);
+ existingMember->RemoveFieldNotifyFlag(UF_FLAG_PARTY_MEMBER);
}
- if (member->HaveAtClient(player))
+ if (existingMember->HaveAtClient(player))
{
UpdateData newData(player->GetMapId());
WorldPacket newDataPacket;
- player->BuildValuesUpdateBlockForPlayer(&newData, member);
+ player->BuildValuesUpdateBlockForPlayer(&newData, existingMember);
if (newData.HasData())
{
newData.BuildPacket(&newDataPacket);
- member->SendDirectMessage(&newDataPacket);
+ existingMember->SendDirectMessage(&newDataPacket);
}
}
}
@@ -935,7 +934,7 @@ void Group::SendLooter(Creature* creature, Player* groupLooter)
data << creature->GetGUID();
if (GetLootMethod() == MASTER_LOOT && creature->loot.hasOverThresholdItem())
- data << GetMasterLooterGuid().WriteAsPacked();
+ data << GetMasterLooterGuid();
else
data << uint8(0);
@@ -2118,8 +2117,8 @@ void Group::ResetInstances(uint8 method, bool isRaid, bool isLegacy, Player* Sen
{
if (Group* group = SendMsgTo->GetGroup())
{
- for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
- if (Player* player = itr->GetSource())
+ for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
+ if (Player* player = groupRef->GetSource())
player->SendResetInstanceSuccess(instanceSave->GetMapId());
}
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index 4083a07523c..97a965da681 100644
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -2553,7 +2553,7 @@ void Guild::MassInviteToEvent(WorldSession* session, uint32 minLevel, uint32 max
if (member->GetGUID() != session->GetPlayer()->GetGUID() && level >= minLevel && level <= maxLevel && member->IsRankNotLower(minRank))
{
- data << member->GetGUID().WriteAsPacked();
+ data << member->GetGUID();
data << uint8(level);
++count;
}
diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h
index 777147f2595..805e35f0eb3 100644
--- a/src/server/game/Guilds/Guild.h
+++ b/src/server/game/Guilds/Guild.h
@@ -385,7 +385,7 @@ private:
void SetTrackedCriteriaIds(std::set<uint32> criteriaIds) { m_trackedCriteriaIds.swap(criteriaIds); }
bool IsTrackingCriteriaId(uint32 criteriaId) const { return m_trackedCriteriaIds.find(criteriaId) != m_trackedCriteriaIds.end(); }
- bool IsOnline() { return (m_flags & GUILDMEMBER_STATUS_ONLINE); }
+ bool IsOnline() const { return (m_flags & GUILDMEMBER_STATUS_ONLINE); }
void ChangeRank(uint8 newRank);
@@ -857,7 +857,7 @@ public:
void DeleteMember(ObjectGuid guid, bool isDisbanding = false, bool isKicked = false, bool canDeleteGuild = false);
bool ChangeMemberRank(ObjectGuid guid, uint8 newRank);
bool IsMember(ObjectGuid guid) const;
- uint32 GetMembersCount() { return uint32(m_members.size()); }
+ uint32 GetMembersCount() const { return uint32(m_members.size()); }
// Bank
void SwapItems(Player* player, uint8 tabId, uint8 slotId, uint8 destTabId, uint8 destSlotId, uint32 splitedAmount);
diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp
index 8f90b0268aa..44816f5fd67 100644
--- a/src/server/game/Guilds/GuildMgr.cpp
+++ b/src/server/game/Guilds/GuildMgr.cpp
@@ -501,7 +501,7 @@ void GuildMgr::LoadGuildRewards()
{
do
{
- Field* fields = reqAchievementResult->Fetch();
+ fields = reqAchievementResult->Fetch();
uint32 requiredAchievementId = fields[0].GetUInt32();
diff --git a/src/server/game/Handlers/ArenaTeamHandler.cpp b/src/server/game/Handlers/ArenaTeamHandler.cpp
index f4fb9dcd1b2..4fee5e6aeb5 100644
--- a/src/server/game/Handlers/ArenaTeamHandler.cpp
+++ b/src/server/game/Handlers/ArenaTeamHandler.cpp
@@ -17,16 +17,8 @@
*/
#include "Player.h"
-#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
-#include "DatabaseEnv.h"
-
-#include "ArenaTeam.h"
-#include "Log.h"
-#include "ObjectMgr.h"
-#include "SocialMgr.h"
-#include "ArenaTeamMgr.h"
#include "Opcodes.h"
void WorldSession::SendNotInArenaTeamPacket(uint8 type)
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp
index 88f45056187..3b0a8fc8913 100644
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp
@@ -24,7 +24,6 @@
#include "AuctionHouseMgr.h"
#include "Log.h"
#include "Language.h"
-#include "Opcodes.h"
#include "UpdateMask.h"
#include "Util.h"
#include "AccountMgr.h"
diff --git a/src/server/game/Handlers/BankHandler.cpp b/src/server/game/Handlers/BankHandler.cpp
index 8879b4e2532..a67f61d2c2a 100644
--- a/src/server/game/Handlers/BankHandler.cpp
+++ b/src/server/game/Handlers/BankHandler.cpp
@@ -17,7 +17,6 @@
#include "BankPackets.h"
#include "NPCPackets.h"
-#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
#include "WorldPacket.h"
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index debbec88e34..a6f39fcd09b 100644
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -45,7 +45,6 @@ Copied events should probably have a new owner
#include "ObjectAccessor.h"
#include "DatabaseEnv.h"
#include "GuildMgr.h"
-#include "ArenaTeamMgr.h"
#include "WorldSession.h"
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
@@ -69,12 +68,12 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent((*itr)->GetEventId()))
{
data << uint8(calendarEvent->IsGuildEvent());
- data << calendarEvent->GetCreatorGUID().WriteAsPacked();
+ data << calendarEvent->GetCreatorGUID();
}
else
{
data << uint8(0);
- data << (*itr)->GetSenderGUID().WriteAsPacked();
+ data << (*itr)->GetSenderGUID();
}
}
@@ -94,7 +93,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
Guild* guild = sGuildMgr->GetGuildById(calendarEvent->GetGuildId());
data << (guild ? guild->GetGUID() : ObjectGuid::Empty);
- data << calendarEvent->GetCreatorGUID().WriteAsPacked();
+ data << calendarEvent->GetCreatorGUID();
}
data << uint32(currTime); // server time
@@ -269,7 +268,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
for (uint32 i = 0; i < inviteCount && i < MaxPlayerInvites; ++i)
{
- recvData >> invitee[i].ReadAsPacked();
+ recvData >> invitee[i];
recvData >> status[i] >> rank[i];
}
}
@@ -571,7 +570,7 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData)
uint64 ownerInviteId; // isn't it sender's inviteId?
uint64 inviteId;
- recvData >> invitee.ReadAsPacked();
+ recvData >> invitee;
recvData >> inviteId >> ownerInviteId >> eventId;
TC_LOG_DEBUG("network", "CMSG_CALENDAR_REMOVE_INVITE [%s] EventId [" UI64FMTD
@@ -601,7 +600,7 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData)
uint64 ownerInviteId; // isn't it sender's inviteId?
uint8 status;
- recvData >> invitee.ReadAsPacked();
+ recvData >> invitee;
recvData >> eventId >> inviteId >> ownerInviteId >> status;
TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_STATUS [%s] EventId ["
UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([%s] id: ["
@@ -635,7 +634,7 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData)
uint64 ownerInviteId; // isn't it sender's inviteId?
uint8 rank;
- recvData >> invitee.ReadAsPacked();
+ recvData >> invitee;
recvData >> eventId >> inviteId >> ownerInviteId >> rank;
TC_LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [%s] EventId ["
UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([%s] id: ["
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index c823bb57e9e..c3bc704314f 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -34,7 +34,6 @@
#include "GuildFinderMgr.h"
#include "GuildMgr.h"
#include "Language.h"
-#include "LFGMgr.h"
#include "Log.h"
#include "MiscPackets.h"
#include "ObjectAccessor.h"
@@ -733,7 +732,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, WorldPac
{
if (charTemplate->Level != 1)
{
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_LEVEL);
stmt->setUInt8(0, uint8(charTemplate->Level));
stmt->setUInt64(1, newChar.GetGUID().GetCounter());
CharacterDatabase.Execute(stmt);
@@ -1604,7 +1603,7 @@ void WorldSession::HandleCharCustomizeCallback(PreparedQueryResult result, World
playerBytes2 &= ~0xFF;
playerBytes2 |= customizeInfo->FacialHairStyleID;
- PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GENDER_PLAYERBYTES);
+ stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GENDER_PLAYERBYTES);
stmt->setUInt8(0, customizeInfo->SexID);
stmt->setUInt32(1, customizeInfo->SkinID | (uint32(customizeInfo->FaceID) << 8) | (uint32(customizeInfo->HairStyleID) << 16) | (uint32(customizeInfo->HairColorID) << 24));
@@ -1639,16 +1638,16 @@ void WorldSession::HandleCharCustomizeCallback(PreparedQueryResult result, World
GetAccountId(), GetRemoteAddress().c_str(), oldName.c_str(), customizeInfo->CharGUID.ToString().c_str(), customizeInfo->CharName.c_str());
}
-void WorldSession::HandleEquipmentSetSave(WorldPackets::EquipmentSet::SaveEquipmentSet& packet)
+void WorldSession::HandleEquipmentSetSave(WorldPackets::EquipmentSet::SaveEquipmentSet& saveEquipmentSet)
{
- if (packet.Set.SetID >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
+ if (saveEquipmentSet.Set.SetID >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
return;
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
- if (!(packet.Set.IgnoreMask & (1 << i)))
+ if (!(saveEquipmentSet.Set.IgnoreMask & (1 << i)))
{
- ObjectGuid const& itemGuid = packet.Set.Pieces[i];
+ ObjectGuid const& itemGuid = saveEquipmentSet.Set.Pieces[i];
Item* item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
@@ -1661,37 +1660,37 @@ void WorldSession::HandleEquipmentSetSave(WorldPackets::EquipmentSet::SaveEquipm
return;
}
else
- packet.Set.Pieces[i].Clear();
+ saveEquipmentSet.Set.Pieces[i].Clear();
}
- packet.Set.IgnoreMask &= 0x7FFFF; /// clear invalid bits (i > EQUIPMENT_SLOT_END)
+ saveEquipmentSet.Set.IgnoreMask &= 0x7FFFF; /// clear invalid bits (i > EQUIPMENT_SLOT_END)
- _player->SetEquipmentSet(std::move(packet.Set));
+ _player->SetEquipmentSet(std::move(saveEquipmentSet.Set));
}
-void WorldSession::HandleDeleteEquipmentSet(WorldPackets::EquipmentSet::DeleteEquipmentSet& packet)
+void WorldSession::HandleDeleteEquipmentSet(WorldPackets::EquipmentSet::DeleteEquipmentSet& deleteEquipmentSet)
{
- _player->DeleteEquipmentSet(packet.ID);
+ _player->DeleteEquipmentSet(deleteEquipmentSet.ID);
}
-void WorldSession::HandleUseEquipmentSet(WorldPackets::EquipmentSet::UseEquipmentSet& packet)
+void WorldSession::HandleUseEquipmentSet(WorldPackets::EquipmentSet::UseEquipmentSet& useEquipmentSet)
{
ObjectGuid ignoredItemGuid;
ignoredItemGuid.SetRawValue(0, 1);
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
- TC_LOG_DEBUG("entities.player.items", "%s: ContainerSlot: %u, Slot: %u", packet.Items[i].Item.ToString().c_str(), packet.Items[i].ContainerSlot, packet.Items[i].Slot);
+ TC_LOG_DEBUG("entities.player.items", "%s: ContainerSlot: %u, Slot: %u", useEquipmentSet.Items[i].Item.ToString().c_str(), useEquipmentSet.Items[i].ContainerSlot, useEquipmentSet.Items[i].Slot);
// check if item slot is set to "ignored" (raw value == 1), must not be unequipped then
- if (packet.Items[i].Item == ignoredItemGuid)
+ if (useEquipmentSet.Items[i].Item == ignoredItemGuid)
continue;
// Only equip weapons in combat
if (_player->IsInCombat() && i != EQUIPMENT_SLOT_MAINHAND && i != EQUIPMENT_SLOT_OFFHAND && i != EQUIPMENT_SLOT_RANGED)
continue;
- Item* item = _player->GetItemByGuid(packet.Items[i].Item);
+ Item* item = _player->GetItemByGuid(useEquipmentSet.Items[i].Item);
uint16 dstPos = i | (INVENTORY_SLOT_BAG_0 << 8);
@@ -2057,8 +2056,8 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(PreparedQueryResult res
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUILD_MEMBER);
stmt->setUInt64(0, lowGuid);
- if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
- if (Guild* guild = sGuildMgr->GetGuildById(result->Fetch()[0].GetUInt64()))
+ if (PreparedQueryResult memberResult = CharacterDatabase.Query(stmt))
+ if (Guild* guild = sGuildMgr->GetGuildById(memberResult->Fetch()[0].GetUInt64()))
guild->DeleteMember(factionChangeInfo->Guid, false, false, true);
Player::LeaveAllArenaTeams(factionChangeInfo->Guid);
@@ -2213,9 +2212,9 @@ void WorldSession::HandleCharRaceOrFactionChangeCallback(PreparedQueryResult res
stmt->setUInt32(0, oldReputation);
stmt->setUInt64(1, lowGuid);
- if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
+ if (PreparedQueryResult reputationResult = CharacterDatabase.Query(stmt))
{
- Field* fields = result->Fetch();
+ fields = reputationResult->Fetch();
int32 oldDBRep = fields[0].GetInt32();
FactionEntry const* factionEntry = sFactionStore.LookupEntry(oldReputation);
diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp
index b9fd383b19d..49922edafd7 100644
--- a/src/server/game/Handlers/ChatHandler.cpp
+++ b/src/server/game/Handlers/ChatHandler.cpp
@@ -24,7 +24,6 @@
#include "WorldPacket.h"
#include "WorldSession.h"
#include "DatabaseEnv.h"
-#include "CellImpl.h"
#include "Chat.h"
#include "ChannelMgr.h"
#include "GridNotifiersImpl.h"
@@ -34,7 +33,6 @@
#include "Log.h"
#include "Opcodes.h"
#include "Player.h"
-#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "Util.h"
#include "ScriptMgr.h"
diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp
index 9b9a32b2c2a..ab401ced1ad 100644
--- a/src/server/game/Handlers/CombatHandler.cpp
+++ b/src/server/game/Handlers/CombatHandler.cpp
@@ -22,11 +22,8 @@
#include "WorldSession.h"
#include "ObjectAccessor.h"
#include "CreatureAI.h"
-#include "ObjectDefines.h"
#include "Vehicle.h"
-#include "VehicleDefines.h"
#include "Player.h"
-#include "Opcodes.h"
#include "CombatPackets.h"
void WorldSession::HandleAttackSwingOpcode(WorldPackets::Combat::AttackSwing& packet)
diff --git a/src/server/game/Handlers/DuelHandler.cpp b/src/server/game/Handlers/DuelHandler.cpp
index eedfe578b4b..40d6f469c9e 100644
--- a/src/server/game/Handlers/DuelHandler.cpp
+++ b/src/server/game/Handlers/DuelHandler.cpp
@@ -20,8 +20,6 @@
#include "DuelPackets.h"
#include "WorldSession.h"
#include "Log.h"
-#include "Opcodes.h"
-#include "UpdateData.h"
#include "Player.h"
#include "ObjectAccessor.h"
diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
index 9df20126790..8db7afbfa35 100644
--- a/src/server/game/Handlers/GroupHandler.cpp
+++ b/src/server/game/Handlers/GroupHandler.cpp
@@ -22,17 +22,12 @@
#include "GroupMgr.h"
#include "Log.h"
#include "ObjectMgr.h"
-#include "Opcodes.h"
-#include "Pet.h"
#include "Player.h"
#include "SocialMgr.h"
-#include "SpellAuras.h"
#include "Util.h"
-#include "Vehicle.h"
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
-#include "SpellAuraEffects.h"
#include "MiscPackets.h"
#include "LootPackets.h"
#include "PartyPackets.h"
diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp
index fbd1d5a7183..ae2ec7b2fca 100644
--- a/src/server/game/Handlers/GuildHandler.cpp
+++ b/src/server/game/Handlers/GuildHandler.cpp
@@ -25,8 +25,6 @@
#include "Log.h"
#include "Opcodes.h"
#include "Guild.h"
-#include "GossipDef.h"
-#include "SocialMgr.h"
#include "GuildPackets.h"
void WorldSession::HandleGuildQueryOpcode(WorldPackets::Guild::QueryGuildInfo& query)
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index e6aecff9137..9c1afcc3785 100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -24,9 +24,6 @@
#include "ObjectMgr.h"
#include "Player.h"
#include "Item.h"
-#include "UpdateData.h"
-#include "ObjectAccessor.h"
-#include "SpellInfo.h"
#include "DB2Stores.h"
#include "NPCPackets.h"
#include "ItemPackets.h"
@@ -707,8 +704,8 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPackets::Item::AutoStoreBag
void WorldSession::SendEnchantmentLog(ObjectGuid target, ObjectGuid caster, uint32 itemId, uint32 enchantId)
{
WorldPacket data(SMSG_ENCHANTMENT_LOG, (8+8+4+4));
- data << target.WriteAsPacked();
- data << caster.WriteAsPacked();
+ data << target;
+ data << caster;
data << uint32(itemId);
data << uint32(enchantId);
GetPlayer()->SendMessageToSet(&data, true);
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index d53c20329b3..fe6cb4674bc 100644
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -26,9 +26,7 @@
#include "LootMgr.h"
#include "ObjectAccessor.h"
#include "Object.h"
-#include "Opcodes.h"
#include "Player.h"
-#include "World.h"
#include "WorldPacket.h"
#include "LootPackets.h"
#include "WorldSession.h"
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 0aa941de4e2..7fd5ad542ff 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -28,31 +28,19 @@
#include "ObjectMgr.h"
#include "GuildMgr.h"
#include "WorldSession.h"
-#include "BigNumber.h"
-#include "SHA1.h"
-#include "UpdateData.h"
-#include "LootMgr.h"
#include "Chat.h"
#include "zlib.h"
#include "ObjectAccessor.h"
#include "Object.h"
#include "Battleground.h"
#include "OutdoorPvP.h"
-#include "Pet.h"
-#include "CellImpl.h"
#include "AccountMgr.h"
-#include "Vehicle.h"
-#include "CreatureAI.h"
#include "DBCEnums.h"
#include "ScriptMgr.h"
#include "MapManager.h"
-#include "InstanceScript.h"
#include "Group.h"
-#include "AccountMgr.h"
#include "Spell.h"
#include "SpellPackets.h"
-#include "BattlegroundMgr.h"
-#include "DB2Stores.h"
#include "CharacterPackets.h"
#include "ClientConfigPackets.h"
#include "MiscPackets.h"
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp
index 13914adcae3..4256a41f80f 100644
--- a/src/server/game/Handlers/MovementHandler.cpp
+++ b/src/server/game/Handlers/MovementHandler.cpp
@@ -24,7 +24,6 @@
#include "Corpse.h"
#include "Player.h"
#include "Garrison.h"
-#include "SpellAuras.h"
#include "MapManager.h"
#include "Transport.h"
#include "Battleground.h"
@@ -511,17 +510,12 @@ void WorldSession::HandleMovementAckMessage(WorldPackets::Movement::MovementAckM
GetPlayer()->ValidateMovementInfo(&movementAck.Ack.movementInfo);
}
-void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData)
+void WorldSession::HandleSummonResponseOpcode(WorldPackets::Movement::SummonResponse& packet)
{
if (!_player->IsAlive() || _player->IsInCombat())
return;
- ObjectGuid summoner_guid;
- bool agree;
- recvData >> summoner_guid;
- recvData >> agree;
-
- _player->SummonIfPossible(agree);
+ _player->SummonIfPossible(packet.Accept);
}
void WorldSession::HandleSetCollisionHeightAck(WorldPackets::Movement::MoveSetCollisionHeightAck& setCollisionHeightAck)
diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp
index 8664a1195c9..d6d199a7119 100644
--- a/src/server/game/Handlers/PetHandler.cpp
+++ b/src/server/game/Handlers/PetHandler.cpp
@@ -764,7 +764,8 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPackets::Spells::PetCastSpell&
Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE);
spell->m_cast_count = petCastSpell.Cast.CastID;
- spell->m_misc.Data = petCastSpell.Cast.Misc;
+ spell->m_misc.Raw.Data[0] = petCastSpell.Cast.Misc[0];
+ spell->m_misc.Raw.Data[1] = petCastSpell.Cast.Misc[1];
spell->m_targets = targets;
SpellCastResult result = spell->CheckPetCast(NULL);
diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp
index 2e5c4c14424..5563905a325 100644
--- a/src/server/game/Handlers/PetitionsHandler.cpp
+++ b/src/server/game/Handlers/PetitionsHandler.cpp
@@ -17,7 +17,6 @@
*/
#include "Common.h"
-#include "Language.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "World.h"
@@ -26,8 +25,6 @@
#include "Log.h"
#include "Opcodes.h"
#include "Guild.h"
-#include "GossipDef.h"
-#include "SocialMgr.h"
#include "PetitionPackets.h"
#define CHARTER_DISPLAY_ID 16161
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp
index 5d40165df04..c1818638a56 100644
--- a/src/server/game/Handlers/QueryHandler.cpp
+++ b/src/server/game/Handlers/QueryHandler.cpp
@@ -17,20 +17,16 @@
*/
#include "Common.h"
-#include "Language.h"
#include "DatabaseEnv.h"
#include "WorldPacket.h"
#include "WorldSession.h"
-#include "Opcodes.h"
#include "Log.h"
#include "World.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "UpdateMask.h"
#include "NPCHandler.h"
-#include "Pet.h"
#include "MapManager.h"
-#include "CharacterPackets.h"
#include "QueryPackets.h"
void WorldSession::SendNameQueryOpcode(ObjectGuid guid)
@@ -126,26 +122,32 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPackets::Query::QueryGameObj
response.Allow = true;
WorldPackets::Query::GameObjectStats& stats = response.Stats;
- stats.CastBarCaption = gameObjectInfo->castBarCaption;
+ stats.Type = gameObjectInfo->type;
stats.DisplayID = gameObjectInfo->displayId;
- stats.IconName = gameObjectInfo->IconName;
+
stats.Name[0] = gameObjectInfo->name;
+ stats.IconName = gameObjectInfo->IconName;
+ stats.CastBarCaption = gameObjectInfo->castBarCaption;
+ stats.UnkString = gameObjectInfo->unk1;
- GameObjectQuestItemList const* items = sObjectMgr->GetGameObjectQuestItemList(packet.GameObjectID);
- if (items)
+ LocaleConstant localeConstant = GetSessionDbLocaleIndex();
+ if (localeConstant >= LOCALE_enUS)
+ if (GameObjectLocale const* gameObjectLocale = sObjectMgr->GetGameObjectLocale(packet.GameObjectID))
+ {
+ ObjectMgr::GetLocaleString(gameObjectLocale->Name, localeConstant, stats.Name[0]);
+ ObjectMgr::GetLocaleString(gameObjectLocale->CastBarCaption, localeConstant, stats.CastBarCaption);
+ ObjectMgr::GetLocaleString(gameObjectLocale->Unk1, localeConstant, stats.UnkString);
+ }
+
+ stats.Size = gameObjectInfo->size;
+
+ if (GameObjectQuestItemList const* items = sObjectMgr->GetGameObjectQuestItemList(packet.GameObjectID))
for (uint32 item : *items)
stats.QuestItems.push_back(item);
for (uint32 i = 0; i < MAX_GAMEOBJECT_DATA; i++)
stats.Data[i] = gameObjectInfo->raw.data[i];
-
- stats.Size = gameObjectInfo->size;
- stats.Type = gameObjectInfo->type;
- stats.UnkString = gameObjectInfo->unk1;
- stats.Expansion = 0;
}
- else
- response.Allow = false;
SendPacket(response.Write());
}
@@ -312,15 +314,15 @@ void WorldSession::HandleQueryQuestCompletionNPCs(WorldPackets::Query::QueryQues
SendPacket(response.Write());
}
-void WorldSession::HandleQuestPOIQuery(WorldPackets::Query::QuestPOIQuery& packet)
+void WorldSession::HandleQuestPOIQuery(WorldPackets::Query::QuestPOIQuery& questPoiQuery)
{
- if (packet.MissingQuestCount > MAX_QUEST_LOG_SIZE)
+ if (questPoiQuery.MissingQuestCount > MAX_QUEST_LOG_SIZE)
return;
// Read quest ids and add the in a unordered_set so we don't send POIs for the same quest multiple times
std::unordered_set<int32> questIds;
- for (int32 i = 0; i < packet.MissingQuestCount; ++i)
- questIds.insert(packet.MissingQuestPOIs[i]); // QuestID
+ for (int32 i = 0; i < questPoiQuery.MissingQuestCount; ++i)
+ questIds.insert(questPoiQuery.MissingQuestPOIs[i]); // QuestID
WorldPackets::Query::QuestPOIQueryResponse response;
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp
index c1d61ca49f4..9665a41034e 100644
--- a/src/server/game/Handlers/QuestHandler.cpp
+++ b/src/server/game/Handlers/QuestHandler.cpp
@@ -20,7 +20,6 @@
#include "Log.h"
#include "WorldPacket.h"
#include "WorldSession.h"
-#include "Opcodes.h"
#include "World.h"
#include "ObjectMgr.h"
#include "Player.h"
@@ -272,7 +271,8 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPackets::Quest::Quest
if (questPackageItem->ItemID != uint32(packet.ItemChoiceID))
continue;
- if (ItemTemplate const* rewardProto = sObjectMgr->GetItemTemplate(questPackageItem->ItemID))
+ rewardProto = sObjectMgr->GetItemTemplate(questPackageItem->ItemID);
+ if (rewardProto)
{
if (rewardProto->CanWinForPlayer(_player))
{
diff --git a/src/server/game/Handlers/ReferAFriendHandler.cpp b/src/server/game/Handlers/ReferAFriendHandler.cpp
index b4c9513a238..4fad9f01cc6 100644
--- a/src/server/game/Handlers/ReferAFriendHandler.cpp
+++ b/src/server/game/Handlers/ReferAFriendHandler.cpp
@@ -18,7 +18,6 @@
#include "WorldSession.h"
#include "Player.h"
#include "ObjectMgr.h"
-#include "Opcodes.h"
#include "Log.h"
#include "ReferAFriendPackets.h"
diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp
index 870fdea69ac..206deeca305 100644
--- a/src/server/game/Handlers/SkillHandler.cpp
+++ b/src/server/game/Handlers/SkillHandler.cpp
@@ -17,13 +17,10 @@
*/
#include "Common.h"
-#include "DatabaseEnv.h"
#include "Log.h"
#include "ObjectAccessor.h"
-#include "Opcodes.h"
#include "Player.h"
#include "Pet.h"
-#include "UpdateMask.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "TalentPackets.h"
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index 6d3f35d407d..7655d2766f3 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -27,9 +27,7 @@
#include "Opcodes.h"
#include "Spell.h"
#include "Totem.h"
-#include "TemporarySummon.h"
#include "SpellAuras.h"
-#include "CreatureAI.h"
#include "ScriptMgr.h"
#include "GameObjectAI.h"
#include "SpellAuraEffects.h"
@@ -313,7 +311,8 @@ void WorldSession::HandleCastSpellOpcode(WorldPackets::Spells::CastSpell& cast)
Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE, ObjectGuid::Empty, false);
spell->m_cast_count = cast.Cast.CastID; // set count of casts
- spell->m_misc.Data = cast.Cast.Misc; // 6.x Misc is just a guess
+ spell->m_misc.Raw.Data[0] = cast.Cast.Misc[0];
+ spell->m_misc.Raw.Data[1] = cast.Cast.Misc[1];
spell->prepare(&targets);
}
@@ -483,13 +482,10 @@ void WorldSession::HandleSelfResOpcode(WorldPackets::Spells::SelfRes& /*packet*/
}
}
-void WorldSession::HandleSpellClick(WorldPacket& recvData)
+void WorldSession::HandleSpellClick(WorldPackets::Spells::SpellClick& spellClick)
{
- ObjectGuid guid;
- recvData >> guid;
-
// this will get something not in world. crash
- Creature* unit = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
+ Creature* unit = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, spellClick.SpellClickUnitGuid);
if (!unit)
return;
@@ -501,9 +497,9 @@ void WorldSession::HandleSpellClick(WorldPacket& recvData)
unit->HandleSpellClick(_player);
}
-void WorldSession::HandleMirrorImageDataRequest(WorldPackets::Spells::GetMirrorImageData& packet)
+void WorldSession::HandleMirrorImageDataRequest(WorldPackets::Spells::GetMirrorImageData& getMirrorImageData)
{
- ObjectGuid guid = packet.UnitGUID;
+ ObjectGuid guid = getMirrorImageData.UnitGUID;
// Get unit for which data is needed by client
Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
@@ -520,23 +516,23 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPackets::Spells::GetMirrorI
if (Player* player = creator->ToPlayer())
{
- WorldPackets::Spells::MirrorImageComponentedData packet;
- packet.UnitGUID = guid;
- packet.DisplayID = creator->GetDisplayId();
- packet.RaceID = creator->getRace();
- packet.Gender = creator->getGender();
- packet.ClassID = creator->getClass();
+ WorldPackets::Spells::MirrorImageComponentedData mirrorImageComponentedData;
+ mirrorImageComponentedData.UnitGUID = guid;
+ mirrorImageComponentedData.DisplayID = creator->GetDisplayId();
+ mirrorImageComponentedData.RaceID = creator->getRace();
+ mirrorImageComponentedData.Gender = creator->getGender();
+ mirrorImageComponentedData.ClassID = creator->getClass();
Guild* guild = player->GetGuild();
- packet.SkinColor = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_SKIN_ID);
- packet.FaceVariation = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_FACE_ID);
- packet.HairVariation = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_HAIR_STYLE_ID);
- packet.HairColor = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_HAIR_COLOR_ID);
- packet.BeardVariation = player->GetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_FACIAL_STYLE);
- packet.GuildGUID = (guild ? guild->GetGUID() : ObjectGuid::Empty);
+ mirrorImageComponentedData.SkinColor = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_SKIN_ID);
+ mirrorImageComponentedData.FaceVariation = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_FACE_ID);
+ mirrorImageComponentedData.HairVariation = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_HAIR_STYLE_ID);
+ mirrorImageComponentedData.HairColor = player->GetByteValue(PLAYER_BYTES, PLAYER_BYTES_OFFSET_HAIR_COLOR_ID);
+ mirrorImageComponentedData.BeardVariation = player->GetByteValue(PLAYER_BYTES_2, PLAYER_BYTES_2_OFFSET_FACIAL_STYLE);
+ mirrorImageComponentedData.GuildGUID = (guild ? guild->GetGUID() : ObjectGuid::Empty);
- packet.ItemDisplayID.reserve(11);
+ mirrorImageComponentedData.ItemDisplayID.reserve(11);
static EquipmentSlots const itemSlots[] =
{
@@ -566,16 +562,16 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPackets::Spells::GetMirrorI
else
itemDisplayId = 0;
- packet.ItemDisplayID.push_back(itemDisplayId);
+ mirrorImageComponentedData.ItemDisplayID.push_back(itemDisplayId);
}
- SendPacket(packet.Write());
+ SendPacket(mirrorImageComponentedData.Write());
}
else
{
- WorldPackets::Spells::MirrorImageCreatureData packet;
- packet.UnitGUID = guid;
- packet.DisplayID = creator->GetDisplayId();
- SendPacket(packet.Write());
+ WorldPackets::Spells::MirrorImageCreatureData mirrorImageCreatureData;
+ mirrorImageCreatureData.UnitGUID = guid;
+ mirrorImageCreatureData.DisplayID = creator->GetDisplayId();
+ SendPacket(mirrorImageCreatureData.Write());
}
}
diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp
index 0fde16f1be9..20a8ba70f76 100644
--- a/src/server/game/Handlers/TaxiHandler.cpp
+++ b/src/server/game/Handlers/TaxiHandler.cpp
@@ -24,7 +24,6 @@
#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "UpdateMask.h"
#include "Path.h"
#include "WaypointMovementGenerator.h"
diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp
index f9c1f1c6989..59a7ceb0efc 100644
--- a/src/server/game/Handlers/TicketHandler.cpp
+++ b/src/server/game/Handlers/TicketHandler.cpp
@@ -16,16 +16,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "zlib.h"
#include "Common.h"
-#include "Language.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
#include "SupportMgr.h"
#include "TicketPackets.h"
#include "Util.h"
-#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
diff --git a/src/server/game/Handlers/TokenHandler.cpp b/src/server/game/Handlers/TokenHandler.cpp
index ed724a0b3e8..1c9d3a48dfc 100644
--- a/src/server/game/Handlers/TokenHandler.cpp
+++ b/src/server/game/Handlers/TokenHandler.cpp
@@ -15,7 +15,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
#include "TokenPackets.h"
#include "WorldSession.h"
diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp
index ddfc0cef55c..32ed156b226 100644
--- a/src/server/game/Handlers/TradeHandler.cpp
+++ b/src/server/game/Handlers/TradeHandler.cpp
@@ -22,7 +22,6 @@
#include "World.h"
#include "ObjectAccessor.h"
#include "Log.h"
-#include "Opcodes.h"
#include "Player.h"
#include "Item.h"
#include "Spell.h"
diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp
index 6e78ee62c18..03ae55b001d 100644
--- a/src/server/game/Handlers/VehicleHandler.cpp
+++ b/src/server/game/Handlers/VehicleHandler.cpp
@@ -17,7 +17,6 @@
#include "WorldPacket.h"
#include "WorldSession.h"
-#include "Opcodes.h"
#include "Vehicle.h"
#include "Player.h"
#include "Log.h"
diff --git a/src/server/game/Handlers/VoiceChatHandler.cpp b/src/server/game/Handlers/VoiceChatHandler.cpp
index b84f91373da..36e7cd136f7 100644
--- a/src/server/game/Handlers/VoiceChatHandler.cpp
+++ b/src/server/game/Handlers/VoiceChatHandler.cpp
@@ -19,8 +19,6 @@
#include "Common.h"
#include "WorldPacket.h"
#include "WorldSession.h"
-#include "Opcodes.h"
-#include "Log.h"
void WorldSession::HandleVoiceSessionEnableOpcode(WorldPacket& recvData)
{
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp
index 91dc817e717..957a9eb32fa 100644
--- a/src/server/game/Instances/InstanceSaveMgr.cpp
+++ b/src/server/game/Instances/InstanceSaveMgr.cpp
@@ -21,15 +21,12 @@
#include "GridNotifiers.h"
#include "Log.h"
#include "GridStates.h"
-#include "CellImpl.h"
#include "Map.h"
#include "MapManager.h"
#include "MapInstanced.h"
#include "InstanceSaveMgr.h"
#include "Timer.h"
-#include "GridNotifiersImpl.h"
#include "Config.h"
-#include "Transport.h"
#include "ObjectMgr.h"
#include "World.h"
#include "Group.h"
@@ -666,19 +663,19 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
/// @todo delete creature/gameobject respawn times even if the maps are not loaded
}
-uint32 InstanceSaveManager::GetNumBoundPlayersTotal()
+uint32 InstanceSaveManager::GetNumBoundPlayersTotal() const
{
uint32 ret = 0;
- for (InstanceSaveHashMap::iterator itr = m_instanceSaveById.begin(); itr != m_instanceSaveById.end(); ++itr)
+ for (InstanceSaveHashMap::const_iterator itr = m_instanceSaveById.begin(); itr != m_instanceSaveById.end(); ++itr)
ret += itr->second->GetPlayerCount();
return ret;
}
-uint32 InstanceSaveManager::GetNumBoundGroupsTotal()
+uint32 InstanceSaveManager::GetNumBoundGroupsTotal() const
{
uint32 ret = 0;
- for (InstanceSaveHashMap::iterator itr = m_instanceSaveById.begin(); itr != m_instanceSaveById.end(); ++itr)
+ for (InstanceSaveHashMap::const_iterator itr = m_instanceSaveById.begin(); itr != m_instanceSaveById.end(); ++itr)
ret += itr->second->GetGroupCount();
return ret;
diff --git a/src/server/game/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h
index 5c5722dbaa9..8739e6eff13 100644
--- a/src/server/game/Instances/InstanceSaveMgr.h
+++ b/src/server/game/Instances/InstanceSaveMgr.h
@@ -222,9 +222,9 @@ class InstanceSaveManager
InstanceSave* GetInstanceSave(uint32 InstanceId);
/* statistics */
- uint32 GetNumInstanceSaves() { return uint32(m_instanceSaveById.size()); }
- uint32 GetNumBoundPlayersTotal();
- uint32 GetNumBoundGroupsTotal();
+ uint32 GetNumInstanceSaves() const { return uint32(m_instanceSaveById.size()); }
+ uint32 GetNumBoundPlayersTotal() const;
+ uint32 GetNumBoundGroupsTotal() const;
protected:
static uint16 ResetTimeDelay[];
diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp
index 37e22638c1c..1a0d572970a 100644
--- a/src/server/game/Mails/Mail.cpp
+++ b/src/server/game/Mails/Mail.cpp
@@ -22,8 +22,6 @@
#include "World.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "Unit.h"
-#include "BattlegroundMgr.h"
#include "Item.h"
#include "AuctionHouseMgr.h"
#include "CalendarMgr.h"
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 008bb89ff4c..cd383763c4f 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -28,7 +28,6 @@
#include "Group.h"
#include "InstanceScript.h"
#include "MapInstanced.h"
-#include "MapManager.h"
#include "MiscPackets.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
@@ -316,7 +315,15 @@ void Map::SwitchGridContainers(Creature* obj, bool on)
if (!IsGridLoaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y)))
return;
- TC_LOG_DEBUG("maps", "Switch object %s from grid[%u, %u] %u", obj->GetGUID().ToString().c_str(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
+ if (sLog->ShouldLog("maps", LOG_LEVEL_DEBUG))
+ {
+ // Extract bitfield values
+ uint32 const grid_x = cell.data.Part.grid_x;
+ uint32 const grid_y = cell.data.Part.grid_y;
+
+ TC_LOG_DEBUG("maps", "Switch object %s from grid[%u, %u] %u", obj->GetGUID().ToString().c_str(), grid_x, grid_y, on);
+ }
+
NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY());
ASSERT(ngrid != NULL);
@@ -353,7 +360,15 @@ void Map::SwitchGridContainers(GameObject* obj, bool on)
if (!IsGridLoaded(GridCoord(cell.data.Part.grid_x, cell.data.Part.grid_y)))
return;
- TC_LOG_DEBUG("maps", "Switch object %s from grid[%u, %u] %u", obj->GetGUID().ToString().c_str(), cell.data.Part.grid_x, cell.data.Part.grid_y, on);
+ if (sLog->ShouldLog("maps", LOG_LEVEL_DEBUG))
+ {
+ // Extract bitfield values
+ uint32 const grid_x = cell.data.Part.grid_x;
+ uint32 const grid_y = cell.data.Part.grid_y;
+
+ TC_LOG_DEBUG("maps", "Switch object %s from grid[%u, %u] %u", obj->GetGUID().ToString().c_str(), grid_x, grid_y, on);
+ }
+
NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY());
ASSERT(ngrid != NULL);
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index fb1ac3cc62d..9331815bb39 100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -732,7 +732,7 @@ class InstanceMap : public Map
void Update(const uint32) override;
void CreateInstanceData(bool load);
bool Reset(uint8 method);
- uint32 GetScriptId() { return i_script_id; }
+ uint32 GetScriptId() const { return i_script_id; }
InstanceScript* GetInstanceScript() { return i_data; }
void PermBindAllPlayers(Player* source);
void UnloadAll() override;
diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp
index e18a98e8429..a708556fe64 100644
--- a/src/server/game/Maps/MapManager.cpp
+++ b/src/server/game/Maps/MapManager.cpp
@@ -27,10 +27,8 @@
#include "InstanceScript.h"
#include "Config.h"
#include "World.h"
-#include "CellImpl.h"
#include "Corpse.h"
#include "ObjectMgr.h"
-#include "Language.h"
#include "WorldPacket.h"
#include "Group.h"
#include "Player.h"
diff --git a/src/server/game/Maps/MapUpdater.cpp b/src/server/game/Maps/MapUpdater.cpp
index 8ac6226b570..ac97c16a305 100644
--- a/src/server/game/Maps/MapUpdater.cpp
+++ b/src/server/game/Maps/MapUpdater.cpp
@@ -16,12 +16,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <mutex>
-#include <condition_variable>
-
#include "MapUpdater.h"
#include "Map.h"
+#include <mutex>
+
class MapUpdateRequest
{
diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp
index 8f9d65e749b..8c7442a8ae5 100644
--- a/src/server/game/Maps/TransportMgr.cpp
+++ b/src/server/game/Maps/TransportMgr.cpp
@@ -18,7 +18,6 @@
#include "TransportMgr.h"
#include "Transport.h"
#include "InstanceScript.h"
-#include "MoveSpline.h"
#include "MapManager.h"
TransportTemplate::~TransportTemplate()
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index d767f88e102..7456e55f5f1 100644
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -812,7 +812,7 @@ enum SpellAttr12
SPELL_ATTR12_UNK24 = 0x01000000, // 24
SPELL_ATTR12_UNK25 = 0x02000000, // 25
SPELL_ATTR12_UNK26 = 0x04000000, // 26
- SPELL_ATTR12_UNK27 = 0x08000000, // 27
+ SPELL_ATTR12_IS_READINESS_SPELL = 0x08000000, // 27
SPELL_ATTR12_UNK28 = 0x10000000, // 28
SPELL_ATTR12_UNK29 = 0x20000000, // 29
SPELL_ATTR12_UNK30 = 0x40000000, // 30
@@ -1258,7 +1258,8 @@ enum SpellEffectName
SPELL_EFFECT_FINISH_SHIPMENT = 248,
SPELL_EFFECT_249 = 249,
SPELL_EFFECT_TAKE_SCREENSHOT = 250, // Serverside marker for selfie screenshot - achievement check
- TOTAL_SPELL_EFFECTS = 251,
+ SPELL_EFFECT_SET_GARRISON_CACHE_SIZE = 251,
+ TOTAL_SPELL_EFFECTS = 252,
};
enum SpellCastResult // 20201
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index 5177bf5c9de..0a4deebbbfc 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -30,7 +30,6 @@
#include "RandomMovementGenerator.h"
#include "MoveSpline.h"
#include "MoveSplineInit.h"
-#include <cassert>
inline bool isStatic(MovementGenerator *mv)
{
diff --git a/src/server/game/Movement/MovementGenerator.h b/src/server/game/Movement/MovementGenerator.h
index 879b8aea537..45fd252ddb9 100755
--- a/src/server/game/Movement/MovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerator.h
@@ -39,7 +39,7 @@ class MovementGenerator
virtual bool Update(Unit*, uint32 time_diff) = 0;
- virtual MovementGeneratorType GetMovementGeneratorType() = 0;
+ virtual MovementGeneratorType GetMovementGeneratorType() const = 0;
virtual void unitSpeedChanged() { }
diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
index cbfc181fe9f..f0c0311280f 100755
--- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
@@ -17,10 +17,8 @@
*/
#include "Creature.h"
-#include "MapManager.h"
#include "ConfusedMovementGenerator.h"
#include "PathGenerator.h"
-#include "VMapFactory.h"
#include "MoveSplineInit.h"
#include "MoveSpline.h"
#include "Player.h"
diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h
index 4cc4baa081f..5b6d6c96482 100755
--- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h
@@ -33,7 +33,7 @@ class ConfusedMovementGenerator : public MovementGeneratorMedium< T, ConfusedMov
void DoReset(T*);
bool DoUpdate(T*, uint32);
- MovementGeneratorType GetMovementGeneratorType() { return CONFUSED_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return CONFUSED_MOTION_TYPE; }
private:
TimeTracker i_nextMoveTime;
float i_x, i_y, i_z;
diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
index cea25fefbda..fa17846a1ff 100644
--- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
@@ -18,7 +18,6 @@
#include "Creature.h"
#include "CreatureAI.h"
-#include "MapManager.h"
#include "FleeingMovementGenerator.h"
#include "PathGenerator.h"
#include "ObjectAccessor.h"
diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h
index d7cb956e541..dc42dc74991 100755
--- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h
@@ -32,7 +32,7 @@ class FleeingMovementGenerator : public MovementGeneratorMedium< T, FleeingMovem
void DoReset(T*);
bool DoUpdate(T*, uint32);
- MovementGeneratorType GetMovementGeneratorType() { return FLEEING_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return FLEEING_MOTION_TYPE; }
private:
void _setTargetLocation(T*);
@@ -49,7 +49,7 @@ class TimedFleeingMovementGenerator : public FleeingMovementGenerator<Creature>
FleeingMovementGenerator<Creature>(fright),
i_totalFleeTime(time) { }
- MovementGeneratorType GetMovementGeneratorType() override { return TIMED_FLEEING_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return TIMED_FLEEING_MOTION_TYPE; }
bool Update(Unit*, uint32) override;
void Finalize(Unit*) override;
diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
index ff28f3855a6..4245bffb864 100644
--- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
@@ -19,7 +19,6 @@
#include "HomeMovementGenerator.h"
#include "Creature.h"
#include "CreatureAI.h"
-#include "WorldPacket.h"
#include "MoveSplineInit.h"
#include "MoveSpline.h"
diff --git a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h
index 099d81ff54e..cbb6f279c6d 100644
--- a/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h
@@ -38,7 +38,7 @@ class HomeMovementGenerator<Creature> : public MovementGeneratorMedium< Creature
void DoFinalize(Creature*);
void DoReset(Creature*);
bool DoUpdate(Creature*, const uint32);
- MovementGeneratorType GetMovementGeneratorType() override { return HOME_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return HOME_MOTION_TYPE; }
private:
void _setTargetLocation(Creature*);
diff --git a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp
index cdbc1a8919f..3f91032dde6 100644
--- a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.cpp
@@ -74,12 +74,23 @@ void RotateMovementGenerator::Finalize(Unit* unit)
void DistractMovementGenerator::Initialize(Unit* owner)
{
+ // Distracted creatures stand up if not standing
+ if (!owner->IsStandState())
+ owner->SetStandState(UNIT_STAND_STATE_STAND);
+
owner->AddUnitState(UNIT_STATE_DISTRACTED);
}
void DistractMovementGenerator::Finalize(Unit* owner)
{
owner->ClearUnitState(UNIT_STATE_DISTRACTED);
+
+ // If this is a creature, then return orientation to original position (for idle movement creatures)
+ if (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature())
+ {
+ float angle = owner->ToCreature()->GetHomePosition().GetOrientation();
+ owner->SetFacingTo(angle);
+ }
}
bool DistractMovementGenerator::Update(Unit* /*owner*/, uint32 time_diff)
diff --git a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h
index e4ea99e00cb..30a8b9b868e 100755
--- a/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/IdleMovementGenerator.h
@@ -29,7 +29,7 @@ class IdleMovementGenerator : public MovementGenerator
void Finalize(Unit*) override { }
void Reset(Unit*) override;
bool Update(Unit*, uint32) override { return true; }
- MovementGeneratorType GetMovementGeneratorType() override { return IDLE_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return IDLE_MOTION_TYPE; }
};
extern IdleMovementGenerator si_idleMovement;
@@ -43,7 +43,7 @@ class RotateMovementGenerator : public MovementGenerator
void Finalize(Unit*) override;
void Reset(Unit* owner) override { Initialize(owner); }
bool Update(Unit*, uint32) override;
- MovementGeneratorType GetMovementGeneratorType() override { return ROTATE_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return ROTATE_MOTION_TYPE; }
private:
uint32 m_duration, m_maxDuration;
@@ -59,7 +59,7 @@ class DistractMovementGenerator : public MovementGenerator
void Finalize(Unit*) override;
void Reset(Unit* owner) override { Initialize(owner); }
bool Update(Unit*, uint32) override;
- MovementGeneratorType GetMovementGeneratorType() override { return DISTRACT_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return DISTRACT_MOTION_TYPE; }
private:
uint32 m_timer;
@@ -71,7 +71,7 @@ class AssistanceDistractMovementGenerator : public DistractMovementGenerator
AssistanceDistractMovementGenerator(uint32 timer) :
DistractMovementGenerator(timer) { }
- MovementGeneratorType GetMovementGeneratorType() override { return ASSISTANCE_DISTRACT_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return ASSISTANCE_DISTRACT_MOTION_TYPE; }
void Finalize(Unit*) override;
};
diff --git a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
index e967bd7f0ba..f143e19b24b 100644
--- a/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
@@ -38,7 +38,7 @@ class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementG
void unitSpeedChanged() { i_recalculateSpeed = true; }
- MovementGeneratorType GetMovementGeneratorType() { return POINT_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return POINT_MOTION_TYPE; }
void GetDestination(float& x, float& y, float& z) const { x = i_x; y = i_y; z = i_z; }
private:
@@ -55,7 +55,7 @@ class AssistanceMovementGenerator : public PointMovementGenerator<Creature>
AssistanceMovementGenerator(float _x, float _y, float _z) :
PointMovementGenerator<Creature>(0, _x, _y, _z, true) { }
- MovementGeneratorType GetMovementGeneratorType() override { return ASSISTANCE_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return ASSISTANCE_MOTION_TYPE; }
void Finalize(Unit*) override;
};
@@ -68,7 +68,7 @@ class EffectMovementGenerator : public MovementGenerator
void Finalize(Unit*) override;
void Reset(Unit*) override { }
bool Update(Unit*, uint32) override;
- MovementGeneratorType GetMovementGeneratorType() override { return EFFECT_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return EFFECT_MOTION_TYPE; }
private:
uint32 m_Id;
};
diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
index 0341af299be..86f0e6e20eb 100644
--- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
@@ -17,9 +17,7 @@
*/
#include "Creature.h"
-#include "MapManager.h"
#include "RandomMovementGenerator.h"
-#include "ObjectAccessor.h"
#include "Map.h"
#include "Util.h"
#include "CreatureGroups.h"
diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h
index 175e512c35d..763e3294613 100644
--- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h
@@ -33,7 +33,7 @@ class RandomMovementGenerator : public MovementGeneratorMedium< T, RandomMovemen
void DoReset(T*);
bool DoUpdate(T*, const uint32);
bool GetResetPos(T*, float& x, float& y, float& z);
- MovementGeneratorType GetMovementGeneratorType() { return RANDOM_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return RANDOM_MOTION_TYPE; }
private:
TimeTrackerSmall i_nextMoveTime;
diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h
index 44d64909a3c..77a669e0738 100755
--- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h
@@ -73,7 +73,7 @@ class ChaseMovementGenerator : public TargetedMovementGeneratorMedium<T, ChaseMo
: TargetedMovementGeneratorMedium<T, ChaseMovementGenerator<T> >(target, offset, angle) { }
~ChaseMovementGenerator() { }
- MovementGeneratorType GetMovementGeneratorType() { return CHASE_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return CHASE_MOTION_TYPE; }
void DoInitialize(T*);
void DoFinalize(T*);
@@ -97,7 +97,7 @@ class FollowMovementGenerator : public TargetedMovementGeneratorMedium<T, Follow
: TargetedMovementGeneratorMedium<T, FollowMovementGenerator<T> >(target, offset, angle) { }
~FollowMovementGenerator() { }
- MovementGeneratorType GetMovementGeneratorType() { return FOLLOW_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return FOLLOW_MOTION_TYPE; }
void DoInitialize(T*);
void DoFinalize(T*);
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
index 47e8f18810c..46ccd8638da 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
@@ -19,7 +19,6 @@
#include "WaypointMovementGenerator.h"
//Extended headers
#include "ObjectMgr.h"
-#include "World.h"
#include "Transport.h"
//Flightmaster grid preloading
#include "MapManager.h"
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
index f65af3fb73d..eb8533159a9 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
@@ -72,7 +72,7 @@ class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Crea
void MovementInform(Creature*);
- MovementGeneratorType GetMovementGeneratorType() override { return WAYPOINT_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return WAYPOINT_MOTION_TYPE; }
// now path movement implmementation
void LoadPath(Creature*);
@@ -126,7 +126,7 @@ class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, Flig
void DoReset(Player*);
void DoFinalize(Player*);
bool DoUpdate(Player*, uint32);
- MovementGeneratorType GetMovementGeneratorType() override { return FLIGHT_MOTION_TYPE; }
+ MovementGeneratorType GetMovementGeneratorType() const override { return FLIGHT_MOTION_TYPE; }
TaxiPathNodeList const& GetPath() { return *i_path; }
uint32 GetPathAtMapEnd() const;
diff --git a/src/server/game/Movement/PathGenerator.cpp b/src/server/game/Movement/PathGenerator.cpp
index f8cb6afa7b6..0acfc7816fe 100644
--- a/src/server/game/Movement/PathGenerator.cpp
+++ b/src/server/game/Movement/PathGenerator.cpp
@@ -854,16 +854,16 @@ dtStatus PathGenerator::FindSmoothPath(float const* startPos, float const* endPo
npolys -= npos;
// Handle the connection.
- float startPos[VERTEX_SIZE], endPos[VERTEX_SIZE];
- if (dtStatusSucceed(_navMesh->getOffMeshConnectionPolyEndPoints(prevRef, polyRef, startPos, endPos)))
+ float connectionStartPos[VERTEX_SIZE], connectionEndPos[VERTEX_SIZE];
+ if (dtStatusSucceed(_navMesh->getOffMeshConnectionPolyEndPoints(prevRef, polyRef, connectionStartPos, connectionEndPos)))
{
if (nsmoothPath < maxSmoothPathSize)
{
- dtVcopy(&smoothPath[nsmoothPath*VERTEX_SIZE], startPos);
+ dtVcopy(&smoothPath[nsmoothPath*VERTEX_SIZE], connectionStartPos);
nsmoothPath++;
}
// Move position at the other side of the off-mesh link.
- dtVcopy(iterPos, endPos);
+ dtVcopy(iterPos, connectionEndPos);
_navMeshQuery->getPolyHeight(polys[0], iterPos, &iterPos[1]);
iterPos[1] += 0.5f;
}
diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp
index 05e22b6a34a..c0faf1867b7 100644
--- a/src/server/game/Movement/Spline/MoveSpline.cpp
+++ b/src/server/game/Movement/Spline/MoveSpline.cpp
@@ -17,10 +17,11 @@
*/
#include "MoveSpline.h"
-#include <sstream>
#include "Log.h"
#include "Creature.h"
+#include <sstream>
+
namespace Movement{
Location MoveSpline::ComputePosition() const
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp
index 973f348c2bb..114f683b601 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.cpp
+++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp
@@ -20,9 +20,6 @@
#include "MoveSpline.h"
#include "Unit.h"
#include "Transport.h"
-#include "Vehicle.h"
-#include "WorldPacket.h"
-#include "Opcodes.h"
#include "MovementPackets.h"
namespace Movement
diff --git a/src/server/game/Movement/Spline/Spline.cpp b/src/server/game/Movement/Spline/Spline.cpp
index ef326cbdd8e..25678086eab 100644
--- a/src/server/game/Movement/Spline/Spline.cpp
+++ b/src/server/game/Movement/Spline/Spline.cpp
@@ -205,7 +205,7 @@ void SplineBase::init_spline(const Vector3 * controls, index_type count, Evaluat
m_mode = m;
cyclic = false;
- (this->*initializers[m_mode])(controls, count, cyclic, 0);
+ (this->*initializers[m_mode])(controls, count, 0);
}
void SplineBase::init_cyclic_spline(const Vector3 * controls, index_type count, EvaluationMode m, index_type cyclic_point)
@@ -213,10 +213,10 @@ void SplineBase::init_cyclic_spline(const Vector3 * controls, index_type count,
m_mode = m;
cyclic = true;
- (this->*initializers[m_mode])(controls, count, cyclic, cyclic_point);
+ (this->*initializers[m_mode])(controls, count, cyclic_point);
}
-void SplineBase::InitLinear(const Vector3* controls, index_type count, bool cyclic, index_type cyclic_point)
+void SplineBase::InitLinear(const Vector3* controls, index_type count, index_type cyclic_point)
{
ASSERT(count >= 2);
const int real_size = count + 1;
@@ -236,7 +236,7 @@ void SplineBase::InitLinear(const Vector3* controls, index_type count, bool cycl
index_hi = cyclic ? count : (count - 1);
}
-void SplineBase::InitCatmullRom(const Vector3* controls, index_type count, bool cyclic, index_type cyclic_point)
+void SplineBase::InitCatmullRom(const Vector3* controls, index_type count, index_type cyclic_point)
{
const int real_size = count + (cyclic ? (1+2) : (1+1));
@@ -269,7 +269,7 @@ void SplineBase::InitCatmullRom(const Vector3* controls, index_type count, bool
index_hi = high_index + (cyclic ? 1 : 0);
}
-void SplineBase::InitBezier3(const Vector3* controls, index_type count, bool /*cyclic*/, index_type /*cyclic_point*/)
+void SplineBase::InitBezier3(const Vector3* controls, index_type count, index_type /*cyclic_point*/)
{
index_type c = count / 3u * 3u;
index_type t = c / 3u;
diff --git a/src/server/game/Movement/Spline/Spline.h b/src/server/game/Movement/Spline/Spline.h
index 7b4f5ab1e54..9f1068ccfaf 100644
--- a/src/server/game/Movement/Spline/Spline.h
+++ b/src/server/game/Movement/Spline/Spline.h
@@ -76,10 +76,10 @@ protected:
typedef float (SplineBase::*SegLenghtMethtod)(index_type) const;
static SegLenghtMethtod seglengths[ModesEnd];
- void InitLinear(const Vector3*, index_type, bool, index_type);
- void InitCatmullRom(const Vector3*, index_type, bool, index_type);
- void InitBezier3(const Vector3*, index_type, bool, index_type);
- typedef void (SplineBase::*InitMethtod)(const Vector3*, index_type, bool, index_type);
+ void InitLinear(const Vector3*, index_type, index_type);
+ void InitCatmullRom(const Vector3*, index_type, index_type);
+ void InitBezier3(const Vector3*, index_type, index_type);
+ typedef void (SplineBase::*InitMethtod)(const Vector3*, index_type, index_type);
static InitMethtod initializers[ModesEnd];
void UninitializedSpline() const { ASSERT(false);}
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
index d91dc2bc469..57fced33988 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
@@ -119,7 +119,7 @@ bool OPvPCapturePoint::AddObject(uint32 type, uint32 entry, uint32 map, float x,
bool OPvPCapturePoint::AddCreature(uint32 type, uint32 entry, uint32 map, float x, float y, float z, float o, TeamId /*teamId = TEAM_NEUTRAL*/, uint32 spawntimedelay /*= 0*/)
{
- if (ObjectGuid::LowType guid = sObjectMgr->AddCreData(entry, map, x, y, z, o, spawntimedelay))
+ if (ObjectGuid::LowType guid = sObjectMgr->AddCreatureData(entry, map, x, y, z, o, spawntimedelay))
{
AddCre(type, guid);
return true;
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h
index cb86f1e9056..3763597ae93 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvP.h
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.h
@@ -236,7 +236,7 @@ class OutdoorPvP : public ZoneScript
// awards rewards for player kill
virtual void AwardKillBonus(Player* /*player*/) { }
- uint32 GetTypeId() {return m_TypeId;}
+ uint32 GetTypeId() const {return m_TypeId;}
virtual bool HandleDropFlag(Player* player, uint32 spellId);
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp
index c1098b4cf52..5036e5cde1a 100644
--- a/src/server/game/Quests/QuestDef.cpp
+++ b/src/server/game/Quests/QuestDef.cpp
@@ -19,7 +19,6 @@
#include "QuestDef.h"
#include "Player.h"
#include "World.h"
-#include "ObjectMgr.h"
#include "QuestPackets.h"
Quest::Quest(Field* questRecord)
diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp
index 225ab7386c6..2c814a956c1 100644
--- a/src/server/game/Scripting/MapScripts.cpp
+++ b/src/server/game/Scripting/MapScripts.cpp
@@ -18,13 +18,11 @@
#include "CellImpl.h"
#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
#include "GossipDef.h"
#include "Map.h"
-#include "MapManager.h"
-#include "MapRefManager.h"
#include "ObjectMgr.h"
#include "Pet.h"
+#include "Item.h"
#include "ScriptedCreature.h"
#include "ScriptMgr.h"
#include "Transport.h"
diff --git a/src/server/game/Server/Packet.cpp b/src/server/game/Server/Packet.cpp
index 10e935e87c7..38be5fc3bf7 100644
--- a/src/server/game/Server/Packet.cpp
+++ b/src/server/game/Server/Packet.cpp
@@ -15,4 +15,4 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Packet.h"
+//#include "Packet.h"
diff --git a/src/server/game/Server/Packets/ChannelPackets.h b/src/server/game/Server/Packets/ChannelPackets.h
index 7464e9bd391..b41be6e93d1 100644
--- a/src/server/game/Server/Packets/ChannelPackets.h
+++ b/src/server/game/Server/Packets/ChannelPackets.h
@@ -31,8 +31,8 @@ namespace WorldPackets
public:
struct ChannelPlayer
{
- ChannelPlayer(ObjectGuid const& guid, uint32 realm, uint8 flags) :
- Guid(guid), VirtualRealmAddress(realm), Flags(flags) { }
+ ChannelPlayer(ObjectGuid const& guid, uint32 virtualRealmAddress, uint8 flags) :
+ Guid(guid), VirtualRealmAddress(virtualRealmAddress), Flags(flags) { }
ObjectGuid Guid; ///< Player Guid
uint32 VirtualRealmAddress;
diff --git a/src/server/game/Server/Packets/MovementPackets.cpp b/src/server/game/Server/Packets/MovementPackets.cpp
index 789c37cd72a..c8c26af2be2 100644
--- a/src/server/game/Server/Packets/MovementPackets.cpp
+++ b/src/server/game/Server/Packets/MovementPackets.cpp
@@ -674,3 +674,18 @@ void WorldPackets::Movement::MoveTimeSkipped::Read()
_worldPacket >> MoverGUID;
_worldPacket >> TimeSkipped;
}
+
+void WorldPackets::Movement::SummonResponse::Read()
+{
+ _worldPacket >> SummonerGUID;
+ Accept = _worldPacket.ReadBit();
+}
+
+WorldPacket const* WorldPackets::Movement::ControlUpdate::Write()
+{
+ _worldPacket << Guid;
+ _worldPacket.WriteBit(On);
+ _worldPacket.FlushBits();
+
+ return &_worldPacket;
+}
diff --git a/src/server/game/Server/Packets/MovementPackets.h b/src/server/game/Server/Packets/MovementPackets.h
index 2543a990937..b00d29f5501 100644
--- a/src/server/game/Server/Packets/MovementPackets.h
+++ b/src/server/game/Server/Packets/MovementPackets.h
@@ -401,6 +401,28 @@ namespace WorldPackets
ObjectGuid MoverGUID;
uint32 TimeSkipped = 0;
};
+
+ class SummonResponse final : public ClientPacket
+ {
+ public:
+ SummonResponse(WorldPacket&& packet) : ClientPacket(CMSG_SUMMON_RESPONSE, std::move(packet)) { }
+
+ void Read() override;
+
+ bool Accept = false;
+ ObjectGuid SummonerGUID;
+ };
+
+ class ControlUpdate final : public ServerPacket
+ {
+ public:
+ ControlUpdate() : ServerPacket(SMSG_CONTROL_UPDATE, 16 + 1) { }
+
+ WorldPacket const* Write() override;
+
+ ObjectGuid Guid;
+ bool On = false;
+ };
}
ByteBuffer& operator<<(ByteBuffer& data, Movement::MonsterSplineFilterKey const& monsterSplineFilterKey);
diff --git a/src/server/game/Server/Packets/PartyPackets.cpp b/src/server/game/Server/Packets/PartyPackets.cpp
index 81cdfd22649..1ca4d8095d0 100644
--- a/src/server/game/Server/Packets/PartyPackets.cpp
+++ b/src/server/game/Server/Packets/PartyPackets.cpp
@@ -475,10 +475,10 @@ void WorldPackets::Party::PartyMemberStats::Initialize(Player const* player)
if (aurApp->GetFlags() & AFLAG_SCALABLE)
{
- for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (uint32 e = 0; e < MAX_SPELL_EFFECTS; ++e)
{
- float scale = 0.f;
- if (AuraEffect const* eff = aurApp->GetBase()->GetEffect(i))
+ float scale = 0.0f;
+ if (AuraEffect const* eff = aurApp->GetBase()->GetEffect(e))
scale = float(eff->GetAmount());
aura.EffectScales.push_back(scale);
}
@@ -526,10 +526,10 @@ void WorldPackets::Party::PartyMemberStats::Initialize(Player const* player)
if (aurApp->GetFlags() & AFLAG_SCALABLE)
{
- for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
+ for (uint32 e = 0; e < MAX_SPELL_EFFECTS; ++e)
{
- float scale = 0.f;
- if (AuraEffect const* eff = aurApp->GetBase()->GetEffect(i))
+ float scale = 0.0f;
+ if (AuraEffect const* eff = aurApp->GetBase()->GetEffect(e))
scale = float(eff->GetAmount());
aura.EffectScales.push_back(scale);
}
diff --git a/src/server/game/Server/Packets/QuestPackets.cpp b/src/server/game/Server/Packets/QuestPackets.cpp
index 7135a79a74e..687ab6402f4 100644
--- a/src/server/game/Server/Packets/QuestPackets.cpp
+++ b/src/server/game/Server/Packets/QuestPackets.cpp
@@ -494,3 +494,11 @@ void WorldPackets::Quest::QuestConfirmAccept::Read()
{
_worldPacket >> QuestID;
}
+
+WorldPacket const* WorldPackets::Quest::QuestPushResult::Write()
+{
+ _worldPacket << SenderGUID;
+ _worldPacket << uint8(Result);
+
+ return &_worldPacket;
+}
diff --git a/src/server/game/Server/Packets/QuestPackets.h b/src/server/game/Server/Packets/QuestPackets.h
index 90568ed36ea..377f0ca6a64 100644
--- a/src/server/game/Server/Packets/QuestPackets.h
+++ b/src/server/game/Server/Packets/QuestPackets.h
@@ -484,6 +484,17 @@ namespace WorldPackets
int32 QuestID = 0;
};
+
+ class QuestPushResult final : public ServerPacket
+ {
+ public:
+ QuestPushResult() : ServerPacket(SMSG_QUEST_PUSH_RESULT, 16 + 1) { }
+
+ WorldPacket const* Write() override;
+
+ ObjectGuid SenderGUID;
+ uint8 Result = 0;
+ };
}
}
diff --git a/src/server/game/Server/Packets/SpellPackets.cpp b/src/server/game/Server/Packets/SpellPackets.cpp
index 832dfc82b06..91821780575 100644
--- a/src/server/game/Server/Packets/SpellPackets.cpp
+++ b/src/server/game/Server/Packets/SpellPackets.cpp
@@ -16,7 +16,6 @@
*/
#include "SpellPackets.h"
-#include "SpellAuraEffects.h"
#include "MovementPackets.h"
void WorldPackets::Spells::CancelAura::Read()
@@ -108,6 +107,7 @@ WorldPacket const* WorldPackets::Spells::AuraUpdate::Write()
{
AuraDataInfo const& data = *aura.AuraData;
_worldPacket << uint32(data.SpellID);
+ _worldPacket << uint32(data.SpellXSpellVisualID);
_worldPacket << uint8(data.Flags);
_worldPacket << uint32(data.ActiveFlags);
_worldPacket << uint16(data.CastLevel);
@@ -188,8 +188,10 @@ ByteBuffer& operator>>(ByteBuffer& buffer, WorldPackets::Spells::MissileTrajecto
ByteBuffer& operator>>(ByteBuffer& buffer, WorldPackets::Spells::SpellCastRequest& request)
{
buffer >> request.CastID;
+ buffer >> request.Misc[0];
+ buffer >> request.Misc[1];
buffer >> request.SpellID;
- buffer >> request.Misc;
+ buffer >> request.SpellXSpellVisualID;
buffer >> request.Target;
buffer >> request.MissileTrajectory;
buffer >> request.Charmer;
@@ -228,7 +230,6 @@ void WorldPackets::Spells::PetCastSpell::Read()
_worldPacket >> Cast;
}
-
void WorldPackets::Spells::UseItem::Read()
{
_worldPacket >> PackSlot;
@@ -315,13 +316,6 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellAmmo const&
return data;
}
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::ProjectileVisualData const& projectileVisual)
-{
- data << int32(projectileVisual.ID[0]);
- data << int32(projectileVisual.ID[1]);
- return data;
-}
-
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::CreatureImmunities const& immunities)
{
data << int32(immunities.School);
@@ -343,6 +337,7 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastData con
data << spellCastData.CasterUnit;
data << uint8(spellCastData.CastID);
data << int32(spellCastData.SpellID);
+ data << uint32(spellCastData.SpellXSpellVisualID);
data << uint32(spellCastData.CastFlags);
data << uint32(spellCastData.CastTime);
data << uint32(spellCastData.HitTargets.size());
@@ -372,17 +367,13 @@ ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastData con
for (WorldPackets::Spells::TargetLocation const& targetLoc : spellCastData.TargetPoints)
data << targetLoc;
- data.WriteBits(spellCastData.CastFlagsEx, 18);
+ data.WriteBits(spellCastData.CastFlagsEx, 20);
data.WriteBit(spellCastData.RemainingRunes.is_initialized());
- data.WriteBit(spellCastData.ProjectileVisual.is_initialized());
data.FlushBits();
if (spellCastData.RemainingRunes)
data << *spellCastData.RemainingRunes;
- if (spellCastData.ProjectileVisual)
- data << *spellCastData.ProjectileVisual;
-
return data;
}
@@ -423,6 +414,7 @@ WorldPacket const* WorldPackets::Spells::SpellFailure::Write()
_worldPacket << CasterUnit;
_worldPacket << uint8(CastID);
_worldPacket << int32(SpellID);
+ _worldPacket << uint32(SpelXSpellVisualID);
_worldPacket << uint16(Reason);
return &_worldPacket;
@@ -482,6 +474,9 @@ WorldPacket const* WorldPackets::Spells::UnlearnedSpells::Write()
for (uint32 spellId : SpellID)
_worldPacket << uint32(spellId);
+ _worldPacket.WriteBit(SuppressMessaging);
+ _worldPacket.FlushBits();
+
return &_worldPacket;
}
@@ -586,7 +581,8 @@ WorldPacket const* WorldPackets::Spells::ClearSpellCharges::Write()
WorldPacket const* WorldPackets::Spells::SetSpellCharges::Write()
{
_worldPacket << int32(Category);
- _worldPacket << float(Count);
+ _worldPacket << uint32(NextRecoveryTime);
+ _worldPacket << uint8(ConsumedCharges);
_worldPacket.WriteBit(IsPet);
_worldPacket.FlushBits();
@@ -742,3 +738,29 @@ WorldPacket const* WorldPackets::Spells::MirrorImageCreatureData::Write()
return &_worldPacket;
}
+
+void WorldPackets::Spells::SpellClick::Read()
+{
+ _worldPacket >> SpellClickUnitGuid;
+ TryAutoDismount = _worldPacket.ReadBit();
+}
+
+WorldPacket const* WorldPackets::Spells::ConvertRune::Write()
+{
+ _worldPacket << uint8(Index);
+ _worldPacket << uint8(Rune);
+
+ return &_worldPacket;
+}
+
+WorldPacket const* WorldPackets::Spells::ResyncRunes::Write()
+{
+ _worldPacket << uint32(Runes.size());
+ for (auto const& rune : Runes)
+ {
+ _worldPacket << uint8(rune.RuneType);
+ _worldPacket << uint8(rune.Cooldown);
+ }
+
+ return &_worldPacket;
+}
diff --git a/src/server/game/Server/Packets/SpellPackets.h b/src/server/game/Server/Packets/SpellPackets.h
index a3fa6c10925..f5df5e32da0 100644
--- a/src/server/game/Server/Packets/SpellPackets.h
+++ b/src/server/game/Server/Packets/SpellPackets.h
@@ -150,6 +150,7 @@ namespace WorldPackets
struct AuraDataInfo
{
int32 SpellID = 0;
+ uint32 SpellXSpellVisualID = 0;
uint8 Flags = 0;
uint32 ActiveFlags = 0;
uint16 CastLevel = 1;
@@ -213,13 +214,14 @@ namespace WorldPackets
{
uint8 CastID = 0;
int32 SpellID = 0;
- int32 Misc = 0;
+ uint32 SpellXSpellVisualID = 0;
uint8 SendCastFlags = 0;
SpellTargetData Target;
MissileTrajectoryRequest MissileTrajectory;
Optional<MovementInfo> MoveUpdate;
std::vector<SpellWeight> Weight;
ObjectGuid Charmer;
+ int32 Misc[2] = { };
};
class CastSpell final : public ClientPacket
@@ -287,11 +289,6 @@ namespace WorldPackets
int8 InventoryType = 0;
};
- struct ProjectileVisualData
- {
- int32 ID[2];
- };
-
struct CreatureImmunities
{
uint32 School = 0;
@@ -311,6 +308,7 @@ namespace WorldPackets
ObjectGuid CasterUnit;
uint8 CastID = 0;
int32 SpellID = 0;
+ uint32 SpellXSpellVisualID = 0;
uint32 CastFlags = 0;
uint32 CastFlagsEx = 0;
uint32 CastTime = 0;
@@ -322,7 +320,6 @@ namespace WorldPackets
Optional<RuneData> RemainingRunes;
MissileTrajectoryResult MissileTrajectory;
SpellAmmo Ammo;
- Optional<ProjectileVisualData> ProjectileVisual;
uint8 DestLocSpellCastIndex = 0;
std::vector<TargetLocation> TargetPoints;
CreatureImmunities Immunities;
@@ -370,6 +367,7 @@ namespace WorldPackets
ObjectGuid CasterUnit;
uint32 SpellID = 0;
+ uint32 SpelXSpellVisualID = 0;
uint16 Reason = 0;
uint8 CastID = 0;
};
@@ -431,6 +429,7 @@ namespace WorldPackets
WorldPacket const* Write() override;
std::vector<uint32> SpellID;
+ bool SuppressMessaging = false;
};
class CooldownEvent final : public ServerPacket
@@ -550,8 +549,9 @@ namespace WorldPackets
WorldPacket const* Write() override;
bool IsPet = false;
- float Count = 0.0f;
- int32 Category = 0;
+ uint32 Category = 0;
+ uint32 NextRecoveryTime = 0;
+ uint8 ConsumedCharges = 0;
};
struct SpellChargeEntry
@@ -738,6 +738,44 @@ namespace WorldPackets
ObjectGuid UnitGUID;
uint32 DisplayID = 0;
};
+
+ class SpellClick final : public ClientPacket
+ {
+ public:
+ SpellClick(WorldPacket&& packet) : ClientPacket(CMSG_SPELL_CLICK, std::move(packet)) { }
+
+ void Read() override;
+
+ ObjectGuid SpellClickUnitGuid;
+ bool TryAutoDismount = false;
+ };
+
+ class ConvertRune final : public ServerPacket
+ {
+ public:
+ ConvertRune() : ServerPacket(SMSG_CONVERT_RUNE, 1 + 1) { }
+
+ WorldPacket const* Write() override;
+
+ uint8 Index = 0;
+ uint8 Rune = 0;
+ };
+
+ class ResyncRunes final : public ServerPacket
+ {
+ public:
+ struct ResyncRune
+ {
+ uint8 RuneType = 0;
+ uint8 Cooldown = 0;
+ };
+
+ ResyncRunes(size_t size) : ServerPacket(SMSG_RESYNC_RUNES, 4 + 2 * size) { }
+
+ WorldPacket const* Write() override;
+
+ std::vector<ResyncRune> Runes;
+ };
}
}
diff --git a/src/server/game/Server/Packets/TicketPackets.h b/src/server/game/Server/Packets/TicketPackets.h
index 050be771274..c25c02b7619 100644
--- a/src/server/game/Server/Packets/TicketPackets.h
+++ b/src/server/game/Server/Packets/TicketPackets.h
@@ -81,7 +81,7 @@ namespace WorldPackets
time_t OldestTicketTime = 0;
time_t UpdateTime = 0;
std::vector<GMTicketCase> Cases;
- };
+ };
class GMTicketAcknowledgeSurvey final : public ClientPacket
{
diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp
index 8d59f77b0ea..a72f6e0f3fa 100644
--- a/src/server/game/Server/Protocol/Opcodes.cpp
+++ b/src/server/game/Server/Protocol/Opcodes.cpp
@@ -244,19 +244,19 @@ void OpcodeTable::Initialize()
DEFINE_OPCODE_HANDLER_OLD(CMSG_CALENDAR_REMOVE_EVENT, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleCalendarRemoveEvent );
DEFINE_OPCODE_HANDLER_OLD(CMSG_CALENDAR_REMOVE_INVITE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleCalendarEventRemoveInvite );
DEFINE_OPCODE_HANDLER_OLD(CMSG_CALENDAR_UPDATE_EVENT, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleCalendarUpdateEvent );
- DEFINE_HANDLER(CMSG_CANCEL_AURA, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Spells::CancelAura, &WorldSession::HandleCancelAuraOpcode);
+ DEFINE_HANDLER(CMSG_CANCEL_AURA, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Spells::CancelAura, &WorldSession::HandleCancelAuraOpcode);
DEFINE_OPCODE_HANDLER_OLD(CMSG_CANCEL_AUTO_REPEAT_SPELL, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleCancelAutoRepeatSpellOpcode);
- DEFINE_HANDLER(CMSG_CANCEL_CAST, STATUS_UNHANDLED, PROCESS_THREADSAFE, WorldPackets::Spells::CancelCast, &WorldSession::HandleCancelCastOpcode);
+ DEFINE_HANDLER(CMSG_CANCEL_CAST, STATUS_LOGGEDIN, PROCESS_THREADSAFE, WorldPackets::Spells::CancelCast, &WorldSession::HandleCancelCastOpcode);
DEFINE_OPCODE_HANDLER_OLD(CMSG_CANCEL_CHANNELLING, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleCancelChanneling );
- DEFINE_HANDLER(CMSG_CANCEL_GROWTH_AURA, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Spells::CancelGrowthAura, &WorldSession::HandleCancelGrowthAuraOpcode);
+ DEFINE_HANDLER(CMSG_CANCEL_GROWTH_AURA, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Spells::CancelGrowthAura, &WorldSession::HandleCancelGrowthAuraOpcode);
DEFINE_HANDLER(CMSG_CANCEL_MASTER_LOOT_ROLL, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_CANCEL_MOD_SPEED_NO_CONTROL_AURAS, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
- DEFINE_HANDLER(CMSG_CANCEL_MOUNT_AURA, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Spells::CancelMountAura, &WorldSession::HandleCancelMountAuraOpcode);
+ DEFINE_HANDLER(CMSG_CANCEL_MOUNT_AURA, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Spells::CancelMountAura, &WorldSession::HandleCancelMountAuraOpcode);
DEFINE_HANDLER(CMSG_CANCEL_QUEUED_SPELL, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_CANCEL_TEMP_ENCHANTMENT, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Item::CancelTempEnchantment, &WorldSession::HandleCancelTempEnchantmentOpcode);
DEFINE_HANDLER(CMSG_CANCEL_TRADE, STATUS_LOGGEDIN_OR_RECENTLY_LOGGOUT, PROCESS_THREADUNSAFE, WorldPackets::Trade::CancelTrade, &WorldSession::HandleCancelTradeOpcode);
DEFINE_HANDLER(CMSG_CAN_DUEL, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Duel::CanDuel, &WorldSession::HandleCanDuel);
- DEFINE_HANDLER(CMSG_CAST_SPELL, STATUS_UNHANDLED, PROCESS_THREADSAFE, WorldPackets::Spells::CastSpell, &WorldSession::HandleCastSpellOpcode);
+ DEFINE_HANDLER(CMSG_CAST_SPELL, STATUS_LOGGEDIN, PROCESS_THREADSAFE, WorldPackets::Spells::CastSpell, &WorldSession::HandleCastSpellOpcode);
DEFINE_HANDLER(CMSG_CHALLENGE_MODE_REQUEST_LEADERS, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_CHALLENGE_MODE_REQUEST_MAP_STATS, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_CHANGE_BAG_SLOT_FLAG, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
@@ -394,8 +394,8 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_GET_CHALLENGE_MODE_REWARDS, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_GET_GARRISON_INFO, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Garrison::GetGarrisonInfo, &WorldSession::HandleGetGarrisonInfo);
DEFINE_HANDLER(CMSG_GET_ITEM_PURCHASE_DATA, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Item::GetItemPurchaseData, &WorldSession::HandleGetItemPurchaseData);
- DEFINE_HANDLER(CMSG_GET_MIRROR_IMAGE_DATA, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Spells::GetMirrorImageData, &WorldSession::HandleMirrorImageDataRequest);
- DEFINE_HANDLER(CMSG_GET_PVP_OPTIONS_ENABLED, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Battleground::GetPVPOptionsEnabled, &WorldSession::HandleGetPVPOptionsEnabled);
+ DEFINE_HANDLER(CMSG_GET_MIRROR_IMAGE_DATA, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Spells::GetMirrorImageData, &WorldSession::HandleMirrorImageDataRequest);
+ DEFINE_HANDLER(CMSG_GET_PVP_OPTIONS_ENABLED, STATUS_LOGGEDIN, PROCESS_INPLACE, WorldPackets::Battleground::GetPVPOptionsEnabled, &WorldSession::HandleGetPVPOptionsEnabled);
DEFINE_HANDLER(CMSG_GET_REMAINING_GAME_TIME, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_GET_TROPHY_LIST, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_GET_UNDELETE_CHARACTER_COOLDOWN_STATUS, STATUS_AUTHED, PROCESS_THREADUNSAFE, WorldPackets::Character::GetUndeleteCharacterCooldownStatus, &WorldSession::HandleGetUndeleteCooldownStatus);
@@ -580,7 +580,7 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_OBJECT_UPDATE_RESCUED, STATUS_LOGGEDIN, PROCESS_INPLACE, WorldPackets::Misc::ObjectUpdateRescued, &WorldSession::HandleObjectUpdateRescuedOpcode);
DEFINE_HANDLER(CMSG_OFFER_PETITION, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Petition::OfferPetition, &WorldSession::HandleOfferPetition);
DEFINE_OPCODE_HANDLER_OLD(CMSG_OPENING_CINEMATIC, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleOpeningCinematic );
- DEFINE_HANDLER(CMSG_OPEN_ITEM, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Spells::OpenItem, &WorldSession::HandleOpenItemOpcode);
+ DEFINE_HANDLER(CMSG_OPEN_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Spells::OpenItem, &WorldSession::HandleOpenItemOpcode);
DEFINE_HANDLER(CMSG_OPEN_MISSION_NPC, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_OPEN_SHIPMENT_NPC, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_OPEN_TRADESKILL_NPC, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
@@ -604,7 +604,7 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_PET_BATTLE_REQUEST_WILD, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_PET_BATTLE_SCRIPT_ERROR_NOTIFY, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_OPCODE_HANDLER_OLD(CMSG_PET_CANCEL_AURA, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandlePetCancelAuraOpcode );
- DEFINE_HANDLER(CMSG_PET_CAST_SPELL, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Spells::PetCastSpell, &WorldSession::HandlePetCastSpellOpcode);
+ DEFINE_HANDLER(CMSG_PET_CAST_SPELL, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Spells::PetCastSpell, &WorldSession::HandlePetCastSpellOpcode);
DEFINE_OPCODE_HANDLER_OLD(CMSG_PET_RENAME, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandlePetRename );
DEFINE_OPCODE_HANDLER_OLD(CMSG_PET_SET_ACTION, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandlePetSetAction );
DEFINE_OPCODE_HANDLER_OLD(CMSG_PET_SPELL_AUTOCAST, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandlePetSpellAutocastOpcode );
@@ -662,7 +662,7 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_REPORT_PVP_PLAYER_AFK, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Battleground::ReportPvPPlayerAFK, &WorldSession::HandleReportPvPAFK);
DEFINE_HANDLER(CMSG_REQUEST_ACCOUNT_DATA, STATUS_AUTHED, PROCESS_THREADUNSAFE, WorldPackets::ClientConfig::RequestAccountData, &WorldSession::HandleRequestAccountData);
DEFINE_HANDLER(CMSG_REQUEST_BATTLEFIELD_STATUS, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Battleground::RequestBattlefieldStatus, &WorldSession::HandleRequestBattlefieldStatusOpcode);
- DEFINE_HANDLER(CMSG_REQUEST_CATEGORY_COOLDOWNS, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Spells::RequestCategoryCooldowns, &WorldSession::HandleRequestCategoryCooldowns);
+ DEFINE_HANDLER(CMSG_REQUEST_CATEGORY_COOLDOWNS, STATUS_LOGGEDIN, PROCESS_INPLACE, WorldPackets::Spells::RequestCategoryCooldowns, &WorldSession::HandleRequestCategoryCooldowns);
DEFINE_HANDLER(CMSG_REQUEST_CEMETERY_LIST, STATUS_LOGGEDIN, PROCESS_INPLACE, WorldPackets::Misc::RequestCemeteryList, &WorldSession::HandleRequestCemeteryList);
DEFINE_HANDLER(CMSG_REQUEST_CONQUEST_FORMULA_CONSTANTS, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_REQUEST_FORCED_REACTIONS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Reputation::RequestForcedReactions, &WorldSession::HandleRequestForcedReactionsOpcode);
@@ -695,7 +695,7 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_SCENE_PLAYBACK_CANCELED, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Scenes::ScenePlaybackCanceled, &WorldSession::HandleScenePlaybackCanceled);
DEFINE_HANDLER(CMSG_SCENE_PLAYBACK_COMPLETE, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Scenes::ScenePlaybackComplete, &WorldSession::HandleScenePlaybackComplete);
DEFINE_HANDLER(CMSG_SCENE_TRIGGER_EVENT, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Scenes::SceneTriggerEvent, &WorldSession::HandleSceneTriggerEvent);
- DEFINE_HANDLER(CMSG_SELF_RES, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Spells::SelfRes, &WorldSession::HandleSelfResOpcode);
+ DEFINE_HANDLER(CMSG_SELF_RES, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Spells::SelfRes, &WorldSession::HandleSelfResOpcode);
DEFINE_HANDLER(CMSG_SELL_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Item::SellItem, &WorldSession::HandleSellItemOpcode);
DEFINE_HANDLER(CMSG_SELL_WOW_TOKEN_CONFIRM, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_SELL_WOW_TOKEN_START, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
@@ -755,13 +755,13 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_SORT_BAGS, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_SORT_BANK_BAGS, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_SORT_REAGENT_BANK_BAGS, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
- DEFINE_OPCODE_HANDLER_OLD(CMSG_SPELL_CLICK, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleSpellClick );
+ DEFINE_HANDLER(CMSG_SPELL_CLICK, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Spells::SpellClick, &WorldSession::HandleSpellClick);
DEFINE_HANDLER(CMSG_SPIRIT_HEALER_ACTIVATE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::NPC::SpiritHealerActivate, &WorldSession::HandleSpiritHealerActivate);
DEFINE_HANDLER(CMSG_SPLIT_ITEM, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Item::SplitItem, &WorldSession::HandleSplitItemOpcode);
DEFINE_HANDLER(CMSG_STAND_STATE_CHANGE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Misc::StandStateChange, &WorldSession::HandleStandStateChangeOpcode);
DEFINE_HANDLER(CMSG_START_SPECTATOR_WAR_GAME, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_START_WAR_GAME, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
- DEFINE_OPCODE_HANDLER_OLD(CMSG_SUMMON_RESPONSE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleSummonResponseOpcode );
+ DEFINE_HANDLER(CMSG_SUMMON_RESPONSE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Movement::SummonResponse, &WorldSession::HandleSummonResponseOpcode);
DEFINE_HANDLER(CMSG_SUPPORT_TICKET_SUBMIT_BUG, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Ticket::SupportTicketSubmitBug, &WorldSession::HandleSupportTicketSubmitBug);
DEFINE_HANDLER(CMSG_SUPPORT_TICKET_SUBMIT_COMPLAINT, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Ticket::SupportTicketSubmitComplaint, &WorldSession::HandleSupportTicketSubmitComplaint);
DEFINE_HANDLER(CMSG_SUPPORT_TICKET_SUBMIT_SUGGESTION, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Ticket::SupportTicketSubmitSuggestion, &WorldSession::HandleSupportTicketSubmitSuggestion);
@@ -797,7 +797,7 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_UI_TIME_REQUEST, STATUS_LOGGEDIN, PROCESS_INPLACE, WorldPackets::Misc::UITimeRequest, &WorldSession::HandleUITimeRequest);
DEFINE_HANDLER(CMSG_UNACCEPT_TRADE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Trade::UnacceptTrade, &WorldSession::HandleUnacceptTradeOpcode);
DEFINE_HANDLER(CMSG_UNDELETE_CHARACTER, STATUS_AUTHED, PROCESS_THREADUNSAFE, WorldPackets::Character::UndeleteCharacter, &WorldSession::HandleCharUndeleteOpcode);
- DEFINE_HANDLER(CMSG_UNLEARN_SKILL, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Spells::UnlearnSkill, &WorldSession::HandleUnlearnSkillOpcode);
+ DEFINE_HANDLER(CMSG_UNLEARN_SKILL, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Spells::UnlearnSkill, &WorldSession::HandleUnlearnSkillOpcode);
DEFINE_HANDLER(CMSG_UNLEARN_SPECIALIZATION, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_UNLOCK_VOID_STORAGE, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::VoidStorage::UnlockVoidStorage, &WorldSession::HandleVoidStorageUnlock);
DEFINE_HANDLER(CMSG_UPDATE_ACCOUNT_DATA, STATUS_AUTHED, PROCESS_THREADUNSAFE, WorldPackets::ClientConfig::UserClientUpdateAccountData, &WorldSession::HandleUpdateAccountData);
@@ -812,7 +812,7 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_USED_FOLLOW, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_USE_CRITTER_ITEM, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_USE_EQUIPMENT_SET, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::EquipmentSet::UseEquipmentSet, &WorldSession::HandleUseEquipmentSet);
- DEFINE_HANDLER(CMSG_USE_ITEM, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::Spells::UseItem, &WorldSession::HandleUseItemOpcode);
+ DEFINE_HANDLER(CMSG_USE_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Spells::UseItem, &WorldSession::HandleUseItemOpcode);
DEFINE_HANDLER(CMSG_USE_TOY, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_VIOLENCE_LEVEL, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Misc::ViolenceLevel, &WorldSession::HandleViolenceLevel);
DEFINE_HANDLER(CMSG_VOICE_ADD_IGNORE, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
@@ -879,7 +879,7 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_REPLICATE_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_WON_NOTIFICATION, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AURA_POINTS_DEPLETED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_AURA_UPDATE, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_AURA_UPDATE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUTH_CHALLENGE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUTH_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AVAILABLE_VOICE_CHANNEL, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
@@ -934,7 +934,7 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_QUEUE_STATUS_UPDATE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BF_MGR_STATE_CHANGED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BINDER_CONFIRM, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_BIND_POINT_UPDATE, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_BIND_POINT_UPDATE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BLACK_MARKET_BID_ON_ITEM_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BLACK_MARKET_OPEN_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_BLACK_MARKET_OUTBID, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
@@ -974,8 +974,8 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CANCEL_SPELL_VISUAL, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CANCEL_SPELL_VISUAL_KIT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CAN_DUEL_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_CAST_FAILED, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_CATEGORY_COOLDOWN, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_CAST_FAILED, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_CATEGORY_COOLDOWN, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CHALLEGE_MODE_REWARDS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CHALLENGE_MODE_ALL_MAP_STATS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CHALLENGE_MODE_COMPLETE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
@@ -1013,12 +1013,12 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CHEAT_IGNORE_DIMISHING_RETURNS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CHECK_WARGAME_ENTRY, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CHUNKED_PACKET, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_ALL_SPELL_CHARGES, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_ALL_SPELL_CHARGES, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_BOSS_EMOTES, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_COOLDOWN, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_COOLDOWNS, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_COOLDOWN, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_COOLDOWNS, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_LOSS_OF_CONTROL, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_SPELL_CHARGES, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_SPELL_CHARGES, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CLEAR_TARGET, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_COIN_REMOVED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_COMBAT_EVENT_FAILED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
@@ -1032,10 +1032,10 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CONQUEST_FORMULA_CONSTANTS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CONSOLE_WRITE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CONTACT_LIST, STATUS_NEVER, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_CONTROL_UPDATE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_CONVERT_RUNE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_CONTROL_UPDATE, STATUS_NEVER, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_CONVERT_RUNE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_COOLDOWN_CHEAT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_COOLDOWN_EVENT, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_COOLDOWN_EVENT, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CORPSE_LOCATION, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CORPSE_RECLAIM_DELAY, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_CORPSE_TRANSPORT_QUERY, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
@@ -1222,7 +1222,7 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_HEALTH_UPDATE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_HIGHEST_THREAT_UPDATE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_HOTFIX_NOTIFY, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_HOTFIX_NOTIFY_BLOB, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_HOTFIX_NOTIFY_BLOB, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INCREASE_CAST_TIME_FOR_SPELL, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INITIALIZE_FACTIONS, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_INITIAL_SETUP, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
@@ -1323,10 +1323,10 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_MASTER_LOOT_CANDIDATE_LIST, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_MESSAGE_BOX, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_MINIMAP_PING, STATUS_NEVER, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_MIRROR_IMAGE_COMPONENTED_DATA, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_MIRROR_IMAGE_CREATURE_DATA, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_MIRROR_IMAGE_COMPONENTED_DATA, STATUS_NEVER, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_MIRROR_IMAGE_CREATURE_DATA, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_MISSILE_CANCEL, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_MODIFY_COOLDOWN, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_MODIFY_COOLDOWN, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOTD, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOUNT_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_MOVE_APPLY_MOVEMENT_FORCE, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
@@ -1456,7 +1456,7 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_BATTLE_REQUEST_FAILED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_BATTLE_ROUND_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_BATTLE_SLOT_UPDATES, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_CAST_FAILED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_CAST_FAILED, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_CLEAR_SPELLS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_DISMISS_SOUND, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_PET_GOD_MODE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
@@ -1494,8 +1494,8 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_PROPOSE_LEVEL_GRANT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_PVP_CREDIT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_PVP_LOG_DATA, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_PVP_OPTIONS_ENABLED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_PVP_SEASON, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_PVP_OPTIONS_ENABLED, STATUS_NEVER, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_PVP_SEASON, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUERY_BATTLE_PET_NAME_RESPONSE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUERY_CREATURE_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUERY_GAME_OBJECT_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
@@ -1523,7 +1523,7 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_GIVER_STATUS_MULTIPLE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_LOG_FULL, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_POI_QUERY_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_PUSH_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_PUSH_RESULT, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_UPDATE_ADD_CREDIT, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_UPDATE_ADD_CREDIT_SIMPLE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_QUEST_UPDATE_ADD_PVP_CREDIT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
@@ -1565,8 +1565,8 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RESUME_CAST_BAR, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RESUME_COMMS, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_RESUME_TOKEN, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_RESURRECT_REQUEST, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_RESYNC_RUNES, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_RESURRECT_REQUEST, STATUS_NEVER, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_RESYNC_RUNES, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_ROLE_CHANGED_INFORM, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_ROLE_CHOSEN, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_ROLE_POLL_INFORM, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
@@ -1574,7 +1574,7 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SCENARIO_BOOT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SCENARIO_COMPLETED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SCENARIO_OUT_OF_BOUNDS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_SCENARIO_PO_IS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SCENARIO_POIS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SCENARIO_PROGRESS_UPDATE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SCENARIO_STATE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SCENE_OBJECT_EVENT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
@@ -1590,9 +1590,9 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SEND_KNOWN_SPELLS, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SEND_RAID_TARGET_UPDATE_ALL, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SEND_RAID_TARGET_UPDATE_SINGLE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_SEND_SPELL_CHARGES, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_SEND_SPELL_HISTORY, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_SEND_UNLEARN_SPELLS, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SEND_SPELL_CHARGES, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SEND_SPELL_HISTORY, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SEND_UNLEARN_SPELLS, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SERVER_FIRST_ACHIEVEMENT, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SERVER_FIRST_ACHIEVEMENTS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SERVER_TIME, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
@@ -1608,19 +1608,19 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_FACTION_NOT_VISIBLE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_FACTION_STANDING, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_FACTION_VISIBLE, STATUS_NEVER, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_FLAT_SPELL_MODIFIER, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_FLAT_SPELL_MODIFIER, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_FORCED_REACTIONS, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_ITEM_PURCHASE_DATA, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_LOOT_METHOD_FAILED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_MAX_WEEKLY_QUANTITY, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_MELEE_ANIM_KIT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_MOVEMENT_ANIM_KIT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_PCT_SPELL_MODIFIER, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_PCT_SPELL_MODIFIER, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_PET_SPECIALIZATION, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_PLAY_HOVER_ANIM, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_PROFICIENCY, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_SPELL_CHARGES, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_SPELL_CHARGES, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_TASK_COMPLETE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_TIME_ZONE_INFORMATION, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SET_VEHICLE_REC_ID, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
@@ -1633,17 +1633,17 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SOR_START_EXPERIENCE_INCOMPLETE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPECIAL_MOUNT_ANIM, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_ABSORB_LOG, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_CHANNEL_START, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_CHANNEL_UPDATE, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_COOLDOWN, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_CHANNEL_START, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_CHANNEL_UPDATE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_COOLDOWN, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_DAMAGE_SHIELD, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_DELAYED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_DISPELL_LOG, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_ENERGIZE_LOG, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_EXECUTE_LOG, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_FAILED_OTHER, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_FAILURE, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_GO, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_FAILED_OTHER, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_FAILURE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_GO, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_HEAL_LOG, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_INSTAKILL_LOG, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_INTERRUPT_LOG, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
@@ -1652,7 +1652,7 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_NON_MELEE_DAMAGE_LOG, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_OR_DAMAGE_IMMUNE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_PERIODIC_AURA_LOG, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_START, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_START, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPELL_UPDATE_CHAIN_TARGETS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_SPIRIT_HEALER_CONFIRM, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_STAND_STATE_UPDATE, STATUS_NEVER, CONNECTION_TYPE_REALM);
@@ -1698,7 +1698,7 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UI_TIME, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UNDELETE_CHARACTER_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UNDELETE_COOLDOWN_STATUS_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_UNLEARNED_SPELLS, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_UNLEARNED_SPELLS, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_ACCOUNT_DATA, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_ACTION_BUTTONS, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_CHARACTER_FLAGS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h
index 2852afe44db..a82116e9daa 100644
--- a/src/server/game/Server/Protocol/Opcodes.h
+++ b/src/server/game/Server/Protocol/Opcodes.h
@@ -283,7 +283,7 @@ enum OpcodeClient : uint32
CMSG_GARRISON_START_MISSION = 0x1508,
CMSG_GARRISON_SWAP_BUILDINGS = 0x0824,
CMSG_GENERATE_RANDOM_CHARACTER_NAME = 0x0336,
- CMSG_GET_CHALLENGE_MODE_REWARDS = 0x0849,
+ CMSG_GET_CHALLENGE_MODE_REWARDS = 0x0709,
CMSG_GET_GARRISON_INFO = 0x17E3,
CMSG_GET_ITEM_PURCHASE_DATA = 0x0897,
CMSG_GET_MIRROR_IMAGE_DATA = 0x1113,
@@ -314,7 +314,7 @@ enum OpcodeClient : uint32
CMSG_GUILD_CHALLENGE_UPDATE_REQUEST = 0x0B1D,
CMSG_GUILD_CHANGE_NAME_REQUEST = 0x021A,
CMSG_GUILD_DECLINE_INVITATION = 0x085D,
- CMSG_GUILD_DELETE = 0x080E,
+ CMSG_GUILD_DELETE = 0x054E,
CMSG_GUILD_DELETE_RANK = 0x095D,
CMSG_GUILD_DEMOTE_MEMBER = 0x040E,
CMSG_GUILD_EVENT_LOG_QUERY = 0x07CD,
@@ -372,8 +372,8 @@ enum OpcodeClient : uint32
CMSG_LF_GUILD_ADD_RECRUIT = 0x0941,
CMSG_LF_GUILD_BROWSE = 0x0022,
CMSG_LF_GUILD_DECLINE_RECRUIT = 0x068A,
- CMSG_LF_GUILD_GET_APPLICATIONS = 0x054E,
- CMSG_LF_GUILD_GET_GUILD_POST = 0x0709,
+ CMSG_LF_GUILD_GET_APPLICATIONS = 0x080E,
+ CMSG_LF_GUILD_GET_GUILD_POST = 0x0849,
CMSG_LF_GUILD_GET_RECRUITS = 0x078A,
CMSG_LF_GUILD_REMOVE_RECRUIT = 0x0449,
CMSG_LF_GUILD_SET_GUILD_POST = 0x0926,
@@ -1462,7 +1462,7 @@ enum OpcodeServer : uint32
SMSG_SCENARIO_BOOT = 0x00B6,
SMSG_SCENARIO_COMPLETED = 0x0EA2,
SMSG_SCENARIO_OUT_OF_BOUNDS = 0x0410,
- SMSG_SCENARIO_PO_IS = 0x00CC,
+ SMSG_SCENARIO_POIS = 0x00CC,
SMSG_SCENARIO_PROGRESS_UPDATE = 0x0AA5,
SMSG_SCENARIO_STATE = 0x0E35,
SMSG_SCENE_OBJECT_EVENT = 0x0644,
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index ab7b0552ff2..d9bd2d8ecc6 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -21,7 +21,6 @@
*/
#include "WorldSocket.h"
-#include <zlib.h>
#include "Config.h"
#include "Common.h"
#include "DatabaseEnv.h"
@@ -40,13 +39,9 @@
#include "ObjectAccessor.h"
#include "BattlegroundMgr.h"
#include "OutdoorPvPMgr.h"
-#include "MapManager.h"
#include "SocialMgr.h"
-#include "zlib.h"
#include "ScriptMgr.h"
-#include "Transport.h"
#include "WardenWin.h"
-#include "WardenMac.h"
#include "BattlenetServerManager.h"
#include "AuthenticationPackets.h"
#include "CharacterPackets.h"
@@ -54,6 +49,8 @@
#include "MiscPackets.h"
#include "ChatPackets.h"
+#include <zlib.h>
+
namespace {
std::string const DefaultPlayerName = "<none>";
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 2ff82e187bd..888bbc522b6 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -360,6 +360,7 @@ namespace WorldPackets
class SetActiveMover;
class MoveSetCollisionHeightAck;
class MoveTimeSkipped;
+ class SummonResponse;
}
namespace NPC
@@ -499,6 +500,7 @@ namespace WorldPackets
class UnlearnSkill;
class SelfRes;
class GetMirrorImageData;
+ class SpellClick;
}
namespace Talent
@@ -780,7 +782,7 @@ class WorldSession
std::string GetPlayerInfo() const;
void SetSecurity(AccountTypes security) { _security = security; }
- std::string const& GetRemoteAddress() { return m_Address; }
+ std::string const& GetRemoteAddress() const { return m_Address; }
void SetPlayer(Player* player);
uint8 GetExpansion() const { return m_expansion; }
@@ -1313,7 +1315,7 @@ class WorldSession
void HandleQueryCorpseLocation(WorldPackets::Query::QueryCorpseLocationFromClient& packet);
void HandleQueryCorpseTransport(WorldPackets::Query::QueryCorpseTransport& packet);
void HandleResurrectResponse(WorldPackets::Misc::ResurrectResponse& packet);
- void HandleSummonResponseOpcode(WorldPacket& recvData);
+ void HandleSummonResponseOpcode(WorldPackets::Movement::SummonResponse& packet);
void HandleJoinChannel(WorldPackets::Channel::JoinChannel& packet);
void HandleLeaveChannel(WorldPackets::Channel::LeaveChannel& packet);
@@ -1486,16 +1488,16 @@ class WorldSession
void HandleTransmogrifyItems(WorldPacket& recvData);
// Miscellaneous
- void HandleSpellClick(WorldPacket& recvData);
- void HandleMirrorImageDataRequest(WorldPackets::Spells::GetMirrorImageData& packet);
+ void HandleSpellClick(WorldPackets::Spells::SpellClick& spellClick);
+ void HandleMirrorImageDataRequest(WorldPackets::Spells::GetMirrorImageData& getMirrorImageData);
void HandleRemoveGlyph(WorldPacket& recvData);
void HandleGuildSetFocusedAchievement(WorldPackets::Achievement::GuildSetFocusedAchievement& setFocusedAchievement);
- void HandleEquipmentSetSave(WorldPackets::EquipmentSet::SaveEquipmentSet& packet);
- void HandleDeleteEquipmentSet(WorldPackets::EquipmentSet::DeleteEquipmentSet& packet);
- void HandleUseEquipmentSet(WorldPackets::EquipmentSet::UseEquipmentSet& packet);
+ void HandleEquipmentSetSave(WorldPackets::EquipmentSet::SaveEquipmentSet& saveEquipmentSet);
+ void HandleDeleteEquipmentSet(WorldPackets::EquipmentSet::DeleteEquipmentSet& deleteEquipmentSet);
+ void HandleUseEquipmentSet(WorldPackets::EquipmentSet::UseEquipmentSet& useEquipmentSet);
void HandleUITimeRequest(WorldPackets::Misc::UITimeRequest& /*request*/);
void HandleQueryQuestCompletionNPCs(WorldPackets::Query::QueryQuestCompletionNPCs& queryQuestCompletionNPCs);
- void HandleQuestPOIQuery(WorldPackets::Query::QuestPOIQuery& packet);
+ void HandleQuestPOIQuery(WorldPackets::Query::QuestPOIQuery& questPoiQuery);
void HandleUpdateProjectilePosition(WorldPacket& recvPacket);
void HandleUpdateMissileTrajectory(WorldPacket& recvPacket);
void HandleViolenceLevel(WorldPackets::Misc::ViolenceLevel& violenceLevel);
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index 027c35dfd7f..321a7635e4e 100644
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
@@ -21,12 +21,11 @@
#include "BigNumber.h"
#include "CharacterPackets.h"
#include "Opcodes.h"
-#include "Player.h"
#include "ScriptMgr.h"
#include "SHA1.h"
#include "PacketLog.h"
-#include "BattlenetAccountMgr.h"
#include "World.h"
+
#include <zlib.h>
#include <memory>
@@ -881,6 +880,8 @@ void WorldSocket::SendAuthResponseError(uint8 code)
bool WorldSocket::HandlePing(WorldPacket& recvPacket)
{
+ using namespace std::chrono;
+
uint32 ping;
uint32 latency;
diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp
index 673c96717ff..9f0f56c484f 100644
--- a/src/server/game/Server/WorldSocketMgr.cpp
+++ b/src/server/game/Server/WorldSocketMgr.cpp
@@ -21,6 +21,7 @@
#include "ScriptMgr.h"
#include "WorldSocket.h"
#include "WorldSocketMgr.h"
+
#include <boost/system/error_code.hpp>
static void OnSocketAccept(tcp::socket&& sock)
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 92a29dd5c73..473b3a98c56 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -25,15 +25,13 @@
#include "Player.h"
#include "Unit.h"
#include "ObjectAccessor.h"
+#include "CellImpl.h"
#include "Util.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
#include "Battleground.h"
#include "OutdoorPvPMgr.h"
-#include "Formulas.h"
#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "CellImpl.h"
#include "ScriptMgr.h"
#include "Vehicle.h"
#include "Battlefield.h"
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 516de90d454..8098c8db3d5 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -202,6 +202,7 @@ void AuraApplication::BuildUpdatePacket(WorldPackets::Spells::AuraInfo& auraInfo
WorldPackets::Spells::AuraDataInfo auraData;
auraData.SpellID = aura->GetId();
+ auraData.SpellXSpellVisualID = aura->GetSpellInfo()->GetSpellXSpellVisualId(_target->GetMap()->GetDifficultyID());
auraData.Flags = GetFlags();
if (aura->GetMaxDuration() > 0 && !(aura->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_HIDE_DURATION))
auraData.Flags |= AFLAG_DURATION;
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 6eabf259171..945580b0ee3 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -31,13 +31,10 @@
#include "Player.h"
#include "Pet.h"
#include "Unit.h"
-#include "Totem.h"
#include "Spell.h"
#include "DynamicObject.h"
#include "Guild.h"
-#include "Group.h"
#include "UpdateData.h"
-#include "MapManager.h"
#include "ObjectAccessor.h"
#include "CellImpl.h"
#include "SharedDefines.h"
@@ -157,59 +154,6 @@ SpellCastTargets::SpellCastTargets(Unit* caster, WorldPackets::Spells::SpellCast
SpellCastTargets::~SpellCastTargets() { }
-void SpellCastTargets::Read(ByteBuffer& data, Unit* caster)
-{
- data >> m_targetMask;
-
- if (m_targetMask == TARGET_FLAG_NONE)
- return;
-
- if (m_targetMask & (TARGET_FLAG_UNIT | TARGET_FLAG_UNIT_MINIPET | TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_CORPSE_ENEMY | TARGET_FLAG_CORPSE_ALLY))
- data >> m_objectTargetGUID.ReadAsPacked();
-
- if (m_targetMask & (TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM))
- data >> m_itemTargetGUID.ReadAsPacked();
-
- if (m_targetMask & TARGET_FLAG_SOURCE_LOCATION)
- {
- data >> m_src._transportGUID.ReadAsPacked();
- if (!m_src._transportGUID.IsEmpty())
- data >> m_src._transportOffset.PositionXYZStream();
- else
- data >> m_src._position.PositionXYZStream();
- }
- else
- {
- m_src._transportGUID = caster->GetTransGUID();
- if (!m_src._transportGUID.IsEmpty())
- m_src._transportOffset.Relocate(caster->GetTransOffsetX(), caster->GetTransOffsetY(), caster->GetTransOffsetZ(), caster->GetTransOffsetO());
- else
- m_src._position.Relocate(caster);
- }
-
- if (m_targetMask & TARGET_FLAG_DEST_LOCATION)
- {
- data >> m_dst._transportGUID.ReadAsPacked();
- if (!m_dst._transportGUID.IsEmpty())
- data >> m_dst._transportOffset.PositionXYZStream();
- else
- data >> m_dst._position.PositionXYZStream();
- }
- else
- {
- m_dst._transportGUID = caster->GetTransGUID();
- if (!m_dst._transportGUID.IsEmpty())
- m_dst._transportOffset.Relocate(caster->GetTransOffsetX(), caster->GetTransOffsetY(), caster->GetTransOffsetZ(), caster->GetTransOffsetO());
- else
- m_dst._position.Relocate(caster);
- }
-
- if (m_targetMask & TARGET_FLAG_STRING)
- data >> m_strTarget;
-
- Update(caster);
-}
-
void SpellCastTargets::Write(WorldPackets::Spells::SpellTargetData& data)
{
data.Flags = m_targetMask;
@@ -643,7 +587,8 @@ m_spellValue(new SpellValue(caster->GetMap()->GetDifficultyID(), m_spellInfo)),
m_procEx = 0;
focusObject = NULL;
m_cast_count = 0;
- m_misc.Data = 0;
+ memset(m_misc.Raw.Data, 0, sizeof(m_misc.Raw.Data));
+ m_SpellVisual = m_spellInfo->GetSpellXSpellVisualId(caster->GetMap()->GetDifficultyID());
m_preCastSpell = 0;
m_triggeredByAuraSpell = NULL;
m_spellAura = NULL;
@@ -1131,8 +1076,8 @@ void Spell::SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTar
{
case TARGET_OBJECT_TYPE_UNIT:
{
- if (Unit* unitTarget = target->ToUnit())
- AddUnitTarget(unitTarget, effMask, true, false);
+ if (Unit* unit = target->ToUnit())
+ AddUnitTarget(unit, effMask, true, false);
else
{
TC_LOG_DEBUG("spells", "Spell::SelectImplicitNearbyTargets: OnObjectTargetSelect script hook for spell Id %u set object of wrong type, expected unit, got %s, effect %u", m_spellInfo->Id, target->GetGUID().GetTypeName(), effMask);
@@ -1193,8 +1138,8 @@ void Spell::SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTarge
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
{
- if (Unit* unitTarget = (*itr)->ToUnit())
- AddUnitTarget(unitTarget, effMask, false);
+ if (Unit* unit = (*itr)->ToUnit())
+ AddUnitTarget(unit, effMask, false);
else if (GameObject* gObjTarget = (*itr)->ToGameObject())
AddGOTarget(gObjTarget, effMask);
}
@@ -1272,8 +1217,8 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
{
- if (Unit* unitTarget = (*itr)->ToUnit())
- AddUnitTarget(unitTarget, effMask, false, true, center);
+ if (Unit* unit = (*itr)->ToUnit())
+ AddUnitTarget(unit, effMask, false, true, center);
else if (GameObject* gObjTarget = (*itr)->ToGameObject())
AddGOTarget(gObjTarget, effMask);
}
@@ -1544,8 +1489,8 @@ void Spell::SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTarg
CallScriptObjectAreaTargetSelectHandlers(targets, effIndex, targetType);
for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
- if (Unit* unitTarget = (*itr)->ToUnit())
- AddUnitTarget(unitTarget, effMask, false);
+ if (Unit* unit = (*itr)->ToUnit())
+ AddUnitTarget(unit, effMask, false);
}
}
@@ -1600,12 +1545,12 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex)
if (m_spellInfo->CheckTarget(m_caster, *itr, true) != SPELL_CAST_OK)
continue;
- if (Unit* unitTarget = (*itr)->ToUnit())
+ if (Unit* unit = (*itr)->ToUnit())
{
- if (m_caster == *itr || m_caster->IsOnVehicle(unitTarget) || unitTarget->GetVehicle())
+ if (m_caster == *itr || m_caster->IsOnVehicle(unit) || unit->GetVehicle())
continue;
- if (Creature* creatureTarget = unitTarget->ToCreature())
+ if (Creature* creatureTarget = unit->ToCreature())
{
if (!(creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_PROJECTILE_COLLISION))
continue;
@@ -1760,8 +1705,8 @@ void Spell::SelectEffectTypeImplicitTargets(uint32 effIndex)
// player which not released his spirit is Unit, but target flag for it is TARGET_FLAG_CORPSE_MASK
if (targetMask & (TARGET_FLAG_UNIT_MASK | TARGET_FLAG_CORPSE_MASK))
{
- if (Unit* unitTarget = m_targets.GetUnitTarget())
- target = unitTarget;
+ if (Unit* unit = m_targets.GetUnitTarget())
+ target = unit;
else if (targetMask & TARGET_FLAG_CORPSE_MASK)
{
if (Corpse* corpseTarget = m_targets.GetCorpseTarget())
@@ -1776,8 +1721,8 @@ void Spell::SelectEffectTypeImplicitTargets(uint32 effIndex)
}
if (targetMask & TARGET_FLAG_ITEM_MASK)
{
- if (Item* itemTarget = m_targets.GetItemTarget())
- AddItemTarget(itemTarget, 1 << effIndex);
+ if (Item* item = m_targets.GetItemTarget())
+ AddItemTarget(item, 1 << effIndex);
return;
}
if (targetMask & TARGET_FLAG_GAMEOBJECT_MASK)
@@ -1957,10 +1902,10 @@ void Spell::SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTar
uint32 maxHPDeficit = 0;
for (std::list<WorldObject*>::iterator itr = tempTargets.begin(); itr != tempTargets.end(); ++itr)
{
- if (Unit* unitTarget = (*itr)->ToUnit())
+ if (Unit* unit = (*itr)->ToUnit())
{
- uint32 deficit = unitTarget->GetMaxHealth() - unitTarget->GetHealth();
- if ((deficit > maxHPDeficit || foundItr == tempTargets.end()) && target->IsWithinDist(unitTarget, jumpRadius) && target->IsWithinLOSInMap(unitTarget))
+ uint32 deficit = unit->GetMaxHealth() - unit->GetHealth();
+ if ((deficit > maxHPDeficit || foundItr == tempTargets.end()) && target->IsWithinDist(unit, jumpRadius) && target->IsWithinLOSInMap(unit))
{
foundItr = itr;
maxHPDeficit = deficit;
@@ -2996,6 +2941,14 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered
triggeredByAura->GetBase()->SetDuration(0);
}
+ if (m_caster->GetTypeId() == TYPEID_PLAYER)
+ {
+ m_caster->ToPlayer()->RestoreSpellMods(this);
+ // cleanup after mod system
+ // triggered spell pointer can be not removed in some cases
+ m_caster->ToPlayer()->SetSpellModTakingSpell(this, false);
+ }
+
SendCastResult(result);
finish(false);
@@ -3704,7 +3657,7 @@ void Spell::SendCastResult(SpellCastResult result)
if (m_caster->ToPlayer()->GetSession()->PlayerLoading()) // don't send cast results at loading time
return;
- SendCastResult(m_caster->ToPlayer(), m_spellInfo, m_cast_count, result, m_customError, SMSG_CAST_FAILED, m_misc.Data);
+ SendCastResult(m_caster->ToPlayer(), m_spellInfo, m_cast_count, result, m_customError, SMSG_CAST_FAILED, m_misc.Raw.Data);
}
void Spell::SendPetCastResult(SpellCastResult result)
@@ -3716,10 +3669,10 @@ void Spell::SendPetCastResult(SpellCastResult result)
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
return;
- SendCastResult(owner->ToPlayer(), m_spellInfo, m_cast_count, result, SPELL_CUSTOM_ERROR_NONE, SMSG_PET_CAST_FAILED, m_misc.Data);
+ SendCastResult(owner->ToPlayer(), m_spellInfo, m_cast_count, result, SPELL_CUSTOM_ERROR_NONE, SMSG_PET_CAST_FAILED, m_misc.Raw.Data);
}
-void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError /*= SPELL_CUSTOM_ERROR_NONE*/, OpcodeServer opcode /*= SMSG_CAST_FAILED*/, uint32 misc /*= 0*/)
+void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError /*= SPELL_CUSTOM_ERROR_NONE*/, OpcodeServer opcode /*= SMSG_CAST_FAILED*/, uint32* misc /*= nullptr*/)
{
if (result == SPELL_CAST_OK)
return;
@@ -3830,10 +3783,11 @@ void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cas
packet.FailedArg1 = missingItem; // first missing item
break;
}
- case SPELL_FAILED_CANT_UNTALENT:
+ case SPELL_FAILED_CANT_UNTALENT:
{
- if (TalentEntry const* talent = sTalentStore.LookupEntry(misc))
- packet.FailedArg1 = talent->SpellID;
+ if (misc)
+ if (TalentEntry const* talent = sTalentStore.LookupEntry(misc[0]))
+ packet.FailedArg1 = talent->SpellID;
break;
}
// TODO: SPELL_FAILED_NOT_STANDING
@@ -3880,6 +3834,7 @@ void Spell::SendSpellStart()
castData.CasterUnit = m_caster->GetGUID();
castData.CastID = m_cast_count; // pending spell cast?
castData.SpellID = m_spellInfo->Id;
+ castData.SpellXSpellVisualID = m_SpellVisual;
castData.CastFlags = castFlags;
castData.CastTime = m_casttime;
@@ -3995,6 +3950,7 @@ void Spell::SendSpellGo()
castData.CasterUnit = m_caster->GetGUID();
castData.CastID = m_cast_count; // pending spell cast?
castData.SpellID = m_spellInfo->Id;
+ castData.SpellXSpellVisualID = m_SpellVisual;
castData.CastFlags = castFlags;
castData.CastTime = getMSTime();
@@ -4236,6 +4192,7 @@ void Spell::SendInterrupted(uint8 result)
failurePacket.CasterUnit = m_caster->GetGUID();
failurePacket.CastID = m_cast_count;
failurePacket.SpellID = m_spellInfo->Id;
+ failurePacket.SpelXSpellVisualID = m_SpellVisual;
failurePacket.Reason = result;
m_caster->SendMessageToSet(failurePacket.Write(), true);
@@ -4274,6 +4231,16 @@ void Spell::SendChannelStart(uint32 duration)
spellChannelStart.ChannelDuration = duration;
m_caster->SendMessageToSet(spellChannelStart.Write(), true);
+ uint32 schoolImmunityMask = m_caster->GetSchoolImmunityMask();
+ uint32 mechanicImmunityMask = m_caster->GetMechanicImmunityMask();
+
+ if (schoolImmunityMask || mechanicImmunityMask)
+ {
+ spellChannelStart.InterruptImmunities = boost::in_place();
+ spellChannelStart.InterruptImmunities->SchoolImmunities = schoolImmunityMask;
+ spellChannelStart.InterruptImmunities->Immunities = mechanicImmunityMask;
+ }
+
m_timer = duration;
if (!channelTarget.IsEmpty())
m_caster->SetChannelObjectGuid(channelTarget);
@@ -5078,12 +5045,12 @@ SpellCastResult Spell::CheckCast(bool strict)
case SPELL_EFFECT_LEARN_PET_SPELL:
{
// check target only for unit target case
- if (Unit* unitTarget = m_targets.GetUnitTarget())
+ if (Unit* unit = m_targets.GetUnitTarget())
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return SPELL_FAILED_BAD_TARGETS;
- Pet* pet = unitTarget->ToPet();
+ Pet* pet = unit->ToPet();
if (!pet || pet->GetOwner() != m_caster)
return SPELL_FAILED_BAD_TARGETS;
@@ -5480,8 +5447,8 @@ SpellCastResult Spell::CheckCast(bool strict)
if (target->GetOwner() && target->GetOwner()->GetTypeId() == TYPEID_PLAYER)
return SPELL_FAILED_TARGET_IS_PLAYER_CONTROLLED;
- int32 damage = CalculateDamage(effect->EffectIndex, target);
- if (damage && int32(target->getLevel()) > damage)
+ int32 value = CalculateDamage(effect->EffectIndex, target);
+ if (value && int32(target->getLevel()) > value)
return SPELL_FAILED_HIGHLEVEL;
}
@@ -6564,8 +6531,8 @@ bool Spell::CheckEffectTarget(Unit const* target, SpellEffectInfo const* effect,
return false;
if (!target->GetCharmerGUID().IsEmpty())
return false;
- if (int32 damage = CalculateDamage(effect->EffectIndex, target))
- if ((int32)target->getLevel() > damage)
+ if (int32 value = CalculateDamage(effect->EffectIndex, target))
+ if ((int32)target->getLevel() > value)
return false;
break;
default:
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index 77abd3c78c2..183f4039711 100644
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -149,7 +149,6 @@ class SpellCastTargets
SpellCastTargets(Unit* caster, WorldPackets::Spells::SpellCastRequest const& spellCastRequest);
~SpellCastTargets();
- void Read(ByteBuffer& data, Unit* caster);
void Write(WorldPackets::Spells::SpellTargetData& data);
uint32 GetTargetMask() const { return m_targetMask; }
@@ -489,7 +488,7 @@ class Spell
void CheckSrc() { if (!m_targets.HasSrc()) m_targets.SetSrc(*m_caster); }
void CheckDst() { if (!m_targets.HasDst()) m_targets.SetDst(*m_caster); }
- static void SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError = SPELL_CUSTOM_ERROR_NONE, OpcodeServer opcode = SMSG_CAST_FAILED, uint32 misc = 0);
+ static void SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError = SPELL_CUSTOM_ERROR_NONE, OpcodeServer opcode = SMSG_CAST_FAILED, uint32* misc = nullptr);
void SendCastResult(SpellCastResult result);
void SendPetCastResult(SpellCastResult result);
void SendSpellStart();
@@ -526,8 +525,29 @@ class Spell
uint32 TalentId;
uint32 GlyphSlot;
- uint32 Data;
+ // SPELL_EFFECT_SET_FOLLOWER_QUALITY
+ // SPELL_EFFECT_INCREASE_FOLLOWER_ITEM_LEVEL
+ // SPELL_EFFECT_INCREASE_FOLLOWER_EXPERIENCE
+ // SPELL_EFFECT_RANDOMIZE_FOLLOWER_ABILITIES
+ // SPELL_EFFECT_LEARN_FOLLOWER_ABILITY
+ struct
+ {
+ uint32 Id;
+ uint32 AbilityId; // only SPELL_EFFECT_LEARN_FOLLOWER_ABILITY
+ } GarrFollower;
+
+ // SPELL_EFFECT_FINISH_GARRISON_MISSION
+ uint32 GarrMissionId;
+
+ // SPELL_EFFECT_UPGRADE_HEIRLOOM
+ uint32 ItemId;
+
+ struct
+ {
+ uint32 Data[2];
+ } Raw;
} m_misc;
+ uint32 m_SpellVisual;
uint32 m_preCastSpell;
SpellCastTargets m_targets;
int8 m_comboPointGain;
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 3af8adabd7f..23d183330f2 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -34,9 +34,6 @@
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
#include "Group.h"
-#include "UpdateData.h"
-#include "MapManager.h"
-#include "ObjectAccessor.h"
#include "SharedDefines.h"
#include "Pet.h"
#include "GameObject.h"
@@ -50,21 +47,13 @@
#include "Language.h"
#include "SocialMgr.h"
#include "Util.h"
-#include "VMapFactory.h"
#include "TemporarySummon.h"
-#include "CellImpl.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "SkillDiscovery.h"
-#include "Formulas.h"
-#include "Vehicle.h"
#include "ScriptMgr.h"
#include "GameObjectAI.h"
#include "AccountMgr.h"
#include "InstanceScript.h"
#include "PathGenerator.h"
#include "Guild.h"
-#include "GuildMgr.h"
#include "ReputationMgr.h"
#include "AreaTrigger.h"
#include "Garrison.h"
@@ -326,6 +315,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectNULL, //248 SPELL_EFFECT_FINISH_SHIPMENT
&Spell::EffectNULL, //249 SPELL_EFFECT_249
&Spell::EffectNULL, //250 SPELL_EFFECT_TAKE_SCREENSHOT
+ &Spell::EffectNULL, //251 SPELL_EFFECT_SET_GARRISON_CACHE_SIZE
};
void Spell::EffectNULL(SpellEffIndex /*effIndex*/)
@@ -3118,9 +3108,9 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
uint32 eff_damage(std::max(weaponDamage, 0));
// Add melee damage bonuses (also check for negative)
- uint32 damage = m_caster->MeleeDamageBonusDone(unitTarget, eff_damage, m_attackType, m_spellInfo);
+ uint32 damageBonusDone = m_caster->MeleeDamageBonusDone(unitTarget, eff_damage, m_attackType, m_spellInfo);
- m_damage += unitTarget->MeleeDamageBonusTaken(m_caster, damage, m_attackType, m_spellInfo);
+ m_damage += unitTarget->MeleeDamageBonusTaken(m_caster, damageBonusDone, m_attackType, m_spellInfo);
}
void Spell::EffectThreat(SpellEffIndex /*effIndex*/)
@@ -3378,9 +3368,9 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
case 54426:
if (unitTarget)
{
- int32 damage = int32(unitTarget->GetHealth()) - int32(unitTarget->CountPctFromMaxHealth(5));
- if (damage > 0)
- m_caster->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, damage, unitTarget);
+ int32 decimateDamage = int32(unitTarget->GetHealth()) - int32(unitTarget->CountPctFromMaxHealth(5));
+ if (decimateDamage > 0)
+ m_caster->CastCustomSpell(28375, SPELLVALUE_BASE_POINT0, decimateDamage, unitTarget);
}
return;
// Mirren's Drinking Hat
diff --git a/src/server/game/Spells/SpellHistory.cpp b/src/server/game/Spells/SpellHistory.cpp
index 54e33078622..64902febc77 100644
--- a/src/server/game/Spells/SpellHistory.cpp
+++ b/src/server/game/Spells/SpellHistory.cpp
@@ -720,21 +720,13 @@ void SpellHistory::RestoreCharge(SpellCategoryEntry const* chargeCategoryEntry)
if (Player* player = GetPlayerOwner())
{
- int32 maxCharges = GetMaxCharges(chargeCategoryEntry);
- int32 usedCharges = itr->second.size();
- float count = float(maxCharges - usedCharges);
- if (usedCharges)
- {
- ChargeEntry& charge = itr->second.front();
- std::chrono::milliseconds remaining = std::chrono::duration_cast<std::chrono::milliseconds>(charge.RechargeEnd - Clock::now());
- std::chrono::milliseconds recharge = std::chrono::duration_cast<std::chrono::milliseconds>(charge.RechargeEnd - charge.RechargeStart);
- count += 1.0f - float(remaining.count()) / float(recharge.count());
- }
-
WorldPackets::Spells::SetSpellCharges setSpellCharges;
- setSpellCharges.IsPet = player == _owner;
- setSpellCharges.Count = count;
setSpellCharges.Category = chargeCategoryEntry->ID;
+ if (!itr->second.empty())
+ setSpellCharges.NextRecoveryTime = uint32(std::chrono::duration_cast<std::chrono::milliseconds>(itr->second.front().RechargeEnd - Clock::now()).count());
+ setSpellCharges.ConsumedCharges = itr->second.size();
+ setSpellCharges.IsPet = player == _owner;
+
player->SendDirectMessage(setSpellCharges.Write());
}
}
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index f9f777f22f3..94fc49a2c3d 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -327,16 +327,36 @@ SpellImplicitTargetInfo::StaticData SpellImplicitTargetInfo::_data[TOTAL_SPELL_
{TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 115
{TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 116
{TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 117
- {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 118
+ {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 118
{TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_CASTER, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_RAID, TARGET_DIR_NONE}, // 119
- {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 120
- {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 121
+ {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_AREA, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 120
+ {TARGET_OBJECT_TYPE_UNIT, TARGET_REFERENCE_TYPE_TARGET, TARGET_SELECT_CATEGORY_DEFAULT, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 121
{TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 122
{TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 123
{TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 124
{TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 125
{TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 126
{TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 127
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 128
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 129
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 130
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 131
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 132
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 133
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 134
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 135
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 136
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 137
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 138
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 139
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 140
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 141
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 142
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 143
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 144
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 145
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 146
+ {TARGET_OBJECT_TYPE_NONE, TARGET_REFERENCE_TYPE_NONE, TARGET_SELECT_CATEGORY_NYI, TARGET_CHECK_DEFAULT, TARGET_DIR_NONE}, // 147
};
SpellEffectInfo::SpellEffectInfo(SpellEntry const* /*spellEntry*/, SpellInfo const* spellInfo, uint8 effIndex, SpellEffectEntry const* _effect)
@@ -945,6 +965,13 @@ SpellEffectInfo::StaticData SpellEffectInfo::_data[TOTAL_SPELL_EFFECTS] =
{EFFECT_IMPLICIT_TARGET_NONE, TARGET_OBJECT_TYPE_NONE}, // 242 SPELL_EFFECT_242
{EFFECT_IMPLICIT_TARGET_NONE, TARGET_OBJECT_TYPE_NONE}, // 243 SPELL_EFFECT_243
{EFFECT_IMPLICIT_TARGET_NONE, TARGET_OBJECT_TYPE_NONE}, // 244 SPELL_EFFECT_244
+ {EFFECT_IMPLICIT_TARGET_NONE, TARGET_OBJECT_TYPE_NONE}, // 245 SPELL_EFFECT_235
+ {EFFECT_IMPLICIT_TARGET_NONE, TARGET_OBJECT_TYPE_NONE}, // 246 SPELL_EFFECT_236
+ {EFFECT_IMPLICIT_TARGET_NONE, TARGET_OBJECT_TYPE_NONE}, // 247 SPELL_EFFECT_237
+ {EFFECT_IMPLICIT_TARGET_NONE, TARGET_OBJECT_TYPE_NONE}, // 248 SPELL_EFFECT_238
+ {EFFECT_IMPLICIT_TARGET_NONE, TARGET_OBJECT_TYPE_NONE}, // 249 SPELL_EFFECT_239
+ {EFFECT_IMPLICIT_TARGET_NONE, TARGET_OBJECT_TYPE_NONE}, // 250 SPELL_EFFECT_240
+ {EFFECT_IMPLICIT_TARGET_NONE, TARGET_OBJECT_TYPE_NONE}, // 251 SPELL_EFFECT_241
};
SpellInfo::SpellInfo(SpellEntry const* spellEntry, SpellEffectEntryMap const& effectsMap, SpellVisualMap&& visuals)
@@ -3286,10 +3313,10 @@ SpellEffectInfoVector SpellInfo::GetEffectsForDifficulty(uint32 difficulty) cons
DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(difficulty);
while (difficultyEntry)
{
- SpellEffectInfoMap::const_iterator itr = _effects.find(difficulty);
- if (itr != _effects.end())
+ SpellEffectInfoMap::const_iterator effectItr = _effects.find(difficulty);
+ if (effectItr != _effects.end())
{
- for (SpellEffectInfo const* effect : itr->second)
+ for (SpellEffectInfo const* effect : effectItr->second)
{
// overwrite any existing effect from DIFFICULTY_NONE
if (effect)
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index ac125950c24..e893ab1b7f8 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -19,15 +19,11 @@
#include "SpellMgr.h"
#include "SpellInfo.h"
#include "ObjectMgr.h"
-#include "SpellAuras.h"
#include "SpellAuraDefines.h"
#include "SharedDefines.h"
#include "DBCStores.h"
-#include "World.h"
#include "Chat.h"
-#include "Spell.h"
#include "BattlegroundMgr.h"
-#include "MapManager.h"
#include "BattlefieldWG.h"
#include "BattlefieldMgr.h"
#include "Player.h"
@@ -498,7 +494,7 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg
case SPELL_EFFECT_CREATE_ITEM:
case SPELL_EFFECT_CREATE_ITEM_2:
{
- if (effect->ItemType == 0)
+ if (effect->ItemType == 0)
{
// skip auto-loot crafting spells, its not need explicit item info (but have special fake items sometime)
if (!spellInfo->IsLootCrafting())
@@ -3184,6 +3180,9 @@ void SpellMgr::LoadSpellInfoCorrections()
const_cast<SpellEffectInfo*>(spellInfo->GetEffect(EFFECT_0))->TargetB = SpellImplicitTargetInfo(TARGET_UNIT_SRC_AREA_ALLY);
const_cast<SpellEffectInfo*>(spellInfo->GetEffect(EFFECT_1))->TargetB = SpellImplicitTargetInfo(TARGET_UNIT_SRC_AREA_ALLY);
break;
+ case 15290: // Vampiric Embrace
+ spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_INITIAL_AGGRO;
+ break;
case 8145: // Tremor Totem (instant pulse)
case 6474: // Earthbind Totem (instant pulse)
spellInfo->AttributesEx5 |= SPELL_ATTR5_START_PERIODIC_AT_APPLY;
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index 62aa5a52279..fe0f4117ffa 100644
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -15,11 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <string>
#include "Spell.h"
#include "SpellAuras.h"
#include "SpellScript.h"
-#include "SpellMgr.h"
+
+#include <string>
bool _SpellScript::_Validate(SpellInfo const* entry)
{
@@ -85,9 +85,9 @@ uint32 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellInfo const* spellEn
return mask;
}
-bool _SpellScript::EffectHook::IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndex)
+bool _SpellScript::EffectHook::IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndexToCheck)
{
- return (GetAffectedEffectsMask(spellEntry) & 1 << effIndex) != 0;
+ return (GetAffectedEffectsMask(spellEntry) & 1 << effIndexToCheck) != 0;
}
std::string _SpellScript::EffectHook::EffIndexToString()
@@ -189,14 +189,14 @@ std::string SpellScript::EffectHandler::ToString()
return "Index: " + EffIndexToString() + " Name: " +_SpellScript::EffectNameCheck::ToString();
}
-bool SpellScript::EffectHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
+bool SpellScript::EffectHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndexToCheck)
{
- return _SpellScript::EffectNameCheck::Check(spellEntry, effIndex);
+ return _SpellScript::EffectNameCheck::Check(spellEntry, effIndexToCheck);
}
-void SpellScript::EffectHandler::Call(SpellScript* spellScript, SpellEffIndex effIndex)
+void SpellScript::EffectHandler::Call(SpellScript* spellScript, SpellEffIndex effIndexToHandle)
{
- (spellScript->*pEffectHandlerScript)(effIndex);
+ (spellScript->*pEffectHandlerScript)(effIndexToHandle);
}
SpellScript::HitHandler::HitHandler(SpellHitFnType _pHitHandlerScript)
@@ -219,12 +219,12 @@ std::string SpellScript::TargetHook::ToString()
return oss.str();
}
-bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
+bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 effIndexToCheck)
{
if (!targetType)
return false;
- SpellEffectInfo const* effect = spellEntry->GetEffect(effIndex);
+ SpellEffectInfo const* effect = spellEntry->GetEffect(effIndexToCheck);
if (!effect)
return false;
@@ -781,9 +781,9 @@ void AuraScript::AuraDispelHandler::Call(AuraScript* auraScript, DispelInfo* _di
AuraScript::EffectBase::EffectBase(uint8 _effIndex, uint16 _effName)
: _SpellScript::EffectAuraNameCheck(_effName), _SpellScript::EffectHook(_effIndex) { }
-bool AuraScript::EffectBase::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
+bool AuraScript::EffectBase::CheckEffect(SpellInfo const* spellEntry, uint8 effIndexToCheck)
{
- return _SpellScript::EffectAuraNameCheck::Check(spellEntry, effIndex);
+ return _SpellScript::EffectAuraNameCheck::Check(spellEntry, effIndexToCheck);
}
std::string AuraScript::EffectBase::ToString()
diff --git a/src/server/game/Support/SupportMgr.h b/src/server/game/Support/SupportMgr.h
index fd251f50110..405e1372fb3 100644
--- a/src/server/game/Support/SupportMgr.h
+++ b/src/server/game/Support/SupportMgr.h
@@ -77,7 +77,7 @@ public:
return name;
}
- std::string const& GetComment() { return _comment; }
+ std::string const& GetComment() const { return _comment; }
virtual void SetAssignedTo(ObjectGuid guid, bool /*isAdmin*/ = false) { _assignedTo = guid; }
virtual void SetUnassigned() { _assignedTo.Clear(); }
@@ -225,11 +225,11 @@ public:
void Initialize();
- bool GetSupportSystemStatus() { return _supportSystemStatus; }
- bool GetTicketSystemStatus() { return _supportSystemStatus && _ticketSystemStatus; }
- bool GetBugSystemStatus() { return _supportSystemStatus && _bugSystemStatus; }
- bool GetComplaintSystemStatus() { return _supportSystemStatus && _complaintSystemStatus; }
- bool GetSuggestionSystemStatus() { return _supportSystemStatus && _suggestionSystemStatus; }
+ bool GetSupportSystemStatus() const { return _supportSystemStatus; }
+ bool GetTicketSystemStatus() const { return _supportSystemStatus && _ticketSystemStatus; }
+ bool GetBugSystemStatus() const { return _supportSystemStatus && _bugSystemStatus; }
+ bool GetComplaintSystemStatus() const { return _supportSystemStatus && _complaintSystemStatus; }
+ bool GetSuggestionSystemStatus() const { return _supportSystemStatus && _suggestionSystemStatus; }
uint64 GetLastChange() const { return _lastChange; }
template<typename T>
uint32 GetOpenTicketCount() const;
diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp
index c6192c94fda..b09bfe7f0f7 100644
--- a/src/server/game/Warden/Warden.cpp
+++ b/src/server/game/Warden/Warden.cpp
@@ -22,14 +22,13 @@
#include "Log.h"
#include "Opcodes.h"
#include "ByteBuffer.h"
-#include <openssl/md5.h>
-#include <openssl/sha.h>
#include "World.h"
-#include "Player.h"
#include "Util.h"
#include "Warden.h"
#include "AccountMgr.h"
+#include <openssl/sha.h>
+
Warden::Warden() : _session(NULL), _inputCrypto(16), _outputCrypto(16), _checkTimer(10000/*10 sec*/), _clientResponseTimer(0),
_dataSent(false), _previousTimestamp(0), _module(NULL), _initialized(false)
{
diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp
index c2d095e6530..df9cd4786ad 100644
--- a/src/server/game/Warden/WardenCheckMgr.cpp
+++ b/src/server/game/Warden/WardenCheckMgr.cpp
@@ -21,7 +21,6 @@
#include "WorldSession.h"
#include "Log.h"
#include "Database/DatabaseEnv.h"
-#include "Util.h"
#include "WardenCheckMgr.h"
#include "Warden.h"
diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp
index 2eccd4c46ff..8abd48bd3f7 100644
--- a/src/server/game/Warden/WardenMac.cpp
+++ b/src/server/game/Warden/WardenMac.cpp
@@ -23,13 +23,14 @@
#include "Log.h"
#include "Opcodes.h"
#include "ByteBuffer.h"
-#include <openssl/md5.h>
#include "World.h"
#include "Player.h"
#include "Util.h"
#include "WardenMac.h"
#include "WardenModuleMac.h"
+#include <openssl/md5.h>
+
WardenMac::WardenMac() : Warden() { }
WardenMac::~WardenMac() { }
diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp
index 6e96fc51f2c..82aff5c7a1b 100644
--- a/src/server/game/Warden/WardenWin.cpp
+++ b/src/server/game/Warden/WardenWin.cpp
@@ -24,7 +24,6 @@
#include "Log.h"
#include "Opcodes.h"
#include "ByteBuffer.h"
-#include <openssl/md5.h>
#include "Database/DatabaseEnv.h"
#include "World.h"
#include "Player.h"
@@ -32,7 +31,8 @@
#include "WardenWin.h"
#include "WardenModuleWin.h"
#include "WardenCheckMgr.h"
-#include "AccountMgr.h"
+
+#include <openssl/md5.h>
WardenWin::WardenWin() : Warden(), _serverTicks(0) {}
diff --git a/src/server/game/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp
index 348a98aa8b2..b4b0bd6fcec 100644
--- a/src/server/game/Weather/Weather.cpp
+++ b/src/server/game/Weather/Weather.cpp
@@ -25,10 +25,8 @@
#include "Player.h"
#include "World.h"
#include "Log.h"
-#include "ObjectMgr.h"
#include "Util.h"
#include "ScriptMgr.h"
-#include "Opcodes.h"
#include "WorldSession.h"
#include "MiscPackets.h"
diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp
index 883e622bf50..8ab122a82bb 100644
--- a/src/server/game/Weather/WeatherMgr.cpp
+++ b/src/server/game/Weather/WeatherMgr.cpp
@@ -25,8 +25,6 @@
#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "WorldPacket.h"
-#include "Opcodes.h"
#include "WorldSession.h"
#include "MiscPackets.h"
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 7746607d9e6..96c5f2eff1b 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1391,7 +1391,7 @@ void World::LoadConfigSettings(bool reload)
sScriptMgr->OnConfigLoad(reload);
}
-extern void LoadGameObjectModelList();
+extern void LoadGameObjectModelList(std::string const& dataPath);
/// Initialize the World
void World::SetInitialWorldSettings()
@@ -1471,6 +1471,17 @@ void World::SetInitialWorldSettings()
sSpellMgr->LoadPetFamilySpellsStore();
+ std::vector<uint32> mapIds;
+ for (uint32 mapId = 0; mapId < sMapStore.GetNumRows(); mapId++)
+ if (sMapStore.LookupEntry(mapId))
+ mapIds.push_back(mapId);
+
+ if (VMAP::VMapManager2* vmmgr2 = dynamic_cast<VMAP::VMapManager2*>(VMAP::VMapFactory::createOrGetVMapManager()))
+ vmmgr2->InitializeThreadUnsafe(mapIds);
+
+ MMAP::MMapManager* mmmgr = MMAP::MMapFactory::createOrGetMMapManager();
+ mmmgr->InitializeThreadUnsafe(mapIds);
+
TC_LOG_INFO("server.loading", "Loading SpellInfo store...");
sSpellMgr->LoadSpellInfoStore();
@@ -1484,7 +1495,7 @@ void World::SetInitialWorldSettings()
sSpellMgr->LoadSpellInfoCustomAttributes();
TC_LOG_INFO("server.loading", "Loading GameObject models...");
- LoadGameObjectModelList();
+ LoadGameObjectModelList(m_dataPath);
TC_LOG_INFO("server.loading", "Loading Script Names...");
sObjectMgr->LoadScriptNames();
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index aa0f1993621..b9a22162e2e 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -34,6 +34,7 @@ EndScriptData */
#include "Transport.h"
#include "Language.h"
#include "MovementPackets.h"
+#include "SpellPackets.h"
#include "ScenePackets.h"
#include <fstream>
@@ -213,16 +214,13 @@ public:
char* fail2 = strtok(NULL, " ");
uint8 failArg2 = fail2 ? (uint8)atoi(fail2) : 0;
- WorldPacket data(SMSG_CAST_FAILED, 5);
- data << uint8(0);
- data << uint32(133);
- data << uint8(failNum);
- if (fail1 || fail2)
- data << uint32(failArg1);
- if (fail2)
- data << uint32(failArg2);
-
- handler->GetSession()->SendPacket(&data);
+ WorldPackets::Spells::CastFailed castFailed(SMSG_CAST_FAILED);
+ castFailed.CastID = 0;
+ castFailed.SpellID = 133;
+ castFailed.Reason = failNum;
+ castFailed.FailedArg1 = failArg1;
+ castFailed.FailedArg2 = failArg2;
+ handler->GetSession()->SendPacket(castFailed.Write());
return true;
}
diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp
index 0ee987aadf6..9951688dcf7 100644
--- a/src/server/scripts/Commands/cs_list.cpp
+++ b/src/server/scripts/Commands/cs_list.cpp
@@ -500,7 +500,7 @@ public:
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL_LIST_INFO);
stmt->setUInt64(0, targetGuid.GetCounter());
- PreparedQueryResult queryResult = CharacterDatabase.Query(stmt);
+ queryResult = CharacterDatabase.Query(stmt);
if (queryResult)
{
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index b9765223add..83c8d55aec3 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -1350,8 +1350,8 @@ public:
static bool HandleMaxSkillCommand(ChatHandler* handler, char const* /*args*/)
{
- Player* SelectedPlayer = handler->getSelectedPlayer();
- if (!SelectedPlayer)
+ Player* player = handler->getSelectedPlayerOrSelf();
+ if (!player)
{
handler->SendSysMessage(LANG_NO_CHAR_SELECTED);
handler->SetSentErrorMessage(true);
@@ -1359,7 +1359,7 @@ public:
}
// each skills that have max skill value dependent from level seted to current level max skill value
- SelectedPlayer->UpdateSkillsToMaxSkillsForLevel();
+ player->UpdateSkillsToMaxSkillsForLevel();
return true;
}
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 3bcb6862b7f..9b4f78722c3 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -23,14 +23,13 @@ Category: commandscripts
EndScriptData */
#include "Chat.h"
-#include <stdlib.h>
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Pet.h"
#include "Player.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
-
+#include "SpellPackets.h"
class modify_commandscript : public CommandScript
{
@@ -407,12 +406,15 @@ public:
if (handler->needReportToTarget(target))
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOURS_SPELLFLATID_CHANGED, handler->GetNameLink().c_str(), spellflatid, val, mark);
- WorldPacket data(SMSG_SET_FLAT_SPELL_MODIFIER, (1+1+2+2));
- data << uint8(spellflatid);
- data << uint8(op);
- data << uint16(val);
- data << uint16(mark);
- target->GetSession()->SendPacket(&data);
+ WorldPackets::Spells::SetSpellModifier packet(SMSG_SET_FLAT_SPELL_MODIFIER);
+ WorldPackets::Spells::SpellModifier spellMod;
+ spellMod.ModIndex = op;
+ WorldPackets::Spells::SpellModifierData modData;
+ modData.ClassIndex = spellflatid;
+ modData.ModifierValue = float(val);
+ spellMod.ModifierData.push_back(modData);
+ packet.Modifiers.push_back(spellMod);
+ target->GetSession()->SendPacket(packet.Write());
return true;
}
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
index 92c3f83034d..f3c59654295 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp
@@ -552,11 +552,11 @@ public:
YellTimer = 10000;
}
- uint32 NextStep(uint32 Step)
+ uint32 NextStep(uint32 step)
{
Creature* arca = ObjectAccessor::GetCreature(*me, ArcanagosGUID);
Map* map = me->GetMap();
- switch (Step)
+ switch (step)
{
case 0: return 9999999;
case 1:
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
index ba2f1505127..9b290852dc2 100644
--- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
+++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp
@@ -152,6 +152,7 @@ public:
if (id == 1)
{
wait_timer = 5000;
+ me->LoadEquipment(1);
me->CastSpell(me, SPELL_DK_INITIATE_VISUAL, true);
if (Player* starter = ObjectAccessor::GetPlayer(*me, playerGUID))
diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
index 5df11a573a1..a2891c9f89b 100644
--- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
+++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp
@@ -464,13 +464,13 @@ public:
SayTimer = 8000;
}
- uint32 NextStep(uint8 Step)
+ uint32 NextStep(uint8 step)
{
Creature* Spark = ObjectAccessor::GetCreature(*me, SparkGUID);
if (!Spark)
return 99999999;
- switch (Step)
+ switch (step)
{
case 0:
Spark->GetMotionMaster()->MovePoint(0, -5080.70f, -11253.61f, 0.56f);
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
index a4a0b46ceb7..57c906b2d72 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
@@ -1005,7 +1005,6 @@ class npc_meteor_strike_initial : public CreatureScript
if (HalionAI* halionAI = CAST_AI(HalionAI, owner->AI()))
{
Position const* ownerPos = halionAI->GetMeteorStrikePosition();
- // Adjust randomness between 0 and pi.
float randomAdjustment = frand(static_cast<float>(M_PI / 14), static_cast<float>(13 * M_PI / 14));
float angle[4];
angle[0] = me->GetAngle(ownerPos);
@@ -1087,13 +1086,12 @@ class npc_meteor_strike : public CreatureScript
void UpdateAI(uint32 diff) override
{
_events.Update(diff);
+
if (_events.ExecuteEvent() == EVENT_SPAWN_METEOR_FLAME)
{
- Position pos = me->GetNearPosition(5.0f, 0.0f);
+ Position pos = me->GetNearPosition(5.0f, frand(static_cast<float>(-M_PI / 16), static_cast<float>(M_PI / 16)));
if (Creature* flame = me->SummonCreature(NPC_METEOR_STRIKE_FLAME, pos, TEMPSUMMON_TIMED_DESPAWN, 25000))
{
- flame->SetOrientation(me->GetOrientation());
-
flame->AI()->SetGUID(GetGUID());
flame->AI()->DoAction(ACTION_SUMMON_FLAME);
}
@@ -1141,12 +1139,12 @@ class npc_meteor_strike_flame : public CreatureScript
if (!meteorStrike || meteorStrike->AI()->GetData(DATA_SPAWNED_FLAMES) > 5)
return;
- me->SetOrientation(me->GetOrientation() + frand(static_cast<float>(-M_PI / 16), static_cast<float>(M_PI / 16)));
- Position pos = me->GetNearPosition(5.0f, 0.0f);
+ Position pos = me->GetNearPosition(5.0f, frand(static_cast<float>(-M_PI / 16), static_cast<float>(M_PI / 16)));
if (Creature* flame = me->SummonCreature(NPC_METEOR_STRIKE_FLAME, pos, TEMPSUMMON_TIMED_DESPAWN, 25000))
{
flame->AI()->SetGUID(_rootOwnerGuid);
+ flame->AI()->DoAction(ACTION_SUMMON_FLAME);
meteorStrike->AI()->SetData(DATA_SPAWNED_FLAMES, 1);
}
}
@@ -1164,7 +1162,7 @@ class npc_meteor_strike_flame : public CreatureScript
private:
InstanceScript* _instance;
EventMap _events;
- ObjectGuid _rootOwnerGuid = ObjectGuid::Empty;
+ ObjectGuid _rootOwnerGuid;
};
CreatureAI* GetAI(Creature* creature) const override
diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
index f10c108c00c..5111247b84c 100644
--- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
+++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp
@@ -20,6 +20,7 @@
#include "ScriptMgr.h"
#include "WorldSession.h"
#include "gundrak.h"
+#include "EventMap.h"
DoorData const doorData[] =
{
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
index 816895684f1..5368dde12c6 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp
@@ -19,6 +19,7 @@
#include "CreatureTextMgr.h"
#include "GridNotifiersImpl.h"
#include "GossipDef.h"
+#include "MovementPackets.h"
#include "MoveSpline.h"
#include "MoveSplineInit.h"
#include "PassiveAI.h"
@@ -2083,7 +2084,7 @@ class spell_igb_overheat : public SpellScriptLoader
return GetUnitOwner()->IsVehicle();
}
- void SendClientControl(uint8 value)
+ void SendClientControl(bool value)
{
if (Vehicle* vehicle = GetUnitOwner()->GetVehicleKit())
{
@@ -2091,10 +2092,10 @@ class spell_igb_overheat : public SpellScriptLoader
{
if (Player* player = passenger->ToPlayer())
{
- WorldPacket data(SMSG_CONTROL_UPDATE, GetUnitOwner()->GetPackGUID().size() + 1);
- data << GetUnitOwner()->GetPackGUID();
- data << uint8(value);
- player->GetSession()->SendPacket(&data);
+ WorldPackets::Movement::ControlUpdate data;
+ data.Guid = GetUnitOwner()->GetGUID();
+ data.On = value;
+ player->GetSession()->SendPacket(data.Write());
}
}
}
@@ -2102,12 +2103,12 @@ class spell_igb_overheat : public SpellScriptLoader
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- SendClientControl(0);
+ SendClientControl(false);
}
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
- SendClientControl(1);
+ SendClientControl(true);
}
void Register() override
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
index 705d15081c1..3ef6a7c15e3 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp
@@ -221,12 +221,12 @@ public:
}
}
- void MovementInform(uint32 type, uint32 id) override
+ void MovementInform(uint32 type, uint32 point) override
{
if (type != POINT_MOTION_TYPE)
return;
- if (id == 2 || id == 5 || id == 8 || id == 11)
+ if (point == 2 || point == 5 || point == 8 || point == 11)
{
movementCompleted = true;
me->SetReactState(REACT_AGGRESSIVE);
@@ -251,7 +251,7 @@ public:
}
nextMovementStarted = false;
- nextWP = id + 1;
+ nextWP = point + 1;
}
// switch to "who" if nearer than current target.
diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
index 90efc0d484b..cc13455c23f 100644
--- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
+++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp
@@ -176,8 +176,6 @@ class boss_gothik : public CreatureScript
}
uint32 waveCount;
- typedef std::vector<Creature*> TriggerVct;
- TriggerVct liveTrigger, deadTrigger;
bool mergedSides;
bool phaseTwo;
bool thirtyPercentReached;
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
index 5f5c944ee6c..b1a816b896b 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp
@@ -594,8 +594,8 @@ class boss_freya : public CreatureScript
const uint32 summonSpell[2][4] =
{
/* 0Elder, 1Elder, 2Elder, 3Elder */
- /* 10N */ {62950, 62953, 62955, 62957},
- /* 25N */ {62952, 62954, 62956, 62958}
+ /* 10N */ {62950, 62952, 62953, 62954},
+ /* 25N */ {62955, 62956, 62957, 62958}
};
me->CastSpell((Unit*)NULL, summonSpell[me->GetMap()->GetDifficultyID() - DIFFICULTY_10_N][elderCount], true);
diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
index 1f9fc6d7981..8ead8ab559e 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp
@@ -113,7 +113,7 @@ public:
{
if (Creature* pGuard1 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_1)))
pGuard1->Respawn();
-
+
if (Creature* pGuard2 = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_EREKEM_GUARD_2)))
pGuard2->Respawn();
}
@@ -254,7 +254,7 @@ public:
else
breakBondsCd -= diff;
- switch (uint32 eventId = events.ExecuteEvent())
+ switch (events.ExecuteEvent())
{
case EVENT_EARTH_SHIELD:
if (Unit* ally = DoSelectLowestHpFriendly(30.0f))
diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
index cfdacb10896..caf1392ea38 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp
@@ -345,7 +345,7 @@ public:
events.Update(diff);
- switch (uint32 eventId = events.ExecuteEvent())
+ switch (events.ExecuteEvent())
{
case EVENT_WATER_BLAST:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
@@ -367,7 +367,7 @@ public:
bIsDrained = true;
drainedTimer = 50;
uint32 damage = me->CountPctFromMaxHealth(30);
- if (me->GetHealth() < damage)
+ if (me->GetHealth() < damage)
me->SetHealth(me->CountPctFromMaxHealth(1));
else
{
@@ -398,7 +398,7 @@ public:
events.Update(diff);
- switch (uint32 eventId = events.ExecuteEvent())
+ switch (events.ExecuteEvent())
{
case EVENT_WATER_BLAST:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
diff --git a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
index 8dc0e32fb31..8b77b512ca4 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_lavanthor.cpp
@@ -106,7 +106,7 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
- switch (uint32 eventId = events.ExecuteEvent())
+ switch (events.ExecuteEvent())
{
case EVENT_FIREBOLT:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
index 8f2fe578d6e..ee89faac3a4 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp
@@ -27,7 +27,7 @@ enum Spells
SPELL_OPTIC_LINK = 54396,
SPELL_RAY_OF_PAIN = 54438, // NYI missing spelldifficulty
SPELL_RAY_OF_SUFFERING = 54442, // NYI missing spelldifficulty
-
+
// Visual
SPELL_OPTIC_LINK_LEVEL_1 = 54393,
SPELL_OPTIC_LINK_LEVEL_2 = 54394,
@@ -108,7 +108,7 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
- switch (uint32 eventId = events.ExecuteEvent())
+ switch (events.ExecuteEvent())
{
case EVENT_OPTIC_LINK:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
index 4fb7646558d..fe0f161cc27 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp
@@ -63,7 +63,7 @@ enum XevozzEvents
EVENT_ARCANE_BUFFET,
EVENT_SUMMON_SPHERE,
EVENT_SUMMON_SPHERE_2,
- EVENT_RANGE_CHECK,
+ EVENT_RANGE_CHECK,
EVENT_SUMMON_PLAYERS,
EVENT_DESPAWN_SPHERE
};
@@ -196,7 +196,7 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
- switch (uint32 eventId = events.ExecuteEvent())
+ switch (events.ExecuteEvent())
{
case EVENT_ARCANE_BARRAGE:
DoCast(SPELL_ARCANE_BARRAGE_VOLLEY);
@@ -220,11 +220,14 @@ public:
DoCast(SPELL_SUMMON_ETHEREAL_SPHERE_2);
break;
case EVENT_SUMMON_PLAYERS:
- if (Creature* sphere = me->FindNearestCreature(NPC_ETHEREAL_SPHERE, 150.0f))
- sphere->GetAI()->DoAction(ACTION_SUMMON);
- else if (Creature* sphere = me->FindNearestCreature(NPC_ETHEREAL_SPHERE2, 150.0f))
+ {
+ Creature* sphere = me->FindNearestCreature(NPC_ETHEREAL_SPHERE, 150.0f);
+ if (!sphere)
+ sphere = me->FindNearestCreature(NPC_ETHEREAL_SPHERE2, 150.0f);
+ if (sphere)
sphere->GetAI()->DoAction(ACTION_SUMMON);
break;
+ }
default:
break;
}
@@ -286,7 +289,7 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
- switch (uint32 eventId = events.ExecuteEvent())
+ switch (events.ExecuteEvent())
{
case EVENT_RANGE_CHECK:
if (Creature* xevozz = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_XEVOZZ)))
diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
index 02e479a22f4..5b3f06c9e40 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
@@ -180,7 +180,7 @@ public:
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
- switch (uint32 eventId = events.ExecuteEvent())
+ switch (events.ExecuteEvent())
{
case EVENT_SUMMON_VOID:
DoCast(SPELL_SUMMON_VOID_SENTRY);
diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.h b/src/server/scripts/Northrend/VioletHold/violet_hold.h
index e8da9576c13..2bd90672024 100644
--- a/src/server/scripts/Northrend/VioletHold/violet_hold.h
+++ b/src/server/scripts/Northrend/VioletHold/violet_hold.h
@@ -102,7 +102,7 @@ enum CreaturesIds
NPC_SABOTEOUR = 31079,
NPC_VIOLET_HOLD_GUARD = 30659,
NPC_DEFENSE_SYSTEM = 30837,
- NPC_VOID_SENTRY = 29364,
+ NPC_VOID_SENTRY = 29364,
NPC_VOID_SENTRY_BALL = 29365
};
diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp
index a6c00c05dce..749f5cbf88b 100644
--- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp
@@ -364,21 +364,21 @@ class boss_vazruden_the_herald : public CreatureScript
}
}
- void JustSummoned(Creature* summoned) override
+ void JustSummoned(Creature* summon) override
{
- if (!summoned)
+ if (!summon)
return;
Unit* victim = me->GetVictim();
- if (summoned->GetEntry() == NPC_NAZAN)
+ if (summon->GetEntry() == NPC_NAZAN)
{
- summoned->SetDisableGravity(true);
- summoned->SetSpeed(MOVE_FLIGHT, 2.5f);
+ summon->SetDisableGravity(true);
+ summon->SetSpeed(MOVE_FLIGHT, 2.5f);
if (victim)
AttackStartNoMove(victim);
}
else
if (victim)
- summoned->AI()->AttackStart(victim);
+ summon->AI()->AttackStart(victim);
}
void SentryDownBy(Unit* killer)
diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
index 7f2e08b39ca..9f7592a9ee4 100644
--- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
+++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp
@@ -127,18 +127,18 @@ class boss_warchief_kargath_bladefist : public CreatureScript
Talk(SAY_AGGRO);
}
- void JustSummoned(Creature* summoned) override
+ void JustSummoned(Creature* summon) override
{
- switch (summoned->GetEntry())
+ switch (summon->GetEntry())
{
case NPC_HEARTHEN_GUARD:
case NPC_SHARPSHOOTER_GUARD:
case NPC_REAVER_GUARD:
- summoned->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0));
- adds.push_back(summoned->GetGUID());
+ summon->AI()->AttackStart(SelectTarget(SELECT_TARGET_RANDOM, 0));
+ adds.push_back(summon->GetGUID());
break;
case NPC_SHATTERED_ASSASSIN:
- assassins.push_back(summoned->GetGUID());
+ assassins.push_back(summon->GetGUID());
break;
}
}
diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
index 2a568a84a7c..d140b41a8f8 100644
--- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
+++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp
@@ -165,7 +165,6 @@ public:
void Reset() override
{
- ryga = NULL;
}
// Override Evade Mode event, recast buff that was removed by standard handler
@@ -175,15 +174,6 @@ public:
DoCast(me, SPELL_ANCESTRAL_WOLF_BUFF, true);
}
- void MoveInLineOfSight(Unit* who) override
- {
- if (!ryga && who->GetEntry() == NPC_RYGA && me->IsWithinDistInMap(who, 15.0f))
- if (Creature* temp = who->ToCreature())
- ryga = temp;
-
- npc_escortAI::MoveInLineOfSight(who);
- }
-
void WaypointReached(uint32 waypointId) override
{
switch (waypointId)
@@ -238,9 +228,6 @@ public:
break;
}
}
-
- private:
- Creature* ryga;
};
CreatureAI* GetAI(Creature* creature) const override
diff --git a/src/server/shared/Cryptography/WardenKeyGeneration.h b/src/server/shared/Cryptography/WardenKeyGeneration.h
index 0e8a8be7e03..bfa0337d347 100644
--- a/src/server/shared/Cryptography/WardenKeyGeneration.h
+++ b/src/server/shared/Cryptography/WardenKeyGeneration.h
@@ -28,16 +28,16 @@ class SHA1Randx
public:
SHA1Randx(uint8* buff, uint32 size)
{
- uint32 taken = size/2;
+ uint32 halfSize = size / 2;
sh.Initialize();
- sh.UpdateData(buff, taken);
+ sh.UpdateData(buff, halfSize);
sh.Finalize();
memcpy(o1, sh.GetDigest(), 20);
sh.Initialize();
- sh.UpdateData(buff + taken, size - taken);
+ sh.UpdateData(buff + halfSize, size - halfSize);
sh.Finalize();
memcpy(o2, sh.GetDigest(), 20);
diff --git a/src/server/shared/Database/AdhocStatement.h b/src/server/shared/Database/AdhocStatement.h
index 8195d9add98..c449e0f6e59 100644
--- a/src/server/shared/Database/AdhocStatement.h
+++ b/src/server/shared/Database/AdhocStatement.h
@@ -32,7 +32,7 @@ class BasicStatementTask : public SQLOperation
~BasicStatementTask();
bool Execute() override;
- QueryResultFuture GetFuture() { return m_result->get_future(); }
+ QueryResultFuture GetFuture() const { return m_result->get_future(); }
private:
const char* m_sql; //- Raw query to be executed
diff --git a/src/server/shared/Database/DatabaseWorkerPool.h b/src/server/shared/Database/DatabaseWorkerPool.h
index d99e832d62f..6d35f03451d 100644
--- a/src/server/shared/Database/DatabaseWorkerPool.h
+++ b/src/server/shared/Database/DatabaseWorkerPool.h
@@ -162,7 +162,7 @@ class DatabaseWorkerPool
//! This method should only be used for queries that are only executed once, e.g during startup.
void Execute(const char* sql)
{
- if (!sql)
+ if (Trinity::IsFormatEmptyOrNull(sql))
return;
BasicStatementTask* task = new BasicStatementTask(sql);
@@ -171,13 +171,13 @@ class DatabaseWorkerPool
//! Enqueues a one-way SQL operation in string format -with variable args- that will be executed asynchronously.
//! This method should only be used for queries that are only executed once, e.g during startup.
- template<typename... Args>
- void PExecute(const char* sql, Args const&... args)
+ template<typename Format, typename... Args>
+ void PExecute(Format&& sql, Args&&... args)
{
- if (!sql)
+ if (Trinity::IsFormatEmptyOrNull(sql))
return;
- Execute(Trinity::StringFormat(sql, args...).c_str());
+ Execute(Trinity::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
}
//! Enqueues a one-way SQL operation in prepared statement format that will be executed asynchronously.
@@ -206,13 +206,13 @@ class DatabaseWorkerPool
//! Directly executes a one-way SQL operation in string format -with variable args-, that will block the calling thread until finished.
//! This method should only be used for queries that are only executed once, e.g during startup.
- template<typename... Args>
- void DirectPExecute(const char* sql, Args const&... args)
+ template<typename Format, typename... Args>
+ void DirectPExecute(Format&& sql, Args&&... args)
{
- if (!sql)
+ if (Trinity::IsFormatEmptyOrNull(sql))
return;
- DirectExecute(Trinity::StringFormat(sql, args...).c_str());
+ DirectExecute(Trinity::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
}
//! Directly executes a one-way SQL operation in prepared statement format, that will block the calling thread until finished.
@@ -233,7 +233,7 @@ class DatabaseWorkerPool
//! Directly executes an SQL query in string format that will block the calling thread until finished.
//! Returns reference counted auto pointer, no need for manual memory management in upper level code.
- QueryResult Query(const char* sql, T* conn = NULL)
+ QueryResult Query(const char* sql, T* conn = nullptr)
{
if (!conn)
conn = GetFreeConnection();
@@ -251,24 +251,24 @@ class DatabaseWorkerPool
//! Directly executes an SQL query in string format -with variable args- that will block the calling thread until finished.
//! Returns reference counted auto pointer, no need for manual memory management in upper level code.
- template<typename... Args>
- QueryResult PQuery(const char* sql, T* conn, Args const&... args)
+ template<typename Format, typename... Args>
+ QueryResult PQuery(Format&& sql, T* conn, Args&&... args)
{
- if (!sql)
- return QueryResult(NULL);
+ if (Trinity::IsFormatEmptyOrNull(sql))
+ return QueryResult(nullptr);
- return Query(Trinity::StringFormat(sql, args...).c_str(), conn);
+ return Query(Trinity::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str(), conn);
}
//! Directly executes an SQL query in string format -with variable args- that will block the calling thread until finished.
//! Returns reference counted auto pointer, no need for manual memory management in upper level code.
- template<typename... Args>
- QueryResult PQuery(const char* sql, Args const&... args)
+ template<typename Format, typename... Args>
+ QueryResult PQuery(Format&& sql, Args&&... args)
{
if (!sql)
- return QueryResult(NULL);
+ return QueryResult(nullptr);
- return Query(Trinity::StringFormat(sql, args...).c_str());
+ return Query(Trinity::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
}
//! Directly executes an SQL query in prepared format that will block the calling thread until finished.
@@ -309,10 +309,10 @@ class DatabaseWorkerPool
//! Enqueues a query in string format -with variable args- that will set the value of the QueryResultFuture return object as soon as the query is executed.
//! The return value is then processed in ProcessQueryCallback methods.
- template<typename... Args>
- QueryResultFuture AsyncPQuery(const char* sql, Args const&... args)
+ template<typename Format, typename... Args>
+ QueryResultFuture AsyncPQuery(Format&& sql, Args&&... args)
{
- return AsyncQuery(Trinity::StringFormat(sql, args...).c_str());
+ return AsyncQuery(Trinity::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
}
//! Enqueues a query in prepared format that will set the value of the PreparedQueryResultFuture return object as soon as the query is executed.
@@ -503,7 +503,7 @@ class DatabaseWorkerPool
{
while (_connectionCount[type] != 0)
{
- T* t = _connections[type][i--];
+ t = _connections[type][i--];
delete t;
--_connectionCount[type];
}
diff --git a/src/server/shared/Database/QueryHolder.h b/src/server/shared/Database/QueryHolder.h
index a190ffbbdab..657496e8196 100644
--- a/src/server/shared/Database/QueryHolder.h
+++ b/src/server/shared/Database/QueryHolder.h
@@ -30,8 +30,11 @@ class SQLQueryHolder
SQLQueryHolder() { }
virtual ~SQLQueryHolder();
bool SetQuery(size_t index, const char* sql);
- template<typename... Args>
- bool SetPQuery(size_t index, const char* sql, Args const&... args) { return SetQuery(index, Trinity::StringFormat(sql, args...).c_str()); }
+ template<typename Format, typename... Args>
+ bool SetPQuery(size_t index, Format&& sql, Args&&... args)
+ {
+ return SetQuery(index, Trinity::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
+ }
bool SetPreparedQuery(size_t index, PreparedStatement* stmt);
void SetSize(size_t size);
QueryResult GetResult(size_t index);
diff --git a/src/server/shared/Database/Transaction.h b/src/server/shared/Database/Transaction.h
index a51c96ea93b..4fbbe1ed45b 100644
--- a/src/server/shared/Database/Transaction.h
+++ b/src/server/shared/Database/Transaction.h
@@ -39,8 +39,11 @@ class Transaction
void Append(PreparedStatement* statement);
void Append(const char* sql);
- template<typename... Args>
- void PAppend(const char* sql, Args const&... args) { Append(Trinity::StringFormat(sql, args...).c_str()); }
+ template<typename Format, typename... Args>
+ void PAppend(Format&& sql, Args&&... args)
+ {
+ Append(Trinity::StringFormat(std::forward<Format>(sql), std::forward<Args>(args)...).c_str());
+ }
size_t GetSize() const { return m_queries.size(); }
diff --git a/src/server/shared/Debugging/WheatyExceptionReport.cpp b/src/server/shared/Debugging/WheatyExceptionReport.cpp
index e9f888f280d..02916ca12d2 100644
--- a/src/server/shared/Debugging/WheatyExceptionReport.cpp
+++ b/src/server/shared/Debugging/WheatyExceptionReport.cpp
@@ -1008,9 +1008,9 @@ bool logChildren)
// Get the size of the child member
ULONG64 length;
SymGetTypeInfo(m_hProcess, modBase, innerTypeID, TI_GET_LENGTH, &length);
- char buffer[50];
- FormatOutputValue(buffer, basicType, length, (PVOID)address, sizeof(buffer));
- symbolDetails.top().Value = buffer;
+ char buffer2[50];
+ FormatOutputValue(buffer2, basicType, length, (PVOID)address, sizeof(buffer));
+ symbolDetails.top().Value = buffer2;
}
bHandled = true;
return pszCurrBuffer;
@@ -1233,16 +1233,16 @@ size_t countOverride)
else
length = strlen((char*)pAddress);
if (length > bufferSize - 6)
- pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s...\"", bufferSize - 6, (char*)pAddress);
+ pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s...\"", (DWORD)(bufferSize - 6), (char*)pAddress);
else
- pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s\"", length, (char*)pAddress);
+ pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s\"", (DWORD)length, (char*)pAddress);
break;
}
case btStdString:
{
std::string* value = static_cast<std::string*>(pAddress);
if (value->length() > bufferSize - 6)
- pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s...\"", bufferSize - 6, value->c_str());
+ pszCurrBuffer += sprintf(pszCurrBuffer, "\"%.*s...\"", (DWORD)(bufferSize - 6), value->c_str());
else
pszCurrBuffer += sprintf(pszCurrBuffer, "\"%s\"", value->c_str());
break;
@@ -1264,7 +1264,7 @@ size_t countOverride)
{
if (basicType == btFloat)
{
- pszCurrBuffer += sprintf(pszCurrBuffer, "%lf",
+ pszCurrBuffer += sprintf(pszCurrBuffer, "%f",
*(double *)pAddress);
}
else
@@ -1274,9 +1274,9 @@ size_t countOverride)
else
{
#if _WIN64
- pszCurrBuffer += sprintf(pszCurrBuffer, "0x%I64X", (DWORD64*)pAddress);
+ pszCurrBuffer += sprintf(pszCurrBuffer, "0x%I64X", (DWORD64)pAddress);
#else
- pszCurrBuffer += sprintf(pszCurrBuffer, "0x%X", (PDWORD)pAddress);
+ pszCurrBuffer += sprintf(pszCurrBuffer, "0x%X", (DWORD)pAddress);
#endif
}
break;
@@ -1285,9 +1285,9 @@ size_t countOverride)
__except (EXCEPTION_EXECUTE_HANDLER)
{
#if _WIN64
- pszCurrBuffer += sprintf(pszCurrBuffer, "0x%I64X <Unable to read memory>", (DWORD64*)pAddress);
+ pszCurrBuffer += sprintf(pszCurrBuffer, "0x%I64X <Unable to read memory>", (DWORD64)pAddress);
#else
- pszCurrBuffer += sprintf(pszCurrBuffer, "0x%X <Unable to read memory>", (PDWORD)pAddress);
+ pszCurrBuffer += sprintf(pszCurrBuffer, "0x%X <Unable to read memory>", (DWORD)pAddress);
#endif
}
}
diff --git a/src/server/shared/Debugging/WheatyExceptionReport.h b/src/server/shared/Debugging/WheatyExceptionReport.h
index ef6334add16..8c2479d5232 100644
--- a/src/server/shared/Debugging/WheatyExceptionReport.h
+++ b/src/server/shared/Debugging/WheatyExceptionReport.h
@@ -7,6 +7,7 @@
#include <set>
#include <stdlib.h>
#include <stack>
+#include <mutex>
#define countof _countof
#define WER_MAX_ARRAY_ELEMENTS_COUNT 10
diff --git a/src/server/shared/Logging/AppenderFile.cpp b/src/server/shared/Logging/AppenderFile.cpp
index 5a8d610a36b..c9cc1935c7a 100644
--- a/src/server/shared/Logging/AppenderFile.cpp
+++ b/src/server/shared/Logging/AppenderFile.cpp
@@ -22,20 +22,19 @@
# include <Windows.h>
#endif
-AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* _filename, const char* _logDir, const char* _mode, AppenderFlags _flags, uint64 fileSize):
- Appender(id, name, APPENDER_FILE, level, _flags),
+AppenderFile::AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* filename, const char* logDir, const char* mode, AppenderFlags flags, uint64 fileSize):
+ Appender(id, name, APPENDER_FILE, level, flags),
logfile(NULL),
- filename(_filename),
- logDir(_logDir),
- mode(_mode),
- maxFileSize(fileSize),
- fileSize(0)
+ _fileName(filename),
+ _logDir(logDir),
+ _maxFileSize(fileSize),
+ _fileSize(0)
{
- dynamicName = std::string::npos != filename.find("%s");
- backup = (_flags & APPENDER_FLAGS_MAKE_FILE_BACKUP) != 0;
+ _dynamicName = std::string::npos != _fileName.find("%s");
+ _backup = (flags & APPENDER_FLAGS_MAKE_FILE_BACKUP) != 0;
- if (!dynamicName)
- logfile = OpenFile(_filename, _mode, mode == "w" && backup);
+ if (!_dynamicName)
+ logfile = OpenFile(filename, mode, !strcmp(mode, "w") && _backup);
}
AppenderFile::~AppenderFile()
@@ -45,36 +44,36 @@ AppenderFile::~AppenderFile()
void AppenderFile::_write(LogMessage const* message)
{
- bool exceedMaxSize = maxFileSize > 0 && (fileSize.load() + message->Size()) > maxFileSize;
+ bool exceedMaxSize = _maxFileSize > 0 && (_fileSize.load() + message->Size()) > _maxFileSize;
- if (dynamicName)
+ if (_dynamicName)
{
char namebuf[TRINITY_PATH_MAX];
- snprintf(namebuf, TRINITY_PATH_MAX, filename.c_str(), message->param1.c_str());
+ snprintf(namebuf, TRINITY_PATH_MAX, _fileName.c_str(), message->param1.c_str());
// always use "a" with dynamic name otherwise it could delete the log we wrote in last _write() call
- FILE* file = OpenFile(namebuf, "a", backup || exceedMaxSize);
+ FILE* file = OpenFile(namebuf, "a", _backup || exceedMaxSize);
if (!file)
return;
fprintf(file, "%s%s\n", message->prefix.c_str(), message->text.c_str());
fflush(file);
- fileSize += uint64(message->Size());
+ _fileSize += uint64(message->Size());
fclose(file);
return;
}
else if (exceedMaxSize)
- logfile = OpenFile(filename, "w", true);
+ logfile = OpenFile(_fileName, "w", true);
if (!logfile)
return;
fprintf(logfile, "%s%s\n", message->prefix.c_str(), message->text.c_str());
fflush(logfile);
- fileSize += uint64(message->Size());
+ _fileSize += uint64(message->Size());
}
-FILE* AppenderFile::OpenFile(std::string const &filename, std::string const &mode, bool backup)
+FILE* AppenderFile::OpenFile(std::string const& filename, std::string const& mode, bool backup)
{
- std::string fullName(logDir + filename);
+ std::string fullName(_logDir + filename);
if (backup)
{
CloseFile();
@@ -87,7 +86,7 @@ FILE* AppenderFile::OpenFile(std::string const &filename, std::string const &mod
if (FILE* ret = fopen(fullName.c_str(), mode.c_str()))
{
- fileSize = ftell(ret);
+ _fileSize = ftell(ret);
return ret;
}
diff --git a/src/server/shared/Logging/AppenderFile.h b/src/server/shared/Logging/AppenderFile.h
index 36afdd23ad1..4082b34a2b4 100644
--- a/src/server/shared/Logging/AppenderFile.h
+++ b/src/server/shared/Logging/AppenderFile.h
@@ -24,21 +24,20 @@
class AppenderFile: public Appender
{
public:
- AppenderFile(uint8 _id, std::string const& _name, LogLevel level, const char* filename, const char* logDir, const char* mode, AppenderFlags flags, uint64 maxSize);
+ AppenderFile(uint8 id, std::string const& name, LogLevel level, const char* filename, const char* logDir, const char* mode, AppenderFlags flags, uint64 maxSize);
~AppenderFile();
- FILE* OpenFile(std::string const& _name, std::string const& _mode, bool _backup);
+ FILE* OpenFile(std::string const& name, std::string const& mode, bool backup);
private:
void CloseFile();
void _write(LogMessage const* message) override;
FILE* logfile;
- std::string filename;
- std::string logDir;
- std::string mode;
- bool dynamicName;
- bool backup;
- uint64 maxFileSize;
- std::atomic<uint64> fileSize;
+ std::string _fileName;
+ std::string _logDir;
+ bool _dynamicName;
+ bool _backup;
+ uint64 _maxFileSize;
+ std::atomic<uint64> _fileSize;
};
#endif
diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp
index c9a4432039f..f9f96c3da75 100644
--- a/src/server/shared/Logging/Log.cpp
+++ b/src/server/shared/Logging/Log.cpp
@@ -270,7 +270,7 @@ void Log::write(std::unique_ptr<LogMessage>&& msg) const
if (_ioService)
{
- auto logOperation = std::shared_ptr<LogOperation>(new LogOperation(logger, std::forward<std::unique_ptr<LogMessage>>(msg)));
+ auto logOperation = std::shared_ptr<LogOperation>(new LogOperation(logger, std::move(msg)));
_ioService->post(_strand->wrap([logOperation](){ logOperation->call(); }));
}
@@ -291,9 +291,8 @@ std::string Log::GetTimestampStr()
// HH hour (2 digits 00-23)
// MM minutes (2 digits 00-59)
// SS seconds (2 digits 00-59)
- char buf[20];
- snprintf(buf, 20, "%04d-%02d-%02d_%02d-%02d-%02d", aTm.tm_year+1900, aTm.tm_mon+1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec);
- return std::string(buf);
+ return Trinity::StringFormat("%04d-%02d-%02d_%02d-%02d-%02d",
+ aTm.tm_year + 1900, aTm.tm_mon + 1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec);
}
bool Log::SetLogLevel(std::string const& name, const char* newLevelc, bool isLogger /* = true */)
diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h
index 5b3782fce55..ab7b2169ed2 100644
--- a/src/server/shared/Logging/Log.h
+++ b/src/server/shared/Logging/Log.h
@@ -62,19 +62,22 @@ class Log
bool ShouldLog(std::string const& type, LogLevel level) const;
bool SetLogLevel(std::string const& name, char const* level, bool isLogger = true);
- template<typename... Args>
- inline void outMessage(std::string const& filter, LogLevel const level, const char* fmt, Args const&... args)
+ template<typename Format, typename... Args>
+ inline void outMessage(std::string const& filter, LogLevel const level, Format&& fmt, Args&&... args)
{
- write(Trinity::make_unique<LogMessage>(level, filter, Trinity::StringFormat(fmt, args...)));
+ write(Trinity::make_unique<LogMessage>(level, filter,
+ Trinity::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...)));
}
- template<typename... Args>
- void outCommand(uint32 account, const char* fmt, Args const&... args)
+ template<typename Format, typename... Args>
+ void outCommand(uint32 account, Format&& fmt, Args&&... args)
{
if (!ShouldLog("commands.gm", LOG_LEVEL_INFO))
return;
- std::unique_ptr<LogMessage> msg = Trinity::make_unique<LogMessage>(LOG_LEVEL_INFO, "commands.gm", std::move(Trinity::StringFormat(fmt, args...)));
+ std::unique_ptr<LogMessage> msg =
+ Trinity::make_unique<LogMessage>(LOG_LEVEL_INFO, "commands.gm",
+ Trinity::StringFormat(std::forward<Format>(fmt), std::forward<Args>(args)...));
msg->param1 = std::to_string(account);
@@ -160,7 +163,8 @@ inline bool Log::ShouldLog(std::string const& type, LogLevel level) const
}
#if PLATFORM != PLATFORM_WINDOWS
-void check_args(const char* format, ...) ATTR_PRINTF(1, 2);
+void check_args(const char*, ...) ATTR_PRINTF(1, 2);
+void check_args(std::string const&, ...);
// This will catch format errors on build time
#define TC_LOG_MESSAGE_BODY(filterType__, level__, ...) \
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h
index 0fa500c7c65..417e2f4b7b4 100644
--- a/src/server/shared/Packets/ByteBuffer.h
+++ b/src/server/shared/Packets/ByteBuffer.h
@@ -658,7 +658,7 @@ class ByteBuffer
put<uint8>(pos, mask);
}
- size_t PackUInt64(uint64 value, uint8* mask, uint8* result) const
+ static size_t PackUInt64(uint64 value, uint8* mask, uint8* result)
{
size_t resultSize = 0;
*mask = 0;
diff --git a/src/server/shared/PrecompiledHeaders/sharedPCH.h b/src/server/shared/PrecompiledHeaders/sharedPCH.h
index 87af9f44eb7..d99476bc7a8 100644
--- a/src/server/shared/PrecompiledHeaders/sharedPCH.h
+++ b/src/server/shared/PrecompiledHeaders/sharedPCH.h
@@ -7,3 +7,4 @@
#include "Errors.h"
#include "TypeList.h"
#include "TaskScheduler.h"
+#include "EventMap.h"
diff --git a/src/server/shared/Threading/ProducerConsumerQueue.h b/src/server/shared/Threading/ProducerConsumerQueue.h
index 3158e3deb24..223f5109545 100644
--- a/src/server/shared/Threading/ProducerConsumerQueue.h
+++ b/src/server/shared/Threading/ProducerConsumerQueue.h
@@ -70,7 +70,8 @@ public:
{
std::unique_lock<std::mutex> lock(_queueLock);
- // we could be using .wait(lock, predicate) overload here but some threading error analysis tools produce false positives
+ // we could be using .wait(lock, predicate) overload here but it is broken
+ // https://connect.microsoft.com/VisualStudio/feedback/details/1098841
while (_queue.empty() && !_shutdown)
_condition.wait(lock);
diff --git a/src/server/shared/Utilities/Duration.h b/src/server/shared/Utilities/Duration.h
new file mode 100644
index 00000000000..58a08e5842f
--- /dev/null
+++ b/src/server/shared/Utilities/Duration.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2008-2015 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 _DURATION_H_
+#define _DURATION_H_
+
+#include <chrono>
+
+/// Milliseconds shorthand typedef.
+typedef std::chrono::milliseconds Milliseconds;
+
+/// Seconds shorthand typedef.
+typedef std::chrono::seconds Seconds;
+
+/// Minutes shorthand typedef.
+typedef std::chrono::minutes Minutes;
+
+/// Hours shorthand typedef.
+typedef std::chrono::hours Hours;
+
+/// Makes std::chrono_literals globally available.
+// ToDo: Enable this when TC supports C++14.
+// using namespace std::chrono_literals;
+
+#endif // _DURATION_H_
diff --git a/src/server/shared/Utilities/EventMap.cpp b/src/server/shared/Utilities/EventMap.cpp
new file mode 100644
index 00000000000..8c3f60afe82
--- /dev/null
+++ b/src/server/shared/Utilities/EventMap.cpp
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2008-2015 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 "EventMap.h"
+
+void EventMap::Reset()
+{
+ _eventMap.clear();
+ _time = 0;
+ _phase = 0;
+}
+
+void EventMap::SetPhase(uint8 phase)
+{
+ if (!phase)
+ _phase = 0;
+ else if (phase <= 8)
+ _phase = uint8(1 << (phase - 1));
+}
+
+void EventMap::ScheduleEvent(uint32 eventId, uint32 time, uint32 group /*= 0*/, uint8 phase /*= 0*/)
+{
+ if (group && group <= 8)
+ eventId |= (1 << (group + 15));
+
+ if (phase && phase <= 8)
+ eventId |= (1 << (phase + 23));
+
+ _eventMap.insert(EventStore::value_type(_time + time, eventId));
+}
+
+uint32 EventMap::ExecuteEvent()
+{
+ while (!Empty())
+ {
+ EventStore::iterator itr = _eventMap.begin();
+
+ if (itr->first > _time)
+ return 0;
+ else if (_phase && (itr->second & 0xFF000000) && !((itr->second >> 24) & _phase))
+ _eventMap.erase(itr);
+ else
+ {
+ uint32 eventId = (itr->second & 0x0000FFFF);
+ _lastEvent = itr->second; // include phase/group
+ _eventMap.erase(itr);
+ return eventId;
+ }
+ }
+
+ return 0;
+}
+
+void EventMap::DelayEvents(uint32 delay, uint32 group)
+{
+ if (!group || group > 8 || Empty())
+ return;
+
+ EventStore delayed;
+
+ for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
+ {
+ if (itr->second & (1 << (group + 15)))
+ {
+ delayed.insert(EventStore::value_type(itr->first + delay, itr->second));
+ _eventMap.erase(itr++);
+ }
+ else
+ ++itr;
+ }
+
+ _eventMap.insert(delayed.begin(), delayed.end());
+}
+
+void EventMap::CancelEvent(uint32 eventId)
+{
+ if (Empty())
+ return;
+
+ for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
+ {
+ if (eventId == (itr->second & 0x0000FFFF))
+ _eventMap.erase(itr++);
+ else
+ ++itr;
+ }
+}
+
+void EventMap::CancelEventGroup(uint32 group)
+{
+ if (!group || group > 8 || Empty())
+ return;
+
+ for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
+ {
+ if (itr->second & (1 << (group + 15)))
+ _eventMap.erase(itr++);
+ else
+ ++itr;
+ }
+}
+
+uint32 EventMap::GetNextEventTime(uint32 eventId) const
+{
+ if (Empty())
+ return 0;
+
+ for (EventStore::const_iterator itr = _eventMap.begin(); itr != _eventMap.end(); ++itr)
+ if (eventId == (itr->second & 0x0000FFFF))
+ return itr->first;
+
+ return 0;
+}
+
+uint32 EventMap::GetTimeUntilEvent(uint32 eventId) const
+{
+ for (EventStore::const_iterator itr = _eventMap.begin(); itr != _eventMap.end(); ++itr)
+ if (eventId == (itr->second & 0x0000FFFF))
+ return itr->first - _time;
+
+ return std::numeric_limits<uint32>::max();
+}
diff --git a/src/server/shared/Utilities/EventMap.h b/src/server/shared/Utilities/EventMap.h
new file mode 100644
index 00000000000..021dffc4940
--- /dev/null
+++ b/src/server/shared/Utilities/EventMap.h
@@ -0,0 +1,342 @@
+/*
+ * Copyright (C) 2008-2015 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 _EVENT_MAP_H_
+#define _EVENT_MAP_H_
+
+#include "Common.h"
+#include "Duration.h"
+#include "Util.h"
+
+class EventMap
+{
+ /**
+ * Internal storage type.
+ * Key: Time as uint32 when the event should occur.
+ * Value: The event data as uint32.
+ *
+ * Structure of event data:
+ * - Bit 0 - 15: Event Id.
+ * - Bit 16 - 23: Group
+ * - Bit 24 - 31: Phase
+ * - Pattern: 0xPPGGEEEE
+ */
+ typedef std::multimap<uint32, uint32> EventStore;
+
+public:
+ EventMap() : _time(0), _phase(0), _lastEvent(0) { }
+
+ /**
+ * @name Reset
+ * @brief Removes all scheduled events and resets time and phase.
+ */
+ void Reset();
+
+ /**
+ * @name Update
+ * @brief Updates the timer of the event map.
+ * @param time Value in ms to be added to time.
+ */
+ void Update(uint32 time)
+ {
+ _time += time;
+ }
+
+ /**
+ * @name GetTimer
+ * @return Current timer in ms value.
+ */
+ uint32 GetTimer() const
+ {
+ return _time;
+ }
+
+ /**
+ * @name GetPhaseMask
+ * @return Active phases as mask.
+ */
+ uint8 GetPhaseMask() const
+ {
+ return _phase;
+ }
+
+ /**
+ * @name Empty
+ * @return True, if there are no events scheduled.
+ */
+ bool Empty() const
+ {
+ return _eventMap.empty();
+ }
+
+ /**
+ * @name SetPhase
+ * @brief Sets the phase of the map (absolute).
+ * @param phase Phase which should be set. Values: 1 - 8. 0 resets phase.
+ */
+ void SetPhase(uint8 phase);
+
+ /**
+ * @name AddPhase
+ * @brief Activates the given phase (bitwise).
+ * @param phase Phase which should be activated. Values: 1 - 8
+ */
+ void AddPhase(uint8 phase)
+ {
+ if (phase && phase <= 8)
+ _phase |= uint8(1 << (phase - 1));
+ }
+
+ /**
+ * @name RemovePhase
+ * @brief Deactivates the given phase (bitwise).
+ * @param phase Phase which should be deactivated. Values: 1 - 8.
+ */
+ void RemovePhase(uint8 phase)
+ {
+ if (phase && phase <= 8)
+ _phase &= uint8(~(1 << (phase - 1)));
+ }
+
+ /**
+ * @name ScheduleEvent
+ * @brief Creates new event entry in map.
+ * @param eventId The id of the new event.
+ * @param time The time in milliseconds as std::chrono::duration until the event occurs.
+ * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group.
+ * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases.
+ */
+ void ScheduleEvent(uint32 eventId, Milliseconds const& time, uint32 group = 0, uint8 phase = 0)
+ {
+ ScheduleEvent(eventId, time.count(), group, phase);
+ }
+
+ /**
+ * @name ScheduleEvent
+ * @brief Creates new event entry in map.
+ * @param eventId The id of the new event.
+ * @param time The time in milliseconds until the event occurs.
+ * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group.
+ * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases.
+ */
+ void ScheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint8 phase = 0);
+
+ /**
+ * @name RescheduleEvent
+ * @brief Cancels the given event and reschedules it.
+ * @param eventId The id of the event.
+ * @param time The time in milliseconds as std::chrono::duration until the event occurs.
+ * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group.
+ * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases.
+ */
+ void RescheduleEvent(uint32 eventId, Milliseconds const& time, uint32 group = 0, uint8 phase = 0)
+ {
+ RescheduleEvent(eventId, time.count(), group, phase);
+ }
+
+ /**
+ * @name RescheduleEvent
+ * @brief Cancels the given event and reschedules it.
+ * @param eventId The id of the event.
+ * @param time The time in milliseconds until the event occurs.
+ * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group.
+ * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases.
+ */
+ void RescheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint8 phase = 0)
+ {
+ CancelEvent(eventId);
+ ScheduleEvent(eventId, time, group, phase);
+ }
+
+ /**
+ * @name RepeatEvent
+ * @brief Repeats the mostly recently executed event.
+ * @param time Time until in milliseconds as std::chrono::duration the event occurs.
+ */
+ void Repeat(Milliseconds const& time)
+ {
+ Repeat(time.count());
+ }
+
+ /**
+ * @name RepeatEvent
+ * @brief Repeats the mostly recently executed event.
+ * @param time Time until the event occurs.
+ */
+ void Repeat(uint32 time)
+ {
+ _eventMap.insert(EventStore::value_type(_time + time, _lastEvent));
+ }
+
+ /**
+ * @name RepeatEvent
+ * @brief Repeats the mostly recently executed event.
+ * @param minTime Minimum time as std::chrono::duration until the event occurs.
+ * @param maxTime Maximum time as std::chrono::duration until the event occurs.
+ */
+ void Repeat(Milliseconds const& minTime, Milliseconds const& maxTime)
+ {
+ Repeat(minTime.count(), maxTime.count());
+ }
+
+ /**
+ * @name RepeatEvent
+ * @brief Repeats the mostly recently executed event, Equivalent to Repeat(urand(minTime, maxTime).
+ * @param minTime Minimum time until the event occurs.
+ * @param maxTime Maximum time until the event occurs.
+ */
+ void Repeat(uint32 minTime, uint32 maxTime)
+ {
+ Repeat(urand(minTime, maxTime));
+ }
+
+ /**
+ * @name ExecuteEvent
+ * @brief Returns the next event to execute and removes it from map.
+ * @return Id of the event to execute.
+ */
+ uint32 ExecuteEvent();
+
+ /**
+ * @name DelayEvents
+ * @brief Delays all events in the map. If delay is greater than or equal internal timer, delay will be 0.
+ * @param delay Amount of delay in ms as std::chrono::duration.
+ */
+ void DelayEvents(Milliseconds const& delay)
+ {
+ DelayEvents(delay.count());
+ }
+
+ /**
+ * @name DelayEvents
+ * @brief Delays all events in the map. If delay is greater than or equal internal timer, delay will be 0.
+ * @param delay Amount of delay.
+ */
+ void DelayEvents(uint32 delay)
+ {
+ _time = delay < _time ? _time - delay : 0;
+ }
+
+ /**
+ * @name DelayEvents
+ * @brief Delay all events of the same group.
+ * @param delay Amount of delay in ms as std::chrono::duration.
+ * @param group Group of the events.
+ */
+ void DelayEvents(Milliseconds const& delay, uint32 group)
+ {
+ DelayEvents(delay.count(), group);
+ }
+
+ /**
+ * @name DelayEvents
+ * @brief Delay all events of the same group.
+ * @param delay Amount of delay.
+ * @param group Group of the events.
+ */
+ void DelayEvents(uint32 delay, uint32 group);
+
+ /**
+ * @name CancelEvent
+ * @brief Cancels all events of the specified id.
+ * @param eventId Event id to cancel.
+ */
+ void CancelEvent(uint32 eventId);
+
+ /**
+ * @name CancelEventGroup
+ * @brief Cancel events belonging to specified group.
+ * @param group Group to cancel.
+ */
+ void CancelEventGroup(uint32 group);
+
+ /**
+ * @name GetNextEventTime
+ * @brief Returns closest occurence of specified event.
+ * @param eventId Wanted event id.
+ * @return Time of found event.
+ */
+ uint32 GetNextEventTime(uint32 eventId) const;
+
+ /**
+ * @name GetNextEventTime
+ * @return Time of next event.
+ */
+ uint32 GetNextEventTime() const
+ {
+ return Empty() ? 0 : _eventMap.begin()->first;
+ }
+
+ /**
+ * @name IsInPhase
+ * @brief Returns whether event map is in specified phase or not.
+ * @param phase Wanted phase.
+ * @return True, if phase of event map contains specified phase.
+ */
+ bool IsInPhase(uint8 phase) const
+ {
+ return phase <= 8 && (!phase || _phase & (1 << (phase - 1)));
+ }
+
+ /**
+ * @name GetTimeUntilEvent
+ * @brief Returns time in milliseconds until next event.
+ * @param eventId of the event.
+ * @return Time of next event.
+ */
+ uint32 GetTimeUntilEvent(uint32 eventId) const;
+
+private:
+ /**
+ * @name _time
+ * @brief Internal timer.
+ *
+ * This does not represent the real date/time value.
+ * It's more like a stopwatch: It can run, it can be stopped,
+ * it can be resetted and so on. Events occur when this timer
+ * has reached their time value. Its value is changed in the
+ * Update method.
+ */
+ uint32 _time;
+
+ /**
+ * @name _phase
+ * @brief Phase mask of the event map.
+ *
+ * Contains the phases the event map is in. Multiple
+ * phases from 1 to 8 can be set with SetPhase or
+ * AddPhase. RemovePhase deactives a phase.
+ */
+ uint8 _phase;
+
+ /**
+ * @name _eventMap
+ * @brief Internal event storage map. Contains the scheduled events.
+ *
+ * See typedef at the beginning of the class for more
+ * details.
+ */
+ EventStore _eventMap;
+
+ /**
+ * @name _lastEvent
+ * @brief Stores information on the most recently executed event
+ */
+ uint32 _lastEvent;
+};
+
+#endif // _EVENT_MAP_H_
diff --git a/src/server/shared/Utilities/StringFormat.h b/src/server/shared/Utilities/StringFormat.h
index 70d9aefb14d..67e0100e7c8 100644
--- a/src/server/shared/Utilities/StringFormat.h
+++ b/src/server/shared/Utilities/StringFormat.h
@@ -19,15 +19,27 @@
#ifndef TRINITYCORE_STRING_FORMAT_H
#define TRINITYCORE_STRING_FORMAT_H
-#include <format.h>
+#include "format.h"
namespace Trinity
{
- //! Default TC string format function
- template<typename... Args>
- inline std::string StringFormat(const char* fmt, Args const&... args)
+ /// Default TC string format function.
+ template<typename Format, typename... Args>
+ inline std::string StringFormat(Format&& fmt, Args&&... args)
{
- return fmt::sprintf(fmt, args...);
+ return fmt::sprintf(std::forward<Format>(fmt), std::forward<Args>(args)...);
+ }
+
+ /// Returns true if the given char pointer is null.
+ inline bool IsFormatEmptyOrNull(const char* fmt)
+ {
+ return fmt == nullptr;
+ }
+
+ /// Returns true if the given std::string is empty.
+ inline bool IsFormatEmptyOrNull(std::string const& fmt)
+ {
+ return fmt.empty();
}
}
diff --git a/src/server/shared/Utilities/TaskScheduler.h b/src/server/shared/Utilities/TaskScheduler.h
index d45835b5f17..f1fe7ea0a21 100644
--- a/src/server/shared/Utilities/TaskScheduler.h
+++ b/src/server/shared/Utilities/TaskScheduler.h
@@ -29,6 +29,7 @@
#include <boost/optional.hpp>
#include "Util.h"
+#include "Duration.h"
class TaskContext;
@@ -646,16 +647,4 @@ private:
void Invoke();
};
-/// Milliseconds shorthand typedef.
-typedef std::chrono::milliseconds Milliseconds;
-
-/// Seconds shorthand typedef.
-typedef std::chrono::seconds Seconds;
-
-/// Minutes shorthand typedef.
-typedef std::chrono::minutes Minutes;
-
-/// Hours shorthand typedef.
-typedef std::chrono::hours Hours;
-
#endif /// _TASK_SCHEDULER_H_
diff --git a/src/server/shared/Utilities/Timer.h b/src/server/shared/Utilities/Timer.h
index b7d2fa1b5ad..c54903d7be2 100644
--- a/src/server/shared/Utilities/Timer.h
+++ b/src/server/shared/Utilities/Timer.h
@@ -21,10 +21,10 @@
#include <chrono>
-using namespace std::chrono;
-
inline uint32 getMSTime()
{
+ using namespace std::chrono;
+
static const system_clock::time_point ApplicationStartTime = system_clock::now();
return uint32(duration_cast<milliseconds>(system_clock::now() - ApplicationStartTime).count());
diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp
index 9a3d612a54b..ec67968f11e 100644
--- a/src/server/shared/Utilities/Util.cpp
+++ b/src/server/shared/Utilities/Util.cpp
@@ -573,15 +573,6 @@ std::string ByteArrayToHexStr(uint8 const* bytes, uint32 arrayLen, bool reverse
return ss.str();
}
-uint32 EventMap::GetTimeUntilEvent(uint32 eventId) const
-{
- for (EventStore::const_iterator itr = _eventMap.begin(); itr != _eventMap.end(); ++itr)
- if (eventId == (itr->second & 0x0000FFFF))
- return itr->first - _time;
-
- return std::numeric_limits<uint32>::max();
-}
-
void HexStrToByteArray(std::string const& str, uint8* out, bool reverse /*= false*/)
{
// string must have even number of characters
diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h
index 9605efe18ec..a96fd21058f 100644
--- a/src/server/shared/Utilities/Util.h
+++ b/src/server/shared/Utilities/Util.h
@@ -555,346 +555,4 @@ bool CompareValues(ComparisionType type, T val1, T val2)
}
}
-class EventMap
-{
- /**
- * Internal storage type.
- * Key: Time as uint32 when the event should occur.
- * Value: The event data as uint32.
- *
- * Structure of event data:
- * - Bit 0 - 15: Event Id.
- * - Bit 16 - 23: Group
- * - Bit 24 - 31: Phase
- * - Pattern: 0xPPGGEEEE
- */
- typedef std::multimap<uint32, uint32> EventStore;
-
- public:
- EventMap() : _time(0), _phase(0), _lastEvent(0) { }
-
- /**
- * @name Reset
- * @brief Removes all scheduled events and resets time and phase.
- */
- void Reset()
- {
- _eventMap.clear();
- _time = 0;
- _phase = 0;
- }
-
- /**
- * @name Update
- * @brief Updates the timer of the event map.
- * @param time Value to be added to time.
- */
- void Update(uint32 time)
- {
- _time += time;
- }
-
- /**
- * @name GetTimer
- * @return Current timer value.
- */
- uint32 GetTimer() const
- {
- return _time;
- }
-
- /**
- * @name GetPhaseMask
- * @return Active phases as mask.
- */
- uint8 GetPhaseMask() const
- {
- return _phase;
- }
-
- /**
- * @name Empty
- * @return True, if there are no events scheduled.
- */
- bool Empty() const
- {
- return _eventMap.empty();
- }
-
- /**
- * @name SetPhase
- * @brief Sets the phase of the map (absolute).
- * @param phase Phase which should be set. Values: 1 - 8. 0 resets phase.
- */
- void SetPhase(uint8 phase)
- {
- if (!phase)
- _phase = 0;
- else if (phase <= 8)
- _phase = uint8(1 << (phase - 1));
- }
-
- /**
- * @name AddPhase
- * @brief Activates the given phase (bitwise).
- * @param phase Phase which should be activated. Values: 1 - 8
- */
- void AddPhase(uint8 phase)
- {
- if (phase && phase <= 8)
- _phase |= uint8(1 << (phase - 1));
- }
-
- /**
- * @name RemovePhase
- * @brief Deactivates the given phase (bitwise).
- * @param phase Phase which should be deactivated. Values: 1 - 8.
- */
- void RemovePhase(uint8 phase)
- {
- if (phase && phase <= 8)
- _phase &= uint8(~(1 << (phase - 1)));
- }
-
- /**
- * @name ScheduleEvent
- * @brief Creates new event entry in map.
- * @param eventId The id of the new event.
- * @param time The time in milliseconds until the event occurs.
- * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group.
- * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases.
- */
- void ScheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint8 phase = 0)
- {
- if (group && group <= 8)
- eventId |= (1 << (group + 15));
-
- if (phase && phase <= 8)
- eventId |= (1 << (phase + 23));
-
- _eventMap.insert(EventStore::value_type(_time + time, eventId));
- }
-
- /**
- * @name RescheduleEvent
- * @brief Cancels the given event and reschedules it.
- * @param eventId The id of the event.
- * @param time The time in milliseconds until the event occurs.
- * @param group The group which the event is associated to. Has to be between 1 and 8. 0 means it has no group.
- * @param phase The phase in which the event can occur. Has to be between 1 and 8. 0 means it can occur in all phases.
- */
- void RescheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint8 phase = 0)
- {
- CancelEvent(eventId);
- ScheduleEvent(eventId, time, group, phase);
- }
-
- /**
- * @name RepeatEvent
- * @brief Repeats the mostly recently executed event.
- * @param time Time until the event occurs.
- */
- void Repeat(uint32 time)
- {
- _eventMap.insert(EventStore::value_type(_time + time, _lastEvent));
- }
-
- /**
- * @name RepeatEvent
- * @brief Repeats the mostly recently executed event, Equivalent to Repeat(urand(minTime, maxTime).
- * @param minTime Minimum time until the event occurs.
- * @param maxTime Maximum time until the event occurs.
- */
- void Repeat(uint32 minTime, uint32 maxTime)
- {
- Repeat(urand(minTime, maxTime));
- }
-
- /**
- * @name ExecuteEvent
- * @brief Returns the next event to execute and removes it from map.
- * @return Id of the event to execute.
- */
- uint32 ExecuteEvent()
- {
- while (!Empty())
- {
- EventStore::iterator itr = _eventMap.begin();
-
- if (itr->first > _time)
- return 0;
- else if (_phase && (itr->second & 0xFF000000) && !((itr->second >> 24) & _phase))
- _eventMap.erase(itr);
- else
- {
- uint32 eventId = (itr->second & 0x0000FFFF);
- _lastEvent = itr->second; // include phase/group
- _eventMap.erase(itr);
- return eventId;
- }
- }
-
- return 0;
- }
-
- /**
- * @name DelayEvents
- * @brief Delays all events in the map. If delay is greater than or equal internal timer, delay will be 0.
- * @param delay Amount of delay.
- */
- void DelayEvents(uint32 delay)
- {
- _time = delay < _time ? _time - delay : 0;
- }
-
- /**
- * @name DelayEvents
- * @brief Delay all events of the same group.
- * @param delay Amount of delay.
- * @param group Group of the events.
- */
- void DelayEvents(uint32 delay, uint32 group)
- {
- if (!group || group > 8 || Empty())
- return;
-
- EventStore delayed;
-
- for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
- {
- if (itr->second & (1 << (group + 15)))
- {
- delayed.insert(EventStore::value_type(itr->first + delay, itr->second));
- _eventMap.erase(itr++);
- }
- else
- ++itr;
- }
-
- _eventMap.insert(delayed.begin(), delayed.end());
- }
-
- /**
- * @name CancelEvent
- * @brief Cancels all events of the specified id.
- * @param eventId Event id to cancel.
- */
- void CancelEvent(uint32 eventId)
- {
- if (Empty())
- return;
-
- for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
- {
- if (eventId == (itr->second & 0x0000FFFF))
- _eventMap.erase(itr++);
- else
- ++itr;
- }
- }
-
- /**
- * @name CancelEventGroup
- * @brief Cancel events belonging to specified group.
- * @param group Group to cancel.
- */
- void CancelEventGroup(uint32 group)
- {
- if (!group || group > 8 || Empty())
- return;
-
- for (EventStore::iterator itr = _eventMap.begin(); itr != _eventMap.end();)
- {
- if (itr->second & (1 << (group + 15)))
- _eventMap.erase(itr++);
- else
- ++itr;
- }
- }
-
- /**
- * @name GetNextEventTime
- * @brief Returns closest occurence of specified event.
- * @param eventId Wanted event id.
- * @return Time of found event.
- */
- uint32 GetNextEventTime(uint32 eventId) const
- {
- if (Empty())
- return 0;
-
- for (EventStore::const_iterator itr = _eventMap.begin(); itr != _eventMap.end(); ++itr)
- if (eventId == (itr->second & 0x0000FFFF))
- return itr->first;
-
- return 0;
- }
-
- /**
- * @name GetNextEventTime
- * @return Time of next event.
- */
- uint32 GetNextEventTime() const
- {
- return Empty() ? 0 : _eventMap.begin()->first;
- }
-
- /**
- * @name IsInPhase
- * @brief Returns wether event map is in specified phase or not.
- * @param phase Wanted phase.
- * @return True, if phase of event map contains specified phase.
- */
- bool IsInPhase(uint8 phase)
- {
- return phase <= 8 && (!phase || _phase & (1 << (phase - 1)));
- }
-
- /**
- * @name GetTimeUntilEvent
- * @brief Returns time in milliseconds until next event.
- * @param eventId of the event.
- * @return Time of next event.
- */
- uint32 GetTimeUntilEvent(uint32 eventId) const;
-
- private:
- /**
- * @name _time
- * @brief Internal timer.
- *
- * This does not represent the real date/time value.
- * It's more like a stopwatch: It can run, it can be stopped,
- * it can be resetted and so on. Events occur when this timer
- * has reached their time value. Its value is changed in the
- * Update method.
- */
- uint32 _time;
-
- /**
- * @name _phase
- * @brief Phase mask of the event map.
- *
- * Contains the phases the event map is in. Multiple
- * phases from 1 to 8 can be set with SetPhase or
- * AddPhase. RemovePhase deactives a phase.
- */
- uint8 _phase;
-
- /**
- * @name _eventMap
- * @brief Internal event storage map. Contains the scheduled events.
- *
- * See typedef at the beginning of the class for more
- * details.
- */
- EventStore _eventMap;
-
- /**
- * @name _lastEvent
- * @brief Stores information on the most recently executed event
- */
- uint32 _lastEvent;
-};
-
#endif