diff options
| author | Kittnz <Kittnz@users.noreply.github.com> | 2017-10-26 11:27:44 +0200 |
|---|---|---|
| committer | funjoker <funjoker109@gmail.com> | 2021-01-13 22:04:52 +0100 |
| commit | 097335f2c4db5ce8ff773ec73b179a1f26b504fe (patch) | |
| tree | 940bfef7a45fb3c371c1c57ee43723b5eb72939f /src | |
| parent | 7a21d02da12667e6e873163de83fa3cb25d028aa (diff) | |
Core/SAI: Add distance option for SMART_ACTION_SOUND & SMART_ACTION_RANDOM_SOUND (#20717)
(cherry picked from commit 37995ade2991ed27845728eb6a6dd95f3a490849)
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 13 | ||||
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.h | 5 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 3a18f984137..42c0c126a48 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -297,7 +297,11 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (IsUnit(target)) { - target->PlayDirectSound(e.action.sound.sound, e.action.sound.onlySelf ? target->ToPlayer() : nullptr, e.action.sound.keyBroadcastTextId); + if (e.action.sound.distance == 1) + target->PlayDistanceSound(e.action.sound.sound, e.action.sound.onlySelf ? target->ToPlayer() : nullptr); + else + target->PlayDirectSound(e.action.sound.sound, e.action.sound.onlySelf ? target->ToPlayer() : nullptr, e.action.sound.keyBroadcastTextId); + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (%s), sound: %u, onlyself: %u", target->GetName().c_str(), target->GetGUID().ToString().c_str(), e.action.sound.sound, e.action.sound.onlySelf); } @@ -2092,7 +2096,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsUnit(target)) { uint32 sound = Trinity::Containers::SelectRandomContainerElement(sounds); - target->PlayDirectSound(sound, onlySelf ? target->ToPlayer() : nullptr); + + if (e.action.randomSound.distance == 1) + target->PlayDistanceSound(sound, onlySelf ? target->ToPlayer() : nullptr); + else + target->PlayDirectSound(sound, onlySelf ? target->ToPlayer() : nullptr); + TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_RANDOM_SOUND: target: %s (%s), sound: %u, onlyself: %s", target->GetName().c_str(), target->GetGUID().ToString().c_str(), sound, onlySelf ? "true" : "false"); } diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 3039afd29bf..a09c84c9072 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -625,7 +625,7 @@ struct SmartAction { uint32 sound; uint32 onlySelf; - uint32 distance; // NYI: awaiting cherry-pick + uint32 distance; uint32 keyBroadcastTextId; } sound; @@ -1095,8 +1095,9 @@ struct SmartAction struct { - uint32 sounds[SMART_ACTION_PARAM_COUNT - 1]; + uint32 sounds[SMART_ACTION_PARAM_COUNT - 2]; uint32 onlySelf; + uint32 distance; } randomSound; struct |
