Core/Object: Implemented helper method PlayObjectSound

Port From (https://github.com/TrinityCore/TrinityCore/commit/35e5da37bdbbac355e454c5cbabe5991b7966709)
This commit is contained in:
hondacrx
2023-09-14 02:51:26 -04:00
parent ae837fb074
commit 0e2b551b06
@@ -2960,6 +2960,21 @@ namespace Game.Entities
SendMessageToSet(new PlayMusic(musicId), true);
}
void PlayObjectSound(uint soundKitId, ObjectGuid targetObjectGUID, Player target = null, int broadcastTextId = 0)
{
PlayObjectSound pkt = new();
pkt.TargetObjectGUID = targetObjectGUID;
pkt.SourceObjectGUID = GetGUID();
pkt.SoundKitID = soundKitId;
pkt.Position = GetPosition();
pkt.BroadcastTextID = broadcastTextId;
if (target)
target.SendPacket(pkt);
else
SendMessageToSet(pkt, true);
}
public void DestroyForNearbyPlayers()
{
if (!IsInWorld)