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,15 +19592,18 @@ 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
if (auto* renderer = core::Application::getInstance().getRenderer()) { // animations/sounds, not magic spell audio).
if (auto* ssm = renderer->getSpellSoundManager()) { if (!isProfessionSpell(data.spellId)) {
loadSpellNameCache(); if (auto* renderer = core::Application::getInstance().getRenderer()) {
auto it = spellNameCache_.find(data.spellId); if (auto* ssm = renderer->getSpellSoundManager()) {
auto school = (it != spellNameCache_.end() && it->second.schoolMask) loadSpellNameCache();
? schoolMaskToMagicSchool(it->second.schoolMask) auto it = spellNameCache_.find(data.spellId);
: audio::SpellSoundManager::MagicSchool::ARCANE; auto school = (it != spellNameCache_.end() && it->second.schoolMask)
ssm->playPrecast(school, audio::SpellSoundManager::SpellPower::MEDIUM); ? schoolMaskToMagicSchool(it->second.schoolMask)
: audio::SpellSoundManager::MagicSchool::ARCANE;
ssm->playPrecast(school, audio::SpellSoundManager::SpellPower::MEDIUM);
}
} }
} }
@ -19636,25 +19639,28 @@ 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 (auto* renderer = core::Application::getInstance().getRenderer()) { if (!isProfessionSpell(data.spellId)) {
if (auto* ssm = renderer->getSpellSoundManager()) { if (auto* renderer = core::Application::getInstance().getRenderer()) {
loadSpellNameCache(); if (auto* ssm = renderer->getSpellSoundManager()) {
auto it = spellNameCache_.find(data.spellId); loadSpellNameCache();
auto school = (it != spellNameCache_.end() && it->second.schoolMask) auto it = spellNameCache_.find(data.spellId);
? schoolMaskToMagicSchool(it->second.schoolMask) auto school = (it != spellNameCache_.end() && it->second.schoolMask)
: audio::SpellSoundManager::MagicSchool::ARCANE; ? schoolMaskToMagicSchool(it->second.schoolMask)
ssm->playCast(school); : audio::SpellSoundManager::MagicSchool::ARCANE;
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) {