fix(Core/CharmInfo): Adjust how spells are given to charmed creatures. (#20227)
Init.
This commit is contained in:
@@ -78,21 +78,7 @@ void CharmInfo::InitPossessCreateSpells()
|
|||||||
{
|
{
|
||||||
if (_unit->IsCreature())
|
if (_unit->IsCreature())
|
||||||
{
|
{
|
||||||
// Adding switch until better way is found. Malcrom
|
InitEmptyActionBar(false);
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
|
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 spell_id = 0;
|
||||||
uint32 first_id = 0;
|
uint32 first_id = 0;
|
||||||
|
bool autocastable = false;
|
||||||
|
|
||||||
if (spellInfo)
|
if (spellInfo)
|
||||||
{
|
{
|
||||||
spell_id = spellInfo->Id;
|
spell_id = spellInfo->Id;
|
||||||
first_id = spellInfo->GetFirstRankSpell()->Id;
|
first_id = spellInfo->GetFirstRankSpell()->Id;
|
||||||
|
if (spellInfo->IsAutocastable())
|
||||||
|
autocastable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// new spell rank can be already listed
|
// 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)
|
if (i != index && index <= MAX_UNIT_ACTION_BAR_INDEX)
|
||||||
continue;
|
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())
|
if (_unit->GetCharmer() && _unit->GetCharmer()->IsPlayer())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user