fix: suppress spell sounds and melee swing for crafting/profession spells
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run

Crafting spells (bandages, smelting, etc.) were playing magic precast/
cast-complete audio and triggering melee weapon swing animations because
they have physical school mask (1). Re-add isProfessionSpell check to
skip spell sounds and melee animation for tradeskill spells. The
character still plays the generic cast animation via spellCastAnimCallback.
This commit is contained in:
Kelsi 2026-03-24 14:33:22 -07:00
parent 432da20b3e
commit 6bfa3dc402

View file

@ -19592,7 +19592,9 @@ void GameHandler::handleSpellStart(network::Packet& packet) {
castTimeRemaining = castTimeTotal; castTimeRemaining = castTimeTotal;
if (addonEventCallback_) addonEventCallback_("CURRENT_SPELL_CAST_CHANGED", {}); if (addonEventCallback_) addonEventCallback_("CURRENT_SPELL_CAST_CHANGED", {});
// Play precast sound with correct magic school (including crafting spells) // Play precast sound — skip profession/tradeskill spells (they use crafting
// animations/sounds, not magic spell audio).
if (!isProfessionSpell(data.spellId)) {
if (auto* renderer = core::Application::getInstance().getRenderer()) { if (auto* renderer = core::Application::getInstance().getRenderer()) {
if (auto* ssm = renderer->getSpellSoundManager()) { if (auto* ssm = renderer->getSpellSoundManager()) {
loadSpellNameCache(); loadSpellNameCache();
@ -19603,6 +19605,7 @@ void GameHandler::handleSpellStart(network::Packet& packet) {
ssm->playPrecast(school, audio::SpellSoundManager::SpellPower::MEDIUM); ssm->playPrecast(school, audio::SpellSoundManager::SpellPower::MEDIUM);
} }
} }
}
// Trigger cast animation on player character // Trigger cast animation on player character
if (spellCastAnimCallback_) { if (spellCastAnimCallback_) {
@ -19636,7 +19639,8 @@ void GameHandler::handleSpellGo(network::Packet& packet) {
// Cast completed // Cast completed
if (data.casterUnit == playerGuid) { if (data.casterUnit == playerGuid) {
// Play cast-complete sound with correct magic school (including crafting) // Play cast-complete sound — skip profession spells (no magic sound for crafting)
if (!isProfessionSpell(data.spellId)) {
if (auto* renderer = core::Application::getInstance().getRenderer()) { if (auto* renderer = core::Application::getInstance().getRenderer()) {
if (auto* ssm = renderer->getSpellSoundManager()) { if (auto* ssm = renderer->getSpellSoundManager()) {
loadSpellNameCache(); loadSpellNameCache();
@ -19647,14 +19651,16 @@ void GameHandler::handleSpellGo(network::Packet& packet) {
ssm->playCast(school); ssm->playCast(school);
} }
} }
}
// Instant melee abilities → trigger attack animation // Instant melee abilities → trigger attack animation
// Detect via physical school mask (1 = Physical) from the spell DBC cache. // Detect via physical school mask (1 = Physical) from the spell DBC cache.
// Skip profession spells — crafting should not swing weapons.
// This covers warrior, rogue, DK, paladin, feral druid, and hunter melee // This covers warrior, rogue, DK, paladin, feral druid, and hunter melee
// abilities generically instead of maintaining a brittle per-spell-ID list. // abilities generically instead of maintaining a brittle per-spell-ID list.
uint32_t sid = data.spellId; uint32_t sid = data.spellId;
bool isMeleeAbility = false; bool isMeleeAbility = false;
{ if (!isProfessionSpell(sid)) {
loadSpellNameCache(); loadSpellNameCache();
auto cacheIt = spellNameCache_.find(sid); auto cacheIt = spellNameCache_.find(sid);
if (cacheIt != spellNameCache_.end() && cacheIt->second.schoolMask == 1) { if (cacheIt != spellNameCache_.end() && cacheIt->second.schoolMask == 1) {