[11812] Add possibility to send sound only to a zone in Map::PlayDirectSoundToMap

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
stfx 2011-10-06 15:19:56 +02:00 committed by Schmoozerd
parent 379ef94aa7
commit 35ad6b2ae5
3 changed files with 6 additions and 4 deletions

View file

@ -3230,13 +3230,15 @@ void Map::MonsterYellToMap(CreatureInfo const* cinfo, int32 textId, uint32 langu
* Function to play sound to all players in map * Function to play sound to all players in map
* *
* @param soundId Played Sound * @param soundId Played Sound
* @param zoneId Id of the Zone to which the sound should be restricted
*/ */
void Map::PlayDirectSoundToMap(uint32 soundId) void Map::PlayDirectSoundToMap(uint32 soundId, uint32 zoneId /*=0*/)
{ {
WorldPacket data(SMSG_PLAY_SOUND, 4); WorldPacket data(SMSG_PLAY_SOUND, 4);
data << uint32(soundId); data << uint32(soundId);
Map::PlayerList const& pList = GetPlayers(); Map::PlayerList const& pList = GetPlayers();
for (PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) for (PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
itr->getSource()->SendDirectMessage(&data); if (!zoneId || itr->getSource()->GetZoneId() == zoneId)
itr->getSource()->SendDirectMessage(&data);
} }

View file

@ -257,7 +257,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
void MonsterYellToMap(ObjectGuid guid, int32 textId, uint32 language, Unit* target); void MonsterYellToMap(ObjectGuid guid, int32 textId, uint32 language, Unit* target);
void MonsterYellToMap(CreatureInfo const* cinfo, int32 textId, uint32 language, Unit* target, uint32 senderLowGuid = 0); void MonsterYellToMap(CreatureInfo const* cinfo, int32 textId, uint32 language, Unit* target, uint32 senderLowGuid = 0);
void PlayDirectSoundToMap(uint32 soundId); void PlayDirectSoundToMap(uint32 soundId, uint32 zoneId = 0);
private: private:
void LoadMapAndVMap(int gx, int gy); void LoadMapAndVMap(int gx, int gy);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11811" #define REVISION_NR "11812"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__