[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
*
* @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);
data << uint32(soundId);
Map::PlayerList const& pList = GetPlayers();
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);
}