aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2017-06-04 01:00:45 +0200
committerShauren <shauren.trinity@gmail.com>2017-06-04 01:00:45 +0200
commitb453e124231a90321fe79fbf3a62acdcfa54a691 (patch)
treeca2a815b923080385ed9a3a69aefe20ee54a7969 /src/server/game
parentec72a59b08e71ebc7ba00b32592ec903a7995a84 (diff)
Core/Game: Include cleanup part 5
* ObjectMgr.h * Player.h * Unit.h * G3D should no longer propagate everywhere from Spline/MotionMaster
Diffstat (limited to 'src/server/game')
-rw-r--r--src/server/game/AI/CoreAI/CombatAI.cpp1
-rw-r--r--src/server/game/AI/CoreAI/GuardAI.cpp1
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp1
-rw-r--r--src/server/game/AI/CoreAI/UnitAI.cpp11
-rw-r--r--src/server/game/AI/CreatureAI.cpp2
-rw-r--r--src/server/game/AI/PlayerAI/PlayerAI.cpp4
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp6
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp2
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp4
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp2
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp19
-rw-r--r--src/server/game/AI/SmartScripts/SmartScriptMgr.cpp6
-rw-r--r--src/server/game/Achievements/AchievementMgr.cpp11
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp5
-rw-r--r--src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp9
-rw-r--r--src/server/game/BattlePets/BattlePetMgr.cpp2
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp3
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldTB.cpp7
-rw-r--r--src/server/game/Battlefield/Zones/BattlefieldWG.cpp7
-rw-r--r--src/server/game/Battlegrounds/Arena.cpp1
-rw-r--r--src/server/game/Battlegrounds/ArenaTeam.cpp1
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp17
-rw-r--r--src/server/game/Battlegrounds/BattlegroundMgr.cpp3
-rw-r--r--src/server/game/Battlegrounds/BattlegroundQueue.cpp1
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp3
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp3
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp2
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp2
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp5
-rw-r--r--src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp2
-rw-r--r--src/server/game/BlackMarket/BlackMarketMgr.cpp2
-rw-r--r--src/server/game/Chat/Channels/Channel.cpp2
-rw-r--r--src/server/game/Chat/Channels/ChannelMgr.cpp4
-rw-r--r--src/server/game/Chat/Chat.cpp2
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp4
-rw-r--r--src/server/game/Conditions/DisableMgr.cpp1
-rw-r--r--src/server/game/DataStores/DB2Structure.h4
-rw-r--r--src/server/game/DataStores/DBCEnums.h14
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp3
-rw-r--r--src/server/game/DungeonFinding/LFGScripts.cpp11
-rw-r--r--src/server/game/Entities/AreaTrigger/AreaTrigger.cpp67
-rw-r--r--src/server/game/Entities/AreaTrigger/AreaTrigger.h24
-rw-r--r--src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.cpp5
-rw-r--r--src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.h13
-rw-r--r--src/server/game/Entities/Corpse/Corpse.cpp2
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp39
-rw-r--r--src/server/game/Entities/Creature/Creature.h634
-rw-r--r--src/server/game/Entities/Creature/CreatureData.h633
-rw-r--r--src/server/game/Entities/Creature/CreatureGroups.cpp2
-rw-r--r--src/server/game/Entities/Creature/GossipDef.cpp6
-rw-r--r--src/server/game/Entities/Creature/TemporarySummon.cpp9
-rw-r--r--src/server/game/Entities/Creature/TemporarySummon.h16
-rw-r--r--src/server/game/Entities/DynamicObject/DynamicObject.cpp15
-rw-r--r--src/server/game/Entities/DynamicObject/DynamicObject.h1
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp13
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h870
-rw-r--r--src/server/game/Entities/GameObject/GameObjectData.h873
-rw-r--r--src/server/game/Entities/Item/Container/Bag.h1
-rw-r--r--src/server/game/Entities/Item/Item.cpp36
-rw-r--r--src/server/game/Entities/Item/Item.h203
-rw-r--r--src/server/game/Entities/Item/ItemDefines.h213
-rw-r--r--src/server/game/Entities/Item/ItemTemplate.h12
-rw-r--r--src/server/game/Entities/Object/Object.cpp63
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp4
-rw-r--r--src/server/game/Entities/Player/CinematicMgr.cpp3
-rw-r--r--src/server/game/Entities/Player/KillRewarder.cpp3
-rw-r--r--src/server/game/Entities/Player/Player.cpp93
-rw-r--r--src/server/game/Entities/Player/Player.h129
-rw-r--r--src/server/game/Entities/Player/PlayerTaxi.cpp5
-rw-r--r--src/server/game/Entities/Player/PlayerTaxi.h15
-rw-r--r--src/server/game/Entities/Player/SceneMgr.cpp5
-rw-r--r--src/server/game/Entities/Player/TradeData.cpp2
-rw-r--r--src/server/game/Entities/Totem/Totem.cpp2
-rw-r--r--src/server/game/Entities/Unit/StatSystem.cpp5
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp8
-rw-r--r--src/server/game/Entities/Unit/Unit.h63
-rw-r--r--src/server/game/Entities/Unit/UnitDefines.h29
-rw-r--r--src/server/game/Entities/Vehicle/Vehicle.cpp18
-rw-r--r--src/server/game/Events/GameEventMgr.cpp17
-rw-r--r--src/server/game/Globals/AreaTriggerDataStore.cpp15
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp4
-rw-r--r--src/server/game/Globals/ObjectMgr.h90
-rw-r--r--src/server/game/Grids/GridStates.cpp5
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiers.h9
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiersImpl.h8
-rw-r--r--src/server/game/Groups/Group.cpp33
-rw-r--r--src/server/game/Groups/Group.h4
-rw-r--r--src/server/game/Guilds/Guild.cpp4
-rw-r--r--src/server/game/Guilds/GuildFinderMgr.cpp3
-rw-r--r--src/server/game/Guilds/GuildMgr.cpp2
-rw-r--r--src/server/game/Handlers/ArtifactHandler.cpp2
-rw-r--r--src/server/game/Handlers/AuctionHouseHandler.cpp4
-rw-r--r--src/server/game/Handlers/BankHandler.cpp2
-rw-r--r--src/server/game/Handlers/BattleGroundHandler.cpp36
-rw-r--r--src/server/game/Handlers/BlackMarketHandler.cpp1
-rw-r--r--src/server/game/Handlers/ChannelHandler.cpp1
-rw-r--r--src/server/game/Handlers/CharacterHandler.cpp7
-rw-r--r--src/server/game/Handlers/ChatHandler.cpp23
-rw-r--r--src/server/game/Handlers/CombatHandler.cpp10
-rw-r--r--src/server/game/Handlers/GroupHandler.cpp2
-rw-r--r--src/server/game/Handlers/ItemHandler.cpp5
-rw-r--r--src/server/game/Handlers/LFGHandler.cpp1
-rw-r--r--src/server/game/Handlers/LootHandler.cpp6
-rw-r--r--src/server/game/Handlers/MailHandler.cpp2
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp4
-rw-r--r--src/server/game/Handlers/NPCHandler.cpp4
-rw-r--r--src/server/game/Handlers/PetHandler.cpp1
-rw-r--r--src/server/game/Handlers/PetitionsHandler.cpp2
-rw-r--r--src/server/game/Handlers/QueryHandler.cpp8
-rw-r--r--src/server/game/Handlers/QuestHandler.cpp3
-rw-r--r--src/server/game/Handlers/ReferAFriendHandler.cpp2
-rw-r--r--src/server/game/Handlers/SkillHandler.cpp8
-rw-r--r--src/server/game/Handlers/SocialHandler.cpp1
-rw-r--r--src/server/game/Handlers/SpellHandler.cpp4
-rw-r--r--src/server/game/Handlers/TaxiHandler.cpp12
-rw-r--r--src/server/game/Handlers/ToyHandler.cpp1
-rw-r--r--src/server/game/Handlers/TradeHandler.cpp2
-rw-r--r--src/server/game/Handlers/TransmogrificationHandler.cpp2
-rw-r--r--src/server/game/Handlers/VehicleHandler.cpp6
-rw-r--r--src/server/game/Handlers/VoidStorageHandler.cpp11
-rw-r--r--src/server/game/Instances/InstanceSaveMgr.cpp1
-rw-r--r--src/server/game/Instances/InstanceScript.cpp1
-rw-r--r--src/server/game/Loot/Loot.cpp1
-rw-r--r--src/server/game/Loot/Loot.h2
-rw-r--r--src/server/game/Mails/Mail.cpp1
-rw-r--r--src/server/game/Maps/Map.cpp3
-rw-r--r--src/server/game/Maps/Map.h12
-rw-r--r--src/server/game/Maps/MapInstanced.cpp1
-rw-r--r--src/server/game/Maps/MapReference.cpp39
-rw-r--r--src/server/game/Maps/MapReference.h23
-rw-r--r--src/server/game/Maps/MapScripts.cpp2
-rw-r--r--src/server/game/Maps/TransportMgr.cpp2
-rw-r--r--src/server/game/Miscellaneous/Formulas.h11
-rw-r--r--src/server/game/Movement/MotionMaster.cpp12
-rw-r--r--src/server/game/Movement/MotionMaster.h4
-rw-r--r--src/server/game/Movement/MovementGenerators/SplineChainMovementGenerator.h4
-rw-r--r--src/server/game/Movement/PathGenerator.h1
-rw-r--r--src/server/game/Movement/Spline/MoveSpline.cpp8
-rw-r--r--src/server/game/Movement/Spline/MoveSpline.h1
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.cpp31
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.h28
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInitArgs.h14
-rw-r--r--src/server/game/Movement/Spline/Spline.h1
-rw-r--r--src/server/game/Movement/Spline/SplineChain.h6
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvP.cpp3
-rw-r--r--src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp1
-rw-r--r--src/server/game/Pools/PoolMgr.cpp2
-rw-r--r--src/server/game/Quests/QuestDef.cpp3
-rw-r--r--src/server/game/Reputation/ReputationMgr.cpp1
-rw-r--r--src/server/game/Scenarios/InstanceScenario.cpp2
-rw-r--r--src/server/game/Scenarios/Scenario.cpp1
-rw-r--r--src/server/game/Scripting/ScriptMgr.cpp1
-rw-r--r--src/server/game/Scripting/ScriptSystem.cpp23
-rw-r--r--src/server/game/Scripting/ScriptSystem.h21
-rw-r--r--src/server/game/Server/Packets/CharacterPackets.cpp1
-rw-r--r--src/server/game/Server/Packets/ChatPackets.cpp3
-rw-r--r--src/server/game/Server/Packets/ItemPackets.cpp4
-rw-r--r--src/server/game/Server/Packets/ItemPackets.h7
-rw-r--r--src/server/game/Server/Packets/MailPackets.cpp3
-rw-r--r--src/server/game/Server/Packets/MovementPackets.cpp8
-rw-r--r--src/server/game/Server/Packets/MovementPackets.h3
-rw-r--r--src/server/game/Server/Packets/PartyPackets.cpp1
-rw-r--r--src/server/game/Server/Packets/QueryPackets.cpp3
-rw-r--r--src/server/game/Server/WorldSession.cpp1
-rw-r--r--src/server/game/Skills/SkillExtraItems.cpp4
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp8
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp23
-rw-r--r--src/server/game/Spells/Spell.cpp57
-rw-r--r--src/server/game/Spells/SpellEffects.cpp30
-rw-r--r--src/server/game/Spells/SpellHistory.cpp3
-rw-r--r--src/server/game/Spells/SpellInfo.cpp4
-rw-r--r--src/server/game/Spells/SpellMgr.cpp2
-rw-r--r--src/server/game/Texts/CreatureTextMgr.cpp34
-rw-r--r--src/server/game/Texts/CreatureTextMgr.h162
-rw-r--r--src/server/game/Texts/CreatureTextMgrImpl.h166
-rw-r--r--src/server/game/World/World.cpp2
176 files changed, 2952 insertions, 2535 deletions
diff --git a/src/server/game/AI/CoreAI/CombatAI.cpp b/src/server/game/AI/CoreAI/CombatAI.cpp
index 88ef940ace3..da414114239 100644
--- a/src/server/game/AI/CoreAI/CombatAI.cpp
+++ b/src/server/game/AI/CoreAI/CombatAI.cpp
@@ -21,6 +21,7 @@
#include "Creature.h"
#include "CreatureAIImpl.h"
#include "Log.h"
+#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "SpellInfo.h"
diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp
index 399f9b8a514..a71af8a88fe 100644
--- a/src/server/game/AI/CoreAI/GuardAI.cpp
+++ b/src/server/game/AI/CoreAI/GuardAI.cpp
@@ -20,6 +20,7 @@
#include "Creature.h"
#include "Errors.h"
#include "Log.h"
+#include "MotionMaster.h"
#include "Player.h"
GuardAI::GuardAI(Creature* creature) : ScriptedAI(creature)
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index 413e5555e45..2dc5e03e6e5 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -21,6 +21,7 @@
#include "Errors.h"
#include "Group.h"
#include "Log.h"
+#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "Pet.h"
#include "Player.h"
diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp
index 4507d064bea..7469152f2bb 100644
--- a/src/server/game/AI/CoreAI/UnitAI.cpp
+++ b/src/server/game/AI/CoreAI/UnitAI.cpp
@@ -17,14 +17,15 @@
*/
#include "UnitAI.h"
-#include "Player.h"
#include "Creature.h"
-#include "SpellAuras.h"
+#include "CreatureAIImpl.h"
+#include "MotionMaster.h"
+#include "Player.h"
+#include "Spell.h"
#include "SpellAuraEffects.h"
-#include "SpellMgr.h"
+#include "SpellAuras.h"
#include "SpellInfo.h"
-#include "Spell.h"
-#include "CreatureAIImpl.h"
+#include "SpellMgr.h"
void UnitAI::AttackStart(Unit* victim)
{
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp
index 2dd54975ba6..42dfa052eef 100644
--- a/src/server/game/AI/CreatureAI.cpp
+++ b/src/server/game/AI/CreatureAI.cpp
@@ -23,7 +23,9 @@
#include "CreatureTextMgr.h"
#include "Language.h"
#include "Log.h"
+#include "Map.h"
#include "MapReference.h"
+#include "MotionMaster.h"
#include "Player.h"
#include "SpellMgr.h"
#include "TemporarySummon.h"
diff --git a/src/server/game/AI/PlayerAI/PlayerAI.cpp b/src/server/game/AI/PlayerAI/PlayerAI.cpp
index d670df82528..f3c4b36dccf 100644
--- a/src/server/game/AI/PlayerAI/PlayerAI.cpp
+++ b/src/server/game/AI/PlayerAI/PlayerAI.cpp
@@ -17,11 +17,15 @@
#include "PlayerAI.h"
#include "Creature.h"
+#include "Item.h"
+#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "Spell.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
+#include "SpellHistory.h"
+#include "SpellMgr.h"
enum Spells
{
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index f9334bf9710..a7af9dd0011 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -18,14 +18,18 @@
#include "ScriptedCreature.h"
#include "AreaBoundary.h"
+#include "DB2Stores.h"
#include "Cell.h"
#include "CellImpl.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "InstanceScript.h"
#include "Log.h"
-#include "ObjectMgr.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "Spell.h"
+#include "SpellMgr.h"
+#include "TemporarySummon.h"
// Spell summary for ScriptedAI::SelectSpell
struct TSpellSummary
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index e0de158831c..8f75faf6350 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -27,6 +27,8 @@ EndScriptData */
#include "Creature.h"
#include "Group.h"
#include "Log.h"
+#include "Map.h"
+#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "Player.h"
diff --git a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
index 7a1bcb14680..746154dab53 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp
@@ -25,8 +25,10 @@ EndScriptData */
#include "ScriptedFollowerAI.h"
#include "Creature.h"
-#include "Log.h"
#include "Group.h"
+#include "Log.h"
+#include "Map.h"
+#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "Player.h"
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 18ea269fbb0..6bf18bea890 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -16,10 +16,12 @@
*/
#include "SmartAI.h"
+#include "DB2Structure.h"
#include "Creature.h"
#include "GameObject.h"
#include "Group.h"
#include "Log.h"
+#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "PetDefines.h"
#include "Player.h"
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 0280af9498e..6b160a45d30 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -20,21 +20,26 @@
#include "ChatTextBuilder.h"
#include "Creature.h"
#include "CreatureTextMgr.h"
+#include "CreatureTextMgrImpl.h"
+#include "DB2Stores.h"
#include "GameEventMgr.h"
#include "GameObject.h"
#include "GossipDef.h"
#include "GridNotifiersImpl.h"
+#include "Group.h"
#include "InstanceScript.h"
#include "Language.h"
#include "Log.h"
#include "Map.h"
+#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Random.h"
#include "SmartAI.h"
#include "SpellAuras.h"
+#include "SpellMgr.h"
+#include "TemporarySummon.h"
#include "Vehicle.h"
-#include <G3D/Quat.h>
SmartScript::SmartScript()
{
@@ -1447,8 +1452,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
continue;
Position pos = (*itr)->GetPositionWithOffset(Position(e.target.x, e.target.y, e.target.z, e.target.o));
- G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(pos.GetOrientation(), 0.f, 0.f);
- summoner->SummonGameObject(e.action.summonGO.entry, pos, QuaternionData(rot.x, rot.y, rot.z, rot.w), e.action.summonGO.despawnTime);
+ summoner->SummonGameObject(e.action.summonGO.entry, pos, QuaternionData::fromEulerAnglesZYX(pos.GetOrientation(), 0.f, 0.f), e.action.summonGO.despawnTime);
}
delete targets;
@@ -1457,8 +1461,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (e.GetTargetType() != SMART_TARGET_POSITION)
break;
- G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(e.target.o, 0.f, 0.f);
- summoner->SummonGameObject(e.action.summonGO.entry, Position(e.target.x, e.target.y, e.target.z, e.target.o), QuaternionData(rot.x, rot.y, rot.z, rot.w), e.action.summonGO.despawnTime);
+ summoner->SummonGameObject(e.action.summonGO.entry, Position(e.target.x, e.target.y, e.target.z, e.target.o), QuaternionData::fromEulerAnglesZYX(e.target.o, 0.f, 0.f), e.action.summonGO.despawnTime);
break;
}
case SMART_ACTION_KILL_UNIT:
@@ -1700,12 +1703,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!target)
{
- G3D::Vector3 dest(e.target.x, e.target.y, e.target.z);
+ Position dest(e.target.x, e.target.y, e.target.z);
if (e.action.MoveToPos.transport)
if (TransportBase* trans = me->GetDirectTransport())
- trans->CalculatePassengerPosition(dest.x, dest.y, dest.z);
+ trans->CalculatePassengerPosition(dest.m_positionX, dest.m_positionY, dest.m_positionZ);
- me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, dest.x, dest.y, dest.z, e.action.MoveToPos.disablePathfinding == 0);
+ me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, dest, e.action.MoveToPos.disablePathfinding == 0);
}
else
me->GetMotionMaster()->MovePoint(e.action.MoveToPos.pointId, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), e.action.MoveToPos.disablePathfinding == 0);
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
index e20c512b93c..bb4eec88183 100644
--- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp
@@ -16,14 +16,20 @@
*/
#include "SmartScriptMgr.h"
+#include "DB2Stores.h"
#include "CreatureTextMgr.h"
#include "DatabaseEnv.h"
#include "GameEventMgr.h"
#include "InstanceScript.h"
#include "Log.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
+#include "Timer.h"
+#include "UnitDefines.h"
+#include <algorithm>
SmartWaypointMgr* SmartWaypointMgr::instance()
{
diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp
index da219cd4798..79b7728d406 100644
--- a/src/server/game/Achievements/AchievementMgr.cpp
+++ b/src/server/game/Achievements/AchievementMgr.cpp
@@ -18,6 +18,7 @@
#include "AchievementMgr.h"
#include "AchievementPackets.h"
+#include "DB2Stores.h"
#include "CellImpl.h"
#include "ChatTextBuilder.h"
#include "DatabaseEnv.h"
@@ -25,11 +26,13 @@
#include "Group.h"
#include "Guild.h"
#include "GuildMgr.h"
+#include "Item.h"
#include "Language.h"
#include "Log.h"
#include "Mail.h"
#include "ObjectMgr.h"
#include "World.h"
+#include "WorldSession.h"
struct VisibleAchievementCheck
{
@@ -448,7 +451,7 @@ void PlayerAchievementMgr::SendAchievementInfo(Player* receiver, uint32 /*achiev
inspectedAchievements.Data.Progress.push_back(progress);
}
- receiver->GetSession()->SendPacket(inspectedAchievements.Write());
+ receiver->SendDirectMessage(inspectedAchievements.Write());
}
void PlayerAchievementMgr::CompletedAchievement(AchievementEntry const* achievement, Player* referencePlayer)
@@ -795,7 +798,7 @@ void GuildAchievementMgr::SendAllData(Player const* receiver) const
allGuildAchievements.Earned.push_back(earned);
}
- receiver->GetSession()->SendPacket(allGuildAchievements.Write());
+ receiver->SendDirectMessage(allGuildAchievements.Write());
}
void GuildAchievementMgr::SendAchievementInfo(Player* receiver, uint32 achievementId /*= 0*/) const
@@ -828,7 +831,7 @@ void GuildAchievementMgr::SendAchievementInfo(Player* receiver, uint32 achieveme
}
}
- receiver->GetSession()->SendPacket(guildCriteriaUpdate.Write());
+ receiver->SendDirectMessage(guildCriteriaUpdate.Write());
}
void GuildAchievementMgr::SendAllTrackedCriterias(Player* receiver, std::set<uint32> const& trackedCriterias) const
@@ -854,7 +857,7 @@ void GuildAchievementMgr::SendAllTrackedCriterias(Player* receiver, std::set<uin
guildCriteriaUpdate.Progress.push_back(guildCriteriaProgress);
}
- receiver->GetSession()->SendPacket(guildCriteriaUpdate.Write());
+ receiver->SendDirectMessage(guildCriteriaUpdate.Write());
}
void GuildAchievementMgr::SendAchievementMembers(Player* receiver, uint32 achievementId) const
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 3fb1b7ca7af..02c9224e4ea 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -19,11 +19,14 @@
#include "AuctionHouseMgr.h"
#include "AuctionHousePackets.h"
#include "AccountMgr.h"
+#include "Bag.h"
+#include "DB2Stores.h"
#include "Common.h"
#include "DatabaseEnv.h"
-#include "Item.h"
#include "Language.h"
#include "Log.h"
+#include "Mail.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "Realm.h"
diff --git a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp
index 3f6e0877353..728a47f301b 100644
--- a/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp
+++ b/src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp
@@ -66,13 +66,10 @@ bool AuctionBotSeller::Initialize()
const CreatureTemplateContainer* creatures = sObjectMgr->GetCreatureTemplates();
std::set<uint32> tempItems;
for (CreatureTemplateContainer::const_iterator it = creatures->begin(); it != creatures->end(); ++it)
- {
if (const VendorItemData* data = sObjectMgr->GetNpcVendorItemList(it->first))
- {
- for (VendorItemList::const_iterator it2 = data->m_items.begin(); it2 != data->m_items.end(); ++it2)
- tempItems.insert((*it2)->item);
- }
- }
+ for (VendorItem const& it2 : data->m_items)
+ tempItems.insert(it2.item);
+
for (uint32 itemId : tempItems)
npcItems.push_back(itemId);
diff --git a/src/server/game/BattlePets/BattlePetMgr.cpp b/src/server/game/BattlePets/BattlePetMgr.cpp
index e1f254daeef..38dcb92158d 100644
--- a/src/server/game/BattlePets/BattlePetMgr.cpp
+++ b/src/server/game/BattlePets/BattlePetMgr.cpp
@@ -16,8 +16,10 @@
*/
#include "BattlePetMgr.h"
+#include "DB2Stores.h"
#include "Containers.h"
#include "DatabaseEnv.h"
+#include "Item.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index f8538ab0a43..a16144ef03f 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -21,6 +21,7 @@
#include "BattlegroundPackets.h"
#include "CellImpl.h"
#include "CreatureTextMgr.h"
+#include "DB2Stores.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
@@ -31,7 +32,9 @@
#include "MiscPackets.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
+#include "WorldSession.h"
#include "WorldStatePackets.h"
+#include <G3D/g3dmath.h>
Battlefield::Battlefield()
{
diff --git a/src/server/game/Battlefield/Zones/BattlefieldTB.cpp b/src/server/game/Battlefield/Zones/BattlefieldTB.cpp
index 60948cec1ab..b067e5dedbb 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldTB.cpp
+++ b/src/server/game/Battlefield/Zones/BattlefieldTB.cpp
@@ -25,12 +25,13 @@
#include "BattlefieldTB.h"
#include "AchievementMgr.h"
-#include "CreatureTextMgr.h"
#include "Battleground.h"
+#include "CreatureTextMgr.h"
+#include "GameObject.h"
#include "MapManager.h"
-#include "ObjectMgr.h"
-#include "Opcodes.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "Random.h"
#include "SpellAuras.h"
#include "TemporarySummon.h"
#include "World.h"
diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
index 180cfe4c3f4..36561498f55 100644
--- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
+++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp
@@ -23,14 +23,17 @@
#include "AchievementMgr.h"
#include "Battleground.h"
#include "CreatureTextMgr.h"
+#include "GameObject.h"
+#include "DB2Stores.h"
#include "Log.h"
#include "MapManager.h"
-#include "ObjectMgr.h"
-#include "Opcodes.h"
+#include "ObjectAccessor.h"
#include "Player.h"
+#include "Random.h"
#include "SpellAuras.h"
#include "TemporarySummon.h"
#include "World.h"
+#include "WorldSession.h"
#include "WorldStatePackets.h"
struct BfWGCoordGY
diff --git a/src/server/game/Battlegrounds/Arena.cpp b/src/server/game/Battlegrounds/Arena.cpp
index 390a2395251..6fc7271d861 100644
--- a/src/server/game/Battlegrounds/Arena.cpp
+++ b/src/server/game/Battlegrounds/Arena.cpp
@@ -22,6 +22,7 @@
#include "Guild.h"
#include "Language.h"
#include "Log.h"
+#include "Map.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "World.h"
diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp
index 68d2a076860..7669cc05f63 100644
--- a/src/server/game/Battlegrounds/ArenaTeam.cpp
+++ b/src/server/game/Battlegrounds/ArenaTeam.cpp
@@ -21,6 +21,7 @@
#include "DatabaseEnv.h"
#include "Group.h"
#include "Log.h"
+#include "Map.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 533577e7c22..79296f43d1c 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -21,6 +21,7 @@
#include "BattlegroundMgr.h"
#include "BattlegroundPackets.h"
#include "BattlegroundScore.h"
+#include "ChatPackets.h"
#include "Creature.h"
#include "CreatureTextMgr.h"
#include "DatabaseEnv.h"
@@ -30,8 +31,9 @@
#include "Guild.h"
#include "GuildMgr.h"
#include "Log.h"
+#include "Map.h"
#include "MiscPackets.h"
-#include "Object.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ReputationMgr.h"
@@ -39,9 +41,8 @@
#include "TemporarySummon.h"
#include "Transport.h"
#include "Util.h"
-#include "WorldPacket.h"
#include "WorldStatePackets.h"
-#include <G3D/Quat.h>
+#include <cstdarg>
namespace Trinity
{
@@ -490,7 +491,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
- player->GetSession()->SendPacket(&data);
+ player->SendDirectMessage(&data);
m_CountdownTimer = 0;
}
@@ -1147,7 +1148,7 @@ void Battleground::AddPlayer(Player* player)
data << uint32(0); // unk
data << uint32(countdownMaxForBGType - (GetElapsedTime() / 1000));
data << uint32(countdownMaxForBGType);
- player->GetSession()->SendPacket(&data);
+ player->SendDirectMessage(&data);
}
}
@@ -1472,11 +1473,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
TC_LOG_DEBUG("bg.battleground", "Battleground::AddObject: gameoobject [entry: %u, object type: %u] for BG (map: %u) has zeroed rotation fields, "
"orientation used temporally, but please fix the spawn", entry, type, m_MapId);
- G3D::Quat fallbackRot = G3D::Matrix3::fromEulerAnglesZYX(o, 0.f, 0.f);
- rot.x = fallbackRot.x;
- rot.y = fallbackRot.y;
- rot.z = fallbackRot.z;
- rot.w = fallbackRot.w;
+ rot = QuaternionData::fromEulerAnglesZYX(o, 0.f, 0.f);
}
// Must be created this way, adding to godatamap would add it to the base map of the instance
diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
index 601191596ac..4be999c7d4a 100644
--- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp
@@ -34,6 +34,7 @@
#include "Common.h"
#include "Containers.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "DisableMgr.h"
#include "GameEventMgr.h"
#include "Log.h"
@@ -619,7 +620,7 @@ void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battlegrou
WorldPackets::Battleground::AreaSpiritHealerTime areaSpiritHealerTime;
areaSpiritHealerTime.HealerGuid = guid;
areaSpiritHealerTime.TimeLeft = time_;
- player->GetSession()->SendPacket(areaSpiritHealerTime.Write());
+ player->SendDirectMessage(areaSpiritHealerTime.Write());
}
bool BattlegroundMgr::IsArenaType(BattlegroundTypeId bgTypeId)
diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
index 12de65a891e..bd0c588c627 100644
--- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp
+++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp
@@ -22,6 +22,7 @@
#include "BattlegroundMgr.h"
#include "BattlegroundPackets.h"
#include "Chat.h"
+#include "DB2Stores.h"
#include "Group.h"
#include "Language.h"
#include "Log.h"
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
index 7251538ff76..6049e877156 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp
@@ -17,12 +17,13 @@
*/
#include "BattlegroundAB.h"
-#include "WorldPacket.h"
#include "BattlegroundMgr.h"
#include "Creature.h"
+#include "DB2Stores.h"
#include "GameObject.h"
#include "Language.h"
#include "Log.h"
+#include "Map.h"
#include "Player.h"
#include "Random.h"
#include "Util.h"
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
index 8b91a4602d8..44730912184 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp
@@ -17,10 +17,13 @@
*/
#include "BattlegroundAV.h"
+#include "Creature.h"
#include "CreatureAI.h"
+#include "DB2Stores.h"
#include "GameObject.h"
#include "Language.h"
#include "Log.h"
+#include "MotionMaster.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "WorldSession.h"
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
index 7eb13c48431..ac43a97f5ff 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp
@@ -20,9 +20,11 @@
#include "BattlegroundMgr.h"
#include "BattlegroundPackets.h"
#include "Creature.h"
+#include "DB2Stores.h"
#include "GameObject.h"
#include "Language.h"
#include "Log.h"
+#include "Map.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "Random.h"
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
index 0a814cd3817..1ff128d7560 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp
@@ -17,9 +17,11 @@
*/
#include "BattlegroundIC.h"
+#include "Creature.h"
#include "GameObject.h"
#include "Language.h"
#include "Log.h"
+#include "Map.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "Transport.h"
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
index 7c0f08378c0..c41c55446ab 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp
@@ -17,11 +17,14 @@
*/
#include "BattlegroundSA.h"
+#include "Creature.h"
#include "CreatureAI.h"
+#include "DB2Stores.h"
#include "GameObject.h"
#include "Language.h"
#include "Log.h"
-#include "ObjectMgr.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "Player.h"
#include "Random.h"
#include "UpdateData.h"
diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
index 458a1e36692..1f160b19653 100644
--- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
+++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp
@@ -19,9 +19,11 @@
#include "BattlegroundWS.h"
#include "BattlegroundMgr.h"
#include "BattlegroundPackets.h"
+#include "DB2Stores.h"
#include "GameObject.h"
#include "Language.h"
#include "Log.h"
+#include "Map.h"
#include "Object.h"
#include "ObjectAccessor.h"
#include "Player.h"
diff --git a/src/server/game/BlackMarket/BlackMarketMgr.cpp b/src/server/game/BlackMarket/BlackMarketMgr.cpp
index 8d1f1588909..d2455778a74 100644
--- a/src/server/game/BlackMarket/BlackMarketMgr.cpp
+++ b/src/server/game/BlackMarket/BlackMarketMgr.cpp
@@ -20,6 +20,7 @@
#include "BlackMarketPackets.h"
#include "Containers.h"
#include "DatabaseEnv.h"
+#include "Item.h"
#include "Language.h"
#include "Log.h"
#include "Mail.h"
@@ -28,6 +29,7 @@
#include "Player.h"
#include "Realm.h"
#include "World.h"
+#include "WorldSession.h"
#include <sstream>
BlackMarketMgr::BlackMarketMgr()
diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp
index f394ac806e4..ed2d68ec440 100644
--- a/src/server/game/Chat/Channels/Channel.cpp
+++ b/src/server/game/Chat/Channels/Channel.cpp
@@ -21,6 +21,7 @@
#include "ChannelAppenders.h"
#include "Chat.h"
#include "ChatPackets.h"
+#include "DB2Stores.h"
#include "DatabaseEnv.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
@@ -31,6 +32,7 @@
#include "Player.h"
#include "SocialMgr.h"
#include "World.h"
+#include "WorldSession.h"
#include <sstream>
Channel::Channel(uint32 channelId, uint32 team /*= 0*/, AreaTableEntry const* zoneEntry /*= nullptr*/) :
diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp
index 0c2f77ff38c..befd8c91e88 100644
--- a/src/server/game/Chat/Channels/ChannelMgr.cpp
+++ b/src/server/game/Chat/Channels/ChannelMgr.cpp
@@ -16,11 +16,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Channel.h"
#include "ChannelMgr.h"
+#include "Channel.h"
#include "ChannelPackets.h"
+#include "DB2Stores.h"
#include "Player.h"
#include "World.h"
+#include "WorldSession.h"
ChannelMgr::~ChannelMgr()
{
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index 9fc51df3ac7..3fb58fe02ea 100644
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -23,12 +23,14 @@
#include "ChatPackets.h"
#include "Common.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "Language.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
+#include "Optional.h"
#include "Player.h"
#include "Realm.h"
#include "ScriptMgr.h"
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index f5d30b835a1..b3503752c5b 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -20,12 +20,15 @@
#include "AchievementMgr.h"
#include "Containers.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "GameEventMgr.h"
#include "GameObject.h"
#include "Group.h"
#include "InstanceScript.h"
+#include "Item.h"
#include "Log.h"
#include "LootMgr.h"
+#include "Map.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "Pet.h"
@@ -34,6 +37,7 @@
#include "SpellAuras.h"
#include "SpellMgr.h"
#include "World.h"
+#include "WorldSession.h"
char const* const ConditionMgr::StaticSourceTypeData[CONDITION_SOURCE_TYPE_MAX] =
{
diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp
index 7cf027d0d85..b2d49867c46 100644
--- a/src/server/game/Conditions/DisableMgr.cpp
+++ b/src/server/game/Conditions/DisableMgr.cpp
@@ -19,6 +19,7 @@
#include "DisableMgr.h"
#include "CriteriaHandler.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "OutdoorPvP.h"
diff --git a/src/server/game/DataStores/DB2Structure.h b/src/server/game/DataStores/DB2Structure.h
index 21fd68677ef..da5b79e7384 100644
--- a/src/server/game/DataStores/DB2Structure.h
+++ b/src/server/game/DataStores/DB2Structure.h
@@ -1517,10 +1517,6 @@ struct ItemSetSpellEntry
uint8 Threshold;
};
-#define MAX_ITEM_PROTO_FLAGS 3
-#define MAX_ITEM_PROTO_SOCKETS 3
-#define MAX_ITEM_PROTO_STATS 10
-
struct ItemSparseEntry
{
uint32 ID;
diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h
index fb67c17926f..2f25f9fde47 100644
--- a/src/server/game/DataStores/DBCEnums.h
+++ b/src/server/game/DataStores/DBCEnums.h
@@ -613,6 +613,10 @@ enum FactionMasks
// if none flags set then non-aggressive creature
};
+#define MAX_ITEM_PROTO_FLAGS 3
+#define MAX_ITEM_PROTO_SOCKETS 3
+#define MAX_ITEM_PROTO_STATS 10
+
enum MapTypes // Lua_IsInInstance
{
MAP_COMMON = 0, // none
@@ -799,6 +803,16 @@ enum SpellCategoryFlags
#define MAX_SPELL_EFFECTS 32
#define MAX_EFFECT_MASK 0xFFFFFFFF
+enum SpellItemEnchantmentFlags
+{
+ ENCHANTMENT_CAN_SOULBOUND = 0x01,
+ ENCHANTMENT_UNK1 = 0x02,
+ ENCHANTMENT_UNK2 = 0x04,
+ ENCHANTMENT_UNK3 = 0x08,
+ ENCHANTMENT_COLLECTABLE = 0x100,
+ ENCHANTMENT_HIDE_IF_NOT_COLLECTED = 0x200,
+};
+
enum SpellProcsPerMinuteModType
{
SPELL_PPM_MOD_HASTE = 1,
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 9e87f6271cb..0b00269ad33 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -17,6 +17,7 @@
#include "LFGMgr.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "DisableMgr.h"
#include "GameEventMgr.h"
#include "Group.h"
@@ -27,6 +28,8 @@
#include "LFGQueue.h"
#include "LFGScripts.h"
#include "Log.h"
+#include "Map.h"
+#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp
index 15c0889b27d..3bd64194885 100644
--- a/src/server/game/DungeonFinding/LFGScripts.cpp
+++ b/src/server/game/DungeonFinding/LFGScripts.cpp
@@ -19,15 +19,16 @@
* Interaction between core and LFGScripts
*/
+#include "LFGScripts.h"
#include "Common.h"
-#include "Log.h"
-#include "SharedDefines.h"
-#include "Player.h"
#include "Group.h"
-#include "LFGScripts.h"
#include "LFGMgr.h"
-#include "ScriptMgr.h"
+#include "Log.h"
+#include "Map.h"
#include "ObjectAccessor.h"
+#include "Player.h"
+#include "ScriptMgr.h"
+#include "SharedDefines.h"
#include "WorldSession.h"
namespace lfg
diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp
index 5106b37cea1..d545cbb003e 100644
--- a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp
+++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp
@@ -31,6 +31,7 @@
#include "Player.h"
#include "ScriptMgr.h"
#include "SpellInfo.h"
+#include "Spline.h"
#include "Transport.h"
#include "Unit.h"
#include "UpdateData.h"
@@ -409,19 +410,17 @@ void AreaTrigger::UpdatePolygonOrientation()
if (G3D::fuzzyEq(_previousCheckOrientation, newOrientation))
return;
- _polygonVertices = GetTemplate()->PolygonVertices;
+ _polygonVertices.assign(GetTemplate()->PolygonVertices.begin(), GetTemplate()->PolygonVertices.end());
float angleSin = std::sin(newOrientation);
float angleCos = std::cos(newOrientation);
// This is needed to rotate the vertices, following orientation
- for (G3D::Vector2& vertice : _polygonVertices)
+ for (Position& vertice : _polygonVertices)
{
- float tempX = vertice.x;
- float tempY = vertice.y;
-
- vertice.x = tempX * angleCos - tempY * angleSin;
- vertice.y = tempX * angleSin + tempY * angleCos;
+ float tempX = vertice.GetPositionX();
+ float tempY = vertice.GetPositionY();
+ vertice.Relocate(tempX * angleCos - tempY * angleSin, tempX * angleSin + tempY * angleCos);
}
_previousCheckOrientation = newOrientation;
@@ -451,10 +450,10 @@ bool AreaTrigger::CheckIsInPolygon2D(Position const* pos) const
nextVertex = vertex + 1;
}
- float vertX_i = GetPositionX() + _polygonVertices[vertex].x;
- float vertY_i = GetPositionY() + _polygonVertices[vertex].y;
- float vertX_j = GetPositionX() + _polygonVertices[nextVertex].x;
- float vertY_j = GetPositionY() + _polygonVertices[nextVertex].y;
+ float vertX_i = GetPositionX() + _polygonVertices[vertex].GetPositionX();
+ float vertY_i = GetPositionY() + _polygonVertices[vertex].GetPositionY();
+ float vertX_j = GetPositionX() + _polygonVertices[nextVertex].GetPositionX();
+ float vertY_j = GetPositionY() + _polygonVertices[nextVertex].GetPositionY();
// following statement checks if testPoint.Y is below Y-coord of i-th vertex
bool belowLowY = vertY_i > testY;
@@ -561,42 +560,45 @@ void AreaTrigger::DoActions(Unit* unit)
void AreaTrigger::UndoActions(Unit* unit)
{
for (AreaTriggerAction const& action : GetTemplate()->Actions)
- {
if (action.ActionType == AREATRIGGER_ACTION_CAST || action.ActionType == AREATRIGGER_ACTION_ADDAURA)
unit->RemoveAurasDueToSpell(action.Param, GetCasterGuid());
- }
}
-void AreaTrigger::InitSplineOffsets(std::vector<G3D::Vector3> splinePoints, uint32 timeToTarget)
+void AreaTrigger::InitSplineOffsets(std::vector<Position> const& splinePoints, uint32 timeToTarget)
{
float angleSin = std::sin(GetOrientation());
float angleCos = std::cos(GetOrientation());
// This is needed to rotate the spline, following caster orientation
- for (G3D::Vector3& spline : splinePoints)
+ std::vector<G3D::Vector3> rotatedPoints;
+ rotatedPoints.reserve(splinePoints.size());
+ for (Position const& spline : splinePoints)
{
- float tempX = spline.x;
- float tempY = spline.y;
+ float tempX = spline.GetPositionX();
+ float tempY = spline.GetPositionY();
float tempZ = GetPositionZ();
- spline.x = (tempX * angleCos - tempY * angleSin) + GetPositionX();
- spline.y = (tempX * angleSin + tempY * angleCos) + GetPositionY();
- UpdateAllowedPositionZ(spline.x, spline.y, tempZ);
- spline.z += tempZ;
+ UpdateAllowedPositionZ(spline.GetPositionX(), spline.GetPositionY(), tempZ);
+ rotatedPoints.emplace_back(
+ (tempX * angleCos - tempY * angleSin) + GetPositionX(),
+ (tempX * angleSin + tempY * angleCos) + GetPositionY(),
+ tempZ
+ );
}
- InitSplines(splinePoints, timeToTarget);
+ InitSplines(std::move(rotatedPoints), timeToTarget);
}
-void AreaTrigger::InitSplines(std::vector<G3D::Vector3> const& splinePoints, uint32 timeToTarget)
+void AreaTrigger::InitSplines(std::vector<G3D::Vector3> splinePoints, uint32 timeToTarget)
{
if (splinePoints.size() < 2)
return;
_movementTime = 0;
- _spline.init_spline(&splinePoints[0], splinePoints.size(), ::Movement::SplineBase::ModeLinear);
- _spline.initLengths();
+ _spline = Trinity::make_unique<::Movement::Spline<int32>>();
+ _spline->init_spline(&splinePoints[0], splinePoints.size(), ::Movement::SplineBase::ModeLinear);
+ _spline->initLengths();
// should be sent in object create packets only
m_uint32Values[AREATRIGGER_TIME_TO_TARGET] = timeToTarget;
@@ -624,6 +626,11 @@ void AreaTrigger::InitSplines(std::vector<G3D::Vector3> const& splinePoints, uin
_reachedDestination = false;
}
+bool AreaTrigger::HasSplines() const
+{
+ return !_spline->empty();
+}
+
void AreaTrigger::UpdateSplinePosition(uint32 diff)
{
if (_reachedDestination)
@@ -637,9 +644,9 @@ void AreaTrigger::UpdateSplinePosition(uint32 diff)
if (_movementTime >= GetTimeToTarget())
{
_reachedDestination = true;
- _lastSplineIndex = int32(_spline.last());
+ _lastSplineIndex = int32(_spline->last());
- G3D::Vector3 lastSplinePosition = _spline.getPoint(_lastSplineIndex);
+ G3D::Vector3 lastSplinePosition = _spline->getPoint(_lastSplineIndex);
GetMap()->AreaTriggerRelocation(this, lastSplinePosition.x, lastSplinePosition.y, lastSplinePosition.z, GetOrientation());
#ifdef TRINITY_DEBUG
DebugVisualizePosition();
@@ -669,15 +676,15 @@ void AreaTrigger::UpdateSplinePosition(uint32 diff)
int lastPositionIndex = 0;
float percentFromLastPoint = 0;
- _spline.computeIndex(currentTimePercent, lastPositionIndex, percentFromLastPoint);
+ _spline->computeIndex(currentTimePercent, lastPositionIndex, percentFromLastPoint);
G3D::Vector3 currentPosition;
- _spline.evaluate_percent(lastPositionIndex, percentFromLastPoint, currentPosition);
+ _spline->evaluate_percent(lastPositionIndex, percentFromLastPoint, currentPosition);
float orientation = GetOrientation();
if (GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_FACE_MOVEMENT_DIR))
{
- G3D::Vector3 const& nextPoint = _spline.getPoint(lastPositionIndex + 1);
+ G3D::Vector3 const& nextPoint = _spline->getPoint(lastPositionIndex + 1);
orientation = GetAngle(nextPoint.x, nextPoint.y);
}
diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.h b/src/server/game/Entities/AreaTrigger/AreaTrigger.h
index f1284754600..d3b92cae0ae 100644
--- a/src/server/game/Entities/AreaTrigger/AreaTrigger.h
+++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.h
@@ -19,7 +19,6 @@
#define TRINITYCORE_AREATRIGGER_H
#include "Object.h"
-#include "Spline.h"
#include "MapObject.h"
class AreaTriggerTemplate;
@@ -31,6 +30,17 @@ class AuraEffect;
struct AreaTriggerPolygonVertice;
+namespace G3D
+{
+ class Vector2;
+ class Vector3;
+}
+namespace Movement
+{
+ template<typename length_type>
+ class Spline;
+}
+
class TC_GAME_API AreaTrigger : public WorldObject, public GridObject<AreaTrigger>, public MapObject
{
public:
@@ -71,10 +81,10 @@ class TC_GAME_API AreaTrigger : public WorldObject, public GridObject<AreaTrigge
Position const& GetRollPitchYaw() const { return _rollPitchYaw; }
Position const& GetTargetRollPitchYaw() const { return _targetRollPitchYaw; }
- void InitSplineOffsets(std::vector<G3D::Vector3> splinePoints, uint32 timeToTarget);
- void InitSplines(std::vector<G3D::Vector3> const& splinePoints, uint32 timeToTarget);
- bool HasSplines() const { return !_spline.empty(); }
- ::Movement::Spline<int32> const& GetSpline() const { return _spline; }
+ void InitSplineOffsets(std::vector<Position> const& splinePoints, uint32 timeToTarget);
+ void InitSplines(std::vector<G3D::Vector3> splinePoints, uint32 timeToTarget);
+ bool HasSplines() const;
+ ::Movement::Spline<int32> const& GetSpline() const { return *_spline; }
uint32 GetElapsedTimeForMovement() const { return GetTimeSinceCreated(); } /// @todo: research the right value, in sniffs both timers are nearly identical
void UpdateShape();
@@ -111,8 +121,8 @@ class TC_GAME_API AreaTrigger : public WorldObject, public GridObject<AreaTrigge
Position _rollPitchYaw;
Position _targetRollPitchYaw;
- std::vector<G3D::Vector2> _polygonVertices;
- ::Movement::Spline<int32> _spline;
+ std::vector<Position> _polygonVertices;
+ std::unique_ptr<::Movement::Spline<int32>> _spline;
bool _reachedDestination;
int32 _lastSplineIndex;
diff --git a/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.cpp b/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.cpp
index 5a34fbcb474..2b3c1cfe19f 100644
--- a/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.cpp
+++ b/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.cpp
@@ -65,9 +65,10 @@ void AreaTriggerTemplate::InitMaxSearchRadius()
if (PolygonDatas.Height <= 0.0f)
PolygonDatas.Height = 1.0f;
- for (G3D::Vector2 const& vertice : PolygonVertices)
+ Position center(0.0f, 0.0f);
+ for (TaggedPosition<Position::XY> const& vertice : PolygonVertices)
{
- float pointDist = vertice.length();
+ float pointDist = center.GetExactDist2d(vertice);
if (pointDist > MaxSearchRadius)
MaxSearchRadius = pointDist;
diff --git a/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.h b/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.h
index 64db8856666..0fa2ce01c54 100644
--- a/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.h
+++ b/src/server/game/Entities/AreaTrigger/AreaTriggerTemplate.h
@@ -19,14 +19,9 @@
#define TRINITYCORE_AREATRIGGER_TEMPLATE_H
#include "Define.h"
+#include "Position.h"
#include <vector>
-namespace G3D
-{
- class Vector2;
- class Vector3;
-}
-
#define MAX_AREATRIGGER_ENTITY_DATA 6
#define MAX_AREATRIGGER_SCALE 7
@@ -117,8 +112,8 @@ public:
uint32 Flags;
uint32 ScriptId;
float MaxSearchRadius;
- std::vector<G3D::Vector2> PolygonVertices;
- std::vector<G3D::Vector2> PolygonVerticesTarget;
+ std::vector<TaggedPosition<Position::XY>> PolygonVertices;
+ std::vector<TaggedPosition<Position::XY>> PolygonVerticesTarget;
std::vector<AreaTriggerAction> Actions;
union
@@ -186,7 +181,7 @@ public:
AreaTriggerScaleInfo ScaleInfo;
AreaTriggerTemplate const* Template;
- std::vector<G3D::Vector3> SplinePoints;
+ std::vector<Position> SplinePoints;
};
#endif
diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp
index 91adaa4ca34..b119dc4283a 100644
--- a/src/server/game/Entities/Corpse/Corpse.cpp
+++ b/src/server/game/Entities/Corpse/Corpse.cpp
@@ -19,7 +19,9 @@
#include "Common.h"
#include "Corpse.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "Log.h"
+#include "Map.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "UpdateData.h"
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index f3b40225078..0396786871c 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -19,6 +19,7 @@
#include "Creature.h"
#include "BattlegroundMgr.h"
#include "CellImpl.h"
+#include "CombatPackets.h"
#include "Common.h"
#include "CreatureAI.h"
#include "CreatureAISelector.h"
@@ -27,29 +28,29 @@
#include "Formulas.h"
#include "GameEventMgr.h"
#include "GossipDef.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "GroupMgr.h"
#include "InstanceScript.h"
#include "Log.h"
#include "LootMgr.h"
+#include "MiscPackets.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "PoolMgr.h"
#include "QuestDef.h"
+#include "ScriptedGossip.h"
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
#include "TemporarySummon.h"
+#include "Transport.h"
#include "Util.h"
#include "Vehicle.h"
#include "World.h"
#include "WorldPacket.h"
-#include "CombatPackets.h"
-#include "MiscPackets.h"
-
-#include "Transport.h"
-#include "ScriptedGossip.h"
+#include <G3D/g3dmath.h>
TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const
{
@@ -60,27 +61,27 @@ TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const
return nullptr;
}
+bool VendorItem::IsGoldRequired(ItemTemplate const* pProto) const
+{
+ return pProto->GetFlags2() & ITEM_FLAG2_DONT_IGNORE_BUY_PRICE || !ExtendedCost;
+}
+
bool VendorItemData::RemoveItem(uint32 item_id, uint8 type)
{
- bool found = false;
- for (VendorItemList::iterator i = m_items.begin(); i != m_items.end();)
+ auto newEnd = std::remove_if(m_items.begin(), m_items.end(), [=](VendorItem const& vendorItem)
{
- if ((*i)->item == item_id && (*i)->Type == type)
- {
- i = m_items.erase(i++);
- found = true;
- }
- else
- ++i;
- }
+ return vendorItem.item == item_id && vendorItem.Type == type;
+ });
+ bool found = newEnd != m_items.end();
+ m_items.erase(newEnd, m_items.end());
return found;
}
VendorItem const* VendorItemData::FindItemCostPair(uint32 item_id, uint32 extendedCost, uint8 type) const
{
- for (VendorItemList::const_iterator i = m_items.begin(); i != m_items.end(); ++i)
- if ((*i)->item == item_id && (*i)->ExtendedCost == extendedCost && (*i)->Type == type)
- return *i;
+ for (VendorItem const& vendorItem : m_items)
+ if (vendorItem.item == item_id && vendorItem.ExtendedCost == extendedCost && vendorItem.Type == type)
+ return &vendorItem;
return nullptr;
}
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 2b6bde797ad..03d69454e2b 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -19,12 +19,12 @@
#ifndef TRINITYCORE_CREATURE_H
#define TRINITYCORE_CREATURE_H
+#include "Unit.h"
#include "Common.h"
+#include "CreatureData.h"
+#include "DatabaseEnvFwd.h"
#include "Duration.h"
-#include "Unit.h"
-#include "ItemTemplate.h"
#include "Loot.h"
-#include "DatabaseEnvFwd.h"
#include "MapObject.h"
#include <list>
@@ -36,598 +36,11 @@ class Quest;
class Player;
class SpellInfo;
class WorldSession;
-
-enum CreatureDifficultyFlags
-{
- CREATURE_DIFFICULTYFLAGS_UNK1 = 0x00000001, // Related to mounts
- CREATURE_DIFFICULTYFLAGS_NO_EXPERIENCE = 0x00000002,
- CREATURE_DIFFICULTYFLAGS_NO_LOOT = 0x00000004,
- CREATURE_DIFFICULTYFLAGS_UNKILLABLE = 0x00000008,
- CREATURE_DIFFICULTYFLAGS_TAMEABLE = 0x00000010, // CREATURE_TYPEFLAGS_TAMEABLE
- CREATURE_DIFFICULTYFLAGS_IMMUNE_TO_PC = 0x00000020, // UNIT_FLAG_IMMUNE_TO_PC
- CREATURE_DIFFICULTYFLAGS_IMMUNE_TO_NPC = 0x00000040, // UNIT_FLAG_IMMUNE_TO_NPC
- CREATURE_DIFFICULTYFLAGS_UNK2 = 0x00000080,
- CREATURE_DIFFICULTYFLAGS_SESSILE = 0x00000100, // Creature is rooted
- CREATURE_DIFFICULTYFLAGS_NOT_SELECTABLE = 0x00000200, // UNIT_FLAG_NOT_SELECTABLE
- CREATURE_DIFFICULTYFLAGS_UNK3 = 0x00000400, // Related to health - it seems similar to CREATURE_DIFFICULTYFLAGS_2_KEEP_HEALTH_POINTS_AT_RESET
- CREATURE_DIFFICULTYFLAGS_NO_CORPSE_UPON_DEATH = 0x00000800, // Creature instantly disappear when killed
- CREATURE_DIFFICULTYFLAGS_UNK5 = 0x00001000,
- CREATURE_DIFFICULTYFLAGS_UNK6 = 0x00002000,
- CREATURE_DIFFICULTYFLAGS_UNK7 = 0x00004000,
- CREATURE_DIFFICULTYFLAGS_UNK8 = 0x00008000,
- CREATURE_DIFFICULTYFLAGS_BOSS = 0x00010000, // CREATURE_TYPEFLAGS_BOSS
- CREATURE_DIFFICULTYFLAGS_UNK9 = 0x00020000,
- CREATURE_DIFFICULTYFLAGS_WATER_BOUND = 0x00040000,
- CREATURE_DIFFICULTYFLAGS_CAN_PENETRATE_WATER = 0x00080000,
- CREATURE_DIFFICULTYFLAGS_UNK10 = 0x00100000,
- CREATURE_DIFFICULTYFLAGS_GHOST = 0x00200000, // CREATURE_TYPEFLAGS_GHOST
- CREATURE_DIFFICULTYFLAGS_UNK11 = 0x00400000,
- CREATURE_DIFFICULTYFLAGS_DO_NOT_PLAY_WOUND_PARRY_ANIMATION = 0x00800000, // CREATURE_TYPEFLAGS_DO_NOT_PLAY_WOUND_PARRY_ANIMATION
- CREATURE_DIFFICULTYFLAGS_HIDE_FACTION_TOOLTIP = 0x01000000, // CREATURE_TYPEFLAGS_HIDE_FACTION_TOOLTIP
- CREATURE_DIFFICULTYFLAGS_IGNORE_COMBAT = 0x02000000,
- CREATURE_DIFFICULTYFLAGS_UNK12 = 0x04000000,
- CREATURE_DIFFICULTYFLAGS_SUMMON_GUARD_IF_IN_AGGRO_RANGE = 0x08000000, // Creature will summon a guard if player is within its aggro range (even if creature doesn't attack per se)
- CREATURE_DIFFICULTYFLAGS_ONLY_SWIM = 0x10000000, // UNIT_FLAG_UNK_15
- CREATURE_DIFFICULTYFLAGS_UNK13 = 0x20000000, // Related to gravity
- CREATURE_DIFFICULTYFLAGS_TFLAG_UNK5 = 0x40000000, // CREATURE_TYPEFLAGS_UNK5
- CREATURE_DIFFICULTYFLAGS_LARGE_AOI = 0x80000000 // UnitFlags2 0x200000
-};
-
-enum CreatureDifficultyFlags2
-{
- CREATURE_DIFFICULTYFLAGS_2_UNK1 = 0x00000001,
- CREATURE_DIFFICULTYFLAGS_2_FORCE_PARTY_MEMBERS_INTO_COMBAT = 0x00000002,
- CREATURE_DIFFICULTYFLAGS_2_UNK2 = 0x00000004,
- CREATURE_DIFFICULTYFLAGS_2_SPELL_ATTACKABLE = 0x00000008, // CREATURE_TYPEFLAGS_SPELL_ATTACKABLE
- CREATURE_DIFFICULTYFLAGS_2_UNK3 = 0x00000010,
- CREATURE_DIFFICULTYFLAGS_2_UNK4 = 0x00000020,
- CREATURE_DIFFICULTYFLAGS_2_UNK5 = 0x00000040,
- CREATURE_DIFFICULTYFLAGS_2_UNK6 = 0x00000080,
- CREATURE_DIFFICULTYFLAGS_2_UNK7 = 0x00000100,
- CREATURE_DIFFICULTYFLAGS_2_UNK8 = 0x00000200,
- CREATURE_DIFFICULTYFLAGS_2_UNK9 = 0x00000400,
- CREATURE_DIFFICULTYFLAGS_2_DEAD_INTERACT = 0x00000800, // CREATURE_TYPEFLAGS_DEAD_INTERACT
- CREATURE_DIFFICULTYFLAGS_2_UNK10 = 0x00001000,
- CREATURE_DIFFICULTYFLAGS_2_UNK11 = 0x00002000,
- CREATURE_DIFFICULTYFLAGS_2_HERBLOOT = 0x00004000, // CREATURE_TYPEFLAGS_HERBLOOT
- CREATURE_DIFFICULTYFLAGS_2_MININGLOOT = 0x00008000, // CREATURE_TYPEFLAGS_MININGLOOT
- CREATURE_DIFFICULTYFLAGS_2_DONT_LOG_DEATH = 0x00010000, // CREATURE_TYPEFLAGS_DONT_LOG_DEATH
- CREATURE_DIFFICULTYFLAGS_2_UNK12 = 0x00020000,
- CREATURE_DIFFICULTYFLAGS_2_MOUNTED_COMBAT = 0x00040000, // CREATURE_TYPEFLAGS_MOUNTED_COMBAT
- CREATURE_DIFFICULTYFLAGS_2_UNK13 = 0x00080000,
- CREATURE_DIFFICULTYFLAGS_2_UNK14 = 0x00100000, // This flag seems similar to CREATURE_DIFFICULTYFLAGS_IGNORE_COMBAT
- CREATURE_DIFFICULTYFLAGS_2_UNK15 = 0x00200000,
- CREATURE_DIFFICULTYFLAGS_2_UNK16 = 0x00400000,
- CREATURE_DIFFICULTYFLAGS_2_UNK17 = 0x00800000,
- CREATURE_DIFFICULTYFLAGS_2_UNK18 = 0x01000000,
- CREATURE_DIFFICULTYFLAGS_2_HIDE_BODY = 0x02000000, // UNIT_FLAG2_UNK1
- CREATURE_DIFFICULTYFLAGS_2_UNK19 = 0x04000000,
- CREATURE_DIFFICULTYFLAGS_2_SERVER_ONLY = 0x08000000,
- CREATURE_DIFFICULTYFLAGS_2_CAN_SAFE_FALL = 0x10000000,
- CREATURE_DIFFICULTYFLAGS_2_CAN_ASSIST = 0x20000000, // CREATURE_TYPEFLAGS_CAN_ASSIST
- CREATURE_DIFFICULTYFLAGS_2_KEEP_HEALTH_POINTS_AT_RESET = 0x40000000,
- CREATURE_DIFFICULTYFLAGS_2_IS_PET_BAR_USED = 0x80000000 // CREATURE_TYPEFLAGS_IS_PET_BAR_USED
-};
-
-enum CreatureDifficultyFlags3
-{
- CREATURE_DIFFICULTYFLAGS_3_UNK1 = 0x00000001,
- CREATURE_DIFFICULTYFLAGS_3_UNK2 = 0x00000002,
- CREATURE_DIFFICULTYFLAGS_3_INSTANTLY_APPEAR_MODEL = 0x00000004, // UNIT_FLAG2_INSTANTLY_APPEAR_MODEL
- CREATURE_DIFFICULTYFLAGS_3_MASK_UID = 0x00000008, // CREATURE_TYPEFLAG_MASK_UID
- CREATURE_DIFFICULTYFLAGS_3_ENGINEERLOOT = 0x00000010, // CREATURE_TYPEFLAGS_ENGINEERLOOT
- CREATURE_DIFFICULTYFLAGS_3_UNK3 = 0x00000020,
- CREATURE_DIFFICULTYFLAGS_3_UNK4 = 0x00000040,
- CREATURE_DIFFICULTYFLAGS_3_UNK5 = 0x00000080,
- CREATURE_DIFFICULTYFLAGS_3_CANNOT_SWIM = 0x00000100, // UNIT_FLAG_UNK_14
- CREATURE_DIFFICULTYFLAGS_3_EXOTIC = 0x00000200, // CREATURE_TYPEFLAGS_EXOTIC
- CREATURE_DIFFICULTYFLAGS_3_GIGANTIC_AOI = 0x00000400, // Since MoP, creatures with that flag have UnitFlags2 0x400000
- CREATURE_DIFFICULTYFLAGS_3_INFINITE_AOI = 0x00000800, // Since MoP, creatures with that flag have UnitFlags2 0x40000000
- CREATURE_DIFFICULTYFLAGS_3_WATERWALKING = 0x00001000,
- CREATURE_DIFFICULTYFLAGS_3_HIDE_NAMEPLATE = 0x00002000, // CREATURE_TYPEFLAGS_HIDE_NAMEPLATE
- CREATURE_DIFFICULTYFLAGS_3_UNK6 = 0x00004000,
- CREATURE_DIFFICULTYFLAGS_3_UNK7 = 0x00008000,
- CREATURE_DIFFICULTYFLAGS_3_USE_DEFAULT_COLLISION_BOX = 0x00010000, // CREATURE_TYPEFLAGS_USE_DEFAULT_COLLISION_BOX
- CREATURE_DIFFICULTYFLAGS_3_UNK8 = 0x00020000,
- CREATURE_DIFFICULTYFLAGS_3_IS_SIEGE_WEAPON = 0x00040000, // CREATURE_TYPEFLAGS_IS_SIEGE_WEAPON
- CREATURE_DIFFICULTYFLAGS_3_UNK9 = 0x00080000,
- CREATURE_DIFFICULTYFLAGS_3_UNK10 = 0x00100000,
- CREATURE_DIFFICULTYFLAGS_3_UNK11 = 0x00200000,
- CREATURE_DIFFICULTYFLAGS_3_PROJECTILE_COLLISION = 0x00400000, // CREATURE_TYPEFLAGS_PROJECTILE_COLLISION
- CREATURE_DIFFICULTYFLAGS_3_CAN_BE_MULTITAPPED = 0x00800000,
- CREATURE_DIFFICULTYFLAGS_3_DO_NOT_PLAY_MOUNTED_ANIMATIONS = 0x01000000, // CREATURE_TYPEFLAGS_DO_NOT_PLAY_MOUNTED_ANIMATIONS
- CREATURE_DIFFICULTYFLAGS_3_DISABLE_TURN = 0x02000000, // UNIT_FLAG2_DISABLE_TURN
- CREATURE_DIFFICULTYFLAGS_3_UNK12 = 0x04000000,
- CREATURE_DIFFICULTYFLAGS_3_UNK13 = 0x08000000,
- CREATURE_DIFFICULTYFLAGS_3_UNK14 = 0x10000000,
- CREATURE_DIFFICULTYFLAGS_3_IS_LINK_ALL = 0x20000000, // CREATURE_TYPEFLAGS_IS_LINK_ALL
- CREATURE_DIFFICULTYFLAGS_3_UNK15 = 0x40000000,
- CREATURE_DIFFICULTYFLAGS_3_UNK16 = 0x80000000
-};
-
-enum CreatureDifficultyFlags4
-{
- CREATURE_DIFFICULTYFLAGS_4_HAS_NO_BIRTH_ANIMATION = 0x00000001, // SMSG_UPDATE_OBJECT's "NoBirthAnim"
- CREATURE_DIFFICULTYFLAGS_4_UNK1 = 0x00000002,
- CREATURE_DIFFICULTYFLAGS_4_UNK2 = 0x00000004,
- CREATURE_DIFFICULTYFLAGS_4_INTERACT_ONLY_WITH_CREATOR = 0x00000008, // CREATURE_TYPEFLAGS_INTERACT_ONLY_WITH_CREATOR
- CREATURE_DIFFICULTYFLAGS_4_DO_NOT_PLAY_UNIT_EVENT_SOUNDS = 0x00000010, // CREATURE_TYPEFLAGS_DO_NOT_PLAY_UNIT_EVENT_SOUNDS
- CREATURE_DIFFICULTYFLAGS_4_HAS_NO_SHADOW_BLOB = 0x00000020, // CREATURE_TYPEFLAGS_HAS_NO_SHADOW_BLOB
- CREATURE_DIFFICULTYFLAGS_4_UNK3 = 0x00000040,
- CREATURE_DIFFICULTYFLAGS_4_UNK4 = 0x00000080,
- CREATURE_DIFFICULTYFLAGS_4_UNK5 = 0x00000100,
- CREATURE_DIFFICULTYFLAGS_4_UNK6 = 0x00000200,
- CREATURE_DIFFICULTYFLAGS_4_UNK7 = 0x00000400,
- CREATURE_DIFFICULTYFLAGS_4_UNK8 = 0x00000800,
- CREATURE_DIFFICULTYFLAGS_4_UNK9 = 0x00001000,
- CREATURE_DIFFICULTYFLAGS_4_UNK10 = 0x00002000,
- CREATURE_DIFFICULTYFLAGS_4_UNK11 = 0x00004000,
- CREATURE_DIFFICULTYFLAGS_4_UFLAG2_UNK20 = 0x00008000, // UnitFlags2 0x100000
- CREATURE_DIFFICULTYFLAGS_4_UNK12 = 0x00010000,
- CREATURE_DIFFICULTYFLAGS_4_UNK13 = 0x00020000,
- CREATURE_DIFFICULTYFLAGS_4_UNK14 = 0x00040000,
- CREATURE_DIFFICULTYFLAGS_4_FORCE_GOSSIP = 0x00080000, // CREATURE_TYPEFLAGS_FORCE_GOSSIP
- CREATURE_DIFFICULTYFLAGS_4_UNK15 = 0x00100000,
- CREATURE_DIFFICULTYFLAGS_4_DO_NOT_SHEATHE = 0x00200000, // CREATURE_TYPEFLAGS_DO_NOT_SHEATHE
- CREATURE_DIFFICULTYFLAGS_4_IGNORE_SPELL_MIN_RANGE_RESTRICTIONS = 0x00400000, // UnitFlags2 0x8000000
- CREATURE_DIFFICULTYFLAGS_4_UNK16 = 0x00800000,
- CREATURE_DIFFICULTYFLAGS_4_PREVENT_SWIM = 0x01000000, // UnitFlags2 0x1000000
- CREATURE_DIFFICULTYFLAGS_4_HIDE_IN_COMBAT_LOG = 0x02000000, // UnitFlags2 0x2000000
- CREATURE_DIFFICULTYFLAGS_4_UNK17 = 0x04000000,
- CREATURE_DIFFICULTYFLAGS_4_UNK18 = 0x08000000,
- CREATURE_DIFFICULTYFLAGS_4_UNK19 = 0x10000000,
- CREATURE_DIFFICULTYFLAGS_4_DO_NOT_TARGET_ON_INTERACTION = 0x20000000, // CREATURE_TYPEFLAGS_DO_NOT_TARGET_ON_INTERACTION
- CREATURE_DIFFICULTYFLAGS_4_DO_NOT_RENDER_OBJECT_NAME = 0x40000000, // CREATURE_TYPEFLAGS_DO_NOT_RENDER_OBJECT_NAME
- CREATURE_DIFFICULTYFLAGS_4_UNIT_IS_QUEST_BOSS = 0x80000000 // CREATURE_TYPEFLAGS_UNIT_IS_QUEST_BOSS
-};
-
-enum CreatureDifficultyFlags5
-{
- CREATURE_DIFFICULTYFLAGS_5_CANNOT_SWITCH_TARGETS = 0x00000001, // UnitFlags2 0x4000000
- CREATURE_DIFFICULTYFLAGS_5_UNK1 = 0x00000002,
- CREATURE_DIFFICULTYFLAGS_5_UFLAG2_UNK30 = 0x00000004, // UnitFlags2 0x10000000
- CREATURE_DIFFICULTYFLAGS_5_UNK2 = 0x00000008,
- CREATURE_DIFFICULTYFLAGS_5_UNK3 = 0x00000010,
- CREATURE_DIFFICULTYFLAGS_5_UNK4 = 0x00000020,
- CREATURE_DIFFICULTYFLAGS_5_UNK5 = 0x00000040,
- CREATURE_DIFFICULTYFLAGS_5_UNK6 = 0x00000080,
- CREATURE_DIFFICULTYFLAGS_5_CAN_INTERACT_EVEN_IF_HOSTILE = 0x00000100, // UNIT_FLAG2_ALLOW_ENEMY_INTERACT
- CREATURE_DIFFICULTYFLAGS_5_UNK7 = 0x00000200,
- CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK1 = 0x00000400, // CREATURE_TYPEFLAGS_2_UNK1
- CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK2 = 0x00000800, // CREATURE_TYPEFLAGS_2_UNK2
- CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK3 = 0x00001000, // CREATURE_TYPEFLAGS_2_UNK3
- CREATURE_DIFFICULTYFLAGS_5_UFLAG2_UNK19 = 0x00002000, // UnitFlags2 0x80000
- CREATURE_DIFFICULTYFLAGS_5_UNK8 = 0x00004000,
- CREATURE_DIFFICULTYFLAGS_5_UNK9 = 0x00008000,
- CREATURE_DIFFICULTYFLAGS_5_UNK10 = 0x00010000,
- CREATURE_DIFFICULTYFLAGS_5_UNK11 = 0x00020000,
- CREATURE_DIFFICULTYFLAGS_5_UNK12 = 0x00040000,
- CREATURE_DIFFICULTYFLAGS_5_UNK13 = 0x00080000,
- CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK4 = 0x00100000, // CREATURE_TYPEFLAGS_2_UNK4
- CREATURE_DIFFICULTYFLAGS_5_UNK14 = 0x00200000,
- CREATURE_DIFFICULTYFLAGS_5_UNK15 = 0x00400000,
- CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK5 = 0x00800000, // CREATURE_TYPEFLAGS_2_UNK5
- CREATURE_DIFFICULTYFLAGS_5_UNK16 = 0x01000000,
- CREATURE_DIFFICULTYFLAGS_5_UNK17 = 0x02000000,
- CREATURE_DIFFICULTYFLAGS_5_UNK18 = 0x04000000,
- CREATURE_DIFFICULTYFLAGS_5_UNK19 = 0x08000000,
- CREATURE_DIFFICULTYFLAGS_5_UNK20 = 0x10000000,
- CREATURE_DIFFICULTYFLAGS_5_UNK21 = 0x20000000,
- CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK6 = 0x40000000, // CREATURE_TYPEFLAGS_2_UNK6
- CREATURE_DIFFICULTYFLAGS_5_UNK22 = 0x80000000
-};
-
-enum CreatureDifficultyFlags6
-{
- CREATURE_DIFFICULTYFLAGS_6_UNK1 = 0x00000001,
- CREATURE_DIFFICULTYFLAGS_6_UNK2 = 0x00000002,
- CREATURE_DIFFICULTYFLAGS_6_UNK3 = 0x00000004,
- CREATURE_DIFFICULTYFLAGS_6_UNK4 = 0x00000008,
- CREATURE_DIFFICULTYFLAGS_6_UNK5 = 0x00000010,
- CREATURE_DIFFICULTYFLAGS_6_UNK6 = 0x00000020,
- CREATURE_DIFFICULTYFLAGS_6_UNK7 = 0x00000040,
- CREATURE_DIFFICULTYFLAGS_6_TFLAG2_UNK7 = 0x00000080,
- CREATURE_DIFFICULTYFLAGS_6_UNK8 = 0x00000100,
- CREATURE_DIFFICULTYFLAGS_6_UNK9 = 0x00000200,
- CREATURE_DIFFICULTYFLAGS_6_UNK10 = 0x00000400,
- CREATURE_DIFFICULTYFLAGS_6_UNK11 = 0x00000800,
- CREATURE_DIFFICULTYFLAGS_6_UNK12 = 0x00001000,
- CREATURE_DIFFICULTYFLAGS_6_UNK13 = 0x00002000,
- CREATURE_DIFFICULTYFLAGS_6_UNK14 = 0x00004000,
- CREATURE_DIFFICULTYFLAGS_6_UNK15 = 0x00008000,
- CREATURE_DIFFICULTYFLAGS_6_UNK16 = 0x00010000,
- CREATURE_DIFFICULTYFLAGS_6_UNK17 = 0x00020000,
- CREATURE_DIFFICULTYFLAGS_6_UNK18 = 0x00040000,
- CREATURE_DIFFICULTYFLAGS_6_UNK19 = 0x00080000,
- CREATURE_DIFFICULTYFLAGS_6_UNK20 = 0x00100000,
- CREATURE_DIFFICULTYFLAGS_6_UNK21 = 0x00200000,
- CREATURE_DIFFICULTYFLAGS_6_UNK22 = 0x00400000,
- CREATURE_DIFFICULTYFLAGS_6_UNK23 = 0x00800000,
- CREATURE_DIFFICULTYFLAGS_6_UNK24 = 0x01000000,
- CREATURE_DIFFICULTYFLAGS_6_UNK25 = 0x02000000,
- CREATURE_DIFFICULTYFLAGS_6_UNK26 = 0x04000000,
- CREATURE_DIFFICULTYFLAGS_6_UNK27 = 0x08000000,
- CREATURE_DIFFICULTYFLAGS_6_UNK28 = 0x10000000,
- CREATURE_DIFFICULTYFLAGS_6_UNK29 = 0x20000000,
- CREATURE_DIFFICULTYFLAGS_6_UNK30 = 0x40000000,
- CREATURE_DIFFICULTYFLAGS_6_TFLAG2_UNK14 = 0x80000000
-};
-
-enum CreatureDifficultyFlags7
-{
- CREATURE_DIFFICULTYFLAGS_7_TFLAG2_UNK15 = 0x00000001,
- CREATURE_DIFFICULTYFLAGS_7_TFLAG2_UNK16 = 0x00000002,
- CREATURE_DIFFICULTYFLAGS_7_TFLAG2_UNK17 = 0x00000004,
- CREATURE_DIFFICULTYFLAGS_7_UNK1 = 0x00000008
-};
-
-enum CreatureFlagsExtra
-{
- CREATURE_FLAG_EXTRA_INSTANCE_BIND = 0x00000001, // creature kill bind instance with killer and killer's group
- CREATURE_FLAG_EXTRA_CIVILIAN = 0x00000002, // not aggro (ignore faction/reputation hostility)
- CREATURE_FLAG_EXTRA_NO_PARRY = 0x00000004, // creature can't parry
- CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN = 0x00000008, // creature can't counter-attack at parry
- CREATURE_FLAG_EXTRA_NO_BLOCK = 0x00000010, // creature can't block
- CREATURE_FLAG_EXTRA_NO_CRUSH = 0x00000020, // creature can't do crush attacks
- CREATURE_FLAG_EXTRA_NO_XP_AT_KILL = 0x00000040, // creature kill not provide XP
- CREATURE_FLAG_EXTRA_TRIGGER = 0x00000080, // trigger creature
- CREATURE_FLAG_EXTRA_NO_TAUNT = 0x00000100, // creature is immune to taunt auras and effect attack me
- CREATURE_FLAG_EXTRA_WORLDEVENT = 0x00004000, // custom flag for world event creatures (left room for merging)
- CREATURE_FLAG_EXTRA_GUARD = 0x00008000, // Creature is guard
- CREATURE_FLAG_EXTRA_NO_CRIT = 0x00020000, // creature can't do critical strikes
- CREATURE_FLAG_EXTRA_NO_SKILLGAIN = 0x00040000, // creature won't increase weapon skills
- CREATURE_FLAG_EXTRA_TAUNT_DIMINISH = 0x00080000, // Taunt is a subject to diminishing returns on this creautre
- CREATURE_FLAG_EXTRA_ALL_DIMINISH = 0x00100000, // creature is subject to all diminishing returns as player are
- CREATURE_FLAG_EXTRA_NO_PLAYER_DAMAGE_REQ = 0x00200000, // creature does not need to take player damage for kill credit
- CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000, // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB)
- CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING = 0x20000000, // creature ignore pathfinding
- CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK = 0x40000000 // creature is immune to knockback effects
-};
-
-#define CREATURE_FLAG_EXTRA_DB_ALLOWED (CREATURE_FLAG_EXTRA_INSTANCE_BIND | CREATURE_FLAG_EXTRA_CIVILIAN | \
- CREATURE_FLAG_EXTRA_NO_PARRY | CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN | CREATURE_FLAG_EXTRA_NO_BLOCK | \
- CREATURE_FLAG_EXTRA_NO_CRUSH | CREATURE_FLAG_EXTRA_NO_XP_AT_KILL | CREATURE_FLAG_EXTRA_TRIGGER | \
- CREATURE_FLAG_EXTRA_NO_TAUNT | CREATURE_FLAG_EXTRA_WORLDEVENT | CREATURE_FLAG_EXTRA_NO_CRIT | \
- CREATURE_FLAG_EXTRA_NO_SKILLGAIN | CREATURE_FLAG_EXTRA_TAUNT_DIMINISH | CREATURE_FLAG_EXTRA_ALL_DIMINISH | \
- CREATURE_FLAG_EXTRA_GUARD | CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING | CREATURE_FLAG_EXTRA_NO_PLAYER_DAMAGE_REQ | CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK)
-
-const uint32 CREATURE_REGEN_INTERVAL = 2 * IN_MILLISECONDS;
-const uint32 CREATURE_NOPATH_EVADE_TIME = 5 * IN_MILLISECONDS;
-
-const uint8 MAX_KILL_CREDIT = 2;
-const uint32 MAX_CREATURE_MODELS = 4;
-const uint32 MAX_CREATURE_NAMES = 4;
-const uint32 MAX_CREATURE_SPELLS = 8;
-const uint32 MAX_CREATURE_DIFFICULTIES = 3;
-
-// from `creature_template` table
-struct TC_GAME_API CreatureTemplate
-{
- uint32 Entry;
- uint32 DifficultyEntry[MAX_CREATURE_DIFFICULTIES];
- uint32 KillCredit[MAX_KILL_CREDIT];
- uint32 Modelid1;
- uint32 Modelid2;
- uint32 Modelid3;
- uint32 Modelid4;
- std::string Name;
- std::string FemaleName;
- std::string SubName;
- std::string IconName;
- uint32 GossipMenuId;
- int16 minlevel;
- int16 maxlevel;
- int32 HealthScalingExpansion;
- uint32 RequiredExpansion;
- uint32 VignetteID; /// @todo Read Vignette.db2
- uint32 faction;
- uint64 npcflag;
- float speed_walk;
- float speed_run;
- float scale;
- uint32 rank;
- uint32 dmgschool;
- uint32 BaseAttackTime;
- uint32 RangeAttackTime;
- float BaseVariance;
- float RangeVariance;
- uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures.
- uint32 unit_flags; // enum UnitFlags mask values
- uint32 unit_flags2; // enum UnitFlags2 mask values
- uint32 unit_flags3; // enum UnitFlags3 mask values
- uint32 dynamicflags;
- CreatureFamily family; // enum CreatureFamily values (optional)
- uint32 trainer_type;
- uint32 trainer_class;
- uint32 trainer_race;
- uint32 type; // enum CreatureType values
- uint32 type_flags; // enum CreatureTypeFlags mask values
- uint32 type_flags2; // unknown enum, only set for 4 creatures (with value 1)
- uint32 lootid;
- uint32 pickpocketLootId;
- uint32 SkinLootId;
- int32 resistance[MAX_SPELL_SCHOOL];
- uint32 spells[MAX_CREATURE_SPELLS];
- uint32 VehicleId;
- uint32 mingold;
- uint32 maxgold;
- std::string AIName;
- uint32 MovementType;
- uint32 InhabitType;
- float HoverHeight;
- float ModHealth;
- float ModHealthExtra;
- float ModMana;
- float ModManaExtra; // Added in 4.x, this value is usually 2 for a small group of creatures with double mana
- float ModArmor;
- float ModDamage;
- float ModExperience;
- bool RacialLeader;
- uint32 movementId;
- bool RegenHealth;
- uint32 MechanicImmuneMask;
- uint32 flags_extra;
- uint32 ScriptID;
- uint32 GetRandomValidModelId() const;
- uint32 GetFirstValidModelId() const;
- uint32 GetFirstInvisibleModel() const;
- uint32 GetFirstVisibleModel() const;
-
- // helpers
- SkillType GetRequiredLootSkill() const
- {
- if (type_flags & CREATURE_TYPE_FLAG_HERB_SKINNING_SKILL)
- return SKILL_HERBALISM;
- else if (type_flags & CREATURE_TYPE_FLAG_MINING_SKINNING_SKILL)
- return SKILL_MINING;
- else if (type_flags & CREATURE_TYPE_FLAG_ENGINEERING_SKINNING_SKILL)
- return SKILL_ENGINEERING;
- else
- return SKILL_SKINNING; // normal case
- }
-
- bool IsExotic() const
- {
- return (type_flags & CREATURE_TYPE_FLAG_EXOTIC_PET) != 0;
- }
-
- bool IsTameable(bool canTameExotic) const
- {
- if (type != CREATURE_TYPE_BEAST || family == CREATURE_FAMILY_NONE || (type_flags & CREATURE_TYPE_FLAG_TAMEABLE_PET) == 0)
- return false;
-
- // if can tame exotic then can tame any tameable
- return canTameExotic || !IsExotic();
- }
-
- static int32 DifficultyIDToDifficultyEntryIndex(uint32 difficulty)
- {
- switch (difficulty)
- {
- case DIFFICULTY_NONE:
- case DIFFICULTY_NORMAL:
- case DIFFICULTY_10_N:
- case DIFFICULTY_40:
- case DIFFICULTY_3_MAN_SCENARIO_N:
- case DIFFICULTY_NORMAL_RAID:
- return -1;
- case DIFFICULTY_HEROIC:
- case DIFFICULTY_25_N:
- case DIFFICULTY_3_MAN_SCENARIO_HC:
- case DIFFICULTY_HEROIC_RAID:
- return 0;
- case DIFFICULTY_10_HC:
- case DIFFICULTY_MYTHIC_KEYSTONE:
- case DIFFICULTY_MYTHIC_RAID:
- return 1;
- case DIFFICULTY_25_HC:
- return 2;
- case DIFFICULTY_LFR:
- case DIFFICULTY_LFR_NEW:
- case DIFFICULTY_EVENT_RAID:
- case DIFFICULTY_EVENT_DUNGEON:
- case DIFFICULTY_EVENT_SCENARIO:
- default:
- return -1;
- }
- }
-};
-
-typedef std::vector<uint32> CreatureQuestItemList;
-typedef std::unordered_map<uint32, CreatureQuestItemList> CreatureQuestItemMap;
-
-// Benchmarked: Faster than std::map (insert/find)
-typedef std::unordered_map<uint32, CreatureTemplate> CreatureTemplateContainer;
-
-#pragma pack(push, 1)
-
-// Defines base stats for creatures (used to calculate HP/mana/armor/attackpower/rangedattackpower/all damage).
-struct TC_GAME_API CreatureBaseStats
-{
- uint32 BaseHealth[MAX_EXPANSIONS];
- uint32 BaseMana;
- uint32 BaseArmor;
- uint32 AttackPower;
- uint32 RangedAttackPower;
- float BaseDamage[MAX_EXPANSIONS];
-
- // Helpers
-
- uint32 GenerateHealth(CreatureTemplate const* info) const
- {
- return uint32(ceil(BaseHealth[info->HealthScalingExpansion] * info->ModHealth * info->ModHealthExtra));
- }
-
- uint32 GenerateMana(CreatureTemplate const* info) const
- {
- // Mana can be 0.
- if (!BaseMana)
- return 0;
-
- return uint32(ceil(BaseMana * info->ModMana * info->ModManaExtra));
- }
-
- uint32 GenerateArmor(CreatureTemplate const* info) const
- {
- return uint32(ceil(BaseArmor * info->ModArmor));
- }
-
- float GenerateBaseDamage(CreatureTemplate const* info) const
- {
- return BaseDamage[info->HealthScalingExpansion];
- }
-
- static CreatureBaseStats const* GetBaseStats(uint8 level, uint8 unitClass);
-};
-
-typedef std::unordered_map<uint16, CreatureBaseStats> CreatureBaseStatsContainer;
-
-struct CreatureLocale
-{
- std::vector<std::string> Name;
- std::vector<std::string> NameAlt;
- std::vector<std::string> Title;
- std::vector<std::string> TitleAlt;
-};
-
-struct EquipmentItem
-{
- uint32 ItemId = 0;
- uint16 AppearanceModId = 0;
- uint16 ItemVisual = 0;
-};
-
-struct EquipmentInfo
-{
- EquipmentItem Items[MAX_EQUIPMENT_ITEMS];
-};
-
-// Benchmarked: Faster than std::map (insert/find)
-typedef std::unordered_map<uint8, EquipmentInfo> EquipmentInfoContainerInternal;
-typedef std::unordered_map<uint32, EquipmentInfoContainerInternal> EquipmentInfoContainer;
-
-// from `creature` table
-struct CreatureData
-{
- CreatureData() : id(0), mapid(0), phaseMask(0), displayid(0), equipmentId(0),
- posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0),
- spawndist(0.0f), currentwaypoint(0), curhealth(0), curmana(0), movementType(0),
- spawnMask(0), npcflag(0), unit_flags(0), unit_flags2(0), unit_flags3(0), dynamicflags(0),
- phaseid(0), phaseGroup(0), dbData(true) { }
- uint32 id; // entry in creature_template
- uint16 mapid;
- uint32 phaseMask;
- uint32 displayid;
- int8 equipmentId;
- float posX;
- float posY;
- float posZ;
- float orientation;
- uint32 spawntimesecs;
- float spawndist;
- uint32 currentwaypoint;
- uint32 curhealth;
- uint32 curmana;
- uint8 movementType;
- uint32 spawnMask;
- uint64 npcflag;
- uint32 unit_flags; // enum UnitFlags mask values
- uint32 unit_flags2; // enum UnitFlags2 mask values
- uint32 unit_flags3; // enum UnitFlags3 mask values
- uint32 dynamicflags;
- uint32 phaseid;
- uint32 phaseGroup;
- uint32 ScriptId;
- bool dbData;
-};
-
-struct CreatureModelInfo
-{
- float bounding_radius;
- float combat_reach;
- int8 gender;
- uint32 displayId_other_gender;
- bool is_trigger;
-};
-
-// Benchmarked: Faster than std::map (insert/find)
-typedef std::unordered_map<uint32, CreatureModelInfo> CreatureModelContainer;
-
-enum InhabitTypeValues
-{
- INHABIT_GROUND = 1,
- INHABIT_WATER = 2,
- INHABIT_AIR = 4,
- INHABIT_ROOT = 8,
- INHABIT_ANYWHERE = INHABIT_GROUND | INHABIT_WATER | INHABIT_AIR | INHABIT_ROOT
-};
-
-#pragma pack(pop)
-
-// `creature_addon` table
-struct CreatureAddon
-{
- uint32 path_id;
- uint32 mount;
- uint32 bytes1;
- uint32 bytes2;
- uint32 emote;
- uint16 aiAnimKit;
- uint16 movementAnimKit;
- uint16 meleeAnimKit;
- std::vector<uint32> auras;
-};
-
-typedef std::unordered_map<ObjectGuid::LowType, CreatureAddon> CreatureAddonContainer;
-typedef std::unordered_map<uint32, CreatureAddon> CreatureTemplateAddonContainer;
-
-// Vendors
-struct VendorItem
-{
- VendorItem(uint32 _item, int32 _maxcount, uint32 _incrtime, uint32 _ExtendedCost, uint8 _Type)
- : item(_item), maxcount(_maxcount), incrtime(_incrtime), ExtendedCost(_ExtendedCost), Type(_Type) { }
-
- uint32 item;
- uint32 maxcount; // 0 for infinity item amount
- uint32 incrtime; // time for restore items amount if maxcount != 0
- uint32 ExtendedCost;
- uint8 Type;
-
- //helpers
- bool IsGoldRequired(ItemTemplate const* pProto) const { return pProto->GetFlags2() & ITEM_FLAG2_DONT_IGNORE_BUY_PRICE || !ExtendedCost; }
-};
-typedef std::vector<VendorItem*> VendorItemList;
-
-struct VendorItemData
-{
- VendorItemList m_items;
-
- VendorItem* GetItem(uint32 slot) const
- {
- if (slot >= m_items.size())
- return NULL;
-
- return m_items[slot];
- }
- bool Empty() const { return m_items.empty(); }
- uint32 GetItemCount() const { return uint32(m_items.size()); }
- void AddItem(uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, uint8 type)
- {
- m_items.push_back(new VendorItem(item, maxcount, ptime, ExtendedCost, type));
- }
- bool RemoveItem(uint32 item_id, uint8 type);
- VendorItem const* FindItemCostPair(uint32 item_id, uint32 extendedCost, uint8 type) const;
- void Clear()
- {
- for (VendorItemList::const_iterator itr = m_items.begin(); itr != m_items.end(); ++itr)
- delete (*itr);
- m_items.clear();
- }
-};
+enum MovementGeneratorType : uint8;
struct VendorItemCount
{
- explicit VendorItemCount(uint32 _item, uint32 _count)
+ VendorItemCount(uint32 _item, uint32 _count)
: itemId(_item), count(_count), lastIncrementTime(time(NULL)) { }
uint32 itemId;
@@ -637,43 +50,6 @@ struct VendorItemCount
typedef std::list<VendorItemCount> VendorItemCounts;
-#define MAX_TRAINERSPELL_ABILITY_REQS 3
-
-struct TrainerSpell
-{
- TrainerSpell() : SpellID(0), MoneyCost(0), ReqSkillLine(0), ReqSkillRank(0), ReqLevel(0), Index(0)
- {
- for (uint8 i = 0; i < MAX_TRAINERSPELL_ABILITY_REQS; ++i)
- ReqAbility[i] = 0;
- }
-
- uint32 SpellID;
- uint32 MoneyCost;
- uint32 ReqSkillLine;
- uint32 ReqSkillRank;
- uint32 ReqLevel;
- uint32 ReqAbility[MAX_TRAINERSPELL_ABILITY_REQS];
- uint32 Index;
-
- // helpers
- bool IsCastable() const { return ReqAbility[0] != SpellID; }
-};
-
-typedef std::unordered_map<uint32 /*spellid*/, TrainerSpell> TrainerSpellMap;
-
-struct TC_GAME_API TrainerSpellData
-{
- TrainerSpellData() : trainerType(0) { }
- ~TrainerSpellData() { spellList.clear(); }
-
- TrainerSpellMap spellList;
- uint32 trainerType; // trainer type based at trainer spells, can be different from creature_template value.
- // req. for correct show non-prof. trainers like weaponmaster, allowed values 0 and 2.
- TrainerSpell const* Find(uint32 spell_id) const;
-};
-
-typedef std::map<uint32, time_t> CreatureSpellCooldowns;
-
// max different by z coordinate for creature aggro reaction
#define CREATURE_Z_ATTACK_RANGE 3
diff --git a/src/server/game/Entities/Creature/CreatureData.h b/src/server/game/Entities/Creature/CreatureData.h
new file mode 100644
index 00000000000..9fa90399bde
--- /dev/null
+++ b/src/server/game/Entities/Creature/CreatureData.h
@@ -0,0 +1,633 @@
+/*
+ * 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 CreatureData_h__
+#define CreatureData_h__
+
+#include "DBCEnums.h"
+#include "SharedDefines.h"
+#include "UnitDefines.h"
+#include <string>
+#include <unordered_map>
+#include <vector>
+#include <cmath>
+
+struct ItemTemplate;
+
+enum CreatureDifficultyFlags
+{
+ CREATURE_DIFFICULTYFLAGS_UNK1 = 0x00000001, // Related to mounts
+ CREATURE_DIFFICULTYFLAGS_NO_EXPERIENCE = 0x00000002,
+ CREATURE_DIFFICULTYFLAGS_NO_LOOT = 0x00000004,
+ CREATURE_DIFFICULTYFLAGS_UNKILLABLE = 0x00000008,
+ CREATURE_DIFFICULTYFLAGS_TAMEABLE = 0x00000010, // CREATURE_TYPEFLAGS_TAMEABLE
+ CREATURE_DIFFICULTYFLAGS_IMMUNE_TO_PC = 0x00000020, // UNIT_FLAG_IMMUNE_TO_PC
+ CREATURE_DIFFICULTYFLAGS_IMMUNE_TO_NPC = 0x00000040, // UNIT_FLAG_IMMUNE_TO_NPC
+ CREATURE_DIFFICULTYFLAGS_UNK2 = 0x00000080,
+ CREATURE_DIFFICULTYFLAGS_SESSILE = 0x00000100, // Creature is rooted
+ CREATURE_DIFFICULTYFLAGS_NOT_SELECTABLE = 0x00000200, // UNIT_FLAG_NOT_SELECTABLE
+ CREATURE_DIFFICULTYFLAGS_UNK3 = 0x00000400, // Related to health - it seems similar to CREATURE_DIFFICULTYFLAGS_2_KEEP_HEALTH_POINTS_AT_RESET
+ CREATURE_DIFFICULTYFLAGS_NO_CORPSE_UPON_DEATH = 0x00000800, // Creature instantly disappear when killed
+ CREATURE_DIFFICULTYFLAGS_UNK5 = 0x00001000,
+ CREATURE_DIFFICULTYFLAGS_UNK6 = 0x00002000,
+ CREATURE_DIFFICULTYFLAGS_UNK7 = 0x00004000,
+ CREATURE_DIFFICULTYFLAGS_UNK8 = 0x00008000,
+ CREATURE_DIFFICULTYFLAGS_BOSS = 0x00010000, // CREATURE_TYPEFLAGS_BOSS
+ CREATURE_DIFFICULTYFLAGS_UNK9 = 0x00020000,
+ CREATURE_DIFFICULTYFLAGS_WATER_BOUND = 0x00040000,
+ CREATURE_DIFFICULTYFLAGS_CAN_PENETRATE_WATER = 0x00080000,
+ CREATURE_DIFFICULTYFLAGS_UNK10 = 0x00100000,
+ CREATURE_DIFFICULTYFLAGS_GHOST = 0x00200000, // CREATURE_TYPEFLAGS_GHOST
+ CREATURE_DIFFICULTYFLAGS_UNK11 = 0x00400000,
+ CREATURE_DIFFICULTYFLAGS_DO_NOT_PLAY_WOUND_PARRY_ANIMATION = 0x00800000, // CREATURE_TYPEFLAGS_DO_NOT_PLAY_WOUND_PARRY_ANIMATION
+ CREATURE_DIFFICULTYFLAGS_HIDE_FACTION_TOOLTIP = 0x01000000, // CREATURE_TYPEFLAGS_HIDE_FACTION_TOOLTIP
+ CREATURE_DIFFICULTYFLAGS_IGNORE_COMBAT = 0x02000000,
+ CREATURE_DIFFICULTYFLAGS_UNK12 = 0x04000000,
+ CREATURE_DIFFICULTYFLAGS_SUMMON_GUARD_IF_IN_AGGRO_RANGE = 0x08000000, // Creature will summon a guard if player is within its aggro range (even if creature doesn't attack per se)
+ CREATURE_DIFFICULTYFLAGS_ONLY_SWIM = 0x10000000, // UNIT_FLAG_UNK_15
+ CREATURE_DIFFICULTYFLAGS_UNK13 = 0x20000000, // Related to gravity
+ CREATURE_DIFFICULTYFLAGS_TFLAG_UNK5 = 0x40000000, // CREATURE_TYPEFLAGS_UNK5
+ CREATURE_DIFFICULTYFLAGS_LARGE_AOI = 0x80000000 // UnitFlags2 0x200000
+};
+
+enum CreatureDifficultyFlags2
+{
+ CREATURE_DIFFICULTYFLAGS_2_UNK1 = 0x00000001,
+ CREATURE_DIFFICULTYFLAGS_2_FORCE_PARTY_MEMBERS_INTO_COMBAT = 0x00000002,
+ CREATURE_DIFFICULTYFLAGS_2_UNK2 = 0x00000004,
+ CREATURE_DIFFICULTYFLAGS_2_SPELL_ATTACKABLE = 0x00000008, // CREATURE_TYPEFLAGS_SPELL_ATTACKABLE
+ CREATURE_DIFFICULTYFLAGS_2_UNK3 = 0x00000010,
+ CREATURE_DIFFICULTYFLAGS_2_UNK4 = 0x00000020,
+ CREATURE_DIFFICULTYFLAGS_2_UNK5 = 0x00000040,
+ CREATURE_DIFFICULTYFLAGS_2_UNK6 = 0x00000080,
+ CREATURE_DIFFICULTYFLAGS_2_UNK7 = 0x00000100,
+ CREATURE_DIFFICULTYFLAGS_2_UNK8 = 0x00000200,
+ CREATURE_DIFFICULTYFLAGS_2_UNK9 = 0x00000400,
+ CREATURE_DIFFICULTYFLAGS_2_DEAD_INTERACT = 0x00000800, // CREATURE_TYPEFLAGS_DEAD_INTERACT
+ CREATURE_DIFFICULTYFLAGS_2_UNK10 = 0x00001000,
+ CREATURE_DIFFICULTYFLAGS_2_UNK11 = 0x00002000,
+ CREATURE_DIFFICULTYFLAGS_2_HERBLOOT = 0x00004000, // CREATURE_TYPEFLAGS_HERBLOOT
+ CREATURE_DIFFICULTYFLAGS_2_MININGLOOT = 0x00008000, // CREATURE_TYPEFLAGS_MININGLOOT
+ CREATURE_DIFFICULTYFLAGS_2_DONT_LOG_DEATH = 0x00010000, // CREATURE_TYPEFLAGS_DONT_LOG_DEATH
+ CREATURE_DIFFICULTYFLAGS_2_UNK12 = 0x00020000,
+ CREATURE_DIFFICULTYFLAGS_2_MOUNTED_COMBAT = 0x00040000, // CREATURE_TYPEFLAGS_MOUNTED_COMBAT
+ CREATURE_DIFFICULTYFLAGS_2_UNK13 = 0x00080000,
+ CREATURE_DIFFICULTYFLAGS_2_UNK14 = 0x00100000, // This flag seems similar to CREATURE_DIFFICULTYFLAGS_IGNORE_COMBAT
+ CREATURE_DIFFICULTYFLAGS_2_UNK15 = 0x00200000,
+ CREATURE_DIFFICULTYFLAGS_2_UNK16 = 0x00400000,
+ CREATURE_DIFFICULTYFLAGS_2_UNK17 = 0x00800000,
+ CREATURE_DIFFICULTYFLAGS_2_UNK18 = 0x01000000,
+ CREATURE_DIFFICULTYFLAGS_2_HIDE_BODY = 0x02000000, // UNIT_FLAG2_UNK1
+ CREATURE_DIFFICULTYFLAGS_2_UNK19 = 0x04000000,
+ CREATURE_DIFFICULTYFLAGS_2_SERVER_ONLY = 0x08000000,
+ CREATURE_DIFFICULTYFLAGS_2_CAN_SAFE_FALL = 0x10000000,
+ CREATURE_DIFFICULTYFLAGS_2_CAN_ASSIST = 0x20000000, // CREATURE_TYPEFLAGS_CAN_ASSIST
+ CREATURE_DIFFICULTYFLAGS_2_KEEP_HEALTH_POINTS_AT_RESET = 0x40000000,
+ CREATURE_DIFFICULTYFLAGS_2_IS_PET_BAR_USED = 0x80000000 // CREATURE_TYPEFLAGS_IS_PET_BAR_USED
+};
+
+enum CreatureDifficultyFlags3
+{
+ CREATURE_DIFFICULTYFLAGS_3_UNK1 = 0x00000001,
+ CREATURE_DIFFICULTYFLAGS_3_UNK2 = 0x00000002,
+ CREATURE_DIFFICULTYFLAGS_3_INSTANTLY_APPEAR_MODEL = 0x00000004, // UNIT_FLAG2_INSTANTLY_APPEAR_MODEL
+ CREATURE_DIFFICULTYFLAGS_3_MASK_UID = 0x00000008, // CREATURE_TYPEFLAG_MASK_UID
+ CREATURE_DIFFICULTYFLAGS_3_ENGINEERLOOT = 0x00000010, // CREATURE_TYPEFLAGS_ENGINEERLOOT
+ CREATURE_DIFFICULTYFLAGS_3_UNK3 = 0x00000020,
+ CREATURE_DIFFICULTYFLAGS_3_UNK4 = 0x00000040,
+ CREATURE_DIFFICULTYFLAGS_3_UNK5 = 0x00000080,
+ CREATURE_DIFFICULTYFLAGS_3_CANNOT_SWIM = 0x00000100, // UNIT_FLAG_UNK_14
+ CREATURE_DIFFICULTYFLAGS_3_EXOTIC = 0x00000200, // CREATURE_TYPEFLAGS_EXOTIC
+ CREATURE_DIFFICULTYFLAGS_3_GIGANTIC_AOI = 0x00000400, // Since MoP, creatures with that flag have UnitFlags2 0x400000
+ CREATURE_DIFFICULTYFLAGS_3_INFINITE_AOI = 0x00000800, // Since MoP, creatures with that flag have UnitFlags2 0x40000000
+ CREATURE_DIFFICULTYFLAGS_3_WATERWALKING = 0x00001000,
+ CREATURE_DIFFICULTYFLAGS_3_HIDE_NAMEPLATE = 0x00002000, // CREATURE_TYPEFLAGS_HIDE_NAMEPLATE
+ CREATURE_DIFFICULTYFLAGS_3_UNK6 = 0x00004000,
+ CREATURE_DIFFICULTYFLAGS_3_UNK7 = 0x00008000,
+ CREATURE_DIFFICULTYFLAGS_3_USE_DEFAULT_COLLISION_BOX = 0x00010000, // CREATURE_TYPEFLAGS_USE_DEFAULT_COLLISION_BOX
+ CREATURE_DIFFICULTYFLAGS_3_UNK8 = 0x00020000,
+ CREATURE_DIFFICULTYFLAGS_3_IS_SIEGE_WEAPON = 0x00040000, // CREATURE_TYPEFLAGS_IS_SIEGE_WEAPON
+ CREATURE_DIFFICULTYFLAGS_3_UNK9 = 0x00080000,
+ CREATURE_DIFFICULTYFLAGS_3_UNK10 = 0x00100000,
+ CREATURE_DIFFICULTYFLAGS_3_UNK11 = 0x00200000,
+ CREATURE_DIFFICULTYFLAGS_3_PROJECTILE_COLLISION = 0x00400000, // CREATURE_TYPEFLAGS_PROJECTILE_COLLISION
+ CREATURE_DIFFICULTYFLAGS_3_CAN_BE_MULTITAPPED = 0x00800000,
+ CREATURE_DIFFICULTYFLAGS_3_DO_NOT_PLAY_MOUNTED_ANIMATIONS = 0x01000000, // CREATURE_TYPEFLAGS_DO_NOT_PLAY_MOUNTED_ANIMATIONS
+ CREATURE_DIFFICULTYFLAGS_3_DISABLE_TURN = 0x02000000, // UNIT_FLAG2_DISABLE_TURN
+ CREATURE_DIFFICULTYFLAGS_3_UNK12 = 0x04000000,
+ CREATURE_DIFFICULTYFLAGS_3_UNK13 = 0x08000000,
+ CREATURE_DIFFICULTYFLAGS_3_UNK14 = 0x10000000,
+ CREATURE_DIFFICULTYFLAGS_3_IS_LINK_ALL = 0x20000000, // CREATURE_TYPEFLAGS_IS_LINK_ALL
+ CREATURE_DIFFICULTYFLAGS_3_UNK15 = 0x40000000,
+ CREATURE_DIFFICULTYFLAGS_3_UNK16 = 0x80000000
+};
+
+enum CreatureDifficultyFlags4
+{
+ CREATURE_DIFFICULTYFLAGS_4_HAS_NO_BIRTH_ANIMATION = 0x00000001, // SMSG_UPDATE_OBJECT's "NoBirthAnim"
+ CREATURE_DIFFICULTYFLAGS_4_UNK1 = 0x00000002,
+ CREATURE_DIFFICULTYFLAGS_4_UNK2 = 0x00000004,
+ CREATURE_DIFFICULTYFLAGS_4_INTERACT_ONLY_WITH_CREATOR = 0x00000008, // CREATURE_TYPEFLAGS_INTERACT_ONLY_WITH_CREATOR
+ CREATURE_DIFFICULTYFLAGS_4_DO_NOT_PLAY_UNIT_EVENT_SOUNDS = 0x00000010, // CREATURE_TYPEFLAGS_DO_NOT_PLAY_UNIT_EVENT_SOUNDS
+ CREATURE_DIFFICULTYFLAGS_4_HAS_NO_SHADOW_BLOB = 0x00000020, // CREATURE_TYPEFLAGS_HAS_NO_SHADOW_BLOB
+ CREATURE_DIFFICULTYFLAGS_4_UNK3 = 0x00000040,
+ CREATURE_DIFFICULTYFLAGS_4_UNK4 = 0x00000080,
+ CREATURE_DIFFICULTYFLAGS_4_UNK5 = 0x00000100,
+ CREATURE_DIFFICULTYFLAGS_4_UNK6 = 0x00000200,
+ CREATURE_DIFFICULTYFLAGS_4_UNK7 = 0x00000400,
+ CREATURE_DIFFICULTYFLAGS_4_UNK8 = 0x00000800,
+ CREATURE_DIFFICULTYFLAGS_4_UNK9 = 0x00001000,
+ CREATURE_DIFFICULTYFLAGS_4_UNK10 = 0x00002000,
+ CREATURE_DIFFICULTYFLAGS_4_UNK11 = 0x00004000,
+ CREATURE_DIFFICULTYFLAGS_4_UFLAG2_UNK20 = 0x00008000, // UnitFlags2 0x100000
+ CREATURE_DIFFICULTYFLAGS_4_UNK12 = 0x00010000,
+ CREATURE_DIFFICULTYFLAGS_4_UNK13 = 0x00020000,
+ CREATURE_DIFFICULTYFLAGS_4_UNK14 = 0x00040000,
+ CREATURE_DIFFICULTYFLAGS_4_FORCE_GOSSIP = 0x00080000, // CREATURE_TYPEFLAGS_FORCE_GOSSIP
+ CREATURE_DIFFICULTYFLAGS_4_UNK15 = 0x00100000,
+ CREATURE_DIFFICULTYFLAGS_4_DO_NOT_SHEATHE = 0x00200000, // CREATURE_TYPEFLAGS_DO_NOT_SHEATHE
+ CREATURE_DIFFICULTYFLAGS_4_IGNORE_SPELL_MIN_RANGE_RESTRICTIONS = 0x00400000, // UnitFlags2 0x8000000
+ CREATURE_DIFFICULTYFLAGS_4_UNK16 = 0x00800000,
+ CREATURE_DIFFICULTYFLAGS_4_PREVENT_SWIM = 0x01000000, // UnitFlags2 0x1000000
+ CREATURE_DIFFICULTYFLAGS_4_HIDE_IN_COMBAT_LOG = 0x02000000, // UnitFlags2 0x2000000
+ CREATURE_DIFFICULTYFLAGS_4_UNK17 = 0x04000000,
+ CREATURE_DIFFICULTYFLAGS_4_UNK18 = 0x08000000,
+ CREATURE_DIFFICULTYFLAGS_4_UNK19 = 0x10000000,
+ CREATURE_DIFFICULTYFLAGS_4_DO_NOT_TARGET_ON_INTERACTION = 0x20000000, // CREATURE_TYPEFLAGS_DO_NOT_TARGET_ON_INTERACTION
+ CREATURE_DIFFICULTYFLAGS_4_DO_NOT_RENDER_OBJECT_NAME = 0x40000000, // CREATURE_TYPEFLAGS_DO_NOT_RENDER_OBJECT_NAME
+ CREATURE_DIFFICULTYFLAGS_4_UNIT_IS_QUEST_BOSS = 0x80000000 // CREATURE_TYPEFLAGS_UNIT_IS_QUEST_BOSS
+};
+
+enum CreatureDifficultyFlags5
+{
+ CREATURE_DIFFICULTYFLAGS_5_CANNOT_SWITCH_TARGETS = 0x00000001, // UnitFlags2 0x4000000
+ CREATURE_DIFFICULTYFLAGS_5_UNK1 = 0x00000002,
+ CREATURE_DIFFICULTYFLAGS_5_UFLAG2_UNK30 = 0x00000004, // UnitFlags2 0x10000000
+ CREATURE_DIFFICULTYFLAGS_5_UNK2 = 0x00000008,
+ CREATURE_DIFFICULTYFLAGS_5_UNK3 = 0x00000010,
+ CREATURE_DIFFICULTYFLAGS_5_UNK4 = 0x00000020,
+ CREATURE_DIFFICULTYFLAGS_5_UNK5 = 0x00000040,
+ CREATURE_DIFFICULTYFLAGS_5_UNK6 = 0x00000080,
+ CREATURE_DIFFICULTYFLAGS_5_CAN_INTERACT_EVEN_IF_HOSTILE = 0x00000100, // UNIT_FLAG2_ALLOW_ENEMY_INTERACT
+ CREATURE_DIFFICULTYFLAGS_5_UNK7 = 0x00000200,
+ CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK1 = 0x00000400, // CREATURE_TYPEFLAGS_2_UNK1
+ CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK2 = 0x00000800, // CREATURE_TYPEFLAGS_2_UNK2
+ CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK3 = 0x00001000, // CREATURE_TYPEFLAGS_2_UNK3
+ CREATURE_DIFFICULTYFLAGS_5_UFLAG2_UNK19 = 0x00002000, // UnitFlags2 0x80000
+ CREATURE_DIFFICULTYFLAGS_5_UNK8 = 0x00004000,
+ CREATURE_DIFFICULTYFLAGS_5_UNK9 = 0x00008000,
+ CREATURE_DIFFICULTYFLAGS_5_UNK10 = 0x00010000,
+ CREATURE_DIFFICULTYFLAGS_5_UNK11 = 0x00020000,
+ CREATURE_DIFFICULTYFLAGS_5_UNK12 = 0x00040000,
+ CREATURE_DIFFICULTYFLAGS_5_UNK13 = 0x00080000,
+ CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK4 = 0x00100000, // CREATURE_TYPEFLAGS_2_UNK4
+ CREATURE_DIFFICULTYFLAGS_5_UNK14 = 0x00200000,
+ CREATURE_DIFFICULTYFLAGS_5_UNK15 = 0x00400000,
+ CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK5 = 0x00800000, // CREATURE_TYPEFLAGS_2_UNK5
+ CREATURE_DIFFICULTYFLAGS_5_UNK16 = 0x01000000,
+ CREATURE_DIFFICULTYFLAGS_5_UNK17 = 0x02000000,
+ CREATURE_DIFFICULTYFLAGS_5_UNK18 = 0x04000000,
+ CREATURE_DIFFICULTYFLAGS_5_UNK19 = 0x08000000,
+ CREATURE_DIFFICULTYFLAGS_5_UNK20 = 0x10000000,
+ CREATURE_DIFFICULTYFLAGS_5_UNK21 = 0x20000000,
+ CREATURE_DIFFICULTYFLAGS_5_TFLAG2_UNK6 = 0x40000000, // CREATURE_TYPEFLAGS_2_UNK6
+ CREATURE_DIFFICULTYFLAGS_5_UNK22 = 0x80000000
+};
+
+enum CreatureDifficultyFlags6
+{
+ CREATURE_DIFFICULTYFLAGS_6_UNK1 = 0x00000001,
+ CREATURE_DIFFICULTYFLAGS_6_UNK2 = 0x00000002,
+ CREATURE_DIFFICULTYFLAGS_6_UNK3 = 0x00000004,
+ CREATURE_DIFFICULTYFLAGS_6_UNK4 = 0x00000008,
+ CREATURE_DIFFICULTYFLAGS_6_UNK5 = 0x00000010,
+ CREATURE_DIFFICULTYFLAGS_6_UNK6 = 0x00000020,
+ CREATURE_DIFFICULTYFLAGS_6_UNK7 = 0x00000040,
+ CREATURE_DIFFICULTYFLAGS_6_TFLAG2_UNK7 = 0x00000080,
+ CREATURE_DIFFICULTYFLAGS_6_UNK8 = 0x00000100,
+ CREATURE_DIFFICULTYFLAGS_6_UNK9 = 0x00000200,
+ CREATURE_DIFFICULTYFLAGS_6_UNK10 = 0x00000400,
+ CREATURE_DIFFICULTYFLAGS_6_UNK11 = 0x00000800,
+ CREATURE_DIFFICULTYFLAGS_6_UNK12 = 0x00001000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK13 = 0x00002000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK14 = 0x00004000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK15 = 0x00008000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK16 = 0x00010000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK17 = 0x00020000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK18 = 0x00040000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK19 = 0x00080000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK20 = 0x00100000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK21 = 0x00200000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK22 = 0x00400000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK23 = 0x00800000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK24 = 0x01000000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK25 = 0x02000000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK26 = 0x04000000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK27 = 0x08000000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK28 = 0x10000000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK29 = 0x20000000,
+ CREATURE_DIFFICULTYFLAGS_6_UNK30 = 0x40000000,
+ CREATURE_DIFFICULTYFLAGS_6_TFLAG2_UNK14 = 0x80000000
+};
+
+enum CreatureDifficultyFlags7
+{
+ CREATURE_DIFFICULTYFLAGS_7_TFLAG2_UNK15 = 0x00000001,
+ CREATURE_DIFFICULTYFLAGS_7_TFLAG2_UNK16 = 0x00000002,
+ CREATURE_DIFFICULTYFLAGS_7_TFLAG2_UNK17 = 0x00000004,
+ CREATURE_DIFFICULTYFLAGS_7_UNK1 = 0x00000008
+};
+
+enum CreatureFlagsExtra
+{
+ CREATURE_FLAG_EXTRA_INSTANCE_BIND = 0x00000001, // creature kill bind instance with killer and killer's group
+ CREATURE_FLAG_EXTRA_CIVILIAN = 0x00000002, // not aggro (ignore faction/reputation hostility)
+ CREATURE_FLAG_EXTRA_NO_PARRY = 0x00000004, // creature can't parry
+ CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN = 0x00000008, // creature can't counter-attack at parry
+ CREATURE_FLAG_EXTRA_NO_BLOCK = 0x00000010, // creature can't block
+ CREATURE_FLAG_EXTRA_NO_CRUSH = 0x00000020, // creature can't do crush attacks
+ CREATURE_FLAG_EXTRA_NO_XP_AT_KILL = 0x00000040, // creature kill not provide XP
+ CREATURE_FLAG_EXTRA_TRIGGER = 0x00000080, // trigger creature
+ CREATURE_FLAG_EXTRA_NO_TAUNT = 0x00000100, // creature is immune to taunt auras and effect attack me
+ CREATURE_FLAG_EXTRA_WORLDEVENT = 0x00004000, // custom flag for world event creatures (left room for merging)
+ CREATURE_FLAG_EXTRA_GUARD = 0x00008000, // Creature is guard
+ CREATURE_FLAG_EXTRA_NO_CRIT = 0x00020000, // creature can't do critical strikes
+ CREATURE_FLAG_EXTRA_NO_SKILLGAIN = 0x00040000, // creature won't increase weapon skills
+ CREATURE_FLAG_EXTRA_TAUNT_DIMINISH = 0x00080000, // Taunt is a subject to diminishing returns on this creautre
+ CREATURE_FLAG_EXTRA_ALL_DIMINISH = 0x00100000, // creature is subject to all diminishing returns as player are
+ CREATURE_FLAG_EXTRA_NO_PLAYER_DAMAGE_REQ = 0x00200000, // creature does not need to take player damage for kill credit
+ CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000, // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB)
+ CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING = 0x20000000, // creature ignore pathfinding
+ CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK = 0x40000000 // creature is immune to knockback effects
+};
+
+#define CREATURE_FLAG_EXTRA_DB_ALLOWED (CREATURE_FLAG_EXTRA_INSTANCE_BIND | CREATURE_FLAG_EXTRA_CIVILIAN | \
+ CREATURE_FLAG_EXTRA_NO_PARRY | CREATURE_FLAG_EXTRA_NO_PARRY_HASTEN | CREATURE_FLAG_EXTRA_NO_BLOCK | \
+ CREATURE_FLAG_EXTRA_NO_CRUSH | CREATURE_FLAG_EXTRA_NO_XP_AT_KILL | CREATURE_FLAG_EXTRA_TRIGGER | \
+ CREATURE_FLAG_EXTRA_NO_TAUNT | CREATURE_FLAG_EXTRA_WORLDEVENT | CREATURE_FLAG_EXTRA_NO_CRIT | \
+ CREATURE_FLAG_EXTRA_NO_SKILLGAIN | CREATURE_FLAG_EXTRA_TAUNT_DIMINISH | CREATURE_FLAG_EXTRA_ALL_DIMINISH | \
+ CREATURE_FLAG_EXTRA_GUARD | CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING | CREATURE_FLAG_EXTRA_NO_PLAYER_DAMAGE_REQ | CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK)
+
+const uint32 CREATURE_REGEN_INTERVAL = 2 * IN_MILLISECONDS;
+const uint32 CREATURE_NOPATH_EVADE_TIME = 5 * IN_MILLISECONDS;
+
+const uint8 MAX_KILL_CREDIT = 2;
+const uint32 MAX_CREATURE_MODELS = 4;
+const uint32 MAX_CREATURE_NAMES = 4;
+const uint32 MAX_CREATURE_SPELLS = 8;
+const uint32 MAX_CREATURE_DIFFICULTIES = 3;
+
+// from `creature_template` table
+struct TC_GAME_API CreatureTemplate
+{
+ uint32 Entry;
+ uint32 DifficultyEntry[MAX_CREATURE_DIFFICULTIES];
+ uint32 KillCredit[MAX_KILL_CREDIT];
+ uint32 Modelid1;
+ uint32 Modelid2;
+ uint32 Modelid3;
+ uint32 Modelid4;
+ std::string Name;
+ std::string FemaleName;
+ std::string SubName;
+ std::string IconName;
+ uint32 GossipMenuId;
+ int16 minlevel;
+ int16 maxlevel;
+ int32 HealthScalingExpansion;
+ uint32 RequiredExpansion;
+ uint32 VignetteID; /// @todo Read Vignette.db2
+ uint32 faction;
+ uint64 npcflag;
+ float speed_walk;
+ float speed_run;
+ float scale;
+ uint32 rank;
+ uint32 dmgschool;
+ uint32 BaseAttackTime;
+ uint32 RangeAttackTime;
+ float BaseVariance;
+ float RangeVariance;
+ uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures.
+ uint32 unit_flags; // enum UnitFlags mask values
+ uint32 unit_flags2; // enum UnitFlags2 mask values
+ uint32 unit_flags3; // enum UnitFlags3 mask values
+ uint32 dynamicflags;
+ CreatureFamily family; // enum CreatureFamily values (optional)
+ uint32 trainer_type;
+ uint32 trainer_class;
+ uint32 trainer_race;
+ uint32 type; // enum CreatureType values
+ uint32 type_flags; // enum CreatureTypeFlags mask values
+ uint32 type_flags2; // unknown enum, only set for 4 creatures (with value 1)
+ uint32 lootid;
+ uint32 pickpocketLootId;
+ uint32 SkinLootId;
+ int32 resistance[MAX_SPELL_SCHOOL];
+ uint32 spells[MAX_CREATURE_SPELLS];
+ uint32 VehicleId;
+ uint32 mingold;
+ uint32 maxgold;
+ std::string AIName;
+ uint32 MovementType;
+ uint32 InhabitType;
+ float HoverHeight;
+ float ModHealth;
+ float ModHealthExtra;
+ float ModMana;
+ float ModManaExtra; // Added in 4.x, this value is usually 2 for a small group of creatures with double mana
+ float ModArmor;
+ float ModDamage;
+ float ModExperience;
+ bool RacialLeader;
+ uint32 movementId;
+ bool RegenHealth;
+ uint32 MechanicImmuneMask;
+ uint32 flags_extra;
+ uint32 ScriptID;
+ uint32 GetRandomValidModelId() const;
+ uint32 GetFirstValidModelId() const;
+ uint32 GetFirstInvisibleModel() const;
+ uint32 GetFirstVisibleModel() const;
+
+ // helpers
+ SkillType GetRequiredLootSkill() const
+ {
+ if (type_flags & CREATURE_TYPE_FLAG_HERB_SKINNING_SKILL)
+ return SKILL_HERBALISM;
+ else if (type_flags & CREATURE_TYPE_FLAG_MINING_SKINNING_SKILL)
+ return SKILL_MINING;
+ else if (type_flags & CREATURE_TYPE_FLAG_ENGINEERING_SKINNING_SKILL)
+ return SKILL_ENGINEERING;
+ else
+ return SKILL_SKINNING; // normal case
+ }
+
+ bool IsExotic() const
+ {
+ return (type_flags & CREATURE_TYPE_FLAG_EXOTIC_PET) != 0;
+ }
+
+ bool IsTameable(bool canTameExotic) const
+ {
+ if (type != CREATURE_TYPE_BEAST || family == CREATURE_FAMILY_NONE || (type_flags & CREATURE_TYPE_FLAG_TAMEABLE_PET) == 0)
+ return false;
+
+ // if can tame exotic then can tame any tameable
+ return canTameExotic || !IsExotic();
+ }
+
+ static int32 DifficultyIDToDifficultyEntryIndex(uint32 difficulty)
+ {
+ switch (difficulty)
+ {
+ case DIFFICULTY_NONE:
+ case DIFFICULTY_NORMAL:
+ case DIFFICULTY_10_N:
+ case DIFFICULTY_40:
+ case DIFFICULTY_3_MAN_SCENARIO_N:
+ case DIFFICULTY_NORMAL_RAID:
+ return -1;
+ case DIFFICULTY_HEROIC:
+ case DIFFICULTY_25_N:
+ case DIFFICULTY_3_MAN_SCENARIO_HC:
+ case DIFFICULTY_HEROIC_RAID:
+ return 0;
+ case DIFFICULTY_10_HC:
+ case DIFFICULTY_MYTHIC_KEYSTONE:
+ case DIFFICULTY_MYTHIC_RAID:
+ return 1;
+ case DIFFICULTY_25_HC:
+ return 2;
+ case DIFFICULTY_LFR:
+ case DIFFICULTY_LFR_NEW:
+ case DIFFICULTY_EVENT_RAID:
+ case DIFFICULTY_EVENT_DUNGEON:
+ case DIFFICULTY_EVENT_SCENARIO:
+ default:
+ return -1;
+ }
+ }
+};
+
+#pragma pack(push, 1)
+
+// Defines base stats for creatures (used to calculate HP/mana/armor/attackpower/rangedattackpower/all damage).
+struct TC_GAME_API CreatureBaseStats
+{
+ uint32 BaseHealth[MAX_EXPANSIONS];
+ uint32 BaseMana;
+ uint32 BaseArmor;
+ uint32 AttackPower;
+ uint32 RangedAttackPower;
+ float BaseDamage[MAX_EXPANSIONS];
+
+ // Helpers
+
+ uint32 GenerateHealth(CreatureTemplate const* info) const
+ {
+ return uint32(ceil(BaseHealth[info->HealthScalingExpansion] * info->ModHealth * info->ModHealthExtra));
+ }
+
+ uint32 GenerateMana(CreatureTemplate const* info) const
+ {
+ // Mana can be 0.
+ if (!BaseMana)
+ return 0;
+
+ return uint32(ceil(BaseMana * info->ModMana * info->ModManaExtra));
+ }
+
+ uint32 GenerateArmor(CreatureTemplate const* info) const
+ {
+ return uint32(ceil(BaseArmor * info->ModArmor));
+ }
+
+ float GenerateBaseDamage(CreatureTemplate const* info) const
+ {
+ return BaseDamage[info->HealthScalingExpansion];
+ }
+
+ static CreatureBaseStats const* GetBaseStats(uint8 level, uint8 unitClass);
+};
+
+struct CreatureLocale
+{
+ std::vector<std::string> Name;
+ std::vector<std::string> NameAlt;
+ std::vector<std::string> Title;
+ std::vector<std::string> TitleAlt;
+};
+
+struct EquipmentItem
+{
+ uint32 ItemId = 0;
+ uint16 AppearanceModId = 0;
+ uint16 ItemVisual = 0;
+};
+
+struct EquipmentInfo
+{
+ EquipmentItem Items[MAX_EQUIPMENT_ITEMS];
+};
+
+// from `creature` table
+struct CreatureData
+{
+ CreatureData() : id(0), mapid(0), phaseMask(0), displayid(0), equipmentId(0),
+ posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0),
+ spawndist(0.0f), currentwaypoint(0), curhealth(0), curmana(0), movementType(0),
+ spawnMask(0), npcflag(0), unit_flags(0), unit_flags2(0), unit_flags3(0), dynamicflags(0),
+ phaseid(0), phaseGroup(0), dbData(true) { }
+ uint32 id; // entry in creature_template
+ uint16 mapid;
+ uint32 phaseMask;
+ uint32 displayid;
+ int8 equipmentId;
+ float posX;
+ float posY;
+ float posZ;
+ float orientation;
+ uint32 spawntimesecs;
+ float spawndist;
+ uint32 currentwaypoint;
+ uint32 curhealth;
+ uint32 curmana;
+ uint8 movementType;
+ uint32 spawnMask;
+ uint64 npcflag;
+ uint32 unit_flags; // enum UnitFlags mask values
+ uint32 unit_flags2; // enum UnitFlags2 mask values
+ uint32 unit_flags3; // enum UnitFlags3 mask values
+ uint32 dynamicflags;
+ uint32 phaseid;
+ uint32 phaseGroup;
+ uint32 ScriptId;
+ bool dbData;
+};
+
+struct CreatureModelInfo
+{
+ float bounding_radius;
+ float combat_reach;
+ int8 gender;
+ uint32 displayId_other_gender;
+ bool is_trigger;
+};
+
+enum InhabitTypeValues
+{
+ INHABIT_GROUND = 1,
+ INHABIT_WATER = 2,
+ INHABIT_AIR = 4,
+ INHABIT_ROOT = 8,
+ INHABIT_ANYWHERE = INHABIT_GROUND | INHABIT_WATER | INHABIT_AIR | INHABIT_ROOT
+};
+
+#pragma pack(pop)
+
+// `creature_addon` table
+struct CreatureAddon
+{
+ uint32 path_id;
+ uint32 mount;
+ uint32 bytes1;
+ uint32 bytes2;
+ uint32 emote;
+ uint16 aiAnimKit;
+ uint16 movementAnimKit;
+ uint16 meleeAnimKit;
+ std::vector<uint32> auras;
+};
+
+// Vendors
+struct VendorItem
+{
+ VendorItem(uint32 _item, int32 _maxcount, uint32 _incrtime, uint32 _ExtendedCost, uint8 _Type)
+ : item(_item), maxcount(_maxcount), incrtime(_incrtime), ExtendedCost(_ExtendedCost), Type(_Type) { }
+
+ uint32 item;
+ uint32 maxcount; // 0 for infinity item amount
+ uint32 incrtime; // time for restore items amount if maxcount != 0
+ uint32 ExtendedCost;
+ uint8 Type;
+
+ //helpers
+ bool IsGoldRequired(ItemTemplate const* pProto) const;
+};
+
+struct VendorItemData
+{
+ std::vector<VendorItem> m_items;
+
+ VendorItem const* GetItem(uint32 slot) const
+ {
+ if (slot >= m_items.size())
+ return nullptr;
+
+ return &m_items[slot];
+ }
+ bool Empty() const { return m_items.empty(); }
+ uint32 GetItemCount() const { return uint32(m_items.size()); }
+ void AddItem(uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, uint8 type)
+ {
+ m_items.emplace_back(item, maxcount, ptime, ExtendedCost, type);
+ }
+ bool RemoveItem(uint32 item_id, uint8 type);
+ VendorItem const* FindItemCostPair(uint32 item_id, uint32 extendedCost, uint8 type) const;
+ void Clear()
+ {
+ m_items.clear();
+ }
+};
+
+#define MAX_TRAINERSPELL_ABILITY_REQS 3
+
+struct TrainerSpell
+{
+ TrainerSpell() : SpellID(0), MoneyCost(0), ReqSkillLine(0), ReqSkillRank(0), ReqLevel(0), Index(0)
+ {
+ for (uint8 i = 0; i < MAX_TRAINERSPELL_ABILITY_REQS; ++i)
+ ReqAbility[i] = 0;
+ }
+
+ uint32 SpellID;
+ uint32 MoneyCost;
+ uint32 ReqSkillLine;
+ uint32 ReqSkillRank;
+ uint32 ReqLevel;
+ uint32 ReqAbility[MAX_TRAINERSPELL_ABILITY_REQS];
+ uint32 Index;
+
+ // helpers
+ bool IsCastable() const { return ReqAbility[0] != SpellID; }
+};
+
+typedef std::unordered_map<uint32 /*spellid*/, TrainerSpell> TrainerSpellMap;
+
+struct TC_GAME_API TrainerSpellData
+{
+ TrainerSpellData() : trainerType(0) { }
+ ~TrainerSpellData() { spellList.clear(); }
+
+ TrainerSpellMap spellList;
+ uint32 trainerType; // trainer type based at trainer spells, can be different from creature_template value.
+ // req. for correct show non-prof. trainers like weaponmaster, allowed values 0 and 2.
+ TrainerSpell const* Find(uint32 spell_id) const;
+};
+
+#endif // CreatureData_h__
diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp
index e92506f3a9a..de677d44329 100644
--- a/src/server/game/Entities/Creature/CreatureGroups.cpp
+++ b/src/server/game/Entities/Creature/CreatureGroups.cpp
@@ -21,6 +21,8 @@
#include "CreatureAI.h"
#include "DatabaseEnv.h"
#include "Log.h"
+#include "Map.h"
+#include "MotionMaster.h"
#include "ObjectMgr.h"
#define MAX_DESYNC 5.0f
diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp
index 26b0509f13f..8a3b83f2aa1 100644
--- a/src/server/game/Entities/Creature/GossipDef.cpp
+++ b/src/server/game/Entities/Creature/GossipDef.cpp
@@ -17,12 +17,16 @@
*/
#include "GossipDef.h"
-#include "Formulas.h"
+#include "Creature.h"
+#include "DB2Stores.h"
#include "Log.h"
#include "NPCPackets.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
+#include "Player.h"
#include "QuestDef.h"
#include "QuestPackets.h"
+#include "World.h"
#include "WorldSession.h"
GossipMenu::GossipMenu()
diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp
index c31cec6dee3..5d2d56c9d09 100644
--- a/src/server/game/Entities/Creature/TemporarySummon.cpp
+++ b/src/server/game/Entities/Creature/TemporarySummon.cpp
@@ -16,11 +16,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "TemporarySummon.h"
+#include "CreatureAI.h"
+#include "DB2Structure.h"
#include "Log.h"
+#include "Map.h"
#include "ObjectAccessor.h"
-#include "CreatureAI.h"
-#include "ObjectMgr.h"
-#include "TemporarySummon.h"
#include "Pet.h"
#include "Player.h"
@@ -252,7 +253,7 @@ void TempSummon::UnSummon(uint32 msTime)
//ASSERT(!IsPet());
if (IsPet())
{
- ((Pet*)this)->Remove(PET_SAVE_NOT_IN_SLOT);
+ ToPet()->Remove(PET_SAVE_NOT_IN_SLOT);
ASSERT(!IsInWorld());
return;
}
diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h
index 20050617c03..e919f6647bb 100644
--- a/src/server/game/Entities/Creature/TemporarySummon.h
+++ b/src/server/game/Entities/Creature/TemporarySummon.h
@@ -21,21 +21,7 @@
#include "Creature.h"
-enum SummonerType
-{
- SUMMONER_TYPE_CREATURE = 0,
- SUMMONER_TYPE_GAMEOBJECT = 1,
- SUMMONER_TYPE_MAP = 2
-};
-
-/// Stores data for temp summons
-struct TempSummonData
-{
- uint32 entry; ///< Entry of summoned creature
- Position pos; ///< Position, where should be creature spawned
- TempSummonType type; ///< Summon type, see TempSummonType for available types
- uint32 time; ///< Despawn time, usable only with certain temp summon types
-};
+struct SummonPropertiesEntry;
class TC_GAME_API TempSummon : public Creature
{
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
index 3a2708e80fe..1e3a6b85343 100644
--- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp
@@ -16,13 +16,19 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "DynamicObject.h"
#include "Common.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
#include "Log.h"
+#include "Map.h"
#include "ObjectAccessor.h"
+#include "Player.h"
#include "ScriptMgr.h"
+#include "SpellAuras.h"
+#include "SpellInfo.h"
+#include "SpellMgr.h"
#include "Transport.h"
+#include "Unit.h"
+#include "UpdateData.h"
#include "World.h"
DynamicObject::DynamicObject(bool isWorldObject) : WorldObject(isWorldObject),
@@ -236,3 +242,8 @@ void DynamicObject::UnbindFromCaster()
_caster->_UnregisterDynObject(this);
_caster = NULL;
}
+
+SpellInfo const* DynamicObject::GetSpellInfo() const
+{
+ return sSpellMgr->GetSpellInfo(GetSpellId());
+}
diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.h b/src/server/game/Entities/DynamicObject/DynamicObject.h
index aa3af92ed31..ee2ad1022e2 100644
--- a/src/server/game/Entities/DynamicObject/DynamicObject.h
+++ b/src/server/game/Entities/DynamicObject/DynamicObject.h
@@ -56,6 +56,7 @@ class TC_GAME_API DynamicObject : public WorldObject, public GridObject<DynamicO
void BindToCaster();
void UnbindFromCaster();
uint32 GetSpellId() const { return GetUInt32Value(DYNAMICOBJECT_SPELLID); }
+ SpellInfo const* GetSpellInfo() const;
ObjectGuid GetCasterGUID() const { return GetGuidValue(DYNAMICOBJECT_CASTER); }
float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); }
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 4bb4901823a..42eb2cbe3f7 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -28,9 +28,11 @@
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "GroupMgr.h"
+#include "Item.h"
#include "Log.h"
#include "LootMgr.h"
#include "MiscPackets.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "OutdoorPvPMgr.h"
#include "PoolMgr.h"
@@ -41,6 +43,17 @@
#include "World.h"
#include <G3D/Quat.h>
+bool QuaternionData::isUnit() const
+{
+ return fabs(x * x + y * y + z * z + w * w - 1.0f) < 1e-5;
+}
+
+QuaternionData QuaternionData::fromEulerAnglesZYX(float Z, float Y, float X)
+{
+ G3D::Quat quat(G3D::Matrix3::fromEulerAnglesZYX(Z, Y, X));
+ return QuaternionData(quat.x, quat.y, quat.z, quat.w);
+}
+
GameObject::GameObject() : WorldObject(false), MapObject(),
m_model(nullptr), m_goValue(), m_AI(nullptr), _animKitId(0)
{
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 0e225bf5faa..e55f74c4b2b 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -19,820 +19,21 @@
#ifndef TRINITYCORE_GAMEOBJECT_H
#define TRINITYCORE_GAMEOBJECT_H
-#include "Common.h"
-#include "SharedDefines.h"
#include "Object.h"
-#include "Loot.h"
#include "DatabaseEnvFwd.h"
+#include "GameObjectData.h"
+#include "Loot.h"
#include "MapObject.h"
+#include "SharedDefines.h"
class GameObjectAI;
+class GameObjectModel;
class Group;
-class Transport;
-enum TriggerCastFlags : uint32;
-
-// from `gameobject_template`
-struct GameObjectTemplate
-{
- uint32 entry;
- uint32 type;
- uint32 displayId;
- std::string name;
- std::string IconName;
- std::string castBarCaption;
- std::string unk1;
- float size;
- int32 RequiredLevel;
- union
- {
- // 0 GAMEOBJECT_TYPE_DOOR
- struct
- {
- uint32 startOpen; // 0 startOpen, enum { false, true, }; Default: false
- uint32 open; // 1 open, References: Lock_, NoValue = 0
- uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 3000
- uint32 noDamageImmune; // 3 noDamageImmune, enum { false, true, }; Default: false
- uint32 openTextID; // 4 openTextID, References: BroadcastText, NoValue = 0
- uint32 closeTextID; // 5 closeTextID, References: BroadcastText, NoValue = 0
- uint32 IgnoredByPathing; // 6 Ignored By Pathing, enum { false, true, }; Default: false
- uint32 conditionID1; // 7 conditionID1, References: PlayerCondition, NoValue = 0
- uint32 DoorisOpaque; // 8 Door is Opaque (Disable portal on close), enum { false, true, }; Default: true
- uint32 GiganticAOI; // 9 Gigantic AOI, enum { false, true, }; Default: false
- uint32 InfiniteAOI; // 10 Infinite AOI, enum { false, true, }; Default: false
- } door;
- // 1 GAMEOBJECT_TYPE_BUTTON
- struct
- {
- uint32 startOpen; // 0 startOpen, enum { false, true, }; Default: false
- uint32 open; // 1 open, References: Lock_, NoValue = 0
- uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 3000
- uint32 linkedTrap; // 3 linkedTrap, References: GameObjects, NoValue = 0
- uint32 noDamageImmune; // 4 noDamageImmune, enum { false, true, }; Default: false
- uint32 GiganticAOI; // 5 Gigantic AOI, enum { false, true, }; Default: false
- uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0
- uint32 closeTextID; // 7 closeTextID, References: BroadcastText, NoValue = 0
- uint32 requireLOS; // 8 require LOS, enum { false, true, }; Default: false
- uint32 conditionID1; // 9 conditionID1, References: PlayerCondition, NoValue = 0
- } button;
- // 2 GAMEOBJECT_TYPE_QUESTGIVER
- struct
- {
- uint32 open; // 0 open, References: Lock_, NoValue = 0
- uint32 questGiver; // 1 questGiver, References: QuestGiver, NoValue = 0
- uint32 pageMaterial; // 2 pageMaterial, References: PageTextMaterial, NoValue = 0
- uint32 gossipID; // 3 gossipID, References: Gossip, NoValue = 0
- uint32 customAnim; // 4 customAnim, int, Min value: 0, Max value: 4, Default value: 0
- uint32 noDamageImmune; // 5 noDamageImmune, enum { false, true, }; Default: false
- uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0
- uint32 requireLOS; // 7 require LOS, enum { false, true, }; Default: false
- uint32 allowMounted; // 8 allowMounted, enum { false, true, }; Default: false
- uint32 GiganticAOI; // 9 Gigantic AOI, enum { false, true, }; Default: false
- uint32 conditionID1; // 10 conditionID1, References: PlayerCondition, NoValue = 0
- uint32 NeverUsableWhileMounted; // 11 Never Usable While Mounted, enum { false, true, }; Default: false
- } questgiver;
- // 3 GAMEOBJECT_TYPE_CHEST
- struct
- {
- uint32 open; // 0 open, References: Lock_, NoValue = 0
- uint32 chestLoot; // 1 chestLoot, References: Treasure, NoValue = 0
- uint32 chestRestockTime; // 2 chestRestockTime, int, Min value: 0, Max value: 1800000, Default value: 0
- uint32 consumable; // 3 consumable, enum { false, true, }; Default: false
- uint32 minRestock; // 4 minRestock, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 maxRestock; // 5 maxRestock, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 triggeredEvent; // 6 triggeredEvent, References: GameEvents, NoValue = 0
- uint32 linkedTrap; // 7 linkedTrap, References: GameObjects, NoValue = 0
- uint32 questID; // 8 questID, References: QuestV2, NoValue = 0
- uint32 level; // 9 level, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 requireLOS; // 10 require LOS, enum { false, true, }; Default: false
- uint32 leaveLoot; // 11 leaveLoot, enum { false, true, }; Default: false
- uint32 notInCombat; // 12 notInCombat, enum { false, true, }; Default: false
- uint32 logloot; // 13 log loot, enum { false, true, }; Default: false
- uint32 openTextID; // 14 openTextID, References: BroadcastText, NoValue = 0
- uint32 usegrouplootrules; // 15 use group loot rules, enum { false, true, }; Default: false
- uint32 floatingTooltip; // 16 floatingTooltip, enum { false, true, }; Default: false
- uint32 conditionID1; // 17 conditionID1, References: PlayerCondition, NoValue = 0
- int32 xpLevel; // 18 xpLevel, int, Min value: -1, Max value: 123, Default value: 0
- uint32 xpDifficulty; // 19 xpDifficulty, enum { No Exp, Trivial, Very Small, Small, Substandard, Standard, High, Epic, Dungeon, 5, }; Default: No Exp
- uint32 lootLevel; // 20 lootLevel, int, Min value: 0, Max value: 123, Default value: 0
- uint32 GroupXP; // 21 Group XP, enum { false, true, }; Default: false
- uint32 DamageImmuneOK; // 22 Damage Immune OK, enum { false, true, }; Default: false
- uint32 trivialSkillLow; // 23 trivialSkillLow, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 trivialSkillHigh; // 24 trivialSkillHigh, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 DungeonEncounter; // 25 Dungeon Encounter, References: DungeonEncounter, NoValue = 0
- uint32 spell; // 26 spell, References: Spell, NoValue = 0
- uint32 GiganticAOI; // 27 Gigantic AOI, enum { false, true, }; Default: false
- uint32 LargeAOI; // 28 Large AOI, enum { false, true, }; Default: false
- uint32 SpawnVignette; // 29 Spawn Vignette, References: vignette, NoValue = 0
- uint32 chestPersonalLoot; // 30 chest Personal Loot, References: Treasure, NoValue = 0
- uint32 turnpersonallootsecurityoff; // 31 turn personal loot security off, enum { false, true, }; Default: false
- uint32 ChestProperties; // 32 Chest Properties, References: ChestProperties, NoValue = 0
- } chest;
- // 4 GAMEOBJECT_TYPE_BINDER
- struct
- {
- } binder;
- // 5 GAMEOBJECT_TYPE_GENERIC
- struct
- {
- uint32 floatingTooltip; // 0 floatingTooltip, enum { false, true, }; Default: false
- uint32 highlight; // 1 highlight, enum { false, true, }; Default: true
- uint32 serverOnly; // 2 serverOnly, enum { false, true, }; Default: false
- uint32 GiganticAOI; // 3 Gigantic AOI, enum { false, true, }; Default: false
- uint32 floatOnWater; // 4 floatOnWater, enum { false, true, }; Default: false
- uint32 questID; // 5 questID, References: QuestV2, NoValue = 0
- uint32 conditionID1; // 6 conditionID1, References: PlayerCondition, NoValue = 0
- uint32 LargeAOI; // 7 Large AOI, enum { false, true, }; Default: false
- uint32 UseGarrisonOwnerGuildColors; // 8 Use Garrison Owner Guild Colors, enum { false, true, }; Default: false
- } generic;
- // 6 GAMEOBJECT_TYPE_TRAP
- struct
- {
- uint32 open; // 0 open, References: Lock_, NoValue = 0
- uint32 level; // 1 level, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 radius; // 2 radius, int, Min value: 0, Max value: 100, Default value: 0
- uint32 spell; // 3 spell, References: Spell, NoValue = 0
- uint32 charges; // 4 charges, int, Min value: 0, Max value: 65535, Default value: 1
- uint32 cooldown; // 5 cooldown, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 autoClose; // 6 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
- uint32 startDelay; // 7 startDelay, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 serverOnly; // 8 serverOnly, enum { false, true, }; Default: false
- uint32 stealthed; // 9 stealthed, enum { false, true, }; Default: false
- uint32 GiganticAOI; // 10 Gigantic AOI, enum { false, true, }; Default: false
- uint32 stealthAffected; // 11 stealthAffected, enum { false, true, }; Default: false
- uint32 openTextID; // 12 openTextID, References: BroadcastText, NoValue = 0
- uint32 closeTextID; // 13 closeTextID, References: BroadcastText, NoValue = 0
- uint32 IgnoreTotems; // 14 Ignore Totems, enum { false, true, }; Default: false
- uint32 conditionID1; // 15 conditionID1, References: PlayerCondition, NoValue = 0
- uint32 playerCast; // 16 playerCast, enum { false, true, }; Default: false
- uint32 SummonerTriggered; // 17 Summoner Triggered, enum { false, true, }; Default: false
- uint32 requireLOS; // 18 require LOS, enum { false, true, }; Default: false
- } trap;
- // 7 GAMEOBJECT_TYPE_CHAIR
- struct
- {
- uint32 chairslots; // 0 chairslots, int, Min value: 1, Max value: 5, Default value: 1
- uint32 chairheight; // 1 chairheight, int, Min value: 0, Max value: 2, Default value: 1
- uint32 onlyCreatorUse; // 2 onlyCreatorUse, enum { false, true, }; Default: false
- uint32 triggeredEvent; // 3 triggeredEvent, References: GameEvents, NoValue = 0
- uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0
- } chair;
- // 8 GAMEOBJECT_TYPE_SPELL_FOCUS
- struct
- {
- uint32 spellFocusType; // 0 spellFocusType, References: SpellFocusObject, NoValue = 0
- uint32 radius; // 1 radius, int, Min value: 0, Max value: 50, Default value: 10
- uint32 linkedTrap; // 2 linkedTrap, References: GameObjects, NoValue = 0
- uint32 serverOnly; // 3 serverOnly, enum { false, true, }; Default: false
- uint32 questID; // 4 questID, References: QuestV2, NoValue = 0
- uint32 GiganticAOI; // 5 Gigantic AOI, enum { false, true, }; Default: false
- uint32 floatingTooltip; // 6 floatingTooltip, enum { false, true, }; Default: false
- uint32 floatOnWater; // 7 floatOnWater, enum { false, true, }; Default: false
- uint32 conditionID1; // 8 conditionID1, References: PlayerCondition, NoValue = 0
- } spellFocus;
- // 9 GAMEOBJECT_TYPE_TEXT
- struct
- {
- uint32 pageID; // 0 pageID, References: PageText, NoValue = 0
- uint32 language; // 1 language, References: Languages, NoValue = 0
- uint32 pageMaterial; // 2 pageMaterial, References: PageTextMaterial, NoValue = 0
- uint32 allowMounted; // 3 allowMounted, enum { false, true, }; Default: false
- uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0
- uint32 NeverUsableWhileMounted; // 5 Never Usable While Mounted, enum { false, true, }; Default: false
- } text;
- // 10 GAMEOBJECT_TYPE_GOOBER
- struct
- {
- uint32 open; // 0 open, References: Lock_, NoValue = 0
- uint32 questID; // 1 questID, References: QuestV2, NoValue = 0
- uint32 eventID; // 2 eventID, References: GameEvents, NoValue = 0
- uint32 autoClose; // 3 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 3000
- uint32 customAnim; // 4 customAnim, int, Min value: 0, Max value: 4, Default value: 0
- uint32 consumable; // 5 consumable, enum { false, true, }; Default: false
- uint32 cooldown; // 6 cooldown, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 pageID; // 7 pageID, References: PageText, NoValue = 0
- uint32 language; // 8 language, References: Languages, NoValue = 0
- uint32 pageMaterial; // 9 pageMaterial, References: PageTextMaterial, NoValue = 0
- uint32 spell; // 10 spell, References: Spell, NoValue = 0
- uint32 noDamageImmune; // 11 noDamageImmune, enum { false, true, }; Default: false
- uint32 linkedTrap; // 12 linkedTrap, References: GameObjects, NoValue = 0
- uint32 GiganticAOI; // 13 Gigantic AOI, enum { false, true, }; Default: false
- uint32 openTextID; // 14 openTextID, References: BroadcastText, NoValue = 0
- uint32 closeTextID; // 15 closeTextID, References: BroadcastText, NoValue = 0
- uint32 requireLOS; // 16 require LOS, enum { false, true, }; Default: false
- uint32 allowMounted; // 17 allowMounted, enum { false, true, }; Default: false
- uint32 floatingTooltip; // 18 floatingTooltip, enum { false, true, }; Default: false
- uint32 gossipID; // 19 gossipID, References: Gossip, NoValue = 0
- uint32 AllowMultiInteract; // 20 Allow Multi-Interact, enum { false, true, }; Default: false
- uint32 floatOnWater; // 21 floatOnWater, enum { false, true, }; Default: false
- uint32 conditionID1; // 22 conditionID1, References: PlayerCondition, NoValue = 0
- uint32 playerCast; // 23 playerCast, enum { false, true, }; Default: false
- uint32 SpawnVignette; // 24 Spawn Vignette, References: vignette, NoValue = 0
- uint32 startOpen; // 25 startOpen, enum { false, true, }; Default: false
- uint32 DontPlayOpenAnim; // 26 Dont Play Open Anim, enum { false, true, }; Default: false
- uint32 IgnoreBoundingBox; // 27 Ignore Bounding Box, enum { false, true, }; Default: false
- uint32 NeverUsableWhileMounted; // 28 Never Usable While Mounted, enum { false, true, }; Default: false
- uint32 SortFarZ; // 29 Sort Far Z, enum { false, true, }; Default: false
- uint32 SyncAnimationtoObjectLifetime; // 30 Sync Animation to Object Lifetime (global track only), enum { false, true, }; Default: false
- uint32 NoFuzzyHit; // 31 No Fuzzy Hit, enum { false, true, }; Default: false
- } goober;
- // 11 GAMEOBJECT_TYPE_TRANSPORT
- struct
- {
- uint32 Timeto2ndfloor; // 0 Time to 2nd floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
- uint32 startOpen; // 1 startOpen, enum { false, true, }; Default: false
- uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
- uint32 Reached1stfloor; // 3 Reached 1st floor, References: GameEvents, NoValue = 0
- uint32 Reached2ndfloor; // 4 Reached 2nd floor, References: GameEvents, NoValue = 0
- int32 SpawnMap; // 5 Spawn Map, References: Map, NoValue = -1
- uint32 Timeto3rdfloor; // 6 Time to 3rd floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
- uint32 Reached3rdfloor; // 7 Reached 3rd floor, References: GameEvents, NoValue = 0
- uint32 Timeto4thfloor; // 8 Time to 4th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
- uint32 Reached4thfloor; // 9 Reached 4th floor, References: GameEvents, NoValue = 0
- uint32 Timeto5thfloor; // 10 Time to 5th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
- uint32 Reached5thfloor; // 11 Reached 5th floor, References: GameEvents, NoValue = 0
- uint32 Timeto6thfloor; // 12 Time to 6th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
- uint32 Reached6thfloor; // 13 Reached 6th floor, References: GameEvents, NoValue = 0
- uint32 Timeto7thfloor; // 14 Time to 7th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
- uint32 Reached7thfloor; // 15 Reached 7th floor, References: GameEvents, NoValue = 0
- uint32 Timeto8thfloor; // 16 Time to 8th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
- uint32 Reached8thfloor; // 17 Reached 8th floor, References: GameEvents, NoValue = 0
- uint32 Timeto9thfloor; // 18 Time to 9th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
- uint32 Reached9thfloor; // 19 Reached 9th floor, References: GameEvents, NoValue = 0
- uint32 Timeto10thfloor; // 20 Time to 10th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
- uint32 Reached10thfloor; // 21 Reached 10th floor, References: GameEvents, NoValue = 0
- uint32 onlychargeheightcheck; // 22 only charge height check. (yards), int, Min value: 0, Max value: 65535, Default value: 0
- uint32 onlychargetimecheck; // 23 only charge time check, int, Min value: 0, Max value: 65535, Default value: 0
- } transport;
- // 12 GAMEOBJECT_TYPE_AREADAMAGE
- struct
- {
- uint32 open; // 0 open, References: Lock_, NoValue = 0
- uint32 radius; // 1 radius, int, Min value: 0, Max value: 50, Default value: 3
- uint32 damageMin; // 2 damageMin, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 damageMax; // 3 damageMax, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 damageSchool; // 4 damageSchool, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 autoClose; // 5 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
- uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0
- uint32 closeTextID; // 7 closeTextID, References: BroadcastText, NoValue = 0
- } areaDamage;
- // 13 GAMEOBJECT_TYPE_CAMERA
- struct
- {
- uint32 open; // 0 open, References: Lock_, NoValue = 0
- uint32 camera; // 1 camera, References: CinematicSequences, NoValue = 0
- uint32 eventID; // 2 eventID, References: GameEvents, NoValue = 0
- uint32 openTextID; // 3 openTextID, References: BroadcastText, NoValue = 0
- uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0
- } camera;
- // 14 GAMEOBJECT_TYPE_MAP_OBJECT
- struct
- {
- } mapobject;
- // 15 GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT
- struct
- {
- uint32 taxiPathID; // 0 taxiPathID, References: TaxiPath, NoValue = 0
- uint32 moveSpeed; // 1 moveSpeed, int, Min value: 1, Max value: 60, Default value: 1
- uint32 accelRate; // 2 accelRate, int, Min value: 1, Max value: 20, Default value: 1
- uint32 startEventID; // 3 startEventID, References: GameEvents, NoValue = 0
- uint32 stopEventID; // 4 stopEventID, References: GameEvents, NoValue = 0
- uint32 transportPhysics; // 5 transportPhysics, References: TransportPhysics, NoValue = 0
- int32 SpawnMap; // 6 Spawn Map, References: Map, NoValue = -1
- uint32 worldState1; // 7 worldState1, References: WorldState, NoValue = 0
- uint32 allowstopping; // 8 allow stopping, enum { false, true, }; Default: false
- uint32 InitStopped; // 9 Init Stopped, enum { false, true, }; Default: false
- uint32 TrueInfiniteAOI; // 10 True Infinite AOI (programmer only!), enum { false, true, }; Default: false
- } moTransport;
- // 16 GAMEOBJECT_TYPE_DUEL_ARBITER
- struct
- {
- } duelFlag;
- // 17 GAMEOBJECT_TYPE_FISHINGNODE
- struct
- {
- } fishingNode;
- // 18 GAMEOBJECT_TYPE_RITUAL
- struct
- {
- uint32 casters; // 0 casters, int, Min value: 1, Max value: 10, Default value: 1
- uint32 spell; // 1 spell, References: Spell, NoValue = 0
- uint32 animSpell; // 2 animSpell, References: Spell, NoValue = 0
- uint32 ritualPersistent; // 3 ritualPersistent, enum { false, true, }; Default: false
- uint32 casterTargetSpell; // 4 casterTargetSpell, References: Spell, NoValue = 0
- uint32 casterTargetSpellTargets; // 5 casterTargetSpellTargets, int, Min value: 1, Max value: 10, Default value: 1
- uint32 castersGrouped; // 6 castersGrouped, enum { false, true, }; Default: true
- uint32 ritualNoTargetCheck; // 7 ritualNoTargetCheck, enum { false, true, }; Default: true
- uint32 conditionID1; // 8 conditionID1, References: PlayerCondition, NoValue = 0
- } ritual;
- // 19 GAMEOBJECT_TYPE_MAILBOX
- struct
- {
- uint32 conditionID1; // 0 conditionID1, References: PlayerCondition, NoValue = 0
- } mailbox;
- // 20 GAMEOBJECT_TYPE_DO_NOT_USE
- struct
- {
- } DONOTUSE;
- // 21 GAMEOBJECT_TYPE_GUARDPOST
- struct
- {
- uint32 creatureID; // 0 creatureID, References: Creature, NoValue = 0
- uint32 charges; // 1 charges, int, Min value: 0, Max value: 65535, Default value: 1
- } guardPost;
- // 22 GAMEOBJECT_TYPE_SPELLCASTER
- struct
- {
- uint32 spell; // 0 spell, References: Spell, NoValue = 0
- int32 charges; // 1 charges, int, Min value: -1, Max value: 65535, Default value: 1
- uint32 partyOnly; // 2 partyOnly, enum { false, true, }; Default: false
- uint32 allowMounted; // 3 allowMounted, enum { false, true, }; Default: false
- uint32 GiganticAOI; // 4 Gigantic AOI, enum { false, true, }; Default: false
- uint32 conditionID1; // 5 conditionID1, References: PlayerCondition, NoValue = 0
- uint32 playerCast; // 6 playerCast, enum { false, true, }; Default: false
- uint32 NeverUsableWhileMounted; // 7 Never Usable While Mounted, enum { false, true, }; Default: false
- } spellCaster;
- // 23 GAMEOBJECT_TYPE_MEETINGSTONE
- struct
- {
- uint32 minLevel; // 0 minLevel, int, Min value: 0, Max value: 65535, Default value: 1
- uint32 maxLevel; // 1 maxLevel, int, Min value: 1, Max value: 65535, Default value: 60
- uint32 areaID; // 2 areaID, References: AreaTable, NoValue = 0
- } meetingStone;
- // 24 GAMEOBJECT_TYPE_FLAGSTAND
- struct
- {
- uint32 open; // 0 open, References: Lock_, NoValue = 0
- uint32 pickupSpell; // 1 pickupSpell, References: Spell, NoValue = 0
- uint32 radius; // 2 radius, int, Min value: 0, Max value: 50, Default value: 0
- uint32 returnAura; // 3 returnAura, References: Spell, NoValue = 0
- uint32 returnSpell; // 4 returnSpell, References: Spell, NoValue = 0
- uint32 noDamageImmune; // 5 noDamageImmune, enum { false, true, }; Default: false
- uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0
- uint32 requireLOS; // 7 require LOS, enum { false, true, }; Default: true
- uint32 conditionID1; // 8 conditionID1, References: PlayerCondition, NoValue = 0
- uint32 playerCast; // 9 playerCast, enum { false, true, }; Default: false
- uint32 GiganticAOI; // 10 Gigantic AOI, enum { false, true, }; Default: false
- uint32 InfiniteAOI; // 11 Infinite AOI, enum { false, true, }; Default: false
- uint32 cooldown; // 12 cooldown, int, Min value: 0, Max value: 2147483647, Default value: 3000
- } flagStand;
- // 25 GAMEOBJECT_TYPE_FISHINGHOLE
- struct
- {
- uint32 radius; // 0 radius, int, Min value: 0, Max value: 50, Default value: 0
- uint32 chestLoot; // 1 chestLoot, References: Treasure, NoValue = 0
- uint32 minRestock; // 2 minRestock, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 maxRestock; // 3 maxRestock, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 open; // 4 open, References: Lock_, NoValue = 0
- } fishingHole;
- // 26 GAMEOBJECT_TYPE_FLAGDROP
- struct
- {
- uint32 open; // 0 open, References: Lock_, NoValue = 0
- uint32 eventID; // 1 eventID, References: GameEvents, NoValue = 0
- uint32 pickupSpell; // 2 pickupSpell, References: Spell, NoValue = 0
- uint32 noDamageImmune; // 3 noDamageImmune, enum { false, true, }; Default: false
- uint32 openTextID; // 4 openTextID, References: BroadcastText, NoValue = 0
- uint32 playerCast; // 5 playerCast, enum { false, true, }; Default: false
- uint32 ExpireDuration; // 6 Expire Duration, int, Min value: 0, Max value: 60000, Default value: 10000
- uint32 GiganticAOI; // 7 Gigantic AOI, enum { false, true, }; Default: false
- uint32 InfiniteAOI; // 8 Infinite AOI, enum { false, true, }; Default: false
- uint32 cooldown; // 9 cooldown, int, Min value: 0, Max value: 2147483647, Default value: 3000
- } flagDrop;
- // 27 GAMEOBJECT_TYPE_MINI_GAME
- struct
- {
- } miniGame;
- // 28 GAMEOBJECT_TYPE_DO_NOT_USE_2
- struct
- {
- } DONOTUSE2;
- // 29 GAMEOBJECT_TYPE_CONTROL_ZONE
- struct
- {
- uint32 radius; // 0 radius, int, Min value: 0, Max value: 100, Default value: 10
- uint32 spell; // 1 spell, References: Spell, NoValue = 0
- uint32 worldState1; // 2 worldState1, References: WorldState, NoValue = 0
- uint32 worldstate2; // 3 worldstate2, References: WorldState, NoValue = 0
- uint32 CaptureEventHorde; // 4 Capture Event (Horde), References: GameEvents, NoValue = 0
- uint32 CaptureEventAlliance; // 5 Capture Event (Alliance), References: GameEvents, NoValue = 0
- uint32 ContestedEventHorde; // 6 Contested Event (Horde), References: GameEvents, NoValue = 0
- uint32 ContestedEventAlliance; // 7 Contested Event (Alliance), References: GameEvents, NoValue = 0
- uint32 ProgressEventHorde; // 8 Progress Event (Horde), References: GameEvents, NoValue = 0
- uint32 ProgressEventAlliance; // 9 Progress Event (Alliance), References: GameEvents, NoValue = 0
- uint32 NeutralEventHorde; // 10 Neutral Event (Horde), References: GameEvents, NoValue = 0
- uint32 NeutralEventAlliance; // 11 Neutral Event (Alliance), References: GameEvents, NoValue = 0
- uint32 neutralPercent; // 12 neutralPercent, int, Min value: 0, Max value: 100, Default value: 0
- uint32 worldstate3; // 13 worldstate3, References: WorldState, NoValue = 0
- uint32 minSuperiority; // 14 minSuperiority, int, Min value: 1, Max value: 65535, Default value: 1
- uint32 maxSuperiority; // 15 maxSuperiority, int, Min value: 1, Max value: 65535, Default value: 1
- uint32 minTime; // 16 minTime, int, Min value: 1, Max value: 65535, Default value: 1
- uint32 maxTime; // 17 maxTime, int, Min value: 1, Max value: 65535, Default value: 1
- uint32 GiganticAOI; // 18 Gigantic AOI, enum { false, true, }; Default: false
- uint32 highlight; // 19 highlight, enum { false, true, }; Default: true
- uint32 startingValue; // 20 startingValue, int, Min value: 0, Max value: 100, Default value: 50
- uint32 unidirectional; // 21 unidirectional, enum { false, true, }; Default: false
- uint32 killbonustime; // 22 kill bonus time %, int, Min value: 0, Max value: 100, Default value: 0
- uint32 speedWorldState1; // 23 speedWorldState1, References: WorldState, NoValue = 0
- uint32 speedWorldState2; // 24 speedWorldState2, References: WorldState, NoValue = 0
- uint32 UncontestedTime; // 25 Uncontested Time, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 FrequentHeartbeat; // 26 Frequent Heartbeat, enum { false, true, }; Default: false
- } controlZone;
- // 30 GAMEOBJECT_TYPE_AURA_GENERATOR
- struct
- {
- uint32 startOpen; // 0 startOpen, enum { false, true, }; Default: true
- uint32 radius; // 1 radius, int, Min value: 0, Max value: 100, Default value: 10
- uint32 auraID1; // 2 auraID1, References: Spell, NoValue = 0
- uint32 conditionID1; // 3 conditionID1, References: PlayerCondition, NoValue = 0
- uint32 auraID2; // 4 auraID2, References: Spell, NoValue = 0
- uint32 conditionID2; // 5 conditionID2, References: PlayerCondition, NoValue = 0
- uint32 serverOnly; // 6 serverOnly, enum { false, true, }; Default: false
- } auraGenerator;
- // 31 GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY
- struct
- {
- uint32 InstanceType; // 0 Instance Type, enum { Not Instanced, Party Dungeon, Raid Dungeon, PVP Battlefield, Arena Battlefield, Scenario, }; Default: Party Dungeon
- uint32 DifficultyNormal; // 1 Difficulty Normal, References: animationdata, NoValue = 0
- uint32 DifficultyHeroic; // 2 Difficulty Heroic, References: animationdata, NoValue = 0
- uint32 DifficultyEpic; // 3 Difficulty Epic, References: animationdata, NoValue = 0
- uint32 DifficultyLegendary; // 4 Difficulty Legendary, References: animationdata, NoValue = 0
- uint32 HeroicAttachment; // 5 Heroic Attachment, References: gameobjectdisplayinfo, NoValue = 0
- uint32 ChallengeAttachment; // 6 Challenge Attachment, References: gameobjectdisplayinfo, NoValue = 0
- uint32 DifficultyAnimations; // 7 Difficulty Animations, References: GameObjectDiffAnim, NoValue = 0
- uint32 LargeAOI; // 8 Large AOI, enum { false, true, }; Default: false
- uint32 GiganticAOI; // 9 Gigantic AOI, enum { false, true, }; Default: false
- uint32 Legacy; // 10 Legacy, enum { false, true, }; Default: false
- } dungeonDifficulty;
- // 32 GAMEOBJECT_TYPE_BARBER_CHAIR
- struct
- {
- uint32 chairheight; // 0 chairheight, int, Min value: 0, Max value: 2, Default value: 1
- int32 HeightOffset; // 1 Height Offset (inches), int, Min value: -100, Max value: 100, Default value: 0
- uint32 SitAnimKit; // 2 Sit Anim Kit, References: AnimKit, NoValue = 0
- } barberChair;
- // 33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
- struct
- {
- int32 Unused; // 0 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
- uint32 CreditProxyCreature; // 1 Credit Proxy Creature, References: Creature, NoValue = 0
- uint32 HealthRec; // 2 Health Rec, References: DestructibleHitpoint, NoValue = 0
- uint32 IntactEvent; // 3 Intact Event, References: GameEvents, NoValue = 0
- uint32 PVPEnabling; // 4 PVP Enabling, enum { false, true, }; Default: false
- uint32 InteriorVisible; // 5 Interior Visible, enum { false, true, }; Default: false
- uint32 InteriorLight; // 6 Interior Light, enum { false, true, }; Default: false
- int32 Unused1; // 7 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
- int32 Unused2; // 8 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
- uint32 DamagedEvent; // 9 Damaged Event, References: GameEvents, NoValue = 0
- int32 Unused3; // 10 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
- int32 Unused4; // 11 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
- int32 Unused5; // 12 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
- int32 Unused6; // 13 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
- uint32 DestroyedEvent; // 14 Destroyed Event, References: GameEvents, NoValue = 0
- int32 Unused7; // 15 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
- uint32 RebuildingTime; // 16 Rebuilding: Time (secs), int, Min value: 0, Max value: 65535, Default value: 0
- int32 Unused8; // 17 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
- uint32 DestructibleModelRec; // 18 Destructible Model Rec, References: DestructibleModelData, NoValue = 0
- uint32 RebuildingEvent; // 19 Rebuilding: Event, References: GameEvents, NoValue = 0
- int32 Unused9; // 20 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
- int32 Unused10; // 21 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
- uint32 DamageEvent; // 22 Damage Event, References: GameEvents, NoValue = 0
- } destructibleBuilding;
- // 34 GAMEOBJECT_TYPE_GUILD_BANK
- struct
- {
- uint32 conditionID1; // 0 conditionID1, References: PlayerCondition, NoValue = 0
- } guildbank;
- // 35 GAMEOBJECT_TYPE_TRAPDOOR
- struct
- {
- uint32 AutoLink; // 0 Auto Link, enum { false, true, }; Default: false
- uint32 startOpen; // 1 startOpen, enum { false, true, }; Default: false
- uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
- uint32 BlocksPathsDown; // 3 Blocks Paths Down, enum { false, true, }; Default: false
- uint32 PathBlockerBump; // 4 Path Blocker Bump (ft), int, Min value: -2147483648, Max value: 2147483647, Default value: 0
- } trapdoor;
- // 36 GAMEOBJECT_TYPE_NEW_FLAG
- struct
- {
- uint32 open; // 0 open, References: Lock_, NoValue = 0
- uint32 pickupSpell; // 1 pickupSpell, References: Spell, NoValue = 0
- uint32 openTextID; // 2 openTextID, References: BroadcastText, NoValue = 0
- uint32 requireLOS; // 3 require LOS, enum { false, true, }; Default: true
- uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0
- uint32 GiganticAOI; // 5 Gigantic AOI, enum { false, true, }; Default: false
- uint32 InfiniteAOI; // 6 Infinite AOI, enum { false, true, }; Default: false
- uint32 ExpireDuration; // 7 Expire Duration, int, Min value: 0, Max value: 3600000, Default value: 10000
- uint32 RespawnTime; // 8 Respawn Time, int, Min value: 0, Max value: 3600000, Default value: 20000
- uint32 FlagDrop; // 9 Flag Drop, References: GameObjects, NoValue = 0
- int32 ExclusiveCategory; // 10 Exclusive Category (BGs Only), int, Min value: -2147483648, Max value: 2147483647, Default value: 0
- uint32 worldState1; // 11 worldState1, References: WorldState, NoValue = 0
- uint32 ReturnonDefenderInteract; // 12 Return on Defender Interact, enum { false, true, }; Default: false
- } newflag;
- // 37 GAMEOBJECT_TYPE_NEW_FLAG_DROP
- struct
- {
- uint32 open; // 0 open, References: Lock_, NoValue = 0
- } newflagdrop;
- // 38 GAMEOBJECT_TYPE_GARRISON_BUILDING
- struct
- {
- int32 SpawnMap; // 0 Spawn Map, References: Map, NoValue = -1
- } garrisonBuilding;
- // 39 GAMEOBJECT_TYPE_GARRISON_PLOT
- struct
- {
- uint32 PlotInstance; // 0 Plot Instance, References: GarrPlotInstance, NoValue = 0
- int32 SpawnMap; // 1 Spawn Map, References: Map, NoValue = -1
- } garrisonPlot;
- // 40 GAMEOBJECT_TYPE_CLIENT_CREATURE
- struct
- {
- uint32 CreatureDisplayInfo; // 0 Creature Display Info, References: CreatureDisplayInfo, NoValue = 0
- uint32 AnimKit; // 1 Anim Kit, References: AnimKit, NoValue = 0
- uint32 creatureID; // 2 creatureID, References: Creature, NoValue = 0
- } clientCreature;
- // 41 GAMEOBJECT_TYPE_CLIENT_ITEM
- struct
- {
- uint32 Item; // 0 Item, References: Item, NoValue = 0
- } clientItem;
- // 42 GAMEOBJECT_TYPE_CAPTURE_POINT
- struct
- {
- uint32 CaptureTime; // 0 Capture Time (ms), int, Min value: 0, Max value: 2147483647, Default value: 60000
- uint32 GiganticAOI; // 1 Gigantic AOI, enum { false, true, }; Default: false
- uint32 highlight; // 2 highlight, enum { false, true, }; Default: true
- uint32 open; // 3 open, References: Lock_, NoValue = 0
- uint32 AssaultBroadcastHorde; // 4 Assault Broadcast (Horde), References: BroadcastText, NoValue = 0
- uint32 CaptureBroadcastHorde; // 5 Capture Broadcast (Horde), References: BroadcastText, NoValue = 0
- uint32 DefendedBroadcastHorde; // 6 Defended Broadcast (Horde), References: BroadcastText, NoValue = 0
- uint32 AssaultBroadcastAlliance; // 7 Assault Broadcast (Alliance), References: BroadcastText, NoValue = 0
- uint32 CaptureBroadcastAlliance; // 8 Capture Broadcast (Alliance), References: BroadcastText, NoValue = 0
- uint32 DefendedBroadcastAlliance; // 9 Defended Broadcast (Alliance), References: BroadcastText, NoValue = 0
- uint32 worldState1; // 10 worldState1, References: WorldState, NoValue = 0
- uint32 ContestedEventHorde; // 11 Contested Event (Horde), References: GameEvents, NoValue = 0
- uint32 CaptureEventHorde; // 12 Capture Event (Horde), References: GameEvents, NoValue = 0
- uint32 DefendedEventHorde; // 13 Defended Event (Horde), References: GameEvents, NoValue = 0
- uint32 ContestedEventAlliance; // 14 Contested Event (Alliance), References: GameEvents, NoValue = 0
- uint32 CaptureEventAlliance; // 15 Capture Event (Alliance), References: GameEvents, NoValue = 0
- uint32 DefendedEventAlliance; // 16 Defended Event (Alliance), References: GameEvents, NoValue = 0
- uint32 SpellVisual1; // 17 Spell Visual 1, References: SpellVisual, NoValue = 0
- uint32 SpellVisual2; // 18 Spell Visual 2, References: SpellVisual, NoValue = 0
- uint32 SpellVisual3; // 19 Spell Visual 3, References: SpellVisual, NoValue = 0
- uint32 SpellVisual4; // 20 Spell Visual 4, References: SpellVisual, NoValue = 0
- uint32 SpellVisual5; // 21 Spell Visual 5, References: SpellVisual, NoValue = 0
- } capturePoint;
- // 43 GAMEOBJECT_TYPE_PHASEABLE_MO
- struct
- {
- int32 SpawnMap; // 0 Spawn Map, References: Map, NoValue = -1
- uint32 AreaNameSet; // 1 Area Name Set (Index), int, Min value: -2147483648, Max value: 2147483647, Default value: 0
- uint32 DoodadSetA; // 2 Doodad Set A, int, Min value: 0, Max value: 2147483647, Default value: 0
- uint32 DoodadSetB; // 3 Doodad Set B, int, Min value: 0, Max value: 2147483647, Default value: 0
- } phaseableMO;
- // 44 GAMEOBJECT_TYPE_GARRISON_MONUMENT
- struct
- {
- uint32 TrophyTypeID; // 0 Trophy Type ID, References: TrophyType, NoValue = 0
- uint32 TrophyInstanceID; // 1 Trophy Instance ID, References: TrophyInstance, NoValue = 0
- } garrisonMonument;
- // 45 GAMEOBJECT_TYPE_GARRISON_SHIPMENT
- struct
- {
- uint32 ShipmentContainer; // 0 Shipment Container, References: CharShipmentContainer, NoValue = 0
- uint32 GiganticAOI; // 1 Gigantic AOI, enum { false, true, }; Default: false
- uint32 LargeAOI; // 2 Large AOI, enum { false, true, }; Default: false
- } garrisonShipment;
- // 46 GAMEOBJECT_TYPE_GARRISON_MONUMENT_PLAQUE
- struct
- {
- uint32 TrophyInstanceID; // 0 Trophy Instance ID, References: TrophyInstance, NoValue = 0
- } garrisonMonumentPlaque;
- // 47 GAMEOBJECT_TYPE_ARTIFACT_FORGE
- struct
- {
- uint32 conditionID1; // 0 conditionID1, References: PlayerCondition, NoValue = 0
- uint32 LargeAOI; // 1 Large AOI, enum { false, true, }; Default: false
- uint32 IgnoreBoundingBox; // 2 Ignore Bounding Box, enum { false, true, }; Default: false
- uint32 CameraMode; // 3 Camera Mode, References: CameraMode, NoValue = 0
- uint32 FadeRegionRadius; // 4 Fade Region Radius, int, Min value: 0, Max value: 2147483647, Default value: 0
- } artifactForge;
- // 48 GAMEOBJECT_TYPE_UI_LINK
- struct
- {
- uint32 UILinkType; // 0 UI Link Type, enum { Adventure Journal, Obliterum Forge, }; Default: Adventure Journal
- uint32 allowMounted; // 1 allowMounted, enum { false, true, }; Default: false
- uint32 GiganticAOI; // 2 Gigantic AOI, enum { false, true, }; Default: false
- uint32 spellFocusType; // 3 spellFocusType, References: SpellFocusObject, NoValue = 0
- uint32 radius; // 4 radius, int, Min value: 0, Max value: 50, Default value: 10
- } UILink;
- // 49 GAMEOBJECT_TYPE_KEYSTONE_RECEPTACLE
- struct
- {
- } KeystoneReceptacle;
- // 50 GAMEOBJECT_TYPE_GATHERING_NODE
- struct
- {
- uint32 open; // 0 open, References: Lock_, NoValue = 0
- uint32 chestLoot; // 1 chestLoot, References: Treasure, NoValue = 0
- uint32 level; // 2 level, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 notInCombat; // 3 notInCombat, enum { false, true, }; Default: false
- uint32 trivialSkillLow; // 4 trivialSkillLow, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 trivialSkillHigh; // 5 trivialSkillHigh, int, Min value: 0, Max value: 65535, Default value: 0
- uint32 ObjectDespawnDelay; // 6 Object Despawn Delay, int, Min value: 0, Max value: 600, Default value: 15
- uint32 triggeredEvent; // 7 triggeredEvent, References: GameEvents, NoValue = 0
- uint32 requireLOS; // 8 require LOS, enum { false, true, }; Default: false
- uint32 openTextID; // 9 openTextID, References: BroadcastText, NoValue = 0
- uint32 floatingTooltip; // 10 floatingTooltip, enum { false, true, }; Default: false
- uint32 conditionID1; // 11 conditionID1, References: PlayerCondition, NoValue = 0
- uint32 xpLevel; // 12 xpLevel, int, Min value: -1, Max value: 123, Default value: 0
- uint32 xpDifficulty; // 13 xpDifficulty, enum { No Exp, Trivial, Very Small, Small, Substandard, Standard, High, Epic, Dungeon, 5, }; Default: No Exp
- uint32 spell; // 14 spell, References: Spell, NoValue = 0
- uint32 GiganticAOI; // 15 Gigantic AOI, enum { false, true, }; Default: false
- uint32 LargeAOI; // 16 Large AOI, enum { false, true, }; Default: false
- uint32 SpawnVignette; // 17 Spawn Vignette, References: vignette, NoValue = 0
- uint32 MaxNumberofLoots; // 18 Max Number of Loots, int, Min value: 1, Max value: 40, Default value: 10
- uint32 logloot; // 19 log loot, enum { false, true, }; Default: false
- uint32 linkedTrap; // 20 linkedTrap, References: GameObjects, NoValue = 0
- } gatheringNode;
- // 51 GAMEOBJECT_TYPE_CHALLENGE_MODE_REWARD
- struct
- {
- uint32 chestLoot; // 0 chestLoot, References: Treasure, NoValue = 0
- uint32 WhenAvailable; // 1 When Available, References: GameObjectDisplayInfo, NoValue = 0
- } challengeModeReward;
- struct
- {
- uint32 data[MAX_GAMEOBJECT_DATA];
- } raw;
- };
-
- std::string AIName;
- uint32 ScriptId;
-
- // helpers
- bool IsDespawnAtAction() const
- {
- switch (type)
- {
- case GAMEOBJECT_TYPE_CHEST: return chest.consumable != 0;
- case GAMEOBJECT_TYPE_GOOBER: return goober.consumable != 0;
- default: return false;
- }
- }
-
- bool IsUsableMounted() const
- {
- switch (type)
- {
- case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.allowMounted != 0;
- case GAMEOBJECT_TYPE_TEXT: return text.allowMounted != 0;
- case GAMEOBJECT_TYPE_GOOBER: return goober.allowMounted != 0;
- case GAMEOBJECT_TYPE_SPELLCASTER: return spellCaster.allowMounted != 0;
- case GAMEOBJECT_TYPE_UI_LINK: return UILink.allowMounted != 0;
- default: return false;
- }
- }
-
- uint32 GetLockId() const
- {
- switch (type)
- {
- case GAMEOBJECT_TYPE_DOOR: return door.open;
- case GAMEOBJECT_TYPE_BUTTON: return button.open;
- case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.open;
- case GAMEOBJECT_TYPE_CHEST: return chest.open;
- case GAMEOBJECT_TYPE_TRAP: return trap.open;
- case GAMEOBJECT_TYPE_GOOBER: return goober.open;
- case GAMEOBJECT_TYPE_AREADAMAGE: return areaDamage.open;
- case GAMEOBJECT_TYPE_CAMERA: return camera.open;
- case GAMEOBJECT_TYPE_FLAGSTAND: return flagStand.open;
- case GAMEOBJECT_TYPE_FISHINGHOLE: return fishingHole.open;
- case GAMEOBJECT_TYPE_FLAGDROP: return flagDrop.open;
- case GAMEOBJECT_TYPE_NEW_FLAG: return newflag.open;
- case GAMEOBJECT_TYPE_NEW_FLAG_DROP: return newflagdrop.open;
- case GAMEOBJECT_TYPE_CAPTURE_POINT: return capturePoint.open;
- case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.open;
- default: return 0;
- }
- }
-
- bool GetDespawnPossibility() const // despawn at targeting of cast?
- {
- switch (type)
- {
- case GAMEOBJECT_TYPE_DOOR: return door.noDamageImmune != 0;
- case GAMEOBJECT_TYPE_BUTTON: return button.noDamageImmune != 0;
- case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.noDamageImmune != 0;
- case GAMEOBJECT_TYPE_GOOBER: return goober.noDamageImmune != 0;
- case GAMEOBJECT_TYPE_FLAGSTAND: return flagStand.noDamageImmune != 0;
- case GAMEOBJECT_TYPE_FLAGDROP: return flagDrop.noDamageImmune != 0;
- default: return true;
- }
- }
-
- uint32 GetCharges() const // despawn at uses amount
- {
- switch (type)
- {
- //case GAMEOBJECT_TYPE_TRAP: return trap.charges;
- case GAMEOBJECT_TYPE_GUARDPOST: return guardPost.charges;
- case GAMEOBJECT_TYPE_SPELLCASTER: return spellCaster.charges;
- default: return 0;
- }
- }
-
- uint32 GetLinkedGameObjectEntry() const
- {
- switch (type)
- {
- case GAMEOBJECT_TYPE_BUTTON: return button.linkedTrap;
- case GAMEOBJECT_TYPE_CHEST: return chest.linkedTrap;
- case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.linkedTrap;
- case GAMEOBJECT_TYPE_GOOBER: return goober.linkedTrap;
- case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.linkedTrap;
- default: return 0;
- }
- }
-
- uint32 GetAutoCloseTime() const
- {
- uint32 autoCloseTime = 0;
- switch (type)
- {
- case GAMEOBJECT_TYPE_DOOR: autoCloseTime = door.autoClose; break;
- case GAMEOBJECT_TYPE_BUTTON: autoCloseTime = button.autoClose; break;
- case GAMEOBJECT_TYPE_TRAP: autoCloseTime = trap.autoClose; break;
- case GAMEOBJECT_TYPE_GOOBER: autoCloseTime = goober.autoClose; break;
- case GAMEOBJECT_TYPE_TRANSPORT: autoCloseTime = transport.autoClose; break;
- case GAMEOBJECT_TYPE_AREADAMAGE: autoCloseTime = areaDamage.autoClose; break;
- case GAMEOBJECT_TYPE_TRAPDOOR: autoCloseTime = trapdoor.autoClose; break;
- default: break;
- }
- return autoCloseTime / IN_MILLISECONDS; // prior to 3.0.3, conversion was / 0x10000;
- }
-
- uint32 GetLootId() const
- {
- switch (type)
- {
- case GAMEOBJECT_TYPE_CHEST: return chest.chestLoot;
- case GAMEOBJECT_TYPE_FISHINGHOLE: return fishingHole.chestLoot;
- case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.chestLoot;
- case GAMEOBJECT_TYPE_CHALLENGE_MODE_REWARD: return challengeModeReward.chestLoot;
- default: return 0;
- }
- }
-
- uint32 GetGossipMenuId() const
- {
- switch (type)
- {
- case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.gossipID;
- case GAMEOBJECT_TYPE_GOOBER: return goober.gossipID;
- default: return 0;
- }
- }
-
- uint32 GetEventScriptId() const
- {
- switch (type)
- {
- case GAMEOBJECT_TYPE_GOOBER: return goober.eventID;
- case GAMEOBJECT_TYPE_CHEST: return chest.triggeredEvent;
- case GAMEOBJECT_TYPE_CAMERA: return camera.eventID;
- case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.triggeredEvent;
- default: return 0;
- }
- }
-
- uint32 GetCooldown() const // Cooldown preventing goober and traps to cast spell
- {
- switch (type)
- {
- case GAMEOBJECT_TYPE_TRAP: return trap.cooldown;
- case GAMEOBJECT_TYPE_GOOBER: return goober.cooldown;
- default: return 0;
- }
- }
-};
-
-// From `gameobject_template_addon`
-struct GameObjectTemplateAddon
-{
- uint32 entry;
- uint32 faction;
- uint32 flags;
- uint32 mingold;
- uint32 maxgold;
-};
-
-// Benchmarked: Faster than std::map (insert/find)
-typedef std::unordered_map<uint32, GameObjectTemplate> GameObjectTemplateContainer;
-typedef std::unordered_map<uint32, GameObjectTemplateAddon> GameObjectTemplateAddonContainer;
-
class OPvPCapturePoint;
+class Transport;
+class Unit;
struct TransportAnimation;
+enum TriggerCastFlags : uint32;
union GameObjectValue
{
@@ -863,60 +64,6 @@ union GameObjectValue
} Building;
};
-struct GameObjectLocale
-{
- std::vector<std::string> Name;
- std::vector<std::string> CastBarCaption;
- std::vector<std::string> Unk1;
-};
-
-struct QuaternionData
-{
- float x, y, z, w;
-
- QuaternionData() : x(0.0f), y(0.0f), z(0.0f), w(1.0f) {}
- QuaternionData(float X, float Y, float Z, float W) : x(X), y(Y), z(Z), w(W) {}
-
- bool isUnit() const { return fabs(x * x + y * y + z * z + w * w - 1.0f) < 1e-5; }
-};
-
-// `gameobject_addon` table
-struct GameObjectAddon
-{
- QuaternionData ParentRotation;
- InvisibilityType invisibilityType;
- uint32 InvisibilityValue;
-};
-
-typedef std::unordered_map<ObjectGuid::LowType, GameObjectAddon> GameObjectAddonContainer;
-
-// from `gameobject`
-struct GameObjectData
-{
- explicit GameObjectData() : id(0), mapid(0), phaseMask(0), posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0),
- animprogress(0), go_state(GO_STATE_ACTIVE), spawnMask(0), artKit(0), phaseid(0), phaseGroup(0), dbData(true) { }
- uint32 id; // entry in gamobject_template
- uint16 mapid;
- uint32 phaseMask;
- float posX;
- float posY;
- float posZ;
- float orientation;
- QuaternionData rotation;
- int32 spawntimesecs;
- uint32 animprogress;
- GOState go_state;
- uint32 spawnMask;
- uint8 artKit;
- uint32 phaseid;
- uint32 phaseGroup;
- uint32 ScriptId;
- bool dbData;
-};
-
-typedef std::vector<uint32> GameObjectQuestItemList;
-typedef std::unordered_map<uint32, GameObjectQuestItemList> GameObjectQuestItemMap;
-
// For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ...
// For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted>
// For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ...
@@ -929,9 +76,6 @@ enum LootState
GO_JUST_DEACTIVATED
};
-class Unit;
-class GameObjectModel;
-
// 5 sec for bobber catch
#define FISHING_BOBBER_READY_TIME 5
diff --git a/src/server/game/Entities/GameObject/GameObjectData.h b/src/server/game/Entities/GameObject/GameObjectData.h
new file mode 100644
index 00000000000..c0a91a3d166
--- /dev/null
+++ b/src/server/game/Entities/GameObject/GameObjectData.h
@@ -0,0 +1,873 @@
+/*
+ * 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 GameObjectData_h__
+#define GameObjectData_h__
+
+#include "Common.h"
+#include "SharedDefines.h"
+#include <string>
+#include <vector>
+
+// from `gameobject_template`
+struct GameObjectTemplate
+{
+ uint32 entry;
+ uint32 type;
+ uint32 displayId;
+ std::string name;
+ std::string IconName;
+ std::string castBarCaption;
+ std::string unk1;
+ float size;
+ int32 RequiredLevel;
+ union
+ {
+ // 0 GAMEOBJECT_TYPE_DOOR
+ struct
+ {
+ uint32 startOpen; // 0 startOpen, enum { false, true, }; Default: false
+ uint32 open; // 1 open, References: Lock_, NoValue = 0
+ uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 3000
+ uint32 noDamageImmune; // 3 noDamageImmune, enum { false, true, }; Default: false
+ uint32 openTextID; // 4 openTextID, References: BroadcastText, NoValue = 0
+ uint32 closeTextID; // 5 closeTextID, References: BroadcastText, NoValue = 0
+ uint32 IgnoredByPathing; // 6 Ignored By Pathing, enum { false, true, }; Default: false
+ uint32 conditionID1; // 7 conditionID1, References: PlayerCondition, NoValue = 0
+ uint32 DoorisOpaque; // 8 Door is Opaque (Disable portal on close), enum { false, true, }; Default: true
+ uint32 GiganticAOI; // 9 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 InfiniteAOI; // 10 Infinite AOI, enum { false, true, }; Default: false
+ } door;
+ // 1 GAMEOBJECT_TYPE_BUTTON
+ struct
+ {
+ uint32 startOpen; // 0 startOpen, enum { false, true, }; Default: false
+ uint32 open; // 1 open, References: Lock_, NoValue = 0
+ uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 3000
+ uint32 linkedTrap; // 3 linkedTrap, References: GameObjects, NoValue = 0
+ uint32 noDamageImmune; // 4 noDamageImmune, enum { false, true, }; Default: false
+ uint32 GiganticAOI; // 5 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0
+ uint32 closeTextID; // 7 closeTextID, References: BroadcastText, NoValue = 0
+ uint32 requireLOS; // 8 require LOS, enum { false, true, }; Default: false
+ uint32 conditionID1; // 9 conditionID1, References: PlayerCondition, NoValue = 0
+ } button;
+ // 2 GAMEOBJECT_TYPE_QUESTGIVER
+ struct
+ {
+ uint32 open; // 0 open, References: Lock_, NoValue = 0
+ uint32 questGiver; // 1 questGiver, References: QuestGiver, NoValue = 0
+ uint32 pageMaterial; // 2 pageMaterial, References: PageTextMaterial, NoValue = 0
+ uint32 gossipID; // 3 gossipID, References: Gossip, NoValue = 0
+ uint32 customAnim; // 4 customAnim, int, Min value: 0, Max value: 4, Default value: 0
+ uint32 noDamageImmune; // 5 noDamageImmune, enum { false, true, }; Default: false
+ uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0
+ uint32 requireLOS; // 7 require LOS, enum { false, true, }; Default: false
+ uint32 allowMounted; // 8 allowMounted, enum { false, true, }; Default: false
+ uint32 GiganticAOI; // 9 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 conditionID1; // 10 conditionID1, References: PlayerCondition, NoValue = 0
+ uint32 NeverUsableWhileMounted; // 11 Never Usable While Mounted, enum { false, true, }; Default: false
+ } questgiver;
+ // 3 GAMEOBJECT_TYPE_CHEST
+ struct
+ {
+ uint32 open; // 0 open, References: Lock_, NoValue = 0
+ uint32 chestLoot; // 1 chestLoot, References: Treasure, NoValue = 0
+ uint32 chestRestockTime; // 2 chestRestockTime, int, Min value: 0, Max value: 1800000, Default value: 0
+ uint32 consumable; // 3 consumable, enum { false, true, }; Default: false
+ uint32 minRestock; // 4 minRestock, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 maxRestock; // 5 maxRestock, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 triggeredEvent; // 6 triggeredEvent, References: GameEvents, NoValue = 0
+ uint32 linkedTrap; // 7 linkedTrap, References: GameObjects, NoValue = 0
+ uint32 questID; // 8 questID, References: QuestV2, NoValue = 0
+ uint32 level; // 9 level, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 requireLOS; // 10 require LOS, enum { false, true, }; Default: false
+ uint32 leaveLoot; // 11 leaveLoot, enum { false, true, }; Default: false
+ uint32 notInCombat; // 12 notInCombat, enum { false, true, }; Default: false
+ uint32 logloot; // 13 log loot, enum { false, true, }; Default: false
+ uint32 openTextID; // 14 openTextID, References: BroadcastText, NoValue = 0
+ uint32 usegrouplootrules; // 15 use group loot rules, enum { false, true, }; Default: false
+ uint32 floatingTooltip; // 16 floatingTooltip, enum { false, true, }; Default: false
+ uint32 conditionID1; // 17 conditionID1, References: PlayerCondition, NoValue = 0
+ int32 xpLevel; // 18 xpLevel, int, Min value: -1, Max value: 123, Default value: 0
+ uint32 xpDifficulty; // 19 xpDifficulty, enum { No Exp, Trivial, Very Small, Small, Substandard, Standard, High, Epic, Dungeon, 5, }; Default: No Exp
+ uint32 lootLevel; // 20 lootLevel, int, Min value: 0, Max value: 123, Default value: 0
+ uint32 GroupXP; // 21 Group XP, enum { false, true, }; Default: false
+ uint32 DamageImmuneOK; // 22 Damage Immune OK, enum { false, true, }; Default: false
+ uint32 trivialSkillLow; // 23 trivialSkillLow, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 trivialSkillHigh; // 24 trivialSkillHigh, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 DungeonEncounter; // 25 Dungeon Encounter, References: DungeonEncounter, NoValue = 0
+ uint32 spell; // 26 spell, References: Spell, NoValue = 0
+ uint32 GiganticAOI; // 27 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 LargeAOI; // 28 Large AOI, enum { false, true, }; Default: false
+ uint32 SpawnVignette; // 29 Spawn Vignette, References: vignette, NoValue = 0
+ uint32 chestPersonalLoot; // 30 chest Personal Loot, References: Treasure, NoValue = 0
+ uint32 turnpersonallootsecurityoff; // 31 turn personal loot security off, enum { false, true, }; Default: false
+ uint32 ChestProperties; // 32 Chest Properties, References: ChestProperties, NoValue = 0
+ } chest;
+ // 4 GAMEOBJECT_TYPE_BINDER
+ struct
+ {
+ } binder;
+ // 5 GAMEOBJECT_TYPE_GENERIC
+ struct
+ {
+ uint32 floatingTooltip; // 0 floatingTooltip, enum { false, true, }; Default: false
+ uint32 highlight; // 1 highlight, enum { false, true, }; Default: true
+ uint32 serverOnly; // 2 serverOnly, enum { false, true, }; Default: false
+ uint32 GiganticAOI; // 3 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 floatOnWater; // 4 floatOnWater, enum { false, true, }; Default: false
+ uint32 questID; // 5 questID, References: QuestV2, NoValue = 0
+ uint32 conditionID1; // 6 conditionID1, References: PlayerCondition, NoValue = 0
+ uint32 LargeAOI; // 7 Large AOI, enum { false, true, }; Default: false
+ uint32 UseGarrisonOwnerGuildColors; // 8 Use Garrison Owner Guild Colors, enum { false, true, }; Default: false
+ } generic;
+ // 6 GAMEOBJECT_TYPE_TRAP
+ struct
+ {
+ uint32 open; // 0 open, References: Lock_, NoValue = 0
+ uint32 level; // 1 level, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 radius; // 2 radius, int, Min value: 0, Max value: 100, Default value: 0
+ uint32 spell; // 3 spell, References: Spell, NoValue = 0
+ uint32 charges; // 4 charges, int, Min value: 0, Max value: 65535, Default value: 1
+ uint32 cooldown; // 5 cooldown, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 autoClose; // 6 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
+ uint32 startDelay; // 7 startDelay, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 serverOnly; // 8 serverOnly, enum { false, true, }; Default: false
+ uint32 stealthed; // 9 stealthed, enum { false, true, }; Default: false
+ uint32 GiganticAOI; // 10 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 stealthAffected; // 11 stealthAffected, enum { false, true, }; Default: false
+ uint32 openTextID; // 12 openTextID, References: BroadcastText, NoValue = 0
+ uint32 closeTextID; // 13 closeTextID, References: BroadcastText, NoValue = 0
+ uint32 IgnoreTotems; // 14 Ignore Totems, enum { false, true, }; Default: false
+ uint32 conditionID1; // 15 conditionID1, References: PlayerCondition, NoValue = 0
+ uint32 playerCast; // 16 playerCast, enum { false, true, }; Default: false
+ uint32 SummonerTriggered; // 17 Summoner Triggered, enum { false, true, }; Default: false
+ uint32 requireLOS; // 18 require LOS, enum { false, true, }; Default: false
+ } trap;
+ // 7 GAMEOBJECT_TYPE_CHAIR
+ struct
+ {
+ uint32 chairslots; // 0 chairslots, int, Min value: 1, Max value: 5, Default value: 1
+ uint32 chairheight; // 1 chairheight, int, Min value: 0, Max value: 2, Default value: 1
+ uint32 onlyCreatorUse; // 2 onlyCreatorUse, enum { false, true, }; Default: false
+ uint32 triggeredEvent; // 3 triggeredEvent, References: GameEvents, NoValue = 0
+ uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0
+ } chair;
+ // 8 GAMEOBJECT_TYPE_SPELL_FOCUS
+ struct
+ {
+ uint32 spellFocusType; // 0 spellFocusType, References: SpellFocusObject, NoValue = 0
+ uint32 radius; // 1 radius, int, Min value: 0, Max value: 50, Default value: 10
+ uint32 linkedTrap; // 2 linkedTrap, References: GameObjects, NoValue = 0
+ uint32 serverOnly; // 3 serverOnly, enum { false, true, }; Default: false
+ uint32 questID; // 4 questID, References: QuestV2, NoValue = 0
+ uint32 GiganticAOI; // 5 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 floatingTooltip; // 6 floatingTooltip, enum { false, true, }; Default: false
+ uint32 floatOnWater; // 7 floatOnWater, enum { false, true, }; Default: false
+ uint32 conditionID1; // 8 conditionID1, References: PlayerCondition, NoValue = 0
+ } spellFocus;
+ // 9 GAMEOBJECT_TYPE_TEXT
+ struct
+ {
+ uint32 pageID; // 0 pageID, References: PageText, NoValue = 0
+ uint32 language; // 1 language, References: Languages, NoValue = 0
+ uint32 pageMaterial; // 2 pageMaterial, References: PageTextMaterial, NoValue = 0
+ uint32 allowMounted; // 3 allowMounted, enum { false, true, }; Default: false
+ uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0
+ uint32 NeverUsableWhileMounted; // 5 Never Usable While Mounted, enum { false, true, }; Default: false
+ } text;
+ // 10 GAMEOBJECT_TYPE_GOOBER
+ struct
+ {
+ uint32 open; // 0 open, References: Lock_, NoValue = 0
+ uint32 questID; // 1 questID, References: QuestV2, NoValue = 0
+ uint32 eventID; // 2 eventID, References: GameEvents, NoValue = 0
+ uint32 autoClose; // 3 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 3000
+ uint32 customAnim; // 4 customAnim, int, Min value: 0, Max value: 4, Default value: 0
+ uint32 consumable; // 5 consumable, enum { false, true, }; Default: false
+ uint32 cooldown; // 6 cooldown, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 pageID; // 7 pageID, References: PageText, NoValue = 0
+ uint32 language; // 8 language, References: Languages, NoValue = 0
+ uint32 pageMaterial; // 9 pageMaterial, References: PageTextMaterial, NoValue = 0
+ uint32 spell; // 10 spell, References: Spell, NoValue = 0
+ uint32 noDamageImmune; // 11 noDamageImmune, enum { false, true, }; Default: false
+ uint32 linkedTrap; // 12 linkedTrap, References: GameObjects, NoValue = 0
+ uint32 GiganticAOI; // 13 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 openTextID; // 14 openTextID, References: BroadcastText, NoValue = 0
+ uint32 closeTextID; // 15 closeTextID, References: BroadcastText, NoValue = 0
+ uint32 requireLOS; // 16 require LOS, enum { false, true, }; Default: false
+ uint32 allowMounted; // 17 allowMounted, enum { false, true, }; Default: false
+ uint32 floatingTooltip; // 18 floatingTooltip, enum { false, true, }; Default: false
+ uint32 gossipID; // 19 gossipID, References: Gossip, NoValue = 0
+ uint32 AllowMultiInteract; // 20 Allow Multi-Interact, enum { false, true, }; Default: false
+ uint32 floatOnWater; // 21 floatOnWater, enum { false, true, }; Default: false
+ uint32 conditionID1; // 22 conditionID1, References: PlayerCondition, NoValue = 0
+ uint32 playerCast; // 23 playerCast, enum { false, true, }; Default: false
+ uint32 SpawnVignette; // 24 Spawn Vignette, References: vignette, NoValue = 0
+ uint32 startOpen; // 25 startOpen, enum { false, true, }; Default: false
+ uint32 DontPlayOpenAnim; // 26 Dont Play Open Anim, enum { false, true, }; Default: false
+ uint32 IgnoreBoundingBox; // 27 Ignore Bounding Box, enum { false, true, }; Default: false
+ uint32 NeverUsableWhileMounted; // 28 Never Usable While Mounted, enum { false, true, }; Default: false
+ uint32 SortFarZ; // 29 Sort Far Z, enum { false, true, }; Default: false
+ uint32 SyncAnimationtoObjectLifetime; // 30 Sync Animation to Object Lifetime (global track only), enum { false, true, }; Default: false
+ uint32 NoFuzzyHit; // 31 No Fuzzy Hit, enum { false, true, }; Default: false
+ } goober;
+ // 11 GAMEOBJECT_TYPE_TRANSPORT
+ struct
+ {
+ uint32 Timeto2ndfloor; // 0 Time to 2nd floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
+ uint32 startOpen; // 1 startOpen, enum { false, true, }; Default: false
+ uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
+ uint32 Reached1stfloor; // 3 Reached 1st floor, References: GameEvents, NoValue = 0
+ uint32 Reached2ndfloor; // 4 Reached 2nd floor, References: GameEvents, NoValue = 0
+ int32 SpawnMap; // 5 Spawn Map, References: Map, NoValue = -1
+ uint32 Timeto3rdfloor; // 6 Time to 3rd floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
+ uint32 Reached3rdfloor; // 7 Reached 3rd floor, References: GameEvents, NoValue = 0
+ uint32 Timeto4thfloor; // 8 Time to 4th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
+ uint32 Reached4thfloor; // 9 Reached 4th floor, References: GameEvents, NoValue = 0
+ uint32 Timeto5thfloor; // 10 Time to 5th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
+ uint32 Reached5thfloor; // 11 Reached 5th floor, References: GameEvents, NoValue = 0
+ uint32 Timeto6thfloor; // 12 Time to 6th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
+ uint32 Reached6thfloor; // 13 Reached 6th floor, References: GameEvents, NoValue = 0
+ uint32 Timeto7thfloor; // 14 Time to 7th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
+ uint32 Reached7thfloor; // 15 Reached 7th floor, References: GameEvents, NoValue = 0
+ uint32 Timeto8thfloor; // 16 Time to 8th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
+ uint32 Reached8thfloor; // 17 Reached 8th floor, References: GameEvents, NoValue = 0
+ uint32 Timeto9thfloor; // 18 Time to 9th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
+ uint32 Reached9thfloor; // 19 Reached 9th floor, References: GameEvents, NoValue = 0
+ uint32 Timeto10thfloor; // 20 Time to 10th floor (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
+ uint32 Reached10thfloor; // 21 Reached 10th floor, References: GameEvents, NoValue = 0
+ uint32 onlychargeheightcheck; // 22 only charge height check. (yards), int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 onlychargetimecheck; // 23 only charge time check, int, Min value: 0, Max value: 65535, Default value: 0
+ } transport;
+ // 12 GAMEOBJECT_TYPE_AREADAMAGE
+ struct
+ {
+ uint32 open; // 0 open, References: Lock_, NoValue = 0
+ uint32 radius; // 1 radius, int, Min value: 0, Max value: 50, Default value: 3
+ uint32 damageMin; // 2 damageMin, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 damageMax; // 3 damageMax, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 damageSchool; // 4 damageSchool, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 autoClose; // 5 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
+ uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0
+ uint32 closeTextID; // 7 closeTextID, References: BroadcastText, NoValue = 0
+ } areaDamage;
+ // 13 GAMEOBJECT_TYPE_CAMERA
+ struct
+ {
+ uint32 open; // 0 open, References: Lock_, NoValue = 0
+ uint32 camera; // 1 camera, References: CinematicSequences, NoValue = 0
+ uint32 eventID; // 2 eventID, References: GameEvents, NoValue = 0
+ uint32 openTextID; // 3 openTextID, References: BroadcastText, NoValue = 0
+ uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0
+ } camera;
+ // 14 GAMEOBJECT_TYPE_MAP_OBJECT
+ struct
+ {
+ } mapobject;
+ // 15 GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT
+ struct
+ {
+ uint32 taxiPathID; // 0 taxiPathID, References: TaxiPath, NoValue = 0
+ uint32 moveSpeed; // 1 moveSpeed, int, Min value: 1, Max value: 60, Default value: 1
+ uint32 accelRate; // 2 accelRate, int, Min value: 1, Max value: 20, Default value: 1
+ uint32 startEventID; // 3 startEventID, References: GameEvents, NoValue = 0
+ uint32 stopEventID; // 4 stopEventID, References: GameEvents, NoValue = 0
+ uint32 transportPhysics; // 5 transportPhysics, References: TransportPhysics, NoValue = 0
+ int32 SpawnMap; // 6 Spawn Map, References: Map, NoValue = -1
+ uint32 worldState1; // 7 worldState1, References: WorldState, NoValue = 0
+ uint32 allowstopping; // 8 allow stopping, enum { false, true, }; Default: false
+ uint32 InitStopped; // 9 Init Stopped, enum { false, true, }; Default: false
+ uint32 TrueInfiniteAOI; // 10 True Infinite AOI (programmer only!), enum { false, true, }; Default: false
+ } moTransport;
+ // 16 GAMEOBJECT_TYPE_DUEL_ARBITER
+ struct
+ {
+ } duelFlag;
+ // 17 GAMEOBJECT_TYPE_FISHINGNODE
+ struct
+ {
+ } fishingNode;
+ // 18 GAMEOBJECT_TYPE_RITUAL
+ struct
+ {
+ uint32 casters; // 0 casters, int, Min value: 1, Max value: 10, Default value: 1
+ uint32 spell; // 1 spell, References: Spell, NoValue = 0
+ uint32 animSpell; // 2 animSpell, References: Spell, NoValue = 0
+ uint32 ritualPersistent; // 3 ritualPersistent, enum { false, true, }; Default: false
+ uint32 casterTargetSpell; // 4 casterTargetSpell, References: Spell, NoValue = 0
+ uint32 casterTargetSpellTargets; // 5 casterTargetSpellTargets, int, Min value: 1, Max value: 10, Default value: 1
+ uint32 castersGrouped; // 6 castersGrouped, enum { false, true, }; Default: true
+ uint32 ritualNoTargetCheck; // 7 ritualNoTargetCheck, enum { false, true, }; Default: true
+ uint32 conditionID1; // 8 conditionID1, References: PlayerCondition, NoValue = 0
+ } ritual;
+ // 19 GAMEOBJECT_TYPE_MAILBOX
+ struct
+ {
+ uint32 conditionID1; // 0 conditionID1, References: PlayerCondition, NoValue = 0
+ } mailbox;
+ // 20 GAMEOBJECT_TYPE_DO_NOT_USE
+ struct
+ {
+ } DONOTUSE;
+ // 21 GAMEOBJECT_TYPE_GUARDPOST
+ struct
+ {
+ uint32 creatureID; // 0 creatureID, References: Creature, NoValue = 0
+ uint32 charges; // 1 charges, int, Min value: 0, Max value: 65535, Default value: 1
+ } guardPost;
+ // 22 GAMEOBJECT_TYPE_SPELLCASTER
+ struct
+ {
+ uint32 spell; // 0 spell, References: Spell, NoValue = 0
+ int32 charges; // 1 charges, int, Min value: -1, Max value: 65535, Default value: 1
+ uint32 partyOnly; // 2 partyOnly, enum { false, true, }; Default: false
+ uint32 allowMounted; // 3 allowMounted, enum { false, true, }; Default: false
+ uint32 GiganticAOI; // 4 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 conditionID1; // 5 conditionID1, References: PlayerCondition, NoValue = 0
+ uint32 playerCast; // 6 playerCast, enum { false, true, }; Default: false
+ uint32 NeverUsableWhileMounted; // 7 Never Usable While Mounted, enum { false, true, }; Default: false
+ } spellCaster;
+ // 23 GAMEOBJECT_TYPE_MEETINGSTONE
+ struct
+ {
+ uint32 minLevel; // 0 minLevel, int, Min value: 0, Max value: 65535, Default value: 1
+ uint32 maxLevel; // 1 maxLevel, int, Min value: 1, Max value: 65535, Default value: 60
+ uint32 areaID; // 2 areaID, References: AreaTable, NoValue = 0
+ } meetingStone;
+ // 24 GAMEOBJECT_TYPE_FLAGSTAND
+ struct
+ {
+ uint32 open; // 0 open, References: Lock_, NoValue = 0
+ uint32 pickupSpell; // 1 pickupSpell, References: Spell, NoValue = 0
+ uint32 radius; // 2 radius, int, Min value: 0, Max value: 50, Default value: 0
+ uint32 returnAura; // 3 returnAura, References: Spell, NoValue = 0
+ uint32 returnSpell; // 4 returnSpell, References: Spell, NoValue = 0
+ uint32 noDamageImmune; // 5 noDamageImmune, enum { false, true, }; Default: false
+ uint32 openTextID; // 6 openTextID, References: BroadcastText, NoValue = 0
+ uint32 requireLOS; // 7 require LOS, enum { false, true, }; Default: true
+ uint32 conditionID1; // 8 conditionID1, References: PlayerCondition, NoValue = 0
+ uint32 playerCast; // 9 playerCast, enum { false, true, }; Default: false
+ uint32 GiganticAOI; // 10 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 InfiniteAOI; // 11 Infinite AOI, enum { false, true, }; Default: false
+ uint32 cooldown; // 12 cooldown, int, Min value: 0, Max value: 2147483647, Default value: 3000
+ } flagStand;
+ // 25 GAMEOBJECT_TYPE_FISHINGHOLE
+ struct
+ {
+ uint32 radius; // 0 radius, int, Min value: 0, Max value: 50, Default value: 0
+ uint32 chestLoot; // 1 chestLoot, References: Treasure, NoValue = 0
+ uint32 minRestock; // 2 minRestock, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 maxRestock; // 3 maxRestock, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 open; // 4 open, References: Lock_, NoValue = 0
+ } fishingHole;
+ // 26 GAMEOBJECT_TYPE_FLAGDROP
+ struct
+ {
+ uint32 open; // 0 open, References: Lock_, NoValue = 0
+ uint32 eventID; // 1 eventID, References: GameEvents, NoValue = 0
+ uint32 pickupSpell; // 2 pickupSpell, References: Spell, NoValue = 0
+ uint32 noDamageImmune; // 3 noDamageImmune, enum { false, true, }; Default: false
+ uint32 openTextID; // 4 openTextID, References: BroadcastText, NoValue = 0
+ uint32 playerCast; // 5 playerCast, enum { false, true, }; Default: false
+ uint32 ExpireDuration; // 6 Expire Duration, int, Min value: 0, Max value: 60000, Default value: 10000
+ uint32 GiganticAOI; // 7 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 InfiniteAOI; // 8 Infinite AOI, enum { false, true, }; Default: false
+ uint32 cooldown; // 9 cooldown, int, Min value: 0, Max value: 2147483647, Default value: 3000
+ } flagDrop;
+ // 27 GAMEOBJECT_TYPE_MINI_GAME
+ struct
+ {
+ } miniGame;
+ // 28 GAMEOBJECT_TYPE_DO_NOT_USE_2
+ struct
+ {
+ } DONOTUSE2;
+ // 29 GAMEOBJECT_TYPE_CONTROL_ZONE
+ struct
+ {
+ uint32 radius; // 0 radius, int, Min value: 0, Max value: 100, Default value: 10
+ uint32 spell; // 1 spell, References: Spell, NoValue = 0
+ uint32 worldState1; // 2 worldState1, References: WorldState, NoValue = 0
+ uint32 worldstate2; // 3 worldstate2, References: WorldState, NoValue = 0
+ uint32 CaptureEventHorde; // 4 Capture Event (Horde), References: GameEvents, NoValue = 0
+ uint32 CaptureEventAlliance; // 5 Capture Event (Alliance), References: GameEvents, NoValue = 0
+ uint32 ContestedEventHorde; // 6 Contested Event (Horde), References: GameEvents, NoValue = 0
+ uint32 ContestedEventAlliance; // 7 Contested Event (Alliance), References: GameEvents, NoValue = 0
+ uint32 ProgressEventHorde; // 8 Progress Event (Horde), References: GameEvents, NoValue = 0
+ uint32 ProgressEventAlliance; // 9 Progress Event (Alliance), References: GameEvents, NoValue = 0
+ uint32 NeutralEventHorde; // 10 Neutral Event (Horde), References: GameEvents, NoValue = 0
+ uint32 NeutralEventAlliance; // 11 Neutral Event (Alliance), References: GameEvents, NoValue = 0
+ uint32 neutralPercent; // 12 neutralPercent, int, Min value: 0, Max value: 100, Default value: 0
+ uint32 worldstate3; // 13 worldstate3, References: WorldState, NoValue = 0
+ uint32 minSuperiority; // 14 minSuperiority, int, Min value: 1, Max value: 65535, Default value: 1
+ uint32 maxSuperiority; // 15 maxSuperiority, int, Min value: 1, Max value: 65535, Default value: 1
+ uint32 minTime; // 16 minTime, int, Min value: 1, Max value: 65535, Default value: 1
+ uint32 maxTime; // 17 maxTime, int, Min value: 1, Max value: 65535, Default value: 1
+ uint32 GiganticAOI; // 18 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 highlight; // 19 highlight, enum { false, true, }; Default: true
+ uint32 startingValue; // 20 startingValue, int, Min value: 0, Max value: 100, Default value: 50
+ uint32 unidirectional; // 21 unidirectional, enum { false, true, }; Default: false
+ uint32 killbonustime; // 22 kill bonus time %, int, Min value: 0, Max value: 100, Default value: 0
+ uint32 speedWorldState1; // 23 speedWorldState1, References: WorldState, NoValue = 0
+ uint32 speedWorldState2; // 24 speedWorldState2, References: WorldState, NoValue = 0
+ uint32 UncontestedTime; // 25 Uncontested Time, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 FrequentHeartbeat; // 26 Frequent Heartbeat, enum { false, true, }; Default: false
+ } controlZone;
+ // 30 GAMEOBJECT_TYPE_AURA_GENERATOR
+ struct
+ {
+ uint32 startOpen; // 0 startOpen, enum { false, true, }; Default: true
+ uint32 radius; // 1 radius, int, Min value: 0, Max value: 100, Default value: 10
+ uint32 auraID1; // 2 auraID1, References: Spell, NoValue = 0
+ uint32 conditionID1; // 3 conditionID1, References: PlayerCondition, NoValue = 0
+ uint32 auraID2; // 4 auraID2, References: Spell, NoValue = 0
+ uint32 conditionID2; // 5 conditionID2, References: PlayerCondition, NoValue = 0
+ uint32 serverOnly; // 6 serverOnly, enum { false, true, }; Default: false
+ } auraGenerator;
+ // 31 GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY
+ struct
+ {
+ uint32 InstanceType; // 0 Instance Type, enum { Not Instanced, Party Dungeon, Raid Dungeon, PVP Battlefield, Arena Battlefield, Scenario, }; Default: Party Dungeon
+ uint32 DifficultyNormal; // 1 Difficulty Normal, References: animationdata, NoValue = 0
+ uint32 DifficultyHeroic; // 2 Difficulty Heroic, References: animationdata, NoValue = 0
+ uint32 DifficultyEpic; // 3 Difficulty Epic, References: animationdata, NoValue = 0
+ uint32 DifficultyLegendary; // 4 Difficulty Legendary, References: animationdata, NoValue = 0
+ uint32 HeroicAttachment; // 5 Heroic Attachment, References: gameobjectdisplayinfo, NoValue = 0
+ uint32 ChallengeAttachment; // 6 Challenge Attachment, References: gameobjectdisplayinfo, NoValue = 0
+ uint32 DifficultyAnimations; // 7 Difficulty Animations, References: GameObjectDiffAnim, NoValue = 0
+ uint32 LargeAOI; // 8 Large AOI, enum { false, true, }; Default: false
+ uint32 GiganticAOI; // 9 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 Legacy; // 10 Legacy, enum { false, true, }; Default: false
+ } dungeonDifficulty;
+ // 32 GAMEOBJECT_TYPE_BARBER_CHAIR
+ struct
+ {
+ uint32 chairheight; // 0 chairheight, int, Min value: 0, Max value: 2, Default value: 1
+ int32 HeightOffset; // 1 Height Offset (inches), int, Min value: -100, Max value: 100, Default value: 0
+ uint32 SitAnimKit; // 2 Sit Anim Kit, References: AnimKit, NoValue = 0
+ } barberChair;
+ // 33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
+ struct
+ {
+ int32 Unused; // 0 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
+ uint32 CreditProxyCreature; // 1 Credit Proxy Creature, References: Creature, NoValue = 0
+ uint32 HealthRec; // 2 Health Rec, References: DestructibleHitpoint, NoValue = 0
+ uint32 IntactEvent; // 3 Intact Event, References: GameEvents, NoValue = 0
+ uint32 PVPEnabling; // 4 PVP Enabling, enum { false, true, }; Default: false
+ uint32 InteriorVisible; // 5 Interior Visible, enum { false, true, }; Default: false
+ uint32 InteriorLight; // 6 Interior Light, enum { false, true, }; Default: false
+ int32 Unused1; // 7 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
+ int32 Unused2; // 8 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
+ uint32 DamagedEvent; // 9 Damaged Event, References: GameEvents, NoValue = 0
+ int32 Unused3; // 10 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
+ int32 Unused4; // 11 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
+ int32 Unused5; // 12 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
+ int32 Unused6; // 13 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
+ uint32 DestroyedEvent; // 14 Destroyed Event, References: GameEvents, NoValue = 0
+ int32 Unused7; // 15 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
+ uint32 RebuildingTime; // 16 Rebuilding: Time (secs), int, Min value: 0, Max value: 65535, Default value: 0
+ int32 Unused8; // 17 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
+ uint32 DestructibleModelRec; // 18 Destructible Model Rec, References: DestructibleModelData, NoValue = 0
+ uint32 RebuildingEvent; // 19 Rebuilding: Event, References: GameEvents, NoValue = 0
+ int32 Unused9; // 20 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
+ int32 Unused10; // 21 Unused, int, Min value: -2147483648, Max value: 2147483647, Default value: 0
+ uint32 DamageEvent; // 22 Damage Event, References: GameEvents, NoValue = 0
+ } destructibleBuilding;
+ // 34 GAMEOBJECT_TYPE_GUILD_BANK
+ struct
+ {
+ uint32 conditionID1; // 0 conditionID1, References: PlayerCondition, NoValue = 0
+ } guildbank;
+ // 35 GAMEOBJECT_TYPE_TRAPDOOR
+ struct
+ {
+ uint32 AutoLink; // 0 Auto Link, enum { false, true, }; Default: false
+ uint32 startOpen; // 1 startOpen, enum { false, true, }; Default: false
+ uint32 autoClose; // 2 autoClose (ms), int, Min value: 0, Max value: 2147483647, Default value: 0
+ uint32 BlocksPathsDown; // 3 Blocks Paths Down, enum { false, true, }; Default: false
+ uint32 PathBlockerBump; // 4 Path Blocker Bump (ft), int, Min value: -2147483648, Max value: 2147483647, Default value: 0
+ } trapdoor;
+ // 36 GAMEOBJECT_TYPE_NEW_FLAG
+ struct
+ {
+ uint32 open; // 0 open, References: Lock_, NoValue = 0
+ uint32 pickupSpell; // 1 pickupSpell, References: Spell, NoValue = 0
+ uint32 openTextID; // 2 openTextID, References: BroadcastText, NoValue = 0
+ uint32 requireLOS; // 3 require LOS, enum { false, true, }; Default: true
+ uint32 conditionID1; // 4 conditionID1, References: PlayerCondition, NoValue = 0
+ uint32 GiganticAOI; // 5 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 InfiniteAOI; // 6 Infinite AOI, enum { false, true, }; Default: false
+ uint32 ExpireDuration; // 7 Expire Duration, int, Min value: 0, Max value: 3600000, Default value: 10000
+ uint32 RespawnTime; // 8 Respawn Time, int, Min value: 0, Max value: 3600000, Default value: 20000
+ uint32 FlagDrop; // 9 Flag Drop, References: GameObjects, NoValue = 0
+ int32 ExclusiveCategory; // 10 Exclusive Category (BGs Only), int, Min value: -2147483648, Max value: 2147483647, Default value: 0
+ uint32 worldState1; // 11 worldState1, References: WorldState, NoValue = 0
+ uint32 ReturnonDefenderInteract; // 12 Return on Defender Interact, enum { false, true, }; Default: false
+ } newflag;
+ // 37 GAMEOBJECT_TYPE_NEW_FLAG_DROP
+ struct
+ {
+ uint32 open; // 0 open, References: Lock_, NoValue = 0
+ } newflagdrop;
+ // 38 GAMEOBJECT_TYPE_GARRISON_BUILDING
+ struct
+ {
+ int32 SpawnMap; // 0 Spawn Map, References: Map, NoValue = -1
+ } garrisonBuilding;
+ // 39 GAMEOBJECT_TYPE_GARRISON_PLOT
+ struct
+ {
+ uint32 PlotInstance; // 0 Plot Instance, References: GarrPlotInstance, NoValue = 0
+ int32 SpawnMap; // 1 Spawn Map, References: Map, NoValue = -1
+ } garrisonPlot;
+ // 40 GAMEOBJECT_TYPE_CLIENT_CREATURE
+ struct
+ {
+ uint32 CreatureDisplayInfo; // 0 Creature Display Info, References: CreatureDisplayInfo, NoValue = 0
+ uint32 AnimKit; // 1 Anim Kit, References: AnimKit, NoValue = 0
+ uint32 creatureID; // 2 creatureID, References: Creature, NoValue = 0
+ } clientCreature;
+ // 41 GAMEOBJECT_TYPE_CLIENT_ITEM
+ struct
+ {
+ uint32 Item; // 0 Item, References: Item, NoValue = 0
+ } clientItem;
+ // 42 GAMEOBJECT_TYPE_CAPTURE_POINT
+ struct
+ {
+ uint32 CaptureTime; // 0 Capture Time (ms), int, Min value: 0, Max value: 2147483647, Default value: 60000
+ uint32 GiganticAOI; // 1 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 highlight; // 2 highlight, enum { false, true, }; Default: true
+ uint32 open; // 3 open, References: Lock_, NoValue = 0
+ uint32 AssaultBroadcastHorde; // 4 Assault Broadcast (Horde), References: BroadcastText, NoValue = 0
+ uint32 CaptureBroadcastHorde; // 5 Capture Broadcast (Horde), References: BroadcastText, NoValue = 0
+ uint32 DefendedBroadcastHorde; // 6 Defended Broadcast (Horde), References: BroadcastText, NoValue = 0
+ uint32 AssaultBroadcastAlliance; // 7 Assault Broadcast (Alliance), References: BroadcastText, NoValue = 0
+ uint32 CaptureBroadcastAlliance; // 8 Capture Broadcast (Alliance), References: BroadcastText, NoValue = 0
+ uint32 DefendedBroadcastAlliance; // 9 Defended Broadcast (Alliance), References: BroadcastText, NoValue = 0
+ uint32 worldState1; // 10 worldState1, References: WorldState, NoValue = 0
+ uint32 ContestedEventHorde; // 11 Contested Event (Horde), References: GameEvents, NoValue = 0
+ uint32 CaptureEventHorde; // 12 Capture Event (Horde), References: GameEvents, NoValue = 0
+ uint32 DefendedEventHorde; // 13 Defended Event (Horde), References: GameEvents, NoValue = 0
+ uint32 ContestedEventAlliance; // 14 Contested Event (Alliance), References: GameEvents, NoValue = 0
+ uint32 CaptureEventAlliance; // 15 Capture Event (Alliance), References: GameEvents, NoValue = 0
+ uint32 DefendedEventAlliance; // 16 Defended Event (Alliance), References: GameEvents, NoValue = 0
+ uint32 SpellVisual1; // 17 Spell Visual 1, References: SpellVisual, NoValue = 0
+ uint32 SpellVisual2; // 18 Spell Visual 2, References: SpellVisual, NoValue = 0
+ uint32 SpellVisual3; // 19 Spell Visual 3, References: SpellVisual, NoValue = 0
+ uint32 SpellVisual4; // 20 Spell Visual 4, References: SpellVisual, NoValue = 0
+ uint32 SpellVisual5; // 21 Spell Visual 5, References: SpellVisual, NoValue = 0
+ } capturePoint;
+ // 43 GAMEOBJECT_TYPE_PHASEABLE_MO
+ struct
+ {
+ int32 SpawnMap; // 0 Spawn Map, References: Map, NoValue = -1
+ uint32 AreaNameSet; // 1 Area Name Set (Index), int, Min value: -2147483648, Max value: 2147483647, Default value: 0
+ uint32 DoodadSetA; // 2 Doodad Set A, int, Min value: 0, Max value: 2147483647, Default value: 0
+ uint32 DoodadSetB; // 3 Doodad Set B, int, Min value: 0, Max value: 2147483647, Default value: 0
+ } phaseableMO;
+ // 44 GAMEOBJECT_TYPE_GARRISON_MONUMENT
+ struct
+ {
+ uint32 TrophyTypeID; // 0 Trophy Type ID, References: TrophyType, NoValue = 0
+ uint32 TrophyInstanceID; // 1 Trophy Instance ID, References: TrophyInstance, NoValue = 0
+ } garrisonMonument;
+ // 45 GAMEOBJECT_TYPE_GARRISON_SHIPMENT
+ struct
+ {
+ uint32 ShipmentContainer; // 0 Shipment Container, References: CharShipmentContainer, NoValue = 0
+ uint32 GiganticAOI; // 1 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 LargeAOI; // 2 Large AOI, enum { false, true, }; Default: false
+ } garrisonShipment;
+ // 46 GAMEOBJECT_TYPE_GARRISON_MONUMENT_PLAQUE
+ struct
+ {
+ uint32 TrophyInstanceID; // 0 Trophy Instance ID, References: TrophyInstance, NoValue = 0
+ } garrisonMonumentPlaque;
+ // 47 GAMEOBJECT_TYPE_ARTIFACT_FORGE
+ struct
+ {
+ uint32 conditionID1; // 0 conditionID1, References: PlayerCondition, NoValue = 0
+ uint32 LargeAOI; // 1 Large AOI, enum { false, true, }; Default: false
+ uint32 IgnoreBoundingBox; // 2 Ignore Bounding Box, enum { false, true, }; Default: false
+ uint32 CameraMode; // 3 Camera Mode, References: CameraMode, NoValue = 0
+ uint32 FadeRegionRadius; // 4 Fade Region Radius, int, Min value: 0, Max value: 2147483647, Default value: 0
+ } artifactForge;
+ // 48 GAMEOBJECT_TYPE_UI_LINK
+ struct
+ {
+ uint32 UILinkType; // 0 UI Link Type, enum { Adventure Journal, Obliterum Forge, }; Default: Adventure Journal
+ uint32 allowMounted; // 1 allowMounted, enum { false, true, }; Default: false
+ uint32 GiganticAOI; // 2 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 spellFocusType; // 3 spellFocusType, References: SpellFocusObject, NoValue = 0
+ uint32 radius; // 4 radius, int, Min value: 0, Max value: 50, Default value: 10
+ } UILink;
+ // 49 GAMEOBJECT_TYPE_KEYSTONE_RECEPTACLE
+ struct
+ {
+ } KeystoneReceptacle;
+ // 50 GAMEOBJECT_TYPE_GATHERING_NODE
+ struct
+ {
+ uint32 open; // 0 open, References: Lock_, NoValue = 0
+ uint32 chestLoot; // 1 chestLoot, References: Treasure, NoValue = 0
+ uint32 level; // 2 level, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 notInCombat; // 3 notInCombat, enum { false, true, }; Default: false
+ uint32 trivialSkillLow; // 4 trivialSkillLow, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 trivialSkillHigh; // 5 trivialSkillHigh, int, Min value: 0, Max value: 65535, Default value: 0
+ uint32 ObjectDespawnDelay; // 6 Object Despawn Delay, int, Min value: 0, Max value: 600, Default value: 15
+ uint32 triggeredEvent; // 7 triggeredEvent, References: GameEvents, NoValue = 0
+ uint32 requireLOS; // 8 require LOS, enum { false, true, }; Default: false
+ uint32 openTextID; // 9 openTextID, References: BroadcastText, NoValue = 0
+ uint32 floatingTooltip; // 10 floatingTooltip, enum { false, true, }; Default: false
+ uint32 conditionID1; // 11 conditionID1, References: PlayerCondition, NoValue = 0
+ uint32 xpLevel; // 12 xpLevel, int, Min value: -1, Max value: 123, Default value: 0
+ uint32 xpDifficulty; // 13 xpDifficulty, enum { No Exp, Trivial, Very Small, Small, Substandard, Standard, High, Epic, Dungeon, 5, }; Default: No Exp
+ uint32 spell; // 14 spell, References: Spell, NoValue = 0
+ uint32 GiganticAOI; // 15 Gigantic AOI, enum { false, true, }; Default: false
+ uint32 LargeAOI; // 16 Large AOI, enum { false, true, }; Default: false
+ uint32 SpawnVignette; // 17 Spawn Vignette, References: vignette, NoValue = 0
+ uint32 MaxNumberofLoots; // 18 Max Number of Loots, int, Min value: 1, Max value: 40, Default value: 10
+ uint32 logloot; // 19 log loot, enum { false, true, }; Default: false
+ uint32 linkedTrap; // 20 linkedTrap, References: GameObjects, NoValue = 0
+ } gatheringNode;
+ // 51 GAMEOBJECT_TYPE_CHALLENGE_MODE_REWARD
+ struct
+ {
+ uint32 chestLoot; // 0 chestLoot, References: Treasure, NoValue = 0
+ uint32 WhenAvailable; // 1 When Available, References: GameObjectDisplayInfo, NoValue = 0
+ } challengeModeReward;
+ struct
+ {
+ uint32 data[MAX_GAMEOBJECT_DATA];
+ } raw;
+ };
+
+ std::string AIName;
+ uint32 ScriptId;
+
+ // helpers
+ bool IsDespawnAtAction() const
+ {
+ switch (type)
+ {
+ case GAMEOBJECT_TYPE_CHEST: return chest.consumable != 0;
+ case GAMEOBJECT_TYPE_GOOBER: return goober.consumable != 0;
+ default: return false;
+ }
+ }
+
+ bool IsUsableMounted() const
+ {
+ switch (type)
+ {
+ case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.allowMounted != 0;
+ case GAMEOBJECT_TYPE_TEXT: return text.allowMounted != 0;
+ case GAMEOBJECT_TYPE_GOOBER: return goober.allowMounted != 0;
+ case GAMEOBJECT_TYPE_SPELLCASTER: return spellCaster.allowMounted != 0;
+ case GAMEOBJECT_TYPE_UI_LINK: return UILink.allowMounted != 0;
+ default: return false;
+ }
+ }
+
+ uint32 GetLockId() const
+ {
+ switch (type)
+ {
+ case GAMEOBJECT_TYPE_DOOR: return door.open;
+ case GAMEOBJECT_TYPE_BUTTON: return button.open;
+ case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.open;
+ case GAMEOBJECT_TYPE_CHEST: return chest.open;
+ case GAMEOBJECT_TYPE_TRAP: return trap.open;
+ case GAMEOBJECT_TYPE_GOOBER: return goober.open;
+ case GAMEOBJECT_TYPE_AREADAMAGE: return areaDamage.open;
+ case GAMEOBJECT_TYPE_CAMERA: return camera.open;
+ case GAMEOBJECT_TYPE_FLAGSTAND: return flagStand.open;
+ case GAMEOBJECT_TYPE_FISHINGHOLE: return fishingHole.open;
+ case GAMEOBJECT_TYPE_FLAGDROP: return flagDrop.open;
+ case GAMEOBJECT_TYPE_NEW_FLAG: return newflag.open;
+ case GAMEOBJECT_TYPE_NEW_FLAG_DROP: return newflagdrop.open;
+ case GAMEOBJECT_TYPE_CAPTURE_POINT: return capturePoint.open;
+ case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.open;
+ default: return 0;
+ }
+ }
+
+ bool GetDespawnPossibility() const // despawn at targeting of cast?
+ {
+ switch (type)
+ {
+ case GAMEOBJECT_TYPE_DOOR: return door.noDamageImmune != 0;
+ case GAMEOBJECT_TYPE_BUTTON: return button.noDamageImmune != 0;
+ case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.noDamageImmune != 0;
+ case GAMEOBJECT_TYPE_GOOBER: return goober.noDamageImmune != 0;
+ case GAMEOBJECT_TYPE_FLAGSTAND: return flagStand.noDamageImmune != 0;
+ case GAMEOBJECT_TYPE_FLAGDROP: return flagDrop.noDamageImmune != 0;
+ default: return true;
+ }
+ }
+
+ uint32 GetCharges() const // despawn at uses amount
+ {
+ switch (type)
+ {
+ //case GAMEOBJECT_TYPE_TRAP: return trap.charges;
+ case GAMEOBJECT_TYPE_GUARDPOST: return guardPost.charges;
+ case GAMEOBJECT_TYPE_SPELLCASTER: return spellCaster.charges;
+ default: return 0;
+ }
+ }
+
+ uint32 GetLinkedGameObjectEntry() const
+ {
+ switch (type)
+ {
+ case GAMEOBJECT_TYPE_BUTTON: return button.linkedTrap;
+ case GAMEOBJECT_TYPE_CHEST: return chest.linkedTrap;
+ case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.linkedTrap;
+ case GAMEOBJECT_TYPE_GOOBER: return goober.linkedTrap;
+ case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.linkedTrap;
+ default: return 0;
+ }
+ }
+
+ uint32 GetAutoCloseTime() const
+ {
+ uint32 autoCloseTime = 0;
+ switch (type)
+ {
+ case GAMEOBJECT_TYPE_DOOR: autoCloseTime = door.autoClose; break;
+ case GAMEOBJECT_TYPE_BUTTON: autoCloseTime = button.autoClose; break;
+ case GAMEOBJECT_TYPE_TRAP: autoCloseTime = trap.autoClose; break;
+ case GAMEOBJECT_TYPE_GOOBER: autoCloseTime = goober.autoClose; break;
+ case GAMEOBJECT_TYPE_TRANSPORT: autoCloseTime = transport.autoClose; break;
+ case GAMEOBJECT_TYPE_AREADAMAGE: autoCloseTime = areaDamage.autoClose; break;
+ case GAMEOBJECT_TYPE_TRAPDOOR: autoCloseTime = trapdoor.autoClose; break;
+ default: break;
+ }
+ return autoCloseTime / IN_MILLISECONDS; // prior to 3.0.3, conversion was / 0x10000;
+ }
+
+ uint32 GetLootId() const
+ {
+ switch (type)
+ {
+ case GAMEOBJECT_TYPE_CHEST: return chest.chestLoot;
+ case GAMEOBJECT_TYPE_FISHINGHOLE: return fishingHole.chestLoot;
+ case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.chestLoot;
+ case GAMEOBJECT_TYPE_CHALLENGE_MODE_REWARD: return challengeModeReward.chestLoot;
+ default: return 0;
+ }
+ }
+
+ uint32 GetGossipMenuId() const
+ {
+ switch (type)
+ {
+ case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.gossipID;
+ case GAMEOBJECT_TYPE_GOOBER: return goober.gossipID;
+ default: return 0;
+ }
+ }
+
+ uint32 GetEventScriptId() const
+ {
+ switch (type)
+ {
+ case GAMEOBJECT_TYPE_GOOBER: return goober.eventID;
+ case GAMEOBJECT_TYPE_CHEST: return chest.triggeredEvent;
+ case GAMEOBJECT_TYPE_CAMERA: return camera.eventID;
+ case GAMEOBJECT_TYPE_GATHERING_NODE: return gatheringNode.triggeredEvent;
+ default: return 0;
+ }
+ }
+
+ uint32 GetCooldown() const // Cooldown preventing goober and traps to cast spell
+ {
+ switch (type)
+ {
+ case GAMEOBJECT_TYPE_TRAP: return trap.cooldown;
+ case GAMEOBJECT_TYPE_GOOBER: return goober.cooldown;
+ default: return 0;
+ }
+ }
+};
+
+// From `gameobject_template_addon`
+struct GameObjectTemplateAddon
+{
+ uint32 entry;
+ uint32 faction;
+ uint32 flags;
+ uint32 mingold;
+ uint32 maxgold;
+};
+
+
+struct GameObjectLocale
+{
+ std::vector<std::string> Name;
+ std::vector<std::string> CastBarCaption;
+ std::vector<std::string> Unk1;
+};
+
+struct TC_GAME_API QuaternionData
+{
+ float x, y, z, w;
+
+ QuaternionData() : x(0.0f), y(0.0f), z(0.0f), w(1.0f) {}
+ QuaternionData(float X, float Y, float Z, float W) : x(X), y(Y), z(Z), w(W) {}
+
+ bool isUnit() const;
+ static QuaternionData fromEulerAnglesZYX(float Z, float Y, float X);
+};
+
+// `gameobject_addon` table
+struct GameObjectAddon
+{
+ QuaternionData ParentRotation;
+ InvisibilityType invisibilityType;
+ uint32 InvisibilityValue;
+};
+
+// from `gameobject`
+struct GameObjectData
+{
+ explicit GameObjectData() : id(0), mapid(0), phaseMask(0), posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0),
+ animprogress(0), go_state(GO_STATE_ACTIVE), spawnMask(0), artKit(0), phaseid(0), phaseGroup(0), dbData(true) { }
+ uint32 id; // entry in gamobject_template
+ uint16 mapid;
+ uint32 phaseMask;
+ float posX;
+ float posY;
+ float posZ;
+ float orientation;
+ QuaternionData rotation;
+ int32 spawntimesecs;
+ uint32 animprogress;
+ GOState go_state;
+ uint32 spawnMask;
+ uint8 artKit;
+ uint32 phaseid;
+ uint32 phaseGroup;
+ uint32 ScriptId;
+ bool dbData;
+};
+
+#endif // GameObjectData_h__
diff --git a/src/server/game/Entities/Item/Container/Bag.h b/src/server/game/Entities/Item/Container/Bag.h
index c9276f2a855..eaa7507de75 100644
--- a/src/server/game/Entities/Item/Container/Bag.h
+++ b/src/server/game/Entities/Item/Container/Bag.h
@@ -23,7 +23,6 @@
#define MAX_BAG_SIZE 36 // 2.0.12
#include "Item.h"
-#include "ItemTemplate.h"
class TC_GAME_API Bag : public Item
{
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index cf0679a0395..d81c4e8e59d 100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -18,24 +18,26 @@
#include "Item.h"
#include "ArtifactPackets.h"
+#include "Bag.h"
#include "CollectionMgr.h"
#include "Common.h"
#include "ConditionMgr.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "GameTables.h"
#include "ItemEnchantmentMgr.h"
#include "ItemPackets.h"
#include "Log.h"
#include "LootMgr.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
-#include "Opcodes.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
#include "TradeData.h"
#include "UpdateData.h"
-#include "WorldPacket.h"
#include "WorldSession.h"
void AddItemsSetItem(Player* player, Item* item)
@@ -958,7 +960,7 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
// pretend the item never existed
if (forplayer)
{
- RemoveFromUpdateQueueOf(forplayer);
+ RemoveItemFromUpdateQueueOf(this, forplayer);
forplayer->DeleteRefundReference(GetGUID());
}
delete this;
@@ -971,7 +973,7 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
uState = state;
if (forplayer)
- AddToUpdateQueueOf(forplayer);
+ AddItemToUpdateQueueOf(this, forplayer);
}
else
{
@@ -982,46 +984,46 @@ void Item::SetState(ItemUpdateState state, Player* forplayer)
}
}
-void Item::AddToUpdateQueueOf(Player* player)
+void AddItemToUpdateQueueOf(Item* item, Player* player)
{
- if (IsInUpdateQueue())
+ if (item->IsInUpdateQueue())
return;
ASSERT(player != NULL);
- if (player->GetGUID() != GetOwnerGUID())
+ if (player->GetGUID() != item->GetOwnerGUID())
{
TC_LOG_DEBUG("entities.player.items", "Item::AddToUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!",
- GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str());
+ item->GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str());
return;
}
if (player->m_itemUpdateQueueBlocked)
return;
- player->m_itemUpdateQueue.push_back(this);
- uQueuePos = player->m_itemUpdateQueue.size()-1;
+ player->m_itemUpdateQueue.push_back(item);
+ item->uQueuePos = player->m_itemUpdateQueue.size() - 1;
}
-void Item::RemoveFromUpdateQueueOf(Player* player)
+void RemoveItemFromUpdateQueueOf(Item* item, Player* player)
{
- if (!IsInUpdateQueue())
+ if (!item->IsInUpdateQueue())
return;
ASSERT(player != NULL);
- if (player->GetGUID() != GetOwnerGUID())
+ if (player->GetGUID() != item->GetOwnerGUID())
{
TC_LOG_DEBUG("entities.player.items", "Item::RemoveFromUpdateQueueOf - Owner's guid (%s) and player's guid (%s) don't match!",
- GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str());
+ item->GetOwnerGUID().ToString().c_str(), player->GetGUID().ToString().c_str());
return;
}
if (player->m_itemUpdateQueueBlocked)
return;
- player->m_itemUpdateQueue[uQueuePos] = NULL;
- uQueuePos = -1;
+ player->m_itemUpdateQueue[item->uQueuePos] = nullptr;
+ item->uQueuePos = -1;
}
uint8 Item::GetBagSlot() const
@@ -1042,7 +1044,7 @@ bool Item::CanBeTraded(bool mail, bool trade) const
if ((!mail || !IsBoundAccountWide()) && (IsSoulBound() && (!HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE) || !trade)))
return false;
- if (IsBag() && (Player::IsBagPos(GetPos()) || !((Bag const*)this)->IsEmpty()))
+ if (IsBag() && (Player::IsBagPos(GetPos()) || !ToBag()->IsEmpty()))
return false;
if (Player* owner = GetOwner())
diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h
index 76e1ef5258b..31dbb82c098 100644
--- a/src/server/game/Entities/Item/Item.h
+++ b/src/server/game/Entities/Item/Item.h
@@ -19,13 +19,13 @@
#ifndef TRINITYCORE_ITEM_H
#define TRINITYCORE_ITEM_H
-#include "Common.h"
#include "Object.h"
-#include "Loot.h"
+#include "Common.h"
+#include "DatabaseEnvFwd.h"
+#include "ItemDefines.h"
#include "ItemEnchantmentMgr.h"
#include "ItemTemplate.h"
-#include "DatabaseEnvFwd.h"
-#include <unordered_set>
+#include "Loot.h"
class SpellInfo;
class Bag;
@@ -45,158 +45,6 @@ struct ItemSetEffect
std::unordered_set<ItemSetSpellEntry const*> SetBonuses;
};
-enum InventoryResult : uint8
-{
- EQUIP_ERR_OK = 0,
- EQUIP_ERR_CANT_EQUIP_LEVEL_I = 1, // You must reach level %d to use that item.
- EQUIP_ERR_CANT_EQUIP_SKILL = 2, // You aren't skilled enough to use that item.
- EQUIP_ERR_WRONG_SLOT = 3, // That item does not go in that slot.
- EQUIP_ERR_BAG_FULL = 4, // That bag is full.
- EQUIP_ERR_BAG_IN_BAG = 5, // Can't put non-empty bags in other bags.
- EQUIP_ERR_TRADE_EQUIPPED_BAG = 6, // You can't trade equipped bags.
- EQUIP_ERR_AMMO_ONLY = 7, // Only ammo can go there.
- EQUIP_ERR_PROFICIENCY_NEEDED = 8, // You do not have the required proficiency for that item.
- EQUIP_ERR_NO_SLOT_AVAILABLE = 9, // No equipment slot is available for that item.
- EQUIP_ERR_CANT_EQUIP_EVER = 10, // You can never use that item.
- EQUIP_ERR_CANT_EQUIP_EVER_2 = 11, // You can never use that item.
- EQUIP_ERR_NO_SLOT_AVAILABLE_2 = 12, // No equipment slot is available for that item.
- EQUIP_ERR_2HANDED_EQUIPPED = 13, // Cannot equip that with a two-handed weapon.
- EQUIP_ERR_2HSKILLNOTFOUND = 14, // You cannot dual-wield
- EQUIP_ERR_WRONG_BAG_TYPE = 15, // That item doesn't go in that container.
- EQUIP_ERR_WRONG_BAG_TYPE_2 = 16, // That item doesn't go in that container.
- EQUIP_ERR_ITEM_MAX_COUNT = 17, // You can't carry any more of those items.
- EQUIP_ERR_NO_SLOT_AVAILABLE_3 = 18, // No equipment slot is available for that item.
- EQUIP_ERR_CANT_STACK = 19, // This item cannot stack.
- EQUIP_ERR_NOT_EQUIPPABLE = 20, // This item cannot be equipped.
- EQUIP_ERR_CANT_SWAP = 21, // These items can't be swapped.
- EQUIP_ERR_SLOT_EMPTY = 22, // That slot is empty.
- EQUIP_ERR_ITEM_NOT_FOUND = 23, // The item was not found.
- EQUIP_ERR_DROP_BOUND_ITEM = 24, // You can't drop a soulbound item.
- EQUIP_ERR_OUT_OF_RANGE = 25, // Out of range.
- EQUIP_ERR_TOO_FEW_TO_SPLIT = 26, // Tried to split more than number in stack.
- EQUIP_ERR_SPLIT_FAILED = 27, // Couldn't split those items.
- EQUIP_ERR_SPELL_FAILED_REAGENTS_GENERIC = 28, // Missing reagent
- EQUIP_ERR_NOT_ENOUGH_MONEY = 29, // You don't have enough money.
- EQUIP_ERR_NOT_A_BAG = 30, // Not a bag.
- EQUIP_ERR_DESTROY_NONEMPTY_BAG = 31, // You can only do that with empty bags.
- EQUIP_ERR_NOT_OWNER = 32, // You don't own that item.
- EQUIP_ERR_ONLY_ONE_QUIVER = 33, // You can only equip one quiver.
- EQUIP_ERR_NO_BANK_SLOT = 34, // You must purchase that bag slot first
- EQUIP_ERR_NO_BANK_HERE = 35, // You are too far away from a bank.
- EQUIP_ERR_ITEM_LOCKED = 36, // Item is locked.
- EQUIP_ERR_GENERIC_STUNNED = 37, // You are stunned
- EQUIP_ERR_PLAYER_DEAD = 38, // You can't do that when you're dead.
- EQUIP_ERR_CLIENT_LOCKED_OUT = 39, // You can't do that right now.
- EQUIP_ERR_INTERNAL_BAG_ERROR = 40, // Internal Bag Error
- EQUIP_ERR_ONLY_ONE_BOLT = 41, // You can only equip one quiver.
- EQUIP_ERR_ONLY_ONE_AMMO = 42, // You can only equip one ammo pouch.
- EQUIP_ERR_CANT_WRAP_STACKABLE = 43, // Stackable items can't be wrapped.
- EQUIP_ERR_CANT_WRAP_EQUIPPED = 44, // Equipped items can't be wrapped.
- EQUIP_ERR_CANT_WRAP_WRAPPED = 45, // Wrapped items can't be wrapped.
- EQUIP_ERR_CANT_WRAP_BOUND = 46, // Bound items can't be wrapped.
- EQUIP_ERR_CANT_WRAP_UNIQUE = 47, // Unique items can't be wrapped.
- EQUIP_ERR_CANT_WRAP_BAGS = 48, // Bags can't be wrapped.
- EQUIP_ERR_LOOT_GONE = 49, // Already looted
- EQUIP_ERR_INV_FULL = 50, // Inventory is full.
- EQUIP_ERR_BANK_FULL = 51, // Your bank is full
- EQUIP_ERR_VENDOR_SOLD_OUT = 52, // That item is currently sold out.
- EQUIP_ERR_BAG_FULL_2 = 53, // That bag is full.
- EQUIP_ERR_ITEM_NOT_FOUND_2 = 54, // The item was not found.
- EQUIP_ERR_CANT_STACK_2 = 55, // This item cannot stack.
- EQUIP_ERR_BAG_FULL_3 = 56, // That bag is full.
- EQUIP_ERR_VENDOR_SOLD_OUT_2 = 57, // That item is currently sold out.
- EQUIP_ERR_OBJECT_IS_BUSY = 58, // That object is busy.
- EQUIP_ERR_CANT_BE_DISENCHANTED = 59,
- EQUIP_ERR_NOT_IN_COMBAT = 60, // You can't do that while in combat
- EQUIP_ERR_NOT_WHILE_DISARMED = 61, // You can't do that while disarmed
- EQUIP_ERR_BAG_FULL_4 = 62, // That bag is full.
- EQUIP_ERR_CANT_EQUIP_RANK = 63, // You don't have the required rank for that item
- EQUIP_ERR_CANT_EQUIP_REPUTATION = 64, // You don't have the required reputation for that item
- EQUIP_ERR_TOO_MANY_SPECIAL_BAGS = 65, // You cannot equip another bag of that type
- EQUIP_ERR_LOOT_CANT_LOOT_THAT_NOW = 66, // You can't loot that item now.
- EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE = 67, // You cannot equip more than one of those.
- EQUIP_ERR_VENDOR_MISSING_TURNINS = 68, // You do not have the required items for that purchase
- EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS = 69, // You don't have enough honor points
- EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS = 70, // You don't have enough arena points
- EQUIP_ERR_ITEM_MAX_COUNT_SOCKETED = 71, // You have the maximum number of those gems in your inventory or socketed into items.
- EQUIP_ERR_MAIL_BOUND_ITEM = 72, // You can't mail soulbound items.
- EQUIP_ERR_INTERNAL_BAG_ERROR_2 = 73, // Internal Bag Error
- EQUIP_ERR_BAG_FULL_5 = 74, // That bag is full.
- EQUIP_ERR_ITEM_MAX_COUNT_EQUIPPED_SOCKETED = 75, // You have the maximum number of those gems socketed into equipped items.
- EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED = 76, // You cannot socket more than one of those gems into a single item.
- EQUIP_ERR_TOO_MUCH_GOLD = 77, // At gold limit
- EQUIP_ERR_NOT_DURING_ARENA_MATCH = 78, // You can't do that while in an arena match
- EQUIP_ERR_TRADE_BOUND_ITEM = 79, // You can't trade a soulbound item.
- EQUIP_ERR_CANT_EQUIP_RATING = 80, // You don't have the personal, team, or battleground rating required to buy that item
- EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM = 81,
- EQUIP_ERR_NOT_SAME_ACCOUNT = 82, // Account-bound items can only be given to your own characters.
- EQUIP_ERR_NO_OUTPUT = 83,
- EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED_IS = 84, // You can only carry %d %s
- EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_SOCKETED_EXCEEDED_IS = 85, // You can only equip %d |4item:items in the %s category
- EQUIP_ERR_SCALING_STAT_ITEM_LEVEL_EXCEEDED = 86, // Your level is too high to use that item
- EQUIP_ERR_PURCHASE_LEVEL_TOO_LOW = 87, // You must reach level %d to purchase that item.
- EQUIP_ERR_CANT_EQUIP_NEED_TALENT = 88, // You do not have the required talent to equip that.
- EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED_IS = 89, // You can only equip %d |4item:items in the %s category
- EQUIP_ERR_SHAPESHIFT_FORM_CANNOT_EQUIP = 90, // Cannot equip item in this form
- EQUIP_ERR_ITEM_INVENTORY_FULL_SATCHEL = 91, // Your inventory is full. Your satchel has been delivered to your mailbox.
- EQUIP_ERR_SCALING_STAT_ITEM_LEVEL_TOO_LOW = 92, // Your level is too low to use that item
- EQUIP_ERR_CANT_BUY_QUANTITY = 93, // You can't buy the specified quantity of that item.
- EQUIP_ERR_ITEM_IS_BATTLE_PAY_LOCKED = 94, // Your purchased item is still waiting to be unlocked
- EQUIP_ERR_REAGENT_BANK_FULL = 95, // Your reagent bank is full
- EQUIP_ERR_REAGENT_BANK_LOCKED = 96,
- EQUIP_ERR_WRONG_BAG_TYPE_3 = 97,
- EQUIP_ERR_CANT_USE_ITEM = 98, // You can't use that item.
- EQUIP_ERR_CANT_BE_OBLITERATED = 99, // You can't obliterate that item
- EQUIP_ERR_GUILD_BANK_CONJURED_ITEM = 100,// You cannot store conjured items in the guild bank
-};
-
-enum BuyResult
-{
- BUY_ERR_CANT_FIND_ITEM = 0,
- BUY_ERR_ITEM_ALREADY_SOLD = 1,
- BUY_ERR_NOT_ENOUGHT_MONEY = 2,
- BUY_ERR_SELLER_DONT_LIKE_YOU = 4,
- BUY_ERR_DISTANCE_TOO_FAR = 5,
- BUY_ERR_ITEM_SOLD_OUT = 7,
- BUY_ERR_CANT_CARRY_MORE = 8,
- BUY_ERR_RANK_REQUIRE = 11,
- BUY_ERR_REPUTATION_REQUIRE = 12
-};
-
-enum SellResult
-{
- SELL_ERR_CANT_FIND_ITEM = 1,
- SELL_ERR_CANT_SELL_ITEM = 2, // merchant doesn't like that item
- SELL_ERR_CANT_FIND_VENDOR = 3, // merchant doesn't like you
- SELL_ERR_YOU_DONT_OWN_THAT_ITEM = 4, // you don't own that item
- SELL_ERR_UNK = 5, // nothing appears...
- SELL_ERR_ONLY_EMPTY_BAG = 6 // can only do with empty bags
-};
-
-// -1 from client enchantment slot number
-enum EnchantmentSlot : uint16
-{
- PERM_ENCHANTMENT_SLOT = 0,
- TEMP_ENCHANTMENT_SLOT = 1,
- SOCK_ENCHANTMENT_SLOT = 2,
- SOCK_ENCHANTMENT_SLOT_2 = 3,
- SOCK_ENCHANTMENT_SLOT_3 = 4,
- BONUS_ENCHANTMENT_SLOT = 5,
- PRISMATIC_ENCHANTMENT_SLOT = 6, // added at apply special permanent enchantment
- USE_ENCHANTMENT_SLOT = 7,
-
- MAX_INSPECTED_ENCHANTMENT_SLOT = 8,
-
- PROP_ENCHANTMENT_SLOT_0 = 8, // used with RandomSuffix
- PROP_ENCHANTMENT_SLOT_1 = 9, // used with RandomSuffix
- PROP_ENCHANTMENT_SLOT_2 = 10, // used with RandomSuffix and RandomProperty
- PROP_ENCHANTMENT_SLOT_3 = 11, // used with RandomProperty
- PROP_ENCHANTMENT_SLOT_4 = 12, // used with RandomProperty
- MAX_ENCHANTMENT_SLOT = 13
-};
-
-#define MAX_VISIBLE_ITEM_OFFSET 2 // 2 fields per visible item (entry+enchantment)
-
#define MAX_GEM_SOCKETS MAX_ITEM_PROTO_SOCKETS// (BONUS_ENCHANTMENT_SLOT-SOCK_ENCHANTMENT_SLOT) and item proto size, equal value expected
enum EnchantmentOffset
@@ -208,16 +56,6 @@ enum EnchantmentOffset
#define MAX_ENCHANTMENT_OFFSET 3
-enum EnchantmentSlotMask
-{
- ENCHANTMENT_CAN_SOULBOUND = 0x01,
- ENCHANTMENT_UNK1 = 0x02,
- ENCHANTMENT_UNK2 = 0x04,
- ENCHANTMENT_UNK3 = 0x08,
- ENCHANTMENT_COLLECTABLE = 0x100,
- ENCHANTMENT_HIDE_IF_NOT_COLLECTED = 0x200,
-};
-
enum ItemUpdateState
{
ITEM_UNCHANGED = 0,
@@ -226,36 +64,6 @@ enum ItemUpdateState
ITEM_REMOVED = 3
};
-enum ItemModifier : uint16
-{
- ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS = 0,
- ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_1 = 1,
- ITEM_MODIFIER_UPGRADE_ID = 2,
- ITEM_MODIFIER_BATTLE_PET_SPECIES_ID = 3,
- ITEM_MODIFIER_BATTLE_PET_BREED_DATA = 4, // (breedId) | (breedQuality << 24)
- ITEM_MODIFIER_BATTLE_PET_LEVEL = 5,
- ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID = 6,
- ITEM_MODIFIER_ENCHANT_ILLUSION_ALL_SPECS = 7,
- ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID = 8,
- ITEM_MODIFIER_SCALING_STAT_DISTRIBUTION_FIXED_LEVEL = 9,
- ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_1 = 10,
- ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_2 = 11,
- ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_2 = 12,
- ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_3 = 13,
- ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_3 = 14,
- ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_4 = 15,
- ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_4 = 16,
- ITEM_MODIFIER_CHALLENGE_MAP_CHALLENGE_MODE_ID = 17,
- ITEM_MODIFIER_CHALLENGE_KEYSTONE_LEVEL = 18,
- ITEM_MODIFIER_CHALLENGE_KEYSTONE_AFFIX_ID_1 = 19,
- ITEM_MODIFIER_CHALLENGE_KEYSTONE_AFFIX_ID_2 = 20,
- ITEM_MODIFIER_CHALLENGE_KEYSTONE_AFFIX_ID_3 = 21,
- ITEM_MODIFIER_CHALLENGE_KEYSTONE_IS_CHARGED = 22,
- ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL = 23,
- ITEM_MODIFIER_ARTIFACT_TIER = 24,
-
- MAX_ITEM_MODIFIERS
-};
#define MAX_ITEM_SPELLS 5
@@ -318,6 +126,8 @@ struct ItemDynamicFieldGems
class TC_GAME_API Item : public Object
{
+ friend void AddItemToUpdateQueueOf(Item* item, Player* player);
+ friend void RemoveItemFromUpdateQueueOf(Item* item, Player* player);
public:
static Item* CreateItem(uint32 itemEntry, uint32 count, Player const* player = NULL);
Item* CloneItem(uint32 count, Player const* player = NULL) const;
@@ -435,7 +245,6 @@ class TC_GAME_API Item : public Object
// Update States
ItemUpdateState GetState() const { return uState; }
void SetState(ItemUpdateState state, Player* forplayer = NULL);
- void AddToUpdateQueueOf(Player* player);
void RemoveFromUpdateQueueOf(Player* player);
bool IsInUpdateQueue() const { return uQueuePos != -1; }
uint16 GetQueuePos() const { return uQueuePos; }
diff --git a/src/server/game/Entities/Item/ItemDefines.h b/src/server/game/Entities/Item/ItemDefines.h
new file mode 100644
index 00000000000..012b16e7509
--- /dev/null
+++ b/src/server/game/Entities/Item/ItemDefines.h
@@ -0,0 +1,213 @@
+/*
+ * 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 ItemDefines_h__
+#define ItemDefines_h__
+
+#include "Define.h"
+
+enum InventoryResult : uint8
+{
+ EQUIP_ERR_OK = 0,
+ EQUIP_ERR_CANT_EQUIP_LEVEL_I = 1, // You must reach level %d to use that item.
+ EQUIP_ERR_CANT_EQUIP_SKILL = 2, // You aren't skilled enough to use that item.
+ EQUIP_ERR_WRONG_SLOT = 3, // That item does not go in that slot.
+ EQUIP_ERR_BAG_FULL = 4, // That bag is full.
+ EQUIP_ERR_BAG_IN_BAG = 5, // Can't put non-empty bags in other bags.
+ EQUIP_ERR_TRADE_EQUIPPED_BAG = 6, // You can't trade equipped bags.
+ EQUIP_ERR_AMMO_ONLY = 7, // Only ammo can go there.
+ EQUIP_ERR_PROFICIENCY_NEEDED = 8, // You do not have the required proficiency for that item.
+ EQUIP_ERR_NO_SLOT_AVAILABLE = 9, // No equipment slot is available for that item.
+ EQUIP_ERR_CANT_EQUIP_EVER = 10, // You can never use that item.
+ EQUIP_ERR_CANT_EQUIP_EVER_2 = 11, // You can never use that item.
+ EQUIP_ERR_NO_SLOT_AVAILABLE_2 = 12, // No equipment slot is available for that item.
+ EQUIP_ERR_2HANDED_EQUIPPED = 13, // Cannot equip that with a two-handed weapon.
+ EQUIP_ERR_2HSKILLNOTFOUND = 14, // You cannot dual-wield
+ EQUIP_ERR_WRONG_BAG_TYPE = 15, // That item doesn't go in that container.
+ EQUIP_ERR_WRONG_BAG_TYPE_2 = 16, // That item doesn't go in that container.
+ EQUIP_ERR_ITEM_MAX_COUNT = 17, // You can't carry any more of those items.
+ EQUIP_ERR_NO_SLOT_AVAILABLE_3 = 18, // No equipment slot is available for that item.
+ EQUIP_ERR_CANT_STACK = 19, // This item cannot stack.
+ EQUIP_ERR_NOT_EQUIPPABLE = 20, // This item cannot be equipped.
+ EQUIP_ERR_CANT_SWAP = 21, // These items can't be swapped.
+ EQUIP_ERR_SLOT_EMPTY = 22, // That slot is empty.
+ EQUIP_ERR_ITEM_NOT_FOUND = 23, // The item was not found.
+ EQUIP_ERR_DROP_BOUND_ITEM = 24, // You can't drop a soulbound item.
+ EQUIP_ERR_OUT_OF_RANGE = 25, // Out of range.
+ EQUIP_ERR_TOO_FEW_TO_SPLIT = 26, // Tried to split more than number in stack.
+ EQUIP_ERR_SPLIT_FAILED = 27, // Couldn't split those items.
+ EQUIP_ERR_SPELL_FAILED_REAGENTS_GENERIC = 28, // Missing reagent
+ EQUIP_ERR_NOT_ENOUGH_MONEY = 29, // You don't have enough money.
+ EQUIP_ERR_NOT_A_BAG = 30, // Not a bag.
+ EQUIP_ERR_DESTROY_NONEMPTY_BAG = 31, // You can only do that with empty bags.
+ EQUIP_ERR_NOT_OWNER = 32, // You don't own that item.
+ EQUIP_ERR_ONLY_ONE_QUIVER = 33, // You can only equip one quiver.
+ EQUIP_ERR_NO_BANK_SLOT = 34, // You must purchase that bag slot first
+ EQUIP_ERR_NO_BANK_HERE = 35, // You are too far away from a bank.
+ EQUIP_ERR_ITEM_LOCKED = 36, // Item is locked.
+ EQUIP_ERR_GENERIC_STUNNED = 37, // You are stunned
+ EQUIP_ERR_PLAYER_DEAD = 38, // You can't do that when you're dead.
+ EQUIP_ERR_CLIENT_LOCKED_OUT = 39, // You can't do that right now.
+ EQUIP_ERR_INTERNAL_BAG_ERROR = 40, // Internal Bag Error
+ EQUIP_ERR_ONLY_ONE_BOLT = 41, // You can only equip one quiver.
+ EQUIP_ERR_ONLY_ONE_AMMO = 42, // You can only equip one ammo pouch.
+ EQUIP_ERR_CANT_WRAP_STACKABLE = 43, // Stackable items can't be wrapped.
+ EQUIP_ERR_CANT_WRAP_EQUIPPED = 44, // Equipped items can't be wrapped.
+ EQUIP_ERR_CANT_WRAP_WRAPPED = 45, // Wrapped items can't be wrapped.
+ EQUIP_ERR_CANT_WRAP_BOUND = 46, // Bound items can't be wrapped.
+ EQUIP_ERR_CANT_WRAP_UNIQUE = 47, // Unique items can't be wrapped.
+ EQUIP_ERR_CANT_WRAP_BAGS = 48, // Bags can't be wrapped.
+ EQUIP_ERR_LOOT_GONE = 49, // Already looted
+ EQUIP_ERR_INV_FULL = 50, // Inventory is full.
+ EQUIP_ERR_BANK_FULL = 51, // Your bank is full
+ EQUIP_ERR_VENDOR_SOLD_OUT = 52, // That item is currently sold out.
+ EQUIP_ERR_BAG_FULL_2 = 53, // That bag is full.
+ EQUIP_ERR_ITEM_NOT_FOUND_2 = 54, // The item was not found.
+ EQUIP_ERR_CANT_STACK_2 = 55, // This item cannot stack.
+ EQUIP_ERR_BAG_FULL_3 = 56, // That bag is full.
+ EQUIP_ERR_VENDOR_SOLD_OUT_2 = 57, // That item is currently sold out.
+ EQUIP_ERR_OBJECT_IS_BUSY = 58, // That object is busy.
+ EQUIP_ERR_CANT_BE_DISENCHANTED = 59,
+ EQUIP_ERR_NOT_IN_COMBAT = 60, // You can't do that while in combat
+ EQUIP_ERR_NOT_WHILE_DISARMED = 61, // You can't do that while disarmed
+ EQUIP_ERR_BAG_FULL_4 = 62, // That bag is full.
+ EQUIP_ERR_CANT_EQUIP_RANK = 63, // You don't have the required rank for that item
+ EQUIP_ERR_CANT_EQUIP_REPUTATION = 64, // You don't have the required reputation for that item
+ EQUIP_ERR_TOO_MANY_SPECIAL_BAGS = 65, // You cannot equip another bag of that type
+ EQUIP_ERR_LOOT_CANT_LOOT_THAT_NOW = 66, // You can't loot that item now.
+ EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE = 67, // You cannot equip more than one of those.
+ EQUIP_ERR_VENDOR_MISSING_TURNINS = 68, // You do not have the required items for that purchase
+ EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS = 69, // You don't have enough honor points
+ EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS = 70, // You don't have enough arena points
+ EQUIP_ERR_ITEM_MAX_COUNT_SOCKETED = 71, // You have the maximum number of those gems in your inventory or socketed into items.
+ EQUIP_ERR_MAIL_BOUND_ITEM = 72, // You can't mail soulbound items.
+ EQUIP_ERR_INTERNAL_BAG_ERROR_2 = 73, // Internal Bag Error
+ EQUIP_ERR_BAG_FULL_5 = 74, // That bag is full.
+ EQUIP_ERR_ITEM_MAX_COUNT_EQUIPPED_SOCKETED = 75, // You have the maximum number of those gems socketed into equipped items.
+ EQUIP_ERR_ITEM_UNIQUE_EQUIPPABLE_SOCKETED = 76, // You cannot socket more than one of those gems into a single item.
+ EQUIP_ERR_TOO_MUCH_GOLD = 77, // At gold limit
+ EQUIP_ERR_NOT_DURING_ARENA_MATCH = 78, // You can't do that while in an arena match
+ EQUIP_ERR_TRADE_BOUND_ITEM = 79, // You can't trade a soulbound item.
+ EQUIP_ERR_CANT_EQUIP_RATING = 80, // You don't have the personal, team, or battleground rating required to buy that item
+ EQUIP_ERR_EVENT_AUTOEQUIP_BIND_CONFIRM = 81,
+ EQUIP_ERR_NOT_SAME_ACCOUNT = 82, // Account-bound items can only be given to your own characters.
+ EQUIP_ERR_NO_OUTPUT = 83,
+ EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED_IS = 84, // You can only carry %d %s
+ EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_SOCKETED_EXCEEDED_IS = 85, // You can only equip %d |4item:items in the %s category
+ EQUIP_ERR_SCALING_STAT_ITEM_LEVEL_EXCEEDED = 86, // Your level is too high to use that item
+ EQUIP_ERR_PURCHASE_LEVEL_TOO_LOW = 87, // You must reach level %d to purchase that item.
+ EQUIP_ERR_CANT_EQUIP_NEED_TALENT = 88, // You do not have the required talent to equip that.
+ EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED_IS = 89, // You can only equip %d |4item:items in the %s category
+ EQUIP_ERR_SHAPESHIFT_FORM_CANNOT_EQUIP = 90, // Cannot equip item in this form
+ EQUIP_ERR_ITEM_INVENTORY_FULL_SATCHEL = 91, // Your inventory is full. Your satchel has been delivered to your mailbox.
+ EQUIP_ERR_SCALING_STAT_ITEM_LEVEL_TOO_LOW = 92, // Your level is too low to use that item
+ EQUIP_ERR_CANT_BUY_QUANTITY = 93, // You can't buy the specified quantity of that item.
+ EQUIP_ERR_ITEM_IS_BATTLE_PAY_LOCKED = 94, // Your purchased item is still waiting to be unlocked
+ EQUIP_ERR_REAGENT_BANK_FULL = 95, // Your reagent bank is full
+ EQUIP_ERR_REAGENT_BANK_LOCKED = 96,
+ EQUIP_ERR_WRONG_BAG_TYPE_3 = 97,
+ EQUIP_ERR_CANT_USE_ITEM = 98, // You can't use that item.
+ EQUIP_ERR_CANT_BE_OBLITERATED = 99, // You can't obliterate that item
+ EQUIP_ERR_GUILD_BANK_CONJURED_ITEM = 100,// You cannot store conjured items in the guild bank
+};
+
+enum BuyResult
+{
+ BUY_ERR_CANT_FIND_ITEM = 0,
+ BUY_ERR_ITEM_ALREADY_SOLD = 1,
+ BUY_ERR_NOT_ENOUGHT_MONEY = 2,
+ BUY_ERR_SELLER_DONT_LIKE_YOU = 4,
+ BUY_ERR_DISTANCE_TOO_FAR = 5,
+ BUY_ERR_ITEM_SOLD_OUT = 7,
+ BUY_ERR_CANT_CARRY_MORE = 8,
+ BUY_ERR_RANK_REQUIRE = 11,
+ BUY_ERR_REPUTATION_REQUIRE = 12
+};
+
+enum SellResult
+{
+ SELL_ERR_CANT_FIND_ITEM = 1,
+ SELL_ERR_CANT_SELL_ITEM = 2, // merchant doesn't like that item
+ SELL_ERR_CANT_FIND_VENDOR = 3, // merchant doesn't like you
+ SELL_ERR_YOU_DONT_OWN_THAT_ITEM = 4, // you don't own that item
+ SELL_ERR_UNK = 5, // nothing appears...
+ SELL_ERR_ONLY_EMPTY_BAG = 6 // can only do with empty bags
+};
+
+// -1 from client enchantment slot number
+enum EnchantmentSlot : uint16
+{
+ PERM_ENCHANTMENT_SLOT = 0,
+ TEMP_ENCHANTMENT_SLOT = 1,
+ SOCK_ENCHANTMENT_SLOT = 2,
+ SOCK_ENCHANTMENT_SLOT_2 = 3,
+ SOCK_ENCHANTMENT_SLOT_3 = 4,
+ BONUS_ENCHANTMENT_SLOT = 5,
+ PRISMATIC_ENCHANTMENT_SLOT = 6, // added at apply special permanent enchantment
+ USE_ENCHANTMENT_SLOT = 7,
+
+ MAX_INSPECTED_ENCHANTMENT_SLOT = 8,
+
+ PROP_ENCHANTMENT_SLOT_0 = 8, // used with RandomSuffix
+ PROP_ENCHANTMENT_SLOT_1 = 9, // used with RandomSuffix
+ PROP_ENCHANTMENT_SLOT_2 = 10, // used with RandomSuffix and RandomProperty
+ PROP_ENCHANTMENT_SLOT_3 = 11, // used with RandomProperty
+ PROP_ENCHANTMENT_SLOT_4 = 12, // used with RandomProperty
+ MAX_ENCHANTMENT_SLOT = 13
+};
+
+#define MAX_VISIBLE_ITEM_OFFSET 2 // 2 fields per visible item (entry+enchantment)
+
+enum ItemVendorType
+{
+ ITEM_VENDOR_TYPE_NONE = 0,
+ ITEM_VENDOR_TYPE_ITEM = 1,
+ ITEM_VENDOR_TYPE_CURRENCY = 2,
+};
+
+enum ItemModifier : uint16
+{
+ ITEM_MODIFIER_TRANSMOG_APPEARANCE_ALL_SPECS = 0,
+ ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_1 = 1,
+ ITEM_MODIFIER_UPGRADE_ID = 2,
+ ITEM_MODIFIER_BATTLE_PET_SPECIES_ID = 3,
+ ITEM_MODIFIER_BATTLE_PET_BREED_DATA = 4, // (breedId) | (breedQuality << 24)
+ ITEM_MODIFIER_BATTLE_PET_LEVEL = 5,
+ ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID = 6,
+ ITEM_MODIFIER_ENCHANT_ILLUSION_ALL_SPECS = 7,
+ ITEM_MODIFIER_ARTIFACT_APPEARANCE_ID = 8,
+ ITEM_MODIFIER_SCALING_STAT_DISTRIBUTION_FIXED_LEVEL = 9,
+ ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_1 = 10,
+ ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_2 = 11,
+ ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_2 = 12,
+ ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_3 = 13,
+ ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_3 = 14,
+ ITEM_MODIFIER_TRANSMOG_APPEARANCE_SPEC_4 = 15,
+ ITEM_MODIFIER_ENCHANT_ILLUSION_SPEC_4 = 16,
+ ITEM_MODIFIER_CHALLENGE_MAP_CHALLENGE_MODE_ID = 17,
+ ITEM_MODIFIER_CHALLENGE_KEYSTONE_LEVEL = 18,
+ ITEM_MODIFIER_CHALLENGE_KEYSTONE_AFFIX_ID_1 = 19,
+ ITEM_MODIFIER_CHALLENGE_KEYSTONE_AFFIX_ID_2 = 20,
+ ITEM_MODIFIER_CHALLENGE_KEYSTONE_AFFIX_ID_3 = 21,
+ ITEM_MODIFIER_CHALLENGE_KEYSTONE_IS_CHARGED = 22,
+ ITEM_MODIFIER_ARTIFACT_KNOWLEDGE_LEVEL = 23,
+ ITEM_MODIFIER_ARTIFACT_TIER = 24,
+
+ MAX_ITEM_MODIFIERS
+};
+
+#endif // ItemDefines_h__
diff --git a/src/server/game/Entities/Item/ItemTemplate.h b/src/server/game/Entities/Item/ItemTemplate.h
index c40cb3791db..3babccc4163 100644
--- a/src/server/game/Entities/Item/ItemTemplate.h
+++ b/src/server/game/Entities/Item/ItemTemplate.h
@@ -293,13 +293,6 @@ enum CurrencyCategory
// ...
};
-enum ItemVendorType
-{
- ITEM_VENDOR_TYPE_NONE = 0,
- ITEM_VENDOR_TYPE_ITEM = 1,
- ITEM_VENDOR_TYPE_CURRENCY = 2,
-};
-
enum BAG_FAMILY_MASK
{
BAG_FAMILY_MASK_NONE = 0x00000000,
@@ -348,7 +341,7 @@ extern uint32 const SocketColorToGemTypeMask[19];
#define SOCKET_COLOR_STANDARD (SOCKET_COLOR_RED | SOCKET_COLOR_YELLOW | SOCKET_COLOR_BLUE)
-enum InventoryType
+enum InventoryType : uint8
{
INVTYPE_NON_EQUIP = 0,
INVTYPE_HEAD = 1,
@@ -814,7 +807,4 @@ struct TC_GAME_API ItemTemplate
static std::size_t CalculateItemSpecBit(ChrSpecializationEntry const* spec);
};
-// Benchmarked: Faster than std::map (insert/find)
-typedef std::unordered_map<uint32, ItemTemplate> ItemTemplateContainer;
-
#endif
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 61baafd3c97..a96015a848a 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -17,35 +17,37 @@
*/
#include "Object.h"
+#include "AreaTriggerTemplate.h"
+#include "BattlefieldMgr.h"
+#include "CellImpl.h"
+#include "CinematicMgr.h"
#include "Common.h"
-#include "SharedDefines.h"
-#include "WorldPacket.h"
-#include "Opcodes.h"
-#include "Log.h"
-#include "World.h"
#include "Creature.h"
-#include "Player.h"
-#include "Vehicle.h"
-#include "ObjectMgr.h"
-#include "UpdateData.h"
-#include "Util.h"
-#include "ObjectAccessor.h"
-#include "Transport.h"
-#include "VMapFactory.h"
-#include "CellImpl.h"
-#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
+#include "InstanceScenario.h"
+#include "Item.h"
+#include "Log.h"
+#include "MiscPackets.h"
+#include "MovementPackets.h"
+#include "MovementTypedefs.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
+#include "OutdoorPvPMgr.h"
+#include "Player.h"
+#include "SharedDefines.h"
#include "SpellAuraEffects.h"
-#include "UpdateFieldFlags.h"
#include "TemporarySummon.h"
#include "Totem.h"
-#include "MovementPackets.h"
-#include "OutdoorPvPMgr.h"
+#include "Transport.h"
#include "Unit.h"
-#include "BattlefieldMgr.h"
-#include "MiscPackets.h"
-#include "InstanceScenario.h"
-#include "AreaTriggerTemplate.h"
+#include "UpdateData.h"
+#include "UpdateFieldFlags.h"
+#include "Util.h"
+#include "VMapFactory.h"
+#include "Vehicle.h"
+#include "World.h"
+#include "WorldSession.h"
+#include <G3D/Vector3.h>
Object::Object()
{
@@ -258,7 +260,7 @@ void Object::SendUpdateToPlayer(Player* player)
else
BuildCreateUpdateBlockForPlayer(&upd, player);
upd.BuildPacket(&packet);
- player->GetSession()->SendPacket(&packet);
+ player->SendDirectMessage(&packet);
}
void Object::BuildValuesUpdateBlockForPlayer(UpdateData* data, Player* target) const
@@ -569,15 +571,10 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint32 flags) const
if (hasAreaTriggerSpline)
{
- std::vector<G3D::Vector3> const& splinePoints = areaTrigger->GetSpline().getPoints();
-
*data << uint32(areaTrigger->GetTimeToTarget());
*data << uint32(areaTrigger->GetElapsedTimeForMovement());
- data->WriteBits(splinePoints.size(), 16);
-
- for (G3D::Vector3 const& spline : splinePoints)
- *data << spline.x << spline.y << spline.z;
+ WorldPackets::Movement::CommonMovement::WriteCreateObjectAreaTriggerSpline(areaTrigger->GetSpline(), *data);
}
if (hasTargetRollPitchYaw)
@@ -624,11 +621,11 @@ void Object::BuildMovementUpdate(ByteBuffer* data, uint32 flags) const
*data << float(areaTriggerTemplate->PolygonDatas.Height);
*data << float(areaTriggerTemplate->PolygonDatas.HeightTarget);
- for (G3D::Vector2 const& vertice : areaTriggerTemplate->PolygonVertices)
- *data << vertice.x << vertice.y;
+ for (TaggedPosition<Position::XY> const& vertice : areaTriggerTemplate->PolygonVertices)
+ *data << vertice;
- for (G3D::Vector2 const& vertice : areaTriggerTemplate->PolygonVerticesTarget)
- *data << vertice.x << vertice.y;
+ for (TaggedPosition<Position::XY> const& vertice : areaTriggerTemplate->PolygonVerticesTarget)
+ *data << vertice;
}
if (hasAreaTriggerCylinder)
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 2209282223a..e1de1dd37ca 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -19,10 +19,11 @@
#include "Pet.h"
#include "Common.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "Group.h"
#include "Log.h"
+#include "Map.h"
#include "ObjectMgr.h"
-#include "Opcodes.h"
#include "PetPackets.h"
#include "Player.h"
#include "Spell.h"
@@ -34,7 +35,6 @@
#include "Unit.h"
#include "Util.h"
#include "World.h"
-#include "WorldPacket.h"
#include "WorldSession.h"
#define PET_XP_FACTOR 0.05f
diff --git a/src/server/game/Entities/Player/CinematicMgr.cpp b/src/server/game/Entities/Player/CinematicMgr.cpp
index e3f0db3af8f..8e426d74982 100644
--- a/src/server/game/Entities/Player/CinematicMgr.cpp
+++ b/src/server/game/Entities/Player/CinematicMgr.cpp
@@ -16,8 +16,9 @@
*/
#include "CinematicMgr.h"
-#include "Creature.h"
#include "M2Stores.h"
+#include "Map.h"
+#include "MotionMaster.h"
#include "Player.h"
#include "TemporarySummon.h"
diff --git a/src/server/game/Entities/Player/KillRewarder.cpp b/src/server/game/Entities/Player/KillRewarder.cpp
index f7a62a2ae5d..1e89d90cec6 100644
--- a/src/server/game/Entities/Player/KillRewarder.cpp
+++ b/src/server/game/Entities/Player/KillRewarder.cpp
@@ -16,8 +16,8 @@
*/
#include "KillRewarder.h"
-#include "SpellAuraEffects.h"
#include "Creature.h"
+#include "DB2Stores.h"
#include "Formulas.h"
#include "Group.h"
#include "Guild.h"
@@ -26,6 +26,7 @@
#include "Pet.h"
#include "Player.h"
#include "Scenario.h"
+#include "SpellAuraEffects.h"
// == KillRewarder ====================================================
// KillRewarder encapsulates logic of rewarding player upon kill with:
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 90b615a9477..85a2153f546 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -22,6 +22,7 @@
#include "AchievementMgr.h"
#include "ArenaTeam.h"
#include "ArenaTeamMgr.h"
+#include "Bag.h"
#include "Battlefield.h"
#include "BattlefieldMgr.h"
#include "BattlefieldTB.h"
@@ -39,6 +40,7 @@
#include "CharacterPackets.h"
#include "Chat.h"
#include "ChatPackets.h"
+#include "CinematicMgr.h"
#include "CombatLogPackets.h"
#include "CombatPackets.h"
#include "Common.h"
@@ -71,9 +73,11 @@
#include "Log.h"
#include "LootMgr.h"
#include "LootPackets.h"
+#include "Mail.h"
#include "MailPackets.h"
#include "MapManager.h"
#include "MiscPackets.h"
+#include "MotionMaster.h"
#include "MovementPackets.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
@@ -98,6 +102,7 @@
#include "SpellPackets.h"
#include "TalentPackets.h"
#include "ToyPackets.h"
+#include "TradeData.h"
#include "TransmogrificationPackets.h"
#include "Transport.h"
#include "UpdateData.h"
@@ -111,6 +116,7 @@
#include "WorldPacket.h"
#include "WorldSession.h"
#include "WorldStatePackets.h"
+#include <G3D/g3dmath.h>
#define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS)
@@ -10038,6 +10044,11 @@ InventoryResult Player::CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item
return EQUIP_ERR_OK;
}
+InventoryResult Player::CanTakeMoreSimilarItems(Item* pItem, uint32* offendingItemId /*= nullptr*/) const
+{
+ return CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem, nullptr, offendingItemId);
+}
+
InventoryResult Player::CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count /*= NULL*/) const
{
return CanStoreItem(bag, slot, dest, item, count, nullptr, false, no_space_count);
@@ -12138,7 +12149,7 @@ void Player::MoveItemFromInventory(uint8 bag, uint8 slot, bool update)
ItemRemovedQuestCheck(it->GetEntry(), it->GetCount());
RemoveItem(bag, slot, update);
it->SetNotRefundable(this, false, nullptr, false);
- it->RemoveFromUpdateQueueOf(this);
+ RemoveItemFromUpdateQueueOf(it, this);
GetSession()->GetCollectionMgr()->RemoveTemporaryAppearance(it);
if (it->IsInWorld())
{
@@ -19085,13 +19096,10 @@ void Player::_LoadGroup(PreparedQueryResult result)
SetGroup(group, subgroup);
SetPartyType(group->GetGroupCategory(), GROUP_TYPE_NORMAL);
ResetGroupUpdateSequenceIfNeeded(group);
- if (getLevel() >= LEVELREQUIREMENT_HEROIC)
- {
- // the group leader may change the instance difficulty while the player is offline
- SetDungeonDifficultyID(group->GetDungeonDifficultyID());
- SetRaidDifficultyID(group->GetRaidDifficultyID());
- SetLegacyRaidDifficultyID(group->GetLegacyRaidDifficultyID());
- }
+ // the group leader may change the instance difficulty while the player is offline
+ SetDungeonDifficultyID(group->GetDungeonDifficultyID());
+ SetRaidDifficultyID(group->GetRaidDifficultyID());
+ SetLegacyRaidDifficultyID(group->GetLegacyRaidDifficultyID());
}
}
@@ -21413,6 +21421,65 @@ bool Player::IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod
return spellInfo->IsAffectedBySpellMod(mod);
}
+template <class T>
+void Player::ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* spell /*= nullptr*/)
+{
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
+ if (!spellInfo)
+ return;
+
+ float totalmul = 1.0f;
+ int32 totalflat = 0;
+
+ // Drop charges for triggering spells instead of triggered ones
+ if (m_spellModTakingSpell)
+ spell = m_spellModTakingSpell;
+
+ for (SpellModList::iterator itr = m_spellMods[op][SPELLMOD_FLAT].begin(); itr != m_spellMods[op][SPELLMOD_FLAT].end(); ++itr)
+ {
+ SpellModifier* mod = *itr;
+
+ // Charges can be set only for mods with auras
+ if (!mod->ownerAura)
+ ASSERT(mod->charges == 0);
+
+ if (!IsAffectedBySpellmod(spellInfo, mod, spell))
+ continue;
+
+ totalflat += mod->value;
+ DropModCharge(mod, spell);
+ }
+
+ for (SpellModList::iterator itr = m_spellMods[op][SPELLMOD_PCT].begin(); itr != m_spellMods[op][SPELLMOD_PCT].end(); ++itr)
+ {
+ SpellModifier* mod = *itr;
+
+ // Charges can be set only for mods with auras
+ if (!mod->ownerAura)
+ ASSERT(mod->charges == 0);
+
+ if (!IsAffectedBySpellmod(spellInfo, mod, spell))
+ continue;
+
+ // skip percent mods for null basevalue (most important for spell mods with charges)
+ if (basevalue + totalflat == T(0))
+ continue;
+
+ // special case (skip > 10sec spell casts for instant cast setting)
+ if (mod->op == SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100)
+ continue;
+
+ totalmul *= 1.0f + CalculatePct(1.0f, mod->value);
+ DropModCharge(mod, spell);
+ }
+
+ basevalue = T(float(basevalue + totalflat) * totalmul);
+}
+
+template TC_GAME_API void Player::ApplySpellMod(uint32 spellId, SpellModOp op, int32& basevalue, Spell* spell);
+template TC_GAME_API void Player::ApplySpellMod(uint32 spellId, SpellModOp op, uint32& basevalue, Spell* spell);
+template TC_GAME_API void Player::ApplySpellMod(uint32 spellId, SpellModOp op, float& basevalue, Spell* spell);
+
void Player::AddSpellMod(SpellModifier* mod, bool apply)
{
TC_LOG_DEBUG("spells", "Player::AddSpellMod: Player '%s' (%s), SpellID: %d", GetName().c_str(), GetGUID().ToString().c_str(), mod->spellId);
@@ -24158,6 +24225,11 @@ float Player::GetReputationPriceDiscount(Creature const* creature) const
return 1.0f - 0.05f* (rank - REP_NEUTRAL);
}
+Player* Player::GetTrader() const
+{
+ return m_trade ? m_trade->GetTrader() : nullptr;
+}
+
bool Player::IsSpellFitByClassAndRace(uint32 spell_id) const
{
uint32 racemask = getRaceMask();
@@ -25241,6 +25313,11 @@ bool Player::HasTitle(uint32 bitIndex) const
return HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
}
+bool Player::HasTitle(CharTitlesEntry const* title) const
+{
+ return HasTitle(title->MaskID);
+}
+
void Player::SetTitle(CharTitlesEntry const* title, bool lost)
{
uint32 fieldIndexOffset = title->MaskID / 32;
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 7d9a8d915f5..3aafac29b28 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -19,47 +19,80 @@
#ifndef _PLAYER_H
#define _PLAYER_H
-#include "DB2Stores.h"
-#include "GroupReference.h"
-#include "MapReference.h"
+#include "Unit.h"
#include "CUFProfile.h"
+#include "DatabaseEnvFwd.h"
+#include "DBCEnums.h"
#include "EquipementSet.h"
-#include "Item.h"
+#include "GroupReference.h"
+#include "ItemDefines.h"
+#include "ItemEnchantmentMgr.h"
+#include "MapReference.h"
#include "PetDefines.h"
-#include "QuestDef.h"
-#include "SpellMgr.h"
-#include "SpellHistory.h"
-#include "Unit.h"
-#include "WorldSession.h"
#include "PlayerTaxi.h"
-#include "TradeData.h"
-#include "CinematicMgr.h"
+#include "QuestDef.h"
#include "SceneMgr.h"
#include <queue>
struct AccessRequirement;
+struct AchievementEntry;
+struct AreaTableEntry;
+struct AreaTriggerEntry;
+struct ArtifactPowerRankEntry;
+struct BarberShopStyleEntry;
+struct CharTitlesEntry;
+struct ChatChannelsEntry;
+struct ChrSpecializationEntry;
struct CreatureTemplate;
-struct Mail;
+struct CurrencyTypesEntry;
+struct FactionEntry;
struct ItemExtendedCostEntry;
+struct ItemSetEffect;
+struct ItemTemplate;
+struct Loot;
+struct Mail;
+struct MapEntry;
+struct QuestPackageItemEntry;
+struct SkillRaceClassInfoEntry;
+struct TalentEntry;
struct TrainerSpell;
struct VendorItem;
-class PlayerAchievementMgr;
-class ReputationMgr;
+class AELootResult;
+class Bag;
+class Battleground;
class Channel;
+class CinematicMgr;
class Creature;
class DynamicObject;
class Garrison;
class Group;
class Guild;
+class Item;
+class LootStore;
class OutdoorPvP;
class Pet;
+class PlayerAI;
+class PlayerAchievementMgr;
class PlayerMenu;
class PlayerSocial;
+class ReputationMgr;
class SpellCastTargets;
-class PlayerAI;
+class TradeData;
enum GroupCategory : uint8;
+enum InventoryType : uint8;
+enum ItemClass : uint8;
+enum LootError : uint8;
+enum LootType : uint8;
+
+namespace WorldPackets
+{
+ namespace Character
+ {
+ struct CharacterCreateInfo;
+ }
+}
typedef std::deque<Mail*> PlayerMails;
@@ -1021,8 +1054,8 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
{
friend class WorldSession;
friend class CinematicMgr;
- friend void Item::AddToUpdateQueueOf(Player* player);
- friend void Item::RemoveFromUpdateQueueOf(Player* player);
+ friend void AddItemToUpdateQueueOf(Item* item, Player* player);
+ friend void RemoveItemFromUpdateQueueOf(Item* item, Player* player);
public:
explicit Player(WorldSession* session);
~Player();
@@ -1183,7 +1216,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
bool CanNoReagentCast(SpellInfo const* spellInfo) const;
bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const;
bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const;
- InventoryResult CanTakeMoreSimilarItems(Item* pItem, uint32* offendingItemId = nullptr) const { return CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem, nullptr, offendingItemId); }
+ InventoryResult CanTakeMoreSimilarItems(Item* pItem, uint32* offendingItemId = nullptr) const;
InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, uint32* offendingItemId = nullptr) const { return CanTakeMoreSimilarItems(entry, count, nullptr, nullptr, offendingItemId); }
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = nullptr) const;
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap = false) const;
@@ -1288,7 +1321,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
float GetReputationPriceDiscount(Creature const* creature) const;
- Player* GetTrader() const { return m_trade ? m_trade->GetTrader() : nullptr; }
+ Player* GetTrader() const;
TradeData* GetTradeData() const { return m_trade; }
void TradeCancel(bool sendback);
@@ -2274,7 +2307,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
bool ModifierTreeSatisfied(uint32 modifierTreeId) const;
bool HasTitle(uint32 bitIndex) const;
- bool HasTitle(CharTitlesEntry const* title) const { return HasTitle(title->MaskID); }
+ bool HasTitle(CharTitlesEntry const* title) const;
void SetTitle(CharTitlesEntry const* title, bool lost = false);
//bool isActiveObject() const { return true; }
@@ -2687,60 +2720,4 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
TC_GAME_API void AddItemsSetItem(Player* player, Item* item);
TC_GAME_API void RemoveItemsSetItem(Player* player, ItemTemplate const* proto);
-// "the bodies of template functions must be made available in a header file"
-template <class T>
-void Player::ApplySpellMod(uint32 spellId, SpellModOp op, T& basevalue, Spell* spell /*= nullptr*/)
-{
- SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
- if (!spellInfo)
- return;
-
- float totalmul = 1.0f;
- int32 totalflat = 0;
-
- // Drop charges for triggering spells instead of triggered ones
- if (m_spellModTakingSpell)
- spell = m_spellModTakingSpell;
-
- for (SpellModList::iterator itr = m_spellMods[op][SPELLMOD_FLAT].begin(); itr != m_spellMods[op][SPELLMOD_FLAT].end(); ++itr)
- {
- SpellModifier* mod = *itr;
-
- // Charges can be set only for mods with auras
- if (!mod->ownerAura)
- ASSERT(mod->charges == 0);
-
- if (!IsAffectedBySpellmod(spellInfo, mod, spell))
- continue;
-
- totalflat += mod->value;
- DropModCharge(mod, spell);
- }
-
- for (SpellModList::iterator itr = m_spellMods[op][SPELLMOD_PCT].begin(); itr != m_spellMods[op][SPELLMOD_PCT].end(); ++itr)
- {
- SpellModifier* mod = *itr;
-
- // Charges can be set only for mods with auras
- if (!mod->ownerAura)
- ASSERT(mod->charges == 0);
-
- if (!IsAffectedBySpellmod(spellInfo, mod, spell))
- continue;
-
- // skip percent mods for null basevalue (most important for spell mods with charges)
- if (basevalue + totalflat == T(0))
- continue;
-
- // special case (skip > 10sec spell casts for instant cast setting)
- if (mod->op == SPELLMOD_CASTING_TIME && basevalue >= T(10000) && mod->value <= -100)
- continue;
-
- totalmul *= 1.0f + CalculatePct(1.0f, mod->value);
- DropModCharge(mod, spell);
- }
-
- basevalue = T(float(basevalue + totalflat) * totalmul);
-}
-
#endif
diff --git a/src/server/game/Entities/Player/PlayerTaxi.cpp b/src/server/game/Entities/Player/PlayerTaxi.cpp
index f3ebb891062..816920049e3 100644
--- a/src/server/game/Entities/Player/PlayerTaxi.cpp
+++ b/src/server/game/Entities/Player/PlayerTaxi.cpp
@@ -15,11 +15,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "PlayerTaxi.h"
+#include "DB2Stores.h"
+#include "ObjectMgr.h"
#include "Player.h"
#include "TaxiPackets.h"
-#include "ObjectMgr.h"
#include <limits>
-#include <math.h>
#include <sstream>
void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level)
diff --git a/src/server/game/Entities/Player/PlayerTaxi.h b/src/server/game/Entities/Player/PlayerTaxi.h
index 13aeed19ef8..82abf771bf8 100644
--- a/src/server/game/Entities/Player/PlayerTaxi.h
+++ b/src/server/game/Entities/Player/PlayerTaxi.h
@@ -1,10 +1,19 @@
#ifndef __PLAYERTAXI_H__
#define __PLAYERTAXI_H__
-#include "DB2Stores.h"
+#include "DBCEnums.h"
#include "Define.h"
-#include "WorldSession.h"
-#include <map>
+#include <deque>
+#include <iosfwd>
+#include <vector>
+
+namespace WorldPackets
+{
+ namespace Taxi
+ {
+ class ShowTaxiNodes;
+ }
+}
class TC_GAME_API PlayerTaxi
{
diff --git a/src/server/game/Entities/Player/SceneMgr.cpp b/src/server/game/Entities/Player/SceneMgr.cpp
index 8ecdcf0348e..130261a2aea 100644
--- a/src/server/game/Entities/Player/SceneMgr.cpp
+++ b/src/server/game/Entities/Player/SceneMgr.cpp
@@ -17,6 +17,7 @@
#include "SceneMgr.h"
#include "Chat.h"
+#include "DB2Stores.h"
#include "Language.h"
#include "ObjectMgr.h"
#include "Player.h"
@@ -62,7 +63,7 @@ uint32 SceneMgr::PlaySceneByTemplate(SceneTemplate const* sceneTemplate, Positio
playScene.Location = *position;
playScene.TransportGUID = GetPlayer()->GetTransGUID();
- GetPlayer()->GetSession()->SendPacket(playScene.Write(), true);
+ GetPlayer()->SendDirectMessage(playScene.Write());
AddInstanceIdToSceneMap(sceneInstanceID, sceneTemplate);
@@ -89,7 +90,7 @@ void SceneMgr::CancelScene(uint32 sceneInstanceID, bool removeFromMap /*= true*/
WorldPackets::Scenes::CancelScene cancelScene;
cancelScene.SceneInstanceID = sceneInstanceID;
- GetPlayer()->GetSession()->SendPacket(cancelScene.Write(), true);
+ GetPlayer()->SendDirectMessage(cancelScene.Write());
}
void SceneMgr::OnSceneTrigger(uint32 sceneInstanceID, std::string const& triggerName)
diff --git a/src/server/game/Entities/Player/TradeData.cpp b/src/server/game/Entities/Player/TradeData.cpp
index fe5b8231109..8c478ad3837 100644
--- a/src/server/game/Entities/Player/TradeData.cpp
+++ b/src/server/game/Entities/Player/TradeData.cpp
@@ -16,9 +16,11 @@
*/
#include "TradeData.h"
+#include "Item.h"
#include "Player.h"
#include "Random.h"
#include "TradePackets.h"
+#include "WorldSession.h"
TradeData* TradeData::GetTraderData() const
{
diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp
index 4ebb6ce30bc..5e89828ac74 100644
--- a/src/server/game/Entities/Totem/Totem.cpp
+++ b/src/server/game/Entities/Totem/Totem.cpp
@@ -18,7 +18,7 @@
#include "Totem.h"
#include "Group.h"
-#include "ObjectMgr.h"
+#include "Map.h"
#include "Player.h"
#include "SpellHistory.h"
#include "SpellMgr.h"
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 72f58e0f17a..88160cf4f62 100644
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -17,6 +17,8 @@
*/
#include "Unit.h"
+#include "DB2Stores.h"
+#include "Item.h"
#include "Player.h"
#include "Pet.h"
#include "Creature.h"
@@ -25,6 +27,7 @@
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "World.h"
+#include <G3D/g3dmath.h>
#include <numeric>
inline bool _ModifyUInt32(bool apply, uint32& baseValue, int32& amount)
@@ -553,7 +556,7 @@ void Player::UpdateMastery()
if (G3D::fuzzyEq(mult, 0.0f))
continue;
- aura->GetEffect(effect->EffectIndex)->ChangeAmount(int32(value * effect->BonusCoefficient));
+ aura->GetEffect(effect->EffectIndex)->ChangeAmount(int32(value * mult));
}
}
}
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 1bf845f750d..a78644eb8fb 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -38,12 +38,15 @@
#include "Group.h"
#include "InstanceSaveMgr.h"
#include "InstanceScript.h"
+#include "Item.h"
#include "Log.h"
#include "LootMgr.h"
#include "LootPackets.h"
#include "MiscPackets.h"
+#include "MotionMaster.h"
#include "MovementPackets.h"
#include "MoveSpline.h"
+#include "MoveSplineInit.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
@@ -10845,6 +10848,11 @@ void Unit::SendPetAIReaction(ObjectGuid guid)
owner->ToPlayer()->SendDirectMessage(packet.Write());
}
+void Unit::propagateSpeedChange()
+{
+ GetMotionMaster()->propagateSpeedChange();
+}
+
///----------End of Pet responses methods----------
void Unit::StopMoving()
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 177defa83e0..b782ccfd288 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -19,19 +19,19 @@
#ifndef __UNIT_H
#define __UNIT_H
-#include "UnitDefines.h"
+#include "Object.h"
#include "EventProcessor.h"
#include "FollowerReference.h"
#include "FollowerRefManager.h"
#include "HostileRefManager.h"
-#include "MotionMaster.h"
-#include "Object.h"
#include "SpellAuraDefines.h"
#include "ThreatManager.h"
-#include "MoveSplineInit.h"
#include "Timer.h"
+#include "UnitDefines.h"
#include "Util.h"
#include <boost/container/flat_set.hpp>
+#include <algorithm>
+#include <map>
#define WORLD_TRIGGER 12999
#define ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE 197886
@@ -275,32 +275,34 @@ struct LiquidTypeEntry;
struct MountCapabilityEntry;
struct SpellValue;
-class AuraApplication;
class Aura;
-class UnitAura;
+class AuraApplication;
class AuraEffect;
class Creature;
-class Spell;
-class SpellInfo;
-class SpellEffectInfo;
-class SpellHistory;
class DynamicObject;
class GameObject;
+class Guardian;
class Item;
+class Minion;
+class MotionMaster;
class Pet;
class PetAura;
-class Minion;
-class Guardian;
-class UnitAI;
+class Spell;
+class SpellCastTargets;
+class SpellEffectInfo;
+class SpellHistory;
+class SpellInfo;
class Totem;
class Transport;
+class TransportBase;
+class UnitAI;
+class UnitAura;
class Vehicle;
class VehicleJoinEvent;
-class TransportBase;
-class SpellCastTargets;
namespace Movement
{
class MoveSpline;
+ struct SpellEffectExtraData;
}
namespace WorldPackets
{
@@ -819,33 +821,6 @@ enum CurrentSpellTypes : uint8
#define CURRENT_FIRST_NON_MELEE_SPELL 1
#define CURRENT_MAX_SPELL 4
-enum ActiveStates
-{
- ACT_PASSIVE = 0x01, // 0x01 - passive
- ACT_DISABLED = 0x81, // 0x80 - castable
- ACT_ENABLED = 0xC1, // 0x40 | 0x80 - auto cast + castable
- ACT_COMMAND = 0x07, // 0x01 | 0x02 | 0x04
- ACT_REACTION = 0x06, // 0x02 | 0x04
- ACT_DECIDE = 0x00 // custom
-};
-
-enum ReactStates
-{
- REACT_PASSIVE = 0,
- REACT_DEFENSIVE = 1,
- REACT_AGGRESSIVE = 2,
- REACT_ASSIST = 3
-};
-
-enum CommandStates : uint8
-{
- COMMAND_STAY = 0,
- COMMAND_FOLLOW = 1,
- COMMAND_ATTACK = 2,
- COMMAND_ABANDON = 3,
- COMMAND_MOVE_TO = 4
-};
-
#define UNIT_ACTION_BUTTON_ACTION(X) (uint32(X) & 0x00FFFFFF)
#define UNIT_ACTION_BUTTON_TYPE(X) ((uint32(X) & 0xFF000000) >> 24)
#define MAKE_UNIT_ACTION_BUTTON(A, T) (uint32(A) | (uint32(T) << 24))
@@ -999,8 +974,6 @@ enum PlayerTotemType
SUMMON_TYPE_TOTEM_AIR = 83
};
-#define MAX_EQUIPMENT_ITEMS 3
-
// delay time next attack to prevent client attack animation problems
#define ATTACK_DISPLAY_DELAY 200
#define MAX_PLAYER_STEALTH_DETECT_RANGE 30.0f // max distance for detection targets by player
@@ -1874,7 +1847,7 @@ class TC_GAME_API Unit : public WorldObject
void SendPetAIReaction(ObjectGuid guid);
///----------End of Pet responses methods----------
- void propagateSpeedChange() { GetMotionMaster()->propagateSpeedChange(); }
+ void propagateSpeedChange();
// reactive attacks
void ClearAllReactives();
diff --git a/src/server/game/Entities/Unit/UnitDefines.h b/src/server/game/Entities/Unit/UnitDefines.h
index 35490f33bb0..3552ca4dea4 100644
--- a/src/server/game/Entities/Unit/UnitDefines.h
+++ b/src/server/game/Entities/Unit/UnitDefines.h
@@ -29,6 +29,8 @@
#define BASE_MAXDAMAGE 2.0f
#define BASE_ATTACK_TIME 2000
+#define MAX_EQUIPMENT_ITEMS 3
+
// byte value (UNIT_FIELD_BYTES_1, 0)
enum UnitStandStateType : uint8
{
@@ -357,4 +359,31 @@ struct DeclinedName
std::string name[MAX_DECLINED_NAME_CASES];
};
+enum ActiveStates
+{
+ ACT_PASSIVE = 0x01, // 0x01 - passive
+ ACT_DISABLED = 0x81, // 0x80 - castable
+ ACT_ENABLED = 0xC1, // 0x40 | 0x80 - auto cast + castable
+ ACT_COMMAND = 0x07, // 0x01 | 0x02 | 0x04
+ ACT_REACTION = 0x06, // 0x02 | 0x04
+ ACT_DECIDE = 0x00 // custom
+};
+
+enum ReactStates
+{
+ REACT_PASSIVE = 0,
+ REACT_DEFENSIVE = 1,
+ REACT_AGGRESSIVE = 2,
+ REACT_ASSIST = 3
+};
+
+enum CommandStates : uint8
+{
+ COMMAND_STAY = 0,
+ COMMAND_FOLLOW = 1,
+ COMMAND_ATTACK = 2,
+ COMMAND_ABANDON = 3,
+ COMMAND_MOVE_TO = 4
+};
+
#endif // UnitDefines_h__
diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp
index db46a0dce2d..6ae0bc5caf2 100644
--- a/src/server/game/Entities/Vehicle/Vehicle.cpp
+++ b/src/server/game/Entities/Vehicle/Vehicle.cpp
@@ -16,19 +16,21 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "Vehicle.h"
+#include "Battleground.h"
#include "Common.h"
+#include "CreatureAI.h"
+#include "DB2Stores.h"
+#include "EventProcessor.h"
#include "Log.h"
+#include "MoveSplineInit.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
-#include "Vehicle.h"
-#include "Unit.h"
-#include "Util.h"
+#include "Player.h"
#include "ScriptMgr.h"
-#include "CreatureAI.h"
-#include "MoveSplineInit.h"
#include "TemporarySummon.h"
-#include "EventProcessor.h"
-#include "Player.h"
-#include "Battleground.h"
+#include "Unit.h"
+#include "Util.h"
Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) :
UsableSeatNum(0), _me(unit), _vehicleInfo(vehInfo), _creatureEntry(creatureEntry), _status(STATUS_NONE), _lastShootPos()
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index 7091166b7b8..95300e622bd 100644
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ -17,18 +17,21 @@
*/
#include "GameEventMgr.h"
-#include "World.h"
-#include "ObjectMgr.h"
-#include "PoolMgr.h"
+#include "BattlegroundMgr.h"
+#include "Creature.h"
+#include "CreatureAI.h"
+#include "DatabaseEnv.h"
+#include "DB2Stores.h"
+#include "GameObject.h"
+#include "GameObjectAI.h"
#include "Language.h"
#include "Log.h"
#include "MapManager.h"
+#include "ObjectMgr.h"
#include "Player.h"
-#include "BattlegroundMgr.h"
-#include "CreatureAI.h"
-#include "GameObjectAI.h"
+#include "PoolMgr.h"
+#include "World.h"
#include "WorldStatePackets.h"
-#include "DatabaseEnv.h"
GameEventMgr* GameEventMgr::instance()
{
diff --git a/src/server/game/Globals/AreaTriggerDataStore.cpp b/src/server/game/Globals/AreaTriggerDataStore.cpp
index 9cffbf35558..4a45f9c66f9 100644
--- a/src/server/game/Globals/AreaTriggerDataStore.cpp
+++ b/src/server/game/Globals/AreaTriggerDataStore.cpp
@@ -18,6 +18,7 @@
#include "AreaTriggerDataStore.h"
#include "AreaTriggerTemplate.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "Timer.h"
@@ -31,9 +32,9 @@ namespace
void AreaTriggerDataStore::LoadAreaTriggerTemplates()
{
uint32 oldMSTime = getMSTime();
- std::unordered_map<uint32, std::vector<G3D::Vector2>> verticesByAreaTrigger;
- std::unordered_map<uint32, std::vector<G3D::Vector2>> verticesTargetByAreaTrigger;
- std::unordered_map<uint32, std::vector<G3D::Vector3>> splinesBySpellMisc;
+ std::unordered_map<uint32, std::vector<TaggedPosition<Position::XY>>> verticesByAreaTrigger;
+ std::unordered_map<uint32, std::vector<TaggedPosition<Position::XY>>> verticesTargetByAreaTrigger;
+ std::unordered_map<uint32, std::vector<Position>> splinesBySpellMisc;
std::unordered_map<uint32, std::vector<AreaTriggerAction>> actionsByAreaTrigger;
// 0 1 2 3
@@ -102,13 +103,7 @@ void AreaTriggerDataStore::LoadAreaTriggerTemplates()
{
Field* splineFields = splines->Fetch();
uint32 spellMiscId = splineFields[0].GetUInt32();
-
- G3D::Vector3 spline;
- spline.x = splineFields[1].GetFloat();
- spline.y = splineFields[2].GetFloat();
- spline.z = splineFields[3].GetFloat();
-
- splinesBySpellMisc[spellMiscId].push_back(spline);
+ splinesBySpellMisc[spellMiscId].emplace_back(splineFields[1].GetFloat(), splineFields[2].GetFloat(), splineFields[3].GetFloat());
}
while (splines->NextRow());
}
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index e01f73abde6..81624ba04f4 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -22,6 +22,7 @@
#include "DatabaseEnv.h"
#include "DB2Stores.h"
#include "DisableMgr.h"
+#include "GameObject.h"
#include "GameTables.h"
#include "GridDefines.h"
#include "GossipDef.h"
@@ -33,7 +34,7 @@
#include "LootMgr.h"
#include "Mail.h"
#include "MapManager.h"
-#include "Object.h"
+#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "ObjectDefines.h"
#include "Player.h"
@@ -50,6 +51,7 @@
#include "Vehicle.h"
#include "VMapFactory.h"
#include "World.h"
+#include <G3D/g3dmath.h>
ScriptMapMap sSpellScripts;
ScriptMapMap sEventScripts;
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index cec03e26bf3..18bfaec87cb 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -19,42 +19,33 @@
#ifndef _OBJECTMGR_H
#define _OBJECTMGR_H
-#include "Object.h"
-#include "Bag.h"
-#include "Creature.h"
-#include "DynamicObject.h"
-#include "Conversation.h"
-#include "GameObject.h"
-#include "TemporarySummon.h"
-#include "Corpse.h"
-#include "QuestDef.h"
+#include "Common.h"
+#include "ConditionMgr.h"
+#include "CreatureData.h"
+#include "DatabaseEnvFwd.h"
+#include "GameObjectData.h"
#include "ItemTemplate.h"
#include "NPCHandler.h"
-#include "DatabaseEnvFwd.h"
-#include "Mail.h"
-#include "Map.h"
-#include "ObjectAccessor.h"
#include "ObjectDefines.h"
-#include "ConditionMgr.h"
-#include "ItemTemplate.h"
+#include "ObjectGuid.h"
+#include "Position.h"
+#include "QuestDef.h"
+#include "SharedDefines.h"
#include "VehicleDefines.h"
-#include "ConditionMgr.h"
-#include "DB2Stores.h"
-#include <string>
-#include <tuple>
#include <map>
-#include <limits>
-#include <functional>
-#include <memory>
+#include <unordered_map>
class Item;
+class Unit;
class Vehicle;
struct AccessRequirement;
struct DeclinedName;
+struct DungeonEncounterEntry;
+struct FactionEntry;
struct PlayerInfo;
struct PlayerLevelInfo;
-
-#pragma pack(push, 1)
+struct SkillRaceClassInfoEntry;
+struct WorldSafeLocsEntry;
struct PageText
{
@@ -64,6 +55,15 @@ struct PageText
uint8 Flags;
};
+enum SummonerType
+{
+ SUMMONER_TYPE_CREATURE = 0,
+ SUMMONER_TYPE_GAMEOBJECT = 1,
+ SUMMONER_TYPE_MAP = 2
+};
+
+#pragma pack(push, 1)
+
/// Key for storing temp summon data in TempSummonDataContainer
struct TempSummonGroupKey
{
@@ -84,6 +84,15 @@ private:
uint8 _summonGroup; ///< Summon's group id
};
+/// Stores data for temp summons
+struct TempSummonData
+{
+ uint32 entry; ///< Entry of summoned creature
+ Position pos; ///< Position, where should be creature spawned
+ TempSummonType type; ///< Summon type, see TempSummonType for available types
+ uint32 time; ///< Despawn time, usable only with certain temp summon types
+};
+
#pragma pack(pop)
// DB scripting commands
@@ -137,7 +146,13 @@ enum ChatType
typedef std::map<uint32, PageText> PageTextContainer;
-// Benchmarked: Faster than std::map (insert/find)
+struct InstanceTemplate
+{
+ uint32 Parent;
+ uint32 ScriptId;
+ bool AllowMount;
+};
+
typedef std::unordered_map<uint16, InstanceTemplate> InstanceTemplateContainer;
struct GameTele
@@ -461,11 +476,24 @@ struct TrinityString
};
typedef std::map<ObjectGuid, ObjectGuid> LinkedRespawnContainer;
+typedef std::unordered_map<uint32, CreatureTemplate> CreatureTemplateContainer;
+typedef std::unordered_map<uint32, CreatureAddon> CreatureTemplateAddonContainer;
typedef std::unordered_map<ObjectGuid::LowType, CreatureData> CreatureDataContainer;
+typedef std::unordered_map<ObjectGuid::LowType, CreatureAddon> CreatureAddonContainer;
+typedef std::unordered_map<uint16, CreatureBaseStats> CreatureBaseStatsContainer;
+typedef std::unordered_map<uint8, EquipmentInfo> EquipmentInfoContainerInternal;
+typedef std::unordered_map<uint32, EquipmentInfoContainerInternal> EquipmentInfoContainer;
+typedef std::unordered_map<uint32, CreatureModelInfo> CreatureModelContainer;
+typedef std::unordered_map<uint32, std::vector<uint32>> CreatureQuestItemMap;
+typedef std::unordered_map<uint32, GameObjectTemplate> GameObjectTemplateContainer;
+typedef std::unordered_map<uint32, GameObjectTemplateAddon> GameObjectTemplateAddonContainer;
typedef std::unordered_map<ObjectGuid::LowType, GameObjectData> GameObjectDataContainer;
-typedef std::map<TempSummonGroupKey, std::vector<TempSummonData> > TempSummonDataContainer;
+typedef std::unordered_map<ObjectGuid::LowType, GameObjectAddon> GameObjectAddonContainer;
+typedef std::unordered_map<uint32, std::vector<uint32>> GameObjectQuestItemMap;
+typedef std::map<TempSummonGroupKey, std::vector<TempSummonData>> TempSummonDataContainer;
typedef std::unordered_map<uint32, CreatureLocale> CreatureLocaleContainer;
typedef std::unordered_map<uint32, GameObjectLocale> GameObjectLocaleContainer;
+typedef std::unordered_map<uint32, ItemTemplate> ItemTemplateContainer;
typedef std::unordered_map<uint32, QuestTemplateLocale> QuestTemplateLocaleContainer;
typedef std::unordered_map<uint32, QuestObjectivesLocale> QuestObjectivesLocaleContainer;
typedef std::unordered_map<uint32, QuestOfferRewardLocale> QuestOfferRewardLocaleContainer;
@@ -552,7 +580,11 @@ struct PlayerInfo
struct PetLevelInfo
{
- PetLevelInfo() : health(0), mana(0), armor(0) { memset(stats, 0, sizeof(stats)); }
+ PetLevelInfo() : health(0), mana(0), armor(0)
+ {
+ for (uint16& stat : stats)
+ stat = 0;
+ }
uint16 stats[MAX_STATS];
uint16 health;
@@ -865,7 +897,7 @@ class TC_GAME_API ObjectMgr
static ObjectGuid GetPlayerGUIDByName(std::string const& name);
- GameObjectQuestItemList const* GetGameObjectQuestItemList(uint32 id) const
+ std::vector<uint32> const* GetGameObjectQuestItemList(uint32 id) const
{
GameObjectQuestItemMap::const_iterator itr = _gameObjectQuestItemStore.find(id);
if (itr != _gameObjectQuestItemStore.end())
@@ -874,7 +906,7 @@ class TC_GAME_API ObjectMgr
}
GameObjectQuestItemMap const* GetGameObjectQuestItemMap() const { return &_gameObjectQuestItemStore; }
- CreatureQuestItemList const* GetCreatureQuestItemList(uint32 id) const
+ std::vector<uint32> const* GetCreatureQuestItemList(uint32 id) const
{
CreatureQuestItemMap::const_iterator itr = _creatureQuestItemStore.find(id);
if (itr != _creatureQuestItemStore.end())
diff --git a/src/server/game/Grids/GridStates.cpp b/src/server/game/Grids/GridStates.cpp
index 2d00c9db184..61a8553e640 100644
--- a/src/server/game/Grids/GridStates.cpp
+++ b/src/server/game/Grids/GridStates.cpp
@@ -19,9 +19,12 @@
#include "GridStates.h"
#include "GridNotifiers.h"
#include "Log.h"
+#include "Map.h"
+#include "ObjectGridLoader.h"
void InvalidState::Update(Map&, NGridType&, GridInfo&, uint32) const
-{ }
+{
+}
void ActiveState::Update(Map& map, NGridType& grid, GridInfo& info, uint32 diff) const
{
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index 0459b6322dc..ffb0f818eb6 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -19,9 +19,6 @@
#ifndef TRINITY_GRIDNOTIFIERS_H
#define TRINITY_GRIDNOTIFIERS_H
-#include "ObjectGridLoader.h"
-#include "UpdateData.h"
-
#include "AreaTrigger.h"
#include "Creature.h"
#include "Corpse.h"
@@ -32,6 +29,7 @@
#include "Player.h"
#include "Spell.h"
#include "UnitAI.h"
+#include "UpdateData.h"
namespace Trinity
{
@@ -888,9 +886,6 @@ namespace Trinity
bool operator()(Unit* u) const
{
- if (G3D::fuzzyEq(_range, 0))
- return false;
-
if (_raid)
{
if (!_refUnit->IsInRaidWith(u))
@@ -962,7 +957,7 @@ namespace Trinity
: i_obj(obj), i_funit(funit), _spellInfo(NULL), i_range(range)
{
if (DynamicObject const* dynObj = i_obj->ToDynObject())
- _spellInfo = sSpellMgr->GetSpellInfo(dynObj->GetSpellId());
+ _spellInfo = dynObj->GetSpellInfo();
}
bool operator()(Unit* u) const
diff --git a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
index 68a1c17bdb3..fb2a00c2b5c 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
@@ -20,13 +20,13 @@
#define TRINITY_GRIDNOTIFIERSIMPL_H
#include "GridNotifiers.h"
-#include "WorldPacket.h"
#include "Corpse.h"
-#include "Player.h"
-#include "UpdateData.h"
#include "CreatureAI.h"
+#include "Player.h"
#include "SpellAuras.h"
-#include "Opcodes.h"
+#include "UpdateData.h"
+#include "WorldPacket.h"
+#include "WorldSession.h"
template<class T>
inline void Trinity::VisibleNotifier::Visit(GridRefManager<T> &m)
diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp
index 51e72590afa..971d6586c2f 100644
--- a/src/server/game/Groups/Group.cpp
+++ b/src/server/game/Groups/Group.cpp
@@ -21,7 +21,9 @@
#include "BattlegroundMgr.h"
#include "Common.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "Formulas.h"
+#include "GameObject.h"
#include "GroupMgr.h"
#include "InstanceSaveMgr.h"
#include "LFGMgr.h"
@@ -31,7 +33,6 @@
#include "MapManager.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
-#include "Opcodes.h"
#include "PartyPackets.h"
#include "Pet.h"
#include "Player.h"
@@ -41,7 +42,6 @@
#include "UpdateFieldFlags.h"
#include "Util.h"
#include "World.h"
-#include "WorldPacket.h"
#include "WorldSession.h"
Roll::Roll(LootItem const& li) : itemid(li.itemid),
@@ -458,23 +458,20 @@ bool Group::AddMember(Player* player)
player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, true, false);
player->ResetInstances(INSTANCE_RESET_GROUP_JOIN, true, true);
- if (player->getLevel() >= LEVELREQUIREMENT_HEROIC)
+ if (player->GetDungeonDifficultyID() != GetDungeonDifficultyID())
{
- if (player->GetDungeonDifficultyID() != GetDungeonDifficultyID())
- {
- player->SetDungeonDifficultyID(GetDungeonDifficultyID());
- player->SendDungeonDifficulty();
- }
- if (player->GetRaidDifficultyID() != GetRaidDifficultyID())
- {
- player->SetRaidDifficultyID(GetRaidDifficultyID());
- player->SendRaidDifficulty(false);
- }
- if (player->GetLegacyRaidDifficultyID() != GetLegacyRaidDifficultyID())
- {
- player->SetLegacyRaidDifficultyID(GetLegacyRaidDifficultyID());
- player->SendRaidDifficulty(true);
- }
+ player->SetDungeonDifficultyID(GetDungeonDifficultyID());
+ player->SendDungeonDifficulty();
+ }
+ if (player->GetRaidDifficultyID() != GetRaidDifficultyID())
+ {
+ player->SetRaidDifficultyID(GetRaidDifficultyID());
+ player->SendRaidDifficulty(false);
+ }
+ if (player->GetLegacyRaidDifficultyID() != GetLegacyRaidDifficultyID())
+ {
+ player->SetLegacyRaidDifficultyID(GetLegacyRaidDifficultyID());
+ player->SendRaidDifficulty(true);
}
}
diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h
index 69d64e7754e..333b2fe0983 100644
--- a/src/server/game/Groups/Group.h
+++ b/src/server/game/Groups/Group.h
@@ -20,11 +20,11 @@
#define TRINITYCORE_GROUP_H
#include "DBCEnums.h"
+#include "DatabaseEnvFwd.h"
#include "GroupRefManager.h"
#include "Loot.h"
-#include "QueryResult.h"
-#include "SharedDefines.h"
#include "Object.h"
+#include "SharedDefines.h"
#include <map>
class Battlefield;
diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp
index af696e8c3b9..23a7f1d884c 100644
--- a/src/server/game/Guilds/Guild.cpp
+++ b/src/server/game/Guilds/Guild.cpp
@@ -25,13 +25,15 @@
#include "ChatPackets.h"
#include "Config.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "GuildFinderMgr.h"
#include "GuildMgr.h"
#include "GuildPackets.h"
#include "Language.h"
#include "Log.h"
+#include "Map.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
-#include "Opcodes.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "SocialMgr.h"
diff --git a/src/server/game/Guilds/GuildFinderMgr.cpp b/src/server/game/Guilds/GuildFinderMgr.cpp
index b0a9184aa41..3f8537ab11f 100644
--- a/src/server/game/Guilds/GuildFinderMgr.cpp
+++ b/src/server/game/Guilds/GuildFinderMgr.cpp
@@ -17,11 +17,12 @@
#include "GuildFinderMgr.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "Guild.h"
#include "GuildMgr.h"
#include "GuildFinderPackets.h"
#include "Log.h"
-#include "ObjectMgr.h"
+#include "ObjectAccessor.h"
#include "Player.h"
#include "World.h"
diff --git a/src/server/game/Guilds/GuildMgr.cpp b/src/server/game/Guilds/GuildMgr.cpp
index 513de46edd4..a5ff3bf2250 100644
--- a/src/server/game/Guilds/GuildMgr.cpp
+++ b/src/server/game/Guilds/GuildMgr.cpp
@@ -16,11 +16,13 @@
*/
#include "GuildMgr.h"
+#include "DB2Stores.h"
#include "DatabaseEnv.h"
#include "Guild.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "World.h"
+#include <algorithm>
GuildMgr::GuildMgr() : NextGuildId(UI64LIT(1))
{
diff --git a/src/server/game/Handlers/ArtifactHandler.cpp b/src/server/game/Handlers/ArtifactHandler.cpp
index a5143b81c07..4dc5201100d 100644
--- a/src/server/game/Handlers/ArtifactHandler.cpp
+++ b/src/server/game/Handlers/ArtifactHandler.cpp
@@ -18,7 +18,9 @@
#include "WorldSession.h"
#include "ArtifactPackets.h"
#include "ConditionMgr.h"
+#include "DB2Stores.h"
#include "GameTables.h"
+#include "Item.h"
#include "Player.h"
#include "SpellAuraEffects.h"
#include "SpellInfo.h"
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp
index e3edfe0f138..630c7603e67 100644
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp
@@ -20,9 +20,13 @@
#include "AccountMgr.h"
#include "AuctionHouseMgr.h"
#include "AuctionHousePackets.h"
+#include "Creature.h"
#include "DatabaseEnv.h"
+#include "Item.h"
#include "Language.h"
#include "Log.h"
+#include "Mail.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "Util.h"
diff --git a/src/server/game/Handlers/BankHandler.cpp b/src/server/game/Handlers/BankHandler.cpp
index 3d890dc5570..fac02e3c9c7 100644
--- a/src/server/game/Handlers/BankHandler.cpp
+++ b/src/server/game/Handlers/BankHandler.cpp
@@ -16,6 +16,8 @@
*/
#include "BankPackets.h"
+#include "Item.h"
+#include "DB2Stores.h"
#include "Log.h"
#include "NPCPackets.h"
#include "Opcodes.h"
diff --git a/src/server/game/Handlers/BattleGroundHandler.cpp b/src/server/game/Handlers/BattleGroundHandler.cpp
index 03684097ed2..4d3b27bfd90 100644
--- a/src/server/game/Handlers/BattleGroundHandler.cpp
+++ b/src/server/game/Handlers/BattleGroundHandler.cpp
@@ -16,38 +16,36 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
-#include "ObjectAccessor.h"
-#include "ObjectMgr.h"
-#include "ArenaTeamMgr.h"
-#include "WorldPacket.h"
#include "WorldSession.h"
-
#include "ArenaTeam.h"
-#include "BattlegroundMgr.h"
+#include "ArenaTeamMgr.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
#include "Battleground.h"
+#include "BattlegroundMgr.h"
#include "BattlegroundPackets.h"
#include "Chat.h"
+#include "Common.h"
+#include "Creature.h"
+#include "DB2Stores.h"
+#include "DisableMgr.h"
+#include "Group.h"
#include "Language.h"
#include "Log.h"
-#include "Player.h"
+#include "MotionMaster.h"
+#include "NPCPackets.h"
#include "Object.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
#include "Opcodes.h"
-#include "DisableMgr.h"
-#include "Group.h"
-#include "Battlefield.h"
-#include "BattlefieldMgr.h"
-#include "NPCPackets.h"
+#include "Player.h"
void WorldSession::HandleBattlemasterHelloOpcode(WorldPackets::NPC::Hello& hello)
{
- Creature* unit = GetPlayer()->GetMap()->GetCreature(hello.Unit);
+ Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(hello.Unit, UNIT_NPC_FLAG_BATTLEMASTER);
if (!unit)
return;
- if (!unit->IsBattleMaster()) // it's not battlemaster
- return;
-
// Stop the npc if moving
unit->StopMoving();
@@ -643,7 +641,7 @@ void WorldSession::HandleRequestPvpReward(WorldPackets::Battleground::RequestPVP
void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPackets::Battleground::AreaSpiritHealerQuery& areaSpiritHealerQuery)
{
- Creature* unit = GetPlayer()->GetMap()->GetCreature(areaSpiritHealerQuery.HealerGuid);
+ Creature* unit = ObjectAccessor::GetCreature(*GetPlayer(), areaSpiritHealerQuery.HealerGuid);
if (!unit)
return;
@@ -659,7 +657,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPackets::Battleground:
void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPackets::Battleground::AreaSpiritHealerQueue& areaSpiritHealerQueue)
{
- Creature* unit = GetPlayer()->GetMap()->GetCreature(areaSpiritHealerQueue.HealerGuid);
+ Creature* unit = ObjectAccessor::GetCreature(*GetPlayer(), areaSpiritHealerQueue.HealerGuid);
if (!unit)
return;
diff --git a/src/server/game/Handlers/BlackMarketHandler.cpp b/src/server/game/Handlers/BlackMarketHandler.cpp
index 7e8226fe5bb..dd7d234951b 100644
--- a/src/server/game/Handlers/BlackMarketHandler.cpp
+++ b/src/server/game/Handlers/BlackMarketHandler.cpp
@@ -19,6 +19,7 @@
#include "BlackMarketMgr.h"
#include "BlackMarketPackets.h"
#include "DatabaseEnv.h"
+#include "Item.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
diff --git a/src/server/game/Handlers/ChannelHandler.cpp b/src/server/game/Handlers/ChannelHandler.cpp
index 8555099d033..376c8a00d12 100644
--- a/src/server/game/Handlers/ChannelHandler.cpp
+++ b/src/server/game/Handlers/ChannelHandler.cpp
@@ -20,6 +20,7 @@
#include "Channel.h"
#include "ChannelMgr.h"
#include "ChannelPackets.h"
+#include "DB2Stores.h"
#include "Log.h"
#include "ObjectMgr.h" // for normalizePlayerName
#include "Player.h"
diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp
index 2feac5418e5..17ddf3ed8a6 100644
--- a/src/server/game/Handlers/CharacterHandler.cpp
+++ b/src/server/game/Handlers/CharacterHandler.cpp
@@ -30,19 +30,23 @@
#include "ClientConfigPackets.h"
#include "Common.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "EquipmentSetPackets.h"
+#include "GameObject.h"
#include "GitRevision.h"
#include "Group.h"
#include "Guild.h"
#include "GuildFinderMgr.h"
#include "GuildMgr.h"
+#include "Item.h"
#include "Language.h"
#include "Log.h"
+#include "Map.h"
#include "Metric.h"
#include "MiscPackets.h"
+#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
-#include "Opcodes.h"
#include "Pet.h"
#include "Player.h"
#include "PlayerDump.h"
@@ -56,7 +60,6 @@
#include "SystemPackets.h"
#include "Util.h"
#include "World.h"
-#include "WorldPacket.h"
class LoginQueryHolder : public SQLQueryHolder
{
diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp
index 765a071cf29..569e94a5f00 100644
--- a/src/server/game/Handlers/ChatHandler.cpp
+++ b/src/server/game/Handlers/ChatHandler.cpp
@@ -16,29 +16,30 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
-#include "ObjectAccessor.h"
-#include "ObjectMgr.h"
-#include "GuildMgr.h"
-#include "World.h"
-#include "WorldPacket.h"
#include "WorldSession.h"
-#include "DatabaseEnv.h"
-#include "Chat.h"
+#include "AccountMgr.h"
#include "Channel.h"
#include "ChannelMgr.h"
+#include "Chat.h"
+#include "ChatPackets.h"
+#include "Common.h"
+#include "DB2Stores.h"
+#include "DatabaseEnv.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "Guild.h"
+#include "GuildMgr.h"
#include "Language.h"
#include "Log.h"
+#include "ObjectAccessor.h"
+#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
+#include "ScriptMgr.h"
#include "SpellAuraEffects.h"
#include "Util.h"
-#include "ScriptMgr.h"
-#include "AccountMgr.h"
-#include "ChatPackets.h"
+#include "World.h"
+#include "WorldPacket.h"
void WorldSession::HandleChatMessageOpcode(WorldPackets::Chat::ChatMessage& chatMessage)
{
diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp
index 0029c2a5e03..e11d60aa5d1 100644
--- a/src/server/game/Handlers/CombatHandler.cpp
+++ b/src/server/game/Handlers/CombatHandler.cpp
@@ -16,15 +16,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "WorldSession.h"
+#include "CombatPackets.h"
#include "Common.h"
+#include "CreatureAI.h"
+#include "DB2Structure.h"
#include "Log.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
#include "ObjectAccessor.h"
-#include "CreatureAI.h"
-#include "Vehicle.h"
#include "Player.h"
-#include "CombatPackets.h"
+#include "Vehicle.h"
void WorldSession::HandleAttackSwingOpcode(WorldPackets::Combat::AttackSwing& packet)
{
diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
index cf803ed2d88..19eea1b5a7a 100644
--- a/src/server/game/Handlers/GroupHandler.cpp
+++ b/src/server/game/Handlers/GroupHandler.cpp
@@ -23,7 +23,7 @@
#include "Log.h"
#include "LootPackets.h"
#include "MiscPackets.h"
-#include "ObjectMgr.h"
+#include "ObjectAccessor.h"
#include "PartyPackets.h"
#include "Player.h"
#include "SocialMgr.h"
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 2421d30a6f6..7f9bfd09e3d 100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -19,6 +19,7 @@
#include "WorldPacket.h"
#include "BattlePetMgr.h"
#include "Common.h"
+#include "Creature.h"
#include "DatabaseEnv.h"
#include "DB2Stores.h"
#include "Item.h"
@@ -468,7 +469,7 @@ void WorldSession::HandleSellItemOpcode(WorldPackets::Item::SellItem& packet)
{
_player->ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount());
_player->RemoveItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
- pItem->RemoveFromUpdateQueueOf(_player);
+ RemoveItemFromUpdateQueueOf(pItem, _player);
_player->AddItemToBuyBackSlot(pItem);
}
@@ -877,7 +878,7 @@ void WorldSession::HandleWrapItem(WorldPackets::Item::WrapItem& packet)
if (item->GetState() == ITEM_NEW) // save new item, to have alway for `character_gifts` record in `item_instance`
{
// after save it will be impossible to remove the item from the queue
- item->RemoveFromUpdateQueueOf(_player);
+ RemoveItemFromUpdateQueueOf(item, _player);
item->SaveToDB(trans); // item gave inventory record unchanged and can be save standalone
}
CharacterDatabase.CommitTransaction(trans);
diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp
index c743ec8cec6..6669fac7291 100644
--- a/src/server/game/Handlers/LFGHandler.cpp
+++ b/src/server/game/Handlers/LFGHandler.cpp
@@ -19,6 +19,7 @@
#include "Group.h"
#include "LFGMgr.h"
#include "Log.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp
index a383dd7f660..fe6971859ee 100644
--- a/src/server/game/Handlers/LootHandler.cpp
+++ b/src/server/game/Handlers/LootHandler.cpp
@@ -21,11 +21,13 @@
#include "Common.h"
#include "Corpse.h"
#include "Creature.h"
+#include "DB2Stores.h"
#include "GameObject.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "Guild.h"
#include "GuildMgr.h"
+#include "Item.h"
#include "Log.h"
#include "LootMgr.h"
#include "LootPackets.h"
@@ -552,11 +554,9 @@ void WorldSession::HandleSetLootSpecialization(WorldPackets::Loot::SetLootSpecia
if (packet.SpecID)
{
if (ChrSpecializationEntry const* chrSpec = sChrSpecializationStore.LookupEntry(packet.SpecID))
- {
if (chrSpec->ClassID == GetPlayer()->getClass())
GetPlayer()->SetLootSpecId(packet.SpecID);
- }
}
else
- GetPlayer()->SetLootSpecId(packet.SpecID);
+ GetPlayer()->SetLootSpecId(0);
}
diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp
index 6685c693f83..2baa149f123 100644
--- a/src/server/game/Handlers/MailHandler.cpp
+++ b/src/server/game/Handlers/MailHandler.cpp
@@ -19,6 +19,7 @@
#include "AccountMgr.h"
#include "BattlenetAccountMgr.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "Guild.h"
#include "GuildMgr.h"
#include "Item.h"
@@ -26,6 +27,7 @@
#include "Log.h"
#include "Mail.h"
#include "MailPackets.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 59a7266e80e..15543943195 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -23,10 +23,12 @@
#include "Battleground.h"
#include "CharacterPackets.h"
#include "Chat.h"
+#include "CinematicMgr.h"
#include "ClientConfigPackets.h"
#include "Common.h"
+#include "Corpse.h"
#include "DatabaseEnv.h"
-#include "DBCEnums.h"
+#include "DB2Stores.h"
#include "GossipDef.h"
#include "Group.h"
#include "Guild.h"
diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp
index a85641efd7d..82f7336f0e4 100644
--- a/src/server/game/Handlers/NPCHandler.cpp
+++ b/src/server/game/Handlers/NPCHandler.cpp
@@ -23,12 +23,16 @@
#include "Creature.h"
#include "CreatureAI.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
#include "GossipDef.h"
+#include "Item.h"
#include "ItemPackets.h"
#include "Language.h"
#include "Log.h"
#include "MailPackets.h"
+#include "Map.h"
#include "NPCPackets.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp
index 9df8373cf9a..17ea7051383 100644
--- a/src/server/game/Handlers/PetHandler.cpp
+++ b/src/server/game/Handlers/PetHandler.cpp
@@ -22,6 +22,7 @@
#include "DatabaseEnv.h"
#include "Group.h"
#include "Log.h"
+#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
diff --git a/src/server/game/Handlers/PetitionsHandler.cpp b/src/server/game/Handlers/PetitionsHandler.cpp
index 6e45db003ba..489135bf70a 100644
--- a/src/server/game/Handlers/PetitionsHandler.cpp
+++ b/src/server/game/Handlers/PetitionsHandler.cpp
@@ -21,7 +21,9 @@
#include "DatabaseEnv.h"
#include "Guild.h"
#include "GuildMgr.h"
+#include "Item.h"
#include "Log.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "PetitionPackets.h"
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp
index cce3923a8aa..2ab360d76e7 100644
--- a/src/server/game/Handlers/QueryHandler.cpp
+++ b/src/server/game/Handlers/QueryHandler.cpp
@@ -18,10 +18,14 @@
#include "WorldSession.h"
#include "Common.h"
+#include "Corpse.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
+#include "Item.h"
#include "Log.h"
#include "MapManager.h"
#include "NPCHandler.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "QueryPackets.h"
@@ -108,7 +112,7 @@ void WorldSession::HandleCreatureQuery(WorldPackets::Query::QueryCreature& packe
//stats.TitleAlt = ;
stats.CursorName = creatureInfo->IconName;
- if (CreatureQuestItemList const* items = sObjectMgr->GetCreatureQuestItemList(packet.CreatureID))
+ if (std::vector<uint32> const* items = sObjectMgr->GetCreatureQuestItemList(packet.CreatureID))
for (uint32 item : *items)
stats.QuestItems.push_back(item);
@@ -156,7 +160,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPackets::Query::QueryGameObj
stats.Size = gameObjectInfo->size;
- if (GameObjectQuestItemList const* items = sObjectMgr->GetGameObjectQuestItemList(packet.GameObjectID))
+ if (std::vector<uint32> const* items = sObjectMgr->GetGameObjectQuestItemList(packet.GameObjectID))
for (int32 item : *items)
stats.QuestItems.push_back(item);
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp
index 42fddac2ac4..01edd416f7f 100644
--- a/src/server/game/Handlers/QuestHandler.cpp
+++ b/src/server/game/Handlers/QuestHandler.cpp
@@ -19,7 +19,10 @@
#include "WorldSession.h"
#include "Battleground.h"
#include "Common.h"
+#include "Creature.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
+#include "GameObject.h"
#include "GameObjectAI.h"
#include "GossipDef.h"
#include "Group.h"
diff --git a/src/server/game/Handlers/ReferAFriendHandler.cpp b/src/server/game/Handlers/ReferAFriendHandler.cpp
index e002e19f901..5c12bd4d550 100644
--- a/src/server/game/Handlers/ReferAFriendHandler.cpp
+++ b/src/server/game/Handlers/ReferAFriendHandler.cpp
@@ -17,7 +17,7 @@
#include "WorldSession.h"
#include "Log.h"
-#include "ObjectMgr.h"
+#include "ObjectAccessor.h"
#include "Player.h"
#include "ReferAFriendPackets.h"
#include "World.h"
diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp
index 39f103a50c9..b3dc78e3484 100644
--- a/src/server/game/Handlers/SkillHandler.cpp
+++ b/src/server/game/Handlers/SkillHandler.cpp
@@ -16,15 +16,15 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "WorldSession.h"
#include "Common.h"
+#include "DB2Stores.h"
#include "Log.h"
#include "ObjectAccessor.h"
-#include "Player.h"
#include "Pet.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "TalentPackets.h"
+#include "Player.h"
#include "SpellPackets.h"
+#include "TalentPackets.h"
void WorldSession::HandleLearnTalentsOpcode(WorldPackets::Talent::LearnTalents& packet)
{
diff --git a/src/server/game/Handlers/SocialHandler.cpp b/src/server/game/Handlers/SocialHandler.cpp
index e15584b771b..332035c9d89 100644
--- a/src/server/game/Handlers/SocialHandler.cpp
+++ b/src/server/game/Handlers/SocialHandler.cpp
@@ -20,6 +20,7 @@
#include "AccountMgr.h"
#include "DatabaseEnv.h"
#include "Log.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "RBAC.h"
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index 8336e448157..5a98941d0d6 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -24,8 +24,10 @@
#include "GameObjectPackets.h"
#include "Guild.h"
#include "GuildMgr.h"
+#include "Item.h"
#include "Log.h"
#include "Player.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include "Spell.h"
@@ -454,7 +456,7 @@ void WorldSession::HandleTotemDestroyed(WorldPackets::Totem::TotemDestroyed& tot
if (!_player->m_SummonSlot[slotId])
return;
- Creature* totem = GetPlayer()->GetMap()->GetCreature(_player->m_SummonSlot[slotId]);
+ Creature* totem = ObjectAccessor::GetCreature(*GetPlayer(), _player->m_SummonSlot[slotId]);
if (totem && totem->IsTotem() && totem->GetGUID() == totemDestroyed.TotemGUID)
totem->ToTotem()->UnSummon();
}
diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp
index d878a406909..e72dda130c3 100644
--- a/src/server/game/Handlers/TaxiHandler.cpp
+++ b/src/server/game/Handlers/TaxiHandler.cpp
@@ -16,15 +16,14 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "WorldSession.h"
#include "Common.h"
#include "ConditionMgr.h"
#include "Containers.h"
#include "DatabaseEnv.h"
#include "DB2Stores.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "Opcodes.h"
#include "Log.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "TaxiPackets.h"
@@ -33,11 +32,10 @@
void WorldSession::HandleEnableTaxiNodeOpcode(WorldPackets::Taxi::EnableTaxiNode& enableTaxiNode)
{
- Creature* unit = GetPlayer()->GetMap()->GetCreature(enableTaxiNode.Unit);
- SendLearnNewTaxiNode(unit);
+ if (Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(enableTaxiNode.Unit, UNIT_NPC_FLAG_FLIGHTMASTER))
+ SendLearnNewTaxiNode(unit);
}
-
void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPackets::Taxi::TaxiNodeStatusQuery& taxiNodeStatusQuery)
{
SendTaxiStatus(taxiNodeStatusQuery.UnitGUID);
@@ -46,7 +44,7 @@ void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPackets::Taxi::TaxiNodeS
void WorldSession::SendTaxiStatus(ObjectGuid guid)
{
// cheating checks
- Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
+ Creature* unit = ObjectAccessor::GetCreature(*GetPlayer(), guid);
if (!unit)
{
TC_LOG_DEBUG("network", "WorldSession::SendTaxiStatus - %s not found.", guid.ToString().c_str());
diff --git a/src/server/game/Handlers/ToyHandler.cpp b/src/server/game/Handlers/ToyHandler.cpp
index 5497abf1c17..7e1348417e8 100644
--- a/src/server/game/Handlers/ToyHandler.cpp
+++ b/src/server/game/Handlers/ToyHandler.cpp
@@ -22,6 +22,7 @@
#include "ObjectMgr.h"
#include "Player.h"
#include "Spell.h"
+#include "SpellMgr.h"
#include "ToyPackets.h"
void WorldSession::HandleAddToy(WorldPackets::Toy::AddToy& packet)
diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp
index d14d07c886a..ea79a4a67f9 100644
--- a/src/server/game/Handlers/TradeHandler.cpp
+++ b/src/server/game/Handlers/TradeHandler.cpp
@@ -27,10 +27,10 @@
#include "Player.h"
#include "SocialMgr.h"
#include "Spell.h"
+#include "SpellMgr.h"
#include "TradeData.h"
#include "TradePackets.h"
#include "World.h"
-#include "WorldPacket.h"
void WorldSession::SendTradeStatus(WorldPackets::Trade::TradeStatus& info)
{
diff --git a/src/server/game/Handlers/TransmogrificationHandler.cpp b/src/server/game/Handlers/TransmogrificationHandler.cpp
index 3e3f779b4d6..91702327a35 100644
--- a/src/server/game/Handlers/TransmogrificationHandler.cpp
+++ b/src/server/game/Handlers/TransmogrificationHandler.cpp
@@ -17,6 +17,8 @@
#include "WorldSession.h"
#include "CollectionMgr.h"
+#include "DB2Stores.h"
+#include "Item.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "Player.h"
diff --git a/src/server/game/Handlers/VehicleHandler.cpp b/src/server/game/Handlers/VehicleHandler.cpp
index 0b0b3160fd0..007ca5a67f3 100644
--- a/src/server/game/Handlers/VehicleHandler.cpp
+++ b/src/server/game/Handlers/VehicleHandler.cpp
@@ -15,12 +15,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "WorldPacket.h"
#include "WorldSession.h"
-#include "Vehicle.h"
-#include "Player.h"
+#include "DB2Structure.h"
#include "Log.h"
#include "ObjectAccessor.h"
+#include "Player.h"
+#include "Vehicle.h"
#include "VehiclePackets.h"
void WorldSession::HandleMoveDismissVehicle(WorldPackets::Vehicle::MoveDismissVehicle& moveDismissVehicle)
diff --git a/src/server/game/Handlers/VoidStorageHandler.cpp b/src/server/game/Handlers/VoidStorageHandler.cpp
index de0861d3dd3..6582932d037 100644
--- a/src/server/game/Handlers/VoidStorageHandler.cpp
+++ b/src/server/game/Handlers/VoidStorageHandler.cpp
@@ -15,17 +15,16 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Common.h"
-#include "CollectionMgr.h"
-#include "WorldPacket.h"
#include "WorldSession.h"
-#include "World.h"
+#include "Bag.h"
+#include "CollectionMgr.h"
+#include "Common.h"
+#include "Log.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
-#include "Log.h"
-#include "Opcodes.h"
#include "Player.h"
#include "VoidStoragePackets.h"
+#include "World.h"
void WorldSession::SendVoidStorageTransferResult(VoidTransferError result)
{
diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp
index d3f3d4c1ea9..10a06d400c0 100644
--- a/src/server/game/Instances/InstanceSaveMgr.cpp
+++ b/src/server/game/Instances/InstanceSaveMgr.cpp
@@ -20,6 +20,7 @@
#include "Common.h"
#include "Config.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "GridNotifiers.h"
#include "GridStates.h"
#include "Group.h"
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index 2abee1258ab..d2946b8d75b 100644
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -39,6 +39,7 @@
#include "World.h"
#include "WorldSession.h"
#include <sstream>
+#include <cstdarg>
BossBoundaryData::~BossBoundaryData()
{
diff --git a/src/server/game/Loot/Loot.cpp b/src/server/game/Loot/Loot.cpp
index 406c616ccc0..7207edfa877 100644
--- a/src/server/game/Loot/Loot.cpp
+++ b/src/server/game/Loot/Loot.cpp
@@ -23,6 +23,7 @@
#include "Log.h"
#include "LootMgr.h"
#include "LootPackets.h"
+#include "Map.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
diff --git a/src/server/game/Loot/Loot.h b/src/server/game/Loot/Loot.h
index 64268ff64b8..d11f34ac71a 100644
--- a/src/server/game/Loot/Loot.h
+++ b/src/server/game/Loot/Loot.h
@@ -102,7 +102,7 @@ enum LootType : uint8
LOOT_FISHING_JUNK = 22 // unsupported by client, sending LOOT_FISHING instead
};
-enum LootError
+enum LootError : uint8
{
LOOT_ERROR_DIDNT_KILL = 0, // You don't have permission to loot that corpse.
LOOT_ERROR_TOO_FAR = 4, // You are too far away to loot that corpse.
diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp
index 322ae79aa0e..d6c47c5e19c 100644
--- a/src/server/game/Mails/Mail.cpp
+++ b/src/server/game/Mails/Mail.cpp
@@ -24,6 +24,7 @@
#include "Item.h"
#include "Log.h"
#include "LootMgr.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "World.h"
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 5fe949dec57..7556384b058 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -36,7 +36,9 @@
#include "MapManager.h"
#include "MiscPackets.h"
#include "MMapFactory.h"
+#include "MotionMaster.h"
#include "ObjectAccessor.h"
+#include "ObjectGridLoader.h"
#include "ObjectMgr.h"
#include "Pet.h"
#include "ScriptMgr.h"
@@ -45,6 +47,7 @@
#include "VMapFactory.h"
#include "Weather.h"
#include "World.h"
+#include "WorldSession.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 f58859316ff..69dfd6affba 100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -226,18 +226,6 @@ public:
#pragma pack(push, 1)
-struct InstanceTemplate
-{
- uint32 Parent;
- uint32 ScriptId;
- bool AllowMount;
-};
-
-enum LevelRequirementVsMode
-{
- LEVELREQUIREMENT_HEROIC = 70
-};
-
struct ZoneDynamicInfo
{
ZoneDynamicInfo();
diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp
index 6ea46eb63ee..bc16254071d 100644
--- a/src/server/game/Maps/MapInstanced.cpp
+++ b/src/server/game/Maps/MapInstanced.cpp
@@ -18,6 +18,7 @@
#include "MapInstanced.h"
#include "Battleground.h"
+#include "DB2Stores.h"
#include "GarrisonMap.h"
#include "Group.h"
#include "InstanceSaveMgr.h"
diff --git a/src/server/game/Maps/MapReference.cpp b/src/server/game/Maps/MapReference.cpp
new file mode 100644
index 00000000000..a14378be524
--- /dev/null
+++ b/src/server/game/Maps/MapReference.cpp
@@ -0,0 +1,39 @@
+/*
+ * 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 "MapReference.h"
+#include "Map.h"
+
+void MapReference::targetObjectBuildLink()
+{
+ // called from link()
+ getTarget()->m_mapRefManager.insertFirst(this);
+ getTarget()->m_mapRefManager.incSize();
+}
+
+void MapReference::targetObjectDestroyLink()
+{
+ // called from unlink()
+ if (isValid())
+ getTarget()->m_mapRefManager.decSize();
+}
+
+void MapReference::sourceObjectDestroyLink()
+{
+ // called from invalidate()
+ getTarget()->m_mapRefManager.decSize();
+}
diff --git a/src/server/game/Maps/MapReference.h b/src/server/game/Maps/MapReference.h
index 11a97b6f44b..73b0635390e 100644
--- a/src/server/game/Maps/MapReference.h
+++ b/src/server/game/Maps/MapReference.h
@@ -20,27 +20,16 @@
#define _MAPREFERENCE_H
#include "Reference.h"
-#include "Map.h"
+
+class Map;
+class Player;
class MapReference : public Reference<Map, Player>
{
protected:
- void targetObjectBuildLink() override
- {
- // called from link()
- getTarget()->m_mapRefManager.insertFirst(this);
- getTarget()->m_mapRefManager.incSize();
- }
- void targetObjectDestroyLink() override
- {
- // called from unlink()
- if (isValid()) getTarget()->m_mapRefManager.decSize();
- }
- void sourceObjectDestroyLink() override
- {
- // called from invalidate()
- getTarget()->m_mapRefManager.decSize();
- }
+ void targetObjectBuildLink() override;
+ void targetObjectDestroyLink() override;
+ void sourceObjectDestroyLink() override;
public:
MapReference() : Reference<Map, Player>() { }
~MapReference() { unlink(); }
diff --git a/src/server/game/Maps/MapScripts.cpp b/src/server/game/Maps/MapScripts.cpp
index 3dd766a8646..02265f49b51 100644
--- a/src/server/game/Maps/MapScripts.cpp
+++ b/src/server/game/Maps/MapScripts.cpp
@@ -23,6 +23,8 @@
#include "Item.h"
#include "Log.h"
#include "MapManager.h"
+#include "MotionMaster.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Pet.h"
#include "ScriptMgr.h"
diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp
index 06dec768990..e998619a3d8 100644
--- a/src/server/game/Maps/TransportMgr.cpp
+++ b/src/server/game/Maps/TransportMgr.cpp
@@ -20,6 +20,8 @@
#include "InstanceScript.h"
#include "Log.h"
#include "MapManager.h"
+#include "MoveSplineInitArgs.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Spline.h"
#include "Transport.h"
diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h
index dd3cc5ff685..af750a5a3a6 100644
--- a/src/server/game/Miscellaneous/Formulas.h
+++ b/src/server/game/Miscellaneous/Formulas.h
@@ -19,12 +19,13 @@
#ifndef TRINITY_FORMULAS_H
#define TRINITY_FORMULAS_H
-#include "World.h"
-#include "SharedDefines.h"
-#include "ScriptMgr.h"
-#include "Player.h"
-#include "GameTables.h"
#include "Creature.h"
+#include "GameTables.h"
+#include "Map.h"
+#include "Player.h"
+#include "ScriptMgr.h"
+#include "SharedDefines.h"
+#include "World.h"
namespace Trinity
{
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index 9618146160e..6d60c96d72a 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -21,6 +21,7 @@
#include "Creature.h"
#include "ScriptSystem.h"
#include "Log.h"
+#include "Map.h"
#include "ConfusedMovementGenerator.h"
#include "FleeingMovementGenerator.h"
#include "HomeMovementGenerator.h"
@@ -457,7 +458,7 @@ void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool
init.Launch();
}
-void MotionMaster::MoveSmoothPath(uint32 pointId, G3D::Vector3 const* pathPoints, size_t pathSize, bool walk, bool fly)
+void MotionMaster::MoveSmoothPath(uint32 pointId, Position const* pathPoints, size_t pathSize, bool walk, bool fly)
{
Movement::MoveSplineInit init(_owner);
if (fly)
@@ -466,7 +467,12 @@ void MotionMaster::MoveSmoothPath(uint32 pointId, G3D::Vector3 const* pathPoints
init.SetUncompressed();
}
- Movement::PointsArray path(pathPoints, pathPoints + pathSize);
+ Movement::PointsArray path;
+ path.reserve(pathSize);
+ std::transform(pathPoints, pathPoints + pathSize, std::back_inserter(path), [](Position const& point)
+ {
+ return G3D::Vector3(point.GetPositionX(), point.GetPositionY(), point.GetPositionZ());
+ });
init.MovebyPath(path);
init.SetSmooth();
init.SetWalk(walk);
@@ -488,7 +494,7 @@ void MotionMaster::MoveAlongSplineChain(uint32 pointId, uint16 dbChainId, bool w
TC_LOG_ERROR("misc", "MotionMaster::MoveAlongSplineChain: non-creature %s tried to walk along DB spline chain. Ignoring.", _owner->GetGUID().ToString().c_str());
return;
}
- SplineChain const* chain = sScriptSystemMgr->GetSplineChain(owner, dbChainId);
+ std::vector<SplineChainLink> const* chain = sScriptSystemMgr->GetSplineChain(owner, dbChainId);
if (!chain)
{
TC_LOG_ERROR("misc", "MotionMaster::MoveAlongSplineChain: creature with entry %u tried to walk along non-existing spline chain with DB id %u.", owner->GetEntry(), dbChainId);
diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h
index e338b61244e..a509c908cd1 100644
--- a/src/server/game/Movement/MotionMaster.h
+++ b/src/server/game/Movement/MotionMaster.h
@@ -46,7 +46,7 @@ namespace Movement
#define VISUAL_WAYPOINT 1
// values 0 ... MAX_DB_MOTION_TYPE-1 used in DB
-enum MovementGeneratorType
+enum MovementGeneratorType : uint8
{
IDLE_MOTION_TYPE = 0, // IdleMovementGenerator.h
RANDOM_MOTION_TYPE = 1, // RandomMovementGenerator.h
@@ -215,7 +215,7 @@ class TC_GAME_API MotionMaster //: private std::stack<MovementGenerator *>
}
void MoveJump(float x, float y, float z, float o, float speedXY, float speedZ, uint32 id = EVENT_JUMP, bool hasOrientation = false, JumpArrivalCastArgs const* arrivalCast = nullptr, Movement::SpellEffectExtraData const* spellEffectExtraData = nullptr);
void MoveCirclePath(float x, float y, float z, float radius, bool clockwise, uint8 stepCount);
- void MoveSmoothPath(uint32 pointId, G3D::Vector3 const* pathPoints, size_t pathSize, bool walk = false, bool fly = false);
+ void MoveSmoothPath(uint32 pointId, Position const* pathPoints, size_t pathSize, bool walk = false, bool fly = false);
// Walk along spline chain stored in DB (script_spline_chain_meta and script_spline_chain_waypoints)
void MoveAlongSplineChain(uint32 pointId, uint16 dbChainId, bool walk);
void MoveAlongSplineChain(uint32 pointId, std::vector<SplineChainLink> const& chain, bool walk);
diff --git a/src/server/game/Movement/MovementGenerators/SplineChainMovementGenerator.h b/src/server/game/Movement/MovementGenerators/SplineChainMovementGenerator.h
index 2892dc3e5c6..a0fbabb4fe1 100644
--- a/src/server/game/Movement/MovementGenerators/SplineChainMovementGenerator.h
+++ b/src/server/game/Movement/MovementGenerators/SplineChainMovementGenerator.h
@@ -24,7 +24,7 @@
class TC_GAME_API SplineChainMovementGenerator : public MovementGenerator
{
public:
- explicit SplineChainMovementGenerator(uint32 id, SplineChain const& chain, bool walk = false) : _id(id), _chain(chain), _chainSize(chain.size()), _walk(walk), finished(false), _nextIndex(0), _nextFirstWP(0), _msToNext(0) { }
+ explicit SplineChainMovementGenerator(uint32 id, std::vector<SplineChainLink> const& chain, bool walk = false) : _id(id), _chain(chain), _chainSize(chain.size()), _walk(walk), finished(false), _nextIndex(0), _nextFirstWP(0), _msToNext(0) { }
explicit SplineChainMovementGenerator(SplineChainResumeInfo const& info) : _id(info.PointID), _chain(*info.Chain), _chainSize(info.Chain->size()), _walk(info.IsWalkMode), finished(info.SplineIndex >= info.Chain->size()), _nextIndex(info.SplineIndex), _nextFirstWP(info.PointIndex), _msToNext(info.TimeToNext) { }
void Initialize(Unit* me) override;
void Finalize(Unit* me) override;
@@ -41,7 +41,7 @@ class TC_GAME_API SplineChainMovementGenerator : public MovementGenerator
void SendSplineFor(Unit* me, uint32 index, uint32& toNext);
uint32 SendPathSpline(Unit* me, Movement::PointsArray const& wp) const;
uint32 const _id;
- SplineChain const& _chain;
+ std::vector<SplineChainLink> const& _chain;
uint8 const _chainSize;
bool const _walk;
bool finished;
diff --git a/src/server/game/Movement/PathGenerator.h b/src/server/game/Movement/PathGenerator.h
index a3e88b8a705..2884f8a1220 100644
--- a/src/server/game/Movement/PathGenerator.h
+++ b/src/server/game/Movement/PathGenerator.h
@@ -23,6 +23,7 @@
#include "DetourNavMesh.h"
#include "DetourNavMeshQuery.h"
#include "MoveSplineInitArgs.h"
+#include <G3D/Vector3.h>
class Unit;
diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp
index a30c91c070c..9dc75a1225d 100644
--- a/src/server/game/Movement/Spline/MoveSpline.cpp
+++ b/src/server/game/Movement/Spline/MoveSpline.cpp
@@ -257,6 +257,14 @@ bool MoveSplineInitArgs::_checkPathLengths() const
return false;
return true;
}
+MoveSplineInitArgs::MoveSplineInitArgs(size_t path_capacity /*= 16*/) : path_Idx_offset(0), velocity(0.f),
+parabolic_amplitude(0.f), time_perc(0.f), splineId(0), initialOrientation(0.f),
+walk(false), HasVelocity(false), TransformForTransport(true)
+{
+ path.reserve(path_capacity);
+}
+
+MoveSplineInitArgs::~MoveSplineInitArgs() = default;
/// ============================================================================================
diff --git a/src/server/game/Movement/Spline/MoveSpline.h b/src/server/game/Movement/Spline/MoveSpline.h
index 2df68eb94e8..c88037b7506 100644
--- a/src/server/game/Movement/Spline/MoveSpline.h
+++ b/src/server/game/Movement/Spline/MoveSpline.h
@@ -21,6 +21,7 @@
#include "Spline.h"
#include "MoveSplineInitArgs.h"
+#include <G3D/Vector3.h>
namespace WorldPackets
{
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp
index 1f36a292bbf..1745ef24a39 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.cpp
+++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp
@@ -17,10 +17,11 @@
*/
#include "MoveSplineInit.h"
+#include "MovementPackets.h"
#include "MoveSpline.h"
-#include "Unit.h"
+#include "PathGenerator.h"
#include "Transport.h"
-#include "MovementPackets.h"
+#include "Unit.h"
namespace Movement
{
@@ -189,7 +190,19 @@ namespace Movement
args.flags.steering = unit->HasFlag64(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_STEERING);
}
- void MoveSplineInit::SetFacing(const Unit* target)
+ MoveSplineInit::~MoveSplineInit() = default;
+
+ void MoveSplineInit::SetFacing(Vector3 const& spot)
+ {
+ TransportPathTransform transform(unit, args.TransformForTransport);
+ Vector3 finalSpot = transform(spot);
+ args.facing.f.x = finalSpot.x;
+ args.facing.f.y = finalSpot.y;
+ args.facing.f.z = finalSpot.z;
+ args.facing.type = MONSTER_MOVE_FACING_SPOT;
+ }
+
+ void MoveSplineInit::SetFacing(Unit const* target)
{
args.facing.angle = unit->GetAngle(target);
args.facing.target = target->GetGUID();
@@ -210,6 +223,18 @@ namespace Movement
args.facing.type = MONSTER_MOVE_FACING_ANGLE;
}
+ void MoveSplineInit::MovebyPath(const PointsArray& controls, int32 path_offset)
+ {
+ args.path_Idx_offset = path_offset;
+ args.path.reserve(controls.size());
+ std::transform(controls.begin(), controls.end(), std::back_inserter(args.path), TransportPathTransform(unit, args.TransformForTransport));
+ }
+
+ void MoveSplineInit::MoveTo(float x, float y, float z, bool generatePath, bool forceDestination)
+ {
+ MoveTo(G3D::Vector3(x, y, z), generatePath, forceDestination);
+ }
+
void MoveSplineInit::MoveTo(const Vector3& dest, bool generatePath, bool forceDestination)
{
if (generatePath)
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.h b/src/server/game/Movement/Spline/MoveSplineInit.h
index e02f840f107..cca4c32ef2b 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.h
+++ b/src/server/game/Movement/Spline/MoveSplineInit.h
@@ -20,7 +20,6 @@
#define TRINITYSERVER_MOVESPLINEINIT_H
#include "MoveSplineInitArgs.h"
-#include "PathGenerator.h"
class Unit;
@@ -54,6 +53,9 @@ namespace Movement
public:
explicit MoveSplineInit(Unit* m);
+ ~MoveSplineInit();
+ MoveSplineInit(MoveSplineInit const&) = delete;
+ MoveSplineInit& operator=(MoveSplineInit const&) = delete;
/* Final pass of initialization that launches spline movement.
*/
@@ -80,7 +82,7 @@ namespace Movement
*/
void SetFacing(float angle);
void SetFacing(Vector3 const& point);
- void SetFacing(const Unit* target);
+ void SetFacing(Unit const* target);
/* Initializes movement by path
* @param path - array of points, shouldn't be empty
@@ -170,18 +172,6 @@ namespace Movement
inline void MoveSplineInit::SetTransportExit() { args.flags.EnableTransportExit(); }
inline void MoveSplineInit::SetOrientationFixed(bool enable) { args.flags.orientationFixed = enable; }
- inline void MoveSplineInit::MovebyPath(const PointsArray& controls, int32 path_offset)
- {
- args.path_Idx_offset = path_offset;
- args.path.resize(controls.size());
- std::transform(controls.begin(), controls.end(), args.path.begin(), TransportPathTransform(unit, args.TransformForTransport));
- }
-
- inline void MoveSplineInit::MoveTo(float x, float y, float z, bool generatePath, bool forceDestination)
- {
- MoveTo(G3D::Vector3(x, y, z), generatePath, forceDestination);
- }
-
inline void MoveSplineInit::SetParabolic(float amplitude, float time_shift)
{
args.time_perc = time_shift;
@@ -195,16 +185,6 @@ namespace Movement
args.flags.EnableAnimation((uint8)anim);
}
- inline void MoveSplineInit::SetFacing(Vector3 const& spot)
- {
- TransportPathTransform transform(unit, args.TransformForTransport);
- Vector3 finalSpot = transform(spot);
- args.facing.f.x = finalSpot.x;
- args.facing.f.y = finalSpot.y;
- args.facing.f.z = finalSpot.z;
- args.facing.type = MONSTER_MOVE_FACING_SPOT;
- }
-
inline void MoveSplineInit::DisableTransportPathTransformations() { args.TransformForTransport = false; }
inline void MoveSplineInit::SetSpellEffectExtraData(SpellEffectExtraData const& spellEffectExtraData)
diff --git a/src/server/game/Movement/Spline/MoveSplineInitArgs.h b/src/server/game/Movement/Spline/MoveSplineInitArgs.h
index d9688674dfc..f0011bcb9fb 100644
--- a/src/server/game/Movement/Spline/MoveSplineInitArgs.h
+++ b/src/server/game/Movement/Spline/MoveSplineInitArgs.h
@@ -22,7 +22,6 @@
#include "MoveSplineFlag.h"
#include "ObjectGuid.h"
#include "Optional.h"
-#include <G3D/Vector3.h>
class Unit;
@@ -32,7 +31,10 @@ namespace Movement
struct FacingInfo
{
- G3D::Vector3 f;
+ struct
+ {
+ float x, y, z;
+ } f;
ObjectGuid target;
float angle;
@@ -51,12 +53,8 @@ namespace Movement
struct MoveSplineInitArgs
{
- MoveSplineInitArgs(size_t path_capacity = 16) : path_Idx_offset(0), velocity(0.f),
- parabolic_amplitude(0.f), time_perc(0.f), splineId(0), initialOrientation(0.f),
- walk(false), HasVelocity(false), TransformForTransport(true)
- {
- path.reserve(path_capacity);
- }
+ explicit MoveSplineInitArgs(size_t path_capacity = 16);
+ ~MoveSplineInitArgs();
PointsArray path;
FacingInfo facing;
diff --git a/src/server/game/Movement/Spline/Spline.h b/src/server/game/Movement/Spline/Spline.h
index e0f7cdce7fc..a029eb295bf 100644
--- a/src/server/game/Movement/Spline/Spline.h
+++ b/src/server/game/Movement/Spline/Spline.h
@@ -23,6 +23,7 @@
#include "Errors.h"
#include <G3D/Vector3.h>
#include <limits>
+#include <vector>
namespace Movement {
diff --git a/src/server/game/Movement/Spline/SplineChain.h b/src/server/game/Movement/Spline/SplineChain.h
index 33d816712b7..e189dc3ecbf 100644
--- a/src/server/game/Movement/Spline/SplineChain.h
+++ b/src/server/game/Movement/Spline/SplineChain.h
@@ -19,6 +19,7 @@
#define TRINITY_SPLINECHAIN_H
#include "MoveSplineInitArgs.h"
+#include <G3D/Vector3.h>
struct TC_GAME_API SplineChainLink
{
@@ -29,17 +30,16 @@ struct TC_GAME_API SplineChainLink
uint32 ExpectedDuration;
uint32 TimeToNext;
};
-typedef std::vector<SplineChainLink> SplineChain;
struct TC_GAME_API SplineChainResumeInfo
{
SplineChainResumeInfo() : PointID(0), Chain(nullptr), IsWalkMode(false), SplineIndex(0), PointIndex(0), TimeToNext(0) { }
- SplineChainResumeInfo(uint32 id, SplineChain const* chain, bool walk, uint8 splineIndex, uint8 wpIndex, uint32 msToNext) :
+ SplineChainResumeInfo(uint32 id, std::vector<SplineChainLink> const* chain, bool walk, uint8 splineIndex, uint8 wpIndex, uint32 msToNext) :
PointID(id), Chain(chain), IsWalkMode(walk), SplineIndex(splineIndex), PointIndex(wpIndex), TimeToNext(msToNext) { }
bool Empty() const { return Chain == nullptr; }
void Clear() { Chain = nullptr; }
uint32 PointID;
- SplineChain const* Chain;
+ std::vector<SplineChainLink> const* Chain;
bool IsWalkMode;
uint8 SplineIndex;
uint8 PointIndex;
diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
index 8b021d9d8a5..824eb144eac 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp
@@ -19,7 +19,7 @@
#include "CellImpl.h"
#include "ChatPackets.h"
#include "DatabaseEnv.h"
-#include "GridNotifiers.h"
+#include "DB2Stores.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "Log.h"
@@ -29,6 +29,7 @@
#include "ObjectMgr.h"
#include "OutdoorPvPMgr.h"
#include "WorldPacket.h"
+#include "WorldSession.h"
class DefenseMessageBuilder
{
diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
index 4a8ffe68e16..80dc54864df 100644
--- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
+++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp
@@ -17,6 +17,7 @@
#include "OutdoorPvPMgr.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "DisableMgr.h"
#include "Log.h"
#include "ObjectMgr.h"
diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp
index ba614cfb4b6..aa7edf99e9c 100644
--- a/src/server/game/Pools/PoolMgr.cpp
+++ b/src/server/game/Pools/PoolMgr.cpp
@@ -18,7 +18,9 @@
#include "PoolMgr.h"
#include "Containers.h"
+#include "Creature.h"
#include "DatabaseEnv.h"
+#include "GameObject.h"
#include "Log.h"
#include "MapManager.h"
#include "ObjectMgr.h"
diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp
index 9baea76bd03..57f16b0622e 100644
--- a/src/server/game/Quests/QuestDef.cpp
+++ b/src/server/game/Quests/QuestDef.cpp
@@ -17,12 +17,13 @@
*/
#include "QuestDef.h"
+#include "DB2Stores.h"
#include "Field.h"
#include "GameTables.h"
#include "Log.h"
#include "Player.h"
-#include "World.h"
#include "QuestPackets.h"
+#include "World.h"
Quest::Quest(Field* questRecord)
{
diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp
index 038e05f1b3c..18da6a07006 100644
--- a/src/server/game/Reputation/ReputationMgr.cpp
+++ b/src/server/game/Reputation/ReputationMgr.cpp
@@ -19,6 +19,7 @@
#include "ReputationMgr.h"
#include "CharacterPackets.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
diff --git a/src/server/game/Scenarios/InstanceScenario.cpp b/src/server/game/Scenarios/InstanceScenario.cpp
index 72d20c245ab..1f4cfa6a92c 100644
--- a/src/server/game/Scenarios/InstanceScenario.cpp
+++ b/src/server/game/Scenarios/InstanceScenario.cpp
@@ -17,8 +17,10 @@
#include "InstanceScenario.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "InstanceSaveMgr.h"
#include "Log.h"
+#include "Map.h"
#include "ObjectMgr.h"
#include "Player.h"
diff --git a/src/server/game/Scenarios/Scenario.cpp b/src/server/game/Scenarios/Scenario.cpp
index a59bb366ff2..0c6eef3f426 100644
--- a/src/server/game/Scenarios/Scenario.cpp
+++ b/src/server/game/Scenarios/Scenario.cpp
@@ -18,6 +18,7 @@
#include "Scenario.h"
#include "InstanceSaveMgr.h"
#include "Log.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ScenarioMgr.h"
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index cf9cb50b3be..3eed0132d3c 100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -26,6 +26,7 @@
#include "Errors.h"
#include "GameObject.h"
#include "GossipDef.h"
+#include "Item.h"
#include "LFGScripts.h"
#include "Log.h"
#include "Map.h"
diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp
index f205fa138af..3a86e761aca 100644
--- a/src/server/game/Scripting/ScriptSystem.cpp
+++ b/src/server/game/Scripting/ScriptSystem.cpp
@@ -22,6 +22,10 @@
#include "Log.h"
#include "ObjectMgr.h"
#include "ScriptMgr.h"
+#include "SplineChain.h"
+
+SystemMgr::SystemMgr() = default;
+SystemMgr::~SystemMgr() = default;
SystemMgr* SystemMgr::instance()
{
@@ -109,7 +113,7 @@ void SystemMgr::LoadScriptSplineChains()
uint32 entry = fieldsMeta[0].GetUInt32();
uint16 chainId = fieldsMeta[1].GetUInt16();
uint8 splineId = fieldsMeta[2].GetUInt8();
- SplineChain& chain = m_mSplineChainsMap[{entry,chainId}];
+ std::vector<SplineChainLink>& chain = m_mSplineChainsMap[{entry,chainId}];
if (splineId != chain.size())
{
@@ -117,8 +121,9 @@ void SystemMgr::LoadScriptSplineChains()
continue;
}
- uint32 expectedDuration = fieldsMeta[3].GetUInt32(), msUntilNext = fieldsMeta[4].GetUInt32();
- chain.push_back(SplineChainLink(expectedDuration, msUntilNext));
+ uint32 expectedDuration = fieldsMeta[3].GetUInt32();
+ uint32 msUntilNext = fieldsMeta[4].GetUInt32();
+ chain.emplace_back(expectedDuration, msUntilNext);
if (splineId == 0)
++chainCount;
@@ -138,7 +143,7 @@ void SystemMgr::LoadScriptSplineChains()
TC_LOG_WARN("server.loading", "Creature #%u has waypoint data for spline chain %u. No such chain exists - entry skipped.", entry, chainId);
continue;
}
- SplineChain& chain = it->second;
+ std::vector<SplineChainLink>& chain = it->second;
if (splineId >= chain.size())
{
TC_LOG_WARN("server.loading", "Creature #%u has waypoint data for spline (%u,%u). The specified chain does not have a spline with this index - entry skipped.", entry, chainId, splineId);
@@ -158,7 +163,15 @@ void SystemMgr::LoadScriptSplineChains()
}
}
-SplineChain const* SystemMgr::GetSplineChain(Creature const* who, uint16 id) const
+std::vector<SplineChainLink> const* SystemMgr::GetSplineChain(uint32 entry, uint16 chainId) const
+{
+ auto it = m_mSplineChainsMap.find({ entry, chainId });
+ if (it != m_mSplineChainsMap.end())
+ return &it->second;
+ return nullptr;
+}
+
+std::vector<SplineChainLink> const* SystemMgr::GetSplineChain(Creature const* who, uint16 id) const
{
return GetSplineChain(who->GetEntry(), id);
}
diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h
index 304275e87c7..af29bf1fdec 100644
--- a/src/server/game/Scripting/ScriptSystem.h
+++ b/src/server/game/Scripting/ScriptSystem.h
@@ -21,11 +21,11 @@
#include "Define.h"
#include "Hash.h"
-#include "SplineChain.h"
#include <unordered_map>
#include <vector>
class Creature;
+struct SplineChainLink;
#define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available
@@ -68,8 +68,10 @@ typedef std::vector<ScriptPointMove> ScriptPointVector;
class TC_GAME_API SystemMgr
{
private:
- SystemMgr() { }
- ~SystemMgr() { }
+ SystemMgr();
+ ~SystemMgr();
+ SystemMgr(SystemMgr const&) = delete;
+ SystemMgr& operator=(SystemMgr const&) = delete;
public:
static SystemMgr* instance();
@@ -90,20 +92,13 @@ class TC_GAME_API SystemMgr
return &itr->second;
}
- SplineChain const* GetSplineChain(uint32 entry, uint16 chainId) const
- {
- auto it = m_mSplineChainsMap.find({ entry, chainId });
- if (it == m_mSplineChainsMap.end())
- return nullptr;
- return &it->second;
- }
-
- SplineChain const* GetSplineChain(Creature const* who, uint16 id) const;
+ std::vector<SplineChainLink> const* GetSplineChain(uint32 entry, uint16 chainId) const;
+ std::vector<SplineChainLink> const* GetSplineChain(Creature const* who, uint16 id) const;
protected:
PointMoveMap m_mPointMoveMap; //coordinates for waypoints
typedef std::pair<uint32, uint16> ChainKeyType; // creature entry + chain ID
- std::unordered_map<ChainKeyType, SplineChain> m_mSplineChainsMap; // spline chains
+ std::unordered_map<ChainKeyType, std::vector<SplineChainLink>> m_mSplineChainsMap; // spline chains
};
#define sScriptSystemMgr SystemMgr::instance()
diff --git a/src/server/game/Server/Packets/CharacterPackets.cpp b/src/server/game/Server/Packets/CharacterPackets.cpp
index efbb5035319..8f685cec810 100644
--- a/src/server/game/Server/Packets/CharacterPackets.cpp
+++ b/src/server/game/Server/Packets/CharacterPackets.cpp
@@ -16,6 +16,7 @@
*/
#include "CharacterPackets.h"
+#include "DB2Stores.h"
#include "Field.h"
#include "ObjectMgr.h"
#include "Player.h"
diff --git a/src/server/game/Server/Packets/ChatPackets.cpp b/src/server/game/Server/Packets/ChatPackets.cpp
index 6cc86a8a013..a587246ac5e 100644
--- a/src/server/game/Server/Packets/ChatPackets.cpp
+++ b/src/server/game/Server/Packets/ChatPackets.cpp
@@ -16,10 +16,11 @@
*/
#include "ChatPackets.h"
+#include "Creature.h"
#include "Group.h"
#include "Player.h"
#include "World.h"
-#include "Creature.h"
+#include "WorldSession.h"
void WorldPackets::Chat::ChatMessage::Read()
{
diff --git a/src/server/game/Server/Packets/ItemPackets.cpp b/src/server/game/Server/Packets/ItemPackets.cpp
index 2470dca41c9..89dfa245a06 100644
--- a/src/server/game/Server/Packets/ItemPackets.cpp
+++ b/src/server/game/Server/Packets/ItemPackets.cpp
@@ -340,8 +340,8 @@ void WorldPackets::Item::UpgradeItem::Read()
void WorldPackets::Item::SocketGems::Read()
{
_worldPacket >> ItemGuid;
- for (uint32 i = 0; i < MAX_GEM_SOCKETS; ++i)
- _worldPacket >> GemItem[i];
+ for (ObjectGuid& gemGuid : GemItem)
+ _worldPacket >> gemGuid;
}
WorldPacket const* WorldPackets::Item::SocketGemsResult::Write()
diff --git a/src/server/game/Server/Packets/ItemPackets.h b/src/server/game/Server/Packets/ItemPackets.h
index 4e677814083..1589f89a251 100644
--- a/src/server/game/Server/Packets/ItemPackets.h
+++ b/src/server/game/Server/Packets/ItemPackets.h
@@ -19,10 +19,13 @@
#define ItemPackets_h__
#include "Packet.h"
-#include "Item.h"
+#include "DBCEnums.h"
+#include "ItemDefines.h"
#include "ItemPacketsCommon.h"
#include "PacketUtilities.h"
+#include "ObjectGuid.h"
#include "Optional.h"
+#include <array>
struct VoidStorageItem;
@@ -476,7 +479,7 @@ namespace WorldPackets
void Read() override;
ObjectGuid ItemGuid;
- ObjectGuid GemItem[MAX_GEM_SOCKETS];
+ std::array<ObjectGuid, MAX_ITEM_PROTO_SOCKETS> GemItem;
};
class SocketGemsResult final : public ServerPacket
diff --git a/src/server/game/Server/Packets/MailPackets.cpp b/src/server/game/Server/Packets/MailPackets.cpp
index 0be3b4206d2..fb1c7c1d3a4 100644
--- a/src/server/game/Server/Packets/MailPackets.cpp
+++ b/src/server/game/Server/Packets/MailPackets.cpp
@@ -15,8 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "Mail.h"
#include "MailPackets.h"
+#include "Item.h"
+#include "Mail.h"
#include "Player.h"
#include "World.h"
diff --git a/src/server/game/Server/Packets/MovementPackets.cpp b/src/server/game/Server/Packets/MovementPackets.cpp
index 5320a74b0b8..8bebc63711a 100644
--- a/src/server/game/Server/Packets/MovementPackets.cpp
+++ b/src/server/game/Server/Packets/MovementPackets.cpp
@@ -347,7 +347,7 @@ void WorldPackets::Movement::CommonMovement::WriteCreateObjectSplineDataBlock(::
if (HasSpecialTime)
data << uint32(moveSpline.effect_start_time); // SpecialTime
- data.append<G3D::Vector3>(&moveSpline.getPath()[0], moveSpline.getPath().size());
+ data.append(moveSpline.getPath().data(), moveSpline.getPath().size());
if (moveSpline.spell_effect_extra)
{
@@ -359,6 +359,12 @@ void WorldPackets::Movement::CommonMovement::WriteCreateObjectSplineDataBlock(::
}
}
+void WorldPackets::Movement::CommonMovement::WriteCreateObjectAreaTriggerSpline(::Movement::Spline<int32> const& spline, ByteBuffer& data)
+{
+ data.WriteBits(spline.getPoints().size(), 16);
+ data.append<G3D::Vector3>(spline.getPoints().data(), spline.getPoints().size());
+}
+
void WorldPackets::Movement::MonsterMove::InitializeSplineData(::Movement::MoveSpline const& moveSpline)
{
SplineData.ID = moveSpline.m_Id;
diff --git a/src/server/game/Server/Packets/MovementPackets.h b/src/server/game/Server/Packets/MovementPackets.h
index 5e4168a4270..328ea1845dd 100644
--- a/src/server/game/Server/Packets/MovementPackets.h
+++ b/src/server/game/Server/Packets/MovementPackets.h
@@ -24,6 +24,8 @@
namespace Movement
{
+ template<class index_type>
+ class Spline;
class MoveSpline;
}
@@ -111,6 +113,7 @@ namespace WorldPackets
{
public:
static void WriteCreateObjectSplineDataBlock(::Movement::MoveSpline const& moveSpline, ByteBuffer& data);
+ static void WriteCreateObjectAreaTriggerSpline(::Movement::Spline<int32> const& spline, ByteBuffer& data);
};
class MonsterMove final : public ServerPacket
diff --git a/src/server/game/Server/Packets/PartyPackets.cpp b/src/server/game/Server/Packets/PartyPackets.cpp
index c4974e77f6e..8d3c648a7e6 100644
--- a/src/server/game/Server/Packets/PartyPackets.cpp
+++ b/src/server/game/Server/Packets/PartyPackets.cpp
@@ -23,6 +23,7 @@
#include "SpellAuras.h"
#include "Vehicle.h"
#include "World.h"
+#include "WorldSession.h"
WorldPacket const* WorldPackets::Party::PartyCommandResult::Write()
{
diff --git a/src/server/game/Server/Packets/QueryPackets.cpp b/src/server/game/Server/Packets/QueryPackets.cpp
index ffd1a645b6e..2ff815e647c 100644
--- a/src/server/game/Server/Packets/QueryPackets.cpp
+++ b/src/server/game/Server/Packets/QueryPackets.cpp
@@ -17,9 +17,10 @@
#include "QueryPackets.h"
#include "BattlenetAccountMgr.h"
+#include "ObjectMgr.h"
#include "Player.h"
#include "World.h"
-#include "ObjectMgr.h"
+#include "WorldSession.h"
void WorldPackets::Query::QueryCreature::Read()
{
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 2bcb75f4b4f..d19ebd5560d 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -33,6 +33,7 @@
#include "Group.h"
#include "Guild.h"
#include "GuildMgr.h"
+#include "Map.h"
#include "Metric.h"
#include "MiscPackets.h"
#include "ObjectMgr.h"
diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp
index 5d5ea4396fb..161864ef706 100644
--- a/src/server/game/Skills/SkillExtraItems.cpp
+++ b/src/server/game/Skills/SkillExtraItems.cpp
@@ -19,9 +19,9 @@
#include "SkillExtraItems.h"
#include "DatabaseEnv.h"
#include "Log.h"
-#include "Player.h"
#include "ObjectMgr.h"
-#include <map>
+#include "Player.h"
+#include "SpellMgr.h"
// some type definitions
// no use putting them in the header file, they're only used in this .cpp
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index a9550666167..57b381f90aa 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -22,11 +22,13 @@
#include "Battleground.h"
#include "CellImpl.h"
#include "Common.h"
-#include "GridNotifiers.h"
+#include "DB2Stores.h"
#include "GridNotifiersImpl.h"
+#include "Item.h"
#include "Log.h"
#include "LootMgr.h"
#include "MiscPackets.h"
+#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
@@ -44,6 +46,8 @@
#include "Weather.h"
#include "WeatherMgr.h"
#include "WorldPacket.h"
+#include "WorldSession.h"
+#include <G3D/g3dmath.h>
class Aura;
//
@@ -6341,7 +6345,7 @@ void AuraEffect::HandleAuraForceWeather(AuraApplication const* aurApp, uint8 mod
if (apply)
{
WorldPackets::Misc::Weather weather(WeatherState(GetMiscValue()), 1.0f);
- target->GetSession()->SendPacket(weather.Write());
+ target->SendDirectMessage(weather.Write());
}
else
{
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 91ac7806010..f5a6a0bf6e6 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -17,27 +17,26 @@
*/
#include "Common.h"
-#include "WorldPacket.h"
-#include "Opcodes.h"
+#include "CellImpl.h"
+#include "Config.h"
+#include "DB2Stores.h"
+#include "DynamicObject.h"
+#include "GridNotifiersImpl.h"
+#include "Item.h"
#include "Log.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
-#include "SpellMgr.h"
#include "Player.h"
-#include "Unit.h"
+#include "ScriptMgr.h"
#include "Spell.h"
#include "SpellAuraEffects.h"
#include "SpellHistory.h"
+#include "SpellMgr.h"
#include "SpellPackets.h"
-#include "DynamicObject.h"
-#include "ObjectAccessor.h"
-#include "Util.h"
-#include "GridNotifiers.h"
-#include "GridNotifiersImpl.h"
-#include "CellImpl.h"
-#include "ScriptMgr.h"
#include "SpellScript.h"
+#include "Unit.h"
+#include "Util.h"
#include "Vehicle.h"
-#include "Config.h"
#include "World.h"
AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura* aura, uint32 effMask):
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 867753ecfb6..8686c53b156 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -16,47 +16,44 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "Spell.h"
+#include "Battlefield.h"
+#include "BattlefieldMgr.h"
+#include "Battleground.h"
+#include "CellImpl.h"
+#include "CombatLogPackets.h"
#include "Common.h"
+#include "ConditionMgr.h"
+#include "DB2Stores.h"
#include "DatabaseEnv.h"
-#include "WorldPacket.h"
-#include "WorldSession.h"
-#include "GridNotifiers.h"
+#include "DisableMgr.h"
+#include "DynamicObject.h"
#include "GridNotifiersImpl.h"
-#include "Opcodes.h"
+#include "Guild.h"
+#include "InstanceScript.h"
+#include "Item.h"
#include "Log.h"
-#include "World.h"
+#include "LootMgr.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
-#include "SpellMgr.h"
-#include "Player.h"
+#include "PathGenerator.h"
#include "Pet.h"
-#include "Unit.h"
-#include "Spell.h"
-#include "DynamicObject.h"
-#include "Guild.h"
-#include "UpdateData.h"
-#include "ObjectAccessor.h"
-#include "CellImpl.h"
+#include "Player.h"
+#include "ScriptMgr.h"
#include "SharedDefines.h"
-#include "LootMgr.h"
-#include "VMapFactory.h"
-#include "Battleground.h"
-#include "Util.h"
-#include "TemporarySummon.h"
-#include "Vehicle.h"
#include "SpellAuraEffects.h"
-#include "ScriptMgr.h"
-#include "ConditionMgr.h"
-#include "DisableMgr.h"
-#include "SpellScript.h"
-#include "InstanceScript.h"
+#include "SpellHistory.h"
#include "SpellInfo.h"
-#include "DB2Stores.h"
-#include "Battlefield.h"
-#include "BattlefieldMgr.h"
+#include "SpellMgr.h"
#include "SpellPackets.h"
-#include "CombatLogPackets.h"
-#include "SpellHistory.h"
+#include "SpellScript.h"
+#include "TemporarySummon.h"
#include "TradeData.h"
+#include "Util.h"
+#include "VMapFactory.h"
+#include "Vehicle.h"
+#include "World.h"
+#include "WorldSession.h"
extern pEffect SpellEffects[TOTAL_SPELL_EFFECTS];
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 25cf8d8d897..fc9244a4581 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -28,6 +28,7 @@
#include "Creature.h"
#include "CreatureAI.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
#include "DuelPackets.h"
#include "DynamicObject.h"
#include "GameObject.h"
@@ -37,10 +38,13 @@
#include "Group.h"
#include "Guild.h"
#include "InstanceScript.h"
+#include "Item.h"
#include "Language.h"
#include "Log.h"
#include "LootMgr.h"
+#include "Map.h"
#include "MiscPackets.h"
+#include "MotionMaster.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "OutdoorPvPMgr.h"
@@ -64,7 +68,7 @@
#include "Util.h"
#include "World.h"
#include "WorldPacket.h"
-#include <G3D/Quat.h>
+#include "WorldSession.h"
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
{
@@ -3158,8 +3162,8 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
Map* map = target->GetMap();
- G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(target->GetOrientation(), 0.f, 0.f);
- if (!pGameObj->Create(gameobject_id, map, m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), QuaternionData(rot.x, rot.y, rot.z, rot.w), 255, GO_STATE_READY))
+ QuaternionData rot = QuaternionData::fromEulerAnglesZYX(target->GetOrientation(), 0.f, 0.f);
+ if (!pGameObj->Create(gameobject_id, map, m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), rot, 255, GO_STATE_READY))
{
delete pGameObj;
return;
@@ -3185,7 +3189,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
{
GameObject* linkedGO = new GameObject();
- if (linkedGO->Create(linkedEntry, map, m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), QuaternionData(rot.x, rot.y, rot.z, rot.w), 255, GO_STATE_READY))
+ if (linkedGO->Create(linkedEntry, map, m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), rot, 255, GO_STATE_READY))
{
linkedGO->CopyPhaseFrom(m_caster);
@@ -3734,8 +3738,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
};
Map* map = m_caster->GetMap();
- G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(pos.GetOrientation(), 0.f, 0.f);
- if (!pGameObj->Create(gameobject_id, map, m_caster->GetPhaseMask(), pos, QuaternionData(rot.x, rot.y, rot.z, rot.w), 0, GO_STATE_READY))
+ if (!pGameObj->Create(gameobject_id, map, m_caster->GetPhaseMask(), pos, QuaternionData::fromEulerAnglesZYX(pos.GetOrientation(), 0.f, 0.f), 0, GO_STATE_READY))
{
delete pGameObj;
return;
@@ -3762,8 +3765,8 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
packet.RequestedByWowAccount = caster->GetSession()->GetAccountGUID();
WorldPacket const* worldPacket = packet.Write();
- caster->GetSession()->SendPacket(worldPacket);
- target->GetSession()->SendPacket(worldPacket);
+ caster->SendDirectMessage(worldPacket);
+ target->SendDirectMessage(worldPacket);
// create duel-info
DuelInfo* duel = new DuelInfo;
@@ -4070,8 +4073,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
Map* map = m_caster->GetMap();
- G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(m_caster->GetOrientation(), 0.f, 0.f);
- if (!go->Create(go_id, map, m_caster->GetPhaseMask(), Position(x, y, z, m_caster->GetOrientation()), QuaternionData(rot.x, rot.y, rot.z, rot.w), 255, GO_STATE_READY))
+ if (!go->Create(go_id, map, m_caster->GetPhaseMask(), Position(x, y, z, m_caster->GetOrientation()), QuaternionData::fromEulerAnglesZYX(m_caster->GetOrientation(), 0.f, 0.f), 255, GO_STATE_READY))
{
delete go;
return;
@@ -4754,8 +4756,8 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
GameObject* pGameObj = new GameObject();
Position pos = { fx, fy, fz, m_caster->GetOrientation() };
- G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(m_caster->GetOrientation(), 0.f, 0.f);
- if (!pGameObj->Create(name_id, cMap, m_caster->GetPhaseMask(), pos, QuaternionData(rot.x, rot.y, rot.z, rot.w), 255, GO_STATE_READY))
+ QuaternionData rot = QuaternionData::fromEulerAnglesZYX(m_caster->GetOrientation(), 0.f, 0.f);
+ if (!pGameObj->Create(name_id, cMap, m_caster->GetPhaseMask(), pos, rot, 255, GO_STATE_READY))
{
delete pGameObj;
return;
@@ -4822,7 +4824,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
if (uint32 linkedEntry = pGameObj->GetGOInfo()->GetLinkedGameObjectEntry())
{
GameObject* linkedGO = new GameObject;
- if (linkedGO->Create(linkedEntry, cMap, m_caster->GetPhaseMask(), pos, QuaternionData(rot.x, rot.y, rot.z, rot.w), 255, GO_STATE_READY))
+ if (linkedGO->Create(linkedEntry, cMap, m_caster->GetPhaseMask(), pos, rot, 255, GO_STATE_READY))
{
linkedGO->CopyPhaseFrom(m_caster);
@@ -5346,7 +5348,7 @@ void Spell::EffectPlayMusic(SpellEffIndex /*effIndex*/)
return;
}
- unitTarget->ToPlayer()->GetSession()->SendPacket(WorldPackets::Misc::PlayMusic(soundid).Write());
+ unitTarget->ToPlayer()->SendDirectMessage(WorldPackets::Misc::PlayMusic(soundid).Write());
}
void Spell::EffectActivateSpec(SpellEffIndex /*effIndex*/)
diff --git a/src/server/game/Spells/SpellHistory.cpp b/src/server/game/Spells/SpellHistory.cpp
index e614709b10c..f85b1f10e3e 100644
--- a/src/server/game/Spells/SpellHistory.cpp
+++ b/src/server/game/Spells/SpellHistory.cpp
@@ -17,12 +17,15 @@
#include "SpellHistory.h"
#include "DatabaseEnv.h"
+#include "DB2Stores.h"
+#include "Item.h"
#include "ObjectMgr.h"
#include "Pet.h"
#include "PetPackets.h"
#include "Player.h"
#include "Spell.h"
#include "SpellInfo.h"
+#include "SpellMgr.h"
#include "SpellPackets.h"
#include "World.h"
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 8ea71d76484..f5619c5041f 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -19,9 +19,12 @@
#include "Battleground.h"
#include "ConditionMgr.h"
#include "Corpse.h"
+#include "DB2Stores.h"
#include "GameTables.h"
#include "InstanceScript.h"
+#include "ItemTemplate.h"
#include "Log.h"
+#include "Map.h"
#include "ObjectAccessor.h"
#include "Pet.h"
#include "Player.h"
@@ -30,6 +33,7 @@
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
#include "Vehicle.h"
+#include <G3D/g3dmath.h>
uint32 GetTargetFlagMask(SpellTargetObjectTypes objType)
{
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index a739e974563..f59fba52187 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -21,8 +21,10 @@
#include "BattlefieldWG.h"
#include "BattlegroundMgr.h"
#include "Chat.h"
+#include "DB2Stores.h"
#include "DatabaseEnv.h"
#include "Log.h"
+#include "MotionMaster.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "SharedDefines.h"
diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp
index ad02e6618fc..32e0bea3cc3 100644
--- a/src/server/game/Texts/CreatureTextMgr.cpp
+++ b/src/server/game/Texts/CreatureTextMgr.cpp
@@ -16,17 +16,18 @@
*/
#include "CreatureTextMgr.h"
-#include "Cell.h"
+#include "CreatureTextMgrImpl.h"
#include "CellImpl.h"
#include "Chat.h"
#include "ChatPackets.h"
#include "Common.h"
#include "DatabaseEnv.h"
-#include "GridNotifiers.h"
+#include "DB2Stores.h"
#include "GridNotifiersImpl.h"
#include "Log.h"
#include "MiscPackets.h"
#include "ObjectMgr.h"
+#include "World.h"
class CreatureTextBuilder
{
@@ -225,7 +226,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject
}
CreatureTextGroup const& textGroupContainer = itr->second; //has all texts in the group
- CreatureTextRepeatIds repeatGroup = GetRepeatGroup(source, textGroup);//has all textIDs from the group that were already said
+ CreatureTextRepeatIds repeatGroup = source->GetTextRepeatGroup(textGroup);//has all textIDs from the group that were already said
CreatureTextGroup tempGroup;//will use this to talk after sorting repeatGroup
for (CreatureTextGroup::const_iterator giter = textGroupContainer.begin(); giter != textGroupContainer.end(); ++giter)
@@ -276,7 +277,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject
SendChatPacket(finalSource, builder, finalType, whisperTarget, range, team, gmOnly);
}
- SetRepeatId(source, textGroup, iter->id);
+ source->SetTextRepeatId(textGroup, iter->id);
return iter->duration;
}
@@ -348,7 +349,7 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket const*
Map::PlayerList const& players = source->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if (itr->GetSource()->GetAreaId() == areaId && (!team || Team(itr->GetSource()->GetTeam()) == team) && (!gmOnly || itr->GetSource()->IsGameMaster()))
- itr->GetSource()->GetSession()->SendPacket(data);
+ itr->GetSource()->SendDirectMessage(data);
return;
}
case TEXT_RANGE_ZONE:
@@ -357,7 +358,7 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket const*
Map::PlayerList const& players = source->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if (itr->GetSource()->GetZoneId() == zoneId && (!team || Team(itr->GetSource()->GetTeam()) == team) && (!gmOnly || itr->GetSource()->IsGameMaster()))
- itr->GetSource()->GetSession()->SendPacket(data);
+ itr->GetSource()->SendDirectMessage(data);
return;
}
case TEXT_RANGE_MAP:
@@ -365,7 +366,7 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket const*
Map::PlayerList const& players = source->GetMap()->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if ((!team || Team(itr->GetSource()->GetTeam()) == team) && (!gmOnly || itr->GetSource()->IsGameMaster()))
- itr->GetSource()->GetSession()->SendPacket(data);
+ itr->GetSource()->SendDirectMessage(data);
return;
}
case TEXT_RANGE_WORLD:
@@ -373,8 +374,8 @@ void CreatureTextMgr::SendNonChatPacket(WorldObject* source, WorldPacket const*
SessionMap const& smap = sWorld->GetAllSessions();
for (SessionMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter)
if (Player* player = iter->second->GetPlayer())
- if (player->GetSession() && (!team || Team(player->GetTeam()) == team) && (!gmOnly || player->IsGameMaster()))
- player->GetSession()->SendPacket(data);
+ if ((!team || Team(player->GetTeam()) == team) && (!gmOnly || player->IsGameMaster()))
+ player->SendDirectMessage(data);
return;
}
case TEXT_RANGE_NORMAL:
@@ -394,21 +395,6 @@ void CreatureTextMgr::SendEmote(Unit* source, uint32 emote)
source->HandleEmoteCommand(emote);
}
-void CreatureTextMgr::SetRepeatId(Creature* source, uint8 textGroup, uint8 id)
-{
- if (!source)
- return;
-
- source->SetTextRepeatId(textGroup, id);
-}
-
-CreatureTextRepeatIds CreatureTextMgr::GetRepeatGroup(Creature* source, uint8 textGroup) const
-{
- ASSERT(source);//should never happen
-
- return source->GetTextRepeatGroup(textGroup);
-}
-
bool CreatureTextMgr::TextExist(uint32 sourceEntry, uint8 textGroup) const
{
if (!sourceEntry)
diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h
index 475fda31f20..45e4d0678d5 100644
--- a/src/server/game/Texts/CreatureTextMgr.h
+++ b/src/server/game/Texts/CreatureTextMgr.h
@@ -18,14 +18,17 @@
#ifndef TRINITY_CREATURE_TEXT_MGR_H
#define TRINITY_CREATURE_TEXT_MGR_H
-#include "Creature.h"
-#include "GridNotifiers.h"
-#include "ObjectAccessor.h"
+#include "Common.h"
#include "SharedDefines.h"
-#include "Opcodes.h"
-#include "Group.h"
-#include "Packets/ChatPackets.h"
-#include "World.h"
+#include <map>
+#include <unordered_map>
+#include <vector>
+
+class Creature;
+class Player;
+class Unit;
+class WorldObject;
+class WorldPacket;
enum CreatureTextRange
{
@@ -63,7 +66,7 @@ struct CreatureTextId
bool operator<(CreatureTextId const& right) const
{
- return memcmp(this, &right, sizeof(CreatureTextId)) < 0;
+ return std::tie(entry, textGroup, textId) < std::tie(right.entry, right.textGroup, right.textId);
}
uint32 entry;
@@ -98,12 +101,10 @@ class TC_GAME_API CreatureTextMgr
bool TextExist(uint32 sourceEntry, uint8 textGroup) const;
std::string GetLocalizedChatString(uint32 entry, uint8 gender, uint8 textGroup, uint32 id, LocaleConstant locale) const;
- template<class Builder> static void SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, WorldObject const* whisperTarget = nullptr, CreatureTextRange range = TEXT_RANGE_NORMAL, Team team = TEAM_OTHER, bool gmOnly = false);
+ template<class Builder>
+ static void SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, WorldObject const* whisperTarget = nullptr, CreatureTextRange range = TEXT_RANGE_NORMAL, Team team = TEAM_OTHER, bool gmOnly = false);
private:
- CreatureTextRepeatIds GetRepeatGroup(Creature* source, uint8 textGroup) const;
- void SetRepeatId(Creature* source, uint8 textGroup, uint8 id);
-
static void SendNonChatPacket(WorldObject* source, WorldPacket const* data, ChatMsg msgType, WorldObject const* whisperTarget, CreatureTextRange range, Team team, bool gmOnly);
static float GetRangeForChatType(ChatMsg msgType);
@@ -113,141 +114,4 @@ class TC_GAME_API CreatureTextMgr
#define sCreatureTextMgr CreatureTextMgr::instance()
-template<class Builder>
-class CreatureTextLocalizer
-{
- public:
- CreatureTextLocalizer(Builder const& builder, ChatMsg msgType) : _builder(builder), _msgType(msgType)
- {
- _packetCache.resize(TOTAL_LOCALES, NULL);
- }
-
- ~CreatureTextLocalizer()
- {
- for (size_t i = 0; i < _packetCache.size(); ++i)
- delete _packetCache[i];
- }
-
- void operator()(Player const* player) const
- {
- LocaleConstant loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
- WorldPackets::Chat::Chat* messageTemplate;
-
- // create if not cached yet
- if (!_packetCache[loc_idx])
- {
- messageTemplate = static_cast<WorldPackets::Chat::Chat*>(_builder(loc_idx));
- messageTemplate->Write();
- _packetCache[loc_idx] = messageTemplate;
- }
- else
- messageTemplate = _packetCache[loc_idx];
-
- switch (_msgType)
- {
- case CHAT_MSG_MONSTER_WHISPER:
- case CHAT_MSG_RAID_BOSS_WHISPER:
- {
- WorldPackets::Chat::Chat message(*messageTemplate);
- message.SetReceiver(player, loc_idx);
- player->SendDirectMessage(message.Write());
- return;
- }
- default:
- break;
- }
-
- player->SendDirectMessage(messageTemplate->GetRawPacket());
- }
-
- private:
- mutable std::vector<WorldPackets::Chat::Chat*> _packetCache;
- Builder const& _builder;
- ChatMsg _msgType;
-};
-
-template<class Builder>
-void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, WorldObject const* whisperTarget /*= nullptr*/, CreatureTextRange range /*= TEXT_RANGE_NORMAL*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/)
-{
- if (!source)
- return;
-
- CreatureTextLocalizer<Builder> localizer(builder, msgType);
-
- switch (msgType)
- {
- case CHAT_MSG_MONSTER_PARTY:
- {
- if (!whisperTarget)
- return;
-
- if (Player const* whisperPlayer = whisperTarget->ToPlayer())
- if (Group const* group = whisperPlayer->GetGroup())
- group->BroadcastWorker(localizer);
- return;
- }
- case CHAT_MSG_MONSTER_WHISPER:
- case CHAT_MSG_RAID_BOSS_WHISPER:
- {
- if (range == TEXT_RANGE_NORMAL) // ignores team and gmOnly
- {
- if (!whisperTarget || whisperTarget->GetTypeId() != TYPEID_PLAYER)
- return;
-
- localizer(const_cast<Player*>(whisperTarget->ToPlayer()));
- return;
- }
- break;
- }
- default:
- break;
- }
-
- switch (range)
- {
- case TEXT_RANGE_AREA:
- {
- uint32 areaId = source->GetAreaId();
- Map::PlayerList const& players = source->GetMap()->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- if (itr->GetSource()->GetAreaId() == areaId && (!team || Team(itr->GetSource()->GetTeam()) == team) && (!gmOnly || itr->GetSource()->IsGameMaster()))
- localizer(itr->GetSource());
- return;
- }
- case TEXT_RANGE_ZONE:
- {
- uint32 zoneId = source->GetZoneId();
- Map::PlayerList const& players = source->GetMap()->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- if (itr->GetSource()->GetZoneId() == zoneId && (!team || Team(itr->GetSource()->GetTeam()) == team) && (!gmOnly || itr->GetSource()->IsGameMaster()))
- localizer(itr->GetSource());
- return;
- }
- case TEXT_RANGE_MAP:
- {
- Map::PlayerList const& players = source->GetMap()->GetPlayers();
- for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- if ((!team || Team(itr->GetSource()->GetTeam()) == team) && (!gmOnly || itr->GetSource()->IsGameMaster()))
- localizer(itr->GetSource());
- return;
- }
- case TEXT_RANGE_WORLD:
- {
- SessionMap const& smap = sWorld->GetAllSessions();
- for (SessionMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter)
- if (Player* player = iter->second->GetPlayer())
- if ((!team || Team(player->GetTeam()) == team) && (!gmOnly || player->IsGameMaster()))
- localizer(player);
- return;
- }
- case TEXT_RANGE_NORMAL:
- default:
- break;
- }
-
- float dist = GetRangeForChatType(msgType);
- Trinity::PlayerDistWorker<CreatureTextLocalizer<Builder>> worker(source, dist, localizer);
- Cell::VisitWorldObjects(source, worker, dist);
-}
-
#endif
diff --git a/src/server/game/Texts/CreatureTextMgrImpl.h b/src/server/game/Texts/CreatureTextMgrImpl.h
new file mode 100644
index 00000000000..75b96fc8dcd
--- /dev/null
+++ b/src/server/game/Texts/CreatureTextMgrImpl.h
@@ -0,0 +1,166 @@
+/*
+ * 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 CreatureTextMgrImpl_h__
+#define CreatureTextMgrImpl_h__
+
+#include "CreatureTextMgr.h"
+#include "CellImpl.h"
+#include "ChatPackets.h"
+#include "GridNotifiers.h"
+#include "Group.h"
+#include "World.h"
+#include "WorldSession.h"
+
+template<class Builder>
+class CreatureTextLocalizer
+{
+public:
+ CreatureTextLocalizer(Builder const& builder, ChatMsg msgType) : _builder(builder), _msgType(msgType)
+ {
+ _packetCache.resize(TOTAL_LOCALES, NULL);
+ }
+
+ ~CreatureTextLocalizer()
+ {
+ for (size_t i = 0; i < _packetCache.size(); ++i)
+ delete _packetCache[i];
+ }
+
+ void operator()(Player const* player) const
+ {
+ LocaleConstant loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
+ WorldPackets::Chat::Chat* messageTemplate;
+
+ // create if not cached yet
+ if (!_packetCache[loc_idx])
+ {
+ messageTemplate = static_cast<WorldPackets::Chat::Chat*>(_builder(loc_idx));
+ messageTemplate->Write();
+ _packetCache[loc_idx] = messageTemplate;
+ }
+ else
+ messageTemplate = _packetCache[loc_idx];
+
+ switch (_msgType)
+ {
+ case CHAT_MSG_MONSTER_WHISPER:
+ case CHAT_MSG_RAID_BOSS_WHISPER:
+ {
+ WorldPackets::Chat::Chat message(*messageTemplate);
+ message.SetReceiver(player, loc_idx);
+ player->SendDirectMessage(message.Write());
+ return;
+ }
+ default:
+ break;
+ }
+
+ player->SendDirectMessage(messageTemplate->GetRawPacket());
+ }
+
+private:
+ mutable std::vector<WorldPackets::Chat::Chat*> _packetCache;
+ Builder const& _builder;
+ ChatMsg _msgType;
+};
+
+template<class Builder>
+void CreatureTextMgr::SendChatPacket(WorldObject* source, Builder const& builder, ChatMsg msgType, WorldObject const* whisperTarget /*= nullptr*/, CreatureTextRange range /*= TEXT_RANGE_NORMAL*/, Team team /*= TEAM_OTHER*/, bool gmOnly /*= false*/)
+{
+ if (!source)
+ return;
+
+ CreatureTextLocalizer<Builder> localizer(builder, msgType);
+
+ switch (msgType)
+ {
+ case CHAT_MSG_MONSTER_PARTY:
+ {
+ if (!whisperTarget)
+ return;
+
+ if (Player const* whisperPlayer = whisperTarget->ToPlayer())
+ if (Group const* group = whisperPlayer->GetGroup())
+ group->BroadcastWorker(localizer);
+ return;
+ }
+ case CHAT_MSG_MONSTER_WHISPER:
+ case CHAT_MSG_RAID_BOSS_WHISPER:
+ {
+ if (range == TEXT_RANGE_NORMAL) // ignores team and gmOnly
+ {
+ if (!whisperTarget || whisperTarget->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ localizer(const_cast<Player*>(whisperTarget->ToPlayer()));
+ return;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ switch (range)
+ {
+ case TEXT_RANGE_AREA:
+ {
+ uint32 areaId = source->GetAreaId();
+ Map::PlayerList const& players = source->GetMap()->GetPlayers();
+ for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
+ if (itr->GetSource()->GetAreaId() == areaId && (!team || Team(itr->GetSource()->GetTeam()) == team) && (!gmOnly || itr->GetSource()->IsGameMaster()))
+ localizer(itr->GetSource());
+ return;
+ }
+ case TEXT_RANGE_ZONE:
+ {
+ uint32 zoneId = source->GetZoneId();
+ Map::PlayerList const& players = source->GetMap()->GetPlayers();
+ for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
+ if (itr->GetSource()->GetZoneId() == zoneId && (!team || Team(itr->GetSource()->GetTeam()) == team) && (!gmOnly || itr->GetSource()->IsGameMaster()))
+ localizer(itr->GetSource());
+ return;
+ }
+ case TEXT_RANGE_MAP:
+ {
+ Map::PlayerList const& players = source->GetMap()->GetPlayers();
+ for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
+ if ((!team || Team(itr->GetSource()->GetTeam()) == team) && (!gmOnly || itr->GetSource()->IsGameMaster()))
+ localizer(itr->GetSource());
+ return;
+ }
+ case TEXT_RANGE_WORLD:
+ {
+ SessionMap const& smap = sWorld->GetAllSessions();
+ for (SessionMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter)
+ if (Player* player = iter->second->GetPlayer())
+ if ((!team || Team(player->GetTeam()) == team) && (!gmOnly || player->IsGameMaster()))
+ localizer(player);
+ return;
+ }
+ case TEXT_RANGE_NORMAL:
+ default:
+ break;
+ }
+
+ float dist = GetRangeForChatType(msgType);
+ Trinity::PlayerDistWorker<CreatureTextLocalizer<Builder>> worker(source, dist, localizer);
+ Cell::VisitWorldObjects(source, worker, dist);
+}
+
+#endif // CreatureTextMgrImpl_h__
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 10d81a32776..93ec94ad47e 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -65,6 +65,7 @@
#include "MiscPackets.h"
#include "MMapFactory.h"
#include "Object.h"
+#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "OutdoorPvPMgr.h"
#include "Player.h"
@@ -75,6 +76,7 @@
#include "ScriptReloadMgr.h"
#include "SkillDiscovery.h"
#include "SkillExtraItems.h"
+#include "SpellMgr.h"
#include "SmartScriptMgr.h"
#include "SupportMgr.h"
#include "TaxiPathGraph.h"