* Don't allow pets to attack in melee if owner is pacified. This applies for possessed "pets" as well.
* Use proper spell ID in unsummoning possessed units on channeling interrupt. * Allow only once to init pet bar for CharmInfo * Export CharmInfo to be available to scripts * Allow to disable the melee attack command when initializing the pet action bar --HG-- branch : trunk
This commit is contained in:
+22
-13
@@ -3421,15 +3421,8 @@ void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id)
|
||||
// channeled spells are interrupted if they are not finished, even if they are delayed
|
||||
if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spell_id))
|
||||
{
|
||||
if (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED)
|
||||
m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
|
||||
m_currentSpells[CURRENT_CHANNELED_SPELL]->SetReferencedFromCurrent(false);
|
||||
m_currentSpells[CURRENT_CHANNELED_SPELL] = NULL;
|
||||
|
||||
// Unsummon any summoned as possessed creatures on channel interrupt
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
|
||||
if (!spellInfo || !interrupted)
|
||||
return;
|
||||
SpellEntry const *spellInfo = m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
if (spellInfo->Effect[i] == SPELL_EFFECT_SUMMON &&
|
||||
@@ -3442,6 +3435,11 @@ void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id)
|
||||
((TemporarySummon*)GetCharm())->UnSummon();
|
||||
}
|
||||
}
|
||||
|
||||
if (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED)
|
||||
m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
|
||||
m_currentSpells[CURRENT_CHANNELED_SPELL]->SetReferencedFromCurrent(false);
|
||||
m_currentSpells[CURRENT_CHANNELED_SPELL] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9820,7 +9818,7 @@ CharmInfo* Unit::InitCharmInfo(Unit *charm)
|
||||
}
|
||||
|
||||
CharmInfo::CharmInfo(Unit* unit)
|
||||
: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0)
|
||||
: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0), m_barInit(false)
|
||||
{
|
||||
for(int i =0; i<4; ++i)
|
||||
{
|
||||
@@ -9831,6 +9829,9 @@ CharmInfo::CharmInfo(Unit* unit)
|
||||
|
||||
void CharmInfo::InitPetActionBar()
|
||||
{
|
||||
if (m_barInit)
|
||||
return;
|
||||
|
||||
// the first 3 SpellOrActions are attack, follow and stay
|
||||
for(uint32 i = 0; i < 3; i++)
|
||||
{
|
||||
@@ -9845,17 +9846,25 @@ void CharmInfo::InitPetActionBar()
|
||||
PetActionBar[i + 3].Type = ACT_DISABLED;
|
||||
PetActionBar[i + 3].SpellOrAction = 0;
|
||||
}
|
||||
m_barInit = true;
|
||||
}
|
||||
|
||||
void CharmInfo::InitEmptyActionBar()
|
||||
void CharmInfo::InitEmptyActionBar(bool withAttack)
|
||||
{
|
||||
for(uint32 x = 1; x < 10; ++x)
|
||||
if (m_barInit)
|
||||
return;
|
||||
|
||||
for(uint32 x = 0; x < 10; ++x)
|
||||
{
|
||||
PetActionBar[x].Type = ACT_CAST;
|
||||
PetActionBar[x].SpellOrAction = 0;
|
||||
}
|
||||
PetActionBar[0].Type = ACT_COMMAND;
|
||||
PetActionBar[0].SpellOrAction = COMMAND_ATTACK;
|
||||
if (withAttack)
|
||||
{
|
||||
PetActionBar[0].Type = ACT_COMMAND;
|
||||
PetActionBar[0].SpellOrAction = COMMAND_ATTACK;
|
||||
}
|
||||
m_barInit = true;
|
||||
}
|
||||
|
||||
void CharmInfo::InitPossessCreateSpells()
|
||||
|
||||
Reference in New Issue
Block a user