diff options
Diffstat (limited to 'src/server/game')
80 files changed, 741 insertions, 616 deletions
diff --git a/src/server/game/AI/CoreAI/GameObjectAI.h b/src/server/game/AI/CoreAI/GameObjectAI.h index 195f8d19c86..4561aa92741 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.h +++ b/src/server/game/AI/CoreAI/GameObjectAI.h @@ -42,7 +42,7 @@ class GameObjectAI // Pass parameters between AI virtual void DoAction(const int32 /*param = 0 */) {} virtual void SetGUID(uint64 /*guid*/, int32 /*id = 0 */) {} - virtual uint64 GetGUID(int32 /*id = 0 */) { return 0; } + virtual uint64 GetGUID(int32 /*id = 0 */) const { return 0; } static int Permissible(GameObject const* go); @@ -53,9 +53,9 @@ class GameObjectAI virtual bool QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; } virtual uint32 GetDialogStatus(Player* /*player*/) { return 100; } virtual void Destroyed(Player* /*player*/, uint32 /*eventId*/) {} - virtual uint32 GetData(uint32 /*id*/) { return 0; } + virtual uint32 GetData(uint32 /*id*/) const { return 0; } virtual void SetData64(uint32 /*id*/, uint64 /*value*/) {} - virtual uint64 GetData64(uint32 /*id*/) { return 0; } + virtual uint64 GetData64(uint32 /*id*/) const { return 0; } virtual void SetData(uint32 /*id*/, uint32 /*value*/) {} virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) {} virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) {} diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index b07c766ae0b..2eab0e89fcd 100755 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -24,8 +24,9 @@ #include "Containers.h" #include <list> -class Unit; class Player; +class Quest; +class Unit; struct AISpellInfoType; // Default script texts @@ -146,10 +147,10 @@ class UnitAI // Pass parameters between AI virtual void DoAction(int32 const /*param*/) {} - virtual uint32 GetData(uint32 /*id = 0*/) { return 0; } + virtual uint32 GetData(uint32 /*id = 0*/) const { return 0; } virtual void SetData(uint32 /*id*/, uint32 /*value*/) {} virtual void SetGUID(uint64 /*guid*/, int32 /*id*/ = 0) {} - virtual uint64 GetGUID(int32 /*id*/ = 0) { return 0; } + virtual uint64 GetGUID(int32 /*id*/ = 0) const { return 0; } Unit* SelectTarget(SelectAggroTarget targetType, uint32 position = 0, float dist = 0.0f, bool playerOnly = false, int32 aura = 0); // Select the targets satifying the predicate. diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 200b868670b..ac74cacf2c5 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -77,17 +77,13 @@ void SummonList::RemoveNotExisting() } } -bool SummonList::HasEntry(uint32 entry) +bool SummonList::HasEntry(uint32 entry) const { - for (iterator i = begin(); i != end();) + for (const_iterator i = begin(); i != end(); ++i) { Creature* summon = Unit::GetCreature(*me, *i); - if (!summon) - erase(i++); - else if (summon->GetEntry() == entry) + if (summon && summon->GetEntry() == entry) return true; - else - ++i; } return false; diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index aa46d555b7d..2a221d04404 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -54,7 +54,7 @@ class SummonList : public std::list<uint64> void DoZoneInCombat(uint32 entry = 0); void RemoveNotExisting(); - bool HasEntry(uint32 entry); + bool HasEntry(uint32 entry) const; private: Creature* me; }; diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 7dd4053b82f..6aebcbb2d8a 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -698,7 +698,7 @@ void SmartAI::DoAction(const int32 param) GetScript()->ProcessEventsFor(SMART_EVENT_ACTION_DONE, NULL, param); } -uint32 SmartAI::GetData(uint32 /*id*/) +uint32 SmartAI::GetData(uint32 /*id*/) const { return 0; } @@ -712,7 +712,7 @@ void SmartAI::SetGUID(uint64 /*guid*/, int32 /*id*/) { } -uint64 SmartAI::GetGUID(int32 /*id*/) +uint64 SmartAI::GetGUID(int32 /*id*/) const { return 0; } diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index f81d6e86850..6f748f9dee2 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -22,7 +22,6 @@ #include "Creature.h" #include "CreatureAI.h" #include "Unit.h" -#include "ConditionMgr.h" #include "Spell.h" #include "SmartScript.h" @@ -151,7 +150,7 @@ class SmartAI : public CreatureAI void DoAction(const int32 param = 0); // Used in scripts to share variables - uint32 GetData(uint32 id = 0); + uint32 GetData(uint32 id = 0) const; // Used in scripts to share variables void SetData(uint32 id, uint32 value); @@ -160,7 +159,7 @@ class SmartAI : public CreatureAI void SetGUID(uint64 guid, int32 id = 0); // Used in scripts to share variables - uint64 GetGUID(int32 id = 0); + uint64 GetGUID(int32 id = 0) const; //core related static int Permissible(const Creature*); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index b8c0f952df9..a22978632fe 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -15,25 +15,25 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "Cell.h" +#include "CellImpl.h" +#include "CreatureTextMgr.h" #include "DatabaseEnv.h" -#include "ObjectMgr.h" -#include "ObjectDefines.h" +#include "GossipDef.h" #include "GridDefines.h" #include "GridNotifiers.h" -#include "SpellMgr.h" #include "GridNotifiersImpl.h" -#include "Cell.h" -#include "CellImpl.h" +#include "Group.h" #include "InstanceScript.h" +#include "Language.h" +#include "ObjectDefines.h" +#include "ObjectMgr.h" #include "ScriptedCreature.h" -#include "GossipDef.h" -#include "ScriptedCreature.h" -#include "SmartScript.h" +#include "ScriptedGossip.h" #include "SmartAI.h" -#include "Group.h" +#include "SmartScript.h" +#include "SpellMgr.h" #include "Vehicle.h" -#include "ScriptedGossip.h" -#include "CreatureTextMgr.h" class TrinityStringTextBuilder { diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index 2a0eceb574a..61e22b25d17 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -22,7 +22,6 @@ #include "Creature.h" #include "CreatureAI.h" #include "Unit.h" -#include "ConditionMgr.h" #include "Spell.h" #include "GridNotifiers.h" diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index 2b67acfd6d0..a82de501ea6 100755 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -22,6 +22,7 @@ #include "Player.h" #include "Util.h" #include "SHA1.h" +#include "WorldSession.h" namespace AccountMgr { diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index e5ab02c897e..dc7d7caaf19 100644 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -17,29 +17,31 @@ */ #include "AchievementMgr.h" -#include "Common.h" -#include "DBCEnums.h" -#include "ObjectMgr.h" -#include "ArenaTeamMgr.h" -#include "GuildMgr.h" -#include "World.h" -#include "WorldPacket.h" -#include "DatabaseEnv.h" #include "ArenaTeam.h" +#include "ArenaTeamMgr.h" +#include "BattlegroundAB.h" +#include "Battleground.h" #include "CellImpl.h" +#include "Common.h" +#include "DatabaseEnv.h" +#include "DBCEnums.h" +#include "DisableMgr.h" #include "GameEventMgr.h" #include "GridNotifiersImpl.h" +#include "Group.h" #include "Guild.h" +#include "GuildMgr.h" +#include "InstanceScript.h" #include "Language.h" +#include "Map.h" +#include "MapManager.h" +#include "ObjectMgr.h" #include "Player.h" -#include "SpellMgr.h" -#include "DisableMgr.h" +#include "ReputationMgr.h" #include "ScriptMgr.h" -#include "MapManager.h" -#include "Battleground.h" -#include "Map.h" -#include "InstanceScript.h" -#include "Group.h" +#include "SpellMgr.h" +#include "World.h" +#include "WorldPacket.h" namespace Trinity { diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index f6b3d133cb9..968e1eea7f1 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -592,12 +592,12 @@ bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player) //-------------------- //-Battlefield Method- //-------------------- -BfGraveyard* Battlefield::GetGraveyardById(uint32 id) +BfGraveyard* Battlefield::GetGraveyardById(uint32 id) const { if (id < m_GraveyardList.size()) { - if (m_GraveyardList[id]) - return m_GraveyardList[id]; + if (BfGraveyard* graveyard = m_GraveyardList.at(id)) + return graveyard; else sLog->outError(LOG_FILTER_BATTLEFIELD, "Battlefield::GetGraveyardById Id:%u not existed", id); } diff --git a/src/server/game/Battlefield/Battlefield.h b/src/server/game/Battlefield/Battlefield.h index 7bd893e3e56..bcadc877eea 100644 --- a/src/server/game/Battlefield/Battlefield.h +++ b/src/server/game/Battlefield/Battlefield.h @@ -148,7 +148,7 @@ class BfGraveyard // Method to changing who controls the graveyard void GiveControlTo(TeamId team); - TeamId GetControlTeamId() { return m_ControlTeam; } + TeamId GetControlTeamId() const { return m_ControlTeam; } // Find the nearest graveyard to a player float GetDistance(Player* player); @@ -188,7 +188,7 @@ class BfGraveyard bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); } // Get the graveyard's ID. - uint32 GetGraveyardId() { return m_GraveyardId; } + uint32 GetGraveyardId() const { return m_GraveyardId; } protected: TeamId m_ControlTeam; @@ -262,11 +262,11 @@ class Battlefield : public ZoneScript void HandlePlayerLeaveZone(Player* player, uint32 zone); // All-purpose data storage 64 bit - virtual uint64 GetData64(uint32 dataId) { return m_Data64[dataId]; } + virtual uint64 GetData64(uint32 dataId) const { return m_Data64[dataId]; } virtual void SetData64(uint32 dataId, uint64 value) { m_Data64[dataId] = value; } // All-purpose data storage 32 bit - virtual uint32 GetData(uint32 dataId) { return m_Data32[dataId]; } + virtual uint32 GetData(uint32 dataId) const { return m_Data32[dataId]; } virtual void SetData(uint32 dataId, uint32 value) { m_Data32[dataId] = value; } virtual void UpdateData(uint32 index, int32 pad) { m_Data32[index] += pad; } @@ -294,7 +294,7 @@ class Battlefield : public ZoneScript virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid); void RemovePlayerFromResurrectQueue(uint64 player_guid); void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); } - BfGraveyard* GetGraveyardById(uint32 id); + BfGraveyard* GetGraveyardById(uint32 id) const; // Misc methods Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team); diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp index 98833589d00..0865df03d34 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.cpp +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.cpp @@ -20,11 +20,15 @@ // TODO: Use spell victory/defeat in wg instead of RewardMarkOfHonor() && RewardHonor // TODO: Add proper implement of achievement -#include "ObjectMgr.h" #include "BattlefieldWG.h" +#include "AchievementMgr.h" +#include "ObjectMgr.h" +#include "Opcodes.h" +#include "Player.h" #include "SpellAuras.h" +#include "TemporarySummon.h" #include "Vehicle.h" -#include "Player.h" +#include "WorldSession.h" enum WGVehicles { @@ -454,7 +458,7 @@ void BattlefieldWG::OnStartGrouping() SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START); } -uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) +uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) const { switch (areaId) { @@ -802,7 +806,7 @@ void BattlefieldWG::OnPlayerEnterZone(Player* player) SendInitWorldStatesTo(player); } -uint32 BattlefieldWG::GetData(uint32 data) +uint32 BattlefieldWG::GetData(uint32 data) const { switch (data) { @@ -813,8 +817,8 @@ uint32 BattlefieldWG::GetData(uint32 data) case AREA_WESTPARK_WORKSHOP: case AREA_EASTPARK_WORKSHOP: // Graveyards and Workshops are controlled by the same team. - if (m_GraveyardList[GetSpiritGraveyardId(data)]) - return m_GraveyardList[GetSpiritGraveyardId(data)]->GetControlTeamId(); + if (BfGraveyard const* graveyard = GetGraveyardById(GetSpiritGraveyardId(data))) + return graveyard->GetControlTeamId(); } return Battlefield::GetData(data); diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index 0a81a7af992..bd616167e8b 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -22,6 +22,7 @@ #include "ObjectAccessor.h" #include "WorldPacket.h" #include "Battlefield.h" +#include "World.h" class Group; class BattlefieldWG; @@ -410,9 +411,9 @@ class BattlefieldWG : public Battlefield bool FindAndRemoveVehicleFromList(Unit* vehicle); // returns the graveyardId in the specified area. - uint8 GetSpiritGraveyardId(uint32 areaId); + uint8 GetSpiritGraveyardId(uint32 areaId) const; - uint32 GetData(uint32 data); + uint32 GetData(uint32 data) const; protected: bool m_isRelicInteractible; diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 4cfe069960d..7889d5caf65 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -23,6 +23,8 @@ #include "Group.h" #include "ArenaTeamMgr.h" #include "Player.h" +#include "WorldSession.h" +#include "Opcodes.h" ArenaTeam::ArenaTeam() : TeamId(0), Type(0), TeamName(), CaptainGuid(0), BackgroundColor(0), EmblemStyle(0), EmblemColor(0), diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 13d434ff0e9..d1165456abb 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -16,26 +16,26 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "Player.h" -#include "ObjectMgr.h" -#include "ArenaTeamMgr.h" -#include "World.h" -#include "WorldPacket.h" #include "ArenaTeam.h" +#include "ArenaTeamMgr.h" #include "Battleground.h" #include "BattlegroundMgr.h" #include "Creature.h" #include "Formulas.h" #include "GridNotifiersImpl.h" #include "Group.h" -#include "Language.h" +#include "Guild.h" +#include "GuildMgr.h" #include "MapManager.h" #include "Object.h" -#include "SpellAuras.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "ReputationMgr.h" #include "SpellAuraEffects.h" +#include "SpellAuras.h" #include "Util.h" -#include "Guild.h" -#include "GuildMgr.h" +#include "World.h" +#include "WorldPacket.h" namespace Trinity { diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 323bc3fa1d2..13aed749a49 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -46,6 +46,7 @@ #include "SharedDefines.h" #include "Formulas.h" #include "DisableMgr.h" +#include "Opcodes.h" /*********************************************************/ /*** BATTLEGROUND MANAGER ***/ diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index 43865b5ec8e..d298e972b44 100755 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -16,14 +16,15 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "BattlegroundQueue.h" #include "ArenaTeam.h" +#include "ArenaTeamMgr.h" #include "BattlegroundMgr.h" +#include "BattlegroundQueue.h" #include "Chat.h" -#include "ObjectMgr.h" -#include "ArenaTeamMgr.h" -#include "Log.h" #include "Group.h" +#include "Log.h" +#include "Language.h" +#include "ObjectMgr.h" #include "Player.h" /*********************************************************/ diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 8f7231ba66e..47320db27cf 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -26,6 +26,7 @@ #include "Object.h" #include "Player.h" #include "Util.h" +#include "WorldSession.h" BattlegroundAB::BattlegroundAB() { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 95aa0308c7d..918cef4d261 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -21,11 +21,12 @@ #include "ObjectMgr.h" #include "WorldPacket.h" -#include "Miscellaneous/Formulas.h" +#include "Formulas.h" #include "GameObject.h" -#include "Miscellaneous/Language.h" +#include "Language.h" #include "Player.h" #include "SpellAuras.h" +#include "WorldSession.h" BattlegroundAV::BattlegroundAV() { @@ -1707,4 +1708,4 @@ uint32 BattlegroundAV::GetPrematureWinner() return HORDE; return Battleground::GetPrematureWinner(); -}
\ No newline at end of file +} diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index a64184261c7..02c5167c9ec 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -17,11 +17,12 @@ */ #include "BattlegroundDS.h" -#include "ObjectAccessor.h" +#include "Creature.h" +#include "GameObject.h" #include "Language.h" +#include "ObjectAccessor.h" #include "Player.h" #include "WorldPacket.h" -#include "GameObject.h" BattlegroundDS::BattlegroundDS() { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index fe3f214ebe5..c3e8de40fa9 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -25,6 +25,7 @@ #include "ObjectMgr.h" #include "Vehicle.h" #include "Transport.h" +#include "WorldSession.h" BattlegroundIC::BattlegroundIC() { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index 12eb68b33af..fc87c329caa 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -22,6 +22,7 @@ #include "GameObject.h" #include "ObjectMgr.h" #include "WorldPacket.h" +#include "WorldSession.h" BattlegroundSA::BattlegroundSA() { diff --git a/src/server/game/Calendar/CalendarMgr.cpp b/src/server/game/Calendar/CalendarMgr.cpp index 1955eaa63aa..9f4816d6c7c 100644 --- a/src/server/game/Calendar/CalendarMgr.cpp +++ b/src/server/game/Calendar/CalendarMgr.cpp @@ -22,6 +22,7 @@ #include "Player.h" #include "GuildMgr.h" #include "ObjectAccessor.h" +#include "Opcodes.h" CalendarInvite::~CalendarInvite() { @@ -44,8 +45,8 @@ CalendarMgr::~CalendarMgr() void CalendarMgr::LoadFromDB() { uint32 count = 0; - _maxEventId = 1; - _maxInviteId = 1; + _maxEventId = 0; + _maxInviteId = 0; // 0 1 2 3 4 5 6 7 8 if (QueryResult result = CharacterDatabase.Query("SELECT id, creator, title, description, type, dungeon, eventtime, flags, time2 FROM calendar_events")) diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp index 66111e5a6db..4c1db28c18b 100755 --- a/src/server/game/Chat/Channels/ChannelMgr.cpp +++ b/src/server/game/Chat/Channels/ChannelMgr.cpp @@ -19,6 +19,7 @@ #include "ChannelMgr.h" #include "Player.h" #include "World.h" +#include "WorldSession.h" ChannelMgr::~ChannelMgr() { diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 9f4fc78d879..3b825a7b8f0 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -16,15 +16,17 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "Player.h" -#include "SpellAuras.h" -#include "SpellMgr.h" +#include "ConditionMgr.h" +#include "AchievementMgr.h" #include "GameEventMgr.h" -#include "ObjectMgr.h" #include "InstanceScript.h" -#include "ConditionMgr.h" -#include "ScriptMgr.h" +#include "ObjectMgr.h" +#include "Player.h" +#include "ReputationMgr.h" #include "ScriptedCreature.h" +#include "ScriptMgr.h" +#include "SpellAuras.h" +#include "SpellMgr.h" #include "Spell.h" // Checks if object meets the condition diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 9d14bde1586..f8f40972337 100755 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -19,7 +19,11 @@ #ifndef TRINITY_CONDITIONMGR_H #define TRINITY_CONDITIONMGR_H +#include "Define.h" +#include "Errors.h" #include <ace/Singleton.h> +#include <list> +#include <map> class Player; class Unit; diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index 6c499645e39..b544e966084 100755 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -17,6 +17,7 @@ */ #include "DisableMgr.h" +#include "AchievementMgr.h" #include "ObjectMgr.h" #include "OutdoorPvP.h" #include "SpellMgr.h" diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index c91be00080e..41d3b540089 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -21,6 +21,7 @@ #include "DisableMgr.h" #include "ObjectMgr.h" #include "SocialMgr.h" +#include "Language.h" #include "LFGMgr.h" #include "LFGScripts.h" #include "LFGGroupData.h" @@ -30,6 +31,7 @@ #include "Player.h" #include "GroupMgr.h" #include "GameEventMgr.h" +#include "WorldSession.h" LFGMgr::LFGMgr(): m_QueueTimer(0), m_lfgProposalId(1), m_options(sWorld->getIntConfig(CONFIG_LFG_OPTIONSMASK)) diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index 91314e64285..930367a0745 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -27,6 +27,7 @@ #include "LFGMgr.h" #include "ScriptMgr.h" #include "ObjectAccessor.h" +#include "WorldSession.h" LFGPlayerScript::LFGPlayerScript() : PlayerScript("LFGPlayerScript") { diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index a1297391a08..37f723f5c1f 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -16,40 +16,42 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "BattlegroundMgr.h" +#include "CellImpl.h" #include "Common.h" -#include "DatabaseEnv.h" -#include "WorldPacket.h" -#include "World.h" -#include "ObjectMgr.h" -#include "GroupMgr.h" -#include "SpellMgr.h" -#include "Creature.h" -#include "QuestDef.h" -#include "GossipDef.h" -#include "Player.h" -#include "PoolMgr.h" -#include "Opcodes.h" -#include "Log.h" -#include "LootMgr.h" -#include "MapManager.h" #include "CreatureAI.h" #include "CreatureAISelector.h" +#include "CreatureGroups.h" +#include "Creature.h" +#include "DatabaseEnv.h" #include "Formulas.h" -#include "WaypointMovementGenerator.h" -#include "InstanceScript.h" -#include "BattlegroundMgr.h" -#include "Util.h" +#include "GameEventMgr.h" +#include "GossipDef.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" -#include "CellImpl.h" -#include "OutdoorPvPMgr.h" -#include "GameEventMgr.h" -#include "CreatureGroups.h" -#include "Vehicle.h" -#include "SpellAuraEffects.h" #include "Group.h" -#include "MoveSplineInit.h" +#include "GroupMgr.h" +#include "InstanceScript.h" +#include "Log.h" +#include "LootMgr.h" +#include "MapManager.h" #include "MoveSpline.h" +#include "MoveSplineInit.h" +#include "ObjectMgr.h" +#include "Opcodes.h" +#include "OutdoorPvPMgr.h" +#include "Player.h" +#include "PoolMgr.h" +#include "QuestDef.h" +#include "SpellAuraEffects.h" +#include "SpellMgr.h" +#include "TemporarySummon.h" +#include "Util.h" +#include "Vehicle.h" +#include "WaypointMovementGenerator.h" +#include "World.h" +#include "WorldPacket.h" + // apply implementation of the singletons TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index f01953a5441..6be78ec2fb5 100755 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -27,6 +27,8 @@ #include "ScriptMgr.h" #include "ConditionMgr.h" #include "Player.h" +#include "Opcodes.h" +#include "WorldSession.h" void AddItemsSetItem(Player* player, Item* item) { diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 6da9bde6d16..30f64b0b30e 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2512,119 +2512,6 @@ TempSummon* WorldObject::SummonCreature(uint32 entry, const Position &pos, TempS return NULL; } -Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 duration) -{ - Pet* pet = new Pet(this, petType); - - if (petType == SUMMON_PET && pet->LoadPetFromDB(this, entry)) - { - // Remove Demonic Sacrifice auras (known pet) - Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();) - { - if ((*itr)->GetMiscValue() == 2228) - { - RemoveAurasDueToSpell((*itr)->GetId()); - itr = auraClassScripts.begin(); - } - else - ++itr; - } - - if (duration > 0) - pet->SetDuration(duration); - - return NULL; - } - - // petentry == 0 for hunter "call pet" (current pet summoned if any) - if (!entry) - { - delete pet; - return NULL; - } - - pet->Relocate(x, y, z, ang); - if (!pet->IsPositionValid()) - { - sLog->outError(LOG_FILTER_GENERAL, "Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY()); - delete pet; - return NULL; - } - - Map* map = GetMap(); - uint32 pet_number = sObjectMgr->GeneratePetNumber(); - if (!pet->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PET), map, GetPhaseMask(), entry, pet_number)) - { - sLog->outError(LOG_FILTER_GENERAL, "no such creature entry %u", entry); - delete pet; - return NULL; - } - - pet->SetCreatorGUID(GetGUID()); - pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction()); - - pet->setPowerType(POWER_MANA); - pet->SetUInt32Value(UNIT_NPC_FLAGS, 0); - pet->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - pet->InitStatsForLevel(getLevel()); - - SetMinion(pet, true); - - switch (petType) - { - case SUMMON_PET: - // this enables pet details window (Shift+P) - pet->GetCharmInfo()->SetPetNumber(pet_number, true); - pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048); - pet->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); - pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); - pet->SetFullHealth(); - pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA)); - pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped in this case - break; - default: - break; - } - - map->AddToMap(pet->ToCreature()); - - switch (petType) - { - case SUMMON_PET: - pet->InitPetCreateSpells(); - pet->InitTalentForLevel(); - pet->SavePetToDB(PET_SAVE_AS_CURRENT); - PetSpellInitialize(); - break; - default: - break; - } - - if (petType == SUMMON_PET) - { - // Remove Demonic Sacrifice auras (known pet) - Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); - for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();) - { - if ((*itr)->GetMiscValue() == 2228) - { - RemoveAurasDueToSpell((*itr)->GetId()); - itr = auraClassScripts.begin(); - } - else - ++itr; - } - } - - if (duration > 0) - pet->SetDuration(duration); - - //ObjectAccessor::UpdateObjectVisibility(pet); - - return pet; -} - GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime) { if (!IsInWorld()) diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index c431ee2c772..9337add8ba3 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -30,6 +30,8 @@ #include "Unit.h" #include "Util.h" #include "Group.h" +#include "Opcodes.h" +#include "WorldSession.h" #define PET_XP_FACTOR 0.05f @@ -1034,7 +1036,7 @@ bool Pet::HaveInDiet(ItemTemplate const* item) const return diet & FoodMask; } -uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel) +uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel) const { // -5 or greater food level if (getLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect @@ -1838,7 +1840,7 @@ void Pet::ToggleAutocast(SpellInfo const* spellInfo, bool apply) } } -bool Pet::IsPermanentPetFor(Player* owner) +bool Pet::IsPermanentPetFor(Player* owner) const { switch (getPetType()) { diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h index e7ecadae2f1..15f0237d8d2 100755 --- a/src/server/game/Entities/Pet/Pet.h +++ b/src/server/game/Entities/Pet/Pet.h @@ -19,43 +19,11 @@ #ifndef TRINITYCORE_PET_H #define TRINITYCORE_PET_H -#include "ObjectDefines.h" -#include "Unit.h" +#include "PetDefines.h" #include "TemporarySummon.h" -enum PetType -{ - SUMMON_PET = 0, - HUNTER_PET = 1, - MAX_PET_TYPE = 4 -}; - -#define MAX_PET_STABLES 4 - -// stored in character_pet.slot -enum PetSaveMode -{ - PET_SAVE_AS_DELETED = -1, // not saved in fact - PET_SAVE_AS_CURRENT = 0, // in current slot (with player) - PET_SAVE_FIRST_STABLE_SLOT = 1, - PET_SAVE_LAST_STABLE_SLOT = MAX_PET_STABLES, // last in DB stable slot index (including), all higher have same meaning as PET_SAVE_NOT_IN_SLOT - PET_SAVE_NOT_IN_SLOT = 100 // for avoid conflict with stable size grow will use 100 -}; - -enum PetSpellState -{ - PETSPELL_UNCHANGED = 0, - PETSPELL_CHANGED = 1, - PETSPELL_NEW = 2, - PETSPELL_REMOVED = 3 -}; - -enum PetSpellType -{ - PETSPELL_NORMAL = 0, - PETSPELL_FAMILY = 1, - PETSPELL_TALENT = 2 -}; +#define PET_FOCUS_REGEN_INTERVAL 4 * IN_MILLISECONDS +#define HAPPINESS_LEVEL_SIZE 333000 struct PetSpell { @@ -64,29 +32,9 @@ struct PetSpell PetSpellType type; }; -enum ActionFeedback -{ - FEEDBACK_NONE = 0, - FEEDBACK_PET_DEAD = 1, - FEEDBACK_NOTHING_TO_ATT = 2, - FEEDBACK_CANT_ATT_TARGET = 3 -}; - -enum PetTalk -{ - PET_TALK_SPECIAL_SPELL = 0, - PET_TALK_ATTACK = 1 -}; - typedef UNORDERED_MAP<uint32, PetSpell> PetSpellMap; typedef std::vector<uint32> AutoSpellList; -#define ACTIVE_SPELLS_MAX 4 - -#define PET_FOLLOW_DIST 1.0f -#define PET_FOLLOW_ANGLE (M_PI/2) -#define PET_FOCUS_REGEN_INTERVAL 4 * IN_MILLISECONDS - class Player; class Pet : public Guardian @@ -103,9 +51,9 @@ class Pet : public Guardian bool isControlled() const { return getPetType() == SUMMON_PET || getPetType() == HUNTER_PET; } bool isTemporarySummoned() const { return m_duration > 0; } - bool IsPermanentPetFor(Player* owner); // pet have tab in character windows and set UNIT_FIELD_PETNUMBER + bool IsPermanentPetFor(Player* owner) const; // pet have tab in character windows and set UNIT_FIELD_PETNUMBER - bool Create (uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 pet_number); + bool Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 pet_number); bool CreateBaseAtCreature(Creature* creature); bool CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit* owner); bool CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phaseMask); @@ -131,9 +79,9 @@ class Pet : public Guardian void GivePetLevel(uint8 level); void SynchronizeLevelWithOwner(); bool HaveInDiet(ItemTemplate const* item) const; - uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel); + uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel) const; void SetDuration(int32 dur) { m_duration = dur; } - int32 GetDuration() { return m_duration; } + int32 GetDuration() const { return m_duration; } /* bool UpdateStats(Stats stat); diff --git a/src/server/game/Entities/Pet/PetDefines.h b/src/server/game/Entities/Pet/PetDefines.h new file mode 100644 index 00000000000..76de2647c8c --- /dev/null +++ b/src/server/game/Entities/Pet/PetDefines.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/> + * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef TRINITYCORE_PET_DEFINES_H +#define TRINITYCORE_PET_DEFINES_H + +enum PetType +{ + SUMMON_PET = 0, + HUNTER_PET = 1, + MAX_PET_TYPE = 4 +}; + +#define MAX_PET_STABLES 4 + +// stored in character_pet.slot +enum PetSaveMode +{ + PET_SAVE_AS_DELETED = -1, // not saved in fact + PET_SAVE_AS_CURRENT = 0, // in current slot (with player) + PET_SAVE_FIRST_STABLE_SLOT = 1, + PET_SAVE_LAST_STABLE_SLOT = MAX_PET_STABLES, // last in DB stable slot index (including), all higher have same meaning as PET_SAVE_NOT_IN_SLOT + PET_SAVE_NOT_IN_SLOT = 100 // for avoid conflict with stable size grow will use 100 +}; + +enum HappinessState +{ + UNHAPPY = 1, + CONTENT = 2, + HAPPY = 3 +}; + +enum PetSpellState +{ + PETSPELL_UNCHANGED = 0, + PETSPELL_CHANGED = 1, + PETSPELL_NEW = 2, + PETSPELL_REMOVED = 3 +}; + +enum PetSpellType +{ + PETSPELL_NORMAL = 0, + PETSPELL_FAMILY = 1, + PETSPELL_TALENT = 2 +}; + +enum ActionFeedback +{ + FEEDBACK_NONE = 0, + FEEDBACK_PET_DEAD = 1, + FEEDBACK_NOTHING_TO_ATT = 2, + FEEDBACK_CANT_ATT_TARGET = 3 +}; + +enum PetTalk +{ + PET_TALK_SPECIAL_SPELL = 0, + PET_TALK_ATTACK = 1 +}; + +#define PET_FOLLOW_DIST 1.0f +#define PET_FOLLOW_ANGLE (M_PI/2) + +#endif diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index d92e848e5d4..0e0bbb95daa 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -16,69 +16,69 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "Common.h" -#include "Language.h" -#include "DatabaseEnv.h" -#include "Log.h" -#include "Opcodes.h" -#include "SpellMgr.h" -#include "World.h" -#include "WorldPacket.h" -#include "WorldSession.h" -#include "UpdateMask.h" #include "Player.h" -#include "Vehicle.h" -#include "SkillDiscovery.h" -#include "QuestDef.h" -#include "GossipDef.h" -#include "UpdateData.h" +#include "AccountMgr.h" +#include "AchievementMgr.h" +#include "ArenaTeam.h" +#include "ArenaTeamMgr.h" +#include "Battlefield.h" +#include "BattlefieldMgr.h" +#include "BattlefieldWG.h" +#include "BattlegroundAV.h" +#include "Battleground.h" +#include "BattlegroundMgr.h" +#include "CellImpl.h" #include "Channel.h" #include "ChannelMgr.h" -#include "MapManager.h" -#include "MapInstanced.h" -#include "InstanceSaveMgr.h" -#include "GridNotifiers.h" -#include "GridNotifiersImpl.h" -#include "CellImpl.h" -#include "ObjectMgr.h" -#include "ArenaTeamMgr.h" -#include "GuildMgr.h" -#include "GroupMgr.h" -#include "ObjectAccessor.h" +#include "CharacterDatabaseCleaner.h" +#include "Chat.h" +#include <cmath> +#include "Common.h" +#include "ConditionMgr.h" #include "CreatureAI.h" +#include "DatabaseEnv.h" +#include "DB2Stores.h" +#include "DisableMgr.h" #include "Formulas.h" +#include "GameEventMgr.h" +#include "GossipDef.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" #include "Group.h" +#include "GroupMgr.h" #include "Guild.h" -#include "Pet.h" -#include "Util.h" -#include "Transport.h" -#include "Weather.h" -#include "Battleground.h" -#include "BattlegroundAV.h" -#include "BattlegroundMgr.h" +#include "GuildMgr.h" +#include "InstanceSaveMgr.h" +#include "InstanceScript.h" +#include "Language.h" +#include "LFGMgr.h" +#include "Log.h" +#include "MapInstanced.h" +#include "MapManager.h" +#include "ObjectAccessor.h" +#include "ObjectMgr.h" +#include "Opcodes.h" #include "OutdoorPvP.h" #include "OutdoorPvPMgr.h" -#include "ArenaTeam.h" -#include "Chat.h" -#include "Spell.h" +#include "ReputationMgr.h" +#include "Pet.h" +#include "QuestDef.h" +#include "SkillDiscovery.h" #include "SocialMgr.h" -#include "GameEventMgr.h" -#include "AchievementMgr.h" -#include "SpellAuras.h" #include "SpellAuraEffects.h" -#include "ConditionMgr.h" -#include "DisableMgr.h" +#include "SpellAuras.h" +#include "Spell.h" +#include "SpellMgr.h" +#include "Transport.h" +#include "UpdateData.h" +#include "UpdateMask.h" +#include "Util.h" +#include "Vehicle.h" +#include "Weather.h" #include "WeatherMgr.h" -#include "LFGMgr.h" -#include "CharacterDatabaseCleaner.h" -#include "InstanceScript.h" -#include <cmath> -#include "AccountMgr.h" -#include "DB2Stores.h" -#include "DBCStores.h" -#include "Battlefield.h" -#include "BattlefieldMgr.h" -#include "BattlefieldWG.h" +#include "World.h" +#include "WorldPacket.h" +#include "WorldSession.h" #define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS) @@ -647,7 +647,7 @@ void KillRewarder::Reward() #ifdef _MSC_VER #pragma warning(disable:4355) #endif -Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_reputationMgr(this), phaseMgr(this) +Player::Player(WorldSession* session): Unit(true), phaseMgr(this) { #ifdef _MSC_VER #pragma warning(default:4355) @@ -861,6 +861,9 @@ Player::Player(WorldSession* session): Unit(true), m_achievementMgr(this), m_rep memset(_voidStorageItems, 0, VOID_STORAGE_MAX_SLOT * sizeof(VoidStorageItem*)); memset(_CUFProfiles, 0, MAX_CUF_PROFILES * sizeof(CUFProfile*)); + + m_achievementMgr = new AchievementMgr<Player>(this); + m_reputationMgr = new ReputationMgr(this); } Player::~Player() @@ -891,6 +894,8 @@ Player::~Player() delete m_declinedname; delete m_runes; + delete m_achievementMgr; + delete m_reputationMgr; for (uint8 i = 0; i < VOID_STORAGE_MAX_SLOT; ++i) delete _voidStorageItems[i]; @@ -1595,7 +1600,7 @@ void Player::Update(uint32 p_time) } } - m_achievementMgr.UpdateTimedAchievements(p_time); + m_achievementMgr->UpdateTimedAchievements(p_time); if (HasUnitState(UNIT_STATE_MELEE_ATTACKING) && !HasUnitState(UNIT_STATE_CASTING)) { @@ -16608,6 +16613,11 @@ float Player::GetFloatValueFromArray(Tokenizer const& data, uint16 index) return result; } +bool Player::isBeingLoaded() const +{ + return GetSession()->PlayerLoading(); +} + bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) { //// 0 1 2 3 4 5 6 7 8 9 10 11 @@ -16694,7 +16704,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f); // load achievements before anything else to prevent multiple gains for the same achievement/criteria on every loading (as loading does call UpdateAchievementCriteria) - m_achievementMgr.LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS)); + m_achievementMgr->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS)); uint64 money = fields[8].GetUInt64(); if (money > MAX_MONEY_AMOUNT) @@ -17132,7 +17142,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) learnDefaultSpells(); // must be before inventory (some items required reputation check) - m_reputationMgr.LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADREPUTATION)); + m_reputationMgr->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADREPUTATION)); _LoadInventory(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADINVENTORY), time_diff); @@ -17269,7 +17279,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) _LoadDeclinedNames(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES)); - m_achievementMgr.CheckAllAchievementCriteria(this); + m_achievementMgr->CheckAllAchievementCriteria(this); _LoadEquipmentSets(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS)); @@ -18586,6 +18596,14 @@ bool Player::CheckInstanceLoginValid() return sMapMgr->CanPlayerEnter(GetMap()->GetId(), this, true); } +bool Player::CheckInstanceCount(uint32 instanceId) const +{ + if (_instanceResetTimes.size() < sWorld->getIntConfig(CONFIG_MAX_INSTANCES_PER_HOUR)) + return true; + return _instanceResetTimes.find(instanceId) != _instanceResetTimes.end(); +} + + bool Player::_LoadHomeBind(PreparedQueryResult result) { PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); @@ -18926,8 +18944,8 @@ void Player::SaveToDB(bool create /*=false*/) _SaveActions(trans); _SaveAuras(trans); _SaveSkills(trans); - m_achievementMgr.SaveToDB(trans); - m_reputationMgr.SaveToDB(trans); + m_achievementMgr->SaveToDB(trans); + m_reputationMgr->SaveToDB(trans); _SaveEquipmentSets(trans); GetSession()->SaveTutorialsData(trans); // changed only while character in game _SaveGlyphs(trans); @@ -22375,8 +22393,8 @@ void Player::SendInitialPacketsBeforeAddToMap() GetSession()->SendPacket(&data); SendInitialActionButtons(); - m_reputationMgr.SendInitialReputations(); - m_achievementMgr.SendAllAchievementData(this); + m_reputationMgr->SendInitialReputations(); + m_achievementMgr->SendAllAchievementData(this); SendEquipmentSetList(); @@ -24488,42 +24506,42 @@ void Player::HandleFall(MovementInfo const& movementInfo) void Player::ResetAchievements() { - m_achievementMgr.Reset(); + m_achievementMgr->Reset(); } void Player::SendRespondInspectAchievements(Player* player) const { - m_achievementMgr.SendAchievementInfo(player); + m_achievementMgr->SendAchievementInfo(player); } uint32 Player::GetAchievementPoints() const { - return m_achievementMgr.GetAchievementPoints(); + return m_achievementMgr->GetAchievementPoints(); } bool Player::HasAchieved(uint32 achievementId) const { - return m_achievementMgr.HasAchieved(achievementId); + return m_achievementMgr->HasAchieved(achievementId); } void Player::StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost/* = 0*/) { - m_achievementMgr.StartTimedAchievement(type, entry, timeLost); + m_achievementMgr->StartTimedAchievement(type, entry, timeLost); } void Player::RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry) { - m_achievementMgr.RemoveTimedAchievement(type, entry); + m_achievementMgr->RemoveTimedAchievement(type, entry); } void Player::ResetAchievementCriteria(AchievementCriteriaTypes type, uint64 miscValue1 /*= 0*/, uint64 miscValue2 /*= 0*/, bool evenIfCriteriaComplete /* = false*/) { - m_achievementMgr.ResetAchievementCriteria(type, miscValue1, miscValue2, evenIfCriteriaComplete); + m_achievementMgr->ResetAchievementCriteria(type, miscValue1, miscValue2, evenIfCriteriaComplete); } void Player::UpdateAchievementCriteria(AchievementCriteriaTypes type, uint64 miscValue1 /*= 0*/, uint64 miscValue2 /*= 0*/, uint64 miscValue3 /*= 0*/, Unit* unit /*= NULL*/) { - m_achievementMgr.UpdateAchievementCriteria(type, miscValue1, miscValue2, miscValue3, unit, this); + m_achievementMgr->UpdateAchievementCriteria(type, miscValue1, miscValue2, miscValue3, unit, this); Guild* guild = sGuildMgr->GetGuildById(GetGuildId()); if (!guild) return; @@ -24538,7 +24556,7 @@ void Player::UpdateAchievementCriteria(AchievementCriteriaTypes type, uint64 mis void Player::CompletedAchievement(AchievementEntry const* entry) { - m_achievementMgr.CompletedAchievement(entry, this); + m_achievementMgr->CompletedAchievement(entry, this); } bool Player::LearnTalent(uint32 talentId, uint32 talentRank) @@ -26322,3 +26340,116 @@ Guild* Player::GetGuild() uint32 guildId = GetGuildId(); return guildId ? sGuildMgr->GetGuildById(guildId) : NULL; } + +Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 duration) +{ + Pet* pet = new Pet(this, petType); + + if (petType == SUMMON_PET && pet->LoadPetFromDB(this, entry)) + { + // Remove Demonic Sacrifice auras (known pet) + Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();) + { + if ((*itr)->GetMiscValue() == 2228) + { + RemoveAurasDueToSpell((*itr)->GetId()); + itr = auraClassScripts.begin(); + } + else + ++itr; + } + + if (duration > 0) + pet->SetDuration(duration); + + return NULL; + } + + // petentry == 0 for hunter "call pet" (current pet summoned if any) + if (!entry) + { + delete pet; + return NULL; + } + + pet->Relocate(x, y, z, ang); + if (!pet->IsPositionValid()) + { + sLog->outError(LOG_FILTER_GENERAL, "Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY()); + delete pet; + return NULL; + } + + Map* map = GetMap(); + uint32 pet_number = sObjectMgr->GeneratePetNumber(); + if (!pet->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PET), map, GetPhaseMask(), entry, pet_number)) + { + sLog->outError(LOG_FILTER_GENERAL, "no such creature entry %u", entry); + delete pet; + return NULL; + } + + pet->SetCreatorGUID(GetGUID()); + pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction()); + + pet->setPowerType(POWER_MANA); + pet->SetUInt32Value(UNIT_NPC_FLAGS, 0); + pet->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + pet->InitStatsForLevel(getLevel()); + + SetMinion(pet, true); + + switch (petType) + { + case SUMMON_PET: + // this enables pet details window (Shift+P) + pet->GetCharmInfo()->SetPetNumber(pet_number, true); + pet->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048); + pet->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); + pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); + pet->SetFullHealth(); + pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA)); + pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped in this case + break; + default: + break; + } + + map->AddToMap(pet->ToCreature()); + + switch (petType) + { + case SUMMON_PET: + pet->InitPetCreateSpells(); + pet->InitTalentForLevel(); + pet->SavePetToDB(PET_SAVE_AS_CURRENT); + PetSpellInitialize(); + break; + default: + break; + } + + if (petType == SUMMON_PET) + { + // Remove Demonic Sacrifice auras (known pet) + Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); + for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr != auraClassScripts.end();) + { + if ((*itr)->GetMiscValue() == 2228) + { + RemoveAurasDueToSpell((*itr)->GetId()); + itr = auraClassScripts.begin(); + } + else + ++itr; + } + } + + if (duration > 0) + pet->SetDuration(duration); + + //ObjectAccessor::UpdateObjectVisibility(pet); + + return pet; +} diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index b5c397057f4..0056230f6ce 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -19,30 +19,30 @@ #ifndef _PLAYER_H #define _PLAYER_H -#include <bitset> -#include "AchievementMgr.h" -#include "Common.h" -#include "DatabaseEnv.h" -#include "DBCEnums.h" +#include "DBCStores.h" #include "GroupReference.h" -#include "Item.h" #include "MapReference.h" -#include "Pet.h" -#include "QuestDef.h" -#include "ReputationMgr.h" -#include "Unit.h" -#include "WorldSession.h" -#include "PhaseMgr.h" -// for template +#include "Item.h" +#include "PetDefines.h" +#include "PhaseMgr.h" +#include "QuestDef.h" #include "SpellMgr.h" +#include "Unit.h" #include <string> #include <vector> +struct CreatureTemplate; struct Mail; struct ItemExtendedCostEntry; +struct TrainerSpell; +struct VendorItem; + +template<class T> class AchievementMgr; +class ReputationMgr; class Channel; +class CharacterCreateInfo; class Creature; class DynamicObject; class Group; @@ -1703,7 +1703,7 @@ class Player : public Unit, public GridObject<Player> /*********************************************************/ bool LoadFromDB(uint32 guid, SQLQueryHolder *holder); - bool isBeingLoaded() const { return GetSession()->PlayerLoading();} + bool isBeingLoaded() const; void Initialize(uint32 guid); static uint32 GetUInt32ValueFromArray(Tokenizer const& data, uint16 index); @@ -2235,8 +2235,8 @@ class Player : public Unit, public GridObject<Player> uint8 GetGrantableLevels() { return m_grantableLevels; } void SetGrantableLevels(uint8 val) { m_grantableLevels = val; } - ReputationMgr& GetReputationMgr() { return m_reputationMgr; } - ReputationMgr const& GetReputationMgr() const { return m_reputationMgr; } + ReputationMgr& GetReputationMgr() { return *m_reputationMgr; } + ReputationMgr const& GetReputationMgr() const { return *m_reputationMgr; } ReputationRank GetReputationRank(uint32 faction_id) const; void RewardReputation(Unit* victim, float rate); void RewardReputation(Quest const* quest); @@ -2600,12 +2600,7 @@ class Player : public Unit, public GridObject<Player> static void ConvertInstancesToGroup(Player* player, Group* group, bool switchLeader); bool Satisfy(AccessRequirement const* ar, uint32 target_map, bool report = false); bool CheckInstanceLoginValid(); - bool CheckInstanceCount(uint32 instanceId) const - { - if (_instanceResetTimes.size() < sWorld->getIntConfig(CONFIG_MAX_INSTANCES_PER_HOUR)) - return true; - return _instanceResetTimes.find(instanceId) != _instanceResetTimes.end(); - } + bool CheckInstanceCount(uint32 instanceId) const; void AddInstanceEnterTime(uint32 instanceId, time_t enterTime) { @@ -3084,8 +3079,8 @@ class Player : public Unit, public GridObject<Player> uint32 m_temporaryUnsummonedPetNumber; uint32 m_oldpetspell; - AchievementMgr<Player> m_achievementMgr; - ReputationMgr m_reputationMgr; + AchievementMgr<Player>* m_achievementMgr; + ReputationMgr* m_reputationMgr; SpellCooldowns m_spellCooldowns; diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp index bc16a7f42a2..803b38ccd12 100755 --- a/src/server/game/Entities/Player/SocialMgr.cpp +++ b/src/server/game/Entities/Player/SocialMgr.cpp @@ -26,6 +26,7 @@ #include "World.h" #include "Util.h" #include "AccountMgr.h" +#include "WorldSession.h" PlayerSocial::PlayerSocial() { diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp index d5d1bd99277..4d726181c4f 100755 --- a/src/server/game/Entities/Totem/Totem.cpp +++ b/src/server/game/Entities/Totem/Totem.cpp @@ -17,13 +17,14 @@ */ #include "Totem.h" -#include "WorldPacket.h" #include "Log.h" #include "Group.h" -#include "Player.h" #include "ObjectMgr.h" +#include "Opcodes.h" +#include "Player.h" #include "SpellMgr.h" #include "SpellInfo.h" +#include "WorldPacket.h" Totem::Totem(SummonPropertiesEntry const* properties, Unit* owner) : Minion(properties, owner, false) { diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 18002fb3531..ce0ed7f565f 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -16,49 +16,50 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "Battlefield.h" +#include "BattlefieldMgr.h" +#include "Battleground.h" +#include "CellImpl.h" #include "Common.h" +#include "ConditionMgr.h" +#include "CreatureAI.h" #include "CreatureAIImpl.h" -#include "Log.h" -#include "Opcodes.h" -#include "WorldPacket.h" -#include "WorldSession.h" -#include "World.h" -#include "ObjectMgr.h" -#include "SpellMgr.h" -#include "Unit.h" -#include "QuestDef.h" -#include "Player.h" +#include "CreatureGroups.h" #include "Creature.h" -#include "Spell.h" +#include "Formulas.h" +#include "GridNotifiersImpl.h" #include "Group.h" -#include "SpellAuras.h" -#include "SpellAuraEffects.h" +#include "InstanceSaveMgr.h" +#include "InstanceScript.h" +#include "Log.h" #include "MapManager.h" +#include "MoveSpline.h" +#include "MoveSplineInit.h" #include "ObjectAccessor.h" -#include "CreatureAI.h" -#include "Formulas.h" -#include "Pet.h" -#include "Util.h" -#include "Totem.h" -#include "Battleground.h" +#include "ObjectMgr.h" +#include "Opcodes.h" #include "OutdoorPvP.h" -#include "InstanceSaveMgr.h" -#include "GridNotifiersImpl.h" -#include "CellImpl.h" -#include "CreatureGroups.h" -#include "PetAI.h" #include "PassiveAI.h" +#include "PetAI.h" +#include "Pet.h" +#include "Player.h" +#include "QuestDef.h" +#include "ReputationMgr.h" +#include "SpellAuraEffects.h" +#include "SpellAuras.h" +#include "Spell.h" +#include "SpellInfo.h" +#include "SpellMgr.h" #include "TemporarySummon.h" -#include "Vehicle.h" +#include "Totem.h" #include "Transport.h" -#include "InstanceScript.h" -#include "SpellInfo.h" -#include "MoveSplineInit.h" -#include "MoveSpline.h" -#include "ConditionMgr.h" +#include "Unit.h" #include "UpdateFieldFlags.h" -#include "Battlefield.h" -#include "BattlefieldMgr.h" +#include "Util.h" +#include "Vehicle.h" +#include "World.h" +#include "WorldPacket.h" +#include "WorldSession.h" #include <math.h> diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 9dae2708526..4dfe5ec1a00 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -19,25 +19,14 @@ #ifndef __UNIT_H #define __UNIT_H -#include "Common.h" -#include "Object.h" -#include "Opcodes.h" -#include "SpellAuraDefines.h" -#include "UpdateFields.h" -#include "SharedDefines.h" -#include "ThreatManager.h" -#include "HostileRefManager.h" +#include "EventProcessor.h" #include "FollowerReference.h" #include "FollowerRefManager.h" -#include "EventProcessor.h" +#include "HostileRefManager.h" #include "MotionMaster.h" -#include "DBCStructure.h" -#include "SpellInfo.h" -#include "Path.h" -#include "WorldPacket.h" -#include "WorldSession.h" -#include "Timer.h" -#include <list> +#include "Object.h" +#include "SpellAuraDefines.h" +#include "ThreatManager.h" #define WORLD_TRIGGER 12999 @@ -343,6 +332,7 @@ class Totem; class Transport; class Vehicle; class TransportBase; +class SpellCastTargets; typedef std::list<Unit*> UnitList; typedef std::list< std::pair<Aura*, uint8> > DispelChargesList; diff --git a/src/server/game/Globals/ObjectAccessor.cpp b/src/server/game/Globals/ObjectAccessor.cpp index 6999eb301f5..cedb20eccf1 100755 --- a/src/server/game/Globals/ObjectAccessor.cpp +++ b/src/server/game/Globals/ObjectAccessor.cpp @@ -17,25 +17,25 @@ */ #include "ObjectAccessor.h" -#include "ObjectMgr.h" - -#include "Player.h" +#include "CellImpl.h" +#include "Corpse.h" #include "Creature.h" -#include "GameObject.h" #include "DynamicObject.h" -#include "Vehicle.h" -#include "WorldPacket.h" -#include "Item.h" -#include "Corpse.h" +#include "GameObject.h" #include "GridNotifiers.h" -#include "MapManager.h" -#include "Map.h" -#include "CellImpl.h" #include "GridNotifiersImpl.h" -#include "Opcodes.h" -#include "ObjectDefines.h" +#include "Item.h" +#include "Map.h" #include "MapInstanced.h" +#include "MapManager.h" +#include "ObjectDefines.h" +#include "ObjectMgr.h" +#include "Opcodes.h" +#include "Pet.h" +#include "Player.h" +#include "Vehicle.h" #include "World.h" +#include "WorldPacket.h" #include <cmath> diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 37117c9edf4..3b043368186 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -16,38 +16,40 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "AccountMgr.h" +#include "AchievementMgr.h" +#include "ArenaTeam.h" +#include "ArenaTeamMgr.h" +#include "Chat.h" #include "Common.h" #include "DatabaseEnv.h" +#include "DB2Structure.h" +#include "DB2Stores.h" +#include "DisableMgr.h" +#include "GameEventMgr.h" +#include "GossipDef.h" +#include "GroupMgr.h" +#include "GuildMgr.h" +#include "InstanceSaveMgr.h" +#include "Language.h" +#include "LFGMgr.h" #include "Log.h" #include "MapManager.h" #include "ObjectMgr.h" -#include "ArenaTeamMgr.h" -#include "GuildMgr.h" -#include "GroupMgr.h" +#include "Pet.h" +#include "PoolMgr.h" +#include "ReputationMgr.h" +#include "ScriptMgr.h" +#include "SpellAuras.h" +#include "Spell.h" #include "SpellMgr.h" -#include "UpdateMask.h" -#include "World.h" -#include "ArenaTeam.h" +#include "SpellScript.h" #include "Transport.h" -#include "Language.h" -#include "GameEventMgr.h" -#include "Spell.h" -#include "Chat.h" -#include "AccountMgr.h" -#include "InstanceSaveMgr.h" -#include "SpellAuras.h" +#include "UpdateMask.h" #include "Util.h" -#include "WaypointManager.h" -#include "GossipDef.h" #include "Vehicle.h" -#include "AchievementMgr.h" -#include "DisableMgr.h" -#include "ScriptMgr.h" -#include "SpellScript.h" -#include "PoolMgr.h" -#include "DB2Structure.h" -#include "DB2Stores.h" -#include "LFGMgr.h" +#include "WaypointManager.h" +#include "World.h" ScriptMapMap sQuestEndScripts; ScriptMapMap sQuestStartScripts; @@ -262,11 +264,14 @@ ObjectMgr::~ObjectMgr() delete[] i->second; for (int race = 0; race < MAX_RACES; ++race) + { for (int class_ = 0; class_ < MAX_CLASSES; ++class_) { - delete[] _playerInfo[race][class_]->levelInfo; + if (_playerInfo[race][class_]) + delete[] _playerInfo[race][class_]->levelInfo; delete _playerInfo[race][class_]; } + } for (CacheVendorItemContainer::iterator itr = _cacheVendorItemStore.begin(); itr != _cacheVendorItemStore.end(); ++itr) itr->second.Clear(); diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index ab4306bbc87..ae1c8449275 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -69,6 +69,41 @@ struct PageText #pragma pack(pop) #endif +// DB scripting commands +enum ScriptCommands +{ + SCRIPT_COMMAND_TALK = 0, // source/target = Creature, target = any, datalong = talk type (0=say, 1=whisper, 2=yell, 3=emote text, 4=boss emote text), datalong2 & 1 = player talk (instead of creature), dataint = string_id + SCRIPT_COMMAND_EMOTE = 1, // source/target = Creature, datalong = emote id, datalong2 = 0: set emote state; > 0: play emote state + SCRIPT_COMMAND_FIELD_SET = 2, // source/target = Creature, datalong = field id, datalog2 = value + SCRIPT_COMMAND_MOVE_TO = 3, // source/target = Creature, datalong2 = time to reach, x/y/z = destination + SCRIPT_COMMAND_FLAG_SET = 4, // source/target = Creature, datalong = field id, datalog2 = bitmask + SCRIPT_COMMAND_FLAG_REMOVE = 5, // source/target = Creature, datalong = field id, datalog2 = bitmask + SCRIPT_COMMAND_TELEPORT_TO = 6, // source/target = Creature/Player (see datalong2), datalong = map_id, datalong2 = 0: Player; 1: Creature, x/y/z = destination, o = orientation + SCRIPT_COMMAND_QUEST_EXPLORED = 7, // target/source = Player, target/source = GO/Creature, datalong = quest id, datalong2 = distance or 0 + SCRIPT_COMMAND_KILL_CREDIT = 8, // target/source = Player, datalong = creature entry, datalong2 = 0: personal credit, 1: group credit + SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9, // source = WorldObject (summoner), datalong = GO guid, datalong2 = despawn delay + SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10, // source = WorldObject (summoner), datalong = creature entry, datalong2 = despawn delay, x/y/z = summon position, o = orientation + SCRIPT_COMMAND_OPEN_DOOR = 11, // source = Unit, datalong = GO guid, datalong2 = reset delay (min 15) + SCRIPT_COMMAND_CLOSE_DOOR = 12, // source = Unit, datalong = GO guid, datalong2 = reset delay (min 15) + SCRIPT_COMMAND_ACTIVATE_OBJECT = 13, // source = Unit, target = GO + SCRIPT_COMMAND_REMOVE_AURA = 14, // source (datalong2 != 0) or target (datalong2 == 0) = Unit, datalong = spell id + SCRIPT_COMMAND_CAST_SPELL = 15, // source and/or target = Unit, datalong2 = cast direction (0: s->t 1: s->s 2: t->t 3: t->s 4: s->creature with dataint entry), dataint & 1 = triggered flag + SCRIPT_COMMAND_PLAY_SOUND = 16, // source = WorldObject, target = none/Player, datalong = sound id, datalong2 (bitmask: 0/1=anyone/player, 0/2=without/with distance dependency, so 1|2 = 3 is target with distance dependency) + SCRIPT_COMMAND_CREATE_ITEM = 17, // target/source = Player, datalong = item entry, datalong2 = amount + SCRIPT_COMMAND_DESPAWN_SELF = 18, // target/source = Creature, datalong = despawn delay + + SCRIPT_COMMAND_LOAD_PATH = 20, // source = Unit, datalong = path id, datalong2 = is repeatable + SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT = 21, // source = WorldObject (if present used as a search center), datalong = script id, datalong2 = unit lowguid, dataint = script table to use (see ScriptsType) + SCRIPT_COMMAND_KILL = 22, // source/target = Creature, dataint = remove corpse attribute + + // TrinityCore only + SCRIPT_COMMAND_ORIENTATION = 30, // source = Unit, target (datalong > 0) = Unit, datalong = > 0 turn source to face target, o = orientation + SCRIPT_COMMAND_EQUIP = 31, // soucre = Creature, datalong = equipment id + SCRIPT_COMMAND_MODEL = 32, // source = Creature, datalong = model id + SCRIPT_COMMAND_CLOSE_GOSSIP = 33, // source = Player + SCRIPT_COMMAND_PLAYMOVIE = 34 // source = Player, datalong = movie id +}; + // Benchmarked: Faster than UNORDERED_MAP (insert/find) typedef std::map<uint32, PageText> PageTextContainer; diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 672491e9f49..6c1cdf6a7fb 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -31,6 +31,7 @@ #include "Unit.h" #include "CreatureAI.h" #include "Spell.h" +#include "WorldSession.h" class Player; //class Map; diff --git a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h index e3cda4dd76d..2d60678d4ff 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h +++ b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h @@ -26,6 +26,7 @@ #include "UpdateData.h" #include "CreatureAI.h" #include "SpellAuras.h" +#include "Opcodes.h" template<class T> inline void Trinity::VisibleNotifier::Visit(GridRefManager<T> &m) diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 3d06b266afb..903aac6e983 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -16,18 +16,19 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "AccountMgr.h" +#include "CalendarMgr.h" +#include "Chat.h" +#include "Config.h" #include "DatabaseEnv.h" #include "Guild.h" -#include "GuildMgr.h" #include "GuildFinderMgr.h" +#include "GuildMgr.h" +#include "Language.h" +#include "Log.h" #include "ScriptMgr.h" -#include "Chat.h" -#include "Config.h" #include "SocialMgr.h" -#include "Log.h" -#include "AccountMgr.h" -#include "AchievementMgr.h" -#include "CalendarMgr.h" +#include "Opcodes.h" #define MAX_GUILD_BANK_TAB_TEXT_LEN 500 #define EMBLEM_PRICE 10 * GOLD diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h index fc90a492399..2b1ec24c7d5 100755 --- a/src/server/game/Guilds/Guild.h +++ b/src/server/game/Guilds/Guild.h @@ -19,6 +19,7 @@ #ifndef TRINITYCORE_GUILD_H #define TRINITYCORE_GUILD_H +#include "AchievementMgr.h" #include "World.h" #include "Item.h" #include "WorldPacket.h" diff --git a/src/server/game/Handlers/ArenaTeamHandler.cpp b/src/server/game/Handlers/ArenaTeamHandler.cpp index 0d1fa986b87..917fc7069a8 100755 --- a/src/server/game/Handlers/ArenaTeamHandler.cpp +++ b/src/server/game/Handlers/ArenaTeamHandler.cpp @@ -27,6 +27,7 @@ #include "ObjectMgr.h" #include "SocialMgr.h" #include "ArenaTeamMgr.h" +#include "Opcodes.h" void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket & recvData) { diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 17d84295bd7..5db1fe16003 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -24,6 +24,7 @@ #include "AuctionHouseMgr.h" #include "Log.h" +#include "Language.h" #include "Opcodes.h" #include "UpdateMask.h" #include "Util.h" diff --git a/src/server/game/Handlers/ChannelHandler.cpp b/src/server/game/Handlers/ChannelHandler.cpp index 6e2314c2e16..15379271812 100755 --- a/src/server/game/Handlers/ChannelHandler.cpp +++ b/src/server/game/Handlers/ChannelHandler.cpp @@ -19,6 +19,7 @@ #include "ObjectMgr.h" // for normalizePlayerName #include "ChannelMgr.h" #include "Player.h" +#include "WorldSession.h" void WorldSession::HandleJoinChannel(WorldPacket& recvPacket) { diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index 5017a2a7c9d..e0cd25edf22 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -16,36 +16,37 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "Common.h" -#include "ObjectAccessor.h" -#include "ObjectMgr.h" -#include "ArenaTeamMgr.h" -#include "GuildMgr.h" -#include "SystemConfig.h" -#include "World.h" -#include "WorldPacket.h" -#include "WorldSession.h" -#include "DatabaseEnv.h" +#include "AccountMgr.h" #include "ArenaTeam.h" +#include "ArenaTeamMgr.h" +#include "Battleground.h" +#include "CalendarMgr.h" #include "Chat.h" +#include "Common.h" +#include "DatabaseEnv.h" #include "Group.h" #include "Guild.h" #include "GuildFinderMgr.h" +#include "GuildMgr.h" #include "Language.h" +#include "LFGMgr.h" #include "Log.h" +#include "ObjectAccessor.h" +#include "ObjectMgr.h" #include "Opcodes.h" -#include "Player.h" +#include "Pet.h" #include "PlayerDump.h" +#include "Player.h" +#include "ReputationMgr.h" +#include "ScriptMgr.h" #include "SharedDefines.h" #include "SocialMgr.h" +#include "SystemConfig.h" #include "UpdateMask.h" #include "Util.h" -#include "ScriptMgr.h" -#include "Battleground.h" -#include "AccountMgr.h" -#include "DBCStores.h" -#include "LFGMgr.h" -#include "CalendarMgr.h" +#include "World.h" +#include "WorldPacket.h" +#include "WorldSession.h" class LoginQueryHolder : public SQLQueryHolder { diff --git a/src/server/game/Handlers/CombatHandler.cpp b/src/server/game/Handlers/CombatHandler.cpp index 391a6fc0831..d30164b2592 100755 --- a/src/server/game/Handlers/CombatHandler.cpp +++ b/src/server/game/Handlers/CombatHandler.cpp @@ -26,6 +26,7 @@ #include "Vehicle.h" #include "VehicleDefines.h" #include "Player.h" +#include "Opcodes.h" void WorldSession::HandleAttackSwingOpcode(WorldPacket& recvData) { diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index 16645ffadf2..af5b3123707 100644 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -18,22 +18,20 @@ #include "Common.h" #include "DatabaseEnv.h" -#include "Opcodes.h" +#include "Group.h" +#include "GroupMgr.h" #include "Log.h" -#include "WorldPacket.h" -#include "WorldSession.h" -#include "World.h" #include "ObjectMgr.h" -#include "GroupMgr.h" +#include "Opcodes.h" +#include "Pet.h" #include "Player.h" -#include "Group.h" #include "SocialMgr.h" -#include "Util.h" #include "SpellAuras.h" +#include "Util.h" #include "Vehicle.h" -#include "DB2Structure.h" -#include "DB2Stores.h" -#include "SpellAuraEffects.h" +#include "World.h" +#include "WorldPacket.h" +#include "WorldSession.h" class Aura; diff --git a/src/server/game/Handlers/LFGHandler.cpp b/src/server/game/Handlers/LFGHandler.cpp index 83f9f62ee3d..9c08abf8045 100755 --- a/src/server/game/Handlers/LFGHandler.cpp +++ b/src/server/game/Handlers/LFGHandler.cpp @@ -23,6 +23,7 @@ #include "LFGMgr.h" #include "ObjectMgr.h" #include "GroupMgr.h" +#include "Opcodes.h" void BuildPlayerLockDungeonBlock(WorldPacket& data, const LfgLockMap& lock) { diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index c8d6d749331..283a40d8409 100755 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -17,19 +17,20 @@ */ #include "Common.h" -#include "WorldPacket.h" #include "Log.h" #include "Corpse.h" +#include "Creature.h" #include "GameObject.h" -#include "Player.h" -#include "ObjectAccessor.h" -#include "WorldSession.h" +#include "Group.h" +#include "GuildMgr.h" #include "LootMgr.h" +#include "ObjectAccessor.h" #include "Object.h" -#include "Group.h" +#include "Opcodes.h" +#include "Player.h" #include "World.h" -#include "Util.h" -#include "GuildMgr.h" +#include "WorldPacket.h" +#include "WorldSession.h" void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recvData) { diff --git a/src/server/game/Handlers/NPCHandler.cpp b/src/server/game/Handlers/NPCHandler.cpp index 0ca51d3732c..30d51e03b11 100755 --- a/src/server/game/Handlers/NPCHandler.cpp +++ b/src/server/game/Handlers/NPCHandler.cpp @@ -31,6 +31,7 @@ #include "ObjectAccessor.h" #include "Creature.h" #include "Pet.h" +#include "ReputationMgr.h" #include "BattlegroundMgr.h" #include "Battleground.h" #include "ScriptMgr.h" diff --git a/src/server/game/Handlers/SkillHandler.cpp b/src/server/game/Handlers/SkillHandler.cpp index 9d93c7af182..8153af95208 100755 --- a/src/server/game/Handlers/SkillHandler.cpp +++ b/src/server/game/Handlers/SkillHandler.cpp @@ -18,13 +18,14 @@ #include "Common.h" #include "DatabaseEnv.h" -#include "Opcodes.h" #include "Log.h" +#include "ObjectAccessor.h" +#include "Opcodes.h" #include "Player.h" +#include "Pet.h" +#include "UpdateMask.h" #include "WorldPacket.h" #include "WorldSession.h" -#include "ObjectAccessor.h" -#include "UpdateMask.h" void WorldSession::HandleLearnTalentOpcode(WorldPacket & recvData) { diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp index 41e834d84e8..1571d857f41 100644 --- a/src/server/game/Handlers/TicketHandler.cpp +++ b/src/server/game/Handlers/TicketHandler.cpp @@ -17,15 +17,16 @@ */ #include "zlib.h" -#include "Language.h" -#include "WorldPacket.h" #include "Common.h" +#include "Language.h" #include "ObjectMgr.h" -#include "TicketMgr.h" +#include "Opcodes.h" #include "Player.h" +#include "TicketMgr.h" +#include "Util.h" #include "World.h" +#include "WorldPacket.h" #include "WorldSession.h" -#include "Util.h" void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData) { diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index af4b33e079c..a183c13d2c7 100755 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -16,15 +16,18 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "InstanceScript.h" -#include "DatabaseEnv.h" -#include "Map.h" -#include "Player.h" -#include "GameObject.h" #include "Creature.h" #include "CreatureAI.h" -#include "Log.h" +#include "DatabaseEnv.h" +#include "GameObject.h" +#include "InstanceScript.h" #include "LFGMgr.h" +#include "Log.h" +#include "Map.h" +#include "Player.h" +#include "Pet.h" +#include "WorldSession.h" +#include "Opcodes.h" void InstanceScript::SaveToDB() { diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index cf773ba7ead..1f6b3e42428 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -17,23 +17,24 @@ */ #include "Map.h" -#include "GridStates.h" -#include "ScriptMgr.h" -#include "VMapFactory.h" -#include "MapInstanced.h" +#include "Battleground.h" #include "CellImpl.h" +#include "DynamicTree.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" -#include "Transport.h" +#include "GridStates.h" +#include "Group.h" #include "InstanceScript.h" -#include "ObjectAccessor.h" +#include "LFGMgr.h" +#include "MapInstanced.h" #include "MapManager.h" +#include "ObjectAccessor.h" #include "ObjectMgr.h" -#include "Group.h" -#include "LFGMgr.h" -#include "DynamicTree.h" +#include "Pet.h" +#include "ScriptMgr.h" +#include "Transport.h" #include "Vehicle.h" -#include "Battleground.h" +#include "VMapFactory.h" union u_map_magic { diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 0ead173ed95..8fdd3298afb 100755 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -34,6 +34,8 @@ #include "WorldPacket.h" #include "Group.h" #include "Player.h" +#include "WorldSession.h" +#include "Opcodes.h" extern GridState* si_GridStates[]; // debugging code, should be deleted some day diff --git a/src/server/game/Maps/PhaseMgr.cpp b/src/server/game/Maps/PhaseMgr.cpp index 38c9b3fc6e9..d43a930c71d 100644 --- a/src/server/game/Maps/PhaseMgr.cpp +++ b/src/server/game/Maps/PhaseMgr.cpp @@ -17,6 +17,7 @@ #include "PhaseMgr.h" #include "Chat.h" +#include "Language.h" #include "ObjectMgr.h" #include "Player.h" diff --git a/src/server/game/Maps/ZoneScript.h b/src/server/game/Maps/ZoneScript.h index df6349a7664..7b20b0ee676 100755 --- a/src/server/game/Maps/ZoneScript.h +++ b/src/server/game/Maps/ZoneScript.h @@ -32,19 +32,20 @@ class ZoneScript virtual uint32 GetCreatureEntry(uint32 /*guidlow*/, CreatureData const* data) { return data->id; } virtual uint32 GetGameObjectEntry(uint32 /*guidlow*/, uint32 entry) { return entry; } - virtual void OnCreatureCreate(Creature* /*creature*/) {} - virtual void OnCreatureRemove(Creature* /*creature*/) {} - virtual void OnGameObjectCreate(GameObject* /*go*/) {} - virtual void OnGameObjectRemove(GameObject* /*go*/) {} + virtual void OnCreatureCreate(Creature *) { } + virtual void OnCreatureRemove(Creature *) { } - virtual void OnUnitDeath(Unit* /*unit*/) {} + virtual void OnGameObjectCreate(GameObject *) { } + virtual void OnGameObjectRemove(GameObject *) { } + + virtual void OnUnitDeath(Unit*) { } //All-purpose data storage 64 bit - virtual uint64 GetData64(uint32 /*DataId*/) { return 0; } + virtual uint64 GetData64(uint32 /*DataId*/) const { return 0; } virtual void SetData64(uint32 /*DataId*/, uint64 /*Value*/) {} //All-purpose data storage 32 bit - virtual uint32 GetData(uint32 /*DataId*/) { return 0; } + virtual uint32 GetData(uint32 /*DataId*/) const { return 0; } virtual void SetData(uint32 /*DataId*/, uint32 /*Value*/) {} virtual void ProcessEvent(WorldObject* /*obj*/, uint32 /*eventId*/) {} diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 057895898e5..59ebfa8044e 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -3830,4 +3830,37 @@ enum VoidTransferError #define CURRENCY_PRECISION 100 +enum PartyResult +{ + ERR_PARTY_RESULT_OK = 0, + ERR_BAD_PLAYER_NAME_S = 1, + ERR_TARGET_NOT_IN_GROUP_S = 2, + ERR_TARGET_NOT_IN_INSTANCE_S = 3, + ERR_GROUP_FULL = 4, + ERR_ALREADY_IN_GROUP_S = 5, + ERR_NOT_IN_GROUP = 6, + ERR_NOT_LEADER = 7, + ERR_PLAYER_WRONG_FACTION = 8, + ERR_IGNORING_YOU_S = 9, + ERR_LFG_PENDING = 12, + ERR_INVITE_RESTRICTED = 13, + ERR_GROUP_SWAP_FAILED = 14, // if (PartyOperation == PARTY_OP_SWAP) ERR_GROUP_SWAP_FAILED else ERR_INVITE_IN_COMBAT + ERR_INVITE_UNKNOWN_REALM = 15, + ERR_INVITE_NO_PARTY_SERVER = 16, + ERR_INVITE_PARTY_BUSY = 17, + ERR_PARTY_TARGET_AMBIGUOUS = 18, + ERR_PARTY_LFG_INVITE_RAID_LOCKED = 19, + ERR_PARTY_LFG_BOOT_LIMIT = 20, + ERR_PARTY_LFG_BOOT_COOLDOWN_S = 21, + ERR_PARTY_LFG_BOOT_IN_PROGRESS = 22, + ERR_PARTY_LFG_BOOT_TOO_FEW_PLAYERS = 23, + ERR_PARTY_LFG_BOOT_NOT_ELIGIBLE_S = 24, + ERR_RAID_DISALLOWED_BY_LEVEL = 25, + ERR_PARTY_LFG_BOOT_IN_COMBAT = 26, + ERR_VOTE_KICK_REASON_NEEDED = 27, + ERR_PARTY_LFG_BOOT_DUNGEON_COMPLETE = 28, + ERR_PARTY_LFG_BOOT_LOOT_ROLLS = 29, + ERR_PARTY_LFG_TELEPORT_IN_COMBAT = 30 +}; + #endif diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index d6c69c2c679..7a669642e7e 100755 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -59,10 +59,29 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T &owner) } else { - if (i_target->IsWithinDistInMap(&owner, i_offset + 1.0f)) + float dist; + float size; + + // Pets need special handling. + // We need to subtract GetObjectSize() because it gets added back further down the chain + // and that makes pets too far away. Subtracting it allows pets to properly + // be (GetCombatReach() + i_offset) away. + if (owner.isPet()) + { + dist = i_target->GetCombatReach(); + size = i_target->GetCombatReach() - i_target->GetObjectSize(); + } + else + { + dist = i_offset + 1.0f; + size = owner.GetObjectSize(); + } + + if (i_target->IsWithinDistInMap(&owner, dist)) return; + // to at i_offset distance from target and i_angle from target facing - i_target->GetClosePoint(x, y, z, owner.GetObjectSize(), i_offset, i_angle); + i_target->GetClosePoint(x, y, z, size, i_offset, i_angle); } /* diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index fd20d041b4b..a5ca4e0cfe9 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -22,6 +22,8 @@ #include "Unit.h" #include "Transport.h" #include "Vehicle.h" +#include "WorldPacket.h" +#include "Opcodes.h" namespace Movement { diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index d4dad387b1d..59a7110decb 100755 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -24,6 +24,8 @@ #include "World.h" #include "ObjectMgr.h" #include "ScriptMgr.h" +#include "Opcodes.h" +#include "WorldSession.h" const int32 ReputationMgr::PointsInRank[MAX_REPUTATION_RANK] = {36000, 3000, 3000, 3000, 6000, 12000, 21000, 1000}; diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index 517ea6cb6bd..069ae71b7cb 100755 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -16,19 +16,20 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "Map.h" -#include "World.h" #include "CellImpl.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" -#include "Transport.h" -#include "ScriptedCreature.h" -#include "WaypointManager.h" #include "GossipDef.h" +#include "Map.h" #include "MapManager.h" -#include "ObjectMgr.h" #include "MapRefManager.h" +#include "ObjectMgr.h" +#include "Pet.h" +#include "ScriptedCreature.h" #include "ScriptMgr.h" +#include "Transport.h" +#include "WaypointManager.h" +#include "World.h" /// Put scripts in the execution queue void Map::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, Object* target) diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 570a508f7d2..988ef0937c3 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -31,6 +31,7 @@ #include "GossipDef.h" #include "CreatureAI.h" #include "Player.h" +#include "WorldPacket.h" // This is the global static registry of scripts. template<class TScript> diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 68490e3b4dc..306ce8323cf 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -94,40 +94,6 @@ enum PartyOperation PARTY_OP_SWAP = 4 }; -enum PartyResult -{ - ERR_PARTY_RESULT_OK = 0, - ERR_BAD_PLAYER_NAME_S = 1, - ERR_TARGET_NOT_IN_GROUP_S = 2, - ERR_TARGET_NOT_IN_INSTANCE_S = 3, - ERR_GROUP_FULL = 4, - ERR_ALREADY_IN_GROUP_S = 5, - ERR_NOT_IN_GROUP = 6, - ERR_NOT_LEADER = 7, - ERR_PLAYER_WRONG_FACTION = 8, - ERR_IGNORING_YOU_S = 9, - ERR_LFG_PENDING = 12, - ERR_INVITE_RESTRICTED = 13, - ERR_GROUP_SWAP_FAILED = 14, // if (PartyOperation == PARTY_OP_SWAP) ERR_GROUP_SWAP_FAILED else ERR_INVITE_IN_COMBAT - ERR_INVITE_UNKNOWN_REALM = 15, - ERR_INVITE_NO_PARTY_SERVER = 16, - ERR_INVITE_PARTY_BUSY = 17, - ERR_PARTY_TARGET_AMBIGUOUS = 18, - ERR_PARTY_LFG_INVITE_RAID_LOCKED = 19, - ERR_PARTY_LFG_BOOT_LIMIT = 20, - ERR_PARTY_LFG_BOOT_COOLDOWN_S = 21, - ERR_PARTY_LFG_BOOT_IN_PROGRESS = 22, - ERR_PARTY_LFG_BOOT_TOO_FEW_PLAYERS = 23, - ERR_PARTY_LFG_BOOT_NOT_ELIGIBLE_S = 24, - ERR_RAID_DISALLOWED_BY_LEVEL = 25, - ERR_PARTY_LFG_BOOT_IN_COMBAT = 26, - ERR_VOTE_KICK_REASON_NEEDED = 27, - ERR_PARTY_LFG_BOOT_DUNGEON_COMPLETE = 28, - ERR_PARTY_LFG_BOOT_LOOT_ROLLS = 29, - ERR_PARTY_LFG_TELEPORT_IN_COMBAT = 30 -}; - - enum BFLeaveReason { BF_LEAVE_REASON_CLOSE = 0x00000001, diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 1c41f1fb2ff..71dd40fdd37 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -39,6 +39,8 @@ #include "Battlefield.h" #include "BattlefieldMgr.h" #include "WeatherMgr.h" +#include "Pet.h" +#include "ReputationMgr.h" class Aura; // diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index c7990eb1ed6..11368e990f5 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -65,6 +65,7 @@ #include "InstanceScript.h" #include "Guild.h" #include "GuildMgr.h" +#include "ReputationMgr.h" pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= { diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h index a86a1059e7d..df6dd7fe4f3 100755 --- a/src/server/game/Texts/CreatureTextMgr.h +++ b/src/server/game/Texts/CreatureTextMgr.h @@ -22,6 +22,7 @@ #include "GridNotifiers.h" #include "ObjectAccessor.h" #include "SharedDefines.h" +#include "Opcodes.h" struct CreatureTextEntry { diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index 89dd28f6a30..ccad818249d 100644 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -20,11 +20,13 @@ #include "TicketMgr.h" #include "DatabaseEnv.h" #include "Log.h" +#include "Language.h" #include "WorldPacket.h" #include "WorldSession.h" #include "Chat.h" #include "World.h" #include "Player.h" +#include "Opcodes.h" inline float GetAge(uint64 t) { return float(time(NULL) - t) / DAY; } diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index f5cd88df58d..7e3ac8b319d 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -22,6 +22,7 @@ #include "UpdateFields.h" #include "ObjectMgr.h" #include "AccountMgr.h" +#include "World.h" #define DUMP_TABLE_COUNT 29 struct DumpTable diff --git a/src/server/game/Weather/Weather.cpp b/src/server/game/Weather/Weather.cpp index 896e7161606..c5167a5aeb2 100755 --- a/src/server/game/Weather/Weather.cpp +++ b/src/server/game/Weather/Weather.cpp @@ -28,6 +28,8 @@ #include "ObjectMgr.h" #include "Util.h" #include "ScriptMgr.h" +#include "Opcodes.h" +#include "WorldSession.h" /// Create the Weather object Weather::Weather(uint32 zone, WeatherData const* weatherChances) diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index 6148005ca6b..efd2b4ed936 100755 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -26,6 +26,9 @@ #include "ObjectMgr.h" #include "AutoPtr.h" #include "Player.h" +#include "WorldPacket.h" +#include "Opcodes.h" +#include "WorldSession.h" namespace WeatherMgr { diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 230f96e4997..917ab6c5fec 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -491,41 +491,6 @@ enum WorldStates WS_GUILD_WEEKLY_RESET_TIME = 20007, // Next guild week reset time }; -// DB scripting commands -enum ScriptCommands -{ - SCRIPT_COMMAND_TALK = 0, // source/target = Creature, target = any, datalong = talk type (0=say, 1=whisper, 2=yell, 3=emote text, 4=boss emote text), datalong2 & 1 = player talk (instead of creature), dataint = string_id - SCRIPT_COMMAND_EMOTE = 1, // source/target = Creature, datalong = emote id, datalong2 = 0: set emote state; > 0: play emote state - SCRIPT_COMMAND_FIELD_SET = 2, // source/target = Creature, datalong = field id, datalog2 = value - SCRIPT_COMMAND_MOVE_TO = 3, // source/target = Creature, datalong2 = time to reach, x/y/z = destination - SCRIPT_COMMAND_FLAG_SET = 4, // source/target = Creature, datalong = field id, datalog2 = bitmask - SCRIPT_COMMAND_FLAG_REMOVE = 5, // source/target = Creature, datalong = field id, datalog2 = bitmask - SCRIPT_COMMAND_TELEPORT_TO = 6, // source/target = Creature/Player (see datalong2), datalong = map_id, datalong2 = 0: Player; 1: Creature, x/y/z = destination, o = orientation - SCRIPT_COMMAND_QUEST_EXPLORED = 7, // target/source = Player, target/source = GO/Creature, datalong = quest id, datalong2 = distance or 0 - SCRIPT_COMMAND_KILL_CREDIT = 8, // target/source = Player, datalong = creature entry, datalong2 = 0: personal credit, 1: group credit - SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9, // source = WorldObject (summoner), datalong = GO guid, datalong2 = despawn delay - SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10, // source = WorldObject (summoner), datalong = creature entry, datalong2 = despawn delay, x/y/z = summon position, o = orientation - SCRIPT_COMMAND_OPEN_DOOR = 11, // source = Unit, datalong = GO guid, datalong2 = reset delay (min 15) - SCRIPT_COMMAND_CLOSE_DOOR = 12, // source = Unit, datalong = GO guid, datalong2 = reset delay (min 15) - SCRIPT_COMMAND_ACTIVATE_OBJECT = 13, // source = Unit, target = GO - SCRIPT_COMMAND_REMOVE_AURA = 14, // source (datalong2 != 0) or target (datalong2 == 0) = Unit, datalong = spell id - SCRIPT_COMMAND_CAST_SPELL = 15, // source and/or target = Unit, datalong2 = cast direction (0: s->t 1: s->s 2: t->t 3: t->s 4: s->creature with dataint entry), dataint & 1 = triggered flag - SCRIPT_COMMAND_PLAY_SOUND = 16, // source = WorldObject, target = none/Player, datalong = sound id, datalong2 (bitmask: 0/1=anyone/player, 0/2=without/with distance dependency, so 1|2 = 3 is target with distance dependency) - SCRIPT_COMMAND_CREATE_ITEM = 17, // target/source = Player, datalong = item entry, datalong2 = amount - SCRIPT_COMMAND_DESPAWN_SELF = 18, // target/source = Creature, datalong = despawn delay - - SCRIPT_COMMAND_LOAD_PATH = 20, // source = Unit, datalong = path id, datalong2 = is repeatable - SCRIPT_COMMAND_CALLSCRIPT_TO_UNIT = 21, // source = WorldObject (if present used as a search center), datalong = script id, datalong2 = unit lowguid, dataint = script table to use (see ScriptsType) - SCRIPT_COMMAND_KILL = 22, // source/target = Creature, dataint = remove corpse attribute - - // TrinityCore only - SCRIPT_COMMAND_ORIENTATION = 30, // source = Unit, target (datalong > 0) = Unit, datalong = > 0 turn source to face target, o = orientation - SCRIPT_COMMAND_EQUIP = 31, // soucre = Creature, datalong = equipment id - SCRIPT_COMMAND_MODEL = 32, // source = Creature, datalong = model id - SCRIPT_COMMAND_CLOSE_GOSSIP = 33, // source = Player - SCRIPT_COMMAND_PLAYMOVIE = 34 // source = Player, datalong = movie id -}; - /// Storage class for commands issued for delayed execution struct CliCommandHolder { |
