diff --git a/src/game/AI/AggressorAI.cpp b/src/game/AI/AggressorAI.cpp index b0fc5ddbc..3306f8b79 100644 --- a/src/game/AI/AggressorAI.cpp +++ b/src/game/AI/AggressorAI.cpp @@ -21,6 +21,7 @@ #include "AggressorAI.h" #include "Creature.h" +#include "Map.h" int AggressorAI::Permissible(Creature const* creature) { diff --git a/src/game/AI/CreatureAI.cpp b/src/game/AI/CreatureAI.cpp index 601f9f729..f8b994f0d 100644 --- a/src/game/AI/CreatureAI.cpp +++ b/src/game/AI/CreatureAI.cpp @@ -24,7 +24,14 @@ #include "Creature.h" #include "DBCStores.h" #include "Totem.h" -#include "GridSearchers.h" +#include "ObjectMgr.h" +#include "ScriptMgr.h" +#include "Group.h" + +CreatureAI::CreatureAI(Creature* creature) : m_creature(creature), m_bUseAiAtControl(false), m_bMeleeAttack(true), m_bCombatMovement(true), m_uiCastingDelay(0), m_uLastAlertTime(0) +{ + SetSpellsList(creature->GetCreatureInfo()->spell_list_id); +} CreatureAI::~CreatureAI() { diff --git a/src/game/AI/CreatureAI.h b/src/game/AI/CreatureAI.h index 9625649a3..28e4aae1e 100644 --- a/src/game/AI/CreatureAI.h +++ b/src/game/AI/CreatureAI.h @@ -23,14 +23,10 @@ #define MANGOS_CREATUREAI_H #include "Common.h" -#include "Platform/Define.h" -#include "Policies/Singleton.h" #include "Dynamic/ObjectRegistry.h" #include "Dynamic/FactoryHolder.h" #include "ObjectGuid.h" -#include "ObjectMgr.h" - -#include "Utilities/EventMap.h" +#include "CreatureDefines.h" class WorldObject; class GameObject; @@ -66,10 +62,7 @@ struct CreatureAISpellsEntry : CreatureSpellsEntry class CreatureAI { public: - explicit CreatureAI(Creature* creature) : m_creature(creature), m_bUseAiAtControl(false), m_bMeleeAttack(true), m_bCombatMovement(true), m_uiCastingDelay(0), m_uLastAlertTime(0) - { - SetSpellsList(creature->GetCreatureInfo()->spell_list_id); - } + explicit CreatureAI(Creature* creature); virtual ~CreatureAI(); virtual void OnRemoveFromWorld() {} diff --git a/src/game/AI/CreatureEventAI.cpp b/src/game/AI/CreatureEventAI.cpp index 113ca0588..e5362ee94 100644 --- a/src/game/AI/CreatureEventAI.cpp +++ b/src/game/AI/CreatureEventAI.cpp @@ -20,22 +20,16 @@ */ #include "Common.h" +#include "Creature.h" #include "CreatureEventAI.h" #include "CreatureEventAIMgr.h" -#include "ObjectMgr.h" -#include "Spell.h" -#include "World.h" -#include "Cell.h" -#include "CellImpl.h" -#include "GameEventMgr.h" -#include "GridNotifiers.h" -#include "GridNotifiersImpl.h" -#include "InstanceData.h" +#include "Player.h" +#include "SpellAuras.h" #include "Chat.h" #include "Language.h" -#include "ScriptMgr.h" -#include "CreatureAI.h" #include "GuardMgr.h" +#include "Conditions.h" +#include "Map.h" bool CreatureEventAIHolder::UpdateRepeatTimer(Creature* creature, uint32 repeatMin, uint32 repeatMax) { @@ -132,7 +126,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction if (pHolder.Event.event_inverse_phase_mask & (1 << m_Phase)) return false; - if (pHolder.Event.condition_id && !sObjectMgr.IsConditionSatisfied(pHolder.Event.condition_id, pActionInvoker ? pActionInvoker : m_creature->GetVictim(), m_creature->GetMap(), m_creature, CONDITION_FROM_EVENTAI)) + if (pHolder.Event.condition_id && !IsConditionSatisfied(pHolder.Event.condition_id, pActionInvoker ? pActionInvoker : m_creature->GetVictim(), m_creature->GetMap(), m_creature, CONDITION_FROM_EVENTAI)) return false; CreatureEventAI_Event const& event = pHolder.Event; diff --git a/src/game/AI/CreatureEventAI.h b/src/game/AI/CreatureEventAI.h index 119a08f4b..23ba7cf19 100644 --- a/src/game/AI/CreatureEventAI.h +++ b/src/game/AI/CreatureEventAI.h @@ -24,6 +24,7 @@ #include "Common.h" #include "CreatureAI.h" +#include "ScriptMgr.h" class Unit; class Creature; diff --git a/src/game/AI/GameObjectAI.h b/src/game/AI/GameObjectAI.h index c42843a9b..a87b5fa1b 100644 --- a/src/game/AI/GameObjectAI.h +++ b/src/game/AI/GameObjectAI.h @@ -1,9 +1,12 @@ #ifndef _HEADER_GAMEOBJECT_AI #define _HEADER_GAMEOBJECT_AI -#include "SharedDefines.h" +#include "Common.h" +class Unit; +class Creature; class GameObject; +class ObjectGuid; class GameObjectAI { diff --git a/src/game/AI/GenericSpellAI.cpp b/src/game/AI/GenericSpellAI.cpp index 45bc0fb3c..cb7a2984d 100644 --- a/src/game/AI/GenericSpellAI.cpp +++ b/src/game/AI/GenericSpellAI.cpp @@ -1,7 +1,7 @@ -#include "ProgressBar.h" -#include "SpellMgr.h" #include "ScriptedAI.h" -#include "ScriptedInstance.h" +#include "Creature.h" +#include "SpellMgr.h" +#include "ScriptMgr.h" #include "Util.h" #define DEFAULT_MIN_CD 5000 @@ -74,12 +74,9 @@ struct GenericSpellMob : public ScriptedAI { GenericSpellMob(Creature* pCreature) : ScriptedAI(pCreature) { - m_pInstance = (ScriptedInstance*)pCreature->GetInstanceData(); Reset(); } - ScriptedInstance* m_pInstance; - std::vector m_uiSpells; // Si 'true', le mob attaquera a distance tant qu'il aura du mana. diff --git a/src/game/AI/GuardAI.cpp b/src/game/AI/GuardAI.cpp index 7343cde4e..b3d03ef3f 100644 --- a/src/game/AI/GuardAI.cpp +++ b/src/game/AI/GuardAI.cpp @@ -21,7 +21,6 @@ #include "GuardAI.h" #include "Creature.h" -#include "Player.h" int GuardAI::Permissible(Creature const* creature) { diff --git a/src/game/AI/GuardEventAI.cpp b/src/game/AI/GuardEventAI.cpp index da4a851e0..c6e3837bb 100644 --- a/src/game/AI/GuardEventAI.cpp +++ b/src/game/AI/GuardEventAI.cpp @@ -17,6 +17,7 @@ */ #include "GuardEventAI.h" +#include "Creature.h" GuardEventAI::GuardEventAI(Creature* pCreature) : CreatureEventAI(pCreature) {} diff --git a/src/game/AI/NullCreatureAI.cpp b/src/game/AI/NullCreatureAI.cpp index 6bba4046e..857660709 100644 --- a/src/game/AI/NullCreatureAI.cpp +++ b/src/game/AI/NullCreatureAI.cpp @@ -22,6 +22,13 @@ #include "NullCreatureAI.h" #include "Creature.h" +NullCreatureAI::NullCreatureAI(Creature* c) : CreatureAI(c) +{ + c->AddUnitState(UNIT_STAT_IGNORE_MOVE_LOS); + m_bMeleeAttack = false; + m_bCombatMovement = false; +} + NullCreatureAI::~NullCreatureAI() { } diff --git a/src/game/AI/NullCreatureAI.h b/src/game/AI/NullCreatureAI.h index 0f2f2c052..e3403060c 100644 --- a/src/game/AI/NullCreatureAI.h +++ b/src/game/AI/NullCreatureAI.h @@ -28,12 +28,7 @@ class NullCreatureAI : public CreatureAI { public: - explicit NullCreatureAI(Creature* c) : CreatureAI(c) - { - c->AddUnitState(UNIT_STAT_IGNORE_MOVE_LOS); - m_bMeleeAttack = false; - m_bCombatMovement = false; - } + explicit NullCreatureAI(Creature* c); ~NullCreatureAI() override; void MoveInLineOfSight(Unit*) override {} diff --git a/src/game/AI/PetAI.cpp b/src/game/AI/PetAI.cpp index fd1600ff2..e7635fe72 100644 --- a/src/game/AI/PetAI.cpp +++ b/src/game/AI/PetAI.cpp @@ -23,15 +23,13 @@ #include "Errors.h" #include "Pet.h" #include "Player.h" -#include "DBCStores.h" #include "Spell.h" -#include "ObjectAccessor.h" #include "SpellMgr.h" +#include "ScriptMgr.h" #include "Creature.h" -#include "World.h" #include "Util.h" #include "Group.h" -#include "SpellAuras.h" +#include "SpellAuraDefines.h" int PetAI::Permissible(Creature const* creature) { diff --git a/src/game/AI/PetAI.h b/src/game/AI/PetAI.h index b80f30e02..f7ca17677 100644 --- a/src/game/AI/PetAI.h +++ b/src/game/AI/PetAI.h @@ -23,8 +23,6 @@ #define MANGOS_PETAI_H #include "CreatureAI.h" -#include "ObjectGuid.h" -#include "Timer.h" class Creature; class Spell; diff --git a/src/game/AI/PetEventAI.cpp b/src/game/AI/PetEventAI.cpp index d22a94c3d..f45dd8f90 100644 --- a/src/game/AI/PetEventAI.cpp +++ b/src/game/AI/PetEventAI.cpp @@ -18,7 +18,7 @@ #include "PetEventAI.h" #include "Pet.h" -#include "CreatureEventAI.h" +#include "Player.h" PetEventAI::PetEventAI(Creature* pCreature) : CreatureEventAI(pCreature) {} diff --git a/src/game/AI/PlayerAI.cpp b/src/game/AI/PlayerAI.cpp index 55025c0a1..82edc40ba 100644 --- a/src/game/AI/PlayerAI.cpp +++ b/src/game/AI/PlayerAI.cpp @@ -20,10 +20,8 @@ #include "PlayerAI.h" #include "Player.h" #include "DBCStores.h" -#include "Log.h" #include "SpellMgr.h" #include "MotionMaster.h" -#include "MoveSpline.h" #include "Spell.h" // Misc spells we dont want players to cast @@ -48,26 +46,27 @@ PlayerAI::~PlayerAI() { } -CanCastResult PlayerAI::CanCastSpell(Unit* pTarget, SpellEntry const* pSpell, bool isTriggered, bool checkControlled) +bool PlayerAI::CanCastSpell(Unit* pTarget, SpellEntry const* pSpell, bool isTriggered, bool checkControlled) { if (!pTarget) - return CAST_FAIL_OTHER; + return false; + // If not triggered, we check if (!isTriggered) { // State does not allow if (me->HasUnitState(checkControlled ? UNIT_STAT_CAN_NOT_REACT_OR_LOST_CONTROL : UNIT_STAT_CAN_NOT_REACT)) - return CAST_FAIL_STATE; + return false; if (pSpell->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) - return CAST_FAIL_STATE; + return false; if (pSpell->PreventionType == SPELL_PREVENTION_TYPE_PACIFY && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)) - return CAST_FAIL_STATE; + return false; // Check for power (also done by Spell::CheckCast()) if (me->GetPower((Powers)pSpell->powerType) < pSpell->manaCost) - return CAST_FAIL_POWER; + return false; } if (SpellRangeEntry const* pSpellRange = sSpellRangeStore.LookupEntry(pSpell->rangeIndex)) @@ -78,17 +77,17 @@ CanCastResult PlayerAI::CanCastSpell(Unit* pTarget, SpellEntry const* pSpell, bo float fDistance = me->GetCombatDistance(pTarget); if (fDistance > pSpellRange->maxRange) - return CAST_FAIL_TOO_FAR; + return false; float fMinRange = pSpellRange->minRange; if (fMinRange && fDistance < fMinRange) - return CAST_FAIL_TOO_CLOSE; + return false; } - return CAST_OK; + return true; } - else - return CAST_FAIL_OTHER; + + return false; } void PlayerAI::UpdateAI(uint32 const /*diff*/) @@ -391,7 +390,7 @@ void PlayerControlledAI::UpdateAI(uint32 const uiDiff) if (spellInfo) { - if (CanCastSpell(spellTarget, spellInfo, false, false) == CAST_OK) + if (CanCastSpell(spellTarget, spellInfo, false, false)) { me->CastSpell(spellTarget, spellId, false); uiGlobalCD = 1500; diff --git a/src/game/AI/PlayerAI.h b/src/game/AI/PlayerAI.h index 8f3646e19..7b31380f6 100644 --- a/src/game/AI/PlayerAI.h +++ b/src/game/AI/PlayerAI.h @@ -21,11 +21,7 @@ #define MANGOS_PLAYERAI_H #include "Common.h" -#include "Platform/Define.h" -#include "Policies/Singleton.h" -#include "Dynamic/ObjectRegistry.h" -#include "Dynamic/FactoryHolder.h" -#include "CreatureAI.h" // Pour 'enum CanCastResult' +#include "ObjectGuid.h" class WorldObject; class Unit; @@ -45,8 +41,8 @@ class PlayerAI virtual void UpdateAI(uint32 const /*diff*/); virtual void MovementInform(uint32 MovementType, uint32 Data = 0) {} - ///== Helpeurs ===================================== - CanCastResult CanCastSpell(Unit* pTarget, SpellEntry const* pSpell, bool isTriggered, bool checkControlled = true); + ///== Helpers ===================================== + bool CanCastSpell(Unit* pTarget, SpellEntry const* pSpell, bool isTriggered, bool checkControlled = true); ///== Fields ======================================= diff --git a/src/game/AI/ReactorAI.cpp b/src/game/AI/ReactorAI.cpp index c1bfd730e..0642e99a7 100644 --- a/src/game/AI/ReactorAI.cpp +++ b/src/game/AI/ReactorAI.cpp @@ -21,8 +21,12 @@ #include "ReactorAI.h" #include "Creature.h" +#include "Player.h" #include "GuardMgr.h" +ReactorAI::ReactorAI(Creature* c) : CreatureAI(c), m_bCanSummonGuards(c->CanSummonGuards()) +{} + int ReactorAI::Permissible(Creature const* creature) { if (creature->HasExtraFlag(CREATURE_FLAG_EXTRA_NO_AGGRO) || creature->IsNeutralToAll()) diff --git a/src/game/AI/ReactorAI.h b/src/game/AI/ReactorAI.h index 2126b01d6..490d829a9 100644 --- a/src/game/AI/ReactorAI.h +++ b/src/game/AI/ReactorAI.h @@ -24,11 +24,13 @@ #include "CreatureAI.h" +class Creature; + class ReactorAI : public CreatureAI { public: - explicit ReactorAI(Creature* c) : CreatureAI(c), m_bCanSummonGuards(c->CanSummonGuards()) {} + explicit ReactorAI(Creature* c); void MoveInLineOfSight(Unit*) override; void AttackStart(Unit*) override; diff --git a/src/game/AI/ScriptedAI.h b/src/game/AI/ScriptedAI.h index 52b5fc3bf..0a1e46856 100644 --- a/src/game/AI/ScriptedAI.h +++ b/src/game/AI/ScriptedAI.h @@ -6,8 +6,6 @@ #define SC_CREATURE_H #include "CreatureAI.h" -#include "Creature.h" -#include "ScriptMgr.h" #define CAST_AI(a,b) (dynamic_cast(b)) diff --git a/src/game/AI/ScriptedEscortAI.cpp b/src/game/AI/ScriptedEscortAI.cpp index df66af896..8e0c07ae3 100644 --- a/src/game/AI/ScriptedEscortAI.cpp +++ b/src/game/AI/ScriptedEscortAI.cpp @@ -9,10 +9,12 @@ SDComment: SDCategory: Npc EndScriptData */ -#include "ScriptMgr.h" #include "ScriptedEscortAI.h" +#include "ScriptMgr.h" #include "Chat.h" -#include "PointMovementGenerator.h" +#include "MovementGenerator.h" +#include "Player.h" +#include "Group.h" float const DEFAULT_MAX_PLAYER_DISTANCE = 100.0f; float const DEFAULT_MAX_ASSIST_DISTANCE = 40.0f; @@ -92,6 +94,11 @@ void npc_escortAI::Aggro(Unit* /*pEnemy*/) { } +Player* npc_escortAI::GetPlayerForEscort() const +{ + return m_creature->GetMap()->GetPlayer(m_uiPlayerGUID); +} + bool npc_escortAI::AssistPlayerInCombat(Unit* pWho) { if (!m_uiPlayerGUID) diff --git a/src/game/AI/ScriptedEscortAI.h b/src/game/AI/ScriptedEscortAI.h index ce14bc1d7..34a47f5eb 100644 --- a/src/game/AI/ScriptedEscortAI.h +++ b/src/game/AI/ScriptedEscortAI.h @@ -6,8 +6,8 @@ #define SC_ESCORTAI_H #include "ScriptedAI.h" -#include "QuestDef.h" -#include "Player.h" + +class Quest; struct Escort_Waypoint { @@ -102,7 +102,7 @@ struct npc_escortAI : ScriptedAI void GetCombatStartPosition(float &x, float &y, float &z) const { x = m_combatStartX; y = m_combatStartY; z = m_combatStartZ; } protected: - Player* GetPlayerForEscort() const { return m_creature->GetMap()->GetPlayer(m_uiPlayerGUID); } + Player* GetPlayerForEscort() const; virtual void JustStartedEscort() {} private: diff --git a/src/game/AI/ScriptedFollowerAI.cpp b/src/game/AI/ScriptedFollowerAI.cpp index 56c797b1c..e6c786aa1 100644 --- a/src/game/AI/ScriptedFollowerAI.cpp +++ b/src/game/AI/ScriptedFollowerAI.cpp @@ -11,6 +11,8 @@ EndScriptData */ #include "ScriptedFollowerAI.h" #include "Chat.h" +#include "Player.h" +#include "Group.h" float const MAX_PLAYER_DISTANCE = 100.0f; diff --git a/src/game/AI/ScriptedFollowerAI.h b/src/game/AI/ScriptedFollowerAI.h index a0d2d8b03..08132e142 100644 --- a/src/game/AI/ScriptedFollowerAI.h +++ b/src/game/AI/ScriptedFollowerAI.h @@ -6,8 +6,9 @@ #define SC_FOLLOWERAI_H #include "ScriptedAI.h" -#include "Player.h" -#include "QuestDef.h" +#include "Pet.h" + +class Player; enum eFollowState { diff --git a/src/game/AI/ScriptedInstance.cpp b/src/game/AI/ScriptedInstance.cpp index 830d4f705..39d0f25d9 100644 --- a/src/game/AI/ScriptedInstance.cpp +++ b/src/game/AI/ScriptedInstance.cpp @@ -2,8 +2,9 @@ * This program is free software licensed under GPL version 2 * Please see the included DOCS/LICENSE.TXT for more information */ -#include "Player.h" #include "ScriptedInstance.h" +#include "Player.h" +#include "GameObject.h" #define SAVE_LOAD_LOG sLog.outDebug diff --git a/src/game/AI/ScriptedInstance.h b/src/game/AI/ScriptedInstance.h index 274208f71..7f814210e 100644 --- a/src/game/AI/ScriptedInstance.h +++ b/src/game/AI/ScriptedInstance.h @@ -5,10 +5,12 @@ #ifndef SC_INSTANCE_H #define SC_INSTANCE_H -#include "Creature.h" -#include "GameObject.h" #include "InstanceData.h" #include "Map.h" +#include "ScriptMgr.h" + +class GameObject; +class Creature; enum EncounterState { diff --git a/src/game/AI/TotemAI.h b/src/game/AI/TotemAI.h index ca251b3d3..2bfd3f8a5 100644 --- a/src/game/AI/TotemAI.h +++ b/src/game/AI/TotemAI.h @@ -24,17 +24,11 @@ #include "CreatureAI.h" #include "ObjectGuid.h" -#include "Timer.h" #include "Totem.h" class Creature; class Totem; -enum -{ - NPC_TOTEM_GLEBE = 5925, -}; - class TotemAI : public CreatureAI { public: diff --git a/src/game/AccountMgr.cpp b/src/game/AccountMgr.cpp index 0d27800ad..7563cc8d4 100644 --- a/src/game/AccountMgr.cpp +++ b/src/game/AccountMgr.cpp @@ -28,9 +28,7 @@ #include "Util.h" #include "Auth/Sha1.h" #include "World.h" -#include "Chat.h" #include "WorldSession.h" -#include "Chat.h" #include "MasterPlayer.h" #include "Anticheat.h" diff --git a/src/game/Anticheat/MovementAnticheat/MovementAnticheat.cpp b/src/game/Anticheat/MovementAnticheat/MovementAnticheat.cpp index 069c736df..0b7b251c5 100644 --- a/src/game/Anticheat/MovementAnticheat/MovementAnticheat.cpp +++ b/src/game/Anticheat/MovementAnticheat/MovementAnticheat.cpp @@ -1,6 +1,7 @@ #include "Common.h" #include "Database/DatabaseEnv.h" #include "Config/Config.h" +#include "Opcodes.h" #include "MovementAnticheat.h" #include "Chat.h" #include "Player.h" @@ -76,6 +77,20 @@ const char* GetMovementCheatName(CheatType flagId) return "UnknownCheat"; } +MovementAnticheat::MovementAnticheat(Player* _me) : me(_me), m_session(_me->GetSession()) +{ +} + +MovementInfo& MovementAnticheat::GetLastMovementInfo() +{ + return me->m_movementInfo; +} + +MovementInfo const& MovementAnticheat::GetLastMovementInfo() const +{ + return me->m_movementInfo; +} + uint32 MovementAnticheat::Update(uint32 diff, std::stringstream& reason) { if (!sWorld.getConfig(CONFIG_BOOL_AC_MOVEMENT_ENABLED)) diff --git a/src/game/Anticheat/MovementAnticheat/MovementAnticheat.h b/src/game/Anticheat/MovementAnticheat/MovementAnticheat.h index 9f7b5edc3..f196f811d 100644 --- a/src/game/Anticheat/MovementAnticheat/MovementAnticheat.h +++ b/src/game/Anticheat/MovementAnticheat/MovementAnticheat.h @@ -1,12 +1,13 @@ #ifndef _HEADER_CHEATS #define _HEADER_CHEATS -#include - #include "Common.h" -#include "Player.h" +#include "UnitDefines.h" #include "Anticheat.h" +#include +#include + enum CheatType { CHEAT_TYPE_TIME_BACK, @@ -42,6 +43,8 @@ enum CheatType #define CHEATS_UPDATE_INTERVAL 4000 const char* GetMovementCheatName(CheatType type); +class Player; +class MovementInfo; class ChatHandler; class WorldSession; class WorldPacket; @@ -49,7 +52,7 @@ class WorldPacket; class MovementAnticheat { public: - explicit MovementAnticheat(Player* _me) : me(_me), m_session(_me->GetSession()) {} + explicit MovementAnticheat(Player* _me); void Init(); void InitNewPlayer(Player* pPlayer); @@ -87,8 +90,8 @@ private: uint32 CheckSpeedHack(MovementInfo const& movementInfo, uint16 opcode); uint32 CheckTimeDesync(MovementInfo const& movementInfo); - MovementInfo& GetLastMovementInfo() { return me->m_movementInfo; } - MovementInfo const& GetLastMovementInfo() const { return me->m_movementInfo; } + MovementInfo& GetLastMovementInfo(); + MovementInfo const& GetLastMovementInfo() const; UnitMoveType GetMoveTypeForMovementInfo(MovementInfo const& movementInfo) const; bool m_knockBack = false; diff --git a/src/game/Anticheat/WardenAnticheat/WardenMgr.h b/src/game/Anticheat/WardenAnticheat/WardenMgr.h index c14591037..c635588ec 100644 --- a/src/game/Anticheat/WardenAnticheat/WardenMgr.h +++ b/src/game/Anticheat/WardenAnticheat/WardenMgr.h @@ -17,6 +17,7 @@ #ifndef _WARDENCHECKMGR_H #define _WARDENCHECKMGR_H +#include #include #include #include "Auth/BigNumber.h" diff --git a/src/game/AuctionHouse/AuctionHouseBotMgr.cpp b/src/game/AuctionHouse/AuctionHouseBotMgr.cpp index 3527a011d..1b7fb71c6 100644 --- a/src/game/AuctionHouse/AuctionHouseBotMgr.cpp +++ b/src/game/AuctionHouse/AuctionHouseBotMgr.cpp @@ -1,12 +1,8 @@ #include "Database/DatabaseEnv.h" -#include "World.h" #include "Log.h" -#include "ProgressBar.h" #include "Policies/SingletonImp.h" -#include "Player.h" #include "Item.h" #include "AuctionHouseMgr.h" -#include "ObjectAccessor.h" #include "ObjectMgr.h" #include "AuctionHouseBotMgr.h" #include "Config/Config.h" diff --git a/src/game/AuctionHouse/AuctionHouseMgr.cpp b/src/game/AuctionHouse/AuctionHouseMgr.cpp index 49b5da3e8..c631d09cc 100644 --- a/src/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouse/AuctionHouseMgr.cpp @@ -21,12 +21,10 @@ #include "AuctionHouseMgr.h" #include "Database/DatabaseEnv.h" -#include "SQLStorages.h" #include "DBCStores.h" -#include "ProgressBar.h" - #include "AccountMgr.h" #include "Item.h" +#include "Bag.h" #include "Language.h" #include "Log.h" #include "ObjectMgr.h" diff --git a/src/game/AuctionHouse/AuctionHouseMgr.h b/src/game/AuctionHouse/AuctionHouseMgr.h index f2a03b9df..10f54ec1c 100644 --- a/src/game/AuctionHouse/AuctionHouseMgr.h +++ b/src/game/AuctionHouse/AuctionHouseMgr.h @@ -29,7 +29,6 @@ #include "SharedDefines.h" #include "Policies/Singleton.h" #include "DBCStructure.h" -#include "Log.h" class Item; class Player; diff --git a/src/game/AutoBroadCastMgr.h b/src/game/AutoBroadCastMgr.h index 627c9e37a..37eb1e299 100644 --- a/src/game/AutoBroadCastMgr.h +++ b/src/game/AutoBroadCastMgr.h @@ -2,7 +2,7 @@ #define _AUTOBROADCAST_MGR_H #include "Policies/Singleton.h" -#include "SharedDefines.h" +#include "Platform/Define.h" #include diff --git a/src/game/Battlegrounds/BattleGround.cpp b/src/game/Battlegrounds/BattleGround.cpp index 3310682f3..a48477769 100644 --- a/src/game/Battlegrounds/BattleGround.cpp +++ b/src/game/Battlegrounds/BattleGround.cpp @@ -24,9 +24,8 @@ #include "BattleGround.h" #include "BattleGroundMgr.h" #include "Creature.h" -#include "MapManager.h" #include "Language.h" -#include "SpellAuras.h" +#include "SpellAuraDefines.h" #include "World.h" #include "Group.h" #include "ObjectGuid.h" diff --git a/src/game/Battlegrounds/BattleGroundAB.cpp b/src/game/Battlegrounds/BattleGroundAB.cpp index 4613570af..5c224013b 100644 --- a/src/game/Battlegrounds/BattleGroundAB.cpp +++ b/src/game/Battlegrounds/BattleGroundAB.cpp @@ -23,13 +23,11 @@ #include "Player.h" #include "BattleGround.h" #include "BattleGroundAB.h" -#include "Creature.h" #include "GameObject.h" #include "BattleGroundMgr.h" #include "Language.h" #include "Util.h" #include "WorldPacket.h" -#include "MapManager.h" BattleGroundAB::BattleGroundAB() { diff --git a/src/game/Battlegrounds/BattleGroundAV.cpp b/src/game/Battlegrounds/BattleGroundAV.cpp index de9c9aae6..4ba080ec0 100644 --- a/src/game/Battlegrounds/BattleGroundAV.cpp +++ b/src/game/Battlegrounds/BattleGroundAV.cpp @@ -27,7 +27,6 @@ #include "GameObject.h" #include "Language.h" #include "WorldPacket.h" -#include "ObjectMgr.h" #include "Chat.h" diff --git a/src/game/Battlegrounds/BattleGroundMgr.cpp b/src/game/Battlegrounds/BattleGroundMgr.cpp index 999fe848a..11d6a291d 100644 --- a/src/game/Battlegrounds/BattleGroundMgr.cpp +++ b/src/game/Battlegrounds/BattleGroundMgr.cpp @@ -21,7 +21,9 @@ #include "Common.h" #include "SharedDefines.h" +#include "Opcodes.h" #include "Player.h" +#include "Group.h" #include "BattleGroundMgr.h" #include "BattleGroundAV.h" #include "BattleGroundAB.h" diff --git a/src/game/Battlegrounds/BattleGroundWS.cpp b/src/game/Battlegrounds/BattleGroundWS.cpp index 6ae94a103..da1e8c84d 100644 --- a/src/game/Battlegrounds/BattleGroundWS.cpp +++ b/src/game/Battlegrounds/BattleGroundWS.cpp @@ -23,13 +23,11 @@ #include "Player.h" #include "BattleGround.h" #include "BattleGroundWS.h" -#include "Creature.h" #include "GameObject.h" #include "ObjectMgr.h" #include "BattleGroundMgr.h" #include "WorldPacket.h" #include "Language.h" -#include "MapManager.h" #include "World.h" BattleGroundWS::BattleGroundWS() diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt index 13fdff64e..c574b3b6e 100644 --- a/src/game/CMakeLists.txt +++ b/src/game/CMakeLists.txt @@ -283,7 +283,6 @@ set (game_SRCS Chat/AsyncCommandHandlers.h Chat/AbstractPlayer.h Chat/MasterPlayer.h - Commands/Nostalrius.h Database/CharacterDatabaseCache.h Database/CharacterDatabaseCleaner.h Database/DBCEnums.h @@ -322,6 +321,7 @@ set (game_SRCS Maps/MoveMapSharedDefines.h Maps/Path.h Maps/PathFinder.h + Maps/ScriptCommands.h Maps/ZoneScript.h Maps/ZoneScriptMgr.h Maps/Pool/PoolManager.h @@ -352,11 +352,14 @@ set (game_SRCS Objects/Bag.h Objects/Corpse.h Objects/Creature.h + Objects/CreatureDefines.h Objects/DynamicObject.h Objects/GameObject.h + Objects/GameObjectDefines.h Objects/Item.h Objects/ItemPrototype.h Objects/Object.h + Objects/ObjectDefines.h Objects/Pet.h Objects/Player.h Objects/TemporarySummon.h diff --git a/src/game/Chat/AsyncCommandHandlers.cpp b/src/game/Chat/AsyncCommandHandlers.cpp index 480a108fe..0e4c56e94 100644 --- a/src/game/Chat/AsyncCommandHandlers.cpp +++ b/src/game/Chat/AsyncCommandHandlers.cpp @@ -26,8 +26,6 @@ #include "Database/SqlOperations.h" #include "Language.h" #include "Chat.h" -#include "GameEventMgr.h" -#include "ScriptMgr.h" #include "AccountMgr.h" #include "DBCStores.h" #include "Util.h" diff --git a/src/game/Chat/AsyncCommandHandlers.h b/src/game/Chat/AsyncCommandHandlers.h index 3ec340a14..00d40e302 100644 --- a/src/game/Chat/AsyncCommandHandlers.h +++ b/src/game/Chat/AsyncCommandHandlers.h @@ -29,10 +29,9 @@ #include "Database/DatabaseEnv.h" #include "Database/Database.h" #include "Database/SqlOperations.h" -#include "WorldSession.h" -#include "World.h" -enum { +enum +{ PINFO_QUERY_GOLD_SENT = 0, PINFO_QUERY_GOLD_RECEIVED, PINFO_QUERY_ACCOUNT_INFO, @@ -63,6 +62,8 @@ struct PInfoData std::string target_name; }; +class WorldSession; + /** Chain query handling for PInfo. It uses a long blocking query (select from characters) so doing it in the main thread is bad. Therefore, we just handle all the queries via diff --git a/src/game/Chat/Chat.cpp b/src/game/Chat/Chat.cpp index 26f9dc470..fe9173a8b 100644 --- a/src/game/Chat/Chat.cpp +++ b/src/game/Chat/Chat.cpp @@ -30,6 +30,7 @@ #include "ObjectMgr.h" #include "ObjectGuid.h" #include "Player.h" +#include "Group.h" #include "UpdateMask.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" diff --git a/src/game/Chat/MasterPlayer.cpp b/src/game/Chat/MasterPlayer.cpp index 54801dcaa..d744e8195 100644 --- a/src/game/Chat/MasterPlayer.cpp +++ b/src/game/Chat/MasterPlayer.cpp @@ -4,8 +4,10 @@ #include "SocialMgr.h" #include "Item.h" #include "Mail.h" +#include "Bag.h" #include "ObjectAccessor.h" #include "WorldPacket.h" +#include "Opcodes.h" MasterPlayer::MasterPlayer(WorldSession* s): m_speakTime(0), m_speakCount(0), m_social(nullptr), diff --git a/src/game/Commands/AccountCommands.cpp b/src/game/Commands/AccountCommands.cpp index 40796acea..d553619d2 100644 --- a/src/game/Commands/AccountCommands.cpp +++ b/src/game/Commands/AccountCommands.cpp @@ -26,7 +26,6 @@ #include "AccountMgr.h" #include "ObjectMgr.h" #include "SystemConfig.h" -#include "revision.h" #include "Util.h" #include "AsyncCommandHandlers.h" #include "Anticheat.h" diff --git a/src/game/Commands/CharacterCommands.cpp b/src/game/Commands/CharacterCommands.cpp index cb13cbb66..68f390e48 100644 --- a/src/game/Commands/CharacterCommands.cpp +++ b/src/game/Commands/CharacterCommands.cpp @@ -19,23 +19,21 @@ #include "Database/DatabaseImpl.h" #include "World.h" #include "Player.h" +#include "Group.h" +#include "Bag.h" #include "Opcodes.h" #include "Chat.h" #include "ObjectAccessor.h" #include "Language.h" #include "AccountMgr.h" #include "ObjectMgr.h" -#include "ScriptMgr.h" #include "SystemConfig.h" -#include "revision.h" #include "Util.h" -#include "Mail.h" #include "AsyncCommandHandlers.h" #include "WaypointMovementGenerator.h" #include "PlayerDump.h" #include "CharacterDatabaseCache.h" #include "Config/Config.h" -#include "PlayerAI.h" #include diff --git a/src/game/Commands/CreatureCommands.cpp b/src/game/Commands/CreatureCommands.cpp index e128718a7..79b2fe43b 100644 --- a/src/game/Commands/CreatureCommands.cpp +++ b/src/game/Commands/CreatureCommands.cpp @@ -16,17 +16,14 @@ #include "Common.h" #include "Database/DatabaseEnv.h" -#include "World.h" #include "Player.h" #include "Chat.h" #include "Language.h" #include "ObjectMgr.h" #include "ScriptMgr.h" -#include "SystemConfig.h" -#include "revision.h" #include "Util.h" #include "Creature.h" -#include "CreatureAI.h" +#include "CreatureGroups.h" #include "TemporarySummon.h" #include "Totem.h" #include "GridNotifiers.h" @@ -231,7 +228,7 @@ bool ChatHandler::HandleNpcSetLevelCommand(char* args) return false; uint8 lvl = (uint8) atoi(args); - if (lvl < 1 || lvl > sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL) + 3) + if (lvl < 1) { SendSysMessage(LANG_BAD_VALUE); SetSentErrorMessage(true); diff --git a/src/game/Commands/DebugCommands.cpp b/src/game/Commands/DebugCommands.cpp index b4bf3619c..aff81de99 100644 --- a/src/game/Commands/DebugCommands.cpp +++ b/src/game/Commands/DebugCommands.cpp @@ -24,10 +24,10 @@ #include "DBCStores.h" #include "WorldPacket.h" #include "Player.h" +#include "Bag.h" #include "Opcodes.h" #include "Chat.h" #include "Log.h" -#include "GossipDef.h" #include "Language.h" #include "BattleGroundMgr.h" #include @@ -36,6 +36,8 @@ #include "SpellMgr.h" #include "SpellModMgr.h" #include "World.h" +#include "ScriptMgr.h" +#include "Conditions.h" // VMAPS #include "VMapFactory.h" #include "ModelInstance.h" @@ -584,7 +586,7 @@ bool ChatHandler::HandleDebugConditionCommand(char* args) if (pSource && pTarget) { - if (sObjectMgr.IsConditionSatisfied(conditionId, pTarget, pSource->GetMap(), pSource, CONDITION_FROM_DBSCRIPTS)) + if (IsConditionSatisfied(conditionId, pTarget, pSource->GetMap(), pSource, CONDITION_FROM_DBSCRIPTS)) SendSysMessage("Condition is satisfied."); else SendSysMessage("Condition is not satisfied."); diff --git a/src/game/Commands/LookupCommands.cpp b/src/game/Commands/LookupCommands.cpp index 86ef93cc3..6560afc45 100644 --- a/src/game/Commands/LookupCommands.cpp +++ b/src/game/Commands/LookupCommands.cpp @@ -17,18 +17,15 @@ #include "Common.h" #include "Database/DatabaseEnv.h" #include "Database/DatabaseImpl.h" -#include "World.h" #include "Player.h" #include "Chat.h" #include "Language.h" #include "AccountMgr.h" #include "ObjectMgr.h" +#include "Guild.h" #include "GuildMgr.h" -#include "SystemConfig.h" -#include "revision.h" #include "Util.h" #include "AsyncCommandHandlers.h" -#include "Guild.h" #include "GameEventMgr.h" bool ChatHandler::HandleListObjectCommand(char* args) diff --git a/src/game/Commands/MiscCommands.cpp b/src/game/Commands/MiscCommands.cpp index 1960f3778..9e2c69f9d 100644 --- a/src/game/Commands/MiscCommands.cpp +++ b/src/game/Commands/MiscCommands.cpp @@ -16,15 +16,14 @@ #include "Common.h" #include "Database/DatabaseEnv.h" +#include "Opcodes.h" #include "World.h" #include "Player.h" -#include "Opcodes.h" +#include "Group.h" #include "Chat.h" #include "ObjectAccessor.h" #include "Language.h" #include "ObjectMgr.h" -#include "SystemConfig.h" -#include "revision.h" #include "Util.h" #include "Guild.h" #include "GuildMgr.h" diff --git a/src/game/Commands/Nostalrius.h b/src/game/Commands/Nostalrius.h deleted file mode 100644 index 8168a5376..000000000 --- a/src/game/Commands/Nostalrius.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -Nostalrius custom header. -Used for : -- Configuration defines -*/ -//#define CONFIG_NOSTALRIUS_MAX 3 - -#ifndef NOSTALRIUS_HEADER -#define NOSTALRIUS_HEADER - -enum WorldMasks -{ - // Ne voit absolument rien - WORLD_ALONE = 0x00, - WORLD_DEFAULT_MASK = 0x01, - // Helpeurs - WORLD_DEFAULT_OBJECT = (WORLD_DEFAULT_MASK), - WORLD_DEFAULT_UNIT = (WORLD_DEFAULT_MASK), - WORLD_DEFAULT_CREATURE = (WORLD_DEFAULT_MASK), - WORLD_DEFAULT_CHAR = (WORLD_DEFAULT_MASK), - WORLD_SEE_ALL = 0xF, -}; - -#endif diff --git a/src/game/Commands/ObjectCommands.cpp b/src/game/Commands/ObjectCommands.cpp index 9e4a59b12..0a1a28936 100644 --- a/src/game/Commands/ObjectCommands.cpp +++ b/src/game/Commands/ObjectCommands.cpp @@ -16,14 +16,11 @@ #include "Common.h" #include "Database/DatabaseEnv.h" -#include "World.h" #include "Player.h" #include "Chat.h" #include "ObjectAccessor.h" #include "Language.h" #include "ObjectMgr.h" -#include "SystemConfig.h" -#include "revision.h" #include "Util.h" #include "GameEventMgr.h" #include "GridNotifiers.h" diff --git a/src/game/Commands/ServerCommands.cpp b/src/game/Commands/ServerCommands.cpp index ea2e8f3cb..63eabef31 100644 --- a/src/game/Commands/ServerCommands.cpp +++ b/src/game/Commands/ServerCommands.cpp @@ -16,6 +16,7 @@ #include "Common.h" #include "Database/DatabaseEnv.h" +#include "Opcodes.h" #include "World.h" #include "Player.h" #include "Chat.h" @@ -38,6 +39,7 @@ #include "AuraRemovalMgr.h" #include "AutoBroadCastMgr.h" #include "SpellModMgr.h" +#include "CreatureGroups.h" bool ChatHandler::HandleAnnounceCommand(char* args) { diff --git a/src/game/Commands/TeleportCommands.cpp b/src/game/Commands/TeleportCommands.cpp index 6743e02b5..5b7033d31 100644 --- a/src/game/Commands/TeleportCommands.cpp +++ b/src/game/Commands/TeleportCommands.cpp @@ -16,14 +16,12 @@ #include "Common.h" #include "Database/DatabaseEnv.h" -#include "World.h" #include "Player.h" +#include "Group.h" #include "Chat.h" #include "ObjectAccessor.h" #include "Language.h" #include "ObjectMgr.h" -#include "SystemConfig.h" -#include "revision.h" #include "Util.h" bool ChatHandler::HandleTeleCommand(char* args) diff --git a/src/game/Commands/TicketCommands.cpp b/src/game/Commands/TicketCommands.cpp index 7bfba2a72..de5746f8a 100644 --- a/src/game/Commands/TicketCommands.cpp +++ b/src/game/Commands/TicketCommands.cpp @@ -5,7 +5,6 @@ #include "Opcodes.h" #include "Player.h" #include "GMTicketMgr.h" -#include "ScriptMgr.h" #include "World.h" bool ChatHandler::HandleGMTicketAssignToCommand(char* args) diff --git a/src/game/Commands/UnitCommands.cpp b/src/game/Commands/UnitCommands.cpp index 5a2ca9a28..433ebec71 100644 --- a/src/game/Commands/UnitCommands.cpp +++ b/src/game/Commands/UnitCommands.cpp @@ -15,14 +15,11 @@ */ #include "Common.h" -#include "Database/DatabaseEnv.h" #include "World.h" #include "Player.h" #include "Chat.h" #include "Language.h" #include "ObjectMgr.h" -#include "SystemConfig.h" -#include "revision.h" #include "Util.h" #include "SpellAuras.h" #include "TargetedMovementGenerator.h" diff --git a/src/game/Conditions.cpp b/src/game/Conditions.cpp index 25a6ecb67..b2b7ef2e5 100644 --- a/src/game/Conditions.cpp +++ b/src/game/Conditions.cpp @@ -18,7 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "Unit.h" +#include "Conditions.h" #include "Player.h" #include "GameEventMgr.h" #include "SpellAuras.h" diff --git a/src/game/Conditions.h b/src/game/Conditions.h index e4143fb2d..3d16d4855 100644 --- a/src/game/Conditions.h +++ b/src/game/Conditions.h @@ -23,6 +23,9 @@ #include "SharedDefines.h" +class Map; +class WorldObject; + enum ConditionType { // // Legend: diff --git a/src/game/Database/CharacterDatabaseCleaner.cpp b/src/game/Database/CharacterDatabaseCleaner.cpp index a6dbc712d..a9506459c 100644 --- a/src/game/Database/CharacterDatabaseCleaner.cpp +++ b/src/game/Database/CharacterDatabaseCleaner.cpp @@ -24,7 +24,6 @@ #include "World.h" #include "Database/DatabaseEnv.h" #include "DBCStores.h" -#include "ProgressBar.h" #include "SpellMgr.h" void CharacterDatabaseCleaner::CleanDatabase() diff --git a/src/game/Database/DBCStores.cpp b/src/game/Database/DBCStores.cpp index 2fd2d7092..bf6979919 100644 --- a/src/game/Database/DBCStores.cpp +++ b/src/game/Database/DBCStores.cpp @@ -18,13 +18,10 @@ */ #include "DBCStores.h" -#include "Policies/SingletonImp.h" #include "Log.h" #include "ProgressBar.h" #include "SharedDefines.h" #include "ObjectGuid.h" -#include "Map.h" -#include "SQLStorages.h" #include "DBCfmt.h" #include "SpellMgr.h" #include "ObjectMgr.h" diff --git a/src/game/Database/DBCStructure.h b/src/game/Database/DBCStructure.h index 474b024c5..9483a7d64 100644 --- a/src/game/Database/DBCStructure.h +++ b/src/game/Database/DBCStructure.h @@ -25,7 +25,6 @@ #include "Common.h" #include "DBCEnums.h" #include "Path.h" -#include "Platform/Define.h" #include "SpellClassMask.h" #include diff --git a/src/game/Formulas.h b/src/game/Formulas.h index 8c36ecbaf..28467c7bd 100644 --- a/src/game/Formulas.h +++ b/src/game/Formulas.h @@ -23,7 +23,8 @@ #define MANGOS_FORMULAS_H #include "World.h" -#include "ObjectMgr.h" +#include "Creature.h" +#include "Player.h" namespace MaNGOS { diff --git a/src/game/GMTicketMgr.cpp b/src/game/GMTicketMgr.cpp index 2ba452604..bde636ba6 100644 --- a/src/game/GMTicketMgr.cpp +++ b/src/game/GMTicketMgr.cpp @@ -19,15 +19,16 @@ #include "Common.h" #include "GMTicketMgr.h" #include "Database/DatabaseEnv.h" +#include "Database/DatabaseImpl.h" #include "Log.h" #include "Language.h" +#include "Opcodes.h" #include "WorldPacket.h" #include "WorldSession.h" #include "Chat.h" #include "World.h" #include "Player.h" -#include "Opcodes.h" -#include "Database/DatabaseImpl.h" +#include "ObjectMgr.h" inline float GetAge(uint64 t) { return float(time(nullptr) - t) / DAY; } @@ -227,6 +228,26 @@ char const* GmTicket::GetTicketCategoryName(TicketType category) const return "Unknown"; } +Player* GmTicket::GetPlayer() const +{ + return ObjectAccessor::FindPlayer(_playerGuid); +} + +Player* GmTicket::GetAssignedPlayer() const +{ + return ObjectAccessor::FindPlayer(_assignedTo); +} + +std::string GmTicket::GetAssignedToName() const +{ + std::string name; + // save queries if ticket is not assigned + if (_assignedTo) + sObjectMgr.GetPlayerNameByGUID(_assignedTo, name); + + return name; +} + void GmTicket::SetUnassigned() { _assignedTo.Clear(); diff --git a/src/game/GMTicketMgr.h b/src/game/GMTicketMgr.h index addf1ed98..66cb50130 100644 --- a/src/game/GMTicketMgr.h +++ b/src/game/GMTicketMgr.h @@ -18,13 +18,16 @@ #ifndef _TICKETMGR_H #define _TICKETMGR_H +#include "SharedDefines.h" +#include "ObjectGuid.h" #include -#include "ObjectMgr.h" -#include "SharedDefines.h" - +class Player; class ChatHandler; +class Field; class QueryResult; +class WorldPacket; +class WorldSession; // from blizzard lua enum GMTicketSystemStatus @@ -94,20 +97,12 @@ public: bool IsAssignedNotTo(ObjectGuid guid) const { return IsAssigned() && !IsAssignedTo(guid); } uint32 GetId() const { return _id; } - Player* GetPlayer() const { return ObjectAccessor::FindPlayer(_playerGuid); } + Player* GetPlayer() const; std::string const& GetPlayerName() const { return _playerName; } std::string const& GetMessage() const { return _message; } - Player* GetAssignedPlayer() const { return ObjectAccessor::FindPlayer(_assignedTo); } + Player* GetAssignedPlayer() const; ObjectGuid GetAssignedToGUID() const { return _assignedTo; } - std::string GetAssignedToName() const - { - std::string name; - // save queries if ticket is not assigned - if (_assignedTo) - sObjectMgr.GetPlayerNameByGUID(_assignedTo, name); - - return name; - } + std::string GetAssignedToName() const; uint64 GetLastModifiedTime() const { return _lastModifiedTime; } GMTicketEscalationStatus GetEscalatedStatus() const { return _escalatedStatus; } diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp index 1c9c39f4d..6aead2d08 100644 --- a/src/game/GameEventMgr.cpp +++ b/src/game/GameEventMgr.cpp @@ -30,7 +30,6 @@ #include "Language.h" #include "Log.h" #include "MapManager.h" -#include "BattleGroundMgr.h" #include "MassMailMgr.h" #include "SpellMgr.h" #include "Policies/SingletonImp.h" diff --git a/src/game/Geometry.h b/src/game/Geometry.h index 4f4d1bb24..0f6c5491a 100644 --- a/src/game/Geometry.h +++ b/src/game/Geometry.h @@ -18,7 +18,6 @@ #define _GEOMETRY #include "Common.h" -#include "SharedDefines.h" namespace Geometry { diff --git a/src/game/Group/Group.h b/src/game/Group/Group.h index 681815d1b..01c622404 100644 --- a/src/game/Group/Group.h +++ b/src/game/Group/Group.h @@ -23,15 +23,14 @@ #define MANGOSSERVER_GROUP_H #include "Common.h" +#include "SharedDefines.h" #include "ObjectGuid.h" #include "GroupReference.h" #include "GroupRefManager.h" #include "BattleGround.h" #include "LootMgr.h" -#include "DBCEnums.h" -#include "SharedDefines.h" -#include "LFGHandler.h" #include "LFGMgr.h" +#include "DBCEnums.h" #include #include diff --git a/src/game/GuardMgr.cpp b/src/game/GuardMgr.cpp index 4f4b03f32..281ba5ea9 100644 --- a/src/game/GuardMgr.cpp +++ b/src/game/GuardMgr.cpp @@ -17,7 +17,9 @@ #include "GuardMgr.h" #include "Creature.h" #include "CreatureAI.h" +#include "Player.h" #include "World.h" +#include "ScriptMgr.h" #include "DBCStores.h" #include "Log.h" #include "Policies/SingletonImp.h" diff --git a/src/game/Guild/Guild.h b/src/game/Guild/Guild.h index bd7cd645d..b82b7a6f0 100644 --- a/src/game/Guild/Guild.h +++ b/src/game/Guild/Guild.h @@ -23,11 +23,8 @@ #define MANGOSSERVER_GUILD_H #include "Common.h" -#include "Item.h" #include "ObjectAccessor.h" -#include "SharedDefines.h" -class Item; class Petition; #define GUILD_RANKS_MIN_COUNT 5 diff --git a/src/game/Handlers/AddonHandler.cpp b/src/game/Handlers/AddonHandler.cpp index 0ae71c2ea..15b5c7bb9 100644 --- a/src/game/Handlers/AddonHandler.cpp +++ b/src/game/Handlers/AddonHandler.cpp @@ -22,6 +22,7 @@ #include "AddonHandler.h" #include "Database/DatabaseEnv.h" #include "Opcodes.h" +#include "WorldPacket.h" #include "Log.h" #include "Policies/SingletonImp.h" #include "zlib.h" diff --git a/src/game/Handlers/AddonHandler.h b/src/game/Handlers/AddonHandler.h index 24acb5578..fc8105f4d 100644 --- a/src/game/Handlers/AddonHandler.h +++ b/src/game/Handlers/AddonHandler.h @@ -24,7 +24,8 @@ #include "Common.h" #include "Policies/Singleton.h" -#include "WorldPacket.h" + +class WorldPacket; class AddonHandler { diff --git a/src/game/Handlers/AuctionHouseHandler.cpp b/src/game/Handlers/AuctionHouseHandler.cpp index b6ffb3e34..ed9517392 100644 --- a/src/game/Handlers/AuctionHouseHandler.cpp +++ b/src/game/Handlers/AuctionHouseHandler.cpp @@ -27,7 +27,6 @@ #include "ObjectMgr.h" #include "ObjectGuid.h" #include "Player.h" -#include "UpdateMask.h" #include "AuctionHouseMgr.h" #include "Mail.h" #include "Util.h" diff --git a/src/game/Handlers/BattleGroundHandler.cpp b/src/game/Handlers/BattleGroundHandler.cpp index 98bd7145f..5f5580528 100644 --- a/src/game/Handlers/BattleGroundHandler.cpp +++ b/src/game/Handlers/BattleGroundHandler.cpp @@ -24,6 +24,7 @@ #include "Opcodes.h" #include "Log.h" #include "Player.h" +#include "Group.h" #include "ObjectMgr.h" #include "WorldSession.h" #include "Object.h" diff --git a/src/game/Handlers/CharacterHandler.cpp b/src/game/Handlers/CharacterHandler.cpp index 368d672d9..b35729f89 100644 --- a/src/game/Handlers/CharacterHandler.cpp +++ b/src/game/Handlers/CharacterHandler.cpp @@ -31,7 +31,6 @@ #include "Player.h" #include "Guild.h" #include "GuildMgr.h" -#include "UpdateMask.h" #include "Auth/md5.h" #include "ObjectAccessor.h" #include "Group.h" diff --git a/src/game/Handlers/CombatHandler.cpp b/src/game/Handlers/CombatHandler.cpp index 7c190dd2d..c114408f2 100644 --- a/src/game/Handlers/CombatHandler.cpp +++ b/src/game/Handlers/CombatHandler.cpp @@ -21,6 +21,7 @@ #include "Common.h" #include "Log.h" +#include "Opcodes.h" #include "WorldPacket.h" #include "WorldSession.h" #include "CreatureAI.h" diff --git a/src/game/Handlers/GMTicketHandler.cpp b/src/game/Handlers/GMTicketHandler.cpp index 32de0e254..68ff540a1 100644 --- a/src/game/Handlers/GMTicketHandler.cpp +++ b/src/game/Handlers/GMTicketHandler.cpp @@ -27,8 +27,8 @@ #include "ObjectAccessor.h" #include "Player.h" #include "Chat.h" -#include "SpellAuras.h" #include "World.h" +#include "Opcodes.h" void WorldSession::HandleGMTicketGetTicketOpcode(WorldPacket& /*recv_data*/) { diff --git a/src/game/Handlers/ItemHandler.cpp b/src/game/Handlers/ItemHandler.cpp index d8800f7fd..d7c4c5309 100644 --- a/src/game/Handlers/ItemHandler.cpp +++ b/src/game/Handlers/ItemHandler.cpp @@ -27,8 +27,9 @@ #include "ObjectMgr.h" #include "Player.h" #include "Item.h" -#include "UpdateData.h" +#include "Bag.h" #include "Chat.h" +#include "Conditions.h" #include "Anticheat.h" void WorldSession::HandleSplitItemOpcode(WorldPacket& recv_data) @@ -823,7 +824,7 @@ void WorldSession::SendListInventory(ObjectGuid vendorguid, uint8 menu_type) ReputationRank(pProto->RequiredReputationRank) > _player->GetReputationRank(pCreature->getFactionTemplateEntry()->faction)) continue; - if (crItem->conditionId && !sObjectMgr.IsConditionSatisfied(crItem->conditionId, _player, pCreature->GetMap(), pCreature, CONDITION_FROM_VENDOR)) + if (crItem->conditionId && !IsConditionSatisfied(crItem->conditionId, _player, pCreature->GetMap(), pCreature, CONDITION_FROM_VENDOR)) continue; } diff --git a/src/game/Handlers/LFGHandler.cpp b/src/game/Handlers/LFGHandler.cpp index 79688c08c..4c299d397 100644 --- a/src/game/Handlers/LFGHandler.cpp +++ b/src/game/Handlers/LFGHandler.cpp @@ -30,10 +30,6 @@ #include "ObjectMgr.h" #include "WorldSession.h" #include "Object.h" -#include "Chat.h" -#include "Language.h" -#include "ScriptMgr.h" -#include "World.h" #include "Group.h" #include "LFGHandler.h" #include "LFGMgr.h" diff --git a/src/game/Handlers/LootHandler.cpp b/src/game/Handlers/LootHandler.cpp index c1584af54..d7041795c 100644 --- a/src/game/Handlers/LootHandler.cpp +++ b/src/game/Handlers/LootHandler.cpp @@ -20,10 +20,12 @@ */ #include "Common.h" +#include "Opcodes.h" #include "WorldPacket.h" #include "Log.h" #include "Corpse.h" #include "GameObject.h" +#include "GameObjectAI.h" #include "Player.h" #include "ObjectAccessor.h" #include "ObjectGuid.h" @@ -31,8 +33,8 @@ #include "LootMgr.h" #include "Object.h" #include "Group.h" -#include "GameObjectAI.h" #include "World.h" +#include "ScriptMgr.h" #include "Util.h" #include "Anticheat.h" diff --git a/src/game/Handlers/MiscHandler.cpp b/src/game/Handlers/MiscHandler.cpp index 27c343079..88ce2ab1d 100644 --- a/src/game/Handlers/MiscHandler.cpp +++ b/src/game/Handlers/MiscHandler.cpp @@ -27,29 +27,23 @@ #include "Opcodes.h" #include "Log.h" #include "Player.h" +#include "Group.h" #include "World.h" #include "GuildMgr.h" #include "ObjectMgr.h" #include "WorldSession.h" -#include "Auth/BigNumber.h" -#include "Auth/Sha1.h" -#include "UpdateData.h" -#include "LootMgr.h" -#include "Chat.h" #include "ScriptMgr.h" #include #include "ObjectAccessor.h" #include "Object.h" #include "BattleGround.h" #include "BattleGroundMgr.h" -#include "Pet.h" #include "SocialMgr.h" #include "Spell.h" #include "ZoneScript.h" +#include "Conditions.h" #include "Anticheat.h" #include "MasterPlayer.h" -#include "GossipDef.h" -#include "GameEventMgr.h" void WorldSession::HandleRepopRequestOpcode(WorldPacket& /*recv_data*/) { diff --git a/src/game/Handlers/MovementHandler.cpp b/src/game/Handlers/MovementHandler.cpp index 219e64983..553abc065 100644 --- a/src/game/Handlers/MovementHandler.cpp +++ b/src/game/Handlers/MovementHandler.cpp @@ -24,20 +24,15 @@ #include "WorldSession.h" #include "Opcodes.h" #include "Log.h" -#include "Corpse.h" #include "Player.h" #include "MapManager.h" #include "Transport.h" #include "BattleGround.h" #include "WaypointMovementGenerator.h" #include "MapPersistentStateMgr.h" -#include "ObjectMgr.h" - #include "World.h" #include "Anticheat.h" #include "packet_builder.h" -#include "MoveSpline.h" -#include "MovementBroadcaster.h" #include "MovementPacketSender.h" diff --git a/src/game/Handlers/NPCHandler.cpp b/src/game/Handlers/NPCHandler.cpp index b7c142552..799c1c969 100644 --- a/src/game/Handlers/NPCHandler.cpp +++ b/src/game/Handlers/NPCHandler.cpp @@ -30,13 +30,10 @@ #include "SpellMgr.h" #include "Player.h" #include "GossipDef.h" -#include "UpdateMask.h" #include "ScriptMgr.h" #include "Creature.h" #include "Pet.h" -#include "Guild.h" #include "Spell.h" -#include "GuildMgr.h" #include "Chat.h" #include "CharacterDatabaseCache.h" diff --git a/src/game/Handlers/PetHandler.cpp b/src/game/Handlers/PetHandler.cpp index cfb6317e3..b9eb24c43 100644 --- a/src/game/Handlers/PetHandler.cpp +++ b/src/game/Handlers/PetHandler.cpp @@ -30,7 +30,7 @@ #include "CreatureAI.h" #include "Util.h" #include "Pet.h" -#include "World.h" +#include "Group.h" void WorldSession::HandlePetAction(WorldPacket& recv_data) { diff --git a/src/game/Handlers/QueryHandler.cpp b/src/game/Handlers/QueryHandler.cpp index 8d5dc5866..d8588f67f 100644 --- a/src/game/Handlers/QueryHandler.cpp +++ b/src/game/Handlers/QueryHandler.cpp @@ -20,7 +20,6 @@ */ #include "Common.h" -#include "Language.h" #include "Database/DatabaseEnv.h" #include "Database/DatabaseImpl.h" #include "WorldPacket.h" @@ -31,10 +30,6 @@ #include "ObjectMgr.h" #include "ObjectGuid.h" #include "Player.h" -#include "UpdateMask.h" -#include "NPCHandler.h" -#include "Pet.h" -#include "MapManager.h" void WorldSession::SendNameQueryOpcode(Player* p) { diff --git a/src/game/Handlers/SpellHandler.cpp b/src/game/Handlers/SpellHandler.cpp index ecd3bd878..38343807f 100644 --- a/src/game/Handlers/SpellHandler.cpp +++ b/src/game/Handlers/SpellHandler.cpp @@ -23,14 +23,12 @@ #include "DBCStores.h" #include "WorldPacket.h" #include "WorldSession.h" -#include "ObjectMgr.h" #include "SpellMgr.h" #include "Log.h" #include "Opcodes.h" #include "Spell.h" -#include "ScriptMgr.h" -#include "Totem.h" #include "SpellAuras.h" +#include "GameObject.h" using namespace Spells; diff --git a/src/game/Handlers/TaxiHandler.cpp b/src/game/Handlers/TaxiHandler.cpp index 81f058a38..c5541a7f9 100644 --- a/src/game/Handlers/TaxiHandler.cpp +++ b/src/game/Handlers/TaxiHandler.cpp @@ -27,7 +27,6 @@ #include "Log.h" #include "ObjectMgr.h" #include "Player.h" -#include "UpdateMask.h" #include "Path.h" #include "WaypointMovementGenerator.h" diff --git a/src/game/Handlers/TradeHandler.cpp b/src/game/Handlers/TradeHandler.cpp index f3fabcfbe..5dd41a969 100644 --- a/src/game/Handlers/TradeHandler.cpp +++ b/src/game/Handlers/TradeHandler.cpp @@ -23,7 +23,6 @@ #include "WorldPacket.h" #include "WorldSession.h" #include "World.h" -#include "ObjectAccessor.h" #include "Log.h" #include "Opcodes.h" #include "Player.h" diff --git a/src/game/HonorMgr.cpp b/src/game/HonorMgr.cpp index d26ff524b..ecc3f9e90 100644 --- a/src/game/HonorMgr.cpp +++ b/src/game/HonorMgr.cpp @@ -11,6 +11,8 @@ #include "Database/DatabaseEnv.h" #include "Policies/SingletonImp.h" #include "ObjectAccessor.h" +#include "ObjectMgr.h" +#include "Opcodes.h" #include diff --git a/src/game/InstanceStatistics.cpp b/src/game/InstanceStatistics.cpp index fcfc4994b..542ffebf2 100644 --- a/src/game/InstanceStatistics.cpp +++ b/src/game/InstanceStatistics.cpp @@ -20,7 +20,7 @@ #include "Policies/Singleton.h" #include "Database/DatabaseEnv.h" #include "Policies/SingletonImp.h" -#include "Player.h" +#include "Map.h" #include "Creature.h" #include "SpellEntry.h" #include "ProgressBar.h" diff --git a/src/game/LFG/LFGMgr.cpp b/src/game/LFG/LFGMgr.cpp index 6eaefcf1f..684217405 100644 --- a/src/game/LFG/LFGMgr.cpp +++ b/src/game/LFG/LFGMgr.cpp @@ -24,16 +24,13 @@ #include "Policies/SingletonImp.h" #include "Common.h" -#include "ProgressBar.h" #include "SharedDefines.h" #include "Player.h" -#include "Map.h" #include "ObjectMgr.h" -#include "Chat.h" #include "World.h" #include "WorldPacket.h" #include "WorldSession.h" -#include "Language.h" +#include "Opcodes.h" #include "Group.h" #include "LFGMgr.h" #include "LFGHandler.h" diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index c6342a5ff..36cc010ee 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -26,6 +26,7 @@ #include "World.h" #include "Util.h" #include "Conditions.h" +#include "Group.h" static eConfigFloatValues const qualityToRate[MAX_ITEM_QUALITY] = { @@ -378,7 +379,7 @@ LootItem::LootItem(uint32 itemid_, uint32 count_, int32 randomPropertyId_) bool LootItem::AllowedForPlayer(Player const* player, WorldObject const* lootTarget) const { // DB conditions check - if (conditionId && !sObjectMgr.IsConditionSatisfied(conditionId, player, player->GetMap(), lootTarget, CONDITION_FROM_LOOT)) + if (conditionId && !IsConditionSatisfied(conditionId, player, player->GetMap(), lootTarget, CONDITION_FROM_LOOT)) return false; ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemid); diff --git a/src/game/Mail/Mail.cpp b/src/game/Mail/Mail.cpp index e8b496864..7b249718f 100644 --- a/src/game/Mail/Mail.cpp +++ b/src/game/Mail/Mail.cpp @@ -29,7 +29,6 @@ */ #include "Mail.h" -#include "WorldPacket.h" #include "WorldSession.h" #include "Opcodes.h" #include "Log.h" @@ -37,10 +36,6 @@ #include "ObjectMgr.h" #include "ObjectGuid.h" #include "Player.h" -#include "UpdateMask.h" -#include "Language.h" -#include "DBCStores.h" -#include "BattleGroundMgr.h" #include "Item.h" #include "AuctionHouseMgr.h" #include "MasterPlayer.h" diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index 6e3e5ce4d..8470279bc 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -52,9 +52,7 @@ #include "GridSearchers.h" #include "ThreadPool.h" #include "AuraRemovalMgr.h" -#include "GameEventMgr.h" #include "world/world_event_wareffort.h" -#include "LFGMgr.h" Map::~Map() { @@ -994,12 +992,12 @@ bool ScriptedEvent::UpdateEvent() WorldObject* pSource = GetSourceObject(); WorldObject* pTarget = GetTargetObject(); - if (m_uiFailureCondition && sObjectMgr.IsConditionSatisfied(m_uiFailureCondition, pTarget, &m_Map, pSource, CONDITION_FROM_MAP_EVENT)) + if (m_uiFailureCondition && IsConditionSatisfied(m_uiFailureCondition, pTarget, &m_Map, pSource, CONDITION_FROM_MAP_EVENT)) { EndEvent(false); return true; } - else if (m_uiSuccessCondition && sObjectMgr.IsConditionSatisfied(m_uiSuccessCondition, pTarget, &m_Map, pSource, CONDITION_FROM_MAP_EVENT)) + else if (m_uiSuccessCondition && IsConditionSatisfied(m_uiSuccessCondition, pTarget, &m_Map, pSource, CONDITION_FROM_MAP_EVENT)) { EndEvent(true); return true; @@ -1012,12 +1010,12 @@ bool ScriptedEvent::UpdateEvent() if (!pObject || !pObject->IsInWorld()) continue; - if (target.uiFailureCondition && sObjectMgr.IsConditionSatisfied(target.uiFailureCondition, pObject, &m_Map, pSource, CONDITION_FROM_MAP_EVENT)) + if (target.uiFailureCondition && IsConditionSatisfied(target.uiFailureCondition, pObject, &m_Map, pSource, CONDITION_FROM_MAP_EVENT)) { EndEvent(false); return true; } - else if (target.uiSuccessCondition && sObjectMgr.IsConditionSatisfied(target.uiSuccessCondition, pObject, &m_Map, pSource, CONDITION_FROM_MAP_EVENT)) + else if (target.uiSuccessCondition && IsConditionSatisfied(target.uiSuccessCondition, pObject, &m_Map, pSource, CONDITION_FROM_MAP_EVENT)) { EndEvent(true); return true; @@ -2359,7 +2357,7 @@ void Map::ScriptCommandStartDirect(ScriptInfo const& script, WorldObject* source { if ((script.command != SCRIPT_COMMAND_DISABLED) && FindScriptFinalTargets(source, target, script) && - (!script.condition || sObjectMgr.IsConditionSatisfied(script.condition, target, this, source, CONDITION_FROM_DBSCRIPTS))) + (!script.condition || IsConditionSatisfied(script.condition, target, this, source, CONDITION_FROM_DBSCRIPTS))) (this->*(m_ScriptCommands[script.command]))(script, source, target); } @@ -2457,7 +2455,7 @@ void Map::ScriptsProcess() bool scriptResultOk = (step.script->command != SCRIPT_COMMAND_DISABLED) && FindScriptInitialTargets(source, target, step) && FindScriptFinalTargets(source, target, *step.script) && - (!step.script->condition || sObjectMgr.IsConditionSatisfied(step.script->condition, target, this, source, CONDITION_FROM_DBSCRIPTS)); + (!step.script->condition || IsConditionSatisfied(step.script->condition, target, this, source, CONDITION_FROM_DBSCRIPTS)); if (scriptResultOk) scriptResultOk = (this->*(m_ScriptCommands[step.script->command]))(*step.script, source, target); diff --git a/src/game/Maps/Map.h b/src/game/Maps/Map.h index 7ef9c288a..db920d839 100644 --- a/src/game/Maps/Map.h +++ b/src/game/Maps/Map.h @@ -23,24 +23,20 @@ #define MANGOS_MAP_H #include "Common.h" -#include "Platform/Define.h" #include "Policies/ThreadingModel.h" - -#include "DBCStructure.h" +#include "SharedDefines.h" #include "GridDefines.h" #include "Cell.h" #include "Object.h" -#include "Timer.h" -#include "SharedDefines.h" #include "GridMap.h" #include "GameSystem/GridRefManager.h" #include "MapRefManager.h" #include "Utilities/TypeList.h" -#include "ScriptMgr.h" #include "vmap/DynamicTree.h" #include "MoveSplineInitArgs.h" #include "WorldSession.h" #include "SQLStorages.h" +#include "ScriptCommands.h" #include "CreatureLinkingMgr.h" #include @@ -56,19 +52,13 @@ class Creature; class Unit; class WorldPacket; class InstanceData; -class Group; - class CreatureGroup; - class MapPersistentState; class WorldPersistentState; class DungeonPersistentState; class BattleGroundPersistentState; class ChatHandler; - -struct ScriptInfo; class BattleGround; -class GridMap; class WeatherSystem; class Transport; diff --git a/src/game/Maps/MapManager.cpp b/src/game/Maps/MapManager.cpp index 02234f077..88fdee484 100644 --- a/src/game/Maps/MapManager.cpp +++ b/src/game/Maps/MapManager.cpp @@ -25,14 +25,13 @@ #include "Database/DatabaseEnv.h" #include "Log.h" #include "GridDefines.h" -#include "World.h" #include "CellImpl.h" -#include "Corpse.h" -#include "ObjectMgr.h" +#include "World.h" +#include "Player.h" +#include "Group.h" #include "ZoneScriptMgr.h" #include "Map.h" #include "ThreadPool.h" -#include "MoveMap.h" typedef MaNGOS::ClassLevelLockable MapManagerLock; INSTANTIATE_SINGLETON_2(MapManager, MapManagerLock); @@ -392,7 +391,7 @@ void MapManager::InitMaxInstanceId() { i_MaxInstanceId = RESERVED_INSTANCES_LAST; - QueryResult* result = CharacterDatabase.Query("SELECT MAX(id) FROM instance"); + QueryResult* result = CharacterDatabase.Query("SELECT MAX(`id`) FROM `instance`"); if (result) { i_MaxInstanceId = result->Fetch()[0].GetUInt32(); diff --git a/src/game/Maps/ScriptCommands.cpp b/src/game/Maps/ScriptCommands.cpp index 164603a0b..d54ca2eae 100644 --- a/src/game/Maps/ScriptCommands.cpp +++ b/src/game/Maps/ScriptCommands.cpp @@ -24,6 +24,8 @@ #include "CreatureAIImpl.h" #include "NullCreatureAI.h" #include "GameEventMgr.h" +#include "ObjectMgr.h" +#include "Group.h" // Script commands should return false by default. // If they return true the rest of the script is aborted. @@ -1024,7 +1026,7 @@ bool Map::ScriptCommand_TerminateCondition(ScriptInfo const& script, WorldObject WorldObject* pSource = source; WorldObject* pTarget = target; - bool terminateResult = sObjectMgr.IsConditionSatisfied(script.terminateCond.conditionId, pTarget, this, pSource, CONDITION_FROM_DBSCRIPTS); + bool terminateResult = IsConditionSatisfied(script.terminateCond.conditionId, pTarget, this, pSource, CONDITION_FROM_DBSCRIPTS); if (script.terminateCond.flags & SF_TERMINATECONDITION_WHEN_FALSE) terminateResult = !terminateResult; @@ -1774,7 +1776,7 @@ bool Map::ScriptCommand_RemoveMapEventTarget(ScriptInfo const& script, WorldObje { if (WorldObject* pObject = GetWorldObject(itr->target)) { - if (sObjectMgr.IsConditionSatisfied(script.removeMapEventTarget.conditionId, source, this, pObject, CONDITION_FROM_DBSCRIPTS)) + if (IsConditionSatisfied(script.removeMapEventTarget.conditionId, source, this, pObject, CONDITION_FROM_DBSCRIPTS)) { itr = pEvent->m_vTargets.erase(itr); if (script.removeMapEventTarget.targets == SO_REMOVETARGET_ONE_FIT_CONDITION) diff --git a/src/game/Maps/ScriptCommands.h b/src/game/Maps/ScriptCommands.h new file mode 100644 index 000000000..4d0016dad --- /dev/null +++ b/src/game/Maps/ScriptCommands.h @@ -0,0 +1,1157 @@ +/* +* 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, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef __SCRIPT_COMMANDS_H +#define __SCRIPT_COMMANDS_H + +#include "Common.h" +#include "ObjectGuid.h" + +// Legend: +// source - the type of object which executes the command +// target - the type of object used as target of the command if needed +// provided source - the "WorldObject* source" provided to the command +// provided target - the "WorldObject* target" provided to the command + +// For example the talk command can be used by any WorldObject and the text will +// be said by this object. If there is also a target provided of type Unit, then +// any use of $n in the text will show the name of this unit. + +// Command functions are defined in Map.h and implemented in ScriptCommands.cpp! + +enum eScriptCommand +{ + SCRIPT_COMMAND_TALK = 0, // source = WorldObject + // target = Unit/None + // datalong = chat_type (see enum ChatType) + // dataint = broadcast_text id. dataint2-4 optional for random selected text. + SCRIPT_COMMAND_EMOTE = 1, // source = Unit + // datalong1-4 = emote_id + SCRIPT_COMMAND_FIELD_SET = 2, // source = Object + // datalong = field_id + // datalong2 = value + SCRIPT_COMMAND_MOVE_TO = 3, // source = Creature + // target = WorldObject (for datalong > 0) + // datalong = coordinates_type (see enum eMoveToCoordinateTypes) + // datalong2 = time + // datalong3 = movement_options (see enum MoveOptions) + // datalong4 = eMoveToFlags + // dataint = path_id + // x/y/z/o = coordinates + SCRIPT_COMMAND_MODIFY_FLAGS = 4, // source = Object + // datalong = field_id + // datalong2 = bitmask + // datalong3 = eModifyFlagsOptions + SCRIPT_COMMAND_INTERRUPT_CASTS = 5, // source = Unit + // datalong = (bool) with_delayed + // datalong2 = spell_id (optional) + SCRIPT_COMMAND_TELEPORT_TO = 6, // source = Unit + // datalong = map_id (only used for players but still required) + // datalong2 = teleport_options (see enum TeleportToOptions) + // x/y/z/o = coordinates + SCRIPT_COMMAND_QUEST_EXPLORED = 7, // source = Player (from provided source or target) + // target = WorldObject (from provided source or target) + // datalong = quest_id + // datalong2 = distance or 0 + // datalong3 = (bool) group + SCRIPT_COMMAND_KILL_CREDIT = 8, // source = Player (from provided source or target) + // datalong = creature entry + // datalong2 = bool (0=personal credit, 1=group credit) + SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9, // source = Map + // target = GameObject (from datalong, provided source or target) + // datalong = db_guid + // datalong2 = despawn_delay + SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10, // source = WorldObject (from provided source or buddy) + // datalong = creature_entry + // datalong2 = despawn_delay + // datalong3 = unique_limit + // datalong4 = unique_distance + // dataint = eSummonCreatureFlags + // dataint2 = script_id + // dataint3 = attack_target (see enum ScriptTarget) + // dataint4 = despawn_type (see enum TempSummonType) + // x/y/z/o = coordinates + SCRIPT_COMMAND_OPEN_DOOR = 11, // source = GameObject (from datalong, provided source or target) + // If provided target is BUTTON GameObject, command is run on it too. + // datalong = db_guid + // datalong2 = reset_delay + SCRIPT_COMMAND_CLOSE_DOOR = 12, // source = GameObject (from datalong, provided source or target) + // If provided target is BUTTON GameObject, command is run on it too. + // datalong = db_guid + // datalong2 = reset_delay + SCRIPT_COMMAND_ACTIVATE_OBJECT = 13, // source = GameObject + // target = Unit + SCRIPT_COMMAND_REMOVE_AURA = 14, // source = Unit + // datalong = spell_id + SCRIPT_COMMAND_CAST_SPELL = 15, // source = Unit + // target = Unit + // datalong = spell_id + // datalong2 = eCastSpellFlags + SCRIPT_COMMAND_PLAY_SOUND = 16, // source = WorldObject + // target = Player/None + // datalong = sound_id + // datalong2 = ePlaySoundFlags + SCRIPT_COMMAND_CREATE_ITEM = 17, // source = Player (from provided source or target) + // datalong = item_entry + // datalong2 = amount + SCRIPT_COMMAND_DESPAWN_CREATURE = 18, // source = Creature + // datalong = despawn_delay + SCRIPT_COMMAND_SET_EQUIPMENT = 19, // source = Creature + // datalong = (bool) reset_default + // dataint = main-hand item_id + // dataint2 = off-hand item_id + // dataint3 = ranged item_id + SCRIPT_COMMAND_MOVEMENT = 20, // source = Creature + // datalong = see enum MovementGeneratorType (not all are supported) + // datalong2 = bool_param (meaning depends on the motion type) + // datalong3 = int_param (meaning depends on the motion type) + // datalong4 = (bool) clear + // x = distance (only for some motion types) + // o = angle (only for some motion types) + SCRIPT_COMMAND_SET_ACTIVEOBJECT = 21, // source = Creature + // datalong = (bool) 0=off, 1=on + SCRIPT_COMMAND_SET_FACTION = 22, // source = Creature + // datalong = faction_Id, + // datalong2 = see enum TemporaryFactionFlags + SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL = 23, // source = Unit + // datalong = creature_id/display_id (depend on datalong2) + // datalong2 = (bool) is_display_id + SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL = 24, // source = Creature + // datalong = creature_id/display_id (depend on datalong2) + // datalong2 = (bool) is_display_id + // datalong3 = (bool) permanent + SCRIPT_COMMAND_SET_RUN = 25, // source = Creature + // datalong = (bool) 0 = off, 1 = on + SCRIPT_COMMAND_ATTACK_START = 26, // source = Creature + // target = Player + SCRIPT_COMMAND_UPDATE_ENTRY = 27, // source = Creature + // datalong = creature_entry + // datalong2 = team for display_id (0 = alliance, 1 = horde) + SCRIPT_COMMAND_STAND_STATE = 28, // source = Unit + // datalong = stand_state (enum UnitStandStateType) + SCRIPT_COMMAND_MODIFY_THREAT = 29, // source = Creature + // datalong = eModifyThreatTargets + // x = percent + SCRIPT_COMMAND_SEND_TAXI_PATH = 30, // source = Player + // datalong = taxi_path_id + SCRIPT_COMMAND_TERMINATE_SCRIPT = 31, // source = Any + // datalong = creature_entry + // datalong2 = search_distance + // datalong3 = eTerminateScriptOptions + SCRIPT_COMMAND_TERMINATE_CONDITION = 32, // source = Any + // datalong = condition_id + // datalong2 = failed_quest_id + // datalong3 = eTerminateConditionFlags + SCRIPT_COMMAND_ENTER_EVADE_MODE = 33, // source = Creature + SCRIPT_COMMAND_SET_HOME_POSITION = 34, // source = Creature + // datalong = eSetHomePositionOptions + // x/y/z/o = coordinates + SCRIPT_COMMAND_TURN_TO = 35, // source = Unit + // target = WorldObject + // datalong = eTurnToFacingOptions + SCRIPT_COMMAND_MEETINGSTONE = 36, // source = Player + // datalong = area_id + SCRIPT_COMMAND_SET_INST_DATA = 37, // source = Map + // datalong = field + // datalong2 = data + // datalong3 = eSetInstDataOptions + SCRIPT_COMMAND_SET_INST_DATA64 = 38, // source = Map + // target = Object (when saving guid) + // datalong = field + // datalong2 = data + // datalong3 = eSetInstData64Options + SCRIPT_COMMAND_START_SCRIPT = 39, // source = Map + // datalong1-4 = event_script id + // dataint1-4 = chance (total cant be above 100) + SCRIPT_COMMAND_REMOVE_ITEM = 40, // source = Player (from provided source or target) + // datalong = item_entry + // datalong2 = amount + SCRIPT_COMMAND_REMOVE_OBJECT = 41, // source = GameObject + // target = Unit + SCRIPT_COMMAND_SET_MELEE_ATTACK = 42, // source = Creature + // datalong = (bool) 0 = off, 1 = on + SCRIPT_COMMAND_SET_COMBAT_MOVEMENT = 43, // source = Creature + // datalong = (bool) 0 = off, 1 = on + SCRIPT_COMMAND_SET_PHASE = 44, // source = Creature + // datalong = phase + // datalong2 = eSetPhaseOptions + SCRIPT_COMMAND_SET_PHASE_RANDOM = 45, // source = Creature + // datalong1-4 = phase + SCRIPT_COMMAND_SET_PHASE_RANGE = 46, // source = Creature + // datalong = phase_min + // datalong2 = phase_max + SCRIPT_COMMAND_FLEE = 47, // source = Creature + // datalong = seek_assistance (bool) 0 = off, 1 = on + SCRIPT_COMMAND_DEAL_DAMAGE = 48, // source = Unit + // target = Unit + // datalong = damage + // datalong2 = (bool) is_percent + SCRIPT_COMMAND_ZONE_COMBAT_PULSE = 49, // source = Creature + // datalong = (bool) initialPulse + SCRIPT_COMMAND_CALL_FOR_HELP = 50, // source = Creature + // x = radius + SCRIPT_COMMAND_SET_SHEATH = 51, // source = Unit + // datalong = see enum SheathState + SCRIPT_COMMAND_INVINCIBILITY = 52, // source = Creature + // datalong = health + // datalong2 = (bool) is_percent + SCRIPT_COMMAND_GAME_EVENT = 53, // source = None + // datalong = event_id + // datalong2 = (bool) start + // datalong3 = (bool) overwrite + SCRIPT_COMMAND_SET_SERVER_VARIABLE = 54, // source = None + // datalong = index + // datalong2 = value + SCRIPT_COMMAND_CREATURE_SPELLS = 55, // source = Creature + // datalong1-4 = creature_spells id + // dataint1-4 = chance (total cant be above 100) + SCRIPT_COMMAND_REMOVE_GUARDIANS = 56, // source = Unit + // datalong = creature_id + SCRIPT_COMMAND_ADD_SPELL_COOLDOWN = 57, // source = Unit + // datalong = spell_id + // datalong2 = cooldown + SCRIPT_COMMAND_REMOVE_SPELL_COOLDOWN = 58, // source = Unit + // datalong = spell_id + SCRIPT_COMMAND_SET_REACT_STATE = 59, // source = Creature + // datalong = see enum ReactStates + SCRIPT_COMMAND_START_WAYPOINTS = 60, // source = Creature + // datalong = waypoints_source + // datalong2 = start_point + // datalong3 = initial_delay + // datalong4 = (bool) repeat + // dataint = overwrite_guid + // dataint2 = overwrite_entry + SCRIPT_COMMAND_START_MAP_EVENT = 61, // source = Map + // datalong = event_id + // datalong2 = time_limit + // dataint = success_condition + // dataint2 = success_script + // dataint3 = failure_condition + // dataint4 = failure_script + SCRIPT_COMMAND_END_MAP_EVENT = 62, // source = Map + // datalong = event_id + // datalong2 = (bool) success + SCRIPT_COMMAND_ADD_MAP_EVENT_TARGET = 63, // source = Map + // target = WorldObject + // datalong = event_id + // dataint = success_condition + // dataint2 = success_script + // dataint3 = failure_condition + // dataint4 = failure_script + SCRIPT_COMMAND_REMOVE_MAP_EVENT_TARGET = 64, // source = Map + // target = WorldObject + // datalong = event_id + // datalong2 = condition_id + // datalong3 = eRemoveMapEventTargetOptions + SCRIPT_COMMAND_SET_MAP_EVENT_DATA = 65, // source = Map + // datalong = event_id + // datalong2 = index + // datalong3 = data + // datalong4 = eSetMapScriptDataOptions + SCRIPT_COMMAND_SEND_MAP_EVENT = 66, // source = Map + // datalong = event_id + // datalong2 = data + // datalong3 = eSendMapEventOptions + SCRIPT_COMMAND_SET_DEFAULT_MOVEMENT = 67, // source = Creature + // datalong = movement_type + // datalong2 = (bool) always_replace + // datalong3 = param1 + SCRIPT_COMMAND_START_SCRIPT_FOR_ALL = 68, // source = WorldObject + // datalong = script_id + // datalong2 = eStartScriptForAllOptions + // datalong3 = object_entry + // datalong4 = search_radius + SCRIPT_COMMAND_EDIT_MAP_EVENT = 69, // source = Map + // datalong = event_id + // dataint = success_condition + // dataint2 = success_script + // dataint3 = failure_condition + // dataint4 = failure_script + SCRIPT_COMMAND_FAIL_QUEST = 70, // source = Player + // datalong = quest_id + SCRIPT_COMMAND_RESPAWN_CREATURE = 71, // source = Creature + // datalong = (bool) even_if_alive + SCRIPT_COMMAND_ASSIST_UNIT = 72, // source = Creature + // target = Unit + SCRIPT_COMMAND_COMBAT_STOP = 73, // source = Unit + SCRIPT_COMMAND_ADD_AURA = 74, // source = Unit + // datalong = spell_id + // datalong2 = flags + SCRIPT_COMMAND_ADD_THREAT = 75, // source = Creature + // target = Unit + SCRIPT_COMMAND_SUMMON_OBJECT = 76, // source = WorldObject + // datalong = gameobject_entry + // datalong2 = respawn_time + // x/y/z/o = coordinates + SCRIPT_COMMAND_SET_FLY = 77, // source = Unit + // datalong = (bool) 0 = off, 1 = on + SCRIPT_COMMAND_JOIN_CREATURE_GROUP = 78, // source = Creature + // target = Creature + // datalong = OptionFlags + // x = distance + // o = angle + SCRIPT_COMMAND_LEAVE_CREATURE_GROUP = 79, // source = Creature + SCRIPT_COMMAND_SET_GO_STATE = 80, // source = GameObject + // datalong = GOState + SCRIPT_COMMAND_DESPAWN_GAMEOBJECT = 81, // source = GameObject (from datalong, provided source or target) + // datalong = db_guid + // datalong2 = despawn_delay + SCRIPT_COMMAND_LOAD_GAMEOBJECT = 82, // source = Map + // datalong = db_guid + SCRIPT_COMMAND_QUEST_CREDIT = 83, // source = Player (from provided source or target) + // target = WorldObject (from provided source or target) + SCRIPT_COMMAND_SET_GOSSIP_MENU = 84, // source = Creature + // datalong = gossip_menu_id + SCRIPT_COMMAND_SEND_SCRIPT_EVENT = 85, // source = Creature + // target = WorldObject + // datalong = event_id + // datalong2 = event_data + SCRIPT_COMMAND_SET_PVP = 86, // source = Player + // datalong = (bool) 0 = off, 1 = on + SCRIPT_COMMAND_MAX, + + SCRIPT_COMMAND_DISABLED = 9999 // Script action was disabled during loading. +}; + +#define MAX_TEXT_ID 4 // used for SCRIPT_COMMAND_TALK +static constexpr uint32 MAX_EMOTE_ID = 4; // used for SCRIPT_COMMAND_EMOTE + +// Flags used by SCRIPT_COMMAND_MOVE_TO +enum eMoveToFlags +{ + SF_MOVETO_FORCED = 0x1, // No check if creature can move. + SF_MOVETO_POINT_MOVEGEN = 0x2, // Changes movement generator to point movement. +}; + +// Possible datalong3 values for SCRIPT_COMMAND_MOVE_TO +enum eMoveToCoordinateTypes +{ + SO_MOVETO_COORDINATES_NORMAL = 0, + SO_MOVETO_COORDINATES_RELATIVE_TO_TARGET = 1, // Coordinates are added to that of target. + SO_MOVETO_COORDINATES_DISTANCE_FROM_TARGET = 2, // X is distance from target, others not used. + SO_MOVETO_COORDINATES_RANDOM_POINT = 3, // O is max distance from coordinates + + MOVETO_COORDINATES_MAX +}; + +// Possible datalong3 values for SCRIPT_COMMAND_MODIFY_FLAGS +enum eModifyFlagsOptions +{ + SO_MODIFYFLAGS_TOGGLE = 0, + SO_MODIFYFLAGS_SET = 1, + SO_MODIFYFLAGS_REMOVE = 2 +}; + +// Flags used by SCRIPT_COMMAND_TEMP_SUMMON_CREATURE +// Must start from 0x8 because of target selection flags. +enum eSummonCreatureFlags +{ + SF_SUMMONCREATURE_SET_RUN = 0x01, // makes creature move at run speed + SF_SUMMONCREATURE_ACTIVE = 0x02, // active creatures are always updated + SF_SUMMONCREATURE_UNIQUE = 0x04, // not actually unique, just checks for same entry in certain range + SF_SUMMONCREATURE_UNIQUE_TEMP = 0x08, // same as 0x10 but check for TempSummon only creatures + SF_SUMMONCREATURE_NULL_AI = 0x10 // use Null AI instead of the normal creature script +}; + +// FLags used by SCRIPT_COMMAND_CAST_SPELL +enum CastFlags +{ + CF_INTERRUPT_PREVIOUS = 0x001, // Interrupt any spell casting + CF_TRIGGERED = 0x002, // Triggered (this makes spell cost zero mana and have no cast time) + CF_FORCE_CAST = 0x004, // Bypasses extra checks in Creature::TryToCast + CF_MAIN_RANGED_SPELL = 0x008, // To be used by ranged mobs only. Creature will not chase target until cast fails. + CF_TARGET_UNREACHABLE = 0x010, // Will only use the ability if creature cannot currently get to target + CF_AURA_NOT_PRESENT = 0x020, // Only casts the spell if the target does not have an aura from the spell + CF_ONLY_IN_MELEE = 0x040, // Only casts if the creature is in melee range of the target + CF_NOT_IN_MELEE = 0x080, // Only casts if the creature is not in melee range of the target + CF_TARGET_CASTING = 0x100, // Only casts if the target is currently casting a spell +}; + +#define ALL_CAST_FLAGS (CF_INTERRUPT_PREVIOUS | CF_TRIGGERED | CF_FORCE_CAST | CF_MAIN_RANGED_SPELL | CF_TARGET_UNREACHABLE | CF_AURA_NOT_PRESENT | CF_ONLY_IN_MELEE | CF_NOT_IN_MELEE | CF_TARGET_CASTING) + +// Flags used by SCRIPT_COMMAND_PLAY_SOUND +enum ePlaySoundFlags +{ + SF_PLAYSOUND_ONLY_TO_TARGET = 0x1, + SF_PLAYSOUND_DISTANCE_DEPENDENT = 0x2 +}; + +// Possible datalong values for SCRIPT_COMMAND_MODIFY_THREAT +enum eModifyThreatTargets +{ + // 0 to 5 from Target enum. + SO_MODIFYTHREAT_ALL_ATTACKERS = 6 +}; + +// Possible datalong3 values for SCRIPT_COMMAND_TERMINATE_SCRIPT +enum eTerminateScriptOptions +{ + SO_TERMINATESCRIPT_IF_NOT_FOUND = 0, + SO_TERMINATESCRIPT_IF_FOUND = 1 +}; + +// Flags used by SCRIPT_COMMAND_TERMINATE_CONDITION +enum eTerminateConditionFlags +{ + SF_TERMINATECONDITION_WHEN_FALSE = 0x1 +}; + +// Possible datalong values for SCRIPT_COMMAND_SET_HOME_POSITION +enum eSetHomePositionOptions +{ + SO_SETHOME_PROVIDED_POSITION = 0, + SO_SETHOME_CURRENT_POSITION = 1, + SO_SETHOME_DEFAULT_POSITION = 2 +}; + +// Possible datalong values for SCRIPT_COMMAND_TURN_TO +enum eTurnToFacingOptions +{ + SO_TURNTO_FACE_TARGET = 0, + SO_TURNTO_PROVIDED_ORIENTATION = 1 +}; + +// Possible datalong3 values for SCRIPT_COMMAND_SET_INST_DATA +enum eSetInstDataOptions +{ + SO_INSTDATA_RAW = 0, + SO_INSTDATA_INCREMENT = 1, + SO_INSTDATA_DECREMENT = 2, + + SO_INSTDATA_MAX +}; + +// Possible datalong3 values for SCRIPT_COMMAND_SET_INST_DATA64 +enum eSetInstData64Options +{ + SO_INSTDATA64_RAW = 0, + SO_INSTDATA64_SOURCE_GUID = 1, + + SO_INSTDATA64_MAX +}; + +// Possible datalong values for SCRIPT_COMMAND_SET_PHASE +enum eSetPhaseOptions +{ + SO_SETPHASE_RAW = 0, + SO_SETPHASE_INCREMENT = 1, + SO_SETPHASE_DECREMENT = 2, + + SO_SETPHASE_MAX +}; + +// Possible datalong3 values for SCRIPT_COMMAND_REMOVE_MAP_EVENT_TARGET +enum eRemoveMapEventTargetOptions +{ + SO_REMOVETARGET_SELF = 0, + SO_REMOVETARGET_ONE_FIT_CONDITION = 1, + SO_REMOVETARGET_ALL_FIT_CONDITION = 2, + SO_REMOVETARGET_ALL_TARGETS = 3, + + SO_REMOVETARGET_MAX +}; + +// Possible datalong4 values for SCRIPT_COMMAND_SET_MAP_EVENT_DATA +enum eSetMapScriptDataOptions +{ + SO_MAPEVENTDATA_RAW = 0, + SO_MAPEVENTDATA_INCREMENT = 1, + SO_MAPEVENTDATA_DECREMENT = 2, + + SO_MAPEVENTDATA_MAX +}; + +// Possible datalong3 values for SCRIPT_COMMAND_SEND_MAP_EVENT +enum eSendMapEventOptions +{ + SO_SENDMAPEVENT_MAIN_TARGETS_ONLY = 0, + SO_SENDMAPEVENT_EXTRA_TARGETS_ONLY = 1, + SO_SENDMAPEVENT_ALL_TARGETS = 2, + + SO_SENDMAPEVENT_MAX +}; + +// Possible datalong2 values for SCRIPT_COMMAND_START_SCRIPT_FOR_ALL +enum eStartScriptForAllOptions +{ + SO_STARTFORALL_GAMEOBJECTS = 0, + SO_STARTFORALL_UNITS = 1, + SO_STARTFORALL_CREATURES = 2, + SO_STARTFORALL_PLAYERS = 3, + + SO_STARTFORALL_MAX +}; + +enum eDataFlags +{ + SF_GENERAL_SWAP_INITIAL_TARGETS = 0x1, // Swaps the provided source and target, before buddy is checked. + SF_GENERAL_SWAP_FINAL_TARGETS = 0x2, // Swaps the local source and target, after buddy is assigned. + SF_GENERAL_TARGET_SELF = 0x4, // Replaces the provided target with the provided source. + SF_GENERAL_ABORT_ON_FAILURE = 0x8 // Terminates the script if the command fails. +}; + +struct ScriptInfo +{ + uint32 id; + uint32 delay; + uint32 command; + uint32 condition; + + union + { + struct // SCRIPT_COMMAND_TALK (0) + { + uint32 chatType; // datalong + uint32 unused1; // datalong2 + uint32 unused2; // datalong3 + uint32 unused3; // datalong4 + uint32 unused4; // data_flags + int32 textId[MAX_TEXT_ID]; // dataint to dataint4 + } talk; + + struct // SCRIPT_COMMAND_EMOTE (1) + { + uint32 emoteId[MAX_EMOTE_ID]; // datalong to datalong4 + } emote; + + struct // SCRIPT_COMMAND_FIELD_SET (2) + { + uint32 fieldId; // datalong + uint32 fieldValue; // datalong2 + } setField; + + struct // SCRIPT_COMMAND_MOVE_TO (3) + { + uint32 coordinatesType; // datalong + uint32 travelTime; // datalong2 + uint32 movementOptions; // datalong3 + uint32 flags; // datalong4 + uint32 unused; // data_flags + int32 pointId; // dataint + } moveTo; + + struct // SCRIPT_COMMAND_MODIFY_FLAGS (4) + { + uint32 fieldId; // datalong + uint32 fieldValue; // datalong2 + uint32 mode; // datalong3 + } modFlags; + + struct // SCRIPT_COMMAND_INTERRUPT_CASTS (5) + { + uint32 withDelayed; // datalong + uint32 spellId; // datalong2 + } interruptCasts; + + struct // SCRIPT_COMMAND_TELEPORT_TO (6) + { + uint32 mapId; // datalong + uint32 teleportOptions; // datalong2 + } teleportTo; + + struct // SCRIPT_COMMAND_QUEST_EXPLORED (7) + { + uint32 questId; // datalong + uint32 distance; // datalong2 + uint32 group; // datalong3 + } questExplored; + + struct // SCRIPT_COMMAND_KILL_CREDIT (8) + { + uint32 creatureEntry; // datalong + uint32 isGroupCredit; // datalong2 + } killCredit; + + struct // SCRIPT_COMMAND_RESPAWN_GAMEOBJECT (9) + { + uint32 goGuid; // datalong + int32 despawnDelay; // datalong2 + } respawnGo; + + struct // SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (10) + { + uint32 creatureEntry; // datalong + uint32 despawnDelay; // datalong2 + uint32 uniqueLimit; // datalong3 + uint32 uniqueDistance; // datalong4 + uint32 unused; // data_flags + int32 flags; // dataint + int32 scriptId; // dataint2 + int32 attackTarget; // dataint3 + int32 despawnType; // dataint4 + } summonCreature; + + struct // SCRIPT_COMMAND_OPEN_DOOR (11) + { + uint32 goGuid; // datalong + int32 resetDelay; // datalong2 + } openDoor; + + struct // SCRIPT_COMMAND_CLOSE_DOOR (12) + { + uint32 goGuid; // datalong + int32 resetDelay; // datalong2 + } closeDoor; + + // SCRIPT_COMMAND_ACTIVATE_OBJECT (13) + + struct // SCRIPT_COMMAND_REMOVE_AURA (14) + { + uint32 spellId; // datalong + } removeAura; + + struct // SCRIPT_COMMAND_CAST_SPELL (15) + { + uint32 spellId; // datalong + uint32 flags; // datalong2 + } castSpell; + + struct // SCRIPT_COMMAND_PLAY_SOUND (16) + { + uint32 soundId; // datalong + uint32 flags; // datalong2 + } playSound; + + struct // SCRIPT_COMMAND_CREATE_ITEM (17) + { + uint32 itemEntry; // datalong + uint32 amount; // datalong2 + } createItem; + + struct // SCRIPT_COMMAND_DESPAWN_CREATURE (18) + { + uint32 despawnDelay; // datalong + } despawn; + + struct // SCRIPT_COMMAND_SET_EQUIPMENT (19) + { + uint32 resetDefault; // datalong + uint32 unused1; // datalong2 + uint32 unused2; // datalong3 + uint32 unused3; // datalong4 + uint32 unused4; // data_flags + int32 slot[MAX_TEXT_ID]; // dataint to dataint4 + } setEquipment; + + struct // SCRIPT_COMMAND_MOVEMENT (20) + { + uint32 movementType; // datalong + uint32 boolParam; // datalong2 + uint32 intParam; // datalong3 + uint32 clear; // datalong4 + } movement; + + struct // SCRIPT_COMMAND_SET_ACTIVEOBJECT (21) + { + uint32 activate; // datalong + } activeObject; + + struct // SCRIPT_COMMAND_SET_FACTION (22) + { + uint32 factionId; // datalong + uint32 flags; // datalong2 + } faction; + + struct // SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL (23) + { + uint32 creatureOrModelEntry; // datalong + uint32 isDisplayId; // datalong2 + } morph; + + struct // SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL (24) + { + uint32 creatureOrModelEntry; // datalong + uint32 isDisplayId; // datalong2 + uint32 permanent; // datalong3 + } mount; + + struct // SCRIPT_COMMAND_SET_RUN (25) + { + uint32 run; // datalong + } run; + + // SCRIPT_COMMAND_ATTACK_START (26) + + struct // SCRIPT_COMMAND_UPDATE_ENTRY (27) + { + uint32 creatureEntry; // datalong + uint32 team; // datalong2 + } updateEntry; + + struct // SCRIPT_COMMAND_STAND_STATE (28) + { + uint32 standState; // datalong + } standState; + + struct // SCRIPT_COMMAND_MODIFY_THREAT (29) + { + uint32 target; // datalong + } modThreat; + + struct // SCRIPT_COMMAND_SEND_TAXI_PATH (30) + { + uint32 taxiPathId; // datalong + } sendTaxiPath; + + struct // SCRIPT_COMMAND_TERMINATE_SCRIPT (31) + { + uint32 creatureEntry; // datalong + uint32 searchRadius; // datalong2 + uint32 flags; // datalong3 + } terminateScript; + + struct // SCRIPT_COMMAND_TERMINATE_CONDITION (32) + { + uint32 conditionId; // datalong + uint32 failQuest; // datalong2 + uint32 flags; // datalong3 + } terminateCond; + + // SCRIPT_COMMAND_ENTER_EVADE_MODE (33) + + struct // SCRIPT_COMMAND_SET_HOME_POSITION (34) + { + uint32 mode; // datalong + } setHome; + + struct // SCRIPT_COMMAND_TURN_TO (35) + { + uint32 facingLogic; // datalong + } turnTo; + + struct // SCRIPT_COMMAND_MEETINGSTONE (36) + { + uint32 areaId; // datalong + } meetingstone; + + struct // SCRIPT_COMMAND_SET_INST_DATA (37) + { + uint32 field; // datalong + uint32 data; // datalong2 + uint32 type; // datalong3 + } setData; + + struct // SCRIPT_COMMAND_SET_INST_DATA64 (38) + { + uint32 field; // datalong + uint32 data; // datalong2 + uint32 type; // datalong3 + } setData64; + + struct // SCRIPT_COMMAND_START_SCRIPT (39) + { + uint32 scriptId[4]; // datalong to datalong4 + uint32 unused; // data_flags + int32 chance[4]; // dataint to dataint4 + } startScript; + + struct // SCRIPT_COMMAND_REMOVE_ITEM (40) + { + uint32 itemEntry; // datalong + uint32 amount; // datalong2 + } removeItem; + + // SCRIPT_COMMAND_REMOVE_OBJECT (41) + + struct // SCRIPT_COMMAND_SET_MELEE_ATTACK (42) + { + uint32 enabled; // datalong + } enableMelee; + + struct // SCRIPT_COMMAND_SET_COMBAT_MOVEMENT (43) + { + uint32 enabled; // datalong + } combatMovement; + + struct // SCRIPT_COMMAND_SET_PHASE (44) + { + uint32 phase; // datalong + uint32 mode; // datalong2 + } setPhase; + + struct // SCRIPT_COMMAND_SET_PHASE_RANDOM (45) + { + uint32 phase[MAX_TEXT_ID]; // datalong + } setPhaseRandom; + + struct // SCRIPT_COMMAND_SET_PHASE_RANGE (46) + { + uint32 phaseMin; // datalong + uint32 phaseMax; // datalong2 + } setPhaseRange; + + struct // SCRIPT_COMMAND_FLEE (47) + { + uint32 seekAssistance; // datalong + } flee; + + struct // SCRIPT_COMMAND_DEAL_DAMAGE (48) + { + uint32 damage; // datalong + uint32 isPercent; // datalong2 + } dealDamage; + + struct // SCRIPT_COMMAND_ZONE_COMBAT_PULSE (49) + { + uint32 initialPulse; // datalong + } combatPulse; + + // SCRIPT_COMMAND_CALL_FOR_HELP (50) + + struct // SCRIPT_COMMAND_SET_SHEATH (51) + { + uint32 sheathState; // datalong + } setSheath; + + struct // SCRIPT_COMMAND_INVINCIBILITY (52) + { + uint32 health; // datalong + uint32 isPercent; // datalong2 + } invincibility; + + struct // SCRIPT_COMMAND_GAME_EVENT (53) + { + uint32 eventId; // datalong + uint32 start; // datalong2 + uint32 overwrite; // datalong3 + } gameEvent; + + struct // SCRIPT_COMMAND_SET_SERVER_VARIABLE (54) + { + uint32 index; // datalong + uint32 value; // datalong2 + } serverVariable; + + struct // SCRIPT_COMMAND_CREATURE_SPELLS (55) + { + uint32 spellListId[4]; // datalong to datalong4 + uint32 unused; // data_flags + int32 chance[4]; // dataint to dataint4 + } creatureSpells; + + struct // SCRIPT_COMMAND_REMOVE_GUARDIANS (56) + { + uint32 creatureId; // datalong + } removeGuardian; + + struct // SCRIPT_COMMAND_ADD_SPELL_COOLDOWN (57) + { + uint32 spellId; // datalong + uint32 cooldown; // datalong2 + } addCooldown; + + struct // SCRIPT_COMMAND_REMOVE_SPELL_COOLDOWN (58) + { + uint32 spellId; // datalong + } removeCooldown; + + struct // SCRIPT_COMMAND_SET_REACT_STATE (59) + { + uint32 state; // datalong + } setReactState; + + struct // SCRIPT_COMMAND_START_WAYPOINTS (60) + { + uint32 wpSource; // datalong + uint32 startPoint; // datalong2 + uint32 initialDelay; // datalong3 + uint32 canRepeat; // datalong4 + uint32 unused; // data_flags + int32 overwriteGuid; // dataint + int32 overwriteEntry; // dataint2 + } startWaypoints; + + struct // SCRIPT_COMMAND_START_MAP_EVENT (61) + { + uint32 eventId; // datalong + uint32 timeLimit; // datalong2 + uint32 unused1; // datalong3 + uint32 unuded2; // datalong4 + uint32 unused3; // data_flags + int32 successCondition; // dataint + int32 successScript; // dataint2 + int32 failureCondition; // dataint3 + int32 failureScript; // dataint4 + } startMapEvent; + + struct // SCRIPT_COMMAND_END_MAP_EVENT (62) + { + uint32 eventId; // datalong + uint32 success; // datalong2 + } endMapEvent; + + struct // SCRIPT_COMMAND_ADD_MAP_EVENT_TARGET (63) + { + uint32 eventId; // datalong + uint32 unused1; // datalong2 + uint32 unused2; // datalong3 + uint32 unused3; // datalong4 + uint32 unused4; // data_flags + int32 successCondition; // dataint + int32 successScript; // dataint2 + int32 failureCondition; // dataint3 + int32 failureScript; // dataint4 + } addMapEventTarget; + + struct // SCRIPT_COMMAND_REMOVE_MAP_EVENT_TARGET (64) + { + uint32 eventId; // datalong + uint32 conditionId; // datalong2 + uint32 targets; // datalong3 + } removeMapEventTarget; + + struct // SCRIPT_COMMAND_SET_MAP_EVENT_DATA (65) + { + uint32 eventId; // datalong + uint32 index; // datalong2 + uint32 data; // datalong3 + uint32 type; // datalong4 + } setMapEventData; + + struct // SCRIPT_COMMAND_SEND_MAP_EVENT (66) + { + uint32 eventId; // datalong + uint32 data; // datalong2 + uint32 targets; // datalong3 + } sendMapEvent; + + struct // SCRIPT_COMMAND_SET_DEFAULT_MOVEMENT (67) + { + uint32 movementType; // datalong + uint32 alwaysReplace; // datalong2 + uint32 param1; // datalong3 + } setDefaultMovement; + + struct // SCRIPT_COMMAND_START_SCRIPT_FOR_ALL (68) + { + uint32 scriptId; // datalong + uint32 objectType; // datalong2 + uint32 objectEntry; // datalong3 + uint32 searchRadius; // datalong4 + } startScriptForAll; + + struct // SCRIPT_COMMAND_EDIT_MAP_EVENT (69) + { + uint32 eventId; // datalong + uint32 unused1; // datalong2 + uint32 unused2; // datalong3 + uint32 unused3; // datalong4 + uint32 unused4; // data_flags + int32 successCondition; // dataint + int32 successScript; // dataint2 + int32 failureCondition; // dataint3 + int32 failureScript; // dataint4 + } editMapEvent; + + struct // SCRIPT_COMMAND_FAIL_QUEST (70) + { + uint32 questId; // datalong + } failQuest; + + struct // SCRIPT_COMMAND_RESPAWN_CREATURE (71) + { + uint32 evenAlive; // datalong + } respawnCreature; + + // SCRIPT_COMMAND_ASSIST_UNIT (72) + + // SCRIPT_COMMAND_COMBAT_STOP (73) + + struct // SCRIPT_COMMAND_ADD_AURA (74) + { + uint32 spellId; // datalong + uint32 flags; // datalong2 + } addAura; + + // SCRIPT_COMMAND_ADD_THREAT (75) + + struct // SCRIPT_COMMAND_SUMMON_OBJECT (76) + { + uint32 gameobject_entry; // datalong + uint32 respawn_time; // datalong2 + } summonObject; + + struct // SCRIPT_COMMAND_SET_FLY (77) + { + uint32 enabled; // datalong + } setFly; + + struct // SCRIPT_COMMAND_JOIN_CREATURE_GROUP (78) + { + uint32 options; // datalong + } joinCreatureGroup; + + // SCRIPT_COMMAND_LEAVE_CREATURE_GROUP (79) + + struct // SCRIPT_COMMAND_SET_GO_STATE (80) + { + uint32 state; // datalong + } setGoState; + + struct // SCRIPT_COMMAND_DESPAWN_GAMEOBJECT (81) + { + uint32 goGuid; // datalong + uint32 respawnDelay; // datalong2 + } despawnGo; + + struct // SCRIPT_COMMAND_LOAD_GAMEOBJECT (82) + { + uint32 goGuid; // datalong + } loadGo; + + // SCRIPT_COMMAND_QUEST_CREDIT (83) + + struct // SCRIPT_COMMAND_SET_GOSSIP_MENU (84) + { + uint32 gossipMenuId; // datalong + } setGossipMenu; + + struct // SCRIPT_COMMAND_SEND_SCRIPT_EVENT (85) + { + uint32 eventId; // datalong + uint32 eventData; // datalong2 + } sendScriptEvent; + + struct // SCRIPT_COMMAND_SET_PVP (86) + { + uint32 enabled; // datalong + } setPvP; + + struct + { + uint32 data[9]; + } raw; + }; + + uint32 target_param1; + uint32 target_param2; + uint8 target_type; + + float x; + float y; + float z; + float o; + + ScriptInfo() : id(0), delay(0), command(0), condition(0), target_param1(0), target_param2(0), target_type(0), x(0), y(0), z(0), o(0) + { + memset(raw.data, 0, sizeof(raw.data)); + } + + // helpers + uint32 GetGOGuid() const + { + switch(command) + { + case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT: return respawnGo.goGuid; + case SCRIPT_COMMAND_DESPAWN_GAMEOBJECT: return despawnGo.goGuid; + case SCRIPT_COMMAND_LOAD_GAMEOBJECT: return loadGo.goGuid; + case SCRIPT_COMMAND_OPEN_DOOR: return openDoor.goGuid; + case SCRIPT_COMMAND_CLOSE_DOOR: return closeDoor.goGuid; + default: return 0; + } + } +}; + +struct ScriptAction +{ + ObjectGuid sourceGuid; + ObjectGuid targetGuid; + ScriptInfo const* script; // pointer to static script data + + bool IsSameScript(uint32 id, ObjectGuid sourceGuid, ObjectGuid targetGuid) const + { + return id == script->id && + (sourceGuid == this->sourceGuid || !sourceGuid) && + (targetGuid == this->targetGuid || !targetGuid); + } +}; + +// Values used in target_type column +enum ScriptTarget +{ + TARGET_T_PROVIDED_TARGET = 0, //Object that was provided to the command. + + TARGET_T_HOSTILE = 1, //Our current target (ie: highest aggro). + TARGET_T_HOSTILE_SECOND_AGGRO = 2, //Second highest aggro (generaly used for cleaves and some special attacks). + //Param1 = select_flags + TARGET_T_HOSTILE_LAST_AGGRO = 3, //Dead last on aggro (no idea what this could be used for). + //Param1 = select_flags + TARGET_T_HOSTILE_RANDOM = 4, //Just any random target on our threat list. + //Param1 = select_flags + TARGET_T_HOSTILE_RANDOM_NOT_TOP = 5, //Any random target except top threat. + //Param1 = select_flags + + TARGET_T_OWNER_OR_SELF = 6, //Either self or owner if pet or controlled. + TARGET_T_OWNER = 7, //The owner of the source. + + + TARGET_T_NEAREST_CREATURE_WITH_ENTRY = 8, //Searches for closest nearby creature with the given entry. + //Param1 = creature_entry + //Param2 = search_radius + + TARGET_T_CREATURE_WITH_GUID = 9, //The creature with this database guid. + //Param1 = db_guid + + TARGET_T_CREATURE_FROM_INSTANCE_DATA = 10, //Find creature by guid stored in instance data. + //Param1 = instance_data_field + + TARGET_T_NEAREST_GAMEOBJECT_WITH_ENTRY = 11, //Searches for closest nearby gameobject with the given entry. + //Param1 = gameobject_entry + //Param2 = search_radius + + TARGET_T_GAMEOBJECT_WITH_GUID = 12, //The gameobject with this database guid. + //Param1 = db_guid + + TARGET_T_GAMEOBJECT_FROM_INSTANCE_DATA = 13, //Find gameobject by guid stored in instance data. + //Param1 = instance_data_field + + TARGET_T_FRIENDLY = 14, //Random friendly unit. + //Param1 = search_radius + //Param2 = (bool) exclude_target + TARGET_T_FRIENDLY_INJURED = 15, //Friendly unit missing the most health. + //Param1 = search_radius + //Param2 = hp_percent + TARGET_T_FRIENDLY_INJURED_EXCEPT = 16, //Friendly unit missing the most health but not provided target. + //Param1 = search_radius + //Param2 = hp_percent + TARGET_T_FRIENDLY_MISSING_BUFF = 17, //Friendly unit without aura. + //Param1 = search_radius + //Param2 = spell_id + TARGET_T_FRIENDLY_MISSING_BUFF_EXCEPT = 18, //Friendly unit without aura but not provided target. + //Param1 = search_radius + //Param2 = spell_id + TARGET_T_FRIENDLY_CC = 19, //Friendly unit under crowd control. + //Param1 = search_radius + TARGET_T_MAP_EVENT_SOURCE = 20, //The source WorldObject of a scripted map event. + //Param1 = eventId + TARGET_T_MAP_EVENT_TARGET = 21, //The target WorldObject of a scripted map event. + //Param1 = eventId + TARGET_T_MAP_EVENT_EXTRA_TARGET = 22, //An additional WorldObject target from a scripted map event. + //Param1 = eventId + //Param2 = creature_entry or gameobject_entry + TARGET_T_NEAREST_PLAYER = 23, //Nearest player within range. + //Param1 = search-radius + TARGET_T_NEAREST_HOSTILE_PLAYER = 24, //Nearest hostile player within range. + //Param1 = search-radius + TARGET_T_NEAREST_FRIENDLY_PLAYER = 25, //Nearest friendly player within range. + //Param1 = search-radius + TARGET_T_RANDOM_CREATURE_WITH_ENTRY = 26, //Searches for random nearby creature with the given entry. Not Self. + //Param1 = creature_entry + //Param2 = search_radius + TARGET_T_END +}; + +#endif \ No newline at end of file diff --git a/src/game/Maps/ZoneScript.cpp b/src/game/Maps/ZoneScript.cpp index 25dc44f93..3393f952b 100644 --- a/src/game/Maps/ZoneScript.cpp +++ b/src/game/Maps/ZoneScript.cpp @@ -17,7 +17,6 @@ #include "ZoneScript.h" #include "ZoneScriptMgr.h" -#include "ObjectAccessor.h" #include "ObjectMgr.h" #include "Map.h" #include "MapManager.h" diff --git a/src/game/Maps/ZoneScriptMgr.cpp b/src/game/Maps/ZoneScriptMgr.cpp index 31e4f9d04..9f1ddcd86 100644 --- a/src/game/Maps/ZoneScriptMgr.cpp +++ b/src/game/Maps/ZoneScriptMgr.cpp @@ -16,9 +16,6 @@ */ #include "ZoneScriptMgr.h" -#include "ObjectMgr.h" -#include "Player.h" -#include "ScriptMgr.h" #include "Policies/SingletonImp.h" INSTANTIATE_SINGLETON_1(ZoneScriptMgr); @@ -87,7 +84,7 @@ void ZoneScriptMgr::HandlePlayerEnterZone(Player* plr, uint32 zoneid) return; itr->second->OnPlayerEnter(plr); - DEBUG_LOG("Player %u entered ZoneScript", plr->GetGUIDLow()); + //DEBUG_LOG("Player %u entered ZoneScript", plr->GetGUIDLow()); } void ZoneScriptMgr::HandlePlayerLeaveZone(Player* plr, uint32 zoneid) @@ -101,7 +98,7 @@ void ZoneScriptMgr::HandlePlayerLeaveZone(Player* plr, uint32 zoneid) return; itr->second->OnPlayerLeave(plr); - DEBUG_LOG("Player %u left ZoneScript", plr->GetGUIDLow()); + //DEBUG_LOG("Player %u left ZoneScript", plr->GetGUIDLow()); } ZoneScript * ZoneScriptMgr::GetZoneScriptToZoneId(uint32 zoneid) diff --git a/src/game/Movement/FearMovementGenerator.cpp b/src/game/Movement/FearMovementGenerator.cpp index 196f657d3..2acd0bdf0 100644 --- a/src/game/Movement/FearMovementGenerator.cpp +++ b/src/game/Movement/FearMovementGenerator.cpp @@ -4,7 +4,6 @@ #include "Creature.h" #include "CreatureAI.h" -#include "MapManager.h" #include "FearMovementGenerator.h" #include "ObjectAccessor.h" #include "MoveSplineInit.h" diff --git a/src/game/Movement/FleeingMovementGenerator.cpp b/src/game/Movement/FleeingMovementGenerator.cpp index 003bf168a..d7d770f43 100644 --- a/src/game/Movement/FleeingMovementGenerator.cpp +++ b/src/game/Movement/FleeingMovementGenerator.cpp @@ -18,7 +18,6 @@ #include "Creature.h" #include "CreatureAI.h" -#include "MapManager.h" #include "FleeingMovementGenerator.h" #include "ObjectAccessor.h" #include "MoveSplineInit.h" diff --git a/src/game/Movement/HomeMovementGenerator.cpp b/src/game/Movement/HomeMovementGenerator.cpp index af9d978ea..600c44fd0 100644 --- a/src/game/Movement/HomeMovementGenerator.cpp +++ b/src/game/Movement/HomeMovementGenerator.cpp @@ -19,8 +19,6 @@ #include "HomeMovementGenerator.h" #include "Creature.h" #include "CreatureAI.h" -#include "ObjectMgr.h" -#include "WorldPacket.h" #include "MoveSplineInit.h" #include "MoveSpline.h" diff --git a/src/game/Movement/MovementPacketSender.cpp b/src/game/Movement/MovementPacketSender.cpp index 815214749..b85d79b81 100644 --- a/src/game/Movement/MovementPacketSender.cpp +++ b/src/game/Movement/MovementPacketSender.cpp @@ -17,6 +17,7 @@ #include "MovementPacketSender.h" #include "Player.h" +#include "Opcodes.h" #include "WorldPacket.h" #include "WorldSession.h" #include "Anticheat.h" diff --git a/src/game/Movement/PointMovementGenerator.cpp b/src/game/Movement/PointMovementGenerator.cpp index bc398bb71..dfdd9ba48 100644 --- a/src/game/Movement/PointMovementGenerator.cpp +++ b/src/game/Movement/PointMovementGenerator.cpp @@ -289,8 +289,9 @@ void ChargeMovementGenerator::ComputePath(T& attacker, Unit& victim) // Improved path to victim future estimated position if (Player* victimPlayer = victim.ToPlayer()) { - if ((victimPlayer->ExtrapolateMovement(victimPlayer->m_movementInfo, 1000, victimSpd.x, victimSpd.y, victimSpd.z, o)) && - (victimPlayer->ExtrapolateMovement(victimPlayer->m_movementInfo, 0, victimPos.x, victimPos.y, victimPos.z, o))) + if (sWorld.getConfig(CONFIG_BOOL_ENABLE_MOVEMENT_EXTRAPOLATION_CHARGE) && + victimPlayer->ExtrapolateMovement(victimPlayer->m_movementInfo, 1000, victimSpd.x, victimSpd.y, victimSpd.z, o) && + victimPlayer->ExtrapolateMovement(victimPlayer->m_movementInfo, 0, victimPos.x, victimPos.y, victimPos.z, o)) { // Victim speed per sec. victimSpd -= victimPos; diff --git a/src/game/Movement/RandomMovementGenerator.cpp b/src/game/Movement/RandomMovementGenerator.cpp index e09cf2760..b65748f7c 100644 --- a/src/game/Movement/RandomMovementGenerator.cpp +++ b/src/game/Movement/RandomMovementGenerator.cpp @@ -17,9 +17,7 @@ */ #include "Creature.h" -#include "MapManager.h" #include "RandomMovementGenerator.h" -#include "Map.h" #include "Util.h" #include "MoveSplineInit.h" #include "MoveSpline.h" diff --git a/src/game/Movement/WaypointMovementGenerator.cpp b/src/game/Movement/WaypointMovementGenerator.cpp index 70a89223c..5a7634849 100644 --- a/src/game/Movement/WaypointMovementGenerator.cpp +++ b/src/game/Movement/WaypointMovementGenerator.cpp @@ -19,7 +19,6 @@ #include #include "WaypointMovementGenerator.h" -#include "ObjectMgr.h" #include "Creature.h" #include "CreatureAI.h" #include "WaypointManager.h" diff --git a/src/game/Movement/spline/MoveSplineInit.cpp b/src/game/Movement/spline/MoveSplineInit.cpp index 91f87de2e..5694b64c3 100644 --- a/src/game/Movement/spline/MoveSplineInit.cpp +++ b/src/game/Movement/spline/MoveSplineInit.cpp @@ -19,11 +19,12 @@ #include "MoveSplineInit.h" #include "MoveSpline.h" #include "packet_builder.h" +#include "Opcodes.h" +#include "WorldPacket.h" #include "Unit.h" #include "Transport.h" #include "ObjectAccessor.h" #include "Anticheat.h" -#include "WorldPacket.h" namespace Movement { diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 60d9a0c45..eb1370fe3 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -23,8 +23,6 @@ #include "ObjectMgr.h" #include "Policies/SingletonImp.h" #include "Player.h" -#include "WorldPacket.h" -#include "Item.h" #include "Corpse.h" #include "GridNotifiers.h" #include "MapManager.h" @@ -32,7 +30,6 @@ #include "CellImpl.h" #include "GridNotifiersImpl.h" #include "ObjectGuid.h" -#include "World.h" #include diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index 6bbc088db..861b4489d 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -26,9 +26,6 @@ #include "Platform/Define.h" #include "Policies/Singleton.h" #include "Policies/ThreadingModel.h" - -#include "UpdateData.h" - #include "GridDefines.h" #include "Object.h" #include "Player.h" diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 8547c1581..e740e2795 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -24,7 +24,6 @@ #include "Database/DatabaseImpl.h" #include "Database/SQLStorageImpl.h" #include "Policies/SingletonImp.h" - #include "SQLStorages.h" #include "Log.h" #include "MapManager.h" @@ -34,6 +33,7 @@ #include "UpdateMask.h" #include "World.h" #include "Group.h" +#include "Bag.h" #include "Transport.h" #include "ProgressBar.h" #include "Language.h" @@ -52,6 +52,7 @@ #include "InstanceData.h" #include "CharacterDatabaseCache.h" #include "HardcodedEvents.h" +#include "Conditions.h" #include @@ -10787,16 +10788,6 @@ void ObjectMgr::LoadConditions() sLog.outString(); } - -// Check if a player meets condition conditionId -bool ObjectMgr::IsConditionSatisfied(uint32 conditionId, WorldObject const* target, Map const* map, WorldObject const* source, ConditionSource conditionSourceType) const -{ - if (ConditionEntry const* condition = sConditionStorage.LookupEntry(conditionId)) - return condition->Meets(target, map, source, conditionSourceType); - - return false; -} - uint32 ObjectMgr::GenerateAuctionID() { std::set::const_iterator it = m_AuctionsIds.lower_bound(m_NextAuctionId); diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 56b9c8c24..b8c1b0317 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -21,24 +21,19 @@ #define _OBJECTMGR_H #include "Common.h" -#include "Log.h" #include "Object.h" -#include "Bag.h" -#include "Creature.h" -#include "Player.h" +#include "CreatureDefines.h" #include "GameObject.h" #include "Corpse.h" #include "QuestDef.h" #include "ItemPrototype.h" #include "NPCHandler.h" #include "Database/DatabaseEnv.h" -#include "Map.h" #include "MapPersistentStateMgr.h" #include "ObjectAccessor.h" #include "ObjectGuid.h" #include "Policies/Singleton.h" #include "SQLStorages.h" -#include "Conditions.h" #include #include @@ -130,29 +125,6 @@ struct SoundEntriesEntry std::string Name; }; -// Number of spells in one template -#define CREATURE_SPELLS_MAX_SPELLS 8 -// Columns in the db for each spell -#define CREATURE_SPELLS_MAX_COLUMNS 11 - -struct CreatureSpellsEntry -{ - uint16 const spellId; - uint8 const probability; - uint8 const castTarget; - uint32 const targetParam1; - uint32 const targetParam2; - uint16 const castFlags; - uint32 const delayInitialMin; - uint32 const delayInitialMax; - uint32 const delayRepeatMin; - uint32 const delayRepeatMax; - uint32 const scriptId; - CreatureSpellsEntry(uint16 Id, uint8 Probability, uint8 CastTarget, uint32 TargetParam1, uint32 TargetParam2, uint16 CastFlags, uint32 InitialMin, uint32 InitialMax, uint32 RepeatMin, uint32 RepeatMax, uint32 ScriptId) : spellId(Id), probability(Probability), castTarget(CastTarget), targetParam1(TargetParam1), targetParam2(TargetParam2), castFlags(CastFlags), delayInitialMin(InitialMin), delayInitialMax(InitialMax), delayRepeatMin(RepeatMin), delayRepeatMax(RepeatMax), scriptId(ScriptId) {} -}; - -typedef std::vector CreatureSpellsList; - typedef std::unordered_map CreatureSpellsMap; typedef std::map CellCorpseSet; @@ -1146,8 +1118,6 @@ class ObjectMgr int GetIndexForLocale(LocaleConstant loc); LocaleConstant GetLocaleForIndex(int i); - bool IsConditionSatisfied(uint32 conditionId, WorldObject const* target, Map const* map, WorldObject const* source, ConditionSource conditionSourceType) const; - GameTele const* GetGameTele(uint32 id) const { auto itr = m_GameTeleMap.find(id); diff --git a/src/game/ObjectPosSelector.cpp b/src/game/ObjectPosSelector.cpp index 62ff53b45..3076bc8bf 100644 --- a/src/game/ObjectPosSelector.cpp +++ b/src/game/ObjectPosSelector.cpp @@ -20,7 +20,7 @@ */ #include "ObjectPosSelector.h" -#include "Object.h" +#include "ObjectDefines.h" ObjectPosSelector::ObjectPosSelector(float x, float y, float size, float dist) : m_center_x(x), m_center_y(y), m_size(size), m_dist(dist) diff --git a/src/game/Objects/Bag.cpp b/src/game/Objects/Bag.cpp index 0de86e306..bf187dc8f 100644 --- a/src/game/Objects/Bag.cpp +++ b/src/game/Objects/Bag.cpp @@ -21,8 +21,6 @@ #include "Bag.h" #include "ObjectMgr.h" -#include "Database/DatabaseEnv.h" -#include "Log.h" #include "UpdateData.h" Bag::Bag(): Item() diff --git a/src/game/Objects/Corpse.cpp b/src/game/Objects/Corpse.cpp index 60f34301e..266091966 100644 --- a/src/game/Objects/Corpse.cpp +++ b/src/game/Objects/Corpse.cpp @@ -21,12 +21,10 @@ #include "Corpse.h" #include "Player.h" -#include "UpdateMask.h" +#include "Group.h" #include "ObjectAccessor.h" #include "ObjectGuid.h" #include "Database/DatabaseEnv.h" -#include "Opcodes.h" -#include "GossipDef.h" #include "World.h" #include "ObjectMgr.h" diff --git a/src/game/Objects/Creature.cpp b/src/game/Objects/Creature.cpp index 071472b1f..984ccdbbc 100644 --- a/src/game/Objects/Creature.cpp +++ b/src/game/Objects/Creature.cpp @@ -27,9 +27,9 @@ #include "ScriptMgr.h" #include "ObjectGuid.h" #include "SpellMgr.h" -#include "QuestDef.h" #include "GossipDef.h" #include "Player.h" +#include "Group.h" #include "GameEventMgr.h" #include "PoolManager.h" #include "Opcodes.h" @@ -38,18 +38,13 @@ #include "MapManager.h" #include "CreatureAI.h" #include "CreatureAISelector.h" -#include "Formulas.h" -#include "WaypointMovementGenerator.h" -#include "InstanceData.h" +#include "MovementGenerator.h" #include "MapPersistentStateMgr.h" #include "BattleGroundMgr.h" -#include "Spell.h" #include "Util.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" -#include "Language.h" - #include "CreatureGroups.h" #include "ZoneScript.h" #include "MoveSplineInit.h" @@ -57,13 +52,8 @@ #include "Anticheat.h" #include "CreatureLinkingMgr.h" #include "TemporarySummon.h" -#include "ScriptedEscortAI.h" #include "GuardMgr.h" -// apply implementation of the singletons -#include "Policies/SingletonImp.h" - - TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const { TrainerSpellMap::const_iterator itr = spellList.find(spell_id); diff --git a/src/game/Objects/Creature.h b/src/game/Objects/Creature.h index 5ec95c509..90690f28e 100644 --- a/src/game/Objects/Creature.h +++ b/src/game/Objects/Creature.h @@ -23,21 +23,17 @@ #define MANGOSSERVER_CREATURE_H #include "Common.h" -#include "Unit.h" -#include "UpdateMask.h" -#include "ItemPrototype.h" #include "SharedDefines.h" +#include "CreatureDefines.h" +#include "Unit.h" #include "LootMgr.h" -#include "DBCEnums.h" -#include "Database/DatabaseEnv.h" -#include "CreatureGroups.h" #include "Cell.h" #include "Util.h" +#include #include class SpellEntry; - class CreatureAI; class Group; class Quest; @@ -47,419 +43,6 @@ class CreatureGroup; struct GameEventCreatureData; -enum CreatureFlagsExtra -{ - CREATURE_FLAG_EXTRA_INSTANCE_BIND = 0x00000001, // 1 Killing this creature will bind players to the raid - CREATURE_FLAG_EXTRA_NO_AGGRO = 0x00000002, // 2 Creature will not attack nearby hostile targets (ignore faction/reputation hostility) - CREATURE_FLAG_EXTRA_NO_PARRY = 0x00000004, // 4 Creature can't parry - CREATURE_FLAG_EXTRA_SUMMON_GUARD = 0x00000008, // 8 Creature summons a guard if an opposite faction player gets near or attacks - CREATURE_FLAG_EXTRA_NO_BLOCK = 0x00000010, // 16 Creature can't block - CREATURE_FLAG_EXTRA_NO_CRUSH = 0x00000020, // 32 Creature can't do crush attacks - CREATURE_FLAG_EXTRA_FIXED_Z = 0x00000040, // 64 Creature does not fall - CREATURE_FLAG_EXTRA_INVISIBLE = 0x00000080, // 128 Creature is always invisible for player (mostly trigger creatures) - CREATURE_FLAG_EXTRA_NOT_TAUNTABLE = 0x00000100, // 256 Creature is immune to taunt auras and effect attack me - CREATURE_FLAG_EXTRA_AGGRO_ZONE = 0x00000200, // 512 Creature sets itself in combat with zone on aggro - CREATURE_FLAG_EXTRA_GUARD = 0x00000400, // 1024 Creature is a guard - CREATURE_FLAG_EXTRA_NO_THREAT_LIST = 0x00000800, // 2048 Creature does not select targets based on threat - CREATURE_FLAG_EXTRA_KEEP_POSITIVE_AURAS_ON_EVADE = 0x00001000, // 4096 Creature keeps positive auras at reset - CREATURE_FLAG_EXTRA_ALWAYS_CRUSH = 0x00002000, // 8192 Creature always roll a crushing melee outcome when not miss/crit/dodge/parry/block - CREATURE_FLAG_EXTRA_IMMUNE_AOE = 0x00004000, // 16384 Creature is immune to AoE - CREATURE_FLAG_EXTRA_CHASE_GEN_NO_BACKING = 0x00008000, // 32768 Creature does not move back when target is within bounding radius - CREATURE_FLAG_EXTRA_NO_ASSIST = 0x00010000, // 65536 Creature does not aggro when nearby creatures aggro - CREATURE_FLAG_EXTRA_NO_TARGET = 0x00020000, // 131072 Creature does not acquire targets - CREATURE_FLAG_EXTRA_ONLY_VISIBLE_TO_FRIENDLY = 0x00040000, // 262144 Creature can only be seen by friendly units - CREATURE_FLAG_EXTRA_PVP = 0x00080000, // 524288 Creature has pvp unit flag set by default - CREATURE_FLAG_EXTRA_CAN_ASSIST = 0x00100000, // 1048576 CREATURE_TYPEFLAGS_CAN_ASSIST from TBC - CREATURE_FLAG_EXTRA_LARGE_AOI = 0x00200000, // 2097152 CREATURE_DIFFICULTYFLAGS_LARGE_AOI (200 yards) - CREATURE_FLAG_EXTRA_GIGANTIC_AOI = 0x00400000, // 4194304 CREATURE_DIFFICULTYFLAGS_3_GIGANTIC_AOI (400 yards) - CREATURE_FLAG_EXTRA_INFINITE_AOI = 0x00800000, // 8388606 CREATURE_DIFFICULTYFLAGS_3_INFINITE_AOI - CREATURE_FLAG_EXTRA_NO_MOVEMENT_PAUSE = 0x01000000, // 16777216 Creature will not pause movement when player talks to it - CREATURE_FLAG_EXTRA_ALWAYS_RUN = 0x02000000, // 33554432 Creature will use run speed out of combat - CREATURE_FLAG_EXTRA_NO_UNREACHABLE_EVADE = 0x04000000, // 67108864 Creature will not evade due to target being unreachable -}; - -// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform -#if defined(__GNUC__) -#pragma pack(1) -#else -#pragma pack(push,1) -#endif - -#define MAX_DISPLAY_IDS_PER_CREATURE 4 // only single send to client in static data -#define CREATURE_FLEE_TEXT 1150 -#define NPC_MOVEMENT_PAUSE_TIME 180000 - -#define SPEED_REDUCTION_NONE 1.0f -#define SPEED_REDUCTION_HP_15 0.7f -#define SPEED_REDUCTION_HP_10 0.6f -#define SPEED_REDUCTION_HP_5 0.5f - -// from `creature_template` table -struct CreatureInfo -{ - uint32 entry; - uint32 display_id[MAX_DISPLAY_IDS_PER_CREATURE]; - float display_scale[MAX_DISPLAY_IDS_PER_CREATURE]; - uint32 display_probability[MAX_DISPLAY_IDS_PER_CREATURE]; - uint32 display_total_probability; - uint32 mount_display_id; - char* name; - char* subname; - uint32 gossip_menu_id; - uint32 level_min; - uint32 level_max; - uint32 health_min; - uint32 health_max; - uint32 mana_min; - uint32 mana_max; - uint32 armor; - uint32 faction; - uint32 npc_flags; - float speed_walk; - float speed_run; - float detection_range; // Detection Range for Line of Sight aggro - float call_for_help_range; // Radius for combat assistance call - float leash_range; // Hard limit on allowed chase distance - uint32 rank; - float xp_multiplier; - float dmg_min; - float dmg_max; - uint32 dmg_school; - uint32 attack_power; - float dmg_multiplier; - uint32 base_attack_time; - uint32 ranged_attack_time; - uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures. - uint32 unit_flags; // enum UnitFlags mask values - uint32 dynamic_flags; - uint32 beast_family; // enum CreatureFamily values (optional) - uint32 trainer_type; - uint32 trainer_spell; - uint32 trainer_class; - uint32 trainer_race; - float ranged_dmg_min; - float ranged_dmg_max; - uint32 ranged_attack_power; - uint32 type; // enum CreatureType values - uint32 type_flags; // enum CreatureTypeFlags mask values - uint32 loot_id; - uint32 pickpocket_loot_id; - uint32 skinning_loot_id; - int32 holy_res; - int32 fire_res; - int32 nature_res; - int32 frost_res; - int32 shadow_res; - int32 arcane_res; - uint32 spells[CREATURE_MAX_SPELLS]; - uint32 spell_list_id; - uint32 pet_spell_list_id; - uint32 const* auras; - uint32 gold_min; - uint32 gold_max; - char const* ai_name; - uint32 movement_type; - uint32 inhabit_type; - uint32 civilian; - bool racial_leader; - uint32 regeneration; - uint32 equipment_id; - uint32 trainer_id; - uint32 vendor_id; - uint32 mechanic_immune_mask; - uint32 school_immune_mask; - uint32 flags_extra; - uint32 script_id; - - // helpers - static HighGuid GetHighGuid() - { - return HIGHGUID_UNIT; // in pre-3.x always HIGHGUID_UNIT - } - - ObjectGuid GetObjectGuid(uint32 lowguid) const { return ObjectGuid(GetHighGuid(), entry, lowguid); } - - bool isTameable() const - { - return type == CREATURE_TYPE_BEAST && beast_family != 0 && type_flags & CREATURE_TYPEFLAGS_TAMEABLE; - } -}; - -struct EquipmentInfo -{ - uint32 entry; - uint32 equipentry[3]; -}; - -#define MAX_CREATURE_IDS_PER_SPAWN 4 - -// from `creature` table -struct CreatureData -{ - std::array creature_id = {}; - WorldLocation position; - uint32 spawntimesecsmin = 0; - uint32 spawntimesecsmax = 0; - float wander_distance = 0.0f; - float health_percent = 100.0f; - float mana_percent = 100.0f; - uint8 movement_type = 0; - uint32 spawn_flags = 0; - float visibility_mod = 0.0f; - - // non db field - uint32 instanciatedContinentInstanceId; - - // helper function - ObjectGuid GetObjectGuid(uint32 lowguid) const { return ObjectGuid(CreatureInfo::GetHighGuid(), creature_id[0], lowguid); } - uint32 GetRandomRespawnTime() const { return urand(spawntimesecsmin, spawntimesecsmax); } - uint32 ChooseCreatureId() const - { - uint32 creatureId = 0; - uint32 creatureIdCount = 0; - for (; creatureIdCount < MAX_CREATURE_IDS_PER_SPAWN && creature_id[creatureIdCount]; ++creatureIdCount); - - if (creatureIdCount) - creatureId = creature_id[urand(0, creatureIdCount - 1)]; - - if (!creatureId) - creatureId = 1; - - return creatureId; - } - uint32 GetCreatureIdCount() const - { - uint32 creatureIdCount = 0; - for (; creatureIdCount < MAX_CREATURE_IDS_PER_SPAWN && creature_id[creatureIdCount]; ++creatureIdCount); - return creatureIdCount; - } -}; - -// from `creature_addon` table -struct CreatureDataAddon -{ - uint32 guid; - uint32 display_id; - int32 mount_display_id; - int32 equipment_id; - uint8 stand_state; - uint8 sheath_state; // SheathState - uint32 emote_state; - uint32 const* auras; // loaded as char* "spell1 spell2 ... " -}; - -struct CreatureDisplayInfoAddon -{ - uint32 display_id; - float bounding_radius; - float combat_reach; - uint8 gender; - uint32 display_id_other_gender; // The oposite gender for this display id (male/female) -}; - -// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform -#if defined(__GNUC__) -#pragma pack() -#else -#pragma pack(pop) -#endif - -struct CreatureLocale -{ - std::vector Name; - std::vector SubName; -}; - -struct GossipMenuItemsLocale -{ - std::vector OptionText; - std::vector BoxText; -}; - -struct PointOfInterestLocale -{ - std::vector IconName; -}; - -enum InhabitTypeValues -{ - INHABIT_GROUND = 1, - INHABIT_WATER = 2, - INHABIT_AIR = 4, - INHABIT_ANYWHERE = INHABIT_GROUND | INHABIT_WATER | INHABIT_AIR -}; - -// Enums used by StringTextData::Type (CreatureEventAI) -enum ChatType -{ - CHAT_TYPE_SAY = 0, - CHAT_TYPE_YELL = 1, - CHAT_TYPE_TEXT_EMOTE = 2, - CHAT_TYPE_BOSS_EMOTE = 3, - CHAT_TYPE_WHISPER = 4, - CHAT_TYPE_BOSS_WHISPER = 5, - CHAT_TYPE_ZONE_YELL = 6 -}; - -// Selection method used by SelectAttackingTarget -enum AttackingTarget -{ - ATTACKING_TARGET_RANDOM = 0, // Just selects a random target - ATTACKING_TARGET_TOPAGGRO, // Selects targets from top aggro to bottom - ATTACKING_TARGET_BOTTOMAGGRO, // Selects targets from bottom aggro to top - ATTACKING_TARGET_NEAREST, // Selects the closest target - ATTACKING_TARGET_FARTHEST // Selects the farthest away target -}; - -enum SelectFlags -{ - SELECT_FLAG_IN_LOS = 0x001, // Default Selection Requirement for Spell-targets - SELECT_FLAG_PLAYER = 0x002, - SELECT_FLAG_POWER_MANA = 0x004, // For Energy based spells, like manaburn - SELECT_FLAG_POWER_RAGE = 0x008, - SELECT_FLAG_POWER_ENERGY = 0x010, - SELECT_FLAG_IN_MELEE_RANGE = 0x040, - SELECT_FLAG_NOT_IN_MELEE_RANGE = 0x080, - SELECT_FLAG_NO_TOTEM = 0x100, - SELECT_FLAG_PLAYER_NOT_GM = 0x200, - SELECT_FLAG_PET = 0x400, - SELECT_FLAG_NOT_PLAYER = 0x800, - SELECT_FLAG_POWER_NOT_MANA = 0x1000, // Used in some dungeon encounters -}; - -#define MAX_SELECT_FLAG_MASK (SELECT_FLAG_IN_LOS | SELECT_FLAG_PLAYER | SELECT_FLAG_POWER_MANA | SELECT_FLAG_POWER_RAGE | SELECT_FLAG_POWER_ENERGY | SELECT_FLAG_IN_MELEE_RANGE | SELECT_FLAG_NOT_IN_MELEE_RANGE | SELECT_FLAG_NO_TOTEM | SELECT_FLAG_PLAYER_NOT_GM | SELECT_FLAG_PET | SELECT_FLAG_NOT_PLAYER | SELECT_FLAG_POWER_NOT_MANA) - -enum RegenStatsFlags -{ - REGEN_FLAG_HEALTH = 0x001, - REGEN_FLAG_POWER = 0x002, -}; - -enum CreatureStateFlag : uint16 -{ - CSTATE_ALREADY_CALL_ASSIST = 0x0001, - CSTATE_ALREADY_SEARCH_ASSIST = 0x0002, - CSTATE_REGEN_HEALTH = 0x0004, - CSTATE_REGEN_MANA = 0x0008, - CSTATE_INIT_AI_ON_RESPAWN = 0x0010, - CSTATE_COMBAT = 0x0020, - CSTATE_COMBAT_WITH_ZONE = 0x0040, - CSTATE_ESCORTABLE = 0x0080, - CSTATE_DESPAWNING = 0x0100, -}; - -// Vendors -struct VendorItem -{ - VendorItem(uint32 _item, uint32 _maxcount, uint32 _incrtime, uint32 _itemflags, uint32 _conditionId) - : item(_item), maxcount(_maxcount), incrtime(_incrtime), itemflags(_itemflags), conditionId(_conditionId) {} - - uint32 item; - uint32 maxcount; // 0 for infinity item amount - uint32 incrtime; // time for restore items amount if maxcount != 0 - uint32 itemflags; - uint32 conditionId; // condition to check for this item -}; -typedef std::vector VendorItemList; - -struct VendorItemData -{ - VendorItemList m_items; - - VendorItem* GetItem(uint32 slot) const - { - if (slot>=m_items.size()) return nullptr; - return m_items[slot]; - } - bool Empty() const { return m_items.empty(); } - uint8 GetItemCount() const { return m_items.size(); } - void AddItem(uint32 item, uint32 maxcount, uint32 ptime, uint32 itemflags, uint32 conditonId) - { - m_items.push_back(new VendorItem(item, maxcount, ptime, itemflags, conditonId)); - } - bool RemoveItem(uint32 item_id); - VendorItem const* FindItem(uint32 item_id) const; - size_t FindItemSlot(uint32 item_id) const; - - void Clear() - { - for (const auto& item : m_items) - delete item; - m_items.clear(); - } -}; - -struct VendorItemCount -{ - explicit VendorItemCount(uint32 _item, uint32 _count, uint32 _restockDelay) - : itemId(_item), count(_count), restockDelay(_restockDelay), lastIncrementTime(time(nullptr)) {} - - uint32 itemId; - uint32 count; - uint32 restockDelay; - time_t lastIncrementTime; -}; - -enum VendorItemFlags -{ - VENDOR_ITEM_FLAG_RANDOM_RESTOCK = 0x01, - VENDOR_ITEM_FLAG_DYNAMIC_RESTOCK = 0x02, -}; - -typedef std::list VendorItemCounts; - -struct TrainerSpell -{ - TrainerSpell() : spell(0), spellCost(0), reqSkill(0), reqSkillValue(0), reqLevel(0) {} - - TrainerSpell(uint32 _spell, uint32 _spellCost, uint32 _reqSkill, uint32 _reqSkillValue, uint32 _reqLevel) - : spell(_spell), spellCost(_spellCost), reqSkill(_reqSkill), reqSkillValue(_reqSkillValue), reqLevel(_reqLevel) - {} - - uint32 spell; - uint32 spellCost; - uint32 reqSkill; - uint32 reqSkillValue; - uint32 reqLevel; -}; - -typedef std::unordered_map TrainerSpellMap; - -struct TrainerSpellData -{ - TrainerSpellData() : trainerType(0) {} - - 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; - void Clear() { spellList.clear(); } -}; - -// max different by z coordinate for creature aggro reaction -#define CREATURE_Z_ATTACK_RANGE 3 - -#define MAX_VENDOR_ITEMS 255 // Limitation in item count field size in SMSG_LIST_INVENTORY - -enum VirtualItemSlot -{ - VIRTUAL_ITEM_SLOT_0 = 0, - VIRTUAL_ITEM_SLOT_1 = 1, - VIRTUAL_ITEM_SLOT_2 = 2, -}; - -#define MAX_VIRTUAL_ITEM_SLOT 3 - -enum VirtualItemInfoByteOffset -{ - VIRTUAL_ITEM_INFO_0_OFFSET_CLASS = 0, - VIRTUAL_ITEM_INFO_0_OFFSET_SUBCLASS = 1, - VIRTUAL_ITEM_INFO_0_OFFSET_MATERIAL = 2, - VIRTUAL_ITEM_INFO_0_OFFSET_INVENTORYTYPE = 3, - - VIRTUAL_ITEM_INFO_1_OFFSET_SHEATH = 0, -}; - struct CreatureCreatePos { // exactly coordinates used @@ -483,29 +66,12 @@ private: float m_dist; }; -enum CreatureSubtype -{ - CREATURE_SUBTYPE_GENERIC, // new Creature - CREATURE_SUBTYPE_PET, // new Pet - CREATURE_SUBTYPE_TOTEM, // new Totem - CREATURE_SUBTYPE_TEMPORARY_SUMMON, // new TemporarySummon -}; - -enum TemporaryFactionFlags // Used at real faction changes -{ - TEMPFACTION_NONE = 0x00, // When no flag is used in temporary faction change, faction will be persistent. It will then require manual change back to default/another faction when changed once - TEMPFACTION_RESTORE_RESPAWN = 0x01, // Default faction will be restored at respawn - TEMPFACTION_RESTORE_COMBAT_STOP = 0x02, // ... at CombatStop() (happens at creature death, at evade or custom scripte among others) - TEMPFACTION_RESTORE_REACH_HOME = 0x04, // ... at reaching home in home movement (evade), if not already done at CombatStop() - TEMPFACTION_ALL, -}; - class ThreatListProcesser { - public: - ThreatListProcesser() {} - virtual ~ThreatListProcesser() {} - virtual bool Process(Unit* unit) = 0; +public: + ThreatListProcesser() {} + virtual ~ThreatListProcesser() {} + virtual bool Process(Unit* unit) = 0; }; class Creature : public Unit diff --git a/src/game/Objects/CreatureDefines.h b/src/game/Objects/CreatureDefines.h new file mode 100644 index 000000000..d34e206a9 --- /dev/null +++ b/src/game/Objects/CreatureDefines.h @@ -0,0 +1,562 @@ +/* + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __CREATURE_DEFINES_H +#define __CREATURE_DEFINES_H + +#include "Common.h" +#include "SharedDefines.h" +#include "UnitDefines.h" +#include "ObjectGuid.h" +#include "Util.h" + +#include +#include + + +enum TrainerType // this is important type for npcs! +{ + TRAINER_TYPE_CLASS = 0, + TRAINER_TYPE_MOUNTS = 1, // on blizz it's 2 + TRAINER_TYPE_TRADESKILLS = 2, + TRAINER_TYPE_PETS = 3 +}; + +#define MAX_TRAINER_TYPE 4 + +// CreatureType.dbc +enum CreatureType +{ + CREATURE_TYPE_BEAST = 1, + CREATURE_TYPE_DRAGONKIN = 2, + CREATURE_TYPE_DEMON = 3, + CREATURE_TYPE_ELEMENTAL = 4, + CREATURE_TYPE_GIANT = 5, + CREATURE_TYPE_UNDEAD = 6, + CREATURE_TYPE_HUMANOID = 7, + CREATURE_TYPE_CRITTER = 8, + CREATURE_TYPE_MECHANICAL = 9, + CREATURE_TYPE_NOT_SPECIFIED = 10, + CREATURE_TYPE_TOTEM = 11, +}; + +uint32 const CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD = (1 << (CREATURE_TYPE_HUMANOID - 1)) | (1 << (CREATURE_TYPE_UNDEAD - 1)); +uint32 const CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL = (1 << (CREATURE_TYPE_MECHANICAL - 1)) | (1 << (CREATURE_TYPE_ELEMENTAL - 1)); + +// CreatureFamily.dbc +enum CreatureFamily +{ + CREATURE_FAMILY_WOLF = 1, + CREATURE_FAMILY_CAT = 2, + CREATURE_FAMILY_SPIDER = 3, + CREATURE_FAMILY_BEAR = 4, + CREATURE_FAMILY_BOAR = 5, + CREATURE_FAMILY_CROCOLISK = 6, + CREATURE_FAMILY_CARRION_BIRD = 7, + CREATURE_FAMILY_CRAB = 8, + CREATURE_FAMILY_GORILLA = 9, + CREATURE_FAMILY_HORSE_CUSTOM = 10, // not exist in DBC but used for horse like beasts in DB + CREATURE_FAMILY_RAPTOR = 11, + CREATURE_FAMILY_TALLSTRIDER = 12, + CREATURE_FAMILY_FELHUNTER = 15, + CREATURE_FAMILY_VOIDWALKER = 16, + CREATURE_FAMILY_SUCCUBUS = 17, + CREATURE_FAMILY_DOOMGUARD = 19, + CREATURE_FAMILY_SCORPID = 20, + CREATURE_FAMILY_TURTLE = 21, + CREATURE_FAMILY_IMP = 23, + CREATURE_FAMILY_BAT = 24, + CREATURE_FAMILY_HYENA = 25, + CREATURE_FAMILY_OWL = 26, + CREATURE_FAMILY_WIND_SERPENT = 27, + CREATURE_FAMILY_REMOTE_CONTROL = 28, +}; + +enum CreatureTypeFlags +{ + CREATURE_TYPEFLAGS_TAMEABLE = 0x00000001, // Tameable by any hunter + CREATURE_TYPEFLAGS_GHOST_VISIBLE = 0x00000002, // Creatures which can _also_ be seen when player is a ghost, used in CanInteract function by client, can't be attacked + CREATURE_TYPEFLAGS_BOSS = 0x00000004, // Changes creature's visible level to "??" in the creature's portrait + CREATURE_TYPEFLAGS_NO_WOUND_ANIM = 0x00000008, // Disables "wounded" animations at spell taken + CREATURE_TYPEFLAGS_HIDE_FACTION_TOOLTIP = 0x00000010, // Controls something in client tooltip related to creature faction + CREATURE_TYPEFLAGS_UNK6 = 0x00000020, // May be sound related + CREATURE_TYPEFLAGS_SPELL_ATTACKABLE = 0x00000040, // May be related to attackable / not attackable creatures with spells, used together with lua_IsHelpfulSpell/lua_IsHarmfulSpell +}; + +enum CreatureEliteType +{ + CREATURE_ELITE_NORMAL = 0, + CREATURE_ELITE_ELITE = 1, + CREATURE_ELITE_RAREELITE = 2, + CREATURE_ELITE_WORLDBOSS = 3, + CREATURE_ELITE_RARE = 4, + CREATURE_UNKNOWN = 5 // found in 2.2.3 for 2 mobs +}; + +enum CreatureFlagsExtra +{ + CREATURE_FLAG_EXTRA_INSTANCE_BIND = 0x00000001, // 1 Killing this creature will bind players to the raid + CREATURE_FLAG_EXTRA_NO_AGGRO = 0x00000002, // 2 Creature will not attack nearby hostile targets (ignore faction/reputation hostility) + CREATURE_FLAG_EXTRA_NO_PARRY = 0x00000004, // 4 Creature can't parry + CREATURE_FLAG_EXTRA_SUMMON_GUARD = 0x00000008, // 8 Creature summons a guard if an opposite faction player gets near or attacks + CREATURE_FLAG_EXTRA_NO_BLOCK = 0x00000010, // 16 Creature can't block + CREATURE_FLAG_EXTRA_NO_CRUSH = 0x00000020, // 32 Creature can't do crush attacks + CREATURE_FLAG_EXTRA_FIXED_Z = 0x00000040, // 64 Creature does not fall + CREATURE_FLAG_EXTRA_INVISIBLE = 0x00000080, // 128 Creature is always invisible for player (mostly trigger creatures) + CREATURE_FLAG_EXTRA_NOT_TAUNTABLE = 0x00000100, // 256 Creature is immune to taunt auras and effect attack me + CREATURE_FLAG_EXTRA_AGGRO_ZONE = 0x00000200, // 512 Creature sets itself in combat with zone on aggro + CREATURE_FLAG_EXTRA_GUARD = 0x00000400, // 1024 Creature is a guard + CREATURE_FLAG_EXTRA_NO_THREAT_LIST = 0x00000800, // 2048 Creature does not select targets based on threat + CREATURE_FLAG_EXTRA_KEEP_POSITIVE_AURAS_ON_EVADE = 0x00001000, // 4096 Creature keeps positive auras at reset + CREATURE_FLAG_EXTRA_ALWAYS_CRUSH = 0x00002000, // 8192 Creature always roll a crushing melee outcome when not miss/crit/dodge/parry/block + CREATURE_FLAG_EXTRA_IMMUNE_AOE = 0x00004000, // 16384 Creature is immune to AoE + CREATURE_FLAG_EXTRA_CHASE_GEN_NO_BACKING = 0x00008000, // 32768 Creature does not move back when target is within bounding radius + CREATURE_FLAG_EXTRA_NO_ASSIST = 0x00010000, // 65536 Creature does not aggro when nearby creatures aggro + CREATURE_FLAG_EXTRA_NO_TARGET = 0x00020000, // 131072 Creature does not acquire targets + CREATURE_FLAG_EXTRA_ONLY_VISIBLE_TO_FRIENDLY = 0x00040000, // 262144 Creature can only be seen by friendly units + CREATURE_FLAG_EXTRA_PVP = 0x00080000, // 524288 Creature has pvp unit flag set by default + CREATURE_FLAG_EXTRA_CAN_ASSIST = 0x00100000, // 1048576 CREATURE_TYPEFLAGS_CAN_ASSIST from TBC + CREATURE_FLAG_EXTRA_LARGE_AOI = 0x00200000, // 2097152 CREATURE_DIFFICULTYFLAGS_LARGE_AOI (200 yards) + CREATURE_FLAG_EXTRA_GIGANTIC_AOI = 0x00400000, // 4194304 CREATURE_DIFFICULTYFLAGS_3_GIGANTIC_AOI (400 yards) + CREATURE_FLAG_EXTRA_INFINITE_AOI = 0x00800000, // 8388606 CREATURE_DIFFICULTYFLAGS_3_INFINITE_AOI + CREATURE_FLAG_EXTRA_NO_MOVEMENT_PAUSE = 0x01000000, // 16777216 Creature will not pause movement when player talks to it + CREATURE_FLAG_EXTRA_ALWAYS_RUN = 0x02000000, // 33554432 Creature will use run speed out of combat + CREATURE_FLAG_EXTRA_NO_UNREACHABLE_EVADE = 0x04000000, // 67108864 Creature will not evade due to target being unreachable +}; + +// Number of spells in one template +#define CREATURE_SPELLS_MAX_SPELLS 8 +// Columns in the db for each spell +#define CREATURE_SPELLS_MAX_COLUMNS 11 + +struct CreatureSpellsEntry +{ + uint16 const spellId; + uint8 const probability; + uint8 const castTarget; + uint32 const targetParam1; + uint32 const targetParam2; + uint16 const castFlags; + uint32 const delayInitialMin; + uint32 const delayInitialMax; + uint32 const delayRepeatMin; + uint32 const delayRepeatMax; + uint32 const scriptId; + CreatureSpellsEntry(uint16 Id, uint8 Probability, uint8 CastTarget, uint32 TargetParam1, uint32 TargetParam2, uint16 CastFlags, uint32 InitialMin, uint32 InitialMax, uint32 RepeatMin, uint32 RepeatMax, uint32 ScriptId) : spellId(Id), probability(Probability), castTarget(CastTarget), targetParam1(TargetParam1), targetParam2(TargetParam2), castFlags(CastFlags), delayInitialMin(InitialMin), delayInitialMax(InitialMax), delayRepeatMin(RepeatMin), delayRepeatMax(RepeatMax), scriptId(ScriptId) {} +}; + +typedef std::vector CreatureSpellsList; + +// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform +#if defined(__GNUC__) +#pragma pack(1) +#else +#pragma pack(push,1) +#endif + +#define MAX_DISPLAY_IDS_PER_CREATURE 4 // only single send to client in static data +#define CREATURE_FLEE_TEXT 1150 +#define NPC_MOVEMENT_PAUSE_TIME 180000 + +#define SPEED_REDUCTION_NONE 1.0f +#define SPEED_REDUCTION_HP_15 0.7f +#define SPEED_REDUCTION_HP_10 0.6f +#define SPEED_REDUCTION_HP_5 0.5f + +// from `creature_template` table +struct CreatureInfo +{ + uint32 entry; + uint32 display_id[MAX_DISPLAY_IDS_PER_CREATURE]; + float display_scale[MAX_DISPLAY_IDS_PER_CREATURE]; + uint32 display_probability[MAX_DISPLAY_IDS_PER_CREATURE]; + uint32 display_total_probability; + uint32 mount_display_id; + char* name; + char* subname; + uint32 gossip_menu_id; + uint32 level_min; + uint32 level_max; + uint32 health_min; + uint32 health_max; + uint32 mana_min; + uint32 mana_max; + uint32 armor; + uint32 faction; + uint32 npc_flags; + float speed_walk; + float speed_run; + float detection_range; // Detection Range for Line of Sight aggro + float call_for_help_range; // Radius for combat assistance call + float leash_range; // Hard limit on allowed chase distance + uint32 rank; + float xp_multiplier; + float dmg_min; + float dmg_max; + uint32 dmg_school; + uint32 attack_power; + float dmg_multiplier; + uint32 base_attack_time; + uint32 ranged_attack_time; + uint32 unit_class; // enum Classes. Note only 4 classes are known for creatures. + uint32 unit_flags; // enum UnitFlags mask values + uint32 dynamic_flags; + uint32 beast_family; // enum CreatureFamily values (optional) + uint32 trainer_type; + uint32 trainer_spell; + uint32 trainer_class; + uint32 trainer_race; + float ranged_dmg_min; + float ranged_dmg_max; + uint32 ranged_attack_power; + uint32 type; // enum CreatureType values + uint32 type_flags; // enum CreatureTypeFlags mask values + uint32 loot_id; + uint32 pickpocket_loot_id; + uint32 skinning_loot_id; + int32 holy_res; + int32 fire_res; + int32 nature_res; + int32 frost_res; + int32 shadow_res; + int32 arcane_res; + uint32 spells[CREATURE_MAX_SPELLS]; + uint32 spell_list_id; + uint32 pet_spell_list_id; + uint32 const* auras; + uint32 gold_min; + uint32 gold_max; + char const* ai_name; + uint32 movement_type; + uint32 inhabit_type; + uint32 civilian; + bool racial_leader; + uint32 regeneration; + uint32 equipment_id; + uint32 trainer_id; + uint32 vendor_id; + uint32 mechanic_immune_mask; + uint32 school_immune_mask; + uint32 flags_extra; + uint32 script_id; + + // helpers + static HighGuid GetHighGuid() + { + return HIGHGUID_UNIT; // in pre-3.x always HIGHGUID_UNIT + } + + ObjectGuid GetObjectGuid(uint32 lowguid) const { return ObjectGuid(GetHighGuid(), entry, lowguid); } + + bool isTameable() const + { + return type == CREATURE_TYPE_BEAST && beast_family != 0 && type_flags & CREATURE_TYPEFLAGS_TAMEABLE; + } +}; + +struct EquipmentInfo +{ + uint32 entry; + uint32 equipentry[3]; +}; + +#define MAX_CREATURE_IDS_PER_SPAWN 4 + +// from `creature` table +struct CreatureData +{ + std::array creature_id = {}; + WorldLocation position; + uint32 spawntimesecsmin = 0; + uint32 spawntimesecsmax = 0; + float wander_distance = 0.0f; + float health_percent = 100.0f; + float mana_percent = 100.0f; + uint8 movement_type = 0; + uint32 spawn_flags = 0; + float visibility_mod = 0.0f; + + // non db field + uint32 instanciatedContinentInstanceId; + + // helper function + ObjectGuid GetObjectGuid(uint32 lowguid) const { return ObjectGuid(CreatureInfo::GetHighGuid(), creature_id[0], lowguid); } + uint32 GetRandomRespawnTime() const { return urand(spawntimesecsmin, spawntimesecsmax); } + uint32 ChooseCreatureId() const + { + uint32 creatureId = 0; + uint32 creatureIdCount = 0; + for (; creatureIdCount < MAX_CREATURE_IDS_PER_SPAWN && creature_id[creatureIdCount]; ++creatureIdCount); + + if (creatureIdCount) + creatureId = creature_id[urand(0, creatureIdCount - 1)]; + + if (!creatureId) + creatureId = 1; + + return creatureId; + } + uint32 GetCreatureIdCount() const + { + uint32 creatureIdCount = 0; + for (; creatureIdCount < MAX_CREATURE_IDS_PER_SPAWN && creature_id[creatureIdCount]; ++creatureIdCount); + return creatureIdCount; + } +}; + +// from `creature_addon` table +struct CreatureDataAddon +{ + uint32 guid; + uint32 display_id; + int32 mount_display_id; + int32 equipment_id; + uint8 stand_state; + uint8 sheath_state; // SheathState + uint32 emote_state; + uint32 const* auras; // loaded as char* "spell1 spell2 ... " +}; + +struct CreatureDisplayInfoAddon +{ + uint32 display_id; + float bounding_radius; + float combat_reach; + uint8 gender; + uint32 display_id_other_gender; // The oposite gender for this display id (male/female) +}; + +// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform +#if defined(__GNUC__) +#pragma pack() +#else +#pragma pack(pop) +#endif + +struct CreatureLocale +{ + std::vector Name; + std::vector SubName; +}; + +struct GossipMenuItemsLocale +{ + std::vector OptionText; + std::vector BoxText; +}; + +struct PointOfInterestLocale +{ + std::vector IconName; +}; + +enum InhabitTypeValues +{ + INHABIT_GROUND = 1, + INHABIT_WATER = 2, + INHABIT_AIR = 4, + INHABIT_ANYWHERE = INHABIT_GROUND | INHABIT_WATER | INHABIT_AIR +}; + +// Enums used by StringTextData::Type (CreatureEventAI) +enum ChatType +{ + CHAT_TYPE_SAY = 0, + CHAT_TYPE_YELL = 1, + CHAT_TYPE_TEXT_EMOTE = 2, + CHAT_TYPE_BOSS_EMOTE = 3, + CHAT_TYPE_WHISPER = 4, + CHAT_TYPE_BOSS_WHISPER = 5, + CHAT_TYPE_ZONE_YELL = 6 +}; + +// Selection method used by SelectAttackingTarget +enum AttackingTarget +{ + ATTACKING_TARGET_RANDOM = 0, // Just selects a random target + ATTACKING_TARGET_TOPAGGRO, // Selects targets from top aggro to bottom + ATTACKING_TARGET_BOTTOMAGGRO, // Selects targets from bottom aggro to top + ATTACKING_TARGET_NEAREST, // Selects the closest target + ATTACKING_TARGET_FARTHEST // Selects the farthest away target +}; + +enum SelectFlags +{ + SELECT_FLAG_IN_LOS = 0x001, // Default Selection Requirement for Spell-targets + SELECT_FLAG_PLAYER = 0x002, + SELECT_FLAG_POWER_MANA = 0x004, // For Energy based spells, like manaburn + SELECT_FLAG_POWER_RAGE = 0x008, + SELECT_FLAG_POWER_ENERGY = 0x010, + SELECT_FLAG_IN_MELEE_RANGE = 0x040, + SELECT_FLAG_NOT_IN_MELEE_RANGE = 0x080, + SELECT_FLAG_NO_TOTEM = 0x100, + SELECT_FLAG_PLAYER_NOT_GM = 0x200, + SELECT_FLAG_PET = 0x400, + SELECT_FLAG_NOT_PLAYER = 0x800, + SELECT_FLAG_POWER_NOT_MANA = 0x1000, // Used in some dungeon encounters +}; + +#define MAX_SELECT_FLAG_MASK (SELECT_FLAG_IN_LOS | SELECT_FLAG_PLAYER | SELECT_FLAG_POWER_MANA | SELECT_FLAG_POWER_RAGE | SELECT_FLAG_POWER_ENERGY | SELECT_FLAG_IN_MELEE_RANGE | SELECT_FLAG_NOT_IN_MELEE_RANGE | SELECT_FLAG_NO_TOTEM | SELECT_FLAG_PLAYER_NOT_GM | SELECT_FLAG_PET | SELECT_FLAG_NOT_PLAYER | SELECT_FLAG_POWER_NOT_MANA) + +enum RegenStatsFlags +{ + REGEN_FLAG_HEALTH = 0x001, + REGEN_FLAG_POWER = 0x002, +}; + +enum CreatureStateFlag : uint16 +{ + CSTATE_ALREADY_CALL_ASSIST = 0x0001, + CSTATE_ALREADY_SEARCH_ASSIST = 0x0002, + CSTATE_REGEN_HEALTH = 0x0004, + CSTATE_REGEN_MANA = 0x0008, + CSTATE_INIT_AI_ON_RESPAWN = 0x0010, + CSTATE_COMBAT = 0x0020, + CSTATE_COMBAT_WITH_ZONE = 0x0040, + CSTATE_ESCORTABLE = 0x0080, + CSTATE_DESPAWNING = 0x0100, +}; + +// Vendors +struct VendorItem +{ + VendorItem(uint32 _item, uint32 _maxcount, uint32 _incrtime, uint32 _itemflags, uint32 _conditionId) + : item(_item), maxcount(_maxcount), incrtime(_incrtime), itemflags(_itemflags), conditionId(_conditionId) {} + + uint32 item; + uint32 maxcount; // 0 for infinity item amount + uint32 incrtime; // time for restore items amount if maxcount != 0 + uint32 itemflags; + uint32 conditionId; // condition to check for this item +}; +typedef std::vector VendorItemList; + +struct VendorItemData +{ + VendorItemList m_items; + + VendorItem* GetItem(uint32 slot) const + { + if (slot>=m_items.size()) return nullptr; + return m_items[slot]; + } + bool Empty() const { return m_items.empty(); } + uint8 GetItemCount() const { return m_items.size(); } + void AddItem(uint32 item, uint32 maxcount, uint32 ptime, uint32 itemflags, uint32 conditonId) + { + m_items.push_back(new VendorItem(item, maxcount, ptime, itemflags, conditonId)); + } + bool RemoveItem(uint32 item_id); + VendorItem const* FindItem(uint32 item_id) const; + size_t FindItemSlot(uint32 item_id) const; + + void Clear() + { + for (const auto& item : m_items) + delete item; + m_items.clear(); + } +}; + +struct VendorItemCount +{ + explicit VendorItemCount(uint32 _item, uint32 _count, uint32 _restockDelay) + : itemId(_item), count(_count), restockDelay(_restockDelay), lastIncrementTime(time(nullptr)) {} + + uint32 itemId; + uint32 count; + uint32 restockDelay; + time_t lastIncrementTime; +}; + +enum VendorItemFlags +{ + VENDOR_ITEM_FLAG_RANDOM_RESTOCK = 0x01, + VENDOR_ITEM_FLAG_DYNAMIC_RESTOCK = 0x02, +}; + +typedef std::list VendorItemCounts; + +struct TrainerSpell +{ + TrainerSpell() : spell(0), spellCost(0), reqSkill(0), reqSkillValue(0), reqLevel(0) {} + + TrainerSpell(uint32 _spell, uint32 _spellCost, uint32 _reqSkill, uint32 _reqSkillValue, uint32 _reqLevel) + : spell(_spell), spellCost(_spellCost), reqSkill(_reqSkill), reqSkillValue(_reqSkillValue), reqLevel(_reqLevel) + {} + + uint32 spell; + uint32 spellCost; + uint32 reqSkill; + uint32 reqSkillValue; + uint32 reqLevel; +}; + +typedef std::unordered_map TrainerSpellMap; + +struct TrainerSpellData +{ + TrainerSpellData() : trainerType(0) {} + + 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; + void Clear() { spellList.clear(); } +}; + +// max different by z coordinate for creature aggro reaction +#define CREATURE_Z_ATTACK_RANGE 3 + +#define MAX_VENDOR_ITEMS 255 // Limitation in item count field size in SMSG_LIST_INVENTORY + +enum VirtualItemSlot +{ + VIRTUAL_ITEM_SLOT_0 = 0, + VIRTUAL_ITEM_SLOT_1 = 1, + VIRTUAL_ITEM_SLOT_2 = 2, +}; + +#define MAX_VIRTUAL_ITEM_SLOT 3 + +enum VirtualItemInfoByteOffset +{ + VIRTUAL_ITEM_INFO_0_OFFSET_CLASS = 0, + VIRTUAL_ITEM_INFO_0_OFFSET_SUBCLASS = 1, + VIRTUAL_ITEM_INFO_0_OFFSET_MATERIAL = 2, + VIRTUAL_ITEM_INFO_0_OFFSET_INVENTORYTYPE = 3, + + VIRTUAL_ITEM_INFO_1_OFFSET_SHEATH = 0, +}; + +enum CreatureSubtype +{ + CREATURE_SUBTYPE_GENERIC, // new Creature + CREATURE_SUBTYPE_PET, // new Pet + CREATURE_SUBTYPE_TOTEM, // new Totem + CREATURE_SUBTYPE_TEMPORARY_SUMMON, // new TemporarySummon +}; + +enum TemporaryFactionFlags // Used at real faction changes +{ + TEMPFACTION_NONE = 0x00, // When no flag is used in temporary faction change, faction will be persistent. It will then require manual change back to default/another faction when changed once + TEMPFACTION_RESTORE_RESPAWN = 0x01, // Default faction will be restored at respawn + TEMPFACTION_RESTORE_COMBAT_STOP = 0x02, // ... at CombatStop() (happens at creature death, at evade or custom scripte among others) + TEMPFACTION_RESTORE_REACH_HOME = 0x04, // ... at reaching home in home movement (evade), if not already done at CombatStop() + TEMPFACTION_ALL, +}; + +#endif diff --git a/src/game/Objects/DynamicObject.cpp b/src/game/Objects/DynamicObject.cpp index 9aff684f3..aa6941c49 100644 --- a/src/game/Objects/DynamicObject.cpp +++ b/src/game/Objects/DynamicObject.cpp @@ -20,11 +20,8 @@ */ #include "Common.h" -#include "UpdateMask.h" -#include "Opcodes.h" #include "World.h" #include "ObjectAccessor.h" -#include "Database/DatabaseEnv.h" #include "GridNotifiers.h" #include "CellImpl.h" #include "GridNotifiersImpl.h" diff --git a/src/game/Objects/GameObject.cpp b/src/game/Objects/GameObject.cpp index 0d528f06c..19941026b 100644 --- a/src/game/Objects/GameObject.cpp +++ b/src/game/Objects/GameObject.cpp @@ -25,7 +25,7 @@ #include "PoolManager.h" #include "SpellMgr.h" #include "Spell.h" -#include "UpdateMask.h" +#include "Group.h" #include "Opcodes.h" #include "WorldPacket.h" #include "World.h" @@ -34,13 +34,11 @@ #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" -#include "InstanceData.h" #include "MapManager.h" #include "MapPersistentStateMgr.h" #include "BattleGround.h" #include "BattleGroundAV.h" #include "Util.h" - #include "GameObjectAI.h" #include "ScriptMgr.h" #include "ZoneScript.h" diff --git a/src/game/Objects/GameObject.h b/src/game/Objects/GameObject.h index d7bf17670..cf66949f8 100644 --- a/src/game/Objects/GameObject.h +++ b/src/game/Objects/GameObject.h @@ -24,637 +24,11 @@ #include "Common.h" #include "SharedDefines.h" +#include "GameObjectDefines.h" #include "Object.h" #include "LootMgr.h" -#include "Database/DatabaseEnv.h" #include "Util.h" -// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform -#if defined(__GNUC__) -#pragma pack(1) -#else -#pragma pack(push,1) -#endif - -// from `gameobject_template` -struct GameObjectInfo -{ - uint32 id; - uint32 type; - uint32 displayId; - char * name; - uint32 faction; - uint32 flags; - float size; - union // different GO types have different data field - { - //0 GAMEOBJECT_TYPE_DOOR - struct - { - uint32 startOpen; //0 used client side to determine GO_ACTIVATED means open/closed - uint32 lockId; //1 -> Lock.dbc - uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000 - uint32 noDamageImmune; //3 break opening whenever you recieve damage? - uint32 openTextID; //4 can be used to replace castBarCaption? - uint32 closeTextID; //5 - } door; - //1 GAMEOBJECT_TYPE_BUTTON - struct - { - uint32 startOpen; //0 - uint32 lockId; //1 -> Lock.dbc - uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000 - uint32 linkedTrapId; //3 - uint32 noDamageImmune; //4 isBattlegroundObject - uint32 large; //5 - uint32 openTextID; //6 can be used to replace castBarCaption? - uint32 closeTextID; //7 - uint32 losOK; //8 - } button; - //2 GAMEOBJECT_TYPE_QUESTGIVER - struct - { - uint32 lockId; //0 -> Lock.dbc - uint32 questList; //1 - uint32 pageMaterial; //2 - uint32 gossipID; //3 - uint32 customAnim; //4 - uint32 noDamageImmune; //5 - uint32 openTextID; //6 can be used to replace castBarCaption? - uint32 losOK; //7 - uint32 allowMounted; //8 - uint32 large; //9 - } questgiver; - //3 GAMEOBJECT_TYPE_CHEST - struct - { - uint32 lockId; //0 -> Lock.dbc - uint32 lootId; //1 - uint32 chestRestockTime; //2 - uint32 consumable; //3 - uint32 minSuccessOpens; //4 - uint32 maxSuccessOpens; //5 - uint32 eventId; //6 lootedEvent - uint32 linkedTrapId; //7 - uint32 questId; //8 not used currently but store quest required for GO activation for player - uint32 level; //9 - uint32 losOK; //10 - uint32 leaveLoot; //11 - uint32 notInCombat; //12 - uint32 logLoot; //13 - uint32 openTextID; //14 can be used to replace castBarCaption? - uint32 groupLootRules; //15 - } chest; - //4 GAMEOBJECT_TYPE_BINDER - empty - //5 GAMEOBJECT_TYPE_GENERIC - struct - { - uint32 floatingTooltip; //0 - uint32 highlight; //1 - uint32 serverOnly; //2 - uint32 large; //3 - uint32 floatOnWater; //4 - uint32 questID; //5 - } _generic; - //6 GAMEOBJECT_TYPE_TRAP - struct - { - uint32 lockId; //0 -> Lock.dbc - uint32 level; //1 - uint32 radius; //2 radius for trap activation - uint32 spellId; //3 - uint32 charges; //4 need respawn (if > 0) - uint32 cooldown; //5 time in secs - int32 autoCloseTime; //6 - uint32 startDelay; //7 - uint32 serverOnly; //8 - uint32 stealthed; //9 - uint32 large; //10 - uint32 stealthAffected; //11 - uint32 openTextID; //12 can be used to replace castBarCaption? - uint32 closeTextID; //13 - } trap; - //7 GAMEOBJECT_TYPE_CHAIR - struct - { - uint32 slots; //0 - uint32 height; //1 - uint32 onlyCreatorUse; //2 - } chair; - //8 GAMEOBJECT_TYPE_SPELL_FOCUS - struct - { - uint32 focusId; //0 - uint32 dist; //1 - uint32 linkedTrapId; //2 - uint32 serverOnly; //3 - uint32 questID; //4 - uint32 large; //5 - } spellFocus; - //9 GAMEOBJECT_TYPE_TEXT - struct - { - uint32 pageID; //0 - uint32 language; //1 - uint32 pageMaterial; //2 - uint32 allowMounted; //3 - } text; - //10 GAMEOBJECT_TYPE_GOOBER - struct - { - uint32 lockId; //0 -> Lock.dbc - int32 questId; //1 - uint32 eventId; //2 - uint32 autoCloseTime; //3 - uint32 customAnim; //4 - uint32 consumable; //5 - int32 cooldown; //6 - uint32 pageId; //7 - uint32 language; //8 - uint32 pageMaterial; //9 - uint32 spellId; //10 - uint32 noDamageImmune; //11 - uint32 linkedTrapId; //12 - uint32 large; //13 - uint32 openTextID; //14 can be used to replace castBarCaption? - uint32 closeTextID; //15 - uint32 losOK; //16 isBattlegroundObject - uint32 allowMounted; //17 - uint32 floatingTooltip; //18 - uint32 gossipID; //19 - } goober; - //11 GAMEOBJECT_TYPE_TRANSPORT - struct - { - uint32 pause; //0 - uint32 startOpen; //1 - uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000 - } transport; - //12 GAMEOBJECT_TYPE_AREADAMAGE - struct - { - uint32 lockId; //0 - uint32 radius; //1 - uint32 damageMin; //2 - uint32 damageMax; //3 - uint32 damageSchool; //4 - uint32 autoCloseTime; //5 secs till autoclose = autoCloseTime / 0x10000 - uint32 openTextID; //6 - uint32 closeTextID; //7 - } areadamage; - //13 GAMEOBJECT_TYPE_CAMERA - struct - { - uint32 lockId; //0 -> Lock.dbc - uint32 cinematicId; //1 - uint32 eventID; //2 - uint32 openTextID; //3 can be used to replace castBarCaption? - } camera; - //14 GAMEOBJECT_TYPE_MAPOBJECT - empty - //15 GAMEOBJECT_TYPE_MO_TRANSPORT - struct - { - uint32 taxiPathId; //0 - uint32 moveSpeed; //1 - uint32 accelRate; //2 - uint32 startEventID; //3 - uint32 stopEventID; //4 - uint32 transportPhysics; //5 - uint32 mapID; //6 - } moTransport; - //16 GAMEOBJECT_TYPE_DUELFLAG - empty - //17 GAMEOBJECT_TYPE_FISHINGNODE - struct - { - uint32 _data0; //0 - uint32 lootId; //1 - } fishnode; - //18 GAMEOBJECT_TYPE_SUMMONING_RITUAL - struct - { - uint32 reqParticipants; //0 - uint32 spellId; //1 - uint32 animSpell; //2 - uint32 ritualPersistent; //3 - uint32 casterTargetSpell; //4 - uint32 casterTargetSpellTargets; //5 - uint32 castersGrouped; //6 - uint32 ritualNoTargetCheck; //7 - } summoningRitual; - //19 GAMEOBJECT_TYPE_MAILBOX - empty - //20 GAMEOBJECT_TYPE_AUCTIONHOUSE - struct - { - uint32 auctionHouseID; //0 - } auctionhouse; - //21 GAMEOBJECT_TYPE_GUARDPOST - struct - { - uint32 creatureID; //0 - uint32 charges; //1 - } guardpost; - //22 GAMEOBJECT_TYPE_SPELLCASTER - struct - { - uint32 spellId; //0 - uint32 charges; //1 - uint32 partyOnly; //2 - uint32 allowMounted; //3 Is usable while on mount/vehicle. (0/1) - uint32 large; //4 - uint32 conditionID1; //5 - } spellcaster; - //23 GAMEOBJECT_TYPE_MEETINGSTONE - struct - { - uint32 minLevel; //0 - uint32 maxLevel; //1 - uint32 areaID; //2 - } meetingstone; - //24 GAMEOBJECT_TYPE_FLAGSTAND - struct - { - uint32 lockId; //0 - uint32 pickupSpell; //1 - uint32 radius; //2 - uint32 returnAura; //3 - uint32 returnSpell; //4 - uint32 noDamageImmune; //5 - uint32 openTextID; //6 - uint32 losOK; //7 - } flagstand; - //25 GAMEOBJECT_TYPE_FISHINGHOLE - struct - { - uint32 radius; //0 how close bobber must land for sending loot - uint32 lootId; //1 - uint32 minSuccessOpens; //2 - uint32 maxSuccessOpens; //3 - uint32 lockId; //4 -> Lock.dbc; possibly 1628 for all? - } fishinghole; -#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1 - //26 GAMEOBJECT_TYPE_FLAGDROP - struct - { - uint32 lockId; //0 - uint32 eventID; //1 - uint32 pickupSpell; //2 - uint32 noDamageImmune; //3 - uint32 openTextID; //4 - } flagdrop; -#endif -#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_9_4 - //27 GAMEOBJECT_TYPE_MINI_GAME - struct - { - uint32 gameType; //0 - } miniGame; -#endif -#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_11_2 - //29 GAMEOBJECT_TYPE_CAPTURE_POINT - struct - { - uint32 radius; //0 - uint32 spell; //1 - uint32 worldState1; //2 - uint32 worldstate2; //3 - uint32 winEventID1; //4 - uint32 winEventID2; //5 - uint32 contestedEventID1; //6 - uint32 contestedEventID2; //7 - uint32 progressEventID1; //8 - uint32 progressEventID2; //9 - uint32 neutralEventID1; //10 - uint32 neutralEventID2; //11 - uint32 neutralPercent; //12 - uint32 worldstate3; //13 - uint32 minSuperiority; //14 - uint32 maxSuperiority; //15 - uint32 minTime; //16 - uint32 maxTime; //17 - uint32 large; //18 - uint32 highlight; //19 - } capturePoint; - //30 GAMEOBJECT_TYPE_AURA_GENERATOR - struct - { - uint32 startOpen; //0 - uint32 radius; //1 - uint32 auraID1; //2 - uint32 conditionID1; //3 - uint32 auraID2; //4 - uint32 conditionID2; //5 - uint32 serverOnly; //6 - } auraGenerator; -#endif - // not use for specific field access (only for output with loop by all filed), also this determinate max union size - struct - { - uint32 data[24]; - } raw; - }; - - uint32 MinMoneyLoot; - uint32 MaxMoneyLoot; - uint32 ScriptId; - - // helpers - bool IsDespawnAtAction() const - { - switch(type) - { - case GAMEOBJECT_TYPE_CHEST: return chest.consumable; - case GAMEOBJECT_TYPE_GOOBER: return goober.consumable; - default: return false; - } - } - - bool IsUsableMounted() const - { - switch (type) - { - case GAMEOBJECT_TYPE_MAILBOX: return true; - 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; - default: return false; - } - } - - uint32 GetLockId() const - { - switch(type) - { - case GAMEOBJECT_TYPE_DOOR: return door.lockId; - case GAMEOBJECT_TYPE_BUTTON: return button.lockId; - case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.lockId; - case GAMEOBJECT_TYPE_CHEST: return chest.lockId; - case GAMEOBJECT_TYPE_TRAP: return trap.lockId; - case GAMEOBJECT_TYPE_GOOBER: return goober.lockId; - case GAMEOBJECT_TYPE_AREADAMAGE: return areadamage.lockId; - case GAMEOBJECT_TYPE_CAMERA: return camera.lockId; - case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.lockId; - case GAMEOBJECT_TYPE_FISHINGHOLE:return fishinghole.lockId; -#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1 - case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.lockId; -#endif - default: return 0; - } - } - - bool GetDespawnPossibility() const // despawn at targeting of cast? - { - switch(type) - { - case GAMEOBJECT_TYPE_DOOR: return door.noDamageImmune; - case GAMEOBJECT_TYPE_BUTTON: return button.noDamageImmune; - case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.noDamageImmune; - case GAMEOBJECT_TYPE_GOOBER: return goober.noDamageImmune; - case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.noDamageImmune; -#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1 - case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.noDamageImmune; -#endif - default: return true; - } - } - - bool CannotBeUsedUnderImmunity() const // Cannot be used/activated/looted by players under immunity effects (example: Divine Shield) - { - 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_CHEST: return true; // All chests cannot be opened while immune on 3.3.5a - case GAMEOBJECT_TYPE_GOOBER: return goober.noDamageImmune != 0; - case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.noDamageImmune != 0; -#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1 - case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.noDamageImmune != 0; -#endif - default: return false; - } - } - - 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 GetCooldown() const // not triggering at detection target or use until coolodwn expire - { - switch(type) - { - case GAMEOBJECT_TYPE_TRAP: return trap.cooldown; - case GAMEOBJECT_TYPE_GOOBER: return goober.cooldown; - default: return 0; - } - } - - uint32 GetLinkedGameObjectEntry() const - { - switch(type) - { - case GAMEOBJECT_TYPE_BUTTON: return button.linkedTrapId; - case GAMEOBJECT_TYPE_CHEST: return chest.linkedTrapId; - case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.linkedTrapId; - case GAMEOBJECT_TYPE_GOOBER: return goober.linkedTrapId; - default: return 0; - } - } - - uint32 GetAutoCloseTime() const - { - uint32 autoCloseTime = 0; - switch(type) - { - case GAMEOBJECT_TYPE_DOOR: autoCloseTime = door.autoCloseTime; break; - case GAMEOBJECT_TYPE_BUTTON: autoCloseTime = button.autoCloseTime; break; - case GAMEOBJECT_TYPE_TRAP: autoCloseTime = trap.autoCloseTime; break; - case GAMEOBJECT_TYPE_GOOBER: autoCloseTime = goober.autoCloseTime; break; - case GAMEOBJECT_TYPE_TRANSPORT: autoCloseTime = transport.autoCloseTime; break; - case GAMEOBJECT_TYPE_AREADAMAGE: autoCloseTime = areadamage.autoCloseTime; break; - default: break; - } - return autoCloseTime / 0x10000; - } - - uint32 GetLootId() const - { - switch(type) - { - case GAMEOBJECT_TYPE_CHEST: return chest.lootId; - case GAMEOBJECT_TYPE_FISHINGHOLE: return fishinghole.lootId; - 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; - } - } - - bool IsLargeGameObject() const - { - switch (type) - { - case GAMEOBJECT_TYPE_BUTTON: return button.large != 0; - case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.large != 0; - case GAMEOBJECT_TYPE_GENERIC: return _generic.large != 0; - case GAMEOBJECT_TYPE_TRAP: return trap.large != 0; - case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.large != 0; - case GAMEOBJECT_TYPE_GOOBER: return goober.large != 0; - case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.large != 0; -#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_11_2 - case GAMEOBJECT_TYPE_CAPTURE_POINT: return capturePoint.large != 0; -#endif - default: return false; - } - } - - bool IsInfiniteGameObject() const - { - switch (type) - { - case GAMEOBJECT_TYPE_DOOR: return true; - case GAMEOBJECT_TYPE_FLAGSTAND: return true; -#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1 - case GAMEOBJECT_TYPE_FLAGDROP: return true; -#endif - default: return false; - } - } - - bool IsServerOnly() const - { - switch (type) - { - case GAMEOBJECT_TYPE_GENERIC: return _generic.serverOnly; - case GAMEOBJECT_TYPE_TRAP: return trap.serverOnly; - case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.serverOnly; -#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_11_2 - case GAMEOBJECT_TYPE_AURA_GENERATOR: return auraGenerator.serverOnly; -#endif - default: return false; - } - } - - float GetInteractionDistance() const - { - switch (type) - { - // TODO: find out how the client calculates the maximal usage distance to spellless working - // gameobjects like mailboxes - 10.0 is a just an abitrary chosen number - case GAMEOBJECT_TYPE_MAILBOX: - return 10.0f; - case GAMEOBJECT_TYPE_FISHINGHOLE: - case GAMEOBJECT_TYPE_FISHINGNODE: - return 20.0f + CONTACT_DISTANCE; // max spell range; - } - - return INTERACTION_DISTANCE; - } - - uint32 GetEventScriptId() const - { - switch(type) - { - case GAMEOBJECT_TYPE_GOOBER: return goober.eventId; - case GAMEOBJECT_TYPE_CHEST: return chest.eventId; - case GAMEOBJECT_TYPE_CAMERA: return camera.eventID; - default: return 0; - } - } -}; - -// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform -#if defined(__GNUC__) -#pragma pack() -#else -#pragma pack(pop) -#endif - -struct GameObjectLocale -{ - std::vector Name; -}; - -// client side GO show states -enum GOState -{ - GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open) - GO_STATE_READY = 1, // show in world as ready (closed door close) - GO_STATE_ACTIVE_ALTERNATIVE = 2 // show in world as used in alt way and not reset (closed door open by cannon fire) -}; - -#define MAX_GO_STATE 3 - -// from `gameobject` -struct GameObjectData -{ - uint32 id; // entry in gamobject_template - WorldLocation position; - float rotation0; - float rotation1; - float rotation2; - float rotation3; - int32 spawntimesecsmin; - int32 spawntimesecsmax; - uint32 animprogress; - GOState go_state; - uint32 spawn_flags; - float visibility_mod; - - uint32 instanciatedContinentInstanceId; - uint32 ComputeRespawnDelay(uint32 baseDelay) const; - uint32 GetRandomRespawnTime() const { return urand(uint32(spawntimesecsmin), uint32(spawntimesecsmax)); } -}; - -struct GameObjectDisplayInfoAddon -{ - uint32 display_id; - float min_x; - float min_y; - float min_z; - float max_x; - float max_y; - float max_z; -}; - -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; - void toEulerAnglesZYX(float& Z, float& Y, float& X) const; - static QuaternionData fromEulerAnglesZYX(float Z, float Y, float X); -}; - -// 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-> -// For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ... -// For door(open): [GO_NOT_READY]->GO_READY (open) ->GO_ACTIVATED (close)->GO_JUST_DEACTIVATED->GO_READY(open) -> ... -enum LootState -{ - GO_NOT_READY = 0, - GO_READY, // can be ready but despawned, and then not possible activate until spawn - GO_ACTIVATED, - GO_JUST_DEACTIVATED -}; - class Unit; class GameObjectAI; class GameObjectModel; @@ -662,11 +36,6 @@ class Transport; struct GameObjectDisplayInfoEntry; -// 5 sec for bobber catch -#define FISHING_BOBBER_READY_TIME 5 - -#define GO_ANIMPROGRESS_DEFAULT 100 // in 3.x 0xFF - class GameObject : public WorldObject { public: diff --git a/src/game/Objects/GameObjectDefines.h b/src/game/Objects/GameObjectDefines.h new file mode 100644 index 000000000..fc2523d97 --- /dev/null +++ b/src/game/Objects/GameObjectDefines.h @@ -0,0 +1,767 @@ +/* + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __GAMEOBJECT_DEFINES_H +#define __GAMEOBJECT_DEFINES_H + +#include "Common.h" +#include "SharedDefines.h" +#include "ObjectDefines.h" +#include "Util.h" + +enum GameobjectTypes +{ + GAMEOBJECT_TYPE_DOOR = 0, + GAMEOBJECT_TYPE_BUTTON = 1, + GAMEOBJECT_TYPE_QUESTGIVER = 2, + GAMEOBJECT_TYPE_CHEST = 3, + GAMEOBJECT_TYPE_BINDER = 4, + GAMEOBJECT_TYPE_GENERIC = 5, + GAMEOBJECT_TYPE_TRAP = 6, + GAMEOBJECT_TYPE_CHAIR = 7, + GAMEOBJECT_TYPE_SPELL_FOCUS = 8, + GAMEOBJECT_TYPE_TEXT = 9, + GAMEOBJECT_TYPE_GOOBER = 10, + GAMEOBJECT_TYPE_TRANSPORT = 11, + GAMEOBJECT_TYPE_AREADAMAGE = 12, + GAMEOBJECT_TYPE_CAMERA = 13, + GAMEOBJECT_TYPE_MAP_OBJECT = 14, + GAMEOBJECT_TYPE_MO_TRANSPORT = 15, + GAMEOBJECT_TYPE_DUEL_ARBITER = 16, + GAMEOBJECT_TYPE_FISHINGNODE = 17, + GAMEOBJECT_TYPE_SUMMONING_RITUAL = 18, + GAMEOBJECT_TYPE_MAILBOX = 19, + GAMEOBJECT_TYPE_AUCTIONHOUSE = 20, + GAMEOBJECT_TYPE_GUARDPOST = 21, + GAMEOBJECT_TYPE_SPELLCASTER = 22, + GAMEOBJECT_TYPE_MEETINGSTONE = 23, + GAMEOBJECT_TYPE_FLAGSTAND = 24, + GAMEOBJECT_TYPE_FISHINGHOLE = 25, +#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1 + GAMEOBJECT_TYPE_FLAGDROP = 26, +#endif +#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_9_4 + GAMEOBJECT_TYPE_MINI_GAME = 27, + GAMEOBJECT_TYPE_LOTTERY_KIOSK = 28, +#endif +#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_11_2 + GAMEOBJECT_TYPE_CAPTURE_POINT = 29, + GAMEOBJECT_TYPE_AURA_GENERATOR = 30, +#endif + GAMEOBJECT_TYPE_MAX +}; + +#define MAX_GAMEOBJECT_TYPE 31 // sending to client this or greater value can crash client. + +enum GameObjectFlags +{ + GO_FLAG_IN_USE = 0x00000001, //disables interaction while animated + GO_FLAG_LOCKED = 0x00000002, //require key, spell, event, etc to be opened. Makes "Locked" appear in tooltip + GO_FLAG_INTERACT_COND = 0x00000004, //cannot interact (condition to interact) + GO_FLAG_TRANSPORT = 0x00000008, //any kind of transport? Object can transport (elevator, boat, car) + GO_FLAG_NO_INTERACT = 0x00000010, //players cannot interact with this go (often need to remove flag in event) + GO_FLAG_NODESPAWN = 0x00000020, //never despawn, typically for doors, they just change state + GO_FLAG_TRIGGERED = 0x00000040 //typically, summoned objects. Triggered by spell or other events +}; + +enum GameObjectDynamicLowFlags +{ + GO_DYNFLAG_LO_ACTIVATE = 0x01, // enables interaction with GO + GO_DYNFLAG_LO_ANIMATE = 0x02, // possibly more distinct animation of GO + GO_DYNFLAG_LO_NO_INTERACT = 0x04, // appears to disable interaction (not fully verified) +}; + +enum class GameObjectActions : uint32 +{ // Name from client executable // Comments + None, // -NONE- + AnimateCustom0, // Animate Custom0 + AnimateCustom1, // Animate Custom1 + AnimateCustom2, // Animate Custom2 + AnimateCustom3, // Animate Custom3 + Disturb, // Disturb // Triggers trap + Unlock, // Unlock // Resets GO_FLAG_LOCKED + Lock, // Lock // Sets GO_FLAG_LOCKED + Open, // Open // Sets GO_STATE_ACTIVE + OpenAndUnlock, // Open + Unlock // Sets GO_STATE_ACTIVE and resets GO_FLAG_LOCKED + Close, // Close // Sets GO_STATE_READY + ToggleOpen, // Toggle Open + Destroy, // Destroy // Sets GO_STATE_DESTROYED + Rebuild, // Rebuild // Resets from GO_STATE_DESTROYED + Creation, // Creation + Despawn, // Despawn + MakeInert, // Make Inert // Disables interactions + MakeActive, // Make Active // Enables interactions + CloseAndLock, // Close + Lock // Sets GO_STATE_READY and sets GO_FLAG_LOCKED + UseArtKit0, // Use ArtKit0 // 46904: 121 + UseArtKit1, // Use ArtKit1 // 36639: 81, 46903: 122 + UseArtKit2, // Use ArtKit2 + UseArtKit3, // Use ArtKit3 + SetTapList, // Set Tap List + GoTo1stFloor, // Go to 1st floor + GoTo2ndFloor, // Go to 2nd floor + GoTo3rdFloor, // Go to 3rd floor + GoTo4thFloor, // Go to 4th floor + GoTo5thFloor, // Go to 5th floor + GoTo6thFloor, // Go to 6th floor + GoTo7thFloor, // Go to 7th floor + GoTo8thFloor, // Go to 8th floor + GoTo9thFloor, // Go to 9th floor + GoTo10thFloor, // Go to 10th floor + UseArtKit4, // Use ArtKit4 + PlayAnimKit, // Play Anim Kit "%s" // MiscValueB -> Anim Kit ID + OpenAndPlayAnimKit, // Open + Play Anim Kit "%s" // MiscValueB -> Anim Kit ID + CloseAndPlayAnimKit, // Close + Play Anim Kit "%s" // MiscValueB -> Anim Kit ID + PlayOneshotAnimKit, // Play One-shot Anim Kit "%s" // MiscValueB -> Anim Kit ID + StopAnimKit, // Stop Anim Kit + OpenAndStopAnimKit, // Open + Stop Anim Kit + CloseAndStopAnimKit, // Close + Stop Anim Kit + PlaySpellVisual, // Play Spell Visual "%s" // MiscValueB -> Spell Visual ID + StopSpellVisual, // Stop Spell Visual + SetTappedToChallengePlayers, // Set Tapped to Challenge Players +}; + +// client side GO show states +enum GOState +{ + GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open) + GO_STATE_READY = 1, // show in world as ready (closed door close) + GO_STATE_ACTIVE_ALTERNATIVE = 2 // show in world as used in alt way and not reset (closed door open by cannon fire) +}; + +#define MAX_GO_STATE 3 + +// 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-> +// For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ... +// For door(open): [GO_NOT_READY]->GO_READY (open) ->GO_ACTIVATED (close)->GO_JUST_DEACTIVATED->GO_READY(open) -> ... +enum LootState +{ + GO_NOT_READY = 0, + GO_READY, // can be ready but despawned, and then not possible activate until spawn + GO_ACTIVATED, + GO_JUST_DEACTIVATED +}; + +// 5 sec for bobber catch +#define FISHING_BOBBER_READY_TIME 5 + +#define GO_ANIMPROGRESS_DEFAULT 100 // in 3.x 0xFF + +// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform +#if defined(__GNUC__) +#pragma pack(1) +#else +#pragma pack(push,1) +#endif + +// from `gameobject_template` +struct GameObjectInfo +{ + uint32 id; + uint32 type; + uint32 displayId; + char * name; + uint32 faction; + uint32 flags; + float size; + union // different GO types have different data field + { + //0 GAMEOBJECT_TYPE_DOOR + struct + { + uint32 startOpen; //0 used client side to determine GO_ACTIVATED means open/closed + uint32 lockId; //1 -> Lock.dbc + uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000 + uint32 noDamageImmune; //3 break opening whenever you recieve damage? + uint32 openTextID; //4 can be used to replace castBarCaption? + uint32 closeTextID; //5 + } door; + //1 GAMEOBJECT_TYPE_BUTTON + struct + { + uint32 startOpen; //0 + uint32 lockId; //1 -> Lock.dbc + uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000 + uint32 linkedTrapId; //3 + uint32 noDamageImmune; //4 isBattlegroundObject + uint32 large; //5 + uint32 openTextID; //6 can be used to replace castBarCaption? + uint32 closeTextID; //7 + uint32 losOK; //8 + } button; + //2 GAMEOBJECT_TYPE_QUESTGIVER + struct + { + uint32 lockId; //0 -> Lock.dbc + uint32 questList; //1 + uint32 pageMaterial; //2 + uint32 gossipID; //3 + uint32 customAnim; //4 + uint32 noDamageImmune; //5 + uint32 openTextID; //6 can be used to replace castBarCaption? + uint32 losOK; //7 + uint32 allowMounted; //8 + uint32 large; //9 + } questgiver; + //3 GAMEOBJECT_TYPE_CHEST + struct + { + uint32 lockId; //0 -> Lock.dbc + uint32 lootId; //1 + uint32 chestRestockTime; //2 + uint32 consumable; //3 + uint32 minSuccessOpens; //4 + uint32 maxSuccessOpens; //5 + uint32 eventId; //6 lootedEvent + uint32 linkedTrapId; //7 + uint32 questId; //8 not used currently but store quest required for GO activation for player + uint32 level; //9 + uint32 losOK; //10 + uint32 leaveLoot; //11 + uint32 notInCombat; //12 + uint32 logLoot; //13 + uint32 openTextID; //14 can be used to replace castBarCaption? + uint32 groupLootRules; //15 + } chest; + //4 GAMEOBJECT_TYPE_BINDER - empty + //5 GAMEOBJECT_TYPE_GENERIC + struct + { + uint32 floatingTooltip; //0 + uint32 highlight; //1 + uint32 serverOnly; //2 + uint32 large; //3 + uint32 floatOnWater; //4 + uint32 questID; //5 + } _generic; + //6 GAMEOBJECT_TYPE_TRAP + struct + { + uint32 lockId; //0 -> Lock.dbc + uint32 level; //1 + uint32 radius; //2 radius for trap activation + uint32 spellId; //3 + uint32 charges; //4 need respawn (if > 0) + uint32 cooldown; //5 time in secs + int32 autoCloseTime; //6 + uint32 startDelay; //7 + uint32 serverOnly; //8 + uint32 stealthed; //9 + uint32 large; //10 + uint32 stealthAffected; //11 + uint32 openTextID; //12 can be used to replace castBarCaption? + uint32 closeTextID; //13 + } trap; + //7 GAMEOBJECT_TYPE_CHAIR + struct + { + uint32 slots; //0 + uint32 height; //1 + uint32 onlyCreatorUse; //2 + } chair; + //8 GAMEOBJECT_TYPE_SPELL_FOCUS + struct + { + uint32 focusId; //0 + uint32 dist; //1 + uint32 linkedTrapId; //2 + uint32 serverOnly; //3 + uint32 questID; //4 + uint32 large; //5 + } spellFocus; + //9 GAMEOBJECT_TYPE_TEXT + struct + { + uint32 pageID; //0 + uint32 language; //1 + uint32 pageMaterial; //2 + uint32 allowMounted; //3 + } text; + //10 GAMEOBJECT_TYPE_GOOBER + struct + { + uint32 lockId; //0 -> Lock.dbc + int32 questId; //1 + uint32 eventId; //2 + uint32 autoCloseTime; //3 + uint32 customAnim; //4 + uint32 consumable; //5 + int32 cooldown; //6 + uint32 pageId; //7 + uint32 language; //8 + uint32 pageMaterial; //9 + uint32 spellId; //10 + uint32 noDamageImmune; //11 + uint32 linkedTrapId; //12 + uint32 large; //13 + uint32 openTextID; //14 can be used to replace castBarCaption? + uint32 closeTextID; //15 + uint32 losOK; //16 isBattlegroundObject + uint32 allowMounted; //17 + uint32 floatingTooltip; //18 + uint32 gossipID; //19 + } goober; + //11 GAMEOBJECT_TYPE_TRANSPORT + struct + { + uint32 pause; //0 + uint32 startOpen; //1 + uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000 + } transport; + //12 GAMEOBJECT_TYPE_AREADAMAGE + struct + { + uint32 lockId; //0 + uint32 radius; //1 + uint32 damageMin; //2 + uint32 damageMax; //3 + uint32 damageSchool; //4 + uint32 autoCloseTime; //5 secs till autoclose = autoCloseTime / 0x10000 + uint32 openTextID; //6 + uint32 closeTextID; //7 + } areadamage; + //13 GAMEOBJECT_TYPE_CAMERA + struct + { + uint32 lockId; //0 -> Lock.dbc + uint32 cinematicId; //1 + uint32 eventID; //2 + uint32 openTextID; //3 can be used to replace castBarCaption? + } camera; + //14 GAMEOBJECT_TYPE_MAPOBJECT - empty + //15 GAMEOBJECT_TYPE_MO_TRANSPORT + struct + { + uint32 taxiPathId; //0 + uint32 moveSpeed; //1 + uint32 accelRate; //2 + uint32 startEventID; //3 + uint32 stopEventID; //4 + uint32 transportPhysics; //5 + uint32 mapID; //6 + } moTransport; + //16 GAMEOBJECT_TYPE_DUELFLAG - empty + //17 GAMEOBJECT_TYPE_FISHINGNODE + struct + { + uint32 _data0; //0 + uint32 lootId; //1 + } fishnode; + //18 GAMEOBJECT_TYPE_SUMMONING_RITUAL + struct + { + uint32 reqParticipants; //0 + uint32 spellId; //1 + uint32 animSpell; //2 + uint32 ritualPersistent; //3 + uint32 casterTargetSpell; //4 + uint32 casterTargetSpellTargets; //5 + uint32 castersGrouped; //6 + uint32 ritualNoTargetCheck; //7 + } summoningRitual; + //19 GAMEOBJECT_TYPE_MAILBOX - empty + //20 GAMEOBJECT_TYPE_AUCTIONHOUSE + struct + { + uint32 auctionHouseID; //0 + } auctionhouse; + //21 GAMEOBJECT_TYPE_GUARDPOST + struct + { + uint32 creatureID; //0 + uint32 charges; //1 + } guardpost; + //22 GAMEOBJECT_TYPE_SPELLCASTER + struct + { + uint32 spellId; //0 + uint32 charges; //1 + uint32 partyOnly; //2 + uint32 allowMounted; //3 Is usable while on mount/vehicle. (0/1) + uint32 large; //4 + uint32 conditionID1; //5 + } spellcaster; + //23 GAMEOBJECT_TYPE_MEETINGSTONE + struct + { + uint32 minLevel; //0 + uint32 maxLevel; //1 + uint32 areaID; //2 + } meetingstone; + //24 GAMEOBJECT_TYPE_FLAGSTAND + struct + { + uint32 lockId; //0 + uint32 pickupSpell; //1 + uint32 radius; //2 + uint32 returnAura; //3 + uint32 returnSpell; //4 + uint32 noDamageImmune; //5 + uint32 openTextID; //6 + uint32 losOK; //7 + } flagstand; + //25 GAMEOBJECT_TYPE_FISHINGHOLE + struct + { + uint32 radius; //0 how close bobber must land for sending loot + uint32 lootId; //1 + uint32 minSuccessOpens; //2 + uint32 maxSuccessOpens; //3 + uint32 lockId; //4 -> Lock.dbc; possibly 1628 for all? + } fishinghole; +#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1 + //26 GAMEOBJECT_TYPE_FLAGDROP + struct + { + uint32 lockId; //0 + uint32 eventID; //1 + uint32 pickupSpell; //2 + uint32 noDamageImmune; //3 + uint32 openTextID; //4 + } flagdrop; +#endif +#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_9_4 + //27 GAMEOBJECT_TYPE_MINI_GAME + struct + { + uint32 gameType; //0 + } miniGame; +#endif +#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_11_2 + //29 GAMEOBJECT_TYPE_CAPTURE_POINT + struct + { + uint32 radius; //0 + uint32 spell; //1 + uint32 worldState1; //2 + uint32 worldstate2; //3 + uint32 winEventID1; //4 + uint32 winEventID2; //5 + uint32 contestedEventID1; //6 + uint32 contestedEventID2; //7 + uint32 progressEventID1; //8 + uint32 progressEventID2; //9 + uint32 neutralEventID1; //10 + uint32 neutralEventID2; //11 + uint32 neutralPercent; //12 + uint32 worldstate3; //13 + uint32 minSuperiority; //14 + uint32 maxSuperiority; //15 + uint32 minTime; //16 + uint32 maxTime; //17 + uint32 large; //18 + uint32 highlight; //19 + } capturePoint; + //30 GAMEOBJECT_TYPE_AURA_GENERATOR + struct + { + uint32 startOpen; //0 + uint32 radius; //1 + uint32 auraID1; //2 + uint32 conditionID1; //3 + uint32 auraID2; //4 + uint32 conditionID2; //5 + uint32 serverOnly; //6 + } auraGenerator; +#endif + // not use for specific field access (only for output with loop by all filed), also this determinate max union size + struct + { + uint32 data[24]; + } raw; + }; + + uint32 MinMoneyLoot; + uint32 MaxMoneyLoot; + uint32 ScriptId; + + // helpers + bool IsDespawnAtAction() const + { + switch(type) + { + case GAMEOBJECT_TYPE_CHEST: return chest.consumable; + case GAMEOBJECT_TYPE_GOOBER: return goober.consumable; + default: return false; + } + } + + bool IsUsableMounted() const + { + switch (type) + { + case GAMEOBJECT_TYPE_MAILBOX: return true; + 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; + default: return false; + } + } + + uint32 GetLockId() const + { + switch(type) + { + case GAMEOBJECT_TYPE_DOOR: return door.lockId; + case GAMEOBJECT_TYPE_BUTTON: return button.lockId; + case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.lockId; + case GAMEOBJECT_TYPE_CHEST: return chest.lockId; + case GAMEOBJECT_TYPE_TRAP: return trap.lockId; + case GAMEOBJECT_TYPE_GOOBER: return goober.lockId; + case GAMEOBJECT_TYPE_AREADAMAGE: return areadamage.lockId; + case GAMEOBJECT_TYPE_CAMERA: return camera.lockId; + case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.lockId; + case GAMEOBJECT_TYPE_FISHINGHOLE:return fishinghole.lockId; +#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1 + case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.lockId; +#endif + default: return 0; + } + } + + bool GetDespawnPossibility() const // despawn at targeting of cast? + { + switch(type) + { + case GAMEOBJECT_TYPE_DOOR: return door.noDamageImmune; + case GAMEOBJECT_TYPE_BUTTON: return button.noDamageImmune; + case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.noDamageImmune; + case GAMEOBJECT_TYPE_GOOBER: return goober.noDamageImmune; + case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.noDamageImmune; +#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1 + case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.noDamageImmune; +#endif + default: return true; + } + } + + bool CannotBeUsedUnderImmunity() const // Cannot be used/activated/looted by players under immunity effects (example: Divine Shield) + { + 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_CHEST: return true; // All chests cannot be opened while immune on 3.3.5a + case GAMEOBJECT_TYPE_GOOBER: return goober.noDamageImmune != 0; + case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.noDamageImmune != 0; +#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1 + case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.noDamageImmune != 0; +#endif + default: return false; + } + } + + 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 GetCooldown() const // not triggering at detection target or use until coolodwn expire + { + switch(type) + { + case GAMEOBJECT_TYPE_TRAP: return trap.cooldown; + case GAMEOBJECT_TYPE_GOOBER: return goober.cooldown; + default: return 0; + } + } + + uint32 GetLinkedGameObjectEntry() const + { + switch(type) + { + case GAMEOBJECT_TYPE_BUTTON: return button.linkedTrapId; + case GAMEOBJECT_TYPE_CHEST: return chest.linkedTrapId; + case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.linkedTrapId; + case GAMEOBJECT_TYPE_GOOBER: return goober.linkedTrapId; + default: return 0; + } + } + + uint32 GetAutoCloseTime() const + { + uint32 autoCloseTime = 0; + switch(type) + { + case GAMEOBJECT_TYPE_DOOR: autoCloseTime = door.autoCloseTime; break; + case GAMEOBJECT_TYPE_BUTTON: autoCloseTime = button.autoCloseTime; break; + case GAMEOBJECT_TYPE_TRAP: autoCloseTime = trap.autoCloseTime; break; + case GAMEOBJECT_TYPE_GOOBER: autoCloseTime = goober.autoCloseTime; break; + case GAMEOBJECT_TYPE_TRANSPORT: autoCloseTime = transport.autoCloseTime; break; + case GAMEOBJECT_TYPE_AREADAMAGE: autoCloseTime = areadamage.autoCloseTime; break; + default: break; + } + return autoCloseTime / 0x10000; + } + + uint32 GetLootId() const + { + switch(type) + { + case GAMEOBJECT_TYPE_CHEST: return chest.lootId; + case GAMEOBJECT_TYPE_FISHINGHOLE: return fishinghole.lootId; + 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; + } + } + + bool IsLargeGameObject() const + { + switch (type) + { + case GAMEOBJECT_TYPE_BUTTON: return button.large != 0; + case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.large != 0; + case GAMEOBJECT_TYPE_GENERIC: return _generic.large != 0; + case GAMEOBJECT_TYPE_TRAP: return trap.large != 0; + case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.large != 0; + case GAMEOBJECT_TYPE_GOOBER: return goober.large != 0; + case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.large != 0; +#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_11_2 + case GAMEOBJECT_TYPE_CAPTURE_POINT: return capturePoint.large != 0; +#endif + default: return false; + } + } + + bool IsInfiniteGameObject() const + { + switch (type) + { + case GAMEOBJECT_TYPE_DOOR: return true; + case GAMEOBJECT_TYPE_FLAGSTAND: return true; +#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1 + case GAMEOBJECT_TYPE_FLAGDROP: return true; +#endif + default: return false; + } + } + + bool IsServerOnly() const + { + switch (type) + { + case GAMEOBJECT_TYPE_GENERIC: return _generic.serverOnly; + case GAMEOBJECT_TYPE_TRAP: return trap.serverOnly; + case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.serverOnly; +#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_11_2 + case GAMEOBJECT_TYPE_AURA_GENERATOR: return auraGenerator.serverOnly; +#endif + default: return false; + } + } + + float GetInteractionDistance() const + { + switch (type) + { + // TODO: find out how the client calculates the maximal usage distance to spellless working + // gameobjects like mailboxes - 10.0 is a just an abitrary chosen number + case GAMEOBJECT_TYPE_MAILBOX: + return 10.0f; + case GAMEOBJECT_TYPE_FISHINGHOLE: + case GAMEOBJECT_TYPE_FISHINGNODE: + return 20.0f + CONTACT_DISTANCE; // max spell range; + } + + return INTERACTION_DISTANCE; + } + + uint32 GetEventScriptId() const + { + switch(type) + { + case GAMEOBJECT_TYPE_GOOBER: return goober.eventId; + case GAMEOBJECT_TYPE_CHEST: return chest.eventId; + case GAMEOBJECT_TYPE_CAMERA: return camera.eventID; + default: return 0; + } + } +}; + +// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform +#if defined(__GNUC__) +#pragma pack() +#else +#pragma pack(pop) +#endif + +struct GameObjectLocale +{ + std::vector Name; +}; + +// from `gameobject` +struct GameObjectData +{ + uint32 id; // entry in gamobject_template + WorldLocation position; + float rotation0; + float rotation1; + float rotation2; + float rotation3; + int32 spawntimesecsmin; + int32 spawntimesecsmax; + uint32 animprogress; + GOState go_state; + uint32 spawn_flags; + float visibility_mod; + + uint32 instanciatedContinentInstanceId; + uint32 ComputeRespawnDelay(uint32 baseDelay) const; + uint32 GetRandomRespawnTime() const { return urand(uint32(spawntimesecsmin), uint32(spawntimesecsmax)); } +}; + +struct GameObjectDisplayInfoAddon +{ + uint32 display_id; + float min_x; + float min_y; + float min_z; + float max_x; + float max_y; + float max_z; +}; + +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; + void toEulerAnglesZYX(float& Z, float& Y, float& X) const; + static QuaternionData fromEulerAnglesZYX(float Z, float Y, float X); +}; + +#endif diff --git a/src/game/Objects/Item.cpp b/src/game/Objects/Item.cpp index 9803f5819..906acc911 100644 --- a/src/game/Objects/Item.cpp +++ b/src/game/Objects/Item.cpp @@ -20,8 +20,10 @@ */ #include "Item.h" +#include "Bag.h" #include "ObjectMgr.h" #include "ObjectGuid.h" +#include "Opcodes.h" #include "WorldPacket.h" #include "Database/DatabaseEnv.h" #include "ItemEnchantmentMgr.h" diff --git a/src/game/Objects/Object.cpp b/src/game/Objects/Object.cpp index 282f82e25..80f73bebb 100644 --- a/src/game/Objects/Object.cpp +++ b/src/game/Objects/Object.cpp @@ -34,10 +34,8 @@ #include "UpdateMask.h" #include "Util.h" #include "MapManager.h" -#include "Log.h" #include "Transport.h" -#include "TargetedMovementGenerator.h" -#include "WaypointMovementGenerator.h" +#include "MotionMaster.h" #include "VMapFactory.h" #include "CellImpl.h" #include "GridNotifiers.h" @@ -45,12 +43,11 @@ #include "Language.h" #include "Geometry.h" #include "ObjectPosSelector.h" - +#include "MoveMapSharedDefines.h" #include "TemporarySummon.h" #include "ZoneScriptMgr.h" #include "InstanceData.h" #include "Chat.h" -#include "Anticheat.h" #include "packet_builder.h" #include "MovementBroadcaster.h" diff --git a/src/game/Objects/Object.h b/src/game/Objects/Object.h index 618a31d72..98ffe1140 100644 --- a/src/game/Objects/Object.h +++ b/src/game/Objects/Object.h @@ -27,12 +27,14 @@ #include "UpdateFields.h" #include "UpdateData.h" #include "ObjectGuid.h" -#include "Camera.h" #include "SharedDefines.h" +#include "ObjectDefines.h" #include "SpellDefines.h" #include "DBCEnums.h" #include "Utilities/EventProcessor.h" #include "Util.h" +#include "Timer.h" +#include "Camera.h" #include #include @@ -42,60 +44,13 @@ using namespace nonstd; -#define CONTACT_DISTANCE 0.5f -#define INTERACTION_DISTANCE 5.0f -#define ATTACK_DISTANCE 5.0f -#define INSPECT_DISTANCE 10.0f -#define TRADE_DISTANCE 11.11f - -#define MAX_VISIBILITY_DISTANCE SIZE_OF_GRIDS // max distance for visible object show, used to be 333 yards -#define DEFAULT_VISIBILITY_DISTANCE 100.0f // default visible distance on continents, used to be 90 yards -#define DEFAULT_VISIBILITY_INSTANCE 170.0f // default visible distance in instances, used to be 120 yards -#define DEFAULT_VISIBILITY_BG 533.0f // default visible distance in BG, used to be 180 yards -#define DEFAULT_VISIBILITY_MODIFIER 0.0f // default visibility modifier on some units that should be seen beyond normal visibility distances -#define DEFAULT_CREATURE_SUMMON_LIMIT 100 // default maximum number of creatures an object can have summoned at once - -#define VISIBILITY_DISTANCE_GIGANTIC 400.0f -#define VISIBILITY_DISTANCE_LARGE 200.0f -#define VISIBILITY_DISTANCE_NORMAL 100.0f -#define VISIBILITY_DISTANCE_SMALL 50.0f -#define VISIBILITY_DISTANCE_TINY 25.0f - -#define DEFAULT_WORLD_OBJECT_SIZE 0.388999998569489f // currently used (correctly?) for any non Unit world objects. This is actually the bounding_radius, like player/creature from creature_model_data -#define DEFAULT_OBJECT_SCALE 1.0f // player/item scale as default, npc/go from database, pets from dbc -#define DEFAULT_GNOME_SCALE 1.15f -#define DEFAULT_TAUREN_MALE_SCALE 1.35f // Tauren Male Player Scale by default -#define DEFAULT_TAUREN_FEMALE_SCALE 1.25f // Tauren Female Player Scale by default - -#define MAX_STEALTH_DETECT_RANGE 45.0f - -// TrinityCore -#define DEFAULT_COMBAT_REACH 1.5f -#define MIN_MELEE_REACH 2.0f -#define NOMINAL_MELEE_RANGE 5.0f -#define MELEE_RANGE (NOMINAL_MELEE_RANGE - MIN_MELEE_REACH * 2) - -#define LEEWAY_MIN_MOVE_SPEED 4.97f -#define LEEWAY_BONUS_RANGE 2.66f - -enum TempSummonType -{ - TEMPSUMMON_TIMED_OR_DEAD_DESPAWN = 1, // despawns after a specified time (out of combat) OR when the creature disappears - TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN = 2, // despawns after a specified time (out of combat) OR when the creature dies - TEMPSUMMON_TIMED_DESPAWN = 3, // despawns after a specified time - TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT = 4, // despawns after a specified time after the creature is out of combat - TEMPSUMMON_CORPSE_DESPAWN = 5, // despawns instantly after death - TEMPSUMMON_CORPSE_TIMED_DESPAWN = 6, // despawns after a specified time after death - TEMPSUMMON_DEAD_DESPAWN = 7, // despawns when the creature disappears - TEMPSUMMON_MANUAL_DESPAWN = 8, // despawns when UnSummon() is called - TEMPSUMMON_TIMED_COMBAT_OR_DEAD_DESPAWN = 9, // despawns after a specified time (in or out of combat) OR when the creature disappears - TEMPSUMMON_TIMED_COMBAT_OR_CORPSE_DESPAWN = 10, // despawns after a specified time (in or out of combat) OR when the creature dies -}; - class WorldPacket; class UpdateData; class WorldSession; +class DynamicObject; +class Corpse; class Creature; +class Pet; class Player; class Unit; class Map; @@ -142,19 +97,6 @@ class WorldUpdateCounter uint32 m_tmStart; }; - -enum ObjectSpawnFlags -{ - SPAWN_FLAG_ACTIVE = 0x01, - SPAWN_FLAG_DISABLED = 0x02, - SPAWN_FLAG_RANDOM_RESPAWN_TIME = 0x04, - SPAWN_FLAG_DYNAMIC_RESPAWN_TIME = 0x08, - SPAWN_FLAG_FORCE_DYNAMIC_ELITE = 0x10, // creature only - SPAWN_FLAG_EVADE_OUT_HOME_AREA = 0x20, // creature only - SPAWN_FLAG_NOT_VISIBLE = 0x40, // creature only - SPAWN_FLAG_DEAD = 0x80, // creature only -}; - // [-ZERO] Need check and update // used in most movement packets (send and received) enum MovementFlags diff --git a/src/game/Objects/ObjectDefines.h b/src/game/Objects/ObjectDefines.h new file mode 100644 index 000000000..86f55aeb2 --- /dev/null +++ b/src/game/Objects/ObjectDefines.h @@ -0,0 +1,99 @@ +/* + * 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, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __OBJECT_DEFINES_H +#define __OBJECT_DEFINES_H + +#include "Common.h" + + +#define CONTACT_DISTANCE 0.5f +#define INTERACTION_DISTANCE 5.0f +#define ATTACK_DISTANCE 5.0f +#define INSPECT_DISTANCE 10.0f +#define TRADE_DISTANCE 11.11f + +#define MAX_VISIBILITY_DISTANCE SIZE_OF_GRIDS // max distance for visible object show, used to be 333 yards +#define DEFAULT_VISIBILITY_DISTANCE 100.0f // default visible distance on continents, used to be 90 yards +#define DEFAULT_VISIBILITY_INSTANCE 170.0f // default visible distance in instances, used to be 120 yards +#define DEFAULT_VISIBILITY_BG 533.0f // default visible distance in BG, used to be 180 yards +#define DEFAULT_VISIBILITY_MODIFIER 0.0f // default visibility modifier on some units that should be seen beyond normal visibility distances +#define DEFAULT_CREATURE_SUMMON_LIMIT 100 // default maximum number of creatures an object can have summoned at once + +#define VISIBILITY_DISTANCE_GIGANTIC 400.0f +#define VISIBILITY_DISTANCE_LARGE 200.0f +#define VISIBILITY_DISTANCE_NORMAL 100.0f +#define VISIBILITY_DISTANCE_SMALL 50.0f +#define VISIBILITY_DISTANCE_TINY 25.0f + +#define DEFAULT_WORLD_OBJECT_SIZE 0.388999998569489f // currently used (correctly?) for any non Unit world objects. This is actually the bounding_radius, like player/creature from creature_model_data +#define DEFAULT_OBJECT_SCALE 1.0f // player/item scale as default, npc/go from database, pets from dbc +#define DEFAULT_GNOME_SCALE 1.15f +#define DEFAULT_TAUREN_MALE_SCALE 1.35f // Tauren Male Player Scale by default +#define DEFAULT_TAUREN_FEMALE_SCALE 1.25f // Tauren Female Player Scale by default + +#define MAX_STEALTH_DETECT_RANGE 45.0f + +// TrinityCore +#define DEFAULT_COMBAT_REACH 1.5f +#define MIN_MELEE_REACH 2.0f +#define NOMINAL_MELEE_RANGE 5.0f +#define MELEE_RANGE (NOMINAL_MELEE_RANGE - MIN_MELEE_REACH * 2) + +#define LEEWAY_MIN_MOVE_SPEED 4.97f +#define LEEWAY_BONUS_RANGE 2.66f + +enum TempSummonType +{ + TEMPSUMMON_TIMED_OR_DEAD_DESPAWN = 1, // despawns after a specified time (out of combat) OR when the creature disappears + TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN = 2, // despawns after a specified time (out of combat) OR when the creature dies + TEMPSUMMON_TIMED_DESPAWN = 3, // despawns after a specified time + TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT = 4, // despawns after a specified time after the creature is out of combat + TEMPSUMMON_CORPSE_DESPAWN = 5, // despawns instantly after death + TEMPSUMMON_CORPSE_TIMED_DESPAWN = 6, // despawns after a specified time after death + TEMPSUMMON_DEAD_DESPAWN = 7, // despawns when the creature disappears + TEMPSUMMON_MANUAL_DESPAWN = 8, // despawns when UnSummon() is called + TEMPSUMMON_TIMED_COMBAT_OR_DEAD_DESPAWN = 9, // despawns after a specified time (in or out of combat) OR when the creature disappears + TEMPSUMMON_TIMED_COMBAT_OR_CORPSE_DESPAWN = 10, // despawns after a specified time (in or out of combat) OR when the creature dies +}; + +enum ObjectSpawnFlags +{ + SPAWN_FLAG_ACTIVE = 0x01, + SPAWN_FLAG_DISABLED = 0x02, + SPAWN_FLAG_RANDOM_RESPAWN_TIME = 0x04, + SPAWN_FLAG_DYNAMIC_RESPAWN_TIME = 0x08, + SPAWN_FLAG_FORCE_DYNAMIC_ELITE = 0x10, // creature only + SPAWN_FLAG_EVADE_OUT_HOME_AREA = 0x20, // creature only + SPAWN_FLAG_NOT_VISIBLE = 0x40, // creature only + SPAWN_FLAG_DEAD = 0x80, // creature only +}; + +enum WorldMasks +{ + // Sees absolutely nothing + WORLD_ALONE = 0x00, + WORLD_DEFAULT_MASK = 0x01, + // Helpers + WORLD_DEFAULT_OBJECT = (WORLD_DEFAULT_MASK), + WORLD_DEFAULT_UNIT = (WORLD_DEFAULT_MASK), + WORLD_DEFAULT_CREATURE = (WORLD_DEFAULT_MASK), + WORLD_DEFAULT_CHAR = (WORLD_DEFAULT_MASK), + WORLD_SEE_ALL = 0xF, +}; + + +#endif diff --git a/src/game/Objects/Pet.cpp b/src/game/Objects/Pet.cpp index 066fb77c0..d57cc7fe0 100644 --- a/src/game/Objects/Pet.cpp +++ b/src/game/Objects/Pet.cpp @@ -20,8 +20,10 @@ */ #include "Pet.h" +#include "Group.h" #include "Database/DatabaseEnv.h" #include "Log.h" +#include "Opcodes.h" #include "WorldPacket.h" #include "ObjectMgr.h" #include "SpellMgr.h" diff --git a/src/game/Objects/Pet.h b/src/game/Objects/Pet.h index 0d71f9780..9a0128da7 100644 --- a/src/game/Objects/Pet.h +++ b/src/game/Objects/Pet.h @@ -23,7 +23,6 @@ #define MANGOSSERVER_PET_H #include "Common.h" -#include "ObjectGuid.h" #include "Creature.h" enum PetType diff --git a/src/game/Objects/Player.cpp b/src/game/Objects/Player.cpp index 8a0c2dae2..f526e4e27 100644 --- a/src/game/Objects/Player.cpp +++ b/src/game/Objects/Player.cpp @@ -20,8 +20,10 @@ */ #include +#include #include "Player.h" +#include "Bag.h" #include "Language.h" #include "Database/DatabaseEnv.h" #include "Log.h" @@ -38,13 +40,11 @@ #include "ChannelMgr.h" #include "MapManager.h" #include "MapPersistentStateMgr.h" -#include "InstanceData.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" #include "ObjectMgr.h" #include "ObjectAccessor.h" -#include "CreatureAI.h" #include "Formulas.h" #include "Group.h" #include "Guild.h" @@ -66,16 +66,12 @@ #include "GMTicketMgr.h" #include "MasterPlayer.h" #include "MovementPacketSender.h" - -/* Nostalrius */ #include "Config/Config.h" -#include #include "ZoneScript.h" #include "ZoneScriptMgr.h" #include "PlayerBotMgr.h" #include "PlayerBotAI.h" #include "AccountMgr.h" -#include "MoveSpline.h" #include "Anticheat.h" #include "MovementBroadcaster.h" #include "PlayerBroadcaster.h" @@ -1477,16 +1473,6 @@ void Player::Update(uint32 update_diff, uint32 p_time) m_areaCheckTimer -= p_time; } - float x, y, z, o; - if (IsInWorld() && sWorld.getConfig(CONFIG_BOOL_ENABLE_MOVEMENT_EXTRAPOLATION_PLAYER) && movespline->Finalized() && ExtrapolateMovement(m_movementInfo, WorldTimer::getMSTime() - m_movementInfo.time, x, y, z, o)) - { - GetMap()->DoPlayerGridRelocation(this, x, y, z, o); - m_position.x = x; - m_position.y = y; - m_position.z = z; - m_position.o = o; - } - // Anticheat sanction std::stringstream reason; uint32 cheatAction = GetCheatData()->Update(p_time, reason); @@ -12171,7 +12157,7 @@ void Player::PrepareGossipMenu(WorldObject* pSource, uint32 menuId) bool hasMenuItem = true; bool isGMSkipConditionCheck = false; - if (itr->second.condition_id && !sObjectMgr.IsConditionSatisfied(itr->second.condition_id, this, GetMap(), pSource, CONDITION_FROM_GOSSIP_OPTION)) + if (itr->second.condition_id && !IsConditionSatisfied(itr->second.condition_id, this, GetMap(), pSource, CONDITION_FROM_GOSSIP_OPTION)) { if (IsGameMaster()) // Let GM always see menu items regardless of conditions isGMSkipConditionCheck = true; @@ -12515,7 +12501,7 @@ uint32 Player::GetGossipTextId(uint32 menuId, WorldObject* pSource) // Take the text that has the highest conditionId of all fitting // No condition and no text with condition found OR higher and fitting condition found if ((!itr->second.condition_id && !lastConditionId) || - (itr->second.condition_id > lastConditionId && sObjectMgr.IsConditionSatisfied(itr->second.condition_id, this, GetMap(), pSource, CONDITION_FROM_GOSSIP_MENU))) + (itr->second.condition_id > lastConditionId && IsConditionSatisfied(itr->second.condition_id, this, GetMap(), pSource, CONDITION_FROM_GOSSIP_MENU))) { lastConditionId = itr->second.condition_id; textId = itr->second.text_id; @@ -13471,7 +13457,7 @@ bool Player::SatisfyQuestCondition(Quest const* qInfo, bool msg) const { if (uint32 conditionId = qInfo->GetRequiredCondition()) { - bool result = sObjectMgr.IsConditionSatisfied(conditionId, this, GetMap(), nullptr, CONDITION_FROM_QUEST); + bool result = IsConditionSatisfied(conditionId, this, GetMap(), nullptr, CONDITION_FROM_QUEST); if (!result && msg) SendCanTakeQuestResponse(INVALIDREASON_DONT_HAVE_REQ); @@ -18194,7 +18180,7 @@ bool Player::BuyItemFromVendor(ObjectGuid vendorGuid, uint32 item, uint8 count, return false; } - if (crItem->conditionId && !IsGameMaster() && !sObjectMgr.IsConditionSatisfied(crItem->conditionId, this, pCreature->GetMap(), pCreature, CONDITION_FROM_VENDOR)) + if (crItem->conditionId && !IsGameMaster() && !IsConditionSatisfied(crItem->conditionId, this, pCreature->GetMap(), pCreature, CONDITION_FROM_VENDOR)) { SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0); return false; diff --git a/src/game/Objects/Player.h b/src/game/Objects/Player.h index 5bc0993e1..db96d97ca 100644 --- a/src/game/Objects/Player.h +++ b/src/game/Objects/Player.h @@ -23,21 +23,16 @@ #define _PLAYER_H #include "Common.h" -#include "ItemPrototype.h" #include "Unit.h" -#include "Item.h" #include "Database/DatabaseEnv.h" -#include "NPCHandler.h" -#include "QuestDef.h" -#include "Group.h" -#include "Bag.h" +#include "GroupReference.h" #include "WorldSession.h" #include "Pet.h" #include "Util.h" // for Tokens typedef #include "ReputationMgr.h" #include "BattleGround.h" -#include "DBCStores.h" #include "SharedDefines.h" +#include "GameObjectDefines.h" #include "SpellMgr.h" #include "HonorMgr.h" @@ -46,6 +41,8 @@ #include struct Mail; +struct ItemPrototype; +class Group; class Channel; class Creature; class PlayerMenu; diff --git a/src/game/Objects/Totem.cpp b/src/game/Objects/Totem.cpp index 57b55f8e3..10a491aeb 100644 --- a/src/game/Objects/Totem.cpp +++ b/src/game/Objects/Totem.cpp @@ -20,15 +20,12 @@ */ #include "Totem.h" -#include "WorldPacket.h" -#include "Log.h" #include "Group.h" #include "Player.h" -#include "ObjectMgr.h" #include "SpellMgr.h" -#include "DBCStores.h" #include "CreatureAI.h" #include "InstanceData.h" +#include "ObjectAccessor.h" Totem::Totem() : Creature(CREATURE_SUBTYPE_TOTEM) { diff --git a/src/game/Objects/Unit.cpp b/src/game/Objects/Unit.cpp index 7339b4c27..ac32626fb 100644 --- a/src/game/Objects/Unit.cpp +++ b/src/game/Objects/Unit.cpp @@ -19,6 +19,10 @@ */ #include "Unit.h" +#include "Creature.h" +#include "Pet.h" +#include "Totem.h" +#include "Player.h" #include "Log.h" #include "Opcodes.h" #include "WorldPacket.h" @@ -27,41 +31,28 @@ #include "ObjectMgr.h" #include "ObjectGuid.h" #include "SpellMgr.h" -#include "QuestDef.h" -#include "Player.h" -#include "Creature.h" #include "Spell.h" #include "Group.h" #include "SpellAuras.h" -#include "MapManager.h" #include "ObjectAccessor.h" #include "CreatureAI.h" #include "TemporarySummon.h" #include "Formulas.h" -#include "Pet.h" #include "Util.h" -#include "Totem.h" #include "BattleGround.h" -#include "InstanceData.h" -#include "MapPersistentStateMgr.h" #include "GridNotifiersImpl.h" #include "CellImpl.h" #include "DBCStores.h" #include "VMapFactory.h" #include "MovementGenerator.h" #include "Transport.h" - +#include "CreatureGroups.h" #include "ZoneScript.h" -#include "Nostalrius.h" -#include "InstanceData.h" - -#include "PathFinder.h" #include "MoveSplineInit.h" #include "MoveSpline.h" #include "packet_builder.h" #include "Chat.h" #include "Anticheat.h" -#include "CreatureLinkingMgr.h" #include "InstanceStatistics.h" #include "MovementPacketSender.h" @@ -4536,6 +4527,14 @@ bool Unit::IsNeutralToAll() const return my_faction->IsNeutralToAll(); } +bool Unit::IsContestedGuard() const +{ + if (FactionTemplateEntry const* entry = getFactionTemplateEntry()) + return entry->IsContestedGuardFaction(); + + return false; +} + bool Unit::Attack(Unit* victim, bool meleeAttack) { if (!victim || victim == this) diff --git a/src/game/Objects/Unit.h b/src/game/Objects/Unit.h index b54d1251e..813c404ae 100644 --- a/src/game/Objects/Unit.h +++ b/src/game/Objects/Unit.h @@ -23,22 +23,19 @@ #define __UNIT_H #include "Common.h" +#include "SharedDefines.h" +#include "ItemPrototype.h" #include "Object.h" #include "UnitDefines.h" -#include "Opcodes.h" #include "SpellAuraDefines.h" #include "UpdateFields.h" -#include "SharedDefines.h" #include "ThreatManager.h" #include "HostileRefManager.h" #include "FollowerReference.h" #include "FollowerRefManager.h" #include "MotionMaster.h" -#include "DBCStructure.h" -#include "Timer.h" #include - struct FactionTemplateEntry; struct Modifier; struct SpellModifier; @@ -1182,13 +1179,7 @@ class Unit : public WorldObject bool IsHostileToPlayers() const; bool IsFriendlyTo(WorldObject const* target) const override; bool IsNeutralToAll() const; - bool IsContestedGuard() const - { - if (FactionTemplateEntry const* entry = getFactionTemplateEntry()) - return entry->IsContestedGuardFaction(); - - return false; - } + bool IsContestedGuard() const; bool IsInPartyWith(Unit const* unit) const; bool IsInRaidWith(Unit const* unit) const; diff --git a/src/game/OutdoorPvP/OutdoorPvPEP.cpp b/src/game/OutdoorPvP/OutdoorPvPEP.cpp index 7f2adb582..6fbee2780 100644 --- a/src/game/OutdoorPvP/OutdoorPvPEP.cpp +++ b/src/game/OutdoorPvP/OutdoorPvPEP.cpp @@ -20,12 +20,9 @@ #include "Player.h" #include "GameObject.h" #include "ObjectMgr.h" -#include "ObjectAccessor.h" #include "ZoneScriptMgr.h" -#include "Creature.h" #include "Language.h" #include "World.h" -#include "GossipDef.h" #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_11_2 diff --git a/src/game/OutdoorPvP/OutdoorPvPEP.h b/src/game/OutdoorPvP/OutdoorPvPEP.h index 3a6eae491..b52070d6f 100644 --- a/src/game/OutdoorPvP/OutdoorPvPEP.h +++ b/src/game/OutdoorPvP/OutdoorPvPEP.h @@ -18,7 +18,6 @@ #ifndef OUTDOOR_PVP_EP_ #define OUTDOOR_PVP_EP_ -#include "DBCStructure.h" #include "ZoneScript.h" #if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_11_2 diff --git a/src/game/OutdoorPvP/OutdoorPvPSI.cpp b/src/game/OutdoorPvP/OutdoorPvPSI.cpp index d4ea2cc2a..8b8774d2a 100644 --- a/src/game/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/game/OutdoorPvP/OutdoorPvPSI.cpp @@ -18,8 +18,6 @@ #include "OutdoorPvP/OutdoorPvPSI.h" #include "WorldPacket.h" #include "Player.h" -#include "GameObject.h" -#include "MapManager.h" #include "ObjectMgr.h" #include "ZoneScriptMgr.h" #include "Language.h" diff --git a/src/game/PacketBroadcast/MovementBroadcaster.h b/src/game/PacketBroadcast/MovementBroadcaster.h index c7bf766a2..8129fb21e 100644 --- a/src/game/PacketBroadcast/MovementBroadcaster.h +++ b/src/game/PacketBroadcast/MovementBroadcaster.h @@ -1,14 +1,10 @@ #ifndef MANGOS_MOVEMENT_BROADCASTER_H #define MANGOS_MOVEMENT_BROADCASTER_H -#include "Log.h" -#include "ObjectGuid.h" -#include +#include "Platform/Define.h" + #include -#include #include -#include -#include #include #include #include diff --git a/src/game/PacketBroadcast/PlayerBroadcaster.cpp b/src/game/PacketBroadcast/PlayerBroadcaster.cpp index 886298dc3..dfac6f76f 100644 --- a/src/game/PacketBroadcast/PlayerBroadcaster.cpp +++ b/src/game/PacketBroadcast/PlayerBroadcaster.cpp @@ -1,6 +1,7 @@ #include "PlayerBroadcaster.h" #include "MovementBroadcaster.h" -#include "World.h" +#include "WorldSocket.h" +#include "WorldPacket.h" #include "Player.h" uint32 PlayerBroadcaster::num_bcaster_created = 0; diff --git a/src/game/PacketBroadcast/PlayerBroadcaster.h b/src/game/PacketBroadcast/PlayerBroadcaster.h index a1640bcc8..15c7fdef9 100644 --- a/src/game/PacketBroadcast/PlayerBroadcaster.h +++ b/src/game/PacketBroadcast/PlayerBroadcaster.h @@ -3,13 +3,12 @@ #include "ObjectGuid.h" #include "WorldPacket.h" -#include "WorldSocket.h" -#include "WorldPacket.h" #include "Opcodes.h" #include #include #include +class WorldSocket; class MovementBroadcaster; class Player; diff --git a/src/game/PlayerBots/BattleBotAI.cpp b/src/game/PlayerBots/BattleBotAI.cpp index cb7a4118b..e237ab5b2 100644 --- a/src/game/PlayerBots/BattleBotAI.cpp +++ b/src/game/PlayerBots/BattleBotAI.cpp @@ -1,17 +1,35 @@ +/* +* 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, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include "BattleBotAI.h" #include "BattleBotWaypoints.h" #include "Player.h" +#include "Group.h" +#include "CreatureAI.h" #include "Log.h" #include "MotionMaster.h" #include "ObjectMgr.h" #include "PlayerBotMgr.h" +#include "Opcodes.h" #include "WorldPacket.h" #include "World.h" #include "Spell.h" #include "SpellAuras.h" #include "Chat.h" #include "TargetedMovementGenerator.h" -#include enum BattleBotSpells { diff --git a/src/game/PlayerBots/BattleBotAI.h b/src/game/PlayerBots/BattleBotAI.h index 133fa8ca6..0e6be715f 100644 --- a/src/game/PlayerBots/BattleBotAI.h +++ b/src/game/PlayerBots/BattleBotAI.h @@ -1,3 +1,19 @@ +/* +* 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, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #ifndef MANGOS_BattleBotAI_H #define MANGOS_BattleBotAI_H diff --git a/src/game/PlayerBots/BattleBotWaypoints.cpp b/src/game/PlayerBots/BattleBotWaypoints.cpp index 8fca6ade0..2e6cc7853 100644 --- a/src/game/PlayerBots/BattleBotWaypoints.cpp +++ b/src/game/PlayerBots/BattleBotWaypoints.cpp @@ -1,7 +1,25 @@ +/* +* 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, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include "BattleBotAI.h" #include "BattleBotWaypoints.h" #include "WorldPacket.h" +#include "Opcodes.h" #include "Player.h" +#include "GameObject.h" #include "MotionMaster.h" #include "Spell.h" #include "Battlegrounds/BattleGround.h" diff --git a/src/game/PlayerBots/BattleBotWaypoints.h b/src/game/PlayerBots/BattleBotWaypoints.h index 26f2a51d0..3df228f8f 100644 --- a/src/game/PlayerBots/BattleBotWaypoints.h +++ b/src/game/PlayerBots/BattleBotWaypoints.h @@ -1,7 +1,24 @@ +/* +* 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, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #ifndef MANGOS_BattleBotWaypoints_H #define MANGOS_BattleBotWaypoints_H #include "SharedDefines.h" +#include struct RecordedMovementPacket { diff --git a/src/game/PlayerBots/CombatBotBaseAI.cpp b/src/game/PlayerBots/CombatBotBaseAI.cpp index 2467d820a..9342bb0cf 100644 --- a/src/game/PlayerBots/CombatBotBaseAI.cpp +++ b/src/game/PlayerBots/CombatBotBaseAI.cpp @@ -1,14 +1,11 @@ #include "CombatBotBaseAI.h" #include "Player.h" -#include "Log.h" -#include "MotionMaster.h" -#include "ObjectMgr.h" +#include "Group.h" #include "PlayerBotMgr.h" +#include "Opcodes.h" #include "WorldPacket.h" #include "Spell.h" #include "SpellAuras.h" -#include "Chat.h" -#include "TargetedMovementGenerator.h" enum CombatBotSpells { diff --git a/src/game/PlayerBots/CombatBotBaseAI.h b/src/game/PlayerBots/CombatBotBaseAI.h index d364999ba..1b89bf103 100644 --- a/src/game/PlayerBots/CombatBotBaseAI.h +++ b/src/game/PlayerBots/CombatBotBaseAI.h @@ -2,6 +2,8 @@ #define MANGOS_COMBAT_BOT_BASE_H #include "PlayerBotAI.h" +#include "SpellEntry.h" +#include "Player.h" struct HealSpellCompare { diff --git a/src/game/PlayerBots/PartyBotAI.cpp b/src/game/PlayerBots/PartyBotAI.cpp index 9b13f2cb5..cf55839a7 100644 --- a/src/game/PlayerBots/PartyBotAI.cpp +++ b/src/game/PlayerBots/PartyBotAI.cpp @@ -1,9 +1,26 @@ +/* +* 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, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #include "PartyBotAI.h" #include "Player.h" -#include "Log.h" +#include "CreatureAI.h" #include "MotionMaster.h" #include "ObjectMgr.h" #include "PlayerBotMgr.h" +#include "Opcodes.h" #include "WorldPacket.h" #include "Spell.h" #include "SpellAuras.h" diff --git a/src/game/PlayerBots/PartyBotAI.h b/src/game/PlayerBots/PartyBotAI.h index 2bbb30677..a204508f6 100644 --- a/src/game/PlayerBots/PartyBotAI.h +++ b/src/game/PlayerBots/PartyBotAI.h @@ -1,7 +1,25 @@ +/* +* 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, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #ifndef MANGOS_PARTYBOTAI_H #define MANGOS_PARTYBOTAI_H #include "CombatBotBaseAI.h" +#include "Group.h" +#include "ObjectAccessor.h" struct LootResponseData { diff --git a/src/game/PlayerBots/PlayerBotAI.cpp b/src/game/PlayerBots/PlayerBotAI.cpp index 540414f5a..a8b1db2b8 100644 --- a/src/game/PlayerBots/PlayerBotAI.cpp +++ b/src/game/PlayerBots/PlayerBotAI.cpp @@ -1,12 +1,28 @@ +/* +* 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, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "PlayerBotMgr.h" #include "PlayerBotAI.h" #include "Player.h" -#include "DBCStores.h" #include "Log.h" #include "SocialMgr.h" #include "MotionMaster.h" #include "ObjectMgr.h" #include "MoveSpline.h" -#include "PlayerBotMgr.h" +#include "Opcodes.h" #include "WorldPacket.h" bool PlayerBotAI::OnSessionLoaded(PlayerBotEntry* entry, WorldSession* sess) diff --git a/src/game/PlayerBots/PlayerBotAI.h b/src/game/PlayerBots/PlayerBotAI.h index 70416aba5..c0fb7e68c 100644 --- a/src/game/PlayerBots/PlayerBotAI.h +++ b/src/game/PlayerBots/PlayerBotAI.h @@ -1,3 +1,19 @@ +/* +* 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, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + #ifndef MANGOS_PLAYERBOTAI_H #define MANGOS_PLAYERBOTAI_H diff --git a/src/game/PlayerBots/PlayerBotMgr.cpp b/src/game/PlayerBots/PlayerBotMgr.cpp index cd1c93a3c..6b081bdc2 100644 --- a/src/game/PlayerBots/PlayerBotMgr.cpp +++ b/src/game/PlayerBots/PlayerBotMgr.cpp @@ -5,15 +5,14 @@ #include "World.h" #include "WorldSession.h" #include "AccountMgr.h" -#include "Opcodes.h" #include "Config/Config.h" #include "Chat.h" #include "Player.h" +#include "Group.h" #include "PlayerBotAI.h" #include "PartyBotAI.h" #include "BattleBotAI.h" #include "BattleBotWaypoints.h" -#include "Anticheat.h" #include "Language.h" INSTANTIATE_SINGLETON_1(PlayerBotMgr); diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp index 99dac10a6..6918a892e 100644 --- a/src/game/PlayerDump.cpp +++ b/src/game/PlayerDump.cpp @@ -22,7 +22,6 @@ #include "Common.h" #include "PlayerDump.h" #include "Database/DatabaseEnv.h" -#include "SQLStorages.h" #include "UpdateFields.h" #include "ObjectMgr.h" #include "AccountMgr.h" diff --git a/src/game/QuestDef.h b/src/game/QuestDef.h index a356074ef..575ef1604 100644 --- a/src/game/QuestDef.h +++ b/src/game/QuestDef.h @@ -23,13 +23,12 @@ #define MANGOSSERVER_QUEST_H #include "Platform/Define.h" -#include "Database/DatabaseEnv.h" #include #include +class Field; class Player; - class ObjectMgr; #define MAX_QUEST_LOG_SIZE 20 diff --git a/src/game/ReputationMgr.cpp b/src/game/ReputationMgr.cpp index 52502be5b..2d8275140 100644 --- a/src/game/ReputationMgr.cpp +++ b/src/game/ReputationMgr.cpp @@ -20,8 +20,8 @@ */ #include "ReputationMgr.h" -#include "DBCStores.h" #include "Player.h" +#include "Opcodes.h" #include "WorldPacket.h" #include "ObjectMgr.h" #include diff --git a/src/game/ScriptMgr.h b/src/game/ScriptMgr.h index 417418ff2..9d6fee893 100644 --- a/src/game/ScriptMgr.h +++ b/src/game/ScriptMgr.h @@ -22,10 +22,10 @@ #include "Common.h" #include "Policies/Singleton.h" -#include "ObjectGuid.h" #include "DBCEnums.h" +#include "ScriptCommands.h" + #include -#include "SpellDefines.h" struct AreaTriggerEntry; class Aura; @@ -44,1049 +44,6 @@ class Quest; class SpellCastTargets; class SpellEntry; -// Legend: -// source - the type of object which executes the command -// target - the type of object used as target of the command if needed -// provided source - the "WorldObject* source" provided to the command -// provided target - the "WorldObject* target" provided to the command - -// For example the talk command can be used by any WorldObject and the text will -// be said by this object. If there is also a target provided of type Unit, then -// any use of $n in the text will show the name of this unit. - -// Command functions are defined in Map.h and implemented in ScriptCommands.cpp! - -enum eScriptCommand -{ - SCRIPT_COMMAND_TALK = 0, // source = WorldObject - // target = Unit/None - // datalong = chat_type (see enum ChatType) - // dataint = broadcast_text id. dataint2-4 optional for random selected text. - SCRIPT_COMMAND_EMOTE = 1, // source = Unit - // datalong1-4 = emote_id - SCRIPT_COMMAND_FIELD_SET = 2, // source = Object - // datalong = field_id - // datalong2 = value - SCRIPT_COMMAND_MOVE_TO = 3, // source = Creature - // target = WorldObject (for datalong > 0) - // datalong = coordinates_type (see enum eMoveToCoordinateTypes) - // datalong2 = time - // datalong3 = movement_options (see enum MoveOptions) - // datalong4 = eMoveToFlags - // dataint = path_id - // x/y/z/o = coordinates - SCRIPT_COMMAND_MODIFY_FLAGS = 4, // source = Object - // datalong = field_id - // datalong2 = bitmask - // datalong3 = eModifyFlagsOptions - SCRIPT_COMMAND_INTERRUPT_CASTS = 5, // source = Unit - // datalong = (bool) with_delayed - // datalong2 = spell_id (optional) - SCRIPT_COMMAND_TELEPORT_TO = 6, // source = Unit - // datalong = map_id (only used for players but still required) - // datalong2 = teleport_options (see enum TeleportToOptions) - // x/y/z/o = coordinates - SCRIPT_COMMAND_QUEST_EXPLORED = 7, // source = Player (from provided source or target) - // target = WorldObject (from provided source or target) - // datalong = quest_id - // datalong2 = distance or 0 - // datalong3 = (bool) group - SCRIPT_COMMAND_KILL_CREDIT = 8, // source = Player (from provided source or target) - // datalong = creature entry - // datalong2 = bool (0=personal credit, 1=group credit) - SCRIPT_COMMAND_RESPAWN_GAMEOBJECT = 9, // source = Map - // target = GameObject (from datalong, provided source or target) - // datalong = db_guid - // datalong2 = despawn_delay - SCRIPT_COMMAND_TEMP_SUMMON_CREATURE = 10, // source = WorldObject (from provided source or buddy) - // datalong = creature_entry - // datalong2 = despawn_delay - // datalong3 = unique_limit - // datalong4 = unique_distance - // dataint = eSummonCreatureFlags - // dataint2 = script_id - // dataint3 = attack_target (see enum ScriptTarget) - // dataint4 = despawn_type (see enum TempSummonType) - // x/y/z/o = coordinates - SCRIPT_COMMAND_OPEN_DOOR = 11, // source = GameObject (from datalong, provided source or target) - // If provided target is BUTTON GameObject, command is run on it too. - // datalong = db_guid - // datalong2 = reset_delay - SCRIPT_COMMAND_CLOSE_DOOR = 12, // source = GameObject (from datalong, provided source or target) - // If provided target is BUTTON GameObject, command is run on it too. - // datalong = db_guid - // datalong2 = reset_delay - SCRIPT_COMMAND_ACTIVATE_OBJECT = 13, // source = GameObject - // target = Unit - SCRIPT_COMMAND_REMOVE_AURA = 14, // source = Unit - // datalong = spell_id - SCRIPT_COMMAND_CAST_SPELL = 15, // source = Unit - // target = Unit - // datalong = spell_id - // datalong2 = eCastSpellFlags - SCRIPT_COMMAND_PLAY_SOUND = 16, // source = WorldObject - // target = Player/None - // datalong = sound_id - // datalong2 = ePlaySoundFlags - SCRIPT_COMMAND_CREATE_ITEM = 17, // source = Player (from provided source or target) - // datalong = item_entry - // datalong2 = amount - SCRIPT_COMMAND_DESPAWN_CREATURE = 18, // source = Creature - // datalong = despawn_delay - SCRIPT_COMMAND_SET_EQUIPMENT = 19, // source = Creature - // datalong = (bool) reset_default - // dataint = main-hand item_id - // dataint2 = off-hand item_id - // dataint3 = ranged item_id - SCRIPT_COMMAND_MOVEMENT = 20, // source = Creature - // datalong = see enum MovementGeneratorType (not all are supported) - // datalong2 = bool_param (meaning depends on the motion type) - // datalong3 = int_param (meaning depends on the motion type) - // datalong4 = (bool) clear - // x = distance (only for some motion types) - // o = angle (only for some motion types) - SCRIPT_COMMAND_SET_ACTIVEOBJECT = 21, // source = Creature - // datalong = (bool) 0=off, 1=on - SCRIPT_COMMAND_SET_FACTION = 22, // source = Creature - // datalong = faction_Id, - // datalong2 = see enum TemporaryFactionFlags - SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL = 23, // source = Unit - // datalong = creature_id/display_id (depend on datalong2) - // datalong2 = (bool) is_display_id - SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL = 24, // source = Creature - // datalong = creature_id/display_id (depend on datalong2) - // datalong2 = (bool) is_display_id - // datalong3 = (bool) permanent - SCRIPT_COMMAND_SET_RUN = 25, // source = Creature - // datalong = (bool) 0 = off, 1 = on - SCRIPT_COMMAND_ATTACK_START = 26, // source = Creature - // target = Player - SCRIPT_COMMAND_UPDATE_ENTRY = 27, // source = Creature - // datalong = creature_entry - // datalong2 = team for display_id (0 = alliance, 1 = horde) - SCRIPT_COMMAND_STAND_STATE = 28, // source = Unit - // datalong = stand_state (enum UnitStandStateType) - SCRIPT_COMMAND_MODIFY_THREAT = 29, // source = Creature - // datalong = eModifyThreatTargets - // x = percent - SCRIPT_COMMAND_SEND_TAXI_PATH = 30, // source = Player - // datalong = taxi_path_id - SCRIPT_COMMAND_TERMINATE_SCRIPT = 31, // source = Any - // datalong = creature_entry - // datalong2 = search_distance - // datalong3 = eTerminateScriptOptions - SCRIPT_COMMAND_TERMINATE_CONDITION = 32, // source = Any - // datalong = condition_id - // datalong2 = failed_quest_id - // datalong3 = eTerminateConditionFlags - SCRIPT_COMMAND_ENTER_EVADE_MODE = 33, // source = Creature - SCRIPT_COMMAND_SET_HOME_POSITION = 34, // source = Creature - // datalong = eSetHomePositionOptions - // x/y/z/o = coordinates - SCRIPT_COMMAND_TURN_TO = 35, // source = Unit - // target = WorldObject - // datalong = eTurnToFacingOptions - SCRIPT_COMMAND_MEETINGSTONE = 36, // source = Player - // datalong = area_id - SCRIPT_COMMAND_SET_INST_DATA = 37, // source = Map - // datalong = field - // datalong2 = data - // datalong3 = eSetInstDataOptions - SCRIPT_COMMAND_SET_INST_DATA64 = 38, // source = Map - // target = Object (when saving guid) - // datalong = field - // datalong2 = data - // datalong3 = eSetInstData64Options - SCRIPT_COMMAND_START_SCRIPT = 39, // source = Map - // datalong1-4 = event_script id - // dataint1-4 = chance (total cant be above 100) - SCRIPT_COMMAND_REMOVE_ITEM = 40, // source = Player (from provided source or target) - // datalong = item_entry - // datalong2 = amount - SCRIPT_COMMAND_REMOVE_OBJECT = 41, // source = GameObject - // target = Unit - SCRIPT_COMMAND_SET_MELEE_ATTACK = 42, // source = Creature - // datalong = (bool) 0 = off, 1 = on - SCRIPT_COMMAND_SET_COMBAT_MOVEMENT = 43, // source = Creature - // datalong = (bool) 0 = off, 1 = on - SCRIPT_COMMAND_SET_PHASE = 44, // source = Creature - // datalong = phase - // datalong2 = eSetPhaseOptions - SCRIPT_COMMAND_SET_PHASE_RANDOM = 45, // source = Creature - // datalong1-4 = phase - SCRIPT_COMMAND_SET_PHASE_RANGE = 46, // source = Creature - // datalong = phase_min - // datalong2 = phase_max - SCRIPT_COMMAND_FLEE = 47, // source = Creature - // datalong = seek_assistance (bool) 0 = off, 1 = on - SCRIPT_COMMAND_DEAL_DAMAGE = 48, // source = Unit - // target = Unit - // datalong = damage - // datalong2 = (bool) is_percent - SCRIPT_COMMAND_ZONE_COMBAT_PULSE = 49, // source = Creature - // datalong = (bool) initialPulse - SCRIPT_COMMAND_CALL_FOR_HELP = 50, // source = Creature - // x = radius - SCRIPT_COMMAND_SET_SHEATH = 51, // source = Unit - // datalong = see enum SheathState - SCRIPT_COMMAND_INVINCIBILITY = 52, // source = Creature - // datalong = health - // datalong2 = (bool) is_percent - SCRIPT_COMMAND_GAME_EVENT = 53, // source = None - // datalong = event_id - // datalong2 = (bool) start - // datalong3 = (bool) overwrite - SCRIPT_COMMAND_SET_SERVER_VARIABLE = 54, // source = None - // datalong = index - // datalong2 = value - SCRIPT_COMMAND_CREATURE_SPELLS = 55, // source = Creature - // datalong1-4 = creature_spells id - // dataint1-4 = chance (total cant be above 100) - SCRIPT_COMMAND_REMOVE_GUARDIANS = 56, // source = Unit - // datalong = creature_id - SCRIPT_COMMAND_ADD_SPELL_COOLDOWN = 57, // source = Unit - // datalong = spell_id - // datalong2 = cooldown - SCRIPT_COMMAND_REMOVE_SPELL_COOLDOWN = 58, // source = Unit - // datalong = spell_id - SCRIPT_COMMAND_SET_REACT_STATE = 59, // source = Creature - // datalong = see enum ReactStates - SCRIPT_COMMAND_START_WAYPOINTS = 60, // source = Creature - // datalong = waypoints_source - // datalong2 = start_point - // datalong3 = initial_delay - // datalong4 = (bool) repeat - // dataint = overwrite_guid - // dataint2 = overwrite_entry - SCRIPT_COMMAND_START_MAP_EVENT = 61, // source = Map - // datalong = event_id - // datalong2 = time_limit - // dataint = success_condition - // dataint2 = success_script - // dataint3 = failure_condition - // dataint4 = failure_script - SCRIPT_COMMAND_END_MAP_EVENT = 62, // source = Map - // datalong = event_id - // datalong2 = (bool) success - SCRIPT_COMMAND_ADD_MAP_EVENT_TARGET = 63, // source = Map - // target = WorldObject - // datalong = event_id - // dataint = success_condition - // dataint2 = success_script - // dataint3 = failure_condition - // dataint4 = failure_script - SCRIPT_COMMAND_REMOVE_MAP_EVENT_TARGET = 64, // source = Map - // target = WorldObject - // datalong = event_id - // datalong2 = condition_id - // datalong3 = eRemoveMapEventTargetOptions - SCRIPT_COMMAND_SET_MAP_EVENT_DATA = 65, // source = Map - // datalong = event_id - // datalong2 = index - // datalong3 = data - // datalong4 = eSetMapScriptDataOptions - SCRIPT_COMMAND_SEND_MAP_EVENT = 66, // source = Map - // datalong = event_id - // datalong2 = data - // datalong3 = eSendMapEventOptions - SCRIPT_COMMAND_SET_DEFAULT_MOVEMENT = 67, // source = Creature - // datalong = movement_type - // datalong2 = (bool) always_replace - // datalong3 = param1 - SCRIPT_COMMAND_START_SCRIPT_FOR_ALL = 68, // source = WorldObject - // datalong = script_id - // datalong2 = eStartScriptForAllOptions - // datalong3 = object_entry - // datalong4 = search_radius - SCRIPT_COMMAND_EDIT_MAP_EVENT = 69, // source = Map - // datalong = event_id - // dataint = success_condition - // dataint2 = success_script - // dataint3 = failure_condition - // dataint4 = failure_script - SCRIPT_COMMAND_FAIL_QUEST = 70, // source = Player - // datalong = quest_id - SCRIPT_COMMAND_RESPAWN_CREATURE = 71, // source = Creature - // datalong = (bool) even_if_alive - SCRIPT_COMMAND_ASSIST_UNIT = 72, // source = Creature - // target = Unit - SCRIPT_COMMAND_COMBAT_STOP = 73, // source = Unit - SCRIPT_COMMAND_ADD_AURA = 74, // source = Unit - // datalong = spell_id - // datalong2 = flags - SCRIPT_COMMAND_ADD_THREAT = 75, // source = Creature - // target = Unit - SCRIPT_COMMAND_SUMMON_OBJECT = 76, // source = WorldObject - // datalong = gameobject_entry - // datalong2 = respawn_time - // x/y/z/o = coordinates - SCRIPT_COMMAND_SET_FLY = 77, // source = Unit - // datalong = (bool) 0 = off, 1 = on - SCRIPT_COMMAND_JOIN_CREATURE_GROUP = 78, // source = Creature - // target = Creature - // datalong = OptionFlags - // x = distance - // o = angle - SCRIPT_COMMAND_LEAVE_CREATURE_GROUP = 79, // source = Creature - SCRIPT_COMMAND_SET_GO_STATE = 80, // source = GameObject - // datalong = GOState - SCRIPT_COMMAND_DESPAWN_GAMEOBJECT = 81, // source = GameObject (from datalong, provided source or target) - // datalong = db_guid - // datalong2 = despawn_delay - SCRIPT_COMMAND_LOAD_GAMEOBJECT = 82, // source = Map - // datalong = db_guid - SCRIPT_COMMAND_QUEST_CREDIT = 83, // source = Player (from provided source or target) - // target = WorldObject (from provided source or target) - SCRIPT_COMMAND_SET_GOSSIP_MENU = 84, // source = Creature - // datalong = gossip_menu_id - SCRIPT_COMMAND_SEND_SCRIPT_EVENT = 85, // source = Creature - // target = WorldObject - // datalong = event_id - // datalong2 = event_data - SCRIPT_COMMAND_SET_PVP = 86, // source = Player - // datalong = (bool) 0 = off, 1 = on - SCRIPT_COMMAND_MAX, - - SCRIPT_COMMAND_DISABLED = 9999 // Script action was disabled during loading. -}; - -#define MAX_TEXT_ID 4 // used for SCRIPT_COMMAND_TALK -static constexpr uint32 MAX_EMOTE_ID = 4; // used for SCRIPT_COMMAND_EMOTE - -// Flags used by SCRIPT_COMMAND_MOVE_TO -enum eMoveToFlags -{ - SF_MOVETO_FORCED = 0x1, // No check if creature can move. - SF_MOVETO_POINT_MOVEGEN = 0x2, // Changes movement generator to point movement. -}; - -// Possible datalong3 values for SCRIPT_COMMAND_MOVE_TO -enum eMoveToCoordinateTypes -{ - SO_MOVETO_COORDINATES_NORMAL = 0, - SO_MOVETO_COORDINATES_RELATIVE_TO_TARGET = 1, // Coordinates are added to that of target. - SO_MOVETO_COORDINATES_DISTANCE_FROM_TARGET = 2, // X is distance from target, others not used. - SO_MOVETO_COORDINATES_RANDOM_POINT = 3, // O is max distance from coordinates - - MOVETO_COORDINATES_MAX -}; - -// Possible datalong3 values for SCRIPT_COMMAND_MODIFY_FLAGS -enum eModifyFlagsOptions -{ - SO_MODIFYFLAGS_TOGGLE = 0, - SO_MODIFYFLAGS_SET = 1, - SO_MODIFYFLAGS_REMOVE = 2 -}; - -// Flags used by SCRIPT_COMMAND_TEMP_SUMMON_CREATURE -// Must start from 0x8 because of target selection flags. -enum eSummonCreatureFlags -{ - SF_SUMMONCREATURE_SET_RUN = 0x01, // makes creature move at run speed - SF_SUMMONCREATURE_ACTIVE = 0x02, // active creatures are always updated - SF_SUMMONCREATURE_UNIQUE = 0x04, // not actually unique, just checks for same entry in certain range - SF_SUMMONCREATURE_UNIQUE_TEMP = 0x08, // same as 0x10 but check for TempSummon only creatures - SF_SUMMONCREATURE_NULL_AI = 0x10 // use Null AI instead of the normal creature script -}; - -// Flags used by SCRIPT_COMMAND_PLAY_SOUND -enum ePlaySoundFlags -{ - SF_PLAYSOUND_ONLY_TO_TARGET = 0x1, - SF_PLAYSOUND_DISTANCE_DEPENDENT = 0x2 -}; - -// Possible datalong values for SCRIPT_COMMAND_MODIFY_THREAT -enum eModifyThreatTargets -{ - // 0 to 5 from Target enum. - SO_MODIFYTHREAT_ALL_ATTACKERS = 6 -}; - -// Possible datalong3 values for SCRIPT_COMMAND_TERMINATE_SCRIPT -enum eTerminateScriptOptions -{ - SO_TERMINATESCRIPT_IF_NOT_FOUND = 0, - SO_TERMINATESCRIPT_IF_FOUND = 1 -}; - -// Flags used by SCRIPT_COMMAND_TERMINATE_CONDITION -enum eTerminateConditionFlags -{ - SF_TERMINATECONDITION_WHEN_FALSE = 0x1 -}; - -// Possible datalong values for SCRIPT_COMMAND_SET_HOME_POSITION -enum eSetHomePositionOptions -{ - SO_SETHOME_PROVIDED_POSITION = 0, - SO_SETHOME_CURRENT_POSITION = 1, - SO_SETHOME_DEFAULT_POSITION = 2 -}; - -// Possible datalong values for SCRIPT_COMMAND_TURN_TO -enum eTurnToFacingOptions -{ - SO_TURNTO_FACE_TARGET = 0, - SO_TURNTO_PROVIDED_ORIENTATION = 1 -}; - -// Possible datalong3 values for SCRIPT_COMMAND_SET_INST_DATA -enum eSetInstDataOptions -{ - SO_INSTDATA_RAW = 0, - SO_INSTDATA_INCREMENT = 1, - SO_INSTDATA_DECREMENT = 2, - - SO_INSTDATA_MAX -}; - -// Possible datalong3 values for SCRIPT_COMMAND_SET_INST_DATA64 -enum eSetInstData64Options -{ - SO_INSTDATA64_RAW = 0, - SO_INSTDATA64_SOURCE_GUID = 1, - - SO_INSTDATA64_MAX -}; - -// Possible datalong values for SCRIPT_COMMAND_SET_PHASE -enum eSetPhaseOptions -{ - SO_SETPHASE_RAW = 0, - SO_SETPHASE_INCREMENT = 1, - SO_SETPHASE_DECREMENT = 2, - - SO_SETPHASE_MAX -}; - -// Possible datalong3 values for SCRIPT_COMMAND_REMOVE_MAP_EVENT_TARGET -enum eRemoveMapEventTargetOptions -{ - SO_REMOVETARGET_SELF = 0, - SO_REMOVETARGET_ONE_FIT_CONDITION = 1, - SO_REMOVETARGET_ALL_FIT_CONDITION = 2, - SO_REMOVETARGET_ALL_TARGETS = 3, - - SO_REMOVETARGET_MAX -}; - -// Possible datalong4 values for SCRIPT_COMMAND_SET_MAP_EVENT_DATA -enum eSetMapScriptDataOptions -{ - SO_MAPEVENTDATA_RAW = 0, - SO_MAPEVENTDATA_INCREMENT = 1, - SO_MAPEVENTDATA_DECREMENT = 2, - - SO_MAPEVENTDATA_MAX -}; - -// Possible datalong3 values for SCRIPT_COMMAND_SEND_MAP_EVENT -enum eSendMapEventOptions -{ - SO_SENDMAPEVENT_MAIN_TARGETS_ONLY = 0, - SO_SENDMAPEVENT_EXTRA_TARGETS_ONLY = 1, - SO_SENDMAPEVENT_ALL_TARGETS = 2, - - SO_SENDMAPEVENT_MAX -}; - -// Possible datalong2 values for SCRIPT_COMMAND_START_SCRIPT_FOR_ALL -enum eStartScriptForAllOptions -{ - SO_STARTFORALL_GAMEOBJECTS = 0, - SO_STARTFORALL_UNITS = 1, - SO_STARTFORALL_CREATURES = 2, - SO_STARTFORALL_PLAYERS = 3, - - SO_STARTFORALL_MAX -}; - -enum eDataFlags -{ - SF_GENERAL_SWAP_INITIAL_TARGETS = 0x1, // Swaps the provided source and target, before buddy is checked. - SF_GENERAL_SWAP_FINAL_TARGETS = 0x2, // Swaps the local source and target, after buddy is assigned. - SF_GENERAL_TARGET_SELF = 0x4, // Replaces the provided target with the provided source. - SF_GENERAL_ABORT_ON_FAILURE = 0x8 // Terminates the script if the command fails. -}; - -struct ScriptInfo -{ - uint32 id; - uint32 delay; - uint32 command; - uint32 condition; - - union - { - struct // SCRIPT_COMMAND_TALK (0) - { - uint32 chatType; // datalong - uint32 unused1; // datalong2 - uint32 unused2; // datalong3 - uint32 unused3; // datalong4 - uint32 unused4; // data_flags - int32 textId[MAX_TEXT_ID]; // dataint to dataint4 - } talk; - - struct // SCRIPT_COMMAND_EMOTE (1) - { - uint32 emoteId[MAX_EMOTE_ID]; // datalong to datalong4 - } emote; - - struct // SCRIPT_COMMAND_FIELD_SET (2) - { - uint32 fieldId; // datalong - uint32 fieldValue; // datalong2 - } setField; - - struct // SCRIPT_COMMAND_MOVE_TO (3) - { - uint32 coordinatesType; // datalong - uint32 travelTime; // datalong2 - uint32 movementOptions; // datalong3 - uint32 flags; // datalong4 - uint32 unused; // data_flags - int32 pointId; // dataint - } moveTo; - - struct // SCRIPT_COMMAND_MODIFY_FLAGS (4) - { - uint32 fieldId; // datalong - uint32 fieldValue; // datalong2 - uint32 mode; // datalong3 - } modFlags; - - struct // SCRIPT_COMMAND_INTERRUPT_CASTS (5) - { - uint32 withDelayed; // datalong - uint32 spellId; // datalong2 - } interruptCasts; - - struct // SCRIPT_COMMAND_TELEPORT_TO (6) - { - uint32 mapId; // datalong - uint32 teleportOptions; // datalong2 - } teleportTo; - - struct // SCRIPT_COMMAND_QUEST_EXPLORED (7) - { - uint32 questId; // datalong - uint32 distance; // datalong2 - uint32 group; // datalong3 - } questExplored; - - struct // SCRIPT_COMMAND_KILL_CREDIT (8) - { - uint32 creatureEntry; // datalong - uint32 isGroupCredit; // datalong2 - } killCredit; - - struct // SCRIPT_COMMAND_RESPAWN_GAMEOBJECT (9) - { - uint32 goGuid; // datalong - int32 despawnDelay; // datalong2 - } respawnGo; - - struct // SCRIPT_COMMAND_TEMP_SUMMON_CREATURE (10) - { - uint32 creatureEntry; // datalong - uint32 despawnDelay; // datalong2 - uint32 uniqueLimit; // datalong3 - uint32 uniqueDistance; // datalong4 - uint32 unused; // data_flags - int32 flags; // dataint - int32 scriptId; // dataint2 - int32 attackTarget; // dataint3 - int32 despawnType; // dataint4 - } summonCreature; - - struct // SCRIPT_COMMAND_OPEN_DOOR (11) - { - uint32 goGuid; // datalong - int32 resetDelay; // datalong2 - } openDoor; - - struct // SCRIPT_COMMAND_CLOSE_DOOR (12) - { - uint32 goGuid; // datalong - int32 resetDelay; // datalong2 - } closeDoor; - - // SCRIPT_COMMAND_ACTIVATE_OBJECT (13) - - struct // SCRIPT_COMMAND_REMOVE_AURA (14) - { - uint32 spellId; // datalong - } removeAura; - - struct // SCRIPT_COMMAND_CAST_SPELL (15) - { - uint32 spellId; // datalong - uint32 flags; // datalong2 - } castSpell; - - struct // SCRIPT_COMMAND_PLAY_SOUND (16) - { - uint32 soundId; // datalong - uint32 flags; // datalong2 - } playSound; - - struct // SCRIPT_COMMAND_CREATE_ITEM (17) - { - uint32 itemEntry; // datalong - uint32 amount; // datalong2 - } createItem; - - struct // SCRIPT_COMMAND_DESPAWN_CREATURE (18) - { - uint32 despawnDelay; // datalong - } despawn; - - struct // SCRIPT_COMMAND_SET_EQUIPMENT (19) - { - uint32 resetDefault; // datalong - uint32 unused1; // datalong2 - uint32 unused2; // datalong3 - uint32 unused3; // datalong4 - uint32 unused4; // data_flags - int32 slot[MAX_TEXT_ID]; // dataint to dataint4 - } setEquipment; - - struct // SCRIPT_COMMAND_MOVEMENT (20) - { - uint32 movementType; // datalong - uint32 boolParam; // datalong2 - uint32 intParam; // datalong3 - uint32 clear; // datalong4 - } movement; - - struct // SCRIPT_COMMAND_SET_ACTIVEOBJECT (21) - { - uint32 activate; // datalong - } activeObject; - - struct // SCRIPT_COMMAND_SET_FACTION (22) - { - uint32 factionId; // datalong - uint32 flags; // datalong2 - } faction; - - struct // SCRIPT_COMMAND_MORPH_TO_ENTRY_OR_MODEL (23) - { - uint32 creatureOrModelEntry; // datalong - uint32 isDisplayId; // datalong2 - } morph; - - struct // SCRIPT_COMMAND_MOUNT_TO_ENTRY_OR_MODEL (24) - { - uint32 creatureOrModelEntry; // datalong - uint32 isDisplayId; // datalong2 - uint32 permanent; // datalong3 - } mount; - - struct // SCRIPT_COMMAND_SET_RUN (25) - { - uint32 run; // datalong - } run; - - // SCRIPT_COMMAND_ATTACK_START (26) - - struct // SCRIPT_COMMAND_UPDATE_ENTRY (27) - { - uint32 creatureEntry; // datalong - uint32 team; // datalong2 - } updateEntry; - - struct // SCRIPT_COMMAND_STAND_STATE (28) - { - uint32 standState; // datalong - } standState; - - struct // SCRIPT_COMMAND_MODIFY_THREAT (29) - { - uint32 target; // datalong - } modThreat; - - struct // SCRIPT_COMMAND_SEND_TAXI_PATH (30) - { - uint32 taxiPathId; // datalong - } sendTaxiPath; - - struct // SCRIPT_COMMAND_TERMINATE_SCRIPT (31) - { - uint32 creatureEntry; // datalong - uint32 searchRadius; // datalong2 - uint32 flags; // datalong3 - } terminateScript; - - struct // SCRIPT_COMMAND_TERMINATE_CONDITION (32) - { - uint32 conditionId; // datalong - uint32 failQuest; // datalong2 - uint32 flags; // datalong3 - } terminateCond; - - // SCRIPT_COMMAND_ENTER_EVADE_MODE (33) - - struct // SCRIPT_COMMAND_SET_HOME_POSITION (34) - { - uint32 mode; // datalong - } setHome; - - struct // SCRIPT_COMMAND_TURN_TO (35) - { - uint32 facingLogic; // datalong - } turnTo; - - struct // SCRIPT_COMMAND_MEETINGSTONE (36) - { - uint32 areaId; // datalong - } meetingstone; - - struct // SCRIPT_COMMAND_SET_INST_DATA (37) - { - uint32 field; // datalong - uint32 data; // datalong2 - uint32 type; // datalong3 - } setData; - - struct // SCRIPT_COMMAND_SET_INST_DATA64 (38) - { - uint32 field; // datalong - uint32 data; // datalong2 - uint32 type; // datalong3 - } setData64; - - struct // SCRIPT_COMMAND_START_SCRIPT (39) - { - uint32 scriptId[4]; // datalong to datalong4 - uint32 unused; // data_flags - int32 chance[4]; // dataint to dataint4 - } startScript; - - struct // SCRIPT_COMMAND_REMOVE_ITEM (40) - { - uint32 itemEntry; // datalong - uint32 amount; // datalong2 - } removeItem; - - // SCRIPT_COMMAND_REMOVE_OBJECT (41) - - struct // SCRIPT_COMMAND_SET_MELEE_ATTACK (42) - { - uint32 enabled; // datalong - } enableMelee; - - struct // SCRIPT_COMMAND_SET_COMBAT_MOVEMENT (43) - { - uint32 enabled; // datalong - } combatMovement; - - struct // SCRIPT_COMMAND_SET_PHASE (44) - { - uint32 phase; // datalong - uint32 mode; // datalong2 - } setPhase; - - struct // SCRIPT_COMMAND_SET_PHASE_RANDOM (45) - { - uint32 phase[MAX_TEXT_ID]; // datalong - } setPhaseRandom; - - struct // SCRIPT_COMMAND_SET_PHASE_RANGE (46) - { - uint32 phaseMin; // datalong - uint32 phaseMax; // datalong2 - } setPhaseRange; - - struct // SCRIPT_COMMAND_FLEE (47) - { - uint32 seekAssistance; // datalong - } flee; - - struct // SCRIPT_COMMAND_DEAL_DAMAGE (48) - { - uint32 damage; // datalong - uint32 isPercent; // datalong2 - } dealDamage; - - struct // SCRIPT_COMMAND_ZONE_COMBAT_PULSE (49) - { - uint32 initialPulse; // datalong - } combatPulse; - - // SCRIPT_COMMAND_CALL_FOR_HELP (50) - - struct // SCRIPT_COMMAND_SET_SHEATH (51) - { - uint32 sheathState; // datalong - } setSheath; - - struct // SCRIPT_COMMAND_INVINCIBILITY (52) - { - uint32 health; // datalong - uint32 isPercent; // datalong2 - } invincibility; - - struct // SCRIPT_COMMAND_GAME_EVENT (53) - { - uint32 eventId; // datalong - uint32 start; // datalong2 - uint32 overwrite; // datalong3 - } gameEvent; - - struct // SCRIPT_COMMAND_SET_SERVER_VARIABLE (54) - { - uint32 index; // datalong - uint32 value; // datalong2 - } serverVariable; - - struct // SCRIPT_COMMAND_CREATURE_SPELLS (55) - { - uint32 spellListId[4]; // datalong to datalong4 - uint32 unused; // data_flags - int32 chance[4]; // dataint to dataint4 - } creatureSpells; - - struct // SCRIPT_COMMAND_REMOVE_GUARDIANS (56) - { - uint32 creatureId; // datalong - } removeGuardian; - - struct // SCRIPT_COMMAND_ADD_SPELL_COOLDOWN (57) - { - uint32 spellId; // datalong - uint32 cooldown; // datalong2 - } addCooldown; - - struct // SCRIPT_COMMAND_REMOVE_SPELL_COOLDOWN (58) - { - uint32 spellId; // datalong - } removeCooldown; - - struct // SCRIPT_COMMAND_SET_REACT_STATE (59) - { - uint32 state; // datalong - } setReactState; - - struct // SCRIPT_COMMAND_START_WAYPOINTS (60) - { - uint32 wpSource; // datalong - uint32 startPoint; // datalong2 - uint32 initialDelay; // datalong3 - uint32 canRepeat; // datalong4 - uint32 unused; // data_flags - int32 overwriteGuid; // dataint - int32 overwriteEntry; // dataint2 - } startWaypoints; - - struct // SCRIPT_COMMAND_START_MAP_EVENT (61) - { - uint32 eventId; // datalong - uint32 timeLimit; // datalong2 - uint32 unused1; // datalong3 - uint32 unuded2; // datalong4 - uint32 unused3; // data_flags - int32 successCondition; // dataint - int32 successScript; // dataint2 - int32 failureCondition; // dataint3 - int32 failureScript; // dataint4 - } startMapEvent; - - struct // SCRIPT_COMMAND_END_MAP_EVENT (62) - { - uint32 eventId; // datalong - uint32 success; // datalong2 - } endMapEvent; - - struct // SCRIPT_COMMAND_ADD_MAP_EVENT_TARGET (63) - { - uint32 eventId; // datalong - uint32 unused1; // datalong2 - uint32 unused2; // datalong3 - uint32 unused3; // datalong4 - uint32 unused4; // data_flags - int32 successCondition; // dataint - int32 successScript; // dataint2 - int32 failureCondition; // dataint3 - int32 failureScript; // dataint4 - } addMapEventTarget; - - struct // SCRIPT_COMMAND_REMOVE_MAP_EVENT_TARGET (64) - { - uint32 eventId; // datalong - uint32 conditionId; // datalong2 - uint32 targets; // datalong3 - } removeMapEventTarget; - - struct // SCRIPT_COMMAND_SET_MAP_EVENT_DATA (65) - { - uint32 eventId; // datalong - uint32 index; // datalong2 - uint32 data; // datalong3 - uint32 type; // datalong4 - } setMapEventData; - - struct // SCRIPT_COMMAND_SEND_MAP_EVENT (66) - { - uint32 eventId; // datalong - uint32 data; // datalong2 - uint32 targets; // datalong3 - } sendMapEvent; - - struct // SCRIPT_COMMAND_SET_DEFAULT_MOVEMENT (67) - { - uint32 movementType; // datalong - uint32 alwaysReplace; // datalong2 - uint32 param1; // datalong3 - } setDefaultMovement; - - struct // SCRIPT_COMMAND_START_SCRIPT_FOR_ALL (68) - { - uint32 scriptId; // datalong - uint32 objectType; // datalong2 - uint32 objectEntry; // datalong3 - uint32 searchRadius; // datalong4 - } startScriptForAll; - - struct // SCRIPT_COMMAND_EDIT_MAP_EVENT (69) - { - uint32 eventId; // datalong - uint32 unused1; // datalong2 - uint32 unused2; // datalong3 - uint32 unused3; // datalong4 - uint32 unused4; // data_flags - int32 successCondition; // dataint - int32 successScript; // dataint2 - int32 failureCondition; // dataint3 - int32 failureScript; // dataint4 - } editMapEvent; - - struct // SCRIPT_COMMAND_FAIL_QUEST (70) - { - uint32 questId; // datalong - } failQuest; - - struct // SCRIPT_COMMAND_RESPAWN_CREATURE (71) - { - uint32 evenAlive; // datalong - } respawnCreature; - - // SCRIPT_COMMAND_ASSIST_UNIT (72) - - // SCRIPT_COMMAND_COMBAT_STOP (73) - - struct // SCRIPT_COMMAND_ADD_AURA (74) - { - uint32 spellId; // datalong - uint32 flags; // datalong2 - } addAura; - - // SCRIPT_COMMAND_ADD_THREAT (75) - - struct // SCRIPT_COMMAND_SUMMON_OBJECT (76) - { - uint32 gameobject_entry; // datalong - uint32 respawn_time; // datalong2 - } summonObject; - - struct // SCRIPT_COMMAND_SET_FLY (77) - { - uint32 enabled; // datalong - } setFly; - - struct // SCRIPT_COMMAND_JOIN_CREATURE_GROUP (78) - { - uint32 options; // datalong - } joinCreatureGroup; - - // SCRIPT_COMMAND_LEAVE_CREATURE_GROUP (79) - - struct // SCRIPT_COMMAND_SET_GO_STATE (80) - { - uint32 state; // datalong - } setGoState; - - struct // SCRIPT_COMMAND_DESPAWN_GAMEOBJECT (81) - { - uint32 goGuid; // datalong - uint32 respawnDelay; // datalong2 - } despawnGo; - - struct // SCRIPT_COMMAND_LOAD_GAMEOBJECT (82) - { - uint32 goGuid; // datalong - } loadGo; - - // SCRIPT_COMMAND_QUEST_CREDIT (83) - - struct // SCRIPT_COMMAND_SET_GOSSIP_MENU (84) - { - uint32 gossipMenuId; // datalong - } setGossipMenu; - - struct // SCRIPT_COMMAND_SEND_SCRIPT_EVENT (85) - { - uint32 eventId; // datalong - uint32 eventData; // datalong2 - } sendScriptEvent; - - struct // SCRIPT_COMMAND_SET_PVP (86) - { - uint32 enabled; // datalong - } setPvP; - - struct - { - uint32 data[9]; - } raw; - }; - - uint32 target_param1; - uint32 target_param2; - uint8 target_type; - - float x; - float y; - float z; - float o; - - ScriptInfo() : id(0), delay(0), command(0), condition(0), target_param1(0), target_param2(0), target_type(0), x(0), y(0), z(0), o(0) - { - memset(raw.data, 0, sizeof(raw.data)); - } - - // helpers - uint32 GetGOGuid() const - { - switch(command) - { - case SCRIPT_COMMAND_RESPAWN_GAMEOBJECT: return respawnGo.goGuid; - case SCRIPT_COMMAND_DESPAWN_GAMEOBJECT: return despawnGo.goGuid; - case SCRIPT_COMMAND_LOAD_GAMEOBJECT: return loadGo.goGuid; - case SCRIPT_COMMAND_OPEN_DOOR: return openDoor.goGuid; - case SCRIPT_COMMAND_CLOSE_DOOR: return closeDoor.goGuid; - default: return 0; - } - } -}; - -struct ScriptAction -{ - ObjectGuid sourceGuid; - ObjectGuid targetGuid; - ScriptInfo const* script; // pointer to static script data - - bool IsSameScript(uint32 id, ObjectGuid sourceGuid, ObjectGuid targetGuid) const - { - return id == script->id && - (sourceGuid == this->sourceGuid || !sourceGuid) && - (targetGuid == this->targetGuid || !targetGuid); - } -}; - typedef std::multimap ScriptMap; typedef std::map ScriptMapMap; @@ -1113,96 +70,6 @@ extern ScriptMapMap sCreatureAIScripts; #define TEXT_SOURCE_CUSTOM_START TEXT_SOURCE_RANGE*2 #define TEXT_SOURCE_CUSTOM_END TEXT_SOURCE_RANGE*3 + 1 -enum CastFlags -{ - CF_INTERRUPT_PREVIOUS = 0x001, // Interrupt any spell casting - CF_TRIGGERED = 0x002, // Triggered (this makes spell cost zero mana and have no cast time) - CF_FORCE_CAST = 0x004, // Bypasses extra checks in Creature::TryToCast - CF_MAIN_RANGED_SPELL = 0x008, // To be used by ranged mobs only. Creature will not chase target until cast fails. - CF_TARGET_UNREACHABLE = 0x010, // Will only use the ability if creature cannot currently get to target - CF_AURA_NOT_PRESENT = 0x020, // Only casts the spell if the target does not have an aura from the spell - CF_ONLY_IN_MELEE = 0x040, // Only casts if the creature is in melee range of the target - CF_NOT_IN_MELEE = 0x080, // Only casts if the creature is not in melee range of the target - CF_TARGET_CASTING = 0x100, // Only casts if the target is currently casting a spell -}; - -#define ALL_CAST_FLAGS (CF_INTERRUPT_PREVIOUS | CF_TRIGGERED | CF_FORCE_CAST | CF_MAIN_RANGED_SPELL | CF_TARGET_UNREACHABLE | CF_AURA_NOT_PRESENT | CF_ONLY_IN_MELEE | CF_NOT_IN_MELEE | CF_TARGET_CASTING) - -// Values used in target_type column -enum ScriptTarget -{ - TARGET_T_PROVIDED_TARGET = 0, //Object that was provided to the command. - - TARGET_T_HOSTILE = 1, //Our current target (ie: highest aggro). - TARGET_T_HOSTILE_SECOND_AGGRO = 2, //Second highest aggro (generaly used for cleaves and some special attacks). - //Param1 = select_flags - TARGET_T_HOSTILE_LAST_AGGRO = 3, //Dead last on aggro (no idea what this could be used for). - //Param1 = select_flags - TARGET_T_HOSTILE_RANDOM = 4, //Just any random target on our threat list. - //Param1 = select_flags - TARGET_T_HOSTILE_RANDOM_NOT_TOP = 5, //Any random target except top threat. - //Param1 = select_flags - - TARGET_T_OWNER_OR_SELF = 6, //Either self or owner if pet or controlled. - TARGET_T_OWNER = 7, //The owner of the source. - - - TARGET_T_NEAREST_CREATURE_WITH_ENTRY = 8, //Searches for closest nearby creature with the given entry. - //Param1 = creature_entry - //Param2 = search_radius - - TARGET_T_CREATURE_WITH_GUID = 9, //The creature with this database guid. - //Param1 = db_guid - - TARGET_T_CREATURE_FROM_INSTANCE_DATA = 10, //Find creature by guid stored in instance data. - //Param1 = instance_data_field - - TARGET_T_NEAREST_GAMEOBJECT_WITH_ENTRY = 11, //Searches for closest nearby gameobject with the given entry. - //Param1 = gameobject_entry - //Param2 = search_radius - - TARGET_T_GAMEOBJECT_WITH_GUID = 12, //The gameobject with this database guid. - //Param1 = db_guid - - TARGET_T_GAMEOBJECT_FROM_INSTANCE_DATA = 13, //Find gameobject by guid stored in instance data. - //Param1 = instance_data_field - - TARGET_T_FRIENDLY = 14, //Random friendly unit. - //Param1 = search_radius - //Param2 = (bool) exclude_target - TARGET_T_FRIENDLY_INJURED = 15, //Friendly unit missing the most health. - //Param1 = search_radius - //Param2 = hp_percent - TARGET_T_FRIENDLY_INJURED_EXCEPT = 16, //Friendly unit missing the most health but not provided target. - //Param1 = search_radius - //Param2 = hp_percent - TARGET_T_FRIENDLY_MISSING_BUFF = 17, //Friendly unit without aura. - //Param1 = search_radius - //Param2 = spell_id - TARGET_T_FRIENDLY_MISSING_BUFF_EXCEPT = 18, //Friendly unit without aura but not provided target. - //Param1 = search_radius - //Param2 = spell_id - TARGET_T_FRIENDLY_CC = 19, //Friendly unit under crowd control. - //Param1 = search_radius - TARGET_T_MAP_EVENT_SOURCE = 20, //The source WorldObject of a scripted map event. - //Param1 = eventId - TARGET_T_MAP_EVENT_TARGET = 21, //The target WorldObject of a scripted map event. - //Param1 = eventId - TARGET_T_MAP_EVENT_EXTRA_TARGET = 22, //An additional WorldObject target from a scripted map event. - //Param1 = eventId - //Param2 = creature_entry or gameobject_entry - TARGET_T_NEAREST_PLAYER = 23, //Nearest player within range. - //Param1 = search-radius - TARGET_T_NEAREST_HOSTILE_PLAYER = 24, //Nearest hostile player within range. - //Param1 = search-radius - TARGET_T_NEAREST_FRIENDLY_PLAYER = 25, //Nearest friendly player within range. - //Param1 = search-radius - TARGET_T_RANDOM_CREATURE_WITH_ENTRY = 26, //Searches for random nearby creature with the given entry. Not Self. - //Param1 = creature_entry - //Param2 = search_radius - TARGET_T_END -}; - //Generic scripting functions void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target = nullptr, int32 chatTypeOverride = -1); void DoOrSimulateScriptTextForMap(int32 iTextEntry, uint32 uiCreatureEntry, Map* pMap, Creature* pCreatureSource = nullptr, Unit* pTarget = nullptr); diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 7949fd2d0..c34648028 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -266,117 +266,6 @@ enum DamageEffectType SELF_DAMAGE = 5, }; -enum GameobjectTypes -{ - GAMEOBJECT_TYPE_DOOR = 0, - GAMEOBJECT_TYPE_BUTTON = 1, - GAMEOBJECT_TYPE_QUESTGIVER = 2, - GAMEOBJECT_TYPE_CHEST = 3, - GAMEOBJECT_TYPE_BINDER = 4, - GAMEOBJECT_TYPE_GENERIC = 5, - GAMEOBJECT_TYPE_TRAP = 6, - GAMEOBJECT_TYPE_CHAIR = 7, - GAMEOBJECT_TYPE_SPELL_FOCUS = 8, - GAMEOBJECT_TYPE_TEXT = 9, - GAMEOBJECT_TYPE_GOOBER = 10, - GAMEOBJECT_TYPE_TRANSPORT = 11, - GAMEOBJECT_TYPE_AREADAMAGE = 12, - GAMEOBJECT_TYPE_CAMERA = 13, - GAMEOBJECT_TYPE_MAP_OBJECT = 14, - GAMEOBJECT_TYPE_MO_TRANSPORT = 15, - GAMEOBJECT_TYPE_DUEL_ARBITER = 16, - GAMEOBJECT_TYPE_FISHINGNODE = 17, - GAMEOBJECT_TYPE_SUMMONING_RITUAL = 18, - GAMEOBJECT_TYPE_MAILBOX = 19, - GAMEOBJECT_TYPE_AUCTIONHOUSE = 20, - GAMEOBJECT_TYPE_GUARDPOST = 21, - GAMEOBJECT_TYPE_SPELLCASTER = 22, - GAMEOBJECT_TYPE_MEETINGSTONE = 23, - GAMEOBJECT_TYPE_FLAGSTAND = 24, - GAMEOBJECT_TYPE_FISHINGHOLE = 25, -#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_7_1 - GAMEOBJECT_TYPE_FLAGDROP = 26, -#endif -#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_9_4 - GAMEOBJECT_TYPE_MINI_GAME = 27, - GAMEOBJECT_TYPE_LOTTERY_KIOSK = 28, -#endif -#if SUPPORTED_CLIENT_BUILD > CLIENT_BUILD_1_11_2 - GAMEOBJECT_TYPE_CAPTURE_POINT = 29, - GAMEOBJECT_TYPE_AURA_GENERATOR = 30, -#endif - GAMEOBJECT_TYPE_MAX -}; - -#define MAX_GAMEOBJECT_TYPE 31 // sending to client this or greater value can crash client. - -enum GameObjectFlags -{ - GO_FLAG_IN_USE = 0x00000001, //disables interaction while animated - GO_FLAG_LOCKED = 0x00000002, //require key, spell, event, etc to be opened. Makes "Locked" appear in tooltip - GO_FLAG_INTERACT_COND = 0x00000004, //cannot interact (condition to interact) - GO_FLAG_TRANSPORT = 0x00000008, //any kind of transport? Object can transport (elevator, boat, car) - GO_FLAG_NO_INTERACT = 0x00000010, //players cannot interact with this go (often need to remove flag in event) - GO_FLAG_NODESPAWN = 0x00000020, //never despawn, typically for doors, they just change state - GO_FLAG_TRIGGERED = 0x00000040 //typically, summoned objects. Triggered by spell or other events -}; - -enum GameObjectDynamicLowFlags -{ - GO_DYNFLAG_LO_ACTIVATE = 0x01, // enables interaction with GO - GO_DYNFLAG_LO_ANIMATE = 0x02, // possibly more distinct animation of GO - GO_DYNFLAG_LO_NO_INTERACT = 0x04, // appears to disable interaction (not fully verified) -}; - -enum class GameObjectActions : uint32 -{ // Name from client executable // Comments - None, // -NONE- - AnimateCustom0, // Animate Custom0 - AnimateCustom1, // Animate Custom1 - AnimateCustom2, // Animate Custom2 - AnimateCustom3, // Animate Custom3 - Disturb, // Disturb // Triggers trap - Unlock, // Unlock // Resets GO_FLAG_LOCKED - Lock, // Lock // Sets GO_FLAG_LOCKED - Open, // Open // Sets GO_STATE_ACTIVE - OpenAndUnlock, // Open + Unlock // Sets GO_STATE_ACTIVE and resets GO_FLAG_LOCKED - Close, // Close // Sets GO_STATE_READY - ToggleOpen, // Toggle Open - Destroy, // Destroy // Sets GO_STATE_DESTROYED - Rebuild, // Rebuild // Resets from GO_STATE_DESTROYED - Creation, // Creation - Despawn, // Despawn - MakeInert, // Make Inert // Disables interactions - MakeActive, // Make Active // Enables interactions - CloseAndLock, // Close + Lock // Sets GO_STATE_READY and sets GO_FLAG_LOCKED - UseArtKit0, // Use ArtKit0 // 46904: 121 - UseArtKit1, // Use ArtKit1 // 36639: 81, 46903: 122 - UseArtKit2, // Use ArtKit2 - UseArtKit3, // Use ArtKit3 - SetTapList, // Set Tap List - GoTo1stFloor, // Go to 1st floor - GoTo2ndFloor, // Go to 2nd floor - GoTo3rdFloor, // Go to 3rd floor - GoTo4thFloor, // Go to 4th floor - GoTo5thFloor, // Go to 5th floor - GoTo6thFloor, // Go to 6th floor - GoTo7thFloor, // Go to 7th floor - GoTo8thFloor, // Go to 8th floor - GoTo9thFloor, // Go to 9th floor - GoTo10thFloor, // Go to 10th floor - UseArtKit4, // Use ArtKit4 - PlayAnimKit, // Play Anim Kit "%s" // MiscValueB -> Anim Kit ID - OpenAndPlayAnimKit, // Open + Play Anim Kit "%s" // MiscValueB -> Anim Kit ID - CloseAndPlayAnimKit, // Close + Play Anim Kit "%s" // MiscValueB -> Anim Kit ID - PlayOneshotAnimKit, // Play One-shot Anim Kit "%s" // MiscValueB -> Anim Kit ID - StopAnimKit, // Stop Anim Kit - OpenAndStopAnimKit, // Open + Stop Anim Kit - CloseAndStopAnimKit, // Close + Stop Anim Kit - PlaySpellVisual, // Play Spell Visual "%s" // MiscValueB -> Spell Visual ID - StopSpellVisual, // Stop Spell Visual - SetTappedToChallengePlayers, // Set Tapped to Challenge Players -}; - enum TextEmotes { TEXTEMOTE_AGREE = 1, @@ -934,85 +823,6 @@ enum LockType LOCKTYPE_FISHING = 19 }; -enum TrainerType // this is important type for npcs! -{ - TRAINER_TYPE_CLASS = 0, - TRAINER_TYPE_MOUNTS = 1, // on blizz it's 2 - TRAINER_TYPE_TRADESKILLS = 2, - TRAINER_TYPE_PETS = 3 -}; - -#define MAX_TRAINER_TYPE 4 - -// CreatureType.dbc -enum CreatureType -{ - CREATURE_TYPE_BEAST = 1, - CREATURE_TYPE_DRAGONKIN = 2, - CREATURE_TYPE_DEMON = 3, - CREATURE_TYPE_ELEMENTAL = 4, - CREATURE_TYPE_GIANT = 5, - CREATURE_TYPE_UNDEAD = 6, - CREATURE_TYPE_HUMANOID = 7, - CREATURE_TYPE_CRITTER = 8, - CREATURE_TYPE_MECHANICAL = 9, - CREATURE_TYPE_NOT_SPECIFIED = 10, - CREATURE_TYPE_TOTEM = 11, -}; - -uint32 const CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD = (1 << (CREATURE_TYPE_HUMANOID - 1)) | (1 << (CREATURE_TYPE_UNDEAD - 1)); -uint32 const CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL = (1 << (CREATURE_TYPE_MECHANICAL - 1)) | (1 << (CREATURE_TYPE_ELEMENTAL - 1)); - -// CreatureFamily.dbc -enum CreatureFamily -{ - CREATURE_FAMILY_WOLF = 1, - CREATURE_FAMILY_CAT = 2, - CREATURE_FAMILY_SPIDER = 3, - CREATURE_FAMILY_BEAR = 4, - CREATURE_FAMILY_BOAR = 5, - CREATURE_FAMILY_CROCOLISK = 6, - CREATURE_FAMILY_CARRION_BIRD = 7, - CREATURE_FAMILY_CRAB = 8, - CREATURE_FAMILY_GORILLA = 9, - CREATURE_FAMILY_HORSE_CUSTOM = 10, // not exist in DBC but used for horse like beasts in DB - CREATURE_FAMILY_RAPTOR = 11, - CREATURE_FAMILY_TALLSTRIDER = 12, - CREATURE_FAMILY_FELHUNTER = 15, - CREATURE_FAMILY_VOIDWALKER = 16, - CREATURE_FAMILY_SUCCUBUS = 17, - CREATURE_FAMILY_DOOMGUARD = 19, - CREATURE_FAMILY_SCORPID = 20, - CREATURE_FAMILY_TURTLE = 21, - CREATURE_FAMILY_IMP = 23, - CREATURE_FAMILY_BAT = 24, - CREATURE_FAMILY_HYENA = 25, - CREATURE_FAMILY_OWL = 26, - CREATURE_FAMILY_WIND_SERPENT = 27, - CREATURE_FAMILY_REMOTE_CONTROL = 28, -}; - -enum CreatureTypeFlags -{ - CREATURE_TYPEFLAGS_TAMEABLE = 0x00000001, // Tameable by any hunter - CREATURE_TYPEFLAGS_GHOST_VISIBLE = 0x00000002, // Creatures which can _also_ be seen when player is a ghost, used in CanInteract function by client, can't be attacked - CREATURE_TYPEFLAGS_BOSS = 0x00000004, // Changes creature's visible level to "??" in the creature's portrait - CREATURE_TYPEFLAGS_NO_WOUND_ANIM = 0x00000008, // Disables "wounded" animations at spell taken - CREATURE_TYPEFLAGS_HIDE_FACTION_TOOLTIP = 0x00000010, // Controls something in client tooltip related to creature faction - CREATURE_TYPEFLAGS_UNK6 = 0x00000020, // May be sound related - CREATURE_TYPEFLAGS_SPELL_ATTACKABLE = 0x00000040, // May be related to attackable / not attackable creatures with spells, used together with lua_IsHelpfulSpell/lua_IsHarmfulSpell -}; - -enum CreatureEliteType -{ - CREATURE_ELITE_NORMAL = 0, - CREATURE_ELITE_ELITE = 1, - CREATURE_ELITE_RAREELITE = 2, - CREATURE_ELITE_WORLDBOSS = 3, - CREATURE_ELITE_RARE = 4, - CREATURE_UNKNOWN = 5 // found in 2.2.3 for 2 mobs -}; - enum HolidayIds { HOLIDAY_NONE = 0, @@ -1305,7 +1115,7 @@ enum UnitDynFlags UNIT_DYNFLAG_NONE = 0x0000, UNIT_DYNFLAG_LOOTABLE = 0x0001, UNIT_DYNFLAG_TRACK_UNIT = 0x0002, - UNIT_DYNFLAG_TAPPED = 0x0004, // Lua_UnitIsTapped + UNIT_DYNFLAG_TAPPED = 0x0004, // Lua_UnitIsTapped UNIT_DYNFLAG_TAPPED_BY_PLAYER = 0x0008, // Et non *_ROOTED ! UNIT_DYNFLAG_SPECIALINFO = 0x0010, UNIT_DYNFLAG_DEAD = 0x0020, diff --git a/src/game/SocialMgr.cpp b/src/game/SocialMgr.cpp index a62066cee..01d7660f3 100644 --- a/src/game/SocialMgr.cpp +++ b/src/game/SocialMgr.cpp @@ -25,7 +25,7 @@ #include "Opcodes.h" #include "WorldPacket.h" #include "MasterPlayer.h" -#include "ObjectMgr.h" +#include "ObjectAccessor.h" #include "World.h" #include "Util.h" diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index 8169edd68..255a5e88e 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -20,35 +20,29 @@ */ #include "Spell.h" -#include "Database/DatabaseEnv.h" +#include "Log.h" +#include "Opcodes.h" #include "WorldPacket.h" #include "WorldSession.h" +#include "World.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" -#include "Opcodes.h" -#include "Log.h" -#include "UpdateMask.h" -#include "World.h" +#include "CellImpl.h" #include "ObjectMgr.h" #include "SpellMgr.h" #include "Player.h" #include "Pet.h" #include "DynamicObject.h" #include "Group.h" -#include "UpdateData.h" #include "MapManager.h" #include "ObjectAccessor.h" -#include "CellImpl.h" -#include "Policies/SingletonImp.h" #include "SharedDefines.h" #include "LootMgr.h" #include "VMapFactory.h" #include "BattleGround.h" #include "Util.h" -#include "Chat.h" #include "PathFinder.h" #include "CharacterDatabaseCache.h" -#include "GameObjectAI.h" #include "ZoneScript.h" using namespace Spells; @@ -5474,7 +5468,7 @@ SpellCastResult Spell::CheckCast(bool strict) // only allow triggered spells if at an ended battleground if (m_caster->IsPlayer()) - if (BattleGround * bg = ((Player*)m_caster)->GetBattleGround()) + if (BattleGround* bg = ((Player*)m_caster)->GetBattleGround()) if (bg->GetStatus() == STATUS_WAIT_LEAVE) return SPELL_FAILED_DONT_REPORT; diff --git a/src/game/Spells/Spell.h b/src/game/Spells/Spell.h index 894da32b7..98d981654 100644 --- a/src/game/Spells/Spell.h +++ b/src/game/Spells/Spell.h @@ -23,7 +23,6 @@ #define __SPELL_H #include "Common.h" -#include "GridDefines.h" #include "SharedDefines.h" #include "DBCEnums.h" #include "ObjectGuid.h" diff --git a/src/game/Spells/SpellAuras.cpp b/src/game/Spells/SpellAuras.cpp index b40eaad83..bbc370d24 100644 --- a/src/game/Spells/SpellAuras.cpp +++ b/src/game/Spells/SpellAuras.cpp @@ -20,22 +20,19 @@ */ #include "Common.h" -#include "Database/DatabaseEnv.h" #include "WorldPacket.h" #include "WorldSession.h" #include "Opcodes.h" #include "Log.h" -#include "UpdateMask.h" #include "World.h" #include "ObjectMgr.h" #include "SpellMgr.h" #include "Player.h" +#include "PlayerAI.h" #include "Spell.h" #include "DynamicObject.h" #include "Group.h" -#include "UpdateData.h" #include "ObjectAccessor.h" -#include "Policies/SingletonImp.h" #include "Totem.h" #include "Creature.h" #include "Formulas.h" @@ -50,10 +47,6 @@ #include "MoveSpline.h" #include "MovementPacketSender.h" #include "ZoneScript.h" -#include "PlayerAI.h" -#include "PlayerBotAI.h" -#include "PlayerBotMgr.h" -#include "Anticheat.h" using namespace Spells; @@ -495,6 +488,11 @@ void Aura::SetModifier(AuraType t, float a, uint32 pt, int32 miscValue) m_modifier.periodictime = pt; } +int32 Aura::GetMiscValue() const +{ + return m_spellAuraHolder->GetSpellProto()->EffectMiscValue[m_effIndex]; +} + void Aura::UpdatePeriodicTimer(int32 duration) { if (m_isPeriodic) @@ -6729,6 +6727,11 @@ void SpellAuraHolder::SetStackAmount(uint32 stackAmount) RefreshHolder(); } +uint32 SpellAuraHolder::GetId() const +{ + return m_spellProto->Id; +} + Unit* SpellAuraHolder::GetCaster() const { if (GetCasterGuid() == m_target->GetObjectGuid()) @@ -7220,6 +7223,11 @@ void SpellAuraHolder::UnregisterSingleCastHolder() } } +void SpellAuraHolder::SetAura(uint32 slot, bool remove) +{ + m_target->SetUInt32Value(UNIT_FIELD_AURA + slot, remove ? 0 : GetId()); +} + void SpellAuraHolder::SetAuraFlag(uint32 slot, bool add) { uint32 index = slot >> 3; diff --git a/src/game/Spells/SpellAuras.h b/src/game/Spells/SpellAuras.h index 69c5c409e..80bc5bb7f 100644 --- a/src/game/Spells/SpellAuras.h +++ b/src/game/Spells/SpellAuras.h @@ -110,7 +110,7 @@ class SpellAuraHolder Aura* GetAuraByEffectIndex(SpellEffectIndex index) const { return m_auras[index]; } uint32 GetAuraPeriodicTickTimer(SpellEffectIndex index) const; - uint32 GetId() const { return m_spellProto->Id; } + uint32 GetId() const; SpellEntry const* GetSpellProto() const { return m_spellProto; } ObjectGuid const& GetCasterGuid() const { return m_casterGuid; } @@ -225,7 +225,7 @@ class SpellAuraHolder void UpdateAuraDuration() const; - void SetAura(uint32 slot, bool remove) { m_target->SetUInt32Value(UNIT_FIELD_AURA + slot, remove ? 0 : GetId()); } + void SetAura(uint32 slot, bool remove); void SetAuraFlag(uint32 slot, bool add); void SetAuraLevel(uint32 slot, uint32 level); @@ -434,10 +434,10 @@ class Aura void SetModifier(AuraType t, float a, uint32 pt, int32 miscValue); Modifier* GetModifier() { return &m_modifier; } Modifier const* GetModifier() const { return &m_modifier; } - int32 GetMiscValue() const { return m_spellAuraHolder->GetSpellProto()->EffectMiscValue[m_effIndex]; } + int32 GetMiscValue() const; SpellEntry const* GetSpellProto() const { return GetHolder()->GetSpellProto(); } - uint32 GetId() const{ return GetHolder()->GetSpellProto()->Id; } + uint32 GetId() const{ return GetHolder()->GetId(); } ObjectGuid const& GetCastItemGuid() const { return GetHolder()->GetCastItemGuid(); } ObjectGuid const& GetCasterGuid() const { return GetHolder()->GetCasterGuid(); } ObjectGuid const& GetRealCasterGuid() const { return GetHolder()->GetRealCasterGuid(); } diff --git a/src/game/Spells/SpellClassMask.h b/src/game/Spells/SpellClassMask.h index 5fe86764c..3a3812465 100644 --- a/src/game/Spells/SpellClassMask.h +++ b/src/game/Spells/SpellClassMask.h @@ -19,8 +19,6 @@ #ifndef _SPELL_CLASS_MASK_H #define _SPELL_CLASS_MASK_H -#include "Platform/Define.h" - enum ClassFlag { // -- Mage (3) diff --git a/src/game/Spells/SpellEffects.cpp b/src/game/Spells/SpellEffects.cpp index 51b2a37d5..163873341 100644 --- a/src/game/Spells/SpellEffects.cpp +++ b/src/game/Spells/SpellEffects.cpp @@ -20,11 +20,10 @@ */ #include "Common.h" -#include "Database/DatabaseEnv.h" +#include "SharedDefines.h" #include "WorldPacket.h" #include "Opcodes.h" #include "Log.h" -#include "UpdateMask.h" #include "World.h" #include "ObjectMgr.h" #include "SpellMgr.h" @@ -33,29 +32,23 @@ #include "DynamicObject.h" #include "SpellAuras.h" #include "Group.h" -#include "UpdateData.h" -#include "MapManager.h" #include "ObjectAccessor.h" -#include "SharedDefines.h" +#include "Creature.h" #include "Pet.h" #include "GameObject.h" #include "GameObjectAI.h" -#include "GossipDef.h" -#include "Creature.h" #include "Totem.h" #include "CreatureAI.h" #include "BattleGroundMgr.h" #include "BattleGround.h" #include "BattleGroundWS.h" -#include "Language.h" -#include "SocialMgr.h" #include "VMapFactory.h" #include "Util.h" -#include "TemporarySummon.h" #include "MoveMapSharedDefines.h" #include "GameEventMgr.h" #include "InstanceData.h" #include "ScriptMgr.h" +#include "SocialMgr.h" using namespace Spells; diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index acf854326..ac342a6d5 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -19,12 +19,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "Player.h" -#include "Pet.h" -#include "Creature.h" #include "SharedDefines.h" +#include "Creature.h" +#include "Pet.h" +#include "Player.h" #include "SpellAuras.h" -#include "ObjectMgr.h" #include "World.h" /*####################################### diff --git a/src/game/Transports/Transport.cpp b/src/game/Transports/Transport.cpp index f7f1c7e4f..d16e24afa 100644 --- a/src/game/Transports/Transport.cpp +++ b/src/game/Transports/Transport.cpp @@ -21,16 +21,13 @@ #include "MapManager.h" #include "ObjectMgr.h" #include "Path.h" -#include "ScriptMgr.h" #include "WorldPacket.h" -#include "DBCStores.h" #include "World.h" #include "GameObjectAI.h" #include "MapReference.h" #include "Player.h" #include "Cell.h" #include "CellImpl.h" -#include "Totem.h" #include "GameObjectModel.h" #include "ObjectAccessor.h" diff --git a/src/game/Transports/TransportMgr.cpp b/src/game/Transports/TransportMgr.cpp index 3ec500d21..d3c40e7b7 100644 --- a/src/game/Transports/TransportMgr.cpp +++ b/src/game/Transports/TransportMgr.cpp @@ -17,7 +17,6 @@ #include "TransportMgr.h" #include "Transport.h" -#include "MoveSpline.h" #include "MapManager.h" #include "ObjectMgr.h" #include "MoveMap.h" diff --git a/src/game/UnitAuraProcHandler.cpp b/src/game/UnitAuraProcHandler.cpp index 429efc358..e4d1a4614 100644 --- a/src/game/UnitAuraProcHandler.cpp +++ b/src/game/UnitAuraProcHandler.cpp @@ -21,16 +21,11 @@ #include "Common.h" #include "Log.h" -#include "ObjectMgr.h" -#include "SpellMgr.h" +#include "Creature.h" #include "Player.h" #include "Spell.h" #include "SpellAuras.h" -#include "Totem.h" -#include "Creature.h" -#include "Formulas.h" -#include "CreatureAI.h" -#include "ScriptMgr.h" +#include "SpellMgr.h" #include "Util.h" pAuraProcHandler AuraProcHandler[TOTAL_AURAS] = diff --git a/src/game/Weather.cpp b/src/game/Weather.cpp index cef61762b..2b5fecfee 100644 --- a/src/game/Weather.cpp +++ b/src/game/Weather.cpp @@ -27,6 +27,7 @@ #include "WorldSession.h" #include "Player.h" #include "Map.h" +#include "Opcodes.h" #include "World.h" #include "WorldPacket.h" #include "Log.h" diff --git a/src/game/World.cpp b/src/game/World.cpp index 7fe998e46..e1032873b 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -34,6 +34,7 @@ #include "WorldPacket.h" #include "Weather.h" #include "Player.h" +#include "Group.h" #include "AccountMgr.h" #include "AuctionHouseMgr.h" #include "ObjectMgr.h" @@ -50,7 +51,6 @@ #include "CreatureAIRegistry.h" #include "Policies/SingletonImp.h" #include "BattleGroundMgr.h" -#include "TemporarySummon.h" #include "VMapFactory.h" #include "GameEventMgr.h" #include "PoolManager.h" @@ -67,7 +67,6 @@ #include "AuctionHouseBotMgr.h" #include "Transports/TransportMgr.h" #include "PlayerBotMgr.h" -#include "ProgressBar.h" #include "ZoneScriptMgr.h" #include "CharacterDatabaseCache.h" #include "CreatureGroups.h" @@ -905,7 +904,7 @@ void World::LoadConfigSettings(bool reload) setConfig(CONFIG_BOOL_TERRAIN_PRELOAD_CONTINENTS, "Terrain.Preload.Continents", 1); setConfig(CONFIG_BOOL_TERRAIN_PRELOAD_INSTANCES, "Terrain.Preload.Instances", 1); - setConfig(CONFIG_BOOL_ENABLE_MOVEMENT_EXTRAPOLATION_PLAYER, "Movement.ExtrapolatePlayerPosition", true); + setConfig(CONFIG_BOOL_ENABLE_MOVEMENT_EXTRAPOLATION_CHARGE, "Movement.ExtrapolateChargePosition", true); setConfig(CONFIG_BOOL_ENABLE_MOVEMENT_EXTRAPOLATION_PET, "Movement.ExtrapolatePetPosition", true); setConfig(CONFIG_UINT32_MOVEMENT_CHANGE_ACK_TIME, "Movement.PendingAckResponseTime", 2000); setConfigMinMax(CONFIG_UINT32_MAX_POINTS_PER_MVT_PACKET, "Movement.MaxPointsPerPacket", 80, 5, 10000); diff --git a/src/game/World.h b/src/game/World.h index fbc730092..e815b6f81 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -30,7 +30,6 @@ #include "Timer.h" #include "Policies/Singleton.h" #include "SharedDefines.h" -#include "Nostalrius.h" #include "ObjectGuid.h" #include "Chat/AbstractPlayer.h" #include "WorldPacket.h" @@ -516,7 +515,7 @@ enum eConfigBoolValues CONFIG_BOOL_PET_UNSUMMON_AT_MOUNT, CONFIG_BOOL_ENABLE_DK, CONFIG_BOOL_ENABLE_CITY_PROTECTOR, - CONFIG_BOOL_ENABLE_MOVEMENT_EXTRAPOLATION_PLAYER, + CONFIG_BOOL_ENABLE_MOVEMENT_EXTRAPOLATION_CHARGE, CONFIG_BOOL_ENABLE_MOVEMENT_EXTRAPOLATION_PET, CONFIG_BOOL_WHISPER_RESTRICTION, CONFIG_BOOL_MAILSPAM_ITEM, diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 34410edec..14d68e949 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -36,7 +36,6 @@ #include "Guild.h" #include "GuildMgr.h" #include "World.h" -#include "ObjectAccessor.h" #include "BattleGroundMgr.h" #include "MapManager.h" #include "SocialMgr.h" @@ -45,10 +44,7 @@ #include "Anticheat.h" #include "Language.h" #include "Auth/Sha1.h" -#include "ChannelMgr.h" #include "Chat.h" -#include "Channel.h" -#include "AccountMgr.h" #include "MasterPlayer.h" // select opcodes appropriate for processing in Map::Update context for current session state diff --git a/src/game/vmap/GameObjectModel.h b/src/game/vmap/GameObjectModel.h index 6cda275da..59f79b5d0 100644 --- a/src/game/vmap/GameObjectModel.h +++ b/src/game/vmap/GameObjectModel.h @@ -24,7 +24,6 @@ #include #include #include "DBCStructure.h" -#include "GameObject.h" #include "Platform/Define.h" @@ -33,6 +32,7 @@ namespace VMAP class WorldModel; } +class GameObject; class GameObjectModel { diff --git a/src/mangosd/ChatSocket.cpp b/src/mangosd/ChatSocket.cpp index 6d5205859..ab8eb9c01 100644 --- a/src/mangosd/ChatSocket.cpp +++ b/src/mangosd/ChatSocket.cpp @@ -28,7 +28,6 @@ #include "Log.h" #include "ChatSocket.h" #include "World.h" -#include "Config/Config.h" #include "Util.h" #include "SharedDefines.h" #include "ObjectAccessor.h" @@ -36,6 +35,7 @@ #include "ObjectMgr.h" #include "AccountMgr.h" #include "Chat.h" +#include "Opcodes.h" #define DEBUG_OUT_CHAT(...) //sLog.outString(__VA_ARGS__) diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index a08e1266c..e8e191497 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -318,7 +318,7 @@ AsyncTasks.Threads = 1 AsyncQueriesTickTimeout = 0 # Movement extrapolation system - not stable now -Movement.ExtrapolatePlayerPosition = 0 +Movement.ExtrapolateChargePosition = 1 Movement.ExtrapolatePetPosition = 1 # Delayed repositionning checks (mounts inside / swimming ...). 0 to disable. diff --git a/src/scripts/CMakeLists.txt b/src/scripts/CMakeLists.txt index 0b49e7c99..a5e6d6d5c 100644 --- a/src/scripts/CMakeLists.txt +++ b/src/scripts/CMakeLists.txt @@ -372,7 +372,6 @@ if((${CMAKE_VERSION} VERSION_LESS "3.16") OR USE_PCH_OLD) else() set(PCHS ../game/Mail/Mail.h - ../game/Commands/Nostalrius.h ../game/ScriptMgr.h ../game/Objects/Object.h ../game/ObjectMgr.h diff --git a/src/scripts/PrecompiledHeaders/scriptPCH.h b/src/scripts/PrecompiledHeaders/scriptPCH.h index cae2848aa..30fbbb693 100644 --- a/src/scripts/PrecompiledHeaders/scriptPCH.h +++ b/src/scripts/PrecompiledHeaders/scriptPCH.h @@ -6,7 +6,6 @@ #define SC_PRECOMPILED_H #include "Mail.h" -#include "Nostalrius.h" #include "ScriptMgr.h" #include "Object.h" #include "ObjectMgr.h" diff --git a/src/scripts/battlegrounds/battleground_alterac.cpp b/src/scripts/battlegrounds/battleground_alterac.cpp index 9d0be2610..482f96a9c 100644 --- a/src/scripts/battlegrounds/battleground_alterac.cpp +++ b/src/scripts/battlegrounds/battleground_alterac.cpp @@ -6,6 +6,7 @@ SDCategory: BG EndScriptData */ #include "scriptPCH.h" +#include "CreatureGroups.h" /* Vanndar: Thunderclap (about 200-300 nature damage per player in range not been upgraded since vanilla, Time between attacks increased by 33%, movement speed reduced by 40%.) Storm Bolt (about 450 nature damage, stuns for 8 seconds, dispellable, used on non tanks) Avatar (50% increased damage and armor, up for 15 seconds, comes back up about 15-20 seconds later) Drek'thar: Whirlwind (2 second cast time, weapon damage to all in range) Frenzy (167% damage increase and attack speed increase by 50%, lasts 2 minutes, goes up after about 15-20 seconds from the start of fight) Knockdown (Infli diff --git a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/instance_blackrock_spire.cpp b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/instance_blackrock_spire.cpp index 76811f2a7..b19a19ff2 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/instance_blackrock_spire.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/blackrock_spire/instance_blackrock_spire.cpp @@ -24,6 +24,7 @@ EndScriptData */ #include "scriptPCH.h" #include "blackrock_spire.h" #include "WaypointManager.h" +#include "CreatureGroups.h" //#define DEBUG_ON diff --git a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_lucifron.cpp b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_lucifron.cpp index bae1237b9..d3f1064c4 100644 --- a/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_lucifron.cpp +++ b/src/scripts/eastern_kingdoms/burning_steppes/molten_core/boss_lucifron.cpp @@ -10,6 +10,7 @@ */ #include "scriptPCH.h" +#include "Utilities/EventMap.h" #include "molten_core.h" enum eSpells diff --git a/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/gnomeregan.cpp b/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/gnomeregan.cpp index d8b937370..dc34b2917 100644 --- a/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/gnomeregan.cpp +++ b/src/scripts/eastern_kingdoms/dun_morogh/gnomeregan/gnomeregan.cpp @@ -26,6 +26,7 @@ npc_blastmaster_emi_shortfuse EndContentData */ #include "scriptPCH.h" +#include "CreatureGroups.h" #include "gnomeregan.h" /*###### diff --git a/src/scripts/eastern_kingdoms/duskwood/duskwood.cpp b/src/scripts/eastern_kingdoms/duskwood/duskwood.cpp index 4e396cb76..3ab90e46b 100644 --- a/src/scripts/eastern_kingdoms/duskwood/duskwood.cpp +++ b/src/scripts/eastern_kingdoms/duskwood/duskwood.cpp @@ -14,6 +14,7 @@ npc_lord_ello_ebonlocke EndContentData */ #include "scriptPCH.h" +#include "CreatureGroups.h" enum NightmareCorruptionData { diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp b/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp index d17e77265..f0cdc224f 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/eastern_plaguelands.cpp @@ -26,6 +26,7 @@ mobs_ghoul_flayer EndContentData */ #include "scriptPCH.h" +#include "CreatureGroups.h" // Eris Havenfire event diff --git a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/naxxramas.h b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/naxxramas.h index 356130413..875c53afd 100644 --- a/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/naxxramas.h +++ b/src/scripts/eastern_kingdoms/eastern_plaguelands/naxxramas/naxxramas.h @@ -5,6 +5,9 @@ #ifndef DEF_NAXXRAMAS_H #define DEF_NAXXRAMAS_H +#include "scriptPCH.h" +#include "Utilities/EventMap.h" + enum NAXX_ENCOUNTERS_TYPES { TYPE_ANUB_REKHAN = 0, diff --git a/src/scripts/eastern_kingdoms/searing_gorge/searing_gorge.cpp b/src/scripts/eastern_kingdoms/searing_gorge/searing_gorge.cpp index 019a34aa8..577d7f5a9 100644 --- a/src/scripts/eastern_kingdoms/searing_gorge/searing_gorge.cpp +++ b/src/scripts/eastern_kingdoms/searing_gorge/searing_gorge.cpp @@ -26,6 +26,7 @@ npc_zamael_lunthistle EndContentData */ #include "scriptPCH.h" +#include "Group.h" /*###### ## npc_dorius_stonetender diff --git a/src/scripts/eastern_kingdoms/stormwind_city/quest_stormwind_rendezvous.cpp b/src/scripts/eastern_kingdoms/stormwind_city/quest_stormwind_rendezvous.cpp index 788ca917b..fe2a0079e 100644 --- a/src/scripts/eastern_kingdoms/stormwind_city/quest_stormwind_rendezvous.cpp +++ b/src/scripts/eastern_kingdoms/stormwind_city/quest_stormwind_rendezvous.cpp @@ -3,6 +3,7 @@ */ #include "scriptPCH.h" +#include "Group.h" #include "quest_stormwind_rendezvous.h" /* diff --git a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/instance_scarlet_monastery.cpp b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/instance_scarlet_monastery.cpp index c23c7ee53..9ec065e8a 100644 --- a/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/instance_scarlet_monastery.cpp +++ b/src/scripts/eastern_kingdoms/tirisfal_glades/scarlet_monastery/instance_scarlet_monastery.cpp @@ -22,6 +22,7 @@ SDCategory: Scarlet Monastery EndScriptData */ #include "scriptPCH.h" +#include "Utilities/EventMap.h" #include "scarlet_monastery.h" enum AshbringerEventMisc diff --git a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_vectus.cpp b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_vectus.cpp index 74536239c..c00dee1d2 100644 --- a/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_vectus.cpp +++ b/src/scripts/eastern_kingdoms/western_plaguelands/scholomance/boss_vectus.cpp @@ -22,6 +22,7 @@ SDCategory: Scholomance EndScriptData */ #include "scriptPCH.h" +#include "CreatureGroups.h" #include "scholomance.h" enum diff --git a/src/scripts/kalimdor/desolace/desolace.cpp b/src/scripts/kalimdor/desolace/desolace.cpp index 3de7050d6..6fe257f91 100644 --- a/src/scripts/kalimdor/desolace/desolace.cpp +++ b/src/scripts/kalimdor/desolace/desolace.cpp @@ -28,6 +28,7 @@ EndContentData */ #include "scriptPCH.h" #include "MoveMapSharedDefines.h" +#include "CreatureGroups.h" /*###### ## go_hand_of_iruxos_crystal diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp index cd691cbc7..3778e86ef 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/boss_rajaxx.cpp @@ -23,6 +23,8 @@ EndScriptData */ #include "scriptPCH.h" +#include "CreatureGroups.h" +#include "Group.h" #include "ruins_of_ahnqiraj.h" #define GOSSIP_START "Let's find out." diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp index c9278e26b..8f36960f8 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/instance_ruins_of_ahnqiraj.cpp @@ -22,6 +22,7 @@ SDCategory: Ruins of Ahn'Qiraj EndScriptData */ #include "scriptPCH.h" +#include "CreatureGroups.h" #include "ruins_of_ahnqiraj.h" instance_ruins_of_ahnqiraj::instance_ruins_of_ahnqiraj(Map* pMap) : ScriptedInstance(pMap) diff --git a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.cpp b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.cpp index cae283a75..5573398aa 100644 --- a/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.cpp +++ b/src/scripts/kalimdor/silithus/ruins_of_ahnqiraj/ruins_of_ahnqiraj.cpp @@ -27,6 +27,7 @@ mob_flesh_hunter EndContentData */ #include "scriptPCH.h" +#include "CreatureGroups.h" #include "ruins_of_ahnqiraj.h" // Anubisath guardian diff --git a/src/scripts/kalimdor/silithus/silithus.cpp b/src/scripts/kalimdor/silithus/silithus.cpp index d64e03dea..37ee1e1b3 100644 --- a/src/scripts/kalimdor/silithus/silithus.cpp +++ b/src/scripts/kalimdor/silithus/silithus.cpp @@ -27,8 +27,8 @@ EndContentData */ #include "scriptPCH.h" -#include "Database/DatabaseEnv.h" #include "HardcodedEvents.h" +#include "CreatureGroups.h" enum { diff --git a/src/scripts/world/fireworks_show.cpp b/src/scripts/world/fireworks_show.cpp index d3a97dc4d..b29109182 100644 --- a/src/scripts/world/fireworks_show.cpp +++ b/src/scripts/world/fireworks_show.cpp @@ -16,6 +16,7 @@ */ #include "scriptPCH.h" +#include "Utilities/EventMap.h" #include enum FireworksShowTypeObjects diff --git a/src/scripts/world/go_scripts.cpp b/src/scripts/world/go_scripts.cpp index 785c57ec4..92ac388fa 100644 --- a/src/scripts/world/go_scripts.cpp +++ b/src/scripts/world/go_scripts.cpp @@ -41,6 +41,7 @@ go_darkmoon_faire_music EndContentData */ #include "scriptPCH.h" +#include "Utilities/EventMap.h" /*###### ## go_cat_figurine