diff --git a/src/game/Chat/MonsterChatBuilder.h b/src/game/Chat/MonsterChatBuilder.h index 508de7cbd..e2917c6a9 100644 --- a/src/game/Chat/MonsterChatBuilder.h +++ b/src/game/Chat/MonsterChatBuilder.h @@ -23,9 +23,6 @@ #include "Chat.h" #include "ObjectMgr.h" -struct CreatureInfo; -class WorldObject; - namespace MaNGOS { class MonsterChatBuilderFormat diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index b58718afd..ca6828fa6 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -2952,7 +2952,7 @@ void Map::SendMonsterTextToMap(int32 textId, Language language, ChatMsg chatMsg, return; } - MaNGOS::StaticMonsterChatBuilder say_build(cInfo, chatMsg, textId, language, pTarget, 0); + MaNGOS::StaticMonsterChatBuilder say_build(cInfo, chatMsg, textId, language, pTarget); MaNGOS::LocalizedPacketDo say_do(say_build); Map::PlayerList const& pList = GetPlayers(); diff --git a/src/game/Maps/Map.h b/src/game/Maps/Map.h index 2a2427fdb..f719a6938 100644 --- a/src/game/Maps/Map.h +++ b/src/game/Maps/Map.h @@ -445,12 +445,15 @@ class Map : public GridRefManager uint32 GetPlayersCountExceptGMs() const; bool ActiveObjectsNearGrid(uint32 x,uint32 y) const; - // Send a Packet to all players on a map + // Send a Packet to all players in the map void SendToPlayers(WorldPacket const* data, Team team = TEAM_NONE) const; - // Send a Packet to all players in a zone. Return false if no player found - bool SendToPlayersInZone(WorldPacket const* data, uint32 zoneId) const; void SendDefenseMessage(int32 textId, uint32 zoneId) const; + void SendMonsterTextToMap(int32 textId, Language language, ChatMsg chatMsg, uint32 creatureId, WorldObject const* pSource = nullptr, Unit const* pTarget = nullptr); + // Send a Packet to all players in a zone + bool SendToPlayersInZone(WorldPacket const* data, uint32 zoneId) const; // return false if no player found + void PlayDirectSoundToMap(uint32 soundId, uint32 zoneId = 0) const; + typedef MapRefManager PlayerList; PlayerList const& GetPlayers() const { return m_mapRefManager; } @@ -540,10 +543,7 @@ class Map : public GridRefManager InstanceData* GetInstanceData() { return i_data; } InstanceData const* GetInstanceData() const { return i_data; } uint32 GetScriptId() const { return i_script_id; } - - void SendMonsterTextToMap(int32 textId, Language language, ChatMsg chatMsg, uint32 creatureId, WorldObject const* pSource = nullptr, Unit const* pTarget = nullptr); - void PlayDirectSoundToMap(uint32 soundId, uint32 zoneId = 0) const; - + // GameObjectCollision float GetHeight(float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const; bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, bool checkDynLos = true, bool ignoreM2Model = true) const; diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp index 53ddd9646..dfcac2c21 100644 --- a/src/game/ScriptMgr.cpp +++ b/src/game/ScriptMgr.cpp @@ -2630,21 +2630,17 @@ void DoScriptText(int32 textId, WorldObject* pSource, Unit* pTarget, int32 chatT } } - -/** - * Function that either simulates or does script text for a map - * - * @param textId Entry of the text, stored in SD2-database, only type CHAT_TYPE_ZONE_YELL supported - * @param creatureId Id of the creature of whom saying will be simulated - * @param pMap Given Map on which the map-wide text is displayed - * @param pSource Can be nullptr. If pointer to Creature is given, then the creature does the map-wide text - * @param pTarget Can be nullptr. Possible target for the text - */ void DoOrSimulateScriptTextForMap(int32 textId, uint32 creatureId, Map* pMap, Creature* pSource /*= nullptr*/, Unit* pTarget /*= nullptr*/) { if (!pMap) { - sLog.outError("DoOrSimulateScriptTextForMap entry %i, invalid Map pointer.", textId); + sLog.outError("DoOrSimulateScriptTextForMap call for text %i without a valid map!", textId); + return; + } + + if (!creatureId && !pSource) + { + sLog.outError("DoOrSimulateScriptTextForMap call for text %i without a valid source!", textId); return; } @@ -2684,7 +2680,7 @@ void DoOrSimulateScriptTextForMap(int32 textId, uint32 creatureId, Map* pMap, Cr } } - sLog.outDebug("SD2: DoOrSimulateScriptTextForMap: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", + sLog.outDebug("SD2: DoOrSimulateScriptTextForMap: textId=%i, soundId=%u, chatType=%u, languageId=%u, emoteId=%u", textId, soundId, chatType, languageId, emoteId); uint8 chatMsg; @@ -2912,4 +2908,4 @@ WorldObject* GetTargetByType(WorldObject* pSource, WorldObject* pTarget, Map* pM break; } return nullptr; -} \ No newline at end of file +}