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;
if (addonEventCallback_) addonEventCallback_("CURRENT_SPELL_CAST_CHANGED", {});
// Play precast sound with correct magic school (including crafting spells)
if (auto* renderer = core::Application::getInstance().getRenderer()) {
if (auto* ssm = renderer->getSpellSoundManager()) {
loadSpellNameCache();
auto it = spellNameCache_.find(data.spellId);
auto school = (it != spellNameCache_.end() && it->second.schoolMask)
? schoolMaskToMagicSchool(it->second.schoolMask)
: audio::SpellSoundManager::MagicSchool::ARCANE;
ssm->playPrecast(school, audio::SpellSoundManager::SpellPower::MEDIUM);
// 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* ssm = renderer->getSpellSoundManager()) {
loadSpellNameCache();
auto it = spellNameCache_.find(data.spellId);
auto school = (it != spellNameCache_.end() && it->second.schoolMask)
? 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
if (data.casterUnit == playerGuid) {
// Play cast-complete sound with correct magic school (including crafting)
if (auto* renderer = core::Application::getInstance().getRenderer()) {
if (auto* ssm = renderer->getSpellSoundManager()) {
loadSpellNameCache();
auto it = spellNameCache_.find(data.spellId);
auto school = (it != spellNameCache_.end() && it->second.schoolMask)
? schoolMaskToMagicSchool(it->second.schoolMask)
: audio::SpellSoundManager::MagicSchool::ARCANE;
ssm->playCast(school);
// 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* ssm = renderer->getSpellSoundManager()) {
loadSpellNameCache();
auto it = spellNameCache_.find(data.spellId);
auto school = (it != spellNameCache_.end() && it->second.schoolMask)
? schoolMaskToMagicSchool(it->second.schoolMask)
: audio::SpellSoundManager::MagicSchool::ARCANE;
ssm->playCast(school);
}
}
}
// Instant melee abilities → trigger attack animation
// 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
// abilities generically instead of maintaining a brittle per-spell-ID list.
uint32_t sid = data.spellId;
bool isMeleeAbility = false;
{
if (!isProfessionSpell(sid)) {
loadSpellNameCache();
auto cacheIt = spellNameCache_.find(sid);
if (cacheIt != spellNameCache_.end() && cacheIt->second.schoolMask == 1) {