feat(Core/Object): Play radius sound/music. (#18011)
This commit is contained in:
parent
4d40b03644
commit
06525cdc1e
2 changed files with 34 additions and 0 deletions
|
|
@ -2883,6 +2883,22 @@ void WorldObject::PlayDirectSound(uint32 sound_id, Player* target /*= nullptr*/)
|
|||
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*/)
|
||||
{
|
||||
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()
|
||||
{
|
||||
if (!IsInWorld())
|
||||
|
|
|
|||
|
|
@ -487,7 +487,9 @@ public:
|
|||
|
||||
void PlayDistanceSound(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 PlayRadiusMusic(uint32 music_id, float radius);
|
||||
|
||||
void SendObjectDeSpawnAnim(ObjectGuid guid);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue