Merge pull request #15920 from Treeston/3.3.5-MCHotkeyPos
Unit/PossessBar: Fix spell ordering on possess bar (cherry picked from commit c703e01471a3598f68051abb17e598e316b744ef)
This commit is contained in:
@@ -11900,7 +11900,7 @@ void CharmInfo::InitPossessCreateSpells()
|
||||
break;
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
|
||||
{
|
||||
uint32 spellId = _unit->ToCreature()->m_spells[i];
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
@@ -11909,7 +11909,7 @@ void CharmInfo::InitPossessCreateSpells()
|
||||
if (spellInfo->IsPassive())
|
||||
_unit->CastSpell(_unit, spellInfo, true);
|
||||
else
|
||||
AddSpellToActionBar(spellInfo, ACT_PASSIVE);
|
||||
AddSpellToActionBar(spellInfo, ACT_PASSIVE, i % MAX_UNIT_ACTION_BAR_INDEX);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11967,11 +11967,12 @@ void CharmInfo::InitCharmCreateSpells()
|
||||
}
|
||||
}
|
||||
|
||||
bool CharmInfo::AddSpellToActionBar(SpellInfo const* spellInfo, ActiveStates newstate)
|
||||
bool CharmInfo::AddSpellToActionBar(SpellInfo const* spellInfo, ActiveStates newstate, uint8 preferredSlot)
|
||||
{
|
||||
uint32 spell_id = spellInfo->Id;
|
||||
uint32 first_id = spellInfo->GetFirstRankSpell()->Id;
|
||||
|
||||
ASSERT(preferredSlot < MAX_UNIT_ACTION_BAR_INDEX);
|
||||
// new spell rank can be already listed
|
||||
for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
|
||||
{
|
||||
@@ -11988,9 +11989,10 @@ bool CharmInfo::AddSpellToActionBar(SpellInfo const* spellInfo, ActiveStates new
|
||||
// or use empty slot in other case
|
||||
for (uint8 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
|
||||
{
|
||||
if (!PetActionBar[i].GetAction() && PetActionBar[i].IsActionBarForSpell())
|
||||
uint8 j = (preferredSlot + i) % MAX_UNIT_ACTION_BAR_INDEX;
|
||||
if (!PetActionBar[j].GetAction() && PetActionBar[j].IsActionBarForSpell())
|
||||
{
|
||||
SetActionBar(i, spell_id, newstate == ACT_DECIDE ? spellInfo->IsAutocastable() ? ACT_DISABLED : ACT_PASSIVE : newstate);
|
||||
SetActionBar(j, spell_id, newstate == ACT_DECIDE ? spellInfo->IsAutocastable() ? ACT_DISABLED : ACT_PASSIVE : newstate);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1209,7 +1209,7 @@ struct CharmInfo
|
||||
void InitEmptyActionBar(bool withAttack = true);
|
||||
|
||||
//return true if successful
|
||||
bool AddSpellToActionBar(SpellInfo const* spellInfo, ActiveStates newstate = ACT_DECIDE);
|
||||
bool AddSpellToActionBar(SpellInfo const* spellInfo, ActiveStates newstate = ACT_DECIDE, uint8 preferredSlot = 0);
|
||||
bool RemoveSpellFromActionBar(uint32 spell_id);
|
||||
void LoadPetActionBar(const std::string& data);
|
||||
void BuildActionBar(WorldPacket* data);
|
||||
|
||||
Reference in New Issue
Block a user