Core/Chat: Send broadcast text id in sound packets to allow playing encrypted sound files
Port From (https://github.com/TrinityCore/TrinityCore/commit/2e4609f6e18c181fbb54ec851a9ccd5bd3c6eb7b)
This commit is contained in:
@@ -2416,6 +2416,8 @@ namespace Game.AI
|
||||
{
|
||||
public uint soundId;
|
||||
public uint onlySelf;
|
||||
public uint distance; // NYI: awaiting cherry-pick
|
||||
public uint keyBroadcastTextId;
|
||||
}
|
||||
public struct Emote
|
||||
{
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace Game.AI
|
||||
{
|
||||
if (IsUnit(target))
|
||||
{
|
||||
target.PlayDirectSound(e.Action.sound.soundId, e.Action.sound.onlySelf != 0 ? target.ToPlayer() : null);
|
||||
target.PlayDirectSound(e.Action.sound.soundId, e.Action.sound.onlySelf != 0 ? target.ToPlayer() : null, e.Action.sound.keyBroadcastTextId);
|
||||
Log.outDebug(LogFilter.ScriptsAi, "SmartScript.ProcessAction. SMART_ACTION_SOUND: target: {0} (GuidLow: {1}), sound: {2}, onlyself: {3}",
|
||||
target.GetName(), target.GetGUID().ToString(), e.Action.sound.soundId, e.Action.sound.onlySelf);
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ namespace Game.BattleFields
|
||||
|
||||
void DoPlaySoundToAll(uint soundID)
|
||||
{
|
||||
BroadcastPacketToWar(new PlaySound(ObjectGuid.Empty, soundID));
|
||||
BroadcastPacketToWar(new PlaySound(ObjectGuid.Empty, soundID, 0));
|
||||
}
|
||||
|
||||
public bool HasPlayer(Player player)
|
||||
|
||||
@@ -567,12 +567,12 @@ namespace Game.BattleGrounds
|
||||
|
||||
public void PlaySoundToAll(uint soundID)
|
||||
{
|
||||
SendPacketToAll(new PlaySound(ObjectGuid.Empty, soundID));
|
||||
SendPacketToAll(new PlaySound(ObjectGuid.Empty, soundID, 0));
|
||||
}
|
||||
|
||||
void PlaySoundToTeam(uint soundID, Team team)
|
||||
{
|
||||
SendPacketToTeam(team, new PlaySound(ObjectGuid.Empty, soundID));
|
||||
SendPacketToTeam(team, new PlaySound(ObjectGuid.Empty, soundID, 0));
|
||||
}
|
||||
|
||||
public void CastSpellOnTeam(uint SpellID, Team team)
|
||||
|
||||
@@ -1834,7 +1834,9 @@ namespace Game.Chat
|
||||
return false;
|
||||
}
|
||||
|
||||
Global.WorldMgr.SendGlobalMessage(new PlaySound(handler.GetSession().GetPlayer().GetGUID(), soundId));
|
||||
uint broadcastTextId = args.NextUInt32();
|
||||
|
||||
Global.WorldMgr.SendGlobalMessage(new PlaySound(handler.GetSession().GetPlayer().GetGUID(), soundId, broadcastTextId));
|
||||
|
||||
handler.SendSysMessage(CypherStrings.CommandPlayedToAll, soundId);
|
||||
return true;
|
||||
|
||||
@@ -1618,9 +1618,9 @@ namespace Game.Entities
|
||||
SendMessageToSet(playSpeakerBoxSound, true);
|
||||
}
|
||||
|
||||
public void PlayDirectSound(uint soundId, Player target = null)
|
||||
public void PlayDirectSound(uint soundId, Player target = null, uint broadcastTextId = 0)
|
||||
{
|
||||
PlaySound sound = new PlaySound(GetGUID(), soundId);
|
||||
PlaySound sound = new PlaySound(GetGUID(), soundId, broadcastTextId);
|
||||
if (target)
|
||||
target.SendPacket(sound);
|
||||
else
|
||||
|
||||
@@ -885,22 +885,23 @@ namespace Game.Networking.Packets
|
||||
|
||||
class PlaySound : ServerPacket
|
||||
{
|
||||
public PlaySound(ObjectGuid sourceObjectGuid, uint soundKitID) : base(ServerOpcodes.PlaySound)
|
||||
public PlaySound(ObjectGuid sourceObjectGuid, uint soundKitID, uint broadcastTextId) : base(ServerOpcodes.PlaySound)
|
||||
{
|
||||
SourceObjectGuid = sourceObjectGuid;
|
||||
SoundKitID = soundKitID;
|
||||
BroadcastTextID = broadcastTextId;
|
||||
}
|
||||
|
||||
public override void Write()
|
||||
{
|
||||
_worldPacket.WriteUInt32(SoundKitID);
|
||||
_worldPacket.WritePackedGuid(SourceObjectGuid);
|
||||
_worldPacket.WriteInt32(BroadcastTextID);
|
||||
_worldPacket.WriteUInt32(BroadcastTextID);
|
||||
}
|
||||
|
||||
public ObjectGuid SourceObjectGuid;
|
||||
public uint SoundKitID;
|
||||
public int BroadcastTextID;
|
||||
public uint BroadcastTextID;
|
||||
}
|
||||
|
||||
class PlaySpeakerBoxSound : ServerPacket
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace Game
|
||||
range = textEntry.TextRange;
|
||||
|
||||
if (finalSound != 0)
|
||||
SendSound(source, finalSound, finalType, whisperTarget, range, team, gmOnly);
|
||||
SendSound(source, finalSound, finalType, whisperTarget, range, team, gmOnly, textEntry.BroadcastTextId);
|
||||
|
||||
Unit finalSource = source;
|
||||
if (srcPlr)
|
||||
@@ -256,12 +256,12 @@ namespace Game
|
||||
return dist;
|
||||
}
|
||||
|
||||
public void SendSound(Creature source, uint sound, ChatMsg msgType, WorldObject whisperTarget = null, CreatureTextRange range = CreatureTextRange.Normal, Team team = Team.Other, bool gmOnly = false)
|
||||
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)
|
||||
{
|
||||
if (sound == 0 || !source)
|
||||
return;
|
||||
|
||||
SendNonChatPacket(source, new PlaySound(source.GetGUID(), sound), msgType, whisperTarget, range, team, gmOnly);
|
||||
SendNonChatPacket(source, new PlaySound(source.GetGUID(), sound, keyBroadcastTextId), msgType, whisperTarget, range, team, gmOnly);
|
||||
}
|
||||
|
||||
void SendNonChatPacket(WorldObject source, ServerPacket data, ChatMsg msgType, WorldObject whisperTarget, CreatureTextRange range, Team team, bool gmOnly)
|
||||
|
||||
Reference in New Issue
Block a user