fix/feat: (Core/PacketIO): updated sound and creature addon (#10813)

* fix\feat: (Core/PacketIO): updated sound and creature addon

updated SMSG_PLAY_SOUND, SMSG_PLAY_MUSIC and SMSG_PLAY_OBJECT_SOUND via tc cherry pick
https://github.com/TrinityCore/TrinityCore/pull/2363 and 0f1f7ef401 by @joschiwald  and @ForesterDev
This so far a attempt to align atleast with sound with tc, and correct a potentional issue of hearing creature sounds that is not in visible range. I notice PlaySound was being defined in some weird dependency as it isnt with tc so I renamed it to Playsound. Notice a isLarge still being used in the creature addon when it was depreciated, so i removed that a that seem to of interfered with visibilitydistanceType.

Co-Authored-By: joschiwald <736792+joschiwald@users.noreply.github.com>
Co-Authored-By: ForesterDev <11771800+ForesterDev@users.noreply.github.com>
This commit is contained in:
acidmanifesto
2022-02-26 10:05:58 -05:00
committed by GitHub
parent ea497f2b6e
commit 69e2f2e3aa
20 changed files with 120 additions and 104 deletions

View File

@@ -27,6 +27,7 @@
#include "GridNotifiers.h"
#include "Log.h"
#include "MapMgr.h"
#include "MiscPackets.h"
#include "MovementPacketBuilder.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
@@ -2809,36 +2810,29 @@ void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update)
void WorldObject::PlayDistanceSound(uint32 sound_id, Player* target /*= nullptr*/)
{
WorldPacket data(SMSG_PLAY_OBJECT_SOUND, 4 + 8);
data << uint32(sound_id);
data << GetGUID();
if (target)
target->SendDirectMessage(&data);
target->SendDirectMessage(WorldPackets::Misc::PlayObjectSound(GetGUID(), sound_id).Write());
else
SendMessageToSet(&data, true);
SendMessageToSet(WorldPackets::Misc::PlayObjectSound(GetGUID(), sound_id).Write(), true);
}
void WorldObject::PlayDirectSound(uint32 sound_id, Player* target /*= nullptr*/)
{
WorldPacket data(SMSG_PLAY_SOUND, 4);
data << uint32(sound_id);
if (target)
target->SendDirectMessage(&data);
target->SendDirectMessage(WorldPackets::Misc::Playsound(sound_id).Write());
else
SendMessageToSet(&data, true);
SendMessageToSet(WorldPackets::Misc::Playsound(sound_id).Write(), true);
}
void WorldObject::PlayDirectMusic(uint32 music_id, Player* target /*= nullptr*/)
{
WorldPacket data(SMSG_PLAY_MUSIC, 4);
data << uint32(music_id);
if (target)
{
target->SendDirectMessage(&data);
target->SendDirectMessage(WorldPackets::Misc::PlayMusic(music_id).Write());
}
else
{
SendMessageToSet(&data, true);
SendMessageToSet(WorldPackets::Misc::PlayMusic(music_id).Write(), true);
}
}