From 7abbca0f5b4ab3a15d78db7ec40e3b4358bed7da Mon Sep 17 00:00:00 2001 From: Benjamin Jackson <38561765+heyitsbench@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:42:21 -0400 Subject: [PATCH] fix(Core/CharmInfo): Adjust how spells are given to charmed creatures. (#20227) Init. --- src/server/game/Entities/Unit/CharmInfo.cpp | 24 +++++++-------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/server/game/Entities/Unit/CharmInfo.cpp b/src/server/game/Entities/Unit/CharmInfo.cpp index 425d15579..8a4c6d761 100644 --- a/src/server/game/Entities/Unit/CharmInfo.cpp +++ b/src/server/game/Entities/Unit/CharmInfo.cpp @@ -78,21 +78,7 @@ void CharmInfo::InitPossessCreateSpells() { if (_unit->IsCreature()) { - // Adding switch until better way is found. Malcrom - // Adding entrys to this switch will prevent COMMAND_ATTACK being added to pet bar. - switch (_unit->GetEntry()) - { - case 23575: // Mindless Abomination - case 24783: // Trained Rock Falcon - case 27664: // Crashin' Thrashin' Racer - case 40281: // Crashin' Thrashin' Racer - case 23109: // Vengeful Spirit - case 25653: // Power of the Blue Flight - break; - default: - InitEmptyActionBar(); - break; - } + InitEmptyActionBar(false); for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i) { @@ -160,11 +146,14 @@ bool CharmInfo::AddSpellToActionBar(SpellInfo const* spellInfo, ActiveStates new { uint32 spell_id = 0; uint32 first_id = 0; + bool autocastable = false; if (spellInfo) { spell_id = spellInfo->Id; first_id = spellInfo->GetFirstRankSpell()->Id; + if (spellInfo->IsAutocastable()) + autocastable = true; } // new spell rank can be already listed @@ -188,7 +177,10 @@ bool CharmInfo::AddSpellToActionBar(SpellInfo const* spellInfo, ActiveStates new if (i != index && index <= MAX_UNIT_ACTION_BAR_INDEX) continue; - SetActionBar(i, spell_id, newstate == ACT_DECIDE ? spellInfo->IsAutocastable() ? ACT_DISABLED : ACT_PASSIVE : newstate); + if (!spell_id && index == ACTION_BAR_INDEX_START) + SetActionBar(ACTION_BAR_INDEX_START, COMMAND_ATTACK, ACT_COMMAND); + else + SetActionBar(i, spell_id, newstate == ACT_DECIDE ? autocastable ? ACT_DISABLED : ACT_PASSIVE : newstate); if (_unit->GetCharmer() && _unit->GetCharmer()->IsPlayer()) {