fix(Core/CharmInfo): Adjust how spells are given to charmed creatures. (#20227)

Init.
This commit is contained in:
Benjamin Jackson
2024-10-18 16:42:21 -04:00
committed by GitHub
parent 572be7d69f
commit 7abbca0f5b

View File

@@ -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())
{