feat(Core/Object): Play radius sound/music. (#18011)
This commit is contained in:
@@ -2883,6 +2883,22 @@ void WorldObject::PlayDirectSound(uint32 sound_id, Player* target /*= nullptr*/)
|
|||||||
SendMessageToSet(WorldPackets::Misc::Playsound(sound_id).Write(), true);
|
SendMessageToSet(WorldPackets::Misc::Playsound(sound_id).Write(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldObject::PlayRadiusSound(uint32 sound_id, float radius)
|
||||||
|
{
|
||||||
|
std::list<Player*> targets;
|
||||||
|
Acore::AnyPlayerInObjectRangeCheck check(this, radius, false);
|
||||||
|
Acore::PlayerListSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(this, targets, check);
|
||||||
|
Cell::VisitWorldObjects(this, searcher, radius);
|
||||||
|
|
||||||
|
for (Player* player : targets)
|
||||||
|
{
|
||||||
|
if (player)
|
||||||
|
{
|
||||||
|
player->SendDirectMessage(WorldPackets::Misc::Playsound(sound_id).Write());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WorldObject::PlayDirectMusic(uint32 music_id, Player* target /*= nullptr*/)
|
void WorldObject::PlayDirectMusic(uint32 music_id, Player* target /*= nullptr*/)
|
||||||
{
|
{
|
||||||
if (target)
|
if (target)
|
||||||
@@ -2895,6 +2911,22 @@ void WorldObject::PlayDirectMusic(uint32 music_id, Player* target /*= nullptr*/)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldObject::PlayRadiusMusic(uint32 music_id, float radius)
|
||||||
|
{
|
||||||
|
std::list<Player*> targets;
|
||||||
|
Acore::AnyPlayerInObjectRangeCheck check(this, radius, false);
|
||||||
|
Acore::PlayerListSearcher<Acore::AnyPlayerInObjectRangeCheck> searcher(this, targets, check);
|
||||||
|
Cell::VisitWorldObjects(this, searcher, radius);
|
||||||
|
|
||||||
|
for (Player* player : targets)
|
||||||
|
{
|
||||||
|
if (player)
|
||||||
|
{
|
||||||
|
player->SendDirectMessage(WorldPackets::Misc::PlayMusic(music_id).Write());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WorldObject::DestroyForNearbyPlayers()
|
void WorldObject::DestroyForNearbyPlayers()
|
||||||
{
|
{
|
||||||
if (!IsInWorld())
|
if (!IsInWorld())
|
||||||
|
|||||||
@@ -487,7 +487,9 @@ public:
|
|||||||
|
|
||||||
void PlayDistanceSound(uint32 sound_id, Player* target = nullptr);
|
void PlayDistanceSound(uint32 sound_id, Player* target = nullptr);
|
||||||
void PlayDirectSound(uint32 sound_id, Player* target = nullptr);
|
void PlayDirectSound(uint32 sound_id, Player* target = nullptr);
|
||||||
|
void PlayRadiusSound(uint32 sound_id, float radius);
|
||||||
void PlayDirectMusic(uint32 music_id, Player* target = nullptr);
|
void PlayDirectMusic(uint32 music_id, Player* target = nullptr);
|
||||||
|
void PlayRadiusMusic(uint32 music_id, float radius);
|
||||||
|
|
||||||
void SendObjectDeSpawnAnim(ObjectGuid guid);
|
void SendObjectDeSpawnAnim(ObjectGuid guid);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user