From a47d2e1c22237e1b2337e89b0f1d910cca68b6ed Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 22 Mar 2009 19:20:03 -0600 Subject: *Note some script id are changed. DB change may be needed. [7518] Implement new script command SCRIPT_COMMAND_PLAY_SOUND (look in World.h for args) Author: VladimirMangos * Also rewrite use SMSG_PLAY_OBJECT_SOUND/SMSG_PLAY_SOUND Now WorldObject have 2 function for sound level dependent from distance (PlayDistanceSound) and for not depednet (PlayDirectSound) * Old Player::PlaySound function removed and uses need to be updated to WorldObject functions Note: function called for _source_ of sound in different from old function. * chat command .debug ps removed and .debug playsound can used for bother packects test: if no selection used SMSG_PLAY_SOUND, if selection exist including self then SMSG_PLAY_OBJECT_SOUND. --HG-- branch : trunk --- src/game/Object.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/game/Object.cpp') diff --git a/src/game/Object.cpp b/src/game/Object.cpp index b6069fe1ae1..26405d13cf7 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1884,3 +1884,24 @@ void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update) if(update && IsInWorld()) ObjectAccessor::UpdateObjectVisibility(this); } + +void WorldObject::PlayDistanceSound( uint32 sound_id, Player* target /*= NULL*/ ) +{ + WorldPacket data(SMSG_PLAY_OBJECT_SOUND,4+8); + data << uint32(sound_id); + data << GetGUID(); + if (target) + target->SendDirectMessage( &data ); + else + SendMessageToSet( &data, true ); +} + +void WorldObject::PlayDirectSound( uint32 sound_id, Player* target /*= NULL*/ ) +{ + WorldPacket data(SMSG_PLAY_SOUND, 4); + data << uint32(sound_id); + if (target) + target->SendDirectMessage( &data ); + else + SendMessageToSet( &data, true ); +} -- cgit v1.2.3