aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.h1
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp4
-rw-r--r--src/server/game/Achievements/CriteriaHandler.cpp1
-rw-r--r--src/server/game/Battlegrounds/ArenaScore.h3
-rw-r--r--src/server/game/Battlegrounds/Battleground.h15
-rw-r--r--src/server/game/Battlegrounds/BattlegroundMgr.cpp5
-rw-r--r--src/server/game/Battlegrounds/BattlegroundMgr.h6
-rw-r--r--src/server/game/Battlegrounds/BattlegroundQueue.cpp3
-rw-r--r--src/server/game/Battlegrounds/BattlegroundScore.h6
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp4
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundDS.h1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp5
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp4
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp5
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp1
-rw-r--r--src/server/game/Chat/Channels/ChannelAppenders.h5
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp7
-rw-r--r--src/server/game/DataStores/DB2Stores.cpp14
-rw-r--r--src/server/game/DataStores/DB2Stores.h4
-rw-r--r--src/server/game/DataStores/DB2Structure.h6
-rw-r--r--src/server/game/DataStores/DBCEnums.h10
-rw-r--r--src/server/game/Entities/AreaTrigger/AreaTrigger.cpp1
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp8
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h23
-rw-r--r--src/server/game/Entities/Item/Item.h2
-rw-r--r--src/server/game/Entities/Object/MovementInfo.h111
-rw-r--r--src/server/game/Entities/Object/Object.h134
-rw-r--r--src/server/game/Entities/Object/ObjectDefines.h68
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp2
-rw-r--r--src/server/game/Entities/Player/EquipementSet.h67
-rw-r--r--src/server/game/Entities/Player/Player.cpp23
-rw-r--r--src/server/game/Entities/Player/Player.h50
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp33
-rw-r--r--src/server/game/Entities/Unit/Unit.h54
-rw-r--r--src/server/game/Entities/Unit/UnitDefines.h30
-rw-r--r--src/server/game/Globals/ObjectMgr.h2
-rw-r--r--src/server/game/Guilds/Guild.cpp47
-rw-r--r--src/server/game/Guilds/Guild.h64
-rw-r--r--src/server/game/Guilds/GuildFinderMgr.cpp1
-rw-r--r--src/server/game/Guilds/GuildMgr.cpp1
-rw-r--r--src/server/game/Handlers/CalendarHandler.cpp1
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp17
-rw-r--r--src/server/game/Handlers/GuildHandler.cpp15
-rw-r--r--src/server/game/Handlers/NPCHandler.cpp31
-rw-r--r--src/server/game/Handlers/PetitionsHandler.cpp1
-rw-r--r--src/server/game/Handlers/ToyHandler.cpp4
-rw-r--r--src/server/game/Maps/Map.cpp2
-rw-r--r--src/server/game/Maps/Map.h2
-rw-r--r--src/server/game/Maps/MapScripts.cpp3
-rw-r--r--src/server/game/Maps/TransportMgr.cpp10
-rw-r--r--src/server/game/Maps/TransportMgr.h2
-rw-r--r--src/server/game/Miscellaneous/SharedDefines.h15
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp3
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h6
-rw-r--r--src/server/game/Server/Packets/CharacterPackets.cpp17
-rw-r--r--src/server/game/Server/Packets/CharacterPackets.h30
-rw-r--r--src/server/game/Server/Packets/CombatLogPackets.cpp2
-rw-r--r--src/server/game/Server/Packets/CombatLogPackets.h4
-rw-r--r--src/server/game/Server/Packets/CombatLogPacketsCommon.cpp84
-rw-r--r--src/server/game/Server/Packets/CombatLogPacketsCommon.h120
-rw-r--r--src/server/game/Server/Packets/CombatPackets.cpp2
-rw-r--r--src/server/game/Server/Packets/CombatPackets.h12
-rw-r--r--src/server/game/Server/Packets/EquipmentSetPackets.cpp6
-rw-r--r--src/server/game/Server/Packets/EquipmentSetPackets.h6
-rw-r--r--src/server/game/Server/Packets/GuildPackets.h4
-rw-r--r--src/server/game/Server/Packets/InspectPackets.h3
-rw-r--r--src/server/game/Server/Packets/LootPackets.h2
-rw-r--r--src/server/game/Server/Packets/MailPackets.h4
-rw-r--r--src/server/game/Server/Packets/NPCPackets.cpp5
-rw-r--r--src/server/game/Server/Packets/NPCPackets.h8
-rw-r--r--src/server/game/Server/Packets/PetPackets.h7
-rw-r--r--src/server/game/Server/Packets/QueryPackets.cpp17
-rw-r--r--src/server/game/Server/Packets/QueryPackets.h17
-rw-r--r--src/server/game/Server/Packets/QuestPackets.h2
-rw-r--r--src/server/game/Server/Packets/SpellPackets.cpp62
-rw-r--r--src/server/game/Server/Packets/SpellPackets.h113
-rw-r--r--src/server/game/Server/Packets/TalentPackets.h3
-rw-r--r--src/server/game/Server/Packets/ToyPackets.h2
-rw-r--r--src/server/game/Server/Packets/TradePackets.h5
-rw-r--r--src/server/game/Server/Packets/VoidStoragePackets.h4
-rw-r--r--src/server/game/Server/WorldSession.h9
-rw-r--r--src/server/game/Server/WorldSocketMgr.cpp5
-rw-r--r--src/server/game/Server/WorldSocketMgr.h8
-rw-r--r--src/server/game/Spells/Auras/SpellAuraDefines.h10
-rw-r--r--src/server/game/Spells/Spell.cpp98
-rw-r--r--src/server/game/Spells/Spell.h79
-rw-r--r--src/server/game/Spells/SpellEffects.cpp85
-rw-r--r--src/server/game/Spells/SpellHistory.cpp2
-rw-r--r--src/server/game/Spells/SpellInfo.cpp32
-rw-r--r--src/server/game/Spells/SpellInfo.h20
-rw-r--r--src/server/game/World/World.cpp3
-rw-r--r--src/server/scripts/Commands/cs_guild.cpp1
-rw-r--r--src/server/scripts/Commands/cs_instance.cpp2
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp1
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp1
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp12
-rw-r--r--src/server/scripts/Spells/spell_item.cpp4
-rw-r--r--src/server/scripts/Spells/spell_mage.cpp4
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp4
-rw-r--r--src/server/worldserver/Main.cpp3
101 files changed, 1045 insertions, 823 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h
index c93bf046007..3ebcf719fbb 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.h
+++ b/src/server/game/AI/SmartScripts/SmartAI.h
@@ -21,6 +21,7 @@
#include "Define.h"
#include "CreatureAI.h"
#include "GameObjectAI.h"
+#include "Position.h"
#include "SmartScript.h"
struct WayPoint;
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 22597d36fab..afaffc5abb8 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -649,9 +649,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
bool _allowMove = false;
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(e.action.cast.spell);
- std::vector<SpellInfo::CostData> costs = spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask());
+ std::vector<SpellPowerCost> costs = spellInfo->CalcPowerCost(me, spellInfo->GetSchoolMask());
bool hasPower = true;
- for (SpellInfo::CostData const& cost : costs)
+ for (SpellPowerCost const& cost : costs)
{
if (cost.Power == POWER_HEALTH)
{
diff --git a/src/server/game/Achievements/CriteriaHandler.cpp b/src/server/game/Achievements/CriteriaHandler.cpp
index 081c758478e..eda31175b0b 100644
--- a/src/server/game/Achievements/CriteriaHandler.cpp
+++ b/src/server/game/Achievements/CriteriaHandler.cpp
@@ -33,6 +33,7 @@
#include "ScriptMgr.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
+#include "World.h"
bool CriteriaData::IsValid(Criteria const* criteria)
{
diff --git a/src/server/game/Battlegrounds/ArenaScore.h b/src/server/game/Battlegrounds/ArenaScore.h
index cc6693dcd07..8d2a0b6790f 100644
--- a/src/server/game/Battlegrounds/ArenaScore.h
+++ b/src/server/game/Battlegrounds/ArenaScore.h
@@ -19,9 +19,6 @@
#define TRINITY_ARENA_SCORE_H
#include "BattlegroundScore.h"
-#include "SharedDefines.h"
-#include "Player.h"
-#include "ObjectAccessor.h"
#include <sstream>
struct TC_GAME_API ArenaScore : public BattlegroundScore
diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h
index 5c5fc5b8076..26c0a903ebc 100644
--- a/src/server/game/Battlegrounds/Battleground.h
+++ b/src/server/game/Battlegrounds/Battleground.h
@@ -20,23 +20,22 @@
#define __BATTLEGROUND_H
#include "ArenaScore.h"
-#include "Common.h"
-#include "SharedDefines.h"
#include "DBCEnums.h"
-#include "WorldPacket.h"
-#include "Object.h"
-#include "GameObject.h"
-#include "EventMap.h"
+#include "ObjectGuid.h"
+#include "Position.h"
+#include "SharedDefines.h"
+#include <map>
+class BattlegroundMap;
class Creature;
class GameObject;
class Group;
class Player;
+class Transport;
class Unit;
class WorldObject;
class WorldPacket;
-class BattlegroundMap;
-
+struct BattlegroundScore;
struct PvpDifficultyEntry;
struct WorldSafeLocsEntry;
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index 9705521f5d2..601191596ac 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -47,6 +47,11 @@
#include "World.h"
#include "WorldPacket.h"
+bool BattlegroundTemplate::IsArena() const
+{
+ return BattlemasterEntry->InstanceType == MAP_ARENA;
+}
+
/*********************************************************/
/*** BATTLEGROUND MANAGER ***/
/*********************************************************/
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h
index 1914a880be7..a240d53d916 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.h
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.h
@@ -23,6 +23,10 @@
#include "DBCEnums.h"
#include "Battleground.h"
#include "BattlegroundQueue.h"
+#include <unordered_map>
+
+class Battleground;
+struct BattlemasterListEntry;
typedef std::map<uint32, Battleground*> BattlegroundContainer;
typedef std::set<uint32> BattlegroundClientIdsContainer;
@@ -54,7 +58,7 @@ struct BattlegroundTemplate
uint32 ScriptId;
BattlemasterListEntry const* BattlemasterEntry;
- bool IsArena() const { return BattlemasterEntry->InstanceType == MAP_ARENA; }
+ bool IsArena() const;
};
namespace WorldPackets
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
index 59cd9f3cecf..12de65a891e 100644
--- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
@@ -23,8 +23,9 @@
#include "BattlegroundPackets.h"
#include "Chat.h"
#include "Group.h"
-#include "Log.h"
#include "Language.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
#include "Player.h"
#include "World.h"
diff --git a/src/server/game/Battlegrounds/BattlegroundScore.h b/src/server/game/Battlegrounds/BattlegroundScore.h
index d52ec0c48dc..9d46755c854 100644
--- a/src/server/game/Battlegrounds/BattlegroundScore.h
+++ b/src/server/game/Battlegrounds/BattlegroundScore.h
@@ -18,9 +18,9 @@
#ifndef TRINITY_BATTLEGROUND_SCORE_H
#define TRINITY_BATTLEGROUND_SCORE_H
-#include "WorldPacket.h"
-#include "Player.h"
-#include "ObjectAccessor.h"
+#include "Errors.h"
+#include "ObjectGuid.h"
+#include "SharedDefines.h"
enum ScoreType
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index 61360b254fc..7251538ff76 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -20,6 +20,7 @@
#include "WorldPacket.h"
#include "BattlegroundMgr.h"
#include "Creature.h"
+#include "GameObject.h"
#include "Language.h"
#include "Log.h"
#include "Player.h"
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index 6dd3fdedb28..8b91a4602d8 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -17,14 +17,14 @@
*/
#include "BattlegroundAV.h"
+#include "CreatureAI.h"
#include "GameObject.h"
#include "Language.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "ScriptedCreature.h"
-#include "WorldPacket.h"
#include "WorldSession.h"
+#include "WorldStatePackets.h"
BattlegroundAV::BattlegroundAV()
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
index 0efc9e487e5..be62030c06b 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h
@@ -20,6 +20,7 @@
#define __BATTLEGROUNDDS_H
#include "Arena.h"
+#include "EventMap.h"
enum BattlegroundDSObjectTypes
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
index 7c4d06bdc28..7eb13c48431 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
@@ -17,15 +17,16 @@
*/
#include "BattlegroundEY.h"
-#include "WorldPacket.h"
#include "BattlegroundMgr.h"
+#include "BattlegroundPackets.h"
#include "Creature.h"
+#include "GameObject.h"
#include "Language.h"
#include "Log.h"
+#include "ObjectAccessor.h"
#include "Player.h"
#include "Random.h"
#include "Util.h"
-#include "BattlegroundPackets.h"
#include "WorldStatePackets.h"
// these variables aren't used outside of this file, so declare them only here
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index 4ffb91327f5..0a814cd3817 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -22,10 +22,10 @@
#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "ScriptedCreature.h"
#include "Transport.h"
+#include "UnitAI.h"
#include "Vehicle.h"
-#include "WorldPacket.h"
+#include "WorldStatePackets.h"
BattlegroundIC::BattlegroundIC()
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index 06c57d50049..774fca9c7de 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -17,14 +17,15 @@
*/
#include "BattlegroundSA.h"
+#include "CreatureAI.h"
#include "GameObject.h"
#include "Language.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
-#include "ScriptedCreature.h"
+#include "Random.h"
#include "UpdateData.h"
-#include "WorldPacket.h"
+#include "WorldStatePackets.h"
BattlegroundSA::BattlegroundSA()
{
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index 0a599b15882..458a1e36692 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -23,6 +23,7 @@
#include "Language.h"
#include "Log.h"
#include "Object.h"
+#include "ObjectAccessor.h"
#include "Player.h"
#include "WorldPacket.h"
#include "WorldStatePackets.h"
diff --git a/src/server/game/Chat/Channels/ChannelAppenders.h b/src/server/game/Chat/Channels/ChannelAppenders.h
index 55ad307919e..6a098681094 100644
--- a/src/server/game/Chat/Channels/ChannelAppenders.h
+++ b/src/server/game/Chat/Channels/ChannelAppenders.h
@@ -20,7 +20,6 @@
#include "Channel.h"
#include "ChannelPackets.h"
-#include "ObjectMgr.h"
#include "World.h"
// initial packet data (notify type and channel name)
@@ -185,8 +184,8 @@ struct ChannelOwnerAppend
{
explicit ChannelOwnerAppend(Channel const* channel, ObjectGuid const& ownerGuid) : _channel(channel), _ownerGuid(ownerGuid)
{
- if (!ObjectMgr::GetPlayerNameByGUID(_ownerGuid, _ownerName))
- _ownerName = "PLAYER_NOT_FOUND";
+ if (CharacterInfo const* characterInfo = sWorld->GetCharacterInfo(_ownerGuid))
+ _ownerName = characterInfo->Name;
}
static uint8 const NotificationType = CHAT_CHANNEL_OWNER_NOTICE;
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 630d3c5a730..e3e92d6aa3a 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -18,6 +18,7 @@
#include "ConditionMgr.h"
#include "AchievementMgr.h"
+#include "Containers.h"
#include "DatabaseEnv.h"
#include "GameEventMgr.h"
#include "GameObject.h"
@@ -30,9 +31,9 @@
#include "Pet.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
-#include "ScriptedCreature.h"
#include "SpellAuras.h"
#include "SpellMgr.h"
+#include "World.h"
char const* const ConditionMgr::StaticSourceTypeData[CONDITION_SOURCE_TYPE_MAX] =
{
@@ -295,12 +296,12 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) const
}
case CONDITION_NEAR_CREATURE:
{
- condMeets = GetClosestCreatureWithEntry(object, ConditionValue1, (float)ConditionValue2, bool(!ConditionValue3)) ? true : false;
+ condMeets = object->FindNearestCreature(ConditionValue1, (float)ConditionValue2, bool(!ConditionValue3)) != nullptr;
break;
}
case CONDITION_NEAR_GAMEOBJECT:
{
- condMeets = GetClosestGameObjectWithEntry(object, ConditionValue1, (float)ConditionValue2) ? true : false;
+ condMeets = object->FindNearestGameObject(ConditionValue1, (float)ConditionValue2) != nullptr;
break;
}
case CONDITION_OBJECT_ENTRY_GUID:
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp
index 32841b6a436..3f398a9ff40 100644
--- a/src/server/game/DataStores/DB2Stores.cpp
+++ b/src/server/game/DataStores/DB2Stores.cpp
@@ -16,15 +16,13 @@
*/
#include "DB2Stores.h"
-#include "Common.h"
#include "Containers.h"
#include "DatabaseEnv.h"
#include "DB2LoadInfo.h"
#include "Hash.h"
#include "Log.h"
#include "Regex.h"
-#include "TransportMgr.h"
-#include "World.h"
+#include "Timer.h"
#include <array>
#include <sstream>
#include <cctype>
@@ -1009,12 +1007,6 @@ void DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
}
}
- for (TransportAnimationEntry const* anim : sTransportAnimationStore)
- sTransportMgr->AddPathNodeToTransport(anim->TransportID, anim->TimeIndex, anim);
-
- for (TransportRotationEntry const* rot : sTransportRotationStore)
- sTransportMgr->AddPathRotationToTransport(rot->TransportID, rot->TimeIndex, rot);
-
for (ToyEntry const* toy : sToyStore)
_toys.insert(toy->ItemID);
@@ -1688,7 +1680,7 @@ DB2Manager::MountXDisplayContainer const* DB2Manager::GetMountDisplays(uint32 mo
return Trinity::Containers::MapGetValuePtr(_mountDisplays, mountId);
}
-std::string DB2Manager::GetNameGenEntry(uint8 race, uint8 gender, LocaleConstant locale) const
+std::string DB2Manager::GetNameGenEntry(uint8 race, uint8 gender, LocaleConstant locale, LocaleConstant defaultLocale) const
{
ASSERT(gender < GENDER_NONE);
auto ritr = _nameGenData.find(race);
@@ -1702,7 +1694,7 @@ std::string DB2Manager::GetNameGenEntry(uint8 race, uint8 gender, LocaleConstant
if (*data->Str[locale] != '\0')
return data->Str[locale];
- return data->Str[sWorld->GetDefaultDbcLocale()];
+ return data->Str[defaultLocale];
}
ResponseCodes DB2Manager::ValidateName(std::wstring const& name, LocaleConstant locale) const
diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h
index 9b156babe80..ac8d91fe5b6 100644
--- a/src/server/game/DataStores/DB2Stores.h
+++ b/src/server/game/DataStores/DB2Stores.h
@@ -192,6 +192,8 @@ TC_GAME_API extern DB2Storage<SummonPropertiesEntry> sSummonPrope
TC_GAME_API extern DB2Storage<TalentEntry> sTalentStore;
TC_GAME_API extern DB2Storage<TaxiNodesEntry> sTaxiNodesStore;
TC_GAME_API extern DB2Storage<TaxiPathEntry> sTaxiPathStore;
+TC_GAME_API extern DB2Storage<TransportAnimationEntry> sTransportAnimationStore;
+TC_GAME_API extern DB2Storage<TransportRotationEntry> sTransportRotationStore;
TC_GAME_API extern DB2Storage<UnitPowerBarEntry> sUnitPowerBarStore;
TC_GAME_API extern DB2Storage<VehicleEntry> sVehicleStore;
TC_GAME_API extern DB2Storage<VehicleSeatEntry> sVehicleSeatStore;
@@ -296,7 +298,7 @@ public:
MapDifficultyEntry const* GetDefaultMapDifficulty(uint32 mapId, Difficulty* difficulty = nullptr) const;
MapDifficultyEntry const* GetMapDifficultyData(uint32 mapId, Difficulty difficulty) const;
MapDifficultyEntry const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty) const;
- std::string GetNameGenEntry(uint8 race, uint8 gender, LocaleConstant locale) const;
+ std::string GetNameGenEntry(uint8 race, uint8 gender, LocaleConstant locale, LocaleConstant defaultLocale) const;
MountEntry const* GetMount(uint32 spellId) const;
MountEntry const* GetMountById(uint32 id) const;
MountTypeXCapabilitySet const* GetMountCapabilities(uint32 mountType) const;
diff --git a/src/server/game/DataStores/DB2Structure.h b/src/server/game/DataStores/DB2Structure.h
index c0da73c4a46..21fd68677ef 100644
--- a/src/server/game/DataStores/DB2Structure.h
+++ b/src/server/game/DataStores/DB2Structure.h
@@ -2364,9 +2364,6 @@ struct SpellEffectEntry
float PvPMultiplier;
};
-#define MAX_SPELL_EFFECTS 32
-#define MAX_EFFECT_MASK 0xFFFFFFFF
-
struct SpellEffectScalingEntry
{
uint32 ID;
@@ -2651,9 +2648,6 @@ struct TactKeyEntry
uint8 Key[TACTKEY_SIZE];
};
-#define MAX_TALENT_TIERS 7
-#define MAX_TALENT_COLUMNS 3
-
struct TalentEntry
{
uint32 ID;
diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h
index 3c3bcb02340..fb67c17926f 100644
--- a/src/server/game/DataStores/DBCEnums.h
+++ b/src/server/game/DataStores/DBCEnums.h
@@ -257,7 +257,7 @@ enum CriteriaFlags
CRITERIA_FLAG_MONEY_COUNTER = 0x00000020 // Displays counter as money
};
-enum CriteriaTimedTypes
+enum CriteriaTimedTypes : uint8
{
CRITERIA_TIMED_TYPE_EVENT = 1, // Timer is started by internal event with id in timerStartEvent
CRITERIA_TIMED_TYPE_QUEST = 2, // Timer is started by accepting quest with entry in timerStartEvent
@@ -272,7 +272,7 @@ enum CriteriaTimedTypes
CRITERIA_TIMED_TYPE_MAX
};
-enum CriteriaTypes
+enum CriteriaTypes : uint8
{
CRITERIA_TYPE_KILL_CREATURE = 0,
CRITERIA_TYPE_WIN_BG = 1,
@@ -796,6 +796,9 @@ enum SpellCategoryFlags
SPELL_CATEGORY_FLAG_COOLDOWN_EXPIRES_AT_DAILY_RESET = 0x08
};
+#define MAX_SPELL_EFFECTS 32
+#define MAX_EFFECT_MASK 0xFFFFFFFF
+
enum SpellProcsPerMinuteModType
{
SPELL_PPM_MOD_HASTE = 1,
@@ -890,6 +893,9 @@ enum SummonPropFlags
SUMMON_PROP_FLAG_UNK21 = 0x00100000 // Totems
};
+#define MAX_TALENT_TIERS 7
+#define MAX_TALENT_COLUMNS 3
+
enum TaxiNodeFlags
{
TAXI_NODE_FLAG_ALLIANCE = 0x01,
diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp
index bfe8018af08..555a3aa581f 100644
--- a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp
+++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp
@@ -34,6 +34,7 @@
#include "Transport.h"
#include "Unit.h"
#include "UpdateData.h"
+#include <G3D/AABox.h>
AreaTrigger::AreaTrigger() : WorldObject(false), MapObject(),
_duration(0), _totalDuration(0), _timeSinceCreated(0), _previousCheckOrientation(std::numeric_limits<float>::infinity()),
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 9c8985e63c3..f3b40225078 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -1957,8 +1957,8 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* victim)
if (bcontinue)
continue;
- std::vector<SpellInfo::CostData> costs = spellInfo->CalcPowerCost(this, SpellSchoolMask(spellInfo->SchoolMask));
- auto m = std::find_if(costs.begin(), costs.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_MANA; });
+ std::vector<SpellPowerCost> costs = spellInfo->CalcPowerCost(this, SpellSchoolMask(spellInfo->SchoolMask));
+ auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_MANA; });
if (m != costs.end())
if (m->Amount > GetPower(POWER_MANA))
continue;
@@ -2005,8 +2005,8 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* victim)
if (bcontinue)
continue;
- std::vector<SpellInfo::CostData> costs = spellInfo->CalcPowerCost(this, SpellSchoolMask(spellInfo->SchoolMask));
- auto m = std::find_if(costs.begin(), costs.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_MANA; });
+ std::vector<SpellPowerCost> costs = spellInfo->CalcPowerCost(this, SpellSchoolMask(spellInfo->SchoolMask));
+ auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_MANA; });
if (m != costs.end())
if (m->Amount > GetPower(POWER_MANA))
continue;
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index e5951dec833..64c0ed1711c 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -21,7 +21,6 @@
#include "Common.h"
#include "SharedDefines.h"
-#include "Unit.h"
#include "Object.h"
#include "Loot.h"
#include "DatabaseEnvFwd.h"
@@ -31,6 +30,7 @@
class GameObjectAI;
class Group;
class Transport;
+enum TriggerCastFlags : uint32;
// from `gameobject_template`
struct GameObjectTemplate
@@ -881,19 +881,6 @@ struct GameObjectAddon
typedef std::unordered_map<ObjectGuid::LowType, GameObjectAddon> GameObjectAddonContainer;
-// client side GO show states
-enum GOState
-{
- GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open)
- GO_STATE_READY = 1, // show in world as ready (closed door close)
- GO_STATE_ACTIVE_ALTERNATIVE = 2, // show in world as used in alt way and not reset (closed door open by cannon fire)
- GO_STATE_TRANSPORT_ACTIVE = 24,
- GO_STATE_TRANSPORT_STOPPED = 25
-};
-
-#define MAX_GO_STATE 3
-#define MAX_GO_STATE_TRANSPORT_STOP_FRAMES 9
-
// from `gameobject`
struct GameObjectData
{
@@ -1095,13 +1082,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
bool IsAlwaysVisibleFor(WorldObject const* seer) const override;
bool IsInvisibleDueToDespawn() const override;
- uint8 getLevelForTarget(WorldObject const* target) const override
- {
- if (Unit* owner = GetOwner())
- return owner->getLevelForTarget(target);
-
- return 1;
- }
+ uint8 getLevelForTarget(WorldObject const* target) const override;
GameObject* LookupFishingHoleAround(float range);
diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h
index 78759928c54..76e1ef5258b 100644
--- a/src/server/game/Entities/Item/Item.h
+++ b/src/server/game/Entities/Item/Item.h
@@ -45,7 +45,7 @@ struct ItemSetEffect
std::unordered_set<ItemSetSpellEntry const*> SetBonuses;
};
-enum InventoryResult
+enum InventoryResult : uint8
{
EQUIP_ERR_OK = 0,
EQUIP_ERR_CANT_EQUIP_LEVEL_I = 1, // You must reach level %d to use that item.
diff --git a/src/server/game/Entities/Object/MovementInfo.h b/src/server/game/Entities/Object/MovementInfo.h
new file mode 100644
index 00000000000..9d95cf7ce97
--- /dev/null
+++ b/src/server/game/Entities/Object/MovementInfo.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2008-2017 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 MovementInfo_h__
+#define MovementInfo_h__
+
+#include "ObjectGuid.h"
+#include "Position.h"
+
+struct MovementInfo
+{
+ // common
+ ObjectGuid guid;
+ uint32 flags;
+ uint32 flags2;
+ Position pos;
+ uint32 time;
+
+ // transport
+ struct TransportInfo
+ {
+ void Reset()
+ {
+ guid.Clear();
+ pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
+ seat = -1;
+ time = 0;
+ prevTime = 0;
+ vehicleId = 0;
+ }
+
+ ObjectGuid guid;
+ Position pos;
+ int8 seat;
+ uint32 time;
+ uint32 prevTime;
+ uint32 vehicleId;
+ } transport;
+
+ // swimming/flying
+ float pitch;
+
+ // jumping
+ struct JumpInfo
+ {
+ void Reset()
+ {
+ fallTime = 0;
+ zspeed = sinAngle = cosAngle = xyspeed = 0.0f;
+ }
+
+ uint32 fallTime;
+
+ float zspeed, sinAngle, cosAngle, xyspeed;
+
+ } jump;
+
+ // spline
+ float splineElevation;
+
+ MovementInfo() :
+ flags(0), flags2(0), time(0), pitch(0.0f), splineElevation(0.0f)
+ {
+ pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
+ transport.Reset();
+ jump.Reset();
+ }
+
+ uint32 GetMovementFlags() const { return flags; }
+ void SetMovementFlags(uint32 flag) { flags = flag; }
+ void AddMovementFlag(uint32 flag) { flags |= flag; }
+ void RemoveMovementFlag(uint32 flag) { flags &= ~flag; }
+ bool HasMovementFlag(uint32 flag) const { return (flags & flag) != 0; }
+
+ uint32 GetExtraMovementFlags() const { return flags2; }
+ void SetExtraMovementFlags(uint32 flag) { flags2 = flag; }
+ void AddExtraMovementFlag(uint32 flag) { flags2 |= flag; }
+ void RemoveExtraMovementFlag(uint32 flag) { flags2 &= ~flag; }
+ bool HasExtraMovementFlag(uint32 flag) const { return (flags2 & flag) != 0; }
+
+ uint32 GetFallTime() const { return jump.fallTime; }
+ void SetFallTime(uint32 fallTime) { jump.fallTime = fallTime; }
+
+ void ResetTransport()
+ {
+ transport.Reset();
+ }
+
+ void ResetJump()
+ {
+ jump.Reset();
+ }
+
+ void OutDebug();
+};
+
+#endif // MovementInfo_h__
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index fbe3aadaa05..c5a34ab4a55 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -22,6 +22,8 @@
#include "Common.h"
#include "GridReference.h"
#include "GridRefManager.h"
+#include "MovementInfo.h"
+#include "ObjectDefines.h"
#include "ObjectGuid.h"
#include "Position.h"
#include "SharedDefines.h"
@@ -31,51 +33,6 @@
#include <set>
#include <unordered_map>
-#define CONTACT_DISTANCE 0.5f
-#define INTERACTION_DISTANCE 5.0f
-#define ATTACK_DISTANCE 5.0f
-#define INSPECT_DISTANCE 28.0f
-#define TRADE_DISTANCE 11.11f
-#define MAX_VISIBILITY_DISTANCE SIZE_OF_GRIDS // max distance for visible objects
-#define SIGHT_RANGE_UNIT 50.0f
-#define DEFAULT_VISIBILITY_DISTANCE 90.0f // default visible distance, 90 yards on continents
-#define DEFAULT_VISIBILITY_INSTANCE 170.0f // default visible distance in instances, 170 yards
-#define DEFAULT_VISIBILITY_BGARENAS 533.0f // default visible distance in BG/Arenas, roughly 533 yards
-
-#define DEFAULT_WORLD_OBJECT_SIZE 0.388999998569489f // player size, also currently used (correctly?) for any non Unit world objects
-#define DEFAULT_COMBAT_REACH 1.5f
-#define MIN_MELEE_REACH 2.0f
-#define NOMINAL_MELEE_RANGE 5.0f
-#define MELEE_RANGE (NOMINAL_MELEE_RANGE - MIN_MELEE_REACH * 2) //center to center for players
-
-#define DEFAULT_PHASE 169
-
-enum TempSummonType
-{
- TEMPSUMMON_TIMED_OR_DEAD_DESPAWN = 1, // despawns after a specified time OR when the creature disappears
- TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN = 2, // despawns after a specified time OR when the creature dies
- TEMPSUMMON_TIMED_DESPAWN = 3, // despawns after a specified time
- TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT = 4, // despawns after a specified time after the creature is out of combat
- TEMPSUMMON_CORPSE_DESPAWN = 5, // despawns instantly after death
- TEMPSUMMON_CORPSE_TIMED_DESPAWN = 6, // despawns after a specified time after death
- TEMPSUMMON_DEAD_DESPAWN = 7, // despawns when the creature disappears
- TEMPSUMMON_MANUAL_DESPAWN = 8 // despawns when UnSummon() is called
-};
-
-enum PhaseMasks
-{
- PHASEMASK_NORMAL = 0x00000001,
- PHASEMASK_ANYWHERE = 0xFFFFFFFF
-};
-
-enum NotifyFlags
-{
- NOTIFY_NONE = 0x00,
- NOTIFY_AI_RELOCATION = 0x01,
- NOTIFY_VISIBILITY_CHANGED = 0x02,
- NOTIFY_ALL = 0xFF
-};
-
class AreaTrigger;
class Conversation;
class Corpse;
@@ -379,93 +336,6 @@ class TC_GAME_API Object
Object& operator=(Object const& right) = delete;
};
-struct MovementInfo
-{
- // common
- ObjectGuid guid;
- uint32 flags;
- uint32 flags2;
- Position pos;
- uint32 time;
-
- // transport
- struct TransportInfo
- {
- void Reset()
- {
- guid.Clear();
- pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
- seat = -1;
- time = 0;
- prevTime = 0;
- vehicleId = 0;
- }
-
- ObjectGuid guid;
- Position pos;
- int8 seat;
- uint32 time;
- uint32 prevTime;
- uint32 vehicleId;
- } transport;
-
- // swimming/flying
- float pitch;
-
- // jumping
- struct JumpInfo
- {
- void Reset()
- {
- fallTime = 0;
- zspeed = sinAngle = cosAngle = xyspeed = 0.0f;
- }
-
- uint32 fallTime;
-
- float zspeed, sinAngle, cosAngle, xyspeed;
-
- } jump;
-
- // spline
- float splineElevation;
-
- MovementInfo() :
- flags(0), flags2(0), time(0), pitch(0.0f), splineElevation(0.0f)
- {
- pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
- transport.Reset();
- jump.Reset();
- }
-
- uint32 GetMovementFlags() const { return flags; }
- void SetMovementFlags(uint32 flag) { flags = flag; }
- void AddMovementFlag(uint32 flag) { flags |= flag; }
- void RemoveMovementFlag(uint32 flag) { flags &= ~flag; }
- bool HasMovementFlag(uint32 flag) const { return (flags & flag) != 0; }
-
- uint32 GetExtraMovementFlags() const { return flags2; }
- void SetExtraMovementFlags(uint32 flag) { flags2 = flag; }
- void AddExtraMovementFlag(uint32 flag) { flags2 |= flag; }
- void RemoveExtraMovementFlag(uint32 flag) { flags2 &= ~flag; }
- bool HasExtraMovementFlag(uint32 flag) const { return (flags2 & flag) != 0; }
-
- uint32 GetFallTime() const { return jump.fallTime; }
- void SetFallTime(uint32 fallTime) { jump.fallTime = fallTime; }
-
- void ResetTransport()
- {
- transport.Reset();
- }
-
- void ResetJump()
- {
- jump.Reset();
- }
-
- void OutDebug();
-};
-
template<class T>
class GridObject
{
diff --git a/src/server/game/Entities/Object/ObjectDefines.h b/src/server/game/Entities/Object/ObjectDefines.h
index dfe2a7c6ec5..1c2b785218d 100644
--- a/src/server/game/Entities/Object/ObjectDefines.h
+++ b/src/server/game/Entities/Object/ObjectDefines.h
@@ -21,46 +21,82 @@
#include "Define.h"
-// used for creating values for respawn for example
-inline uint64 MAKE_PAIR64(uint32 l, uint32 h);
-inline uint32 PAIR64_HIPART(uint64 x);
-inline uint32 PAIR64_LOPART(uint64 x);
-inline uint16 MAKE_PAIR16(uint8 l, uint8 h);
-inline uint32 MAKE_PAIR32(uint16 l, uint16 h);
-inline uint16 PAIR32_HIPART(uint32 x);
-inline uint16 PAIR32_LOPART(uint32 x);
-
-uint64 MAKE_PAIR64(uint32 l, uint32 h)
+#define CONTACT_DISTANCE 0.5f
+#define INTERACTION_DISTANCE 5.0f
+#define ATTACK_DISTANCE 5.0f
+#define INSPECT_DISTANCE 28.0f
+#define TRADE_DISTANCE 11.11f
+#define MAX_VISIBILITY_DISTANCE SIZE_OF_GRIDS // max distance for visible objects
+#define SIGHT_RANGE_UNIT 50.0f
+#define DEFAULT_VISIBILITY_DISTANCE 90.0f // default visible distance, 90 yards on continents
+#define DEFAULT_VISIBILITY_INSTANCE 170.0f // default visible distance in instances, 170 yards
+#define DEFAULT_VISIBILITY_BGARENAS 533.0f // default visible distance in BG/Arenas, roughly 533 yards
+
+#define DEFAULT_WORLD_OBJECT_SIZE 0.388999998569489f // player size, also currently used (correctly?) for any non Unit world objects
+#define DEFAULT_COMBAT_REACH 1.5f
+#define MIN_MELEE_REACH 2.0f
+#define NOMINAL_MELEE_RANGE 5.0f
+#define MELEE_RANGE (NOMINAL_MELEE_RANGE - MIN_MELEE_REACH * 2) //center to center for players
+
+#define DEFAULT_PHASE 169
+
+enum TempSummonType
+{
+ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN = 1, // despawns after a specified time OR when the creature disappears
+ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN = 2, // despawns after a specified time OR when the creature dies
+ TEMPSUMMON_TIMED_DESPAWN = 3, // despawns after a specified time
+ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT = 4, // despawns after a specified time after the creature is out of combat
+ TEMPSUMMON_CORPSE_DESPAWN = 5, // despawns instantly after death
+ TEMPSUMMON_CORPSE_TIMED_DESPAWN = 6, // despawns after a specified time after death
+ TEMPSUMMON_DEAD_DESPAWN = 7, // despawns when the creature disappears
+ TEMPSUMMON_MANUAL_DESPAWN = 8 // despawns when UnSummon() is called
+};
+
+enum PhaseMasks
+{
+ PHASEMASK_NORMAL = 0x00000001,
+ PHASEMASK_ANYWHERE = 0xFFFFFFFF
+};
+
+enum NotifyFlags
+{
+ NOTIFY_NONE = 0x00,
+ NOTIFY_AI_RELOCATION = 0x01,
+ NOTIFY_VISIBILITY_CHANGED = 0x02,
+ NOTIFY_ALL = 0xFF
+};
+
+inline uint64 MAKE_PAIR64(uint32 l, uint32 h)
{
return uint64(l | (uint64(h) << 32));
}
-uint32 PAIR64_HIPART(uint64 x)
+inline uint32 PAIR64_HIPART(uint64 x)
{
return (uint32)((x >> 32) & UI64LIT(0x00000000FFFFFFFF));
}
-uint32 PAIR64_LOPART(uint64 x)
+inline uint32 PAIR64_LOPART(uint64 x)
{
return (uint32)(x & UI64LIT(0x00000000FFFFFFFF));
}
-uint16 MAKE_PAIR16(uint8 l, uint8 h)
+inline uint16 MAKE_PAIR16(uint8 l, uint8 h)
{
return uint16(l | (uint16(h) << 8));
}
-uint32 MAKE_PAIR32(uint16 l, uint16 h)
+inline uint32 MAKE_PAIR32(uint16 l, uint16 h)
{
return uint32(l | (uint32(h) << 16));
}
-uint16 PAIR32_HIPART(uint32 x)
+inline uint16 PAIR32_HIPART(uint32 x)
{
return (uint16)((x >> 16) & 0x0000FFFF);
}
-uint16 PAIR32_LOPART(uint32 x)
+inline uint16 PAIR32_LOPART(uint32 x)
{
return (uint16)(x & 0x0000FFFF);
}
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 63ca784c2ff..2209282223a 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -24,6 +24,8 @@
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "PetPackets.h"
+#include "Player.h"
+#include "Spell.h"
#include "SpellAuraEffects.h"
#include "SpellAuras.h"
#include "SpellHistory.h"
diff --git a/src/server/game/Entities/Player/EquipementSet.h b/src/server/game/Entities/Player/EquipementSet.h
new file mode 100644
index 00000000000..3ac891db523
--- /dev/null
+++ b/src/server/game/Entities/Player/EquipementSet.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2008-2017 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 EquipementSet_h__
+#define EquipementSet_h__
+
+#include "Define.h"
+#include "ObjectGuid.h"
+#include <array>
+#include <map>
+
+enum EquipmentSetUpdateState
+{
+ EQUIPMENT_SET_UNCHANGED = 0,
+ EQUIPMENT_SET_CHANGED = 1,
+ EQUIPMENT_SET_NEW = 2,
+ EQUIPMENT_SET_DELETED = 3
+};
+
+#define EQUIPEMENT_SET_SLOTS 19
+
+struct EquipmentSetInfo
+{
+ enum EquipmentSetType : int32
+ {
+ EQUIPMENT = 0,
+ TRANSMOG = 1
+ };
+
+ /// Data sent in EquipmentSet related packets
+ struct EquipmentSetData
+ {
+ EquipmentSetType Type = EQUIPMENT;
+ uint64 Guid = 0; ///< Set Identifier
+ uint32 SetID = 0; ///< Index
+ uint32 IgnoreMask = 0; ///< Mask of EquipmentSlot
+ int32 AssignedSpecIndex = -1; ///< Index of character specialization that this set is automatically equipped for
+ std::string SetName;
+ std::string SetIcon;
+ std::array<ObjectGuid, EQUIPEMENT_SET_SLOTS> Pieces;
+ std::array<int32, EQUIPEMENT_SET_SLOTS> Appearances; ///< ItemModifiedAppearanceID
+ std::array<int32, 2> Enchants; ///< SpellItemEnchantmentID
+ } Data;
+
+ /// Server-side data
+ EquipmentSetUpdateState State = EQUIPMENT_SET_NEW;
+};
+
+#define MAX_EQUIPMENT_SET_INDEX 20 // client limit
+
+typedef std::map<uint64, EquipmentSetInfo> EquipmentSetContainer;
+
+#endif // EquipementSet_h__
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 443c1aefc82..21553d8ec07 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -5784,14 +5784,9 @@ void Player::SendActionButtons(uint32 state) const
{
WorldPackets::Spells::UpdateActionButtons packet;
- for (uint8 button = 0; button < MAX_ACTION_BUTTONS; ++button)
- {
- ActionButtonList::const_iterator itr = m_actionButtons.find(button);
- if (itr != m_actionButtons.end() && itr->second.uState != ACTIONBUTTON_DELETED)
- packet.ActionButtons[button] = uint64(itr->second.packedData);
- else
- packet.ActionButtons[button] = 0;
- }
+ for (auto itr = m_actionButtons.begin(); itr != m_actionButtons.end(); ++itr)
+ if (itr->second.uState != ACTIONBUTTON_DELETED && itr->first < packet.ActionButtons.size())
+ packet.ActionButtons[itr->first] = itr->second.packedData;
packet.Reason = state;
@@ -20785,26 +20780,22 @@ void Player::SetUInt32ValueInArray(Tokenizer& Tokenizer, uint16 index, uint32 va
void Player::SendAttackSwingDeadTarget() const
{
- WorldPackets::Combat::AttackSwingError packet(ATTACKSWINGERR_DEADTARGET);
- GetSession()->SendPacket(packet.Write());
+ GetSession()->SendPacket(WorldPackets::Combat::AttackSwingError(WorldPackets::Combat::AttackSwingError::DeadTarget).Write());
}
void Player::SendAttackSwingCantAttack() const
{
- WorldPackets::Combat::AttackSwingError packet(ATTACKSWINGERR_CANT_ATTACK);
- GetSession()->SendPacket(packet.Write());
+ GetSession()->SendPacket(WorldPackets::Combat::AttackSwingError(WorldPackets::Combat::AttackSwingError::CantAttack).Write());
}
void Player::SendAttackSwingNotInRange() const
{
- WorldPackets::Combat::AttackSwingError packet(ATTACKSWINGERR_NOTINRANGE);
- GetSession()->SendPacket(packet.Write());
+ GetSession()->SendPacket(WorldPackets::Combat::AttackSwingError(WorldPackets::Combat::AttackSwingError::NotInRange).Write());
}
void Player::SendAttackSwingBadFacingAttack() const
{
- WorldPackets::Combat::AttackSwingError packet(ATTACKSWINGERR_BADFACING);
- GetSession()->SendPacket(packet.Write());
+ GetSession()->SendPacket(WorldPackets::Combat::AttackSwingError(WorldPackets::Combat::AttackSwingError::BadFacing).Write());
}
void Player::SendAttackSwingCancelAttack() const
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 6dcb1f99900..7d9a8d915f5 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -23,6 +23,7 @@
#include "GroupReference.h"
#include "MapReference.h"
#include "CUFProfile.h"
+#include "EquipementSet.h"
#include "Item.h"
#include "PetDefines.h"
#include "QuestDef.h"
@@ -419,8 +420,6 @@ enum PlayerBytes2Offsets
PLAYER_BYTES_2_OFFSET_FACIAL_STYLE = 3,
};
-#define PLAYER_CUSTOM_DISPLAY_SIZE 3
-
enum PlayerBytes3Offsets
{
PLAYER_BYTES_3_OFFSET_PARTY_TYPE = 0,
@@ -576,14 +575,6 @@ struct SkillStatusData
typedef std::unordered_map<uint32, SkillStatusData> SkillStatusMap;
-enum AttackSwingErr
-{
- ATTACKSWINGERR_CANT_ATTACK = 0,
- ATTACKSWINGERR_BADFACING = 1,
- ATTACKSWINGERR_NOTINRANGE = 2,
- ATTACKSWINGERR_DEADTARGET = 3
-};
-
class Quest;
class Spell;
class Item;
@@ -671,45 +662,6 @@ enum ChildEquipmentSlots
CHILD_EQUIPMENT_SLOT_END = 187,
};
-enum EquipmentSetUpdateState
-{
- EQUIPMENT_SET_UNCHANGED = 0,
- EQUIPMENT_SET_CHANGED = 1,
- EQUIPMENT_SET_NEW = 2,
- EQUIPMENT_SET_DELETED = 3
-};
-
-struct EquipmentSetInfo
-{
- enum EquipmentSetType : int32
- {
- EQUIPMENT = 0,
- TRANSMOG = 1
- };
-
- /// Data sent in EquipmentSet related packets
- struct EquipmentSetData
- {
- EquipmentSetType Type = EQUIPMENT;
- uint64 Guid = 0; ///< Set Identifier
- uint32 SetID = 0; ///< Index
- uint32 IgnoreMask = 0; ///< Mask of EquipmentSlot
- int32 AssignedSpecIndex = -1; ///< Index of character specialization that this set is automatically equipped for
- std::string SetName;
- std::string SetIcon;
- std::array<ObjectGuid, EQUIPMENT_SLOT_END> Pieces;
- std::array<int32, EQUIPMENT_SLOT_END> Appearances; ///< ItemModifiedAppearanceID
- std::array<int32, 2> Enchants; ///< SpellItemEnchantmentID
- } Data;
-
- /// Server-side data
- EquipmentSetUpdateState State = EQUIPMENT_SET_NEW;
-};
-
-#define MAX_EQUIPMENT_SET_INDEX 20 // client limit
-
-typedef std::map<uint64, EquipmentSetInfo> EquipmentSetContainer;
-
struct ItemPosCount
{
ItemPosCount(uint16 _pos, uint32 _count) : pos(_pos), count(_count) { }
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 70811186cee..e3d0519bfa7 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -17,19 +17,22 @@
*/
#include "Unit.h"
-#include "Common.h"
#include "Battlefield.h"
#include "BattlefieldMgr.h"
#include "Battleground.h"
#include "BattlegroundPackets.h"
#include "BattlegroundScore.h"
#include "CellImpl.h"
+#include "ChatPackets.h"
#include "ChatTextBuilder.h"
+#include "CombatLogPackets.h"
+#include "CombatPackets.h"
+#include "Common.h"
#include "ConditionMgr.h"
+#include "Creature.h"
#include "CreatureAI.h"
#include "CreatureAIImpl.h"
#include "CreatureGroups.h"
-#include "Creature.h"
#include "Formulas.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
@@ -37,41 +40,39 @@
#include "InstanceScript.h"
#include "Log.h"
#include "LootMgr.h"
+#include "LootPackets.h"
+#include "MiscPackets.h"
+#include "MovementPackets.h"
#include "MoveSpline.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "OutdoorPvP.h"
+#include "PartyPackets.h"
#include "PassiveAI.h"
-#include "PetAI.h"
#include "Pet.h"
+#include "PetAI.h"
#include "Player.h"
#include "PlayerAI.h"
#include "QuestDef.h"
#include "ReputationMgr.h"
+#include "Spell.h"
#include "SpellAuraEffects.h"
#include "SpellAuras.h"
-#include "Spell.h"
-#include "SpellInfo.h"
#include "SpellHistory.h"
+#include "SpellInfo.h"
#include "SpellMgr.h"
+#include "SpellPackets.h"
#include "TemporarySummon.h"
-#include "Transport.h"
#include "Totem.h"
+#include "Transport.h"
#include "UpdateFieldFlags.h"
#include "Util.h"
#include "Vehicle.h"
+#include "VehiclePackets.h"
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
-#include "ChatPackets.h"
-#include "MiscPackets.h"
-#include "MovementPackets.h"
-#include "CombatPackets.h"
-#include "CombatLogPackets.h"
-#include "VehiclePackets.h"
-#include "LootPackets.h"
-#include "PartyPackets.h"
#include <cmath>
float baseMoveSpeed[MAX_MOVE_TYPE] =
@@ -10630,8 +10631,8 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* target, uint32 procFlag, u
// Skip melee hits and spells ws wrong school or zero cost
if (procSpell && (triggeredByAura->GetMiscValue() & procSpell->SchoolMask)) // School check
{
- std::vector<SpellInfo::CostData> costs = procSpell->CalcPowerCost(this, procSpell->GetSchoolMask());
- auto m = std::find_if(costs.begin(), costs.end(), [](SpellInfo::CostData const& cost) { return cost.Amount > 0; });
+ std::vector<SpellPowerCost> costs = procSpell->CalcPowerCost(this, procSpell->GetSchoolMask());
+ auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Amount > 0; });
if (m != costs.end())
takeCharges = true;
}
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 6ca7b8d9bf4..a6dbb3f6e94 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -130,7 +130,7 @@ enum SpellModOp
#define MAX_SPELLMOD 39
-enum SpellValueMod
+enum SpellValueMod : uint8
{
SPELLVALUE_BASE_POINT0,
SPELLVALUE_BASE_POINT1,
@@ -263,36 +263,6 @@ enum VictimState
VICTIMSTATE_DEFLECTS = 8
};
-enum HitInfo
-{
- HITINFO_NORMALSWING = 0x00000000,
- HITINFO_UNK1 = 0x00000001, // req correct packet structure
- HITINFO_AFFECTS_VICTIM = 0x00000002,
- HITINFO_OFFHAND = 0x00000004,
- HITINFO_UNK2 = 0x00000008,
- HITINFO_MISS = 0x00000010,
- HITINFO_FULL_ABSORB = 0x00000020,
- HITINFO_PARTIAL_ABSORB = 0x00000040,
- HITINFO_FULL_RESIST = 0x00000080,
- HITINFO_PARTIAL_RESIST = 0x00000100,
- HITINFO_CRITICALHIT = 0x00000200, // critical hit
- HITINFO_UNK10 = 0x00000400,
- HITINFO_UNK11 = 0x00000800,
- HITINFO_UNK12 = 0x00001000,
- HITINFO_BLOCK = 0x00002000, // blocked damage
- HITINFO_UNK14 = 0x00004000, // set only if meleespellid is present// no world text when victim is hit for 0 dmg(HideWorldTextForNoDamage?)
- HITINFO_UNK15 = 0x00008000, // player victim?// something related to blod sprut visual (BloodSpurtInBack?)
- HITINFO_GLANCING = 0x00010000,
- HITINFO_CRUSHING = 0x00020000,
- HITINFO_NO_ANIMATION = 0x00040000,
- HITINFO_UNK19 = 0x00080000,
- HITINFO_UNK20 = 0x00100000,
- HITINFO_SWINGNOHITSOUND = 0x00200000, // unused?
- HITINFO_UNK22 = 0x00400000,
- HITINFO_RAGE_GAIN = 0x00800000,
- HITINFO_FAKE_DAMAGE = 0x01000000 // enables damage animation even if no damage done, set only if no damage
-};
-
//i would like to remove this: (it is defined in item.h
enum InventorySlot
{
@@ -367,17 +337,7 @@ enum WeaponDamageRange
MAXDAMAGE
};
-enum AuraRemoveMode
-{
- AURA_REMOVE_NONE = 0,
- AURA_REMOVE_BY_DEFAULT = 1, // scripted remove, remove by stack with aura with different ids and sc aura remove
- AURA_REMOVE_BY_CANCEL,
- AURA_REMOVE_BY_ENEMY_SPELL, // dispel and absorb aura destroy
- AURA_REMOVE_BY_EXPIRE, // aura duration has ended
- AURA_REMOVE_BY_DEATH
-};
-
-enum TriggerCastFlags
+enum TriggerCastFlags : uint32
{
TRIGGERED_NONE = 0x00000000, //! Not triggered
TRIGGERED_IGNORE_GCD = 0x00000001, //! Will ignore GCD
@@ -587,7 +547,7 @@ enum CombatRating
#define MAX_COMBAT_RATING 32
-enum DamageEffectType
+enum DamageEffectType : uint8
{
DIRECT_DAMAGE = 0, // used for normal weapon damage (not for class abilities or spells)
SPELL_DIRECT_DAMAGE = 1, // spell/class abilities damage
@@ -848,7 +808,7 @@ struct RedirectThreatInfo
}
};
-enum CurrentSpellTypes
+enum CurrentSpellTypes : uint8
{
CURRENT_MELEE_SPELL = 0,
CURRENT_GENERIC_SPELL = 1,
@@ -2210,4 +2170,10 @@ namespace Trinity
bool const _ascending;
};
}
+
+inline void SetUnitCurrentCastSpell(Unit* unit, Spell* spell)
+{
+ unit->SetCurrentCastSpell(spell);
+}
+
#endif
diff --git a/src/server/game/Entities/Unit/UnitDefines.h b/src/server/game/Entities/Unit/UnitDefines.h
index 6b853057751..35490f33bb0 100644
--- a/src/server/game/Entities/Unit/UnitDefines.h
+++ b/src/server/game/Entities/Unit/UnitDefines.h
@@ -320,6 +320,36 @@ enum MovementFlags2 : uint32
MOVEMENTFLAG2_INTERPOLATED_PITCHING = 0x00400000
};
+enum HitInfo
+{
+ HITINFO_NORMALSWING = 0x00000000,
+ HITINFO_UNK1 = 0x00000001, // req correct packet structure
+ HITINFO_AFFECTS_VICTIM = 0x00000002,
+ HITINFO_OFFHAND = 0x00000004,
+ HITINFO_UNK2 = 0x00000008,
+ HITINFO_MISS = 0x00000010,
+ HITINFO_FULL_ABSORB = 0x00000020,
+ HITINFO_PARTIAL_ABSORB = 0x00000040,
+ HITINFO_FULL_RESIST = 0x00000080,
+ HITINFO_PARTIAL_RESIST = 0x00000100,
+ HITINFO_CRITICALHIT = 0x00000200, // critical hit
+ HITINFO_UNK10 = 0x00000400,
+ HITINFO_UNK11 = 0x00000800,
+ HITINFO_UNK12 = 0x00001000,
+ HITINFO_BLOCK = 0x00002000, // blocked damage
+ HITINFO_UNK14 = 0x00004000, // set only if meleespellid is present// no world text when victim is hit for 0 dmg(HideWorldTextForNoDamage?)
+ HITINFO_UNK15 = 0x00008000, // player victim?// something related to blod sprut visual (BloodSpurtInBack?)
+ HITINFO_GLANCING = 0x00010000,
+ HITINFO_CRUSHING = 0x00020000,
+ HITINFO_NO_ANIMATION = 0x00040000,
+ HITINFO_UNK19 = 0x00080000,
+ HITINFO_UNK20 = 0x00100000,
+ HITINFO_SWINGNOHITSOUND = 0x00200000, // unused?
+ HITINFO_UNK22 = 0x00400000,
+ HITINFO_RAGE_GAIN = 0x00800000,
+ HITINFO_FAKE_DAMAGE = 0x01000000 // enables damage animation even if no damage done, set only if no damage
+};
+
#define MAX_DECLINED_NAME_CASES 5
struct DeclinedName
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index ad7b4b4a76b..cec03e26bf3 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -764,7 +764,7 @@ struct LanguageDesc
TC_GAME_API extern LanguageDesc lang_description[LANGUAGES_COUNT];
LanguageDesc const* GetLanguageDescByID(uint32 lang);
-enum EncounterCreditType
+enum EncounterCreditType : uint8
{
ENCOUNTER_CREDIT_KILL_CREATURE = 0,
ENCOUNTER_CREDIT_CAST_SPELL = 1
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index 747c0bfd5c4..af696e8c3b9 100644
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -32,8 +32,11 @@
#include "Log.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
+#include "Player.h"
#include "ScriptMgr.h"
#include "SocialMgr.h"
+#include "World.h"
+#include "WorldSession.h"
#define MAX_GUILD_BANK_TAB_TEXT_LEN 500
#define EMBLEM_PRICE 10 * GOLD
@@ -360,6 +363,11 @@ void Guild::RankInfo::SetBankTabSlotsAndRights(GuildBankRightsAndSlots rightsAnd
}
}
+Guild::BankTab::BankTab(ObjectGuid::LowType guildId, uint8 tabId) : m_guildId(guildId), m_tabId(tabId)
+{
+ memset(m_items, 0, GUILD_BANK_MAX_SLOTS * sizeof(Item*));
+}
+
// BankTab
void Guild::BankTab::LoadFromDB(Field* fields)
{
@@ -501,6 +509,26 @@ void Guild::BankTab::SendText(Guild const* guild, WorldSession* session) const
}
}
+Guild::Member::Member(ObjectGuid::LowType guildId, ObjectGuid guid, uint8 rankId) :
+ m_guildId(guildId),
+ m_guid(guid),
+ m_zoneId(0),
+ m_level(0),
+ m_class(0),
+ _gender(0),
+ m_flags(GUILDMEMBER_STATUS_NONE),
+ m_logoutTime(::time(nullptr)),
+ m_accountId(0),
+ m_rankId(rankId),
+ m_achievementPoints(0),
+ m_totalActivity(0),
+ m_weekActivity(0),
+ m_totalReputation(0),
+ m_weekReputation(0)
+{
+ memset(m_bankWithdraw, 0, (GUILD_BANK_MAX_TABS + 1) * sizeof(int32));
+}
+
// Member
void Guild::Member::SetStats(Player* player)
{
@@ -721,6 +749,15 @@ void EmblemInfo::SaveToDB(ObjectGuid::LowType guildId) const
CharacterDatabase.Execute(stmt);
}
+Guild::MoveItemData::MoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId) : m_pGuild(guild), m_pPlayer(player),
+m_container(container), m_slotId(slotId), m_pItem(nullptr), m_pClonedItem(nullptr)
+{
+}
+
+Guild::MoveItemData::~MoveItemData()
+{
+}
+
// MoveItemData
bool Guild::MoveItemData::CheckItem(uint32& splitedAmount)
{
@@ -886,7 +923,7 @@ Item* Guild::BankMoveItemData::StoreItem(SQLTransaction& trans, Item* pItem)
return nullptr;
Item* pLastItem = pItem;
- for (ItemPosCountVec::const_iterator itr = m_vec.begin(); itr != m_vec.end(); )
+ for (auto itr = m_vec.begin(); itr != m_vec.end(); )
{
ItemPosCount pos(*itr);
++itr;
@@ -2754,6 +2791,14 @@ void Guild::SetBankTabText(uint8 tabId, std::string const& text)
}
}
+bool Guild::_HasRankRight(Player const* player, uint32 right) const
+{
+ if (player)
+ if (Member const* member = GetMember(player->GetGUID()))
+ return (_GetRankRights(member->GetRankId()) & right) != GR_RIGHT_NONE;
+ return false;
+}
+
void Guild::_DeleteMemberFromDB(ObjectGuid::LowType lowguid)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GUILD_MEMBER);
diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h
index 99bad731a09..be20db3b203 100644
--- a/src/server/game/Guilds/Guild.h
+++ b/src/server/game/Guilds/Guild.h
@@ -20,12 +20,17 @@
#define TRINITYCORE_GUILD_H
#include "AchievementMgr.h"
-#include "World.h"
-#include "Item.h"
-#include "WorldPacket.h"
-#include "Player.h"
+#include "DatabaseEnvFwd.h"
+#include "ObjectGuid.h"
+#include "SharedDefines.h"
+#include <unordered_map>
class Item;
+class Player;
+class WorldPacket;
+class WorldSession;
+struct ItemPosCount;
+enum InventoryResult : uint8;
namespace WorldPackets
{
@@ -34,6 +39,7 @@ namespace WorldPackets
class GuildBankLogQueryResults;
class GuildEventLogQueryResults;
class GuildNews;
+ class SaveGuildEmblem;
}
}
@@ -323,25 +329,7 @@ private:
class Member
{
public:
- Member(ObjectGuid::LowType guildId, ObjectGuid guid, uint8 rankId) :
- m_guildId(guildId),
- m_guid(guid),
- m_zoneId(0),
- m_level(0),
- m_class(0),
- _gender(0),
- m_flags(GUILDMEMBER_STATUS_NONE),
- m_logoutTime(::time(nullptr)),
- m_accountId(0),
- m_rankId(rankId),
- m_achievementPoints(0),
- m_totalActivity(0),
- m_weekActivity(0),
- m_totalReputation(0),
- m_weekReputation(0)
- {
- memset(m_bankWithdraw, 0, (GUILD_BANK_MAX_TABS + 1) * sizeof(int32));
- }
+ Member(ObjectGuid::LowType guildId, ObjectGuid guid, uint8 rankId);
void SetStats(Player* player);
void SetStats(std::string const& name, uint8 level, uint8 _class, uint8 gender, uint32 zoneId, uint32 accountId, uint32 reputation);
@@ -615,21 +603,12 @@ private:
class BankTab
{
public:
- BankTab(ObjectGuid::LowType guildId, uint8 tabId) : m_guildId(guildId), m_tabId(tabId)
- {
- memset(m_items, 0, GUILD_BANK_MAX_SLOTS * sizeof(Item*));
- }
+ BankTab(ObjectGuid::LowType guildId, uint8 tabId);
void LoadFromDB(Field* fields);
bool LoadItemFromDB(Field* fields);
void Delete(SQLTransaction& trans, bool removeItemsFromDB = false);
- void WriteInfoPacket(WorldPacket& data) const
- {
- data << m_name;
- data << m_icon;
- }
-
void SetInfo(std::string const& name, std::string const& icon);
void SetText(std::string const& text);
void SendText(Guild const* guild, WorldSession* session) const;
@@ -655,9 +634,8 @@ private:
class MoveItemData
{
public:
- MoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId) : m_pGuild(guild), m_pPlayer(player),
- m_container(container), m_slotId(slotId), m_pItem(nullptr), m_pClonedItem(nullptr) { }
- virtual ~MoveItemData() { }
+ MoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId);
+ virtual ~MoveItemData();
virtual bool IsBank() const = 0;
// Initializes item pointer. Returns true, if item exists, false otherwise.
@@ -696,7 +674,7 @@ private:
uint8 m_slotId;
Item* m_pItem;
Item* m_pClonedItem;
- ItemPosCountVec m_vec;
+ std::vector<ItemPosCount> m_vec;
};
class PlayerMoveItemData : public MoveItemData
@@ -901,13 +879,7 @@ private:
inline uint8 _GetRanksSize() const { return uint8(m_ranks.size()); }
inline const RankInfo* GetRankInfo(uint8 rankId) const { return rankId < _GetRanksSize() ? &m_ranks[rankId] : NULL; }
inline RankInfo* GetRankInfo(uint8 rankId) { return rankId < _GetRanksSize() ? &m_ranks[rankId] : NULL; }
- inline bool _HasRankRight(Player const* player, uint32 right) const
- {
- if (player)
- if (Member const* member = GetMember(player->GetGUID()))
- return (_GetRankRights(member->GetRankId()) & right) != GR_RIGHT_NONE;
- return false;
- }
+ bool _HasRankRight(Player const* player, uint32 right) const;
inline uint8 _GetLowestRankId() const { return uint8(m_ranks.size() - 1); }
@@ -915,13 +887,13 @@ private:
inline BankTab* GetBankTab(uint8 tabId) { return tabId < m_bankTabs.size() ? m_bankTabs[tabId] : NULL; }
inline const BankTab* GetBankTab(uint8 tabId) const { return tabId < m_bankTabs.size() ? m_bankTabs[tabId] : NULL; }
- inline const Member* GetMember(ObjectGuid guid) const
+ inline const Member* GetMember(ObjectGuid const& guid) const
{
Members::const_iterator itr = m_members.find(guid);
return itr != m_members.end() ? itr->second : NULL;
}
- inline Member* GetMember(ObjectGuid guid)
+ inline Member* GetMember(ObjectGuid const& guid)
{
Members::iterator itr = m_members.find(guid);
return itr != m_members.end() ? itr->second : NULL;
diff --git a/src/server/game/Guilds/GuildFinderMgr.cpp b/src/server/game/Guilds/GuildFinderMgr.cpp
index c057324e2c5..b0a9184aa41 100644
--- a/src/server/game/Guilds/GuildFinderMgr.cpp
+++ b/src/server/game/Guilds/GuildFinderMgr.cpp
@@ -22,6 +22,7 @@
#include "GuildFinderPackets.h"
#include "Log.h"
#include "ObjectMgr.h"
+#include "Player.h"
#include "World.h"
MembershipRequest::MembershipRequest() : _availability(0), _classRoles(0), _interests(0), _time(time(NULL))
diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp
index c7811b0b9ab..513de46edd4 100644
--- a/src/server/game/Guilds/GuildMgr.cpp
+++ b/src/server/game/Guilds/GuildMgr.cpp
@@ -20,6 +20,7 @@
#include "Guild.h"
#include "Log.h"
#include "ObjectMgr.h"
+#include "World.h"
GuildMgr::GuildMgr() : NextGuildId(UI64LIT(1))
{
diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp
index 364ed390a61..ad969a31093 100644
--- a/src/server/game/Handlers/CalendarHandler.cpp
+++ b/src/server/game/Handlers/CalendarHandler.cpp
@@ -48,6 +48,7 @@ Copied events should probably have a new owner
#include "Opcodes.h"
#include "Player.h"
#include "SocialMgr.h"
+#include "World.h"
void WorldSession::HandleCalendarGetCalendar(WorldPackets::Calendar::CalendarGetCalendar& /*calendarGetCalendar*/)
{
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index 3df0c716189..2feac5418e5 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -1464,13 +1464,13 @@ void WorldSession::HandleAlterAppearance(WorldPackets::Character::AlterApperance
GameObject* go = _player->FindNearestGameObjectOfType(GAMEOBJECT_TYPE_BARBER_CHAIR, 5.0f);
if (!go)
{
- SendBarberShopResult(BARBER_SHOP_RESULT_NOT_ON_CHAIR);
+ SendPacket(WorldPackets::Character::BarberShopResult(WorldPackets::Character::BarberShopResult::ResultEnum::NotOnChair).Write());
return;
}
if (_player->GetStandState() != UnitStandStateType(UNIT_STAND_STATE_SIT_LOW_CHAIR + go->GetGOInfo()->barberChair.chairheight))
{
- SendBarberShopResult(BARBER_SHOP_RESULT_NOT_ON_CHAIR);
+ SendPacket(WorldPackets::Character::BarberShopResult(WorldPackets::Character::BarberShopResult::ResultEnum::NotOnChair).Write());
return;
}
@@ -1481,11 +1481,11 @@ void WorldSession::HandleAlterAppearance(WorldPackets::Character::AlterApperance
// 2 - you have to sit on barber chair
if (!_player->HasEnoughMoney((uint64)cost))
{
- SendBarberShopResult(BARBER_SHOP_RESULT_NO_MONEY);
+ SendPacket(WorldPackets::Character::BarberShopResult(WorldPackets::Character::BarberShopResult::ResultEnum::NoMoney).Write());
return;
}
- SendBarberShopResult(BARBER_SHOP_RESULT_SUCCESS);
+ SendPacket(WorldPackets::Character::BarberShopResult(WorldPackets::Character::BarberShopResult::ResultEnum::Success).Write());
_player->ModifyMoney(-int64(cost)); // it isn't free
_player->UpdateCriteria(CRITERIA_TYPE_GOLD_SPENT_AT_BARBER, cost);
@@ -2338,7 +2338,7 @@ void WorldSession::HandleRandomizeCharNameOpcode(WorldPackets::Character::Genera
WorldPackets::Character::GenerateRandomCharacterNameResult result;
result.Success = true;
- result.Name = sDB2Manager.GetNameGenEntry(packet.Race, packet.Sex, GetSessionDbcLocale());
+ result.Name = sDB2Manager.GetNameGenEntry(packet.Race, packet.Sex, GetSessionDbcLocale(), sWorld->GetDefaultDbcLocale());
SendPacket(result.Write());
}
@@ -2571,13 +2571,6 @@ void WorldSession::SendSetPlayerDeclinedNamesResult(DeclinedNameResult result, O
SendPacket(packet.Write());
}
-void WorldSession::SendBarberShopResult(BarberShopResult result)
-{
- WorldPackets::Character::BarberShopResultServer packet;
- packet.Result = result;
- SendPacket(packet.Write());
-}
-
void WorldSession::SendUndeleteCooldownStatusResponse(uint32 currentCooldown, uint32 maxCooldown)
{
WorldPackets::Character::UndeleteCooldownStatusResponse response;
diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp
index d0510b6bfd3..5ebd6a93532 100644
--- a/src/server/game/Handlers/GuildHandler.cpp
+++ b/src/server/game/Handlers/GuildHandler.cpp
@@ -16,17 +16,18 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
-#include "WorldPacket.h"
#include "WorldSession.h"
-#include "World.h"
-#include "ObjectMgr.h"
+#include "AchievementPackets.h"
+#include "Common.h"
+#include "Guild.h"
#include "GuildMgr.h"
+#include "GuildPackets.h"
#include "Log.h"
+#include "ObjectMgr.h"
#include "Opcodes.h"
-#include "Guild.h"
-#include "AchievementPackets.h"
-#include "GuildPackets.h"
+#include "Player.h"
+#include "World.h"
+#include "WorldPacket.h"
void WorldSession::HandleGuildQueryOpcode(WorldPackets::Guild::QueryGuildInfo& query)
{
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp
index 726992fd872..a85641efd7d 100644
--- a/src/server/game/Handlers/NPCHandler.cpp
+++ b/src/server/game/Handlers/NPCHandler.cpp
@@ -16,30 +16,31 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "WorldSession.h"
+#include "Battleground.h"
+#include "BattlegroundMgr.h"
#include "Common.h"
-#include "Language.h"
+#include "Creature.h"
+#include "CreatureAI.h"
#include "DatabaseEnv.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "Opcodes.h"
-#include "Log.h"
-#include "ObjectMgr.h"
-#include "SpellMgr.h"
-#include "Player.h"
+#include "GameObjectAI.h"
#include "GossipDef.h"
+#include "ItemPackets.h"
+#include "Language.h"
+#include "Log.h"
+#include "MailPackets.h"
+#include "NPCPackets.h"
#include "ObjectAccessor.h"
-#include "Creature.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
#include "Pet.h"
#include "PetPackets.h"
+#include "Player.h"
#include "ReputationMgr.h"
-#include "BattlegroundMgr.h"
-#include "Battleground.h"
#include "ScriptMgr.h"
-#include "CreatureAI.h"
-#include "GameObjectAI.h"
#include "SpellInfo.h"
-#include "NPCPackets.h"
-#include "MailPackets.h"
+#include "SpellMgr.h"
+#include "WorldPacket.h"
enum StableResultCode
{
diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp
index 3d3d782b225..6e45db003ba 100644
--- a/src/server/game/Handlers/PetitionsHandler.cpp
+++ b/src/server/game/Handlers/PetitionsHandler.cpp
@@ -25,6 +25,7 @@
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "PetitionPackets.h"
+#include "Player.h"
#include "World.h"
#include "WorldPacket.h"
#include <sstream>
diff --git a/src/server/game/Handlers/ToyHandler.cpp b/src/server/game/Handlers/ToyHandler.cpp
index 39d322be0d5..5497abf1c17 100644
--- a/src/server/game/Handlers/ToyHandler.cpp
+++ b/src/server/game/Handlers/ToyHandler.cpp
@@ -16,8 +16,12 @@
*/
#include "WorldSession.h"
+#include "DB2Stores.h"
#include "Item.h"
#include "Log.h"
+#include "ObjectMgr.h"
+#include "Player.h"
+#include "Spell.h"
#include "ToyPackets.h"
void WorldSession::HandleAddToy(WorldPackets::Toy::AddToy& packet)
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index f4e088ce729..7c29dd65373 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -23,6 +23,7 @@
#include "DatabaseEnv.h"
#include "DisableMgr.h"
#include "DynamicTree.h"
+#include "GameObjectModel.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "GridStates.h"
@@ -43,6 +44,7 @@
#include "Vehicle.h"
#include "VMapFactory.h"
#include "Weather.h"
+#include "World.h"
u_map_magic MapMagic = { {'M','A','P','S'} };
u_map_magic MapVersionMagic = { {'v','1','.','8'} };
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index 4ff78d3c537..1c9ae67cbcb 100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -28,7 +28,6 @@
#include "GridRefManager.h"
#include "MapRefManager.h"
#include "DynamicTree.h"
-#include "GameObjectModel.h"
#include "ObjectGuid.h"
#include <bitset>
@@ -41,6 +40,7 @@
class Battleground;
class BattlegroundMap;
class CreatureGroup;
+class GameObjectModel;
class Group;
class InstanceMap;
class InstanceSave;
diff --git a/src/server/game/Maps/MapScripts.cpp b/src/server/game/Maps/MapScripts.cpp
index cc82334faa9..3dd766a8646 100644
--- a/src/server/game/Maps/MapScripts.cpp
+++ b/src/server/game/Maps/MapScripts.cpp
@@ -25,7 +25,6 @@
#include "MapManager.h"
#include "ObjectMgr.h"
#include "Pet.h"
-#include "ScriptedCreature.h"
#include "ScriptMgr.h"
#include "Transport.h"
#include "WaypointManager.h"
@@ -703,7 +702,7 @@ void Map::ScriptsProcess()
break;
case SF_CASTSPELL_SEARCH_CREATURE: // source -> creature with entry
uSource = source ? source->ToUnit() : NULL;
- uTarget = uSource ? GetClosestCreatureWithEntry(uSource, abs(step.script->CastSpell.CreatureEntry), step.script->CastSpell.SearchRadius) : NULL;
+ uTarget = uSource ? uSource->FindNearestCreature(abs(step.script->CastSpell.CreatureEntry), step.script->CastSpell.SearchRadius) : NULL;
break;
}
diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp
index d402b93b899..06dec768990 100644
--- a/src/server/game/Maps/TransportMgr.cpp
+++ b/src/server/game/Maps/TransportMgr.cpp
@@ -20,6 +20,7 @@
#include "InstanceScript.h"
#include "Log.h"
#include "MapManager.h"
+#include "ObjectMgr.h"
#include "Spline.h"
#include "Transport.h"
@@ -91,6 +92,15 @@ void TransportMgr::LoadTransportTemplates()
TC_LOG_INFO("server.loading", ">> Loaded %u transport templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
}
+void TransportMgr::LoadTransportAnimationAndRotation()
+{
+ for (TransportAnimationEntry const* anim : sTransportAnimationStore)
+ AddPathNodeToTransport(anim->TransportID, anim->TimeIndex, anim);
+
+ for (TransportRotationEntry const* rot : sTransportRotationStore)
+ AddPathRotationToTransport(rot->TransportID, rot->TimeIndex, rot);
+}
+
class SplineRawInitializer
{
public:
diff --git a/src/server/game/Maps/TransportMgr.h b/src/server/game/Maps/TransportMgr.h
index 8b8d1d07d6a..4c914d72bc4 100644
--- a/src/server/game/Maps/TransportMgr.h
+++ b/src/server/game/Maps/TransportMgr.h
@@ -111,6 +111,8 @@ class TC_GAME_API TransportMgr
void LoadTransportTemplates();
+ void LoadTransportAnimationAndRotation();
+
// Creates a transport using given GameObject template entry
Transport* CreateTransport(uint32 entry, ObjectGuid::LowType guid = UI64LIT(0), Map* map = nullptr, uint32 phaseid = 0, uint32 phasegroup = 0);
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index fc40b0d238b..2dc9640f8e3 100644
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -947,6 +947,8 @@ enum CharacterFlags4 : uint32
CHARACTER_FLAG_4_TRIAL_BOOST_LOCKED = 0x00040000,
};
+#define PLAYER_CUSTOM_DISPLAY_SIZE 3
+
enum CharacterSlot
{
SLOT_HEAD = 0,
@@ -2359,6 +2361,19 @@ enum GameObjectDynamicLowFlags
GO_DYNFLAG_LO_STOPPED = 0x40 // Transport is stopped
};
+// client side GO show states
+enum GOState : uint8
+{
+ GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open)
+ GO_STATE_READY = 1, // show in world as ready (closed door close)
+ GO_STATE_ACTIVE_ALTERNATIVE = 2, // show in world as used in alt way and not reset (closed door open by cannon fire)
+ GO_STATE_TRANSPORT_ACTIVE = 24,
+ GO_STATE_TRANSPORT_STOPPED = 25
+};
+
+#define MAX_GO_STATE 3
+#define MAX_GO_STATE_TRANSPORT_STOP_FRAMES 9
+
enum GameObjectDestructibleState
{
GO_DESTRUCTIBLE_INTACT = 0,
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
index 920a44b3a55..d1393ed1611 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
@@ -17,7 +17,6 @@
*/
#include "WaypointMovementGenerator.h"
-#include "Creature.h"
#include "CreatureAI.h"
#include "CreatureGroups.h"
#include "Log.h"
@@ -25,8 +24,8 @@
#include "MoveSpline.h"
#include "MoveSplineInit.h"
#include "ObjectMgr.h"
-#include "Player.h"
#include "Transport.h"
+#include "World.h"
void WaypointMovementGenerator<Creature>::LoadPath(Creature* creature)
{
diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
index 160c9f93042..d7610810d38 100755
--- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
@@ -26,9 +26,11 @@
*/
#include "MovementGenerator.h"
-#include "WaypointManager.h"
+#include "Creature.h"
+#include "DB2Stores.h"
#include "Player.h"
-#include "World.h"
+#include "Timer.h"
+#include "WaypointManager.h"
#define FLIGHT_TRAVEL_UPDATE 100
#define TIMEDIFF_NEXT_WP 250
diff --git a/src/server/game/Server/Packets/CharacterPackets.cpp b/src/server/game/Server/Packets/CharacterPackets.cpp
index f65626179fa..efbb5035319 100644
--- a/src/server/game/Server/Packets/CharacterPackets.cpp
+++ b/src/server/game/Server/Packets/CharacterPackets.cpp
@@ -18,9 +18,14 @@
#include "CharacterPackets.h"
#include "Field.h"
#include "ObjectMgr.h"
-#include "PacketUtilities.h"
+#include "Player.h"
#include "World.h"
+WorldPackets::Character::EnumCharacters::EnumCharacters(WorldPacket&& packet) : ClientPacket(std::move(packet))
+{
+ ASSERT(GetOpcode() == CMSG_ENUM_CHARACTERS || GetOpcode() == CMSG_ENUM_CHARACTERS_DELETED_BY_CLIENT);
+}
+
WorldPackets::Character::EnumCharactersResult::CharacterInfo::CharacterInfo(Field* fields)
{
// 0 1 2 3 4 5 6 7
@@ -171,11 +176,11 @@ WorldPacket const* WorldPackets::Character::EnumCharactersResult::Write()
_worldPacket << uint32(charInfo.ProfessionIds[0]);
_worldPacket << uint32(charInfo.ProfessionIds[1]);
- for (uint8 slot = 0; slot < INVENTORY_SLOT_BAG_END; ++slot)
+ for (CharacterInfo::VisualItemInfo const& visualItem : charInfo.VisualItems)
{
- _worldPacket << uint32(charInfo.VisualItems[slot].DisplayId);
- _worldPacket << uint32(charInfo.VisualItems[slot].DisplayEnchantId);
- _worldPacket << uint8(charInfo.VisualItems[slot].InventoryType);
+ _worldPacket << uint32(visualItem.DisplayId);
+ _worldPacket << uint32(visualItem.DisplayEnchantId);
+ _worldPacket << uint8(visualItem.InventoryType);
}
_worldPacket << uint32(charInfo.LastPlayedTime);
@@ -450,7 +455,7 @@ void WorldPackets::Character::AlterApperance::Read()
_worldPacket >> NewCustomDisplay[i];
}
-WorldPacket const* WorldPackets::Character::BarberShopResultServer::Write()
+WorldPacket const* WorldPackets::Character::BarberShopResult::Write()
{
_worldPacket << int32(Result);
return &_worldPacket;
diff --git a/src/server/game/Server/Packets/CharacterPackets.h b/src/server/game/Server/Packets/CharacterPackets.h
index 70767bea1f0..a5b27e1b3db 100644
--- a/src/server/game/Server/Packets/CharacterPackets.h
+++ b/src/server/game/Server/Packets/CharacterPackets.h
@@ -19,9 +19,16 @@
#define CharacterPackets_h__
#include "Packet.h"
+#include "ObjectGuid.h"
#include "Optional.h"
-#include "Player.h"
#include "PacketUtilities.h"
+#include "Position.h"
+#include "SharedDefines.h"
+#include "UnitDefines.h"
+#include <array>
+#include <memory>
+
+class Field;
namespace WorldPackets
{
@@ -30,10 +37,7 @@ namespace WorldPackets
class EnumCharacters final : public ClientPacket
{
public:
- EnumCharacters(WorldPacket&& packet) : ClientPacket(std::move(packet))
- {
- ASSERT(GetOpcode() == CMSG_ENUM_CHARACTERS || GetOpcode() == CMSG_ENUM_CHARACTERS_DELETED_BY_CLIENT);
- }
+ EnumCharacters(WorldPacket&& packet);
void Read() override { }
};
@@ -160,7 +164,7 @@ namespace WorldPackets
uint8 InventoryType = 0;
};
- VisualItemInfo VisualItems[INVENTORY_SLOT_BAG_END];
+ std::array<VisualItemInfo, 23> VisualItems;
};
struct RestrictedFactionChangeRuleInfo
@@ -597,14 +601,22 @@ namespace WorldPackets
std::array<uint32, PLAYER_CUSTOM_DISPLAY_SIZE> NewCustomDisplay;
};
- class BarberShopResultServer final : public ServerPacket
+ class BarberShopResult final : public ServerPacket
{
public:
- BarberShopResultServer() : ServerPacket(SMSG_BARBER_SHOP_RESULT, 4) { }
+ enum class ResultEnum : uint8
+ {
+ Success = 0,
+ NoMoney = 1,
+ NotOnChair = 2,
+ NoMoney2 = 3
+ };
+
+ BarberShopResult(ResultEnum result) : ServerPacket(SMSG_BARBER_SHOP_RESULT, 4), Result(result) { }
WorldPacket const* Write() override;
- BarberShopResult Result = BARBER_SHOP_RESULT_SUCCESS;
+ ResultEnum Result = ResultEnum::Success;
};
class LogXPGain final : public ServerPacket
diff --git a/src/server/game/Server/Packets/CombatLogPackets.cpp b/src/server/game/Server/Packets/CombatLogPackets.cpp
index 60e7ba97d46..fe0109b3ccb 100644
--- a/src/server/game/Server/Packets/CombatLogPackets.cpp
+++ b/src/server/game/Server/Packets/CombatLogPackets.cpp
@@ -16,7 +16,7 @@
*/
#include "CombatLogPackets.h"
-#include "SpellPackets.h"
+#include "UnitDefines.h"
WorldPacket const* WorldPackets::CombatLog::SpellNonMeleeDamageLog::Write()
{
diff --git a/src/server/game/Server/Packets/CombatLogPackets.h b/src/server/game/Server/Packets/CombatLogPackets.h
index 40c650b2903..33ef377323c 100644
--- a/src/server/game/Server/Packets/CombatLogPackets.h
+++ b/src/server/game/Server/Packets/CombatLogPackets.h
@@ -18,9 +18,9 @@
#ifndef CombatLogPackets_h__
#define CombatLogPackets_h__
-#include "Packet.h"
+#include "CombatLogPacketsCommon.h"
+#include "Optional.h"
#include "Spell.h"
-#include "SpellPackets.h"
namespace WorldPackets
{
diff --git a/src/server/game/Server/Packets/CombatLogPacketsCommon.cpp b/src/server/game/Server/Packets/CombatLogPacketsCommon.cpp
new file mode 100644
index 00000000000..c4a36149dc6
--- /dev/null
+++ b/src/server/game/Server/Packets/CombatLogPacketsCommon.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2008-2017 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 "CombatLogPacketsCommon.h"
+#include "Spell.h"
+#include "SpellInfo.h"
+#include "Unit.h"
+
+void WorldPackets::Spells::SpellCastLogData::Initialize(Unit const* unit)
+{
+ Health = unit->GetHealth();
+ AttackPower = unit->GetTotalAttackPowerValue(unit->getClass() == CLASS_HUNTER ? RANGED_ATTACK : BASE_ATTACK);
+ SpellPower = unit->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SPELL);
+ PowerData.emplace_back(int32(unit->getPowerType()), unit->GetPower(unit->getPowerType()), int32(0));
+}
+
+void WorldPackets::Spells::SpellCastLogData::Initialize(Spell const* spell)
+{
+ Health = spell->GetCaster()->GetHealth();
+ AttackPower = spell->GetCaster()->GetTotalAttackPowerValue(spell->GetCaster()->getClass() == CLASS_HUNTER ? RANGED_ATTACK : BASE_ATTACK);
+ SpellPower = spell->GetCaster()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SPELL);
+ Powers primaryPowerType = spell->GetCaster()->getPowerType();
+ bool primaryPowerAdded = false;
+ for (SpellPowerCost const& cost : spell->GetPowerCost())
+ {
+ PowerData.emplace_back(int32(cost.Power), spell->GetCaster()->GetPower(Powers(cost.Power)), int32(cost.Amount));
+ if (cost.Power == primaryPowerType)
+ primaryPowerAdded = true;
+ }
+
+ if (!primaryPowerAdded)
+ PowerData.insert(PowerData.begin(), SpellLogPowerData(int32(primaryPowerType), spell->GetCaster()->GetPower(primaryPowerType), 0));
+}
+
+ByteBuffer& WorldPackets::CombatLog::CombatLogServerPacket::WriteLogData()
+{
+ return _fullLogPacket << LogData;
+}
+
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastLogData const& spellCastLogData)
+{
+ data << int64(spellCastLogData.Health);
+ data << int32(spellCastLogData.AttackPower);
+ data << int32(spellCastLogData.SpellPower);
+ data.WriteBits(spellCastLogData.PowerData.size(), 9);
+ data.FlushBits();
+
+ for (WorldPackets::Spells::SpellLogPowerData const& powerData : spellCastLogData.PowerData)
+ {
+ data << int32(powerData.PowerType);
+ data << int32(powerData.Amount);
+ data << int32(powerData.Cost);
+ }
+
+ return data;
+}
+
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SandboxScalingData const& sandboxScalingData)
+{
+ data.WriteBits(sandboxScalingData.Type, 3);
+ data << int16(sandboxScalingData.PlayerLevelDelta);
+ data << uint16(sandboxScalingData.PlayerItemLevel);
+ data << uint8(sandboxScalingData.TargetLevel);
+ data << uint8(sandboxScalingData.Expansion);
+ data << uint8(sandboxScalingData.Class);
+ data << uint8(sandboxScalingData.TargetMinScalingLevel);
+ data << uint8(sandboxScalingData.TargetMaxScalingLevel);
+ data << int8(sandboxScalingData.TargetScalingLevelDelta);
+ return data;
+}
diff --git a/src/server/game/Server/Packets/CombatLogPacketsCommon.h b/src/server/game/Server/Packets/CombatLogPacketsCommon.h
new file mode 100644
index 00000000000..7f8d77dd73f
--- /dev/null
+++ b/src/server/game/Server/Packets/CombatLogPacketsCommon.h
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2008-2017 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 CombatLogPacketsCommon_h__
+#define CombatLogPacketsCommon_h__
+
+#include "Packet.h"
+
+class Spell;
+class Unit;
+
+namespace WorldPackets
+{
+ namespace Spells
+ {
+ struct SpellLogPowerData
+ {
+ SpellLogPowerData(int32 powerType, int32 amount, int32 cost) : PowerType(powerType), Amount(amount), Cost(cost) { }
+
+ int32 PowerType = 0;
+ int32 Amount = 0;
+ int32 Cost = 0;
+ };
+
+ struct SpellCastLogData
+ {
+ int64 Health = 0;
+ int32 AttackPower = 0;
+ int32 SpellPower = 0;
+ std::vector<SpellLogPowerData> PowerData;
+
+ void Initialize(Unit const* unit);
+ void Initialize(Spell const* spell);
+ };
+
+ struct SandboxScalingData
+ {
+ uint32 Type = 0;
+ int16 PlayerLevelDelta = 0;
+ uint16 PlayerItemLevel = 0;
+ uint8 TargetLevel = 0;
+ uint8 Expansion = 0;
+ uint8 Class = 1;
+ uint8 TargetMinScalingLevel = 1;
+ uint8 TargetMaxScalingLevel = 1;
+ int8 TargetScalingLevelDelta = 1;
+ };
+ }
+
+ namespace CombatLog
+ {
+ class CombatLogServerPacket : public ServerPacket
+ {
+ public:
+ CombatLogServerPacket(OpcodeServer opcode, size_t initialSize = 200, ConnectionType connection = CONNECTION_TYPE_DEFAULT)
+ : ServerPacket(opcode, initialSize, connection), _fullLogPacket(opcode, initialSize, connection) { }
+
+ WorldPacket const* GetFullLogPacket() const { return &_fullLogPacket; }
+ WorldPacket const* GetBasicLogPacket() const { return &_worldPacket; }
+
+ Spells::SpellCastLogData LogData;
+
+ protected:
+ template<typename T>
+ void operator<<(T const& val)
+ {
+ _worldPacket << val;
+ _fullLogPacket << val;
+ }
+
+ void WriteLogDataBit()
+ {
+ _worldPacket.WriteBit(false);
+ _fullLogPacket.WriteBit(true);
+ }
+
+ void FlushBits()
+ {
+ _worldPacket.FlushBits();
+ _fullLogPacket.FlushBits();
+ }
+
+ bool WriteBit(bool bit)
+ {
+ _worldPacket.WriteBit(bit);
+ _fullLogPacket.WriteBit(bit);
+ return bit;
+ }
+
+ void WriteBits(uint32 value, uint32 bitCount)
+ {
+ _worldPacket.WriteBits(value, bitCount);
+ _fullLogPacket.WriteBits(value, bitCount);
+ }
+
+ ByteBuffer& WriteLogData();
+
+ WorldPacket _fullLogPacket;
+ };
+ }
+}
+
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastLogData const& spellCastLogData);
+ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SandboxScalingData const& sandboxScalingData);
+
+#endif // CombatLogPacketsCommon_h__
diff --git a/src/server/game/Server/Packets/CombatPackets.cpp b/src/server/game/Server/Packets/CombatPackets.cpp
index 509fe8a83a1..71c4ef05549 100644
--- a/src/server/game/Server/Packets/CombatPackets.cpp
+++ b/src/server/game/Server/Packets/CombatPackets.cpp
@@ -16,7 +16,7 @@
*/
#include "CombatPackets.h"
-#include "SpellPackets.h"
+#include "Unit.h"
void WorldPackets::Combat::AttackSwing::Read()
{
diff --git a/src/server/game/Server/Packets/CombatPackets.h b/src/server/game/Server/Packets/CombatPackets.h
index a17df851b66..ca7ff808b72 100644
--- a/src/server/game/Server/Packets/CombatPackets.h
+++ b/src/server/game/Server/Packets/CombatPackets.h
@@ -20,7 +20,7 @@
#include "Packet.h"
#include "ObjectGuid.h"
-#include "SpellPackets.h"
+#include "CombatLogPacketsCommon.h"
namespace WorldPackets
{
@@ -39,12 +39,20 @@ namespace WorldPackets
class AttackSwingError final : public ServerPacket
{
public:
+ enum AttackSwingErr : uint8
+ {
+ CantAttack = 0,
+ BadFacing = 1,
+ NotInRange = 2,
+ DeadTarget = 3
+ };
+
AttackSwingError() : ServerPacket(SMSG_ATTACK_SWING_ERROR, 4) { }
AttackSwingError(AttackSwingErr reason) : ServerPacket(SMSG_ATTACK_SWING_ERROR, 4), Reason(reason) { }
WorldPacket const* Write() override;
- AttackSwingErr Reason = ATTACKSWINGERR_CANT_ATTACK;
+ AttackSwingErr Reason = CantAttack;
};
class AttackStop final : public ClientPacket
diff --git a/src/server/game/Server/Packets/EquipmentSetPackets.cpp b/src/server/game/Server/Packets/EquipmentSetPackets.cpp
index 2650410f0c1..b8d390c5fa5 100644
--- a/src/server/game/Server/Packets/EquipmentSetPackets.cpp
+++ b/src/server/game/Server/Packets/EquipmentSetPackets.cpp
@@ -37,7 +37,7 @@ WorldPacket const* WorldPackets::EquipmentSet::LoadEquipmentSet::Write()
_worldPacket << uint32(equipSet->SetID);
_worldPacket << uint32(equipSet->IgnoreMask);
- for (std::size_t i = 0; i < EQUIPMENT_SLOT_END; ++i)
+ for (std::size_t i = 0; i < EQUIPEMENT_SET_SLOTS; ++i)
{
_worldPacket << equipSet->Pieces[i];
_worldPacket << int32(equipSet->Appearances[i]);
@@ -67,7 +67,7 @@ void WorldPackets::EquipmentSet::SaveEquipmentSet::Read()
_worldPacket >> Set.SetID;
_worldPacket >> Set.IgnoreMask;
- for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
+ for (uint8 i = 0; i < EQUIPEMENT_SET_SLOTS; ++i)
{
_worldPacket >> Set.Pieces[i];
_worldPacket >> Set.Appearances[i];
@@ -97,7 +97,7 @@ void WorldPackets::EquipmentSet::UseEquipmentSet::Read()
{
_worldPacket >> Inv;
- for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
+ for (uint8 i = 0; i < EQUIPEMENT_SET_SLOTS; ++i)
{
_worldPacket >> Items[i].Item;
_worldPacket >> Items[i].ContainerSlot;
diff --git a/src/server/game/Server/Packets/EquipmentSetPackets.h b/src/server/game/Server/Packets/EquipmentSetPackets.h
index 2811fa396dc..ce1b187bde0 100644
--- a/src/server/game/Server/Packets/EquipmentSetPackets.h
+++ b/src/server/game/Server/Packets/EquipmentSetPackets.h
@@ -18,8 +18,8 @@
#pragma once
#include "Packet.h"
-#include "Player.h"
-#include "ItemPackets.h"
+#include "EquipementSet.h"
+#include "ItemPacketsCommon.h"
namespace WorldPackets
{
@@ -82,7 +82,7 @@ namespace WorldPackets
};
WorldPackets::Item::InvUpdate Inv;
- EquipmentSetItem Items[EQUIPMENT_SLOT_END];
+ EquipmentSetItem Items[EQUIPEMENT_SET_SLOTS];
uint64 GUID = 0; ///< Set Identifier
};
diff --git a/src/server/game/Server/Packets/GuildPackets.h b/src/server/game/Server/Packets/GuildPackets.h
index c41da5d8016..d08523d113b 100644
--- a/src/server/game/Server/Packets/GuildPackets.h
+++ b/src/server/game/Server/Packets/GuildPackets.h
@@ -19,9 +19,9 @@
#define GuildPackets_h__
#include "Packet.h"
-#include "ObjectGuid.h"
+#include "ItemPacketsCommon.h"
#include "Guild.h"
-#include "ItemPackets.h"
+#include "ObjectGuid.h"
namespace WorldPackets
{
diff --git a/src/server/game/Server/Packets/InspectPackets.h b/src/server/game/Server/Packets/InspectPackets.h
index 937d51839e0..462a40e776f 100644
--- a/src/server/game/Server/Packets/InspectPackets.h
+++ b/src/server/game/Server/Packets/InspectPackets.h
@@ -18,8 +18,9 @@
#pragma once
#include "Packet.h"
-#include "ItemPackets.h"
+#include "ItemPacketsCommon.h"
#include "ObjectGuid.h"
+#include "SharedDefines.h"
class Item;
diff --git a/src/server/game/Server/Packets/LootPackets.h b/src/server/game/Server/Packets/LootPackets.h
index 3d9e5ef9b70..5feddbf97f8 100644
--- a/src/server/game/Server/Packets/LootPackets.h
+++ b/src/server/game/Server/Packets/LootPackets.h
@@ -20,7 +20,7 @@
#include "Packet.h"
#include "ObjectGuid.h"
-#include "ItemPackets.h"
+#include "ItemPacketsCommon.h"
namespace WorldPackets
{
diff --git a/src/server/game/Server/Packets/MailPackets.h b/src/server/game/Server/Packets/MailPackets.h
index 9ff27382405..411e7cfb772 100644
--- a/src/server/game/Server/Packets/MailPackets.h
+++ b/src/server/game/Server/Packets/MailPackets.h
@@ -18,11 +18,11 @@
#ifndef MailPackets_h__
#define MailPackets_h__
-#include "ItemPackets.h"
#include "Packet.h"
-#include "QueryPackets.h"
+#include "ItemPacketsCommon.h"
#include "ObjectGuid.h"
+class Player;
struct Mail;
namespace WorldPackets
diff --git a/src/server/game/Server/Packets/NPCPackets.cpp b/src/server/game/Server/Packets/NPCPackets.cpp
index 70c75aa5607..ac0132d76cf 100644
--- a/src/server/game/Server/Packets/NPCPackets.cpp
+++ b/src/server/game/Server/Packets/NPCPackets.cpp
@@ -105,10 +105,7 @@ WorldPacket const* WorldPackets::NPC::TrainerList::Write()
_worldPacket << spell.MoneyCost;
_worldPacket << spell.ReqSkillLine;
_worldPacket << spell.ReqSkillRank;
-
- for (uint32 i = 0; i < MAX_TRAINERSPELL_ABILITY_REQS; ++i)
- _worldPacket << spell.ReqAbility[i];
-
+ _worldPacket.append(spell.ReqAbility.data(), spell.ReqAbility.size());
_worldPacket << spell.Usable;
_worldPacket << spell.ReqLevel;
}
diff --git a/src/server/game/Server/Packets/NPCPackets.h b/src/server/game/Server/Packets/NPCPackets.h
index d063d33962d..94f4d4f6575 100644
--- a/src/server/game/Server/Packets/NPCPackets.h
+++ b/src/server/game/Server/Packets/NPCPackets.h
@@ -19,8 +19,10 @@
#define NPCPackets_h__
#include "Packet.h"
-#include "ItemPackets.h"
-#include "Creature.h"
+#include "ItemPacketsCommon.h"
+#include "ObjectGuid.h"
+#include "Position.h"
+#include <array>
namespace WorldPackets
{
@@ -131,7 +133,7 @@ namespace WorldPackets
int32 MoneyCost = 0;
int32 ReqSkillLine = 0;
int32 ReqSkillRank = 0;
- int32 ReqAbility[MAX_TRAINERSPELL_ABILITY_REQS] = { };
+ std::array<int32, 3> ReqAbility;
uint8 Usable = 0;
uint8 ReqLevel = 0;
};
diff --git a/src/server/game/Server/Packets/PetPackets.h b/src/server/game/Server/Packets/PetPackets.h
index 0a8fb5e7c06..12ebdd8e150 100644
--- a/src/server/game/Server/Packets/PetPackets.h
+++ b/src/server/game/Server/Packets/PetPackets.h
@@ -19,11 +19,11 @@
#define PetPackets_h__
#include "Packet.h"
-#include "PacketUtilities.h"
+#include "Position.h"
#include "ObjectGuid.h"
#include "Optional.h"
-#include "Unit.h"
-#include "WorldSession.h"
+#include "UnitDefines.h"
+#include <array>
namespace WorldPackets
{
@@ -160,7 +160,6 @@ namespace WorldPackets
std::vector<uint32> Spells;
};
-
struct PetRenameData
{
ObjectGuid PetGUID;
diff --git a/src/server/game/Server/Packets/QueryPackets.cpp b/src/server/game/Server/Packets/QueryPackets.cpp
index 88e9a24b030..ffd1a645b6e 100644
--- a/src/server/game/Server/Packets/QueryPackets.cpp
+++ b/src/server/game/Server/Packets/QueryPackets.cpp
@@ -40,13 +40,13 @@ WorldPacket const* WorldPackets::Query::QueryCreatureResponse::Write()
_worldPacket.WriteBits(Stats.CursorName.length() + 1, 6);
_worldPacket.WriteBit(Stats.Leader);
- for (uint32 i = 0; i < MAX_CREATURE_NAMES; ++i)
+ for (std::size_t i = 0; i < Stats.Name.size(); ++i)
{
_worldPacket.WriteBits(Stats.Name[i].length() + 1, 11);
_worldPacket.WriteBits(Stats.NameAlt[i].length() + 1, 11);
}
- for (uint32 i = 0; i < MAX_CREATURE_NAMES; ++i)
+ for (std::size_t i = 0; i < Stats.Name.size(); ++i)
{
if (!Stats.Name[i].empty())
_worldPacket << Stats.Name[i];
@@ -55,19 +55,12 @@ WorldPacket const* WorldPackets::Query::QueryCreatureResponse::Write()
_worldPacket << Stats.NameAlt[i];
}
- for (uint8 i = 0; i < 2; ++i)
- _worldPacket << Stats.Flags[i];
-
+ _worldPacket.append(Stats.Flags.data(), Stats.Flags.size());
_worldPacket << int32(Stats.CreatureType);
_worldPacket << int32(Stats.CreatureFamily);
_worldPacket << int32(Stats.Classification);
-
- for (uint32 i = 0; i < MAX_KILL_CREDIT; ++i)
- _worldPacket << int32(Stats.ProxyCreatureID[i]);
-
- for (uint32 i = 0; i < MAX_CREATURE_MODELS; ++i)
- _worldPacket << int32(Stats.CreatureDisplayID[i]);
-
+ _worldPacket.append(Stats.ProxyCreatureID.data(), Stats.ProxyCreatureID.size());
+ _worldPacket.append(Stats.CreatureDisplayID.data(), Stats.CreatureDisplayID.size());
_worldPacket << float(Stats.HpMulti);
_worldPacket << float(Stats.EnergyMulti);
_worldPacket << uint32(Stats.QuestItems.size());
diff --git a/src/server/game/Server/Packets/QueryPackets.h b/src/server/game/Server/Packets/QueryPackets.h
index fefeae5ff4a..15c04624b6a 100644
--- a/src/server/game/Server/Packets/QueryPackets.h
+++ b/src/server/game/Server/Packets/QueryPackets.h
@@ -20,9 +20,12 @@
#include "Packet.h"
#include "AuthenticationPackets.h"
-#include "Creature.h"
#include "NPCHandler.h"
-#include "DB2Stores.h"
+#include "ObjectGuid.h"
+#include "Position.h"
+#include "SharedDefines.h"
+#include "UnitDefines.h"
+#include <array>
class Player;
@@ -56,11 +59,11 @@ namespace WorldPackets
int32 HealthScalingExpansion = 0;
uint32 RequiredExpansion = 0;
uint32 VignetteID = 0;
- uint32 Flags[2];
- uint32 ProxyCreatureID[MAX_KILL_CREDIT];
- uint32 CreatureDisplayID[MAX_CREATURE_MODELS];
- std::string Name[MAX_CREATURE_NAMES];
- std::string NameAlt[MAX_CREATURE_NAMES];
+ std::array<uint32, 2> Flags;
+ std::array<uint32, 2> ProxyCreatureID;
+ std::array<uint32, 4> CreatureDisplayID;
+ std::array<std::string, 4> Name;
+ std::array<std::string, 4> NameAlt;
};
class QueryCreatureResponse final : public ServerPacket
diff --git a/src/server/game/Server/Packets/QuestPackets.h b/src/server/game/Server/Packets/QuestPackets.h
index ac382f31b41..12d94ac4527 100644
--- a/src/server/game/Server/Packets/QuestPackets.h
+++ b/src/server/game/Server/Packets/QuestPackets.h
@@ -19,9 +19,9 @@
#define QuestPackets_h__
#include "Packet.h"
+#include "ItemPacketsCommon.h"
#include "QuestDef.h"
#include "ObjectGuid.h"
-#include "ItemPackets.h"
namespace WorldPackets
{
diff --git a/src/server/game/Server/Packets/SpellPackets.cpp b/src/server/game/Server/Packets/SpellPackets.cpp
index bfcde994f8f..ffe17bfdffd 100644
--- a/src/server/game/Server/Packets/SpellPackets.cpp
+++ b/src/server/game/Server/Packets/SpellPackets.cpp
@@ -69,9 +69,7 @@ WorldPacket const* WorldPackets::Spells::SendKnownSpells::Write()
WorldPacket const* WorldPackets::Spells::UpdateActionButtons::Write()
{
- for (uint32 i = 0; i < MAX_ACTION_BUTTONS; ++i)
- _worldPacket << ActionButtons[i];
-
+ _worldPacket.append(ActionButtons.data(), ActionButtons.size());
_worldPacket << Reason;
return &_worldPacket;
@@ -92,64 +90,6 @@ WorldPacket const* WorldPackets::Spells::SendUnlearnSpells::Write()
return &_worldPacket;
}
-void WorldPackets::Spells::SpellCastLogData::Initialize(Unit const* unit)
-{
- Health = unit->GetHealth();
- AttackPower = unit->GetTotalAttackPowerValue(unit->getClass() == CLASS_HUNTER ? RANGED_ATTACK : BASE_ATTACK);
- SpellPower = unit->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SPELL);
- PowerData.emplace_back(int32(unit->getPowerType()), unit->GetPower(unit->getPowerType()), int32(0));
-}
-
-void WorldPackets::Spells::SpellCastLogData::Initialize(Spell const* spell)
-{
- Health = spell->GetCaster()->GetHealth();
- AttackPower = spell->GetCaster()->GetTotalAttackPowerValue(spell->GetCaster()->getClass() == CLASS_HUNTER ? RANGED_ATTACK : BASE_ATTACK);
- SpellPower = spell->GetCaster()->SpellBaseDamageBonusDone(SPELL_SCHOOL_MASK_SPELL);
- Powers primaryPowerType = spell->GetCaster()->getPowerType();
- bool primaryPowerAdded = false;
- for (SpellInfo::CostData const& cost : spell->GetPowerCost())
- {
- PowerData.emplace_back(int32(cost.Power), spell->GetCaster()->GetPower(Powers(cost.Power)), int32(cost.Amount));
- if (cost.Power == primaryPowerType)
- primaryPowerAdded = true;
- }
-
- if (!primaryPowerAdded)
- PowerData.insert(PowerData.begin(), SpellLogPowerData(int32(primaryPowerType), spell->GetCaster()->GetPower(primaryPowerType), 0));
-}
-
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastLogData const& spellCastLogData)
-{
- data << int64(spellCastLogData.Health);
- data << int32(spellCastLogData.AttackPower);
- data << int32(spellCastLogData.SpellPower);
- data.WriteBits(spellCastLogData.PowerData.size(), 9);
- data.FlushBits();
-
- for (WorldPackets::Spells::SpellLogPowerData const& powerData : spellCastLogData.PowerData)
- {
- data << int32(powerData.PowerType);
- data << int32(powerData.Amount);
- data << int32(powerData.Cost);
- }
-
- return data;
-}
-
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SandboxScalingData const& sandboxScalingData)
-{
- data.WriteBits(sandboxScalingData.Type, 3);
- data << int16(sandboxScalingData.PlayerLevelDelta);
- data << uint16(sandboxScalingData.PlayerItemLevel);
- data << uint8(sandboxScalingData.TargetLevel);
- data << uint8(sandboxScalingData.Expansion);
- data << uint8(sandboxScalingData.Class);
- data << uint8(sandboxScalingData.TargetMinScalingLevel);
- data << uint8(sandboxScalingData.TargetMaxScalingLevel);
- data << int8(sandboxScalingData.TargetScalingLevelDelta);
- return data;
-}
-
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::AuraDataInfo const& auraData)
{
data << auraData.CastID;
diff --git a/src/server/game/Server/Packets/SpellPackets.h b/src/server/game/Server/Packets/SpellPackets.h
index 3d2aeca3610..4b4c0ad9db9 100644
--- a/src/server/game/Server/Packets/SpellPackets.h
+++ b/src/server/game/Server/Packets/SpellPackets.h
@@ -18,97 +18,18 @@
#ifndef SpellPackets_h__
#define SpellPackets_h__
-#include "Packet.h"
-#include "PacketUtilities.h"
-#include "Player.h"
-#include "SpellAuras.h"
-#include "Spell.h"
+#include "CombatLogPacketsCommon.h"
+#include "MovementInfo.h"
+#include "ObjectGuid.h"
#include "Optional.h"
+#include "Position.h"
+#include "SharedDefines.h"
+#include <array>
namespace WorldPackets
{
namespace Spells
{
- struct SpellLogPowerData
- {
- SpellLogPowerData(int32 powerType, int32 amount, int32 cost) : PowerType(powerType), Amount(amount), Cost(cost) { }
-
- int32 PowerType = 0;
- int32 Amount = 0;
- int32 Cost = 0;
- };
-
- struct SpellCastLogData
- {
- int64 Health = 0;
- int32 AttackPower = 0;
- int32 SpellPower = 0;
- std::vector<SpellLogPowerData> PowerData;
-
- void Initialize(Unit const* unit);
- void Initialize(Spell const* spell);
- };
- }
-}
-
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SpellCastLogData const& spellCastLogData);
-
-namespace WorldPackets
-{
- namespace CombatLog
- {
- class CombatLogServerPacket : public ServerPacket
- {
- public:
- CombatLogServerPacket(OpcodeServer opcode, size_t initialSize = 200, ConnectionType connection = CONNECTION_TYPE_DEFAULT)
- : ServerPacket(opcode, initialSize, connection), _fullLogPacket(opcode, initialSize, connection) { }
-
- WorldPacket const* GetFullLogPacket() const { return &_fullLogPacket; }
- WorldPacket const* GetBasicLogPacket() const { return &_worldPacket; }
-
- Spells::SpellCastLogData LogData;
-
- protected:
- template<typename T>
- void operator<<(T const& val)
- {
- _worldPacket << val;
- _fullLogPacket << val;
- }
-
- void WriteLogDataBit()
- {
- _worldPacket.WriteBit(false);
- _fullLogPacket.WriteBit(true);
- }
-
- void FlushBits()
- {
- _worldPacket.FlushBits();
- _fullLogPacket.FlushBits();
- }
-
- bool WriteBit(bool bit)
- {
- _worldPacket.WriteBit(bit);
- _fullLogPacket.WriteBit(bit);
- return bit;
- }
-
- void WriteBits(uint32 value, uint32 bitCount)
- {
- _worldPacket.WriteBits(value, bitCount);
- _fullLogPacket.WriteBits(value, bitCount);
- }
-
- ByteBuffer& WriteLogData() { return _fullLogPacket << LogData; }
-
- WorldPacket _fullLogPacket;
- };
- }
-
- namespace Spells
- {
class CancelAura final : public ClientPacket
{
public:
@@ -207,14 +128,16 @@ namespace WorldPackets
class UpdateActionButtons final : public ServerPacket
{
public:
- UpdateActionButtons() : ServerPacket(SMSG_UPDATE_ACTION_BUTTONS, MAX_ACTION_BUTTONS * 8 + 1)
+ static std::size_t constexpr NumActionButtons = 132;
+
+ UpdateActionButtons() : ServerPacket(SMSG_UPDATE_ACTION_BUTTONS, NumActionButtons * 8 + 1)
{
- std::memset(ActionButtons, 0, sizeof(ActionButtons));
+ ActionButtons.fill(0);
}
WorldPacket const* Write() override;
- uint64 ActionButtons[MAX_ACTION_BUTTONS];
+ std::array<uint64, NumActionButtons> ActionButtons;
uint8 Reason = 0;
/*
Reason can be 0, 1, 2
@@ -245,19 +168,6 @@ namespace WorldPackets
std::vector<uint32> Spells;
};
- struct SandboxScalingData
- {
- uint32 Type = 0;
- int16 PlayerLevelDelta = 0;
- uint16 PlayerItemLevel = 0;
- uint8 TargetLevel = 0;
- uint8 Expansion = 0;
- uint8 Class = 1;
- uint8 TargetMinScalingLevel = 1;
- uint8 TargetMaxScalingLevel = 1;
- int8 TargetScalingLevelDelta = 1;
- };
-
struct AuraDataInfo
{
ObjectGuid CastID;
@@ -1062,6 +972,5 @@ namespace WorldPackets
}
ByteBuffer& operator>>(ByteBuffer& buffer, WorldPackets::Spells::SpellCastRequest& request);
-ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::Spells::SandboxScalingData const& sandboxScalingData);
#endif // SpellPackets_h__
diff --git a/src/server/game/Server/Packets/TalentPackets.h b/src/server/game/Server/Packets/TalentPackets.h
index 7c5f15a9563..82ec152e1b5 100644
--- a/src/server/game/Server/Packets/TalentPackets.h
+++ b/src/server/game/Server/Packets/TalentPackets.h
@@ -19,8 +19,9 @@
#define TalentPackets_h__
#include "Packet.h"
+#include "DBCEnums.h"
+#include "ObjectGuid.h"
#include "PacketUtilities.h"
-#include "Player.h"
namespace WorldPackets
{
diff --git a/src/server/game/Server/Packets/ToyPackets.h b/src/server/game/Server/Packets/ToyPackets.h
index 663163d992c..37f79fbe803 100644
--- a/src/server/game/Server/Packets/ToyPackets.h
+++ b/src/server/game/Server/Packets/ToyPackets.h
@@ -18,8 +18,6 @@
#ifndef ToyPackets_h__
#define ToyPackets_h__
-#include "Packet.h"
-#include "ObjectGuid.h"
#include "SpellPackets.h"
#include "CollectionMgr.h"
diff --git a/src/server/game/Server/Packets/TradePackets.h b/src/server/game/Server/Packets/TradePackets.h
index 8ace77824e5..972ae798a58 100644
--- a/src/server/game/Server/Packets/TradePackets.h
+++ b/src/server/game/Server/Packets/TradePackets.h
@@ -18,7 +18,10 @@
#ifndef TradePackets_h__
#define TradePackets_h__
-#include "ItemPackets.h"
+#include "Packet.h"
+#include "ItemPacketsCommon.h"
+#include "ObjectGuid.h"
+#include "SharedDefines.h"
namespace WorldPackets
{
diff --git a/src/server/game/Server/Packets/VoidStoragePackets.h b/src/server/game/Server/Packets/VoidStoragePackets.h
index bccc3129e5b..5a9aff476b5 100644
--- a/src/server/game/Server/Packets/VoidStoragePackets.h
+++ b/src/server/game/Server/Packets/VoidStoragePackets.h
@@ -19,7 +19,9 @@
#define VoidStoragePackets_h__
#include "Packet.h"
-#include "ItemPackets.h"
+#include "ItemPacketsCommon.h"
+#include "ObjectGuid.h"
+#include "SharedDefines.h"
namespace WorldPackets
{
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 8b4c5e99743..cc0c47af344 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -784,14 +784,6 @@ enum PartyOperation
PARTY_OP_SWAP = 4
};
-enum BarberShopResult
-{
- BARBER_SHOP_RESULT_SUCCESS = 0,
- BARBER_SHOP_RESULT_NO_MONEY = 1,
- BARBER_SHOP_RESULT_NOT_ON_CHAIR = 2,
- BARBER_SHOP_RESULT_NO_MONEY_2 = 3
-};
-
enum BFLeaveReason
{
BF_LEAVE_REASON_CLOSE = 1,
@@ -1125,7 +1117,6 @@ class TC_GAME_API WorldSession
void SendCharCustomize(ResponseCodes result, WorldPackets::Character::CharCustomizeInfo const* customizeInfo);
void SendCharFactionChange(ResponseCodes result, WorldPackets::Character::CharRaceOrFactionChangeInfo const* factionChangeInfo);
void SendSetPlayerDeclinedNamesResult(DeclinedNameResult result, ObjectGuid guid);
- void SendBarberShopResult(BarberShopResult result);
void SendUndeleteCooldownStatusResponse(uint32 currentCooldown, uint32 maxCooldown);
void SendUndeleteCharacterResponse(CharacterUndeleteResult result, WorldPackets::Character::CharacterUndeleteInfo const* undeleteInfo);
diff --git a/src/server/game/Server/WorldSocketMgr.cpp b/src/server/game/Server/WorldSocketMgr.cpp
index 1fda984f969..65f74af46c9 100644
--- a/src/server/game/Server/WorldSocketMgr.cpp
+++ b/src/server/game/Server/WorldSocketMgr.cpp
@@ -21,7 +21,6 @@
#include "NetworkThread.h"
#include "ScriptMgr.h"
#include "WorldSocket.h"
-#include "World.h"
#include <boost/system/error_code.hpp>
static void OnSocketAccept(tcp::socket&& sock, uint32 threadIndex)
@@ -59,7 +58,7 @@ WorldSocketMgr& WorldSocketMgr::Instance()
return instance;
}
-bool WorldSocketMgr::StartNetwork(boost::asio::io_service& service, std::string const& bindIp, uint16 port, int threadCount)
+bool WorldSocketMgr::StartWorldNetwork(boost::asio::io_service& service, std::string const& bindIp, uint16 port, uint16 instancePort, int threadCount)
{
_tcpNoDelay = sConfigMgr->GetBoolDefault("Network.TcpNodelay", true);
@@ -83,7 +82,7 @@ bool WorldSocketMgr::StartNetwork(boost::asio::io_service& service, std::string
AsyncAcceptor* instanceAcceptor = nullptr;
try
{
- instanceAcceptor = new AsyncAcceptor(service, bindIp, uint16(sWorld->getIntConfig(CONFIG_PORT_INSTANCE)));
+ instanceAcceptor = new AsyncAcceptor(service, bindIp, instancePort);
}
catch (boost::system::system_error const& err)
{
diff --git a/src/server/game/Server/WorldSocketMgr.h b/src/server/game/Server/WorldSocketMgr.h
index 3540d8778c1..ea4b10f863f 100644
--- a/src/server/game/Server/WorldSocketMgr.h
+++ b/src/server/game/Server/WorldSocketMgr.h
@@ -40,7 +40,7 @@ public:
static WorldSocketMgr& Instance();
/// Start network, listen at address:port .
- bool StartNetwork(boost::asio::io_service& service, std::string const& bindIp, uint16 port, int networkThreads) override;
+ bool StartWorldNetwork(boost::asio::io_service& service, std::string const& bindIp, uint16 port, uint16 instancePort, int networkThreads);
/// Stops all network threads, It will wait for all running threads .
void StopNetwork() override;
@@ -55,6 +55,12 @@ protected:
NetworkThread<WorldSocket>* CreateThreads() const override;
private:
+ // private, must not be called directly
+ bool StartNetwork(boost::asio::io_service& service, std::string const& bindIp, uint16 port, int threadCount) override
+ {
+ return BaseSocketMgr::StartNetwork(service, bindIp, port, threadCount);
+ }
+
AsyncAcceptor* _instanceAcceptor;
int32 _socketSystemSendBufferSize;
int32 _socketApplicationSendBufferSize;
diff --git a/src/server/game/Spells/Auras/SpellAuraDefines.h b/src/server/game/Spells/Auras/SpellAuraDefines.h
index 60781365cdf..4041f8c1335 100644
--- a/src/server/game/Spells/Auras/SpellAuraDefines.h
+++ b/src/server/game/Spells/Auras/SpellAuraDefines.h
@@ -48,6 +48,16 @@ enum AuraEffectHandleModes
AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK = (AURA_EFFECT_HANDLE_REAPPLY | AURA_EFFECT_HANDLE_REAL)
};
+enum AuraRemoveMode
+{
+ AURA_REMOVE_NONE = 0,
+ AURA_REMOVE_BY_DEFAULT = 1, // scripted remove, remove by stack with aura with different ids and sc aura remove
+ AURA_REMOVE_BY_CANCEL,
+ AURA_REMOVE_BY_ENEMY_SPELL, // dispel and absorb aura destroy
+ AURA_REMOVE_BY_EXPIRE, // aura duration has ended
+ AURA_REMOVE_BY_DEATH
+};
+
//m_schoolAbsorb
enum DAMAGE_ABSORB_TYPE
{
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 2a677dc50d1..867753ecfb6 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -420,6 +420,16 @@ void SpellCastTargets::RemoveDst()
m_targetMask &= ~(TARGET_FLAG_DEST_LOCATION);
}
+bool SpellCastTargets::HasSrc() const
+{
+ return (GetTargetMask() & TARGET_FLAG_SOURCE_LOCATION) != 0;
+}
+
+bool SpellCastTargets::HasDst() const
+{
+ return (GetTargetMask() & TARGET_FLAG_DEST_LOCATION) != 0;
+}
+
void SpellCastTargets::Update(Unit* caster)
{
m_objectTarget = !m_objectTargetGUID.IsEmpty() ? ((m_objectTargetGUID == caster->GetGUID()) ? caster : ObjectAccessor::GetWorldObject(*caster, m_objectTargetGUID)) : NULL;
@@ -498,9 +508,22 @@ SpellValue::SpellValue(Difficulty diff, SpellInfo const* proto)
AuraStackAmount = 1;
}
+class TC_GAME_API SpellEvent : public BasicEvent
+{
+public:
+ SpellEvent(Spell* spell);
+ virtual ~SpellEvent();
+
+ virtual bool Execute(uint64 e_time, uint32 p_time) override;
+ virtual void Abort(uint64 e_time) override;
+ virtual bool IsDeletable() const override;
+protected:
+ Spell* m_Spell;
+};
+
Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID, bool skipCheck) :
m_spellInfo(info), m_caster((info->HasAttribute(SPELL_ATTR6_CAST_BY_CHARMER) && caster->GetCharmerOrOwner()) ? caster->GetCharmerOrOwner() : caster),
-m_spellValue(new SpellValue(caster->GetMap()->GetDifficultyID(), m_spellInfo)), m_preGeneratedPath(PathGenerator(m_caster))
+m_spellValue(new SpellValue(caster->GetMap()->GetDifficultyID(), m_spellInfo))
{
_effects = info->GetEffectsForDifficulty(caster->GetMap()->GetDifficultyID());
@@ -3927,10 +3950,10 @@ void Spell::SendSpellStart()
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsPet()))
- && std::find_if(m_powerCost.begin(), m_powerCost.end(), [](SpellInfo::CostData const& cost) { return cost.Power != POWER_HEALTH; }) != m_powerCost.end())
+ && std::find_if(m_powerCost.begin(), m_powerCost.end(), [](SpellPowerCost const& cost) { return cost.Power != POWER_HEALTH; }) != m_powerCost.end())
castFlags |= CAST_FLAG_POWER_LEFT_SELF;
- if (std::find_if(m_powerCost.begin(), m_powerCost.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_RUNES; }) != m_powerCost.end())
+ if (std::find_if(m_powerCost.begin(), m_powerCost.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_RUNES; }) != m_powerCost.end())
castFlags |= CAST_FLAG_NO_GCD; // not needed, but Blizzard sends it
WorldPackets::Spells::SpellStart packet;
@@ -3954,7 +3977,7 @@ void Spell::SendSpellStart()
if (castFlags & CAST_FLAG_POWER_LEFT_SELF)
{
- for (SpellInfo::CostData const& cost : m_powerCost)
+ for (SpellPowerCost const& cost : m_powerCost)
{
WorldPackets::Spells::SpellPowerData powerData;
powerData.Type = cost.Power;
@@ -4028,12 +4051,12 @@ void Spell::SendSpellGo()
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->IsPet()))
- && std::find_if(m_powerCost.begin(), m_powerCost.end(), [](SpellInfo::CostData const& cost) { return cost.Power != POWER_HEALTH; }) != m_powerCost.end())
+ && std::find_if(m_powerCost.begin(), m_powerCost.end(), [](SpellPowerCost const& cost) { return cost.Power != POWER_HEALTH; }) != m_powerCost.end())
castFlags |= CAST_FLAG_POWER_LEFT_SELF; // should only be sent to self, but the current messaging doesn't make that possible
if ((m_caster->GetTypeId() == TYPEID_PLAYER)
&& (m_caster->getClass() == CLASS_DEATH_KNIGHT)
- && std::find_if(m_powerCost.begin(), m_powerCost.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_RUNES; }) != m_powerCost.end()
+ && std::find_if(m_powerCost.begin(), m_powerCost.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_RUNES; }) != m_powerCost.end()
&& !(_triggeredCastFlags & TRIGGERED_IGNORE_POWER_AND_REAGENT_COST))
{
castFlags |= CAST_FLAG_NO_GCD; // not needed, but Blizzard sends it
@@ -4072,7 +4095,7 @@ void Spell::SendSpellGo()
if (castFlags & CAST_FLAG_POWER_LEFT_SELF)
{
- for (SpellInfo::CostData const& cost : m_powerCost)
+ for (SpellPowerCost const& cost : m_powerCost)
{
WorldPackets::Spells::SpellPowerData powerData;
powerData.Type = cost.Power;
@@ -4503,7 +4526,7 @@ void Spell::TakePower()
return;
}
- for (SpellInfo::CostData& cost : m_powerCost)
+ for (SpellPowerCost& cost : m_powerCost)
{
Powers powerType = Powers(cost.Power);
bool hit = true;
@@ -4563,7 +4586,7 @@ void Spell::TakePower()
SpellCastResult Spell::CheckRuneCost()
{
- auto runeCost = std::find_if(m_powerCost.begin(), m_powerCost.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_RUNES; });
+ auto runeCost = std::find_if(m_powerCost.begin(), m_powerCost.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_RUNES; });
if (runeCost == m_powerCost.end())
return SPELL_CAST_OK;
@@ -4593,7 +4616,7 @@ void Spell::TakeRunePower(bool didHit)
Player* player = m_caster->ToPlayer();
m_runesState = player->GetRunesState(); // store previous state
- int32 runeCost = std::find_if(m_powerCost.begin(), m_powerCost.end(), [](SpellInfo::CostData const& cost)
+ int32 runeCost = std::find_if(m_powerCost.begin(), m_powerCost.end(), [](SpellPowerCost const& cost)
{
return cost.Power == POWER_RUNES;
})->Amount;
@@ -5242,26 +5265,27 @@ SpellCastResult Spell::CheckCast(bool strict)
float objSize = target->GetObjectSize();
float range = m_spellInfo->GetMaxRange(true, m_caster, this) * 1.5f + objSize; // can't be overly strict
- m_preGeneratedPath.SetPathLengthLimit(range);
+ m_preGeneratedPath = Trinity::make_unique<PathGenerator>(m_caster);
+ m_preGeneratedPath->SetPathLengthLimit(range);
// first try with raycast, if it fails fall back to normal path
float targetObjectSize = std::min(target->GetObjectSize(), 4.0f);
- bool result = m_preGeneratedPath.CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + targetObjectSize, false, true);
- if (m_preGeneratedPath.GetPathType() & PATHFIND_SHORT)
+ bool result = m_preGeneratedPath->CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + targetObjectSize, false, true);
+ if (m_preGeneratedPath->GetPathType() & PATHFIND_SHORT)
return SPELL_FAILED_OUT_OF_RANGE;
- else if (!result || m_preGeneratedPath.GetPathType() & (PATHFIND_NOPATH | PATHFIND_INCOMPLETE))
+ else if (!result || m_preGeneratedPath->GetPathType() & (PATHFIND_NOPATH | PATHFIND_INCOMPLETE))
{
- result = m_preGeneratedPath.CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + targetObjectSize, false, false);
- if (m_preGeneratedPath.GetPathType() & PATHFIND_SHORT)
+ result = m_preGeneratedPath->CalculatePath(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() + targetObjectSize, false, false);
+ if (m_preGeneratedPath->GetPathType() & PATHFIND_SHORT)
return SPELL_FAILED_OUT_OF_RANGE;
- else if (!result || m_preGeneratedPath.GetPathType() & (PATHFIND_NOPATH | PATHFIND_INCOMPLETE))
+ else if (!result || m_preGeneratedPath->GetPathType() & (PATHFIND_NOPATH | PATHFIND_INCOMPLETE))
return SPELL_FAILED_NOPATH;
- else if (m_preGeneratedPath.IsInvalidDestinationZ(target)) // Check position z, if not in a straight line
+ else if (m_preGeneratedPath->IsInvalidDestinationZ(target)) // Check position z, if not in a straight line
return SPELL_FAILED_NOPATH;
}
- else if (m_preGeneratedPath.IsInvalidDestinationZ(target)) // Check position z, if in a straight line
+ else if (m_preGeneratedPath->IsInvalidDestinationZ(target)) // Check position z, if in a straight line
return SPELL_FAILED_NOPATH;
- m_preGeneratedPath.ReducePathLenghtByDist(objSize); // move back
+ m_preGeneratedPath->ReducePathLenghtByDist(objSize); // move back
}
break;
}
@@ -5902,6 +5926,11 @@ SpellCastResult Spell::CheckArenaAndRatedBattlegroundCastRules()
return SPELL_CAST_OK;
}
+int32 Spell::CalculateDamage(uint8 i, Unit const* target, float* var /*= nullptr*/) const
+{
+ return m_caster->CalculateSpellDamage(target, m_spellInfo, i, &m_spellValue->EffectBasePoints[i], var, m_castItemLevel);
+}
+
bool Spell::CanAutoCast(Unit* target)
{
if (!target)
@@ -5961,6 +5990,18 @@ bool Spell::CanAutoCast(Unit* target)
return false;
}
+void Spell::CheckSrc()
+{
+ if (!m_targets.HasSrc())
+ m_targets.SetSrc(*m_caster);
+}
+
+void Spell::CheckDst()
+{
+ if (!m_targets.HasDst())
+ m_targets.SetDst(*m_caster);
+}
+
SpellCastResult Spell::CheckRange(bool strict)
{
// Don't check for instant cast spells
@@ -6059,7 +6100,7 @@ SpellCastResult Spell::CheckPower()
if (m_CastItem)
return SPELL_CAST_OK;
- for (SpellInfo::CostData const& cost : m_powerCost)
+ for (SpellPowerCost const& cost : m_powerCost)
{
// health as power used - need check health amount
if (cost.Power == POWER_HEALTH)
@@ -6801,6 +6842,21 @@ bool Spell::IsNextMeleeSwingSpell() const
return m_spellInfo->HasAttribute(SPELL_ATTR0_ON_NEXT_SWING);
}
+bool Spell::IsTriggered() const
+{
+ return (_triggeredCastFlags & TRIGGERED_FULL_MASK) != 0;
+}
+
+bool Spell::IsIgnoringCooldowns() const
+{
+ return (_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD) != 0;
+}
+
+bool Spell::IsChannelActive() const
+{
+ return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0;
+}
+
bool Spell::IsAutoActionResetSpell() const
{
/// @todo changed SPELL_INTERRUPT_FLAG_AUTOATTACK -> SPELL_INTERRUPT_FLAG_INTERRUPT to fix compile - is this check correct at all?
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index 39a5b705563..e31fc53659b 100644
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -19,11 +19,12 @@
#ifndef __SPELL_H
#define __SPELL_H
-#include "GridDefines.h"
+#include "ConditionMgr.h"
+#include "DBCEnums.h"
+#include "ObjectGuid.h"
+#include "Position.h"
#include "SharedDefines.h"
-#include "ObjectMgr.h"
-#include "SpellInfo.h"
-#include "PathGenerator.h"
+#include <memory>
namespace WorldPackets
{
@@ -36,14 +37,31 @@ namespace WorldPackets
}
}
-class Unit;
-class Player;
-class GameObject;
-class DynamicObject;
-class WorldObject;
class Aura;
+class AuraEffect;
+class Corpse;
+class DynamicObject;
+class GameObject;
+class Item;
+class Object;
+class PathGenerator;
+class Player;
+class SpellEffectInfo;
+class SpellImplicitTargetInfo;
+class SpellInfo;
class SpellScript;
-class ByteBuffer;
+class Unit;
+class WorldObject;
+struct SpellPowerCost;
+struct SummonPropertiesEntry;
+enum CurrentSpellTypes : uint8;
+enum LootType : uint8;
+enum SpellCastTargetFlags : uint32;
+enum SpellTargetCheckTypes : uint8;
+enum SpellTargetObjectTypes : uint8;
+enum SpellValueMod : uint8;
+enum TriggerCastFlags : uint32;
+enum WeaponAttackType : uint8;
#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILLISECONDS)
@@ -237,8 +255,8 @@ class TC_GAME_API SpellCastTargets
void ModDst(SpellDestination const& spellDest);
void RemoveDst();
- bool HasSrc() const { return (GetTargetMask() & TARGET_FLAG_SOURCE_LOCATION) != 0; }
- bool HasDst() const { return (GetTargetMask() & TARGET_FLAG_DEST_LOCATION) != 0; }
+ bool HasSrc() const;
+ bool HasDst() const;
bool HasTraj() const { return m_speed != 0; }
float GetPitch() const { return m_pitch; }
@@ -307,7 +325,7 @@ static const uint32 SPELL_INTERRUPT_NONPLAYER = 32747;
class TC_GAME_API Spell
{
- friend void Unit::SetCurrentCastSpell(Spell* pSpell);
+ friend void SetUnitCurrentCastSpell(Unit* unit, Spell* spell);
friend class SpellScript;
public:
@@ -519,7 +537,7 @@ class TC_GAME_API Spell
SpellCastResult CheckCasterAuras() const;
SpellCastResult CheckArenaAndRatedBattlegroundCastRules();
- int32 CalculateDamage(uint8 i, Unit const* target, float* var = nullptr) const { return m_caster->CalculateSpellDamage(target, m_spellInfo, i, &m_spellValue->EffectBasePoints[i], var, m_castItemLevel); }
+ int32 CalculateDamage(uint8 i, Unit const* target, float* var = nullptr) const;
bool HaveTargetsForEffect(uint8 effect) const;
void Delayed();
@@ -533,8 +551,8 @@ class TC_GAME_API Spell
bool CheckEffectTarget(GameObject const* target, SpellEffectInfo const* effect) const;
bool CheckEffectTarget(Item const* target, SpellEffectInfo const* effect) const;
bool CanAutoCast(Unit* target);
- void CheckSrc() { if (!m_targets.HasSrc()) m_targets.SetSrc(*m_caster); }
- void CheckDst() { if (!m_targets.HasDst()) m_targets.SetDst(*m_caster); }
+ void CheckSrc();
+ void CheckDst();
static void SendCastResult(Player* caster, SpellInfo const* spellInfo, uint32 spellVisual, ObjectGuid cast_count, SpellCastResult result, SpellCustomErrors customError = SPELL_CUSTOM_ERROR_NONE, uint32* misc = nullptr);
void SendCastResult(SpellCastResult result);
@@ -616,9 +634,9 @@ class TC_GAME_API Spell
void SetAutoRepeat(bool rep) { m_autoRepeat = rep; }
void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; }
bool IsNextMeleeSwingSpell() const;
- bool IsTriggered() const { return (_triggeredCastFlags & TRIGGERED_FULL_MASK) != 0; }
- bool IsIgnoringCooldowns() const { return (_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD) != 0; }
- bool IsChannelActive() const { return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0; }
+ bool IsTriggered() const;
+ bool IsIgnoringCooldowns() const;
+ bool IsChannelActive() const;
bool IsAutoActionResetSpell() const;
bool IsDeletable() const { return !m_referencedFromCurrentSpell && !m_executedCurrently; }
@@ -636,7 +654,7 @@ class TC_GAME_API Spell
Unit* GetCaster() const { return m_caster; }
Unit* GetOriginalCaster() const { return m_originalCaster; }
SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
- std::vector<SpellInfo::CostData> const& GetPowerCost() const { return m_powerCost; }
+ std::vector<SpellPowerCost> const& GetPowerCost() const { return m_powerCost; }
bool UpdatePointers(); // must be used at call Spell code after time delay (non triggered spell cast/update spell call/etc)
@@ -644,7 +662,7 @@ class TC_GAME_API Spell
void SetSpellValue(SpellValueMod mod, int32 value);
- SpellEffectInfoVector const& GetEffects() const { return _effects; }
+ std::vector<SpellEffectInfo const*> const& GetEffects() const { return _effects; }
SpellEffectInfo const* GetEffect(uint32 index) const
{
if (index >= _effects.size())
@@ -681,7 +699,7 @@ class TC_GAME_API Spell
SpellSchoolMask m_spellSchoolMask; // Spell school (can be overwrite for some spells (wand shoot for example)
WeaponAttackType m_attackType; // For weapon based attack
- std::vector<SpellInfo::CostData> m_powerCost; // Calculated spell cost initialized only in Spell::prepare
+ std::vector<SpellPowerCost> m_powerCost; // Calculated spell cost initialized only in Spell::prepare
int32 m_casttime; // Calculated spell cast time initialized only in Spell::prepare
int32 m_channeledDuration; // Calculated channeled spell duration in order to calculate correct pushback.
bool m_canReflect; // can reflect this spell?
@@ -852,7 +870,7 @@ class TC_GAME_API Spell
bool m_skipCheck;
uint32 m_auraScaleMask;
- PathGenerator m_preGeneratedPath;
+ std::unique_ptr<PathGenerator> m_preGeneratedPath;
std::vector<SpellLogEffectPowerDrainParams> _powerDrainTargets[MAX_SPELL_EFFECTS];
std::vector<SpellLogEffectExtraAttacksParams> _extraAttacksTargets[MAX_SPELL_EFFECTS];
@@ -864,7 +882,7 @@ class TC_GAME_API Spell
Spell(Spell const& right) = delete;
Spell& operator=(Spell const& right) = delete;
- SpellEffectInfoVector _effects;
+ std::vector<SpellEffectInfo const*> _effects;
};
namespace Trinity
@@ -918,17 +936,4 @@ namespace Trinity
}
typedef void(Spell::*pEffect)(SpellEffIndex effIndex);
-
-class TC_GAME_API SpellEvent : public BasicEvent
-{
- public:
- SpellEvent(Spell* spell);
- virtual ~SpellEvent();
-
- virtual bool Execute(uint64 e_time, uint32 p_time) override;
- virtual void Abort(uint64 e_time) override;
- virtual bool IsDeletable() const override;
- protected:
- Spell* m_Spell;
-};
#endif
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 1eeb35f43ba..a5d97bc8843 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -16,54 +16,55 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "Spell.h"
+#include "AccountMgr.h"
+#include "AreaTrigger.h"
+#include "Battleground.h"
+#include "BattlegroundMgr.h"
+#include "BattlePetMgr.h"
+#include "CombatLogPackets.h"
#include "Common.h"
+#include "Conversation.h"
+#include "Creature.h"
+#include "CreatureAI.h"
#include "DatabaseEnv.h"
-#include "WorldPacket.h"
-#include "Opcodes.h"
-#include "Log.h"
-#include "World.h"
-#include "ObjectMgr.h"
-#include "SpellMgr.h"
-#include "Player.h"
-#include "SkillExtraItems.h"
-#include "Unit.h"
-#include "Spell.h"
+#include "DuelPackets.h"
#include "DynamicObject.h"
-#include "SpellAuras.h"
-#include "SpellAuraEffects.h"
-#include "SpellHistory.h"
-#include "Group.h"
-#include "SharedDefines.h"
-#include "Pet.h"
#include "GameObject.h"
-#include "GossipDef.h"
-#include "Creature.h"
-#include "Totem.h"
-#include "CreatureAI.h"
-#include "BattlegroundMgr.h"
-#include "Battleground.h"
-#include "OutdoorPvPMgr.h"
-#include "Language.h"
-#include "SocialMgr.h"
-#include "Util.h"
-#include "TemporarySummon.h"
-#include "ScriptMgr.h"
#include "GameObjectAI.h"
-#include "AccountMgr.h"
+#include "Garrison.h"
+#include "GossipDef.h"
+#include "Group.h"
+#include "Guild.h"
#include "InstanceScript.h"
+#include "Language.h"
+#include "Log.h"
+#include "LootMgr.h"
+#include "MiscPackets.h"
+#include "ObjectMgr.h"
+#include "Opcodes.h"
+#include "OutdoorPvPMgr.h"
#include "PathGenerator.h"
-#include "Guild.h"
+#include "Pet.h"
+#include "Player.h"
#include "ReputationMgr.h"
-#include "AreaTrigger.h"
-#include "BattlePetMgr.h"
-#include "Garrison.h"
-#include "CombatLogPackets.h"
-#include "DuelPackets.h"
-#include "MiscPackets.h"
+#include "ScriptMgr.h"
+#include "SharedDefines.h"
+#include "SkillExtraItems.h"
+#include "SocialMgr.h"
+#include "SpellAuraEffects.h"
+#include "SpellAuras.h"
+#include "SpellHistory.h"
+#include "SpellMgr.h"
#include "SpellPackets.h"
#include "TalentPackets.h"
-#include "Conversation.h"
-#include "LootMgr.h"
+#include "TemporarySummon.h"
+#include "Totem.h"
+#include "Unit.h"
+#include "Util.h"
+#include "World.h"
+#include "WorldPacket.h"
+#include <G3D/Quat.h>
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
{
@@ -4307,14 +4308,14 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
spellEffectExtraData->SpellVisualId = effectInfo->MiscValueB;
}
// Spell is not using explicit target - no generated path
- if (m_preGeneratedPath.GetPathType() == PATHFIND_BLANK)
+ if (m_preGeneratedPath->GetPathType() == PATHFIND_BLANK)
{
//unitTarget->GetContactPoint(m_caster, pos.m_positionX, pos.m_positionY, pos.m_positionZ);
Position pos = unitTarget->GetFirstCollisionPosition(unitTarget->GetObjectSize(), unitTarget->GetRelativeAngle(m_caster));
m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speed, EVENT_CHARGE, false, unitTarget, spellEffectExtraData.get_ptr());
}
else
- m_caster->GetMotionMaster()->MoveCharge(m_preGeneratedPath, speed, unitTarget, spellEffectExtraData.get_ptr());
+ m_caster->GetMotionMaster()->MoveCharge(*m_preGeneratedPath, speed, unitTarget, spellEffectExtraData.get_ptr());
}
if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET)
@@ -4615,8 +4616,8 @@ void Spell::EffectDestroyAllTotems(SpellEffIndex /*effIndex*/)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (spellInfo)
{
- std::vector<SpellInfo::CostData> costs = spellInfo->CalcPowerCost(m_caster, spellInfo->GetSchoolMask());
- auto m = std::find_if(costs.begin(), costs.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_MANA; });
+ std::vector<SpellPowerCost> costs = spellInfo->CalcPowerCost(m_caster, spellInfo->GetSchoolMask());
+ auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_MANA; });
if (m != costs.end())
mana += m->Amount;
}
diff --git a/src/server/game/Spells/SpellHistory.cpp b/src/server/game/Spells/SpellHistory.cpp
index dee766daff3..e614709b10c 100644
--- a/src/server/game/Spells/SpellHistory.cpp
+++ b/src/server/game/Spells/SpellHistory.cpp
@@ -17,9 +17,11 @@
#include "SpellHistory.h"
#include "DatabaseEnv.h"
+#include "ObjectMgr.h"
#include "Pet.h"
#include "PetPackets.h"
#include "Player.h"
+#include "Spell.h"
#include "SpellInfo.h"
#include "SpellPackets.h"
#include "World.h"
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 4a3aa150bdb..8ea71d76484 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -16,18 +16,20 @@
*/
#include "SpellInfo.h"
-#include "Log.h"
-#include "SpellAuraDefines.h"
-#include "SpellAuraEffects.h"
-#include "SpellMgr.h"
-#include "Spell.h"
+#include "Battleground.h"
#include "ConditionMgr.h"
+#include "Corpse.h"
#include "GameTables.h"
+#include "InstanceScript.h"
+#include "Log.h"
+#include "ObjectAccessor.h"
+#include "Pet.h"
#include "Player.h"
-#include "Battleground.h"
+#include "Random.h"
+#include "Spell.h"
+#include "SpellAuraEffects.h"
+#include "SpellMgr.h"
#include "Vehicle.h"
-#include "Pet.h"
-#include "InstanceScript.h"
uint32 GetTargetFlagMask(SpellTargetObjectTypes objType)
{
@@ -2570,9 +2572,9 @@ uint32 SpellInfo::GetRecoveryTime() const
return RecoveryTime > CategoryRecoveryTime ? RecoveryTime : CategoryRecoveryTime;
}
-std::vector<SpellInfo::CostData> SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask) const
+std::vector<SpellPowerCost> SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask) const
{
- std::vector<CostData> costs;
+ std::vector<SpellPowerCost> costs;
auto collector = [this, caster, schoolMask, &costs](std::vector<SpellPowerEntry const*> const& powers)
{
costs.reserve(powers.size());
@@ -2596,7 +2598,7 @@ std::vector<SpellInfo::CostData> SpellInfo::CalcPowerCost(Unit const* caster, Sp
// Else drain all power
if (power->PowerType < MAX_POWERS)
{
- CostData cost;
+ SpellPowerCost cost;
cost.Power = Powers(power->PowerType);
cost.Amount = caster->GetPower(cost.Power);
costs.push_back(cost);
@@ -2713,7 +2715,7 @@ std::vector<SpellInfo::CostData> SpellInfo::CalcPowerCost(Unit const* caster, Sp
}
bool found = false;
- for (CostData& cost : costs)
+ for (SpellPowerCost& cost : costs)
{
if (cost.Power == Powers(power->PowerType))
{
@@ -2724,7 +2726,7 @@ std::vector<SpellInfo::CostData> SpellInfo::CalcPowerCost(Unit const* caster, Sp
if (!found)
{
- CostData cost;
+ SpellPowerCost cost;
cost.Power = Powers(power->PowerType);
cost.Amount = powerCost;
costs.push_back(cost);
@@ -2733,7 +2735,7 @@ std::vector<SpellInfo::CostData> SpellInfo::CalcPowerCost(Unit const* caster, Sp
if (healthCost > 0)
{
- CostData cost;
+ SpellPowerCost cost;
cost.Power = POWER_HEALTH;
cost.Amount = healthCost;
costs.push_back(cost);
@@ -2746,7 +2748,7 @@ std::vector<SpellInfo::CostData> SpellInfo::CalcPowerCost(Unit const* caster, Sp
collector(sDB2Manager.GetSpellPowers(Id, caster->GetMap()->GetDifficultyID()));
// POWER_RUNES is handled by SpellRuneCost.db2, and cost.Amount is always 0 (see Spell::TakeRunePower)
- costs.erase(std::remove_if(costs.begin(), costs.end(), [](CostData const& cost) { return cost.Power != POWER_RUNES && cost.Amount <= 0; }), costs.end());
+ costs.erase(std::remove_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power != POWER_RUNES && cost.Amount <= 0; }), costs.end());
return costs;
}
diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h
index 752cd908eea..818b7d5e901 100644
--- a/src/server/game/Spells/SpellInfo.h
+++ b/src/server/game/Spells/SpellInfo.h
@@ -36,7 +36,7 @@ struct SpellModifier;
struct SpellTargetPosition;
struct Condition;
-enum SpellCastTargetFlags
+enum SpellCastTargetFlags : uint32
{
TARGET_FLAG_NONE = 0x00000000,
TARGET_FLAG_UNUSED_1 = 0x00000001, // not used
@@ -93,7 +93,7 @@ enum SpellTargetReferenceTypes
TARGET_REFERENCE_TYPE_DEST
};
-enum SpellTargetObjectTypes
+enum SpellTargetObjectTypes : uint8
{
TARGET_OBJECT_TYPE_NONE = 0,
TARGET_OBJECT_TYPE_SRC,
@@ -109,7 +109,7 @@ enum SpellTargetObjectTypes
TARGET_OBJECT_TYPE_CORPSE_ALLY
};
-enum SpellTargetCheckTypes
+enum SpellTargetCheckTypes : uint8
{
TARGET_CHECK_DEFAULT,
TARGET_CHECK_ENTRY,
@@ -320,6 +320,12 @@ typedef std::vector<AuraEffect*> AuraEffectVector;
struct SpellInfoLoadHelper;
+struct SpellPowerCost
+{
+ Powers Power;
+ int32 Amount;
+};
+
class TC_GAME_API SpellInfo
{
public:
@@ -513,13 +519,7 @@ public:
uint32 CalcCastTime(uint8 level = 0, Spell* spell = NULL) const;
uint32 GetRecoveryTime() const;
- struct CostData
- {
- Powers Power;
- int32 Amount;
- };
-
- std::vector<CostData> CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask) const;
+ std::vector<SpellPowerCost> CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask) const;
float CalcProcPPM(Unit* caster, int32 itemLevel) const;
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 207cad78266..10d81a32776 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1648,6 +1648,9 @@ void World::SetInitialWorldSettings()
TC_LOG_INFO("server.loading", "Loading Transport templates...");
sTransportMgr->LoadTransportTemplates();
+ TC_LOG_INFO("server.loading", "Loading Transport animations and rotations...");
+ sTransportMgr->LoadTransportAnimationAndRotation();
+
TC_LOG_INFO("server.loading", "Loading Spell Rank Data...");
sSpellMgr->LoadSpellRanks();
diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp
index 02765540582..e02101aa010 100644
--- a/src/server/scripts/Commands/cs_guild.cpp
+++ b/src/server/scripts/Commands/cs_guild.cpp
@@ -30,6 +30,7 @@ EndScriptData */
#include "GuildMgr.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
+#include "Player.h"
#include "RBAC.h"
#include <iomanip>
diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp
index c5743f29424..1c584d79668 100644
--- a/src/server/scripts/Commands/cs_instance.cpp
+++ b/src/server/scripts/Commands/cs_instance.cpp
@@ -29,6 +29,8 @@ EndScriptData */
#include "InstanceScript.h"
#include "Language.h"
#include "MapManager.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
#include "Player.h"
#include "RBAC.h"
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 35fe2ed5e89..7a7d2cd2951 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -34,6 +34,7 @@
#include "MMapFactory.h"
#include "MovementGenerator.h"
#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Pet.h"
#include "Player.h"
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index 9246eb4b532..a430f901bb3 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -25,6 +25,7 @@ EndScriptData */
#include "ScriptMgr.h"
#include "Chat.h"
#include "Log.h"
+#include "ObjectMgr.h"
#include "Pet.h"
#include "Player.h"
#include "RBAC.h"
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index 0008c41b1bf..0773a2c39f3 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -309,8 +309,8 @@ public:
GetTarget()->CastCustomSpell(GetTarget(), SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, nullptr, nullptr, true, nullptr, aurEff, GetCasterGUID());
// restore mana
- std::vector<SpellInfo::CostData> costs = GetSpellInfo()->CalcPowerCost(caster, GetSpellInfo()->GetSchoolMask());
- auto m = std::find_if(costs.begin(), costs.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_MANA; });
+ std::vector<SpellPowerCost> costs = GetSpellInfo()->CalcPowerCost(caster, GetSpellInfo()->GetSchoolMask());
+ auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_MANA; });
if (m != costs.end())
{
int32 returnMana = m->Amount * stack / 2;
@@ -337,8 +337,8 @@ public:
target->CastCustomSpell(target, SPELL_DRUID_LIFEBLOOM_FINAL_HEAL, &healAmount, nullptr, nullptr, true, nullptr, nullptr, GetCasterGUID());
// restore mana
- std::vector<SpellInfo::CostData> costs = GetSpellInfo()->CalcPowerCost(caster, GetSpellInfo()->GetSchoolMask());
- auto m = std::find_if(costs.begin(), costs.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_MANA; });
+ std::vector<SpellPowerCost> costs = GetSpellInfo()->CalcPowerCost(caster, GetSpellInfo()->GetSchoolMask());
+ auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_MANA; });
if (m != costs.end())
{
int32 returnMana = m->Amount * dispelInfo->GetRemovedCharges() / 2;
@@ -929,8 +929,8 @@ class spell_dru_t3_8p_bonus : public SpellScriptLoader
return;
Unit* caster = eventInfo.GetActor();
- std::vector<SpellInfo::CostData> costs = spellInfo->CalcPowerCost(caster, spellInfo->GetSchoolMask());
- auto m = std::find_if(costs.begin(), costs.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_MANA; });
+ std::vector<SpellPowerCost> costs = spellInfo->CalcPowerCost(caster, spellInfo->GetSchoolMask());
+ auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_MANA; });
if (m == costs.end())
return;
diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp
index c04559b15c5..f36a3ff38d8 100644
--- a/src/server/scripts/Spells/spell_item.cpp
+++ b/src/server/scripts/Spells/spell_item.cpp
@@ -1561,8 +1561,8 @@ class spell_item_pendant_of_the_violet_eye : public SpellScriptLoader
{
if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo())
{
- std::vector<SpellInfo::CostData> costs = spellInfo->CalcPowerCost(GetTarget(), spellInfo->GetSchoolMask());
- auto m = std::find_if(costs.begin(), costs.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_MANA && cost.Amount > 0; });
+ std::vector<SpellPowerCost> costs = spellInfo->CalcPowerCost(GetTarget(), spellInfo->GetSchoolMask());
+ auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_MANA && cost.Amount > 0; });
if (m != costs.end())
return true;
}
diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp
index 11544843686..474ec9371ee 100644
--- a/src/server/scripts/Spells/spell_mage.cpp
+++ b/src/server/scripts/Spells/spell_mage.cpp
@@ -615,8 +615,8 @@ class spell_mage_master_of_elements : public SpellScriptLoader
{
PreventDefaultAction();
- std::vector<SpellInfo::CostData> costs = eventInfo.GetDamageInfo()->GetSpellInfo()->CalcPowerCost(GetTarget(), eventInfo.GetDamageInfo()->GetSchoolMask());
- auto m = std::find_if(costs.begin(), costs.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_MANA; });
+ std::vector<SpellPowerCost> costs = eventInfo.GetDamageInfo()->GetSpellInfo()->CalcPowerCost(GetTarget(), eventInfo.GetDamageInfo()->GetSchoolMask());
+ auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_MANA; });
if (m != costs.end())
{
int32 mana = CalculatePct(m->Amount, aurEff->GetAmount());
diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp
index 7e40ec29f67..24b7cccace9 100644
--- a/src/server/scripts/Spells/spell_shaman.cpp
+++ b/src/server/scripts/Spells/spell_shaman.cpp
@@ -677,8 +677,8 @@ class spell_sha_item_mana_surge : public SpellScriptLoader
if (!spellInfo)
return;
- std::vector<SpellInfo::CostData> costs = eventInfo.GetDamageInfo()->GetSpellInfo()->CalcPowerCost(GetTarget(), eventInfo.GetDamageInfo()->GetSchoolMask());
- auto m = std::find_if(costs.begin(), costs.end(), [](SpellInfo::CostData const& cost) { return cost.Power == POWER_MANA; });
+ std::vector<SpellPowerCost> costs = eventInfo.GetDamageInfo()->GetSpellInfo()->CalcPowerCost(GetTarget(), eventInfo.GetDamageInfo()->GetSchoolMask());
+ auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_MANA; });
if (m != costs.end())
{
int32 mana = CalculatePct(m->Amount, 35);
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp
index 363e3a8ce64..a8d7fac0260 100644
--- a/src/server/worldserver/Main.cpp
+++ b/src/server/worldserver/Main.cpp
@@ -282,6 +282,7 @@ extern int main(int argc, char** argv)
// Launch the worldserver listener socket
uint16 worldPort = uint16(sWorld->getIntConfig(CONFIG_PORT_WORLD));
+ uint16 instancePort = uint16(sWorld->getIntConfig(CONFIG_PORT_INSTANCE));
std::string worldListener = sConfigMgr->GetStringDefault("BindIP", "0.0.0.0");
int networkThreads = sConfigMgr->GetIntDefault("Network.Threads", 1);
@@ -292,7 +293,7 @@ extern int main(int argc, char** argv)
return 1;
}
- if (!sWorldSocketMgr.StartNetwork(*ioService, worldListener, worldPort, networkThreads))
+ if (!sWorldSocketMgr.StartWorldNetwork(*ioService, worldListener, worldPort, instancePort, networkThreads))
{
TC_LOG_ERROR("server.worldserver", "Failed to initialize network");
return 1;