Пример #1
0
        public void SendSound(Creature source, uint sound, ChatMsg msgType, WorldObject whisperTarget = null, CreatureTextRange range = CreatureTextRange.Normal, Team team = Team.Other, bool gmOnly = false, uint keyBroadcastTextId = 0, SoundKitPlayType playType = SoundKitPlayType.Normal)
        {
            if (sound == 0 || !source)
            {
                return;
            }

            if (playType == SoundKitPlayType.ObjectSound)
            {
                PlayObjectSound pkt = new();
                pkt.TargetObjectGUID = whisperTarget.GetGUID();
                pkt.SourceObjectGUID = source.GetGUID();
                pkt.SoundKitID       = sound;
                pkt.Position         = whisperTarget.GetWorldLocation();
                pkt.BroadcastTextID  = (int)keyBroadcastTextId;
                SendNonChatPacket(source, pkt, msgType, whisperTarget, range, team, gmOnly);
            }
            else if (playType == SoundKitPlayType.Normal)
            {
                SendNonChatPacket(source, new PlaySound(source.GetGUID(), sound, keyBroadcastTextId), msgType, whisperTarget, range, team, gmOnly);
            }
        }