Core/Spells: ported helper function from 3f28fd304d833eadefff8d343ab45caf8d0575c2
Core/Spells: Reimplemented automatic spell learning
This commit is contained in:
1 parent
87f25be0aa
commit
badef62df4
3 files changed
+20
-22
No files matched your search
@@ -353,7 +353,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
|
||||
}
|
||||
|
||||
Unit* caster = mover;
|
||||
if (caster->GetTypeId() == TYPEID_UNIT && !caster->ToCreature()->HasSpell(spellId))
|
||||
if (caster->GetTypeId() == TYPEID_UNIT && !caster->ToCreature()->HasSpell(spellInfo->Id))
|
||||
{
|
||||
// If the vehicle creature does not have the spell but it allows the passenger to cast own spells
|
||||
// change caster to player and let him cast
|
||||
@@ -366,33 +366,15 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
|
||||
caster = _player;
|
||||
}
|
||||
|
||||
if (caster->GetTypeId() == TYPEID_PLAYER && !caster->ToPlayer()->HasActiveSpell(spellId))
|
||||
if (caster->GetTypeId() == TYPEID_PLAYER && !caster->ToPlayer()->HasActiveSpell(spellInfo->Id))
|
||||
{
|
||||
// not have spell in spellbook
|
||||
recvPacket.rfinish(); // prevent spam at ignore packet
|
||||
return;
|
||||
}
|
||||
|
||||
Unit::AuraEffectList swaps = mover->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS);
|
||||
Unit::AuraEffectList const& swaps2 = mover->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_2);
|
||||
if (!swaps2.empty())
|
||||
swaps.insert(swaps.end(), swaps2.begin(), swaps2.end());
|
||||
|
||||
if (!swaps.empty())
|
||||
{
|
||||
for (Unit::AuraEffectList::const_iterator itr = swaps.begin(); itr != swaps.end(); ++itr)
|
||||
{
|
||||
if ((*itr)->IsAffectingSpell(spellInfo))
|
||||
{
|
||||
if (SpellInfo const* newInfo = sSpellMgr->GetSpellInfo((*itr)->GetAmount()))
|
||||
{
|
||||
spellInfo = newInfo;
|
||||
spellId = newInfo->Id;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Check possible spell cast overrides
|
||||
spellInfo = caster->GetCastSpellInfo(spellInfo);
|
||||
|
||||
// Client is resending autoshot cast opcode when other spell is cast during shoot rotation
|
||||
// Skip it to prevent "interrupt" message
|
||||
|
||||
Reference in new issue
Block a user