diff options
Diffstat (limited to 'src')
442 files changed, 3498 insertions, 2827 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" diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index bfb9897cbf3..5db80a148b2 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -30,6 +30,7 @@ EndScriptData */ #include "Player.h" #include "ScriptMgr.h" #include "World.h" +#include "WorldSession.h" #include <boost/asio/ip/address_v4.hpp> class account_commandscript : public CommandScript diff --git a/src/server/scripts/Commands/cs_achievement.cpp b/src/server/scripts/Commands/cs_achievement.cpp index 8a7a1003e8c..57cb037874e 100644 --- a/src/server/scripts/Commands/cs_achievement.cpp +++ b/src/server/scripts/Commands/cs_achievement.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "AchievementMgr.h" #include "Chat.h" +#include "DB2Stores.h" #include "Language.h" #include "Player.h" #include "RBAC.h" diff --git a/src/server/scripts/Commands/cs_arena.cpp b/src/server/scripts/Commands/cs_arena.cpp index 2ca02645e53..6dacd58d2c5 100644 --- a/src/server/scripts/Commands/cs_arena.cpp +++ b/src/server/scripts/Commands/cs_arena.cpp @@ -30,6 +30,7 @@ EndScriptData */ #include "ObjectMgr.h" #include "Player.h" #include "RBAC.h" +#include "WorldSession.h" class arena_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp index c81ca30355b..b108da82756 100644 --- a/src/server/scripts/Commands/cs_ban.cpp +++ b/src/server/scripts/Commands/cs_ban.cpp @@ -31,6 +31,7 @@ EndScriptData */ #include "Player.h" #include "ScriptMgr.h" #include "World.h" +#include "WorldSession.h" class ban_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_battlenet_account.cpp b/src/server/scripts/Commands/cs_battlenet_account.cpp index 6365cdc4b17..679a49a8eb8 100644 --- a/src/server/scripts/Commands/cs_battlenet_account.cpp +++ b/src/server/scripts/Commands/cs_battlenet_account.cpp @@ -25,6 +25,7 @@ #include "Player.h" #include "ScriptMgr.h" #include "Util.h" +#include "WorldSession.h" #include <boost/asio/ip/address_v4.hpp> class battlenet_account_commandscript : public CommandScript diff --git a/src/server/scripts/Commands/cs_cast.cpp b/src/server/scripts/Commands/cs_cast.cpp index 416daaa4b35..f4e37b74c14 100644 --- a/src/server/scripts/Commands/cs_cast.cpp +++ b/src/server/scripts/Commands/cs_cast.cpp @@ -28,6 +28,8 @@ EndScriptData */ #include "Language.h" #include "Player.h" #include "RBAC.h" +#include "SpellMgr.h" +#include "WorldSession.h" class cast_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index 51ee5c0b313..7d6e4725040 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -25,13 +25,16 @@ EndScriptData */ #include "AccountMgr.h" #include "Chat.h" #include "DatabaseEnv.h" +#include "DB2Stores.h" #include "Log.h" +#include "ObjectAccessor.h" #include "ObjectMgr.h" #include "PlayerDump.h" #include "Player.h" #include "ReputationMgr.h" #include "ScriptMgr.h" #include "World.h" +#include "WorldSession.h" class character_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_cheat.cpp b/src/server/scripts/Commands/cs_cheat.cpp index 4eda4cc5017..3b224dd1536 100644 --- a/src/server/scripts/Commands/cs_cheat.cpp +++ b/src/server/scripts/Commands/cs_cheat.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "Language.h" #include "Player.h" #include "RBAC.h" +#include "WorldSession.h" class cheat_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 1d93561eb85..bd9d68761b6 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -23,15 +23,14 @@ Category: commandscripts EndScriptData */ #include "ScriptMgr.h" +#include "Bag.h" #include "BattlefieldMgr.h" #include "BattlegroundMgr.h" -#include "Cell.h" #include "CellImpl.h" #include "Chat.h" #include "ChatPackets.h" #include "Conversation.h" #include "GossipDef.h" -#include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "Language.h" #include "Log.h" @@ -42,6 +41,7 @@ EndScriptData */ #include "RBAC.h" #include "SpellPackets.h" #include "Transport.h" +#include "WorldSession.h" #include <fstream> #include <limits> diff --git a/src/server/scripts/Commands/cs_disable.cpp b/src/server/scripts/Commands/cs_disable.cpp index 724778fe0ca..919bd93d5c8 100644 --- a/src/server/scripts/Commands/cs_disable.cpp +++ b/src/server/scripts/Commands/cs_disable.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "Chat.h" #include "CriteriaHandler.h" #include "DatabaseEnv.h" +#include "DB2Stores.h" #include "DisableMgr.h" #include "Language.h" #include "ObjectMgr.h" diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index a625b9d3a33..9d886515dfb 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -26,12 +26,13 @@ EndScriptData */ #include "Chat.h" #include "DatabaseEnv.h" #include "Language.h" -#include "ObjectMgr.h" +#include "ObjectAccessor.h" #include "Opcodes.h" #include "Player.h" #include "Realm.h" #include "ScriptMgr.h" #include "World.h" +#include "WorldSession.h" #include <boost/thread/shared_mutex.hpp> #include <boost/thread/locks.hpp> diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index c71a7ad2782..deadd9c25b3 100644 --- a/src/server/scripts/Commands/cs_go.cpp +++ b/src/server/scripts/Commands/cs_go.cpp @@ -27,11 +27,13 @@ EndScriptData */ #include "DatabaseEnv.h" #include "Language.h" #include "MapManager.h" +#include "MotionMaster.h" #include "ObjectMgr.h" #include "Player.h" #include "RBAC.h" #include "SupportMgr.h" #include "Transport.h" +#include "WorldSession.h" class go_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 4ece2a87e94..7c9f5b224dc 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -25,16 +25,19 @@ EndScriptData */ #include "ScriptMgr.h" #include "Chat.h" #include "DatabaseEnv.h" +#include "DB2Stores.h" #include "GameEventMgr.h" +#include "GameObject.h" #include "Language.h" #include "Log.h" #include "MapManager.h" +#include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Opcodes.h" #include "Player.h" #include "PoolMgr.h" #include "RBAC.h" -#include <G3D/Quat.h> +#include "WorldSession.h" class gobject_commandscript : public CommandScript { @@ -141,8 +144,7 @@ public: GameObject* object = new GameObject(); - G3D::Quat rot = G3D::Matrix3::fromEulerAnglesZYX(player->GetOrientation(), 0.f, 0.f); - if (!object->Create(objectInfo->entry, map, 0, *player, QuaternionData(rot.x, rot.y, rot.z, rot.w), 255, GO_STATE_READY)) + if (!object->Create(objectInfo->entry, map, 0, *player, QuaternionData::fromEulerAnglesZYX(player->GetOrientation(), 0.0f, 0.0f), 255, GO_STATE_READY)) { delete object; return false; @@ -197,7 +199,6 @@ public: if (spawntime) spawntm = atoul(spawntime); - G3D::Quat rotation = G3D::Matrix3::fromEulerAnglesZYX(player->GetOrientation(), 0.f, 0.f); uint32 objectId = atoul(id); if (!sObjectMgr->GetGameObjectTemplate(objectId)) @@ -207,7 +208,7 @@ public: return false; } - player->SummonGameObject(objectId, *player, QuaternionData(rotation.x, rotation.y, rotation.z, rotation.w), spawntm); + player->SummonGameObject(objectId, *player, QuaternionData::fromEulerAnglesZYX(player->GetOrientation(), 0.0f, 0.0f), spawntm); return true; } diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp index 311ed64cf18..ea6bd7fa3e1 100644 --- a/src/server/scripts/Commands/cs_group.cpp +++ b/src/server/scripts/Commands/cs_group.cpp @@ -18,12 +18,17 @@ #include "ScriptMgr.h" #include "Chat.h" #include "DatabaseEnv.h" +#include "DB2Stores.h" #include "GroupMgr.h" #include "Language.h" #include "LFG.h" +#include "Map.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Player.h" #include "RBAC.h" +#include "WorldSession.h" class group_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_honor.cpp b/src/server/scripts/Commands/cs_honor.cpp index 55b80c727fd..c187df7ede2 100644 --- a/src/server/scripts/Commands/cs_honor.cpp +++ b/src/server/scripts/Commands/cs_honor.cpp @@ -28,6 +28,7 @@ EndScriptData */ #include "ObjectMgr.h" #include "Player.h" #include "RBAC.h" +#include "WorldSession.h" class honor_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp index 1c584d79668..b1e9390db24 100644 --- a/src/server/scripts/Commands/cs_instance.cpp +++ b/src/server/scripts/Commands/cs_instance.cpp @@ -33,6 +33,7 @@ EndScriptData */ #include "ObjectMgr.h" #include "Player.h" #include "RBAC.h" +#include "WorldSession.h" class instance_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp index cfddaac6aa0..e1a5c2bf90e 100644 --- a/src/server/scripts/Commands/cs_learn.cpp +++ b/src/server/scripts/Commands/cs_learn.cpp @@ -24,6 +24,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "Chat.h" +#include "DB2Stores.h" #include "Language.h" #include "ObjectMgr.h" #include "Pet.h" @@ -31,6 +32,7 @@ EndScriptData */ #include "RBAC.h" #include "SpellInfo.h" #include "SpellMgr.h" +#include "WorldSession.h" class learn_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_lfg.cpp b/src/server/scripts/Commands/cs_lfg.cpp index 13670f4dad3..478be31fd6a 100644 --- a/src/server/scripts/Commands/cs_lfg.cpp +++ b/src/server/scripts/Commands/cs_lfg.cpp @@ -22,6 +22,7 @@ #include "GroupMgr.h" #include "Language.h" #include "LFGMgr.h" +#include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Player.h" #include "RBAC.h" diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp index af22e91fedd..eb58710a647 100644 --- a/src/server/scripts/Commands/cs_list.cpp +++ b/src/server/scripts/Commands/cs_list.cpp @@ -31,6 +31,7 @@ EndScriptData */ #include "Player.h" #include "RBAC.h" #include "SpellAuraEffects.h" +#include "WorldSession.h" class list_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 19fa8fde081..dc07c0b9f49 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -22,17 +22,20 @@ Comment: All lookup related commands Category: commandscripts EndScriptData */ +#include "ScriptMgr.h" #include "AccountMgr.h" #include "Chat.h" #include "DatabaseEnv.h" +#include "DB2Stores.h" #include "GameEventMgr.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Player.h" #include "ReputationMgr.h" -#include "ScriptMgr.h" #include "SpellInfo.h" +#include "SpellMgr.h" #include "World.h" +#include "WorldSession.h" class lookup_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_message.cpp b/src/server/scripts/Commands/cs_message.cpp index edddedd6e98..be699bae3a4 100644 --- a/src/server/scripts/Commands/cs_message.cpp +++ b/src/server/scripts/Commands/cs_message.cpp @@ -28,11 +28,14 @@ EndScriptData */ #include "Channel.h" #include "ChannelMgr.h" #include "DatabaseEnv.h" +#include "DB2Stores.h" #include "Language.h" +#include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Player.h" #include "RBAC.h" #include "World.h" +#include "WorldSession.h" class message_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 7a7d2cd2951..87d521f67f8 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -26,6 +26,7 @@ #include "Group.h" #include "GroupMgr.h" #include "InstanceSaveMgr.h" +#include "Item.h" #include "Language.h" #include "LFG.h" #include "Log.h" @@ -42,11 +43,13 @@ #include "ScriptMgr.h" #include "SpellAuras.h" #include "SpellHistory.h" +#include "SpellMgr.h" #include "TargetedMovementGenerator.h" #include "Transport.h" #include "Weather.h" #include "WeatherMgr.h" #include "World.h" +#include "WorldSession.h" #include <boost/asio/ip/address_v4.hpp> // temporary hack until database includes are sorted out (don't want to pull in Windows.h everywhere from mysql.h) diff --git a/src/server/scripts/Commands/cs_mmaps.cpp b/src/server/scripts/Commands/cs_mmaps.cpp index 3e8081eb835..9ec68a42919 100644 --- a/src/server/scripts/Commands/cs_mmaps.cpp +++ b/src/server/scripts/Commands/cs_mmaps.cpp @@ -30,12 +30,12 @@ #include "GridNotifiersImpl.h" #include "Map.h" #include "MMapFactory.h" -#include "ObjectMgr.h" #include "PathGenerator.h" #include "Player.h" #include "PointMovementGenerator.h" #include "RBAC.h" #include "TargetedMovementGenerator.h" +#include "WorldSession.h" class mmaps_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index a430f901bb3..e8d9d20f9a6 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -24,13 +24,16 @@ EndScriptData */ #include "ScriptMgr.h" #include "Chat.h" +#include "DB2Stores.h" #include "Log.h" #include "ObjectMgr.h" #include "Pet.h" #include "Player.h" #include "RBAC.h" #include "ReputationMgr.h" +#include "SpellMgr.h" #include "SpellPackets.h" +#include "WorldSession.h" class modify_commandscript : public CommandScript { @@ -322,7 +325,7 @@ public: modData.ModifierValue = float(val); spellMod.ModifierData.push_back(modData); packet.Modifiers.push_back(spellMod); - target->GetSession()->SendPacket(packet.Write()); + target->SendDirectMessage(packet.Write()); return true; } diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 4ad73cb4121..a5238df6651 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -29,6 +29,8 @@ EndScriptData */ #include "DatabaseEnv.h" #include "Language.h" #include "Log.h" +#include "Map.h" +#include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Pet.h" #include "Player.h" @@ -36,6 +38,7 @@ EndScriptData */ #include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand #include "Transport.h" #include "World.h" +#include "WorldSession.h" template<typename E, typename T = char const*> struct EnumName diff --git a/src/server/scripts/Commands/cs_pet.cpp b/src/server/scripts/Commands/cs_pet.cpp index 61843fbb00c..b0b6de3d44e 100644 --- a/src/server/scripts/Commands/cs_pet.cpp +++ b/src/server/scripts/Commands/cs_pet.cpp @@ -19,10 +19,13 @@ #include "Chat.h" #include "Language.h" #include "Log.h" +#include "Map.h" #include "Pet.h" #include "ObjectMgr.h" #include "Player.h" #include "RBAC.h" +#include "SpellMgr.h" +#include "WorldSession.h" static inline Pet* GetSelectedPlayerPetOrOwn(ChatHandler* handler) { diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index 483585f8b57..8b7e5e1bf93 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "Chat.h" #include "DatabaseEnv.h" +#include "DB2Stores.h" #include "ObjectMgr.h" #include "Player.h" #include "RBAC.h" diff --git a/src/server/scripts/Commands/cs_rbac.cpp b/src/server/scripts/Commands/cs_rbac.cpp index a07bc32fd38..a94c4cfddb6 100644 --- a/src/server/scripts/Commands/cs_rbac.cpp +++ b/src/server/scripts/Commands/cs_rbac.cpp @@ -30,6 +30,7 @@ EndScriptData */ #include "Realm.h" #include "ScriptMgr.h" #include "World.h" +#include "WorldSession.h" struct RBACCommandData { diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 5c467c9e021..7ebb01c8581 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -33,6 +33,7 @@ EndScriptData */ #include "CreatureTextMgr.h" #include "DatabaseEnv.h" #include "DisableMgr.h" +#include "ItemEnchantmentMgr.h" #include "Language.h" #include "LFGMgr.h" #include "Log.h" @@ -47,6 +48,7 @@ EndScriptData */ #include "SupportMgr.h" #include "WardenCheckMgr.h" #include "WaypointManager.h" +#include "World.h" class reload_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp index c2026b53fac..e10068f9861 100644 --- a/src/server/scripts/Commands/cs_reset.cpp +++ b/src/server/scripts/Commands/cs_reset.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "AchievementMgr.h" #include "Chat.h" #include "DatabaseEnv.h" +#include "DB2Stores.h" #include "Language.h" #include "Log.h" #include "ObjectAccessor.h" @@ -33,6 +34,7 @@ EndScriptData */ #include "Player.h" #include "RBAC.h" #include "World.h" +#include "WorldSession.h" #include <boost/thread/shared_mutex.hpp> #include <boost/thread/locks.hpp> diff --git a/src/server/scripts/Commands/cs_scene.cpp b/src/server/scripts/Commands/cs_scene.cpp index b37b09a16b3..69d754c1fac 100644 --- a/src/server/scripts/Commands/cs_scene.cpp +++ b/src/server/scripts/Commands/cs_scene.cpp @@ -17,10 +17,12 @@ #include "ScriptMgr.h" #include "Chat.h" +#include "DB2Stores.h" #include "Language.h" #include "ObjectMgr.h" #include "Player.h" #include "RBAC.h" +#include "WorldSession.h" class scene_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_send.cpp b/src/server/scripts/Commands/cs_send.cpp index 37777da1af0..39d937dd003 100644 --- a/src/server/scripts/Commands/cs_send.cpp +++ b/src/server/scripts/Commands/cs_send.cpp @@ -18,11 +18,14 @@ #include "ScriptMgr.h" #include "Chat.h" #include "DatabaseEnv.h" +#include "Item.h" #include "Language.h" +#include "Mail.h" #include "ObjectMgr.h" #include "Pet.h" #include "Player.h" #include "RBAC.h" +#include "WorldSession.h" class send_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp index 7f108bb2994..44cee846df2 100644 --- a/src/server/scripts/Commands/cs_server.cpp +++ b/src/server/scripts/Commands/cs_server.cpp @@ -33,6 +33,7 @@ EndScriptData */ #include "RBAC.h" #include "Util.h" #include "World.h" +#include "WorldSession.h" class server_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index 4dcb8ed1d97..ea9e03e9206 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -25,12 +25,15 @@ EndScriptData */ #include "ScriptMgr.h" #include "Chat.h" #include "DatabaseEnv.h" +#include "DB2Stores.h" #include "Group.h" #include "Language.h" #include "MapManager.h" +#include "MotionMaster.h" #include "ObjectMgr.h" #include "Player.h" #include "RBAC.h" +#include "WorldSession.h" class tele_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp index 1f305b8983f..5f794c59335 100644 --- a/src/server/scripts/Commands/cs_ticket.cpp +++ b/src/server/scripts/Commands/cs_ticket.cpp @@ -33,6 +33,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "SupportMgr.h" #include "World.h" +#include "WorldSession.h" class ticket_commandscript : public CommandScript { diff --git a/src/server/scripts/Commands/cs_titles.cpp b/src/server/scripts/Commands/cs_titles.cpp index bb7f27d4ad9..7f412569393 100644 --- a/src/server/scripts/Commands/cs_titles.cpp +++ b/src/server/scripts/Commands/cs_titles.cpp @@ -24,6 +24,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "Chat.h" +#include "DB2Stores.h" #include "Language.h" #include "ObjectMgr.h" #include "Player.h" diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index ab62af74479..e64713b32b1 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -24,12 +24,16 @@ EndScriptData */ #include "ScriptMgr.h" #include "Chat.h" +#include "Creature.h" #include "DatabaseEnv.h" #include "Language.h" +#include "Map.h" +#include "MotionMaster.h" #include "ObjectMgr.h" #include "Player.h" #include "RBAC.h" #include "WaypointManager.h" +#include "WorldSession.h" class wp_commandscript : public CommandScript { diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp index b7226214694..75ec6633bee 100644 --- a/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp +++ b/src/server/scripts/EasternKingdoms/BaradinHold/boss_alizabal.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "baradin_hold.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/boss_pit_lord_argaloth.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/boss_pit_lord_argaloth.cpp index 899e1417369..bd1a4429a41 100644 --- a/src/server/scripts/EasternKingdoms/BaradinHold/boss_pit_lord_argaloth.cpp +++ b/src/server/scripts/EasternKingdoms/BaradinHold/boss_pit_lord_argaloth.cpp @@ -62,7 +62,6 @@ class boss_pit_lord_argaloth : public CreatureScript void EnterEvadeMode(EvadeReason /*why*/) override { - me->GetMotionMaster()->MoveTargetedHome(); instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); _DespawnAtEvade(); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp index 965908e99d0..4851da13d03 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp @@ -552,7 +552,7 @@ public: void DoGo(uint32 id, uint32 state) { - if (GameObject* go = instance->instance->GetGameObject(instance->GetGuidData(id))) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(id))) go->SetGoState((GOState)state); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp index 76f2fd1639c..f8e72d3b708 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/instance_blackrock_depths.cpp @@ -22,6 +22,7 @@ #include "InstanceScript.h" #include "Log.h" #include "Map.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" #define TIMER_TOMBOFTHESEVEN 15000 diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gizrul_the_slavener.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gizrul_the_slavener.cpp index 12f81a0d557..a62da8ea9ed 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gizrul_the_slavener.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gizrul_the_slavener.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "blackrock_spire.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" #include "TemporarySummon.h" diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp index d3d86ad629f..4a469a3b716 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_gyth.cpp @@ -19,6 +19,7 @@ #include "blackrock_spire.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" enum Spells diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp index a9292b05c92..b13523d0e78 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -17,8 +17,10 @@ #include "ScriptMgr.h" #include "blackrock_spire.h" +#include "GameObject.h" #include "InstanceScript.h" -#include "ObjectMgr.h" +#include "Map.h" +#include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" #include "SpellInfo.h" @@ -105,10 +107,10 @@ public: break; case 2: // Close these two doors on Blackhand Incarcerators aggro - if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_IN))) + if (GameObject* door1 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_IN))) if (door1->GetGoState() == GO_STATE_ACTIVE) door1->SetGoState(GO_STATE_READY); - if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_DOORS))) + if (GameObject* door2 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_DOORS))) if (door2->GetGoState() == GO_STATE_ACTIVE) door2->SetGoState(GO_STATE_READY); break; @@ -167,33 +169,33 @@ public: void OpenDoors(bool Boss_Killed) { // These two doors reopen on reset or boss kill - if (GameObject* door1 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_IN))) + if (GameObject* door1 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_IN))) door1->SetGoState(GO_STATE_ACTIVE); - if (GameObject* door2 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_DOORS))) + if (GameObject* door2 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_DOORS))) door2->SetGoState(GO_STATE_ACTIVE); // This door opens on boss kill if (Boss_Killed) - if (GameObject* door3 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_OUT))) + if (GameObject* door3 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_OUT))) door3->SetGoState(GO_STATE_ACTIVE); } void UpdateRunes(GOState state) { // update all runes - if (GameObject* rune1 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_1))) + if (GameObject* rune1 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_RUNE_1))) rune1->SetGoState(state); - if (GameObject* rune2 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_2))) + if (GameObject* rune2 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_RUNE_2))) rune2->SetGoState(state); - if (GameObject* rune3 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_3))) + if (GameObject* rune3 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_RUNE_3))) rune3->SetGoState(state); - if (GameObject* rune4 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_4))) + if (GameObject* rune4 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_RUNE_4))) rune4->SetGoState(state); - if (GameObject* rune5 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_5))) + if (GameObject* rune5 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_RUNE_5))) rune5->SetGoState(state); - if (GameObject* rune6 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_6))) + if (GameObject* rune6 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_RUNE_6))) rune6->SetGoState(state); - if (GameObject* rune7 = me->GetMap()->GetGameObject(instance->GetGuidData(GO_EMBERSEER_RUNE_7))) + if (GameObject* rune7 = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_EMBERSEER_RUNE_7))) rune7->SetGoState(state); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp index bdf11bc06b4..1f5bd2a4cd0 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_rend_blackhand.cpp @@ -19,6 +19,7 @@ #include "ScriptMgr.h" #include "blackrock_spire.h" #include "GameObject.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" @@ -374,37 +375,37 @@ public: me->SummonCreature(NPC_GYTH, 211.762f, -397.5885f, 111.1817f, 4.747295f); break; case EVENT_WAVE_1: - if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID)) + if (GameObject* portcullis = ObjectAccessor::GetGameObject(*me, portcullisGUID)) portcullis->UseDoorOrButton(); // move wave break; case EVENT_WAVE_2: // spawn wave - if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID)) + if (GameObject* portcullis = ObjectAccessor::GetGameObject(*me, portcullisGUID)) portcullis->UseDoorOrButton(); // move wave break; case EVENT_WAVE_3: // spawn wave - if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID)) + if (GameObject* portcullis = ObjectAccessor::GetGameObject(*me, portcullisGUID)) portcullis->UseDoorOrButton(); // move wave break; case EVENT_WAVE_4: // spawn wave - if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID)) + if (GameObject* portcullis = ObjectAccessor::GetGameObject(*me, portcullisGUID)) portcullis->UseDoorOrButton(); // move wave break; case EVENT_WAVE_5: // spawn wave - if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID)) + if (GameObject* portcullis = ObjectAccessor::GetGameObject(*me, portcullisGUID)) portcullis->UseDoorOrButton(); // move wave break; case EVENT_WAVE_6: // spawn wave - if (GameObject* portcullis = me->GetMap()->GetGameObject(portcullisGUID)) + if (GameObject* portcullis = ObjectAccessor::GetGameObject(*me, portcullisGUID)) portcullis->UseDoorOrButton(); // move wave break; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp index 2b9bf7b3db5..910d4901fbf 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_chromaggus.cpp @@ -17,9 +17,10 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "Player.h" #include "blackwing_lair.h" +#include "Map.h" +#include "Player.h" +#include "ScriptedCreature.h" enum Emotes { diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp index 12a4f888c0b..c4b1d78c5ac 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/boss_nefarian.cpp @@ -20,6 +20,7 @@ #include "blackwing_lair.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "Player.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp index c0ef0dd23e4..be9920c0afc 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp @@ -19,6 +19,8 @@ #include "blackwing_lair.h" #include "GameObject.h" #include "InstanceScript.h" +#include "Map.h" +#include "MotionMaster.h" #include "Player.h" #include "ScriptedCreature.h" #include "TemporarySummon.h" diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp index c6db56b07b0..92118e5e1fe 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "Map.h" #include "molten_core.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp index 1dd2ca3e1d9..e555e2970f7 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "deadmines.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp index be1aee0a75c..9ac936e6fa6 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp @@ -28,6 +28,7 @@ EndScriptData */ #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "TemporarySummon.h" enum Sounds diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp index 24fba345b11..f8f921ee8d0 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp @@ -26,6 +26,7 @@ Script Data End */ #include "GameObject.h" #include "gnomeregan.h" #include "InstanceScript.h" +#include "Map.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp index c5d98e6da18..1ccf1963477 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp @@ -21,7 +21,7 @@ #include "gnomeregan.h" #include "InstanceScript.h" #include "Log.h" -#include "Player.h" +#include "Map.h" #define MAX_ENCOUNTER 1 diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 02ace4c82ec..7fe3909655e 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "karazhan.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellInfo.h" diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp index 6f246bc071a..36777a5670c 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_netherspite.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "GameObject.h" #include "InstanceScript.h" #include "karazhan.h" +#include "Map.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index 78b2949d390..5c759927a9a 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" #include "karazhan.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" enum Spells diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index 8daedae224d..6c872e8acd9 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -26,7 +26,10 @@ EndScriptData */ #include "ScriptMgr.h" #include "GameObject.h" #include "InstanceScript.h" +#include "Item.h" #include "karazhan.h" +#include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index 43d60feeff8..e9dbd619d9c 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "InstanceScript.h" #include "karazhan.h" #include "Log.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index 12e20b93e44..a5513e79584 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -32,6 +32,8 @@ EndContentData */ #include "InstanceScript.h" #include "karazhan.h" #include "Log.h" +#include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedEscortAI.h" @@ -477,7 +479,7 @@ public: if (instance->GetGuidData(DATA_IMAGE_OF_MEDIVH).IsEmpty()) { instance->SetGuidData(DATA_IMAGE_OF_MEDIVH, me->GetGUID()); - (*me).GetMotionMaster()->MovePoint(1, MedivPos[0], MedivPos[1], MedivPos[2]); + me->GetMotionMaster()->MovePoint(1, MedivPos[0], MedivPos[1], MedivPos[2]); Step = 0; } else diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index 10e2a6f6b29..3d6a1a6213d 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "GameObject.h" #include "InstanceScript.h" #include "magisters_terrace.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "TemporarySummon.h" diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp index b6f94c74c73..a2ab42f5e3b 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "magisters_terrace.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp index 02f57cd2622..7ce7f2a9636 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_vexallus.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "magisters_terrace.h" +#include "MotionMaster.h" enum Yells { diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp index 1883f7b661b..651b8a05d9b 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp @@ -21,6 +21,7 @@ #include "InstanceScript.h" #include "magisters_terrace.h" #include "Map.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" #include "TemporarySummon.h" diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp index 9792ea0cfba..3228b3382f7 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.cpp @@ -28,11 +28,11 @@ npc_kalecgos EndContentData */ #include "ScriptMgr.h" +#include "magisters_terrace.h" +#include "MotionMaster.h" +#include "Player.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" -#include "Player.h" -#include "magisters_terrace.h" -#include "EventMap.h" /*###### ## npc_kalecgos diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 9fe6e9c7721..96c76ea6bbb 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -16,18 +16,20 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "ScriptedGossip.h" -#include "Vehicle.h" -#include "ObjectMgr.h" -#include "ScriptedEscortAI.h" #include "CombatAI.h" +#include "CreatureTextMgr.h" +#include "GameObject.h" +#include "Log.h" +#include "MotionMaster.h" +#include "MoveSplineInit.h" +#include "ObjectAccessor.h" #include "PassiveAI.h" #include "Player.h" +#include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" #include "SpellInfo.h" -#include "CreatureTextMgr.h" -#include "MoveSplineInit.h" -#include "Log.h" +#include "TemporarySummon.h" +#include "Vehicle.h" /*###### ##Quest 12848 @@ -950,15 +952,10 @@ public: std::list<TempSummon*> MinionList; owner->GetAllMinionsByEntry(MinionList, NPC_GHOULS); - if (!MinionList.empty()) - { - for (TempSummon* summon : MinionList) - { - if (summon->GetOwnerGUID() == me->GetOwnerGUID()) - if (summon->IsInCombat() && summon->getAttackerForHelper()) - AttackStart(summon->getAttackerForHelper()); - } - } + for (TempSummon* summon : MinionList) + if (summon->GetOwnerGUID() == me->GetOwnerGUID()) + if (summon->IsInCombat() && summon->getAttackerForHelper()) + AttackStart(summon->getAttackerForHelper()); } void UpdateAI(uint32 /*diff*/) override diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index b564ed1101a..91b35f91d4a 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -16,11 +16,13 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "ScriptedEscortAI.h" +#include "CreatureTextMgr.h" +#include "GameObject.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "Player.h" +#include "ScriptedEscortAI.h" #include "SpellInfo.h" -#include "CreatureTextMgr.h" //How to win friends and influence enemies // texts signed for creature 28939 but used for 28939, 28940, 28610 diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 94c8622ebee..b6011eb8eab 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -17,6 +17,8 @@ #include "ScriptMgr.h" #include "GameObject.h" +#include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp index 1ff7823aa28..483abda4ab7 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/zone_the_scarlet_enclave.cpp @@ -16,6 +16,7 @@ */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "PassiveAI.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index cf9ee7c8fae..befee5f6a69 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -29,6 +29,7 @@ EndScriptData */ #include "InstanceScript.h" #include "LFGMgr.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "scarlet_monastery.h" @@ -99,7 +100,7 @@ enum Spells SPELL_DEATH = 42566 //not correct spell }; -G3D::Vector3 const FlightPoint[]= +Position const FlightPoint[]= { {1754.00f, 1346.00f, 17.50f}, {1765.00f, 1347.00f, 19.00f}, @@ -124,7 +125,7 @@ G3D::Vector3 const FlightPoint[]= {1758.00f, 1367.00f, 19.51f} }; -G3D::Vector3 const Spawn[]= +Position const Spawn[]= { {1776.27f, 1348.74f, 19.20f}, //spawn point for pumpkin shrine mob {1765.28f, 1347.46f, 17.55f} //spawn point for smoke @@ -476,7 +477,7 @@ public: break; case 1: { - if (Creature* smoke = me->SummonCreature(HELPER, Spawn[1].x, Spawn[1].y, Spawn[1].z, 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) + if (Creature* smoke = me->SummonCreature(HELPER, Spawn[1], TEMPSUMMON_TIMED_DESPAWN, 20000)) ENSURE_AI(npc_wisp_invis::npc_wisp_invisAI, smoke->AI())->SetType(3); DoCast(me, SPELL_RHYME_BIG); break; @@ -685,7 +686,7 @@ public: { wp_reached = false; me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MovePoint(id, FlightPoint[id].x, FlightPoint[id].y, FlightPoint[id].z); + me->GetMotionMaster()->MovePoint(id, FlightPoint[id]); } } } @@ -695,7 +696,7 @@ public: break; if (burn <= diff) { - if (Creature* flame = me->SummonCreature(HELPER, Spawn[0].x, Spawn[0].y, Spawn[0].z, 0, TEMPSUMMON_TIMED_DESPAWN, 17000)) + if (Creature* flame = me->SummonCreature(HELPER, Spawn[0], TEMPSUMMON_TIMED_DESPAWN, 17000)) ENSURE_AI(npc_wisp_invis::npc_wisp_invisAI, flame->AI())->SetType(2); burned = true; } @@ -899,7 +900,7 @@ public: return false; player->AreaExploredOrEventHappens(11405); - if (Creature* horseman = go->SummonCreature(HH_MOUNTED, FlightPoint[20].x, FlightPoint[20].y, FlightPoint[20].z, 0, TEMPSUMMON_MANUAL_DESPAWN, 0)) + if (Creature* horseman = go->SummonCreature(HH_MOUNTED, FlightPoint[20], TEMPSUMMON_MANUAL_DESPAWN, 0)) { ENSURE_AI(boss_headless_horseman::boss_headless_horsemanAI, horseman->AI())->PlayerGUID = player->GetGUID(); ENSURE_AI(boss_headless_horseman::boss_headless_horsemanAI, horseman->AI())->FlyMode(); diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp index 42f2514da79..17f37c2cf41 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_mograine_and_whitemane.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "scarlet_monastery.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp index 7c280dc8a3b..f1e86bfb4c6 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp @@ -25,6 +25,7 @@ Category: Scholomance #include "ScriptMgr.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "scholomance.h" diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp index 8cfcd4583f7..09417fb3704 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_kirtonos_the_herald.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "MoveSplineInit.h" #include "ObjectAccessor.h" #include "Player.h" @@ -162,13 +163,13 @@ class boss_kirtonos_the_herald : public CreatureScript events.ScheduleEvent(INTRO_3, 1000); break; case INTRO_3: - if (GameObject* gate = me->GetMap()->GetGameObject(instance->GetGuidData(GO_GATE_KIRTONOS))) + if (GameObject* gate = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_GATE_KIRTONOS))) gate->SetGoState(GO_STATE_READY); me->SetFacingTo(0.01745329f); events.ScheduleEvent(INTRO_4, 3000); break; case INTRO_4: - if (GameObject* brazier = me->GetMap()->GetGameObject(instance->GetGuidData(GO_BRAZIER_OF_THE_HERALD))) + if (GameObject* brazier = ObjectAccessor::GetGameObject(*me, instance->GetGuidData(GO_BRAZIER_OF_THE_HERALD))) brazier->SetGoState(GO_STATE_READY); me->SetWalk(true); me->SetDisableGravity(false); diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp index f999f4d46c9..f6d79b5ebe4 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp @@ -34,6 +34,7 @@ EndContentData */ #include "GameObject.h" #include "Group.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index a87997a03bd..a78ca24a5d5 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "CellImpl.h" #include "GridNotifiersImpl.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "sunwell_plateau.h" diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index c54e98dd8c4..7482f2824f5 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -26,6 +26,8 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" #include "Log.h" +#include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 30e871d3ad9..ce397f1fc91 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -28,6 +28,7 @@ EndScriptData */ #include "GameObject.h" #include "InstanceScript.h" #include "Log.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp index 9d58eae4f81..6449a985c0f 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp @@ -20,6 +20,7 @@ #include "GameObject.h" #include "InstanceScript.h" #include "Log.h" +#include "Map.h" #include "Player.h" #include "sunwell_plateau.h" diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index aa2fa9acfd7..2425871a6e8 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -30,6 +30,7 @@ EndScriptData */ #include "InstanceScript.h" #include "Log.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "uldaman.h" diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index 1479daf73f7..1f62e44b878 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -17,7 +17,9 @@ #include "ScriptMgr.h" #include "CreatureTextMgr.h" +#include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index d9cfa61a36a..1191db2cf43 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -20,6 +20,7 @@ #include "GridNotifiers.h" #include "InstanceScript.h" #include "ObjectAccessor.h" +#include "MotionMaster.h" #include "Player.h" #include "ScriptedCreature.h" #include "SpellAuraEffects.h" @@ -491,11 +492,7 @@ class spell_mandokir_bloodletting : public SpellScriptLoader bool Validate(SpellInfo const* /*spell*/) override { - if (!sSpellMgr->GetSpellInfo(SPELL_BLOODLETTING_DAMAGE)) - return false; - if (!sSpellMgr->GetSpellInfo(SPELL_BLOODLETTING_HEAL)) - return false; - return true; + return ValidateSpellInfo({ SPELL_BLOODLETTING_DAMAGE, SPELL_BLOODLETTING_HEAL }); } void HandleEffectPeriodic(AuraEffect const* aurEff) diff --git a/src/server/scripts/EasternKingdoms/zone_dun_morogh.cpp b/src/server/scripts/EasternKingdoms/zone_dun_morogh.cpp index a60f9fb9b37..d88ac1b2bf9 100644 --- a/src/server/scripts/EasternKingdoms/zone_dun_morogh.cpp +++ b/src/server/scripts/EasternKingdoms/zone_dun_morogh.cpp @@ -16,6 +16,7 @@ */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" enum FrozenMountaineer diff --git a/src/server/scripts/EasternKingdoms/zone_dun_morogh_area_coldridge_valley.cpp b/src/server/scripts/EasternKingdoms/zone_dun_morogh_area_coldridge_valley.cpp index 5517302be6a..8249f4999f0 100644 --- a/src/server/scripts/EasternKingdoms/zone_dun_morogh_area_coldridge_valley.cpp +++ b/src/server/scripts/EasternKingdoms/zone_dun_morogh_area_coldridge_valley.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "CombatAI.h" +#include "MotionMaster.h" #include "MoveSplineInit.h" #include "ObjectAccessor.h" #include "Player.h" @@ -222,8 +223,7 @@ enum MilosGyro EVENT_MILO_DESPAWN = 13 }; -uint32 const pathSize = 24; -G3D::Vector3 const kharanosPath[pathSize] = +Position const kharanosPath[] = { { -6247.328f, 299.5365f, 390.266f }, { -6247.328f, 299.5365f, 390.266f }, @@ -250,6 +250,7 @@ G3D::Vector3 const kharanosPath[pathSize] = { -5603.897f, -466.3438f, 409.8931f }, { -5566.957f, -472.5642f, 399.0056f } }; +size_t const pathSize = std::extent<decltype(kharanosPath)>::value; class npc_milos_gyro : public CreatureScript { @@ -302,7 +303,7 @@ public: switch (eventId) { case EVENT_START_PATH: - me->GetMotionMaster()->MoveSmoothPath(pathSize, kharanosPath, pathSize, false, true); + me->GetMotionMaster()->MoveSmoothPath(uint32(pathSize), kharanosPath, pathSize, false, true); _events.ScheduleEvent(EVENT_MILO_SAY_0, Seconds(5)); break; case EVENT_MILO_SAY_0: diff --git a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp index dcdbd684e8a..f4720292716 100644 --- a/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp +++ b/src/server/scripts/EasternKingdoms/zone_hinterlands.cpp @@ -28,6 +28,7 @@ npc_oox09hl EndContentData */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" #include "ScriptedEscortAI.h" #include "Player.h" @@ -144,8 +145,7 @@ enum Sharpbeak SPELL_EJECT_ALL_PASSENGERS = 50630 }; -uint32 const campPathSize = 12; -G3D::Vector3 const campPath[campPathSize] = +Position const campPath[] = { { -75.40077f, -4037.111f, 114.6418f }, { -68.80193f, -4034.235f, 123.6844f }, @@ -160,9 +160,9 @@ G3D::Vector3 const campPath[campPathSize] = { -169.123f, -3582.08f, 282.866f }, { -241.8403f, -3625.01f, 247.4203f } }; +size_t constexpr campPathSize = std::extent<decltype(campPath)>::value; -uint32 const jinthaalorPathSize = 20; -G3D::Vector3 const jinthaalorPath[jinthaalorPathSize] = +Position const jinthaalorPath[] = { { -249.4681f, -3632.487f, 232.6947f }, { -241.606f, -3627.713f, 236.61870f }, @@ -185,6 +185,7 @@ G3D::Vector3 const jinthaalorPath[jinthaalorPathSize] = { -76.90625f, -4040.207f, 126.0433f }, { -77.51563f, -4022.026f, 123.2135f } }; +size_t constexpr jinthaalorPathSize = std::extent<decltype(jinthaalorPath)>::value; class npc_sharpbeak : public CreatureScript { @@ -211,11 +212,11 @@ public: switch (me->GetEntry()) { case NPC_SHARPBEAK_CAMP: - me->GetMotionMaster()->MoveSmoothPath(campPathSize, campPath, campPathSize, false); + me->GetMotionMaster()->MoveSmoothPath(uint32(campPathSize), campPath, campPathSize, false); endPoint = campPathSize; break; case NPC_SHARPBEAK_JINTHAALOR: - me->GetMotionMaster()->MoveSmoothPath(jinthaalorPathSize, jinthaalorPath, jinthaalorPathSize, false, true); + me->GetMotionMaster()->MoveSmoothPath(uint32(jinthaalorPathSize), jinthaalorPath, jinthaalorPathSize, false, true); endPoint = jinthaalorPathSize; break; } @@ -228,8 +229,9 @@ public: DoCast(SPELL_EJECT_ALL_PASSENGERS); } } - private: - uint8 endPoint; + + private: + size_t endPoint; }; CreatureAI* GetAI(Creature* creature) const override diff --git a/src/server/scripts/EasternKingdoms/zone_tol_barad.cpp b/src/server/scripts/EasternKingdoms/zone_tol_barad.cpp index ee02b75839b..04ddf2ddb3e 100644 --- a/src/server/scripts/EasternKingdoms/zone_tol_barad.cpp +++ b/src/server/scripts/EasternKingdoms/zone_tol_barad.cpp @@ -19,6 +19,7 @@ #include "Battlefield.h" #include "BattlefieldMgr.h" #include "BattlefieldTB.h" +#include "DB2Stores.h" #include "Player.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" diff --git a/src/server/scripts/EasternKingdoms/zone_undercity.cpp b/src/server/scripts/EasternKingdoms/zone_undercity.cpp index 8cab122911b..9aec68575bc 100644 --- a/src/server/scripts/EasternKingdoms/zone_undercity.cpp +++ b/src/server/scripts/EasternKingdoms/zone_undercity.cpp @@ -29,6 +29,7 @@ npc_highborne_lamenter EndContentData */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp index 6b666d749eb..2737783a608 100644 --- a/src/server/scripts/Events/childrens_week.cpp +++ b/src/server/scripts/Events/childrens_week.cpp @@ -16,6 +16,7 @@ */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp index 0300eccc116..d35e70ac1e9 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp @@ -84,10 +84,7 @@ public: { Initialize(); if (creature->IsSummon()) - { creature->SetHomePosition(HomePosition); - AttackPlayer(); - } instance = creature->GetInstanceScript(); } @@ -114,28 +111,9 @@ public: Initialize(); } - void AttackPlayer() + void IsSummonedBy(Unit*) override { - Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); - - if (PlList.isEmpty()) - return; - - for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) - { - if (Player* player = i->GetSource()) - { - if (player->IsGameMaster()) - continue; - - if (player->IsAlive()) - { - me->SetInCombatWith(player); - player->SetInCombatWith(me); - me->AddThreat(player, 0.0f); - } - } - } + DoZoneInCombat(); } void UpdateAI(uint32 diff) override diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index 38fb4c8a68e..49bc82bbad7 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "hyjal.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellScript.h" diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index 6479dd2cdfe..9b21f128bdd 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -30,6 +30,7 @@ EndScriptData */ #include "hyjalAI.h" #include "InstanceScript.h" #include "Log.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "TemporarySummon.h" diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index 32b90c6bfc9..0e842d848f3 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -20,6 +20,7 @@ #include "hyjal_trash.h" #include "hyjalAI.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "TemporarySummon.h" diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp index 1e24c9780e6..2224ca4f439 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp @@ -26,6 +26,7 @@ Script Data End */ #include "ScriptMgr.h" #include "culling_of_stratholme.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index f28c9e06e79..72d610d368f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -19,6 +19,7 @@ #include "culling_of_stratholme.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "PassiveAI.h" #include "Player.h" diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp index ef56283f024..de9eead2fc6 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp @@ -23,6 +23,7 @@ #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "TemporarySummon.h" #include "WorldStatePackets.h" diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp index f5b2743b487..30a2b565f0d 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "old_hillsbrad.h" #include "ScriptedEscortAI.h" @@ -72,7 +73,7 @@ enum LieutenantDrake SPELL_FRIGHTENING_SHOUT = 33789 }; -G3D::Vector3 const DrakeWP[]= +Position const DrakeWP[]= { { 2125.84f, 88.2535f, 54.8830f }, { 2111.01f, 93.8022f, 52.6356f }, @@ -156,7 +157,7 @@ public: /// @todo make this work if (CanPatrol && wpId == 0) { - me->GetMotionMaster()->MovePoint(wpId, DrakeWP[wpId].x, DrakeWP[wpId].y, DrakeWP[wpId].z); + me->GetMotionMaster()->MovePoint(wpId, DrakeWP[wpId]); ++wpId; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp index c96aacef21b..4050d363d06 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "Map.h" #include "ObjectAccessor.h" #include "old_hillsbrad.h" #include "Player.h" diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp index 36ce378f575..fe4316b2caf 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/TheBlackMorass/the_black_morass.cpp @@ -32,6 +32,7 @@ EndContentData */ #include "ScriptMgr.h" #include "InstanceScript.h" #include "Log.h" +#include "Map.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp b/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp index 508b010542e..678306030d5 100644 --- a/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp +++ b/src/server/scripts/Kalimdor/Firelands/boss_alysrazor.cpp @@ -20,6 +20,8 @@ #include "DB2Stores.h" #include "firelands.h" #include "GridNotifiersImpl.h" +#include "MotionMaster.h" +#include "MoveSplineInit.h" #include "ObjectAccessor.h" #include "PassiveAI.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp index 9efa74edd4f..b4d51bae4a6 100644 --- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp +++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp @@ -19,6 +19,8 @@ #include "GridNotifiers.h" #include "halls_of_origination.h" #include "InstanceScript.h" +#include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_earthrager_ptah.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_earthrager_ptah.cpp index bdf4e6e3c0a..0a55ae7694c 100644 --- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_earthrager_ptah.cpp +++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_earthrager_ptah.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "halls_of_origination.h" #include "InstanceScript.h" +#include "Map.h" #include "Player.h" #include "ScriptedCreature.h" #include "SpellAuraEffects.h" diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp index c8c4c57bac7..4537b438914 100644 --- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp +++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_temple_guardian_anhuur.cpp @@ -19,6 +19,7 @@ #include "GridNotifiers.h" #include "halls_of_origination.h" #include "InstanceScript.h" +#include "Map.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" @@ -286,17 +287,14 @@ class spell_anhuur_shield_of_light : public SpellScriptLoader void FilterTargets(std::list<WorldObject*>& targets) { - if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap()) + if (InstanceScript* const script = GetCaster()->GetInstanceScript()) { - if (InstanceScript* const script = instance->GetInstanceScript()) + if (GameObject* go = ObjectAccessor::GetGameObject(*GetCaster(), script->GetGuidData(DATA_ANHUUR_DOOR))) { - if (GameObject* go = ObjectAccessor::GetGameObject(*GetCaster(), script->GetGuidData(DATA_ANHUUR_DOOR))) - { - targets.remove_if(Trinity::HeightDifferenceCheck(go, 5.0f, false)); - targets.remove(GetCaster()); - targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); - targets.resize(2); - } + targets.remove_if(Trinity::HeightDifferenceCheck(go, 5.0f, false)); + targets.remove(GetCaster()); + targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); + targets.resize(2); } } } @@ -329,10 +327,9 @@ class spell_anhuur_disable_beacon_beams : public SpellScriptLoader void Notify(SpellEffIndex /*index*/) { - if (InstanceMap* instance = GetCaster()->GetMap()->ToInstanceMap()) - if (InstanceScript* const script = instance->GetInstanceScript()) - if (Creature* anhuur = instance->GetCreature(script->GetGuidData(DATA_ANHUUR_GUID))) - anhuur->AI()->DoAction(ACTION_DISABLE_BEACON); + if (InstanceScript* const script = GetCaster()->GetInstanceScript()) + if (Creature* anhuur = ObjectAccessor::GetCreature(*GetCaster(), script->GetGuidData(DATA_ANHUUR_GUID))) + anhuur->AI()->DoAction(ACTION_DISABLE_BEACON); } void Register() override diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp index 2459ff987f8..88736992d67 100644 --- a/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp +++ b/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp @@ -15,17 +15,13 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "ObjectMgr.h" #include "ScriptMgr.h" +#include "Creature.h" +#include "CreatureAI.h" +#include "GameObject.h" +#include "halls_of_origination.h" #include "InstanceScript.h" -#include "ScriptedCreature.h" #include "Map.h" -#include "PoolMgr.h" -#include "AccountMgr.h" -#include "halls_of_origination.h" -#include "Player.h" -#include "WorldPacket.h" -#include "WorldSession.h" DoorData const doorData[] = { diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp index 049ab5ef45e..3df735c178b 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp @@ -30,6 +30,7 @@ EndScriptData */ #include "CreatureAIImpl.h" #include "GridNotifiersImpl.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "onyxias_lair.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp index 5fcc2e15a35..c50cba3eef5 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp @@ -16,10 +16,11 @@ */ #include "ScriptMgr.h" -#include "ObjectMgr.h" +#include "GameObject.h" #include "InstanceScript.h" +#include "Map.h" +#include "MotionMaster.h" #include "razorfen_downs.h" -#include "Player.h" #include "TemporarySummon.h" Position const PosSummonTutenkash[15] = @@ -135,13 +136,9 @@ public: } if (GameObject* go = instance->GetGameObject(goGongGUID)) - { for (uint8 i = summonLowRange; i < summonHighRange; ++i) - { - Creature* creature = go->SummonCreature(summonCreature, PosSummonTutenkash[i]); + if (Creature* creature = go->SummonCreature(summonCreature, PosSummonTutenkash[i])) creature->GetMotionMaster()->MovePoint(0, 2533.479f + float(irand(-5, 5)), 870.020f + float(irand(-5, 5)), 47.678f); - } - } ++gongWave; break; diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp index d485d6f7802..8f5869b8c3d 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "CellImpl.h" #include "GridNotifiersImpl.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "Player.h" #include "razorfen_downs.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp index c8ba60f7aef..ae8f923c961 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp @@ -18,6 +18,8 @@ #include "ScriptMgr.h" #include "GameObject.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "PetAI.h" #include "Player.h" #include "razorfen_kraul.h" @@ -171,7 +173,7 @@ public: { if (type == POINT_MOTION_TYPE && id == POINT_TUBBER) { - if (GameObject* go = me->GetMap()->GetGameObject(TargetTubberGUID)) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, TargetTubberGUID)) { go->SetRespawnTime(5 * MINUTE); go->Refresh(); diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp index aa383be1443..b471f1f6410 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp @@ -19,6 +19,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ruins_of_ahnqiraj.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp index 3d208c4fd1b..c636d8a7a3f 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "CreatureTextMgr.h" #include "InstanceScript.h" +#include "ObjectAccessor.h" #include "ruins_of_ahnqiraj.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp index beca6e88156..d0f7938eb07 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp @@ -18,7 +18,9 @@ #include "ScriptMgr.h" #include "GameObject.h" #include "InstanceScript.h" +#include "Map.h" #include "MiscPackets.h" +#include "ObjectAccessor.h" #include "Player.h" #include "ruins_of_ahnqiraj.h" #include "ScriptedCreature.h" @@ -130,7 +132,7 @@ class boss_ossirian : public CreatureScript void DoAction(int32 action) override { if (action == ACTION_TRIGGER_WEAKNESS) - if (Creature* Trigger = me->GetMap()->GetCreature(TriggerGUID)) + if (Creature* Trigger = ObjectAccessor::GetCreature(*me, TriggerGUID)) if (!Trigger->HasUnitState(UNIT_STATE_CASTING)) Trigger->CastSpell(Trigger, SpellWeakness[urand(0, 4)], false); } @@ -181,7 +183,7 @@ class boss_ossirian : public CreatureScript void Cleanup() { - if (GameObject* Crystal = me->GetMap()->GetGameObject(CrystalGUID)) + if (GameObject* Crystal = ObjectAccessor::GetGameObject(*me, CrystalGUID)) Crystal->Use(me); } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index c70bede36ed..4571b681e59 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp index c8102675ac5..cf5ab95ae1c 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_viscidus.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp index 27b096e3561..239624a16ac 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp @@ -28,6 +28,8 @@ EndContentData */ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "Player.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" @@ -259,7 +261,7 @@ public: ++eventProgress; eventTimer = 15000; //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false); - if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) + if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) DoCast(naralex, SPELL_NARALEXS_AWAKENING, true); Talk(EMOTE_AWAKENING_RITUAL); } @@ -268,7 +270,7 @@ public: { ++eventProgress; eventTimer = 15000; - if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) + if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) naralex->AI()->Talk(EMOTE_TROUBLED_SLEEP); me->SummonCreature(NPC_DEVIATE_MOCCASIN, 135.943f, 199.701f, -103.529f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); me->SummonCreature(NPC_DEVIATE_MOCCASIN, 151.08f, 221.13f, -103.609f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); @@ -279,7 +281,7 @@ public: { ++eventProgress; eventTimer = 30000; - if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) + if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) naralex->AI()->Talk(EMOTE_WRITHE_IN_AGONY); me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413f, 207.188f, -102.469f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857f, 218.645f, -102.905f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); @@ -293,7 +295,7 @@ public: if (eventProgress == 5) { ++eventProgress; - if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) + if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) naralex->AI()->Talk(EMOTE_HORRENDOUS_VISION); me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872f, 262.905f, -103.503f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); Talk(SAY_MUTANUS_THE_DEVOURER); @@ -304,7 +306,7 @@ public: { ++eventProgress; eventTimer = 3000; - if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) + if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) { if (me->HasAura(SPELL_NARALEXS_AWAKENING)) me->RemoveAura(SPELL_NARALEXS_AWAKENING); @@ -318,7 +320,7 @@ public: { ++eventProgress; eventTimer = 6000; - if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) + if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) naralex->AI()->Talk(SAY_THANK_YOU); } else @@ -326,7 +328,7 @@ public: { ++eventProgress; eventTimer = 8000; - if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) + if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) { naralex->AI()->Talk(SAY_FAREWELL); naralex->AddAura(SPELL_FLIGHT_FORM, naralex); @@ -340,7 +342,7 @@ public: { ++eventProgress; eventTimer = 1500; - if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) + if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) naralex->GetMotionMaster()->MovePoint(25, naralex->GetPositionX(), naralex->GetPositionY(), naralex->GetPositionZ()); } else @@ -348,7 +350,7 @@ public: { ++eventProgress; eventTimer = 2500; - if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) + if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) { naralex->GetMotionMaster()->MovePoint(0, 117.095512f, 247.107971f, -96.167870f); naralex->GetMotionMaster()->MovePoint(1, 90.388809f, 276.135406f, -83.389801f); @@ -359,7 +361,7 @@ public: else if (eventProgress == 11) { - if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) + if (Creature* naralex = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_NARALEX))) naralex->SetVisible(false); me->SetVisible(false); instance->SetData(TYPE_NARALEX_PART3, DONE); diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index 695d99872e9..f678bf674d6 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -19,6 +19,7 @@ #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "TemporarySummon.h" #include "zulfarrak.h" diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp index c30d956bcc4..526232bab63 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptMgr.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" @@ -220,19 +221,19 @@ public: { instance->SetData(EVENT_PYRAMID, PYRAMID_CAGES_OPEN); //set bly & co to aggressive & start moving to top of stairs - initBlyCrewMember(instance, ENTRY_BLY, 1884.99f, 1263, 41.52f); - initBlyCrewMember(instance, ENTRY_RAVEN, 1882.5f, 1263, 41.52f); - initBlyCrewMember(instance, ENTRY_ORO, 1886.47f, 1270.68f, 41.68f); - initBlyCrewMember(instance, ENTRY_WEEGLI, 1890, 1263, 41.52f); - initBlyCrewMember(instance, ENTRY_MURTA, 1891.19f, 1272.03f, 41.60f); + initBlyCrewMember(instance, go, ENTRY_BLY, 1884.99f, 1263, 41.52f); + initBlyCrewMember(instance, go, ENTRY_RAVEN, 1882.5f, 1263, 41.52f); + initBlyCrewMember(instance, go, ENTRY_ORO, 1886.47f, 1270.68f, 41.68f); + initBlyCrewMember(instance, go, ENTRY_WEEGLI, 1890, 1263, 41.52f); + initBlyCrewMember(instance, go, ENTRY_MURTA, 1891.19f, 1272.03f, 41.60f); } return false; } private: - void initBlyCrewMember(InstanceScript* instance, uint32 entry, float x, float y, float z) + void initBlyCrewMember(InstanceScript* instance, GameObject* go, uint32 entry, float x, float y, float z) { - if (Creature* crew = instance->instance->GetCreature(instance->GetGuidData(entry))) + if (Creature* crew = ObjectAccessor::GetCreature(*go, instance->GetGuidData(entry))) { crew->SetReactState(REACT_AGGRESSIVE); crew->SetWalk(true); diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp index e9337d3e4ee..4b0a551f229 100644 --- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp @@ -36,6 +36,7 @@ EndContentData */ #include "CellImpl.h" #include "GridNotifiersImpl.h" #include "Log.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" diff --git a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp index f1aec9a37be..cb1cfbf51e8 100644 --- a/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_bloodmyst_isle.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "CellImpl.h" #include "GridNotifiersImpl.h" #include "Group.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "PassiveAI.h" #include "Player.h" diff --git a/src/server/scripts/Kalimdor/zone_desolace.cpp b/src/server/scripts/Kalimdor/zone_desolace.cpp index 6fee111cb4e..6517fdf8928 100644 --- a/src/server/scripts/Kalimdor/zone_desolace.cpp +++ b/src/server/scripts/Kalimdor/zone_desolace.cpp @@ -29,10 +29,10 @@ go_demon_portal EndContentData */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "ScriptedGossip.h" -#include "ScriptedEscortAI.h" +#include "MotionMaster.h" #include "Player.h" +#include "ScriptedEscortAI.h" +#include "ScriptedGossip.h" #include "SpellInfo.h" enum DyingKodo diff --git a/src/server/scripts/Kalimdor/zone_durotar.cpp b/src/server/scripts/Kalimdor/zone_durotar.cpp index a1a6b2d5329..7c3900f7444 100644 --- a/src/server/scripts/Kalimdor/zone_durotar.cpp +++ b/src/server/scripts/Kalimdor/zone_durotar.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "CreatureAIImpl.h" #include "GameObject.h" +#include "MotionMaster.h" #include "Player.h" #include "ScriptedCreature.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp index bb5ca8716e8..d323189e5b0 100644 --- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp @@ -27,6 +27,7 @@ EndScriptData */ EndContentData */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "Player.h" #include "QuestDef.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/Kalimdor/zone_felwood.cpp b/src/server/scripts/Kalimdor/zone_felwood.cpp index 863ad5a1bee..8a9d45aa33d 100644 --- a/src/server/scripts/Kalimdor/zone_felwood.cpp +++ b/src/server/scripts/Kalimdor/zone_felwood.cpp @@ -16,13 +16,9 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "ScriptedGossip.h" +#include "MotionMaster.h" #include "Player.h" -#include "Cell.h" -#include "CellImpl.h" -#include "GridNotifiers.h" -#include "GridNotifiersImpl.h" +#include "ScriptedCreature.h" #include "SpellScript.h" /*###### @@ -240,7 +236,7 @@ public: spell_ruumbos_silly_dance() : SpellScriptLoader("spell_ruumbos_silly_dan { player->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DANCE); - if (player->GetMap()->GetId() == MAP_KALIMDOR) + if (player->GetMapId() == MAP_KALIMDOR) { player->SummonCreature(NPC_DRIZZLE, DrizzleSpawnPos, TEMPSUMMON_TIMED_DESPAWN, 20000); player->SummonCreature(NPC_FERLI, FerliSpawnPos, TEMPSUMMON_TIMED_DESPAWN, 20000); diff --git a/src/server/scripts/Kalimdor/zone_moonglade.cpp b/src/server/scripts/Kalimdor/zone_moonglade.cpp index 85460b4d7f7..a6ecd7aedd6 100644 --- a/src/server/scripts/Kalimdor/zone_moonglade.cpp +++ b/src/server/scripts/Kalimdor/zone_moonglade.cpp @@ -16,15 +16,11 @@ */ #include "ScriptMgr.h" -#include "ScriptedCreature.h" -#include "ScriptedEscortAI.h" -#include "ScriptedGossip.h" +#include "GameObject.h" +#include "MotionMaster.h" #include "Player.h" +#include "ScriptedEscortAI.h" #include "SpellInfo.h" -#include "GridNotifiers.h" -#include "GridNotifiersImpl.h" -#include "Cell.h" -#include "CellImpl.h" /*#### # npc_omen diff --git a/src/server/scripts/Kalimdor/zone_mulgore.cpp b/src/server/scripts/Kalimdor/zone_mulgore.cpp index 15fa1a46ffd..b92251e623f 100644 --- a/src/server/scripts/Kalimdor/zone_mulgore.cpp +++ b/src/server/scripts/Kalimdor/zone_mulgore.cpp @@ -16,6 +16,7 @@ */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" /*###### @@ -28,8 +29,7 @@ enum EagleSpirit SPELL_SPIRIT_FORM = 69324 }; -uint32 const EagleSpiritflightPathSize = 7; -G3D::Vector3 const EagleSpiritflightPath[EagleSpiritflightPathSize] = +Position const EagleSpiritflightPath[] = { { -2884.155f, -71.08681f, 242.0678f }, { -2720.592f, -111.0035f, 242.5955f }, @@ -39,6 +39,7 @@ G3D::Vector3 const EagleSpiritflightPath[EagleSpiritflightPathSize] = { -2465.321f, -502.4896f, 190.7347f }, { -2343.872f, -401.8281f, -8.320873f } }; +size_t const EagleSpiritflightPathSize = std::extent<decltype(EagleSpiritflightPath)>::value; class npc_eagle_spirit : public CreatureScript { @@ -54,7 +55,7 @@ public: if (!apply) return; - me->GetMotionMaster()->MoveSmoothPath(EagleSpiritflightPathSize, EagleSpiritflightPath, EagleSpiritflightPathSize, false, true); + me->GetMotionMaster()->MoveSmoothPath(uint32(EagleSpiritflightPathSize), EagleSpiritflightPath, EagleSpiritflightPathSize, false, true); me->CastSpell(me, SPELL_SPIRIT_FORM); } diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp index afece0568de..430a04de529 100644 --- a/src/server/scripts/Kalimdor/zone_silithus.cpp +++ b/src/server/scripts/Kalimdor/zone_silithus.cpp @@ -39,6 +39,7 @@ EndContentData */ #include "CreatureAIImpl.h" #include "GameObject.h" #include "Group.h" +#include "MotionMaster.h" #include "Player.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Kalimdor/zone_tanaris.cpp b/src/server/scripts/Kalimdor/zone_tanaris.cpp index 4c074407025..465ff2222aa 100644 --- a/src/server/scripts/Kalimdor/zone_tanaris.cpp +++ b/src/server/scripts/Kalimdor/zone_tanaris.cpp @@ -29,6 +29,7 @@ npc_OOX17 EndContentData */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/Kalimdor/zone_the_barrens.cpp b/src/server/scripts/Kalimdor/zone_the_barrens.cpp index 88d776d887d..56004e1ee92 100644 --- a/src/server/scripts/Kalimdor/zone_the_barrens.cpp +++ b/src/server/scripts/Kalimdor/zone_the_barrens.cpp @@ -28,6 +28,7 @@ npc_wizzlecrank_shredder EndContentData */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/Kalimdor/zone_winterspring.cpp b/src/server/scripts/Kalimdor/zone_winterspring.cpp index 8d87d82e4a7..8380731b5c3 100644 --- a/src/server/scripts/Kalimdor/zone_winterspring.cpp +++ b/src/server/scripts/Kalimdor/zone_winterspring.cpp @@ -31,6 +31,8 @@ EndContentData */ #include "ScriptMgr.h" #include "GameObject.h" +#include "MotionMaster.h" +#include "ObjectAccessor.h" #include "Player.h" #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" @@ -432,7 +434,7 @@ public: (*itr)->Refresh(); } - if (GameObject* altar = me->GetMap()->GetGameObject(_altarGUID)) + if (GameObject* altar = ObjectAccessor::GetGameObject(*me ,_altarGUID)) me->SetFacingToObject(altar); break; } @@ -446,7 +448,7 @@ public: case 44: // Stop the escort and turn towards the altar SetEscortPaused(true); - if (GameObject* altar = me->GetMap()->GetGameObject(_altarGUID)) + if (GameObject* altar = ObjectAccessor::GetGameObject(*me, _altarGUID)) me->SetFacingToObject(altar); break; } @@ -476,7 +478,7 @@ public: break; case SAY_PRIESTESS_ALTAR_9: // move near the escort npc - if (Creature* priestess = me->GetMap()->GetCreature(_firstPriestessGUID)) + if (Creature* priestess = ObjectAccessor::GetCreature(*me, _firstPriestessGUID)) priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[6]); break; case SAY_PRIESTESS_ALTAR_13: @@ -487,7 +489,7 @@ public: _guardEluneGUID = guard->GetGUID(); } // summon the Voice of Elune - if (GameObject* altar = me->GetMap()->GetGameObject(_altarGUID)) + if (GameObject* altar = ObjectAccessor::GetGameObject(*me, _altarGUID)) { if (Creature* voice = me->SummonCreature(NPC_VOICE_ELUNE, *altar, TEMPSUMMON_TIMED_DESPAWN, 30000)) _voiceEluneGUID = voice->GetGUID(); @@ -495,7 +497,7 @@ public: break; case SAY_VOICE_ALTAR_15: // move near the escort npc and continue dialogue - if (Creature* priestess = me->GetMap()->GetCreature(_secondPriestessGUID)) + if (Creature* priestess = ObjectAccessor::GetCreature(*me, _secondPriestessGUID)) { priestess->AI()->Talk(SAY_PRIESTESS_ALTAR_14); priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[7]); @@ -503,7 +505,7 @@ public: break; case SAY_PRIESTESS_ALTAR_19: // make the voice of elune leave - if (Creature* guard = me->GetMap()->GetCreature(_guardEluneGUID)) + if (Creature* guard = ObjectAccessor::GetCreature(*me, _guardEluneGUID)) { guard->GetMotionMaster()->MovePoint(0, wingThicketLocations[2]); guard->DespawnOrUnsummon(4000); @@ -511,7 +513,7 @@ public: break; case SAY_PRIESTESS_ALTAR_20: // make the first priestess leave - if (Creature* priestess = me->GetMap()->GetCreature(_firstPriestessGUID)) + if (Creature* priestess = ObjectAccessor::GetCreature(*me, _firstPriestessGUID)) { priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[0]); priestess->DespawnOrUnsummon(4000); @@ -519,7 +521,7 @@ public: break; case SAY_PRIESTESS_ALTAR_21: // make the second priestess leave - if (Creature* priestess = me->GetMap()->GetCreature(_secondPriestessGUID)) + if (Creature* priestess = ObjectAccessor::GetCreature(*me, _secondPriestessGUID)) { priestess->GetMotionMaster()->MovePoint(0, wingThicketLocations[1]); priestess->DespawnOrUnsummon(4000); @@ -535,7 +537,7 @@ public: break; case SAY_RANSHALLA_END_2: // Turn towards the altar and kneel - quest complete - if (GameObject* altar = me->GetMap()->GetGameObject(_altarGUID)) + if (GameObject* altar = ObjectAccessor::GetGameObject(*me, _altarGUID)) { me->SetFacingToObject(altar); altar->ResetDoorOrButton(); @@ -558,11 +560,11 @@ public: case NPC_RANSHALLA: return me; case NPC_VOICE_ELUNE: - return me->GetMap()->GetCreature(_voiceEluneGUID); + return ObjectAccessor::GetCreature(*me, _voiceEluneGUID); case NPC_PRIESTESS_DATA_1: - return me->GetMap()->GetCreature(_firstPriestessGUID); + return ObjectAccessor::GetCreature(*me, _firstPriestessGUID); case NPC_PRIESTESS_DATA_2: - return me->GetMap()->GetCreature(_secondPriestessGUID); + return ObjectAccessor::GetCreature(*me, _secondPriestessGUID); default: return NULL; } diff --git a/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp b/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp index ce6a3d77411..841d6199452 100644 --- a/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp +++ b/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp @@ -18,6 +18,8 @@ #include "ScriptMgr.h" #include "DynamicObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" +#include "MoveSplineInit.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" @@ -25,6 +27,7 @@ #include "SpellScript.h" #include "stonecore.h" #include "Vehicle.h" +#include <G3D/Vector3.h> enum Spells { diff --git a/src/server/scripts/Maelstrom/Stonecore/boss_slabhide.cpp b/src/server/scripts/Maelstrom/Stonecore/boss_slabhide.cpp index a9beb1b5421..a10b9b23661 100644 --- a/src/server/scripts/Maelstrom/Stonecore/boss_slabhide.cpp +++ b/src/server/scripts/Maelstrom/Stonecore/boss_slabhide.cpp @@ -19,6 +19,7 @@ #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" #include "Spell.h" #include "SpellScript.h" diff --git a/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp b/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp index 26c42183c93..12198d931ab 100644 --- a/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp +++ b/src/server/scripts/Maelstrom/Stonecore/stonecore.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectMgr.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp index 956d2b60e55..9885d414706 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp @@ -23,6 +23,7 @@ #include "ScriptMgr.h" #include "ahnkahet.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "TemporarySummon.h" diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index 36ac2107bab..be5cedd99e5 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -20,6 +20,7 @@ #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index cb8f01be073..8f4dd246346 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -20,6 +20,7 @@ #include "azjol_nerub.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "PassiveAI.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp index cc8a7e6829d..e619ecc0f08 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "azjol_nerub.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellAuraEffects.h" diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index 47243c77e25..06de46688b0 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -19,6 +19,7 @@ #include "CellImpl.h" #include "GridNotifiersImpl.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "obsidian_sanctum.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp index 80b14d6ec85..650a5ed157f 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.cpp @@ -19,6 +19,7 @@ #include "CellImpl.h" #include "GridNotifiersImpl.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "obsidian_sanctum.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp index df0e85281ab..249426cc0a3 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "Map.h" +#include "MotionMaster.h" #include "ruby_sanctum.h" #include "ScriptedCreature.h" #include "SpellScript.h" diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp index cfcd0f662f9..7af304a62c1 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ruby_sanctum.h" diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index d3c1a491f20..69f9bddd887 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -24,6 +24,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedEscortAI.h" #include "SpellScript.h" diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp index 46e9792aafd..58cd448b318 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp @@ -28,6 +28,7 @@ EndScriptData */ #include "InstanceScript.h" #include "Log.h" #include "Map.h" +#include "MotionMaster.h" #include "Player.h" #include "trial_of_the_champion.h" diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp index 4af6e5991ab..ae3199e8644 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp @@ -30,6 +30,7 @@ EndContentData */ #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index 48e80a6613e..36476e194c5 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -23,6 +23,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellScript.h" diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index b3b6f825777..28ded5323e5 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -20,6 +20,7 @@ #include "GridNotifiers.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 9b404606fbe..9024bd60468 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -22,6 +22,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index d6041d72b35..f6ad19875df 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -24,6 +24,7 @@ #include "CellImpl.h" #include "GridNotifiersImpl.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index 76313a9bd4a..41cb3d15468 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -23,6 +23,7 @@ #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp index 22fa07bd2ef..2502b3cea6a 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp @@ -19,6 +19,7 @@ #include "drak_tharon_keep.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellScript.h" diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index 77962c46db1..285cb1ad450 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "drak_tharon_keep.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellAuraEffects.h" diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp index 8ac3e9a5594..90219ee6323 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp @@ -19,6 +19,7 @@ #include "forge_of_souls.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellScript.h" diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp index 08609ec1d94..b00ee7ff6d6 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp @@ -19,6 +19,7 @@ #include "forge_of_souls.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" #include "SpellAuraEffects.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 50a23bd8381..5c3e91c7491 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "halls_of_reflection.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "MoveSplineInit.h" #include "ObjectAccessor.h" #include "Player.h" diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index 25cc8f7a98f..cb0821640e2 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "pit_of_saron.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index 05a3a3a4f2c..f9f375560af 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "pit_of_saron.h" #include "Player.h" diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index 375dd23addc..dd90508c1a4 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "pit_of_saron.h" #include "Player.h" diff --git a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp index c47e163a75f..465bb9bcf24 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_drakkari_colossus.cpp @@ -22,6 +22,7 @@ #include "ScriptMgr.h" #include "gundrak.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp index 33f6e09085b..fb00acb39dc 100644 --- a/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp +++ b/src/server/scripts/Northrend/Gundrak/boss_slad_ran.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "gundrak.h" +#include "MotionMaster.h" #include "Player.h" #include "ScriptedCreature.h" #include "SpellAuras.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 80f6d81834f..9deffa305bf 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -18,6 +18,7 @@ #include "icecrown_citadel.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index 855afb707ff..1b2212d9ddc 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -19,6 +19,7 @@ #include "GridNotifiers.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index d0f14390b64..c202d65a308 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -18,6 +18,7 @@ #include "icecrown_citadel.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp index 57bac6cb166..dfef623d708 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp @@ -21,7 +21,9 @@ #include "GridNotifiersImpl.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "MovementPackets.h" +#include "MoveSplineInit.h" #include "ObjectAccessor.h" #include "PassiveAI.h" #include "Player.h" @@ -35,6 +37,7 @@ #include "TemporarySummon.h" #include "Transport.h" #include "Vehicle.h" +#include <G3D/Vector3.h> enum Texts { diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index ec6a86d906d..c8f99deed87 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -18,6 +18,7 @@ #include "icecrown_citadel.h" #include "Group.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "PoolMgr.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index 2a4649b00ac..fc90699307b 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -18,6 +18,7 @@ #include "icecrown_citadel.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "MoveSplineInit.h" #include "ObjectAccessor.h" #include "Player.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index bcc1b60eb02..5ed31ccea61 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -22,6 +22,7 @@ #include "Group.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "Spell.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 522ee971b2d..6d29fe8a46d 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -20,6 +20,7 @@ #include "GridNotifiers.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Player.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index c28e26d8022..75d4e8dda85 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -22,6 +22,7 @@ #include "GridNotifiersImpl.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "Spell.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index 75a3c9b59d6..b7ca1978ead 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -19,6 +19,7 @@ #include "CellImpl.h" #include "GridNotifiersImpl.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellAuraEffects.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index da5a449e7bb..db910822d91 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -20,6 +20,7 @@ #include "GameObject.h" #include "GridNotifiersImpl.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "PassiveAI.h" #include "PetDefines.h" diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp index c730b9b22a2..bbad2e8e769 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp @@ -19,6 +19,7 @@ #include "GameObject.h" #include "GameObjectAI.h" #include "InstanceScript.h" +#include "Map.h" #include "Player.h" #include "ScriptedGossip.h" #include "Spell.h" diff --git a/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp b/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp index 7db8e4d30c3..fff4f9894f5 100644 --- a/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp +++ b/src/server/scripts/Northrend/IsleOfConquest/isle_of_conquest.cpp @@ -18,6 +18,8 @@ #include "ScriptMgr.h" #include "BattlegroundIC.h" #include "GameObject.h" +#include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "PassiveAI.h" #include "Player.h" diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index 75d1452cef5..6efbaefdf41 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -19,6 +19,7 @@ #include "InstanceScript.h" #include "Log.h" #include "Map.h" +#include "MotionMaster.h" #include "naxxramas.h" #include "ObjectAccessor.h" #include "Player.h" diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp index 4e8344ef583..a99a9a47c52 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gluth.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "naxxramas.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp index 9d97b10f38e..8de227067af 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_gothik.cpp @@ -21,6 +21,7 @@ #include "GridNotifiers.h" #include "InstanceScript.h" #include "Log.h" +#include "Map.h" #include "naxxramas.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 26d17fc5f11..49616f218e8 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "naxxramas.h" #include "ObjectAccessor.h" #include "Player.h" diff --git a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp index fa26ecba402..17d5b39149d 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_maexxna.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "naxxramas.h" #include "ObjectAccessor.h" #include "PassiveAI.h" diff --git a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp index e78788dc04b..f9fb0caf826 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_noth.cpp @@ -16,6 +16,7 @@ */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "naxxramas.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp index 0e6e8f09ccd..4679fb17358 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_razuvious.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "naxxramas.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index 5c2a1ea1016..d89f6793386 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -19,6 +19,7 @@ #include "GameObject.h" #include "GameObjectAI.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "naxxramas.h" #include "ObjectAccessor.h" #include "Player.h" diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp index 891b8fd76be..66c4e702481 100644 --- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp +++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp @@ -23,6 +23,7 @@ #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "naxxramas.h" #include "TemporarySummon.h" diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index ca0bbefb81a..84f4294739e 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -26,6 +26,7 @@ Script Data End */ #include "GridNotifiers.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp index f1e3484a971..3bfafc59077 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_magus_telestra.cpp @@ -19,6 +19,7 @@ #include "ScriptMgr.h" #include "GameEventMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "nexus.h" #include "ScriptedCreature.h" #include "TemporarySummon.h" diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp index fcf9992159c..96b3eba3fd9 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "oculus.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp index dafe692ee75..ac210e23be5 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_eregos.cpp @@ -16,6 +16,7 @@ */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "oculus.h" #include "ScriptedCreature.h" #include "SpellScript.h" diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp index 92fdea2576d..459b9cb188d 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp @@ -23,6 +23,7 @@ SDCategory: Instance Script EndScriptData */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "oculus.h" #include "ScriptedCreature.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index d476c7aa115..5ed8c882b2a 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "oculus.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp index 8f038a632b6..c53b2d737ca 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp @@ -22,6 +22,7 @@ #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "oculus.h" #include "TemporarySummon.h" #include "WorldStatePackets.h" diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index 739bb84b128..ed6c7c459bf 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "CombatAI.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "oculus.h" #include "Player.h" diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp index ae1202cf522..0fccdb8c4b0 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_ionar.cpp @@ -23,6 +23,7 @@ #include "ScriptMgr.h" #include "halls_of_lightning.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp index 9b3f00c7c44..35dd26ce10d 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "halls_of_lightning.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp index 435000665cb..9f6ccce5a87 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_sjonnir.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "halls_of_stone.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp index 57c5d4e9419..b0b2f149377 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -21,6 +21,7 @@ #include "GameObjectAI.h" #include "InstanceScript.h" #include "MapManager.h" +#include "MotionMaster.h" #include "MoveSplineInit.h" #include "ObjectAccessor.h" #include "PassiveAI.h" diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp index c9cbabd0586..3286450aceb 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_assembly_of_iron.cpp @@ -24,6 +24,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellAuras.h" diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index b0af1c7ac11..d16d735d1c2 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -28,6 +28,7 @@ #include "GameObject.h" #include "GridNotifiersImpl.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "PassiveAI.h" #include "Player.h" diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp index e4dd5f41225..e04efe4bb71 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_general_vezax.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp index 4fcb536d544..ea9c9743ef5 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_hodir.cpp @@ -19,6 +19,7 @@ #include "CellImpl.h" #include "GridNotifiersImpl.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellAuras.h" diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index eddbae6041a..2a6ea06fa74 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellAuraEffects.h" diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp index 0c13e519be0..947cf887913 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_mimiron.cpp @@ -19,6 +19,7 @@ #include "GameObject.h" #include "GridNotifiers.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellAuraEffects.h" diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp index 1a1dc732a59..73d72f785a2 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_razorscale.cpp @@ -20,6 +20,7 @@ #include "ScriptMgr.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index 6e845a35faf..b6ae350927c 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -24,6 +24,7 @@ #include "ScriptMgr.h" #include "CombatLogPackets.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "PassiveAI.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp index fccfe5ff56b..3846a69595b 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp @@ -20,6 +20,7 @@ #include "GridNotifiers.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "PassiveAI.h" #include "Player.h" diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 650df127750..d3355842688 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -19,6 +19,7 @@ #include "AreaBoundary.h" #include "GameObject.h" #include "InstanceScript.h" +#include "Item.h" #include "Map.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index f67779fb154..683590fa075 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -24,6 +24,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "Spell.h" diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp index fc92c2490c5..e7f565eb99c 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp @@ -24,6 +24,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellAuras.h" diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp index f4c68ad36e7..3b9e962ea4d 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" #include "SpellInfo.h" #include "SpellScript.h" diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp index 735ef2f087b..8b36853a24a 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp @@ -26,6 +26,7 @@ Script Data End */ #include "ScriptMgr.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "TemporarySummon.h" diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index 7e31ccd5d35..da0bfbb0d8c 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -18,6 +18,8 @@ #include "ScriptMgr.h" #include "GridNotifiers.h" #include "InstanceScript.h" +#include "MotionMaster.h" +#include "MoveSplineInit.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 85c21ffb9eb..f7b89126980 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index 622cc8fdc1c..fc67a9f5580 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -16,6 +16,7 @@ */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp index f9f99999eeb..104783e653c 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_erekem.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "violet_hold.h" diff --git a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp index 831a9abd6c2..81de573a726 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_ichoron.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" #include "SpellAuras.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp index bd1a11164c8..804c7b1490b 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_xevozz.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" #include "SpellInfo.h" #include "SpellScript.h" diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 3c8764836b7..1a6dc7f3366 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -21,6 +21,7 @@ #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "Player.h" #include "TaskScheduler.h" #include "TemporarySummon.h" @@ -70,7 +71,7 @@ Position const PortalIntroPositions[PortalIntroPositionsSize] = // sniff uint32 const EncouterPortalsCount = PortalPositionsSize + PortalElitePositionsSize; uint32 const MoraggPathSize = 3; -G3D::Vector3 const MoraggPath[MoraggPathSize] = // sniff +Position const MoraggPath[MoraggPathSize] = // sniff { { 1893.895f, 728.1261f, 47.75016f }, { 1892.997f, 738.4987f, 47.66684f }, @@ -78,7 +79,7 @@ G3D::Vector3 const MoraggPath[MoraggPathSize] = // sniff }; uint32 const ErekemPathSize = 3; -G3D::Vector3 const ErekemPath[ErekemPathSize] = // sniff +Position const ErekemPath[ErekemPathSize] = // sniff { { 1871.456f, 871.0361f, 43.41524f }, { 1874.948f, 859.5452f, 43.33349f }, @@ -86,7 +87,7 @@ G3D::Vector3 const ErekemPath[ErekemPathSize] = // sniff }; uint32 const ErekemGuardLeftPathSize = 3; -G3D::Vector3 const ErekemGuardLeftPath[ErekemGuardLeftPathSize] = // sniff +Position const ErekemGuardLeftPath[ErekemGuardLeftPathSize] = // sniff { { 1853.752f, 862.4528f, 43.41614f }, { 1866.931f, 854.577f, 43.3335f }, @@ -94,7 +95,7 @@ G3D::Vector3 const ErekemGuardLeftPath[ErekemGuardLeftPathSize] = // sniff }; uint32 const ErekemGuardRightPathSize = 3; -G3D::Vector3 const ErekemGuardRightPath[ErekemGuardRightPathSize] = // sniff +Position const ErekemGuardRightPath[ErekemGuardRightPathSize] = // sniff { { 1892.418f, 872.2831f, 43.41563f }, { 1885.639f, 859.0245f, 43.3335f }, @@ -102,7 +103,7 @@ G3D::Vector3 const ErekemGuardRightPath[ErekemGuardRightPathSize] = // sniff }; uint32 const IchoronPathSize = 5; -G3D::Vector3 const IchoronPath[IchoronPathSize] = // sniff +Position const IchoronPath[IchoronPathSize] = // sniff { { 1942.041f, 749.5228f, 30.95229f }, { 1930.571f, 762.9065f, 31.98814f }, @@ -112,7 +113,7 @@ G3D::Vector3 const IchoronPath[IchoronPathSize] = // sniff }; uint32 const LavanthorPathSize = 3; -G3D::Vector3 const LavanthorPath[LavanthorPathSize] = // sniff +Position const LavanthorPath[LavanthorPathSize] = // sniff { { 1844.557f, 748.7083f, 38.74205f }, { 1854.618f, 761.5295f, 38.65631f }, @@ -120,7 +121,7 @@ G3D::Vector3 const LavanthorPath[LavanthorPathSize] = // sniff }; uint32 const XevozzPathSize = 3; -G3D::Vector3 const XevozzPath[XevozzPathSize] = // sniff +Position const XevozzPath[XevozzPathSize] = // sniff { { 1908.417f, 845.8502f, 38.71947f }, { 1905.557f, 841.3157f, 38.65529f }, @@ -128,7 +129,7 @@ G3D::Vector3 const XevozzPath[XevozzPathSize] = // sniff }; uint32 const ZuramatPathSize = 3; -G3D::Vector3 const ZuramatPath[ZuramatPathSize] = // sniff +Position const ZuramatPath[ZuramatPathSize] = // sniff { { 1934.151f, 860.9463f, 47.29499f }, { 1927.085f, 852.1342f, 47.19214f }, diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index 174e417155e..474ed9a1a12 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -16,8 +16,11 @@ */ #include "ScriptMgr.h" +#include "Containers.h" #include "GameObject.h" #include "InstanceScript.h" +#include "Map.h" +#include "MotionMaster.h" #include "Player.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" @@ -157,7 +160,7 @@ enum Sinclari SAY_SINCLARI_PORTAL_KEEPER = 2 }; -G3D::Vector3 const FirstPortalWPs[6] = +Position const FirstPortalWPs[] = { {1877.670288f, 842.280273f, 43.333591f}, {1877.338867f, 834.615356f, 38.762287f}, @@ -168,7 +171,7 @@ G3D::Vector3 const FirstPortalWPs[6] = //{1825.736084f, 807.305847f, 44.363785f} }; -G3D::Vector3 const SecondPortalFirstWPs[9] = +Position const SecondPortalFirstWPs[] = { {1902.561401f, 853.334656f, 47.106117f}, {1895.486084f, 855.376404f, 44.334591f}, @@ -182,7 +185,7 @@ G3D::Vector3 const SecondPortalFirstWPs[9] = //{1825.736084f, 807.305847f, 44.363785f} }; -G3D::Vector3 const SecondPortalSecondWPs[8] = +Position const SecondPortalSecondWPs[] = { {1929.392212f, 837.614990f, 47.136166f}, {1928.290649f, 824.750427f, 45.474411f}, @@ -195,7 +198,7 @@ G3D::Vector3 const SecondPortalSecondWPs[8] = //{1825.736084f, 807.305847f, 44.363785f} }; -G3D::Vector3 const ThirdPortalWPs[8] = +Position const ThirdPortalWPs[] = { {1934.049438f, 815.778503f, 52.408699f}, {1928.290649f, 824.750427f, 45.474411f}, @@ -208,7 +211,7 @@ G3D::Vector3 const ThirdPortalWPs[8] = //{1825.736084f, 807.305847f, 44.363785f} }; -G3D::Vector3 const FourthPortalWPs[9] = +Position const FourthPortalWPs[] = { {1921.658447f, 761.657043f, 50.866741f}, {1910.559814f, 755.780457f, 47.701447f}, @@ -222,7 +225,7 @@ G3D::Vector3 const FourthPortalWPs[9] = //{1827.100342f, 801.605957f, 44.363358f} }; -G3D::Vector3 const FifthPortalWPs[6] = +Position const FifthPortalWPs[] = { {1887.398804f, 763.633240f, 47.666851f}, {1879.020386f, 775.396973f, 38.705990f}, @@ -233,7 +236,7 @@ G3D::Vector3 const FifthPortalWPs[6] = //{1827.100342f, 801.605957f, 44.363358f} }; -G3D::Vector3 const SixthPoralWPs[4] = +Position const SixthPoralWPs[] = { {1888.861084f, 805.074768f, 38.375790f}, {1869.793823f, 804.135804f, 38.647018f}, @@ -242,13 +245,12 @@ G3D::Vector3 const SixthPoralWPs[4] = //{1826.889648f, 803.929993f, 44.363239f} }; -G3D::Vector3 const DefaultPortalWPs[1] = +Position const DefaultPortalWPs[] = { { 1843.567017f, 804.288208f, 44.139091f } }; -uint32 const SaboteurMoraggPathSize = 5; -G3D::Vector3 const SaboteurMoraggPath[SaboteurMoraggPathSize] = // sniff +Position const SaboteurMoraggPath[] = // sniff { { 1886.251f, 803.0743f, 38.42326f }, { 1885.71f, 799.8929f, 38.37241f }, @@ -257,8 +259,7 @@ G3D::Vector3 const SaboteurMoraggPath[SaboteurMoraggPathSize] = // sniff { 1894.603f, 739.9231f, 47.66684f }, }; -uint32 const SaboteurErekemPathSize = 5; -G3D::Vector3 const SaboteurErekemPath[SaboteurErekemPathSize] = // sniff +Position const SaboteurErekemPath[] = // sniff { { 1886.251f, 803.0743f, 38.42326f }, { 1881.047f, 829.6866f, 38.64856f }, @@ -267,24 +268,21 @@ G3D::Vector3 const SaboteurErekemPath[SaboteurErekemPathSize] = // sniff { 1873.747f, 864.1373f, 43.33349f } }; -uint32 const SaboteurIchoronPathSize = 3; -G3D::Vector3 const SaboteurIchoronPath[SaboteurIchoronPathSize] = // sniff +Position const SaboteurIchoronPath[] = // sniff { { 1886.251f, 803.0743f, 38.42326f }, { 1888.672f, 801.2348f, 38.42305f }, { 1901.987f, 793.3254f, 38.65126f } }; -uint32 const SaboteurLavanthorPathSize = 3; -G3D::Vector3 const SaboteurLavanthorPath[SaboteurLavanthorPathSize] = // sniff +Position const SaboteurLavanthorPath[] = // sniff { { 1886.251f, 803.0743f, 38.42326f }, { 1867.925f, 778.8035f, 38.64702f }, { 1853.304f, 759.0161f, 38.65761f } }; -uint32 const SaboteurXevozzPathSize = 4; -G3D::Vector3 const SaboteurXevozzPath[SaboteurXevozzPathSize] = // sniff +Position const SaboteurXevozzPath[] = // sniff { { 1886.251f, 803.0743f, 38.42326f }, { 1889.096f, 810.0487f, 38.43871f }, @@ -292,8 +290,7 @@ G3D::Vector3 const SaboteurXevozzPath[SaboteurXevozzPathSize] = // sniff { 1906.666f, 842.3111f, 38.63351f } }; -uint32 const SaboteurZuramatPathSize = 7; -G3D::Vector3 const SaboteurZuramatPath[SaboteurZuramatPathSize] = // sniff +Position const SaboteurZuramatPath[] = // sniff { { 1886.251f, 803.0743f, 38.42326f }, { 1889.69f, 807.0032f, 38.39914f }, @@ -546,41 +543,35 @@ class npc_azure_saboteur : public CreatureScript _bossId = _instance->GetData(DATA_2ND_BOSS); } - void StartMovement() + template<size_t N> + void StartSmoothPath(Position const (&path)[N]) { - uint32 pathSize = 0; - G3D::Vector3 const* path = nullptr; + me->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, &path[0], N, false); + } + void StartMovement() + { switch (_bossId) { case DATA_MORAGG: - pathSize = SaboteurMoraggPathSize; - path = SaboteurMoraggPath; + StartSmoothPath(SaboteurMoraggPath); break; case DATA_EREKEM: - pathSize = SaboteurErekemPathSize; - path = SaboteurErekemPath; + StartSmoothPath(SaboteurErekemPath); break; case DATA_ICHORON: - pathSize = SaboteurIchoronPathSize; - path = SaboteurIchoronPath; + StartSmoothPath(SaboteurIchoronPath); break; case DATA_LAVANTHOR: - pathSize = SaboteurLavanthorPathSize; - path = SaboteurLavanthorPath; + StartSmoothPath(SaboteurLavanthorPath); break; case DATA_XEVOZZ: - pathSize = SaboteurXevozzPathSize; - path = SaboteurXevozzPath; + StartSmoothPath(SaboteurXevozzPath); break; case DATA_ZURAMAT: - pathSize = SaboteurZuramatPathSize; - path = SaboteurZuramatPath; + StartSmoothPath(SaboteurZuramatPath); break; } - - if (path) - me->GetMotionMaster()->MoveSmoothPath(POINT_INTRO, path, pathSize, false); } void Reset() override @@ -852,58 +843,57 @@ struct violet_hold_trashAI : public npc_escortAI _scheduler.CancelAll(); } + template<size_t N> + Position const* GetPathAndInitLastWaypointFrom(Position const (&path)[N]) + { + _lastWaypointId = N - 1; + return &path[0]; + } + void SetData(uint32 type, uint32 data) override { if (type == DATA_PORTAL_LOCATION) { - G3D::Vector3 const* path = nullptr; + Position const* path = nullptr; switch (data) { case 0: - _lastWaypointId = 5; - path = FirstPortalWPs; + path = GetPathAndInitLastWaypointFrom(FirstPortalWPs); break; case 7: switch (urand(0, 1)) { case 0: - _lastWaypointId = 8; - path = SecondPortalFirstWPs; + path = GetPathAndInitLastWaypointFrom(SecondPortalFirstWPs); break; case 1: - _lastWaypointId = 7; - path = SecondPortalSecondWPs; + path = GetPathAndInitLastWaypointFrom(SecondPortalSecondWPs); break; } break; case 2: - _lastWaypointId = 7; - path = ThirdPortalWPs; + path = GetPathAndInitLastWaypointFrom(ThirdPortalWPs); break; case 6: - _lastWaypointId = 8; - path = FourthPortalWPs; + path = GetPathAndInitLastWaypointFrom(FourthPortalWPs); break; case 1: - _lastWaypointId = 5; - path = FifthPortalWPs; + path = GetPathAndInitLastWaypointFrom(FifthPortalWPs); break; case 5: - _lastWaypointId = 3; - path = SixthPoralWPs; + path = GetPathAndInitLastWaypointFrom(SixthPoralWPs); break; default: - _lastWaypointId = 0; - path = DefaultPortalWPs; + path = GetPathAndInitLastWaypointFrom(DefaultPortalWPs); break; } if (path) { for (uint32 i = 0; i <= _lastWaypointId; i++) - AddWaypoint(i, path[i].x + irand(-1, 1), path[i].y + irand(-1, 1), path[i].z, 0); - me->SetHomePosition(path[_lastWaypointId].x, path[_lastWaypointId].y, path[_lastWaypointId].z, float(M_PI)); + AddWaypoint(i, path[i].GetPositionX() + irand(-1, 1), path[i].GetPositionY() + irand(-1, 1), path[i].GetPositionZ(), 0); + me->SetHomePosition(path[_lastWaypointId].GetPositionX(), path[_lastWaypointId].GetPositionY(), path[_lastWaypointId].GetPositionZ(), float(M_PI)); } Start(true, true); diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index 635c653fe8d..48caa35a3b7 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -36,6 +36,7 @@ EndContentData */ #include "ScriptMgr.h" #include "GameObject.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Player.h" @@ -45,6 +46,7 @@ EndContentData */ #include "SpellInfo.h" #include "SpellScript.h" #include "TemporarySummon.h" +#include "WorldSession.h" /*###### ## npc_sinkhole_kill_credit @@ -442,7 +444,7 @@ public: void JustDied(Unit* /*killer*/) override { - if (GameObject* go_caribou = me->GetMap()->GetGameObject(go_caribouGUID)) + if (GameObject* go_caribou = ObjectAccessor::GetGameObject(*me, go_caribouGUID)) go_caribou->SetLootState(GO_JUST_DEACTIVATED); if (TempSummon* summon = me->ToTempSummon()) @@ -451,7 +453,7 @@ public: if (Player* player = temp->ToPlayer()) player->KilledMonsterCredit(me->GetEntry()); - if (GameObject* go_caribou = me->GetMap()->GetGameObject(go_caribouGUID)) + if (GameObject* go_caribou = ObjectAccessor::GetGameObject(*me, go_caribouGUID)) go_caribou->SetGoState(GO_STATE_READY); } diff --git a/src/server/scripts/Northrend/zone_dalaran.cpp b/src/server/scripts/Northrend/zone_dalaran.cpp index 5a043d3438c..bcb7ce2da9f 100644 --- a/src/server/scripts/Northrend/zone_dalaran.cpp +++ b/src/server/scripts/Northrend/zone_dalaran.cpp @@ -26,6 +26,8 @@ Script Data End */ #include "ScriptMgr.h" #include "DatabaseEnv.h" #include "Mail.h" +#include "Map.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "Player.h" diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp index 2cda3eb3cba..689e60befce 100644 --- a/src/server/scripts/Northrend/zone_dragonblight.cpp +++ b/src/server/scripts/Northrend/zone_dragonblight.cpp @@ -28,6 +28,7 @@ EndContentData */ #include "ScriptMgr.h" #include "CombatAI.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/Northrend/zone_grizzly_hills.cpp b/src/server/scripts/Northrend/zone_grizzly_hills.cpp index 1d17b2ec113..673f298ddab 100644 --- a/src/server/scripts/Northrend/zone_grizzly_hills.cpp +++ b/src/server/scripts/Northrend/zone_grizzly_hills.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "CombatAI.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/Northrend/zone_howling_fjord.cpp b/src/server/scripts/Northrend/zone_howling_fjord.cpp index 598a2fd2745..cef3def3af8 100644 --- a/src/server/scripts/Northrend/zone_howling_fjord.cpp +++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp @@ -28,6 +28,7 @@ npc_apothecary_hanes EndContentData */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index 5834b90f3c6..9659f7d6f70 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "CombatAI.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp index 5a0c42a77be..e0e052c733c 100644 --- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp +++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp @@ -30,6 +30,8 @@ EndContentData */ #include "ScriptMgr.h" #include "CombatAI.h" +#include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Player.h" diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp index 0376ecb259f..2c26c7b242d 100644 --- a/src/server/scripts/Northrend/zone_storm_peaks.cpp +++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "CombatAI.h" #include "GameObject.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedEscortAI.h" @@ -26,6 +27,7 @@ #include "SpellScript.h" #include "TemporarySummon.h" #include "Vehicle.h" +#include "WorldSession.h" ///////////////////// ///npc_injured_goblin diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp index aecda636c2d..b06ab39d9f6 100644 --- a/src/server/scripts/Northrend/zone_wintergrasp.cpp +++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp @@ -18,6 +18,8 @@ #include "Battlefield.h" #include "BattlefieldMgr.h" #include "BattlefieldWG.h" +#include "DB2Stores.h" +#include "GameObject.h" #include "GameObjectAI.h" #include "ObjectMgr.h" #include "Player.h" diff --git a/src/server/scripts/Northrend/zone_zuldrak.cpp b/src/server/scripts/Northrend/zone_zuldrak.cpp index fc7999ed4fd..05176ada874 100644 --- a/src/server/scripts/Northrend/zone_zuldrak.cpp +++ b/src/server/scripts/Northrend/zone_zuldrak.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "GameObject.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index 997ef36406b..00f367efd53 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "Creature.h" +#include "GameObject.h" #include "MapManager.h" #include "ObjectMgr.h" #include "OutdoorPvPNA.h" diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index 07dfe8f00f8..6a3a710aa37 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -19,6 +19,7 @@ #include "DB2Stores.h" #include "GameObject.h" #include "Language.h" +#include "Map.h" #include "ObjectMgr.h" #include "OutdoorPvPSI.h" #include "Player.h" diff --git a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp index e93c0baba2a..6623feead32 100644 --- a/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp +++ b/src/server/scripts/Outland/Auchindoun/ManaTombs/boss_nexusprince_shaffar.cpp @@ -24,6 +24,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "mana_tombs.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" enum Yells diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index 6f2563eb82e..5b8647b6ad1 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -25,6 +25,7 @@ Category: Auchindoun, Shadow Labyrinth #include "ScriptMgr.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 02e5c1ad6e9..2212611f810 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -28,6 +28,7 @@ EndScriptData */ #include "GameObject.h" #include "InstanceScript.h" #include "Log.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "PassiveAI.h" #include "ScriptedCreature.h" @@ -302,7 +303,7 @@ static const Yells Conversation[22] = {0, "", EMPTY, 1000, 0, false} // 21 }; -G3D::Vector3 const HoverPosition[4]= +Position const HoverPosition[4]= { {657.0f, 340.0f, 355.0f}, {657.0f, 275.0f, 355.0f}, @@ -310,7 +311,7 @@ G3D::Vector3 const HoverPosition[4]= {705.0f, 340.0f, 355.0f} }; -G3D::Vector3 const GlaivePosition[4]= +Position const GlaivePosition[4]= { {695.105f, 305.303f, 354.256f}, {659.338f, 305.303f, 354.256f}, // the distance between two glaives is 36 @@ -318,13 +319,13 @@ G3D::Vector3 const GlaivePosition[4]= {664.338f, 305.303f, 354.256f} }; -G3D::Vector3 const EyeBlast[2]= +Position const EyeBlast[2]= { {677.0f, 350.0f, 354.0f}, // start point, pass through glaive point {677.0f, 260.0f, 354.0f} }; -G3D::Vector3 const AkamaWP[13]= +Position const AkamaWP[13]= { {770.01f, 304.50f, 312.29f}, // Bottom of the first stairs, at the doors {780.66f, 304.50f, 319.74f}, // Top of the first stairs @@ -341,7 +342,7 @@ G3D::Vector3 const AkamaWP[13]= {782.01f, 304.55f, 319.76f} // Final location - back at the initial gates. This is where he will fight the minions! (12) }; // 755.762f, 304.0747f, 312.1769f -- This is where Akama should be spawned -G3D::Vector3 const SpiritSpawns[2]= +Position const SpiritSpawns[2]= { {755.5426f, 309.9156f, 312.2129f}, {755.5426f, 298.7923f, 312.0834f} @@ -729,29 +730,29 @@ public: float distx, disty, dist[2]; for (uint8 i = 0; i < 2; ++i) { - distx = EyeBlast[i].x - HoverPosition[HoverPoint].x; - disty = EyeBlast[i].y - HoverPosition[HoverPoint].y; + distx = EyeBlast[i].GetPositionX() - HoverPosition[HoverPoint].GetPositionX(); + disty = EyeBlast[i].GetPositionY() - HoverPosition[HoverPoint].GetPositionY(); dist[i] = distx * distx + disty * disty; } - G3D::Vector3 initial = EyeBlast[dist[0] < dist[1] ? 0 : 1]; + Position const& initial = EyeBlast[dist[0] < dist[1] ? 0 : 1]; for (uint8 i = 0; i < 2; ++i) { - distx = GlaivePosition[i].x - HoverPosition[HoverPoint].x; - disty = GlaivePosition[i].y - HoverPosition[HoverPoint].y; + distx = GlaivePosition[i].GetPositionX() - HoverPosition[HoverPoint].GetPositionX(); + disty = GlaivePosition[i].GetPositionY() - HoverPosition[HoverPoint].GetPositionY(); dist[i] = distx * distx + disty * disty; } - G3D::Vector3 final = GlaivePosition[dist[0] < dist[1] ? 0 : 1]; + Position final = GlaivePosition[dist[0] < dist[1] ? 0 : 1]; - final.x = 2 * final.x - initial.x; - final.y = 2 * final.y - initial.y; + final.m_positionX = 2 * final.GetPositionX() - initial.GetPositionX(); + final.m_positionY = 2 * final.GetPositionY() - initial.GetPositionY(); - Creature* Trigger = me->SummonCreature(23069, initial.x, initial.y, initial.z, 0, TEMPSUMMON_TIMED_DESPAWN, 13000); + Creature* Trigger = me->SummonCreature(23069, initial, TEMPSUMMON_TIMED_DESPAWN, 13000); if (!Trigger) return; Trigger->SetSpeedRate(MOVE_WALK, 3); Trigger->SetWalk(true); - Trigger->GetMotionMaster()->MovePoint(0, final.x, final.y, final.z); + Trigger->GetMotionMaster()->MovePoint(0, final); // Trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetTarget(Trigger->GetGUID()); @@ -766,7 +767,7 @@ public: { if (Creature* glaive = ObjectAccessor::GetCreature(*me, GlaiveGUID[i])) { - if (Creature* flame = me->SummonCreature(FLAME_OF_AZZINOTH, GlaivePosition[i+2].x, GlaivePosition[i+2].y, GlaivePosition[i+2].z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) + if (Creature* flame = me->SummonCreature(FLAME_OF_AZZINOTH, GlaivePosition[i+2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)) { flame->setFaction(me->getFaction()); // Just in case the database has it as a different faction flame->SetMeleeDamageSchool(SPELL_SCHOOL_FIRE); @@ -809,7 +810,7 @@ public: case 3: // throw one glaive { uint8 i=1; - Creature* Glaive = me->SummonCreature(BLADE_OF_AZZINOTH, GlaivePosition[i].x, GlaivePosition[i].y, GlaivePosition[i].z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + Creature* Glaive = me->SummonCreature(BLADE_OF_AZZINOTH, GlaivePosition[i], TEMPSUMMON_CORPSE_DESPAWN, 0); if (Glaive) { GlaiveGUID[i] = Glaive->GetGUID(); @@ -825,7 +826,7 @@ public: SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); { uint8 i=0; - Creature* Glaive = me->SummonCreature(BLADE_OF_AZZINOTH, GlaivePosition[i].x, GlaivePosition[i].y, GlaivePosition[i].z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0); + Creature* Glaive = me->SummonCreature(BLADE_OF_AZZINOTH, GlaivePosition[i], TEMPSUMMON_CORPSE_DESPAWN, 0); if (Glaive) { GlaiveGUID[i] = Glaive->GetGUID(); @@ -842,7 +843,7 @@ public: Timer[EVENT_FLIGHT_SEQUENCE] = 3000; break; case 6: // fly to hover point - me->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint].x, HoverPosition[HoverPoint].y, HoverPosition[HoverPoint].z); + me->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint]); Timer[EVENT_FLIGHT_SEQUENCE] = 0; break; case 7: // return to center @@ -1088,7 +1089,7 @@ public: HoverPoint += (rand32() % 3 + 1); if (HoverPoint > 3) HoverPoint -= 4; - me->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint].x, HoverPosition[HoverPoint].y, HoverPosition[HoverPoint].z); + me->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint]); break; default: @@ -1284,7 +1285,7 @@ public: if (!target || !me->IsWithinDistInMap(target, 80) || illidan->IsWithinDistInMap(target, 20)) { uint8 pos = rand32() % 4; - BlinkTo(HoverPosition[pos].x, HoverPosition[pos].y, HoverPosition[pos].z); + BlinkTo(HoverPosition[pos].GetPositionX(), HoverPosition[pos].GetPositionY(), HoverPosition[pos].GetPositionZ()); } else { @@ -1519,7 +1520,7 @@ public: } for (uint8 i = 0; i < 2; ++i) - if (Creature* Spirit = me->SummonCreature(i ? SPIRIT_OF_OLUM : SPIRIT_OF_UDALO, SpiritSpawns[i].x, SpiritSpawns[i].y, SpiritSpawns[i].z, 0, TEMPSUMMON_TIMED_DESPAWN, 20000)) + if (Creature* Spirit = me->SummonCreature(i ? SPIRIT_OF_OLUM : SPIRIT_OF_UDALO, SpiritSpawns[i], TEMPSUMMON_TIMED_DESPAWN, 20000)) { Spirit->SetVisible(false); SpiritGUID[i] = Spirit->GetGUID(); @@ -1530,7 +1531,7 @@ public: { me->SetWalk(false); me->SetSpeedRate(MOVE_RUN, 1.0f); - me->GetMotionMaster()->MovePoint(0, AkamaWP[WalkCount].x, AkamaWP[WalkCount].y, AkamaWP[WalkCount].z); + me->GetMotionMaster()->MovePoint(0, AkamaWP[WalkCount]); } void EnterPhase(PhaseAkama NextPhase) @@ -1697,7 +1698,7 @@ public: { Timer = 0; ++WalkCount; - me->GetMotionMaster()->MovePoint(WalkCount, AkamaWP[WalkCount].x, AkamaWP[WalkCount].y, AkamaWP[WalkCount].z); + me->GetMotionMaster()->MovePoint(WalkCount, AkamaWP[WalkCount]); } } diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp index 665eda75aed..dc2540c4569 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp @@ -24,6 +24,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "black_temple.h" +#include "Containers.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" @@ -83,7 +84,7 @@ uint32 PrismaticAuras[]= 40897, // Holy }; -G3D::Vector3 const TeleportPoint[]= +Position const TeleportPoint[]= { {959.996f, 212.576f, 193.843f}, {932.537f, 231.813f, 193.838f}, @@ -150,10 +151,10 @@ public: void TeleportPlayers() { - uint32 random = urand(0, 6); - float X = TeleportPoint[random].x; - float Y = TeleportPoint[random].y; - float Z = TeleportPoint[random].z; + Position const& random = Trinity::Containers::SelectRandomContainerElement(TeleportPoint); + float X = random.GetPositionX(); + float Y = random.GetPositionY(); + float Z = random.GetPositionZ(); for (uint8 i = 0; i < 3; ++i) { if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 1)) diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp index 76d57cf2e16..0d8673a4f02 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "black_temple.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "Spell.h" diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index d4978d249ec..8b78b1eb015 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -19,6 +19,7 @@ #include "black_temple.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "PassiveAI.h" #include "Player.h" diff --git a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp index 425d63c0287..9bc295a1837 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "black_temple.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "PassiveAI.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index d8cd53916ae..a057dce7426 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "black_temple.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "TemporarySummon.h" diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp index b3685b3af0a..4c9cc9acb7c 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "black_temple.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellScript.h" diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp index 8d31ebe63e5..ca3e4481597 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedEscortAI.h" #include "serpent_shrine.h" diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index 7cb504351cf..a8f8986d638 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index d82bd4e38d1..2eb22dee56d 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index e2fd8409805..eec7e62ac93 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -27,6 +27,7 @@ EndScriptData */ #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" +#include "MotionMaster.h" #include "Player.h" #include "ScriptedCreature.h" #include "serpent_shrine.h" diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp index db5acbaa61b..6e8479a0ff5 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/boss_ahune.cpp @@ -22,6 +22,7 @@ #include "InstanceScript.h" #include "LFGMgr.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedGossip.h" diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp index b7dc8b81bb9..ac40dad3ca8 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "gruuls_lair.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" #include "SpellInfo.h" #include "SpellScript.h" diff --git a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp index 055fc4d6e30..3fef7b2f637 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "gruuls_lair.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index 7f28650c9b8..f22ec0678e3 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "hellfire_ramparts.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp index a052fd941fc..c4f3dc16ea7 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/boss_warchief_kargath_bladefist.cpp @@ -29,6 +29,7 @@ EndContentData */ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "shattered_halls.h" diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index cfaa9ff8b45..72f9cf39d51 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index 9736d61d44e..2cc8e08632e 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellAuras.h" diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index b624b614ac8..b4390690c59 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "GameObject.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp index a3be06dd188..e2f340dc69c 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp @@ -26,6 +26,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "InstanceScript.h" #include "mechanar.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" enum Says diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp index 8771b8a5af5..ccff8828ab5 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp @@ -32,6 +32,7 @@ EndContentData */ #include "ScriptMgr.h" #include "arcatraz.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" /*##### diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp index 4232d6efdc9..561dbaa8c5a 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_wrath_scryer_soccothrates.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "arcatraz.h" #include "InstanceScript.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp index 3ba08006940..204a52609b0 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_high_botanist_freywinn.cpp @@ -24,6 +24,7 @@ SDCategory: Tempest Keep, The Botanica EndScriptData */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "the_botanica.h" diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp index 21ac858cb6b..07c4914b39a 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp @@ -24,6 +24,7 @@ SDCategory: Tempest Keep, The Botanica EndScriptData */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "TemporarySummon.h" diff --git a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp index 42783ce2953..6e6188a6ebc 100644 --- a/src/server/scripts/Outland/zone_blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/zone_blades_edge_mountains.cpp @@ -34,6 +34,7 @@ EndContentData */ #include "CreatureAIImpl.h" #include "GameObject.h" #include "GridNotifiersImpl.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp index 439a07161fc..78046580f46 100644 --- a/src/server/scripts/Outland/zone_hellfire_peninsula.cpp +++ b/src/server/scripts/Outland/zone_hellfire_peninsula.cpp @@ -32,6 +32,7 @@ EndContentData */ #include "ScriptMgr.h" #include "Log.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "QuestDef.h" diff --git a/src/server/scripts/Outland/zone_nagrand.cpp b/src/server/scripts/Outland/zone_nagrand.cpp index bddbc07a8e5..4363c8c6ebb 100644 --- a/src/server/scripts/Outland/zone_nagrand.cpp +++ b/src/server/scripts/Outland/zone_nagrand.cpp @@ -30,6 +30,7 @@ EndContentData */ #include "ScriptMgr.h" #include "GameObject.h" +#include "MotionMaster.h" #include "Player.h" #include "QuestDef.h" #include "ScriptedEscortAI.h" diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index d216e08ece7..e4050ef6da6 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -39,6 +39,7 @@ EndContentData */ #include "ScriptMgr.h" #include "GameObject.h" #include "Group.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "QuestDef.h" diff --git a/src/server/scripts/Outland/zone_shattrath_city.cpp b/src/server/scripts/Outland/zone_shattrath_city.cpp index 9342417acdc..edc8318068c 100644 --- a/src/server/scripts/Outland/zone_shattrath_city.cpp +++ b/src/server/scripts/Outland/zone_shattrath_city.cpp @@ -35,6 +35,7 @@ EndContentData */ #include "Player.h" #include "ScriptedGossip.h" #include "ScriptedEscortAI.h" +#include "WorldSession.h" /*###### ## npc_raliq_the_drunk diff --git a/src/server/scripts/Outland/zone_terokkar_forest.cpp b/src/server/scripts/Outland/zone_terokkar_forest.cpp index 98752c1eb1e..2269752087a 100644 --- a/src/server/scripts/Outland/zone_terokkar_forest.cpp +++ b/src/server/scripts/Outland/zone_terokkar_forest.cpp @@ -38,6 +38,7 @@ EndContentData */ #include "Player.h" #include "ScriptedEscortAI.h" #include "ScriptedGossip.h" +#include "WorldSession.h" /*###### ## npc_unkor_the_ruthless diff --git a/src/server/scripts/Pet/pet_dk.cpp b/src/server/scripts/Pet/pet_dk.cpp index 9f475ddf9c3..4b77d8a33a5 100644 --- a/src/server/scripts/Pet/pet_dk.cpp +++ b/src/server/scripts/Pet/pet_dk.cpp @@ -24,6 +24,7 @@ #include "CellImpl.h" #include "CombatAI.h" #include "GridNotifiersImpl.h" +#include "MotionMaster.h" #include "ScriptedCreature.h" #include "SpellInfo.h" diff --git a/src/server/scripts/Pet/pet_generic.cpp b/src/server/scripts/Pet/pet_generic.cpp index 1ac60ba3405..0127262f55e 100644 --- a/src/server/scripts/Pet/pet_generic.cpp +++ b/src/server/scripts/Pet/pet_generic.cpp @@ -30,6 +30,7 @@ #include "ScriptMgr.h" #include "DB2Structure.h" #include "Map.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "PassiveAI.h" #include "PetDefines.h" diff --git a/src/server/scripts/Pet/pet_mage.cpp b/src/server/scripts/Pet/pet_mage.cpp index 43ffddeca5d..66cc7894215 100644 --- a/src/server/scripts/Pet/pet_mage.cpp +++ b/src/server/scripts/Pet/pet_mage.cpp @@ -24,6 +24,7 @@ #include "CellImpl.h" #include "CombatAI.h" #include "GridNotifiersImpl.h" +#include "MotionMaster.h" #include "Pet.h" #include "PetAI.h" #include "Player.h" diff --git a/src/server/scripts/World/action_ip_logger.cpp b/src/server/scripts/World/action_ip_logger.cpp index 8ab65038028..24e0d636b7c 100644 --- a/src/server/scripts/World/action_ip_logger.cpp +++ b/src/server/scripts/World/action_ip_logger.cpp @@ -18,6 +18,7 @@ #include "ScriptMgr.h" #include "DatabaseEnv.h" #include "Player.h" +#include "WorldSession.h" enum IPLoggingTypes { diff --git a/src/server/scripts/World/areatrigger_scripts.cpp b/src/server/scripts/World/areatrigger_scripts.cpp index 45a42835858..543dd432668 100644 --- a/src/server/scripts/World/areatrigger_scripts.cpp +++ b/src/server/scripts/World/areatrigger_scripts.cpp @@ -36,7 +36,9 @@ at_area_52_entrance EndContentData */ #include "ScriptMgr.h" +#include "DB2Structure.h" #include "GameObject.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ScriptedCreature.h" #include "Player.h" diff --git a/src/server/scripts/World/boss_emerald_dragons.cpp b/src/server/scripts/World/boss_emerald_dragons.cpp index ab490ec4a59..b7e6380f769 100644 --- a/src/server/scripts/World/boss_emerald_dragons.cpp +++ b/src/server/scripts/World/boss_emerald_dragons.cpp @@ -17,6 +17,7 @@ */ #include "ScriptMgr.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "PassiveAI.h" #include "ScriptedCreature.h" diff --git a/src/server/scripts/World/duel_reset.cpp b/src/server/scripts/World/duel_reset.cpp index ba746a498f3..f98ff6c8226 100644 --- a/src/server/scripts/World/duel_reset.cpp +++ b/src/server/scripts/World/duel_reset.cpp @@ -18,7 +18,9 @@ #include "ScriptMgr.h" #include "Player.h" #include "Pet.h" +#include "SpellHistory.h" #include "SpellInfo.h" +#include "SpellMgr.h" #include "World.h" class DuelResetScript : public PlayerScript diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 835407a0a4e..026d213478d 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -45,13 +45,16 @@ go_toy_train_set EndContentData */ #include "ScriptMgr.h" +#include "DB2Structure.h" #include "GameObject.h" #include "GameObjectAI.h" #include "Log.h" +#include "MotionMaster.h" #include "Player.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "TemporarySummon.h" +#include "WorldSession.h" /*###### ## go_cat_figurine diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp index 7ff2a090353..23035547835 100644 --- a/src/server/scripts/World/guards.cpp +++ b/src/server/scripts/World/guards.cpp @@ -31,6 +31,7 @@ EndContentData */ #include "ScriptMgr.h" #include "GuardAI.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "Player.h" #include "SpellInfo.h" diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index 57fd0e34176..04ce1037cfe 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -24,11 +24,13 @@ SDCategory: NPCs EndScriptData */ #include "ScriptMgr.h" +#include "Item.h" #include "Log.h" #include "Player.h" #include "ScriptedCreature.h" #include "ScriptedGossip.h" #include "SpellInfo.h" +#include "SpellMgr.h" #include "WorldSession.h" /* diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 2d42afd23ff..dbbfd8a1f01 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -24,6 +24,7 @@ #include "GameObjectAI.h" #include "GridNotifiersImpl.h" #include "Log.h" +#include "MotionMaster.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "PassiveAI.h" @@ -34,6 +35,7 @@ #include "SpellAuras.h" #include "SpellHistory.h" #include "SpellInfo.h" +#include "SpellMgr.h" #include "TemporarySummon.h" /*######## @@ -2035,10 +2037,10 @@ public: break; } - const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId); - - if (spellInfo && spellInfo->GetEffect(EFFECT_0)->Effect == SPELL_EFFECT_SUMMON_OBJECT_WILD) - return spellInfo->GetEffect(EFFECT_0)->MiscValue; + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId)) + if (SpellEffectInfo const* effect0 = spellInfo->GetEffect(EFFECT_0)) + if (effect0->Effect == SPELL_EFFECT_SUMMON_OBJECT_WILD) + return effect0->MiscValue; return 0; } diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index 37314e9136c..ce233bd8e02 100644 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -97,9 +97,7 @@ void utf8print(void* /*arg*/, const char* str) if (!Utf8toWStr(str, strlen(str), wtemp_buf, wtemp_len)) return; - char temp_buf[6000]; - CharToOemBuffW(&wtemp_buf[0], &temp_buf[0], wtemp_len+1); - printf(temp_buf); + wprintf(L"%s", wtemp_buf); #else { printf("%s", str); |